[Horus] A lot of GUI fixes
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
@@ -45,7 +45,7 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||
|
||||
#if !defined(CPUM64)
|
||||
#define DEFAULT_SCROLLBAR_X (LCD_W-1)
|
||||
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
#endif
|
||||
|
||||
#define SET_SCROLLBAR_X(x)
|
||||
|
||||
@@ -160,7 +160,7 @@ const char * displayMenu(uint8_t event)
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
displayScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
lcdDrawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
|
||||
@@ -151,7 +151,7 @@ void menuTextView(uint8_t event)
|
||||
lcd_invert_line(0);
|
||||
|
||||
if (lines_count > LCD_LINES-1) {
|
||||
displayScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||
lcdDrawScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||
}
|
||||
|
||||
#if !defined(CPUM64)
|
||||
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
lcd_vlineStip(x, y, h, DOTTED);
|
||||
coord_t yofs = (h * offset) / count;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#define MENU_FOOTER_TOP 251 // MENU_BODY_TOP + MENU_BODY_HEIGHT
|
||||
#define MENU_FOOTER_HEIGHT 21
|
||||
|
||||
#define MENU_TITLE_LEFT 6
|
||||
#define MENUS_MARGIN_LEFT 6
|
||||
|
||||
#define DEFAULT_SCROLLBAR_X LCD_W-10
|
||||
#define DEFAULT_SCROLLBAR_Y MENU_CONTENT_TOP
|
||||
@@ -59,9 +59,15 @@
|
||||
#define INVERT_VERT_MARGIN 1
|
||||
#define INVERT_LINE_HEIGHT 18
|
||||
|
||||
#define CURVE_SIDE_WIDTH 88
|
||||
#define CURVE_CENTER_X (LCD_W-CURVE_SIDE_WIDTH-10)
|
||||
#define CURVE_CENTER_Y 159
|
||||
|
||||
#define MENU_TITLE_NEXT_POS (lcdNextPos + 10)
|
||||
|
||||
void displaySplash();
|
||||
void displayScreenIndex(uint8_t index, uint8_t count);
|
||||
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void drawHeader(int index);
|
||||
void drawFooter();
|
||||
#define drawStatusLine(...)
|
||||
|
||||
+116
-26
@@ -38,14 +38,14 @@
|
||||
|
||||
uint8_t switchToMix(uint8_t source)
|
||||
{
|
||||
#warning en double !
|
||||
return 0;
|
||||
div_t qr = div(source-1, 3);
|
||||
return qr.quot+MIXSRC_FIRST_SWITCH;
|
||||
}
|
||||
|
||||
int circularIncDec(int current, int incr, int min, int max, IsValueAvailable isValueAvailable)
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable)
|
||||
{
|
||||
do {
|
||||
current += incr;
|
||||
current += inc;
|
||||
if (current < min)
|
||||
current = max;
|
||||
else if (current > max)
|
||||
@@ -111,6 +111,10 @@ bool isSourceAvailable(int source)
|
||||
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
|
||||
}
|
||||
|
||||
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH) {
|
||||
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
|
||||
}
|
||||
|
||||
#if !defined(HELI)
|
||||
if (source>=MIXSRC_CYC1 && source<=MIXSRC_CYC3)
|
||||
return false;
|
||||
@@ -144,6 +148,14 @@ bool isSourceAvailable(int source)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isSourceAvailableInGlobalFunctions(int source)
|
||||
{
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
|
||||
return false;
|
||||
}
|
||||
return isSourceAvailable(source);
|
||||
}
|
||||
|
||||
bool isSourceAvailableInCustomSwitches(int source)
|
||||
{
|
||||
bool result = isSourceAvailable(source);
|
||||
@@ -160,23 +172,29 @@ bool isSourceAvailableInCustomSwitches(int source)
|
||||
|
||||
bool isInputSourceAvailable(int source)
|
||||
{
|
||||
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
|
||||
return true;
|
||||
if (source>=MIXSRC_FIRST_POT && source<=MIXSRC_LAST_POT) {
|
||||
return IS_POT_AVAILABLE(POT1+source-MIXSRC_FIRST_POT);
|
||||
}
|
||||
|
||||
if (source>=MIXSRC_Rud && source<=MIXSRC_MAX)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_TrimRud && source<MIXSRC_SW1)
|
||||
if (source>=MIXSRC_FIRST_TRIM && source<=MIXSRC_LAST_TRIM)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_FIRST_SWITCH && source<=MIXSRC_LAST_SWITCH)
|
||||
return SWITCH_EXISTS(source-MIXSRC_FIRST_SWITCH);
|
||||
|
||||
if (source>=MIXSRC_FIRST_CH && source<=MIXSRC_LAST_CH)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_FIRST_TRAINER && source<=MIXSRC_LAST_TRAINER)
|
||||
return true;
|
||||
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM)
|
||||
return isTelemetryFieldAvailable(source-MIXSRC_FIRST_TELEM);
|
||||
if (source>=MIXSRC_FIRST_TELEM && source<=MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source-MIXSRC_FIRST_TELEM, 3);
|
||||
return isTelemetryFieldAvailable(qr.quot) && isTelemetryFieldComparisonAvailable(qr.quot);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -190,30 +208,59 @@ enum SwitchContext
|
||||
MixesContext
|
||||
};
|
||||
|
||||
bool isLogicalSwitchAvailable(int index)
|
||||
{
|
||||
LogicalSwitchData * lsw = lswAddress(index);
|
||||
return (lsw->func != LS_FUNC_NONE);
|
||||
}
|
||||
|
||||
bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
{
|
||||
uint32_t index = switchInfo(abs(swtch)).quot;
|
||||
bool negative = false;
|
||||
|
||||
if (swtch < 0) {
|
||||
if (!IS_3POS(index))
|
||||
return false;
|
||||
negative = true;
|
||||
if (swtch == -SWSRC_ON || swtch == -SWSRC_ONE) {
|
||||
return false;
|
||||
}
|
||||
swtch = -swtch;
|
||||
}
|
||||
|
||||
if (swtch <= SWSRC_FIRST_SWITCH) {
|
||||
if (swtch >= SWSRC_SA0 && swtch <= SWSRC_LAST_SWITCH) {
|
||||
div_t swinfo = switchInfo(swtch);
|
||||
if (!SWITCH_EXISTS(swinfo.quot)) {
|
||||
return false;
|
||||
}
|
||||
if (!IS_3POS(swinfo.quot)) {
|
||||
if (negative) {
|
||||
return false;
|
||||
}
|
||||
if (IS_3POS_MIDDLE(swinfo.rem)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#if NUM_XPOTS > 0
|
||||
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_FIRST_MULTIPOS_SWITCH) % XPOTS_MULTIPOS_COUNT));
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
if (context == GeneralCustomFunctionsContext) {
|
||||
return false;
|
||||
}
|
||||
else if (context != LogicalSwitchesContext) {
|
||||
LogicalSwitchData * cs = lswAddress(swtch-SWSRC_FIRST_LOGICAL_SWITCH);
|
||||
return (cs->func != LS_FUNC_NONE);
|
||||
return isLogicalSwitchAvailable(swtch - SWSRC_FIRST_LOGICAL_SWITCH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -235,6 +282,10 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
}
|
||||
}
|
||||
|
||||
if (swtch >= SWSRC_FIRST_SENSOR && swtch <= SWSRC_LAST_SENSOR) {
|
||||
return isTelemetryFieldAvailable(swtch - SWSRC_FIRST_SENSOR);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -274,6 +325,14 @@ bool isSwitchAvailableInTimers(int swtch)
|
||||
return isSwitchAvailable(swtch, TimersContext);
|
||||
}
|
||||
|
||||
bool isThrottleSourceAvailable(int source)
|
||||
{
|
||||
if (source >= THROTTLE_SOURCE_FIRST_POT && source < THROTTLE_SOURCE_FIRST_POT+NUM_POTS && !IS_POT_AVAILABLE(POT1+source-THROTTLE_SOURCE_FIRST_POT))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
bool isLogicalSwitchFunctionAvailable(int function)
|
||||
{
|
||||
return function != LS_FUNC_RANGE;
|
||||
@@ -301,15 +360,14 @@ bool isAssignableFunctionAvailable(int function)
|
||||
#if !defined(HAPTIC)
|
||||
case FUNC_HAPTIC:
|
||||
#endif
|
||||
case FUNC_RESERVE4:
|
||||
#if !defined(DANGEROUS_MODULE_FUNCTIONS)
|
||||
case FUNC_RANGECHECK:
|
||||
case FUNC_BIND:
|
||||
// case FUNC_MODULE_OFF:
|
||||
#endif
|
||||
#if !defined(LUA)
|
||||
case FUNC_PLAY_SCRIPT:
|
||||
#endif
|
||||
case FUNC_RESERVE4:
|
||||
case FUNC_RESERVE5:
|
||||
return false;
|
||||
|
||||
@@ -318,19 +376,39 @@ bool isAssignableFunctionAvailable(int function)
|
||||
}
|
||||
}
|
||||
|
||||
bool isModuleAvailable(int module)
|
||||
bool isSourceAvailableInGlobalResetSpecialFunction(int index)
|
||||
{
|
||||
if (module == MODULE_TYPE_NONE)
|
||||
if (index >= FUNC_RESET_PARAM_FIRST_TELEM)
|
||||
return false;
|
||||
|
||||
#if !defined(PXX)
|
||||
if (module == MODULE_TYPE_XJT)
|
||||
return false;
|
||||
#endif
|
||||
|
||||
return true;
|
||||
else
|
||||
return isSourceAvailableInResetSpecialFunction(index);
|
||||
}
|
||||
|
||||
bool isSourceAvailableInResetSpecialFunction(int index)
|
||||
{
|
||||
if (index >= FUNC_RESET_PARAM_FIRST_TELEM) {
|
||||
TelemetrySensor & telemetrySensor = g_model.telemetrySensors[index-FUNC_RESET_PARAM_FIRST_TELEM];
|
||||
return telemetrySensor.isAvailable();
|
||||
}
|
||||
#if TIMERS < 3
|
||||
else if (index == FUNC_RESET_TIMER3) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
#if TIMERS < 2
|
||||
else if (index == FUNC_RESET_TIMER2) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool isModuleAvailable(int module)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool modelHasNotes()
|
||||
{
|
||||
@@ -339,3 +417,15 @@ bool modelHasNotes()
|
||||
strcpy(buf, TEXT_EXT);
|
||||
return isFileAvailable(filename);
|
||||
}
|
||||
|
||||
int getFirstAvailable(int min, int max, bool (*func)(int))
|
||||
{
|
||||
int retval = 0;
|
||||
for (int i = min; i <= max; i++) {
|
||||
if ((*func)(i)) {
|
||||
retval = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
+55
-34
@@ -59,11 +59,12 @@ void lcdColorsInit()
|
||||
lcdColorTable[WARNING_COLOR_INDEX] = YELLOW;
|
||||
lcdColorTable[TEXT_DISABLE_COLOR_INDEX] = RGB(0x60, 0x60, 0x60);
|
||||
lcdColorTable[CURVE_AXIS_COLOR_INDEX] = BLUE;
|
||||
lcdColorTable[CURVE_COLOR_INDEX] = BLACK;
|
||||
lcdColorTable[CURVE_CURSOR_COLOR_INDEX] = RED;
|
||||
lcdColorTable[TITLE_BGCOLOR_INDEX] = RED;
|
||||
lcdColorTable[HEADER_BGCOLOR_INDEX] = DARKRED;
|
||||
}
|
||||
|
||||
coord_t lcdLastPos;
|
||||
coord_t lcdNextPos;
|
||||
|
||||
#define FONT_CHARS_COUNT 103
|
||||
@@ -174,14 +175,16 @@ void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags
|
||||
const pm_uchar * font = fontsTable[fontindex];
|
||||
const uint16_t * fontspecs = fontspecsTable[fontindex];
|
||||
|
||||
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE) && (COLOR_IDX(flags) == TEXT_COLOR_INDEX)) {
|
||||
flags += TEXT_INVERTED_COLOR - TEXT_COLOR;
|
||||
if (FONTSIZE(flags) == TINSIZE)
|
||||
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN+2, y-INVERT_VERT_MARGIN+2, width+2*INVERT_HORZ_MARGIN-5, INVERT_LINE_HEIGHT-7, TEXT_INVERTED_BGCOLOR);
|
||||
else if (FONTSIZE(flags) == SMLSIZE)
|
||||
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN+1, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN-2, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
else
|
||||
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
if ((flags&INVERS) && ((~flags & BLINK) || BLINK_ON_PHASE)) {
|
||||
if (COLOR_IDX(flags) == TEXT_COLOR_INDEX) {
|
||||
flags += TEXT_INVERTED_COLOR - TEXT_COLOR;
|
||||
}
|
||||
if (FONTSIZE(flags) == TINSIZE)
|
||||
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN+2, y-INVERT_VERT_MARGIN+2, width+2*INVERT_HORZ_MARGIN-5, INVERT_LINE_HEIGHT-7, TEXT_INVERTED_BGCOLOR);
|
||||
else if (FONTSIZE(flags) == SMLSIZE)
|
||||
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN+1, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN-2, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
else
|
||||
lcdDrawFilledRect(x-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, width+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
|
||||
char str[256];
|
||||
@@ -224,7 +227,6 @@ void lcd_putsnAtt(coord_t x, coord_t y, const pm_char * s, uint8_t len, LcdFlags
|
||||
}
|
||||
s++;
|
||||
}
|
||||
lcdLastPos = x;
|
||||
lcdNextPos = x;
|
||||
}
|
||||
|
||||
@@ -245,7 +247,7 @@ void lcd_puts(coord_t x, coord_t y, const pm_char * s)
|
||||
|
||||
void lcd_putsLeft(coord_t y, const pm_char * s)
|
||||
{
|
||||
lcd_puts(MENU_TITLE_LEFT, y, s);
|
||||
lcd_puts(MENUS_MARGIN_LEFT, y, s);
|
||||
}
|
||||
|
||||
void lcd_putsCenter(coord_t y, const pm_char * s, LcdFlags attr)
|
||||
@@ -486,7 +488,7 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
lcd_putsiAtt(x, y, STR_VSRCRAW, 0, att); // TODO macro
|
||||
}
|
||||
else if (idx <= MIXSRC_LAST_INPUT) {
|
||||
char s[32] = "\307";
|
||||
char s[32] = "\323";
|
||||
if (ZEXIST(g_model.inputNames[idx-MIXSRC_FIRST_INPUT])) {
|
||||
zchar2str(s+1, g_model.inputNames[idx-MIXSRC_FIRST_INPUT], LEN_INPUT_NAME);
|
||||
s[1+LEN_INPUT_NAME] = '\0';
|
||||
@@ -537,8 +539,8 @@ void putsMixerSource(coord_t x, coord_t y, uint8_t idx, LcdFlags att)
|
||||
putsStrIdx(x, y, STR_CH, idx-MIXSRC_CH1+1, att);
|
||||
#if 0
|
||||
if (ZEXIST(g_model.limitData[idx-MIXSRC_CH1].name) && (att & STREXPANDED)) {
|
||||
lcd_putcAtt(lcdLastPos, y, ' ', att);
|
||||
lcd_putsnAtt(lcdLastPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att);
|
||||
lcd_putcAtt(lcdNextPos, y, ' ', att);
|
||||
lcd_putsnAtt(lcdNextPos+3, y, g_model.limitData[idx-MIXSRC_CH1].name, LEN_CHANNEL_NAME, ZCHAR|att);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -577,36 +579,55 @@ void putsModelName(coord_t x, coord_t y, char *name, uint8_t id, LcdFlags att)
|
||||
|
||||
void putsSwitches(coord_t x, coord_t y, int8_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);
|
||||
}
|
||||
|
||||
char s[8];
|
||||
int pos = 0;
|
||||
if (idx < 0) {
|
||||
s[pos++] = '!';
|
||||
idx = -idx;
|
||||
}
|
||||
|
||||
int absidx = abs(idx);
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
if (absidx >= SWSRC_FIRST_FLIGHT_MODE) {
|
||||
return putsStrIdx(x, y, STR_FP, absidx-SWSRC_FIRST_FLIGHT_MODE, att, idx < 0 ? "!" : "");
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (absidx >= SWSRC_FIRST_SWITCH && absidx <= SWSRC_LAST_SWITCH) {
|
||||
div_t swinfo = switchInfo(absidx);
|
||||
if (idx <= SWSRC_LAST_SWITCH) {
|
||||
div_t swinfo = switchInfo(idx);
|
||||
if (ZEXIST(g_eeGeneral.switchNames[swinfo.quot])) {
|
||||
pos = zchar2str(&s[pos], g_eeGeneral.switchNames[swinfo.quot], LEN_SWITCH_NAME);
|
||||
s[pos++] = "\300-\301"[swinfo.rem];
|
||||
s[pos] = '\0';
|
||||
lcd_putsAtt(x, y, s, att);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
s[pos++] = 'S';
|
||||
s[pos++] = 'A'+swinfo.quot;
|
||||
}
|
||||
s[pos++] = "\300-\301"[swinfo.rem];
|
||||
s[pos] = '\0';
|
||||
lcd_putsAtt(x, y, s, 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 if (idx <= SWSRC_LAST_FLIGHT_MODE) {
|
||||
putsStrIdx(x, y, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE, att);
|
||||
}
|
||||
else if (idx == SWSRC_TELEMETRY_STREAMING) {
|
||||
lcd_putsAtt(x, y, "Tele", att);
|
||||
}
|
||||
else {
|
||||
lcd_putsnAtt(x, y, g_model.telemetrySensors[idx-SWSRC_FIRST_SENSOR].label, TELEM_LABEL_LEN, ZCHAR|att);
|
||||
}
|
||||
|
||||
strAppend(&s[pos], STR_VSWITCHES+1+absidx*STR_VSWITCHES[0], STR_VSWITCHES[0]);
|
||||
lcd_putsAtt(x, y, s, att);
|
||||
}
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
@@ -627,12 +648,12 @@ void putsCurveRef(coord_t x, coord_t y, CurveRef &curve, LcdFlags att)
|
||||
switch (curve.type) {
|
||||
case CURVE_REF_DIFF:
|
||||
lcd_putsAtt(x, y, "D", att);
|
||||
GVAR_MENU_ITEM(x+8, y, curve.value, -100, 100, LEFT|att, 0, 0);
|
||||
GVAR_MENU_ITEM(lcdNextPos, y, curve.value, -100, 100, LEFT|att, 0, 0);
|
||||
break;
|
||||
|
||||
case CURVE_REF_EXPO:
|
||||
lcd_putsAtt(x, y, "E", att);
|
||||
GVAR_MENU_ITEM(x+8, y, curve.value, -100, 100, LEFT|att, 0, 0);
|
||||
GVAR_MENU_ITEM(lcdNextPos, y, curve.value, -100, 100, LEFT|att, 0, 0);
|
||||
break;
|
||||
|
||||
case CURVE_REF_FUNC:
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#define LCD_W 480
|
||||
#define LCD_H 272
|
||||
|
||||
#define BOX_WIDTH 61
|
||||
#define BOX_WIDTH 81
|
||||
#define coord_t int
|
||||
#define scoord_t int
|
||||
#define CENTER
|
||||
@@ -55,10 +55,10 @@
|
||||
#define LCD_COLS 30
|
||||
|
||||
#define BSS 0x00
|
||||
#define ERASE 0x00
|
||||
#define FORCE 0x00
|
||||
// #define ERASE 0x00
|
||||
// #define FORCE 0x00
|
||||
#define FIXEDWIDTH 0x00
|
||||
#define FILLWHITE 0x00
|
||||
// #define FILLWHITE 0x00
|
||||
#define BOLD 0x00
|
||||
|
||||
/* lcd common flags */
|
||||
@@ -128,6 +128,8 @@ enum LcdColorIndex
|
||||
WARNING_COLOR_INDEX,
|
||||
TEXT_DISABLE_COLOR_INDEX,
|
||||
CURVE_AXIS_COLOR_INDEX,
|
||||
CURVE_COLOR_INDEX,
|
||||
CURVE_CURSOR_COLOR_INDEX,
|
||||
HEADER_BGCOLOR_INDEX,
|
||||
TITLE_BGCOLOR_INDEX,
|
||||
LCD_COLOR_COUNT
|
||||
@@ -153,6 +155,8 @@ void lcdColorsInit();
|
||||
#define WARNING_COLOR COLOR(WARNING_COLOR_INDEX)
|
||||
#define TEXT_DISABLE_COLOR COLOR(TEXT_DISABLE_COLOR_INDEX)
|
||||
#define CURVE_AXIS_COLOR COLOR(CURVE_AXIS_COLOR_INDEX)
|
||||
#define CURVE_COLOR COLOR(CURVE_COLOR_INDEX)
|
||||
#define CURVE_CURSOR_COLOR COLOR(CURVE_CURSOR_COLOR_INDEX)
|
||||
#define TITLE_BGCOLOR COLOR(TITLE_BGCOLOR_INDEX)
|
||||
#define HEADER_BGCOLOR COLOR(HEADER_BGCOLOR_INDEX)
|
||||
|
||||
@@ -182,6 +186,8 @@ extern uint32_t CurrentFrameBuffer;
|
||||
#define DISPLAY_END (displayBuf + DISPLAY_BUF_SIZE)
|
||||
#define ASSERT_IN_DISPLAY(p) assert((p) >= displayBuf && (p) < DISPLAY_END)
|
||||
|
||||
extern coord_t lcdNextPos;
|
||||
|
||||
void lcdStartScreen();
|
||||
void lcd_putc(coord_t x, coord_t y, const unsigned char c);
|
||||
void lcd_putcAtt(coord_t x, coord_t y, const unsigned char c, LcdFlags attr=TEXT_COLOR);
|
||||
|
||||
@@ -99,14 +99,14 @@ void menuCommonCalib(evt_t event)
|
||||
case 0:
|
||||
// START CALIBRATION
|
||||
if (!READ_ONLY()) {
|
||||
lcd_putsCenter(MENU_HEADER_HEIGHT+FH, STR_MENUTOSTART);
|
||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUTOSTART);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// SET MIDPOINT
|
||||
lcd_putsCenter(MENU_HEADER_HEIGHT+FH, STR_SETMIDPOINT, INVERS);
|
||||
lcd_putsCenter(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
|
||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_SETMIDPOINT, INVERS);
|
||||
lcd_putsCenter(MENU_CONTENT_TOP+2*FH, STR_MENUWHENDONE);
|
||||
|
||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
reusableBuffer.calib.loVals[i] = 15000;
|
||||
@@ -122,8 +122,8 @@ void menuCommonCalib(evt_t event)
|
||||
case 2:
|
||||
// MOVE STICKS/POTS
|
||||
STICK_SCROLL_DISABLE();
|
||||
lcd_putsCenter(MENU_HEADER_HEIGHT+FH, STR_MOVESTICKSPOTS, INVERS);
|
||||
lcd_putsCenter(MENU_HEADER_HEIGHT+2*FH, STR_MENUWHENDONE);
|
||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MOVESTICKSPOTS, INVERS);
|
||||
lcd_putsCenter(MENU_CONTENT_TOP+2*FH, STR_MENUWHENDONE);
|
||||
|
||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
|
||||
@@ -196,6 +196,8 @@ void menuGeneralCalib(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabGeneral, e_Calib, 0, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
m_posVert = -1;
|
||||
|
||||
if (menuEvent) {
|
||||
calibrationState = 0;
|
||||
}
|
||||
|
||||
@@ -348,10 +348,10 @@ void menuGeneralSdManager(evt_t _event)
|
||||
if (!reusableBuffer.sdmanager.lines[i][SD_SCREEN_FILE_LENGTH+1]) {
|
||||
char s[SD_SCREEN_FILE_LENGTH+1+2];
|
||||
sprintf(s, "[%s]", reusableBuffer.sdmanager.lines[i]);
|
||||
lcd_putsAtt(MENU_TITLE_LEFT, y, s, attr);
|
||||
lcd_putsAtt(MENUS_MARGIN_LEFT, y, s, attr);
|
||||
}
|
||||
else {
|
||||
lcd_putsAtt(MENU_TITLE_LEFT, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
lcd_putsAtt(MENUS_MARGIN_LEFT, y, reusableBuffer.sdmanager.lines[i], attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,14 @@
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define RADIO_SETUP_2ND_COLUMN 220
|
||||
#define YEAR_SEPARATOR_OFFSET 42
|
||||
#define MONTH_OFFSET 55
|
||||
#define MONTH_SEPARATOR_OFFSET 79
|
||||
#define DAY_OFFSET 91
|
||||
#define HOUR_SEPARATOR_OFFSET 26
|
||||
#define MINUTE_OFFSET 36
|
||||
#define MINUTE_SEPARATOR_OFFSET 63
|
||||
#define SECOND_OFFSET 75
|
||||
|
||||
#define SLIDER_5POS(y, value, label, event, attr) { \
|
||||
int8_t tmp = value; \
|
||||
@@ -92,7 +100,6 @@ enum menuGeneralSetupItems {
|
||||
// CASE_MAVLINK(ITEM_MAVLINK_BAUD)
|
||||
ITEM_SETUP_SWITCHES_DELAY,
|
||||
ITEM_SETUP_RX_CHANNEL_ORD,
|
||||
ITEM_SETUP_STICK_MODE_LABELS,
|
||||
ITEM_SETUP_STICK_MODE,
|
||||
ITEM_SETUP_MAX
|
||||
};
|
||||
@@ -119,7 +126,7 @@ void menuGeneralSetup(evt_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, DEFAULT_SCROLLBAR_X, { 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0, CASE_VARIO_CPUARM(LABEL(VARIO)) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) LABEL(ALARMS), 0, 0, 0, CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, CASE_MAVLINK(0) 0, 0, LABEL(TX_MODE), 0, 1/*to force edit mode*/ });
|
||||
MENU(STR_MENURADIOSETUP, menuTabGeneral, e_Setup, ITEM_SETUP_MAX, DEFAULT_SCROLLBAR_X, { 2|NAVIGATION_LINE_BY_LINE, 2|NAVIGATION_LINE_BY_LINE, LABEL(SOUND), 0, 0, 0, 0, 0, 0, 0, CASE_VARIO_CPUARM(LABEL(VARIO)) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_VARIO_CPUARM(0) CASE_HAPTIC(LABEL(HAPTIC)) CASE_HAPTIC(0) CASE_HAPTIC(0) CASE_HAPTIC(0) LABEL(ALARMS), 0, 0, 0, CASE_GPS(0) CASE_GPS(0) CASE_PXX(0) 0, 0, CASE_MAVLINK(0) 0, 0, LABEL(TX_MODE), 1/*to force edit mode*/ });
|
||||
|
||||
int sub = m_posVert;
|
||||
|
||||
@@ -138,8 +145,8 @@ void menuGeneralSetup(evt_t event)
|
||||
flags |= INVERS;
|
||||
lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+28, y, "-", flags);
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+53, y, "-", flags);
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+YEAR_SEPARATOR_OFFSET, y, "-", flags);
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+MONTH_SEPARATOR_OFFSET, y, "-", flags);
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
switch (j) {
|
||||
@@ -148,7 +155,7 @@ void menuGeneralSetup(evt_t event)
|
||||
if (rowattr && s_editMode>0) t.tm_year = checkIncDec(event, t.tm_year, 112, 200, 0);
|
||||
break;
|
||||
case 1:
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+36, y, t.tm_mon+1, LEFT|flags|rowattr|LEADING0, 2);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+MONTH_OFFSET, y, t.tm_mon+1, LEFT|flags|rowattr|LEADING0, 2);
|
||||
if (rowattr && s_editMode>0) t.tm_mon = checkIncDec(event, t.tm_mon, 0, 11, 0);
|
||||
break;
|
||||
case 2:
|
||||
@@ -157,7 +164,7 @@ void menuGeneralSetup(evt_t event)
|
||||
int8_t dlim = (((((year%4==0) && (year%100!=0)) || (year%400==0)) && (t.tm_mon==1)) ? 1 : 0);
|
||||
static const pm_uint8_t dmon[] PROGMEM = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
dlim += pgm_read_byte(&dmon[t.tm_mon]);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+61, y, t.tm_mday, LEFT|flags|rowattr|LEADING0, 2);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+DAY_OFFSET, y, t.tm_mday, LEFT|flags|rowattr|LEADING0, 2);
|
||||
if (rowattr && s_editMode>0) t.tm_mday = checkIncDec(event, t.tm_mday, 1, dlim, 0);
|
||||
break;
|
||||
}
|
||||
@@ -177,8 +184,8 @@ void menuGeneralSetup(evt_t event)
|
||||
flags |= INVERS;
|
||||
lcdDrawFilledRect(RADIO_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 85, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+15, y, ":", flags);
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+35, y, ":", flags);
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+HOUR_SEPARATOR_OFFSET, y, ":", flags);
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN+MINUTE_SEPARATOR_OFFSET, y, ":", flags);
|
||||
for (uint8_t j=0; j<3; j++) {
|
||||
uint8_t rowattr = (m_posHorz==j ? attr : 0);
|
||||
switch (j) {
|
||||
@@ -187,11 +194,11 @@ void menuGeneralSetup(evt_t event)
|
||||
if (rowattr && s_editMode>0) t.tm_hour = checkIncDec(event, t.tm_hour, 0, 23, 0);
|
||||
break;
|
||||
case 1:
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+20, y, t.tm_min, flags|rowattr|LEFT|LEADING0, 2);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+MINUTE_OFFSET, y, t.tm_min, flags|rowattr|LEFT|LEADING0, 2);
|
||||
if (rowattr && s_editMode>0) t.tm_min = checkIncDec(event, t.tm_min, 0, 59, 0);
|
||||
break;
|
||||
case 2:
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+40, y, t.tm_sec, flags|rowattr|LEFT|LEADING0, 2);
|
||||
lcd_outdezNAtt(RADIO_SETUP_2ND_COLUMN+SECOND_OFFSET, y, t.tm_sec, flags|rowattr|LEFT|LEADING0, 2);
|
||||
if (rowattr && s_editMode>0) t.tm_sec = checkIncDec(event, t.tm_sec, 0, 59, 0);
|
||||
break;
|
||||
}
|
||||
@@ -489,20 +496,13 @@ void menuGeneralSetup(evt_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_SETUP_STICK_MODE_LABELS:
|
||||
lcd_putsLeft(y, NO_INDENT(STR_MODE));
|
||||
for (int i=0; i<4; i++) {
|
||||
// lcdDrawBitmap((6+4*i)*12, y, ...);
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_SETUP_STICK_MODE:
|
||||
{
|
||||
char s[2] = " ";
|
||||
s[0] = '1'+g_eeGeneral.stickMode;
|
||||
lcd_putsAtt(INDENT_WIDTH, y, s, attr);
|
||||
lcd_putsAtt(RADIO_SETUP_2ND_COLUMN, y, s, attr);
|
||||
for (uint8_t i=0; i<4; i++) {
|
||||
putsMixerSource((6+4*i)*12, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i));
|
||||
putsMixerSource(RADIO_SETUP_2ND_COLUMN + 40 + 50*i, y, MIXSRC_Rud + pgm_read_byte(modn12x3 + 4*g_eeGeneral.stickMode + i));
|
||||
}
|
||||
if (attr && s_editMode>0) {
|
||||
CHECK_INCDEC_GENVAR(event, g_eeGeneral.stickMode, 0, 3);
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define TRAINER_COLUMN_WIDTH 60
|
||||
#define TRAINER_COLUMN_1 MENU_TITLE_LEFT+80
|
||||
#define TRAINER_COLUMN_1 MENUS_MARGIN_LEFT+80
|
||||
#define TRAINER_COLUMN_2 TRAINER_COLUMN_1+TRAINER_COLUMN_WIDTH
|
||||
#define TRAINER_COLUMN_3 TRAINER_COLUMN_2+TRAINER_COLUMN_WIDTH
|
||||
|
||||
@@ -58,9 +58,10 @@ void menuGeneralTrainer(evt_t event)
|
||||
uint8_t attr;
|
||||
uint8_t blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
|
||||
lcd_putsAtt(TRAINER_COLUMN_1, MENU_HEADER_HEIGHT+1, "Mode", HEADER_COLOR);
|
||||
/* lcd_putsAtt(TRAINER_COLUMN_1, MENU_HEADER_HEIGHT+1, "Mode", HEADER_COLOR);
|
||||
lcd_putsAtt(TRAINER_COLUMN_2, MENU_HEADER_HEIGHT+1, "Weight", HEADER_COLOR);
|
||||
lcd_putsAtt(TRAINER_COLUMN_3, MENU_HEADER_HEIGHT+1, "Source", HEADER_COLOR);
|
||||
*/
|
||||
|
||||
y = MENU_CONTENT_TOP + FH;
|
||||
int sub = m_posVert + 1;
|
||||
@@ -69,7 +70,7 @@ void menuGeneralTrainer(evt_t event)
|
||||
uint8_t chan = channel_order(i);
|
||||
volatile TrainerMix *td = &g_eeGeneral.trainer.mix[chan-1];
|
||||
|
||||
putsMixerSource(MENU_TITLE_LEFT, y, MIXSRC_Rud-1+chan, ((sub==i && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||
putsMixerSource(MENUS_MARGIN_LEFT, y, MIXSRC_Rud-1+chan, ((sub==i && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||
|
||||
for (int j=0; j<3; j++) {
|
||||
|
||||
@@ -102,7 +103,7 @@ void menuGeneralTrainer(evt_t event)
|
||||
|
||||
attr = (sub==6) ? INVERS : 0;
|
||||
if (attr) s_editMode = 0;
|
||||
lcd_putsAtt(MENU_TITLE_LEFT, MENU_CONTENT_TOP + 6*FH, STR_CAL, attr);
|
||||
lcd_putsAtt(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 6*FH, STR_CAL, attr);
|
||||
for (int i=0; i<4; i++) {
|
||||
#if defined (PPM_UNIT_PERCENT_PREC1)
|
||||
lcd_outdezAtt(TRAINER_COLUMN_1+i*TRAINER_COLUMN_WIDTH, MENU_CONTENT_TOP + 6*FH, (ppmInput[i]-g_eeGeneral.trainer.calib[i])*2, LEFT|PREC1);
|
||||
|
||||
@@ -35,11 +35,6 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
// TODO elsewhere!
|
||||
#define WCHART 64
|
||||
#define X0 (LCD_W-WCHART-8)
|
||||
#define Y0 118
|
||||
|
||||
enum EnumTabModel {
|
||||
// e_ModelSelect,
|
||||
e_ModelSetup,
|
||||
@@ -80,11 +75,11 @@ extern uint8_t s_curveChan;
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t attr);
|
||||
|
||||
#define MIXES_2ND_COLUMN 80
|
||||
#define MIXES_2ND_COLUMN 100
|
||||
|
||||
uint8_t editDelay(const coord_t x, const coord_t y, const evt_t event, const uint8_t attr, const pm_char *str, uint8_t delay)
|
||||
{
|
||||
lcd_putsAtt(x+MENU_TITLE_LEFT, y, str, TEXT_COLOR);
|
||||
lcd_putsAtt(x+MENUS_MARGIN_LEFT, y, str, TEXT_COLOR);
|
||||
lcd_outdezAtt(x+MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);
|
||||
return delay;
|
||||
@@ -121,7 +116,7 @@ static int8_t s_copyTgtOfs;
|
||||
|
||||
static uint8_t editNameCursorPos = 0;
|
||||
|
||||
void editName(coord_t x, coord_t y, char *name, uint8_t size, evt_t event, uint8_t active)
|
||||
void editName(coord_t x, coord_t y, char * name, uint8_t size, evt_t event, uint8_t active)
|
||||
{
|
||||
uint8_t mode = 0;
|
||||
if (active && s_editMode <= 0) {
|
||||
@@ -184,7 +179,7 @@ void editName(coord_t x, coord_t y, char *name, uint8_t size, evt_t event, uint8
|
||||
lcd_putsnAtt(x, y, name, size, ZCHAR | mode);
|
||||
coord_t w = (editNameCursorPos == 0 ? 0 : getTextWidth(name, editNameCursorPos, ZCHAR));
|
||||
char s[] = { idx2char(v), '\0' };
|
||||
lcdDrawFilledRect(x+w, y-1, getTextWidth(s, 1)-1, 12, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawFilledRect(x+w, y-INVERT_VERT_MARGIN, getTextWidth(s, 1)-1, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
lcd_putsAtt(x+w, y, s, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -55,10 +55,10 @@ point_t getPoint(uint8_t i)
|
||||
bool custom = (crv.type == CURVE_TYPE_CUSTOM);
|
||||
uint8_t count = 5+crv.points;
|
||||
if (i < count) {
|
||||
result.x = X0-1-WCHART+i*WCHART*2/(count-1);
|
||||
result.y = Y0 - (points[i]) * (WCHART-1) / 100;
|
||||
result.x = CURVE_CENTER_X-1-CURVE_SIDE_WIDTH+i*CURVE_SIDE_WIDTH*2/(count-1);
|
||||
result.y = CURVE_CENTER_Y - (points[i]) * (CURVE_SIDE_WIDTH-1) / 100;
|
||||
if (custom && i>0 && i<count-1)
|
||||
result.x = X0-1-WCHART + (100 + (100 + points[count+i-1]) * (2*WCHART)) / 200;
|
||||
result.x = CURVE_CENTER_X-1-CURVE_SIDE_WIDTH + (100 + (100 + points[count+i-1]) * (2*CURVE_SIDE_WIDTH)) / 200;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -143,14 +143,14 @@ void menuModelCurveOne(evt_t event)
|
||||
|
||||
SIMPLE_SUBMENU(STR_MENUCURVE, 4 + 5+crv.points + (crv.type==CURVE_TYPE_CUSTOM ? 5+crv.points-2 : 0), 0);
|
||||
|
||||
lcd_outdezAtt(60, MENU_FOOTER_TOP, s_curveChan+1, LEFT);
|
||||
lcd_outdezAtt(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, s_curveChan+1, LEFT|HEADER_COLOR);
|
||||
|
||||
lcd_putsLeft(MENU_HEADER_HEIGHT+1, STR_NAME);
|
||||
editName(MENU_TITLE_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + FH, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==0);
|
||||
lcd_putsLeft(MENU_CONTENT_TOP, STR_NAME);
|
||||
editName(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + FH, g_model.curveNames[s_curveChan], sizeof(g_model.curveNames[s_curveChan]), event, m_posVert==0);
|
||||
|
||||
LcdFlags attr = (m_posVert==1 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcd_putsLeft(MENU_CONTENT_TOP + 2*FH, "Type");
|
||||
lcd_putsiAtt(MENU_TITLE_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 3*FH, STR_CURVE_TYPES, crv.type, attr);
|
||||
lcd_putsiAtt(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 3*FH, STR_CURVE_TYPES, crv.type, attr);
|
||||
if (attr) {
|
||||
uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST);
|
||||
if (newType != crv.type) {
|
||||
@@ -167,7 +167,7 @@ void menuModelCurveOne(evt_t event)
|
||||
|
||||
attr = (m_posVert==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcd_putsLeft(MENU_CONTENT_TOP + 4*FH, STR_COUNT);
|
||||
lcd_outdezAtt(MENU_TITLE_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 5*FH, 5+crv.points, LEFT|attr, STR_PTS);
|
||||
lcd_outdezAtt(MENUS_MARGIN_LEFT+INDENT_WIDTH, MENU_CONTENT_TOP + 5*FH, 5+crv.points, LEFT|attr, STR_PTS);
|
||||
if (attr) {
|
||||
int count = checkIncDecModel(event, crv.points, -3, 12); // 2pts - 17pts
|
||||
if (checkIncDec_Ret) {
|
||||
@@ -187,7 +187,7 @@ void menuModelCurveOne(evt_t event)
|
||||
}
|
||||
|
||||
lcd_putsLeft(MENU_CONTENT_TOP + 6*FH, STR_SMOOTH);
|
||||
lcdDrawCheckBox(70, MENU_CONTENT_TOP + 6*FH, crv.smooth, m_posVert==3 ? INVERS : 0);
|
||||
lcdDrawCheckBox(lcdNextPos + 10, MENU_CONTENT_TOP + 6*FH, crv.smooth, m_posVert==3 ? INVERS : 0);
|
||||
if (m_posVert==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
||||
|
||||
switch(event) {
|
||||
@@ -215,7 +215,7 @@ void menuModelCurveOne(evt_t event)
|
||||
lcd_putsAtt(115, MENU_FOOTER_TOP, "X", HEADER_COLOR);
|
||||
lcd_putsAtt(145, MENU_FOOTER_TOP, "Y", HEADER_COLOR);
|
||||
|
||||
coord_t posY = MENU_HEADER_HEIGHT+1;
|
||||
coord_t posY = MENU_CONTENT_TOP;
|
||||
attr = (s_editMode > 0 ? INVERS|BLINK : INVERS);
|
||||
for (int i=0; i<5+crv.points; i++) {
|
||||
point_t point = getPoint(i);
|
||||
@@ -233,9 +233,9 @@ void menuModelCurveOne(evt_t event)
|
||||
if (i>=pointsOfs && i<pointsOfs+NUM_BODY_LINES) {
|
||||
int8_t x = -100 + 200*i/(5+crv.points-1);
|
||||
if (crv.type==CURVE_TYPE_CUSTOM && i>0 && i<5+crv.points-1) x = points[5+crv.points+i-1];
|
||||
lcd_outdezAtt(100, posY, i+1, LEFT);
|
||||
lcd_outdezAtt(115, posY, x, LEFT|(selectionMode==1?attr:0));
|
||||
lcd_outdezAtt(145, posY, points[i], LEFT|(selectionMode==2?attr:0));
|
||||
lcd_outdezAtt(110, posY, i+1, LEFT);
|
||||
lcd_outdezAtt(130, posY, x, LEFT|(selectionMode==1?attr:0));
|
||||
lcd_outdezAtt(160, posY, points[i], LEFT|(selectionMode==2?attr:0));
|
||||
posY += FH;
|
||||
}
|
||||
|
||||
@@ -256,7 +256,7 @@ void menuModelCurveOne(evt_t event)
|
||||
}
|
||||
|
||||
if (5+crv.points > NUM_BODY_LINES) {
|
||||
displayScrollbar(167, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, pointsOfs, 5+crv.points, NUM_BODY_LINES);
|
||||
lcdDrawScrollbar(167, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, pointsOfs, 5+crv.points, NUM_BODY_LINES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,14 +270,14 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, evt_t event, uint8_t a
|
||||
switch (curve.type) {
|
||||
case CURVE_REF_DIFF:
|
||||
case CURVE_REF_EXPO:
|
||||
curve.value = GVAR_MENU_ITEM(x+40, y, curve.value, -100, 100, m_posHorz==1 ? LEFT|attr : LEFT, 0, event);
|
||||
curve.value = GVAR_MENU_ITEM(lcdNextPos+10, y, curve.value, -100, 100, m_posHorz==1 ? LEFT|attr : LEFT, 0, event);
|
||||
break;
|
||||
case CURVE_REF_FUNC:
|
||||
lcd_putsiAtt(x+40, y, STR_VCURVEFUNC, curve.value, (m_posHorz==1 ? attr : 0));
|
||||
lcd_putsiAtt(lcdNextPos+10, y, STR_VCURVEFUNC, curve.value, (m_posHorz==1 ? attr : 0));
|
||||
if (attr && m_posHorz==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
|
||||
break;
|
||||
case CURVE_REF_CUSTOM:
|
||||
putsCurve(x+40, y, curve.value, (m_posHorz==1 ? attr : 0));
|
||||
putsCurve(lcdNextPos+10, y, curve.value, (m_posHorz==1 ? attr : 0));
|
||||
if (attr && m_posHorz==1) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER) && curve.value!=0) {
|
||||
s_curveChan = (curve.value<0 ? -curve.value-1 : curve.value-1);
|
||||
@@ -311,7 +311,7 @@ void menuModelCurvesAll(evt_t event)
|
||||
uint8_t k = i + s_pgOfs;
|
||||
LcdFlags attr = (sub == k ? INVERS : 0);
|
||||
{
|
||||
putsStrIdx(MENU_TITLE_LEFT, y, STR_CV, k+1, attr);
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_CV, k+1, attr);
|
||||
editName(50, y, g_model.curveNames[k], sizeof(g_model.curveNames[k]), 0, 0);
|
||||
CurveInfo & crv = g_model.curves[k];
|
||||
lcd_outdezAtt(100, y, 5+crv.points, LEFT, STR_PTS);
|
||||
|
||||
@@ -37,10 +37,10 @@
|
||||
|
||||
#define MODEL_CUSTOM_FUNC_1ST_COLUMN 50
|
||||
#define MODEL_CUSTOM_FUNC_2ND_COLUMN 100
|
||||
#define MODEL_CUSTOM_FUNC_2ND_COLUMN_EXT 150
|
||||
#define MODEL_CUSTOM_FUNC_3RD_COLUMN 200
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN 286
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF 290
|
||||
#define MODEL_CUSTOM_FUNC_2ND_COLUMN_EXT 180
|
||||
#define MODEL_CUSTOM_FUNC_3RD_COLUMN 300
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN 440
|
||||
#define MODEL_CUSTOM_FUNC_4TH_COLUMN_ONOFF 450
|
||||
|
||||
void onCustomFunctionsFileSelectionMenu(const char *result)
|
||||
{
|
||||
@@ -141,7 +141,7 @@ void menuCustomFunctions(evt_t event, CustomFunctionData * functions, CustomFunc
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
unsigned int k = i+s_pgOfs;
|
||||
|
||||
putsStrIdx(MENU_TITLE_LEFT, y, functions == g_model.customFn ? STR_SF : STR_GF, k+1, (sub==k && m_posHorz<0) ? INVERS : 0);
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, functions == g_model.customFn ? STR_SF : STR_GF, k+1, (sub==k && m_posHorz<0) ? INVERS : 0);
|
||||
|
||||
CustomFunctionData *cfn = &functions[k];
|
||||
unsigned int func = CFN_FUNC(cfn);
|
||||
|
||||
@@ -53,6 +53,13 @@ bool isTrimModeAvailable(int mode)
|
||||
return (mode < 0 || (mode%2) == 0 || (mode/2) != m_posVert);
|
||||
}
|
||||
|
||||
#define FLIGHT_MODES_NAME_COLUMN 60
|
||||
#define FLIGHT_MODES_SWITCH_COLUMN 200
|
||||
#define FLIGHT_MODES_TRIMS_COLUMN 210
|
||||
#define FLIGHT_MODES_TRIM_WIDTH 25
|
||||
#define FLIGHT_MODES_FADEIN_COLUMN 400
|
||||
#define FLIGHT_MODES_FADEOUT_COLUMN 450
|
||||
|
||||
void menuModelFlightModesAll(evt_t event)
|
||||
{
|
||||
MENU(STR_MENUFLIGHTPHASES, menuTabModel, e_FlightModesAll, MAX_FLIGHT_MODES+1, DEFAULT_SCROLLBAR_X, { NAVIGATION_LINE_BY_LINE|(ITEM_FLIGHT_MODES_LAST-1), NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, NAVIGATION_LINE_BY_LINE|ITEM_FLIGHT_MODES_LAST, 0});
|
||||
@@ -101,21 +108,21 @@ void menuModelFlightModesAll(evt_t event)
|
||||
|
||||
FlightModeData *p = flightModeAddress(k);
|
||||
|
||||
putsFlightMode(MENU_TITLE_LEFT, y, k+1, (getFlightMode()==k ? 0/*BOLD*/ : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
|
||||
putsFlightMode(MENUS_MARGIN_LEFT, y, k+1, (getFlightMode()==k ? 0/*BOLD*/ : 0) | ((sub==k && m_posHorz<0) ? INVERS : 0));
|
||||
|
||||
for (int j=0; j<ITEM_FLIGHT_MODES_COUNT; j++) {
|
||||
LcdFlags attr = ((sub==k && posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
LcdFlags active = (attr && s_editMode>0) ;
|
||||
switch (j) {
|
||||
case ITEM_FLIGHT_MODES_NAME:
|
||||
editName(45, y, p->name, sizeof(p->name), event, attr);
|
||||
editName(FLIGHT_MODES_NAME_COLUMN, y, p->name, sizeof(p->name), event, attr);
|
||||
break;
|
||||
|
||||
case ITEM_FLIGHT_MODES_SWITCH:
|
||||
if (k == 0)
|
||||
lcd_puts(145, y, "N/A");
|
||||
lcd_puts(FLIGHT_MODES_SWITCH_COLUMN, y, "N/A");
|
||||
else
|
||||
putsSwitches(145, y, p->swtch, attr);
|
||||
putsSwitches(FLIGHT_MODES_SWITCH_COLUMN, y, p->swtch, attr);
|
||||
if (active) CHECK_INCDEC_MODELSWITCH(event, p->swtch, SWSRC_FIRST_IN_MIXES, SWSRC_LAST_IN_MIXES, isSwitchAvailableInMixes);
|
||||
break;
|
||||
|
||||
@@ -125,7 +132,7 @@ void menuModelFlightModesAll(evt_t event)
|
||||
case ITEM_FLIGHT_MODES_TRIM_AIL:
|
||||
{
|
||||
uint8_t t = j-ITEM_FLIGHT_MODES_TRIM_RUD;
|
||||
putsTrimMode(155+j*15, y, k, t, attr);
|
||||
putsTrimMode(FLIGHT_MODES_TRIMS_COLUMN+j*FLIGHT_MODES_TRIM_WIDTH, y, k, t, attr);
|
||||
if (active) {
|
||||
trim_t & v = p->trim[t];
|
||||
v.mode = checkIncDec(event, v.mode==TRIM_MODE_NONE ? -1 : v.mode, -1, k==0 ? 0 : 2*MAX_FLIGHT_MODES-1, EE_MODEL, isTrimModeAvailable);
|
||||
@@ -134,12 +141,12 @@ void menuModelFlightModesAll(evt_t event)
|
||||
}
|
||||
|
||||
case ITEM_FLIGHT_MODES_FADE_IN:
|
||||
lcd_outdezAtt(272, y, (10/DELAY_STEP)*p->fadeIn, attr|PREC1);
|
||||
lcd_outdezAtt(FLIGHT_MODES_FADEIN_COLUMN, y, (10/DELAY_STEP)*p->fadeIn, attr|PREC1);
|
||||
if (active) p->fadeIn = checkIncDec(event, p->fadeIn, 0, DELAY_MAX, EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
|
||||
case ITEM_FLIGHT_MODES_FADE_OUT:
|
||||
lcd_outdezAtt(300, y, (10/DELAY_STEP)*p->fadeOut, attr|PREC1);
|
||||
lcd_outdezAtt(FLIGHT_MODES_FADEOUT_COLUMN, y, (10/DELAY_STEP)*p->fadeOut, attr|PREC1);
|
||||
if (active) p->fadeOut = checkIncDec(event, p->fadeOut, 0, DELAY_MAX, EE_MODEL|NO_INCDEC_MARKS);
|
||||
break;
|
||||
|
||||
|
||||
@@ -66,8 +66,8 @@ void menuModelGVars(evt_t event)
|
||||
for (int l=0; l<NUM_BODY_LINES; l++) {
|
||||
int i = l+s_pgOfs;
|
||||
coord_t y = MENU_CONTENT_TOP + l*FH;
|
||||
if (g_model.gvars[i].popup) lcd_puts(MENU_TITLE_LEFT+25, y, "!");
|
||||
putsStrIdx(MENU_TITLE_LEFT, y, STR_GV, i+1, ((sub==i && m_posHorz<0) ? INVERS : 0));
|
||||
if (g_model.gvars[i].popup) lcd_puts(MENUS_MARGIN_LEFT+25, y, "!");
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_GV, i+1, ((sub==i && m_posHorz<0) ? INVERS : 0));
|
||||
|
||||
for (int j=0; j<1+MAX_FLIGHT_MODES; j++) {
|
||||
LcdFlags attr = ((sub==i && m_posHorz==j) ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
@@ -75,7 +75,7 @@ void menuModelGVars(evt_t event)
|
||||
switch(j)
|
||||
{
|
||||
case 0:
|
||||
editName(MENU_TITLE_LEFT+30, y, g_model.gvars[i].name, LEN_GVAR_NAME, event, attr);
|
||||
editName(MENUS_MARGIN_LEFT+30, y, g_model.gvars[i].name, LEN_GVAR_NAME, event, attr);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -79,7 +79,7 @@ void menuModelHeli(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_HELI_ELE_WEIGHT:
|
||||
lcd_puts(MENU_TITLE_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_puts(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.elevatorWeight, -100, 100);
|
||||
break;
|
||||
@@ -91,7 +91,7 @@ void menuModelHeli(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_HELI_AIL_WEIGHT:
|
||||
lcd_puts(MENU_TITLE_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_puts(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.aileronWeight, -100, 100);
|
||||
break;
|
||||
@@ -103,7 +103,7 @@ void menuModelHeli(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_HELI_COL_WEIGHT:
|
||||
lcd_puts(MENU_TITLE_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_puts(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcd_outdezAtt(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.collectiveWeight, -100, 100);
|
||||
break;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
#define EXPO_ONE_2ND_COLUMN 80
|
||||
#define EXPO_ONE_2ND_COLUMN 110
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t attr)
|
||||
@@ -47,7 +47,7 @@ void displayFlightModes(coord_t x, coord_t y, FlightModesType value, uint8_t att
|
||||
char s[] = " ";
|
||||
s[0] = '0' + i;
|
||||
lcd_putsAtt(x, y, s, flags);
|
||||
x += 9;
|
||||
x += 12;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -81,25 +81,38 @@ int expoFn(int x)
|
||||
return anas[ed->chn];
|
||||
}
|
||||
|
||||
int divRound(int num, int den)
|
||||
{
|
||||
if (num < 0)
|
||||
return (num - den/2) / den;
|
||||
else
|
||||
return (num + den/2) / den;
|
||||
}
|
||||
|
||||
coord_t getYCoord(FnFuncP fn, coord_t x)
|
||||
{
|
||||
return limit(0, Y0 - (fn(x * (RESX/WCHART)) * WCHART / RESX), LCD_H-1);
|
||||
return limit(0, CURVE_CENTER_Y - divRound(fn(divRound(x * RESX, CURVE_SIDE_WIDTH)) * CURVE_SIDE_WIDTH, RESX), LCD_H-1);
|
||||
}
|
||||
|
||||
void DrawFunction(FnFuncP fn, int offset)
|
||||
{
|
||||
lcd_vlineStip(X0-offset, Y0-WCHART, WCHART*2, 0xee, CURVE_AXIS_COLOR);
|
||||
lcd_hlineStip(X0-WCHART-offset, Y0, WCHART*2, 0xee, CURVE_AXIS_COLOR);
|
||||
lcd_vlineStip(CURVE_CENTER_X-offset, CURVE_CENTER_Y-CURVE_SIDE_WIDTH, CURVE_SIDE_WIDTH*2, 0xee, CURVE_AXIS_COLOR);
|
||||
lcd_hlineStip(CURVE_CENTER_X-CURVE_SIDE_WIDTH-offset, CURVE_CENTER_Y, CURVE_SIDE_WIDTH*2, 0xee, CURVE_AXIS_COLOR);
|
||||
|
||||
coord_t ymin=0, ymax=0, info=0;
|
||||
for (int xv=-WCHART; xv<=WCHART; xv++) {
|
||||
coord_t prev_yv = (coord_t)-1;
|
||||
|
||||
for (int xv=-CURVE_SIDE_WIDTH; xv<=CURVE_SIDE_WIDTH; xv++) {
|
||||
coord_t yv = getYCoord(fn, xv);
|
||||
|
||||
if (ymin == 0 || yv < ymin)
|
||||
ymin = yv;
|
||||
if (ymax == 0 || yv > ymax)
|
||||
ymax = yv;
|
||||
info += yv*xv;
|
||||
if (prev_yv != (coord_t)-1) {
|
||||
if (abs((int8_t)yv-prev_yv) <= 1) {
|
||||
lcdDrawPoint(CURVE_CENTER_X+xv-offset-1, prev_yv, CURVE_COLOR);
|
||||
}
|
||||
else {
|
||||
uint8_t tmp = (prev_yv < yv ? 0 : 1);
|
||||
lcdDrawVerticalLine(CURVE_CENTER_X+xv-offset-1, yv+tmp, prev_yv-yv, CURVE_COLOR);
|
||||
}
|
||||
}
|
||||
prev_yv = yv;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +344,7 @@ void menuModelExpoOne(evt_t event)
|
||||
|
||||
SUBMENU(STR_MENUINPUTS, EXPO_FIELD_MAX, EXPO_ONE_2ND_COLUMN+85, { 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 /*, ...*/});
|
||||
|
||||
putsMixerSource(60, MENU_FOOTER_TOP, MIXSRC_FIRST_INPUT+ed->chn, HEADER_COLOR);
|
||||
putsMixerSource(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, MIXSRC_FIRST_INPUT+ed->chn, HEADER_COLOR);
|
||||
|
||||
int8_t sub = m_posVert;
|
||||
|
||||
@@ -346,18 +359,18 @@ void menuModelExpoOne(evt_t event)
|
||||
if (ed->scale > 0) x = (x * 1024) / convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale);
|
||||
}
|
||||
else {
|
||||
lcd_outdezAtt(X0+WCHART, MENU_HEADER_HEIGHT+6*FH, calcRESXto1000(x), PREC1);
|
||||
lcd_outdezAtt(CURVE_CENTER_X+CURVE_SIDE_WIDTH, CURVE_CENTER_Y+CURVE_SIDE_WIDTH-FH+6, calcRESXto1000(x), PREC1);
|
||||
}
|
||||
|
||||
x = limit(-1024, x, 1024);
|
||||
int y = limit<int>(-1024, expoFn(x), 1024);
|
||||
lcd_outdezAtt(X0-WCHART, MENU_HEADER_HEIGHT+1, calcRESXto1000(y), LEFT|PREC1);
|
||||
lcd_outdezAtt(CURVE_CENTER_X-CURVE_SIDE_WIDTH, CURVE_CENTER_Y-CURVE_SIDE_WIDTH, calcRESXto1000(y), LEFT|PREC1);
|
||||
|
||||
x = x / (RESX/WCHART);
|
||||
x = divRound(x*CURVE_SIDE_WIDTH, RESX);
|
||||
y = getYCoord(expoFn, x);
|
||||
|
||||
lcd_vlineStip(X0+x, y-3, 7, SOLID, TEXT_INVERTED_BGCOLOR);
|
||||
lcd_hlineStip(X0+x-3, y, 7, SOLID, TEXT_INVERTED_BGCOLOR);
|
||||
lcd_vlineStip(CURVE_CENTER_X+x, y-3, 7, SOLID, CURVE_CURSOR_COLOR);
|
||||
lcd_hlineStip(CURVE_CENTER_X+x-3, y, 7, SOLID, CURVE_CURSOR_COLOR);
|
||||
}
|
||||
|
||||
for (unsigned int k=0; k<NUM_BODY_LINES; k++) {
|
||||
@@ -480,9 +493,10 @@ void drawOffsetBar(uint8_t x, uint8_t y, MixData * md)
|
||||
lcd_vline(x-2, y+1, GAUGE_HEIGHT-1);
|
||||
lcd_vline(x+GAUGE_WIDTH-1, y+1, GAUGE_HEIGHT-1);
|
||||
if (barMin <= barMax) {
|
||||
int8_t right = (barMax * GAUGE_WIDTH) / 200;
|
||||
int8_t left = ((barMin * GAUGE_WIDTH) / 200)-1;
|
||||
// TODO lcdDrawFilledRect(x+GAUGE_WIDTH/2+left, y+2, right-left, GAUGE_HEIGHT-3);
|
||||
// TODO
|
||||
// int8_t right = (barMax * GAUGE_WIDTH) / 200;
|
||||
// int8_t left = ((barMin * GAUGE_WIDTH) / 200)-1;
|
||||
// lcdDrawFilledRect(x+GAUGE_WIDTH/2+left, y+2, right-left, GAUGE_HEIGHT-3);
|
||||
}
|
||||
lcd_vline(x+GAUGE_WIDTH/2-1, y, GAUGE_HEIGHT+1);
|
||||
#if 0 // TODO
|
||||
@@ -509,7 +523,7 @@ void menuModelMixOne(evt_t event)
|
||||
|
||||
SUBMENU(s_currCh ? STR_INSERTMIX : STR_EDITMIX, MIX_FIELD_COUNT, 0, { 0, 0, 0, 0, 0, CASE_CURVES(1) CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/ });
|
||||
|
||||
putsChn(80, MENU_FOOTER_TOP, md2->destCh+1, HEADER_COLOR);
|
||||
putsChn(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, md2->destCh+1, HEADER_COLOR);
|
||||
|
||||
// The separation line between 2 columns
|
||||
lcd_vlineStip(MENU_COLUMN2_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, SOLID, HEADER_COLOR);
|
||||
@@ -612,28 +626,29 @@ static uint8_t s_copySrcCh;
|
||||
#define _STR_MAX(x) PSTR("/" #x)
|
||||
#define STR_MAX(x) _STR_MAX(x)
|
||||
|
||||
#define EXPO_LINE_WEIGHT_POS 89
|
||||
#define EXPO_LINE_SRC_POS 102
|
||||
#define EXPO_LINE_FM_POS 138
|
||||
#define EXPO_LINE_CURVE_POS 138
|
||||
#define EXPO_LINE_SWITCH_POS 182
|
||||
#define EXPO_LINE_SIDE_POS 215
|
||||
#define EXPO_LINE_SELECT_POS 61
|
||||
#define EXPO_LINE_SELECT_WIDTH 244
|
||||
#define EXPO_LINE_NAME_POS 238
|
||||
#define EXPO_LINE_WEIGHT_POS 92
|
||||
#define EXPO_LINE_SRC_POS 115
|
||||
#define EXPO_LINE_CURVE_POS 162
|
||||
#define EXPO_LINE_SWITCH_POS 210
|
||||
#define EXPO_LINE_SIDE_POS 250
|
||||
#define EXPO_LINE_FM_POS 270
|
||||
#define EXPO_LINE_NAME_POS 380
|
||||
#define EXPO_LINE_SELECT_POS 50
|
||||
#define EXPO_LINE_SELECT_WIDTH (LCD_W-EXPO_LINE_SELECT_POS-5)
|
||||
|
||||
#define MIX_LINE_WEIGHT_POS 69
|
||||
#define MIX_LINE_SRC_POS 83
|
||||
#define MIX_LINE_FM_POS 142
|
||||
#define MIX_LINE_CURVE_POS 142
|
||||
#define MIX_LINE_SWITCH_POS 190
|
||||
#define MIX_LINE_DELAY_POS 225
|
||||
#define MIX_LINE_SELECT_POS 40
|
||||
#define MIX_LINE_SELECT_WIDTH 265
|
||||
#define MIX_LINE_WEIGHT_POS 92
|
||||
#define MIX_LINE_SRC_POS 115
|
||||
#define MIX_LINE_CURVE_POS 162
|
||||
#define MIX_LINE_SWITCH_POS 210
|
||||
#define MIX_LINE_DELAY_POS 255
|
||||
#define MIX_LINE_FM_POS 270
|
||||
#define MIX_LINE_NAME_POS 380
|
||||
#define MIX_LINE_SELECT_POS 50
|
||||
#define MIX_LINE_SELECT_WIDTH (LCD_W-EXPO_LINE_SELECT_POS-5)
|
||||
|
||||
void lineSurround(bool expo, coord_t y, LcdFlags flags=CURVE_AXIS_COLOR)
|
||||
{
|
||||
lcd_rect(expo ? EXPO_LINE_SELECT_POS : MIX_LINE_SELECT_POS, y-INVERT_VERT_MARGIN, expo ? EXPO_LINE_SELECT_WIDTH : MIX_LINE_SELECT_WIDTH, INVERT_LINE_HEIGHT, WARNING_COLOR|(s_copyMode == COPY_MODE ? SOLID : DOTTED), flags);
|
||||
lcd_rect(expo ? EXPO_LINE_SELECT_POS : MIX_LINE_SELECT_POS, y-INVERT_VERT_MARGIN, expo ? EXPO_LINE_SELECT_WIDTH : MIX_LINE_SELECT_WIDTH, INVERT_LINE_HEIGHT, (s_copyMode == COPY_MODE ? SOLID : DOTTED), flags);
|
||||
}
|
||||
|
||||
void onExpoMixMenu(const char *result)
|
||||
@@ -684,10 +699,8 @@ void displayMixLine(coord_t y, MixData *md)
|
||||
{
|
||||
if (md->name[0])
|
||||
lcd_putsnAtt(EXPO_LINE_NAME_POS, y, md->name, sizeof(md->name), ZCHAR);
|
||||
if (!md->flightModes || ((md->curve.value || md->swtch) && ((get_tmr10ms() / 200) & 1)))
|
||||
displayMixInfos(y, md);
|
||||
else
|
||||
displayFlightModes(MIX_LINE_FM_POS, y, md->flightModes, 0);
|
||||
displayMixInfos(y, md);
|
||||
displayFlightModes(MIX_LINE_FM_POS, y, md->flightModes, 0);
|
||||
}
|
||||
|
||||
void displayExpoInfos(coord_t y, ExpoData *ed)
|
||||
@@ -705,10 +718,8 @@ void displayExpoLine(coord_t y, ExpoData *ed)
|
||||
{
|
||||
putsMixerSource(EXPO_LINE_SRC_POS, y, ed->srcRaw);
|
||||
|
||||
if (!ed->flightModes || ((ed->curve.value || ed->swtch) && ((get_tmr10ms() / 200) & 1)))
|
||||
displayExpoInfos(y, ed);
|
||||
else
|
||||
displayFlightModes(EXPO_LINE_FM_POS, y, ed->flightModes, 0);
|
||||
displayExpoInfos(y, ed);
|
||||
displayFlightModes(EXPO_LINE_FM_POS, y, ed->flightModes, 0);
|
||||
|
||||
if (ed->name[0]) {
|
||||
lcd_putsnAtt(EXPO_LINE_NAME_POS, y, ed->name, sizeof(ed->name), ZCHAR);
|
||||
@@ -724,6 +735,9 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
|
||||
uint8_t chn = (expo ? expoAddress(s_currIdx)->chn+1 : mixAddress(s_currIdx)->destCh+1);
|
||||
|
||||
int linesCount = getLinesCount(expo);
|
||||
SIMPLE_MENU(expo ? STR_MENUINPUTS : STR_MIXER, menuTabModel, expo ? e_InputsAll : e_MixAll, linesCount, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
@@ -847,12 +861,9 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
int linesCount = getLinesCount(expo);
|
||||
SIMPLE_MENU(expo ? STR_MENUINPUTS : STR_MIXER, menuTabModel, expo ? e_InputsAll : e_MixAll, linesCount, DEFAULT_SCROLLBAR_X);
|
||||
|
||||
char str[6];
|
||||
sprintf(str, "%d/%d", getExpoMixCount(expo), expo ? MAX_EXPOS : MAX_MIXERS);
|
||||
lcd_putsAtt(60, MENU_FOOTER_TOP, str, HEADER_COLOR);
|
||||
lcd_putsAtt(MENU_TITLE_NEXT_POS, MENU_TITLE_TOP+2, str, HEADER_COLOR);
|
||||
|
||||
sub = m_posVert;
|
||||
s_currCh = 0;
|
||||
@@ -865,10 +876,10 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
if (expo ? (i<MAX_EXPOS && (ed=expoAddress(i))->chn+1 == ch && EXPO_VALID(ed)) : (i<MAX_MIXERS && (md=mixAddress(i))->srcRaw && md->destCh+1 == ch)) {
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(MENU_TITLE_LEFT, y, ch);
|
||||
putsMixerSource(MENUS_MARGIN_LEFT, y, ch);
|
||||
}
|
||||
else {
|
||||
putsChn(MENU_TITLE_LEFT, y, ch, 0); // show CHx
|
||||
putsChn(MENUS_MARGIN_LEFT, y, ch, 0); // show CHx
|
||||
}
|
||||
}
|
||||
uint8_t mixCnt = 0;
|
||||
@@ -889,7 +900,7 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
LcdFlags attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
|
||||
if (expo) {
|
||||
ed->weight = GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, 0);
|
||||
GVAR_MENU_ITEM(EXPO_LINE_WEIGHT_POS, y, ed->weight, MIN_EXPO_WEIGHT, 100, attr | (isExpoActive(i) ? BOLD : 0), 0, 0);
|
||||
displayExpoLine(y, ed);
|
||||
}
|
||||
else {
|
||||
@@ -919,7 +930,7 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
}
|
||||
if (cur == sub) {
|
||||
/* invert the raw when it's the current one */
|
||||
lineSurround(expo, y, WARNING_COLOR);
|
||||
lineSurround(expo, y, ALARM_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -941,10 +952,10 @@ void menuModelExpoMix(uint8_t expo, evt_t event)
|
||||
}
|
||||
if (cur-s_pgOfs >= 0 && cur-s_pgOfs < NUM_BODY_LINES) {
|
||||
if (expo) {
|
||||
putsMixerSource(MENU_TITLE_LEFT, y, ch, attr);
|
||||
putsMixerSource(MENUS_MARGIN_LEFT, y, ch, attr);
|
||||
}
|
||||
else {
|
||||
putsChn(MENU_TITLE_LEFT, y, ch, attr); // show CHx
|
||||
putsChn(MENUS_MARGIN_LEFT, y, ch, attr); // show CHx
|
||||
if (attr) {
|
||||
displayHeaderChannelName(ch);
|
||||
}
|
||||
|
||||
@@ -65,15 +65,15 @@ enum LimitsItems {
|
||||
};
|
||||
|
||||
#if defined(PPM_CENTER_ADJUSTABLE)
|
||||
#define LIMITS_NAME_POS 44
|
||||
#define LIMITS_OFFSET_POS 136
|
||||
#define LIMITS_MIN_POS 175
|
||||
#define LIMITS_DIRECTION_POS 177
|
||||
#define LIMITS_MAX_POS 214
|
||||
#define LIMITS_REVERT_POS 218
|
||||
#define LIMITS_CURVE_POS 232
|
||||
#define LIMITS_PPM_CENTER_POS 292
|
||||
#define LIMITS_SYMETRICAL_POS 298
|
||||
#define LIMITS_NAME_POS 52
|
||||
#define LIMITS_OFFSET_POS 160
|
||||
#define LIMITS_MIN_POS 220
|
||||
#define LIMITS_DIRECTION_POS 240
|
||||
#define LIMITS_MAX_POS 300
|
||||
#define LIMITS_REVERT_POS 320
|
||||
#define LIMITS_CURVE_POS 360
|
||||
#define LIMITS_PPM_CENTER_POS 450
|
||||
#define LIMITS_SYMETRICAL_POS 460
|
||||
#else
|
||||
#define LIMITS_NAME_POS 44
|
||||
#define LIMITS_OFFSET_POS 136
|
||||
@@ -177,7 +177,7 @@ void menuModelLimits(evt_t event)
|
||||
|
||||
int limit = (g_model.extendedLimits ? LIMIT_EXT_MAX : 1000);
|
||||
|
||||
putsChn(MENU_TITLE_LEFT, y, k+1, (sub==k && m_posHorz < 0) ? INVERS : 0);
|
||||
putsChn(MENUS_MARGIN_LEFT, y, k+1, (sub==k && m_posHorz < 0) ? INVERS : 0);
|
||||
if (sub==k && m_posHorz < 0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(event);
|
||||
MENU_ADD_ITEM(STR_RESET);
|
||||
|
||||
@@ -47,12 +47,12 @@ enum LogicalSwitchFields {
|
||||
LS_FIELD_LAST = LS_FIELD_COUNT-1
|
||||
};
|
||||
|
||||
#define CSW_1ST_COLUMN 40
|
||||
#define CSW_2ND_COLUMN 85
|
||||
#define CSW_3RD_COLUMN 130
|
||||
#define CSW_4TH_COLUMN 185
|
||||
#define CSW_5TH_COLUMN 225
|
||||
#define CSW_6TH_COLUMN 270
|
||||
#define CSW_1ST_COLUMN 42
|
||||
#define CSW_2ND_COLUMN 90
|
||||
#define CSW_3RD_COLUMN 140
|
||||
#define CSW_4TH_COLUMN 200
|
||||
#define CSW_5TH_COLUMN 245
|
||||
#define CSW_6TH_COLUMN 300
|
||||
|
||||
#define INCDEC_DECLARE_VARS(f) uint8_t incdecFlag = (f); IsValueAvailable isValueAvailable = NULL
|
||||
#define INCDEC_SET_FLAG(f) incdecFlag = (f)
|
||||
@@ -131,7 +131,7 @@ void menuModelLogicalSwitches(evt_t event)
|
||||
|
||||
// CSW name
|
||||
unsigned int sw = SWSRC_SW1+k;
|
||||
putsSwitches(MENU_TITLE_LEFT, y, sw, (getSwitch(sw) ? 0/*BOLD*/ : 0) | ((sub==k && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||
putsSwitches(MENUS_MARGIN_LEFT, y, sw, (getSwitch(sw) ? 0/*BOLD*/ : 0) | ((sub==k && CURSOR_ON_LINE()) ? INVERS : 0));
|
||||
|
||||
// CSW func
|
||||
lcd_putsiAtt(CSW_1ST_COLUMN, y, STR_VCSWFUNC, cs->func, horz==0 ? attr : 0);
|
||||
|
||||
@@ -248,18 +248,18 @@ void menuModelSelect(evt_t event)
|
||||
LcdFlags flags = 0;
|
||||
if (sub==k && s_copyMode == 0) {
|
||||
flags |= TEXT_INVERTED_COLOR;
|
||||
lcdDrawFilledRect(MENU_TITLE_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawFilledRect(MENUS_MARGIN_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
|
||||
char str[20];
|
||||
strAppendDigits(str, k+1);
|
||||
lcd_putsAtt(MENU_TITLE_LEFT, y, str, flags);
|
||||
lcd_putsAtt(MENUS_MARGIN_LEFT, y, str, flags);
|
||||
|
||||
if (s_copyMode == MOVE_MODE || (s_copyMode == COPY_MODE && s_copySrcRow >= 0)) {
|
||||
if (k == sub) {
|
||||
if (s_copyMode == COPY_MODE) {
|
||||
k = s_copySrcRow;
|
||||
// lcd_rect(MENU_TITLE_LEFT-5, y-3, 170, 16, SOLID, YELLOW);
|
||||
// lcd_rect(MENUS_MARGIN_LEFT-5, y-3, 170, 16, SOLID, YELLOW);
|
||||
}
|
||||
else {
|
||||
k = sub + s_copyTgtOfs;
|
||||
@@ -285,7 +285,7 @@ void menuModelSelect(evt_t event)
|
||||
}
|
||||
|
||||
if (s_copyMode && (vertpos_t)sub==i+s_pgOfs) {
|
||||
lcd_rect(MENU_TITLE_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, s_copyMode == COPY_MODE ? SOLID : DOTTED, WARNING_COLOR);
|
||||
lcd_rect(MENUS_MARGIN_LEFT-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 150, INVERT_LINE_HEIGHT, s_copyMode == COPY_MODE ? SOLID : DOTTED, WARNING_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ void editTimerMode(int timerIdx, coord_t y, LcdFlags attr, evt_t event)
|
||||
if (attr && m_posHorz < 0) {
|
||||
lcdDrawFilledRect(MODEL_SETUP_2ND_COLUMN-INVERT_HORZ_MARGIN, y-INVERT_VERT_MARGIN, 80+2*INVERT_HORZ_MARGIN, INVERT_LINE_HEIGHT, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
putsStrIdx(MENU_TITLE_LEFT, y, STR_TIMER, timerIdx+1);
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_TIMER, timerIdx+1);
|
||||
putsTimerMode(MODEL_SETUP_2ND_COLUMN, y, timer->mode, (m_posHorz<=0 ? attr : 0));
|
||||
putsTimer(MODEL_SETUP_2ND_COLUMN+50, y, timer->start, (m_posHorz!=0 ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
|
||||
@@ -214,7 +214,7 @@ void menuModelSensor(evt_t event)
|
||||
|
||||
SUBMENU(STR_MENUSENSOR, SENSOR_FIELD_MAX, DEFAULT_SCROLLBAR_X, { 0, 0, sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, SENSOR_UNIT_ROWS, SENSOR_PREC_ROWS, SENSOR_PARAM1_ROWS, SENSOR_PARAM2_ROWS, SENSOR_PARAM3_ROWS, SENSOR_PARAM4_ROWS, 0 });
|
||||
|
||||
lcd_outdezAtt(MENU_TITLE_LEFT+getTextWidth(TR_MENUSENSOR)+5, MENU_FOOTER_TOP, s_currIdx+1, HEADER_COLOR|LEFT);
|
||||
lcd_outdezAtt(MENUS_MARGIN_LEFT+getTextWidth(TR_MENUSENSOR)+5, MENU_FOOTER_TOP, s_currIdx+1, HEADER_COLOR|LEFT);
|
||||
putsTelemetryChannelValue(SENSOR_2ND_COLUMN, MENU_FOOTER_TOP, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx), HEADER_COLOR|LEFT);
|
||||
|
||||
int sub = m_posVert;
|
||||
@@ -371,7 +371,7 @@ void menuModelSensor(evt_t event)
|
||||
|
||||
case SENSOR_FIELD_PARAM4:
|
||||
{
|
||||
putsStrIdx(MENU_TITLE_LEFT, y, NO_INDENT(STR_SOURCE), k-SENSOR_FIELD_PARAM1+1);
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, NO_INDENT(STR_SOURCE), k-SENSOR_FIELD_PARAM1+1);
|
||||
int8_t & source = sensor->calc.sources[k-SENSOR_FIELD_PARAM1];
|
||||
if (attr) {
|
||||
source = checkIncDec(event, source, -MAX_SENSORS, MAX_SENSORS, EE_MODEL|NO_INCDEC_MARKS, isSensorAvailable);
|
||||
@@ -461,7 +461,7 @@ void menuModelTelemetry(evt_t event)
|
||||
|
||||
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_SENSORS) {
|
||||
int index = k-ITEM_TELEMETRY_SENSOR1;
|
||||
lcd_outdezAtt(MENU_TITLE_LEFT+INDENT_WIDTH, y, index+1, LEFT|attr, ":");
|
||||
lcd_outdezAtt(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, index+1, LEFT|attr, ":");
|
||||
lcd_putsnAtt(60, y, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
|
||||
if (telemetryItems[index].isFresh()) {
|
||||
lcd_puts(100, y, "*");
|
||||
@@ -500,7 +500,7 @@ void menuModelTelemetry(evt_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_NEWSENSOR:
|
||||
lcd_putsAtt(MENU_TITLE_LEFT+INDENT_WIDTH, y, NO_INDENT(STR_TELEMETRY_NEWSENSOR), attr);
|
||||
lcd_putsAtt(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, NO_INDENT(STR_TELEMETRY_NEWSENSOR), attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
int res = availableTelemetryIndex();
|
||||
@@ -542,9 +542,9 @@ void menuModelTelemetry(evt_t event)
|
||||
case ITEM_TELEMETRY_VARIO_RANGE:
|
||||
lcd_putsLeft(y, STR_LIMIT);
|
||||
lcd_outdezAtt(TELEM_COL2, y, -10+g_model.frsky.varioMin, (m_posHorz<=0 ? attr : 0)|LEFT);
|
||||
lcd_outdezAtt(TELEM_COL2+50, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+75, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+100, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || m_posHorz==3) ? attr : 0));
|
||||
lcd_outdezAtt(TELEM_COL2+70, y, -5+g_model.frsky.varioCenterMin, ((CURSOR_ON_LINE() || m_posHorz==1) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+115, y, 5+g_model.frsky.varioCenterMax, ((CURSOR_ON_LINE() || m_posHorz==2) ? attr : 0)|PREC1);
|
||||
lcd_outdezAtt(TELEM_COL2+160, y, 10+g_model.frsky.varioMax, ((CURSOR_ON_LINE() || m_posHorz==3) ? attr : 0));
|
||||
if (attr && s_editMode>0) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
@@ -590,7 +590,7 @@ void menuModelTelemetry(evt_t event)
|
||||
case ITEM_TELEMETRY_SCREEN_LABEL4:
|
||||
{
|
||||
uint8_t screenIndex = TELEMETRY_CURRENT_EDIT_SCREEN(k);
|
||||
putsStrIdx(MENU_TITLE_LEFT, y, STR_SCREEN, screenIndex+1);
|
||||
putsStrIdx(MENUS_MARGIN_LEFT, y, STR_SCREEN, screenIndex+1);
|
||||
TelemetryScreenType oldScreenType = TELEMETRY_SCREEN_TYPE(screenIndex);
|
||||
TelemetryScreenType newScreenType = (TelemetryScreenType)selectMenuItem(TELEM_SCRTYPE_COL, y, PSTR(""), STR_VTELEMSCREENTYPE, oldScreenType, 0, TELEMETRY_SCREEN_TYPE_MAX, (m_posHorz==0 ? attr : 0), event);
|
||||
if (newScreenType != oldScreenType) {
|
||||
@@ -665,17 +665,17 @@ void menuModelTelemetry(evt_t event)
|
||||
if (IS_BARS_SCREEN(screenIndex)) {
|
||||
FrSkyBarData & bar = g_model.frsky.screens[screenIndex].bars[lineIndex];
|
||||
source_t barSource = bar.source;
|
||||
putsMixerSource(MENU_TITLE_LEFT+INDENT_WIDTH, y, barSource, (m_posHorz==0 ? attr : 0));
|
||||
putsMixerSource(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, barSource, (m_posHorz==0 ? attr : 0));
|
||||
int barMax = getMaximumValue(barSource);
|
||||
int barMin = -barMax;
|
||||
if (barSource) {
|
||||
if (barSource <= MIXSRC_LAST_CH) {
|
||||
putsChannelValue(MENU_TITLE_LEFT+INDENT_WIDTH+100, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(MENU_TITLE_LEFT+INDENT_WIDTH+200, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(MENUS_MARGIN_LEFT+INDENT_WIDTH+100, y, barSource, calc100toRESX(bar.barMin), (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(MENUS_MARGIN_LEFT+INDENT_WIDTH+200, y, barSource, calc100toRESX(bar.barMax), (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
else {
|
||||
putsChannelValue(MENU_TITLE_LEFT+INDENT_WIDTH+100, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(MENU_TITLE_LEFT+INDENT_WIDTH+200, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
putsChannelValue(MENUS_MARGIN_LEFT+INDENT_WIDTH+100, y, barSource, bar.barMin, (m_posHorz==1 ? attr : 0) | LEFT);
|
||||
putsChannelValue(MENUS_MARGIN_LEFT+INDENT_WIDTH+200, y, barSource, bar.barMax, (m_posHorz==2 ? attr : 0) | LEFT);
|
||||
}
|
||||
}
|
||||
else if (attr) {
|
||||
@@ -711,7 +711,7 @@ void menuModelTelemetry(evt_t event)
|
||||
for (int c=0; c<NUM_LINE_ITEMS; c++) {
|
||||
LcdFlags cellAttr = (m_posHorz==c ? attr : 0);
|
||||
source_t & value = g_model.frsky.screens[screenIndex].lines[lineIndex].sources[c];
|
||||
const coord_t pos[] = {MENU_TITLE_LEFT+INDENT_WIDTH, MENU_TITLE_LEFT+INDENT_WIDTH+100, MENU_TITLE_LEFT+INDENT_WIDTH+200};
|
||||
const coord_t pos[] = {MENUS_MARGIN_LEFT+INDENT_WIDTH, MENUS_MARGIN_LEFT+INDENT_WIDTH+100, MENUS_MARGIN_LEFT+INDENT_WIDTH+200};
|
||||
putsMixerSource(pos[c], y, value, cellAttr);
|
||||
if (cellAttr && s_editMode>0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, value, MIXSRC_LAST_TELEM, isSourceAvailable);
|
||||
|
||||
@@ -49,14 +49,17 @@
|
||||
#endif
|
||||
|
||||
#define MENUS_SCROLLBAR_WIDTH 2
|
||||
#define MENU_COLUMN2_X 180
|
||||
#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > MENU_COLUMN2_X+MENU_TITLE_LEFT+68) ? MENU_COLUMN2_X+MENU_TITLE_LEFT : MENU_TITLE_LEFT, y, str)
|
||||
#define MENU_COLUMN2_X 280
|
||||
|
||||
#define lcd_putsColumnLeft(x, y, str) lcd_puts((x > MENU_COLUMN2_X+MENUS_MARGIN_LEFT+68) ? MENU_COLUMN2_X+MENUS_MARGIN_LEFT : MENUS_MARGIN_LEFT, y, str)
|
||||
|
||||
typedef int16_t vertpos_t;
|
||||
|
||||
typedef evt_t & check_event_t;
|
||||
#define horzpos_t int8_t
|
||||
|
||||
extern uint8_t menuPageIndex;
|
||||
extern uint8_t menuPageCount;
|
||||
extern vertpos_t m_posVert;
|
||||
extern horzpos_t m_posHorz;
|
||||
extern vertpos_t s_pgOfs;
|
||||
@@ -189,8 +192,11 @@ int8_t checkIncDecMovedSwitch(int8_t val);
|
||||
#define CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, var, max, check) \
|
||||
var = checkIncDec(event, var, 0, max, EE_MODEL, check)
|
||||
|
||||
bool isThrottleSourceAvailable(int source);
|
||||
bool isLogicalSwitchFunctionAvailable(int function);
|
||||
bool isAssignableFunctionAvailable(int function);
|
||||
bool isSourceAvailableInResetSpecialFunction(int index);
|
||||
bool isSourceAvailableInGlobalResetSpecialFunction(int index);
|
||||
bool isSwitchAvailableInLogicalSwitches(int swtch);
|
||||
bool isSwitchAvailableInCustomFunctions(int swtch);
|
||||
bool isSwitchAvailableInMixes(int swtch);
|
||||
@@ -222,18 +228,18 @@ bool check_submenu_simple(check_event_t event, uint8_t maxrow, uint16_t scrollba
|
||||
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
|
||||
void drawMenuTemplate(const char *title, evt_t event, int pageIndex=0, int pageCount=0);
|
||||
void drawMenuTemplate(const char *title, evt_t event);
|
||||
|
||||
#define MENU(title, tab, menu, lines_count, scrollbar_X, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
|
||||
if (!check(event, menu, tab, DIM(tab), mstate_tab, DIM(mstate_tab)-1, lines_count, scrollbar_X)) return; \
|
||||
drawMenuTemplate(title, event, menu, DIM(tab)); \
|
||||
drawMenuTemplate(title, event); \
|
||||
|
||||
#define SIMPLE_MENU(title, tab, menu, lines_count, scrollbar_X) \
|
||||
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", title); \
|
||||
if (!check_simple(event, menu, tab, DIM(tab), lines_count, scrollbar_X)) return; \
|
||||
drawMenuTemplate(title, event, menu, DIM(tab)); \
|
||||
drawMenuTemplate(title, event); \
|
||||
|
||||
#define SUBMENU(title, lines_count, scrollbar_X, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
|
||||
@@ -216,6 +216,9 @@ int checkIncDec(evt_t event, int val, int i_min, int i_max, unsigned int i_flags
|
||||
#define INC(val, min, max) if (val<max) {val++;} else {val=min;}
|
||||
#define DEC(val, min, max) if (val>min) {val--;} else {val=max;}
|
||||
|
||||
uint8_t menuPageIndex;
|
||||
uint8_t menuPageCount;
|
||||
|
||||
bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t menuTabSize, const pm_uint8_t *horTab, uint8_t horTabMax, vertpos_t rowcount, uint16_t scrollbar_X, uint8_t flags)
|
||||
{
|
||||
vertpos_t l_posVert = m_posVert;
|
||||
@@ -239,8 +242,10 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
l_posVert = POS_VERT_INIT;
|
||||
event = 0;
|
||||
if (rowcount > 0) {
|
||||
l_posVert = POS_VERT_INIT;
|
||||
event = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -248,12 +253,15 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
chainMenu((MenuFuncP)pgm_read_adr(&menuTab[cc]));
|
||||
return false;
|
||||
}
|
||||
|
||||
menuPageIndex = curr;
|
||||
menuPageCount = menuTabSize;
|
||||
}
|
||||
|
||||
switch(event)
|
||||
{
|
||||
case EVT_ENTRY:
|
||||
l_posVert = -1;
|
||||
l_posVert = (menuTab ? -1 : 0);
|
||||
l_posHorz = POS_HORZ_INIT(l_posVert);
|
||||
s_editMode = EDIT_MODE_INIT;
|
||||
break;
|
||||
@@ -267,9 +275,8 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
if (s_editMode > 1) break;
|
||||
if (m_posHorz < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
l_posHorz = 0;
|
||||
break;
|
||||
}
|
||||
if (READ_ONLY_UNLOCKED()) {
|
||||
else if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = (s_editMode<=0);
|
||||
}
|
||||
break;
|
||||
@@ -280,7 +287,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (s_editMode>0) {
|
||||
if (s_editMode > 0) {
|
||||
s_editMode = 0;
|
||||
break;
|
||||
}
|
||||
@@ -288,7 +295,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
if (l_posHorz >= 0 && (COLATTR(l_posVert) & NAVIGATION_LINE_BY_LINE)) {
|
||||
l_posHorz = -1;
|
||||
}
|
||||
else if (l_posVert >= 0) {
|
||||
else if (menuTab && l_posVert >= 0) {
|
||||
l_posVert = -1;
|
||||
l_posHorz = 0;
|
||||
#if 0
|
||||
@@ -313,6 +320,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
case EVT_KEY_REPT(KEY_LEFT):
|
||||
if (s_editMode != 0) break;
|
||||
DEC(l_posHorz, 0, maxcol);
|
||||
break;
|
||||
|
||||
@@ -439,7 +447,7 @@ bool check(check_event_t event, uint8_t curr, const MenuFuncP *menuTab, uint8_t
|
||||
}
|
||||
|
||||
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||
displayScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||
lcdDrawScrollbar(scrollbar_X, DEFAULT_SCROLLBAR_Y, DEFAULT_SCROLLBAR_H, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||
}
|
||||
|
||||
m_posVert = l_posVert;
|
||||
|
||||
@@ -156,13 +156,13 @@ const char * displayMenu(evt_t event)
|
||||
uint8_t display_count = min(s_menu_count, (uint16_t)MENU_MAX_LINES);
|
||||
|
||||
int y = (LCD_H - (display_count*(FH+1))) / 2;
|
||||
drawBlackOverlay();
|
||||
// drawBlackOverlay();
|
||||
lcdDrawFilledRect(MENU_X, y, MENU_W, display_count * (FH+1), TEXT_BGCOLOR);
|
||||
lcd_rect(MENU_X, y, MENU_W, display_count * (FH+1), SOLID, WARNING_COLOR);
|
||||
lcdDrawRect(MENU_X, y, MENU_W, display_count * (FH+1) + 1, ALARM_COLOR);
|
||||
|
||||
for (uint8_t i=0; i<display_count; i++) {
|
||||
if (i == s_menu_item) {
|
||||
lcdDrawFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, 18, TEXT_INVERTED_BGCOLOR);
|
||||
lcdDrawFilledRect(MENU_X+1, i*(FH+1) + y + 1, MENU_W-2, FH+1, TEXT_INVERTED_BGCOLOR);
|
||||
lcd_putsAtt(MENU_X+6, i*(FH+1) + y + 5, s_menu[i], TEXT_INVERTED_COLOR|s_menu_flags);
|
||||
}
|
||||
else {
|
||||
@@ -171,7 +171,7 @@ const char * displayMenu(evt_t event)
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
displayScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
lcdDrawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_LINES * (FH+1), s_menu_offset, s_menu_count, MENU_MAX_LINES);
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
@@ -216,7 +216,6 @@ const char * displayMenu(evt_t event)
|
||||
}
|
||||
}
|
||||
break;
|
||||
CASE_EVT_ROTARY_BREAK
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
result = s_menu[s_menu_item];
|
||||
// no break
|
||||
|
||||
@@ -55,7 +55,8 @@ void drawPotsBars()
|
||||
for (x=LCD_W/2-9, i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=9, i++) {
|
||||
if (IS_POT_AVAILABLE(i)) {
|
||||
len = ((calibratedStick[i]+RESX)*BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||
lcdDrawFilledRect(x, 170-FH-len, 5, len, TEXT_COLOR);
|
||||
// TODO 220 constant
|
||||
lcdDrawFilledRect(x, 220-FH-len, 5, len, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ void menuTextView(evt_t event)
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
lcd_puts(MENU_TITLE_LEFT, MENU_CONTENT_TOP + i*FH, s_text_screen[i]);
|
||||
lcd_puts(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i*FH, s_text_screen[i]);
|
||||
}
|
||||
|
||||
char *title = s_text_file;
|
||||
@@ -148,7 +148,7 @@ void menuTextView(evt_t event)
|
||||
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
||||
|
||||
if (lines_count > NUM_BODY_LINES) {
|
||||
displayScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, s_pgOfs, lines_count, NUM_BODY_LINES);
|
||||
lcdDrawScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, s_pgOfs, lines_count, NUM_BODY_LINES);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,19 +38,20 @@
|
||||
#include <stdio.h>
|
||||
|
||||
#define COLUMN_HEADER_X 150
|
||||
|
||||
void displayHeader(const char *header)
|
||||
{
|
||||
lcd_putsAtt(COLUMN_HEADER_X, MENU_FOOTER_TOP, header, HEADER_COLOR);
|
||||
// TODO ? lcd_putsAtt(COLUMN_HEADER_X, MENU_FOOTER_TOP, header, HEADER_COLOR);
|
||||
}
|
||||
|
||||
void displayColumnHeader(const char * const *headers, uint8_t index)
|
||||
{
|
||||
displayHeader(headers[index]);
|
||||
// TODO ? displayHeader(headers[index]);
|
||||
}
|
||||
|
||||
void drawStick(coord_t centrex, int16_t xval, int16_t yval)
|
||||
{
|
||||
#define BOX_CENTERY (170 - FH - BOX_WIDTH/2)
|
||||
#define BOX_CENTERY (220 - FH - BOX_WIDTH/2)
|
||||
#define MARKER_WIDTH 5
|
||||
|
||||
lcdDrawSquare(centrex-BOX_WIDTH/2, BOX_CENTERY-BOX_WIDTH/2, BOX_WIDTH, TEXT_COLOR);
|
||||
@@ -82,7 +83,7 @@ void lcdDrawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||
}
|
||||
}
|
||||
|
||||
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
lcdDrawVerticalLine(x, y, h, LINE_COLOR);
|
||||
coord_t yofs = (h*offset + count/2) / count;
|
||||
@@ -103,22 +104,16 @@ void updateProgressBar(int num, int den)
|
||||
{
|
||||
if (num > 0 && den > 0) {
|
||||
int width = (200*num)/den;
|
||||
lcd_hline(5, 6*FH+6, width, FORCE);
|
||||
lcd_hline(5, 6*FH+7, width, FORCE);
|
||||
lcd_hline(5, 6*FH+8, width, FORCE);
|
||||
lcd_hline(5, 6*FH+6, width);
|
||||
lcd_hline(5, 6*FH+7, width);
|
||||
lcd_hline(5, 6*FH+8, width);
|
||||
lcdRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
void title(const pm_char * s)
|
||||
{
|
||||
int width = getTextWidth(s);
|
||||
lcd_putsAtt(MENU_TITLE_LEFT, MENU_TITLE_TOP+2, s, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
#define MENU_ICONS_SPACING 31
|
||||
|
||||
void drawMenuTemplate(const char *name, evt_t event, int pageIndex, int pageCount)
|
||||
void drawMenuTemplate(const char * name, evt_t event)
|
||||
{
|
||||
// clear the screen
|
||||
lcdDrawFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
@@ -130,29 +125,29 @@ void drawMenuTemplate(const char *name, evt_t event, int pageIndex, int pageCoun
|
||||
lcdDrawBitmapPattern(0, 0, LBM_TOP_POLYGON, TITLE_BGCOLOR);
|
||||
|
||||
if (m_posVert < 0) {
|
||||
lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_BG, TITLE_BGCOLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawFilledRect(58+pageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR);
|
||||
lcdDrawFilledRect(58+menuPageIndex*MENU_ICONS_SPACING-9, 0, 32, MENU_HEADER_HEIGHT, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_DOT, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
const uint8_t * const * icons = (g_menuPos[0] == 0 ? LBM_MODEL_ICONS : LBM_RADIO_ICONS);
|
||||
|
||||
lcdDrawBitmapPattern(5, 7, icons[0], MENU_TITLE_COLOR);
|
||||
|
||||
for (int i=0; i<pageCount; i++) {
|
||||
for (int i=0; i<menuPageCount; i++) {
|
||||
lcdDrawBitmapPattern(50+i*MENU_ICONS_SPACING, 7, icons[i+1], MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
if (m_posVert < 0) {
|
||||
lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TEXT_COLOR);
|
||||
lcdDrawBitmapPattern(58+pageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR);
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING-10, 0, LBM_CURRENT_SHADOW, TEXT_COLOR);
|
||||
lcdDrawBitmapPattern(58+menuPageIndex*MENU_ICONS_SPACING, MENU_TITLE_TOP-9, LBM_CURRENT_DOT, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
if (name) {
|
||||
// header
|
||||
title(name);
|
||||
// must be done at the end so that we can write something at the right of the menu title
|
||||
lcd_putsAtt(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+2, name, MENU_TITLE_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ struct MenuItem {
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||
void displaySplash();
|
||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible);
|
||||
void displayMenuBar(const MenuItem *menu, int index);
|
||||
void displayProgressBar(const char *label);
|
||||
void updateProgressBar(int num, int den);
|
||||
|
||||
@@ -68,6 +68,29 @@ bool isInputAvailable(int input)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isChannelUsed(int channel)
|
||||
{
|
||||
for (int i=0; i<MAX_MIXERS; ++i) {
|
||||
MixData *md = mixAddress(i);
|
||||
if (md->srcRaw == 0) return false;
|
||||
if (md->destCh == channel) return true;
|
||||
if (md->destCh > channel) return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int getChannelsUsed()
|
||||
{
|
||||
int result = 0;
|
||||
int lastCh = -1;
|
||||
for (int i=0; i<MAX_MIXERS; ++i) {
|
||||
MixData *md = mixAddress(i);
|
||||
if (md->srcRaw == 0) return result;
|
||||
if (md->destCh != lastCh) { ++result; lastCh = md->destCh; }
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool isSourceAvailable(int source)
|
||||
{
|
||||
if (source>=MIXSRC_FIRST_INPUT && source<=MIXSRC_LAST_INPUT) {
|
||||
@@ -98,17 +121,11 @@ bool isSourceAvailable(int source)
|
||||
#endif
|
||||
|
||||
if (source>=MIXSRC_CH1 && source<=MIXSRC_LAST_CH) {
|
||||
uint8_t destCh = source-MIXSRC_CH1;
|
||||
for (uint8_t i = 0; i < MAX_MIXERS; i++) {
|
||||
MixData *md = mixAddress(i);
|
||||
if (md->srcRaw == 0) return false;
|
||||
if (md->destCh==destCh) return true;
|
||||
}
|
||||
return false;
|
||||
return isChannelUsed(source-MIXSRC_CH1);
|
||||
}
|
||||
|
||||
if (source>=MIXSRC_FIRST_LOGICAL_SWITCH && source<=MIXSRC_LAST_LOGICAL_SWITCH) {
|
||||
LogicalSwitchData * cs = lswAddress(source-MIXSRC_SW1);
|
||||
LogicalSwitchData * cs = lswAddress(source-MIXSRC_FIRST_LOGICAL_SWITCH);
|
||||
return (cs->func != LS_FUNC_NONE);
|
||||
}
|
||||
|
||||
@@ -225,6 +242,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if NUM_XPOTS > 0
|
||||
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)) {
|
||||
@@ -235,6 +253,7 @@ bool isSwitchAvailable(int swtch, SwitchContext context)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (swtch >= SWSRC_FIRST_LOGICAL_SWITCH && swtch <= SWSRC_LAST_LOGICAL_SWITCH) {
|
||||
if (context == GeneralCustomFunctionsContext) {
|
||||
|
||||
@@ -597,7 +597,7 @@ void check(const char *name, check_event_t event, uint8_t curr, const MenuFuncP
|
||||
}
|
||||
|
||||
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||
displayScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||
lcdDrawScrollbar(scrollbar_X, MENU_HEADER_HEIGHT, LCD_H-MENU_HEADER_HEIGHT, s_pgOfs, linesCount, NUM_BODY_LINES);
|
||||
}
|
||||
|
||||
m_posVert = l_posVert;
|
||||
|
||||
@@ -139,7 +139,7 @@ const char * displayMenu(uint8_t event)
|
||||
}
|
||||
|
||||
if (s_menu_count > display_count) {
|
||||
displayScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), s_menu_offset, s_menu_count, display_count);
|
||||
lcdDrawScrollbar(MENU_X+MENU_W-1, y+1, MENU_MAX_DISPLAY_LINES * (FH+1), s_menu_offset, s_menu_count, display_count);
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
|
||||
@@ -149,7 +149,7 @@ void menuTextView(uint8_t event)
|
||||
lcd_invert_line(0);
|
||||
|
||||
if (lines_count > LCD_LINES-1) {
|
||||
displayScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||
lcdDrawScrollbar(LCD_W-1, FH, LCD_H-FH, s_pgOfs, lines_count, LCD_LINES-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr)
|
||||
lcd_outdezAtt(x, 0, index+1, attr);
|
||||
}
|
||||
|
||||
void displayScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
void lcdDrawScrollbar(coord_t x, coord_t y, coord_t h, uint16_t offset, uint16_t count, uint8_t visible)
|
||||
{
|
||||
lcd_vlineStip(x, y, h, DOTTED);
|
||||
coord_t yofs = (h * offset) / count;
|
||||
|
||||
@@ -1764,7 +1764,7 @@ enum SwitchSources {
|
||||
SWSRC_SF1,
|
||||
SWSRC_SF2,
|
||||
SWSRC_LAST_SWITCH = SWSRC_SF2,
|
||||
#elif defined(PCBTARANIS)
|
||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
SWSRC_SA0 = SWSRC_FIRST_SWITCH,
|
||||
SWSRC_SA1,
|
||||
SWSRC_SA2,
|
||||
|
||||
+3
-22
@@ -337,42 +337,23 @@
|
||||
#include <avr/wdt.h>
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define NUM_SWITCHES 5 // 8 physical switches + 6 possible from 3POS
|
||||
#define NUM_SW_SRCRAW 8
|
||||
// #define SWSRC_THR SWSRC_SF2
|
||||
// #define SWSRC_GEA SWSRC_SG2
|
||||
// #define SWSRC_ID0 SWSRC_SA0
|
||||
// #define SWSRC_ID1 SWSRC_SA1
|
||||
// #define SWSRC_ID2 SWSRC_SA2
|
||||
// #define SW_DSM2_BIND SW_SH2
|
||||
#elif defined(PCBFLAMENCO)
|
||||
#define NUM_SWITCHES 5 // 8 physical switches + 6 possible from 3POS
|
||||
#define NUM_SW_SRCRAW 8
|
||||
// #define SWSRC_THR SWSRC_SF2
|
||||
// #define SWSRC_GEA SWSRC_SG2
|
||||
// #define SWSRC_ID0 SWSRC_SA0
|
||||
// #define SWSRC_ID1 SWSRC_SA1
|
||||
// #define SWSRC_ID2 SWSRC_SA2
|
||||
// #define SW_DSM2_BIND SW_SH2
|
||||
#elif defined(PCBTARANIS)
|
||||
#if defined(PCBFLAMENCO)
|
||||
#define NUM_SWITCHES 5
|
||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
#if defined(REV9E)
|
||||
#define NUM_SWITCHES 18 // yes, it's a lot!
|
||||
#else
|
||||
#define NUM_SWITCHES 8
|
||||
#endif
|
||||
#define NUM_SW_SRCRAW 8
|
||||
#define SWSRC_THR SWSRC_SF2
|
||||
#define SWSRC_GEA SWSRC_SG2
|
||||
#define SWSRC_ID0 SWSRC_SA0
|
||||
#define SWSRC_ID1 SWSRC_SA1
|
||||
#define SWSRC_ID2 SWSRC_SA2
|
||||
#define SW_DSM2_BIND SW_SH2
|
||||
#else
|
||||
#define NUM_SWITCHES 7
|
||||
#define IS_3POS(sw) ((sw) == 0)
|
||||
#define IS_MOMENTARY(sw) (sw == SWSRC_TRN)
|
||||
#define NUM_SW_SRCRAW 1
|
||||
#define SW_DSM2_BIND SW_TRN
|
||||
#endif
|
||||
|
||||
|
||||
+10
-4
@@ -46,11 +46,17 @@
|
||||
#define EEPROM_STR DEFNUMSTR(EEPROM_VER);
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define TAB "\037\075"
|
||||
#elif defined(PCBFLAMENCO)
|
||||
#define TAB "\037\050"
|
||||
#endif
|
||||
|
||||
#if defined(COLORLCD)
|
||||
const pm_char vers_stamp[] PROGMEM = "VERS\037\050: " "opentx-" FLAVOUR "-" VERS_STR;
|
||||
const pm_char date_stamp[] PROGMEM = "DATE\037\050: " DATE_STR;
|
||||
const pm_char time_stamp[] PROGMEM = "TIME\037\050: " TIME_STR;
|
||||
const pm_char eeprom_stamp[] PROGMEM = "EEPR\037\050: " EEPROM_STR;
|
||||
const pm_char vers_stamp[] PROGMEM = "VERS" TAB ": " "opentx-" FLAVOUR "-" VERS_STR;
|
||||
const pm_char date_stamp[] PROGMEM = "DATE" TAB ": " DATE_STR;
|
||||
const pm_char time_stamp[] PROGMEM = "TIME" TAB ": " TIME_STR;
|
||||
const pm_char eeprom_stamp[] PROGMEM = "EEPR" TAB ": " EEPROM_STR;
|
||||
#else
|
||||
const pm_char vers_stamp[] PROGMEM = "FW\037\033: " "opentx-" FLAVOUR "\036VERS\037\033: " VERS_STR "\036DATE\037\033: " DATE_STR"\036TIME\037\033: " TIME_STR "\036EEPR\037\033: " EEPROM_STR;
|
||||
#endif
|
||||
|
||||
@@ -71,7 +71,7 @@ volatile GETSWITCH_RECURSIVE_TYPE s_last_switch_value = 0;
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(PCBFLAMENCO) || defined(PCBHORUS)
|
||||
#if defined(PCBFLAMENCO)
|
||||
tmr10ms_t potsLastposStart[1];
|
||||
uint8_t potsPos[1];
|
||||
tmr10ms_t switchesMidposStart[2];
|
||||
@@ -178,7 +178,7 @@ void getSwitchesPosition(bool startup)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
#if defined(REV9E)
|
||||
tmr10ms_t switchesMidposStart[16];
|
||||
#else
|
||||
@@ -697,7 +697,7 @@ swsrc_t getMovedSwitch()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#elif defined(PCBTARANIS)
|
||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
for (int i=0; i<NUM_SWITCHES; i++) {
|
||||
if (SWITCH_EXISTS(i)) {
|
||||
swarnstate_t mask = ((swarnstate_t)0x03 << (i*2));
|
||||
|
||||
@@ -501,7 +501,7 @@
|
||||
|
||||
#if defined(PCBFLAMENCO)
|
||||
#define TR_PHYS_SWITCHES "SA\300""SA-""SA\301""SB\300""SB\301""SC1""SC2""SC3""SC4""SC5""SC6""SE\300""SE\301""SF\300""SF-""SF\301"
|
||||
#elif !defined(PCBTARANIS)
|
||||
#elif !defined(PCBTARANIS) && !defined(PCBHORUS)
|
||||
#define TR_PHYS_SWITCHES "THR""RUD""ELE""AIL""GEA""TRN"
|
||||
#endif
|
||||
|
||||
@@ -509,7 +509,7 @@
|
||||
|
||||
#if defined(PCBFLAMENCO)
|
||||
#define TR_VSWITCHES "---" TR_PHYS_SWITCHES TR_TRIMS_SWITCHES TR_ROTENC_SWITCHES TR_LOGICALSW "ON\0""One"
|
||||
#elif defined(PCBTARANIS)
|
||||
#elif defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
// only special switches here
|
||||
#define TR_VSWITCHES "---" TR_TRIMS_SWITCHES TR_ON_ONE_SWITCHES
|
||||
#else
|
||||
@@ -574,7 +574,7 @@
|
||||
#define BREAKSPACE " "
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBFLAMENCO)
|
||||
#if defined(PCBTARANIS) || defined(PCBFLAMENCO) || defined(PCBHORUS)
|
||||
#define TR_ENTER "[ENTER]"
|
||||
#else
|
||||
#define TR_ENTER "[MENU]"
|
||||
|
||||
+15
-3
@@ -2,7 +2,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys
|
||||
from PyQt4 import Qt, QtGui
|
||||
from PyQt4 import Qt, QtCore, QtGui
|
||||
import glob
|
||||
|
||||
try:
|
||||
@@ -13,7 +13,7 @@ except:
|
||||
for f in glob.glob("fonts/*.ttf"):
|
||||
QtGui.QFontDatabase.addApplicationFont(f)
|
||||
|
||||
chars = u""" !"#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz~ ≥→←↑↓ △Ⓘ"""
|
||||
chars = u""" !"#$%&'()*+,-./0123456789:;<=>?°ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz~ ≥→←↑↓↗↘↙↖△"""
|
||||
|
||||
def getCharWidth(fontsize, metrics, index):
|
||||
if index == 0:
|
||||
@@ -46,7 +46,12 @@ def createFontBitmap(filename, fontname, fontsize, foreground, background, coord
|
||||
metrics = QtGui.QFontMetrics(font)
|
||||
width = getFontWidth(fontsize, metrics)
|
||||
top, bottom = getFontTopBottom(fontsize, metrics)
|
||||
image = QtGui.QImage(width, fontsize+1, QtGui.QImage.Format_RGB32)
|
||||
extraImage = QtGui.QImage("fonts/extra_%dpx.png" % (fontsize+1))
|
||||
if extraImage.isNull():
|
||||
extraWidth = 0
|
||||
else:
|
||||
extraWidth = extraImage.size().width()
|
||||
image = QtGui.QImage(width + extraWidth, fontsize+1, QtGui.QImage.Format_RGB32)
|
||||
image.fill(background)
|
||||
painter = QtGui.QPainter()
|
||||
painter.begin(image)
|
||||
@@ -64,6 +69,9 @@ def createFontBitmap(filename, fontname, fontsize, foreground, background, coord
|
||||
rect = metrics.boundingRect(c)
|
||||
painter.drawText(width-rect.left(), fontsize-2, c) # fontsize-bottom+1 -17 / 7
|
||||
width += getCharWidth(fontsize, metrics, i)
|
||||
if extraWidth:
|
||||
painter.drawImage(QtCore.QPoint(width, 0), extraImage)
|
||||
|
||||
coords.append(width)
|
||||
painter.end()
|
||||
image.save(filename + ".png")
|
||||
@@ -71,6 +79,10 @@ def createFontBitmap(filename, fontname, fontsize, foreground, background, coord
|
||||
f = file(filename + ".specs", "w")
|
||||
f.write("{ ")
|
||||
f.write(",".join(str(tmp) for tmp in coords))
|
||||
if extraWidth:
|
||||
for w in (7, 20, 30, 41, 52, 57, 70, 80, 92, 104, 113, 126, 136):
|
||||
f.write(", %d" % (int(coords[-1])+w))
|
||||
# f.write(file("fonts/extra_%dpx.specs" % fontsize).read())
|
||||
f.write(" }")
|
||||
f.close()
|
||||
return coords
|
||||
|
||||
Reference in New Issue
Block a user