From eb3200bb291de1ee213647b6cd56b3153347bd99 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Wed, 22 May 2024 13:03:30 +0200 Subject: [PATCH] align JSON release info with upstream 0_15 (update page, JSON "info") align with upstream /json/info * info.release * info.arch * info.clock * info.flash --- wled00/json.cpp | 12 +++++++++--- wled00/wled.h | 27 ++++++++++++++++----------- wled00/xml.cpp | 2 +- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/wled00/json.cpp b/wled00/json.cpp index eeb61a42..5456b455 100644 --- a/wled00/json.cpp +++ b/wled00/json.cpp @@ -897,9 +897,10 @@ String restartCode2Info(esp_reset_reason_t reason) { void serializeInfo(JsonObject root) { root[F("ver")] = versionString; - root[F("rel")] = releaseString; //WLEDMM to add bin name root[F("vid")] = VERSION; - //root[F("cn")] = WLED_CODENAME; + //root[F("cn")] = F(WLED_CODENAME); //WLEDMM removed + root[F("release")] = FPSTR(releaseString); + root[F("rel")] = FPSTR(releaseString); //WLEDMM to add bin name JsonObject leds = root.createNestedObject("leds"); leds[F("count")] = strip.getLengthTotal(); @@ -1018,12 +1019,15 @@ void serializeInfo(JsonObject root) wifi_info[F("txPower")] = (int) WiFi.getTxPower(); wifi_info[F("sleep")] = (bool) WiFi.getSleep(); #endif - #if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) + //#if !defined(CONFIG_IDF_TARGET_ESP32C2) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32S3) + #if CONFIG_IDF_TARGET_ESP32 root[F("arch")] = "esp32"; #else root[F("arch")] = ESP.getChipModel(); #endif root[F("core")] = ESP.getSdkVersion(); + root[F("clock")] = ESP.getCpuFreqMHz(); + root[F("flash")] = (ESP.getFlashChipSize()/1024)/1024; //root[F("maxalloc")] = ESP.getMaxAllocHeap(); #ifdef WLED_DEBUG root[F("resetReason0")] = (int)rtc_get_reset_reason(0); @@ -1043,6 +1047,8 @@ void serializeInfo(JsonObject root) #else root[F("arch")] = "esp8266"; root[F("core")] = ESP.getCoreVersion(); + root[F("clock")] = ESP.getCpuFreqMHz(); + root[F("flash")] = (ESP.getFlashChipSize()/1024)/1024; //root[F("maxalloc")] = ESP.getMaxFreeBlockSize(); #ifdef WLED_DEBUG root[F("resetReason")] = (int)ESP.getResetInfoPtr()->reason; diff --git a/wled00/wled.h b/wled00/wled.h index 3153e913..711b3d35 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2405170 +#define VERSION 2405220 // WLEDMM - you can check for this define in usermods, to only enabled WLEDMM specific code in the "right" fork. Its not defined in AC WLED. #define _MoonModules_WLED_ @@ -271,16 +271,17 @@ using PSRAMDynamicJsonDocument = BasicJsonDocument; // int arr[]{0,1,2} becomes WLED_GLOBAL int arr[] _INIT_N(({0,1,2})); #ifndef WLED_DEFINE_GLOBAL_VARS -# define WLED_GLOBAL extern -# define _INIT(x) -# define _INIT_N(x) + #define WLED_GLOBAL extern + #define _INIT(x) + #define _INIT_N(x) + #define _INIT_PROGMEM(x) #else -# define WLED_GLOBAL -# define _INIT(x) = x - -//needed to ignore commas in array definitions -#define UNPACK( ... ) __VA_ARGS__ -# define _INIT_N(x) UNPACK x + #define WLED_GLOBAL + #define _INIT(x) = x + //needed to ignore commas in array definitions + #define UNPACK( ... ) __VA_ARGS__ + #define _INIT_N(x) UNPACK x + #define _INIT_PROGMEM(x) PROGMEM = x #endif #define STRINGIFY(X) #X @@ -290,9 +291,13 @@ using PSRAMDynamicJsonDocument = BasicJsonDocument; #define WLED_VERSION "dev" #endif +#ifndef WLED_RELEASE_NAME + #define WLED_RELEASE_NAME mdev_release +#endif + // Global Variable definitions WLED_GLOBAL char versionString[] _INIT(TOSTRING(WLED_VERSION)); -WLED_GLOBAL char releaseString[] _INIT(TOSTRING(WLED_RELEASE_NAME)); //WLEDMM: to show on update page +WLED_GLOBAL char releaseString[] _INIT_PROGMEM(TOSTRING(WLED_RELEASE_NAME)); //WLEDMM: to show on update page // somehow this will not work if using "const char releaseString[] #define WLED_CODENAME "Hoshi" // AP and OTA default passwords (for maximum security change them!) diff --git a/wled00/xml.cpp b/wled00/xml.cpp index dbb9ce75..0c6a1566 100644 --- a/wled00/xml.cpp +++ b/wled00/xml.cpp @@ -846,7 +846,7 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W olen -= 2; //delete "; oappend(versionString); oappend(SET_F(" ")); - oappend(releaseString); + oappend((char*)FPSTR(releaseString)); oappend(SET_F(".bin
(")); #if defined(CONFIG_IDF_TARGET_ESP32C3) oappend(SET_F("ESP32-C3"));