Cosmetics

This commit is contained in:
Bertrand Songis
2016-08-21 12:41:12 +02:00
parent cd2b6b3864
commit b657ca1862
28 changed files with 122 additions and 97 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ extern Layout * customScreens[MAX_CUSTOM_SCREENS];
extern Topbar * topbar;
void drawAlertBox(const char * title, const char * text, const char * action);
void showAlertBox(const pm_char * title, const pm_char * text, const char * action, uint8_t sound);
void showAlertBox(const char * title, const char * text, const char * action, uint8_t sound);
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
#define IS_TELEMETRY_VIEW_DISPLAYED() false
+9 -43
View File
@@ -64,7 +64,7 @@ void lcdPutFontPattern(coord_t x, coord_t y, const uint8_t * font, const uint16_
lcdNextPos = x + width;
}
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags flags)
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags)
{
uint32_t fontindex = FONTINDEX(flags);
const pm_uchar * font = fontsTable[fontindex];
@@ -210,51 +210,16 @@ void lcdDrawLine(coord_t x1, coord_t y1, coord_t x2, coord_t y2, uint8_t pat, Lc
}
#endif
void drawRtcTime(coord_t x, coord_t y, LcdFlags att)
void drawRtcTime(coord_t x, coord_t y, LcdFlags flags)
{
drawTimer(x, y, getValue(MIXSRC_TX_TIME), att);
drawTimer(x, y, getValue(MIXSRC_TX_TIME), flags);
}
void getTimerString(char * str, putstime_t tme, LcdFlags att)
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags flags)
{
div_t qr;
if (tme < 0) {
// TODO lcdDrawChar(x - ((att & DBLSIZE) ? FW+2 : ((att & MIDSIZE) ? FW+0 : FWNUM)), y, '-', att);
tme = -tme;
*str++ = '-';
}
qr = div(tme, 60);
if (att & TIMEHOUR) {
div_t qr2 = div(qr.quot, 60);
*str++ = '0' + (qr2.quot/10);
*str++ = '0' + (qr2.quot%10);
*str++ = ':';
qr.quot = qr2.rem;
}
*str++ = '0' + (qr.quot/10);
*str++ = '0' + (qr.quot%10);
*str++ = ':';
*str++ = '0' + (qr.rem/10);
*str++ = '0' + (qr.rem%10);
*str = '\0';
}
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att)
{
char str[LEN_TIMER_STRING]; // "-00:00:00"
getTimerString(str, tme, att);
lcdDrawText(x, y, str, att);
}
void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, int idx, LcdFlags att, const char * prefix)
{
char s[64];
strAppendUnsigned(strAppend(strAppend(s, prefix), str), abs(idx));
lcdDrawText(x, y, s, att);
char str[LEN_TIMER_STRING];
getTimerString(str, tme, flags & TIMEHOUR);
lcdDrawText(x, y, str, flags);
}
void putsStickName(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
@@ -275,7 +240,7 @@ void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
lcdDrawTextAtIndex(x, y, STR_RETA123, idx-1, att);
}
void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
void putsModelName(coord_t x, coord_t y, char * name, uint8_t id, LcdFlags att)
{
uint8_t len = sizeof(g_model.header.name);
while (len>0 && !name[len-1]) --len;
@@ -355,6 +320,7 @@ void drawValueWithUnit(coord_t x, coord_t y, int32_t val, uint8_t unit, LcdFlags
void drawDate(coord_t x, coord_t y, TelemetryItem & telemetryItem, LcdFlags att)
{
// TODO
if (att & DBLSIZE) {
x -= 42;
att &= ~0x0F00; // TODO constant
+2 -8
View File
@@ -107,9 +107,9 @@ extern display_t displayBuf[DISPLAY_BUFFER_SIZE];
extern coord_t lcdNextPos;
void lcdDrawChar(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=0);
void lcdDrawChar(coord_t x, coord_t y, char c, LcdFlags flags=0);
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags attr=0);
void lcdDrawTextAtIndex(coord_t x, coord_t y, const pm_char * s, uint8_t idx, LcdFlags flags=0);
inline void lcdClear()
{
@@ -141,14 +141,8 @@ void drawTrimMode(coord_t x, coord_t y, uint8_t phase, uint8_t idx, LcdFlags att
#define putsChn(x, y, idx, att) drawSource(x, y, MIXSRC_CH1+idx-1, att)
void putsChnLetter(coord_t x, coord_t y, uint8_t idx, LcdFlags attr);
void drawSourceCustomValue(coord_t x, coord_t y, source_t channel, int32_t val, LcdFlags att=0);
void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags att=0);
void drawSensorCustomValue(coord_t x, coord_t y, uint8_t channel, int32_t val, LcdFlags att=0);
#define putstime_t int32_t
#define LEN_TIMER_STRING 10
void getTimerString(char * str, putstime_t tme, LcdFlags att=0);
void drawRtcTime(coord_t x, coord_t y, LcdFlags att=0);
void drawTimer(coord_t x, coord_t y, putstime_t tme, LcdFlags att=0);
+8 -1
View File
@@ -159,6 +159,7 @@ enum ExposFields {
EXPO_FIELD_INPUT_NAME,
EXPO_FIELD_NAME,
EXPO_FIELD_SOURCE,
EXPO_FIELD_SCALE,
EXPO_FIELD_WEIGHT,
EXPO_FIELD_OFFSET,
CASE_CURVES(EXPO_FIELD_CURVE)
@@ -175,7 +176,7 @@ bool menuModelExpoOne(event_t event)
{
ExpoData * ed = expoAddress(s_currIdx);
SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, ICON_MODEL_INPUTS, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)1 : (uint8_t)0), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, ICON_MODEL_INPUTS, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)0 : (uint8_t)HIDDEN_ROW), 0, 0, CASE_CURVES(CURVE_ROWS) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
lcdDrawSizedText(50, 3+FH, g_model.inputNames[ed->chn], LEN_INPUT_NAME, ZCHAR|MENU_TITLE_COLOR);
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 230, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
@@ -243,6 +244,12 @@ bool menuModelExpoOne(event_t event)
menuHorizontalPosition = 0;
}
break;
case EXPO_FIELD_SCALE:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SCALE);
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|attr);
if (attr) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
break;
case EXPO_FIELD_WEIGHT:
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_WEIGHT);
@@ -171,7 +171,7 @@ bool menuModelLogicalSwitches(event_t event)
INCDEC_ENABLE_CHECK(NULL);
}
v2_max = getMaximumValue(v1_val);
v2_min = - v2_max;
v2_min = -v2_max;
drawSourceCustomValue(CSW_3RD_COLUMN, y, v1_val, v1_val <= MIXSRC_LAST_CH ? calc100toRESX(cs->v2) : cs->v2, LEFT|attr2);
}
+2 -2
View File
@@ -45,7 +45,7 @@ void runPopupWarningBox()
// lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_WARNING);
}
void displayMessageBox()
void drawMessageBox()
{
// theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_INFO);
// lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
@@ -69,7 +69,7 @@ void showAlertBox(const char * title, const char * text, const char * action, ui
void showMessageBox(const char * title)
{
// displayMessageBox();
// drawMessageBox();
lcdDrawSizedText(WARNING_LINE_X, WARNING_LINE_Y, title, WARNING_LINE_LEN, DBLSIZE|WARNING_COLOR);
lcdRefresh();
}
+1 -1
View File
@@ -33,7 +33,7 @@ bool menuRadioTrainer(event_t event)
MENU(STR_MENUTRAINER, RADIO_ICONS, menuTabGeneral, MENU_RADIO_TRAINER, (slave ? 0 : 6), { 2, 2, 2, 2, 0/*, 0*/ });
if (slave) {
// TODO lcd_putsCenter(5*FH, STR_SLAVE, TEXT_COLOR);
// TODO lcdDrawTextAlignedCenter(5*FH, STR_SLAVE, TEXT_COLOR);
return true;
}
+1 -1
View File
@@ -37,7 +37,7 @@ bool menuRadioVersion(event_t event)
DEBUG_TIMER_STOP(debugTimerDrawText);
// TODO EEPROM erase + backup
// lcd_putsCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP);
// lcdDrawTextAlignedCenter(MENU_HEADER_HEIGHT+6*FH, STR_EEBACKUP);
// if (event == EVT_KEY_LONG(KEY_ENTER)) {
// eepromBackup();
// }
+1 -1
View File
@@ -130,7 +130,7 @@ bool menuTextView(event_t event)
#if defined(SIMU)
if (!strncmp(title, "./", 2)) title += 2;
#endif
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
lcdDrawTextAlignedCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
#endif
drawVerticalScrollbar(LCD_W-5, 50, 195, menuVerticalOffset, lines_count, NUM_BODY_LINES);