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

Fixed RX task check. #10649

Merged
merged 1 commit into from
Apr 25, 2021
Merged

Fixed RX task check. #10649

merged 1 commit into from
Apr 25, 2021

Conversation

mikeller
Copy link
Member

Fixes #10647.

We need to run the entire task check every time, to avoid losing status updates while waiting for the main task to be scheduled.

@mikeller mikeller added this to the 4.3 milestone Mar 29, 2021
@SteveCEvans
Copy link
Member

I’ve just ordered an R-XSR to investigate this. The check function takes a lot of time so it would be better to preserve the state as required between calls. I’ll raise another PR with a fix that gives optimal timing once I’ve been able to reproduce this.

@mikeller
Copy link
Member Author

Yeah, there is potentially quite a bit of optimisation possible, by moving some of the state updating that is currently done in the check function into the actual task.
Also, splitting the check function into multiple functions, one for each RX type, and calling them by function pointer which is set up during initialisation.
But for now this will be a workaround that is no worse than the old way of doing things.

@TheIsotopes
Copy link
Contributor

TheIsotopes commented Mar 29, 2021

@mikeller I have tested this and it works, but unfortunately the cpu load goes to 100% when the transmitter is switched on.

@SteveCEvans
Copy link
Member

The check function is quite time consuming, so we really only want to be calling it once. What state is being lost to cause the FrSky rx not to work?

@mikeller
Copy link
Member Author

@TheIsotopes: Thanks for testing - the feedback was helpful. Turns out this was a bug in the state machine - if there are no updates pending we need to go back to checking, and not busy wait in the processing state. Please try again:

betaflight_4.3.0_STM32F745_82ff9fb00.zip
betaflight_4.3.0_STM32F7X2_82ff9fb00.zip
betaflight_4.3.0_STM32F411_82ff9fb00.zip
betaflight_4.3.0_STM32F405_82ff9fb00.zip

@TheIsotopes
Copy link
Contributor

TheIsotopes commented Mar 30, 2021

@mikeller cpu load is normal and telemetry is working ... but there are still problems with the rx task.
see also my last comment in #10647.

# tasks
Task list             rate/hz  max/us  avg/us maxload avgload  total/ms
00 - (         SYSTEM)     10       5       1    0.5%    0.5%         0
01 - (         SYSTEM)    996       6       1    1.0%    0.5%        87
02 - (           GYRO)   8000      13       8   10.9%    6.9%      7137
03 - (         FILTER)   8000      24      16   19.7%   13.3%     14817
04 - (            PID)   8000      61      44   49.3%   35.7%     39354
07 - (             RX)  29412      17      12   50.5%   35.7%       444
08 - (         SERIAL)    100     810       2    8.6%    0.5%        54
09 - (       DISPATCH)    998       6       1    1.0%    0.5%        60
10 - (BATTERY_VOLTAGE)     50       7       2    0.5%    0.5%        11
11 - (BATTERY_CURRENT)     50       4       1    0.5%    0.5%         4
12 - ( BATTERY_ALERTS)      5       6       2    0.5%    0.5%         1
13 - (         BEEPER)    100      10       2    0.6%    0.5%        14
21 - (       LEDSTRIP)    100      28       6    0.7%    0.5%        59
25 - (            CMS)     20       7       2    0.5%    0.5%         3
26 - (        VTXCTRL)      5       5       1    0.5%    0.5%         0
27 - (        CAMCTRL)      5       2       0    0.5%    0.0%         0
29 - (    ADCINTERNAL)      1       5       3    0.5%    0.5%         0
RX Check Function                  12       2                        85
Total (excluding SERIAL)                       137.7%   97.1%

EDIT: Stick command also not working e.g. calibrate Gyro

EDIT2: fixed in #10659

@mikeller mikeller merged commit 21009d2 into betaflight:master Apr 25, 2021
@mikeller mikeller deleted the fix_rx_task_check branch April 25, 2021 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

on latest builds the rx is not recognized
3 participants