Fix the "slow" version of the G-code parser

This commit is contained in:
Bob-the-Kuhn 2018-01-29 16:45:44 -06:00 committed by Scott Lahteine
parent c251601916
commit 21179f8300
4 changed files with 23 additions and 18 deletions

View File

@ -91,12 +91,12 @@ void spiSendBlock(uint8_t token, const uint8_t* buf) {
SPI.beginTransaction(spiConfig); SPI.beginTransaction(spiConfig);
SPDR = token; SPDR = token;
for (uint16_t i = 0; i < 512; i += 2) { for (uint16_t i = 0; i < 512; i += 2) {
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } while (!TEST(SPSR, SPIF)) { /* nada */ };
SPDR = buf[i]; SPDR = buf[i];
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } while (!TEST(SPSR, SPIF)) { /* nada */ };
SPDR = buf[i + 1]; SPDR = buf[i + 1];
} }
while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } while (!TEST(SPSR, SPIF)) { /* nada */ };
SPI.endTransaction(); SPI.endTransaction();
} }

View File

@ -32,6 +32,9 @@
#include "../inc/MarlinConfig.h" #include "../inc/MarlinConfig.h"
//#define DEBUG_GCODE_PARSER //#define DEBUG_GCODE_PARSER
#if ENABLED(DEBUG_GCODE_PARSER)
#include "../libs/hex_print_routines.h"
#endif
/** /**
* GCode parser * GCode parser
@ -90,8 +93,6 @@ public:
#define LETTER_BIT(N) ((N) - 'A') #define LETTER_BIT(N) ((N) - 'A')
#if ENABLED(FASTER_GCODE_PARSER)
FORCE_INLINE static bool valid_signless(const char * const p) { FORCE_INLINE static bool valid_signless(const char * const p) {
return NUMERIC(p[0]) || (p[0] == '.' && NUMERIC(p[1])); // .?[0-9] return NUMERIC(p[0]) || (p[0] == '.' && NUMERIC(p[1])); // .?[0-9]
} }
@ -100,6 +101,8 @@ public:
return valid_signless(p) || ((p[0] == '-' || p[0] == '+') && valid_signless(&p[1])); // [-+]?.?[0-9] return valid_signless(p) || ((p[0] == '-' || p[0] == '+') && valid_signless(&p[1])); // [-+]?.?[0-9]
} }
#if ENABLED(FASTER_GCODE_PARSER)
FORCE_INLINE static bool valid_int(const char * const p) { FORCE_INLINE static bool valid_int(const char * const p) {
return NUMERIC(p[0]) || ((p[0] == '-' || p[0] == '+') && NUMERIC(p[1])); // [-+]?[0-9] return NUMERIC(p[0]) || ((p[0] == '-' || p[0] == '+') && NUMERIC(p[1])); // [-+]?[0-9]
} }

View File

@ -28,10 +28,10 @@ extern u8g_dev_t u8g_dev_st7565_64128n_HAL_2x_hw_spi;
class U8GLIB_64128N_2X_HAL : public U8GLIB class U8GLIB_64128N_2X_HAL : public U8GLIB
{ {
public: public:
U8GLIB_64128N_2X_HAL(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) U8GLIB_64128N_2X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE)
: U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_sw_spi, sck, mosi, cs, a0, reset) : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_sw_spi, sck, mosi, cs, a0, reset)
{ } { }
U8GLIB_64128N_2X_HAL(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) U8GLIB_64128N_2X_HAL(pin_t cs, pin_t a0, pin_t reset = U8G_PIN_NONE)
: U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_hw_spi, cs, a0, reset) : U8GLIB(&u8g_dev_st7565_64128n_HAL_2x_hw_spi, cs, a0, reset)
{ } { }
}; };
@ -42,10 +42,10 @@ extern u8g_dev_t u8g_dev_st7920_128x64_HAL_4x_hw_spi;
class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB class U8GLIB_ST7920_128X64_4X_HAL : public U8GLIB
{ {
public: public:
U8GLIB_ST7920_128X64_4X_HAL(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t reset = U8G_PIN_NONE) U8GLIB_ST7920_128X64_4X_HAL(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE)
: U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_sw_spi, sck, mosi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_sw_spi, sck, mosi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE
{ } { }
U8GLIB_ST7920_128X64_4X_HAL(uint8_t cs, uint8_t reset = U8G_PIN_NONE) U8GLIB_ST7920_128X64_4X_HAL(pin_t cs, pin_t reset = U8G_PIN_NONE)
: U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_hw_spi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE : U8GLIB(&u8g_dev_st7920_128x64_HAL_4x_hw_spi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE
{ } { }
}; };
@ -56,7 +56,7 @@ extern u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi;
class U8GLIB_ST7920_128X64_RRD : public U8GLIB class U8GLIB_ST7920_128X64_RRD : public U8GLIB
{ {
public: public:
U8GLIB_ST7920_128X64_RRD(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t reset = U8G_PIN_NONE) U8GLIB_ST7920_128X64_RRD(pin_t sck, pin_t mosi, pin_t cs, pin_t reset = U8G_PIN_NONE)
: U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi, sck, mosi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE : U8GLIB(&u8g_dev_st7920_128x64_rrd_sw_spi, sck, mosi, cs, U8G_PIN_NONE, reset) // a0 = U8G_PIN_NONE
{ } { }
}; };

View File

@ -214,8 +214,10 @@
// //
// Průša i3 MK2 Multiplexer Support // Průša i3 MK2 Multiplexer Support
// //
#define E_MUX0_PIN P0_03 // ( 0) Z_CS_PIN #if SERIAL_PORT != 0 && SERIAL_PORT_2 != 0
#define E_MUX1_PIN P0_02 // ( 1) E0_CS_PIN #define E_MUX0_PIN P0_03 // ( 0) Z_CS_PIN
#define E_MUX1_PIN P0_02 // ( 1) E0_CS_PIN
#endif
#define E_MUX2_PIN P0_26 // (63) E1_CS_PIN #define E_MUX2_PIN P0_26 // (63) E1_CS_PIN
/** /**