1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-15 23:13:07 +01:00

Split reading all sensor data in a separate task (thanks to Andreas)

This commit is contained in:
norbert-walter
2022-03-20 18:10:25 +01:00
parent 758778ace4
commit 1baa959d8f
5 changed files with 421 additions and 372 deletions

View File

@@ -0,0 +1,28 @@
#pragma once
#include "GwSynchronized.h"
#include "GwApi.h"
#include "freertos/semphr.h"
#include "Pagedata.h"
class SharedData{
private:
SemaphoreHandle_t locker;
SensorData sensors;
public:
GwApi *api=NULL;
SharedData(GwApi *api){
locker=xSemaphoreCreateMutex();
this->api=api;
}
void setSensorData(SensorData &values){
GWSYNCHRONIZED(&locker);
sensors=values;
}
SensorData getSensorData(){
GWSYNCHRONIZED(&locker);
return sensors;
}
};
void createSensorTask(SharedData *shared);