|
@@ -440,7 +440,7 @@ float soft_endstop_min[XYZ] = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
|
440
|
440
|
soft_endstop_max[XYZ] = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
441
|
441
|
|
442
|
442
|
#if FAN_COUNT > 0
|
443
|
|
- int fanSpeeds[FAN_COUNT] = { 0 };
|
|
443
|
+ int16_t fanSpeeds[FAN_COUNT] = { 0 };
|
444
|
444
|
#endif
|
445
|
445
|
|
446
|
446
|
// The active extruder (tool). Set with T<extruder> command.
|
|
@@ -1292,32 +1292,24 @@ inline bool code_value_bool() { return !code_has_value() || code_value_byte() >
|
1292
|
1292
|
inline float code_value_linear_units() { return code_value_float() * linear_unit_factor; }
|
1293
|
1293
|
inline float code_value_axis_units(const AxisEnum axis) { return code_value_float() * axis_unit_factor(axis); }
|
1294
|
1294
|
inline float code_value_per_axis_unit(const AxisEnum axis) { return code_value_float() / axis_unit_factor(axis); }
|
1295
|
|
-
|
1296
|
|
-#else
|
1297
|
|
-
|
1298
|
|
- #define code_value_linear_units() code_value_float()
|
1299
|
|
- #define code_value_axis_units(A) code_value_float()
|
1300
|
|
- #define code_value_per_axis_unit(A) code_value_float()
|
1301
|
|
-
|
1302
|
1295
|
#endif
|
1303
|
1296
|
|
1304
|
1297
|
#if ENABLED(TEMPERATURE_UNITS_SUPPORT)
|
1305
|
1298
|
inline void set_input_temp_units(TempUnit units) { input_temp_units = units; }
|
1306
|
1299
|
|
1307
|
|
- float code_value_temp_abs() {
|
|
1300
|
+ int16_t code_value_temp_abs() {
|
1308
|
1301
|
switch (input_temp_units) {
|
1309
|
|
- case TEMPUNIT_C:
|
1310
|
|
- return code_value_float();
|
1311
|
1302
|
case TEMPUNIT_F:
|
1312
|
1303
|
return (code_value_float() - 32) * 0.5555555556;
|
1313
|
1304
|
case TEMPUNIT_K:
|
1314
|
1305
|
return code_value_float() - 273.15;
|
|
1306
|
+ case TEMPUNIT_C:
|
1315
|
1307
|
default:
|
1316
|
|
- return code_value_float();
|
|
1308
|
+ return code_value_int();
|
1317
|
1309
|
}
|
1318
|
1310
|
}
|
1319
|
1311
|
|
1320
|
|
- float code_value_temp_diff() {
|
|
1312
|
+ int16_t code_value_temp_diff() {
|
1321
|
1313
|
switch (input_temp_units) {
|
1322
|
1314
|
case TEMPUNIT_C:
|
1323
|
1315
|
case TEMPUNIT_K:
|
|
@@ -1329,8 +1321,8 @@ inline bool code_value_bool() { return !code_has_value() || code_value_byte() >
|
1329
|
1321
|
}
|
1330
|
1322
|
}
|
1331
|
1323
|
#else
|
1332
|
|
- float code_value_temp_abs() { return code_value_float(); }
|
1333
|
|
- float code_value_temp_diff() { return code_value_float(); }
|
|
1324
|
+ int16_t code_value_temp_abs() { return code_value_int(); }
|
|
1325
|
+ int16_t code_value_temp_diff() { return code_value_int(); }
|
1334
|
1326
|
#endif
|
1335
|
1327
|
|
1336
|
1328
|
FORCE_INLINE millis_t code_value_millis() { return code_value_ulong(); }
|
|
@@ -1391,7 +1383,7 @@ bool get_target_extruder_from_command(int code) {
|
1391
|
1383
|
static float raised_parked_position[XYZE]; // used in mode 1
|
1392
|
1384
|
static millis_t delayed_move_time = 0; // used in mode 1
|
1393
|
1385
|
static float duplicate_extruder_x_offset = DEFAULT_DUPLICATION_X_OFFSET; // used in mode 2
|
1394
|
|
- static float duplicate_extruder_temp_offset = 0; // used in mode 2
|
|
1386
|
+ static int16_t duplicate_extruder_temp_offset = 0; // used in mode 2
|
1395
|
1387
|
|
1396
|
1388
|
#endif // DUAL_X_CARRIAGE
|
1397
|
1389
|
|
|
@@ -2080,10 +2072,10 @@ static void clean_up_after_endstop_or_probe_move() {
|
2080
|
2072
|
void set_heaters_for_bltouch(const bool deploy) {
|
2081
|
2073
|
static bool heaters_were_disabled = false;
|
2082
|
2074
|
static millis_t next_emi_protection = 0;
|
2083
|
|
- static float temps_at_entry[HOTENDS];
|
|
2075
|
+ static int16_t temps_at_entry[HOTENDS];
|
2084
|
2076
|
|
2085
|
2077
|
#if HAS_TEMP_BED
|
2086
|
|
- static float bed_temp_at_entry;
|
|
2078
|
+ static int16_t bed_temp_at_entry;
|
2087
|
2079
|
#endif
|
2088
|
2080
|
|
2089
|
2081
|
// If called out of order or far apart something is seriously wrong
|
|
@@ -2588,7 +2580,7 @@ static void clean_up_after_endstop_or_probe_move() {
|
2588
|
2580
|
/**
|
2589
|
2581
|
* Extrapolate a single point from its neighbors
|
2590
|
2582
|
*/
|
2591
|
|
- static void extrapolate_one_point(uint8_t x, uint8_t y, int8_t xdir, int8_t ydir) {
|
|
2583
|
+ static void extrapolate_one_point(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir) {
|
2592
|
2584
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
2593
|
2585
|
if (DEBUGGING(LEVELING)) {
|
2594
|
2586
|
SERIAL_ECHOPGM("Extrapolate [");
|
|
@@ -2611,9 +2603,10 @@ static void clean_up_after_endstop_or_probe_move() {
|
2611
|
2603
|
SERIAL_EOL;
|
2612
|
2604
|
|
2613
|
2605
|
// Get X neighbors, Y neighbors, and XY neighbors
|
2614
|
|
- float a1 = z_values[x + xdir][y], a2 = z_values[x + xdir * 2][y],
|
2615
|
|
- b1 = z_values[x][y + ydir], b2 = z_values[x][y + ydir * 2],
|
2616
|
|
- c1 = z_values[x + xdir][y + ydir], c2 = z_values[x + xdir * 2][y + ydir * 2];
|
|
2606
|
+ const uint8_t x1 = x + xdir, y1 = y + ydir, x2 = x1 + xdir, y2 = y1 + ydir;
|
|
2607
|
+ float a1 = z_values[x1][y ], a2 = z_values[x2][y ],
|
|
2608
|
+ b1 = z_values[x ][y1], b2 = z_values[x ][y2],
|
|
2609
|
+ c1 = z_values[x1][y1], c2 = z_values[x2][y2];
|
2617
|
2610
|
|
2618
|
2611
|
// Treat far unprobed points as zero, near as equal to far
|
2619
|
2612
|
if (isnan(a2)) a2 = 0.0; if (isnan(a1)) a1 = a2;
|
|
@@ -2647,19 +2640,19 @@ static void clean_up_after_endstop_or_probe_move() {
|
2647
|
2640
|
*/
|
2648
|
2641
|
static void extrapolate_unprobed_bed_level() {
|
2649
|
2642
|
#ifdef HALF_IN_X
|
2650
|
|
- const uint8_t ctrx2 = 0, xlen = GRID_MAX_POINTS_X - 1;
|
|
2643
|
+ constexpr uint8_t ctrx2 = 0, xlen = GRID_MAX_POINTS_X - 1;
|
2651
|
2644
|
#else
|
2652
|
|
- const uint8_t ctrx1 = (GRID_MAX_POINTS_X - 1) / 2, // left-of-center
|
2653
|
|
- ctrx2 = GRID_MAX_POINTS_X / 2, // right-of-center
|
2654
|
|
- xlen = ctrx1;
|
|
2645
|
+ constexpr uint8_t ctrx1 = (GRID_MAX_POINTS_X - 1) / 2, // left-of-center
|
|
2646
|
+ ctrx2 = (GRID_MAX_POINTS_X) / 2, // right-of-center
|
|
2647
|
+ xlen = ctrx1;
|
2655
|
2648
|
#endif
|
2656
|
2649
|
|
2657
|
2650
|
#ifdef HALF_IN_Y
|
2658
|
|
- const uint8_t ctry2 = 0, ylen = GRID_MAX_POINTS_Y - 1;
|
|
2651
|
+ constexpr uint8_t ctry2 = 0, ylen = GRID_MAX_POINTS_Y - 1;
|
2659
|
2652
|
#else
|
2660
|
|
- const uint8_t ctry1 = (GRID_MAX_POINTS_Y - 1) / 2, // top-of-center
|
2661
|
|
- ctry2 = GRID_MAX_POINTS_Y / 2, // bottom-of-center
|
2662
|
|
- ylen = ctry1;
|
|
2653
|
+ constexpr uint8_t ctry1 = (GRID_MAX_POINTS_Y - 1) / 2, // top-of-center
|
|
2654
|
+ ctry2 = (GRID_MAX_POINTS_Y) / 2, // bottom-of-center
|
|
2655
|
+ ylen = ctry1;
|
2663
|
2656
|
#endif
|
2664
|
2657
|
|
2665
|
2658
|
for (uint8_t xo = 0; xo <= xlen; xo++)
|
|
@@ -6477,10 +6470,11 @@ inline void gcode_M104() {
|
6477
|
6470
|
#endif
|
6478
|
6471
|
|
6479
|
6472
|
if (code_seen('S')) {
|
6480
|
|
- thermalManager.setTargetHotend(code_value_temp_abs(), target_extruder);
|
|
6473
|
+ const int16_t temp = code_value_temp_abs();
|
|
6474
|
+ thermalManager.setTargetHotend(temp, target_extruder);
|
6481
|
6475
|
#if ENABLED(DUAL_X_CARRIAGE)
|
6482
|
6476
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
|
6483
|
|
- thermalManager.setTargetHotend(code_value_temp_abs() == 0.0 ? 0.0 : code_value_temp_abs() + duplicate_extruder_temp_offset, 1);
|
|
6477
|
+ thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
|
6484
|
6478
|
#endif
|
6485
|
6479
|
|
6486
|
6480
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
|
@@ -6490,7 +6484,7 @@ inline void gcode_M104() {
|
6490
|
6484
|
* standby mode, for instance in a dual extruder setup, without affecting
|
6491
|
6485
|
* the running print timer.
|
6492
|
6486
|
*/
|
6493
|
|
- if (code_value_temp_abs() <= (EXTRUDE_MINTEMP)/2) {
|
|
6487
|
+ if (code_value_temp_abs() <= (EXTRUDE_MINTEMP) / 2) {
|
6494
|
6488
|
print_job_timer.stop();
|
6495
|
6489
|
LCD_MESSAGEPGM(WELCOME_MSG);
|
6496
|
6490
|
}
|
|
@@ -6513,7 +6507,7 @@ inline void gcode_M104() {
|
6513
|
6507
|
SERIAL_PROTOCOLPGM(" /");
|
6514
|
6508
|
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(target_extruder), 1);
|
6515
|
6509
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
6516
|
|
- SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_raw[target_extruder] / OVERSAMPLENR);
|
|
6510
|
+ SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(target_extruder) / OVERSAMPLENR);
|
6517
|
6511
|
SERIAL_PROTOCOLCHAR(')');
|
6518
|
6512
|
#endif
|
6519
|
6513
|
#endif
|
|
@@ -6523,7 +6517,7 @@ inline void gcode_M104() {
|
6523
|
6517
|
SERIAL_PROTOCOLPGM(" /");
|
6524
|
6518
|
SERIAL_PROTOCOL_F(thermalManager.degTargetBed(), 1);
|
6525
|
6519
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
6526
|
|
- SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_bed_raw / OVERSAMPLENR);
|
|
6520
|
+ SERIAL_PROTOCOLPAIR(" (", thermalManager.rawBedTemp() / OVERSAMPLENR);
|
6527
|
6521
|
SERIAL_PROTOCOLCHAR(')');
|
6528
|
6522
|
#endif
|
6529
|
6523
|
#endif
|
|
@@ -6535,7 +6529,7 @@ inline void gcode_M104() {
|
6535
|
6529
|
SERIAL_PROTOCOLPGM(" /");
|
6536
|
6530
|
SERIAL_PROTOCOL_F(thermalManager.degTargetHotend(e), 1);
|
6537
|
6531
|
#if ENABLED(SHOW_TEMP_ADC_VALUES)
|
6538
|
|
- SERIAL_PROTOCOLPAIR(" (", thermalManager.current_temperature_raw[e] / OVERSAMPLENR);
|
|
6532
|
+ SERIAL_PROTOCOLPAIR(" (", thermalManager.rawHotendTemp(e) / OVERSAMPLENR);
|
6539
|
6533
|
SERIAL_PROTOCOLCHAR(')');
|
6540
|
6534
|
#endif
|
6541
|
6535
|
}
|
|
@@ -6671,10 +6665,11 @@ inline void gcode_M109() {
|
6671
|
6665
|
|
6672
|
6666
|
const bool no_wait_for_cooling = code_seen('S');
|
6673
|
6667
|
if (no_wait_for_cooling || code_seen('R')) {
|
6674
|
|
- thermalManager.setTargetHotend(code_value_temp_abs(), target_extruder);
|
|
6668
|
+ const int16_t temp = code_value_temp_abs();
|
|
6669
|
+ thermalManager.setTargetHotend(temp, target_extruder);
|
6675
|
6670
|
#if ENABLED(DUAL_X_CARRIAGE)
|
6676
|
6671
|
if (dual_x_carriage_mode == DXC_DUPLICATION_MODE && target_extruder == 0)
|
6677
|
|
- thermalManager.setTargetHotend(code_value_temp_abs() == 0.0 ? 0.0 : code_value_temp_abs() + duplicate_extruder_temp_offset, 1);
|
|
6672
|
+ thermalManager.setTargetHotend(temp ? temp + duplicate_extruder_temp_offset : 0, 1);
|
6678
|
6673
|
#endif
|
6679
|
6674
|
|
6680
|
6675
|
#if ENABLED(PRINTJOB_TIMER_AUTOSTART)
|
|
@@ -7202,7 +7197,7 @@ inline void gcode_M92() {
|
7202
|
7197
|
LOOP_XYZE(i) {
|
7203
|
7198
|
if (code_seen(axis_codes[i])) {
|
7204
|
7199
|
if (i == E_AXIS) {
|
7205
|
|
- const float value = code_value_per_axis_unit(E_AXIS + TARGET_EXTRUDER);
|
|
7200
|
+ const float value = code_value_per_axis_unit((AxisEnum)(E_AXIS + TARGET_EXTRUDER));
|
7206
|
7201
|
if (value < 20.0) {
|
7207
|
7202
|
float factor = planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] / value; // increase e constants if M92 E14 is given for netfab.
|
7208
|
7203
|
planner.max_jerk[E_AXIS] *= factor;
|
|
@@ -7212,7 +7207,7 @@ inline void gcode_M92() {
|
7212
|
7207
|
planner.axis_steps_per_mm[E_AXIS + TARGET_EXTRUDER] = value;
|
7213
|
7208
|
}
|
7214
|
7209
|
else {
|
7215
|
|
- planner.axis_steps_per_mm[i] = code_value_per_axis_unit(i);
|
|
7210
|
+ planner.axis_steps_per_mm[i] = code_value_per_axis_unit((AxisEnum)i);
|
7216
|
7211
|
}
|
7217
|
7212
|
}
|
7218
|
7213
|
}
|
|
@@ -8106,11 +8101,11 @@ inline void gcode_M226() {
|
8106
|
8101
|
*/
|
8107
|
8102
|
inline void gcode_M303() {
|
8108
|
8103
|
#if HAS_PID_HEATING
|
8109
|
|
- int e = code_seen('E') ? code_value_int() : 0;
|
8110
|
|
- int c = code_seen('C') ? code_value_int() : 5;
|
8111
|
|
- bool u = code_seen('U') && code_value_bool();
|
|
8104
|
+ const int e = code_seen('E') ? code_value_int() : 0,
|
|
8105
|
+ c = code_seen('C') ? code_value_int() : 5;
|
|
8106
|
+ const bool u = code_seen('U') && code_value_bool();
|
8112
|
8107
|
|
8113
|
|
- float temp = code_seen('S') ? code_value_temp_abs() : (e < 0 ? 70.0 : 150.0);
|
|
8108
|
+ int16_t temp = code_seen('S') ? code_value_temp_abs() : (e < 0 ? 70 : 150);
|
8114
|
8109
|
|
8115
|
8110
|
if (WITHIN(e, 0, HOTENDS - 1))
|
8116
|
8111
|
target_extruder = e;
|
|
@@ -8747,7 +8742,6 @@ inline void gcode_M503() {
|
8747
|
8742
|
|
8748
|
8743
|
const millis_t nozzle_timeout = millis() + (millis_t)(FILAMENT_CHANGE_NOZZLE_TIMEOUT) * 1000UL;
|
8749
|
8744
|
bool nozzle_timed_out = false;
|
8750
|
|
- float temps[4];
|
8751
|
8745
|
|
8752
|
8746
|
// Wait for filament insert by user and press button
|
8753
|
8747
|
lcd_filament_change_show_message(FILAMENT_CHANGE_MESSAGE_INSERT);
|
|
@@ -8758,6 +8752,7 @@ inline void gcode_M503() {
|
8758
|
8752
|
|
8759
|
8753
|
idle();
|
8760
|
8754
|
|
|
8755
|
+ int16_t temps[HOTENDS];
|
8761
|
8756
|
HOTEND_LOOP() temps[e] = thermalManager.target_temperature[e]; // Save nozzle temps
|
8762
|
8757
|
|
8763
|
8758
|
KEEPALIVE_STATE(PAUSED_FOR_USER);
|