feat: shuffle mode
This commit is contained in:
@@ -3,13 +3,14 @@
|
||||
#include "stepperDrv.hpp"
|
||||
#include "stepperMotor.hpp"
|
||||
#include <cmath>
|
||||
#include "syslog.hpp"
|
||||
|
||||
class WatchMotor {
|
||||
static constexpr uint8_t Positions = 6;
|
||||
|
||||
public:
|
||||
using AllmostFinishedCb = void (*)(uint8_t newIdx);
|
||||
WatchMotor(IStepperMotor &stepper, AllmostFinishedCb onDone)
|
||||
using AlmostFinishedCb = void (*)(uint8_t newIdx);
|
||||
WatchMotor(IStepperMotor &stepper, AlmostFinishedCb onDone)
|
||||
: _stepper(stepper),
|
||||
_onFinCb(onDone) {
|
||||
}
|
||||
@@ -44,7 +45,12 @@ class WatchMotor {
|
||||
|
||||
ESP_LOGD("MV", "Moving to %d by %.2f + %.2f", sign, delta, corr);
|
||||
|
||||
_stepper.moveBy(delta + corr, profile, accel, speed, [&]() {
|
||||
_stepper.moveBy(delta + corr, profile, accel, speed, [&](int diff) {
|
||||
Syslog::logv(Syslog::Severity::Debug,"Almost done with head=%i",diff);
|
||||
if (diff < 6) {
|
||||
Syslog::logv(Syslog::Severity::Warning,"Low headroom in Profile pipeline=%i",diff);
|
||||
}
|
||||
|
||||
if (_onFinCb) {
|
||||
_onFinCb(position);
|
||||
}
|
||||
@@ -58,5 +64,5 @@ class WatchMotor {
|
||||
private:
|
||||
IStepperMotor &_stepper;
|
||||
uint8_t _currentIndex{};
|
||||
AllmostFinishedCb _onFinCb{};
|
||||
AlmostFinishedCb _onFinCb{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user