Browse Source

M200 implementation

whosawhatsis 11 years ago
parent
commit
d24df7af2c
4 changed files with 47 additions and 1 deletions
  1. 1
    0
      Marlin/Marlin.h
  2. 35
    0
      Marlin/Marlin_main.cpp
  3. 9
    0
      Marlin/language.h
  4. 2
    1
      Marlin/planner.cpp

+ 1
- 0
Marlin/Marlin.h View File

202
 extern bool axis_relative_modes[];
202
 extern bool axis_relative_modes[];
203
 extern int feedmultiply;
203
 extern int feedmultiply;
204
 extern int extrudemultiply; // Sets extrude multiply factor (in percent)
204
 extern int extrudemultiply; // Sets extrude multiply factor (in percent)
205
+extern float filament_area[EXTRUDERS]; // cross-sectional area of filament (in cubic millimeters)
205
 extern float current_position[NUM_AXIS] ;
206
 extern float current_position[NUM_AXIS] ;
206
 extern float add_homeing[3];
207
 extern float add_homeing[3];
207
 #ifdef DELTA
208
 #ifdef DELTA

+ 35
- 0
Marlin/Marlin_main.cpp View File

188
 int feedmultiply=100; //100->1 200->2
188
 int feedmultiply=100; //100->1 200->2
189
 int saved_feedmultiply;
189
 int saved_feedmultiply;
190
 int extrudemultiply=100; //100->1 200->2
190
 int extrudemultiply=100; //100->1 200->2
191
+float filament_area[EXTRUDERS] = {1.0
192
+  #if EXTRUDERS > 1
193
+    , 1.0
194
+    #if EXTRUDERS > 2
195
+      , 1.0
196
+    #endif
197
+  #endif
198
+};
191
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
199
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
192
 float add_homeing[3]={0,0,0};
200
 float add_homeing[3]={0,0,0};
193
 #ifdef DELTA
201
 #ifdef DELTA
2190
       }
2198
       }
2191
       break;
2199
       break;
2192
     #endif //BLINKM
2200
     #endif //BLINKM
2201
+    case 200: // M200 S<millimeters> set filament diameter and set E axis units to cubic millimeters (use S0 to set back to millimeters).
2202
+      {
2203
+        float area;
2204
+        if(code_seen('S')) {
2205
+          float radius = code_value() / 2;
2206
+          if(radius == 0) {
2207
+            area = 1;
2208
+          } else {
2209
+            area = M_PI * pow(radius, 2);
2210
+          }
2211
+        } else {
2212
+          //reserved for setting filament diameter via UFID or filament measuring device
2213
+          break;
2214
+        }
2215
+        tmp_extruder = active_extruder;
2216
+        if(code_seen('T')) {
2217
+          tmp_extruder = code_value();
2218
+          if(tmp_extruder >= EXTRUDERS) {
2219
+            SERIAL_ECHO_START;
2220
+            SERIAL_ECHO(MSG_M200_INVALID_EXTRUDER);
2221
+          }
2222
+          SERIAL_ECHOLN(tmp_extruder);
2223
+          break;
2224
+        }
2225
+        filament_area[tmp_extruder] = area;
2226
+      }
2227
+      break;
2193
     case 201: // M201
2228
     case 201: // M201
2194
       for(int8_t i=0; i < NUM_AXIS; i++)
2229
       for(int8_t i=0; i < NUM_AXIS; i++)
2195
       {
2230
       {

+ 9
- 0
Marlin/language.h View File

163
 	#define MSG_END_FILE_LIST "End file list"
163
 	#define MSG_END_FILE_LIST "End file list"
164
 	#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
164
 	#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
165
 	#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
165
 	#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
166
+	#define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder "
166
 	#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
167
 	#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
167
 	#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
168
 	#define MSG_ERR_NO_THERMISTORS "No thermistors - no temperature"
168
 	#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
169
 	#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
331
 	#define MSG_END_FILE_LIST "Koniec listy plikow"
332
 	#define MSG_END_FILE_LIST "Koniec listy plikow"
332
 	#define MSG_M104_INVALID_EXTRUDER "M104 Niepoprawny ekstruder "
333
 	#define MSG_M104_INVALID_EXTRUDER "M104 Niepoprawny ekstruder "
333
 	#define MSG_M105_INVALID_EXTRUDER "M105 Niepoprawny ekstruder "
334
 	#define MSG_M105_INVALID_EXTRUDER "M105 Niepoprawny ekstruder "
335
+	#define MSG_M200_INVALID_EXTRUDER "M200 Niepoprawny ekstruder "
334
 	#define MSG_M218_INVALID_EXTRUDER "M218 Niepoprawny ekstruder "
336
 	#define MSG_M218_INVALID_EXTRUDER "M218 Niepoprawny ekstruder "
335
 	#define MSG_ERR_NO_THERMISTORS "Brak termistorow - brak temperatury :("
337
 	#define MSG_ERR_NO_THERMISTORS "Brak termistorow - brak temperatury :("
336
 	#define MSG_M109_INVALID_EXTRUDER "M109 Niepoprawny ekstruder "
338
 	#define MSG_M109_INVALID_EXTRUDER "M109 Niepoprawny ekstruder "
498
 	#define MSG_END_FILE_LIST "Fin de la liste de fichiers"
500
 	#define MSG_END_FILE_LIST "Fin de la liste de fichiers"
499
 	#define MSG_M104_INVALID_EXTRUDER "M104 Extruder invalide"
501
 	#define MSG_M104_INVALID_EXTRUDER "M104 Extruder invalide"
500
 	#define MSG_M105_INVALID_EXTRUDER "M105 Extruder invalide"
502
 	#define MSG_M105_INVALID_EXTRUDER "M105 Extruder invalide"
503
+	#define MSG_M200_INVALID_EXTRUDER "M200 Extruder invalide"
501
 	#define MSG_M218_INVALID_EXTRUDER "M218 Extruder invalide"
504
 	#define MSG_M218_INVALID_EXTRUDER "M218 Extruder invalide"
502
 	#define MSG_ERR_NO_THERMISTORS "Pas de thermistor, pas de temperature"
505
 	#define MSG_ERR_NO_THERMISTORS "Pas de thermistor, pas de temperature"
503
 	#define MSG_M109_INVALID_EXTRUDER "M109 Extruder invalide "
506
 	#define MSG_M109_INVALID_EXTRUDER "M109 Extruder invalide "
668
 	#define MSG_END_FILE_LIST "End file list"
671
 	#define MSG_END_FILE_LIST "End file list"
669
 	#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
672
 	#define MSG_M104_INVALID_EXTRUDER "M104 Invalid extruder "
670
 	#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
673
 	#define MSG_M105_INVALID_EXTRUDER "M105 Invalid extruder "
674
+	#define MSG_M200_INVALID_EXTRUDER "M200 Invalid extruder "
671
 	#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
675
 	#define MSG_M218_INVALID_EXTRUDER "M218 Invalid extruder "
672
 	#define MSG_ERR_NO_THERMISTORS "No thermistors - no temp"
676
 	#define MSG_ERR_NO_THERMISTORS "No thermistors - no temp"
673
 	#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
677
 	#define MSG_M109_INVALID_EXTRUDER "M109 Invalid extruder "
842
 	#define MSG_END_FILE_LIST "Fin de la lista de archivos"
846
 	#define MSG_END_FILE_LIST "Fin de la lista de archivos"
843
 	#define MSG_M104_INVALID_EXTRUDER "M104 Extrusor Invalido "
847
 	#define MSG_M104_INVALID_EXTRUDER "M104 Extrusor Invalido "
844
 	#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor Invalido "
848
 	#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor Invalido "
849
+	#define MSG_M200_INVALID_EXTRUDER "M200 Extrusor Invalido "
845
 	#define MSG_M218_INVALID_EXTRUDER "M218 Extrusor Invalido "
850
 	#define MSG_M218_INVALID_EXTRUDER "M218 Extrusor Invalido "
846
 	#define MSG_ERR_NO_THERMISTORS "No hay termistores - no temp"
851
 	#define MSG_ERR_NO_THERMISTORS "No hay termistores - no temp"
847
 	#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor Invalido "
852
 	#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor Invalido "
1006
 	#define MSG_END_FILE_LIST					"Конец списка файлов"
1011
 	#define MSG_END_FILE_LIST					"Конец списка файлов"
1007
 	#define MSG_M104_INVALID_EXTRUDER			"M104 ошибка экструдера "
1012
 	#define MSG_M104_INVALID_EXTRUDER			"M104 ошибка экструдера "
1008
 	#define MSG_M105_INVALID_EXTRUDER			"M105 ошибка экструдера "
1013
 	#define MSG_M105_INVALID_EXTRUDER			"M105 ошибка экструдера "
1014
+	#define MSG_M200_INVALID_EXTRUDER			"M200 ошибка экструдера "
1009
 	#define MSG_M218_INVALID_EXTRUDER			"M218 ошибка экструдера "
1015
 	#define MSG_M218_INVALID_EXTRUDER			"M218 ошибка экструдера "
1010
 	#define MSG_ERR_NO_THERMISTORS				"Нет термистра - нет температуры"
1016
 	#define MSG_ERR_NO_THERMISTORS				"Нет термистра - нет температуры"
1011
 	#define MSG_M109_INVALID_EXTRUDER			"M109 ошибка экструдера "
1017
 	#define MSG_M109_INVALID_EXTRUDER			"M109 ошибка экструдера "
1170
 	#define MSG_END_FILE_LIST        "Fine Lista File"
1176
 	#define MSG_END_FILE_LIST        "Fine Lista File"
1171
 	#define MSG_M104_INVALID_EXTRUDER "M104 Estrusore non valido "
1177
 	#define MSG_M104_INVALID_EXTRUDER "M104 Estrusore non valido "
1172
 	#define MSG_M105_INVALID_EXTRUDER "M105 Estrusore non valido "
1178
 	#define MSG_M105_INVALID_EXTRUDER "M105 Estrusore non valido "
1179
+	#define MSG_M200_INVALID_EXTRUDER "M200 Estrusore non valido "
1173
 	#define MSG_M218_INVALID_EXTRUDER "M218 Estrusore non valido "
1180
 	#define MSG_M218_INVALID_EXTRUDER "M218 Estrusore non valido "
1174
 	#define MSG_ERR_NO_THERMISTORS   "Nessun Termistore - nessuna temperatura"
1181
 	#define MSG_ERR_NO_THERMISTORS   "Nessun Termistore - nessuna temperatura"
1175
 	#define MSG_M109_INVALID_EXTRUDER "M109 Estrusore non valido "
1182
 	#define MSG_M109_INVALID_EXTRUDER "M109 Estrusore non valido "
1343
 	#define MSG_END_FILE_LIST "Fim da lista de arquivos"
1350
 	#define MSG_END_FILE_LIST "Fim da lista de arquivos"
1344
 	#define MSG_M104_INVALID_EXTRUDER "M104 Extrusor inválido "
1351
 	#define MSG_M104_INVALID_EXTRUDER "M104 Extrusor inválido "
1345
 	#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor inválido "
1352
 	#define MSG_M105_INVALID_EXTRUDER "M105 Extrusor inválido "
1353
+	#define MSG_M200_INVALID_EXTRUDER "M200 Extrusor inválido "
1346
 	#define MSG_M218_INVALID_EXTRUDER "M218 Extrusor inválido "
1354
 	#define MSG_M218_INVALID_EXTRUDER "M218 Extrusor inválido "
1347
 	#define MSG_ERR_NO_THERMISTORS "Nao ha termistor - no temp"
1355
 	#define MSG_ERR_NO_THERMISTORS "Nao ha termistor - no temp"
1348
 	#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor inválido "
1356
 	#define MSG_M109_INVALID_EXTRUDER "M109 Extrusor inválido "
1512
 	#define MSG_END_FILE_LIST "Tiedostolistauksen loppu"
1520
 	#define MSG_END_FILE_LIST "Tiedostolistauksen loppu"
1513
 	#define MSG_M104_INVALID_EXTRUDER "M104 Virheellinen suutin "
1521
 	#define MSG_M104_INVALID_EXTRUDER "M104 Virheellinen suutin "
1514
 	#define MSG_M105_INVALID_EXTRUDER "M105 Virheellinen suutin "
1522
 	#define MSG_M105_INVALID_EXTRUDER "M105 Virheellinen suutin "
1523
+	#define MSG_M200_INVALID_EXTRUDER "M200 Virheellinen suutin "
1515
 	#define MSG_M218_INVALID_EXTRUDER "M218 Virheellinen suutin "
1524
 	#define MSG_M218_INVALID_EXTRUDER "M218 Virheellinen suutin "
1516
 	#define MSG_ERR_NO_THERMISTORS "Ei termistoreja - ei lampotiloja"
1525
 	#define MSG_ERR_NO_THERMISTORS "Ei termistoreja - ei lampotiloja"
1517
 	#define MSG_M109_INVALID_EXTRUDER "M109 Virheellinen suutin "
1526
 	#define MSG_M109_INVALID_EXTRUDER "M109 Virheellinen suutin "

+ 2
- 1
Marlin/planner.cpp View File

593
 #endif
593
 #endif
594
   block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]);
594
   block->steps_z = labs(target[Z_AXIS]-position[Z_AXIS]);
595
   block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
595
   block->steps_e = labs(target[E_AXIS]-position[E_AXIS]);
596
+  block->steps_e *= filament_area[active_extruder];
596
   block->steps_e *= extrudemultiply;
597
   block->steps_e *= extrudemultiply;
597
   block->steps_e /= 100;
598
   block->steps_e /= 100;
598
   block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e)));
599
   block->step_event_count = max(block->steps_x, max(block->steps_y, max(block->steps_z, block->steps_e)));
682
     delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS];
683
     delta_mm[Y_AXIS] = ((target[X_AXIS]-position[X_AXIS]) - (target[Y_AXIS]-position[Y_AXIS]))/axis_steps_per_unit[Y_AXIS];
683
   #endif
684
   #endif
684
   delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
685
   delta_mm[Z_AXIS] = (target[Z_AXIS]-position[Z_AXIS])/axis_steps_per_unit[Z_AXIS];
685
-  delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*extrudemultiply/100.0;
686
+  delta_mm[E_AXIS] = ((target[E_AXIS]-position[E_AXIS])/axis_steps_per_unit[E_AXIS])*filament_area[active_extruder]*extrudemultiply/100.0;
686
   if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments )
687
   if ( block->steps_x <=dropsegments && block->steps_y <=dropsegments && block->steps_z <=dropsegments )
687
   {
688
   {
688
     block->millimeters = fabs(delta_mm[E_AXIS]);
689
     block->millimeters = fabs(delta_mm[E_AXIS]);

Loading…
Cancel
Save