Open the firmware folder and navigate to the
/src/controller folder.
Open
main.h in a text editor.
Find these lines in particular:
Code:
// ADC battery voltage measurement
#define BATTERY_VOLTAGE_PER_10_BIT_ADC_STEP_X512 44
#define BATTERY_VOLTAGE_PER_10_BIT_ADC_STEP_X1000 87 // conversion value verified with a cheap power meter
I'm using 52V and reducing the X1000 value by 1 equals approximately -0.5V.
(87 / OSF reported voltage) * actual voltage = new X1000 value (round this up or down to get closest to actual voltage)
But at this stage I don't know if the discrepancy is the same for everyone, depends on battery type or varies individually.
So you will need to experiment with changing that 87 value, saving the file, re-compiling and flashing.
Note that BATTERY_VOLTAGE_PER_10_BIT_ADC_STEP_X512 is related, and calculated at..
(BATTERY_VOLTAGE_PER_10_BIT_ADC_STEP_X1000 / 1000) * 512
Manually calculate that and disregard the decimal places. For example, if you change X1000 to 85 then X512 will need to be..
(85 / 1000) * 512 = 43
In addition to there was a miscalculation with the ADC battery current values identified after the beta release.
BATTERY_CURRENT_PER_10_BIT_ADC_STEP_X512 should be 87 (not 102), being....
(BATTERY_CURRENT_PER_10_BIT_ADC_STEP_X100 / 100) * 512 where X100 = 17.
So, your values for those need to be as below.
Code:
// ADC battery current measurement
#define BATTERY_CURRENT_PER_10_BIT_ADC_STEP_X512 86
#define BATTERY_CURRENT_PER_10_BIT_ADC_STEP_X100 17 // conversion value verified with a cheap power meter