From d25231aea862890d1d224ed28ae80a22ad65ce28 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 29 Aug 2019 17:06:18 -0500 Subject: [PATCH] Spacing, defined(), #include tweaks --- Marlin/src/HAL/HAL_AVR/fast_pwm.cpp | 2 +- Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp | 3 ++- Marlin/src/HAL/HAL_ESP32/web.cpp | 3 ++- Marlin/src/HAL/HAL_LINUX/include/serial.h | 4 ++-- Marlin/src/HAL/HAL_STM32/pinsDebug_STM32duino.h | 14 +++++++------- Marlin/src/HAL/HAL_STM32_F4_F7/STM32F7/TMC2660.cpp | 6 ++++-- Marlin/src/HAL/shared/servo.h | 2 +- .../lulzbot/ftdi_eve_lib/extended/screen_types.h | 9 +++++---- .../BIGTREE_GENERIC_STM32F407_5X/variant.h | 6 +++--- 9 files changed, 27 insertions(+), 22 deletions(-) diff --git a/Marlin/src/HAL/HAL_AVR/fast_pwm.cpp b/Marlin/src/HAL/HAL_AVR/fast_pwm.cpp index 7923968fd2..55ca669a87 100644 --- a/Marlin/src/HAL/HAL_AVR/fast_pwm.cpp +++ b/Marlin/src/HAL/HAL_AVR/fast_pwm.cpp @@ -65,7 +65,7 @@ Timer get_pwm_timer(const pin_t pin) { /*n, q*/ 2, 0 }; } - #elif defined TCCR2A + #elif defined(TCCR2A) #if ENABLED(USE_OCR2A_AS_TOP) case TIMER2A: break; // protect TIMER2A case TIMER2B: { diff --git a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp index 85c0879712..96052b88ef 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL_spi_ESP32.cpp @@ -27,9 +27,10 @@ #include "../shared/HAL_SPI.h" #include #include "spi_pins.h" -#include "../../core/macros.h" #include +#include "../../core/macros.h" + // ------------------------ // Public Variables // ------------------------ diff --git a/Marlin/src/HAL/HAL_ESP32/web.cpp b/Marlin/src/HAL/HAL_ESP32/web.cpp index b2bb03d714..8e4b9e510c 100644 --- a/Marlin/src/HAL/HAL_ESP32/web.cpp +++ b/Marlin/src/HAL/HAL_ESP32/web.cpp @@ -27,11 +27,12 @@ #if ENABLED(WEBSUPPORT) #include + #include "wifi.h" AsyncEventSource events("/events"); // event source (Server-Sent events) -void onNotFound(AsyncWebServerRequest *request){ +void onNotFound(AsyncWebServerRequest *request) { request->send(404); } diff --git a/Marlin/src/HAL/HAL_LINUX/include/serial.h b/Marlin/src/HAL/HAL_LINUX/include/serial.h index a844936c1b..9098af5ff8 100644 --- a/Marlin/src/HAL/HAL_LINUX/include/serial.h +++ b/Marlin/src/HAL/HAL_LINUX/include/serial.h @@ -108,11 +108,11 @@ public: void flush() { receive_buffer.clear(); } - uint8_t availableForWrite(void){ + uint8_t availableForWrite(void) { return transmit_buffer.free() > 255 ? 255 : (uint8_t)transmit_buffer.free(); } - void flushTX(void){ + void flushTX(void) { if (host_connected) while (transmit_buffer.available()) { /* nada */ } } diff --git a/Marlin/src/HAL/HAL_STM32/pinsDebug_STM32duino.h b/Marlin/src/HAL/HAL_STM32/pinsDebug_STM32duino.h index 138633b502..9d9796eabe 100644 --- a/Marlin/src/HAL/HAL_STM32/pinsDebug_STM32duino.h +++ b/Marlin/src/HAL/HAL_STM32/pinsDebug_STM32duino.h @@ -145,19 +145,19 @@ uint8_t get_pin_mode(const pin_t Ard_num) { case 'D' : mode_all = GPIOD->MODER; break; #ifdef PE_0 case 'E' : mode_all = GPIOE->MODER; break; - #elif defined (PF_0) + #elif defined(PF_0) case 'F' : mode_all = GPIOF->MODER; break; - #elif defined (PG_0) + #elif defined(PG_0) case 'G' : mode_all = GPIOG->MODER; break; - #elif defined (PH_0) + #elif defined(PH_0) case 'H' : mode_all = GPIOH->MODER; break; - #elif defined (PI_0) + #elif defined(PI_0) case 'I' : mode_all = GPIOI->MODER; break; - #elif defined (PJ_0) + #elif defined(PJ_0) case 'J' : mode_all = GPIOJ->MODER; break; - #elif defined (PK_0) + #elif defined(PK_0) case 'K' : mode_all = GPIOK->MODER; break; - #elif defined (PL_0) + #elif defined(PL_0) case 'L' : mode_all = GPIOL->MODER; break; #endif } diff --git a/Marlin/src/HAL/HAL_STM32_F4_F7/STM32F7/TMC2660.cpp b/Marlin/src/HAL/HAL_STM32_F4_F7/STM32F7/TMC2660.cpp index 698681e7f0..b2aaf5ea3f 100644 --- a/Marlin/src/HAL/HAL_STM32_F4_F7/STM32F7/TMC2660.cpp +++ b/Marlin/src/HAL/HAL_STM32_F4_F7/STM32F7/TMC2660.cpp @@ -313,10 +313,12 @@ void TMC26XStepper::setCurrent(uint16_t current) { current_scaling = (byte)((resistor_value * mASetting * 32.0 / (0.165 * sq(1000.0))) - 0.5); //theoretically - 1.0 for better rounding it is 0.5 #ifdef TMC_DEBUG0 // crashes SERIAL_ECHOPAIR("\nCS (Vsense=1): ",current_scaling); - } else { - SERIAL_ECHOPAIR("\nCS: ", current_scaling); #endif } + #ifdef TMC_DEBUG0 // crashes + else + SERIAL_ECHOPAIR("\nCS: ", current_scaling); + #endif // do some sanity checks NOMORE(current_scaling, 31); diff --git a/Marlin/src/HAL/shared/servo.h b/Marlin/src/HAL/shared/servo.h index d1a83bf169..51b0c7b571 100644 --- a/Marlin/src/HAL/shared/servo.h +++ b/Marlin/src/HAL/shared/servo.h @@ -84,7 +84,7 @@ #else #include - #if defined(__AVR__) || defined(ARDUINO_ARCH_SAM) || defined (__SAMD51__) + #if defined(__AVR__) || defined(ARDUINO_ARCH_SAM) || defined(__SAMD51__) // we're good to go #else #error "This library only supports boards with an AVR, SAM3X or SAMD51 processor." diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h index 5550314942..ede0a92182 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h @@ -170,7 +170,7 @@ class UncachedScreen { template class CachedScreen { protected: - static bool storeBackground(){ + static bool storeBackground() { DLCache dlcache(DL_SLOT); if (!dlcache.store(DL_SIZE)) { SERIAL_ECHO_START(); @@ -180,7 +180,7 @@ class CachedScreen { return true; } - static void repaintBackground(){ + static void repaintBackground() { using namespace FTDI; DLCache dlcache(DL_SLOT); CLCD::CommandFifo cmd; @@ -192,7 +192,7 @@ class CachedScreen { } public: - static void onRefresh(){ + static void onRefresh() { using namespace FTDI; DLCache dlcache(DL_SLOT); CLCD::CommandFifo cmd; @@ -201,7 +201,8 @@ class CachedScreen { if (dlcache.has_data()) { dlcache.append(); - } else { + } + else { current_screen.onRedraw(BACKGROUND); dlcache.store(DL_SIZE); } diff --git a/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.h b/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.h index 44155d9b02..4cc9ae2b85 100644 --- a/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.h +++ b/buildroot/share/PlatformIO/variants/BIGTREE_GENERIC_STM32F407_5X/variant.h @@ -47,15 +47,15 @@ extern const PinName digitalPin[]; #define STM32F4X_PIN_NUM 64 //64 pins mcu, 51 gpio #define STM32F4X_GPIO_NUM 51 #define STM32F4X_ADC_NUM 16 -#elif defined STM32F407_5VX +#elif defined(STM32F407_5VX) #define STM32F4X_PIN_NUM 100 //100 pins mcu, 82 gpio #define STM32F4X_GPIO_NUM 82 #define STM32F4X_ADC_NUM 16 -#elif defined STM32F407_5ZX +#elif defined(STM32F407_5ZX) #define STM32F4X_PIN_NUM 144 //144 pins mcu, 114 gpio #define STM32F4X_GPIO_NUM 114 #define STM32F4X_ADC_NUM 24 -#elif defined STM32F407IX +#elif defined(STM32F407IX) #define STM32F4X_PIN_NUM 176 //176 pins mcu, 140 gpio #define STM32F4X_GPIO_NUM 140 #define STM32F4X_ADC_NUM 24