Skip to content

Commit ad87247

Browse files
committed
Report 50°C on virtual TMC heater channel for any driver being active
1 parent 5db5043 commit ad87247

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
@@ -2813,6 +2813,19 @@ void Platform::DisableAllDrives()
28132813
}
28142814
}
28152815

2816+
// Check if at least one driver is NOT in state disabled
2817+
bool Platform::IsAnyDriverActive()
2818+
{
2819+
for (size_t driver = 0; driver < DRIVES; ++driver)
2820+
{
2821+
if (driverState[driver] != DriverStatus::disabled)
2822+
{
2823+
return true;
2824+
}
2825+
}
2826+
return false;
2827+
}
2828+
28162829
// Set drives to idle hold if they are enabled. If a drive is disabled, leave it alone.
28172830
// Must not be called from an ISR, or with interrupts disabled.
28182831
void Platform::SetDriversIdle()
@@ -4108,10 +4121,11 @@ float Platform::GetCurrentPowerVoltage() const
41084121
// TMC driver temperatures
41094122
float Platform::GetTmcDriversTemperature(unsigned int board) const
41104123
{
4111-
const uint16_t mask = ((1u << 5) - 1) << (5 * board); // there are 5 driver son each board
4124+
const uint16_t mask = ((1u << 5) - 1) << (5 * board); // there are 5 drivers on each board
41124125
return ((temperatureShutdownDrivers & mask) != 0) ? 150.0
41134126
: ((temperatureWarningDrivers & mask) != 0) ? 100.0
4114-
: 0.0;
4127+
: IsAnyDriverActive() ? 50.0
4128+
: 0.0;
41154129
}
41164130

41174131
#endif

src/Platform.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ class Platform
403403
void EnableDrive(size_t axisOrExtruder);
404404
void DisableDrive(size_t axisOrExtruder);
405405
void DisableAllDrives();
406+
bool IsAnyDriverActive();
406407
void SetDriversIdle();
407408
void SetMotorCurrent(size_t axisOrExtruder, float current, int code);
408409
float GetMotorCurrent(size_t axisOrExtruder, int code) const;

0 commit comments

Comments
 (0)