Prevent multiple-starts on a thread from causing panic

This commit is contained in:
Matthew Kennedy 2023-10-12 19:08:53 -04:00 committed by rusefi
parent 2374a47182
commit 6f52a25c2b
2 changed files with 9 additions and 1 deletions

View File

@ -31,6 +31,9 @@ Release template (copy/paste this for new release):
### Added
- DAC with Lua #5601
### Fixed
- Changing idle stepper settings causes kernel panic
## October 2023 "Day 591"
### Breaking Changes

View File

@ -19,6 +19,7 @@ class ThreadController : public chibios_rt::BaseStaticThread<TStackSize>
{
private:
const tprio_t m_prio;
bool m_started = false;
protected:
// Override this function to implement your controller's thread's behavior.
@ -44,6 +45,10 @@ public:
*/
void start()
{
chibios_rt::BaseStaticThread<TStackSize>::start(m_prio);
if (!m_started)
{
m_started = true;
chibios_rt::BaseStaticThread<TStackSize>::start(m_prio);
}
}
};