Bsongis/gui refactoring for x7 d (#3701)
* [X7D] New board added * Cosmetics
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/widgets.cpp
|
||||
)
|
||||
|
||||
if(HELI)
|
||||
set(GUI_SRC ${GUI_SRC} ../common/stdlcd/model_heli.cpp)
|
||||
endif()
|
||||
|
||||
if(ARCH STREQUAL ARM)
|
||||
add_definitions(-DGRAPHICS)
|
||||
set(CURVE_EDIT_SRC ../common/stdlcd/model_curve_edit.cpp)
|
||||
else()
|
||||
set(CURVE_EDIT_SRC model_curve_simple_edit.cpp)
|
||||
endif()
|
||||
|
||||
if(CURVES)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/model_curves.cpp
|
||||
${CURVE_EDIT_SRC}
|
||||
)
|
||||
endif()
|
||||
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
void displayPresetChoice(uint8_t event)
|
||||
{
|
||||
runPopupWarning(event);
|
||||
lcdDrawNumber(WARNING_LINE_X+FW*7, WARNING_LINE_Y, 45*warningInputValue/4, LEFT|INVERS);
|
||||
lcdDrawChar(lcdLastPos, WARNING_LINE_Y, '@', INVERS);
|
||||
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
int k = 25 * warningInputValue;
|
||||
int dx = 2000 / (5+crv.points-1);
|
||||
for (uint8_t i=0; i<5+crv.points; i++) {
|
||||
int x = -1000 + i * dx;
|
||||
points[i] = div_and_round(div_and_round(k * x, 100), 10);
|
||||
}
|
||||
if (crv.type == CURVE_TYPE_CUSTOM) {
|
||||
resetCustomCurveX(points, 5+crv.points);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onCurveOneMenu(const char * result)
|
||||
{
|
||||
if (result == STR_CURVE_PRESET) {
|
||||
POPUP_INPUT(STR_PRESET, displayPresetChoice, 0, -4, 4);
|
||||
}
|
||||
else if (result == STR_MIRROR) {
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
for (int i=0; i<5+crv.points; i++)
|
||||
points[i] = -points[i];
|
||||
}
|
||||
else if (result == STR_CLEAR) {
|
||||
CurveInfo & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
for (int i=0; i<5+crv.points; i++)
|
||||
points[i] = 0;
|
||||
if (crv.type == CURVE_TYPE_CUSTOM) {
|
||||
resetCustomCurveX(points, 5+crv.points);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelCurveOne(uint8_t event)
|
||||
{
|
||||
static uint8_t pointsOfs = 0;
|
||||
CurveData & crv = g_model.curves[s_curveChan];
|
||||
int8_t * points = curveAddress(s_curveChan);
|
||||
|
||||
drawStringWithIndex(PSIZE(TR_MENUCURVES)*FW+FW, 0, "CV", s_curveChan+1);
|
||||
|
||||
#if LCD_W >= 212
|
||||
lcdDrawText(11*FW+FW/2, 0, TR_PT "\002X\006Y");
|
||||
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
|
||||
#endif
|
||||
|
||||
SIMPLE_SUBMENU(STR_MENUCURVES, 4 + 5+crv.points + (crv.type==CURVE_TYPE_CUSTOM ? 5+crv.points-2 : 0));
|
||||
|
||||
// Curve name
|
||||
lcdDrawTextAlignedLeft(FH + 1, STR_NAME);
|
||||
editName(INDENT_WIDTH, 2 * FH + 1, crv.name, sizeof(crv.name), event, menuVerticalPosition == 0);
|
||||
|
||||
// Curve type
|
||||
lcdDrawTextAlignedLeft(3 * FH + 1, NO_INDENT(STR_TYPE));
|
||||
LcdFlags attr = (menuVerticalPosition == 1 ? (s_editMode > 0 ? INVERS | BLINK : INVERS) : 0);
|
||||
lcdDrawTextAtIndex(INDENT_WIDTH, 4 * FH + 1, STR_CURVE_TYPES, crv.type, attr);
|
||||
if (attr) {
|
||||
uint8_t newType = checkIncDecModelZero(event, crv.type, CURVE_TYPE_LAST);
|
||||
if (newType != crv.type) {
|
||||
for (int i = 1; i < 4 + crv.points; i++) {
|
||||
points[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5 + crv.points, i)), s_curveChan));
|
||||
}
|
||||
moveCurve(s_curveChan, checkIncDec_Ret > 0 ? 3 + crv.points : -3 - crv.points);
|
||||
if (newType == CURVE_TYPE_CUSTOM) {
|
||||
resetCustomCurveX(points, 5 + crv.points);
|
||||
}
|
||||
crv.type = newType;
|
||||
}
|
||||
}
|
||||
|
||||
attr = (menuVerticalPosition==2 ? (s_editMode>0 ? INVERS|BLINK : INVERS) : 0);
|
||||
lcdDrawTextAlignedLeft(5*FH+1, STR_COUNT);
|
||||
lcdDrawNumber(INDENT_WIDTH, 6*FH+1, 5+crv.points, LEFT|attr);
|
||||
lcdDrawText(lcdLastPos, 6*FH+1, STR_PTS, attr);
|
||||
if (attr) {
|
||||
int8_t count = checkIncDecModel(event, crv.points, -3, 12); // 2pts - 17pts
|
||||
if (checkIncDec_Ret) {
|
||||
int8_t newPoints[MAX_POINTS_PER_CURVE];
|
||||
newPoints[0] = points[0];
|
||||
newPoints[4+count] = points[4+crv.points];
|
||||
for (int i=1; i<4+count; i++)
|
||||
newPoints[i] = calcRESXto100(applyCustomCurve(calc100toRESX(getCurveX(5+count, i)), s_curveChan));
|
||||
moveCurve(s_curveChan, checkIncDec_Ret*(crv.type==CURVE_TYPE_CUSTOM?2:1));
|
||||
for (int i=0; i<5+count; i++) {
|
||||
points[i] = newPoints[i];
|
||||
if (crv.type == CURVE_TYPE_CUSTOM && i!=0 && i!=4+count)
|
||||
points[5+count+i-1] = getCurveX(5+count, i);
|
||||
}
|
||||
crv.points = count;
|
||||
}
|
||||
}
|
||||
|
||||
lcdDrawTextAlignedLeft(7*FH+1, STR_SMOOTH);
|
||||
drawCheckBox(7 * FW, 7 * FH + 1, crv.smooth, menuVerticalPosition == 3 ? INVERS : 0);
|
||||
if (menuVerticalPosition==3) crv.smooth = checkIncDecModel(event, crv.smooth, 0, 1);
|
||||
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
pointsOfs = 0;
|
||||
SET_SCROLLBAR_X(0);
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
if (menuVerticalPosition > 1) {
|
||||
killEvents(event);
|
||||
POPUP_MENU_ADD_ITEM(STR_CURVE_PRESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_MIRROR);
|
||||
POPUP_MENU_ADD_ITEM(STR_CLEAR);
|
||||
POPUP_MENU_START(onCurveOneMenu);
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(PCBTARANIS) && LCD >= 212
|
||||
// TODO
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
pushMenu(menuChannelsView);
|
||||
killEvents(event);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
drawCurve(FW);
|
||||
|
||||
uint8_t posY = FH+1;
|
||||
attr = (s_editMode > 0 ? INVERS|BLINK : INVERS);
|
||||
for (uint8_t i=0; i<5+crv.points; i++) {
|
||||
point_t point = getPoint(i);
|
||||
uint8_t selectionMode = 0;
|
||||
if (crv.type==CURVE_TYPE_CUSTOM) {
|
||||
if (menuVerticalPosition==4+2*i || (i==5+crv.points-1 && menuVerticalPosition==4+5+crv.points+5+crv.points-2-1))
|
||||
selectionMode = 2;
|
||||
else if (i>0 && menuVerticalPosition==3+2*i)
|
||||
selectionMode = 1;
|
||||
}
|
||||
else if (menuVerticalPosition == 4+i) {
|
||||
selectionMode = 2;
|
||||
}
|
||||
|
||||
if (i>=pointsOfs && i<pointsOfs+7) {
|
||||
int8_t x = getCurveX(5+crv.points, i);
|
||||
if (crv.type==CURVE_TYPE_CUSTOM && i>0 && i<5+crv.points-1) {
|
||||
x = points[5+crv.points+i-1];
|
||||
}
|
||||
lcdDrawNumber(6+10*FW+FW/2, posY, i+1, LEFT);
|
||||
lcdDrawNumber(3+14*FW, posY, x, LEFT|(selectionMode==1?attr:0));
|
||||
lcdDrawNumber(3+18*FW, posY, points[i], LEFT|(selectionMode==2?attr:0));
|
||||
posY += FH;
|
||||
}
|
||||
|
||||
if (selectionMode > 0) {
|
||||
// do selection square
|
||||
lcdDrawFilledRect(point.x-FW-1, point.y-2, 5, 5, SOLID, FORCE);
|
||||
lcdDrawFilledRect(point.x-FW, point.y-1, 3, 3, SOLID);
|
||||
if (s_editMode > 0) {
|
||||
if (selectionMode == 1)
|
||||
CHECK_INCDEC_MODELVAR(event, points[5+crv.points+i-1], i==1 ? -100 : points[5+crv.points+i-2], i==5+crv.points-2 ? 100 : points[5+crv.points+i]); // edit X
|
||||
else if (selectionMode == 2)
|
||||
CHECK_INCDEC_MODELVAR(event, points[i], -100, 100);
|
||||
}
|
||||
if (i < pointsOfs)
|
||||
pointsOfs = i;
|
||||
else if (i > pointsOfs+6)
|
||||
pointsOfs = i-6;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#if defined(GVARS_IN_CURVES_SCREEN)
|
||||
#warning "define still not added to CMakeLists.txt"
|
||||
#define CURVE_SELECTED() (sub >= 0 && sub < MAX_CURVES)
|
||||
#define GVAR_SELECTED() (sub >= MAX_CURVES)
|
||||
#else
|
||||
#define CURVE_SELECTED() (sub >= 0)
|
||||
#endif
|
||||
|
||||
void drawCurve(coord_t offset)
|
||||
{
|
||||
drawFunction(applyCurrentCurve, offset);
|
||||
|
||||
uint8_t i = 0;
|
||||
do {
|
||||
point_t point = getPoint(i);
|
||||
i++;
|
||||
if (point.x == 0) break;
|
||||
lcdDrawFilledRect(point.x-offset, point.y-1, 3, 3, SOLID, FORCE); // do markup square
|
||||
} while (1);
|
||||
}
|
||||
|
||||
void menuModelCurvesAll(uint8_t event)
|
||||
{
|
||||
#if defined(GVARS_IN_CURVES_SCREEN)
|
||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, MENU_MODEL_CURVES, HEADER_LINE+MAX_CURVES+MAX_GVARS);
|
||||
#else
|
||||
SIMPLE_MENU(STR_MENUCURVES, menuTabModel, MENU_MODEL_CURVES, HEADER_LINE+MAX_CURVES);
|
||||
#endif
|
||||
|
||||
int8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
switch (event) {
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
case EVT_ROTARY_BREAK:
|
||||
#endif
|
||||
#if !defined(PCBTARANIS)
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
#endif
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
if (CURVE_SELECTED() && !READ_ONLY()) {
|
||||
s_curveChan = sub;
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
LcdFlags attr = (sub == k ? INVERS : 0);
|
||||
#if defined(GVARS_IN_CURVES_SCREEN)
|
||||
if (k >= MAX_CURVES) {
|
||||
drawStringWithIndex(0, y, STR_GV, k-MAX_CURVES+1);
|
||||
if (GVAR_SELECTED()) {
|
||||
if (attr && s_editMode>0) attr |= BLINK;
|
||||
lcdDrawNumber(10*FW, y, GVAR_VALUE(k-MAX_CURVES, -1), attr);
|
||||
if (attr) g_model.gvars[k-MAX_CURVES] = checkIncDec(event, g_model.gvars[k-MAX_CURVES], -1000, 1000, EE_MODEL);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
drawStringWithIndex(0, y, STR_CV, k+1, attr);
|
||||
#if defined(CPUARM)
|
||||
CurveData & crv = g_model.curves[k];
|
||||
editName(4*FW, y, crv.name, sizeof(crv.name), 0, 0);
|
||||
#if LCD_W >= 212
|
||||
lcdDrawNumber(11*FW, y, 5+crv.points, LEFT);
|
||||
lcdDrawText(lcdLastPos, y, STR_PTS, 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (CURVE_SELECTED()) {
|
||||
s_curveChan = sub;
|
||||
#if !defined(CPUARM) || LCD_W >= 212
|
||||
drawCurve(23);
|
||||
#else
|
||||
drawCurve(10);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, uint8_t event, LcdFlags flags)
|
||||
{
|
||||
coord_t x1 = x;
|
||||
if (flags & RIGHT) {
|
||||
x1 -= 8*FW;
|
||||
flags -= RIGHT;
|
||||
}
|
||||
else {
|
||||
x += 8*FW;
|
||||
}
|
||||
|
||||
lcdDrawTextAtIndex(x1, y, "\004DiffExpoFuncCstm", curve.type, menuHorizontalPosition==0 ? flags : 0);
|
||||
if (flags && menuHorizontalPosition==0) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, curve.type, CURVE_REF_CUSTOM);
|
||||
if (checkIncDec_Ret) curve.value = 0;
|
||||
}
|
||||
switch (curve.type) {
|
||||
case CURVE_REF_DIFF:
|
||||
case CURVE_REF_EXPO:
|
||||
curve.value = GVAR_MENU_ITEM(x, y, curve.value, -100, 100, RIGHT | (menuHorizontalPosition==1 ? flags : 0), 0, event);
|
||||
break;
|
||||
case CURVE_REF_FUNC:
|
||||
lcdDrawTextAtIndex(x, y, STR_VCURVEFUNC, curve.value, RIGHT | (menuHorizontalPosition==1 ? flags : 0));
|
||||
if (flags && menuHorizontalPosition==1) CHECK_INCDEC_MODELVAR_ZERO(event, curve.value, CURVE_BASE-1);
|
||||
break;
|
||||
case CURVE_REF_CUSTOM:
|
||||
drawCurveName(x, y, curve.value, RIGHT | (menuHorizontalPosition==1 ? flags : 0));
|
||||
if (flags && menuHorizontalPosition==1) {
|
||||
if (event==EVT_KEY_LONG(KEY_ENTER) && curve.value!=0) {
|
||||
s_curveChan = (curve.value<0 ? -curve.value-1 : curve.value-1);
|
||||
pushMenu(menuModelCurveOne);
|
||||
}
|
||||
else {
|
||||
CHECK_INCDEC_MODELVAR(event, curve.value, -MAX_CURVES, MAX_CURVES);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* 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 MenuModelHeliItems {
|
||||
ITEM_HELI_SWASHTYPE,
|
||||
ITEM_HELI_SWASHRING,
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
ITEM_HELI_ELE,
|
||||
ITEM_HELI_ELE_WEIGHT,
|
||||
ITEM_HELI_AIL,
|
||||
ITEM_HELI_AIL_WEIGHT,
|
||||
ITEM_HELI_COL,
|
||||
ITEM_HELI_COL_WEIGHT,
|
||||
#else
|
||||
ITEM_HELI_COLLECTIVE,
|
||||
ITEM_HELI_ELEDIRECTION,
|
||||
ITEM_HELI_AILDIRECTION,
|
||||
ITEM_HELI_COLDIRECTION,
|
||||
#endif
|
||||
ITEM_HELI_MAX
|
||||
};
|
||||
|
||||
#if LCD_W >= 212
|
||||
#define MODEL_HELI_2ND_COLUMN (LCD_W-17*FW-MENUS_SCROLLBAR_WIDTH)
|
||||
#else
|
||||
#define MODEL_HELI_2ND_COLUMN (14*FW)
|
||||
#endif
|
||||
|
||||
void menuModelHeli(uint8_t event)
|
||||
{
|
||||
SIMPLE_MENU(STR_MENUHELISETUP, menuTabModel, MENU_MODEL_HELI, HEADER_LINE+ITEM_HELI_MAX);
|
||||
|
||||
uint8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
#else
|
||||
for (uint8_t k=0; k<ITEM_HELI_MAX; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
#endif
|
||||
LcdFlags blink = (s_editMode > 0 ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
switch (k) {
|
||||
case ITEM_HELI_SWASHTYPE:
|
||||
g_model.swashR.type = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_SWASHTYPE, STR_VSWASHTYPE, g_model.swashR.type, 0, SWASH_TYPE_MAX, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_SWASHRING:
|
||||
lcdDrawTextAlignedLeft(y, STR_SWASHRING);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.value, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.swashR.value, 100);
|
||||
break;
|
||||
|
||||
#if defined(VIRTUAL_INPUTS)
|
||||
case ITEM_HELI_ELE:
|
||||
lcdDrawTextAlignedLeft(y, STR_ELEVATOR);
|
||||
drawSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.elevatorSource, 0, MIXSRC_LAST_CH);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_ELE_WEIGHT:
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.elevatorWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.elevatorWeight, -100, 100);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_AIL:
|
||||
lcdDrawTextAlignedLeft(y, STR_AILERON);
|
||||
drawSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.aileronSource, 0, MIXSRC_LAST_CH);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_AIL_WEIGHT:
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.aileronWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.aileronWeight, -100, 100);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_COL:
|
||||
lcdDrawTextAlignedLeft(y, STR_COLLECTIVE);
|
||||
drawSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr);
|
||||
if (attr) CHECK_INCDEC_MODELSOURCE(event, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_COL_WEIGHT:
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_WEIGHT);
|
||||
lcdDrawNumber(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveWeight, LEFT|attr);
|
||||
if (attr) CHECK_INCDEC_MODELVAR(event, g_model.swashR.collectiveWeight, -100, 100);
|
||||
break;
|
||||
#else
|
||||
case ITEM_HELI_COLLECTIVE:
|
||||
g_model.swashR.collectiveSource = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_COLLECTIVE, NULL, g_model.swashR.collectiveSource, 0, MIXSRC_LAST_CH, attr, event);
|
||||
drawSource(MODEL_HELI_2ND_COLUMN, y, g_model.swashR.collectiveSource, attr);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_ELEDIRECTION:
|
||||
g_model.swashR.invertELE = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_ELEDIRECTION, STR_MMMINV, g_model.swashR.invertELE, 0, 1, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_AILDIRECTION:
|
||||
g_model.swashR.invertAIL = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_AILDIRECTION, STR_MMMINV, g_model.swashR.invertAIL, 0, 1, attr, event);
|
||||
break;
|
||||
|
||||
case ITEM_HELI_COLDIRECTION:
|
||||
g_model.swashR.invertCOL = selectMenuItem(MODEL_HELI_2ND_COLUMN, y, STR_COLDIRECTION, STR_MMMINV, g_model.swashR.invertCOL, 0, 1, attr, event);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const pm_char * str, uint8_t idx, LcdFlags att)
|
||||
{
|
||||
lcdDrawText(x, y, str, att & ~LEADING0);
|
||||
lcdDrawNumber(lcdNextPos, y, idx, att|LEFT, 2);
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
FlightModesType editFlightModes(coord_t x, coord_t y, uint8_t event, FlightModesType value, uint8_t attr)
|
||||
{
|
||||
int posHorz = menuHorizontalPosition;
|
||||
|
||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
LcdFlags flags = 0;
|
||||
if (attr) {
|
||||
flags |= INVERS;
|
||||
if (posHorz==p) flags |= BLINK;
|
||||
}
|
||||
if (value & (1<<p))
|
||||
lcdDrawChar(x, y, ' ', flags|FIXEDWIDTH);
|
||||
else
|
||||
lcdDrawChar(x, y, '0'+p, flags);
|
||||
x += FW;
|
||||
}
|
||||
|
||||
if (attr) {
|
||||
if (s_editMode && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
value ^= (1<<posHorz);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user