Moved the battery sensing logic in a task and added a task to reset/restart the module

This commit is contained in:
anschrammh 2019-09-01 21:34:32 +02:00
parent b93a6f64e8
commit 9c030518c5
2 changed files with 19 additions and 0 deletions

View File

@ -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();
}

View File

@ -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