-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fix rak11310 Voltage Read #6618
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
base: master
Are you sure you want to change the base?
Conversation
add voltage read correction for rak11310
#if defined(RAK11310) | ||
float voltage_raw = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / 1023) * raw; | ||
|
||
LOG_INFO("[POWER DEBUG] AREF=%.2fV, ADC_RAW=%u, ADC_MULT=%.2f", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't log an info called 'DEBUG' :-)
|
||
scaled = (voltage_raw * 1.22f) - 0.1f; | ||
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / 4096) * raw; | ||
LOG_INFO("[POWER CORRECTION] Before=%.2fmV, After=%.2fmV", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please drop the [POWER CORRECTION] - Log lines will be auto-prefixed with the thread name.
(double)operativeAdcMultiplier); | ||
|
||
scaled = (voltage_raw * 1.22f) - 0.1f; | ||
scaled = operativeAdcMultiplier * ((1000 * AREF_VOLTAGE) / 4096) * raw; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you are computing scaled twice here. either the latter is in here by mistake or you can drop the former one.
raw, | ||
(double)operativeAdcMultiplier); | ||
|
||
scaled = (voltage_raw * 1.22f) - 0.1f; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.22f seems to be a correction factor. can we make this a generic correction macro and remove the #ifdef bracket? In case we need it on more than the 11310
add voltage read correction for rak11310
π Thank you for sending in a pull request, here's some tips to get started!
β (Please delete all these tips and replace them with your text) β
to say "Hey, I think this idea X should be implemented and I'm starting work on it. My general plan is Y, any feedback
is appreciated." This will allow other devs to potentially save you time by not accidentially duplicating work etc...
because it automatically follows our indentation rules and its auto reformatting will not cause spurious changes to lines.
π€ Attestations