Spacing, defined(), #include tweaks

This commit is contained in:
Scott Lahteine 2019-08-29 17:06:18 -05:00
parent 7ebfae27e3
commit d25231aea8
9 changed files with 27 additions and 22 deletions

View File

@ -65,7 +65,7 @@ Timer get_pwm_timer(const pin_t pin) {
/*n, q*/ 2, 0 /*n, q*/ 2, 0
}; };
} }
#elif defined TCCR2A #elif defined(TCCR2A)
#if ENABLED(USE_OCR2A_AS_TOP) #if ENABLED(USE_OCR2A_AS_TOP)
case TIMER2A: break; // protect TIMER2A case TIMER2A: break; // protect TIMER2A
case TIMER2B: { case TIMER2B: {

View File

@ -27,9 +27,10 @@
#include "../shared/HAL_SPI.h" #include "../shared/HAL_SPI.h"
#include <pins_arduino.h> #include <pins_arduino.h>
#include "spi_pins.h" #include "spi_pins.h"
#include "../../core/macros.h"
#include <SPI.h> #include <SPI.h>
#include "../../core/macros.h"
// ------------------------ // ------------------------
// Public Variables // Public Variables
// ------------------------ // ------------------------

View File

@ -27,11 +27,12 @@
#if ENABLED(WEBSUPPORT) #if ENABLED(WEBSUPPORT)
#include <SPIFFS.h> #include <SPIFFS.h>
#include "wifi.h" #include "wifi.h"
AsyncEventSource events("/events"); // event source (Server-Sent events) AsyncEventSource events("/events"); // event source (Server-Sent events)
void onNotFound(AsyncWebServerRequest *request){ void onNotFound(AsyncWebServerRequest *request) {
request->send(404); request->send(404);
} }

View File

@ -108,11 +108,11 @@ public:
void flush() { receive_buffer.clear(); } void flush() { receive_buffer.clear(); }
uint8_t availableForWrite(void){ uint8_t availableForWrite(void) {
return transmit_buffer.free() > 255 ? 255 : (uint8_t)transmit_buffer.free(); return transmit_buffer.free() > 255 ? 255 : (uint8_t)transmit_buffer.free();
} }
void flushTX(void){ void flushTX(void) {
if (host_connected) if (host_connected)
while (transmit_buffer.available()) { /* nada */ } while (transmit_buffer.available()) { /* nada */ }
} }

View File

@ -145,19 +145,19 @@ uint8_t get_pin_mode(const pin_t Ard_num) {
case 'D' : mode_all = GPIOD->MODER; break; case 'D' : mode_all = GPIOD->MODER; break;
#ifdef PE_0 #ifdef PE_0
case 'E' : mode_all = GPIOE->MODER; break; case 'E' : mode_all = GPIOE->MODER; break;
#elif defined (PF_0) #elif defined(PF_0)
case 'F' : mode_all = GPIOF->MODER; break; case 'F' : mode_all = GPIOF->MODER; break;
#elif defined (PG_0) #elif defined(PG_0)
case 'G' : mode_all = GPIOG->MODER; break; case 'G' : mode_all = GPIOG->MODER; break;
#elif defined (PH_0) #elif defined(PH_0)
case 'H' : mode_all = GPIOH->MODER; break; case 'H' : mode_all = GPIOH->MODER; break;
#elif defined (PI_0) #elif defined(PI_0)
case 'I' : mode_all = GPIOI->MODER; break; case 'I' : mode_all = GPIOI->MODER; break;
#elif defined (PJ_0) #elif defined(PJ_0)
case 'J' : mode_all = GPIOJ->MODER; break; case 'J' : mode_all = GPIOJ->MODER; break;
#elif defined (PK_0) #elif defined(PK_0)
case 'K' : mode_all = GPIOK->MODER; break; case 'K' : mode_all = GPIOK->MODER; break;
#elif defined (PL_0) #elif defined(PL_0)
case 'L' : mode_all = GPIOL->MODER; break; case 'L' : mode_all = GPIOL->MODER; break;
#endif #endif
} }

View File

@ -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 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 #ifdef TMC_DEBUG0 // crashes
SERIAL_ECHOPAIR("\nCS (Vsense=1): ",current_scaling); SERIAL_ECHOPAIR("\nCS (Vsense=1): ",current_scaling);
} else {
SERIAL_ECHOPAIR("\nCS: ", current_scaling);
#endif #endif
} }
#ifdef TMC_DEBUG0 // crashes
else
SERIAL_ECHOPAIR("\nCS: ", current_scaling);
#endif
// do some sanity checks // do some sanity checks
NOMORE(current_scaling, 31); NOMORE(current_scaling, 31);

View File

@ -84,7 +84,7 @@
#else #else
#include <stdint.h> #include <stdint.h>
#if defined(__AVR__) || defined(ARDUINO_ARCH_SAM) || defined (__SAMD51__) #if defined(__AVR__) || defined(ARDUINO_ARCH_SAM) || defined(__SAMD51__)
// we're good to go // we're good to go
#else #else
#error "This library only supports boards with an AVR, SAM3X or SAMD51 processor." #error "This library only supports boards with an AVR, SAM3X or SAMD51 processor."

View File

@ -170,7 +170,7 @@ class UncachedScreen {
template<uint8_t DL_SLOT,uint32_t DL_SIZE = 0> template<uint8_t DL_SLOT,uint32_t DL_SIZE = 0>
class CachedScreen { class CachedScreen {
protected: protected:
static bool storeBackground(){ static bool storeBackground() {
DLCache dlcache(DL_SLOT); DLCache dlcache(DL_SLOT);
if (!dlcache.store(DL_SIZE)) { if (!dlcache.store(DL_SIZE)) {
SERIAL_ECHO_START(); SERIAL_ECHO_START();
@ -180,7 +180,7 @@ class CachedScreen {
return true; return true;
} }
static void repaintBackground(){ static void repaintBackground() {
using namespace FTDI; using namespace FTDI;
DLCache dlcache(DL_SLOT); DLCache dlcache(DL_SLOT);
CLCD::CommandFifo cmd; CLCD::CommandFifo cmd;
@ -192,7 +192,7 @@ class CachedScreen {
} }
public: public:
static void onRefresh(){ static void onRefresh() {
using namespace FTDI; using namespace FTDI;
DLCache dlcache(DL_SLOT); DLCache dlcache(DL_SLOT);
CLCD::CommandFifo cmd; CLCD::CommandFifo cmd;
@ -201,7 +201,8 @@ class CachedScreen {
if (dlcache.has_data()) { if (dlcache.has_data()) {
dlcache.append(); dlcache.append();
} else { }
else {
current_screen.onRedraw(BACKGROUND); current_screen.onRedraw(BACKGROUND);
dlcache.store(DL_SIZE); dlcache.store(DL_SIZE);
} }

View File

@ -47,15 +47,15 @@ extern const PinName digitalPin[];
#define STM32F4X_PIN_NUM 64 //64 pins mcu, 51 gpio #define STM32F4X_PIN_NUM 64 //64 pins mcu, 51 gpio
#define STM32F4X_GPIO_NUM 51 #define STM32F4X_GPIO_NUM 51
#define STM32F4X_ADC_NUM 16 #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_PIN_NUM 100 //100 pins mcu, 82 gpio
#define STM32F4X_GPIO_NUM 82 #define STM32F4X_GPIO_NUM 82
#define STM32F4X_ADC_NUM 16 #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_PIN_NUM 144 //144 pins mcu, 114 gpio
#define STM32F4X_GPIO_NUM 114 #define STM32F4X_GPIO_NUM 114
#define STM32F4X_ADC_NUM 24 #define STM32F4X_ADC_NUM 24
#elif defined STM32F407IX #elif defined(STM32F407IX)
#define STM32F4X_PIN_NUM 176 //176 pins mcu, 140 gpio #define STM32F4X_PIN_NUM 176 //176 pins mcu, 140 gpio
#define STM32F4X_GPIO_NUM 140 #define STM32F4X_GPIO_NUM 140
#define STM32F4X_ADC_NUM 24 #define STM32F4X_ADC_NUM 24