Merge branch 'main' of ssh://gitea.cs.ru.is:2222/helgie22/ESP_Project3_H26 into Isak_part2
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include "rotary_encoder_driver.h"
|
||||
#include "motor_driver.h"
|
||||
#include "p_controller.h"
|
||||
#include "digital_out.h"
|
||||
|
||||
class State;
|
||||
|
||||
@@ -11,6 +12,10 @@ class State;
|
||||
class MotorController
|
||||
{
|
||||
private:
|
||||
static constexpr double DEFAULT_REFERENCE_RPM = 40.0;
|
||||
static constexpr double PWM_PER_PERCENT = 255.0 / 100.0;
|
||||
static const uint8_t LED_PIN = 5; // PB5 = D13 = LED_BUILTIN
|
||||
|
||||
State* current_state;
|
||||
|
||||
State* initialization_state;
|
||||
@@ -21,6 +26,8 @@ private:
|
||||
MotorDriver& motor;
|
||||
P_controller& controller;
|
||||
|
||||
Digital_out led;
|
||||
|
||||
double reference_rpm;
|
||||
|
||||
|
||||
@@ -45,7 +52,7 @@ public:
|
||||
|
||||
void command(char c);
|
||||
|
||||
void transition_to(State* new_state);
|
||||
void transition_to(State& new_state);
|
||||
|
||||
|
||||
void to_initialization();
|
||||
@@ -62,6 +69,10 @@ public:
|
||||
void stop_motor();
|
||||
|
||||
void reset_speed_measurement();
|
||||
|
||||
void led_on();
|
||||
|
||||
void led_off();
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user