Browse Source

Prevent 'current' name conflict, if needed

Scott Lahteine 5 years ago
parent
commit
565a0e11ed

+ 2
- 3
Marlin/src/HAL/HAL_STM32_F4_F7/STM32F7/TMC2660.cpp View File

@@ -831,9 +831,8 @@ void TMC26XStepper::debugLastStatus() {
831 831
         SERIAL_ECHOPAIR("\n  Stall Guard value:", value);
832 832
       }
833 833
       else if (readout_config == READ_STALL_GUARD_AND_COOL_STEP) {
834
-        int16_t stallGuard = value & 0xF, current = value & 0x1F0;
835
-        SERIAL_ECHOPAIR("\n  Approx Stall Guard: ", stallGuard);
836
-        SERIAL_ECHOPAIR("\n  Current level", current);
834
+        SERIAL_ECHOPAIR("\n  Approx Stall Guard: ", value & 0xF);
835
+        SERIAL_ECHOPAIR("\n  Current level", value & 0x1F0);
837 836
       }
838 837
     }
839 838
   #endif

+ 7
- 7
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp View File

@@ -757,10 +757,10 @@
757 757
       do {
758 758
         if (do_ubl_mesh_map) display_map(g29_map_type);
759 759
 
760
-        const int current = (GRID_MAX_POINTS) - count + 1;
761
-        SERIAL_ECHOLNPAIR("\nProbing mesh point ", current, "/", int(GRID_MAX_POINTS), ".\n");
760
+        const int point_num = (GRID_MAX_POINTS) - count + 1;
761
+        SERIAL_ECHOLNPAIR("\nProbing mesh point ", point_num, "/", int(GRID_MAX_POINTS), ".\n");
762 762
         #if HAS_DISPLAY
763
-          ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), current, int(GRID_MAX_POINTS));
763
+          ui.status_printf_P(0, PSTR(MSG_PROBING_MESH " %i/%i"), point_num, int(GRID_MAX_POINTS));
764 764
         #endif
765 765
 
766 766
         #if HAS_LCD_MENU
@@ -1477,7 +1477,7 @@
1477 1477
 
1478 1478
         bool zig_zag = false;
1479 1479
 
1480
-        uint16_t total_points = g29_grid_size * g29_grid_size, current = 1;
1480
+        uint16_t total_points = g29_grid_size * g29_grid_size, point_num = 1;
1481 1481
 
1482 1482
         for (uint8_t ix = 0; ix < g29_grid_size; ix++) {
1483 1483
           const float rx = float(x_min) + ix * dx;
@@ -1485,9 +1485,9 @@
1485 1485
             const float ry = float(y_min) + dy * (zig_zag ? g29_grid_size - 1 - iy : iy);
1486 1486
 
1487 1487
             if (!abort_flag) {
1488
-              SERIAL_ECHOLNPAIR("Tilting mesh point ", current, "/", total_points, "\n");
1488
+              SERIAL_ECHOLNPAIR("Tilting mesh point ", point_num, "/", total_points, "\n");
1489 1489
               #if HAS_DISPLAY
1490
-                ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " %i/%i"), current, total_points);
1490
+                ui.status_printf_P(0, PSTR(MSG_LCD_TILTING_MESH " %i/%i"), point_num, total_points);
1491 1491
               #endif
1492 1492
 
1493 1493
               measured_z = probe_pt(rx, ry, parser.seen('E') ? PROBE_PT_STOW : PROBE_PT_RAISE, g29_verbose_level); // TODO: Needs error handling
@@ -1518,7 +1518,7 @@
1518 1518
               incremental_LSF(&lsf_results, rx, ry, measured_z);
1519 1519
             }
1520 1520
 
1521
-            current++;
1521
+            point_num++;
1522 1522
           }
1523 1523
 
1524 1524
           zig_zag ^= true;

+ 3
- 3
Marlin/src/lcd/extensible_ui/lib/dgus/DGUSDisplayDefinition.cpp View File

@@ -166,14 +166,14 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
166 166
 
167 167
   // Temperature Data
168 168
   #if HOTENDS >= 1
169
-    VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[0].current, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
169
+    VPHELPER(VP_T_E1_Is, &thermalManager.temp_hotend[0].celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
170 170
     VPHELPER(VP_T_E1_Set, &thermalManager.temp_hotend[0].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
171 171
     VPHELPER(VP_Flowrate_E1, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
172 172
     VPHELPER(VP_EPos, &destination[3], nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<2>),
173 173
     VPHELPER(VP_MOVE_E1, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
174 174
   #endif
175 175
   #if HOTENDS >= 2
176
-    VPHELPER(VP_T_E2_I, &thermalManager.temp_hotend[1].current, nullptr, DGUSLCD_SendFloatAsLongValueToDisplay<0>),
176
+    VPHELPER(VP_T_E2_I, &thermalManager.temp_hotend[1].celsius, nullptr, DGUSLCD_SendFloatAsLongValueToDisplay<0>),
177 177
     VPHELPER(VP_T_E2_S, &thermalManager.temp_hotend[1].target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
178 178
     VPHELPER(VP_Flowrate_E2, nullptr, DGUSScreenVariableHandler::HandleFlowRateChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
179 179
     VPHELPER(VP_MOVE_E2, nullptr, &DGUSScreenVariableHandler::HandleManualExtrude, nullptr),
@@ -182,7 +182,7 @@ const struct DGUS_VP_Variable ListOfVP[] PROGMEM = {
182 182
     #error More than 2 Hotends currently not implemented on the Display UI design.
183 183
   #endif
184 184
   #if HAS_HEATED_BED
185
-    VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.current, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
185
+    VPHELPER(VP_T_Bed_Is, &thermalManager.temp_bed.celsius, nullptr, DGUSScreenVariableHandler::DGUSLCD_SendFloatAsLongValueToDisplay<0>),
186 186
     VPHELPER(VP_T_Bed_Set, &thermalManager.temp_bed.target, DGUSScreenVariableHandler::HandleTemperatureChanged, &DGUSScreenVariableHandler::DGUSLCD_SendWordValueToDisplay),
187 187
   #endif
188 188
 

+ 19
- 19
Marlin/src/module/planner.cpp View File

@@ -994,23 +994,23 @@ void Planner::forward_pass() {
994 994
   //  pass will never modify the values at the tail.
995 995
   uint8_t block_index = block_buffer_planned;
996 996
 
997
-  block_t *current;
997
+  block_t *block;
998 998
   const block_t * previous = nullptr;
999 999
   while (block_index != block_buffer_head) {
1000 1000
 
1001 1001
     // Perform the forward pass
1002
-    current = &block_buffer[block_index];
1002
+    block = &block_buffer[block_index];
1003 1003
 
1004 1004
     // Skip SYNC blocks
1005
-    if (!TEST(current->flag, BLOCK_BIT_SYNC_POSITION)) {
1005
+    if (!TEST(block->flag, BLOCK_BIT_SYNC_POSITION)) {
1006 1006
       // If there's no previous block or the previous block is not
1007 1007
       // BUSY (thus, modifiable) run the forward_pass_kernel. Otherwise,
1008 1008
       // the previous block became BUSY, so assume the current block's
1009 1009
       // entry speed can't be altered (since that would also require
1010 1010
       // updating the exit speed of the previous block).
1011 1011
       if (!previous || !stepper.is_block_busy(previous))
1012
-        forward_pass_kernel(previous, current, block_index);
1013
-      previous = current;
1012
+        forward_pass_kernel(previous, block, block_index);
1013
+      previous = block;
1014 1014
     }
1015 1015
     // Advance to the previous
1016 1016
     block_index = next_block_index(block_index);
@@ -1045,7 +1045,7 @@ void Planner::recalculate_trapezoids() {
1045 1045
   }
1046 1046
 
1047 1047
   // Go from the tail (currently executed block) to the first block, without including it)
1048
-  block_t *current = nullptr, *next = nullptr;
1048
+  block_t *block = nullptr, *next = nullptr;
1049 1049
   float current_entry_speed = 0.0, next_entry_speed = 0.0;
1050 1050
   while (block_index != head_block_index) {
1051 1051
 
@@ -1055,41 +1055,41 @@ void Planner::recalculate_trapezoids() {
1055 1055
     if (!TEST(next->flag, BLOCK_BIT_SYNC_POSITION)) {
1056 1056
       next_entry_speed = SQRT(next->entry_speed_sqr);
1057 1057
 
1058
-      if (current) {
1058
+      if (block) {
1059 1059
         // Recalculate if current block entry or exit junction speed has changed.
1060
-        if (TEST(current->flag, BLOCK_BIT_RECALCULATE) || TEST(next->flag, BLOCK_BIT_RECALCULATE)) {
1060
+        if (TEST(block->flag, BLOCK_BIT_RECALCULATE) || TEST(next->flag, BLOCK_BIT_RECALCULATE)) {
1061 1061
 
1062 1062
           // Mark the current block as RECALCULATE, to protect it from the Stepper ISR running it.
1063 1063
           // Note that due to the above condition, there's a chance the current block isn't marked as
1064 1064
           // RECALCULATE yet, but the next one is. That's the reason for the following line.
1065
-          SBI(current->flag, BLOCK_BIT_RECALCULATE);
1065
+          SBI(block->flag, BLOCK_BIT_RECALCULATE);
1066 1066
 
1067 1067
           // But there is an inherent race condition here, as the block maybe
1068 1068
           // became BUSY, just before it was marked as RECALCULATE, so check
1069 1069
           // if that is the case!
1070
-          if (!stepper.is_block_busy(current)) {
1070
+          if (!stepper.is_block_busy(block)) {
1071 1071
             // Block is not BUSY, we won the race against the Stepper ISR:
1072 1072
 
1073 1073
             // NOTE: Entry and exit factors always > 0 by all previous logic operations.
1074
-            const float current_nominal_speed = SQRT(current->nominal_speed_sqr),
1074
+            const float current_nominal_speed = SQRT(block->nominal_speed_sqr),
1075 1075
                         nomr = 1.0f / current_nominal_speed;
1076
-            calculate_trapezoid_for_block(current, current_entry_speed * nomr, next_entry_speed * nomr);
1076
+            calculate_trapezoid_for_block(block, current_entry_speed * nomr, next_entry_speed * nomr);
1077 1077
             #if ENABLED(LIN_ADVANCE)
1078
-              if (current->use_advance_lead) {
1079
-                const float comp = current->e_D_ratio * extruder_advance_K[active_extruder] * settings.axis_steps_per_mm[E_AXIS];
1080
-                current->max_adv_steps = current_nominal_speed * comp;
1081
-                current->final_adv_steps = next_entry_speed * comp;
1078
+              if (block->use_advance_lead) {
1079
+                const float comp = block->e_D_ratio * extruder_advance_K[active_extruder] * settings.axis_steps_per_mm[E_AXIS];
1080
+                block->max_adv_steps = current_nominal_speed * comp;
1081
+                block->final_adv_steps = next_entry_speed * comp;
1082 1082
               }
1083 1083
             #endif
1084 1084
           }
1085 1085
 
1086 1086
           // Reset current only to ensure next trapezoid is computed - The
1087 1087
           // stepper is free to use the block from now on.
1088
-          CBI(current->flag, BLOCK_BIT_RECALCULATE);
1088
+          CBI(block->flag, BLOCK_BIT_RECALCULATE);
1089 1089
         }
1090 1090
       }
1091 1091
 
1092
-      current = next;
1092
+      block = next;
1093 1093
       current_entry_speed = next_entry_speed;
1094 1094
     }
1095 1095
 
@@ -1107,7 +1107,7 @@ void Planner::recalculate_trapezoids() {
1107 1107
     // But there is an inherent race condition here, as the block maybe
1108 1108
     // became BUSY, just before it was marked as RECALCULATE, so check
1109 1109
     // if that is the case!
1110
-    if (!stepper.is_block_busy(current)) {
1110
+    if (!stepper.is_block_busy(block)) {
1111 1111
       // Block is not BUSY, we won the race against the Stepper ISR:
1112 1112
 
1113 1113
       const float next_nominal_speed = SQRT(next->nominal_speed_sqr),

+ 46
- 46
Marlin/src/module/temperature.cpp View File

@@ -346,7 +346,7 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
346 346
    * temperature to succeed.
347 347
    */
348 348
   void Temperature::PID_autotune(const float &target, const heater_ind_t heater, const int8_t ncycles, const bool set_result/*=false*/) {
349
-    float current = 0.0;
349
+    float current_temp = 0.0;
350 350
     int cycles = 0;
351 351
     bool heating = true;
352 352
 
@@ -410,7 +410,7 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
410 410
 
411 411
     wait_for_heatup = true; // Can be interrupted with M108
412 412
     #if ENABLED(PRINTER_EVENT_LEDS)
413
-      const float start_temp = GHV(temp_bed.current, temp_hotend[heater].current);
413
+      const float start_temp = GHV(temp_bed.celsius, temp_hotend[heater].celsius);
414 414
       LEDColor color = ONHEATINGSTART();
415 415
     #endif
416 416
 
@@ -427,12 +427,12 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
427 427
         updateTemperaturesFromRawValues();
428 428
 
429 429
         // Get the current temperature and constrain it
430
-        current = GHV(temp_bed.current, temp_hotend[heater].current);
431
-        NOLESS(maxT, current);
432
-        NOMORE(minT, current);
430
+        current_temp = GHV(temp_bed.celsius, temp_hotend[heater].celsius);
431
+        NOLESS(maxT, current_temp);
432
+        NOMORE(minT, current_temp);
433 433
 
434 434
         #if ENABLED(PRINTER_EVENT_LEDS)
435
-          ONHEATING(start_temp, current, target);
435
+          ONHEATING(start_temp, current_temp, target);
436 436
         #endif
437 437
 
438 438
         #if HAS_AUTO_FAN
@@ -442,7 +442,7 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
442 442
           }
443 443
         #endif
444 444
 
445
-        if (heating && current > target) {
445
+        if (heating && current_temp > target) {
446 446
           if (ELAPSED(ms, t2 + 5000UL)) {
447 447
             heating = false;
448 448
             SHV((bias - d) >> 1, (bias - d) >> 1);
@@ -452,7 +452,7 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
452 452
           }
453 453
         }
454 454
 
455
-        if (!heating && current < target) {
455
+        if (!heating && current_temp < target) {
456 456
           if (ELAPSED(ms, t1 + 5000UL)) {
457 457
             heating = true;
458 458
             t2 = ms;
@@ -510,7 +510,7 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
510 510
       #ifndef MAX_OVERSHOOT_PID_AUTOTUNE
511 511
         #define MAX_OVERSHOOT_PID_AUTOTUNE 20
512 512
       #endif
513
-      if (current > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
513
+      if (current_temp > target + MAX_OVERSHOOT_PID_AUTOTUNE) {
514 514
         SERIAL_ECHOLNPGM(MSG_PID_TEMP_TOO_HIGH);
515 515
         break;
516 516
       }
@@ -535,15 +535,15 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0
535 535
             #endif
536 536
           ) {
537 537
             if (!heated) {                                          // If not yet reached target...
538
-              if (current > next_watch_temp) {                      // Over the watch temp?
539
-                next_watch_temp = current + watch_temp_increase;    // - set the next temp to watch for
538
+              if (current_temp > next_watch_temp) {                      // Over the watch temp?
539
+                next_watch_temp = current_temp + watch_temp_increase;    // - set the next temp to watch for
540 540
                 temp_change_ms = ms + watch_temp_period * 1000UL;   // - move the expiration timer up
541
-                if (current > watch_temp_target) heated = true;     // - Flag if target temperature reached
541
+                if (current_temp > watch_temp_target) heated = true;     // - Flag if target temperature reached
542 542
               }
543 543
               else if (ELAPSED(ms, temp_change_ms))                 // Watch timer expired
544 544
                 _temp_error(heater, PSTR(MSG_T_HEATING_FAILED), TEMP_ERR_PSTR(MSG_HEATING_FAILED_LCD, heater));
545 545
             }
546
-            else if (current < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?
546
+            else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far?
547 547
               _temp_error(heater, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, heater));
548 548
           }
549 549
         #endif
@@ -685,11 +685,11 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) {
685 685
     uint8_t fanState = 0;
686 686
 
687 687
     HOTEND_LOOP()
688
-      if (temp_hotend[e].current >= EXTRUDER_AUTO_FAN_TEMPERATURE)
688
+      if (temp_hotend[e].celsius >= EXTRUDER_AUTO_FAN_TEMPERATURE)
689 689
         SBI(fanState, pgm_read_byte(&fanBit[e]));
690 690
 
691 691
     #if HAS_AUTO_CHAMBER_FAN
692
-      if (temp_chamber.current >= CHAMBER_AUTO_FAN_TEMPERATURE)
692
+      if (temp_chamber.celsius >= CHAMBER_AUTO_FAN_TEMPERATURE)
693 693
         SBI(fanState, pgm_read_byte(&fanBit[CHAMBER_FAN_INDEX]));
694 694
     #endif
695 695
 
@@ -831,7 +831,7 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
831 831
       static float temp_iState[HOTENDS] = { 0 },
832 832
                    temp_dState[HOTENDS] = { 0 };
833 833
       static bool pid_reset[HOTENDS] = { false };
834
-      const float pid_error = temp_hotend[ee].target - temp_hotend[ee].current;
834
+      const float pid_error = temp_hotend[ee].target - temp_hotend[ee].celsius;
835 835
 
836 836
       if (temp_hotend[ee].target == 0
837 837
         || pid_error < -(PID_FUNCTIONAL_RANGE)
@@ -853,7 +853,7 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
853 853
           pid_reset[ee] = false;
854 854
         }
855 855
 
856
-        work_pid[ee].Kd = work_pid[ee].Kd + PID_K2 * (PID_PARAM(Kd, ee) * (temp_dState[ee] - temp_hotend[ee].current) - work_pid[ee].Kd);
856
+        work_pid[ee].Kd = work_pid[ee].Kd + PID_K2 * (PID_PARAM(Kd, ee) * (temp_dState[ee] - temp_hotend[ee].celsius) - work_pid[ee].Kd);
857 857
         const float max_power_over_i_gain = float(PID_MAX) / PID_PARAM(Ki, ee) - float(MIN_POWER);
858 858
         temp_iState[ee] = constrain(temp_iState[ee] + pid_error, 0, max_power_over_i_gain);
859 859
         work_pid[ee].Kp = PID_PARAM(Kp, ee) * pid_error;
@@ -880,7 +880,7 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
880 880
 
881 881
         LIMIT(pid_output, 0, PID_MAX);
882 882
       }
883
-      temp_dState[ee] = temp_hotend[ee].current;
883
+      temp_dState[ee] = temp_hotend[ee].celsius;
884 884
 
885 885
     #else // PID_OPENLOOP
886 886
 
@@ -893,7 +893,7 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
893 893
         SERIAL_ECHO_START();
894 894
         SERIAL_ECHOPAIR(
895 895
           MSG_PID_DEBUG, ee,
896
-          MSG_PID_DEBUG_INPUT, temp_hotend[ee].current,
896
+          MSG_PID_DEBUG_INPUT, temp_hotend[ee].celsius,
897 897
           MSG_PID_DEBUG_OUTPUT, pid_output
898 898
         );
899 899
         #if DISABLED(PID_OPENLOOP)
@@ -917,7 +917,7 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
917 917
     #else
918 918
       #define _TIMED_OUT_TEST false
919 919
     #endif
920
-    pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].current < temp_hotend[ee].target) ? BANG_MAX : 0;
920
+    pid_output = (!_TIMED_OUT_TEST && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0;
921 921
     #undef _TIMED_OUT_TEST
922 922
 
923 923
   #endif
@@ -936,7 +936,7 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
936 936
       static bool pid_reset = true;
937 937
       float pid_output = 0;
938 938
       const float max_power_over_i_gain = float(MAX_BED_POWER) / temp_bed.pid.Ki - float(MIN_BED_POWER),
939
-                  pid_error = temp_bed.target - temp_bed.current;
939
+                  pid_error = temp_bed.target - temp_bed.celsius;
940 940
 
941 941
       if (!temp_bed.target || pid_error < -(PID_FUNCTIONAL_RANGE)) {
942 942
         pid_output = 0;
@@ -957,9 +957,9 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
957 957
 
958 958
         work_pid.Kp = temp_bed.pid.Kp * pid_error;
959 959
         work_pid.Ki = temp_bed.pid.Ki * temp_iState;
960
-        work_pid.Kd = work_pid.Kd + PID_K2 * (temp_bed.pid.Kd * (temp_dState - temp_bed.current) - work_pid.Kd);
960
+        work_pid.Kd = work_pid.Kd + PID_K2 * (temp_bed.pid.Kd * (temp_dState - temp_bed.celsius) - work_pid.Kd);
961 961
 
962
-        temp_dState = temp_bed.current;
962
+        temp_dState = temp_bed.celsius;
963 963
 
964 964
         pid_output = constrain(work_pid.Kp + work_pid.Ki + work_pid.Kd + float(MIN_BED_POWER), 0, MAX_BED_POWER);
965 965
       }
@@ -973,7 +973,7 @@ float Temperature::get_pid_output_hotend(const uint8_t e) {
973 973
     #if ENABLED(PID_BED_DEBUG)
974 974
       SERIAL_ECHO_START();
975 975
       SERIAL_ECHOLNPAIR(
976
-        " PID_BED_DEBUG : Input ", temp_bed.current, " Output ", pid_output,
976
+        " PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output,
977 977
         #if DISABLED(PID_OPENLOOP)
978 978
           MSG_PID_DEBUG_PTERM, work_pid.Kp,
979 979
           MSG_PID_DEBUG_ITERM, work_pid.Ki,
@@ -1016,13 +1016,13 @@ void Temperature::manage_heater() {
1016 1016
   updateTemperaturesFromRawValues(); // also resets the watchdog
1017 1017
 
1018 1018
   #if ENABLED(HEATER_0_USES_MAX6675)
1019
-    if (temp_hotend[0].current > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
1020
-    if (temp_hotend[0].current < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
1019
+    if (temp_hotend[0].celsius > _MIN(HEATER_0_MAXTEMP, HEATER_0_MAX6675_TMAX - 1.0)) max_temp_error(H_E0);
1020
+    if (temp_hotend[0].celsius < _MAX(HEATER_0_MINTEMP, HEATER_0_MAX6675_TMIN + .01)) min_temp_error(H_E0);
1021 1021
   #endif
1022 1022
 
1023 1023
   #if ENABLED(HEATER_1_USES_MAX6675)
1024
-    if (temp_hotend[1].current > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
1025
-    if (temp_hotend[1].current < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
1024
+    if (temp_hotend[1].celsius > _MIN(HEATER_1_MAXTEMP, HEATER_1_MAX6675_TMAX - 1.0)) max_temp_error(H_E1);
1025
+    if (temp_hotend[1].celsius < _MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(H_E1);
1026 1026
   #endif
1027 1027
 
1028 1028
   #if HAS_THERMAL_PROTECTION || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER
@@ -1041,10 +1041,10 @@ void Temperature::manage_heater() {
1041 1041
 
1042 1042
     #if ENABLED(THERMAL_PROTECTION_HOTENDS)
1043 1043
       // Check for thermal runaway
1044
-      thermal_runaway_protection(tr_state_machine[e], temp_hotend[e].current, temp_hotend[e].target, (heater_ind_t)e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
1044
+      thermal_runaway_protection(tr_state_machine[e], temp_hotend[e].celsius, temp_hotend[e].target, (heater_ind_t)e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS);
1045 1045
     #endif
1046 1046
 
1047
-    temp_hotend[e].soft_pwm_amount = (temp_hotend[e].current > temp_range[e].mintemp || is_preheating(e)) && temp_hotend[e].current < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0;
1047
+    temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_preheating(e)) && temp_hotend[e].celsius < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0;
1048 1048
 
1049 1049
     #if WATCH_HOTENDS
1050 1050
       // Make sure temperature is increasing
@@ -1058,7 +1058,7 @@ void Temperature::manage_heater() {
1058 1058
 
1059 1059
     #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1060 1060
       // Make sure measured temperatures are close together
1061
-      if (ABS(temp_hotend[0].current - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
1061
+      if (ABS(temp_hotend[0].celsius - redundant_temperature) > MAX_REDUNDANT_TEMP_SENSOR_DIFF)
1062 1062
         _temp_error(H_E0, PSTR(MSG_REDUNDANCY), PSTR(MSG_ERR_REDUNDANT_TEMP));
1063 1063
     #endif
1064 1064
 
@@ -1120,7 +1120,7 @@ void Temperature::manage_heater() {
1120 1120
       #endif
1121 1121
 
1122 1122
       #if HAS_THERMALLY_PROTECTED_BED
1123
-        thermal_runaway_protection(tr_state_machine_bed, temp_bed.current, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
1123
+        thermal_runaway_protection(tr_state_machine_bed, temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS);
1124 1124
       #endif
1125 1125
 
1126 1126
       #if HEATER_IDLE_HANDLER
@@ -1134,17 +1134,17 @@ void Temperature::manage_heater() {
1134 1134
       #endif
1135 1135
       {
1136 1136
         #if ENABLED(PIDTEMPBED)
1137
-          temp_bed.soft_pwm_amount = WITHIN(temp_bed.current, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 1 : 0;
1137
+          temp_bed.soft_pwm_amount = WITHIN(temp_bed.celsius, BED_MINTEMP, BED_MAXTEMP) ? (int)get_pid_output_bed() >> 1 : 0;
1138 1138
         #else
1139 1139
           // Check if temperature is within the correct band
1140
-          if (WITHIN(temp_bed.current, BED_MINTEMP, BED_MAXTEMP)) {
1140
+          if (WITHIN(temp_bed.celsius, BED_MINTEMP, BED_MAXTEMP)) {
1141 1141
             #if ENABLED(BED_LIMIT_SWITCHING)
1142
-              if (temp_bed.current >= temp_bed.target + BED_HYSTERESIS)
1142
+              if (temp_bed.celsius >= temp_bed.target + BED_HYSTERESIS)
1143 1143
                 temp_bed.soft_pwm_amount = 0;
1144
-              else if (temp_bed.current <= temp_bed.target - (BED_HYSTERESIS))
1144
+              else if (temp_bed.celsius <= temp_bed.target - (BED_HYSTERESIS))
1145 1145
                 temp_bed.soft_pwm_amount = MAX_BED_POWER >> 1;
1146 1146
             #else // !PIDTEMPBED && !BED_LIMIT_SWITCHING
1147
-              temp_bed.soft_pwm_amount = temp_bed.current < temp_bed.target ? MAX_BED_POWER >> 1 : 0;
1147
+              temp_bed.soft_pwm_amount = temp_bed.celsius < temp_bed.target ? MAX_BED_POWER >> 1 : 0;
1148 1148
             #endif
1149 1149
           }
1150 1150
           else {
@@ -1182,14 +1182,14 @@ void Temperature::manage_heater() {
1182 1182
     if (ELAPSED(ms, next_chamber_check_ms)) {
1183 1183
       next_chamber_check_ms = ms + CHAMBER_CHECK_INTERVAL;
1184 1184
 
1185
-      if (WITHIN(temp_chamber.current, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
1185
+      if (WITHIN(temp_chamber.celsius, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) {
1186 1186
         #if ENABLED(CHAMBER_LIMIT_SWITCHING)
1187
-          if (temp_chamber.current >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
1187
+          if (temp_chamber.celsius >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS)
1188 1188
             temp_chamber.soft_pwm_amount = 0;
1189
-          else if (temp_chamber.current <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS))
1189
+          else if (temp_chamber.celsius <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS))
1190 1190
             temp_chamber.soft_pwm_amount = MAX_CHAMBER_POWER >> 1;
1191 1191
         #else
1192
-          temp_chamber.soft_pwm_amount = temp_chamber.current < temp_chamber.target ? MAX_CHAMBER_POWER >> 1 : 0;
1192
+          temp_chamber.soft_pwm_amount = temp_chamber.celsius < temp_chamber.target ? MAX_CHAMBER_POWER >> 1 : 0;
1193 1193
         #endif
1194 1194
       }
1195 1195
       else {
@@ -1198,12 +1198,12 @@ void Temperature::manage_heater() {
1198 1198
       }
1199 1199
 
1200 1200
       #if ENABLED(THERMAL_PROTECTION_CHAMBER)
1201
-        thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.current, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS);
1201
+        thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS);
1202 1202
       #endif
1203 1203
     }
1204 1204
 
1205 1205
     // TODO: Implement true PID pwm
1206
-    //temp_bed.soft_pwm_amount = WITHIN(temp_chamber.current, CHAMBER_MINTEMP, CHAMBER_MAXTEMP) ? (int)get_pid_output_chamber() >> 1 : 0;
1206
+    //temp_bed.soft_pwm_amount = WITHIN(temp_chamber.celsius, CHAMBER_MINTEMP, CHAMBER_MAXTEMP) ? (int)get_pid_output_chamber() >> 1 : 0;
1207 1207
 
1208 1208
   #endif // HAS_HEATED_CHAMBER
1209 1209
 }
@@ -1500,12 +1500,12 @@ void Temperature::updateTemperaturesFromRawValues() {
1500 1500
   #if ENABLED(HEATER_1_USES_MAX6675)
1501 1501
     temp_hotend[1].raw = READ_MAX6675(1);
1502 1502
   #endif
1503
-  HOTEND_LOOP() temp_hotend[e].current = analog_to_celsius_hotend(temp_hotend[e].raw, e);
1503
+  HOTEND_LOOP() temp_hotend[e].celsius = analog_to_celsius_hotend(temp_hotend[e].raw, e);
1504 1504
   #if HAS_HEATED_BED
1505
-    temp_bed.current = analog_to_celsius_bed(temp_bed.raw);
1505
+    temp_bed.celsius = analog_to_celsius_bed(temp_bed.raw);
1506 1506
   #endif
1507 1507
   #if HAS_TEMP_CHAMBER
1508
-    temp_chamber.current = analog_to_celsius_chamber(temp_chamber.raw);
1508
+    temp_chamber.celsius = analog_to_celsius_chamber(temp_chamber.raw);
1509 1509
   #endif
1510 1510
   #if ENABLED(TEMP_SENSOR_1_AS_REDUNDANT)
1511 1511
     redundant_temperature = analog_to_celsius_hotend(redundant_temperature_raw, 1);

+ 10
- 10
Marlin/src/module/temperature.h View File

@@ -158,7 +158,7 @@ enum ADCSensorState : char {
158 158
 typedef struct TempInfo {
159 159
   uint16_t acc;
160 160
   int16_t raw;
161
-  float current;
161
+  float celsius;
162 162
   inline void reset() { acc = 0; }
163 163
   inline void sample(const uint16_t s) { acc += s; }
164 164
   inline void update() { raw = acc; }
@@ -577,7 +577,7 @@ class Temperature {
577 577
 
578 578
     FORCE_INLINE static float degHotend(const uint8_t e) {
579 579
       E_UNUSED();
580
-      return temp_hotend[HOTEND_INDEX].current;
580
+      return temp_hotend[HOTEND_INDEX].celsius;
581 581
     }
582 582
 
583 583
     #if ENABLED(SHOW_TEMP_ADC_VALUES)
@@ -625,12 +625,12 @@ class Temperature {
625 625
 
626 626
     FORCE_INLINE static bool isHeatingHotend(const uint8_t e) {
627 627
       E_UNUSED();
628
-      return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].current;
628
+      return temp_hotend[HOTEND_INDEX].target > temp_hotend[HOTEND_INDEX].celsius;
629 629
     }
630 630
 
631 631
     FORCE_INLINE static bool isCoolingHotend(const uint8_t e) {
632 632
       E_UNUSED();
633
-      return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].current;
633
+      return temp_hotend[HOTEND_INDEX].target < temp_hotend[HOTEND_INDEX].celsius;
634 634
     }
635 635
 
636 636
     #if HAS_TEMP_HOTEND
@@ -650,10 +650,10 @@ class Temperature {
650 650
       #if ENABLED(SHOW_TEMP_ADC_VALUES)
651 651
         FORCE_INLINE static int16_t rawBedTemp()  { return temp_bed.raw; }
652 652
       #endif
653
-      FORCE_INLINE static float degBed()          { return temp_bed.current; }
653
+      FORCE_INLINE static float degBed()          { return temp_bed.celsius; }
654 654
       FORCE_INLINE static int16_t degTargetBed()  { return temp_bed.target; }
655
-      FORCE_INLINE static bool isHeatingBed()     { return temp_bed.target > temp_bed.current; }
656
-      FORCE_INLINE static bool isCoolingBed()     { return temp_bed.target < temp_bed.current; }
655
+      FORCE_INLINE static bool isHeatingBed()     { return temp_bed.target > temp_bed.celsius; }
656
+      FORCE_INLINE static bool isCoolingBed()     { return temp_bed.target < temp_bed.celsius; }
657 657
 
658 658
       #if WATCH_BED
659 659
         static void start_watching_bed();
@@ -687,11 +687,11 @@ class Temperature {
687 687
       #if ENABLED(SHOW_TEMP_ADC_VALUES)
688 688
         FORCE_INLINE static int16_t rawChamberTemp()    { return temp_chamber.raw; }
689 689
       #endif
690
-      FORCE_INLINE static float degChamber()            { return temp_chamber.current; }
690
+      FORCE_INLINE static float degChamber()            { return temp_chamber.celsius; }
691 691
       #if HAS_HEATED_CHAMBER
692 692
         FORCE_INLINE static int16_t degTargetChamber()  { return temp_chamber.target; }
693
-        FORCE_INLINE static bool isHeatingChamber()     { return temp_chamber.target > temp_chamber.current; }
694
-        FORCE_INLINE static bool isCoolingChamber()     { return temp_chamber.target < temp_chamber.current; }
693
+        FORCE_INLINE static bool isHeatingChamber()     { return temp_chamber.target > temp_chamber.celsius; }
694
+        FORCE_INLINE static bool isCoolingChamber()     { return temp_chamber.target < temp_chamber.celsius; }
695 695
 
696 696
         static bool wait_for_chamber(const bool no_wait_for_cooling=true);
697 697
       #endif

Loading…
Cancel
Save