feat(color,cpn): Updates to the model telemetry page, sensor ID consistency (#3401)
* Add 'Show Instance ID' button to telemetry page to show/hide sensor instance number (default is hidden). Fix issues with page refresh when all sensors deleted. Select closest sensor when a single sensor is deleted. On change, only refresh the sensor list instead of the whole page. The 'showInstanceIds' property is saved to the model file. Update Companion to save/load 'showInstanceIds' in model YAML file. Add checkbox to telemetry edit page. * Update all radio specific files. * Keep focus on 'Discover/Stop' button when searching for new sensors. Start sensor ID index at 1 to match B&W radios. Keep focus on changed parameter when editing sensor, don't rebuild entire parameter list on change. * Display actual 'instance' ID instead of 'instance' + 1. * Fix incorrect ID when reloading simulator data. * Fix incorrect ID when reloading simulator data on B&W radios.
This commit is contained in:
@@ -811,6 +811,7 @@ Node convert<ModelData>::encode(const ModelData& rhs)
|
||||
node["trimInc"] = rhs.trimInc;
|
||||
node["displayTrims"] = rhs.trimsDisplay;
|
||||
node["ignoreSensorIds"] = (int)rhs.frsky.ignoreSensorIds;
|
||||
node["showInstanceIds"] = (int)rhs.showInstanceIds;
|
||||
node["disableThrottleWarning"] = (int)rhs.disableThrottleWarning;
|
||||
node["enableCustomThrottleWarning"] = (int)rhs.enableCustomThrottleWarning;
|
||||
node["customThrottleWarningPosition"] = (int)rhs.customThrottleWarningPosition;
|
||||
@@ -1058,6 +1059,7 @@ bool convert<ModelData>::decode(const Node& node, ModelData& rhs)
|
||||
node["trimInc"] >> rhs.trimInc;
|
||||
node["displayTrims"] >> rhs.trimsDisplay;
|
||||
node["ignoreSensorIds"] >> rhs.frsky.ignoreSensorIds;
|
||||
node["showInstanceIds"] >> rhs.showInstanceIds;
|
||||
node["disableThrottleWarning"] >> rhs.disableThrottleWarning;
|
||||
node["enableCustomThrottleWarning"] >> rhs.enableCustomThrottleWarning;
|
||||
node["customThrottleWarningPosition"] >> rhs.customThrottleWarningPosition;
|
||||
|
||||
@@ -49,12 +49,7 @@ Node convert<SensorData>::encode(const SensorData& rhs)
|
||||
node["id1"]["id"] = rhs.id;
|
||||
node["subId"] = rhs.subid;
|
||||
|
||||
unsigned int instance = rhs.instance;
|
||||
if (instance != 0) {
|
||||
instance =
|
||||
((instance - 1) & 0x1F) | (rhs.rxIdx << 5) | (rhs.moduleIdx << 7);
|
||||
}
|
||||
node["id2"]["instance"] = instance;
|
||||
node["id2"]["instance"] = rhs.instance;
|
||||
cfg["custom"]["ratio"] = rhs.ratio;
|
||||
cfg["custom"]["offset"] = rhs.offset;
|
||||
} else {
|
||||
@@ -132,7 +127,6 @@ bool convert<SensorData>::decode(const Node& node, SensorData& rhs)
|
||||
if (rhs.type == SensorData::TELEM_TYPE_CUSTOM) {
|
||||
rhs.rxIdx = (rhs.instance >> 5) & 0x03; // 2 bits Rx idx
|
||||
rhs.moduleIdx = (rhs.instance >> 7) & 0x1; // 1 bit module idx
|
||||
rhs.instance = (rhs.instance & 0x1F) + 1; // 5 bits instance
|
||||
}
|
||||
|
||||
node["label"] >> rhs.label;
|
||||
|
||||
@@ -171,6 +171,7 @@ class ModelData {
|
||||
FrSkyData frsky;
|
||||
unsigned int rssiSource;
|
||||
RSSIAlarmData rssiAlarms;
|
||||
bool showInstanceIds;
|
||||
|
||||
char bitmap[CPN_MAX_BITMAP_LEN + 1];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user