Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
hw_sanity.h
Go to the documentation of this file.
1 #pragma once
3 #include <stdint.h>
4 #include "command_base.h"
5 #include "../config/axis.h"
6 #include "../modules/leds.h"
7 
8 namespace logic {
9 
14 
15 class HWSanity : public CommandBase {
16 public:
17  inline constexpr HWSanity()
18  : CommandBase() {}
19 
21  bool Reset(uint8_t param) override;
22 
37  bool StepInner() override;
38 
39 private:
40  // Shared code fault display setup for each axis/slot
41  static void SetFaultDisplay(uint8_t slot, uint8_t mask);
42 
43  // Prepares an axis for testing by initializing it and turning off the output.
44  static void PrepareAxis(config::Axis axis);
45 
46  uint8_t test_step = 0;
47  config::Axis axis = config::Axis::Pulley;
48  uint8_t fault_masks[3] = { 0 };
49  ProgressCode next_state = ProgressCode::HWTestBegin;
50  uint16_t wait_start = 0;
51  ml::Mode das_blinken_state = ml::off;
52 };
53 
55 extern HWSanity hwSanity;
56 
57 } // namespace logic
Base class defining common API for high-level operations/commands/state machines.
Definition: command_base.h:29
Performs a sanity check of the hardware at reset/boot. Checks the following:
Definition: hw_sanity.h:15
bool StepInner() override
Definition: hw_sanity.cpp:64
bool Reset(uint8_t param) override
Restart the automaton.
Definition: hw_sanity.cpp:27
Axis
List of available axes.
Definition: axis.h:35
The logic namespace handles the application logic on top of the modules.
Definition: application.h:8
HWSanity hwSanity
The one and only instance of hwSanity state machine in the FW.
Definition: hw_sanity.cpp:23
Mode
Definition: leds.h:23
ProgressCode
Definition: progress_codes.h:11