|
|
@ -3,6 +3,26 @@ |
|
|
|
#include "page_about.h" |
|
|
|
#include "page_about.h" |
|
|
|
#include "fw_version.h" |
|
|
|
#include "fw_version.h" |
|
|
|
#include "sbmp.h" |
|
|
|
#include "sbmp.h" |
|
|
|
|
|
|
|
#include "datalink.h" |
|
|
|
|
|
|
|
#include "serial.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static bool stm_vers_loaded = false; |
|
|
|
|
|
|
|
static char stm_vers_buf[10]; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void readVersionCB(SBMP_Endpoint *ep, SBMP_Datagram *dg, void** arg) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
(void)ep; |
|
|
|
|
|
|
|
(void)arg; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (dg->type != DG_SUCCESS) { |
|
|
|
|
|
|
|
error("Response to REQUEST_VERSION not SUCCESS."); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(stm_vers_buf, "%d.%d.%d", dg->payload[0], dg->payload[1], dg->payload[2]); |
|
|
|
|
|
|
|
stm_vers_loaded = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** "About" page */ |
|
|
|
/** "About" page */ |
|
|
|
httpd_cgi_state FLASH_FN tplAbout(HttpdConnData *connData, char *token, void **arg) |
|
|
|
httpd_cgi_state FLASH_FN tplAbout(HttpdConnData *connData, char *token, void **arg) |
|
|
@ -29,6 +49,34 @@ httpd_cgi_state FLASH_FN tplAbout(HttpdConnData *connData, char *token, void **a |
|
|
|
|
|
|
|
|
|
|
|
} else if (streq(token, "vers_sdk")) { |
|
|
|
} else if (streq(token, "vers_sdk")) { |
|
|
|
httpdSend(connData, STR(ESP_SDK_VERSION), -1); |
|
|
|
httpdSend(connData, STR(ESP_SDK_VERSION), -1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (streq(token, "vers_stm")) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stm_vers_loaded) { |
|
|
|
|
|
|
|
httpdSend(connData, stm_vers_buf, -1); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
uint16_t sesn; |
|
|
|
|
|
|
|
sbmp_ep_send_message(dlnk_ep, DG_REQUEST_STM_VERSION, NULL, 0, &sesn, NULL); |
|
|
|
|
|
|
|
sbmp_ep_add_listener(dlnk_ep, sesn, readVersionCB, NULL); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sprintf(stm_vers_buf, "???"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// poll & wait for response
|
|
|
|
|
|
|
|
const int timeout = 100; |
|
|
|
|
|
|
|
for (uint32_t i = 0; i < timeout * 100; i++) { |
|
|
|
|
|
|
|
uart_poll(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (stm_vers_loaded) { |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
os_delay_us(10); |
|
|
|
|
|
|
|
system_soft_wdt_feed(); // Feed the dog, or it'll bite.
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
httpdSend(connData, stm_vers_buf, -1); // send to view
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return HTTPD_CGI_DONE; |
|
|
|
return HTTPD_CGI_DONE; |
|
|
|