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
This commit is contained in:
Frank
2024-05-22 13:03:30 +02:00
parent a25e608e2b
commit eb3200bb29
3 changed files with 26 additions and 15 deletions

View File

@@ -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;

View File

@@ -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<PSRAM_Allocator>;
// 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<PSRAM_Allocator>;
#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!)

View File

@@ -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<br>("));
#if defined(CONFIG_IDF_TARGET_ESP32C3)
oappend(SET_F("ESP32-C3"));