From c70e43126fdc69ee935224eae60a50e24469e85d Mon Sep 17 00:00:00 2001 From: Niklas Jensen Date: Fri, 26 Dec 2025 22:10:01 +0100 Subject: [PATCH] Added peripheral logging - Removed main logging --- esp32/src/main.cpp | 12 ++++++------ esp32/src/peripherals/peripherals.cpp | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/esp32/src/main.cpp b/esp32/src/main.cpp index 3896dc4..4220163 100644 --- a/esp32/src/main.cpp +++ b/esp32/src/main.cpp @@ -131,12 +131,12 @@ void IRAM_ATTR SpotControlLoopEntry(void *) { #if FT_ENABLED(USE_WS2812) ledService.loop(); #endif - CALLS_PER_SECOND_TIMED(SpotControlLoopEntry, - CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, peripherals_update) - CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, motionService_update) - CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, servoController_setAngles) - CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, servoController_update) - ); + // CALLS_PER_SECOND_TIMED(SpotControlLoopEntry, + // CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, peripherals_update) + // CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, motionService_update) + // CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, servoController_setAngles) + // CALLS_PER_SECOND_TIMED_FUNC_PRINT(SpotControlLoopEntry, servoController_update) + // ); // vTaskDelayUntil(&xLastWakeTime, xFrequency); } } diff --git a/esp32/src/peripherals/peripherals.cpp b/esp32/src/peripherals/peripherals.cpp index f4fea9d..917c0b7 100644 --- a/esp32/src/peripherals/peripherals.cpp +++ b/esp32/src/peripherals/peripherals.cpp @@ -56,11 +56,19 @@ void Peripherals::begin() { }; void Peripherals::update() { - readImu(); - readMag(); - EXECUTE_EVERY_N_MS(100, { readGesture(); }); - EXECUTE_EVERY_N_MS(500, { readBMP(); }); - EXECUTE_EVERY_N_MS(500, { readSonar(); }); + CALLS_PER_SECOND_TIMED_CALL(Peripherals_update, read_imu, readImu()); + CALLS_PER_SECOND_TIMED_CALL(Peripherals_update, read_mag, readMag()); + CALLS_PER_SECOND_TIMED_CALL(Peripherals_update, read_gesture, EXECUTE_EVERY_N_MS(100, { readGesture(); }) ); + CALLS_PER_SECOND_TIMED_CALL(Peripherals_update, read_bmp, EXECUTE_EVERY_N_MS(500, { readBMP(); }) ); + CALLS_PER_SECOND_TIMED_CALL(Peripherals_update, read_sonar, EXECUTE_EVERY_N_MS(500, { readSonar(); }) ); + + CALLS_PER_SECOND_TIMED(Peripherals_update, + CALLS_PER_SECOND_TIMED_FUNC_PRINT(Peripherals_update, read_imu) + CALLS_PER_SECOND_TIMED_FUNC_PRINT(Peripherals_update, read_mag) + CALLS_PER_SECOND_TIMED_FUNC_PRINT(Peripherals_update, read_gesture) + CALLS_PER_SECOND_TIMED_FUNC_PRINT(Peripherals_update, read_bmp) + CALLS_PER_SECOND_TIMED_FUNC_PRINT(Peripherals_update, read_sonar) + ); } void Peripherals::updatePins() {