Prusa3d Marlin fork
mmu2_reporting.h
Go to the documentation of this file.
1 
3 #pragma once
4 #include <stdint.h>
5 #ifdef __AVR__
6  #include "mmu2/error_codes.h"
7  #include "mmu2/progress_codes.h"
8 #else
9  #include "../../../../../../Prusa-Firmware-MMU/src/logic/error_codes.h"
10  #include "../../../../../../Prusa-Firmware-MMU/src/logic/progress_codes.h"
11 #endif
12 
13 namespace MMU2 {
14 
15 enum CommandInProgress : uint8_t {
16  NoCommand = 0,
17  CutFilament = 'K',
18  EjectFilament = 'E',
19  Homing = 'H',
20  LoadFilament = 'L',
21  Reset = 'X',
22  ToolChange = 'T',
23  UnloadFilament = 'U',
24 };
25 
27 void BeginReport(CommandInProgress cip, ProgressCode ec);
28 
30 void EndReport(CommandInProgress cip, ProgressCode ec);
31 
34 
38 bool TuneMenuEntered();
39 
45 void ReportErrorHook(CommandInProgress cip, ErrorCode ec, uint8_t es);
46 
48 void ReportProgressHook(CommandInProgress cip, ProgressCode ec);
49 
51  TryLoadUnloadReporter(float delta_mm);
53  void Progress(bool sensorState);
54  void DumpToSerial();
55 
56 private:
60  void Render(uint8_t col, bool sensorState);
61 
62  uint8_t dpixel0;
63  uint8_t dpixel1;
64  uint8_t lcd_cursor_col;
65  // The total length is twice delta_mm. Divide that length by number of pixels
66  // available to get length per pixel.
67  // Note: Below is the reciprocal of (2 * delta_mm) / LCD_WIDTH [mm/pixel]
68  float pixel_per_mm;
69 };
70 
73 
76 
79 bool MMUAvailable();
80 
82 bool UseMMU();
83 
86 
89 void IncrementLoadFails();
90 
92 void IncrementMMUFails();
93 
95 bool cutter_enabled();
96 
97 // Beware: enum values intentionally chosen to match the 8bit FW to save code size
98 enum SoundType {
99  Prompt = 2,
100  Confirm = 3
101 };
102 
103 void MakeSound(SoundType s);
104 
105 void FullScreenMsgCut(uint8_t slot);
106 void FullScreenMsgEject(uint8_t slot);
107 void FullScreenMsgTest(uint8_t slot);
108 void FullScreenMsgLoad(uint8_t slot);
109 void FullScreenMsgRestoringTemperature();
110 
111 void ScreenUpdateEnable();
112 void ScreenClear();
113 
114 void tuneIdlerStallguardThreshold();
115 
116 } // namespace MMU2
New MMU2 protocol logic.
Definition: mmu2.cpp:26
bool TuneMenuEntered()
Definition: mmu2_reporting.cpp:233
bool UseMMU()
Global Enable/Disable use MMU (to be stored in EEPROM)
void ReportErrorHookDynamicRender(void)
Renders any characters that will be updated live on the MMU error screen. Currently,...
Definition: mmu2_reporting.cpp:36
void IncrementLoadFails()
Definition: mmu2_reporting.cpp:353
void ReportErrorHookSensorLineRender()
Renders the static part of the sensor state line. Also used by "resuming temperature screen".
Definition: mmu2_reporting.cpp:87
void DisableMMUInSettings()
Disables MMU in EEPROM.
Definition: mmu2_reporting.cpp:348
void IncrementMMUFails()
Increments EEPROM cell - number of MMU errors.
Definition: mmu2_reporting.cpp:358
bool MMUAvailable()
void CheckErrorScreenUserInput()
Checks for error screen user input, if the error screen is open.
Definition: mmu2_reporting.cpp:225
void ReportProgressHook(CommandInProgress cip, ProgressCode ec)
Called when the MMU sends operation progress update.
Definition: mmu2_reporting.cpp:296
void BeginReport(CommandInProgress, ProgressCode ec)
Called at the begin of every MMU operation.
Definition: mmu2_reporting.cpp:19
bool cutter_enabled()
Definition: mmu2_reporting.cpp:363
void ReportErrorHook(CommandInProgress, ErrorCode ec, uint8_t)
Called when the MMU or MK3S sends operation error (even repeatedly). Render MMU error screen on the L...
Definition: mmu2_reporting.cpp:237
void EndReport(CommandInProgress, ProgressCode)
Called at the end of every MMU operation.
Definition: mmu2_reporting.cpp:24
Definition: mmu2_reporting.h:50