Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logical switch timers 0.1 second longer than V1 #4663

Open
1 task done
alteman opened this issue Feb 21, 2024 · 0 comments · May be fixed by #4664
Open
1 task done

Logical switch timers 0.1 second longer than V1 #4663

alteman opened this issue Feb 21, 2024 · 0 comments · May be fixed by #4664
Labels
bug 🪲 Something isn't working triage Bug report awaiting review / sorting

Comments

@alteman
Copy link
Contributor

alteman commented Feb 21, 2024

Is there an existing issue for this problem?

  • I have searched the existing issues

What part of EdgeTX is the focus of this bug?

Transmitter firmware

Current Behavior

Phase 1 of a logical switch timer takes 1 cycle (100ms) longer than expected (0.1s longer than v1 value).

Expected Behavior

Timer intervals are interpreted correctly.

Steps To Reproduce

  1. Create a logical switch L1 with type=timer and v1=v2=0.1s
  2. Create a global var that increments when L1 is set
  3. Use a stopwatch to measure L1 timer cycle time
  4. Measured cycle time is 0.3s where you would expect it to be 0.2s.

Version

2.9.3

Transmitter

RadioMaster Boxer

Operating System (OS)

No response

OS Version

No response

Anything else?

In switches.cpp:logicalSwitchesTimerTick, there's code to handle v1->v2 transition

else if (*lastValue < 0) {
          if (++(*lastValue) == 0)
            *lastValue = lswTimerValue(ls->v2);
        }

but when going in the opposite direction, it takes an extra cycle to get from lastValue==1 to reloading v1 into lastValue.

@alteman alteman added bug 🪲 Something isn't working triage Bug report awaiting review / sorting labels Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working triage Bug report awaiting review / sorting
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant