Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
#include "settopdistancephase.h"
#include "commandhandlingphase.h"
SetTopDistancePhase::SetTopDistancePhase(PhaseManager* manager, Movement* movement, Pen* pen) : CommandHandlingPhase(movement) {
this->manager = manager;
this->movement = movement;
this->pen = pen;
}
void SetTopDistancePhase::setTopDistance(AsyncWebServerRequest *request) {
const AsyncWebParameter* p = request->getParam(0);
int distance = p->value().toInt();
Serial.println("Setting distance");
movement->setTopDistance(distance);
manager->setPhase(PhaseManager::SvgSelect);
manager->respondWithState(request);
}
void SetTopDistancePhase::setServo(AsyncWebServerRequest *request) {
const AsyncWebParameter* p = request->getParam(0);
int angle = p->value().toInt();
pen->setRawValue(angle);
request->send(200, "text/plain", "OK");
}
void SetTopDistancePhase::estepsCalibration(AsyncWebServerRequest* request) {
Serial.println("Extending 1000mm");
movement->extend1000mm();
request->send(200, "text/plain", "OK");
}
const char* SetTopDistancePhase::getName() {
return "SetTopDistance";
}a1f6533f1This file is pinned to the selected release. Download the original to open it in your design tool.