Browse Source

M200 implementation

pull/1/head
whosawhatsis 11 years ago
parent
commit
d24df7af2c
  1. 1
      Marlin/Marlin.h
  2. 35
      Marlin/Marlin_main.cpp
  3. 9
      Marlin/language.h
  4. 3
      Marlin/planner.cpp

1
Marlin/Marlin.h

@ -202,6 +202,7 @@ extern float homing_feedrate[];
extern bool axis_relative_modes[]; extern bool axis_relative_modes[];
extern int feedmultiply; extern int feedmultiply;
extern int extrudemultiply; // Sets extrude multiply factor (in percent) extern int extrudemultiply; // Sets extrude multiply factor (in percent)
extern float filament_area[EXTRUDERS]; // cross-sectional area of filament (in cubic millimeters)
extern float current_position[NUM_AXIS] ; extern float current_position[NUM_AXIS] ;
extern float add_homeing[3]; extern float add_homeing[3];
#ifdef DELTA #ifdef DELTA

35
Marlin/Marlin_main.cpp

@ -188,6 +188,14 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
int feedmultiply=100; //100->1 200->2 int feedmultiply=100; //100->1 200->2
int saved_feedmultiply; int saved_feedmultiply;
int extrudemultiply=100; //100->1 200->2 int extrudemultiply=100; //100->1 200->2
float filament_area[EXTRUDERS] = {1.0
#if EXTRUDERS > 1
, 1.0
#if EXTRUDERS > 2
, 1.0
#endif
#endif
};
float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 }; float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
float add_homeing[3]={0,0,0}; float add_homeing[3]={0,0,0};
#ifdef DELTA #ifdef DELTA
@ -2190,6 +2198,33 @@ void process_commands()
} }
break; break;
#endif //BLINKM #endif //BLINKM
case 200: // M200 S<millimeters> set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
{
float area;
if(code_seen('S')) {
float radius = code_value() / 2;
if(radius == 0) {
area = 1;
} else {
area = M_PI * pow(radius, 2);
}
} else {
//reserved for setting filament diameter via UFID or filament measuring device
break;
}
tmp_extruder = active_extruder;
if(code_seen('T')) {
tmp_extruder = code_value();
if(tmp_extruder >= EXTRUDERS) {
SERIAL_ECHO_START;
SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER);
}
SERIAL_ECHOLN(tmp_extruder);
break;
}
filament_area[tmp_extruder] = area;
}
break;
case 201: // M201 case 201: // M201
for(int8_t i=0; i < NUM_AXIS; i++) for(int8_t i=0; i < NUM_AXIS; i++)
{ {

9
Marlin/language.h

@ -163,6 +163,7 @@
#define MSG_END_FILE_LIST "End file list" #define MSG_END_FILE_LIST "End file list"
#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder " #define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder " #define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
#define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder "
#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder " #define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder " #define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
@ -331,6 +332,7 @@
#define MSG_END_FILE_LIST "Koniec listy plikow" #define MSG_END_FILE_LIST "Koniec listy plikow"
#define MSG_M104_INVALID_EXTRUDER "M104 Niepoprawny ekstruder " #define MSG_M104_INVALID_EXTRUDER "M104 Niepoprawny ekstruder "
#define MSG_M105_INVALID_EXTRUDER "M105 Niepoprawny ekstruder " #define MSG_M105_INVALID_EXTRUDER "M105 Niepoprawny ekstruder "
#define MSG_M200_INVALID_EXTRUDER "M200 Niepoprawny ekstruder "
#define MSG_M218_INVALID_EXTRUDER "M218 Niepoprawny ekstruder " #define MSG_M218_INVALID_EXTRUDER "M218 Niepoprawny ekstruder "
#define MSG_ERR_NO_THERMISTORS "Brak termistorow - brak temperatury :(" #define MSG_ERR_NO_THERMISTORS "Brak termistorow - brak temperatury :("
#define MSG_M109_INVALID_EXTRUDER "M109 Niepoprawny ekstruder " #define MSG_M109_INVALID_EXTRUDER "M109 Niepoprawny ekstruder "
@ -498,6 +500,7 @@
#define MSG_END_FILE_LIST "Fin de la liste de fichiers" #define MSG_END_FILE_LIST "Fin de la liste de fichiers"
#define MSG_M104_INVALID_EXTRUDER "M104 Extruder invalide" #define MSG_M104_INVALID_EXTRUDER "M104 Extruder invalide"
#define MSG_M105_INVALID_EXTRUDER "M105 Extruder invalide" #define MSG_M105_INVALID_EXTRUDER "M105 Extruder invalide"
#define MSG_M200_INVALID_EXTRUDER "M200 Extruder invalide"
#define MSG_M218_INVALID_EXTRUDER "M218 Extruder invalide" #define MSG_M218_INVALID_EXTRUDER "M218 Extruder invalide"
#define MSG_ERR_NO_THERMISTORS "Pas de thermistor, pas de temperature" #define MSG_ERR_NO_THERMISTORS "Pas de thermistor, pas de temperature"
#define MSG_M109_INVALID_EXTRUDER "M109 Extruder invalide " #define MSG_M109_INVALID_EXTRUDER "M109 Extruder invalide "
@ -668,6 +671,7 @@
#define MSG_END_FILE_LIST "End file list" #define MSG_END_FILE_LIST "End file list"
#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder " #define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder " #define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
#define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder "
#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder " #define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
#define MSG_ERR_NO_THERMISTORS "No thermistors - no temp" #define MSG_ERR_NO_THERMISTORS "No thermistors - no temp"
#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder " #define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
@ -842,6 +846,7 @@
#define MSG_END_FILE_LIST "Fin de la lista de archivos" #define MSG_END_FILE_LIST "Fin de la lista de archivos"
#define MSG_M104_INVALID_EXTRUDER "M104 Extrusor Invalido " #define MSG_M104_INVALID_EXTRUDER "M104 Extrusor Invalido "
#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor Invalido " #define MSG_M105_INVALID_EXTRUDER "M105 Extrusor Invalido "
#define MSG_M200_INVALID_EXTRUDER "M200 Extrusor Invalido "
#define MSG_M218_INVALID_EXTRUDER "M218 Extrusor Invalido " #define MSG_M218_INVALID_EXTRUDER "M218 Extrusor Invalido "
#define MSG_ERR_NO_THERMISTORS "No hay termistores - no temp" #define MSG_ERR_NO_THERMISTORS "No hay termistores - no temp"
#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor Invalido " #define MSG_M109_INVALID_EXTRUDER "M109 Extrusor Invalido "
@ -1006,6 +1011,7 @@
#define MSG_END_FILE_LIST "Конец списка файлов" #define MSG_END_FILE_LIST "Конец списка файлов"
#define MSG_M104_INVALID_EXTRUDER "M104 ошибка экструдера " #define MSG_M104_INVALID_EXTRUDER "M104 ошибка экструдера "
#define MSG_M105_INVALID_EXTRUDER "M105 ошибка экструдера " #define MSG_M105_INVALID_EXTRUDER "M105 ошибка экструдера "
#define MSG_M200_INVALID_EXTRUDER "M200 ошибка экструдера "
#define MSG_M218_INVALID_EXTRUDER "M218 ошибка экструдера " #define MSG_M218_INVALID_EXTRUDER "M218 ошибка экструдера "
#define MSG_ERR_NO_THERMISTORS "Нет термистра - нет температуры" #define MSG_ERR_NO_THERMISTORS "Нет термистра - нет температуры"
#define MSG_M109_INVALID_EXTRUDER "M109 ошибка экструдера " #define MSG_M109_INVALID_EXTRUDER "M109 ошибка экструдера "
@ -1170,6 +1176,7 @@
#define MSG_END_FILE_LIST "Fine Lista File" #define MSG_END_FILE_LIST "Fine Lista File"
#define MSG_M104_INVALID_EXTRUDER "M104 Estrusore non valido " #define MSG_M104_INVALID_EXTRUDER "M104 Estrusore non valido "
#define MSG_M105_INVALID_EXTRUDER "M105 Estrusore non valido " #define MSG_M105_INVALID_EXTRUDER "M105 Estrusore non valido "
#define MSG_M200_INVALID_EXTRUDER "M200 Estrusore non valido "
#define MSG_M218_INVALID_EXTRUDER "M218 Estrusore non valido " #define MSG_M218_INVALID_EXTRUDER "M218 Estrusore non valido "
#define MSG_ERR_NO_THERMISTORS "Nessun Termistore - nessuna temperatura" #define MSG_ERR_NO_THERMISTORS "Nessun Termistore - nessuna temperatura"
#define MSG_M109_INVALID_EXTRUDER "M109 Estrusore non valido " #define MSG_M109_INVALID_EXTRUDER "M109 Estrusore non valido "
@ -1343,6 +1350,7 @@
#define MSG_END_FILE_LIST "Fim da lista de arquivos" #define MSG_END_FILE_LIST "Fim da lista de arquivos"
#define MSG_M104_INVALID_EXTRUDER "M104 Extrusor inválido " #define MSG_M104_INVALID_EXTRUDER "M104 Extrusor inválido "
#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor inválido " #define MSG_M105_INVALID_EXTRUDER "M105 Extrusor inválido "
#define MSG_M200_INVALID_EXTRUDER "M200 Extrusor inválido "
#define MSG_M218_INVALID_EXTRUDER "M218 Extrusor inválido " #define MSG_M218_INVALID_EXTRUDER "M218 Extrusor inválido "
#define MSG_ERR_NO_THERMISTORS "Nao ha termistor - no temp" #define MSG_ERR_NO_THERMISTORS "Nao ha termistor - no temp"
#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor inválido " #define MSG_M109_INVALID_EXTRUDER "M109 Extrusor inválido "
@ -1512,6 +1520,7 @@
#define MSG_END_FILE_LIST "Tiedostolistauksen loppu" #define MSG_END_FILE_LIST "Tiedostolistauksen loppu"
#define MSG_M104_INVALID_EXTRUDER "M104 Virheellinen suutin " #define MSG_M104_INVALID_EXTRUDER "M104 Virheellinen suutin "
#define MSG_M105_INVALID_EXTRUDER "M105 Virheellinen suutin " #define MSG_M105_INVALID_EXTRUDER "M105 Virheellinen suutin "
#define MSG_M200_INVALID_EXTRUDER "M200 Virheellinen suutin "
#define MSG_M218_INVALID_EXTRUDER "M218 Virheellinen suutin " #define MSG_M218_INVALID_EXTRUDER "M218 Virheellinen suutin "
#define MSG_ERR_NO_THERMISTORS "Ei termistoreja - ei lampotiloja" #define MSG_ERR_NO_THERMISTORS "Ei termistoreja - ei lampotiloja"
#define MSG_M109_INVALID_EXTRUDER "M109 Virheellinen suutin " #define MSG_M109_INVALID_EXTRUDER "M109 Virheellinen suutin "

3
Marlin/planner.cpp

@ -593,6 +593,7 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
#endif #endif
block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]); block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]);
block->steps_e = labs(target[E_AXIS]-position[E_AXIS]); block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
block->steps_e *= filament_area[active_extruder];
block->steps_e *= extrudemultiply; block->steps_e *= extrudemultiply;
block->steps_e /= 100; block->steps_e /= 100;
block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e))); block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e)));
@ -682,7 +683,7 @@ block->steps_y = labs((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-positi
delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS]; delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS];
#endif #endif
delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS]; delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*extrudemultiply/100.0; delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*filament_area[active_extruder]*extrudemultiply/100.0;
if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments ) if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments )
{ {
block->millimeters = fabs(delta_mm[E_AXIS]); block->millimeters = fabs(delta_mm[E_AXIS]);

Loading…
Cancel
Save