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.
31 lines
546 B
C++
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;
|
|
}
|