Merge remote-tracking branch 'origin/bsongis/refactoring_putsSwitches'
This commit is contained in:
@@ -140,7 +140,7 @@ enum SwitchContext
|
||||
bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
{
|
||||
if (swtch < 0) {
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
|
||||
return false;
|
||||
}
|
||||
swtch = -swtch;
|
||||
@@ -156,7 +156,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
}
|
||||
}
|
||||
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
|
||||
if (swtch < 0) {
|
||||
negative = true;
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_One) {
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
|
||||
return false;
|
||||
}
|
||||
swtch = -swtch;
|
||||
@@ -245,7 +245,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
}
|
||||
}
|
||||
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_One)) {
|
||||
if (context != ModelCustomFunctionsContext && context != GeneralCustomFunctionsContext && (swtch == SWSRC_ON || swtch == SWSRC_ONE)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -674,7 +674,7 @@ void putsMixerSource(coord_t x, coord_t y, uint32_t idx, LcdFlags att)
|
||||
else
|
||||
lcd_putsiAtt(x, y, STR_VSRCRAW, idx+1, att);
|
||||
}
|
||||
else if (idx >= MIXSRC_FIRST_SWITCH && idx < MIXSRC_FIRST_LOGICAL_SWITCH) {
|
||||
else if (idx >= MIXSRC_FIRST_SWITCH && idx <= MIXSRC_LAST_SWITCH) {
|
||||
idx = idx-MIXSRC_FIRST_SWITCH;
|
||||
if (ZEXIST(g_eeGeneral.switchNames[idx])) {
|
||||
lcd_putcAtt(x, y, '\312', att); //switch symbol
|
||||
@@ -729,27 +729,46 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
|
||||
|
||||
void putsSwitches(coord_t x, coord_t y, int32_t idx, LcdFlags att)
|
||||
{
|
||||
if (idx == SWSRC_OFF)
|
||||
if (idx == SWSRC_NONE) {
|
||||
return lcd_putsiAtt(x, y, STR_VSWITCHES, 0, att);
|
||||
}
|
||||
else if (idx == SWSRC_OFF) {
|
||||
return lcd_putsiAtt(x, y, STR_OFFON, 0, att);
|
||||
}
|
||||
|
||||
if (idx < 0) {
|
||||
lcd_putcAtt(x-2, y, '!', att);
|
||||
idx = -idx;
|
||||
}
|
||||
#if defined(FLIGHT_MODES)
|
||||
if (idx >= SWSRC_FIRST_FLIGHT_MODE) {
|
||||
return putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
#endif
|
||||
if (idx >= SWSRC_FIRST_SWITCH && idx <= SWSRC_LAST_SWITCH) {
|
||||
|
||||
if (idx <= SWSRC_LAST_SWITCH) {
|
||||
div_t swinfo = switchInfo(idx);
|
||||
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
|
||||
lcd_putsnAtt(x, y, g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME, ZCHAR|att);
|
||||
char c = "\300-\301"[swinfo.rem];
|
||||
lcd_putcAtt(lcdNextPos, y, c, att);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
lcd_putcAtt(x, y, 'S', att);
|
||||
lcd_putcAtt(lcdNextPos, y, 'A'+swinfo.quot, att);
|
||||
}
|
||||
char c = "\300-\301"[swinfo.rem];
|
||||
lcd_putcAtt(lcdNextPos, y, c, att);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_MULTIPOS_SWITCH) {
|
||||
div_t swinfo = div(idx - SWSRC_FIRST_MULTIPOS_SWITCH, XPOTS_MULTIPOS_COUNT);
|
||||
putsStrIdx(x, y, "S", swinfo.quot*10+swinfo.rem+11, att);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_TRIM) {
|
||||
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_FIRST_TRIM+1, att);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
putsStrIdx(x, y, "L", idx-SWSRC_FIRST_LOGICAL_SWITCH+1, att);
|
||||
}
|
||||
else if (idx <= SWSRC_ONE) {
|
||||
lcd_putsiAtt(x, y, STR_VSWITCHES, idx-SWSRC_ON+1+(2*NUM_STICKS), att);
|
||||
}
|
||||
else {
|
||||
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
return lcd_putsiAtt(x, y, STR_VSWITCHES, idx, att);
|
||||
}
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
|
||||
@@ -88,7 +88,7 @@ void DrawFunction(FnFuncP fn, uint8_t offset)
|
||||
|
||||
coord_t prev_yv = (coord_t)-1;
|
||||
|
||||
for (int8_t xv=-WCHART; xv<=WCHART; xv++) {
|
||||
for (int xv=-WCHART; xv<=WCHART; xv++) {
|
||||
coord_t yv = (LCD_H-1) - (((uint16_t)RESX + fn(xv * (RESX/WCHART))) / 2 * (LCD_H-1) / RESX);
|
||||
if (prev_yv != (coord_t)-1) {
|
||||
if (abs((int8_t)yv-prev_yv) <= 1) {
|
||||
@@ -108,7 +108,7 @@ uint8_t getExpoMixCount(uint8_t expo)
|
||||
uint8_t count = 0;
|
||||
uint8_t ch ;
|
||||
|
||||
for(int8_t i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
|
||||
for (int i=(expo ? MAX_EXPOS-1 : MAX_MIXERS-1); i>=0; i--) {
|
||||
ch = (expo ? EXPO_VALID(expoAddress(i)) : mixAddress(i)->srcRaw);
|
||||
if (ch != 0) {
|
||||
count++;
|
||||
|
||||
Reference in New Issue
Block a user