Skip to content

Commit

Permalink
Fixes 3 issues with the displays (ExpressLRS#2916)
Browse files Browse the repository at this point in the history
* Fixes 2 issues with the displays

* Fix for joystick that uses shared WIFI ADC
  • Loading branch information
pkendall64 authored Sep 6, 2024
1 parent 98409ee commit b3b43dd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
20 changes: 12 additions & 8 deletions src/lib/SCREEN/devScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@ static bool jumpToChannelSelect = false;

static int handle(void)
{
#if defined(JOY_ADC_VALUES) && defined(PLATFORM_ESP32)
// if we are using analog joystick then we can't cancel because WiFi is using the ADC2 (i.e. channel >= 8)!
if (connectionState == wifiUpdate && digitalPinToAnalogChannel(GPIO_PIN_JOYSTICK) >= 8)
{
return DURATION_NEVER;
}
#endif

#ifdef HAS_GSENSOR
is_screen_flipped = gsensor.isFlipped();

Expand Down Expand Up @@ -81,7 +73,19 @@ static int handle(void)
{
int key;
bool isLongPressed;
#if defined(JOY_ADC_VALUES) && defined(PLATFORM_ESP32)
// if we are using analog joystick then we can't cancel because WiFi is using the ADC2 (i.e. channel >= 8)!
if (connectionState == wifiUpdate && digitalPinToAnalogChannel(GPIO_PIN_JOYSTICK) >= 8)
{
key = INPUT_KEY_NO_PRESS;
}
else
{
fivewaybutton.update(&key, &isLongPressed);
}
#else
fivewaybutton.update(&key, &isLongPressed);
#endif
fsm_event_t fsm_event;
switch (key)
{
Expand Down
2 changes: 1 addition & 1 deletion src/lib/SCREEN/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ fsm_state_entry_t const wifi_update_menu_fsm[] = {
{STATE_LAST}
};
fsm_state_event_t const wifi_menu_update_events[] = {MENU_EVENTS(wifi_update_menu_fsm)};
fsm_state_event_t const wifi_ext_execute_events[] = {{EVENT_TIMEOUT, GOTO(STATE_WIFI_EXECUTE)}};
fsm_state_event_t const wifi_ext_execute_events[] = {{EVENT_TIMEOUT, ACTION_POP}};
fsm_state_entry_t const wifi_ext_menu_fsm[] = {
{STATE_WIFI_EXECUTE, nullptr, executeWiFi, 1000, wifi_ext_execute_events, ARRAY_SIZE(wifi_ext_execute_events)},
{STATE_LAST}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/SCREEN/menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ enum fsm_state_s {
STATE_BIND,
STATE_WIFI,
STATE_VTX,
STATE_LINKSTATS,

STATE_POWER_MAX,
STATE_POWER_DYNAMIC,
Expand Down Expand Up @@ -57,6 +56,8 @@ enum fsm_state_s {
STATE_VALUE_INC,
STATE_VALUE_DEC,
STATE_VALUE_SAVE,

STATE_LINKSTATS
};


Expand Down

0 comments on commit b3b43dd

Please sign in to comment.