Skip to content

Commit

Permalink
Merge branch 'bugfix-2.0.x' into 2.0.x-Sapphire-Pro
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzmax committed Feb 11, 2020
2 parents f7e4299 + 4a73379 commit b226623
Show file tree
Hide file tree
Showing 41 changed files with 463 additions and 366 deletions.
5 changes: 5 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,11 @@
#define X_DRIVER_TYPE TMC2209
#define Y_DRIVER_TYPE TMC2209
#define Z_DRIVER_TYPE TMC2209
//#define X2_DRIVER_TYPE A4988
//#define Y2_DRIVER_TYPE A4988
//#define Z2_DRIVER_TYPE A4988
//#define Z3_DRIVER_TYPE A4988
//#define Z4_DRIVER_TYPE A4988
#define E0_DRIVER_TYPE TMC2209
//#define E1_DRIVER_TYPE A4988
//#define E2_DRIVER_TYPE A4988
Expand Down
4 changes: 4 additions & 0 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -2784,6 +2784,10 @@
*/
#define FASTER_GCODE_PARSER

#if ENABLED(FASTER_GCODE_PARSER)
//#define GCODE_QUOTED_STRINGS // Support for quoted string parameters
#endif

/**
* CNC G-code options
* Support CNC-style G-code dialects used by laser cutters, drawing machine cams, etc.
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_AVR/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@
//#define analogInputToDigitalPin(IO) IO

#ifndef CRITICAL_SECTION_START
#define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli()
#define CRITICAL_SECTION_END SREG = _sreg
#define CRITICAL_SECTION_START() unsigned char _sreg = SREG; cli()
#define CRITICAL_SECTION_END() SREG = _sreg
#endif
#define ISRS_ENABLED() TEST(SREG, SREG_I)
#define ENABLE_ISRS() sei()
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_DUE/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ typedef int8_t pin_t;
//
// Interrupts
//
#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END() if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/HAL/HAL_DUE/InterruptVectors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ static pfnISR_Handler* get_relocated_table_addr() {
memcpy(&ram_tab, romtab, sizeof(ram_tab));

// Disable global interrupts
CRITICAL_SECTION_START;
CRITICAL_SECTION_START();

// Set the vector table base address to the SRAM copy
SCB->VTOR = (uint32_t)(&ram_tab);

// Reenable interrupts
CRITICAL_SECTION_END;
CRITICAL_SECTION_END();

// Return the address of the table
return (pfnISR_Handler*)(&ram_tab);
Expand All @@ -80,7 +80,7 @@ pfnISR_Handler install_isr(IRQn_Type irq, pfnISR_Handler newHandler) {
pfnISR_Handler *isrtab = get_relocated_table_addr();

// Disable global interrupts
CRITICAL_SECTION_START;
CRITICAL_SECTION_START();

// Get the original handler
pfnISR_Handler oldHandler = isrtab[irq + 16];
Expand All @@ -89,7 +89,7 @@ pfnISR_Handler install_isr(IRQn_Type irq, pfnISR_Handler newHandler) {
isrtab[irq + 16] = newHandler;

// Reenable interrupts
CRITICAL_SECTION_END;
CRITICAL_SECTION_END();

// Return the original one
return oldHandler;
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_ESP32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ extern portMUX_TYPE spinlock;
#define NUM_SERIAL 1
#endif

#define CRITICAL_SECTION_START portENTER_CRITICAL(&spinlock)
#define CRITICAL_SECTION_END portEXIT_CRITICAL(&spinlock)
#define CRITICAL_SECTION_START() portENTER_CRITICAL(&spinlock)
#define CRITICAL_SECTION_END() portEXIT_CRITICAL(&spinlock)
#define ISRS_ENABLED() (spinlock.owner == portMUX_FREE_VAL)
#define ENABLE_ISRS() if (spinlock.owner != portMUX_FREE_VAL) portEXIT_CRITICAL(&spinlock)
#define DISABLE_ISRS() portENTER_CRITICAL(&spinlock)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_LINUX/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ extern HalSerial usb_serial;
//
// Interrupts
//
#define CRITICAL_SECTION_START
#define CRITICAL_SECTION_END
#define CRITICAL_SECTION_START()
#define CRITICAL_SECTION_END()
#define ISRS_ENABLED()
#define ENABLE_ISRS()
#define DISABLE_ISRS()
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_LPC1768/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ extern "C" volatile uint32_t _millis;
//
// Interrupts
//
#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END() if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_SAMD51/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ typedef int8_t pin_t;
//
// Interrupts
//
#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END() if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_SAMD51/fastio.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@
const EPortType port = (EPortType)GET_SAMD_PORT(IO); \
const uint32_t pin = GET_SAMD_PIN(IO); \
\
PORT->Group[port].PINCFG[pin].reg = (uint8_t)(PORT_PINCFG_INEN); \
PORT->Group[port].DIRSET.reg = MASK(pin); \
PORT->Group[port].PINCFG[pin].reg = 0; \
}while(0)
// Set pin as output (open drain)
#define SET_OUTPUT_OD(IO) do{ \
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/HAL_SAMD51/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#endif

#if ENABLED(EEPROM_SETTINGS) && NONE(SPI_EEPROM, I2C_EEPROM)
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Activator"
#warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Manager/releases"
#endif

#if HAS_TMC_SW_SERIAL
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_STM32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@
#define analogInputToDigitalPin(p) (p)
#endif

#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END() if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_STM32F1/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ void HAL_idletask();
#define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != nullptr)
#endif

#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); (void)__iCliRetVal()
#define CRITICAL_SECTION_END if (!primask) (void)__iSeiRetVal()
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); (void)__iCliRetVal()
#define CRITICAL_SECTION_END() if (!primask) (void)__iSeiRetVal()
#define ISRS_ENABLED() (!__get_primask())
#define ENABLE_ISRS() ((void)__iSeiRetVal())
#define DISABLE_ISRS() ((void)__iCliRetVal())
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_STM32_F4_F7/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@
#define analogInputToDigitalPin(p) (p)
#endif

#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END() if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_TEENSY31_32/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ typedef int8_t pin_t;
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif

#define CRITICAL_SECTION_START uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define CRITICAL_SECTION_START() uint32_t primask = __get_PRIMASK(); __disable_irq()
#define CRITICAL_SECTION_END() if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_PRIMASK())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/HAL_TEENSY35_36/HAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ typedef int8_t pin_t;
#define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1)
#endif

#define CRITICAL_SECTION_START uint32_t primask = __get_primask(); __disable_irq()
#define CRITICAL_SECTION_END if (!primask) __enable_irq()
#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq()
#define CRITICAL_SECTION_END() if (!primask) __enable_irq()
#define ISRS_ENABLED() (!__get_primask())
#define ENABLE_ISRS() __enable_irq()
#define DISABLE_ISRS() __disable_irq()
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/HAL/shared/servo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ void Servo::writeMicroseconds(int value) {
value = constrain(value, SERVO_MIN(min), SERVO_MAX(max)) - (TRIM_DURATION);
value = usToTicks(value); // convert to ticks after compensating for interrupt overhead - 12 Aug 2009

CRITICAL_SECTION_START;
CRITICAL_SECTION_START();
servo_info[channel].ticks = value;
CRITICAL_SECTION_END;
CRITICAL_SECTION_END();
}
}

Expand Down
20 changes: 10 additions & 10 deletions Marlin/src/feature/Max7219_Debug_LEDs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ uint8_t Max7219::led_line[MAX7219_LINES]; // = { 0 };
#define SIG_DELAY() DELAY_US(1) // Approximate a 1µs delay on 32-bit ARM
#undef CRITICAL_SECTION_START
#undef CRITICAL_SECTION_END
#define CRITICAL_SECTION_START NOOP
#define CRITICAL_SECTION_END NOOP
#define CRITICAL_SECTION_START() NOOP
#define CRITICAL_SECTION_END() NOOP
#else
#define SIG_DELAY() DELAY_NS(188) // Delay for 0.1875µs (16MHz AVR) or 0.15µs (20MHz AVR)
#endif
Expand Down Expand Up @@ -163,7 +163,7 @@ inline uint32_t flipped(const uint32_t bits, const uint8_t n_bytes) {
}

void Max7219::noop() {
CRITICAL_SECTION_START;
CRITICAL_SECTION_START();
SIG_DELAY();
WRITE(MAX7219_DIN_PIN, LOW);
for (uint8_t i = 16; i--;) {
Expand All @@ -174,11 +174,11 @@ void Max7219::noop() {
WRITE(MAX7219_CLK_PIN, HIGH);
SIG_DELAY();
}
CRITICAL_SECTION_END;
CRITICAL_SECTION_END();
}

void Max7219::putbyte(uint8_t data) {
CRITICAL_SECTION_START;
CRITICAL_SECTION_START();
for (uint8_t i = 8; i--;) {
SIG_DELAY();
WRITE(MAX7219_CLK_PIN, LOW); // tick
Expand All @@ -189,7 +189,7 @@ void Max7219::putbyte(uint8_t data) {
SIG_DELAY();
data <<= 1;
}
CRITICAL_SECTION_END;
CRITICAL_SECTION_END();
}

void Max7219::pulse_load() {
Expand All @@ -202,12 +202,12 @@ void Max7219::pulse_load() {

void Max7219::send(const uint8_t reg, const uint8_t data) {
SIG_DELAY();
CRITICAL_SECTION_START;
CRITICAL_SECTION_START();
SIG_DELAY();
putbyte(reg); // specify register
SIG_DELAY();
putbyte(data); // put data
CRITICAL_SECTION_END;
CRITICAL_SECTION_END();
}

// Send out a single native row of bits to just one unit
Expand Down Expand Up @@ -574,14 +574,14 @@ void Max7219::idle_tasks() {
#define MAX7219_USE_HEAD (defined(MAX7219_DEBUG_PLANNER_HEAD) || defined(MAX7219_DEBUG_PLANNER_QUEUE))
#define MAX7219_USE_TAIL (defined(MAX7219_DEBUG_PLANNER_TAIL) || defined(MAX7219_DEBUG_PLANNER_QUEUE))
#if MAX7219_USE_HEAD || MAX7219_USE_TAIL
CRITICAL_SECTION_START;
CRITICAL_SECTION_START();
#if MAX7219_USE_HEAD
const uint8_t head = planner.block_buffer_head;
#endif
#if MAX7219_USE_TAIL
const uint8_t tail = planner.block_buffer_tail;
#endif
CRITICAL_SECTION_END;
CRITICAL_SECTION_END();
#endif

#if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE)
Expand Down
15 changes: 13 additions & 2 deletions Marlin/src/gcode/host/M115.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,26 @@
#endif

/**
* M115: Capabilities string
* M115: Capabilities string and extended capabilities report
* If a capability is not reported, hosts should assume
* the capability is not present.
*/
void GcodeSuite::M115() {

SERIAL_ECHOLNPGM(MSG_M115_REPORT);

#if ENABLED(EXTENDED_CAPABILITIES_REPORT)

// PAREN_COMMENTS
#if ENABLED(PAREN_COMMENTS)
cap_line(PSTR("PAREN_COMMENTS"), true);
#endif

// QUOTED_STRINGS
#if ENABLED(GCODE_QUOTED_STRINGS)
cap_line(PSTR("QUOTED_STRINGS"), true);
#endif

// SERIAL_XON_XOFF
cap_line(PSTR("SERIAL_XON_XOFF")
#if ENABLED(SERIAL_XON_XOFF)
Expand Down Expand Up @@ -171,6 +183,5 @@ void GcodeSuite::M115() {
#endif
);


#endif // EXTENDED_CAPABILITIES_REPORT
}
Loading

0 comments on commit b226623

Please sign in to comment.