Add stealtMode flag into the global storage hive
May be used elsewhere to return to the desired motors' mode e.g. after homing (which requires switching to normal mode)pull/114/head
parent
1e6194a9b9
commit
852ca37e8f
|
|
@ -272,6 +272,9 @@ void PlanCommand(const mp::RequestMsg &rq) {
|
|||
}
|
||||
|
||||
void SetMode(uint8_t m) {
|
||||
mg::globals.SetMotorsMode(m != 0); // remember the last mode set
|
||||
|
||||
// distribute the mode to all motors immediately
|
||||
mm::MotorMode mode = (m == 0) ? mm::Normal : mm::Stealth;
|
||||
mm::motion.SetMode(mm::Pulley, mode);
|
||||
mm::motion.SetMode(mm::Selector, mode);
|
||||
|
|
|
|||
|
|
@ -36,5 +36,10 @@ void Globals::IncDriveErrors() {
|
|||
mps::DriveError::increment();
|
||||
}
|
||||
|
||||
void Globals::SetMotorsMode(bool stealth) {
|
||||
stealthMode = stealth;
|
||||
// @@TODO store into EEPROM
|
||||
}
|
||||
|
||||
} // namespace globals
|
||||
} // namespace modules
|
||||
|
|
|
|||
|
|
@ -40,9 +40,19 @@ public:
|
|||
/// Increment MMU errors by 1
|
||||
void IncDriveErrors();
|
||||
|
||||
/// Set normal or stealth mode for all of the motors
|
||||
/// Used to keep track of the last set mode to be able to return to it properly
|
||||
/// after homing sequences and/or after restarting the MMU
|
||||
/// @param stealth true means use stealth mode, false means use normal mode
|
||||
void SetMotorsMode(bool stealth);
|
||||
|
||||
/// @returns true if the motors are to be operated in stealth mode
|
||||
bool MotorsStealth() const { return stealthMode; }
|
||||
|
||||
private:
|
||||
uint8_t activeSlot;
|
||||
bool filamentLoaded;
|
||||
bool stealthMode;
|
||||
};
|
||||
|
||||
/// The one and only instance of global state variables
|
||||
|
|
|
|||
Loading…
Reference in New Issue