Merge with latest 2.3
This commit is contained in:
@@ -300,7 +300,7 @@ void showAlertBox(const char * title, const char * text, const char * action , u
|
||||
#define LOAD_MODEL_BITMAP()
|
||||
|
||||
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
|
||||
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetryFrsky
|
||||
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetry
|
||||
#define IS_OTHER_VIEW_DISPLAYED() false
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
|
||||
|
||||
@@ -45,16 +45,16 @@ inline bool isModelMenuDisplayed()
|
||||
void onMainViewMenu(const char * result);
|
||||
void menuFirstCalib(event_t event);
|
||||
void menuMainView(event_t event);
|
||||
void menuViewTelemetryFrsky(event_t event);
|
||||
void menuViewTelemetry(event_t event);
|
||||
void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
|
||||
|
||||
enum MenuRadioIndexes
|
||||
{
|
||||
MENU_RADIO_SETUP,
|
||||
CASE_SDCARD(MENU_RADIO_SD_MANAGER)
|
||||
#if defined(LUA) || defined(PXX2) || defined(MULTIMODULE)
|
||||
MENU_RADIO_TOOLS,
|
||||
#endif
|
||||
CASE_SDCARD(MENU_RADIO_SD_MANAGER)
|
||||
MENU_RADIO_SETUP,
|
||||
MENU_RADIO_SPECIAL_FUNCTIONS,
|
||||
MENU_RADIO_TRAINER,
|
||||
MENU_RADIO_HARDWARE,
|
||||
@@ -76,11 +76,11 @@ void menuRadioPowerMeter(event_t event);
|
||||
void menuRadioCalibration(event_t event);
|
||||
|
||||
static const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT] = {
|
||||
menuRadioSetup,
|
||||
CASE_SDCARD(menuRadioSdManager)
|
||||
#if defined(LUA) || defined(PXX2) || defined(MULTIMODULE)
|
||||
menuRadioTools,
|
||||
#endif
|
||||
CASE_SDCARD(menuRadioSdManager)
|
||||
menuRadioSetup,
|
||||
menuRadioSpecialFunctions,
|
||||
menuRadioTrainer,
|
||||
menuRadioHardware,
|
||||
|
||||
@@ -113,7 +113,11 @@ void menuModelFlightModeOne(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, STR_TRIMS);
|
||||
for (uint8_t t = 0; t < NUM_STICKS; t++) {
|
||||
drawTrimMode(MIXES_2ND_COLUMN + (t*2*FW), y, s_currIdx, t, menuHorizontalPosition == t ? attr : 0);
|
||||
#if defined(NAVIGATION_9X)
|
||||
if (s_editMode > 0 && attr && menuHorizontalPosition == t) {
|
||||
#else
|
||||
if (s_editMode >= 0 && attr && menuHorizontalPosition == t) {
|
||||
#endif
|
||||
trim_t & v = fm->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);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ void menuModelLogicalSwitchOne(event_t event)
|
||||
uint8_t new_cstate = lswFamily(cs->func);
|
||||
if (cstate != new_cstate) {
|
||||
if (new_cstate == LS_FAMILY_TIMER) {
|
||||
cs->v1 = cs->v2 = 0;
|
||||
cs->v1 = cs->v2 = -119;
|
||||
}
|
||||
else if (new_cstate == LS_FAMILY_EDGE) {
|
||||
cs->v1 = 0; cs->v2 = -129; cs->v3 = 0;
|
||||
|
||||
@@ -215,6 +215,9 @@ void onLimitsMenu(const char *result)
|
||||
else if (result == STR_EDIT) {
|
||||
pushMenu(menuModelLimitsOne);
|
||||
}
|
||||
else if (result == STR_COPY_MIN_MAX_TO_OUTPUTS) {
|
||||
copyMinMaxToOutputs(s_currIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelLimits(event_t event)
|
||||
@@ -240,6 +243,7 @@ void menuModelLimits(event_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_MIN_MAX_TO_OUTPUTS);
|
||||
POPUP_MENU_START(onLimitsMenu);
|
||||
}
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ void menuMainView(event_t event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_GENERAL_MENU:
|
||||
pushMenu(menuRadioSetup);
|
||||
pushMenu(menuRadioTools);
|
||||
killEvents(event);
|
||||
break;
|
||||
#endif
|
||||
@@ -397,7 +397,7 @@ void menuMainView(event_t event)
|
||||
#endif
|
||||
|
||||
case EVT_KEY_TELEMETRY:
|
||||
chainMenu(menuViewTelemetryFrsky);
|
||||
chainMenu(menuViewTelemetry);
|
||||
killEvents(event);
|
||||
break;
|
||||
|
||||
|
||||
@@ -206,79 +206,3 @@ bool displayTelemetryScreen()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
enum NavigationDirection {
|
||||
none,
|
||||
up,
|
||||
down
|
||||
};
|
||||
#define decrTelemetryScreen() direction = up
|
||||
#define incrTelemetryScreen() direction = down
|
||||
|
||||
#if defined(NAVIGATION_XLITE)
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_LONG(KEY_LEFT) && IS_SHIFT_PRESSED())
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_LONG(KEY_RIGHT) && IS_SHIFT_PRESSED())
|
||||
#elif defined(NAVIGATION_X7)
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_LONG(KEY_PAGE))
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_BREAK(KEY_PAGE))
|
||||
#elif defined(NAVIGATION_9X)
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_LONG(KEY_UP))
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_LONG(KEY_DOWN))
|
||||
#else
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_FIRST(KEY_UP))
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_FIRST(KEY_DOWN))
|
||||
#endif
|
||||
|
||||
void menuViewTelemetryFrsky(event_t event)
|
||||
{
|
||||
enum NavigationDirection direction = none;
|
||||
|
||||
if (event == EVT_KEY_FIRST(KEY_EXIT) && TELEMETRY_SCREEN_TYPE(s_frsky_view) != TELEMETRY_SCREEN_TYPE_SCRIPT) {
|
||||
killEvents(event);
|
||||
chainMenu(menuMainView);
|
||||
}
|
||||
#if defined(LUA)
|
||||
else if (event == EVT_KEY_LONG(KEY_EXIT)) {
|
||||
killEvents(event);
|
||||
chainMenu(menuMainView);
|
||||
}
|
||||
#endif
|
||||
else if (EVT_KEY_PREVIOUS_VIEW(event)) {
|
||||
killEvents(event);
|
||||
decrTelemetryScreen();
|
||||
}
|
||||
else if (EVT_KEY_NEXT_VIEW(event)) {
|
||||
killEvents(event);
|
||||
incrTelemetryScreen();
|
||||
}
|
||||
else if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
}
|
||||
|
||||
for (int i=0; i<=TELEMETRY_SCREEN_TYPE_MAX; i++) {
|
||||
if (direction == up) {
|
||||
if (s_frsky_view-- == 0)
|
||||
s_frsky_view = TELEMETRY_VIEW_MAX;
|
||||
}
|
||||
else if (direction == down) {
|
||||
if (s_frsky_view++ == TELEMETRY_VIEW_MAX)
|
||||
s_frsky_view = 0;
|
||||
}
|
||||
else {
|
||||
direction = down;
|
||||
}
|
||||
if (displayTelemetryScreen()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
drawTelemetryTopBar();
|
||||
lcdDrawText(2*FW, 3*FH, "No Telemetry Screens");
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
#undef EVT_KEY_PREVIOUS_VIEW
|
||||
#undef EVT_KEY_NEXT_VIEW
|
||||
|
||||
@@ -301,7 +301,7 @@ FlightModesType editFlightModes(coord_t x, coord_t y, event_t event, FlightModes
|
||||
#endif
|
||||
|
||||
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
|
||||
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetryFrsky
|
||||
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetry
|
||||
#define IS_OTHER_VIEW_DISPLAYED() (menuHandlers[0] == menuMainViewChannelsMonitor || menuHandlers[0] == menuChannelsView)
|
||||
|
||||
#endif // _GUI_H_
|
||||
|
||||
@@ -21,11 +21,11 @@
|
||||
#include "opentx.h"
|
||||
|
||||
const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT] = {
|
||||
menuRadioSetup,
|
||||
menuRadioSdManager,
|
||||
#if defined(LUA) || defined(PXX2)
|
||||
menuRadioTools,
|
||||
#endif
|
||||
menuRadioSdManager,
|
||||
menuRadioSetup,
|
||||
menuRadioSpecialFunctions,
|
||||
menuRadioTrainer,
|
||||
menuRadioHardware,
|
||||
|
||||
@@ -39,7 +39,7 @@ void menuFirstCalib(event_t event);
|
||||
void menuMainViewChannelsMonitor(event_t event);
|
||||
void menuChannelsView(event_t event);
|
||||
void menuMainView(event_t event);
|
||||
void menuViewTelemetryFrsky(event_t event);
|
||||
void menuViewTelemetry(event_t event);
|
||||
void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomFunctionsContext * functionsContext);
|
||||
void menuModelNotes(event_t event);
|
||||
void menuStatisticsView(event_t event);
|
||||
@@ -52,11 +52,11 @@ void menuTraceBuffer(event_t event);
|
||||
#endif
|
||||
|
||||
enum MenuRadioIndexes {
|
||||
MENU_RADIO_SETUP,
|
||||
MENU_RADIO_SD_MANAGER,
|
||||
#if defined(LUA) || defined(PXX2) || defined(MULTIMODULE)
|
||||
MENU_RADIO_TOOLS,
|
||||
#endif
|
||||
MENU_RADIO_SD_MANAGER,
|
||||
MENU_RADIO_SETUP,
|
||||
MENU_RADIO_SPECIAL_FUNCTIONS,
|
||||
MENU_RADIO_TRAINER,
|
||||
MENU_RADIO_HARDWARE,
|
||||
|
||||
@@ -86,6 +86,9 @@ void onLimitsMenu(const char *result)
|
||||
copyTrimsToOffset(ch);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else if (result == STR_COPY_MIN_MAX_TO_OUTPUTS) {
|
||||
copyMinMaxToOutputs(ch);
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelLimits(event_t event)
|
||||
@@ -142,6 +145,7 @@ void menuModelLimits(event_t event)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_TRIMS_TO_OFS);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_STICKS_TO_OFS);
|
||||
POPUP_MENU_ADD_ITEM(STR_COPY_MIN_MAX_TO_OUTPUTS);
|
||||
POPUP_MENU_START(onLimitsMenu);
|
||||
}
|
||||
|
||||
|
||||
@@ -353,7 +353,7 @@ void menuModelSetup(event_t event)
|
||||
LABEL(InternalModule),
|
||||
INTERNAL_MODULE_TYPE_ROWS,
|
||||
MODULE_CHANNELS_ROWS(INTERNAL_MODULE),
|
||||
IF_NOT_ACCESS_MODULE_RF(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(isModuleFailsafeAvailable(INTERNAL_MODULE) ? (uint8_t)2 : (uint8_t)1)),
|
||||
IF_NOT_ACCESS_MODULE_RF(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(isModuleRangeAvailable(INTERNAL_MODULE)? (uint8_t)2 : (uint8_t)1)), // RxNum, Range check and Register buttons
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), // RxNum for ACCESS
|
||||
IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), // Failsafe
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 1), // Range check and Register buttons
|
||||
|
||||
@@ -455,7 +455,7 @@ void menuMainView(event_t event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_MENU):
|
||||
pushMenu(menuRadioSetup);
|
||||
pushMenu(menuRadioTools);
|
||||
killEvents(event);
|
||||
break;
|
||||
#endif
|
||||
@@ -470,7 +470,7 @@ void menuMainView(event_t event)
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_PAGE):
|
||||
chainMenu(menuViewTelemetryFrsky);
|
||||
chainMenu(menuViewTelemetry);
|
||||
killEvents(event);
|
||||
break;
|
||||
|
||||
|
||||
@@ -200,65 +200,3 @@ bool displayTelemetryScreen()
|
||||
return true;
|
||||
}
|
||||
|
||||
enum NavigationDirection {
|
||||
none,
|
||||
up,
|
||||
down
|
||||
};
|
||||
|
||||
#define decrTelemetryScreen() direction = up
|
||||
#define incrTelemetryScreen() direction = down
|
||||
|
||||
void menuViewTelemetryFrsky(event_t event)
|
||||
{
|
||||
enum NavigationDirection direction = none;
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_FIRST(KEY_EXIT):
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
killEvents(event);
|
||||
chainMenu(menuMainView);
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_PAGE):
|
||||
killEvents(event);
|
||||
// no break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_UP):
|
||||
decrTelemetryScreen();
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_PAGE):
|
||||
case EVT_KEY_FIRST(KEY_DOWN):
|
||||
incrTelemetryScreen();
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
killEvents(event);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i=0; i<=TELEMETRY_SCREEN_TYPE_MAX; i++) {
|
||||
if (direction == up) {
|
||||
if (s_frsky_view-- == 0)
|
||||
s_frsky_view = TELEMETRY_VIEW_MAX;
|
||||
}
|
||||
else if (direction == down) {
|
||||
if (s_frsky_view++ == TELEMETRY_VIEW_MAX)
|
||||
s_frsky_view = 0;
|
||||
}
|
||||
else {
|
||||
direction = down;
|
||||
}
|
||||
if (displayTelemetryScreen()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
drawTelemetryTopBar();
|
||||
lcdDrawText(8*FW, 3*FH, "No Telemetry Screens");
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
@@ -64,6 +64,10 @@ const uint8_t LBM_TOPMENU_TXBATT[] = {
|
||||
#include "mask_txbat.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_TOPMENU_TXBATT_CHARGING[] = {
|
||||
#include "mask_txbat_charging.lbm"
|
||||
};
|
||||
|
||||
const uint8_t LBM_TOPMENU_ANTENNA[] = {
|
||||
#include "mask_antenna.lbm"
|
||||
};
|
||||
|
||||
@@ -34,6 +34,7 @@ extern const uint8_t LBM_TOPMENU_VOLUME_3[];
|
||||
extern const uint8_t LBM_TOPMENU_VOLUME_4[];
|
||||
extern const uint8_t LBM_TOPMENU_VOLUME_SCALE[];
|
||||
extern const uint8_t LBM_TOPMENU_TXBATT[];
|
||||
extern const uint8_t LBM_TOPMENU_TXBATT_CHARGING[];
|
||||
extern const uint8_t LBM_HTRIM_FRAME[];
|
||||
extern const uint8_t LBM_VTRIM_FRAME[];
|
||||
extern const uint8_t LBM_TRIM_SHADOW[];
|
||||
|
||||
@@ -56,7 +56,7 @@ bool menuTextView(event_t event)
|
||||
}
|
||||
|
||||
for (int i=0; i<NUM_BODY_LINES; i++) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i*FH, reusableBuffer.viewText.lines[i]);
|
||||
lcd->drawTextMaxWidth(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + i * FH, reusableBuffer.viewText.lines[i], 0, LCD_W - 2 * MENUS_MARGIN_LEFT);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
@@ -16,6 +16,7 @@ set(GUI_SRC
|
||||
../common/stdlcd/radio_hardware.cpp
|
||||
../common/stdlcd/radio_version.cpp
|
||||
../common/stdlcd/radio_trainer.cpp
|
||||
../common/stdlcd/view_telemetry.cpp
|
||||
model_curve_edit.cpp
|
||||
)
|
||||
|
||||
|
||||
@@ -87,23 +87,7 @@ void menuRadioTools(event_t event)
|
||||
|
||||
uint8_t index = 0;
|
||||
|
||||
#if defined(INTERNAL_MODULE_PXX2)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER))
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_INT, menuRadioSpectrumAnalyser, INTERNAL_MODULE);
|
||||
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
addRadioModuleTool(index++, STR_POWER_METER_INT, menuRadioPowerMeter, INTERNAL_MODULE);
|
||||
#elif defined(INTERNAL_MODULE_MULTI)
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_INT, menuRadioSpectrumAnalyser, INTERNAL_MODULE);
|
||||
#endif
|
||||
#if defined(PXX2)|| defined(MULTIMODULE)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER) || isModuleMultimodule(EXTERNAL_MODULE))
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_EXT, menuRadioSpectrumAnalyser, EXTERNAL_MODULE);
|
||||
#endif
|
||||
#if defined(PXX2)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
||||
#endif
|
||||
|
||||
#if defined(LUA)
|
||||
FILINFO fno;
|
||||
@@ -127,6 +111,24 @@ void menuRadioTools(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(INTERNAL_MODULE_PXX2)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER))
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_INT, menuRadioSpectrumAnalyser, INTERNAL_MODULE);
|
||||
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
addRadioModuleTool(index++, STR_POWER_METER_INT, menuRadioPowerMeter, INTERNAL_MODULE);
|
||||
#elif defined(INTERNAL_MODULE_MULTI)
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_INT, menuRadioSpectrumAnalyser, INTERNAL_MODULE);
|
||||
#endif
|
||||
#if defined(PXX2)|| defined(MULTIMODULE)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER) || isModuleMultimodule(EXTERNAL_MODULE))
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_EXT, menuRadioSpectrumAnalyser, EXTERNAL_MODULE);
|
||||
#endif
|
||||
#if defined(PXX2)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
||||
#endif
|
||||
|
||||
if (index == 0) {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_NO_TOOLS);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
extern bool displayTelemetryScreen();
|
||||
extern void displayRssiLine();
|
||||
|
||||
enum NavigationDirection {
|
||||
NAVIGATION_DIRECTION_NONE,
|
||||
NAVIGATION_DIRECTION_UP,
|
||||
NAVIGATION_DIRECTION_DOWN
|
||||
};
|
||||
#define decrTelemetryScreen() direction = NAVIGATION_DIRECTION_UP
|
||||
#define incrTelemetryScreen() direction = NAVIGATION_DIRECTION_DOWN
|
||||
|
||||
#if defined(NAVIGATION_XLITE)
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_LONG(KEY_LEFT) && IS_SHIFT_PRESSED())
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_LONG(KEY_RIGHT) && IS_SHIFT_PRESSED())
|
||||
#elif defined(NAVIGATION_X7) || defined(NAVIGATION_X9D)
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_LONG(KEY_PAGE))
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_BREAK(KEY_PAGE))
|
||||
#elif defined(NAVIGATION_9X)
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_LONG(KEY_UP))
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_LONG(KEY_DOWN))
|
||||
#else
|
||||
#define EVT_KEY_PREVIOUS_VIEW(evt) (evt == EVT_KEY_FIRST(KEY_UP))
|
||||
#define EVT_KEY_NEXT_VIEW(evt) (evt == EVT_KEY_FIRST(KEY_DOWN))
|
||||
#endif
|
||||
|
||||
void menuViewTelemetry(event_t event)
|
||||
{
|
||||
enum NavigationDirection direction = NAVIGATION_DIRECTION_NONE;
|
||||
|
||||
if (event == EVT_KEY_FIRST(KEY_EXIT) && TELEMETRY_SCREEN_TYPE(s_frsky_view) != TELEMETRY_SCREEN_TYPE_SCRIPT) {
|
||||
killEvents(event);
|
||||
chainMenu(menuMainView);
|
||||
}
|
||||
#if defined(LUA)
|
||||
else if (event == EVT_KEY_LONG(KEY_EXIT)) {
|
||||
killEvents(event);
|
||||
chainMenu(menuMainView);
|
||||
}
|
||||
#endif
|
||||
else if (EVT_KEY_PREVIOUS_VIEW(event)) {
|
||||
killEvents(event);
|
||||
decrTelemetryScreen();
|
||||
}
|
||||
else if (EVT_KEY_NEXT_VIEW(event)) {
|
||||
killEvents(event);
|
||||
incrTelemetryScreen();
|
||||
}
|
||||
else if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_FLIGHT);
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
}
|
||||
|
||||
for (int i=0; i<=TELEMETRY_SCREEN_TYPE_MAX; i++) {
|
||||
if (direction == NAVIGATION_DIRECTION_UP) {
|
||||
if (s_frsky_view-- == 0)
|
||||
s_frsky_view = TELEMETRY_VIEW_MAX;
|
||||
}
|
||||
else if (direction == NAVIGATION_DIRECTION_DOWN) {
|
||||
if (s_frsky_view++ == TELEMETRY_VIEW_MAX)
|
||||
s_frsky_view = 0;
|
||||
}
|
||||
else {
|
||||
direction = NAVIGATION_DIRECTION_DOWN;
|
||||
}
|
||||
if (displayTelemetryScreen()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
drawTelemetryTopBar();
|
||||
lcdDrawText(LCD_W / 2, 3 * FH, "No Telemetry Screens", CENTERED);
|
||||
displayRssiLine();
|
||||
}
|
||||
|
||||
#undef EVT_KEY_PREVIOUS_VIEW
|
||||
#undef EVT_KEY_NEXT_VIEW
|
||||
Reference in New Issue
Block a user