Prusa-Firmware-MMU/src/logic/tool_change.h

36 lines
1018 B
C++

#pragma once
#include <stdint.h>
#include "command_base.h"
#include "unload_filament.h"
#include "load_filament.h"
namespace logic {
/// @brief A high-level command state machine - handles the complex logic of tool change - which is basically a chain of an Unload and a Load operation.
class ToolChange : public CommandBase {
public:
inline ToolChange()
: CommandBase() {}
/// Restart the automaton
/// @param param index of filament slot to change to - i.e. to load
void Reset(uint8_t param) override;
/// @returns true if the state machine finished its job, false otherwise
bool Step() override;
ProgressCode State() const override;
ErrorCode Error() const override;
private:
UnloadFilament unl; ///< a high-level command/operation may be used as a building block of other operations as well
LoadFilament load;
uint8_t plannedSlot;
};
/// The one and only instance of ToolChange state machine in the FW
extern ToolChange toolChange;
} // namespace logic