소스 검색

🎨 CONF_SERIAL_IS => SERIAL_IN_USE

Scott Lahteine 2 년 전
부모
커밋
e298266eff

+ 5
- 5
Marlin/src/HAL/AVR/inc/SanityCheck.h 파일 보기

@@ -37,22 +37,22 @@
37 37
   || X_ENA_PIN  == N || Y_ENA_PIN  == N || Z_ENA_PIN  == N \
38 38
   || BTN_EN1    == N || BTN_EN2    == N \
39 39
 )
40
-#if CONF_SERIAL_IS(0)
40
+#if SERIAL_IN_USE(0)
41 41
   // D0-D1. No known conflicts.
42 42
 #endif
43 43
 #if NOT_TARGET(__AVR_ATmega644P__, __AVR_ATmega1284P__)
44
-  #if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
44
+  #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
45 45
     #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
46 46
   #endif
47 47
 #else
48
-  #if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11))
48
+  #if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(10) || CHECK_SERIAL_PIN(11))
49 49
     #error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
50 50
   #endif
51 51
 #endif
52
-#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
52
+#if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
53 53
   #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
54 54
 #endif
55
-#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
55
+#if SERIAL_IN_USE(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
56 56
   #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
57 57
 #endif
58 58
 #undef CHECK_SERIAL_PIN

+ 4
- 4
Marlin/src/HAL/DUE/inc/SanityCheck.h 파일 보기

@@ -36,15 +36,15 @@
36 36
   || X_DIR_PIN  == N || Y_DIR_PIN  == N || Z_DIR_PIN  == N \
37 37
   || X_ENA_PIN  == N || Y_ENA_PIN  == N || Z_ENA_PIN  == N \
38 38
 )
39
-#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts.
39
+#if SERIAL_IN_USE(0) // D0-D1. No known conflicts.
40 40
 #endif
41
-#if CONF_SERIAL_IS(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
41
+#if SERIAL_IN_USE(1) && (CHECK_SERIAL_PIN(18) || CHECK_SERIAL_PIN(19))
42 42
   #error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
43 43
 #endif
44
-#if CONF_SERIAL_IS(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
44
+#if SERIAL_IN_USE(2) && (CHECK_SERIAL_PIN(16) || CHECK_SERIAL_PIN(17))
45 45
   #error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
46 46
 #endif
47
-#if CONF_SERIAL_IS(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
47
+#if SERIAL_IN_USE(3) && (CHECK_SERIAL_PIN(14) || CHECK_SERIAL_PIN(15))
48 48
   #error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
49 49
 #endif
50 50
 #undef CHECK_SERIAL_PIN

+ 10
- 8
Marlin/src/HAL/STM32/eeprom_flash.cpp 파일 보기

@@ -95,7 +95,7 @@
95 95
   static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid");
96 96
   static_assert(IS_POWER_OF_2(FLASH_UNIT_SIZE), "FLASH_UNIT_SIZE should be a power of 2, please check your chip's spec sheet");
97 97
 
98
-#endif
98
+#endif // FLASH_EEPROM_LEVELING
99 99
 
100 100
 static bool eeprom_data_written = false;
101 101
 
@@ -189,15 +189,15 @@ bool PersistentStore::access_finish() {
189 189
 
190 190
       UNLOCK_FLASH();
191 191
 
192
-      uint32_t offset = 0;
193
-      uint32_t address = SLOT_ADDRESS(current_slot);
194
-      uint32_t address_end = address + MARLIN_EEPROM_SIZE;
195
-      uint32_t data = 0;
192
+      uint32_t offset = 0,
193
+               address = SLOT_ADDRESS(current_slot),
194
+               address_end = address + MARLIN_EEPROM_SIZE,
195
+               data = 0;
196 196
 
197 197
       bool success = true;
198 198
 
199 199
       while (address < address_end) {
200
-        memcpy(&data, ram_eeprom + offset, sizeof(uint32_t));
200
+        memcpy(&data, ram_eeprom + offset, sizeof(data));
201 201
         status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, address, data);
202 202
         if (status == HAL_OK) {
203 203
           address += sizeof(uint32_t);
@@ -221,7 +221,8 @@ bool PersistentStore::access_finish() {
221 221
 
222 222
       return success;
223 223
 
224
-    #else
224
+    #else !FLASH_EEPROM_LEVELING
225
+
225 226
       // The following was written for the STM32F4 but may work with other MCUs as well.
226 227
       // Most STM32F4 flash does not allow reading from flash during erase operations.
227 228
       // This takes about a second on a STM32F407 with a 128kB sector used as EEPROM.
@@ -235,7 +236,8 @@ bool PersistentStore::access_finish() {
235 236
       TERN_(HAS_PAUSE_SERVO_OUTPUT, RESUME_SERVO_OUTPUT());
236 237
 
237 238
       eeprom_data_written = false;
238
-    #endif
239
+
240
+    #endif // !FLASH_EEPROM_LEVELING
239 241
   }
240 242
 
241 243
   return true;

+ 3
- 3
Marlin/src/inc/Conditionals_post.h 파일 보기

@@ -2446,7 +2446,7 @@
2446 2446
 //
2447 2447
 
2448 2448
 // Flag the indexed hardware serial ports in use
2449
-#define CONF_SERIAL_IS(N) (  (defined(SERIAL_PORT)      && SERIAL_PORT == N) \
2449
+#define SERIAL_IN_USE(N) (  (defined(SERIAL_PORT)      && SERIAL_PORT == N) \
2450 2450
                           || (defined(SERIAL_PORT_2)    && SERIAL_PORT_2 == N) \
2451 2451
                           || (defined(SERIAL_PORT_3)    && SERIAL_PORT_3 == N) \
2452 2452
                           || (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == N) \
@@ -2454,7 +2454,7 @@
2454 2454
 
2455 2455
 // Flag the named hardware serial ports in use
2456 2456
 #define TMC_UART_IS(A,N) (defined(A##_HARDWARE_SERIAL) && (CAT(HW_,A##_HARDWARE_SERIAL) == HW_Serial##N || CAT(HW_,A##_HARDWARE_SERIAL) == HW_MSerial##N))
2457
-#define ANY_SERIAL_IS(N) (  CONF_SERIAL_IS(N) \
2457
+#define ANY_SERIAL_IS(N) (  SERIAL_IN_USE(N) \
2458 2458
                          || TMC_UART_IS(X,  N) || TMC_UART_IS(Y , N) || TMC_UART_IS(Z , N) \
2459 2459
                          || TMC_UART_IS(I,  N) || TMC_UART_IS(J , N) || TMC_UART_IS(K , N) \
2460 2460
                          || TMC_UART_IS(U,  N) || TMC_UART_IS(V , N) || TMC_UART_IS(W , N) \
@@ -2481,7 +2481,7 @@
2481 2481
 #define HW_MSerial9  518
2482 2482
 #define HW_MSerial10 519
2483 2483
 
2484
-#if CONF_SERIAL_IS(-1)
2484
+#if SERIAL_IN_USE(-1)
2485 2485
   #define USING_HW_SERIALUSB 1
2486 2486
 #endif
2487 2487
 #if ANY_SERIAL_IS(0)

+ 8
- 8
Marlin/src/pins/pinsDebug.h 파일 보기

@@ -49,19 +49,19 @@
49 49
 
50 50
 // manually add pins that have names that are macros which don't play well with these macros
51 51
 #if ANY(AVR_ATmega2560_FAMILY, AVR_ATmega1284_FAMILY, ARDUINO_ARCH_SAM, TARGET_LPC1768)
52
-  #if CONF_SERIAL_IS(0)
52
+  #if SERIAL_IN_USE(0)
53 53
     static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
54 54
     static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
55 55
   #endif
56
-  #if CONF_SERIAL_IS(1)
56
+  #if SERIAL_IN_USE(1)
57 57
     static const char RXD_NAME_1[] PROGMEM = { "RXD1" };
58 58
     static const char TXD_NAME_1[] PROGMEM = { "TXD1" };
59 59
   #endif
60
-  #if CONF_SERIAL_IS(2)
60
+  #if SERIAL_IN_USE(2)
61 61
     static const char RXD_NAME_2[] PROGMEM = { "RXD2" };
62 62
     static const char TXD_NAME_2[] PROGMEM = { "TXD2" };
63 63
   #endif
64
-  #if CONF_SERIAL_IS(3)
64
+  #if SERIAL_IN_USE(3)
65 65
     static const char RXD_NAME_3[] PROGMEM = { "RXD3" };
66 66
     static const char TXD_NAME_3[] PROGMEM = { "TXD3" };
67 67
   #endif
@@ -99,7 +99,7 @@ const PinInfo pin_array[] PROGMEM = {
99 99
    *     2 bytes containing the digital/analog bool flag
100 100
    */
101 101
 
102
-  #if CONF_SERIAL_IS(0)
102
+  #if SERIAL_IN_USE(0)
103 103
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
104 104
       { RXD_NAME_0, 0, true },
105 105
       { TXD_NAME_0, 1, true },
@@ -112,7 +112,7 @@ const PinInfo pin_array[] PROGMEM = {
112 112
     #endif
113 113
   #endif
114 114
 
115
-  #if CONF_SERIAL_IS(1)
115
+  #if SERIAL_IN_USE(1)
116 116
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
117 117
       { RXD_NAME_1, 19, true },
118 118
       { TXD_NAME_1, 18, true },
@@ -130,7 +130,7 @@ const PinInfo pin_array[] PROGMEM = {
130 130
     #endif
131 131
   #endif
132 132
 
133
-  #if CONF_SERIAL_IS(2)
133
+  #if SERIAL_IN_USE(2)
134 134
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
135 135
       { RXD_NAME_2, 17, true },
136 136
       { TXD_NAME_2, 16, true },
@@ -145,7 +145,7 @@ const PinInfo pin_array[] PROGMEM = {
145 145
     #endif
146 146
   #endif
147 147
 
148
-  #if CONF_SERIAL_IS(3)
148
+  #if SERIAL_IN_USE(3)
149 149
     #if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
150 150
       { RXD_NAME_3, 15, true },
151 151
       { TXD_NAME_3, 14, true },

Loading…
취소
저장