Prusa MINI Firmware overview
marlin_events.h
Go to the documentation of this file.
1 // marlin_events.h
2 #ifndef _MARLIN_EVENTS_H
3 #define _MARLIN_EVENTS_H
4 
5 #include "variant8.h"
6 
7 // Marlin events - UIAPI
8 #define MARLIN_EVT_Startup 0x00 // onStartup()
9 #define MARLIN_EVT_Idle 0x01 // onIdle()
10 #define MARLIN_EVT_PrinterKilled 0x02 // onPrinterKilled(PGM_P const msg)
11 #define MARLIN_EVT_MediaInserted 0x03 // onMediaInserted();
12 #define MARLIN_EVT_MediaError 0x04 // onMediaError();
13 #define MARLIN_EVT_MediaRemoved 0x05 // onMediaRemoved();
14 #define MARLIN_EVT_PlayTone 0x06 // onPlayTone(const uint16_t frequency, const uint16_t duration)
15 #define MARLIN_EVT_PrintTimerStarted 0x07 // onPrintTimerStarted()
16 #define MARLIN_EVT_PrintTimerPaused 0x08 // onPrintTimerPaused()
17 #define MARLIN_EVT_PrintTimerStopped 0x09 // onPrintTimerStopped()
18 #define MARLIN_EVT_FilamentRunout 0x0a // onFilamentRunout()
19 #define MARLIN_EVT_UserConfirmRequired 0x0b // onUserConfirmRequired(const char * const msg)
20 #define MARLIN_EVT_StatusChanged 0x0c // onStatusChanged(const char * const msg)
21 #define MARLIN_EVT_FactoryReset 0x0d // onFactoryReset()
22 #define MARLIN_EVT_LoadSettings 0x0e // onLoadSettings()
23 #define MARLIN_EVT_StoreSettings 0x0f // onStoreSettings()
24 #define MARLIN_EVT_MeshUpdate 0x10 // onMeshUpdate(const uint8_t xpos, const uint8_t ypos, const float zval)
25 // Marlin events - host actions
26 #define MARLIN_EVT_HostPrompt 0x11 // host_action_prompt
27 // Marlin events - other
28 #define MARLIN_EVT_StartProcessing 0x12 // sent from marlin_server_start_processing
29 #define MARLIN_EVT_StopProcessing 0x13 // sent from marlin_server_stop_processing
30 #define MARLIN_EVT_Busy 0x14 // sent from marlin_server_idle
31 #define MARLIN_EVT_Ready 0x15 // sent from marlin_server_loop
32 #define MARLIN_EVT_Error 0x16 // sent onStatusChanged etc.
33 #define MARLIN_EVT_CommandBegin 0x17 //
34 #define MARLIN_EVT_CommandEnd 0x18 //
35 #define MARLIN_EVT_SafetyTimerExpired 0x19 // host action from marlin, hotends and bed turned off
36 #define MARLIN_EVT_Message 0x1a //
37 #define MARLIN_EVT_Reheat 0x1b //
38 #define MARLIN_EVT_Acknowledge 0x1c // onAcknowledge - lowest priority
39 #define MARLIN_EVT_MAX MARLIN_EVT_Acknowledge
40 
41 // event masks
42 #define MARLIN_EVT_MSK(e_id) ((uint64_t)1 << (e_id))
43 #define MARLIN_EVT_MSK_DEF ( \
44  MARLIN_EVT_MSK(MARLIN_EVT_Startup) | MARLIN_EVT_MSK(MARLIN_EVT_MediaInserted) | MARLIN_EVT_MSK(MARLIN_EVT_MediaError) | MARLIN_EVT_MSK(MARLIN_EVT_MediaRemoved) | MARLIN_EVT_MSK(MARLIN_EVT_PlayTone) | MARLIN_EVT_MSK(MARLIN_EVT_PrintTimerStarted) | MARLIN_EVT_MSK(MARLIN_EVT_PrintTimerPaused) | MARLIN_EVT_MSK(MARLIN_EVT_PrintTimerStopped) | MARLIN_EVT_MSK(MARLIN_EVT_FilamentRunout) | MARLIN_EVT_MSK(MARLIN_EVT_UserConfirmRequired) | MARLIN_EVT_MSK(MARLIN_EVT_StatusChanged) | MARLIN_EVT_MSK(MARLIN_EVT_FactoryReset) | MARLIN_EVT_MSK(MARLIN_EVT_LoadSettings) | MARLIN_EVT_MSK(MARLIN_EVT_StoreSettings) | MARLIN_EVT_MSK(MARLIN_EVT_MeshUpdate) | MARLIN_EVT_MSK(MARLIN_EVT_HostPrompt) | MARLIN_EVT_MSK(MARLIN_EVT_StartProcessing) | MARLIN_EVT_MSK(MARLIN_EVT_StopProcessing) | MARLIN_EVT_MSK(MARLIN_EVT_Busy) | MARLIN_EVT_MSK(MARLIN_EVT_Ready) | MARLIN_EVT_MSK(MARLIN_EVT_Error) | MARLIN_EVT_MSK(MARLIN_EVT_CommandBegin) | MARLIN_EVT_MSK(MARLIN_EVT_CommandEnd) | MARLIN_EVT_MSK(MARLIN_EVT_SafetyTimerExpired) | MARLIN_EVT_MSK(MARLIN_EVT_Message) | MARLIN_EVT_MSK(MARLIN_EVT_Reheat) | MARLIN_EVT_MSK(MARLIN_EVT_Acknowledge))
45 
46 #define MARLIN_EVT_MSK_ALL ( \
47  MARLIN_EVT_MSK(MARLIN_EVT_Startup) | MARLIN_EVT_MSK(MARLIN_EVT_Idle) | MARLIN_EVT_MSK(MARLIN_EVT_PrinterKilled) | MARLIN_EVT_MSK(MARLIN_EVT_MediaInserted) | MARLIN_EVT_MSK(MARLIN_EVT_MediaError) | MARLIN_EVT_MSK(MARLIN_EVT_MediaRemoved) | MARLIN_EVT_MSK(MARLIN_EVT_PlayTone) | MARLIN_EVT_MSK(MARLIN_EVT_PrintTimerStarted) | MARLIN_EVT_MSK(MARLIN_EVT_PrintTimerPaused) | MARLIN_EVT_MSK(MARLIN_EVT_PrintTimerStopped) | MARLIN_EVT_MSK(MARLIN_EVT_FilamentRunout) | MARLIN_EVT_MSK(MARLIN_EVT_UserConfirmRequired) | MARLIN_EVT_MSK(MARLIN_EVT_StatusChanged) | MARLIN_EVT_MSK(MARLIN_EVT_FactoryReset) | MARLIN_EVT_MSK(MARLIN_EVT_LoadSettings) | MARLIN_EVT_MSK(MARLIN_EVT_StoreSettings) | MARLIN_EVT_MSK(MARLIN_EVT_MeshUpdate) | MARLIN_EVT_MSK(MARLIN_EVT_HostPrompt) | MARLIN_EVT_MSK(MARLIN_EVT_StartProcessing) | MARLIN_EVT_MSK(MARLIN_EVT_StopProcessing) | MARLIN_EVT_MSK(MARLIN_EVT_Busy) | MARLIN_EVT_MSK(MARLIN_EVT_Ready) | MARLIN_EVT_MSK(MARLIN_EVT_Error) | MARLIN_EVT_MSK(MARLIN_EVT_CommandBegin) | MARLIN_EVT_MSK(MARLIN_EVT_CommandEnd) | MARLIN_EVT_MSK(MARLIN_EVT_SafetyTimerExpired) | MARLIN_EVT_MSK(MARLIN_EVT_Message) | MARLIN_EVT_MSK(MARLIN_EVT_Reheat) | MARLIN_EVT_MSK(MARLIN_EVT_Acknowledge))
48 
49 // commands
50 #define MARLIN_CMD_NONE 0
51 #define MARLIN_CMD_G (((uint32_t)'G') << 16)
52 #define MARLIN_CMD_M (((uint32_t)'M') << 16)
53 #define MARLIN_CMD_G28 (MARLIN_CMD_G + 28)
54 #define MARLIN_CMD_G29 (MARLIN_CMD_G + 29)
55 #define MARLIN_CMD_M109 (MARLIN_CMD_M + 109)
56 #define MARLIN_CMD_M190 (MARLIN_CMD_M + 190)
57 #define MARLIN_CMD_M600 (MARLIN_CMD_M + 600)
58 #define MARLIN_CMD_M701 (MARLIN_CMD_M + 701)
59 #define MARLIN_CMD_M702 (MARLIN_CMD_M + 702)
60 
61 #define MARLIN_MAX_MESH_POINTS (4 * 4)
62 
63 #pragma pack(push)
64 #pragma pack(1)
65 
66 typedef union _marlin_events_t {
67  uint64_t evt;
68  struct
69  {
98  uint64_t evt_reserved : 38;
99  };
101 
102 typedef struct _marlin_mesh_t {
106 } marlin_mesh_t;
107 
108 #pragma pack(pop)
109 
110 #ifdef __cplusplus
111 extern "C" {
112 #endif //__cplusplus
113 
114 extern const char *marlin_events_get_name(uint8_t evt_id);
115 
116 #ifdef __cplusplus
117 }
118 #endif //__cplusplus
119 
120 #endif //_MARLIN_EVENTS_H
_marlin_events_t::evt_StopProcessing
uint8_t evt_StopProcessing
Definition: marlin_events.h:89
marlin_events_t
union _marlin_events_t marlin_events_t
_marlin_events_t
Definition: marlin_events.h:66
_marlin_events_t::evt_Acknowledge
uint8_t evt_Acknowledge
Definition: marlin_events.h:97
_marlin_events_t::evt_LoadSettings
uint8_t evt_LoadSettings
Definition: marlin_events.h:84
_marlin_mesh_t
Definition: marlin_events.h:102
marlin_events_get_name
const char * marlin_events_get_name(uint8_t evt_id)
Definition: marlin_events.c:40
_marlin_events_t::evt_reserved
uint64_t evt_reserved
Definition: marlin_events.h:98
_marlin_mesh_t::xc
uint8_t xc
Definition: marlin_events.h:104
_marlin_events_t::evt_PrintTimerStarted
uint8_t evt_PrintTimerStarted
Definition: marlin_events.h:77
_marlin_events_t::evt_Error
uint8_t evt_Error
Definition: marlin_events.h:92
_marlin_events_t::evt_UserConfirmRequired
uint8_t evt_UserConfirmRequired
Definition: marlin_events.h:81
_marlin_events_t::evt_SafetyTimerExpired
uint8_t evt_SafetyTimerExpired
Definition: marlin_events.h:95
__evt_name
const char * __evt_name[]
Definition: marlin_events.c:7
marlin_events.h
_marlin_events_t::evt_StatusChanged
uint8_t evt_StatusChanged
Definition: marlin_events.h:82
_marlin_events_t::evt_CommandBegin
uint8_t evt_CommandBegin
Definition: marlin_events.h:93
_marlin_events_t::evt_Ready
uint8_t evt_Ready
Definition: marlin_events.h:91
variant8.h
_marlin_events_t::evt_MediaInserted
uint8_t evt_MediaInserted
Definition: marlin_events.h:73
_marlin_events_t::evt
uint64_t evt
Definition: marlin_events.h:67
_marlin_events_t::evt_MediaError
uint8_t evt_MediaError
Definition: marlin_events.h:74
_marlin_events_t::evt_Busy
uint8_t evt_Busy
Definition: marlin_events.h:90
_marlin_events_t::evt_Message
uint8_t evt_Message
Definition: marlin_events.h:96
_marlin_events_t::evt_PrintTimerStopped
uint8_t evt_PrintTimerStopped
Definition: marlin_events.h:79
uint8_t
const uint8_t[]
Definition: 404_html.c:3
_marlin_mesh_t::z
float z[MARLIN_MAX_MESH_POINTS]
Definition: marlin_events.h:103
_marlin_events_t::evt_PlayTone
uint8_t evt_PlayTone
Definition: marlin_events.h:76
_marlin_events_t::evt_FilamentRunout
uint8_t evt_FilamentRunout
Definition: marlin_events.h:80
marlin_events_get_name
const char * marlin_events_get_name(uint8_t evt_id)
Definition: marlin_events.c:40
_marlin_events_t::evt_PrintTimerPaused
uint8_t evt_PrintTimerPaused
Definition: marlin_events.h:78
_marlin_events_t::evt_Startup
uint8_t evt_Startup
Definition: marlin_events.h:70
_marlin_events_t::evt_MediaRemoved
uint8_t evt_MediaRemoved
Definition: marlin_events.h:75
_marlin_events_t::evt_FactoryReset
uint8_t evt_FactoryReset
Definition: marlin_events.h:83
_marlin_mesh_t::yc
uint8_t yc
Definition: marlin_events.h:105
_marlin_events_t::evt_HostPrompt
uint8_t evt_HostPrompt
Definition: marlin_events.h:87
_marlin_events_t::evt_PrinterKilled
uint8_t evt_PrinterKilled
Definition: marlin_events.h:72
marlin_mesh_t
struct _marlin_mesh_t marlin_mesh_t
_marlin_events_t::evt_CommandEnd
uint8_t evt_CommandEnd
Definition: marlin_events.h:94
MARLIN_MAX_MESH_POINTS
#define MARLIN_MAX_MESH_POINTS
Definition: marlin_events.h:61
MARLIN_EVT_MAX
#define MARLIN_EVT_MAX
Definition: marlin_events.h:39
_marlin_events_t::evt_MeshUpdate
uint8_t evt_MeshUpdate
Definition: marlin_events.h:86
_marlin_events_t::evt_Idle
uint8_t evt_Idle
Definition: marlin_events.h:71
_marlin_events_t::evt_StartProcessing
uint8_t evt_StartProcessing
Definition: marlin_events.h:88
_marlin_events_t::evt_StoreSettings
uint8_t evt_StoreSettings
Definition: marlin_events.h:85