Skip to content

ADC sampling fix - #3112

Merged
pkendall64 merged 5 commits into
ExpressLRS:3.x.x-maintenancefrom
pkendall64:adc-sampling-fix
Jan 23, 2025
Merged

pkendall64 merged 5 commits into
ExpressLRS:3.x.x-maintenancefrom
pkendall64:adc-sampling-fix

Conversation

@pkendall64

@pkendall64 pkendall64 commented Jan 22, 2025 •

Copy link
Copy Markdown
Collaborator

Problem

analogRead for the joystick (when run on the second core) interferes with the main codepath SPI and/or interrupts, causing the link to skip out of alignment i.e. the packet sequence becomes out-of-step.

This manifested itself on 333Hz mode on LR1121 based TX modules with an OLED and Joystick.

Solution

Create a new device to handle the ADC reads for the TX module. The device will guarantee that reads only occur on the rising edge of the busyTransmitting, once the ISR completes, this is when there is the most "dead time" in the main loop.

The PA PowerDetect device has also been changed to use the ADC device to get analog values for power detection.

@JyeSmith JyeSmith left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks the goods. The reads are happen as expected immediately after the Tock HW Timer has returned.

image

@pkendall64
pkendall64 merged commit 1b7460a into ExpressLRS:3.x.x-maintenance Jan 23, 2025
@pkendall64
pkendall64 deleted the adc-sampling-fix branch January 23, 2025 22:11
pkendall64 added a commit to pkendall64/ExpressLRS that referenced this pull request Mar 16, 2025
The ADC should always be allowed when the state is above MODE_STATES
MUSTARDTIGERFPV pushed a commit that referenced this pull request Mar 28, 2025
The ADC should always be allowed when the state is above MODE_STATES
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.

3 participants