fix #if HAS_TELEMETRY when set to 0 (#3733)

This commit is contained in:
Oliver Seiler 2024-04-27 11:35:44 +00:00 committed by GitHub
parent f8c3f43ea6
commit a06a01d25e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -184,7 +184,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
virtual uint16_t getBattVoltage() override virtual uint16_t getBattVoltage() override
{ {
#if defined(HAS_TELEMETRY) && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU) #if HAS_TELEMETRY && !defined(ARCH_PORTDUINO) && !defined(HAS_PMU)
if (hasINA()) { if (hasINA()) {
LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage\n", config.power.device_battery_ina_address); LOG_DEBUG("Using INA on I2C addr 0x%x for device battery voltage\n", config.power.device_battery_ina_address);
return getINAVoltage(); return getINAVoltage();
@ -360,7 +360,7 @@ class AnalogBatteryLevel : public HasBatteryLevel
float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS); float last_read_value = (OCV[NUM_OCV_POINTS - 1] * NUM_CELLS);
uint32_t last_read_time_ms = 0; uint32_t last_read_time_ms = 0;
#if defined(HAS_TELEMETRY) && !defined(ARCH_PORTDUINO) #if HAS_TELEMETRY && !defined(ARCH_PORTDUINO)
uint16_t getINAVoltage() uint16_t getINAVoltage()
{ {
if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) { if (nodeTelemetrySensorsMap[meshtastic_TelemetrySensorType_INA219].first == config.power.device_battery_ina_address) {