Added Updater to automatically perform OTA updates without user interaction.

This commit is contained in:
2019-11-28 06:42:30 +01:00
parent 3b0410f560
commit 07b1ea3a5c
9 changed files with 192 additions and 4 deletions

View File

@ -3,6 +3,7 @@
#include "config.h"
#include "playlist.h"
#include "http_server.h"
#include "updater.h"
#include <ArduinoJson.h>
Controller::Controller(Player* p, PlaylistManager* playlist_manager) {
@ -50,6 +51,14 @@ void Controller::loop() {
process_message(_cmd_queue);
_cmd_queue = "";
}
#ifdef OTA_UPDATE_URL
if (!player->is_playing() && _last_update_check_at<millis() && _last_update_check_at + OTA_CHECK_INTERVAL < millis()) {
Updater::run();
} else {
_last_update_check_at = millis();
}
#endif
TRACE("Controller::loop() done.\n");
}