diff --git a/Marlin/Makefile b/Marlin/Makefile index 5ab0d1eefd11..68dd05bdfbad 100644 --- a/Marlin/Makefile +++ b/Marlin/Makefile @@ -170,110 +170,114 @@ else ifeq ($(HARDWARE_MOTHERBOARD),1100) else ifeq ($(HARDWARE_MOTHERBOARD),1101) # Velleman K8400 Controller (derived from 3Drag Controller) else ifeq ($(HARDWARE_MOTHERBOARD),1102) -# Velleman K8600 Controller (derived from 3Drag Controller) +# Velleman K8600 Controller (Vertex Nano) else ifeq ($(HARDWARE_MOTHERBOARD),1103) -# 2PrintBeta BAM&DICE with STK drivers +# Velleman K8800 Controller (Vertex Delta) else ifeq ($(HARDWARE_MOTHERBOARD),1104) -# 2PrintBeta BAM&DICE Due with STK drivers +# 2PrintBeta BAM&DICE with STK drivers else ifeq ($(HARDWARE_MOTHERBOARD),1105) -# MKS BASE v1.0 +# 2PrintBeta BAM&DICE Due with STK drivers else ifeq ($(HARDWARE_MOTHERBOARD),1106) -# MKS v1.4 with A4982 stepper drivers +# MKS BASE v1.0 else ifeq ($(HARDWARE_MOTHERBOARD),1107) -# MKS v1.5 with Allegro A4982 stepper drivers +# MKS v1.4 with A4982 stepper drivers else ifeq ($(HARDWARE_MOTHERBOARD),1108) -# MKS v1.6 with Allegro A4982 stepper drivers +# MKS v1.5 with Allegro A4982 stepper drivers else ifeq ($(HARDWARE_MOTHERBOARD),1109) -# MKS BASE 1.0 with Heroic HR4982 stepper drivers +# MKS v1.6 with Allegro A4982 stepper drivers else ifeq ($(HARDWARE_MOTHERBOARD),1110) -# MKS GEN v1.3 or 1.4 +# MKS BASE 1.0 with Heroic HR4982 stepper drivers else ifeq ($(HARDWARE_MOTHERBOARD),1111) -# MKS GEN L +# MKS GEN v1.3 or 1.4 else ifeq ($(HARDWARE_MOTHERBOARD),1112) -# zrib V2.0 control board (Chinese knock off RAMPS replica) +# MKS GEN L else ifeq ($(HARDWARE_MOTHERBOARD),1113) -# BigTreeTech or BIQU KFB2.0 +# zrib V2.0 control board (Chinese knock off RAMPS replica) else ifeq ($(HARDWARE_MOTHERBOARD),1114) -# Felix 2.0+ Electronics Board (RAMPS like) +# BigTreeTech or BIQU KFB2.0 else ifeq ($(HARDWARE_MOTHERBOARD),1115) -# Invent-A-Part RigidBoard +# Felix 2.0+ Electronics Board (RAMPS like) else ifeq ($(HARDWARE_MOTHERBOARD),1116) -# Invent-A-Part RigidBoard V2 +# Invent-A-Part RigidBoard else ifeq ($(HARDWARE_MOTHERBOARD),1117) -# Sainsmart 2-in-1 board +# Invent-A-Part RigidBoard V2 else ifeq ($(HARDWARE_MOTHERBOARD),1118) -# Ultimaker +# Sainsmart 2-in-1 board else ifeq ($(HARDWARE_MOTHERBOARD),1119) -# Ultimaker (Older electronics. Pre 1.5.4. This is rare) +# Ultimaker else ifeq ($(HARDWARE_MOTHERBOARD),1120) +# Ultimaker (Older electronics. Pre 1.5.4. This is rare) +else ifeq ($(HARDWARE_MOTHERBOARD),1121) MCU ?= atmega1280 # Azteeg X3 -else ifeq ($(HARDWARE_MOTHERBOARD),1121) -# Azteeg X3 Pro else ifeq ($(HARDWARE_MOTHERBOARD),1122) -# Ultimainboard 2.x (Uses TEMP_SENSOR 20) +# Azteeg X3 Pro else ifeq ($(HARDWARE_MOTHERBOARD),1123) -# Rumba +# Ultimainboard 2.x (Uses TEMP_SENSOR 20) else ifeq ($(HARDWARE_MOTHERBOARD),1124) -# Raise3D Rumba +# Rumba else ifeq ($(HARDWARE_MOTHERBOARD),1125) -# Rapide Lite RL200 Rumba +# Raise3D Rumba else ifeq ($(HARDWARE_MOTHERBOARD),1126) -# Formbot T-Rex 2 Plus +# Rapide Lite RL200 Rumba else ifeq ($(HARDWARE_MOTHERBOARD),1127) -# Formbot T-Rex 3 +# Formbot T-Rex 2 Plus else ifeq ($(HARDWARE_MOTHERBOARD),1128) -# Formbot Raptor +# Formbot T-Rex 3 else ifeq ($(HARDWARE_MOTHERBOARD),1129) -# Formbot Raptor 2 +# Formbot Raptor else ifeq ($(HARDWARE_MOTHERBOARD),1130) -# bq ZUM Mega 3D +# Formbot Raptor 2 else ifeq ($(HARDWARE_MOTHERBOARD),1131) -# MakeBoard Mini v2.1.2 is a control board sold by MicroMake +# bq ZUM Mega 3D else ifeq ($(HARDWARE_MOTHERBOARD),1132) -# TriGorilla Anycubic version 1.3 based on RAMPS EFB +# MakeBoard Mini v2.1.2 is a control board sold by MicroMake else ifeq ($(HARDWARE_MOTHERBOARD),1133) -# TriGorilla Anycubic version 1.4 based on RAMPS EFB +# TriGorilla Anycubic version 1.3 based on RAMPS EFB else ifeq ($(HARDWARE_MOTHERBOARD),1134) -# TriGorilla Anycubic version 1.4 Rev 1.1 +# TriGorilla Anycubic version 1.4 based on RAMPS EFB else ifeq ($(HARDWARE_MOTHERBOARD),1135) -# Creality: Ender-4, CR-8 +# TriGorilla Anycubic version 1.4 Rev 1.1 else ifeq ($(HARDWARE_MOTHERBOARD),1136) -# Creality: CR10S, CR20, CR-X +# Creality: Ender-4, CR-8 else ifeq ($(HARDWARE_MOTHERBOARD),1137) -# Dagoma F5 +# Creality: CR10S, CR20, CR-X else ifeq ($(HARDWARE_MOTHERBOARD),1138) -# FYSETC F6 1.3 +# Dagoma F5 else ifeq ($(HARDWARE_MOTHERBOARD),1139) -# FYSETC F6 1.5 +# FYSETC F6 1.3 else ifeq ($(HARDWARE_MOTHERBOARD),1140) -# Duplicator i3 Plus +# FYSETC F6 1.5 else ifeq ($(HARDWARE_MOTHERBOARD),1141) -# VORON +# Duplicator i3 Plus else ifeq ($(HARDWARE_MOTHERBOARD),1142) -# TRONXY V3 1.0 +# VORON else ifeq ($(HARDWARE_MOTHERBOARD),1143) -# Z-Bolt X Series +# TRONXY V3 1.0 else ifeq ($(HARDWARE_MOTHERBOARD),1144) -# TT OSCAR +# Z-Bolt X Series else ifeq ($(HARDWARE_MOTHERBOARD),1145) -# Overlord/Overlord Pro +# TT OSCAR else ifeq ($(HARDWARE_MOTHERBOARD),1146) -# ADIMLab Gantry v1 +# Overlord/Overlord Pro else ifeq ($(HARDWARE_MOTHERBOARD),1147) -# ADIMLab Gantry v2 +# ADIMLab Gantry v1 else ifeq ($(HARDWARE_MOTHERBOARD),1148) -# BIQU Tango V1 +# ADIMLab Gantry v2 else ifeq ($(HARDWARE_MOTHERBOARD),1149) -# MKS GEN L V2 +# BIQU Tango V1 else ifeq ($(HARDWARE_MOTHERBOARD),1150) -# Copymaster 3D +# MKS GEN L V2 else ifeq ($(HARDWARE_MOTHERBOARD),1151) -# Ortur 4 +# MKS GEN L V2.1 else ifeq ($(HARDWARE_MOTHERBOARD),1152) -# Tenlog D3 Hero +# Copymaster 3D else ifeq ($(HARDWARE_MOTHERBOARD),1153) +# Ortur 4 +else ifeq ($(HARDWARE_MOTHERBOARD),1154) +# Tenlog D3 Hero +else ifeq ($(HARDWARE_MOTHERBOARD),1155) # # RAMBo and derivatives diff --git a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp index 00b4310d1dc7..b3d2908ac93e 100644 --- a/Marlin/src/HAL/LPC1768/HAL_SPI.cpp +++ b/Marlin/src/HAL/LPC1768/HAL_SPI.cpp @@ -39,10 +39,10 @@ * Some of the LCD interfaces/adapters result in the LCD SPI and the SD card * SPI sharing pins. The SCK, MOSI & MISO pins can NOT be set/cleared with * WRITE nor digitalWrite when the hardware SPI module within the LPC17xx is - * active. If any of these pins are shared then the software SPI must be used. + * active. If any of these pins are shared then the software SPI must be used. * - * A more sophisticated hardware SPI can be found at the following link. This - * implementation has not been fully debugged. + * A more sophisticated hardware SPI can be found at the following link. + * This implementation has not been fully debugged. * https://github.com/MarlinFirmware/Marlin/tree/071c7a78f27078fd4aee9a3ef365fcf5e143531e */ @@ -100,72 +100,25 @@ #else - // 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) - #define LPC_HW_SPI_DEV 1 - #else - #if (SCK_PIN == P0_15 && MISO_PIN == P0_17 && MOSI_PIN == P0_18) - #define LPC_HW_SPI_DEV 0 - #else - #error "Invalid pins selected for hardware SPI" - #endif - #endif - #endif - #if LPC_HW_SPI_DEV == 0 - #define LPC_SSPn LPC_SSP0 - #else - #define LPC_SSPn LPC_SSP1 - #endif - void spiBegin() { // setup SCK, MOSI & MISO pins for SSP0 - PINSEL_CFG_Type PinCfg; // data structure to hold init values - PinCfg.Funcnum = 2; - PinCfg.OpenDrain = 0; - PinCfg.Pinmode = 0; - PinCfg.Pinnum = LPC176x::pin_bit(SCK_PIN); - PinCfg.Portnum = LPC176x::pin_port(SCK_PIN); - PINSEL_ConfigPin(&PinCfg); - SET_OUTPUT(SCK_PIN); - - PinCfg.Pinnum = LPC176x::pin_bit(MISO_PIN); - PinCfg.Portnum = LPC176x::pin_port(MISO_PIN); - PINSEL_ConfigPin(&PinCfg); - SET_INPUT(MISO_PIN); - - PinCfg.Pinnum = LPC176x::pin_bit(MOSI_PIN); - PinCfg.Portnum = LPC176x::pin_port(MOSI_PIN); - PINSEL_ConfigPin(&PinCfg); - SET_OUTPUT(MOSI_PIN); - // divide PCLK by 2 for SSP0 - CLKPWR_SetPCLKDiv(LPC_HW_SPI_DEV == 0 ? CLKPWR_PCLKSEL_SSP0 : CLKPWR_PCLKSEL_SSP1, CLKPWR_PCLKSEL_CCLK_DIV_2); - spiInit(0); - SSP_Cmd(LPC_SSPn, ENABLE); // start SSP running + spiInit(SPI_SPEED); } void spiInit(uint8_t spiRate) { - // table to convert Marlin spiRates (0-5 plus default) into bit rates - uint32_t Marlin_speed[7]; // CPSR is always 2 - Marlin_speed[0] = 8333333; //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED - Marlin_speed[1] = 4166667; //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED - Marlin_speed[2] = 2083333; //(SCR: 11) desired: 2,000,000 actual: 2,083,333 +4.2% SPI_QUARTER_SPEED - Marlin_speed[3] = 1000000; //(SCR: 24) desired: 1,000,000 actual: 1,000,000 SPI_EIGHTH_SPEED - Marlin_speed[4] = 500000; //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5 - Marlin_speed[5] = 250000; //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6 - Marlin_speed[6] = 125000; //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h - // setup for SPI mode - 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 = Marlin_speed[_MIN(spiRate, 6)]; // put in the specified bit rate - HW_SPI_init.Mode |= SSP_CR1_SSP_EN; - SSP_Init(LPC_SSPn, &HW_SPI_init); // puts the values into the proper bits in the SSP0 registers + #if MISO_PIN == BOARD_SPI1_MISO_PIN + SPI.setModule(1); + #elif MISO_PIN == BOARD_SPI2_MISO_PIN + SPI.setModule(2); + #endif + SPI.setDataSize(DATA_SIZE_8BIT); + SPI.setDataMode(SPI_MODE0); + + SPI.setClock(SPISettings::spiRate2Clock(spiRate)); + SPI.begin(); } static uint8_t doio(uint8_t b) { - /* send and receive a single byte */ - SSP_SendData(LPC_SSPn, b & 0x00FF); - while (SSP_GetStatus(LPC_SSPn, SSP_STAT_BUSY)); // wait for it to finish - return SSP_ReceiveData(LPC_SSPn) & 0x00FF; + return SPI.transfer(b & 0x00FF) & 0x00FF; } void spiSend(uint8_t b) { doio(b); } @@ -217,63 +170,74 @@ static inline void waitSpiTxEnd(LPC_SSP_TypeDef *spi_d) { while (SSP_GetStatus(spi_d, SSP_STAT_BUSY) == SET) { /* nada */ } // wait until BSY=0 } +// Retain the pin init state of the SPI, to avoid init more than once, +// even if more instances of SPIClass exist +static bool spiInitialised[BOARD_NR_SPI] = { false }; + 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); + _settings[0].dataMode = SPI_MODE0; + _settings[0].dataSize = DATA_SIZE_8BIT; + _settings[0].clock = SPI_CLOCK_MAX; + //_settings[0].clockDivider = determine_baud_rate(_settings[0].spi_d, _settings[0].clock); #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); + _settings[1].dataMode = SPI_MODE0; + _settings[1].dataSize = DATA_SIZE_8BIT; + _settings[1].clock = SPI_CLOCK_MAX; + //_settings[1].clockDivider = determine_baud_rate(_settings[1].spi_d, _settings[1].clock); + #endif + + setModule(device); + + // Init the GPDMA controller + // TODO: call once in the constructor? or each time? + GPDMA_Init(); +} + +void SPIClass::begin() { + // Init the SPI pins in the first begin call + if ((_currentSetting->spi_d == LPC_SSP0 && spiInitialised[0] == false) || + (_currentSetting->spi_d == LPC_SSP1 && spiInitialised[1] == false)) { + pin_t sck, miso, mosi; + if (_currentSetting->spi_d == LPC_SSP0) { + sck = BOARD_SPI1_SCK_PIN; + miso = BOARD_SPI1_MISO_PIN; + mosi = BOARD_SPI1_MOSI_PIN; + spiInitialised[0] = true; + } + else if (_currentSetting->spi_d == LPC_SSP1) { + sck = BOARD_SPI2_SCK_PIN; + miso = BOARD_SPI2_MISO_PIN; + mosi = BOARD_SPI2_MOSI_PIN; + spiInitialised[1] = true; + } + PINSEL_CFG_Type PinCfg; // data structure to hold init values 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); + PinCfg.Pinnum = LPC176x::pin_bit(sck); + PinCfg.Portnum = LPC176x::pin_port(sck); PINSEL_ConfigPin(&PinCfg); - SET_OUTPUT(BOARD_SPI2_SCK_PIN); + SET_OUTPUT(sck); - PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_MISO_PIN); - PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_MISO_PIN); + PinCfg.Pinnum = LPC176x::pin_bit(miso); + PinCfg.Portnum = LPC176x::pin_port(miso); PINSEL_ConfigPin(&PinCfg); - SET_INPUT(BOARD_SPI2_MISO_PIN); + SET_INPUT(miso); - PinCfg.Pinnum = LPC176x::pin_bit(BOARD_SPI2_MOSI_PIN); - PinCfg.Portnum = LPC176x::pin_port(BOARD_SPI2_MOSI_PIN); + PinCfg.Pinnum = LPC176x::pin_bit(mosi); + PinCfg.Portnum = LPC176x::pin_port(mosi); 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(); -} + SET_OUTPUT(mosi); + } -void SPIClass::begin() { updateSettings(); SSP_Cmd(_currentSetting->spi_d, ENABLE); // start SSP running } @@ -287,7 +251,7 @@ void SPIClass::beginTransaction(const SPISettings &cfg) { } uint8_t SPIClass::transfer(const uint16_t b) { - /* send and receive a single byte */ + // 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 @@ -295,8 +259,7 @@ uint8_t SPIClass::transfer(const uint16_t b) { } uint16_t SPIClass::transfer16(const uint16_t data) { - return (transfer((data >> 8) & 0xFF) << 8) - | (transfer(data & 0xFF) & 0xFF); + return (transfer((data >> 8) & 0xFF) << 8) | (transfer(data & 0xFF) & 0xFF); } void SPIClass::end() { @@ -320,7 +283,7 @@ void SPIClass::dmaSend(void *buf, uint16_t length, bool minc) { // Destination memory - Not used GPDMACfg.DstMemAddr = 0; // Transfer size - GPDMACfg.TransferSize = (minc ? length : 1); + GPDMACfg.TransferSize = length; // Transfer width GPDMACfg.TransferWidth = (_currentSetting->dataSize == DATA_SIZE_16BIT) ? GPDMA_WIDTH_HALFWORD : GPDMA_WIDTH_BYTE; // Transfer type @@ -335,26 +298,24 @@ void SPIClass::dmaSend(void *buf, uint16_t length, bool minc) { // 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); + // Only increase memory if minc is true + GPDMACfg.MemoryIncrease = (minc ? GPDMA_DMACCxControl_SI : 0); - // enabled dma - GPDMA_ChannelCmd(0, ENABLE); + // Setup channel with given parameter + GPDMA_Setup(&GPDMACfg); - // wait data transfer - while (!GPDMA_IntGetStatus(GPDMA_STAT_INTTC, 0) && !GPDMA_IntGetStatus(GPDMA_STAT_INTERR, 0)) { } + // Enable DMA + GPDMA_ChannelCmd(0, ENABLE); - // clear err and int - GPDMA_ClearIntPending (GPDMA_STATCLR_INTTC, 0); - GPDMA_ClearIntPending (GPDMA_STATCLR_INTERR, 0); + // Wait for data transfer + while (!GPDMA_IntGetStatus(GPDMA_STAT_RAWINTTC, 0) && !GPDMA_IntGetStatus(GPDMA_STAT_RAWINTERR, 0)) { } - // dma disable - GPDMA_ChannelCmd(0, DISABLE); + // Clear err and int + GPDMA_ClearIntPending (GPDMA_STATCLR_INTTC, 0); + GPDMA_ClearIntPending (GPDMA_STATCLR_INTERR, 0); - --length; - } while (!minc && length > 0); + // Disable DMA + GPDMA_ChannelCmd(0, DISABLE); waitSpiTxEnd(_currentSetting->spi_d); @@ -382,7 +343,7 @@ void SPIClass::setBitOrder(uint8_t bitOrder) { } void SPIClass::setDataMode(uint8_t dataMode) { - _currentSetting->dataSize = dataMode; + _currentSetting->dataMode = dataMode; } void SPIClass::setDataSize(uint32_t ds) { @@ -413,19 +374,19 @@ void SPIClass::updateSettings() { switch (_currentSetting->dataMode) { case SPI_MODE0: HW_SPI_init.CPHA = SSP_CPHA_FIRST; - HW_SPI_init.CPOL = SSP_CPOL_HI; + 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; + 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; + 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; + HW_SPI_init.CPOL = SSP_CPOL_LO; break; default: break; diff --git a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h index 0a4e59c6c459..caec347bf599 100644 --- a/Marlin/src/HAL/LPC1768/inc/SanityCheck.h +++ b/Marlin/src/HAL/LPC1768/inc/SanityCheck.h @@ -24,7 +24,7 @@ #if PIO_PLATFORM_VERSION < 1001 #error "nxplpc-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries. You may need to remove the platform and let it reinstall automatically." #endif -#if PIO_FRAMEWORK_VERSION < 2002 +#if PIO_FRAMEWORK_VERSION < 2005 #error "framework-arduino-lpc176x package is out of date, Please update the PlatformIO platforms, frameworks and libraries." #endif diff --git a/Marlin/src/HAL/LPC1768/include/SPI.h b/Marlin/src/HAL/LPC1768/include/SPI.h index e2645b9290db..9da2a32556e7 100644 --- a/Marlin/src/HAL/LPC1768/include/SPI.h +++ b/Marlin/src/HAL/LPC1768/include/SPI.h @@ -61,7 +61,9 @@ class SPISettings { public: - SPISettings(uint32_t speed, int, int) : spi_speed(speed) {}; + SPISettings(uint32_t spiRate, int inBitOrder, int inDataMode) { + init_AlwaysInline(spiRate2Clock(spiRate), inBitOrder, inDataMode, DATA_SIZE_8BIT); + } SPISettings(uint32_t inClock, uint8_t inBitOrder, uint8_t inDataMode, uint32_t inDataSize) { if (__builtin_constant_p(inClock)) init_AlwaysInline(inClock, inBitOrder, inDataMode, inDataSize); @@ -72,7 +74,19 @@ class SPISettings { init_AlwaysInline(4000000, MSBFIRST, SPI_MODE0, DATA_SIZE_8BIT); } - uint32_t spiRate() const { return spi_speed; } + //uint32_t spiRate() const { return spi_speed; } + + static inline uint32_t spiRate2Clock(uint32_t spiRate) { + uint32_t Marlin_speed[7]; // CPSR is always 2 + Marlin_speed[0] = 8333333; //(SCR: 2) desired: 8,000,000 actual: 8,333,333 +4.2% SPI_FULL_SPEED + Marlin_speed[1] = 4166667; //(SCR: 5) desired: 4,000,000 actual: 4,166,667 +4.2% SPI_HALF_SPEED + Marlin_speed[2] = 2083333; //(SCR: 11) desired: 2,000,000 actual: 2,083,333 +4.2% SPI_QUARTER_SPEED + Marlin_speed[3] = 1000000; //(SCR: 24) desired: 1,000,000 actual: 1,000,000 SPI_EIGHTH_SPEED + Marlin_speed[4] = 500000; //(SCR: 49) desired: 500,000 actual: 500,000 SPI_SPEED_5 + Marlin_speed[5] = 250000; //(SCR: 99) desired: 250,000 actual: 250,000 SPI_SPEED_6 + Marlin_speed[6] = 125000; //(SCR:199) desired: 125,000 actual: 125,000 Default from HAL.h + return Marlin_speed[spiRate > 6 ? 6 : spiRate]; + } private: void init_MightInline(uint32_t inClock, uint8_t inBitOrder, uint8_t inDataMode, uint32_t inDataSize) { @@ -85,7 +99,7 @@ class SPISettings { dataSize = inDataSize; } - uint32_t spi_speed; + //uint32_t spi_speed; uint32_t clock; uint32_t dataSize; //uint32_t clockDivider; @@ -122,7 +136,7 @@ class SPIClass { void end(); void beginTransaction(const SPISettings&); - void endTransaction() {}; + void endTransaction() {} // Transfer using 1 "Data Size" uint8_t transfer(uint16_t data); diff --git a/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp index c72e5f0eac44..5f96630043c1 100644 --- a/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp +++ b/Marlin/src/HAL/LPC1768/tft/xpt2046.cpp @@ -72,7 +72,6 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) { if (!isTouched()) return false; *x = getRawData(XPT2046_X); *y = getRawData(XPT2046_Y); - SERIAL_ECHOLNPAIR("X: ", *x, ", Y: ", *y); return isTouched(); } diff --git a/Marlin/src/HAL/STM32/MarlinSerial.cpp b/Marlin/src/HAL/STM32/MarlinSerial.cpp index 8d99ab78558e..2d799ea54db0 100644 --- a/Marlin/src/HAL/STM32/MarlinSerial.cpp +++ b/Marlin/src/HAL/STM32/MarlinSerial.cpp @@ -55,10 +55,8 @@ void MarlinSerial::begin(unsigned long baud, uint8_t config) { HardwareSerial::begin(baud, config); - // replace the IRQ callback with the one we have defined - #if ENABLED(EMERGENCY_PARSER) - _serial.rx_callback = _rx_callback; - #endif + // Replace the IRQ callback with the one we have defined + TERN_(EMERGENCY_PARSER, _serial.rx_callback = _rx_callback); } // This function is Copyright (c) 2006 Nicholas Zambetti. diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp index f965bc99cf06..9a48e901f42d 100644 --- a/Marlin/src/HAL/STM32F1/MarlinSerial.cpp +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.cpp @@ -20,6 +20,8 @@ * */ +#ifdef __STM32F1__ + #include "../../inc/MarlinConfigPre.h" #include "MarlinSerial.h" #include @@ -27,28 +29,43 @@ // 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 + /* 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. + */ + uint32_t srflags = regs->SR, cr1its = regs->CR1; + + if ((cr1its & USART_CR1_RXNEIE) && (srflags & USART_SR_RXNE)) { + if (srflags & USART_SR_FE || srflags & USART_SR_PE ) { + // framing error or parity error + regs->DR; // Read and throw away the data, which also clears FE and PE + } + else { + 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 + } + } + else if (srflags & USART_SR_ORE) { + // overrun and empty data, just do a dummy read to clear ORE + // and prevent a raise condition where a continous interrupt stream (due to ORE set) occurs + // (see chapter "Overrun error" ) in STM32 reference manual + regs->DR; } + // TXE signifies readiness to send a byte to DR. - if ((regs->CR1 & USART_CR1_TXEIE) && (regs->SR & USART_SR_TXE)) { + if ((cr1its & USART_CR1_TXEIE) && (srflags & USART_SR_TXE)) { if (!rb_is_empty(wb)) regs->DR=rb_remove(wb); else @@ -91,3 +108,5 @@ static inline __always_inline void my_usart_irq(ring_buffer *rb, ring_buffer *wb #if SERIAL_PORT == 5 || SERIAL_PORT_2 == 5 || DGUS_SERIAL_PORT == 5 DEFINE_HWSERIAL_UART_MARLIN(MSerial5, 5); #endif + +#endif // __STM32F1__ diff --git a/Marlin/src/HAL/STM32F1/MarlinSerial.h b/Marlin/src/HAL/STM32F1/MarlinSerial.h index 4e8a47d2f909..eb0059bfbcae 100644 --- a/Marlin/src/HAL/STM32F1/MarlinSerial.h +++ b/Marlin/src/HAL/STM32F1/MarlinSerial.h @@ -22,6 +22,7 @@ #pragma once #include +#include #include #include "../../inc/MarlinConfigPre.h" @@ -29,6 +30,8 @@ #include "../../feature/e_parser.h" #endif +#define UART_IRQ_PRIO 1 + class MarlinSerial : public HardwareSerial { public: MarlinSerial(struct usart_dev *usart_device, uint8 tx_pin, uint8 rx_pin) : @@ -38,6 +41,18 @@ class MarlinSerial : public HardwareSerial { #endif { } + #ifdef UART_IRQ_PRIO + // shadow the parent methods to set irq priority after the begin + void begin(uint32 baud) { + MarlinSerial::begin(baud, SERIAL_8N1); + } + + void begin(uint32 baud, uint8_t config) { + HardwareSerial::begin(baud, config); + nvic_irq_set_priority(c_dev()->irq_num, UART_IRQ_PRIO); + } + #endif + #if ENABLED(EMERGENCY_PARSER) EmergencyParser::State emergency_state; #endif diff --git a/Marlin/src/HAL/STM32F1/sdio.cpp b/Marlin/src/HAL/STM32F1/sdio.cpp index 0e8a74581015..0e9a3b2d0450 100644 --- a/Marlin/src/HAL/STM32F1/sdio.cpp +++ b/Marlin/src/HAL/STM32F1/sdio.cpp @@ -108,7 +108,7 @@ bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) { SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); return false; - } + } //Wait for DMA transaction to complete while ((DMA2_BASE->ISR & (DMA_ISR_TEIF4|DMA_ISR_TCIF4)) == 0 ) { /* wait */ } diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.cpp b/Marlin/src/HAL/TEENSY40_41/HAL.cpp new file mode 100644 index 000000000000..f5d37f5fc44d --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/HAL.cpp @@ -0,0 +1,167 @@ +/** + * 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 . + * + */ + +/** + * Description: HAL for Teensy40 (IMXRT1062) + */ + +#ifdef __IMXRT1062__ + +#include "HAL.h" +#include "../shared/Delay.h" +#include "timers.h" + +#include + +uint16_t HAL_adc_result, HAL_adc_select; + +static const uint8_t pin2sc1a[] = { + 0x07, // 0/A0 AD_B1_02 + 0x08, // 1/A1 AD_B1_03 + 0x0C, // 2/A2 AD_B1_07 + 0x0B, // 3/A3 AD_B1_06 + 0x06, // 4/A4 AD_B1_01 + 0x05, // 5/A5 AD_B1_00 + 0x0F, // 6/A6 AD_B1_10 + 0x00, // 7/A7 AD_B1_11 + 0x0D, // 8/A8 AD_B1_08 + 0x0E, // 9/A9 AD_B1_09 + 0x01, // 24/A10 AD_B0_12 + 0x02, // 25/A11 AD_B0_13 + 0x83, // 26/A12 AD_B1_14 - only on ADC2, 3 + 0x84, // 27/A13 AD_B1_15 - only on ADC2, 4 + 0x07, // 14/A0 AD_B1_02 + 0x08, // 15/A1 AD_B1_03 + 0x0C, // 16/A2 AD_B1_07 + 0x0B, // 17/A3 AD_B1_06 + 0x06, // 18/A4 AD_B1_01 + 0x05, // 19/A5 AD_B1_00 + 0x0F, // 20/A6 AD_B1_10 + 0x00, // 21/A7 AD_B1_11 + 0x0D, // 22/A8 AD_B1_08 + 0x0E, // 23/A9 AD_B1_09 + 0x01, // 24/A10 AD_B0_12 + 0x02, // 25/A11 AD_B0_13 + 0x83, // 26/A12 AD_B1_14 - only on ADC2, 3 + 0x84, // 27/A13 AD_B1_15 - only on ADC2, 4 + #ifdef ARDUINO_TEENSY41 + 0xFF, // 28 + 0xFF, // 29 + 0xFF, // 30 + 0xFF, // 31 + 0xFF, // 32 + 0xFF, // 33 + 0xFF, // 34 + 0xFF, // 35 + 0xFF, // 36 + 0xFF, // 37 + 0x81, // 38/A14 AD_B1_12 - only on ADC2, 1 + 0x82, // 39/A15 AD_B1_13 - only on ADC2, 2 + 0x09, // 40/A16 AD_B1_04 + 0x0A, // 41/A17 AD_B1_05 + #endif +}; + +/* +// disable interrupts +void cli() { noInterrupts(); } + +// enable interrupts +void sei() { interrupts(); } +*/ + +void HAL_adc_init() { + analog_init(); + while (ADC1_GC & ADC_GC_CAL) ; + while (ADC2_GC & ADC_GC_CAL) ; +} + +void HAL_clear_reset_source() { + uint32_t reset_source = SRC_SRSR; + SRC_SRSR = reset_source; + } + +uint8_t HAL_get_reset_source() { + switch (SRC_SRSR & 0xFF) { + case 1: return RST_POWER_ON; break; + case 2: return RST_SOFTWARE; break; + case 4: return RST_EXTERNAL; break; + // case 8: return RST_BROWN_OUT; break; + case 16: return RST_WATCHDOG; break; + case 64: return RST_JTAG; break; + // case 128: return RST_OVERTEMP; break; + } + return 0; +} + +#define __bss_end _ebss + +extern "C" { + extern char __bss_end; + extern char __heap_start; + extern void* __brkval; + + // Doesn't work on Teensy 4.x + uint32_t freeMemory() { + uint32_t free_memory; + if ((uint32_t)__brkval == 0) + free_memory = ((uint32_t)&free_memory) - ((uint32_t)&__bss_end); + else + free_memory = ((uint32_t)&free_memory) - ((uint32_t)__brkval); + return free_memory; + } +} + +void HAL_adc_start_conversion(const uint8_t adc_pin) { + const uint16_t pin = pin2sc1a[adc_pin]; + if (pin == 0xFF) { + HAL_adc_select = -1; // Digital only + } + else if (pin & 0x80) { + HAL_adc_select = 1; + ADC2_HC0 = pin & 0x7F; + } + else { + HAL_adc_select = 0; + ADC1_HC0 = pin; + } +} + +uint16_t HAL_adc_get_result() { + switch (HAL_adc_select) { + case 0: + while (!(ADC1_HS & ADC_HS_COCO0)) ; // wait + return ADC1_R0; + case 1: + while (!(ADC2_HS & ADC_HS_COCO0)) ; // wait + return ADC2_R0; + } + return 0; +} + +bool is_output(uint8_t pin) { + const struct digital_pin_bitband_and_config_table_struct *p; + p = digital_pin_to_info_PGM + pin; + return (*(p->reg + 1) & p->mask); +} + +#endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/HAL.h b/Marlin/src/HAL/TEENSY40_41/HAL.h new file mode 100644 index 000000000000..0626d4ee9cda --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/HAL.h @@ -0,0 +1,180 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * + * 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 + +/** + * Description: HAL for Teensy 4.0 and Teensy 4.1 + */ + +#define CPU_32_BIT + +#include "../shared/Marduino.h" +#include "../shared/math_32bit.h" +#include "../shared/HAL_SPI.h" + +#include "fastio.h" +#include "watchdog.h" + +#include +#include + +//#define ST7920_DELAY_1 DELAY_NS(600) +//#define ST7920_DELAY_2 DELAY_NS(750) +//#define ST7920_DELAY_3 DELAY_NS(750) + +// ------------------------ +// Defines +// ------------------------ + +#ifdef __IMXRT1062__ + #define IS_32BIT_TEENSY 1 + #define IS_TEENSY41 1 +#endif + +#if SERIAL_PORT == -1 + #define MYSERIAL0 SerialUSB +#elif SERIAL_PORT == 0 + #define MYSERIAL0 Serial +#elif SERIAL_PORT == 1 + #define MYSERIAL0 Serial1 +#elif SERIAL_PORT == 2 + #define MYSERIAL0 Serial2 +#elif SERIAL_PORT == 3 + #define MYSERIAL0 Serial3 +#elif SERIAL_PORT == 4 + #define MYSERIAL0 Serial4 +#elif SERIAL_PORT == 5 + #define MYSERIAL0 Serial5 +#elif SERIAL_PORT == 6 + #define MYSERIAL0 Serial6 +#elif SERIAL_PORT == 7 + #define MYSERIAL0 Serial7 +#elif SERIAL_PORT == 8 + #define MYSERIAL0 Serial8 +#else + #error "The required SERIAL_PORT must be from -1 to 8. Please update your configuration." +#endif + +#ifdef SERIAL_PORT_2 + #if SERIAL_PORT_2 == SERIAL_PORT + #error "SERIAL_PORT_2 must be different from SERIAL_PORT. Please update your configuration." + #elif SERIAL_PORT_2 == -1 + #define MYSERIAL1 usbSerial + #elif SERIAL_PORT_2 == 0 + #define MYSERIAL1 Serial + #elif SERIAL_PORT_2 == 1 + #define MYSERIAL1 Serial1 + #elif SERIAL_PORT_2 == 2 + #define MYSERIAL1 Serial2 + #elif SERIAL_PORT_2 == 3 + #define MYSERIAL1 Serial3 + #elif SERIAL_PORT_2 == 4 + #define MYSERIAL1 Serial4 + #elif SERIAL_PORT_2 == 5 + #define MYSERIAL1 Serial5 + #elif SERIAL_PORT_2 == 6 + #define MYSERIAL1 Serial6 + #elif SERIAL_PORT_2 == 7 + #define MYSERIAL1 Serial7 + #elif SERIAL_PORT_2 == 8 + #define MYSERIAL1 Serial8 + #else + #error "SERIAL_PORT_2 must be from -1 to 8. Please update your configuration." + #endif + #define NUM_SERIAL 2 +#else + #define NUM_SERIAL 1 +#endif + +#define HAL_SERVO_LIB libServo + +typedef int8_t pin_t; + +#ifndef analogInputToDigitalPin + #define analogInputToDigitalPin(p) ((p < 12u) ? (p) + 54u : -1) +#endif + +#define CRITICAL_SECTION_START() uint32_t primask = __get_primask(); __disable_irq() +#define CRITICAL_SECTION_END() if (!primask) __enable_irq() +#define ISRS_ENABLED() (!__get_primask()) +#define ENABLE_ISRS() __enable_irq() +#define DISABLE_ISRS() __disable_irq() + +#undef sq +#define sq(x) ((x)*(x)) + +#ifndef strncpy_P + #define strncpy_P(dest, src, num) strncpy((dest), (src), (num)) +#endif + +// Don't place string constants in PROGMEM +#undef PSTR +#define PSTR(str) ({static const char *data = (str); &data[0];}) + +// Fix bug in pgm_read_ptr +#undef pgm_read_ptr +#define pgm_read_ptr(addr) (*((void**)(addr))) +// Add type-checking to pgm_read_word +#undef pgm_read_word +#define pgm_read_word(addr) (*((uint16_t*)(addr))) + +// Enable hooks into idle and setup for HAL +#define HAL_IDLETASK 1 +FORCE_INLINE void HAL_idletask() {} +FORCE_INLINE void HAL_init() {} + +// Clear reset reason +void HAL_clear_reset_source(); + +// Reset reason +uint8_t HAL_get_reset_source(); + +FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); } + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +extern "C" { + uint32_t freeMemory(); +} +#pragma GCC diagnostic pop + +// ADC + +void HAL_adc_init(); + +#define HAL_ADC_VREF 3.3 +#define HAL_ADC_RESOLUTION 10 +#define HAL_ADC_FILTERED // turn off ADC oversampling +#define HAL_START_ADC(pin) HAL_adc_start_conversion(pin) +#define HAL_READ_ADC() HAL_adc_get_result() +#define HAL_ADC_READY() true + +#define HAL_ANALOG_SELECT(pin) + +void HAL_adc_start_conversion(const uint8_t adc_pin); +uint16_t HAL_adc_get_result(); + +#define GET_PIN_MAP_PIN(index) index +#define GET_PIN_MAP_INDEX(pin) pin +#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval) + +bool is_output(uint8_t pin); diff --git a/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp b/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp new file mode 100644 index 000000000000..9ccbb3a1f45b --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/HAL_SPI.cpp @@ -0,0 +1,138 @@ +/** + * 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 . + * + */ +#ifdef __IMXRT1062__ + +#include "HAL.h" +#include +#include +#include "spi_pins.h" +#include "../../core/macros.h" + +static SPISettings spiConfig; + +// ------------------------ +// Public functions +// ------------------------ + +#if ENABLED(SOFTWARE_SPI) + // ------------------------ + // Software SPI + // ------------------------ + #error "Software SPI not supported for Teensy 4. Use Hardware SPI." +#else + +// ------------------------ +// Hardware SPI +// ------------------------ + +void spiBegin() { + #ifndef SS_PIN + #error "SS_PIN is not defined!" + #endif + + OUT_WRITE(SS_PIN, HIGH); + + //SET_OUTPUT(SCK_PIN); + //SET_INPUT(MISO_PIN); + //SET_OUTPUT(MOSI_PIN); + + #if 0 && DISABLED(SOFTWARE_SPI) + // set SS high - may be chip select for another SPI device + #if SET_SPI_SS_HIGH + WRITE(SS_PIN, HIGH); + #endif + // set a default rate + spiInit(SPI_HALF_SPEED); // 1 + #endif +} + +void spiInit(uint8_t spiRate) { + // Use Marlin data-rates + uint32_t clock; + switch (spiRate) { + case SPI_FULL_SPEED: clock = 10000000; break; + case SPI_HALF_SPEED: clock = 5000000; break; + case SPI_QUARTER_SPEED: clock = 2500000; break; + case SPI_EIGHTH_SPEED: clock = 1250000; break; + case SPI_SPEED_5: clock = 625000; break; + case SPI_SPEED_6: clock = 312500; break; + default: + clock = 4000000; // Default from the SPI libarary + } + spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0); + SPI.begin(); +} + +uint8_t spiRec() { + SPI.beginTransaction(spiConfig); + uint8_t returnByte = SPI.transfer(0xFF); + SPI.endTransaction(); + return returnByte; + //SPDR = 0xFF; + //while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } + //return SPDR; +} + +void spiRead(uint8_t* buf, uint16_t nbyte) { + SPI.beginTransaction(spiConfig); + SPI.transfer(buf, nbyte); + SPI.endTransaction(); + //if (nbyte-- == 0) return; + // SPDR = 0xFF; + //for (uint16_t i = 0; i < nbyte; i++) { + // while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } + // buf[i] = SPDR; + // SPDR = 0xFF; + //} + //while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } + //buf[nbyte] = SPDR; +} + +void spiSend(uint8_t b) { + SPI.beginTransaction(spiConfig); + SPI.transfer(b); + SPI.endTransaction(); + //SPDR = b; + //while (!TEST(SPSR, SPIF)) { /* Intentionally left empty */ } +} + +void spiSendBlock(uint8_t token, const uint8_t* buf) { + SPI.beginTransaction(spiConfig); + SPDR = token; + for (uint16_t i = 0; i < 512; i += 2) { + while (!TEST(SPSR, SPIF)) { /* nada */ }; + SPDR = buf[i]; + while (!TEST(SPSR, SPIF)) { /* nada */ }; + SPDR = buf[i + 1]; + } + while (!TEST(SPSR, SPIF)) { /* nada */ }; + SPI.endTransaction(); +} + +// Begin SPI transaction, set clock, bit order, data mode +void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) { + spiConfig = SPISettings(spiClock, bitOrder, dataMode); + SPI.beginTransaction(spiConfig); +} + +#endif // SOFTWARE_SPI +#endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/Servo.cpp b/Marlin/src/HAL/TEENSY40_41/Servo.cpp new file mode 100644 index 000000000000..e3d0d034499d --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/Servo.cpp @@ -0,0 +1,57 @@ +/** + * 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 . + * + */ +#ifdef __IMXRT1062__ + +#include "../../inc/MarlinConfig.h" + +#if HAS_SERVOS + +#include "Servo.h" + +int8_t libServo::attach(const int inPin) { + if (inPin > 0) servoPin = inPin; + return super::attach(servoPin); +} + +int8_t libServo::attach(const int inPin, const int inMin, const int inMax) { + if (inPin > 0) servoPin = inPin; + return super::attach(servoPin, inMin, inMax); +} + +void libServo::move(const int value) { + constexpr uint16_t servo_delay[] = SERVO_DELAY; + static_assert(COUNT(servo_delay) == NUM_SERVOS, "SERVO_DELAY must be an array NUM_SERVOS long."); + if (attach(0) >= 0) { + write(value); + safe_delay(servo_delay[servoIndex]); + TERN_(DEACTIVATE_SERVOS_AFTER_MOVE, detach()); + } +} + +void libServo::detach() { + // PWMServo library does not have detach() function + //super::detach(); +} + +#endif // HAS_SERVOS + +#endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/Servo.h b/Marlin/src/HAL/TEENSY40_41/Servo.h new file mode 100644 index 000000000000..ce910ed8a854 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/Servo.h @@ -0,0 +1,39 @@ +/** + * 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 + +// Inherit and expand on core Servo library +class libServo : public PWMServo { + public: + int8_t attach(const int pin); + int8_t attach(const int pin, const int min, const int max); + void move(const int value); + void detach(void); + private: + typedef PWMServo super; + uint8_t servoPin; + uint16_t min_ticks; + uint16_t max_ticks; + uint8_t servoIndex; // Index into the channel data for this servo +}; diff --git a/Marlin/src/HAL/TEENSY40_41/eeprom.cpp b/Marlin/src/HAL/TEENSY40_41/eeprom.cpp new file mode 100644 index 000000000000..5491e04fbcc7 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/eeprom.cpp @@ -0,0 +1,77 @@ +/** + * Marlin 3D Printer Firmware + * + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * Copyright (c) 2016 Victor Perez victor_pv@hotmail.com + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#ifdef __IMXRT1062__ + +#include "../../inc/MarlinConfig.h" + +#if USE_WIRED_EEPROM + +/** + * PersistentStore for Arduino-style EEPROM interface + * with implementations supplied by the framework. + */ + +#include "../shared/eeprom_api.h" +#include + +#ifndef MARLIN_EEPROM_SIZE + #define MARLIN_EEPROM_SIZE size_t(E2END + 1) +#endif +size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; } + +bool PersistentStore::access_start() { return true; } +bool PersistentStore::access_finish() { return true; } + +bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) { + while (size--) { + uint8_t * const p = (uint8_t * const)pos; + uint8_t v = *value; + // EEPROM has only ~100,000 write cycles, + // so only write bytes that have changed! + if (v != eeprom_read_byte(p)) { + eeprom_write_byte(p, v); + if (eeprom_read_byte(p) != v) { + SERIAL_ECHO_MSG(STR_ERR_EEPROM_WRITE); + return true; + } + } + crc16(crc, &v, 1); + pos++; + value++; + } + return false; +} + +bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) { + do { + uint8_t c = eeprom_read_byte((uint8_t*)pos); + if (writing) *value = c; + crc16(crc, &c, 1); + pos++; + value++; + } while (--size); + return false; +} + +#endif // USE_WIRED_EEPROM +#endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/endstop_interrupts.h b/Marlin/src/HAL/TEENSY40_41/endstop_interrupts.h new file mode 100644 index 000000000000..92e22efc0fe6 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/endstop_interrupts.h @@ -0,0 +1,66 @@ +/** + * 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 + +/** + * Endstop Interrupts + * + * Without endstop interrupts the endstop pins must be polled continually in + * the temperature-ISR via endstops.update(), most of the time finding no change. + * With this feature endstops.update() is called only when we know that at + * least one endstop has changed state, saving valuable CPU cycles. + * + * This feature only works when all used endstop pins can generate an 'external interrupt'. + * + * Test whether pins issue interrupts on your board by flashing 'pin_interrupt_test.ino'. + * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino) + */ + +#include "../../module/endstops.h" + +// One ISR for all EXT-Interrupts +void endstop_ISR() { endstops.update(); } + +/** + * Endstop interrupts for Due based targets. + * On Due, all pins support external interrupt capability. + */ +void setup_endstop_interrupts() { + #define _ATTACH(P) attachInterrupt(digitalPinToInterrupt(P), endstop_ISR, CHANGE) + TERN_(HAS_X_MAX, _ATTACH(X_MAX_PIN)); + TERN_(HAS_X_MIN, _ATTACH(X_MIN_PIN)); + TERN_(HAS_Y_MAX, _ATTACH(Y_MAX_PIN)); + TERN_(HAS_Y_MIN, _ATTACH(Y_MIN_PIN)); + TERN_(HAS_Z_MAX, _ATTACH(Z_MAX_PIN)); + TERN_(HAS_Z_MIN, _ATTACH(Z_MIN_PIN)); + TERN_(HAS_X2_MAX, _ATTACH(X2_MAX_PIN)); + TERN_(HAS_X2_MIN, _ATTACH(X2_MIN_PIN)); + TERN_(HAS_Y2_MAX, _ATTACH(Y2_MAX_PIN)); + TERN_(HAS_Y2_MIN, _ATTACH(Y2_MIN_PIN)); + TERN_(HAS_Z2_MAX, _ATTACH(Z2_MAX_PIN)); + TERN_(HAS_Z2_MIN, _ATTACH(Z2_MIN_PIN)); + TERN_(HAS_Z3_MAX, _ATTACH(Z3_MAX_PIN)); + TERN_(HAS_Z3_MIN, _ATTACH(Z3_MIN_PIN)); + TERN_(HAS_Z4_MAX, _ATTACH(Z4_MAX_PIN)); + TERN_(HAS_Z4_MIN, _ATTACH(Z4_MIN_PIN)); + TERN_(HAS_Z_MIN_PROBE_PIN, _ATTACH(Z_MIN_PROBE_PIN)); +} diff --git a/Marlin/src/HAL/TEENSY40_41/fastio.h b/Marlin/src/HAL/TEENSY40_41/fastio.h new file mode 100644 index 000000000000..19b8114509b7 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/fastio.h @@ -0,0 +1,58 @@ +/** + * 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 + * Copyright (c) 2017 Victor Perez + * + * 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 + +/** + * Fast I/O interfaces for Teensy 4 + * These use GPIO functions instead of Direct Port Manipulation, as on AVR. + */ + +#ifndef PWM + #define PWM OUTPUT +#endif + +#define READ(IO) digitalRead(IO) +#define WRITE(IO,V) digitalWrite(IO,V) + +#define _GET_MODE(IO) !is_output(IO) +#define _SET_MODE(IO,M) pinMode(IO, M) +#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */ + +#define OUT_WRITE(IO,V) do{ _SET_OUTPUT(IO); WRITE(IO,V); }while(0) + +#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */ +#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */ +#define SET_INPUT_PULLDOWN(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */ +#define SET_OUTPUT(IO) OUT_WRITE(IO, LOW) +#define SET_PWM(IO) _SET_MODE(IO, PWM) + +#define TOGGLE(IO) OUT_WRITE(IO, !READ(IO)) + +#define IS_INPUT(IO) !is_output(IO) +#define IS_OUTPUT(IO) is_output(IO) + +#define PWM_PIN(P) digitalPinHasPWM(P) + +// digitalRead/Write wrappers +#define extDigitalRead(IO) digitalRead(IO) +#define extDigitalWrite(IO,V) digitalWrite(IO,V) diff --git a/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_LCD.h b/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_LCD.h new file mode 100644 index 000000000000..6a8540927b97 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_LCD.h @@ -0,0 +1,26 @@ +/** + * 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 + +#if HAS_SPI_TFT || HAS_FSMC_TFT + #error "Sorry! TFT displays are not available for HAL/TEENSY40_41." +#endif diff --git a/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_adv.h b/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_adv.h new file mode 100644 index 000000000000..5f1c4b16019d --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_adv.h @@ -0,0 +1,22 @@ +/** + * 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 diff --git a/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_post.h b/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_post.h new file mode 100644 index 000000000000..998f1dcc0d73 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/inc/Conditionals_post.h @@ -0,0 +1,26 @@ +/** + * 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 + +#if USE_FALLBACK_EEPROM + #define USE_WIRED_EEPROM 1 +#endif diff --git a/Marlin/src/HAL/TEENSY40_41/inc/SanityCheck.h b/Marlin/src/HAL/TEENSY40_41/inc/SanityCheck.h new file mode 100644 index 000000000000..fbfe7b0fc3d4 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/inc/SanityCheck.h @@ -0,0 +1,38 @@ +/** + * 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 + +/** + * Test TEENSY41 specific configuration values for errors at compile-time. + */ + +#if ENABLED(EMERGENCY_PARSER) + #error "EMERGENCY_PARSER is not yet implemented for Teensy 4.0/4.1. 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 Teensy 4.0/4.1." +#endif + +#if HAS_TMC_SW_SERIAL + #error "TMC220x Software Serial is not supported on this platform." +#endif diff --git a/Marlin/src/HAL/TEENSY40_41/pinsDebug.h b/Marlin/src/HAL/TEENSY40_41/pinsDebug.h new file mode 100644 index 000000000000..890f66865011 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/pinsDebug.h @@ -0,0 +1,146 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 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 + +#warning "PINS_DEBUGGING is not fully supported for Teensy 4.0 / 4.1 so 'M43' may cause hangs." + +#define NUMBER_PINS_TOTAL NUM_DIGITAL_PINS + +#define digitalRead_mod(p) extDigitalRead(p) // AVR digitalRead disabled PWM before it read the pin +#define PRINT_PORT(p) +#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0) +#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0) +#define GET_ARRAY_PIN(p) pin_array[p].pin +#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital +#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL ? 1 : 0) +#define DIGITAL_PIN_TO_ANALOG_PIN(p) int(p - analogInputToDigitalPin(0)) +#define IS_ANALOG(P) ((P) >= analogInputToDigitalPin(0) && (P) <= analogInputToDigitalPin(13)) || ((P) >= analogInputToDigitalPin(14) && (P) <= analogInputToDigitalPin(17)) +#define pwm_status(pin) HAL_pwm_status(pin) +#define GET_PINMODE(PIN) (VALID_PIN(pin) && IS_OUTPUT(pin)) +#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin + +struct pwm_pin_info_struct { + uint8_t type; // 0=no pwm, 1=flexpwm, 2=quad + uint8_t module; // 0-3, 0-3 + uint8_t channel; // 0=X, 1=A, 2=B + uint8_t muxval; // +}; + +#define M(a, b) ((((a) - 1) << 4) | (b)) + +const struct pwm_pin_info_struct pwm_pin_info[] = { + {1, M(1, 1), 0, 4}, // FlexPWM1_1_X 0 // AD_B0_03 + {1, M(1, 0), 0, 4}, // FlexPWM1_0_X 1 // AD_B0_02 + {1, M(4, 2), 1, 1}, // FlexPWM4_2_A 2 // EMC_04 + {1, M(4, 2), 2, 1}, // FlexPWM4_2_B 3 // EMC_05 + {1, M(2, 0), 1, 1}, // FlexPWM2_0_A 4 // EMC_06 + {1, M(2, 1), 1, 1}, // FlexPWM2_1_A 5 // EMC_08 + {1, M(2, 2), 1, 2}, // FlexPWM2_2_A 6 // B0_10 + {1, M(1, 3), 2, 6}, // FlexPWM1_3_B 7 // B1_01 + {1, M(1, 3), 1, 6}, // FlexPWM1_3_A 8 // B1_00 + {1, M(2, 2), 2, 2}, // FlexPWM2_2_B 9 // B0_11 + {2, M(1, 0), 0, 1}, // QuadTimer1_0 10 // B0_00 + {2, M(1, 2), 0, 1}, // QuadTimer1_2 11 // B0_02 + {2, M(1, 1), 0, 1}, // QuadTimer1_1 12 // B0_01 + {2, M(2, 0), 0, 1}, // QuadTimer2_0 13 // B0_03 + {2, M(3, 2), 0, 1}, // QuadTimer3_2 14 // AD_B1_02 + {2, M(3, 3), 0, 1}, // QuadTimer3_3 15 // AD_B1_03 + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {2, M(3, 1), 0, 1}, // QuadTimer3_1 18 // AD_B1_01 + {2, M(3, 0), 0, 1}, // QuadTimer3_0 19 // AD_B1_00 + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {1, M(4, 0), 1, 1}, // FlexPWM4_0_A 22 // AD_B1_08 + {1, M(4, 1), 1, 1}, // FlexPWM4_1_A 23 // AD_B1_09 + {1, M(1, 2), 0, 4}, // FlexPWM1_2_X 24 // AD_B0_12 + {1, M(1, 3), 0, 4}, // FlexPWM1_3_X 25 // AD_B0_13 + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {1, M(3, 1), 2, 1}, // FlexPWM3_1_B 28 // EMC_32 + {1, M(3, 1), 1, 1}, // FlexPWM3_1_A 29 // EMC_31 + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {1, M(2, 0), 2, 1}, // FlexPWM2_0_B 33 // EMC_07 + #ifdef ARDUINO_TEENSY40 + {1, M(1, 1), 2, 1}, // FlexPWM1_1_B 34 // SD_B0_03 + {1, M(1, 1), 1, 1}, // FlexPWM1_1_A 35 // SD_B0_02 + {1, M(1, 0), 2, 1}, // FlexPWM1_0_B 36 // SD_B0_01 + {1, M(1, 0), 1, 1}, // FlexPWM1_0_A 37 // SD_B0_00 + {1, M(1, 2), 2, 1}, // FlexPWM1_2_B 38 // SD_B0_05 + {1, M(1, 2), 1, 1}, // FlexPWM1_2_A 39 // SD_B0_04 + #endif + #ifdef ARDUINO_TEENSY41 + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {1, M(2, 3), 1, 6}, // FlexPWM2_3_A 36 // B1_00 + {1, M(2, 3), 2, 6}, // FlexPWM2_3_B 37 // B1_01 + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {0, M(1, 0), 0, 0}, + {1, M(1, 1), 2, 1}, // FlexPWM1_1_B 42 // SD_B0_03 + {1, M(1, 1), 1, 1}, // FlexPWM1_1_A 43 // SD_B0_02 + {1, M(1, 0), 2, 1}, // FlexPWM1_0_B 44 // SD_B0_01 + {1, M(1, 0), 1, 1}, // FlexPWM1_0_A 45 // SD_B0_00 + {1, M(1, 2), 2, 1}, // FlexPWM1_2_B 46 // SD_B0_05 + {1, M(1, 2), 1, 1}, // FlexPWM1_2_A 47 // SD_B0_04 + {0, M(1, 0), 0, 0}, // duplicate FlexPWM1_0_B + {0, M(1, 0), 0, 0}, // duplicate FlexPWM1_2_A + {0, M(1, 0), 0, 0}, // duplicate FlexPWM1_2_B + {1, M(3, 3), 2, 1}, // FlexPWM3_3_B 51 // EMC_22 + {0, M(1, 0), 0, 0}, // duplicate FlexPWM1_1_B + {0, M(1, 0), 0, 0}, // duplicate FlexPWM1_1_A + {1, M(3, 0), 1, 1}, // FlexPWM3_0_A 53 // EMC_29 + #endif +}; + +void HAL_print_analog_pin(char buffer[], int8_t pin) { + if (pin <= 23) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 14)); + else if (pin <= 41) sprintf_P(buffer, PSTR("(A%2d) "), int(pin - 24)); +} + +void HAL_analog_pin_state(char buffer[], int8_t pin) { + if (pin <= 23) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 14)); + else if (pin <= 41) sprintf_P(buffer, PSTR("Analog in =% 5d"), analogRead(pin - 24)); +} + +#define PWM_PRINT(V) do{ sprintf_P(buffer, PSTR("PWM: %4d"), V); SERIAL_ECHO(buffer); }while(0) + +/** + * Print a pin's PWM status. + * Return true if it's currently a PWM pin. + */ +bool HAL_pwm_status(int8_t pin) { + char buffer[20]; // for the sprintf statements + const struct pwm_pin_info_struct *info; + + if (pin >= CORE_NUM_DIGITAL) return 0; + info = pwm_pin_info + pin; + + if (info->type == 0) return 0; + + /* TODO decode pwm value from timers */ + // for now just indicate if output is set as pwm + PWM_PRINT(*(portConfigRegister(pin)) == info->muxval); + return (*(portConfigRegister(pin)) == info->muxval); +} + +static void pwm_details(uint8_t pin) { /* TODO */ } diff --git a/Marlin/src/HAL/TEENSY40_41/spi_pins.h b/Marlin/src/HAL/TEENSY40_41/spi_pins.h new file mode 100644 index 000000000000..276d4f456a7f --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/spi_pins.h @@ -0,0 +1,27 @@ +/** + * 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 + +#define SCK_PIN 13 +#define MISO_PIN 12 +#define MOSI_PIN 11 +#define SS_PIN 20 // SDSS // A.28, A.29, B.21, C.26, C.29 diff --git a/Marlin/src/HAL/TEENSY40_41/timers.cpp b/Marlin/src/HAL/TEENSY40_41/timers.cpp new file mode 100644 index 000000000000..15f5185a6ba0 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/timers.cpp @@ -0,0 +1,114 @@ +/** + * 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 . + * + */ + +/** + * Teensy4.0/4.1 (__IMXRT1062__) + */ + +#ifdef __IMXRT1062__ + +#include "../../inc/MarlinConfig.h" + +void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) { + switch (timer_num) { + case 0: + CCM_CSCMR1 &= ~CCM_CSCMR1_PERCLK_CLK_SEL; // turn off 24mhz mode + CCM_CCGR1 |= CCM_CCGR1_GPT1_BUS(CCM_CCGR_ON); + + GPT1_CR = 0; // disable timer + GPT1_SR = 0x3F; // clear all prior status + GPT1_PR = GPT1_TIMER_PRESCALE - 1; + GPT1_CR |= GPT_CR_CLKSRC(1); //clock selection #1 (peripheral clock = 150 MHz) + GPT1_CR |= GPT_CR_ENMOD; //reset count to zero before enabling + GPT1_CR |= GPT_CR_OM1(1); // toggle mode + GPT1_OCR1 = (GPT1_TIMER_RATE / frequency) -1; // Initial compare value + GPT1_IR = GPT_IR_OF1IE; // Compare3 value + GPT1_CR |= GPT_CR_EN; //enable GPT2 counting at 150 MHz + + OUT_WRITE(15, HIGH); + attachInterruptVector(IRQ_GPT1, &stepTC_Handler); + NVIC_SET_PRIORITY(IRQ_GPT1, 16); + break; + case 1: + CCM_CSCMR1 &= ~CCM_CSCMR1_PERCLK_CLK_SEL; // turn off 24mhz mode + CCM_CCGR0 |= CCM_CCGR0_GPT2_BUS(CCM_CCGR_ON); + + GPT2_CR = 0; // disable timer + GPT2_SR = 0x3F; // clear all prior status + GPT2_PR = GPT2_TIMER_PRESCALE - 1; + GPT2_CR |= GPT_CR_CLKSRC(1); //clock selection #1 (peripheral clock = 150 MHz) + GPT2_CR |= GPT_CR_ENMOD; //reset count to zero before enabling + GPT2_CR |= GPT_CR_OM1(1); // toggle mode + GPT2_OCR1 = (GPT2_TIMER_RATE / frequency) -1; // Initial compare value + GPT2_IR = GPT_IR_OF1IE; // Compare3 value + GPT2_CR |= GPT_CR_EN; //enable GPT2 counting at 150 MHz + + OUT_WRITE(14, HIGH); + attachInterruptVector(IRQ_GPT2, &tempTC_Handler); + NVIC_SET_PRIORITY(IRQ_GPT2, 32); + break; + } +} + +void HAL_timer_enable_interrupt(const uint8_t timer_num) { + switch (timer_num) { + case 0: + NVIC_ENABLE_IRQ(IRQ_GPT1); + break; + case 1: + NVIC_ENABLE_IRQ(IRQ_GPT2); + break; + } +} + +void HAL_timer_disable_interrupt(const uint8_t timer_num) { + switch (timer_num) { + case 0: NVIC_DISABLE_IRQ(IRQ_GPT1); break; + case 1: NVIC_DISABLE_IRQ(IRQ_GPT2); break; + } + + // We NEED memory barriers to ensure Interrupts are actually disabled! + // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the ) + asm volatile("dsb"); +} + +bool HAL_timer_interrupt_enabled(const uint8_t timer_num) { + switch (timer_num) { + case 0: return (NVIC_IS_ENABLED(IRQ_GPT1)); + case 1: return (NVIC_IS_ENABLED(IRQ_GPT2)); + } + return false; +} + +void HAL_timer_isr_prologue(const uint8_t timer_num) { + switch (timer_num) { + case 0: + GPT1_SR = GPT_IR_OF1IE; // clear OF3 bit + break; + case 1: + GPT2_SR = GPT_IR_OF1IE; // clear OF3 bit + break; + } + asm volatile("dsb"); +} + +#endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/timers.h b/Marlin/src/HAL/TEENSY40_41/timers.h new file mode 100644 index 000000000000..9c4bf8c274cc --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/timers.h @@ -0,0 +1,119 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (c) 2015-2016 Nico Tonnhofer wurstnase.reprap@gmail.com + * + * 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 + +/** + * Description: HAL for + * Teensy4.0/4.1 (__IMXRT1062__) + */ + +#include + +// ------------------------ +// Defines +// ------------------------ + +#define FORCE_INLINE __attribute__((always_inline)) inline + +typedef uint32_t hal_timer_t; +#define HAL_TIMER_TYPE_MAX 0xFFFFFFFE + +#define GPT_TIMER_RATE F_BUS_ACTUAL // 150MHz + +#define GPT1_TIMER_PRESCALE 2 +#define GPT2_TIMER_PRESCALE 10 + +#define GPT1_TIMER_RATE (GPT_TIMER_RATE / GPT1_TIMER_PRESCALE) // 75MHz +#define GPT2_TIMER_RATE (GPT_TIMER_RATE / GPT2_TIMER_PRESCALE) // 15MHz + +#ifndef STEP_TIMER_NUM + #define STEP_TIMER_NUM 0 // Timer Index for Stepper +#endif +#ifndef PULSE_TIMER_NUM + #define PULSE_TIMER_NUM STEP_TIMER_NUM +#endif +#ifndef TEMP_TIMER_NUM + #define TEMP_TIMER_NUM 1 // Timer Index for Temperature +#endif + +#define TEMP_TIMER_RATE 1000000 +#define TEMP_TIMER_FREQUENCY 1000 + +#define STEPPER_TIMER_RATE GPT1_TIMER_RATE +#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) +#define STEPPER_TIMER_PRESCALE ((GPT_TIMER_RATE / 1000000) / STEPPER_TIMER_TICKS_PER_US) + +#define PULSE_TIMER_RATE STEPPER_TIMER_RATE // frequency of pulse timer +#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE +#define PULSE_TIMER_TICKS_PER_US STEPPER_TIMER_TICKS_PER_US + +#define ENABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_enable_interrupt(STEP_TIMER_NUM) +#define DISABLE_STEPPER_DRIVER_INTERRUPT() HAL_timer_disable_interrupt(STEP_TIMER_NUM) +#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_enabled(STEP_TIMER_NUM) + +#define ENABLE_TEMPERATURE_INTERRUPT() HAL_timer_enable_interrupt(TEMP_TIMER_NUM) +#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM) + +#ifndef HAL_STEP_TIMER_ISR + #define HAL_STEP_TIMER_ISR() extern "C" void stepTC_Handler() // GPT1_Handler() +#endif +#ifndef HAL_TEMP_TIMER_ISR + #define HAL_TEMP_TIMER_ISR() extern "C" void tempTC_Handler() // GPT2_Handler() +#endif + +extern "C" void stepTC_Handler(); +extern "C" void tempTC_Handler(); + +void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency); + +FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t compare) { + switch (timer_num) { + case 0: + GPT1_OCR1 = compare - 1; + break; + case 1: + GPT2_OCR1 = compare - 1; + break; + } +} + +FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) { + switch (timer_num) { + case 0: return GPT1_OCR1; + case 1: return GPT2_OCR1; + } + return 0; +} + +FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) { + switch (timer_num) { + case 0: return GPT1_CNT; + case 1: return GPT2_CNT; + } + return 0; +} + +void HAL_timer_enable_interrupt(const uint8_t timer_num); +void HAL_timer_disable_interrupt(const uint8_t timer_num); +bool HAL_timer_interrupt_enabled(const uint8_t timer_num); + +void HAL_timer_isr_prologue(const uint8_t timer_num); +//void HAL_timer_isr_epilogue(const uint8_t timer_num) {} +#define HAL_timer_isr_epilogue(TIMER_NUM) diff --git a/Marlin/src/HAL/TEENSY40_41/watchdog.cpp b/Marlin/src/HAL/TEENSY40_41/watchdog.cpp new file mode 100644 index 000000000000..4253944f2b79 --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/watchdog.cpp @@ -0,0 +1,52 @@ +/** + * 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 . + * + */ +#ifdef __IMXRT1062__ + +#include "../../inc/MarlinConfig.h" + +#if ENABLED(USE_WATCHDOG) + +#include "watchdog.h" + +// 4 seconds timeout +#define WDTO 4 //seconds + +uint8_t timeoutval = (WDTO - 0.5f) / 0.5f; + +void watchdog_init() { + + CCM_CCGR3 |= CCM_CCGR3_WDOG1(3); // enable WDOG1 clocks + WDOG1_WMCR = 0; // disable power down PDE + WDOG1_WCR |= WDOG_WCR_SRS | WDOG_WCR_WT(timeoutval); + WDOG1_WCR |= WDOG_WCR_WDE | WDOG_WCR_WDT | WDOG_WCR_SRE; + +} + +void HAL_watchdog_refresh() { + // Watchdog refresh sequence + WDOG1_WSR = 0x5555; + WDOG1_WSR = 0xAAAA; +} + +#endif // USE_WATCHDOG + +#endif // __IMXRT1062__ diff --git a/Marlin/src/HAL/TEENSY40_41/watchdog.h b/Marlin/src/HAL/TEENSY40_41/watchdog.h new file mode 100644 index 000000000000..f10ecb5aef9c --- /dev/null +++ b/Marlin/src/HAL/TEENSY40_41/watchdog.h @@ -0,0 +1,30 @@ +/** + * 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 + +/** + * Watchdog for Teensy4.0/4.1 (__IMXRT1062__) + */ + +void watchdog_init(); + +void HAL_watchdog_refresh(); diff --git a/Marlin/src/HAL/platforms.h b/Marlin/src/HAL/platforms.h index d4cec6426774..ef17d19170cc 100644 --- a/Marlin/src/HAL/platforms.h +++ b/Marlin/src/HAL/platforms.h @@ -31,6 +31,8 @@ #define HAL_PATH(PATH, NAME) XSTR(PATH/TEENSY31_32/NAME) #elif defined(__MK64FX512__) || defined(__MK66FX1M0__) #define HAL_PATH(PATH, NAME) XSTR(PATH/TEENSY35_36/NAME) +#elif defined(__IMXRT1062__) + #define HAL_PATH(PATH, NAME) XSTR(PATH/TEENSY40_41/NAME) #elif defined(TARGET_LPC1768) #define HAL_PATH(PATH, NAME) XSTR(PATH/LPC1768/NAME) #elif defined(__STM32F1__) || defined(TARGET_STM32F1) diff --git a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp index 02a6ad34f0c7..4b085f90cef5 100644 --- a/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp +++ b/Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp @@ -129,6 +129,19 @@ #define START_FLASH_ADDR 0x00000000 #define END_FLASH_ADDR 0x00140000 +#elif defined(__IMXRT1062__) + + // For IMXRT1062 in TEENSY 4.0/4/1 + // ITCM (rwx): ORIGIN = 0x00000000, LENGTH = 512K + // DTCM (rwx): ORIGIN = 0x20000000, LENGTH = 512K + // RAM (rwx): ORIGIN = 0x20200000, LENGTH = 512K + // FLASH (rwx): ORIGIN = 0x60000000, LENGTH = 1984K + // + #define START_SRAM_ADDR 0x00000000 + #define END_SRAM_ADDR 0x20280000 + #define START_FLASH_ADDR 0x60000000 + #define END_FLASH_ADDR 0x601F0000 + #elif defined(__SAMD51P20A__) // For SAMD51x20, valid address ranges are diff --git a/Marlin/src/HAL/shared/servo.h b/Marlin/src/HAL/shared/servo.h index f9c478411852..ccaf1f0255df 100644 --- a/Marlin/src/HAL/shared/servo.h +++ b/Marlin/src/HAL/shared/servo.h @@ -71,6 +71,8 @@ #include "../TEENSY31_32/Servo.h" #elif IS_TEENSY35 || IS_TEENSY36 #include "../TEENSY35_36/Servo.h" +#elif IS_TEENSY40 || IS_TEENSY41 + #include "../TEENSY40_41/Servo.h" #elif defined(TARGET_LPC1768) #include "../LPC1768/Servo.h" #elif defined(__STM32F1__) || defined(TARGET_STM32F1) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 89791c90820b..2927a3e40b28 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -977,18 +977,14 @@ void setup() { SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION); SERIAL_EOL(); - #if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR) SERIAL_ECHO_MSG( - STR_CONFIGURATION_VER - STRING_DISTRIBUTION_DATE - STR_AUTHOR STRING_CONFIG_H_AUTHOR + " Last Updated: " STRING_DISTRIBUTION_DATE + " | Author: " STRING_CONFIG_H_AUTHOR ); - SERIAL_ECHO_MSG("Compiled: " __DATE__); #endif - - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE)); + SERIAL_ECHO_MSG("Compiled: " __DATE__); + SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, (int)sizeof(block_t) * (BLOCK_BUFFER_SIZE)); // Set up LEDs early #if HAS_COLOR_LEDS diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index c8e1f287548d..581c801feb88 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -57,56 +57,58 @@ #define BOARD_K8200 1101 // Velleman K8200 Controller (derived from 3Drag Controller) #define BOARD_K8400 1102 // Velleman K8400 Controller (derived from 3Drag Controller) #define BOARD_K8600 1103 // Velleman K8600 Controller (Vertex Nano) -#define BOARD_BAM_DICE 1104 // 2PrintBeta BAM&DICE with STK drivers -#define BOARD_BAM_DICE_DUE 1105 // 2PrintBeta BAM&DICE Due with STK drivers -#define BOARD_MKS_BASE 1106 // MKS BASE v1.0 -#define BOARD_MKS_BASE_14 1107 // MKS BASE v1.4 with Allegro A4982 stepper drivers -#define BOARD_MKS_BASE_15 1108 // MKS BASE v1.5 with Allegro A4982 stepper drivers -#define BOARD_MKS_BASE_16 1109 // MKS BASE v1.6 with Allegro A4982 stepper drivers -#define BOARD_MKS_BASE_HEROIC 1110 // MKS BASE 1.0 with Heroic HR4982 stepper drivers -#define BOARD_MKS_GEN_13 1111 // MKS GEN v1.3 or 1.4 -#define BOARD_MKS_GEN_L 1112 // MKS GEN L -#define BOARD_KFB_2 1113 // BigTreeTech or BIQU KFB2.0 -#define BOARD_ZRIB_V20 1114 // zrib V2.0 control board (Chinese knock off RAMPS replica) -#define BOARD_FELIX2 1115 // Felix 2.0+ Electronics Board (RAMPS like) -#define BOARD_RIGIDBOARD 1116 // Invent-A-Part RigidBoard -#define BOARD_RIGIDBOARD_V2 1117 // Invent-A-Part RigidBoard V2 -#define BOARD_SAINSMART_2IN1 1118 // Sainsmart 2-in-1 board -#define BOARD_ULTIMAKER 1119 // Ultimaker -#define BOARD_ULTIMAKER_OLD 1120 // Ultimaker (Older electronics. Pre 1.5.4. This is rare) -#define BOARD_AZTEEG_X3 1121 // Azteeg X3 -#define BOARD_AZTEEG_X3_PRO 1122 // Azteeg X3 Pro -#define BOARD_ULTIMAIN_2 1123 // Ultimainboard 2.x (Uses TEMP_SENSOR 20) -#define BOARD_RUMBA 1124 // Rumba -#define BOARD_RUMBA_RAISE3D 1125 // Raise3D N series Rumba derivative -#define BOARD_RL200 1126 // Rapide Lite 200 (v1, low-cost RUMBA clone with drv) -#define BOARD_FORMBOT_TREX2PLUS 1127 // Formbot T-Rex 2 Plus -#define BOARD_FORMBOT_TREX3 1128 // Formbot T-Rex 3 -#define BOARD_FORMBOT_RAPTOR 1129 // Formbot Raptor -#define BOARD_FORMBOT_RAPTOR2 1130 // Formbot Raptor 2 -#define BOARD_BQ_ZUM_MEGA_3D 1131 // bq ZUM Mega 3D -#define BOARD_MAKEBOARD_MINI 1132 // MakeBoard Mini v2.1.2 is a control board sold by MicroMake -#define BOARD_TRIGORILLA_13 1133 // TriGorilla Anycubic version 1.3-based on RAMPS EFB -#define BOARD_TRIGORILLA_14 1134 // ... Ver 1.4 -#define BOARD_TRIGORILLA_14_11 1135 // ... Rev 1.1 (new servo pin order) -#define BOARD_RAMPS_ENDER_4 1136 // Creality: Ender-4, CR-8 -#define BOARD_RAMPS_CREALITY 1137 // Creality: CR10S, CR20, CR-X -#define BOARD_RAMPS_DAGOMA 1138 // Dagoma F5 -#define BOARD_FYSETC_F6_13 1139 // FYSETC F6 1.3 -#define BOARD_FYSETC_F6_14 1140 // FYSETC F6 1.4 -#define BOARD_DUPLICATOR_I3_PLUS 1141 // Wanhao Duplicator i3 Plus -#define BOARD_VORON 1142 // VORON Design -#define BOARD_TRONXY_V3_1_0 1143 // Tronxy TRONXY-V3-1.0 -#define BOARD_Z_BOLT_X_SERIES 1144 // Z-Bolt X Series -#define BOARD_TT_OSCAR 1145 // TT OSCAR -#define BOARD_OVERLORD 1146 // Overlord/Overlord Pro -#define BOARD_HJC2560C_REV1 1147 // ADIMLab Gantry v1 -#define BOARD_HJC2560C_REV2 1148 // ADIMLab Gantry v2 -#define BOARD_TANGO 1149 // BIQU Tango V1 -#define BOARD_MKS_GEN_L_V2 1150 // MKS GEN L V2 -#define BOARD_COPYMASTER_3D 1151 // Copymaster 3D -#define BOARD_ORTUR_4 1152 // Ortur 4 -#define BOARD_TENLOG_D3_HERO 1153 // Tenlog D3 Hero IDEX printer +#define BOARD_K8800 1104 // Velleman K8800 Controller (Vertex Delta) +#define BOARD_BAM_DICE 1105 // 2PrintBeta BAM&DICE with STK drivers +#define BOARD_BAM_DICE_DUE 1106 // 2PrintBeta BAM&DICE Due with STK drivers +#define BOARD_MKS_BASE 1107 // MKS BASE v1.0 +#define BOARD_MKS_BASE_14 1108 // MKS BASE v1.4 with Allegro A4982 stepper drivers +#define BOARD_MKS_BASE_15 1109 // MKS BASE v1.5 with Allegro A4982 stepper drivers +#define BOARD_MKS_BASE_16 1110 // MKS BASE v1.6 with Allegro A4982 stepper drivers +#define BOARD_MKS_BASE_HEROIC 1111 // MKS BASE 1.0 with Heroic HR4982 stepper drivers +#define BOARD_MKS_GEN_13 1112 // MKS GEN v1.3 or 1.4 +#define BOARD_MKS_GEN_L 1113 // MKS GEN L +#define BOARD_KFB_2 1114 // BigTreeTech or BIQU KFB2.0 +#define BOARD_ZRIB_V20 1115 // zrib V2.0 control board (Chinese knock off RAMPS replica) +#define BOARD_FELIX2 1116 // Felix 2.0+ Electronics Board (RAMPS like) +#define BOARD_RIGIDBOARD 1117 // Invent-A-Part RigidBoard +#define BOARD_RIGIDBOARD_V2 1118 // Invent-A-Part RigidBoard V2 +#define BOARD_SAINSMART_2IN1 1119 // Sainsmart 2-in-1 board +#define BOARD_ULTIMAKER 1120 // Ultimaker +#define BOARD_ULTIMAKER_OLD 1121 // Ultimaker (Older electronics. Pre 1.5.4. This is rare) +#define BOARD_AZTEEG_X3 1122 // Azteeg X3 +#define BOARD_AZTEEG_X3_PRO 1123 // Azteeg X3 Pro +#define BOARD_ULTIMAIN_2 1124 // Ultimainboard 2.x (Uses TEMP_SENSOR 20) +#define BOARD_RUMBA 1125 // Rumba +#define BOARD_RUMBA_RAISE3D 1126 // Raise3D N series Rumba derivative +#define BOARD_RL200 1127 // Rapide Lite 200 (v1, low-cost RUMBA clone with drv) +#define BOARD_FORMBOT_TREX2PLUS 1128 // Formbot T-Rex 2 Plus +#define BOARD_FORMBOT_TREX3 1129 // Formbot T-Rex 3 +#define BOARD_FORMBOT_RAPTOR 1130 // Formbot Raptor +#define BOARD_FORMBOT_RAPTOR2 1131 // Formbot Raptor 2 +#define BOARD_BQ_ZUM_MEGA_3D 1132 // bq ZUM Mega 3D +#define BOARD_MAKEBOARD_MINI 1133 // MakeBoard Mini v2.1.2 is a control board sold by MicroMake +#define BOARD_TRIGORILLA_13 1134 // TriGorilla Anycubic version 1.3-based on RAMPS EFB +#define BOARD_TRIGORILLA_14 1135 // ... Ver 1.4 +#define BOARD_TRIGORILLA_14_11 1136 // ... Rev 1.1 (new servo pin order) +#define BOARD_RAMPS_ENDER_4 1137 // Creality: Ender-4, CR-8 +#define BOARD_RAMPS_CREALITY 1138 // Creality: CR10S, CR20, CR-X +#define BOARD_RAMPS_DAGOMA 1139 // Dagoma F5 +#define BOARD_FYSETC_F6_13 1140 // FYSETC F6 1.3 +#define BOARD_FYSETC_F6_14 1141 // FYSETC F6 1.4 +#define BOARD_DUPLICATOR_I3_PLUS 1142 // Wanhao Duplicator i3 Plus +#define BOARD_VORON 1143 // VORON Design +#define BOARD_TRONXY_V3_1_0 1144 // Tronxy TRONXY-V3-1.0 +#define BOARD_Z_BOLT_X_SERIES 1145 // Z-Bolt X Series +#define BOARD_TT_OSCAR 1146 // TT OSCAR +#define BOARD_OVERLORD 1147 // Overlord/Overlord Pro +#define BOARD_HJC2560C_REV1 1148 // ADIMLab Gantry v1 +#define BOARD_HJC2560C_REV2 1149 // ADIMLab Gantry v2 +#define BOARD_TANGO 1150 // BIQU Tango V1 +#define BOARD_MKS_GEN_L_V2 1151 // MKS GEN L V2 +#define BOARD_MKS_GEN_L_V21 1152 // MKS GEN L V2.1 +#define BOARD_COPYMASTER_3D 1153 // Copymaster 3D +#define BOARD_ORTUR_4 1154 // Ortur 4 +#define BOARD_TENLOG_D3_HERO 1155 // Tenlog D3 Hero IDEX printer // // RAMBo and derivatives @@ -356,10 +358,13 @@ #define BOARD_THE_BORG 5000 // THE-BORG (Power outputs: Hotend0, Hotend1, Bed, Fan) #define BOARD_REMRAM_V1 5001 // RemRam v1 +#define BOARD_TEENSY41 5002 // Teensy4.0 and Teensy4.1 +#define BOARD_T41U5XBB 5003 // T41U5XBB Teensy4.1 breakout board // // Espressif ESP32 WiFi // + #define BOARD_ESPRESSIF_ESP32 6000 // Generic ESP32 #define BOARD_MRR_ESPA 6001 // MRR ESPA board based on ESP32 (native pins only) #define BOARD_MRR_ESPE 6002 // MRR ESPE board based on ESP32 (with I2S stepper stream) @@ -368,11 +373,13 @@ // // SAMD51 ARM Cortex M4 // + #define BOARD_AGCM4_RAMPS_144 6100 // RAMPS 1.4.4 // // Custom board // + #define BOARD_CUSTOM 9998 // Custom pins definition for development and/or rare boards // diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 1d81ee61fb6d..0bcf799ac31d 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -108,8 +108,6 @@ #define STR_BROWNOUT_RESET " Brown out Reset" #define STR_WATCHDOG_RESET " Watchdog Reset" #define STR_SOFTWARE_RESET " Software Reset" -#define STR_AUTHOR " | Author: " -#define STR_CONFIGURATION_VER " Last Updated: " #define STR_FREE_MEMORY " Free Memory: " #define STR_PLANNER_BUFFER_BYTES " PlannerBufferBytes: " #define STR_OK "ok" @@ -127,7 +125,6 @@ #define STR_INVALID_E_STEPPER "Invalid E stepper" #define STR_E_STEPPER_NOT_SPECIFIED "E stepper not specified" #define STR_INVALID_SOLENOID "Invalid solenoid" -#define STR_M115_REPORT "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ") SOURCE_CODE_URL:" SOURCE_CODE_URL " PROTOCOL_VERSION:" PROTOCOL_VERSION " MACHINE_TYPE:" MACHINE_NAME " EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " UUID:" MACHINE_UUID #define STR_COUNT_X " Count X:" #define STR_COUNT_A " Count A:" #define STR_WATCHDOG_FIRED "Watchdog timeout. Reset required." diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index d13a8c3dc455..9fc9ec099e8b 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -736,6 +736,7 @@ uint8_t count = GRID_MAX_POINTS; mesh_index_pair best; + TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::MESH_START)); do { if (do_ubl_mesh_map) display_map(g29_map_type); @@ -775,6 +776,8 @@ } while (best.pos.x >= 0 && --count); + TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(best.pos, ExtUI::MESH_FINISH)); + // Release UI during stow to allow for PAUSE_BEFORE_DEPLOY_STOW TERN_(HAS_LCD_MENU, ui.release()); probe.stow(); diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 4089e2b87b05..f8a7d83260e2 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -381,7 +381,7 @@ 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) { 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); + DEBUG_ECHOLNPAIR("... 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); @@ -397,19 +397,6 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float TERN_(HOST_PROMPT_SUPPORT, host_prompt_open(PROMPT_INFO, PSTR("Pause"), DISMISS_STR)); - if (!DEBUGGING(DRYRUN) && unload_length && thermalManager.targetTooColdToExtrude(active_extruder)) { - SERIAL_ECHO_MSG(STR_ERR_HOTEND_TOO_COLD); - - #if HAS_LCD_MENU - if (show_lcd) { // Show status screen - lcd_pause_show_message(PAUSE_MESSAGE_STATUS); - LCD_MESSAGEPGM(MSG_M600_TOO_COLD); - } - #endif - - return false; // unable to reach safe temperature - } - // Indicate that the printer is paused ++did_pause_print; @@ -434,8 +421,10 @@ bool pause_print(const float &retract, const xyz_pos_t &park_point, const float #endif // Initial retract before move to filament change position - if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) + if (retract && thermalManager.hotEnoughToExtrude(active_extruder)) { + DEBUG_ECHOLNPAIR("... retract:", retract); 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_should_home()) @@ -495,7 +484,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // Start the heater idle timers const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT); - HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout); + HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout); #if ENABLED(DUAL_X_CARRIAGE) const int8_t saved_ext = active_extruder; @@ -514,7 +503,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // If the nozzle has timed out... if (!nozzle_timed_out) - HOTEND_LOOP() nozzle_timed_out |= thermalManager.hotend_idle[e].timed_out; + HOTEND_LOOP() nozzle_timed_out |= thermalManager.heater_idle[e].timed_out; // Wait for the user to press the button to re-heat the nozzle, then // re-heat the nozzle, re-show the continue prompt, restart idle timers, start over @@ -544,7 +533,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep // Start the heater idle timers const millis_t nozzle_timeout = SEC_TO_MS(PAUSE_PARK_NOZZLE_TIMEOUT); - HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout); + HOTEND_LOOP() thermalManager.heater_idle[e].start(nozzle_timeout); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), CONTINUE_STR)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Reheat finished."))); wait_for_user = true; @@ -599,15 +588,16 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le // Re-enable the heaters if they timed out bool nozzle_timed_out = false; HOTEND_LOOP() { - nozzle_timed_out |= thermalManager.hotend_idle[e].timed_out; + nozzle_timed_out |= thermalManager.heater_idle[e].timed_out; thermalManager.reset_hotend_idle_timer(e); } - if (targetTemp > thermalManager.degTargetHotend(active_extruder)) + if (targetTemp > thermalManager.degTargetHotend(active_extruder)) { thermalManager.setTargetHotend(targetTemp, active_extruder); + } - if (nozzle_timed_out || thermalManager.hotEnoughToExtrude(active_extruder)) // Load the new filament - load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_SAME DXC_PASS); + // Load the new filament + load_filament(slow_load_length, fast_load_length, purge_length, max_beep_count, true, nozzle_timed_out, PAUSE_MODE_SAME DXC_PASS); if (targetTemp > 0) { thermalManager.setTargetHotend(targetTemp, active_extruder); diff --git a/Marlin/src/feature/tmc_util.h b/Marlin/src/feature/tmc_util.h index 2779ae4ef4b4..d96939c91611 100644 --- a/Marlin/src/feature/tmc_util.h +++ b/Marlin/src/feature/tmc_util.h @@ -105,6 +105,7 @@ class TMCMarlin : public TMC, public TMCStorage { #if HAS_STEALTHCHOP inline void refresh_stepping_mode() { this->en_pwm_mode(this->stored.stealthChop_enabled); } inline bool get_stealthChop_status() { return this->en_pwm_mode(); } + inline bool get_stored_stealthChop_status() { return this->stored.stealthChop_enabled; } #endif #if ENABLED(HYBRID_THRESHOLD) @@ -171,6 +172,7 @@ class TMCMarlin : public TMC220 #if HAS_STEALTHCHOP inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); } inline bool get_stealthChop_status() { return !this->en_spreadCycle(); } + inline bool get_stored_stealthChop_status() { return this->stored.stealthChop_enabled; } #endif #if ENABLED(HYBRID_THRESHOLD) @@ -216,6 +218,7 @@ class TMCMarlin : public TMC220 #if HAS_STEALTHCHOP inline void refresh_stepping_mode() { en_spreadCycle(!this->stored.stealthChop_enabled); } inline bool get_stealthChop_status() { return !this->en_spreadCycle(); } + inline bool get_stored_stealthChop_status() { return this->stored.stealthChop_enabled; } #endif #if ENABLED(HYBRID_THRESHOLD) diff --git a/Marlin/src/gcode/calibrate/G76_M871.cpp b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp similarity index 90% rename from Marlin/src/gcode/calibrate/G76_M871.cpp rename to Marlin/src/gcode/calibrate/G76_M192_M871.cpp index 9870d9fbe567..89393b4582c1 100644 --- a/Marlin/src/gcode/calibrate/G76_M871.cpp +++ b/Marlin/src/gcode/calibrate/G76_M192_M871.cpp @@ -37,6 +37,17 @@ #include "../../module/probe.h" #include "../../feature/probe_temp_comp.h" +#include "../../lcd/ultralcd.h" +#include "../../MarlinCore.h" // for wait_for_heatup and idle() + +#if ENABLED(PRINTJOB_TIMER_AUTOSTART) + #include "../../module/printcounter.h" +#endif + +#if ENABLED(PRINTER_EVENTS_LEDS) + #include "../../feature/leds/leds.h" +#endif + /** * G76: calibrate probe and/or bed temperature offsets * Notes: @@ -303,17 +314,17 @@ void GcodeSuite::M871() { } else if (parser.seen("BPE")) { if (!parser.seenval('V')) return; - const int16_t val = parser.value_int(); + const int16_t offset_val = parser.value_int(); if (!parser.seenval('I')) return; const int16_t idx = parser.value_int(); const TempSensorID mod = (parser.seen('B') ? TSI_BED : - #if ENABLED(USE_TEMP_EXT_COMPENSATION) - parser.seen('E') ? TSI_EXT : - #endif - TSI_PROBE + #if ENABLED(USE_TEMP_EXT_COMPENSATION) + parser.seen('E') ? TSI_EXT : + #endif + TSI_PROBE ); - if (idx > 0 && temp_comp.set_offset(mod, idx - 1, val)) - SERIAL_ECHOLNPAIR("Set value: ", val); + if (idx > 0 && temp_comp.set_offset(mod, idx - 1, offset_val)) + SERIAL_ECHOLNPAIR("Set value: ", offset_val); else SERIAL_ECHOLNPGM("!Invalid index. Failed to set value (note: value at index 0 is constant)."); @@ -322,4 +333,25 @@ void GcodeSuite::M871() { temp_comp.print_offsets(); } +/** + * M192: Wait for probe temperature sensor to reach a target + * + * Select only one of these flags: + * R - Wait for heating or cooling + * S - Wait only for heating + */ +void GcodeSuite::M192() { + if (DEBUGGING(DRYRUN)) return; + + const bool no_wait_for_cooling = parser.seenval('S'); + if (!no_wait_for_cooling && ! parser.seenval('R')) { + SERIAL_ERROR_MSG("No target temperature set."); + return; + } + + const float target_temp = parser.value_celsius(); + ui.set_status_P(thermalManager.isProbeBelowTemp(target_temp) ? GET_TEXT(MSG_PROBE_HEATING) : GET_TEXT(MSG_PROBE_COOLING)); + thermalManager.wait_for_probe(target_temp, no_wait_for_cooling); +} + #endif // PROBE_TEMP_COMPENSATION diff --git a/Marlin/src/gcode/control/M993_M994.cpp b/Marlin/src/gcode/control/M993_M994.cpp index 4e13aa9d77df..ddc95238bf89 100644 --- a/Marlin/src/gcode/control/M993_M994.cpp +++ b/Marlin/src/gcode/control/M993_M994.cpp @@ -41,8 +41,6 @@ void GcodeSuite::M993() { return; } - W25QXXFlash W25QXX; - uint8_t buf[1024]; uint32_t addr = 0; W25QXX.init(SPI_QUARTER_SPEED); @@ -71,8 +69,6 @@ void GcodeSuite::M994() { return; } - W25QXXFlash W25QXX; - uint8_t buf[1024]; uint32_t addr = 0; W25QXX.init(SPI_QUARTER_SPEED); diff --git a/Marlin/src/gcode/feature/pause/M600.cpp b/Marlin/src/gcode/feature/pause/M600.cpp index b78608f7aee7..fe1d90109eef 100644 --- a/Marlin/src/gcode/feature/pause/M600.cpp +++ b/Marlin/src/gcode/feature/pause/M600.cpp @@ -162,9 +162,6 @@ 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/gcode.cpp b/Marlin/src/gcode/gcode.cpp index c0a795025fc7..c1b6deeadda8 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -818,6 +818,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { #endif #if ENABLED(PROBE_TEMP_COMPENSATION) + case 192: M192(); break; // M192: Wait for probe temp case 871: M871(); break; // M871: Print/reset/clear first layer temperature offset values #endif diff --git a/Marlin/src/gcode/gcode.h b/Marlin/src/gcode/gcode.h index 23bf2c0ce5b1..24273012629f 100644 --- a/Marlin/src/gcode/gcode.h +++ b/Marlin/src/gcode/gcode.h @@ -253,6 +253,7 @@ * M868 - Report or set position encoder module error correction threshold. * M869 - Report position encoder module error. * M871 - Print/reset/clear first layer temperature offset values. (Requires PROBE_TEMP_COMPENSATION) + * M192 - Wait for probe temp (Requires PROBE_TEMP_COMPENSATION) * M876 - Handle Prompt Response. (Requires HOST_PROMPT_SUPPORT and not EMERGENCY_PARSER) * M900 - Get or Set Linear Advance K-factor. (Requires LIN_ADVANCE) * M906 - Set or get motor current in milliamps using axis codes X, Y, Z, E. Report values if no axis codes given. (Requires at least one _DRIVER_TYPE defined as TMC2130/2160/5130/5160/2208/2209/2660 or L6470) @@ -820,7 +821,10 @@ class GcodeSuite { FORCE_INLINE static void M869() { I2CPEM.M869(); } #endif - TERN_(PROBE_TEMP_COMPENSATION, static void M871()); + #if ENABLED(PROBE_TEMP_COMPENSATION) + static void M192(); + static void M871(); + #endif TERN_(LIN_ADVANCE, static void M900()); diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index cd64c563f9fb..53c5163bbaf6 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -42,8 +42,16 @@ * the capability is not present. */ void GcodeSuite::M115() { - - SERIAL_ECHOLNPGM(STR_M115_REPORT); + SERIAL_ECHOLNPGM( + "FIRMWARE_NAME:Marlin " DETAILED_BUILD_VERSION " (" __DATE__ " " __TIME__ ") " + "SOURCE_CODE_URL:" SOURCE_CODE_URL " " + "PROTOCOL_VERSION:" PROTOCOL_VERSION " " + "MACHINE_TYPE:" MACHINE_NAME " " + "EXTRUDER_COUNT:" STRINGIFY(EXTRUDERS) " " + #ifdef MACHINE_UUID + "UUID:" MACHINE_UUID + #endif + ); #if ENABLED(EXTENDED_CAPABILITIES_REPORT) diff --git a/Marlin/src/gcode/motion/G2_G3.cpp b/Marlin/src/gcode/motion/G2_G3.cpp index 59a5346356b2..61d9f1d3a66d 100644 --- a/Marlin/src/gcode/motion/G2_G3.cpp +++ b/Marlin/src/gcode/motion/G2_G3.cpp @@ -115,9 +115,7 @@ void plan_arc( ); // Divide total travel by nominal segment length uint16_t segments = FLOOR(mm_of_travel / seg_length); - if (segments < min_segments) { // Too few segments? - segments = min_segments; // More segments - } + NOLESS(segments, min_segments); // At least some segments seg_length = mm_of_travel / segments; /** diff --git a/Marlin/src/gcode/temp/M303.cpp b/Marlin/src/gcode/temp/M303.cpp index 3340e4fa49a1..ccce09b4f1ee 100644 --- a/Marlin/src/gcode/temp/M303.cpp +++ b/Marlin/src/gcode/temp/M303.cpp @@ -62,7 +62,7 @@ void GcodeSuite::M303() { #define SI TERN(PIDTEMPBED, H_BED, H_E0) #define EI TERN(PIDTEMP, HOTENDS - 1, H_BED) - const heater_ind_t e = (heater_ind_t)parser.intval('E'); + const heater_id_t e = (heater_id_t)parser.intval('E'); if (!WITHIN(e, SI, EI)) { SERIAL_ECHOLNPGM(STR_PID_BAD_EXTRUDER_NUM); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_BAD_EXTRUDER_NUM)); diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index 35542f9412ab..9742967a09d9 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -56,6 +56,15 @@ #undef SHOW_TEMP_ADC_VALUES #endif +#if TEMP_SENSOR_BED == 0 + #undef THERMAL_PROTECTION_BED + #undef THERMAL_PROTECTION_BED_PERIOD +#endif + +#if TEMP_SENSOR_CHAMBER == 0 + #undef THERMAL_PROTECTION_CHAMBER +#endif + #if ENABLED(MIXING_EXTRUDER) && (ENABLED(RETRACT_SYNC_MIXING) || BOTH(FILAMENT_LOAD_UNLOAD_GCODES, FILAMENT_UNLOAD_ALL_EXTRUDERS)) #define HAS_MIXER_SYNC_CHANNEL 1 #endif diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index 775899febb16..1ee082720d7d 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2182,16 +2182,16 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal #endif /** - * Make sure features that need to write to the SD card are - * disabled unless write support is enabled. + * Make sure features that need to write to the SD card can */ -#if ENABLED(SDCARD_READONLY) +#if ENABLED(SDCARD_READONLY) && ANY(POWER_LOSS_RECOVERY, BINARY_FILE_TRANSFER, SDCARD_EEPROM_EMULATION) + #undef SDCARD_READONLY #if ENABLED(POWER_LOSS_RECOVERY) - #error "POWER_LOSS_RECOVERY is incompatible with SDCARD_READONLY." + #warning "Either disable SDCARD_READONLY or disable POWER_LOSS_RECOVERY." #elif ENABLED(BINARY_FILE_TRANSFER) - #error "BINARY_FILE_TRANSFER is incompatible with SDCARD_READONLY." + #warning "Either disable SDCARD_READONLY or disable BINARY_FILE_TRANSFER." #elif ENABLED(SDCARD_EEPROM_EMULATION) - #error "SDCARD_EEPROM_EMULATION is incompatible with SDCARD_READONLY." + #warning "Either disable SDCARD_READONLY or disable SDCARD_EEPROM_EMULATION." #endif #endif diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index baffa0bc48c6..df3ff7aa3dd3 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-09-09" + #define STRING_DISTRIBUTION_DATE "2020-09-15" #endif /** diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp index 22dd63f68cb0..0a1177d63ee9 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp @@ -519,13 +519,13 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const } } -FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const char prefix, const bool blink) { +FORCE_INLINE void _draw_heater_status(const heater_id_t heater_id, const char prefix, const bool blink) { #if HAS_HEATED_BED - const bool isBed = heater < 0; - const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)), - t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater)); + const bool isBed = TERN(HAS_HEATED_CHAMBER, heater_id == H_BED, heater_id < 0); + const float t1 = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater_id)), + t2 = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater_id)); #else - const float t1 = thermalManager.degHotend(heater), t2 = thermalManager.degTargetHotend(heater); + const float t1 = thermalManager.degHotend(heater_id), t2 = thermalManager.degTargetHotend(heater_id); #endif if (prefix >= 0) lcd_put_wchar(prefix); @@ -536,14 +536,7 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const char pref #if !HEATER_IDLE_HANDLER UNUSED(blink); #else - const bool is_idle = ( - #if HAS_HEATED_BED - isBed ? thermalManager.bed_idle.timed_out : - #endif - thermalManager.hotend_idle[heater].timed_out - ); - - if (!blink && is_idle) { + if (!blink && thermalManager.heater_idle[thermalManager.idle_index_for_id(heater_id)].timed_out) { lcd_put_wchar(' '); if (t2 >= 10) lcd_put_wchar(' '); if (t2 >= 100) lcd_put_wchar(' '); @@ -560,27 +553,14 @@ FORCE_INLINE void _draw_heater_status(const heater_ind_t heater, const char pref } FORCE_INLINE void _draw_bed_status(const bool blink) { - _draw_heater_status(H_BED, ( - #if HAS_LEVELING - planner.leveling_active && blink ? '_' : - #endif - LCD_STR_BEDTEMP[0] - ), - blink - ); + _draw_heater_status(H_BED, TERN0(HAS_LEVELING, blink && planner.leveling_active) ? '_' : LCD_STR_BEDTEMP[0], blink); } #if HAS_PRINT_PROGRESS FORCE_INLINE void _draw_print_progress() { const uint8_t progress = ui.get_progress_percent(); - lcd_put_u8str_P(PSTR( - #if ENABLED(SDSUPPORT) - "SD" - #elif ENABLED(LCD_SET_PROGRESS_MANUALLY) - "P:" - #endif - )); + lcd_put_u8str_P(PSTR(TERN(SDSUPPORT, "SD", "P:"))); if (progress) lcd_put_u8str(ui8tostr3rj(progress)); else @@ -990,7 +970,7 @@ void MarlinUI::draw_status_screen() { void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) { if (row < LCD_HEIGHT) { lcd_moveto(LCD_WIDTH - 9, row); - _draw_heater_status((heater_ind_t)extruder, LCD_STR_THERMOMETER[0], get_blink()); + _draw_heater_status((heater_id_t)extruder, LCD_STR_THERMOMETER[0], get_blink()); } } diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index bdd9f25703ec..4b51c2949b23 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -178,17 +178,17 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons #if DO_DRAW_HOTENDS // Draw hotend bitmap with current and target temperatures - FORCE_INLINE void _draw_hotend_status(const heater_ind_t heater, const bool blink) { + FORCE_INLINE void _draw_hotend_status(const heater_id_t heater_id, const bool blink) { #if !HEATER_IDLE_HANDLER UNUSED(blink); #endif - const bool isHeat = HOTEND_ALT(heater); + const bool isHeat = HOTEND_ALT(heater_id); - const uint8_t tx = STATUS_HOTEND_TEXT_X(heater); + const uint8_t tx = STATUS_HOTEND_TEXT_X(heater_id); - const float temp = thermalManager.degHotend(heater), - target = thermalManager.degTargetHotend(heater); + const float temp = thermalManager.degHotend(heater_id), + target = thermalManager.degTargetHotend(heater_id); #if DISABLED(STATUS_HOTEND_ANIM) #define STATIC_HOTEND true @@ -237,24 +237,24 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons #if ANIM_HOTEND // Draw hotend bitmap, either whole or split by the heating percent - const uint8_t hx = STATUS_HOTEND_X(heater), - bw = STATUS_HOTEND_BYTEWIDTH(heater); + const uint8_t hx = STATUS_HOTEND_X(heater_id), + bw = STATUS_HOTEND_BYTEWIDTH(heater_id); #if ENABLED(STATUS_HEAT_PERCENT) if (isHeat && tall <= BAR_TALL) { const uint8_t ph = STATUS_HEATERS_HEIGHT - 1 - tall; - u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(heater, false)); - u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(heater, true) + ph * bw); + u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, ph, HOTEND_BITMAP(heater_id, false)); + u8g.drawBitmapP(hx, STATUS_HEATERS_Y + ph, bw, tall + 1, HOTEND_BITMAP(heater_id, true) + ph * bw); } else #endif - u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(heater, isHeat)); + u8g.drawBitmapP(hx, STATUS_HEATERS_Y, bw, STATUS_HEATERS_HEIGHT, HOTEND_BITMAP(heater_id, isHeat)); #endif } // PAGE_CONTAINS if (PAGE_UNDER(7)) { #if HEATER_IDLE_HANDLER - const bool dodraw = (blink || !thermalManager.hotend_idle[heater].timed_out); + const bool dodraw = (blink || !thermalManager.heater_idle[heater_id].timed_out); #else constexpr bool dodraw = true; #endif @@ -327,7 +327,7 @@ FORCE_INLINE void _draw_centered_temp(const int16_t temp, const uint8_t tx, cons if (PAGE_UNDER(7)) { #if HEATER_IDLE_HANDLER - const bool dodraw = (blink || !thermalManager.bed_idle.timed_out); + const bool dodraw = (blink || !thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out); #else constexpr bool dodraw = true; #endif @@ -597,7 +597,7 @@ void MarlinUI::draw_status_screen() { // Extruders #if DO_DRAW_HOTENDS LOOP_L_N(e, MAX_HOTEND_DRAW) - _draw_hotend_status((heater_ind_t)e, blink); + _draw_hotend_status((heater_id_t)e, blink); #endif // Laser / Spindle diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index bf0edbb8ded2..b4f32d3343a1 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -308,7 +308,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop lcd_put_u8str(i16tostr3rj(thermalManager.degHotend(extruder))); lcd_put_wchar('/'); - if (get_blink() || !thermalManager.hotend_idle[extruder].timed_out) + if (get_blink() || !thermalManager.heater_idle[extruder].timed_out) lcd_put_u8str(i16tostr3rj(thermalManager.degTargetHotend(extruder))); } diff --git a/Marlin/src/lcd/dwin/e3v2/dwin.cpp b/Marlin/src/lcd/dwin/e3v2/dwin.cpp index 1d9c83e6da8a..ccd5f2bc2055 100644 --- a/Marlin/src/lcd/dwin/e3v2/dwin.cpp +++ b/Marlin/src/lcd/dwin/e3v2/dwin.cpp @@ -48,15 +48,17 @@ #include "../../../core/macros.h" #include "../../../gcode/queue.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" +#if ENABLED(EEPROM_SETTINGS) + #include "../../../module/settings.h" +#endif + #if ENABLED(HOST_ACTION_COMMANDS) #include "../../../feature/host_actions.h" #endif @@ -69,6 +71,10 @@ #include "../../../module/probe.h" #endif +#if ENABLED(POWER_LOSS_RECOVERY) + #include "../../../feature/powerloss.h" +#endif + #ifndef MACHINE_SIZE #define MACHINE_SIZE "220x220x250" #endif @@ -130,7 +136,7 @@ constexpr uint16_t TROWS = 6, MROWS = TROWS - 1, // Total rows, and other #define MBASE(L) (49 + (L)*MLINE) -#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, zprobe_zoffset) +#define BABY_Z_VAR TERN(HAS_BED_PROBE, probe.offset.z, dwin_zoffset) /* Value Init */ HMI_value_t HMI_ValueStruct; @@ -188,8 +194,8 @@ float last_E_scale = 0; bool DWIN_lcd_sd_status = 0; bool pause_action_flag = 0; int temphot = 0, tempbed = 0; -float zprobe_zoffset = 0; -float last_zoffset = 0, last_probe_zoffset = 0; +float dwin_zoffset = 0; +float last_zoffset = 0; #define DWIN_LANGUAGE_EEPROM_ADDRESS 0x01 // Between 0x01 and 0x63 (EEPROM_OFFSET-1) // BL24CXX::check() uses 0x00 @@ -213,13 +219,13 @@ void HMI_SetAndSaveLanguageChinese(void) { BL24CXX::write(DWIN_LANGUAGE_EEPROM_ADDRESS, (uint8_t*)&HMI_flag.language_chinese, sizeof(HMI_flag.language_chinese)); } -void show_plus_or_minus(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value) { +void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value) { if (value < 0) { - DWIN_Draw_String(false, true, size, White, bColor, x - 6, y, (char*)"-"); + DWIN_Draw_String(false, true, size, White, bColor, x - 6, y, F("-")); DWIN_Draw_FloatValue(true, true, 0, size, White, bColor, iNum, fNum, x, y, -value); } else { - DWIN_Draw_String(false, true, size, White, bColor, x - 6, y, (char*)" "); + DWIN_Draw_String(false, true, size, White, bColor, x - 6, y, F(" ")); DWIN_Draw_FloatValue(true, true, 0, size, White, bColor, iNum, fNum, x, y, value); } } @@ -227,6 +233,7 @@ void show_plus_or_minus(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNu void ICON_Print() { if (select_page.now == 0) { DWIN_ICON_Show(ICON, ICON_Print_1, 17, 130); + DWIN_Draw_Rectangle(0, White, 17, 130, 126, 229); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 1, 447, 271 - 243, 479 - 19, 58, 201); else @@ -244,6 +251,7 @@ void ICON_Print() { void ICON_Prepare() { if (select_page.now == 1) { DWIN_ICON_Show(ICON, ICON_Prepare_1, 145, 130); + DWIN_Draw_Rectangle(0, White, 145, 130, 254, 229); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 31, 447, 271 - 213, 479 - 19, 186, 201); else @@ -261,6 +269,7 @@ void ICON_Prepare() { void ICON_Control() { if (select_page.now == 2) { DWIN_ICON_Show(ICON, ICON_Control_1, 17, 246); + DWIN_Draw_Rectangle(0, White, 17, 246, 126, 345); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 61, 447, 271 - 183, 479 - 19, 58, 318); else @@ -278,6 +287,7 @@ void ICON_Control() { void ICON_StartInfo(bool show) { if (show) { DWIN_ICON_Show(ICON, ICON_Info_1, 145, 246); + DWIN_Draw_Rectangle(0, White, 145, 246, 254, 345); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 91, 447, 271 - 153, 479 - 19, 186, 318); else @@ -295,6 +305,7 @@ void ICON_StartInfo(bool show) { void ICON_Leveling(bool show) { if (show) { DWIN_ICON_Show(ICON, ICON_Leveling_1, 145, 246); + DWIN_Draw_Rectangle(0, White, 145, 246, 254, 345); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 211, 447, 238, 479 - 19, 186, 318); else @@ -312,6 +323,7 @@ void ICON_Leveling(bool show) { void ICON_Tune() { if (select_print.now == 0) { DWIN_ICON_Show(ICON, ICON_Setup_1, 8, 252); + DWIN_Draw_Rectangle(0, White, 8, 252, 87, 351); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 121, 447, 271 - 123, 479 - 21, 34, 325); else @@ -329,6 +341,7 @@ void ICON_Tune() { void ICON_Pause() { if (select_print.now == 1) { DWIN_ICON_Show(ICON, ICON_Pause_1, 96, 252); + DWIN_Draw_Rectangle(0, White, 96, 252, 175, 351); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 181, 447, 271 - 63, 479 - 20, 124, 325); else @@ -346,6 +359,7 @@ void ICON_Pause() { void ICON_Continue() { if (select_print.now == 1) { DWIN_ICON_Show(ICON, ICON_Continue_1, 96, 252); + DWIN_Draw_Rectangle(0, White, 96, 252, 175, 351); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 1, 447, 271 - 243, 479 - 19, 124, 325); else @@ -363,6 +377,7 @@ void ICON_Continue() { void ICON_Stop() { if (select_print.now == 2) { DWIN_ICON_Show(ICON, ICON_Stop_1, 184, 252); + DWIN_Draw_Rectangle(0, White, 184, 252, 263, 351); if (HMI_flag.language_chinese) DWIN_Frame_AreaCopy(1, 151, 447, 271 - 93, 479 - 20, 210, 325); else @@ -508,7 +523,7 @@ inline void Prepare_Item_Offset(const uint8_t row) { if (HMI_flag.language_chinese) { #if HAS_BED_PROBE DWIN_Frame_AreaCopy(1, 174, 164, 271 - 48, 479 - 302, LBLX, MBASE(row)); - show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(row), probe.offset.z * 100); + DWIN_Draw_Signed_Float(font8x16, Background_black, 2, 2, 202, MBASE(row), probe.offset.z * 100); #else DWIN_Frame_AreaCopy(1, 43, 89, 271 - 173, 479 - 378, LBLX, MBASE(row)); #endif @@ -516,7 +531,7 @@ inline void Prepare_Item_Offset(const uint8_t row) { else { #if HAS_BED_PROBE DWIN_Frame_AreaCopy(1, 93, 179, 271 - 130, 479 - 290, LBLX, MBASE(row)); // "Z-Offset" - show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(row), probe.offset.z * 100); + DWIN_Draw_Signed_Float(font8x16, Background_black, 2, 2, 202, MBASE(row), probe.offset.z * 100); #else DWIN_Frame_AreaCopy(1, 1, 76, 271 - 165, 479 - 393, LBLX, MBASE(row)); // "..." #endif @@ -557,11 +572,11 @@ inline void Prepare_Item_Cool(const uint8_t row) { inline void Prepare_Item_Lang(const uint8_t row) { if (HMI_flag.language_chinese) { DWIN_Frame_AreaCopy(1, 239, 134, 271 - 5, 479 - 333, LBLX, MBASE(row)); - DWIN_Draw_String(false, false, font8x16, White, Background_black, 226, MBASE(row), (char*)"CN"); + DWIN_Draw_String(false, false, font8x16, White, Background_black, 226, MBASE(row), F("CN")); } else { DWIN_Frame_AreaCopy(1, 0, 194, 271 - 150, 479 - 272, LBLX, MBASE(row)); // "Language selection" - DWIN_Draw_String(false, false, font8x16, White, Background_black, 226, MBASE(row), (char*)"EN"); + DWIN_Draw_String(false, false, font8x16, White, Background_black, 226, MBASE(row), F("EN")); } Draw_Menu_Icon(row, ICON_Language); } @@ -622,24 +637,30 @@ inline void Draw_Control_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_CONTROL)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)GET_TEXT_F(MSG_TEMPERATURE)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_MOTION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_STORE_EEPROM)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_LOAD_EEPROM)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), (char*)GET_TEXT_F(MSG_RESTORE_DEFAULTS)); - if (CVISI(6)) - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 5), (char*)"Info"); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), GET_TEXT_F(MSG_TEMPERATURE)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), GET_TEXT_F(MSG_MOTION)); + #if ENABLED(EEPROM_SETTINGS) + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), GET_TEXT_F(MSG_STORE_EEPROM)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), GET_TEXT_F(MSG_LOAD_EEPROM)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), GET_TEXT_F(MSG_RESTORE_DEFAULTS)); + if (CVISI(6)) DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 5), F("Info")); + #else + if (CVISI(3)) DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), F("Info")); + #endif #else DWIN_Frame_AreaCopy(1, 128, 2, 271 - 95, 479 - 467, 14, 8); DWIN_Frame_AreaCopy(1, 1, 89, 271 - 188, 479 - 377 - 1, LBLX, CLINE(1));// Temperature > DWIN_Frame_AreaCopy(1, 84, 89, 271 - 143, 479 - 380, LBLX, CLINE(2));// Motion > - DWIN_Frame_AreaCopy(1, 131 + 17, 89, 271 - 3, 479 - 377 - 1, LBLX, CLINE(3));// "Store Configuration" - DWIN_Frame_AreaCopy(1, 26, 104, 271 - 214, 479 - 365, LBLX, CLINE(4)); // "Read" - DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 31 + 3, CLINE(4)); // "Configuration" - DWIN_Frame_AreaCopy(1, 59, 104, 271 - 178, 479 - 365, LBLX, CLINE(5)); // "Reset" - DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 34 + 3, CLINE(5)); // "Configuration" - if (CVISI(6)) - DWIN_Frame_AreaCopy(1, 0, 104, 25, 115, LBLX, CLINE(6)); // Info > + #if ENABLED(EEPROM_SETTINGS) + DWIN_Frame_AreaCopy(1, 131 + 17, 89, 271 - 3, 479 - 377 - 1, LBLX, CLINE(3));// "Store Configuration" + DWIN_Frame_AreaCopy(1, 26, 104, 271 - 214, 479 - 365, LBLX, CLINE(4)); // "Read" + DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 31 + 3, CLINE(4)); // "Configuration" + DWIN_Frame_AreaCopy(1, 59, 104, 271 - 178, 479 - 365, LBLX, CLINE(5)); // "Reset" + DWIN_Frame_AreaCopy(1, 131 + 51, 89, 271 - 3, 479 - 377 - 1, LBLX + 34 + 3, CLINE(5)); // "Configuration" + if (CVISI(6)) DWIN_Frame_AreaCopy(1, 0, 104, 25, 115, LBLX, CLINE(6)); // Info > + #else + if (CVISI(3)) DWIN_Frame_AreaCopy(1, 0, 104, 25, 115, LBLX, CLINE(3)); // Info > + #endif #endif } @@ -669,11 +690,11 @@ inline void Draw_Tune_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_TUNE)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)GET_TEXT_F(MSG_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), (char*)GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), GET_TEXT_F(MSG_SPEED)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), GET_TEXT_F(MSG_FAN_SPEED)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), GET_TEXT_F(MSG_ZPROBE_ZOFFSET)); #else DWIN_Frame_AreaCopy(1, 94, 2, 271 - 145, 479 - 467, 14, 9); DWIN_Frame_AreaCopy(1, 1, 179, 271 - 179, 479 - 287 - 2, LBLX, MBASE(1)); // print speed @@ -699,7 +720,7 @@ inline void Draw_Tune_Menu() { DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(2), thermalManager.temp_hotend[0].target); DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(3), thermalManager.temp_bed.target); DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(4), thermalManager.fan_speed[0]); - show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(5), BABY_Z_VAR * 100); + DWIN_Draw_Signed_Float(font8x16, Background_black, 2, 2, 202, MBASE(5), BABY_Z_VAR * 100); } inline void draw_max_en(const uint16_t line) { @@ -748,10 +769,10 @@ inline void Draw_Motion_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_MOTION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Feedrate"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_ACCELERATION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_JERK)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_STEPS_PER_MM)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), F("Feedrate")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), GET_TEXT_F(MSG_ACCELERATION)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), GET_TEXT_F(MSG_JERK)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), GET_TEXT_F(MSG_STEPS_PER_MM)); #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); draw_max_en(MBASE(1)); draw_speed_en(24 + 3, MBASE(1)); // "Max Speed" @@ -787,8 +808,8 @@ void Popup_Window_Temperature(const bool toohigh) { DWIN_Frame_AreaCopy(1, 189, 389, 271 - 0, 402, 95, 310); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 36, 300, (char*)"Nozzle or Bed temperature"); - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 300, (char*)"is too high"); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 36, 300, F("Nozzle or Bed temperature")); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 300, F("is too high")); } } else { @@ -798,8 +819,8 @@ void Popup_Window_Temperature(const bool toohigh) { DWIN_Frame_AreaCopy(1, 189, 389, 271 - 0, 402, 95, 310); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 36, 300, (char*)"Nozzle or Bed temperature"); - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 300, (char*)"is too low"); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 36, 300, F("Nozzle or Bed temperature")); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 300, F("is too low")); } } } @@ -820,7 +841,7 @@ inline void Draw_Popup_Bkgd_60() { DWIN_ICON_Show(ICON, ICON_Confirm_C, 86, 280); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 20, 235, (char*)"Nozzle is too cold"); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 20, 235, F("Nozzle is too cold")); DWIN_ICON_Show(ICON, ICON_Confirm_E, 86, 280); } } @@ -837,9 +858,9 @@ void Popup_Window_Resume(void) { DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 307); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 120, 115, (char*)"Tips"); - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 192, (char*)"I see the file stopped"); - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 68, 212, (char*)"unexpectedly last time"); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 120, 115, F("Tips")); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 192, F("I see the file stopped")); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 68, 212, F("unexpectedly last time")); DWIN_ICON_Show(ICON, ICON_Continue_E, 26, 307); DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 307); } @@ -855,8 +876,8 @@ void Popup_Window_Home(void) { DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 80, 230, (char*)GET_TEXT_F(MSG_LEVEL_BED_HOMING)); - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 260, (char*)"Please wait until completed"); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 80, 230, GET_TEXT_F(MSG_LEVEL_BED_HOMING)); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 260, F("Please wait until completed")); } } @@ -869,8 +890,8 @@ void Popup_Window_Leveling(void) { DWIN_Frame_AreaCopy(1, 0, 389, 150, 402, 61, 280); } else { - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 76, 230, (char*)GET_TEXT_F(MSG_BED_LEVELING)); - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 260, (char*)"Please wait until completed"); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 76, 230, GET_TEXT_F(MSG_BED_LEVELING)); + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 24, 260, F("Please wait until completed")); } } @@ -895,8 +916,8 @@ void Popup_window_PauseOrStop(void) { DWIN_ICON_Show(ICON, ICON_Cancel_C, 146, 280); } else { - if (select_print.now == 1) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 88, 150, (char*)GET_TEXT_F(MSG_PAUSE_PRINT)); - else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 150, (char*)GET_TEXT_F(MSG_STOP_PRINT)); + if (select_print.now == 1) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 88, 150, GET_TEXT_F(MSG_PAUSE_PRINT)); + else if (select_print.now == 2) DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, 92, 150, GET_TEXT_F(MSG_STOP_PRINT)); DWIN_ICON_Show(ICON, ICON_Confirm_E, 26, 280); DWIN_ICON_Show(ICON, ICON_Cancel_E, 146, 280); } @@ -920,19 +941,19 @@ void Draw_Print_ProgressBar() { DWIN_ICON_Show(ICON, ICON_Bar, 15, 93); DWIN_Draw_Rectangle(1, BarFill_Color, 16 + Percentrecord * 240 / 100, 93, 256, 113); DWIN_Draw_IntValue(true, true, 0, font8x16, Percent_Color, Background_black, 2, 117, 133, Percentrecord); - DWIN_Draw_String(false, false, font8x16, Percent_Color, Background_black, 117 + 16, 133, (char*)"%"); + DWIN_Draw_String(false, false, font8x16, Percent_Color, Background_black, 117 + 16, 133, F("%")); } void Draw_Print_ProgressElapsed() { duration_t elapsed = print_job_timer.duration(); // print timer DWIN_Draw_IntValue(true, true, 1, font8x16, White, Background_black, 2, 42, 212, elapsed.value / 3600); - DWIN_Draw_String(false, false, font8x16, White, Background_black, 42 + 16, 212, (char*)":"); + DWIN_Draw_String(false, false, font8x16, White, Background_black, 42 + 16, 212, F(":")); DWIN_Draw_IntValue(true, true, 1, font8x16, White, Background_black, 2, 42 + 24, 212, (elapsed.value % 3600) / 60); } void Draw_Print_ProgressRemain() { DWIN_Draw_IntValue(true, true, 1, font8x16, White, Background_black, 2, 176, 212, remain_time / 3600); - DWIN_Draw_String(false, false, font8x16, White, Background_black, 176 + 16, 212, (char*)":"); + DWIN_Draw_String(false, false, font8x16, White, Background_black, 176 + 16, 212, F(":")); DWIN_Draw_IntValue(true, true, 1, font8x16, White, Background_black, 2, 176 + 24, 212, (remain_time % 3600) / 60); } @@ -1093,7 +1114,7 @@ void HMI_Move_Z(void) { checkkey = AxisMove; EncoderRate.encoderRateEnabled = 0; last_E_scale = HMI_ValueStruct.Move_E_scale; - show_plus_or_minus(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); + DWIN_Draw_Signed_Float(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); if (!planner.is_full()) { planner.synchronize(); // Wait for planner moves to finish! planner.buffer_line(current_position, MMM_TO_MMS(FEEDRATE_E), active_extruder); @@ -1106,7 +1127,7 @@ void HMI_Move_Z(void) { else if ((last_E_scale - HMI_ValueStruct.Move_E_scale) > (EXTRUDE_MAXLENGTH) * MINUNITMULT) HMI_ValueStruct.Move_E_scale = last_E_scale - (EXTRUDE_MAXLENGTH) * MINUNITMULT; current_position.e = HMI_ValueStruct.Move_E_scale / 10; - show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); + DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); DWIN_UpdateLCD(); } } @@ -1116,7 +1137,7 @@ void HMI_Move_Z(void) { void HMI_Zoffset(void) { ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); if (encoder_diffState != ENCODER_DIFF_NO) { - last_zoffset = zprobe_zoffset; + last_zoffset = dwin_zoffset; if (encoder_diffState == ENCODER_DIFF_CW) { HMI_ValueStruct.offset_value += EncoderRate.encoderMoveValue; } @@ -1125,24 +1146,22 @@ void HMI_Zoffset(void) { } else if (encoder_diffState == ENCODER_DIFF_ENTER) { EncoderRate.encoderRateEnabled = 0; - zprobe_zoffset = HMI_ValueStruct.offset_value / 100; + dwin_zoffset = HMI_ValueStruct.offset_value / 100; #if HAS_BED_PROBE - if (WITHIN(zprobe_zoffset - last_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) - probe.offset.z = zprobe_zoffset; - settings.save(); + if (WITHIN(dwin_zoffset - last_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) + probe.offset.z = dwin_zoffset; + TERN_(EEPROM_SETTINGS, settings.save()); #elif ENABLED(BABYSTEPPING) - babystep.add_mm(Z_AXIS, (zprobe_zoffset - last_zoffset)); - #else - UNUSED(zprobe_zoffset - last_zoffset); + babystep.add_mm(Z_AXIS, dwin_zoffset - last_zoffset); #endif if (HMI_ValueStruct.show_mode == -4) { checkkey = Prepare; - show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(4 + MROWS - index_prepare), TERN(HAS_BED_PROBE, probe.offset.z * 100, HMI_ValueStruct.offset_value)); + DWIN_Draw_Signed_Float(font8x16, Background_black, 2, 2, 202, MBASE(4 + MROWS - index_prepare), TERN(HAS_BED_PROBE, probe.offset.z * 100, HMI_ValueStruct.offset_value)); } else { checkkey = Tune; - show_plus_or_minus(font8x16, Background_black, 2, 2, 202, MBASE(5 + MROWS - index_tune), TERN(HAS_BED_PROBE, probe.offset.z * 100, HMI_ValueStruct.offset_value)); + DWIN_Draw_Signed_Float(font8x16, Background_black, 2, 2, 202, MBASE(5 + MROWS - index_tune), TERN(HAS_BED_PROBE, probe.offset.z * 100, HMI_ValueStruct.offset_value)); } DWIN_UpdateLCD(); return; @@ -1150,9 +1169,9 @@ void HMI_Zoffset(void) { NOLESS(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MIN) * 100); NOMORE(HMI_ValueStruct.offset_value, (Z_PROBE_OFFSET_RANGE_MAX) * 100); if (HMI_ValueStruct.show_mode == -4) - show_plus_or_minus(font8x16, Select_Color, 2, 2, 202, MBASE(4 + MROWS - index_prepare), HMI_ValueStruct.offset_value); + DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(4 + MROWS - index_prepare), HMI_ValueStruct.offset_value); else - show_plus_or_minus(font8x16, Select_Color, 2, 2, 202, MBASE(5 + MROWS - index_tune), HMI_ValueStruct.offset_value); + DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(5 + MROWS - index_tune), HMI_ValueStruct.offset_value); DWIN_UpdateLCD(); } } @@ -1204,7 +1223,7 @@ void HMI_Zoffset(void) { } } -#endif // if HAS_HOTEND +#endif // HAS_HOTEND #if HAS_HEATED_BED @@ -1253,7 +1272,7 @@ void HMI_Zoffset(void) { } } -#endif // if HAS_HEATED_BED +#endif // HAS_HEATED_BED #if HAS_FAN @@ -1302,7 +1321,7 @@ void HMI_Zoffset(void) { } } -#endif // if HAS_FAN +#endif // HAS_FAN void HMI_PrintSpeed(void) { ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); @@ -1506,27 +1525,20 @@ void update_variable(void) { DWIN_Draw_IntValue(true, true, 0, STAT_FONT, White, Background_black, 3, 33 + 2 * STAT_CHR_W, 429, feedrate_percentage); last_speed = feedrate_percentage; } - #if HAS_BED_PROBE - if (last_probe_zoffset != probe.offset.z) { - show_plus_or_minus(STAT_FONT, Background_black, 2, 2, 178 + STAT_CHR_W, 429, probe.offset.z * 100); - last_probe_zoffset = probe.offset.z; - } - #else - if (last_zoffset != zprobe_zoffset) { - show_plus_or_minus(STAT_FONT, Background_black, 2, 2, 178 + STAT_CHR_W, 429, zprobe_zoffset * 100); - last_zoffset = zprobe_zoffset; - } - #endif + if (last_zoffset != BABY_Z_VAR) { + DWIN_Draw_Signed_Float(STAT_FONT, Background_black, 2, 2, 178 + STAT_CHR_W, 429, BABY_Z_VAR * 100); + last_zoffset = BABY_Z_VAR; + } } /** -* Read and cache the working directory. -* -* TODO: New code can follow the pattern of menu_media.cpp -* and rely on Marlin caching for performance. No need to -* cache files here. -* -*/ + * Read and cache the working directory. + * + * TODO: New code can follow the pattern of menu_media.cpp + * and rely on Marlin caching for performance. No need to + * cache files here. + * + */ #ifndef strcasecmp_P #define strcasecmp_P(a, b) strcasecmp((a), (b)) @@ -1595,7 +1607,7 @@ inline void Draw_SDItem(const uint16_t item, int16_t row=-1) { if (row < 0) row = item + 1 + MROWS - index_file; const bool is_subdir = !card.flag.workDirIsRoot; if (is_subdir && item == 0) { - Draw_Menu_Line(row, ICON_Folder, (char*)".."); + Draw_Menu_Line(row, ICON_Folder, ".."); return; } @@ -1712,11 +1724,11 @@ void HMI_StartFrame(const bool with_update) { DWIN_Draw_IntValue(true, true, 0, STAT_FONT, White, Background_black, 3, 178 + 4 * STAT_CHR_W + 6, 382, thermalManager.temp_bed.target); DWIN_Draw_IntValue(true, true, 0, STAT_FONT, White, Background_black, 3, 33 + 2 * STAT_CHR_W, 429, feedrate_percentage); - DWIN_Draw_String(false, false, STAT_FONT, White, Background_black, 33 + (2 + 3) * STAT_CHR_W + 2, 429, (char*)"%"); + DWIN_Draw_String(false, false, STAT_FONT, White, Background_black, 33 + (2 + 3) * STAT_CHR_W + 2, 429, F("%")); - show_plus_or_minus(STAT_FONT, Background_black, 2, 2, 178, 429, BABY_Z_VAR * 100); - DWIN_Draw_String(false, false, STAT_FONT, White, Background_black, 33 + 3 * STAT_CHR_W + 5, 383, (char*)"/"); - DWIN_Draw_String(false, false, STAT_FONT, White, Background_black, 178 + 3 * STAT_CHR_W + 5, 383, (char*)"/"); + DWIN_Draw_Signed_Float(STAT_FONT, Background_black, 2, 2, 178, 429, BABY_Z_VAR * 100); + DWIN_Draw_String(false, false, STAT_FONT, White, Background_black, 33 + 3 * STAT_CHR_W + 5, 383, F("/")); + DWIN_Draw_String(false, false, STAT_FONT, White, Background_black, 178 + 3 * STAT_CHR_W + 5, 383, F("/")); if (with_update) { DWIN_UpdateLCD(); @@ -2214,7 +2226,7 @@ void HMI_Prepare(void) { DWIN_Draw_FloatValue(true, true, 0, font8x16, White, Background_black, 3, 1, 216, MBASE(1), current_position[X_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, White, Background_black, 3, 1, 216, MBASE(2), current_position[Y_AXIS] * MINUNITMULT); DWIN_Draw_FloatValue(true, true, 0, font8x16, White, Background_black, 3, 1, 216, MBASE(3), current_position[Z_AXIS] * MINUNITMULT); - show_plus_or_minus(font8x16, Background_black, 3, 1, 216, MBASE(4), current_position.e * MINUNITMULT); + DWIN_Draw_Signed_Float(font8x16, Background_black, 3, 1, 216, MBASE(4), current_position.e * MINUNITMULT); break; case 2: // close motion queue.inject_P(PSTR("M84")); @@ -2228,9 +2240,9 @@ void HMI_Prepare(void) { case 4: // Z-offset #if HAS_BED_PROBE checkkey = Homeoffset; - HMI_ValueStruct.show_mode = -4; + HMI_ValueStruct.show_mode = -4; HMI_ValueStruct.offset_value = probe.offset.z * 100; - show_plus_or_minus(font8x16, Select_Color, 2, 2, 202, MBASE(4 + MROWS - index_prepare), HMI_ValueStruct.offset_value); + DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(4 + MROWS - index_prepare), HMI_ValueStruct.offset_value); EncoderRate.encoderRateEnabled = 1; #else // Apply workspace offset, making the current position 0,0,0 @@ -2287,11 +2299,11 @@ void Draw_Temperature_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_TEMPERATURE)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"PLA Preheat Settings"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), (char*)"ABS Preheat Settings"); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), GET_TEXT_F(MSG_UBL_SET_TEMP_HOTEND)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), GET_TEXT_F(MSG_UBL_SET_TEMP_BED)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), GET_TEXT_F(MSG_FAN_SPEED)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), F("PLA Preheat Settings")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 4), F("ABS Preheat Settings")); #else DWIN_Frame_AreaCopy(1, 56, 16, 271 - 130, 479 - 450 - 1, 14, 8); DWIN_Frame_AreaCopy(1, 197, 104, 271 - 33, 479 - 365, LBLX, MBASE(1)); // Nozzle... @@ -2383,19 +2395,22 @@ void HMI_Control(void) { select_motion.reset(); Draw_Motion_Menu(); break; - case 3: { // write EEPROM - const bool success = settings.save(); - HMI_AudioFeedback(success); - } break; - case 4: { // read EEPROM - const bool success = settings.load(); - HMI_AudioFeedback(success); - } break; - case 5: // resume EEPROM - settings.reset(); - HMI_AudioFeedback(); - break; - case 6: // info + case 3: + #if ENABLED(EEPROM_SETTINGS) + { // write EEPROM + const bool success = settings.save(); + HMI_AudioFeedback(success); + } break; + case 4: { // read EEPROM + const bool success = settings.load(); + HMI_AudioFeedback(success); + } break; + case 5: // resume EEPROM + settings.reset(); + HMI_AudioFeedback(); + break; + case 6: // info + #endif checkkey = Info; Draw_Info_Menu(); break; @@ -2433,7 +2448,7 @@ void HMI_AxisMove(void) { DWIN_Draw_FloatValue(true, true, 0, font8x16, White, Background_black, 3, 1, 216, MBASE(1), HMI_ValueStruct.Move_X_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, White, Background_black, 3, 1, 216, MBASE(2), HMI_ValueStruct.Move_Y_scale); DWIN_Draw_FloatValue(true, true, 0, font8x16, White, Background_black, 3, 1, 216, MBASE(3), HMI_ValueStruct.Move_Z_scale); - show_plus_or_minus(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); + DWIN_Draw_Signed_Float(font8x16, Background_black, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); DWIN_UpdateLCD(); } return; @@ -2486,7 +2501,7 @@ void HMI_AxisMove(void) { #endif checkkey = Extruder; HMI_ValueStruct.Move_E_scale = current_position.e * MINUNITMULT; - show_plus_or_minus(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); + DWIN_Draw_Signed_Float(font8x16, Select_Color, 3, 1, 216, MBASE(4), HMI_ValueStruct.Move_E_scale); EncoderRate.encoderRateEnabled = 1; break; #endif @@ -2561,10 +2576,10 @@ void HMI_Temperature(void) { else { #ifdef USE_STRING_HEADINGS Draw_Title("PLA Settings"); // TODO: GET_TEXT_F - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Nozzle Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Bed Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_STORE_EEPROM)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), F("Nozzle Temp")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), F("Bed Temp")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), GET_TEXT_F(MSG_FAN_SPEED)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), GET_TEXT_F(MSG_STORE_EEPROM)); #else DWIN_Frame_AreaCopy(1, 56, 16, 271 - 130, 479 - 450 - 1, 14, 8); DWIN_Frame_AreaCopy(1, 157, 76, 181, 479 - 393, LBLX, MBASE(1)); @@ -2584,7 +2599,9 @@ void HMI_Temperature(void) { Draw_Menu_Line(1, ICON_SetEndTemp); Draw_Menu_Line(2, ICON_SetBedTemp); Draw_Menu_Line(3, ICON_FanSpeed); - Draw_Menu_Line(4, ICON_WriteEEPROM); + #if ENABLED(EEPROM_SETTINGS) + Draw_Menu_Line(4, ICON_WriteEEPROM); + #endif DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(1), ui.material_preset[0].hotend_temp); DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(2), ui.material_preset[0].bed_temp); @@ -2614,10 +2631,10 @@ void HMI_Temperature(void) { else { #ifdef USE_STRING_HEADINGS Draw_Title("ABS Settings"); // TODO: GET_TEXT_F - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Nozzle Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Bed Temp"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)GET_TEXT_F(MSG_FAN_SPEED)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)GET_TEXT_F(MSG_STORE_EEPROM)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), F("Nozzle Temp")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), F("Bed Temp")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), GET_TEXT_F(MSG_FAN_SPEED)); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), GET_TEXT_F(MSG_STORE_EEPROM)); #else DWIN_Frame_AreaCopy(1, 56, 16, 271 - 130, 479 - 450 - 1, 14, 8); DWIN_Frame_AreaCopy(1, 172, 76, 198, 479 - 393, LBLX, MBASE(1)); @@ -2638,14 +2655,16 @@ void HMI_Temperature(void) { Draw_Menu_Line(1, ICON_SetEndTemp); Draw_Menu_Line(2, ICON_SetBedTemp); Draw_Menu_Line(3, ICON_FanSpeed); - Draw_Menu_Line(4, ICON_WriteEEPROM); + #if ENABLED(EEPROM_SETTINGS) + Draw_Menu_Line(4, ICON_WriteEEPROM); + #endif DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(1), ui.material_preset[1].hotend_temp); DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(2), ui.material_preset[1].bed_temp); DWIN_Draw_IntValue(true, true, 0, font8x16, White, Background_black, 3, 216, MBASE(3), ui.material_preset[1].fan_speed); break; - #endif // if HAS_HOTEND + #endif // HAS_HOTEND } } DWIN_UpdateLCD(); @@ -2673,10 +2692,10 @@ inline void Draw_Max_Speed_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title("Max Speed (mm/s)"); // TODO: GET_TEXT_F - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Max Feedrate X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Max Feedrate Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Max Feedrate Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Max Feedrate E"); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), F("Max Feedrate X")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), F("Max Feedrate Y")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), F("Max Feedrate Z")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), F("Max Feedrate E")); #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); @@ -2728,10 +2747,10 @@ inline void Draw_Max_Accel_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_ACCELERATION)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Max Accel X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Max Accel Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Max Accel Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Max Accel E"); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), F("Max Accel X")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), F("Max Accel Y")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), F("Max Accel Z")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), F("Max Accel E")); #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); draw_max_accel_en(MBASE(1)); say_x(24 + 78 + 6, MBASE(1)); // "Max Acceleration X" @@ -2776,10 +2795,10 @@ inline void Draw_Max_Jerk_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_JERK)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Max Jerk X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Max Jerk Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Max Jerk Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Max Jerk E"); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), F("Max Jerk X")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), F("Max Jerk Y")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), F("Max Jerk Z")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), F("Max Jerk E")); #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); draw_max_en(MBASE(1)); // "Max" @@ -2831,10 +2850,10 @@ inline void Draw_Steps_Menu() { else { #ifdef USE_STRING_HEADINGS Draw_Title(GET_TEXT_F(MSG_STEPS_PER_MM)); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), (char*)"Steps/mm X"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), (char*)"Steps/mm Y"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), (char*)"Steps/mm Z"); - DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), (char*)"Steps/mm E"); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 0), F("Steps/mm X")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 1), F("Steps/mm Y")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 2), F("Steps/mm Z")); + DWIN_Draw_String(false, true, font8x16, White, Background_black, 60, 102 + (MLINE * 3), F("Steps/mm E")); #else DWIN_Frame_AreaCopy(1, 144, 16, 271 - 82, 479 - 453, 14, 8); draw_steps_per_mm(MBASE(1)); say_x(100 + 3, MBASE(1)); // "Steps-per-mm X" @@ -2987,7 +3006,7 @@ void HMI_Tune(void) { case 5: // Z-offset checkkey = Homeoffset; HMI_ValueStruct.offset_value = BABY_Z_VAR * 100; - show_plus_or_minus(font8x16, Select_Color, 2, 2, 202, MBASE(5 + MROWS - index_tune), HMI_ValueStruct.offset_value); + DWIN_Draw_Signed_Float(font8x16, Select_Color, 2, 2, 202, MBASE(5 + MROWS - index_tune), HMI_ValueStruct.offset_value); EncoderRate.encoderRateEnabled = 1; break; case 6: // Language @@ -3058,10 +3077,12 @@ void HMI_PLAPreheatSetting(void) { EncoderRate.encoderRateEnabled = 1; break; #endif - case 4: { // save PLA configuration - const bool success = settings.save(); - HMI_AudioFeedback(success); - } break; + #if ENABLED(EEPROM_SETTINGS) + case 4: { // save PLA configuration + const bool success = settings.save(); + HMI_AudioFeedback(success); + } break; + #endif default: break; } } @@ -3112,10 +3133,12 @@ void HMI_ABSPreheatSetting(void) { EncoderRate.encoderRateEnabled = 1; break; #endif - case 4: { // save ABS configuration - const bool success = settings.save(); - HMI_AudioFeedback(success); - } break; + #if ENABLED(EEPROM_SETTINGS) + case 4: { // save ABS configuration + const bool success = settings.save(); + HMI_AudioFeedback(success); + } break; + #endif default: break; } @@ -3432,7 +3455,7 @@ void EachMomentUpdate(void) { else if (abort_flag && !HMI_flag.home_flag) { // Print Stop abort_flag = 0; HMI_ValueStruct.print_speed = feedrate_percentage = 100; - zprobe_zoffset = TERN(HAS_BED_PROBE, probe.offset.z, 0); + dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); planner.finish_and_disable(); @@ -3443,70 +3466,72 @@ void EachMomentUpdate(void) { select_page.set(0); Goto_MainMenu(); } - else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // resume print before power off - recovery.dwin_flag = false; - - recovery.load(); - if (!recovery.valid()) return recovery.purge(); - - auto draw_first_option = [](const bool sel) { - const uint16_t c1 = sel ? Background_window : Select_Color; - DWIN_Draw_Rectangle(0, c1, 25, 306, 126, 345); - DWIN_Draw_Rectangle(0, c1, 24, 305, 127, 346); - }; - - auto update_selection = [&](const bool sel) { - HMI_flag.select_flag = sel; - draw_first_option(sel); - const uint16_t c2 = sel ? Select_Color : Background_window; - DWIN_Draw_Rectangle(0, c2, 145, 306, 246, 345); - DWIN_Draw_Rectangle(0, c2, 144, 305, 247, 346); - }; - - const uint16_t fileCnt = card.get_num_Files(); - for (uint16_t i = 0; i < fileCnt; i++) { - // TODO: Resume print via M1000 then update the UI - // with the active filename which can come from CardReader. - card.getfilename_sorted(SD_ORDER(i, fileCnt)); - if (!strcmp(card.filename, &recovery.info.sd_filename[1])) { // Resume print before power failure while have the same file - recovery_flag = 1; - HMI_flag.select_flag = 1; - Popup_Window_Resume(); - draw_first_option(false); - char * const name = card.longest_filename(); - const int8_t npos = _MAX(0, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2; - DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, npos, 252, name); - DWIN_UpdateLCD(); - break; + #if ENABLED(POWER_LOSS_RECOVERY) + else if (DWIN_lcd_sd_status && recovery.dwin_flag) { // resume print before power off + recovery.dwin_flag = false; + + recovery.load(); + if (!recovery.valid()) return recovery.purge(); + + auto draw_first_option = [](const bool sel) { + const uint16_t c1 = sel ? Background_window : Select_Color; + DWIN_Draw_Rectangle(0, c1, 25, 306, 126, 345); + DWIN_Draw_Rectangle(0, c1, 24, 305, 127, 346); + }; + + auto update_selection = [&](const bool sel) { + HMI_flag.select_flag = sel; + draw_first_option(sel); + const uint16_t c2 = sel ? Select_Color : Background_window; + DWIN_Draw_Rectangle(0, c2, 145, 306, 246, 345); + DWIN_Draw_Rectangle(0, c2, 144, 305, 247, 346); + }; + + const uint16_t fileCnt = card.get_num_Files(); + for (uint16_t i = 0; i < fileCnt; i++) { + // TODO: Resume print via M1000 then update the UI + // with the active filename which can come from CardReader. + card.getfilename_sorted(SD_ORDER(i, fileCnt)); + if (!strcmp(card.filename, &recovery.info.sd_filename[1])) { // Resume print before power failure while have the same file + recovery_flag = 1; + HMI_flag.select_flag = 1; + Popup_Window_Resume(); + draw_first_option(false); + char * const name = card.longest_filename(); + const int8_t npos = _MAX(0, DWIN_WIDTH - strlen(name) * (MENU_CHR_W)) / 2; + DWIN_Draw_String(false, true, font8x16, Font_window, Background_window, npos, 252, name); + DWIN_UpdateLCD(); + break; + } } - } - // if hasn't resumable G-code file - if (!recovery_flag) return; + // if hasn't resumable G-code file + if (!recovery_flag) return; + + while (recovery_flag) { + ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); + if (encoder_diffState != ENCODER_DIFF_NO) { + if (encoder_diffState == ENCODER_DIFF_ENTER) { + recovery_flag = 0; + if (HMI_flag.select_flag) break; + TERN_(POWER_LOSS_RECOVERY, recovery.cancel()); + HMI_StartFrame(true); + return; + } + else + update_selection(encoder_diffState == ENCODER_DIFF_CCW); - while (recovery_flag) { - ENCODER_DiffState encoder_diffState = Encoder_ReceiveAnalyze(); - if (encoder_diffState != ENCODER_DIFF_NO) { - if (encoder_diffState == ENCODER_DIFF_ENTER) { - recovery_flag = 0; - if (HMI_flag.select_flag) break; - TERN_(POWER_LOSS_RECOVERY, recovery.cancel()); - HMI_StartFrame(true); - return; + DWIN_UpdateLCD(); } - else - update_selection(encoder_diffState == ENCODER_DIFF_CCW); - - DWIN_UpdateLCD(); } - } - select_print.set(0); - HMI_ValueStruct.show_mode = 0; - HMI_StartFrame(false); - recovery.resume(); - return; - } + select_print.set(0); + HMI_ValueStruct.show_mode = 0; + HMI_StartFrame(false); + recovery.resume(); + return; + } + #endif DWIN_UpdateLCD(); } @@ -3563,7 +3588,7 @@ void DWIN_CompletedHoming(void) { } else if (checkkey == Back_Main) { HMI_ValueStruct.print_speed = feedrate_percentage = 100; - zprobe_zoffset = TERN0(BLTOUCH, probe.offset.z); + dwin_zoffset = TERN0(HAS_BED_PROBE, probe.offset.z); planner.finish_and_disable(); Goto_MainMenu(); } diff --git a/Marlin/src/lcd/dwin/e3v2/dwin.h b/Marlin/src/lcd/dwin/e3v2/dwin.h index dffd40bd03fb..e5d95f61661c 100644 --- a/Marlin/src/lcd/dwin/e3v2/dwin.h +++ b/Marlin/src/lcd/dwin/e3v2/dwin.h @@ -318,7 +318,7 @@ void HMI_MaxCornerXYZE(void); void HMI_StepXYZE(void); void update_variable(void); -void show_plus_or_minus(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); +void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); // SD Card void HMI_SDCardInit(void); diff --git a/Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp index e4c563cf6b98..dbbd356eff2d 100644 --- a/Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp +++ b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp @@ -20,15 +20,13 @@ * */ -/** - ****************************************************************************** - * @file rotary_encoder.cpp - * @author LEO / Creality3D - * @date 2019/07/06 - * @version 2.0.1 - * @brief 旋转编码器操作函数 - ****************************************************************************** -**/ +/***************************************************************************** + * @file rotary_encoder.cpp + * @author LEO / Creality3D + * @date 2019/07/06 + * @version 2.0.1 + * @brief Rotary encoder functions + *****************************************************************************/ #include "../../../inc/MarlinConfigPre.h" @@ -47,14 +45,14 @@ ENCODER_Rate EncoderRate; -/*蜂鸣器响*/ +// Buzzer void Encoder_tick(void) { WRITE(BEEPER_PIN, 1); delay(10); WRITE(BEEPER_PIN, 0); } -/*编码器初始化 PB12:Encoder_A PB13:Encoder_B PB14:Encoder_C*/ +// Encoder initialization void Encoder_Configuration(void) { #if BUTTON_EXISTS(EN1) SET_INPUT_PULLUP(BTN_EN1); @@ -70,8 +68,7 @@ void Encoder_Configuration(void) { #endif } -millis_t next_click_update_ms; -/*接收数据解析 返回值:ENCODER_DIFF_NO,无状态; ENCODER_DIFF_CW,顺时针旋转; ENCODER_DIFF_CCW,逆时针旋转; ENCODER_DIFF_ENTER,按下*/ +// Analyze encoder value and return state ENCODER_DiffState Encoder_ReceiveAnalyze(void) { const millis_t now = millis(); static unsigned char lastEncoderBits; @@ -82,6 +79,7 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) { if (BUTTON_PRESSED(EN1)) newbutton |= 0x01; if (BUTTON_PRESSED(EN2)) newbutton |= 0x02; if (BUTTON_PRESSED(ENC)) { + static millis_t next_click_update_ms; if (ELAPSED(now, next_click_update_ms)) { next_click_update_ms = millis() + 300; Encoder_tick(); @@ -127,15 +125,15 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) { // if must encoder rati multiplier if (EncoderRate.encoderRateEnabled) { - const float abs_diff = ABS(temp_diff); - const float encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP); + const float abs_diff = ABS(temp_diff), + encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP); if (EncoderRate.lastEncoderTime) { // Note that the rate is always calculated between two passes through the // loop and that the abs of the temp_diff value is tracked. const float encoderStepRate = encoderMovementSteps / float(ms - EncoderRate.lastEncoderTime) * 1000; - if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100; - else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10; - else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5; + if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100; + else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10; + else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5; } EncoderRate.lastEncoderTime = ms; } @@ -154,22 +152,22 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) { #if PIN_EXISTS(LCD_LED) - /*取低24位有效 24Bit: G7 G6 G5 G4 G3 G2 G1 G0 R7 R6 R5 R4 R3 R2 R1 R0 B7 B6 B5 B4 B3 B2 B1 B0*/ + // Take the low 24 valid bits 24Bit: G7 G6 G5 G4 G3 G2 G1 G0 R7 R6 R5 R4 R3 R2 R1 R0 B7 B6 B5 B4 B3 B2 B1 B0 unsigned int LED_DataArray[LED_NUM]; - /*LED灯操作*/ + // LED light operation void LED_Action(void) { LED_Control(RGB_SCALE_WARM_WHITE,0x0F); delay(30); LED_Control(RGB_SCALE_WARM_WHITE,0x00); } - /*LED初始化*/ + // LED initialization void LED_Configuration(void) { SET_OUTPUT(LCD_LED_PIN); } - /*LED写数据*/ + // LED write data void LED_WriteData(void) { unsigned char tempCounter_LED, tempCounter_Bit; for (tempCounter_LED = 0; tempCounter_LED < LED_NUM; tempCounter_LED++) { @@ -189,7 +187,9 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) { } } - /*LED控制 RGB_Scale:RGB色彩配比 luminance:亮度(0~0xFF)*/ + // LED control + // RGB_Scale: RGB color ratio + // luminance: brightness (0~0xFF) void LED_Control(unsigned char RGB_Scale, unsigned char luminance) { unsigned char temp_Counter; for (temp_Counter = 0; temp_Counter < LED_NUM; temp_Counter++) { @@ -203,7 +203,10 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) { LED_WriteData(); } - /*LED渐变控制 RGB_Scale:RGB色彩配比 luminance:亮度(0~0xFF) change_Time:渐变时间(ms)*/ + // LED gradient control + // RGB_Scale: RGB color ratio + // luminance: brightness (0~0xFF) + // change_Time: gradient time (ms) void LED_GraduallyControl(unsigned char RGB_Scale, unsigned char luminance, unsigned int change_Interval) { unsigned char temp_Counter; unsigned char LED_R_Data[LED_NUM], LED_G_Data[LED_NUM], LED_B_Data[LED_NUM]; @@ -246,6 +249,6 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void) { } } -#endif +#endif // LCD_LED #endif // DWIN_CREALITY_LCD diff --git a/Marlin/src/lcd/dwin/e3v2/rotary_encoder.h b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.h index db074098ebf1..fb8102f8b22a 100644 --- a/Marlin/src/lcd/dwin/e3v2/rotary_encoder.h +++ b/Marlin/src/lcd/dwin/e3v2/rotary_encoder.h @@ -21,15 +21,13 @@ */ #pragma once -/** - ****************************************************************************** +/***************************************************************************** * @file rotary_encoder.h * @author LEO / Creality3D * @date 2019/07/06 * @version 2.0.1 - * @brief 旋转编码器操作函数 - ****************************************************************************** -**/ + * @brief Rotary encoder functions + ****************************************************************************/ #include "../../../inc/MarlinConfig.h" #include "../../../MarlinCore.h" @@ -54,19 +52,18 @@ typedef struct { extern ENCODER_Rate EncoderRate; typedef enum { - ENCODER_DIFF_NO = 0, - ENCODER_DIFF_CW = 1, - ENCODER_DIFF_CCW = 2, - ENCODER_DIFF_ENTER = 3 + ENCODER_DIFF_NO = 0, // no state + ENCODER_DIFF_CW = 1, // clockwise rotation + ENCODER_DIFF_CCW = 2, // counterclockwise rotation + ENCODER_DIFF_ENTER = 3 // click } ENCODER_DiffState; -/*编码器初始化 PB12:Encoder_A PB13:Encoder_B PB14:Encoder_C*/ +// Encoder initialization void Encoder_Configuration(void); -/*接收数据解析 返回值:ENCODER_DIFF_NO,无状态; ENCODER_DIFF_CW,顺时针旋转; ENCODER_DIFF_CCW,逆时针旋转; ENCODER_DIFF_ENTER,按下*/ +// Analyze encoder value and return state ENCODER_DiffState Encoder_ReceiveAnalyze(void); - /*********************** Encoder LED ***********************/ #if PIN_EXISTS(LCD_LED) @@ -78,28 +75,30 @@ ENCODER_DiffState Encoder_ReceiveAnalyze(void); #define RGB_SCALE_R10_G7_B5 1 #define RGB_SCALE_R10_G7_B4 2 #define RGB_SCALE_R10_G8_B7 3 - #define RGB_SCALE_NEUTRAL_WHITE RGB_SCALE_R10_G7_B5 //正白 - #define RGB_SCALE_WARM_WHITE RGB_SCALE_R10_G7_B4 //暖白 - #define RGB_SCALE_COOL_WHITE RGB_SCALE_R10_G8_B7 //冷白 + #define RGB_SCALE_NEUTRAL_WHITE RGB_SCALE_R10_G7_B5 + #define RGB_SCALE_WARM_WHITE RGB_SCALE_R10_G7_B4 + #define RGB_SCALE_COOL_WHITE RGB_SCALE_R10_G8_B7 extern unsigned int LED_DataArray[LED_NUM]; - /*状态LED初始化*/ - void STATE_LED_Configuration(void); - - /*LED灯操作*/ + // LED light operation void LED_Action(void); - /*LED初始化*/ + // LED initialization void LED_Configuration(void); - /*LED写数据*/ + // LED write data void LED_WriteData(void); - /*LED控制 RGB_Scale:RGB色彩配比 luminance:亮度(0~0xFF)*/ + // LED control + // RGB_Scale: RGB color ratio + // luminance: brightness (0~0xFF) void LED_Control(unsigned char RGB_Scale, unsigned char luminance); - /*LED渐变控制 RGB_Scale:RGB色彩配比 luminance:亮度(0~0xFF) change_Time:渐变时间(ms)*/ + // LED gradient control + // RGB_Scale: RGB color ratio + // luminance: brightness (0~0xFF) + // change_Time: gradient time (ms) void LED_GraduallyControl(unsigned char RGB_Scale, unsigned char luminance, unsigned int change_Interval); -#endif +#endif // LCD_LED 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 index 3746f1cde0f5..266b6efdab1e 100644 --- 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 @@ -30,12 +30,12 @@ namespace FTDI { */ 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; + const int16_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; + int16_t lineWidth = 0; char *breakPoint = str; for(char* c = str; *c; c++) { lineWidth += fm.get_char_width(*c); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h index 3abc6fca2dc8..450b9c4415e0 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extras/poly_ui.h @@ -16,7 +16,7 @@ * GNU General Public License for more details. * * * * To view a copy of the GNU General Public License, go to the following * - * location: . * + * location: . * ****************************************************************************/ #pragma once @@ -36,7 +36,7 @@ * * PolyReader r(data, N_ELEMENTS(data)); * - * for(r.start();r.has_more(); r.next()) { + * for (r.start();r.has_more(); r.next()) { * uint16_t x = r.x; * uint16_t y = r.y; * @@ -107,8 +107,8 @@ class PolyReader { } } - bool has_more() {return p != NULL;} - bool end_of_loop() {return start_x == eol;} + bool has_more() { return p != NULL; } + bool end_of_loop() { return start_x == eol; } }; /** @@ -129,7 +129,7 @@ class TransformedPolyReader : public PolyReader { */ static constexpr uint8_t fract_bits = 5; typedef int16_t fix_t; - fix_t makefix(float f) {return f * (1 << fract_bits);} + fix_t makefix(float f) { return f * (1 << fract_bits); } // First two rows of 3x3 transformation matrix fix_t a, b, c; @@ -254,6 +254,13 @@ class GenericPolyUI { draw_mode_t mode; public: + enum ButtonStyle : uint8_t { + FILL = 1, + STROKE = 2, + SHADOW = 4, + REGULAR = 7 + }; + typedef POLY_READER poly_reader_t; GenericPolyUI(CommandProcessor &c, draw_mode_t what = BOTH) : cmd(c), mode(what) {} @@ -276,7 +283,7 @@ class GenericPolyUI { Polygon p(cmd); p.begin_fill(); p.begin_loop(); - for(r.start();r.has_more();r.next()) { + for (r.start();r.has_more();r.next()) { p(r.x * 16, r.y * 16); if (r.end_of_loop()) { p.end_loop(); @@ -306,7 +313,7 @@ class GenericPolyUI { Polygon p(cmd); p.begin_stroke(); p.begin_loop(); - for(r.start();r.has_more(); r.next()) { + for (r.start();r.has_more(); r.next()) { p(r.x * 16, r.y * 16); if (r.end_of_loop()) { p.end_loop(); @@ -323,7 +330,7 @@ class GenericPolyUI { int16_t y_min = INT16_MAX; int16_t x_max = INT16_MIN; int16_t y_max = INT16_MIN; - for(r.start(); r.has_more(); r.next()) { + for (r.start(); r.has_more(); r.next()) { x_min = min(x_min, int16_t(r.x)); x_max = max(x_max, int16_t(r.x)); y_min = min(y_min, int16_t(r.y)); @@ -355,11 +362,11 @@ class GenericPolyUI { btn_shadow_depth = depth; } - void button(const uint8_t tag, poly_reader_t r) { + void button(const uint8_t tag, poly_reader_t r, uint8_t style = REGULAR) { using namespace FTDI; // Draw the shadow #if FTDI_API_LEVEL >= 810 - if (mode & BACKGROUND) { + if (mode & BACKGROUND && style & SHADOW) { cmd.cmd(SAVE_CONTEXT()); cmd.cmd(TAG(tag)); cmd.cmd(VERTEX_TRANSLATE_X(btn_shadow_depth * 16)); @@ -381,11 +388,15 @@ class GenericPolyUI { #endif // Draw the fill and stroke cmd.cmd(TAG(tag)); - cmd.cmd(COLOR_RGB(btn_fill_color)); - fill(r, false); - cmd.cmd(COLOR_RGB(btn_stroke_color)); - cmd.cmd(LINE_WIDTH(btn_stroke_width)); - stroke(r); + if (style & FILL) { + cmd.cmd(COLOR_RGB(btn_fill_color)); + fill(r, false); + } + if (style & STROKE) { + cmd.cmd(COLOR_RGB(btn_stroke_color)); + cmd.cmd(LINE_WIDTH(btn_stroke_width)); + stroke(r); + } cmd.cmd(RESTORE_CONTEXT()); } } 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 f2971087c160..e465aa0b93a7 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 @@ -145,7 +145,8 @@ namespace Language_en { PROGMEM Language_Str MSG_TOUCH_CALIBRATION_PROMPT = u8"Touch the dots to calibrate"; PROGMEM Language_Str MSG_AUTOLEVEL_X_AXIS = u8"Level X Axis"; PROGMEM Language_Str MSG_BED_MAPPING_DONE = u8"Bed mapping finished"; - PROGMEM Language_Str MSG_RESET_BLTOUCH = u8"Reset BLTouch"; + PROGMEM Language_Str MSG_LEVELING = u8"Leveling"; + PROGMEM Language_Str MSG_SHOW_MESH = u8"Show Bed Mesh"; #ifdef TOUCH_UI_LULZBOT_BIO PROGMEM Language_Str MSG_MOVE_TO_HOME = u8"Move to Home"; 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 e06f9f3a29de..fe68faefee44 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 @@ -61,7 +61,9 @@ namespace ExtUI { if (AT_SCREEN(StatusScreen) || isPrintingFromMedia()) StatusScreen::setStatusMessage(GET_TEXT_F(MSG_MEDIA_REMOVED)); - if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen) + #if ENABLED(SDSUPPORT) + if (AT_SCREEN(FilesScreen)) GOTO_SCREEN(StatusScreen); + #endif } void onMediaError() { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp index 35040734b472..67b077a55323 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/advanced_settings_menu.cpp @@ -55,11 +55,11 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { #define ACCELERATION_POS BTN_POS(2,5), BTN_SIZE(1,1) #define ENDSTOPS_POS BTN_POS(1,6), BTN_SIZE(1,1) #define JERK_POS BTN_POS(2,6), BTN_SIZE(1,1) - #define OFFSETS_POS BTN_POS(1,7), BTN_SIZE(1,1) + #define CASE_LIGHT_POS BTN_POS(1,7), BTN_SIZE(1,1) #define BACKLASH_POS BTN_POS(2,7), BTN_SIZE(1,1) - #define CASE_LIGHT_POS BTN_POS(1,8), BTN_SIZE(1,1) + #define OFFSETS_POS BTN_POS(1,8), BTN_SIZE(1,1) #define TMC_HOMING_THRS_POS BTN_POS(2,8), BTN_SIZE(1,1) - #if EITHER(CASE_LIGHT_ENABLE, SENSORLESS_HOMING) + #if EITHER(HAS_MULTI_HOTEND, SENSORLESS_HOMING) #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1) #else #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1) @@ -98,8 +98,8 @@ void AdvancedSettingsMenu::onRedraw(draw_mode_t what) { .tag(13).button( TMC_CURRENT_POS, GET_TEXT_F(MSG_TMC_CURRENT)) .enabled(ENABLED(SENSORLESS_HOMING)) .tag(14).button( TMC_HOMING_THRS_POS, GET_TEXT_F(MSG_TMC_HOMING_THRS)) - .enabled(EITHER(HAS_MULTI_HOTEND, BLTOUCH)) - .tag(4) .button( OFFSETS_POS, GET_TEXT_F(TERN(HAS_MULTI_HOTEND, MSG_OFFSETS_MENU, MSG_RESET_BLTOUCH))) + .enabled(ENABLED(HAS_MULTI_HOTEND)) + .tag(4) .button( OFFSETS_POS, GET_TEXT_F(MSG_OFFSETS_MENU)) .enabled(EITHER(LIN_ADVANCE, FILAMENT_RUNOUT_SENSOR)) .tag(11).button( FILAMENT_POS, GET_TEXT_F(MSG_FILAMENT)) .tag(12).button( ENDSTOPS_POS, GET_TEXT_F(MSG_LCD_ENDSTOPS)) @@ -123,13 +123,9 @@ bool AdvancedSettingsMenu::onTouchEnd(uint8_t tag) { case 2: GOTO_SCREEN(ZOffsetScreen); break; #endif case 3: GOTO_SCREEN(StepsScreen); break; - case 4: - #if HAS_MULTI_HOTEND - GOTO_SCREEN(NozzleOffsetScreen); - #elif ENABLED(BLTOUCH) - injectCommands_P(PSTR("M280 P0 S60")); - #endif - break; + #if ENABLED(HAS_MULTI_HOTEND) + case 4: GOTO_SCREEN(NozzleOffsetScreen); break; + #endif case 5: GOTO_SCREEN(MaxVelocityScreen); break; case 6: GOTO_SCREEN(DefaultAccelerationScreen); break; case 7: GOTO_SCREEN(TERN(HAS_JUNCTION_DEVIATION, JunctionDeviationScreen, JerkScreen)); break; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp index 663555f05de7..eea2268c5b9c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_screen.cpp @@ -222,7 +222,8 @@ bool BedMeshScreen::tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y) { void BedMeshScreen::onEntry() { screen_data.BedMeshScreen.highlightedTag = 0; - screen_data.BedMeshScreen.count = 0; + screen_data.BedMeshScreen.count = GRID_MAX_POINTS; + screen_data.BedMeshScreen.showMappingDone = false; BaseScreen::onEntry(); } @@ -251,6 +252,10 @@ void BedMeshScreen::drawHighlightedPointValue() { .colors(action_btn) .tag(1).button( OKAY_POS, GET_TEXT_F(MSG_BUTTON_OKAY)) .tag(0); + + if (screen_data.BedMeshScreen.showMappingDone) { + cmd.text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); + } } void BedMeshScreen::onRedraw(draw_mode_t what) { @@ -270,17 +275,13 @@ void BedMeshScreen::onRedraw(draw_mode_t what) { if (what & FOREGROUND) { constexpr float autoscale_max_amplitude = 0.03; - const bool levelingFinished = screen_data.BedMeshScreen.count >= GRID_MAX_POINTS; - const float levelingProgress = sq(float(screen_data.BedMeshScreen.count) / GRID_MAX_POINTS); - if (levelingFinished) { + const bool gotAllPoints = screen_data.BedMeshScreen.count >= GRID_MAX_POINTS; + if (gotAllPoints) { drawHighlightedPointValue(); - CommandProcessor cmd; - cmd.font(Theme::font_medium) - .text(MESSAGE_POS, GET_TEXT_F(MSG_BED_MAPPING_DONE)); } - + const float levelingProgress = sq(float(screen_data.BedMeshScreen.count) / GRID_MAX_POINTS); BedMeshScreen::drawMesh(INSET_POS(MESH_POS), ExtUI::getMeshArray(), - USE_POINTS | USE_HIGHLIGHT | USE_AUTOSCALE | (levelingFinished ? USE_COLORS : 0), + USE_POINTS | USE_HIGHLIGHT | USE_AUTOSCALE | (gotAllPoints ? USE_COLORS : 0), autoscale_max_amplitude * levelingProgress ); } @@ -307,11 +308,29 @@ void BedMeshScreen::onMeshUpdate(const int8_t, const int8_t, const float) { } void BedMeshScreen::onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t state) { - if (state == ExtUI::PROBE_FINISH) { - screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y); - screen_data.BedMeshScreen.count++; + switch(state) { + case ExtUI::MESH_START: + screen_data.BedMeshScreen.count = 0; + screen_data.BedMeshScreen.showMappingDone = false; + break; + case ExtUI::MESH_FINISH: + screen_data.BedMeshScreen.count = GRID_MAX_POINTS; + screen_data.BedMeshScreen.showMappingDone = true; + break; + case ExtUI::PROBE_START: + screen_data.BedMeshScreen.highlightedTag = pointToTag(x, y); + break; + case ExtUI::PROBE_FINISH: + screen_data.BedMeshScreen.count++; + break; } BedMeshScreen::onMeshUpdate(x, y, 0); } +void BedMeshScreen::startMeshProbe() { + GOTO_SCREEN(BedMeshScreen); + screen_data.BedMeshScreen.count = 0; + injectCommands_P(PSTR(BED_LEVELING_COMMANDS)); +} + #endif // TOUCH_UI_FTDI_EVE && HAS_MESH diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp index 6d72fc92a2e4..e881995f2e69 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_status_screen.cpp @@ -29,7 +29,9 @@ #include "../ftdi_eve_lib/extras/poly_ui.h" -#ifdef TOUCH_UI_PORTRAIT +#if ENABLED(TOUCH_UI_COCOA_PRESS) + #include "cocoa_press_ui.h" +#elif ENABLED(TOUCH_UI_PORTRAIT) #include "bio_printer_ui_portrait.h" #else #include "bio_printer_ui_landscape.h" @@ -100,7 +102,7 @@ void StatusScreen::draw_temperature(draw_mode_t what) { // heating zones, but has no bed temperature cmd.cmd(COLOR_RGB(bg_text_enabled)); - cmd.font(font_medium); + cmd.font(font_xsmall); ui.bounds(POLY(h0_label), x, y, h, v); cmd.text(x, y, h, v, GET_TEXT_F(MSG_ZONE_1)); @@ -221,7 +223,7 @@ void StatusScreen::draw_syringe(draw_mode_t what) { ui.color(syringe_rgb); ui.fill(POLY(syringe_outline)); - ui.color(fill_rgb); + ui.color(fluid_rgb); ui.bounds(POLY(syringe_fluid), x, y, h, v); cmd.cmd(SAVE_CONTEXT()); cmd.cmd(SCISSOR_XY(x,y + v * (1.0 - fill_level))); @@ -245,23 +247,25 @@ void StatusScreen::draw_arrows(draw_mode_t what) { ui.button_stroke(stroke_rgb, 28); ui.button_shadow(shadow_rgb, shadow_depth); + constexpr uint8_t style = TERN(TOUCH_UI_COCOA_PRESS, PolyUI::FILL | PolyUI::SHADOW, PolyUI::REGULAR); + if ((what & BACKGROUND) || jog_xy) { - ui.button(1, POLY(x_neg)); - ui.button(2, POLY(x_pos)); - ui.button(3, POLY(y_neg)); - ui.button(4, POLY(y_pos)); + ui.button(1, POLY(x_neg), style); + ui.button(2, POLY(x_pos), style); + ui.button(3, POLY(y_neg), style); + ui.button(4, POLY(y_pos), style); } if ((what & BACKGROUND) || z_homed) { - ui.button(5, POLY(z_neg)); - ui.button(6, POLY(z_pos)); + ui.button(5, POLY(z_neg), style); + ui.button(6, POLY(z_pos), style); } if ((what & BACKGROUND) || e_homed) { #if DISABLED(TOUCH_UI_COCOA_PRESS) - ui.button(7, POLY(e_neg)); + ui.button(7, POLY(e_neg), style); #endif - ui.button(8, POLY(e_pos)); + ui.button(8, POLY(e_pos), style); } } @@ -300,13 +304,14 @@ void StatusScreen::draw_overlay_icons(draw_mode_t what) { PolyUI ui(cmd, what); if (what & FOREGROUND) { - ui.button_fill (fill_rgb); + ui.button_fill (TERN(TOUCH_UI_COCOA_PRESS, stroke_rgb, fill_rgb)); ui.button_stroke(stroke_rgb, 28); ui.button_shadow(shadow_rgb, shadow_depth); - if (!jog_xy) ui.button(12, POLY(padlock)); - if (!e_homed) ui.button(13, POLY(home_e)); - if (!z_homed) ui.button(14, POLY(home_z)); + constexpr uint8_t style = TERN(TOUCH_UI_COCOA_PRESS, PolyUI::FILL | PolyUI::SHADOW, PolyUI::REGULAR); + if (!jog_xy) ui.button(12, POLY(padlock), style); + if (!e_homed) ui.button(13, POLY(home_e), style); + if (!z_homed) ui.button(14, POLY(home_z), style); } } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.cpp index 575f75a74e9c..82ee118e4c68 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/filament_menu.cpp @@ -30,6 +30,22 @@ using namespace FTDI; using namespace ExtUI; using namespace Theme; +#ifdef TOUCH_UI_PORTRAIT + #define GRID_ROWS 9 + #define GRID_COLS 2 + #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) + #define RUNOUT_SENSOR_POS BTN_POS(1,2), BTN_SIZE(2,1) + #define LIN_ADVANCE_POS BTN_POS(1,3), BTN_SIZE(2,1) + #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1) +#else + #define GRID_ROWS 6 + #define GRID_COLS 2 + #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) + #define RUNOUT_SENSOR_POS BTN_POS(1,2), BTN_SIZE(2,1) + #define LIN_ADVANCE_POS BTN_POS(1,3), BTN_SIZE(2,1) + #define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1) +#endif + void FilamentMenu::onRedraw(draw_mode_t what) { if (what & BACKGROUND) { CommandProcessor cmd; @@ -41,47 +57,14 @@ void FilamentMenu::onRedraw(draw_mode_t what) { if (what & FOREGROUND) { CommandProcessor cmd; cmd.font(font_large) - #ifdef TOUCH_UI_PORTRAIT - #define GRID_ROWS 9 - #define GRID_COLS 2 - .text ( BTN_POS(1,1), BTN_SIZE(2,1), GET_TEXT_F(MSG_FILAMENT)) - .font(font_medium).colors(normal_btn) - .enabled( - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - 1 - #endif - ) - .tag(2).button( BTN_POS(1,2), BTN_SIZE(2,1), GET_TEXT_F(MSG_RUNOUT_SENSOR)) - .enabled( - #if ENABLED(LIN_ADVANCE) - 1 - #endif - ) - .tag(3).button( BTN_POS(1,3), BTN_SIZE(2,1), GET_TEXT_F(MSG_LINEAR_ADVANCE)) - .colors(action_btn) - .tag(1) .button( BTN_POS(1,9), BTN_SIZE(2,1), GET_TEXT_F(MSG_BACK)); - #undef GRID_COLS - #undef GRID_ROWS - #else - #define GRID_ROWS 6 - #define GRID_COLS 3 - .text ( BTN_POS(1,1), BTN_SIZE(3,1), GET_TEXT_F(MSG_FILAMENT)) - .font(font_medium).colors(normal_btn) - .enabled( - #if ENABLED(FILAMENT_RUNOUT_SENSOR) - 1 - #endif - ) - .tag(2).button( BTN_POS(1,2), BTN_SIZE(3,1), GET_TEXT_F(MSG_RUNOUT_SENSOR)) - .enabled( - #if ENABLED(LIN_ADVANCE) - 1 - #endif - ) - .tag(3).button( BTN_POS(1,3), BTN_SIZE(3,1), GET_TEXT_F(MSG_LINEAR_ADVANCE)) - .colors(action_btn) - .tag(1) .button( BTN_POS(1,6), BTN_SIZE(3,1), GET_TEXT_F(MSG_BACK)); - #endif + .text(TITLE_POS, GET_TEXT_F(MSG_FILAMENT)) + .font(font_medium).colors(normal_btn) + .enabled(ENABLED(FILAMENT_RUNOUT_SENSOR)) + .tag(2).button(RUNOUT_SENSOR_POS, GET_TEXT_F(MSG_RUNOUT_SENSOR)) + .enabled(ENABLED(LIN_ADVANCE)) + .tag(3).button(LIN_ADVANCE_POS, GET_TEXT_F(MSG_LINEAR_ADVANCE)) + .colors(action_btn) + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); } } 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 8d6fb1860394..dd0eb263d5fa 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 @@ -22,7 +22,7 @@ #include "../config.h" -#if ENABLED(TOUCH_UI_FTDI_EVE) +#if BOTH(TOUCH_UI_FTDI_EVE, SDSUPPORT) #include "screens.h" #include "screen_data.h" diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp new file mode 100644 index 000000000000..2eab27c6086b --- /dev/null +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/leveling_menu.cpp @@ -0,0 +1,121 @@ +/********************* + * leveling_menu.cpp * + *********************/ + +/**************************************************************************** + * Written By Mark Pelletier 2017 - Aleph Objects, Inc. * + * Written By Marcio Teixeira 2018 - 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 "../config.h" + +#if BOTH(TOUCH_UI_FTDI_EVE,HAS_LEVELING) + +#include "screens.h" + +#if BOTH(HAS_BED_PROBE,BLTOUCH) + #include "../../../../../feature/bltouch.h" +#endif + +using namespace FTDI; +using namespace ExtUI; +using namespace Theme; + +#ifdef TOUCH_UI_PORTRAIT + #define GRID_ROWS 9 + #define GRID_COLS 2 + #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) + #define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1) + #define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1) + #define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1) + #define BLTOUCH_TITLE_POS BTN_POS(1,6), BTN_SIZE(2,1) + #define BLTOUCH_RESET_POS BTN_POS(1,7), BTN_SIZE(1,1) + #define BLTOUCH_TEST_POS BTN_POS(2,7), BTN_SIZE(1,1) + #define BACK_POS BTN_POS(1,9), BTN_SIZE(2,1) +#else + #define GRID_ROWS 7 + #define GRID_COLS 2 + #define TITLE_POS BTN_POS(1,1), BTN_SIZE(2,1) + #define LEVEL_BED_POS BTN_POS(1,2), BTN_SIZE(2,1) + #define LEVEL_AXIS_POS BTN_POS(1,3), BTN_SIZE(2,1) + #define SHOW_MESH_POS BTN_POS(1,4), BTN_SIZE(2,1) + #define BLTOUCH_TITLE_POS BTN_POS(1,5), BTN_SIZE(2,1) + #define BLTOUCH_RESET_POS BTN_POS(1,6), BTN_SIZE(1,1) + #define BLTOUCH_TEST_POS BTN_POS(2,6), BTN_SIZE(1,1) + #define BACK_POS BTN_POS(1,7), BTN_SIZE(2,1) +#endif + +void LevelingMenu::onRedraw(draw_mode_t what) { + if (what & BACKGROUND) { + CommandProcessor cmd; + cmd.cmd(CLEAR_COLOR_RGB(Theme::bg_color)) + .cmd(CLEAR(true,true,true)) + .tag(0); + } + + if (what & FOREGROUND) { + CommandProcessor cmd; + cmd.font(font_large) + .text(TITLE_POS, GET_TEXT_F(MSG_LEVELING)) + .font(font_medium).colors(normal_btn) + .tag(2).button(LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED)) + .enabled( + #ifdef AXIS_LEVELING_COMMANDS + 1 + #endif + ) + .tag(3).button(LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) + .enabled(ENABLED(HAS_MESH)) + .tag(4).button(SHOW_MESH_POS, GET_TEXT_F(MSG_SHOW_MESH)); + #if ENABLED(BLTOUCH) + cmd.text(BLTOUCH_TITLE_POS, GET_TEXT_F(MSG_BLTOUCH)) + .tag(5).button(BLTOUCH_RESET_POS, GET_TEXT_F(MSG_BLTOUCH_RESET)) + .tag(6).button(BLTOUCH_TEST_POS, GET_TEXT_F(MSG_BLTOUCH_SELFTEST)); + #endif + cmd.colors(action_btn) + .tag(1).button(BACK_POS, GET_TEXT_F(MSG_BACK)); + } +} + +bool LevelingMenu::onTouchEnd(uint8_t tag) { + switch (tag) { + case 1: GOTO_PREVIOUS(); break; + case 2: + #ifndef BED_LEVELING_COMMANDS + #define BED_LEVELING_COMMANDS "G29" + #endif + #if HAS_MESH + BedMeshScreen::startMeshProbe(); + #else + SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS)); + #endif + break; + #ifdef AXIS_LEVELING_COMMANDS + case 3: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break; + #endif + #if HAS_MESH + case 4: GOTO_SCREEN(BedMeshScreen); break; + #endif + #if ENABLED(BLTOUCH) + case 5: injectCommands_P(PSTR("M280 P0 S60")); break; + case 6: SpinnerDialogBox::enqueueAndWait_P(F("M280 P0 S90\nG4 P100\nM280 P0 S120")); break; + #endif + default: return false; + } + return true; +} + +#endif // BOTH(TOUCH_UI_FTDI_EVE,HAS_LEVELING) diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp index dfb23daa528f..53e3ab00c736 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/main_menu.cpp @@ -44,15 +44,14 @@ void MainMenu::onRedraw(draw_mode_t what) { #define ADVANCED_SETTINGS_POS BTN_POS(1,2), BTN_SIZE(2,1) #define FILAMENTCHANGE_POS BTN_POS(1,3), BTN_SIZE(2,1) #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(2,1) - #define MOVE_AXIS_POS BTN_POS(1,5), BTN_SIZE(1,1) - #define DISABLE_STEPPERS_POS BTN_POS(2,5), BTN_SIZE(1,1) - #define AUTO_HOME_POS BTN_POS(1,6), BTN_SIZE(1,1) - #define CLEAN_NOZZLE_POS BTN_POS(2,6), BTN_SIZE(1,1) - #define LEVEL_BED_POS BTN_POS(1,7), BTN_SIZE(1,1) - #define LEVEL_AXIS_POS BTN_POS(2,7), BTN_SIZE(1,1) + #define DISABLE_STEPPERS_POS BTN_POS(1,5), BTN_SIZE(2,1) + #define MOVE_AXIS_POS BTN_POS(1,6), BTN_SIZE(1,1) + #define LEVELING_POS BTN_POS(2,6), BTN_SIZE(1,1) + #define AUTO_HOME_POS BTN_POS(1,7), BTN_SIZE(1,1) + #define CLEAN_NOZZLE_POS BTN_POS(2,7), BTN_SIZE(1,1) #define BACK_POS BTN_POS(1,8), BTN_SIZE(2,1) #else - #define GRID_ROWS 6 + #define GRID_ROWS 5 #define GRID_COLS 2 #define ADVANCED_SETTINGS_POS BTN_POS(1,1), BTN_SIZE(1,1) #define ABOUT_PRINTER_POS BTN_POS(2,1), BTN_SIZE(1,1) @@ -62,9 +61,8 @@ void MainMenu::onRedraw(draw_mode_t what) { #define DISABLE_STEPPERS_POS BTN_POS(2,3), BTN_SIZE(1,1) #define TEMPERATURE_POS BTN_POS(1,4), BTN_SIZE(1,1) #define FILAMENTCHANGE_POS BTN_POS(2,4), BTN_SIZE(1,1) - #define LEVEL_BED_POS BTN_POS(1,5), BTN_SIZE(1,1) - #define LEVEL_AXIS_POS BTN_POS(2,5), BTN_SIZE(1,1) - #define BACK_POS BTN_POS(1,6), BTN_SIZE(2,1) + #define LEVELING_POS BTN_POS(1,5), BTN_SIZE(1,1) + #define BACK_POS BTN_POS(2,5), BTN_SIZE(1,1) #endif if (what & FOREGROUND) { @@ -100,24 +98,13 @@ void MainMenu::onRedraw(draw_mode_t what) { #endif )) .tag(8).button( ADVANCED_SETTINGS_POS, GET_TEXT_F(MSG_ADVANCED_SETTINGS)) - .enabled( - #ifdef PRINTCOUNTER - 1 - #endif - ) - .enabled( - #ifdef AXIS_LEVELING_COMMANDS - 1 - #endif - ) - .tag(9).button( LEVEL_AXIS_POS, GET_TEXT_F(MSG_AUTOLEVEL_X_AXIS)) .enabled( #ifdef HAS_LEVELING 1 #endif ) - .tag(10).button( LEVEL_BED_POS, GET_TEXT_F(MSG_LEVEL_BED)) - .tag(11).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) + .tag(9).button( LEVELING_POS, GET_TEXT_F(MSG_LEVELING)) + .tag(10).button( ABOUT_PRINTER_POS, GET_TEXT_F(MSG_INFO_MENU)) .colors(action_btn) .tag(1).button( BACK_POS, GET_TEXT_F(MSG_BACK)); } @@ -143,23 +130,10 @@ bool MainMenu::onTouchEnd(uint8_t tag) { case 7: GOTO_SCREEN(ChangeFilamentScreen); break; #endif case 8: GOTO_SCREEN(AdvancedSettingsMenu); break; - #ifdef AXIS_LEVELING_COMMANDS - case 9: SpinnerDialogBox::enqueueAndWait_P(F(AXIS_LEVELING_COMMANDS)); break; - #endif - #if HAS_LEVELING - case 10: - #ifndef BED_LEVELING_COMMANDS - #define BED_LEVELING_COMMANDS "G29" - #endif - #if HAS_MESH - GOTO_SCREEN(BedMeshScreen); - injectCommands_P(PSTR(BED_LEVELING_COMMANDS)); - #else - SpinnerDialogBox::enqueueAndWait_P(F(BED_LEVELING_COMMANDS)); - #endif - break; + #ifdef HAS_LEVELING + case 9: GOTO_SCREEN(LevelingMenu); break; #endif - case 11: GOTO_SCREEN(AboutScreen); break; + case 10: GOTO_SCREEN(AboutScreen); break; default: return false; } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h index 207277b824be..39e9ce4bc568 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screen_data.h @@ -62,6 +62,7 @@ union screen_data_t { } MoveAxisScreen; #if HAS_MESH struct { + bool showMappingDone; uint8_t count; uint8_t highlightedTag; } BedMeshScreen; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp index 01438aeb947f..16aa68216842 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/screens.cpp @@ -55,9 +55,6 @@ SCREEN_TABLE { #endif #if ENABLED(BABYSTEPPING) DECL_SCREEN(NudgeNozzleScreen), -#endif -#if HAS_MESH - DECL_SCREEN(BedMeshScreen), #endif DECL_SCREEN(MoveAxisScreen), DECL_SCREEN(StepsScreen), @@ -65,8 +62,14 @@ SCREEN_TABLE { DECL_SCREEN(StepperCurrentScreen), DECL_SCREEN(StepperBumpSensitivityScreen), #endif -#if HAS_BED_PROBE - DECL_SCREEN(ZOffsetScreen), +#if HAS_LEVELING + DECL_SCREEN(LevelingMenu), + #if HAS_BED_PROBE + DECL_SCREEN(ZOffsetScreen), + #endif + #if HAS_MESH + DECL_SCREEN(BedMeshScreen), + #endif #endif #if HAS_MULTI_HOTEND DECL_SCREEN(NozzleOffsetScreen), @@ -100,7 +103,9 @@ SCREEN_TABLE { DECL_SCREEN(InterfaceSettingsScreen), DECL_SCREEN(InterfaceSoundsScreen), DECL_SCREEN(LockScreen), +#if ENABLED(SDSUPPORT) DECL_SCREEN(FilesScreen), +#endif DECL_SCREEN(EndstopStatesScreen), #if ENABLED(TOUCH_UI_LULZBOT_BIO) DECL_SCREEN(BioPrintingDialogBox), 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 ae48f752406e..ec8df2760789 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 @@ -39,24 +39,37 @@ enum { STATUS_SCREEN_CACHE, MENU_SCREEN_CACHE, TUNE_SCREEN_CACHE, - ADJUST_OFFSETS_SCREEN_CACHE, ALERT_BOX_CACHE, SPINNER_CACHE, ADVANCED_SETTINGS_SCREEN_CACHE, MOVE_AXIS_SCREEN_CACHE, TEMPERATURE_SCREEN_CACHE, STEPS_SCREEN_CACHE, - STEPPER_CURRENT_SCREEN_CACHE, - STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE, - ZOFFSET_SCREEN_CACHE, - NOZZLE_OFFSET_SCREEN_CACHE, - BACKLASH_COMPENSATION_SCREEN_CACHE, MAX_FEEDRATE_SCREEN_CACHE, MAX_VELOCITY_SCREEN_CACHE, MAX_ACCELERATION_SCREEN_CACHE, DEFAULT_ACCELERATION_SCREEN_CACHE, -#if HAS_MESH - BED_MESH_SCREEN_CACHE, +#if HAS_LEVELING + LEVELING_SCREEN_CACHE, + #if HAS_BED_PROBE + ZOFFSET_SCREEN_CACHE, + #endif + #if HAS_MESH + BED_MESH_SCREEN_CACHE, + #endif +#endif +#if ENABLED(BABYSTEPPING) + ADJUST_OFFSETS_SCREEN_CACHE, +#endif +#if HAS_TRINAMIC_CONFIG + STEPPER_CURRENT_SCREEN_CACHE, + STEPPER_BUMP_SENSITIVITY_SCREEN_CACHE, +#endif +#if HAS_MULTI_HOTEND + NOZZLE_OFFSET_SCREEN_CACHE, +#endif +#if ENABLED(BACKLASH_GCODE) + BACKLASH_COMPENSATION_SCREEN_CACHE, #endif #if HAS_JUNCTION_DEVIATION JUNC_DEV_SCREEN_CACHE, @@ -81,12 +94,14 @@ enum { #if ENABLED(TOUCH_UI_COCOA_PRESS) PREHEAT_MENU_CACHE, PREHEAT_TIMER_SCREEN_CACHE, +#endif +#if ENABLED(SDSUPPORT) + FILES_SCREEN_CACHE, #endif CHANGE_FILAMENT_SCREEN_CACHE, INTERFACE_SETTINGS_SCREEN_CACHE, INTERFACE_SOUNDS_SCREEN_CACHE, LOCK_SCREEN_CACHE, - FILES_SCREEN_CACHE, DISPLAY_TIMINGS_SCREEN_CACHE }; @@ -133,33 +148,6 @@ class AboutScreen : public BaseScreen, public UncachedScreen { static bool onTouchEnd(uint8_t tag); }; -#if HAS_MESH -class BedMeshScreen : public BaseScreen, public CachedScreen { - private: - enum MeshOpts { - USE_POINTS = 0x01, - USE_COLORS = 0x02, - USE_TAGS = 0x04, - USE_HIGHLIGHT = 0x08, - USE_AUTOSCALE = 0x10 - }; - - static uint8_t pointToTag(uint8_t x, uint8_t y); - static bool tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y); - static float getHightlightedValue(); - static void drawHighlightedPointValue(); - static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1); - - public: - static void onMeshUpdate(const int8_t x, const int8_t y, const float val); - static void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t); - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchStart(uint8_t tag); - static bool onTouchEnd(uint8_t tag); -}; -#endif - #if ENABLED(PRINTCOUNTER) class StatisticsScreen : public BaseScreen, public UncachedScreen { public: @@ -505,21 +493,58 @@ class StepsScreen : public BaseNumericAdjustmentScreen, public CachedScreen { +#if HAS_MULTI_HOTEND + class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen { public: + static void onEntry(); static void onRedraw(draw_mode_t); static bool onTouchHeld(uint8_t tag); }; #endif -#if HAS_MULTI_HOTEND - class NozzleOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen { +#if HAS_LEVELING + class LevelingMenu : public BaseScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + }; + + #if HAS_BED_PROBE + class ZOffsetScreen : public BaseNumericAdjustmentScreen, public CachedScreen { + public: + static void onRedraw(draw_mode_t); + static bool onTouchHeld(uint8_t tag); + }; + #endif + + #if HAS_MESH + class BedMeshScreen : public BaseScreen, public CachedScreen { + private: + enum MeshOpts { + USE_POINTS = 0x01, + USE_COLORS = 0x02, + USE_TAGS = 0x04, + USE_HIGHLIGHT = 0x08, + USE_AUTOSCALE = 0x10 + }; + + static uint8_t pointToTag(uint8_t x, uint8_t y); + static bool tagToPoint(uint8_t tag, uint8_t &x, uint8_t &y); + static float getHightlightedValue(); + static void drawHighlightedPointValue(); + static void drawMesh(int16_t x, int16_t y, int16_t w, int16_t h, ExtUI::bed_mesh_t data, uint8_t opts, float autoscale_max = 0.1); + public: + static void onMeshUpdate(const int8_t x, const int8_t y, const float val); + static void onMeshUpdate(const int8_t x, const int8_t y, const ExtUI::probe_state_t); static void onEntry(); static void onRedraw(draw_mode_t); - static bool onTouchHeld(uint8_t tag); + static bool onTouchStart(uint8_t tag); + static bool onTouchEnd(uint8_t tag); + + static void startMeshProbe(); }; + #endif #endif #if ENABLED(BABYSTEPPING) @@ -707,40 +732,42 @@ class LockScreen : public BaseScreen, public CachedScreen { static bool onTouchEnd(uint8_t tag); }; -class FilesScreen : public BaseScreen, public CachedScreen { - private: - #ifdef TOUCH_UI_PORTRAIT - static constexpr uint8_t header_h = 2; - static constexpr uint8_t footer_h = 2; - static constexpr uint8_t files_per_page = 11; - #else - static constexpr uint8_t header_h = 1; - static constexpr uint8_t footer_h = 1; - static constexpr uint8_t files_per_page = 6; - #endif - - static uint8_t getTagForLine(uint8_t line) {return line + 2;} - static uint8_t getLineForTag(uint8_t tag) {return tag - 2;} - static uint16_t getFileForTag(uint8_t tag); - static uint16_t getSelectedFileIndex(); - - inline static const char *getSelectedShortFilename() {return getSelectedFilename(false);} - inline static const char *getSelectedLongFilename() {return getSelectedFilename(true);} - static const char *getSelectedFilename(bool longName); - - static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted); - static void drawFileList(); - static void drawHeader(); - static void drawFooter(); - static void drawSelectedFile(); - - static void gotoPage(uint8_t); - public: - static void onEntry(); - static void onRedraw(draw_mode_t); - static bool onTouchEnd(uint8_t tag); - static void onIdle(); -}; +#if ENABLED(SDSUPPORT) + class FilesScreen : public BaseScreen, public CachedScreen { + private: + #ifdef TOUCH_UI_PORTRAIT + static constexpr uint8_t header_h = 2; + static constexpr uint8_t footer_h = 2; + static constexpr uint8_t files_per_page = 11; + #else + static constexpr uint8_t header_h = 1; + static constexpr uint8_t footer_h = 1; + static constexpr uint8_t files_per_page = 6; + #endif + + static uint8_t getTagForLine(uint8_t line) {return line + 2;} + static uint8_t getLineForTag(uint8_t tag) {return tag - 2;} + static uint16_t getFileForTag(uint8_t tag); + static uint16_t getSelectedFileIndex(); + + inline static const char *getSelectedShortFilename() {return getSelectedFilename(false);} + inline static const char *getSelectedLongFilename() {return getSelectedFilename(true);} + static const char *getSelectedFilename(bool longName); + + static void drawFileButton(const char* filename, uint8_t tag, bool is_dir, bool is_highlighted); + static void drawFileList(); + static void drawHeader(); + static void drawFooter(); + static void drawSelectedFile(); + + static void gotoPage(uint8_t); + public: + static void onEntry(); + static void onRedraw(draw_mode_t); + static bool onTouchEnd(uint8_t tag); + static void onIdle(); + }; +#endif class EndstopStatesScreen : public BaseScreen, public UncachedScreen { public: 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 f2524c7982f1..6b258b53893b 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 @@ -376,7 +376,9 @@ bool StatusScreen::onTouchEnd(uint8_t tag) { using namespace ExtUI; switch (tag) { - case 3: GOTO_SCREEN(FilesScreen); break; + #if ENABLED(SDSUPPORT) + case 3: GOTO_SCREEN(FilesScreen); break; + #endif case 4: if (isPrinting()) { GOTO_SCREEN(TuneMenu); diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h index f99c0fd3ebcd..84639b59e12c 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/theme/colors.h @@ -124,7 +124,13 @@ namespace Theme { constexpr uint32_t shadow_rgb = gray_color_6; constexpr uint32_t stroke_rgb = accent_color_1; constexpr uint32_t fill_rgb = accent_color_3; - constexpr uint32_t syringe_rgb = accent_color_5; + #if ENABLED(TOUCH_UI_COCOA_PRESS) + constexpr uint32_t syringe_rgb = 0xFFFFFF; + constexpr uint32_t fluid_rgb = accent_color_5; + #else + constexpr uint32_t syringe_rgb = accent_color_5; + constexpr uint32_t fluid_rgb = accent_color_3; + #endif #if ENABLED(TOUCH_UI_ROYAL_THEME) constexpr uint32_t x_axis = hsl_to_rgb(0, 1.00, 0.26); diff --git a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp index 979c916e5cad..9d3adc1bab93 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/SPIFlashStorage.cpp @@ -27,8 +27,6 @@ #include "../../../../inc/MarlinConfig.h" #include "SPIFlashStorage.h" -extern W25QXXFlash W25QXX; - uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize]; uint32_t SPIFlashStorage::m_currentPage; uint16_t SPIFlashStorage::m_pageDataUsed; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp index ff9d0518d378..6bdea3fd2101 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp +++ b/Marlin/src/lcd/extui/lib/mks_ui/draw_ui.cpp @@ -49,7 +49,6 @@ #include "../../../../feature/pause.h" #endif -W25QXXFlash W25QXX; CFG_ITMES gCfgItems; UI_CFG uiCfg; DISP_STATE_STACK disp_state_stack; diff --git a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h index 4d9d08a9b4e3..f1086fd1b941 100644 --- a/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h +++ b/Marlin/src/lcd/extui/lib/mks_ui/pic_manager.h @@ -156,8 +156,6 @@ extern void spi_flash_read_test(); extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize); extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize); -extern W25QXXFlash W25QXX; - #ifdef __cplusplus } /* C-declarations for C++ */ #endif diff --git a/Marlin/src/lcd/extui/ui_api.cpp b/Marlin/src/lcd/extui/ui_api.cpp index 31449fcef4c7..1637d32877e4 100644 --- a/Marlin/src/lcd/extui/ui_api.cpp +++ b/Marlin/src/lcd/extui/ui_api.cpp @@ -223,7 +223,7 @@ namespace ExtUI { bool isHeaterIdle(const extruder_t extruder) { #if HAS_HOTEND && HEATER_IDLE_HANDLER - return thermalManager.hotend_idle[extruder - E0].timed_out; + return thermalManager.heater_idle[extruder - E0].timed_out; #else UNUSED(extruder); return false; @@ -233,10 +233,10 @@ namespace ExtUI { bool isHeaterIdle(const heater_t heater) { #if HEATER_IDLE_HANDLER switch (heater) { - TERN_(HAS_HEATED_BED, case BED: return thermalManager.bed_idle.timed_out); + TERN_(HAS_HEATED_BED, case BED: return thermalManager.heater_idle[thermalManager.IDLE_INDEX_BED].timed_out); TERN_(HAS_HEATED_CHAMBER, case CHAMBER: return false); // Chamber has no idle timer default: - return TERN0(HAS_HOTEND, thermalManager.hotend_idle[heater - H0].timed_out); + return TERN0(HAS_HOTEND, thermalManager.heater_idle[heater - H0].timed_out); } #else UNUSED(heater); @@ -544,11 +544,13 @@ namespace ExtUI { void setAxisSteps_per_mm(const float value, const axis_t axis) { planner.settings.axis_steps_per_mm[axis] = value; + planner.refresh_positioning(); } void setAxisSteps_per_mm(const float value, const extruder_t extruder) { UNUSED_E(extruder); planner.settings.axis_steps_per_mm[E_AXIS_N(extruder - E0)] = value; + planner.refresh_positioning(); } feedRate_t getAxisMaxFeedrate_mm_s(const axis_t axis) { @@ -580,11 +582,13 @@ namespace ExtUI { void setAxisMaxAcceleration_mm_s2(const float value, const axis_t axis) { planner.set_max_acceleration(axis, value); + planner.reset_acceleration_rates(); } void setAxisMaxAcceleration_mm_s2(const float value, const extruder_t extruder) { UNUSED_E(extruder); planner.set_max_acceleration(E_AXIS_N(extruder - E0), value); + planner.reset_acceleration_rates(); } #if HAS_FILAMENT_SENSOR @@ -755,7 +759,7 @@ namespace ExtUI { if (WITHIN(value, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) probe.offset.z = value; #elif ENABLED(BABYSTEP_DISPLAY_TOTAL) - babystep.add_mm(Z_AXIS, (value - getZOffset_mm())); + babystep.add_mm(Z_AXIS, value - getZOffset_mm()); #else UNUSED(value); #endif @@ -864,7 +868,7 @@ namespace ExtUI { } void startPIDTune(const float temp, extruder_t tool) { - thermalManager.PID_autotune(temp, (heater_ind_t)tool, 8, true); + thermalManager.PID_autotune(temp, (heater_id_t)tool, 8, true); } #endif @@ -1003,7 +1007,7 @@ namespace ExtUI { bool FileList::seek(const uint16_t pos, const bool skip_range_check) { #if ENABLED(SDSUPPORT) if (!skip_range_check && (pos + 1) > count()) return false; - card.getfilename_sorted(pos); + card.getfilename_sorted(SD_ORDER(pos, count())); return card.filename[0] != '\0'; #else UNUSED(pos); diff --git a/Marlin/src/lcd/extui/ui_api.h b/Marlin/src/lcd/extui/ui_api.h index ca12d79a8bc9..02c4717d77f4 100644 --- a/Marlin/src/lcd/extui/ui_api.h +++ b/Marlin/src/lcd/extui/ui_api.h @@ -143,7 +143,12 @@ namespace ExtUI { void onMeshUpdate(const int8_t xpos, const int8_t ypos, const float zval); inline void onMeshUpdate(const xy_int8_t &pos, const float zval) { onMeshUpdate(pos.x, pos.y, zval); } - typedef enum : unsigned char { PROBE_START, PROBE_FINISH } probe_state_t; + typedef enum : unsigned char { + MESH_START, // Prior to start of probe + MESH_FINISH, // Following probe of all points + PROBE_START, // Beginning probe of grid location + PROBE_FINISH // Finished probe of grid location + } probe_state_t; void onMeshUpdate(const int8_t xpos, const int8_t ypos, probe_state_t state); inline void onMeshUpdate(const xy_int8_t &pos, probe_state_t state) { onMeshUpdate(pos.x, pos.y, state); } #endif diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index 069a8e5a55a0..b11a3686cb46 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -410,10 +410,6 @@ namespace Language_cz { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("TEPL. ÚNIK KOMORA"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("VYSOKÁ TEPLOTA"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("NÍZKA TEPLOTA"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("VYS. TEPL. PODL."); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("NÍZ. TEPL. PODL."); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Err: MAXTEMP KOMORA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Err: MINTEMP KOMORA"); PROGMEM Language_Str MSG_HALTED = _UxGT("TISK. ZASTAVENA"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Proveďte reset"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); @@ -501,7 +497,6 @@ namespace Language_cz { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Délka mm senz.fil."); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Parkování selhalo"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Kalibrace selhala"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Moc studený"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("VYBERTE FILAMENT"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_da.h b/Marlin/src/lcd/language/language_da.h index 7a9321d001d1..da282be0b40f 100644 --- a/Marlin/src/lcd/language/language_da.h +++ b/Marlin/src/lcd/language/language_da.h @@ -52,7 +52,7 @@ namespace Language_da { #if PREHEAT_COUNT PROGMEM Language_Str MSG_PREHEAT_1 = _UxGT("Forvarm ") PREHEAT_1_LABEL; PROGMEM Language_Str MSG_PREHEAT_1_H = _UxGT("Forvarm ") PREHEAT_1_LABEL " ~"; - PROGMEM Language_Str MSG_PREHEAT_1_END = _UxGT("Forvarm ") PREHEAT_1_LABEL _UxGT(" end") + PROGMEM Language_Str MSG_PREHEAT_1_END = _UxGT("Forvarm ") PREHEAT_1_LABEL _UxGT(" end"); PROGMEM Language_Str MSG_PREHEAT_1_END_E = _UxGT("Forvarm ") PREHEAT_1_LABEL _UxGT(" end ~"); PROGMEM Language_Str MSG_PREHEAT_1_ALL = _UxGT("Forvarm ") PREHEAT_1_LABEL _UxGT(" Alle"); PROGMEM Language_Str MSG_PREHEAT_1_BEDONLY = _UxGT("Forvarm ") PREHEAT_1_LABEL _UxGT(" Bed"); @@ -60,7 +60,7 @@ namespace Language_da { PROGMEM Language_Str MSG_PREHEAT_M = _UxGT("Forvarm $"); PROGMEM Language_Str MSG_PREHEAT_M_H = _UxGT("Forvarm $ ~"); - PROGMEM Language_Str MSG_PREHEAT_M_END = _UxGT("Forvarm $ end") + PROGMEM Language_Str MSG_PREHEAT_M_END = _UxGT("Forvarm $ end"); PROGMEM Language_Str MSG_PREHEAT_M_END_E = _UxGT("Forvarm $ end ~"); PROGMEM Language_Str MSG_PREHEAT_M_ALL = _UxGT("Forvarm $ Alle"); PROGMEM Language_Str MSG_PREHEAT_M_BEDONLY = _UxGT("Forvarm $ Bed"); @@ -142,8 +142,6 @@ namespace Language_da { PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("Temp løber løbsk"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Fejl: Maks temp"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Fejl: Min temp"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Fejl: Maks Plade temp"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Fejl: Min Plade temp"); PROGMEM Language_Str MSG_HALTED = _UxGT("PRINTER STOPPET"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Reset Venligst"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // Kun et bogstav diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 84b304c242be..875444c0e7fe 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -452,10 +452,6 @@ namespace Language_de { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("GEH.") " " LCD_STR_THERMOMETER _UxGT(" NICHT ERREICHT"); PROGMEM Language_Str MSG_ERR_MAXTEMP = " " LCD_STR_THERMOMETER _UxGT(" ÜBERSCHRITTEN"); PROGMEM Language_Str MSG_ERR_MINTEMP = " " LCD_STR_THERMOMETER _UxGT(" UNTERSCHRITTEN"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("BETT ") LCD_STR_THERMOMETER _UxGT(" ÜBERSCHRITTEN"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("BETT ") LCD_STR_THERMOMETER _UxGT(" UNTERSCHRITTEN"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Err:Gehäuse max Temp"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Err:Gehäuse min Temp"); PROGMEM Language_Str MSG_HALTED = _UxGT("DRUCKER GESTOPPT"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Bitte neustarten"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("t"); // One character only @@ -536,7 +532,6 @@ namespace Language_de { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout-Weg mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Homing gescheitert"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Probing gescheitert"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: zu kalt"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("FILAMENT WÄHLEN"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_el.h b/Marlin/src/lcd/language/language_el.h index cee8dd0e55d5..8fe888765331 100644 --- a/Marlin/src/lcd/language/language_el.h +++ b/Marlin/src/lcd/language/language_el.h @@ -180,8 +180,6 @@ namespace Language_el { PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("ΔΙΑΦΥΓΗ ΘΕΡΜΟΚΡΑΣΙΑΣ"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("ΠΕΡΙΤΗ ΘΕΡΜΟΚΡΑΣΙΑ"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("ΜΗ ΕΠΑΡΚΗΣ ΘΕΡΜΟΚΡΑΣΙΑΣ"); //SHORTEN - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("ΜΕΓΙΣΤΗ ΘΕΡΜΟΚΡΑΣΙΑΣ ΕΠ. ΕΚΤΥΠΩΣΗΣ"); //SHORTEN - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("ΕΛΑΧΙΣΤΗ ΘΕΡΜΟΚΡΑΣΙΑΣ ΕΠ. ΕΚΤΥΠΩΣΗΣ"); //SHORTEN PROGMEM Language_Str MSG_HALTED = _UxGT("H εκτύπωση διακόπηκε"); PROGMEM Language_Str MSG_HEATING = _UxGT("Θερμαίνεται…"); PROGMEM Language_Str MSG_BED_HEATING = _UxGT("Θέρμανση ΕΠ. Εκτύπωσης"); //SHORTEN diff --git a/Marlin/src/lcd/language/language_el_gr.h b/Marlin/src/lcd/language/language_el_gr.h index d7bead9ea669..ad170a348721 100644 --- a/Marlin/src/lcd/language/language_el_gr.h +++ b/Marlin/src/lcd/language/language_el_gr.h @@ -182,8 +182,6 @@ namespace Language_el_gr { PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("ΔΙΑΦΥΓΗ ΘΕΡΜΟΤΗΤΑΣ"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Λάθος: ΜΕΓΙΣΤΗ ΘΕΡΜΟΤΗΤΑ"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Λάθος: ΕΛΑΧΙΣΤΗ ΘΕΡΜΟΤΗΤΑ"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Λάθος: ΜΕΓΙΣΤΗ ΘΕΡΜΟΤΗΤΑ ΚΛΙΝΗΣ"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Λάθος: ΕΛΑΧΙΣΤΗ ΘΕΡΜΟΤΗΤΑ ΚΛΙΝΗΣ"); PROGMEM Language_Str MSG_HEATING = _UxGT("Θερμαίνεται…"); PROGMEM Language_Str MSG_BED_HEATING = _UxGT("Θέρμανση κλίνης…"); PROGMEM Language_Str MSG_DELTA_CALIBRATE = _UxGT("Βαθμονόμηση Delta"); diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index 8ae40304bdf3..fc9e065abe0d 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -457,10 +457,6 @@ namespace Language_en { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("CHAMBER T. RUNAWAY"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Err: MAXTEMP"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Err: MINTEMP"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Err: MAXTEMP BED"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Err: MINTEMP BED"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Err: MAXTEMP CHAMBER"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Err: MINTEMP CHAMBER"); PROGMEM Language_Str MSG_HALTED = _UxGT("PRINTER HALTED"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Please Reset"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only @@ -470,6 +466,8 @@ namespace Language_en { PROGMEM Language_Str MSG_COOLING = _UxGT("Cooling..."); PROGMEM Language_Str MSG_BED_HEATING = _UxGT("Bed Heating..."); PROGMEM Language_Str MSG_BED_COOLING = _UxGT("Bed Cooling..."); + PROGMEM Language_Str MSG_PROBE_HEATING = _UxGT("Probe Heating..."); + PROGMEM Language_Str MSG_PROBE_COOLING = _UxGT("Probe Cooling..."); PROGMEM Language_Str MSG_CHAMBER_HEATING = _UxGT("Chamber Heating..."); PROGMEM Language_Str MSG_CHAMBER_COOLING = _UxGT("Chamber Cooling..."); PROGMEM Language_Str MSG_DELTA_CALIBRATE = _UxGT("Delta Calibration"); @@ -541,7 +539,6 @@ namespace Language_en { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout Dist mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Homing Failed"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Probing Failed"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Too Cold"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("CHOOSE FILAMENT"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_es.h b/Marlin/src/lcd/language/language_es.h index 5beab6c1c90f..15fa35ac75f5 100644 --- a/Marlin/src/lcd/language/language_es.h +++ b/Marlin/src/lcd/language/language_es.h @@ -421,10 +421,6 @@ namespace Language_es { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("FUGA TÉRMICA CAMARA"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Err:TEMP. MÁX"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Err:TEMP. MIN"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Err:TEMP. MÁX CAMA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Err:TEMP. MIN CAMA"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Err:TEMP. MÁX CÁMARA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Err:TEMP. MIN CÁMARA"); PROGMEM Language_Str MSG_HALTED = _UxGT("IMPRESORA DETENIDA"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Por favor, reinicie"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only @@ -504,7 +500,6 @@ namespace Language_es { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Dist. filamento mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Ir a origen Fallado"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Sondeo Fallado"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Muy Frio"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("ELIJE FILAMENTO"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_eu.h b/Marlin/src/lcd/language/language_eu.h index 5b38299e76fe..bee571bbde25 100644 --- a/Marlin/src/lcd/language/language_eu.h +++ b/Marlin/src/lcd/language/language_eu.h @@ -244,8 +244,6 @@ namespace Language_eu { PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("TENP. KONTROL EZA"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Err: Tenp Maximoa"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Err: Tenp Minimoa"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Err: Ohe Tenp Max"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Err: Ohe Tenp Min"); PROGMEM Language_Str MSG_HALTED = _UxGT("INPRIMA. GELDIRIK"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Berrabia. Mesedez"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only @@ -278,8 +276,7 @@ namespace Language_eu { PROGMEM Language_Str MSG_INFO_BAUDRATE = _UxGT("Baudioak"); PROGMEM Language_Str MSG_INFO_PROTOCOL = _UxGT("Protokoloa"); PROGMEM Language_Str MSG_CASE_LIGHT = _UxGT("Kabina Argia"); - PROGMEM Language_Str MSG_CASE_LIGHT_BRIGHTNESS - = ; + PROGMEM Language_Str MSG_CASE_LIGHT_BRIGHTNESS = _UxGT("Argiaren Distira"); #if LCD_WIDTH >= 20 PROGMEM Language_Str MSG_INFO_PRINT_COUNT = _UxGT("Inprim. Zenbaketa"); PROGMEM Language_Str MSG_INFO_COMPLETED_PRINTS = _UxGT("Burututa"); @@ -310,7 +307,6 @@ namespace Language_eu { PROGMEM Language_Str MSG_FILAMENT_CHANGE_NOZZLE = _UxGT(" Pita: "); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Hasi. huts egin du"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Neurketak huts egin du"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: hotzegi"); PROGMEM Language_Str MSG_KILL_EXPECTED_PRINTER = _UxGT("Inprimagailu okerra"); diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 0042a30f8e5f..21f7757fa953 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -413,6 +413,8 @@ namespace Language_fr { PROGMEM Language_Str MSG_COOLING = _UxGT("Refroidissement"); PROGMEM Language_Str MSG_BED_HEATING = _UxGT("Lit en chauffe..."); PROGMEM Language_Str MSG_BED_COOLING = _UxGT("Refroid. du lit..."); + PROGMEM Language_Str MSG_PROBE_HEATING = _UxGT("Probe en chauffe..."); + PROGMEM Language_Str MSG_PROBE_COOLING = _UxGT("Refroid. Probe..."); PROGMEM Language_Str MSG_CHAMBER_HEATING = _UxGT("Chauffe caisson..."); PROGMEM Language_Str MSG_CHAMBER_COOLING = _UxGT("Refroid. caisson..."); PROGMEM Language_Str MSG_DELTA_CALIBRATE = _UxGT("Calibration Delta"); @@ -485,7 +487,6 @@ namespace Language_fr { PROGMEM Language_Str MSG_RUNOUT_SENSOR = _UxGT("Capteur fil."); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Echec origine"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Echec sonde"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Trop froid"); PROGMEM Language_Str MSG_KILL_MMU2_FIRMWARE = _UxGT("MAJ firmware MMU!!"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("CHOISIR FILAMENT"); diff --git a/Marlin/src/lcd/language/language_gl.h b/Marlin/src/lcd/language/language_gl.h index 90e4129abd7c..53b0803518e5 100644 --- a/Marlin/src/lcd/language/language_gl.h +++ b/Marlin/src/lcd/language/language_gl.h @@ -443,10 +443,6 @@ namespace Language_gl { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("FUGA TÉRMICA CÁMARA"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Erro:TEMP MÁX"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Erro:TEMP MÍN"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Erro:TEMP MÁX CAMA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Erro:TEMP MÍN CAMA"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Erro:TEMP MÁX CÁMARA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Erro:TEMP MÍN CÁMARA"); PROGMEM Language_Str MSG_HALTED = _UxGT("IMPRESORA DETIDA"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Debe reiniciar!"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only @@ -526,7 +522,6 @@ namespace Language_gl { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Dist mm Sensor Fil"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Fallo ao ir á Orixe"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Fallo ao Sondar"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Moi Frío"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("ESCOLLE FILAMENTO"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_hu.h b/Marlin/src/lcd/language/language_hu.h index 64ea482249ef..76aff51d9cc3 100644 --- a/Marlin/src/lcd/language/language_hu.h +++ b/Marlin/src/lcd/language/language_hu.h @@ -445,10 +445,6 @@ namespace Language_hu { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("KAMRA FÜTÉS KIMARADÁS"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Hiba: MAX Höfok"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Hiba: MIN Höfok"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Hiba: MAX ÁGY HÖFOK"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Hiba: MIN ÁGY HÖFOK"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Hiba: MAX KAMRA HÖFOK"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Hiba: MIN KAMRA HÖFOK"); PROGMEM Language_Str MSG_HALTED = _UxGT("A NYOMTATÓ LEFAGYOTT"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Indítsd újra!"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("n"); // Csak egy karakter @@ -528,7 +524,6 @@ namespace Language_hu { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Túlfutás Táv. mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Tájolási hiba"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Szondázás hiba"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Túl hideg"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("SZÁLVÁLASZTÁS"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 0a56fdf5ecfe..e22e58708f51 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -46,6 +46,7 @@ namespace Language_it { PROGMEM Language_Str MSG_MEDIA_INSERTED = _UxGT("Media inserito"); PROGMEM Language_Str MSG_MEDIA_REMOVED = _UxGT("Media rimosso"); PROGMEM Language_Str MSG_MEDIA_WAITING = _UxGT("Aspettando media"); + PROGMEM Language_Str MSG_SD_INIT_FAIL = _UxGT("Inizial.SD fallita"); PROGMEM Language_Str MSG_MEDIA_READ_ERROR = _UxGT("Err.leggendo media"); PROGMEM Language_Str MSG_MEDIA_USB_REMOVED = _UxGT("Dispos.USB rimosso"); PROGMEM Language_Str MSG_MEDIA_USB_FAILED = _UxGT("Avvio USB fallito"); @@ -221,6 +222,10 @@ namespace Language_it { PROGMEM Language_Str MSG_SET_LEDS_VIOLET = _UxGT("Viola"); PROGMEM Language_Str MSG_SET_LEDS_WHITE = _UxGT("Bianco"); PROGMEM Language_Str MSG_SET_LEDS_DEFAULT = _UxGT("Predefinito"); + PROGMEM Language_Str MSG_LED_CHANNEL_N = _UxGT("Canale ="); + PROGMEM Language_Str MSG_LEDS2 = _UxGT("Luci #2"); + PROGMEM Language_Str MSG_NEO2_PRESETS = _UxGT("Luce #2 Presets"); + PROGMEM Language_Str MSG_NEO2_BRIGHTNESS = _UxGT("Luminosità"); PROGMEM Language_Str MSG_CUSTOM_LEDS = _UxGT("Luci personalizzate"); PROGMEM Language_Str MSG_INTENSITY_R = _UxGT("Intensità rosso"); PROGMEM Language_Str MSG_INTENSITY_G = _UxGT("Intensità verde"); @@ -452,10 +457,6 @@ namespace Language_it { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("T.CAMERA FUORI CTRL"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Err: TEMP MASSIMA"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Err: TEMP MINIMA"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Err: TEMP MAX PIATTO"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Err: TEMP MIN PIATTO"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Err: TEMP MAX CAMERA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Err: TEMP MIN CAMERA"); PROGMEM Language_Str MSG_HALTED = _UxGT("STAMPANTE FERMATA"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Riavviare prego"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("g"); // Un solo carattere @@ -465,6 +466,8 @@ namespace Language_it { PROGMEM Language_Str MSG_COOLING = _UxGT("Raffreddamento.."); PROGMEM Language_Str MSG_BED_HEATING = _UxGT("Risc. piatto..."); PROGMEM Language_Str MSG_BED_COOLING = _UxGT("Raffr. piatto..."); + PROGMEM Language_Str MSG_PROBE_HEATING = _UxGT("Risc. sonda..."); + PROGMEM Language_Str MSG_PROBE_COOLING = _UxGT("Raffr. sonda..."); PROGMEM Language_Str MSG_CHAMBER_HEATING = _UxGT("Risc. camera..."); PROGMEM Language_Str MSG_CHAMBER_COOLING = _UxGT("Raffr. camera..."); PROGMEM Language_Str MSG_DELTA_CALIBRATE = _UxGT("Calibraz. Delta"); @@ -535,7 +538,6 @@ namespace Language_it { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Dist mm filo term."); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Home fallito"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Sondaggio fallito"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600:Troppo freddo"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("SCELTA FILAMENTO"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); @@ -586,6 +588,17 @@ namespace Language_it { PROGMEM Language_Str MSG_BAD_PAGE = _UxGT("Indice pag. errato"); PROGMEM Language_Str MSG_BAD_PAGE_SPEED = _UxGT("Vel. pag. errata"); + PROGMEM Language_Str MSG_EDIT_PASSWORD = _UxGT("Modif.password"); + PROGMEM Language_Str MSG_LOGIN_REQUIRED = _UxGT("Login richiesto"); + PROGMEM Language_Str MSG_PASSWORD_SETTINGS = _UxGT("Impostaz.password"); + PROGMEM Language_Str MSG_ENTER_DIGIT = _UxGT("Inserisci cifra"); + PROGMEM Language_Str MSG_CHANGE_PASSWORD = _UxGT("Imp./Modif.password"); + PROGMEM Language_Str MSG_REMOVE_PASSWORD = _UxGT("Elimina password"); + PROGMEM Language_Str MSG_PASSWORD_SET = _UxGT("La password è "); + PROGMEM Language_Str MSG_START_OVER = _UxGT("Ricominciare"); + PROGMEM Language_Str MSG_REMINDER_SAVE_SETTINGS = _UxGT("Ricordati di mem.!"); + PROGMEM Language_Str MSG_PASSWORD_REMOVED = _UxGT("Password eliminata"); + // // Le schermate di Cambio Filamento possono visualizzare fino a 3 linee su un display a 4 righe // ...o fino a 2 linee su un display a 3 righe. diff --git a/Marlin/src/lcd/language/language_jp_kana.h b/Marlin/src/lcd/language/language_jp_kana.h index 5f679dd49d2c..df6ad9b5d98f 100644 --- a/Marlin/src/lcd/language/language_jp_kana.h +++ b/Marlin/src/lcd/language/language_jp_kana.h @@ -184,8 +184,6 @@ namespace Language_jp_kana { PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("ネツボウソウ"); // "THERMAL RUNAWAY" PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("エラー:サイコウオンチョウカ"); // "Err: MAXTEMP" PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("エラー:サイテイオンミマン"); // "Err: MINTEMP" - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("エラー:ベッド サイコウオンチョウカ"); // "Err: MAXTEMP BED" - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("エラー:ベッド サイテイオンミマン"); // "Err: MINTEMP BED" PROGMEM Language_Str MSG_HALTED = _UxGT("プリンターハテイシシマシタ"); // "PRINTER HALTED" PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("リセットシテクダサイ"); // "Please reset" PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only diff --git a/Marlin/src/lcd/language/language_nl.h b/Marlin/src/lcd/language/language_nl.h index c8c79e472add..c1a1a0605b31 100644 --- a/Marlin/src/lcd/language/language_nl.h +++ b/Marlin/src/lcd/language/language_nl.h @@ -164,8 +164,6 @@ namespace Language_nl { PROGMEM Language_Str MSG_THERMAL_RUNAWAY = _UxGT("Therm. wegloop"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Err: Max. temp"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Err: Min. temp"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Err: Max.tmp bed"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Err: Min.tmp bed"); PROGMEM Language_Str MSG_HALTED = _UxGT("PRINTER GESTOPT"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Reset A.U.B."); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only. Keep English standard diff --git a/Marlin/src/lcd/language/language_pl.h b/Marlin/src/lcd/language/language_pl.h index 17ca0bd00f45..f6a9e12c8ee5 100644 --- a/Marlin/src/lcd/language/language_pl.h +++ b/Marlin/src/lcd/language/language_pl.h @@ -391,10 +391,6 @@ namespace Language_pl { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("ZANIK TEMP.KOMORY"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Błąd: MAXTEMP"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Błąd: MINTEMP"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Błąd: MAXTEMP STÓŁ"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Błąd: MINTEMP STÓŁ"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Błąd: MAXTEMP KOMORA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Błąd: MINTEMP KOMORA"); PROGMEM Language_Str MSG_HALTED = _UxGT("Drukarka zatrzym."); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Proszę zresetować"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only @@ -474,7 +470,6 @@ namespace Language_pl { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Dystans do czujnika mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Zerowanie nieudane"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Sondowanie nieudane"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: za zimne"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("WYBIERZ FILAMENT"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_pt.h b/Marlin/src/lcd/language/language_pt.h index 1180649c989b..8bd94d06e154 100644 --- a/Marlin/src/lcd/language/language_pt.h +++ b/Marlin/src/lcd/language/language_pt.h @@ -150,8 +150,6 @@ namespace Language_pt { PROGMEM Language_Str MSG_HEATING_FAILED_LCD = _UxGT("Aquecimento falhou"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Err: T Máxima"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Err: T Mínima"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Err: T Base Máxima"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Err: T Base Mínima"); PROGMEM Language_Str MSG_HEATING = _UxGT("Aquecendo..."); PROGMEM Language_Str MSG_BED_HEATING = _UxGT("Aquecendo base..."); PROGMEM Language_Str MSG_DELTA_CALIBRATE = _UxGT("Calibração Delta"); diff --git a/Marlin/src/lcd/language/language_pt_br.h b/Marlin/src/lcd/language/language_pt_br.h index 2c6c2af1486e..eb1e2f9bf32e 100644 --- a/Marlin/src/lcd/language/language_pt_br.h +++ b/Marlin/src/lcd/language/language_pt_br.h @@ -357,10 +357,6 @@ namespace Language_pt_br { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("ESCAPE TÉRMICO CAMARA"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Erro:Temp Máxima"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Erro:Temp Mínima"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Erro:Temp Mesa Máx"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Erro:Temp Mesa Mín"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Erro:Temp Câmara Máx"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Erro:Temp Câmara Min"); PROGMEM Language_Str MSG_HALTED = _UxGT("IMPRESSORA PAROU"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Favor resetar"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); @@ -432,7 +428,6 @@ namespace Language_pt_br { PROGMEM Language_Str MSG_RUNOUT_SENSOR = _UxGT("Sensor filamento"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Falha ao ir à origem"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Falha ao sondar"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Muito frio"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("ESCOLHER FILAMENTO"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_ro.h b/Marlin/src/lcd/language/language_ro.h index dc5591117602..d71471a09dfc 100644 --- a/Marlin/src/lcd/language/language_ro.h +++ b/Marlin/src/lcd/language/language_ro.h @@ -448,10 +448,6 @@ namespace Language_ro { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("CHAMBER T. RUNAWAY"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Err: MAXTEMP"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Err: MINTEMP"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Err: MAXTEMP BED"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Err: MINTEMP BED"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Err: MAXTEMP CHAMBER"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Err: MINTEMP CHAMBER"); PROGMEM Language_Str MSG_HALTED = _UxGT("PRINTER HALTED"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Please Reset"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); // One character only @@ -532,7 +528,6 @@ namespace Language_ro { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Runout Dist mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Homing Failed"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Probing Failed"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Too Cold"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("CHOOSE FILAMENT"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_ru.h b/Marlin/src/lcd/language/language_ru.h index e1abfa542972..b8c146e515e8 100644 --- a/Marlin/src/lcd/language/language_ru.h +++ b/Marlin/src/lcd/language/language_ru.h @@ -536,10 +536,6 @@ namespace Language_ru { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("УТЕЧКА ТЕПЛА КАМЕРЫ"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Ошибка: Т макс."); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Ошибка: Т мин."); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Ошибка: Т стола макс"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Ошибка: Т стола мин."); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Ошибка:Т камеры макс"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Ошибка:Т камеры мин."); PROGMEM Language_Str MSG_HALTED = _UxGT("ПРИНТЕР ОСТАНОВЛЕН"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Сделайте сброс"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("д"); // One character only @@ -640,7 +636,6 @@ namespace Language_ru { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("До конца, мм"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Ошибка парковки"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Ошибка зондирования"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Низкая Т") LCD_STR_DEGREE; PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("ВЫБИРЕТЕ ФИЛАМЕНТ"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("Настройки MMU"); diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 71949014b7c7..e936110d0768 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -441,10 +441,6 @@ namespace Language_sk { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("TEPLOTNÝ SKOK KOMO."); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Chyba: MAXTEMP"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Chyba: MINTEMP"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Chyba: MAXTEMP PODL."); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Chyba: MINTEMP PODL."); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Chyba: MAXTEMP KOMO."); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Chyba: MINTEMP KOMO."); PROGMEM Language_Str MSG_HALTED = _UxGT("TLAČIAREŇ ZASTAVENÁ"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Reštartuje ju"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("d"); @@ -525,7 +521,6 @@ namespace Language_sk { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Vzd. mm fil. senz."); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Parkovanie zlyhalo"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Kalibrácia zlyhala"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Príliš studený"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("VYBERTE FILAMENT"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU2"); diff --git a/Marlin/src/lcd/language/language_tr.h b/Marlin/src/lcd/language/language_tr.h index c0ce4bfdc5d0..95e4fb2a8bad 100644 --- a/Marlin/src/lcd/language/language_tr.h +++ b/Marlin/src/lcd/language/language_tr.h @@ -420,10 +420,6 @@ namespace Language_tr { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("ODA TERMAL PROBLEM"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Hata: MAX.SICAKLIK"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Hata: MIN.SICAKLIK"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Hata: MAX.SIC. TABLA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Hata: MIN.SIC. TABLA"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("Hata: MAX.SIC ODA"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("Hata: MIN.SIC ODA"); PROGMEM Language_Str MSG_HALTED = _UxGT("YAZICI DURDURULDU"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Lütfen Resetleyin"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("G"); // One character only @@ -500,7 +496,6 @@ namespace Language_tr { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("Aşınma Farkı mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Sıfırlama Başarısız"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Probing Başarısız"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Çok Soğuk"); PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("FILAMAN SEÇ"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_uk.h b/Marlin/src/lcd/language/language_uk.h index 30d45338d98d..9041decbb251 100644 --- a/Marlin/src/lcd/language/language_uk.h +++ b/Marlin/src/lcd/language/language_uk.h @@ -530,10 +530,6 @@ namespace Language_uk { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("ВИТІК ТЕПЛА КАМЕРИ"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("ПЕРЕГРІВ"); PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("МІНІМАЛЬНА Т") LCD_STR_DEGREE; - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("ПЕРЕГРІВ СТОЛУ"); - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("МІНІМАЛЬНА Т") LCD_STR_DEGREE _UxGT(" СТОЛУ"); - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("ПЕРЕГРІВ КАМЕРИ"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("МІНІМАЛЬНА Т") LCD_STR_DEGREE _UxGT(" КАМЕРИ"); PROGMEM Language_Str MSG_HALTED = _UxGT("ПРИНТЕР ЗУПИНЕНО"); PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Перезавантажте"); PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("д"); // One character only @@ -650,7 +646,6 @@ namespace Language_uk { #endif PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Помилка паркування"); PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("Помилка зондування"); - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: низька Т") LCD_STR_DEGREE; PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("ОБЕРІТЬ ПРУТОК"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("Налаштування MMU"); diff --git a/Marlin/src/lcd/language/language_vi.h b/Marlin/src/lcd/language/language_vi.h index 02453e58792f..afd87d379838 100644 --- a/Marlin/src/lcd/language/language_vi.h +++ b/Marlin/src/lcd/language/language_vi.h @@ -335,8 +335,6 @@ namespace Language_vi { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_BED = _UxGT("Vấn đề nhiệt bàn"); // BED THERMAL RUNAWAY PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("Điều sai: nhiệt độ tối đa"); // Err: MAXTEMP PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("Điều sai: nhiệt độ tối thiểu"); // Err: MINTEMP - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("Điều sai: nhiệt độ bàn tối đa"); // Err: MAXTEMP BED - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("Điều sai: nhiệt độ bàn tối thiểu"); // Err: MINTEMP BED PROGMEM Language_Str MSG_HALTED = _UxGT("MÁY IN ĐÃ DỪNG LẠI"); // PRINTER HALTED PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("Xin bặt lại"); // Please reset PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("n"); // d - ngày - One character only @@ -405,7 +403,6 @@ namespace Language_vi { PROGMEM Language_Str MSG_RUNOUT_SENSOR_ENABLE = _UxGT("Cảm Biến Hết"); // Runout Sensor PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("Sự nhà không thành công"); // Homing failed PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT(" không thành công"); // Probing failed - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: Quá lạnh"); // // Filament Change screens show up to 3 lines on a 4-line display diff --git a/Marlin/src/lcd/language/language_zh_CN.h b/Marlin/src/lcd/language/language_zh_CN.h index 49d7acd94cc8..d30ee789dd85 100644 --- a/Marlin/src/lcd/language/language_zh_CN.h +++ b/Marlin/src/lcd/language/language_zh_CN.h @@ -447,10 +447,6 @@ namespace Language_zh_CN { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("机箱热量失控"); PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("错误:最高温度"); //"Err: MAXTEMP" PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("错误:最低温度"); //"Err: MINTEMP" - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("错误:最高热床温度"); //"Err: MAXTEMP BED" - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("错误:最低热床温度"); //"Err: MINTEMP BED" - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("错误:最高机箱温度"); - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("错误:最低机箱温度"); PROGMEM Language_Str MSG_HALTED = _UxGT("打印停机"); //"PRINTER HALTED" PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("请重置"); //"Please reset" PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("天"); //"d" // One character only @@ -532,7 +528,6 @@ namespace Language_zh_CN { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("断料距离mm"); PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("归原位失败"); // "Homing failed" PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("探针探测失败"); // "Probing failed" - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: 太凉"); // "M600: Too cold" PROGMEM Language_Str MSG_MMU2_CHOOSE_FILAMENT_HEADER = _UxGT("选择料"); PROGMEM Language_Str MSG_MMU2_MENU = _UxGT("MMU"); diff --git a/Marlin/src/lcd/language/language_zh_TW.h b/Marlin/src/lcd/language/language_zh_TW.h index ac543585347f..6764af6d73ce 100644 --- a/Marlin/src/lcd/language/language_zh_TW.h +++ b/Marlin/src/lcd/language/language_zh_TW.h @@ -388,10 +388,6 @@ namespace Language_zh_TW { PROGMEM Language_Str MSG_THERMAL_RUNAWAY_CHAMBER = _UxGT("機箱溫度失控"); //"CHAMBER T. RUNAWAY" PROGMEM Language_Str MSG_ERR_MAXTEMP = _UxGT("錯誤:最高溫度"); //"Err: MAXTEMP" PROGMEM Language_Str MSG_ERR_MINTEMP = _UxGT("錯誤:最低溫度"); //"Err: MINTEMP" - PROGMEM Language_Str MSG_ERR_MAXTEMP_BED = _UxGT("錯誤:最高熱床溫度"); //"Err: MAXTEMP BED" - PROGMEM Language_Str MSG_ERR_MINTEMP_BED = _UxGT("錯誤:最低熱床溫度"); //"Err: MINTEMP BED" - PROGMEM Language_Str MSG_ERR_MAXTEMP_CHAMBER = _UxGT("錯誤:最高機箱溫度"); //"Err: MAXTEMP CHAMBER" - PROGMEM Language_Str MSG_ERR_MINTEMP_CHAMBER = _UxGT("錯誤:最低機箱溫度"); //"Err: MINTEMP CHAMBER" PROGMEM Language_Str MSG_HALTED = _UxGT("印表機停機"); //"PRINTER HALTED" PROGMEM Language_Str MSG_PLEASE_RESET = _UxGT("請重置"); //"Please reset" PROGMEM Language_Str MSG_SHORT_DAY = _UxGT("天"); //"d" // One character only @@ -472,7 +468,6 @@ namespace Language_zh_TW { PROGMEM Language_Str MSG_RUNOUT_DISTANCE_MM = _UxGT("絲距離mm"); //"Runout Dist mm" PROGMEM Language_Str MSG_KILL_HOMING_FAILED = _UxGT("歸原位失敗"); // "Homing failed" PROGMEM Language_Str MSG_LCD_PROBING_FAILED = _UxGT("探針探測失敗"); // "Probing failed" - PROGMEM Language_Str MSG_M600_TOO_COLD = _UxGT("M600: 太冷"); // "M600: Too cold" // // Filament Change screens show up to 3 lines on a 4-line display diff --git a/Marlin/src/lcd/lcdprint.cpp b/Marlin/src/lcd/lcdprint.cpp index 0f7f945a9925..1355dbbf2ddb 100644 --- a/Marlin/src/lcd/lcdprint.cpp +++ b/Marlin/src/lcd/lcdprint.cpp @@ -57,7 +57,10 @@ lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const i PGM_P const b = ind == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED); n -= lcd_put_u8str_max_P(b, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); } - if (n) n -= lcd_put_u8str_max_P((PGM_P)p, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); + if (n) { + n -= lcd_put_u8str_max_P((PGM_P)p, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); + break; + } } else if (ch == '$' && inStr) { n -= lcd_put_u8str_max_P(inStr, n * (MENU_FONT_WIDTH)) / (MENU_FONT_WIDTH); diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index e6739a135cbf..64923547e8ad 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -34,10 +34,6 @@ #include "../../libs/buzzer.h" #endif -#if WATCH_HOTENDS || WATCH_BED - #include "../../module/temperature.h" -#endif - #if ENABLED(BABYSTEP_ZPROBE_OFFSET) #include "../../module/probe.h" #endif diff --git a/Marlin/src/lcd/menu/menu_info.cpp b/Marlin/src/lcd/menu/menu_info.cpp index 00ab9ad195e3..864e855df23d 100644 --- a/Marlin/src/lcd/menu/menu_info.cpp +++ b/Marlin/src/lcd/menu/menu_info.cpp @@ -34,6 +34,9 @@ #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" @@ -49,8 +52,8 @@ char buffer[21]; START_SCREEN(); // 12345678901234567890 - 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 + 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_TIME, SS_LEFT); // Total print Time: STATIC_ITEM_P(PSTR("> "), SS_LEFT, duration_t(stats.printTime).toString(buffer)); // > 99y 364d 23h 59m 59s diff --git a/Marlin/src/lcd/menu/menu_item.h b/Marlin/src/lcd/menu/menu_item.h index bee05141bb28..755135d14dec 100644 --- a/Marlin/src/lcd/menu/menu_item.h +++ b/Marlin/src/lcd/menu/menu_item.h @@ -342,8 +342,8 @@ class MenuItem_bool : public MenuEditItemBase { #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) +#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), N, ##V) #define MENU_ITEM_N_S_P(TYPE, N, S, PLABEL, V...) _MENU_ITEM_N_S_P(TYPE, N, S, false, PLABEL, ##V) #define MENU_ITEM_N_S(TYPE, N, S, LABEL, V...) MENU_ITEM_N_S_P(TYPE, N, S, GET_TEXT(LABEL), ##V) diff --git a/Marlin/src/libs/W25Qxx.cpp b/Marlin/src/libs/W25Qxx.cpp index d51dfb819de9..9abe45fbaf7c 100644 --- a/Marlin/src/libs/W25Qxx.cpp +++ b/Marlin/src/libs/W25Qxx.cpp @@ -24,9 +24,10 @@ #if HAS_SPI_FLASH +#include "W25Qxx.h" #include -#include "W25Qxx.h" +W25QXXFlash W25QXX; #ifndef SPI_FLASH_MISO_PIN #define SPI_FLASH_MISO_PIN W25QXX_MISO_PIN diff --git a/Marlin/src/libs/W25Qxx.h b/Marlin/src/libs/W25Qxx.h index 81e964345010..ac3e8a169b24 100644 --- a/Marlin/src/libs/W25Qxx.h +++ b/Marlin/src/libs/W25Qxx.h @@ -1,4 +1,4 @@ -/** +/** * Marlin 3D Printer Firmware * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * @@ -21,10 +21,6 @@ */ #pragma once -//#ifdef __cplusplus -//extern "C" { /* C-declarations for C++ */ -//#endif - #include #define W25X_WriteEnable 0x06 @@ -71,6 +67,4 @@ class W25QXXFlash { static void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead); }; -//#ifdef __cplusplus -//} /* C-declarations for C++ */ -//#endif +extern W25QXXFlash W25QXX; diff --git a/Marlin/src/libs/private_spi.h b/Marlin/src/libs/private_spi.h index c2a054235b48..9c0ffe7486d7 100644 --- a/Marlin/src/libs/private_spi.h +++ b/Marlin/src/libs/private_spi.h @@ -43,7 +43,7 @@ class SPIclass { SET_INPUT_PULLUP(MISO_PIN); } FORCE_INLINE static uint8_t receive() { - #if defined(__AVR__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) + #if defined(__AVR__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__) || defined(__IMXRT1062__) SPDR = 0; for (;!TEST(SPSR, SPIF);); return SPDR; diff --git a/Marlin/src/module/motion.h b/Marlin/src/module/motion.h index c3f2d9b779a4..052e3180c86e 100644 --- a/Marlin/src/module/motion.h +++ b/Marlin/src/module/motion.h @@ -108,22 +108,28 @@ extern int16_t feedrate_percentage; extern float e_move_accumulator; #endif -inline float pgm_read_any(const float *p) { return pgm_read_float(p); } -inline signed char pgm_read_any(const signed char *p) { return pgm_read_byte(p); } +#ifdef __IMXRT1062__ + #define DEFS_PROGMEM +#else + #define DEFS_PROGMEM PROGMEM +#endif + +inline float pgm_read_any(const float *p) { return TERN(__IMXRT1062__, *p, pgm_read_float(p)); } +inline int8_t pgm_read_any(const int8_t *p) { return TERN(__IMXRT1062__, *p, pgm_read_byte(p)); } #define XYZ_DEFS(T, NAME, OPT) \ inline T NAME(const AxisEnum axis) { \ - static const XYZval NAME##_P PROGMEM = { X_##OPT, Y_##OPT, Z_##OPT }; \ + static const XYZval NAME##_P DEFS_PROGMEM = { X_##OPT, Y_##OPT, Z_##OPT }; \ return pgm_read_any(&NAME##_P[axis]); \ } XYZ_DEFS(float, base_min_pos, MIN_POS); XYZ_DEFS(float, base_max_pos, MAX_POS); XYZ_DEFS(float, base_home_pos, HOME_POS); XYZ_DEFS(float, max_length, MAX_LENGTH); -XYZ_DEFS(signed char, home_dir, HOME_DIR); +XYZ_DEFS(int8_t, home_dir, HOME_DIR); inline float home_bump_mm(const AxisEnum axis) { - static const xyz_pos_t home_bump_mm_P PROGMEM = HOMING_BUMP_MM; + static const xyz_pos_t home_bump_mm_P DEFS_PROGMEM = HOMING_BUMP_MM; return pgm_read_any(&home_bump_mm_P[axis]); } diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 8af2071e3600..2c679068b936 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -1191,60 +1191,60 @@ void MarlinSettings::postprocess() { #if HAS_STEALTHCHOP #if AXIS_HAS_STEALTHCHOP(X) - tmc_stealth_enabled.X = stepperX.get_stealthChop_status(); + tmc_stealth_enabled.X = stepperX.get_stored_stealthChop_status(); #endif #if AXIS_HAS_STEALTHCHOP(Y) - tmc_stealth_enabled.Y = stepperY.get_stealthChop_status(); + tmc_stealth_enabled.Y = stepperY.get_stored_stealthChop_status(); #endif #if AXIS_HAS_STEALTHCHOP(Z) - tmc_stealth_enabled.Z = stepperZ.get_stealthChop_status(); + tmc_stealth_enabled.Z = stepperZ.get_stored_stealthChop_status(); #endif #if AXIS_HAS_STEALTHCHOP(X2) - tmc_stealth_enabled.X2 = stepperX2.get_stealthChop_status(); + tmc_stealth_enabled.X2 = stepperX2.get_stored_stealthChop_status(); #endif #if AXIS_HAS_STEALTHCHOP(Y2) - tmc_stealth_enabled.Y2 = stepperY2.get_stealthChop_status(); + tmc_stealth_enabled.Y2 = stepperY2.get_stored_stealthChop_status(); #endif #if AXIS_HAS_STEALTHCHOP(Z2) - tmc_stealth_enabled.Z2 = stepperZ2.get_stealthChop_status(); + tmc_stealth_enabled.Z2 = stepperZ2.get_stored_stealthChop_status(); #endif #if AXIS_HAS_STEALTHCHOP(Z3) - tmc_stealth_enabled.Z3 = stepperZ3.get_stealthChop_status(); + tmc_stealth_enabled.Z3 = stepperZ3.get_stored_stealthChop_status(); #endif #if AXIS_HAS_STEALTHCHOP(Z4) - tmc_stealth_enabled.Z4 = stepperZ4.get_stealthChop_status(); + tmc_stealth_enabled.Z4 = stepperZ4.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS #if AXIS_HAS_STEALTHCHOP(E0) - tmc_stealth_enabled.E0 = stepperE0.get_stealthChop_status(); + tmc_stealth_enabled.E0 = stepperE0.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS > 1 #if AXIS_HAS_STEALTHCHOP(E1) - tmc_stealth_enabled.E1 = stepperE1.get_stealthChop_status(); + tmc_stealth_enabled.E1 = stepperE1.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS > 2 #if AXIS_HAS_STEALTHCHOP(E2) - tmc_stealth_enabled.E2 = stepperE2.get_stealthChop_status(); + tmc_stealth_enabled.E2 = stepperE2.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS > 3 #if AXIS_HAS_STEALTHCHOP(E3) - tmc_stealth_enabled.E3 = stepperE3.get_stealthChop_status(); + tmc_stealth_enabled.E3 = stepperE3.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS > 4 #if AXIS_HAS_STEALTHCHOP(E4) - tmc_stealth_enabled.E4 = stepperE4.get_stealthChop_status(); + tmc_stealth_enabled.E4 = stepperE4.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS > 5 #if AXIS_HAS_STEALTHCHOP(E5) - tmc_stealth_enabled.E5 = stepperE5.get_stealthChop_status(); + tmc_stealth_enabled.E5 = stepperE5.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS > 6 #if AXIS_HAS_STEALTHCHOP(E6) - tmc_stealth_enabled.E6 = stepperE6.get_stealthChop_status(); + tmc_stealth_enabled.E6 = stepperE6.get_stored_stealthChop_status(); #endif #if MAX_EXTRUDERS > 7 #if AXIS_HAS_STEALTHCHOP(E7) - tmc_stealth_enabled.E7 = stepperE7.get_stealthChop_status(); + tmc_stealth_enabled.E7 = stepperE7.get_stored_stealthChop_status(); #endif #endif // MAX_EXTRUDERS > 7 #endif // MAX_EXTRUDERS > 6 @@ -3595,17 +3595,17 @@ void MarlinSettings::reset() { #if HAS_STEALTHCHOP CONFIG_ECHO_HEADING("Driver stepping mode:"); #if AXIS_HAS_STEALTHCHOP(X) - const bool chop_x = stepperX.get_stealthChop_status(); + const bool chop_x = stepperX.get_stored_stealthChop_status(); #else constexpr bool chop_x = false; #endif #if AXIS_HAS_STEALTHCHOP(Y) - const bool chop_y = stepperY.get_stealthChop_status(); + const bool chop_y = stepperY.get_stored_stealthChop_status(); #else constexpr bool chop_y = false; #endif #if AXIS_HAS_STEALTHCHOP(Z) - const bool chop_z = stepperZ.get_stealthChop_status(); + const bool chop_z = stepperZ.get_stored_stealthChop_status(); #else constexpr bool chop_z = false; #endif @@ -3619,17 +3619,17 @@ void MarlinSettings::reset() { } #if AXIS_HAS_STEALTHCHOP(X2) - const bool chop_x2 = stepperX2.get_stealthChop_status(); + const bool chop_x2 = stepperX2.get_stored_stealthChop_status(); #else constexpr bool chop_x2 = false; #endif #if AXIS_HAS_STEALTHCHOP(Y2) - const bool chop_y2 = stepperY2.get_stealthChop_status(); + const bool chop_y2 = stepperY2.get_stored_stealthChop_status(); #else constexpr bool chop_y2 = false; #endif #if AXIS_HAS_STEALTHCHOP(Z2) - const bool chop_z2 = stepperZ2.get_stealthChop_status(); + const bool chop_z2 = stepperZ2.get_stored_stealthChop_status(); #else constexpr bool chop_z2 = false; #endif @@ -3643,36 +3643,36 @@ void MarlinSettings::reset() { } #if AXIS_HAS_STEALTHCHOP(Z3) - if (stepperZ3.get_stealthChop_status()) { say_M569(forReplay, PSTR("I2 Z"), true); } + if (stepperZ3.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("I2 Z"), true); } #endif #if AXIS_HAS_STEALTHCHOP(Z4) - if (stepperZ4.get_stealthChop_status()) { say_M569(forReplay, PSTR("I3 Z"), true); } + if (stepperZ4.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("I3 Z"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E0) - if (stepperE0.get_stealthChop_status()) { say_M569(forReplay, PSTR("T0 E"), true); } + if (stepperE0.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T0 E"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E1) - if (stepperE1.get_stealthChop_status()) { say_M569(forReplay, PSTR("T1 E"), true); } + if (stepperE1.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T1 E"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E2) - if (stepperE2.get_stealthChop_status()) { say_M569(forReplay, PSTR("T2 E"), true); } + if (stepperE2.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T2 E"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E3) - if (stepperE3.get_stealthChop_status()) { say_M569(forReplay, PSTR("T3 E"), true); } + if (stepperE3.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T3 E"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E4) - if (stepperE4.get_stealthChop_status()) { say_M569(forReplay, PSTR("T4 E"), true); } + if (stepperE4.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T4 E"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E5) - if (stepperE5.get_stealthChop_status()) { say_M569(forReplay, PSTR("T5 E"), true); } + if (stepperE5.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T5 E"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E6) - if (stepperE6.get_stealthChop_status()) { say_M569(forReplay, PSTR("T6 E"), true); } + if (stepperE6.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T6 E"), true); } #endif #if AXIS_HAS_STEALTHCHOP(E7) - if (stepperE7.get_stealthChop_status()) { say_M569(forReplay, PSTR("T7 E"), true); } + if (stepperE7.get_stored_stealthChop_status()) { say_M569(forReplay, PSTR("T7 E"), true); } #endif #endif // HAS_STEALTHCHOP diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index 6b22c50a7b14..e0fa6fa98f53 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -252,7 +252,7 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, hotend_watch_t Temperature::watch_hotend[HOTENDS]; // = { { 0 } } #endif #if HEATER_IDLE_HANDLER - hotend_idle_t Temperature::hotend_idle[HOTENDS]; // = { { 0 } } + Temperature::heater_idle_t Temperature::heater_idle[NR_HEATER_IDLE]; // = { { 0 } } #endif #if HAS_HEATED_BED @@ -266,7 +266,6 @@ const char str_t_thermal_runaway[] PROGMEM = STR_T_THERMAL_RUNAWAY, #endif TERN_(WATCH_BED, bed_watch_t Temperature::watch_bed); // = { 0 } TERN(PIDTEMPBED,, millis_t Temperature::next_bed_check_ms); - TERN_(HEATER_IDLE_HANDLER, hotend_idle_t Temperature::bed_idle); // = { 0 } #endif // HAS_HEATED_BED #if HAS_TEMP_CHAMBER @@ -377,7 +376,7 @@ volatile bool Temperature::raw_temps_ready = false; * Needs sufficient heater power to make some overshoot at target * temperature to succeed. */ - void Temperature::PID_autotune(const float &target, const heater_ind_t heater, const int8_t ncycles, const bool set_result/*=false*/) { + void Temperature::PID_autotune(const float &target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result/*=false*/) { float current_temp = 0.0; int cycles = 0; bool heating = true; @@ -389,11 +388,11 @@ volatile bool Temperature::raw_temps_ready = false; PID_t tune_pid = { 0, 0, 0 }; float maxT = 0, minT = 10000; - const bool isbed = (heater == H_BED); + const bool isbed = (heater_id == H_BED); #if HAS_PID_FOR_BOTH #define GHV(B,H) (isbed ? (B) : (H)) - #define SHV(B,H) do{ if (isbed) temp_bed.soft_pwm_amount = B; else temp_hotend[heater].soft_pwm_amount = H; }while(0) + #define SHV(B,H) do{ if (isbed) temp_bed.soft_pwm_amount = B; else temp_hotend[heater_id].soft_pwm_amount = H; }while(0) #define ONHEATINGSTART() (isbed ? printerEventLEDs.onBedHeatingStart() : printerEventLEDs.onHotendHeatingStart()) #define ONHEATING(S,C,T) (isbed ? printerEventLEDs.onBedHeating(S,C,T) : printerEventLEDs.onHotendHeating(S,C,T)) #elif ENABLED(PIDTEMPBED) @@ -403,7 +402,7 @@ volatile bool Temperature::raw_temps_ready = false; #define ONHEATING(S,C,T) printerEventLEDs.onBedHeating(S,C,T) #else #define GHV(B,H) H - #define SHV(B,H) (temp_hotend[heater].soft_pwm_amount = H) + #define SHV(B,H) (temp_hotend[heater_id].soft_pwm_amount = H) #define ONHEATINGSTART() printerEventLEDs.onHotendHeatingStart() #define ONHEATING(S,C,T) printerEventLEDs.onHotendHeating(S,C,T) #endif @@ -427,7 +426,7 @@ volatile bool Temperature::raw_temps_ready = false; TERN_(HAS_AUTO_FAN, next_auto_fan_check_ms = next_temp_ms + 2500UL); - if (target > GHV(BED_MAX_TARGET, temp_range[heater].maxtemp - HOTEND_OVERSHOOT)) { + if (target > GHV(BED_MAX_TARGET, temp_range[heater_id].maxtemp - HOTEND_OVERSHOOT)) { SERIAL_ECHOLNPGM(STR_PID_TEMP_TOO_HIGH); TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TEMP_TOO_HIGH)); return; @@ -440,15 +439,15 @@ volatile bool Temperature::raw_temps_ready = false; SHV(bias = d = (MAX_BED_POWER) >> 1, bias = d = (PID_MAX) >> 1); - wait_for_heatup = true; // Can be interrupted with M108 #if ENABLED(PRINTER_EVENT_LEDS) - const float start_temp = GHV(temp_bed.celsius, temp_hotend[heater].celsius); + const float start_temp = GHV(temp_bed.celsius, temp_hotend[heater_id].celsius); LEDColor color = ONHEATINGSTART(); #endif TERN_(NO_FAN_SLOWING_IN_PID_TUNING, adaptive_fan_slowing = false); // PID Tuning loop + wait_for_heatup = true; // Can be interrupted with M108 while (wait_for_heatup) { const millis_t ms = millis(); @@ -457,7 +456,7 @@ volatile bool Temperature::raw_temps_ready = false; updateTemperaturesFromRawValues(); // Get the current temperature and constrain it - current_temp = GHV(temp_bed.celsius, temp_hotend[heater].celsius); + current_temp = GHV(temp_bed.celsius, temp_hotend[heater_id].celsius); NOLESS(maxT, current_temp); NOMORE(minT, current_temp); @@ -549,7 +548,7 @@ volatile bool Temperature::raw_temps_ready = false; // Report heater states every 2 seconds if (ELAPSED(ms, next_temp_ms)) { #if HAS_TEMP_SENSOR - print_heater_states(isbed ? active_extruder : heater); + print_heater_states(isbed ? active_extruder : heater_id); SERIAL_EOL(); #endif next_temp_ms = ms + 2000UL; @@ -564,10 +563,10 @@ volatile bool Temperature::raw_temps_ready = false; if (current_temp > watch_temp_target) heated = true; // - Flag if target temperature reached } else if (ELAPSED(ms, temp_change_ms)) // Watch timer expired - _temp_error(heater, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); + _temp_error(heater_id, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); } else if (current_temp < target - (MAX_OVERSHOOT_PID_AUTOTUNE)) // Heated, then temperature fell too far? - _temp_error(heater, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); + _temp_error(heater_id, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); } #endif } // every 2 seconds @@ -608,9 +607,9 @@ volatile bool Temperature::raw_temps_ready = false; }while(0) #define _SET_EXTRUDER_PID() do { \ - PID_PARAM(Kp, heater) = tune_pid.Kp; \ - PID_PARAM(Ki, heater) = scalePID_i(tune_pid.Ki); \ - PID_PARAM(Kd, heater) = scalePID_d(tune_pid.Kd); \ + PID_PARAM(Kp, heater_id) = tune_pid.Kp; \ + PID_PARAM(Ki, heater_id) = scalePID_i(tune_pid.Ki); \ + PID_PARAM(Kd, heater_id) = scalePID_d(tune_pid.Kd); \ updatePID(); }while(0) // Use the result? (As with "M303 U1") @@ -632,6 +631,7 @@ volatile bool Temperature::raw_temps_ready = false; } TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update()); } + wait_for_heatup = false; disable_all_heaters(); @@ -650,7 +650,7 @@ volatile bool Temperature::raw_temps_ready = false; * Class and Instance Methods */ -int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { +int16_t Temperature::getHeaterPower(const heater_id_t heater_id) { switch (heater_id) { #if HAS_HEATED_BED case H_BED: return temp_bed.soft_pwm_amount; @@ -757,7 +757,7 @@ int16_t Temperature::getHeaterPower(const heater_ind_t heater_id) { // Temperature Error Handlers // -inline void loud_kill(PGM_P const lcd_msg, const heater_ind_t heater) { +inline void loud_kill(PGM_P const lcd_msg, const heater_id_t heater_id) { marlin_state = MF_KILLED; #if USE_BEEPER for (uint8_t i = 20; i--;) { @@ -766,10 +766,10 @@ inline void loud_kill(PGM_P const lcd_msg, const heater_ind_t heater) { } WRITE(BEEPER_PIN, HIGH); #endif - kill(lcd_msg, HEATER_PSTR(heater)); + kill(lcd_msg, HEATER_PSTR(heater_id)); } -void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, PGM_P const lcd_msg) { +void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_msg, PGM_P const lcd_msg) { static uint8_t killed = 0; @@ -777,9 +777,9 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, SERIAL_ERROR_START(); serialprintPGM(serial_msg); SERIAL_ECHOPGM(STR_STOPPED_HEATER); - if (heater >= 0) - SERIAL_ECHO((int)heater); - else if (TERN0(HAS_HEATED_CHAMBER, heater == H_CHAMBER)) + if (heater_id >= 0) + SERIAL_ECHO((int)heater_id); + else if (TERN0(HAS_HEATED_CHAMBER, heater_id == H_CHAMBER)) SERIAL_ECHOPGM(STR_HEATER_CHAMBER); else SERIAL_ECHOPGM(STR_HEATER_BED); @@ -800,25 +800,25 @@ void Temperature::_temp_error(const heater_ind_t heater, PGM_P const serial_msg, if (ELAPSED(ms, expire_ms)) ++killed; break; case 2: - loud_kill(lcd_msg, heater); + loud_kill(lcd_msg, heater_id); ++killed; break; } #elif defined(BOGUS_TEMPERATURE_GRACE_PERIOD) UNUSED(killed); #else - if (!killed) { killed = 1; loud_kill(lcd_msg, heater); } + if (!killed) { killed = 1; loud_kill(lcd_msg, heater_id); } #endif } -void Temperature::max_temp_error(const heater_ind_t heater) { +void Temperature::max_temp_error(const heater_id_t heater_id) { TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(1)); - _temp_error(heater, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP)); + _temp_error(heater_id, PSTR(STR_T_MAXTEMP), GET_TEXT(MSG_ERR_MAXTEMP)); } -void Temperature::min_temp_error(const heater_ind_t heater) { +void Temperature::min_temp_error(const heater_id_t heater_id) { TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); - _temp_error(heater, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP)); + _temp_error(heater_id, PSTR(STR_T_MINTEMP), GET_TEXT(MSG_ERR_MINTEMP)); } #if HAS_HOTEND @@ -840,7 +840,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) { if (temp_hotend[ee].target == 0 || pid_error < -(PID_FUNCTIONAL_RANGE) - || TERN0(HEATER_IDLE_HANDLER, hotend_idle[ee].timed_out) + || TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out) ) { pid_output = 0; pid_reset[ee] = true; @@ -925,7 +925,7 @@ void Temperature::min_temp_error(const heater_ind_t heater) { #else // No PID enabled - const bool is_idling = TERN0(HEATER_IDLE_HANDLER, hotend_idle[ee].timed_out); + const bool is_idling = TERN0(HEATER_IDLE_HANDLER, heater_idle[ee].timed_out); const float pid_output = (!is_idling && temp_hotend[ee].celsius < temp_hotend[ee].target) ? BANG_MAX : 0; #endif @@ -1039,15 +1039,14 @@ void Temperature::manage_heater() { HOTEND_LOOP() { #if ENABLED(THERMAL_PROTECTION_HOTENDS) - if (degHotend(e) > temp_range[e].maxtemp) - _temp_error((heater_ind_t)e, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); + if (degHotend(e) > temp_range[e].maxtemp) max_temp_error((heater_id_t)e); #endif - TERN_(HEATER_IDLE_HANDLER, hotend_idle[e].update(ms)); + TERN_(HEATER_IDLE_HANDLER, heater_idle[e].update(ms)); #if ENABLED(THERMAL_PROTECTION_HOTENDS) // Check for thermal runaway - thermal_runaway_protection(tr_state_machine[e], temp_hotend[e].celsius, temp_hotend[e].target, (heater_ind_t)e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); + tr_state_machine[e].run(temp_hotend[e].celsius, temp_hotend[e].target, (heater_id_t)e, THERMAL_PROTECTION_PERIOD, THERMAL_PROTECTION_HYSTERESIS); #endif temp_hotend[e].soft_pwm_amount = (temp_hotend[e].celsius > temp_range[e].mintemp || is_preheating(e)) && temp_hotend[e].celsius < temp_range[e].maxtemp ? (int)get_pid_output_hotend(e) >> 1 : 0; @@ -1057,7 +1056,7 @@ void Temperature::manage_heater() { if (watch_hotend[e].next_ms && ELAPSED(ms, watch_hotend[e].next_ms)) { // Time to check this extruder? if (degHotend(e) < watch_hotend[e].target) { // Failed to increase enough? TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); - _temp_error((heater_ind_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); + _temp_error((heater_id_t)e, str_t_heating_failed, GET_TEXT(MSG_HEATING_FAILED_LCD)); } else // Start again if the target is still far off start_watching_hotend(e); @@ -1092,8 +1091,7 @@ void Temperature::manage_heater() { #if HAS_HEATED_BED #if ENABLED(THERMAL_PROTECTION_BED) - if (degBed() > BED_MAXTEMP) - _temp_error(H_BED, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); + if (degBed() > BED_MAXTEMP) max_temp_error(H_BED); #endif #if WATCH_BED @@ -1126,12 +1124,14 @@ void Temperature::manage_heater() { TERN_(PAUSE_CHANGE_REQD, last_pause_state = paused); #endif - TERN_(HEATER_IDLE_HANDLER, bed_idle.update(ms)); + TERN_(HEATER_IDLE_HANDLER, heater_idle[IDLE_INDEX_BED].update(ms)); - TERN_(HAS_THERMALLY_PROTECTED_BED, thermal_runaway_protection(tr_state_machine_bed, temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS)); + #if HAS_THERMALLY_PROTECTED_BED + tr_state_machine[RUNAWAY_IND_BED].run(temp_bed.celsius, temp_bed.target, H_BED, THERMAL_PROTECTION_BED_PERIOD, THERMAL_PROTECTION_BED_HYSTERESIS); + #endif #if HEATER_IDLE_HANDLER - if (bed_idle.timed_out) { + if (heater_idle[IDLE_INDEX_BED].timed_out) { temp_bed.soft_pwm_amount = 0; #if DISABLED(PIDTEMPBED) WRITE_HEATER_BED(LOW); @@ -1172,8 +1172,7 @@ void Temperature::manage_heater() { #endif #if ENABLED(THERMAL_PROTECTION_CHAMBER) - if (degChamber() > CHAMBER_MAXTEMP) - _temp_error(H_CHAMBER, str_t_thermal_runaway, GET_TEXT(MSG_THERMAL_RUNAWAY)); + if (degChamber() > CHAMBER_MAXTEMP) max_temp_error(H_CHAMBER); #endif #if WATCH_CHAMBER @@ -1204,7 +1203,9 @@ void Temperature::manage_heater() { WRITE_HEATER_CHAMBER(LOW); } - TERN_(THERMAL_PROTECTION_CHAMBER, thermal_runaway_protection(tr_state_machine_chamber, temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS)); + #if ENABLED(THERMAL_PROTECTION_CHAMBER) + tr_state_machine[RUNAWAY_IND_CHAMBER].run(temp_chamber.celsius, temp_chamber.target, H_CHAMBER, THERMAL_PROTECTION_CHAMBER_PERIOD, THERMAL_PROTECTION_CHAMBER_HYSTERESIS); + #endif } // TODO: Implement true PID pwm @@ -1934,61 +1935,66 @@ void Temperature::init() { #if HAS_THERMAL_PROTECTION - #if ENABLED(THERMAL_PROTECTION_HOTENDS) - Temperature::tr_state_machine_t Temperature::tr_state_machine[HOTENDS]; // = { { TRInactive, 0 } }; - #endif - #if HAS_THERMALLY_PROTECTED_BED - Temperature::tr_state_machine_t Temperature::tr_state_machine_bed; // = { TRInactive, 0 }; - #endif - #if ENABLED(THERMAL_PROTECTION_CHAMBER) - Temperature::tr_state_machine_t Temperature::tr_state_machine_chamber; // = { TRInactive, 0 }; - #endif + Temperature::tr_state_machine_t Temperature::tr_state_machine[NR_HEATER_RUNAWAY]; // = { { TRInactive, 0 } }; - void Temperature::thermal_runaway_protection(Temperature::tr_state_machine_t &sm, const float ¤t, const float &target, const heater_ind_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc) { + /** + * @brief Thermal Runaway state machine for a single heater + * @param current current measured temperature + * @param target current target temperature + * @param heater_id extruder index + * @param period_seconds missed temperature allowed time + * @param hysteresis_degc allowed distance from target + * + * TODO: Embed the last 3 parameters during init, if not less optimal + */ + void Temperature::tr_state_machine_t::run(const float ¤t, const float &target, const heater_id_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc) { - static float tr_target_temperature[HOTENDS + 1] = { 0.0 }; + #if HEATER_IDLE_HANDLER + // Convert the given heater_id_t to an idle array index + const IdleIndex idle_index = idle_index_for_id(heater_id); + #endif /** SERIAL_ECHO_START(); SERIAL_ECHOPGM("Thermal Runaway Running. Heater ID: "); - if (heater_id == H_CHAMBER) SERIAL_ECHOPGM("chamber"); - if (heater_id < 0) SERIAL_ECHOPGM("bed"); else SERIAL_ECHO(heater_id); - SERIAL_ECHOPAIR(" ; State:", sm.state, " ; Timer:", sm.timer, " ; Temperature:", current, " ; Target Temp:", target); - if (heater_id >= 0) - SERIAL_ECHOPAIR(" ; Idle Timeout:", hotend_idle[heater_id].timed_out); - else - SERIAL_ECHOPAIR(" ; Idle Timeout:", bed_idle.timed_out); - SERIAL_EOL(); + switch (heater_id) { + case H_BED: SERIAL_ECHOPGM("bed"); break; + case H_CHAMBER: SERIAL_ECHOPGM("chamber"); break; + default: SERIAL_ECHO(heater_id); + } + SERIAL_ECHOLNPAIR( + " ; sizeof(running_temp):", sizeof(running_temp), + " ; State:", state, " ; Timer:", timer, " ; Temperature:", current, " ; Target Temp:", target + #if HEATER_IDLE_HANDLER + , " ; Idle Timeout:", heater_idle[idle_index].timed_out + #endif + ); //*/ - const int heater_index = heater_id >= 0 ? heater_id : HOTENDS; - #if HEATER_IDLE_HANDLER // If the heater idle timeout expires, restart - if ((heater_id >= 0 && hotend_idle[heater_id].timed_out) - || TERN0(HAS_HEATED_BED, (heater_id < 0 && bed_idle.timed_out)) - ) { - sm.state = TRInactive; - tr_target_temperature[heater_index] = 0; + if (heater_idle[idle_index].timed_out) { + state = TRInactive; + running_temp = 0; } else #endif { // If the target temperature changes, restart - if (tr_target_temperature[heater_index] != target) { - tr_target_temperature[heater_index] = target; - sm.state = target > 0 ? TRFirstHeating : TRInactive; + if (running_temp != target) { + running_temp = target; + state = target > 0 ? TRFirstHeating : TRInactive; } } - switch (sm.state) { + switch (state) { // Inactive state waits for a target temperature to be set case TRInactive: break; // When first heating, wait for the temperature to be reached then go to Stable state case TRFirstHeating: - if (current < tr_target_temperature[heater_index]) break; - sm.state = TRStable; + if (current < running_temp) break; + state = TRStable; // While the temperature is stable watch for a bad temperature case TRStable: @@ -1996,25 +2002,25 @@ void Temperature::init() { #if ENABLED(ADAPTIVE_FAN_SLOWING) if (adaptive_fan_slowing && heater_id >= 0) { const int fan_index = _MIN(heater_id, FAN_COUNT - 1); - if (fan_speed[fan_index] == 0 || current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.25f)) + if (fan_speed[fan_index] == 0 || current >= running_temp - (hysteresis_degc * 0.25f)) fan_speed_scaler[fan_index] = 128; - else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.3335f)) + else if (current >= running_temp - (hysteresis_degc * 0.3335f)) fan_speed_scaler[fan_index] = 96; - else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.5f)) + else if (current >= running_temp - (hysteresis_degc * 0.5f)) fan_speed_scaler[fan_index] = 64; - else if (current >= tr_target_temperature[heater_id] - (hysteresis_degc * 0.8f)) + else if (current >= running_temp - (hysteresis_degc * 0.8f)) fan_speed_scaler[fan_index] = 32; else fan_speed_scaler[fan_index] = 0; } #endif - if (current >= tr_target_temperature[heater_index] - hysteresis_degc) { - sm.timer = millis() + SEC_TO_MS(period_seconds); + if (current >= running_temp - hysteresis_degc) { + timer = millis() + SEC_TO_MS(period_seconds); break; } - else if (PENDING(millis(), sm.timer)) break; - sm.state = TRRunaway; + else if (PENDING(millis(), timer)) break; + state = TRRunaway; case TRRunaway: TERN_(DWIN_CREALITY_LCD, Popup_Window_Temperature(0)); @@ -2085,8 +2091,8 @@ void Temperature::disable_all_heaters() { if (p != paused) { paused = p; if (p) { - HOTEND_LOOP() hotend_idle[e].expire(); // Timeout immediately - TERN_(HAS_HEATED_BED, bed_idle.expire()); // Timeout immediately + HOTEND_LOOP() heater_idle[e].expire(); // Timeout immediately + TERN_(HAS_HEATED_BED, heater_idle[IDLE_INDEX_BED].expire()); // Timeout immediately } else { HOTEND_LOOP() reset_hotend_idle_timer(e); @@ -2310,12 +2316,12 @@ void Temperature::readings_ready() { const bool heater_on = (temp_hotend[e].target > 0 || TERN0(PIDTEMP, temp_hotend[e].soft_pwm_amount) > 0 ); - if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error((heater_ind_t)e); + if (rawtemp > temp_range[e].raw_max * tdir) max_temp_error((heater_id_t)e); if (heater_on && rawtemp < temp_range[e].raw_min * tdir && !is_preheating(e)) { #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED if (++consecutive_low_temperature_error[e] >= MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED) #endif - min_temp_error((heater_ind_t)e); + min_temp_error((heater_id_t)e); } #ifdef MAX_CONSECUTIVE_LOW_TEMPERATURE_ERROR_ALLOWED else @@ -2332,9 +2338,7 @@ void Temperature::readings_ready() { #else #define BEDCMP(A,B) ((A)>(B)) #endif - const bool bed_on = temp_bed.target > 0 - || TERN0(PIDTEMPBED, temp_bed.soft_pwm_amount) > 0 - ; + const bool bed_on = (temp_bed.target > 0) || TERN0(PIDTEMPBED, temp_bed.soft_pwm_amount > 0); if (BEDCMP(temp_bed.raw, maxtemp_raw_BED)) max_temp_error(H_BED); if (bed_on && BEDCMP(mintemp_raw_BED, temp_bed.raw)) min_temp_error(H_BED); #endif @@ -2882,7 +2886,7 @@ void Temperature::tick() { #if ENABLED(SHOW_TEMP_ADC_VALUES) , const float r #endif - , const heater_ind_t e=INDEX_NONE + , const heater_id_t e=INDEX_NONE ) { char k; switch (e) { @@ -2973,10 +2977,10 @@ void Temperature::tick() { #if ENABLED(SHOW_TEMP_ADC_VALUES) , rawHotendTemp(e) #endif - , (heater_ind_t)e + , (heater_id_t)e ); #endif - SERIAL_ECHOPAIR(" @:", getHeaterPower((heater_ind_t)target_extruder)); + SERIAL_ECHOPAIR(" @:", getHeaterPower((heater_id_t)target_extruder)); #if HAS_HEATED_BED SERIAL_ECHOPAIR(" B@:", getHeaterPower(H_BED)); #endif @@ -2987,7 +2991,7 @@ void Temperature::tick() { HOTEND_LOOP() { SERIAL_ECHOPAIR(" @", e); SERIAL_CHAR(':'); - SERIAL_ECHO(getHeaterPower((heater_ind_t)e)); + SERIAL_ECHO(getHeaterPower((heater_id_t)e)); } #endif } @@ -3060,10 +3064,10 @@ void Temperature::tick() { printerEventLEDs.onHotendHeatingStart(); #endif - float target_temp = -1.0, old_temp = 9999.0; bool wants_to_cool = false; - wait_for_heatup = true; + float target_temp = -1.0, old_temp = 9999.0; millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; + wait_for_heatup = true; do { // Target temperature might be changed during the loop if (target_temp != degTargetHotend(target_extruder)) { @@ -3137,6 +3141,7 @@ void Temperature::tick() { } while (wait_for_heatup && TEMP_CONDITIONS); if (wait_for_heatup) { + wait_for_heatup = false; #if ENABLED(DWIN_CREALITY_LCD) HMI_flag.heat_flag = 0; duration_t elapsed = print_job_timer.duration(); // print timer @@ -3145,9 +3150,10 @@ void Temperature::tick() { ui.reset_status(); #endif TERN_(PRINTER_EVENT_LEDS, printerEventLEDs.onHeatingDone()); + return true; } - return wait_for_heatup; + return false; } #endif // HAS_TEMP_HOTEND @@ -3176,11 +3182,6 @@ void Temperature::tick() { #define TEMP_BED_CONDITIONS (wants_to_cool ? isCoolingBed() : isHeatingBed()) #endif - float target_temp = -1, old_temp = 9999; - bool wants_to_cool = false; - wait_for_heatup = true; - millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; - #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) KEEPALIVE_STATE(NOT_BUSY); #endif @@ -3190,6 +3191,10 @@ void Temperature::tick() { printerEventLEDs.onBedHeatingStart(); #endif + bool wants_to_cool = false; + float target_temp = -1, old_temp = 9999; + millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; + wait_for_heatup = true; do { // Target temperature might be changed during the loop if (target_temp != degTargetBed()) { @@ -3264,9 +3269,13 @@ void Temperature::tick() { } while (wait_for_heatup && TEMP_BED_CONDITIONS); - if (wait_for_heatup) ui.reset_status(); + if (wait_for_heatup) { + wait_for_heatup = false; + ui.reset_status(); + return true; + } - return wait_for_heatup; + return false; } void Temperature::wait_for_bed_heating() { @@ -3280,6 +3289,77 @@ void Temperature::tick() { #endif // HAS_HEATED_BED + #if HAS_TEMP_PROBE + + #ifndef MIN_DELTA_SLOPE_DEG_PROBE + #define MIN_DELTA_SLOPE_DEG_PROBE 1.0 + #endif + #ifndef MIN_DELTA_SLOPE_TIME_PROBE + #define MIN_DELTA_SLOPE_TIME_PROBE 600 + #endif + + bool Temperature::wait_for_probe(const float target_temp, bool no_wait_for_cooling/*=true*/) { + + const bool wants_to_cool = isProbeAboveTemp(target_temp); + const bool will_wait = !(wants_to_cool && no_wait_for_cooling); + if (will_wait) + SERIAL_ECHOLNPAIR("Waiting for probe to ", (wants_to_cool ? PSTR("cool down") : PSTR("heat up")), " to ", target_temp, " degrees."); + + #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) + KEEPALIVE_STATE(NOT_BUSY); + #endif + + float old_temp = 9999; + millis_t next_temp_ms = 0, next_delta_check_ms = 0; + wait_for_heatup = true; + while (will_wait && wait_for_heatup) { + + // Print Temp Reading every 10 seconds while heating up. + millis_t now = millis(); + if (!next_temp_ms || ELAPSED(now, next_temp_ms)) { + next_temp_ms = now + 10000UL; + print_heater_states(active_extruder); + SERIAL_EOL(); + } + + idle(); + gcode.reset_stepper_timeout(); // Keep steppers powered + + // Break after MIN_DELTA_SLOPE_TIME_PROBE seconds if the temperature + // did not drop at least MIN_DELTA_SLOPE_DEG_PROBE. This avoids waiting + // forever as the probe is not actively heated. + if (!next_delta_check_ms || ELAPSED(now, next_delta_check_ms)) { + const float temp = degProbe(), + delta_temp = old_temp > temp ? old_temp - temp : temp - old_temp; + if (delta_temp < float(MIN_DELTA_SLOPE_DEG_PROBE)) { + SERIAL_ECHOLNPGM("Timed out waiting for probe temperature."); + break; + } + next_delta_check_ms = now + 1000UL * MIN_DELTA_SLOPE_TIME_PROBE; + old_temp = temp; + } + + // Loop until the temperature is very close target + if (!(wants_to_cool ? isProbeAboveTemp(target_temp) : isProbeBelowTemp(target_temp))) { + SERIAL_ECHOLN(wants_to_cool ? PSTR("Cooldown") : PSTR("Heatup")); + SERIAL_ECHOLNPGM(" complete, target probe temperature reached."); + break; + } + } + + if (wait_for_heatup) { + wait_for_heatup = false; + ui.reset_status(); + return true; + } + else if (will_wait) + SERIAL_ECHOLNPGM("Canceled wait for probe temperature."); + + return false; + } + + #endif // HAS_TEMP_PROBE + #if HAS_HEATED_CHAMBER #ifndef MIN_COOLING_SLOPE_DEG_CHAMBER @@ -3300,15 +3380,14 @@ void Temperature::tick() { #define TEMP_CHAMBER_CONDITIONS (wants_to_cool ? isCoolingChamber() : isHeatingChamber()) #endif - float target_temp = -1, old_temp = 9999; - bool wants_to_cool = false; - wait_for_heatup = true; - millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; - #if DISABLED(BUSY_WHILE_HEATING) && ENABLED(HOST_KEEPALIVE_FEATURE) KEEPALIVE_STATE(NOT_BUSY); #endif + bool wants_to_cool = false; + float target_temp = -1, old_temp = 9999; + millis_t now, next_temp_ms = 0, next_cool_check_ms = 0; + wait_for_heatup = true; do { // Target temperature might be changed during the loop if (target_temp != degTargetChamber()) { @@ -3367,9 +3446,13 @@ void Temperature::tick() { } } while (wait_for_heatup && TEMP_CHAMBER_CONDITIONS); - if (wait_for_heatup) ui.reset_status(); + if (wait_for_heatup) { + wait_for_heatup = false; + ui.reset_status(); + return true; + } - return wait_for_heatup; + return false; } #endif // HAS_HEATED_CHAMBER diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index 4d3efceafd75..57b0fecbcc99 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -40,12 +40,12 @@ #define HOTEND_INDEX TERN(HAS_MULTI_HOTEND, e, 0) #define E_NAME TERN_(HAS_MULTI_HOTEND, e) -// Identifiers for other heaters +// Heater identifiers. Positive values are hotends. Negative values are other heaters. typedef enum : int8_t { INDEX_NONE = -5, H_PROBE, H_REDUNDANT, H_CHAMBER, H_BED, H_E0, H_E1, H_E2, H_E3, H_E4, H_E5, H_E6, H_E7 -} heater_ind_t; +} heater_id_t; // PID storage typedef struct { float Kp, Ki, Kd; } PID_t; @@ -211,16 +211,6 @@ struct PIDHeaterInfo : public HeaterInfo { typedef temp_info_t chamber_info_t; #endif -// Heater idle handling -typedef struct { - millis_t timeout_ms; - bool timed_out; - inline void update(const millis_t &ms) { if (!timed_out && timeout_ms && ELAPSED(ms, timeout_ms)) timed_out = true; } - inline void start(const millis_t &ms) { timeout_ms = millis() + ms; timed_out = false; } - inline void reset() { timeout_ms = 0; timed_out = false; } - inline void expire() { start(0); } -} hotend_idle_t; - // Heater watch handling template struct HeaterWatch { @@ -346,9 +336,38 @@ class Temperature { FORCE_INLINE static bool targetHotEnoughToExtrude(const uint8_t e) { return !targetTooColdToExtrude(e); } #if HEATER_IDLE_HANDLER - static hotend_idle_t hotend_idle[HOTENDS]; - TERN_(HAS_HEATED_BED, static hotend_idle_t bed_idle); - TERN_(HAS_HEATED_CHAMBER, static hotend_idle_t chamber_idle); + + // Heater idle handling. Marlin creates one per hotend and one for the heated bed. + typedef struct { + millis_t timeout_ms; + bool timed_out; + inline void update(const millis_t &ms) { if (!timed_out && timeout_ms && ELAPSED(ms, timeout_ms)) timed_out = true; } + inline void start(const millis_t &ms) { timeout_ms = millis() + ms; timed_out = false; } + inline void reset() { timeout_ms = 0; timed_out = false; } + inline void expire() { start(0); } + } heater_idle_t; + + // Indices and size for the heater_idle array + #define _ENUM_FOR_E(N) IDLE_INDEX_E##N, + enum IdleIndex : uint8_t { + REPEAT(HOTENDS, _ENUM_FOR_E) + #if ENABLED(HAS_HEATED_BED) + IDLE_INDEX_BED, + #endif + NR_HEATER_IDLE + }; + #undef _ENUM_FOR_E + + // Convert the given heater_id_t to idle array index + static inline IdleIndex idle_index_for_id(const int8_t heater_id) { + #if HAS_HEATED_BED + if (heater_id == H_BED) return IDLE_INDEX_BED; + #endif + return (IdleIndex)_MAX(heater_id, 0); + } + + static heater_idle_t heater_idle[NR_HEATER_IDLE]; + #endif private: @@ -654,6 +673,9 @@ class Temperature { FORCE_INLINE static int16_t rawProbeTemp() { return temp_probe.raw; } #endif FORCE_INLINE static float degProbe() { return temp_probe.celsius; } + FORCE_INLINE static bool isProbeBelowTemp(const float target_temp) { return temp_probe.celsius < target_temp; } + FORCE_INLINE static bool isProbeAboveTemp(const float target_temp) { return temp_probe.celsius > target_temp; } + static bool wait_for_probe(const float target_temp, bool no_wait_for_cooling=true); #endif #if WATCH_PROBE @@ -698,7 +720,7 @@ class Temperature { /** * The software PWM power for a heater */ - static int16_t getHeaterPower(const heater_ind_t heater); + static int16_t getHeaterPower(const heater_id_t heater_id); /** * Switch off all heaters, set all target temperatures to 0 @@ -717,7 +739,7 @@ class Temperature { * Perform auto-tuning for hotend or bed in response to M303 */ #if HAS_PID_HEATING - static void PID_autotune(const float &target, const heater_ind_t hotend, const int8_t ncycles, const bool set_result=false); + static void PID_autotune(const float &target, const heater_id_t heater_id, const int8_t ncycles, const bool set_result=false); #if ENABLED(NO_FAN_SLOWING_IN_PID_TUNING) static bool adaptive_fan_slowing; @@ -744,13 +766,13 @@ class Temperature { #if HEATER_IDLE_HANDLER static void reset_hotend_idle_timer(const uint8_t E_NAME) { - hotend_idle[HOTEND_INDEX].reset(); + heater_idle[HOTEND_INDEX].reset(); start_watching_hotend(HOTEND_INDEX); } #if HAS_HEATED_BED static void reset_bed_idle_timer() { - bed_idle.reset(); + heater_idle[IDLE_INDEX_BED].reset(); start_watching_bed(); } #endif @@ -808,26 +830,51 @@ class Temperature { TERN_(HAS_HEATED_CHAMBER, static float get_pid_output_chamber()); - static void _temp_error(const heater_ind_t e, PGM_P const serial_msg, PGM_P const lcd_msg); - static void min_temp_error(const heater_ind_t e); - static void max_temp_error(const heater_ind_t e); + static void _temp_error(const heater_id_t e, PGM_P const serial_msg, PGM_P const lcd_msg); + static void min_temp_error(const heater_id_t e); + static void max_temp_error(const heater_id_t e); - #define HAS_THERMAL_PROTECTION (EITHER(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_CHAMBER) || HAS_THERMALLY_PROTECTED_BED) + #define HAS_THERMAL_PROTECTION ANY(THERMAL_PROTECTION_HOTENDS, THERMAL_PROTECTION_CHAMBER, HAS_THERMALLY_PROTECTED_BED) #if HAS_THERMAL_PROTECTION + // Indices and size for the tr_state_machine array. One for each protected heater. + #define _ENUM_FOR_E(N) RUNAWAY_IND_E##N, + enum RunawayIndex : uint8_t { + #if ENABLED(THERMAL_PROTECTION_HOTENDS) + REPEAT(HOTENDS, _ENUM_FOR_E) + #endif + #if ENABLED(HAS_THERMALLY_PROTECTED_BED) + RUNAWAY_IND_BED, + #endif + #if ENABLED(THERMAL_PROTECTION_CHAMBER) + RUNAWAY_IND_CHAMBER, + #endif + NR_HEATER_RUNAWAY + }; + #undef _ENUM_FOR_E + + // Convert the given heater_id_t to runaway state array index + static inline RunawayIndex runaway_index_for_id(const int8_t heater_id) { + #if HAS_THERMALLY_PROTECTED_CHAMBER + if (heater_id == H_CHAMBER) return RUNAWAY_IND_CHAMBER; + #endif + #if HAS_THERMALLY_PROTECTED_BED + if (heater_id == H_BED) return RUNAWAY_IND_BED; + #endif + return (RunawayIndex)_MAX(heater_id, 0); + } + enum TRState : char { TRInactive, TRFirstHeating, TRStable, TRRunaway }; typedef struct { millis_t timer = 0; TRState state = TRInactive; + float running_temp; + void run(const float ¤t, const float &target, const heater_id_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc); } tr_state_machine_t; - TERN_(THERMAL_PROTECTION_HOTENDS, static tr_state_machine_t tr_state_machine[HOTENDS]); - TERN_(HAS_THERMALLY_PROTECTED_BED, static tr_state_machine_t tr_state_machine_bed); - TERN_(THERMAL_PROTECTION_CHAMBER, static tr_state_machine_t tr_state_machine_chamber); - - static void thermal_runaway_protection(tr_state_machine_t &state, const float ¤t, const float &target, const heater_ind_t heater_id, const uint16_t period_seconds, const uint16_t hysteresis_degc); + static tr_state_machine_t tr_state_machine[NR_HEATER_RUNAWAY]; #endif // HAS_THERMAL_PROTECTION }; 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 b32f99c68db0..49c4dffa04ed 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -275,9 +275,6 @@ #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 @@ -285,7 +282,6 @@ #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 @@ -297,15 +293,18 @@ #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 + // Emulated DOGM have xpt calibration values independent of display resolution + #if ENABLED(SPI_GRAPHICAL_TFT) + #define XPT2046_X_CALIBRATION -11245 + #define XPT2046_Y_CALIBRATION 8629 + #define XPT2046_X_OFFSET 685 + #define XPT2046_Y_OFFSET -285 + #endif + #else #define BTN_ENC P0_28 // (58) open-drain diff --git a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h index 733751eb0a8e..23558b2e0474 100644 --- a/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h +++ b/Marlin/src/pins/lpc1768/pins_MKS_SGEN_L.h @@ -229,7 +229,7 @@ * _____ _____ * (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 | · · | 1.20 (SD_MOSI) + * (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 * ----- ----- @@ -279,7 +279,7 @@ #define DOGLCD_CS P0_18 #define DOGLCD_A0 P0_16 #define DOGLCD_SCK P0_07 - #define DOGLCD_MOSI P1_20 + #define DOGLCD_MOSI P0_09 #define LCD_BACKLIGHT_PIN -1 diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 9f120b8b0091..9dce52b4204f 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -196,6 +196,8 @@ #include "ramps/pins_ORTUR_4.h" // ATmega2560 env:mega2560 #elif MB(TENLOG_D3_HERO) #include "ramps/pins_TENLOG_D3_HERO.h" // ATmega2560 env:mega2560 +#elif MB(MKS_GEN_L_V21) + #include "ramps/pins_MKS_GEN_L_V21.h" // ATmega2560 env:mega2560 // // RAMBo and derivatives @@ -619,6 +621,10 @@ #include "stm32f7/pins_THE_BORG.h" // STM32F7 env:STM32F7 #elif MB(REMRAM_V1) #include "stm32f7/pins_REMRAM_V1.h" // STM32F7 env:STM32F7 +#elif MB(TEENSY40_41) + #include "teensy4/pins_TEENSY41.h" // Teensy-4.x env:teensy41 +#elif MB(T41U5XBB) + #include "teensy4/pins_T41U5XBB.h" // Teensy-4.x env:teensy41 // // Espressif ESP32 diff --git a/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h new file mode 100644 index 000000000000..24e04a39ff1f --- /dev/null +++ b/Marlin/src/pins/ramps/pins_MKS_GEN_L_V21.h @@ -0,0 +1,85 @@ +/** + * 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 GEN L V2 – Arduino Mega2560 with RAMPS v1.4 pin assignments + */ + +#if HOTENDS > 2 || E_STEPPERS > 2 + #error "MKS GEN L V2.1 supports up to 2 hotends / E-steppers. Comment out this line to continue." +#endif + +#define BOARD_INFO_NAME "MKS GEN L V2.1" + +// +// Heaters / Fans +// +// Power outputs EFBF or EFBE +#define MOSFET_D_PIN 7 + +// +// CS Pins wired to avoid conflict with the LCD +// See https://www.thingiverse.com/asset:66604 +// + +#ifndef X_CS_PIN + #define X_CS_PIN 63 +#endif +#ifndef Y_CS_PIN + #define Y_CS_PIN 64 +#endif +#ifndef Z_CS_PIN + #define Z_CS_PIN 65 +#endif +#ifndef E0_CS_PIN + #define E0_CS_PIN 66 +#endif +#ifndef E1_CS_PIN + #define E1_CS_PIN 12 +#endif + +// TMC2130 Diag Pins (currently just for reference) +#define X_DIAG_PIN 3 +#define Y_DIAG_PIN 14 +#define Z_DIAG_PIN 18 +#define E0_DIAG_PIN 2 +#define E1_DIAG_PIN 15 + +#ifndef SERVO1_PIN + #define SERVO1_PIN 21 +#endif +#ifndef SERVO2_PIN + #define SERVO2_PIN 39 +#endif +#ifndef SERVO3_PIN + #define SERVO3_PIN 32 +#endif + +#ifndef E1_SERIAL_TX_PIN + #define E1_SERIAL_TX_PIN 20 +#endif +#ifndef E1_SERIAL_RX_PIN + #define E1_SERIAL_RX_PIN 12 +#endif + +#include "pins_RAMPS.h" diff --git a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h index 090f3ee3f8f9..f122a2b7c2ba 100644 --- a/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h +++ b/Marlin/src/pins/stm32f1/pins_CREALITY_V4.h @@ -161,7 +161,7 @@ #if ENABLED(RET6_12864_LCD) - /* RET6 12864 LCD */ + // RET6 12864 LCD #define LCD_PINS_RS PB12 #define LCD_PINS_ENABLE PB15 #define LCD_PINS_D4 PB13 @@ -174,7 +174,7 @@ #elif ENABLED(VET6_12864_LCD) - /* VET6 12864 LCD */ + // VET6 12864 LCD #define LCD_PINS_RS PA4 #define LCD_PINS_ENABLE PA7 #define LCD_PINS_D4 PA5 @@ -185,7 +185,7 @@ #elif ENABLED(DWIN_CREALITY_LCD) - /* RET6 DWIN ENCODER LCD */ + // RET6 DWIN ENCODER LCD #define BTN_ENC PB14 #define BTN_EN1 PB15 #define BTN_EN2 PB12 @@ -198,7 +198,7 @@ #elif ENABLED(DWIN_VET6_CREALITY_LCD) - /* VET6 DWIN ENCODER LCD */ + // VET6 DWIN ENCODER LCD #define BTN_ENC PA6 #define BTN_EN1 PA7 #define BTN_EN2 PA4 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index d66338b8ad32..c3e8be74e8c2 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -25,7 +25,7 @@ * MKS Robin nano (STM32F130VET6) board pin assignments */ -#ifndef __STM32F1__ +#if !defined(STM32F1) && !defined(STM32F1xx) #error "Oops! Select an STM32F1 board in 'Tools > Board.'" #elif HOTENDS > 2 || E_STEPPERS > 2 #error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue." @@ -36,7 +36,7 @@ // // Release PB4 (Y_ENABLE_PIN) from JTAG NRST role // -#define DISABLE_DEBUG +#define DISABLE_JTAG // // EEPROM diff --git a/Marlin/src/pins/teensy4/pins_T41U5XBB.h b/Marlin/src/pins/teensy4/pins_T41U5XBB.h new file mode 100644 index 000000000000..1541bfbd62e8 --- /dev/null +++ b/Marlin/src/pins/teensy4/pins_T41U5XBB.h @@ -0,0 +1,119 @@ +/** + * 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 + +/**************************************************************************************** +* Teensy 4.1 (IMXRT1062) Breadboard pin assignments +* Requires the Teensyduino software with Teensy 4.1 selected in Arduino IDE! +* https://www.pjrc.com/teensy/teensyduino.html +****************************************************************************************/ + +#if !IS_32BIT_TEENSY || !IS_TEENSY41 + #error "Oops! Select 'Teensy 4.1' in 'Tools > Board.'" +#else + #define BOARD_INFO_NAME "Teensy4.1" +#endif + +#define AT90USB 1286 // Disable MarlinSerial etc. +#define USBCON //1286 // Disable MarlinSerial etc. +/* + + plan for Teensy4.0 and Teensy4.1: + USB + GND |-----#####-----| VIN (3.65 TO 5.5V) + RX1 CS1 RX1 PWM 0 | ##### | GND + TX1 MISO1 TX1 PWM 1 | | 3.3V + STPX PWM 2 | | 23 A9 PWM + DIRX PWM 3 | | 22 A8 PWM LIMZ + STPY PWM 4 | | 21 A7 RX5 LIMY + DIRY PWM 5 | | 20 A6 TX5 LIMX + STPZ PWM 6 | | 19 A5 PWM SCL0 COOL + DIRZ RX2 PWM 7 | | 18 A4 PWM SDA0 MIST + STPA TX2 PWM 8 | | 17 A3 RX4 SDA1 CYST + DIRA PWM 9 | | 16 A2 TX4 SCL1 EHOLD + STEN PWM 10 | | 15 A1 PWM RX3 PRB + SPDI MOSI0 PWM 11 | | 14 A0 PWM TX3 PANIC + SPEN MISO0 PWM 12 | | 13 LED PWM SCK0 SPWM + 3.3V | | GND + SCL PWM 24 | | 41 A17 KPSTR + SDA PWM 25 | | 40 A16 STENY + STPB MOSI1 26 | | 39 A15 MISO1 STENZ + DIRB SCK1 27 | * * * * * | 38 A14 STENA + LIMB RX7 PWM 28 | | 37 PWM STENB + DOOR TX7 PWM 29 | | 36 PWM ST0 + ST1 30 | | 35 TX8 ST3 + AUX0 31 | SDCARD | 34 RX8 ST2 + AUX1 32 |_______________| 33 PWM AUX2 + + +*/ + +// +// Limit Switches +// +#define X_STOP_PIN 20 +#define Y_STOP_PIN 21 +#define Z_STOP_PIN 22 + +// +// Steppers +// +#define X_STEP_PIN 2 +#define X_DIR_PIN 3 +#define X_ENABLE_PIN 10 +//#define X_CS_PIN 30 + +#define Y_STEP_PIN 4 +#define Y_DIR_PIN 5 +#define Y_ENABLE_PIN 40 +//#define Y_CS_PIN 31 + +#define Z_STEP_PIN 6 +#define Z_DIR_PIN 7 +#define Z_ENABLE_PIN 39 +//#define Z_CS_PIN 32 + +#define E0_STEP_PIN 8 +#define E0_DIR_PIN 9 +#define E0_ENABLE_PIN 38 + +#define E1_STEP_PIN 26 +#define E1_DIR_PIN 27 +#define E1_ENABLE_PIN 37 + +#define HEATER_0_PIN 31 +#define HEATER_1_PIN 32 +#define HEATER_BED_PIN 33 + +#define TEMP_0_PIN 5 // Extruder / Analog pin numbering: 2 => A2 +#define TEMP_1_PIN 4 +#define TEMP_BED_PIN 15 // Bed / Analog pin numbering + +#define LED_PIN 13 + +#define SOL0_PIN 17 +#define SERVO0_PIN 24 +#define SERVO1_PIN 25 + +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif diff --git a/Marlin/src/pins/teensy4/pins_TEENSY41.h b/Marlin/src/pins/teensy4/pins_TEENSY41.h new file mode 100644 index 000000000000..08a3f5e0d139 --- /dev/null +++ b/Marlin/src/pins/teensy4/pins_TEENSY41.h @@ -0,0 +1,129 @@ +/** + * 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 + +/**************************************************************************************** +* Teensy 4.1 (IMXRT1062) Breadboard pin assignments +* Requires the Teensyduino software with Teensy 4.1 selected in Arduino IDE! +* https://www.pjrc.com/teensy/teensyduino.html +****************************************************************************************/ + +#if !IS_32BIT_TEENSY || !IS_TEENSY41 + #error "Oops! Select 'Teensy 4.1' in 'Tools > Board.'" +#else + #define BOARD_INFO_NAME "Teensy4.1" +#endif + +#define AT90USB 1286 // Disable MarlinSerial etc. +#define USBCON //1286 // Disable MarlinSerial etc. +/* + + plan for Teensy4.0 and Teensy4.1: + USB + GND |-----#####-----| VIN (3.65 TO 5.5V) + X_STEP_PIN CS1 RX1 PWM 0 | ##### | GND + X_DIR_PIN MISO1 TX1 PWM 1 | | 3.3V + Y_STEP_PIN PWM 2 | | 23 A9 PWM SERVO1_PIN + Y_DIR_PIN PWM 3 | | 22 A8 PWM SERVO0_PIN + Z_STEP_PIN PWM 4 | | 21 A7 RX5 + Z_DIR_PIN PWM 5 | | 20 A6 TX5 FILWIDTH_PIN + X_ENABLE_PIN PWM 6 | | 19 A5 PWM SCL0 + Y_ENABLE_PIN RX2 PWM 7 | | 18 A4 PWM SDA0 HEATER_1_PIN + Z_ENABLE_PIN TX2 PWM 8 | | 17 A3 RX4 SDA1 + E0_STEP_PIN PWM 9 | | 16 A2 TX4 SCL1 TEMP_0_PIN + E0_DIR_PIN PWM 10 | | 15 A1 PWM RX3 TEMP_BED_PIN + MOSI_PIN MOSI0 PWM 11 | | 14 A0 PWM TX3 TEMP_1_PIN + MISO_PIN MISO0 PWM 12 | | 13 LED PWM SCK0 SCK_PIN + 3.3V | | GND + Z_STOP_PIN PWM 24 | | 41 A17 + E0_ENABLE_PIN PWM 25 | | 40 A16 + FAN_PIN MOSI1 26 | | 39 A15 MISO1 X_STOP_PIN + Z-PROBE PWR SCK1 27 | * * * * * | 38 A14 Y_STOP_PIN + SOL1_PIN RX7 PWM 28 | | 37 PWM HEATER_0_PIN + FAN_PIN TX7 PWM 29 | | 36 PWM HEATER_BED_PIN + X_CS_PIN 30 | | 35 TX8 E1_ENABLE_PIN + y_CS_PIN 31 | SDCARD | 34 RX8 E1_DIR_PIN + Z_CS_PIN 32 |_______________| 33 PWM E1_STEP_PIN + + +*/ + +// +// Limit Switches +// +#define X_STOP_PIN 39 +#define Y_STOP_PIN 38 +#define Z_STOP_PIN 24 + +// +// Steppers +// +#define X_STEP_PIN 0 +#define X_DIR_PIN 1 +#define X_ENABLE_PIN 6 +//#define X_CS_PIN 30 + +#define Y_STEP_PIN 2 +#define Y_DIR_PIN 3 +#define Y_ENABLE_PIN 7 +//#define Y_CS_PIN 31 + +#define Z_STEP_PIN 4 +#define Z_DIR_PIN 5 +#define Z_ENABLE_PIN 8 +//#define Z_CS_PIN 32 + +#define E0_STEP_PIN 9 +#define E0_DIR_PIN 10 +#define E0_ENABLE_PIN 25 + +#define E1_STEP_PIN 33 +#define E1_DIR_PIN 34 +#define E1_ENABLE_PIN 35 + +#define HEATER_0_PIN 37 +#define HEATER_1_PIN 18 +#define HEATER_BED_PIN 36 +#ifndef FAN_PIN + #define FAN_PIN 29 +#endif + +#define TEMP_0_PIN 2 // Extruder / Analog pin numbering: 2 => A2 +#define TEMP_1_PIN 0 +#define TEMP_BED_PIN 1 // Bed / Analog pin numbering + +#define LED_PIN 13 +//#define PS_ON_PIN 1 +//#define ALARM_PIN -1 + +//#define FILWIDTH_PIN 6 // A6 +#define SOL0_PIN 28 +#define SERVO0_PIN 22 +#define SERVO1_PIN 23 + +//#define SCK_PIN 13 +//#define MISO_PIN 12 +//#define MOSI_PIN 11 + +#ifndef SDCARD_CONNECTION + #define SDCARD_CONNECTION ONBOARD +#endif diff --git a/README.md b/README.md index 042cf3303b8a..839b9f3f6578 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,13 @@ Marlin 2.0 introduces a layer of abstraction so that all the existing high-level [Teensy 3.5](https://www.pjrc.com/store/teensy35.html)|[MK64FX512VMD12](https://www.mouser.com/ProductDetail/NXP-Freescale/MK64FX512VMD12) ARM-Cortex M4|120MHz|512k|192k|3.3-5V|yes [Teensy 3.6](https://www.pjrc.com/store/teensy36.html)|[MK66FX1M0VMD18](https://www.mouser.com/ProductDetail/NXP-Freescale/MK66FX1M0VMD18) ARM-Cortex M4|180MHz|1M|256k|3.3V|yes + #### Teensy 4.0 / 4.1 + + boards|processor|speed|flash|sram|logic|fpu + ----|---------|-----|-----|----|-----|--- + [Teensy 4.0](https://www.pjrc.com/store/teensy40.html)|[IMXRT1062](https://www.mouser.com/new/nxp-semiconductors/nxp-imx-rt1060-crossover-processor/) ARM-Cortex M7|600MHz|1M|2M|3.3V|yes + [Teensy 4.1](https://www.pjrc.com/store/teensy41.html)|[IMXRT1062](https://www.mouser.com/new/nxp-semiconductors/nxp-imx-rt1060-crossover-processor/) ARM-Cortex M7|600MHz|1M|2M|3.3V|yes + ## Submitting Patches Proposed patches should be submitted as a Pull Request against the ([bugfix-2.0.x](https://github.com/MarlinFirmware/Marlin/tree/bugfix-2.0.x)) branch. diff --git a/buildroot/share/git/mftest b/buildroot/share/git/mftest index 3a88bf5f286c..cfb5dd05f357 100755 --- a/buildroot/share/git/mftest +++ b/buildroot/share/git/mftest @@ -48,6 +48,8 @@ case $TESTENV in t32) TESTENV='teensy31' ;; t35) TESTENV='teensy35' ;; t36) TESTENV='teensy35' ;; + t40) TESTENV='teensy41' ;; + t41) TESTENV='teensy41' ;; -h|--help) echo -e "$(basename $0) : Marlin Firmware test, build, and upload\n" echo "Usage: $(basename $0) ................. Select env and test to apply / run" @@ -56,7 +58,7 @@ case $TESTENV in echo " $(basename $0) -b [variant] .... Auto-build the specified variant" echo " $(basename $0) -u [variant] .... Auto-build and upload the specified variant" echo - echo "env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36" + echo "env shortcuts: tree due esp lin lpc|lpc8 lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41" exit ;; diff --git a/buildroot/tests/teensy41-tests b/buildroot/tests/teensy41-tests new file mode 100644 index 000000000000..04baf029d9cc --- /dev/null +++ b/buildroot/tests/teensy41-tests @@ -0,0 +1,123 @@ +#!/usr/bin/env bash +# +# Build tests for Teensy 4.0/4.1 (ARM Cortex-M7) +# + +# exit on first failure +set -e + +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +exec_test $1 $2 "Teensy4.1 with default config" + +# +# Test as many features together as possible +# +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +opt_set EXTRUDERS 2 +opt_set TEMP_SENSOR_0 1 +opt_set TEMP_SENSOR_1 5 +opt_set TEMP_SENSOR_BED 1 +opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER LCD_INFO_MENU SDSUPPORT SDCARD_SORT_ALPHA \ + FILAMENT_WIDTH_SENSOR FILAMENT_LCD_DISPLAY CALIBRATION_GCODE BAUD_RATE_GCODE \ + FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \ + BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \ + PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER \ + ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \ + PHOTO_GCODE PHOTO_POSITION PHOTO_SWITCH_POSITION PHOTO_SWITCH_MS PHOTO_DELAY_MS PHOTO_RETRACT_MM \ + HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT +opt_set I2C_SLAVE_ADDRESS 63 +opt_set GRID_MAX_POINTS_X 16 +exec_test $1 $2 "Teensy4.1 with many features" + +# +# Test a Sled Z Probe with Linear leveling +# +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +opt_enable EEPROM_SETTINGS Z_PROBE_SLED Z_SAFE_HOMING AUTO_BED_LEVELING_LINEAR DEBUG_LEVELING_FEATURE GCODE_MACROS +exec_test $1 $2 "Sled Z Probe with Linear leveling" + +# +# Test a Servo Probe +# +# restore_configs +# opt_set MOTHERBOARD BOARD_TEENSY41 +# opt_enable Z_PROBE_SERVO_NR Z_SERVO_ANGLES DEACTIVATE_SERVOS_AFTER_MOVE \ +# AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS +# opt_set NUM_SERVOS 1 +# exec_test $1 $2 "Servo Probe" +# +# ...with AUTO_BED_LEVELING_3POINT, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, EEPROM_CHITCHAT, EXTENDED_CAPABILITIES_REPORT, and AUTO_REPORT_TEMPERATURES +# +# opt_enable AUTO_BED_LEVELING_3POINT DEBUG_LEVELING_FEATURE EEPROM_SETTINGS \ +# EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES +# exec_test $1 $2 "...with AUTO_BED_LEVELING_3POINT, DEBUG_LEVELING_FEATURE, EEPROM_SETTINGS, EEPROM_CHITCHAT, EXTENDED_CAPABILITIES_REPORT, and AUTO_REPORT_TEMPERATURES" + +# +# Test MAGNETIC_PARKING_EXTRUDER with LCD +# +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +opt_set EXTRUDERS 2 +opt_set TEMP_SENSOR_1 1 +opt_enable MAGNETIC_PARKING_EXTRUDER ULTIMAKERCONTROLLER +exec_test $1 $2 "MAGNETIC_PARKING_EXTRUDER with LCD" + +# +# Mixing Extruder +# +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +opt_enable MIXING_EXTRUDER DIRECT_MIXING_IN_G1 GRADIENT_MIX GRADIENT_VTOOL REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER +opt_set MIXING_STEPPERS 2 +exec_test $1 $2 "Mixing Extruder" + +# +# Test SWITCHING_EXTRUDER +# +# restore_configs +# opt_set MOTHERBOARD BOARD_TEENSY41 +# opt_set EXTRUDERS 2 +# opt_set NUM_SERVOS 1 +# opt_enable SWITCHING_EXTRUDER ULTIMAKERCONTROLLER +# exec_test $1 $2 "SWITCHING_EXTRUDER" + +# +# Enable COREXY +# +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +opt_enable COREXY +opt_set X_DRIVER_TYPE TMC5160 +opt_set Y_DRIVER_TYPE TMC5160 +opt_set X_MIN_ENDSTOP_INVERTING true +opt_set Y_MIN_ENDSTOP_INVERTING true +opt_add X_CS_PIN 46 +opt_add Y_CS_PIN 47 +opt_enable USE_ZMIN_PLUG MONITOR_DRIVER_STATUS SENSORLESS_HOMING +exec_test $1 $2 "Teensy 4.0/4.1 COREXY" + +# +# Enable COREXZ +# +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +opt_enable COREXZ +exec_test $1 $2 "Teensy 4.0/4.1 COREXZ" + +# +# Enable Dual Z with Dual Z endstops +# +restore_configs +opt_set MOTHERBOARD BOARD_TEENSY41 +opt_enable Z_MULTI_ENDSTOPS +opt_set NUM_Z_STEPPER_DRIVERS 2 +pins_set ramps/RAMPS X_MAX_PIN -1 +opt_add Z2_MAX_PIN 2 +opt_enable USE_XMAX_PLUG +exec_test $1 $2 "Dual Z with Dual Z endstops" + +# Clean up +restore_configs diff --git a/platformio.ini b/platformio.ini index f46e60996917..d0a4cb7b10ea 100644 --- a/platformio.ini +++ b/platformio.ini @@ -623,6 +623,7 @@ debug_tool = jlink # [common_LPC] platform = https://github.com/p3p/pio-nxplpc-arduino-lpc176x/archive/0.1.3.zip +platform_packages = framework-arduino-lpc176x@^0.2.5 board = nxp_lpc1768 lib_ldf_mode = off lib_compat_mode = strict @@ -739,6 +740,11 @@ upload_protocol = serial # STM32F103RC_btt_512K ........ RCT6 with 512K # STM32F103RC_btt_512K_USB .... RCT6 with 512K (USB mass storage) # +# WARNING! If you have an SKR Mini v1.1 or an SKR Mini E3 1.0 / 1.2 / 2.0 / DIP +# and experience a printer freeze, re-flash Marlin using the regular (non-512K) +# build option. 256K chips may be re-branded 512K chips, but this means the +# upper 256K is sketchy, and failure is very likely. +# [env:STM32F103RC_btt] platform = ${common_stm32f1.platform} @@ -1059,7 +1065,7 @@ build_flags = ${env:chitu_f103.build_flags} -DCHITU_V5_Z_MIN_BUGFIX [env:STM32F103RET6_creality] platform = ${common_stm32f1.platform} extends = common_stm32f1 -board = genericSTM32F103RC +board = genericSTM32F103RE build_flags = !python Marlin/src/HAL/STM32F1/build_flags.py ${common.build_flags} -std=gnu++14 -DSTM32_XL_DENSITY -DTEMP_TIMER_CHAN=4 extra_scripts = ${common.extra_scripts} @@ -1264,6 +1270,19 @@ platform = teensy board = teensy35 src_filter = ${common.default_src_filter} + +[env:teensy36] +platform = teensy +board = teensy36 +src_filter = ${common.default_src_filter} + + +# +# Teensy 4.0 / 4.1 (ARM Cortex-M7) +# +[env:teensy41] +platform = teensy +board = teensy41 +src_filter = ${common.default_src_filter} + + # # Native # No supported Arduino libraries, base Marlin only