瀏覽代碼

Make enums into implicit char

Scott Lahteine 7 年之前
父節點
當前提交
2057177184

+ 2
- 2
Marlin/src/HAL/HAL_DUE/usb/genclk.h 查看文件

73
 //! \name Programmable Clock Sources (PCK)
73
 //! \name Programmable Clock Sources (PCK)
74
 //@{
74
 //@{
75
 
75
 
76
-enum genclk_source {
76
+enum genclk_source : char {
77
 	GENCLK_PCK_SRC_SLCK_RC       = 0, //!< Internal 32kHz RC oscillator as PCK source clock
77
 	GENCLK_PCK_SRC_SLCK_RC       = 0, //!< Internal 32kHz RC oscillator as PCK source clock
78
 	GENCLK_PCK_SRC_SLCK_XTAL     = 1, //!< External 32kHz crystal oscillator as PCK source clock
78
 	GENCLK_PCK_SRC_SLCK_XTAL     = 1, //!< External 32kHz crystal oscillator as PCK source clock
79
 	GENCLK_PCK_SRC_SLCK_BYPASS   = 2, //!< External 32kHz bypass oscillator as PCK source clock
79
 	GENCLK_PCK_SRC_SLCK_BYPASS   = 2, //!< External 32kHz bypass oscillator as PCK source clock
92
 //! \name Programmable Clock Prescalers (PCK)
92
 //! \name Programmable Clock Prescalers (PCK)
93
 //@{
93
 //@{
94
 
94
 
95
-enum genclk_divider {
95
+enum genclk_divider : char {
96
 	GENCLK_PCK_PRES_1  = PMC_PCK_PRES_CLK_1, //!< Set PCK clock prescaler to 1
96
 	GENCLK_PCK_PRES_1  = PMC_PCK_PRES_CLK_1, //!< Set PCK clock prescaler to 1
97
 	GENCLK_PCK_PRES_2  = PMC_PCK_PRES_CLK_2, //!< Set PCK clock prescaler to 2
97
 	GENCLK_PCK_PRES_2  = PMC_PCK_PRES_CLK_2, //!< Set PCK clock prescaler to 2
98
 	GENCLK_PCK_PRES_4  = PMC_PCK_PRES_CLK_4, //!< Set PCK clock prescaler to 4
98
 	GENCLK_PCK_PRES_4  = PMC_PCK_PRES_CLK_4, //!< Set PCK clock prescaler to 4

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/pll.h 查看文件

76
 
76
 
77
 #define PLL_COUNT           0x3fU
77
 #define PLL_COUNT           0x3fU
78
 
78
 
79
-enum pll_source {
79
+enum pll_source : char {
80
 	PLL_SRC_MAINCK_4M_RC        = OSC_MAINCK_4M_RC,     //!< Internal 4MHz RC oscillator.
80
 	PLL_SRC_MAINCK_4M_RC        = OSC_MAINCK_4M_RC,     //!< Internal 4MHz RC oscillator.
81
 	PLL_SRC_MAINCK_8M_RC        = OSC_MAINCK_8M_RC,     //!< Internal 8MHz RC oscillator.
81
 	PLL_SRC_MAINCK_8M_RC        = OSC_MAINCK_8M_RC,     //!< Internal 8MHz RC oscillator.
82
 	PLL_SRC_MAINCK_12M_RC       = OSC_MAINCK_12M_RC,    //!< Internal 12MHz RC oscillator.
82
 	PLL_SRC_MAINCK_12M_RC       = OSC_MAINCK_12M_RC,    //!< Internal 12MHz RC oscillator.

+ 1
- 1
Marlin/src/HAL/HAL_DUE/usb/sbc_protocol.h 查看文件

80
 //! \name SBC-2 Mode page definitions
80
 //! \name SBC-2 Mode page definitions
81
 //@{
81
 //@{
82
 
82
 
83
-enum scsi_sbc_mode {
83
+enum scsi_sbc_mode : char {
84
 	SCSI_MS_MODE_RW_ERR_RECOV = 0x01,	//!< Read-Write Error Recovery mode page
84
 	SCSI_MS_MODE_RW_ERR_RECOV = 0x01,	//!< Read-Write Error Recovery mode page
85
 	SCSI_MS_MODE_FORMAT_DEVICE = 0x03,	//!< Format Device mode page
85
 	SCSI_MS_MODE_FORMAT_DEVICE = 0x03,	//!< Format Device mode page
86
 	SCSI_MS_MODE_FLEXIBLE_DISK = 0x05,	//!< Flexible Disk mode page
86
 	SCSI_MS_MODE_FLEXIBLE_DISK = 0x05,	//!< Flexible Disk mode page

+ 5
- 5
Marlin/src/HAL/HAL_DUE/usb/spc_protocol.h 查看文件

184
 COMPILER_PACK_RESET()
184
 COMPILER_PACK_RESET()
185
 
185
 
186
 /* Vital Product Data page codes */
186
 /* Vital Product Data page codes */
187
-enum scsi_vpd_page_code {
187
+enum scsi_vpd_page_code : char {
188
 	SCSI_VPD_SUPPORTED_PAGES = 0x00,
188
 	SCSI_VPD_SUPPORTED_PAGES = 0x00,
189
 	SCSI_VPD_UNIT_SERIAL_NUMBER = 0x80,
189
 	SCSI_VPD_UNIT_SERIAL_NUMBER = 0x80,
190
 	SCSI_VPD_DEVICE_IDENTIFICATION = 0x83,
190
 	SCSI_VPD_DEVICE_IDENTIFICATION = 0x83,
202
 
202
 
203
 
203
 
204
 /* Sense keys */
204
 /* Sense keys */
205
-enum scsi_sense_key {
205
+enum scsi_sense_key : char {
206
 	SCSI_SK_NO_SENSE = 0x0,
206
 	SCSI_SK_NO_SENSE = 0x0,
207
 	SCSI_SK_RECOVERED_ERROR = 0x1,
207
 	SCSI_SK_RECOVERED_ERROR = 0x1,
208
 	SCSI_SK_NOT_READY = 0x2,
208
 	SCSI_SK_NOT_READY = 0x2,
220
 };
220
 };
221
 
221
 
222
 /* Additional Sense Code / Additional Sense Code Qualifier pairs */
222
 /* Additional Sense Code / Additional Sense Code Qualifier pairs */
223
-enum scsi_asc_ascq {
223
+enum scsi_asc_ascq : char {
224
 	SCSI_ASC_NO_ADDITIONAL_SENSE_INFO = 0x0000,
224
 	SCSI_ASC_NO_ADDITIONAL_SENSE_INFO = 0x0000,
225
 	SCSI_ASC_LU_NOT_READY_REBUILD_IN_PROGRESS = 0x0405,
225
 	SCSI_ASC_LU_NOT_READY_REBUILD_IN_PROGRESS = 0x0405,
226
 	SCSI_ASC_WRITE_ERROR = 0x0c00,
226
 	SCSI_ASC_WRITE_ERROR = 0x0c00,
239
  * used with MODE SELECT and MODE SENSE commands
239
  * used with MODE SELECT and MODE SENSE commands
240
  * that are applicable to all SCSI devices.
240
  * that are applicable to all SCSI devices.
241
  */
241
  */
242
-enum scsi_spc_mode {
242
+enum scsi_spc_mode : char {
243
 	SCSI_MS_MODE_VENDOR_SPEC = 0x00,
243
 	SCSI_MS_MODE_VENDOR_SPEC = 0x00,
244
 	SCSI_MS_MODE_INFEXP = 0x1C,    // Informational exceptions control page
244
 	SCSI_MS_MODE_INFEXP = 0x1C,    // Informational exceptions control page
245
 	SCSI_MS_MODE_ALL = 0x3f,
245
 	SCSI_MS_MODE_ALL = 0x3f,
273
 };
273
 };
274
 
274
 
275
 
275
 
276
-enum scsi_spc_mode_sense_pc {
276
+enum scsi_spc_mode_sense_pc : char {
277
 	SCSI_MS_SENSE_PC_CURRENT = 0,
277
 	SCSI_MS_SENSE_PC_CURRENT = 0,
278
 	SCSI_MS_SENSE_PC_CHANGEABLE = 1,
278
 	SCSI_MS_SENSE_PC_CHANGEABLE = 1,
279
 	SCSI_MS_SENSE_PC_DEFAULT = 2,
279
 	SCSI_MS_SENSE_PC_DEFAULT = 2,

+ 13
- 13
Marlin/src/HAL/HAL_DUE/usb/usb_protocol.h 查看文件

107
 /**
107
 /**
108
  * \brief Standard USB requests (bRequest)
108
  * \brief Standard USB requests (bRequest)
109
  */
109
  */
110
-enum usb_reqid {
110
+enum usb_reqid : char {
111
 	USB_REQ_GET_STATUS = 0,
111
 	USB_REQ_GET_STATUS = 0,
112
 	USB_REQ_CLEAR_FEATURE = 1,
112
 	USB_REQ_CLEAR_FEATURE = 1,
113
 	USB_REQ_SET_FEATURE = 3,
113
 	USB_REQ_SET_FEATURE = 3,
125
  * \brief Standard USB device status flags
125
  * \brief Standard USB device status flags
126
  *
126
  *
127
  */
127
  */
128
-enum usb_device_status {
128
+enum usb_device_status : char {
129
 	USB_DEV_STATUS_BUS_POWERED = 0,
129
 	USB_DEV_STATUS_BUS_POWERED = 0,
130
 	USB_DEV_STATUS_SELF_POWERED = 1,
130
 	USB_DEV_STATUS_SELF_POWERED = 1,
131
 	USB_DEV_STATUS_REMOTEWAKEUP = 2
131
 	USB_DEV_STATUS_REMOTEWAKEUP = 2
135
  * \brief Standard USB Interface status flags
135
  * \brief Standard USB Interface status flags
136
  *
136
  *
137
  */
137
  */
138
-enum usb_interface_status {
138
+enum usb_interface_status : char {
139
 	USB_IFACE_STATUS_RESERVED = 0
139
 	USB_IFACE_STATUS_RESERVED = 0
140
 };
140
 };
141
 
141
 
143
  * \brief Standard USB endpoint status flags
143
  * \brief Standard USB endpoint status flags
144
  *
144
  *
145
  */
145
  */
146
-enum usb_endpoint_status {
146
+enum usb_endpoint_status : char {
147
 	USB_EP_STATUS_HALTED = 1,
147
 	USB_EP_STATUS_HALTED = 1,
148
 };
148
 };
149
 
149
 
152
  *
152
  *
153
  * \note valid for SetFeature request.
153
  * \note valid for SetFeature request.
154
  */
154
  */
155
-enum usb_device_feature {
155
+enum usb_device_feature : char {
156
 	USB_DEV_FEATURE_REMOTE_WAKEUP = 1, //!< Remote wakeup enabled
156
 	USB_DEV_FEATURE_REMOTE_WAKEUP = 1, //!< Remote wakeup enabled
157
 	USB_DEV_FEATURE_TEST_MODE = 2,     //!< USB test mode
157
 	USB_DEV_FEATURE_TEST_MODE = 2,     //!< USB test mode
158
 	USB_DEV_FEATURE_OTG_B_HNP_ENABLE = 3,
158
 	USB_DEV_FEATURE_OTG_B_HNP_ENABLE = 3,
165
  *
165
  *
166
  * \note valid for USB_DEV_FEATURE_TEST_MODE request.
166
  * \note valid for USB_DEV_FEATURE_TEST_MODE request.
167
  */
167
  */
168
-enum usb_device_hs_test_mode {
168
+enum usb_device_hs_test_mode : char {
169
 	USB_DEV_TEST_MODE_J = 1,
169
 	USB_DEV_TEST_MODE_J = 1,
170
 	USB_DEV_TEST_MODE_K = 2,
170
 	USB_DEV_TEST_MODE_K = 2,
171
 	USB_DEV_TEST_MODE_SE0_NAK = 3,
171
 	USB_DEV_TEST_MODE_SE0_NAK = 3,
176
 /**
176
 /**
177
  * \brief Standard USB endpoint feature/status flags
177
  * \brief Standard USB endpoint feature/status flags
178
  */
178
  */
179
-enum usb_endpoint_feature {
179
+enum usb_endpoint_feature : char {
180
 	USB_EP_FEATURE_HALT = 0,
180
 	USB_EP_FEATURE_HALT = 0,
181
 };
181
 };
182
 
182
 
183
 /**
183
 /**
184
  * \brief Standard USB Test Mode Selectors
184
  * \brief Standard USB Test Mode Selectors
185
  */
185
  */
186
-enum usb_test_mode_selector {
186
+enum usb_test_mode_selector : char {
187
 	USB_TEST_J = 0x01,
187
 	USB_TEST_J = 0x01,
188
 	USB_TEST_K = 0x02,
188
 	USB_TEST_K = 0x02,
189
 	USB_TEST_SE0_NAK = 0x03,
189
 	USB_TEST_SE0_NAK = 0x03,
194
 /**
194
 /**
195
  * \brief Standard USB descriptor types
195
  * \brief Standard USB descriptor types
196
  */
196
  */
197
-enum usb_descriptor_type {
197
+enum usb_descriptor_type : char {
198
 	USB_DT_DEVICE = 1,
198
 	USB_DT_DEVICE = 1,
199
 	USB_DT_CONFIGURATION = 2,
199
 	USB_DT_CONFIGURATION = 2,
200
 	USB_DT_STRING = 3,
200
 	USB_DT_STRING = 3,
212
 /**
212
 /**
213
  * \brief USB Device Capability types
213
  * \brief USB Device Capability types
214
  */
214
  */
215
-enum usb_capability_type {
215
+enum usb_capability_type : char {
216
 	USB_DC_USB20_EXTENSION = 0x02,
216
 	USB_DC_USB20_EXTENSION = 0x02,
217
 };
217
 };
218
 
218
 
220
  * \brief USB Device Capability - USB 2.0 Extension
220
  * \brief USB Device Capability - USB 2.0 Extension
221
  * To fill bmAttributes field of usb_capa_ext_desc_t structure.
221
  * To fill bmAttributes field of usb_capa_ext_desc_t structure.
222
  */
222
  */
223
-enum usb_capability_extension_attr {
223
+enum usb_capability_extension_attr : char {
224
 	USB_DC_EXT_LPM  = 0x00000002,
224
 	USB_DC_EXT_LPM  = 0x00000002,
225
 };
225
 };
226
 
226
 
253
 /**
253
 /**
254
  * \brief Standard USB endpoint transfer types
254
  * \brief Standard USB endpoint transfer types
255
  */
255
  */
256
-enum usb_ep_type {
256
+enum usb_ep_type : char {
257
 	USB_EP_TYPE_CONTROL = 0x00,
257
 	USB_EP_TYPE_CONTROL = 0x00,
258
 	USB_EP_TYPE_ISOCHRONOUS = 0x01,
258
 	USB_EP_TYPE_ISOCHRONOUS = 0x01,
259
 	USB_EP_TYPE_BULK = 0x02,
259
 	USB_EP_TYPE_BULK = 0x02,
264
 /**
264
 /**
265
  * \brief Standard USB language IDs for string descriptors
265
  * \brief Standard USB language IDs for string descriptors
266
  */
266
  */
267
-enum usb_langid {
267
+enum usb_langid : char {
268
 	USB_LANGID_EN_US = 0x0409, //!< English (United States)
268
 	USB_LANGID_EN_US = 0x0409, //!< English (United States)
269
 };
269
 };
270
 
270
 

+ 2
- 2
Marlin/src/HAL/HAL_DUE/usb/usb_protocol_cdc.h 查看文件

239
 	uint8_t bDataBits;
239
 	uint8_t bDataBits;
240
 } usb_cdc_line_coding_t;
240
 } usb_cdc_line_coding_t;
241
 //! Possible values of bCharFormat
241
 //! Possible values of bCharFormat
242
-enum cdc_char_format {
242
+enum cdc_char_format : char {
243
 	CDC_STOP_BITS_1 = 0,	//!< 1 stop bit
243
 	CDC_STOP_BITS_1 = 0,	//!< 1 stop bit
244
 	CDC_STOP_BITS_1_5 = 1,	//!< 1.5 stop bits
244
 	CDC_STOP_BITS_1_5 = 1,	//!< 1.5 stop bits
245
 	CDC_STOP_BITS_2 = 2,	//!< 2 stop bits
245
 	CDC_STOP_BITS_2 = 2,	//!< 2 stop bits
246
 };
246
 };
247
 //! Possible values of bParityType
247
 //! Possible values of bParityType
248
-enum cdc_parity {
248
+enum cdc_parity : char {
249
 	CDC_PAR_NONE = 0,	//!< No parity
249
 	CDC_PAR_NONE = 0,	//!< No parity
250
 	CDC_PAR_ODD = 1,	//!< Odd parity
250
 	CDC_PAR_ODD = 1,	//!< Odd parity
251
 	CDC_PAR_EVEN = 2,	//!< Even parity
251
 	CDC_PAR_EVEN = 2,	//!< Even parity

+ 2
- 2
Marlin/src/HAL/HAL_DUE/usb/usb_protocol_msc.h 查看文件

93
 /**
93
 /**
94
  * \brief MSC USB requests (bRequest)
94
  * \brief MSC USB requests (bRequest)
95
  */
95
  */
96
-enum usb_reqid_msc {
96
+enum usb_reqid_msc : unsigned char {
97
 	USB_REQ_MSC_BULK_RESET = 0xFF,	//!< Mass Storage Reset
97
 	USB_REQ_MSC_BULK_RESET = 0xFF,	//!< Mass Storage Reset
98
-	USB_REQ_MSC_GET_MAX_LUN = 0xFE,	//!< Get Max LUN
98
+	USB_REQ_MSC_GET_MAX_LUN = 0xFE 	//!< Get Max LUN
99
 };
99
 };
100
 
100
 
101
 
101
 

+ 1
- 1
Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.cpp 查看文件

87
   #endif
87
   #endif
88
 };
88
 };
89
 
89
 
90
-enum TEMP_PINS {
90
+enum TEMP_PINS : char {
91
   #if HAS_TEMP_0
91
   #if HAS_TEMP_0
92
     TEMP_0,
92
     TEMP_0,
93
   #endif
93
   #endif

+ 5
- 5
Marlin/src/core/enum.h 查看文件

31
  *  - X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship
31
  *  - X_HEAD and Y_HEAD is used for systems that don't have a 1:1 relationship
32
  *    between X_AXIS and X Head movement, like CoreXY bots
32
  *    between X_AXIS and X Head movement, like CoreXY bots
33
  */
33
  */
34
-enum AxisEnum {
35
-  NO_AXIS   = -1,
34
+enum AxisEnum : unsigned char {
36
   X_AXIS    = 0,
35
   X_AXIS    = 0,
37
   A_AXIS    = 0,
36
   A_AXIS    = 0,
38
   Y_AXIS    = 1,
37
   Y_AXIS    = 1,
43
   X_HEAD    = 4,
42
   X_HEAD    = 4,
44
   Y_HEAD    = 5,
43
   Y_HEAD    = 5,
45
   Z_HEAD    = 6,
44
   Z_HEAD    = 6,
46
-  ALL_AXES  = 100
45
+  ALL_AXES  = 0xFE,
46
+  NO_AXIS   = 0xFF
47
 };
47
 };
48
 
48
 
49
 #define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=S; VAR<=N; VAR++)
49
 #define LOOP_S_LE_N(VAR, S, N) for (uint8_t VAR=S; VAR<=N; VAR++)
73
 /**
73
 /**
74
  * SD Card
74
  * SD Card
75
  */
75
  */
76
-enum LsAction { LS_SerialPrint, LS_Count, LS_GetFilename };
76
+enum LsAction : char { LS_SerialPrint, LS_Count, LS_GetFilename };
77
 
77
 
78
 /**
78
 /**
79
  * Ultra LCD
79
  * Ultra LCD
80
  */
80
  */
81
-enum LCDViewAction {
81
+enum LCDViewAction : char {
82
   LCDVIEW_NONE,
82
   LCDVIEW_NONE,
83
   LCDVIEW_REDRAW_NOW,
83
   LCDVIEW_REDRAW_NOW,
84
   LCDVIEW_CALL_REDRAW_NEXT,
84
   LCDVIEW_CALL_REDRAW_NEXT,

+ 2
- 2
Marlin/src/core/serial.h 查看文件

32
 /**
32
 /**
33
  * Define debug bit-masks
33
  * Define debug bit-masks
34
  */
34
  */
35
-enum DebugFlags {
35
+enum DebugFlags : unsigned char {
36
   DEBUG_NONE          = 0,
36
   DEBUG_NONE          = 0,
37
   DEBUG_ECHO          = _BV(0), ///< Echo commands in order as they are processed
37
   DEBUG_ECHO          = _BV(0), ///< Echo commands in order as they are processed
38
   DEBUG_INFO          = _BV(1), ///< Print messages for code that has debug output
38
   DEBUG_INFO          = _BV(1), ///< Print messages for code that has debug output
45
 };
45
 };
46
 
46
 
47
 #if ENABLED(EMERGENCY_PARSER)
47
 #if ENABLED(EMERGENCY_PARSER)
48
-  enum e_parser_state {
48
+  enum e_parser_state : char {
49
     state_RESET,
49
     state_RESET,
50
     state_N,
50
     state_N,
51
     state_M,
51
     state_M,

+ 1
- 1
Marlin/src/feature/bedlevel/mbl/mesh_bed_leveling.h 查看文件

25
 
25
 
26
 #include "../../../inc/MarlinConfig.h"
26
 #include "../../../inc/MarlinConfig.h"
27
 
27
 
28
-enum MeshLevelingState {
28
+enum MeshLevelingState : char {
29
   MeshReport,
29
   MeshReport,
30
   MeshStart,
30
   MeshStart,
31
   MeshNext,
31
   MeshNext,

+ 1
- 1
Marlin/src/feature/bedlevel/ubl/ubl.h 查看文件

47
 
47
 
48
 // ubl_G29.cpp
48
 // ubl_G29.cpp
49
 
49
 
50
-enum MeshPointType { INVALID, REAL, SET_IN_BITMAP };
50
+enum MeshPointType : char { INVALID, REAL, SET_IN_BITMAP };
51
 
51
 
52
 // External references
52
 // External references
53
 
53
 

+ 3
- 3
Marlin/src/feature/pause.h 查看文件

32
 
32
 
33
 #include "../inc/MarlinConfigPre.h"
33
 #include "../inc/MarlinConfigPre.h"
34
 
34
 
35
-enum AdvancedPauseMode {
35
+enum AdvancedPauseMode : char {
36
   ADVANCED_PAUSE_MODE_PAUSE_PRINT,
36
   ADVANCED_PAUSE_MODE_PAUSE_PRINT,
37
   ADVANCED_PAUSE_MODE_LOAD_FILAMENT,
37
   ADVANCED_PAUSE_MODE_LOAD_FILAMENT,
38
   ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT
38
   ADVANCED_PAUSE_MODE_UNLOAD_FILAMENT
39
 };
39
 };
40
 
40
 
41
-enum AdvancedPauseMessage {
41
+enum AdvancedPauseMessage : char {
42
   ADVANCED_PAUSE_MESSAGE_INIT,
42
   ADVANCED_PAUSE_MESSAGE_INIT,
43
   ADVANCED_PAUSE_MESSAGE_UNLOAD,
43
   ADVANCED_PAUSE_MESSAGE_UNLOAD,
44
   ADVANCED_PAUSE_MESSAGE_INSERT,
44
   ADVANCED_PAUSE_MESSAGE_INSERT,
51
   ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT
51
   ADVANCED_PAUSE_MESSAGE_WAIT_FOR_NOZZLES_TO_HEAT
52
 };
52
 };
53
 
53
 
54
-enum AdvancedPauseMenuResponse {
54
+enum AdvancedPauseMenuResponse : char {
55
   ADVANCED_PAUSE_RESPONSE_WAIT_FOR,
55
   ADVANCED_PAUSE_RESPONSE_WAIT_FOR,
56
   ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE,
56
   ADVANCED_PAUSE_RESPONSE_EXTRUDE_MORE,
57
   ADVANCED_PAUSE_RESPONSE_RESUME_PRINT
57
   ADVANCED_PAUSE_RESPONSE_RESUME_PRINT

+ 2
- 2
Marlin/src/feature/tmc_util.cpp 查看文件

253
 
253
 
254
 #if ENABLED(TMC_DEBUG)
254
 #if ENABLED(TMC_DEBUG)
255
 
255
 
256
-  enum TMC_debug_enum {
256
+  enum TMC_debug_enum : char {
257
     TMC_CODES,
257
     TMC_CODES,
258
     TMC_ENABLED,
258
     TMC_ENABLED,
259
     TMC_CURRENT,
259
     TMC_CURRENT,
277
     TMC_HSTRT,
277
     TMC_HSTRT,
278
     TMC_SGT
278
     TMC_SGT
279
   };
279
   };
280
-  enum TMC_drv_status_enum {
280
+  enum TMC_drv_status_enum : char {
281
     TMC_DRV_CODES,
281
     TMC_DRV_CODES,
282
     TMC_STST,
282
     TMC_STST,
283
     TMC_OLB,
283
     TMC_OLB,

+ 1
- 1
Marlin/src/feature/tmc_util.h 查看文件

29
 
29
 
30
 extern bool report_tmc_status;
30
 extern bool report_tmc_status;
31
 
31
 
32
-enum TMC_AxisEnum { TMC_X, TMC_X2, TMC_Y, TMC_Y2, TMC_Z, TMC_Z2, TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4 };
32
+enum TMC_AxisEnum : char { TMC_X, TMC_X2, TMC_Y, TMC_Y2, TMC_Z, TMC_Z2, TMC_E0, TMC_E1, TMC_E2, TMC_E3, TMC_E4 };
33
 
33
 
34
 constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) {
34
 constexpr uint32_t _tmc_thrs(const uint16_t msteps, const int32_t thrs, const uint32_t spmm) {
35
   return 12650000UL * msteps / (256 * thrs * spmm);
35
   return 12650000UL * msteps / (256 * thrs * spmm);

+ 1
- 1
Marlin/src/gcode/calibrate/G33.cpp 查看文件

43
 constexpr uint8_t _7P_STEP = 1,              // 7-point step - to change number of calibration points
43
 constexpr uint8_t _7P_STEP = 1,              // 7-point step - to change number of calibration points
44
                   _4P_STEP = _7P_STEP * 2,   // 4-point step
44
                   _4P_STEP = _7P_STEP * 2,   // 4-point step
45
                   NPP      = _7P_STEP * 6;   // number of calibration points on the radius
45
                   NPP      = _7P_STEP * 6;   // number of calibration points on the radius
46
-enum CalEnum {                               // the 7 main calibration points - add definitions if needed
46
+enum CalEnum : char {                               // the 7 main calibration points - add definitions if needed
47
   CEN      = 0,
47
   CEN      = 0,
48
   __A      = 1,
48
   __A      = 1,
49
   _AB      = __A + _7P_STEP,
49
   _AB      = __A + _7P_STEP,

+ 2
- 2
Marlin/src/gcode/gcode.h 查看文件

267
      * Workspace planes only apply to G2/G3 moves
267
      * Workspace planes only apply to G2/G3 moves
268
      * (and "canned cycles" - not a current feature)
268
      * (and "canned cycles" - not a current feature)
269
      */
269
      */
270
-    enum WorkspacePlane { PLANE_XY, PLANE_ZX, PLANE_YZ };
270
+    enum WorkspacePlane : char { PLANE_XY, PLANE_ZX, PLANE_YZ };
271
     static WorkspacePlane workspace_plane;
271
     static WorkspacePlane workspace_plane;
272
   #endif
272
   #endif
273
 
273
 
304
      * States for managing Marlin and host communication
304
      * States for managing Marlin and host communication
305
      * Marlin sends messages if blocked or busy
305
      * Marlin sends messages if blocked or busy
306
      */
306
      */
307
-    enum MarlinBusyState {
307
+    enum MarlinBusyState : char {
308
       NOT_BUSY,           // Not in a handler
308
       NOT_BUSY,           // Not in a handler
309
       IN_HANDLER,         // Processing a GCode
309
       IN_HANDLER,         // Processing a GCode
310
       IN_PROCESS,         // Known to be blocking command input (as in G29)
310
       IN_PROCESS,         // Known to be blocking command input (as in G29)

+ 1
- 1
Marlin/src/libs/stopwatch.h 查看文件

36
  */
36
  */
37
 class Stopwatch {
37
 class Stopwatch {
38
   private:
38
   private:
39
-    enum State {
39
+    enum State : char {
40
       STOPPED,
40
       STOPPED,
41
       RUNNING,
41
       RUNNING,
42
       PAUSED
42
       PAUSED

+ 1
- 1
Marlin/src/module/endstops.h 查看文件

30
 #include "../inc/MarlinConfig.h"
30
 #include "../inc/MarlinConfig.h"
31
 #include <stdint.h>
31
 #include <stdint.h>
32
 
32
 
33
-enum EndstopEnum {
33
+enum EndstopEnum : char {
34
   X_MIN,
34
   X_MIN,
35
   Y_MIN,
35
   Y_MIN,
36
   Z_MIN,
36
   Z_MIN,

+ 2
- 2
Marlin/src/module/motion.h 查看文件

288
  */
288
  */
289
 #if ENABLED(DUAL_X_CARRIAGE)
289
 #if ENABLED(DUAL_X_CARRIAGE)
290
 
290
 
291
-  enum DualXMode {
291
+  enum DualXMode : char {
292
     DXC_FULL_CONTROL_MODE,  // DUAL_X_CARRIAGE only
292
     DXC_FULL_CONTROL_MODE,  // DUAL_X_CARRIAGE only
293
     DXC_AUTO_PARK_MODE,     // DUAL_X_CARRIAGE only
293
     DXC_AUTO_PARK_MODE,     // DUAL_X_CARRIAGE only
294
     DXC_DUPLICATION_MODE
294
     DXC_DUPLICATION_MODE
308
 
308
 
309
 #elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
309
 #elif ENABLED(DUAL_NOZZLE_DUPLICATION_MODE)
310
 
310
 
311
-  enum DualXMode {
311
+  enum DualXMode : char {
312
     DXC_DUPLICATION_MODE = 2
312
     DXC_DUPLICATION_MODE = 2
313
   };
313
   };
314
 
314
 

+ 2
- 2
Marlin/src/module/planner.h 查看文件

44
   #include "../libs/vector_3.h"
44
   #include "../libs/vector_3.h"
45
 #endif
45
 #endif
46
 
46
 
47
-enum BlockFlagBit {
47
+enum BlockFlagBit : char {
48
   // Recalculate trapezoids on entry junction. For optimization.
48
   // Recalculate trapezoids on entry junction. For optimization.
49
   BLOCK_BIT_RECALCULATE,
49
   BLOCK_BIT_RECALCULATE,
50
 
50
 
60
   BLOCK_BIT_CONTINUED
60
   BLOCK_BIT_CONTINUED
61
 };
61
 };
62
 
62
 
63
-enum BlockFlag {
63
+enum BlockFlag : char {
64
   BLOCK_FLAG_RECALCULATE          = _BV(BLOCK_BIT_RECALCULATE),
64
   BLOCK_FLAG_RECALCULATE          = _BV(BLOCK_BIT_RECALCULATE),
65
   BLOCK_FLAG_NOMINAL_LENGTH       = _BV(BLOCK_BIT_NOMINAL_LENGTH),
65
   BLOCK_FLAG_NOMINAL_LENGTH       = _BV(BLOCK_BIT_NOMINAL_LENGTH),
66
   BLOCK_FLAG_BUSY                 = _BV(BLOCK_BIT_BUSY),
66
   BLOCK_FLAG_BUSY                 = _BV(BLOCK_BIT_BUSY),

+ 2
- 2
Marlin/src/module/temperature.h 查看文件

49
 /**
49
 /**
50
  * States for ADC reading in the ISR
50
  * States for ADC reading in the ISR
51
  */
51
  */
52
-enum ADCSensorState {
52
+enum ADCSensorState : char {
53
   #if HAS_TEMP_0
53
   #if HAS_TEMP_0
54
     PrepareTemp_0,
54
     PrepareTemp_0,
55
     MeasureTemp_0,
55
     MeasureTemp_0,
610
 
610
 
611
     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED
611
     #if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED
612
 
612
 
613
-      typedef enum TRState { TRInactive, TRFirstHeating, TRStable, TRRunaway } TRstate;
613
+      typedef enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway } TRstate;
614
 
614
 
615
       static void thermal_runaway_protection(TRState * const state, millis_t * const timer, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
615
       static void thermal_runaway_protection(TRState * const state, millis_t * const timer, const float &current, const float &target, const int8_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc);
616
 
616
 

Loading…
取消
儲存