ota handler added, wip

This commit is contained in:
nick-4711
2024-04-23 05:59:58 +07:00
parent 5275f5a810
commit 12f03aff30
5 changed files with 23 additions and 7 deletions

View File

@ -37,7 +37,7 @@ CC BY-SA 4.0 Attribution-ShareAlike 4.0 International License
*/
#include <HardwareSerial.h>
#include "OtaHandler.h"
#include "AgApiClient.h"
#include "AgConfigure.h"
#include "AgSchedule.h"
@ -81,6 +81,7 @@ static StateMachine stateMachine(oledDisplay, Serial, measurements,
static WifiConnector wifiConnector(oledDisplay, Serial, stateMachine, configuration);
static OpenMetrics openMetrics(measurements, configuration, wifiConnector,
apiClient);
static OtaHandler otaHandler;
static LocalServer localServer(Serial, openMetrics, measurements, configuration,
wifiConnector);
@ -178,6 +179,12 @@ void setup() {
initMqtt();
sendDataToAg();
#ifdef ESP8266
// ota not supported
#else
otaHandler.updateFirmwareIfOutdated();
#endif
apiClient.fetchServerConfiguration();
configSchedule.update();
if (apiClient.isFetchConfigureFailed()) {
@ -467,7 +474,6 @@ static void oneIndoorInit(void) {
/** Show boot display */
Serial.println("Firmware Version: " + ag->getVersion());
Serial.printf("Firmware version: %s\n", GIT_VERSION);
oledDisplay.setText("AirGradient ONE",
"FW Version: ", ag->getVersion().c_str());

View File

@ -7,7 +7,7 @@
#include "AirGradient.h"
#include "AgApiClient.h"
class OpenMetrics{
class OpenMetrics {
private:
AirGradient *ag;
Measurements &measure;

View File

@ -0,0 +1,12 @@
#ifndef _OTA_HANDLER_H_
#define _OTA_HANDLER_H_
class OtaHandler {
public:
void updateFirmwareIfOutdated() {
}
};
#endif