Issue 53 fixed

Issue 75 fixed
This commit is contained in:
bsongis
2012-08-11 20:08:58 +00:00
parent 5697f4aa72
commit 0eee68144d
3 changed files with 31 additions and 15 deletions
+8 -1
View File
@@ -806,7 +806,14 @@ void menuProcDiagAna(uint8_t event)
// Voltage calibration
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
#if defined (PCBV4)
#if defined(PCBARM)
static uint32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(7)) / 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, 6*FH-2, batCalV, (m_posVert==1 ? INVERS : 0));
// TODO PREC2 => lcd_outdezNAtt(LEN_CALIB_FIELDS*FW+4*FW, 6*FH-2, batCalV, PREC2|(m_posVert==1 ? INVERS : 0));
#elif defined(PCBV4)
// Gruvin wants 2 decimal places and instant update of volts calib field when button pressed
static uint16_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(7)) / 8; // running average, sourced directly (to avoid unending debate :P)
+4 -4
View File
@@ -2501,11 +2501,11 @@ void menuProcFunctionSwitches(uint8_t event)
uint8_t active = (attr && (s_editMode>0 || p1valdiff));
switch (j) {
case 0:
if (sd->func <= FUNC_SAFETY_CH16 && sd->delay) {
if (sd->func <= FUNC_TRAINER_AIL && sd->delay) {
if (sd->swtch > MAX_SWITCH+1) sd->swtch -= (MAX_SWITCH+1);
if (sd->swtch < -MAX_SWITCH-1) sd->swtch += (MAX_SWITCH+1);
}
putsSwitches(3, y, sd->swtch, SWONOFF | attr | ((abs(sd->swtch) <= (MAX_SWITCH+1) && getSwitch(sd->swtch, 0) && (sd->func >= 16 || sd->delay)) ? BOLD : 0));
putsSwitches(3, y, sd->swtch, SWONOFF | attr | ((abs(sd->swtch) <= (MAX_SWITCH+1) && getSwitch(sd->swtch, 0) && (sd->func > FUNC_INSTANT_TRIM || sd->delay)) ? BOLD : 0));
if (active) {
CHECK_INCDEC_MODELSWITCH( event, sd->swtch, SWITCH_OFF-MAX_SWITCH, SWITCH_ON+MAX_SWITCH+1);
}
@@ -2609,7 +2609,7 @@ void menuProcFunctionSwitches(uint8_t event)
lcd_outdezAtt(18*FW, y, val_displayed, attr);
}
else {
if (attr) m_posHorz = 0;
if (attr) m_posHorz = ((event & EVT_KEY_MASK) == KEY_LEFT ? 1 : 3);
break;
}
@@ -2623,7 +2623,7 @@ void menuProcFunctionSwitches(uint8_t event)
break;
case 3:
if (sd->swtch && sd->func <= FUNC_SAFETY_CH16) {
if (sd->swtch && sd->func <= FUNC_INSTANT_TRIM) {
#if defined(GRAPHICS)
menu_lcd_onoff(20*FW, y, sd->delay, attr ) ;
#else
+19 -10
View File
@@ -635,6 +635,9 @@ bool __getSwitch(int8_t swtch)
#if defined(FRSKY)
// Telemetry
if (cs->v1 > CSW_CHOUT_BASE+NUM_CHNOUT) {
if (frskyStreaming <= 0 && cs->v1 > CSW_CHOUT_BASE+NUM_CHNOUT+MAX_TIMERS)
return swtch > 0 ? false : true;
y = convertTelemValue(cs->v1-(CSW_CHOUT_BASE+NUM_CHNOUT), 128+cs->v2);
uint8_t idx = cs->v1-CSW_CHOUT_BASE-NUM_CHNOUT-TELEM_ALT;
if (idx < THLD_MAX) {
@@ -1726,13 +1729,14 @@ void playValue(uint8_t idx)
default:
{
uint8_t unit;
uint8_t unit = 1;
if (idx < NUM_XCHNRAW+TELEM_TM1-1)
val = (val * 25) / 256;
if (idx >= NUM_XCHNRAW+TELEM_ALT-1 && idx <= NUM_XCHNRAW+TELEM_GPSALT-1)
unit = idx - (NUM_XCHNRAW+TELEM_ALT-1);
else if (idx >= NUM_XCHNRAW+TELEM_MAX_T1-1 && idx <= NUM_XCHNRAW+TELEM_MAX_DIST-1)
unit = 3 + idx - (NUM_XCHNRAW+TELEM_MAX_T1-1);
else
unit = 1;
unit = pgm_read_byte(bchunit_ar+unit);
#if !defined(IMPERIAL_UNITS)
if (unit == UNIT_KTS) {
@@ -1785,20 +1789,25 @@ void evalFunctions()
swtch += MAX_SWITCH+1;
}
if (getSwitch(swtch, 0)) {
if (sd->func < FUNC_TRAINER && sd->delay) {
safetyCh[sd->func] = FSW_PARAM(sd);
}
if (sd->delay) {
if (sd->func < FUNC_TRAINER) {
safetyCh[sd->func] = FSW_PARAM(sd);
}
if (~activeFunctions & function_mask) {
if (sd->func == FUNC_INSTANT_TRIM) {
if (g_menuStack[0] == menuMainView
if (~activeFunctions & function_mask) {
if (sd->func == FUNC_INSTANT_TRIM) {
if (g_menuStack[0] == menuMainView
#if defined(FRSKY)
|| g_menuStack[0] == menuProcFrsky
#endif
)
instantTrim();
instantTrim();
}
}
}
else if (sd->func <= FUNC_INSTANT_TRIM) {
function_mask = 0;
}
#if defined(SDCARD)
if (sd->func == FUNC_LOGS) {