diff --git a/radio/releasenotes.txt b/radio/releasenotes.txt index 404a6db18..3aaa5cf6b 100644 --- a/radio/releasenotes.txt +++ b/radio/releasenotes.txt @@ -10,6 +10,7 @@
  • Several fixes to the SD card manager menu (#2623)
  • Fixed the difference between top and main LCD TX battery bars on 9Xe (#2671)
  • Several Lua getValue() fields were not exported correctly (tx-voltage, clock and timers1-3)
  • +
  • Fixed: Edge Logical Switch could trigger right after the model was loaded or the radio turned on (#2728)
  • [Sky9x / 9XR-PRO] diff --git a/radio/src/switches.cpp b/radio/src/switches.cpp index 746e37755..6415699ff 100644 --- a/radio/src/switches.cpp +++ b/radio/src/switches.cpp @@ -835,6 +835,13 @@ void logicalSwitchesTimerTick() #if defined(CPUARM) else if (ls->func == LS_FUNC_EDGE) { ls_stay_struct & lastValue = (ls_stay_struct &)LS_LAST_VALUE(fm, i); + // if this ls was reset by the logicalSwitchesReset() the lastValue will be set to CS_LAST_VALUE_INIT(0x8000) + // when it is unpacked into ls_stay_struct the lastValue.duration will have a value of 0x4000 + // this will produce an instant true for edge logical switch if the second parameter is big enough. + // So we reset it here. + if (LS_LAST_VALUE(fm, i) == CS_LAST_VALUE_INIT) { + lastValue.duration = 0; + } lastValue.state = false; bool state = getSwitch(ls->v1); if (state) {