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

fix: timers throttle condition on surface radio #4502

Merged
merged 4 commits into from
Jan 2, 2024
Merged

Conversation

3djc
Copy link
Collaborator

@3djc 3djc commented Jan 1, 2024

Account for surface radio specific throttle.

This fixes #4499

This also fixes corresponding test scripts

@philmoz
Copy link
Collaborator

philmoz commented Jan 1, 2024

I was looking at this as well and took a slightly different approach.

mixer.cpp (doMixerPeriodicUpdates) - change:

    val >>= (RESX_SHIFT-6); // calibrate it (resolution increased by factor 4)

    evalTimers(val, tick10ms);

to:

    evalTimers(val, tick10ms);

    val >>= (RESX_SHIFT-6); // calibrate it (resolution increased by factor 4)

timers.cpp (evalTimers) - add at the start:

  // 'throttle' range is 0 (-100%) to 2048 (100%)
  // Scale value to range 0 - 128
#if defined(SURFACE_RADIO)
  // For surface radio throttle off position is at 0%
  throttle = abs(throttle - RESX) >> 3;
#else
  // For air radio throttle off position is at -100%
  throttle = throttle >> 4;
#endif

@pfeerick pfeerick changed the title fix: timers condition on surface radio fix: timers throttle condition on surface radio Jan 2, 2024
@pfeerick pfeerick added the bug 🪲 Something isn't working label Jan 2, 2024
@pfeerick
Copy link
Member

pfeerick commented Jan 2, 2024

On both Pocket and MT12, I configured all three timers to be throttle triggered in conjunction with SD down. THs, TH% and THt (trigger). On the Pocket, it stills seems to be working fine with this PR. and on the MT12 it looks good also - needed to recalibrate though as it was a bit temperamental about the centre point to allow the THRs condition to let go. Another reason it may be handy to have a radio level setting that lets you set the THs/THt trigger point.

As a side-note, on the MT12, when I check the statistics, TH% and THR are still counting with the stick in resting position ;) Looks like

// Throttle special timers
lcdDrawText(STATS_2ND_COLUMN, FH*0+1, "THR", BOLD);
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*0+1, s_timeCumThr);
lcdDrawText(STATS_2ND_COLUMN, FH*1+1, "TH%", BOLD);
drawTimer(STATS_2ND_COLUMN + STATS_LABEL_WIDTH, FH*1+1, s_timeCum16ThrP/16);

needs to learn about surface radios too at some point... may also be worth considering how to do the throttle graph differently... maybe a line graph rather than bars?

@pfeerick pfeerick added this to the 2.10 milestone Jan 2, 2024
@pfeerick pfeerick merged commit 7d18edc into main Jan 2, 2024
39 checks passed
@pfeerick pfeerick deleted the 3djc/surface-timers branch January 2, 2024 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🪲 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MT12 - Throttle timers constantly active
3 participants