diff --git a/src/cmnds/cmd_if.c b/src/cmnds/cmd_if.c index 7b314ba5d..4fda4f21b 100644 --- a/src/cmnds/cmd_if.c +++ b/src/cmnds/cmd_if.c @@ -283,6 +283,12 @@ float getSunset(const char *s) { #endif + +float getRebootReason(const char *s) { + return g_rebootReason; +} + + const constant_t g_constants[] = { //cnstdetail:{"name":"MQTTOn", //cnstdetail:"title":"MQTTOn", @@ -470,6 +476,13 @@ const constant_t g_constants[] = { //cnstdetail:"descr":"Random unsigned value", //cnstdetail:"requires":""} { "$rand", &getRand }, +#ifdef PLATFORM_BEKEN + //cnstdetail:{"name":"$rebootReason", + //cnstdetail:"title":"$rebootReason", + //cnstdetail:"descr":"Reboot reason", + //cnstdetail:"requires":""} + { "$rebootReason", &getRebootReason }, +#endif }; static int g_totalConstants = sizeof(g_constants) / sizeof(g_constants[0]); diff --git a/src/httpserver/http_fns.c b/src/httpserver/http_fns.c index 11c9368b4..e193f8104 100644 --- a/src/httpserver/http_fns.c +++ b/src/httpserver/http_fns.c @@ -874,22 +874,20 @@ typedef enum { } RESET_SOURCE_STATUS; */ - int bk_misc_get_start_type(); { const char* s = "Unk"; - i = bk_misc_get_start_type(); - if (i == 0) + if (g_rebootReason == 0) s = "Pwr"; - else if (i == 1) + else if (g_rebootReason == 1) s = "Rbt"; - else if (i == 2) + else if (g_rebootReason == 2) s = "Wdt"; - else if (i == 3) + else if (g_rebootReason == 3) s = "Pin Interrupt"; - else if (i == 4) + else if (g_rebootReason == 4) s = "Sleep Timer"; - hprintf255(request, "