technoshop.laser_turret_debug/serial_stream.cpp
Julien Oculi 403f9181e3 feat!: WIP convert all motor controls to stack based task pool
This commit close this branch with WIP implementation of a stack based
task pool system to handle long running action (motor move) of
the kissStepper lib (that need a long `while`). The goal was to
allow handling of incomming serrial messages and motion cancellation
during stepper control loop.
2025-07-25 14:59:37 +02:00

31 lines
546 B
C++

#include "serial_stream.h"
SerialStream &SerialStream::connect(HardwareSerial &serial) {
_serial = &serial;
return *this;
}
SerialStream &SerialStream::disconnect() {
_serial = nullptr;
return *this;
}
SerialStream &SerialStream::bind(Turret &turret) {
_turret = &turret;
return *this;
}
SerialStream &SerialStream::unbind() {
_turret = nullptr;
return *this;
}
SerialStream &SerialStream::loop() {
if (_serial == nullptr) return *this;
if (_serial->available() == 0) return *this;
_serial->read();
return *this;
}