feat: add DS18B20 1-Wire sensor support

- New DS18B20Reading message (fixed32 device_id via FNV-1a hash, float temperature)
- New DS18B20Config message in TelemetryConfig (pin, TemperatureMode enum, mesh_enabled)
- DS18B20 = 51 in TelemetrySensorType enum
- max_count:16 in telemetry.options for ds18b20_readings array
This commit is contained in:
elwimen 2026-03-24 14:12:18 +01:00
parent cb1f89372a
commit 3bcdab9794
3 changed files with 75 additions and 0 deletions

View file

@ -619,6 +619,50 @@ message ModuleConfig {
bool clear_on_reboot = 4;
}
/*
* DS18B20 1-Wire sensor configuration.
*/
message DS18B20Config {
/*
* GPIO pin for the DS18B20 1-Wire sensor bus. 0 = disabled.
* Set via CLI to activate DS18B20 support on any pin.
*/
uint32 pin = 1;
/*
* Which value the legacy EnvironmentMetrics.temperature scalar reports.
*/
enum TemperatureMode {
/*
* Report the temperature of the first sensor (index 0, sorted by ROM code). Default.
*/
FIRST = 0;
/*
* Report the average temperature across all connected sensors.
*/
AVERAGE = 1;
/*
* Report the minimum temperature across all connected sensors.
*/
MIN = 2;
/*
* Report the maximum temperature across all connected sensors.
*/
MAX = 3;
}
/*
* Selects what value the legacy EnvironmentMetrics.temperature scalar reports.
*/
TemperatureMode mode = 2;
/*
* When true, DS18B20 readings beyond the first packet are broadcast over LoRa mesh.
* When false (default), extra sensor chunks are sent only to the connected phone/client.
*/
bool mesh_enabled = 3;
}
/*
* Configuration for both device and environment metrics
*/
@ -707,6 +751,11 @@ message ModuleConfig {
* Enable/Disable the air quality telemetry measurement module on-device display
*/
bool air_quality_screen_enabled = 15;
/*
* DS18B20 1-Wire sensor configuration. Pin, temperature mode, and mesh broadcast control.
*/
DS18B20Config ds18b20 = 16;
}
/*

View file

@ -1,6 +1,7 @@
# options for nanopb
# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options
*EnvironmentMetrics.ds18b20_readings max_count:16
*EnvironmentMetrics.iaq int_size:16
*EnvironmentMetrics.wind_direction int_size:16
*EnvironmentMetrics.soil_moisture int_size:8

View file

@ -153,6 +153,26 @@ message EnvironmentMetrics {
* Soil temperature measured (*C)
*/
optional float soil_temperature = 22;
/*
* DS18B20 1-Wire temperature sensor readings
*/
repeated DS18B20Reading ds18b20_readings = 23;
}
/*
* A single DS18B20 1-Wire temperature sensor reading with its unique ROM code
*/
message DS18B20Reading {
/*
* 32-bit FNV-1a hash of the 64-bit 1-Wire ROM code stable, compact identifier per sensor
*/
fixed32 device_id = 1;
/*
* Temperature in degrees Celsius
*/
float temperature = 2;
}
/*
@ -871,6 +891,11 @@ enum TelemetrySensorType {
* SHT family of sensors for temperature and humidity
*/
SHTXX = 50;
/*
* Dallas/Maxim DS18B20 1-Wire digital thermometer
*/
DS18B20 = 51;
}
/*