Skip to content

Commit

Permalink
Merge pull request meshtastic#133 from meshtastic/telemetry-rework-3
Browse files Browse the repository at this point in the history
Telemetry rework 3
  • Loading branch information
thebentern authored Mar 27, 2022
2 parents 3689ca4 + 0a4e99a commit 6d35504
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 35 deletions.
2 changes: 1 addition & 1 deletion mesh.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1053,7 +1053,7 @@ message NodeInfo {
*/
fixed32 last_heard = 5;
/*
* The latest telemetry data for the node.
* The latest device telemetry data for the node.
*/
Telemetry telemetry = 6;
}
Expand Down
24 changes: 15 additions & 9 deletions radioconfig.proto
Original file line number Diff line number Diff line change
Expand Up @@ -741,42 +741,42 @@ message RadioConfig {
reserved 136;

/*
* Preferences for the Teletry Module
* Preferences for the Telemetry Module (Environment)
* FIXME - Move this out of UserPreferences and into a section for module configuration.
* Enable/Disable the telemetry measurement module measurement collection
*/
bool telemetry_module_measurement_enabled = 140;
bool telemetry_module_environment_measurement_enabled = 140;

/*
* Enable/Disable the telemetry measurement module on-device display
*/
bool telemetry_module_screen_enabled = 141;
bool telemetry_module_environment_screen_enabled = 141;

/*
* Sometimes sensor reads can fail.
* If this happens, we will retry a configurable number of attempts,
* each attempt will be delayed by the minimum required refresh rate for that sensor
*/
uint32 telemetry_module_read_error_count_threshold = 142;
uint32 telemetry_module_environment_read_error_count_threshold = 142;

/*
* Interval in seconds of how often we should try to send our
* measurements to the mesh
*/
uint32 telemetry_module_update_interval = 143;
uint32 telemetry_module_device_update_interval = 143;

/*
* Sometimes we can end up with more than read_error_count_threshold failures.
* In this case, we will stop trying to read from the sensor for a while.
* Wait this long until trying to read from the sensor again
*/
uint32 telemetry_module_recovery_interval = 144;
uint32 telemetry_module_environment_recovery_interval = 144;

/*
* We'll always read the sensor in Celsius, but sometimes we might want to
* display the results in Fahrenheit as a "user preference".
*/
bool telemetry_module_display_fahrenheit = 145;
bool telemetry_module_environment_display_fahrenheit = 145;

/*
* TODO: REPLACE
Expand Down Expand Up @@ -835,12 +835,12 @@ message RadioConfig {
/*
* Specify the sensor type
*/
TelemetrySensorType telemetry_module_sensor_type = 146;
TelemetrySensorType telemetry_module_environment_sensor_type = 146;

/*
* Specify the peferred GPIO Pin for sensor readings
*/
uint32 telemetry_module_sensor_pin = 147;
uint32 telemetry_module_environment_sensor_pin = 147;

/*
* Bit field of boolean configuration options for POSITION messages
Expand Down Expand Up @@ -968,6 +968,12 @@ message RadioConfig {
* Overrides the ADC_MULTIPLIER defined in variant for battery voltage calculation.
*/
float adc_multiplier_override = 175;

/*
* Interval in seconds of how often we should try to send our
* environent measurements to the mesh
*/
uint32 telemetry_module_environment_update_interval = 177;
}

/*
Expand Down
4 changes: 4 additions & 0 deletions telemetry.options
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# options for nanopb
# https://jpa.kapsi.fi/nanopb/docs/reference.html#proto-file-options


75 changes: 50 additions & 25 deletions telemetry.proto
Original file line number Diff line number Diff line change
@@ -1,68 +1,93 @@
syntax = "proto3";

option java_package = "com.geeksville.mesh";
option optimize_for = LITE_RUNTIME;
option go_package = "github.com/meshtastic/gomeshproto";

option java_outer_classname = "TelemetryProtos";

/*
* TODO: REPLACE
* Key native device metrics such as battery level
*/
message Telemetry {

message DeviceMetrics {
/*
* This is usually not sent over the mesh (to save space), but it is sent
* from the phone so that the local device can set its RTC If it is sent over
* the mesh (because there are devices on the mesh without GPS), it will only
* be sent by devices which has a hardware GPS clock (IE Mobile Phone).
* seconds since 1970
* 1-100 (0 means powered)
*/
fixed32 time = 1;

uint32 battery_level = 1;
/*
* 1-100 (0 means powered)
* Voltage measured
*/
uint32 battery_level = 2;
float voltage = 2;

/*
* Utilization for the current channel, including well formed TX, RX and malformed RX (aka noise).
*/
float channel_utilization = 3;

/*
* Percent of airtime for transmission used within the last hour.
*/
float air_util_tx = 4;
}

/*
* This is sent by node only if it a router and if hop_limit is set to 0
* and is not being sent as a reliable message.
*/
bool router_heartbeat = 5;

/*
* Weather station or other environmental metrics
*/
message EnvironmentMetrics {
/*
* Temperature measured
*/
float temperature = 6;
float temperature = 1;

/*
* Relative humidity percent measured
*/
float relative_humidity = 7;
float relative_humidity = 2;

/*
* Barometric pressure in hPA measured
*/
float barometric_pressure = 8;
float barometric_pressure = 3;

/*
* Gas resistance in mOhm measured
*/
float gas_resistance = 9;
float gas_resistance = 4;

/*
* Voltage measured
*/
float voltage = 10;
float voltage = 5;

/*
* Current measured
*/
float current = 11;
float current = 6;
}

/*
* Types of Measurements the telemetry module is equipped to handle
*/
message Telemetry {
/*
* This is usually not sent over the mesh (to save space), but it is sent
* from the phone so that the local device can set its RTC If it is sent over
* the mesh (because there are devices on the mesh without GPS), it will only
* be sent by devices which has a hardware GPS clock (IE Mobile Phone).
* seconds since 1970
*/
fixed32 time = 1;

oneof variant {
/*
* Key native device metrics such as battery level
*/
DeviceMetrics device_metrics = 2;

/*
* Weather station or other environmental metrics
*/
EnvironmentMetrics environment_metrics = 3;
}
}

0 comments on commit 6d35504

Please sign in to comment.