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: device sleep (part 1) #3590

Merged
merged 10 commits into from
Apr 12, 2024
Merged

fix: device sleep (part 1) #3590

merged 10 commits into from
Apr 12, 2024

Conversation

mverch67
Copy link
Collaborator

@mverch67 mverch67 commented Apr 10, 2024

This PR fixes some issues introduced in #3251 (e.g. router/repeater/powersave wakeup issues) and does a few debug cosmetics:

The function enableLoraInterrupt() assumes that all LORA/DIO1/CS/RESET GPIOs are RTC GPIOs which is not true (e.g. only RTC GPIOs can be used for ext0).
As a result there are error messages in the log and all devices where the DIO1 pin is not an RTC GPIO will fail to wake up from sleep when a LoRa packet is received (one packet is received though, but processed on the next scheduled wakeup).

E (221030) RTCIO: rtc_gpio_pulldown_en(129): RTCIO number error
E (72312) RTCIO: rtc_gpio_pullup_en(109): RTCIO number error
E (72313) RTCIO: rtc_gpio_pullup_en(109): RTCIO number error

This PR replaces the RTC GPIO functions by generic functions which check for RTC GPIO internally and does a check for the validity of RTC GPIOs for DIO1.

@mverch67 mverch67 marked this pull request as draft April 11, 2024 06:25
@mverch67 mverch67 marked this pull request as ready for review April 11, 2024 10:30
@mverch67
Copy link
Collaborator Author

mverch67 commented Apr 11, 2024

Tested with tbeam, t3s3, heltec v3 and heltec wireless paper. Now all wake up from router mode. In case you still experience issues in sleep mode (e.g unresponsive, noise) you'll have to do a factory reset, there may be some wrong setting.

@mverch67
Copy link
Collaborator Author

mverch67 commented Apr 11, 2024

As the PR re-introduces GPIO wakeup source for all hardware devices that don't have RTC GPIO DIO1 some code changes from #3521 had to be reverted in the same fashion as in #2412 (to avoid screen turn on with every single packet).

@mverch67 mverch67 marked this pull request as draft April 11, 2024 12:01
@mverch67 mverch67 marked this pull request as ready for review April 11, 2024 14:16
#endif
#ifdef RF95_IRQ
gpio_wakeup_enable((gpio_num_t)RF95_IRQ, GPIO_INTR_HIGH_LEVEL); // RF95 interrupt, active high
#if defined(RF95_IRQ) && (RF95_IRQ != RADIOLIB_NC)
Copy link
Contributor

Choose a reason for hiding this comment

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

Good call. Technically we have targets like the T-Beam that have RF95 macros for the SX1276 and also SX126X ones, so runtime discrimination probably heads off some potential issues there hopefully.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, I've tested that already. Working as expected.

@thebentern thebentern merged commit 4c9646f into master Apr 12, 2024
71 checks passed
@mverch67 mverch67 deleted the fix-sleep branch April 27, 2024 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants