[Horus] Hardware menu added. Calibration menu moved to the Hardware menu
This commit is contained in:
@@ -68,6 +68,7 @@ if(PCB STREQUAL HORUS)
|
||||
${GUI_SRC}
|
||||
curves.cpp
|
||||
bitmaps.cpp
|
||||
menu_general_hardware.cpp
|
||||
menu_model_inputs.cpp
|
||||
menu_model_mixes.cpp
|
||||
view_channels.cpp
|
||||
|
||||
@@ -74,8 +74,8 @@ void drawFooter();
|
||||
void drawProgressBar(const char *label);
|
||||
void updateProgressBar(int num, int den);
|
||||
void drawTopmenuDatetime();
|
||||
void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X);
|
||||
void drawStick(coord_t centrex, int16_t xval, int16_t yval);
|
||||
void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X=0);
|
||||
void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval);
|
||||
void drawSticks();
|
||||
|
||||
#if defined(FLIGHT_MODES)
|
||||
@@ -128,6 +128,7 @@ extern const uint8_t LBM_STAR1[];
|
||||
// Calibration screen
|
||||
extern const uint8_t LBM_HORUS[];
|
||||
extern const uint8_t LBM_STICK_BACKGROUND[];
|
||||
extern const uint8_t LBM_STICK_POINTER[];
|
||||
|
||||
// Other icons
|
||||
extern const uint8_t LBM_SPLASH[];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -22,42 +22,43 @@
|
||||
|
||||
#define XPOT_DELTA 10
|
||||
#define XPOT_DELAY 10 /* cycles */
|
||||
#define POT_BAR_WIDTH 7
|
||||
#define POT_BAR_HEIGHT (BOX_WIDTH-9)
|
||||
#define POT_BAR_INTERVAL 20
|
||||
#define POT_BAR_BOTTOM 200
|
||||
#define LBOX_CENTERX (BOX_WIDTH/2 + 17)
|
||||
#define RBOX_CENTERX (LCD_W-LBOX_CENTERX)
|
||||
#define STICKS_WIDTH 90
|
||||
#define STICKS_Y 110
|
||||
#define STICK_LEFT_X 25
|
||||
#define STICK_RIGHT_X (LCD_W-STICK_LEFT_X-STICKS_WIDTH)
|
||||
|
||||
void drawPotsBars()
|
||||
{
|
||||
// Optimization by Mike Blandford
|
||||
unsigned int x, i, len ; // declare temporary variables
|
||||
for (x=LCD_W/2-(POT_BAR_INTERVAL*NUM_POTS/2), i=NUM_STICKS; i<NUM_STICKS+NUM_POTS; x+=POT_BAR_INTERVAL, i++) {
|
||||
if (IS_POT_AVAILABLE(i)) {
|
||||
len = ((calibratedStick[i]+RESX)*POT_BAR_HEIGHT/(RESX*2))+1l; // calculate once per loop
|
||||
// TODO 220 constant
|
||||
lcdDrawSolidFilledRect(x, POT_BAR_BOTTOM-len, POT_BAR_WIDTH, len, TEXT_COLOR);
|
||||
putsStickName(x-2, POT_BAR_BOTTOM+5, i, TEXT_COLOR|TINSIZE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawSticksPositions()
|
||||
void drawSticks()
|
||||
{
|
||||
int16_t calibStickVert = calibratedStick[CONVERT_MODE(1)];
|
||||
if (g_model.throttleReversed && CONVERT_MODE(1) == THR_STICK)
|
||||
calibStickVert = -calibStickVert;
|
||||
drawStick(LBOX_CENTERX, calibratedStick[CONVERT_MODE(0)], calibStickVert);
|
||||
drawStick(STICK_LEFT_X, STICKS_Y, calibratedStick[CONVERT_MODE(0)], calibStickVert);
|
||||
|
||||
calibStickVert = calibratedStick[CONVERT_MODE(2)];
|
||||
if (g_model.throttleReversed && CONVERT_MODE(2) == THR_STICK)
|
||||
calibStickVert = -calibStickVert;
|
||||
drawStick(RBOX_CENTERX, calibratedStick[CONVERT_MODE(3)], calibStickVert);
|
||||
drawStick(STICK_RIGHT_X, STICKS_Y, calibratedStick[CONVERT_MODE(3)], calibStickVert);
|
||||
}
|
||||
|
||||
void drawPots()
|
||||
{
|
||||
// The pots which are displayed in the main view
|
||||
extern void drawMainPots();
|
||||
drawMainPots();
|
||||
|
||||
// The 2 main front sliders
|
||||
drawVerticalSlider(125, 120, 120, calibratedStick[7], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS |
|
||||
OPTION_SLIDER_SQUARE_BUTTON);
|
||||
drawVerticalSlider(LCD_W-125-12, 120, 120, calibratedStick[8], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS |
|
||||
OPTION_SLIDER_SQUARE_BUTTON);
|
||||
}
|
||||
|
||||
bool menuCommonCalib(evt_t event)
|
||||
{
|
||||
drawScreenTemplate(NULL, OPTION_MENU_NO_FOOTER);
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS; i++) { // get low and high vals for sticks and trims
|
||||
int16_t vt = anaIn(i);
|
||||
reusableBuffer.calib.loVals[i] = min(vt, reusableBuffer.calib.loVals[i]);
|
||||
@@ -112,15 +113,15 @@ bool menuCommonCalib(evt_t event)
|
||||
case 0:
|
||||
// START CALIBRATION
|
||||
if (!READ_ONLY()) {
|
||||
lcd_putsCenter(MENU_CONTENT_TOP, STR_MENUTOSTART);
|
||||
lcdDrawText(50, 3, STR_MENUCALIBRATION, MENU_TITLE_COLOR);
|
||||
lcdDrawText(50, 3+FH, "Press [Enter] to start", MENU_TITLE_COLOR);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
// SET MIDPOINT
|
||||
lcd_putsCenter(MENU_CONTENT_TOP, STR_SETMIDPOINT, INVERS);
|
||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUWHENDONE);
|
||||
|
||||
lcdDrawText(50, 3, STR_MENUCALIBRATION, MENU_TITLE_COLOR);
|
||||
lcdDrawText(50, 3+FH, "Please center sticks and press [Enter]", MENU_TITLE_COLOR);
|
||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
reusableBuffer.calib.loVals[i] = 15000;
|
||||
reusableBuffer.calib.hiVals[i] = -15000;
|
||||
@@ -134,10 +135,8 @@ bool menuCommonCalib(evt_t event)
|
||||
|
||||
case 2:
|
||||
// MOVE STICKS/POTS
|
||||
STICK_SCROLL_DISABLE();
|
||||
lcd_putsCenter(MENU_CONTENT_TOP, STR_MOVESTICKSPOTS, INVERS);
|
||||
lcd_putsCenter(MENU_CONTENT_TOP+FH, STR_MENUWHENDONE);
|
||||
|
||||
lcdDrawText(50, 3, STR_MENUCALIBRATION, MENU_TITLE_COLOR);
|
||||
lcdDrawText(50, 3+FH, "Move sticks, pots and sliders and press [Enter]", MENU_TITLE_COLOR);
|
||||
for (int i=0; i<NUM_STICKS+NUM_POTS; i++) {
|
||||
if (abs(reusableBuffer.calib.loVals[i]-reusableBuffer.calib.hiVals[i]) > 50) {
|
||||
g_eeGeneral.calib[i].mid = reusableBuffer.calib.midVals[i];
|
||||
@@ -183,8 +182,9 @@ bool menuCommonCalib(evt_t event)
|
||||
break;
|
||||
}
|
||||
|
||||
drawSticksPositions();
|
||||
drawPotsBars();
|
||||
lcdDrawBitmap((LCD_W-206)/2, LCD_H-220, LBM_HORUS);
|
||||
drawSticks();
|
||||
drawPots();
|
||||
|
||||
for (int i=POT1; i<=POT_LAST; i++) {
|
||||
uint8_t steps = 0;
|
||||
@@ -205,7 +205,16 @@ bool menuCommonCalib(evt_t event)
|
||||
|
||||
bool menuGeneralCalib(evt_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUCALIBRATION, menuTabGeneral, e_Calib, 0, DEFAULT_SCROLLBAR_X);
|
||||
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) TRACE("Menu %s displayed ...", STR_MENUCALIBRATION);
|
||||
if (calibrationState == 4) {
|
||||
calibrationState = 0;
|
||||
popMenu();
|
||||
return false;
|
||||
}
|
||||
if (!check_submenu_simple(event, 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
menuVerticalPosition = -1;
|
||||
|
||||
return menuCommonCalib(READ_ONLY() ? 0 : event);
|
||||
@@ -219,7 +228,6 @@ bool menuFirstCalib(evt_t event)
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
drawScreenTemplate(STR_MENUCALIBRATION);
|
||||
return menuCommonCalib(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "../../opentx.h"
|
||||
|
||||
enum menuGeneralHwItems {
|
||||
ITEM_SETUP_HW_CALIBRATION,
|
||||
ITEM_SETUP_HW_LABEL_STICKS,
|
||||
ITEM_SETUP_HW_STICK1,
|
||||
ITEM_SETUP_HW_STICK2,
|
||||
ITEM_SETUP_HW_STICK3,
|
||||
ITEM_SETUP_HW_STICK4,
|
||||
ITEM_SETUP_HW_LABEL_POTS,
|
||||
ITEM_SETUP_HW_POT1,
|
||||
ITEM_SETUP_HW_POT2,
|
||||
ITEM_SETUP_HW_POT3,
|
||||
ITEM_SETUP_HW_LS,
|
||||
ITEM_SETUP_HW_RS,
|
||||
ITEM_SETUP_HW_LS2,
|
||||
ITEM_SETUP_HW_RS2,
|
||||
ITEM_SETUP_HW_LABEL_SWITCHES,
|
||||
ITEM_SETUP_HW_SA,
|
||||
ITEM_SETUP_HW_SB,
|
||||
ITEM_SETUP_HW_SC,
|
||||
ITEM_SETUP_HW_SD,
|
||||
ITEM_SETUP_HW_SE,
|
||||
ITEM_SETUP_HW_SF,
|
||||
ITEM_SETUP_HW_SG,
|
||||
ITEM_SETUP_HW_SH,
|
||||
ITEM_SETUP_HW_BLUETOOTH,
|
||||
// ITEM_SETUP_HW_UART3_MODE,
|
||||
ITEM_SETUP_HW_MAX
|
||||
};
|
||||
|
||||
#define HW_SETTINGS_COLUMN 150
|
||||
#define POTS_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, 0, 0, 0, 0
|
||||
#define SWITCHES_ROWS NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1, NAVIGATION_LINE_BY_LINE|1
|
||||
#define BLUETOOTH_ROWS 1,
|
||||
#define SWITCH_TYPE_MAX(sw) ((MIXSRC_SF-MIXSRC_FIRST_SWITCH == sw || MIXSRC_SH-MIXSRC_FIRST_SWITCH == sw) ? SWITCH_2POS : SWITCH_3POS)
|
||||
|
||||
bool menuGeneralHardware(evt_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, menuTabGeneral, e_Hardware, ITEM_SETUP_HW_MAX, DEFAULT_SCROLLBAR_X, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, BLUETOOTH_ROWS 0 });
|
||||
|
||||
uint8_t sub = menuVerticalPosition;
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i + menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
}
|
||||
LcdFlags attr = (sub == k ? ((s_editMode>0) ? BLINK|INVERS : INVERS) : 0);
|
||||
switch (k) {
|
||||
case ITEM_SETUP_HW_CALIBRATION:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "Calibration", attr);
|
||||
if (attr && s_editMode>0) {
|
||||
pushMenu(menuGeneralCalib);
|
||||
}
|
||||
break;
|
||||
case ITEM_SETUP_HW_LABEL_STICKS:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_STICKS);
|
||||
break;
|
||||
case ITEM_SETUP_HW_STICK1:
|
||||
case ITEM_SETUP_HW_STICK2:
|
||||
case ITEM_SETUP_HW_STICK3:
|
||||
case ITEM_SETUP_HW_STICK4:
|
||||
{
|
||||
int idx = k - ITEM_SETUP_HW_STICK1;
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, idx+1, 0);
|
||||
if (ZEXIST(g_eeGeneral.anaNames[idx]) || attr)
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[idx], LEN_ANA_NAME, event, attr);
|
||||
else
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
|
||||
break;
|
||||
}
|
||||
case ITEM_SETUP_HW_LS:
|
||||
case ITEM_SETUP_HW_RS:
|
||||
case ITEM_SETUP_HW_LS2:
|
||||
case ITEM_SETUP_HW_RS2:
|
||||
{
|
||||
int idx = k - ITEM_SETUP_HW_LS;
|
||||
uint8_t mask = (0x01 << idx);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+NUM_XPOTS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+2+idx]) || (attr && menuHorizontalPosition == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+NUM_XPOTS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
|
||||
else
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
|
||||
uint8_t potType = (g_eeGeneral.slidersConfig & mask) >> idx;
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN+50, y, STR_SLIDERTYPES, potType, SLIDER_NONE, SLIDER_WITH_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
|
||||
g_eeGeneral.slidersConfig &= ~mask;
|
||||
g_eeGeneral.slidersConfig |= (potType << idx);
|
||||
break;
|
||||
}
|
||||
case ITEM_SETUP_HW_LABEL_POTS:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_POTS);
|
||||
break;
|
||||
case ITEM_SETUP_HW_POT1:
|
||||
case ITEM_SETUP_HW_POT2:
|
||||
case ITEM_SETUP_HW_POT3:
|
||||
{
|
||||
int idx = k - ITEM_SETUP_HW_POT1;
|
||||
uint8_t shift = (2*idx);
|
||||
uint8_t mask = (0x03 << shift);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, NUM_STICKS+idx+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.anaNames[NUM_STICKS+idx]) || (attr && menuHorizontalPosition == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.anaNames[NUM_STICKS+idx], LEN_ANA_NAME, event, attr && menuHorizontalPosition == 0);
|
||||
else
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
|
||||
uint8_t potType = (g_eeGeneral.potsConfig & mask) >> shift;
|
||||
potType = selectMenuItem(HW_SETTINGS_COLUMN+50, y, STR_POTTYPES, potType, POT_NONE, POT_WITHOUT_DETENT, menuHorizontalPosition == 1 ? attr : 0, event);
|
||||
g_eeGeneral.potsConfig &= ~mask;
|
||||
g_eeGeneral.potsConfig |= (potType << shift);
|
||||
break;
|
||||
}
|
||||
case ITEM_SETUP_HW_LABEL_SWITCHES:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SWITCHES);
|
||||
break;
|
||||
case ITEM_SETUP_HW_SA:
|
||||
case ITEM_SETUP_HW_SB:
|
||||
case ITEM_SETUP_HW_SC:
|
||||
case ITEM_SETUP_HW_SD:
|
||||
case ITEM_SETUP_HW_SE:
|
||||
case ITEM_SETUP_HW_SF:
|
||||
case ITEM_SETUP_HW_SG:
|
||||
case ITEM_SETUP_HW_SH:
|
||||
{
|
||||
int index = k-ITEM_SETUP_HW_SA;
|
||||
int config = SWITCH_CONFIG(index);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, y, STR_VSRCRAW, MIXSRC_FIRST_SWITCH-MIXSRC_Rud+index+1, menuHorizontalPosition < 0 ? attr : 0);
|
||||
if (ZEXIST(g_eeGeneral.switchNames[index]) || (attr && menuHorizontalPosition == 0))
|
||||
editName(HW_SETTINGS_COLUMN, y, g_eeGeneral.switchNames[index], LEN_SWITCH_NAME, event, menuHorizontalPosition == 0 ? attr : 0);
|
||||
else
|
||||
lcdDrawTextAtIndex(HW_SETTINGS_COLUMN, y, STR_MMMINV, 0, 0);
|
||||
config = selectMenuItem(HW_SETTINGS_COLUMN+50, y, STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
swconfig_t mask = (swconfig_t)0x03 << (2*index);
|
||||
g_eeGeneral.switchConfig = (g_eeGeneral.switchConfig & ~mask) | ((swconfig_t(config) & 0x03) << (2*index));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_SETUP_HW_BLUETOOTH:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "Bluetooth");
|
||||
drawCheckBox(HW_SETTINGS_COLUMN, y, g_eeGeneral.bluetoothEnable, menuHorizontalPosition == 0 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition == 0) {
|
||||
g_eeGeneral.bluetoothEnable = checkIncDecGen(event, g_eeGeneral.bluetoothEnable, 0, 1);
|
||||
}
|
||||
editName(HW_SETTINGS_COLUMN+50, y, g_eeGeneral.bluetoothName, LEN_BLUETOOTH_NAME, event, menuHorizontalPosition == 1 ? attr : 0);
|
||||
break;
|
||||
|
||||
#if 0
|
||||
case ITEM_SETUP_HW_UART3_MODE:
|
||||
g_eeGeneral.serial2Mode = selectMenuItem(HW_SETTINGS_COLUMN, y, STR_UART3MODE, STR_UART3MODES, g_eeGeneral.serial2Mode, 0, UART_MODE_MAX, attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
serial2Init(g_eeGeneral.serial2Mode, MODEL_TELEMETRY_PROTOCOL());
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
int8_t editSlider(coord_t x, coord_t y, evt_t event, int8_t value, int8_t min, int8_t max, LcdFlags attr)
|
||||
{
|
||||
drawSlider(x, y, value-min, max-min, attr);
|
||||
drawHorizontalSlider(x, y, 100, value, min, max, 0, OPTION_SLIDER_DBL_COLOR|attr);
|
||||
return selectMenuItem(x, y, NULL, value, min, max, attr, event);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ bool menuGeneralSetup(evt_t event)
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i+menuVerticalOffset;
|
||||
int k = i + menuVerticalOffset;
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
|
||||
@@ -102,14 +102,6 @@ bool menuModelLimits(evt_t event)
|
||||
|
||||
uint32_t sub = menuVerticalPosition;
|
||||
|
||||
if (sub < NUM_CHNOUT) {
|
||||
#if defined(PPM_CENTER_ADJUSTABLE) || defined(PPM_UNIT_US)
|
||||
lcdDrawNumber(100, MENU_FOOTER_TOP, PPM_CH_CENTER(sub)+channelOutputs[sub]/2, HEADER_COLOR, 0, NULL, STR_US);
|
||||
#else
|
||||
lcdDrawNumber(100, MENU_FOOTER_TOP, calcRESXto1000(channelOutputs[sub]), HEADER_COLOR|PREC1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (sub<NUM_CHNOUT && menuHorizontalPosition>=0) {
|
||||
drawColumnHeader(STR_LIMITS_HEADERS, menuHorizontalPosition);
|
||||
}
|
||||
|
||||
@@ -313,14 +313,6 @@ void onMixesMenu(const char * result)
|
||||
}
|
||||
}
|
||||
|
||||
void displayHeaderChannelName(uint8_t ch)
|
||||
{
|
||||
uint8_t len = zlen(g_model.limitData[ch-1].name, sizeof(g_model.limitData[ch-1].name));
|
||||
if (len) {
|
||||
lcdDrawSizedText(COLUMN_HEADER_X, MENU_FOOTER_TOP, g_model.limitData[ch-1].name, len, HEADER_COLOR|ZCHAR);
|
||||
}
|
||||
}
|
||||
|
||||
void displayMixInfos(coord_t y, MixData *md)
|
||||
{
|
||||
putsCurveRef(MIX_LINE_CURVE_POS, y, md->curve);
|
||||
@@ -506,9 +498,6 @@ bool menuModelMixAll(evt_t event)
|
||||
}
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
LcdFlags attr = ((s_copyMode || sub != cur) ? 0 : INVERS);
|
||||
if (attr) {
|
||||
displayHeaderChannelName(ch);
|
||||
}
|
||||
|
||||
if (mixCnt > 0) lcdDrawTextAtIndex(6, y, STR_VMLTPX2, md->mltpx, 0);
|
||||
|
||||
@@ -554,9 +543,6 @@ bool menuModelMixAll(evt_t event)
|
||||
}
|
||||
if (cur-menuVerticalOffset >= 0 && cur-menuVerticalOffset < NUM_BODY_LINES) {
|
||||
putsChn(MENUS_MARGIN_LEFT, y, ch, attr); // show CHx
|
||||
if (attr) {
|
||||
displayHeaderChannelName(ch);
|
||||
}
|
||||
if (s_copyMode == MOVE_MODE && s_copySrcCh == ch) {
|
||||
lineMixSurround(y);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ bool menuModelSetup(evt_t event)
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; ++i) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
int k = i+menuVerticalOffset;
|
||||
int k = i + menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -128,7 +128,7 @@ enum EnumTabRadio {
|
||||
e_Sd,
|
||||
e_GeneralCustomFunctions,
|
||||
e_Trainer,
|
||||
e_Calib,
|
||||
e_Hardware,
|
||||
e_Vers,
|
||||
};
|
||||
|
||||
@@ -137,6 +137,7 @@ bool menuGeneralSdManager(evt_t event);
|
||||
bool menuGeneralCustomFunctions(evt_t event);
|
||||
bool menuGeneralTrainer(evt_t event);
|
||||
bool menuGeneralVersion(evt_t event);
|
||||
bool menuGeneralHardware(evt_t event);
|
||||
bool menuGeneralCalib(evt_t event);
|
||||
|
||||
static const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
|
||||
@@ -144,7 +145,7 @@ static const MenuHandlerFunc menuTabGeneral[] PROGMEM = {
|
||||
menuGeneralSdManager,
|
||||
menuGeneralCustomFunctions,
|
||||
menuGeneralTrainer,
|
||||
menuGeneralCalib,
|
||||
menuGeneralHardware,
|
||||
menuGeneralVersion,
|
||||
};
|
||||
|
||||
@@ -267,9 +268,25 @@ bool check_submenu_simple(check_event_t event, uint8_t maxrow);
|
||||
#define MENU_TAB(...) const uint8_t mstate_tab[] = __VA_ARGS__
|
||||
|
||||
void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h);
|
||||
void drawScreenTemplate(const char * title);
|
||||
void drawMenuTemplate(const char * title, uint16_t scrollbar_X=0);
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr);
|
||||
void drawScreenTemplate(const char * title, uint32_t options=0);
|
||||
|
||||
#define OPTION_MENU_NO_FOOTER 0x01
|
||||
void drawMenuTemplate(const char * title, uint16_t scrollbar_X=0, uint32_t options=0);
|
||||
|
||||
#define OPTION_SLIDER_INVERS INVERS
|
||||
#define OPTION_SLIDER_BLINK BLINK
|
||||
#define OPTION_SLIDER_VERTICAL 0x04
|
||||
#define OPTION_SLIDER_EMPTY_BAR 0x08
|
||||
#define OPTION_SLIDER_DBL_COLOR 0x10
|
||||
#define OPTION_SLIDER_TICKS 0x20
|
||||
#define OPTION_SLIDER_BIG_TICKS 0x40
|
||||
#define OPTION_SLIDER_TRIM_BUTTON 0x80
|
||||
#define OPTION_SLIDER_NUMBER_BUTTON 0x100
|
||||
#define OPTION_SLIDER_SQUARE_BUTTON 0x200
|
||||
|
||||
void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
|
||||
void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
|
||||
void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options);
|
||||
|
||||
#define MENU(title, tab, menu, lines_count, scrollbar_X, ...) \
|
||||
MENU_TAB(__VA_ARGS__); \
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -39,124 +39,21 @@
|
||||
#define TIMER2PANEL_LEFT TIMER1PANEL_LEFT
|
||||
#define TIMER2PANEL_TOP 134
|
||||
|
||||
void drawTrimSquare(coord_t x, coord_t y)
|
||||
void drawMainPots()
|
||||
{
|
||||
lcdDrawSolidFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TEXT_COLOR);
|
||||
}
|
||||
// The 3 pots
|
||||
drawHorizontalSlider(TRIM_LH_X, POTS_LINE_Y, 160, calibratedStick[4], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS |
|
||||
OPTION_SLIDER_SQUARE_BUTTON);
|
||||
drawHorizontalSlider(LCD_W/2-20, POTS_LINE_Y, XPOTS_MULTIPOS_COUNT*5, 1 + (potsPos[1] & 0x0f), 1, XPOTS_MULTIPOS_COUNT + 1, XPOTS_MULTIPOS_COUNT, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS |
|
||||
OPTION_SLIDER_NUMBER_BUTTON);
|
||||
drawHorizontalSlider(TRIM_RH_X, POTS_LINE_Y, 160, calibratedStick[6], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS |
|
||||
OPTION_SLIDER_SQUARE_BUTTON);
|
||||
|
||||
void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidVerticalLine(x+8, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawSolidVerticalLine(x+2, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawSolidVerticalLine(xm, ym, 9, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
void drawVerticalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidHorizontalLine(x+1, y+4, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawSolidHorizontalLine(x+1, y+10, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawSolidHorizontalLine(xm-1, ym, 3, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
#define OPTION_VERTICAL 0x01
|
||||
#define OPTION_BIG_TICKS 0x02
|
||||
#define OPTION_TRIM_BUTTON 0x10
|
||||
#define OPTION_NUMBER_BUTTON 0x20
|
||||
|
||||
void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
{
|
||||
if (steps) {
|
||||
int delta = len / steps;
|
||||
for (int i = 0; i <= len; i += delta) {
|
||||
if ((options & OPTION_BIG_TICKS) && (i == 0 || i == len / 2 || i == len))
|
||||
lcdDrawSolidHorizontalLine(x, y + i, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawSolidHorizontalLine(x + 2, y + i, 9, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x + 1, y, LBM_VTRIM_FRAME, TEXT_COLOR);
|
||||
/* if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE);
|
||||
}
|
||||
} */
|
||||
}
|
||||
y += len - (val - min) * len / (max - min) - 5;
|
||||
if (options & OPTION_TRIM_BUTTON) {
|
||||
drawVerticalTrimPosition(x, y - 2, val);
|
||||
}
|
||||
else if (options & OPTION_NUMBER_BUTTON) {
|
||||
drawTrimSquare(x, y - 2);
|
||||
lcdDrawChar(x + 2, y - 1, '0' + val, SMLSIZE | TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else {
|
||||
drawTrimSquare(x, y - 2);
|
||||
}
|
||||
}
|
||||
|
||||
void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
{
|
||||
if (steps) {
|
||||
int delta = len / steps;
|
||||
for (int i = 0; i <= len; i += delta) {
|
||||
if ((options & OPTION_BIG_TICKS) && (i == 0 || i == len / 2 || i == len))
|
||||
lcdDrawSolidVerticalLine(x + i, y, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawSolidVerticalLine(x + i, y + 2, 9, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x, y + 1, LBM_HTRIM_FRAME, TEXT_COLOR);
|
||||
/* if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE);
|
||||
}
|
||||
} */
|
||||
}
|
||||
x += (val - min) * len / (max - min) - 5;
|
||||
if (options & OPTION_TRIM_BUTTON) {
|
||||
drawHorizontalTrimPosition(x, y - 1, val);
|
||||
}
|
||||
else if (options & OPTION_NUMBER_BUTTON) {
|
||||
drawTrimSquare(x, y - 1);
|
||||
lcdDrawChar(x + 2, y, '0' + val, SMLSIZE | TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else {
|
||||
drawTrimSquare(x, y - 1);
|
||||
}
|
||||
}
|
||||
|
||||
void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
{
|
||||
if (options & OPTION_VERTICAL)
|
||||
drawVerticalSlider(x, y, len, val, min, max, steps, options);
|
||||
else
|
||||
drawHorizontalSlider(x, y, len, val, min, max, steps, options);
|
||||
}
|
||||
|
||||
void drawPots()
|
||||
{
|
||||
drawVerticalSlider(6, TRIM_V_Y, 160, calibratedStick[9], -RESX, RESX, 40, OPTION_BIG_TICKS);
|
||||
drawHorizontalSlider(TRIM_LH_X, POTS_LINE_Y, 160, calibratedStick[4], -RESX, RESX, 40, OPTION_BIG_TICKS);
|
||||
drawVerticalSlider(LCD_W-18, TRIM_V_Y, 160, calibratedStick[10], -RESX, RESX, 40, OPTION_BIG_TICKS);
|
||||
drawHorizontalSlider(TRIM_RH_X, POTS_LINE_Y, 160, calibratedStick[6], -RESX, RESX, 40, OPTION_BIG_TICKS);
|
||||
drawHorizontalSlider(LCD_W/2-20, POTS_LINE_Y, XPOTS_MULTIPOS_COUNT*5, 1 + (potsPos[1] & 0x0f), 1, XPOTS_MULTIPOS_COUNT + 1, XPOTS_MULTIPOS_COUNT, OPTION_NUMBER_BUTTON);
|
||||
// The 2 rear sliders
|
||||
drawVerticalSlider(6, TRIM_V_Y, 160, calibratedStick[9], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS |
|
||||
OPTION_SLIDER_SQUARE_BUTTON);
|
||||
drawVerticalSlider(LCD_W-18, TRIM_V_Y, 160, calibratedStick[10], -RESX, RESX, 40, OPTION_SLIDER_TICKS | OPTION_SLIDER_BIG_TICKS |
|
||||
OPTION_SLIDER_SQUARE_BUTTON);
|
||||
}
|
||||
|
||||
void drawTrims(uint8_t flightMode)
|
||||
@@ -182,10 +79,10 @@ void drawTrims(uint8_t flightMode)
|
||||
}
|
||||
|
||||
if (vert[i]) {
|
||||
drawVerticalSlider(xm, TRIM_V_Y, 160, trim, -125, 125, 0, OPTION_TRIM_BUTTON);
|
||||
drawVerticalSlider(xm, TRIM_V_Y, 160, trim, -125, 125, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
||||
}
|
||||
else {
|
||||
drawHorizontalSlider(xm, TRIM_H_Y, 160, trim, -125, 125, 0, OPTION_TRIM_BUTTON);
|
||||
drawHorizontalSlider(xm, TRIM_H_Y, 160, trim, -125, 125, 0, OPTION_SLIDER_EMPTY_BAR|OPTION_SLIDER_TRIM_BUTTON);
|
||||
/* if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE);
|
||||
@@ -262,23 +159,6 @@ bool isViewAvailable(int index)
|
||||
return TELEMETRY_SCREEN_TYPE(index-VIEW_TELEM1) != TELEMETRY_SCREEN_TYPE_NONE;
|
||||
}
|
||||
|
||||
void displayMainViewIndex()
|
||||
{
|
||||
int x = LCD_W - 14;
|
||||
|
||||
for (int i=VIEW_COUNT; i>=0; --i) {
|
||||
if (isViewAvailable(i)) {
|
||||
if (g_eeGeneral.view == i) {
|
||||
lcdDrawSolidFilledRect(x, MENU_FOOTER_TOP+17, 9, 9, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawSolidRect(x+1, MENU_FOOTER_TOP+18, 7, 7, TEXT_COLOR);
|
||||
}
|
||||
x -= 11;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onMainViewMenu(const char *result)
|
||||
{
|
||||
if (result == STR_MODEL_SELECT) {
|
||||
@@ -398,7 +278,7 @@ bool menuMainView(evt_t event)
|
||||
lcdDrawSizedText(LCD_W/2-getTextWidth(g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR|SMLSIZE)/2, 237, g_model.flightModeData[mixerCurrentFlightMode].name, sizeof(g_model.flightModeData[mixerCurrentFlightMode].name), ZCHAR|SMLSIZE);
|
||||
|
||||
// Pots and rear sliders positions
|
||||
drawPots();
|
||||
drawMainPots();
|
||||
|
||||
// Trims
|
||||
drawTrims(mixerCurrentFlightMode);
|
||||
|
||||
@@ -125,11 +125,11 @@ bool menuTextView(evt_t event)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i*FH, s_text_screen[i]);
|
||||
}
|
||||
|
||||
char *title = s_text_file;
|
||||
char * title = s_text_file;
|
||||
#if defined(SIMU)
|
||||
if (!strncmp(title, "./", 2)) title += 2;
|
||||
#endif
|
||||
lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
||||
// lcd_putsCenter(MENU_FOOTER_TOP, title, HEADER_COLOR);
|
||||
|
||||
drawVerticalScrollbar(LCD_W-5, 30, MENU_FOOTER_TOP-34, menuVerticalOffset, lines_count, NUM_BODY_LINES);
|
||||
|
||||
|
||||
+141
-36
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
@@ -52,18 +52,11 @@ void drawTopmenuDatetime()
|
||||
lcdDrawText(DATETIME_LEFT(str), DATETIME_LINE2, str, SMLSIZE|TEXT_INVERTED_COLOR);
|
||||
}
|
||||
|
||||
void drawStick(coord_t centrex, int16_t xval, int16_t yval)
|
||||
#define STICK_PANEL_WIDTH 68
|
||||
void drawStick(coord_t x, coord_t y, int16_t xval, int16_t yval)
|
||||
{
|
||||
#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);
|
||||
lcdDrawVerticalLine(centrex, BOX_CENTERY-1, 3, SOLID, TEXT_COLOR);
|
||||
lcdDrawHorizontalLine(centrex-1, BOX_CENTERY, 3, SOLID, TEXT_COLOR);
|
||||
lcdDrawSquare(centrex + (xval/((2*RESX)/(BOX_WIDTH-MARKER_WIDTH))) - MARKER_WIDTH/2, BOX_CENTERY - (yval/((2*RESX)/(BOX_WIDTH-MARKER_WIDTH))) - MARKER_WIDTH/2, MARKER_WIDTH, ROUND|TEXT_COLOR);
|
||||
|
||||
#undef BOX_CENTERY
|
||||
#undef MARKER_WIDTH
|
||||
lcdDrawBitmap(x, y, LBM_STICK_BACKGROUND);
|
||||
lcdDrawAlphaBitmap(x + 2 + STICK_PANEL_WIDTH/2 + STICK_PANEL_WIDTH/2 * xval/RESX, y + 2 + STICK_PANEL_WIDTH/2 - STICK_PANEL_WIDTH/2 * yval/RESX, LBM_STICK_POINTER);
|
||||
}
|
||||
|
||||
void drawCheckBox(coord_t x, coord_t y, uint8_t value, LcdFlags attr)
|
||||
@@ -134,7 +127,7 @@ void drawShadow(coord_t x, coord_t y, coord_t w, coord_t h)
|
||||
lcdDrawSolidHorizontalLine(x+2, y+h+1, w, LINE_COLOR);
|
||||
}
|
||||
|
||||
void drawScreenTemplate(const char * title)
|
||||
void drawScreenTemplate(const char * title, uint32_t options)
|
||||
{
|
||||
// Header
|
||||
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
@@ -148,11 +141,14 @@ void drawScreenTemplate(const char * title)
|
||||
lcdDrawText(50, 3, title, MENU_TITLE_COLOR|DBLSIZE);
|
||||
}
|
||||
|
||||
// Body
|
||||
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TEXT_BGCOLOR);
|
||||
|
||||
// Footer
|
||||
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||
// Body and footer (depending on options)
|
||||
if (options & OPTION_MENU_NO_FOOTER) {
|
||||
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, LCD_H-MENU_HEADER_HEIGHT, TEXT_BGCOLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawSolidFilledRect(0, MENU_HEADER_HEIGHT, LCD_W, LCD_H-MENU_HEADER_HEIGHT-MENU_FOOTER_HEIGHT, TEXT_BGCOLOR);
|
||||
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, LCD_W, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
@@ -187,7 +183,7 @@ void drawSubmenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
}
|
||||
}
|
||||
|
||||
void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
void drawMenuTemplate(const char * title, uint16_t scrollbar_X, uint32_t options)
|
||||
{
|
||||
// clear the screen
|
||||
lcdDrawSolidFilledRect(0, 0, LCD_W, MENU_HEADER_HEIGHT, HEADER_BGCOLOR);
|
||||
@@ -221,9 +217,9 @@ void drawMenuTemplate(const char * name, uint16_t scrollbar_X)
|
||||
|
||||
drawTopmenuDatetime();
|
||||
|
||||
if (name) {
|
||||
if (title) {
|
||||
// must be done at the end so that we can write something at the right of the menu title
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+2, name, MENU_TITLE_COLOR);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_TITLE_TOP+2, title, MENU_TITLE_COLOR);
|
||||
}
|
||||
|
||||
if (scrollbar_X && linesCount > NUM_BODY_LINES) {
|
||||
@@ -251,24 +247,133 @@ int8_t switchMenuItem(coord_t x, coord_t y, int8_t value, LcdFlags attr, evt_t e
|
||||
return value;
|
||||
}
|
||||
|
||||
void drawSlider(coord_t x, coord_t y, uint8_t value, uint8_t max, uint8_t attr)
|
||||
void drawTrimSquare(coord_t x, coord_t y)
|
||||
{
|
||||
const int width = 100;
|
||||
lcdDrawSolidFilledRect(x-2, y, 15, 15, TITLE_BGCOLOR);
|
||||
lcdDrawBitmapPattern(x-2, y, LBM_TRIM_SHADOW, TEXT_COLOR);
|
||||
}
|
||||
|
||||
// The bar
|
||||
lcdDrawBitmapPattern(x, y + 8, LBM_SLIDER_BAR_LEFT, value <= 0 ? LINE_COLOR : TEXT_INVERTED_BGCOLOR);
|
||||
int w = value * (width - 8) / max;
|
||||
if (value > 0)
|
||||
lcdDrawSolidFilledRect(x + 4, y + 8, w, 4, TEXT_INVERTED_BGCOLOR);
|
||||
if (value < max)
|
||||
lcdDrawSolidFilledRect(x + 4 + w, y + 8, width - 8 - w, 4, LINE_COLOR);
|
||||
lcdDrawBitmapPattern(x + width - 4, y + 8, LBM_SLIDER_BAR_RIGHT, value >= max ? TEXT_INVERTED_BGCOLOR : LINE_COLOR);
|
||||
void drawHorizontalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidVerticalLine(x+8, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawSolidVerticalLine(x+2, y+3, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawSolidVerticalLine(xm, ym, 9, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
// The point
|
||||
lcdDrawBitmapPattern(x + w - 4, y + 2, LBM_SLIDER_POINT_OUT, TEXT_COLOR);
|
||||
lcdDrawBitmapPattern(x + w - 4, y + 2, LBM_SLIDER_POINT_MID, TEXT_BGCOLOR);
|
||||
if (attr && (!(attr & BLINK) || !BLINK_ON_PHASE))
|
||||
lcdDrawBitmapPattern(x + w - 4, y + 2, LBM_SLIDER_POINT_IN, TEXT_INVERTED_BGCOLOR);
|
||||
void drawVerticalTrimPosition(coord_t x, coord_t y, int16_t dir)
|
||||
{
|
||||
drawTrimSquare(x, y);
|
||||
if (dir >= 0) {
|
||||
lcdDrawSolidHorizontalLine(x+1, y+4, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
if (dir <= 0) {
|
||||
lcdDrawSolidHorizontalLine(x+1, y+10, 9, TEXT_INVERTED_COLOR);
|
||||
}
|
||||
// if (exttrim) {
|
||||
// lcdDrawSolidHorizontalLine(xm-1, ym, 3, TEXT_INVERTED_COLOR);
|
||||
// }
|
||||
}
|
||||
|
||||
void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
{
|
||||
if (steps) {
|
||||
int delta = len / steps;
|
||||
for (int i = 0; i <= len; i += delta) {
|
||||
if ((options & OPTION_SLIDER_BIG_TICKS) && (i == 0 || i == len / 2 || i == len))
|
||||
lcdDrawSolidHorizontalLine(x, y + i, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawSolidHorizontalLine(x + 2, y + i, 9, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x + 1, y, LBM_VTRIM_FRAME, TEXT_COLOR);
|
||||
/* if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE);
|
||||
}
|
||||
} */
|
||||
}
|
||||
y += len - (val - min) * len / (max - min) - 5;
|
||||
if (options & OPTION_SLIDER_TRIM_BUTTON) {
|
||||
drawVerticalTrimPosition(x, y - 2, val);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_NUMBER_BUTTON) {
|
||||
drawTrimSquare(x, y - 2);
|
||||
lcdDrawChar(x + 2, y - 1, '0' + val, SMLSIZE | TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else {
|
||||
drawTrimSquare(x, y - 2);
|
||||
}
|
||||
}
|
||||
|
||||
void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
{
|
||||
int w = (val - min) * len / (max - min);
|
||||
if (options & OPTION_SLIDER_TICKS) {
|
||||
if (steps) {
|
||||
int delta = len / steps;
|
||||
for (int i = 0; i <= len; i += delta) {
|
||||
if ((options & OPTION_SLIDER_BIG_TICKS) && (i == 0 || i == len / 2 || i == len))
|
||||
lcdDrawSolidVerticalLine(x + i, y, 13, TEXT_COLOR);
|
||||
else
|
||||
lcdDrawSolidVerticalLine(x + i, y + 2, 9, TEXT_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (options & OPTION_SLIDER_EMPTY_BAR) {
|
||||
lcdDrawBitmapPattern(x, y + 1, LBM_HTRIM_FRAME, TEXT_COLOR);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_DBL_COLOR) {
|
||||
lcdDrawBitmapPattern(x, y + 8, LBM_SLIDER_BAR_LEFT, w <= 0 ? LINE_COLOR : TEXT_INVERTED_BGCOLOR);
|
||||
if (w > 4)
|
||||
lcdDrawSolidFilledRect(x + 4, y + 8, w - 4, 4, TEXT_INVERTED_BGCOLOR);
|
||||
if (w < len - 4)
|
||||
lcdDrawSolidFilledRect(x + w, y + 8, len - w - 4, 4, LINE_COLOR);
|
||||
lcdDrawBitmapPattern(x + len - 4, y + 8, LBM_SLIDER_BAR_RIGHT, w >= len ? TEXT_INVERTED_BGCOLOR : LINE_COLOR);
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x, y + 8, LBM_SLIDER_BAR_LEFT, LINE_COLOR);
|
||||
lcdDrawSolidFilledRect(x + 4, y + 8, len - 8, 4, LINE_COLOR);
|
||||
lcdDrawBitmapPattern(x + len - 4, y + 8, LBM_SLIDER_BAR_RIGHT, LINE_COLOR);
|
||||
//
|
||||
/* if (g_model.displayTrims != DISPLAY_TRIMS_NEVER && trim != 0) {
|
||||
if (g_model.displayTrims == DISPLAY_TRIMS_ALWAYS || (trimsDisplayTimer > 0 && (trimsDisplayMask & (1<<i)))) {
|
||||
lcdDrawNumber((stickIndex==0 ? TRIM_LH_X : TRIM_RH_X)+(trim>0 ? -20 : 50), ym+1, trim, TINSIZE);
|
||||
}
|
||||
} */
|
||||
}
|
||||
x += w - 5;
|
||||
if (options & OPTION_SLIDER_TRIM_BUTTON) {
|
||||
drawHorizontalTrimPosition(x, y - 1, val);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_NUMBER_BUTTON) {
|
||||
drawTrimSquare(x, y - 1);
|
||||
lcdDrawChar(x + 2, y, '0' + val, SMLSIZE | TEXT_INVERTED_COLOR);
|
||||
}
|
||||
else if (options & OPTION_SLIDER_SQUARE_BUTTON) {
|
||||
drawTrimSquare(x, y - 1);
|
||||
}
|
||||
else {
|
||||
lcdDrawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_OUT, TEXT_COLOR);
|
||||
lcdDrawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_MID, TEXT_BGCOLOR);
|
||||
if ((options & INVERS) && (!(options & BLINK) || !BLINK_ON_PHASE))
|
||||
lcdDrawBitmapPattern(x, y + 2, LBM_SLIDER_POINT_IN, TEXT_INVERTED_BGCOLOR);
|
||||
}
|
||||
}
|
||||
|
||||
void drawSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
|
||||
{
|
||||
if (options & OPTION_SLIDER_VERTICAL)
|
||||
drawVerticalSlider(x, y, len, val, min, max, steps, options);
|
||||
else
|
||||
drawHorizontalSlider(x, y, len, val, min, max, steps, options);
|
||||
}
|
||||
|
||||
#if defined(GVARS)
|
||||
|
||||
@@ -427,6 +427,7 @@ enum UartModes {
|
||||
#define LEN_SWITCH_NAME 3
|
||||
#define LEN_ANA_NAME 3
|
||||
#define LEN_MODEL_FILENAME 16
|
||||
#define LEN_BLUETOOTH_NAME 10
|
||||
#define EXTRA_GENERAL_FIELDS \
|
||||
EXTRA_GENERAL_FIELDS_ARM \
|
||||
uint8_t serial2Mode:6; \
|
||||
@@ -436,7 +437,9 @@ enum UartModes {
|
||||
uint8_t potsConfig; /* two bits per pot */ \
|
||||
char switchNames[NUM_SWITCHES][LEN_SWITCH_NAME]; \
|
||||
char anaNames[NUM_STICKS+NUM_POTS][LEN_ANA_NAME]; \
|
||||
char currModelFilename[LEN_MODEL_FILENAME+1];
|
||||
char currModelFilename[LEN_MODEL_FILENAME+1]; \
|
||||
uint8_t bluetoothEnable; \
|
||||
char bluetoothName[LEN_BLUETOOTH_NAME];
|
||||
#elif defined(PCBFLAMENCO)
|
||||
#define LEN_SWITCH_NAME 3
|
||||
#define LEN_ANA_NAME 3
|
||||
|
||||
@@ -39,7 +39,7 @@ const pm_char STR_OPEN9X[] PROGMEM =
|
||||
#endif
|
||||
ISTR(TRNMODE)
|
||||
ISTR(TRNCHN)
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
ISTR(UART3MODES)
|
||||
ISTR(SWTYPES)
|
||||
ISTR(POTTYPES)
|
||||
@@ -582,9 +582,9 @@ const pm_char STR_MODEL_SELECT[] PROGMEM = TR_MODEL_SELECT;
|
||||
const pm_char STR_MODULE[] PROGMEM = TR_MODULE;
|
||||
const pm_char STR_ENABLE_POPUP[] PROGMEM = TR_ENABLE_POPUP;
|
||||
const pm_char STR_DISABLE_POPUP[] PROGMEM = TR_DISABLE_POPUP;
|
||||
const pm_char STR_POPUP[] PROGMEM = TR_POPUP;
|
||||
const pm_char STR_MIN[] PROGMEM = TR_MIN;
|
||||
const pm_char STR_MAX[] PROGMEM = TR_MAX;
|
||||
const pm_char STR_POPUP[] PROGMEM = TR_POPUP;
|
||||
const pm_char STR_MIN[] PROGMEM = TR_MIN;
|
||||
const pm_char STR_MAX[] PROGMEM = TR_MAX;
|
||||
const pm_char STR_CURVE_PRESET[] PROGMEM = TR_CURVE_PRESET;
|
||||
const pm_char STR_PRESET[] PROGMEM = TR_PRESET;
|
||||
const pm_char STR_MIRROR[] PROGMEM = TR_MIRROR;
|
||||
|
||||
@@ -89,7 +89,7 @@ extern const pm_char STR_OPEN9X[];
|
||||
#define OFS_TRNMODE (OFS_VBEEPMODE + sizeof(TR_VBEEPMODE))
|
||||
#endif
|
||||
#define OFS_TRNCHN (OFS_TRNMODE + sizeof(TR_TRNMODE))
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
#define OFS_UART3MODES (OFS_TRNCHN + sizeof(TR_TRNCHN))
|
||||
#define OFS_SWTYPES (OFS_UART3MODES + sizeof(TR_UART3MODES))
|
||||
#define OFS_POTTYPES (OFS_SWTYPES + sizeof(TR_SWTYPES))
|
||||
@@ -827,9 +827,9 @@ extern const pm_char STR_BLCOLOR[];
|
||||
extern const pm_char STR_MODULE[];
|
||||
extern const pm_char STR_ENABLE_POPUP[];
|
||||
extern const pm_char STR_DISABLE_POPUP[];
|
||||
extern const pm_char STR_POPUP[];
|
||||
extern const pm_char STR_MIN[];
|
||||
extern const pm_char STR_MAX[];
|
||||
extern const pm_char STR_POPUP[];
|
||||
extern const pm_char STR_MIN[];
|
||||
extern const pm_char STR_MAX[];
|
||||
extern const pm_char STR_CURVE_PRESET[];
|
||||
extern const pm_char STR_PRESET[];
|
||||
extern const pm_char STR_MIRROR[];
|
||||
|
||||
Reference in New Issue
Block a user