This is the formula:
Line 420 of Multiwii Tab 2.3
Code: Select all
#if VBAT_SMOOTH == 16
analog.vbat = vsum / conf.vbatscale; // result is Vbatt in 0.1V steps
Line 581 of Multiwii Tab 2.2
Code: Select all
vbat = (vbatRaw*2) / conf.vbatscale; // result is Vbatt in 0.1V steps
but with my sensor (rctimer 50 V / 90 Amps), changes of VBATSCALE even by just 1 integer (eg 20 to 21) result in a change of VBAT by several 10ths of a volt, generally equaling about 0.5v.
so there is not fine enough adjustment.
to fix this i tweaked the formula in 2.3
Code: Select all
#if VBAT_SMOOTH == 16
analog.vbat = vsum * 6 / conf.vbatscale; // result is Vbatt in 0.1V steps
to fix this i tweaked the formula in 2.2
Code: Select all
vbat = (vbatRaw*6) / conf.vbatscale; // result is Vbatt in 0.1V steps //haydent *12 gives finer adjustment by vbatscale
in general the larger the multiplier the finer accuracy you get with VBATSCALE, the only 'limitation' to size of multiplier is VBATSCALE is defined as a uint8 so unless you want to change that the largest you can have VBATSCALE is 127, luckily i could get away with 123 to give my voltage.
but if you need finer accuracy i imagine you could define it as a int16 the change the formula to multiply say by 200 and and use a vbatscale of say ~2099