diff --git a/.gitignore b/.gitignore index cc62436997..bd07c9ce7a 100755 --- a/.gitignore +++ b/.gitignore @@ -158,9 +158,7 @@ vc-fileutils.settings #Visual Studio Code .vscode - -#Visual Studio Code -.vscode +.vscode/c_cpp_properties.json #cmake CMakeLists.txt diff --git a/.travis.yml b/.travis.yml index b9ef8e1e24..ec18ba2316 100644 --- a/.travis.yml +++ b/.travis.yml @@ -61,7 +61,7 @@ script: - opt_set TEMP_SENSOR_BED 1 - opt_enable PIDTEMPBED Z_SAFE_HOMING ARC_P_CIRCLES CNC_WORKSPACE_PLANES - opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT EEPROM_SETTINGS - - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_RGBW_LED + - opt_enable BLINKM PCA9632 RGB_LED NEOPIXEL_LED - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} # @@ -436,3 +436,14 @@ script: - pins_set RAMPS X_MAX_PIN -1 - opt_set_adv Z2_MAX_PIN 2 - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} + + ############################# + # LPC1768 default config test + ############################# + + - export TEST_PLATFORM="-e LPC1768" + - restore_configs + - opt_set MOTHERBOARD BOARD_RAMPS_14_RE_ARM_EFB + - cp Marlin/Configuration.h Marlin/src/config/default/Configuration.h + - cp Marlin/Configuration_adv.h Marlin/src/config/default/Configuration_adv.h + - build_marlin_pio ${TRAVIS_BUILD_DIR} ${TEST_PLATFORM} diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e02f120420..0a5a049818 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 14c0fd8208..e6c0a1c2dd 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -628,7 +637,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/HAL/HAL_AVR/HAL_AVR.h b/Marlin/src/HAL/HAL_AVR/HAL_AVR.h index 60a73581c0..42bd6680a1 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/HAL_AVR.h @@ -66,9 +66,11 @@ // Types // -------------------------------------------------------------------------- -#define HAL_TIMER_TYPE uint16_t +typedef uint16_t timer_t; #define HAL_TIMER_TYPE_MAX 0xFFFF +typedef int8_t pin_t; + #define HAL_SERVO_LIB Servo // -------------------------------------------------------------------------- @@ -153,4 +155,10 @@ inline void HAL_adc_init(void) { #define HAL_READ_ADC ADC +#define GET_PIN_MAP_PIN(index) index +#define GET_PIN_MAP_INDEX(pin) pin +#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) + +#define HAL_SENSITIVE_PINS 0, 1 + #endif // _HAL_AVR_H_ diff --git a/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h b/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h index a278c08b99..87b9693000 100644 --- a/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h +++ b/Marlin/src/HAL/HAL_AVR/HAL_pinsDebug_AVR.h @@ -82,7 +82,7 @@ void HAL_analog_pin_state(char buffer[], int8_t pin) { typedef struct { const char * const name; - uint8_t pin; + pin_t pin; bool is_digital; } PinInfo; @@ -457,7 +457,7 @@ static void print_input_or_output(const bool isout) { } // pretty report with PWM info -inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false, const char *start_string = "") { +inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = false, const char *start_string = "") { uint8_t temp_char; char *name_mem_pointer, buffer[30]; // for the sprintf statements bool found = false, multi_name_pin = false; diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp index 88258e119e..025254481e 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp @@ -84,7 +84,7 @@ // Currently looking for: M108, M112, M410 // If you alter the parser please don't forget to update the capabilities in Conditionals_post.h - FORCE_INLINE void emergency_parser(const unsigned char c) { + FORCE_INLINE void emergency_parser(const uint8_t c) { static e_parser_state state = state_RESET; @@ -169,13 +169,16 @@ #endif // EMERGENCY_PARSER FORCE_INLINE void store_rxd_char() { + const ring_buffer_pos_t h = rx_buffer.head, i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + // Read the character + const uint8_t c = M_UDRx; + // If the character is to be stored at the index just before the tail // (such that the head would advance to the current tail), the buffer is // critical, so don't write the character or advance the head. - const char c = M_UDRx; if (i != rx_buffer.tail) { rx_buffer.buffer[h] = c; rx_buffer.head = i; @@ -194,6 +197,7 @@ #endif #if ENABLED(SERIAL_XON_XOFF) + // for high speed transfers, we can use XON/XOFF protocol to do // software handshake and avoid overruns. if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) { diff --git a/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h b/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h index 595283f9c7..60a98446a9 100644 --- a/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h +++ b/Marlin/src/HAL/HAL_AVR/pinsDebug_AVR_8_bit.h @@ -397,6 +397,6 @@ static void pwm_details(uint8_t pin) { #endif -#define GET_PIN_INFO(pin) do{}while(0) +#define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer);} while (0) #endif // _PINSDEBUG_AVR_8_BIT_ diff --git a/Marlin/src/HAL/HAL_DUE/HAL_Due.h b/Marlin/src/HAL/HAL_DUE/HAL_Due.h index 9c6721b8a1..0aa7ab4377 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_Due.h @@ -29,37 +29,35 @@ #ifndef _HAL_DUE_H #define _HAL_DUE_H -// -------------------------------------------------------------------------- -// Includes -// -------------------------------------------------------------------------- - #include #include "Arduino.h" #include "fastio_Due.h" #include "watchdog_Due.h" - #include "HAL_timers_Due.h" -// -------------------------------------------------------------------------- +// // Defines -// -------------------------------------------------------------------------- +// #if SERIAL_PORT == -1 #define MYSERIAL SerialUSB #elif SERIAL_PORT == 0 - #define MYSERIAL Serial + #define MYSERIAL customizedSerial #elif SERIAL_PORT == 1 - #define MYSERIAL Serial1 + #define MYSERIAL customizedSerial #elif SERIAL_PORT == 2 - #define MYSERIAL Serial2 + #define MYSERIAL customizedSerial #elif SERIAL_PORT == 3 - #define MYSERIAL Serial3 + #define MYSERIAL customizedSerial #endif #define _BV(bit) (1 << (bit)) +// We need the previous define before the include, or compilation bombs... +#include "MarlinSerial_Due.h" + #ifndef analogInputToDigitalPin #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1) #endif @@ -96,51 +94,49 @@ // Types // -------------------------------------------------------------------------- +typedef int8_t pin_t; // -------------------------------------------------------------------------- // Public Variables // -------------------------------------------------------------------------- -/** result of last ADC conversion */ -extern uint16_t HAL_adc_result; +extern uint16_t HAL_adc_result; // result of last ADC conversion -// -------------------------------------------------------------------------- -// Public functions -// -------------------------------------------------------------------------- +void cli(void); // Disable interrupts +void sei(void); // Enable interrupts -// Disable interrupts -void cli(void); - -// Enable interrupts -void sei(void); - -/** clear reset reason */ -void HAL_clear_reset_source (void); - -/** reset reason */ -uint8_t HAL_get_reset_source (void); +void HAL_clear_reset_source(void); // clear reset reason +uint8_t HAL_get_reset_source(void); // get reset reason void _delay_ms(const int delay); int freeMemory(void); -// SPI: Extended functions which take a channel number (hardware SPI only) -/** Write single byte to specified SPI channel */ +/** + * SPI: Extended functions taking a channel number (hardware SPI only) + */ + +// Write single byte to specified SPI channel void spiSend(uint32_t chan, byte b); -/** Write buffer to specified SPI channel */ + +// Write buffer to specified SPI channel void spiSend(uint32_t chan, const uint8_t* buf, size_t n); -/** Read single byte from specified SPI channel */ + +// Read single byte from specified SPI channel uint8_t spiRec(uint32_t chan); +/** + * EEPROM + */ -// EEPROM void eeprom_write_byte(unsigned char *pos, unsigned char value); unsigned char eeprom_read_byte(unsigned char *pos); void eeprom_read_block (void *__dst, const void *__src, size_t __n); void eeprom_update_block (const void *__src, void *__dst, size_t __n); - -// ADC +/** + * ADC + */ #define HAL_ANALOG_SELECT(pin) @@ -149,27 +145,18 @@ inline void HAL_adc_init(void) {}//todo #define HAL_START_ADC(pin) HAL_adc_start_conversion(pin) #define HAL_READ_ADC HAL_adc_result - void HAL_adc_start_conversion(const uint8_t adc_pin); - uint16_t HAL_adc_get_result(void); - -// uint16_t HAL_getAdcReading(uint8_t chan); - void HAL_startAdcConversion(uint8_t chan); uint8_t HAL_pinToAdcChannel(int pin); - uint16_t HAL_getAdcFreerun(uint8_t chan, bool wait_for_conversion = false); //uint16_t HAL_getAdcSuperSample(uint8_t chan); - void HAL_enable_AdcFreerun(void); //void HAL_disable_AdcFreerun(uint8_t chan); - -// -------------------------------------------------------------------------- -// -// -------------------------------------------------------------------------- +#define GET_PIN_MAP_PIN(index) index +#define GET_PIN_MAP_INDEX(pin) pin +#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) #endif // _HAL_DUE_H - diff --git a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h index 5dfd42ce94..733c92e2c8 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h +++ b/Marlin/src/HAL/HAL_DUE/HAL_timers_Due.h @@ -40,7 +40,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline -#define HAL_TIMER_TYPE uint32_t +typedef uint32_t timer_t; #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF #define STEP_TIMER_NUM 3 // index of timer to use for stepper @@ -92,7 +92,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count; } -static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_count(const uint8_t timer_num) { +static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) { const tTimerConfig *pConfig = &TimerConfig[timer_num]; return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC; } diff --git a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp new file mode 100644 index 0000000000..0a46776110 --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.cpp @@ -0,0 +1,95 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * InterruptVectors_Due.cpp - This module relocates the Interrupt vector table to SRAM, + * allowing to register new interrupt handlers at runtime. Specially valuable and needed + * because Arduino runtime allocates some interrupt handlers that we NEED to override to + * properly support extended functionality, as for example, USB host or USB device (MSD, MTP) + * and custom serial port handlers, and we don't actually want to modify and/or recompile the + * Arduino runtime. We just want to run as much as possible on Stock Arduino + * + * Copyright (c) 2017 Eduardo José Tagle. All right reserved + */ +#ifdef ARDUINO_ARCH_SAM + +#include "HAL_Due.h" +#include "InterruptVectors_Due.h" + +/* The relocated Exception/Interrupt Table - Must be aligned to 128bytes, + as bits 0-6 on VTOR register are reserved and must be set to 0 */ +__attribute__ ((aligned(128))) +static DeviceVectors ram_tab = { NULL }; + +/** + * This function checks if the exception/interrupt table is already in SRAM or not. + * If it is not, then it copies the ROM table to the SRAM and relocates the table + * by reprogramming the NVIC registers + */ +static pfnISR_Handler* get_relocated_table_addr(void) { + // Get the address of the interrupt/exception table + uint32_t isrtab = SCB->VTOR; + + // If already relocated, we are done! + if (isrtab >= IRAM0_ADDR) + return (pfnISR_Handler*)isrtab; + + // Get the address of the table stored in FLASH + const pfnISR_Handler* romtab = (const pfnISR_Handler*)isrtab; + + // Copy it to SRAM + memcpy(&ram_tab, romtab, sizeof(ram_tab)); + + // Disable global interrupts + CRITICAL_SECTION_START; + + // Set the vector table base address to the SRAM copy + SCB->VTOR = (uint32_t)(&ram_tab); + + // Reenable interrupts + CRITICAL_SECTION_END; + + // Return the address of the table + return (pfnISR_Handler*)(&ram_tab); +} + +pfnISR_Handler install_isr(IRQn_Type irq, pfnISR_Handler newHandler) { + // Get the address of the relocated table + const pfnISR_Handler *isrtab = get_relocated_table_addr(); + + // Disable global interrupts + CRITICAL_SECTION_START; + + // Get the original handler + pfnISR_Handler oldHandler = isrtab[irq + 16]; + + // Install the new one + isrtab[irq + 16] = newHandler; + + // Reenable interrupts + CRITICAL_SECTION_END; + + // Return the original one + return oldHandler; +} + +#endif diff --git a/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h new file mode 100644 index 0000000000..efc63de25d --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/InterruptVectors_Due.h @@ -0,0 +1,52 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * InterruptVectors_Due.h + * + * Copyright (c) 2017 Eduardo José Tagle. All right reserved + * + * This module relocates the Interrupt vector table to SRAM, allowing new + * interrupt handlers to be added at runtime. This is required because the + * Arduino runtime steals interrupt handlers that Marlin MUST use to support + * extended functionality such as USB hosts and USB devices (MSD, MTP) and + * custom serial port handlers. Rather than modifying and/or recompiling the + * Arduino runtime, We just want to run as much as possible on Stock Arduino. + * + * Copyright (c) 2017 Eduardo José Tagle. All right reserved + */ + +#ifndef INTERRUPTVECTORS_DUE_H +#define INTERRUPTVECTORS_DUE_H + +#include "../../inc/MarlinConfig.h" + +#ifdef ARDUINO_ARCH_SAM + +// ISR handler type +typedef void (*pfnISR_Handler)(void); + +// Install a new interrupt vector handler for the given irq, returning the old one +pfnISR_Handler install_isr(IRQn_Type irq, pfnISR_Handler newHandler); + +#endif // ARDUINO_ARCH_SAM +#endif // INTERRUPTVECTORS_DUE_H diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp new file mode 100644 index 0000000000..0acfb9942c --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.cpp @@ -0,0 +1,680 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * MarlinSerial_Due.cpp - Hardware serial library for Arduino DUE + * Copyright (c) 2017 Eduardo José Tagle. All right reserved + * Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved. + */ +#ifdef ARDUINO_ARCH_SAM + +#include "../../inc/MarlinConfig.h" + +#include "MarlinSerial_Due.h" +#include "InterruptVectors_Due.h" +#include "../../Marlin.h" + +// Based on selected port, use the proper configuration +#if SERIAL_PORT == 0 + #define HWUART UART + #define HWUART_IRQ UART_IRQn + #define HWUART_IRQ_ID ID_UART +#elif SERIAL_PORT == 1 + #define HWUART USART0 + #define HWUART_IRQ USART0_IRQn + #define HWUART_IRQ_ID ID_USART0 +#elif SERIAL_PORT == 2 + #define HWUART USART1 + #define HWUART_IRQ USART1_IRQn + #define HWUART_IRQ_ID ID_USART1 +#elif SERIAL_PORT == 3 + #define HWUART USART3 + #define HWUART_IRQ USART3_IRQn + #define HWUART_IRQ_ID ID_USART3 +#endif + +struct ring_buffer_r { + unsigned char buffer[RX_BUFFER_SIZE]; + volatile ring_buffer_pos_t head, tail; +}; + +#if TX_BUFFER_SIZE > 0 + struct ring_buffer_t { + unsigned char buffer[TX_BUFFER_SIZE]; + volatile uint8_t head, tail; + }; +#endif + +ring_buffer_r rx_buffer = { { 0 }, 0, 0 }; +#if TX_BUFFER_SIZE > 0 + ring_buffer_t tx_buffer = { { 0 }, 0, 0 }; + static bool _written; +#endif + +#if ENABLED(SERIAL_XON_XOFF) + constexpr uint8_t XON_XOFF_CHAR_SENT = 0x80; // XON / XOFF Character was sent + constexpr uint8_t XON_XOFF_CHAR_MASK = 0x1F; // XON / XOFF character to send + // XON / XOFF character definitions + constexpr uint8_t XON_CHAR = 17; + constexpr uint8_t XOFF_CHAR = 19; + uint8_t xon_xoff_state = XON_XOFF_CHAR_SENT | XON_CHAR; + + // Validate that RX buffer size is at least 4096 bytes- According to several experiments, on + // the original Arduino Due that uses a ATmega16U2 as USB to serial bridge, due to the introduced + // latencies, at least 2959 bytes of RX buffering (when transmitting at 250kbits/s) are required + // to avoid overflows. + + #if RX_BUFFER_SIZE < 4096 + #error Arduino DUE requires at least 4096 bytes of RX buffer to avoid buffer overflows when using XON/XOFF handshake + #endif +#endif + +#if ENABLED(SERIAL_STATS_DROPPED_RX) + uint8_t rx_dropped_bytes = 0; +#endif + +#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + ring_buffer_pos_t rx_max_enqueued = 0; +#endif + +// A SW memory barrier, to ensure GCC does not overoptimize loops +#define sw_barrier() asm volatile("": : :"memory"); + +#if ENABLED(EMERGENCY_PARSER) + + #include "../../module/stepper.h" + + // Currently looking for: M108, M112, M410 + // If you alter the parser please don't forget to update the capabilities in Conditionals_post.h + + FORCE_INLINE void emergency_parser(const uint8_t c) { + + static e_parser_state state = state_RESET; + + switch (state) { + case state_RESET: + switch (c) { + case ' ': break; + case 'N': state = state_N; break; + case 'M': state = state_M; break; + default: state = state_IGNORE; + } + break; + + case state_N: + switch (c) { + case '0': case '1': case '2': + case '3': case '4': case '5': + case '6': case '7': case '8': + case '9': case '-': case ' ': break; + case 'M': state = state_M; break; + default: state = state_IGNORE; + } + break; + + case state_M: + switch (c) { + case ' ': break; + case '1': state = state_M1; break; + case '4': state = state_M4; break; + default: state = state_IGNORE; + } + break; + + case state_M1: + switch (c) { + case '0': state = state_M10; break; + case '1': state = state_M11; break; + default: state = state_IGNORE; + } + break; + + case state_M10: + state = (c == '8') ? state_M108 : state_IGNORE; + break; + + case state_M11: + state = (c == '2') ? state_M112 : state_IGNORE; + break; + + case state_M4: + state = (c == '1') ? state_M41 : state_IGNORE; + break; + + case state_M41: + state = (c == '0') ? state_M410 : state_IGNORE; + break; + + case state_IGNORE: + if (c == '\n') state = state_RESET; + break; + + default: + if (c == '\n') { + switch (state) { + case state_M108: + wait_for_user = wait_for_heatup = false; + break; + case state_M112: + kill(PSTR(MSG_KILLED)); + break; + case state_M410: + quickstop_stepper(); + break; + default: + break; + } + state = state_RESET; + } + } + } + +#endif // EMERGENCY_PARSER + +FORCE_INLINE void store_rxd_char() { + + const ring_buffer_pos_t h = rx_buffer.head, + i = (ring_buffer_pos_t)(h + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + + // Read the character + const uint8_t c = HWUART->UART_RHR; + + // If the character is to be stored at the index just before the tail + // (such that the head would advance to the current tail), the buffer is + // critical, so don't write the character or advance the head. + if (i != rx_buffer.tail) { + rx_buffer.buffer[h] = c; + rx_buffer.head = i; + } + #if ENABLED(SERIAL_STATS_DROPPED_RX) + else if (!++rx_dropped_bytes) ++rx_dropped_bytes; + #endif + +#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + // calculate count of bytes stored into the RX buffer + ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + // Keep track of the maximum count of enqueued bytes + NOLESS(rx_max_enqueued, rx_count); +#endif + +#if ENABLED(SERIAL_XON_XOFF) + + // for high speed transfers, we can use XON/XOFF protocol to do + // software handshake and avoid overruns. + if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XON_CHAR) { + + // calculate count of bytes stored into the RX buffer + ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + + // if we are above 12.5% of RX buffer capacity, send XOFF before + // we run out of RX buffer space .. We need 325 bytes @ 250kbits/s to + // let the host react and stop sending bytes. This translates to 13mS + // propagation time. + if (rx_count >= (RX_BUFFER_SIZE) / 8) { + // If TX interrupts are disabled and data register is empty, + // just write the byte to the data register and be done. This + // shortcut helps significantly improve the effective datarate + // at high (>500kbit/s) bitrates, where interrupt overhead + // becomes a slowdown. + if (!(HWUART->UART_IMR & UART_IMR_TXRDY) && (HWUART->UART_SR & UART_SR_TXRDY)) { + // Send an XOFF character + HWUART->UART_THR = XOFF_CHAR; + + // And remember it was sent + xon_xoff_state = XOFF_CHAR | XON_XOFF_CHAR_SENT; + } + else { + // TX interrupts disabled, but buffer still not empty ... or + // TX interrupts enabled. Reenable TX ints and schedule XOFF + // character to be sent + #if TX_BUFFER_SIZE > 0 + HWUART->UART_IER = UART_IER_TXRDY; + xon_xoff_state = XOFF_CHAR; + #else + // We are not using TX interrupts, we will have to send this manually + while (!(HWUART->UART_SR & UART_SR_TXRDY)) { sw_barrier(); }; + HWUART->UART_THR = XOFF_CHAR; + // And remember we already sent it + xon_xoff_state = XOFF_CHAR | XON_XOFF_CHAR_SENT; + #endif + } + } + } +#endif // SERIAL_XON_XOFF + +#if ENABLED(EMERGENCY_PARSER) + emergency_parser(c); +#endif +} + +#if TX_BUFFER_SIZE > 0 + + FORCE_INLINE void _tx_thr_empty_irq(void) { + // If interrupts are enabled, there must be more data in the output + // buffer. + + #if ENABLED(SERIAL_XON_XOFF) + // Do a priority insertion of an XON/XOFF char, if needed. + const uint8_t state = xon_xoff_state; + if (!(state & XON_XOFF_CHAR_SENT)) { + HWUART->UART_THR = state & XON_XOFF_CHAR_MASK; + xon_xoff_state = state | XON_XOFF_CHAR_SENT; + } + else + #endif + { // Send the next byte + const uint8_t t = tx_buffer.tail, c = tx_buffer.buffer[t]; + tx_buffer.tail = (t + 1) & (TX_BUFFER_SIZE - 1); + HWUART->UART_THR = c; + } + + // Disable interrupts if the buffer is empty + if (tx_buffer.head == tx_buffer.tail) + HWUART->UART_IDR = UART_IDR_TXRDY; + } + +#endif // TX_BUFFER_SIZE + +static void UART_ISR(void) { + uint32_t status = HWUART->UART_SR; + + // Did we receive data? + if (status & UART_SR_RXRDY) + store_rxd_char(); + + #if TX_BUFFER_SIZE > 0 + // Do we have something to send, and TX interrupts are enabled (meaning something to send) ? + if ((status & UART_SR_TXRDY) && (HWUART->UART_IMR & UART_IMR_TXRDY)) + _tx_thr_empty_irq(); + #endif + + // Acknowledge errors + if ((status & UART_SR_OVRE) || (status & UART_SR_FRAME)) { + // TODO: error reporting outside ISR + HWUART->UART_CR = UART_CR_RSTSTA; + } +} + +// Public Methods + +void MarlinSerial::begin(const long baud_setting) { + + // Disable UART interrupt in NVIC + NVIC_DisableIRQ( HWUART_IRQ ); + + // Disable clock + pmc_disable_periph_clk( HWUART_IRQ_ID ); + + // Configure PMC + pmc_enable_periph_clk( HWUART_IRQ_ID ); + + // Disable PDC channel + HWUART->UART_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS; + + // Reset and disable receiver and transmitter + HWUART->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS; + + // Configure mode: 8bit, No parity, 1 bit stop + HWUART->UART_MR = UART_MR_CHMODE_NORMAL | US_MR_CHRL_8_BIT | US_MR_NBSTOP_1_BIT | UART_MR_PAR_NO; + + // Configure baudrate (asynchronous, no oversampling) + HWUART->UART_BRGR = (SystemCoreClock / (baud_setting << 4)); + + // Configure interrupts + HWUART->UART_IDR = 0xFFFFFFFF; + HWUART->UART_IER = UART_IER_RXRDY | UART_IER_OVRE | UART_IER_FRAME; + + // Install interrupt handler + install_isr(HWUART_IRQ, UART_ISR); + + // Enable UART interrupt in NVIC + NVIC_EnableIRQ(HWUART_IRQ); + + // Enable receiver and transmitter + HWUART->UART_CR = UART_CR_RXEN | UART_CR_TXEN; + + #if TX_BUFFER_SIZE > 0 + _written = false; + #endif +} + +void MarlinSerial::end() { + // Disable UART interrupt in NVIC + NVIC_DisableIRQ( HWUART_IRQ ); + + pmc_disable_periph_clk( HWUART_IRQ_ID ); +} + +void MarlinSerial::checkRx(void) { + if (HWUART->UART_SR & UART_SR_RXRDY) { + CRITICAL_SECTION_START; + store_rxd_char(); + CRITICAL_SECTION_END; + } +} + +int MarlinSerial::peek(void) { + CRITICAL_SECTION_START; + const int v = rx_buffer.head == rx_buffer.tail ? -1 : rx_buffer.buffer[rx_buffer.tail]; + CRITICAL_SECTION_END; + return v; +} + +int MarlinSerial::read(void) { + int v; + CRITICAL_SECTION_START; + const ring_buffer_pos_t t = rx_buffer.tail; + if (rx_buffer.head == t) + v = -1; + else { + v = rx_buffer.buffer[t]; + rx_buffer.tail = (ring_buffer_pos_t)(t + 1) & (RX_BUFFER_SIZE - 1); + + #if ENABLED(SERIAL_XON_XOFF) + if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { + // Get count of bytes in the RX buffer + ring_buffer_pos_t rx_count = (ring_buffer_pos_t)(rx_buffer.head - rx_buffer.tail) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); + // When below 10% of RX buffer capacity, send XON before + // running out of RX buffer bytes + if (rx_count < (RX_BUFFER_SIZE) / 10) { + xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; + CRITICAL_SECTION_END; // End critical section before returning! + writeNoHandshake(XON_CHAR); + return v; + } + } + #endif + } + CRITICAL_SECTION_END; + return v; +} + +ring_buffer_pos_t MarlinSerial::available(void) { + CRITICAL_SECTION_START; + const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail; + CRITICAL_SECTION_END; + return (ring_buffer_pos_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1); +} + +void MarlinSerial::flush(void) { + // Don't change this order of operations. If the RX interrupt occurs between + // reading rx_buffer_head and updating rx_buffer_tail, the previous rx_buffer_head + // may be written to rx_buffer_tail, making the buffer appear full rather than empty. + CRITICAL_SECTION_START; + rx_buffer.head = rx_buffer.tail; + CRITICAL_SECTION_END; + +#if ENABLED(SERIAL_XON_XOFF) + if ((xon_xoff_state & XON_XOFF_CHAR_MASK) == XOFF_CHAR) { + xon_xoff_state = XON_CHAR | XON_XOFF_CHAR_SENT; + writeNoHandshake(XON_CHAR); + } +#endif +} + +#if TX_BUFFER_SIZE > 0 + uint8_t MarlinSerial::availableForWrite(void) { + CRITICAL_SECTION_START; + const uint8_t h = tx_buffer.head, t = tx_buffer.tail; + CRITICAL_SECTION_END; + return (uint8_t)(TX_BUFFER_SIZE + h - t) & (TX_BUFFER_SIZE - 1); + } + + void MarlinSerial::write(const uint8_t c) { + #if ENABLED(SERIAL_XON_XOFF) + const uint8_t state = xon_xoff_state; + if (!(state & XON_XOFF_CHAR_SENT)) { + // Send 2 chars: XON/XOFF, then a user-specified char + writeNoHandshake(state & XON_XOFF_CHAR_MASK); + xon_xoff_state = state | XON_XOFF_CHAR_SENT; + } + #endif + writeNoHandshake(c); + } + + void MarlinSerial::writeNoHandshake(const uint8_t c) { + _written = true; + CRITICAL_SECTION_START; + bool emty = (tx_buffer.head == tx_buffer.tail); + CRITICAL_SECTION_END; + // If the buffer and the data register is empty, just write the byte + // to the data register and be done. This shortcut helps + // significantly improve the effective datarate at high (> + // 500kbit/s) bitrates, where interrupt overhead becomes a slowdown. + if (emty && (HWUART->UART_SR & UART_SR_TXRDY)) { + CRITICAL_SECTION_START; + HWUART->UART_THR = c; + HWUART->UART_IER = UART_IER_TXRDY; + CRITICAL_SECTION_END; + return; + } + const uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1); + + // If the output buffer is full, there's nothing for it other than to + // wait for the interrupt handler to empty it a bit + while (i == tx_buffer.tail) { + if (__get_PRIMASK()) { + // Interrupts are disabled, so we'll have to poll the data + // register empty flag ourselves. If it is set, pretend an + // interrupt has happened and call the handler to free up + // space for us. + if (HWUART->UART_SR & UART_SR_TXRDY) + _tx_thr_empty_irq(); + } + else { + // nop, the interrupt handler will free up space for us + } + sw_barrier(); + } + + tx_buffer.buffer[tx_buffer.head] = c; + { CRITICAL_SECTION_START; + tx_buffer.head = i; + HWUART->UART_IER = UART_IER_TXRDY; + CRITICAL_SECTION_END; + } + return; + } + + void MarlinSerial::flushTX(void) { + // TX + // If we have never written a byte, no need to flush. + if (!_written) + return; + + while ((HWUART->UART_IMR & UART_IMR_TXRDY) || !(HWUART->UART_SR & UART_SR_TXEMPTY)) { + if (__get_PRIMASK()) + if ((HWUART->UART_SR & UART_SR_TXRDY)) + _tx_thr_empty_irq(); + sw_barrier(); + } + // If we get here, nothing is queued anymore (TX interrupts are disabled) and + // the hardware finished tranmission (TXEMPTY is set). + } + +#else // TX_BUFFER_SIZE == 0 + + void MarlinSerial::write(const uint8_t c) { + #if ENABLED(SERIAL_XON_XOFF) + // Do a priority insertion of an XON/XOFF char, if needed. + const uint8_t state = xon_xoff_state; + if (!(state & XON_XOFF_CHAR_SENT)) { + writeNoHandshake(state & XON_XOFF_CHAR_MASK); + xon_xoff_state = state | XON_XOFF_CHAR_SENT; + } + #endif + writeNoHandshake(c); + } + + void MarlinSerial::writeNoHandshake(const uint8_t c) { + while (!(HWUART->UART_SR & UART_SR_TXRDY)) { sw_barrier(); }; + HWUART->UART_THR = c; + } + +#endif // TX_BUFFER_SIZE == 0 + +/** +* Imports from print.h +*/ + +void MarlinSerial::print(char c, int base) { + print((long)c, base); +} + +void MarlinSerial::print(unsigned char b, int base) { + print((unsigned long)b, base); +} + +void MarlinSerial::print(int n, int base) { + print((long)n, base); +} + +void MarlinSerial::print(unsigned int n, int base) { + print((unsigned long)n, base); +} + +void MarlinSerial::print(long n, int base) { + if (base == 0) + write(n); + else if (base == 10) { + if (n < 0) { + print('-'); + n = -n; + } + printNumber(n, 10); + } + else + printNumber(n, base); +} + +void MarlinSerial::print(unsigned long n, int base) { + if (base == 0) write(n); + else printNumber(n, base); +} + +void MarlinSerial::print(double n, int digits) { + printFloat(n, digits); +} + +void MarlinSerial::println(void) { + print('\r'); + print('\n'); +} + +void MarlinSerial::println(const String& s) { + print(s); + println(); +} + +void MarlinSerial::println(const char c[]) { + print(c); + println(); +} + +void MarlinSerial::println(char c, int base) { + print(c, base); + println(); +} + +void MarlinSerial::println(unsigned char b, int base) { + print(b, base); + println(); +} + +void MarlinSerial::println(int n, int base) { + print(n, base); + println(); +} + +void MarlinSerial::println(unsigned int n, int base) { + print(n, base); + println(); +} + +void MarlinSerial::println(long n, int base) { + print(n, base); + println(); +} + +void MarlinSerial::println(unsigned long n, int base) { + print(n, base); + println(); +} + +void MarlinSerial::println(double n, int digits) { + print(n, digits); + println(); +} + +// Private Methods + +void MarlinSerial::printNumber(unsigned long n, uint8_t base) { + if (n) { + unsigned char buf[8 * sizeof(long)]; // Enough space for base 2 + int8_t i = 0; + while (n) { + buf[i++] = n % base; + n /= base; + } + while (i--) + print((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10))); + } + else + print('0'); +} + +void MarlinSerial::printFloat(double number, uint8_t digits) { + // Handle negative numbers + if (number < 0.0) { + print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + for (uint8_t i = 0; i < digits; ++i) + rounding *= 0.1; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits) { + print('.'); + // Extract digits from the remainder one at a time + while (digits--) { + remainder *= 10.0; + int toPrint = int(remainder); + print(toPrint); + remainder -= toPrint; + } + } +} + +// Preinstantiate +MarlinSerial customizedSerial; + +#endif // ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h new file mode 100644 index 0000000000..740db4d9c5 --- /dev/null +++ b/Marlin/src/HAL/HAL_DUE/MarlinSerial_Due.h @@ -0,0 +1,142 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * MarlinSerial_Due.h - Hardware serial library for Arduino DUE + * Copyright (c) 2017 Eduardo José Tagle. All right reserved + * Based on MarlinSerial for AVR, copyright (c) 2006 Nicholas Zambetti. All right reserved. + */ + +#ifndef MARLINSERIAL_DUE_H +#define MARLINSERIAL_DUE_H + +#include "../../inc/MarlinConfig.h" + +#include + +#ifndef SERIAL_PORT + #define SERIAL_PORT 0 +#endif + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 +#define BYTE 0 + +// Define constants and variables for buffering incoming serial data. We're +// using a ring buffer (I think), in which rx_buffer_head is the index of the +// location to which to write the next incoming character and rx_buffer_tail +// is the index of the location from which to read. +// 256 is the max limit due to uint8_t head and tail. Use only powers of 2. (...,16,32,64,128,256) +#ifndef RX_BUFFER_SIZE + #define RX_BUFFER_SIZE 128 +#endif +#ifndef TX_BUFFER_SIZE + #define TX_BUFFER_SIZE 32 +#endif + +#if ENABLED(SERIAL_XON_XOFF) && RX_BUFFER_SIZE < 1024 + #error "XON/XOFF requires RX_BUFFER_SIZE >= 1024 for reliable transfers without drops." +#endif + +#if !IS_POWER_OF_2(RX_BUFFER_SIZE) || RX_BUFFER_SIZE < 2 + #error "RX_BUFFER_SIZE must be a power of 2 greater than 1." +#endif + +#if TX_BUFFER_SIZE && (TX_BUFFER_SIZE < 2 || TX_BUFFER_SIZE > 256 || !IS_POWER_OF_2(TX_BUFFER_SIZE)) + #error "TX_BUFFER_SIZE must be 0 or a power of 2 greater than 1." +#endif + +#if RX_BUFFER_SIZE > 256 + typedef uint16_t ring_buffer_pos_t; +#else + typedef uint8_t ring_buffer_pos_t; +#endif + +#if ENABLED(SERIAL_STATS_DROPPED_RX) + extern uint8_t rx_dropped_bytes; +#endif + +#if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + extern ring_buffer_pos_t rx_max_enqueued; +#endif + +class MarlinSerial { + +public: + MarlinSerial() {}; + static void begin(const long); + static void end(); + static int peek(void); + static int read(void); + static void flush(void); + static ring_buffer_pos_t available(void); + static void checkRx(void); + static void write(const uint8_t c); + #if TX_BUFFER_SIZE > 0 + static uint8_t availableForWrite(void); + static void flushTX(void); + #endif + static void writeNoHandshake(const uint8_t c); + + #if ENABLED(SERIAL_STATS_DROPPED_RX) + FORCE_INLINE static uint32_t dropped() { return rx_dropped_bytes; } + #endif + + #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) + FORCE_INLINE static ring_buffer_pos_t rxMaxEnqueued() { return rx_max_enqueued; } + #endif + + static FORCE_INLINE void write(const char* str) { while (*str) write(*str++); } + static FORCE_INLINE void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); } + static FORCE_INLINE void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); } + static FORCE_INLINE void print(const char* str) { write(str); } + + static void print(char, int = BYTE); + static void print(unsigned char, int = BYTE); + static void print(int, int = DEC); + static void print(unsigned int, int = DEC); + static void print(long, int = DEC); + static void print(unsigned long, int = DEC); + static void print(double, int = 2); + + static void println(const String& s); + static void println(const char[]); + static void println(char, int = BYTE); + static void println(unsigned char, int = BYTE); + static void println(int, int = DEC); + static void println(unsigned int, int = DEC); + static void println(long, int = DEC); + static void println(unsigned long, int = DEC); + static void println(double, int = 2); + static void println(void); + operator bool() { return true; } + +private: + static void printNumber(unsigned long, const uint8_t); + static void printFloat(double, uint8_t); +}; + +extern MarlinSerial customizedSerial; + +#endif // MARLINSERIAL_DUE_H diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp index 29c0964e9b..3c852e8e03 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.cpp @@ -81,14 +81,16 @@ void HAL_adc_init(void) { extern void kill(const char*); extern const char errormagic[]; -void HAL_adc_enable_channel(int pin) { - if (!WITHIN(pin, 0, NUM_ANALOG_INPUTS - 1)) { - MYSERIAL.printf("%sINVALID ANALOG PORT:%d\n", errormagic, pin); +void HAL_adc_enable_channel(int ch) { + pin_t pin = analogInputToDigitalPin(ch); + + if (pin == -1) { + MYSERIAL.printf("%sINVALID ANALOG PORT:%d\n", errormagic, ch); kill(MSG_KILLED); } - int8_t pin_port = adc_pin_map[pin].port, - pin_port_pin = adc_pin_map[pin].pin, + int8_t pin_port = LPC1768_PIN_PORT(pin), + pin_port_pin = LPC1768_PIN_PIN(pin), pinsel_start_bit = pin_port_pin > 15 ? 2 * (pin_port_pin - 16) : 2 * pin_port_pin; uint8_t pin_sel_register = (pin_port == 0 && pin_port_pin <= 15) ? 0 : pin_port == 0 ? 1 : @@ -111,15 +113,16 @@ void HAL_adc_enable_channel(int pin) { } uint8_t active_adc = 0; -void HAL_adc_start_conversion(const uint8_t adc_pin) { - if (adc_pin >= (NUM_ANALOG_INPUTS) || adc_pin_map[adc_pin].port == 0xFF) { - MYSERIAL.printf("HAL: HAL_adc_start_conversion: no pinmap for %d\n", adc_pin); +void HAL_adc_start_conversion(const uint8_t ch) { + if (analogInputToDigitalPin(ch) == -1) { + MYSERIAL.printf("HAL: HAL_adc_start_conversion: invalid channel %d\n", ch); return; } - LPC_ADC->ADCR &= ~0xFF; // Reset - SBI(LPC_ADC->ADCR, adc_pin_map[adc_pin].adc); // Select Channel - SBI(LPC_ADC->ADCR, 24); // Start conversion - active_adc = adc_pin; + + LPC_ADC->ADCR &= ~0xFF; // Reset + SBI(LPC_ADC->ADCR, ch); // Select Channel + SBI(LPC_ADC->ADCR, 24); // Start conversion + active_adc = ch; } bool HAL_adc_finished(void) { diff --git a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h index 03d782ba7e..596c526ed7 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL_timers.h @@ -40,7 +40,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline -#define HAL_TIMER_TYPE uint32_t +typedef uint32_t timer_t; #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF #define STEP_TIMER_NUM 0 // index of timer to use for stepper @@ -77,7 +77,7 @@ void HAL_timer_init(void); void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); -static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const HAL_TIMER_TYPE count) { +static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const timer_t count) { switch (timer_num) { case 0: LPC_TIM0->MR0 = count; @@ -92,7 +92,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const HAL_ } } -static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_count(const uint8_t timer_num) { +static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) { switch (timer_num) { case 0: return LPC_TIM0->MR0; case 1: return LPC_TIM1->MR0; @@ -100,7 +100,7 @@ static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_count(const uint8_t timer_num) return 0; } -static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_current_count(const uint8_t timer_num) { +static FORCE_INLINE timer_t HAL_timer_get_current_count(const uint8_t timer_num) { switch (timer_num) { case 0: return LPC_TIM0->TC; case 1: return LPC_TIM1->TC; diff --git a/Marlin/src/HAL/HAL_LPC1768/HardwareSerial.cpp b/Marlin/src/HAL/HAL_LPC1768/HardwareSerial.cpp index cd76e8f704..6e3acb9e30 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HardwareSerial.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/HardwareSerial.cpp @@ -102,7 +102,7 @@ void HardwareSerial::begin(uint32_t baudrate) { // Initialize eripheral with given to corresponding parameter UART_Init(UARTx, &UARTConfigStruct); - + // Enable and reset the TX and RX FIFOs UART_FIFOConfigStructInit(&FIFOConfig); UART_FIFOConfig(UARTx, &FIFOConfig); @@ -113,7 +113,7 @@ void HardwareSerial::begin(uint32_t baudrate) { // Configure Interrupts UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); UART_IntConfig(UARTx, UART_INTCFG_RLS, ENABLE); - + if (UARTx == LPC_UART0) NVIC_EnableIRQ(UART0_IRQn); else if ((LPC_UART1_TypeDef *) UARTx == LPC_UART1) @@ -135,13 +135,13 @@ int HardwareSerial::peek() { /* Temporarily lock out UART receive interrupts during this read so the UART receive interrupt won't cause problems with the index values */ UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE); - + if (RxQueueReadPos != RxQueueWritePos) byte = RxBuffer[RxQueueReadPos]; /* Re-enable UART interrupts */ UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); - + return byte; } @@ -151,7 +151,7 @@ int HardwareSerial::read() { /* Temporarily lock out UART receive interrupts during this read so the UART receive interrupt won't cause problems with the index values */ UART_IntConfig(UARTx, UART_INTCFG_RBR, DISABLE); - + if (RxQueueReadPos != RxQueueWritePos) { byte = RxBuffer[RxQueueReadPos]; RxQueueReadPos = (RxQueueReadPos + 1) % RX_BUFFER_SIZE; @@ -159,7 +159,7 @@ int HardwareSerial::read() { /* Re-enable UART interrupts */ UART_IntConfig(UARTx, UART_INTCFG_RBR, ENABLE); - + return byte; } @@ -170,7 +170,7 @@ size_t HardwareSerial::write(uint8_t send) { /* If the Tx Buffer is full, wait for space to clear */ if ((TxQueueWritePos+1) % TX_BUFFER_SIZE == TxQueueReadPos) flushTX(); - + /* Temporarily lock out UART transmit interrupts during this read so the UART transmit interrupt won't cause problems with the index values */ UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE); @@ -180,7 +180,7 @@ size_t HardwareSerial::write(uint8_t send) { fifolvl = *(reinterpret_cast(&((LPC_UART1_TypeDef *) UARTx)->FIFOLVL)); else fifolvl = *(reinterpret_cast(&UARTx->FIFOLVL)); - + /* If the queue is empty and there's space in the FIFO, immediately send the byte */ if (TxQueueWritePos == TxQueueReadPos && fifolvl < UART_TX_FIFO_SIZE) { bytes = UART_Send(UARTx, &send, 1, BLOCKING); @@ -191,10 +191,10 @@ size_t HardwareSerial::write(uint8_t send) { TxQueueWritePos = (TxQueueWritePos+1) % TX_BUFFER_SIZE; bytes++; } - + /* Re-enable the TX Interrupt */ UART_IntConfig(UARTx, UART_INTCFG_THRE, ENABLE); - + return bytes; #else return UART_Send(UARTx, &send, 1, BLOCKING); @@ -251,7 +251,7 @@ void HardwareSerial::IRQHandler() { return; } } - + if ( IIRValue == UART_IIR_INTID_RDA ) /* Receive Data Available */ { /* Clear the FIFO */ @@ -278,7 +278,7 @@ void HardwareSerial::IRQHandler() { /* Wait for FIFO buffer empty */ while (UART_CheckBusy(UARTx) == SET); - + /* Transfer up to UART_TX_FIFO_SIZE bytes of data */ for (int i = 0; i < UART_TX_FIFO_SIZE && TxQueueWritePos != TxQueueReadPos; i++) { /* Move a piece of data into the transmit FIFO */ @@ -287,7 +287,7 @@ void HardwareSerial::IRQHandler() { else break; } - + /* If there is no more data to send, disable the transmit interrupt - else enable it or keep it enabled */ if (TxQueueWritePos == TxQueueReadPos) UART_IntConfig(UARTx, UART_INTCFG_THRE, DISABLE); diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp new file mode 100644 index 0000000000..65cfb56635 --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.cpp @@ -0,0 +1,509 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * The class Servo uses the PWM class to implement its functions + * + * All PWMs use the same repetition rate - 20mS because that's the normal servo rate +*/ + +/** + * This is a hybrid system. + * + * The PWM1 module is used to directly control the Servo 0, 1 & 3 pins. This keeps + * the pulse width jitter to under a microsecond. + * + * For all other pins the PWM1 module is used to generate interrupts. The ISR + * routine does the actual setting/clearing of pins. The upside is that any pin can + * have a PWM channel assigned to it. The downside is that there is more pulse width + * jitter. The jitter depends on what else is happening in the system and what ISRs + * prempt the PWM ISR. Writing to the SD card can add 20 microseconds to the pulse + * width. + */ + +/** + * The data structures are setup to minimize the computation done by the ISR which + * minimizes ISR execution time. Execution times are 2.2 - 3.7 microseconds. + * + * Two tables are used. active_table is used by the ISR. Changes to the table are + * are done by copying the active_table into the work_table, updating the work_table + * and then swapping the two tables. Swapping is done by manipulating pointers. + * + * Immediately after the swap the ISR uses the work_table until the start of the + * next 20mS cycle. During this transition the "work_table" is actually the table + * that was being used before the swap. The "active_table" contains the data that + * will start being used at the start of the next 20mS period. This keeps the pins + * well behaved during the transition. + * + * The ISR's priority is set to the maximum otherwise other ISRs can cause considerable + * jitter in the PWM high time. + * + * See the end of this file for details on the hardware/firmware interaction + */ + + +#ifdef TARGET_LPC1768 +#include +#include "LPC1768_PWM.h" +#include "arduino.h" + +#define NUM_PWMS 6 + +typedef struct { // holds all data needed to control/init one of the PWM channels + uint8_t sequence; // 0: available slot, 1 - 6: PWM channel assigned to that slot + pin_t pin; + uint16_t PWM_mask; // MASK TO CHECK/WRITE THE IR REGISTER + volatile uint32_t* set_register; + volatile uint32_t* clr_register; + uint32_t write_mask; // USED BY SET/CLEAR COMMANDS + uint32_t microseconds; // value written to MR register + uint32_t min; // lower value limit checked by WRITE routine before writing to the MR register + uint32_t max; // upper value limit checked by WRITE routine before writing to the MR register + bool PWM_flag; // 0 - USED BY sERVO, 1 - USED BY ANALOGWRITE + uint8_t servo_index; // 0 - MAX_SERVO -1 : servo index, 0xFF : PWM channel + bool active_flag; // THIS TABLE ENTRY IS ACTIVELY TOGGLING A PIN + uint8_t assigned_MR; // Which MR (1-6) is used by this logical channel + uint32_t PCR_bit; // PCR register bit to enable PWM1 control of this pin + uint32_t PINSEL3_bits; // PINSEL3 register bits to set pin mode to PWM1 control + +} PWM_map; + + +#define MICRO_MAX 0xffffffff + +#define PWM_MAP_INIT_ROW {0, 0xff, 0, 0, 0, 0, MICRO_MAX, 0, 0, 0, 0, 0, 0, 0, 0} +#define PWM_MAP_INIT {PWM_MAP_INIT_ROW,\ + PWM_MAP_INIT_ROW,\ + PWM_MAP_INIT_ROW,\ + PWM_MAP_INIT_ROW,\ + PWM_MAP_INIT_ROW,\ + PWM_MAP_INIT_ROW,\ + }; + +PWM_map PWM1_map_A[NUM_PWMS] = PWM_MAP_INIT; +PWM_map PWM1_map_B[NUM_PWMS] = PWM_MAP_INIT; + +PWM_map *active_table = PWM1_map_A; +PWM_map *work_table = PWM1_map_B; +PWM_map *ISR_table; + + +#define IR_BIT(p) (p >= 0 && p <= 3 ? p : p + 4 ) +#define COPY_ACTIVE_TABLE for (uint8_t i = 0; i < 6 ; i++) work_table[i] = active_table[i] +#define PIN_IS_INVERTED(p) 0 // place holder in case inverting PWM output is offered + + +/** + * Prescale register and MR0 register values + * + * 100MHz PCLK 50MHz PCLK 25MHz PCLK 12.5MHz PCLK + * ----------------- ----------------- ----------------- ----------------- + * desired prescale MR0 prescale MR0 prescale MR0 prescale MR0 resolution + * prescale register register register register register register register register in degrees + * freq value value value value value value value value + * + * 8 11.5 159,999 5.25 159,999 2.13 159,999 0.5625 159,999 0.023 + * 4 24 79,999 11.5 79,999 5.25 79,999 2.125 79,999 0.045 + * 2 49 39,999 24 39,999 11.5 39,999 5.25 39,999 0.090 + * 1 99 19,999 49 19,999 24 19,999 11.5 19,999 0.180 + * 0.5 199 9,999 99 9,999 49 9,999 24 9,999 0.360 + * 0.25 399 4,999 199 4,999 99 4,999 49 4,999 0.720 + * 0.125 799 2,499 399 2,499 199 2,499 99 2,499 1.440 + * + * The desired prescale frequency comes from an input in the range of 544 - 2400 microseconds and the + * desire to just shift the input left or right as needed. + * + * A resolution of 0.2 degrees seems reasonable so a prescale frequency output of 1MHz is being used. + * It also means we don't need to scale the input. + * + * The PCLK is set to 25MHz because that's the slowest one that gives whole numbers for prescale and + * MR0 registers. + * + * Final settings: + * PCLKSEL0: 0x0 + * PWM1PR: 0x018 (24) + * PWM1MR0: 0x04E1F (19,999) + * + */ + + +void LPC1768_PWM_init(void) { + #define SBIT_CNTEN 0 // PWM1 counter & pre-scaler enable/disable + #define SBIT_CNTRST 1 // reset counters to known state + #define SBIT_PWMEN 3 // 1 - PWM, 0 - timer + #define SBIT_PWMMR0R 1 + #define PCPWM1 6 + #define PCLK_PWM1 12 + + LPC_SC->PCONP |= (1 << PCPWM1); // enable PWM1 controller (enabled on power up) + LPC_SC->PCLKSEL0 &= ~(0x3 << PCLK_PWM1); + LPC_SC->PCLKSEL0 |= (LPC_PWM1_PCLKSEL0 << PCLK_PWM1); + LPC_PWM1->MR0 = LPC_PWM1_MR0; // TC resets every 19,999 + 1 cycles - sets PWM cycle(Ton+Toff) to 20 mS + // MR0 must be set before TCR enables the PWM + LPC_PWM1->TCR = _BV(SBIT_CNTEN) | _BV(SBIT_CNTRST)| _BV(SBIT_PWMEN);; // enable counters, reset counters, set mode to PWM + LPC_PWM1->TCR &= ~(_BV(SBIT_CNTRST)); // take counters out of reset + LPC_PWM1->PR = LPC_PWM1_PR; + LPC_PWM1->MCR = (_BV(SBIT_PWMMR0R) | _BV(0)); // Reset TC if it matches MR0, disable all interrupts except for MR0 + LPC_PWM1->CTCR = 0; // disable counter mode (enable PWM mode) + + LPC_PWM1->LER = 0x07F; // Set the latch Enable Bits to load the new Match Values for MR0 - MR6 + // Set all PWMs to single edge + LPC_PWM1->PCR = 0; // single edge mode for all channels, PWM1 control of outputs off + + NVIC_EnableIRQ(PWM1_IRQn); // Enable interrupt handler + // NVIC_SetPriority(PWM1_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module + NVIC_SetPriority(PWM1_IRQn, NVIC_EncodePriority(0, 0, 0)); // minimizes jitter due to higher priority ISRs +} + + +bool PWM_table_swap = false; // flag to tell the ISR that the tables have been swapped +bool PWM_MR0_wait = false; // flag to ensure don't delay MR0 interrupt + + +bool LPC1768_PWM_attach_pin(pin_t pin, uint32_t min /* = 1 */, uint32_t max /* = (LPC_PWM1_MR0 - MR0_MARGIN) */, uint8_t servo_index /* = 0xff */) { + while (PWM_table_swap) delay(5); // don't do anything until the previous change has been implemented by the ISR + COPY_ACTIVE_TABLE; // copy active table into work table + uint8_t slot = 0; + for (uint8_t i = 0; i < NUM_PWMS ; i++) // see if already in table + if (work_table[i].pin == pin) return 1; + + for (uint8_t i = 1; (i < NUM_PWMS + 1) && !slot; i++) // find empty slot + if ( !(work_table[i - 1].set_register)) slot = i; // any item that can't be zero when active or just attached is OK + if (!slot) return 0; + slot--; // turn it into array index + + work_table[slot].pin = pin; // init slot + work_table[slot].PWM_mask = 0; // real value set by PWM_write + work_table[slot].set_register = PIN_IS_INVERTED(pin) ? &LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR : &LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET; + work_table[slot].clr_register = PIN_IS_INVERTED(pin) ? &LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET : &LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR; + work_table[slot].write_mask = LPC_PIN(LPC1768_PIN_PIN(pin)); + work_table[slot].microseconds = MICRO_MAX; + work_table[slot].min = min; + work_table[slot].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); + work_table[slot].servo_index = servo_index; + work_table[slot].active_flag = false; + + //swap tables + PWM_MR0_wait = true; + while (PWM_MR0_wait) delay(5); //wait until MR0 interrupt has happend so don't delay it. + + NVIC_DisableIRQ(PWM1_IRQn); + PWM_map *pointer_swap = active_table; + active_table = work_table; + work_table = pointer_swap; + PWM_table_swap = true; // tell the ISR that the tables have been swapped + NVIC_EnableIRQ(PWM1_IRQn); // re-enable PWM interrupts + + return 1; +} + +#define pin_11_PWM_channel 2 +#define pin_6_PWM_channel 3 +#define pin_4_PWM_channel 1 + +// used to keep track of which Match Registers have been used and if they will be used by the +// PWM1 module to directly control the pin or will be used to generate an interrupt +typedef struct { // status of PWM1 channel + uint8_t map_used; // 0 - this MR register not used/assigned + uint8_t map_PWM_INT; // 0 - available for interrupts, 1 - in use by PWM + pin_t map_PWM_PIN; // pin for this PwM1 controlled pin / port + volatile uint32_t* MR_register; // address of the MR register for this PWM1 channel + uint32_t PCR_bit; // PCR register bit to enable PWM1 control of this pin + uint32_t PINSEL3_bits; // PINSEL3 register bits to set pin mode to PWM1 control +} MR_map; + +MR_map map_MR[NUM_PWMS]; + +void LPC1768_PWM_update_map_MR(void) { + map_MR[0] = {0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + pin_4_PWM_channel) ? 1 : 0), 4, &LPC_PWM1->MR1, 0, 0}; + map_MR[1] = {0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + pin_11_PWM_channel) ? 1 : 0), 11, &LPC_PWM1->MR2, 0, 0}; + map_MR[2] = {0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + pin_6_PWM_channel) ? 1 : 0), 6, &LPC_PWM1->MR3, 0, 0}; + map_MR[3] = {0, 0, 0, &LPC_PWM1->MR4, 0, 0}; + map_MR[4] = {0, 0, 0, &LPC_PWM1->MR5, 0, 0}; + map_MR[5] = {0, 0, 0, &LPC_PWM1->MR6, 0, 0}; +} + + +uint32_t LPC1768_PWM_interrupt_mask = 1; + +void LPC1768_PWM_update(void) { + for (uint8_t i = NUM_PWMS; --i;) { // (bubble) sort table by microseconds + bool didSwap = false; + PWM_map temp; + for (uint16_t j = 0; j < i; ++j) { + if (work_table[j].microseconds > work_table[j + 1].microseconds) { + temp = work_table[j + 1]; + work_table[j + 1] = work_table[j]; + work_table[j] = temp; + didSwap = true; + } + } + if (!didSwap) break; + } + + LPC1768_PWM_interrupt_mask = 0; // set match registers to new values, build IRQ mask + for (uint8_t i = 0; i < NUM_PWMS; i++) { + if (work_table[i].active_flag == true) { + work_table[i].sequence = i + 1; + + // first see if there is a PWM1 controlled pin for this entry + bool found = false; + for (uint8_t j = 0; (j < NUM_PWMS) && !found; j++) { + if ( (map_MR[j].map_PWM_PIN == work_table[i].pin) && map_MR[j].map_PWM_INT ) { + *map_MR[j].MR_register = work_table[i].microseconds; // found one of the PWM pins + work_table[i].PWM_mask = 0; + work_table[i].PCR_bit = map_MR[j].PCR_bit; // PCR register bit to enable PWM1 control of this pin + work_table[i].PINSEL3_bits = map_MR[j].PINSEL3_bits; // PINSEL3 register bits to set pin mode to PWM1 control} MR_map; + map_MR[j].map_used = 2; + work_table[i].assigned_MR = j +1; // only used to help in debugging + found = true; + } + } + + // didn't find a PWM1 pin so get an interrupt + for (uint8_t k = 0; (k < NUM_PWMS) && !found; k++) { + if ( !(map_MR[k].map_PWM_INT || map_MR[k].map_used)) { + *map_MR[k].MR_register = work_table[i].microseconds; // found one for an interrupt pin + map_MR[k].map_used = 1; + LPC1768_PWM_interrupt_mask |= _BV(3 * (k + 1)); // set bit in the MCR to enable this MR to generate an interrupt + work_table[i].PWM_mask = _BV(IR_BIT(k + 1)); // bit in the IR that will go active when this MR generates an interrupt + work_table[i].assigned_MR = k +1; // only used to help in debugging + found = true; + } + } + } + else + work_table[i].sequence = 0; + } + LPC1768_PWM_interrupt_mask |= (uint32_t) _BV(0); // add in MR0 interrupt + + // swap tables + + PWM_MR0_wait = true; + while (PWM_MR0_wait) delay(5); //wait until MR0 interrupt has happend so don't delay it. + + NVIC_DisableIRQ(PWM1_IRQn); + LPC_PWM1->LER = 0x07E; // Set the latch Enable Bits to load the new Match Values for MR1 - MR6 + PWM_map *pointer_swap = active_table; + active_table = work_table; + work_table = pointer_swap; + PWM_table_swap = true; // tell the ISR that the tables have been swapped + NVIC_EnableIRQ(PWM1_IRQn); // re-enable PWM interrupts +} + + +bool LPC1768_PWM_write(pin_t pin, uint32_t value) { + while (PWM_table_swap) delay(5); // don't do anything until the previous change has been implemented by the ISR + COPY_ACTIVE_TABLE; // copy active table into work table + uint8_t slot = 0xFF; + for (uint8_t i = 0; i < NUM_PWMS; i++) // find slot + if (work_table[i].pin == pin) slot = i; + if (slot == 0xFF) return false; // return error if pin not found + + LPC1768_PWM_update_map_MR(); + + switch(pin) { + case P1_20: // Servo 0, PWM1 channel 2 (Pin 11 P1.20 PWM1.2) + map_MR[pin_11_PWM_channel - 1].PCR_bit = _BV(8 + pin_11_PWM_channel); // enable PWM1 module control of this pin + map_MR[pin_11_PWM_channel - 1].map_PWM_INT = 1; // 0 - available for interrupts, 1 - in use by PWM + map_MR[pin_11_PWM_channel - 1].PINSEL3_bits = 0x2 << 8; // ISR must do this AFTER setting PCR + break; + case P1_21: // Servo 1, PWM1 channel 3 (Pin 6 P1.21 PWM1.3) + map_MR[pin_6_PWM_channel - 1].PCR_bit = _BV(8 + pin_6_PWM_channel); // enable PWM1 module control of this pin + map_MR[pin_6_PWM_channel - 1].map_PWM_INT = 1; // 0 - available for interrupts, 1 - in use by PWM + map_MR[pin_6_PWM_channel - 1].PINSEL3_bits = 0x2 << 10; // ISR must do this AFTER setting PCR + break; + case P1_18: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1) + map_MR[pin_4_PWM_channel - 1].PCR_bit = _BV(8 + pin_4_PWM_channel); // enable PWM1 module control of this pin + map_MR[pin_4_PWM_channel - 1].map_PWM_INT = 1; // 0 - available for interrupts, 1 - in use by PWM + map_MR[pin_4_PWM_channel - 1].PINSEL3_bits = 0x2 << 4; // ISR must do this AFTER setting PCR + break; + default: // ISR pins + pinMode(pin, OUTPUT); // set pin to output but don't write anything in case it's already in use + break; + } + + work_table[slot].microseconds = MAX(MIN(value, work_table[slot].max), work_table[slot].min); + work_table[slot].active_flag = true; + + LPC1768_PWM_update(); + + return 1; +} + + +bool LPC1768_PWM_detach_pin(pin_t pin) { + while (PWM_table_swap) delay(5); // don't do anything until the previous change has been implemented by the ISR + COPY_ACTIVE_TABLE; // copy active table into work table + uint8_t slot = 0xFF; + for (uint8_t i = 0; i < NUM_PWMS; i++) // find slot + if (work_table[i].pin == pin) slot = i; + if (slot == 0xFF) return false; // return error if pin not found + + LPC1768_PWM_update_map_MR(); + + // OK to make these changes before the MR0 interrupt + switch(pin) { + case P1_20: // Servo 0, PWM1 channel 2 (Pin 11 P1.20 PWM1.2) + LPC_PWM1->PCR &= ~(_BV(8 + pin_11_PWM_channel)); // disable PWM1 module control of this pin + map_MR[pin_11_PWM_channel - 1].PCR_bit = 0; + LPC_PINCON->PINSEL3 &= ~(0x3 << 8); // return pin to general purpose I/O + map_MR[pin_11_PWM_channel - 1].PINSEL3_bits = 0; + map_MR[pin_11_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM + break; + case P1_21: // Servo 1, PWM1 channel 3 (Pin 6 P1.21 PWM1.3) + LPC_PWM1->PCR &= ~(_BV(8 + pin_6_PWM_channel)); // disable PWM1 module control of this pin + map_MR[pin_6_PWM_channel - 1].PCR_bit = 0; + LPC_PINCON->PINSEL3 &= ~(0x3 << 10); // return pin to general purpose I/O + map_MR[pin_6_PWM_channel - 1].PINSEL3_bits = 0; + map_MR[pin_6_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM + break; + case P1_18: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1) + LPC_PWM1->PCR &= ~(_BV(8 + pin_4_PWM_channel)); // disable PWM1 module control of this pin + map_MR[pin_4_PWM_channel - 1].PCR_bit = 0; + LPC_PINCON->PINSEL3 &= ~(0x3 << 4); // return pin to general purpose I/O + map_MR[pin_4_PWM_channel - 1].PINSEL3_bits = 0; + map_MR[pin_4_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM + break; + } + + pinMode(pin, INPUT); + + work_table[slot] = PWM_MAP_INIT_ROW; + + LPC1768_PWM_update(); + + return 1; +} + + +bool useable_hardware_PWM(pin_t pin) { + COPY_ACTIVE_TABLE; // copy active table into work table + for (uint8_t i = 0; i < NUM_PWMS; i++) // see if it's already setup + if (work_table[i].pin == pin && work_table[i].sequence) return true; + for (uint8_t i = 0; i < NUM_PWMS; i++) // see if there is an empty slot + if (!work_table[i].sequence) return true; + return false; // only get here if neither the above are true +} + +//////////////////////////////////////////////////////////////////////////////// + +#define HAL_PWM_LPC1768_ISR extern "C" void PWM1_IRQHandler(void) + + +// Both loops could be terminated when the last active channel is found but that would +// result in variations ISR run time which results in variations in pulse width + +/** + * Changes to PINSEL3, PCR and MCR are only done during the MR0 interrupt otherwise + * the wrong pin may be toggled or even have the system hang. + */ + + +HAL_PWM_LPC1768_ISR { + if (PWM_table_swap) ISR_table = work_table; // use old table if a swap was just done + else ISR_table = active_table; + + if (LPC_PWM1->IR & 0x1) { // MR0 interrupt + ISR_table = active_table; // MR0 means new values could have been loaded so set everything + if (PWM_table_swap) LPC_PWM1->MCR = LPC1768_PWM_interrupt_mask; // enable new PWM individual channel interrupts + + for (uint8_t i = 0; i < NUM_PWMS; i++) { + if(ISR_table[i].active_flag && !((ISR_table[i].pin == P1_20) || + (ISR_table[i].pin == P1_21) || + (ISR_table[i].pin == P1_18))) + *ISR_table[i].set_register = ISR_table[i].write_mask; // set pins for all enabled interrupt channels active + if (PWM_table_swap && ISR_table[i].PCR_bit) { + LPC_PWM1->PCR |= ISR_table[i].PCR_bit; // enable PWM1 module control of this pin + LPC_PINCON->PINSEL3 |= ISR_table[i].PINSEL3_bits; // set pin mode to PWM1 control - must be done after PCR + } + } + PWM_table_swap = false; + PWM_MR0_wait = false; + LPC_PWM1->IR = 0x01; // clear the MR0 interrupt flag bit + } + else { + for (uint8_t i = 0; i < NUM_PWMS ; i++) + if (ISR_table[i].active_flag && (LPC_PWM1->IR & ISR_table[i].PWM_mask) ){ + LPC_PWM1->IR = ISR_table[i].PWM_mask; // clear the interrupt flag bits for expected interrupts + *ISR_table[i].clr_register = ISR_table[i].write_mask; // set channel to inactive + } + } + + LPC_PWM1->IR = 0x70F; // guarantees all interrupt flags are cleared which, if there is an unexpected + // PWM interrupt, will keep the ISR from hanging which will crash the controller + +return; +} +#endif + +///////////////////////////////////////////////////////////////// +///////////////// HARDWARE FIRMWARE INTERACTION //////////////// +///////////////////////////////////////////////////////////////// + +/** + * Almost all changes to the hardware registers must be coordinated with the Match Register 0 (MR0) + * interrupt. The only exception is detaching pins. It doesn't matter when they go + * tristate. + * + * The LPC1768_PWM_init routine kicks off the MR0 interrupt. This interrupt is never disabled or + * delayed. + * + * The PWM_table_swap flag is set when the firmware has swapped in an updated table. It is + * cleared by the ISR during the MR0 interrupt as it completes the swap and accompanying updates. + * It serves two purposes: + * 1) Tells the ISR that the tables have been swapped + * 2) Keeps the firmware from starting a new update until the previous one has been completed. + * + * The PWM_MR0_wait flag is set when the firmware is ready to swap in an updated table and cleared by + * the ISR during the MR0 interrupt. It is used to avoid delaying the MR0 interrupt when swapping in + * an updated table. This avoids glitches in pulse width and/or repetition rate. + * + * The sequence of events during a write to a PWM channel is: + * 1) Waits until PWM_table_swap flag is false before starting + * 2) Copies the active table into the work table + * 3) Updates the work table + * NOTES - MR1-MR6 are updated at this time. The updates aren't put into use until the first + * MR0 after the LER register has been written. The LER register is written during the + * table swap process. + * - The MCR mask is created at this time. It is not used until the ISR writes the MCR + * during the MR0 interrupt in the table swap process. + * 4) Sets the PWM_MR0_wait flag + * 5) ISR clears the PWM_MR0_wait flag during the next MR0 interrupt + * 6) Once the PWM_MR0_wait flag is cleared then the firmware: + * disables the ISR interrupt + * swaps the pointers to the tables + * writes to the LER register + * sets the PWM_table_swap flag active + * re-enables the ISR + * 7) On the next interrupt the ISR changes its pointer to the work table which is now the old, + * unmodified, active table. + * 8) On the next MR0 interrupt the ISR: + * switches over to the active table + * clears the PWM_table_swap and PWM_MR0_wait flags + * updates the MCR register with the possibly new interrupt sources/assignments + * writes to the PCR register to enable the direct control of the Servo 0, 1 & 3 pins by the PWM1 module + * sets the PINSEL3 register to function/mode 0x2 for the Servo 0, 1 & 3 pins + * NOTE - PCR must be set before PINSEL + * sets the pins controlled by the ISR to their active states + */ + diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h index 3ab47f888b..6dec0b7e96 100644 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h +++ b/Marlin/src/HAL/HAL_LPC1768/LPC1768_PWM.h @@ -60,88 +60,7 @@ * See the end of this file for details on the hardware/firmware interaction */ - -#ifdef TARGET_LPC1768 -#include - -#define NUM_PWMS 6 - -typedef struct { // holds all data needed to control/init one of the PWM channels - uint8_t sequence; // 0: available slot, 1 - 6: PWM channel assigned to that slot - uint8_t logical_pin; - uint16_t PWM_mask; // MASK TO CHECK/WRITE THE IR REGISTER - volatile uint32_t* set_register; - volatile uint32_t* clr_register; - uint32_t write_mask; // USED BY SET/CLEAR COMMANDS - uint32_t microseconds; // value written to MR register - uint32_t min; // lower value limit checked by WRITE routine before writing to the MR register - uint32_t max; // upper value limit checked by WRITE routine before writing to the MR register - bool PWM_flag; // 0 - USED BY sERVO, 1 - USED BY ANALOGWRITE - uint8_t servo_index; // 0 - MAX_SERVO -1 : servo index, 0xFF : PWM channel - bool active_flag; // THIS TABLE ENTRY IS ACTIVELY TOGGLING A PIN - uint8_t assigned_MR; // Which MR (1-6) is used by this logical channel - uint32_t PCR_bit; // PCR register bit to enable PWM1 control of this pin - uint32_t PINSEL3_bits; // PINSEL3 register bits to set pin mode to PWM1 control - -} PWM_map; - - -#define MICRO_MAX 0xffffffff - -#define PWM_MAP_INIT_ROW {0, 0xff, 0, 0, 0, 0, MICRO_MAX, 0, 0, 0, 0, 0, 0, 0, 0} -#define PWM_MAP_INIT {PWM_MAP_INIT_ROW,\ - PWM_MAP_INIT_ROW,\ - PWM_MAP_INIT_ROW,\ - PWM_MAP_INIT_ROW,\ - PWM_MAP_INIT_ROW,\ - PWM_MAP_INIT_ROW,\ - }; - -PWM_map PWM1_map_A[NUM_PWMS] = PWM_MAP_INIT; -PWM_map PWM1_map_B[NUM_PWMS] = PWM_MAP_INIT; - -PWM_map *active_table = PWM1_map_A; -PWM_map *work_table = PWM1_map_B; -PWM_map *ISR_table; - - -#define IR_BIT(p) (p >= 0 && p <= 3 ? p : p + 4 ) -#define COPY_ACTIVE_TABLE for (uint8_t i = 0; i < 6 ; i++) work_table[i] = active_table[i] -#define PIN_IS_INVERTED(p) 0 // place holder in case inverting PWM output is offered - - -/** - * Prescale register and MR0 register values - * - * 100MHz PCLK 50MHz PCLK 25MHz PCLK 12.5MHz PCLK - * ----------------- ----------------- ----------------- ----------------- - * desired prescale MR0 prescale MR0 prescale MR0 prescale MR0 resolution - * prescale register register register register register register register register in degrees - * freq value value value value value value value value - * - * 8 11.5 159,999 5.25 159,999 2.13 159,999 0.5625 159,999 0.023 - * 4 24 79,999 11.5 79,999 5.25 79,999 2.125 79,999 0.045 - * 2 49 39,999 24 39,999 11.5 39,999 5.25 39,999 0.090 - * 1 99 19,999 49 19,999 24 19,999 11.5 19,999 0.180 - * 0.5 199 9,999 99 9,999 49 9,999 24 9,999 0.360 - * 0.25 399 4,999 199 4,999 99 4,999 49 4,999 0.720 - * 0.125 799 2,499 399 2,499 199 2,499 99 2,499 1.440 - * - * The desired prescale frequency comes from an input in the range of 544 - 2400 microseconds and the - * desire to just shift the input left or right as needed. - * - * A resolution of 0.2 degrees seems reasonable so a prescale frequency output of 1MHz is being used. - * It also means we don't need to scale the input. - * - * The PCLK is set to 25MHz because that's the slowest one that gives whole numbers for prescale and - * MR0 registers. - * - * Final settings: - * PCLKSEL0: 0x0 - * PWM1PR: 0x018 (24) - * PWM1MR0: 0x04E1F (19,999) - * - */ + #include "fastio.h" #define LPC_PWM1_MR0 19999 // base repetition rate minus one count - 20mS #define LPC_PWM1_PR 24 // prescaler value - prescaler divide by 24 + 1 - 1 MHz output @@ -149,365 +68,10 @@ PWM_map *ISR_table; // 0: 25MHz, 1: 100MHz, 2: 50MHz, 3: 12.5MHZ to PWM1 prescaler #define MR0_MARGIN 200 // if channel value too close to MR0 the system locks up - -void LPC1768_PWM_init(void) { - #define SBIT_CNTEN 0 // PWM1 counter & pre-scaler enable/disable - #define SBIT_CNTRST 1 // reset counters to known state - #define SBIT_PWMEN 3 // 1 - PWM, 0 - timer - #define SBIT_PWMMR0R 1 - #define PCPWM1 6 - #define PCLK_PWM1 12 - - LPC_SC->PCONP |= (1 << PCPWM1); // enable PWM1 controller (enabled on power up) - LPC_SC->PCLKSEL0 &= ~(0x3 << PCLK_PWM1); - LPC_SC->PCLKSEL0 |= (LPC_PWM1_PCLKSEL0 << PCLK_PWM1); - LPC_PWM1->MR0 = LPC_PWM1_MR0; // TC resets every 19,999 + 1 cycles - sets PWM cycle(Ton+Toff) to 20 mS - // MR0 must be set before TCR enables the PWM - LPC_PWM1->TCR = _BV(SBIT_CNTEN) | _BV(SBIT_CNTRST)| _BV(SBIT_PWMEN);; // enable counters, reset counters, set mode to PWM - LPC_PWM1->TCR &= ~(_BV(SBIT_CNTRST)); // take counters out of reset - LPC_PWM1->PR = LPC_PWM1_PR; - LPC_PWM1->MCR = (_BV(SBIT_PWMMR0R) | _BV(0)); // Reset TC if it matches MR0, disable all interrupts except for MR0 - LPC_PWM1->CTCR = 0; // disable counter mode (enable PWM mode) - - LPC_PWM1->LER = 0x07F; // Set the latch Enable Bits to load the new Match Values for MR0 - MR6 - // Set all PWMs to single edge - LPC_PWM1->PCR = 0; // single edge mode for all channels, PWM1 control of outputs off - - NVIC_EnableIRQ(PWM1_IRQn); // Enable interrupt handler - // NVIC_SetPriority(PWM1_IRQn, NVIC_EncodePriority(0, 10, 0)); // normal priority for PWM module - NVIC_SetPriority(PWM1_IRQn, NVIC_EncodePriority(0, 0, 0)); // minimizes jitter due to higher priority ISRs -} - - -bool PWM_table_swap = false; // flag to tell the ISR that the tables have been swapped -bool PWM_MR0_wait = false; // flag to ensure don't delay MR0 interrupt - - -bool LPC1768_PWM_attach_pin(uint8_t pin, uint32_t min = 1, uint32_t max = (LPC_PWM1_MR0 - MR0_MARGIN), uint8_t servo_index = 0xff) { - while (PWM_table_swap) delay(5); // don't do anything until the previous change has been implemented by the ISR - COPY_ACTIVE_TABLE; // copy active table into work table - uint8_t slot = 0; - for (uint8_t i = 0; i < NUM_PWMS ; i++) // see if already in table - if (work_table[i].logical_pin == pin) return 1; - - for (uint8_t i = 1; (i < NUM_PWMS + 1) && !slot; i++) // find empty slot - if ( !(work_table[i - 1].set_register)) slot = i; // any item that can't be zero when active or just attached is OK - if (!slot) return 0; - slot--; // turn it into array index - - work_table[slot].logical_pin = pin; // init slot - work_table[slot].PWM_mask = 0; // real value set by PWM_write - work_table[slot].set_register = PIN_IS_INVERTED(pin) ? &LPC_GPIO(pin_map[pin].port)->FIOCLR : &LPC_GPIO(pin_map[pin].port)->FIOSET; - work_table[slot].clr_register = PIN_IS_INVERTED(pin) ? &LPC_GPIO(pin_map[pin].port)->FIOSET : &LPC_GPIO(pin_map[pin].port)->FIOCLR; - work_table[slot].write_mask = LPC_PIN(pin_map[pin].pin); - work_table[slot].microseconds = MICRO_MAX; - work_table[slot].min = min; - work_table[slot].max = MIN(max, LPC_PWM1_MR0 - MR0_MARGIN); - work_table[slot].servo_index = servo_index; - work_table[slot].active_flag = false; - - //swap tables - PWM_MR0_wait = true; - while (PWM_MR0_wait) delay(5); //wait until MR0 interrupt has happend so don't delay it. - - NVIC_DisableIRQ(PWM1_IRQn); - PWM_map *pointer_swap = active_table; - active_table = work_table; - work_table = pointer_swap; - PWM_table_swap = true; // tell the ISR that the tables have been swapped - NVIC_EnableIRQ(PWM1_IRQn); // re-enable PWM interrupts - - return 1; -} - -#define pin_11_PWM_channel 2 -#define pin_6_PWM_channel 3 -#define pin_4_PWM_channel 1 - -// used to keep track of which Match Registers have been used and if they will be used by the -// PWM1 module to directly control the pin or will be used to generate an interrupt -typedef struct { // status of PWM1 channel - uint8_t map_used; // 0 - this MR register not used/assigned - uint8_t map_PWM_INT; // 0 - available for interrupts, 1 - in use by PWM - uint8_t map_PWM_PIN; // logical pin number for this PwM1 controlled pin / port - volatile uint32_t* MR_register; // address of the MR register for this PWM1 channel - uint32_t PCR_bit; // PCR register bit to enable PWM1 control of this pin - uint32_t PINSEL3_bits; // PINSEL3 register bits to set pin mode to PWM1 control -} MR_map; - -MR_map map_MR[NUM_PWMS]; - -void LPC1768_PWM_update_map_MR(void) { - map_MR[0] = {0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + pin_4_PWM_channel) ? 1 : 0), 4, &LPC_PWM1->MR1, 0, 0}; - map_MR[1] = {0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + pin_11_PWM_channel) ? 1 : 0), 11, &LPC_PWM1->MR2, 0, 0}; - map_MR[2] = {0, (uint8_t) (LPC_PWM1->PCR & _BV(8 + pin_6_PWM_channel) ? 1 : 0), 6, &LPC_PWM1->MR3, 0, 0}; - map_MR[3] = {0, 0, 0, &LPC_PWM1->MR4, 0, 0}; - map_MR[4] = {0, 0, 0, &LPC_PWM1->MR5, 0, 0}; - map_MR[5] = {0, 0, 0, &LPC_PWM1->MR6, 0, 0}; -} - - -uint32_t LPC1768_PWM_interrupt_mask = 1; - -void LPC1768_PWM_update(void) { - for (uint8_t i = NUM_PWMS; --i;) { // (bubble) sort table by microseconds - bool didSwap = false; - PWM_map temp; - for (uint16_t j = 0; j < i; ++j) { - if (work_table[j].microseconds > work_table[j + 1].microseconds) { - temp = work_table[j + 1]; - work_table[j + 1] = work_table[j]; - work_table[j] = temp; - didSwap = true; - } - } - if (!didSwap) break; - } - - LPC1768_PWM_interrupt_mask = 0; // set match registers to new values, build IRQ mask - for (uint8_t i = 0; i < NUM_PWMS; i++) { - if (work_table[i].active_flag == true) { - work_table[i].sequence = i + 1; - - // first see if there is a PWM1 controlled pin for this entry - bool found = false; - for (uint8_t j = 0; (j < NUM_PWMS) && !found; j++) { - if ( (map_MR[j].map_PWM_PIN == work_table[i].logical_pin) && map_MR[j].map_PWM_INT ) { - *map_MR[j].MR_register = work_table[i].microseconds; // found one of the PWM pins - work_table[i].PWM_mask = 0; - work_table[i].PCR_bit = map_MR[j].PCR_bit; // PCR register bit to enable PWM1 control of this pin - work_table[i].PINSEL3_bits = map_MR[j].PINSEL3_bits; // PINSEL3 register bits to set pin mode to PWM1 control} MR_map; - map_MR[j].map_used = 2; - work_table[i].assigned_MR = j +1; // only used to help in debugging - found = true; - } - } - - // didn't find a PWM1 pin so get an interrupt - for (uint8_t k = 0; (k < NUM_PWMS) && !found; k++) { - if ( !(map_MR[k].map_PWM_INT || map_MR[k].map_used)) { - *map_MR[k].MR_register = work_table[i].microseconds; // found one for an interrupt pin - map_MR[k].map_used = 1; - LPC1768_PWM_interrupt_mask |= _BV(3 * (k + 1)); // set bit in the MCR to enable this MR to generate an interrupt - work_table[i].PWM_mask = _BV(IR_BIT(k + 1)); // bit in the IR that will go active when this MR generates an interrupt - work_table[i].assigned_MR = k +1; // only used to help in debugging - found = true; - } - } - } - else - work_table[i].sequence = 0; - } - LPC1768_PWM_interrupt_mask |= (uint32_t) _BV(0); // add in MR0 interrupt - - // swap tables - - PWM_MR0_wait = true; - while (PWM_MR0_wait) delay(5); //wait until MR0 interrupt has happend so don't delay it. - - NVIC_DisableIRQ(PWM1_IRQn); - LPC_PWM1->LER = 0x07E; // Set the latch Enable Bits to load the new Match Values for MR1 - MR6 - PWM_map *pointer_swap = active_table; - active_table = work_table; - work_table = pointer_swap; - PWM_table_swap = true; // tell the ISR that the tables have been swapped - NVIC_EnableIRQ(PWM1_IRQn); // re-enable PWM interrupts -} - - -bool LPC1768_PWM_write(uint8_t pin, uint32_t value) { - while (PWM_table_swap) delay(5); // don't do anything until the previous change has been implemented by the ISR - COPY_ACTIVE_TABLE; // copy active table into work table - uint8_t slot = 0xFF; - for (uint8_t i = 0; i < NUM_PWMS; i++) // find slot - if (work_table[i].logical_pin == pin) slot = i; - if (slot == 0xFF) return false; // return error if pin not found - - LPC1768_PWM_update_map_MR(); - - switch(pin) { - case 11: // Servo 0, PWM1 channel 2 (Pin 11 P1.20 PWM1.2) - map_MR[pin_11_PWM_channel - 1].PCR_bit = _BV(8 + pin_11_PWM_channel); // enable PWM1 module control of this pin - map_MR[pin_11_PWM_channel - 1].map_PWM_INT = 1; // 0 - available for interrupts, 1 - in use by PWM - map_MR[pin_11_PWM_channel - 1].PINSEL3_bits = 0x2 << 8; // ISR must do this AFTER setting PCR - break; - case 6: // Servo 1, PWM1 channel 3 (Pin 6 P1.21 PWM1.3) - map_MR[pin_6_PWM_channel - 1].PCR_bit = _BV(8 + pin_6_PWM_channel); // enable PWM1 module control of this pin - map_MR[pin_6_PWM_channel - 1].map_PWM_INT = 1; // 0 - available for interrupts, 1 - in use by PWM - map_MR[pin_6_PWM_channel - 1].PINSEL3_bits = 0x2 << 10; // ISR must do this AFTER setting PCR - break; - case 4: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1) - map_MR[pin_4_PWM_channel - 1].PCR_bit = _BV(8 + pin_4_PWM_channel); // enable PWM1 module control of this pin - map_MR[pin_4_PWM_channel - 1].map_PWM_INT = 1; // 0 - available for interrupts, 1 - in use by PWM - map_MR[pin_4_PWM_channel - 1].PINSEL3_bits = 0x2 << 4; // ISR must do this AFTER setting PCR - break; - default: // ISR pins - pinMode(pin, OUTPUT); // set pin to output but don't write anything in case it's already in use - break; - } - - work_table[slot].microseconds = MAX(MIN(value, work_table[slot].max), work_table[slot].min); - work_table[slot].active_flag = true; - - LPC1768_PWM_update(); - - return 1; -} - - -bool LPC1768_PWM_detach_pin(uint8_t pin) { - while (PWM_table_swap) delay(5); // don't do anything until the previous change has been implemented by the ISR - COPY_ACTIVE_TABLE; // copy active table into work table - uint8_t slot = 0xFF; - for (uint8_t i = 0; i < NUM_PWMS; i++) // find slot - if (work_table[i].logical_pin == pin) slot = i; - if (slot == 0xFF) return false; // return error if pin not found - - LPC1768_PWM_update_map_MR(); - - // OK to make these changes before the MR0 interrupt - switch(pin) { - case 11: // Servo 0, PWM1 channel 2 (Pin 11 P1.20 PWM1.2) - LPC_PWM1->PCR &= ~(_BV(8 + pin_11_PWM_channel)); // disable PWM1 module control of this pin - map_MR[pin_11_PWM_channel - 1].PCR_bit = 0; - LPC_PINCON->PINSEL3 &= ~(0x3 << 8); // return pin to general purpose I/O - map_MR[pin_11_PWM_channel - 1].PINSEL3_bits = 0; - map_MR[pin_11_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM - break; - case 6: // Servo 1, PWM1 channel 3 (Pin 6 P1.21 PWM1.3) - LPC_PWM1->PCR &= ~(_BV(8 + pin_6_PWM_channel)); // disable PWM1 module control of this pin - map_MR[pin_6_PWM_channel - 1].PCR_bit = 0; - LPC_PINCON->PINSEL3 &= ~(0x3 << 10); // return pin to general purpose I/O - map_MR[pin_6_PWM_channel - 1].PINSEL3_bits = 0; - map_MR[pin_6_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM - break; - case 4: // Servo 3, PWM1 channel 1 (Pin 4 P1.18 PWM1.1) - LPC_PWM1->PCR &= ~(_BV(8 + pin_4_PWM_channel)); // disable PWM1 module control of this pin - map_MR[pin_4_PWM_channel - 1].PCR_bit = 0; - LPC_PINCON->PINSEL3 &= ~(0x3 << 4); // return pin to general purpose I/O - map_MR[pin_4_PWM_channel - 1].PINSEL3_bits = 0; - map_MR[pin_4_PWM_channel - 1].map_PWM_INT = 0; // 0 - available for interrupts, 1 - in use by PWM - break; - } - - pinMode(pin, INPUT); - - work_table[slot] = PWM_MAP_INIT_ROW; - - LPC1768_PWM_update(); - - return 1; -} - - -bool useable_hardware_PWM(uint8_t pin) { - COPY_ACTIVE_TABLE; // copy active table into work table - for (uint8_t i = 0; i < NUM_PWMS; i++) // see if it's already setup - if (work_table[i].logical_pin == pin && work_table[i].sequence) return true; - for (uint8_t i = 0; i < NUM_PWMS; i++) // see if there is an empty slot - if (!work_table[i].sequence) return true; - return false; // only get here if neither the above are true -} - -//////////////////////////////////////////////////////////////////////////////// - -#define HAL_PWM_LPC1768_ISR extern "C" void PWM1_IRQHandler(void) - - -// Both loops could be terminated when the last active channel is found but that would -// result in variations ISR run time which results in variations in pulse width - -/** - * Changes to PINSEL3, PCR and MCR are only done during the MR0 interrupt otherwise - * the wrong pin may be toggled or even have the system hang. - */ - - -HAL_PWM_LPC1768_ISR { - if (PWM_table_swap) ISR_table = work_table; // use old table if a swap was just done - else ISR_table = active_table; - - if (LPC_PWM1->IR & 0x1) { // MR0 interrupt - ISR_table = active_table; // MR0 means new values could have been loaded so set everything - if (PWM_table_swap) LPC_PWM1->MCR = LPC1768_PWM_interrupt_mask; // enable new PWM individual channel interrupts - - for (uint8_t i = 0; i < NUM_PWMS; i++) { - if(ISR_table[i].active_flag && !((ISR_table[i].logical_pin == 11) || - (ISR_table[i].logical_pin == 4) || - (ISR_table[i].logical_pin == 6))) - *ISR_table[i].set_register = ISR_table[i].write_mask; // set pins for all enabled interrupt channels active - if (PWM_table_swap && ISR_table[i].PCR_bit) { - LPC_PWM1->PCR |= ISR_table[i].PCR_bit; // enable PWM1 module control of this pin - LPC_PINCON->PINSEL3 |= ISR_table[i].PINSEL3_bits; // set pin mode to PWM1 control - must be done after PCR - } - } - PWM_table_swap = false; - PWM_MR0_wait = false; - LPC_PWM1->IR = 0x01; // clear the MR0 interrupt flag bit - } - else { - for (uint8_t i = 0; i < NUM_PWMS ; i++) - if (ISR_table[i].active_flag && (LPC_PWM1->IR & ISR_table[i].PWM_mask) ){ - LPC_PWM1->IR = ISR_table[i].PWM_mask; // clear the interrupt flag bits for expected interrupts - *ISR_table[i].clr_register = ISR_table[i].write_mask; // set channel to inactive - } - } - - LPC_PWM1->IR = 0x70F; // guarantees all interrupt flags are cleared which, if there is an unexpected - // PWM interrupt, will keep the ISR from hanging which will crash the controller - -return; -} -#endif - -///////////////////////////////////////////////////////////////// -///////////////// HARDWARE FIRMWARE INTERACTION //////////////// -///////////////////////////////////////////////////////////////// - -/** - * Almost all changes to the hardware registers must be coordinated with the Match Register 0 (MR0) - * interrupt. The only exception is detaching pins. It doesn't matter when they go - * tristate. - * - * The LPC1768_PWM_init routine kicks off the MR0 interrupt. This interrupt is never disabled or - * delayed. - * - * The PWM_table_swap flag is set when the firmware has swapped in an updated table. It is - * cleared by the ISR during the MR0 interrupt as it completes the swap and accompanying updates. - * It serves two purposes: - * 1) Tells the ISR that the tables have been swapped - * 2) Keeps the firmware from starting a new update until the previous one has been completed. - * - * The PWM_MR0_wait flag is set when the firmware is ready to swap in an updated table and cleared by - * the ISR during the MR0 interrupt. It is used to avoid delaying the MR0 interrupt when swapping in - * an updated table. This avoids glitches in pulse width and/or repetition rate. - * - * The sequence of events during a write to a PWM channel is: - * 1) Waits until PWM_table_swap flag is false before starting - * 2) Copies the active table into the work table - * 3) Updates the work table - * NOTES - MR1-MR6 are updated at this time. The updates aren't put into use until the first - * MR0 after the LER register has been written. The LER register is written during the - * table swap process. - * - The MCR mask is created at this time. It is not used until the ISR writes the MCR - * during the MR0 interrupt in the table swap process. - * 4) Sets the PWM_MR0_wait flag - * 5) ISR clears the PWM_MR0_wait flag during the next MR0 interrupt - * 6) Once the PWM_MR0_wait flag is cleared then the firmware: - * disables the ISR interrupt - * swaps the pointers to the tables - * writes to the LER register - * sets the PWM_table_swap flag active - * re-enables the ISR - * 7) On the next interrupt the ISR changes its pointer to the work table which is now the old, - * unmodified, active table. - * 8) On the next MR0 interrupt the ISR: - * switches over to the active table - * clears the PWM_table_swap and PWM_MR0_wait flags - * updates the MCR register with the possibly new interrupt sources/assignments - * writes to the PCR register to enable the direct control of the Servo 0, 1 & 3 pins by the PWM1 module - * sets the PINSEL3 register to function/mode 0x2 for the Servo 0, 1 & 3 pins - * NOTE - PCR must be set before PINSEL - * sets the pins controlled by the ISR to their active states - */ - +void LPC1768_PWM_init(void); +bool LPC1768_PWM_attach_pin(pin_t pin, uint32_t min = 1, uint32_t max = (LPC_PWM1_MR0 - MR0_MARGIN), uint8_t servo_index = 0xff); +void LPC1768_PWM_update_map_MR(void); +void LPC1768_PWM_update(void); +bool LPC1768_PWM_write(pin_t pin, uint32_t value); +bool LPC1768_PWM_detach_pin(pin_t pin); +bool useable_hardware_PWM(pin_t pin); diff --git a/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp b/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp index c8120b82dd..317433191c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/LPC1768_Servo.cpp @@ -64,13 +64,10 @@ #if HAS_SERVOS && defined(TARGET_LPC1768) + #include "LPC1768_PWM.h" #include "LPC1768_Servo.h" #include "servo_private.h" - extern bool LPC1768_PWM_attach_pin(uint8_t, uint32_t, uint32_t, uint8_t); - extern bool LPC1768_PWM_write(uint8_t, uint32_t); - extern bool LPC1768_PWM_detach_pin(uint8_t); - ServoInfo_t servo_info[MAX_SERVOS]; // static array of servo info structures uint8_t ServoCount = 0; // the total number of attached servos diff --git a/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp b/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp index bfc5fbebb3..21796bcf64 100644 --- a/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/SoftwareSerial.cpp @@ -40,7 +40,6 @@ http://arduiniana.org. #include #include "arduino.h" #include "pinmapping.h" -#include "pinmap_re_arm.h" #include "fastio.h" #include "SoftwareSerial.h" @@ -253,8 +252,8 @@ void SoftwareSerial::setRX(uint8_t rx) //if (!_inverse_logic) // digitalWrite(rx, HIGH); _receivePin = rx; - _receivePort = pin_map[rx].port; - _receivePortPin = pin_map[rx].pin; + _receivePort = LPC1768_PIN_PORT(rx); + _receivePortPin = LPC1768_PIN_PIN(rx); /* GPIO_T * rxPort = digitalPinToPort(rx); _receivePortRegister = portInputRegister(rxPort); _receiveBitMask = digitalPinToBitMask(rx);*/ diff --git a/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp b/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp index d3e91ce553..f1cf6f9838 100644 --- a/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/WInterrupts.cpp @@ -54,8 +54,8 @@ void attachInterrupt(const uint32_t pin, void (*callback)(void), uint32_t mode) __initialize(); ++enabled; } - uint8_t myport = pin_map[pin].port, - mypin = pin_map[pin].pin; + uint8_t myport = LPC1768_PIN_PORT(pin), + mypin = LPC1768_PIN_PIN(pin); if (myport == 0) callbacksP0[mypin] = callback; @@ -69,8 +69,8 @@ void attachInterrupt(const uint32_t pin, void (*callback)(void), uint32_t mode) void detachInterrupt(const uint32_t pin) { if (!INTERRUPT_PIN(pin)) return; - const uint8_t myport = pin_map[pin].port, - mypin = pin_map[pin].pin; + const uint8_t myport = LPC1768_PIN_PORT(pin), + mypin = LPC1768_PIN_PIN(pin); // Disable interrupt GpioDisableInt(myport, mypin); diff --git a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp b/Marlin/src/HAL/HAL_LPC1768/arduino.cpp index 32c4341660..4832c57f27 100644 --- a/Marlin/src/HAL/HAL_LPC1768/arduino.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/arduino.cpp @@ -23,6 +23,7 @@ #ifdef TARGET_LPC1768 #include "../../inc/MarlinConfig.h" +#include "LPC1768_PWM.h" #include @@ -70,26 +71,26 @@ extern "C" void delay(const int msec) { // IO functions // As defined by Arduino INPUT(0x0), OUPUT(0x1), INPUT_PULLUP(0x2) -void pinMode(uint8_t pin, uint8_t mode) { - if (!WITHIN(pin, 0, NUM_DIGITAL_PINS - 1) || pin_map[pin].port == 0xFF) +void pinMode(pin_t pin, uint8_t mode) { + if (!VALID_PIN(pin)) return; - PINSEL_CFG_Type config = { pin_map[pin].port, - pin_map[pin].pin, + PINSEL_CFG_Type config = { LPC1768_PIN_PORT(pin), + LPC1768_PIN_PIN(pin), PINSEL_FUNC_0, PINSEL_PINMODE_TRISTATE, PINSEL_PINMODE_NORMAL }; switch(mode) { case INPUT: - LPC_GPIO(pin_map[pin].port)->FIODIR &= ~LPC_PIN(pin_map[pin].pin); + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); PINSEL_ConfigPin(&config); break; case OUTPUT: - LPC_GPIO(pin_map[pin].port)->FIODIR |= LPC_PIN(pin_map[pin].pin); + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR |= LPC_PIN(LPC1768_PIN_PIN(pin)); PINSEL_ConfigPin(&config); break; case INPUT_PULLUP: - LPC_GPIO(pin_map[pin].port)->FIODIR &= ~LPC_PIN(pin_map[pin].pin); + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(pin)); config.Pinmode = PINSEL_PINMODE_PULLUP; PINSEL_ConfigPin(&config); break; @@ -98,14 +99,14 @@ void pinMode(uint8_t pin, uint8_t mode) { } } -void digitalWrite(uint8_t pin, uint8_t pin_status) { - if (!WITHIN(pin, 0, NUM_DIGITAL_PINS - 1) || pin_map[pin].port == 0xFF) +void digitalWrite(pin_t pin, uint8_t pin_status) { + if (!VALID_PIN(pin)) return; if (pin_status) - LPC_GPIO(pin_map[pin].port)->FIOSET = LPC_PIN(pin_map[pin].pin); + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(pin)); else - LPC_GPIO(pin_map[pin].port)->FIOCLR = LPC_PIN(pin_map[pin].pin); + LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(pin)); pinMode(pin, OUTPUT); // Set pin mode on every write (Arduino version does this) @@ -118,23 +119,19 @@ void digitalWrite(uint8_t pin, uint8_t pin_status) { */ } -bool digitalRead(uint8_t pin) { - if (!WITHIN(pin, 0, NUM_DIGITAL_PINS - 1) || pin_map[pin].port == 0xFF) { +bool digitalRead(pin_t pin) { + if (!VALID_PIN(pin)) { return false; } - return LPC_GPIO(pin_map[pin].port)->FIOPIN & LPC_PIN(pin_map[pin].pin) ? 1 : 0; + return LPC_GPIO(LPC1768_PIN_PORT(pin))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(pin)) ? 1 : 0; } -void analogWrite(uint8_t pin, int pwm_value) { // 1 - 254: pwm_value, 0: LOW, 255: HIGH - - extern bool LPC1768_PWM_attach_pin(uint8_t, uint32_t, uint32_t, uint8_t); - extern bool LPC1768_PWM_write(uint8_t, uint32_t); - extern bool LPC1768_PWM_detach_pin(uint8_t); +void analogWrite(pin_t pin, int pwm_value) { // 1 - 254: pwm_value, 0: LOW, 255: HIGH #define MR0_MARGIN 200 // if channel value too close to MR0 the system locks up static bool out_of_PWM_slots = false; - if (!WITHIN(pin, 0, NUM_DIGITAL_PINS - 1) || pin_map[pin].port == 0xFF) + if (!VALID_PIN(pin)) return; uint value = MAX(MIN(pwm_value, 255), 0); @@ -155,7 +152,7 @@ void analogWrite(uint8_t pin, int pwm_value) { // 1 - 254: pwm_value, 0: LOW, 2 extern bool HAL_adc_finished(); -uint16_t analogRead(uint8_t adc_pin) { +uint16_t analogRead(pin_t adc_pin) { HAL_adc_start_conversion(adc_pin); while (!HAL_adc_finished()); // Wait for conversion to finish return HAL_adc_get_result(); diff --git a/Marlin/src/HAL/HAL_LPC1768/fastio.h b/Marlin/src/HAL/HAL_LPC1768/fastio.h index 85d5ce2ab3..6f0b361463 100644 --- a/Marlin/src/HAL/HAL_LPC1768/fastio.h +++ b/Marlin/src/HAL/HAL_LPC1768/fastio.h @@ -45,15 +45,15 @@ bool useable_hardware_PWM(uint8_t pin); #define LPC_PIN(pin) (1UL << pin) #define LPC_GPIO(port) ((volatile LPC_GPIO_TypeDef *)(LPC_GPIO0_BASE + LPC_PORT_OFFSET * port)) -#define SET_DIR_INPUT(IO) (LPC_GPIO(DIO ## IO ## _PORT)->FIODIR &= ~LPC_PIN(DIO ## IO ##_PIN)) -#define SET_DIR_OUTPUT(IO) (LPC_GPIO(DIO ## IO ## _PORT)->FIODIR |= LPC_PIN(DIO ## IO ##_PIN)) +#define SET_DIR_INPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR &= ~LPC_PIN(LPC1768_PIN_PIN(IO))) +#define SET_DIR_OUTPUT(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIODIR |= LPC_PIN(LPC1768_PIN_PIN(IO))) -#define SET_MODE(IO, mode) (pin_mode((DIO ## IO ## _PORT, DIO ## IO ## _PIN), mode)) +#define SET_MODE(IO, mode) (pin_mode((LPC1768_PIN_PORT(IO), LPC1768_PIN_PIN(IO)), mode)) -#define WRITE_PIN_SET(IO) (LPC_GPIO(DIO ## IO ## _PORT)->FIOSET = LPC_PIN(DIO ## IO ##_PIN)) -#define WRITE_PIN_CLR(IO) (LPC_GPIO(DIO ## IO ## _PORT)->FIOCLR = LPC_PIN(DIO ## IO ##_PIN)) +#define WRITE_PIN_SET(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOSET = LPC_PIN(LPC1768_PIN_PIN(IO))) +#define WRITE_PIN_CLR(IO) (LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOCLR = LPC_PIN(LPC1768_PIN_PIN(IO))) -#define READ_PIN(IO) ((LPC_GPIO(DIO ## IO ## _PORT)->FIOPIN & LPC_PIN(DIO ## IO ##_PIN)) ? 1 : 0) +#define READ_PIN(IO) ((LPC_GPIO(LPC1768_PIN_PORT(IO))->FIOPIN & LPC_PIN(LPC1768_PIN_PIN(IO))) ? 1 : 0) #define WRITE_PIN(IO, v) ((v) ? WRITE_PIN_SET(IO) : WRITE_PIN_CLR(IO)) /** diff --git a/Marlin/src/HAL/HAL_LPC1768/include/Wire.h b/Marlin/src/HAL/HAL_LPC1768/include/Wire.h index 7e736829b5..d6da3b2311 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/Wire.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/Wire.h @@ -21,7 +21,7 @@ // Modified for use with the mcp4451 digipot routine -#if defined(TARGET_LPC1768) +#ifdef TARGET_LPC1768 #ifndef TwoWire_h #define TwoWire_h diff --git a/Marlin/src/HAL/HAL_LPC1768/include/arduino.h b/Marlin/src/HAL/HAL_LPC1768/include/arduino.h index 5a310f5750..a88324fcfd 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/arduino.h +++ b/Marlin/src/HAL/HAL_LPC1768/include/arduino.h @@ -26,6 +26,8 @@ #include #include +#include "../pinmapping.h" + #define LOW 0x00 #define HIGH 0x01 #define CHANGE 0x02 @@ -83,6 +85,7 @@ extern "C" void GpioDisableInt(uint32_t port, uint32_t pin); #define pgm_read_word(addr) pgm_read_word_near(addr) #define pgm_read_dword(addr) pgm_read_dword_near(addr) +#define memcpy_P memcpy #define sprintf_P sprintf #define strstr_P strstr #define strncpy_P strncpy @@ -99,11 +102,11 @@ void delayMicroseconds(unsigned long); uint32_t millis(); //IO functions -void pinMode(uint8_t, uint8_t); -void digitalWrite(uint8_t, uint8_t); -bool digitalRead(uint8_t); -void analogWrite(uint8_t, int); -uint16_t analogRead(uint8_t); +void pinMode(pin_t, uint8_t); +void digitalWrite(pin_t, uint8_t); +bool digitalRead(pin_t); +void analogWrite(pin_t, int); +uint16_t analogRead(pin_t); // EEPROM void eeprom_write_byte(unsigned char *pos, unsigned char value); diff --git a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c index 6b2372fcd6..a75b21c532 100644 --- a/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c +++ b/Marlin/src/HAL/HAL_LPC1768/include/digipot_mcp4451_I2C_routines.c @@ -25,7 +25,7 @@ -#if defined(TARGET_LPC1768) +#ifdef TARGET_LPC1768 #ifdef __cplusplus extern "C" { diff --git a/Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py b/Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py index a3138dfc07..4f888aa9f3 100644 --- a/Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py +++ b/Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py @@ -22,8 +22,7 @@ if __name__ == "__main__": "-MMD", "-MP", - "-DTARGET_LPC1768", - "-DIS_REARM" + "-DTARGET_LPC1768" ]) for i in range(1, len(sys.argv)): diff --git a/Marlin/src/HAL/HAL_LPC1768/main.cpp b/Marlin/src/HAL/HAL_LPC1768/main.cpp index 788193c5b1..a7f013de43 100644 --- a/Marlin/src/HAL/HAL_LPC1768/main.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/main.cpp @@ -100,7 +100,6 @@ int main(void) { HAL_timer_init(); - extern void LPC1768_PWM_init(); LPC1768_PWM_init(); setup(); diff --git a/Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp b/Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp index 5bcd3576e3..82fd567ab9 100644 --- a/Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/persistent_store_impl.cpp @@ -50,7 +50,8 @@ bool access_start() { if (res) MSC_Release_Lock(); if (res == FR_OK) { - uint16_t bytes_written, file_size = f_size(&eeprom_file); + UINT bytes_written; + FSIZE_t file_size = f_size(&eeprom_file); f_lseek(&eeprom_file, file_size); while (file_size <= E2END && res == FR_OK) { res = f_write(&eeprom_file, &eeprom_erase_value, 1, &bytes_written); @@ -99,7 +100,7 @@ bool access_finish() { bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) { FRESULT s; - uint16_t bytes_written = 0; + UINT bytes_written = 0; s = f_lseek(&eeprom_file, pos); if (s) { @@ -128,7 +129,7 @@ bool write_data(int &pos, const uint8_t *value, uint16_t size, uint16_t *crc) { } bool read_data(int &pos, uint8_t* value, uint16_t size, uint16_t *crc) { - uint16_t bytes_read = 0; + UINT bytes_read = 0; FRESULT s; s = f_lseek(&eeprom_file, pos); if ( s ) { diff --git a/Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h b/Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h deleted file mode 100644 index c4843d7f91..0000000000 --- a/Marlin/src/HAL/HAL_LPC1768/pinmap_re_arm.h +++ /dev/null @@ -1,464 +0,0 @@ -/** - * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * - * Based on Sprinter and grbl. - * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#ifndef __PINMAP_RE_ARM_H__ -#define __PINMAP_RE_ARM_H__ - -// ****************** -// Runtime pinmapping -// ****************** - -#if SERIAL_PORT == 0 - #define NUM_ANALOG_INPUTS 6 -#else - #define NUM_ANALOG_INPUTS 8 -#endif - -const adc_pin_data adc_pin_map[] = { - {0, 23, 0}, //A0 (T0) - D67 - TEMP_0_PIN - {0, 24, 1}, //A1 (T1) - D68 - TEMP_BED_PIN - {0, 25, 2}, //A2 (T2) - D69 - TEMP_1_PIN - {0, 26, 3}, //A3 - D63 - {1, 30, 4}, //A4 - D37 - BUZZER_PIN - {1, 31, 5}, //A5 - D49 - SD_DETECT_PIN - #if SERIAL_PORT != 0 - {0, 3, 6}, //A6 - D0 - RXD0 - {0, 2, 7} //A7 - D1 - TXD0 - #endif -}; - -constexpr FORCE_INLINE int8_t analogInputToDigitalPin(int8_t p) { - return (p == 0 ? 67: - p == 1 ? 68: - p == 2 ? 69: - p == 3 ? 63: - p == 4 ? 37: - p == 5 ? 49: - #if SERIAL_PORT != 0 - p == 6 ? 0: - p == 7 ? 1: - #endif - -1); -} - -constexpr FORCE_INLINE int8_t DIGITAL_PIN_TO_ANALOG_PIN(int8_t p) { - return (p == 67 ? 0: - p == 68 ? 1: - p == 69 ? 2: - p == 63 ? 3: - p == 37 ? 4: - p == 49 ? 5: - #if SERIAL_PORT != 0 - p == 0 ? 6: - p == 1 ? 7: - #endif - -1); -} - -#define NUM_DIGITAL_PINS 84 - -#define VALID_PIN(r) (r < 0 ? 0 :\ - r == 7 ? 0 :\ - r == 17 ? 0 :\ - r == 22 ? 0 :\ - r == 23 ? 0 :\ - r == 25 ? 0 :\ - r == 27 ? 0 :\ - r == 29 ? 0 :\ - r == 32 ? 0 :\ - r == 39 ? 0 :\ - r == 40 ? 0 :\ - r == 42 ? 0 :\ - r == 43 ? 0 :\ - r == 44 ? 0 :\ - r == 45 ? 0 :\ - r == 47 ? 0 :\ - r == 64 ? 0 :\ - r == 65 ? 0 :\ - r == 66 ? 0 :\ - r >= NUM_DIGITAL_PINS ? 0 : 1) - -#define PWM_PIN(r) (r < 0 ? 0 :\ - r == 3 ? 1 :\ - r == 4 ? 1 :\ - r == 6 ? 1 :\ - r == 9 ? 1 :\ - r == 10 ? 1 :\ - r == 11 ? 1 :\ - r == 14 ? 1 :\ - r == 26 ? 1 :\ - r == 46 ? 1 :\ - r == 53 ? 1 :\ - r == 54 ? 1 :\ - r == 60 ? 1 : 0) - -#define NUM_INTERRUPT_PINS 35 - -#define INTERRUPT_PIN(r) ( r< 0 ? 0 :\ - r == 0 ? 1 :\ - r == 1 ? 1 :\ - r == 8 ? 1 :\ - r == 9 ? 1 :\ - r == 10 ? 1 :\ - r == 12 ? 1 :\ - r == 16 ? 1 :\ - r == 20 ? 1 :\ - r == 21 ? 1 :\ - r == 24 ? 1 :\ - r == 25 ? 1 :\ - r == 26 ? 1 :\ - r == 28 ? 1 :\ - r == 34 ? 1 :\ - r == 35 ? 1 :\ - r == 36 ? 1 :\ - r == 38 ? 1 :\ - r == 46 ? 1 :\ - r == 48 ? 1 :\ - r == 50 ? 1 :\ - r == 51 ? 1 :\ - r == 52 ? 1 :\ - r == 54 ? 1 :\ - r == 55 ? 1 :\ - r == 56 ? 1 :\ - r == 57 ? 1 :\ - r == 58 ? 1 :\ - r == 59 ? 1 :\ - r == 60 ? 1 :\ - r == 61 ? 1 :\ - r == 62 ? 1 :\ - r == 63 ? 1 :\ - r == 67 ? 1 :\ - r == 68 ? 1 :\ - r == 69 ? 1 : 0) - /*Internal SD Card */ - /*r == 80 ? 1 :\ - r == 81 ? 1 :\ - r == 82 ? 1 :\ - r == 83 ? 1 :\*/ - -const pin_data pin_map[] = { // pin map for variable pin function - {0,3}, // DIO0 RXD0 A6 J4-4 AUX-1 - {0,2}, // DIO1 TXD0 A7 J4-5 AUX-1 - {1,25}, // DIO2 X_MAX_PIN 10K PULLUP TO 3.3v, 1K SERIES - {1,24}, // DIO3 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - {1,18}, // DIO4 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM - {1,19}, // DIO5 SERVO2_PIN - {1,21}, // DIO6 SERVO1_PIN J5-1 - {0xFF,0xFF}, // DIO7 N/C - {2,7}, // DIO8 RAMPS_D8_PIN - {2,4}, // DIO9 RAMPS_D9_PIN PWM - {2,5}, // DIO10 RAMPS_D10_PIN PWM - {1,20}, // DIO11 SERVO0_PIN - {2,12}, // DIO12 PS_ON_PIN - {4,28}, // DIO13 LED_PIN - {1,26}, // DIO14 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - {1,27}, // DIO15 Y_MAX_PIN 10K PULLUP TO 3.3v, 1K SERIES - {0,16}, // DIO16 LCD_PINS_RS J3-7 - {0xFF,0xFF}, // DIO17 LCD_PINS_ENABLE MOSI_PIN(MOSI0) J3-10 AUX-3 - {1,29}, // DIO18 Z_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - {1,28}, // DIO19 Z_MAX_PIN 10K PULLUP TO 3.3v, 1K SERIES - {0,0}, // DIO20 SCA - {0,1}, // DIO21 SCL - {0xFF,0xFF}, // DIO22 N/C - {0xFF,0xFF}, // DIO23 LCD_PINS_D4 SCK_PIN(SCLK0) J3-9 AUX-3 - {0,4}, // DIO24 E0_ENABLE_PIN - {0xFF,0xFF}, // DIO25 N/C - {2,0}, // DIO26 E0_STEP_PIN - {0xFF,0xFF}, // DIO27 N/C - {0,5}, // DIO28 E0_DIR_PIN - {0xFF,0xFF}, // DIO29 N/C - {4,29}, // DIO30 E1_ENABLE_PIN - {3,26}, // DIO31 BTN_EN1 - {0xFF,0xFF}, // DIO32 N/C - {3,25}, // DIO33 BTN_EN2 J3-4 - {2,13}, // DIO34 E1_DIR_PIN - {2,11}, // DIO35 BTN_ENC J3-3 - {2,8}, // DIO36 E1_STEP_PIN - {1,30}, // DIO37 BEEPER_PIN A4 not 5V tolerant - {0,10}, // DIO38 X_ENABLE_PIN - {0xFF,0xFF}, // DIO39 N/C - {0xFF,0xFF}, // DIO40 N/C - {1,22}, // DIO41 KILL_PIN J5-4 - {0xFF,0xFF}, // DIO42 N/C - {0xFF,0xFF}, // DIO43 N/C - {0xFF,0xFF}, // DIO44 N/C - {0xFF,0xFF}, // DIO45 N/C - {2,3}, // DIO46 Z_STEP_PIN - {0xFF,0xFF}, // DIO47 N/C - {0,22}, // DIO48 Z_DIR_PIN - {1,31}, // DIO49 SD_DETECT_PIN A5 J3-1 not 5V tolerant - {0,17}, // DIO50 MISO_PIN(MISO0) AUX-3 - {0,18}, // DIO51 MOSI_PIN(MOSI0) LCD_PINS_ENABLE J3-10 AUX-3 - {0,15}, // DIO52 SCK_PIN(SCLK0) LCD_PINS_D4 J3-9 AUX-3 - {1,23}, // DIO53 SDSS(SSEL0) J3-5 AUX-3 - {2,1}, // DIO54 X_STEP_PIN - {0,11}, // DIO55 X_DIR_PIN - {0,19}, // DIO56 Y_ENABLE_PIN - {0,27}, // DIO57 AUX-1 open collector - {0,28}, // DIO58 AUX-1 open collector - {2,6}, // DIO59 LCD_A0 J3-8 AUX-2 - {2,2}, // DIO60 Y_STEP_PIN - {0,20}, // DIO61 Y_DIR_PIN - {0,21}, // DIO62 Z_ENABLE_PIN - {0,26}, // DIO63 AUX-2 A3 J5-3 AUX-2 - {0xFF,0xFF}, // DIO64 N/C - {0xFF,0xFF}, // DIO65 N/C - {0xFF,0xFF}, // DIO66 N/C - {0,23}, // DIO67 TEMP_0_PIN A0 - {0,24}, // DIO68 TEMP_BED_PIN A1 - {0,25}, // DIO69 TEMP_1_PIN A2 - {1,16}, // DIO70 J12-3 ENET_MOC - {1,17}, // DIO71 J12-4 ENET_MDIO - {1,15}, // DIO72 J12-5 REF_CLK - {1,14}, // DIO73 J12-6 ENET_RX_ER - {1,9}, // DIO74 J12-7 ENET_RXD0 - {1,10}, // DIO75 J12-8 ENET_RXD1 - {1,8}, // DIO76 J12-9 ENET_CRS - {1,4}, // DIO77 J12-10 ENET_TX_EN - {1,0}, // DIO78 J12-11 ENET_TXD0 - {1,1}, // DIO79 J12-12 ENET_TXD1 - {0,14}, // DIO80 MKS-SBASE J7-6 & EXP1-5 - {0,7}, // DIO81 SD-SCK MKS-SBASE on board SD card and EXP2-2 - {0,8}, // DIO82 SD-MISO MKS-SBASE on board SD card and EXP2-1 - {0,9}, // DIO83 SD-MOSI MKS-SBASE n board SD card and EXP2-6 -// {0,6}, // DIO84 SD-CS on board SD card - -}; - -// *********************** -// Preprocessor pinmapping -// *********************** - -//#define RXD0 0 // A16 J4-4 AUX-1 -#define DIO0_PORT 0 -#define DIO0_PIN 3 -//#define TXD0 1 // A17 J4-5 AUX-1 -#define DIO1_PORT 0 -#define DIO1_PIN 2 -//#define X_MAX_PIN 2 // 10K PULLUP TO 3.3v, 1K SERIES -#define DIO2_PORT 1 -#define DIO2_PIN 25 -//#define X_MIN_PIN 3 // 10K PULLUP TO 3.3v, 1K SERIES -#define DIO3_PORT 1 -#define DIO3_PIN 24 -//#define SERVO3_PIN 4 // FIL_RUNOUT_PIN 5V output, PWM -#define DIO4_PORT 1 -#define DIO4_PIN 18 -//#define SERVO2_PIN 5 // -#define DIO5_PORT 1 -#define DIO5_PIN 19 -//#define SERVO1_PIN 6 // J5-1 -#define DIO6_PORT 1 -#define DIO6_PIN 21 -//#define RAMPS_D8_PIN 8 // -#define DIO8_PORT 2 -#define DIO8_PIN 7 -//#define RAMPS_D9_PIN 9 // PWM -#define DIO9_PORT 2 -#define DIO9_PIN 4 -//#define RAMPS_D10_PIN 10 // PWM -#define DIO10_PORT 2 -#define DIO10_PIN 5 -//#define SERVO0_PIN 11 // -#define DIO11_PORT 1 -#define DIO11_PIN 20 -//#define PS_ON_PIN 12 // -#define DIO12_PORT 2 -#define DIO12_PIN 12 -//#define LED_PIN 13 // -#define DIO13_PORT 4 -#define DIO13_PIN 28 -//#define Y_MIN_PIN 14 // 10K PULLUP TO 3.3v, 1K SERIES -#define DIO14_PORT 1 -#define DIO14_PIN 26 -//#define Y_MAX_PIN 15 // 10K PULLUP TO 3.3v, 1K SERIES -#define DIO15_PORT 1 -#define DIO15_PIN 27 -//#define LCD_PINS_RS 16 // J3-7 -#define DIO16_PORT 0 -#define DIO16_PIN 16 -//#define Z_MIN_PIN 18 // 10K PULLUP TO 3.3v, 1K SERIES -#define DIO18_PORT 1 -#define DIO18_PIN 29 -//#define Z_MAX_PIN 19 // 10K PULLUP TO 3.3v, 1K SERIES -#define DIO19_PORT 1 -#define DIO19_PIN 28 -//#define SCA 20 // -#define DIO20_PORT 0 -#define DIO20_PIN 0 -//#define SCL 21 // -#define DIO21_PORT 0 -#define DIO21_PIN 1 -//#define E0_ENABLE_PIN 24 // -#define DIO24_PORT 0 -#define DIO24_PIN 4 -//#define E0_STEP_PIN 26 // -#define DIO26_PORT 2 -#define DIO26_PIN 0 -//#define E0_DIR_PIN 28 // -#define DIO28_PORT 0 -#define DIO28_PIN 5 -//#define E1_ENABLE_PIN 30 // -#define DIO30_PORT 4 -#define DIO30_PIN 29 -//#define BTN_EN1 31 // -#define DIO31_PORT 3 -#define DIO31_PIN 26 -//#define BTN_EN2 33 // J3-4 -#define DIO33_PORT 3 -#define DIO33_PIN 25 -//#define E1_DIR_PIN 34 // -#define DIO34_PORT 2 -#define DIO34_PIN 13 -//#define BTN_ENC 35 // J3-3 -#define DIO35_PORT 2 -#define DIO35_PIN 11 -//#define E1_STEP_PIN 36 // -#define DIO36_PORT 2 -#define DIO36_PIN 8 -//#define BEEPER_PIN 37 // A18 not 5V tolerant -#define DIO37_PORT 1 -#define DIO37_PIN 30 -//#define X_ENABLE_PIN 38 // -#define DIO38_PORT 0 -#define DIO38_PIN 10 -//#define KILL_PIN 41 // J5-4 -#define DIO41_PORT 1 -#define DIO41_PIN 22 -//#define Z_STEP_PIN 46 // -#define DIO46_PORT 2 -#define DIO46_PIN 3 -//#define Z_DIR_PIN 48 // -#define DIO48_PORT 0 -#define DIO48_PIN 22 -//#define SD_DETECT_PIN 49 // A19 J3-1 not 5V tolerant -#define DIO49_PORT 1 -#define DIO49_PIN 31 -//#define MISO_PIN(MISO0) 50 // AUX-3 -#define DIO50_PORT 0 -#define DIO50_PIN 17 -//#define MOSI_PIN(MOSI0) 51 // LCD_PINS_ENABLE J3-10 AUX-3 -#define DIO51_PORT 0 -#define DIO51_PIN 18 -//#define SCK_PIN(SCLK0) 52 // LCD_PINS_D4 J3-9 AUX-3 -#define DIO52_PORT 0 -#define DIO52_PIN 15 -//#define SDSS(SSEL0) 53 // J3-5 AUX-3 -#define DIO53_PORT 1 -#define DIO53_PIN 23 -//#define X_STEP_PIN 54 // -#define DIO54_PORT 2 -#define DIO54_PIN 1 -//#define X_DIR_PIN 55 // -#define DIO55_PORT 0 -#define DIO55_PIN 11 -//#define Y_ENABLE_PIN 56 // -#define DIO56_PORT 0 -#define DIO56_PIN 19 -//#define AUX-1 57 // open collector -#define DIO57_PORT 0 -#define DIO57_PIN 27 -//#define AUX-1 58 // open collector -#define DIO58_PORT 0 -#define DIO58_PIN 28 -//#define LCD_A0 59 // J3-8 AUX-2 -#define DIO59_PORT 2 -#define DIO59_PIN 6 -//#define Y_STEP_PIN 60 // -#define DIO60_PORT 2 -#define DIO60_PIN 2 -//#define Y_DIR_PIN 61 // -#define DIO61_PORT 0 -#define DIO61_PIN 20 -//#define Z_ENABLE_PIN 62 // -#define DIO62_PORT 0 -#define DIO62_PIN 21 -//#define AUX-2 63 // A9 J5-3 AUX-2 -#define DIO63_PORT 0 -#define DIO63_PIN 26 -//#define TEMP_0_PIN 67 // A13 -#define DIO67_PORT 0 -#define DIO67_PIN 23 -//#define TEMP_BED_PIN 68 // A14 -#define DIO68_PORT 0 -#define DIO68_PIN 24 -//#define TEMP_1_PIN 69 // A15 -#define DIO69_PORT 0 -#define DIO69_PIN 25 -//#define J12-3 70 // ENET_MOC -#define DIO70_PORT 1 -#define DIO70_PIN 16 -//#define J12-4 71 // ENET_MDIO -#define DIO71_PORT 1 -#define DIO71_PIN 17 -//#define J12-5 72 // REF_CLK -#define DIO72_PORT 1 -#define DIO72_PIN 15 -//#define J12-6 73 // ENET_RX_ER -#define DIO73_PORT 1 -#define DIO73_PIN 14 -//#define J12-7 74 // ENET_RXD0 -#define DIO74_PORT 1 -#define DIO74_PIN 9 -//#define J12-8 75 // ENET_RXD1 -#define DIO75_PORT 1 -#define DIO75_PIN 10 -//#define J12-9 76 // ENET_CRS -#define DIO76_PORT 1 -#define DIO76_PIN 8 -//#define J12-10 77 // ENET_TX_EN -#define DIO77_PORT 1 -#define DIO77_PIN 4 -//#define J12-11 78 // ENET_TXD0 -#define DIO78_PORT 1 -#define DIO78_PIN 0 -//#define J12-12 79 // ENET_TXD1 -#define DIO79_PORT 1 -#define DIO79_PIN 1 -//#define J7-6 80 // MKS-SBASE J7-6 -#define DIO80_PORT 0 -#define DIO80_PIN 14 -//#define EXP2-2 81 // MKS-SBASE on board SD card and EXP2 -#define DIO81_PORT 0 -#define DIO81_PIN 7 -//#define EXP2-1 82 // MKS-SBASE on board SD card and EXP2 -#define DIO82_PORT 0 -#define DIO82_PIN 8 -//#define EXP2-6 83 // MKS-SBASE on board SD card and EXP2 -#define DIO83_PORT 0 -#define DIO83_PIN 9 -/** -//#define SD-CS 81 // on board SD card -#define DIO81_PORT 0 -#define DIO81_PIN 6 -//#define SD-SCK 82 // on board SD card -#define DIO82_PORT 0 -#define DIO82_PIN 7 -//#define SD-MISO 83 // on board SD card -#define DIO83_PORT 0 -#define DIO83_PIN 8 -//#define SD-MOSI 84 // on board SD card -#define DIO84_PORT 0 -#define DIO84_PIN 9 -*/ - -#endif //__PINMAP_RE_ARM_H__ diff --git a/Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp b/Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp new file mode 100644 index 0000000000..174ce8616f --- /dev/null +++ b/Marlin/src/HAL/HAL_LPC1768/pinmapping.cpp @@ -0,0 +1,50 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#ifdef TARGET_LPC1768 + +#include "../../inc/MarlinConfig.h" +#include "../../gcode/parser.h" + +int16_t GET_PIN_MAP_INDEX(pin_t pin) { + const uint8_t pin_port = LPC1768_PIN_PORT(pin), + pin_pin = LPC1768_PIN_PIN(pin); + for (size_t i = 0; i < NUM_DIGITAL_PINS; ++i) + if (LPC1768_PIN_PORT(pin_map[i]) == pin_port && LPC1768_PIN_PIN(pin_map[i]) == pin_pin) + return i; + + return -1; +} + +int16_t PARSED_PIN_INDEX(char code, int16_t dval) { + if (parser.seenval(code)) { + int port, pin; + if (sscanf(parser.strval(code), "%d.%d", &port, &pin) == 2) + for (size_t i = 0; i < NUM_DIGITAL_PINS; ++i) + if (LPC1768_PIN_PORT(pin_map[i]) == port && LPC1768_PIN_PIN(pin_map[i]) == pin) + return i; + } + + return dval; +} + +#endif // TARGET_LPC1768 \ No newline at end of file diff --git a/Marlin/src/HAL/HAL_LPC1768/pinmapping.h b/Marlin/src/HAL/HAL_LPC1768/pinmapping.h index adff789b88..2547480ad0 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinmapping.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinmapping.h @@ -24,13 +24,195 @@ #define __HAL_PINMAPPING_H__ #include "../../core/macros.h" -struct pin_data { uint8_t port, pin; }; -struct adc_pin_data { uint8_t port, pin, adc; }; +typedef int16_t pin_t; -#if ENABLED(IS_REARM) - #include "pinmap_re_arm.h" +const uint8_t PIN_FEATURE_INTERRUPT = 1 << 0; +const uint8_t PIN_FEATURE_PWM = 1 << 1; +constexpr uint8_t PIN_FEATURE_ADC(const int8_t chan) { return (((chan + 1) & 0b1111) << 2); } + +constexpr pin_t LPC1768_PIN(const uint8_t port, const uint8_t pin, const uint8_t feat = 0) { + return (((pin_t)feat << 8) | (((pin_t)port & 0x7) << 5) | ((pin_t)pin & 0x1F)); +} + +constexpr uint8_t LPC1768_PIN_PORT(const pin_t pin) { return ((uint8_t)((pin >> 5) & 0b111)); } +constexpr uint8_t LPC1768_PIN_PIN(const pin_t pin) { return ((uint8_t)(pin & 0b11111)); } +constexpr bool LPC1768_PIN_INTERRUPT(const pin_t pin) { return (((pin >> 8) & PIN_FEATURE_INTERRUPT) != 0); } +constexpr bool LPC1768_PIN_PWM(const pin_t pin) { return (((pin >> 8) & PIN_FEATURE_PWM) != 0); } +constexpr int8_t LPC1768_PIN_ADC(const pin_t pin) { return (int8_t)((pin >> 8) & 0b1111) - 1; } + +// ****************** +// Runtime pinmapping +// ****************** +#if SERIAL_PORT != 3 + const pin_t P0_0 = LPC1768_PIN(0, 0, PIN_FEATURE_INTERRUPT); + const pin_t P0_1 = LPC1768_PIN(0, 1, PIN_FEATURE_INTERRUPT); +#endif +#if SERIAL_PORT != 0 + const pin_t P0_2 = LPC1768_PIN(0, 2, PIN_FEATURE_INTERRUPT | PIN_FEATURE_ADC(7)); + const pin_t P0_3 = LPC1768_PIN(0, 3, PIN_FEATURE_INTERRUPT | PIN_FEATURE_ADC(6)); +#endif +const pin_t P0_4 = LPC1768_PIN(0, 4, PIN_FEATURE_INTERRUPT); +const pin_t P0_5 = LPC1768_PIN(0, 5, PIN_FEATURE_INTERRUPT); +const pin_t P0_6 = LPC1768_PIN(0, 6, PIN_FEATURE_INTERRUPT); +const pin_t P0_7 = LPC1768_PIN(0, 7, PIN_FEATURE_INTERRUPT); +const pin_t P0_8 = LPC1768_PIN(0, 8, PIN_FEATURE_INTERRUPT); +const pin_t P0_9 = LPC1768_PIN(0, 9, PIN_FEATURE_INTERRUPT); +#if SERIAL_PORT != 2 + const pin_t P0_10 = LPC1768_PIN(0, 10, PIN_FEATURE_INTERRUPT); + const pin_t P0_11 = LPC1768_PIN(0, 11, PIN_FEATURE_INTERRUPT); +#endif +#if SERIAL_PORT != 1 + const pin_t P0_15 = LPC1768_PIN(0, 15, PIN_FEATURE_INTERRUPT); + const pin_t P0_16 = LPC1768_PIN(0, 16, PIN_FEATURE_INTERRUPT); +#endif +const pin_t P0_17 = LPC1768_PIN(0, 17, PIN_FEATURE_INTERRUPT); +const pin_t P0_18 = LPC1768_PIN(0, 18, PIN_FEATURE_INTERRUPT); +const pin_t P0_19 = LPC1768_PIN(0, 19, PIN_FEATURE_INTERRUPT); +const pin_t P0_20 = LPC1768_PIN(0, 20, PIN_FEATURE_INTERRUPT); +const pin_t P0_21 = LPC1768_PIN(0, 21, PIN_FEATURE_INTERRUPT); +const pin_t P0_22 = LPC1768_PIN(0, 22, PIN_FEATURE_INTERRUPT); +const pin_t P0_23 = LPC1768_PIN(0, 23, PIN_FEATURE_INTERRUPT | PIN_FEATURE_ADC(0)); +const pin_t P0_24 = LPC1768_PIN(0, 24, PIN_FEATURE_INTERRUPT | PIN_FEATURE_ADC(1)); +const pin_t P0_25 = LPC1768_PIN(0, 25, PIN_FEATURE_INTERRUPT | PIN_FEATURE_ADC(2)); +const pin_t P0_26 = LPC1768_PIN(0, 26, PIN_FEATURE_INTERRUPT | PIN_FEATURE_ADC(3)); +const pin_t P0_27 = LPC1768_PIN(0, 27, PIN_FEATURE_INTERRUPT); +const pin_t P0_28 = LPC1768_PIN(0, 28, PIN_FEATURE_INTERRUPT); +const pin_t P0_29 = LPC1768_PIN(0, 29, PIN_FEATURE_INTERRUPT); +const pin_t P0_30 = LPC1768_PIN(0, 30, PIN_FEATURE_INTERRUPT); +const pin_t P1_0 = LPC1768_PIN(1, 0); +const pin_t P1_1 = LPC1768_PIN(1, 1); +const pin_t P1_4 = LPC1768_PIN(1, 4); +const pin_t P1_8 = LPC1768_PIN(1, 8); +const pin_t P1_9 = LPC1768_PIN(1, 9); +const pin_t P1_10 = LPC1768_PIN(1, 10); +const pin_t P1_14 = LPC1768_PIN(1, 14); +const pin_t P1_15 = LPC1768_PIN(1, 15); +const pin_t P1_16 = LPC1768_PIN(1, 16); +const pin_t P1_17 = LPC1768_PIN(1, 17); +const pin_t P1_18 = LPC1768_PIN(1, 18, PIN_FEATURE_PWM); +const pin_t P1_19 = LPC1768_PIN(1, 19); +const pin_t P1_20 = LPC1768_PIN(1, 20, PIN_FEATURE_PWM); +const pin_t P1_21 = LPC1768_PIN(1, 21, PIN_FEATURE_PWM); +const pin_t P1_22 = LPC1768_PIN(1, 22); +const pin_t P1_23 = LPC1768_PIN(1, 23, PIN_FEATURE_PWM); +const pin_t P1_24 = LPC1768_PIN(1, 24, PIN_FEATURE_PWM); +const pin_t P1_25 = LPC1768_PIN(1, 25); +const pin_t P1_26 = LPC1768_PIN(1, 26, PIN_FEATURE_PWM); +const pin_t P1_27 = LPC1768_PIN(1, 27); +const pin_t P1_28 = LPC1768_PIN(1, 28); +const pin_t P1_29 = LPC1768_PIN(1, 29); +const pin_t P1_30 = LPC1768_PIN(1, 30, PIN_FEATURE_ADC(4)); +const pin_t P1_31 = LPC1768_PIN(1, 31, PIN_FEATURE_ADC(5)); +const pin_t P2_0 = LPC1768_PIN(2, 0, PIN_FEATURE_INTERRUPT | PIN_FEATURE_PWM); +const pin_t P2_1 = LPC1768_PIN(2, 1, PIN_FEATURE_INTERRUPT | PIN_FEATURE_PWM); +const pin_t P2_2 = LPC1768_PIN(2, 2, PIN_FEATURE_INTERRUPT | PIN_FEATURE_PWM); +const pin_t P2_3 = LPC1768_PIN(2, 3, PIN_FEATURE_INTERRUPT | PIN_FEATURE_PWM); +const pin_t P2_4 = LPC1768_PIN(2, 4, PIN_FEATURE_INTERRUPT | PIN_FEATURE_PWM); +const pin_t P2_5 = LPC1768_PIN(2, 5, PIN_FEATURE_INTERRUPT | PIN_FEATURE_PWM); +const pin_t P2_6 = LPC1768_PIN(2, 6, PIN_FEATURE_INTERRUPT); +const pin_t P2_7 = LPC1768_PIN(2, 7, PIN_FEATURE_INTERRUPT); +const pin_t P2_8 = LPC1768_PIN(2, 8, PIN_FEATURE_INTERRUPT); +const pin_t P2_9 = LPC1768_PIN(2, 9, PIN_FEATURE_INTERRUPT); +const pin_t P2_10 = LPC1768_PIN(2, 10, PIN_FEATURE_INTERRUPT); +const pin_t P2_11 = LPC1768_PIN(2, 11, PIN_FEATURE_INTERRUPT); +const pin_t P2_12 = LPC1768_PIN(2, 12, PIN_FEATURE_INTERRUPT); +const pin_t P2_13 = LPC1768_PIN(2, 13, PIN_FEATURE_INTERRUPT); +const pin_t P3_25 = LPC1768_PIN(3, 25, PIN_FEATURE_PWM); +const pin_t P3_26 = LPC1768_PIN(3, 26, PIN_FEATURE_PWM); +const pin_t P4_28 = LPC1768_PIN(4, 28); +const pin_t P4_29 = LPC1768_PIN(4, 29); + +constexpr bool VALID_PIN(const pin_t p) { + return ( + #if SERIAL_PORT == 0 + (LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 1) || + (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 4, 11)) || + #elif SERIAL_PORT == 2 + (LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 9) || + #elif SERIAL_PORT == 3 + (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 2, 11)) || + #else + (LPC1768_PIN_PORT(p) == 0 && LPC1768_PIN_PIN(p) <= 11) || + #endif + #if SERIAL_PORT == 1 + (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 17, 30)) || + #else + (LPC1768_PIN_PORT(p) == 0 && WITHIN(LPC1768_PIN_PIN(p), 15, 30)) || + #endif + (LPC1768_PIN_PORT(p) == 1 && LPC1768_PIN_PIN(p) == 1) || + (LPC1768_PIN_PORT(p) == 1 && LPC1768_PIN_PIN(p) == 4) || + (LPC1768_PIN_PORT(p) == 1 && WITHIN(LPC1768_PIN_PIN(p), 8, 10)) || + (LPC1768_PIN_PORT(p) == 1 && WITHIN(LPC1768_PIN_PIN(p), 14, 31)) || + (LPC1768_PIN_PORT(p) == 2 && LPC1768_PIN_PIN(p) <= 13) || + (LPC1768_PIN_PORT(p) == 3 && WITHIN(LPC1768_PIN_PIN(p), 25, 26)) || + (LPC1768_PIN_PORT(p) == 4 && WITHIN(LPC1768_PIN_PIN(p), 28, 29)) + ); +} + +constexpr bool PWM_PIN(const pin_t p) { + return (VALID_PIN(p) && LPC1768_PIN_PWM(p)); +} + +constexpr bool INTERRUPT_PIN(const pin_t p) { + return (VALID_PIN(p) && LPC1768_PIN_INTERRUPT(p)); +} + +#if SERIAL_PORT == 0 + #define NUM_ANALOG_INPUTS 6 #else - #error "HAL: LPC1768: No defined pin-mapping" + #define NUM_ANALOG_INPUTS 8 #endif +constexpr pin_t adc_pin_table[] = { + P0_23, P0_24, P0_25, P0_26, P1_30, P1_31, + #if SERIAL_PORT != 0 + P0_3, P0_2 + #endif +}; + +constexpr pin_t analogInputToDigitalPin(const uint8_t p) { + return (p < COUNT(adc_pin_table) ? adc_pin_table[p] : -1); +} + +constexpr int8_t DIGITAL_PIN_TO_ANALOG_PIN(const pin_t p) { + return (VALID_PIN(p) ? LPC1768_PIN_ADC(p) : -1); +} + +// P0.6 thru P0.9 are for the onboard SD card +// P0.29 and P0.30 are for the USB port +#define HAL_SENSITIVE_PINS P0_6, P0_7, P0_8, P0_9, P0_29, P0_30 + +// Pin map for M43 and M226 +const pin_t pin_map[] = { + #if SERIAL_PORT != 3 + P0_0, P0_1, + #endif + #if SERIAL_PORT != 0 + P0_2, P0_3, + #endif + P0_4, P0_5, P0_6, P0_7, P0_8, P0_9, + #if SERIAL_PORT != 2 + P0_10, P0_11, + #endif + #if SERIAL_PORT != 1 + P0_15, P0_16, + #endif + P0_17, P0_18, P0_19, P0_20, P0_21, P0_22, P0_23, P0_24, + P0_25, P0_26, P0_27, P0_28, P0_29, P0_30, + P1_0, P1_1, P1_4, P1_8, P1_9, P1_10, P1_14, P1_15, + P1_16, P1_17, P1_18, P1_19, P1_20, P1_21, P1_22, P1_23, + P1_24, P1_25, P1_26, P1_27, P1_28, P1_29, P1_30, P1_31, + P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, + P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, + P3_25, P3_26, + P4_28, P4_29 +}; + +#define NUM_DIGITAL_PINS COUNT(pin_map) + +#define GET_PIN_MAP_PIN(i) (WITHIN(i, 0, (int)NUM_DIGITAL_PINS - 1) ? pin_map[i] : -1) + +int16_t GET_PIN_MAP_INDEX(pin_t pin); +int16_t PARSED_PIN_INDEX(char code, int16_t dval = 0); + #endif // __HAL_PINMAPPING_H__ diff --git a/Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h b/Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h similarity index 63% rename from Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h rename to Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h index a93f7c0767..e8d4af265c 100644 --- a/Marlin/src/HAL/HAL_LPC1768/pinsDebug_Re_ARM.h +++ b/Marlin/src/HAL/HAL_LPC1768/pinsDebug_LPC1768.h @@ -21,29 +21,27 @@ */ /** - * Support routines for Re-ARM board + * Support routines for LPC1768 */ -bool pin_Re_ARM_output; -bool pin_Re_ARM_analog; -int8_t pin_Re_ARM_pin; +// active ADC function/mode/code values for PINSEL registers +int8_t ADC_pin_mode(pin_t pin) { + uint8_t pin_port = LPC1768_PIN_PORT(pin); + uint8_t pin_port_pin = LPC1768_PIN_PIN(pin); + return (pin_port == 0 && pin_port_pin == 2 ? 2 : + pin_port == 0 && pin_port_pin == 3 ? 2 : + pin_port == 0 && pin_port_pin == 23 ? 1 : + pin_port == 0 && pin_port_pin == 24 ? 1 : + pin_port == 0 && pin_port_pin == 25 ? 1 : + pin_port == 0 && pin_port_pin == 26 ? 1 : + pin_port == 1 && pin_port_pin == 30 ? 3 : + pin_port == 1 && pin_port_pin == 31 ? 3 : -1); +} -void get_pin_info(int8_t pin) { - -if (pin == 7) return; - pin_Re_ARM_analog = 0; - pin_Re_ARM_pin = pin; - int8_t pin_port = pin_map[pin].port; - int8_t pin_port_pin = pin_map[pin].pin; - // active ADC function/mode/code values for PINSEL registers - int8_t ADC_pin_mode = pin_port == 0 && pin_port_pin == 2 ? 2 : - pin_port == 0 && pin_port_pin == 3 ? 2 : - pin_port == 0 && pin_port_pin == 23 ? 1 : - pin_port == 0 && pin_port_pin == 24 ? 1 : - pin_port == 0 && pin_port_pin == 25 ? 1 : - pin_port == 0 && pin_port_pin == 26 ? 1 : - pin_port == 1 && pin_port_pin == 30 ? 3 : - pin_port == 1 && pin_port_pin == 31 ? 3 : -1; +int8_t get_pin_mode(pin_t pin) { + if (!VALID_PIN(pin)) return -1; + uint8_t pin_port = LPC1768_PIN_PORT(pin); + uint8_t pin_port_pin = LPC1768_PIN_PIN(pin); //get appropriate PINSEL register volatile uint32_t * pinsel_reg = (pin_port == 0 && pin_port_pin <= 15) ? &LPC_PINCON->PINSEL0 : (pin_port == 0) ? &LPC_PINCON->PINSEL1 : @@ -52,16 +50,22 @@ if (pin == 7) return; pin_port == 2 ? &LPC_PINCON->PINSEL4 : pin_port == 3 ? &LPC_PINCON->PINSEL7 : &LPC_PINCON->PINSEL9; uint8_t pinsel_start_bit = pin_port_pin > 15 ? 2 * (pin_port_pin - 16) : 2 * pin_port_pin; - uint8_t pin_mode = (uint8_t) ((*pinsel_reg >> pinsel_start_bit) & 0x3); - uint32_t * FIO_reg[5] PROGMEM = {(uint32_t*) 0x2009C000,(uint32_t*) 0x2009C020,(uint32_t*) 0x2009C040,(uint32_t*) 0x2009C060,(uint32_t*) 0x2009C080}; - pin_Re_ARM_output = (*FIO_reg[pin_map[pin].port] >> pin_map[pin].pin) & 1; //input/output state except if active ADC + int8_t pin_mode = (int8_t) ((*pinsel_reg >> pinsel_start_bit) & 0x3); + return pin_mode; +} - if (pin_mode) { // if function/mode/code value not 0 then could be an active analog channel - if (ADC_pin_mode == pin_mode) { // found an active analog pin - pin_Re_ARM_output = 0; - pin_Re_ARM_analog = 1; - } - } +bool GET_PINMODE(pin_t pin) { + int8_t pin_mode = get_pin_mode(pin); + if (pin_mode == -1 || (pin_mode && pin_mode == ADC_pin_mode(pin))) // found an invalid pin or active analog pin + return false; + + uint32_t * FIO_reg[5] PROGMEM = {(uint32_t*) 0x2009C000,(uint32_t*) 0x2009C020,(uint32_t*) 0x2009C040,(uint32_t*) 0x2009C060,(uint32_t*) 0x2009C080}; + return ((*FIO_reg[LPC1768_PIN_PORT(pin)] >> LPC1768_PIN_PIN(pin) & 1) != 0); //input/output state +} + +bool GET_ARRAY_IS_DIGITAL(pin_t pin) { + int8_t pin_mode = get_pin_mode(pin); + return (pin_mode != -1 && (!get_pin_mode(pin) || pin_mode != ADC_pin_mode(pin))); } /** @@ -70,9 +74,7 @@ if (pin == 7) return; #define pwm_details(pin) pin = pin // do nothing // print PWM details #define pwm_status(pin) false //Print a pin's PWM status. Return true if it's currently a PWM pin. -#define GET_PIN_INFO(pin) get_pin_info(pin) #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P) >= 0 ? 1 : 0) -#define GET_PINMODE(pin) pin_Re_ARM_output #define digitalRead_mod(p) digitalRead(p) #define digitalPinToPort_DEBUG(p) 0 #define digitalPinToBitMask_DEBUG(pin) 0 @@ -81,4 +83,4 @@ if (pin == 7) return; #define NAME_FORMAT(p) PSTR("%-##p##s") // #define PRINT_ARRAY_NAME(x) do {sprintf_P(buffer, NAME_FORMAT(MAX_NAME_LENGTH) , pin_array[x].name); SERIAL_ECHO(buffer);} while (0) #define PRINT_ARRAY_NAME(x) do {sprintf_P(buffer, PSTR("%-35s") , pin_array[x].name); SERIAL_ECHO(buffer);} while (0) -#define GET_ARRAY_IS_DIGITAL(x) !pin_Re_ARM_analog +#define PRINT_PIN(p) do {sprintf_P(buffer, PSTR("%d.%02d "), LPC1768_PIN_PORT(p), LPC1768_PIN_PIN(p)); SERIAL_ECHO(buffer);} while (0) diff --git a/Marlin/src/HAL/HAL_LPC1768/spi_pins.h b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h index 6312f1ff60..1e8ff21617 100644 --- a/Marlin/src/HAL/HAL_LPC1768/spi_pins.h +++ b/Marlin/src/HAL/HAL_LPC1768/spi_pins.h @@ -31,13 +31,13 @@ //#define MOSI_PIN P0_9 //#define SS_PIN P0_6 /** external */ -#define SCK_PIN 52 //P0_15 -#define MISO_PIN 50 //P0_17 -#define MOSI_PIN 51 //P0_18 -#define SS_PIN 53 //P1_23 +#define SCK_PIN P0_15 +#define MISO_PIN P0_17 +#define MOSI_PIN P0_18 +#define SS_PIN P1_23 #define SDSS SS_PIN -#if (defined(IS_REARM) && !(defined(LPC_SOFTWARE_SPI))) // signal LCDs that they need to use the hardware SPI +#if (defined(TARGET_LPC1768) && !(defined(LPC_SOFTWARE_SPI))) // signal LCDs that they need to use the hardware SPI #define SHARED_SPI #endif diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h index 590b32856f..24b8801da3 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_Stm32f1.h @@ -98,6 +98,8 @@ // Types // -------------------------------------------------------------------------- +typedef int8_t pin_t; + // -------------------------------------------------------------------------- // Public Variables // -------------------------------------------------------------------------- @@ -192,4 +194,8 @@ void HAL_enable_AdcFreerun(void); */ +#define GET_PIN_MAP_PIN(index) index +#define GET_PIN_MAP_INDEX(pin) pin +#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) + #endif // _HAL_STM32F1_H diff --git a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h index 7065ebdb23..df155047ae 100644 --- a/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h +++ b/Marlin/src/HAL/HAL_STM32F1/HAL_timers_Stm32f1.h @@ -43,7 +43,7 @@ */ #define FORCE_INLINE __attribute__((always_inline)) inline -#define HAL_TIMER_TYPE uint16_t +typedef uint16_t timer_t; #define HAL_TIMER_TYPE_MAX 0xFFFF #define STEP_TIMER_NUM 5 // index of timer to use for stepper @@ -126,8 +126,8 @@ static FORCE_INLINE void HAL_timer_set_count (uint8_t timer_num, uint32_t count) } } -static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_count (uint8_t timer_num) { - HAL_TIMER_TYPE temp; +static FORCE_INLINE timer_t HAL_timer_get_count (uint8_t timer_num) { + timer_t temp; switch (timer_num) { case STEP_TIMER_NUM: temp = StepperTimer.getCompare(STEP_TIMER_CHAN); @@ -142,8 +142,8 @@ static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_count (uint8_t timer_num) { return temp; } -static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_current_count(uint8_t timer_num) { - HAL_TIMER_TYPE temp; +static FORCE_INLINE timer_t HAL_timer_get_current_count(uint8_t timer_num) { + timer_t temp; switch (timer_num) { case STEP_TIMER_NUM: temp = StepperTimer.getCount(); diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h index 13526f10f8..0ac8244e04 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_Teensy.h @@ -64,6 +64,8 @@ #define HAL_SERVO_LIB libServo +typedef int8_t pin_t; + #ifndef analogInputToDigitalPin #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1) #endif @@ -139,6 +141,10 @@ uint16_t HAL_adc_get_result(void); //void HAL_disable_AdcFreerun(uint8_t chan); */ +#define GET_PIN_MAP_PIN(index) index +#define GET_PIN_MAP_INDEX(pin) pin +#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) + // -------------------------------------------------------------------------- // // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h index e48ea54604..8139a33ad8 100644 --- a/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h +++ b/Marlin/src/HAL/HAL_TEENSY35_36/HAL_timers_Teensy.h @@ -40,7 +40,7 @@ #define FORCE_INLINE __attribute__((always_inline)) inline -#define HAL_TIMER_TYPE uint32_t +typedef uint32_t timer_t; #define HAL_TIMER_TYPE_MAX 0xFFFFFFFF #define STEP_TIMER_NUM 0 @@ -82,7 +82,7 @@ static FORCE_INLINE void HAL_timer_set_count(const uint8_t timer_num, const uint } } -static FORCE_INLINE HAL_TIMER_TYPE HAL_timer_get_count(const uint8_t timer_num) { +static FORCE_INLINE timer_t HAL_timer_get_count(const uint8_t timer_num) { switch(timer_num) { case 0: return FTM0_C0V; case 1: return FTM1_C0V; diff --git a/Marlin/src/HAL/HAL_pinsDebug.h b/Marlin/src/HAL/HAL_pinsDebug.h index 53d718f6f1..17c2c8eeb3 100644 --- a/Marlin/src/HAL/HAL_pinsDebug.h +++ b/Marlin/src/HAL/HAL_pinsDebug.h @@ -30,7 +30,7 @@ #elif IS_32BIT_TEENSY #include "HAL_TEENSY35_36/HAL_pinsDebug_Teensy.h" #elif defined(TARGET_LPC1768) - #include "HAL_LPC1768/pinsDebug_Re_ARM.h" + #include "HAL_LPC1768/pinsDebug_LPC1768.h" #else #error Unsupported Platform! #endif diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 75f10d0b83..80a974d135 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -297,10 +297,13 @@ void setup_powerhold() { /** * Sensitive pin test for M42, M226 */ -bool pin_is_protected(const int8_t pin) { - static const int8_t sensitive_pins[] PROGMEM = SENSITIVE_PINS; - for (uint8_t i = 0; i < COUNT(sensitive_pins); i++) - if (pin == (int8_t)pgm_read_byte(&sensitive_pins[i])) return true; +bool pin_is_protected(const pin_t pin) { + static const pin_t sensitive_pins[] PROGMEM = SENSITIVE_PINS; + for (uint8_t i = 0; i < COUNT(sensitive_pins); i++) { + pin_t sensitive_pin; + memcpy_P(&sensitive_pin, &sensitive_pins[i], sizeof(pin_t)); + if (pin == sensitive_pin) return true; + } return false; } @@ -789,7 +792,6 @@ void setup() { #endif #if ENABLED(NEOPIXEL_LED) - SET_OUTPUT(NEOPIXEL_PIN); setup_neopixel(); #endif diff --git a/Marlin/src/Marlin.h b/Marlin/src/Marlin.h index a1b79208a4..6930996024 100644 --- a/Marlin/src/Marlin.h +++ b/Marlin/src/Marlin.h @@ -216,7 +216,7 @@ extern millis_t max_inactive_time, stepper_inactive_time; extern int lpq_len; #endif -bool pin_is_protected(const int8_t pin); +bool pin_is_protected(const pin_t pin); #if HAS_SUICIDE inline void suicide() { OUT_WRITE(SUICIDE_PIN, LOW); } diff --git a/Marlin/src/config/default/Configuration.h b/Marlin/src/config/default/Configuration.h index 16ec71367a..0a5a049818 100644 --- a/Marlin/src/config/default/Configuration.h +++ b/Marlin/src/config/default/Configuration.h @@ -854,7 +854,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/default/Configuration_adv.h b/Marlin/src/config/default/Configuration_adv.h index 14c0fd8208..e6c0a1c2dd 100644 --- a/Marlin/src/config/default/Configuration_adv.h +++ b/Marlin/src/config/default/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -628,7 +637,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h index 2633c5a2f9..266cee41ec 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration.h @@ -874,7 +874,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1069,7 +1069,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1638,7 +1638,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h index d190904f12..d3e5d4de64 100644 --- a/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h +++ b/Marlin/src/config/examples/AlephObjects/TAZ4/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h index 9215f39ecb..1409e560a8 100644 --- a/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h +++ b/Marlin/src/config/examples/AliExpress/CL-260/Configuration.h @@ -854,7 +854,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Anet/A6/Configuration.h b/Marlin/src/config/examples/Anet/A6/Configuration.h index 52ba8bf25b..027ff1dd8e 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration.h @@ -973,7 +973,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1206,7 +1206,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1777,7 +1777,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h index 209311e2c1..bb35ecaa32 100644 --- a/Marlin/src/config/examples/Anet/A6/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A6/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Anet/A8/Configuration.h b/Marlin/src/config/examples/Anet/A8/Configuration.h index 082671d0e5..553cfc9bcf 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration.h @@ -860,7 +860,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1055,7 +1055,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1626,7 +1626,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h index 70675f3558..2b34eb4aa7 100644 --- a/Marlin/src/config/examples/Anet/A8/Configuration_adv.h +++ b/Marlin/src/config/examples/Anet/A8/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h index 018aca9239..011e81cb2b 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration.h @@ -845,7 +845,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1040,7 +1040,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1609,7 +1609,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h index f045bdd4cb..ddf77e7f59 100644 --- a/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h index f5e9e1d6f3..344d85d8a3 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration.h @@ -1050,7 +1050,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1619,7 +1619,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h index ce8b341bec..d669a13410 100644 --- a/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/Hephestos_2/Configuration_adv.h @@ -559,11 +559,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -624,7 +633,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h index 4d06dfa1a5..4be4a256dd 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration.h @@ -845,7 +845,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1040,7 +1040,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1609,7 +1609,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h index f045bdd4cb..ddf77e7f59 100644 --- a/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h +++ b/Marlin/src/config/examples/BQ/WITBOX/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Cartesio/Configuration.h b/Marlin/src/config/examples/Cartesio/Configuration.h index 5f5552c8ea..b4d9101aa7 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration.h +++ b/Marlin/src/config/examples/Cartesio/Configuration.h @@ -853,7 +853,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1048,7 +1048,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1617,7 +1617,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Cartesio/Configuration_adv.h b/Marlin/src/config/examples/Cartesio/Configuration_adv.h index 31ad3fac39..3f53c38907 100644 --- a/Marlin/src/config/examples/Cartesio/Configuration_adv.h +++ b/Marlin/src/config/examples/Cartesio/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration.h b/Marlin/src/config/examples/Creality/CR-10/Configuration.h index a5c7346f58..8eaebb3f6c 100755 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration.h @@ -864,7 +864,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1059,7 +1059,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1628,7 +1628,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h index dda5ec9866..67c3d8a766 100644 --- a/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h +++ b/Marlin/src/config/examples/Creality/CR-10/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** diff --git a/Marlin/src/config/examples/Felix/Configuration.h b/Marlin/src/config/examples/Felix/Configuration.h index f590ba29ff..f9982ed99f 100644 --- a/Marlin/src/config/examples/Felix/Configuration.h +++ b/Marlin/src/config/examples/Felix/Configuration.h @@ -836,7 +836,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1031,7 +1031,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1600,7 +1600,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Felix/Configuration_adv.h b/Marlin/src/config/examples/Felix/Configuration_adv.h index 30c41ebd07..06df861494 100644 --- a/Marlin/src/config/examples/Felix/Configuration_adv.h +++ b/Marlin/src/config/examples/Felix/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Felix/DUAL/Configuration.h b/Marlin/src/config/examples/Felix/DUAL/Configuration.h index f7c42928ab..fbda372834 100644 --- a/Marlin/src/config/examples/Felix/DUAL/Configuration.h +++ b/Marlin/src/config/examples/Felix/DUAL/Configuration.h @@ -836,7 +836,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1031,7 +1031,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1600,7 +1600,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h similarity index 99% rename from Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h rename to Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h index 2eca0a5915..bea96740a9 100644 --- a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration.h @@ -851,7 +851,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1046,7 +1046,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1615,7 +1615,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h similarity index 99% rename from Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h rename to Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h index 8c84c683fc..67e62bfd43 100644 --- a/Marlin/src/config/examples/Folger Tech/i3-2020/Configuration_adv.h +++ b/Marlin/src/config/examples/FolgerTech/i3-2020/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** diff --git a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h index a182ceb06b..43c87259b1 100644 --- a/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/GT2560/Configuration.h @@ -869,7 +869,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1064,7 +1064,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1633,7 +1633,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h index ed2b4bdaea..0b0aa311b1 100644 --- a/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h +++ b/Marlin/src/config/examples/Geeetech/I3_Pro_X-GT2560/Configuration.h @@ -854,7 +854,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h index 26de7f4d93..529bebcf81 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration.h @@ -858,7 +858,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1053,7 +1053,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1622,7 +1622,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h index 6c7f2c3d20..5ed13679a0 100644 --- a/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h +++ b/Marlin/src/config/examples/Infitary/i3-M508/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration.h b/Marlin/src/config/examples/Malyan/M150/Configuration.h index 226042a7dc..91215949e8 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration.h @@ -878,7 +878,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1077,7 +1077,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1646,7 +1646,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h index 764b58e361..c4864784de 100644 --- a/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h +++ b/Marlin/src/config/examples/Malyan/M150/Configuration_adv.h @@ -556,14 +556,20 @@ // This allows hosts to request long names for files and folders with M33 #define LONG_FILENAME_HOST_SUPPORT - // Enable this option to scroll long filenames in the SD card menu - //#define SCROLL_LONG_FILENAMES - - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -624,7 +630,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Micromake/C1/README.md b/Marlin/src/config/examples/Micromake/C1/README.md index 5e5f0afafa..0111f6f00a 100644 --- a/Marlin/src/config/examples/Micromake/C1/README.md +++ b/Marlin/src/config/examples/Micromake/C1/README.md @@ -13,4 +13,3 @@ Configuration files for Micromake C1 with… - 128 STEPS configured with jumper on the motherboard (all open for 128 Steps). - Capacitive Probe (Adjust offsets at your convenience) - French language with no accents for Japanese LCD. - diff --git a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h index 1e65243237..48484033e7 100644 --- a/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/basic/Configuration.h @@ -858,7 +858,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1053,7 +1053,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1622,7 +1622,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h index d1fc92549a..cb6812c627 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration.h @@ -858,7 +858,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1053,7 +1053,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1622,7 +1622,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h index e4f77d3070..e367858b28 100644 --- a/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h +++ b/Marlin/src/config/examples/Micromake/C1/enhanced/Configuration_adv.h @@ -563,11 +563,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -628,7 +637,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration.h b/Marlin/src/config/examples/Mks/Sbase/Configuration.h index 636f46e258..bbb05dcbd4 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration.h @@ -856,7 +856,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1051,7 +1051,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1594,7 +1594,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h index fae5ea1ccf..fd6001fbad 100644 --- a/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h +++ b/Marlin/src/config/examples/Mks/Sbase/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -634,7 +643,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h index 277ddc8c7e..fb79dcf643 100644 --- a/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h +++ b/Marlin/src/config/examples/RepRapWorld/Megatronics/Configuration.h @@ -854,7 +854,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/RigidBot/Configuration.h b/Marlin/src/config/examples/RigidBot/Configuration.h index 8af196eba4..c8667c6865 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration.h +++ b/Marlin/src/config/examples/RigidBot/Configuration.h @@ -1047,7 +1047,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/RigidBot/Configuration_adv.h b/Marlin/src/config/examples/RigidBot/Configuration_adv.h index 5ad95c98cc..bea4d0c58a 100644 --- a/Marlin/src/config/examples/RigidBot/Configuration_adv.h +++ b/Marlin/src/config/examples/RigidBot/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/SCARA/Configuration.h b/Marlin/src/config/examples/SCARA/Configuration.h index 44432618f7..33e902c7ae 100644 --- a/Marlin/src/config/examples/SCARA/Configuration.h +++ b/Marlin/src/config/examples/SCARA/Configuration.h @@ -1061,7 +1061,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1630,7 +1630,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/SCARA/Configuration_adv.h b/Marlin/src/config/examples/SCARA/Configuration_adv.h index de89cc7e57..aab2c3523e 100644 --- a/Marlin/src/config/examples/SCARA/Configuration_adv.h +++ b/Marlin/src/config/examples/SCARA/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration.h b/Marlin/src/config/examples/Sanguinololu/Configuration.h index 6267b43111..a2a41dff0e 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration.h @@ -1080,7 +1080,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1649,7 +1649,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h index 2ecd9ef447..da3e5d98c3 100644 --- a/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h +++ b/Marlin/src/config/examples/Sanguinololu/Configuration_adv.h @@ -551,11 +551,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -616,7 +625,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration.h b/Marlin/src/config/examples/TinyBoy2/Configuration.h index 194e73aecf..b5d66d7104 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration.h @@ -1105,7 +1105,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1674,7 +1674,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h index f75e352137..ab2d2343da 100644 --- a/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h +++ b/Marlin/src/config/examples/TinyBoy2/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration.h b/Marlin/src/config/examples/Velleman/K8200/Configuration.h index d085210a7f..0c31b8394d 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration.h @@ -1079,7 +1079,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1653,7 +1653,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h index d63595d1a3..abdcd18925 100644 --- a/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8200/Configuration_adv.h @@ -570,11 +570,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -635,7 +644,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Configuration.h index cb80eba1f3..d4a96b9e62 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration.h @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h index 6428a21194..50049be2e3 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h +++ b/Marlin/src/config/examples/Velleman/K8400/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h index 9ed95be6ad..b50829962a 100644 --- a/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h +++ b/Marlin/src/config/examples/Velleman/K8400/Dual-head/Configuration.h @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h index efe6373b59..6f5caea0ac 100644 --- a/Marlin/src/config/examples/adafruit/ST7565/Configuration.h +++ b/Marlin/src/config/examples/adafruit/ST7565/Configuration.h @@ -854,7 +854,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1049,7 +1049,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1618,7 +1618,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h index a8bc014842..17cff0ef91 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration.h @@ -496,6 +496,12 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) // set the default number of probe points : n*n (1 -> 7) #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + + // Enable and set these values based on results of 'G33 A1' + //#define H_FACTOR 1.01 + //#define R_FACTOR 2.61 + //#define A_FACTOR 0.87 + #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) @@ -978,7 +984,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1176,7 +1182,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1746,7 +1752,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h index 6a6379658a..32bf91fec6 100644 --- a/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/auto_calibrate/Configuration_adv.h @@ -564,11 +564,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -629,7 +638,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h index 6d536475c1..49ac6ede2a 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration.h @@ -496,6 +496,12 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) // set the default number of probe points : n*n (1 -> 7) #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + + // Enable and set these values based on results of 'G33 A1' + //#define H_FACTOR 1.01 + //#define R_FACTOR 2.61 + //#define A_FACTOR 0.87 + #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) @@ -978,7 +984,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1170,7 +1176,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1739,7 +1745,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h index 04ae683d0d..88697c8e19 100644 --- a/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/FLSUN/kossel_mini/Configuration_adv.h @@ -564,11 +564,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -629,7 +638,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/delta/generic/Configuration.h b/Marlin/src/config/examples/delta/generic/Configuration.h index ed859f6c81..2542f3f370 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration.h +++ b/Marlin/src/config/examples/delta/generic/Configuration.h @@ -486,6 +486,12 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) // set the default number of probe points : n*n (1 -> 7) #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + + // Enable and set these values based on results of 'G33 A1' + //#define H_FACTOR 1.01 + //#define R_FACTOR 2.61 + //#define A_FACTOR 0.87 + #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) @@ -965,7 +971,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1165,7 +1171,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1734,7 +1740,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/delta/generic/Configuration_adv.h b/Marlin/src/config/examples/delta/generic/Configuration_adv.h index 04ae683d0d..88697c8e19 100644 --- a/Marlin/src/config/examples/delta/generic/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/generic/Configuration_adv.h @@ -564,11 +564,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -629,7 +638,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h index 7d15cdeb23..94a74254d8 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration.h @@ -486,6 +486,12 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) // set the default number of probe points : n*n (1 -> 7) #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + + // Enable and set these values based on results of 'G33 A1' + //#define H_FACTOR 1.01 + //#define R_FACTOR 2.61 + //#define A_FACTOR 0.87 + #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) @@ -1168,7 +1174,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1737,7 +1743,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h index 04ae683d0d..88697c8e19 100644 --- a/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_mini/Configuration_adv.h @@ -564,11 +564,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -629,7 +638,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h index d88cdb51ac..dce7a25b02 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration.h @@ -472,6 +472,12 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) // set the default number of probe points : n*n (1 -> 7) #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + + // Enable and set these values based on results of 'G33 A1' + //#define H_FACTOR 1.01 + //#define R_FACTOR 2.61 + //#define A_FACTOR 0.87 + #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) @@ -968,7 +974,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1168,7 +1174,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1737,7 +1743,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h index 75a918e647..371eddd949 100644 --- a/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_pro/Configuration_adv.h @@ -569,11 +569,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -634,7 +643,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h index d17a5735ab..ba73a95e59 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration.h @@ -490,6 +490,12 @@ #if ENABLED(DELTA_AUTO_CALIBRATION) // set the default number of probe points : n*n (1 -> 7) #define DELTA_CALIBRATION_DEFAULT_POINTS 4 + + // Enable and set these values based on results of 'G33 A1' + //#define H_FACTOR 1.01 + //#define R_FACTOR 2.61 + //#define A_FACTOR 0.87 + #endif #if ENABLED(DELTA_AUTO_CALIBRATION) || ENABLED(DELTA_CALIBRATION_MENU) @@ -977,7 +983,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1177,7 +1183,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1746,7 +1752,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h index aa05d414fc..af8bec56d1 100644 --- a/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h +++ b/Marlin/src/config/examples/delta/kossel_xl/Configuration_adv.h @@ -564,11 +564,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -629,7 +638,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h index e6578f5b3a..e7918142d4 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration.h @@ -868,7 +868,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1063,7 +1063,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1632,7 +1632,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h index 54ae9d1c92..792de3f970 100644 --- a/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h +++ b/Marlin/src/config/examples/gCreate/gMax1.5+/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping #define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/makibox/Configuration.h b/Marlin/src/config/examples/makibox/Configuration.h index 13414e4f3c..1c333ab31a 100644 --- a/Marlin/src/config/examples/makibox/Configuration.h +++ b/Marlin/src/config/examples/makibox/Configuration.h @@ -857,7 +857,7 @@ * - AUTO_BED_LEVELING_UBL (Unified Bed Leveling) * A comprehensive bed leveling system combining the features and benefits * of other systems. UBL also includes integrated Mesh Generation, Mesh - * Validation and Mesh Editing systems. + * Validation and Mesh Editing systems. * * - MESH_BED_LEVELING * Probe a grid manually @@ -1052,7 +1052,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1621,7 +1621,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/makibox/Configuration_adv.h b/Marlin/src/config/examples/makibox/Configuration_adv.h index 68782035ae..24016c4a25 100644 --- a/Marlin/src/config/examples/makibox/Configuration_adv.h +++ b/Marlin/src/config/examples/makibox/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/stm32f103ret6/Configuration.h b/Marlin/src/config/examples/stm32f103ret6/Configuration.h index e9292e3880..53d98dd26f 100644 --- a/Marlin/src/config/examples/stm32f103ret6/Configuration.h +++ b/Marlin/src/config/examples/stm32f103ret6/Configuration.h @@ -176,6 +176,21 @@ //#define HOTEND_OFFSET_Z { 0.0, 0.0 } #endif +/** + * Two separate X-carriages with extruders that connect to a moving part + * via a magnetic docking mechanism. Requires SOL1_PIN and SOL2_PIN. + */ +//#define PARKING_EXTRUDER +#if ENABLED(PARKING_EXTRUDER) + #define PARKING_EXTRUDER_SOLENOIDS_INVERT // If enabled, the solenoid is NOT magnetized with applied voltage + #define PARKING_EXTRUDER_SOLENOIDS_PINS_ACTIVE LOW // LOW or HIGH pin signal energizes the coil + #define PARKING_EXTRUDER_SOLENOIDS_DELAY 250 // Delay (ms) for magnetic field. No delay if 0 or not defined. + #define PARKING_EXTRUDER_PARKING_X { -78, 184 } // X positions for parking the extruders + #define PARKING_EXTRUDER_GRAB_DISTANCE 1 // mm to move beyond the parking point to grab the extruder + #define PARKING_EXTRUDER_SECURITY_RAISE 5 // Z-raise before parking + #define HOTEND_OFFSET_Z { 0.0, 1.3 } // Z-offsets of the two hotends. The first must be 0. +#endif + /** * "Mixing Extruder" * - Adds a new code, M165, to set the current mix factors. @@ -186,7 +201,7 @@ */ //#define MIXING_EXTRUDER #if ENABLED(MIXING_EXTRUDER) - #define MIXING_STEPPERS 3 // Number of steppers in your mixing extruder + #define MIXING_STEPPERS 2 // Number of steppers in your mixing extruder #define MIXING_VIRTUAL_TOOLS 16 // Use the Virtual Tool method with M163 and M164 //#define DIRECT_MIXING_IN_G1 // Allow ABCDHI mix factors in G1 movement commands #endif @@ -543,7 +558,7 @@ /** * Default Jerk (mm/s) - * Override with M205 X Y Z EM + * Override with M205 X Y Z E * * "Jerk" specifies the minimum speed change that requires acceleration. * When changing speed and direction, if the difference is less than the @@ -596,7 +611,7 @@ * Probe Type * * Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, etc. - * You must activate one of these to use Auto Bed Leveling below. + * Activate one of these to use Auto Bed Leveling below. */ /** @@ -627,14 +642,15 @@ #endif /** - * Enable if probing seems unreliable. Heaters and/or fans - consistent with the - * options selected below - will be disabled during probing so as to minimize - * potential EM interference by quieting/silencing the source of the 'noise' (the change - * in current flowing through the wires). This is likely most useful to users of the - * BLTouch probe, but may also help those with inductive or other probe types. + * Enable one or more of the following if probing seems unreliable. + * Heaters and/or fans can be disabled during probing to minimize electrical + * noise. A delay can also be added to allow noise and vibration to settle. + * These options are most useful for the BLTouch probe, but may also improve + * readings with inductive probes and piezo sensors. */ //#define PROBING_HEATERS_OFF // Turn heaters off when probing //#define PROBING_FANS_OFF // Turn fans off when probing +//#define DELAY_BEFORE_PROBING 200 // (ms) To prevent vibrations from triggering piezo sensors // A probe that is deployed and stowed with a solenoid pin (SOL1_PIN) //#define SOLENOID_PROBE @@ -935,7 +951,7 @@ #define UBL_PROBE_PT_3_X 180 #define UBL_PROBE_PT_3_Y 20 - #define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation + //#define UBL_G26_MESH_VALIDATION // Enable G26 mesh validation #define UBL_MESH_EDIT_MOVES_Z // Sophisticated users prefer no movement of nozzle #define UBL_SAVE_ACTIVE_ON_M500 // Save the currently active mesh in the current slot on M500 @@ -964,6 +980,9 @@ #define LCD_PROBE_Z_RANGE 4 // Z Range centered on Z_MIN_POS for LCD Z adjustment #endif +// Add a menu item to move between bed corners for manual bed adjustment +//#define LEVEL_BED_CORNERS + /** * Commands to execute at the end of G29 probing. * Useful to retract or move the Z probe out of the way. @@ -1033,7 +1052,7 @@ // // M100 Free Memory Watcher // -#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1204,7 +1223,7 @@ * - Click the controller to view the LCD menu * - The LCD will display Japanese, Western, or Cyrillic text * - * See https://github.com/MarlinFirmware/Marlin/wiki/LCD-Language + * See http://marlinfw.org/docs/development/lcd_language.html * * :['JAPANESE', 'WESTERN', 'CYRILLIC'] */ @@ -1330,12 +1349,6 @@ // //#define ULTIPANEL -// -// Cartesio UI -// http://mauk.cc/webshop/cartesio-shop/electronics/user-interface -// -//#define CARTESIO_UI - // // PanelOne from T3P3 (via RAMPS 1.4 AUX2/AUX3) // http://reprap.org/wiki/PanelOne @@ -1418,6 +1431,12 @@ // //#define BQ_LCD_SMART_CONTROLLER +// +// Cartesio UI +// http://mauk.cc/webshop/cartesio-shop/electronics/user-interface +// +//#define CARTESIO_UI + // // ANET_10 Controller supported displays. // @@ -1504,6 +1523,35 @@ // //#define OLED_PANEL_TINYBOY2 +// +// Makeboard 3D Printer Parts 3D Printer Mini Display 1602 Mini Controller +// https://www.aliexpress.com/item/Micromake-Makeboard-3D-Printer-Parts-3D-Printer-Mini-Display-1602-Mini-Controller-Compatible-with-Ramps-1/32765887917.html +// +//#define MAKEBOARD_MINI_2_LINE_DISPLAY_1602 + +// +// MKS MINI12864 with graphic controller and SD support +// http://reprap.org/wiki/MKS_MINI_12864 +// +//#define MKS_MINI_12864 + +// +// Factory display for Creality CR-10 +// https://www.aliexpress.com/item/Universal-LCD-12864-3D-Printer-Display-Screen-With-Encoder-For-CR-10-CR-7-Model/32833148327.html +// +// This is RAMPS-compatible using a single 10-pin connector. +// (For CR-10 owners who want to replace the Melzi Creality board but retain the display) +// +//#define CR10_STOCKDISPLAY + +// +// MKS OLED 1.3" 128 × 64 FULL GRAPHICS CONTROLLER +// http://reprap.org/wiki/MKS_12864OLED +// +// Tiny, but very sharp OLED display +// +//#define MKS_12864OLED + // // AZSMZ 12864 LCD with SD // https://www.aliexpress.com/store/product/3D-printer-smart-controller-SMART-RAMPS-OR-RAMPS-1-4-LCD-12864-LCD-control-panel-green/2179173_32213636460.html @@ -1566,14 +1614,20 @@ * Adds the M150 command to set the LED (or LED strip) color. * If pins are PWM capable (e.g., 4, 5, 6, 11) then a range of * luminance values can be set from 0 to 255. + * For Neopixel LED an overall brightness parameter is also available. * * *** CAUTION *** * LED Strips require a MOFSET Chip between PWM lines and LEDs, * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! + * NOTE: A separate 5V power supply is required! The Neopixel LED needs + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * + * LED Type. Enable only one of the following two options. + * */ + //#define RGB_LED //#define RGBW_LED #if ENABLED(RGB_LED) || ENABLED(RGBW_LED) @@ -1626,7 +1680,7 @@ // Delay (in milliseconds) before the next move will start, to give the servo time to reach its target angle. // 300ms is a good value but you can try less delay. // If the servo can't reach the requested position, increase it. -#define SERVO_DELAY 300 +#define SERVO_DELAY { 300 } // Servo deactivation // diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h index 32369f40bb..986c387b68 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration.h @@ -1044,7 +1044,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1613,7 +1613,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h index 2bb64edf34..831b1cb130 100644 --- a/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h +++ b/Marlin/src/config/examples/tvrrug/Round2/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/config/examples/wt150/Configuration.h b/Marlin/src/config/examples/wt150/Configuration.h index baa2953c6d..cd8f9494bf 100644 --- a/Marlin/src/config/examples/wt150/Configuration.h +++ b/Marlin/src/config/examples/wt150/Configuration.h @@ -1054,7 +1054,7 @@ // // M100 Free Memory Watcher // -//#define M100_FREE_MEMORY_WATCHER // uncomment to add the M100 Free Memory Watcher for debug purpose +//#define M100_FREE_MEMORY_WATCHER // Add M100 (Free Memory Watcher) to debug memory usage // // G20/G21 Inch mode support @@ -1623,7 +1623,7 @@ * as the Arduino cannot handle the current the LEDs will require. * Failure to follow this precaution can destroy your Arduino! * NOTE: A separate 5V power supply is required! The Neopixel LED needs - * more current than the Arduino 5V linear regulator can produce. + * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * * LED Type. Enable only one of the following two options. diff --git a/Marlin/src/config/examples/wt150/Configuration_adv.h b/Marlin/src/config/examples/wt150/Configuration_adv.h index 3d840dbb79..f2d61fffbe 100644 --- a/Marlin/src/config/examples/wt150/Configuration_adv.h +++ b/Marlin/src/config/examples/wt150/Configuration_adv.h @@ -562,11 +562,20 @@ // Enable this option to scroll long filenames in the SD card menu //#define SCROLL_LONG_FILENAMES - // This option allows you to abort SD printing when any endstop is triggered. - // This feature must be enabled with "M540 S1" or from the LCD menu. - // To have any effect, endstops must be enabled during SD printing. + /** + * This option allows you to abort SD printing when any endstop is triggered. + * This feature must be enabled with "M540 S1" or from the LCD menu. + * To have any effect, endstops must be enabled during SD printing. + */ //#define ABORT_ON_ENDSTOP_HIT_FEATURE_ENABLED + /** + * This option makes it easier to print the same SD Card file again. + * On print completion the LCD Menu will open with the file selected. + * You can just click to start the print, or navigate elsewhere. + */ + //#define SD_REPRINT_LAST_SELECTED_FILE + #endif // SDSUPPORT /** @@ -627,7 +636,7 @@ #if ENABLED(BABYSTEPPING) //#define BABYSTEP_XY // Also enable X/Y Babystepping. Not supported on DELTA! #define BABYSTEP_INVERT_Z false // Change if Z babysteps should go the other way - #define BABYSTEP_MULTIPLICATOR 100 // Babysteps are very small. Increase for faster motion. + #define BABYSTEP_MULTIPLICATOR 1 // Babysteps are very small. Increase for faster motion. //#define BABYSTEP_ZPROBE_OFFSET // Enable to combine M851 and Babystepping //#define DOUBLECLICK_FOR_Z_BABYSTEPPING // Double-click on the Status Screen for Z Babystepping. #define DOUBLECLICK_MAX_INTERVAL 1250 // Maximum interval between clicks, in milliseconds. diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index b46f398d71..a02d943bd6 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -42,6 +42,7 @@ void serial_echopair_P(const char* s_P, int v) { serialprintPGM(s_P); void serial_echopair_P(const char* s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, float v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, double v) { serialprintPGM(s_P); SERIAL_ECHO(v); } +void serial_echopair_P(const char* s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_echopair_P(const char* s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); } void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) MYSERIAL.write(' '); } diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index 6642a3ce64..887402a068 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -25,6 +25,25 @@ #include "../inc/MarlinConfig.h" +#if HAS_ABL && ENABLED(DEBUG_LEVELING_FEATURE) + #include "../libs/vector_3.h" +#endif + +/** + * Define debug bit-masks + */ +enum DebugFlags { + DEBUG_NONE = 0, + DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed + DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output + DEBUG_ERRORS = _BV(2), ///< Not implemented + DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands + DEBUG_COMMUNICATION = _BV(4), ///< Not implemented + DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling + DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling + DEBUG_ALL = 0xFF +}; + //todo: HAL: breaks encapsulation // For AVR only, define a serial interface based on configuration #ifdef __AVR__ @@ -41,22 +60,10 @@ #endif #endif -#include "../libs/vector_3.h" - -/** - * Define debug bit-masks - */ -enum DebugFlags { - DEBUG_NONE = 0, - DEBUG_ECHO = _BV(0), ///< Echo commands in order as they are processed - DEBUG_INFO = _BV(1), ///< Print messages for code that has debug output - DEBUG_ERRORS = _BV(2), ///< Not implemented - DEBUG_DRYRUN = _BV(3), ///< Ignore temperature setting and E movement commands - DEBUG_COMMUNICATION = _BV(4), ///< Not implemented - DEBUG_LEVELING = _BV(5), ///< Print detailed output for homing and leveling - DEBUG_MESH_ADJUST = _BV(6), ///< UBL bed leveling - DEBUG_ALL = 0xFF -}; +#ifdef ARDUINO_ARCH_SAM + // To pull the Serial port definitions and overrides + #include "../HAL/HAL_DUE/MarlinSerial_Due.h" +#endif extern uint8_t marlin_debug_flags; #define DEBUGGING(F) (marlin_debug_flags & (DEBUG_## F)) @@ -106,7 +113,6 @@ void serial_echopair_P(const char* s_P, double v); void serial_echopair_P(const char* s_P, unsigned int v); void serial_echopair_P(const char* s_P, unsigned long v); FORCE_INLINE void serial_echopair_P(const char* s_P, uint8_t v) { serial_echopair_P(s_P, (int)v); } -FORCE_INLINE void serial_echopair_P(const char* s_P, uint16_t v) { serial_echopair_P(s_P, (int)v); } FORCE_INLINE void serial_echopair_P(const char* s_P, bool v) { serial_echopair_P(s_P, (int)v); } FORCE_INLINE void serial_echopair_P(const char* s_P, void *v) { serial_echopair_P(s_P, (unsigned long)v); } diff --git a/Marlin/src/feature/Max7219_Debug_LEDs.cpp b/Marlin/src/feature/Max7219_Debug_LEDs.cpp index fe42a18611..a57c7a0f4d 100644 --- a/Marlin/src/feature/Max7219_Debug_LEDs.cpp +++ b/Marlin/src/feature/Max7219_Debug_LEDs.cpp @@ -328,27 +328,23 @@ void Max7219_idle_tasks() { #endif #if ENABLED(MAX7219_DEBUG_PRINTER_ALIVE) - static int debug_cnt = 0; - #ifdef CPU_32_BIT - if (debug_cnt++ > 1000) { - #else - if (debug_cnt++ > 100) { - #endif - Max7219_LED_Toggle(7, 7); - debug_cnt = 0; + static millis_t next_blink = 0; + if (ELAPSED(millis(), next_blink)) { + Max7219_LED_Toggle(7, 7); + next_blink = millis() + 750; } #endif #ifdef MAX7219_DEBUG_STEPPER_HEAD static int16_t last_head_cnt=0; if (last_head_cnt != head) { - if ( last_head_cnt < 8) + if (last_head_cnt < 8) Max7219_LED_Off( last_head_cnt, MAX7219_DEBUG_STEPPER_HEAD); else Max7219_LED_Off( last_head_cnt-8, MAX7219_DEBUG_STEPPER_HEAD+1); last_head_cnt = head; - if ( head < 8) + if (head < 8) Max7219_LED_On(head, MAX7219_DEBUG_STEPPER_HEAD); else Max7219_LED_On(head-8, MAX7219_DEBUG_STEPPER_HEAD+1); @@ -358,13 +354,13 @@ void Max7219_idle_tasks() { #ifdef MAX7219_DEBUG_STEPPER_TAIL static int16_t last_tail_cnt=0; if (last_tail_cnt != tail) { - if ( last_tail_cnt < 8) + if (last_tail_cnt < 8) Max7219_LED_Off( last_tail_cnt, MAX7219_DEBUG_STEPPER_TAIL); else Max7219_LED_Off( last_tail_cnt-8, MAX7219_DEBUG_STEPPER_TAIL+1); last_tail_cnt = tail; - if ( tail < 8) + if (tail < 8) Max7219_LED_On(tail, MAX7219_DEBUG_STEPPER_TAIL); else Max7219_LED_On(tail-8, MAX7219_DEBUG_STEPPER_TAIL+1); @@ -384,10 +380,10 @@ void Max7219_idle_tasks() { en = max(current_depth, last_depth); if (current_depth < last_depth) for (uint8_t i = st; i <= en; i++) // clear the highest order LEDs - Max7219_LED_Off(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1)); + Max7219_LED_Off(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1)); else - for (uint8_t i = st; i <= en; i++) // set the LEDs to current depth - Max7219_LED_On(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1)); + for (uint8_t i = st; i <= en; i++) // set the LEDs to current depth + Max7219_LED_On(i/2, MAX7219_DEBUG_STEPPER_QUEUE + (i & 1)); last_depth = current_depth; } diff --git a/Marlin/src/feature/fwretract.cpp b/Marlin/src/feature/fwretract.cpp index a6093205f3..708b52ec71 100644 --- a/Marlin/src/feature/fwretract.cpp +++ b/Marlin/src/feature/fwretract.cpp @@ -94,13 +94,16 @@ void FWRetract::retract(const bool retracting #endif ) { - static float hop_height, // Remember where the Z height started - hop_amount = 0.0; // Total amount lifted, for use in recover + static float hop_amount = 0.0; // Total amount lifted, for use in recover - // Simply never allow two retracts or recovers in a row + // Prevent two retracts or recovers in a row if (retracted[active_extruder] == retracting) return; + // Prevent two swap-retract or recovers in a row #if EXTRUDERS > 1 + // Allow G10 S1 only after G10 + if (swapping && retracted_swap[active_extruder] == retracting) return; + // G11 priority to recover the long retract if activated if (!retracting) swapping = retracted_swap[active_extruder]; #else const bool swapping = false; @@ -121,64 +124,56 @@ void FWRetract::retract(const bool retracting //*/ const bool has_zhop = retract_zlift > 0.01; // Is there a hop set? - const float old_feedrate_mm_s = feedrate_mm_s; - const int16_t old_flow = planner.flow_percentage[active_extruder]; - - // Don't apply flow multiplication to retract/recover - planner.flow_percentage[active_extruder] = 100; // The current position will be the destination for E and Z moves set_destination_from_current(); - stepper.synchronize(); // Wait for buffered moves to complete - if (retracting) { - // Remember the Z height since G-code may include its own Z-hop - // For best results turn off Z hop if G-code already includes it - hop_height = destination[Z_AXIS]; + const float renormalize = 100.0 / planner.flow_percentage[active_extruder] / planner.volumetric_multiplier[active_extruder]; + if (retracting) { // Retract by moving from a faux E position back to the current E position feedrate_mm_s = retract_feedrate_mm_s; - current_position[E_AXIS] += (swapping ? swap_retract_length : retract_length) / planner.volumetric_multiplier[active_extruder]; + current_position[E_AXIS] += (swapping ? swap_retract_length : retract_length) * renormalize; sync_plan_position_e(); prepare_move_to_destination(); // Is a Z hop set, and has the hop not yet been done? - if (has_zhop) { - hop_amount += retract_zlift; // Carriage is raised for retraction hop - current_position[Z_AXIS] -= retract_zlift; // Pretend current pos is lower. Next move raises Z. - SYNC_PLAN_POSITION_KINEMATIC(); // Set the planner to the new position - prepare_move_to_destination(); // Raise up to the old current pos + // No double zlifting + // Feedrate to the max + if (has_zhop && !hop_amount) { + hop_amount += retract_zlift; // Carriage is raised for retraction hop + feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS]; // Z feedrate to max + current_position[Z_AXIS] -= retract_zlift; // Pretend current pos is lower. Next move raises Z. + SYNC_PLAN_POSITION_KINEMATIC(); // Set the planner to the new position + prepare_move_to_destination(); // Raise up to the old current pos } } else { // If a hop was done and Z hasn't changed, undo the Z hop - if (hop_amount && NEAR(hop_height, destination[Z_AXIS])) { - current_position[Z_AXIS] += hop_amount; // Pretend current pos is higher. Next move lowers Z. - SYNC_PLAN_POSITION_KINEMATIC(); // Set the planner to the new position - prepare_move_to_destination(); // Lower to the old current pos - hop_amount = 0.0; + if (hop_amount) { + current_position[Z_AXIS] -= retract_zlift; // Pretend current pos is lower. Next move raises Z. + SYNC_PLAN_POSITION_KINEMATIC(); // Set the planner to the new position + feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS]; // Z feedrate to max + prepare_move_to_destination(); // Raise up to the old current pos + hop_amount = 0.0; // Clear hop } // A retract multiplier has been added here to get faster swap recovery feedrate_mm_s = swapping ? swap_retract_recover_feedrate_mm_s : retract_recover_feedrate_mm_s; const float move_e = swapping ? swap_retract_length + swap_retract_recover_length : retract_length + retract_recover_length; - current_position[E_AXIS] -= move_e / planner.volumetric_multiplier[active_extruder]; + current_position[E_AXIS] -= move_e * renormalize; sync_plan_position_e(); - prepare_move_to_destination(); // Recover E } - // Restore flow and feedrate - planner.flow_percentage[active_extruder] = old_flow; - feedrate_mm_s = old_feedrate_mm_s; + feedrate_mm_s = old_feedrate_mm_s; // Restore original feedrate - // The active extruder is now retracted or recovered - retracted[active_extruder] = retracting; + retracted[active_extruder] = retracting; // Active extruder now retracted / recovered - // If swap retract/recover then update the retracted_swap flag too + // If swap retract/recover update the retracted_swap flag too #if EXTRUDERS > 1 if (swapping) retracted_swap[active_extruder] = retracting; #endif @@ -197,6 +192,6 @@ void FWRetract::retract(const bool retracting SERIAL_ECHOLNPAIR("hop_amount ", hop_amount); //*/ -} // retract() +} #endif // FWRETRACT diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index 558e2ca8fe..b412bdc70c 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -31,15 +31,31 @@ #include "leds.h" void set_led_color( - const uint8_t r, const uint8_t g, const uint8_t b , const uint8_t w , const uint8_t p + const uint8_t r, const uint8_t g, const uint8_t b + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + , const uint8_t w // = 0 + #if ENABLED(NEOPIXEL_LED) + , const uint8_t p // = NEOPIXEL_BRIGHTNESS + , const bool isSequence // = false + #endif + #endif ) { #if ENABLED(NEOPIXEL_LED) - if (w == 255 || (r == 255 && g == 255 && b == 255)) - neopixel_set_led_color(NEO_WHITE, p); - else - neopixel_set_led_color(r, g, b, w, p); - return; + + const uint32_t color = pixels.Color(r, g, b, w); + static uint16_t nextLed = 0; + + pixels.setBrightness(p); + if (!isSequence) + set_neopixel_color(color); + else { + pixels.setPixelColor(nextLed, color); + pixels.show(); + if (++nextLed >= pixels.numPixels()) nextLed = 0; + return; + } + #endif #if ENABLED(BLINKM) diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index b67e982a77..81c822666a 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -27,6 +27,8 @@ #ifndef __LEDS_H__ #define __LEDS_H__ +#include "../../inc/MarlinConfig.h" + #if ENABLED(NEOPIXEL_LED) #include #include "neopixel.h" @@ -40,14 +42,6 @@ #include "pca9632.h" #endif -#if ENABLED(NEOPIXEL_LED) - #if NEOPIXEL_TYPE == NEO_RGB || NEOPIXEL_TYPE == NEO_RBG || NEOPIXEL_TYPE == NEO_GRB || NEOPIXEL_TYPE == NEO_GBR || NEOPIXEL_TYPE == NEO_BRG || NEOPIXEL_TYPE == NEO_BGR - #define NEO_WHITE 255, 255, 255 - #else - #define NEO_WHITE 0, 0, 0, 255 - #endif -#endif - #if ENABLED(RGB_LED) || ENABLED(BLINKM) || ENABLED(PCA9632) #define LED_WHITE 255, 255, 255 #elif ENABLED(RGBW_LED) @@ -61,7 +55,14 @@ #endif void set_led_color( - const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t w = 0, const uint8_t p = 255 + const uint8_t r, const uint8_t g, const uint8_t b + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + , const uint8_t w = 0 + #if ENABLED(NEOPIXEL_LED) + , const uint8_t p = NEOPIXEL_BRIGHTNESS + , const bool isSequence = false + #endif + #endif ); #endif // __LEDS_H__ diff --git a/Marlin/src/feature/leds/neopixel.cpp b/Marlin/src/feature/leds/neopixel.cpp index d96e431c32..ae06e9b009 100644 --- a/Marlin/src/feature/leds/neopixel.cpp +++ b/Marlin/src/feature/leds/neopixel.cpp @@ -39,35 +39,21 @@ void set_neopixel_color(const uint32_t color) { } void setup_neopixel() { + SET_OUTPUT(NEOPIXEL_PIN); pixels.setBrightness(NEOPIXEL_BRIGHTNESS); // 0 - 255 range pixels.begin(); pixels.show(); // initialize to all off #if ENABLED(NEOPIXEL_STARTUP_TEST) - delay(2000); + safe_delay(1000); set_neopixel_color(pixels.Color(255, 0, 0, 0)); // red - delay(2000); + safe_delay(1000); set_neopixel_color(pixels.Color(0, 255, 0, 0)); // green - delay(2000); + safe_delay(1000); set_neopixel_color(pixels.Color(0, 0, 255, 0)); // blue - delay(2000); - #endif - set_neopixel_color(pixels.Color(0, 0, 0, 255)); // white -} - -bool neopixel_set_led_color(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t w, const uint8_t p) { - const uint32_t color = pixels.Color(r, g, b, w); - pixels.setBrightness(p); - #if !ENABLED(NEOPIXEL_IS_SEQUENTIAL) - set_neopixel_color(color); - return false; - #else - static uint16_t nextLed = 0; - pixels.setPixelColor(nextLed, color); - pixels.show(); - if (++nextLed >= pixels.numPixels()) nextLed = 0; - return true; + safe_delay(1000); #endif + set_neopixel_color(pixels.Color(NEO_WHITE)); // white } #endif // NEOPIXEL_LED diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index 265b93d19d..2b937f1b87 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -27,11 +27,22 @@ #ifndef __NEOPIXEL_H__ #define __NEOPIXEL_H__ +#include "../../inc/MarlinConfig.h" + #include #include +#define NEOPIXEL_IS_RGB (NEOPIXEL_TYPE == NEO_RGB || NEOPIXEL_TYPE == NEO_RBG || NEOPIXEL_TYPE == NEO_GRB || NEOPIXEL_TYPE == NEO_GBR || NEOPIXEL_TYPE == NEO_BRG || NEOPIXEL_TYPE == NEO_BGR) +#define NEOPIXEL_IS_RGBW !NEOPIXEL_IS_RGB + +#if NEOPIXEL_IS_RGB + #define NEO_WHITE 255, 255, 255 +#else + #define NEO_WHITE 0, 0, 0, 255 +#endif + void setup_neopixel(); -bool neopixel_set_led_color(const uint8_t r, const uint8_t g, const uint8_t b, const uint8_t w, const uint8_t p); +void set_neopixel_color(const uint32_t color); extern Adafruit_NeoPixel pixels; diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 5746c3c4de..abb8eed4b2 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -37,35 +37,6 @@ #include "../../feature/bedlevel/bedlevel.h" #endif -/** - * G33 - Delta '1-4-7-point' Auto-Calibration - * Calibrate height, endstops, delta radius, and tower angles. - * - * Parameters: - * - * Pn Number of probe points: - * - * P0 No probe. Normalize only. - * P1 Probe center and set height only. - * P2 Probe center and towers. Set height, endstops, and delta radius. - * P3 Probe all positions: center, towers and opposite towers. Set all. - * P4-P7 Probe all positions at different locations and average them. - * - * T0 Don't calibrate tower angle corrections - * - * Cn.nn Calibration precision; when omitted calibrates to maximum precision - * - * Fn Force to run at least n iterations and takes the best result - * - * Vn Verbose level: - * - * V0 Dry-run mode. Report settings and probe results. No calibration. - * V1 Report settings - * V2 Report settings and probe results - * - * E Engage the probe for each point - */ - static void print_signed_float(const char * const prefix, const float &f) { SERIAL_PROTOCOLPGM(" "); serialprintPGM(prefix); @@ -77,21 +48,55 @@ static void print_signed_float(const char * const prefix, const float &f) { static void print_G33_settings(const bool end_stops, const bool tower_angles) { SERIAL_PROTOCOLPAIR(".Height:", DELTA_HEIGHT + home_offset[Z_AXIS]); if (end_stops) { - print_signed_float(PSTR(" Ex"), delta_endstop_adj[A_AXIS]); + print_signed_float(PSTR("Ex"), delta_endstop_adj[A_AXIS]); print_signed_float(PSTR("Ey"), delta_endstop_adj[B_AXIS]); print_signed_float(PSTR("Ez"), delta_endstop_adj[C_AXIS]); - SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); } - SERIAL_EOL(); + if (end_stops && tower_angles) { + SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); + SERIAL_EOL(); + SERIAL_CHAR('.'); + SERIAL_PROTOCOL_SP(13); + } if (tower_angles) { - SERIAL_PROTOCOLPGM(".Tower angle : "); print_signed_float(PSTR("Tx"), delta_tower_angle_trim[A_AXIS]); print_signed_float(PSTR("Ty"), delta_tower_angle_trim[B_AXIS]); print_signed_float(PSTR("Tz"), delta_tower_angle_trim[C_AXIS]); - SERIAL_EOL(); } + if ((!end_stops && tower_angles) || (end_stops && !tower_angles)) { // XOR + SERIAL_PROTOCOLPAIR(" Radius:", delta_radius); + } + SERIAL_EOL(); } +static void print_G33_results(const float z_at_pt[13], const bool tower_points, const bool opposite_points) { + SERIAL_PROTOCOLPGM(". "); + print_signed_float(PSTR("c"), z_at_pt[0]); + if (tower_points) { + print_signed_float(PSTR(" x"), z_at_pt[1]); + print_signed_float(PSTR(" y"), z_at_pt[5]); + print_signed_float(PSTR(" z"), z_at_pt[9]); + } + if (tower_points && opposite_points) { + SERIAL_EOL(); + SERIAL_CHAR('.'); + SERIAL_PROTOCOL_SP(13); + } + if (opposite_points) { + print_signed_float(PSTR("yz"), z_at_pt[7]); + print_signed_float(PSTR("zx"), z_at_pt[11]); + print_signed_float(PSTR("xy"), z_at_pt[3]); + } + SERIAL_EOL(); +} + +/** + * After G33: + * - Move to the print ceiling (DELTA_HOME_TO_SAFE_ZONE only) + * - Stow the probe + * - Restore endstops state + * - Select the old tool, if needed + */ static void G33_cleanup( #if HOTENDS > 1 const uint8_t old_tool_index @@ -107,6 +112,216 @@ static void G33_cleanup( #endif } +static float probe_G33_points(float z_at_pt[13], const int8_t probe_points, const bool towers_set, const bool stow_after_each) { + const bool _0p_calibration = probe_points == 0, + _1p_calibration = probe_points == 1, + _4p_calibration = probe_points == 2, + _4p_opposite_points = _4p_calibration && !towers_set, + _7p_calibration = probe_points >= 3 || probe_points == 0, + _7p_half_circle = probe_points == 3, + _7p_double_circle = probe_points == 5, + _7p_triple_circle = probe_points == 6, + _7p_quadruple_circle = probe_points == 7, + _7p_intermed_points = probe_points >= 4, + _7p_multi_circle = probe_points >= 5; + + #if DISABLED(PROBE_MANUALLY) + const float dx = (X_PROBE_OFFSET_FROM_EXTRUDER), + dy = (Y_PROBE_OFFSET_FROM_EXTRUDER); + #endif + + for (uint8_t i = 0; i < COUNT(z_at_pt); i++) z_at_pt[i] = 0.0; + + if (!_0p_calibration) { + + if (!_7p_half_circle && !_7p_triple_circle) { // probe the center + #if ENABLED(PROBE_MANUALLY) + z_at_pt[0] += lcd_probe_pt(0, 0); + #else + z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false); + #endif + } + + if (_7p_calibration) { // probe extra center points + for (int8_t axis = _7p_multi_circle ? COUNT(z_at_pt) - 2 : COUNT(z_at_pt) - 4; axis > 0; axis -= _7p_multi_circle ? 2 : 4) { + const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1; + #if ENABLED(PROBE_MANUALLY) + z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r); + #else + z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1); + #endif + } + z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points); + } + + if (!_1p_calibration) { // probe the radius + bool zig_zag = true; + const uint8_t start = _4p_opposite_points ? 3 : 1, + step = _4p_calibration ? 4 : _7p_half_circle ? 2 : 1; + for (uint8_t axis = start; axis < COUNT(z_at_pt); axis += step) { + const float zigadd = (zig_zag ? 0.5 : 0.0), + offset_circles = _7p_quadruple_circle ? zigadd + 1.0 : + _7p_triple_circle ? zigadd + 0.5 : + _7p_double_circle ? zigadd : 0; + for (float circles = -offset_circles ; circles <= offset_circles; circles++) { + const float a = RADIANS(180 + 30 * axis), + r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1)); + #if ENABLED(PROBE_MANUALLY) + z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r); + #else + z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1); + #endif + } + zig_zag = !zig_zag; + z_at_pt[axis] /= (2 * offset_circles + 1); + } + } + + if (_7p_intermed_points) // average intermediates to tower and opposites + for (uint8_t axis = 1; axis < COUNT(z_at_pt); axis += 2) + z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0; + + float S1 = z_at_pt[0], + S2 = sq(z_at_pt[0]); + int16_t N = 1; + if (!_1p_calibration) // std dev from zero plane + for (uint8_t axis = (_4p_opposite_points ? 3 : 1); axis < COUNT(z_at_pt); axis += (_4p_calibration ? 4 : 2)) { + S1 += z_at_pt[axis]; + S2 += sq(z_at_pt[axis]); + N++; + } + return round(SQRT(S2 / N) * 1000.0) / 1000.0 + 0.00001; + } + + return 0.00001; +} + +#if DISABLED(PROBE_MANUALLY) + + static void G33_auto_tune() { + float z_at_pt[13] = { 0.0 }, + z_at_pt_base[13] = { 0.0 }, + z_temp, h_fac = 0.0, r_fac = 0.0, a_fac = 0.0, norm = 0.8; + + #define ZP(N,I) ((N) * z_at_pt[I]) + #define Z06(I) ZP(6, I) + #define Z03(I) ZP(3, I) + #define Z02(I) ZP(2, I) + #define Z01(I) ZP(1, I) + #define Z32(I) ZP(3/2, I) + + SERIAL_PROTOCOLPGM("AUTO TUNE baseline"); + SERIAL_EOL(); + probe_G33_points(z_at_pt_base, 3, true, false); + print_G33_results(z_at_pt_base, true, true); + + LOOP_XYZ(axis) { + delta_endstop_adj[axis] -= 1.0; + + endstops.enable(true); + if (!home_delta()) return; + endstops.not_homing(); + + SERIAL_PROTOCOLPGM("Tuning E"); + SERIAL_CHAR(tolower(axis_codes[axis])); + SERIAL_EOL(); + + probe_G33_points(z_at_pt, 3, true, false); + for (int8_t i = 0; i < COUNT(z_at_pt); i++) z_at_pt[i] -= z_at_pt_base[i]; + print_G33_results(z_at_pt, true, true); + delta_endstop_adj[axis] += 1.0; + switch (axis) { + case A_AXIS : + h_fac += 4.0 / (Z03(0) +Z01(1) +Z32(11) +Z32(3)); // Offset by X-tower end-stop + break; + case B_AXIS : + h_fac += 4.0 / (Z03(0) +Z01(5) +Z32(7) +Z32(3)); // Offset by Y-tower end-stop + break; + case C_AXIS : + h_fac += 4.0 / (Z03(0) +Z01(9) +Z32(7) +Z32(11) ); // Offset by Z-tower end-stop + break; + } + } + h_fac /= 3.0; + h_fac *= norm; // Normalize to 1.02 for Kossel mini + + for (int8_t zig_zag = -1; zig_zag < 2; zig_zag += 2) { + delta_radius += 1.0 * zig_zag; + recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + + endstops.enable(true); + if (!home_delta()) return; + endstops.not_homing(); + + SERIAL_PROTOCOLPGM("Tuning R"); + SERIAL_PROTOCOL(zig_zag == -1 ? "-" : "+"); + SERIAL_EOL(); + probe_G33_points(z_at_pt, 3, true, false); + for (int8_t i = 0; i < COUNT(z_at_pt); i++) z_at_pt[i] -= z_at_pt_base[i]; + print_G33_results(z_at_pt, true, true); + delta_radius -= 1.0 * zig_zag; + recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + r_fac -= zig_zag * 6.0 / (Z03(1) + Z03(5) + Z03(9) + Z03(7) + Z03(11) + Z03(3)); // Offset by delta radius + } + r_fac /= 2.0; + r_fac *= 3 * norm; // Normalize to 2.25 for Kossel mini + + LOOP_XYZ(axis) { + delta_tower_angle_trim[axis] += 1.0; + delta_endstop_adj[(axis + 1) % 3] -= 1.0 / 4.5; + delta_endstop_adj[(axis + 2) % 3] += 1.0 / 4.5; + z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]); + home_offset[Z_AXIS] -= z_temp; + LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp; + recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + + endstops.enable(true); + if (!home_delta()) return; + endstops.not_homing(); + + SERIAL_PROTOCOLPGM("Tuning T"); + SERIAL_CHAR(tolower(axis_codes[axis])); + SERIAL_EOL(); + + probe_G33_points(z_at_pt, 3, true, false); + for (int8_t i = 0; i < COUNT(z_at_pt); i++) z_at_pt[i] -= z_at_pt_base[i]; + print_G33_results(z_at_pt, true, true); + + delta_tower_angle_trim[axis] -= 1.0; + delta_endstop_adj[(axis+1) % 3] += 1.0/4.5; + delta_endstop_adj[(axis+2) % 3] -= 1.0/4.5; + z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]); + home_offset[Z_AXIS] -= z_temp; + LOOP_XYZ(axis) delta_endstop_adj[axis] -= z_temp; + recalc_delta_settings(delta_radius, delta_diagonal_rod, delta_tower_angle_trim); + switch (axis) { + case A_AXIS : + a_fac += 4.0 / ( Z06(5) -Z06(9) +Z06(11) -Z06(3)); // Offset by alpha tower angle + break; + case B_AXIS : + a_fac += 4.0 / (-Z06(1) +Z06(9) -Z06(7) +Z06(3)); // Offset by beta tower angle + break; + case C_AXIS : + a_fac += 4.0 / (Z06(1) -Z06(5) +Z06(7) -Z06(11) ); // Offset by gamma tower angle + break; + } + } + a_fac /= 3.0; + a_fac *= norm; // Normalize to 0.83 for Kossel mini + + endstops.enable(true); + if (!home_delta()) return; + endstops.not_homing(); + print_signed_float(PSTR( "H_FACTOR: "), h_fac); + print_signed_float(PSTR(" R_FACTOR: "), r_fac); + print_signed_float(PSTR(" A_FACTOR: "), a_fac); + SERIAL_EOL(); + SERIAL_PROTOCOLPGM("Copy these values to Configuration.h"); + SERIAL_EOL(); + } + +#endif // !PROBE_MANUALLY + /** * G33 - Delta '1-4-7-point' Auto-Calibration * Calibrate height, endstops, delta radius, and tower angles. @@ -114,21 +329,21 @@ static void G33_cleanup( * Parameters: * * Pn Number of probe points: - * * P0 No probe. Normalize only. * P1 Probe center and set height only. - * P2 Probe center and towers. Set height, endstops, and delta radius. + * P2 Probe center and towers. Set height, endstops and delta radius. * P3 Probe all positions: center, towers and opposite towers. Set all. * P4-P7 Probe all positions at different locations and average them. * - * T0 Don't calibrate tower angle corrections + * T Don't calibrate tower angle corrections * - * Cn.nn Calibration precision; when omitted calibrates to maximum precision + * Cn.nn Calibration precision; when omitted calibrates to maximum precision * * Fn Force to run at least n iterations and takes the best result * - * Vn Verbose level: + * A Auto tune calibartion factors (set in Configuration.h) * + * Vn Verbose level: * V0 Dry-run mode. Report settings and probe results. No calibration. * V1 Report settings * V2 Report settings and probe results @@ -162,26 +377,24 @@ void GcodeSuite::G33() { } const bool towers_set = !parser.boolval('T'), + auto_tune = parser.boolval('A'), stow_after_each = parser.boolval('E'), _0p_calibration = probe_points == 0, _1p_calibration = probe_points == 1, _4p_calibration = probe_points == 2, - _4p_towers_points = _4p_calibration && towers_set, - _4p_opposite_points = _4p_calibration && !towers_set, - _7p_calibration = probe_points >= 3 || _0p_calibration, - _7p_half_circle = probe_points == 3, + _tower_results = (_4p_calibration && towers_set) + || probe_points >= 3 || probe_points == 0, + _opposite_results = (_4p_calibration && !towers_set) + || probe_points >= 3 || probe_points == 0, + _endstop_results = probe_points != 1, + _angle_results = (probe_points >= 3 || probe_points == 0) && towers_set, _7p_double_circle = probe_points == 5, _7p_triple_circle = probe_points == 6, - _7p_quadruple_circle = probe_points == 7, - _7p_multi_circle = _7p_double_circle || _7p_triple_circle || _7p_quadruple_circle, - _7p_intermed_points = _7p_calibration && !_7p_half_circle; + _7p_quadruple_circle = probe_points == 7; const static char save_message[] PROGMEM = "Save with M500 and/or copy to Configuration.h"; - const float dx = (X_PROBE_OFFSET_FROM_EXTRUDER), - dy = (Y_PROBE_OFFSET_FROM_EXTRUDER); int8_t iterations = 0; float test_precision, zero_std_dev = (verbose_level ? 999.0 : 0.0), // 0.0 in dry-run mode : forced end - zero_std_dev_old = zero_std_dev, zero_std_dev_min = zero_std_dev, e_old[ABC] = { delta_endstop_adj[A_AXIS], @@ -196,12 +409,14 @@ void GcodeSuite::G33() { delta_tower_angle_trim[C_AXIS] }; + SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate"); + if (!_1p_calibration && !_0p_calibration) { // test if the outer radius is reachable const float circles = (_7p_quadruple_circle ? 1.5 : _7p_triple_circle ? 1.0 : _7p_double_circle ? 0.5 : 0), r = (1 + circles * 0.1) * delta_calibration_radius; - for (uint8_t axis = 1; axis < 13; ++axis) { + for (uint8_t axis = 1; axis <= 12; ++axis) { const float a = RADIANS(180 + 30 * axis); if (!position_is_reachable_xy(cos(a) * r, sin(a) * r)) { SERIAL_PROTOCOLLNPGM("?(M665 B)ed radius is implausible."); @@ -209,7 +424,6 @@ void GcodeSuite::G33() { } } } - SERIAL_PROTOCOLLNPGM("G33 Auto Calibrate"); stepper.synchronize(); #if HAS_LEVELING @@ -232,7 +446,17 @@ void GcodeSuite::G33() { endstops.not_homing(); } - // print settings + if (auto_tune) { + #if ENABLED(PROBE_MANUALLY) + SERIAL_PROTOCOLLNPGM("A probe is needed for auto-tune"); + #else + G33_auto_tune(); + #endif + G33_CLEANUP(); + return; + } + + // Report settings const char *checkingac = PSTR("Checking... AC"); // TODO: Make translatable string serialprintPGM(checkingac); @@ -240,78 +464,19 @@ void GcodeSuite::G33() { SERIAL_EOL(); lcd_setstatusPGM(checkingac); - print_G33_settings(!_1p_calibration, _7p_calibration && towers_set); + print_G33_settings(_endstop_results, _angle_results); do { float z_at_pt[13] = { 0.0 }; - test_precision = zero_std_dev_old != 999.0 ? (zero_std_dev + zero_std_dev_old) / 2 : zero_std_dev; + test_precision = zero_std_dev; iterations++; // Probe the points - if (!_0p_calibration){ - if (!_7p_half_circle && !_7p_triple_circle) { // probe the center - #if ENABLED(PROBE_MANUALLY) - z_at_pt[0] += lcd_probe_pt(0, 0); - #else - z_at_pt[0] += probe_pt(dx, dy, stow_after_each, 1, false); - if (isnan(z_at_pt[0])) return G33_CLEANUP(); - #endif - } - if (_7p_calibration) { // probe extra center points - for (int8_t axis = _7p_multi_circle ? 11 : 9; axis > 0; axis -= _7p_multi_circle ? 2 : 4) { - const float a = RADIANS(180 + 30 * axis), r = delta_calibration_radius * 0.1; - #if ENABLED(PROBE_MANUALLY) - z_at_pt[0] += lcd_probe_pt(cos(a) * r, sin(a) * r); - #else - z_at_pt[0] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1); - if (isnan(z_at_pt[0])) return G33_CLEANUP(); - #endif - } - z_at_pt[0] /= float(_7p_double_circle ? 7 : probe_points); - } - if (!_1p_calibration) { // probe the radius - bool zig_zag = true; - const uint8_t start = _4p_opposite_points ? 3 : 1, - step = _4p_calibration ? 4 : _7p_half_circle ? 2 : 1; - for (uint8_t axis = start; axis < 13; axis += step) { - const float zigadd = (zig_zag ? 0.5 : 0.0), - offset_circles = _7p_quadruple_circle ? zigadd + 1.0 : - _7p_triple_circle ? zigadd + 0.5 : - _7p_double_circle ? zigadd : 0; - for (float circles = -offset_circles ; circles <= offset_circles; circles++) { - const float a = RADIANS(180 + 30 * axis), - r = delta_calibration_radius * (1 + circles * (zig_zag ? 0.1 : -0.1)); - #if ENABLED(PROBE_MANUALLY) - z_at_pt[axis] += lcd_probe_pt(cos(a) * r, sin(a) * r); - #else - z_at_pt[axis] += probe_pt(cos(a) * r + dx, sin(a) * r + dy, stow_after_each, 1); - if (isnan(z_at_pt[axis])) return G33_CLEANUP(); - #endif - } - zig_zag = !zig_zag; - z_at_pt[axis] /= (2 * offset_circles + 1); - } - } - if (_7p_intermed_points) // average intermediates to tower and opposites - for (uint8_t axis = 1; axis < 13; axis += 2) - z_at_pt[axis] = (z_at_pt[axis] + (z_at_pt[axis + 1] + z_at_pt[(axis + 10) % 12 + 1]) / 2.0) / 2.0; - } - - float S1 = z_at_pt[0], - S2 = sq(z_at_pt[0]); - int16_t N = 1; - if (!_1p_calibration) // std dev from zero plane - for (uint8_t axis = (_4p_opposite_points ? 3 : 1); axis < 13; axis += (_4p_calibration ? 4 : 2)) { - S1 += z_at_pt[axis]; - S2 += sq(z_at_pt[axis]); - N++; - } - zero_std_dev_old = zero_std_dev; - zero_std_dev = round(SQRT(S2 / N) * 1000.0) / 1000.0 + 0.00001; + zero_std_dev = probe_G33_points(z_at_pt, probe_points, towers_set, stow_after_each); // Solve matrices @@ -325,9 +490,24 @@ void GcodeSuite::G33() { float e_delta[ABC] = { 0.0 }, r_delta = 0.0, t_delta[ABC] = { 0.0 }; const float r_diff = delta_radius - delta_calibration_radius, - h_factor = (1.00 + r_diff * 0.001) / 6.0, // 1.02 for r_diff = 20mm - r_factor = (-(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff))) / 6.0, // 2.25 for r_diff = 20mm - a_factor = (66.66 / delta_calibration_radius) / (iterations == 1 ? 16.0 : 2.0); // 0.83 for cal_rd = 80mm + h_factor = 1 / 6.0 * + #ifdef H_FACTOR + (H_FACTOR), // Set in Configuration.h + #else + (1.00 + r_diff * 0.001), // 1.02 for r_diff = 20mm + #endif + r_factor = 1 / 6.0 * + #ifdef R_FACTOR + -(R_FACTOR), // Set in Configuration.h + #else + -(1.75 + 0.005 * r_diff + 0.001 * sq(r_diff)), // 2.25 for r_diff = 20mm + #endif + a_factor = 1 / 6.0 * + #ifdef A_FACTOR + (A_FACTOR); // Set in Configuration.h + #else + (66.66 / delta_calibration_radius); // 0.83 for cal_rd = 80mm + #endif #define ZP(N,I) ((N) * z_at_pt[I]) #define Z6(I) ZP(6, I) @@ -341,15 +521,11 @@ void GcodeSuite::G33() { switch (probe_points) { case 0: - #if DISABLED(PROBE_MANUALLY) - test_precision = 0.00; // forced end - #endif + test_precision = 0.00; // forced end break; case 1: - #if DISABLED(PROBE_MANUALLY) - test_precision = 0.00; // forced end - #endif + test_precision = 0.00; // forced end LOOP_XYZ(axis) e_delta[axis] = Z1(0); break; @@ -375,9 +551,9 @@ void GcodeSuite::G33() { r_delta = (Z6(0) - Z1(1) - Z1(5) - Z1(9) - Z1(7) - Z1(11) - Z1(3)) * r_factor; if (towers_set) { - t_delta[A_AXIS] = ( - Z2(5) + Z2(9) - Z2(11) + Z2(3)) * a_factor; - t_delta[B_AXIS] = ( Z2(1) - Z2(9) + Z2(7) - Z2(3)) * a_factor; - t_delta[C_AXIS] = (-Z2(1) + Z2(5) - Z2(7) + Z2(11) ) * a_factor; + t_delta[A_AXIS] = ( - Z4(5) + Z4(9) - Z4(11) + Z4(3)) * a_factor; + t_delta[B_AXIS] = ( Z4(1) - Z4(9) + Z4(7) - Z4(3)) * a_factor; + t_delta[C_AXIS] = (-Z4(1) + Z4(5) - Z4(7) + Z4(11) ) * a_factor; e_delta[A_AXIS] += (t_delta[B_AXIS] - t_delta[C_AXIS]) / 4.5; e_delta[B_AXIS] += (t_delta[C_AXIS] - t_delta[A_AXIS]) / 4.5; e_delta[C_AXIS] += (t_delta[A_AXIS] - t_delta[B_AXIS]) / 4.5; @@ -395,11 +571,14 @@ void GcodeSuite::G33() { home_offset[Z_AXIS] = zh_old; COPY(delta_tower_angle_trim, ta_old); } + if (verbose_level != 0) { // !dry run // normalise angles to least squares - float a_sum = 0.0; - LOOP_XYZ(axis) a_sum += delta_tower_angle_trim[axis]; - LOOP_XYZ(axis) delta_tower_angle_trim[axis] -= a_sum / 3.0; + if (_angle_results) { + float a_sum = 0.0; + LOOP_XYZ(axis) a_sum += delta_tower_angle_trim[axis]; + LOOP_XYZ(axis) delta_tower_angle_trim[axis] -= a_sum / 3.0; + } // adjust delta_height and endstops by the max amount const float z_temp = MAX3(delta_endstop_adj[A_AXIS], delta_endstop_adj[B_AXIS], delta_endstop_adj[C_AXIS]); @@ -411,30 +590,13 @@ void GcodeSuite::G33() { // print report - if (verbose_level != 1) { - SERIAL_PROTOCOLPGM(". "); - print_signed_float(PSTR("c"), z_at_pt[0]); - if (_4p_towers_points || _7p_calibration) { - print_signed_float(PSTR(" x"), z_at_pt[1]); - print_signed_float(PSTR(" y"), z_at_pt[5]); - print_signed_float(PSTR(" z"), z_at_pt[9]); - } - if (!_4p_opposite_points) SERIAL_EOL(); - if ((_4p_opposite_points) || _7p_calibration) { - if (_7p_calibration) { - SERIAL_CHAR('.'); - SERIAL_PROTOCOL_SP(13); - } - print_signed_float(PSTR(" yz"), z_at_pt[7]); - print_signed_float(PSTR("zx"), z_at_pt[11]); - print_signed_float(PSTR("xy"), z_at_pt[3]); - SERIAL_EOL(); - } - } + if (verbose_level != 1) + print_G33_results(z_at_pt, _tower_results, _opposite_results); + if (verbose_level != 0) { // !dry run if ((zero_std_dev >= test_precision && iterations > force_iterations) || zero_std_dev <= calibration_precision) { // end iterations SERIAL_PROTOCOLPGM("Calibration OK"); - SERIAL_PROTOCOL_SP(36); + SERIAL_PROTOCOL_SP(32); #if DISABLED(PROBE_MANUALLY) if (zero_std_dev >= test_precision && !_1p_calibration) SERIAL_PROTOCOLPGM("rolling back."); @@ -452,7 +614,7 @@ void GcodeSuite::G33() { else sprintf_P(&mess[15], PSTR("%03i.x"), (int)round(zero_std_dev_min)); lcd_setstatus(mess); - print_G33_settings(!_1p_calibration, _7p_calibration && towers_set); + print_G33_settings(_endstop_results, _angle_results); serialprintPGM(save_message); SERIAL_EOL(); } @@ -463,18 +625,18 @@ void GcodeSuite::G33() { else sprintf_P(mess, PSTR("No convergence")); SERIAL_PROTOCOL(mess); - SERIAL_PROTOCOL_SP(36); + SERIAL_PROTOCOL_SP(32); SERIAL_PROTOCOLPGM("std dev:"); SERIAL_PROTOCOL_F(zero_std_dev, 3); SERIAL_EOL(); lcd_setstatus(mess); - print_G33_settings(!_1p_calibration, _7p_calibration && towers_set); + print_G33_settings(_endstop_results, _angle_results); } } else { // dry run const char *enddryrun = PSTR("End DRY-RUN"); serialprintPGM(enddryrun); - SERIAL_PROTOCOL_SP(39); + SERIAL_PROTOCOL_SP(35); SERIAL_PROTOCOLPGM("std dev:"); SERIAL_PROTOCOL_F(zero_std_dev, 3); SERIAL_EOL(); @@ -490,7 +652,8 @@ void GcodeSuite::G33() { } endstops.enable(true); - home_delta(); + if (!home_delta()) + return; endstops.not_homing(); } diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index e3f2021f55..9b7fc47538 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -36,11 +36,12 @@ inline void toggle_pins() { const bool I_flag = parser.boolval('I'); const int repeat = parser.intval('R', 1), - start = parser.intval('S'), - end = parser.intval('E', NUM_DIGITAL_PINS - 1), + start = PARSED_PIN_INDEX('S', 0), + end = PARSED_PIN_INDEX('E', NUM_DIGITAL_PINS - 1), wait = parser.intval('W', 500); - for (uint8_t pin = start; pin <= end; pin++) { + for (uint8_t i = start; i <= end; i++) { + pin_t pin = GET_PIN_MAP_PIN(i); //report_pin_state_extended(pin, I_flag, false); if (!VALID_PIN(pin)) continue; if (!I_flag && pin_is_protected(pin)) { @@ -258,7 +259,7 @@ void GcodeSuite::M43() { } // Get the range of pins to test or watch - const uint8_t first_pin = parser.byteval('P'), + const uint8_t first_pin = PARSED_PIN_INDEX('P', 0), last_pin = parser.seenval('P') ? first_pin : NUM_DIGITAL_PINS - 1; if (first_pin > last_pin) return; @@ -269,7 +270,8 @@ void GcodeSuite::M43() { if (parser.boolval('W')) { SERIAL_PROTOCOLLNPGM("Watching pins"); uint8_t pin_state[last_pin - first_pin + 1]; - for (int8_t pin = first_pin; pin <= last_pin; pin++) { + for (uint8_t i = first_pin; i <= last_pin; i++) { + pin_t pin = GET_PIN_MAP_PIN(i); if (!VALID_PIN(pin)) continue; if (pin_is_protected(pin) && !ignore_protection) continue; pinMode(pin, INPUT_PULLUP); @@ -279,7 +281,7 @@ void GcodeSuite::M43() { pin_state[pin - first_pin] = analogRead(DIGITAL_PIN_TO_ANALOG_PIN(pin)); // int16_t pin_state[...] else //*/ - pin_state[pin - first_pin] = digitalRead(pin); + pin_state[i - first_pin] = digitalRead(pin); } #if HAS_RESUME_CONTINUE @@ -288,7 +290,8 @@ void GcodeSuite::M43() { #endif for (;;) { - for (int8_t pin = first_pin; pin <= last_pin; pin++) { + for (uint8_t i = first_pin; i <= last_pin; i++) { + pin_t pin = GET_PIN_MAP_PIN(i); if (!VALID_PIN(pin)) continue; if (pin_is_protected(pin) && !ignore_protection) continue; const byte val = @@ -298,9 +301,9 @@ void GcodeSuite::M43() { : //*/ digitalRead(pin); - if (val != pin_state[pin - first_pin]) { + if (val != pin_state[i - first_pin]) { report_pin_state_extended(pin, ignore_protection, false); - pin_state[pin - first_pin] = val; + pin_state[i - first_pin] = val; } } @@ -317,8 +320,10 @@ void GcodeSuite::M43() { } // Report current state of selected pin(s) - for (uint8_t pin = first_pin; pin <= last_pin; pin++) + for (uint8_t i = first_pin; i <= last_pin; i++) { + pin_t pin = GET_PIN_MAP_PIN(i); if (VALID_PIN(pin)) report_pin_state_extended(pin, ignore_protection, true); + } } #endif // PINS_DEBUGGING diff --git a/Marlin/src/gcode/control/M226.cpp b/Marlin/src/gcode/control/M226.cpp index c0f5111e90..889bac118c 100644 --- a/Marlin/src/gcode/control/M226.cpp +++ b/Marlin/src/gcode/control/M226.cpp @@ -29,16 +29,17 @@ */ void GcodeSuite::M226() { if (parser.seen('P')) { - const int pin_number = parser.value_int(), + const int pin_number = PARSED_PIN_INDEX('P', 0), pin_state = parser.intval('S', -1); // required pin state - default is inverted + const pin_t pin = GET_PIN_MAP_PIN(pin_number); - if (WITHIN(pin_state, -1, 1) && pin_number > -1 && !pin_is_protected(pin_number)) { + if (WITHIN(pin_state, -1, 1) && pin > -1 && !pin_is_protected(pin)) { int target = LOW; stepper.synchronize(); - pinMode(pin_number, INPUT); + pinMode(pin, INPUT); switch (pin_state) { case 1: target = HIGH; @@ -47,12 +48,12 @@ void GcodeSuite::M226() { target = LOW; break; case -1: - target = !digitalRead(pin_number); + target = !digitalRead(pin); break; } - while (digitalRead(pin_number) != target) idle(); + while (digitalRead(pin) != target) idle(); - } // pin_state -1 0 1 && pin_number > -1 + } // pin_state -1 0 1 && pin > -1 } // parser.seen('P') } diff --git a/Marlin/src/gcode/control/M42.cpp b/Marlin/src/gcode/control/M42.cpp index 44a1892ec3..af5886b011 100644 --- a/Marlin/src/gcode/control/M42.cpp +++ b/Marlin/src/gcode/control/M42.cpp @@ -34,21 +34,22 @@ void GcodeSuite::M42() { if (!parser.seenval('S')) return; const byte pin_status = parser.value_byte(); - const int pin_number = parser.intval('P', LED_PIN); + int pin_number = PARSED_PIN_INDEX('P', GET_PIN_MAP_INDEX(LED_PIN)); if (pin_number < 0) return; - if (pin_is_protected(pin_number)) { + const pin_t pin = GET_PIN_MAP_PIN(pin_number); + if (pin_is_protected(pin)) { SERIAL_ERROR_START(); SERIAL_ERRORLNPGM(MSG_ERR_PROTECTED_PIN); return; } - pinMode(pin_number, OUTPUT); - digitalWrite(pin_number, pin_status); - analogWrite(pin_number, pin_status); + pinMode(pin, OUTPUT); + digitalWrite(pin, pin_status); + analogWrite(pin, pin_status); #if FAN_COUNT > 0 - switch (pin_number) { + switch (pin) { #if HAS_FAN0 case FAN_PIN: fanSpeeds[0] = pin_status; break; #endif diff --git a/Marlin/src/gcode/feature/leds/M150.cpp b/Marlin/src/gcode/feature/leds/M150.cpp index 91cdd65995..47c6e82ee1 100644 --- a/Marlin/src/gcode/feature/leds/M150.cpp +++ b/Marlin/src/gcode/feature/leds/M150.cpp @@ -49,9 +49,13 @@ void GcodeSuite::M150() { set_led_color( parser.seen('R') ? (parser.has_value() ? parser.value_byte() : 255) : 0, parser.seen('U') ? (parser.has_value() ? parser.value_byte() : 255) : 0, - parser.seen('B') ? (parser.has_value() ? parser.value_byte() : 255) : 0, - parser.seen('W') ? (parser.has_value() ? parser.value_byte() : 255) : 0, - parser.seen('P') ? (parser.has_value() ? parser.value_byte() : 255) : LED_BRIGHTNESS + parser.seen('B') ? (parser.has_value() ? parser.value_byte() : 255) : 0 + #if ENABLED(RGBW_LED) || ENABLED(NEOPIXEL_LED) + , parser.seen('W') ? (parser.has_value() ? parser.value_byte() : 255) : 0 + #if ENABLED(NEOPIXEL_LED) + , parser.seen('P') ? (parser.has_value() ? parser.value_byte() : 255) : pixels.getBrightness() + #endif + #endif ); } diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 5c0502772a..0e79f56fef 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -525,6 +525,10 @@ void GcodeSuite::process_next_command() { case 280: M280(); break; // M280: Set servo position absolute #endif + #if ENABLED(BABYSTEPPING) + case 290: M290(); break; // M290: Babystepping + #endif + #if HAS_BUZZER case 300: M300(); break; // M300: Play beep tone #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 61415b0761..90d4c7f6ef 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -169,6 +169,7 @@ * M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS) * M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS) * M280 - Set servo position absolute: "M280 P S". (Requires servos) + * M290 - Babystepping (Requires BABYSTEPPING) * M300 - Play beep sound S P * M301 - Set PID parameters P I and D. (Requires PIDTEMP) * M302 - Allow cold extrudes, or set the minimum extrude S. (Requires PREVENT_COLD_EXTRUSION) @@ -585,6 +586,10 @@ private: static void M280(); #endif + #if ENABLED(BABYSTEPPING) + static void M290(); + #endif + #if HAS_BUZZER static void M300(); #endif diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp new file mode 100644 index 0000000000..45817f59f5 --- /dev/null +++ b/Marlin/src/gcode/motion/M290.cpp @@ -0,0 +1,61 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(BABYSTEPPING) + +#include "../gcode.h" +#include "../../module/probe.h" +#include "../../module/temperature.h" +#include "../../module/planner.h" + +/** + * M290: Babystepping + */ +void GcodeSuite::M290() { + #if ENABLED(BABYSTEP_XY) + for (uint8_t a = X_AXIS; a <= Z_AXIS; a++) + if (parser.seenval(axis_codes[a]) || (a == Z_AXIS && parser.seenval('S'))) { + float offs = constrain(parser.value_axis_units(a), -2, 2); + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + if (a == Z_AXIS) { + zprobe_zoffset += offs; + refresh_zprobe_zoffset(true); // 'true' to not babystep + } + #endif + thermalManager.babystep_axis(a, offs * planner.axis_steps_per_mm[a]); + } + #else + if (parser.seenval('Z') || parser.seenval('S')) { + float offs = constrain(parser.value_axis_units(Z_AXIS), -2, 2); + #if ENABLED(BABYSTEP_ZPROBE_OFFSET) + zprobe_zoffset += offs; + refresh_zprobe_zoffset(); // This will babystep the axis + #else + thermalManager.babystep_axis(Z_AXIS, offs * planner.axis_steps_per_mm[Z_AXIS]); + #endif + } + #endif +} + +#endif // BABYSTEPPING diff --git a/Marlin/src/gcode/parser.h b/Marlin/src/gcode/parser.h index dcd019a99c..d872b21d8e 100644 --- a/Marlin/src/gcode/parser.h +++ b/Marlin/src/gcode/parser.h @@ -293,15 +293,16 @@ public: void unknown_command_error(); // Provide simple value accessors with default option - FORCE_INLINE static float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; } - FORCE_INLINE static bool boolval(const char c) { return seenval(c) ? value_bool() : seen(c); } - FORCE_INLINE static uint8_t byteval(const char c, const uint8_t dval=0) { return seenval(c) ? value_byte() : dval; } - FORCE_INLINE static int16_t intval(const char c, const int16_t dval=0) { return seenval(c) ? value_int() : dval; } - FORCE_INLINE static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort() : dval; } - FORCE_INLINE static int32_t longval(const char c, const int32_t dval=0) { return seenval(c) ? value_long() : dval; } - FORCE_INLINE static uint32_t ulongval(const char c, const uint32_t dval=0) { return seenval(c) ? value_ulong() : dval; } - FORCE_INLINE static float linearval(const char c, const float dval=0.0) { return seenval(c) ? value_linear_units() : dval; } - FORCE_INLINE static float celsiusval(const char c, const float dval=0.0) { return seenval(c) ? value_celsius() : dval; } + FORCE_INLINE static float floatval(const char c, const float dval=0.0) { return seenval(c) ? value_float() : dval; } + FORCE_INLINE static bool boolval(const char c) { return seenval(c) ? value_bool() : seen(c); } + FORCE_INLINE static uint8_t byteval(const char c, const uint8_t dval=0) { return seenval(c) ? value_byte() : dval; } + FORCE_INLINE static int16_t intval(const char c, const int16_t dval=0) { return seenval(c) ? value_int() : dval; } + FORCE_INLINE static uint16_t ushortval(const char c, const uint16_t dval=0) { return seenval(c) ? value_ushort() : dval; } + FORCE_INLINE static int32_t longval(const char c, const int32_t dval=0) { return seenval(c) ? value_long() : dval; } + FORCE_INLINE static uint32_t ulongval(const char c, const uint32_t dval=0) { return seenval(c) ? value_ulong() : dval; } + FORCE_INLINE static float linearval(const char c, const float dval=0.0) { return seenval(c) ? value_linear_units() : dval; } + FORCE_INLINE static float celsiusval(const char c, const float dval=0.0) { return seenval(c) ? value_celsius() : dval; } + FORCE_INLINE static const char* strval(const char c) { return seenval(c) ? value_ptr : NULL; } }; diff --git a/Marlin/src/gcode/temperature/M104_M109.cpp b/Marlin/src/gcode/temperature/M104_M109.cpp index c99d49312a..afc7cda7a7 100644 --- a/Marlin/src/gcode/temperature/M104_M109.cpp +++ b/Marlin/src/gcode/temperature/M104_M109.cpp @@ -190,7 +190,14 @@ void GcodeSuite::M109() { const uint8_t blue = map(constrain(temp, start_temp, target_temp), start_temp, target_temp, 255, 0); if (blue != old_blue) { old_blue = blue; - set_led_color(255, 0, blue); + set_led_color(255, 0, blue + #if ENABLED(NEOPIXEL_LED) + , 0, pixels.getBrightness() + #if ENABLED(NEOPIXEL_IS_SEQUENTIAL) + , true + #endif + #endif + ); } } #endif diff --git a/Marlin/src/gcode/temperature/M140_M190.cpp b/Marlin/src/gcode/temperature/M140_M190.cpp index 3caec006e4..b72f3b7a9e 100644 --- a/Marlin/src/gcode/temperature/M140_M190.cpp +++ b/Marlin/src/gcode/temperature/M140_M190.cpp @@ -132,7 +132,14 @@ void GcodeSuite::M190() { const uint8_t red = map(constrain(temp, start_temp, target_temp), start_temp, target_temp, 0, 255); if (red != old_red) { old_red = red; - set_led_color(red, 0, 255); + set_led_color(red, 0, 255 + #if ENABLED(NEOPIXEL_LED) + , 0, pixels.getBrightness() + #if ENABLED(NEOPIXEL_IS_SEQUENTIAL) + , true + #endif + #endif + ); } } #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index b95099fe90..0da0f42684 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -353,9 +353,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE, * Babystepping */ #if ENABLED(BABYSTEPPING) - #if DISABLED(ULTRA_LCD) && DISABLED(I2C_POSITION_ENCODERS) - #error "BABYSTEPPING requires an LCD controller." - #elif ENABLED(SCARA) + #if ENABLED(SCARA) #error "BABYSTEPPING is not implemented for SCARA yet." #elif ENABLED(DELTA) && ENABLED(BABYSTEP_XY) #error "BABYSTEPPING only implemented for Z axis on deltabots." @@ -1162,7 +1160,7 @@ static_assert(1 >= 0 #if !(PIN_EXISTS(NEOPIXEL) && NEOPIXEL_PIXELS > 0) #error "NEOPIXEL_LED requires NEOPIXEL_PIN and NEOPIXEL_PIXELS." #endif -#elif ENABLED(PRINTER_EVENT_LEDS) && DISABLED(BLINKM) && DISABLED(PCA9632) && DISABLED(NEOPIXEL_LED) +#elif ENABLED(PRINTER_EVENT_LEDS) && DISABLED(BLINKM) && DISABLED(PCA9632) #error "PRINTER_EVENT_LEDS requires BLINKM, PCA9632, RGB_LED, RGBW_LED or NEOPIXEL_LED." #endif diff --git a/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h b/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h index 8ff40d054f..e041c3594e 100644 --- a/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h +++ b/Marlin/src/lcd/dogm/dogm_font_data_ISO10646_1.h @@ -32,167 +32,262 @@ Max Font ascent = 8 descent=-1 */ #include -const u8g_fntpgm_uint8_t ISO10646_1_5x7[2592] U8G_SECTION(".progmem.ISO10646_1_5x7") = { - 0, 6, 9, 0, 254, 7, 1, 146, 3, 33, 32, 255, 255, 8, 255, 7, - 255, 0, 0, 0, 6, 0, 0, 1, 7, 7, 6, 2, 0, 128, 128, 128, - 128, 128, 0, 128, 3, 2, 2, 6, 1, 5, 160, 160, 5, 7, 7, 6, - 0, 0, 80, 80, 248, 80, 248, 80, 80, 5, 7, 7, 6, 0, 0, 32, - 120, 160, 112, 40, 240, 32, 5, 7, 7, 6, 0, 0, 192, 200, 16, 32, - 64, 152, 24, 5, 7, 7, 6, 0, 0, 96, 144, 160, 64, 168, 144, 104, - 2, 3, 3, 6, 1, 4, 192, 64, 128, 3, 7, 7, 6, 1, 0, 32, - 64, 128, 128, 128, 64, 32, 3, 7, 7, 6, 1, 0, 128, 64, 32, 32, - 32, 64, 128, 5, 5, 5, 6, 0, 1, 32, 168, 112, 168, 32, 5, 5, - 5, 6, 0, 1, 32, 32, 248, 32, 32, 2, 3, 3, 6, 2, 255, 192, - 64, 128, 5, 1, 1, 6, 0, 3, 248, 2, 2, 2, 6, 2, 0, 192, - 192, 5, 5, 5, 6, 0, 1, 8, 16, 32, 64, 128, 5, 7, 7, 6, - 0, 0, 112, 136, 136, 136, 136, 136, 112, 3, 7, 7, 6, 1, 0, 64, - 192, 64, 64, 64, 64, 224, 5, 7, 7, 6, 0, 0, 112, 136, 8, 112, - 128, 128, 248, 5, 7, 7, 6, 0, 0, 248, 16, 32, 16, 8, 8, 240, - 5, 7, 7, 6, 0, 0, 16, 48, 80, 144, 248, 16, 16, 5, 7, 7, - 6, 0, 0, 248, 128, 240, 8, 8, 136, 112, 5, 7, 7, 6, 0, 0, - 112, 128, 128, 240, 136, 136, 112, 5, 7, 7, 6, 0, 0, 248, 8, 16, - 32, 32, 32, 32, 5, 7, 7, 6, 0, 0, 112, 136, 136, 112, 136, 136, - 112, 5, 7, 7, 6, 0, 0, 112, 136, 136, 120, 8, 8, 112, 2, 5, - 5, 6, 2, 0, 192, 192, 0, 192, 192, 2, 6, 6, 6, 2, 255, 192, - 192, 0, 192, 64, 128, 4, 7, 7, 6, 0, 0, 16, 32, 64, 128, 64, - 32, 16, 5, 3, 3, 6, 0, 2, 248, 0, 248, 4, 7, 7, 6, 1, - 0, 128, 64, 32, 16, 32, 64, 128, 5, 7, 7, 6, 0, 0, 112, 136, - 8, 16, 32, 0, 32, 5, 7, 7, 6, 0, 0, 112, 136, 8, 104, 168, - 168, 112, 5, 7, 7, 6, 0, 0, 112, 136, 136, 248, 136, 136, 136, 5, - 7, 7, 6, 0, 0, 240, 136, 136, 240, 136, 136, 240, 5, 7, 7, 6, - 0, 0, 112, 136, 128, 128, 128, 136, 112, 5, 7, 7, 6, 0, 0, 240, - 136, 136, 136, 136, 136, 240, 5, 7, 7, 6, 0, 0, 248, 128, 128, 240, - 128, 128, 248, 5, 7, 7, 6, 0, 0, 248, 128, 128, 240, 128, 128, 128, - 5, 7, 7, 6, 0, 0, 112, 136, 128, 184, 136, 136, 112, 5, 7, 7, - 6, 0, 0, 136, 136, 136, 248, 136, 136, 136, 1, 7, 7, 6, 2, 0, - 128, 128, 128, 128, 128, 128, 128, 5, 7, 7, 6, 0, 0, 56, 16, 16, - 16, 16, 144, 96, 5, 7, 7, 6, 0, 0, 136, 144, 160, 192, 160, 144, - 136, 5, 7, 7, 6, 0, 0, 128, 128, 128, 128, 128, 128, 248, 5, 7, - 7, 6, 0, 0, 136, 216, 168, 136, 136, 136, 136, 5, 7, 7, 6, 0, - 0, 136, 136, 200, 168, 152, 136, 136, 5, 7, 7, 6, 0, 0, 112, 136, - 136, 136, 136, 136, 112, 5, 7, 7, 6, 0, 0, 240, 136, 136, 240, 128, - 128, 128, 5, 7, 7, 6, 0, 0, 112, 136, 136, 136, 168, 144, 104, 5, - 7, 7, 6, 0, 0, 240, 136, 136, 240, 160, 144, 136, 5, 7, 7, 6, - 0, 0, 120, 128, 128, 112, 8, 8, 240, 5, 7, 7, 6, 0, 0, 248, - 32, 32, 32, 32, 32, 32, 5, 7, 7, 6, 0, 0, 136, 136, 136, 136, - 136, 136, 112, 5, 7, 7, 6, 0, 0, 136, 136, 136, 136, 136, 80, 32, - 5, 7, 7, 6, 0, 0, 136, 136, 136, 136, 136, 168, 80, 5, 7, 7, - 6, 0, 0, 136, 136, 80, 32, 80, 136, 136, 5, 7, 7, 6, 0, 0, - 136, 136, 136, 80, 32, 32, 32, 5, 7, 7, 6, 0, 0, 248, 8, 16, - 32, 64, 128, 248, 3, 7, 7, 6, 1, 0, 224, 128, 128, 128, 128, 128, - 224, 5, 5, 5, 6, 0, 1, 128, 64, 32, 16, 8, 3, 7, 7, 6, - 1, 0, 224, 32, 32, 32, 32, 32, 224, 5, 3, 3, 6, 0, 4, 32, - 80, 136, 5, 1, 1, 6, 0, 0, 248, 2, 2, 2, 6, 2, 5, 128, - 64, 5, 5, 5, 6, 0, 0, 112, 8, 120, 136, 120, 5, 7, 7, 6, - 0, 0, 128, 128, 176, 200, 136, 136, 240, 5, 5, 5, 6, 0, 0, 112, - 128, 128, 136, 112, 5, 7, 7, 6, 0, 0, 8, 8, 104, 152, 136, 136, - 120, 5, 5, 5, 6, 0, 0, 112, 136, 248, 128, 112, 5, 7, 7, 6, - 0, 0, 48, 72, 224, 64, 64, 64, 64, 5, 6, 6, 6, 0, 255, 112, - 136, 136, 120, 8, 112, 5, 7, 7, 6, 0, 0, 128, 128, 176, 200, 136, - 136, 136, 1, 7, 7, 6, 2, 0, 128, 0, 128, 128, 128, 128, 128, 3, - 8, 8, 6, 1, 255, 32, 0, 32, 32, 32, 32, 160, 64, 4, 7, 7, - 6, 0, 0, 128, 128, 144, 160, 192, 160, 144, 3, 7, 7, 6, 1, 0, - 192, 64, 64, 64, 64, 64, 224, 5, 5, 5, 6, 0, 0, 208, 168, 168, - 168, 168, 5, 5, 5, 6, 0, 0, 176, 200, 136, 136, 136, 5, 5, 5, - 6, 0, 0, 112, 136, 136, 136, 112, 5, 6, 6, 6, 0, 255, 240, 136, - 136, 240, 128, 128, 5, 6, 6, 6, 0, 255, 120, 136, 136, 120, 8, 8, - 5, 5, 5, 6, 0, 0, 176, 200, 128, 128, 128, 5, 5, 5, 6, 0, - 0, 112, 128, 112, 8, 240, 4, 7, 7, 6, 0, 0, 64, 64, 224, 64, - 64, 64, 48, 5, 5, 5, 6, 0, 0, 136, 136, 136, 152, 104, 5, 5, - 5, 6, 0, 0, 136, 136, 136, 80, 32, 5, 5, 5, 6, 0, 0, 136, - 136, 168, 168, 80, 5, 5, 5, 6, 0, 0, 136, 80, 32, 80, 136, 5, - 6, 6, 6, 0, 255, 136, 136, 136, 120, 8, 112, 5, 5, 5, 6, 0, - 0, 248, 16, 32, 64, 248, 3, 7, 7, 6, 1, 0, 32, 64, 64, 128, - 64, 64, 32, 1, 7, 7, 6, 2, 0, 128, 128, 128, 128, 128, 128, 128, - 3, 7, 7, 6, 1, 0, 128, 64, 64, 32, 64, 64, 128, 5, 2, 2, - 6, 0, 2, 104, 144, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, - 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, - 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, - 0, 1, 7, 7, 6, 2, 0, 128, 0, 128, 128, 128, 128, 128, 5, 7, - 7, 6, 0, 0, 32, 112, 168, 160, 168, 112, 32, 5, 7, 7, 6, 0, - 0, 48, 64, 64, 224, 64, 80, 168, 5, 5, 5, 6, 0, 0, 136, 112, - 80, 112, 136, 5, 7, 7, 6, 0, 0, 136, 80, 32, 248, 32, 248, 32, - 1, 7, 7, 6, 2, 0, 128, 128, 128, 0, 128, 128, 128, 5, 8, 8, - 6, 0, 0, 48, 72, 32, 80, 80, 32, 144, 96, 3, 1, 1, 6, 1, - 7, 160, 5, 7, 7, 6, 0, 0, 248, 136, 184, 184, 184, 136, 248, 5, - 7, 7, 6, 0, 1, 112, 8, 120, 136, 120, 0, 248, 5, 5, 5, 6, - 0, 1, 40, 80, 160, 80, 40, 5, 3, 3, 6, 0, 1, 248, 8, 8, - 2, 2, 2, 6, 2, 6, 64, 128, 5, 7, 7, 6, 0, 0, 248, 136, - 168, 136, 152, 168, 248, 5, 1, 1, 6, 0, 6, 248, 4, 4, 4, 6, - 0, 3, 96, 144, 144, 96, 5, 7, 7, 6, 0, 0, 32, 32, 248, 32, - 32, 0, 248, 4, 5, 5, 6, 0, 3, 96, 144, 32, 64, 240, 3, 5, - 5, 6, 0, 3, 224, 32, 224, 32, 224, 2, 2, 2, 6, 2, 6, 64, - 128, 5, 8, 8, 6, 0, 255, 136, 136, 136, 136, 152, 232, 128, 128, 5, - 7, 7, 6, 0, 0, 120, 152, 152, 120, 24, 24, 24, 2, 2, 2, 6, - 2, 2, 192, 192, 2, 2, 2, 6, 2, 255, 64, 128, 3, 5, 5, 6, - 0, 3, 64, 192, 64, 64, 224, 5, 7, 7, 6, 0, 1, 112, 136, 136, - 136, 112, 0, 248, 5, 5, 5, 6, 0, 1, 160, 80, 40, 80, 160, 5, - 7, 7, 6, 0, 0, 136, 144, 168, 88, 184, 8, 8, 5, 7, 7, 6, - 0, 0, 136, 144, 184, 72, 152, 32, 56, 5, 8, 8, 6, 0, 0, 192, - 64, 192, 72, 216, 56, 8, 8, 5, 7, 7, 6, 0, 0, 32, 0, 32, - 64, 128, 136, 112, 5, 8, 8, 6, 0, 0, 64, 32, 0, 112, 136, 248, - 136, 136, 5, 8, 8, 6, 0, 0, 16, 32, 0, 112, 136, 248, 136, 136, - 5, 8, 8, 6, 0, 0, 32, 80, 0, 112, 136, 248, 136, 136, 5, 8, - 8, 6, 0, 0, 104, 144, 0, 112, 136, 248, 136, 136, 5, 8, 8, 6, - 0, 0, 80, 0, 112, 136, 136, 248, 136, 136, 5, 8, 8, 6, 0, 0, - 32, 80, 32, 112, 136, 248, 136, 136, 5, 7, 7, 6, 0, 0, 56, 96, - 160, 184, 224, 160, 184, 5, 8, 8, 6, 0, 255, 112, 136, 128, 128, 136, - 112, 32, 96, 5, 8, 8, 6, 0, 0, 64, 32, 0, 248, 128, 240, 128, - 248, 5, 8, 8, 6, 0, 0, 8, 16, 0, 248, 128, 240, 128, 248, 5, - 8, 8, 6, 0, 0, 32, 80, 0, 248, 128, 240, 128, 248, 5, 7, 7, - 6, 0, 0, 80, 0, 248, 128, 240, 128, 248, 3, 8, 8, 6, 1, 0, - 128, 64, 0, 224, 64, 64, 64, 224, 3, 8, 8, 6, 1, 0, 32, 64, - 0, 224, 64, 64, 64, 224, 3, 8, 8, 6, 1, 0, 64, 160, 0, 224, - 64, 64, 64, 224, 3, 7, 7, 6, 1, 0, 160, 0, 224, 64, 64, 64, - 224, 5, 7, 7, 6, 0, 0, 112, 72, 72, 232, 72, 72, 112, 5, 8, - 8, 6, 0, 0, 104, 144, 0, 136, 200, 168, 152, 136, 5, 8, 8, 6, - 0, 0, 64, 32, 112, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, - 16, 32, 112, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 32, 80, - 0, 112, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 104, 144, 0, 112, - 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 80, 0, 112, 136, 136, 136, - 136, 112, 5, 5, 5, 6, 0, 1, 136, 80, 32, 80, 136, 5, 8, 8, - 6, 0, 255, 16, 112, 168, 168, 168, 168, 112, 64, 5, 8, 8, 6, 0, - 0, 64, 32, 136, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 16, - 32, 136, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 32, 80, 0, - 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 80, 0, 136, 136, 136, - 136, 136, 112, 5, 8, 8, 6, 0, 0, 16, 32, 136, 80, 32, 32, 32, - 32, 5, 9, 9, 6, 0, 255, 192, 64, 112, 72, 72, 112, 64, 64, 224, - 4, 8, 8, 6, 1, 255, 96, 144, 144, 160, 144, 144, 224, 128, 5, 8, - 8, 6, 0, 0, 64, 32, 0, 112, 8, 120, 136, 120, 5, 8, 8, 6, - 0, 0, 16, 32, 0, 112, 8, 120, 136, 120, 5, 8, 8, 6, 0, 0, - 32, 80, 0, 112, 8, 120, 136, 120, 5, 8, 8, 6, 0, 0, 104, 144, - 0, 112, 8, 120, 136, 120, 5, 7, 7, 6, 0, 0, 80, 0, 112, 8, - 120, 136, 120, 5, 8, 8, 6, 0, 0, 32, 80, 32, 112, 8, 120, 136, - 120, 5, 6, 6, 6, 0, 0, 208, 40, 120, 160, 168, 80, 5, 6, 6, - 6, 0, 255, 112, 128, 136, 112, 32, 96, 5, 8, 8, 6, 0, 0, 64, - 32, 0, 112, 136, 248, 128, 112, 5, 8, 8, 6, 0, 0, 16, 32, 0, - 112, 136, 248, 128, 112, 5, 8, 8, 6, 0, 0, 32, 80, 0, 112, 136, - 248, 128, 112, 5, 7, 7, 6, 0, 0, 80, 0, 112, 136, 248, 128, 112, - 3, 8, 8, 6, 1, 0, 128, 64, 0, 64, 192, 64, 64, 224, 3, 8, - 8, 6, 1, 0, 32, 64, 0, 64, 192, 64, 64, 224, 3, 8, 8, 6, - 1, 0, 64, 160, 0, 64, 192, 64, 64, 224, 3, 7, 7, 6, 1, 0, - 160, 0, 64, 192, 64, 64, 224, 5, 7, 7, 6, 0, 0, 160, 64, 160, - 16, 120, 136, 112, 5, 8, 8, 6, 0, 0, 104, 144, 0, 176, 200, 136, - 136, 136, 5, 8, 8, 6, 0, 0, 64, 32, 0, 112, 136, 136, 136, 112, - 5, 8, 8, 6, 0, 0, 16, 32, 0, 112, 136, 136, 136, 112, 5, 8, - 8, 6, 0, 0, 32, 80, 0, 112, 136, 136, 136, 112, 5, 8, 8, 6, - 0, 0, 104, 144, 0, 112, 136, 136, 136, 112, 5, 7, 7, 6, 0, 0, - 80, 0, 112, 136, 136, 136, 112, 5, 5, 5, 6, 0, 1, 32, 0, 248, - 0, 32, 5, 7, 7, 6, 0, 255, 16, 112, 168, 168, 168, 112, 64, 5, - 8, 8, 6, 0, 0, 64, 32, 0, 136, 136, 136, 152, 104, 5, 8, 8, - 6, 0, 0, 16, 32, 0, 136, 136, 136, 152, 104, 5, 8, 8, 6, 0, - 0, 32, 80, 0, 136, 136, 136, 152, 104, 5, 7, 7, 6, 0, 0, 80, - 0, 136, 136, 136, 152, 104, 5, 9, 9, 6, 0, 255, 16, 32, 0, 136, - 136, 136, 248, 8, 112, 4, 7, 7, 6, 1, 255, 192, 64, 96, 80, 96, - 64, 224, 5, 8, 8, 6, 0, 255, 80, 0, 136, 136, 136, 120, 8, 112 -}; + +#define not_extended_ISO10646_1_5x7 (defined(LANGUAGE_AN_H) \ + || defined(LANGUAGE_EN_H) \ + || defined(LANGUAGE_ES_H) \ + || defined(LANGUAGE_EU_H) \ + || defined(LANGUAGE_FR_H) \ + || defined(LANGUAGE_GL_H) \ + || defined(LANGUAGE_NL_H) \ + || defined(LANGUAGE_PL_HD44780_H) \ + || defined(LANGUAGE_PT_H) \ + || defined(LANGUAGE_PT_BR_H)) + +#if defined(__AVR__) && not_extended_ISO10646_1_5x7 + + // reduced font (only sysmbols 32 - 127) - saves about 1400 bytes of FLASH + const u8g_fntpgm_uint8_t ISO10646_1_5x7[] U8G_SECTION(".progmem.ISO10646_1_5x7") = { + 0,6,9,0,254,7,1,146,3,33,32,127,255,7,255,7, + 255,0,0,0,6,0,0,1,7,7,6,2,0,128,128,128, + 128,128,0,128,3,2,2,6,1,5,160,160,5,7,7,6, + 0,0,80,80,248,80,248,80,80,5,7,7,6,0,0,32, + 120,160,112,40,240,32,5,7,7,6,0,0,192,200,16,32, + 64,152,24,5,7,7,6,0,0,96,144,160,64,168,144,104, + 2,3,3,6,1,4,192,64,128,3,7,7,6,1,0,32, + 64,128,128,128,64,32,3,7,7,6,1,0,128,64,32,32, + 32,64,128,5,5,5,6,0,1,32,168,112,168,32,5,5, + 5,6,0,1,32,32,248,32,32,2,3,3,6,2,255,192, + 64,128,5,1,1,6,0,3,248,2,2,2,6,2,0,192, + 192,5,5,5,6,0,1,8,16,32,64,128,5,7,7,6, + 0,0,112,136,136,136,136,136,112,3,7,7,6,1,0,64, + 192,64,64,64,64,224,5,7,7,6,0,0,112,136,8,112, + 128,128,248,5,7,7,6,0,0,248,16,32,16,8,8,240, + 5,7,7,6,0,0,16,48,80,144,248,16,16,5,7,7, + 6,0,0,248,128,240,8,8,136,112,5,7,7,6,0,0, + 112,128,128,240,136,136,112,5,7,7,6,0,0,248,8,16, + 32,32,32,32,5,7,7,6,0,0,112,136,136,112,136,136, + 112,5,7,7,6,0,0,112,136,136,120,8,8,112,2,5, + 5,6,2,0,192,192,0,192,192,2,6,6,6,2,255,192, + 192,0,192,64,128,4,7,7,6,0,0,16,32,64,128,64, + 32,16,5,3,3,6,0,2,248,0,248,4,7,7,6,1, + 0,128,64,32,16,32,64,128,5,7,7,6,0,0,112,136, + 8,16,32,0,32,5,7,7,6,0,0,112,136,8,104,168, + 168,112,5,7,7,6,0,0,112,136,136,248,136,136,136,5, + 7,7,6,0,0,240,136,136,240,136,136,240,5,7,7,6, + 0,0,112,136,128,128,128,136,112,5,7,7,6,0,0,240, + 136,136,136,136,136,240,5,7,7,6,0,0,248,128,128,240, + 128,128,248,5,7,7,6,0,0,248,128,128,240,128,128,128, + 5,7,7,6,0,0,112,136,128,184,136,136,112,5,7,7, + 6,0,0,136,136,136,248,136,136,136,1,7,7,6,2,0, + 128,128,128,128,128,128,128,5,7,7,6,0,0,56,16,16, + 16,16,144,96,5,7,7,6,0,0,136,144,160,192,160,144, + 136,5,7,7,6,0,0,128,128,128,128,128,128,248,5,7, + 7,6,0,0,136,216,168,136,136,136,136,5,7,7,6,0, + 0,136,136,200,168,152,136,136,5,7,7,6,0,0,112,136, + 136,136,136,136,112,5,7,7,6,0,0,240,136,136,240,128, + 128,128,5,7,7,6,0,0,112,136,136,136,168,144,104,5, + 7,7,6,0,0,240,136,136,240,160,144,136,5,7,7,6, + 0,0,120,128,128,112,8,8,240,5,7,7,6,0,0,248, + 32,32,32,32,32,32,5,7,7,6,0,0,136,136,136,136, + 136,136,112,5,7,7,6,0,0,136,136,136,136,136,80,32, + 5,7,7,6,0,0,136,136,136,136,136,168,80,5,7,7, + 6,0,0,136,136,80,32,80,136,136,5,7,7,6,0,0, + 136,136,136,80,32,32,32,5,7,7,6,0,0,248,8,16, + 32,64,128,248,3,7,7,6,1,0,224,128,128,128,128,128, + 224,5,5,5,6,0,1,128,64,32,16,8,3,7,7,6, + 1,0,224,32,32,32,32,32,224,5,3,3,6,0,4,32, + 80,136,5,1,1,6,0,0,248,2,2,2,6,2,5,128, + 64,5,5,5,6,0,0,112,8,120,136,120,5,7,7,6, + 0,0,128,128,176,200,136,136,240,5,5,5,6,0,0,112, + 128,128,136,112,5,7,7,6,0,0,8,8,104,152,136,136, + 120,5,5,5,6,0,0,112,136,248,128,112,5,7,7,6, + 0,0,48,72,224,64,64,64,64,5,6,6,6,0,255,112, + 136,136,120,8,112,5,7,7,6,0,0,128,128,176,200,136, + 136,136,1,7,7,6,2,0,128,0,128,128,128,128,128,3, + 8,8,6,1,255,32,0,32,32,32,32,160,64,4,7,7, + 6,0,0,128,128,144,160,192,160,144,3,7,7,6,1,0, + 192,64,64,64,64,64,224,5,5,5,6,0,0,208,168,168, + 168,168,5,5,5,6,0,0,176,200,136,136,136,5,5,5, + 6,0,0,112,136,136,136,112,5,6,6,6,0,255,240,136, + 136,240,128,128,5,6,6,6,0,255,120,136,136,120,8,8, + 5,5,5,6,0,0,176,200,128,128,128,5,5,5,6,0, + 0,112,128,112,8,240,4,7,7,6,0,0,64,64,224,64, + 64,64,48,5,5,5,6,0,0,136,136,136,152,104,5,5, + 5,6,0,0,136,136,136,80,32,5,5,5,6,0,0,136, + 136,168,168,80,5,5,5,6,0,0,136,80,32,80,136,5, + 6,6,6,0,255,136,136,136,120,8,112,5,5,5,6,0, + 0,248,16,32,64,248,3,7,7,6,1,0,32,64,64,128, + 64,64,32,1,7,7,6,2,0,128,128,128,128,128,128,128, + 3,7,7,6,1,0,128,64,64,32,64,64,128,5,2,2, + 6,0,2,104,144,0,0,0,6,0,0}; + +#else + + // extended (original) font (sysmbols 32 - 255) + const u8g_fntpgm_uint8_t ISO10646_1_5x7[2592] U8G_SECTION(".progmem.ISO10646_1_5x7") = { + 0, 6, 9, 0, 254, 7, 1, 146, 3, 33, 32, 255, 255, 8, 255, 7, + 255, 0, 0, 0, 6, 0, 0, 1, 7, 7, 6, 2, 0, 128, 128, 128, + 128, 128, 0, 128, 3, 2, 2, 6, 1, 5, 160, 160, 5, 7, 7, 6, + 0, 0, 80, 80, 248, 80, 248, 80, 80, 5, 7, 7, 6, 0, 0, 32, + 120, 160, 112, 40, 240, 32, 5, 7, 7, 6, 0, 0, 192, 200, 16, 32, + 64, 152, 24, 5, 7, 7, 6, 0, 0, 96, 144, 160, 64, 168, 144, 104, + 2, 3, 3, 6, 1, 4, 192, 64, 128, 3, 7, 7, 6, 1, 0, 32, + 64, 128, 128, 128, 64, 32, 3, 7, 7, 6, 1, 0, 128, 64, 32, 32, + 32, 64, 128, 5, 5, 5, 6, 0, 1, 32, 168, 112, 168, 32, 5, 5, + 5, 6, 0, 1, 32, 32, 248, 32, 32, 2, 3, 3, 6, 2, 255, 192, + 64, 128, 5, 1, 1, 6, 0, 3, 248, 2, 2, 2, 6, 2, 0, 192, + 192, 5, 5, 5, 6, 0, 1, 8, 16, 32, 64, 128, 5, 7, 7, 6, + 0, 0, 112, 136, 136, 136, 136, 136, 112, 3, 7, 7, 6, 1, 0, 64, + 192, 64, 64, 64, 64, 224, 5, 7, 7, 6, 0, 0, 112, 136, 8, 112, + 128, 128, 248, 5, 7, 7, 6, 0, 0, 248, 16, 32, 16, 8, 8, 240, + 5, 7, 7, 6, 0, 0, 16, 48, 80, 144, 248, 16, 16, 5, 7, 7, + 6, 0, 0, 248, 128, 240, 8, 8, 136, 112, 5, 7, 7, 6, 0, 0, + 112, 128, 128, 240, 136, 136, 112, 5, 7, 7, 6, 0, 0, 248, 8, 16, + 32, 32, 32, 32, 5, 7, 7, 6, 0, 0, 112, 136, 136, 112, 136, 136, + 112, 5, 7, 7, 6, 0, 0, 112, 136, 136, 120, 8, 8, 112, 2, 5, + 5, 6, 2, 0, 192, 192, 0, 192, 192, 2, 6, 6, 6, 2, 255, 192, + 192, 0, 192, 64, 128, 4, 7, 7, 6, 0, 0, 16, 32, 64, 128, 64, + 32, 16, 5, 3, 3, 6, 0, 2, 248, 0, 248, 4, 7, 7, 6, 1, + 0, 128, 64, 32, 16, 32, 64, 128, 5, 7, 7, 6, 0, 0, 112, 136, + 8, 16, 32, 0, 32, 5, 7, 7, 6, 0, 0, 112, 136, 8, 104, 168, + 168, 112, 5, 7, 7, 6, 0, 0, 112, 136, 136, 248, 136, 136, 136, 5, + 7, 7, 6, 0, 0, 240, 136, 136, 240, 136, 136, 240, 5, 7, 7, 6, + 0, 0, 112, 136, 128, 128, 128, 136, 112, 5, 7, 7, 6, 0, 0, 240, + 136, 136, 136, 136, 136, 240, 5, 7, 7, 6, 0, 0, 248, 128, 128, 240, + 128, 128, 248, 5, 7, 7, 6, 0, 0, 248, 128, 128, 240, 128, 128, 128, + 5, 7, 7, 6, 0, 0, 112, 136, 128, 184, 136, 136, 112, 5, 7, 7, + 6, 0, 0, 136, 136, 136, 248, 136, 136, 136, 1, 7, 7, 6, 2, 0, + 128, 128, 128, 128, 128, 128, 128, 5, 7, 7, 6, 0, 0, 56, 16, 16, + 16, 16, 144, 96, 5, 7, 7, 6, 0, 0, 136, 144, 160, 192, 160, 144, + 136, 5, 7, 7, 6, 0, 0, 128, 128, 128, 128, 128, 128, 248, 5, 7, + 7, 6, 0, 0, 136, 216, 168, 136, 136, 136, 136, 5, 7, 7, 6, 0, + 0, 136, 136, 200, 168, 152, 136, 136, 5, 7, 7, 6, 0, 0, 112, 136, + 136, 136, 136, 136, 112, 5, 7, 7, 6, 0, 0, 240, 136, 136, 240, 128, + 128, 128, 5, 7, 7, 6, 0, 0, 112, 136, 136, 136, 168, 144, 104, 5, + 7, 7, 6, 0, 0, 240, 136, 136, 240, 160, 144, 136, 5, 7, 7, 6, + 0, 0, 120, 128, 128, 112, 8, 8, 240, 5, 7, 7, 6, 0, 0, 248, + 32, 32, 32, 32, 32, 32, 5, 7, 7, 6, 0, 0, 136, 136, 136, 136, + 136, 136, 112, 5, 7, 7, 6, 0, 0, 136, 136, 136, 136, 136, 80, 32, + 5, 7, 7, 6, 0, 0, 136, 136, 136, 136, 136, 168, 80, 5, 7, 7, + 6, 0, 0, 136, 136, 80, 32, 80, 136, 136, 5, 7, 7, 6, 0, 0, + 136, 136, 136, 80, 32, 32, 32, 5, 7, 7, 6, 0, 0, 248, 8, 16, + 32, 64, 128, 248, 3, 7, 7, 6, 1, 0, 224, 128, 128, 128, 128, 128, + 224, 5, 5, 5, 6, 0, 1, 128, 64, 32, 16, 8, 3, 7, 7, 6, + 1, 0, 224, 32, 32, 32, 32, 32, 224, 5, 3, 3, 6, 0, 4, 32, + 80, 136, 5, 1, 1, 6, 0, 0, 248, 2, 2, 2, 6, 2, 5, 128, + 64, 5, 5, 5, 6, 0, 0, 112, 8, 120, 136, 120, 5, 7, 7, 6, + 0, 0, 128, 128, 176, 200, 136, 136, 240, 5, 5, 5, 6, 0, 0, 112, + 128, 128, 136, 112, 5, 7, 7, 6, 0, 0, 8, 8, 104, 152, 136, 136, + 120, 5, 5, 5, 6, 0, 0, 112, 136, 248, 128, 112, 5, 7, 7, 6, + 0, 0, 48, 72, 224, 64, 64, 64, 64, 5, 6, 6, 6, 0, 255, 112, + 136, 136, 120, 8, 112, 5, 7, 7, 6, 0, 0, 128, 128, 176, 200, 136, + 136, 136, 1, 7, 7, 6, 2, 0, 128, 0, 128, 128, 128, 128, 128, 3, + 8, 8, 6, 1, 255, 32, 0, 32, 32, 32, 32, 160, 64, 4, 7, 7, + 6, 0, 0, 128, 128, 144, 160, 192, 160, 144, 3, 7, 7, 6, 1, 0, + 192, 64, 64, 64, 64, 64, 224, 5, 5, 5, 6, 0, 0, 208, 168, 168, + 168, 168, 5, 5, 5, 6, 0, 0, 176, 200, 136, 136, 136, 5, 5, 5, + 6, 0, 0, 112, 136, 136, 136, 112, 5, 6, 6, 6, 0, 255, 240, 136, + 136, 240, 128, 128, 5, 6, 6, 6, 0, 255, 120, 136, 136, 120, 8, 8, + 5, 5, 5, 6, 0, 0, 176, 200, 128, 128, 128, 5, 5, 5, 6, 0, + 0, 112, 128, 112, 8, 240, 4, 7, 7, 6, 0, 0, 64, 64, 224, 64, + 64, 64, 48, 5, 5, 5, 6, 0, 0, 136, 136, 136, 152, 104, 5, 5, + 5, 6, 0, 0, 136, 136, 136, 80, 32, 5, 5, 5, 6, 0, 0, 136, + 136, 168, 168, 80, 5, 5, 5, 6, 0, 0, 136, 80, 32, 80, 136, 5, + 6, 6, 6, 0, 255, 136, 136, 136, 120, 8, 112, 5, 5, 5, 6, 0, + 0, 248, 16, 32, 64, 248, 3, 7, 7, 6, 1, 0, 32, 64, 64, 128, + 64, 64, 32, 1, 7, 7, 6, 2, 0, 128, 128, 128, 128, 128, 128, 128, + 3, 7, 7, 6, 1, 0, 128, 64, 64, 32, 64, 64, 128, 5, 2, 2, + 6, 0, 2, 104, 144, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, + 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, + 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, + 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, + 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, + 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, + 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 6, 0, + 0, 1, 7, 7, 6, 2, 0, 128, 0, 128, 128, 128, 128, 128, 5, 7, + 7, 6, 0, 0, 32, 112, 168, 160, 168, 112, 32, 5, 7, 7, 6, 0, + 0, 48, 64, 64, 224, 64, 80, 168, 5, 5, 5, 6, 0, 0, 136, 112, + 80, 112, 136, 5, 7, 7, 6, 0, 0, 136, 80, 32, 248, 32, 248, 32, + 1, 7, 7, 6, 2, 0, 128, 128, 128, 0, 128, 128, 128, 5, 8, 8, + 6, 0, 0, 48, 72, 32, 80, 80, 32, 144, 96, 3, 1, 1, 6, 1, + 7, 160, 5, 7, 7, 6, 0, 0, 248, 136, 184, 184, 184, 136, 248, 5, + 7, 7, 6, 0, 1, 112, 8, 120, 136, 120, 0, 248, 5, 5, 5, 6, + 0, 1, 40, 80, 160, 80, 40, 5, 3, 3, 6, 0, 1, 248, 8, 8, + 2, 2, 2, 6, 2, 6, 64, 128, 5, 7, 7, 6, 0, 0, 248, 136, + 168, 136, 152, 168, 248, 5, 1, 1, 6, 0, 6, 248, 4, 4, 4, 6, + 0, 3, 96, 144, 144, 96, 5, 7, 7, 6, 0, 0, 32, 32, 248, 32, + 32, 0, 248, 4, 5, 5, 6, 0, 3, 96, 144, 32, 64, 240, 3, 5, + 5, 6, 0, 3, 224, 32, 224, 32, 224, 2, 2, 2, 6, 2, 6, 64, + 128, 5, 8, 8, 6, 0, 255, 136, 136, 136, 136, 152, 232, 128, 128, 5, + 7, 7, 6, 0, 0, 120, 152, 152, 120, 24, 24, 24, 2, 2, 2, 6, + 2, 2, 192, 192, 2, 2, 2, 6, 2, 255, 64, 128, 3, 5, 5, 6, + 0, 3, 64, 192, 64, 64, 224, 5, 7, 7, 6, 0, 1, 112, 136, 136, + 136, 112, 0, 248, 5, 5, 5, 6, 0, 1, 160, 80, 40, 80, 160, 5, + 7, 7, 6, 0, 0, 136, 144, 168, 88, 184, 8, 8, 5, 7, 7, 6, + 0, 0, 136, 144, 184, 72, 152, 32, 56, 5, 8, 8, 6, 0, 0, 192, + 64, 192, 72, 216, 56, 8, 8, 5, 7, 7, 6, 0, 0, 32, 0, 32, + 64, 128, 136, 112, 5, 8, 8, 6, 0, 0, 64, 32, 0, 112, 136, 248, + 136, 136, 5, 8, 8, 6, 0, 0, 16, 32, 0, 112, 136, 248, 136, 136, + 5, 8, 8, 6, 0, 0, 32, 80, 0, 112, 136, 248, 136, 136, 5, 8, + 8, 6, 0, 0, 104, 144, 0, 112, 136, 248, 136, 136, 5, 8, 8, 6, + 0, 0, 80, 0, 112, 136, 136, 248, 136, 136, 5, 8, 8, 6, 0, 0, + 32, 80, 32, 112, 136, 248, 136, 136, 5, 7, 7, 6, 0, 0, 56, 96, + 160, 184, 224, 160, 184, 5, 8, 8, 6, 0, 255, 112, 136, 128, 128, 136, + 112, 32, 96, 5, 8, 8, 6, 0, 0, 64, 32, 0, 248, 128, 240, 128, + 248, 5, 8, 8, 6, 0, 0, 8, 16, 0, 248, 128, 240, 128, 248, 5, + 8, 8, 6, 0, 0, 32, 80, 0, 248, 128, 240, 128, 248, 5, 7, 7, + 6, 0, 0, 80, 0, 248, 128, 240, 128, 248, 3, 8, 8, 6, 1, 0, + 128, 64, 0, 224, 64, 64, 64, 224, 3, 8, 8, 6, 1, 0, 32, 64, + 0, 224, 64, 64, 64, 224, 3, 8, 8, 6, 1, 0, 64, 160, 0, 224, + 64, 64, 64, 224, 3, 7, 7, 6, 1, 0, 160, 0, 224, 64, 64, 64, + 224, 5, 7, 7, 6, 0, 0, 112, 72, 72, 232, 72, 72, 112, 5, 8, + 8, 6, 0, 0, 104, 144, 0, 136, 200, 168, 152, 136, 5, 8, 8, 6, + 0, 0, 64, 32, 112, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, + 16, 32, 112, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 32, 80, + 0, 112, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 104, 144, 0, 112, + 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 80, 0, 112, 136, 136, 136, + 136, 112, 5, 5, 5, 6, 0, 1, 136, 80, 32, 80, 136, 5, 8, 8, + 6, 0, 255, 16, 112, 168, 168, 168, 168, 112, 64, 5, 8, 8, 6, 0, + 0, 64, 32, 136, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 16, + 32, 136, 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 32, 80, 0, + 136, 136, 136, 136, 112, 5, 8, 8, 6, 0, 0, 80, 0, 136, 136, 136, + 136, 136, 112, 5, 8, 8, 6, 0, 0, 16, 32, 136, 80, 32, 32, 32, + 32, 5, 9, 9, 6, 0, 255, 192, 64, 112, 72, 72, 112, 64, 64, 224, + 4, 8, 8, 6, 1, 255, 96, 144, 144, 160, 144, 144, 224, 128, 5, 8, + 8, 6, 0, 0, 64, 32, 0, 112, 8, 120, 136, 120, 5, 8, 8, 6, + 0, 0, 16, 32, 0, 112, 8, 120, 136, 120, 5, 8, 8, 6, 0, 0, + 32, 80, 0, 112, 8, 120, 136, 120, 5, 8, 8, 6, 0, 0, 104, 144, + 0, 112, 8, 120, 136, 120, 5, 7, 7, 6, 0, 0, 80, 0, 112, 8, + 120, 136, 120, 5, 8, 8, 6, 0, 0, 32, 80, 32, 112, 8, 120, 136, + 120, 5, 6, 6, 6, 0, 0, 208, 40, 120, 160, 168, 80, 5, 6, 6, + 6, 0, 255, 112, 128, 136, 112, 32, 96, 5, 8, 8, 6, 0, 0, 64, + 32, 0, 112, 136, 248, 128, 112, 5, 8, 8, 6, 0, 0, 16, 32, 0, + 112, 136, 248, 128, 112, 5, 8, 8, 6, 0, 0, 32, 80, 0, 112, 136, + 248, 128, 112, 5, 7, 7, 6, 0, 0, 80, 0, 112, 136, 248, 128, 112, + 3, 8, 8, 6, 1, 0, 128, 64, 0, 64, 192, 64, 64, 224, 3, 8, + 8, 6, 1, 0, 32, 64, 0, 64, 192, 64, 64, 224, 3, 8, 8, 6, + 1, 0, 64, 160, 0, 64, 192, 64, 64, 224, 3, 7, 7, 6, 1, 0, + 160, 0, 64, 192, 64, 64, 224, 5, 7, 7, 6, 0, 0, 160, 64, 160, + 16, 120, 136, 112, 5, 8, 8, 6, 0, 0, 104, 144, 0, 176, 200, 136, + 136, 136, 5, 8, 8, 6, 0, 0, 64, 32, 0, 112, 136, 136, 136, 112, + 5, 8, 8, 6, 0, 0, 16, 32, 0, 112, 136, 136, 136, 112, 5, 8, + 8, 6, 0, 0, 32, 80, 0, 112, 136, 136, 136, 112, 5, 8, 8, 6, + 0, 0, 104, 144, 0, 112, 136, 136, 136, 112, 5, 7, 7, 6, 0, 0, + 80, 0, 112, 136, 136, 136, 112, 5, 5, 5, 6, 0, 1, 32, 0, 248, + 0, 32, 5, 7, 7, 6, 0, 255, 16, 112, 168, 168, 168, 112, 64, 5, + 8, 8, 6, 0, 0, 64, 32, 0, 136, 136, 136, 152, 104, 5, 8, 8, + 6, 0, 0, 16, 32, 0, 136, 136, 136, 152, 104, 5, 8, 8, 6, 0, + 0, 32, 80, 0, 136, 136, 136, 152, 104, 5, 7, 7, 6, 0, 0, 80, + 0, 136, 136, 136, 152, 104, 5, 9, 9, 6, 0, 255, 16, 32, 0, 136, + 136, 136, 248, 8, 112, 4, 7, 7, 6, 1, 255, 192, 64, 96, 80, 96, + 64, 224, 5, 8, 8, 6, 0, 255, 80, 0, 136, 136, 136, 120, 8, 112 + }; + +#endif diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 3713433530..9c3b0b7711 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -615,7 +615,10 @@ #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("S UnRet mm") #endif #ifndef MSG_CONTROL_RETRACT_RECOVERF - #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") + #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") +#endif +#ifndef MSG_CONTROL_RETRACT_RECOVER_SWAPF + #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") #endif #ifndef MSG_AUTORETRACT #define MSG_AUTORETRACT _UxGT("AutoRetr.") diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index b98fc38643..fda68334a5 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -222,6 +222,7 @@ #define MSG_CONTROL_RETRACT_RECOVER _UxGT("UnRet mm") #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Ech. UnRet mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") +#define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("Ech. Retr. V") #define MSG_AUTORETRACT _UxGT("Retract. Auto.") #define MSG_FILAMENTCHANGE _UxGT("Changer filament") #define MSG_INIT_SDCARD _UxGT("Init. la carte SD") diff --git a/Marlin/src/lcd/language/language_fr_utf8.h b/Marlin/src/lcd/language/language_fr_utf8.h index d448cf917a..ab328950f0 100644 --- a/Marlin/src/lcd/language/language_fr_utf8.h +++ b/Marlin/src/lcd/language/language_fr_utf8.h @@ -27,8 +27,8 @@ * See also http://marlinfw.org/docs/development/lcd_language.html * */ -#ifndef LANGUAGE_FR_H -#define LANGUAGE_FR_H +#ifndef LANGUAGE_FR_UTF_H +#define LANGUAGE_FR_UTF_H #define MAPPER_C2C3 #define DISPLAY_CHARSET_ISO10646_1 @@ -341,4 +341,4 @@ #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Reprise...") #endif // LCD_HEIGHT < 4 -#endif // LANGUAGE_FR_H +#endif // LANGUAGE_FR_UTF_H diff --git a/Marlin/src/lcd/language/language_pl-DOGM.h b/Marlin/src/lcd/language/language_pl-DOGM.h index d93cfa454b..e712185c61 100644 --- a/Marlin/src/lcd/language/language_pl-DOGM.h +++ b/Marlin/src/lcd/language/language_pl-DOGM.h @@ -24,6 +24,9 @@ * Polish for DOGM display - includes accented characters */ +#ifndef LANGUAGE_PL_DOGM_H +#define LANGUAGE_PL_DOGM_H + #define WELCOME_MSG MACHINE_NAME _UxGT(" gotowy.") #define MSG_SD_INSERTED _UxGT("Karta włożona") #define MSG_SD_REMOVED _UxGT("Karta usunięta") @@ -40,6 +43,7 @@ #define MSG_LEVEL_BED_WAITING _UxGT("Kliknij by rozp.") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Następny punkt") #define MSG_LEVEL_BED_DONE _UxGT("Wypoziomowano!") +#define MSG_USER_MENU _UxGT("Własne Polecenia") #define MSG_SET_HOME_OFFSETS _UxGT("Ust. poz. zer.") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Poz. zerowa ust.") #define MSG_SET_ORIGIN _UxGT("Ustaw punkt zero") @@ -238,3 +242,5 @@ #define MSG_FILAMENT_CHANGE_EXTRUDE_1 _UxGT("Ekstruzja...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wznowienie...") #endif // LCD_HEIGHT < 4 + +#endif // LANGUAGE_PL_DOGM_H diff --git a/Marlin/src/lcd/language/language_pl-HD44780.h b/Marlin/src/lcd/language/language_pl-HD44780.h index 7c5ea08380..67ecaac6c0 100644 --- a/Marlin/src/lcd/language/language_pl-HD44780.h +++ b/Marlin/src/lcd/language/language_pl-HD44780.h @@ -24,6 +24,9 @@ * Polish for HD44780 display - no accented characters */ +#ifndef LANGUAGE_PL_HD44780_H +#define LANGUAGE_PL_HD44780_H + #define WELCOME_MSG MACHINE_NAME _UxGT(" gotowy.") #define MSG_SD_INSERTED _UxGT("Karta wlozona") #define MSG_SD_REMOVED _UxGT("Karta usunieta") @@ -40,6 +43,7 @@ #define MSG_LEVEL_BED_WAITING _UxGT("Kliknij by rozp.") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Nastepny punkt") #define MSG_LEVEL_BED_DONE _UxGT("Wypoziomowano!") +#define MSG_USER_MENU _UxGT("Wlasne Polecenia") #define MSG_SET_HOME_OFFSETS _UxGT("Ust. poz. zer.") #define MSG_HOME_OFFSETS_APPLIED _UxGT("Poz. zerowa ust.") #define MSG_SET_ORIGIN _UxGT("Ustaw punkt zero") @@ -263,3 +267,5 @@ #define MSG_FILAMENT_CHANGE_EXTRUDE_1 _UxGT("Ekstruzja...") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Wznowienie...") #endif // LCD_HEIGHT < 4 + +#endif // LANGUAGE_PL_HD44780_H diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index 37c6a61eca..a44b26ae56 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -3716,6 +3716,9 @@ void kill_screen(const char* lcd_msg) { MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT_RECOVER_SWAP, &fwretract.swap_retract_recover_length, -100, 100); #endif MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVERF, &fwretract.retract_recover_feedrate_mm_s, 1, 999); + #if EXTRUDERS > 1 + MENU_ITEM_EDIT(float3, MSG_CONTROL_RETRACT_RECOVER_SWAPF, &fwretract.swap_retract_recover_feedrate_mm_s, 1, 999); + #endif END_MENU(); } @@ -3742,10 +3745,25 @@ void kill_screen(const char* lcd_msg) { * "Print from SD" submenu * */ + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + uint32_t saved_encoderPosition = 0; + static millis_t assume_print_finished = 0; + #endif + void lcd_sdcard_menu() { ENCODER_DIRECTION_MENUS(); - if (!lcdDrawUpdate && !lcd_clicked) return; // nothing to do (so don't thrash the SD card) - const uint16_t fileCnt = card.get_num_Files(); + + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + if (ELAPSED(millis(), assume_print_finished)) { // if the printer has been busy printing, lcd_sdcard_menu() should not + lcdDrawUpdate = LCDVIEW_REDRAW_NOW; // have been active for 5 seconds. In this case, restore the previous + encoderPosition = saved_encoderPosition; // encoderPosition to the last selected item. + assume_print_finished = millis() + 5000; + } + saved_encoderPosition = encoderPosition; + defer_return_to_status = true; + #endif + + const uint16_t fileCnt = card.getnrfilenames(); START_MENU(); MENU_BACK(MSG_MAIN); card.getWorkDirName(); @@ -4395,6 +4413,9 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(SDSUPPORT) void menu_action_sdfile(const char* filename, char* longFilename) { + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + saved_encoderPosition = encoderPosition; // Save which file was selected for later use + #endif UNUSED(longFilename); card.openAndPrintFile(filename); lcd_return_to_status(); @@ -4702,7 +4723,11 @@ void lcd_update() { uint16_t bbr2 = planner.block_buffer_runtime() >> 1; #if ENABLED(DOGLCD) - if ((lcdDrawUpdate || drawing_screen) && (!bbr2 || (bbr2 > max_display_update_time))) + if ((lcdDrawUpdate || drawing_screen) && (!bbr2 || (bbr2 > max_display_update_time) + #if ENABLED(SDSUPPORT) + || (currentScreen == lcd_sdcard_menu) + #endif + )) #else if (lcdDrawUpdate && (!bbr2 || (bbr2 > max_display_update_time))) #endif @@ -4756,7 +4781,12 @@ void lcd_update() { // Return to Status Screen after a timeout if (currentScreen == lcd_status_screen || defer_return_to_status) + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + if (currentScreen != lcd_sdcard_menu) // lcd_sdcard_menu() does not time out if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; // When the printer finishes a file, it will wait with the file selected for + #else // a re-print. return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS; + #endif else if (ELAPSED(ms, return_to_status_ms)) lcd_return_to_status(); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index 36f4e4e9a0..1e157bbdf2 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -308,7 +308,7 @@ class Planner { return 1.0; } - FORCE_INLINE static bool leveling_active_at_z(const float &lz) { return true; } + FORCE_INLINE static bool leveling_active_at_z(const float &lz) { UNUSED(lz); return true; } #endif diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index eb856af2a7..22c9ad3d92 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -110,9 +110,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even #if ENABLED(LIN_ADVANCE) - constexpr HAL_TIMER_TYPE ADV_NEVER = HAL_TIMER_TYPE_MAX; + constexpr timer_t ADV_NEVER = HAL_TIMER_TYPE_MAX; - HAL_TIMER_TYPE Stepper::nextMainISR = 0, + timer_t Stepper::nextMainISR = 0, Stepper::nextAdvanceISR = ADV_NEVER, Stepper::eISR_Rate = ADV_NEVER; @@ -127,9 +127,9 @@ volatile uint32_t Stepper::step_events_completed = 0; // The number of step even * This fix isn't perfect and may lose steps - but better than locking up completely * in future the planner should slow down if advance stepping rate would be too high */ - FORCE_INLINE HAL_TIMER_TYPE adv_rate(const int steps, const HAL_TIMER_TYPE timer, const uint8_t loops) { + FORCE_INLINE timer_t adv_rate(const int steps, const timer_t timer, const uint8_t loops) { if (steps) { - const HAL_TIMER_TYPE rate = (timer * loops) / abs(steps); + const timer_t rate = (timer * loops) / abs(steps); //return constrain(rate, 1, ADV_NEVER - 1) return rate ? rate : 1; } @@ -147,9 +147,9 @@ volatile signed char Stepper::count_direction[NUM_AXIS] = { 1, 1, 1, 1 }; long Stepper::counter_m[MIXING_STEPPERS]; #endif -HAL_TIMER_TYPE Stepper::acc_step_rate; // needed for deceleration start point +timer_t Stepper::acc_step_rate; // needed for deceleration start point uint8_t Stepper::step_loops, Stepper::step_loops_nominal; -HAL_TIMER_TYPE Stepper::OCR1A_nominal; +timer_t Stepper::OCR1A_nominal; volatile long Stepper::endstops_trigsteps[XYZ]; @@ -313,7 +313,7 @@ HAL_STEP_TIMER_ISR { void Stepper::isr() { - HAL_TIMER_TYPE ocr_val; + timer_t ocr_val; #define ENDSTOP_NOMINAL_OCR_VAL 1500 * HAL_TICKS_PER_US // check endstops every 1.5ms to guarantee two stepper ISRs within 5ms for BLTouch #define OCR_VAL_TOLERANCE 500 * HAL_TICKS_PER_US // First max delay is 2.0ms, last min delay is 0.5ms, all others 1.5ms @@ -649,7 +649,7 @@ void Stepper::isr() { NOMORE(acc_step_rate, current_block->nominal_rate); // step_rate to timer interval - const HAL_TIMER_TYPE timer = calc_timer(acc_step_rate); + const timer_t timer = calc_timer(acc_step_rate); SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL _NEXT_ISR(ocr_val); @@ -671,7 +671,7 @@ void Stepper::isr() { #endif // LIN_ADVANCE } else if (step_events_completed > (uint32_t)current_block->decelerate_after) { - HAL_TIMER_TYPE step_rate; + timer_t step_rate; #ifdef CPU_32_BIT MultiU32X24toH32(step_rate, deceleration_time, current_block->acceleration_rate); #else @@ -686,7 +686,7 @@ void Stepper::isr() { step_rate = current_block->final_rate; // step_rate to timer interval - const HAL_TIMER_TYPE timer = calc_timer(step_rate); + const timer_t timer = calc_timer(step_rate); SPLIT(timer); // split step into multiple ISRs if larger than ENDSTOP_NOMINAL_OCR_VAL _NEXT_ISR(ocr_val); @@ -726,7 +726,7 @@ void Stepper::isr() { #if DISABLED(LIN_ADVANCE) #ifdef CPU_32_BIT // Make sure stepper interrupt does not monopolise CPU by adjusting count to give about 8 us room - HAL_TIMER_TYPE stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM), + timer_t stepper_timer_count = HAL_timer_get_count(STEP_TIMER_NUM), stepper_timer_current_count = HAL_timer_get_current_count(STEP_TIMER_NUM) + 8 * HAL_TICKS_PER_US; HAL_timer_set_count(STEP_TIMER_NUM, max(stepper_timer_count, stepper_timer_current_count)); #else diff --git a/Marlin/src/module/stepper.h b/Marlin/src/module/stepper.h index 6ea5517364..aa11ef929b 100644 --- a/Marlin/src/module/stepper.h +++ b/Marlin/src/module/stepper.h @@ -91,7 +91,7 @@ class Stepper { static volatile uint32_t step_events_completed; // The number of step events executed in the current block #if ENABLED(LIN_ADVANCE) - static HAL_TIMER_TYPE nextMainISR, nextAdvanceISR, eISR_Rate; + static timer_t nextMainISR, nextAdvanceISR, eISR_Rate; #define _NEXT_ISR(T) nextMainISR = T static volatile int e_steps[E_STEPPERS]; @@ -106,9 +106,9 @@ class Stepper { static long acceleration_time, deceleration_time; //unsigned long accelerate_until, decelerate_after, acceleration_rate, initial_rate, final_rate, nominal_rate; - static HAL_TIMER_TYPE acc_step_rate; // needed for deceleration start point + static timer_t acc_step_rate; // needed for deceleration start point static uint8_t step_loops, step_loops_nominal; - static HAL_TIMER_TYPE OCR1A_nominal; + static timer_t OCR1A_nominal; static volatile long endstops_trigsteps[XYZ]; static volatile long endstops_stepsTotal, endstops_stepsDone; @@ -259,8 +259,8 @@ class Stepper { private: - static FORCE_INLINE HAL_TIMER_TYPE calc_timer(HAL_TIMER_TYPE step_rate) { - HAL_TIMER_TYPE timer; + static FORCE_INLINE timer_t calc_timer(timer_t step_rate) { + timer_t timer; NOMORE(step_rate, MAX_STEP_FREQUENCY); diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 09a0d4e817..fd7285ca9e 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -665,7 +665,11 @@ #define _Z2_PINS Z2_STEP_PIN, Z2_DIR_PIN, Z2_ENABLE_PIN, #endif -#define SENSITIVE_PINS { 0, 1, \ +#ifndef HAL_SENSITIVE_PINS +#define HAL_SENSITIVE_PINS +#endif + +#define SENSITIVE_PINS { \ X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \ Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PIN, Y_MAX_PIN, \ Z_STEP_PIN, Z_DIR_PIN, Z_ENABLE_PIN, Z_MIN_PIN, Z_MAX_PIN, Z_MIN_PROBE_PIN, \ @@ -673,7 +677,8 @@ _E0_PINS _E1_PINS _E2_PINS _E3_PINS _E4_PINS BED_PINS \ _H0_PINS _H1_PINS _H2_PINS _H3_PINS _H4_PINS \ _X2_PINS _Y2_PINS _Z2_PINS \ - X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN \ + X_MS1_PIN, X_MS2_PIN, Y_MS1_PIN, Y_MS2_PIN, Z_MS1_PIN, Z_MS2_PIN, \ + HAL_SENSITIVE_PINS \ } #define HAS_DIGIPOTSS (PIN_EXISTS(DIGIPOTSS)) diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 8957077903..037e79ddfb 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -68,7 +68,7 @@ typedef struct { const char * const name; - uint8_t pin; + pin_t pin; bool is_digital; } PinInfo; @@ -109,18 +109,18 @@ static void print_input_or_output(const bool isout) { // pretty report with PWM info -inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = false, const char *start_string = "") { +inline void report_pin_state_extended(pin_t pin, bool ignore, bool extended = false, const char *start_string = "") { char buffer[30]; // for the sprintf statements bool found = false, multi_name_pin = false; for (uint8_t x = 0; x < COUNT(pin_array); x++) { // scan entire array and report all instances of this pin if (GET_ARRAY_PIN(x) == pin) { - GET_PIN_INFO(pin); if (found) multi_name_pin = true; found = true; if (!multi_name_pin) { // report digitial and analog pin number only on the first time through - sprintf_P(buffer, PSTR("%sPIN: %3d "), start_string, pin); // digital pin number + sprintf_P(buffer, PSTR("%sPIN: "), start_string); // digital pin number SERIAL_ECHO(buffer); + PRINT_PIN(pin); PRINT_PORT(pin); if (IS_ANALOG(pin)) { sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); // analog pin number @@ -180,8 +180,9 @@ inline void report_pin_state_extended(int8_t pin, bool ignore, bool extended = f } // end of for loop if (!found) { - sprintf_P(buffer, PSTR("%sPIN: %3d "), start_string, pin); + sprintf_P(buffer, PSTR("%sPIN: "), start_string); SERIAL_ECHO(buffer); + PRINT_PIN(pin); PRINT_PORT(pin); if (IS_ANALOG(pin)) { sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); // analog pin number diff --git a/Marlin/src/pins/pins_AZSMZ_MINI.h b/Marlin/src/pins/pins_AZSMZ_MINI.h index 39dedd8f4a..60c3676f6c 100644 --- a/Marlin/src/pins/pins_AZSMZ_MINI.h +++ b/Marlin/src/pins/pins_AZSMZ_MINI.h @@ -39,7 +39,7 @@ // Servos // #define SERVO0_PIN 53 - + // // Limit Switches // diff --git a/Marlin/src/pins/pins_MKS_SBASE.h b/Marlin/src/pins/pins_MKS_SBASE.h index 1d576f4acc..5da1bf2ac0 100644 --- a/Marlin/src/pins/pins_MKS_SBASE.h +++ b/Marlin/src/pins/pins_MKS_SBASE.h @@ -25,9 +25,8 @@ * MKS SBASE pin assignments */ -//#if !defined(TARGET_LPC1768) -#if DISABLED(IS_REARM) - #error "Oops! Make sure you have Re-Arm selected." +#ifndef TARGET_LPC1768 + #error "Oops! Make sure you have LPC1768 selected." #endif #ifndef BOARD_NAME @@ -39,46 +38,42 @@ // unused /* -#define D57 57 -#define D58 58 +#define PIN_P0_27 P0_27 +#define PIN_P0_28 P0_28 */ // // Limit Switches // -#define X_MIN_PIN 3 //10k pullup to 3.3V, 1K series -#define X_MAX_PIN 2 //10k pullup to 3.3V, 1K series -#define Y_MIN_PIN 14 //10k pullup to 3.3V, 1K series -#define Y_MAX_PIN 15 //10k pullup to 3.3V, 1K series -#define Z_MIN_PIN 19 //The original Mks Sbase DIO19 has a 10k pullup to 3.3V or 5V, 1K series, so when using a Zprobe we must use DIO41 (J8 P1.22) -#define Z_MAX_PIN 18 //10k pullup to 3.3V, 1K series +#define X_MIN_PIN P1_24 //10k pullup to 3.3V, 1K series +#define X_MAX_PIN P1_25 //10k pullup to 3.3V, 1K series +#define Y_MIN_PIN P1_26 //10k pullup to 3.3V, 1K series +#define Y_MAX_PIN P1_27 //10k pullup to 3.3V, 1K series +#define Z_MIN_PIN P1_28 //The original Mks Sbase DIO19 has a 10k pullup to 3.3V or 5V, 1K series, so when using a Zprobe we must use DIO41 (J8 P1.22) +#define Z_MAX_PIN P1_29 //10k pullup to 3.3V, 1K series // // Steppers // -#define X_STEP_PIN 26 -#define X_DIR_PIN 28 -#define X_ENABLE_PIN 24 +#define X_STEP_PIN P2_0 +#define X_DIR_PIN P0_5 +#define X_ENABLE_PIN P0_4 -#define Y_STEP_PIN 54 -#define Y_DIR_PIN 55 -#define Y_ENABLE_PIN 38 +#define Y_STEP_PIN P2_1 +#define Y_DIR_PIN P0_11 +#define Y_ENABLE_PIN P0_10 -#define Z_STEP_PIN 60 -#define Z_DIR_PIN 61 -#define Z_ENABLE_PIN 56 +#define Z_STEP_PIN P2_2 +#define Z_DIR_PIN P0_20 +#define Z_ENABLE_PIN P0_19 -#define E0_STEP_PIN 46 -#define E0_DIR_PIN 48 -#define E0_ENABLE_PIN 62 +#define E0_STEP_PIN P2_3 +#define E0_DIR_PIN P0_22 +#define E0_ENABLE_PIN P0_21 -#define E1_STEP_PIN 36 -#define E1_DIR_PIN 34 -#define E1_ENABLE_PIN 30 - -#define X2_STEP_PIN 36 -#define X2_DIR_PIN 34 -#define X2_ENABLE_PIN 30 +#define E1_STEP_PIN P2_8 +#define E1_DIR_PIN P2_13 +#define E1_ENABLE_PIN P4_29 // // Temperature Sensors @@ -95,13 +90,13 @@ // Heaters / Fans // -#define HEATER_BED_PIN 10 -#define HEATER_0_PIN 8 -#define HEATER_1_PIN 59 -#define FAN_PIN 9 +#define HEATER_BED_PIN P2_5 +#define HEATER_0_PIN P2_7 +#define HEATER_1_PIN P2_6 +#define FAN_PIN P2_4 -#define PS_ON_PIN 69 +#define PS_ON_PIN P0_25 // @@ -111,9 +106,9 @@ // 5V // NC // GND -#define PIN_P0_17 50 -#define PIN_P0_16 16 -#define PIN_P0_14 80 +#define PIN_P0_17 P0_17 +#define PIN_P0_16 P0_16 +#define PIN_P0_14 P0_14 // @@ -121,19 +116,21 @@ // // GND -#define PIN_P1_22 41 -#define PIN_P1_23 53 -#define PIN_P2_12 12 -#define PIN_P2_11 35 -#define PIN_P4_28 13 +#define PIN_P1_22 P1_22 +#define PIN_P1_23 P1_23 +#define PIN_P2_12 P2_12 +#define PIN_P2_11 P2_11 +#define PIN_P4_28 P4_28 // // Prusa i3 MK2 Multi Material Multiplexer Support // -#define E_MUX0_PIN 50 // J7-4 -#define E_MUX1_PIN 16 // J7-5 -#define E_MUX2_PIN 80 // J7-6 +#if ENABLED(MK2_MULTIPLEXER) + #define E_MUX0_PIN P0_17 // J7-4 + #define E_MUX1_PIN P0_16 // J7-5 + #define E_MUX2_PIN P0_15 // J7-6 +#endif /** @@ -150,32 +147,32 @@ */ #if ENABLED(ULTRA_LCD) - #define BEEPER_PIN 49 // EXP1.1 - #define BTN_ENC 37 // EXP1.2 - #define BTN_EN1 31 // EXP2.5 - #define BTN_EN2 33 // EXP2.3 - #define SD_DETECT_PIN 57 // EXP2.7 - #define LCD_PINS_RS 16 // EXP1.4 - #define LCD_SDSS 58 // EXP2.4 - #define LCD_PINS_ENABLE 51 // EXP1.3 - #define LCD_PINS_D4 80 // EXP1.5 + #define BEEPER_PIN P1_31 // EXP1.1 + #define BTN_ENC P1_30 // EXP1.2 + #define BTN_EN1 P3_26 // EXP2.5 + #define BTN_EN2 P3_25 // EXP2.3 + #define SD_DETECT_PIN P0_27 // EXP2.7 + #define LCD_PINS_RS P0_16 // EXP1.4 + #define LCD_SDSS P0_28 // EXP2.4 + #define LCD_PINS_ENABLE P0_18 // EXP1.3 + #define LCD_PINS_D4 P0_14 // EXP1.5 #endif // ULTRA_LCD // // Ethernet pins // #ifndef ULTIPANEL - #define ENET_MDIO 71 // J12-4 - #define ENET_RX_ER 73 // J12-6 - #define ENET_RXD1 75 // J12-8 + #define ENET_MDIO P1_17 // J12-4 + #define ENET_RX_ER P1_14 // J12-6 + #define ENET_RXD1 P1_10 // J12-8 #endif -#define ENET_MOC 70 // J12-3 -#define REF_CLK 72 // J12-5 -#define ENET_RXD0 74 // J12-7 -#define ENET_CRS 76 // J12-9 -#define ENET_TX_EN 77 // J12-10 -#define ENET_TXD0 78 // J12-11 -#define ENET_TXD1 79 // J12-12 +#define ENET_MOC P1_16 // J12-3 +#define REF_CLK P1_15 // J12-5 +#define ENET_RXD0 P1_9 // J12-7 +#define ENET_CRS P1_8 // J12-9 +#define ENET_TX_EN P1_4 // J12-10 +#define ENET_TXD0 P1_0 // J12-11 +#define ENET_TXD1 P1_1 // J12-12 /** * PWMs @@ -184,25 +181,25 @@ * * SERVO2 does NOT have a PWM assigned to it. * - * PWM1.1 DIO4 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM - * PWM1.1 DIO26 E0_STEP_PIN - * PWM1.2 DIO11 SERVO0_PIN - * PWM1.2 DIO54 X_STEP_PIN - * PWM1.3 DIO6 SERVO1_PIN J5-1 - * PWM1.3 DIO60 Y_STEP_PIN - * PWM1.4 DIO53 SDSS(SSEL0) J3-5 AUX-3 - * PWM1.4 DIO46 Z_STEP_PIN - * PWM1.5 DIO3 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.5 DIO9 RAMPS_D9_PIN - * PWM1.6 DIO14 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.6 DIO10 RAMPS_D10_PIN + * PWM1.1 P1_18 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM + * PWM1.1 P2_0 E0_STEP_PIN + * PWM1.2 P1_20 SERVO0_PIN + * PWM1.2 P2_1 X_STEP_PIN + * PWM1.3 P1_21 SERVO1_PIN J5-1 + * PWM1.3 P2_2 Y_STEP_PIN + * PWM1.4 P1_23 SDSS(SSEL0) J3-5 AUX-3 + * PWM1.4 P2_3 Z_STEP_PIN + * PWM1.5 P1_24 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES + * PWM1.5 P2_4 RAMPS_D9_PIN + * PWM1.6 P1_26 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES + * PWM1.6 P2_5 RAMPS_D10_PIN */ /** * Special pins - * D37 - not 5V tolerant - * D49 - not 5V tolerant - * D57 - open collector - * D58 - open collector + * P1_30 - not 5V tolerant + * P1_31 - not 5V tolerant + * P0_27 - open collector + * P0_28 - open collector * */ diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index 5b83176f4b..168dcbd8cb 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -44,7 +44,7 @@ * 7 | 11 */ -#if ENABLED(IS_REARM) +#if ENABLED(TARGET_LPC1768) #error "Oops! Use 'BOARD_RAMPS_RE_ARM' to build for Re-ARM." #endif diff --git a/Marlin/src/pins/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/pins_RAMPS_RE_ARM.h index 80cb0abaf0..992f9b3879 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -34,9 +34,8 @@ * */ -//#if !defined(TARGET_LPC1768) -#if DISABLED(IS_REARM) - #error "Oops! Make sure you have Re-Arm selected." +#ifndef TARGET_LPC1768 + #error "Oops! Make sure you have LPC1768 selected." #endif #ifndef BOARD_NAME @@ -45,56 +44,50 @@ #define LARGE_FLASH true -// unused -#define D57 57 -#define D58 58 - // // Servos // -#define SERVO0_PIN 11 -#define SERVO1_PIN 6 // also on J5-1 -#define SERVO2_PIN 5 -#define SERVO3_PIN 4 // 5V output - PWM capable +#define SERVO0_PIN P1_20 +#define SERVO1_PIN P1_21 // also on J5-1 +#define SERVO2_PIN P1_19 +#define SERVO3_PIN P1_18 // 5V output - PWM capable // // Limit Switches // -#define X_MIN_PIN 3 //10k pullup to 3.3V, 1K series -#define X_MAX_PIN 2 //10k pullup to 3.3V, 1K series -#define Y_MIN_PIN 14 //10k pullup to 3.3V, 1K series -#define Y_MAX_PIN 15 //10k pullup to 3.3V, 1K series -#define Z_MIN_PIN 18 //10k pullup to 3.3V, 1K series -#define Z_MAX_PIN 19 //10k pullup to 3.3V, 1K series -//#define Z_PROBE_PIN 1 // AUX-1 - +#define X_MIN_PIN P1_24 //10k pullup to 3.3V, 1K series +#define X_MAX_PIN P1_25 //10k pullup to 3.3V, 1K series +#define Y_MIN_PIN P1_26 //10k pullup to 3.3V, 1K series +#define Y_MAX_PIN P1_27 //10k pullup to 3.3V, 1K series +#define Z_MIN_PIN P1_29 //10k pullup to 3.3V, 1K series +#define Z_MAX_PIN P1_28 //10k pullup to 3.3V, 1K series // // Steppers // -#define X_STEP_PIN 54 -#define X_DIR_PIN 55 -#define X_ENABLE_PIN 38 +#define X_STEP_PIN P2_1 +#define X_DIR_PIN P0_11 +#define X_ENABLE_PIN P0_10 -#define Y_STEP_PIN 60 -#define Y_DIR_PIN 61 -#define Y_ENABLE_PIN 56 +#define Y_STEP_PIN P2_2 +#define Y_DIR_PIN P0_20 +#define Y_ENABLE_PIN P0_19 -#define Z_STEP_PIN 46 -#define Z_DIR_PIN 48 -#define Z_ENABLE_PIN 62 +#define Z_STEP_PIN P2_3 +#define Z_DIR_PIN P0_22 +#define Z_ENABLE_PIN P0_21 -#define E0_STEP_PIN 26 -#define E0_DIR_PIN 28 -#define E0_ENABLE_PIN 24 +#define E0_STEP_PIN P2_0 +#define E0_DIR_PIN P0_5 +#define E0_ENABLE_PIN P0_4 -#define E1_STEP_PIN 36 -#define E1_DIR_PIN 34 -#define E1_ENABLE_PIN 30 +#define E1_STEP_PIN P2_8 +#define E1_DIR_PIN P2_13 +#define E1_ENABLE_PIN P4_29 -#define E2_STEP_PIN 36 -#define E2_DIR_PIN 34 -#define E2_ENABLE_PIN 30 +#define E2_STEP_PIN P2_8 +#define E2_DIR_PIN P2_13 +#define E2_ENABLE_PIN P4_29 // // Temperature Sensors @@ -131,16 +124,16 @@ // Heaters / Fans // #ifndef MOSFET_D_PIN - #define MOSFET_D_PIN -1 + #define MOSFET_D_PIN -1 #endif #ifndef RAMPS_D8_PIN - #define RAMPS_D8_PIN 8 + #define RAMPS_D8_PIN P2_8 #endif #ifndef RAMPS_D9_PIN - #define RAMPS_D9_PIN 9 + #define RAMPS_D9_PIN P2_4 #endif #ifndef RAMPS_D10_PIN - #define RAMPS_D10_PIN 10 + #define RAMPS_D10_PIN P2_5 #endif #define HEATER_0_PIN RAMPS_D10_PIN @@ -170,22 +163,22 @@ #endif #ifndef FAN_PIN - #define FAN_PIN 4 // IO pin. Buffer needed + #define FAN_PIN P1_18 // IO pin. Buffer needed #endif // // Misc. Functions // -#define LED_PIN 13 +#define LED_PIN P4_28 // define digital pin 4 for the filament runout sensor. Use the RAMPS 1.4 digital input 4 on the servos connector -#define FIL_RUNOUT_PIN 4 +#define FIL_RUNOUT_PIN P1_18 -#define PS_ON_PIN 12 +#define PS_ON_PIN P2_12 #if ENABLED(CASE_LIGHT_ENABLE) && !PIN_EXISTS(CASE_LIGHT) && !defined(SPINDLE_LASER_ENABLE_PIN) #if !defined(NUM_SERVOS) || NUM_SERVOS < 4 // try to use servo connector - #define CASE_LIGHT_PIN 4 // MUST BE HARDWARE PWM + #define CASE_LIGHT_PIN P1_18 // MUST BE HARDWARE PWM #endif #endif @@ -197,17 +190,17 @@ #undef SERVO1 #undef SERVO2 #undef SERVO3 - #define SPINDLE_LASER_ENABLE_PIN 6 // Pin should have a pullup/pulldown! - #define SPINDLE_LASER_PWM_PIN 4 // MUST BE HARDWARE PWM - #define SPINDLE_DIR_PIN 5 + #define SPINDLE_LASER_ENABLE_PIN P1_21 // Pin should have a pullup/pulldown! + #define SPINDLE_LASER_PWM_PIN P1_18 // MUST BE HARDWARE PWM + #define SPINDLE_DIR_PIN P1_19 #endif #endif // // Průša i3 MK2 Multiplexer Support // -#define E_MUX0_PIN 0 // Z_CS_PIN -#define E_MUX1_PIN 1 // E0_CS_PIN -#define E_MUX2_PIN 63 // E1_CS_PIN +#define E_MUX0_PIN P0_3 // Z_CS_PIN +#define E_MUX1_PIN P0_2 // E0_CS_PIN +#define E_MUX2_PIN P0_26 // E1_CS_PIN /** * LCD / Controller @@ -230,89 +223,76 @@ #if ENABLED(ULTRA_LCD) - #define BEEPER_PIN 37 // not 5V tolerant + #define BEEPER_PIN P1_30 // not 5V tolerant - #define BTN_EN1 31 // J3-2 & AUX-4 - #define BTN_EN2 33 // J3-4 & AUX-4 - #define BTN_ENC 35 // J3-3 & AUX-4 + #define BTN_EN1 P3_26 // J3-2 & AUX-4 + #define BTN_EN2 P3_25 // J3-4 & AUX-4 + #define BTN_ENC P2_11 // J3-3 & AUX-4 - #define SD_DETECT_PIN 49 // not 5V tolerant J3-1 & AUX-3 - #define KILL_PIN 41 // J5-4 & AUX-4 - #define LCD_PINS_RS 16 // J3-7 & AUX-4 - #define LCD_SDSS 16 // J3-7 & AUX-4 - #define LCD_BACKLIGHT_PIN 16 // J3-7 & AUX-4 - only used on DOGLCD controllers - #define LCD_PINS_ENABLE 51 // (MOSI) J3-10 & AUX-3 - #define LCD_PINS_D4 52 // (SCK) J3-9 & AUX-3 + #define SD_DETECT_PIN P1_31 // not 5V tolerant J3-1 & AUX-3 + #define KILL_PIN P1_22 // J5-4 & AUX-4 + #define LCD_PINS_RS P0_16 // J3-7 & AUX-4 + #define LCD_SDSS P0_16 // J3-7 & AUX-4 + #define LCD_BACKLIGHT_PIN P0_16 // J3-7 & AUX-4 - only used on DOGLCD controllers + #define LCD_PINS_ENABLE P0_18 // (MOSI) J3-10 & AUX-3 + #define LCD_PINS_D4 P0_15 // (SCK) J3-9 & AUX-3 - #define DOGLCD_A0 59 // J3-8 & AUX-2 - #define DOGLCD_CS 63 // J5-3 & AUX-2 + #define DOGLCD_A0 P2_6 // J3-8 & AUX-2 + #define DOGLCD_CS P0_26 // J5-3 & AUX-2 #ifdef ULTIPANEL - #define LCD_PINS_D5 71 // ENET_MDIO - #define LCD_PINS_D6 73 // ENET_RX_ER - #define LCD_PINS_D7 75 // ENET_RXD1 + #define LCD_PINS_D5 P1_17 // ENET_MDIO + #define LCD_PINS_D6 P1_14 // ENET_RX_ER + #define LCD_PINS_D7 P1_10 // ENET_RXD1 #endif #if ENABLED(NEWPANEL) #if ENABLED(REPRAPWORLD_KEYPAD) - #define SHIFT_OUT 51 // (MOSI) J3-10 & AUX-3 - #define SHIFT_CLK 52 // (SCK) J3-9 & AUX-3 - #define SHIFT_LD 49 // not 5V tolerant J3-1 & AUX-3 + #define SHIFT_OUT P0_18 // (MOSI) J3-10 & AUX-3 + #define SHIFT_CLK P0_15 // (SCK) J3-9 & AUX-3 + #define SHIFT_LD P1_31 // not 5V tolerant J3-1 & AUX-3 #endif #else - //#define SHIFT_CLK 31 // J3-2 & AUX-4 - //#define SHIFT_LD 33 // J3-4 & AUX-4 - //#define SHIFT_OUT 35 // J3-3 & AUX-4 - //#define SHIFT_EN 41 // J5-4 & AUX-4 + //#define SHIFT_CLK P3_26 // J3-2 & AUX-4 + //#define SHIFT_LD P3_25 // J3-4 & AUX-4 + //#define SHIFT_OUT P2_11 // J3-3 & AUX-4 + //#define SHIFT_EN P1_22 // J5-4 & AUX-4 #endif - #define SDCARD_SORT_ALPHA // Using SORT feature to keep one directory level in RAM - // When going up/down directory levels the SD card is - // accessed but the garbage/lines are removed when the - // LCD updates - - #define SDSORT_LIMIT 256 // Maximum number of sorted items (10-256). Costs 27 bytes each. - #define FOLDER_SORTING -1 // -1=above 0=none 1=below - #define SDSORT_GCODE false // Allow turning sorting on/off with LCD and M34 g-code. - #define SDSORT_USES_RAM true // Pre-allocate a static array for faster pre-sorting. - #define SDSORT_USES_STACK false // Prefer the stack for pre-sorting to give back some SRAM. (Negated by next 2 options.) - #define SDSORT_CACHE_NAMES true // Keep sorted items in RAM longer for speedy performance. Most expensive option. - #define SDSORT_DYNAMIC_RAM false // Use dynamic allocation (within SD menus). Least expensive option. Set SDSORT_LIMIT before use! - #if ENABLED(VIKI2) || ENABLED(miniVIKI) // #define LCD_SCREEN_ROT_180 #undef BEEPER_PIN - #define BEEPER_PIN 37 // may change if cable changes + #define BEEPER_PIN P1_30 // may change if cable changes - #define BTN_EN1 31 // J3-2 & AUX-4 - #define BTN_EN2 33 // J3-4 & AUX-4 - #define BTN_ENC 35 // J3-3 & AUX-4 + #define BTN_EN1 P3_26 // J3-2 & AUX-4 + #define BTN_EN2 P3_25 // J3-4 & AUX-4 + #define BTN_ENC P2_11 // J3-3 & AUX-4 - #define SD_DETECT_PIN 49 // not 5V tolerant J3-1 & AUX-3 - #define KILL_PIN 41 // J5-4 & AUX-4 + #define SD_DETECT_PIN P1_31 // not 5V tolerant J3-1 & AUX-3 + #define KILL_PIN P1_22 // J5-4 & AUX-4 #undef DOGLCD_CS - #define DOGLCD_CS 16 - #undef LCD_BACKLIGHT_PIN //16 // J3-7 & AUX-4 - only used on DOGLCD controllers - #undef LCD_PINS_ENABLE //51 // (MOSI) J3-10 & AUX-3 - #undef LCD_PINS_D4 //52 // (SCK) J3-9 & AUX-3 + #define DOGLCD_CS P0_16 + #undef LCD_BACKLIGHT_PIN //P0_16 // J3-7 & AUX-4 - only used on DOGLCD controllers + #undef LCD_PINS_ENABLE //P0_18 // (MOSI) J3-10 & AUX-3 + #undef LCD_PINS_D4 //P0_15 // (SCK) J3-9 & AUX-3 - #undef LCD_PINS_D5 //59 // J3-8 & AUX-2 - #define DOGLCD_A0 59 // J3-8 & AUX-2 - #undef LCD_PINS_D6 //63 // J5-3 & AUX-2 - #undef LCD_PINS_D7 // 6 // (SERVO1) J5-1 & SERVO connector - #define DOGLCD_SCK SCK_PIN - #define DOGLCD_MOSI MOSI_PIN + #undef LCD_PINS_D5 //P2_6 // J3-8 & AUX-2 + #define DOGLCD_A0 P2_6 // J3-8 & AUX-2 + #undef LCD_PINS_D6 //P0_26 // J5-3 & AUX-2 + #undef LCD_PINS_D7 //P1_21 // (SERVO1) J5-1 & SERVO connector + #define DOGLCD_SCK SCK_PIN + #define DOGLCD_MOSI MOSI_PIN - #define STAT_LED_BLUE_PIN 63 // may change if cable changes - #define STAT_LED_RED_PIN 6 // may change if cable changes + #define STAT_LED_BLUE_PIN P0_26 // may change if cable changes + #define STAT_LED_RED_PIN P1_21 // may change if cable changes #endif - //#define MISO_PIN 50 // system defined J3-10 & AUX-3 - //#define MOSI_PIN 51 // system defined J3-10 & AUX-3 - //#define SCK_PIN 52 // system defined J3-9 & AUX-3 - //#define SS_PIN 53 // system defined J3-5 & AUX-3 - sometimes called SDSS + //#define MISO_PIN P0_17 // system defined J3-10 & AUX-3 + //#define MOSI_PIN P0_18 // system defined J3-10 & AUX-3 + //#define SCK_PIN P0_15 // system defined J3-9 & AUX-3 + //#define SS_PIN P1_23 // system defined J3-5 & AUX-3 - sometimes called SDSS #if ENABLED(MINIPANEL) // GLCD features @@ -329,17 +309,17 @@ // Ethernet pins // #ifndef ULTIPANEL - #define ENET_MDIO 71 // J12-4 - #define ENET_RX_ER 73 // J12-6 - #define ENET_RXD1 75 // J12-8 + #define ENET_MDIO P1_17 // J12-4 + #define ENET_RX_ER P1_14 // J12-6 + #define ENET_RXD1 P1_10 // J12-8 #endif -#define ENET_MOC 70 // J12-3 -#define REF_CLK 72 // J12-5 -#define ENET_RXD0 74 // J12-7 -#define ENET_CRS 76 // J12-9 -#define ENET_TX_EN 77 // J12-10 -#define ENET_TXD0 78 // J12-11 -#define ENET_TXD1 79 // J12-12 +#define ENET_MOC P1_16 // J12-3 +#define REF_CLK P1_15 // J12-5 +#define ENET_RXD0 P1_9 // J12-7 +#define ENET_CRS P1_8 // J12-9 +#define ENET_TX_EN P1_4 // J12-10 +#define ENET_TXD0 P1_0 // J12-11 +#define ENET_TXD1 P1_1 // J12-12 /** * PWMS @@ -348,47 +328,25 @@ * * SERVO2 does NOT have a PWM assigned to it. * - * PWM1.1 DIO4 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM - * PWM1.1 DIO26 E0_STEP_PIN - * PWM1.2 DIO11 SERVO0_PIN - * PWM1.2 DIO54 X_STEP_PIN - * PWM1.3 DIO6 SERVO1_PIN J5-1 - * PWM1.3 DIO60 Y_STEP_PIN - * PWM1.4 DIO53 SDSS(SSEL0) J3-5 AUX-3 - * PWM1.4 DIO46 Z_STEP_PIN - * PWM1.5 DIO3 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.5 DIO9 RAMPS_D9_PIN - * PWM1.6 DIO14 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES - * PWM1.6 DIO10 RAMPS_D10_PIN - */ - -/** - * The following pins are NOT available in a Re-ARM system - * 7 - * 17 - * 22 - * 23 - * 25 - * 27 - * 29 - * 32 - * 39 - * 40 - * 42 - * 43 - * 44 - * 45 - * 47 - * 64 - * 65 - * 66 + * PWM1.1 P0_18 SERVO3_PIN FIL_RUNOUT_PIN 5V output, PWM + * PWM1.1 P2_0 E0_STEP_PIN + * PWM1.2 P1_20 SERVO0_PIN + * PWM1.2 P2_1 X_STEP_PIN + * PWM1.3 P1_21 SERVO1_PIN J5-1 + * PWM1.3 P2_2 Y_STEP_PIN + * PWM1.4 P1_23 SDSS(SSEL0) J3-5 AUX-3 + * PWM1.4 P2_3 Z_STEP_PIN + * PWM1.5 P1_24 X_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES + * PWM1.5 P2_4 RAMPS_D9_PIN + * PWM1.6 P1_26 Y_MIN_PIN 10K PULLUP TO 3.3v, 1K SERIES + * PWM1.6 P2_5 RAMPS_D10_PIN */ /** * special pins - * D37 - not 5V tolerant - * D49 - not 5V tolerant - * D57 - open collector - * D58 - open collector + * P1_30 - not 5V tolerant + * P1_31 - not 5V tolerant + * P0_27 - open collector + * P0_28 - open collector * */ diff --git a/Marlin/src/sd/Sd2Card.cpp b/Marlin/src/sd/Sd2Card.cpp index 4107eaf2bc..d0e807f82f 100644 --- a/Marlin/src/sd/Sd2Card.cpp +++ b/Marlin/src/sd/Sd2Card.cpp @@ -170,7 +170,7 @@ bool Sd2Card::eraseSingleBlockEnable() { * the value zero, false, is returned for failure. The reason for failure * can be determined by calling errorCode() and errorData(). */ -bool Sd2Card::init(uint8_t sckRateID, uint8_t chipSelectPin) { +bool Sd2Card::init(uint8_t sckRateID, pin_t chipSelectPin) { errorCode_ = type_ = 0; chipSelectPin_ = chipSelectPin; // 16-bit init start time allows over a minute diff --git a/Marlin/src/sd/Sd2Card.h b/Marlin/src/sd/Sd2Card.h index a038f99a6d..5aaffe72f4 100644 --- a/Marlin/src/sd/Sd2Card.h +++ b/Marlin/src/sd/Sd2Card.h @@ -181,7 +181,7 @@ class Sd2Card { * \return true for success or false for failure. */ bool init(uint8_t sckRateID = SPI_FULL_SPEED, - uint8_t chipSelectPin = SD_CHIP_SELECT_PIN); + pin_t chipSelectPin = SD_CHIP_SELECT_PIN); bool readBlock(uint32_t block, uint8_t* dst); /** * Read a card's CID register. The CID contains card identification @@ -220,7 +220,7 @@ class Sd2Card { bool writeStop(); private: //---------------------------------------------------------------------------- - uint8_t chipSelectPin_; + pin_t chipSelectPin_; uint8_t errorCode_; uint8_t spiRate_; uint8_t status_; diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index cfa7b513f5..3afb050b25 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -892,6 +892,15 @@ uint16_t CardReader::get_num_Files() { ; } +#if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + typedef void (*screenFunc_t)(); + extern void lcd_sdcard_menu(); + extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0); + extern uint32_t saved_encoderPosition; + extern bool screen_changed, drawing_screen, defer_return_to_status; + void _lcd_synchronize(); // Not declared in any LCD header file. Probably, that should be changed. +#endif + void CardReader::printingHasFinished() { stepper.synchronize(); file.close(); @@ -911,6 +920,18 @@ void CardReader::printingHasFinished() { #if ENABLED(SDCARD_SORT_ALPHA) presort(); #endif + + #if ENABLED(SD_REPRINT_LAST_SELECTED_FILE) + lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; + _lcd_synchronize(); + safe_delay(50); + _lcd_synchronize(); + lcdDrawUpdate = LCDVIEW_CALL_REDRAW_NEXT; + drawing_screen = screen_changed = true; + lcd_goto_screen(lcd_sdcard_menu, saved_encoderPosition); + defer_return_to_status = true; + lcd_update(); + #endif } } diff --git a/README.md b/README.md index 6da0746589..fa1ad43ef3 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Marlin 2.0 adds a new abstraction layer so that Marlin can build and run on 32-b [Teensy++ 2.0](http://www.microchip.com/wwwproducts/en/AT90USB1286)|[AT90USB1286](http://www.microchip.com/wwwproducts/en/AT90USB1286)|16MHz|128k|8k|5V|no [Due](https://www.arduino.cc/en/Guide/ArduinoDue), [RAMPS-FD](http://www.reprap.org/wiki/RAMPS-FD), etc.|[SAM3X8E ARM-Cortex M3](http://www.microchip.com/wwwproducts/en/ATsam3x8e)|84MHz|512k|64+32k|3.3V|no [Re-ARM](https://www.kickstarter.com/projects/1245051645/re-arm-for-ramps-simple-32-bit-upgrade)|[LPC1768 ARM-Cortex M3](http://www.nxp.com/products/microcontrollers-and-processors/arm-based-processors-and-mcus/lpc-cortex-m-mcus/lpc1700-cortex-m3/512kb-flash-64kb-sram-ethernet-usb-lqfp100-package:LPC1768FBD100)|100MHz|512k|32+16+16k|3.3-5V|no + [MKS SBASE](http://forums.reprap.org/read.php?13,499322)|LPC1768 ARM-Cortex M3|100MHz|512k|32+16+16k|3.3-5V|no [Teensy 3.5](https://www.pjrc.com/store/teensy35.html)|ARM-Cortex M4|120MHz|512k|192k|3.3-5V|yes [Teensy 3.6](https://www.pjrc.com/store/teensy36.html)|ARM-Cortex M4|180MHz|1M|256k|3.3V|yes @@ -39,7 +40,6 @@ Marlin 2.0 adds a new abstraction layer so that Marlin can build and run on 32-b ----|---------|-----|-----|----|-----|--- [STEVAL-3DP001V1](http://www.st.com/en/evaluation-tools/steval-3dp001v1.html)|[STM32F401VE Arm-Cortex M4](http://www.st.com/en/microcontrollers/stm32f401ve.html)|84MHz|512k|64+32k|3.3-5V|yes [Smoothieboard](http://reprap.org/wiki/Smoothieboard)|LPC1769 ARM-Cortex M3|120MHz|512k|64k|3.3-5V|no - [MKS SBASE](http://forums.reprap.org/read.php?13,499322)|LPC1768 ARM-Cortex M3|100MHz|512k|32+16+16k|3.3-5V|no ## Submitting Patches diff --git a/frameworks/CMSIS/LPC1768/driver/debug_frmwrk.c b/frameworks/CMSIS/LPC1768/driver/debug_frmwrk.c index 7d7bae4b86..62e9b00016 100644 --- a/frameworks/CMSIS/LPC1768/driver/debug_frmwrk.c +++ b/frameworks/CMSIS/LPC1768/driver/debug_frmwrk.c @@ -1,11 +1,11 @@ /********************************************************************** -* $Id$ debug_frmwrk.c 2010-05-21 -*//** -* @file debug_frmwrk.c -* @brief Contains some utilities that used for debugging through UART -* @version 2.0 -* @date 21. May. 2010 -* @author NXP MCU SW Application Team +* $Id$ debug_frmwrk.c 2010-05-21 +* +* @file debug_frmwrk.c +* @brief Contains some utilities that used for debugging through UART +* @version 2.0 +* @date 21. May. 2010 +* @author NXP MCU SW Application Team * * Copyright(C) 2010, NXP Semiconductor * All rights reserved. @@ -37,12 +37,13 @@ * otherwise the default FW library configuration file must be included instead */ #ifdef __BUILD_WITH_EXAMPLE__ -#include "lpc17xx_libcfg.h" + #include "lpc17xx_libcfg.h" #else -#include "lpc17xx_libcfg_default.h" -#endif /* __BUILD_WITH_EXAMPLE__ */ + #include "lpc17xx_libcfg_default.h" +#endif #ifdef _DBGFWK + /* Debug framework */ static Bool debug_frmwrk_initialized = FALSE; @@ -59,284 +60,247 @@ uint8_t (*_db_get_char)(LPC_UART_TypeDef *UARTx) = UARTGetChar; /*********************************************************************//** - * @brief Puts a character to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] ch Character to put - * @return None + * @brief Puts a character to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] ch Character to put + * @return None **********************************************************************/ -void UARTPutChar (LPC_UART_TypeDef *UARTx, uint8_t ch) -{ +void UARTPutChar(LPC_UART_TypeDef *UARTx, uint8_t ch) { if (debug_frmwrk_initialized) - UART_Send(UARTx, &ch, 1, BLOCKING); + UART_Send(UARTx, &ch, 1, BLOCKING); } - /*********************************************************************//** - * @brief Get a character to UART port - * @param[in] UARTx Pointer to UART peripheral - * @return character value that returned + * @brief Get a character to UART port + * @param[in] UARTx Pointer to UART peripheral + * @return character value that returned **********************************************************************/ -uint8_t UARTGetChar (LPC_UART_TypeDef *UARTx) -{ +uint8_t UARTGetChar(LPC_UART_TypeDef *UARTx) { uint8_t tmp = 0; - + if (debug_frmwrk_initialized) UART_Receive(UARTx, &tmp, 1, BLOCKING); - - return(tmp); -} - -/*********************************************************************//** - * @brief Puts a string to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] str string to put - * @return None - **********************************************************************/ -void UARTPuts(LPC_UART_TypeDef *UARTx, const void *str) -{ - uint8_t *s = (uint8_t *) str; - - if (!debug_frmwrk_initialized) - return; - - while (*s) - { - UARTPutChar(UARTx, *s++); - } -} - - -/*********************************************************************//** - * @brief Puts a string to UART port and print new line - * @param[in] UARTx Pointer to UART peripheral - * @param[in] str String to put - * @return None - **********************************************************************/ -void UARTPuts_(LPC_UART_TypeDef *UARTx, const void *str) -{ - if (!debug_frmwrk_initialized) - return; - - UARTPuts (UARTx, str); - UARTPuts (UARTx, "\n\r"); -} - - -/*********************************************************************//** - * @brief Puts a decimal number to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] decnum Decimal number (8-bit long) - * @return None - **********************************************************************/ -void UARTPutDec(LPC_UART_TypeDef *UARTx, uint8_t decnum) -{ - if (!debug_frmwrk_initialized) - return; - - uint8_t c1=decnum%10; - uint8_t c2=(decnum/10)%10; - uint8_t c3=(decnum/100)%10; - UARTPutChar(UARTx, '0'+c3); - UARTPutChar(UARTx, '0'+c2); - UARTPutChar(UARTx, '0'+c1); + return(tmp); } /*********************************************************************//** - * @brief Puts a decimal number to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] decnum Decimal number (8-bit long) - * @return None + * @brief Puts a string to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] str string to put + * @return None **********************************************************************/ -void UARTPutDec16(LPC_UART_TypeDef *UARTx, uint16_t decnum) -{ - if (!debug_frmwrk_initialized) - return; +void UARTPuts(LPC_UART_TypeDef *UARTx, const void *str) { + if (!debug_frmwrk_initialized) return; - uint8_t c1=decnum%10; - uint8_t c2=(decnum/10)%10; - uint8_t c3=(decnum/100)%10; - uint8_t c4=(decnum/1000)%10; - uint8_t c5=(decnum/10000)%10; - UARTPutChar(UARTx, '0'+c5); - UARTPutChar(UARTx, '0'+c4); - UARTPutChar(UARTx, '0'+c3); - UARTPutChar(UARTx, '0'+c2); - UARTPutChar(UARTx, '0'+c1); + uint8_t *s = (uint8_t*)str; + while (*s) UARTPutChar(UARTx, *s++); } /*********************************************************************//** - * @brief Puts a decimal number to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] decnum Decimal number (8-bit long) - * @return None + * @brief Puts a string to UART port and print new line + * @param[in] UARTx Pointer to UART peripheral + * @param[in] str String to put + * @return None **********************************************************************/ -void UARTPutDec32(LPC_UART_TypeDef *UARTx, uint32_t decnum) -{ - if (!debug_frmwrk_initialized) - return; +void UARTPuts_(LPC_UART_TypeDef *UARTx, const void *str) { + if (!debug_frmwrk_initialized) return; - uint8_t c1=decnum%10; - uint8_t c2=(decnum/10)%10; - uint8_t c3=(decnum/100)%10; - uint8_t c4=(decnum/1000)%10; - uint8_t c5=(decnum/10000)%10; - uint8_t c6=(decnum/100000)%10; - uint8_t c7=(decnum/1000000)%10; - uint8_t c8=(decnum/10000000)%10; - uint8_t c9=(decnum/100000000)%10; - uint8_t c10=(decnum/1000000000)%10; - UARTPutChar(UARTx, '0'+c10); - UARTPutChar(UARTx, '0'+c9); - UARTPutChar(UARTx, '0'+c8); - UARTPutChar(UARTx, '0'+c7); - UARTPutChar(UARTx, '0'+c6); - UARTPutChar(UARTx, '0'+c5); - UARTPutChar(UARTx, '0'+c4); - UARTPutChar(UARTx, '0'+c3); - UARTPutChar(UARTx, '0'+c2); - UARTPutChar(UARTx, '0'+c1); + UARTPuts (UARTx, str); + UARTPuts (UARTx, "\n\r"); } /*********************************************************************//** - * @brief Puts a hex number to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] hexnum Hex number (8-bit long) - * @return None + * @brief Puts a decimal number to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] decnum Decimal number (8-bit long) + * @return None **********************************************************************/ -void UARTPutHex (LPC_UART_TypeDef *UARTx, uint8_t hexnum) -{ - uint8_t nibble, i; - - if (!debug_frmwrk_initialized) - return; +void UARTPutDec(LPC_UART_TypeDef *UARTx, uint8_t decnum) { + if (!debug_frmwrk_initialized) return; - UARTPuts(UARTx, "0x"); - i = 1; - do { - nibble = (hexnum >> (4*i)) & 0x0F; - UARTPutChar(UARTx, (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble)); - } while (i--); -} - - -/*********************************************************************//** - * @brief Puts a hex number to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] hexnum Hex number (16-bit long) - * @return None - **********************************************************************/ -void UARTPutHex16 (LPC_UART_TypeDef *UARTx, uint16_t hexnum) -{ - uint8_t nibble, i; - - if (!debug_frmwrk_initialized) - return; - - UARTPuts(UARTx, "0x"); - i = 3; - do { - nibble = (hexnum >> (4*i)) & 0x0F; - UARTPutChar(UARTx, (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble)); - } while (i--); + uint8_t c1 = decnum%10; + uint8_t c2 = (decnum / 10) % 10; + uint8_t c3 = (decnum / 100) % 10; + UARTPutChar(UARTx, '0'+c3); + UARTPutChar(UARTx, '0'+c2); + UARTPutChar(UARTx, '0'+c1); } /*********************************************************************//** - * @brief Puts a hex number to UART port - * @param[in] UARTx Pointer to UART peripheral - * @param[in] hexnum Hex number (32-bit long) - * @return None + * @brief Puts a decimal number to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] decnum Decimal number (8-bit long) + * @return None **********************************************************************/ -void UARTPutHex32 (LPC_UART_TypeDef *UARTx, uint32_t hexnum) -{ - uint8_t nibble, i; - - if (!debug_frmwrk_initialized) - return; +void UARTPutDec16(LPC_UART_TypeDef *UARTx, uint16_t decnum) { + if (!debug_frmwrk_initialized) return; - UARTPuts(UARTx, "0x"); - i = 7; - do { - nibble = (hexnum >> (4*i)) & 0x0F; - UARTPutChar(UARTx, (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble)); - } while (i--); + uint8_t c1 = decnum%10; + uint8_t c2 = (decnum / 10) % 10; + uint8_t c3 = (decnum / 100) % 10; + uint8_t c4 = (decnum / 1000) % 10; + uint8_t c5 = (decnum / 10000) % 10; + UARTPutChar(UARTx, '0'+c5); + UARTPutChar(UARTx, '0'+c4); + UARTPutChar(UARTx, '0'+c3); + UARTPutChar(UARTx, '0'+c2); + UARTPutChar(UARTx, '0'+c1); } -///*********************************************************************//** -// * @brief print function that supports format as same as printf() -// * function of library -// * @param[in] None -// * @return None -// **********************************************************************/ -//void _printf (const char *format, ...) -//{ -// static char buffer[512 + 1]; -// va_list vArgs; -// char *tmp; -// va_start(vArgs, format); -// vsprintf((char *)buffer, (char const *)format, vArgs); -// va_end(vArgs); +/*********************************************************************//** + * @brief Puts a decimal number to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] decnum Decimal number (8-bit long) + * @return None + **********************************************************************/ +void UARTPutDec32(LPC_UART_TypeDef *UARTx, uint32_t decnum) { + if (!debug_frmwrk_initialized) return; + + const uint8_t c1 = decnum % 10, + c2 = (decnum / 10) % 10, + c3 = (decnum / 100) % 10, + c4 = (decnum / 1000) % 10, + c5 = (decnum / 10000) % 10, + c6 = (decnum / 100000) % 10, + c7 = (decnum / 1000000) % 10, + c8 = (decnum / 10000000) % 10, + c9 = (decnum / 100000000) % 10, + c10 = (decnum / 1000000000) % 10; + UARTPutChar(UARTx, '0' + c10); + UARTPutChar(UARTx, '0' + c9); + UARTPutChar(UARTx, '0' + c8); + UARTPutChar(UARTx, '0' + c7); + UARTPutChar(UARTx, '0' + c6); + UARTPutChar(UARTx, '0' + c5); + UARTPutChar(UARTx, '0' + c4); + UARTPutChar(UARTx, '0' + c3); + UARTPutChar(UARTx, '0' + c2); + UARTPutChar(UARTx, '0' + c1); +} + +/*********************************************************************//** + * @brief Puts a hex number to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] hexnum Hex number (8-bit long) + * @return None + **********************************************************************/ +void UARTPutHex(LPC_UART_TypeDef *UARTx, uint8_t hexnum) { + if (!debug_frmwrk_initialized) return; + + UARTPuts(UARTx, "0x"); + uint8_t nibble, i = 1; + do { + nibble = (hexnum >> (4 * i)) & 0x0F; + UARTPutChar(UARTx, (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble)); + } while (i--); +} + +/*********************************************************************//** + * @brief Puts a hex number to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] hexnum Hex number (16-bit long) + * @return None + **********************************************************************/ +void UARTPutHex16(LPC_UART_TypeDef *UARTx, uint16_t hexnum) { + if (!debug_frmwrk_initialized) return; + + UARTPuts(UARTx, "0x"); + uint8_t nibble, i = 3; + do { + nibble = (hexnum >> (4 * i)) & 0x0F; + UARTPutChar(UARTx, (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble)); + } while (i--); +} + +/*********************************************************************//** + * @brief Puts a hex number to UART port + * @param[in] UARTx Pointer to UART peripheral + * @param[in] hexnum Hex number (32-bit long) + * @return None + **********************************************************************/ +void UARTPutHex32(LPC_UART_TypeDef *UARTx, uint32_t hexnum) { + if (!debug_frmwrk_initialized) return; + + UARTPuts(UARTx, "0x"); + uint8_t nibble, i = 7; + do { + nibble = (hexnum >> (4 * i)) & 0x0F; + UARTPutChar(UARTx, (nibble > 9) ? ('A' + nibble - 10) : ('0' + nibble)); + } while (i--); +} + +/*********************************************************************//** + * @brief print function that supports format as same as printf() + * function of library + * @param[in] None + * @return None + **********************************************************************/ +//void _printf (const char *format, ...) { +// static char buffer[512 + 1]; +// va_list vArgs; +// char *tmp; +// va_start(vArgs, format); +// vsprintf((char *)buffer, (char const *)format, vArgs); +// va_end(vArgs); // -// _DBG(buffer); +// _DBG(buffer); //} /*********************************************************************//** - * @brief Initialize Debug frame work through initializing UART port - * @param[in] None - * @return None + * @brief Initialize Debug frame work through initializing UART port + * @param[in] None + * @return None **********************************************************************/ -void debug_frmwrk_init(void) -{ - UART_CFG_Type UARTConfigStruct; - PINSEL_CFG_Type PinCfg; +void debug_frmwrk_init(void) { + UART_CFG_Type UARTConfigStruct; + PINSEL_CFG_Type PinCfg; -#if (USED_UART_DEBUG_PORT==0) - /* - * Initialize UART0 pin connect - */ - PinCfg.Funcnum = 1; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - PinCfg.Pinnum = 2; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); - PinCfg.Pinnum = 3; - PINSEL_ConfigPin(&PinCfg); + #if (USED_UART_DEBUG_PORT==0) + /* + * Initialize UART0 pin connect + */ + PinCfg.Funcnum = 1; + PinCfg.OpenDrain = 0; + PinCfg.Pinmode = 0; + PinCfg.Pinnum = 2; + PinCfg.Portnum = 0; + PINSEL_ConfigPin(&PinCfg); + PinCfg.Pinnum = 3; + PINSEL_ConfigPin(&PinCfg); -#elif (USED_UART_DEBUG_PORT==1) - /* - * Initialize UART1 pin connect - */ - PinCfg.Funcnum = 1; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - PinCfg.Pinnum = 15; - PinCfg.Portnum = 0; - PINSEL_ConfigPin(&PinCfg); - PinCfg.Pinnum = 16; - PINSEL_ConfigPin(&PinCfg); -#endif + #elif (USED_UART_DEBUG_PORT==1) + /* + * Initialize UART1 pin connect + */ + PinCfg.Funcnum = 1; + PinCfg.OpenDrain = 0; + PinCfg.Pinmode = 0; + PinCfg.Pinnum = 15; + PinCfg.Portnum = 0; + PINSEL_ConfigPin(&PinCfg); + PinCfg.Pinnum = 16; + PINSEL_ConfigPin(&PinCfg); + #endif - /* Initialize UART Configuration parameter structure to default state: - * Baudrate = 9600bps - * 8 data bit - * 1 Stop bit - * None parity - */ - UART_ConfigStructInit(&UARTConfigStruct); + /* Initialize UART Configuration parameter structure to default state: + * Baudrate = 9600bps + * 8 data bit + * 1 Stop bit + * None parity + */ + UART_ConfigStructInit(&UARTConfigStruct); - // Re-configure baudrate to 115200bps - UARTConfigStruct.Baud_rate = 115200; + // Re-configure baudrate to 115200bps + UARTConfigStruct.Baud_rate = 115200; - // Initialize DEBUG_UART_PORT peripheral with given to corresponding parameter - UART_Init((LPC_UART_TypeDef *)DEBUG_UART_PORT, &UARTConfigStruct); + // Initialize DEBUG_UART_PORT peripheral with given to corresponding parameter + UART_Init((LPC_UART_TypeDef *)DEBUG_UART_PORT, &UARTConfigStruct); - // Enable UART Transmit - UART_TxCmd((LPC_UART_TypeDef *)DEBUG_UART_PORT, ENABLE); + // Enable UART Transmit + UART_TxCmd((LPC_UART_TypeDef *)DEBUG_UART_PORT, ENABLE); debug_frmwrk_initialized = TRUE; } -#endif /*_DBGFWK */ - -/* --------------------------------- End Of File ------------------------------ */ +#endif // _DBGFWK diff --git a/platformio.ini b/platformio.ini index 06e783433f..94f893edfa 100644 --- a/platformio.ini +++ b/platformio.ini @@ -139,9 +139,9 @@ lib_ignore = Adafruit NeoPixel src_filter = ${common.default_src_filter} # -# Re-ARM (NXP LPC1768 ARM Cortex-M3) +# NXP LPC1768 ARM Cortex-M3 # -[env:Re-ARM] +[env:LPC1768] platform = nxplpc board_f_cpu = 100000000L build_flags = !python Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py @@ -154,9 +154,9 @@ extra_scripts = Marlin/src/HAL/HAL_LPC1768/lpc1768_flag_script.py src_filter = ${common.default_src_filter} # -# Re-ARM (for debugging and development) +# LPC1768 (for debugging and development) # -[env:Re-ARM_debug_and_upload] +[env:LPC1768_debug_and_upload] # Segger JLink platform = nxplpc #framework = mbed