Add support for M0/M1 messages

... route the messages into modules::motion's SetMode of all axes.
pull/114/head
D.R.racer 2021-08-31 07:51:28 +02:00 committed by DRracer
parent 315530ec16
commit 1e6194a9b9
1 changed files with 8 additions and 1 deletions

View File

@ -271,6 +271,13 @@ void PlanCommand(const mp::RequestMsg &rq) {
}
}
void SetMode(uint8_t m) {
mm::MotorMode mode = (m == 0) ? mm::Normal : mm::Stealth;
mm::motion.SetMode(mm::Pulley, mode);
mm::motion.SetMode(mm::Selector, mode);
mm::motion.SetMode(mm::Idler, mode);
}
void ProcessRequestMsg(const mp::RequestMsg &rq) {
switch (rq.code) {
case mp::RequestMsgCodes::Button:
@ -283,7 +290,7 @@ void ProcessRequestMsg(const mp::RequestMsg &rq) {
break;
case mp::RequestMsgCodes::Mode:
// immediately switch to normal/stealth as requested
// modules::motion::SetMode();
SetMode(rq.value);
break;
case mp::RequestMsgCodes::Query:
// immediately report progress of currently running command