Compare commits

...

28 Commits

Author SHA1 Message Date
Michael Gjelsø
67889edeb1
Merge a76e18a9d0 into b5a8e8f51b 2025-07-29 08:44:33 +02:00
Chloe Bethel
b5a8e8f51b
DEBUG_MUTE correctness (#7492)
Some checks failed
CI / docker-alp-amd64-tft (push) Has been cancelled
CI / docker-deb-arm64 (push) Has been cancelled
CI / docker-deb-armv7 (push) Has been cancelled
CI / check (push) Has been cancelled
CI / build-esp32 (push) Has been cancelled
CI / build-esp32s3 (push) Has been cancelled
CI / build-esp32c3 (push) Has been cancelled
CI / build-esp32c6 (push) Has been cancelled
CI / build-nrf52840 (push) Has been cancelled
CI / build-rp2040 (push) Has been cancelled
CI / build-rp2350 (push) Has been cancelled
CI / build-stm32 (push) Has been cancelled
CI / gather-artifacts (esp32) (push) Has been cancelled
CI / gather-artifacts (esp32c3) (push) Has been cancelled
CI / gather-artifacts (esp32c6) (push) Has been cancelled
CI / gather-artifacts (esp32s3) (push) Has been cancelled
CI / gather-artifacts (nrf52840) (push) Has been cancelled
CI / gather-artifacts (rp2040) (push) Has been cancelled
CI / gather-artifacts (rp2350) (push) Has been cancelled
CI / gather-artifacts (stm32) (push) Has been cancelled
CI / release-artifacts (push) Has been cancelled
CI / release-firmware (esp32) (push) Has been cancelled
CI / release-firmware (esp32c3) (push) Has been cancelled
CI / release-firmware (esp32c6) (push) Has been cancelled
CI / release-firmware (esp32s3) (push) Has been cancelled
CI / release-firmware (nrf52840) (push) Has been cancelled
CI / release-firmware (rp2040) (push) Has been cancelled
CI / release-firmware (rp2350) (push) Has been cancelled
CI / release-firmware (stm32) (push) Has been cancelled
CI / publish-firmware (push) Has been cancelled
* treewide: make 'ifdef DEBUG_PORT' guards also take into account DEBUG_MUTE

* stm32wl: Add a guard against having debug prints turned on without PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF defined

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
2025-07-29 08:51:38 +10:00
Michael Gjelsø
a76e18a9d0
Merge branch 'master' into use_detected_ina_addr 2025-07-17 12:25:20 +02:00
Michael Gjelsø
dc8b7a2b63
Merge branch 'master' into use_detected_ina_addr 2025-07-07 15:42:18 +02:00
Michael Gjelsø
d3fe19eca6
Merge branch 'master' into use_detected_ina_addr 2025-07-03 17:42:08 +02:00
Tom Fifield
6f93f81fbe
Merge branch 'master' into use_detected_ina_addr 2025-07-02 11:31:55 +10:00
Michael Gjelsø
a23ba533ac
Merge branch 'master' into use_detected_ina_addr 2025-06-27 20:30:29 +02:00
Michael Gjelsø
6e89d6bcb7
Merge branch 'meshtastic:master' into use_detected_ina_addr 2025-05-18 18:30:33 +02:00
michael
aca5249fd1 Trunk formating 2025-05-18 18:26:58 +02:00
Michael Gjelsø
fc8594a8d3
Merge branch 'master' into use_detected_ina_addr 2025-05-14 19:02:01 +02:00
Michael Gjelsø
39e42f64e9
Merge branch 'master' into use_detected_ina_addr 2025-05-13 20:40:20 +02:00
Tom Fifield
624fccb865
Merge branch 'master' into use_detected_ina_addr 2025-05-13 08:40:19 +10:00
Michael Gjelsø
4e527ff487
Merge branch 'master' into use_detected_ina_addr 2025-04-17 16:09:03 +02:00
Michael Gjelsø
d8ef6d5592
Merge branch 'master' into use_detected_ina_addr 2025-04-17 12:41:05 +02:00
Michael Gjelsø
0b325faf17
Merge branch 'master' into use_detected_ina_addr 2025-04-17 11:13:13 +02:00
Michael Gjelsø
c58bf5070b
Merge branch 'meshtastic:master' into use_detected_ina_addr 2025-03-31 18:00:56 +02:00
gjelsoe
07f955518a Use ScanI2C
Re-wrote some to use ScanI2C
2025-03-31 15:37:53 +02:00
Michael Gjelsø
bd19402411
Merge branch 'meshtastic:master' into use_detected_ina_addr 2025-03-06 16:56:17 +01:00
gjelsoe
bde3a88f41 Merge branch 'use_detected_ina_addr' of https://github.com/gjelsoe/firmware into use_detected_ina_addr 2025-03-02 14:59:06 +01:00
Michael Gjelsø
323e977961
Merge branch 'master' into use_detected_ina_addr 2025-03-01 14:06:16 +01:00
michael
57cf9ddd0a Trunk.... 2025-02-27 16:08:44 +01:00
gjelsoe
3df87d9fab Merge branch 'use_detected_ina_addr' of https://github.com/gjelsoe/firmware into use_detected_ina_addr 2025-02-27 15:24:55 +01:00
gjelsoe
81176de5a7 Update Power.cpp
Take two
2025-02-27 13:54:54 +08:00
gjelsoe
fc289198c9 Update Power.cpp
First stab at using I2C detected INA addr.
2025-02-27 13:54:54 +08:00
Michael Gjelsø
6e89ba98fd
Merge branch 'meshtastic:master' into use_detected_ina_addr 2025-02-17 16:28:21 +01:00
Michael Gjelsø
61912b0dd9
Merge branch 'meshtastic:master' into use_detected_ina_addr 2025-02-16 15:26:05 +01:00
gjelsoe
8b2a6c3b78 Update Power.cpp
Take two
2025-02-15 23:40:27 +01:00
gjelsoe
89e0857c73 Update Power.cpp
First stab at using I2C detected INA addr.
2025-02-15 19:18:25 +01:00
18 changed files with 154 additions and 53 deletions

View File

@ -82,6 +82,8 @@ static const uint8_t ext_chrg_detect_value = EXT_CHRG_DETECT_VALUE;
#endif #endif
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
#include "main.h";
uint8_t INA_ADDR_LOCAL;
#if __has_include(<Adafruit_INA219.h>) #if __has_include(<Adafruit_INA219.h>)
INA219Sensor ina219Sensor; INA219Sensor ina219Sensor;
#else #else
@ -474,7 +476,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
if (hasINA()) { if (hasINA()) {
// get current flow from INA sensor - negative value means power flowing into the battery // get current flow from INA sensor - negative value means power flowing into the battery
// default assuming BATTERY+ <--> INA_VIN+ <--> SHUNT RESISTOR <--> INA_VIN- <--> LOAD // default assuming BATTERY+ <--> INA_VIN+ <--> SHUNT RESISTOR <--> INA_VIN- <--> LOAD
LOG_DEBUG("Using INA on I2C addr 0x%x for charging detection", config.power.device_battery_ina_address); // LOG_DEBUG("Using INA on I2C addr 0x%x for charging detection", config.power.device_battery_ina_address);
LOG_DEBUG("Using INA on I2C addr 0x%x for charging detection", INA_ADDR_LOCAL);
#if defined(INA_CHARGING_DETECTION_INVERT) #if defined(INA_CHARGING_DETECTION_INVERT)
return getINACurrent() > 0; return getINACurrent() > 0;
#else #else
@ -517,8 +520,29 @@ class AnalogBatteryLevel : public HasBatteryLevel
#endif #endif
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR #if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR
/*
Read Voltage from INA using autodetect of addr first else use addr in config.power.device_battery_ina_address
*/
uint16_t getINAVoltage() uint16_t getINAVoltage()
{ {
if (!config.power.device_battery_ina_address) {
if (ina_found.type != ScanI2C::DeviceType::NONE) {
switch (ina_found.type) {
case ScanI2C::DeviceType::INA219:
return ina219Sensor.getBusVoltageMv();
break;
case ScanI2C::DeviceType::INA226:
return ina226Sensor.getBusVoltageMv();
break;
case ScanI2C::DeviceType::INA260:
return ina260Sensor.getBusVoltageMv();
break;
case ScanI2C::DeviceType::INA3221:
return ina3221Sensor.getBusVoltageMv();
break;
}
}
} else if (config.power.device_battery_ina_address) {
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) { if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
return ina219Sensor.getBusVoltageMv(); return ina219Sensor.getBusVoltageMv();
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first == } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first ==
@ -531,11 +555,29 @@ class AnalogBatteryLevel : public HasBatteryLevel
config.power.device_battery_ina_address) { config.power.device_battery_ina_address) {
return ina3221Sensor.getBusVoltageMv(); return ina3221Sensor.getBusVoltageMv();
} }
}
return 0; return 0;
} }
/*
Read Current from INA using autodetect of addr first else use addr in config.power.device_battery_ina_address
*/
int16_t getINACurrent() int16_t getINACurrent()
{ {
if (!config.power.device_battery_ina_address) {
if (ina_found.type != ScanI2C::DeviceType::NONE) {
switch (ina_found.type) {
case ScanI2C::DeviceType::INA219:
return ina219Sensor.getCurrentMa();
case ScanI2C::DeviceType::INA226:
return ina226Sensor.getCurrentMa();
case ScanI2C::DeviceType::INA3221:
return ina3221Sensor.getCurrentMa();
}
}
} else if (config.power.device_battery_ina_address) {
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) { if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
return ina219Sensor.getCurrentMa(); return ina219Sensor.getCurrentMa();
} else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first == } else if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA226].first ==
@ -545,14 +587,43 @@ class AnalogBatteryLevel : public HasBatteryLevel
config.power.device_battery_ina_address) { config.power.device_battery_ina_address) {
return ina3221Sensor.getCurrentMa(); return ina3221Sensor.getCurrentMa();
} }
}
return 0; return 0;
} }
bool hasINA() bool hasINA()
/*
Use autodetect of addr first else use addr in config.power.device_battery_ina_address
Store INA addr in local variable for later use.
*/
{ {
if (!config.power.device_battery_ina_address) { if (!config.power.device_battery_ina_address) {
return false; if (ina_found.type != ScanI2C::DeviceType::NONE) {
INA_ADDR_LOCAL = ina_found.address.address;
switch (ina_found.type) {
case ScanI2C::DeviceType::INA219:
if (!ina219Sensor.isInitialized())
return ina219Sensor.runOnce() > 0;
return ina219Sensor.isRunning();
case ScanI2C::DeviceType::INA226:
if (!ina226Sensor.isInitialized())
return ina226Sensor.runOnce() > 0;
return ina226Sensor.isRunning();
case ScanI2C::DeviceType::INA260:
if (!ina260Sensor.isInitialized())
return ina260Sensor.runOnce() > 0;
return ina260Sensor.isRunning();
case ScanI2C::DeviceType::INA3221:
if (!ina3221Sensor.isInitialized())
return ina3221Sensor.runOnce() > 0;
return ina3221Sensor.isRunning();
} }
}
} else if (config.power.device_battery_ina_address) {
INA_ADDR_LOCAL = config.power.device_battery_ina_address;
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) { if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {
if (!ina219Sensor.isInitialized()) if (!ina219Sensor.isInitialized())
return ina219Sensor.runOnce() > 0; return ina219Sensor.runOnce() > 0;
@ -572,6 +643,8 @@ class AnalogBatteryLevel : public HasBatteryLevel
return ina3221Sensor.runOnce() > 0; return ina3221Sensor.runOnce() > 0;
return ina3221Sensor.isRunning(); return ina3221Sensor.isRunning();
} }
}
INA_ADDR_LOCAL = 0;
return false; return false;
} }
#endif #endif

View File

@ -41,6 +41,12 @@ ScanI2C::FoundDevice ScanI2C::firstAccelerometer() const
return firstOfOrNONE(9, types); return firstOfOrNONE(9, types);
} }
ScanI2C::FoundDevice ScanI2C::firstINA() const
{
ScanI2C::DeviceType types[] = {INA219, INA226, INA260, INA3221};
return firstOfOrNONE(4, types);
}
ScanI2C::FoundDevice ScanI2C::firstAQI() const ScanI2C::FoundDevice ScanI2C::firstAQI() const
{ {
ScanI2C::DeviceType types[] = {PMSA0031, SCD4X}; ScanI2C::DeviceType types[] = {PMSA0031, SCD4X};

View File

@ -132,6 +132,8 @@ class ScanI2C
FoundDevice firstAccelerometer() const; FoundDevice firstAccelerometer() const;
FoundDevice firstINA() const;
FoundDevice firstAQI() const; FoundDevice firstAQI() const;
FoundDevice firstRGBLED() const; FoundDevice firstRGBLED() const;

View File

@ -194,9 +194,15 @@ ScanI2C::DeviceAddress rtc_found = ScanI2C::ADDRESS_NONE;
ScanI2C::DeviceAddress accelerometer_found = ScanI2C::ADDRESS_NONE; ScanI2C::DeviceAddress accelerometer_found = ScanI2C::ADDRESS_NONE;
// The I2C address of the RGB LED (if found) // The I2C address of the RGB LED (if found)
ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::ADDRESS_NONE); ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::ADDRESS_NONE);
// The I2C address of the INA Module (if found)
ScanI2C::FoundDevice ina_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::ADDRESS_NONE);
ScanI2C::DeviceAddress ina_Address = ScanI2C::ADDRESS_NONE;
/// The I2C address of our Air Quality Indicator (if found) /// The I2C address of our Air Quality Indicator (if found)
ScanI2C::DeviceAddress aqi_found = ScanI2C::ADDRESS_NONE; ScanI2C::DeviceAddress aqi_found = ScanI2C::ADDRESS_NONE;
#ifdef T_WATCH_S3 #ifdef T_WATCH_S3
Adafruit_DRV2605 drv; Adafruit_DRV2605 drv;
#endif #endif
@ -653,6 +659,12 @@ void setup()
LOG_DEBUG("acc_info = %i", acc_info.type); LOG_DEBUG("acc_info = %i", acc_info.type);
#endif #endif
#if HAS_TELEMETRY && !MESHTASTIC_EXCLUDE_ENVIRONMENTAL_SENSOR && !defined(ARCH_PORTDUINO)
auto ina_Info = i2cScanner->firstINA();
// ina_Address = ina_Info.type != ScanI2C::DeviceType::NONE ? ina_Info.address : ina_Address;
LOG_DEBUG("ina_info = %i", ina_Info.type);
#endif
scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::BME_680, meshtastic_TelemetrySensorType_BME680); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::BME_680, meshtastic_TelemetrySensorType_BME680);
scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::BME_280, meshtastic_TelemetrySensorType_BME280); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::BME_280, meshtastic_TelemetrySensorType_BME280);
scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::BMP_280, meshtastic_TelemetrySensorType_BMP280); scannerToSensorsMap(i2cScanner, ScanI2C::DeviceType::BMP_280, meshtastic_TelemetrySensorType_BMP280);

View File

@ -35,6 +35,8 @@ extern bool kb_found;
extern ScanI2C::DeviceAddress rtc_found; extern ScanI2C::DeviceAddress rtc_found;
extern ScanI2C::DeviceAddress accelerometer_found; extern ScanI2C::DeviceAddress accelerometer_found;
extern ScanI2C::FoundDevice rgb_found; extern ScanI2C::FoundDevice rgb_found;
// extern ScanI2C::DeviceAddress ina_Address;
extern ScanI2C::FoundDevice ina_found;
extern ScanI2C::DeviceAddress aqi_found; extern ScanI2C::DeviceAddress aqi_found;
extern bool eink_found; extern bool eink_found;

View File

@ -224,9 +224,10 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) { if (!config.lora.override_duty_cycle && myRegion->dutyCycle < 100) {
float hourlyTxPercent = airTime->utilizationTXPercent(); float hourlyTxPercent = airTime->utilizationTXPercent();
if (hourlyTxPercent > myRegion->dutyCycle) { if (hourlyTxPercent > myRegion->dutyCycle) {
#ifdef DEBUG_PORT
uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle); uint8_t silentMinutes = airTime->getSilentMinutes(hourlyTxPercent, myRegion->dutyCycle);
LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d mins", silentMinutes); LOG_WARN("Duty cycle limit exceeded. Aborting send for now, you can send again in %d mins", silentMinutes);
meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed(); meshtastic_ClientNotification *cn = clientNotificationPool.allocZeroed();
cn->has_reply_id = true; cn->has_reply_id = true;
cn->reply_id = p->id; cn->reply_id = p->id;
@ -234,7 +235,7 @@ ErrorCode Router::send(meshtastic_MeshPacket *p)
cn->time = getValidTime(RTCQualityFromNet); cn->time = getValidTime(RTCQualityFromNet);
sprintf(cn->message, "Duty cycle limit exceeded. You can send again in %d mins", silentMinutes); sprintf(cn->message, "Duty cycle limit exceeded. You can send again in %d mins", silentMinutes);
service->sendClientNotification(cn); service->sendClientNotification(cn);
#endif
meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT; meshtastic_Routing_Error err = meshtastic_Routing_Error_DUTY_CYCLE_LIMIT;
if (isFromUs(p)) { // only send NAK to API, not to the mesh if (isFromUs(p)) { // only send NAK to API, not to the mesh
abortSendAndNak(err, p); abortSendAndNak(err, p);

View File

@ -8,7 +8,7 @@
meshtastic_MeshPacket *ReplyModule::allocReply() meshtastic_MeshPacket *ReplyModule::allocReply()
{ {
assert(currentRequest); // should always be !NULL assert(currentRequest); // should always be !NULL
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
auto req = *currentRequest; auto req = *currentRequest;
auto &p = req.decoded; auto &p = req.decoded;
// The incoming message is in p.payload // The incoming message is in p.payload

View File

@ -121,7 +121,7 @@ int32_t AirQualityTelemetryModule::runOnce()
bool AirQualityTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) bool AirQualityTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t)
{ {
if (t->which_variant == meshtastic_Telemetry_air_quality_metrics_tag) { if (t->which_variant == meshtastic_Telemetry_air_quality_metrics_tag) {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
LOG_INFO("(Received from %s): pm10_standard=%i, pm25_standard=%i, pm100_standard=%i", sender, LOG_INFO("(Received from %s): pm10_standard=%i, pm25_standard=%i, pm100_standard=%i", sender,

View File

@ -49,7 +49,7 @@ bool DeviceTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &
return false; return false;
if (t->which_variant == meshtastic_Telemetry_device_metrics_tag) { if (t->which_variant == meshtastic_Telemetry_device_metrics_tag) {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f", sender, LOG_INFO("(Received from %s): air_util_tx=%f, channel_utilization=%f, battery_level=%i, voltage=%f", sender,

View File

@ -502,7 +502,7 @@ void EnvironmentTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiSt
bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) bool EnvironmentTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t)
{ {
if (t->which_variant == meshtastic_Telemetry_environment_metrics_tag) { if (t->which_variant == meshtastic_Telemetry_environment_metrics_tag) {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, " LOG_INFO("(Received from %s): barometric_pressure=%f, current=%f, gas_resistance=%f, relative_humidity=%f, "

View File

@ -149,7 +149,7 @@ void HealthTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *
bool HealthTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) bool HealthTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t)
{ {
if (t->which_variant == meshtastic_Telemetry_health_metrics_tag) { if (t->which_variant == meshtastic_Telemetry_health_metrics_tag) {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
LOG_INFO("(Received from %s): temperature=%f, heart_bpm=%d, spO2=%d,", sender, t->variant.health_metrics.temperature, LOG_INFO("(Received from %s): temperature=%f, heart_bpm=%d, spO2=%d,", sender, t->variant.health_metrics.temperature,

View File

@ -27,7 +27,7 @@ bool HostMetricsModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp,
return false; return false;
if (t->which_variant == meshtastic_Telemetry_host_metrics_tag) { if (t->which_variant == meshtastic_Telemetry_host_metrics_tag) {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
if (t->variant.host_metrics.has_user_string) if (t->variant.host_metrics.has_user_string)
t->variant.host_metrics.user_string[sizeof(t->variant.host_metrics.user_string) - 1] = '\0'; t->variant.host_metrics.user_string[sizeof(t->variant.host_metrics.user_string) - 1] = '\0';

View File

@ -168,7 +168,7 @@ void PowerTelemetryModule::drawFrame(OLEDDisplay *display, OLEDDisplayUiState *s
bool PowerTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t) bool PowerTelemetryModule::handleReceivedProtobuf(const meshtastic_MeshPacket &mp, meshtastic_Telemetry *t)
{ {
if (t->which_variant == meshtastic_Telemetry_power_metrics_tag) { if (t->which_variant == meshtastic_Telemetry_power_metrics_tag) {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
const char *sender = getSenderShortName(mp); const char *sender = getSenderShortName(mp);
LOG_INFO("(Received from %s): ch1_voltage=%.1f, ch1_current=%.1f, ch2_voltage=%.1f, ch2_current=%.1f, " LOG_INFO("(Received from %s): ch1_voltage=%.1f, ch1_current=%.1f, ch2_voltage=%.1f, ch2_current=%.1f, "

View File

@ -9,7 +9,7 @@ TextMessageModule *textMessageModule;
ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp) ProcessMessage TextMessageModule::handleReceived(const meshtastic_MeshPacket &mp)
{ {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
auto &p = mp.decoded; auto &p = mp.decoded;
LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes); LOG_INFO("Received text msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes);
#endif #endif

View File

@ -232,7 +232,7 @@ void TraceRouteModule::appendMyIDandSNR(meshtastic_RouteDiscovery *updated, floa
void TraceRouteModule::printRoute(meshtastic_RouteDiscovery *r, uint32_t origin, uint32_t dest, bool isTowardsDestination) void TraceRouteModule::printRoute(meshtastic_RouteDiscovery *r, uint32_t origin, uint32_t dest, bool isTowardsDestination)
{ {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
std::string route = "Route traced:\n"; std::string route = "Route traced:\n";
route += vformat("0x%x --> ", origin); route += vformat("0x%x --> ", origin);
for (uint8_t i = 0; i < r->route_count; i++) { for (uint8_t i = 0; i < r->route_count; i++) {

View File

@ -16,7 +16,7 @@ WaypointModule *waypointModule;
ProcessMessage WaypointModule::handleReceived(const meshtastic_MeshPacket &mp) ProcessMessage WaypointModule::handleReceived(const meshtastic_MeshPacket &mp)
{ {
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
auto &p = mp.decoded; auto &p = mp.decoded;
LOG_INFO("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes); LOG_INFO("Received waypoint msg from=0x%0x, id=0x%x, msg=%.*s", mp.from, mp.id, p.payload.size, p.payload.bytes);
#endif #endif

View File

@ -32,3 +32,8 @@
#define SX126X_DIO1 1001 #define SX126X_DIO1 1001
#define SX126X_RESET 1003 #define SX126X_RESET 1003
#define SX126X_BUSY 1004 #define SX126X_BUSY 1004
#if !defined(DEBUG_MUTE) && !defined(PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF)
#error \
"You MUST enable PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF if debug prints are enabled. printf will print uninitialized garbage instead of floats."
#endif

View File

@ -131,7 +131,7 @@ void initDeepSleep()
support busted boards, assume button one was pressed wakeButtons = ((uint64_t)1) << buttons.gpios[0]; support busted boards, assume button one was pressed wakeButtons = ((uint64_t)1) << buttons.gpios[0];
*/ */
#ifdef DEBUG_PORT #if defined(DEBUG_PORT) && !defined(DEBUG_MUTE)
// If we booted because our timer ran out or the user pressed reset, send those as fake events // If we booted because our timer ran out or the user pressed reset, send those as fake events
RESET_REASON hwReason = rtc_get_reset_reason(0); RESET_REASON hwReason = rtc_get_reset_reason(0);