Moved the battery sensing logic in a task and added a task to reset/restart the module
This commit is contained in:
parent
b93a6f64e8
commit
9c030518c5
@ -13,8 +13,24 @@ boolean task2(void *pData)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean task_blink(void *pData)
|
||||
{
|
||||
SAB *p = (SAB *) pData;
|
||||
p->getIoManager().getPcf().togglePin(PCF8574::P2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean task_batt_sensing(void *pData)
|
||||
{
|
||||
View1Packet *p = (View1Packet *) pData;
|
||||
Serial.println(F("BATT SENSING..."));
|
||||
p->powerInfo = p->sab->getPowerInfo();
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean task_esp_reset_restart(void * pData)
|
||||
{
|
||||
ESP.restart();
|
||||
}
|
||||
|
@ -2,9 +2,12 @@
|
||||
#define TASKS_H
|
||||
#include <Arduino.h>
|
||||
#include "SAB.h"
|
||||
#include "views.h"
|
||||
|
||||
boolean task1(void *);
|
||||
boolean task2(void *);
|
||||
boolean task_blink(void *);
|
||||
boolean task_batt_sensing(void *);
|
||||
boolean task_esp_reset_restart(void *);
|
||||
|
||||
#endif //TASKS_H
|
||||
|
Loading…
Reference in New Issue
Block a user