Telemetry tweaks (#1315)

* Update protos

* Removed battery level from position packets

* Send internal metrics

* Handle telemetry on node info for now

* Fixes

* Default telemetry to enabled and same interval as position

* Fixes for lots of interval issues

* Fixed interval

* Regen

* Cleanup

* Newline

* Update proto ref

* Fixed missing metric and updated power level to uint

* Regen
raytac-diy
Ben Meadors 2022-03-23 20:46:39 +00:00 zatwierdzone przez GitHub
rodzic e97bd4f9f9
commit 47524d58d7
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
4 zmienionych plików z 14 dodań i 14 usunięć

2
proto

@ -1 +1 @@
Subproject commit c7bbc04ed3902458aa5e9a3cf89c36a63fa1fc04
Subproject commit 1fca6b8e50fcf84a6a34a5605c9e8c5fea96123d

Wyświetl plik

@ -648,10 +648,10 @@ extern const pb_msgdesc_t ToRadio_PeerInfo_msg;
#define Routing_size 42
#define Data_size 267
#define MeshPacket_size 318
#define NodeInfo_size 320
#define NodeInfo_size 315
#define MyNodeInfo_size 210
#define LogRecord_size 81
#define FromRadio_size 329
#define FromRadio_size 327
#define ToRadio_size 321
#define ToRadio_PeerInfo_size 8

Wyświetl plik

@ -12,7 +12,7 @@
/* Struct definitions */
typedef struct _Telemetry {
uint32_t time;
int32_t battery_level;
uint32_t battery_level;
float channel_utilization;
float air_util_tx;
bool router_heartbeat;
@ -49,7 +49,7 @@ extern "C" {
/* Struct field encoding specification for nanopb */
#define Telemetry_FIELDLIST(X, a) \
X(a, STATIC, SINGULAR, FIXED32, time, 1) \
X(a, STATIC, SINGULAR, INT32, battery_level, 2) \
X(a, STATIC, SINGULAR, UINT32, battery_level, 2) \
X(a, STATIC, SINGULAR, FLOAT, channel_utilization, 3) \
X(a, STATIC, SINGULAR, FLOAT, air_util_tx, 4) \
X(a, STATIC, SINGULAR, BOOL, router_heartbeat, 5) \
@ -68,7 +68,7 @@ extern const pb_msgdesc_t Telemetry_msg;
#define Telemetry_fields &Telemetry_msg
/* Maximum encoded size of messages (where known) */
#define Telemetry_size 58
#define Telemetry_size 53
#ifdef __cplusplus
} /* extern "C" */

Wyświetl plik

@ -188,6 +188,7 @@ bool TelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemetry *t)
DEBUG_MSG("-----------------------------------------\n");
DEBUG_MSG("Telemetry: Received data from %s\n", sender);
DEBUG_MSG("Telemetry->time: %i\n", t->time);
DEBUG_MSG("Telemetry->air_util_tx: %f\n", t->air_util_tx);
DEBUG_MSG("Telemetry->barometric_pressure: %f\n", t->barometric_pressure);
DEBUG_MSG("Telemetry->battery_level: %i\n", t->battery_level);
@ -209,17 +210,19 @@ bool TelemetryModule::handleReceivedProtobuf(const MeshPacket &mp, Telemetry *t)
bool TelemetryModule::sendOurTelemetry(NodeNum dest, bool wantReplies)
{
Telemetry m;
m.air_util_tx = 0;
m.time = getTime();
m.air_util_tx = myNodeInfo.air_util_tx;
m.barometric_pressure = 0;
m.battery_level = 0;
m.channel_utilization = 0;
m.battery_level = powerStatus->getBatteryChargePercent();
m.channel_utilization = myNodeInfo.channel_utilization;
m.current = 0;
m.gas_resistance = 0;
m.relative_humidity = 0;
m.router_heartbeat = 0;
m.temperature = 0;
m.voltage = 0;
DEBUG_MSG("-----------------------------------------\n");
DEBUG_MSG("Telemetry: Read data\n");
@ -248,10 +251,7 @@ bool TelemetryModule::sendOurTelemetry(NodeNum dest, bool wantReplies)
DEBUG_MSG("Telemetry: No external sensor type selected; Only sending internal metrics\n");
}
m.air_util_tx = myNodeInfo.air_util_tx;
m.channel_utilization = myNodeInfo.channel_utilization;
m.battery_level = powerStatus->getBatteryChargePercent();
DEBUG_MSG("Telemetry->time: %i\n", m.time);
DEBUG_MSG("Telemetry->air_util_tx: %f\n", m.air_util_tx);
DEBUG_MSG("Telemetry->barometric_pressure: %f\n", m.barometric_pressure);
DEBUG_MSG("Telemetry->battery_level: %i\n", m.battery_level);