Run servo movement on different core

This commit is contained in:
Christoph Hagen
2024-04-20 09:57:15 +02:00
parent 6256b6ef33
commit 4a88d1a380
3 changed files with 40 additions and 11 deletions

View File

@@ -65,7 +65,7 @@ public:
/**
* @brief Update the servo state periodically
*
* This function should be periodically called to update the servo state,
* This function will be periodically called to update the servo state,
* specifically to release the button after the opening time has elapsed.
*
* There is no required interval to call this function, but the accuracy of
@@ -78,16 +78,14 @@ public:
*/
void pressButton();
/**
* Release the door opener button by moving the servo arm.
*/
void releaseButton();
private:
// Indicator that the door button is pushed
bool buttonIsPressed = false;
// Indicate that the button should be pressed
bool shouldPressButton = false;
uint32_t openDuration = 0;
int pressedValue = 0;
@@ -103,4 +101,12 @@ private:
// PWM Module needed for the servo
ESP32PWM pwm;
// The task on core 1 that resets the servo
TaskHandle_t servoResetTask;
/**
* Release the door opener button by moving the servo arm.
*/
void releaseButton();
};