#pragma once // system includes #include // Arduino includes #ifdef FEATURE_SERIAL #include #endif // 3rdparty lib includes #include #include // local includes #include "bobbycar-common.h" #include "bobbycar-serial.h" #ifdef FEATURE_SERIAL #include "feedbackparser.h" #endif // forward declares #ifdef FEATURE_SERIAL class HardwareSerial; #endif struct Controller { Controller( #ifdef FEATURE_SERIAL HardwareSerial &serial, #endif bool &enableLeft, bool &enableRight, bool &invertLeft, bool &invertRight, espconfig::ConfigWrapper &voltageCalib30V, espconfig::ConfigWrapper &voltageCalib50V); // Controller(const Controller &) = delete; // Controller &operator=(const Controller &) = delete; #ifdef FEATURE_SERIAL std::reference_wrapper serial; #endif bool &enableLeft, &enableRight, &invertLeft, &invertRight; espconfig::ConfigWrapper &voltageCalib30V, &voltageCalib50V; bobbycar::protocol::serial::Command command{}; #ifdef FEATURE_CAN espchrono::millis_clock::time_point lastCanFeedback{}; #endif bool feedbackValid{}; bobbycar::protocol::serial::Feedback feedback{}; #ifdef FEATURE_SERIAL FeedbackParser parser{serial, feedbackValid, feedback}; #endif float getCalibratedVoltage() const; };