diff --git a/.github/workflows/test-builds.yml b/.github/workflows/test-builds.yml index fdb81fbdc9d2..35cd920adff8 100644 --- a/.github/workflows/test-builds.yml +++ b/.github/workflows/test-builds.yml @@ -70,6 +70,7 @@ jobs: - mks_robin_stm32 - ARMED - FYSETC_S6 + - STM32F070CB_malyan - STM32F070RB_malyan - malyan_M300 - mks_robin_lite diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index d23b69c02b28..52af1375a509 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -177,7 +177,7 @@ #endif /** - * Prusa Multi-Material Unit v2 + * Průša Multi-Material Unit v2 * * Requires NOZZLE_PARK_FEATURE to park print head in case MMU unit fails. * Requires EXTRUDERS = 5 @@ -373,7 +373,7 @@ * 4 : 10k thermistor !! do not use it for a hotend. It gives bad resolution at high temp. !! * 5 : 100K thermistor - ATC Semitec 104GT-2/104NT-4-R025H42G (Used in ParCan, J-Head, and E3D) (4.7k pullup) * 501 : 100K Zonestar (Tronxy X3A) Thermistor - * 502 : 100K Zonestar Thermistor used by hot bed in Zonestar Prusa P802M + * 502 : 100K Zonestar Thermistor used by hot bed in Zonestar Průša P802M * 512 : 100k RPW-Ultra hotend thermistor (4.7k pullup) * 6 : 100k EPCOS - Not as accurate as table 1 (created using a fluke thermocouple) (4.7k pullup) * 7 : 100k Honeywell thermistor 135-104LAG-J01 (4.7k pullup) @@ -608,7 +608,7 @@ // @section machine -// Uncomment one of these options to enable CoreXY, CoreXZ, or CoreYZ kinematics +// Enable one of the options below for CoreXY, CoreXZ, or CoreYZ kinematics, // either in the usual order or reversed //#define COREXY //#define COREXZ @@ -616,6 +616,7 @@ //#define COREYX //#define COREZX //#define COREZY +//#define MARKFORGED_XY // MarkForged. See https://reprap.org/forum/read.php?152,504042 //=========================================================================== //============================== Endstop Settings =========================== @@ -1689,7 +1690,7 @@ * Select the language to display on the LCD. These languages are available: * * en, an, bg, ca, cz, da, de, el, el_gr, es, eu, fi, fr, gl, hr, hu, it, - * jp_kana, ko_KR, nl, pl, pt, pt_br, ro ru, sk, tr, uk, vi, zh_CN, zh_TW, test + * jp_kana, ko_KR, nl, pl, pt, pt_br, ro, ru, sk, tr, uk, vi, zh_CN, zh_TW, test * * :{ 'en':'English', 'an':'Aragonese', 'bg':'Bulgarian', 'ca':'Catalan', 'cz':'Czech', 'da':'Danish', 'de':'German', 'el':'Greek', 'el_gr':'Greek (Greece)', 'es':'Spanish', 'eu':'Basque-Euskera', 'fi':'Finnish', 'fr':'French', 'gl':'Galician', 'hr':'Croatian', 'hu':'Hungarian', 'it':'Italian', 'jp_kana':'Japanese', 'ko_KR':'Korean (South Korea)', 'nl':'Dutch', 'pl':'Polish', 'pt':'Portuguese', 'pt_br':'Portuguese (Brazilian)', 'ro':'Romanian', 'ru':'Russian', 'sk':'Slovak', 'tr':'Turkish', 'uk':'Ukrainian', 'vi':'Vietnamese', 'zh_CN':'Chinese (Simplified)', 'zh_TW':'Chinese (Traditional)', 'test':'TEST' } */ @@ -1720,9 +1721,9 @@ #define DISPLAY_CHARSET_HD44780 JAPANESE /** - * Info Screen Style (0:Classic, 1:Prusa) + * Info Screen Style (0:Classic, 1:Průša) * - * :[0:'Classic', 1:'Prusa'] + * :[0:'Classic', 1:'Průša'] */ #define LCD_INFO_SCREEN_STYLE 0 @@ -2062,7 +2063,7 @@ //#define FYSETC_MINI_12864_X_X // Type C/D/E/F. No tunable RGB Backlight by default //#define FYSETC_MINI_12864_1_2 // Type C/D/E/F. Simple RGB Backlight (always on) //#define FYSETC_MINI_12864_2_0 // Type A/B. Discreet RGB Backlight -//#define FYSETC_MINI_12864_2_1 // Type A/B. Neopixel RGB Backlight +//#define FYSETC_MINI_12864_2_1 // Type A/B. NeoPixel RGB Backlight //#define FYSETC_GENERIC_12864_1_1 // Larger display with basic ON/OFF backlight. // @@ -2332,13 +2333,13 @@ * 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. + * For NeoPixel LED an overall brightness parameter is also available. * * *** CAUTION *** * LED Strips require a MOSFET 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 + * NOTE: A separate 5V power supply is required! The NeoPixel LED needs * more current than the Arduino 5V linear regulator can produce. * *** CAUTION *** * @@ -2355,20 +2356,29 @@ //#define RGB_LED_W_PIN -1 #endif -// Support for Adafruit Neopixel LED driver +// Support for Adafruit NeoPixel LED driver //#define NEOPIXEL_LED #if ENABLED(NEOPIXEL_LED) #define NEOPIXEL_TYPE NEO_GRBW // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) #define NEOPIXEL_PIN 4 // LED driving pin //#define NEOPIXEL2_TYPE NEOPIXEL_TYPE //#define NEOPIXEL2_PIN 5 - //#define NEOPIXEL2_INSERIES // Default behavior is NeoPixel 2 in parallel - #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip, larger of 2 strips if 2 neopixel strips are used + #define NEOPIXEL_PIXELS 30 // Number of LEDs in the strip. (Longest strip when NEOPIXEL2_SEPARATE is disabled.) #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) //#define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup - // Use a single Neopixel LED for static (background) lighting + // Support for second Adafruit NeoPixel LED driver controlled with M150 S1 ... + //#define NEOPIXEL2_SEPARATE + #if ENABLED(NEOPIXEL2_SEPARATE) + #define NEOPIXEL2_PIXELS 15 // Number of LEDs in the second strip + #define NEOPIXEL2_BRIGHTNESS 127 // Initial brightness (0-255) + #define NEOPIXEL2_STARTUP_TEST // Cycle through colors at startup + #else + //#define NEOPIXEL2_INSERIES // Default behavior is NeoPixel 2 in parallel + #endif + + // Use a single NeoPixel LED for static (background) lighting //#define NEOPIXEL_BKGD_LED_INDEX 0 // Index of the LED to use //#define NEOPIXEL_BKGD_COLOR { 255, 255, 255, 0 } // R, G, B, W #endif diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index 7d9182ad9bbc..2712312747de 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -488,7 +488,7 @@ //#define CASE_LIGHT_MAX_PWM 128 // Limit pwm //#define CASE_LIGHT_MENU // Add Case Light options to the LCD menu //#define CASE_LIGHT_NO_BRIGHTNESS // Disable brightness control. Enable for non-PWM lighting. - //#define CASE_LIGHT_USE_NEOPIXEL // Use Neopixel LED as case light, requires NEOPIXEL_LED. + //#define CASE_LIGHT_USE_NEOPIXEL // Use NeoPixel LED as case light, requires NEOPIXEL_LED. #if ENABLED(CASE_LIGHT_USE_NEOPIXEL) #define CASE_LIGHT_NEOPIXEL_COLOR { 255, 255, 255, 255 } // { Red, Green, Blue, White } #endif @@ -909,9 +909,9 @@ #define CALIBRATION_MEASUREMENT_RESOLUTION 0.01 // mm - #define CALIBRATION_FEEDRATE_SLOW 60 // mm/m - #define CALIBRATION_FEEDRATE_FAST 1200 // mm/m - #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/m + #define CALIBRATION_FEEDRATE_SLOW 60 // mm/min + #define CALIBRATION_FEEDRATE_FAST 1200 // mm/min + #define CALIBRATION_FEEDRATE_TRAVEL 3000 // mm/min // The following parameters refer to the conical section of the nozzle tip. #define CALIBRATION_NOZZLE_TIP_HEIGHT 1.0 // mm @@ -1065,6 +1065,7 @@ //#define LED_CONTROL_MENU #if ENABLED(LED_CONTROL_MENU) #define LED_COLOR_PRESETS // Enable the Preset Color menu option + //#define NEO2_COLOR_PRESETS // Enable a second NeoPixel Preset Color menu option #if ENABLED(LED_COLOR_PRESETS) #define LED_USER_PRESET_RED 255 // User defined RED value #define LED_USER_PRESET_GREEN 128 // User defined GREEN value @@ -1073,6 +1074,14 @@ #define LED_USER_PRESET_BRIGHTNESS 255 // User defined intensity //#define LED_USER_PRESET_STARTUP // Have the printer display the user preset color on startup #endif + #if ENABLED(NEO2_COLOR_PRESETS) + #define NEO2_USER_PRESET_RED 255 // User defined RED value + #define NEO2_USER_PRESET_GREEN 128 // User defined GREEN value + #define NEO2_USER_PRESET_BLUE 0 // User defined BLUE value + #define NEO2_USER_PRESET_WHITE 255 // User defined WHITE value + #define NEO2_USER_PRESET_BRIGHTNESS 255 // User defined intensity + //#define NEO2_USER_PRESET_STARTUP // Have the printer display the user preset color on startup for the second strip + #endif #endif #endif // HAS_LCD_MENU @@ -2424,7 +2433,7 @@ * CHOPPER_DEFAULT_24V * CHOPPER_DEFAULT_36V * CHOPPER_09STEP_24V // 0.9 degree steppers (24V) - * CHOPPER_PRUSAMK3_24V // Imported parameters from the official Prusa firmware for MK3 (24V) + * CHOPPER_PRUSAMK3_24V // Imported parameters from the official Průša firmware for MK3 (24V) * CHOPPER_MARLIN_119 // Old defaults from Marlin v1.1.9 * * Define you own with @@ -2478,7 +2487,7 @@ #define E7_HYBRID_THRESHOLD 30 /** - * Use StallGuard2 to home / probe X, Y, Z. + * Use StallGuard to home / probe X, Y, Z. * * TMC2130, TMC2160, TMC2209, TMC2660, TMC5130, and TMC5160 only * Connect the stepper driver's DIAG1 pin to the X/Y endstop pin. @@ -2499,6 +2508,8 @@ * * IMPROVE_HOMING_RELIABILITY tunes acceleration and jerk when * homing and adds a guard period for endstop triggering. + * + * Comment *_STALL_SENSITIVITY to disable sensorless homing for that axis. */ //#define SENSORLESS_HOMING // StallGuard capable drivers only @@ -3396,7 +3407,7 @@ #endif /** - * Prusa Multi-Material Unit v2 + * Průša Multi-Material Unit v2 * Enable in Configuration.h */ #if ENABLED(PRUSA_MMU2) @@ -3420,7 +3431,7 @@ //#define MMU2_MENUS #if ENABLED(MMU2_MENUS) // Settings for filament load / unload from the LCD menu. - // This is for Prusa MK3-style extruders. Customize for your hardware. + // This is for Průša MK3-style extruders. Customize for your hardware. #define MMU2_FILAMENTCHANGE_EJECT_FEED 80.0 #define MMU2_LOAD_TO_NOZZLE_SEQUENCE \ { 7.2, 1145 }, \ @@ -3446,7 +3457,7 @@ /** * MMU Extruder Sensor * - * Support for a Prusa (or other) IR Sensor to detect filament near the extruder + * Support for a Průša (or other) IR Sensor to detect filament near the extruder * and make loading more reliable. Suitable for an extruder equipped with a filament * sensor less than 38mm from the gears. * diff --git a/Marlin/Makefile b/Marlin/Makefile index 95135ab594d9..5ab0d1eefd11 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -694,7 +694,7 @@ ifeq ($(HARDWARE_VARIANT), Teensy) LIB_CXXSRC += usb_api.cpp else ifeq ($(HARDWARE_VARIANT), archim) - CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT="Archim"' + CDEFS += -DARDUINO_SAM_ARCHIM -DARDUINO_ARCH_SAM -D__SAM3X8E__ -DUSB_VID=0x27b1 -DUSB_PID=0x0001 -DUSBCON '-DUSB_MANUFACTURER="UltiMachine"' '-DUSB_PRODUCT_STRING="Archim"' LIB_CXXSRC += variant.cpp IPAddress.cpp Reset.cpp RingBuffer.cpp Stream.cpp UARTClass.cpp USARTClass.cpp abi.cpp new.cpp watchdog.cpp CDC.cpp PluggableUSB.cpp USBCore.cpp LIB_SRC += cortex_handlers.c iar_calls_sam3.c syscalls_sam3.c dtostrf.c itoa.c diff --git a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp index e34a102012a1..00b4310d1dc7 100644 --- a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp +++ b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp @@ -30,7 +30,7 @@ */ /** - * Hardware SPI and a software SPI implementations are included in this file. + * Hardware SPI and Software SPI implementations are included in this file. * The hardware SPI runs faster and has higher throughput but is not compatible * with some LCD interfaces/adapters. * @@ -51,6 +51,10 @@ #include "../../inc/MarlinConfig.h" #include +// Hardware SPI and SPIClass +#include +#include + // ------------------------ // Public functions // ------------------------ @@ -96,12 +100,6 @@ #else - // Hardware SPI - - #include - #include - #include - // decide which HW SPI device to use #ifndef LPC_HW_SPI_DEV #if (SCK_PIN == P0_07 && MISO_PIN == P0_08 && MOSI_PIN == P0_09) @@ -114,7 +112,7 @@ #endif #endif #endif - #if (LPC_HW_SPI_DEV == 0) + #if LPC_HW_SPI_DEV == 0 #define LPC_SSPn LPC_SSP0 #else #define LPC_SSPn LPC_SSP1 @@ -192,7 +190,7 @@ for (uint16_t i = 0; i < nbyte; i++) buf[i] = doio(0xFF); } - static uint8_t spiTransfer(uint8_t b) { + uint8_t spiTransfer(uint8_t b) { return doio(b); } @@ -211,30 +209,236 @@ #endif // LPC_SOFTWARE_SPI -void SPIClass::begin() { spiBegin(); } +/** + * @brief Wait until TXE (tx empty) flag is set and BSY (busy) flag unset. + */ +static inline void waitSpiTxEnd(LPC_SSP_TypeDef *spi_d) { + while (SSP_GetStatus(spi_d, SSP_STAT_TXFIFO_EMPTY) == RESET) { /* nada */ } // wait until TXE=1 + while (SSP_GetStatus(spi_d, SSP_STAT_BUSY) == SET) { /* nada */ } // wait until BSY=0 +} + +SPIClass::SPIClass(uint8_t device) { + // Init things specific to each SPI device + // clock divider setup is a bit of hack, and needs to be improved at a later date. + + PINSEL_CFG_Type PinCfg; // data structure to hold init values + #if BOARD_NR_SPI >= 1 + _settings[0].spi_d = LPC_SSP0; + // _settings[0].clockDivider = determine_baud_rate(_settings[0].spi_d, _settings[0].clock); + PinCfg.Funcnum = 2; + PinCfg.OpenDrain = 0; + PinCfg.Pinmode = 0; + PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI1_SCK_PIN); + PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI1_SCK_PIN); + PINSEL_ConfigPin(&PinCfg); + SET_OUTPUT(BOARD_SPI1_SCK_PIN); + + PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI1_MISO_PIN); + PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI1_MISO_PIN); + PINSEL_ConfigPin(&PinCfg); + SET_INPUT(BOARD_SPI1_MISO_PIN); + + PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI1_MOSI_PIN); + PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI1_MOSI_PIN); + PINSEL_ConfigPin(&PinCfg); + SET_OUTPUT(BOARD_SPI1_MOSI_PIN); + #endif + + #if BOARD_NR_SPI >= 2 + _settings[1].spi_d = LPC_SSP1; + // _settings[1].clockDivider = determine_baud_rate(_settings[1].spi_d, _settings[1].clock); + PinCfg.Funcnum = 2; + PinCfg.OpenDrain = 0; + PinCfg.Pinmode = 0; + PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_SCK_PIN); + PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_SCK_PIN); + PINSEL_ConfigPin(&PinCfg); + SET_OUTPUT(BOARD_SPI2_SCK_PIN); + + PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_MISO_PIN); + PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_MISO_PIN); + PINSEL_ConfigPin(&PinCfg); + SET_INPUT(BOARD_SPI2_MISO_PIN); + + PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_MOSI_PIN); + PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_MOSI_PIN); + PINSEL_ConfigPin(&PinCfg); + SET_OUTPUT(BOARD_SPI2_MOSI_PIN); + #endif + + setModule(device); + + /* Initialize GPDMA controller */ + //TODO: call once in the constructor? or each time? + GPDMA_Init(); +} + +void SPIClass::begin() { + updateSettings(); + SSP_Cmd(_currentSetting->spi_d, ENABLE); // start SSP running +} void SPIClass::beginTransaction(const SPISettings &cfg) { - uint8_t spiRate; - switch (cfg.spiRate()) { - case 8000000: spiRate = 0; break; - case 4000000: spiRate = 1; break; - case 2000000: spiRate = 2; break; - case 1000000: spiRate = 3; break; - case 500000: spiRate = 4; break; - case 250000: spiRate = 5; break; - case 125000: spiRate = 6; break; - default: spiRate = 2; break; - } - spiInit(spiRate); + setBitOrder(cfg.bitOrder); + setDataMode(cfg.dataMode); + setDataSize(cfg.dataSize); + //setClockDivider(determine_baud_rate(_currentSetting->spi_d, settings.clock)); + begin(); } -uint8_t SPIClass::transfer(const uint8_t B) { return spiTransfer(B); } +uint8_t SPIClass::transfer(const uint16_t b) { + /* send and receive a single byte */ + SSP_ReceiveData(_currentSetting->spi_d); // read any previous data + SSP_SendData(_currentSetting->spi_d, b); + waitSpiTxEnd(_currentSetting->spi_d); // wait for it to finish + return SSP_ReceiveData(_currentSetting->spi_d); +} uint16_t SPIClass::transfer16(const uint16_t data) { return (transfer((data >> 8) & 0xFF) << 8) | (transfer(data & 0xFF) & 0xFF); } -SPIClass SPI; +void SPIClass::end() { + // SSP_Cmd(_currentSetting->spi_d, DISABLE); // stop device or SSP_DeInit? + SSP_DeInit(_currentSetting->spi_d); +} + +void SPIClass::send(uint8_t data) { + SSP_SendData(_currentSetting->spi_d, data); +} + +void SPIClass::dmaSend(void *buf, uint16_t length, bool minc) { + //TODO: LPC dma can only write 0xFFF bytes at once. + GPDMA_Channel_CFG_Type GPDMACfg; + + /* Configure GPDMA channel 0 -------------------------------------------------------------*/ + /* DMA Channel 0 */ + GPDMACfg.ChannelNum = 0; + // Source memory + GPDMACfg.SrcMemAddr = (uint32_t)buf; + // Destination memory - Not used + GPDMACfg.DstMemAddr = 0; + // Transfer size + GPDMACfg.TransferSize = (minc ? length : 1); + // Transfer width + GPDMACfg.TransferWidth = (_currentSetting->dataSize == DATA_SIZE_16BIT) ? GPDMA_WIDTH_HALFWORD : GPDMA_WIDTH_BYTE; + // Transfer type + GPDMACfg.TransferType = GPDMA_TRANSFERTYPE_M2P; + // Source connection - unused + GPDMACfg.SrcConn = 0; + // Destination connection + GPDMACfg.DstConn = (_currentSetting->spi_d == LPC_SSP0) ? GPDMA_CONN_SSP0_Tx : GPDMA_CONN_SSP1_Tx; + + GPDMACfg.DMALLI = 0; + + // Enable dma on SPI + SSP_DMACmd(_currentSetting->spi_d, SSP_DMA_TX, ENABLE); + + // if minc=false, I'm repeating the same byte 'length' times, as I could not find yet how do GPDMA without memory increment + do { + // Setup channel with given parameter + GPDMA_Setup(&GPDMACfg); + + // enabled dma + GPDMA_ChannelCmd(0, ENABLE); + + // wait data transfer + while (!GPDMA_IntGetStatus(GPDMA_STAT_INTTC, 0) && !GPDMA_IntGetStatus(GPDMA_STAT_INTERR, 0)) { } + + // clear err and int + GPDMA_ClearIntPending (GPDMA_STATCLR_INTTC, 0); + GPDMA_ClearIntPending (GPDMA_STATCLR_INTERR, 0); + + // dma disable + GPDMA_ChannelCmd(0, DISABLE); + + --length; + } while (!minc && length > 0); + + waitSpiTxEnd(_currentSetting->spi_d); + + SSP_DMACmd(_currentSetting->spi_d, SSP_DMA_TX, DISABLE); +} + +uint16_t SPIClass::read() { + return SSP_ReceiveData(_currentSetting->spi_d); +} + +void SPIClass::read(uint8_t *buf, uint32_t len) { + for (uint16_t i = 0; i < len; i++) buf[i] = transfer(0xFF); +} + +void SPIClass::setClock(uint32_t clock) { + _currentSetting->clock = clock; +} + +void SPIClass::setModule(uint8_t device) { + _currentSetting = &_settings[device - 1];// SPI channels are called 1 2 and 3 but the array is zero indexed +} + +void SPIClass::setBitOrder(uint8_t bitOrder) { + _currentSetting->bitOrder = bitOrder; +} + +void SPIClass::setDataMode(uint8_t dataMode) { + _currentSetting->dataSize = dataMode; +} + +void SPIClass::setDataSize(uint32_t ds) { + _currentSetting->dataSize = ds; +} + +/** + * Set up/tear down + */ +void SPIClass::updateSettings() { + //SSP_DeInit(_currentSetting->spi_d); //todo: need force de init?! + + // divide PCLK by 2 for SSP0 + CLKPWR_SetPCLKDiv(_currentSetting->spi_d == LPC_SSP0 ? CLKPWR_PCLKSEL_SSP0 : CLKPWR_PCLKSEL_SSP1, CLKPWR_PCLKSEL_CCLK_DIV_2); + + SSP_CFG_Type HW_SPI_init; // data structure to hold init values + SSP_ConfigStructInit(&HW_SPI_init); // set values for SPI mode + HW_SPI_init.ClockRate = _currentSetting->clock; + HW_SPI_init.Databit = _currentSetting->dataSize; + + /** + * SPI Mode CPOL CPHA Shift SCK-edge Capture SCK-edge + * 0 0 0 Falling Rising + * 1 0 1 Rising Falling + * 2 1 0 Rising Falling + * 3 1 1 Falling Rising + */ + switch (_currentSetting->dataMode) { + case SPI_MODE0: + HW_SPI_init.CPHA = SSP_CPHA_FIRST; + HW_SPI_init.CPOL = SSP_CPOL_HI; + break; + case SPI_MODE1: + HW_SPI_init.CPHA = SSP_CPHA_SECOND; + HW_SPI_init.CPOL = SSP_CPOL_HI; + break; + case SPI_MODE2: + HW_SPI_init.CPHA = SSP_CPHA_FIRST; + HW_SPI_init.CPOL = SSP_CPOL_LO; + break; + case SPI_MODE3: + HW_SPI_init.CPHA = SSP_CPHA_SECOND; + HW_SPI_init.CPOL = SSP_CPOL_LO; + break; + default: + break; + } + + // TODO: handle bitOrder + SSP_Init(_currentSetting->spi_d, &HW_SPI_init); // puts the values into the proper bits in the SSP0 registers +} + +#if MISO_PIN == BOARD_SPI1_MISO_PIN + SPIClass SPI(1); +#elif MISO_PIN == BOARD_SPI2_MISO_PIN + SPIClass SPI(2); +#endif #endif // TARGET_LPC1768 diff --git a/Marlin/src/HAL/LPC1768/inc/Conditionals_LCD.h b/Marlin/src/HAL/LPC1768/inc/Conditionals_LCD.h index 7d4de40faac2..b9bc0bf82e61 100644 --- a/Marlin/src/HAL/LPC1768/inc/Conditionals_LCD.h +++ b/Marlin/src/HAL/LPC1768/inc/Conditionals_LCD.h @@ -21,6 +21,13 @@ */ #pragma once -#if HAS_SPI_TFT || HAS_FSMC_TFT - #error "Sorry! TFT displays are not available for HAL/LPC1768." +#if HAS_FSMC_TFT + #error "Sorry! FSMC TFT displays are not current available for HAL/LPC1768." +#endif + +// This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046' +#if ENABLED(TOUCH_SCREEN) && !HAS_GRAPHICAL_TFT + #undef TOUCH_SCREEN + #undef TOUCH_SCREEN_CALIBRATION + #define HAS_TOUCH_XPT2046 1 #endif diff --git a/Marlin/src/HAL/LPC1768/include/SPI.h b/Marlin/src/HAL/LPC1768/include/SPI.h index 4acd9e7022a9..e2645b9290db 100644 --- a/Marlin/src/HAL/LPC1768/include/SPI.h +++ b/Marlin/src/HAL/LPC1768/include/SPI.h @@ -24,25 +24,139 @@ #include "../../shared/HAL_SPI.h" #include +#include +#include -#define MSBFIRST 1 -#define SPI_MODE3 0 +//#define MSBFIRST 1 + +#define SPI_MODE0 0 +#define SPI_MODE1 1 +#define SPI_MODE2 2 +#define SPI_MODE3 3 + +#define DATA_SIZE_8BIT SSP_DATABIT_8 +#define DATA_SIZE_16BIT SSP_DATABIT_16 + +#define SPI_CLOCK_DIV2 8333333 //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED +#define SPI_CLOCK_DIV4 4166667 //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED +#define SPI_CLOCK_DIV8 2083333 //(SCR: 11) desired: 2,000,000 actual: 2,083,333 +4.2% SPI_QUARTER_SPEED +#define SPI_CLOCK_DIV16 1000000 //(SCR: 24) desired: 1,000,000 actual: 1,000,000 SPI_EIGHTH_SPEED +#define SPI_CLOCK_DIV32 500000 //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5 +#define SPI_CLOCK_DIV64 250000 //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6 +#define SPI_CLOCK_DIV128 125000 //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h + +#define SPI_CLOCK_MAX SPI_CLOCK_DIV2 + +#define BOARD_NR_SPI 2 + +//#define BOARD_SPI1_NSS_PIN PA4 ?! +#define BOARD_SPI1_SCK_PIN P0_15 +#define BOARD_SPI1_MISO_PIN P0_17 +#define BOARD_SPI1_MOSI_PIN P0_18 + +//#define BOARD_SPI2_NSS_PIN PB12 ?! +#define BOARD_SPI2_SCK_PIN P0_07 +#define BOARD_SPI2_MISO_PIN P0_08 +#define BOARD_SPI2_MOSI_PIN P0_09 class SPISettings { - public: - SPISettings(uint32_t speed, int, int) : spi_speed(speed) {}; - uint32_t spiRate() const { return spi_speed; } - private: - uint32_t spi_speed; +public: + SPISettings(uint32_t speed, int, int) : spi_speed(speed) {}; + SPISettings(uint32_t inClock, uint8_t inBitOrder, uint8_t inDataMode, uint32_t inDataSize) { + if (__builtin_constant_p(inClock)) + init_AlwaysInline(inClock, inBitOrder, inDataMode, inDataSize); + else + init_MightInline(inClock, inBitOrder, inDataMode, inDataSize); + } + SPISettings() { + init_AlwaysInline(4000000, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT); + } + + uint32_t spiRate() const { return spi_speed; } + +private: + void init_MightInline(uint32_t inClock, uint8_t inBitOrder, uint8_t inDataMode, uint32_t inDataSize) { + init_AlwaysInline(inClock, inBitOrder, inDataMode, inDataSize); + } + void init_AlwaysInline(uint32_t inClock, uint8_t inBitOrder, uint8_t inDataMode, uint32_t inDataSize) __attribute__((__always_inline__)) { + clock = inClock; + bitOrder = inBitOrder; + dataMode = inDataMode; + dataSize = inDataSize; + } + + uint32_t spi_speed; + uint32_t clock; + uint32_t dataSize; + //uint32_t clockDivider; + uint8_t bitOrder; + uint8_t dataMode; + LPC_SSP_TypeDef *spi_d; + + friend class SPIClass; }; +/** + * @brief Wirish SPI interface. + * + * This is the same interface is available across HAL + * + * This implementation uses software slave management, so the caller + * is responsible for controlling the slave select line. + */ class SPIClass { - public: - void begin(); - void beginTransaction(const SPISettings&); - void endTransaction() {}; - uint8_t transfer(uint8_t data); - uint16_t transfer16(uint16_t data); +public: + /** + * @param spiPortNumber Number of the SPI port to manage. + */ + SPIClass(uint8_t spiPortNumber); + + /** + * Select and configure the current selected SPI device to use + */ + void begin(); + + /** + * Disable the current SPI device + */ + void end(); + + void beginTransaction(const SPISettings&); + void endTransaction() {}; + + // Transfer using 1 "Data Size" + uint8_t transfer(uint16_t data); + // Transfer 2 bytes in 8 bit mode + uint16_t transfer16(uint16_t data); + + void send(uint8_t data); + + uint16_t read(); + void read(uint8_t *buf, uint32_t len); + + void dmaSend(void *buf, uint16_t length, bool minc); + + /** + * @brief Sets the number of the SPI peripheral to be used by + * this HardwareSPI instance. + * + * @param spi_num Number of the SPI port. 1-2 in low density devices + * or 1-3 in high density devices. + */ + void setModule(uint8_t device); + + void setClock(uint32_t clock); + void setBitOrder(uint8_t bitOrder); + void setDataMode(uint8_t dataMode); + void setDataSize(uint32_t ds); + + inline uint32_t getDataSize() { return _currentSetting->dataSize; } + +private: + SPISettings _settings[BOARD_NR_SPI]; + SPISettings *_currentSetting; + + void updateSettings(); }; extern SPIClass SPI; diff --git a/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp new file mode 100644 index 000000000000..84907acd0702 --- /dev/null +++ b/Marlin/src/HAL/LPC1768/tft/tft_spi.cpp @@ -0,0 +1,153 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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 HAS_SPI_TFT + +#include "tft_spi.h" + +//TFT_SPI tft; + +SPIClass TFT_SPI::SPIx(1); + +#define TFT_CS_H WRITE(TFT_CS_PIN, HIGH) +#define TFT_CS_L WRITE(TFT_CS_PIN, LOW) + +#define TFT_DC_H WRITE(TFT_DC_PIN, HIGH) +#define TFT_DC_L WRITE(TFT_DC_PIN, LOW) + +#define TFT_RST_H WRITE(TFT_RESET_PIN, HIGH) +#define TFT_RST_L WRITE(TFT_RESET_PIN, LOW) + +#define TFT_BLK_H WRITE(TFT_BACKLIGHT_PIN, HIGH) +#define TFT_BLK_L WRITE(TFT_BACKLIGHT_PIN, LOW) + +void TFT_SPI::Init() { + #if PIN_EXISTS(TFT_RESET) + SET_OUTPUT(TFT_RESET_PIN); + TFT_RST_H; + delay(100); + #endif + + #if PIN_EXISTS(TFT_BACKLIGHT) + SET_OUTPUT(TFT_BACKLIGHT_PIN); + TFT_BLK_H; + #endif + + SET_OUTPUT(TFT_DC_PIN); + SET_OUTPUT(TFT_CS_PIN); + + TFT_DC_H; + TFT_CS_H; + + /** + * STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz + * STM32F1 has 3 SPI ports, SPI1 in APB2, SPI2/SPI3 in APB1 + * so the minimum prescale of SPI1 is DIV4, SPI2/SPI3 is DIV2 + */ + #if 0 + #if SPI_DEVICE == 1 + #define SPI_CLOCK_MAX SPI_CLOCK_DIV4 + #else + #define SPI_CLOCK_MAX SPI_CLOCK_DIV2 + #endif + uint8_t clock; + uint8_t spiRate = SPI_FULL_SPEED; + switch (spiRate) { + case SPI_FULL_SPEED: clock = SPI_CLOCK_MAX ; break; + case SPI_HALF_SPEED: clock = SPI_CLOCK_DIV4 ; break; + case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8 ; break; + case SPI_EIGHTH_SPEED: clock = SPI_CLOCK_DIV16; break; + case SPI_SPEED_5: clock = SPI_CLOCK_DIV32; break; + case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break; + default: clock = SPI_CLOCK_DIV2; // Default from the SPI library + } + #endif + + #if TFT_MISO_PIN == BOARD_SPI1_MISO_PIN + SPIx.setModule(1); + #elif TFT_MISO_PIN == BOARD_SPI2_MISO_PIN + SPIx.setModule(2); + #endif + SPIx.setClock(SPI_CLOCK_MAX); + SPIx.setBitOrder(MSBFIRST); + SPIx.setDataMode(SPI_MODE0); +} + +void TFT_SPI::DataTransferBegin(uint16_t DataSize) { + SPIx.setDataSize(DataSize); + SPIx.begin(); + TFT_CS_L; +} + +uint32_t TFT_SPI::GetID() { + uint32_t id; + id = ReadID(LCD_READ_ID); + if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) + id = ReadID(LCD_READ_ID4); + return id; +} + +uint32_t TFT_SPI::ReadID(uint16_t Reg) { + uint32_t data = 0; + + #if PIN_EXISTS(TFT_MISO) + uint8_t d = 0; + SPIx.setDataSize(DATASIZE_8BIT); + SPIx.setClock(SPI_CLOCK_DIV64); + SPIx.begin(); + TFT_CS_L; + WriteReg(Reg); + + LOOP_L_N(i, 4) { + SPIx.read((uint8_t*)&d, 1); + data = (data << 8) | d; + } + + DataTransferEnd(); + SPIx.setClock(SPI_CLOCK_MAX); + #endif + + return data >> 7; +} + +bool TFT_SPI::isBusy() { + return false; +} + +void TFT_SPI::Abort() { + DataTransferEnd(); +} + +void TFT_SPI::Transmit(uint16_t Data) { + SPIx.transfer(Data); +} + +void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) { + DataTransferBegin(DATASIZE_16BIT); //16 + TFT_DC_H; + SPIx.dmaSend(Data, Count, MemoryIncrease); + DataTransferEnd(); +} + +#endif // HAS_SPI_TFT diff --git a/Marlin/src/HAL/LPC1768/tft/tft_spi.h b/Marlin/src/HAL/LPC1768/tft/tft_spi.h new file mode 100644 index 000000000000..8d3e3127bbd1 --- /dev/null +++ b/Marlin/src/HAL/LPC1768/tft/tft_spi.h @@ -0,0 +1,77 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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 . + * + */ +#pragma once + +#include "../../../inc/MarlinConfig.h" + +#include +#include +// #include + +#ifndef LCD_READ_ID + #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) +#endif +#ifndef LCD_READ_ID4 + #define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341) +#endif + +#define DATASIZE_8BIT SSP_DATABIT_8 +#define DATASIZE_16BIT SSP_DATABIT_16 +#define TFT_IO TFT_SPI + +#define DMA_MINC_ENABLE 1 +#define DMA_MINC_DISABLE 0 + +class TFT_SPI { +private: + static uint32_t ReadID(uint16_t Reg); + static void Transmit(uint16_t Data); + static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count); + +public: + static SPIClass SPIx; + + static void Init(); + static uint32_t GetID(); + static bool isBusy(); + static void Abort(); + + static void DataTransferBegin(uint16_t DataWidth = DATASIZE_16BIT); + static void DataTransferEnd() { OUT_WRITE(TFT_CS_PIN, HIGH); SPIx.end(); }; + static void DataTransferAbort(); + + static void WriteData(uint16_t Data) { Transmit(Data); } + static void WriteReg(uint16_t Reg) { OUT_WRITE(TFT_A0_PIN, LOW); Transmit(Reg); OUT_WRITE(TFT_A0_PIN, HIGH); } + + static void WriteSequence(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); } + // static void WriteMultiple(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); } + static void WriteMultiple(uint16_t Color, uint32_t Count) { + static uint16_t Data; Data = Color; + //LPC dma can only write 0xFFF bytes at once. + #define MAX_DMA_SIZE (0xFFF - 1) + while (Count > 0) { + TransmitDMA(DMA_MINC_DISABLE, &Data, Count > MAX_DMA_SIZE ? MAX_DMA_SIZE : Count); + Count = Count > MAX_DMA_SIZE ? Count - MAX_DMA_SIZE : 0; + } + #undef MAX_DMA_SIZE + } +}; diff --git a/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp new file mode 100644 index 000000000000..c72e5f0eac44 --- /dev/null +++ b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp @@ -0,0 +1,129 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 HAS_TFT_XPT2046 || HAS_TOUCH_XPT2046 + +#include "xpt2046.h" +#include + +uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; } + +#if ENABLED(TOUCH_BUTTONS_HW_SPI) + #include + + SPIClass XPT2046::SPIx(TOUCH_BUTTONS_HW_SPI_DEVICE); + + static void touch_spi_init(uint8_t spiRate) { + XPT2046::SPIx.setModule(TOUCH_BUTTONS_HW_SPI_DEVICE); + XPT2046::SPIx.setClock(SPI_CLOCK_DIV128); + XPT2046::SPIx.setBitOrder(MSBFIRST); + XPT2046::SPIx.setDataMode(SPI_MODE0); + XPT2046::SPIx.setDataSize(DATA_SIZE_8BIT); + } +#endif + +void XPT2046::Init() { + SET_INPUT(TOUCH_MISO_PIN); + SET_OUTPUT(TOUCH_MOSI_PIN); + SET_OUTPUT(TOUCH_SCK_PIN); + OUT_WRITE(TOUCH_CS_PIN, HIGH); + + #if PIN_EXISTS(TOUCH_INT) + // Optional Pendrive interrupt pin + SET_INPUT(TOUCH_INT_PIN); + #endif + + TERN_(TOUCH_BUTTONS_HW_SPI, touch_spi_init(SPI_SPEED_6)); + + // Read once to enable pendrive status pin + getRawData(XPT2046_X); +} + +bool XPT2046::isTouched() { + return isBusy() ? false : ( + #if PIN_EXISTS(TOUCH_INT) + READ(TOUCH_INT_PIN) != HIGH + #else + getRawData(XPT2046_Z1) >= XPT2046_Z1_THRESHOLD + #endif + ); +} + +bool XPT2046::getRawPoint(int16_t *x, int16_t *y) { + if (isBusy()) return false; + if (!isTouched()) return false; + *x = getRawData(XPT2046_X); + *y = getRawData(XPT2046_Y); + SERIAL_ECHOLNPAIR("X: ", *x, ", Y: ", *y); + return isTouched(); +} + +uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) { + uint16_t data[3]; + + DataTransferBegin(); + TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin()); + + for (uint16_t i = 0; i < 3 ; i++) { + IO(coordinate); + data[i] = (IO() << 4) | (IO() >> 4); + } + + TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end()); + DataTransferEnd(); + + uint16_t delta01 = delta(data[0], data[1]), + delta02 = delta(data[0], data[2]), + delta12 = delta(data[1], data[2]); + + if (delta01 > delta02 || delta01 > delta12) + data[delta02 > delta12 ? 0 : 1] = data[2]; + + return (data[0] + data[1]) >> 1; +} + +uint16_t XPT2046::IO(uint16_t data) { + return TERN(TOUCH_BUTTONS_HW_SPI, HardwareIO, SoftwareIO)(data); +} + +extern uint8_t spiTransfer(uint8_t b); + +#if ENABLED(TOUCH_BUTTONS_HW_SPI) + uint16_t XPT2046::HardwareIO(uint16_t data) { + return SPIx.transfer(data & 0xFF); + } +#endif + +uint16_t XPT2046::SoftwareIO(uint16_t data) { + uint16_t result = 0; + + for (uint8_t j = 0x80; j; j >>= 1) { + WRITE(TOUCH_SCK_PIN, LOW); + WRITE(TOUCH_MOSI_PIN, data & j ? HIGH : LOW); + if (READ(TOUCH_MISO_PIN)) result |= j; + WRITE(TOUCH_SCK_PIN, HIGH); + } + WRITE(TOUCH_SCK_PIN, LOW); + + return result; +} + +#endif // HAS_TFT_XPT2046 diff --git a/Marlin/src/HAL/LPC1768/tft/xpt2046.h b/Marlin/src/HAL/LPC1768/tft/xpt2046.h new file mode 100644 index 000000000000..019f75efce12 --- /dev/null +++ b/Marlin/src/HAL/LPC1768/tft/xpt2046.h @@ -0,0 +1,80 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * 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 . + * + */ +#pragma once + +#include "../../../inc/MarlinConfig.h" + +#if ENABLED(TOUCH_BUTTONS_HW_SPI) + #include +#endif + +#ifndef TOUCH_MISO_PIN + #define TOUCH_MISO_PIN MISO_PIN +#endif +#ifndef TOUCH_MOSI_PIN + #define TOUCH_MOSI_PIN MOSI_PIN +#endif +#ifndef TOUCH_SCK_PIN + #define TOUCH_SCK_PIN SCK_PIN +#endif +#ifndef TOUCH_CS_PIN + #define TOUCH_CS_PIN CS_PIN +#endif +#ifndef TOUCH_INT_PIN + #define TOUCH_INT_PIN -1 +#endif + +#define XPT2046_DFR_MODE 0x00 +#define XPT2046_SER_MODE 0x04 +#define XPT2046_CONTROL 0x80 + +enum XPTCoordinate : uint8_t { + XPT2046_X = 0x10 | XPT2046_CONTROL | XPT2046_DFR_MODE, + XPT2046_Y = 0x50 | XPT2046_CONTROL | XPT2046_DFR_MODE, + XPT2046_Z1 = 0x30 | XPT2046_CONTROL | XPT2046_DFR_MODE, + XPT2046_Z2 = 0x40 | XPT2046_CONTROL | XPT2046_DFR_MODE, +}; + +#if !defined(XPT2046_Z1_THRESHOLD) + #define XPT2046_Z1_THRESHOLD 10 +#endif + +class XPT2046 { +private: + static bool isBusy() { return false; } + + static uint16_t getRawData(const XPTCoordinate coordinate); + static bool isTouched(); + + static inline void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); }; + static inline void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); }; + #if ENABLED(TOUCH_BUTTONS_HW_SPI) + static uint16_t HardwareIO(uint16_t data); + #endif + static uint16_t SoftwareIO(uint16_t data); + static uint16_t IO(uint16_t data = 0); + +public: + #if ENABLED(TOUCH_BUTTONS_HW_SPI) + static SPIClass SPIx; + #endif + + static void Init(); + static bool getRawPoint(int16_t *x, int16_t *y); +}; diff --git a/Marlin/src/HAL/STM32/SoftwareSerial.cpp b/Marlin/src/HAL/STM32/SoftwareSerial.cpp deleted file mode 100644 index 2228a177be66..000000000000 --- a/Marlin/src/HAL/STM32/SoftwareSerial.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/* - * SoftwareSerial.cpp (formerly NewSoftSerial.cpp) - * - * Multi-instance software serial library for Arduino/Wiring - * -- Interrupt-driven receive and other improvements by ladyada - * - * -- Tuning, circular buffer, derivation from class Print/Stream, - * multi-instance support, porting to 8MHz processors, - * various optimizations, PROGMEM delay tables, inverse logic and - * direct port writing by Mikal Hart - * -- Pin change interrupt macros by Paul Stoffregen - * -- 20MHz processor support by Garrett Mace - * -- ATmega1280/2560 support by Brett Hagman - * -- STM32 support by Armin van der Togt - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The latest version of this library can always be found at - * http://arduiniana.org. - */ - -// -// Includes -// -#if defined(PLATFORMIO) && defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) - -#include "../../inc/MarlinConfig.h" - -#include "SoftwareSerial.h" - -#define OVERSAMPLE 3 // in RX, Timer will generate interruption OVERSAMPLE time during a bit. Thus OVERSAMPLE ticks in a bit. (interrupt not synchonized with edge). - -// defined in bit-periods -#define HALFDUPLEX_SWITCH_DELAY 5 -// It's best to define TIMER_SERIAL in variant.h. If not defined, we choose one here -// The order is based on (lack of) features and compare channels, we choose the simplest available -// because we only need an update interrupt -#if !defined(TIMER_SERIAL) -#if defined(TIM18_BASE) -#define TIMER_SERIAL TIM18 -#elif defined(TIM7_BASE) -#define TIMER_SERIAL TIM7 -#elif defined(TIM6_BASE) -#define TIMER_SERIAL TIM6 -#elif defined(TIM22_BASE) -#define TIMER_SERIAL TIM22 -#elif defined(TIM21_BASE) -#define TIMER_SERIAL TIM21 -#elif defined(TIM17_BASE) -#define TIMER_SERIAL TIM17 -#elif defined(TIM16_BASE) -#define TIMER_SERIAL TIM16 -#elif defined(TIM15_BASE) -#define TIMER_SERIAL TIM15 -#elif defined(TIM14_BASE) -#define TIMER_SERIAL TIM14 -#elif defined(TIM13_BASE) -#define TIMER_SERIAL TIM13 -#elif defined(TIM11_BASE) -#define TIMER_SERIAL TIM11 -#elif defined(TIM10_BASE) -#define TIMER_SERIAL TIM10 -#elif defined(TIM12_BASE) -#define TIMER_SERIAL TIM12 -#elif defined(TIM19_BASE) -#define TIMER_SERIAL TIM19 -#elif defined(TIM9_BASE) -#define TIMER_SERIAL TIM9 -#elif defined(TIM5_BASE) -#define TIMER_SERIAL TIM5 -#elif defined(TIM4_BASE) -#define TIMER_SERIAL TIM4 -#elif defined(TIM3_BASE) -#define TIMER_SERIAL TIM3 -#elif defined(TIM2_BASE) -#define TIMER_SERIAL TIM2 -#elif defined(TIM20_BASE) -#define TIMER_SERIAL TIM20 -#elif defined(TIM8_BASE) -#define TIMER_SERIAL TIM8 -#elif defined(TIM1_BASE) -#define TIMER_SERIAL TIM1 -#else -#error No suitable timer found for SoftwareSerial, define TIMER_SERIAL in variant.h -#endif -#endif -// -// Statics -// -HardwareTimer SoftwareSerial::timer(TIMER_SERIAL); -const IRQn_Type SoftwareSerial::timer_interrupt_number = static_cast(getTimerUpIrq(TIMER_SERIAL)); -uint32_t SoftwareSerial::timer_interrupt_priority = NVIC_EncodePriority(NVIC_GetPriorityGrouping(), TIM_IRQ_PRIO, TIM_IRQ_SUBPRIO); -SoftwareSerial *SoftwareSerial::active_listener = nullptr; -SoftwareSerial *volatile SoftwareSerial::active_out = nullptr; -SoftwareSerial *volatile SoftwareSerial::active_in = nullptr; -int32_t SoftwareSerial::tx_tick_cnt = 0; // OVERSAMPLE ticks needed for a bit -int32_t volatile SoftwareSerial::rx_tick_cnt = 0; // OVERSAMPLE ticks needed for a bit -uint32_t SoftwareSerial::tx_buffer = 0; -int32_t SoftwareSerial::tx_bit_cnt = 0; -uint32_t SoftwareSerial::rx_buffer = 0; -int32_t SoftwareSerial::rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit -uint32_t SoftwareSerial::cur_speed = 0; - -void SoftwareSerial::setInterruptPriority(uint32_t preemptPriority, uint32_t subPriority) { - timer_interrupt_priority = NVIC_EncodePriority(NVIC_GetPriorityGrouping(), preemptPriority, subPriority); -} - -// -// Private methods -// - -void SoftwareSerial::setSpeed(uint32_t speed) { - if (speed != cur_speed) { - timer.pause(); - if (speed != 0) { - // Disable the timer - uint32_t clock_rate, cmp_value; - // Get timer clock - clock_rate = timer.getTimerClkFreq(); - int pre = 1; - // Calculate prescale an compare value - do { - cmp_value = clock_rate / (speed * OVERSAMPLE); - if (cmp_value >= UINT16_MAX) { - clock_rate /= 2; - pre *= 2; - } - } while (cmp_value >= UINT16_MAX); - timer.setPrescaleFactor(pre); - timer.setOverflow(cmp_value); - timer.setCount(0); - timer.attachInterrupt(&handleInterrupt); - timer.resume(); - NVIC_SetPriority(timer_interrupt_number, timer_interrupt_priority); - } - else - timer.detachInterrupt(); - cur_speed = speed; - } -} - -// This function sets the current object as the "listening" -// one and returns true if it replaces another -bool SoftwareSerial::listen() { - if (active_listener != this) { - // wait for any transmit to complete as we may change speed - while (active_out); - active_listener->stopListening(); - rx_tick_cnt = 1; // 1 : next interrupt will decrease rx_tick_cnt to 0 which means RX pin level will be considered. - rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit - setSpeed(_speed); - active_listener = this; - if (!_half_duplex) active_in = this; - return true; - } - return false; -} - -// Stop listening. Returns true if we were actually listening. -bool SoftwareSerial::stopListening() { - if (active_listener == this) { - // wait for any output to complete - while (active_out); - if (_half_duplex) setRXTX(false); - active_listener = nullptr; - active_in = nullptr; - // turn off ints - setSpeed(0); - return true; - } - return false; -} - -inline void SoftwareSerial::setTX() { - if (_inverse_logic) - LL_GPIO_ResetOutputPin(_transmitPinPort, _transmitPinNumber); - else - LL_GPIO_SetOutputPin(_transmitPinPort, _transmitPinNumber); - pinMode(_transmitPin, OUTPUT); -} - -inline void SoftwareSerial::setRX() { - pinMode(_receivePin, _inverse_logic ? INPUT_PULLDOWN : INPUT_PULLUP); // pullup for normal logic! -} - -inline void SoftwareSerial::setRXTX(bool input) { - if (_half_duplex) { - if (input) { - if (active_in != this) { - setRX(); - rx_bit_cnt = -1; // rx_bit_cnt = -1 : waiting for start bit - rx_tick_cnt = 2; // 2 : next interrupt will be discarded. 2 interrupts required to consider RX pin level - active_in = this; - } - } - else { - if (active_in == this) { - setTX(); - active_in = nullptr; - } - } - } -} - -inline void SoftwareSerial::send() { - if (--tx_tick_cnt <= 0) { // if tx_tick_cnt > 0 interrupt is discarded. Only when tx_tick_cnt reaches 0 is TX pin set. - if (tx_bit_cnt++ < 10) { // tx_bit_cnt < 10 transmission is not finished (10 = 1 start +8 bits + 1 stop) - // Send data (including start and stop bits) - if (tx_buffer & 1) - LL_GPIO_SetOutputPin(_transmitPinPort, _transmitPinNumber); - else - LL_GPIO_ResetOutputPin(_transmitPinPort, _transmitPinNumber); - tx_buffer >>= 1; - tx_tick_cnt = OVERSAMPLE; // Wait OVERSAMPLE ticks to send next bit - } - else { // Transmission finished - tx_tick_cnt = 1; - if (_output_pending) { - active_out = nullptr; - - // In half-duplex mode wait HALFDUPLEX_SWITCH_DELAY bit-periods after the byte has - // been transmitted before allowing the switch to RX mode - } - else if (tx_bit_cnt > 10 + OVERSAMPLE * HALFDUPLEX_SWITCH_DELAY) { - if (_half_duplex && active_listener == this) setRXTX(true); - active_out = nullptr; - } - } - } -} - -// -// The receive routine called by the interrupt handler -// -inline void SoftwareSerial::recv() { - if (--rx_tick_cnt <= 0) { // if rx_tick_cnt > 0 interrupt is discarded. Only when rx_tick_cnt reaches 0 is RX pin considered - bool inbit = LL_GPIO_IsInputPinSet(_receivePinPort, _receivePinNumber) ^ _inverse_logic; - if (rx_bit_cnt == -1) { // rx_bit_cnt = -1 : waiting for start bit - if (!inbit) { - // got start bit - rx_bit_cnt = 0; // rx_bit_cnt == 0 : start bit received - rx_tick_cnt = OVERSAMPLE + 1; // Wait 1 bit (OVERSAMPLE ticks) + 1 tick in order to sample RX pin in the middle of the edge (and not too close to the edge) - rx_buffer = 0; - } - else - rx_tick_cnt = 1; // Waiting for start bit, but wrong level. Wait for next Interrupt to check RX pin level - } - else if (rx_bit_cnt >= 8) { // rx_bit_cnt >= 8 : waiting for stop bit - if (inbit) { - // Stop-bit read complete. Add to buffer. - uint8_t next = (_receive_buffer_tail + 1) % _SS_MAX_RX_BUFF; - if (next != _receive_buffer_head) { - // save new data in buffer: tail points to byte destination - _receive_buffer[_receive_buffer_tail] = rx_buffer; // save new byte - _receive_buffer_tail = next; - } - else // rx_bit_cnt = x with x = [0..7] correspond to new bit x received - _buffer_overflow = true; - } - // Full trame received. Restart waiting for start bit at next interrupt - rx_tick_cnt = 1; - rx_bit_cnt = -1; - } - else { - // data bits - rx_buffer >>= 1; - if (inbit) rx_buffer |= 0x80; - rx_bit_cnt++; // Prepare for next bit - rx_tick_cnt = OVERSAMPLE; // Wait OVERSAMPLE ticks before sampling next bit - } - } -} - -// -// Interrupt handling -// - -/* static */ -inline void SoftwareSerial::handleInterrupt(HardwareTimer*) { - if (active_in) active_in->recv(); - if (active_out) active_out->send(); -} - -// -// Constructor -// -SoftwareSerial::SoftwareSerial(uint16_t receivePin, uint16_t transmitPin, bool inverse_logic /* = false */) : - _receivePin(receivePin), - _transmitPin(transmitPin), - _receivePinPort(digitalPinToPort(receivePin)), - _receivePinNumber(STM_LL_GPIO_PIN(digitalPinToPinName(receivePin))), - _transmitPinPort(digitalPinToPort(transmitPin)), - _transmitPinNumber(STM_LL_GPIO_PIN(digitalPinToPinName(transmitPin))), - _speed(0), - _buffer_overflow(false), - _inverse_logic(inverse_logic), - _half_duplex(receivePin == transmitPin), - _output_pending(0), - _receive_buffer_tail(0), - _receive_buffer_head(0) -{ - if ((receivePin < NUM_DIGITAL_PINS) || (transmitPin < NUM_DIGITAL_PINS)) { - /* Enable GPIO clock for tx and rx pin*/ - set_GPIO_Port_Clock(STM_PORT(digitalPinToPinName(transmitPin))); - set_GPIO_Port_Clock(STM_PORT(digitalPinToPinName(receivePin))); - } - else - _Error_Handler("ERROR: invalid pin number\n", -1); -} - -// -// Destructor -// -SoftwareSerial::~SoftwareSerial() { end(); } - -// -// Public methods -// - -void SoftwareSerial::begin(long speed) { - #ifdef FORCE_BAUD_RATE - speed = FORCE_BAUD_RATE; - #endif - _speed = speed; - if (!_half_duplex) { - setTX(); - setRX(); - listen(); - } - else - setTX(); -} - -void SoftwareSerial::end() { - stopListening(); -} - -// Read data from buffer -int SoftwareSerial::read() { - // Empty buffer? - if (_receive_buffer_head == _receive_buffer_tail) return -1; - - // Read from "head" - uint8_t d = _receive_buffer[_receive_buffer_head]; // grab next byte - _receive_buffer_head = (_receive_buffer_head + 1) % _SS_MAX_RX_BUFF; - return d; -} - -int SoftwareSerial::available() { - return (_receive_buffer_tail + _SS_MAX_RX_BUFF - _receive_buffer_head) % _SS_MAX_RX_BUFF; -} - -size_t SoftwareSerial::write(uint8_t b) { - // wait for previous transmit to complete - _output_pending = 1; - while (active_out) { /* nada */ } - // add start and stop bits. - tx_buffer = b << 1 | 0x200; - if (_inverse_logic) tx_buffer = ~tx_buffer; - tx_bit_cnt = 0; - tx_tick_cnt = OVERSAMPLE; - setSpeed(_speed); - if (_half_duplex) setRXTX(false); - _output_pending = 0; - // make us active - active_out = this; - return 1; -} - -void SoftwareSerial::flush() { - noInterrupts(); - _receive_buffer_head = _receive_buffer_tail = 0; - interrupts(); -} - -int SoftwareSerial::peek() { - // Empty buffer? - if (_receive_buffer_head == _receive_buffer_tail) return -1; - - // Read from "head" - return _receive_buffer[_receive_buffer_head]; -} - -#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC diff --git a/Marlin/src/HAL/STM32/SoftwareSerial.h b/Marlin/src/HAL/STM32/SoftwareSerial.h deleted file mode 100644 index 1a4f742c32fa..000000000000 --- a/Marlin/src/HAL/STM32/SoftwareSerial.h +++ /dev/null @@ -1,114 +0,0 @@ -/** - * SoftwareSerial.h (formerly NewSoftSerial.h) - * - * Multi-instance software serial library for Arduino/Wiring - * -- Interrupt-driven receive and other improvements by ladyada - * (https://ladyada.net) - * -- Tuning, circular buffer, derivation from class Print/Stream, - * multi-instance support, porting to 8MHz processors, - * various optimizations, PROGMEM delay tables, inverse logic and - * direct port writing by Mikal Hart (http://www.arduiniana.org) - * -- Pin change interrupt macros by Paul Stoffregen (https://www.pjrc.com) - * -- 20MHz processor support by Garrett Mace (http://www.macetech.com) - * -- ATmega1280/2560 support by Brett Hagman (https://www.roguerobotics.com/) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * The latest version of this library can always be found at - * http://arduiniana.org. - */ -#pragma once - -#include - -/****************************************************************************** - * Definitions - ******************************************************************************/ - -#define _SS_MAX_RX_BUFF 64 // RX buffer size - -class SoftwareSerial : public Stream { - private: - // per object data - uint16_t _receivePin; - uint16_t _transmitPin; - GPIO_TypeDef *_receivePinPort; - uint32_t _receivePinNumber; - GPIO_TypeDef *_transmitPinPort; - uint32_t _transmitPinNumber; - uint32_t _speed; - - uint16_t _buffer_overflow: 1; - uint16_t _inverse_logic: 1; - uint16_t _half_duplex: 1; - uint16_t _output_pending: 1; - - unsigned char _receive_buffer[_SS_MAX_RX_BUFF]; - volatile uint8_t _receive_buffer_tail; - volatile uint8_t _receive_buffer_head; - - uint32_t delta_start = 0; - - // static data - static HardwareTimer timer; - static const IRQn_Type timer_interrupt_number; - static uint32_t timer_interrupt_priority; - static SoftwareSerial *active_listener; - static SoftwareSerial *volatile active_out; - static SoftwareSerial *volatile active_in; - static int32_t tx_tick_cnt; - static volatile int32_t rx_tick_cnt; - static uint32_t tx_buffer; - static int32_t tx_bit_cnt; - static uint32_t rx_buffer; - static int32_t rx_bit_cnt; - static uint32_t cur_speed; - - // private methods - void send(); - void recv(); - void setTX(); - void setRX(); - void setSpeed(uint32_t speed); - void setRXTX(bool input); - static void handleInterrupt(HardwareTimer *timer); - - public: - // public methods - - SoftwareSerial(uint16_t receivePin, uint16_t transmitPin, bool inverse_logic=false); - virtual ~SoftwareSerial(); - void begin(long speed); - bool listen(); - void end(); - bool isListening() { return active_listener == this; } - bool stopListening(); - bool overflow() { - bool ret = _buffer_overflow; - if (ret) _buffer_overflow = false; - return ret; - } - int peek(); - - virtual size_t write(uint8_t byte); - virtual int read(); - virtual int available(); - virtual void flush(); - operator bool() { return true; } - - static void setInterruptPriority(uint32_t preemptPriority, uint32_t subPriority); - - using Print::write; -}; diff --git a/Marlin/src/HAL/STM32/timers.cpp b/Marlin/src/HAL/STM32/timers.cpp index 11967314480f..c0ba19abe545 100644 --- a/Marlin/src/HAL/STM32/timers.cpp +++ b/Marlin/src/HAL/STM32/timers.cpp @@ -110,7 +110,6 @@ // ------------------------ HardwareTimer *timer_instance[NUM_HARDWARE_TIMERS] = { NULL }; -bool timer_enabled[NUM_HARDWARE_TIMERS] = { false }; // ------------------------ // Public functions @@ -135,6 +134,7 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { * which changes the prescaler when an IRQ frequency change is needed * (for example when steppers are turned on) */ + timer_instance[timer_num]->setPrescaleFactor(STEPPER_TIMER_PRESCALE); //the -1 is done internally timer_instance[timer_num]->setOverflow(_MIN(hal_timer_t(HAL_TIMER_TYPE_MAX), (HAL_TIMER_RATE) / (STEPPER_TIMER_PRESCALE) /* /frequency */), TICK_FORMAT); break; @@ -145,15 +145,13 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { break; } + // Disable preload. Leaving it default-enabled can cause the timer to stop if it happens + // to exit the ISR after the start time for the next interrupt has already passed. + timer_instance[timer_num]->setPreloadEnable(false); + HAL_timer_enable_interrupt(timer_num); - /* - * Initializes (and unfortunately starts) the timer. - * This is needed to set correct IRQ priority at the moment but causes - * no harm since every call to HAL_timer_start() is actually followed by - * a call to HAL_timer_enable_interrupt() which means that there isn't - * a case in which you want the timer to run without a callback. - */ + // Start the timer. timer_instance[timer_num]->resume(); // First call to resume() MUST follow the attachInterrupt() // This is fixed in Arduino_Core_STM32 1.8. @@ -161,47 +159,34 @@ void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { // timer_instance[timer_num]->setInterruptPriority switch (timer_num) { case STEP_TIMER_NUM: - HAL_NVIC_SetPriority(STEP_TIMER_IRQ_NAME, STEP_TIMER_IRQ_PRIO, 0); + timer_instance[timer_num]->setInterruptPriority(STEP_TIMER_IRQ_PRIO, 0); break; case TEMP_TIMER_NUM: - HAL_NVIC_SetPriority(TEMP_TIMER_IRQ_NAME, TEMP_TIMER_IRQ_PRIO, 0); + timer_instance[timer_num]->setInterruptPriority(TEMP_TIMER_IRQ_PRIO, 0); break; } } } void HAL_timer_enable_interrupt(const uint8_t timer_num) { - if (HAL_timer_initialized(timer_num) && !timer_enabled[timer_num]) { - timer_enabled[timer_num] = true; + if (HAL_timer_initialized(timer_num) && !timer_instance[timer_num]->hasInterrupt()) { switch (timer_num) { case STEP_TIMER_NUM: - timer_instance[timer_num]->attachInterrupt(Step_Handler); - break; - case TEMP_TIMER_NUM: - timer_instance[timer_num]->attachInterrupt(Temp_Handler); - break; + timer_instance[timer_num]->attachInterrupt(Step_Handler); + break; + case TEMP_TIMER_NUM: + timer_instance[timer_num]->attachInterrupt(Temp_Handler); + break; } } } void HAL_timer_disable_interrupt(const uint8_t timer_num) { - if (HAL_timer_interrupt_enabled(timer_num)) { - timer_instance[timer_num]->detachInterrupt(); - timer_enabled[timer_num] = false; - } + if (HAL_timer_initialized(timer_num)) timer_instance[timer_num]->detachInterrupt(); } bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { - return HAL_timer_initialized(timer_num) && timer_enabled[timer_num]; -} - -// Only for use within the HAL -TIM_TypeDef * HAL_timer_device(const uint8_t timer_num) { - switch (timer_num) { - case STEP_TIMER_NUM: return STEP_TIMER_DEV; - case TEMP_TIMER_NUM: return TEMP_TIMER_DEV; - } - return nullptr; + return HAL_timer_initialized(timer_num) && timer_instance[timer_num]->hasInterrupt(); } void SetTimerInterruptPriorities() { @@ -209,4 +194,87 @@ void SetTimerInterruptPriorities() { TERN_(HAS_SERVOS, libServo::setInterruptPriority(SERVO_TIMER_IRQ_PRIO, 0)); } +// This is a terrible hack to replicate the behavior used in the framework's SoftwareSerial.cpp +// to choose a serial timer. It will select TIM7 on most boards used by Marlin, but this is more +// resiliant to new MCUs which may not have a TIM7. Best practice is to explicitly specify +// TIMER_SERIAL to avoid relying on framework selections which may not be predictable. +#if !defined(TIMER_SERIAL) + #if defined (TIM18_BASE) + #define TIMER_SERIAL TIM18 + #elif defined (TIM7_BASE) + #define TIMER_SERIAL TIM7 + #elif defined (TIM6_BASE) + #define TIMER_SERIAL TIM6 + #elif defined (TIM22_BASE) + #define TIMER_SERIAL TIM22 + #elif defined (TIM21_BASE) + #define TIMER_SERIAL TIM21 + #elif defined (TIM17_BASE) + #define TIMER_SERIAL TIM17 + #elif defined (TIM16_BASE) + #define TIMER_SERIAL TIM16 + #elif defined (TIM15_BASE) + #define TIMER_SERIAL TIM15 + #elif defined (TIM14_BASE) + #define TIMER_SERIAL TIM14 + #elif defined (TIM13_BASE) + #define TIMER_SERIAL TIM13 + #elif defined (TIM11_BASE) + #define TIMER_SERIAL TIM11 + #elif defined (TIM10_BASE) + #define TIMER_SERIAL TIM10 + #elif defined (TIM12_BASE) + #define TIMER_SERIAL TIM12 + #elif defined (TIM19_BASE) + #define TIMER_SERIAL TIM19 + #elif defined (TIM9_BASE) + #define TIMER_SERIAL TIM9 + #elif defined (TIM5_BASE) + #define TIMER_SERIAL TIM5 + #elif defined (TIM4_BASE) + #define TIMER_SERIAL TIM4 + #elif defined (TIM3_BASE) + #define TIMER_SERIAL TIM3 + #elif defined (TIM2_BASE) + #define TIMER_SERIAL TIM2 + #elif defined (TIM20_BASE) + #define TIMER_SERIAL TIM20 + #elif defined (TIM8_BASE) + #define TIMER_SERIAL TIM8 + #elif defined (TIM1_BASE) + #define TIMER_SERIAL TIM1 + #else + #error No suitable timer found for SoftwareSerial, define TIMER_SERIAL in variant.h + #endif +#endif + +// Place all timers used into an array, then recursively check for duplicates during compilation. +// This does not currently account for timers used for PWM, such as for fans. +// Timers are actually pointers. Convert to integers to simplify constexpr logic. +static constexpr uintptr_t timers_in_use[] = { + uintptr_t(TEMP_TIMER_DEV), // Override in pins file + uintptr_t(STEP_TIMER_DEV), // Override in pins file + #if HAS_TMC_SW_SERIAL + uintptr_t(TIMER_SERIAL), // Set in variant.h, or as a define in platformio.h if not present in variant.h + #endif + #if ENABLED(SPEAKER) + uintptr_t(TIMER_TONE), // Set in variant.h, or as a define in platformio.h if not present in variant.h + #endif + #if HAS_SERVOS + uintptr_t(TIMER_SERVO), // Set in variant.h, or as a define in platformio.h if not present in variant.h + #endif + }; + +static constexpr bool verify_no_duplicate_timers() { + LOOP_L_N(i, COUNT(timers_in_use)) + LOOP_S_L_N(j, i + 1, COUNT(timers_in_use)) + if (timers_in_use[i] == timers_in_use[j]) return false; + return true; +} + +// If this assertion fails at compile time, review the timers_in_use array. If default_envs is +// defined properly in platformio.ini, VS Code can evaluate the array when hovering over it, +// making it easy to identify the conflicting timers. +static_assert(verify_no_duplicate_timers(), "One or more timer conflict detected"); + #endif // ARDUINO_ARCH_STM32 && !STM32GENERIC diff --git a/Marlin/src/HAL/STM32/timers.h b/Marlin/src/HAL/STM32/timers.h index 000f86043bb3..5515219ead00 100644 --- a/Marlin/src/HAL/STM32/timers.h +++ b/Marlin/src/HAL/STM32/timers.h @@ -30,8 +30,18 @@ #define FORCE_INLINE __attribute__((always_inline)) inline +// STM32 timers may be 16 or 32 bit. Limiting HAL_TIMER_TYPE_MAX to 16 bits +// avoids issues with STM32F0 MCUs, which seem to pause timers if UINT32_MAX +// is written to the register. STM32F4 timers do not manifest this issue, +// even when writing to 16 bit timers. +// +// The range of the timer can be queried at runtime using IS_TIM_32B_COUNTER_INSTANCE. +// This is a more expensive check than a simple compile-time constant, so its +// implementation is deferred until the desire for a 32-bit range outweighs the cost +// of adding a run-time check and HAL_TIMER_TYPE_MAX is refactored to allow unique +// values for each timer. #define hal_timer_t uint32_t -#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF // Timers can be 16 or 32 bit +#define HAL_TIMER_TYPE_MAX UINT16_MAX #ifndef STEP_TIMER_NUM #define STEP_TIMER_NUM 0 // Timer Index for Stepper @@ -61,14 +71,14 @@ #define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) #define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) -extern void Step_Handler(HardwareTimer *htim); -extern void Temp_Handler(HardwareTimer *htim); +extern void Step_Handler(); +extern void Temp_Handler(); #ifndef HAL_STEP_TIMER_ISR - #define HAL_STEP_TIMER_ISR() void Step_Handler(HardwareTimer *htim) + #define HAL_STEP_TIMER_ISR() void Step_Handler() #endif #ifndef HAL_TEMP_TIMER_ISR - #define HAL_TEMP_TIMER_ISR() void Temp_Handler(HardwareTimer *htim) + #define HAL_TEMP_TIMER_ISR() void Temp_Handler() #endif // ------------------------ @@ -90,8 +100,6 @@ bool HAL_timer_interrupt_enabled(const uint8_t timer_num); // Exposed here to allow all timer priority information to reside in timers.cpp void SetTimerInterruptPriorities(); -//TIM_TypeDef* HAL_timer_device(const uint8_t timer_num); no need to be public for now. not public = not used externally - // FORCE_INLINE because these are used in performance-critical situations FORCE_INLINE bool HAL_timer_initialized(const uint8_t timer_num) { return timer_instance[timer_num] != NULL; diff --git a/Marlin/src/HAL/STM32F1/HAL.h b/Marlin/src/HAL/STM32F1/HAL.h index 5a0b0460092b..f76d8c54a0e3 100644 --- a/Marlin/src/HAL/STM32F1/HAL.h +++ b/Marlin/src/HAL/STM32F1/HAL.h @@ -46,6 +46,8 @@ #include "msc_sd.h" #endif +#include "MarlinSerial.h" + // ------------------------ // Defines // ------------------------ @@ -64,17 +66,6 @@ #else #define UsbSerial MarlinCompositeSerial #endif - #define MSerial1 Serial1 - #define MSerial2 Serial2 - #define MSerial3 Serial3 - #define MSerial4 Serial4 - #define MSerial5 Serial5 -#else - #define MSerial1 Serial - #define MSerial2 Serial1 - #define MSerial3 Serial2 - #define MSerial4 Serial3 - #define MSerial5 Serial4 #endif #if SERIAL_PORT == 0 diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp new file mode 100644 index 000000000000..f965bc99cf06 --- /dev/null +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp @@ -0,0 +1,93 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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/MarlinConfigPre.h" +#include "MarlinSerial.h" +#include + +// Copied from ~/.platformio/packages/framework-arduinoststm32-maple/STM32F1/system/libmaple/usart_private.h +// Changed to handle Emergency Parser +static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb, usart_reg_map *regs, MarlinSerial &serial) { + /* Handle RXNEIE and TXEIE interrupts. + * RXNE signifies availability of a byte in DR. + * + * See table 198 (sec 27.4, p809) in STM document RM0008 rev 15. + * We enable RXNEIE. + */ + if ((regs->CR1 & USART_CR1_RXNEIE) && (regs->SR & USART_SR_RXNE)) { + uint8_t c = (uint8)regs->DR; + #ifdef USART_SAFE_INSERT + // If the buffer is full and the user defines USART_SAFE_INSERT, + // ignore new bytes. + rb_safe_insert(rb, c); + #else + // By default, push bytes around in the ring buffer. + rb_push_insert(rb, c); + #endif + #if ENABLED(EMERGENCY_PARSER) + emergency_parser.update(serial.emergency_state, c); + #endif + } + // TXE signifies readiness to send a byte to DR. + if ((regs->CR1 & USART_CR1_TXEIE) && (regs->SR & USART_SR_TXE)) { + if (!rb_is_empty(wb)) + regs->DR=rb_remove(wb); + else + regs->CR1 &= ~((uint32)USART_CR1_TXEIE); // disable TXEIE + } +} + +#define DEFINE_HWSERIAL_MARLIN(name, n) \ + MarlinSerial name(USART##n, \ + BOARD_USART##n##_TX_PIN, \ + BOARD_USART##n##_RX_PIN); \ + extern "C" void __irq_usart##n(void) { \ + my_usart_irq(USART##n->rb, USART##n->wb, USART##n##_BASE, MSerial##n); \ + } + +#define DEFINE_HWSERIAL_UART_MARLIN(name, n) \ + MarlinSerial name(UART##n, \ + BOARD_USART##n##_TX_PIN, \ + BOARD_USART##n##_RX_PIN); \ + extern "C" void __irq_usart##n(void) { \ + my_usart_irq(USART##n->rb, USART##n->wb, USART##n##_BASE, MSerial##n); \ + } + +#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1 || DGUS_SERIAL_PORT == 1 + DEFINE_HWSERIAL_MARLIN(MSerial1, 1); +#endif + +#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2 || DGUS_SERIAL_PORT == 2 + DEFINE_HWSERIAL_MARLIN(MSerial2, 2); +#endif + +#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3 || DGUS_SERIAL_PORT == 3 + DEFINE_HWSERIAL_MARLIN(MSerial3, 3); +#endif + +#if SERIAL_PORT == 4 || SERIAL_PORT_2 == 4 || DGUS_SERIAL_PORT == 4 + DEFINE_HWSERIAL_UART_MARLIN(MSerial4, 4); +#endif + +#if SERIAL_PORT == 5 || SERIAL_PORT_2 == 5 || DGUS_SERIAL_PORT == 5 + DEFINE_HWSERIAL_UART_MARLIN(MSerial5, 5); +#endif diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.h b/Marlin/src/HAL/STM32F1/MarlinSerial.h new file mode 100644 index 000000000000..4e8a47d2f909 --- /dev/null +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.h @@ -0,0 +1,50 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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 . + * + */ +#pragma once + +#include +#include + +#include "../../inc/MarlinConfigPre.h" +#if ENABLED(EMERGENCY_PARSER) + #include "../../feature/e_parser.h" +#endif + +class MarlinSerial : public HardwareSerial { +public: + MarlinSerial(struct usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) : + HardwareSerial(usart_device, tx_pin, rx_pin) + #if ENABLED(EMERGENCY_PARSER) + , emergency_state(EmergencyParser::State::EP_RESET) + #endif + { } + + #if ENABLED(EMERGENCY_PARSER) + EmergencyParser::State emergency_state; + #endif +}; + +extern MarlinSerial MSerial1; +extern MarlinSerial MSerial2; +extern MarlinSerial MSerial3; +extern MarlinSerial MSerial4; +extern MarlinSerial MSerial5; diff --git a/Marlin/src/HAL/STM32F1/SPI.cpp b/Marlin/src/HAL/STM32F1/SPI.cpp index 423772dbc948..0452cf629390 100644 --- a/Marlin/src/HAL/STM32F1/SPI.cpp +++ b/Marlin/src/HAL/STM32F1/SPI.cpp @@ -40,6 +40,9 @@ #include #include +#include "../../inc/MarlinConfig.h" +#include "spi_pins.h" + /** Time in ms for DMA receive timeout */ #define DMA_TIMEOUT 100 @@ -710,6 +713,6 @@ static spi_baud_rate determine_baud_rate(spi_dev *dev, uint32_t freq) { return baud_rates[i]; } -SPIClass SPI(1); +SPIClass SPI(SPI_DEVICE); #endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h index c0cb48695253..9d5026fbab10 100644 --- a/Marlin/src/HAL/STM32F1/inc/SanityCheck.h +++ b/Marlin/src/HAL/STM32F1/inc/SanityCheck.h @@ -25,10 +25,6 @@ * Test STM32F1-specific configuration values for errors at compile-time. */ -#if ENABLED(EMERGENCY_PARSER) - #error "EMERGENCY_PARSER is not yet implemented for STM32F1. Disable EMERGENCY_PARSER to continue." -#endif - #if ENABLED(FAST_PWM_FAN) || SPINDLE_LASER_FREQUENCY #error "Features requiring Hardware PWM (FAST_PWM_FAN, SPINDLE_LASER_FREQUENCY) are not yet supported on STM32F1." #endif diff --git a/Marlin/src/HAL/STM32F1/msc_sd.cpp b/Marlin/src/HAL/STM32F1/msc_sd.cpp index ab5530174e3b..6a4652e467fb 100644 --- a/Marlin/src/HAL/STM32F1/msc_sd.cpp +++ b/Marlin/src/HAL/STM32F1/msc_sd.cpp @@ -21,7 +21,7 @@ #define PRODUCT_ID 0x29 USBMassStorage MarlinMSC; -USBCompositeSerial MarlinCompositeSerial; +MarlinUSBCompositeSerial MarlinCompositeSerial; #include "../../inc/MarlinConfig.h" @@ -38,6 +38,17 @@ USBCompositeSerial MarlinCompositeSerial; #endif +#if ENABLED(EMERGENCY_PARSER) + void (*real_rx_callback)(void); + + void my_rx_callback(void) { + real_rx_callback(); + int len = MarlinCompositeSerial.available(); + while (len-- > 0) // >0 because available() may return a negative value + emergency_parser.update(MarlinCompositeSerial.emergency_state, MarlinCompositeSerial.peek()); + } +#endif + void MSC_SD_init() { USBComposite.setProductId(PRODUCT_ID); // Just set MarlinCompositeSerial enabled to true @@ -59,6 +70,11 @@ void MSC_SD_init() { // Register composite Serial MarlinCompositeSerial.registerComponent(); USBComposite.begin(); + #if ENABLED(EMERGENCY_PARSER) + //rx is usbSerialPart.endpoints[2] + real_rx_callback = usbSerialPart.endpoints[2].callback; + usbSerialPart.endpoints[2].callback = my_rx_callback; + #endif } #endif // USE_USB_COMPOSITE diff --git a/Marlin/src/HAL/STM32F1/msc_sd.h b/Marlin/src/HAL/STM32F1/msc_sd.h index 8715888f474c..d9cdbe6bb3d1 100644 --- a/Marlin/src/HAL/STM32F1/msc_sd.h +++ b/Marlin/src/HAL/STM32F1/msc_sd.h @@ -17,7 +17,25 @@ #include +#include "../../inc/MarlinConfigPre.h" +#if ENABLED(EMERGENCY_PARSER) + #include "../../feature/e_parser.h" +#endif + +class MarlinUSBCompositeSerial : public USBCompositeSerial { +public: + MarlinUSBCompositeSerial() : USBCompositeSerial() + #if ENABLED(EMERGENCY_PARSER) + , emergency_state(EmergencyParser::State::EP_RESET) + #endif + { } + + #if ENABLED(EMERGENCY_PARSER) + EmergencyParser::State emergency_state; + #endif +}; + extern USBMassStorage MarlinMSC; -extern USBCompositeSerial MarlinCompositeSerial; +extern MarlinUSBCompositeSerial MarlinCompositeSerial; void MSC_SD_init(); diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 3544a8840f63..89791c90820b 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -30,6 +30,10 @@ #include "MarlinCore.h" +#if ENABLED(MARLIN_DEV_MODE) + #warning "WARNING! Disable MARLIN_DEV_MODE for the final build!" +#endif + #include "HAL/shared/Delay.h" #include "HAL/shared/esp_wifi.h" @@ -68,9 +72,9 @@ #endif #if ENABLED(DWIN_CREALITY_LCD) - #include "lcd/dwin/dwin.h" + #include "lcd/dwin/e3v2/dwin.h" #include "lcd/dwin/dwin_lcd.h" - #include "lcd/dwin/rotary_encoder.h" + #include "lcd/dwin/e3v2/rotary_encoder.h" #endif #if ENABLED(IIC_BL24CXX_EEPROM) @@ -684,7 +688,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) { * - Read Buttons and Update the LCD * - Run i2c Position Encoders * - Auto-report Temperatures / SD Status - * - Update the Prusa MMU2 + * - Update the Průša MMU2 * - Handle Joystick jogging */ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) { @@ -760,7 +764,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) { } #endif - // Update the Prusa MMU2 + // Update the Průša MMU2 TERN_(PRUSA_MMU2, mmu2.mmu_loop()); // Handle Joystick jogging @@ -922,7 +926,7 @@ void setup() { SETUP_RUN(L64xxManager.init()); // Set up SPI, init drivers #endif - #if ENABLED(SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) + #if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) OUT_WRITE(SMART_EFFECTOR_MOD_PIN, LOW); // Put Smart Effector into NORMAL mode #endif @@ -991,6 +995,10 @@ void setup() { SETUP_RUN(leds.setup()); #endif + #if ENABLED(NEOPIXEL2_SEPARATE) + SETUP_RUN(leds2.setup()); + #endif + #if ENABLED(USE_CONTROLLER_FAN) // Set up fan controller to initialize also the default configurations. SETUP_RUN(controllerFan.setup()); #endif diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index cadbc714211f..c8e1f287548d 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -235,6 +235,7 @@ #define BOARD_SMOOTHIEBOARD 2506 // Smoothieboard #define BOARD_TH3D_EZBOARD 2507 // TH3D EZBoard v1.0 #define BOARD_BTT_SKR_V1_4_TURBO 2508 // BigTreeTech SKR v1.4 TURBO (Power outputs: Hotend0, Hotend1, Fan, Bed) +#define BOARD_MKS_SGEN_L_V2 2509 // MKS SGEN_L V2 (Power outputs: Hotend0, Hotend1, Bed, Fan) // // SAM3X8E ARM Cortex M3 @@ -281,7 +282,7 @@ #define BOARD_STM32F103RE 4000 // STM32F103RE Libmaple-based STM32F1 controller #define BOARD_MALYAN_M200 4001 // STM32C8T6 Libmaple-based STM32F1 controller -#define BOARD_MALYAN_M200_V2 4002 // STM32F070RB Libmaple-based STM32F0 controller +#define BOARD_MALYAN_M200_V2 4002 // STM32F070CB STM32F0 controller #define BOARD_STM3R_MINI 4003 // STM32F103RE Libmaple-based STM32F1 controller #define BOARD_GTM32_PRO_VB 4004 // STM32F103VET6 controller #define BOARD_MORPHEUS 4005 // STM32F103C8 / STM32F103CB Libmaple-based STM32F1 controller @@ -345,8 +346,9 @@ #define BOARD_LERDGE_X 4215 // Lerdge X (STM32F407VE) #define BOARD_VAKE403D 4216 // VAkE 403D (STM32F446VET6) #define BOARD_FYSETC_S6 4217 // FYSETC S6 board -#define BOARD_FLYF407ZG 4218 // FLYF407ZG board (STM32F407ZG) -#define BOARD_MKS_ROBIN2 4219 // MKS_ROBIN2 (STM32F407ZE) +#define BOARD_FYSETC_S6_V2_0 4218 // FYSETC S6 v2.0 board +#define BOARD_FLYF407ZG 4219 // FLYF407ZG board (STM32F407ZG) +#define BOARD_MKS_ROBIN2 4220 // MKS_ROBIN2 (STM32F407ZE) // // ARM Cortex M7 diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index f0ddbdd6d096..1d81ee61fb6d 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -120,6 +120,7 @@ #define STR_ERR_CHECKSUM_MISMATCH "checksum mismatch, Last Line: " #define STR_ERR_NO_CHECKSUM "No Checksum with line number, Last Line: " #define STR_FILE_PRINTED "Done printing file" +#define STR_NO_MEDIA "No media" #define STR_BEGIN_FILE_LIST "Begin file list" #define STR_END_FILE_LIST "End file list" #define STR_INVALID_EXTRUDER "Invalid extruder" diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index 295657fa64f3..f99956816778 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -57,10 +57,11 @@ void safe_delay(millis_t ms) { void log_machine_info() { SERIAL_ECHOLNPGM("Machine Type: " - TERN_(DELTA, "Delta") - TERN_(IS_SCARA, "SCARA") - TERN_(IS_CORE, "Core") - TERN_(IS_CARTESIAN, "Cartesian") + TERN_(DELTA, "Delta") + TERN_(IS_SCARA, "SCARA") + TERN_(IS_CORE, "Core") + TERN_(MARKFORGED_XY, "MarkForged") + TERN_(IS_CARTESIAN, "Cartesian") ); SERIAL_ECHOLNPGM("Probe: " diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp index 41d0a9cb1e91..b07688146110 100644 --- a/Marlin/src/feature/babystep.cpp +++ b/Marlin/src/feature/babystep.cpp @@ -26,7 +26,8 @@ #include "babystep.h" #include "../MarlinCore.h" -#include "../module/planner.h" +#include "../module/motion.h" // for axes_should_home() +#include "../module/planner.h" // for axis_steps_per_mm[] #include "../module/stepper.h" #if ENABLED(BABYSTEP_ALWAYS_AVAILABLE) @@ -54,7 +55,7 @@ void Babystep::add_mm(const AxisEnum axis, const float &mm) { } void Babystep::add_steps(const AxisEnum axis, const int16_t distance) { - if (DISABLED(BABYSTEP_WITHOUT_HOMING) && !TEST(axis_known_position, axis)) return; + if (DISABLED(BABYSTEP_WITHOUT_HOMING) && axes_should_home(_BV(axis))) return; accum += distance; // Count up babysteps for the UI steps[BS_AXIS_IND(axis)] += distance; diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index 809caecf49ea..087fdf42b2ac 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -48,7 +48,7 @@ void unified_bed_leveling::report_current_mesh() { if (!leveling_is_valid()) return; - SERIAL_ECHO_MSG(" G29 I99"); + SERIAL_ECHO_MSG(" G29 I999"); GRID_LOOP(x, y) if (!isnan(z_values[x][y])) { SERIAL_ECHO_START(); diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 69a66420f898..d13a8c3dc455 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -321,7 +321,7 @@ // Check for commands that require the printer to be homed if (may_move) { planner.synchronize(); - if (axes_need_homing()) gcode.home_all_axes(); + if (axes_should_home()) gcode.home_all_axes(); TERN_(HAS_MULTI_HOTEND, if (active_extruder) tool_change(0)); } diff --git a/Marlin/src/feature/direct_stepping.cpp b/Marlin/src/feature/direct_stepping.cpp index d3bdb43ab3cd..9766d1464053 100644 --- a/Marlin/src/feature/direct_stepping.cpp +++ b/Marlin/src/feature/direct_stepping.cpp @@ -56,9 +56,6 @@ namespace DirectStepping { template volatile bool SerialPageManager::page_states_dirty; - template - millis_t SerialPageManager::next_response; - template uint8_t SerialPageManager::pages[Cfg::NUM_PAGES][Cfg::PAGE_SIZE]; @@ -80,7 +77,6 @@ namespace DirectStepping { page_states[i] = PageState::FREE; fatal_error = false; - next_response = 0; state = State::NEWLINE; page_states_dirty = false; @@ -181,15 +177,8 @@ namespace DirectStepping { return; } - // Runs on a set interval also, as responses may get lost. - if (next_response && next_response < millis()) { - page_states_dirty = true; - } - if (!page_states_dirty) return; - page_states_dirty = false; - next_response = millis() + Cfg::RESPONSE_INTERVAL_MS; SERIAL_ECHO(Cfg::CONTROL_CHAR); constexpr int state_bits = 2; @@ -238,29 +227,29 @@ const uint8_t segment_table[DirectStepping::Config::NUM_SEGMENTS][DirectStepping #if STEPPER_PAGE_FORMAT == SP_4x4D_128 - { 1, 1, 1, 1, 1, 1, 1, 0 }, // 0 = -7 - { 1, 1, 1, 0, 1, 1, 1, 0 }, // 1 = -6 - { 0, 1, 1, 0, 1, 0, 1, 1 }, // 2 = -5 - { 0, 1, 0, 1, 0, 1, 0, 1 }, // 3 = -4 - { 0, 1, 0, 0, 1, 0, 0, 1 }, // 4 = -3 - { 0, 0, 1, 0, 0, 0, 1, 0 }, // 5 = -2 - { 0, 0, 0, 0, 1, 0, 0, 0 }, // 6 = -1 - { 0, 0, 0, 0, 0, 0, 0, 0 }, // 7 = 0 - { 0, 0, 0, 0, 1, 0, 0, 0 }, // 8 = 1 - { 0, 0, 1, 0, 0, 0, 1, 0 }, // 9 = 2 - { 0, 1, 0, 0, 1, 0, 0, 1 }, // 10 = 3 - { 0, 1, 0, 1, 0, 1, 0, 1 }, // 11 = 4 - { 0, 1, 1, 0, 1, 0, 1, 1 }, // 12 = 5 - { 1, 1, 1, 0, 1, 1, 1, 0 }, // 13 = 6 - { 1, 1, 1, 1, 1, 1, 1, 0 }, // 14 = 7 + { 1, 1, 1, 1, 1, 1, 1 }, // 0 = -7 + { 1, 1, 1, 0, 1, 1, 1 }, // 1 = -6 + { 1, 1, 1, 0, 1, 0, 1 }, // 2 = -5 + { 1, 1, 0, 1, 0, 1, 0 }, // 3 = -4 + { 1, 1, 0, 0, 1, 0, 0 }, // 4 = -3 + { 0, 0, 1, 0, 0, 0, 1 }, // 5 = -2 + { 0, 0, 0, 1, 0, 0, 0 }, // 6 = -1 + { 0, 0, 0, 0, 0, 0, 0 }, // 7 = 0 + { 0, 0, 0, 1, 0, 0, 0 }, // 8 = 1 + { 0, 0, 1, 0, 0, 0, 1 }, // 9 = 2 + { 1, 1, 0, 0, 1, 0, 0 }, // 10 = 3 + { 1, 1, 0, 1, 0, 1, 0 }, // 11 = 4 + { 1, 1, 1, 0, 1, 0, 1 }, // 12 = 5 + { 1, 1, 1, 0, 1, 1, 1 }, // 13 = 6 + { 1, 1, 1, 1, 1, 1, 1 }, // 14 = 7 { 0 } #elif STEPPER_PAGE_FORMAT == SP_4x2_256 - { 0, 0, 0, 0 }, // 0 - { 0, 1, 0, 0 }, // 1 - { 1, 0, 1, 0 }, // 2 - { 1, 1, 1, 0 }, // 3 + { 0, 0, 0 }, // 0 + { 0, 1, 0 }, // 1 + { 1, 0, 1 }, // 2 + { 1, 1, 1 }, // 3 #elif STEPPER_PAGE_FORMAT == SP_4x1_512 diff --git a/Marlin/src/feature/direct_stepping.h b/Marlin/src/feature/direct_stepping.h index dea2616508d2..cde9d1a0b438 100644 --- a/Marlin/src/feature/direct_stepping.h +++ b/Marlin/src/feature/direct_stepping.h @@ -70,7 +70,6 @@ namespace DirectStepping { static volatile PageState page_states[Cfg::NUM_PAGES]; static volatile bool page_states_dirty; - static millis_t next_response; static uint8_t pages[Cfg::NUM_PAGES][Cfg::PAGE_SIZE]; static uint8_t checksum; @@ -94,14 +93,11 @@ namespace DirectStepping { static constexpr int DIRECTIONAL = dir ? 1 : 0; static constexpr int SEGMENTS = segments; - static constexpr int RAW = (BITS_SEGMENT == 1) ? 1 : 0; static constexpr int NUM_SEGMENTS = 1 << BITS_SEGMENT; - static constexpr int SEGMENT_STEPS = 1 << (BITS_SEGMENT - DIRECTIONAL - RAW); + static constexpr int SEGMENT_STEPS = (1 << (BITS_SEGMENT - DIRECTIONAL)) - 1; static constexpr int TOTAL_STEPS = SEGMENT_STEPS * SEGMENTS; static constexpr int PAGE_SIZE = (NUM_AXES * BITS_SEGMENT * SEGMENTS) / 8; - static constexpr millis_t RESPONSE_INTERVAL_MS = 50; - typedef typename TypeSelector<(PAGE_SIZE>256), uint16_t, uint8_t>::type write_byte_idx_t; typedef typename TypeSelector<(NUM_PAGES>256), uint16_t, uint8_t>::type page_idx_t; }; diff --git a/Marlin/src/feature/leds/leds.cpp b/Marlin/src/feature/leds/leds.cpp index eec0cde630da..ef9099fb2093 100644 --- a/Marlin/src/feature/leds/leds.cpp +++ b/Marlin/src/feature/leds/leds.cpp @@ -44,11 +44,8 @@ #if ENABLED(LED_COLOR_PRESETS) const LEDColor LEDLights::defaultLEDColor = MakeLEDColor( - LED_USER_PRESET_RED, - LED_USER_PRESET_GREEN, - LED_USER_PRESET_BLUE, - LED_USER_PRESET_WHITE, - LED_USER_PRESET_BRIGHTNESS + LED_USER_PRESET_RED, LED_USER_PRESET_GREEN, LED_USER_PRESET_BLUE, + LED_USER_PRESET_WHITE, LED_USER_PRESET_BRIGHTNESS ); #endif @@ -117,24 +114,22 @@ void LEDLights::set_color(const LEDColor &incol // This variant uses 3-4 separate pins for the RGB(W) components. // If the pins can do PWM then their intensity will be set. - #define UPDATE_RGBW(C,c) do { if (PWM_PIN(RGB_LED_##C##_PIN)) \ + #define UPDATE_RGBW(C,c) do { \ + if (PWM_PIN(RGB_LED_##C##_PIN)) \ analogWrite(pin_t(RGB_LED_##C##_PIN), incol.c); \ - else WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); }while(0) - UPDATE_RGBW(R,r); - UPDATE_RGBW(G,g); - UPDATE_RGBW(B,b); + else \ + WRITE(RGB_LED_##C##_PIN, incol.c ? HIGH : LOW); \ + }while(0) + UPDATE_RGBW(R,r); UPDATE_RGBW(G,g); UPDATE_RGBW(B,b); #if ENABLED(RGBW_LED) UPDATE_RGBW(W,w); #endif #endif - #if ENABLED(PCA9632) - // Update I2C LED driver - pca9632_set_led_color(incol); - #endif - - TERN_(PCA9533, PCA9533_setColor(incol.r, incol.g, incol.b)); + // Update I2C LED driver + TERN_(PCA9632, PCA9632_set_led_color(incol)); + TERN_(PCA9533, PCA9533_set_rgb(incol.r, incol.g, incol.b)); #if EITHER(LED_CONTROL_MENU, PRINTER_EVENT_LEDS) // Don't update the color when OFF @@ -161,4 +156,45 @@ void LEDLights::set_color(const LEDColor &incol #endif -#endif // HAS_COLOR_LEDS +#if ENABLED(NEOPIXEL2_SEPARATE) + + #if ENABLED(NEO2_COLOR_PRESETS) + const LEDColor LEDLights2::defaultLEDColor = MakeLEDColor( + NEO2_USER_PRESET_RED, NEO2_USER_PRESET_GREEN, NEO2_USER_PRESET_BLUE, + NEO2_USER_PRESET_WHITE, NEO2_USER_PRESET_BRIGHTNESS + ); + #endif + + #if ENABLED(LED_CONTROL_MENU) + LEDColor LEDLights2::color; + bool LEDLights2::lights_on; + #endif + + LEDLights2 leds2; + + void LEDLights2::setup() { + neo2.init(); + TERN_(NEO2_USER_PRESET_STARTUP, set_default()); + } + + void LEDLights2::set_color(const LEDColor &incol) { + const uint32_t neocolor = LEDColorWhite() == incol + ? neo2.Color(NEO2_WHITE) + : neo2.Color(incol.r, incol.g, incol.b, incol.w); + neo2.set_brightness(incol.i); + neo2.set_color(neocolor); + + #if ENABLED(LED_CONTROL_MENU) + // Don't update the color when OFF + lights_on = !incol.is_off(); + if (lights_on) color = incol; + #endif + } + + #if ENABLED(LED_CONTROL_MENU) + void LEDLights2::toggle() { if (lights_on) set_off(); else update(); } + #endif + +#endif // NEOPIXEL2_SEPARATE + +#endif // HAS_COLOR_LEDS diff --git a/Marlin/src/feature/leds/leds.h b/Marlin/src/feature/leds/leds.h index 577c94752ffd..055ea0df37ad 100644 --- a/Marlin/src/feature/leds/leds.h +++ b/Marlin/src/feature/leds/leds.h @@ -104,11 +104,7 @@ typedef struct LEDColor { bool operator!=(const LEDColor &right) { return !operator==(right); } bool is_off() const { - return 3 > r + g + b - #if HAS_WHITE_LED - + w - #endif - ; + return 3 > r + g + b + TERN0(HAS_WHITE_LED, w); } } LEDColor; @@ -156,14 +152,12 @@ class LEDLights { #endif ); - inline void set_color(uint8_t r, uint8_t g, uint8_t b + static inline void set_color(uint8_t r, uint8_t g, uint8_t b #if HAS_WHITE_LED , uint8_t w=0 - #if ENABLED(NEOPIXEL_LED) - , uint8_t i=NEOPIXEL_BRIGHTNESS - #endif #endif #if ENABLED(NEOPIXEL_LED) + , uint8_t i=NEOPIXEL_BRIGHTNESS , bool isSequence=false #endif ) { @@ -216,3 +210,44 @@ class LEDLights { }; extern LEDLights leds; + +#if ENABLED(NEOPIXEL2_SEPARATE) + + class LEDLights2 { + public: + LEDLights2() {} + + static void setup(); // init() + + static void set_color(const LEDColor &color); + + inline void set_color(uint8_t r, uint8_t g, uint8_t b, uint8_t w=0, uint8_t i=NEOPIXEL2_BRIGHTNESS) { + set_color(MakeLEDColor(r, g, b, w, i)); + } + + static inline void set_off() { set_color(LEDColorOff()); } + static inline void set_green() { set_color(LEDColorGreen()); } + static inline void set_white() { set_color(LEDColorWhite()); } + + #if ENABLED(NEO2_COLOR_PRESETS) + static const LEDColor defaultLEDColor; + static inline void set_default() { set_color(defaultLEDColor); } + static inline void set_red() { set_color(LEDColorRed()); } + static inline void set_orange() { set_color(LEDColorOrange()); } + static inline void set_yellow() { set_color(LEDColorYellow()); } + static inline void set_blue() { set_color(LEDColorBlue()); } + static inline void set_indigo() { set_color(LEDColorIndigo()); } + static inline void set_violet() { set_color(LEDColorViolet()); } + #endif + + #if ENABLED(NEOPIXEL2_SEPARATE) + static LEDColor color; // last non-off color + static bool lights_on; // the last set color was "on" + static void toggle(); // swap "off" with color + static inline void update() { set_color(color); } + #endif + }; + + extern LEDLights2 leds2; + +#endif // NEOPIXEL2_SEPARATE diff --git a/Marlin/src/feature/leds/neopixel.cpp b/Marlin/src/feature/leds/neopixel.cpp index 520d4d63b22f..27bbeb348c5d 100644 --- a/Marlin/src/feature/leds/neopixel.cpp +++ b/Marlin/src/feature/leds/neopixel.cpp @@ -30,7 +30,7 @@ #include "neopixel.h" -#if ENABLED(NEOPIXEL_STARTUP_TEST) +#if EITHER(NEOPIXEL_STARTUP_TEST, NEOPIXEL2_STARTUP_TEST) #include "../../core/utility.h" #endif @@ -38,7 +38,7 @@ Marlin_NeoPixel neo; int8_t Marlin_NeoPixel::neoindex; Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIXEL_TYPE + NEO_KHZ800) - #if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES) + #if CONJOINED_NEOPIXEL , Marlin_NeoPixel::adaneo2(NEOPIXEL_PIXELS, NEOPIXEL2_PIN, NEOPIXEL2_TYPE + NEO_KHZ800) #endif ; @@ -53,9 +53,9 @@ Adafruit_NeoPixel Marlin_NeoPixel::adaneo1(NEOPIXEL_PIXELS, NEOPIXEL_PIN, NEOPIX #endif void Marlin_NeoPixel::set_color(const uint32_t color) { - if (get_neo_index() >= 0) { - set_pixel_color(get_neo_index(), color); - set_neo_index(-1); + if (neoindex >= 0) { + set_pixel_color(neoindex, color); + neoindex = -1; } else { for (uint16_t i = 0; i < pixels(); ++i) { @@ -78,18 +78,18 @@ void Marlin_NeoPixel::set_color_startup(const uint32_t color) { } void Marlin_NeoPixel::init() { - set_neo_index(-1); // -1 .. NEOPIXEL_PIXELS-1 range + neoindex = -1; // -1 .. NEOPIXEL_PIXELS-1 range set_brightness(NEOPIXEL_BRIGHTNESS); // 0 .. 255 range begin(); show(); // initialize to all off #if ENABLED(NEOPIXEL_STARTUP_TEST) set_color_startup(adaneo1.Color(255, 0, 0, 0)); // red - safe_delay(1000); + safe_delay(500); set_color_startup(adaneo1.Color(0, 255, 0, 0)); // green - safe_delay(1000); + safe_delay(500); set_color_startup(adaneo1.Color(0, 0, 255, 0)); // blue - safe_delay(1000); + safe_delay(500); #endif #ifdef NEOPIXEL_BKGD_LED_INDEX @@ -120,4 +120,53 @@ bool Marlin_NeoPixel::set_led_color(const uint8_t r, const uint8_t g, const uint } #endif +#if ENABLED(NEOPIXEL2_SEPARATE) + + Marlin_NeoPixel2 neo2; + + int8_t Marlin_NeoPixel2::neoindex; + Adafruit_NeoPixel Marlin_NeoPixel2::adaneo(NEOPIXEL2_PIXELS, NEOPIXEL2_PIN, NEOPIXEL2_TYPE); + + void Marlin_NeoPixel2::set_color(const uint32_t color) { + if (neoindex >= 0) { + set_pixel_color(neoindex, color); + neoindex = -1; + } + else { + for (uint16_t i = 0; i < pixels(); ++i) + set_pixel_color(i, color); + } + show(); + } + + void Marlin_NeoPixel2::set_color_startup(const uint32_t color) { + for (uint16_t i = 0; i < pixels(); ++i) + set_pixel_color(i, color); + show(); + } + + void Marlin_NeoPixel2::init() { + neoindex = -1; // -1 .. NEOPIXEL2_PIXELS-1 range + set_brightness(NEOPIXEL2_BRIGHTNESS); // 0 .. 255 range + begin(); + show(); // initialize to all off + + #if ENABLED(NEOPIXEL2_STARTUP_TEST) + set_color_startup(adaneo.Color(255, 0, 0, 0)); // red + safe_delay(500); + set_color_startup(adaneo.Color(0, 255, 0, 0)); // green + safe_delay(500); + set_color_startup(adaneo.Color(0, 0, 255, 0)); // blue + safe_delay(500); + #endif + + #if ENABLED(NEO2_USER_PRESET_STARTUP) + set_color(adaneo.Color(NEO2_USER_PRESET_RED, NEO2_USER_PRESET_GREEN, NEO2_USER_PRESET_BLUE, NEO2_USER_PRESET_WHITE)); + #else + set_color(adaneo.Color(0, 0, 0, 0)); + #endif + } + +#endif // NEOPIXEL2_SEPARATE + #endif // NEOPIXEL_LED diff --git a/Marlin/src/feature/leds/neopixel.h b/Marlin/src/feature/leds/neopixel.h index 0155785e9afb..42046fa5638f 100644 --- a/Marlin/src/feature/leds/neopixel.h +++ b/Marlin/src/feature/leds/neopixel.h @@ -22,7 +22,7 @@ #pragma once /** - * Neopixel support + * NeoPixel support */ // ------------------------ @@ -38,10 +38,14 @@ // Defines // ------------------------ -#if defined(NEOPIXEL2_TYPE) && NEOPIXEL2_TYPE != NEOPIXEL_TYPE +#if defined(NEOPIXEL2_TYPE) && NEOPIXEL2_TYPE != NEOPIXEL_TYPE && DISABLED(NEOPIXEL2_SEPARATE) #define MULTIPLE_NEOPIXEL_TYPES 1 #endif +#if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES) + #define CONJOINED_NEOPIXEL 1 +#endif + #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 NEOPIXEL_IS_RGB 1 #else @@ -61,32 +65,26 @@ class Marlin_NeoPixel { private: static Adafruit_NeoPixel adaneo1 - #if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES) + #if CONJOINED_NEOPIXEL , adaneo2 #endif ; - static int8_t neoindex; public: + static int8_t neoindex; + static void init(); static void set_color_startup(const uint32_t c); static void set_color(const uint32_t c); - FORCE_INLINE static void set_neo_index(const int8_t neoIndex) { neoindex = neoIndex; } - FORCE_INLINE static int8_t get_neo_index() { return neoindex; } - #ifdef NEOPIXEL_BKGD_LED_INDEX static void set_color_background(); #endif static inline void begin() { adaneo1.begin(); - #if ENABLED(NEOPIXEL2_INSERIES) - adaneo2.begin(); - #else - TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.begin()); - #endif + TERN_(CONJOINED_NEOPIXEL, adaneo2.begin()); } static inline void set_pixel_color(const uint16_t n, const uint32_t c) { @@ -95,26 +93,24 @@ class Marlin_NeoPixel { else adaneo1.setPixelColor(n, c); #else adaneo1.setPixelColor(n, c); - TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setPixelColor(n, c)); + #if MULTIPLE_NEOPIXEL_TYPES + adaneo2.setPixelColor(n, c); + #endif #endif } static inline void set_brightness(const uint8_t b) { adaneo1.setBrightness(b); - #if ENABLED(NEOPIXEL2_INSERIES) - adaneo2.setBrightness(b); - #else - TERN_(MULTIPLE_NEOPIXEL_TYPES, adaneo2.setBrightness(b)); - #endif + TERN_(CONJOINED_NEOPIXEL, adaneo2.setBrightness(b)); } static inline void show() { adaneo1.show(); #if PIN_EXISTS(NEOPIXEL2) - #if EITHER(MULTIPLE_NEOPIXEL_TYPES, NEOPIXEL2_INSERIES) + #if CONJOINED_NEOPIXEL adaneo2.show(); #else - adaneo1.setPin(NEOPIXEL2_PIN); + TERN(NEOPIXEL2_SEPARATE,,adaneo1.setPin(NEOPIXEL2_PIN)); adaneo1.show(); adaneo1.setPin(NEOPIXEL_PIN); #endif @@ -134,3 +130,50 @@ class Marlin_NeoPixel { }; extern Marlin_NeoPixel neo; + +// Neo pixel channel 2 +#if ENABLED(NEOPIXEL2_SEPARATE) + + #if NEOPIXEL2_TYPE == NEO_RGB || NEOPIXEL2_TYPE == NEO_RBG || NEOPIXEL2_TYPE == NEO_GRB || NEOPIXEL2_TYPE == NEO_GBR || NEOPIXEL2_TYPE == NEO_BRG || NEOPIXEL2_TYPE == NEO_BGR + #define NEOPIXEL2_IS_RGB 1 + #else + #define NEOPIXEL2_IS_RGBW 1 + #endif + + #if NEOPIXEL2_IS_RGB + #define NEO2_WHITE 255, 255, 255, 0 + #else + #define NEO2_WHITE 0, 0, 0, 255 + #endif + + class Marlin_NeoPixel2 { + private: + static Adafruit_NeoPixel adaneo; + + public: + static int8_t neoindex; + + static void init(); + static void set_color_startup(const uint32_t c); + + static void set_color(const uint32_t c); + + static inline void begin() { adaneo.begin(); } + static inline void set_pixel_color(const uint16_t n, const uint32_t c) { adaneo.setPixelColor(n, c); } + static inline void set_brightness(const uint8_t b) { adaneo.setBrightness(b); } + static inline void show() { + adaneo.show(); + adaneo.setPin(NEOPIXEL2_PIN); + } + + // Accessors + static inline uint16_t pixels() { return adaneo.numPixels();} + static inline uint8_t brightness() { return adaneo.getBrightness(); } + static inline uint32_t Color(uint8_t r, uint8_t g, uint8_t b, uint8_t w) { + return adaneo.Color(r, g, b, w); + } + }; + + extern Marlin_NeoPixel2 neo2; + +#endif // NEOPIXEL2_SEPARATE diff --git a/Marlin/src/feature/leds/pca9533.cpp b/Marlin/src/feature/leds/pca9533.cpp index bcc4bc50a474..0fd4d6675771 100644 --- a/Marlin/src/feature/leds/pca9533.cpp +++ b/Marlin/src/feature/leds/pca9533.cpp @@ -62,7 +62,7 @@ void PCA9533_setOff() { PCA9533_writeRegister(PCA9533_REG_SEL, 0); } -void PCA9533_setColor(uint8_t red, uint8_t green, uint8_t blue) { +void PCA9533_set_rgb(uint8_t red, uint8_t green, uint8_t blue) { uint8_t r_pwm0 = 0; // Register data - PWM value uint8_t r_pwm1 = 0; // Register data - PWM value diff --git a/Marlin/src/feature/leds/pca9533.h b/Marlin/src/feature/leds/pca9533.h index 899418ff232c..431058c49136 100644 --- a/Marlin/src/feature/leds/pca9533.h +++ b/Marlin/src/feature/leds/pca9533.h @@ -55,5 +55,5 @@ void PCA9533_init(); void PCA9533_reset(); -void PCA9533_setColor(uint8_t red, uint8_t green, uint8_t blue); +void PCA9533_set_rgb(uint8_t red, uint8_t green, uint8_t blue); void PCA9533_setOff(); diff --git a/Marlin/src/feature/leds/pca9632.cpp b/Marlin/src/feature/leds/pca9632.cpp index df991ded36cc..d8af31cb6ce4 100644 --- a/Marlin/src/feature/leds/pca9632.cpp +++ b/Marlin/src/feature/leds/pca9632.cpp @@ -120,7 +120,7 @@ static void PCA9632_WriteAllRegisters(const byte addr, const byte regadd, const } #endif -void pca9632_set_led_color(const LEDColor &color) { +void PCA9632_set_led_color(const LEDColor &color) { Wire.begin(); if (!PCA_init) { PCA_init = 1; @@ -138,7 +138,7 @@ void pca9632_set_led_color(const LEDColor &color) { #if ENABLED(PCA9632_BUZZER) - void pca9632_buzz(const long, const uint16_t) { + void PCA9632_buzz(const long, const uint16_t) { uint8_t data[] = PCA9632_BUZZER_DATA; Wire.beginTransmission(I2C_ADDRESS(PCA9632_ADDRESS)); Wire.write(data, sizeof(data)); diff --git a/Marlin/src/feature/leds/pca9632.h b/Marlin/src/feature/leds/pca9632.h index 34aceb31d6e3..fb59a8c18479 100644 --- a/Marlin/src/feature/leds/pca9632.h +++ b/Marlin/src/feature/leds/pca9632.h @@ -29,9 +29,9 @@ struct LEDColor; typedef LEDColor LEDColor; -void pca9632_set_led_color(const LEDColor &color); +void PCA9632_set_led_color(const LEDColor &color); #if ENABLED(PCA9632_BUZZER) #include - void pca9632_buzz(const long, const uint16_t); + void PCA9632_buzz(const long, const uint16_t); #endif diff --git a/Marlin/src/feature/mixing.cpp b/Marlin/src/feature/mixing.cpp index 7de4eb79ea67..b002e9808adc 100644 --- a/Marlin/src/feature/mixing.cpp +++ b/Marlin/src/feature/mixing.cpp @@ -180,7 +180,12 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*= } void Mixer::update_gradient_for_planner_z() { - update_gradient_for_z(planner.get_axis_position_mm(Z_AXIS)); + #if ENABLED(DELTA) + get_cartesian_from_steppers(); + update_gradient_for_z(cartes.z); + #else + update_gradient_for_z(planner.get_axis_position_mm(Z_AXIS)); + #endif } #endif // GRADIENT_MIX diff --git a/Marlin/src/feature/password/password.cpp b/Marlin/src/feature/password/password.cpp index c519ee7c9c46..90bb647118b5 100644 --- a/Marlin/src/feature/password/password.cpp +++ b/Marlin/src/feature/password/password.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/feature/password/password.h b/Marlin/src/feature/password/password.h index 66f1c70ba314..3ed584b29d5e 100644 --- a/Marlin/src/feature/password/password.h +++ b/Marlin/src/feature/password/password.h @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ #pragma once diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 2cb9c2df718e..4089e2b87b05 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -29,6 +29,8 @@ #if ENABLED(ADVANCED_PAUSE_FEATURE) +//#define DEBUG_PAUSE_RESUME + #include "../MarlinCore.h" #include "../gcode/gcode.h" #include "../module/motion.h" @@ -62,6 +64,9 @@ #include "../libs/nozzle.h" #include "pause.h" +#define DEBUG_OUT ENABLED(DEBUG_PAUSE_RESUME) +#include "../core/debug_out.h" + // private: static xyze_pos_t resume_position; @@ -120,25 +125,32 @@ fil_change_settings_t fc_settings[EXTRUDERS]; * Returns 'true' if heating was completed, 'false' for abort */ static bool ensure_safe_temperature(const bool wait=true, const PauseMode mode=PAUSE_MODE_SAME) { + DEBUG_SECTION(est, "ensure_safe_temperature", true); + DEBUG_ECHOLNPAIR("... wait:", int(wait), " mode:", int(mode)); - #if ENABLED(PREVENT_COLD_EXTRUSION) - if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) { - SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD); - return false; - } - #endif + if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) + thermalManager.setTargetHotend(thermalManager.extrude_min_temp, active_extruder); #if HAS_LCD_MENU lcd_pause_show_message(PAUSE_MESSAGE_HEATING, mode); - #else - UNUSED(mode); #endif + UNUSED(mode); if (wait) return thermalManager.wait_for_hotend(active_extruder); - while (ABS(thermalManager.degHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > TEMP_WINDOW) + wait_for_heatup = true; // Allow interruption by Emergency Parser M108 + while (wait_for_heatup && ABS(thermalManager.degHotend(active_extruder) - thermalManager.degTargetHotend(active_extruder)) > TEMP_WINDOW) idle(); + wait_for_heatup = false; + + #if ENABLED(PREVENT_COLD_EXTRUSION) + // A user can cancel wait-for-heating with M108 + if (!DEBUGGING(DRYRUN) && thermalManager.targetTooColdToExtrude(active_extruder)) { + SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD); + return false; + } + #endif return true; } @@ -160,7 +172,10 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l const PauseMode mode/*=PAUSE_MODE_PAUSE_PRINT*/ DXC_ARGS ) { - TERN(HAS_LCD_MENU,,UNUSED(show_lcd)); + DEBUG_SECTION(lf, "load_filament", true); + DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " showlcd:", int(show_lcd), " pauseforuser:", int(pause_for_user), " pausemode:", int(mode) DXC_SAY); + + UNUSED(show_lcd); if (!ensure_safe_temperature(false, mode)) { #if HAS_LCD_MENU @@ -292,7 +307,14 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, , const float &mix_multiplier/*=1.0*/ #endif ) { - TERN(HAS_LCD_MENU,,UNUSED(show_lcd)); + DEBUG_SECTION(uf, "unload_filament", true); + DEBUG_ECHOLNPAIR("... unloadlen:", unload_length, " showlcd:", int(show_lcd), " mode:", int(mode) + #if BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) + , " mixmult:", mix_multiplier + #endif + ); + + UNUSED(show_lcd); #if !BOTH(FILAMENT_UNLOAD_ALL_EXTRUDERS, MIXING_EXTRUDER) constexpr float mix_multiplier = 1.0; @@ -358,7 +380,10 @@ bool unload_filament(const float &unload_length, const bool show_lcd/*=false*/, uint8_t did_pause_print = 0; bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length/*=0*/, const bool show_lcd/*=false*/ DXC_ARGS) { - TERN(HAS_LCD_MENU,,UNUSED(show_lcd)); + DEBUG_SECTION(pp, "pause_print", true); + DEBUG_ECHOLNPAIR("... retract:", retract, " park.x:", park_point.x, " y:", park_point.y, " z:", park_point.z, " unloadlen:", unload_length, " showlcd:", int(show_lcd) DXC_SAY); + + UNUSED(show_lcd); if (did_pause_print) return false; // already paused @@ -413,7 +438,7 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float unscaled_e_move(retract, PAUSE_PARK_RETRACT_FEEDRATE); // Park the nozzle by moving up by z_lift and then moving to (x_pos, y_pos) - if (!axes_need_homing()) + if (!axes_should_home()) nozzle.park(0, park_point); #if ENABLED(DUAL_X_CARRIAGE) @@ -449,12 +474,18 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float */ void show_continue_prompt(const bool is_reload) { + DEBUG_SECTION(scp, "pause_print", true); + DEBUG_ECHOLNPAIR("... is_reload:", int(is_reload)); + TERN_(HAS_LCD_MENU, lcd_pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING)); SERIAL_ECHO_START(); serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n")); } void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) { + DEBUG_SECTION(wfc, "wait_for_confirmation", true); + DEBUG_ECHOLNPAIR("... is_reload:", is_reload, " maxbeep:", int(max_beep_count) DXC_SAY); + bool nozzle_timed_out = false; show_continue_prompt(is_reload); @@ -551,6 +582,9 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep * - Resume the current SD print job, if any */ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_length/*=0*/, const float &purge_length/*=ADVANCED_PAUSE_PURGE_LENGTH*/, const int8_t max_beep_count/*=0*/, int16_t targetTemp/*=0*/ DXC_ARGS) { + DEBUG_SECTION(rp, "resume_print", true); + DEBUG_ECHOLNPAIR("... slowlen:", slow_load_length, " fastlen:", fast_load_length, " purgelen:", purge_length, " maxbeep:", int(max_beep_count), " targetTemp:", targetTemp DXC_SAY); + /* SERIAL_ECHOLNPAIR( "start of resume_print()\ndual_x_carriage_mode:", dual_x_carriage_mode, diff --git a/Marlin/src/feature/pause.h b/Marlin/src/feature/pause.h index d8a676afa479..016b0ce3f7d9 100644 --- a/Marlin/src/feature/pause.h +++ b/Marlin/src/feature/pause.h @@ -77,10 +77,12 @@ extern uint8_t did_pause_print; #define DXC_PARAMS , const int8_t DXC_ext=-1 #define DXC_ARGS , const int8_t DXC_ext #define DXC_PASS , DXC_ext + #define DXC_SAY , " dxc:", int(DXC_ext) #else #define DXC_PARAMS #define DXC_ARGS #define DXC_PASS + #define DXC_SAY #endif bool pause_print(const float &retract, const xyz_pos_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS); diff --git a/Marlin/src/feature/power_monitor.h b/Marlin/src/feature/power_monitor.h index ca52ed74c6bc..a86bd07ec4d1 100644 --- a/Marlin/src/feature/power_monitor.h +++ b/Marlin/src/feature/power_monitor.h @@ -89,7 +89,9 @@ class PowerMonitor { #endif #if HAS_SPI_LCD - FORCE_INLINE static bool display_enabled() { return flags != 0x00; } + #if HAS_GRAPHICAL_LCD && DISABLED(LIGHTWEIGHT_UI) + FORCE_INLINE static bool display_enabled() { return flags != 0x00; } + #endif #if ENABLED(POWER_MONITOR_CURRENT) static void draw_current(); FORCE_INLINE static bool current_display_enabled() { return TEST(flags, PM_DISP_BIT_I); } diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 9a3eee31b55c..06296dd215fa 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -365,7 +365,7 @@ void PrintJobRecovery::resume() { #endif // Pretend that all axes are homed - axis_homed = axis_known_position = xyz_bits; + set_all_homed(); // Recover volumetric extrusion state #if DISABLED(NO_VOLUMETRICS) diff --git a/Marlin/src/gcode/bedlevel/G26.cpp b/Marlin/src/gcode/bedlevel/G26.cpp index 2399f207bfa2..cd0dbb13cdcb 100644 --- a/Marlin/src/gcode/bedlevel/G26.cpp +++ b/Marlin/src/gcode/bedlevel/G26.cpp @@ -490,7 +490,7 @@ void GcodeSuite::G26() { // Don't allow Mesh Validation without homing first, // or if the parameter parsing did not go OK, abort - if (axis_unhomed_error()) return; + if (homing_needed_error()) return; // Change the tool first, if specified if (parser.seenval('T')) tool_change(parser.value_int()); diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 786065b34655..7595067dbf85 100755 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -176,7 +176,7 @@ void GcodeSuite::G35() { probe.stow(); // After this operation the Z position needs correction - set_axis_not_trusted(Z_AXIS); + set_axis_never_homed(Z_AXIS); // Home Z after the alignment procedure process_subcommands_now_P(PSTR("G28Z")); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index f25fe32b07e5..9bb1ebe23819 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -61,7 +61,7 @@ #endif #if ENABLED(DWIN_CREALITY_LCD) - #include "../../../lcd/dwin/dwin.h" + #include "../../../lcd/dwin/e3v2/dwin.h" #endif #if HAS_MULTI_HOTEND @@ -183,7 +183,7 @@ G29_TYPE GcodeSuite::G29() { faux = ENABLED(DEBUG_LEVELING_FEATURE) && DISABLED(PROBE_MANUALLY) ? parser.boolval('C') : no_action; // Don't allow auto-leveling without homing first - if (axis_unhomed_error()) G29_RETURN(false); + if (homing_needed_error()) G29_RETURN(false); if (!no_action && planner.leveling_active && parser.boolval('O')) { // Auto-level only if needed if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> Auto-level not needed, skip"); diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index 78695bc05b40..be222a7b1724 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -47,7 +47,7 @@ #include "../../lcd/ultralcd.h" #if ENABLED(DWIN_CREALITY_LCD) - #include "../../lcd/dwin/dwin.h" + #include "../../lcd/dwin/e3v2/dwin.h" #endif #if HAS_L64XX // set L6470 absolute position registers to counts @@ -118,7 +118,7 @@ DEBUG_SECTION(log_G28, "home_z_safely", DEBUGGING(LEVELING)); // Disallow Z homing if X or Y homing is needed - if (axis_unhomed_error(_BV(X_AXIS) | _BV(Y_AXIS))) return; + if (homing_needed_error(_BV(X_AXIS) | _BV(Y_AXIS))) return; sync_plan_position(); @@ -299,8 +299,8 @@ void GcodeSuite::G28() { #else // NOT DELTA const bool homeZ = parser.seen('Z'), - needX = homeZ && TERN0(Z_SAFE_HOMING, axes_need_homing(_BV(X_AXIS))), - needY = homeZ && TERN0(Z_SAFE_HOMING, axes_need_homing(_BV(Y_AXIS))), + needX = homeZ && TERN0(Z_SAFE_HOMING, axes_should_home(_BV(X_AXIS))), + needY = homeZ && TERN0(Z_SAFE_HOMING, axes_should_home(_BV(Y_AXIS))), homeX = needX || parser.seen('X'), homeY = needY || parser.seen('Y'), home_all = homeX == homeY && homeX == homeZ, // All or None doX = home_all || homeX, doY = home_all || homeY, doZ = home_all || homeZ; diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 3360dc050fcf..1fd0754ec780 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -346,7 +346,7 @@ void GcodeSuite::G34() { #if ENABLED(HOME_AFTER_G34) // After this operation the z position needs correction - set_axis_not_trusted(Z_AXIS); + set_axis_never_homed(Z_AXIS); // Home Z after the alignment procedure process_subcommands_now_P(PSTR("G28Z")); #else diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index 0ef23d28f92b..746cb108766b 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -584,7 +584,7 @@ void GcodeSuite::G425() { TEMPORARY_SOFT_ENDSTOP_STATE(false); TEMPORARY_BED_LEVELING_STATE(false); - if (axis_unhomed_error()) return; + if (homing_needed_error()) return; measurements_t m; diff --git a/Marlin/src/gcode/calibrate/G76_M871.cpp b/Marlin/src/gcode/calibrate/G76_M871.cpp index f2f53d213d3a..9870d9fbe567 100644 --- a/Marlin/src/gcode/calibrate/G76_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M871.cpp @@ -45,7 +45,7 @@ * - When calibrating bed, probe temperature is held constant. * Compensation values are deltas to first probe measurement at bed temp. = 60°C. * - The hotend will not be heated at any time. - * - On my Prusa MK3S clone I put a piece of paper between the probe and the hotend + * - On my Průša MK3S clone I put a piece of paper between the probe and the hotend * so the hotend fan would not cool my probe constantly. Alternativly you could just * make sure the fan is not running while running the calibration process. * diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index fc9d22957b1a..aaf58eed1c78 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -55,7 +55,7 @@ extern const char SP_Y_STR[]; void GcodeSuite::M48() { - if (axis_unhomed_error()) return; + if (homing_needed_error()) return; const int8_t verbose_level = parser.byteval('V', 1); if (!WITHIN(verbose_level, 0, 4)) { diff --git a/Marlin/src/gcode/config/M672.cpp b/Marlin/src/gcode/config/M672.cpp index 58dc27177046..af74230516e1 100644 --- a/Marlin/src/gcode/config/M672.cpp +++ b/Marlin/src/gcode/config/M672.cpp @@ -22,20 +22,12 @@ #include "../../inc/MarlinConfig.h" -#if ENABLED(SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) +#if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) #include "../gcode.h" #include "../../HAL/shared/Delay.h" #include "../parser.h" -/** - * M672 - Set/reset Duet Smart Effector sensitivity - * - * One of these is required: - * S - 0-255 - * R - Flag to reset sensitivity to default - */ - /** * The Marlin format for the M672 command is different than shown in the Duet Smart Effector * documentation https://duet3d.dozuki.com/Wiki/Smart_effector_and_carriage_adapters_for_delta_printer @@ -77,6 +69,13 @@ void M672_send(uint8_t b) { // bit rate requirement: 1KHz +/- 30% } } +/** + * M672 - Set/reset Duet Smart Effector sensitivity + * + * One of these is required: + * S - 0-255 + * R - Flag to reset sensitivity to default + */ void GcodeSuite::M672() { if (parser.seen('R')) { M672_send(M672_ERASEBYTE); @@ -96,4 +95,4 @@ void GcodeSuite::M672() { OUT_WRITE(SMART_EFFECTOR_MOD_PIN, LOW); // Keep Smart Effector in NORMAL mode } -#endif // SMART_EFFECTOR && SMART_EFFECTOR_MOD_PIN +#endif // DUET_SMART_EFFECTOR && SMART_EFFECTOR_MOD_PIN diff --git a/Marlin/src/gcode/feature/camera/M240.cpp b/Marlin/src/gcode/feature/camera/M240.cpp index 9664ce15222b..fc350d8a558c 100644 --- a/Marlin/src/gcode/feature/camera/M240.cpp +++ b/Marlin/src/gcode/feature/camera/M240.cpp @@ -126,7 +126,7 @@ void GcodeSuite::M240() { #ifdef PHOTO_POSITION - if (axis_unhomed_error()) return; + if (homing_needed_error()) return; const xyz_pos_t old_pos = { current_position.x + parser.linearval('A'), diff --git a/Marlin/src/gcode/feature/clean/G12.cpp b/Marlin/src/gcode/feature/clean/G12.cpp index fc99cc5c1d06..f91db39703f0 100644 --- a/Marlin/src/gcode/feature/clean/G12.cpp +++ b/Marlin/src/gcode/feature/clean/G12.cpp @@ -45,7 +45,7 @@ */ void GcodeSuite::G12() { // Don't allow nozzle cleaning without homing first - if (axis_unhomed_error()) return; + if (homing_needed_error()) return; #ifdef WIPE_SEQUENCE_COMMANDS if (!parser.seen_any()) { diff --git a/Marlin/src/gcode/feature/leds/M150.cpp b/Marlin/src/gcode/feature/leds/M150.cpp index 88f02951add2..cf09bf14ead7 100644 --- a/Marlin/src/gcode/feature/leds/M150.cpp +++ b/Marlin/src/gcode/feature/leds/M150.cpp @@ -35,7 +35,10 @@ * If brightness is left out, no value changed * * With NEOPIXEL_LED: - * I Set the Neopixel index to affect. Default: All + * I Set the NeoPixel index to affect. Default: All + * + * With NEOPIXEL2_SEPARATE: + * S The NeoPixel strip to set. Default is index 0. * * Examples: * @@ -47,18 +50,35 @@ * M150 P127 ; Set LED 50% brightness * M150 P ; Set LED full brightness * M150 I1 R ; Set NEOPIXEL index 1 to red + * M150 S1 I1 R ; Set SEPARATE index 1 to red */ + void GcodeSuite::M150() { #if ENABLED(NEOPIXEL_LED) - neo.set_neo_index(parser.intval('I', -1)); + const uint8_t index = parser.intval('I', -1); + #if ENABLED(NEOPIXEL2_SEPARATE) + const uint8_t unit = parser.intval('S'), + brightness = unit ? neo2.brightness() : neo.brightness(); + *(unit ? &neo2.neoindex : &neo.neoindex) = index; + #else + const uint8_t brightness = neo.brightness(); + neo.neoindex = index; + #endif #endif - leds.set_color(MakeLEDColor( + + const LEDColor color = MakeLEDColor( 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) : neo.brightness() - )); + parser.seen('P') ? (parser.has_value() ? parser.value_byte() : 255) : brightness + ); + + #if ENABLED(NEOPIXEL2_SEPARATE) + if (unit == 1) { leds2.set_color(color); return; } + #endif + + leds.set_color(color); } #endif // HAS_COLOR_LEDS diff --git a/Marlin/src/gcode/feature/mixing/M166.cpp b/Marlin/src/gcode/feature/mixing/M166.cpp index 5f2c4f042a56..9e071a47ec27 100644 --- a/Marlin/src/gcode/feature/mixing/M166.cpp +++ b/Marlin/src/gcode/feature/mixing/M166.cpp @@ -86,7 +86,14 @@ void GcodeSuite::M166() { echo_zt(mixer.gradient.end_vtool, mixer.gradient.end_z); mixer.update_mix_from_gradient(); - SERIAL_ECHOPAIR(" ; Current Z", planner.get_axis_position_mm(Z_AXIS)); + + SERIAL_ECHOPGM(" ; Current Z"); + #if ENABLED(DELTA) + get_cartesian_from_steppers(); + SERIAL_ECHO(cartes.z); + #else + SERIAL_ECHO(planner.get_axis_position_mm(Z_AXIS)); + #endif echo_mix(); } diff --git a/Marlin/src/gcode/feature/password/M510-M512.cpp b/Marlin/src/gcode/feature/password/M510-M512.cpp index f26fb75fdada..79f1da065b3c 100644 --- a/Marlin/src/gcode/feature/password/M510-M512.cpp +++ b/Marlin/src/gcode/feature/password/M510-M512.cpp @@ -16,7 +16,7 @@ * 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 . + * along with this program. If not, see . * */ diff --git a/Marlin/src/gcode/feature/pause/G27.cpp b/Marlin/src/gcode/feature/pause/G27.cpp index ea6aadf173c0..3ce618d67568 100644 --- a/Marlin/src/gcode/feature/pause/G27.cpp +++ b/Marlin/src/gcode/feature/pause/G27.cpp @@ -34,7 +34,7 @@ */ void GcodeSuite::G27() { // Don't allow nozzle parking without homing first - if (axis_unhomed_error()) return; + if (homing_needed_error()) return; nozzle.park(parser.ushortval('P')); } diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index 673c7387ef98..b78608f7aee7 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -45,6 +45,10 @@ #include "../../../feature/mixing.h" #endif +#if HAS_FILAMENT_SENSOR + #include "../../../feature/runout.h" +#endif + /** * M600: Pause for filament change * @@ -158,6 +162,9 @@ void GcodeSuite::M600() { beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS); #endif } + else { + TERN_(HAS_FILAMENT_SENSOR, runout.reset()); + } #if EXTRUDERS > 1 // Restore toolhead if it was changed diff --git a/Marlin/src/gcode/feature/pause/M701_M702.cpp b/Marlin/src/gcode/feature/pause/M701_M702.cpp index 7449787d780b..a02f2368e21c 100644 --- a/Marlin/src/gcode/feature/pause/M701_M702.cpp +++ b/Marlin/src/gcode/feature/pause/M701_M702.cpp @@ -61,7 +61,7 @@ void GcodeSuite::M701() { #if ENABLED(NO_MOTION_BEFORE_HOMING) // Don't raise Z if the machine isn't homed - if (axes_need_homing()) park_point.z = 0; + if (axes_should_home()) park_point.z = 0; #endif #if ENABLED(MIXING_EXTRUDER) @@ -149,7 +149,7 @@ void GcodeSuite::M702() { #if ENABLED(NO_MOTION_BEFORE_HOMING) // Don't raise Z if the machine isn't homed - if (axes_need_homing()) park_point.z = 0; + if (axes_should_home()) park_point.z = 0; #endif #if ENABLED(MIXING_EXTRUDER) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index edbeca9c9279..c0a795025fc7 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -790,7 +790,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 666: M666(); break; // M666: Set delta or multiple endstop adjustment #endif - #if ENABLED(SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) + #if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) case 672: M672(); break; // M672: Set/clear Duet Smart Effector sensitivity #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index e04cd637eb92..23bf2c0ce5b1 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -155,7 +155,7 @@ * M141 - Set heated chamber target temp. S (Requires a chamber heater) * M145 - Set heatup values for materials on the LCD. H B F for S (0=PLA, 1=ABS) * M149 - Set temperature units. (Requires TEMPERATURE_UNITS_SUPPORT) - * M150 - Set Status LED Color as R U B P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, or PCA9632). + * M150 - Set Status LED Color as R U B W P. Values 0-255. (Requires BLINKM, RGB_LED, RGBW_LED, NEOPIXEL_LED, PCA9533, or PCA9632). * M155 - Auto-report temperatures with interval of S. (Requires AUTO_REPORT_TEMPERATURES) * M163 - Set a single proportion for a mixing extruder. (Requires MIXING_EXTRUDER) * M164 - Commit the mix and save to a virtual tool (current, or as specified by 'S'). (Requires MIXING_EXTRUDER) @@ -236,7 +236,7 @@ * M605 - Set Dual X-Carriage movement mode: "M605 S [X] [R]". (Requires DUAL_X_CARRIAGE) * M665 - Set delta configurations: "M665 H L R S B X Y Z (Requires DELTA) * M666 - Set/get offsets for delta (Requires DELTA) or dual endstops. (Requires [XYZ]_DUAL_ENDSTOPS) - * M672 - Set/Reset Duet Smart Effector's sensitivity. (Requires SMART_EFFECTOR and SMART_EFFECTOR_MOD_PIN) + * M672 - Set/Reset Duet Smart Effector's sensitivity. (Requires DUET_SMART_EFFECTOR and SMART_EFFECTOR_MOD_PIN) * M701 - Load filament (Requires FILAMENT_LOAD_UNLOAD_GCODES) * M702 - Unload filament (Requires FILAMENT_LOAD_UNLOAD_GCODES) * M810-M819 - Define/execute a G-code macro (Requires GCODE_MACROS) @@ -792,7 +792,7 @@ class GcodeSuite { static void M666(); #endif - #if ENABLED(SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) + #if ENABLED(DUET_SMART_EFFECTOR) && PIN_EXISTS(SMART_EFFECTOR_MOD) static void M672(); #endif diff --git a/Marlin/src/gcode/geometry/M206_M428.cpp b/Marlin/src/gcode/geometry/M206_M428.cpp index 2a007427a79c..a477a1a526ef 100644 --- a/Marlin/src/gcode/geometry/M206_M428.cpp +++ b/Marlin/src/gcode/geometry/M206_M428.cpp @@ -61,7 +61,7 @@ void GcodeSuite::M206() { * Use M206 to set these values directly. */ void GcodeSuite::M428() { - if (axis_unhomed_error()) return; + if (homing_needed_error()) return; xyz_float_t diff; LOOP_XYZ(i) { diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp index 87ca23becd48..9970dc4df95c 100644 --- a/Marlin/src/gcode/host/M360.cpp +++ b/Marlin/src/gcode/host/M360.cpp @@ -145,10 +145,11 @@ void GcodeSuite::M360() { config_prefix(PSTR("PrinterType")); SERIAL_ECHOLNPGM( - TERN_(DELTA, "Delta") - TERN_(IS_SCARA, "SCARA") - TERN_(IS_CORE, "Core") - TERN_(IS_CARTESIAN, "Cartesian") + TERN_(DELTA, "Delta") + TERN_(IS_SCARA, "SCARA") + TERN_(IS_CORE, "Core") + TERN_(MARKFORGED_XY, "MarkForged") + TERN_(IS_CARTESIAN, "Cartesian") ); // diff --git a/Marlin/src/gcode/motion/G0_G1.cpp b/Marlin/src/gcode/motion/G0_G1.cpp index 3aa082c25e83..b6ddf9634b7b 100644 --- a/Marlin/src/gcode/motion/G0_G1.cpp +++ b/Marlin/src/gcode/motion/G0_G1.cpp @@ -52,7 +52,7 @@ void GcodeSuite::G0_G1( if (IsRunning() #if ENABLED(NO_MOTION_BEFORE_HOMING) - && !axis_unhomed_error( + && !homing_needed_error( (parser.seen('X') ? _BV(X_AXIS) : 0) | (parser.seen('Y') ? _BV(Y_AXIS) : 0) | (parser.seen('Z') ? _BV(Z_AXIS) : 0) ) diff --git a/Marlin/src/gcode/sd/M20.cpp b/Marlin/src/gcode/sd/M20.cpp index 6d4c55752cc3..7ac4affdae9c 100644 --- a/Marlin/src/gcode/sd/M20.cpp +++ b/Marlin/src/gcode/sd/M20.cpp @@ -31,9 +31,13 @@ * M20: List SD card to serial output */ void GcodeSuite::M20() { - SERIAL_ECHOLNPGM(STR_BEGIN_FILE_LIST); - card.ls(); - SERIAL_ECHOLNPGM(STR_END_FILE_LIST); + if (card.flag.mounted) { + SERIAL_ECHOLNPGM(STR_BEGIN_FILE_LIST); + card.ls(); + SERIAL_ECHOLNPGM(STR_END_FILE_LIST); + } + else + SERIAL_ECHO_MSG(STR_NO_MEDIA); } #endif // SDSUPPORT diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index ccafd413cfcb..d5ef62b621b6 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -26,6 +26,7 @@ * Conditionals that need to be set before Configuration_adv.h or pins.h */ +// Kinematics #if ENABLED(MORGAN_SCARA) #define IS_SCARA 1 #define IS_KINEMATIC 1 @@ -35,10 +36,26 @@ #define IS_CARTESIAN 1 #endif +// MKS_LCD12864 is a variant of MKS_MINI_12864 #if ENABLED(MKS_LCD12864) #define MKS_MINI_12864 #endif +/** + * General Flags that may be set below by specific LCDs + * + * DOGLCD : Run a Graphical LCD through U8GLib (with MarlinUI) + * IS_ULTIPANEL : Define LCD_PINS_D5/6/7 for direct-connected "Ultipanel" LCDs + * IS_ULTRA_LCD : Ultra LCD, not necessarily Ultipanel. Used most often with NEWPANEL. + * IS_RRD_SC : Common RRD Smart Controller digital interface pins + * IS_RRD_FG_SC : Common RRD Full Graphical Smart Controller digital interface pins + * U8GLIB_ST7920 : Most common DOGM display SPI interface, supporting a "lightweight" display mode. + * U8GLIB_SH1106 : SH1106 OLED with I2C interface via U8GLib + * IS_U8GLIB_SSD1306 : SSD1306 OLED with I2C interface via U8GLib + * U8GLIB_SSD1309 : SSD1309 OLED with I2C interface via U8GLib + * U8GLIB_ST7565_64128N : ST7565 128x64 LCD with SPI interface via U8GLib + * U8GLIB_LM6059_AF : LM6059 with Hardware SPI via U8GLib + */ #if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #define MINIPANEL @@ -48,6 +65,11 @@ #define DOGLCD #define IS_ULTIPANEL +#elif EITHER(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) + + #define IS_DWIN_MARLINUI 1 + #define IS_ULTIPANEL + #elif ENABLED(ZONESTAR_LCD) #define ADC_KEYPAD @@ -85,7 +107,6 @@ #elif ANY(miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864) - #define IS_ULTRA_LCD #define DOGLCD #define IS_ULTIPANEL @@ -234,9 +255,9 @@ // 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106 #if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106) - #define HAS_SSD1306_OLED_I2C 1 + #define HAS_U8GLIB_I2C_OLED 1 #endif -#if HAS_SSD1306_OLED_I2C +#if HAS_U8GLIB_I2C_OLED #define IS_ULTRA_LCD #define DOGLCD #endif @@ -402,7 +423,6 @@ #define IS_ULTRA_LCD #define NEWPANEL #endif - #if ENABLED(IS_ULTRA_LCD) #define ULTRA_LCD #endif @@ -512,7 +532,7 @@ #undef DISABLE_INACTIVE_EXTRUDER #endif -// Prusa MK2 Multiplexer and MMU 2.0 force SINGLENOZZLE +// Průša MK2 Multiplexer and MMU 2.0 force SINGLENOZZLE #if EITHER(MK2_MULTIPLEXER, PRUSA_MMU2) #define SINGLENOZZLE #endif diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index fa4f0cd9b1f6..35542f9412ab 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -246,6 +246,28 @@ #endif #endif +#if BOTH(LED_CONTROL_MENU, NEOPIXEL2_SEPARATE) + #ifndef LED2_USER_PRESET_RED + #define LED2_USER_PRESET_RED 255 + #endif + #ifndef LED2_USER_PRESET_GREEN + #define LED2_USER_PRESET_GREEN 255 + #endif + #ifndef LED2_USER_PRESET_BLUE + #define LED2_USER_PRESET_BLUE 255 + #endif + #ifndef LED2_USER_PRESET_WHITE + #define LED2_USER_PRESET_WHITE 0 + #endif + #ifndef LED2_USER_PRESET_BRIGHTNESS + #ifdef NEOPIXEL2_BRIGHTNESS + #define LED2_USER_PRESET_BRIGHTNESS NEOPIXEL2_BRIGHTNESS + #else + #define LED2_USER_PRESET_BRIGHTNESS 255 + #endif + #endif +#endif + // If platform requires early initialization of watchdog to properly boot #if ENABLED(USE_WATCHDOG) && defined(ARDUINO_ARCH_SAM) #define EARLY_WATCHDOG 1 diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index f566643bdb5b..71ae4bb28539 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -149,11 +149,16 @@ #define CORE_AXIS_2 C_AXIS #endif #define CORESIGN(n) (ANY(COREYX, COREZX, COREZY) ? (-(n)) : (n)) +#elif ENABLED(MARKFORGED_XY) + // Markforged kinematics + #define CORE_AXIS_1 A_AXIS + #define CORE_AXIS_2 B_AXIS + #define NORMAL_AXIS Z_AXIS #endif // Calibration codes only for non-core axes #if EITHER(BACKLASH_GCODE, CALIBRATION_GCODE) - #if IS_CORE + #if EITHER(IS_CORE, MARKFORGED_XY) #define X_AXIS_INDEX 0 #define Y_AXIS_INDEX 1 #define Z_AXIS_INDEX 2 diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 5aa614f116ef..775899febb16 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -39,26 +39,20 @@ #define TEST2 1 #define TEST3 0 #define TEST4 true -#if ENABLED(TEST0) +#if ENABLED(TEST0) || !ENABLED(TEST2) || ENABLED(TEST3) #error "ENABLED is borked!" #endif -#if DISABLED(TEST1) - #error "DISABLED is borked!" -#endif -#if !ENABLED(TEST2) - #error "ENABLED is borked!" -#endif -#if ENABLED(TEST3) - #error "ENABLED is borked!" +#if BOTH(TEST0, TEST1) + #error "BOTH is borked!" #endif -#if DISABLED(TEST4) +#if DISABLED(TEST1) || !DISABLED(TEST3) || DISABLED(TEST4) || DISABLED(TEST0, TEST1, TEST2, TEST4) || !DISABLED(TEST0, TEST3) #error "DISABLED is borked!" #endif #if !ANY(TEST1, TEST2, TEST3, TEST4) || ANY(TEST0, TEST3) #error "ANY is borked!" #endif -#if DISABLED(TEST0, TEST1, TEST2, TEST4) - #error "DISABLED is borked!" +#if NONE(TEST0, TEST1, TEST2, TEST4) || !NONE(TEST0, TEST3) + #error "NONE is borked!" #endif #undef TEST1 #undef TEST2 @@ -529,16 +523,11 @@ #error "ANYCUBIC_TFT_MODEL is now ANYCUBIC_LCD_I3MEGA. Please update your Configuration.h." #elif defined(EVENT_GCODE_SD_STOP) #error "EVENT_GCODE_SD_STOP is now EVENT_GCODE_SD_ABORT. Please update your Configuration.h." -#endif - -#ifdef FIL_RUNOUT_INVERTING +#elif defined(FIL_RUNOUT_INVERTING) #if FIL_RUNOUT_INVERTING - #warning "FIL_RUNOUT_INVERTING true is now FIL_RUNOUT_STATE HIGH. Please update Configuration.h." + #error "FIL_RUNOUT_INVERTING true is now FIL_RUNOUT_STATE HIGH. Please update your Configuration.h." #else - #warning "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW. Please update Configuration.h." - #endif - #ifndef FIL_RUNOUT_STATE - #define FIL_RUNOUT_STATE ((FIL_RUNOUT_INVERTING) ? HIGH : LOW) + #error "FIL_RUNOUT_INVERTING false is now FIL_RUNOUT_STATE LOW. Please update your Configuration.h." #endif #endif @@ -775,6 +764,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if ENABLED(BABYSTEPPING) #if ENABLED(SCARA) #error "BABYSTEPPING is not implemented for SCARA yet." + #elif BOTH(MARKFORGED_XY, BABYSTEP_XY) + #error "BABYSTEPPING only implemented for Z axis on MarkForged." #elif BOTH(DELTA, BABYSTEP_XY) #error "BABYSTEPPING only implemented for Z axis on deltabots." #elif BOTH(BABYSTEP_ZPROBE_OFFSET, MESH_BED_LEVELING) @@ -798,6 +789,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #if ENABLED(BABYSTEP_XY) static_assert(BABYSTEP_MULTIPLICATOR_XY <= 0.25f, "BABYSTEP_MULTIPLICATOR_XY must be less than or equal to 0.25mm."); #endif + #elif ENABLED(BABYSTEP_DISPLAY_TOTAL) && ANY(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI) + #error "New Color UI (TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI) does not support BABYSTEP_DISPLAY_TOTAL yet." #endif #endif @@ -1166,8 +1159,9 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS + ENABLED(COREYZ) \ + ENABLED(COREYX) \ + ENABLED(COREZX) \ - + ENABLED(COREZY) - #error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, or COREZY." + + ENABLED(COREZY) \ + + ENABLED(MARKFORGED_XY) + #error "Please enable only one of DELTA, MORGAN_SCARA, COREXY, COREYX, COREXZ, COREZX, COREYZ, COREZY, or MARKFORGED_XY." #endif /** @@ -1587,8 +1581,8 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal #if ENABLED(DUAL_X_CARRIAGE) #if EXTRUDERS < 2 #error "DUAL_X_CARRIAGE requires 2 (or more) extruders." - #elif CORE_IS_XY || CORE_IS_XZ - #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, or COREZX." + #elif ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY) + #error "DUAL_X_CARRIAGE cannot be used with COREXY, COREYX, COREXZ, COREZX, or MARKFORGED_XY." #elif !GOOD_AXIS_PINS(X2) #error "DUAL_X_CARRIAGE requires X2 stepper pins to be defined." #elif !HAS_X_MAX @@ -2127,12 +2121,19 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal #if !(_RGB_TEST && PIN_EXISTS(RGB_LED_W)) #error "RGBW_LED requires RGB_LED_R_PIN, RGB_LED_G_PIN, RGB_LED_B_PIN, and RGB_LED_W_PIN." #endif -#elif ENABLED(NEOPIXEL_LED) - #if !(PIN_EXISTS(NEOPIXEL) && NEOPIXEL_PIXELS > 0) +#endif +#undef _RGB_TEST + +// NeoPixel requirements +#if ENABLED(NEOPIXEL_LED) + #if !PIN_EXISTS(NEOPIXEL) || NEOPIXEL_PIXELS == 0 #error "NEOPIXEL_LED requires NEOPIXEL_PIN and NEOPIXEL_PIXELS." + #elif ENABLED(NEOPIXEL2_SEPARATE) && !(defined(NEOPIXEL2_TYPE) && PIN_EXISTS(NEOPIXEL2) && NEOPIXEL2_PIXELS > 0) + #error "NEOPIXEL2_SEPARATE requires NEOPIXEL2_TYPE, NEOPIXEL2_PIN and NEOPIXEL2_PIXELS." + #elif ENABLED(NEO2_COLOR_PRESETS) && DISABLED(NEOPIXEL2_SEPARATE) + #error "NEO2_COLOR_PRESETS requires NEOPIXEL2_SEPARATE to be enabled." #endif #endif -#undef _RGB_TEST #if DISABLED(NO_COMPILE_TIME_PWM) #define _TEST_PWM(P) PWM_PIN(P) @@ -2202,7 +2203,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal + (ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && DISABLED(IS_RRD_FG_SC)) \ + (ENABLED(ULTRA_LCD) && DISABLED(IS_ULTRA_LCD)) \ + (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \ - + (ENABLED(MINIPANEL) && DISABLED(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \ + + (ENABLED(MINIPANEL) && NONE(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \ + (ENABLED(MKS_MINI_12864) && DISABLED(MKS_LCD12864)) \ + (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \ + (ENABLED(ULTIPANEL) && DISABLED(IS_ULTIPANEL)) \ @@ -2539,6 +2540,8 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal #error "CoreXZ requires both X and Z to use sensorless homing if either one does." #elif CORE_IS_YZ && Y_SENSORLESS != Z_SENSORLESS && !HOMING_Z_WITH_PROBE #error "CoreYZ requires both Y and Z to use sensorless homing if either one does." +#elif ENABLED(MARKFORGED_XY) && X_SENSORLESS != Y_SENSORLESS + #error "MARKFORGED_XY requires both X and Y to use sensorless homing if either one does." #endif // Other TMC feature requirements @@ -2854,6 +2857,10 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #error "BACKLASH_COMPENSATION requires BACKLASH_DISTANCE_MM." #elif !defined(BACKLASH_CORRECTION) #error "BACKLASH_COMPENSATION requires BACKLASH_CORRECTION." + #elif ENABLED(MARKFORGED_XY) + constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM; + static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2], + "BACKLASH_COMPENSATION can only apply to " STRINGIFY(NORMAL_AXIS) " on a MarkForged system."); #elif IS_CORE constexpr float backlash_arr[] = BACKLASH_DISTANCE_MM; static_assert(!backlash_arr[CORE_AXIS_1] && !backlash_arr[CORE_AXIS_2], @@ -2883,7 +2890,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) #endif /** - * Prusa MMU2 requirements + * Průša MMU2 requirements */ #if ENABLED(PRUSA_MMU2) #if EXTRUDERS != 5 @@ -3099,7 +3106,7 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2) * Sanity check for WIFI */ #if EITHER(ESP3D_WIFISUPPORT, WIFISUPPORT) && DISABLED(ARDUINO_ARCH_ESP32) - #error "ESP3D_WIFISUPPORT or WIFISUPPORT requires an ESP32 controller." + #error "ESP3D_WIFISUPPORT or WIFISUPPORT requires an ESP32 MOTHERBOARD." #endif /** diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index 652999971b45..1d14b8e086bd 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -42,7 +42,7 @@ * version was tagged. */ #ifndef STRING_DISTRIBUTION_DATE - #define STRING_DISTRIBUTION_DATE "2020-08-23" + #define STRING_DISTRIBUTION_DATE "2020-09-08" #endif /** diff --git a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp index 9ba9b871ecca..9fe69d442832 100644 --- a/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp +++ b/Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp @@ -982,7 +982,7 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) { if (max_length < 1) return 0; - // TODO: fix the '\\' that doesnt exist in the HD44870 + // TODO: fix the '\\' that doesn't exist in the HD44870 if (c < 128) { lcd.write((uint8_t)c); return 1; diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index 455fc2388ee9..da7d4f6f1ec0 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -82,11 +82,6 @@ #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn - #if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT) - uint8_t u8g_com_stm32duino_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); - #define U8G_COM_HAL_TFT_FN u8g_com_stm32duino_tft_fn - #endif - #elif defined(TARGET_LPC1768) uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); @@ -117,6 +112,9 @@ #ifndef U8G_COM_SSD_I2C_HAL #define U8G_COM_SSD_I2C_HAL u8g_com_null_fn #endif -#ifndef U8G_COM_HAL_TFT_FN +#if EITHER(FSMC_GRAPHICAL_TFT, SPI_GRAPHICAL_TFT) + uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); + #define U8G_COM_HAL_TFT_FN u8g_com_hal_tft_fn +#else #define U8G_COM_HAL_TFT_FN u8g_com_null_fn #endif diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp index b8bfdb293a97..39c294defe5b 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp @@ -760,7 +760,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u static uint8_t msgInitCount = 2; // Ignore all messages until 2nd U8G_COM_MSG_INIT -uint8_t u8g_com_stm32duino_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { +uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { if (msgInitCount) { if (msg == U8G_COM_MSG_INIT) msgInitCount--; if (msgInitCount) return -1; @@ -801,7 +801,7 @@ uint8_t u8g_com_stm32duino_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void break; case U8G_COM_MSG_WRITE_SEQ: - tftio.DataTransferBegin(DATASIZE_8BIT); + tftio.DataTransferBegin(DATASIZE_16BIT); for (uint8_t i = 0; i < arg_val; i += 2) tftio.WriteData(*(uint16_t *)(((uint32_t)arg_ptr) + i)); tftio.DataTransferEnd(); diff --git a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp index 85339e83495a..e4e387c1907f 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp @@ -112,6 +112,7 @@ static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = { U8G_ESC_CS(1), // enable chip UC1701_ALL_PIX(0), // normal display U8G_ESC_CS(0), // disable chip + U8G_ESC_DLY(150), // delay 150 ms before sending any data U8G_ESC_END // end of sequence }; diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index 7ebabd6950b3..bf0edbb8ded2 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -240,39 +240,35 @@ bool MarlinUI::detected() { return true; } // Initialize or re-initialize the LCD void MarlinUI::init_lcd() { - #if DISABLED(MKS_LCD12864) - - #if PIN_EXISTS(LCD_BACKLIGHT) - OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away - #endif - - #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864, ZONESTAR_12864OLED) - SET_OUTPUT(LCD_PINS_DC); - #ifndef LCD_RESET_PIN - #define LCD_RESET_PIN LCD_PINS_RS - #endif - #endif - - #if PIN_EXISTS(LCD_RESET) - // Perform a clean hardware reset with needed delays - OUT_WRITE(LCD_RESET_PIN, LOW); - _delay_ms(5); - WRITE(LCD_RESET_PIN, HIGH); - _delay_ms(5); - u8g.begin(); + #if PIN_EXISTS(LCD_BACKLIGHT) + OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away + #endif + + #if ANY(MKS_12864OLED, MKS_12864OLED_SSD1306, FYSETC_242_OLED_12864, ZONESTAR_12864OLED) + SET_OUTPUT(LCD_PINS_DC); + #ifndef LCD_RESET_PIN + #define LCD_RESET_PIN LCD_PINS_RS #endif - - #if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT) - WRITE(LCD_BACKLIGHT_PIN, HIGH); - #endif - - TERN_(HAS_LCD_CONTRAST, refresh_contrast()); - - TERN_(LCD_SCREEN_ROT_90, u8g.setRot90()); - TERN_(LCD_SCREEN_ROT_180, u8g.setRot180()); - TERN_(LCD_SCREEN_ROT_270, u8g.setRot270()); - - #endif // !MKS_LCD12864 + #endif + + #if PIN_EXISTS(LCD_RESET) + // Perform a clean hardware reset with needed delays + OUT_WRITE(LCD_RESET_PIN, LOW); + _delay_ms(5); + WRITE(LCD_RESET_PIN, HIGH); + _delay_ms(5); + u8g.begin(); + #endif + + #if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT) + WRITE(LCD_BACKLIGHT_PIN, HIGH); + #endif + + TERN_(HAS_LCD_CONTRAST, refresh_contrast()); + + TERN_(LCD_SCREEN_ROT_90, u8g.setRot90()); + TERN_(LCD_SCREEN_ROT_180, u8g.setRot180()); + TERN_(LCD_SCREEN_ROT_270, u8g.setRot270()); uxg_SetUtf8Fonts(g_fontinfo, COUNT(g_fontinfo)); } diff --git a/Marlin/src/lcd/dwin/dwin_lcd.cpp b/Marlin/src/lcd/dwin/dwin_lcd.cpp index 0ca6b8a3ae62..3b30629a8dae 100644 --- a/Marlin/src/lcd/dwin/dwin_lcd.cpp +++ b/Marlin/src/lcd/dwin/dwin_lcd.cpp @@ -37,9 +37,12 @@ #include "dwin_lcd.h" #include // for memset -// Make sure DWIN_SendBuf is large enough to hold the largest -// printed string plus the draw command and tail. -uint8_t DWIN_SendBuf[11 + 24] = { 0xAA }; +//#define DEBUG_OUT 1 +#include "../../core/debug_out.h" + +// Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail. +// Assume the narrowest (6 pixel) font and 2-byte gb2312-encoded characters. +uint8_t DWIN_SendBuf[11 + DWIN_WIDTH / 6 * 2] = { 0xAA }; uint8_t DWIN_BufTail[4] = { 0xCC, 0x33, 0xC3, 0x3C }; uint8_t databuf[26] = { 0 }; uint8_t receivedType; @@ -63,7 +66,7 @@ inline void DWIN_Long(size_t &i, const uint32_t lval) { } inline void DWIN_String(size_t &i, char * const string) { - const size_t len = strlen(string); + const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, strlen(string)); memcpy(&DWIN_SendBuf[i+1], string, len); i += len; } @@ -79,10 +82,8 @@ inline void DWIN_String(size_t &i, const __FlashStringHelper * string) { // Send the data in the buffer and the packet end inline void DWIN_Send(size_t &i) { ++i; - LOOP_L_N(n, i) { MYSERIAL1.write(DWIN_SendBuf[n]); - delayMicroseconds(1); } - LOOP_L_N(n, 4) { MYSERIAL1.write(DWIN_BufTail[n]); - delayMicroseconds(1); } + LOOP_L_N(n, i) { MYSERIAL1.write(DWIN_SendBuf[n]); delayMicroseconds(1); } + LOOP_L_N(n, 4) { MYSERIAL1.write(DWIN_BufTail[n]); delayMicroseconds(1); } } /*-------------------------------------- System variable function --------------------------------------*/ @@ -185,7 +186,6 @@ void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, DWIN_Send(i); } -// // Move a screen area // mode: 0, circle shift; 1, translation // dir: 0=left, 1=right, 2=up, 3=down @@ -230,19 +230,6 @@ void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, DWIN_Send(i); } -void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, - uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *string) { - size_t i = 0; - DWIN_Byte(i, 0x11); - DWIN_Byte(i, (widthAdjust * 0x80) | (bShow * 0x40) | size); - DWIN_Word(i, color); - DWIN_Word(i, bColor); - DWIN_Word(i, x); - DWIN_Word(i, y); - DWIN_String(i, string); - DWIN_Send(i); -} - // Draw a positive integer // bShow: true=display background color; false=don't display background color // zeroFill: true=zero fill; false=no zero fill @@ -343,8 +330,9 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { DWIN_Send(i); } -// Unzip the JPG picture to virtual display area #1 -// id: picture ID +// Unzip the JPG picture to a virtual display area +// n: Cache index +// id: Picture ID void DWIN_JPG_CacheToN(uint8_t n, uint8_t id) { size_t i = 0; DWIN_Byte(i, 0x25); diff --git a/Marlin/src/lcd/dwin/dwin_lcd.h b/Marlin/src/lcd/dwin/dwin_lcd.h index 3fae1ccfc91a..0893974e4c3f 100644 --- a/Marlin/src/lcd/dwin/dwin_lcd.h +++ b/Marlin/src/lcd/dwin/dwin_lcd.h @@ -42,70 +42,151 @@ #define DWIN_WIDTH 272 #define DWIN_HEIGHT 480 -/*接收数据解析 返回值:true,接收到数据;false,未接收到数据*/ -bool DWIN_ReceiveAnalyze(void); +/*-------------------------------------- System variable function --------------------------------------*/ -/*发送当前BUF中的数据以及包尾数据 len:整包数据长度*/ -void DWIN_Send_BufTail(const uint8_t len); - -/*----------------------------------------------系统变量函数----------------------------------------------*/ -/*握手 1: 握手成功 2: 握手失败*/ +// Handshake (1: Success, 0: Fail) bool DWIN_Handshake(void); -/*设定背光亮度 luminance:亮度(0x00~0xFF)*/ +// Common DWIN startup +void DWIN_Startup(void); + +// Set the backlight luminance +// luminance: (0x00-0xFF) void DWIN_Backlight_SetLuminance(const uint8_t luminance); -/*设定画面显示方向 dir:0,0°; 1,90°; 2,180°; 3,270°*/ +// Set screen display direction +// dir: 0=0°, 1=90°, 2=180°, 3=270° void DWIN_Frame_SetDir(uint8_t dir); -/*更新显示*/ +// Update display void DWIN_UpdateLCD(void); -/*----------------------------------------------绘图相关函数----------------------------------------------*/ -/*画面清屏 color:清屏颜色*/ +/*---------------------------------------- Drawing functions ----------------------------------------*/ + +// Clear screen +// color: Clear screen color void DWIN_Frame_Clear(const uint16_t color); -/*画面画线 color:线段颜色 xStart:X起始坐标 yStart:Y起始坐标 xEnd:X终止坐标 yEnd:Y终止坐标*/ +// Draw a line +// color: Line segment color +// xStart/yStart: Start point +// xEnd/yEnd: End point void DWIN_Draw_Line(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd); -/*画面画矩形 mode:0,外框;1,填充;2,异或填充 color:颜色 xStart/yStart:矩形左上坐标 xEnd/yEnd:矩形右下坐标*/ +// Draw a Horizontal line +// color: Line segment color +// xStart/yStart: Start point +// xLength: Line Length +inline void DWIN_Draw_HLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xLength) { + DWIN_Draw_Line(color, xStart, yStart, xStart + xLength - 1, yStart); +} + +// Draw a Vertical line +// color: Line segment color +// xStart/yStart: Start point +// yLength: Line Length +inline void DWIN_Draw_VLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t yLength) { + DWIN_Draw_Line(color, xStart, yStart, xStart, yStart + yLength - 1); +} + +// Draw a rectangle +// mode: 0=frame, 1=fill, 2=XOR fill +// color: Rectangle color +// xStart/yStart: upper left point +// xEnd/yEnd: lower right point void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd); -/*画面区域移动 mode:0,环移;1,平移 dir:0,向左移动;1,向右移动;2,向上移动;3,向下移动 dis:移动距离 - color:填充颜色 xStart/yStart:选定区域左上坐标 xEnd/yEnd:选定区域右下坐标*/ +// Draw a box +// mode: 0=frame, 1=fill, 2=XOR fill +// color: Rectangle color +// xStart/yStart: upper left point +// xSize/ySize: box size +inline void DWIN_Draw_Box(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xSize, uint16_t ySize) { + DWIN_Draw_Rectangle(mode, color, xStart, yStart, xStart + xSize - 1, yStart + ySize - 1); +} + +// Move a screen area +// mode: 0, circle shift; 1, translation +// dir: 0=left, 1=right, 2=up, 3=down +// dis: Distance +// color: Fill color +// xStart/yStart: upper left point +// xEnd/yEnd: bottom right point void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd); -/*----------------------------------------------文本相关函数----------------------------------------------*/ -/*画面显示字符串 widthAdjust:true,自调整字符宽度;false,不调整字符宽度 bShow:true,显示背景色;false,不显示背景色 size:字号大小 - color:字符颜色 bColor:背景颜色 x/y:字符串左上坐标 *string:字符串*/ +/*---------------------------------------- Text related functions ----------------------------------------*/ + +// Draw a string +// widthAdjust: true=self-adjust character width; false=no adjustment +// bShow: true=display background color; false=don't display background color +// size: Font size +// color: Character color +// bColor: Background color +// x/y: Upper-left coordinate of the string +// *string: The string void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string); -/*画面显示正整数 bShow:true,显示背景色;false,不显示背景色 zeroFill:true,补零;false,不补零 zeroMode:1,无效0显示为0; 0,无效0显示为空格 size:字号大小 - color:字符颜色 bColor:背景颜色 iNum:位数 x/y:变量左上坐标 value:整型变量*/ +class __FlashStringHelper; + +inline void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) { + DWIN_Draw_String(widthAdjust, bShow, size, color, bColor, x, y, (char *)title); +} + +// Draw a positive integer +// bShow: true=display background color; false=don't display background color +// zeroFill: true=zero fill; false=no zero fill +// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space +// size: Font size +// color: Character color +// bColor: Background color +// iNum: Number of digits +// x/y: Upper-left coordinate +// value: Integer value void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint16_t value); -/*画面显示浮点数 bShow:true,显示背景色;false,不显示背景色 zeroFill:true,补零;false,不补零 zeroMode:1,无效0显示为0; 0,无效0显示为空格 size:字号大小 - color:字符颜色 bColor:背景颜色 iNum:整数位数 fNum:小数位数 x/y:变量左上坐标 value:浮点数变量*/ +// Draw a floating point number +// bShow: true=display background color; false=don't display background color +// zeroFill: true=zero fill; false=no zero fill +// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space +// size: Font size +// color: Character color +// bColor: Background color +// iNum: Number of whole digits +// fNum: Number of decimal digits +// x/y: Upper-left point +// value: Float value void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); -/*----------------------------------------------图片相关函数----------------------------------------------*/ -/*jpg图片显示并缓存在#0虚拟显示区 id:图片ID*/ +/*---------------------------------------- Picture related functions ----------------------------------------*/ + +// Draw JPG and cached in #0 virtual display area +// id: Picture ID void DWIN_JPG_ShowAndCache(const uint8_t id); -/*图标显示 libID:图标库ID picID:图标ID x/y:图标左上坐标*/ +// Draw an Icon +// libID: Icon library ID +// picID: Icon ID +// x/y: Upper-left point void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y); -/*jpg图片解压到#1虚拟显示区 id:图片ID*/ +// Unzip the JPG picture to a virtual display area +// n: Cache index +// id: Picture ID void DWIN_JPG_CacheToN(uint8_t n, uint8_t id); -/*jpg图片解压到#1虚拟显示区 id:图片ID*/ +// Unzip the JPG picture to virtual display area #1 +// id: Picture ID inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); } -/*从虚拟显示区复制区域至当前画面 cacheID:虚拟区号 xStart/yStart:虚拟区左上坐标 xEnd/yEnd:虚拟区右下坐标 x/y:当前画面粘贴坐标*/ +// Copy area from virtual display area to current screen +// cacheID: virtual area number +// xStart/yStart: Upper-left of virtual area +// xEnd/yEnd: Lower-right of virtual area +// x/y: Screen paste point void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); diff --git a/Marlin/src/lcd/dwin/README.md b/Marlin/src/lcd/dwin/e3v2/README.md similarity index 100% rename from Marlin/src/lcd/dwin/README.md rename to Marlin/src/lcd/dwin/e3v2/README.md diff --git a/Marlin/src/lcd/dwin/dwin.cpp b/Marlin/src/lcd/dwin/e3v2/dwin.cpp similarity index 98% rename from Marlin/src/lcd/dwin/dwin.cpp rename to Marlin/src/lcd/dwin/e3v2/dwin.cpp index 0d719542e182..1d9c83e6da8a 100644 --- a/Marlin/src/lcd/dwin/dwin.cpp +++ b/Marlin/src/lcd/dwin/e3v2/dwin.cpp @@ -24,45 +24,49 @@ * DWIN by Creality3D */ -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ENABLED(DWIN_CREALITY_LCD) +#if ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT) && DISABLED(PROBE_MANUALLY) + #define HAS_ONESTEP_LEVELING 1 +#endif + #include "dwin.h" #include #include #include -#include "../fontutils.h" -#include "../ultralcd.h" +#include "../../fontutils.h" +#include "../../ultralcd.h" -#include "../../sd/cardreader.h" +#include "../../../sd/cardreader.h" -#include "../../MarlinCore.h" -#include "../../core/serial.h" -#include "../../core/macros.h" -#include "../../gcode/queue.h" +#include "../../../MarlinCore.h" +#include "../../../core/serial.h" +#include "../../../core/macros.h" +#include "../../../gcode/queue.h" -#include "../../feature/powerloss.h" -#include "../../feature/babystep.h" +#include "../../../feature/powerloss.h" +#include "../../../feature/babystep.h" -#include "../../module/settings.h" -#include "../../module/temperature.h" -#include "../../module/printcounter.h" -#include "../../module/motion.h" -#include "../../module/planner.h" +#include "../../../module/settings.h" +#include "../../../module/temperature.h" +#include "../../../module/printcounter.h" +#include "../../../module/motion.h" +#include "../../../module/planner.h" #if ENABLED(HOST_ACTION_COMMANDS) - #include "../../feature/host_actions.h" + #include "../../../feature/host_actions.h" #endif -#if HAS_LEVELING - #include "../../feature/bedlevel/bedlevel.h" +#if HAS_ONESTEP_LEVELING + #include "../../../feature/bedlevel/bedlevel.h" #endif #if HAS_BED_PROBE - #include "../../module/probe.h" + #include "../../../module/probe.h" #endif #ifndef MACHINE_SIZE @@ -596,7 +600,7 @@ inline void Draw_Prepare_Menu() { inline void Draw_Control_Menu() { Clear_Main_Window(); - const int16_t scroll = TERN(HAS_LEVELING, MROWS - index_control, 0); // Scrolled-up lines + const int16_t scroll = TERN(HAS_ONESTEP_LEVELING, MROWS - index_control, 0); // Scrolled-up lines #define CSCROL(L) (scroll + (L)) #define CLINE(L) MBASE(CSCROL(L)) @@ -976,7 +980,7 @@ void Goto_MainMenu(void) { ICON_Print(); ICON_Prepare(); ICON_Control(); - TERN(HAS_LEVELING, ICON_Leveling, ICON_StartInfo)(select_page.now == 3); + TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(select_page.now == 3); } inline ENCODER_DiffState get_encoder_state() { @@ -1528,7 +1532,7 @@ void update_variable(void) { #define strcasecmp_P(a, b) strcasecmp((a), (b)) #endif -inline void make_name_without_ext(char *dst, char *src, int maxlen=MENU_CHAR_LIMIT) { +inline void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) { char * const name = card.longest_filename(); size_t pos = strlen(name); // index of ending nul @@ -1782,7 +1786,7 @@ void HMI_MainMenu(void) { case 0: ICON_Print(); break; case 1: ICON_Print(); ICON_Prepare(); break; case 2: ICON_Prepare(); ICON_Control(); break; - case 3: ICON_Control(); TERN(HAS_LEVELING, ICON_Leveling, ICON_StartInfo)(1); break; + case 3: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(1); break; } } } @@ -1791,8 +1795,8 @@ void HMI_MainMenu(void) { switch (select_page.now) { case 0: ICON_Print(); ICON_Prepare(); break; case 1: ICON_Prepare(); ICON_Control(); break; - case 2: ICON_Control(); TERN(HAS_LEVELING, ICON_Leveling, ICON_StartInfo)(0); break; - case 3: TERN(HAS_LEVELING, ICON_Leveling, ICON_StartInfo)(1); break; + case 2: ICON_Control(); TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(0); break; + case 3: TERN(HAS_ONESTEP_LEVELING, ICON_Leveling, ICON_StartInfo)(1); break; } } } @@ -1822,7 +1826,7 @@ void HMI_MainMenu(void) { /* Leveling */ case 3: - #if HAS_LEVELING + #if HAS_ONESTEP_LEVELING checkkey = Leveling; HMI_Leveling(); #else @@ -2133,7 +2137,7 @@ inline void Draw_Move_Menu() { LOOP_L_N(i, MROWS) Draw_Menu_Line(i + 1, ICON_MoveX + i); } -#include "../../libs/buzzer.h" +#include "../../../libs/buzzer.h" void HMI_AudioFeedback(const bool success=true) { if (success) { @@ -2324,7 +2328,7 @@ void HMI_Control(void) { // Avoid flicker by updating only the previous menu if (encoder_diffState == ENCODER_DIFF_CW) { - #define CONTROL_ITEMS (5 + ENABLED(HAS_LEVELING)) + #define CONTROL_ITEMS (5 + ENABLED(HAS_ONESTEP_LEVELING)) if (select_control.inc(CONTROL_ITEMS)) { if (select_control.now > MROWS && select_control.now > index_control) { index_control = select_control.now; @@ -2402,12 +2406,17 @@ void HMI_Control(void) { DWIN_UpdateLCD(); } -/* Leveling */ -void HMI_Leveling(void) { - Popup_Window_Leveling(); - DWIN_UpdateLCD(); - queue.inject_P(PSTR("G28O\nG29")); -} + +#if HAS_ONESTEP_LEVELING + + /* Leveling */ + void HMI_Leveling(void) { + Popup_Window_Leveling(); + DWIN_UpdateLCD(); + queue.inject_P(PSTR("G28O\nG29")); + } + +#endif /* Axis Move */ void HMI_AxisMove(void) { @@ -2896,7 +2905,7 @@ void HMI_Info(void) { ENCODER_DiffState encoder_diffState = get_encoder_state(); if (encoder_diffState == ENCODER_DIFF_NO) return; if (encoder_diffState == ENCODER_DIFF_ENTER) { - #if HAS_LEVELING + #if HAS_ONESTEP_LEVELING checkkey = Control; select_control.set(CONTROL_ITEMS); Draw_Control_Menu(); @@ -3341,13 +3350,6 @@ void HMI_Init(void) { } HMI_SetLanguage(); - - #if ENABLED(FIX_MOUNTED_PROBE) // For "CREALITY_TOUCH" probe too? - SET_OUTPUT(COM_PIN); - WRITE(COM_PIN, 1); - #endif - - delay(200); } void DWIN_Update(void) { diff --git a/Marlin/src/lcd/dwin/dwin.h b/Marlin/src/lcd/dwin/e3v2/dwin.h similarity index 99% rename from Marlin/src/lcd/dwin/dwin.h rename to Marlin/src/lcd/dwin/e3v2/dwin.h index 3446a0d4c18e..dffd40bd03fb 100644 --- a/Marlin/src/lcd/dwin/dwin.h +++ b/Marlin/src/lcd/dwin/e3v2/dwin.h @@ -25,9 +25,9 @@ * DWIN by Creality3D */ -#include "dwin_lcd.h" +#include "../dwin_lcd.h" #include "rotary_encoder.h" -#include "../../libs/BL24CXX.h" +#include "../../../libs/BL24CXX.h" #include diff --git a/Marlin/src/lcd/dwin/rotary_encoder.cpp b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp similarity index 98% rename from Marlin/src/lcd/dwin/rotary_encoder.cpp rename to Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp index 62e2cda35126..e4c563cf6b98 100644 --- a/Marlin/src/lcd/dwin/rotary_encoder.cpp +++ b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp @@ -30,17 +30,17 @@ ****************************************************************************** **/ -#include "../../inc/MarlinConfigPre.h" +#include "../../../inc/MarlinConfigPre.h" #if ENABLED(DWIN_CREALITY_LCD) #include "rotary_encoder.h" -#include "../../MarlinCore.h" -#include "../../HAL/shared/Delay.h" +#include "../../../MarlinCore.h" +#include "../../../HAL/shared/Delay.h" #if HAS_BUZZER - #include "../../libs/buzzer.h" + #include "../../../libs/buzzer.h" #endif #include diff --git a/Marlin/src/lcd/dwin/rotary_encoder.h b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.h similarity index 97% rename from Marlin/src/lcd/dwin/rotary_encoder.h rename to Marlin/src/lcd/dwin/e3v2/rotary_encoder.h index 5c5a8f86a29b..db074098ebf1 100644 --- a/Marlin/src/lcd/dwin/rotary_encoder.h +++ b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.h @@ -31,8 +31,8 @@ ****************************************************************************** **/ -#include "../../inc/MarlinConfig.h" -#include "../../MarlinCore.h" +#include "../../../inc/MarlinConfig.h" +#include "../../../MarlinCore.h" /*********************** Encoder Set ***********************/ diff --git a/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp index 1c9b9299fc43..9b54dbdd2ba2 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -28,6 +28,7 @@ #include "../../../../inc/MarlinConfig.h" #include "../../ui_api.h" #include "../../../../MarlinCore.h" // for quickstop_stepper and disable_steppers +#include "../../../../module/motion.h" // for A20 read printing speed feedrate_percentage // command sending macro's with debugging capability #define SEND_PGM(x) send_P(PSTR(x)) @@ -412,6 +413,7 @@ void AnycubicTFTClass::RenderCurrentFileList() { uint16_t selectedNumber = 0; SelectedDirectory[0] = 0; SelectedFile[0] = 0; + ExtUI::FileList currentFileList; SENDLINE_PGM("FN "); // Filelist start @@ -427,7 +429,7 @@ void AnycubicTFTClass::RenderCurrentFileList() { if (SpecialMenu) RenderSpecialMenu(selectedNumber); - else + else if (selectedNumber <= currentFileList.count()) RenderCurrentFolder(selectedNumber); } SENDLINE_PGM("END"); // Filelist stop @@ -804,7 +806,6 @@ void AnycubicTFTClass::GetCommandFromTFT() { break; case 20: { // A20 read printing speed - int16_t feedrate_percentage = 100; if (CodeSeen('S')) feedrate_percentage = constrain(CodeValue(), 40, 999); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.h index 1bb35a599577..a9fdb5c5c73c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.h @@ -133,6 +133,7 @@ class CLCD { static void set_brightness (uint8_t brightness); static uint8_t get_brightness(); static void host_cmd (unsigned char host_command, unsigned char byte2); + static uint32_t dl_size() {return CLCD::mem_read_32(REG::CMD_DL) & 0x1FFF;} static void get_font_metrics (uint8_t font, struct FontMetrics &fm); static uint16_t get_text_width(const uint8_t font, const char *str); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp index 728e433154ae..f736916a3be4 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.cpp @@ -32,7 +32,8 @@ * * The cache memory begins with a table at * DL_CACHE_START: each table entry contains - * an address and size for a cached DL slot. + * an address, size and used bytes for a cached + * DL slot. * * Immediately following the table is the * DL_FREE_ADDR, which points to free cache @@ -44,11 +45,14 @@ * * DL_CACHE_START slot0_addr 4 * slot0_size 4 + * slot0_used 4 * slot1_addr 4 * slot1_size 4 + * slot1_used 4 * ... * slotN_addr 4 * slotN_size 4 + * slotN_used 4 * DL_FREE_ADDR dl_free_ptr 4 * cached data * ... @@ -57,7 +61,7 @@ */ #define DL_CACHE_START MAP::RAM_G_SIZE - 0xFFFF -#define DL_FREE_ADDR DL_CACHE_START + DL_CACHE_SLOTS * 8 +#define DL_FREE_ADDR DL_CACHE_START + DL_CACHE_SLOTS * 12 using namespace FTDI; @@ -66,12 +70,12 @@ using namespace FTDI; void DLCache::init() { CLCD::mem_write_32(DL_FREE_ADDR, DL_FREE_ADDR + 4); for(uint8_t slot = 0; slot < DL_CACHE_SLOTS; slot++) { - save_slot(slot, 0, 0); + save_slot(slot, 0, 0, 0); } } bool DLCache::has_data() { - return dl_size != 0; + return dl_slot_size != 0; } bool DLCache::wait_until_idle() { @@ -93,12 +97,12 @@ bool DLCache::wait_until_idle() { * that it can be appended later. The memory is * dynamically allocated following DL_FREE_ADDR. * - * If num_bytes is provided, then that many bytes + * If min_bytes is provided, then that many bytes * will be reserved so that the cache may be re-written * later with potentially a bigger DL. */ -bool DLCache::store(uint32_t num_bytes /* = 0*/) { +bool DLCache::store(uint32_t min_bytes /* = 0*/) { CLCD::CommandFifo cmd; // Execute any commands already in the FIFO @@ -107,67 +111,69 @@ bool DLCache::store(uint32_t num_bytes /* = 0*/) { return false; // Figure out how long the display list is - uint32_t new_dl_size = CLCD::mem_read_32(REG::CMD_DL) & 0x1FFF; - uint32_t free_space = 0; - uint32_t dl_alloc = 0; + const uint32_t dl_size = CLCD::dl_size(); - if (dl_addr == 0) { + if (dl_slot_addr == 0) { // If we are allocating new space... - dl_addr = CLCD::mem_read_32(DL_FREE_ADDR); - free_space = MAP::RAM_G_SIZE - dl_addr; - dl_alloc = num_bytes ?: new_dl_size; - dl_size = new_dl_size; - } else { - // Otherwise, we can only store as much space - // as was previously allocated. - free_space = num_bytes ?: dl_size; - dl_alloc = 0; - dl_size = new_dl_size; + dl_slot_addr = CLCD::mem_read_32(DL_FREE_ADDR); + dl_slot_size = max(dl_size, min_bytes); + + const uint32_t free_space = MAP::RAM_G_SIZE - dl_slot_addr; + if (dl_slot_size <= free_space) { + CLCD::mem_write_32(DL_FREE_ADDR, dl_slot_addr + dl_slot_size); + } + else { + dl_slot_addr = 0; + dl_slot_size = 0; + dl_slot_used = 0; + } } - if (dl_size > free_space) { + if (dl_size > dl_slot_size) { // Not enough memory to cache the display list. #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOPAIR ("Not enough space in GRAM to cache display list, free space: ", free_space); + SERIAL_ECHOPAIR ("Not enough space in GRAM to cache display list, free space: ", dl_slot_size); SERIAL_ECHOLNPAIR(" Required: ", dl_size); #endif + dl_slot_used = 0; + save_slot(); return false; - } else { + } + else { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOPAIR ("Saving DL to RAMG cache, bytes: ", dl_size); - SERIAL_ECHOLNPAIR(" Free space: ", free_space); + SERIAL_ECHOPAIR ("Saving DL to RAMG cache, bytes: ", dl_slot_used); + SERIAL_ECHOLNPAIR(" Free space: ", dl_slot_size); #endif - cmd.memcpy(dl_addr, MAP::RAM_DL, dl_size); + dl_slot_used = dl_size; + save_slot(); + cmd.memcpy(dl_slot_addr, MAP::RAM_DL, dl_slot_used); cmd.execute(); - save_slot(dl_slot, dl_addr, dl_size); - if (dl_alloc > 0) { - // If we allocated space dynamically, then adjust dl_free_addr. - CLCD::mem_write_32(DL_FREE_ADDR, dl_addr + dl_alloc); - } return true; } } -void DLCache::save_slot(uint8_t dl_slot, uint32_t dl_addr, uint32_t dl_size) { - CLCD::mem_write_32(DL_CACHE_START + dl_slot * 8 + 0, dl_addr); - CLCD::mem_write_32(DL_CACHE_START + dl_slot * 8 + 4, dl_size); +void DLCache::save_slot(uint8_t indx, uint32_t addr, uint16_t size, uint16_t used) { + CLCD::mem_write_32(DL_CACHE_START + indx * 12 + 0, addr); + CLCD::mem_write_32(DL_CACHE_START + indx * 12 + 4, size); + CLCD::mem_write_32(DL_CACHE_START + indx * 12 + 8, used); } -void DLCache::load_slot() { - dl_addr = CLCD::mem_read_32(DL_CACHE_START + dl_slot * 8 + 0); - dl_size = CLCD::mem_read_32(DL_CACHE_START + dl_slot * 8 + 4); +void DLCache::load_slot(uint8_t indx, uint32_t &addr, uint16_t &size, uint16_t &used) { + addr = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 0); + size = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 4); + used = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 8); } void DLCache::append() { CLCD::CommandFifo cmd; - cmd.append(dl_addr, dl_size); + cmd.append(dl_slot_addr, dl_slot_used); #if ENABLED(TOUCH_UI_DEBUG) cmd.execute(); wait_until_idle(); SERIAL_ECHO_START(); - SERIAL_ECHOPAIR ("Appending to DL from RAMG cache, bytes: ", dl_size); + SERIAL_ECHOPAIR ("Appending to DL from RAMG cache, bytes: ", dl_slot_used); SERIAL_ECHOLNPAIR(" REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL)); #endif } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h index 4ae4bce3efab..da927aeae23a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/dl_cache.h @@ -44,12 +44,16 @@ class DLCache { typedef FTDI::ftdi_registers REG; typedef FTDI::ftdi_memory_map MAP; - uint8_t dl_slot; - uint32_t dl_addr; - uint16_t dl_size; + uint8_t dl_slot_indx; + uint32_t dl_slot_addr; + uint16_t dl_slot_size; + uint16_t dl_slot_used; - void load_slot(); - static void save_slot(uint8_t dl_slot, uint32_t dl_addr, uint32_t dl_size); + void load_slot() {load_slot(dl_slot_indx, dl_slot_addr, dl_slot_size, dl_slot_used);} + void save_slot() {save_slot(dl_slot_indx, dl_slot_addr, dl_slot_size, dl_slot_used);} + + static void load_slot(uint8_t indx, uint32_t &addr, uint16_t &size, uint16_t &used); + static void save_slot(uint8_t indx, uint32_t addr, uint16_t size, uint16_t used); bool wait_until_idle(); @@ -57,12 +61,12 @@ class DLCache { static void init(); DLCache(uint8_t slot) { - dl_slot = slot; + dl_slot_indx = slot; load_slot(); } bool has_data(); - bool store(uint32_t num_bytes = 0); + bool store(uint32_t min_bytes = 0); void append(); }; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/ftdi_extended.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/ftdi_extended.h index e1904511b264..6e4d0668fe3e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/ftdi_extended.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/ftdi_extended.h @@ -47,4 +47,5 @@ #include "sound_list.h" #include "polygon.h" #include "text_box.h" + #include "text_ellipsis.h" #endif diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h index 972c38395b14..d1f84c8a6e86 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.h @@ -144,8 +144,8 @@ class UIScreen { static bool onTouchEnd(uint8_t) {return true;} }; -#define PUSH_SCREEN(screen) current_screen.push(screen::onRedraw); -#define GOTO_SCREEN(screen) current_screen.goTo(screen::onRedraw); +#define PUSH_SCREEN(screen) current_screen.push(screen::onRedraw) +#define GOTO_SCREEN(screen) current_screen.goTo(screen::onRedraw) #define GOTO_PREVIOUS() current_screen.goBack(); #define AT_SCREEN(screen) (current_screen.getType() == current_screen.lookupScreen(screen::onRedraw)) #define IS_PARENT_SCREEN(screen) (current_screen.peek() == current_screen.lookupScreen(screen::onRedraw)) @@ -173,10 +173,21 @@ class UncachedScreen { template class CachedScreen { protected: + static void gfxError() { + using namespace FTDI; + CommandProcessor cmd; + cmd.cmd(CMD_DLSTART) + .cmd(CLEAR(true,true,true)) + .font(30) + .text(0, 0, display_width, display_height, F("GFX MEM FULL")); + } + static bool storeBackground() { DLCache dlcache(DL_SLOT); if (!dlcache.store(DL_SIZE)) { SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space"); + gfxError(); // Try to cache a shorter error message instead. + dlcache.store(DL_SIZE); return false; } return true; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp new file mode 100644 index 000000000000..3746f1cde0f5 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.cpp @@ -0,0 +1,80 @@ +/********************* + * text_ellipsis.cpp * + *********************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2019 - Aleph Objects, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#include "ftdi_extended.h" + +#ifdef FTDI_EXTENDED + +namespace FTDI { + + /** + * Helper function for drawing text with ellipses. The str buffer may be modified and should have space for up to two extra characters. + */ + static void _draw_text_with_ellipsis(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, char *str, uint16_t options, uint8_t font) { + FontMetrics fm(font); + const uint16_t ellipsisWidth = fm.get_char_width('.') * 3; + + // Compute the total line length, as well as + // the location in the string where it can + // split and still allow the ellipsis to fit. + uint16_t lineWidth = 0; + char *breakPoint = str; + for(char* c = str; *c; c++) { + lineWidth += fm.get_char_width(*c); + if(lineWidth + ellipsisWidth < w) + breakPoint = c; + } + + if(lineWidth > w) { + *breakPoint = '\0'; + strcpy_P(breakPoint,PSTR("...")); + } + + cmd.apply_text_alignment(x, y, w, h, options); + #ifdef TOUCH_UI_USE_UTF8 + if (has_utf8_chars(str)) { + draw_utf8_text(cmd, x, y, str, font_size_t::from_romfont(font), options); + } else + #endif + { + cmd.CLCD::CommandFifo::text(x, y, font, options); + cmd.CLCD::CommandFifo::str(str); + } + } + + /** + * These functions draws text inside a bounding box, truncating the text and + * adding ellipsis if the text does not fit. + */ + void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options, uint8_t font) { + char tmp[strlen(str) + 3]; + strcpy(tmp, str); + _draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font); + } + + void draw_text_with_ellipsis(CommandProcessor& cmd, int x, int y, int w, int h, progmem_str pstr, uint16_t options, uint8_t font) { + char tmp[strlen_P((const char*)pstr) + 3]; + strcpy_P(tmp, (const char*)pstr); + _draw_text_with_ellipsis(cmd, x, y, w, h, tmp, options, font); + } +} // namespace FTDI + +#endif // FTDI_EXTENDED diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.h new file mode 100644 index 000000000000..7852b7ec3e38 --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/text_ellipsis.h @@ -0,0 +1,31 @@ +/******************* + * text_ellipsis.h * + *******************/ + +/**************************************************************************** + * Written By Marcio Teixeira 2020 - SynDaver Labs, Inc. * + * * + * 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. * + * * + * To view a copy of the GNU General Public License, go to the following * + * location: . * + ****************************************************************************/ + +#pragma once + +/** + * This function draws text inside a bounding box, truncating the text and + * showing ellipsis if it does not fit. + */ +namespace FTDI { + void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, progmem_str str, uint16_t options = 0, uint8_t font = 31); + void draw_text_with_ellipsis(class CommandProcessor& cmd, int x, int y, int w, int h, const char *str, uint16_t options = 0, uint8_t font = 31); +} diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h index b00c836ce470..f2971087c160 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/language/language_en.h @@ -91,9 +91,6 @@ namespace Language_en { PROGMEM Language_Str MSG_UNITS_STEP_MM = u8"st/mm"; PROGMEM Language_Str MSG_UNITS_PERCENT = u8"%"; PROGMEM Language_Str MSG_UNITS_C = DEGREE_SIGN u8"C"; - PROGMEM Language_Str MSG_MATERIAL_PLA = u8"PLA"; - PROGMEM Language_Str MSG_MATERIAL_ABS = u8"ABS"; - PROGMEM Language_Str MSG_MATERIAL_HIGH_TEMP = u8"High"; PROGMEM Language_Str MSG_IDLE = u8"idle"; PROGMEM Language_Str MSG_SET_MAXIMUM = u8"Set Maximum"; PROGMEM Language_Str MSG_PRINT_SPEED = u8"Print Speed"; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp index a9b4ec6cd8b2..e06f9f3a29de 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/marlin_events.cpp @@ -92,7 +92,7 @@ namespace ExtUI { char lcd_msg[30]; sprintf_P(lcd_msg, PSTR("Extruder %d Filament Error"), extruder + 1); StatusScreen::setStatusMessage(lcd_msg); - InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED); + InterfaceSoundsScreen::playEventSound(InterfaceSoundsScreen::PRINTING_FAILED, FTDI::PLAY_SYNCHRONOUS); } void onFactoryReset() { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp index 47a35cd0a805..9cd17637bd52 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/about_screen.cpp @@ -80,6 +80,7 @@ void AboutScreen::onRedraw(draw_mode_t) { #endif , OPT_CENTER, font_xlarge ); + cmd.tag(3); draw_text_box(cmd, FW_VERS_POS, #ifdef TOUCH_UI_VERSION F(TOUCH_UI_VERSION) @@ -87,6 +88,7 @@ void AboutScreen::onRedraw(draw_mode_t) { progmem_str(getFirmwareName_str()) #endif , OPT_CENTER, font_medium); + cmd.tag(0); draw_text_box(cmd, FW_INFO_POS, about_str, OPT_CENTER, font_medium); draw_text_box(cmd, INSET_POS(LICENSE_POS), GET_TEXT_F(MSG_LICENSE), OPT_CENTER, font_tiny); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp index afa3211a01ae..589da9b21055 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/change_filament_screen.cpp @@ -207,13 +207,13 @@ void ChangeFilamentScreen::onRedraw(draw_mode_t what) { { char str[30]; - format_temp_and_material(str, LOW_TEMP, GET_TEXT(MSG_MATERIAL_PLA)); + format_temp(str, LOW_TEMP); cmd.tag(2) .TOG_STYLE(tog2) .button (BTN_POS(2,6), BTN_SIZE(1,1), str); - format_temp_and_material(str, MED_TEMP, GET_TEXT(MSG_MATERIAL_ABS)); + format_temp(str, MED_TEMP); cmd.tag(3) .TOG_STYLE(tog3) .button (BTN_POS(2,5), BTN_SIZE(1,1), str); - format_temp_and_material(str, HIGH_TEMP, GET_TEXT(MSG_MATERIAL_HIGH_TEMP)); + format_temp(str, HIGH_TEMP); cmd.tag(4) .TOG_STYLE(tog4) .button (BTN_POS(2,4), BTN_SIZE(1,1), str); } cmd.colors(normal_btn) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp index 974ce3a6e1fe..7e1a82025ddc 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/confirm_auto_calibration_dialog_box.cpp @@ -38,7 +38,7 @@ bool ConfirmAutoCalibrationDialogBox::onTouchEnd(uint8_t tag) { switch (tag) { case 1: GOTO_SCREEN(StatusScreen); - injectCommands_P(PSTR(CALIBRATION_COMMANDS)); + injectCommands_P(PSTR("G425")); return true; default: return DialogBoxBaseClass::onTouchEnd(tag); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp index e3043024223a..8d6fb1860394 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/files_screen.cpp @@ -83,15 +83,19 @@ void FilesScreen::drawFileButton(const char* filename, uint8_t tag, bool is_dir, cmd.font(font_medium) .rectangle( 0, BTN_Y(header_h+line), display_width, BTN_H(1)); cmd.cmd(COLOR_RGB(is_highlighted ? normal_btn.rgb : bg_text_enabled)); + constexpr uint16_t dim[2] = {BTN_SIZE(6,1)}; + #define POS_AND_SHORTEN(SHORTEN) BTN_POS(1,header_h+line), dim[0] - (SHORTEN), dim[1] + #define POS_AND_SIZE POS_AND_SHORTEN(0) #if ENABLED(SCROLL_LONG_FILENAMES) if (is_highlighted) { cmd.cmd(SAVE_CONTEXT()); cmd.cmd(MACRO(0)); - } + cmd.text(POS_AND_SIZE, filename, OPT_CENTERY | OPT_NOFIT); + } else #endif - cmd.text (BTN_POS(1,header_h+line), BTN_SIZE(6,1), filename, OPT_CENTERY | TERN0(SCROLL_LONG_FILENAMES, OPT_NOFIT)); - if (is_dir) { - cmd.text(BTN_POS(1,header_h+line), BTN_SIZE(6,1), F("> "), OPT_CENTERY | OPT_RIGHTX); + draw_text_with_ellipsis(cmd, POS_AND_SHORTEN(is_dir ? 20 : 0), filename, OPT_CENTERY, font_medium); + if (is_dir && !is_highlighted) { + cmd.text(POS_AND_SIZE, F("> "), OPT_CENTERY | OPT_RIGHTX); } #if ENABLED(SCROLL_LONG_FILENAMES) if (is_highlighted) { @@ -102,7 +106,7 @@ void FilesScreen::drawFileButton(const char* filename, uint8_t tag, bool is_dir, void FilesScreen::drawFileList() { FileList files; - screen_data.FilesScreen.num_page = max(1,(ceil)(float(files.count()) / files_per_page)); + screen_data.FilesScreen.num_page = max(1,ceil(float(files.count()) / files_per_page)); screen_data.FilesScreen.cur_page = min(screen_data.FilesScreen.cur_page, screen_data.FilesScreen.num_page-1); screen_data.FilesScreen.flags.is_root = files.isAtRootDir(); @@ -134,7 +138,6 @@ void FilesScreen::drawHeader() { sprintf_P(str, PSTR("Page %d of %d"), screen_data.FilesScreen.cur_page + 1, screen_data.FilesScreen.num_page); - CommandProcessor cmd; cmd.colors(normal_btn) .font(font_small) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h index 92e6b230f7ef..ae48f752406e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.h @@ -96,7 +96,7 @@ enum { #define STATUS_SCREEN_DL_SIZE 2048 #define ALERT_BOX_DL_SIZE 3072 #define SPINNER_DL_SIZE 3072 -#define FILE_SCREEN_DL_SIZE 3072 +#define FILE_SCREEN_DL_SIZE 4160 #define PRINTING_SCREEN_DL_SIZE 2048 /************************* MENU SCREEN DECLARATIONS *************************/ diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp index ac1fccd579a6..f2524c7982f1 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/status_screen.cpp @@ -97,7 +97,7 @@ void StatusScreen::draw_axis_position(draw_mode_t what) { strcpy_P(y_str, PSTR("?")); if (isAxisPositionKnown(Z)) - format_position(z_str, getAxisPosition_mm(Z)); + format_position(z_str, getAxisPosition_mm(Z), 2); else strcpy_P(z_str, PSTR("?")); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.cpp index 340ffd055329..b7ce76ecd2b3 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.cpp @@ -61,8 +61,8 @@ void format_temp_and_material(char *str, float t1, const char *material) { /** * Formats a position value (e.g. "10 mm") */ -void format_position(char *str, float p) { - dtostrf(p, 5, 1, str); +void format_position(char *str, float p, uint8_t decimals) { + dtostrf(p, 4 + decimals, decimals, str); strcat_P(str, PSTR(" ")); strcat_P(str, GET_TEXT(MSG_UNITS_MM)); } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.h index ce3af4db878f..e37a82d28a5f 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/string_format.h @@ -25,5 +25,5 @@ void format_temp(char *str, float t1); void format_temp_and_idle(char *str, float t1); void format_temp_and_temp(char *str, float t1, float t2); void format_temp_and_material(char *str, float t1, const char *material); -void format_position(char *str, float p); +void format_position(char *str, float p, uint8_t decimals = 1); void format_position(char *str, float x, float y, float z); diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 3df9c17f6b8e..31449fcef4c7 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -1057,10 +1057,6 @@ namespace ExtUI { // At the moment, we piggy-back off the ultralcd calls, but this could be cleaned up in the future void MarlinUI::init() { - #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) - SET_INPUT_PULLUP(SD_DETECT_PIN); - #endif - ExtUI::onStartup(); } diff --git a/Marlin/src/lcd/fontutils.cpp b/Marlin/src/lcd/fontutils.cpp index ffa6d0df70b8..8b046af9a7a2 100644 --- a/Marlin/src/lcd/fontutils.cpp +++ b/Marlin/src/lcd/fontutils.cpp @@ -73,7 +73,7 @@ int pf_bsearch_r(void *userdata, size_t num_data, pf_bsearch_cb_comp_t cb_comp, return -1; } -/* This function gets the character at the pstart position, interpreting UTF8 multybyte sequences +/* This function gets the character at the pstart position, interpreting UTF8 multibyte sequences and returns the pointer to the next character */ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t *pval) { uint32_t val = 0; @@ -161,7 +161,6 @@ uint8_t* get_utf8_value_cb(uint8_t *pstart, read_byte_cb_t cb_read_byte, wchar_t } static inline uint8_t utf8_strlen_cb(const char *pstart, read_byte_cb_t cb_read_byte) { - uint8_t cnt = 0; uint8_t *pnext = (uint8_t *)pstart; for (;;) { diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index c21cacddc89b..069a8e5a55a0 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -404,8 +404,6 @@ namespace Language_cz { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Celkem"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Endstop abort"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Chyba zahřívání"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Chyba zahř.podl."); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Chyba zahř.komory"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("REDUND. TEPLOTA"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("TEPLOTNÍ ÚNIK"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("TEPL. ÚNIK PODL."); @@ -527,7 +525,7 @@ namespace Language_cz { PROGMEM Language_Str MSG_MMU2_EJECT_RECOVER = _UxGT("Vytáhněte, klikněte"); PROGMEM Language_Str MSG_MIX = _UxGT("Mix"); - PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Komponenta ~"); + PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Komponenta ="); PROGMEM Language_Str MSG_MIXER = _UxGT("Mixér"); PROGMEM Language_Str MSG_GRADIENT = _UxGT("Přechod"); PROGMEM Language_Str MSG_FULL_GRADIENT = _UxGT("Celý přechod"); diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index ebd08050373b..84b304c242be 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -33,10 +33,10 @@ namespace Language_de { using namespace Language_en; // Inherit undefined strings from English constexpr uint8_t CHARSIZE = 2; - PROGMEM Language_Str LANGUAGE = _UxGT("Deutsche"); + PROGMEM Language_Str LANGUAGE = _UxGT("Deutsch"); PROGMEM Language_Str WELCOME_MSG = MACHINE_NAME _UxGT(" bereit"); - + PROGMEM Language_Str MSG_MARLIN = _UxGT("Marlin"); PROGMEM Language_Str MSG_YES = _UxGT("JA"); PROGMEM Language_Str MSG_NO = _UxGT("NEIN"); PROGMEM Language_Str MSG_BACK = _UxGT("Zurück"); @@ -44,9 +44,11 @@ namespace Language_de { PROGMEM Language_Str MSG_MEDIA_INSERTED = _UxGT("Medium erkannt"); PROGMEM Language_Str MSG_MEDIA_REMOVED = _UxGT("Medium entfernt"); PROGMEM Language_Str MSG_MEDIA_WAITING = _UxGT("Warten auf Medium"); + PROGMEM Language_Str MSG_SD_INIT_FAIL = _UxGT("SD Init fehlgesch."); PROGMEM Language_Str MSG_MEDIA_READ_ERROR = _UxGT("Medium Lesefehler"); PROGMEM Language_Str MSG_MEDIA_USB_REMOVED = _UxGT("USB Gerät entfernt"); PROGMEM Language_Str MSG_MEDIA_USB_FAILED = _UxGT("USB Start fehlge."); + PROGMEM Language_Str MSG_KILL_SUBCALL_OVERFLOW = _UxGT("Subcall überschritten"); PROGMEM Language_Str MSG_LCD_ENDSTOPS = _UxGT("Endstopp"); // Max length 8 characters PROGMEM Language_Str MSG_LCD_SOFT_ENDSTOPS = _UxGT("Software-Endstopp"); PROGMEM Language_Str MSG_MAIN = _UxGT("Hauptmenü"); @@ -56,7 +58,13 @@ namespace Language_de { PROGMEM Language_Str MSG_DISABLE_STEPPERS = _UxGT("Motoren deaktivieren"); // M84 :: Max length 19 characters PROGMEM Language_Str MSG_DEBUG_MENU = _UxGT("Debug-Menü"); PROGMEM Language_Str MSG_PROGRESS_BAR_TEST = _UxGT("Statusbalken-Test"); + PROGMEM Language_Str MSG_AUTO_HOME = _UxGT("Auto Home"); + PROGMEM Language_Str MSG_AUTO_HOME_X = _UxGT("Home X"); + PROGMEM Language_Str MSG_AUTO_HOME_Y = _UxGT("Home Y"); + PROGMEM Language_Str MSG_AUTO_HOME_Z = _UxGT("Home Z"); PROGMEM Language_Str MSG_AUTO_Z_ALIGN = _UxGT("Z-Achsen ausgleichen"); + PROGMEM Language_Str MSG_ASSISTED_TRAMMING = _UxGT("Bett ausrichten"); // Bettausrichtung + PROGMEM Language_Str MSG_LEVEL_BED_HOMING = _UxGT("XYZ homen"); PROGMEM Language_Str MSG_LEVEL_BED_WAITING = _UxGT("Klick zum Starten"); PROGMEM Language_Str MSG_LEVEL_BED_NEXT_POINT = _UxGT("Nächste Koordinate"); PROGMEM Language_Str MSG_LEVEL_BED_DONE = _UxGT("Nivellieren fertig!"); @@ -110,9 +118,9 @@ namespace Language_de { PROGMEM Language_Str MSG_MESH_Y = _UxGT("Index Y"); PROGMEM Language_Str MSG_MESH_EDIT_Z = _UxGT("Z-Wert"); PROGMEM Language_Str MSG_USER_MENU = _UxGT("Benutzer-Menü"); - PROGMEM Language_Str MSG_LCD_TILTING_MESH = _UxGT("Berührungspunkt"); PROGMEM Language_Str MSG_M48_TEST = _UxGT("M48 Sondentest"); PROGMEM Language_Str MSG_M48_POINT = _UxGT("M48 Punkt"); + PROGMEM Language_Str MSG_M48_OUT_OF_BOUNDS = _UxGT("Zu weit draußen"); PROGMEM Language_Str MSG_M48_DEVIATION = _UxGT("Abweichung"); PROGMEM Language_Str MSG_IDEX_MENU = _UxGT("IDEX-Modus"); PROGMEM Language_Str MSG_OFFSETS_MENU = _UxGT("Werkzeugversätze"); @@ -126,6 +134,7 @@ namespace Language_de { PROGMEM Language_Str MSG_UBL_DOING_G29 = _UxGT("G29 ausführen"); PROGMEM Language_Str MSG_UBL_TOOLS = _UxGT("UBL-Werkzeuge"); PROGMEM Language_Str MSG_UBL_LEVEL_BED = _UxGT("Unified Bed Leveling"); + PROGMEM Language_Str MSG_LCD_TILTING_MESH = _UxGT("Berührungspunkt"); PROGMEM Language_Str MSG_UBL_MANUAL_MESH = _UxGT("Netz manuell erst."); PROGMEM Language_Str MSG_UBL_BC_INSERT = _UxGT("Unterlegen & messen"); PROGMEM Language_Str MSG_UBL_BC_INSERT2 = _UxGT("Messen"); @@ -154,6 +163,7 @@ namespace Language_de { PROGMEM Language_Str MSG_UBL_VALIDATE_CUSTOM_MESH = _UxGT("Eig. Netz validieren"); PROGMEM Language_Str MSG_G26_HEATING_BED = _UxGT("G26 heizt Bett"); PROGMEM Language_Str MSG_G26_HEATING_NOZZLE = _UxGT("G26 Düse aufheizen"); + PROGMEM Language_Str MSG_G26_MANUAL_PRIME = _UxGT("Manuell Prime..."); PROGMEM Language_Str MSG_G26_FIXED_LENGTH = _UxGT("Feste Länge Prime"); PROGMEM Language_Str MSG_G26_PRIME_DONE = _UxGT("Priming fertig"); PROGMEM Language_Str MSG_G26_CANCELED = _UxGT("G26 abgebrochen"); @@ -234,6 +244,7 @@ namespace Language_de { PROGMEM Language_Str MSG_NOZZLE = _UxGT("Düse"); PROGMEM Language_Str MSG_NOZZLE_N = _UxGT("Düse ~"); PROGMEM Language_Str MSG_NOZZLE_PARKED = _UxGT("Düse geparkt"); + PROGMEM Language_Str MSG_NOZZLE_STANDBY = _UxGT("Düse bereit"); PROGMEM Language_Str MSG_BED = _UxGT("Bett"); PROGMEM Language_Str MSG_CHAMBER = _UxGT("Gehäuse"); PROGMEM Language_Str MSG_FAN_SPEED = _UxGT("Lüfter"); @@ -255,6 +266,22 @@ namespace Language_de { PROGMEM Language_Str MSG_AUTOTEMP = _UxGT("Auto Temperatur"); PROGMEM Language_Str MSG_LCD_ON = _UxGT("an"); PROGMEM Language_Str MSG_LCD_OFF = _UxGT("aus"); + PROGMEM Language_Str MSG_PID_AUTOTUNE = _UxGT("PID Autotune"); + PROGMEM Language_Str MSG_PID_AUTOTUNE_E = _UxGT("PID Autotune *"); + PROGMEM Language_Str MSG_PID_AUTOTUNE_DONE = _UxGT("PID Tuning fertig"); + PROGMEM Language_Str MSG_PID_BAD_EXTRUDER_NUM = _UxGT("Autotune fehlge. Falscher Extruder"); + PROGMEM Language_Str MSG_PID_TEMP_TOO_HIGH = _UxGT("Autotune fehlge. Temperatur zu hoch."); + PROGMEM Language_Str MSG_PID_TIMEOUT = _UxGT("Autotune fehlge.! Timeout."); + PROGMEM Language_Str MSG_PID_P = _UxGT("PID-P"); + PROGMEM Language_Str MSG_PID_P_E = _UxGT("PID-P *"); + PROGMEM Language_Str MSG_PID_I = _UxGT("PID-I"); + PROGMEM Language_Str MSG_PID_I_E = _UxGT("PID-I *"); + PROGMEM Language_Str MSG_PID_D = _UxGT("PID-D"); + PROGMEM Language_Str MSG_PID_D_E = _UxGT("PID-D *"); + PROGMEM Language_Str MSG_PID_C = _UxGT("PID-C"); + PROGMEM Language_Str MSG_PID_C_E = _UxGT("PID-C *"); + PROGMEM Language_Str MSG_PID_F = _UxGT("PID-F"); + PROGMEM Language_Str MSG_PID_F_E = _UxGT("PID-F *"); PROGMEM Language_Str MSG_SELECT = _UxGT("Auswählen"); PROGMEM Language_Str MSG_SELECT_E = _UxGT("Auswählen *"); PROGMEM Language_Str MSG_ACC = _UxGT("Beschleunigung"); @@ -281,6 +308,8 @@ namespace Language_de { PROGMEM Language_Str MSG_AMAX_EN = _UxGT("A max *"); PROGMEM Language_Str MSG_A_RETRACT = _UxGT("A Einzug"); PROGMEM Language_Str MSG_A_TRAVEL = _UxGT("A Leerfahrt"); + PROGMEM Language_Str MSG_XY_FREQUENCY_LIMIT = _UxGT("max. Frequenz"); + PROGMEM Language_Str MSG_XY_FREQUENCY_FEEDRATE = _UxGT("min. Vorschub"); PROGMEM Language_Str MSG_STEPS_PER_MM = _UxGT("Steps/mm"); PROGMEM Language_Str MSG_A_STEPS = LCD_STR_A _UxGT(" Steps/mm"); PROGMEM Language_Str MSG_B_STEPS = LCD_STR_B _UxGT(" Steps/mm"); @@ -291,6 +320,8 @@ namespace Language_de { PROGMEM Language_Str MSG_MOTION = _UxGT("Bewegung"); PROGMEM Language_Str MSG_FILAMENT = _UxGT("Filament"); PROGMEM Language_Str MSG_VOLUMETRIC_ENABLED = _UxGT("E in mm³"); + PROGMEM Language_Str MSG_VOLUMETRIC_LIMIT = _UxGT("E Limit in mm³"); + PROGMEM Language_Str MSG_VOLUMETRIC_LIMIT_E = _UxGT("E Limit *"); PROGMEM Language_Str MSG_FILAMENT_DIAM = _UxGT("Filamentdurchmesser"); PROGMEM Language_Str MSG_FILAMENT_DIAM_E = _UxGT("Filamentdurchmesser *"); PROGMEM Language_Str MSG_FILAMENT_UNLOAD = _UxGT("Entladen mm"); @@ -302,6 +333,9 @@ namespace Language_de { PROGMEM Language_Str MSG_LOAD_EEPROM = _UxGT("Konfig. laden"); PROGMEM Language_Str MSG_RESTORE_DEFAULTS = _UxGT("Standardwerte laden"); PROGMEM Language_Str MSG_INIT_EEPROM = _UxGT("Werkseinstellungen"); + PROGMEM Language_Str MSG_ERR_EEPROM_CRC = _UxGT("EEPROM CRC Fehler"); + PROGMEM Language_Str MSG_ERR_EEPROM_INDEX = _UxGT("EEPROM Index Fehler"); + PROGMEM Language_Str MSG_ERR_EEPROM_VERSION = _UxGT("EEPROM Version Fehler"); PROGMEM Language_Str MSG_SETTINGS_STORED = _UxGT("Einstell. gespei."); PROGMEM Language_Str MSG_MEDIA_UPDATE = _UxGT("FW Update vom Medium"); PROGMEM Language_Str MSG_RESET_PRINTER = _UxGT("Drucker neustarten"); @@ -309,19 +343,26 @@ namespace Language_de { PROGMEM Language_Str MSG_INFO_SCREEN = _UxGT("Info"); PROGMEM Language_Str MSG_PREPARE = _UxGT("Vorbereitung"); PROGMEM Language_Str MSG_TUNE = _UxGT("Justierung"); + PROGMEM Language_Str MSG_POWER_MONITOR = _UxGT("Power Monitor"); + PROGMEM Language_Str MSG_CURRENT = _UxGT("Strom"); + PROGMEM Language_Str MSG_VOLTAGE = _UxGT("Spannung"); + PROGMEM Language_Str MSG_POWER = _UxGT("Power"); PROGMEM Language_Str MSG_START_PRINT = _UxGT("Starte Druck"); PROGMEM Language_Str MSG_BUTTON_NEXT = _UxGT("Weiter"); PROGMEM Language_Str MSG_BUTTON_INIT = _UxGT("Bestätigen"); PROGMEM Language_Str MSG_BUTTON_STOP = _UxGT("Stop"); PROGMEM Language_Str MSG_BUTTON_PRINT = _UxGT("Drucken"); PROGMEM Language_Str MSG_BUTTON_RESET = _UxGT("Reseten"); + PROGMEM Language_Str MSG_BUTTON_IGNORE = _UxGT("Ignorieren"); PROGMEM Language_Str MSG_BUTTON_CANCEL = _UxGT("Abbrechen"); PROGMEM Language_Str MSG_BUTTON_DONE = _UxGT("Fertig"); PROGMEM Language_Str MSG_BUTTON_BACK = _UxGT("Zurück"); + PROGMEM Language_Str MSG_BUTTON_PROCEED = _UxGT("Weiter"); PROGMEM Language_Str MSG_PAUSING = _UxGT("Pause..."); PROGMEM Language_Str MSG_PAUSE_PRINT = _UxGT("SD-Druck pausieren"); PROGMEM Language_Str MSG_RESUME_PRINT = _UxGT("SD-Druck fortsetzen"); PROGMEM Language_Str MSG_STOP_PRINT = _UxGT("SD-Druck abbrechen"); + PROGMEM Language_Str MSG_PRINTING_OBJECT = _UxGT("Objekt drucken"); PROGMEM Language_Str MSG_CANCEL_OBJECT = _UxGT("Objekt abbrechen"); PROGMEM Language_Str MSG_CANCEL_OBJECT_N = _UxGT("Objekt abbrechen ="); PROGMEM Language_Str MSG_OUTAGE_RECOVERY = _UxGT("Wiederh. n. Stroma."); @@ -346,12 +387,22 @@ namespace Language_de { PROGMEM Language_Str MSG_CONTROL_RETRACT_RECOVER_SWAPF = _UxGT("S UnRet V"); PROGMEM Language_Str MSG_AUTORETRACT = _UxGT("Autom. Einzug"); PROGMEM Language_Str MSG_FILAMENT_SWAP_LENGTH = _UxGT("Einzugslänge"); + PROGMEM Language_Str MSG_FILAMENT_SWAP_EXTRA = _UxGT("Extra Einzug"); PROGMEM Language_Str MSG_FILAMENT_PURGE_LENGTH = _UxGT("Entladelänge"); PROGMEM Language_Str MSG_TOOL_CHANGE = _UxGT("Werkzeugwechsel"); PROGMEM Language_Str MSG_TOOL_CHANGE_ZLIFT = _UxGT("Z anheben"); PROGMEM Language_Str MSG_SINGLENOZZLE_PRIME_SPEED = _UxGT("Prime-Geschwin."); PROGMEM Language_Str MSG_SINGLENOZZLE_RETRACT_SPEED = _UxGT("Einzug-Geschwin."); - PROGMEM Language_Str MSG_NOZZLE_STANDBY = _UxGT("Düsen-Standby"); + PROGMEM Language_Str MSG_FILAMENT_PARK_ENABLED = _UxGT("Kopf parken"); + PROGMEM Language_Str MSG_SINGLENOZZLE_UNRETRACT_SPEED = _UxGT("Rückzugsgeschwindigkeit"); + PROGMEM Language_Str MSG_SINGLENOZZLE_FAN_SPEED = _UxGT("Lüfter Geschwindigkeit"); + PROGMEM Language_Str MSG_SINGLENOZZLE_FAN_TIME = _UxGT("Lüfter Zeit"); + PROGMEM Language_Str MSG_TOOL_MIGRATION_ON = _UxGT("Auto AN"); + PROGMEM Language_Str MSG_TOOL_MIGRATION_OFF = _UxGT("Auto AUS"); + PROGMEM Language_Str MSG_TOOL_MIGRATION = _UxGT("Werkzeugmigration"); + PROGMEM Language_Str MSG_TOOL_MIGRATION_AUTO = _UxGT("Auto-Migration"); + PROGMEM Language_Str MSG_TOOL_MIGRATION_END = _UxGT("Letzter Extruder"); + PROGMEM Language_Str MSG_TOOL_MIGRATION_SWAP = _UxGT("Migrieren zu *"); PROGMEM Language_Str MSG_FILAMENTCHANGE = _UxGT("Filament wechseln"); PROGMEM Language_Str MSG_FILAMENTCHANGE_E = _UxGT("Filament wechseln *"); PROGMEM Language_Str MSG_FILAMENTLOAD = _UxGT("Filament laden"); @@ -367,6 +418,7 @@ namespace Language_de { PROGMEM Language_Str MSG_BLTOUCH = _UxGT("BLTouch"); PROGMEM Language_Str MSG_BLTOUCH_SELFTEST = _UxGT("Selbsttest"); PROGMEM Language_Str MSG_BLTOUCH_RESET = _UxGT("Zurücksetzen"); + PROGMEM Language_Str MSG_BLTOUCH_STOW = _UxGT("Einfahren"); PROGMEM Language_Str MSG_BLTOUCH_DEPLOY = _UxGT("Ausfahren"); PROGMEM Language_Str MSG_BLTOUCH_SW_MODE = _UxGT("SW-Modus"); PROGMEM Language_Str MSG_BLTOUCH_5V_MODE = _UxGT("5V-Modus"); @@ -374,7 +426,6 @@ namespace Language_de { PROGMEM Language_Str MSG_BLTOUCH_MODE_STORE = _UxGT("Mode-Store"); PROGMEM Language_Str MSG_BLTOUCH_MODE_STORE_5V = _UxGT("Setze auf 5V"); PROGMEM Language_Str MSG_BLTOUCH_MODE_STORE_OD = _UxGT("Setze auf OD"); - PROGMEM Language_Str MSG_BLTOUCH_STOW = _UxGT("Einfahren"); PROGMEM Language_Str MSG_BLTOUCH_MODE_ECHO = _UxGT("Modus: "); PROGMEM Language_Str MSG_BLTOUCH_MODE_CHANGE = _UxGT("ACHTUNG: Falsche Einstellung - kann zu Beschädigung führen! Fortfahren?"); PROGMEM Language_Str MSG_TOUCHMI_PROBE = _UxGT("TouchMI"); @@ -395,8 +446,6 @@ namespace Language_de { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Total"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Abbr. mit Endstopp"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("HEIZEN ERFOLGLOS"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Bett heizen fehlge."); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Geh. heizen fehlge."); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("REDUND. TEMP-ABWEI."); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = " " LCD_STR_THERMOMETER _UxGT(" NICHT ERREICHT"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("BETT") " " LCD_STR_THERMOMETER _UxGT(" NICHT ERREICHT"); @@ -443,6 +492,9 @@ namespace Language_de { PROGMEM Language_Str MSG_INFO_EXTRUDERS = _UxGT("Extruder"); PROGMEM Language_Str MSG_INFO_BAUDRATE = _UxGT("Baudrate"); PROGMEM Language_Str MSG_INFO_PROTOCOL = _UxGT("Protokoll"); + PROGMEM Language_Str MSG_INFO_RUNAWAY_OFF = _UxGT("Runaway Watch: AUS"); + PROGMEM Language_Str MSG_INFO_RUNAWAY_ON = _UxGT("Runaway Watch: AN"); + PROGMEM Language_Str MSG_HOTEND_IDLE_TIMEOUT = _UxGT("Hotend Idle Timeout"); PROGMEM Language_Str MSG_CASE_LIGHT = _UxGT("Beleuchtung"); PROGMEM Language_Str MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Helligkeit"); @@ -508,7 +560,7 @@ namespace Language_de { PROGMEM Language_Str MSG_MMU2_EJECT_RECOVER = _UxGT("Entfernen, klicken"); PROGMEM Language_Str MSG_MIX = _UxGT("Mix"); - PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Komponente ~"); + PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Komponente ="); PROGMEM Language_Str MSG_MIXER = _UxGT("Mixer"); PROGMEM Language_Str MSG_GRADIENT = _UxGT("Gradient"); // equal Farbverlauf PROGMEM Language_Str MSG_FULL_GRADIENT = _UxGT("Volle Gradient"); @@ -531,6 +583,20 @@ namespace Language_de { PROGMEM Language_Str MSG_SNAKE = _UxGT("Sn4k3"); PROGMEM Language_Str MSG_MAZE = _UxGT("Maze"); + PROGMEM Language_Str MSG_BAD_PAGE = _UxGT("ungült. Seitenzahl"); + PROGMEM Language_Str MSG_BAD_PAGE_SPEED = _UxGT("ungült. Seitengeschw."); + + PROGMEM Language_Str MSG_EDIT_PASSWORD = _UxGT("Passwort bearbeiten"); + PROGMEM Language_Str MSG_LOGIN_REQUIRED = _UxGT("Login erforderlich"); + PROGMEM Language_Str MSG_PASSWORD_SETTINGS = _UxGT("Passwort Einstellungen"); + PROGMEM Language_Str MSG_ENTER_DIGIT = _UxGT("PIN eingeben"); + PROGMEM Language_Str MSG_CHANGE_PASSWORD = _UxGT("Passwort ändern"); + PROGMEM Language_Str MSG_REMOVE_PASSWORD = _UxGT("Passwort löschen"); + PROGMEM Language_Str MSG_PASSWORD_SET = _UxGT("Passwort ist "); + PROGMEM Language_Str MSG_START_OVER = _UxGT("von vorn beginnen"); + PROGMEM Language_Str MSG_REMINDER_SAVE_SETTINGS = _UxGT("Bald speichern!"); + PROGMEM Language_Str MSG_PASSWORD_REMOVED = _UxGT("Passwort gelöscht"); + // // Die Filament-Change-Bildschirme können bis zu 3 Zeilen auf einem 4-Zeilen-Display anzeigen // ...oder 2 Zeilen auf einem 3-Zeilen-Display. @@ -576,7 +642,11 @@ namespace Language_de { PROGMEM Language_Str MSG_BACKLASH_SMOOTHING = _UxGT("Glätten"); PROGMEM Language_Str MSG_LEVEL_X_AXIS = _UxGT("X Achse leveln"); PROGMEM Language_Str MSG_AUTO_CALIBRATE = _UxGT("Auto. Kalibiren"); - PROGMEM Language_Str MSG_HEATER_TIMEOUT = _UxGT("Heizung Timeout"); + #if ENABLED(TOUCH_UI_FTDI_EVE) + PROGMEM Language_Str MSG_HEATER_TIMEOUT = _UxGT("Idle Timeout, Temperatur fällt. Drücke Okay, um erneut aufzuheizen und fortzufahren."); + #else + PROGMEM Language_Str MSG_HEATER_TIMEOUT = _UxGT("Heizungs Timeout"); + #endif PROGMEM Language_Str MSG_REHEAT = _UxGT("Erneut aufheizen"); PROGMEM Language_Str MSG_REHEATING = _UxGT("Erneut aufhei. ..."); } diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 5aa0d76a84a2..8ae40304bdf3 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -222,6 +222,10 @@ namespace Language_en { PROGMEM Language_Str MSG_SET_LEDS_VIOLET = _UxGT("Violet"); PROGMEM Language_Str MSG_SET_LEDS_WHITE = _UxGT("White"); PROGMEM Language_Str MSG_SET_LEDS_DEFAULT = _UxGT("Default"); + PROGMEM Language_Str MSG_LED_CHANNEL_N = _UxGT("Channel ="); + PROGMEM Language_Str MSG_LEDS2 = _UxGT("Lights #2"); + PROGMEM Language_Str MSG_NEO2_PRESETS = _UxGT("Light #2 Presets"); + PROGMEM Language_Str MSG_NEO2_BRIGHTNESS = _UxGT("Brightness"); PROGMEM Language_Str MSG_CUSTOM_LEDS = _UxGT("Custom Lights"); PROGMEM Language_Str MSG_INTENSITY_R = _UxGT("Red Intensity"); PROGMEM Language_Str MSG_INTENSITY_G = _UxGT("Green Intensity"); @@ -447,8 +451,6 @@ namespace Language_en { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Total"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Endstop Abort"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Heating Failed"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Bed Heating Failed"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Chamber Heating Fail"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: REDUNDANT TEMP"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("THERMAL RUNAWAY"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("BED THERMAL RUNAWAY"); @@ -647,7 +649,11 @@ namespace Language_en { PROGMEM Language_Str MSG_LEVEL_X_AXIS = _UxGT("Level X Axis"); PROGMEM Language_Str MSG_AUTO_CALIBRATE = _UxGT("Auto Calibrate"); - PROGMEM Language_Str MSG_HEATER_TIMEOUT = _UxGT("Heater Timeout"); + #if ENABLED(TOUCH_UI_FTDI_EVE) + PROGMEM Language_Str MSG_HEATER_TIMEOUT = _UxGT("Idle timeout, temperature decreased. Press Okay to reheat and again to resume."); + #else + PROGMEM Language_Str MSG_HEATER_TIMEOUT = _UxGT("Heater Timeout"); + #endif PROGMEM Language_Str MSG_REHEAT = _UxGT("Reheat"); PROGMEM Language_Str MSG_REHEATING = _UxGT("Reheating..."); } diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 2b10bfe313e1..5beab6c1c90f 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -415,8 +415,6 @@ namespace Language_es { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Total"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Cancelado - Endstop"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Calent. fallido"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Calent. cama fallido"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Calent. Cám. fallido"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: TEMP. REDUN."); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("FUGA TÉRMICA"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("FUGA TÉRMICA CAMA"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index d403477eb015..0042a30f8e5f 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -508,7 +508,7 @@ namespace Language_fr { PROGMEM Language_Str MSG_MMU2_RESETTING = _UxGT("Réinit. MMU..."); PROGMEM Language_Str MSG_MMU2_EJECT_RECOVER = _UxGT("Retrait, click"); - PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Composante ~"); + PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Composante ="); PROGMEM Language_Str MSG_MIXER = _UxGT("Mixeur"); PROGMEM Language_Str MSG_GRADIENT = _UxGT("Dégradé"); PROGMEM Language_Str MSG_FULL_GRADIENT = _UxGT("Dégradé complet"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 4415fc5e1c12..90e4129abd7c 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -437,8 +437,6 @@ namespace Language_gl { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Total"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Erro FinCarro"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Fallo Quentando"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Fallo Quent. Cama"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Fallo Quent. Cámara"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Erro:Temp Redundante"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("FUGA TÉRMICA"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("FUGA TÉRMICA CAMA"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 182ed27072bb..64ea482249ef 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -439,8 +439,6 @@ namespace Language_hu { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Teljes"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Végállás megszakítva!"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Fütés hiba!"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Ágy fütés hiba!"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Kamra fütés hiba!"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Hiba: SZÜKSÉGTELEN HÖFOK"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("FÜTÉS KIMARADÁS"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("ÁGY FÜTÉS KIMARADÁS"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 43765d7c3ac3..0a56fdf5ecfe 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -445,9 +445,7 @@ namespace Language_it { PROGMEM Language_Str MSG_BABYSTEP_Z = _UxGT("Babystep Z"); PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Totali"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Finecorsa annullati"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Riscald. Fallito"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Risc. piatto fallito"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Risc. camera fallito"); + PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Risc.Fallito"); // Max 12 caratteri PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: TEMP RIDONDANTE"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("TEMP FUORI CONTROLLO"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("TEMP PIAT.FUORI CTRL"); @@ -561,7 +559,7 @@ namespace Language_it { PROGMEM Language_Str MSG_MMU2_EJECT_RECOVER = _UxGT("Rimuovi, click"); PROGMEM Language_Str MSG_MIX = _UxGT("Miscela"); - PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Componente ~"); + PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Componente ="); PROGMEM Language_Str MSG_MIXER = _UxGT("Miscelatore"); PROGMEM Language_Str MSG_GRADIENT = _UxGT("Gradiente"); PROGMEM Language_Str MSG_FULL_GRADIENT = _UxGT("Gradiente pieno"); diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 79190ddfcb42..17ca0bd00f45 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -385,8 +385,6 @@ namespace Language_pl { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Łącznie"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Błąd krańcówki"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Rozgrz. nieudane"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Rozgrz. stołu nieudane"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Rozgrz. komory nieudane"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Błąd temperatury"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("ZANIK TEMPERATURY"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("ZANIK TEMP. STOŁU"); @@ -500,7 +498,7 @@ namespace Language_pl { PROGMEM Language_Str MSG_MMU2_EJECT_RECOVER = _UxGT("Usuń, kliknij"); PROGMEM Language_Str MSG_MIX = _UxGT("Miks"); - PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Komponent ~"); + PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Komponent ="); PROGMEM Language_Str MSG_MIXER = _UxGT("Mikser"); PROGMEM Language_Str MSG_GRADIENT = _UxGT("Gradient"); PROGMEM Language_Str MSG_FULL_GRADIENT = _UxGT("Pełny gradient"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index e0a52fc3906a..2c6c2af1486e 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -351,8 +351,6 @@ namespace Language_pt_br { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Total"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Abortar Fim de Curso"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Aquecimento falhou"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Aquecer mesa falhou"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Aquecer câmara falhou"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Erro:Temp Redundante"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("ESCAPE TÉRMICO"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("ESCAPE TÉRMICO MESA"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index 39e5cb9e2cd8..dc5591117602 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -442,8 +442,6 @@ namespace Language_ro { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Total"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Endstop Abort"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Heating Failed"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Bed Heating Failed"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Chamber Heating Fail"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Err: REDUNDANT TEMP"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("THERMAL RUNAWAY"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("BED THERMAL RUNAWAY"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index 6228e92346ab..e1abfa542972 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -530,8 +530,6 @@ namespace Language_ru { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Сумарно"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Сработал концевик"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Разогрев не удался"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Сбой нагрева стола"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Сбой нагрева камеры"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Ошибка:Избыточная Т"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("УТЕЧКА ТЕПЛА"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("УТЕЧКА ТЕПЛА СТОЛА"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 736e2069d999..71949014b7c7 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -435,8 +435,6 @@ namespace Language_sk { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Celkom"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Zastavenie Endstop"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Chyba ohrevu"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Chyba ohrevu podl."); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Chyba ohrevu komory"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Chyba: REDUND. TEP."); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("TEPLOTNÝ SKOK"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("TEPLOTNÝ SKOK PODL."); @@ -551,7 +549,7 @@ namespace Language_sk { PROGMEM Language_Str MSG_MMU2_EJECT_RECOVER = _UxGT("Odstráňte, kliknite"); PROGMEM Language_Str MSG_MIX = _UxGT("Mix"); - PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Zložka ~"); + PROGMEM Language_Str MSG_MIX_COMPONENT_N = _UxGT("Zložka ="); PROGMEM Language_Str MSG_MIXER = _UxGT("Mixér"); PROGMEM Language_Str MSG_GRADIENT = _UxGT("Gradient"); PROGMEM Language_Str MSG_FULL_GRADIENT = _UxGT("Plný gradient"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index bb68a6171766..c0ce4bfdc5d0 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -414,8 +414,6 @@ namespace Language_tr { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Toplam"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Endstop iptal"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Isınma başarısız"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Yatak Isınma Başrsız"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Oda Isıtma Hatası"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Hata: Sıcaklık Aşımı"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("TERMAL PROBLEM"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("TABLA TERMAL PROBLEM"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 686657246f3b..30d45338d98d 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -524,8 +524,6 @@ namespace Language_uk { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("Сумарно"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Кінцевик спрацював"); PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Збій нагріву"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Збій нагріву столу"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("Збій нагріву камери"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("ЗАВИЩЕНА Т") LCD_STR_DEGREE; PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("ВИТІК ТЕПЛА"); PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("ВИТІК ТЕПЛА СТОЛУ"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 227a4950f367..02453e58792f 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -330,7 +330,6 @@ namespace Language_vi { PROGMEM Language_Str MSG_BABYSTEP_Z = _UxGT("Nhít Z"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("Hủy bỏ công tắc"); // Endstop abort PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Sưởi đầu phun không thành công"); // Heating failed - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("Sưởi bàn không thành công"); // Bed heating failed PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("Điều sai: nhiệt độ dư"); // Err: REDUNDANT TEMP PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("Vấn đề nhiệt"); // THERMAL RUNAWAY | problem PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("Vấn đề nhiệt bàn"); // BED THERMAL RUNAWAY diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index cf772caaef66..49d7acd94cc8 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -441,8 +441,6 @@ namespace Language_zh_CN { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("总计"); PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("挡块终止"); //"Endstop abort" PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("加热失败"); //"Heating failed" - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("热床加热失败"); - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("机箱加热失败"); PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("错误:冗余温度"); //"Err: REDUNDANT TEMP" PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("温控失控"); //"THERMAL RUNAWAY" PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("热床热量失控"); diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index 94a7944b3598..ac543585347f 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -382,8 +382,6 @@ namespace Language_zh_TW { PROGMEM Language_Str MSG_BABYSTEP_TOTAL = _UxGT("總計"); //"Total" PROGMEM Language_Str MSG_ENDSTOP_ABORT = _UxGT("擋塊終止"); //"Endstop abort" PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("加熱失敗"); //"Heating failed" - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_BED = _UxGT("熱床加熱失敗"); //"Bed Heating Failed" - PROGMEM Language_Str MSG_HEATING_FAILED_LCD_CHAMBER = _UxGT("機箱加熱失敗"); //"Chamber Heating Fail" PROGMEM Language_Str MSG_ERR_REDUNDANT_TEMP = _UxGT("錯誤:冗餘溫度"); //"Err: REDUNDANT TEMP" PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("溫度失控"); //"THERMAL RUNAWAY" PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("熱床溫度失控"); //"BED THERMAL RUNAWAY" diff --git a/Marlin/src/lcd/menu/menu_configuration.cpp b/Marlin/src/lcd/menu/menu_configuration.cpp index 32fedce23747..a77e9a735462 100644 --- a/Marlin/src/lcd/menu/menu_configuration.cpp +++ b/Marlin/src/lcd/menu/menu_configuration.cpp @@ -181,7 +181,7 @@ void menu_advanced_settings(); #if ENABLED(DUAL_X_CARRIAGE) void menu_idex() { - const bool need_g28 = !(TEST(axis_known_position, Y_AXIS) && TEST(axis_known_position, Z_AXIS)); + const bool need_g28 = axes_should_home(_BV(Y_AXIS)|_BV(Z_AXIS)); START_MENU(); BACK_ITEM(MSG_CONFIGURATION); diff --git a/Marlin/src/lcd/menu/menu_filament.cpp b/Marlin/src/lcd/menu/menu_filament.cpp index 316b2bc782c5..5d02d674aa84 100644 --- a/Marlin/src/lcd/menu/menu_filament.cpp +++ b/Marlin/src/lcd/menu/menu_filament.cpp @@ -138,8 +138,9 @@ void _menu_temp_filament_op(const PauseMode mode, const int8_t extruder) { SUBMENU_N_P(s, msg, []{ _menu_temp_filament_op(PAUSE_MODE_CHANGE_FILAMENT, MenuItemBase::itemIndex); }); else { ACTION_ITEM_N_P(s, msg, []{ - char cmd[13]; - sprintf_P(cmd, PSTR("M600 B0 T%i"), int(MenuItemBase::itemIndex)); + PGM_P const cmdpstr = PSTR("M600 B0 T%i"); + char cmd[strlen_P(cmdpstr) + 3 + 1]; + sprintf_P(cmd, cmdpstr, int(MenuItemBase::itemIndex)); queue.inject(cmd); }); } diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index 2fe8ccbab699..00ab9ad195e3 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -34,9 +34,6 @@ #include "game/game.h" #endif -#define VALUE_ITEM(MSG, VALUE, STYL) do{ char msg[21]; strcpy_P(msg, PSTR(": ")); strcpy(msg + 2, VALUE); STATIC_ITEM(MSG, STYL, msg); }while(0) -#define VALUE_ITEM_P(MSG, PVALUE, STYL) do{ char msg[21]; strcpy_P(msg, PSTR(": ")); strcpy_P(msg + 2, PSTR(PVALUE)); STATIC_ITEM(MSG, STYL, msg); }while(0) - #if ENABLED(PRINTCOUNTER) #include "../../module/printcounter.h" @@ -52,14 +49,14 @@ char buffer[21]; START_SCREEN(); // 12345678901234567890 - VALUE_ITEM(MSG_INFO_PRINT_COUNT, i16tostr3left(stats.totalPrints), SS_LEFT); // Print Count: 999 - VALUE_ITEM(MSG_INFO_COMPLETED_PRINTS, i16tostr3left(stats.finishedPrints), SS_LEFT); // Completed : 666 + STATIC_ITEM(MSG_INFO_PRINT_COUNT, SS_LEFT, i16tostr3left(stats.totalPrints)); // Print Count: 999 + STATIC_ITEM(MSG_INFO_COMPLETED_PRINTS, SS_LEFT, i16tostr3left(stats.finishedPrints)); // Completed : 666 STATIC_ITEM(MSG_INFO_PRINT_TIME, SS_LEFT); // Total print Time: - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s + STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s STATIC_ITEM(MSG_INFO_PRINT_LONGEST, SS_LEFT); // Longest job time: - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s + STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.longestPrint).toString(buffer)); // > 99y 364d 23h 59m 59s STATIC_ITEM(MSG_INFO_PRINT_FILAMENT, SS_LEFT); // Extruded total: sprintf_P(buffer, PSTR("%ld.%im") @@ -73,8 +70,8 @@ #endif #if SERVICE_INTERVAL_1 > 0 - STATIC_ITEM_P(PSTR(SERVICE_NAME_1 " "), SS_LEFT, buffer); // Service X in: - STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s + STATIC_ITEM_P(PSTR(SERVICE_NAME_1 " "), SS_LEFT, buffer); // Service X in: + STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.nextService1).toString(buffer)); // > 7d 12h 11m 10s #endif #if SERVICE_INTERVAL_2 > 0 @@ -104,8 +101,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_0 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E0 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_0_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_0_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_0_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_0_MAXTEMP), SS_LEFT); #endif #if TEMP_SENSOR_1 != 0 @@ -113,8 +110,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_1 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E1 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_1_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_1_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_1_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_1_MAXTEMP), SS_LEFT); #endif #if TEMP_SENSOR_2 != 0 @@ -122,8 +119,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_2 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E2 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_2_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_2_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_2_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_2_MAXTEMP), SS_LEFT); #endif #if TEMP_SENSOR_3 != 0 @@ -131,8 +128,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_3 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E3 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_3_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_3_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_3_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_3_MAXTEMP), SS_LEFT); #endif #if TEMP_SENSOR_4 != 0 @@ -140,8 +137,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_4 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E4 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_4_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_4_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_4_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_4_MAXTEMP), SS_LEFT); #endif #if TEMP_SENSOR_5 != 0 @@ -149,8 +146,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_5 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E5 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_5_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_5_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_5_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_5_MAXTEMP), SS_LEFT); #endif #if TEMP_SENSOR_6 != 0 @@ -158,8 +155,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_6 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E6 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_6_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_6_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_6_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_6_MAXTEMP), SS_LEFT); #endif #if TEMP_SENSOR_7 != 0 @@ -167,8 +164,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_7 #include "../thermistornames.h" STATIC_ITEM_P(PSTR(LCD_STR_E7 ": " THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_7_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_7_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(HEATER_7_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(HEATER_7_MAXTEMP), SS_LEFT); #endif #if EXTRUDERS @@ -180,8 +177,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_BED #include "../thermistornames.h" STATIC_ITEM_P(PSTR("BED:" THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(BED_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(BED_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_BED, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); #endif @@ -190,8 +187,8 @@ void menu_info_thermistors() { #define THERMISTOR_ID TEMP_SENSOR_CHAMBER #include "../thermistornames.h" STATIC_ITEM_P(PSTR("CHAM:" THERMISTOR_NAME), SS_INVERT); - VALUE_ITEM_P(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT); - VALUE_ITEM_P(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MIN_TEMP, STRINGIFY(CHAMBER_MINTEMP), SS_LEFT); + PSTRING_ITEM(MSG_INFO_MAX_TEMP, STRINGIFY(CHAMBER_MAXTEMP), SS_LEFT); STATIC_ITEM(TERN(WATCH_CHAMBER, MSG_INFO_RUNAWAY_ON, MSG_INFO_RUNAWAY_OFF), SS_LEFT); #endif @@ -209,9 +206,9 @@ void menu_info_board() { #ifdef BOARD_WEBSITE_URL STATIC_ITEM_P(PSTR(BOARD_WEBSITE_URL), SS_LEFT); // www.my3dprinter.com #endif - VALUE_ITEM_P(MSG_INFO_BAUDRATE, STRINGIFY(BAUDRATE), SS_CENTER); // Baud: 250000 - VALUE_ITEM_P(MSG_INFO_PROTOCOL, PROTOCOL_VERSION, SS_CENTER); // Protocol: 1.0 - VALUE_ITEM_P(MSG_INFO_PSU, PSU_NAME, SS_CENTER); + PSTRING_ITEM(MSG_INFO_BAUDRATE, STRINGIFY(BAUDRATE), SS_CENTER); // Baud: 250000 + PSTRING_ITEM(MSG_INFO_PROTOCOL, PROTOCOL_VERSION, SS_CENTER); // Protocol: 1.0 + PSTRING_ITEM(MSG_INFO_PSU, PSU_NAME, SS_CENTER); END_SCREEN(); } @@ -242,7 +239,7 @@ void menu_info_board() { STATIC_ITEM_P(PSTR(STRING_DISTRIBUTION_DATE)); // YYYY-MM-DD HH:MM STATIC_ITEM_P(PSTR(MACHINE_NAME)); // My3DPrinter STATIC_ITEM_P(PSTR(WEBSITE_URL)); // www.my3dprinter.com - VALUE_ITEM_P(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2 + PSTRING_ITEM(MSG_INFO_EXTRUDERS, STRINGIFY(EXTRUDERS), SS_CENTER); // Extruders: 2 #if HAS_LEVELING STATIC_ITEM( TERN_(AUTO_BED_LEVELING_3POINT, MSG_3POINT_LEVELING) // 3-Point Leveling diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index b322246e50d1..bee05141bb28 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -328,6 +328,20 @@ class MenuItem_bool : public MenuEditItemBase { NEXT_ITEM(); \ }while(0) +// PSTRING_ITEM is like STATIC_ITEM but it takes +// two PSTRs with the style as the last parameter. + +#define PSTRING_ITEM_P(PLABEL, PVAL, STYL) do{ \ + constexpr int m = 20; \ + char msg[m+1]; \ + msg[0] = ':'; msg[1] = ' '; \ + strncpy_P(msg+2, PSTR(PVAL), m-2); \ + if (msg[m-1] & 0x80) msg[m-1] = '\0'; \ + STATIC_ITEM_P(PLABEL, STYL, msg); \ +}while(0) + +#define PSTRING_ITEM(LABEL, V...) PSTRING_ITEM_P(GET_TEXT(LABEL), ##V) + #define STATIC_ITEM(LABEL, V...) STATIC_ITEM_P(GET_TEXT(LABEL), ##V) #define STATIC_ITEM_N(LABEL, N, V...) STATIC_ITEM_N_P(GET_TEXT(LABEL), ##V) diff --git a/Marlin/src/lcd/menu/menu_led.cpp b/Marlin/src/lcd/menu/menu_led.cpp index 61ffbfd66399..386a4d799aa2 100644 --- a/Marlin/src/lcd/menu/menu_led.cpp +++ b/Marlin/src/lcd/menu/menu_led.cpp @@ -34,18 +34,19 @@ #include "../../feature/leds/leds.h" #if ENABLED(LED_COLOR_PRESETS) + void menu_led_presets() { START_MENU(); #if LCD_HEIGHT > 2 STATIC_ITEM(MSG_LED_PRESETS, SS_DEFAULT|SS_INVERT); #endif BACK_ITEM(MSG_LED_CONTROL); - ACTION_ITEM(MSG_SET_LEDS_WHITE, leds.set_white); - ACTION_ITEM(MSG_SET_LEDS_RED, leds.set_red); + ACTION_ITEM(MSG_SET_LEDS_WHITE, leds.set_white); + ACTION_ITEM(MSG_SET_LEDS_RED, leds.set_red); ACTION_ITEM(MSG_SET_LEDS_ORANGE, leds.set_orange); - ACTION_ITEM(MSG_SET_LEDS_YELLOW,leds.set_yellow); - ACTION_ITEM(MSG_SET_LEDS_GREEN, leds.set_green); - ACTION_ITEM(MSG_SET_LEDS_BLUE, leds.set_blue); + ACTION_ITEM(MSG_SET_LEDS_YELLOW, leds.set_yellow); + ACTION_ITEM(MSG_SET_LEDS_GREEN, leds.set_green); + ACTION_ITEM(MSG_SET_LEDS_BLUE, leds.set_blue); ACTION_ITEM(MSG_SET_LEDS_INDIGO, leds.set_indigo); ACTION_ITEM(MSG_SET_LEDS_VIOLET, leds.set_violet); END_MENU(); @@ -53,9 +54,33 @@ #endif + #if ENABLED(NEO2_COLOR_PRESETS) + + void menu_leds2_presets() { + START_MENU(); + #if LCD_HEIGHT > 2 + STATIC_ITEM(MSG_NEO2_PRESETS, SS_DEFAULT|SS_INVERT); + #endif + BACK_ITEM(MSG_LED_CONTROL); + ACTION_ITEM(MSG_SET_LEDS_WHITE, leds2.set_white); + ACTION_ITEM(MSG_SET_LEDS_RED, leds2.set_red); + ACTION_ITEM(MSG_SET_LEDS_ORANGE, leds2.set_orange); + ACTION_ITEM(MSG_SET_LEDS_YELLOW, leds2.set_yellow); + ACTION_ITEM(MSG_SET_LEDS_GREEN, leds2.set_green); + ACTION_ITEM(MSG_SET_LEDS_BLUE, leds2.set_blue); + ACTION_ITEM(MSG_SET_LEDS_INDIGO, leds2.set_indigo); + ACTION_ITEM(MSG_SET_LEDS_VIOLET, leds2.set_violet); + END_MENU(); + } + + #endif + void menu_led_custom() { START_MENU(); BACK_ITEM(MSG_LED_CONTROL); + #if ENABLED(NEOPIXEL2_SEPARATE) + STATIC_ITEM_N(MSG_LED_CHANNEL_N, 1, SS_DEFAULT|SS_INVERT); + #endif EDIT_ITEM(uint8, MSG_INTENSITY_R, &leds.color.r, 0, 255, leds.update, true); EDIT_ITEM(uint8, MSG_INTENSITY_G, &leds.color.g, 0, 255, leds.update, true); EDIT_ITEM(uint8, MSG_INTENSITY_B, &leds.color.b, 0, 255, leds.update, true); @@ -65,6 +90,14 @@ EDIT_ITEM(uint8, MSG_LED_BRIGHTNESS, &leds.color.i, 0, 255, leds.update, true); #endif #endif + #if ENABLED(NEOPIXEL2_SEPARATE) + STATIC_ITEM_N(MSG_LED_CHANNEL_N, 2, SS_DEFAULT|SS_INVERT); + EDIT_ITEM(uint8, MSG_INTENSITY_R, &leds2.color.r, 0, 255, leds2.update, true); + EDIT_ITEM(uint8, MSG_INTENSITY_G, &leds2.color.g, 0, 255, leds2.update, true); + EDIT_ITEM(uint8, MSG_INTENSITY_B, &leds2.color.b, 0, 255, leds2.update, true); + EDIT_ITEM(uint8, MSG_INTENSITY_W, &leds2.color.w, 0, 255, leds2.update, true); + EDIT_ITEM(uint8, MSG_NEO2_BRIGHTNESS, &leds2.color.i, 0, 255, leds2.update, true); + #endif END_MENU(); } #endif @@ -83,20 +116,28 @@ #endif #endif - - void menu_led() { START_MENU(); BACK_ITEM(MSG_MAIN); + #if ENABLED(LED_CONTROL_MENU) - bool led_on = leds.lights_on; - EDIT_ITEM(bool, MSG_LEDS, &led_on, leds.toggle); + editable.state = leds.lights_on; + EDIT_ITEM(bool, MSG_LEDS, &editable.state, leds.toggle); ACTION_ITEM(MSG_SET_LEDS_DEFAULT, leds.set_default); + #if ENABLED(NEOPIXEL2_SEPARATE) + editable.state = leds2.lights_on; + EDIT_ITEM(bool, MSG_LEDS2, &editable.state, leds2.toggle); + ACTION_ITEM(MSG_SET_LEDS_DEFAULT, leds2.set_default); + #endif #if ENABLED(LED_COLOR_PRESETS) SUBMENU(MSG_LED_PRESETS, menu_led_presets); #endif + #if ENABLED(NEO2_COLOR_PRESETS) + SUBMENU(MSG_NEO2_PRESETS, menu_leds2_presets); + #endif SUBMENU(MSG_CUSTOM_LEDS, menu_led_custom); #endif + // // Set Case light on/off/brightness // diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 027be4029d05..77ab643cd652 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -195,11 +195,12 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); }); SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); }); if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) { - char tmp[20], numstr[10]; // Determine digits needed right of decimal - const uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 : - !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 100 - int((SHORT_MANUAL_Z_MOVE) * 100)) ? 3 : 2; - sprintf_P(tmp, GET_TEXT(MSG_MOVE_Z_DIST), dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr)); + constexpr uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 : + !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 100 - int((SHORT_MANUAL_Z_MOVE) * 100)) ? 3 : 2; + PGM_P const label = GET_TEXT(MSG_MOVE_Z_DIST); + char tmp[strlen_P(label) + 10 + 1], numstr[10]; + sprintf_P(tmp, label, dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr)); #if DISABLED(HAS_GRAPHICAL_TFT) extern const char NUL_STR[]; diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index f30d9c68cff7..b30f6e49c9e0 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -81,7 +81,7 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; #endif void MarlinUI::buzz(const long duration, const uint16_t freq) { #if ENABLED(PCA9632_BUZZER) - pca9632_buzz(duration, freq); + PCA9632_buzz(duration, freq); #elif USE_BEEPER buzzer.tone(duration, freq); #endif @@ -372,10 +372,6 @@ void MarlinUI::init() { #endif // HAS_SHIFT_ENCODER - #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) - SET_INPUT_PULLUP(SD_DETECT_PIN); - #endif - #if HAS_ENCODER_ACTION && HAS_SLOW_BUTTONS slow_buttons = 0; #endif diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index d6a9f31e6c77..0200d39014c1 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -312,16 +312,18 @@ class MarlinUI { static void media_changed(const uint8_t old_stat, const uint8_t stat); #endif + #if ENABLED(DWIN_CREALITY_LCD) + static void refresh(); + #else + FORCE_INLINE static void refresh() { + TERN_(HAS_SPI_LCD, refresh(LCDVIEW_CLEAR_CALL_REDRAW)); + } + #endif + #if HAS_SPI_LCD static bool detected(); static void init_lcd(); - FORCE_INLINE static void refresh() { refresh(LCDVIEW_CLEAR_CALL_REDRAW); } #else - #if ENABLED(DWIN_CREALITY_LCD) - static void refresh(); - #else - static inline void refresh() {} - #endif static inline bool detected() { return true; } static inline void init_lcd() {} #endif @@ -403,14 +405,10 @@ class MarlinUI { #if HAS_GRAPHICAL_LCD - static bool drawing_screen, first_page; - static void set_font(const MarlinFont font_nr); #else - static constexpr bool drawing_screen = false, first_page = true; - static void set_custom_characters(const HD44780CharSet screen_charset=CHARSET_INFO); #if ENABLED(LCD_PROGRESS_BAR) @@ -460,6 +458,12 @@ class MarlinUI { #endif + #if HAS_GRAPHICAL_LCD + static bool drawing_screen, first_page; + #else + static constexpr bool drawing_screen = false, first_page = true; + #endif + static bool get_blink(); static void kill_screen(PGM_P const lcd_error, PGM_P const lcd_component); static void draw_kill_screen(); diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index 289270072d97..1169ede2dc1e 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -498,7 +498,7 @@ void Endstops::update() { #define UPDATE_ENDSTOP_BIT(AXIS, MINMAX) SET_BIT_TO(live_state, _ENDSTOP(AXIS, MINMAX), (READ(_ENDSTOP_PIN(AXIS, MINMAX)) != _ENDSTOP_INVERTING(AXIS, MINMAX))) #define COPY_LIVE_STATE(SRC_BIT, DST_BIT) SET_BIT_TO(live_state, DST_BIT, TEST(live_state, SRC_BIT)) - #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ) + #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY) // If G38 command is active check Z_MIN_PROBE for ALL movement if (G38_move) UPDATE_ENDSTOP_BIT(Z, MIN_PROBE); #endif @@ -514,12 +514,12 @@ void Endstops::update() { #endif // Use HEAD for core axes, AXIS for others - #if CORE_IS_XY || CORE_IS_XZ + #if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY) #define X_AXIS_HEAD X_HEAD #else #define X_AXIS_HEAD X_AXIS #endif - #if CORE_IS_XY || CORE_IS_YZ + #if ANY(CORE_IS_XY, CORE_IS_YZ, MARKFORGED_XY) #define Y_AXIS_HEAD Y_HEAD #else #define Y_AXIS_HEAD Y_AXIS @@ -736,7 +736,7 @@ void Endstops::update() { #define PROCESS_ENDSTOP_Z(MINMAX) PROCESS_DUAL_ENDSTOP(Z, MINMAX) #endif - #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ) + #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && NONE(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY) #if ENABLED(G38_PROBE_AWAY) #define _G38_OPEN_STATE (G38_move >= 4) #else @@ -865,7 +865,7 @@ void Endstops::update() { bool hit = false; #if X_SPI_SENSORLESS if (tmc_spi_homing.x && (stepperX.test_stall_status() - #if CORE_IS_XY && Y_SPI_SENSORLESS + #if ANY(CORE_IS_XY, MARKFORGED_XY) && Y_SPI_SENSORLESS || stepperY.test_stall_status() #elif CORE_IS_XZ && Z_SPI_SENSORLESS || stepperZ.test_stall_status() @@ -877,7 +877,7 @@ void Endstops::update() { #endif #if Y_SPI_SENSORLESS if (tmc_spi_homing.y && (stepperY.test_stall_status() - #if CORE_IS_XY && X_SPI_SENSORLESS + #if ANY(CORE_IS_XY, MARKFORGED_XY) && X_SPI_SENSORLESS || stepperX.test_stall_status() #elif CORE_IS_YZ && Z_SPI_SENSORLESS || stepperZ.test_stall_status() diff --git a/Marlin/src/module/motion.cpp b/Marlin/src/module/motion.cpp index 9b8c1c60ffa5..2f12302e5915 100644 --- a/Marlin/src/module/motion.cpp +++ b/Marlin/src/module/motion.cpp @@ -1097,17 +1097,16 @@ void prepare_line_to_destination() { current_position = destination; } -uint8_t axes_need_homing(uint8_t axis_bits/*=0x07*/) { - #define HOMED_FLAGS TERN(HOME_AFTER_DEACTIVATE, axis_known_position, axis_homed) - // Clear test bits that are homed - if (TEST(axis_bits, X_AXIS) && TEST(HOMED_FLAGS, X_AXIS)) CBI(axis_bits, X_AXIS); - if (TEST(axis_bits, Y_AXIS) && TEST(HOMED_FLAGS, Y_AXIS)) CBI(axis_bits, Y_AXIS); - if (TEST(axis_bits, Z_AXIS) && TEST(HOMED_FLAGS, Z_AXIS)) CBI(axis_bits, Z_AXIS); +uint8_t axes_should_home(uint8_t axis_bits/*=0x07*/) { + // Clear test bits that are trusted + if (TEST(axis_bits, X_AXIS) && TEST(axis_homed, X_AXIS)) CBI(axis_bits, X_AXIS); + if (TEST(axis_bits, Y_AXIS) && TEST(axis_homed, Y_AXIS)) CBI(axis_bits, Y_AXIS); + if (TEST(axis_bits, Z_AXIS) && TEST(axis_homed, Z_AXIS)) CBI(axis_bits, Z_AXIS); return axis_bits; } -bool axis_unhomed_error(uint8_t axis_bits/*=0x07*/) { - if ((axis_bits = axes_need_homing(axis_bits))) { +bool homing_needed_error(uint8_t axis_bits/*=0x07*/) { + if ((axis_bits = axes_should_home(axis_bits))) { PGM_P home_first = GET_TEXT(MSG_HOME_FIRST); char msg[strlen_P(home_first)+1]; sprintf_P(msg, home_first, @@ -1153,7 +1152,7 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) { #if AXIS_HAS_STALLGUARD(X2) stealth_states.x2 = tmc_enable_stallguard(stepperX2); #endif - #if CORE_IS_XY && Y_SENSORLESS + #if EITHER(CORE_IS_XY, MARKFORGED_XY) && Y_SENSORLESS stealth_states.y = tmc_enable_stallguard(stepperY); #elif CORE_IS_XZ && Z_SENSORLESS stealth_states.z = tmc_enable_stallguard(stepperZ); @@ -1166,7 +1165,7 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) { #if AXIS_HAS_STALLGUARD(Y2) stealth_states.y2 = tmc_enable_stallguard(stepperY2); #endif - #if CORE_IS_XY && X_SENSORLESS + #if EITHER(CORE_IS_XY, MARKFORGED_XY) && X_SENSORLESS stealth_states.x = tmc_enable_stallguard(stepperX); #elif CORE_IS_YZ && Z_SENSORLESS stealth_states.z = tmc_enable_stallguard(stepperZ); @@ -1217,7 +1216,7 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) { #if AXIS_HAS_STALLGUARD(X2) tmc_disable_stallguard(stepperX2, enable_stealth.x2); #endif - #if CORE_IS_XY && Y_SENSORLESS + #if EITHER(CORE_IS_XY, MARKFORGED_XY) && Y_SENSORLESS tmc_disable_stallguard(stepperY, enable_stealth.y); #elif CORE_IS_XZ && Z_SENSORLESS tmc_disable_stallguard(stepperZ, enable_stealth.z); @@ -1230,7 +1229,7 @@ feedRate_t get_homing_bump_feedrate(const AxisEnum axis) { #if AXIS_HAS_STALLGUARD(Y2) tmc_disable_stallguard(stepperY2, enable_stealth.y2); #endif - #if CORE_IS_XY && X_SENSORLESS + #if EITHER(CORE_IS_XY, MARKFORGED_XY) && X_SENSORLESS tmc_disable_stallguard(stepperX, enable_stealth.x); #elif CORE_IS_YZ && Z_SENSORLESS tmc_disable_stallguard(stepperZ, enable_stealth.z); @@ -1431,15 +1430,15 @@ void set_axis_is_at_home(const AxisEnum axis) { } /** - * Set an axis' to be unhomed. + * Set an axis to be unhomed. */ -void set_axis_not_trusted(const AxisEnum axis) { - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_not_trusted(", axis_codes[axis], ")"); +void set_axis_never_homed(const AxisEnum axis) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR(">>> set_axis_never_homed(", axis_codes[axis], ")"); CBI(axis_known_position, axis); CBI(axis_homed, axis); - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< set_axis_not_trusted(", axis_codes[axis], ")"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("<<< set_axis_never_homed(", axis_codes[axis], ")"); TERN_(I2C_POSITION_ENCODERS, I2CPEM.unhomed(axis)); } @@ -1790,7 +1789,7 @@ void homeaxis(const AxisEnum axis) { do_homing_move(axis, adjDistance, get_homing_bump_feedrate(axis)); } - #else // CARTESIAN / CORE + #else // CARTESIAN / CORE / MARKFORGED_XY set_axis_is_at_home(axis); sync_plan_position(); @@ -1819,8 +1818,11 @@ void homeaxis(const AxisEnum axis) { #if ENABLED(SENSORLESS_HOMING) planner.synchronize(); - if (TERN0(IS_CORE, axis != NORMAL_AXIS)) - safe_delay(200); // Short delay to allow belts to spring back + if (false + #if EITHER(IS_CORE, MARKFORGED_XY) + || axis != NORMAL_AXIS + #endif + ) safe_delay(200); // Short delay to allow belts to spring back #endif } #endif diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index 38ce980dae98..c3f2d9b779a4 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -40,8 +40,8 @@ constexpr uint8_t xyz_bits = _BV(X_AXIS) | _BV(Y_AXIS) | _BV(Z_AXIS); FORCE_INLINE bool no_axes_homed() { return !axis_homed; } FORCE_INLINE bool all_axes_homed() { return (axis_homed & xyz_bits) == xyz_bits; } FORCE_INLINE bool all_axes_known() { return (axis_known_position & xyz_bits) == xyz_bits; } -FORCE_INLINE void set_all_unhomed() { axis_homed = 0; } -FORCE_INLINE void set_all_unknown() { axis_known_position = 0; } +FORCE_INLINE void set_all_homed() { axis_homed = axis_known_position = xyz_bits; } +FORCE_INLINE void set_all_unhomed() { axis_homed = axis_known_position = 0; } FORCE_INLINE bool homing_needed() { return !TERN(HOME_AFTER_DEACTIVATE, all_axes_known, all_axes_homed)(); @@ -239,22 +239,18 @@ void do_z_clearance(const float &zclear, const bool z_known=true, const bool rai // // Homing // - -uint8_t axes_need_homing(uint8_t axis_bits=0x07); -bool axis_unhomed_error(uint8_t axis_bits=0x07); +void homeaxis(const AxisEnum axis); +void set_axis_is_at_home(const AxisEnum axis); +void set_axis_never_homed(const AxisEnum axis); +uint8_t axes_should_home(uint8_t axis_bits=0x07); +bool homing_needed_error(uint8_t axis_bits=0x07); #if ENABLED(NO_MOTION_BEFORE_HOMING) - #define MOTION_CONDITIONS (IsRunning() && !axis_unhomed_error()) + #define MOTION_CONDITIONS (IsRunning() && !homing_needed_error()) #else #define MOTION_CONDITIONS IsRunning() #endif -void set_axis_is_at_home(const AxisEnum axis); - -void set_axis_not_trusted(const AxisEnum axis); - -void homeaxis(const AxisEnum axis); - /** * Workspace offsets */ diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 931daa3322b8..82c62ed579de 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1614,6 +1614,7 @@ void Planner::finish_and_disable() { float Planner::get_axis_position_mm(const AxisEnum axis) { float axis_steps; #if IS_CORE + // Requesting one of the "core" axes? if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) { @@ -1631,9 +1632,30 @@ float Planner::get_axis_position_mm(const AxisEnum axis) { } else axis_steps = stepper.position(axis); + + #elif ENABLED(MARKFORGED_XY) + + // Requesting one of the joined axes? + if (axis == CORE_AXIS_1 || axis == CORE_AXIS_2) { + // Protect the access to the position. + const bool was_enabled = stepper.suspend(); + + const int32_t p1 = stepper.position(CORE_AXIS_1), + p2 = stepper.position(CORE_AXIS_2); + + if (was_enabled) stepper.wake_up(); + + axis_steps = ((axis == CORE_AXIS_1) ? p1 - p2 : p2); + } + else + axis_steps = stepper.position(axis); + #else + axis_steps = stepper.position(axis); + #endif + return axis_steps * steps_to_mm[axis]; } @@ -1808,6 +1830,12 @@ bool Planner::_populate_block(block_t * const block, bool split_move, if (dc < 0) SBI(dm, Z_HEAD); // ...and Z if (db + dc < 0) SBI(dm, B_AXIS); // Motor B direction if (CORESIGN(db - dc) < 0) SBI(dm, C_AXIS); // Motor C direction + #elif ENABLED(MARKFORGED_XY) + if (da < 0) SBI(dm, X_HEAD); // Save the real Extruder (head) direction in X Axis + if (db < 0) SBI(dm, Y_HEAD); // ...and Y + if (dc < 0) SBI(dm, Z_AXIS); + if (da + db < 0) SBI(dm, A_AXIS); // Motor A direction + if (db < 0) SBI(dm, B_AXIS); // Motor B direction #else if (da < 0) SBI(dm, X_AXIS); if (db < 0) SBI(dm, Y_AXIS); @@ -1843,6 +1871,8 @@ bool Planner::_populate_block(block_t * const block, bool split_move, block->steps.set(ABS(da + dc), ABS(db), ABS(da - dc)); #elif CORE_IS_YZ block->steps.set(ABS(da), ABS(db + dc), ABS(db - dc)); + #elif ENABLED(MARKFORGED_XY) + block->steps.set(ABS(da + db), ABS(db), ABS(dc)); #elif IS_SCARA block->steps.set(ABS(da), ABS(db), ABS(dc)); #else @@ -1859,7 +1889,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, * Having the real displacement of the head, we can calculate the total movement length and apply the desired speed. */ struct DistanceMM : abce_float_t { - TERN_(IS_CORE, xyz_pos_t head); + #if EITHER(IS_CORE, MARKFORGED_XY) + xyz_pos_t head; + #endif } steps_dist_mm; #if IS_CORE #if CORE_IS_XY @@ -1881,6 +1913,12 @@ bool Planner::_populate_block(block_t * const block, bool split_move, steps_dist_mm.b = (db + dc) * steps_to_mm[B_AXIS]; steps_dist_mm.c = CORESIGN(db - dc) * steps_to_mm[C_AXIS]; #endif + #elif ENABLED(MARKFORGED_XY) + steps_dist_mm.head.x = da * steps_to_mm[A_AXIS]; + steps_dist_mm.head.y = db * steps_to_mm[B_AXIS]; + steps_dist_mm.z = dc * steps_to_mm[Z_AXIS]; + steps_dist_mm.a = (da - db) * steps_to_mm[A_AXIS]; + steps_dist_mm.b = db * steps_to_mm[B_AXIS]; #else steps_dist_mm.a = da * steps_to_mm[A_AXIS]; steps_dist_mm.b = db * steps_to_mm[B_AXIS]; @@ -1907,7 +1945,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, block->millimeters = millimeters; else block->millimeters = SQRT( - #if CORE_IS_XY + #if EITHER(CORE_IS_XY, MARKFORGED_XY) sq(steps_dist_mm.head.x) + sq(steps_dist_mm.head.y) + sq(steps_dist_mm.z) #elif CORE_IS_XZ sq(steps_dist_mm.head.x) + sq(steps_dist_mm.y) + sq(steps_dist_mm.head.z) @@ -1964,7 +2002,7 @@ bool Planner::_populate_block(block_t * const block, bool split_move, #endif // Enable active axes - #if CORE_IS_XY + #if EITHER(CORE_IS_XY, MARKFORGED_XY) if (block->steps.a || block->steps.b) { ENABLE_AXIS_X(); ENABLE_AXIS_Y(); @@ -2325,9 +2363,9 @@ bool Planner::_populate_block(block_t * const block, bool split_move, * On CoreXY the length of the vector [A,B] is SQRT(2) times the length of the head movement vector [X,Y]. * So taking Z and E into account, we cannot scale to a unit vector with "inverse_millimeters". * => normalize the complete junction vector. - * Elsewise, when needed JD factors in the E component + * Elsewise, when needed JD will factor-in the E component */ - if (ENABLED(IS_CORE) || esteps > 0) + if (EITHER(IS_CORE, MARKFORGED_XY) || esteps > 0) normalize_junction_vector(unit_vec); // Normalize with XYZE components else unit_vec *= inverse_millimeters; // Use pre-calculated (1 / SQRT(x^2 + y^2 + z^2)) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 4fab4ec27b49..12b617ec439e 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -359,7 +359,7 @@ bool Probe::set_deployed(const bool deploy) { do_z_raise(_MAX(Z_CLEARANCE_BETWEEN_PROBES, Z_CLEARANCE_DEPLOY_PROBE)); #if EITHER(Z_PROBE_SLED, Z_PROBE_ALLEN_KEY) - if (axis_unhomed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) { + if (homing_needed_error(TERN_(Z_PROBE_SLED, _BV(X_AXIS)))) { SERIAL_ERROR_MSG(STR_STOP_UNHOMED); stop(); return true; diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index d5f41a324664..8af2071e3600 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -52,7 +52,7 @@ #include "temperature.h" #if ENABLED(DWIN_CREALITY_LCD) - #include "../lcd/dwin/dwin.h" + #include "../lcd/dwin/e3v2/dwin.h" #endif #include "../lcd/ultralcd.h" diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index e5f65a3cdd97..fab1a615482d 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -1578,12 +1578,11 @@ void Stepper::pulse_phase_isr() { #if STEPPER_PAGE_FORMAT == SP_4x4D_128 - #define PAGE_SEGMENT_UPDATE(AXIS, VALUE, MID) do{ \ - if ((VALUE) == MID) {} \ - else if ((VALUE) < MID) SBI(dm, _AXIS(AXIS)); \ - else CBI(dm, _AXIS(AXIS)); \ - page_step_state.sd[_AXIS(AXIS)] = VALUE; \ - page_step_state.bd[_AXIS(AXIS)] += VALUE; \ + #define PAGE_SEGMENT_UPDATE(AXIS, VALUE) do{ \ + if ((VALUE) < 7) SBI(dm, _AXIS(AXIS)); \ + else if ((VALUE) > 7) CBI(dm, _AXIS(AXIS)); \ + page_step_state.sd[_AXIS(AXIS)] = VALUE; \ + page_step_state.bd[_AXIS(AXIS)] += VALUE; \ }while(0) #define PAGE_PULSE_PREP(AXIS) do{ \ @@ -1592,7 +1591,7 @@ void Stepper::pulse_phase_isr() { }while(0) switch (page_step_state.segment_steps) { - case 8: + case DirectStepping::Config::SEGMENT_STEPS: page_step_state.segment_idx += 2; page_step_state.segment_steps = 0; // fallthru @@ -1601,10 +1600,10 @@ void Stepper::pulse_phase_isr() { high = page_step_state.page[page_step_state.segment_idx + 1]; uint8_t dm = last_direction_bits; - PAGE_SEGMENT_UPDATE(X, low >> 4, 7); - PAGE_SEGMENT_UPDATE(Y, low & 0xF, 7); - PAGE_SEGMENT_UPDATE(Z, high >> 4, 7); - PAGE_SEGMENT_UPDATE(E, high & 0xF, 7); + PAGE_SEGMENT_UPDATE(X, low >> 4); + PAGE_SEGMENT_UPDATE(Y, low & 0xF); + PAGE_SEGMENT_UPDATE(Z, high >> 4); + PAGE_SEGMENT_UPDATE(E, high & 0xF); if (dm != last_direction_bits) { last_direction_bits = dm; @@ -1615,9 +1614,9 @@ void Stepper::pulse_phase_isr() { default: break; } - PAGE_PULSE_PREP(X), - PAGE_PULSE_PREP(Y), - PAGE_PULSE_PREP(Z), + PAGE_PULSE_PREP(X); + PAGE_PULSE_PREP(Y); + PAGE_PULSE_PREP(Z); PAGE_PULSE_PREP(E); page_step_state.segment_steps++; @@ -1634,7 +1633,7 @@ void Stepper::pulse_phase_isr() { }while(0) switch (page_step_state.segment_steps) { - case 4: + case DirectStepping::Config::SEGMENT_STEPS: page_step_state.segment_idx++; page_step_state.segment_steps = 0; // fallthru @@ -1664,7 +1663,6 @@ void Stepper::pulse_phase_isr() { }while(0) uint8_t steps = page_step_state.page[page_step_state.segment_idx >> 1]; - if (page_step_state.segment_idx & 0x1) steps >>= 4; PAGE_PULSE_PREP(X, 3); @@ -2043,6 +2041,8 @@ uint32_t Stepper::block_phase_isr() { #define X_CMP(A,B) ((A)!=(B)) #endif #define X_MOVE_TEST ( S_(1) != S_(2) || (S_(1) > 0 && X_CMP(D_(1),D_(2))) ) + #elif ENABLED(MARKFORGED_XY) + #define X_MOVE_TEST (current_block->steps.a != current_block->steps.b) #else #define X_MOVE_TEST !!current_block->steps.a #endif @@ -2616,6 +2616,8 @@ void Stepper::_set_position(const int32_t &a, const int32_t &b, const int32_t &c #elif CORE_IS_YZ // coreyz planning count_position.set(a, b + c, CORESIGN(b - c)); + #elif ENABLED(MARKFORGED_XY) + count_position.set(a - b, b, c); #else // default non-h-bot planning count_position.set(a, b, c); @@ -2682,6 +2684,10 @@ void Stepper::endstop_triggered(const AxisEnum axis) { ? CORESIGN(count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2]) : count_position[CORE_AXIS_1] + count_position[CORE_AXIS_2] ) * double(0.5) + #elif ENABLED(MARKFORGED_XY) + axis == CORE_AXIS_1 + ? count_position[CORE_AXIS_1] - count_position[CORE_AXIS_2] + : count_position[CORE_AXIS_2] #else // !IS_CORE count_position[axis] #endif @@ -2711,12 +2717,12 @@ int32_t Stepper::triggered_position(const AxisEnum axis) { } void Stepper::report_a_position(const xyz_long_t &pos) { - #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA + #if ANY(CORE_IS_XY, CORE_IS_XZ, MARKFORGED_XY, DELTA, IS_SCARA) SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y); #else SERIAL_ECHOPAIR_P(PSTR(STR_COUNT_X), pos.x, SP_Y_LBL, pos.y); #endif - #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA) + #if ANY(CORE_IS_XZ, CORE_IS_YZ, DELTA) SERIAL_ECHOLNPAIR(" C:", pos.z); #else SERIAL_ECHOLNPAIR_P(SP_Z_LBL, pos.z); diff --git a/Marlin/src/module/stepper/indirection.h b/Marlin/src/module/stepper/indirection.h index e9705cd3c322..ec0d63a89d97 100644 --- a/Marlin/src/module/stepper/indirection.h +++ b/Marlin/src/module/stepper/indirection.h @@ -840,12 +840,13 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset // // Axis steppers enable / disable macros // +#define FORGET_AXIS(A) TERN(HOME_AFTER_DEACTIVATE, set_axis_never_homed(A), CBI(axis_known_position, A)) #define ENABLE_AXIS_X() do{ ENABLE_STEPPER_X(); ENABLE_STEPPER_X2(); }while(0) -#define DISABLE_AXIS_X() do{ DISABLE_STEPPER_X(); DISABLE_STEPPER_X2(); CBI(axis_known_position, X_AXIS); }while(0) +#define DISABLE_AXIS_X() do{ DISABLE_STEPPER_X(); DISABLE_STEPPER_X2(); FORGET_AXIS(X_AXIS); }while(0) #define ENABLE_AXIS_Y() do{ ENABLE_STEPPER_Y(); ENABLE_STEPPER_Y2(); }while(0) -#define DISABLE_AXIS_Y() do{ DISABLE_STEPPER_Y(); DISABLE_STEPPER_Y2(); CBI(axis_known_position, Y_AXIS); }while(0) +#define DISABLE_AXIS_Y() do{ DISABLE_STEPPER_Y(); DISABLE_STEPPER_Y2(); FORGET_AXIS(Y_AXIS); }while(0) #define ENABLE_AXIS_Z() do{ ENABLE_STEPPER_Z(); ENABLE_STEPPER_Z2(); ENABLE_STEPPER_Z3(); ENABLE_STEPPER_Z4(); }while(0) @@ -854,7 +855,7 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset #else #define Z_RESET() #endif -#define DISABLE_AXIS_Z() do{ DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); CBI(axis_known_position, Z_AXIS); Z_RESET(); }while(0) +#define DISABLE_AXIS_Z() do{ DISABLE_STEPPER_Z(); DISABLE_STEPPER_Z2(); DISABLE_STEPPER_Z3(); DISABLE_STEPPER_Z4(); FORGET_AXIS(Z_AXIS); Z_RESET(); }while(0) // // Extruder steppers enable / disable macros diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index e8be3dbf0173..6b22c50a7b14 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -37,7 +37,7 @@ #include "../lcd/ultralcd.h" #if ENABLED(DWIN_CREALITY_LCD) - #include "../lcd/dwin/dwin.h" + #include "../lcd/dwin/e3v2/dwin.h" #endif #if ENABLED(EXTENSIBLE_UI) @@ -210,9 +210,10 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, if (target < EXTRUDERS) singlenozzle_fan_speed[target] = speed; return; } - target = 0; // Always use fan index 0 with SINGLENOZZLE #endif + TERN_(SINGLENOZZLE, target = 0); // Always use fan index 0 with SINGLENOZZLE + if (target >= FAN_COUNT) return; fan_speed[target] = speed; @@ -435,6 +436,7 @@ volatile bool Temperature::raw_temps_ready = false; SERIAL_ECHOLNPGM(STR_PID_AUTOTUNE_START); disable_all_heaters(); + TERN_(AUTO_POWER_CONTROL, powerManager.power_on()); SHV(bias = d = (MAX_BED_POWER) >> 1, bias = d = (PID_MAX) >> 1); @@ -444,7 +446,6 @@ volatile bool Temperature::raw_temps_ready = false; LEDColor color = ONHEATINGSTART(); #endif - TERN_(AUTO_POWER_CONTROL, powerManager.power_on()); TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = false); // PID Tuning loop diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 94eb42fd0fcd..4d3efceafd75 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -330,7 +330,7 @@ class Temperature { #if ENABLED(PREVENT_COLD_EXTRUSION) static bool allow_cold_extrude; static int16_t extrude_min_temp; - FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp; } + FORCE_INLINE static bool tooCold(const int16_t temp) { return allow_cold_extrude ? false : temp < extrude_min_temp - (TEMP_WINDOW); } FORCE_INLINE static bool tooColdToExtrude(const uint8_t E_NAME) { return tooCold(degHotend(HOTEND_INDEX)); } diff --git a/Marlin/src/module/thermistor/thermistors.h b/Marlin/src/module/thermistor/thermistors.h index 44680a7baa41..56921c6d186e 100644 --- a/Marlin/src/module/thermistor/thermistors.h +++ b/Marlin/src/module/thermistor/thermistors.h @@ -72,7 +72,7 @@ typedef struct { int16_t value, celsius; } temp_entry_t; #if ANY_THERMISTOR_IS(501) // 100K Zonestar thermistor #include "thermistor_501.h" #endif -#if ANY_THERMISTOR_IS(502) // Unknown thermistor used by the Zonestar Prusa P802M hot bed +#if ANY_THERMISTOR_IS(502) // Unknown thermistor used by the Zonestar Průša P802M hot bed #include "thermistor_502.h" #endif #if ANY_THERMISTOR_IS(512) // 100k thermistor in RPW-Ultra hotend, Pull-up = 4.7 kOhm, "unknown model" diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index d1017cea8078..855756026684 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -174,7 +174,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a grabpos = mpe_settings.parking_xpos[new_tool] + (new_tool ? mpe_settings.grab_distance : -mpe_settings.grab_distance), offsetcompensation = TERN0(HAS_HOTEND_OFFSET, hotend_offset[active_extruder].x * mpe_settings.compensation_factor); - if (axis_unhomed_error(_BV(X_AXIS))) return; + if (homing_needed_error(_BV(X_AXIS))) return; /** * Z Lift and Nozzle Offset shift ar defined in caller method to work equal with any Multi Hotend realization diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 69f4f2445121..b32f99c68db0 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -274,6 +274,38 @@ #define FORCE_SOFT_SPI #define LCD_BACKLIGHT_PIN -1 + #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI + #define SS_PIN -1 + //#define ONBOARD_SD_CS_PIN -1 + + #define TFT_CS_PIN P1_22 + #define TFT_A0_PIN P1_23 + #define TFT_DC_PIN P1_23 + #define TFT_MISO_PIN P0_17 + #define TFT_BACKLIGHT_PIN P1_18 + #define TFT_RESET_PIN P1_19 + + #define LPC_HW_SPI_DEV 0 + #define LCD_USE_DMA_SPI + + #define TOUCH_INT_PIN P1_21 + #define TOUCH_CS_PIN P1_20 + #define TOUCH_BUTTONS_HW_SPI + #define TOUCH_BUTTONS_HW_SPI_DEVICE 1 + + #ifndef GRAPHICAL_TFT_UPSCALE + #define GRAPHICAL_TFT_UPSCALE 3 + #endif + + // SPI 1 + #define SCK_PIN P0_15 + #define MISO_PIN P0_17 + #define MOSI_PIN P0_18 + + // Disable any LCD related PINs config + #define LCD_PINS_ENABLE -1 + #define LCD_PINS_RS -1 + #else #define BTN_ENC P0_28 // (58) open-drain @@ -345,7 +377,7 @@ #endif // -// Neopixel LED +// NeoPixel LED // #ifndef NEOPIXEL_PIN #define NEOPIXEL_PIN P1_24 diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h index c89807227892..54f3dfd95c16 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SBASE.h @@ -289,20 +289,21 @@ #define E0_CS_PIN P2_11 #define E1_CS_PIN P4_28 -// Hardware SPI is on EXP2. See if you can make it work: -// https://github.com/makerbase-mks/MKS-SBASE/issues/25 -#define TMC_USE_SW_SPI -#if ENABLED(TMC_USE_SW_SPI) - #ifndef TMC_SW_MOSI - #define TMC_SW_MOSI P0_03 // AUX1 - #endif - #ifndef TMC_SW_MISO - #define TMC_SW_MISO P0_02 // AUX1 - #endif - #ifndef TMC_SW_SCK - #define TMC_SW_SCK P0_26 // TH4 + // Hardware SPI is on EXP2. See if you can make it work: + // https://github.com/makerbase-mks/MKS-SBASE/issues/25 + #define TMC_USE_SW_SPI + #if ENABLED(TMC_USE_SW_SPI) + #ifndef TMC_SW_MOSI + #define TMC_SW_MOSI P0_03 // AUX1 + #endif + #ifndef TMC_SW_MISO + #define TMC_SW_MISO P0_02 // AUX1 + #endif + #ifndef TMC_SW_SCK + #define TMC_SW_SCK P0_26 // TH4 + #endif #endif - #endif + #endif #if MB(MKS_SBASE) && HAS_TMC_UART diff --git a/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h new file mode 100644 index 000000000000..d112cc5d5080 --- /dev/null +++ b/Marlin/src/pins/lpc1769/pins_MKS_SGEN_L_V2.h @@ -0,0 +1,357 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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 . + * + */ +#pragma once + +/** + * MKS SGen pin assignments + */ + +#ifndef MCU_LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." +#endif + +#define BOARD_INFO_NAME "MKS SGEN_L V2" +#define BOARD_WEBSITE_URL "github.com/makerbase-mks" + +// +// EEPROM, MKS SGEN_L V2.0 hardware has 4K EEPROM on the board +// +#if NO_EEPROM_SELECTED + //#define SDCARD_EEPROM_EMULATION + //#define I2C_EEPROM // AT24C32 + #define FLASH_EEPROM_EMULATION + #define MARLIN_EEPROM_SIZE 0x1000 // 4KB +#endif + +// +// Servos +// +#define SERVO0_PIN P1_23 // SERVO P1.23 +#define SERVO1_PIN P2_00 // SERVO P2.0 + +// +// Trinamic Stallguard pins, can connect or disconnect by jumpers cap on the board +// +#define X_DIAG_PIN P1_29 // X- +#define Y_DIAG_PIN P1_27 // Y- +#define Z_DIAG_PIN P1_25 // Z- +#define E0_DIAG_PIN P1_28 // X+ +#define E1_DIAG_PIN P1_26 // Y+ + +// +// Limit Switches +// +#if X_STALL_SENSITIVITY + #define X_STOP_PIN X_DIAG_PIN + #if X_HOME_DIR < 0 + #define X_MAX_PIN P1_28 // X+ + #else + #define X_MIN_PIN P1_28 // X+ + #endif +#else + #define X_MIN_PIN P1_29 // X- + #define X_MAX_PIN P1_28 // X+ +#endif + +#if Y_STALL_SENSITIVITY + #define Y_STOP_PIN Y_DIAG_PIN + #if Y_HOME_DIR < 0 + #define Y_MAX_PIN P1_26 // Y+ + #else + #define Y_MIN_PIN P1_26 // Y+ + #endif +#else + #define Y_MIN_PIN P1_27 // Y- + #define Y_MAX_PIN P1_26 // Y+ +#endif + +#if Z_STALL_SENSITIVITY + #define Z_STOP_PIN Z_DIAG_PIN + #if Z_HOME_DIR < 0 + #define Z_MAX_PIN P1_24 // Z+ + #else + #define Z_MIN_PIN P1_24 // Z+ + #endif +#else + #define Z_MIN_PIN P1_25 // Z- + #define Z_MAX_PIN P1_24 // Z+ +#endif + +// +// Z Probe (when not Z_MIN_PIN) +// +#ifndef Z_MIN_PROBE_PIN + #define Z_MIN_PROBE_PIN P1_24 +#endif + +// +// Steppers +// +#define X_STEP_PIN P2_02 +#define X_DIR_PIN P2_03 +#define X_ENABLE_PIN P2_01 +#ifndef X_CS_PIN + #define X_CS_PIN P1_01 +#endif + +#define Y_STEP_PIN P0_19 +#define Y_DIR_PIN P0_20 +#define Y_ENABLE_PIN P2_08 +#ifndef Y_CS_PIN + #define Y_CS_PIN P1_08 +#endif + +#define Z_STEP_PIN P0_22 +#define Z_DIR_PIN P2_11 +#define Z_ENABLE_PIN P0_21 +#ifndef Z_CS_PIN + #define Z_CS_PIN P1_10 +#endif + +#define E0_STEP_PIN P2_13 +#define E0_DIR_PIN P0_11 +#define E0_ENABLE_PIN P2_12 +#ifndef E0_CS_PIN + #define E0_CS_PIN P1_15 +#endif + +#define E1_STEP_PIN P1_09 +#define E1_DIR_PIN P1_14 +#define E1_ENABLE_PIN P0_10 +#ifndef E1_CS_PIN + #define E1_CS_PIN P1_17 +#endif + +// +// Software SPI pins for TMC2130 stepper drivers +// +#if ENABLED(TMC_USE_SW_SPI) + #ifndef TMC_SW_MOSI + #define TMC_SW_MOSI P1_16 + #endif + #ifndef TMC_SW_MISO + #define TMC_SW_MISO P0_05 + #endif + #ifndef TMC_SW_SCK + #define TMC_SW_SCK P0_04 + #endif +#endif + +#if HAS_TMC_UART + /** + * TMC2208/TMC2209 stepper drivers + * + * Hardware serial communication ports. + * If undefined software serial is used according to the pins below + */ + //#define X_HARDWARE_SERIAL Serial + //#define X2_HARDWARE_SERIAL Serial1 + //#define Y_HARDWARE_SERIAL Serial1 + //#define Y2_HARDWARE_SERIAL Serial1 + //#define Z_HARDWARE_SERIAL Serial1 + //#define Z2_HARDWARE_SERIAL Serial1 + //#define E0_HARDWARE_SERIAL Serial1 + //#define E1_HARDWARE_SERIAL Serial1 + //#define E2_HARDWARE_SERIAL Serial1 + //#define E3_HARDWARE_SERIAL Serial1 + //#define E4_HARDWARE_SERIAL Serial1 + + // + // Software serial + // + #define X_SERIAL_TX_PIN P1_01 + #define X_SERIAL_RX_PIN P1_01 + #define Y_SERIAL_TX_PIN P1_08 + #define Y_SERIAL_RX_PIN P1_08 + #define Z_SERIAL_TX_PIN P1_10 + #define Z_SERIAL_RX_PIN P1_10 + #define E0_SERIAL_TX_PIN P1_15 + #define E0_SERIAL_RX_PIN P1_15 + #define E1_SERIAL_TX_PIN P1_17 + #define E1_SERIAL_RX_PIN P1_17 + + // Reduce baud rate to improve software serial reliability + #define TMC_BAUD_RATE 19200 +#endif // HAS_TMC_UART + +// +// Temperature Sensors +// 3.3V max when defined as an analog input +// +#define TEMP_0_PIN P0_23_A0 // Analog Input A0 (TH1) +#define TEMP_BED_PIN P0_24_A1 // Analog Input A1 (TB) +#define TEMP_1_PIN P0_25_A2 // Analog Input A2 (TH2) +#define TEMP_2_PIN P0_26_A3 // Analog Input A3 (P0.26, No pull up) + +// +// Heaters / Fans +// +#define HEATER_BED_PIN P2_05 +#define HEATER_0_PIN P2_07 +#if HOTENDS == 1 + #ifndef FAN1_PIN + #define FAN1_PIN P2_06 + #endif +#else + #ifndef HEATER_1_PIN + #define HEATER_1_PIN P2_06 + #endif +#endif +#ifndef FAN_PIN + #define FAN_PIN P2_04 +#endif +#ifndef FAN2_PIN + #define FAN2_PIN P1_04 +#endif + +// +// Misc. Functions +// +#define LED_PIN P1_18 // Used as a status indicator +#define LED2_PIN P1_19 +#define LED3_PIN P1_20 +#define LED4_PIN P1_21 + +/** + * _____ _____ + * (BEEPER) 1.31 | · · | 1.30 (BTN_ENC) (MISO) 0.8 | · · | 0.7 (SD_SCK) + * (LCD_EN) 0.18 | · · | 0.16 (LCD_RS) (BTN_EN1) 3.25 | · · | 0.28 (SD_CS2) + * (LCD_D4) 0.15 | · ·| 0.17 (LCD_D5) (BTN_EN2) 3.26 | · ·| 0.9 (SD_MOSI) + * (LCD_D6) 1.0 | · · | 1.22 (LCD_D7) (SD_DETECT) 0.27 | · · | RST + * GND | · · | 5V GND | · · | NC + * ----- ----- + * EXP1 EXP2 + */ +#if HAS_SPI_LCD + #define BEEPER_PIN P1_31 + #define BTN_ENC P1_30 + + #if ENABLED(CR10_STOCKDISPLAY) + #define LCD_PINS_RS P1_00 + + #define BTN_EN1 P0_18 + #define BTN_EN2 P0_15 + + #define LCD_PINS_ENABLE P1_22 + #define LCD_PINS_D4 P0_17 + + #else + + #define BTN_EN1 P3_25 + #define BTN_EN2 P3_26 + + #define LCD_SDSS P0_28 + + #if ENABLED(MKS_12864OLED_SSD1306) + + #define LCD_PINS_DC P0_17 + #define DOGLCD_CS P0_16 + #define DOGLCD_A0 LCD_PINS_DC + #define DOGLCD_SCK P0_15 + #define DOGLCD_MOSI P0_18 + + #define LCD_PINS_RS P1_00 + #define LCD_PINS_D7 P1_22 + #define KILL_PIN -1 // NC + + #else // !MKS_12864OLED_SSD1306 + + #define LCD_PINS_RS P0_16 + + #define LCD_PINS_ENABLE P0_18 + #define LCD_PINS_D4 P0_15 + + #if ENABLED(FYSETC_MINI_12864) + + #define DOGLCD_CS P0_18 + #define DOGLCD_A0 P0_16 + #define DOGLCD_SCK P0_07 + #define DOGLCD_MOSI P1_20 + + #define LCD_BACKLIGHT_PIN -1 + + #define FORCE_SOFT_SPI // Use this if default of hardware SPI causes display problems + // results in LCD soft SPI mode 3, SD soft SPI mode 0 + + #define LCD_RESET_PIN P0_15 // Must be high or open for LCD to operate normally. + + #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN P0_17 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN P1_00 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN P1_22 + #endif + #elif ENABLED(FYSETC_MINI_12864_2_1) + #define NEOPIXEL_PIN P0_17 + #endif + + #else // !FYSETC_MINI_12864 + + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS P0_17 + #define DOGLCD_A0 P1_00 + #endif + + #if ENABLED(ULTIPANEL) + #define LCD_PINS_D5 P0_17 + #define LCD_PINS_D6 P1_00 + #define LCD_PINS_D7 P1_22 + #endif + + #endif // !FYSETC_MINI_12864 + + #endif // !MKS_12864OLED_SSD1306 + + #endif // !CR10_STOCKDISPLAY + +#endif // HAS_SPI_LCD + +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + +#define ONBOARD_SD_CS_PIN P0_06 // Chip select for "System" SD card + +#if SD_CONNECTION_IS(LCD) || SD_CONNECTION_IS(ONBOARD) + #define SD_DETECT_PIN P0_27 + #define SCK_PIN P0_07 + #define MISO_PIN P0_08 + #define MOSI_PIN P0_09 + #if SD_CONNECTION_IS(ONBOARD) + #define SS_PIN ONBOARD_SD_CS_PIN + #else + #define SS_PIN P0_28 + #endif +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #error "No custom SD drive cable defined for this board." +#endif + +// +// Other Pins +// +//#define PIN_P0_02 P0_02 // AUX1 (Interrupt Capable/ADC/Serial Port 0) +//#define PIN_P0_03 P0_03 // AUX1 (Interrupt Capable/ADC/Serial Port 0) +//#define PS_ON_PIN P1_23 // SERVO P1.23 diff --git a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h index c9bd9ec3ae1a..de148995cacb 100644 --- a/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h +++ b/Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h @@ -111,7 +111,48 @@ #elif HAS_SPI_LCD - #error "Marlin's Smoothieboard support cannot drive your LCD." + /* + The Smoothieboard supports the REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER with either + a custom cable with breakouts to the pins indicated below or the RRD GLCD Adapter board + found at http://smoothieware.org/rrdglcdadapter + + Other links to information about setting up a display panel with Smoothieboard + http://chibidibidiwah.wdfiles.com/local--files/panel/smoothieboard2sd.jpg + http://smoothieware.org/panel + */ + + #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) + // EXP1 Pins + #define BEEPER_PIN P1_31 // EXP1 Pin 1 + #define BTN_ENC P1_30 // EXP1 Pin 2 + #define LCD_PINS_ENABLE P0_18 // EXP1 Pin 3 (MOSI) + #define LCD_PINS_RS P0_16 // EXP1 Pin 4 (CS) + #define LCD_PINS_D4 P0_15 // EXP1 Pin 5 (SCK) + // EXP2 Pins + #define BTN_EN2 P3_26 // EXP2 Pin 3 + #define BTN_EN1 P3_25 // EXP2 Pin 5 + + /* + SD Support + + For the RRD GLCD it CANNOT share the same SPI as the LCD so it must be + hooked up to the onboard SDCard SPI and use a spare pin for the SDCS. + Also note that an external SDCard sharing the SPI port with the + onboard/internal SDCard must be ejected before rebooting as the bootloader + does not like the external card. NOTE Smoothie will not boot if the external + sdcard is inserted in the RRD LCD sdcard slot at boot time, it must be + inserted after it has booted. + */ + + #define MISO_PIN P0_08 // EXP2 Pin 1 (PB3, SD_MISO) + #define SCK_PIN P0_07 // EXP2 Pin 2 (SD_SCK) + #define SS_PIN P0_28 // EXP2 Pin 4 (SD_CSEL, SD_CS) + #define MOSI_PIN P0_09 // EXP2 Pin 6 (PB2, SD_MOSI) + #define SD_DETECT_PIN P0_27 // EXP2 Pin 7 (SD_CD, SD_DET) + + #else + #error "Marlin's Smoothieboard support cannot drive your LCD." + #endif #endif diff --git a/Marlin/src/pins/mega/pins_MEGATRONICS.h b/Marlin/src/pins/mega/pins_MEGATRONICS.h index 84346e5f6696..2d98256fe71f 100644 --- a/Marlin/src/pins/mega/pins_MEGATRONICS.h +++ b/Marlin/src/pins/mega/pins_MEGATRONICS.h @@ -124,7 +124,7 @@ #define SD_DETECT_PIN -1 // RAMPS doesn't use this -#endif // HAS_SPI_LCD && NEWPANEL +#endif // ULTRA_LCD && NEWPANEL // // M3/M4/M5 - Spindle/Laser Control diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index f2aec72c4605..9f120b8b0091 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -410,6 +410,8 @@ #include "lpc1769/pins_TH3D_EZBOARD.h" // LPC1769 env:LPC1769 #elif MB(BTT_SKR_V1_4_TURBO) #include "lpc1769/pins_BTT_SKR_V1_4_TURBO.h" // LPC1769 env:LPC1769 +#elif MB(MKS_SGEN_L_V2) + #include "lpc1769/pins_MKS_SGEN_L_V2.h" // LPC1769 env:LPC1769 // // Due (ATSAM) boards @@ -478,7 +480,7 @@ // STM32 ARM Cortex-M0 // #elif MB(MALYAN_M200_V2) - #include "stm32f0/pins_MALYAN_M200_V2.h" // STM32F0 env:STM32F070RB_malyan + #include "stm32f0/pins_MALYAN_M200_V2.h" // STM32F0 env:STM32F070RB_malyan env:STM32F070CB_malyan #elif MB(MALYAN_M300) #include "stm32f0/pins_MALYAN_M300.h" // STM32F070 env:malyan_M300 @@ -606,6 +608,8 @@ #include "stm32f4/pins_FLYF407ZG.h" // STM32F4 env:FLYF407ZG #elif MB(MKS_ROBIN2) #include "stm32f4/pins_MKS_ROBIN2.h" // STM32F4 env:MKS_ROBIN2 +#elif MB(FYSETC_S6_V2_0) + #include "stm32f4/pins_FYSETC_S6_V2_0.h" // STM32F4 env:FYSETC_S6 // // ARM Cortex M7 diff --git a/Marlin/src/pins/pinsDebug_list.h b/Marlin/src/pins/pinsDebug_list.h index 3307cbde97e8..ac15a3c9bae2 100644 --- a/Marlin/src/pins/pinsDebug_list.h +++ b/Marlin/src/pins/pinsDebug_list.h @@ -1421,3 +1421,22 @@ #if PIN_EXISTS(ESP_WIFI_MODULE_GPIO2) REPORT_NAME_DIGITAL(__LINE__, ESP_WIFI_MODULE_GPIO2_PIN) #endif +// TFT PINS +#if PIN_EXISTS(TFT_CS) + REPORT_NAME_DIGITAL(__LINE__, TFT_CS_PIN) +#endif +#if PIN_EXISTS(TFT_A0) + REPORT_NAME_DIGITAL(__LINE__, TFT_A0_PIN) +#endif +#if PIN_EXISTS(TFT_DC) + REPORT_NAME_DIGITAL(__LINE__, TFT_DC_PIN) +#endif +#if PIN_EXISTS(TFT_MISO) + REPORT_NAME_DIGITAL(__LINE__, TFT_MISO_PIN) +#endif +#if PIN_EXISTS(TFT_BACKLIGHT) + REPORT_NAME_DIGITAL(__LINE__, TFT_BACKLIGHT_PIN) +#endif +#if PIN_EXISTS(TFT_RESET) + REPORT_NAME_DIGITAL(__LINE__, TFT_RESET_PIN) +#endif diff --git a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h index 8fb3be47da54..e2a4940e8789 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RAMBO.h @@ -80,6 +80,13 @@ #define Z_MIN_PROBE_PIN 10 #endif +// +// Filament Runout Sensor +// +#ifndef FIL_RUNOUT_PIN + #define FIL_RUNOUT_PIN 62 +#endif + // // Steppers // diff --git a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h index 0df977a05bbd..672c37241464 100644 --- a/Marlin/src/pins/rambo/pins_EINSY_RETRO.h +++ b/Marlin/src/pins/rambo/pins_EINSY_RETRO.h @@ -166,11 +166,11 @@ // // LCD / Controller // -#if HAS_SPI_LCD || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) +#if ANY(HAS_SPI_LCD, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE) #define KILL_PIN 32 - #if ENABLED(ULTIPANEL) || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) + #if ANY(ULTIPANEL, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE) #if ENABLED(CR10_STOCKDISPLAY) #define LCD_PINS_RS 85 @@ -194,5 +194,6 @@ #define SD_DETECT_PIN 15 - #endif // ULTIPANEL || TOUCH_UI_ULTIPANEL -#endif // HAS_SPI_LCD + #endif // ULTIPANEL || TOUCH_UI_ULTIPANEL || TOUCH_UI_FTDI_EVE + +#endif // HAS_SPI_LCD || TOUCH_UI_ULTIPANEL || TOUCH_UI_FTDI_EVE diff --git a/Marlin/src/pins/rambo/pins_MINIRAMBO.h b/Marlin/src/pins/rambo/pins_MINIRAMBO.h index f89bba2d7ff1..0c14d9f46b29 100644 --- a/Marlin/src/pins/rambo/pins_MINIRAMBO.h +++ b/Marlin/src/pins/rambo/pins_MINIRAMBO.h @@ -189,4 +189,4 @@ #endif // ULTIPANEL || TOUCH_UI_ULTIPANEL -#endif // HAS_SPI_LCD +#endif // HAS_SPI_LCD || TOUCH_UI_ULTIPANEL diff --git a/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h b/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h index 9af4a3e05c0f..bdd53abbc04d 100644 --- a/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h +++ b/Marlin/src/pins/ramps/pins_RAMPS_PLUS.h @@ -74,7 +74,7 @@ #undef E0_CS_PIN #undef E1_CS_PIN -#if ENABLED(ULTRA_LCD, REPRAPWORLD_GRAPHICAL_LCD, CR10_STOCKDISPLAY) && !BOTH(NEWPANEL, PANEL_ONE) +#if ENABLED(ULTRA_LCD) && NONE(REPRAPWORLD_GRAPHICAL_LCD, CR10_STOCKDISPLAY) && !BOTH(NEWPANEL, PANEL_ONE) #if DISABLED(MKS_12864OLED) || ENABLED(MKS_12864OLED_SSD1306) #undef LCD_PINS_RS #define LCD_PINS_RS 42 // 3DYMY boards pin 16 -> 42 diff --git a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h index 708f8fa26cd6..412aa2290223 100644 --- a/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h +++ b/Marlin/src/pins/ramps/pins_TRIGORILLA_14.h @@ -64,7 +64,7 @@ #elif TEMP_SENSOR_BED // EFB (Anycubic Kossel default) #define RAMPS_D9_PIN TG_FAN0_PIN - #if ENABLED(ANYCUBIC_CHIRON) + #if ENABLED(ANYCUBIC_LCD_CHIRON) #define RAMPS_D8_PIN TG_HEATER_1_PIN // Heated bed is connected to HEATER1 output #else #define RAMPS_D8_PIN TG_HEATER_BED_PIN @@ -84,7 +84,7 @@ #define E0_AUTO_FAN_PIN TG_FAN2_PIN // Used in Anycubic Kossel example config #endif -#if ENABLED(ANYCUBIC_I3MEGA) +#if ENABLED(ANYCUBIC_LCD_I3MEGA) #define CONTROLLER_FAN_PIN TG_FAN1_PIN #endif @@ -105,14 +105,14 @@ #if ENABLED(ANYCUBIC_4_MAX_PRO_ENDSTOPS) #define X_MAX_PIN 43 #define Y_STOP_PIN 19 -#elif EITHER(ANYCUBIC_CHIRON, ANYCUBIC_I3MEGA) +#elif EITHER(ANYCUBIC_LCD_CHIRON, ANYCUBIC_LCD_I3MEGA) #define Y_STOP_PIN 42 #define Z2_MIN_PIN 43 #ifndef Z_MIN_PROBE_PIN #define Z_MIN_PROBE_PIN 2 #endif #ifndef FIL_RUNOUT_PIN - #if ENABLED(ANYCUBIC_CHIRON) + #if ENABLED(ANYCUBIC_LCD_CHIRON) #define FIL_RUNOUT_PIN 33 #else #define FIL_RUNOUT_PIN 19 diff --git a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h index 955801558457..a44baf26e4d0 100644 --- a/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h +++ b/Marlin/src/pins/ramps/pins_ULTIMAKER_OLD.h @@ -174,7 +174,7 @@ #define LCD_PINS_D6 32 #define LCD_PINS_D7 30 -#elif ENABLED(BOARD_REV_1_5, ULTRA_LCD) +#elif BOTH(BOARD_REV_1_5, ULTRA_LCD) #define BEEPER_PIN 18 diff --git a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h index 7cd81456b17d..4d08ed784d68 100644 --- a/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h +++ b/Marlin/src/pins/sam/pins_ALLIGATOR_R2.h @@ -144,17 +144,16 @@ // LCD / Controller // #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) - #define LCD_PINS_RS 18 #define LCD_PINS_ENABLE 15 #define LCD_PINS_D4 19 #define BEEPER_PIN 64 + #undef UI_VOLTAGE_LEVEL + #define UI_VOLTAGE_LEVEL 1 +#endif +#if ENABLED(NEWPANEL) #define BTN_EN1 14 #define BTN_EN2 16 #define BTN_ENC 17 - - #undef UI_VOLTAGE_LEVEL - #define UI_VOLTAGE_LEVEL 1 - -#endif // REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +#endif diff --git a/Marlin/src/pins/sam/pins_ARCHIM2.h b/Marlin/src/pins/sam/pins_ARCHIM2.h index bbd4804dbd50..b527b511835f 100644 --- a/Marlin/src/pins/sam/pins_ARCHIM2.h +++ b/Marlin/src/pins/sam/pins_ARCHIM2.h @@ -237,7 +237,7 @@ // // LCD / Controller // -#if HAS_SPI_LCD || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) +#if ANY(HAS_SPI_LCD, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE) #define BEEPER_PIN 23 // D24 PA15_CTS1 #define LCD_PINS_RS 17 // D17 PA12_RXD1 #define LCD_PINS_ENABLE 24 // D23 PA14_RTS1 @@ -248,10 +248,10 @@ #define SD_DETECT_PIN 2 // D2 PB25_TIOA0 - #if ENABLED(ULTIPANEL) || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) + #if ANY(ULTIPANEL, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE) // Buttons on AUX-2 #define BTN_EN1 60 // D60 PA3_TIOB1 #define BTN_EN2 13 // D13 PB27_TIOB0 #define BTN_ENC 16 // D16 PA13_TXD1 // the click - #endif // ULTIPANEL || TOUCH_UI_ULTIPANEL -#endif // HAS_SPI_LCD + #endif +#endif diff --git a/Marlin/src/pins/sam/pins_DUE3DOM.h b/Marlin/src/pins/sam/pins_DUE3DOM.h index e0a56137f730..260a2810f5e8 100644 --- a/Marlin/src/pins/sam/pins_DUE3DOM.h +++ b/Marlin/src/pins/sam/pins_DUE3DOM.h @@ -147,7 +147,7 @@ #define SDSS 4 #define SD_DETECT_PIN 14 - #elif HAS_SSD1306_OLED_I2C + #elif HAS_U8GLIB_I2C_OLED #define BTN_EN1 50 #define BTN_EN2 52 diff --git a/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h b/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h index 9a488e312682..946cadcfa943 100644 --- a/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h +++ b/Marlin/src/pins/sam/pins_DUE3DOM_MINI.h @@ -139,7 +139,7 @@ #define SDSS 4 #define SD_DETECT_PIN 14 - #elif HAS_SSD1306_OLED_I2C + #elif HAS_U8GLIB_I2C_OLED #define BTN_EN1 50 #define BTN_EN2 52 diff --git a/Marlin/src/pins/sam/pins_RADDS.h b/Marlin/src/pins/sam/pins_RADDS.h index a0192aadb6f4..bbbfb2e55826 100644 --- a/Marlin/src/pins/sam/pins_RADDS.h +++ b/Marlin/src/pins/sam/pins_RADDS.h @@ -266,7 +266,7 @@ #define SDSS 10 #define SD_DETECT_PIN 14 - #elif HAS_SSD1306_OLED_I2C + #elif HAS_U8GLIB_I2C_OLED #define BTN_EN1 50 #define BTN_EN2 52 diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h index dd490e38933a..3ecd64aa8aee 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_11.h @@ -221,7 +221,7 @@ #define LCD_PINS_RS 52 #define LCD_PINS_ENABLE 53 - #elif HAS_SSD1306_OLED_I2C + #elif HAS_U8GLIB_I2C_OLED #define BEEPER_PIN 62 #define LCD_SDSS 10 diff --git a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h index 8a6287fb659f..2b52338d35ca 100644 --- a/Marlin/src/pins/sam/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/sam/pins_RURAMPS4D_13.h @@ -207,7 +207,7 @@ #define LCD_PINS_RS 52 #define LCD_PINS_ENABLE 53 - #elif HAS_SSD1306_OLED_I2C + #elif HAS_U8GLIB_I2C_OLED #define BEEPER_PIN 62 #define LCD_SDSS 10 diff --git a/Marlin/src/pins/sanguino/pins_ANET_10.h b/Marlin/src/pins/sanguino/pins_ANET_10.h index a2ef1e2c17dd..6830192f319b 100644 --- a/Marlin/src/pins/sanguino/pins_ANET_10.h +++ b/Marlin/src/pins/sanguino/pins_ANET_10.h @@ -163,7 +163,7 @@ #define LCD_PINS_D6 16 #define LCD_PINS_D7 17 #define ADC_KEYPAD_PIN 1 - #elif EITHER(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, ANET_FULL_GRAPHICS_LCD) + #elif EITHER(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) // Pin definitions for the Anet A6 Full Graphics display and the RepRapDiscount Full Graphics // display using an adapter board // https://go.aisler.net/benlye/anet-lcd-adapter/pcb // See below for alternative pin definitions for use with https://www.thingiverse.com/thing:2103748 diff --git a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h index af1e4c114518..5254166fa576 100644 --- a/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h +++ b/Marlin/src/pins/stm32f1/pins_CCROBOT_MEEB_3DP.h @@ -113,7 +113,7 @@ #define FAN1_PIN PA8 // FAN (fan0 on board) e0 cool fan #define FAN2_PIN PB9 // FAN (fan1 on board) controller cool fan -// One neopixel onboard and a connector for other neopixels +// One NeoPixel onboard and a connector for other NeoPixels #define NEOPIXEL_PIN PC7 // The NEOPIXEL LED driving pin /** diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 9ee8aa742365..090f3ee3f8f9 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -81,7 +81,7 @@ #define Y_STOP_PIN PA6 #define Z_STOP_PIN PA7 -#define Z_PROBE_PIN PB1 // BLTouch IN +#define Z_MIN_PROBE_PIN PB1 // BLTouch IN // // Filament Runout Sensor @@ -153,6 +153,7 @@ #define ON_BOARD_SPI_DEVICE 1 #define ONBOARD_SD_CS_PIN PA4 // SDSS #define SDIO_SUPPORT +#define NO_SD_HOST_DRIVE // This board's SD is only seen by the printer #if ENABLED(CR10_STOCKDISPLAY) && NONE(RET6_12864_LCD, VET6_12864_LCD) #error "Define RET6_12864_LCD or VET6_12864_LCD to select pins for CR10_STOCKDISPLAY with the Creality V4 controller." diff --git a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h index cbc43a7ac806..d08045ec16d5 100644 --- a/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h +++ b/Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h @@ -119,11 +119,12 @@ */ #define LCD_RESET_PIN PC4 // pin 33 -#define LCD_BACKLIGHT_PIN PD12 // pin 59 +#define TFT_RESET_PIN PC4 // pin 33 +#define TFT_BACKLIGHT_PIN PD12 // pin 59 #define FSMC_CS_PIN PD7 // pin 88 = FSMC_NE1 #define FSMC_RS_PIN PD11 // pin 58 A16 Register. Only one address needed -#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT +//#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT (broken) #define FSMC_DMA_DEV DMA2 #define FSMC_DMA_CHANNEL DMA_CH5 @@ -136,6 +137,8 @@ #define TFT_PIXEL_OFFSET_X 32 #define TFT_PIXEL_OFFSET_Y 32 +//#define TFT_DRIVER ILI9341 + /** * Note: Alfawise U20/U30 boards DON'T use SPI2, as the hardware designer * mixed up MOSI and MISO pins. SPI is managed in SW, and needs pins diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h index 1346e8099a65..9461a828af01 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h @@ -33,7 +33,6 @@ //#define DISABLE_DEBUG #define DISABLE_JTAG -#define ENABLE_SPI2 // // EEPROM @@ -152,8 +151,6 @@ #define DOGLCD_SCK PB13 #define DOGLCD_MOSI PB15 - #undef SHOW_BOOTSCREEN - #else #define LCD_PINS_D4 PA6 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h index 9cf8685dfab5..6ce6c6010501 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE3.h @@ -115,8 +115,6 @@ #define DOGLCD_SCK PB13 #define DOGLCD_MOSI PB15 - #undef SHOW_BOOTSCREEN - #else // !MKS_MINI_12864 #define LCD_PINS_D4 PA6 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index cb3ab62cc25c..19b04c9e7c6f 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -87,7 +87,7 @@ #define MOTOR_CURRENT_PWM_E_PIN PB0 #define MOTOR_CURRENT_PWM_RANGE 1500 // (255 * (1000mA / 65535)) * 257 = 1000 is equal 1.6v Vref in turn equal 1Amp #ifndef DEFAULT_PWM_MOTOR_CURRENT - #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 } + #define DEFAULT_PWM_MOTOR_CURRENT { 800, 800, 800 } #endif // // Temperature Sensors @@ -180,7 +180,7 @@ #define TFT_DRIVER ILI9341 #define TFT_BUFFER_SIZE 14400 - + // YV for normal screen mounting #define ILI9341_ORIENTATION ILI9341_MADCTL_MY | ILI9341_MADCTL_MV // XV for 180° rotated screen mounting diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index 83b3bcc42db4..d66338b8ad32 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -194,10 +194,18 @@ // LVGL Configs #if ENABLED(TFT_LVGL_UI_FSMC) - #define XPT2046_X_CALIBRATION 17880 - #define XPT2046_Y_CALIBRATION -12234 - #define XPT2046_X_OFFSET -45 - #define XPT2046_Y_OFFSET 349 + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION 17880 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION -12234 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET -45 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET 349 + #endif // Emulated DOGM Configs #elif ENABLED(FSMC_GRAPHICAL_TFT) @@ -234,11 +242,57 @@ #define XPT2046_Y_OFFSET 256 #endif +#elif ENABLED(TFT_320x240) // TFT32/28 + #define TFT_RESET_PIN PC6 + #define TFT_BACKLIGHT_PIN PD13 + + #define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT + #define FSMC_CS_PIN PD7 + #define FSMC_RS_PIN PD11 + #define FSMC_DMA_DEV DMA2 + #define FSMC_DMA_CHANNEL DMA_CH5 + + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -12246 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 9453 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 360 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -22 + #endif + + #define TOUCH_CS_PIN PA7 // SPI2_NSS + #define TOUCH_SCK_PIN PB13 // SPI2_SCK + #define TOUCH_MISO_PIN PB14 // SPI2_MISO + #define TOUCH_MOSI_PIN PB15 // SPI2_MOSI + + #define TFT_DRIVER ILI9341 + #define TFT_BUFFER_SIZE 14400 + + // YV for normal screen mounting + //#define ILI9341_ORIENTATION ILI9341_MADCTL_MY | ILI9341_MADCTL_MV + // XV for 180° rotated screen mounting + #define ILI9341_ORIENTATION ILI9341_MADCTL_MX | ILI9341_MADCTL_MV + + #define ILI9341_COLOR_RGB + #elif ENABLED(TFT_480x320) - #define XPT2046_X_CALIBRATION 17880 - #define XPT2046_Y_CALIBRATION -12234 - #define XPT2046_X_OFFSET -45 - #define XPT2046_Y_OFFSET 349 + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION 17880 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION -12234 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET -45 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET 349 + #endif #define TFT_DRIVER ILI9488 #define TFT_BUFFER_SIZE 14400 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 228049d139bd..1295c7c46b12 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -351,10 +351,6 @@ #define DOGLCD_SCK PA5 #define DOGLCD_MOSI PA7 - // Required for MKS_MINI_12864 with this board - #define MKS_LCD12864B - #undef SHOW_BOOTSCREEN - #else // !MKS_MINI_12864 #define LCD_PINS_D4 PE14 diff --git a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h index d3510b1ff815..009b1b65f1e8 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_BTT002_V1_0.h @@ -21,7 +21,7 @@ */ #pragma once -#ifndef TARGET_STM32F4 +#ifndef STM32F4 #error "Oops! Select an STM32F4 board in 'Tools > Board.'" #elif HOTENDS > 1 || E_STEPPERS > 1 #error "BIGTREE BTT002 V1.0 supports up to 1 hotends / E-steppers." diff --git a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h index bc882316e7db..55d1a37aa7f7 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_GTR_V1_0.h @@ -21,7 +21,7 @@ */ #pragma once -#ifndef TARGET_STM32F4 +#ifndef STM32F4 #error "Oops! Select an STM32F4 board in 'Tools > Board.'" #elif HOTENDS > 8 || E_STEPPERS > 8 #error "BIGTREE GTR V1.0 supports up to 8 hotends / E-steppers." @@ -280,24 +280,29 @@ //#define FAN6_PIN PC9 // Fan6 //#define FAN7_PIN PE14 // Fan7 +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif + // -// By default the onboard SD (SPI1) is enabled +// By default the LCD SD (SPI2) is enabled +// Onboard SD is on a completely separate SPI bus, and requires +// overriding pins to access. // -#define CUSTOM_SPI_PINS -#if DISABLED(CUSTOM_SPI_PINS) +#if SD_CONNECTION_IS(LCD) + #define SD_DETECT_PIN PB10 #define SDSS PB12 -#endif - -// HAL SPI1 pins group -#if ENABLED(CUSTOM_SPI_PINS) +#elif SD_CONNECTION_IS(ONBOARD) + // Instruct the STM32 HAL to override the default SPI pins from the variant.h file + #define CUSTOM_SPI_PINS #define SDSS PA4 - #define SD_DETECT_PIN PC4 - #define LCD_SDSS PA4 - + #define SS_PIN SDSS #define SCK_PIN PA5 #define MISO_PIN PA6 #define MOSI_PIN PA7 - #define SS_PIN PA4 // Chip select for SD card used by Marlin + #define SD_DETECT_PIN PC4 +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #define "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board" #endif /** @@ -319,7 +324,6 @@ #define BTN_ENC PA15 #if ENABLED(CR10_STOCKDISPLAY) - #define LCD_PINS_RS PG6 #define BTN_EN1 PC10 @@ -333,6 +337,15 @@ #undef BOARD_ST7920_DELAY_2 #undef BOARD_ST7920_DELAY_3 + #elif ENABLED(MKS_MINI_12864) + #define DOGLCD_A0 PG6 + #define DOGLCD_CS PG7 + #define BTN_EN1 PD10 + #define BTN_EN2 PH10 + + #if SD_CONNECTION_IS(ONBOARD) + #define SOFTWARE_SPI + #endif #else #define LCD_PINS_RS PA8 @@ -340,17 +353,17 @@ #define BTN_EN1 PD10 #define BTN_EN2 PH10 - #if DISABLED(CUSTOM_SPI_PINS) - #define SD_DETECT_PIN PB10 - #define LCD_SDSS PB12 - #endif - #define LCD_PINS_ENABLE PC10 #define LCD_PINS_D4 PG8 #if ENABLED(FYSETC_MINI_12864) #define DOGLCD_CS PC10 #define DOGLCD_A0 PA8 + + #if SD_CONNECTION_IS(ONBOARD) + #define SOFTWARE_SPI + #endif + //#define LCD_BACKLIGHT_PIN -1 #define LCD_RESET_PIN PG8 // Must be high or open for LCD to operate normally. #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0) @@ -389,11 +402,6 @@ #endif #endif - //#define DOGLCD_CS PB12 - //#define DOGLCD_A0 PA8 - //#define LCD_PINS_DC PB14 - //#define DOGLCD_MOSI PB15 - #endif // HAS_SPI_LCD #undef TP diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h index e13c4a227aae..9e6a43c36b9a 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_PRO_common.h @@ -21,7 +21,7 @@ */ #pragma once -#ifndef TARGET_STM32F4 +#ifndef STM32F4 #error "Oops! Select an STM32F4 board in 'Tools > Board.'" #endif @@ -250,12 +250,22 @@ // Onboard SD card // Must use soft SPI because Marlin's default hardware SPI is tied to LCD's EXP2 // -#if SD_CONNECTION_IS(ONBOARD) - #define SOFTWARE_SPI // Use soft SPI for onboard SD +#if SD_CONNECTION_IS(LCD) + #define SD_DETECT_PIN PF12 + #define SDSS PB12 +#elif SD_CONNECTION_IS(ONBOARD) + // The SKR Pro's ONBOARD SD interface is on SPI1. + // Due to a pull resistor on the clock line, it needs to use SPI Data Mode 3 to + // function with Hardware SPI. This is not currently configurable in the HAL, + // so force Software SPI to work around this issue. + #define SOFTWARE_SPI #define SDSS PA4 #define SCK_PIN PA5 #define MISO_PIN PA6 #define MOSI_PIN PB5 + #define SD_DETECT_PIN PB11 +#elif SD_CONNECTION_IS(CUSTOM_CABLE) + #define "CUSTOM_CABLE is not a supported SDCARD_CONNECTION for this board" #endif /** @@ -275,9 +285,6 @@ #if HAS_SPI_LCD #define BEEPER_PIN PG4 #define BTN_ENC PA8 - #if SD_CONNECTION_IS(LCD) - #define SDSS PB12 // Uses default hardware SPI for LCD's SD - #endif #if ENABLED(CR10_STOCKDISPLAY) #define LCD_PINS_RS PG6 @@ -296,16 +303,14 @@ #elif ENABLED(MKS_MINI_12864) #define DOGLCD_A0 PG6 #define DOGLCD_CS PG3 - + #define BTN_EN1 PG10 + #define BTN_EN2 PF11 #else #define LCD_PINS_RS PD10 #define BTN_EN1 PG10 #define BTN_EN2 PF11 - #define SD_DETECT_PIN PF12 - - #define LCD_SDSS PB12 #define LCD_PINS_ENABLE PD11 #define LCD_PINS_D4 PG2 diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h index 116aa14cf1da..9ffedc2ac477 100644 --- a/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6.h @@ -28,7 +28,7 @@ #endif #ifndef BOARD_INFO_NAME - #define BOARD_INFO_NAME "FYSETC_S6" + #define BOARD_INFO_NAME "FYSETC S6" #endif #ifndef DEFAULT_MACHINE_NAME #define DEFAULT_MACHINE_NAME BOARD_INFO_NAME @@ -82,7 +82,9 @@ // #define X_STEP_PIN PE11 #define X_DIR_PIN PE10 -#define X_ENABLE_PIN PE12 +#ifndef X_ENABLE_PIN + #define X_ENABLE_PIN PE12 +#endif #define X_CS_PIN PE7 #define Y_STEP_PIN PD8 @@ -118,23 +120,42 @@ // // Software serial // - #define X_SERIAL_TX_PIN PE9 - #define X_SERIAL_RX_PIN PE8 - - #define Y_SERIAL_TX_PIN PE14 - #define Y_SERIAL_RX_PIN PE13 - - #define Z_SERIAL_TX_PIN PD11 - #define Z_SERIAL_RX_PIN PD12 - - #define E0_SERIAL_TX_PIN PD3 - #define E0_SERIAL_RX_PIN PA15 - - #define E1_SERIAL_TX_PIN PC4 - #define E1_SERIAL_RX_PIN PC5 - - #define E2_SERIAL_TX_PIN PE1 - #define E2_SERIAL_RX_PIN PE0 + #ifndef X_SERIAL_TX_PIN + #define X_SERIAL_TX_PIN PE9 + #endif + #ifndef X_SERIAL_RX_PIN + #define X_SERIAL_RX_PIN PE8 + #endif + #ifndef Y_SERIAL_TX_PIN + #define Y_SERIAL_TX_PIN PE14 + #endif + #ifndef Y_SERIAL_RX_PIN + #define Y_SERIAL_RX_PIN PE13 + #endif + #ifndef Z_SERIAL_TX_PIN + #define Z_SERIAL_TX_PIN PD11 + #endif + #ifndef Z_SERIAL_RX_PIN + #define Z_SERIAL_RX_PIN PD12 + #endif + #ifndef E0_SERIAL_TX_PIN + #define E0_SERIAL_TX_PIN PD3 + #endif + #ifndef E0_SERIAL_RX_PIN + #define E0_SERIAL_RX_PIN PA15 + #endif + #ifndef E1_SERIAL_TX_PIN + #define E1_SERIAL_TX_PIN PC4 + #endif + #ifndef E1_SERIAL_RX_PIN + #define E1_SERIAL_RX_PIN PC5 + #endif + #ifndef E2_SERIAL_TX_PIN + #define E2_SERIAL_TX_PIN PE1 + #endif + #ifndef E2_SERIAL_RX_PIN + #define E2_SERIAL_RX_PIN PE0 + #endif #endif // diff --git a/Marlin/src/pins/stm32f4/pins_FYSETC_S6_V2_0.h b/Marlin/src/pins/stm32f4/pins_FYSETC_S6_V2_0.h new file mode 100644 index 000000000000..6cd970501fde --- /dev/null +++ b/Marlin/src/pins/stm32f4/pins_FYSETC_S6_V2_0.h @@ -0,0 +1,67 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2019 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 . + * + */ +#pragma once + +#define BOARD_INFO_NAME "FYSETC S6 2.0" + +// +// EEPROM Emulation +// +#if NO_EEPROM_SELECTED + #undef NO_EEPROM_SELECTED + //#define FLASH_EEPROM_EMULATION + //#define SRAM_EEPROM_EMULATION + #define I2C_EEPROM +#endif + +// +// Steppers +// +#define X_ENABLE_PIN PE9 + +#if HAS_TMC_UART + #define X_SERIAL_TX_PIN PE8 + #define Y_SERIAL_TX_PIN PC4 + #define Y_SERIAL_RX_PIN PC4 + #define Z_SERIAL_TX_PIN PD12 + #define E0_SERIAL_TX_PIN PA15 + #define E1_SERIAL_TX_PIN PC5 + #define E2_SERIAL_TX_PIN PE0 +#endif + +// +// Software SPI pins for TMC2130 stepper drivers +// +#define TMC_USE_SW_SPI +#if ENABLED(TMC_USE_SW_SPI) + #ifndef TMC_SW_MOSI + #define TMC_SW_MOSI PE14 + #endif + #ifndef TMC_SW_MISO + #define TMC_SW_MISO PE13 + #endif + #ifndef TMC_SW_SCK + #define TMC_SW_SCK PE12 + #endif +#endif + +#include "pins_FYSETC_S6.h" diff --git a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h index d20fd5a6c1fb..2e55782edb41 100644 --- a/Marlin/src/pins/stm32f4/pins_LERDGE_S.h +++ b/Marlin/src/pins/stm32f4/pins_LERDGE_S.h @@ -127,7 +127,7 @@ #endif // -// Prusa i3 MK2 Multi Material Multiplexer Support +// Průša i3 MK2 Multi Material Multiplexer Support // //#define E_MUX0_PIN -1 //#define E_MUX1_PIN -1 diff --git a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h index 3b513b31ca8c..90f9e500133a 100644 --- a/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h +++ b/Marlin/src/pins/stm32f4/pins_RUMBA32_common.h @@ -42,11 +42,12 @@ // Configure Timers // TIM6 is used for TONE // TIM7 is used for SERVO -// TIMER_SERIAL defaults to TIM7 so we'll override it here -// -#define STEP_TIMER 10 -#define TEMP_TIMER 14 -#define TIMER_SERIAL TIM9 +// TIMER_SERIAL defaults to TIM7 and must be overridden in the platformio.h file if SERVO will also be used. +// This will be difficult to solve from the Arduino IDE, without modifying the RUMBA32 variant +// included with the STM32 framework. + +#define STEP_TIMER 10 +#define TEMP_TIMER 14 #define HAL_TIMER_RATE F_CPU // diff --git a/Marlin/src/pins/stm32f4/pins_VAKE403D.h b/Marlin/src/pins/stm32f4/pins_VAKE403D.h index d34458c04498..1ffe25b49927 100644 --- a/Marlin/src/pins/stm32f4/pins_VAKE403D.h +++ b/Marlin/src/pins/stm32f4/pins_VAKE403D.h @@ -147,7 +147,7 @@ //#define NEOPIXEL_PIN PF13 // -// Prusa i3 MK2 Multi Material Multiplexer Support +// Průša i3 MK2 Multi Material Multiplexer Support // //#define E_MUX0_PIN PG3 //#define E_MUX1_PIN PG4 diff --git a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h index 51080b2fd19f..7d96bd12ff9c 100644 --- a/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h +++ b/Marlin/src/pins/teensy2/pins_PRINTRBOARD.h @@ -166,4 +166,4 @@ #endif -#endif // HAS_SPI_LCD && NEWPANEL +#endif // ULTRA_LCD && NEWPANEL diff --git a/Marlin/src/pins/teensy2/pins_TEENSYLU.h b/Marlin/src/pins/teensy2/pins_TEENSYLU.h index 8ee07a427d8c..c69a1c06a785 100644 --- a/Marlin/src/pins/teensy2/pins_TEENSYLU.h +++ b/Marlin/src/pins/teensy2/pins_TEENSYLU.h @@ -155,7 +155,7 @@ #define SD_DETECT_PIN -1 -#endif // HAS_SPI_LCD && NEWPANEL +#endif // ULTRA_LCD && NEWPANEL // // M3/M4/M5 - Spindle/Laser Control diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 3aa7156e7b02..538fca3c881f 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -24,13 +24,15 @@ #if ENABLED(SDSUPPORT) +//#define DEBUG_CARDREADER + #include "cardreader.h" #include "../MarlinCore.h" #include "../lcd/ultralcd.h" #if ENABLED(DWIN_CREALITY_LCD) - #include "../lcd/dwin/dwin.h" + #include "../lcd/dwin/e3v2/dwin.h" #endif #include "../module/planner.h" // for synchronize @@ -51,6 +53,9 @@ #include "../feature/pause.h" #endif +#define DEBUG_OUT ENABLED(DEBUG_CARDREADER) +#include "../core/debug_out.h" + // public: card_flags_t CardReader::flag; @@ -137,6 +142,10 @@ CardReader::CardReader() { // Disable autostart until card is initialized autostart_index = -1; + #if ENABLED(SDSUPPORT) && PIN_EXISTS(SD_DETECT) + SET_INPUT_PULLUP(SD_DETECT_PIN); + #endif + #if PIN_EXISTS(SDPOWER) OUT_WRITE(SDPOWER_PIN, HIGH); // Power the SD reader #endif @@ -272,8 +281,10 @@ void CardReader::printListing(SdFile parent, const char * const prepend/*=nullpt // List all files on the SD card // void CardReader::ls() { - root.rewind(); - printListing(root); + if (flag.mounted) { + root.rewind(); + printListing(root); + } } #if ENABLED(LONG_FILENAME_HOST_SUPPORT) @@ -379,10 +390,11 @@ void CardReader::mount() { if (flag.mounted) cdroot(); - else { - spiInit(SPI_SPEED); // Return to base SPI speed - ui.set_status_P(GET_TEXT(MSG_SD_INIT_FAIL), -1); - } + #if ENABLED(USB_FLASH_DRIVE_SUPPORT) || PIN_EXISTS(SD_DETECT) + else if (marlin_state != MF_INITIALIZING) + ui.set_status_P(GET_TEXT(MSG_SD_INIT_FAIL), -1); + #endif + ui.refresh(); } @@ -398,6 +410,8 @@ void CardReader::manage_media() { uint8_t stat = uint8_t(IS_SD_INSERTED()); if (stat == prev_stat) return; + DEBUG_ECHOLNPAIR("SD: Status changed from ", prev_stat, " to ", stat); + flag.workDirIsRoot = true; // Return to root on mount/release if (ui.detected()) { @@ -424,12 +438,15 @@ void CardReader::manage_media() { if (stat) { TERN_(SDCARD_EEPROM_EMULATION, settings.first_load()); if (old_stat == 2) // First mount? + DEBUG_ECHOLNPGM("First mount."); TERN(POWER_LOSS_RECOVERY, recovery.check(), // Check for PLR file. (If not there it will beginautostart) beginautostart() // Look for auto0.g on the next loop ); } } + else + DEBUG_ECHOLNPGM("SD: No UI Detected."); } void CardReader::release() { diff --git a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp index 78f338fdae0c..a097df510523 100644 --- a/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp +++ b/Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp @@ -94,9 +94,7 @@ static_assert(USB_INTR_PIN != -1, "USB_INTR_PIN must be defined"); #include "Sd2Card_FlashDrive.h" -#if HAS_DISPLAY - #include "../../lcd/ultralcd.h" -#endif +#include "../../lcd/ultralcd.h" static enum { UNINITIALIZED, @@ -116,9 +114,7 @@ bool Sd2Card::usbStartup() { SERIAL_ECHOPGM("Starting USB host..."); if (!UHS_START) { SERIAL_ECHOLNPGM(" failed."); - #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) - LCD_MESSAGEPGM(MSG_MEDIA_USB_FAILED); - #endif + LCD_MESSAGEPGM(MSG_MEDIA_USB_FAILED); return false; } @@ -213,9 +209,7 @@ void Sd2Card::idle() { #if USB_DEBUG >= 1 SERIAL_ECHOLNPGM("Waiting for media"); #endif - #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) - LCD_MESSAGEPGM(MSG_MEDIA_WAITING); - #endif + LCD_MESSAGEPGM(MSG_MEDIA_WAITING); GOTO_STATE_AFTER_DELAY(state, 2000); } break; @@ -229,11 +223,9 @@ void Sd2Card::idle() { #if USB_DEBUG >= 1 SERIAL_ECHOLNPGM("USB device removed"); #endif - #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) - if (state != MEDIA_READY) - LCD_MESSAGEPGM(MSG_MEDIA_USB_REMOVED); - #endif - GOTO_STATE_AFTER_DELAY( WAIT_FOR_DEVICE, 0 ); + if (state != MEDIA_READY) + LCD_MESSAGEPGM(MSG_MEDIA_USB_REMOVED); + GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); } else if (state > WAIT_FOR_LUN && !bulk.LUNIsGood(0)) { @@ -241,17 +233,13 @@ void Sd2Card::idle() { #if USB_DEBUG >= 1 SERIAL_ECHOLNPGM("Media removed"); #endif - #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) - LCD_MESSAGEPGM(MSG_MEDIA_REMOVED); - #endif - GOTO_STATE_AFTER_DELAY( WAIT_FOR_DEVICE, 0 ); + LCD_MESSAGEPGM(MSG_MEDIA_REMOVED); + GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0); } else if (task_state == UHS_STATE(ERROR)) { - #if EITHER(ULTRA_LCD, EXTENSIBLE_UI) - LCD_MESSAGEPGM(MSG_MEDIA_READ_ERROR); - #endif - GOTO_STATE_AFTER_DELAY( MEDIA_ERROR, 0 ); + LCD_MESSAGEPGM(MSG_MEDIA_READ_ERROR); + GOTO_STATE_AFTER_DELAY(MEDIA_ERROR, 0); } } } diff --git a/buildroot/share/PlatformIO/boards/LERDGE.json b/buildroot/share/PlatformIO/boards/LERDGE.json index 21df8db48e7e..011814a13361 100644 --- a/buildroot/share/PlatformIO/boards/LERDGE.json +++ b/buildroot/share/PlatformIO/boards/LERDGE.json @@ -15,7 +15,8 @@ ] ], "mcu": "stm32f407zgt6", - "variant": "LERDGE" + "variant": "LERDGE", + "ldscript": "LERDGE.ld" }, "debug": { "jlink_device": "STM32F407ZG", diff --git a/buildroot/share/PlatformIO/boards/malyanM200v2.json b/buildroot/share/PlatformIO/boards/malyanM200v2.json index 9e301ee79f31..765a0c0a0006 100644 --- a/buildroot/share/PlatformIO/boards/malyanM200v2.json +++ b/buildroot/share/PlatformIO/boards/malyanM200v2.json @@ -4,7 +4,7 @@ "extra_flags": "-DSTM32F070xB", "f_cpu": "48000000L", "mcu": "stm32f070rbt6", - "variant": "MALYANM200_F070CB", + "variant": "MALYANMx00_F070CB", "vec_tab_addr": "0x8002000" }, "debug": { diff --git a/buildroot/share/PlatformIO/boards/fysetc_s6.json b/buildroot/share/PlatformIO/boards/marlin_fysetc_s6.json similarity index 94% rename from buildroot/share/PlatformIO/boards/fysetc_s6.json rename to buildroot/share/PlatformIO/boards/marlin_fysetc_s6.json index 489a15b9efe0..286e46ffbd20 100644 --- a/buildroot/share/PlatformIO/boards/fysetc_s6.json +++ b/buildroot/share/PlatformIO/boards/marlin_fysetc_s6.json @@ -4,7 +4,7 @@ "extra_flags": "-DSTM32F446xx", "f_cpu": "180000000L", "mcu": "stm32f446ret6", - "variant": "FYSETC_S6" + "variant": "MARLIN_FYSETC_S6" }, "connectivity": [ "can" @@ -32,4 +32,4 @@ }, "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32f446.html", "vendor": "FYSETC" -} \ No newline at end of file +} diff --git a/buildroot/share/PlatformIO/scripts/fysetc_STM32S6.py b/buildroot/share/PlatformIO/scripts/fysetc_STM32S6.py deleted file mode 100644 index f6598ede6543..000000000000 --- a/buildroot/share/PlatformIO/scripts/fysetc_STM32S6.py +++ /dev/null @@ -1,33 +0,0 @@ -from os.path import join -Import("env") - -import os,shutil -from SCons.Script import DefaultEnvironment -from platformio import util - -env = DefaultEnvironment() -platform = env.PioPlatform() -board = env.BoardConfig() - -FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32") -#FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32@3.10500.190327") -CMSIS_DIR = os.path.join(FRAMEWORK_DIR, "CMSIS", "CMSIS") -assert os.path.isdir(FRAMEWORK_DIR) -assert os.path.isdir(CMSIS_DIR) -assert os.path.isdir("buildroot/share/PlatformIO/variants") - -mcu_type = board.get("build.mcu")[:-2] -variant = board.get("build.variant") -series = mcu_type[:7].upper() + "xx" -variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant) - -source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant) -assert os.path.isdir(source_dir) - -if not os.path.isdir(variant_dir): - os.mkdir(variant_dir) - -for file_name in os.listdir(source_dir): - full_file_name = os.path.join(source_dir, file_name) - if os.path.isfile(full_file_name): - shutil.copy(full_file_name, variant_dir) diff --git a/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/PeripheralPins.c b/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/PeripheralPins.c index 4014a519a305..db0a439562a6 100644 --- a/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/PeripheralPins.c +++ b/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/PeripheralPins.c @@ -125,38 +125,62 @@ const PinMap PinMap_I2C_SCL[] = { #ifdef HAL_TIM_MODULE_ENABLED const PinMap PinMap_PWM[] = { + + // Some pins can perform PWM from more than one timer. These were selected to utilize as many channels as + // possible from timers which were already dedicated to PWM output. + // TIM1 = [FAN4, FAN5, HEATER6, FAN7] + // TIM2 = [, HEATER1, BED, ] + // TIM3 = [, , HEATER2, HEATER0] + // TIM4 = [HEATER5, HEATER4, , HEATER3] + // TIM8 = [FAN3, HEATER7, FAN2, FAN6] + // TIM9 = [FAN0, FAN1, , ] + {PB_1, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 HEATER0 - {PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 HEATER1 + {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 HEATER1 {PB_0, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 HEATER2 - {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 BED - {PC_8, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 FAN0 - {PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 FAN1 - {PE_6, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 FAN2 - {PC_9, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 EXTENSION1-4 - {PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 BL-TOUCH-SERVO - - // These pins have been defined for something else on the board but they MIGHT be - // used by the user as PWM pins if they aren't used for their primary purpose. + {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 HEATER3 + {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 HEATER4 + {PD_12, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 HEATER5 + {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 HEATER6 + {PI_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 HEATER7 + {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 BED + + {PE_5, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 FAN0 + {PE_6, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 FAN1 + {PC_8, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3 FAN2 + {PI_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 FAN3 + {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 FAN4 + {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 FAN5 + {PC_9, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4 FAN6 + {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 FAN7 + + + // Alternate timer assignments for pins commonly using PWM + //{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N HEATER0 + //{PB_1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N HEATER0 + //{PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 HEATER1 + //{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N HEATER2 + //{PB_0, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N HEATER2 + //{PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 BED + //{PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 BED + //{PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 FAN2 + //{PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 FAN6 + + // Pins with an available timer channel, on a timer already allocated for PWM. + // These can be freely used for purposes requiring PWM, without creating new timer conflicts. + // This pins are very likely already used for other purposes and enabling PWM on them won't be useful. + {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 BLTouch / Probe Output {PC_6, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 ESP8266 connector. Available if 8266 isn't used {PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 ESP8266 connector. Available if 8266 isn't used - {PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 I2C connector, SDA pin. Available if I2C isn't used. - // TIM5_CH1 is used by the Servo Library - {PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 BL-TOUCH port. Available if Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN - /** - * Unused by specifications on SKR-Pro. + /* + * Pins not utilizing hardware PWM on the GTR. * Uncomment the corresponding line if you want to have HardwarePWM on some pins. * WARNING: check timers' usage first to avoid conflicts. * If you don't know what you're doing leave things as they are or you WILL break something (including hardware) - * If you alter this section DO NOT report bugs to Marlin team since they are most likely caused by you. Thank you. */ //{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 //{PA_0, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 - {PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 BLTOUCH is a "servo" - {PA_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 BLTOUCH is a "servo" - //{PA_1, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 - //{PA_2, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 - //{PA_2, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 1, 0)}, // TIM9_CH1 //{PA_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 //{PA_3, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4 //{PA_3, TIM9, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM9, 2, 0)}, // TIM9_CH2 @@ -173,20 +197,16 @@ const PinMap PinMap_PWM[] = { //{PA_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 //{PA_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 //{PA_15, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 - //{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N - //{PB_0, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N - //{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N - //{PB_1, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N //{PB_3, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 //{PB_4, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1 //{PB_5, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 //{PB_6, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1 + //{PB_7, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 //{PB_8, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 //{PB_8, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 //{PB_9, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 //{PB_9, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 //{PB_10, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 - {PB_11, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 //{PB_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N //{PB_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N //{PB_14, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N @@ -197,30 +217,17 @@ const PinMap PinMap_PWM[] = { //{PC_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 //{PC_7, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 //{PC_7, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 - //{PC_8, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 - //{PC_9, TIM3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4 - {PD_13, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 - {PD_15, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4 + //{PD_14, TIM4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3 //{PE_8, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N - {PE_9, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 //{PE_10, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N - {PE_11, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 //{PE_12, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N - {PE_13, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 - {PE_14, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 - #if STM32F4X_PIN_NUM >= 144 //144 pins mcu, 114 gpio - //{PF_6, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 - //{PF_7, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 - //{PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 - //{PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 - #endif - #if STM32F4X_PIN_NUM >= 176 //176 pins mcu, 140 gpio - {PH_10, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 - {PH_6, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1 - //{PH_11, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 - {PI_5, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1 - {PI_6, TIM8, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2 - #endif + //{PF_6, TIM10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1 + //{PF_7, TIM11, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM11, 1, 0)}, // TIM11_CH1 + //{PF_8, TIM13, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1 + //{PF_9, TIM14, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 + //{PH_10, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1 + //{PH_6, TIM12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 1, 0)}, // TIM12_CH1 + //{PH_11, TIM5, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 {NC, NP, 0} }; #endif diff --git a/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/variant.h b/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/variant.h index 1ba0a18d6af6..2da195c6cff0 100644 --- a/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/variant.h +++ b/buildroot/share/PlatformIO/variants/BIGTREE_GTR_V1/variant.h @@ -255,8 +255,8 @@ extern "C" { // Timer Definitions //Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c -#define TIMER_TONE TIM2 -#define TIMER_SERVO TIM5 // Only 1 Servo PIN on SKR-PRO, so use the same timer as defined in PeripheralPins +#define TIMER_TONE TIM10 +#define TIMER_SERVO TIM5 #define TIMER_SERIAL TIM7 // UART Definitions diff --git a/buildroot/share/PlatformIO/variants/FYSETC_S6/PeripheralPins.c b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/PeripheralPins.c similarity index 100% rename from buildroot/share/PlatformIO/variants/FYSETC_S6/PeripheralPins.c rename to buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/PeripheralPins.c diff --git a/buildroot/share/PlatformIO/variants/FYSETC_S6/PinNamesVar.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/PinNamesVar.h similarity index 100% rename from buildroot/share/PlatformIO/variants/FYSETC_S6/PinNamesVar.h rename to buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/PinNamesVar.h diff --git a/buildroot/share/PlatformIO/variants/FYSETC_S6/ldscript.ld b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/ldscript.ld similarity index 100% rename from buildroot/share/PlatformIO/variants/FYSETC_S6/ldscript.ld rename to buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/ldscript.ld diff --git a/buildroot/share/PlatformIO/variants/FYSETC_S6/variant.cpp b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.cpp similarity index 100% rename from buildroot/share/PlatformIO/variants/FYSETC_S6/variant.cpp rename to buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.cpp diff --git a/buildroot/share/PlatformIO/variants/FYSETC_S6/variant.h b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.h similarity index 99% rename from buildroot/share/PlatformIO/variants/FYSETC_S6/variant.h rename to buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.h index da6a8249eed7..ee4b1ef29608 100644 --- a/buildroot/share/PlatformIO/variants/FYSETC_S6/variant.h +++ b/buildroot/share/PlatformIO/variants/MARLIN_FYSETC_S6/variant.h @@ -115,7 +115,7 @@ extern "C" { #define NUM_ANALOG_FIRST 80 // PWM resolution -#define PWM_RESOLUTION 12 +// #define PWM_RESOLUTION 12 #define PWM_FREQUENCY 20000 // >= 20 Khz => inaudible noise for fans #define PWM_MAX_DUTY_CYCLE 255 diff --git a/buildroot/share/PlatformIO/variants/megaextendedpins/pins_arduino.h b/buildroot/share/PlatformIO/variants/megaextendedpins/pins_arduino.h index 77d0beca9b9d..81f2ae3e19a1 100755 --- a/buildroot/share/PlatformIO/variants/megaextendedpins/pins_arduino.h +++ b/buildroot/share/PlatformIO/variants/megaextendedpins/pins_arduino.h @@ -160,77 +160,77 @@ const uint16_t PROGMEM port_to_input_PGM[] = { }; const uint8_t PROGMEM digital_pin_to_port_PGM[] = { - // PORTLIST - // ------------------------------------------- - PE , // PE 0 ** 0 ** USART0_RX - PE , // PE 1 ** 1 ** USART0_TX - PE , // PE 4 ** 2 ** PWM2 - PE , // PE 5 ** 3 ** PWM3 - PG , // PG 5 ** 4 ** PWM4 - PE , // PE 3 ** 5 ** PWM5 - PH , // PH 3 ** 6 ** PWM6 - PH , // PH 4 ** 7 ** PWM7 - PH , // PH 5 ** 8 ** PWM8 - PH , // PH 6 ** 9 ** PWM9 - PB , // PB 4 ** 10 ** PWM10 - PB , // PB 5 ** 11 ** PWM11 - PB , // PB 6 ** 12 ** PWM12 - PB , // PB 7 ** 13 ** PWM13 - PJ , // PJ 1 ** 14 ** USART3_TX - PJ , // PJ 0 ** 15 ** USART3_RX - PH , // PH 1 ** 16 ** USART2_TX - PH , // PH 0 ** 17 ** USART2_RX - PD , // PD 3 ** 18 ** USART1_TX - PD , // PD 2 ** 19 ** USART1_RX - PD , // PD 1 ** 20 ** I2C_SDA - PD , // PD 0 ** 21 ** I2C_SCL - PA , // PA 0 ** 22 ** D22 - PA , // PA 1 ** 23 ** D23 - PA , // PA 2 ** 24 ** D24 - PA , // PA 3 ** 25 ** D25 - PA , // PA 4 ** 26 ** D26 - PA , // PA 5 ** 27 ** D27 - PA , // PA 6 ** 28 ** D28 - PA , // PA 7 ** 29 ** D29 - PC , // PC 7 ** 30 ** D30 - PC , // PC 6 ** 31 ** D31 - PC , // PC 5 ** 32 ** D32 - PC , // PC 4 ** 33 ** D33 - PC , // PC 3 ** 34 ** D34 - PC , // PC 2 ** 35 ** D35 - PC , // PC 1 ** 36 ** D36 - PC , // PC 0 ** 37 ** D37 - PD , // PD 7 ** 38 ** D38 - PG , // PG 2 ** 39 ** D39 - PG , // PG 1 ** 40 ** D40 - PG , // PG 0 ** 41 ** D41 - PL , // PL 7 ** 42 ** D42 - PL , // PL 6 ** 43 ** D43 - PL , // PL 5 ** 44 ** D44 - PL , // PL 4 ** 45 ** D45 - PL , // PL 3 ** 46 ** D46 - PL , // PL 2 ** 47 ** D47 - PL , // PL 1 ** 48 ** D48 - PL , // PL 0 ** 49 ** D49 - PB , // PB 3 ** 50 ** SPI_MISO - PB , // PB 2 ** 51 ** SPI_MOSI - PB , // PB 1 ** 52 ** SPI_SCK - PB , // PB 0 ** 53 ** SPI_SS - PF , // PF 0 ** 54 ** A0 - PF , // PF 1 ** 55 ** A1 - PF , // PF 2 ** 56 ** A2 - PF , // PF 3 ** 57 ** A3 - PF , // PF 4 ** 58 ** A4 - PF , // PF 5 ** 59 ** A5 - PF , // PF 6 ** 60 ** A6 - PF , // PF 7 ** 61 ** A7 - PK , // PK 0 ** 62 ** A8 - PK , // PK 1 ** 63 ** A9 - PK , // PK 2 ** 64 ** A10 - PK , // PK 3 ** 65 ** A11 - PK , // PK 4 ** 66 ** A12 - PK , // PK 5 ** 67 ** A13 - PK , // PK 6 ** 68 ** A14 + // PORTLIST + // ------------------------------------------- + PE , // PE 0 ** 0 ** USART0_RX + PE , // PE 1 ** 1 ** USART0_TX + PE , // PE 4 ** 2 ** PWM2 + PE , // PE 5 ** 3 ** PWM3 + PG , // PG 5 ** 4 ** PWM4 + PE , // PE 3 ** 5 ** PWM5 + PH , // PH 3 ** 6 ** PWM6 + PH , // PH 4 ** 7 ** PWM7 + PH , // PH 5 ** 8 ** PWM8 + PH , // PH 6 ** 9 ** PWM9 + PB , // PB 4 ** 10 ** PWM10 + PB , // PB 5 ** 11 ** PWM11 + PB , // PB 6 ** 12 ** PWM12 + PB , // PB 7 ** 13 ** PWM13 + PJ , // PJ 1 ** 14 ** USART3_TX + PJ , // PJ 0 ** 15 ** USART3_RX + PH , // PH 1 ** 16 ** USART2_TX + PH , // PH 0 ** 17 ** USART2_RX + PD , // PD 3 ** 18 ** USART1_TX + PD , // PD 2 ** 19 ** USART1_RX + PD , // PD 1 ** 20 ** I2C_SDA + PD , // PD 0 ** 21 ** I2C_SCL + PA , // PA 0 ** 22 ** D22 + PA , // PA 1 ** 23 ** D23 + PA , // PA 2 ** 24 ** D24 + PA , // PA 3 ** 25 ** D25 + PA , // PA 4 ** 26 ** D26 + PA , // PA 5 ** 27 ** D27 + PA , // PA 6 ** 28 ** D28 + PA , // PA 7 ** 29 ** D29 + PC , // PC 7 ** 30 ** D30 + PC , // PC 6 ** 31 ** D31 + PC , // PC 5 ** 32 ** D32 + PC , // PC 4 ** 33 ** D33 + PC , // PC 3 ** 34 ** D34 + PC , // PC 2 ** 35 ** D35 + PC , // PC 1 ** 36 ** D36 + PC , // PC 0 ** 37 ** D37 + PD , // PD 7 ** 38 ** D38 + PG , // PG 2 ** 39 ** D39 + PG , // PG 1 ** 40 ** D40 + PG , // PG 0 ** 41 ** D41 + PL , // PL 7 ** 42 ** D42 + PL , // PL 6 ** 43 ** D43 + PL , // PL 5 ** 44 ** D44 + PL , // PL 4 ** 45 ** D45 + PL , // PL 3 ** 46 ** D46 + PL , // PL 2 ** 47 ** D47 + PL , // PL 1 ** 48 ** D48 + PL , // PL 0 ** 49 ** D49 + PB , // PB 3 ** 50 ** SPI_MISO + PB , // PB 2 ** 51 ** SPI_MOSI + PB , // PB 1 ** 52 ** SPI_SCK + PB , // PB 0 ** 53 ** SPI_SS + PF , // PF 0 ** 54 ** A0 + PF , // PF 1 ** 55 ** A1 + PF , // PF 2 ** 56 ** A2 + PF , // PF 3 ** 57 ** A3 + PF , // PF 4 ** 58 ** A4 + PF , // PF 5 ** 59 ** A5 + PF , // PF 6 ** 60 ** A6 + PF , // PF 7 ** 61 ** A7 + PK , // PK 0 ** 62 ** A8 + PK , // PK 1 ** 63 ** A9 + PK , // PK 2 ** 64 ** A10 + PK , // PK 3 ** 65 ** A11 + PK , // PK 4 ** 66 ** A12 + PK , // PK 5 ** 67 ** A13 + PK , // PK 6 ** 68 ** A14 PK , // PK 7 ** 69 ** A15 PG , // PG 4 ** 70 ** D70 PG , // PG 3 ** 71 ** D71 @@ -251,78 +251,78 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = { }; const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { - // PIN IN PORT - // ------------------------------------------- - _BV( 0 ) , // PE 0 ** 0 ** USART0_RX - _BV( 1 ) , // PE 1 ** 1 ** USART0_TX - _BV( 4 ) , // PE 4 ** 2 ** PWM2 - _BV( 5 ) , // PE 5 ** 3 ** PWM3 - _BV( 5 ) , // PG 5 ** 4 ** PWM4 - _BV( 3 ) , // PE 3 ** 5 ** PWM5 - _BV( 3 ) , // PH 3 ** 6 ** PWM6 - _BV( 4 ) , // PH 4 ** 7 ** PWM7 - _BV( 5 ) , // PH 5 ** 8 ** PWM8 - _BV( 6 ) , // PH 6 ** 9 ** PWM9 - _BV( 4 ) , // PB 4 ** 10 ** PWM10 - _BV( 5 ) , // PB 5 ** 11 ** PWM11 - _BV( 6 ) , // PB 6 ** 12 ** PWM12 - _BV( 7 ) , // PB 7 ** 13 ** PWM13 - _BV( 1 ) , // PJ 1 ** 14 ** USART3_TX - _BV( 0 ) , // PJ 0 ** 15 ** USART3_RX - _BV( 1 ) , // PH 1 ** 16 ** USART2_TX - _BV( 0 ) , // PH 0 ** 17 ** USART2_RX - _BV( 3 ) , // PD 3 ** 18 ** USART1_TX - _BV( 2 ) , // PD 2 ** 19 ** USART1_RX - _BV( 1 ) , // PD 1 ** 20 ** I2C_SDA - _BV( 0 ) , // PD 0 ** 21 ** I2C_SCL - _BV( 0 ) , // PA 0 ** 22 ** D22 - _BV( 1 ) , // PA 1 ** 23 ** D23 - _BV( 2 ) , // PA 2 ** 24 ** D24 - _BV( 3 ) , // PA 3 ** 25 ** D25 - _BV( 4 ) , // PA 4 ** 26 ** D26 - _BV( 5 ) , // PA 5 ** 27 ** D27 - _BV( 6 ) , // PA 6 ** 28 ** D28 - _BV( 7 ) , // PA 7 ** 29 ** D29 - _BV( 7 ) , // PC 7 ** 30 ** D30 - _BV( 6 ) , // PC 6 ** 31 ** D31 - _BV( 5 ) , // PC 5 ** 32 ** D32 - _BV( 4 ) , // PC 4 ** 33 ** D33 - _BV( 3 ) , // PC 3 ** 34 ** D34 - _BV( 2 ) , // PC 2 ** 35 ** D35 - _BV( 1 ) , // PC 1 ** 36 ** D36 - _BV( 0 ) , // PC 0 ** 37 ** D37 - _BV( 7 ) , // PD 7 ** 38 ** D38 - _BV( 2 ) , // PG 2 ** 39 ** D39 - _BV( 1 ) , // PG 1 ** 40 ** D40 - _BV( 0 ) , // PG 0 ** 41 ** D41 - _BV( 7 ) , // PL 7 ** 42 ** D42 - _BV( 6 ) , // PL 6 ** 43 ** D43 - _BV( 5 ) , // PL 5 ** 44 ** D44 - _BV( 4 ) , // PL 4 ** 45 ** D45 - _BV( 3 ) , // PL 3 ** 46 ** D46 - _BV( 2 ) , // PL 2 ** 47 ** D47 - _BV( 1 ) , // PL 1 ** 48 ** D48 - _BV( 0 ) , // PL 0 ** 49 ** D49 - _BV( 3 ) , // PB 3 ** 50 ** SPI_MISO - _BV( 2 ) , // PB 2 ** 51 ** SPI_MOSI - _BV( 1 ) , // PB 1 ** 52 ** SPI_SCK - _BV( 0 ) , // PB 0 ** 53 ** SPI_SS - _BV( 0 ) , // PF 0 ** 54 ** A0 - _BV( 1 ) , // PF 1 ** 55 ** A1 - _BV( 2 ) , // PF 2 ** 56 ** A2 - _BV( 3 ) , // PF 3 ** 57 ** A3 - _BV( 4 ) , // PF 4 ** 58 ** A4 - _BV( 5 ) , // PF 5 ** 59 ** A5 - _BV( 6 ) , // PF 6 ** 60 ** A6 - _BV( 7 ) , // PF 7 ** 61 ** A7 - _BV( 0 ) , // PK 0 ** 62 ** A8 - _BV( 1 ) , // PK 1 ** 63 ** A9 - _BV( 2 ) , // PK 2 ** 64 ** A10 - _BV( 3 ) , // PK 3 ** 65 ** A11 - _BV( 4 ) , // PK 4 ** 66 ** A12 - _BV( 5 ) , // PK 5 ** 67 ** A13 - _BV( 6 ) , // PK 6 ** 68 ** A14 - _BV( 7 ) , // PK 7 ** 69 ** A15 + // PIN IN PORT + // ------------------------------------------- + _BV( 0 ) , // PE 0 ** 0 ** USART0_RX + _BV( 1 ) , // PE 1 ** 1 ** USART0_TX + _BV( 4 ) , // PE 4 ** 2 ** PWM2 + _BV( 5 ) , // PE 5 ** 3 ** PWM3 + _BV( 5 ) , // PG 5 ** 4 ** PWM4 + _BV( 3 ) , // PE 3 ** 5 ** PWM5 + _BV( 3 ) , // PH 3 ** 6 ** PWM6 + _BV( 4 ) , // PH 4 ** 7 ** PWM7 + _BV( 5 ) , // PH 5 ** 8 ** PWM8 + _BV( 6 ) , // PH 6 ** 9 ** PWM9 + _BV( 4 ) , // PB 4 ** 10 ** PWM10 + _BV( 5 ) , // PB 5 ** 11 ** PWM11 + _BV( 6 ) , // PB 6 ** 12 ** PWM12 + _BV( 7 ) , // PB 7 ** 13 ** PWM13 + _BV( 1 ) , // PJ 1 ** 14 ** USART3_TX + _BV( 0 ) , // PJ 0 ** 15 ** USART3_RX + _BV( 1 ) , // PH 1 ** 16 ** USART2_TX + _BV( 0 ) , // PH 0 ** 17 ** USART2_RX + _BV( 3 ) , // PD 3 ** 18 ** USART1_TX + _BV( 2 ) , // PD 2 ** 19 ** USART1_RX + _BV( 1 ) , // PD 1 ** 20 ** I2C_SDA + _BV( 0 ) , // PD 0 ** 21 ** I2C_SCL + _BV( 0 ) , // PA 0 ** 22 ** D22 + _BV( 1 ) , // PA 1 ** 23 ** D23 + _BV( 2 ) , // PA 2 ** 24 ** D24 + _BV( 3 ) , // PA 3 ** 25 ** D25 + _BV( 4 ) , // PA 4 ** 26 ** D26 + _BV( 5 ) , // PA 5 ** 27 ** D27 + _BV( 6 ) , // PA 6 ** 28 ** D28 + _BV( 7 ) , // PA 7 ** 29 ** D29 + _BV( 7 ) , // PC 7 ** 30 ** D30 + _BV( 6 ) , // PC 6 ** 31 ** D31 + _BV( 5 ) , // PC 5 ** 32 ** D32 + _BV( 4 ) , // PC 4 ** 33 ** D33 + _BV( 3 ) , // PC 3 ** 34 ** D34 + _BV( 2 ) , // PC 2 ** 35 ** D35 + _BV( 1 ) , // PC 1 ** 36 ** D36 + _BV( 0 ) , // PC 0 ** 37 ** D37 + _BV( 7 ) , // PD 7 ** 38 ** D38 + _BV( 2 ) , // PG 2 ** 39 ** D39 + _BV( 1 ) , // PG 1 ** 40 ** D40 + _BV( 0 ) , // PG 0 ** 41 ** D41 + _BV( 7 ) , // PL 7 ** 42 ** D42 + _BV( 6 ) , // PL 6 ** 43 ** D43 + _BV( 5 ) , // PL 5 ** 44 ** D44 + _BV( 4 ) , // PL 4 ** 45 ** D45 + _BV( 3 ) , // PL 3 ** 46 ** D46 + _BV( 2 ) , // PL 2 ** 47 ** D47 + _BV( 1 ) , // PL 1 ** 48 ** D48 + _BV( 0 ) , // PL 0 ** 49 ** D49 + _BV( 3 ) , // PB 3 ** 50 ** SPI_MISO + _BV( 2 ) , // PB 2 ** 51 ** SPI_MOSI + _BV( 1 ) , // PB 1 ** 52 ** SPI_SCK + _BV( 0 ) , // PB 0 ** 53 ** SPI_SS + _BV( 0 ) , // PF 0 ** 54 ** A0 + _BV( 1 ) , // PF 1 ** 55 ** A1 + _BV( 2 ) , // PF 2 ** 56 ** A2 + _BV( 3 ) , // PF 3 ** 57 ** A3 + _BV( 4 ) , // PF 4 ** 58 ** A4 + _BV( 5 ) , // PF 5 ** 59 ** A5 + _BV( 6 ) , // PF 6 ** 60 ** A6 + _BV( 7 ) , // PF 7 ** 61 ** A7 + _BV( 0 ) , // PK 0 ** 62 ** A8 + _BV( 1 ) , // PK 1 ** 63 ** A9 + _BV( 2 ) , // PK 2 ** 64 ** A10 + _BV( 3 ) , // PK 3 ** 65 ** A11 + _BV( 4 ) , // PK 4 ** 66 ** A12 + _BV( 5 ) , // PK 5 ** 67 ** A13 + _BV( 6 ) , // PK 6 ** 68 ** A14 + _BV( 7 ) , // PK 7 ** 69 ** A15 _BV( 4 ) , // PG 4 ** 70 ** D70 _BV( 3 ) , // PG 3 ** 71 ** D71 _BV( 2 ) , // PJ 2 ** 72 ** D72 @@ -342,77 +342,77 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { }; const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { - // TIMERS - // ------------------------------------------- - NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX - NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX - TIMER3B , // PE 4 ** 2 ** PWM2 - TIMER3C , // PE 5 ** 3 ** PWM3 - TIMER0B , // PG 5 ** 4 ** PWM4 - TIMER3A , // PE 3 ** 5 ** PWM5 - TIMER4A , // PH 3 ** 6 ** PWM6 - TIMER4B , // PH 4 ** 7 ** PWM7 - TIMER4C , // PH 5 ** 8 ** PWM8 - TIMER2B , // PH 6 ** 9 ** PWM9 - TIMER2A , // PB 4 ** 10 ** PWM10 - TIMER1A , // PB 5 ** 11 ** PWM11 - TIMER1B , // PB 6 ** 12 ** PWM12 - TIMER0A , // PB 7 ** 13 ** PWM13 - NOT_ON_TIMER , // PJ 1 ** 14 ** USART3_TX - NOT_ON_TIMER , // PJ 0 ** 15 ** USART3_RX - NOT_ON_TIMER , // PH 1 ** 16 ** USART2_TX - NOT_ON_TIMER , // PH 0 ** 17 ** USART2_RX - NOT_ON_TIMER , // PD 3 ** 18 ** USART1_TX - NOT_ON_TIMER , // PD 2 ** 19 ** USART1_RX - NOT_ON_TIMER , // PD 1 ** 20 ** I2C_SDA - NOT_ON_TIMER , // PD 0 ** 21 ** I2C_SCL - NOT_ON_TIMER , // PA 0 ** 22 ** D22 - NOT_ON_TIMER , // PA 1 ** 23 ** D23 - NOT_ON_TIMER , // PA 2 ** 24 ** D24 - NOT_ON_TIMER , // PA 3 ** 25 ** D25 - NOT_ON_TIMER , // PA 4 ** 26 ** D26 - NOT_ON_TIMER , // PA 5 ** 27 ** D27 - NOT_ON_TIMER , // PA 6 ** 28 ** D28 - NOT_ON_TIMER , // PA 7 ** 29 ** D29 - NOT_ON_TIMER , // PC 7 ** 30 ** D30 - NOT_ON_TIMER , // PC 6 ** 31 ** D31 - NOT_ON_TIMER , // PC 5 ** 32 ** D32 - NOT_ON_TIMER , // PC 4 ** 33 ** D33 - NOT_ON_TIMER , // PC 3 ** 34 ** D34 - NOT_ON_TIMER , // PC 2 ** 35 ** D35 - NOT_ON_TIMER , // PC 1 ** 36 ** D36 - NOT_ON_TIMER , // PC 0 ** 37 ** D37 - NOT_ON_TIMER , // PD 7 ** 38 ** D38 - NOT_ON_TIMER , // PG 2 ** 39 ** D39 - NOT_ON_TIMER , // PG 1 ** 40 ** D40 - NOT_ON_TIMER , // PG 0 ** 41 ** D41 - NOT_ON_TIMER , // PL 7 ** 42 ** D42 - NOT_ON_TIMER , // PL 6 ** 43 ** D43 - TIMER5C , // PL 5 ** 44 ** D44 - TIMER5B , // PL 4 ** 45 ** D45 - TIMER5A , // PL 3 ** 46 ** D46 - NOT_ON_TIMER , // PL 2 ** 47 ** D47 - NOT_ON_TIMER , // PL 1 ** 48 ** D48 - NOT_ON_TIMER , // PL 0 ** 49 ** D49 - NOT_ON_TIMER , // PB 3 ** 50 ** SPI_MISO - NOT_ON_TIMER , // PB 2 ** 51 ** SPI_MOSI - NOT_ON_TIMER , // PB 1 ** 52 ** SPI_SCK - NOT_ON_TIMER , // PB 0 ** 53 ** SPI_SS - NOT_ON_TIMER , // PF 0 ** 54 ** A0 - NOT_ON_TIMER , // PF 1 ** 55 ** A1 - NOT_ON_TIMER , // PF 2 ** 56 ** A2 - NOT_ON_TIMER , // PF 3 ** 57 ** A3 - NOT_ON_TIMER , // PF 4 ** 58 ** A4 - NOT_ON_TIMER , // PF 5 ** 59 ** A5 - NOT_ON_TIMER , // PF 6 ** 60 ** A6 - NOT_ON_TIMER , // PF 7 ** 61 ** A7 - NOT_ON_TIMER , // PK 0 ** 62 ** A8 - NOT_ON_TIMER , // PK 1 ** 63 ** A9 - NOT_ON_TIMER , // PK 2 ** 64 ** A10 - NOT_ON_TIMER , // PK 3 ** 65 ** A11 - NOT_ON_TIMER , // PK 4 ** 66 ** A12 - NOT_ON_TIMER , // PK 5 ** 67 ** A13 - NOT_ON_TIMER , // PK 6 ** 68 ** A14 + // TIMERS + // ------------------------------------------- + NOT_ON_TIMER , // PE 0 ** 0 ** USART0_RX + NOT_ON_TIMER , // PE 1 ** 1 ** USART0_TX + TIMER3B , // PE 4 ** 2 ** PWM2 + TIMER3C , // PE 5 ** 3 ** PWM3 + TIMER0B , // PG 5 ** 4 ** PWM4 + TIMER3A , // PE 3 ** 5 ** PWM5 + TIMER4A , // PH 3 ** 6 ** PWM6 + TIMER4B , // PH 4 ** 7 ** PWM7 + TIMER4C , // PH 5 ** 8 ** PWM8 + TIMER2B , // PH 6 ** 9 ** PWM9 + TIMER2A , // PB 4 ** 10 ** PWM10 + TIMER1A , // PB 5 ** 11 ** PWM11 + TIMER1B , // PB 6 ** 12 ** PWM12 + TIMER0A , // PB 7 ** 13 ** PWM13 + NOT_ON_TIMER , // PJ 1 ** 14 ** USART3_TX + NOT_ON_TIMER , // PJ 0 ** 15 ** USART3_RX + NOT_ON_TIMER , // PH 1 ** 16 ** USART2_TX + NOT_ON_TIMER , // PH 0 ** 17 ** USART2_RX + NOT_ON_TIMER , // PD 3 ** 18 ** USART1_TX + NOT_ON_TIMER , // PD 2 ** 19 ** USART1_RX + NOT_ON_TIMER , // PD 1 ** 20 ** I2C_SDA + NOT_ON_TIMER , // PD 0 ** 21 ** I2C_SCL + NOT_ON_TIMER , // PA 0 ** 22 ** D22 + NOT_ON_TIMER , // PA 1 ** 23 ** D23 + NOT_ON_TIMER , // PA 2 ** 24 ** D24 + NOT_ON_TIMER , // PA 3 ** 25 ** D25 + NOT_ON_TIMER , // PA 4 ** 26 ** D26 + NOT_ON_TIMER , // PA 5 ** 27 ** D27 + NOT_ON_TIMER , // PA 6 ** 28 ** D28 + NOT_ON_TIMER , // PA 7 ** 29 ** D29 + NOT_ON_TIMER , // PC 7 ** 30 ** D30 + NOT_ON_TIMER , // PC 6 ** 31 ** D31 + NOT_ON_TIMER , // PC 5 ** 32 ** D32 + NOT_ON_TIMER , // PC 4 ** 33 ** D33 + NOT_ON_TIMER , // PC 3 ** 34 ** D34 + NOT_ON_TIMER , // PC 2 ** 35 ** D35 + NOT_ON_TIMER , // PC 1 ** 36 ** D36 + NOT_ON_TIMER , // PC 0 ** 37 ** D37 + NOT_ON_TIMER , // PD 7 ** 38 ** D38 + NOT_ON_TIMER , // PG 2 ** 39 ** D39 + NOT_ON_TIMER , // PG 1 ** 40 ** D40 + NOT_ON_TIMER , // PG 0 ** 41 ** D41 + NOT_ON_TIMER , // PL 7 ** 42 ** D42 + NOT_ON_TIMER , // PL 6 ** 43 ** D43 + TIMER5C , // PL 5 ** 44 ** D44 + TIMER5B , // PL 4 ** 45 ** D45 + TIMER5A , // PL 3 ** 46 ** D46 + NOT_ON_TIMER , // PL 2 ** 47 ** D47 + NOT_ON_TIMER , // PL 1 ** 48 ** D48 + NOT_ON_TIMER , // PL 0 ** 49 ** D49 + NOT_ON_TIMER , // PB 3 ** 50 ** SPI_MISO + NOT_ON_TIMER , // PB 2 ** 51 ** SPI_MOSI + NOT_ON_TIMER , // PB 1 ** 52 ** SPI_SCK + NOT_ON_TIMER , // PB 0 ** 53 ** SPI_SS + NOT_ON_TIMER , // PF 0 ** 54 ** A0 + NOT_ON_TIMER , // PF 1 ** 55 ** A1 + NOT_ON_TIMER , // PF 2 ** 56 ** A2 + NOT_ON_TIMER , // PF 3 ** 57 ** A3 + NOT_ON_TIMER , // PF 4 ** 58 ** A4 + NOT_ON_TIMER , // PF 5 ** 59 ** A5 + NOT_ON_TIMER , // PF 6 ** 60 ** A6 + NOT_ON_TIMER , // PF 7 ** 61 ** A7 + NOT_ON_TIMER , // PK 0 ** 62 ** A8 + NOT_ON_TIMER , // PK 1 ** 63 ** A9 + NOT_ON_TIMER , // PK 2 ** 64 ** A10 + NOT_ON_TIMER , // PK 3 ** 65 ** A11 + NOT_ON_TIMER , // PK 4 ** 66 ** A12 + NOT_ON_TIMER , // PK 5 ** 67 ** A13 + NOT_ON_TIMER , // PK 6 ** 68 ** A14 NOT_ON_TIMER , // PK 7 ** 69 ** A15 NOT_ON_TIMER , // PG 4 ** 70 ** D70 NOT_ON_TIMER , // PG 3 ** 71 ** D71 diff --git a/buildroot/share/vscode/avrdude.conf b/buildroot/share/vscode/avrdude.conf index 9f85aa0d26d6..991d255750f5 100644 --- a/buildroot/share/vscode/avrdude.conf +++ b/buildroot/share/vscode/avrdude.conf @@ -151,7 +151,7 @@ # # INSTRUCTION FORMATS # -# Instruction formats are specified as a comma seperated list of +# Instruction formats are specified as a comma separated list of # string values containing information (bit specifiers) about each # of the 32 bits of the instruction. Bit specifiers may be one of # the following formats: diff --git a/buildroot/share/vscode/avrdude_linux.conf b/buildroot/share/vscode/avrdude_linux.conf index 64d3b677d5bf..ff429a028cca 100644 --- a/buildroot/share/vscode/avrdude_linux.conf +++ b/buildroot/share/vscode/avrdude_linux.conf @@ -151,7 +151,7 @@ # # INSTRUCTION FORMATS # -# Instruction formats are specified as a comma seperated list of +# Instruction formats are specified as a comma separated list of # string values containing information (bit specifiers) about each # of the 32 bits of the instruction. Bit specifiers may be one of # the following formats: diff --git a/buildroot/share/vscode/avrdude_macOS.conf b/buildroot/share/vscode/avrdude_macOS.conf index 814e87e35ea3..6147a2259ac9 100644 --- a/buildroot/share/vscode/avrdude_macOS.conf +++ b/buildroot/share/vscode/avrdude_macOS.conf @@ -151,7 +151,7 @@ # # INSTRUCTION FORMATS # -# Instruction formats are specified as a comma seperated list of +# Instruction formats are specified as a comma separated list of # string values containing information (bit specifiers) about each # of the 32 bits of the instruction. Bit specifiers may be one of # the following formats: diff --git a/buildroot/tests/STM32F070CB_malyan-tests b/buildroot/tests/STM32F070CB_malyan-tests new file mode 100644 index 000000000000..20bd111fa9c0 --- /dev/null +++ b/buildroot/tests/STM32F070CB_malyan-tests @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# +# Build tests for STM32F070CB Malyan M200 v2 +# + +# exit on first failure +set -e + +restore_configs +opt_set MOTHERBOARD BOARD_MALYAN_M200_V2 +opt_set SERIAL_PORT -1 +exec_test $1 $2 "Malyan M200 v2 Default Config" + +# cleanup +restore_configs diff --git a/buildroot/tests/mks_robin_nano35-tests b/buildroot/tests/mks_robin_nano35-tests index ac72050875ab..92c97be756cd 100644 --- a/buildroot/tests/mks_robin_nano35-tests +++ b/buildroot/tests/mks_robin_nano35-tests @@ -35,5 +35,12 @@ opt_disable TOUCH_SCREEN opt_enable TFT_LVGL_UI_SPI exec_test $1 $2 "MKS Robin v2 nano LVGL SPI" +use_example_configs Mks/Robin +opt_set MOTHERBOARD BOARD_MKS_ROBIN_NANO_V2 +opt_disable TFT_320x240 +opt_enable TOUCH_SCREEN +opt_enable TFT_480x320_SPI +exec_test $1 $2 "MKS Robin v2 nano New Color UI 480x320 SPI" + # cleanup restore_configs diff --git a/platformio.ini b/platformio.ini index e3ff6c152634..f46e60996917 100644 --- a/platformio.ini +++ b/platformio.ini @@ -661,13 +661,10 @@ board = nxp_lpc1769 # HAL/STM32 Base Environment values # [common_stm32] -platform = ststm32@~6.1.0 -platform_packages = framework-arduinoststm32@>=4.10700,<4.10800 -lib_ignore = SoftwareSerial +platform = ststm32@~8.0 build_flags = ${common.build_flags} - -IMarlin/src/HAL/STM32 -std=gnu++14 + -std=gnu++14 -DUSBCON -DUSBD_USE_CDC - -DUSBD_VID=0x0483 -DTIM_IRQ_PRIO=13 build_unflags = -std=gnu++11 src_filter = ${common.default_src_filter} + @@ -676,7 +673,7 @@ src_filter = ${common.default_src_filter} + # HAL/STM32F1 Common Environment values # [common_stm32f1] -platform = ${common_stm32.platform} +platform = ststm32@~6.1 build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py ${common.build_flags} -std=gnu++14 -DHAVE_SW_SERIAL build_unflags = -std=gnu11 -std=gnu++11 @@ -828,7 +825,6 @@ platform = ${common_stm32.platform} extends = common_stm32 board = armed_v1 build_flags = ${common_stm32.build_flags} - '-DUSB_PRODUCT="ARMED_V1"' -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing # @@ -1008,20 +1004,29 @@ lib_ignore = ${common_stm32f1.lib_ignore} platform = ${common_stm32.platform} extends = common_stm32 board = malyanM200v2 -build_flags = ${common_stm32.build_flags} -DSTM32F0xx -DUSB_PRODUCT=\"STM32F070RB\" -DHAL_PCD_MODULE_ENABLED - -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing -std=gnu11 -std=gnu++11 +build_flags = ${common_stm32.build_flags} -DHAL_PCD_MODULE_ENABLED + -O2 -ffreestanding -fsigned-char -fno-move-loop-invariants -fno-strict-aliasing -DCUSTOM_STARTUP_FILE -lib_ignore = SoftwareSerial + +# +# Malyan M200 v2 (STM32F070CB) +# +[env:STM32F070CB_malyan] +platform = ${common_stm32.platform} +extends = common_stm32 +board = malyanm200_f070cb +build_flags = ${common_stm32.build_flags} + -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED -DCUSTOM_STARTUP_FILE # # Malyan M300 (STM32F070CB) # [env:malyan_M300] -platform = ststm32@>=6.1.0,<6.2.0 +platform = ${common_stm32.platform} +extends = common_stm32 board = malyanm300_f070cb -build_flags = ${common.build_flags} - -DUSBCON -DUSBD_VID=0x0483 "-DUSB_MANUFACTURER=\"Unknown\"" "-DUSB_PRODUCT=\"MALYAN_M300\"" - -DHAL_PCD_MODULE_ENABLED -DUSBD_USE_CDC -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED +build_flags = ${common_stm32.build_flags} + -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED src_filter = ${common.default_src_filter} + # @@ -1074,13 +1079,11 @@ platform = ${common_stm32.platform} extends = common_stm32 board = STEVAL_STM32F401VE build_flags = ${common_stm32.build_flags} - -DTARGET_STM32F4 -DARDUINO_STEVAL -DSTM32F401xE - -DUSB_PRODUCT=\"STEVAL_F401VE\" + -DARDUINO_STEVAL -DSTM32F401xE -DDISABLE_GENERIC_SERIALUSB -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py buildroot/share/PlatformIO/scripts/STEVAL__F401XX.py -lib_ignore = SoftwareSerial # # FLYF407ZG @@ -1090,8 +1093,7 @@ platform = ${common_stm32.platform} extends = common_stm32 board = FLYF407ZG build_flags = ${common_stm32.build_flags} - -DSTM32F4 -DUSB_PRODUCT=\"STM32F407ZG\" - -DTARGET_STM32F4 -DVECT_TAB_OFFSET=0x8000 + -DVECT_TAB_OFFSET=0x8000 extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py @@ -1101,14 +1103,13 @@ extra_scripts = ${common.extra_scripts} [env:FYSETC_S6] platform = ${common_stm32.platform} extends = common_stm32 -platform_packages = ${common_stm32.platform_packages} - tool-stm32duino -board = fysetc_s6 +platform_packages = tool-stm32duino +board = marlin_fysetc_s6 build_flags = ${common_stm32.build_flags} - -DTARGET_STM32F4 -DVECT_TAB_OFFSET=0x10000 - -DHAL_PCD_MODULE_ENABLED '-DUSB_PRODUCT="FYSETC_S6"' + -DVECT_TAB_OFFSET=0x10000 + -DHAL_PCD_MODULE_ENABLED extra_scripts = ${common.extra_scripts} - pre:buildroot/share/PlatformIO/scripts/fysetc_STM32S6.py + pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py debug_tool = stlink upload_protocol = dfu upload_command = dfu-util -a 0 -s 0x08010000:leave -D "$SOURCE" @@ -1123,12 +1124,10 @@ platform = ${common_stm32.platform} extends = common_stm32 board = blackSTM32F407VET6 build_flags = ${common_stm32.build_flags} - -DTARGET_STM32F4 -DARDUINO_BLACK_F407VE - -DUSB_PRODUCT=\"BLACK_F407VE\" + -DARDUINO_BLACK_F407VE -DUSBD_USE_CDC_COMPOSITE -DUSE_USB_FS extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py -lib_ignore = SoftwareSerial # # BigTreeTech SKR Pro (STM32F407ZGT6 ARM Cortex-M4) @@ -1138,8 +1137,7 @@ platform = ${common_stm32.platform} extends = common_stm32 board = BigTree_SKR_Pro build_flags = ${common_stm32.build_flags} - -DUSB_PRODUCT=\"STM32F407ZG\" - -DTARGET_STM32F4 -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000 + -DSTM32F407_5ZX -DVECT_TAB_OFFSET=0x8000 extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py #upload_protocol = stlink @@ -1151,14 +1149,13 @@ debug_init_break = # Bigtreetech GTR V1.0 (STM32F407IGT6 ARM Cortex-M4) # [env:BIGTREE_GTR_V1_0] -platform = ststm32@>=5.7.0,<6.2.0 +platform = ${common_stm32.platform} extends = common_stm32 board = BigTree_GTR_v1 extra_scripts = ${common.extra_scripts} pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py build_flags = ${common_stm32.build_flags} - -DUSB_PRODUCT=\"STM32F407IG\" - -DTARGET_STM32F4 -DSTM32F407IX -DVECT_TAB_OFFSET=0x8000 + -DSTM32F407IX -DVECT_TAB_OFFSET=0x8000 # # BigTreeTech BTT002 V1.0 (STM32F407VGT6 ARM Cortex-M4) @@ -1168,8 +1165,7 @@ platform = ${common_stm32.platform} extends = common_stm32 board = BigTree_Btt002 build_flags = ${common_stm32.build_flags} - -DUSB_PRODUCT=\"STM32F407VG\" - -DTARGET_STM32F4 -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000 + -DSTM32F407_5VX -DVECT_TAB_OFFSET=0x8000 -DHAVE_HWSERIAL2 -DHAVE_HWSERIAL3 -DPIN_SERIAL2_RX=PD_6 @@ -1226,10 +1222,10 @@ platform = ${common_stm32.platform} extends = common_stm32 build_flags = ${common_stm32.build_flags} -Os - "-DUSB_PRODUCT=\"RUMBA32\"" -DHAL_PCD_MODULE_ENABLED -DDISABLE_GENERIC_SERIALUSB -DHAL_UART_MODULE_ENABLED + -DTIMER_SERIAL=TIM9 board = rumba32_f446ve upload_protocol = dfu monitor_speed = 500000