File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -2859,6 +2859,21 @@ void Platform::DisableAllDrives()
28592859 }
28602860}
28612861
2862+ // Check if at least one driver is NOT in state disabled
2863+ bool Platform::IsAnyDriverActive (unsigned int board) const
2864+ {
2865+ const size_t firstDriver = board * 5 ;
2866+ const size_t lastDriver = min<size_t >(firstDriver + 4 , DRIVES);
2867+ for (size_t driver = firstDriver; driver < lastDriver; ++driver)
2868+ {
2869+ if (driverState[driver] != DriverStatus::disabled)
2870+ {
2871+ return true ;
2872+ }
2873+ }
2874+ return false ;
2875+ }
2876+
28622877// Set drives to idle hold if they are enabled. If a drive is disabled, leave it alone.
28632878// Must not be called from an ISR, or with interrupts disabled.
28642879void Platform::SetDriversIdle ()
@@ -4173,10 +4188,11 @@ float Platform::GetCurrentPowerVoltage() const
41734188// TMC driver temperatures
41744189float Platform::GetTmcDriversTemperature (unsigned int board) const
41754190{
4176- const uint16_t mask = ((1u << 5 ) - 1 ) << (5 * board); // there are 5 driver son each board
4191+ const uint16_t mask = ((1u << 5 ) - 1 ) << (5 * board); // there are 5 drivers on each board
41774192 return ((temperatureShutdownDrivers & mask) != 0 ) ? 150.0
41784193 : ((temperatureWarningDrivers & mask) != 0 ) ? 100.0
4179- : 0.0 ;
4194+ : IsAnyDriverActive (board) ? 50.0
4195+ : 0.0 ;
41804196}
41814197
41824198#endif
Original file line number Diff line number Diff 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 (unsigned int board) const ;
410411 void SetDriversIdle ();
411412 void SetMotorCurrent (size_t axisOrExtruder, float current, int code);
412413 float GetMotorCurrent (size_t axisOrExtruder, int code) const ;
You can’t perform that action at this time.
0 commit comments