Skip to content

feat(environment): add 1-Wire multi-thermometer (DS18B20) display support#5130

Merged
jamesarich merged 2 commits intomeshtastic:mainfrom
jamesarich:feat/onewire-temperature
Apr 15, 2026
Merged

feat(environment): add 1-Wire multi-thermometer (DS18B20) display support#5130
jamesarich merged 2 commits intomeshtastic:mainfrom
jamesarich:feat/onewire-temperature

Conversation

@jamesarich
Copy link
Copy Markdown
Collaborator

Summary

  • Adds display support for up to 8 DS18B20 1-Wire temperature sensors per one_wire_temperature repeated field in EnvironmentMetrics proto
  • Each sensor channel gets a unique color on the environment chart and a labeled row in the metrics card
  • Fahrenheit conversion handled in ViewModel (consistent with existing temperature/soil_temperature pattern); display composables use pre-converted values
  • CSV export includes 1wire_temp_1 through 1wire_temp_8 columns

Changes

core/uiCustomColors.kt

  • Added 4 new GraphColors: Magenta, SkyBlue, Chartreuse, Coral to avoid color collisions with existing metrics

feature/node — Environment metrics

  • EnvironmentMetricsState.kt: Added ONE_WIRE_TEMP_1..8 enum entries with unique colors; graphing data includes per-channel min/max with Fahrenheit awareness
  • EnvironmentMetrics.kt: Added OneWireTemperatureDisplay composable showing per-channel temperature with color indicator
  • EnvironmentCharts.kt: Added LEGEND_DATA_4 with per-channel 1-Wire legend labels
  • CommonCharts.kt: Added LegendData.labelOverride for per-instance legend text
  • MetricsViewModel.kt: Fahrenheit conversion for one_wire_temperature list; CSV export columns

feature/node — Inline component

  • component/EnvironmentMetrics.kt: Inline 1-Wire chip display in node detail

core/resources

  • strings.xml: Added one_wire_temperature string resource

Related

Notes

  • No version gating needed — the one_wire_temperature proto field defaults to an empty list on older firmware, so nothing displays unless data is present
  • Tested with spotlessCheck and spotlessApply — zero lint violations

…port

Add charting, detail card display, and CSV export for up to 8 1-Wire
temperature sensor channels from the environment_metrics.one_wire_temperature
repeated field.

- EnvironmentMetricsState: ONE_WIRE_TEMP_1..8 enum entries with getOrNull()
  access (safely returns null when firmware does not populate the field)
- EnvironmentCharts: LEGEND_DATA_4 with per-channel labels and distinct colours
- CommonCharts: LegendData.labelOverride for per-instance legend labels
- EnvironmentMetrics: OneWireTemperatureDisplay composable in the detail card
- EnvironmentMetrics component: inline 1-Wire chip display with temp formatting
- MetricsViewModel: Fahrenheit conversion for one_wire_temperature in CSV export

No version gating needed — the proto field defaults to an empty list on older
firmware, so the UI elements are naturally hidden when no data is reported.
@jamesarich
Copy link
Copy Markdown
Collaborator Author

@oscgonfer 👀

@github-actions github-actions Bot added the enhancement New feature or request label Apr 14, 2026
@oscgonfer
Copy link
Copy Markdown

Wow! That's nice! 👏

Replace hardcoded one-wire temperature indices (0-7) with a loop over
ONE_WIRE_SENSOR_COUNT constant to fix CyclomaticComplexMethod and
MagicNumber detekt violations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jamesarich jamesarich added this pull request to the merge queue Apr 15, 2026
Merged via the queue into meshtastic:main with commit f48fc61 Apr 15, 2026
11 checks passed
@jamesarich jamesarich deleted the feat/onewire-temperature branch April 15, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants