telemetry bugfix and "healthcheck" conf for debug logging

This commit is contained in:
liquidraver
2026-03-31 20:35:39 +02:00
parent fc28b32d52
commit 2051e1b51a
2 changed files with 57 additions and 9 deletions
+10 -9
View File
@@ -235,35 +235,36 @@ int RepeaterMesh::handleRequest(ClientInfo* sender, uint32_t sender_timestamp, u
/* CayenneLPP telemetry response using SimpleLPP encoder */
SimpleLPP lpp(&reply_data[4], sizeof(reply_data) - 4);
/* Battery voltage - channel 0 = self */
/* Battery voltage channel 1 = TELEM_CHANNEL_SELF (matches Arduino) */
const uint8_t CH_SELF = 1;
uint16_t batt_mv = _board.getBattMilliVolts();
lpp.addVoltage(0, batt_mv / 1000.0f);
lpp.addVoltage(CH_SELF, batt_mv / 1000.0f);
/* Environment sensors — prefer external, fallback to MCU die temp */
struct env_data env;
if (env_sensors_read(&env) == 0) {
if (env.has_temperature) {
lpp.addTemperature(0, env.temperature_c);
lpp.addTemperature(CH_SELF, env.temperature_c);
} else if (env.has_mcu_temperature) {
lpp.addTemperature(0, env.mcu_temperature_c);
lpp.addTemperature(CH_SELF, env.mcu_temperature_c);
} else {
/* Last resort: MCU temp from board API */
float mcu_temp = _board.getMCUTemperature();
if (!isnan(mcu_temp)) {
lpp.addTemperature(0, mcu_temp);
lpp.addTemperature(CH_SELF, mcu_temp);
}
}
if (env.has_humidity) {
lpp.addRelativeHumidity(0, env.humidity_pct);
lpp.addRelativeHumidity(CH_SELF, env.humidity_pct);
}
if (env.has_pressure) {
lpp.addBarometricPressure(0, env.pressure_hpa);
lpp.addBarometricPressure(CH_SELF, env.pressure_hpa);
}
} else {
/* No env sensors at all — try MCU temp directly */
float mcu_temp = _board.getMCUTemperature();
if (!isnan(mcu_temp)) {
lpp.addTemperature(0, mcu_temp);
lpp.addTemperature(CH_SELF, mcu_temp);
}
}
@@ -271,7 +272,7 @@ int RepeaterMesh::handleRequest(ClientInfo* sender, uint32_t sender_timestamp, u
if (power_sensors_available()) {
struct power_data pwr;
if (power_sensors_read(&pwr) == 0) {
uint8_t ch = 1;
uint8_t ch = CH_SELF + 1;
for (int j = 0; j < pwr.num_channels; j++) {
if (pwr.channels[j].valid) {
lpp.addVoltage(ch, pwr.channels[j].voltage_v);
+47
View File
@@ -0,0 +1,47 @@
# Health Check overlay — verbose logging for diagnosing repeater issues
# Build: west build -b rak3401_1watt zephcore --pristine -- \
# -DEXTRA_CONF_FILE="boards/common/repeater.conf;boards/common/healthcheck.conf"
#
# Cranks all ZephCore log modules to INF (some to DBG where safe),
# enables packet logging, and sizes buffers for the extra output.
# ========== ZephCore module log levels ==========
# Main mesh logic (Mesh, BaseChatMesh, RepeaterMesh, Utils, PowerController)
CONFIG_ZEPHCORE_MAIN_LOG_LEVEL_DBG=y
# LoRa radio layer (Dispatcher, SX126xRadio, LoRaRadioBase, PacketPool)
CONFIG_ZEPHCORE_LORA_LOG_LEVEL_DBG=y
# Data store, CLI, ACL, RegionMap
CONFIG_ZEPHCORE_DATASTORE_LOG_LEVEL_DBG=y
# Board adapter (GPIO, ADC, battery)
CONFIG_ZEPHCORE_BOARD_LOG_LEVEL_DBG=y
# GPS manager
CONFIG_ZEPHCORE_GPS_LOG_LEVEL_DBG=y
# Environment sensors
CONFIG_ZEPHCORE_SENSORS_LOG_LEVEL_DBG=y
# USB repeater adapter
CONFIG_ZEPHCORE_USB_LOG_LEVEL_INF=y
# ========== Packet logging ==========
CONFIG_ZEPHCORE_PACKET_LOGGING=y
# ========== Zephyr subsystem logs ==========
# LoRa driver itself
CONFIG_LORA_LOG_LEVEL_DBG=y
# ========== Log infrastructure — sized for heavy output ==========
CONFIG_LOG_BUFFER_SIZE=16384
CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=1
CONFIG_LOG_PROCESS_THREAD_STACK_SIZE=4096
# Backends — UART (USB CDC) so you can read on a terminal
CONFIG_LOG_BACKEND_UART=y
CONFIG_LOG_BACKEND_RTT=y
# Increase system workqueue stack to handle DBG-level log calls from ISR context
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096