configmanager: enhancements for version migration

This commit is contained in:
Klaus K Wilting committed 2020-10-04 19:10:36 +02:00
1 parent 1cbf0d7124
commit 414bc41404
5 files changed
+78 -56

No files matched your search

+2 -1
View File
@@ -1,11 +1,12 @@
#ifndef _CONFIGMANAGER_H
#define _CONFIGMANAGER_H
#include <Preferences.h>
#include "globals.h"
#include <Preferences.h>
void saveConfig(bool erase = false);
bool loadConfig(void);
void eraseConfig(void);
int version_compare(const String v1, const String v2);
#endif
+3 -2
View File
@@ -60,8 +60,10 @@ enum runmode_t {
};
// Struct holding devices's runtime configuration
// using packed to avoid compiler padding, because struct will be memcpy'd to byte array
// using packed to avoid compiler padding, because struct will be memcpy'd to
// byte array
typedef struct __attribute__((packed)) {
char version[10]; // Firmware version
uint8_t loradr; // 0-15, lora datarate
uint8_t txpower; // 2-15, lora tx power
uint8_t adrmode; // 0=disabled, 1=enabled
@@ -80,7 +82,6 @@ typedef struct __attribute__((packed)) {
uint8_t monitormode; // 0=disabled, 1=enabled
uint8_t runmode; // 0=normal, 1=update
uint8_t payloadmask; // bitswitches for payload data
char version[10]; // Firmware version
#ifdef HAS_BME680
uint8_t
bsecstate[BSEC_MAX_STATE_BLOB_SIZE + 1]; // BSEC state for BME680 sensor
+1 -3
View File
@@ -6,17 +6,15 @@
#include "globals.h"
#include "led.h"
#include "display.h"
#include "configmanager.h"
#include <Update.h>
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include <BintrayClient.h>
#include <string>
#include <algorithm>
int do_ota_update();
void start_ota_update();
int version_compare(const String v1, const String v2);
void ota_display(const uint8_t row, const std::string status,
const std::string msg);
void show_progress(unsigned long current, unsigned long size);