Extract common ErrDisengagingIdler state's implementation
parent
6426295e32
commit
e0d1fe3b73
|
|
@ -3,6 +3,7 @@
|
||||||
#include "../modules/selector.h"
|
#include "../modules/selector.h"
|
||||||
#include "../modules/motion.h"
|
#include "../modules/motion.h"
|
||||||
#include "../modules/leds.h"
|
#include "../modules/leds.h"
|
||||||
|
#include "../modules/user_input.h"
|
||||||
|
|
||||||
namespace logic {
|
namespace logic {
|
||||||
|
|
||||||
|
|
@ -96,4 +97,11 @@ bool CommandBase::CheckToolIndex(uint8_t index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CommandBase::ErrDisengagingIdler() {
|
||||||
|
if (!mi::idler.Engaged()) {
|
||||||
|
state = ProgressCode::ERRWaitingForUser;
|
||||||
|
mui::userInput.Clear(); // remove all buffered events if any just before we wait for some input
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace logic
|
} // namespace logic
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,9 @@ protected:
|
||||||
/// If not, it returns false and sets the error to ErrorCode::INVALID_TOOL
|
/// If not, it returns false and sets the error to ErrorCode::INVALID_TOOL
|
||||||
bool CheckToolIndex(uint8_t index);
|
bool CheckToolIndex(uint8_t index);
|
||||||
|
|
||||||
|
/// Common error processing - disengaging idler
|
||||||
|
void ErrDisengagingIdler();
|
||||||
|
|
||||||
ProgressCode state; ///< current progress state of the state machine
|
ProgressCode state; ///< current progress state of the state machine
|
||||||
ErrorCode error; ///< current error code
|
ErrorCode error; ///< current error code
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue