Skip to content

Commit

Permalink
Fix tests failure
Browse files Browse the repository at this point in the history
  • Loading branch information
richardclli committed Nov 30, 2024
1 parent e240531 commit a052f8d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions radio/src/targets/pl18/hal.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
#define TRIMS_GPIO_REG_LVU
#define TRIMS_GPIO_PIN_LVU

// Switches
#define SWITCHES_GPIO_REG_A
#define SWITCHES_GPIO_PIN_A
#define SWITCHES_GPIO_REG_B
#define SWITCHES_GPIO_PIN_B

// Keys
#define KEYS_GPIO_PIN_ENTER
#define KEYS_GPIO_REG_ENTER
Expand Down
2 changes: 2 additions & 0 deletions radio/src/tests/mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,8 @@ TEST_F(MixerTest, RecursiveAddChannel)

TEST_F(MixerTest, RecursiveAddChannelAfterInactivePhase)
{
if (switchGetMaxSwitches() < 4) return;

g_model.flightModeData[1].swtch = SWSRC_FIRST_SWITCH + 1;
g_model.mixData[0].destCh = 0;
g_model.mixData[0].mltpx = MLTPX_ADD;
Expand Down
6 changes: 6 additions & 0 deletions radio/util/hw_defs/stm32_switches.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ static const stm32_switch_t _switch_defs[] = {
{% if switch.type == '2POS' %}
{
"{{ switch.name }}",
{% if switch.gpio %}
{{ switch.gpio }}, {{ switch.pin }},
{% else %}
nullptr, 0,
{% endif %}
nullptr, 0,
SWITCH_HW_2POS, {{ 'SWITCH_HW_INVERTED' if switch.inverted else 0 }}
},
Expand Down Expand Up @@ -55,9 +59,11 @@ static inline void _init_switches()
pinInit.Mode = LL_GPIO_MODE_INPUT;
pinInit.Pull = LL_GPIO_PULL_UP;
{% for sw_gpio, pins in switch_gpios.items() | sort %}
{% if sw_gpio %}
stm32_gpio_enable_clock({{ sw_gpio }});
pinInit.Pin = {{ pins | join('|') }};
LL_GPIO_Init({{ sw_gpio }}, &pinInit);
{% endif %}
{% endfor %}
}

Expand Down
4 changes: 2 additions & 2 deletions radio/util/hw_defs/switch_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"SJ": { "default": "3POS" }
},
"nb4p": {
"SW2" : { "default": "TOGGLE" },
"SW3" : { "default": "TOGGLE" }
"SA" : { "default": "TOGGLE" },
"SB" : { "default": "TOGGLE" }
},
"lr3pro": {
# left side
Expand Down

0 comments on commit a052f8d

Please sign in to comment.