Fixed switch position warning display on B&W

This commit is contained in:
Raphael Coeffic
2021-11-10 11:07:01 +01:00
parent fc4cdfd9ae
commit 68bdf025c1
5 changed files with 24 additions and 25 deletions
+1 -1
View File
@@ -744,7 +744,7 @@ void menuModelSetup(event_t event)
#endif #endif
} }
uint8_t swactive = !(g_model.switchWarningEnable & (1<<i)); uint8_t swactive = !(g_model.switchWarningEnable & (1<<i));
c = "\300-\301"[states & 0x03]; c = (STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
// lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, attr && (menuHorizontalPosition==current) ? INVERS : 0); // lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, attr && (menuHorizontalPosition==current) ? INVERS : 0);
lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN + qr.rem*((2*FW)+1), y+FH*qr.quot, FIRSTSW_STR+(i*length)+3, 1, attr && (menuHorizontalPosition==current) ? INVERS : 0); lcdDrawSizedText(MODEL_SETUP_2ND_COLUMN + qr.rem*((2*FW)+1), y+FH*qr.quot, FIRSTSW_STR+(i*length)+3, 1, attr && (menuHorizontalPosition==current) ? INVERS : 0);
if (swactive) lcdDrawChar(lcdNextPos, y+FH*qr.quot, c); if (swactive) lcdDrawChar(lcdNextPos, y+FH*qr.quot, c);
+1 -1
View File
@@ -700,7 +700,7 @@ void menuModelSetup(event_t event)
storageDirty(EE_MODEL); storageDirty(EE_MODEL);
} }
uint8_t swactive = !(g_model.switchWarningEnable & (1<<i)); uint8_t swactive = !(g_model.switchWarningEnable & (1<<i));
c = "\300-\301"[states & 0x03]; c = (STR_CHAR_UP "-" STR_CHAR_DOWN)[states & 0x03];
lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, line && (menuHorizontalPosition==current) ? INVERS : 0); lcdDrawChar(MODEL_SETUP_2ND_COLUMN+qr.rem*(2*FW+1), y+FH*qr.quot, 'A'+i, line && (menuHorizontalPosition==current) ? INVERS : 0);
if (swactive) lcdDrawChar(lcdNextPos, y+FH*qr.quot, c); if (swactive) lcdDrawChar(lcdNextPos, y+FH*qr.quot, c);
++current; ++current;
+17 -18
View File
@@ -406,20 +406,19 @@ char *getFlightModeString(char *dest, int8_t idx)
return dest; return dest;
} }
char *getSwitchWarningString(char *dest, swsrc_t idx) // char * getSwitchWarningString(char * dest, swsrc_t idx)
{ // {
char *s = dest; // char * s = dest;
uint8_t state = g_model.switchWarningState >> (3 * idx) & 0x07; // uint8_t state = g_model.switchWarningState >> (3*idx) & 0x07;
// *s++ = 'A' + idx;
*s++ = 'A' + idx; // if (state == 0)
if (state == 0) // *s = '\0';
*s = '\0'; // else {
else { // *s++ = "x\300-\301"[state];
*s++ = "x\300-\301"[state]; // *s = '\0';
*s = '\0'; // }
} // return dest;
return dest; // }
}
#if !defined(PCBSKY9X) #if !defined(PCBSKY9X)
char *getSwitchName(char *dest, swsrc_t idx) char *getSwitchName(char *dest, swsrc_t idx)
@@ -752,10 +751,10 @@ char *strAppendDate(char *str, bool time)
#if !defined(BOOT) #if !defined(BOOT)
static char tmpHelpersString[32]; static char tmpHelpersString[32];
char *getSwitchWarningString(swsrc_t idx) // char * getSwitchWarningString(swsrc_t idx)
{ // {
return getSwitchWarningString(tmpHelpersString, idx); // return getSwitchWarningString(tmpHelpersString, idx);
} // }
char *getSourceString(mixsrc_t idx) char *getSourceString(mixsrc_t idx)
{ {
+2 -2
View File
@@ -77,11 +77,11 @@ char *getSourceString(char *dest, mixsrc_t idx);
char *getFlightModeString(char *dest, int8_t idx); char *getFlightModeString(char *dest, int8_t idx);
#define SWITCH_WARNING_STR_SIZE 3 #define SWITCH_WARNING_STR_SIZE 3
char *getSwitchWarningString(char *dest, swsrc_t idx); // char *getSwitchWarningString(char *dest, swsrc_t idx);
char *getSourceString(mixsrc_t idx); char *getSourceString(mixsrc_t idx);
char *getSwitchPositionName(swsrc_t idx); char *getSwitchPositionName(swsrc_t idx);
char *getSwitchWarningString(swsrc_t idx); // char *getSwitchWarningString(swsrc_t idx);
char *getCurveString(int idx); char *getCurveString(int idx);
char *getTimerString(int32_t tme, TimerOptions timerOptions = {.options = 0}); char *getTimerString(int32_t tme, TimerOptions timerOptions = {.options = 0});
void splitTimer(char *s0, char *s1, char *s2, char *s3, int tme, void splitTimer(char *s0, char *s1, char *s2, char *s3, int tme,
+3 -3
View File
@@ -708,7 +708,7 @@ void checkSwitches()
LcdFlags attr = ((states & mask) == (switches_states & mask)) ? 0 : INVERS; LcdFlags attr = ((states & mask) == (switches_states & mask)) ? 0 : INVERS;
if (attr) { if (attr) {
if (++numWarnings < 6) { if (++numWarnings < 6) {
char c = "\300-\301"[(states & mask) >> (i*2)]; char c = (STR_CHAR_UP "-" STR_CHAR_DOWN)[(states & mask) >> (i*2)];
drawSource(x, y, MIXSRC_FIRST_SWITCH+i, attr); drawSource(x, y, MIXSRC_FIRST_SWITCH+i, attr);
lcdDrawChar(lcdNextPos, y, c, attr); lcdDrawChar(lcdNextPos, y, c, attr);
x = lcdNextPos + 3; x = lcdNextPos + 3;
@@ -727,9 +727,9 @@ void checkSwitches()
if (++numWarnings < 6) { if (++numWarnings < 6) {
lcdDrawTextAtIndex(x, y, STR_VSRCRAW, NUM_STICKS + 1 + i, INVERS); lcdDrawTextAtIndex(x, y, STR_VSRCRAW, NUM_STICKS + 1 + i, INVERS);
if (IS_POT(POT1 + i)) if (IS_POT(POT1 + i))
lcdDrawChar(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? 126 : 127, INVERS); lcdDrawChar(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? 126 : 127, INVERS); // TODO: use constants for chars
else else
lcdDrawChar(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? '\300' : '\301', INVERS); lcdDrawChar(lcdNextPos, y, g_model.potsWarnPosition[i] > GET_LOWRES_POT_POSITION(i) ? CHAR_UP : CHAR_DOWN, INVERS);
x = lcdNextPos + 3; x = lcdNextPos + 3;
} }
} }