fix(radio): ensure customisable switch set as Toggle starts in OFF state (#5343)
This commit is contained in:
@@ -69,6 +69,7 @@ class FunctionSwitch : public Window
|
|||||||
FSWITCH_SET_CONFIG(switchIndex, val);
|
FSWITCH_SET_CONFIG(switchIndex, val);
|
||||||
if (val == SWITCH_TOGGLE) {
|
if (val == SWITCH_TOGGLE) {
|
||||||
FSWITCH_SET_STARTUP(switchIndex, FS_START_PREVIOUS);
|
FSWITCH_SET_STARTUP(switchIndex, FS_START_PREVIOUS);
|
||||||
|
setFSLogicalState(switchIndex, 0);
|
||||||
startChoice->setValue(startChoice->getIntValue());
|
startChoice->setValue(startChoice->getIntValue());
|
||||||
}
|
}
|
||||||
SET_DIRTY();
|
SET_DIRTY();
|
||||||
|
|||||||
@@ -22,7 +22,9 @@
|
|||||||
#include "hal/switch_driver.h"
|
#include "hal/switch_driver.h"
|
||||||
#include "hal/adc_driver.h"
|
#include "hal/adc_driver.h"
|
||||||
|
|
||||||
|
#include "myeeprom.h"
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
#include "opentx_constants.h"
|
||||||
#include "switches.h"
|
#include "switches.h"
|
||||||
#include "input_mapping.h"
|
#include "input_mapping.h"
|
||||||
|
|
||||||
@@ -90,6 +92,8 @@ void setFSStartupPosition()
|
|||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
for (uint8_t i = 0; i < NUM_FUNCTIONS_SWITCHES; i++) {
|
||||||
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
uint8_t startPos = (g_model.functionSwitchStartConfig >> 2 * i) & 0x03;
|
||||||
|
if (FSWITCH_CONFIG(i) == SWITCH_TOGGLE)
|
||||||
|
startPos = FS_START_OFF;
|
||||||
switch(startPos) {
|
switch(startPos) {
|
||||||
case FS_START_OFF:
|
case FS_START_OFF:
|
||||||
g_model.functionSwitchLogicalState &= ~(1 << i); // clear state
|
g_model.functionSwitchLogicalState &= ~(1 << i); // clear state
|
||||||
|
|||||||
Reference in New Issue
Block a user