diff --git a/src/mavesp8266_httpd.cpp b/src/mavesp8266_httpd.cpp index efcb286..22a41b5 100644 --- a/src/mavesp8266_httpd.cpp +++ b/src/mavesp8266_httpd.cpp @@ -180,19 +180,101 @@ void handle_getParameters() String message = FPSTR(kHEADER); message += "

Parameters

"; for(int i = 0; i < MavESP8266Parameters::ID_COUNT; i++) { - message += ""; - unsigned long val = 0; - if(getWorld()->getParameters()->getAt(i)->type == MAV_PARAM_TYPE_UINT32) - val = (unsigned long)*((uint32_t*)getWorld()->getParameters()->getAt(i)->value); - else if(getWorld()->getParameters()->getAt(i)->type == MAV_PARAM_TYPE_UINT16) - val = (unsigned long)*((uint16_t*)getWorld()->getParameters()->getAt(i)->value); - else - val = (unsigned long)*((int8_t*)getWorld()->getParameters()->getAt(i)->value); - message += ""; + if(i == getWorld()->getParameters()->ID_FWVER) + { + message += ""; + message += ""; + } + else if(i == getWorld()->getParameters()->ID_MODE) + { + message += ""; + message += ""; + } + else if(i == getWorld()->getParameters()->ID_IPADDRESS) + { + message += ""; + message += ""; + } + else if(i == getWorld()->getParameters()->ID_SSID1) + { + message += ""; + message += ""; + } + else if(i > getWorld()->getParameters()->ID_SSID1 && i <= getWorld()->getParameters()->ID_SSID4) {} + else if(i == getWorld()->getParameters()->ID_PASS1) + { + message += ""; + message += ""; + } + else if(i > getWorld()->getParameters()->ID_PASS1 && i <= getWorld()->getParameters()->ID_PASS4) {} + else if(i == getWorld()->getParameters()->ID_SSIDSTA1) + { + message += ""; + message += ""; + } + else if(i > getWorld()->getParameters()->ID_SSIDSTA1 && i <= getWorld()->getParameters()->ID_SSIDSTA4) {} + else if(i == getWorld()->getParameters()->ID_PASSSTA1) + { + message += ""; + message += ""; + } + else if(i > getWorld()->getParameters()->ID_PASSSTA1 && i <= getWorld()->getParameters()->ID_PASSSTA4) {} + else // integer values + { + message += ""; + unsigned long val = 0; + if(getWorld()->getParameters()->getAt(i)->type == MAV_PARAM_TYPE_UINT32) + val = (unsigned long)*((uint32_t*)getWorld()->getParameters()->getAt(i)->value); + else if(getWorld()->getParameters()->getAt(i)->type == MAV_PARAM_TYPE_UINT16) + val = (unsigned long)*((uint16_t*)getWorld()->getParameters()->getAt(i)->value); + else + val = (unsigned long)*((int8_t*)getWorld()->getParameters()->getAt(i)->value); + + message += ""; + } } message += "
NameValue
"; - message += getWorld()->getParameters()->getAt(i)->id; - message += ""; - message += val; - message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + message += MAVESP8266_VERSION_MAJOR; + message += "."; + message += MAVESP8266_VERSION_MINOR; + message += "."; + message += MAVESP8266_VERSION_BUILD; + message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + if(getWorld()->getParameters()->getWifiMode() == WIFI_MODE_AP) + { + message += "AP"; + } + else + { + message += "STA"; + } + message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + message += getWorld()->getParameters()->getLocalIPAddressInString(); + message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + message += getWorld()->getParameters()->getWifiSsid(); + message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + message += getWorld()->getParameters()->getWifiPassword(); + message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + message += getWorld()->getParameters()->getWifiStaSsid(); + message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + message += getWorld()->getParameters()->getWifiStaPassword(); + message += "
"; + message += getWorld()->getParameters()->getAt(i)->id; + message += ""; + message += val; + message += "
"; message += ""; diff --git a/src/mavesp8266_parameters.cpp b/src/mavesp8266_parameters.cpp index 3062198..e955d42 100644 --- a/src/mavesp8266_parameters.cpp +++ b/src/mavesp8266_parameters.cpp @@ -65,6 +65,8 @@ uint32_t _wifi_subnetsta; uint32_t _uart_baud_rate; uint32_t _flash_left; +String _wifi_ip_addr_string; + //-- Parameters // No string support in parameters so we stash a char[16] into 4 uint32_t struct stMavEspParameters mavParameters[] = { @@ -152,6 +154,10 @@ uint32_t MavESP8266Parameters::getWifiStaGateway () { return _wifi_gatewaysta uint32_t MavESP8266Parameters::getWifiStaSubnet () { return _wifi_subnetsta; } uint32_t MavESP8266Parameters::getUartBaudRate () { return _uart_baud_rate; } +String MavESP8266Parameters::getLocalIPAddressInString() +{ + return(_wifi_ip_addr_string); +} //--------------------------------------------------------------------------------- //-- Reset all to defaults void diff --git a/src/mavesp8266_parameters.h b/src/mavesp8266_parameters.h index e613552..c7cd28b 100644 --- a/src/mavesp8266_parameters.h +++ b/src/mavesp8266_parameters.h @@ -113,6 +113,8 @@ class MavESP8266Parameters { uint32_t getWifiStaSubnet (); uint32_t getUartBaudRate (); + String getLocalIPAddressInString (); + void setDebugEnabled (int8_t enabled); void setWifiMode (int8_t mode); void setWifiChannel (uint32_t channel);