Merge against latest 2.3
This commit is contained in:
@@ -129,10 +129,11 @@ uint8_t * lcdLoadBitmap(uint8_t * bmp, const char * filename, uint8_t width, uin
|
||||
|
||||
memset(dest, 0, BITMAP_BUFFER_SIZE(w, h) - 2);
|
||||
|
||||
uint8_t rowSize = (w + 7) / 8;
|
||||
uint8_t rowSize;
|
||||
|
||||
switch (depth) {
|
||||
case 1:
|
||||
rowSize = ((w + 31) / 32) * 4;
|
||||
for (int8_t i=h-1; i>=0; i--) {
|
||||
result = f_read(&bmpFile, buf, rowSize, &read);
|
||||
if (result != FR_OK || read != rowSize) {
|
||||
|
||||
@@ -183,8 +183,7 @@ void title(const char * s);
|
||||
title(name)
|
||||
|
||||
typedef int choice_t;
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event);
|
||||
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable = nullptr);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, const char * label, LcdFlags attr, event_t event);
|
||||
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags attr, event_t event);
|
||||
|
||||
@@ -231,15 +230,11 @@ void drawStatusLine();
|
||||
#define drawStatusLine()
|
||||
#endif
|
||||
|
||||
#define TEXT_FILENAME_MAXLEN 40
|
||||
extern char s_text_file[TEXT_FILENAME_MAXLEN];
|
||||
void menuTextView(event_t event);
|
||||
void pushMenuTextView(const char *filename);
|
||||
void pushModelNotes();
|
||||
void readModelNotes();
|
||||
|
||||
#define LABEL(...) (uint8_t)-1
|
||||
|
||||
#define CURSOR_MOVED_LEFT(event) (IS_ROTARY_LEFT(event) || EVT_KEY_MASK(event) == KEY_LEFT)
|
||||
#define CURSOR_MOVED_RIGHT(event) (IS_ROTARY_RIGHT(event) || EVT_KEY_MASK(event) == KEY_RIGHT)
|
||||
|
||||
|
||||
@@ -922,15 +922,34 @@ void lcdDraw1bitBitmap(coord_t x, coord_t y, const uint8_t * img, uint8_t idx, L
|
||||
const uint8_t * q = img;
|
||||
uint8_t w = *q++;
|
||||
uint8_t hb = ((*q++) + 7) / 8;
|
||||
uint8_t yShift = y % 8;
|
||||
|
||||
bool inv = (att & INVERS) ? true : (att & BLINK ? BLINK_ON_PHASE : false);
|
||||
|
||||
q += idx*w*hb;
|
||||
|
||||
for (uint8_t yb = 0; yb < hb; yb++) {
|
||||
|
||||
uint8_t *p = &displayBuf[(y / 8 + yb) * LCD_W + x];
|
||||
|
||||
for (coord_t i=0; i<w; i++){
|
||||
uint8_t b = *q++;
|
||||
|
||||
uint8_t b = inv ? ~(*q++) : *q++;
|
||||
|
||||
if (p < DISPLAY_END) {
|
||||
*p++ = inv ? ~b : b;
|
||||
|
||||
if (!yShift) {
|
||||
*p = b;
|
||||
}
|
||||
else {
|
||||
*p = (*p & ((1 << yShift) - 1)) | (b << yShift);
|
||||
|
||||
if (p + LCD_W < DISPLAY_END) {
|
||||
p[LCD_W] = (p[LCD_W] & (0xFF >> yShift)) | (b >> (8 - yShift));
|
||||
}
|
||||
}
|
||||
}
|
||||
p++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, str);
|
||||
lcdDrawNumber(MIXES_2ND_COLUMN, y, (10/DELAY_STEP)*delay, attr|PREC1|LEFT);
|
||||
lcdDrawNumber(MIXES_2ND_COLUMN, y, delay, attr|PREC1|LEFT);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, delay, DELAY_MAX);
|
||||
return delay;
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
void menuRadioSpecialFunctions(event_t event)
|
||||
{
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(NAVIGATION_X7)
|
||||
const CustomFunctionData * cfn = &g_eeGeneral.customFn[menuVerticalPosition];
|
||||
if (!CFN_SWITCH(cfn) && menuHorizontalPosition < 0 && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
menuHorizontalPosition = 0;
|
||||
@@ -33,7 +33,7 @@ void menuRadioSpecialFunctions(event_t event)
|
||||
|
||||
menuSpecialFunctions(event, g_eeGeneral.customFn, &globalFunctionsContext);
|
||||
|
||||
#if defined(PCBX7)
|
||||
#if defined(NAVIGATION_X7)
|
||||
if (!CFN_SWITCH(cfn) && menuHorizontalPosition == 0 && s_editMode <= 0) {
|
||||
menuHorizontalPosition = -1;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,15 @@
|
||||
|
||||
#define MODELSEL_W LCD_W
|
||||
|
||||
void onDeleteModelConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
storageCheck(true);
|
||||
eeDeleteModel(menuVerticalPosition); // delete file
|
||||
s_copyMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void onModelSelectMenu(const char * result)
|
||||
{
|
||||
int8_t sub = menuVerticalPosition;
|
||||
@@ -45,13 +54,14 @@ void onModelSelectMenu(const char * result)
|
||||
POPUP_WARNING(eeBackupModel(sub));
|
||||
}
|
||||
else if (result == STR_RESTORE_MODEL || result == STR_UPDATE_LIST) {
|
||||
if (!sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, NULL)) {
|
||||
if (sdListFiles(MODELS_PATH, MODELS_EXT, MENU_LINE_LENGTH-1, nullptr))
|
||||
POPUP_MENU_START(onModelSelectMenu);
|
||||
else
|
||||
POPUP_WARNING(STR_NO_MODELS_ON_SD);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if (result == STR_DELETE_MODEL) {
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL, nullptr);
|
||||
POPUP_CONFIRMATION(STR_DELETEMODEL, onDeleteModelConfirm);
|
||||
SET_WARNING_INFO(modelHeaders[sub].name, sizeof(g_model.header.name), ZCHAR);
|
||||
}
|
||||
#if defined(SDCARD)
|
||||
@@ -68,14 +78,6 @@ void onModelSelectMenu(const char * result)
|
||||
|
||||
void menuModelSelect(event_t event)
|
||||
{
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
storageCheck(true);
|
||||
eeDeleteModel(menuVerticalPosition); // delete file
|
||||
s_copyMode = 0;
|
||||
event = EVT_ENTRY_UP;
|
||||
}
|
||||
|
||||
event_t _event_ = event;
|
||||
if ((s_copyMode && EVT_KEY_MASK(event) == KEY_EXIT) || event == EVT_KEY_BREAK(KEY_EXIT) || IS_ROTARY_BREAK(event) || IS_ROTARY_LONG(event)) {
|
||||
_event_ = 0;
|
||||
|
||||
@@ -90,7 +90,7 @@ enum MenuModelSetupItems {
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_CHANNELS,
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_NOT_ACCESS_BIND,
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_MODEL_NUM,
|
||||
#if defined(EXTERNAL_ANTENNA)
|
||||
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_ANTENNA,
|
||||
#endif
|
||||
ITEM_MODEL_SETUP_INTERNAL_MODULE_FAILSAFE,
|
||||
@@ -224,8 +224,25 @@ inline uint8_t EXTERNAL_MODULE_TYPE_ROW()
|
||||
#define TRAINER_BLUETOOTH_S_ROW (bluetooth.distantAddr[0] == '\0' ? HIDDEN_ROW : LABEL())
|
||||
#define IF_BT_TRAINER_ON(x) (g_eeGeneral.bluetoothMode == BLUETOOTH_TRAINER ? (uint8_t)(x) : HIDDEN_ROW)
|
||||
|
||||
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
|
||||
#define EXTERNAL_ANTENNA_ROW ((isModuleXJT(INTERNAL_MODULE) && g_eeGeneral.antennaMode == ANTENNA_MODE_PER_MODEL) ? (uint8_t)0 : HIDDEN_ROW),
|
||||
void onModelAntennaSwitchConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
// Switch to external antenna confirmation
|
||||
g_model.moduleData[INTERNAL_MODULE].pxx.antennaMode = ANTENNA_MODE_EXTERNAL;
|
||||
globalData.externalAntennaEnabled = true;
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
reusableBuffer.moduleSetup.antennaMode = g_model.moduleData[INTERNAL_MODULE].pxx.antennaMode;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#define EXTERNAL_ANTENNA_ROW
|
||||
#endif
|
||||
|
||||
#if defined(PCBX7) || defined(PCBX9LITE)
|
||||
#define ANTENNA_ROW
|
||||
#if defined(BLUETOOTH)
|
||||
#define TRAINER_BLUETOOTH_ROW (g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_BLUETOOTH_M_ROW : (g_model.trainerData.mode == TRAINER_MODE_SLAVE_BLUETOOTH ? TRAINER_BLUETOOTH_S_ROW : HIDDEN_ROW)),
|
||||
#else
|
||||
@@ -234,12 +251,10 @@ inline uint8_t EXTERNAL_MODULE_TYPE_ROW()
|
||||
#define TRAINER_PPM_PARAMS_ROW (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#define TRAINER_ROWS LABEL(Trainer), 0, TRAINER_BLUETOOTH_ROW TRAINER_CHANNELS_ROW, TRAINER_PPM_PARAMS_ROW
|
||||
#elif defined(PCBXLITES)
|
||||
#define ANTENNA_ROW IF_NOT_PXX2_MODULE(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(0)),
|
||||
#define TRAINER_BLUETOOTH_ROW (g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_BLUETOOTH_M_ROW : (g_model.trainerData.mode == TRAINER_MODE_SLAVE_BLUETOOTH ? TRAINER_BLUETOOTH_S_ROW : HIDDEN_ROW))
|
||||
#define TRAINER_PPM_PARAMS_ROW (g_model.trainerData.mode == TRAINER_MODE_SLAVE ? (uint8_t)2 : HIDDEN_ROW)
|
||||
#define TRAINER_ROWS LABEL(Trainer), 0, IF_BT_TRAINER_ON(TRAINER_BLUETOOTH_ROW), TRAINER_CHANNELS_ROW, TRAINER_PPM_PARAMS_ROW
|
||||
#elif defined(PCBXLITE)
|
||||
#define ANTENNA_ROW IF_NOT_PXX2_MODULE(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(0)),
|
||||
#define TRAINER_BLUETOOTH_ROW (g_model.trainerData.mode == TRAINER_MODE_MASTER_BLUETOOTH ? TRAINER_BLUETOOTH_M_ROW : (g_model.trainerData.mode == TRAINER_MODE_SLAVE_BLUETOOTH ? TRAINER_BLUETOOTH_S_ROW : HIDDEN_ROW))
|
||||
#define TRAINER_ROWS IF_BT_TRAINER_ON(LABEL(Trainer)), IF_BT_TRAINER_ON(0), IF_BT_TRAINER_ON(TRAINER_BLUETOOTH_ROW), IF_BT_TRAINER_ON(TRAINER_CHANNELS_ROW), HIDDEN_ROW /* xlite has only BT trainer, so never PPM */
|
||||
#else
|
||||
@@ -274,7 +289,7 @@ void onBluetoothConnectMenu(const char * result)
|
||||
INTERNAL_MODULE_CHANNELS_ROWS, \
|
||||
IF_NOT_ACCESS_MODULE_RF(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(isModuleRxNumAvailable(INTERNAL_MODULE) ? (uint8_t)2 : (uint8_t)1)), \
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), /* RxNum */ \
|
||||
ANTENNA_ROW \
|
||||
EXTERNAL_ANTENNA_ROW \
|
||||
IF_INTERNAL_MODULE_ON(FAILSAFE_ROWS(INTERNAL_MODULE)), /* Failsafe */ \
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 1), /* Range check and Register buttons */ \
|
||||
IF_PXX2_MODULE(INTERNAL_MODULE, 0), /* Module options */ \
|
||||
@@ -285,16 +300,6 @@ void onBluetoothConnectMenu(const char * result)
|
||||
#define INTERNAL_MODULE_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(EXTERNAL_ANTENNA)
|
||||
void onAntennaSwitchConfirm(const char * result)
|
||||
{
|
||||
if (result == STR_OK) {
|
||||
// Switch to external antenna confirmation
|
||||
g_model.moduleData[INTERNAL_MODULE].pxx.external_antenna = XJT_EXTERNAL_ANTENNA;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void menuModelSetup(event_t event)
|
||||
{
|
||||
int8_t old_editMode = s_editMode;
|
||||
@@ -372,6 +377,9 @@ void menuModelSetup(event_t event)
|
||||
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) {
|
||||
memclear(&reusableBuffer.moduleSetup, sizeof(reusableBuffer.moduleSetup));
|
||||
reusableBuffer.moduleSetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
|
||||
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
|
||||
reusableBuffer.moduleSetup.antennaMode = g_model.moduleData[INTERNAL_MODULE].pxx.antennaMode;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (defined(DSM2) || defined(PXX))
|
||||
@@ -910,16 +918,16 @@ void menuModelSetup(event_t event)
|
||||
if (isModuleR9MNonAccess(EXTERNAL_MODULE)) {
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].subType > MODULE_SUBTYPE_R9M_EU) {
|
||||
POPUP_WARNING(STR_MODULE_PROTOCOL_FLEX_WARN_LINE1);
|
||||
SET_WARNING_INFO(STR_R9M_PROTO_WARN_LINE2, sizeof(TR_R9M_PROTO_WARN_LINE2) - 1, 0);
|
||||
SET_WARNING_INFO(STR_MODULE_PROTOCOL_WARN_LINE2, sizeof(TR_MODULE_PROTOCOL_WARN_LINE2) - 1, 0);
|
||||
}
|
||||
#if POPUP_LEVEL >= 3
|
||||
else if (g_model.moduleData[EXTERNAL_MODULE].subType == MODULE_SUBTYPE_R9M_EU) {
|
||||
POPUP_WARNING(STR_R9M_PROTO_EU_WARN_LINE1);
|
||||
SET_WARNING_INFO(STR_R9M_PROTO_WARN_LINE2, sizeof(TR_R9M_PROTO_WARN_LINE2) - 1, 0);
|
||||
POPUP_WARNING(STR_MODULE_PROTOCOL_EU_WARN_LINE1);
|
||||
SET_WARNING_INFO(STR_MODULE_PROTOCOL_WARN_LINE2, sizeof(TR_MODULE_PROTOCOL_WARN_LINE2) - 1, 0);
|
||||
}
|
||||
else {
|
||||
POPUP_WARNING(STR_R9M_PROTO_FCC_WARN_LINE1);
|
||||
SET_WARNING_INFO(STR_R9M_PROTO_WARN_LINE2, sizeof(TR_R9M_PROTO_WARN_LINE2) - 1, 0);
|
||||
POPUP_WARNING(STR_MODULE_PROTOCOL_FCC_WARN_LINE1);
|
||||
SET_WARNING_INFO(STR_MODULE_PROTOCOL_WARN_LINE2, sizeof(TR_MODULE_PROTOCOL_WARN_LINE2) - 1, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -1379,20 +1387,23 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(EXTERNAL_ANTENNA)
|
||||
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_ANTENNA:
|
||||
{
|
||||
uint8_t newAntennaSel = editChoice(MODEL_SETUP_2ND_COLUMN, y, STR_ANTENNASELECTION, STR_VANTENNATYPES, g_model.moduleData[INTERNAL_MODULE].pxx.external_antenna, 0, 1, attr, event);
|
||||
if (newAntennaSel != g_model.moduleData[INTERNAL_MODULE].pxx.external_antenna && newAntennaSel == XJT_EXTERNAL_ANTENNA) {
|
||||
POPUP_CONFIRMATION(STR_ANTENNACONFIRM1, onAntennaSwitchConfirm);
|
||||
const char * w = STR_ANTENNACONFIRM2;
|
||||
SET_WARNING_INFO(w, strlen(w), 0);
|
||||
}
|
||||
else {
|
||||
g_model.moduleData[INTERNAL_MODULE].pxx.external_antenna = newAntennaSel;
|
||||
reusableBuffer.moduleSetup.antennaMode = editChoice(MODEL_SETUP_2ND_COLUMN, y, INDENT TR_ANTENNA, STR_ANTENNA_MODES,
|
||||
reusableBuffer.moduleSetup.antennaMode == ANTENNA_MODE_PER_MODEL ? ANTENNA_MODE_INTERNAL : reusableBuffer.moduleSetup.antennaMode,
|
||||
ANTENNA_MODE_INTERNAL, ANTENNA_MODE_EXTERNAL, attr, event,
|
||||
[](int value) { return value != ANTENNA_MODE_PER_MODEL; });
|
||||
if (event && !s_editMode && reusableBuffer.moduleSetup.antennaMode != g_model.moduleData[INTERNAL_MODULE].pxx.antennaMode) {
|
||||
if (reusableBuffer.moduleSetup.antennaMode == ANTENNA_MODE_EXTERNAL && !isExternalAntennaEnabled()) {
|
||||
POPUP_CONFIRMATION(STR_ANTENNACONFIRM1, onModelAntennaSwitchConfirm);
|
||||
SET_WARNING_INFO(STR_ANTENNACONFIRM2, sizeof(TR_ANTENNACONFIRM2), 0);
|
||||
}
|
||||
else {
|
||||
g_model.moduleData[INTERNAL_MODULE].pxx.antennaMode = reusableBuffer.moduleSetup.antennaMode;
|
||||
checkExternalAntenna();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_OPTIONS:
|
||||
|
||||
@@ -70,7 +70,6 @@ void onCustomFunctionsFileSelectionMenu(const char * result)
|
||||
#endif // SDCARD
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
|
||||
void onAdjustGvarSourceLongEnterPress(const char * result)
|
||||
{
|
||||
CustomFunctionData * cfn = &g_model.customFn[menuVerticalPosition];
|
||||
@@ -148,9 +147,8 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#if defined(PCBXLITE)
|
||||
if (menuHorizontalPosition==0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
killEvents(KEY_ENTER);
|
||||
if (IS_SHIFT_PRESSED()) { // ENT LONG on xlite brings up switch type menu, so this menu is activated with SHIT + ENT LONG
|
||||
// ENT LONG on xlite brings up switch type menu, so this menu is activated with SHIT + ENT LONG
|
||||
if (menuHorizontalPosition==0 && event==EVT_KEY_LONG(KEY_ENTER) && IS_SHIFT_PRESSED() && !READ_ONLY()) {
|
||||
#else
|
||||
if (menuHorizontalPosition<0 && event==EVT_KEY_LONG(KEY_ENTER) && !READ_ONLY()) {
|
||||
#endif
|
||||
@@ -172,9 +170,6 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
}
|
||||
POPUP_MENU_START(onCustomFunctionsMenu);
|
||||
}
|
||||
#if defined(PCBXLITE)
|
||||
}
|
||||
#endif
|
||||
#endif // PCBTARANIS
|
||||
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
@@ -389,7 +384,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
else if (attr) {
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
}
|
||||
#if defined(PCBX7) || defined(PCBX9LITE)
|
||||
#if defined(NAVIGATION_X7)
|
||||
if (active || event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
CFN_PARAM(cfn) = CHECK_INCDEC_PARAM(event, val_displayed, val_min, val_max);
|
||||
if (func == FUNC_ADJUST_GVAR && attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
@@ -436,7 +431,7 @@ void menuSpecialFunctions(event_t event, CustomFunctionData * functions, CustomF
|
||||
break;
|
||||
}
|
||||
}
|
||||
#if defined(PCBX7) || defined(PCBX9LITE)
|
||||
#if defined(NAVIGATION_X7)
|
||||
if (sub==k && menuHorizontalPosition<0 && CFN_SWITCH(cfn)) {
|
||||
lcdInvertLine(i+1);
|
||||
}
|
||||
|
||||
@@ -247,12 +247,15 @@ void menuModelTelemetry(event_t event)
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_SOURCE: {
|
||||
lcdDrawTextAlignedLeft(y, INDENT TR_SOURCE);
|
||||
drawSource(TELEM_COL2, y, g_model.rssiSource ? MIXSRC_FIRST_TELEM + 3 * (g_model.rssiSource - 1) : 0, attr);
|
||||
if (g_model.rssiSource) {
|
||||
drawSource(TELEM_COL2, y, MIXSRC_FIRST_TELEM + 3 * (g_model.rssiSource - 1), attr);
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[g_model.rssiSource - 1];
|
||||
lcdDrawText(lcdNextPos, y, " ", attr);
|
||||
drawReceiverName(lcdNextPos, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, attr);
|
||||
}
|
||||
else {
|
||||
lcdDrawText(TELEM_COL2, y, STR_DEFAULT, attr);
|
||||
}
|
||||
if (attr) {
|
||||
g_model.rssiSource = checkIncDec(event, g_model.rssiSource, 0, MAX_TELEMETRY_SENSORS, EE_MODEL | NO_INCDEC_MARKS, isRssiSensorAvailable);
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ void menuModelSensor(event_t event)
|
||||
0, // Name
|
||||
0, // Type
|
||||
sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, // ID / Formula
|
||||
sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : LABEL(Receiver), // Receiver name
|
||||
sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : READONLY_ROW, // Receiver name
|
||||
((sensor->type == TELEM_TYPE_CALCULATED && (sensor->formula == TELEM_FORMULA_DIST)) || sensor->isConfigurable() ? (uint8_t)0 : HIDDEN_ROW), // Unit
|
||||
(sensor->isPrecConfigurable() && sensor->unit != UNIT_FAHRENHEIT ? (uint8_t)0 : HIDDEN_ROW), // Precision
|
||||
(sensor->unit >= UNIT_FIRST_VIRTUAL ? HIDDEN_ROW : (uint8_t)0), // Param1
|
||||
@@ -84,7 +84,6 @@ void menuModelSensor(event_t event)
|
||||
LcdFlags attr = (sub==k ? (s_editMode>0 ? BLINK|INVERS : INVERS) : 0);
|
||||
|
||||
switch (k) {
|
||||
|
||||
case SENSOR_FIELD_NAME:
|
||||
editSingleName(SENSOR_2ND_COLUMN, y, STR_NAME, sensor->label, TELEM_LABEL_LEN, event, attr);
|
||||
break;
|
||||
@@ -106,7 +105,7 @@ void menuModelSensor(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, STR_ID);
|
||||
lcdDrawHexNumber(SENSOR_2ND_COLUMN, y, sensor->id, LEFT|(menuHorizontalPosition==0 ? attr : 0));
|
||||
lcdDrawHexChar(SENSOR_3RD_COLUMN, y, sensor->instance & 0x1f, LEFT|(menuHorizontalPosition==1 ? attr : 0));
|
||||
if (attr) {
|
||||
if (attr && s_editMode > 0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, sensor->id, 0xffff);
|
||||
@@ -143,8 +142,19 @@ void menuModelSensor(event_t event)
|
||||
break;
|
||||
|
||||
case SENSOR_FILED_RECEIVER_NAME:
|
||||
lcdDrawTextAlignedLeft(y, STR_RECEIVER);
|
||||
drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, 0);
|
||||
lcdDrawTextAlignedLeft(y, STR_SOURCE);
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_FRSKY_SPORT && sensor->frskyInstance.rxIndex != TELEMETRY_ENDPOINT_SPORT) {
|
||||
drawReceiverName(SENSOR_2ND_COLUMN, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, 0);
|
||||
}
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
else if (isModuleUsingSport(INTERNAL_MODULE, g_model.moduleData[INTERNAL_MODULE].type)) {
|
||||
// far from perfect
|
||||
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_EXTERNAL_MODULE);
|
||||
}
|
||||
break;
|
||||
|
||||
case SENSOR_FIELD_UNIT:
|
||||
|
||||
@@ -511,14 +511,16 @@ void menuRadioSetup(event_t event)
|
||||
|
||||
#if defined(PWR_BUTTON_PRESS)
|
||||
case ITEM_RADIO_SETUP_PWR_ON_SPEED:
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_ON_SPEED);
|
||||
drawSlider(RADIO_SETUP_2ND_COLUMN, y, LCD_W - 2 - RADIO_SETUP_2ND_COLUMN, g_eeGeneral.pwrOnSpeed +1, 3, attr);
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_ON_DELAY);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 2 - g_eeGeneral.pwrOnSpeed, attr|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOnSpeed, -1, 2);
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_SETUP_PWR_OFF_SPEED:
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_OFF_SPEED);
|
||||
drawSlider(RADIO_SETUP_2ND_COLUMN, y, LCD_W - 2 - RADIO_SETUP_2ND_COLUMN, g_eeGeneral.pwrOffSpeed +1, 3, attr);
|
||||
lcdDrawTextAlignedLeft(y, STR_PWR_OFF_DELAY);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, 2 - g_eeGeneral.pwrOffSpeed, attr|LEFT);
|
||||
lcdDrawChar(lcdLastRightPos, y, 's');
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.pwrOffSpeed, -1, 2);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@@ -22,33 +22,35 @@
|
||||
|
||||
void menuChannelsView(event_t event)
|
||||
{
|
||||
static bool longNames = false;
|
||||
bool newLongNames = false;
|
||||
static bool secondPage = false;
|
||||
static bool mixersView = false;
|
||||
|
||||
uint8_t ch;
|
||||
|
||||
switch(event)
|
||||
{
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
memclear(&reusableBuffer.viewChannels, sizeof(reusableBuffer.viewChannels));
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
popMenu();
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_RIGHT):
|
||||
case EVT_KEY_FIRST(KEY_LEFT):
|
||||
secondPage = !secondPage;
|
||||
reusableBuffer.viewChannels.secondPage = !reusableBuffer.viewChannels.secondPage;
|
||||
break;
|
||||
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
mixersView = !mixersView;
|
||||
reusableBuffer.viewChannels.mixersView = !reusableBuffer.viewChannels.mixersView;
|
||||
break;
|
||||
}
|
||||
|
||||
if (secondPage)
|
||||
if (reusableBuffer.viewChannels.secondPage)
|
||||
ch = 16;
|
||||
else
|
||||
ch = 0;
|
||||
|
||||
if (mixersView) {
|
||||
if (reusableBuffer.viewChannels.mixersView) {
|
||||
lcdDrawTextAlignedCenter(0, TR_MIXERS_MONITOR);
|
||||
}
|
||||
else {
|
||||
@@ -67,13 +69,13 @@ void menuChannelsView(event_t event)
|
||||
// Channels
|
||||
for (uint8_t line=0; line<8; line++) {
|
||||
uint8_t y = 9+line*7;
|
||||
int32_t val = (mixersView) ? ex_chans[ch] : channelOutputs[ch];
|
||||
int32_t val = (reusableBuffer.viewChannels.mixersView) ? ex_chans[ch] : channelOutputs[ch];
|
||||
uint8_t ofs = (col ? 0 : 1);
|
||||
|
||||
// Channel name if present, number if not
|
||||
uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
|
||||
if (lenLabel > 4) {
|
||||
newLongNames = longNames = true;
|
||||
newLongNames = reusableBuffer.viewChannels.longNames = true;
|
||||
}
|
||||
|
||||
if (lenLabel > 0)
|
||||
@@ -83,13 +85,13 @@ void menuChannelsView(event_t event)
|
||||
|
||||
// Value
|
||||
#if defined(PPM_UNIT_US)
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
uint8_t wbar = (reusableBuffer.viewChannels.longNames ? 54 : 64);
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, PPM_CH_CENTER(ch)+val/2, TINSIZE|RIGHT);
|
||||
#elif defined(PPM_UNIT_PERCENT_PREC1)
|
||||
uint8_t wbar = (longNames ? 48 : 58);
|
||||
uint8_t wbar = (reusableBuffer.viewChannels.longNames ? 48 : 58);
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), PREC1|TINSIZE|RIGHT);
|
||||
#else
|
||||
uint8_t wbar = (longNames ? 54 : 64);
|
||||
uint8_t wbar = (reusableBuffer.viewChannels.longNames ? 54 : 64);
|
||||
lcdDrawNumber(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val)/10, TINSIZE|RIGHT);
|
||||
#endif
|
||||
|
||||
@@ -105,5 +107,5 @@ void menuChannelsView(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
longNames = newLongNames;
|
||||
reusableBuffer.viewChannels.longNames = newLongNames;
|
||||
}
|
||||
|
||||
@@ -50,16 +50,24 @@
|
||||
#define RSSSI_X (30)
|
||||
#define RSSSI_Y (31)
|
||||
#define RSSI_MAX 105
|
||||
|
||||
#define TRIM_LEN 23
|
||||
|
||||
void drawRSSIGauge()
|
||||
void drawExternalAntennaAndRSSI()
|
||||
{
|
||||
uint8_t bar = (RSSI_MAX - g_model.rssiAlarms.getWarningRssi()) / 4;
|
||||
#if defined(INTERNAL_MODULE_PXX1) && defined(EXTERNAL_ANTENNA)
|
||||
if (isModuleXJT(INTERNAL_MODULE) && isExternalAntennaEnabled()) {
|
||||
lcdDrawText(VBATT_X-1, VBATT_Y+8, "E", TINSIZE);
|
||||
}
|
||||
#endif
|
||||
|
||||
for(uint8_t i=1; i<5; i++) {
|
||||
if((TELEMETRY_RSSI() - g_model.rssiAlarms.getWarningRssi()) > bar*(i-1)) {
|
||||
lcdDrawFilledRect(RSSSI_X + i*4, RSSSI_Y - 2*i, 3, 2*i, SOLID, 0);
|
||||
if (TELEMETRY_RSSI() > 0) {
|
||||
auto warningRSSI = g_model.rssiAlarms.getWarningRssi();
|
||||
int8_t value = TELEMETRY_RSSI() - warningRSSI;
|
||||
uint8_t step = (RSSI_MAX - warningRSSI) / 4;
|
||||
for (uint8_t i = 1; i < 5; i++) {
|
||||
if (value > step * (i - 1)) {
|
||||
lcdDrawFilledRect(RSSSI_X + i * 4, RSSSI_Y - 2 * i + 1, 3, 2 * i - 1, SOLID, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,6 +279,7 @@ void onMainViewMenu(const char *result)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
POPUP_MENU_START(onMainViewMenu);
|
||||
}
|
||||
else if (result == STR_RESET_TELEMETRY) {
|
||||
telemetryReset();
|
||||
@@ -405,10 +414,8 @@ void menuMainView(event_t event)
|
||||
// Trims sliders
|
||||
displayTrims(mode);
|
||||
|
||||
// RSSI gauge
|
||||
if (TELEMETRY_RSSI() > 0) {
|
||||
drawRSSIGauge();
|
||||
}
|
||||
// RSSI gauge / external antenna
|
||||
drawExternalAntennaAndRSSI();
|
||||
}
|
||||
|
||||
if (view_base < VIEW_INPUTS) {
|
||||
|
||||
@@ -111,7 +111,6 @@ void menuStatisticsDebug(event_t event)
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
case EVT_ENTRY_UP:
|
||||
enableVBatBridge();
|
||||
break;
|
||||
|
||||
case EVT_KEY_LONG(KEY_ENTER):
|
||||
@@ -160,7 +159,7 @@ void menuStatisticsDebug(event_t event)
|
||||
if (IS_RESET_REASON_WATCHDOG()) {
|
||||
lcdDrawText(LCD_W-8*FW, 0, "WATCHDOG");
|
||||
}
|
||||
else if (unexpectedShutdown) {
|
||||
else if (globalData.unexpectedShutdown) {
|
||||
lcdDrawText(LCD_W-13*FW, 0, "UNEXP.SHTDOWN");
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -70,11 +70,11 @@ void title(const char * s)
|
||||
lcdDrawText(0, 0, s, INVERS);
|
||||
}
|
||||
|
||||
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event)
|
||||
choice_t editChoice(coord_t x, coord_t y, const char * label, const char *values, choice_t value, choice_t min, choice_t max, LcdFlags attr, event_t event, IsValueAvailable isValueAvailable)
|
||||
{
|
||||
drawFieldLabel(x, y, label);
|
||||
if (values) lcdDrawTextAtIndex(x, y, values, value-min, attr);
|
||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL);
|
||||
if (attr & (~RIGHT)) value = checkIncDec(event, value, min, max, (isModelMenuDisplayed()) ? EE_MODEL : EE_GENERAL, isValueAvailable);
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user