remove most of the defines
This commit is contained in:
@@ -8,8 +8,8 @@
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*/
|
||||
#ifndef MENU_TEST_MODE
|
||||
#define MENU_TEST_MODE
|
||||
#ifndef MENU_TEST_MODE_H
|
||||
#define MENU_TEST_MODE_H
|
||||
|
||||
#include "SpecialMenus/driveModi/menuDriveMode.h"
|
||||
#include "driveModi/Modi/TestMode/testMode.h"
|
||||
@@ -96,4 +96,4 @@ class MenuTestModeWrapper : public MenuIntInputWrapper {
|
||||
TestModeFunctionDouble testModeFunctionDouble = nullptr;
|
||||
};
|
||||
|
||||
#endif // MENU_TEST_MODE
|
||||
#endif // MENU_TEST_MODE_H
|
||||
|
||||
@@ -20,7 +20,7 @@ DriveManager::DriveManager(MoveControl *moveControl, SPIClass *spiPort, const Co
|
||||
this->input = input;
|
||||
|
||||
this->spiPort = spiPort;
|
||||
this->navigation = new Navigation(spiPort, UBLOX_GNSS_SPI_CS);
|
||||
this->navigation = new Navigation(spiPort, PinNumbers::gnssSpiCs);
|
||||
if (wifi)
|
||||
this->navigation->initNtrip(NTRIP_HOST, NTRIP_PORT, NTRIP_MOUNT_POINT, NTRIP_USER, NTRIP_PASSWORD);
|
||||
|
||||
|
||||
+3
-3
@@ -64,7 +64,7 @@ void makeMenu(void);
|
||||
void restart(void);
|
||||
void receiveCallback (const uint8_t * mac, const uint8_t *incomingData, int len);
|
||||
void sendCallback (const uint8_t *mac_addr, esp_now_send_status_t status);
|
||||
void lcdWrapperCallback (const char data[][DISPLAY_WRAPPER_ROWS], uint8_t lines, uint8_t rows);
|
||||
void lcdWrapperCallback (const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows);
|
||||
|
||||
|
||||
void setup() {
|
||||
@@ -78,7 +78,7 @@ void setup() {
|
||||
Serial.println(WiFi.macAddress());
|
||||
|
||||
spiPort = new SPIClass(HSPI);
|
||||
spiPort->begin(UBLOX_GNSS_SPI_SCK, UBLOX_GNSS_SPI_CIPO, UBLOX_GNSS_SPI_COPI, UBLOX_GNSS_SPI_CS);
|
||||
spiPort->begin(PinNumbers::spiSck, PinNumbers::spiCipo, PinNumbers::spiCopi, PinNumbers::gnssSpiCs);
|
||||
|
||||
mainBattery = new Battery(35);
|
||||
controlPad = new ControlPad();
|
||||
@@ -289,7 +289,7 @@ void sendCallback (const uint8_t *mac_addr, esp_now_send_status_t status) {
|
||||
std::cout << "sendCallback - Delivery Fail" << std::endl;
|
||||
}
|
||||
|
||||
void lcdWrapperCallback (const char data[][DISPLAY_WRAPPER_ROWS], uint8_t lines, uint8_t rows) {
|
||||
void lcdWrapperCallback (const char data[][LcdWrapper::totalRows], uint8_t lines, uint8_t rows) {
|
||||
if (!controlPad->isControlPadConnected())
|
||||
return;
|
||||
|
||||
|
||||
+16
-12
@@ -14,30 +14,34 @@ MoveControl::MoveControl() {
|
||||
this->loopDelay = 20;
|
||||
this->left_motor = new MotorControl();
|
||||
this->right_motor = new MotorControl();
|
||||
this->left_speedometer = new Speedometer(M_ENCODE_LEFT, WHEEL_DIAMETER, ENC_STEPS);
|
||||
this->right_speedometer = new Speedometer(M_ENCODE_RIGHT, WHEEL_DIAMETER, ENC_STEPS);
|
||||
this->left_speedometer = new Speedometer(PinNumbers::LeftMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps);
|
||||
this->right_speedometer = new Speedometer(PinNumbers::RightMotor::encoder, Settings::wheelDiameter, Settings::encoderSteps);
|
||||
|
||||
this->left_pid = new PID( &this->wheelspeed_left,
|
||||
&this->left_pid_out,
|
||||
&this->wheelspeed_left_target,
|
||||
PID_LEFT_P, PID_LEFT_I, PID_LEFT_D,
|
||||
Settings::Pid::Left::P,
|
||||
Settings::Pid::Left::I,
|
||||
Settings::Pid::Left::D,
|
||||
DIRECT);
|
||||
this->right_pid = new PID( &this->wheelspeed_right,
|
||||
&this->right_pid_out,
|
||||
&this->wheelspeed_right_target,
|
||||
PID_RIGHT_P, PID_RIGHT_I, PID_RIGHT_D,
|
||||
Settings::Pid::Right::P,
|
||||
Settings::Pid::Right::I,
|
||||
Settings::Pid::Right::D,
|
||||
DIRECT);
|
||||
|
||||
this->left_pid->SetOutputLimits(PID_OUT_MIN, PID_OUT_MAX);
|
||||
this->left_pid->SetSampleTime(PID_SAMPLETIME);
|
||||
this->left_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
||||
this->left_pid->SetSampleTime(Settings::Pid::sampleTime);
|
||||
this->left_pid->SetMode(AUTOMATIC);
|
||||
|
||||
this->right_pid->SetOutputLimits(PID_OUT_MIN, PID_OUT_MAX);
|
||||
this->right_pid->SetSampleTime(PID_SAMPLETIME);
|
||||
this->right_pid->SetOutputLimits(Settings::Pid::outMin, Settings::Pid::outMax);
|
||||
this->right_pid->SetSampleTime(Settings::Pid::sampleTime);
|
||||
this->right_pid->SetMode(AUTOMATIC);
|
||||
|
||||
this->left_motor->init(M_PWM_1, PWM_CHANNEL_M1, M_DIR_11, M_DIR_12);
|
||||
this->right_motor->init(M_PWM_2, PWM_CHANNEL_M2, M_DIR_21, M_DIR_22);
|
||||
this->left_motor->init(PinNumbers::LeftMotor::pwm, PinNumbers::LeftMotor::pmwChannel, PinNumbers::LeftMotor::dir1, PinNumbers::LeftMotor::dir2);
|
||||
this->right_motor->init(PinNumbers::RightMotor::pwm, PinNumbers::RightMotor::pmwChannel, PinNumbers::RightMotor::dir1, PinNumbers::RightMotor::dir2);
|
||||
|
||||
this->addChildComponent(this->left_motor);
|
||||
this->addChildComponent(this->right_motor);
|
||||
@@ -165,8 +169,8 @@ void MoveControl::calcTargetWheelSpeed() {
|
||||
// (1 / r) * b
|
||||
constexpr double B = 2.096518987;
|
||||
|
||||
this->wheelspeed_right_target = (A * this->x_speed + B * this->rotation_speed) * (WHEEL_DIAMETER / 2);
|
||||
this->wheelspeed_left_target = (A * this->x_speed + (-B) * this->rotation_speed) * (WHEEL_DIAMETER / 2);
|
||||
this->wheelspeed_right_target = (A * this->x_speed + B * this->rotation_speed) * (Settings::wheelDiameter / 2);
|
||||
this->wheelspeed_left_target = (A * this->x_speed + (-B) * this->rotation_speed) * (Settings::wheelDiameter / 2);
|
||||
}
|
||||
|
||||
void MoveControl::regulateMotors() {
|
||||
|
||||
Reference in New Issue
Block a user