From 358a57945f4d5425d639dce630f6a8ed5d0b9d67 Mon Sep 17 00:00:00 2001 From: "bsongis@gmail.com" Date: Fri, 12 Apr 2013 18:57:52 +0000 Subject: [PATCH] [Taranis] External module and Trainer support (menus only) --- src/menu_model.cpp | 435 ++++++++++++++++++++------------- src/myeeprom.h | 125 ++++++---- src/opentx.h | 18 +- src/pulses_arm.cpp | 38 +-- src/taranis/trainer_driver.cpp | 2 +- src/translations.cpp | 1 + src/translations.h | 1 + src/translations/en.h | 6 +- 8 files changed, 376 insertions(+), 250 deletions(-) diff --git a/src/menu_model.cpp b/src/menu_model.cpp index 824198143..4c065197d 100644 --- a/src/menu_model.cpp +++ b/src/menu_model.cpp @@ -72,7 +72,6 @@ void menuModelCustomFunctions(uint8_t event); void menuModelTelemetry(uint8_t event); void menuModelTemplates(uint8_t event); void menuModelExpoOne(uint8_t event); -void menuModelFailsafe(uint8_t event); const MenuFuncP_PROGMEM menuTabModel[] PROGMEM = { menuModelSelect, @@ -613,6 +612,103 @@ void menuModelSelect(uint8_t event) } } +#if defined(PCBTARANIS) +uint8_t g_moduleIdx; +void menuModelFailsafe(uint8_t event) +{ + static bool longNames = false; + bool newLongNames = false; + uint8_t ch; + + SUBMENU_NOTITLE(32, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); + + switch(event) + { + case EVT_KEY_BREAK(KEY_EXIT): + popMenu(); + return; + } + + if (m_posVert >= 16) + ch = 16; + else + ch = 0; + + lcd_putsCenter(0*FH, FAILSAFESET); + lcd_invert_line(0); + + // Column separator + lcd_vline(LCD_W/2, FH, LCD_H-FH); + + for (uint8_t col=0; col<2; col++) { + + uint8_t x = col*LCD_W/2+1; + + // Channels + for (uint8_t line=0; line<8; line++) { + uint8_t y = 9+line*7; + int32_t val; + uint8_t ofs = (col ? 0 : 1); + + if (ch < g_model.moduleData[g_moduleIdx].channelsStart || ch >= NUM_CHANNELS(g_moduleIdx) + g_model.moduleData[g_moduleIdx].channelsStart) + val = 0; + else if (s_editMode && m_posVert == ch) + val = channelOutputs[ch]; + else + val = g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line]; + + if (m_posVert == ch && event == EVT_KEY_LONG(KEY_ENTER)) { + g_model.moduleData[g_moduleIdx].failsafeChannels[8*col+line] = val; + eeDirty(EE_MODEL); + s_editMode = 0; + AUDIO_WARNING1(); + SEND_FAILSAFE_NOW(); + killEvents(event); + } + + // Channel name if present, number if not + uint8_t lenLabel = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name)); + if (lenLabel > 4) { + newLongNames = longNames = true; + } + + if (lenLabel > 0) + lcd_putsnAtt(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE); + else + putsChn(x+1-ofs, y, ch+1, SMLSIZE); + + uint8_t wbar = (longNames ? 48 : 58); + + // Value + LcdFlags flags = PREC1 | TINSIZE; + + if (m_posVert == ch) { + flags |= INVERS; + if (s_editMode) + flags |= BLINK; + } + + lcd_outdezNAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), flags); + + // Gauge + lcd_rect(x+LCD_W/2-3-wbar-ofs, y, wbar+1, 6); + uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2; + uint8_t len = limit((uint8_t)1, uint8_t((abs(val) * wbar/2 + lim/2) / lim), uint8_t(wbar/2)); + uint8_t x0 = (val>0) ? x+LCD_W/2-ofs-3-wbar/2 : x+LCD_W/2-ofs-2-wbar/2-len; + lcd_hline(x0, y+1, len); + lcd_hline(x0, y+2, len); + lcd_hline(x0, y+3, len); + lcd_hline(x0, y+4, len); + + ch++; + } + } + + longNames = newLongNames; + +} +#endif + void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uint8_t active) { #if defined(CPUM64) @@ -727,10 +823,17 @@ enum menuModelSetupItems { ITEM_MODEL_SWITCHES_WARNING, ITEM_MODEL_BEEP_CENTER, #if defined(PCBTARANIS) - ITEM_MODE_INTERNAL_MODULE_LABEL, - ITEM_MODE_INTERNAL_MODULE_MODE, - ITEM_MODE_INTERNAL_MODULE_BIND, - ITEM_MODE_INTERNAL_MODULE_FAILSAFE, + ITEM_MODEL_INTERNAL_MODULE_LABEL, + ITEM_MODEL_INTERNAL_MODULE_MODE, + ITEM_MODEL_INTERNAL_MODULE_CHANNELS, + ITEM_MODEL_INTERNAL_MODULE_BIND, + ITEM_MODEL_INTERNAL_MODULE_FAILSAFE, + ITEM_MODEL_EXTERNAL_MODULE_LABEL, + ITEM_MODEL_EXTERNAL_MODULE_MODE, + ITEM_MODEL_EXTERNAL_MODULE_CHANNELS, + ITEM_MODEL_EXTERNAL_MODULE_BIND, + ITEM_MODEL_EXTERNAL_MODULE_FAILSAFE, + ITEM_MODEL_TRAINER, #else ITEM_MODEL_PROTOCOL, IF_PCBSKY9X(ITEM_MODEL_PPM2_PROTOCOL) @@ -780,13 +883,20 @@ void menuModelSetup(uint8_t event) #if defined(PCBTARANIS) if (event == EVT_KEY_LONG(KEY_EXIT)) { - pxxFlag = 0; + pxxFlag[0] = 0; + pxxFlag[1] = 0; } #endif #if defined(PCBTARANIS) bool CURSOR_ON_CELL = (m_posHorz >= 0); - MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, 1+ITEM_MODEL_SETUP_MAX, { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 2, 2, g_model.failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0}); + #define IF_PORT1_ON(x) (g_model.moduleData[0].rfProtocol == RF_PROTO_OFF ? (uint8_t)-1 : (uint8_t)(x)) + #define IF_PORT2_ON(x) (g_model.externalModule == MODULE_TYPE_NONE ? (uint8_t)-1 : (uint8_t)(x)) + #define IF_PORT_ON(idx, x) (idx==0 ? IS_PORT1_ON(x) : IS_PORT2_ON(x)) + #define IF_PORT2_XJT(x) (IS_MODULE_XJT(1) ? (uint8_t)x : (uint8_t)-1) + #define PORT2_CHANNELS_ROWS() (g_model.externalModule == MODULE_TYPE_NONE ? (uint8_t)-1 : (g_model.externalModule == MODULE_TYPE_DJT ? (uint8_t)0 : (g_model.externalModule == MODULE_TYPE_DSM2 ? (uint8_t)0 : ((uint8_t)1)))) + #define PORT_CHANNELS_ROWS(x) (x==0 ? (uint8_t)1 : (uint8_t)PORT2_CHANNELS_ROWS()) + MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, 1+ITEM_MODEL_SETUP_MAX, { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NAVIGATION_LINE_BY_LINE|(NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1), LABEL(InternalModule), 0, IF_PORT1_ON(1), IF_PORT1_ON(2), IF_PORT1_ON(g_model.moduleData[0].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0), LABEL(ExternalModule), g_model.externalModule==MODULE_TYPE_XJT ? (uint8_t)1 : (uint8_t)0, PORT2_CHANNELS_ROWS(), (IS_MODULE_PPM(1) || IS_MODULE_XJT(1) ? (uint8_t)2 : (uint8_t)-1), IF_PORT2_XJT(g_model.moduleData[1].failsafeMode==FAILSAFE_CUSTOM ? (uint8_t)1 : (uint8_t)0), 0}); #elif defined(CPUM64) #define CURSOR_ON_CELL (true) uint8_t protocol = g_model.protocol; @@ -1004,89 +1114,172 @@ void menuModelSetup(uint8_t event) break; #if defined(PCBTARANIS) - case ITEM_MODE_INTERNAL_MODULE_LABEL: + case ITEM_MODEL_INTERNAL_MODULE_LABEL: lcd_putsLeft(y, TR_INTERNALRF); break; - case ITEM_MODE_INTERNAL_MODULE_MODE: + case ITEM_MODEL_EXTERNAL_MODULE_LABEL: + lcd_putsLeft(y, TR_EXTERNALRF); + break; + + case ITEM_MODEL_INTERNAL_MODULE_MODE: lcd_putsLeft(y, STR_MODE); - lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""X16\0""D8\0 ""LR12"), 1+g_model.rfProtocol, m_posHorz==0 ? attr : 0); - lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+5*FW+3, y, STR_CH, m_posHorz==1 ? attr : 0); - lcd_outdezAtt(lcdLastPos, y, g_model.ppmSCH+1, LEFT | (m_posHorz==1 ? attr : 0)); - lcd_putc(lcdLastPos, y, '-'); - lcd_outdezAtt(lcdLastPos + FW+1, y, g_model.ppmSCH+NUM_PORT1_CHANNELS(g_model), LEFT | (m_posHorz==2 ? attr : 0)); - if (attr && m_posHorz < 0) lcd_filled_rect(MODEL_SETUP_2ND_COLUMN, y, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8); + lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""OFF\0""X16\0""D8\0 ""LR12"), 1+g_model.moduleData[0].rfProtocol, attr); + if (attr) { + CHECK_INCDEC_MODELVAR(event, g_model.moduleData[0].rfProtocol, RF_PROTO_OFF, RF_PROTO_LAST); + if (checkIncDec_Ret) { + g_model.moduleData[0].channelsStart = 0; + g_model.moduleData[0].channelsCount = MAX_PORT1_CHANNELS(); + } + } + break; + + case ITEM_MODEL_EXTERNAL_MODULE_MODE: + lcd_putsLeft(y, PSTR(INDENT "Module")); + lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, PSTR("\004""---\0""PPM\0""XJT\0""DJT\0""DSM2"), g_model.externalModule, m_posHorz==0 ? attr : 0); + if (g_model.externalModule == MODULE_TYPE_XJT) + lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+5*FW, y, PSTR("\004""OFF\0""X16\0""D8\0 ""LR12"), 1+g_model.moduleData[1].rfProtocol, m_posHorz==1 ? attr : 0); if (attr && (editMode>0 || p1valdiff)) { - static const int8_t maxChannels[] = { 0, 4, 0, 2 }; switch (m_posHorz) { case 0: - CHECK_INCDEC_MODELVAR(event, g_model.rfProtocol, RF_PROTO_OFF, RF_PROTO_LAST); - g_model.ppmSCH = 0; - g_model.ppmNCH = maxChannels[1+g_model.rfProtocol]; + CHECK_INCDEC_MODELVAR(event, g_model.externalModule, MODULE_TYPE_NONE, MODULE_TYPE_LAST); + if (checkIncDec_Ret) { + g_model.moduleData[1].channelsStart = 0; + g_model.moduleData[1].channelsCount = MAX_PORT2_CHANNELS(); + } break; case 1: - CHECK_INCDEC_MODELVAR_ZERO(event, g_model.ppmSCH, 32-8-(g_model.ppmNCH*2)); - break; - case 2: - CHECK_INCDEC_MODELVAR_ZERO(event, g_model.ppmNCH, min(maxChannels[1+g_model.rfProtocol], (32-g_model.ppmSCH)/2-4)); - break; + CHECK_INCDEC_MODELVAR(event, g_model.moduleData[1].rfProtocol, RF_PROTO_X16, RF_PROTO_LAST); + if (checkIncDec_Ret) { + g_model.moduleData[1].channelsStart = 0; + g_model.moduleData[1].channelsCount = MAX_PORT2_CHANNELS(); + } } } break; - case ITEM_MODE_INTERNAL_MODULE_BIND: - lcd_putsLeft(y, STR_RXNUM); - lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN, y, g_model.modelId, (m_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2); - if (attr && m_posHorz==0) { - if (editMode>0 || p1valdiff) { - CHECK_INCDEC_MODELVAR_ZERO(event, g_model.modelId, 63); - if (checkIncDec_Ret) - modelIds[g_eeGeneral.currModel] = g_model.modelId; - } - if (editMode==0 && event==EVT_KEY_BREAK(KEY_ENTER)) - checkModelIdUnique(g_eeGeneral.currModel); - } - lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MODULE_BIND, m_posHorz==1 ? attr : 0); - lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, STR_MODULE_RANGE, m_posHorz==2 ? attr : 0); - { - uint8_t newFlag = 0; - if (attr && m_posHorz>0 && s_editMode>0) { - if (m_posHorz == 1) - newFlag = PXX_SEND_RXNUM; - else if(m_posHorz == 2) { - newFlag = PXX_SEND_RANGECHECK; - displayPopup("RSSI: "); - lcd_outdezAtt(16+4*FW, 5*FH, frskyData.rssi[0].value, BOLD); + case ITEM_MODEL_INTERNAL_MODULE_CHANNELS: + case ITEM_MODEL_EXTERNAL_MODULE_CHANNELS: + { + uint8_t moduleIdx = (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? 1 : 0); + ModuleData & moduleData = g_model.moduleData[moduleIdx]; + lcd_putsLeft(y, PSTR(INDENT "Channels Range")); + if ((int8_t)PORT_CHANNELS_ROWS(moduleIdx) >= 0) { + lcd_putsAtt(MODEL_SETUP_2ND_COLUMN, y, STR_CH, m_posHorz==0 ? attr : 0); + lcd_outdezAtt(lcdLastPos, y, moduleData.channelsStart+1, LEFT | (m_posHorz==0 ? attr : 0)); + lcd_putc(lcdLastPos, y, '-'); + lcd_outdezAtt(lcdLastPos + FW+1, y, moduleData.channelsStart+NUM_CHANNELS(moduleIdx), LEFT | (m_posHorz==1 ? attr : 0)); + if (attr && (editMode>0 || p1valdiff)) { + switch (m_posHorz) { + case 0: + CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsStart, 32-8-moduleData.channelsCount); + break; + case 1: + CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.channelsCount, min(MAX_CHANNELS(moduleIdx), 32-moduleData.channelsStart-8)); + break; } } - pxxFlag = newFlag; } break; + } - case ITEM_MODE_INTERNAL_MODULE_FAILSAFE: + case ITEM_MODEL_INTERNAL_MODULE_BIND: + case ITEM_MODEL_EXTERNAL_MODULE_BIND: + { + uint8_t moduleIdx = (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? 1 : 0); + if (IS_MODULE_PPM(moduleIdx)) { + lcd_putsLeft(y, STR_PPMFRAME); + lcd_puts(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS); + lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT); + lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u'); + lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.ppmDelay*50)+300, (m_posHorz < 0 || m_posHorz==1) ? attr : 0); + lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.pulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0); + + if (attr && (editMode>0 || p1valdiff)) { + switch (m_posHorz) { + case 0: + CHECK_INCDEC_MODELVAR(event, g_model.ppmFrameLength, -20, 35); + break; + case 1: + CHECK_INCDEC_MODELVAR(event, g_model.ppmDelay, -4, 10); + break; + case 2: + CHECK_INCDEC_MODELVAR_ZERO(event, g_model.pulsePol, 1); + break; + } + } + } + else { + lcd_putsLeft(y, STR_RXNUM); + if (IS_MODULE_XJT(moduleIdx)) { + lcd_outdezNAtt(MODEL_SETUP_2ND_COLUMN, y, g_model.modelId, (m_posHorz==0 ? attr : 0) | LEADING0|LEFT, 2); + if (attr && m_posHorz==0) { + if (editMode>0 || p1valdiff) { + CHECK_INCDEC_MODELVAR_ZERO(event, g_model.modelId, 63); + if (checkIncDec_Ret) + modelIds[g_eeGeneral.currModel] = g_model.modelId; + } + if (editMode==0 && event==EVT_KEY_BREAK(KEY_ENTER)) + checkModelIdUnique(g_eeGeneral.currModel); + } + + lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MODULE_BIND, m_posHorz==1 ? attr : 0); + lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, STR_MODULE_RANGE, m_posHorz==2 ? attr : 0); + { + uint8_t newFlag = 0; + if (attr && m_posHorz>0 && s_editMode>0) { + if (m_posHorz == 1) + newFlag = PXX_SEND_RXNUM; + else if (m_posHorz == 2) { + newFlag = PXX_SEND_RANGECHECK; + displayPopup("RSSI: "); + lcd_outdezAtt(16+4*FW, 5*FH, frskyData.rssi[0].value, BOLD); + } + } + pxxFlag[moduleIdx] = newFlag; + } + } + } + break; + } + + case ITEM_MODEL_INTERNAL_MODULE_FAILSAFE: + case ITEM_MODEL_EXTERNAL_MODULE_FAILSAFE: + { + uint8_t moduleIdx = (k>=ITEM_MODEL_EXTERNAL_MODULE_LABEL ? 1 : 0); + ModuleData & moduleData = g_model.moduleData[moduleIdx]; lcd_putsLeft(y, TR_FAILSAFE); - lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, g_model.failsafeMode, m_posHorz==0 ? attr : 0); - if (g_model.failsafeMode == FAILSAFE_CUSTOM) lcd_putsAtt(MODEL_SETUP_2ND_COLUMN + 10*FW, y, STR_SET, m_posHorz==1 ? attr : 0); - if (attr) { - if (g_model.failsafeMode != FAILSAFE_CUSTOM) - m_posHorz = 0; - if (m_posHorz==0) { - if (editMode>0 || p1valdiff) { - CHECK_INCDEC_MODELVAR_ZERO(event, g_model.failsafeMode, FAILSAFE_LAST); - if (checkIncDec_Ret) SEND_FAILSAFE_NOW(); + if (IS_MODULE_XJT(moduleIdx)) { + lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN, y, STR_VFAILSAFE, moduleData.failsafeMode, m_posHorz==0 ? attr : 0); + if (moduleData.failsafeMode == FAILSAFE_CUSTOM) lcd_putsAtt(MODEL_SETUP_2ND_COLUMN + 10*FW, y, STR_SET, m_posHorz==1 ? attr : 0); + if (attr) { + if (moduleData.failsafeMode != FAILSAFE_CUSTOM) + m_posHorz = 0; + if (m_posHorz==0) { + if (editMode>0 || p1valdiff) { + CHECK_INCDEC_MODELVAR_ZERO(event, moduleData.failsafeMode, FAILSAFE_LAST); + if (checkIncDec_Ret) SEND_FAILSAFE_NOW(); + } + } + else if (m_posHorz==1) { + s_editMode = 0; + if (moduleData.failsafeMode==FAILSAFE_CUSTOM && event==EVT_KEY_FIRST(KEY_ENTER)) { + g_moduleIdx = moduleIdx; + pushMenu(menuModelFailsafe); + } + } + else { + lcd_filled_rect(MODEL_SETUP_2ND_COLUMN, y, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8); } } - else if (m_posHorz==1) { - s_editMode = 0; - if (g_model.failsafeMode==FAILSAFE_CUSTOM && event==EVT_KEY_FIRST(KEY_ENTER)) - pushMenu(menuModelFailsafe); - } - else { - lcd_filled_rect(MODEL_SETUP_2ND_COLUMN, y, LCD_W-MODEL_SETUP_2ND_COLUMN-MENUS_SCROLLBAR_WIDTH, 8); - } } break; + } + + case ITEM_MODEL_TRAINER: + g_model.trainerMode = onoffMenuItem(g_model.trainerMode, MODEL_SETUP_2ND_COLUMN, y, STR_TRAINER, attr, event); + break; #else case ITEM_MODEL_PROTOCOL: #if defined(PCBSKY9X) @@ -1101,7 +1294,7 @@ void menuModelSetup(uint8_t event) lcd_putsAtt(MODEL_SETUP_2ND_COLUMN+4*FW+3, y, STR_CH, m_posHorz==1 ? attr : 0); lcd_outdezAtt(lcdLastPos, y, g_model.ppmSCH+1, LEFT | (m_posHorz==1 ? attr : 0)); lcd_putc(lcdLastPos, y, '-'); - lcd_outdezAtt(lcdLastPos + FW+1, y, g_model.ppmSCH+NUM_PORT1_CHANNELS(g_model), LEFT | (m_posHorz==2 ? attr : 0)); + lcd_outdezAtt(lcdLastPos + FW+1, y, g_model.ppmSCH+NUM_PORT1_CHANNELS(), LEFT | (m_posHorz==2 ? attr : 0)); #else if (IS_PPM_PROTOCOL(protocol)) { lcd_putsiAtt(MODEL_SETUP_2ND_COLUMN+7*FW, y, STR_NCHANNELS, g_model.ppmNCH+2, m_posHorz!=0 ? attr : 0); @@ -1123,7 +1316,7 @@ void menuModelSetup(uint8_t event) case 1: #if defined(PCBSKY9X) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.ppmSCH, 32-8-(g_model.ppmNCH*2)); - g_model.ppmFrameLength = NUM_PORT1_CHANNELS(g_model)>NUM_PORT2_CHANNELS(g_model) ? 4*(NUM_PORT1_CHANNELS(g_model)-8) : 4*(NUM_PORT2_CHANNELS(g_model)-8); + g_model.ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8); #else CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, -2, 4); g_model.ppmFrameLength = g_model.ppmNCH * 8; @@ -1133,7 +1326,7 @@ void menuModelSetup(uint8_t event) case 2: if (IS_PPM_PROTOCOL(protocol)) { CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, -2, min(4, (32-g_model.ppmSCH)/2-4)); - g_model.ppmFrameLength = NUM_PORT1_CHANNELS(g_model)>NUM_PORT2_CHANNELS(g_model) ? 4*(NUM_PORT1_CHANNELS(g_model)-8) : 4*(NUM_PORT2_CHANNELS(g_model)-8); + g_model.ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8); } else REPEAT_LAST_CURSOR_MOVE(); @@ -1155,11 +1348,11 @@ void menuModelSetup(uint8_t event) switch (m_posHorz) { case 0: CHECK_INCDEC_MODELVAR_ZERO(event, g_model.ppm2SCH, 32-8-(g_model.ppm2NCH*2)); - g_model.ppmFrameLength = NUM_PORT1_CHANNELS(g_model)>NUM_PORT2_CHANNELS(g_model) ? 4*(NUM_PORT1_CHANNELS(g_model)-8) : 4*(NUM_PORT2_CHANNELS(g_model)-8); + g_model.ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8); break; case 1: CHECK_INCDEC_MODELVAR(event, g_model.ppm2NCH, -2, min(4, (32-g_model.ppm2SCH)/2-4)); - g_model.ppmFrameLength = NUM_PORT1_CHANNELS(g_model)>NUM_PORT2_CHANNELS(g_model) ? 4*(NUM_PORT1_CHANNELS(g_model)-8) : 4*(NUM_PORT2_CHANNELS(g_model)-8); + g_model.ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8); break; } } @@ -1168,7 +1361,7 @@ void menuModelSetup(uint8_t event) case ITEM_MODEL_PROTOCOL_PARAMS: if (IS_PPM_PROTOCOL(protocol)) { - lcd_putsLeft( y, STR_PPMFRAME); + lcd_putsLeft(y, STR_PPMFRAME); lcd_puts(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS); lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT); lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u'); @@ -1217,7 +1410,7 @@ void menuModelSetup(uint8_t event) s_editMode = 0; if (event==EVT_KEY_LONG(KEY_ENTER)) { // send reset code - pxxFlag = PXX_SEND_RXNUM; + pxxFlag[0] = PXX_SEND_RXNUM; } } } @@ -4259,99 +4452,3 @@ void menuModelTemplates(uint8_t event) } #endif -#if defined(PCBTARANIS) -void menuModelFailsafe(uint8_t event) -{ - static bool longNames = false; - bool newLongNames = false; - uint8_t ch; - - SUBMENU_NOTITLE(32, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}); - - switch(event) - { - case EVT_KEY_BREAK(KEY_EXIT): - popMenu(); - return; - } - - if (m_posVert >= 16) - ch = 16; - else - ch = 0; - - lcd_putsCenter(0*FH, FAILSAFESET); - lcd_invert_line(0); - - // Column separator - lcd_vline(LCD_W/2, FH, LCD_H-FH); - - for (uint8_t col=0; col<2; col++) { - - uint8_t x = col*LCD_W/2+1; - - // Channels - for (uint8_t line=0; line<8; line++) { - uint8_t y = 9+line*7; - int32_t val; - uint8_t ofs = (col ? 0 : 1); - - if (ch >= g_model.ppmSCH) - if (s_editMode && m_posVert == ch) - val = (ch < NUM_PORT1_CHANNELS(g_model) + g_model.ppmSCH ? channelOutputs[ch] : 0); - else - val = (ch < NUM_PORT1_CHANNELS(g_model) + g_model.ppmSCH ? g_model.failsafeChannels[ch] : 0); - else - val = 0; - - if (m_posVert == ch && event == EVT_KEY_LONG(KEY_ENTER)) { - g_model.failsafeChannels[ch] = val; - eeDirty(EE_MODEL); - s_editMode = 0; - AUDIO_WARNING1(); - SEND_FAILSAFE_NOW(); - killEvents(event); - } - - // Channel name if present, number if not - uint8_t lenLabel = zlen(g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name)); - if (lenLabel > 4) { - newLongNames = longNames = true; - } - - if (lenLabel > 0) - lcd_putsnAtt(x+1-ofs, y, g_model.limitData[ch].name, sizeof(g_model.limitData[ch].name), ZCHAR | SMLSIZE); - else - putsChn(x+1-ofs, y, ch+1, SMLSIZE); - - uint8_t wbar = (longNames ? 48 : 58); - - // Value - LcdFlags flags = PREC1 | TINSIZE; - - if (m_posVert == ch) { - flags |= INVERS; - if (s_editMode) - flags |= BLINK; - } - - lcd_outdezNAtt(x+LCD_W/2-3-wbar-ofs, y+1, calcRESXto1000(val), flags); - - // Gauge - lcd_rect(x+LCD_W/2-3-wbar-ofs, y, wbar+1, 6); - uint16_t lim = g_model.extendedLimits ? 640*2 : 512*2; - uint8_t len = limit((uint8_t)1, uint8_t((abs(val) * wbar/2 + lim/2) / lim), uint8_t(wbar/2)); - uint8_t x0 = (val>0) ? x+LCD_W/2-ofs-3-wbar/2 : x+LCD_W/2-ofs-2-wbar/2-len; - lcd_hline(x0, y+1, len); - lcd_hline(x0, y+2, len); - lcd_hline(x0, y+3, len); - lcd_hline(x0, y+4, len); - - ch++; - } - } - - longNames = newLongNames; - -} -#endif diff --git a/src/myeeprom.h b/src/myeeprom.h index b742fe479..1167cb444 100644 --- a/src/myeeprom.h +++ b/src/myeeprom.h @@ -67,11 +67,63 @@ #define PACK( __Declaration__ ) __Declaration__ __attribute__((__packed__)) #endif +#if defined(CPUARM) + #define MAX_MODELS 60 + #define NUM_CHNOUT 32 // number of real output channels CH1-CH32 + #define MAX_PHASES 9 + #define MAX_MIXERS 64 + #define MAX_EXPOS 32 + #define NUM_CSW 32 // number of custom switches + #define NUM_CFN 32 // number of functions assigned to switches +#elif defined(PCBGRUVIN9X) + #define MAX_MODELS 30 + #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 + #define MAX_PHASES 6 + #define MAX_MIXERS 32 + #define MAX_EXPOS 16 + #define NUM_CSW 15 // number of custom switches + #define NUM_CFN 24 // number of functions assigned to switches +#elif defined(CPUM128) + #define MAX_MODELS 30 + #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 + #define MAX_PHASES 5 + #define MAX_MIXERS 32 + #define MAX_EXPOS 14 + #define NUM_CSW 15 // number of custom switches + #define NUM_CFN 24 // number of functions assigned to switches +#else + #define MAX_MODELS 16 + #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 + #define MAX_PHASES 5 + #define MAX_MIXERS 32 + #define MAX_EXPOS 14 + #define NUM_CSW 12 // number of custom switches + #define NUM_CFN 16 // number of functions assigned to switches +#endif + +#define MAX_TIMERS 2 + +#if defined(CPUARM) + #define MAX_CURVES 16 + #define NUM_POINTS 512 + #define CURVTYPE int16_t +#else + #define MAX_CURVES 8 + #define NUM_POINTS (112-MAX_CURVES) + #define CURVTYPE int8_t +#endif + +#if defined(PCBTARANIS) + #define NUM_MODULES 2 +#else + #define NUM_MODULES 1 +#endif + typedef int16_t gvar_t; #if !defined(PCBSTD) -typedef char gvar_name_t[6]; -#define GVAR_MAX 1024 + typedef char gvar_name_t[6]; + #define GVAR_MAX 1024 #endif #define RESERVE_RANGE_FOR_GVARS 10 @@ -154,12 +206,20 @@ enum BeeperMode { #define EXTRA_GENERAL_FIELDS #endif +PACK(typedef struct t_ModuleData { + int8_t rfProtocol; + uint8_t channelsStart; + int8_t channelsCount; // 0=8 channels + uint8_t failsafeMode; + int16_t failsafeChannels[NUM_CHNOUT]; +}) ModuleData; + #if defined(PCBTARANIS) -#define MODELDATA_EXTRA char bitmap[10]; int8_t rfProtocol; uint8_t ppmSCH; uint8_t failsafeMode; int16_t failsafeChannels[16]; +#define MODELDATA_EXTRA char bitmap[10]; uint8_t externalModule; ModuleData moduleData[NUM_MODULES]; uint8_t trainerMode; #define LIMITDATA_EXTRA char name[6]; #define swstate_t uint16_t #elif defined(PCBSKY9X) -#define MODELDATA_EXTRA uint8_t ppmSCH; int8_t ppm2SCH; int8_t ppm2NCH; int8_t rfProtocol; +#define MODELDATA_EXTRA uint8_t ppmSCH; int8_t ppm2SCH; int8_t ppm2NCH; ModuleData moduleData[NUM_MODULES]; #define LIMITDATA_EXTRA #define swstate_t uint8_t #else @@ -854,52 +914,6 @@ PACK(typedef struct t_PhaseData { }) PhaseData; #endif -#if defined(CPUARM) - #define MAX_MODELS 60 - #define NUM_CHNOUT 32 // number of real output channels CH1-CH32 - #define MAX_PHASES 9 - #define MAX_MIXERS 64 - #define MAX_EXPOS 32 - #define NUM_CSW 32 // number of custom switches - #define NUM_CFN 32 // number of functions assigned to switches -#elif defined(PCBGRUVIN9X) - #define MAX_MODELS 30 - #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 - #define MAX_PHASES 6 - #define MAX_MIXERS 32 - #define MAX_EXPOS 16 - #define NUM_CSW 15 // number of custom switches - #define NUM_CFN 24 // number of functions assigned to switches -#elif defined(CPUM128) - #define MAX_MODELS 30 - #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 - #define MAX_PHASES 5 - #define MAX_MIXERS 32 - #define MAX_EXPOS 14 - #define NUM_CSW 15 // number of custom switches - #define NUM_CFN 24 // number of functions assigned to switches -#else - #define MAX_MODELS 16 - #define NUM_CHNOUT 16 // number of real output channels CH1-CH16 - #define MAX_PHASES 5 - #define MAX_MIXERS 32 - #define MAX_EXPOS 14 - #define NUM_CSW 12 // number of custom switches - #define NUM_CFN 16 // number of functions assigned to switches -#endif - -#define MAX_TIMERS 2 - -#if defined(CPUARM) - #define MAX_CURVES 16 - #define NUM_POINTS 512 - #define CURVTYPE int16_t -#else - #define MAX_CURVES 8 - #define NUM_POINTS (112-MAX_CURVES) - #define CURVTYPE int8_t -#endif - enum SwitchSources { SWSRC_NONE = 0, @@ -1136,7 +1150,7 @@ enum Protocols { PROTO_NONE }; -enum RfProtocols { +enum RFProtocols { RF_PROTO_OFF = -1, RF_PROTO_X16, RF_PROTO_D8, @@ -1144,6 +1158,15 @@ enum RfProtocols { RF_PROTO_LAST = RF_PROTO_LR12 }; +enum ModuleTypes { + MODULE_TYPE_NONE = 0, + MODULE_TYPE_PPM, + MODULE_TYPE_XJT, + MODULE_TYPE_DJT, + MODULE_TYPE_DSM2, + MODULE_TYPE_LAST = MODULE_TYPE_DJT +}; + enum FailsafeModes { FAILSAFE_HOLD, FAILSAFE_CUSTOM, diff --git a/src/opentx.h b/src/opentx.h index 6888d9bc1..7e966cb61 100644 --- a/src/opentx.h +++ b/src/opentx.h @@ -457,13 +457,17 @@ enum EnumKeys { #endif #if defined(PCBTARANIS) - #define NUM_PORT1_CHANNELS(model) ((8+(model.ppmNCH*2))) + static const int8_t maxChannelsModules[] = { 0, 8, 8, 0, 0 }; + static const int8_t maxChannelsXJT[] = { 0, 8, 0, 4 }; + #define IS_MODULE_XJT(idx) ((idx==0 || g_model.externalModule == MODULE_TYPE_XJT) && (g_model.moduleData[idx].rfProtocol != RF_PROTO_OFF)) + #define IS_MODULE_PPM(idx) (idx==1 && g_model.externalModule == MODULE_TYPE_PPM) + #define NUM_CHANNELS(idx) (8+g_model.moduleData[idx].channelsCount) + #define MAX_PORT1_CHANNELS() (maxChannelsXJT[1+g_model.moduleData[0].rfProtocol]) + #define MAX_PORT2_CHANNELS() ((g_model.externalModule == MODULE_TYPE_XJT) ? maxChannelsXJT[1+g_model.moduleData[1].rfProtocol] : maxChannelsModules[g_model.externalModule]) + #define MAX_CHANNELS(idx) (idx==0 ? MAX_PORT1_CHANNELS() : MAX_PORT2_CHANNELS()) #else - #define NUM_PORT1_CHANNELS(model) (IS_PXX_PROTOCOL(model.protocol) ? 8 : (IS_DSM2_PROTOCOL(model.protocol) ? 6 : (8+(model.ppmNCH*2)))) -#endif - -#if defined(PCBSKY9X) - #define NUM_PORT2_CHANNELS(model) (8+(model.ppm2NCH*2)) + #define NUM_PORT1_CHANNELS() (IS_PXX_PROTOCOL(g_model.protocol) ? 8 : (IS_DSM2_PROTOCOL(g_model.protocol) ? 6 : (8+(g_model.ppmNCH*2)))) + #define NUM_PORT2_CHANNELS() (8+(g_model.ppm2NCH*2)) #endif #include "lcd.h" @@ -666,7 +670,7 @@ extern uint16_t inacCounter; extern uint16_t inacSum; #if defined(PXX) -extern uint8_t pxxFlag; +extern uint8_t pxxFlag[NUM_MODULES]; #endif #define PXX_SEND_RXNUM 0x01 diff --git a/src/pulses_arm.cpp b/src/pulses_arm.cpp index 61d64882e..d114425e0 100644 --- a/src/pulses_arm.cpp +++ b/src/pulses_arm.cpp @@ -39,7 +39,7 @@ uint8_t s_pulses_paused = 0; uint8_t s_current_protocol = 255; uint32_t failsafeCounter = 100; -uint8_t pxxFlag = 0; +uint8_t pxxFlag[NUM_MODULES] = { 0 }; uint16_t ppmStream[20] = { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; uint16_t ppm2Stream[20] = { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } ; @@ -113,11 +113,11 @@ void setupPulsesPPM(PPM_PORT_PARAM) // Don't enable interrupts pwmCh = 1; ptr = ppm2Stream; firstCh = g_model.ppm2SCH; - lastCh = min(NUM_CHNOUT, firstCh + 8 + (g_model.ppm2NCH * 2)); + lastCh = min(NUM_CHNOUT, firstCh + NUM_PORT2_CHANNELS()); } #else #define firstCh 0 - uint32_t lastCh = 8 + g_model.ppmNCH * 2; //Channels *2 + uint32_t lastCh = NUM_CHANNELS(0); uint16_t * ptr = ppmStream; #endif @@ -312,18 +312,18 @@ void setupPulsesPXX() /* FLAG1 */ uint8_t flag1; - if (pxxFlag & PXX_SEND_RXNUM) { - flag1 = (g_model.rfProtocol << 6) | (g_eeGeneral.countryCode << 1) | pxxFlag; + if (pxxFlag[0] & PXX_SEND_RXNUM) { + flag1 = (g_model.moduleData[0].rfProtocol << 6) | (g_eeGeneral.countryCode << 1) | pxxFlag[0]; } else { - flag1 = (g_model.rfProtocol << 6) | pxxFlag; + flag1 = (g_model.moduleData[0].rfProtocol << 6) | pxxFlag[0]; #if defined(PCBTARANIS) - if (g_model.failsafeMode != FAILSAFE_HOLD) { + if (g_model.moduleData[0].failsafeMode != FAILSAFE_HOLD) { if (failsafeCounter-- == 0) { failsafeCounter = 1000; flag1 |= PXX_SEND_FAILSAFE; } - if (failsafeCounter == 0 && g_model.ppmNCH > 0) { + if (failsafeCounter == 0 && g_model.moduleData[0].channelsCount > 0) { flag1 |= PXX_SEND_FAILSAFE; } } @@ -338,12 +338,12 @@ void setupPulsesPXX() static uint32_t pass = 0; uint32_t sendUpperChannels = 0; if (pass++ & 0x01) { - sendUpperChannels = g_model.ppmNCH*2; + sendUpperChannels = g_model.moduleData[0].channelsCount; } for (uint32_t i=0; i<8; i+=2) { #if defined(PCBTARANIS) if (flag1 & PXX_SEND_FAILSAFE) { - if (g_model.failsafeMode == FAILSAFE_NOPULSES) { + if (g_model.moduleData[0].failsafeMode == FAILSAFE_NOPULSES) { if (i < sendUpperChannels) { chan = 3072; chan_1 = 3072; @@ -355,14 +355,14 @@ void setupPulsesPXX() } else { if (i < sendUpperChannels) { - chan = limit(2048, PPM_CH_CENTER(8+g_model.ppmSCH+i) - PPM_CENTER + (g_model.failsafeChannels[8+g_model.ppmSCH+i] * 512 / 682) + 3072, 4095); - chan_1 = limit(2048, PPM_CH_CENTER(8+g_model.ppmSCH+i+1) - PPM_CENTER + (g_model.failsafeChannels[8+g_model.ppmSCH+i+1] * 512 / 682) + 3072, 4095); + chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[0].channelsStart+i) - PPM_CENTER + (g_model.moduleData[0].failsafeChannels[8+g_model.moduleData[0].channelsStart+i] * 512 / 682) + 3072, 4095); + chan_1 = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[0].channelsStart+i+1) - PPM_CENTER + (g_model.moduleData[0].failsafeChannels[8+g_model.moduleData[0].channelsStart+i+1] * 512 / 682) + 3072, 4095); if (chan == 3072) chan = 3073; if (chan_1 == 3072) chan_1 = 3073; } else { - chan = limit(0, PPM_CH_CENTER(g_model.ppmSCH+i) - PPM_CENTER + (g_model.failsafeChannels[g_model.ppmSCH+i] * 512 / 682) + 1024, 2047); - chan_1 = limit(0, PPM_CH_CENTER(g_model.ppmSCH+i+1) - PPM_CENTER + (g_model.failsafeChannels[g_model.ppmSCH+i+1] * 512 / 682) + 1024, 2047); + chan = limit(0, PPM_CH_CENTER(g_model.moduleData[0].channelsStart+i) - PPM_CENTER + (g_model.moduleData[0].failsafeChannels[g_model.moduleData[0].channelsStart+i] * 512 / 682) + 1024, 2047); + chan_1 = limit(0, PPM_CH_CENTER(g_model.moduleData[0].channelsStart+i+1) - PPM_CENTER + (g_model.moduleData[0].failsafeChannels[g_model.moduleData[0].channelsStart+i+1] * 512 / 682) + 1024, 2047); if (chan == 1024) chan = 1025; if (chan_1 == 1024) chan_1 = 1025; } @@ -372,12 +372,12 @@ void setupPulsesPXX() #endif { if (i < sendUpperChannels) { - chan = limit(2048, PPM_CH_CENTER(8+g_model.ppmSCH+i) - PPM_CENTER + (channelOutputs[8+g_model.ppmSCH+i] * 512 / 682) + 3072, 4095); - chan_1 = limit(2048, PPM_CH_CENTER(8+g_model.ppmSCH+i+1) - PPM_CENTER + (channelOutputs[8+g_model.ppmSCH+i+1] * 512 / 682) + 3072, 4095); + chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[0].channelsStart+i) - PPM_CENTER + (channelOutputs[8+g_model.moduleData[0].channelsStart+i] * 512 / 682) + 3072, 4095); + chan_1 = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[0].channelsStart+i+1) - PPM_CENTER + (channelOutputs[8+g_model.moduleData[0].channelsStart+i+1] * 512 / 682) + 3072, 4095); } else { - chan = limit(0, PPM_CH_CENTER(g_model.ppmSCH+i) - PPM_CENTER + (channelOutputs[g_model.ppmSCH+i] * 512 / 682) + 1024, 2047); - chan_1 = limit(0, PPM_CH_CENTER(g_model.ppmSCH+i+1) - PPM_CENTER + (channelOutputs[g_model.ppmSCH+i+1] * 512 / 682) + 1024, 2047); + chan = limit(0, PPM_CH_CENTER(g_model.moduleData[0].channelsStart+i) - PPM_CENTER + (channelOutputs[g_model.moduleData[0].channelsStart+i] * 512 / 682) + 1024, 2047); + chan_1 = limit(0, PPM_CH_CENTER(g_model.moduleData[0].channelsStart+i+1) - PPM_CENTER + (channelOutputs[g_model.moduleData[0].channelsStart+i+1] * 512 / 682) + 1024, 2047); } } putPcmByte(chan); // Low byte of channel @@ -554,7 +554,7 @@ void setupPulses() heartbeat |= HEART_TIMER_PULSES; #if defined(PCBTARANIS) - uint8_t required_protocol = (g_model.rfProtocol == RF_PROTO_OFF ? PROTO_NONE : PROTO_PXX); + uint8_t required_protocol = (g_model.moduleData[0].rfProtocol == RF_PROTO_OFF ? PROTO_NONE : PROTO_PXX); #else uint8_t required_protocol = g_model.protocol; #endif diff --git a/src/taranis/trainer_driver.cpp b/src/taranis/trainer_driver.cpp index e1f24c301..8838b86ff 100644 --- a/src/taranis/trainer_driver.cpp +++ b/src/taranis/trainer_driver.cpp @@ -57,7 +57,7 @@ void setupTrainerPulses() int16_t PPM_range = g_model.extendedLimits ? 640 * 2 : 512 * 2; //range of 0.7..1.7msec uint16_t *ptr ; - uint32_t p=8+g_model.ppmNCH*2; //Channels *2 + uint32_t p = NUM_CHANNELS(0); ptr = TrainerPpmStream ; diff --git a/src/translations.cpp b/src/translations.cpp index bf2a5f82e..d40be447c 100644 --- a/src/translations.cpp +++ b/src/translations.cpp @@ -442,6 +442,7 @@ const pm_char STR_BYTES[] PROGMEM = "bytes"; const pm_char STR_MODULE_BIND[] PROGMEM = "[Bind]"; const pm_char STR_MODULE_RANGE[] PROGMEM = "[Range]"; const pm_char STR_SET[] PROGMEM = "[Set]"; +const pm_char STR_TRAINER[] PROGMEM = "Trainer"; #endif const pm_uchar font_5x7[] PROGMEM = { diff --git a/src/translations.h b/src/translations.h index 64753b260..0bad92ad6 100644 --- a/src/translations.h +++ b/src/translations.h @@ -580,6 +580,7 @@ extern const pm_char STR_CHANNELS_MONITOR[]; extern const pm_char STR_MODULE_BIND[]; extern const pm_char STR_MODULE_RANGE[]; extern const pm_char STR_SET[]; + extern const pm_char STR_TRAINER[]; #endif // TODO move to translations files diff --git a/src/translations/en.h b/src/translations/en.h index 863157495..2008737c2 100644 --- a/src/translations/en.h +++ b/src/translations/en.h @@ -365,8 +365,8 @@ #define TR_TTRACE TR("T-Source","Throttle Source") #define TR_TTRIM TR("T-Trim","Throttle Trim") #define TR_BEEPCTR TR("Ctr Beep","Center Beep") -#define TR_PROTO TR(INDENT"Proto",INDENT"Protocol") -#define TR_PPMFRAME "PPM frame" +#define TR_PROTO TR(INDENT "Proto", INDENT "Protocol") +#define TR_PPMFRAME TR("PPM frame", INDENT "PPM frame") #define TR_MS "ms" #define TR_SWITCH "Switch" #define TR_TRIMS "Trims" @@ -590,6 +590,6 @@ #define TR_CHANNELS_MONITOR "CHANNEL MONITOR" #define TR_INTERNALRF "Internal RF" #define TR_EXTERNALRF "External RF" -#define TR_FAILSAFE INDENT"Failsafe mode" +#define TR_FAILSAFE INDENT "Failsafe mode" #define TR_FAILSAFESET "FAILSAFE SETTINGS" #define TR_COUNTRYCODE "Country Code"