Skip to content

Commit 9967e84

Browse files
committed
Report 50°C on virtual TMC heater channel for any driver being active
1 parent 63e77d6 commit 9967e84

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

src/Platform.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2851,6 +2851,19 @@ void Platform::DisableAllDrives()
28512851
}
28522852
}
28532853

2854+
// Check if at least one driver is NOT in state disabled
2855+
bool Platform::IsAnyDriverActive() const
2856+
{
2857+
for (size_t driver = 0; driver < DRIVES; ++driver)
2858+
{
2859+
if (driverState[driver] != DriverStatus::disabled)
2860+
{
2861+
return true;
2862+
}
2863+
}
2864+
return false;
2865+
}
2866+
28542867
// Set drives to idle hold if they are enabled. If a drive is disabled, leave it alone.
28552868
// Must not be called from an ISR, or with interrupts disabled.
28562869
void Platform::SetDriversIdle()
@@ -4165,10 +4178,11 @@ float Platform::GetCurrentPowerVoltage() const
41654178
// TMC driver temperatures
41664179
float Platform::GetTmcDriversTemperature(unsigned int board) const
41674180
{
4168-
const uint16_t mask = ((1u << 5) - 1) << (5 * board); // there are 5 driver son each board
4181+
const uint16_t mask = ((1u << 5) - 1) << (5 * board); // there are 5 drivers on each board
41694182
return ((temperatureShutdownDrivers & mask) != 0) ? 150.0
41704183
: ((temperatureWarningDrivers & mask) != 0) ? 100.0
4171-
: 0.0;
4184+
: IsAnyDriverActive() ? 50.0
4185+
: 0.0;
41724186
}
41734187

41744188
#endif

src/Platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ class Platform
407407
void EnableDrive(size_t axisOrExtruder);
408408
void DisableDrive(size_t axisOrExtruder);
409409
void DisableAllDrives();
410+
bool IsAnyDriverActive() const;
410411
void SetDriversIdle();
411412
void SetMotorCurrent(size_t axisOrExtruder, float current, int code);
412413
float GetMotorCurrent(size_t axisOrExtruder, int code) const;

0 commit comments

Comments
 (0)