a lot of bullshit

This commit is contained in:
2021-12-14 19:22:06 +01:00
parent 1fc5a75f33
commit cd29191bb4
27 changed files with 703 additions and 551 deletions
@@ -0,0 +1,43 @@
#include "consolControl.h"
ConsolControl::ConsolControl() {
this->debug = new DebugMqtt("ConsolControl");
}
void ConsolControl::init(MoveControl *MoveControl) {
this->moveControl = moveControl;
}
void ConsolControl::run() {
uint8_t side = -1;
if (Serial.available()) {
char cmd = Serial.read();
if (cmd == 'l') {
side = 0;
} else if (cmd == 'r') {
side = 1;
}
double p = Serial.parseFloat();
double i = Serial.parseFloat();
double d = Serial.parseFloat();
double s = Serial.parseFloat();
double r = Serial.parseFloat();
if (p && i && d && s && r) {
Serial.println("ConsolControl changeDate");
this->moveControl->setPidTunings(side, p, i, d);
this->moveControl->setSpeed(s);
this->moveControl->setRotationspeed(r);
} else {
this->moveControl->setDrivingStatus(DrivingStatus::stop);
printManual();
debug->sendMsg(Loglevel::error, "not all double are not zero");
}
}
}
void ConsolControl::printManual() {
Serial.println("r 12.0 13.0 4.0 1.0 1.0 // site p i d s r");
}