mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-23 01:41:29 +00:00
sync with upstream dev
This commit is contained in:
1 parent
cceb6606e1
commit
9354975acf
12 files changed
+347
-33
No files matched your search
@@ -1486,23 +1486,23 @@ int CompanionMesh::appendSelfTelemetry(uint8_t *reply, uint8_t permissions)
|
||||
}
|
||||
}
|
||||
|
||||
// Environment sensors if authorized and available
|
||||
/* Sensors are read once here. External temp/humidity/pressure require
|
||||
* TELEM_PERM_ENVIRONMENT, but the MCU die temperature is reported under
|
||||
* base permission — matching Arduino MeshCore (15e259c5) and ZephCore's
|
||||
* own repeater/room-server telemetry, neither of which gates it. */
|
||||
struct env_data env;
|
||||
bool env_ok = (env_sensors_read(&env) == 0);
|
||||
bool temp_reported = false;
|
||||
|
||||
if (permissions & TELEM_PERM_ENVIRONMENT) {
|
||||
struct env_data env;
|
||||
if (env_sensors_read(&env) == 0) {
|
||||
if (env_ok) {
|
||||
if (env.has_temperature) {
|
||||
temp_reported = true;
|
||||
reply[i++] = CH_SELF;
|
||||
reply[i++] = LPP_TEMPERATURE;
|
||||
int16_t temp = (int16_t)(env.temperature_c * 10);
|
||||
reply[i++] = (temp >> 8) & 0xFF;
|
||||
reply[i++] = temp & 0xFF;
|
||||
} else if (env.has_mcu_temperature) {
|
||||
// MCU die temp as fallback when no external sensor
|
||||
reply[i++] = CH_SELF;
|
||||
reply[i++] = LPP_TEMPERATURE;
|
||||
int16_t temp = (int16_t)(env.mcu_temperature_c * 10);
|
||||
reply[i++] = (temp >> 8) & 0xFF;
|
||||
reply[i++] = temp & 0xFF;
|
||||
}
|
||||
if (env.has_humidity) {
|
||||
reply[i++] = CH_SELF;
|
||||
@@ -1550,6 +1550,16 @@ int CompanionMesh::appendSelfTelemetry(uint8_t *reply, uint8_t permissions)
|
||||
}
|
||||
}
|
||||
|
||||
/* MCU die temperature — reported under base permission, but only when no
|
||||
* external sensor already supplied a CH_SELF temperature (never emit two). */
|
||||
if (!temp_reported && env_ok && env.has_mcu_temperature) {
|
||||
reply[i++] = CH_SELF;
|
||||
reply[i++] = LPP_TEMPERATURE;
|
||||
int16_t temp = (int16_t)(env.mcu_temperature_c * 10);
|
||||
reply[i++] = (temp >> 8) & 0xFF;
|
||||
reply[i++] = temp & 0xFF;
|
||||
}
|
||||
|
||||
// Trigger GPS wake for fresh fix on next request
|
||||
if (gps_is_available() && gps_is_enabled()) {
|
||||
gps_request_fresh_fix();
|
||||
|
||||
Reference in new issue
Block a user