Cpn add TX GPS source

This commit is contained in:
elecpower
2021-12-31 10:53:10 +01:00
committed by Raphael Coeffic
parent 71b254924e
commit 0421774a68
5 changed files with 14 additions and 10 deletions
@@ -118,7 +118,7 @@ RawSourceItemModel::RawSourceItemModel(const GeneralSettings * const generalSett
addItems(SOURCE_TYPE_CYC, RawSource::SourcesGroup, CPN_MAX_CYC);
addItems(SOURCE_TYPE_PPM, RawSource::SourcesGroup, firmware->getCapability(TrainerInputs));
addItems(SOURCE_TYPE_CH, RawSource::SourcesGroup, firmware->getCapability(Outputs));
addItems(SOURCE_TYPE_SPECIAL, RawSource::TelemGroup, 5);
addItems(SOURCE_TYPE_SPECIAL, RawSource::TelemGroup, 6);
addItems(SOURCE_TYPE_TELEMETRY, RawSource::TelemGroup, firmware->getCapability(Sensors) * 3);
addItems(SOURCE_TYPE_GVAR, RawSource::GVarsGroup, firmware->getCapability(Gvars));
}
@@ -44,11 +44,10 @@ const YamlLookupTable cycSourceLut = {
const YamlLookupTable specialSourceLut = {
{ 0, "TX_VOLTAGE" },
{ 1, "TX_TIME" },
{ 2, "ONE" },
{ 2, "TX_GPS" },
{ 3, "TIMER1" },
{ 4, "TIMER2" },
{ 5, "TIMER3" },
// TODO: { ???, "TX_GPS" },
};
std::string YamlRawSourceEncode(const RawSource& rhs)
@@ -384,10 +384,11 @@ class SourcesConversionTable: public ConversionTable {
addConversion(RawSource(SOURCE_TYPE_GVAR, i), val++);
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 0), val++); // BATT
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 1), val++); // TIME
val += 5;
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 2), val++); // Timer1
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 3), val++); // Timer2
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 4), val++); // Timer3
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 2), val++); // GPS
val += 4;
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 3), val++); // Timer1
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 4), val++); // Timer2
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 5), val++); // Timer3
for (int i=0; i<MAX_TELEMETRY_SENSORS(board, version)*3; ++i) {
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
}
+6 -2
View File
@@ -96,6 +96,10 @@ RawSourceRange RawSource::getRange(const ModelData * model, const GeneralSetting
result.max = 24 * 60 * result.step - 60; // 23:59:00 with 1-minute resolution
result.unit = tr("s");
}
else if (index == 2) { //GPS
result.max = 30000;
result.min = -result.max;
}
else { // Timers 1 - 3
result.step = 1;
result.max = 9 * 60 * 60 - 1; // 8:59:59 (to match firmware)
@@ -137,7 +141,7 @@ QString RawSource::toString(const ModelData * model, const GeneralSettings * con
};
static const QString special[] = {
tr("Batt"), tr("Time"), tr("Timer1"), tr("Timer2"), tr("Timer3"),
tr("Batt"), tr("Time"), tr("GPS")
};
static const QString rotary[] = { tr("REa"), tr("REb") };
@@ -289,7 +293,7 @@ bool RawSource::isSlider(int * sliderIndex, Board::Type board) const
bool RawSource::isTimeBased(Board::Type board) const
{
return (type == SOURCE_TYPE_SPECIAL && index > 0);
return (type == SOURCE_TYPE_SPECIAL && index >= SOURCE_TYPE_SPECIAL_TIMER1_IDX);
}
bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings * const gs, Board::Type board) const
+1 -1
View File
@@ -179,7 +179,7 @@ enum RawSourceType {
};
constexpr int SOURCE_TYPE_STICK_THR_IDX { 3 }; // TODO is there a function to determine index?
constexpr int SOURCE_TYPE_SPECIAL_TIMER1_IDX { 2 }; // TODO temp const until Timers own source type
constexpr int SOURCE_TYPE_SPECIAL_TIMER1_IDX { 3 }; // TODO temp const until Timers own source type
class RawSourceRange
{