From 7c349a32890df29336edfba3fef02045603ba054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Phillip=20K=C3=BChne?= Date: Wed, 12 Feb 2025 21:56:40 +0100 Subject: [PATCH] Integrate IMU into Power Management --- src/motionDetection/MotionDetection.cpp | 4 ++++ src/motionDetection/MotionDetection.h | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/motionDetection/MotionDetection.cpp b/src/motionDetection/MotionDetection.cpp index a06618e..ba9ce17 100644 --- a/src/motionDetection/MotionDetection.cpp +++ b/src/motionDetection/MotionDetection.cpp @@ -6,6 +6,10 @@ MotionDetection::MotionDetection(){ }; void MotionDetection::begin(void){ + Power::waitForCurrentAllowance( + PowerParameters::PowerConsumers::IMU, + PowerParameters::CurrentConsumptions::CURRENT_IMU, + IMU_MAX_EXECUTION_DELAY_MS, NULL); pinMode(34,OUTPUT); digitalWrite(34,HIGH); handler->begin(36,37,35,34); diff --git a/src/motionDetection/MotionDetection.h b/src/motionDetection/MotionDetection.h index 8fecbb6..4b5b3e6 100644 --- a/src/motionDetection/MotionDetection.h +++ b/src/motionDetection/MotionDetection.h @@ -10,9 +10,13 @@ */ #ifndef MotionDetection_h #define MotionDetection_h -#include -#include +#include "../power/Power.h" #include "IMU_CMDs.h" +#include +#include + +#define IMU_MAX_EXECUTION_DELAY_MS 1 + struct IMUResult{ int16_t x; int16_t y;