Prusa-MMU-Private
PrusaMultiMaterialUpgradev3firmwareforMK3SMK4
permanent_storage.h
Go to the documentation of this file.
1 #pragma once
3 #include "../hal/eeprom.h"
4 #include "../config/axis.h"
5 
6 namespace modules {
7 
12 namespace permanent_storage {
13 
15 void Init();
16 
18 void EraseAll();
19 
28 class BowdenLength {
29 public:
31  static uint16_t Get();
32 
34  static void Set(uint16_t mm);
35 };
36 
66 public:
67  static bool get(uint8_t &filament);
68  static bool set(uint8_t filament);
69 
70 private:
71  enum Key {
72  KeyFront1,
73  KeyReverse1,
74  KeyFront2,
75  KeyReverse2,
76  BehindLastKey,
77  };
78  static_assert(BehindLastKey - 1 <= 0xf, "Key doesn't fit into a nibble.");
79  static uint8_t getStatus();
80  static bool setStatus(uint8_t status);
81  static int16_t getIndex();
82  static void getNext(uint8_t &status, int16_t &index);
83  static void getNext(uint8_t &status);
84 };
85 
89 class DriveError {
90 public:
91  static uint16_t get();
92  static void increment();
93 
94 private:
95  static uint8_t getL();
96  static void setL(uint8_t lowByte);
97  static uint8_t getH();
98  static void setH(uint8_t highByte);
99 };
100 
103 public:
104  static uint8_t get(config::Axis axis, uint8_t defaultValue);
105  static void set(config::Axis axis, uint8_t val);
106 };
107 
108 } // namespace permanent_storage
109 } // namespace modules
110 
111 namespace mps = modules::permanent_storage;
Axis TMC persistent setup.
Definition: permanent_storage.h:102
Read and store bowden length.
Definition: permanent_storage.h:28
static uint16_t Get()
Definition: permanent_storage.cpp:79
static void Set(uint16_t mm)
Sets.
Definition: permanent_storage.cpp:84
Read and increment drive errors.
Definition: permanent_storage.h:89
Read and store last filament loaded to nozzle.
Definition: permanent_storage.h:65
static bool get(uint8_t &filament)
Get last filament loaded.
Definition: permanent_storage.cpp:161
static bool set(uint8_t filament)
Set filament being loaded.
Definition: permanent_storage.cpp:190
Axis
List of available axes.
Definition: axis.h:35
Definition: command_base.h:9
The permanent_storage namespace provides all necessary facilities related to permanently storing data...
Definition: permanent_storage.cpp:11
void EraseAll()
Erase the whole EEPROM.
Definition: permanent_storage.cpp:63
void Init()
Initialization of the permanent storage hive.
Definition: permanent_storage.cpp:57
The modules namespace contains models of MMU's components.
Definition: command_base.h:8