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

Add USB detection to RAK4631 based boards. #2956

Merged
merged 7 commits into from
Nov 22, 2023
Merged

Add USB detection to RAK4631 based boards. #2956

merged 7 commits into from
Nov 22, 2023

Conversation

HookdomPonix
Copy link
Contributor

This PR will add support for detecting if the USB cable is plugged in on the RAK4631-derived boards. It may also work for other NRF52 systems, but I don't have any I can test.

If you wish to test on an NRF board, simply add the define of NRF_APM to your variant.h and let me know how it works out.

The check runs on the power status update thread, so it can take 20 seconds to detect USB or no USB.

We assume the system is charging if there is a battery and USB is plugged in.

@thebentern thebentern merged commit cbb8eb6 into meshtastic:master Nov 22, 2023
59 checks passed
@markbirss
Copy link
Contributor

markbirss commented Nov 30, 2023

@HookdomPonix

Just tried on my nRF52 with integrated SX1262 no battery connected

`DEBUG | ??:??:?? 61 [Power] Battery: usbPower=0, isCharging=0, batMv=0, batPct=0
vs adding to variant.h

// Testing USB detection
#define NRF_APM

DEBUG | ??:??:?? 65 [Power] Battery: usbPower=1, isCharging=1, batMv=0, batPct=0`

@HookdomPonix
Copy link
Contributor Author

Seems functional. Some systems will report a batterymv even when there is none - thats the charge current sharing a line with the batterymv detect line.

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.

4 participants