mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
fix: Remove duplicate sensor cards for temperature, humidity, pressure
Core telemetry fields (temperature, humidity, pressure, voltage) were shown twice: once from the ContactTelemetry top-level fields and again from extraSensorData channel-keyed entries (e.g. temperature_2). Now skips extraSensorData keys that are already represented by core telemetry cards.
This commit is contained in:
@@ -207,9 +207,23 @@ List<SensorMetricOption> sensorMetricOptionsFor(
|
|||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// Keys that are already shown as core telemetry fields above.
|
||||||
|
// Skip them from extraSensorData to avoid duplicates.
|
||||||
|
final coreFieldKeys = <String>{
|
||||||
|
if (batteryMilliVolts != null || batteryPercentage != null)
|
||||||
|
...extraSensorData?.keys.where((k) =>
|
||||||
|
k.startsWith('voltage_') || k.startsWith('analog_input_')) ?? [],
|
||||||
|
if (temperature != null)
|
||||||
|
...extraSensorData?.keys.where((k) => k.startsWith('temperature_')) ?? [],
|
||||||
|
if (humidity != null)
|
||||||
|
...extraSensorData?.keys.where((k) => k.startsWith('humidity_')) ?? [],
|
||||||
|
if (pressure != null)
|
||||||
|
...extraSensorData?.keys.where((k) => k.startsWith('pressure_')) ?? [],
|
||||||
|
};
|
||||||
|
|
||||||
if (extraSensorData != null) {
|
if (extraSensorData != null) {
|
||||||
for (final key in extraSensorData.keys) {
|
for (final key in extraSensorData.keys) {
|
||||||
if (_isTelemetryMetadataKey(key)) {
|
if (_isTelemetryMetadataKey(key) || coreFieldKeys.contains(key)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final metricKey = _parseMetricKey(key);
|
final metricKey = _parseMetricKey(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user