@@ -1,29 +1,24 @@
|
||||
add_definitions(-DGRAPHICS)
|
||||
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/menus.cpp
|
||||
../common/stdlcd/widgets.cpp
|
||||
../common/stdlcd/popups.cpp
|
||||
../common/stdlcd/model_inputs.cpp
|
||||
../common/stdlcd/model_mixes.cpp
|
||||
../common/stdlcd/view_text.cpp
|
||||
../common/stdlcd/model_module_options.cpp
|
||||
../common/stdlcd/model_receiver_options.cpp
|
||||
../common/stdlcd/model_notes.cpp
|
||||
../common/stdlcd/model_curves.cpp
|
||||
model_curve_edit.cpp
|
||||
)
|
||||
|
||||
if(HELI)
|
||||
set(GUI_SRC ${GUI_SRC} ../common/stdlcd/model_heli.cpp)
|
||||
endif()
|
||||
|
||||
add_definitions(-DGRAPHICS)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/model_inputs.cpp
|
||||
../common/stdlcd/model_mixes.cpp
|
||||
../common/stdlcd/view_text.cpp
|
||||
)
|
||||
set(CURVE_EDIT_SRC )
|
||||
|
||||
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
../common/stdlcd/model_curves.cpp
|
||||
model_curve_edit.cpp
|
||||
)
|
||||
|
||||
if(SDCARD)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
MenuHandlerFunc menuHandlers[5];
|
||||
uint8_t menuEvent = 0;
|
||||
uint8_t menuVerticalPositions[4];
|
||||
uint8_t menuLevel = 0;
|
||||
|
||||
void popMenu()
|
||||
{
|
||||
assert(menuLevel > 0);
|
||||
menuLevel = menuLevel - 1;
|
||||
menuEvent = EVT_ENTRY_UP;
|
||||
// TODO ? AUDIO_KEY_PRESS();
|
||||
TRACE("popMenu(%d)", menuLevel);
|
||||
}
|
||||
|
||||
void abortPopMenu()
|
||||
{
|
||||
menuLevel = menuLevel + 1;
|
||||
menuEvent = 0;
|
||||
TRACE("popMenu(%d) aborted", menuLevel);
|
||||
}
|
||||
|
||||
void chainMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
// TODO ? AUDIO_KEY_PRESS();
|
||||
TRACE("chainMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
|
||||
void pushMenu(MenuHandlerFunc newMenu)
|
||||
{
|
||||
killEvents(KEY_ENTER);
|
||||
|
||||
if (menuLevel == 0) {
|
||||
if (newMenu == menuRadioSetup)
|
||||
menuVerticalPositions[0] = 1;
|
||||
if (newMenu == menuModelSelect)
|
||||
menuVerticalPositions[0] = 0;
|
||||
}
|
||||
else {
|
||||
menuVerticalPositions[menuLevel] = menuVerticalPosition;
|
||||
}
|
||||
|
||||
menuLevel++;
|
||||
|
||||
assert(menuLevel < DIM(menuHandlers));
|
||||
|
||||
menuHandlers[menuLevel] = newMenu;
|
||||
menuEvent = EVT_ENTRY;
|
||||
// ? AUDIO_KEY_PRESS();
|
||||
TRACE("pushMenu(%d, %p)", menuLevel, newMenu);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _COMMON_MENUS_H_
|
||||
#define _COMMON_MENUS_H_
|
||||
|
||||
#include "opentx_types.h"
|
||||
|
||||
typedef int8_t horzpos_t;
|
||||
typedef uint16_t vertpos_t;
|
||||
|
||||
typedef void (* MenuHandlerFunc)(event_t event);
|
||||
|
||||
extern tmr10ms_t menuEntryTime;
|
||||
extern vertpos_t menuVerticalPosition;
|
||||
extern horzpos_t menuHorizontalPosition;
|
||||
extern vertpos_t menuVerticalOffset;
|
||||
extern uint8_t menuCalibrationState;
|
||||
extern MenuHandlerFunc menuHandlers[5];
|
||||
extern uint8_t menuVerticalPositions[4];
|
||||
extern uint8_t menuLevel;
|
||||
extern uint8_t menuEvent;
|
||||
|
||||
void chainMenu(MenuHandlerFunc newMenu);
|
||||
void pushMenu(MenuHandlerFunc newMenu);
|
||||
void popMenu();
|
||||
void abortPopMenu();
|
||||
|
||||
inline MenuHandlerFunc lastPopMenu()
|
||||
{
|
||||
return menuHandlers[menuLevel + 1];
|
||||
}
|
||||
|
||||
#endif // _COMMON_MENUS_H_
|
||||
@@ -0,0 +1,183 @@
|
||||
/*
|
||||
* 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>
|
||||
#include <math.h>
|
||||
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN (11*FW)
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
void onTxOptionsUpdateConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettingsDirty = 2;
|
||||
moduleState[g_moduleIdx].writeModuleSettings(&reusableBuffer.hardwareAndSettings.moduleSettings);
|
||||
}
|
||||
else {
|
||||
popMenu();
|
||||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA,
|
||||
ITEM_MODULE_SETTINGS_POWER,
|
||||
ITEM_MODULE_SETTINGS_COUNT
|
||||
};
|
||||
|
||||
#define IF_MODULE_OPTIONS(option, count) uint8_t(isModuleOptionAvailable(modelId, option) ? count : HIDDEN_ROW)
|
||||
|
||||
bool isPowerAvailable(int value)
|
||||
{
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID;
|
||||
uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant;
|
||||
|
||||
if (modelId == PXX2_MODULE_R9M_LITE) {
|
||||
if (variant == PXX2_VARIANT_EU)
|
||||
return (value == 14 /* 25 mW */ ||
|
||||
value == 20 /* 100 mW */);
|
||||
else
|
||||
return value == 20; /* 100 mW */
|
||||
}
|
||||
else if (modelId == PXX2_MODULE_R9M || modelId == PXX2_MODULE_R9M_LITE_PRO) {
|
||||
if (variant == PXX2_VARIANT_EU)
|
||||
return (value == 14 /* 25 mW */ ||
|
||||
value == 23 /* 200 mW */ ||
|
||||
value == 27 /* 500 mW */);
|
||||
else
|
||||
return (value == 10 /* 10 mW */ ||
|
||||
value == 20 /* 100 mW */ ||
|
||||
value == 27 /* 500 mW */ ||
|
||||
value == 30 /* 1000 mW */);
|
||||
}
|
||||
else {
|
||||
return (value <= 20); /* 100 mW max for XJTs */
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelModuleOptions(event_t event)
|
||||
{
|
||||
if (event == EVT_ENTRY) {
|
||||
memclear(&reusableBuffer.hardwareAndSettings, sizeof(reusableBuffer.hardwareAndSettings));
|
||||
#if defined(SIMU)
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.state = PXX2_SETTINGS_OK;
|
||||
#else
|
||||
// no need to initialize reusableBuffer.hardwareAndSettings.moduleState.state to PXX2_HARDWARE_INFO
|
||||
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[g_moduleIdx], PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.modelID;
|
||||
// uint8_t variant = reusableBuffer.hardwareAndSettings.modules[g_moduleIdx].information.variant;
|
||||
|
||||
uint8_t optionsAvailable = moduleOptions[modelId] & ((1 << MODULE_OPTION_EXTERNAL_ANTENNA) | (1 << MODULE_OPTION_POWER));
|
||||
|
||||
SUBMENU_NOTITLE(ITEM_MODULE_SETTINGS_COUNT, {
|
||||
!optionsAvailable ? (uint8_t)0 : IF_MODULE_OPTIONS(MODULE_OPTION_EXTERNAL_ANTENNA, 0),
|
||||
IF_MODULE_OPTIONS(MODULE_OPTION_POWER, 0),
|
||||
});
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettings.state == PXX2_HARDWARE_INFO && moduleState[g_moduleIdx].mode == MODULE_MODE_NORMAL) {
|
||||
if (modelId)
|
||||
moduleState[g_moduleIdx].readModuleSettings(&reusableBuffer.hardwareAndSettings.moduleSettings);
|
||||
else
|
||||
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[g_moduleIdx], PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||
}
|
||||
|
||||
if (menuEvent) {
|
||||
killEvents(KEY_EXIT);
|
||||
moduleState[g_moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettingsDirty) {
|
||||
abortPopMenu();
|
||||
POPUP_CONFIRMATION(STR_UPDATE_TX_OPTIONS, onTxOptionsUpdateConfirm);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && reusableBuffer.hardwareAndSettings.moduleSettingsDirty) {
|
||||
killEvents(event);
|
||||
reusableBuffer.hardwareAndSettings.moduleSettingsDirty = 0;
|
||||
moduleState[g_moduleIdx].writeModuleSettings(&reusableBuffer.hardwareAndSettings.moduleSettings);
|
||||
}
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettingsDirty == 2 && reusableBuffer.hardwareAndSettings.moduleSettings.state == PXX2_SETTINGS_OK) {
|
||||
popMenu();
|
||||
}
|
||||
|
||||
if (modelId != 0 && mstate_tab[menuVerticalPosition] == HIDDEN_ROW) {
|
||||
menuVerticalPosition = 0;
|
||||
while (menuVerticalPosition < ITEM_MODULE_SETTINGS_COUNT && mstate_tab[menuVerticalPosition] == HIDDEN_ROW) {
|
||||
++menuVerticalPosition;
|
||||
}
|
||||
}
|
||||
|
||||
int8_t sub = menuVerticalPosition;
|
||||
lcdDrawTextAlignedLeft(0, STR_MODULE_OPTIONS);
|
||||
lcdDrawText(lcdLastRightPos + 3, 0, PXX2modulesModels[modelId]);
|
||||
lcdInvertLine(0);
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.moduleSettings.state == PXX2_SETTINGS_OK) {
|
||||
if (optionsAvailable) {
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
uint8_t i = k + menuVerticalOffset;
|
||||
for (int j=0; j<=i; ++j) {
|
||||
if (j<(int)DIM(mstate_tab) && mstate_tab[j] == HIDDEN_ROW) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
switch (i) {
|
||||
case ITEM_MODULE_SETTINGS_EXTERNAL_ANTENNA:
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna = editCheckBox(reusableBuffer.hardwareAndSettings.moduleSettings.externalAntenna, RECEIVER_OPTIONS_2ND_COLUMN, y, "Ext. antenna", attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettingsDirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODULE_SETTINGS_POWER:
|
||||
lcdDrawText(0, y, STR_POWER);
|
||||
lcdDrawNumber(RECEIVER_OPTIONS_2ND_COLUMN, y, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, attr);
|
||||
lcdDrawText(lcdNextPos, y, "dBm(");
|
||||
drawPower(lcdNextPos, y, reusableBuffer.hardwareAndSettings.moduleSettings.txPower);
|
||||
lcdDrawText(lcdNextPos, y, ")");
|
||||
if (attr) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettings.txPower = checkIncDec(event, reusableBuffer.hardwareAndSettings.moduleSettings.txPower, 0, 30, 0, &isPowerAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.moduleSettingsDirty = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_NO_TX_OPTIONS);
|
||||
s_editMode = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_WAITING_FOR_TX);
|
||||
s_editMode = 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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 menuModelNotes(event_t event)
|
||||
{
|
||||
if (event == EVT_ENTRY) {
|
||||
strcpy(s_text_file, MODELS_PATH "/");
|
||||
char *buf = strcat_modelname(&s_text_file[sizeof(MODELS_PATH)], g_eeGeneral.currModel);
|
||||
strcpy(buf, TEXT_EXT);
|
||||
}
|
||||
|
||||
menuTextView(event);
|
||||
}
|
||||
|
||||
void pushModelNotes()
|
||||
{
|
||||
pushMenu(menuModelNotes);
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN 80
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
void onRxOptionsUpdateConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_WRITE;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = 2;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.timeout = 0;
|
||||
moduleState[g_moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||
}
|
||||
else {
|
||||
popMenu();
|
||||
}
|
||||
}
|
||||
|
||||
enum {
|
||||
ITEM_RECEIVER_TELEMETRY,
|
||||
ITEM_RECEIVER_PWM_RATE,
|
||||
ITEM_RECEIVER_PINMAP_FIRST
|
||||
};
|
||||
|
||||
void menuModelReceiverOptions(event_t event)
|
||||
{
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
uint8_t wbar = LCD_W / 2 - 20;
|
||||
auto outputsCount = min<uint8_t>(16, reusableBuffer.hardwareAndSettings.receiverSettings.outputsCount);
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(ITEM_RECEIVER_PINMAP_FIRST + outputsCount);
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
#if defined(SIMU)
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_OK;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.outputsCount = 8;
|
||||
#else
|
||||
// no need to initialize reusableBuffer.hardwareAndSettings.receiverSettings.state to PXX2_HARDWARE_INFO
|
||||
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[g_moduleIdx], reusableBuffer.hardwareAndSettings.receiverSettings.receiverId, reusableBuffer.hardwareAndSettings.receiverSettings.receiverId);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.state == PXX2_HARDWARE_INFO && moduleState[g_moduleIdx].mode == MODULE_MODE_NORMAL) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_READ;
|
||||
moduleState[g_moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||
}
|
||||
|
||||
if (menuEvent) {
|
||||
killEvents(KEY_EXIT);
|
||||
moduleState[g_moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.dirty) {
|
||||
abortPopMenu();
|
||||
POPUP_CONFIRMATION(STR_UPDATE_RX_OPTIONS, onRxOptionsUpdateConfirm);
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER) && reusableBuffer.hardwareAndSettings.receiverSettings.dirty) {
|
||||
killEvents(event);
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.state = PXX2_SETTINGS_WRITE;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = 0;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.timeout = 0;
|
||||
moduleState[g_moduleIdx].mode = MODULE_MODE_RECEIVER_SETTINGS;
|
||||
}
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.dirty == 2 && reusableBuffer.hardwareAndSettings.receiverSettings.state == PXX2_SETTINGS_OK) {
|
||||
popMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
int8_t sub = menuVerticalPosition;
|
||||
lcdDrawTextAlignedLeft(0, STR_RECEIVER_OPTIONS);
|
||||
drawReceiverName(FW * 13, 0, g_moduleIdx, reusableBuffer.hardwareAndSettings.receiverSettings.receiverId);
|
||||
lcdInvertLine(0);
|
||||
|
||||
if (reusableBuffer.hardwareAndSettings.receiverSettings.state == PXX2_SETTINGS_OK) {
|
||||
for (uint8_t k=0; k<LCD_LINES-1; k++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + k*FH;
|
||||
uint8_t i = k + menuVerticalOffset;
|
||||
LcdFlags attr = (sub==i ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
switch (i) {
|
||||
case ITEM_RECEIVER_TELEMETRY:
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.telemetryDisabled = editCheckBox(reusableBuffer.hardwareAndSettings.receiverSettings.telemetryDisabled, RECEIVER_OPTIONS_2ND_COLUMN, y, "Telem. disabled", attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_RECEIVER_PWM_RATE:
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.pwmRate = editCheckBox(reusableBuffer.hardwareAndSettings.receiverSettings.pwmRate, RECEIVER_OPTIONS_2ND_COLUMN, y, isModuleR9M2(g_moduleIdx) ? "6.67ms PWM": "9ms PWM", attr, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
// Pin
|
||||
{
|
||||
uint8_t pin = i - ITEM_RECEIVER_PINMAP_FIRST;
|
||||
if (pin < reusableBuffer.hardwareAndSettings.receiverSettings.outputsCount) {
|
||||
uint8_t channel = g_model.moduleData[g_moduleIdx].channelsStart + reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin];
|
||||
int32_t channelValue = channelOutputs[channel];
|
||||
lcdDrawText(0, y, STR_PIN);
|
||||
lcdDrawNumber(lcdLastRightPos + 1, y, pin + 1);
|
||||
putsChn(7 * FW, y, channel + 1, attr);
|
||||
|
||||
// Channel
|
||||
if (attr) {
|
||||
channel = checkIncDec(event, channel, 0, sentModuleChannels(g_moduleIdx) - 1);
|
||||
if (checkIncDec_Ret) {
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.outputsMapping[pin] = channel;
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Bargraph
|
||||
#if !defined(PCBX7) // X7 LCD doesn't like too many horizontal lines
|
||||
lcdDrawRect(LCD_W - 3 - wbar, y + 1, wbar + 1, 4);
|
||||
#endif
|
||||
const uint8_t lenChannel = limit<uint8_t>(1, (abs(channelValue) * wbar / 2 + lim / 2) / lim, wbar / 2);
|
||||
const coord_t xChannel = (channelValue > 0) ? LCD_W - 3 - wbar / 2 : LCD_W - 2 - wbar / 2 - lenChannel;
|
||||
lcdDrawHorizontalLine(xChannel, y + 2, lenChannel, SOLID, 0);
|
||||
lcdDrawHorizontalLine(xChannel, y + 3, lenChannel, SOLID, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_WAITING_FOR_RX);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
void onBindMenu(const char * result)
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
|
||||
if (result == STR_BINDING_1_8_TELEM_ON) {
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = false;
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = false;
|
||||
}
|
||||
else if (result == STR_BINDING_1_8_TELEM_OFF) {
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = true;
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = false;
|
||||
}
|
||||
else if (result == STR_BINDING_9_16_TELEM_ON) {
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = false;
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = true;
|
||||
}
|
||||
else if (result == STR_BINDING_9_16_TELEM_OFF) {
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_telem_off = true;
|
||||
g_model.moduleData[moduleIdx].pxx.receiver_channel_9_16 = true;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_BIND;
|
||||
}
|
||||
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
* 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"
|
||||
|
||||
bool isPXX2ReceiverEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
return is_memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
}
|
||||
|
||||
void removePXX2Receiver(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
g_model.moduleData[moduleIdx].pxx2.receivers &= ~(1 << receiverIdx);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void removePXX2ReceiverIfEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
if (isPXX2ReceiverEmpty(moduleIdx, receiverIdx)) {
|
||||
removePXX2Receiver(moduleIdx, receiverIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void onPXX2R9MBindModeMenu(const char * result)
|
||||
{
|
||||
if (result == STR_8CH_WITH_TELEMETRY) {
|
||||
reusableBuffer.moduleSetup.bindInformation.lbtMode = 0;
|
||||
}
|
||||
else if (result == STR_16CH_WITH_TELEMETRY) {
|
||||
reusableBuffer.moduleSetup.bindInformation.lbtMode = 1;
|
||||
}
|
||||
else if (result == STR_16CH_WITHOUT_TELEMETRY) {
|
||||
reusableBuffer.moduleSetup.bindInformation.lbtMode = 2;
|
||||
}
|
||||
else if (result == STR_FLEX_868) {
|
||||
reusableBuffer.moduleSetup.bindInformation.flexMode = 0;
|
||||
}
|
||||
else if (result == STR_FLEX_915) {
|
||||
reusableBuffer.moduleSetup.bindInformation.flexMode = 1;
|
||||
}
|
||||
else {
|
||||
// the user pressed [Exit]
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
removePXX2ReceiverIfEmpty(moduleIdx, receiverIdx);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(SIMU)
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
memcpy(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], reusableBuffer.moduleSetup.bindInformation.candidateReceiversNames[reusableBuffer.moduleSetup.bindInformation.selectedReceiverIndex], PXX2_LEN_RX_NAME);
|
||||
storageDirty(EE_MODEL);
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
reusableBuffer.moduleSetup.bindInformation.step = BIND_OK;
|
||||
POPUP_INFORMATION(STR_BIND_OK);
|
||||
#else
|
||||
reusableBuffer.moduleSetup.bindInformation.step = BIND_START;
|
||||
#endif
|
||||
}
|
||||
|
||||
void onPXX2BindMenu(const char * result)
|
||||
{
|
||||
if (result != STR_EXIT) {
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
reusableBuffer.moduleSetup.bindInformation.selectedReceiverIndex = (result - reusableBuffer.moduleSetup.bindInformation.candidateReceiversNames[0]) / sizeof(reusableBuffer.moduleSetup.bindInformation.candidateReceiversNames[0]);
|
||||
if (isModuleR9M2(moduleIdx) && reusableBuffer.moduleSetup.pxx2.moduleInformation.information.variant == PXX2_VARIANT_EU) {
|
||||
reusableBuffer.moduleSetup.bindInformation.step = BIND_RX_NAME_SELECTED;
|
||||
POPUP_MENU_ADD_ITEM(STR_8CH_WITH_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_16CH_WITH_TELEMETRY);
|
||||
POPUP_MENU_ADD_ITEM(STR_16CH_WITHOUT_TELEMETRY);
|
||||
POPUP_MENU_START(onPXX2R9MBindModeMenu);
|
||||
}
|
||||
else if (isModuleR9M2(moduleIdx) && reusableBuffer.moduleSetup.pxx2.moduleInformation.information.variant == PXX2_VARIANT_FLEX) {
|
||||
reusableBuffer.moduleSetup.bindInformation.step = BIND_RX_NAME_SELECTED;
|
||||
POPUP_MENU_ADD_ITEM(STR_FLEX_868);
|
||||
POPUP_MENU_ADD_ITEM(STR_FLEX_915);
|
||||
POPUP_MENU_START(onPXX2R9MBindModeMenu);
|
||||
}
|
||||
else {
|
||||
#if defined(SIMU)
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
memcpy(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], result, PXX2_LEN_RX_NAME);
|
||||
storageDirty(EE_MODEL);
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
reusableBuffer.moduleSetup.bindInformation.step = BIND_OK;
|
||||
POPUP_INFORMATION(STR_BIND_OK);
|
||||
#else
|
||||
reusableBuffer.moduleSetup.bindInformation.step = BIND_START;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else {
|
||||
// the user pressed [Exit]
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
removePXX2ReceiverIfEmpty(moduleIdx, receiverIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void onResetReceiverConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_RESET;
|
||||
removePXX2Receiver(moduleIdx, receiverIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void onPXX2ReceiverMenu(const char * result)
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
|
||||
if (result == STR_OPTIONS) {
|
||||
memclear(&reusableBuffer.hardwareAndSettings, sizeof(reusableBuffer.hardwareAndSettings));
|
||||
reusableBuffer.hardwareAndSettings.receiverSettings.receiverId = receiverIdx;
|
||||
g_moduleIdx = moduleIdx;
|
||||
pushMenu(menuModelReceiverOptions);
|
||||
}
|
||||
else if (result == STR_BIND) {
|
||||
memclear(&reusableBuffer.moduleSetup.bindInformation, sizeof(BindInformation));
|
||||
reusableBuffer.moduleSetup.bindInformation.rxUid = receiverIdx;
|
||||
if (isModuleR9M2(moduleIdx)) {
|
||||
#if defined(SIMU)
|
||||
reusableBuffer.moduleSetup.pxx2.moduleInformation.information.modelID = 1;
|
||||
reusableBuffer.moduleSetup.pxx2.moduleInformation.information.variant = 2;
|
||||
#else
|
||||
moduleState[moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
moduleState[moduleIdx].startBind(&reusableBuffer.moduleSetup.bindInformation);
|
||||
}
|
||||
s_editMode = 1;
|
||||
}
|
||||
else if (result == STR_SHARE) {
|
||||
reusableBuffer.moduleSetup.pxx2.shareReceiverIndex = receiverIdx;
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_SHARE;
|
||||
s_editMode = 1;
|
||||
}
|
||||
else if (result == STR_DELETE || result == STR_RESET) {
|
||||
memclear(&reusableBuffer.moduleSetup.pxx2, sizeof(reusableBuffer.moduleSetup.pxx2));
|
||||
reusableBuffer.moduleSetup.pxx2.resetReceiverIndex = receiverIdx;
|
||||
reusableBuffer.moduleSetup.pxx2.resetReceiverFlags = (result == STR_RESET ? 0xFF : 0x01);
|
||||
POPUP_CONFIRMATION(result == STR_RESET ? STR_RECEIVER_RESET : STR_RECEIVER_DELETE, onResetReceiverConfirm);
|
||||
}
|
||||
else {
|
||||
removePXX2ReceiverIfEmpty(moduleIdx, receiverIdx);
|
||||
}
|
||||
}
|
||||
|
||||
enum PopupRegisterItems {
|
||||
ITEM_REGISTER_PASSWORD,
|
||||
ITEM_REGISTER_MODULE_INDEX,
|
||||
ITEM_REGISTER_RECEIVER_NAME,
|
||||
ITEM_REGISTER_BUTTONS
|
||||
};
|
||||
|
||||
void runPopupRegister(event_t event)
|
||||
{
|
||||
uint8_t backupVerticalPosition = menuVerticalPosition;
|
||||
uint8_t backupHorizontalPosition = menuHorizontalPosition;
|
||||
uint8_t backupVerticalOffset = menuVerticalOffset;
|
||||
int8_t backupEditMode = s_editMode;
|
||||
|
||||
menuVerticalPosition = reusableBuffer.moduleSetup.pxx2.registerPopupVerticalPosition;
|
||||
menuHorizontalPosition = reusableBuffer.moduleSetup.pxx2.registerPopupHorizontalPosition;
|
||||
s_editMode = reusableBuffer.moduleSetup.pxx2.registerPopupEditMode;
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (menuVerticalPosition != ITEM_REGISTER_BUTTONS) {
|
||||
break;
|
||||
}
|
||||
else if (reusableBuffer.moduleSetup.pxx2.registerStep >= REGISTER_RX_NAME_RECEIVED && menuHorizontalPosition == 0) {
|
||||
// [Enter] pressed
|
||||
reusableBuffer.moduleSetup.pxx2.registerStep = REGISTER_RX_NAME_SELECTED;
|
||||
backupEditMode = EDIT_MODIFY_FIELD; // so that the [Register] button blinks and the REGISTER process can continue
|
||||
}
|
||||
// no break
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
s_editMode = 0;
|
||||
// no break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (s_editMode <= 0) {
|
||||
warningText = nullptr;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (warningText) {
|
||||
const uint8_t dialogRows[] = { 0, 0, uint8_t(reusableBuffer.moduleSetup.pxx2.registerStep < REGISTER_RX_NAME_RECEIVED ? READONLY_ROW : 0), uint8_t(reusableBuffer.moduleSetup.pxx2.registerStep < REGISTER_RX_NAME_RECEIVED ? 0 : 1)};
|
||||
check(event, 0, nullptr, 0, dialogRows, 3, 4 - HEADER_LINE); // TODO add a comment for 3 - HEADER_LINE once understood
|
||||
|
||||
drawMessageBox(warningText);
|
||||
|
||||
// registration password
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 4, STR_REG_ID);
|
||||
editName(WARNING_LINE_X + 8*FW, WARNING_LINE_Y - 4, g_model.modelRegistrationID, PXX2_LEN_REGISTRATION_ID, event, menuVerticalPosition == ITEM_REGISTER_PASSWORD);
|
||||
|
||||
// loop index (will be removed in future)
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 4 + FH, "UID");
|
||||
lcdDrawNumber(WARNING_LINE_X + 8*FW, WARNING_LINE_Y - 4 + FH, reusableBuffer.moduleSetup.pxx2.registerLoopIndex, menuVerticalPosition == ITEM_REGISTER_MODULE_INDEX ? (s_editMode ? INVERS + BLINK : INVERS) : 0);
|
||||
if (menuVerticalPosition == ITEM_REGISTER_MODULE_INDEX && s_editMode) {
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, reusableBuffer.moduleSetup.pxx2.registerLoopIndex, 2);
|
||||
}
|
||||
|
||||
// RX name
|
||||
if (reusableBuffer.moduleSetup.pxx2.registerStep < REGISTER_RX_NAME_RECEIVED) {
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 4 + 2 * FH, STR_WAITING);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 2 + 3 * FH, TR_EXIT, menuVerticalPosition == ITEM_REGISTER_BUTTONS ? INVERS : 0);
|
||||
}
|
||||
else {
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 4 + 2 * FH, STR_RX_NAME);
|
||||
editName(WARNING_LINE_X + 8*FW, WARNING_LINE_Y - 4 + 2 * FH, reusableBuffer.moduleSetup.pxx2.registerRxName, PXX2_LEN_RX_NAME, event, menuVerticalPosition == ITEM_REGISTER_RECEIVER_NAME);
|
||||
lcdDrawText(WARNING_LINE_X, WARNING_LINE_Y - 2 + 3 * FH, TR_ENTER, menuVerticalPosition == ITEM_REGISTER_BUTTONS && menuHorizontalPosition == 0 ? INVERS : 0);
|
||||
lcdDrawText(WARNING_LINE_X + 8*FW, WARNING_LINE_Y - 2 + 3 * FH, TR_EXIT, menuVerticalPosition == ITEM_REGISTER_BUTTONS && menuHorizontalPosition == 1 ? INVERS : 0);
|
||||
}
|
||||
|
||||
reusableBuffer.moduleSetup.pxx2.registerPopupVerticalPosition = menuVerticalPosition;
|
||||
reusableBuffer.moduleSetup.pxx2.registerPopupHorizontalPosition = menuHorizontalPosition;
|
||||
reusableBuffer.moduleSetup.pxx2.registerPopupEditMode = s_editMode;
|
||||
}
|
||||
|
||||
menuVerticalPosition = backupVerticalPosition;
|
||||
menuHorizontalPosition = backupHorizontalPosition;
|
||||
menuVerticalOffset = backupVerticalOffset;
|
||||
s_editMode = backupEditMode;
|
||||
}
|
||||
|
||||
void startRegisterDialog(uint8_t module)
|
||||
{
|
||||
memclear(&reusableBuffer.moduleSetup.pxx2, sizeof(reusableBuffer.moduleSetup.pxx2));
|
||||
reusableBuffer.moduleSetup.pxx2.registerPopupVerticalPosition = ITEM_REGISTER_BUTTONS;
|
||||
moduleState[module].mode = MODULE_MODE_REGISTER;
|
||||
s_editMode = 0;
|
||||
killAllEvents();
|
||||
POPUP_INPUT("", runPopupRegister);
|
||||
}
|
||||
@@ -215,3 +215,21 @@ void drawPower(coord_t x, coord_t y, int8_t dBm, LcdFlags att)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags)
|
||||
{
|
||||
if (isModulePXX2(moduleIdx)) {
|
||||
if (g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx][0] != '\0')
|
||||
lcdDrawSizedText(x, y, g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], effectiveLen(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME), flags);
|
||||
else
|
||||
lcdDrawText(x, y, "---", flags);
|
||||
}
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
else if (moduleIdx == INTERNAL_MODULE) {
|
||||
lcdDrawText(x, y, "Internal", flags);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
lcdDrawText(x, y, "External", flags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user