whosawhatsis 11 роки тому
джерело
коміт
d24df7af2c
4 змінених файлів з 47 додано та 1 видалено
  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 Переглянути файл

@@ -202,6 +202,7 @@ extern float homing_feedrate[];
202 202
 extern bool axis_relative_modes[];
203 203
 extern int feedmultiply;
204 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 206
 extern float current_position[NUM_AXIS] ;
206 207
 extern float add_homeing[3];
207 208
 #ifdef DELTA

+ 35
- 0
Marlin/Marlin_main.cpp Переглянути файл

@@ -188,6 +188,14 @@ bool axis_relative_modes[] = AXIS_RELATIVE_MODES;
188 188
 int feedmultiply=100; //100->1 200->2
189 189
 int saved_feedmultiply;
190 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 199
 float current_position[NUM_AXIS] = { 0.0, 0.0, 0.0, 0.0 };
192 200
 float add_homeing[3]={0,0,0};
193 201
 #ifdef DELTA
@@ -2190,6 +2198,33 @@ void process_commands()
2190 2198
       }
2191 2199
       break;
2192 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 2228
     case 201: // M201
2194 2229
       for(int8_t i=0; i < NUM_AXIS; i++)
2195 2230
       {

+ 9
- 0
Marlin/language.h Переглянути файл

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

+ 2
- 1
Marlin/planner.cpp Переглянути файл

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

Завантаження…
Відмінити
Зберегти