mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 01:35:21 +03:00
Set all custom failsafe channels at once (#5834)
* added setCustomFailsafe() * failsafe setup: set all custom channels with ENTER long press implements #5820 * added “outputs -> failsafe” menu item on horus * change “Trims >> Subtrims” to “Trims => Subtrims” * use translated string for “Outputs => Failsafe” * fixed entered TR_TRIMS2OFFSETS and TR_OUTPUTS2FAILSAFE When using ZCHARs in Horus texts, there are some artefacts when highlighted. * added “outputs -> failsafe” menu item on taranis 212x64 LCD * added “outputs -> failsafe” menu item on taranis 128x64 LCD * fixed indentation
This commit is contained in:
parent
4f8f00c4e2
commit
2ad0db2d80
19 changed files with 235 additions and 89 deletions
|
@ -1200,9 +1200,18 @@ void menuModelSetup(event_t event)
|
|||
}
|
||||
} else if (menuHorizontalPosition == 1) {
|
||||
s_editMode = 0;
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
g_moduleIdx = moduleIdx;
|
||||
pushMenu(menuModelFailsafe);
|
||||
if (moduleData.failsafeMode == FAILSAFE_CUSTOM) {
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
setCustomFailsafe(moduleIdx);
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(moduleIdx);
|
||||
}
|
||||
else if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
g_moduleIdx = moduleIdx;
|
||||
pushMenu(menuModelFailsafe);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lcdDrawSolidFilledRect(MODEL_SETUP_2ND_COLUMN, y, LCD_W - MODEL_SETUP_2ND_COLUMN, 8);
|
||||
|
@ -1476,7 +1485,6 @@ void menuModelSetup(event_t event)
|
|||
#if defined(CPUARM)
|
||||
void menuModelFailsafe(event_t event)
|
||||
{
|
||||
uint8_t ch = 8 * (menuVerticalPosition / 8);
|
||||
const uint8_t channelStart = g_model.moduleData[g_moduleIdx].channelsStart;
|
||||
const int lim = (g_model.extendedLimits ? (512 * LIMIT_EXT_PERCENT / 100) : 512) * 2;
|
||||
uint8_t wbar = LCD_W - FW * 4 - FWNUM * 4;
|
||||
|
@ -1487,37 +1495,44 @@ void menuModelFailsafe(event_t event)
|
|||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
event = 0;
|
||||
if (s_editMode) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
s_editMode = 0;
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
|
||||
if (menuVerticalPosition < NUM_CHANNELS(g_moduleIdx)) {
|
||||
if (s_editMode) {
|
||||
g_model.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition] = channelOutputs[menuVerticalPosition+channelStart];
|
||||
s_editMode = 0;
|
||||
}
|
||||
else {
|
||||
int16_t & failsafe = g_model.moduleData[g_moduleIdx].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.moduleData[g_moduleIdx].failsafeChannels[menuVerticalPosition];
|
||||
if (failsafe < FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_HOLD;
|
||||
else if (failsafe == FAILSAFE_CHANNEL_HOLD)
|
||||
failsafe = FAILSAFE_CHANNEL_NOPULSE;
|
||||
else
|
||||
failsafe = 0;
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
// "Outputs => Failsafe" menu item
|
||||
setCustomFailsafe(g_moduleIdx);
|
||||
}
|
||||
|
||||
storageDirty(EE_MODEL);
|
||||
AUDIO_WARNING1();
|
||||
SEND_FAILSAFE_NOW(g_moduleIdx);
|
||||
}
|
||||
|
||||
SIMPLE_SUBMENU_NOTITLE(NUM_CHANNELS(g_moduleIdx));
|
||||
SIMPLE_SUBMENU_NOTITLE(NUM_CHANNELS(g_moduleIdx) + 1);
|
||||
|
||||
lcdDrawTextAlignedCenter(0, FAILSAFESET);
|
||||
lcdInvertLine(0);
|
||||
|
||||
const coord_t x = 1;
|
||||
coord_t y = FH + 1;
|
||||
uint8_t line = (menuVerticalPosition >= NUM_CHANNELS(g_moduleIdx) ? 2 : 0);
|
||||
uint8_t ch = (menuVerticalPosition >= 8 ? 8 : 0) + line;
|
||||
|
||||
// Channels
|
||||
for (uint8_t line=0; line<8; line++) {
|
||||
const coord_t y = 9+line*7;
|
||||
for (; line < 8; line++) {
|
||||
const int32_t channelValue = channelOutputs[ch+channelStart];
|
||||
int32_t failsafeValue = g_model.moduleData[g_moduleIdx].failsafeChannels[ch];
|
||||
|
||||
|
@ -1571,9 +1586,15 @@ void menuModelFailsafe(event_t event)
|
|||
lcdDrawSolidHorizontalLine(xFailsafe, y+3, lenFailsafe);
|
||||
lcdDrawSolidHorizontalLine(xFailsafe, y+4, lenFailsafe);
|
||||
|
||||
y += FH - 1;
|
||||
|
||||
if (++ch >= NUM_CHANNELS(g_moduleIdx))
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (menuVerticalPosition >= NUM_CHANNELS(g_moduleIdx)) {
|
||||
// Outputs => Failsafe
|
||||
lcdDrawText(CENTER_OFS, LCD_H - (FH + 1), STR_OUTPUTS2FAILSAFE, INVERS);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue