Browse Source

Merge pull request #3568 from thinkyhead/rc_various_fixes

General code cleanup, improved naming, etc.
Scott Lahteine 8 years ago
parent
commit
3db5a75f30
5 changed files with 111 additions and 84 deletions
  1. 5
    6
      Marlin/Marlin.h
  2. 94
    64
      Marlin/Marlin_main.cpp
  3. 4
    4
      Marlin/planner.cpp
  4. 3
    5
      Marlin/temperature.cpp
  5. 5
    5
      Marlin/ultralcd.cpp

+ 5
- 6
Marlin/Marlin.h View File

223
 void reset_bed_level();
223
 void reset_bed_level();
224
 void prepare_move();
224
 void prepare_move();
225
 void kill(const char*);
225
 void kill(const char*);
226
-void Stop();
227
 
226
 
228
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
227
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
229
-  void filrunout();
228
+  void handle_filament_runout();
230
 #endif
229
 #endif
231
 
230
 
232
 /**
231
 /**
275
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
274
 extern float volumetric_multiplier[EXTRUDERS]; // reciprocal of cross-sectional area of filament (in square millimeters), stored this way to reduce computational burden in planner
276
 extern float current_position[NUM_AXIS];
275
 extern float current_position[NUM_AXIS];
277
 extern float home_offset[3]; // axis[n].home_offset
276
 extern float home_offset[3]; // axis[n].home_offset
278
-extern float min_pos[3]; // axis[n].min_pos
279
-extern float max_pos[3]; // axis[n].max_pos
277
+extern float sw_endstop_min[3]; // axis[n].sw_endstop_min
278
+extern float sw_endstop_max[3]; // axis[n].sw_endstop_max
280
 extern bool axis_known_position[3]; // axis[n].is_known
279
 extern bool axis_known_position[3]; // axis[n].is_known
281
 extern bool axis_homed[3]; // axis[n].is_homed
280
 extern bool axis_homed[3]; // axis[n].is_homed
282
 
281
 
340
 #endif
339
 #endif
341
 
340
 
342
 #if ENABLED(BARICUDA)
341
 #if ENABLED(BARICUDA)
343
-  extern int ValvePressure;
344
-  extern int EtoPPressure;
342
+  extern int baricuda_valve_pressure;
343
+  extern int baricuda_e_to_p_pressure;
345
 #endif
344
 #endif
346
 
345
 
347
 #if ENABLED(FILAMENT_WIDTH_SENSOR)
346
 #if ENABLED(FILAMENT_WIDTH_SENSOR)

+ 94
- 64
Marlin/Marlin_main.cpp View File

284
 float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA);
284
 float filament_size[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(DEFAULT_NOMINAL_FILAMENT_DIA);
285
 float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
285
 float volumetric_multiplier[EXTRUDERS] = ARRAY_BY_EXTRUDERS1(1.0);
286
 
286
 
287
+// The distance that XYZ has been offset by G92. Reset by G28.
287
 float position_shift[3] = { 0 };
288
 float position_shift[3] = { 0 };
289
+
290
+// This offset is added to the configured home position.
291
+// Set by M206, M428, or menu item. Saved to EEPROM.
288
 float home_offset[3] = { 0 };
292
 float home_offset[3] = { 0 };
289
-float min_pos[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
290
-float max_pos[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
293
+
294
+// Software Endstops. Default to configured limits.
295
+float sw_endstop_min[3] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS };
296
+float sw_endstop_max[3] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
291
 
297
 
292
 #if FAN_COUNT > 0
298
 #if FAN_COUNT > 0
293
   int fanSpeeds[FAN_COUNT] = { 0 };
299
   int fanSpeeds[FAN_COUNT] = { 0 };
294
 #endif
300
 #endif
295
 
301
 
302
+// The active extruder (tool). Set with T<extruder> command.
296
 uint8_t active_extruder = 0;
303
 uint8_t active_extruder = 0;
304
+
305
+// Relative Mode. Enable with G91, disable with G90.
306
+static bool relative_mode = false;
307
+
297
 bool cancel_heatup = false;
308
 bool cancel_heatup = false;
298
 
309
 
299
 const char errormagic[] PROGMEM = "Error:";
310
 const char errormagic[] PROGMEM = "Error:";
300
 const char echomagic[] PROGMEM = "echo:";
311
 const char echomagic[] PROGMEM = "echo:";
301
 const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
312
 const char axis_codes[NUM_AXIS] = {'X', 'Y', 'Z', 'E'};
302
 
313
 
303
-static bool relative_mode = false;  //Determines Absolute or Relative Coordinates
304
 static int serial_count = 0;
314
 static int serial_count = 0;
305
-static char* seen_pointer; ///< A pointer to find chars in the command string (X, Y, Z, E, etc.)
306
-const char* queued_commands_P = NULL; /* pointer to the current line in the active sequence of commands, or NULL when none */
315
+
316
+// GCode parameter pointer used by code_seen(), code_value(), etc.
317
+static char* seen_pointer;
318
+
319
+// Next Immediate GCode Command pointer. NULL if none.
320
+const char* queued_commands_P = NULL;
321
+
307
 const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42
322
 const int sensitive_pins[] = SENSITIVE_PINS; ///< Sensitive pin list for M42
323
+
308
 // Inactivity shutdown
324
 // Inactivity shutdown
309
 millis_t previous_cmd_ms = 0;
325
 millis_t previous_cmd_ms = 0;
310
 static millis_t max_inactive_time = 0;
326
 static millis_t max_inactive_time = 0;
311
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
327
 static millis_t stepper_inactive_time = (DEFAULT_STEPPER_DEACTIVE_TIME) * 1000UL;
328
+
329
+// Print Job Timer
312
 Stopwatch print_job_timer = Stopwatch();
330
 Stopwatch print_job_timer = Stopwatch();
331
+
313
 static uint8_t target_extruder;
332
 static uint8_t target_extruder;
314
 
333
 
315
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
334
 #if ENABLED(AUTO_BED_LEVELING_FEATURE)
344
 #endif
363
 #endif
345
 
364
 
346
 #if ENABLED(BARICUDA)
365
 #if ENABLED(BARICUDA)
347
-  int ValvePressure = 0;
348
-  int EtoPPressure = 0;
366
+  int baricuda_valve_pressure = 0;
367
+  int baricuda_e_to_p_pressure = 0;
349
 #endif
368
 #endif
350
 
369
 
351
 #if ENABLED(FWRETRACT)
370
 #if ENABLED(FWRETRACT)
427
 #endif
446
 #endif
428
 
447
 
429
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
448
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
430
-  static bool filrunoutEnqueued = false;
449
+  static bool filament_ran_out = false;
431
 #endif
450
 #endif
432
 
451
 
433
 static bool send_ok[BUFSIZE];
452
 static bool send_ok[BUFSIZE];
472
  * ***************************************************************************
491
  * ***************************************************************************
473
  */
492
  */
474
 
493
 
494
+void stop();
495
+
475
 void get_available_commands();
496
 void get_available_commands();
476
 void process_next_command();
497
 void process_next_command();
477
 
498
 
478
 void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
499
 void plan_arc(float target[NUM_AXIS], float* offset, uint8_t clockwise);
479
 
500
 
480
-bool setTargetedHotend(int code);
481
-
482
 void serial_echopair_P(const char* s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
501
 void serial_echopair_P(const char* s_P, int v)           { serialprintPGM(s_P); SERIAL_ECHO(v); }
483
 void serial_echopair_P(const char* s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
502
 void serial_echopair_P(const char* s_P, long v)          { serialprintPGM(s_P); SERIAL_ECHO(v); }
484
 void serial_echopair_P(const char* s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }
503
 void serial_echopair_P(const char* s_P, float v)         { serialprintPGM(s_P); SERIAL_ECHO(v); }
1142
   return (seen_pointer != NULL); // Return TRUE if the code-letter was found
1161
   return (seen_pointer != NULL); // Return TRUE if the code-letter was found
1143
 }
1162
 }
1144
 
1163
 
1164
+/**
1165
+ * Set target_extruder from the T parameter or the active_extruder
1166
+ *
1167
+ * Returns TRUE if the target is invalid
1168
+ */
1169
+bool get_target_extruder_from_command(int code) {
1170
+  if (code_seen('T')) {
1171
+    short t = code_value_short();
1172
+    if (t >= EXTRUDERS) {
1173
+      SERIAL_ECHO_START;
1174
+      SERIAL_CHAR('M');
1175
+      SERIAL_ECHO(code);
1176
+      SERIAL_ECHOPAIR(" " MSG_INVALID_EXTRUDER " ", t);
1177
+      SERIAL_EOL;
1178
+      return true;
1179
+    }
1180
+    target_extruder = t;
1181
+  }
1182
+  else
1183
+    target_extruder = active_extruder;
1184
+
1185
+  return false;
1186
+}
1187
+
1145
 #define DEFINE_PGM_READ_ANY(type, reader)       \
1188
 #define DEFINE_PGM_READ_ANY(type, reader)       \
1146
   static inline type pgm_read_any(const type *p)  \
1189
   static inline type pgm_read_any(const type *p)  \
1147
   { return pgm_read_##reader##_near(p); }
1190
   { return pgm_read_##reader##_near(p); }
1212
     if (axis == X_AXIS) {
1255
     if (axis == X_AXIS) {
1213
       float dual_max_x = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
1256
       float dual_max_x = max(extruder_offset[X_AXIS][1], X2_MAX_POS);
1214
       if (active_extruder != 0) {
1257
       if (active_extruder != 0) {
1215
-        min_pos[X_AXIS] = X2_MIN_POS + offs;
1216
-        max_pos[X_AXIS] = dual_max_x + offs;
1258
+        sw_endstop_min[X_AXIS] = X2_MIN_POS + offs;
1259
+        sw_endstop_max[X_AXIS] = dual_max_x + offs;
1217
         return;
1260
         return;
1218
       }
1261
       }
1219
       else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
1262
       else if (dual_x_carriage_mode == DXC_DUPLICATION_MODE) {
1220
-        min_pos[X_AXIS] = base_min_pos(X_AXIS) + offs;
1221
-        max_pos[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
1263
+        sw_endstop_min[X_AXIS] = base_min_pos(X_AXIS) + offs;
1264
+        sw_endstop_max[X_AXIS] = min(base_max_pos(X_AXIS), dual_max_x - duplicate_extruder_x_offset) + offs;
1222
         return;
1265
         return;
1223
       }
1266
       }
1224
     }
1267
     }
1225
     else
1268
     else
1226
   #endif
1269
   #endif
1227
   {
1270
   {
1228
-    min_pos[axis] = base_min_pos(axis) + offs;
1229
-    max_pos[axis] = base_max_pos(axis) + offs;
1271
+    sw_endstop_min[axis] = base_min_pos(axis) + offs;
1272
+    sw_endstop_max[axis] = base_max_pos(axis) + offs;
1230
   }
1273
   }
1231
 }
1274
 }
1232
 
1275
 
1276
+/**
1277
+ * Change the home offset for an axis, update the current
1278
+ * position and the software endstops to retain the same
1279
+ * relative distance to the new home.
1280
+ *
1281
+ * Since this changes the current_position, code should
1282
+ * call sync_plan_position soon after this.
1283
+ */
1233
 static void set_home_offset(AxisEnum axis, float v) {
1284
 static void set_home_offset(AxisEnum axis, float v) {
1234
   current_position[axis] += v - home_offset[axis];
1285
   current_position[axis] += v - home_offset[axis];
1235
   home_offset[axis] = v;
1286
   home_offset[axis] = v;
1294
        * SCARA home positions are based on configuration since the actual
1345
        * SCARA home positions are based on configuration since the actual
1295
        * limits are determined by the inverse kinematic transform.
1346
        * limits are determined by the inverse kinematic transform.
1296
        */
1347
        */
1297
-      min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1298
-      max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1348
+      sw_endstop_min[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1349
+      sw_endstop_max[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1299
     }
1350
     }
1300
     else
1351
     else
1301
   #endif
1352
   #endif
1712
             SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
1763
             SERIAL_ERRORLNPGM("Z-Probe failed to engage!");
1713
             LCD_ALERTMESSAGEPGM("Err: ZPROBE");
1764
             LCD_ALERTMESSAGEPGM("Err: ZPROBE");
1714
           }
1765
           }
1715
-          Stop();
1766
+          stop();
1716
         }
1767
         }
1717
 
1768
 
1718
     #endif // Z_PROBE_ALLEN_KEY
1769
     #endif // Z_PROBE_ALLEN_KEY
1816
             SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
1867
             SERIAL_ERRORLNPGM("Z-Probe failed to retract!");
1817
             LCD_ALERTMESSAGEPGM("Err: ZPROBE");
1868
             LCD_ALERTMESSAGEPGM("Err: ZPROBE");
1818
           }
1869
           }
1819
-          Stop();
1870
+          stop();
1820
         }
1871
         }
1821
     #endif // Z_PROBE_ALLEN_KEY
1872
     #endif // Z_PROBE_ALLEN_KEY
1822
 
1873
 
4206
  * M104: Set hot end temperature
4257
  * M104: Set hot end temperature
4207
  */
4258
  */
4208
 inline void gcode_M104() {
4259
 inline void gcode_M104() {
4209
-  if (setTargetedHotend(104)) return;
4260
+  if (get_target_extruder_from_command(104)) return;
4210
   if (DEBUGGING(DRYRUN)) return;
4261
   if (DEBUGGING(DRYRUN)) return;
4211
 
4262
 
4212
   if (code_seen('S')) {
4263
   if (code_seen('S')) {
4314
  * M105: Read hot end and bed temperature
4365
  * M105: Read hot end and bed temperature
4315
  */
4366
  */
4316
 inline void gcode_M105() {
4367
 inline void gcode_M105() {
4317
-  if (setTargetedHotend(105)) return;
4368
+  if (get_target_extruder_from_command(105)) return;
4318
 
4369
 
4319
   #if HAS_TEMP_HOTEND || HAS_TEMP_BED
4370
   #if HAS_TEMP_HOTEND || HAS_TEMP_BED
4320
     SERIAL_PROTOCOLPGM(MSG_OK);
4371
     SERIAL_PROTOCOLPGM(MSG_OK);
4358
  */
4409
  */
4359
 inline void gcode_M109() {
4410
 inline void gcode_M109() {
4360
 
4411
 
4361
-  if (setTargetedHotend(109)) return;
4412
+  if (get_target_extruder_from_command(109)) return;
4362
   if (DEBUGGING(DRYRUN)) return;
4413
   if (DEBUGGING(DRYRUN)) return;
4363
 
4414
 
4364
   bool no_wait_for_cooling = code_seen('S');
4415
   bool no_wait_for_cooling = code_seen('S');
4612
     /**
4663
     /**
4613
      * M126: Heater 1 valve open
4664
      * M126: Heater 1 valve open
4614
      */
4665
      */
4615
-    inline void gcode_M126() { ValvePressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; }
4666
+    inline void gcode_M126() { baricuda_valve_pressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; }
4616
     /**
4667
     /**
4617
      * M127: Heater 1 valve close
4668
      * M127: Heater 1 valve close
4618
      */
4669
      */
4619
-    inline void gcode_M127() { ValvePressure = 0; }
4670
+    inline void gcode_M127() { baricuda_valve_pressure = 0; }
4620
   #endif
4671
   #endif
4621
 
4672
 
4622
   #if HAS_HEATER_2
4673
   #if HAS_HEATER_2
4623
     /**
4674
     /**
4624
      * M128: Heater 2 valve open
4675
      * M128: Heater 2 valve open
4625
      */
4676
      */
4626
-    inline void gcode_M128() { EtoPPressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; }
4677
+    inline void gcode_M128() { baricuda_e_to_p_pressure = code_seen('S') ? constrain(code_value(), 0, 255) : 255; }
4627
     /**
4678
     /**
4628
      * M129: Heater 2 valve close
4679
      * M129: Heater 2 valve close
4629
      */
4680
      */
4630
-    inline void gcode_M129() { EtoPPressure = 0; }
4681
+    inline void gcode_M129() { baricuda_e_to_p_pressure = 0; }
4631
   #endif
4682
   #endif
4632
 
4683
 
4633
 #endif //BARICUDA
4684
 #endif //BARICUDA
5025
  */
5076
  */
5026
 inline void gcode_M200() {
5077
 inline void gcode_M200() {
5027
 
5078
 
5028
-  if (setTargetedHotend(200)) return;
5079
+  if (get_target_extruder_from_command(200)) return;
5029
 
5080
 
5030
   if (code_seen('D')) {
5081
   if (code_seen('D')) {
5031
     float diameter = code_value();
5082
     float diameter = code_value();
5277
    *   Z<zoffset> - Available with DUAL_X_CARRIAGE
5328
    *   Z<zoffset> - Available with DUAL_X_CARRIAGE
5278
    */
5329
    */
5279
   inline void gcode_M218() {
5330
   inline void gcode_M218() {
5280
-    if (setTargetedHotend(218)) return;
5331
+    if (get_target_extruder_from_command(218)) return;
5281
 
5332
 
5282
     if (code_seen('X')) extruder_offset[X_AXIS][target_extruder] = code_value();
5333
     if (code_seen('X')) extruder_offset[X_AXIS][target_extruder] = code_value();
5283
     if (code_seen('Y')) extruder_offset[Y_AXIS][target_extruder] = code_value();
5334
     if (code_seen('Y')) extruder_offset[Y_AXIS][target_extruder] = code_value();
5316
 inline void gcode_M221() {
5367
 inline void gcode_M221() {
5317
   if (code_seen('S')) {
5368
   if (code_seen('S')) {
5318
     int sval = code_value();
5369
     int sval = code_value();
5319
-    if (setTargetedHotend(221)) return;
5370
+    if (get_target_extruder_from_command(221)) return;
5320
     extruder_multiplier[target_extruder] = sval;
5371
     extruder_multiplier[target_extruder] = sval;
5321
   }
5372
   }
5322
 }
5373
 }
5842
   bool err = false;
5893
   bool err = false;
5843
   for (int8_t i = X_AXIS; i <= Z_AXIS; i++) {
5894
   for (int8_t i = X_AXIS; i <= Z_AXIS; i++) {
5844
     if (axis_homed[i]) {
5895
     if (axis_homed[i]) {
5845
-      float base = (current_position[i] > (min_pos[i] + max_pos[i]) / 2) ? base_home_pos(i) : 0,
5896
+      float base = (current_position[i] > (sw_endstop_min[i] + sw_endstop_max[i]) / 2) ? base_home_pos(i) : 0,
5846
             diff = current_position[i] - base;
5897
             diff = current_position[i] - base;
5847
       if (diff > -20 && diff < 20) {
5898
       if (diff > -20 && diff < 20) {
5848
         set_home_offset((AxisEnum)i, home_offset[i] - diff);
5899
         set_home_offset((AxisEnum)i, home_offset[i] - diff);
6078
     #endif
6129
     #endif
6079
 
6130
 
6080
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
6131
     #if ENABLED(FILAMENT_RUNOUT_SENSOR)
6081
-      filrunoutEnqueued = false;
6132
+      filament_ran_out = false;
6082
     #endif
6133
     #endif
6083
 
6134
 
6084
   }
6135
   }
7032
 
7083
 
7033
 void clamp_to_software_endstops(float target[3]) {
7084
 void clamp_to_software_endstops(float target[3]) {
7034
   if (min_software_endstops) {
7085
   if (min_software_endstops) {
7035
-    NOLESS(target[X_AXIS], min_pos[X_AXIS]);
7036
-    NOLESS(target[Y_AXIS], min_pos[Y_AXIS]);
7086
+    NOLESS(target[X_AXIS], sw_endstop_min[X_AXIS]);
7087
+    NOLESS(target[Y_AXIS], sw_endstop_min[Y_AXIS]);
7037
 
7088
 
7038
     float negative_z_offset = 0;
7089
     float negative_z_offset = 0;
7039
     #if ENABLED(AUTO_BED_LEVELING_FEATURE)
7090
     #if ENABLED(AUTO_BED_LEVELING_FEATURE)
7048
         negative_z_offset += home_offset[Z_AXIS];
7099
         negative_z_offset += home_offset[Z_AXIS];
7049
       }
7100
       }
7050
     #endif
7101
     #endif
7051
-    NOLESS(target[Z_AXIS], min_pos[Z_AXIS] + negative_z_offset);
7102
+    NOLESS(target[Z_AXIS], sw_endstop_min[Z_AXIS] + negative_z_offset);
7052
   }
7103
   }
7053
 
7104
 
7054
   if (max_software_endstops) {
7105
   if (max_software_endstops) {
7055
-    NOMORE(target[X_AXIS], max_pos[X_AXIS]);
7056
-    NOMORE(target[Y_AXIS], max_pos[Y_AXIS]);
7057
-    NOMORE(target[Z_AXIS], max_pos[Z_AXIS]);
7106
+    NOMORE(target[X_AXIS], sw_endstop_max[X_AXIS]);
7107
+    NOMORE(target[Y_AXIS], sw_endstop_max[Y_AXIS]);
7108
+    NOMORE(target[Z_AXIS], sw_endstop_max[Z_AXIS]);
7058
   }
7109
   }
7059
 }
7110
 }
7060
 
7111
 
7714
 
7765
 
7715
   #if HAS_FILRUNOUT
7766
   #if HAS_FILRUNOUT
7716
     if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
7767
     if (IS_SD_PRINTING && !(READ(FILRUNOUT_PIN) ^ FIL_RUNOUT_INVERTING))
7717
-      filrunout();
7768
+      handle_filament_runout();
7718
   #endif
7769
   #endif
7719
 
7770
 
7720
   if (commands_in_queue < BUFSIZE) get_available_commands();
7771
   if (commands_in_queue < BUFSIZE) get_available_commands();
7897
 
7948
 
7898
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
7949
 #if ENABLED(FILAMENT_RUNOUT_SENSOR)
7899
 
7950
 
7900
-  void filrunout() {
7901
-    if (!filrunoutEnqueued) {
7902
-      filrunoutEnqueued = true;
7951
+  void handle_filament_runout() {
7952
+    if (!filament_ran_out) {
7953
+      filament_ran_out = true;
7903
       enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
7954
       enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
7904
       st_synchronize();
7955
       st_synchronize();
7905
     }
7956
     }
7968
   }
8019
   }
7969
 #endif // FAST_PWM_FAN
8020
 #endif // FAST_PWM_FAN
7970
 
8021
 
7971
-void Stop() {
8022
+void stop() {
7972
   disable_all_heaters();
8023
   disable_all_heaters();
7973
   if (IsRunning()) {
8024
   if (IsRunning()) {
7974
     Running = false;
8025
     Running = false;
7979
   }
8030
   }
7980
 }
8031
 }
7981
 
8032
 
7982
-/**
7983
- * Set target_extruder from the T parameter or the active_extruder
7984
- *
7985
- * Returns TRUE if the target is invalid
7986
- */
7987
-bool setTargetedHotend(int code) {
7988
-  target_extruder = active_extruder;
7989
-  if (code_seen('T')) {
7990
-    target_extruder = code_value_short();
7991
-    if (target_extruder >= EXTRUDERS) {
7992
-      SERIAL_ECHO_START;
7993
-      SERIAL_CHAR('M');
7994
-      SERIAL_ECHO(code);
7995
-      SERIAL_ECHOPGM(" " MSG_INVALID_EXTRUDER " ");
7996
-      SERIAL_ECHOLN((int)target_extruder);
7997
-      return true;
7998
-    }
7999
-  }
8000
-  return false;
8001
-}
8002
-
8003
 float calculate_volumetric_multiplier(float diameter) {
8033
 float calculate_volumetric_multiplier(float diameter) {
8004
   if (!volumetric_enabled || diameter == 0) return 1.0;
8034
   if (!volumetric_enabled || diameter == 0) return 1.0;
8005
   float d2 = diameter * 0.5;
8035
   float d2 = diameter * 0.5;

+ 4
- 4
Marlin/planner.cpp View File

428
   #endif
428
   #endif
429
 
429
 
430
   #if ENABLED(BARICUDA)
430
   #if ENABLED(BARICUDA)
431
-    unsigned char tail_valve_pressure = ValvePressure,
432
-                  tail_e_to_p_pressure = EtoPPressure;
431
+    unsigned char tail_valve_pressure = baricuda_valve_pressure,
432
+                  tail_e_to_p_pressure = baricuda_e_to_p_pressure;
433
   #endif
433
   #endif
434
 
434
 
435
   block_t* block;
435
   block_t* block;
650
   #endif
650
   #endif
651
 
651
 
652
   #if ENABLED(BARICUDA)
652
   #if ENABLED(BARICUDA)
653
-    block->valve_pressure = ValvePressure;
654
-    block->e_to_p_pressure = EtoPPressure;
653
+    block->valve_pressure = baricuda_valve_pressure;
654
+    block->e_to_p_pressure = baricuda_e_to_p_pressure;
655
   #endif
655
   #endif
656
 
656
 
657
   // Compute direction bits for this block
657
   // Compute direction bits for this block

+ 3
- 5
Marlin/temperature.cpp View File

1279
   #define MAX6675_HEAT_INTERVAL 250u
1279
   #define MAX6675_HEAT_INTERVAL 250u
1280
 
1280
 
1281
   #if ENABLED(MAX6675_IS_MAX31855)
1281
   #if ENABLED(MAX6675_IS_MAX31855)
1282
-    unsigned long max6675_temp = 2000;
1283
-    #define MAX6675_READ_BYTES 4
1282
+    uint32_t max6675_temp = 2000;
1284
     #define MAX6675_ERROR_MASK 7
1283
     #define MAX6675_ERROR_MASK 7
1285
     #define MAX6675_DISCARD_BITS 18
1284
     #define MAX6675_DISCARD_BITS 18
1286
   #else
1285
   #else
1287
-    unsigned int max6675_temp = 2000;
1288
-    #define MAX6675_READ_BYTES 2
1286
+    uint16_t max6675_temp = 2000;
1289
     #define MAX6675_ERROR_MASK 4
1287
     #define MAX6675_ERROR_MASK 4
1290
     #define MAX6675_DISCARD_BITS 3
1288
     #define MAX6675_DISCARD_BITS 3
1291
   #endif
1289
   #endif
1317
 
1315
 
1318
     // Read a big-endian temperature value
1316
     // Read a big-endian temperature value
1319
     max6675_temp = 0;
1317
     max6675_temp = 0;
1320
-    for (uint8_t i = MAX6675_READ_BYTES; i--;) {
1318
+    for (uint8_t i = sizeof(max6675_temp); i--;) {
1321
       SPDR = 0;
1319
       SPDR = 0;
1322
       for (;!TEST(SPSR, SPIF););
1320
       for (;!TEST(SPSR, SPIF););
1323
       max6675_temp |= SPDR;
1321
       max6675_temp |= SPDR;

+ 5
- 5
Marlin/ultralcd.cpp View File

1167
 #if ENABLED(DELTA)
1167
 #if ENABLED(DELTA)
1168
   static float delta_clip_radius_2 =  (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS);
1168
   static float delta_clip_radius_2 =  (DELTA_PRINTABLE_RADIUS) * (DELTA_PRINTABLE_RADIUS);
1169
   static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a*a); }
1169
   static int delta_clip( float a ) { return sqrt(delta_clip_radius_2 - a*a); }
1170
-  static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(min_pos[X_AXIS], -clip), min(max_pos[X_AXIS], clip)); }
1171
-  static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, max(min_pos[Y_AXIS], -clip), min(max_pos[Y_AXIS], clip)); }
1170
+  static void lcd_move_x() { int clip = delta_clip(current_position[Y_AXIS]); _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, max(sw_endstop_min[X_AXIS], -clip), min(sw_endstop_max[X_AXIS], clip)); }
1171
+  static void lcd_move_y() { int clip = delta_clip(current_position[X_AXIS]); _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, max(sw_endstop_min[Y_AXIS], -clip), min(sw_endstop_max[Y_AXIS], clip)); }
1172
 #else
1172
 #else
1173
-  static void lcd_move_x() { _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, min_pos[X_AXIS], max_pos[X_AXIS]); }
1174
-  static void lcd_move_y() { _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, min_pos[Y_AXIS], max_pos[Y_AXIS]); }
1173
+  static void lcd_move_x() { _lcd_move(PSTR(MSG_MOVE_X), X_AXIS, sw_endstop_min[X_AXIS], sw_endstop_max[X_AXIS]); }
1174
+  static void lcd_move_y() { _lcd_move(PSTR(MSG_MOVE_Y), Y_AXIS, sw_endstop_min[Y_AXIS], sw_endstop_max[Y_AXIS]); }
1175
 #endif
1175
 #endif
1176
-static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, min_pos[Z_AXIS], max_pos[Z_AXIS]); }
1176
+static void lcd_move_z() { _lcd_move(PSTR(MSG_MOVE_Z), Z_AXIS, sw_endstop_min[Z_AXIS], sw_endstop_max[Z_AXIS]); }
1177
 static void lcd_move_e(
1177
 static void lcd_move_e(
1178
   #if EXTRUDERS > 1
1178
   #if EXTRUDERS > 1
1179
     uint8_t e
1179
     uint8_t e

Loading…
Cancel
Save