Skip to content

Commit 2e2abbc

Browse files
committed
🎨 CONF_SERIAL_IS => SERIAL_IN_USE
1 parent 485fb77 commit 2e2abbc

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

Marlin/src/HAL/AVR/inc/SanityCheck.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,22 @@
3737
|| X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
3838
|| BTN_EN1 == N || BTN_EN2 == N \
3939
)
40-
#if CONF_SERIAL_IS(0)
40+
#if SERIAL_IN_USE(0)
4141
// D0-D1. No known conflicts.
4242
#endif
4343
#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))
4545
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
4646
#endif
4747
#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))
4949
#error "Serial Port 1 pin D10 and/or D11 conflicts with another pin on the board."
5050
#endif
5151
#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))
5353
#error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
5454
#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))
5656
#error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
5757
#endif
5858
#undef CHECK_SERIAL_PIN

Marlin/src/HAL/DUE/inc/SanityCheck.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@
3636
|| X_DIR_PIN == N || Y_DIR_PIN == N || Z_DIR_PIN == N \
3737
|| X_ENA_PIN == N || Y_ENA_PIN == N || Z_ENA_PIN == N \
3838
)
39-
#if CONF_SERIAL_IS(0) // D0-D1. No known conflicts.
39+
#if SERIAL_IN_USE(0) // D0-D1. No known conflicts.
4040
#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))
4242
#error "Serial Port 1 pin D18 and/or D19 conflicts with another pin on the board."
4343
#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))
4545
#error "Serial Port 2 pin D16 and/or D17 conflicts with another pin on the board."
4646
#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))
4848
#error "Serial Port 3 pin D14 and/or D15 conflicts with another pin on the board."
4949
#endif
5050
#undef CHECK_SERIAL_PIN

Marlin/src/HAL/STM32/eeprom_flash.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
static_assert(IS_FLASH_SECTOR(FLASH_SECTOR), "FLASH_SECTOR is invalid");
9696
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");
9797

98-
#endif
98+
#endif // FLASH_EEPROM_LEVELING
9999

100100
static bool eeprom_data_written = false;
101101

@@ -189,15 +189,15 @@ bool PersistentStore::access_finish() {
189189

190190
UNLOCK_FLASH();
191191

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;
196196

197197
bool success = true;
198198

199199
while (address < address_end) {
200-
memcpy(&data, ram_eeprom + offset, sizeof(uint32_t));
200+
memcpy(&data, ram_eeprom + offset, sizeof(data));
201201
status = HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, address, data);
202202
if (status == HAL_OK) {
203203
address += sizeof(uint32_t);
@@ -221,7 +221,8 @@ bool PersistentStore::access_finish() {
221221

222222
return success;
223223

224-
#else
224+
#else // !FLASH_EEPROM_LEVELING
225+
225226
// The following was written for the STM32F4 but may work with other MCUs as well.
226227
// Most STM32F4 flash does not allow reading from flash during erase operations.
227228
// This takes about a second on a STM32F407 with a 128kB sector used as EEPROM.
@@ -235,7 +236,8 @@ bool PersistentStore::access_finish() {
235236
TERN_(HAS_PAUSE_SERVO_OUTPUT, RESUME_SERVO_OUTPUT());
236237

237238
eeprom_data_written = false;
238-
#endif
239+
240+
#endif // !FLASH_EEPROM_LEVELING
239241
}
240242

241243
return true;

Marlin/src/inc/Conditionals_post.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,15 +2446,15 @@
24462446
//
24472447

24482448
// 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) \
24502450
|| (defined(SERIAL_PORT_2) && SERIAL_PORT_2 == N) \
24512451
|| (defined(SERIAL_PORT_3) && SERIAL_PORT_3 == N) \
24522452
|| (defined(MMU2_SERIAL_PORT) && MMU2_SERIAL_PORT == N) \
24532453
|| (defined(LCD_SERIAL_PORT) && LCD_SERIAL_PORT == N) )
24542454

24552455
// Flag the named hardware serial ports in use
24562456
#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) \
24582458
|| TMC_UART_IS(X, N) || TMC_UART_IS(Y , N) || TMC_UART_IS(Z , N) \
24592459
|| TMC_UART_IS(I, N) || TMC_UART_IS(J , N) || TMC_UART_IS(K , N) \
24602460
|| TMC_UART_IS(U, N) || TMC_UART_IS(V , N) || TMC_UART_IS(W , N) \
@@ -2481,7 +2481,7 @@
24812481
#define HW_MSerial9 518
24822482
#define HW_MSerial10 519
24832483

2484-
#if CONF_SERIAL_IS(-1)
2484+
#if SERIAL_IN_USE(-1)
24852485
#define USING_HW_SERIALUSB 1
24862486
#endif
24872487
#if ANY_SERIAL_IS(0)

Marlin/src/pins/pinsDebug.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,19 @@
4949

5050
// manually add pins that have names that are macros which don't play well with these macros
5151
#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)
5353
static const char RXD_NAME_0[] PROGMEM = { "RXD0" };
5454
static const char TXD_NAME_0[] PROGMEM = { "TXD0" };
5555
#endif
56-
#if CONF_SERIAL_IS(1)
56+
#if SERIAL_IN_USE(1)
5757
static const char RXD_NAME_1[] PROGMEM = { "RXD1" };
5858
static const char TXD_NAME_1[] PROGMEM = { "TXD1" };
5959
#endif
60-
#if CONF_SERIAL_IS(2)
60+
#if SERIAL_IN_USE(2)
6161
static const char RXD_NAME_2[] PROGMEM = { "RXD2" };
6262
static const char TXD_NAME_2[] PROGMEM = { "TXD2" };
6363
#endif
64-
#if CONF_SERIAL_IS(3)
64+
#if SERIAL_IN_USE(3)
6565
static const char RXD_NAME_3[] PROGMEM = { "RXD3" };
6666
static const char TXD_NAME_3[] PROGMEM = { "TXD3" };
6767
#endif
@@ -99,7 +99,7 @@ const PinInfo pin_array[] PROGMEM = {
9999
* 2 bytes containing the digital/analog bool flag
100100
*/
101101

102-
#if CONF_SERIAL_IS(0)
102+
#if SERIAL_IN_USE(0)
103103
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
104104
{ RXD_NAME_0, 0, true },
105105
{ TXD_NAME_0, 1, true },
@@ -112,7 +112,7 @@ const PinInfo pin_array[] PROGMEM = {
112112
#endif
113113
#endif
114114

115-
#if CONF_SERIAL_IS(1)
115+
#if SERIAL_IN_USE(1)
116116
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
117117
{ RXD_NAME_1, 19, true },
118118
{ TXD_NAME_1, 18, true },
@@ -130,7 +130,7 @@ const PinInfo pin_array[] PROGMEM = {
130130
#endif
131131
#endif
132132

133-
#if CONF_SERIAL_IS(2)
133+
#if SERIAL_IN_USE(2)
134134
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
135135
{ RXD_NAME_2, 17, true },
136136
{ TXD_NAME_2, 16, true },
@@ -145,7 +145,7 @@ const PinInfo pin_array[] PROGMEM = {
145145
#endif
146146
#endif
147147

148-
#if CONF_SERIAL_IS(3)
148+
#if SERIAL_IN_USE(3)
149149
#if EITHER(AVR_ATmega2560_FAMILY, ARDUINO_ARCH_SAM)
150150
{ RXD_NAME_3, 15, true },
151151
{ TXD_NAME_3, 14, true },

0 commit comments

Comments
 (0)