mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-02 11:00:57 +02:00
ota handler added, wip
This commit is contained in:
@ -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());
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "AirGradient.h"
|
||||
#include "AgApiClient.h"
|
||||
|
||||
class OpenMetrics{
|
||||
class OpenMetrics {
|
||||
private:
|
||||
AirGradient *ag;
|
||||
Measurements &measure;
|
||||
|
12
examples/OneOpenAir/OtaHandler.h
Normal file
12
examples/OneOpenAir/OtaHandler.h
Normal file
@ -0,0 +1,12 @@
|
||||
#ifndef _OTA_HANDLER_H_
|
||||
#define _OTA_HANDLER_H_
|
||||
|
||||
|
||||
class OtaHandler {
|
||||
public:
|
||||
void updateFirmwareIfOutdated() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user