mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
Remaining Phase instead of Flightmode
This commit is contained in:
parent
ed91931184
commit
49aac252d7
24 changed files with 36 additions and 37 deletions
|
@ -40,7 +40,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||
|
||||
int modesCount = firmware->getCapability(FlightModes);
|
||||
|
||||
// Phase name
|
||||
// Flight mode name
|
||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||
if (modesCount) {
|
||||
ui->name->setValidator(new QRegExpValidator(rx, this));
|
||||
|
@ -51,7 +51,7 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
|
|||
ui->name->setDisabled(true);
|
||||
}
|
||||
|
||||
// Phase switch
|
||||
// Flight mode switch
|
||||
if (phaseIdx > 0) {
|
||||
ui->swtch->setModel(switchModel);
|
||||
connect(ui->swtch, SIGNAL(activated(int)), this, SLOT(phaseSwitchChanged(int)));
|
||||
|
|
|
@ -223,7 +223,7 @@ const char * const audioFilenames[] = {
|
|||
};
|
||||
|
||||
BitField<(AU_SPECIAL_SOUND_FIRST)> sdAvailableSystemAudioFiles;
|
||||
BitField<(MAX_FLIGHT_MODES * 2/*on, off*/)> sdAvailablePhaseAudioFiles;
|
||||
BitField<(MAX_FLIGHT_MODES * 2/*on, off*/)> sdAvailableFlightmodeAudioFiles;
|
||||
BitField<(SWSRC_LAST_SWITCH+NUM_XPOTS*XPOTS_MULTIPOS_COUNT)> sdAvailableSwitchAudioFiles;
|
||||
BitField<(MAX_LOGICAL_SWITCHES * 2/*on, off*/)> sdAvailableLogicalSwitchAudioFiles;
|
||||
|
||||
|
@ -294,10 +294,10 @@ char * getModelAudioPath(char * path)
|
|||
return result;
|
||||
}
|
||||
|
||||
void getPhaseAudioFile(char * filename, int index, unsigned int event)
|
||||
void getFlightmodeAudioFile(char * filename, int index, unsigned int event)
|
||||
{
|
||||
char * str = getModelAudioPath(filename);
|
||||
char * tmp = strcat_phasename(str, index);
|
||||
char * tmp = strcatFlightmodeName(str, index);
|
||||
strcpy(tmp, suffixes[event]);
|
||||
strcat(tmp, SOUNDS_EXT);
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ void referenceModelAudioFiles()
|
|||
FILINFO fno;
|
||||
DIR dir;
|
||||
|
||||
sdAvailablePhaseAudioFiles.reset();
|
||||
sdAvailableFlightmodeAudioFiles.reset();
|
||||
sdAvailableSwitchAudioFiles.reset();
|
||||
sdAvailableLogicalSwitchAudioFiles.reset();
|
||||
|
||||
|
@ -379,13 +379,13 @@ void referenceModelAudioFiles()
|
|||
if (len < 5 || strcasecmp(fno.fname+len-4, SOUNDS_EXT) || (fno.fattrib & AM_DIR)) continue;
|
||||
TRACE("referenceModelAudioFiles(): using file: %s", fno.fname);
|
||||
|
||||
// Phases Audio Files <phasename>-[on|off].wav
|
||||
// Flight modes Audio Files <flightmodename>-[on|off].wav
|
||||
for (int i=0; i<MAX_FLIGHT_MODES && !found; i++) {
|
||||
for (int event=0; event<2; event++) {
|
||||
getPhaseAudioFile(path, i, event);
|
||||
getFlightmodeAudioFile(path, i, event);
|
||||
// TRACE("referenceModelAudioFiles(): searching for %s in %s", filename, fno.fname);
|
||||
if (!strcasecmp(filename, fno.fname)) {
|
||||
sdAvailablePhaseAudioFiles.setBit(INDEX_PHASE_AUDIO_FILE(i, event));
|
||||
sdAvailableFlightmodeAudioFiles.setBit(INDEX_PHASE_AUDIO_FILE(i, event));
|
||||
found = true;
|
||||
TRACE("\tfound: %s", filename);
|
||||
break;
|
||||
|
@ -437,8 +437,8 @@ bool isAudioFileReferenced(uint32_t i, char * filename)
|
|||
}
|
||||
}
|
||||
else if (category == PHASE_AUDIO_CATEGORY) {
|
||||
if (sdAvailablePhaseAudioFiles.getBit(INDEX_PHASE_AUDIO_FILE(index, event))) {
|
||||
getPhaseAudioFile(filename, index, event);
|
||||
if (sdAvailableFlightmodeAudioFiles.getBit(INDEX_PHASE_AUDIO_FILE(index, event))) {
|
||||
getFlightmodeAudioFile(filename, index, event);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ void menuModelGVarOne(event_t event)
|
|||
break;
|
||||
|
||||
default:
|
||||
drawStringWithIndex(0, y, STR_FP, k-GVAR_FIELD_FM0);
|
||||
drawStringWithIndex(0, y, STR_FM, k-GVAR_FIELD_FM0);
|
||||
editGVarValue(GVAR_2ND_COLUMN, y, event, s_currIdx, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
void displayFlightModes(coord_t x, coord_t y, FlightModesType value)
|
||||
{
|
||||
lcdDrawText(x, y, STR_FP);
|
||||
lcdDrawText(x, y, STR_FM);
|
||||
x = lcdNextPos + 1;
|
||||
for (uint8_t p=0; p<MAX_FLIGHT_MODES; p++) {
|
||||
lcdDrawChar(x, y, ((value & (1<<p)) ? '-' : '0'+p));
|
||||
|
|
|
@ -107,7 +107,7 @@ void menuModelGVarOne(event_t event)
|
|||
break;
|
||||
|
||||
default:
|
||||
drawStringWithIndex(0, y, STR_FP, k-GVAR_FIELD_FM0);
|
||||
drawStringWithIndex(0, y, STR_FM, k-GVAR_FIELD_FM0);
|
||||
editGVarValue(GVAR_2ND_COLUMN, y, event, s_currIdx, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ void menuModelGVars(event_t event)
|
|||
if (after2seconds) {
|
||||
menuTitle = STR_GVARS;
|
||||
for (int i=0; i<MAX_GVARS; i++) {
|
||||
drawStringWithIndex(GVARS_FM_COLUMN(i), 1, STR_FP, i, SMLSIZE|(getFlightMode()==i ? INVERS : 0));
|
||||
drawStringWithIndex(GVARS_FM_COLUMN(i), 1, STR_FM, i, SMLSIZE|(getFlightMode()==i ? INVERS : 0));
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -101,7 +101,7 @@ bool menuModelGVarOne(event_t event)
|
|||
break;
|
||||
|
||||
default:
|
||||
drawStringWithIndex(MENUS_MARGIN_LEFT, y, STR_FP, k-GVAR_FIELD_FM0);
|
||||
drawStringWithIndex(MENUS_MARGIN_LEFT, y, STR_FM, k-GVAR_FIELD_FM0);
|
||||
editGVarValue(MIXES_2ND_COLUMN, y, event, s_currIdx, k-GVAR_FIELD_FM0, LEFT|attr);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,6 @@ void drawFlightMode(coord_t x, coord_t y, int8_t idx, LcdFlags att)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
drawStringWithIndex(x, y, STR_FP, idx-1, att);
|
||||
drawStringWithIndex(x, y, STR_FM, idx-1, att);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -472,8 +472,6 @@ extern uint8_t mixerCurrentFlightMode;
|
|||
extern uint8_t lastFlightMode;
|
||||
extern uint8_t flightModeTransitionLast;
|
||||
|
||||
typedef uint32_t bitfield_channels_t;
|
||||
|
||||
#if defined(SIMU)
|
||||
inline int availableMemory() { return 1000; }
|
||||
#elif !defined(SIMU)
|
||||
|
@ -500,7 +498,7 @@ bool getSwitch(swsrc_t swtch, uint8_t flags=0);
|
|||
void logicalSwitchesTimerTick();
|
||||
void logicalSwitchesReset();
|
||||
|
||||
void evalLogicalSwitches(bool isCurrentPhase=true);
|
||||
void evalLogicalSwitches(bool isCurrentFlightmode=true);
|
||||
void logicalSwitchesCopyState(uint8_t src, uint8_t dst);
|
||||
#define LS_RECURSIVE_EVALUATION_RESET()
|
||||
|
||||
|
@ -1162,7 +1160,7 @@ uint8_t zlen(const char *str, uint8_t size);
|
|||
bool zexist(const char *str, uint8_t size);
|
||||
unsigned int effectiveLen(const char * str, unsigned int size);
|
||||
char * strcat_zchar(char *dest, const char *name, uint8_t size, const char *defaultName=NULL, uint8_t defaultNameSize=0, uint8_t defaultIdx=0);
|
||||
#define strcat_phasename(dest, idx) strcat_zchar(dest, g_model.flightModeData[idx].name, LEN_FLIGHT_MODE_NAME, STR_FP, PSIZE(TR_FP), idx+1)
|
||||
#define strcatFlightmodeName(dest, idx) strcat_zchar(dest, g_model.flightModeData[idx].name, LEN_FLIGHT_MODE_NAME, STR_FM, PSIZE(TR_FM), idx+1)
|
||||
#if defined(EEPROM)
|
||||
#define strcat_modelname(dest, idx) strcat_zchar(dest, modelHeaders[idx].name, LEN_MODEL_NAME, STR_MODEL, PSIZE(TR_MODEL), idx+1)
|
||||
#define strcat_currentmodelname(dest) strcat_modelname(dest, g_eeGeneral.currModel)
|
||||
|
|
|
@ -29,5 +29,6 @@ typedef int32_t getvalue_t;
|
|||
typedef uint32_t mixsrc_t;
|
||||
typedef int32_t swsrc_t;
|
||||
typedef int16_t safetych_t;
|
||||
typedef uint32_t bitfield_channels_t;
|
||||
|
||||
#endif // _OTXTYPES_H_
|
||||
|
|
|
@ -302,7 +302,7 @@ char * getSwitchString(char * dest, swsrc_t idx)
|
|||
getStringAtIndex(s, STR_VSWITCHES, IDX_ON_IN_STR_VSWITCHES + idx - SWSRC_ON);
|
||||
}
|
||||
else if (idx <= SWSRC_LAST_FLIGHT_MODE) {
|
||||
strAppendStringWithIndex(s, STR_FP, idx-SWSRC_FIRST_FLIGHT_MODE);
|
||||
strAppendStringWithIndex(s, STR_FM, idx-SWSRC_FIRST_FLIGHT_MODE);
|
||||
}
|
||||
else if (idx == SWSRC_TELEMETRY_STREAMING) {
|
||||
strcpy(s, "Tele");
|
||||
|
|
|
@ -478,12 +478,12 @@ bool getSwitch(swsrc_t swtch, uint8_t flags)
|
|||
/**
|
||||
@brief Calculates new state of logical switches for mixerCurrentFlightMode
|
||||
*/
|
||||
void evalLogicalSwitches(bool isCurrentPhase)
|
||||
void evalLogicalSwitches(bool isCurrentFlightmode)
|
||||
{
|
||||
for (unsigned int idx=0; idx<MAX_LOGICAL_SWITCHES; idx++) {
|
||||
LogicalSwitchContext & context = lswFm[mixerCurrentFlightMode].lsw[idx];
|
||||
bool result = getLogicalSwitch(idx);
|
||||
if (isCurrentPhase) {
|
||||
if (isCurrentFlightmode) {
|
||||
if (result) {
|
||||
if (!context.state) PLAY_LOGICAL_SWITCH_ON(idx);
|
||||
}
|
||||
|
|
|
@ -276,7 +276,7 @@ const char STR_MENUTORESET[] = TR_MENUTORESET;
|
|||
const char STR_PPM_TRAINER[] = TR_PPM_TRAINER;
|
||||
const char STR_CH[] = TR_CH;
|
||||
const char STR_MODEL[] = TR_MODEL;
|
||||
const char STR_FP[] = TR_FP;
|
||||
const char STR_FM[] = TR_FM;
|
||||
const char STR_MIX[] = TR_MIX;
|
||||
const char STR_ALERT[] = TR_ALERT;
|
||||
const char STR_PRESSANYKEYTOSKIP[] = TR_PRESSANYKEYTOSKIP;
|
||||
|
|
|
@ -487,7 +487,7 @@ extern const char STR_MENUTORESET[];
|
|||
extern const char STR_PPM_TRAINER[];
|
||||
extern const char STR_CH[];
|
||||
extern const char STR_MODEL[];
|
||||
extern const char STR_FP[];
|
||||
extern const char STR_FM[];
|
||||
extern const char STR_MIX[];
|
||||
extern const char STR_EEPROMLOWMEM[];
|
||||
extern const char STR_ALERT[];
|
||||
|
|
|
@ -701,7 +701,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "LR"
|
||||
#define TR_FM "LR"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "Dochází EEPROM"
|
||||
#define TR_ALERT "\006 POZOR"
|
||||
|
|
|
@ -708,7 +708,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELL"
|
||||
#define TR_FP "FP"
|
||||
#define TR_FM "FP"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM voll"
|
||||
#define TR_ALERT "WARNUNG"
|
||||
|
|
|
@ -707,7 +707,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FM"
|
||||
#define TR_FM "FM"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM low mem"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
|
|
|
@ -705,7 +705,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELO"
|
||||
#define TR_FP "FM"
|
||||
#define TR_FM "FM"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM mem.baja"
|
||||
#define TR_ALERT "\016ALERTA"
|
||||
|
|
|
@ -697,7 +697,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FM"
|
||||
#define TR_FM "FM"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "FINSKA low mem"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
|
|
|
@ -718,7 +718,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELE"
|
||||
#define TR_FP "PV"
|
||||
#define TR_FM "PV"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM pleine!"
|
||||
#define TR_ALERT "\014ALERTE"
|
||||
|
|
|
@ -707,7 +707,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODELLO"
|
||||
#define TR_FP "FV"
|
||||
#define TR_FM "FV"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM quasi piena!"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
|
|
|
@ -705,7 +705,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FM"
|
||||
#define TR_FM "FM"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM weinig geheugen"
|
||||
#define TR_ALERT "ALARM"
|
||||
|
|
|
@ -708,7 +708,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "KN"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FL"
|
||||
#define TR_FM "FL"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "Niska pamięć EEPROM"
|
||||
#define TR_ALERT "\006UWAGA"
|
||||
|
|
|
@ -704,7 +704,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "CH"
|
||||
#define TR_MODEL "MODEL"
|
||||
#define TR_FP "FP"
|
||||
#define TR_FM "FP"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "EEPROM BX Memoria"
|
||||
#define TR_ALERT "\016ALERT"
|
||||
|
|
|
@ -718,7 +718,7 @@
|
|||
#define TR_PPM_TRAINER "TR"
|
||||
#define TR_CH "KN"
|
||||
#define TR_MODEL "Modell"
|
||||
#define TR_FP "FL"
|
||||
#define TR_FM "FL"
|
||||
#define TR_MIX "MIX"
|
||||
#define TR_EEPROMLOWMEM "Minnesbrist"
|
||||
#define TR_ALERT "\016OBS"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue