-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Revisit this section of code:
yukon/lib/pimoroni_yukon/conversion.py
Lines 69 to 78 in 2c1b378
| def u16_to_current(u16): | |
| # return (((u16 * 3.3) / 65535) * ( 1 / (2.99 * 4020 * 0.0005 / 120))) # Ideal equation, kept for reference | |
| # Commented the below out as it reported underestimates for low current draws | |
| # if u16 >= MEASURED_AT_CURRENT_MID: | |
| # return ((u16 - MEASURED_AT_CURRENT_MID) * MEASURED_TO_CURRENT_MAX_MID) + CURRENT_MID | |
| # else: | |
| # return max(((u16 - MEASURED_AT_CURRENT_MIN) * MEASURED_TO_CURRENT_MID_MIN) + CURRENT_MIN, 0.0) | |
| return max(((u16 - MEASURED_AT_CURRENT_MID) * MEASURED_TO_CURRENT_MAX_MID) + CURRENT_MID, 0.0) # This sadly overreports low current draws |
See if anything can be done to address the overreporting, but not under report either (as is the issue with the currently commented out code)
Metadata
Metadata
Assignees
Labels
No labels