Improve build and integrate firmware versioning

This commit is contained in:
2026-01-14 14:45:54 +01:00
parent eb73c573b4
commit c03b393cf5
6 changed files with 182 additions and 7 deletions

View File

@@ -1,4 +1,5 @@
#include <Arduino.h>
#include "main.h"
#include <Preferences.h>
#include <ArduinoJson.h>
#include <WiFi.h>
@@ -10,7 +11,6 @@
#include <NMEA2000.h>
#include <N2kMsg.h>
#include <N2kMessages.h>
#include "main.h"
#include "Nmea2kTwai.h"
#include "N2kDeviceList.h"
#include <map>
@@ -18,6 +18,21 @@
#include "mbedtls/md.h" // for SHA256
#include <esp32/clk.h> // for cpu frequency
#include "driver/rtc_io.h" // for wakeup from deep sleep
#include "esp_app_format.h" // for custom fw descriptor
// ESP-IDF firmware descriptor
__attribute__((section(".rodata_custom_desc"))) esp_app_desc_t custom_app_desc = {
ESP_APP_DESC_MAGIC_WORD,
1, // secure version
{0, 0}, // reserved
VERSION,
FIRMWARE_TYPE,
BUILD_DATE,
BUILD_TIME,
IDF_VERSION,
{},
{}
};
String get_sha256(String payload) {
byte shaResult[32];
@@ -442,7 +457,7 @@ void setup() {
StaticJsonDocument<512> doc;
doc["systemName"] = "Keypad1";
doc["logLevel"] = 0;
doc["version"] = "0.0";
doc["version"] = VERSION;
doc["fwtype"] = "unknown";
doc["salt"] = "secret";
doc["AdminPassword"] = "********";