Merge against latest 2.3

This commit is contained in:
Bertrand Songis
2019-09-17 13:28:42 +02:00
247 changed files with 35085 additions and 42445 deletions
+1 -5
View File
@@ -209,7 +209,7 @@ void title(const char * s);
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);
@@ -264,8 +264,6 @@ extern char statusLineMsg[STATUS_LINE_LENGTH];
void showStatusLine();
void drawStatusLine();
#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();
@@ -273,8 +271,6 @@ void readModelNotes();
void menuChannelsView(event_t event);
#define LABEL(...) (uint8_t)-1
#if defined(ROTARY_ENCODER_NAVIGATION)
#define CURSOR_MOVED_LEFT(event) (event==EVT_ROTARY_LEFT)
#define CURSOR_MOVED_RIGHT(event) (event==EVT_ROTARY_RIGHT)
+1 -1
View File
@@ -44,7 +44,7 @@ const MenuHandlerFunc menuTabModel[] = {
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;
}
+30 -31
View File
@@ -24,46 +24,45 @@ extern uint8_t g_moduleIdx;
void menuModelFailsafe(event_t event)
{
static uint8_t maxNameLen = 4;
static int8_t lastModel = g_eeGeneral.currModel;
const coord_t barH = (LCD_H - FH) / 8 - 1;
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
uint8_t cols = 1;
uint8_t colW = LCD_W;
if (lastModel != g_eeGeneral.currModel) {
lastModel = g_eeGeneral.currModel;
maxNameLen = 4;
}
switch(event) {
case EVT_ENTRY:
reusableBuffer.modelFailsafe.maxNameLen = 4;
break;
if (event == EVT_KEY_LONG(KEY_ENTER)) {
killEvents(event);
event = 0;
case EVT_KEY_LONG(KEY_ENTER):
killEvents(event);
event = 0;
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
if (s_editMode) {
g_model.failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
s_editMode = 0;
if (menuVerticalPosition < sentModuleChannels(g_moduleIdx)) {
if (s_editMode) {
g_model.failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
s_editMode = 0;
}
else {
int16_t * failsafe = &g_model.failsafeChannels[menuVerticalPosition];
if (*failsafe < FAILSAFE_CHANNEL_HOLD)
*failsafe = FAILSAFE_CHANNEL_HOLD;
else if (*failsafe == FAILSAFE_CHANNEL_HOLD)
*failsafe = FAILSAFE_CHANNEL_NOPULSE;
else
*failsafe = 0;
}
}
else {
int16_t * failsafe = &g_model.failsafeChannels[menuVerticalPosition];
if (*failsafe < FAILSAFE_CHANNEL_HOLD)
*failsafe = FAILSAFE_CHANNEL_HOLD;
else if (*failsafe == FAILSAFE_CHANNEL_HOLD)
*failsafe = FAILSAFE_CHANNEL_NOPULSE;
else
*failsafe = 0;
// "Outputs => Failsafe" menu item
setCustomFailsafe(g_moduleIdx);
}
}
else {
// "Outputs => Failsafe" menu item
setCustomFailsafe(g_moduleIdx);
}
storageDirty(EE_MODEL);
AUDIO_WARNING1();
SEND_FAILSAFE_NOW(g_moduleIdx);
storageDirty(EE_MODEL);
AUDIO_WARNING1();
SEND_FAILSAFE_NOW(g_moduleIdx);
break;
}
SIMPLE_SUBMENU_NOTITLE(sentModuleChannels(g_moduleIdx) + 1);
@@ -95,7 +94,7 @@ void menuModelFailsafe(event_t event)
const int32_t channelValue = channelOutputs[ch+channelStart];
int32_t failsafeValue = g_model.failsafeChannels[8*col+line];
uint8_t lenLabel = ZLEN(g_model.limitData[ch+channelStart].name);
uint8_t barW = colW - FW * maxNameLen - FWNUM * 3; // default bar width
uint8_t barW = colW - FW * reusableBuffer.modelFailsafe.maxNameLen - FWNUM * 3; // default bar width
#if defined(PPM_UNIT_PERCENT_PREC1)
barW -= FWNUM + 1;
@@ -104,8 +103,8 @@ void menuModelFailsafe(event_t event)
// Channel name if present, number if not
if (lenLabel > 0) {
if (lenLabel > maxNameLen)
maxNameLen = lenLabel;
if (lenLabel > reusableBuffer.modelFailsafe.maxNameLen)
reusableBuffer.modelFailsafe.maxNameLen = lenLabel;
lcdDrawSizedText(x - colW, y, g_model.limitData[ch+channelStart].name, sizeof(g_model.limitData[ch+channelStart].name), ZCHAR | SMLSIZE);
}
else {
+2 -2
View File
@@ -126,12 +126,12 @@ void menuModelFlightModesAll(event_t event)
}
case ITEM_FLIGHT_MODES_FADE_IN:
lcdDrawNumber(32*FW-2, y, (10/DELAY_STEP)*p->fadeIn, attr|PREC1|RIGHT);
lcdDrawNumber(32*FW-2, y, p->fadeIn, attr|PREC1|RIGHT);
if (active) p->fadeIn = checkIncDec(event, p->fadeIn, 0, DELAY_MAX, EE_MODEL|NO_INCDEC_MARKS);
break;
case ITEM_FLIGHT_MODES_FADE_OUT:
lcdDrawNumber(35*FW, y, (10/DELAY_STEP)*p->fadeOut, attr|PREC1|RIGHT);
lcdDrawNumber(35*FW, y, p->fadeOut, attr|PREC1|RIGHT);
if (active) p->fadeOut = checkIncDec(event, p->fadeOut, 0, DELAY_MAX, EE_MODEL|NO_INCDEC_MARKS);
break;
+3 -2
View File
@@ -45,9 +45,10 @@ 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);
}
}
else if (result == STR_DELETE_MODEL) {
char * nametmp = reusableBuffer.modelsel.mainname;
+33 -31
View File
@@ -252,7 +252,7 @@ inline uint8_t EXTERNAL_MODULE_TYPE_ROW()
return 1;
#if defined(MULTIMODULE)
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
return 2 + MULTIMODULE_RFPROTO_COLUMNS(EXTERNAL_MODULE);
return 1 + MULTIMODULE_RFPROTO_COLUMNS(EXTERNAL_MODULE);
}
#endif
else
@@ -384,7 +384,8 @@ void menuModelSetup(event_t event)
MENU_CHECK(menuTabModel, MENU_MODEL_SETUP, ITEM_MODEL_SETUP_LINES_COUNT);
title(STR_MENUSETUP);
if (event == EVT_ENTRY) {
if (event == EVT_ENTRY || event == EVT_ENTRY_UP) {
memclear(&reusableBuffer.moduleSetup, sizeof(reusableBuffer.moduleSetup));
reusableBuffer.moduleSetup.r9mPower = g_model.moduleData[EXTERNAL_MODULE].pxx.power;
}
@@ -397,10 +398,10 @@ void menuModelSetup(event_t event)
int sub = menuVerticalPosition;
for (int i=0; i<NUM_BODY_LINES; ++i) {
for (int i = 0; i < NUM_BODY_LINES; ++i) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
uint8_t k = i+menuVerticalOffset;
for (int j=0; j<=k; j++) {
uint8_t k = i + menuVerticalOffset;
for (int j = 0; j <= k; j++) {
if (mstate_tab[j] == HIDDEN_ROW)
k++;
}
@@ -408,7 +409,7 @@ void menuModelSetup(event_t event)
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
LcdFlags attr = (sub == k ? blink : 0);
switch(k) {
switch (k) {
case ITEM_MODEL_SETUP_NAME:
editSingleName(MODEL_SETUP_2ND_COLUMN, y, STR_MODELNAME, g_model.header.name, sizeof(g_model.header.name), event, attr);
memcpy(modelHeaders[g_eeGeneral.currModel].name, g_model.header.name, sizeof(g_model.header.name));
@@ -756,7 +757,7 @@ void menuModelSetup(event_t event)
#if defined(INTERNAL_MODULE_PXX1)
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_INTERNAL_MODULE_PROTOCOLS, g_model.moduleData[INTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
if (isModuleXJT(INTERNAL_MODULE))
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, 1 + g_model.moduleData[INTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, 1 + g_model.moduleData[INTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
else if (isModuleISRM(INTERNAL_MODULE))
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_ISRM_RF_PROTOCOLS, 1 + g_model.moduleData[INTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
if (attr) {
@@ -807,7 +808,7 @@ void menuModelSetup(event_t event)
lcdDrawTextAlignedLeft(y, INDENT TR_MODE);
lcdDrawTextAtIndex(MODEL_SETUP_2ND_COLUMN, y, STR_EXTERNAL_MODULE_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].type, menuHorizontalPosition==0 ? attr : 0);
if (isModuleXJT(EXTERNAL_MODULE))
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_XJT_ACCST_RF_PROTOCOLS, 1+g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==1 ? attr : 0);
else if (isModuleDSM2(EXTERNAL_MODULE))
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_DSM_PROTOCOLS, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, menuHorizontalPosition==1 ? attr : 0);
else if (isModuleR9MNonAccess(EXTERNAL_MODULE))
@@ -844,27 +845,28 @@ void menuModelSetup(event_t event)
}
case 1:
if (isModuleDSM2(EXTERNAL_MODULE))
if (isModuleDSM2(EXTERNAL_MODULE)) {
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, DSM2_PROTO_LP45, DSM2_PROTO_DSMX);
}
#if defined(MULTIMODULE)
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
int multiRfProto = g_model.moduleData[EXTERNAL_MODULE].multi.customProto == 1 ? MODULE_SUBTYPE_MULTI_CUSTOM : g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
CHECK_INCDEC_MODELVAR(event, multiRfProto, MODULE_SUBTYPE_MULTI_FIRST, MODULE_SUBTYPE_MULTI_LAST);
if (checkIncDec_Ret) {
g_model.moduleData[EXTERNAL_MODULE].multi.customProto = (multiRfProto == MODULE_SUBTYPE_MULTI_CUSTOM);
if (!g_model.moduleData[EXTERNAL_MODULE].multi.customProto)
g_model.moduleData[EXTERNAL_MODULE].setMultiProtocol(multiRfProto);
g_model.moduleData[EXTERNAL_MODULE].subType = 0;
// Sensible default for DSM2 (same as for ppm): 7ch@22ms + Autodetect settings enabled
if (g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(true) == MODULE_SUBTYPE_MULTI_DSM2) {
g_model.moduleData[EXTERNAL_MODULE].multi.autoBindMode = 1;
}
else {
g_model.moduleData[EXTERNAL_MODULE].multi.autoBindMode = 0;
}
g_model.moduleData[EXTERNAL_MODULE].multi.optionValue = 0;
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
int multiRfProto = g_model.moduleData[EXTERNAL_MODULE].multi.customProto == 1 ? MODULE_SUBTYPE_MULTI_CUSTOM : g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false);
CHECK_INCDEC_MODELVAR(event, multiRfProto, MODULE_SUBTYPE_MULTI_FIRST, MODULE_SUBTYPE_MULTI_LAST);
if (checkIncDec_Ret) {
g_model.moduleData[EXTERNAL_MODULE].multi.customProto = (multiRfProto == MODULE_SUBTYPE_MULTI_CUSTOM);
if (!g_model.moduleData[EXTERNAL_MODULE].multi.customProto)
g_model.moduleData[EXTERNAL_MODULE].setMultiProtocol(multiRfProto);
g_model.moduleData[EXTERNAL_MODULE].subType = 0;
// Sensible default for DSM2 (same as for ppm): 7ch@22ms + Autodetect settings enabled
if (g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(true) == MODULE_SUBTYPE_MULTI_DSM2) {
g_model.moduleData[EXTERNAL_MODULE].multi.autoBindMode = 1;
}
else {
g_model.moduleData[EXTERNAL_MODULE].multi.autoBindMode = 0;
}
g_model.moduleData[EXTERNAL_MODULE].multi.optionValue = 0;
}
}
#endif
else if (isModuleR9MNonAccess(EXTERNAL_MODULE)) {
g_model.moduleData[EXTERNAL_MODULE].subType = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].subType,
@@ -872,7 +874,7 @@ void menuModelSetup(event_t event)
isR9MModeAvailable);
}
else {
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol,
g_model.moduleData[EXTERNAL_MODULE].subType = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].subType,
MODULE_SUBTYPE_PXX1_ACCST_D16, MODULE_SUBTYPE_PXX1_LAST, EE_MODEL,
isRfProtocolAvailable);
}
@@ -907,16 +909,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
}
+4 -1
View File
@@ -238,12 +238,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);
}
@@ -25,6 +25,7 @@ enum SensorFields {
SENSOR_FIELD_TYPE,
SENSOR_FIELD_ID,
SENSOR_FIELD_FORMULA=SENSOR_FIELD_ID,
SENSOR_FILED_RECEIVER_NAME,
SENSOR_FIELD_UNIT,
SENSOR_FIELD_PRECISION,
SENSOR_FIELD_PARAM1,
@@ -61,7 +62,23 @@ void menuModelSensor(event_t event)
drawSensorCustomValue(25*FW, 0, s_currIdx, getValue(MIXSRC_FIRST_TELEM+3*s_currIdx));
lcdDrawFilledRect(0, 0, LCD_W, FH, SOLID, FILL_WHITE|GREY_DEFAULT);
SUBMENU(STR_MENUSENSOR, SENSOR_FIELD_MAX, { 0, 0, sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, SENSOR_UNIT_ROWS, SENSOR_PREC_ROWS, SENSOR_PARAM1_ROWS, SENSOR_PARAM2_ROWS, SENSOR_PARAM3_ROWS, SENSOR_PARAM4_ROWS, SENSOR_AUTOOFFSET_ROWS, SENSOR_ONLYPOS_ROWS, SENSOR_FILTER_ROWS, SENSOR_PERSISTENT_ROWS, 0 });
SUBMENU(STR_MENUSENSOR, SENSOR_FIELD_MAX, {
0, //Name
0, // Type
sensor->type == TELEM_TYPE_CALCULATED ? (uint8_t)0 : (uint8_t)1, // ID / Formula
sensor->type == TELEM_TYPE_CALCULATED ? HIDDEN_ROW : READONLY_ROW, // Receiver name
SENSOR_UNIT_ROWS,
SENSOR_PREC_ROWS,
SENSOR_PARAM1_ROWS,
SENSOR_PARAM2_ROWS,
SENSOR_PARAM3_ROWS,
SENSOR_PARAM4_ROWS,
SENSOR_AUTOOFFSET_ROWS,
SENSOR_ONLYPOS_ROWS,
SENSOR_FILTER_ROWS,
SENSOR_PERSISTENT_ROWS,
0 // Logs
});
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
@@ -130,6 +147,20 @@ void menuModelSensor(event_t event)
}
break;
case SENSOR_FILED_RECEIVER_NAME:
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);
}
else if (isModuleUsingSport(INTERNAL_MODULE, g_model.moduleData[INTERNAL_MODULE].type)) {
// far from perfect
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_INTERNAL_MODULE);
}
else {
lcdDrawText(SENSOR_2ND_COLUMN, y, STR_EXTERNAL_MODULE);
}
break;
case SENSOR_FIELD_UNIT:
lcdDrawTextAlignedLeft(y, STR_UNIT);
lcdDrawTextAtIndex(SENSOR_2ND_COLUMN, y, STR_VTELEMUNIT, sensor->unit, attr);
+7 -5
View File
@@ -472,14 +472,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, 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, 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
@@ -528,7 +530,7 @@ void menuRadioSetup(event_t event)
#if defined(FAI_CHOICE)
case ITEM_RADIO_SETUP_FAI:
editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, "FAI Mode"), attr, event;
editCheckBox(g_eeGeneral.fai, RADIO_SETUP_2ND_COLUMN, y, "FAI Mode", attr, event);
if (attr && checkIncDec_Ret) {
if (g_eeGeneral.fai)
POPUP_WARNING("FAI\001mode blocked!");
+15 -13
View File
@@ -22,44 +22,46 @@
void menuChannelsView(event_t event)
{
static bool longNames = false;
static bool secondPage = false;
static bool mixersView = false;
uint8_t ch = 0;
uint8_t wbar = (longNames ? 54 : 64);
uint8_t wbar = (reusableBuffer.viewChannels.longNames ? 54 : 64);
int16_t limits = 512 * 2;
#if defined(PPM_UNIT_PERCENT_PREC1)
wbar -= 6;
#endif
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):
#if defined(ROTARY_ENCODER_NAVIGATION)
case EVT_ROTARY_LEFT:
case EVT_ROTARY_RIGHT:
#endif
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;
if (mixersView)
if (reusableBuffer.viewChannels.mixersView)
limits *= 2; // this could be handled nicer, but slower, by checking actual range for this mixer
else if (g_model.extendedLimits)
limits *= LIMIT_EXT_PERCENT / 100;
if (mixersView)
if (reusableBuffer.viewChannels.mixersView)
lcdDrawTextAlignedCenter(0, TR_MIXERS_MONITOR);
else
lcdDrawTextAlignedCenter(0, TR_CHANNELS_MONITOR);
@@ -76,13 +78,13 @@ void menuChannelsView(event_t event)
// Channels
for (uint8_t line=0; line < 8; line++) {
const uint8_t y = 9 + line * 7;
const int32_t val = mixersView ? ex_chans[ch] : channelOutputs[ch];
const int32_t val = reusableBuffer.viewChannels.mixersView ? ex_chans[ch] : channelOutputs[ch];
const uint8_t lenLabel = ZLEN(g_model.limitData[ch].name);
// Channel name if present, number if not
if (lenLabel > 0) {
if (lenLabel > 4)
longNames = true;
reusableBuffer.viewChannels.longNames = true;
lcdDrawSizedText(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE);
}
else {
+2 -12
View File
@@ -342,7 +342,7 @@ void menuMainViewChannelsMonitor(event_t event)
return menuChannelsView(event);
}
void onMainViewMenu(const char *result)
void onMainViewMenu(const char * result)
{
if (result == STR_RESET_TIMER1) {
timerReset(0);
@@ -364,6 +364,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();
@@ -409,16 +410,6 @@ void displaySwitch(coord_t x, coord_t y, int width, unsigned int index)
}
}
bool isMenuAvailable(int index)
{
if (index == 4) {
return modelHasNotes();
}
else {
return true;
}
}
int getSwitchCount()
{
int count = 0;
@@ -435,7 +426,6 @@ void menuMainView(event_t event)
static bool secondPage = false;
switch(event) {
case EVT_ENTRY:
killEvents(KEY_EXIT);
killEvents(KEY_UP);
+1 -6
View File
@@ -115,12 +115,7 @@ void menuStatisticsDebug(event_t event)
}
#endif
switch(event) {
case EVT_ENTRY:
case EVT_ENTRY_UP:
enableVBatBridge();
break;
switch (event) {
case EVT_KEY_LONG(KEY_ENTER):
g_eeGeneral.globalTimer = 0;
sessionTimer = 0;
+2 -2
View File
@@ -81,11 +81,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;
}