AP_BattMonitor: make logging dependent on HAL_LOGGING_ENABLED not HAL_BUILD_AP_PERIPH

We have logging on some periphs now
This commit is contained in:
Peter Barker 2021-11-23 16:15:39 +11:00 committed by Andrew Tridgell
parent ee7464140a
commit 70d98336bc
1 changed files with 3 additions and 3 deletions

View File

@ -373,7 +373,7 @@ void AP_BattMonitor::convert_dynamic_param_groups(uint8_t instance)
// read - For all active instances read voltage & current; log BAT, BCL, POWR
void AP_BattMonitor::read()
{
#ifndef HAL_BUILD_AP_PERIPH
#if HAL_LOGGING_ENABLED
AP_Logger *logger = AP_Logger::get_singleton();
if (logger != nullptr && logger->should_log(_log_battery_bit)) {
logger->Write_Power();
@ -384,8 +384,8 @@ void AP_BattMonitor::read()
if (drivers[i] != nullptr && get_type(i) != Type::NONE) {
drivers[i]->read();
drivers[i]->update_resistance_estimate();
#ifndef HAL_BUILD_AP_PERIPH
#if HAL_LOGGING_ENABLED
if (logger != nullptr && logger->should_log(_log_battery_bit)) {
const uint64_t time_us = AP_HAL::micros64();
drivers[i]->Log_Write_BAT(i, time_us);