mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
fix warning in console when setting wifi params
This commit is contained in:
@@ -373,9 +373,7 @@ int8_t System::wifi_quality() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void System::show_system(uuid::console::Shell & shell) {
|
void System::show_system(uuid::console::Shell & shell) {
|
||||||
shell.print(F("Uptime: "));
|
shell.printfln(F("Uptime: %s"), uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3).c_str());
|
||||||
shell.print(uuid::log::format_timestamp_ms(uuid::get_uptime_ms(), 3));
|
|
||||||
shell.println();
|
|
||||||
|
|
||||||
#if defined(ESP8266)
|
#if defined(ESP8266)
|
||||||
shell.printfln(F("Chip ID: 0x%08x"), ESP.getChipId());
|
shell.printfln(F("Chip ID: 0x%08x"), ESP.getChipId());
|
||||||
@@ -389,7 +387,7 @@ void System::show_system(uuid::console::Shell & shell) {
|
|||||||
shell.printfln(F("Sketch size: %u bytes (%u bytes free)"), ESP.getSketchSize(), ESP.getFreeSketchSpace());
|
shell.printfln(F("Sketch size: %u bytes (%u bytes free)"), ESP.getSketchSize(), ESP.getFreeSketchSpace());
|
||||||
shell.printfln(F("Reset reason: %s"), ESP.getResetReason().c_str());
|
shell.printfln(F("Reset reason: %s"), ESP.getResetReason().c_str());
|
||||||
shell.printfln(F("Reset info: %s"), ESP.getResetInfo().c_str());
|
shell.printfln(F("Reset info: %s"), ESP.getResetInfo().c_str());
|
||||||
|
shell.println();
|
||||||
shell.printfln(F("Free heap: %lu bytes"), (unsigned long)ESP.getFreeHeap());
|
shell.printfln(F("Free heap: %lu bytes"), (unsigned long)ESP.getFreeHeap());
|
||||||
shell.printfln(F("Free mem: %d %%"), free_mem());
|
shell.printfln(F("Free mem: %d %%"), free_mem());
|
||||||
shell.printfln(F("Maximum free block size: %lu bytes"), (unsigned long)ESP.getMaxFreeBlockSize());
|
shell.printfln(F("Maximum free block size: %lu bytes"), (unsigned long)ESP.getMaxFreeBlockSize());
|
||||||
@@ -408,21 +406,19 @@ void System::show_system(uuid::console::Shell & shell) {
|
|||||||
#ifndef EMSESP_STANDALONE
|
#ifndef EMSESP_STANDALONE
|
||||||
switch (WiFi.status()) {
|
switch (WiFi.status()) {
|
||||||
case WL_IDLE_STATUS:
|
case WL_IDLE_STATUS:
|
||||||
shell.printfln(F("WiFi: idle"));
|
shell.printfln(F("WiFi: Idle"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_NO_SSID_AVAIL:
|
case WL_NO_SSID_AVAIL:
|
||||||
shell.printfln(F("WiFi: network not found"));
|
shell.printfln(F("WiFi: Network not found"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_SCAN_COMPLETED:
|
case WL_SCAN_COMPLETED:
|
||||||
shell.printfln(F("WiFi: network scan complete"));
|
shell.printfln(F("WiFi: Network scan complete"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_CONNECTED: {
|
case WL_CONNECTED: {
|
||||||
shell.printfln(F("WiFi: connected"));
|
shell.printfln(F("WiFi: Connected"));
|
||||||
shell.println();
|
|
||||||
|
|
||||||
shell.printfln(F("SSID: %s"), WiFi.SSID().c_str());
|
shell.printfln(F("SSID: %s"), WiFi.SSID().c_str());
|
||||||
shell.printfln(F("BSSID: %s"), WiFi.BSSIDstr().c_str());
|
shell.printfln(F("BSSID: %s"), WiFi.BSSIDstr().c_str());
|
||||||
shell.printfln(F("RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality());
|
shell.printfln(F("RSSI: %d dBm (%d %%)"), WiFi.RSSI(), wifi_quality());
|
||||||
@@ -432,27 +428,26 @@ void System::show_system(uuid::console::Shell & shell) {
|
|||||||
#elif defined(ESP32)
|
#elif defined(ESP32)
|
||||||
shell.printfln(F("Hostname: %s"), WiFi.getHostname());
|
shell.printfln(F("Hostname: %s"), WiFi.getHostname());
|
||||||
#endif
|
#endif
|
||||||
shell.println();
|
|
||||||
shell.printfln(F("IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str());
|
shell.printfln(F("IPv4 address: %s/%s"), uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str());
|
||||||
shell.printfln(F("IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str());
|
shell.printfln(F("IPv4 gateway: %s"), uuid::printable_to_string(WiFi.gatewayIP()).c_str());
|
||||||
shell.printfln(F("IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str());
|
shell.printfln(F("IPv4 nameserver: %s"), uuid::printable_to_string(WiFi.dnsIP()).c_str());
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WL_CONNECT_FAILED:
|
case WL_CONNECT_FAILED:
|
||||||
shell.printfln(F("WiFi: connection failed"));
|
shell.printfln(F("WiFi: Connection failed"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_CONNECTION_LOST:
|
case WL_CONNECTION_LOST:
|
||||||
shell.printfln(F("WiFi: connection lost"));
|
shell.printfln(F("WiFi: Connection lost"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_DISCONNECTED:
|
case WL_DISCONNECTED:
|
||||||
shell.printfln(F("WiFi: disconnected"));
|
shell.printfln(F("WiFi: Disconnected"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WL_NO_SHIELD:
|
case WL_NO_SHIELD:
|
||||||
default:
|
default:
|
||||||
shell.printfln(F("WiFi: unknown"));
|
shell.printfln(F("WiFi: Unknown"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,8 +530,9 @@ void System::console_commands(Shell & shell, unsigned int context) {
|
|||||||
flash_string_vector{F_(set), F_(wifi), F_(hostname)},
|
flash_string_vector{F_(set), F_(wifi), F_(hostname)},
|
||||||
flash_string_vector{F_(name_mandatory)},
|
flash_string_vector{F_(name_mandatory)},
|
||||||
[](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) {
|
[](Shell & shell __attribute__((unused)), const std::vector<std::string> & arguments) {
|
||||||
shell.println("Note, connection will be reset...");
|
shell.println("The wifi connection will be reset...");
|
||||||
Console::loop();
|
Shell::loop_all();
|
||||||
|
delay(1000); // wait a second
|
||||||
EMSESP::esp8266React.getWiFiSettingsService()->update(
|
EMSESP::esp8266React.getWiFiSettingsService()->update(
|
||||||
[&](WiFiSettings & wifiSettings) {
|
[&](WiFiSettings & wifiSettings) {
|
||||||
wifiSettings.hostname = arguments.front().c_str();
|
wifiSettings.hostname = arguments.front().c_str();
|
||||||
@@ -550,8 +546,9 @@ void System::console_commands(Shell & shell, unsigned int context) {
|
|||||||
flash_string_vector{F_(set), F_(wifi), F_(ssid)},
|
flash_string_vector{F_(set), F_(wifi), F_(ssid)},
|
||||||
flash_string_vector{F_(name_mandatory)},
|
flash_string_vector{F_(name_mandatory)},
|
||||||
[](Shell & shell, const std::vector<std::string> & arguments) {
|
[](Shell & shell, const std::vector<std::string> & arguments) {
|
||||||
shell.println("Note, connection will be reset...");
|
shell.println("The wifi connection will be reset...");
|
||||||
Console::loop();
|
Shell::loop_all();
|
||||||
|
delay(1000); // wait a second
|
||||||
EMSESP::esp8266React.getWiFiSettingsService()->update(
|
EMSESP::esp8266React.getWiFiSettingsService()->update(
|
||||||
[&](WiFiSettings & wifiSettings) {
|
[&](WiFiSettings & wifiSettings) {
|
||||||
wifiSettings.ssid = arguments.front().c_str();
|
wifiSettings.ssid = arguments.front().c_str();
|
||||||
|
|||||||
Reference in New Issue
Block a user