Merge branch 'next' into mhotar/modelsetup_items

Conflicts:
	radio/src/translations.cpp
	radio/src/translations.h
	radio/src/translations/de.h.txt
	radio/src/translations/en.h.txt
	radio/src/translations/fr.h.txt
This commit is contained in:
mhotar
2014-03-04 02:13:15 +01:00
55 changed files with 867 additions and 579 deletions
+23 -17
View File
@@ -477,7 +477,7 @@ void menuGeneralSetup(uint8_t event)
#if defined(PCBSKY9X)
case ITEM_SETUP_TEMPERATURE_WARNING:
lcd_putsLeft(y, STR_TEMPWARNING);
putsTelemetryValue(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.temperatureWarn, UNIT_DEGREES, attr|LEFT) ;
putsTelemetryValue(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.temperatureWarn, UNIT_TEMPERATURE, attr|LEFT) ;
if(attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureWarn, 0, 120); // 0 means no alarm
break;
#endif
@@ -1154,7 +1154,7 @@ void menuGeneralDiagAna(uint8_t event)
#if defined(PCBTARANIS)
lcd_putsLeft(6*FH+1, STR_BATT_CALIB);
static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(8)) / 8;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + (adcBatt*g_eeGeneral.vBatCalib)/128) * BATT_SCALE;
batCalV >>= 11;
batCalV += 2; // because of the diode
@@ -1162,7 +1162,7 @@ void menuGeneralDiagAna(uint8_t event)
#elif defined(PCBSKY9X)
lcd_putsLeft(5*FH+1, STR_BATT_CALIB);
static int32_t adcBatt;
adcBatt = ((adcBatt * 7) + anaIn(7)) / 8;
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 8;
uint32_t batCalV = (adcBatt + adcBatt*(g_eeGeneral.vBatCalib)/128) * 4191;
batCalV /= 55296;
putsVolts(LEN_CALIB_FIELDS*FW+4*FW, 5*FH+1, batCalV, (m_posVert==1 ? INVERS : 0));
@@ -1170,7 +1170,7 @@ void menuGeneralDiagAna(uint8_t event)
lcd_putsLeft(6*FH-2, STR_BATT_CALIB);
// 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)
adcBatt = ((adcBatt * 7) + anaIn(TX_VOLTAGE)) / 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));
#else
@@ -1187,7 +1187,7 @@ void menuGeneralDiagAna(uint8_t event)
#if defined(PCBSKY9X)
lcd_putsLeft(7*FH+1, STR_TEMP_CALIB);
putsTelemetryValue(LEN_CALIB_FIELDS*FW+4*FW, 7*FH+1, getTemperature(), UNIT_DEGREES, (m_posVert==3 ? INVERS : 0)) ;
putsTelemetryValue(LEN_CALIB_FIELDS*FW+4*FW, 7*FH+1, getTemperature(), UNIT_TEMPERATURE, (m_posVert==3 ? INVERS : 0)) ;
if (m_posVert==3) CHECK_INCDEC_GENVAR(event, g_eeGeneral.temperatureCalib, -100, 100);
#endif
}
@@ -1196,6 +1196,7 @@ void menuGeneralDiagAna(uint8_t event)
enum menuGeneralHwItems {
ITEM_SETUP_HW_POT1,
ITEM_SETUP_HW_POT2,
ITEM_SETUP_HW_POT3,
ITEM_SETUP_HW_UART3_MODE,
ITEM_SETUP_HW_MAX
};
@@ -1214,14 +1215,20 @@ void menuGeneralHardware(uint8_t event)
switch(i) {
case ITEM_SETUP_HW_POT1:
case ITEM_SETUP_HW_POT2:
case ITEM_SETUP_HW_POT3:
{
int idx = i - ITEM_SETUP_HW_POT1;
uint8_t mask = (1<<idx);
uint8_t potType = selectMenuItem(HW_SETTINGS_COLUMN, y, i==ITEM_SETUP_HW_POT1 ? STR_POT1TYPE : STR_POT2TYPE, STR_POTTYPES, (g_eeGeneral.potsType & mask) >> idx, 0, 1, attr, event);
if (potType)
g_eeGeneral.potsType |= mask;
else
g_eeGeneral.potsType &= ~mask;
uint8_t shift = (2*idx);
uint8_t mask = (0x03 << shift);
putsMixerSource(sizeof(TR_TYPE)*FW, y, MIXSRC_FIRST_POT+idx);
uint8_t potType = (g_eeGeneral.potsType & mask) >> shift;
if (potType == POT_TYPE_NONE && i < 2)
potType = 1;
potType = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_TYPE, STR_POTTYPES, potType, 0, POT_TYPE_MAX, attr, event);
if (potType == POT_TYPE_POT && i < 2)
potType = 0;
g_eeGeneral.potsType &= ~mask;
g_eeGeneral.potsType |= (potType << shift);
break;
}
@@ -1234,7 +1241,6 @@ void menuGeneralHardware(uint8_t event)
}
}
}
#elif defined(PCBSKY9X)
@@ -1323,7 +1329,7 @@ void menuCommonCalib(uint8_t event)
#if defined(PCBTARANIS)
uint8_t idx = i - POT1;
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
if (IS_MULTIPOS_POT(i) && count <= POTS_POS_COUNT) {
if (IS_POT_MULTIPOS(i) && count <= XPOTS_MULTIPOS_COUNT) {
if (reusableBuffer.calib.xpotsCalib[idx].lastCount == 0 || vt < reusableBuffer.calib.xpotsCalib[idx].lastPosition - XPOT_DELTA || vt > reusableBuffer.calib.xpotsCalib[idx].lastPosition + XPOT_DELTA) {
reusableBuffer.calib.xpotsCalib[idx].lastPosition = vt;
reusableBuffer.calib.xpotsCalib[idx].lastCount = 1;
@@ -1341,7 +1347,7 @@ void menuCommonCalib(uint8_t event)
}
}
if (!found) {
if (count < POTS_POS_COUNT) {
if (count < XPOTS_MULTIPOS_COUNT) {
reusableBuffer.calib.xpotsCalib[idx].steps[count] = position;
}
reusableBuffer.calib.xpotsCalib[idx].stepsCount += 1;
@@ -1413,7 +1419,7 @@ void menuCommonCalib(uint8_t event)
for (uint8_t i=POT1; i<=POT_LAST; i++) {
int idx = i - POT1;
int count = reusableBuffer.calib.xpotsCalib[idx].stepsCount;
if (IS_MULTIPOS_POT(i) && count > 1 && count <= POTS_POS_COUNT) {
if (IS_POT_MULTIPOS(i) && count > 1 && count <= XPOTS_MULTIPOS_COUNT) {
for (int j=0; j<count; j++) {
for (int k=j+1; k<count; k++) {
if (reusableBuffer.calib.xpotsCalib[idx].steps[k] < reusableBuffer.calib.xpotsCalib[idx].steps[j]) {
@@ -1451,11 +1457,11 @@ void menuCommonCalib(uint8_t event)
if (reusableBuffer.calib.state == 2) {
steps = reusableBuffer.calib.xpotsCalib[i-POT1].stepsCount;
}
else if (IS_MULTIPOS_POT(i)) {
else if (IS_POT_MULTIPOS(i)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[i];
steps = calib->count + 1;
}
if (steps > 0 && steps <= POTS_POS_COUNT) {
if (steps > 0 && steps <= XPOTS_MULTIPOS_COUNT) {
lcd_outdezAtt(LCD_W/2-2+(i-POT1)*5, LCD_H-6, steps, TINSIZE);
}
}
+10 -4
View File
@@ -1351,6 +1351,12 @@ bool isSourceAvailable(int source)
return false;
#endif
#if defined(PCBTARANIS)
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
}
#endif
#if !defined(HELI)
if (source>=MIXSRC_CYC1 && source<=MIXSRC_CYC3)
return false;
@@ -1438,11 +1444,11 @@ bool isSwitchAvailableInLogicalSwitches(int swtch)
}
#if defined(PCBTARANIS)
if (swtch >= SWSRC_P11 && swtch <= SWSRC_P26) {
int index = (swtch - SWSRC_P11) / POTS_POS_COUNT;
if (g_eeGeneral.potsType & (1<<index)) {
if (swtch >= SWSRC_FIRST_MULTIPOS_SWITCH && swtch <= SWSRC_LAST_MULTIPOS_SWITCH) {
int index = (swtch - SWSRC_FIRST_MULTIPOS_SWITCH) / XPOTS_MULTIPOS_COUNT;
if (IS_POT_MULTIPOS(POT1+index)) {
StepsCalibData * calib = (StepsCalibData *) &g_eeGeneral.calib[POT1+index];
return (calib->count >= ((swtch - SWSRC_P11) % POTS_POS_COUNT));
return (calib->count >= ((swtch - SWSRC_FIRST_MULTIPOS_SWITCH) % XPOTS_MULTIPOS_COUNT));
}
else {
return false;
+12 -7
View File
@@ -122,8 +122,10 @@ void drawPotsBars()
// Optimization by Mike Blandford
uint8_t x, i, len ; // declare temporary variables
for (x=LCD_W/2-5, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=5, i++) {
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
V_BAR(x, LCD_H-8, len)
if (IS_POT_AVAILABLE(i)) {
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
V_BAR(x, LCD_H-8, len)
}
}
}
@@ -196,8 +198,11 @@ void displayTrims(uint8_t phase)
void displaySliders()
{
for (uint8_t i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; i++) {
xcoord_t x = (i%2 ? LCD_W-5 : 3);
int8_t y = (i>NUM_STICKS+1 ? LCD_H/2+1 : 1);
if (i == POT3) {
continue;
}
xcoord_t x = ((i==POT1 || i==SLIDER1) ? 3 : LCD_W-5);
int8_t y = (i>=SLIDER1 ? LCD_H/2+1 : 1);
lcd_vline(x, y, LCD_H/2-2);
lcd_vline(x+1, y, LCD_H/2-2);
y += LCD_H/2-4;
@@ -268,9 +273,9 @@ void displayTopBar()
}
/* Altitude */
if (g_model.frsky.altitudeDisplayed && frskyData.hub.baroAltitudeOffset) {
if (g_model.frsky.altitudeDisplayed && TELEMETRY_BARO_ALT_AVAILABLE()) {
LCD_ICON(altitude_icon_x, BAR_Y, ICON_ALTITUDE);
putsTelemetryValue(altitude_icon_x+2*FW-1, BAR_Y+1, TELEMETRY_ALT_BP, UNIT_METERS, LEFT);
putsTelemetryValue(altitude_icon_x+2*FW-1, BAR_Y+1, TELEMETRY_RELATIVE_BARO_ALT_BP, UNIT_SPEED, LEFT);
}
}
@@ -406,7 +411,7 @@ void displayBattVoltage()
void displayVoltageOrAlarm()
{
if (g_vbat100mV > g_eeGeneral.vBatWarn && g_eeGeneral.temperatureWarn && getTemperature() >= g_eeGeneral.temperatureWarn) {
putsTelemetryValue(6*FW-1, 3*FH, getTemperature(), UNIT_DEGREES, BLINK|INVERS|DBLSIZE);
putsTelemetryValue(6*FW-1, 3*FH, getTemperature(), UNIT_TEMPERATURE, BLINK|INVERS|DBLSIZE);
}
else if (g_vbat100mV > g_eeGeneral.vBatWarn && g_eeGeneral.mAhWarn && (g_eeGeneral.mAhUsed + Current_used * (488 + g_eeGeneral.currentCalib)/8192/36) / 500 >= g_eeGeneral.mAhWarn) {
putsTelemetryValue(7*FW-1, 3*FH, (g_eeGeneral.mAhUsed + Current_used*(488 + g_eeGeneral.currentCalib)/8192/36)/10, UNIT_MAH, BLINK|INVERS|DBLSIZE);
+4 -4
View File
@@ -152,8 +152,8 @@ void menuStatisticsDebug(uint8_t event)
#if defined(PCBSKY9X)
lcd_putsLeft(3*FH, STR_CPU_TEMP);
putsTelemetryValue(MENU_DEBUG_COL_OFS, 3*FH, getTemperature(), UNIT_DEGREES, 0);
putsTelemetryValue(20*FW+2, 3*FH, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_DEGREES, 0);
putsTelemetryValue(MENU_DEBUG_COL_OFS, 3*FH, getTemperature(), UNIT_TEMPERATURE, 0);
putsTelemetryValue(20*FW+2, 3*FH, maxTemperature+g_eeGeneral.temperatureCalib, UNIT_TEMPERATURE, 0);
#endif
#if defined(PCBSKY9X)
@@ -169,8 +169,8 @@ void menuStatisticsDebug(uint8_t event)
lcd_putsAtt(9*FW+2, 4*FH, PSTR("Upgr.TinyApp"),INVERS);
}
else {
putsTelemetryValue(MENU_DEBUG_COL_OFS, 4*FH, Coproc_temp, UNIT_DEGREES, 0);
putsTelemetryValue(20*FW+2, 4*FH, Coproc_maxtemp, UNIT_DEGREES, 0);
putsTelemetryValue(MENU_DEBUG_COL_OFS, 4*FH, Coproc_temp, UNIT_TEMPERATURE, 0);
putsTelemetryValue(20*FW+2, 4*FH, Coproc_maxtemp, UNIT_TEMPERATURE, 0);
}
#elif defined(PCBTARANIS) && !defined(SIMU)
lcd_putsLeft(4*FH, "Free Mem");