Companion 2.5 (#555)
* Introduce yaml in Companion * EdgeTX Companion Replace some OpenTX refs Data conversion to v220 Update Timers ui to cater for mode field split * Fix some simulators crashing when started from Companion * Disable firmware and app update checking and downloads from companion * Some more rebranding * Disable manual download actions and another rebrand * Fix cmake warning * Fix mode ON conversion gtests and enable switch in model edit * Stop update message when updates turned off * OpenTX #8580 Fixes missing negative sign for telemetry sources * OpenTX #8604 fix curves tooltip colors * OpenTX #8616 Fix release notes url references * OpenTX #8548 Align file sync folder references * OpenTX #8548 Link field once * OpenTX #8550 Confirmation prompt before write models and settings to radio * OpenTX #8550 Translate strings * Title and splash images * Change DEB package maintainer * Start NV14 * NV14 continued * NV14 sim * Timer countdownStart data conversion and ui fixes * Fix screen width * Merge OpenTX PR 8675 * NV14 sim add computer keys and mouse to activate some functions * Only allow supported protocols for each module on conversion * Clear mismatched modules on conversion * Replace colorlcd theme and layout blobs with detailed data structs in companion * NV14 has 2 topbar zones * Fix layout init * Fix layout init again * Reset to eepromimportexport.h to main branch * Import/export does not like enum fields * Model edit add custom screens tab for color and bw telemetry * Free memory
This commit is contained in:
@@ -26,23 +26,23 @@ void TimerData::convert(RadioDataConversionState & cstate)
|
||||
{
|
||||
cstate.setComponent(tr("TMR"), 1);
|
||||
cstate.setSubComp(tr("Timer %1").arg(cstate.subCompIdx + 1));
|
||||
mode.convert(cstate);
|
||||
swtch.convert(cstate);
|
||||
}
|
||||
|
||||
void TimerData::clear()
|
||||
{
|
||||
memset(reinterpret_cast<void *>(this), 0, sizeof(TimerData));
|
||||
mode = RawSwitch(SWITCH_TYPE_TIMER_MODE, 0);
|
||||
swtch = RawSwitch(SWITCH_TYPE_NONE);
|
||||
}
|
||||
|
||||
bool TimerData::isEmpty()
|
||||
{
|
||||
return (mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0) && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWNBEEP_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/);
|
||||
return (swtch == RawSwitch(SWITCH_TYPE_NONE, 0) && mode == TIMERMODE_OFF && name[0] == '\0' && minuteBeep == 0 && countdownBeep == COUNTDOWNBEEP_SILENT && val == 0 && persistent == 0 /*&& pvalue == 0*/);
|
||||
}
|
||||
|
||||
bool TimerData::isModeOff()
|
||||
{
|
||||
return mode == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0);
|
||||
return swtch == RawSwitch(SWITCH_TYPE_TIMER_MODE, 0);
|
||||
}
|
||||
|
||||
QString TimerData::nameToString(int index) const
|
||||
@@ -78,12 +78,23 @@ QString TimerData::valToString() const
|
||||
return valToString(val);
|
||||
}
|
||||
|
||||
QString TimerData::modeToString() const
|
||||
{
|
||||
return modeToString(mode);
|
||||
}
|
||||
|
||||
void TimerData::countdownBeepChanged()
|
||||
{
|
||||
if (countdownBeep == COUNTDOWNBEEP_SILENT)
|
||||
countdownStart = 0;
|
||||
}
|
||||
|
||||
void TimerData::modeChanged()
|
||||
{
|
||||
if (mode != TIMERMODE_START)
|
||||
swtch = RawSwitch(SWITCH_TYPE_NONE);
|
||||
}
|
||||
|
||||
// static
|
||||
QString TimerData::countdownBeepToString(const int value)
|
||||
{
|
||||
@@ -145,6 +156,27 @@ QString TimerData::valToString(const int value)
|
||||
return DataHelpers::timeToString(value, TIMESTR_MASK_HRSMINS | TIMESTR_MASK_ZEROHRS);
|
||||
}
|
||||
|
||||
// static
|
||||
QString TimerData::modeToString(const int value)
|
||||
{
|
||||
switch(value) {
|
||||
case TIMERMODE_OFF:
|
||||
return tr("OFF");
|
||||
case TIMERMODE_ON:
|
||||
return tr("ON");
|
||||
case TIMERMODE_START:
|
||||
return tr("Start");
|
||||
case TIMERMODE_THR:
|
||||
return tr("THs");
|
||||
case TIMERMODE_THR_REL:
|
||||
return tr("TH%");
|
||||
case TIMERMODE_THR_START:
|
||||
return tr("THt");
|
||||
default:
|
||||
return CPN_STR_UNKNOWN_ITEM;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
AbstractStaticItemModel * TimerData::countdownBeepItemModel()
|
||||
{
|
||||
@@ -165,7 +197,7 @@ AbstractStaticItemModel * TimerData::countdownStartItemModel()
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName(AIM_TIMER_COUNTDOWNSTART);
|
||||
|
||||
for (int i = COUNTDOWNSTART_LAST; i >= COUNTDOWNSTART_FIRST; i--) {
|
||||
for (int i = COUNTDOWNSTART_FIRST; i <= COUNTDOWNSTART_LAST; i++) {
|
||||
mdl->appendToItemList(countdownStartToString(i), i);
|
||||
}
|
||||
|
||||
@@ -186,3 +218,17 @@ AbstractStaticItemModel * TimerData::persistentItemModel()
|
||||
mdl->loadItemList();
|
||||
return mdl;
|
||||
}
|
||||
|
||||
// static
|
||||
AbstractStaticItemModel * TimerData::modeItemModel()
|
||||
{
|
||||
AbstractStaticItemModel * mdl = new AbstractStaticItemModel();
|
||||
mdl->setName(AIM_TIMER_MODE);
|
||||
|
||||
for (int i = 0; i < TIMERMODE_COUNT; i++) {
|
||||
mdl->appendToItemList(modeToString(i), i);
|
||||
}
|
||||
|
||||
mdl->loadItemList();
|
||||
return mdl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user