diff options
author | David Crocker <dcrocker@eschertech.com> | 2018-04-01 18:49:43 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2018-04-01 18:49:43 +0300 |
commit | 97e7b46202b9f71075101ed86b6967904f87fa98 (patch) | |
tree | 4852f94f2497ae43f6f2ba69c6a72ace6f1f7fd0 /src/Heating | |
parent | 4d151a5d02a8bca3810e4a75bf225136548fa1ab (diff) |
More RTOS work
Refactored mutex and task interface
Output channels, tool list and message box data are now thread safe
Diffstat (limited to 'src/Heating')
-rw-r--r-- | src/Heating/Heat.cpp | 9 | ||||
-rw-r--r-- | src/Heating/Sensors/SpiTemperatureSensor.cpp | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/Heating/Heat.cpp b/src/Heating/Heat.cpp index 977e0b28..ef3bc3f9 100644 --- a/src/Heating/Heat.cpp +++ b/src/Heating/Heat.cpp @@ -37,8 +37,7 @@ const uint32_t HeaterTaskStackSize = 128; // task stack size in dwords const uint32_t HeaterTaskPriority = 1; static uint32_t heaterTaskStack[HeaterTaskStackSize]; -static TaskStorage heaterTaskBuffer; -static TaskHandle heaterTaskHandle; +static Task heaterTask; extern "C" void HeaterTask(void * pvParameters) { @@ -145,7 +144,7 @@ void Heat::Init() coldExtrude = false; #ifdef RTOS - heaterTaskHandle = RTOSIface::CreateTask(HeaterTask, "HEAT", ARRAY_SIZE(heaterTaskStack), nullptr, HeaterTaskPriority, heaterTaskStack, heaterTaskBuffer); + heaterTask.Create(HeaterTask, "HEAT", ARRAY_SIZE(heaterTaskStack), nullptr, HeaterTaskPriority, heaterTaskStack); #else lastTime = millis() - platform.HeatSampleInterval(); // flag the PIDS as due for spinning longWait = millis(); @@ -161,7 +160,7 @@ void Heat::Exit() } #ifdef RTOS - RTOSIface::SuspendTask(heaterTaskHandle); + heaterTask.Suspend(); #else active = false; #endif @@ -255,7 +254,7 @@ void Heat::Diagnostics(MessageType mtype) } } #ifdef RTOS - Tasks::TaskDiagnostics(mtype, heaterTaskHandle); + Tasks::TaskDiagnostics(mtype, heaterTask); #endif } diff --git a/src/Heating/Sensors/SpiTemperatureSensor.cpp b/src/Heating/Sensors/SpiTemperatureSensor.cpp index a1a4fc26..6c447714 100644 --- a/src/Heating/Sensors/SpiTemperatureSensor.cpp +++ b/src/Heating/Sensors/SpiTemperatureSensor.cpp @@ -31,7 +31,7 @@ TemperatureError SpiTemperatureSensor::DoSpiTransaction(const uint8_t dataOut[], uint8_t rawBytes[8]; spi_status_t sts; { - Locker lock(Tasks::GetSpiMutextHandle(), 50); + MutexLocker lock(Tasks::GetSpiMutex(), 50); if (!lock) { return TemperatureError::busBusy; |