Go to the source code of this file.
◆ MAX_TELEMETRY_SIGNALS
| #define MAX_TELEMETRY_SIGNALS 100 |
◆ checkTelemetryHealth()
| void checkTelemetryHealth |
( |
void |
| ) |
|
Definition at line 111 of file Telemetry.c.
111 {
112 uint32_t now = HAL_GetTick();
113
117
118 uint32_t time_since_update = now - sig->
last_update;
120
121 if (time_since_update > stale_threshold) {
124 "Signal stale: %s (last update %dms ago, expected every %dms)",
126 }
127 }
128}
static TelemetrySignal signals[MAX_TELEMETRY_SIGNALS]
static uint16_t num_signals
const UnitDefinition * getUnitDefinition(UnitId unit_id)
uint32_t expected_rate_ms
◆ getCategoryName()
Definition at line 161 of file Telemetry.c.
161 {
162 switch (category) {
172 default: return "Other";
173 }
174}
@ UNIT_CATEGORY_FREQUENCY
@ UNIT_CATEGORY_TEMPERATURE
◆ getTypeName()
Definition at line 177 of file Telemetry.c.
177 {
178 switch (type) {
185 default: return "UNKNOWN";
186 }
187}
◆ handleTelemetryConfigRequest()
| void handleTelemetryConfigRequest |
( |
void |
| ) |
|
Definition at line 130 of file Telemetry.c.
130 {
132
133
135
136
140
141
143 "Signal:%s;Unit:%s;Category:%s;Type:%d;Rate:%d;Min:%.2f;Max:%.2f;Decimals:%d;AbsMin:%.2f;AbsMax:%.2f",
154 }
155
156
158}
const char * getCategoryName(UnitCategory category)
◆ initTelemetry()
| void initTelemetry |
( |
void |
| ) |
|
Definition at line 12 of file Telemetry.c.
12 {
16
17
19
21}
static bool telemetry_initialized
◆ registerTelemetrySignal()
Definition at line 23 of file Telemetry.c.
25 {
27 return NULL;
28 }
29
32
33 strncpy(sig->
name, name,
sizeof(sig->
name) - 1);
34 sig->
name[
sizeof(sig->
name) - 1] =
'\0';
40
41
42 if (custom_min != custom_max) {
46 } else {
50 }
51
53
56 return sig;
57}
const char * getTypeName(TelemetryType type)
#define MAX_TELEMETRY_SIGNALS
float default_warning_min
float default_warning_max
◆ sendCANTelemetryData()
| void sendCANTelemetryData |
( |
TelemetrySignal * |
signal, |
|
|
uint32_t |
can_id, |
|
|
uint8_t * |
data, |
|
|
uint8_t |
dlc |
|
) |
| |
Definition at line 190 of file Telemetry.c.
190 {
191 if (signal == NULL || !signal->
enabled ||
193 return;
194 }
195
196
198
199
200 char hex_data[17] = {0};
201 for (int i = 0; i < dlc && i < 8; i++) {
202 sprintf(&hex_data[i*2], "%02X", data[i]);
203 }
204
206 sendMessage(
"CAN", msg_type,
"ID:0x%03X;DLC:%d;Data:%s", can_id, dlc, hex_data);
207}
◆ sendTelemetryValue()
Definition at line 59 of file Telemetry.c.
59 {
60 if (signal == NULL || !signal->
enabled) {
61 return;
62 }
63
65
66
68
69
70 switch (signal->
type) {
72
76 return;
77 }
78
79
82
83 if (value < min_limit || value > max_limit) {
85 value, unit->
symbol, min_limit, max_limit);
86 }
87
88
90 break;
91
94 break;
95
98 break;
99
102 break;
103
106
107 break;
108 }
109}
bool validateUnitValue(UnitId unit_id, float value)
◆ num_signals
◆ signals
◆ telemetry_initialized
| bool telemetry_initialized = false |
|
static |