diff --git a/main/bobbyquickactions.cpp b/main/bobbyquickactions.cpp index 116265a..395874f 100644 --- a/main/bobbyquickactions.cpp +++ b/main/bobbyquickactions.cpp @@ -5,6 +5,7 @@ #include "espnowfunctions.h" #endif #include "newsettings.h" +#include "wifi_bobbycar.h" namespace quickactions { @@ -45,6 +46,9 @@ void handle_bobby_quickaction(espgui::Button button) case BobbyQuickActions::OPEN_GARAGE: open_garage(); break; + case BobbyQuickActions::WIFI_SCAN: + action_wifi_scan(); + break; default: return; } @@ -67,6 +71,15 @@ void open_garage() #endif } +void action_wifi_scan() +{ + if (const auto result = wifi_scan(); result != ESP_OK) + { + ESP_LOGE("BOBBY", "wifi_scan() failed with %s", esp_err_to_name(result)); + return; + } +} + void blink_left() { #ifdef FEATURE_LEDSTRIP diff --git a/main/bobbyquickactions.h b/main/bobbyquickactions.h index bd52b68..5ec827d 100644 --- a/main/bobbyquickactions.h +++ b/main/bobbyquickactions.h @@ -12,7 +12,8 @@ x(BLINK_LEFT) \ x(BLINK_RIGHT) \ x(HANDBREMSE) \ - x(OPEN_GARAGE) + x(OPEN_GARAGE) \ + x(WIFI_SCAN) DECLARE_TYPESAFE_ENUM(BobbyQuickActions, : uint8_t, BobbyQuickActionsValues) namespace quickactions { @@ -24,5 +25,6 @@ void open_garage(); void blink_left(); void blink_right(); void handle_handbremse(); +void action_wifi_scan(); } // namespace quickactions diff --git a/main/changevaluedisplay_bobbyquickactions.cpp b/main/changevaluedisplay_bobbyquickactions.cpp index 601ad07..efe1c30 100644 --- a/main/changevaluedisplay_bobbyquickactions.cpp +++ b/main/changevaluedisplay_bobbyquickactions.cpp @@ -21,6 +21,7 @@ constexpr char TEXT_QUICKACTION_BLINK_LEFT[] = "Blink Left"; constexpr char TEXT_QUICKACTION_BLINK_RIGHT[] = "Blink Right"; constexpr char TEXT_QUICKACTION_HANDBREMSE[] = "Handbremse"; constexpr char TEXT_QUICKACTION_OPEN_GARAGE[] = "Open Garage"; +constexpr char TEXT_QUICKACTION_WIFI_SCAN[] = "Wifi Scan"; constexpr char TEXT_BACK[] = "Back"; } // namespace @@ -31,6 +32,7 @@ ChangeValueDisplay::ChangeValueDisplay() constructMenuItem, StaticText>>(BobbyQuickActions::BLINK_RIGHT, *this, *this, *this); constructMenuItem, StaticText>>(BobbyQuickActions::HANDBREMSE, *this, *this, *this); constructMenuItem, StaticText>>(BobbyQuickActions::OPEN_GARAGE, *this, *this, *this); + constructMenuItem, StaticText>>(BobbyQuickActions::WIFI_SCAN, *this, *this, *this); constructMenuItem, StaticMenuItemIcon<&espgui::icons::back>>>(*this); } @@ -45,9 +47,10 @@ void ChangeValueDisplay::start() case BobbyQuickActions::BLINK_RIGHT: setSelectedIndex(2); break; case BobbyQuickActions::HANDBREMSE: setSelectedIndex(3); break; case BobbyQuickActions::OPEN_GARAGE: setSelectedIndex(4); break; + case BobbyQuickActions::WIFI_SCAN: setSelectedIndex(5); break; default: ESP_LOGW(TAG, "Unknown BobbyQuickActions: %i", std::to_underlying(value)); - setSelectedIndex(5); + setSelectedIndex(6); } }