[X9D] Sticks and pots OK, calibration OK

This commit is contained in:
bernet.andre@gmail.com
2013-01-07 21:22:46 +00:00
parent 599bacd673
commit edd838d866
4 changed files with 28 additions and 7 deletions
+9 -2
View File
@@ -859,7 +859,7 @@ void menuGeneralDiagAna(uint8_t event)
SIMPLE_MENU(STR_MENUANA, menuTabDiag, e_Ana, ANAS_ITEMS_COUNT);
for (uint8_t i=0; i<7; i++) {
for (uint8_t i=0; i<8; i++) {
uint8_t y = 1+FH+(i/2)*FH;
uint8_t x = i&1 ? 64+5 : 0;
putsStrIdx(x, y, PSTR("A"), i+1);
@@ -874,7 +874,7 @@ void menuGeneralDiagAna(uint8_t event)
lcd_outdezAtt(64+5+6*FW-3, 1+4*FH, BandGap, 0);
#endif
#if defined(CPUARM)
#if defined(PCBSKY9X)
lcd_putsLeft(5*FH, STR_BATT_CALIB);
static uint32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(7)) / 8; // running average, sourced directly (to avoid unending debate :P)
@@ -888,6 +888,13 @@ void menuGeneralDiagAna(uint8_t event)
adcBatt = ((adcBatt * 7) + anaIn(7)) / 8; // running average, sourced directly (to avoid unending debate :P)
uint32_t batCalV = ((uint32_t)adcBatt*1390 + (10*(int32_t)adcBatt*g_eeGeneral.vBatCalib)/8) / BandGap;
lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
#elif defined(PCBX9D)
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 ;
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 5*FH, batCalV, (m_posVert==1 ? INVERS : 0));
#else
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, g_vbat100mV, (m_posVert==1 ? INVERS : 0));