QString AnalogString(int index) { static const QString sticks[] = { QObject::tr("Rud"), QObject::tr("Ele"), QObject::tr("Thr"), QObject::tr("Ail") }; static const QString pots9X[] = { QObject::tr("P1"), QObject::tr("P2"), QObject::tr("P3") }; static const QString potsTaranis[] = { QObject::tr("S1"), QObject::tr("S2"), QObject::tr("S3"), QObject::tr("LS"), QObject::tr("RS") }; if (index < 4) return CHECK_IN_ARRAY(sticks, index); else return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(potsTaranis, index-4) : CHECK_IN_ARRAY(pots9X, index-4)); }
QString getProtocolStr(const int proto) { static const char *strings[] = { "OFF", "PPM", "Silverlit A", "Silverlit B", "Silverlit C", "CTP1009", "LP45", "DSM2", "DSMX", "PPM16", "PPMsim", "FrSky XJT - D16", "FrSky XJT - D8", "FrSky XJT - LR12", "FrSky DJT", }; return CHECK_IN_ARRAY(strings, proto); }
QString ModelPrinter::printModuleProtocol(unsigned int protocol) { static const char *strings[] = { "OFF", "PPM", "Silverlit A", "Silverlit B", "Silverlit C", "CTP1009", "LP45", "DSM2", "DSMX", "PPM16", "PPMsim", "FrSky XJT (D16)", "FrSky XJT (D8)", "FrSky XJT (LR12)", "FrSky DJT", }; return CHECK_IN_ARRAY(strings, protocol); }
QString RawSwitch::toString() { static const QString switches9X[] = { QString("THR"), QString("RUD"), QString("ELE"), QString("ID0"), QString("ID1"), QString("ID2"), QString("AIL"), QString("GEA"), QString("TRN") }; static const QString switchesX9D[] = { SwitchUp('A'), QString::fromUtf8("SA-"), SwitchDn('A'), SwitchUp('B'), QString::fromUtf8("SB-"), SwitchDn('B'), SwitchUp('C'), QString::fromUtf8("SC-"), SwitchDn('C'), SwitchUp('D'), QString::fromUtf8("SD-"), SwitchDn('D'), SwitchUp('E'), QString::fromUtf8("SE-"), SwitchDn('E'), SwitchUp('F'), SwitchDn('F'), SwitchUp('G'), QString::fromUtf8("SG-"), SwitchDn('G'), SwitchUp('H'), SwitchDn('H'), }; static const QString logicalSwitches[] = { QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"), QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"), QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"), QObject::tr("L31"), QObject::tr("L32") }; static const QString flightModes[] = { QObject::tr("FM0"), QObject::tr("FM1"), QObject::tr("FM2"), QObject::tr("FM3"), QObject::tr("FM4"), QObject::tr("FM5"), QObject::tr("FM6"), QObject::tr("FM7"), QObject::tr("FM8") }; static const QString multiposPots[] = { QObject::tr("S11"), QObject::tr("S12"), QObject::tr("S13"), QObject::tr("S14"), QObject::tr("S15"), QObject::tr("S16"), QObject::tr("S21"), QObject::tr("S22"), QObject::tr("S23"), QObject::tr("S24"), QObject::tr("S25"), QObject::tr("S26"), QObject::tr("S31"), QObject::tr("S32"), QObject::tr("S33"), QObject::tr("S34"), QObject::tr("S35"), QObject::tr("S36") }; static const QString trimsSwitches[] = { QObject::tr("RudTrim Left"), QObject::tr("RudTrim Right"), QObject::tr("EleTrim Down"), QObject::tr("EleTrim Up"), QObject::tr("ThrTrim Down"), QObject::tr("ThrTrim Up"), QObject::tr("AilTrim Left"), QObject::tr("AilTrim Right") }; static const QString rotaryEncoders[] = { QObject::tr("REa"), QObject::tr("REb") }; static const QString timerModes[] = { QObject::tr("OFF"), QObject::tr("ABS"), QObject::tr("THs"), QObject::tr("TH%"), QObject::tr("THt") }; if (index < 0) { return QString("!") + RawSwitch(type, -index).toString(); } else { switch(type) { case SWITCH_TYPE_SWITCH: if (IS_TARANIS(GetEepromInterface()->getBoard())) return CHECK_IN_ARRAY(switchesX9D, index-1); else return CHECK_IN_ARRAY(switches9X, index-1); case SWITCH_TYPE_VIRTUAL: return CHECK_IN_ARRAY(logicalSwitches, index-1); case SWITCH_TYPE_MULTIPOS_POT: return CHECK_IN_ARRAY(multiposPots, index-1); case SWITCH_TYPE_TRIM: return CHECK_IN_ARRAY(trimsSwitches, index-1); case SWITCH_TYPE_ROTARY_ENCODER: return CHECK_IN_ARRAY(rotaryEncoders, index-1); case SWITCH_TYPE_ON: return QObject::tr("ON"); case SWITCH_TYPE_OFF: return QObject::tr("OFF"); case SWITCH_TYPE_ONE: return QObject::tr("One"); case SWITCH_TYPE_FLIGHT_MODE: return CHECK_IN_ARRAY(flightModes, index-1); case SWITCH_TYPE_NONE: return QObject::tr("----"); case SWITCH_TYPE_TIMER_MODE: return CHECK_IN_ARRAY(timerModes, index); default: return QObject::tr("???"); } } }
QString RawSource::toString(const ModelData & model) { static const QString trims[] = { QObject::tr("TrmR"), QObject::tr("TrmE"), QObject::tr("TrmT"), QObject::tr("TrmA") }; static const QString telemetry[] = { QObject::tr("Batt"), QObject::tr("Time"), QObject::tr("Timer1"), QObject::tr("Timer2"), QObject::tr("SWR"), QObject::tr("RSSI Tx"), QObject::tr("RSSI Rx"), QObject::tr("A1"), QObject::tr("A2"), QObject::tr("A3"), QObject::tr("A4"), QObject::tr("Alt"), QObject::tr("Rpm"), QObject::tr("Fuel"), QObject::tr("T1"), QObject::tr("T2"), QObject::tr("Speed"), QObject::tr("Dist"), QObject::tr("GPS Alt"), QObject::tr("Cell"), QObject::tr("Cells"), QObject::tr("Vfas"), QObject::tr("Curr"), QObject::tr("Cnsp"), QObject::tr("Powr"), QObject::tr("AccX"), QObject::tr("AccY"), QObject::tr("AccZ"), QObject::tr("Hdg "), QObject::tr("VSpd"), QObject::tr("AirSpeed"), QObject::tr("dTE"), QObject::tr("A1-"), QObject::tr("A2-"), QObject::tr("A3-"), QObject::tr("A4-"), QObject::tr("Alt-"), QObject::tr("Alt+"), QObject::tr("Rpm+"), QObject::tr("T1+"), QObject::tr("T2+"), QObject::tr("Speed+"), QObject::tr("Dist+"), QObject::tr("AirSpeed+"), QObject::tr("Cell-"), QObject::tr("Cells-"), QObject::tr("Vfas-"), QObject::tr("Curr+"), QObject::tr("Powr+"), QObject::tr("ACC"), QObject::tr("GPS Time"), }; static const QString logicalSwitches[] = { QObject::tr("L1"), QObject::tr("L2"), QObject::tr("L3"), QObject::tr("L4"), QObject::tr("L5"), QObject::tr("L6"), QObject::tr("L7"), QObject::tr("L8"), QObject::tr("L9"), QObject::tr("L10"), QObject::tr("L11"), QObject::tr("L12"), QObject::tr("L13"), QObject::tr("L14"), QObject::tr("L15"), QObject::tr("L16"), QObject::tr("L17"), QObject::tr("L18"), QObject::tr("L19"), QObject::tr("L20"), QObject::tr("L21"), QObject::tr("L22"), QObject::tr("L23"), QObject::tr("L24"), QObject::tr("L25"), QObject::tr("L26"), QObject::tr("L27"), QObject::tr("L28"), QObject::tr("L29"), QObject::tr("L30"), QObject::tr("L31"), QObject::tr("L32") }; if (index<0) { return QObject::tr("----"); } switch (type) { case SOURCE_TYPE_VIRTUAL_INPUT: { QString result = QObject::tr("[I%1]").arg(index+1); if (strlen(model.inputNames[index]) > 0) { result += QString(model.inputNames[index]); } return result; } case SOURCE_TYPE_LUA_OUTPUT: return QObject::tr("LUA%1%2").arg(index/16+1).arg(QChar('a'+index%16)); case SOURCE_TYPE_STICK: return AnalogString(index); case SOURCE_TYPE_TRIM: return CHECK_IN_ARRAY(trims, index); case SOURCE_TYPE_ROTARY_ENCODER: return RotaryEncoderString(index); case SOURCE_TYPE_MAX: return QObject::tr("MAX"); case SOURCE_TYPE_SWITCH: return (IS_TARANIS(GetEepromInterface()->getBoard()) ? CHECK_IN_ARRAY(switchesX9D, index) : CHECK_IN_ARRAY(switches9X, index)); case SOURCE_TYPE_CUSTOM_SWITCH: return logicalSwitches[index]; case SOURCE_TYPE_CYC: return QObject::tr("CYC%1").arg(index+1); case SOURCE_TYPE_PPM: return QObject::tr("TR%1").arg(index+1); case SOURCE_TYPE_CH: return QObject::tr("CH%1").arg(index+1); case SOURCE_TYPE_TELEMETRY: return CHECK_IN_ARRAY(telemetry, index); case SOURCE_TYPE_GVAR: return QObject::tr("GV%1").arg(index+1); default: return QObject::tr("----"); } }
QString RotaryEncoderString(int index) { static const QString rotary[] = { QObject::tr("REa"), QObject::tr("REb") }; return CHECK_IN_ARRAY(rotary, index); }