introduced possibility to run move commands without timelimit

This commit is contained in:
hhaupt
2024-04-28 22:38:35 +02:00
parent 45977c95b9
commit c8f7e95363
6 changed files with 78 additions and 55 deletions

View File

@@ -16,17 +16,17 @@
#include <freertos/FreeRTOS.h>
#include <freertos/task.h>
const int MOTOR_RIGHT_PIN = 11;
const int MOTOR_LEFT_PIN = 12;
class Motion{
protected:
static const uint8_t RIGHT_MOTOR_DUTY = 128;
static const uint8_t LEFT_MOTOR_DUTY = 128;
static const int MOTOR_RIGHT_PIN = 11;
static const int MOTOR_LEFT_PIN = 12;
static void moveTask(void * args);
static void leftMotorTask(void * args);
static void rightMotorTask(void * args);
public:
Motion();
/**
* @brief Initialize the movement component.
*
@@ -35,21 +35,30 @@ public:
/**
* @brief Move forward for a certain amount of time.
* Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop().
* @param moveForMs Representing the duration of forward moving in milliseconds.
*/
void move(uint32_t moveForMs);
static void move(uint32_t moveForMs=0);
/**
* @brief Rotate clockwise for a certain amount of time.
* Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop().
* @param rotateForMs Representing the duration of rotating clockwise in milliseconds.
*/
void rotateClockwise(uint32_t rotateForMs);
static void rotateClockwise(uint32_t rotateForMs=0);
/**
* @brief Rotate anticlockwise for a certain amount of time.
* Call with moveForMs 0 will start movement, that must be stopped explicit by call to stop().
* @param rotateForMs Representing the duration of rotating anticlockwise in milliseconds.
*/
void rotateAnticlockwise(uint32_t rotateForMs);
static void rotateAntiClockwise(uint32_t rotateForMs=0);
/**
* @brief stops any current movement, no matter if timebased or endless
*
*/
static void stop(void);
};
#endif //Motion_h