[X9D] Battery voltage scale factor

[X9D] Pots+Switches work in mixer
This commit is contained in:
bernet.andre@gmail.com
2013-01-08 08:38:40 +00:00
parent 7189fa0b54
commit 9812daa0aa
2 changed files with 5 additions and 5 deletions
+2 -2
View File
@@ -892,8 +892,8 @@ void menuGeneralDiagAna(uint8_t event)
lcd_putsLeft(5*FH, STR_BATT_CALIB);
static uint32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(8)) / 8; // running average, sourced directly (to avoid unending debate :P)
uint32_t batCalV = ( adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128 ) * 4191 ;
batCalV /= 55296 ;
uint32_t batCalV = ( adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128 ) * 33 ;
batCalV /= 512 ;
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 5*FH, batCalV, (m_posVert==1 ? INVERS : 0));
#else
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
+3 -3
View File
@@ -2324,7 +2324,7 @@ void perOut(uint8_t mode, uint8_t tick10ms)
if (k < NUM_STICKS)
v = md->noExpo ? rawAnas[k] : anas[k]; //Switch is on. MAX=FULL=512 or value.
#if defined(PCBX9D) || defined(PCBACT)
// TODO
if(k < MIXSRC_SH) v = getValue(k); // TODO
#else
else if (k >= MIXSRC_THR-1 && k <= MIXSRC_SWC-1) {
v = getSwitch(k-MIXSRC_THR+1+1, 0) ? +1024 : -1024;
@@ -2944,8 +2944,8 @@ void perMain()
counter = 10;
#if defined(PCBX9D)
int32_t instant_vbat = anaIn(TX_VOLTAGE);
instant_vbat = ( instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128 ) * 4191 ;
instant_vbat /= 55296 ;
instant_vbat = ( instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128 ) * 33 ;
instant_vbat /= 512 ;
#elif defined(PCBSKY9X)
int32_t instant_vbat = anaIn(TX_VOLTAGE);
instant_vbat = ( instant_vbat + instant_vbat*(g_eeGeneral.vBatCalib)/128 ) * 4191 ;