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

@ -1,13 +1,21 @@
#pragma once
#include <Arduino.h>
// This is a simple number indicating the version for the HTTP Updater.
#define OTA_VERSION 1
// Comment out to prevent automatic updates.
#define OTA_UPDATE_URL "https://files.schle.nz/esmp3/update.manifest"
#define OTA_CHECK_INTERVAL 12*60*60*1000 // 12 hours
#define SHOW_DEBUG
//#define SHOW_TRACE
#define FTP_DEBUG
#define DELAY_AFTER_DEBUG_AND_TRACE 0
#define WIFI_SSID "---CHANGEME---"
#define WIFI_PASS "---CHANGEME---"
// Here you can define WiFi data to use. But actually, the better way to do
// this is by using /_wifi.txt on the sd card.
//#define WIFI_SSID "---CHANGEME---"
//#define WIFI_PASS "---CHANGEME---"
#define VS1053_SLEEP_DELAY 5000
#define POSITION_SEND_INTERVAL 5000

View File

@ -32,6 +32,7 @@ private:
unsigned long _last_rfid_scan_at = 0;
unsigned long _last_position_info_at = 0;
unsigned long _last_update_check_at = 0;
String _serial_buffer = String();
String _cmd_queue = "";
void _execute_command_ls(String path);

8
include/updater.h Normal file
View File

@ -0,0 +1,8 @@
#pragma once
class Updater {
public:
static void run();
static bool do_update(int cmd, String url);
static void update_spiffs();
};