add wifi scan for quick action
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
@ -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<BobbyQuickActions>::ChangeValueDisplay()
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<BobbyQuickActions>, StaticText<TEXT_QUICKACTION_BLINK_RIGHT>>>(BobbyQuickActions::BLINK_RIGHT, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<BobbyQuickActions>, StaticText<TEXT_QUICKACTION_HANDBREMSE>>>(BobbyQuickActions::HANDBREMSE, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<BobbyQuickActions>, StaticText<TEXT_QUICKACTION_OPEN_GARAGE>>>(BobbyQuickActions::OPEN_GARAGE, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, SetValueAction<BobbyQuickActions>, StaticText<TEXT_QUICKACTION_WIFI_SCAN>>>(BobbyQuickActions::WIFI_SCAN, *this, *this, *this);
|
||||
constructMenuItem<makeComponentArgs<MenuItem, BackProxyAction, StaticText<TEXT_BACK>, StaticMenuItemIcon<&espgui::icons::back>>>(*this);
|
||||
}
|
||||
|
||||
@ -45,9 +47,10 @@ void ChangeValueDisplay<BobbyQuickActions>::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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user