diff --git a/libraries/AP_HAL_ESP32/AnalogIn.cpp b/libraries/AP_HAL_ESP32/AnalogIn.cpp index 05487e62a0052..9d687135403bd 100644 --- a/libraries/AP_HAL_ESP32/AnalogIn.cpp +++ b/libraries/AP_HAL_ESP32/AnalogIn.cpp @@ -347,6 +347,7 @@ void AnalogSource::_add_value() */ void AnalogIn::init() { + hal.scheduler->register_timer_process(FUNCTOR_BIND_MEMBER(&AnalogIn::_timer_tick, void)); } /* diff --git a/libraries/AP_HAL_ESP32/Scheduler.cpp b/libraries/AP_HAL_ESP32/Scheduler.cpp index 8b683b6e34dc3..5748aab3977ba 100644 --- a/libraries/AP_HAL_ESP32/Scheduler.cpp +++ b/libraries/AP_HAL_ESP32/Scheduler.cpp @@ -15,7 +15,6 @@ #include "AP_HAL_ESP32/Scheduler.h" #include "AP_HAL_ESP32/RCInput.h" -#include "AP_HAL_ESP32/AnalogIn.h" #include "AP_Math/AP_Math.h" #include "SdCard.h" #include "Profile.h" @@ -318,10 +317,6 @@ void IRAM_ATTR Scheduler::_timer_thread(void *arg) while (true) { sched->delay_microseconds(1000); sched->_run_timers(); - //analog in -#ifndef HAL_DISABLE_ADC_DRIVER - ((AnalogIn*)hal.analogin)->_timer_tick(); -#endif } }