Skip to content

Commit

Permalink
🩹 Update preheat end time var (MarlinFirmware#27023)
Browse files Browse the repository at this point in the history
Co-authored-by: ellensp <530024+ellensp@users.noreply.github.com>
Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
  • Loading branch information
3 people authored May 6, 2024
1 parent ece37ba commit 5b0c818
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Marlin/src/module/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ volatile bool Temperature::raw_temps_ready = false;
#endif

#if MILLISECONDS_PREHEAT_TIME > 0
millis_t Temperature::preheat_end_ms_hotend[HOTENDS]; // = { 0 };
millis_t Temperature::preheat_end_ms_hotend[HOTENDS]; // = { 0 }
#endif
#if HAS_HEATED_BED && PREHEAT_TIME_BED_MS > 0
millis_t Temperature::preheat_end_ms_bed = 0;
Expand Down Expand Up @@ -2442,7 +2442,7 @@ void Temperature::updateTemperaturesFromRawValues() {
/**
// DEBUG PREHEATING TIME
SERIAL_ECHOLNPGM("\nExtruder = ", e, " Preheat On/Off = ", is_preheating(e));
const float test_is_preheating = (preheat_end_time[HOTEND_INDEX] - millis()) * 0.001f;
const float test_is_preheating = (preheat_end_ms_hotend[HOTEND_INDEX] - millis()) * 0.001f;
if (test_is_preheating < 31) SERIAL_ECHOLNPGM("Extruder = ", e, " Preheat remaining time = ", test_is_preheating, "s", "\n");
//*/

Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/module/temperature.h
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ class Temperature {
#endif

#if MILLISECONDS_PREHEAT_TIME > 0
static millis_t preheat_end_time[HOTENDS];
static millis_t preheat_end_ms_hotend[HOTENDS];
#endif

#if HAS_FAN_LOGIC
Expand Down Expand Up @@ -909,13 +909,13 @@ class Temperature {
*/
#if MILLISECONDS_PREHEAT_TIME > 0
static bool is_preheating(const uint8_t E_NAME) {
return preheat_end_time[HOTEND_INDEX] && PENDING(millis(), preheat_end_time[HOTEND_INDEX]);
return preheat_end_ms_hotend[HOTEND_INDEX] && PENDING(millis(), preheat_end_ms_hotend[HOTEND_INDEX]);
}
static void start_preheat_time(const uint8_t E_NAME) {
preheat_end_time[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
preheat_end_ms_hotend[HOTEND_INDEX] = millis() + MILLISECONDS_PREHEAT_TIME;
}
static void reset_preheat_time(const uint8_t E_NAME) {
preheat_end_time[HOTEND_INDEX] = 0;
preheat_end_ms_hotend[HOTEND_INDEX] = 0;
}
#else
#define is_preheating(n) (false)
Expand Down

0 comments on commit 5b0c818

Please sign in to comment.