mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-24 00:35:14 +03:00
Fixes #2381: time based V2 params were not formated properly. Time unit also added.
This commit is contained in:
parent
18d8edce36
commit
f8a2ec0aee
2 changed files with 24 additions and 2 deletions
|
@ -156,7 +156,7 @@ QString SensorData::unitString() const
|
||||||
bool RawSource::isTimeBased() const
|
bool RawSource::isTimeBased() const
|
||||||
{
|
{
|
||||||
if (IS_ARM(GetCurrentFirmware()->getBoard()))
|
if (IS_ARM(GetCurrentFirmware()->getBoard()))
|
||||||
return false;
|
return (type == SOURCE_TYPE_SPECIAL && index > 0);
|
||||||
else
|
else
|
||||||
return (type==SOURCE_TYPE_TELEMETRY && (index==TELEMETRY_SOURCE_TX_TIME || index==TELEMETRY_SOURCE_TIMER1 || index==TELEMETRY_SOURCE_TIMER2 || index==TELEMETRY_SOURCE_TIMER3));
|
return (type==SOURCE_TYPE_TELEMETRY && (index==TELEMETRY_SOURCE_TX_TIME || index==TELEMETRY_SOURCE_TIMER1 || index==TELEMETRY_SOURCE_TIMER2 || index==TELEMETRY_SOURCE_TIMER3));
|
||||||
}
|
}
|
||||||
|
@ -386,6 +386,25 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
|
||||||
result.min = -result.max;
|
result.min = -result.max;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SOURCE_TYPE_SPECIAL:
|
||||||
|
if (index == 0) { //Batt
|
||||||
|
result.step = 0.1;
|
||||||
|
result.decimals = 1;
|
||||||
|
result.max = 25.5;
|
||||||
|
result.unit = QObject::tr("V");
|
||||||
|
}
|
||||||
|
else if (index == 1) { //Time
|
||||||
|
result.step = 1;
|
||||||
|
result.max = 24*60 - 1;
|
||||||
|
result.unit = QObject::tr("h:m");
|
||||||
|
}
|
||||||
|
else { // Timers 1 - 3
|
||||||
|
result.step = singleprec ? 5 : 1;
|
||||||
|
result.max = singleprec ? 255*5 : 60*60;
|
||||||
|
result.unit = singleprec ? QObject::tr("m:s") : QObject::tr("h:m:s");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (model) {
|
if (model) {
|
||||||
result.max = model->getChannelsMax(true);
|
result.max = model->getChannelsMax(true);
|
||||||
|
|
|
@ -309,7 +309,10 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
int maxTime = round(range.max);
|
int maxTime = round(range.max);
|
||||||
int value = round(range.step*model->logicalSw[i].val2 + range.offset);
|
int value = round(range.step*model->logicalSw[i].val2 + range.offset);
|
||||||
cswitchTOffset[i]->setMaximumTime(QTimeS(maxTime));
|
cswitchTOffset[i]->setMaximumTime(QTimeS(maxTime));
|
||||||
cswitchTOffset[i]->setDisplayFormat((maxTime>=3600)?"hh:mm:ss":"mm:ss");
|
QString format = (maxTime>=3600) ? "hh:mm:ss" : "mm:ss";
|
||||||
|
if (!range.unit.isEmpty())
|
||||||
|
format += QString("' [%1]'").arg(range.unit);
|
||||||
|
cswitchTOffset[i]->setDisplayFormat(format);
|
||||||
cswitchTOffset[i]->setTime(QTimeS(value));
|
cswitchTOffset[i]->setTime(QTimeS(value));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue