From a85ba9ab3f6aaf67c3cf6073885999efeb29b7d6 Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Sun, 28 Apr 2019 01:07:02 -0400 Subject: [PATCH] Bump to head --- Marlin/Configuration.h | 2 +- Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp | 24 +- Marlin/src/HAL/HAL_AVR/MarlinSerial.h | 2 +- Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp | 4 +- Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp | 44 ++- .../HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp | 40 ++- .../HAL/HAL_ESP32/FlushableHardwareSerial.cpp | 2 +- Marlin/src/HAL/HAL_ESP32/HAL.cpp | 23 +- Marlin/src/HAL/HAL_ESP32/HAL.h | 9 +- Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp | 273 ++++++------------ Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h | 91 +++--- Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h | 13 +- Marlin/src/HAL/HAL_ESP32/i2s.cpp | 17 +- Marlin/src/HAL/HAL_ESP32/i2s.h | 8 + Marlin/src/HAL/HAL_ESP32/spi_pins.h | 2 +- Marlin/src/HAL/HAL_ESP32/web.cpp | 7 +- Marlin/src/HAL/HAL_ESP32/web.h | 7 +- Marlin/src/HAL/HAL_ESP32/wifi.cpp | 7 +- Marlin/src/HAL/HAL_ESP32/wifi.h | 7 +- Marlin/src/HAL/HAL_LPC1768/HAL.h | 3 + Marlin/src/HAL/HAL_LPC1768/SanityCheck.h | 7 +- Marlin/src/HAL/HAL_LPC1768/main.cpp | 21 ++ .../u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp | 10 +- .../u8g/u8g_com_HAL_LPC1768_sw_spi.cpp | 68 ++++- Marlin/src/HAL/HAL_STM32/HAL.cpp | 2 +- Marlin/src/HAL/HAL_STM32/HAL.h | 2 +- .../HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h | 92 +++--- Marlin/src/HAL/HAL_STM32F4/HAL.cpp | 2 +- Marlin/src/HAL/HAL_STM32F4/HAL.h | 2 +- .../HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h | 92 +++--- Marlin/src/HAL/HAL_STM32F7/HAL.cpp | 2 +- Marlin/src/HAL/HAL_STM32F7/HAL.h | 2 +- Marlin/src/HAL/shared/HAL_ST7920.h | 36 +++ Marlin/src/core/boards.h | 1 + Marlin/src/core/debug_out.h | 2 +- Marlin/src/core/language.h | 1 - Marlin/src/core/utility.cpp | 14 +- Marlin/src/core/utility.h | 4 +- Marlin/src/feature/babystep.cpp | 2 +- Marlin/src/feature/babystep.h | 2 +- Marlin/src/feature/bedlevel/abl/abl.cpp | 4 + Marlin/src/feature/bedlevel/bedlevel.cpp | 4 + Marlin/src/feature/fwretract.cpp | 6 +- Marlin/src/feature/host_actions.cpp | 2 +- Marlin/src/feature/host_actions.h | 2 +- Marlin/src/feature/pause.cpp | 4 +- Marlin/src/feature/power_loss_recovery.cpp | 103 +++++-- Marlin/src/feature/power_loss_recovery.h | 9 + Marlin/src/gcode/bedlevel/M420.cpp | 13 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 4 + Marlin/src/gcode/bedlevel/abl/M421.cpp | 4 + Marlin/src/gcode/calibrate/G34_M422.cpp | 6 + Marlin/src/gcode/control/M3-M5.cpp | 4 +- Marlin/src/gcode/eeprom/M500-M504.cpp | 13 - Marlin/src/gcode/feature/trinamic/M906.cpp | 14 +- Marlin/src/gcode/gcode.cpp | 2 +- Marlin/src/gcode/geometry/G92.cpp | 92 +++--- Marlin/src/gcode/host/M876.cpp | 2 +- Marlin/src/gcode/queue.cpp | 5 +- Marlin/src/gcode/sdcard/M23.cpp | 3 - Marlin/src/gcode/temperature/M141_M191.cpp | 2 +- Marlin/src/inc/Conditionals_LCD.h | 12 +- Marlin/src/inc/Conditionals_post.h | 2 +- Marlin/src/inc/SanityCheck.h | 2 + Marlin/src/inc/Version.h | 4 +- Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp | 6 +- Marlin/src/lcd/dogm/HAL_LCD_class_defines.h | 13 + Marlin/src/lcd/dogm/HAL_LCD_com_defines.h | 2 +- Marlin/src/lcd/dogm/status_screen_DOGM.cpp | 2 +- .../lcd/dogm/status_screen_lite_ST7920.cpp | 32 +- .../src/lcd/dogm/status_screen_lite_ST7920.h | 12 +- .../lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp | 67 +++-- Marlin/src/lcd/dogm/ultralcd_DOGM.cpp | 48 ++- Marlin/src/lcd/dogm/ultralcd_DOGM.h | 8 +- .../dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp | 9 + Marlin/src/lcd/extensible_ui/ui_api.cpp | 6 + Marlin/src/lcd/extensible_ui/ui_api.h | 5 + Marlin/src/lcd/language/language_cz.h | 152 +++++++++- Marlin/src/lcd/language/language_de.h | 25 ++ Marlin/src/lcd/language/language_en.h | 24 ++ Marlin/src/lcd/language/language_fr.h | 185 ++++++++++-- Marlin/src/lcd/language/language_it.h | 2 + Marlin/src/lcd/language/language_sk.h | 14 + Marlin/src/lcd/menu/menu.cpp | 21 +- Marlin/src/lcd/menu/menu.h | 29 +- Marlin/src/lcd/menu/menu_advanced.cpp | 23 +- Marlin/src/lcd/menu/menu_bed_corners.cpp | 34 +-- Marlin/src/lcd/menu/menu_game.cpp | 1 + Marlin/src/lcd/menu/menu_job_recovery.cpp | 2 + Marlin/src/lcd/menu/menu_main.cpp | 15 +- Marlin/src/lcd/menu/menu_mixer.cpp | 20 +- Marlin/src/lcd/menu/menu_sdcard.cpp | 16 +- Marlin/src/lcd/menu/menu_service.cpp | 56 ++-- Marlin/src/lcd/menu/menu_tmc.cpp | 84 +++--- Marlin/src/lcd/menu/menu_ubl.cpp | 6 +- Marlin/src/lcd/ultralcd.cpp | 34 ++- Marlin/src/lcd/ultralcd.h | 8 +- Marlin/src/libs/bresenham.h | 2 +- Marlin/src/module/configuration_store.cpp | 20 +- Marlin/src/module/probe.cpp | 41 ++- Marlin/src/module/temperature.cpp | 106 ++++--- Marlin/src/module/temperature.h | 20 +- Marlin/src/module/tool_change.cpp | 131 ++++----- Marlin/src/pins/pins.h | 2 + Marlin/src/pins/pins_AZTEEG_X5_MINI.h | 10 +- Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h | 97 +++++-- Marlin/src/pins/pins_BIQU_SKR_V1.1.h | 25 +- Marlin/src/pins/pins_ESP32.h | 3 + Marlin/src/pins/pins_FORMBOT_RAPTOR.h | 12 +- Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h | 23 +- Marlin/src/pins/pins_FORMBOT_TREX3.h | 8 +- Marlin/src/pins/pins_FYSETC_F6_13.h | 68 +++-- Marlin/src/pins/pins_GEN7_13.h | 2 +- Marlin/src/pins/pins_MKS_SBASE.h | 67 +++-- Marlin/src/pins/pins_MKS_SGEN.h | 60 ++++ Marlin/src/pins/pins_RAMPS.h | 41 ++- Marlin/src/pins/pins_RAMPS_FD_V1.h | 78 +++-- Marlin/src/pins/pins_RAMPS_RE_ARM.h | 61 ++-- Marlin/src/pins/pins_RURAMPS4D_11.h | 78 +++-- Marlin/src/pins/pins_RURAMPS4D_13.h | 66 ++++- Marlin/src/sd/cardreader.cpp | 1 + 121 files changed, 2109 insertions(+), 1141 deletions(-) create mode 100644 Marlin/src/HAL/shared/HAL_ST7920.h create mode 100644 Marlin/src/pins/pins_MKS_SGEN.h diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index 759c5e4253..dfe95463c9 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -453,7 +453,7 @@ #define TEMP_SENSOR_BED 0 #endif #define TEMP_SENSOR_CHAMBER 0 -#define CHAMBER_HEATER_PIN -1 // On/off pin for enclosure heating system +#define HEATER_CHAMBER_PIN -1 // On/off pin for enclosure heating system // Dummy thermistor constant temperature readings, for use with 998 and 999 #define DUMMY_THERMISTOR_998_VALUE 25 diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp index ff1b6569ba..9bc224bd2b 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.cpp @@ -739,24 +739,24 @@ #endif // !USBCON && (UBRRH || UBRR0H || UBRR1H || UBRR2H || UBRR3H) +#ifdef INTERNAL_SERIAL_PORT -#if defined(INTERNAL_SERIAL_PORT) + ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) { + MarlinSerial>::store_rxd_char(); + } - ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_RX_vect)) { - MarlinSerial>::store_rxd_char(); - } + ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) { + MarlinSerial>::_tx_udr_empty_irq(); + } - ISR(SERIAL_REGNAME(USART,INTERNAL_SERIAL_PORT,_UDRE_vect)) { - MarlinSerial>::_tx_udr_empty_irq(); - } + // Preinstantiate + template class MarlinSerial>; - // Preinstantiate - template class MarlinSerial>; - - // Instantiate - MarlinSerial> internalSerial; + // Instantiate + MarlinSerial> internalSerial; #endif + // For AT90USB targets use the UART for BT interfacing #if defined(USBCON) && ENABLED(BLUETOOTH) HardwareSerial bluetoothSerial; diff --git a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h index bd0a6234f0..5ada120c6d 100644 --- a/Marlin/src/HAL/HAL_AVR/MarlinSerial.h +++ b/Marlin/src/HAL/HAL_AVR/MarlinSerial.h @@ -276,7 +276,7 @@ #endif // !USBCON -#if defined(INTERNAL_SERIAL_PORT) +#ifdef INTERNAL_SERIAL_PORT template struct MarlinInternalSerialCfg { static constexpr int PORT = serial; diff --git a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp index 7c65a904f4..0d3cc81886 100644 --- a/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp +++ b/Marlin/src/HAL/HAL_AVR/watchdog_AVR.cpp @@ -38,7 +38,7 @@ void watchdog_init() { #define WDTO_NS WDTO_4S #endif #if ENABLED(WATCHDOG_RESET_MANUAL) - // We enable the watchdog timer, but only for the interrupt. + // Enable the watchdog timer, but only for the interrupt. // Take care, as this requires the correct order of operation, with interrupts disabled. // See the datasheet of any AVR chip for details. wdt_reset(); @@ -65,7 +65,7 @@ void watchdog_init() { SERIAL_ERROR_MSG(MSG_WATCHDOG_FIRED); minkill(); // interrupt-safe final kill and infinite loop } -#endif // WATCHDOG_RESET_MANUAL +#endif #endif // USE_WATCHDOG #endif // __AVR__ diff --git a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp index a1934886f9..5adc7fcf09 100644 --- a/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp +++ b/Marlin/src/HAL/HAL_DUE/HAL_spi_Due.cpp @@ -53,7 +53,7 @@ // Public functions // -------------------------------------------------------------------------- -#if ENABLED(DUE_SOFTWARE_SPI) +#if EITHER(DUE_SOFTWARE_SPI, FORCE_SOFT_SPI) // -------------------------------------------------------------------------- // software SPI @@ -739,7 +739,42 @@ #define SPI_MODE_2_DUE_HW 0 #define SPI_MODE_3_DUE_HW 1 + /** + * The DUE SPI controller is set up so the upper word of the longword + * written to the transmit data register selects which SPI Chip Select + * Register is used. This allows different streams to have different SPI + * settings. + * + * In practice it's spooky. Some combinations hang the system, while others + * upset the peripheral device. + * + * SPI mode should be the same for all streams. The FYSETC_MINI_12864 gets + * upset if the clock phase changes after chip select goes active. + * + * SPI_CSR_CSAAT should be set for all streams. If not the WHILE_TX(0) + * macro returns immediately which can result in the SPI chip select going + * inactive before all the data has been sent. + * + * The TMC2130 library uses SPI0->SPI_CSR[3]. + * + * The U8G hardware SPI uses SPI0->SPI_CSR[0]. The system hangs and/or the + * FYSETC_MINI_12864 gets upset if lower baud rates are used and the SD card + * is inserted or removed. + * + * The SD card uses SPI0->SPI_CSR[3]. Efforts were made to use [1] and [2] + * but they all resulted in hangs or garbage on the LCD. + * + * The SPI controlled chip selects are NOT enabled in the GPIO controller. + * The application must control the chip select. + * + * All of the above can be avoided by defining FORCE_SOFT_SPI to force the + * display to use software SPI. + * + */ + void spiInit(uint8_t spiRate=6) { // Default to slowest rate if not specified) + // Also sets U8G SPI rate to 4MHz and the SPI mode to 3 + // 8.4 MHz, 4 MHz, 2 MHz, 1 MHz, 0.5 MHz, 0.329 MHz, 0.329 MHz constexpr int spiDivider[] = { 10, 21, 42, 84, 168, 255, 255 }; if (spiRate > 6) spiRate = 1; @@ -760,15 +795,16 @@ // TMC2103 compatible setup // Master mode, no fault detection, PCS bits in data written to TDR select CSR register SPI0->SPI_MR = SPI_MR_MSTR | SPI_MR_PS | SPI_MR_MODFDIS; - // SPI mode 0, 8 Bit data transfer, baud rate - SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDivider[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_0_DUE_HW; // use same CSR as TMC2130 + // SPI mode 3, 8 Bit data transfer, baud rate + SPI0->SPI_CSR[3] = SPI_CSR_SCBR(spiDivider[spiRate]) | SPI_CSR_CSAAT | SPI_MODE_3_DUE_HW; // use same CSR as TMC2130 + SPI0->SPI_CSR[0] = SPI_CSR_SCBR(spiDivider[1]) | SPI_CSR_CSAAT | SPI_MODE_3_DUE_HW; // U8G default to 4MHz } void spiBegin() { spiInit(); } static uint8_t spiTransfer(uint8_t data) { WHILE_TX(0); - SPI0->SPI_TDR = (uint32_t)data | 0x00070000UL; // Add TMC2130 PCS bits to every byte + SPI0->SPI_TDR = (uint32_t)data | 0x00070000UL; // Add TMC2130 PCS bits to every byte (use SPI0->SPI_CSR[3]) WHILE_TX(0); WHILE_RX(0); return SPI0->SPI_RDR; diff --git a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp index 1546407a1e..3cef880bca 100644 --- a/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_DUE/u8g_com_HAL_DUE_st7920_sw_spi.cpp @@ -99,7 +99,7 @@ static void u8g_com_DUE_st7920_write_byte_sw_spi(uint8_t rs, uint8_t val) { spiSend_sw_DUE(rs ? 0x0FA : 0x0F8); // Command or Data DELAY_US(40); // give the controller some time to process the data: 20 is bad, 30 is OK, 40 is safe } - spiSend_sw_DUE(val & 0x0F0); + spiSend_sw_DUE(val & 0xF0); spiSend_sw_DUE(val << 4); } @@ -168,6 +168,42 @@ uint8_t u8g_com_HAL_DUE_ST7920_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_va return 1; } -#endif // HAS_GRAPHICAL_LCD +#if ENABLED(LIGHTWEIGHT_UI) + #include "../../lcd/ultralcd.h" + #include "../shared/HAL_ST7920.h" + #define ST7920_CS_PIN LCD_PINS_RS + + #if DOGM_SPI_DELAY_US > 0 + #define U8G_DELAY() DELAY_US(DOGM_SPI_DELAY_US) + #else + #define U8G_DELAY() DELAY_US(10) + #endif + + void ST7920_cs() { + WRITE(ST7920_CS_PIN, HIGH); + U8G_DELAY(); + } + + void ST7920_ncs() { + WRITE(ST7920_CS_PIN, LOW); + } + + void ST7920_set_cmd() { + spiSend_sw_DUE(0xF8); + DELAY_US(40); + } + + void ST7920_set_dat() { + spiSend_sw_DUE(0xFA); + DELAY_US(40); + } + + void ST7920_write_byte(const uint8_t val) { + spiSend_sw_DUE(val & 0xF0); + spiSend_sw_DUE(val << 4); + } +#endif // LIGHTWEIGHT_UI + +#endif // HAS_GRAPHICAL_LCD #endif // ARDUINO_ARCH_SAM diff --git a/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp index 2d99792d21..6b1277b204 100644 --- a/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp +++ b/Marlin/src/HAL/HAL_ESP32/FlushableHardwareSerial.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.cpp b/Marlin/src/HAL/HAL_ESP32/HAL.cpp index 5e281f2ef3..53966de55e 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.cpp +++ b/Marlin/src/HAL/HAL_ESP32/HAL.cpp @@ -117,7 +117,7 @@ void HAL_idletask(void) { void HAL_clear_reset_source(void) { } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { return rtc_get_reset_reason(1); } @@ -133,12 +133,16 @@ int freeMemory() { // -------------------------------------------------------------------------- // ADC // -------------------------------------------------------------------------- -#define ADC1_CHANNEL(pin) ADC1_GPIO##pin_CHANNEL +#define ADC1_CHANNEL(pin) ADC1_GPIO ## pin ## _CHANNEL adc1_channel_t get_channel(int pin) { switch (pin) { - case 36: return ADC1_GPIO36_CHANNEL; - case 39: return ADC1_GPIO39_CHANNEL; + case 39: return ADC1_CHANNEL(39); + case 36: return ADC1_CHANNEL(36); + case 35: return ADC1_CHANNEL(35); + case 34: return ADC1_CHANNEL(34); + case 33: return ADC1_CHANNEL(33); + case 32: return ADC1_CHANNEL(32); } return ADC1_CHANNEL_MAX; @@ -147,14 +151,21 @@ adc1_channel_t get_channel(int pin) { void HAL_adc_init() { // Configure ADC adc1_config_width(ADC_WIDTH_12Bit); - adc1_config_channel_atten(get_channel(36), ADC_ATTEN_11db); adc1_config_channel_atten(get_channel(39), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(36), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(35), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(34), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(33), ADC_ATTEN_11db); + adc1_config_channel_atten(get_channel(32), ADC_ATTEN_11db); + + // Note that adc2 is shared with the WiFi module, which has higher priority, so the conversion may fail. + // That's why we're not setting it up here. // Calculate ADC characteristics i.e. gain and offset factors esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_12, V_REF, &characteristics); } -void HAL_adc_start_conversion (uint8_t adc_pin) { +void HAL_adc_start_conversion(uint8_t adc_pin) { uint32_t mv; esp_adc_cal_get_voltage((adc_channel_t)get_channel(adc_pin), &characteristics, &mv); diff --git a/Marlin/src/HAL/HAL_ESP32/HAL.h b/Marlin/src/HAL/HAL_ESP32/HAL.h index a291458b33..16859263b2 100644 --- a/Marlin/src/HAL/HAL_ESP32/HAL.h +++ b/Marlin/src/HAL/HAL_ESP32/HAL.h @@ -30,13 +30,18 @@ #include +// these are going to be re-defined in Arduino.h #undef DISABLED #undef M_PI +#undef _BV #include +// revert back to the correct (old) definition #undef DISABLED #define DISABLED(V...) DO(DIS,&&,V) +// re-define in case Arduino.h has been skipped due to earlier inclusion (i.e. in Marlin\src\HAL\HAL_ESP32\i2s.cpp) +#define _BV(b) (1UL << (b)) #include "../shared/math_32bit.h" #include "../shared/HAL_SPI.h" @@ -97,7 +102,7 @@ extern uint16_t HAL_adc_result; void HAL_clear_reset_source (void); // reset reason -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(int delay); @@ -120,7 +125,7 @@ void HAL_adc_init(void); #define HAL_READ_ADC() HAL_adc_result #define HAL_ADC_READY() true -void HAL_adc_start_conversion (uint8_t adc_pin); +void HAL_adc_start_conversion(uint8_t adc_pin); #define GET_PIN_MAP_PIN(index) index #define GET_PIN_MAP_INDEX(pin) pin diff --git a/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp index 4858ba4c3e..bdc804dacf 100644 --- a/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp +++ b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -21,213 +21,132 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include "../../inc/MarlinConfig.h" +#include "../../inc/MarlinConfigPre.h" #if ENABLED(WIFISUPPORT) #include "WebSocketSerial.h" - -extern WebSocketSerial webSocketSerial; - #include "wifi.h" -#include #include -struct ring_buffer_r { - unsigned char buffer[RX_BUFFER_SIZE]; - volatile ring_buffer_pos_t head, tail; -}; +WebSocketSerial webSocketSerial; +AsyncWebSocket ws("/ws"); // TODO Move inside the class. -struct ring_buffer_t { - unsigned char buffer[256]; - volatile uint8_t head, tail; -}; +// RingBuffer impl -ring_buffer_r rx_buffer = { { 0 }, 0, 0 }; -ring_buffer_t tx_buffer = { { 0 }, 0, 0 }; +#define NEXT_INDEX(I, SIZE) ((I + 1) & (ring_buffer_pos_t)(SIZE - 1)) -static bool _written; +RingBuffer::RingBuffer(ring_buffer_pos_t size) + : data(new uint8_t[size]), + read_index(0), + write_index(0), + size(size) +{} -#if ENABLED(EMERGENCY_PARSER) - static EmergencyParser::State emergency_state; // = EP_RESET -#endif +RingBuffer::~RingBuffer() { delete[] data; } -AsyncWebSocket ws("/ws"); // access at ws://[esp ip]/ws +ring_buffer_pos_t RingBuffer::write(const uint8_t c) { + const ring_buffer_pos_t n = NEXT_INDEX(write_index, size); -FORCE_INLINE int next_rx_index(const int i) { return (ring_buffer_pos_t)(i + 1) & (ring_buffer_pos_t)(RX_BUFFER_SIZE - 1); } -FORCE_INLINE int next_tx_index(const int i) { return (ring_buffer_pos_t)(i + 1) & (ring_buffer_pos_t)(TX_BUFFER_SIZE - 1); } - -static void addToBuffer(uint8_t * const data, const size_t len) { - for (size_t i = 0; i < len; i++) { - ring_buffer_pos_t h = rx_buffer.head; - const ring_buffer_pos_t t = rx_buffer.tail, n = next_rx_index(h); - - if (n != t) { rx_buffer.buffer[h] = data[i]; h = n; } - - // TODO: buffer is full, handle? - - rx_buffer.head = h; + if (n != read_index) { + this->data[write_index] = c; + write_index = n; + return 1; } + + // TODO: buffer is full, handle? + return 0; } -// Handle WebSocket event -static void onEvent(AsyncWebSocket * server, AsyncWebSocketClient * client, AwsEventType type, void * arg, uint8_t *data, size_t len) { - switch (type) { - case WS_EVT_CONNECT: client->ping(); break; // client connected - case WS_EVT_DISCONNECT: // client disconnected - case WS_EVT_ERROR: // error was received from the other end - case WS_EVT_PONG: break; // pong message was received (in response to a ping request maybe) - case WS_EVT_DATA: { // data packet - AwsFrameInfo * info = (AwsFrameInfo*)arg; - if (info->opcode == WS_TEXT || info->message_opcode == WS_TEXT) - addToBuffer(data, len); - } +ring_buffer_pos_t RingBuffer::write(const uint8_t *buffer, ring_buffer_pos_t size) { + ring_buffer_pos_t written = 0; + for (ring_buffer_pos_t i = 0; i < size; i++) { + written += write(buffer[i]); } + return written; } -// Public Methods +int RingBuffer::available(void) { + return (size - read_index + write_index) & (size - 1); +} + +int RingBuffer::peek(void) { + return available() ? data[read_index] : -1; +} + +int RingBuffer::read(void) { + if (available()) { + const int ret = data[read_index]; + read_index = NEXT_INDEX(read_index, size); + return ret; + } + return -1; +} + +ring_buffer_pos_t RingBuffer::read(uint8_t *buffer) { + ring_buffer_pos_t len = available(); + + for(ring_buffer_pos_t i = 0; read_index != write_index; i++) { + buffer[i] = data[read_index]; + read_index = NEXT_INDEX(read_index, size); + } + + return len; +} + +void RingBuffer::flush(void) { read_index = write_index; } + +// WebSocketSerial impl +WebSocketSerial::WebSocketSerial() + : rx_buffer(RingBuffer(RX_BUFFER_SIZE)), + tx_buffer(RingBuffer(TX_BUFFER_SIZE)) +{} + void WebSocketSerial::begin(const long baud_setting) { - ws.onEvent(onEvent); - server.addHandler(&ws); // attach AsyncWebSocket + ws.onEvent([this](AsyncWebSocket *server, AsyncWebSocketClient *client, AwsEventType type, void *arg, uint8_t *data, size_t len) { + switch (type) { + case WS_EVT_CONNECT: client->ping(); break; // client connected + case WS_EVT_DISCONNECT: // client disconnected + case WS_EVT_ERROR: // error was received from the other end + case WS_EVT_PONG: break; // pong message was received (in response to a ping request maybe) + case WS_EVT_DATA: { // data packet + AwsFrameInfo * info = (AwsFrameInfo*)arg; + if (info->opcode == WS_TEXT || info->message_opcode == WS_TEXT) + this->rx_buffer.write(data, len); + } + } + }); + server.addHandler(&ws); } void WebSocketSerial::end() { } +int WebSocketSerial::peek(void) { return rx_buffer.peek(); } +int WebSocketSerial::read(void) { return rx_buffer.read(); } +int WebSocketSerial::available(void) { return rx_buffer.available(); } +void WebSocketSerial::flush(void) { rx_buffer.flush(); } -int WebSocketSerial::peek(void) { - const int v = rx_buffer.head == rx_buffer.tail ? -1 : rx_buffer.buffer[rx_buffer.tail]; - return v; -} +size_t WebSocketSerial::write(const uint8_t c) { + size_t ret = tx_buffer.write(c); -int WebSocketSerial::read(void) { - const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail; - if (h == t) return -1; // Nothing to read? Return now - - const int v = rx_buffer.buffer[t]; - - rx_buffer.tail = (ring_buffer_pos_t)(t + 1) & (RX_BUFFER_SIZE - 1); // Advance tail - - return v; -} - -bool WebSocketSerial::available(void) { - const ring_buffer_pos_t h = rx_buffer.head, t = rx_buffer.tail; - return (ring_buffer_pos_t)(RX_BUFFER_SIZE + h - t) & (RX_BUFFER_SIZE - 1); -} - -void WebSocketSerial::flush(void) { - ws.textAll("flush"); - rx_buffer.tail = rx_buffer.head; -} - -#if TX_BUFFER_SIZE - - void WebSocketSerial::write(const uint8_t c) { - _written = true; - - const uint8_t i = (tx_buffer.head + 1) & (TX_BUFFER_SIZE - 1); - - // Store new char. head is always safe to move - tx_buffer.buffer[tx_buffer.head] = c; - tx_buffer.head = i; - - if (c == '\n') { - ws.textAll(tx_buffer.buffer, tx_buffer.head); - tx_buffer.head = 0; - } + if (ret && c == '\n') { + uint8_t tmp[TX_BUFFER_SIZE]; + ring_buffer_pos_t size = tx_buffer.read(tmp); + ws.textAll(tmp, size); } - void WebSocketSerial::flushTx(void) { - ws.textAll("flushTx"); - if (!_written) return; - } - -#else - - //void WebSocketSerial::write(const uint8_t c) { _written = true; } - //void WebSocketSerial::flushTx(void) { if (!_written) return; } - -#endif - -/** - * Imports from print.h - */ - -void WebSocketSerial::print(char c, int base) { print((long)c, base); } -void WebSocketSerial::print(unsigned char b, int base) { print((unsigned long)b, base); } -void WebSocketSerial::print(int n, int base) { print((long)n, base); } -void WebSocketSerial::print(unsigned int n, int base) { print((unsigned long)n, base); } -void WebSocketSerial::print(long n, int base) { - if (base == 0) - write(n); - else if (base == 10) { - if (n < 0) { print('-'); n = -n; } - printNumber(n, 10); - } - else - printNumber(n, base); + return ret; } -void WebSocketSerial::print(unsigned long n, int base) { - if (base == 0) write(n); else printNumber(n, base); +size_t WebSocketSerial::write(const uint8_t* buffer, size_t size) { + size_t written = 0; + for(size_t i = 0; i < size; i++) { + written += write(buffer[i]); + } + return written; } -void WebSocketSerial::print(double n, int digits) { printFloat(n, digits); } - -void WebSocketSerial::println(void) { print('\r'); print('\n'); } -void WebSocketSerial::println(const String& s) { print(s); println(); } -void WebSocketSerial::println(const char c[]) { print(c); println(); } -void WebSocketSerial::println(char c, int base) { print(c, base); println(); } -void WebSocketSerial::println(unsigned char b, int base) { print(b, base); println(); } -void WebSocketSerial::println(int n, int base) { print(n, base); println(); } -void WebSocketSerial::println(unsigned int n, int base) { print(n, base); println(); } -void WebSocketSerial::println(long n, int base) { print(n, base); println(); } -void WebSocketSerial::println(unsigned long n, int base) { print(n, base); println(); } -void WebSocketSerial::println(double n, int digits) { print(n, digits); println(); } - -// Private Methods - -void WebSocketSerial::printNumber(unsigned long n, uint8_t base) { - if (n) { - unsigned char buf[8 * sizeof(long)]; // Enough space for base 2 - int8_t i = 0; - while (n) { - buf[i++] = n % base; - n /= base; - } - while (i--) - print((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10))); - } - else - print('0'); -} - -void WebSocketSerial::printFloat(double number, uint8_t digits) { - // Handle negative numbers - if (number < 0.0) { print('-'); number = -number; } - - // Round correctly so that print(1.999, 2) prints as "2.00" - // Use a lookup table for performance - constexpr double rounds[] = { 0.5, 0.05, 0.005, 0.0005, 0.00005, 0.000005, 0.0000005, 0.00000005 }; - number += rounds[digits]; - - //number += pow(10, -(digits + 1)); // slower single-line equivalent - - // Extract the integer part of the number and print it - unsigned long int_part = (unsigned long)number; - print(int_part); - - // Print the decimal point, but only if there are digits beyond - double remainder = number - (double)int_part; - if (digits) { - print('.'); - // Extract digits from the remainder one at a time - while (digits--) { - remainder *= 10.0; - const int toPrint = int(remainder); - print(toPrint); - remainder -= toPrint; - } - } +void WebSocketSerial::flushTX(void) { + // No need to do anything as there's no benefit to sending partial lines over the websocket connection. } #endif // WIFISUPPORT diff --git a/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h index 43c8044107..6100587555 100644 --- a/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h +++ b/Marlin/src/HAL/HAL_ESP32/WebSocketSerial.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -23,12 +23,7 @@ #include "../../inc/MarlinConfig.h" -#include - -#define DEC 10 -#define HEX 16 -#define OCT 8 -#define BIN 2 +#include "Stream.h" #ifndef RX_BUFFER_SIZE #define RX_BUFFER_SIZE 128 @@ -40,60 +35,50 @@ #error "TX_BUFFER_SIZE is required for the WebSocket." #endif -#if RX_BUFFER_SIZE > 256 - typedef uint16_t ring_buffer_pos_t; -#else - typedef uint8_t ring_buffer_pos_t; -#endif +typedef uint16_t ring_buffer_pos_t; + +class RingBuffer { + uint8_t *data; + ring_buffer_pos_t size, read_index, write_index; -class WebSocketSerial { public: - WebSocketSerial() {}; - static void begin(const long); - static void end(); - static int peek(void); - static int read(void); - static void flush(void); - static void flushTx(void); - static bool available(void); - static void write(const uint8_t c); + RingBuffer(ring_buffer_pos_t size); + ~RingBuffer(); + + int available(void); + int peek(void); + int read(void); + ring_buffer_pos_t read(uint8_t *buffer); + void flush(void); + ring_buffer_pos_t write(const uint8_t c); + ring_buffer_pos_t write(const uint8_t* buffer, ring_buffer_pos_t size); +}; + +class WebSocketSerial: public Stream { + RingBuffer rx_buffer; + RingBuffer tx_buffer; + +public: + WebSocketSerial(); + void begin(const long); + void end(); + int available(void); + int peek(void); + int read(void); + void flush(void); + void flushTX(void); + size_t write(const uint8_t c); + size_t write(const uint8_t* buffer, size_t size); + + operator bool() { return true; } #if ENABLED(SERIAL_STATS_DROPPED_RX) - FORCE_INLINE static uint32_t dropped() { return 0; } + FORCE_INLINE uint32_t dropped() { return 0; } #endif #if ENABLED(SERIAL_STATS_MAX_RX_QUEUED) - FORCE_INLINE static int rxMaxEnqueued() { return 0; } + FORCE_INLINE int rxMaxEnqueued() { return 0; } #endif - - FORCE_INLINE static void write(const char* str) { while (*str) write(*str++); } - FORCE_INLINE static void write(const uint8_t* buffer, size_t size) { while (size--) write(*buffer++); } - FORCE_INLINE static void print(const String& s) { for (int i = 0; i < (int)s.length(); i++) write(s[i]); } - FORCE_INLINE static void print(const char* str) { write(str); } - - static void print(char, int = 0); - static void print(unsigned char, int = 0); - static void print(int, int = DEC); - static void print(unsigned int, int = DEC); - static void print(long, int = DEC); - static void print(unsigned long, int = DEC); - static void print(double, int = 2); - - static void println(const String& s); - static void println(const char[]); - static void println(char, int = 0); - static void println(unsigned char, int = 0); - static void println(int, int = DEC); - static void println(unsigned int, int = DEC); - static void println(long, int = DEC); - static void println(unsigned long, int = DEC); - static void println(double, int = 2); - static void println(void); - operator bool() { return true; } - -private: - static void printNumber(unsigned long, const uint8_t); - static void printFloat(double, uint8_t); }; extern WebSocketSerial webSocketSerial; diff --git a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h index dc2cd708de..b71ca78418 100644 --- a/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h +++ b/Marlin/src/HAL/HAL_ESP32/fastio_ESP32.h @@ -27,6 +27,10 @@ * Utility functions */ +// I2S expander pin mapping. +#define IS_I2S_EXPANDER_PIN(IO) TEST(IO, 7) +#define I2S_EXPANDER_PIN_INDEX(IO) (IO & 0x7F) + // Set pin as input #define _SET_INPUT(IO) pinMode(IO, INPUT) @@ -37,10 +41,10 @@ #define _PULLUP(IO, v) pinMode(IO, v ? INPUT_PULLUP : INPUT) // Read a pin wrapper -#define READ(IO) digitalRead(IO) +#define READ(IO) (IS_I2S_EXPANDER_PIN(IO) ? i2s_state(I2S_EXPANDER_PIN_INDEX(IO)) : digitalRead(IO)) // Write to a pin wrapper -#define WRITE(IO, v) (TEST(IO, 7) ? i2s_write(IO & 0x7F, v) : digitalWrite(IO, v)) +#define WRITE(IO, v) (IS_I2S_EXPANDER_PIN(IO) ? i2s_write(I2S_EXPANDER_PIN_INDEX(IO), v) : digitalWrite(IO, v)) // Set pin as input wrapper #define SET_INPUT(IO) _SET_INPUT(IO) @@ -61,8 +65,9 @@ #define extDigitalRead(IO) digitalRead(IO) #define extDigitalWrite(IO,V) digitalWrite(IO,V) -#define PWM_PIN(P) true -#define USEABLE_HARDWARE_PWM(P) PWM_PIN(P) +// PWM outputs +#define PWM_PIN(P) (P < 34) // NOTE Pins >= 34 are input only on ESP32, so they can't be used for output. +#define USEABLE_HARDWARE_PWM(P) (!IS_I2S_EXPANDER_PIN(P) && PWM_PIN(P)) // Toggle pin value #define TOGGLE(IO) WRITE(IO, !READ(IO)) diff --git a/Marlin/src/HAL/HAL_ESP32/i2s.cpp b/Marlin/src/HAL/HAL_ESP32/i2s.cpp index c503a24bf8..0345889e07 100644 --- a/Marlin/src/HAL/HAL_ESP32/i2s.cpp +++ b/Marlin/src/HAL/HAL_ESP32/i2s.cpp @@ -21,7 +21,12 @@ */ #ifdef ARDUINO_ARCH_ESP32 -#include // replace that with the proper imports +// replace that with the proper imports, then cleanup workarounds in Marlin\src\HAL\HAL_ESP32\HAL.h +#include +// revert back to the correct definition +#undef DISABLED +#define DISABLED(V...) DO(DIS,&&,V) + #include "i2s.h" #include "../../core/macros.h" #include "driver/periph_ctrl.h" @@ -303,9 +308,9 @@ int i2s_init() { xTaskCreate(stepperTask, "StepperTask", 10000, NULL, 1, NULL); // Route the i2s pins to the appropriate GPIO - gpio_matrix_out_check(22, I2S0O_DATA_OUT23_IDX, 0, 0); - gpio_matrix_out_check(25, I2S0O_WS_OUT_IDX, 0, 0); - gpio_matrix_out_check(26, I2S0O_BCK_OUT_IDX, 0, 0); + gpio_matrix_out_check(I2S_DATA, I2S0O_DATA_OUT23_IDX, 0, 0); + gpio_matrix_out_check(I2S_BCK, I2S0O_BCK_OUT_IDX, 0, 0); + gpio_matrix_out_check(I2S_WS, I2S0O_WS_OUT_IDX, 0, 0); // Start the I2S peripheral return i2s_start(I2S_NUM_0); @@ -315,6 +320,10 @@ void i2s_write(uint8_t pin, uint8_t val) { SET_BIT_TO(i2s_port_data, pin, val); } +uint8_t i2s_state(uint8_t pin) { + return TEST(i2s_port_data, pin); +} + void i2s_push_sample() { dma.current[dma.rw_pos++] = i2s_port_data; } diff --git a/Marlin/src/HAL/HAL_ESP32/i2s.h b/Marlin/src/HAL/HAL_ESP32/i2s.h index 32999f712f..fbe7b2419a 100644 --- a/Marlin/src/HAL/HAL_ESP32/i2s.h +++ b/Marlin/src/HAL/HAL_ESP32/i2s.h @@ -26,6 +26,14 @@ extern uint32_t i2s_port_data; int i2s_init(); +uint8_t i2s_state(uint8_t pin); + void i2s_write(uint8_t pin, uint8_t val); void i2s_push_sample(); + +// pin definitions + +#define I2S_WS 25 +#define I2S_BCK 26 +#define I2S_DATA 27 diff --git a/Marlin/src/HAL/HAL_ESP32/spi_pins.h b/Marlin/src/HAL/HAL_ESP32/spi_pins.h index 896d9fa853..4ef6d14ec3 100644 --- a/Marlin/src/HAL/HAL_ESP32/spi_pins.h +++ b/Marlin/src/HAL/HAL_ESP32/spi_pins.h @@ -18,7 +18,7 @@ */ #pragma once -#define SS_PIN 5 +#define SS_PIN SDSS #define SCK_PIN 18 #define MISO_PIN 19 #define MOSI_PIN 23 diff --git a/Marlin/src/HAL/HAL_ESP32/web.cpp b/Marlin/src/HAL/HAL_ESP32/web.cpp index 6bbc0d13aa..cb06cfc7e4 100644 --- a/Marlin/src/HAL/HAL_ESP32/web.cpp +++ b/Marlin/src/HAL/HAL_ESP32/web.cpp @@ -1,7 +1,9 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,6 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * */ #ifdef ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/web.h b/Marlin/src/HAL/HAL_ESP32/web.h index 7f8796e7d4..4173fd91b0 100644 --- a/Marlin/src/HAL/HAL_ESP32/web.h +++ b/Marlin/src/HAL/HAL_ESP32/web.h @@ -1,7 +1,9 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,6 +17,7 @@ * * 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/HAL_ESP32/wifi.cpp b/Marlin/src/HAL/HAL_ESP32/wifi.cpp index 7afc7a87a8..9fb5459ae0 100644 --- a/Marlin/src/HAL/HAL_ESP32/wifi.cpp +++ b/Marlin/src/HAL/HAL_ESP32/wifi.cpp @@ -1,7 +1,9 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,6 +17,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see . + * */ #ifdef ARDUINO_ARCH_ESP32 diff --git a/Marlin/src/HAL/HAL_ESP32/wifi.h b/Marlin/src/HAL/HAL_ESP32/wifi.h index ef35cf14ca..7be40ef900 100644 --- a/Marlin/src/HAL/HAL_ESP32/wifi.h +++ b/Marlin/src/HAL/HAL_ESP32/wifi.h @@ -1,7 +1,9 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] - * Copyright (c) 2016 Bob Cousins bobcousins42@googlemail.com + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,6 +17,7 @@ * * 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/HAL_LPC1768/HAL.h b/Marlin/src/HAL/HAL_LPC1768/HAL.h index 0ac6db167e..36357d6aea 100644 --- a/Marlin/src/HAL/HAL_LPC1768/HAL.h +++ b/Marlin/src/HAL/HAL_LPC1768/HAL.h @@ -147,6 +147,9 @@ using FilteredADC = LPC176x::ADC; #define HAL_READ_ADC() FilteredADC::get_result() #define HAL_ADC_READY() FilteredADC::finished_conversion() +// A grace period for the ADC readings to stabilize before they start causing thermal protection errors. +#define THERMAL_PROTECTION_GRACE_PERIOD 800 + // Parse a G-code word into a pin index int16_t PARSED_PIN_INDEX(const char code, const int16_t dval); // P0.6 thru P0.9 are for the onboard SD card diff --git a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h index ecf0eb0c07..2338b34ee3 100644 --- a/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h +++ b/Marlin/src/HAL/HAL_LPC1768/SanityCheck.h @@ -66,12 +66,7 @@ #endif #endif // SPINDLE_LASER_ENABLE -#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI) \ - && (MB(RAMPS_14_RE_ARM_EFB) \ - || MB(RAMPS_14_RE_ARM_EEB) \ - || MB(RAMPS_14_RE_ARM_EFF) \ - || MB(RAMPS_14_RE_ARM_EEF) \ - || MB(RAMPS_14_RE_ARM_SF)) +#if IS_RE_ARM_BOARD && ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) && HAS_DRIVER(TMC2130) && DISABLED(TMC_USE_SW_SPI) #error "Re-ARM with REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and TMC2130 require TMC_USE_SW_SPI" #endif diff --git a/Marlin/src/HAL/HAL_LPC1768/main.cpp b/Marlin/src/HAL/HAL_LPC1768/main.cpp index 609c0c7e66..cc74eedc1b 100644 --- a/Marlin/src/HAL/HAL_LPC1768/main.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/main.cpp @@ -1,3 +1,24 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ #ifdef TARGET_LPC1768 #include diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp index aad3603ad2..58631a1e17 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_ssd_hw_i2c.cpp @@ -137,8 +137,11 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v case U8G_COM_MSG_WRITE_BYTE: //u8g->pin_list[U8G_PI_SET_A0] = 1; - //if (u8g_com_arduino_ssd_start_sequence(u8g) == 0) - // return u8g_i2c_stop(), 0; + if (u8g_com_ssd_I2C_start_sequence(u8g) == 0) { + u8g_i2c_stop(); + return 0; + } + if (u8g_i2c_send_byte(arg_val) == 0) { u8g_i2c_stop(); return 0; @@ -186,9 +189,6 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_v case U8G_COM_MSG_ADDRESS: /* define cmd (arg_val = 0) or data mode (arg_val = 1) */ u8g->pin_list[U8G_PI_A0_STATE] = arg_val; u8g->pin_list[U8G_PI_SET_A0] = 1; /* force a0 to set again */ - - u8g_i2c_start(0); // send slave address and write bit - u8g_i2c_send_byte(arg_val ? 0x40 : 0x80); // Write to ? Graphics DRAM mode : Command mode break; } // switch diff --git a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp index 1419a74f42..e851284ad5 100644 --- a/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp +++ b/Marlin/src/HAL/HAL_LPC1768/u8g/u8g_com_HAL_LPC1768_sw_spi.cpp @@ -65,10 +65,76 @@ #undef SPI_SPEED #define SPI_SPEED 2 // About 2 MHz +#include +#include +#include + +#include + +uint8_t swSpiTransfer_mode_0(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { + + for (uint8_t i = 0; i < 8; i++) { + if (spi_speed == 0) { + gpio_set(mosi_pin, !!(b & 0x80)); + gpio_set(sck_pin, HIGH); + b <<= 1; + if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1; + gpio_set(sck_pin, LOW); + } + else { + const uint8_t state = (b & 0x80) ? HIGH : LOW; + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(mosi_pin, state); + + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++) + gpio_set(sck_pin, HIGH); + + b <<= 1; + if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1; + + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(sck_pin, LOW); + } + } + + return b; +} + +uint8_t swSpiTransfer_mode_3(uint8_t b, const uint8_t spi_speed, const pin_t sck_pin, const pin_t miso_pin, const pin_t mosi_pin ) { + + for (uint8_t i = 0; i < 8; i++) { + const uint8_t state = (b & 0x80) ? HIGH : LOW; + if (spi_speed == 0) { + gpio_set(sck_pin, LOW); + gpio_set(mosi_pin, state); + gpio_set(mosi_pin, state); // need some setup time + gpio_set(sck_pin, HIGH); + } + else { + for (uint8_t j = 0; j < spi_speed + (miso_pin >= 0 ? 0 : 1); j++) + gpio_set(sck_pin, LOW); + + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(mosi_pin, state); + + for (uint8_t j = 0; j < spi_speed; j++) + gpio_set(sck_pin, HIGH); + } + b <<= 1; + if (miso_pin >= 0 && gpio_get(miso_pin)) b |= 1; + } + + return b; +} + static uint8_t SPI_speed = 0; static void u8g_sw_spi_HAL_LPC1768_shift_out(uint8_t dataPin, uint8_t clockPin, uint8_t val) { - swSpiTransfer(val, SPI_speed, clockPin, -1, dataPin); + #if ENABLED(FYSETC_MINI_12864) + swSpiTransfer_mode_3(val, SPI_speed, clockPin, -1, dataPin); + #else + swSpiTransfer_mode_0(val, SPI_speed, clockPin, -1, dataPin); + #endif } uint8_t u8g_com_HAL_LPC1768_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) { diff --git a/Marlin/src/HAL/HAL_STM32/HAL.cpp b/Marlin/src/HAL/HAL_STM32/HAL.cpp index 0eaee0711b..881168a129 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32/HAL.cpp @@ -120,7 +120,7 @@ void HAL_init(void) { void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG; if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE; if (__HAL_RCC_GET_FLAG(RCC_FLAG_PINRST) != RESET) return RST_EXTERNAL; diff --git a/Marlin/src/HAL/HAL_STM32/HAL.h b/Marlin/src/HAL/HAL_STM32/HAL.h index 84c57a1434..d08a49587f 100644 --- a/Marlin/src/HAL/HAL_STM32/HAL.h +++ b/Marlin/src/HAL/HAL_STM32/HAL.h @@ -165,7 +165,7 @@ void HAL_init(void); void HAL_clear_reset_source (void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); diff --git a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h index a3e93503d8..fe0da6387b 100644 --- a/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F4/EEPROM_Emul/eeprom_emul.h @@ -1,50 +1,48 @@ -/** - ****************************************************************************** - * @file EEPROM/EEPROM_Emulation/inc/eeprom.h - * @author MCD Application Team - * @version V1.2.6 - * @date 04-November-2016 - * @brief This file contains all the functions prototypes for the EEPROM - * emulation firmware library. - ****************************************************************************** - * @attention - * - *

© Copyright � 2016 STMicroelectronics International N.V. - * All rights reserved.

- * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted, provided that the following conditions are met: - * - * 1. Redistribution of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of other - * contributors to this software may be used to endorse or promote products - * derived from this software without specific written permission. - * 4. This software, including modifications and/or derivative works of this - * software, must execute solely and exclusively on microcontroller or - * microprocessor devices manufactured by or for STMicroelectronics. - * 5. Redistribution and use of this software other than as permitted under - * this license is void and will automatically terminate your rights under - * this license. - * - * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY - * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT - * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ +/****************************************************************************** + * @file eeprom_emul.h + * @author MCD Application Team + * @version V1.2.6 + * @date 04-November-2016 + * @brief This file contains all the functions prototypes for the EEPROM + * emulation firmware library. + ****************************************************************************** + * @attention + * + *

© Copyright � 2016 STMicroelectronics International N.V. + * All rights reserved.

+ * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that the following conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific written permission. + * 4. This software, including modifications and/or derivative works of this + * software, must execute solely and exclusively on microcontroller or + * microprocessor devices manufactured by or for STMicroelectronics. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. + * + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + ******************************************************************************/ #pragma once // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp index 2bb443d0cd..5840a525b6 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.cpp @@ -79,7 +79,7 @@ void sei(void) { interrupts(); } void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG; if (__HAL_RCC_GET_FLAG(RCC_FLAG_SFTRST) != RESET) return RST_SOFTWARE; diff --git a/Marlin/src/HAL/HAL_STM32F4/HAL.h b/Marlin/src/HAL/HAL_STM32F4/HAL.h index d009e26af2..c41fe05f60 100644 --- a/Marlin/src/HAL/HAL_STM32F4/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F4/HAL.h @@ -170,7 +170,7 @@ extern uint16_t HAL_adc_result; void HAL_clear_reset_source (void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); diff --git a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h index 441ff1bae1..8cffdbef77 100644 --- a/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h +++ b/Marlin/src/HAL/HAL_STM32F7/EEPROM_Emul/eeprom_emul.h @@ -1,50 +1,48 @@ -/** - ****************************************************************************** - * @file EEPROM/EEPROM_Emulation/inc/eeprom.h - * @author MCD Application Team - * @version V1.2.6 - * @date 04-November-2016 - * @brief This file contains all the functions prototypes for the EEPROM - * emulation firmware library. - ****************************************************************************** - * @attention - * - *

© Copyright © 2016 STMicroelectronics International N.V. - * All rights reserved.

- * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted, provided that the following conditions are met: - * - * 1. Redistribution of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * 3. Neither the name of STMicroelectronics nor the names of other - * contributors to this software may be used to endorse or promote products - * derived from this software without specific written permission. - * 4. This software, including modifications and/or derivative works of this - * software, must execute solely and exclusively on microcontroller or - * microprocessor devices manufactured by or for STMicroelectronics. - * 5. Redistribution and use of this software other than as permitted under - * this license is void and will automatically terminate your rights under - * this license. - * - * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A - * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY - * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT - * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, - * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************** - */ +/****************************************************************************** + * @file eeprom_emul.h + * @author MCD Application Team + * @version V1.2.6 + * @date 04-November-2016 + * @brief This file contains all the functions prototypes for the EEPROM + * emulation firmware library. + ****************************************************************************** + * @attention + * + *

© Copyright © 2016 STMicroelectronics International N.V. + * All rights reserved.

+ * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted, provided that the following conditions are met: + * + * 1. Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * 3. Neither the name of STMicroelectronics nor the names of other + * contributors to this software may be used to endorse or promote products + * derived from this software without specific written permission. + * 4. This software, including modifications and/or derivative works of this + * software, must execute solely and exclusively on microcontroller or + * microprocessor devices manufactured by or for STMicroelectronics. + * 5. Redistribution and use of this software other than as permitted under + * this license is void and will automatically terminate your rights under + * this license. + * + * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A + * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY + * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT + * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + *****************************************************************************/ #pragma once // -------------------------------------------------------------------------- diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp index 01f577cdad..9f354f17e3 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.cpp +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.cpp @@ -79,7 +79,7 @@ void sei(void) { interrupts(); } void HAL_clear_reset_source(void) { __HAL_RCC_CLEAR_RESET_FLAGS(); } -uint8_t HAL_get_reset_source (void) { +uint8_t HAL_get_reset_source(void) { if (__HAL_RCC_GET_FLAG(RCC_FLAG_IWDGRST) != RESET) return RST_WATCHDOG; diff --git a/Marlin/src/HAL/HAL_STM32F7/HAL.h b/Marlin/src/HAL/HAL_STM32F7/HAL.h index 5ece2b5b6b..db7aa0391a 100644 --- a/Marlin/src/HAL/HAL_STM32F7/HAL.h +++ b/Marlin/src/HAL/HAL_STM32F7/HAL.h @@ -157,7 +157,7 @@ extern uint16_t HAL_adc_result; void HAL_clear_reset_source (void); /** reset reason */ -uint8_t HAL_get_reset_source (void); +uint8_t HAL_get_reset_source(void); void _delay_ms(const int delay); diff --git a/Marlin/src/HAL/shared/HAL_ST7920.h b/Marlin/src/HAL/shared/HAL_ST7920.h new file mode 100644 index 0000000000..9af1286c7a --- /dev/null +++ b/Marlin/src/HAL/shared/HAL_ST7920.h @@ -0,0 +1,36 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ +#pragma once + +/** + * HAL/HAL_ST7920.h + * For the HALs that provide direct access to the ST7920 display + * (bypassing U8G), it will allow the LIGHTWEIGHT_UI to operate. + */ + +#if HAS_GRAPHICAL_LCD && ENABLED(LIGHTWEIGHT_UI) + void ST7920_cs(); + void ST7920_ncs(); + void ST7920_set_cmd(); + void ST7920_set_dat(); + void ST7920_write_byte(const uint8_t data); +#endif \ No newline at end of file diff --git a/Marlin/src/core/boards.h b/Marlin/src/core/boards.h index ee9da1fd16..4a7fb642b9 100644 --- a/Marlin/src/core/boards.h +++ b/Marlin/src/core/boards.h @@ -194,6 +194,7 @@ #define BOARD_BIQU_B300_V1_0 1760 // BIQU B300_V1.0 (Power outputs: Hotend0, Fan, Bed, SPI Driver) #define BOARD_BIGTREE_SKR_V1_3 1761 // BIGTREE SKR_V1.3 (Power outputs: Hotend0, Hotend1, Fan, Bed) #define BOARD_AZTEEG_X5_MINI 1762 // Azteeg X5 Mini (Power outputs: Hotend0, Bed, Fan) +#define BOARD_MKS_SGEN 1763 // MKS-SGen (Power outputs: Hotend0, Hotend1, Bed, Fan) // // SAM3X8E ARM Cortex M3 diff --git a/Marlin/src/core/debug_out.h b/Marlin/src/core/debug_out.h index e92c5c5416..c43c928a29 100644 --- a/Marlin/src/core/debug_out.h +++ b/Marlin/src/core/debug_out.h @@ -19,7 +19,6 @@ * along with this program. If not, see . * */ -#pragma once // // Serial aliases for debugging. @@ -27,6 +26,7 @@ // (or not) in a given .cpp file // +#undef DEBUG_PRINT_P #undef DEBUG_ECHO_START #undef DEBUG_ERROR_START #undef DEBUG_CHAR diff --git a/Marlin/src/core/language.h b/Marlin/src/core/language.h index 0dfd54b3af..14dcf8bd30 100644 --- a/Marlin/src/core/language.h +++ b/Marlin/src/core/language.h @@ -344,7 +344,6 @@ #define MSG_LCD_N3 " 4" #define MSG_LCD_N4 " 5" #define MSG_LCD_N5 " 6" -#define MSG_E0 "E0" #define MSG_E1 "E1" #define MSG_E2 "E2" #define MSG_E3 "E3" diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index e695601cef..cc7d0065e9 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -264,15 +264,15 @@ void safe_delay(millis_t ms) { return conv; } - // Convert unsigned float to string with 1234.56 format omitting trailing zeros - char* ftostr62rj(const float &f) { - const long i = ((f < 0 ? -f : f) * 1000 + 5) / 10; - conv[0] = RJDIGIT(i, 100000); + // Convert unsigned float to string with 1234.5 format omitting trailing zeros + char* ftostr51rj(const float &f) { + const long i = ((f < 0 ? -f : f) * 100 + 5) / 10; + conv[0] = ' '; conv[1] = RJDIGIT(i, 10000); conv[2] = RJDIGIT(i, 1000); - conv[3] = DIGIMOD(i, 100); - conv[4] = '.'; - conv[5] = DIGIMOD(i, 10); + conv[3] = RJDIGIT(i, 100); + conv[4] = DIGIMOD(i, 10); + conv[5] = '.'; conv[6] = DIGIMOD(i, 1); return conv; } diff --git a/Marlin/src/core/utility.h b/Marlin/src/core/utility.h index 48f775b529..c04524f672 100644 --- a/Marlin/src/core/utility.h +++ b/Marlin/src/core/utility.h @@ -106,8 +106,8 @@ inline void serial_delay(const millis_t ms) { // Convert signed float to string with +123.45 format char* ftostr52sign(const float &x); - // Convert unsigned float to string with 1234.56 format omitting trailing zeros - char* ftostr62rj(const float &x); + // Convert unsigned float to string with 1234.5 format omitting trailing zeros + char* ftostr51rj(const float &x); // Convert float to rj string with 123 or -12 format FORCE_INLINE char* ftostr3(const float &x) { return i16tostr3(int16_t(x + (x < 0 ? -0.5f : 0.5f))); } diff --git a/Marlin/src/feature/babystep.cpp b/Marlin/src/feature/babystep.cpp index efce79a092..0f0b64295d 100644 --- a/Marlin/src/feature/babystep.cpp +++ b/Marlin/src/feature/babystep.cpp @@ -64,7 +64,7 @@ void Babystep::add_mm(const AxisEnum axis, const float &mm) { add_steps(axis, mm * planner.settings.axis_steps_per_mm[axis]); } -void Babystep::add_steps(const AxisEnum axis, const int32_t distance) { +void Babystep::add_steps(const AxisEnum axis, const int16_t distance) { #if ENABLED(BABYSTEP_WITHOUT_HOMING) #define CAN_BABYSTEP(AXIS) true diff --git a/Marlin/src/feature/babystep.h b/Marlin/src/feature/babystep.h index 3f22fac11f..d7ac71ba44 100644 --- a/Marlin/src/feature/babystep.h +++ b/Marlin/src/feature/babystep.h @@ -53,7 +53,7 @@ public: } #endif #endif - static void add_steps(const AxisEnum axis, const int32_t distance); + static void add_steps(const AxisEnum axis, const int16_t distance); static void add_mm(const AxisEnum axis, const float &mm); static void task(); private: diff --git a/Marlin/src/feature/bedlevel/abl/abl.cpp b/Marlin/src/feature/bedlevel/abl/abl.cpp index ce2799cd38..b6011332bf 100644 --- a/Marlin/src/feature/bedlevel/abl/abl.cpp +++ b/Marlin/src/feature/bedlevel/abl/abl.cpp @@ -32,6 +32,10 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../../core/debug_out.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" +#endif + int bilinear_grid_spacing[2], bilinear_start[2]; float bilinear_grid_factor[2], z_values[GRID_MAX_POINTS_X][GRID_MAX_POINTS_Y]; diff --git a/Marlin/src/feature/bedlevel/bedlevel.cpp b/Marlin/src/feature/bedlevel/bedlevel.cpp index 55267b44e0..3cac3d5b46 100644 --- a/Marlin/src/feature/bedlevel/bedlevel.cpp +++ b/Marlin/src/feature/bedlevel/bedlevel.cpp @@ -42,6 +42,10 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../core/debug_out.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + bool leveling_is_valid() { return #if ENABLED(MESH_BED_LEVELING) diff --git a/Marlin/src/feature/fwretract.cpp b/Marlin/src/feature/fwretract.cpp index f5f7cefc45..a194749913 100644 --- a/Marlin/src/feature/fwretract.cpp +++ b/Marlin/src/feature/fwretract.cpp @@ -103,7 +103,7 @@ void FWRetract::retract(const bool retracting // Prevent two swap-retract or recovers in a row #if EXTRUDERS > 1 - // Allow G10 S1 only after G10 + // Allow G10 S1 only after G11 if (swapping && retracted_swap[active_extruder] == retracting) return; // G11 priority to recover the long retract if activated if (!retracting) swapping = retracted_swap[active_extruder]; @@ -114,8 +114,8 @@ void FWRetract::retract(const bool retracting /* // debugging SERIAL_ECHOLNPAIR( "retracting ", retracting, - "swapping ", swapping - "active extruder ", active_extruder + " swapping ", swapping, + " active extruder ", active_extruder ); for (uint8_t i = 0; i < EXTRUDERS; ++i) { SERIAL_ECHOLNPAIR("retracted[", i, "] ", retracted[i]); diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index bad7bb75cf..f15462195e 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/host_actions.h b/Marlin/src/feature/host_actions.h index 4aee3ef1f5..e6f77cb63c 100644 --- a/Marlin/src/feature/host_actions.h +++ b/Marlin/src/feature/host_actions.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 75705e1593..99dbb380e5 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -656,7 +656,9 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le // Resume the print job timer if it was running if (print_job_timer.isPaused()) print_job_timer.start(); - ui.reset_status(); + #if HAS_LCD_MENU + ui.return_to_status(); + #endif } #endif // ADVANCED_PAUSE_FEATURE diff --git a/Marlin/src/feature/power_loss_recovery.cpp b/Marlin/src/feature/power_loss_recovery.cpp index 17ba4a101b..0b9dba43fd 100644 --- a/Marlin/src/feature/power_loss_recovery.cpp +++ b/Marlin/src/feature/power_loss_recovery.cpp @@ -151,6 +151,12 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= // Machine state COPY(info.current_position, current_position); + #if HAS_HOME_OFFSET + COPY(info.home_offset, home_offset); + #endif + #if HAS_POSITION_SHIFT + COPY(info.position_shift, position_shift); + #endif info.feedrate = uint16_t(feedrate_mm_s * 60.0f); #if HOTENDS > 1 @@ -187,7 +193,7 @@ void PrintJobRecovery::save(const bool force/*=false*/, const bool save_queue/*= info.retract_hop = fwretract.current_hop; #endif - //relative mode + // Relative mode info.relative_mode = relative_mode; info.relative_modes_e = gcode.axis_relative_modes[E_AXIS]; @@ -239,20 +245,30 @@ void PrintJobRecovery::resume() { gcode.process_subcommands_now_P(PSTR("M420 S0 Z0")); #endif - // Set Z to 0, raise Z by 2mm, and Home (XY only for Cartesian) with no raise - // (Only do simulated homing in Marlin Dev Mode.) - gcode.process_subcommands_now_P(PSTR("G92.0 Z0\nG1 Z" STRINGIFY(RECOVERY_ZRAISE) "\nG28 R0" - #if ENABLED(MARLIN_DEV_MODE) - " S" - #elif !IS_KINEMATIC - " X Y" + // Reset E, raise Z, home XY... + gcode.process_subcommands_now_P(PSTR("G92.9 E0" + #if Z_HOME_DIR > 0 + // If Z homing goes to max, reset E and home all + "\nG28R0" + #if ENABLED(MARLIN_DEV_MODE) + "S" + #endif + #else + // Set Z to 0, raise Z by RECOVERY_ZRAISE, and Home (XY only for Cartesian) + // with no raise. (Only do simulated homing in Marlin Dev Mode.) + "Z0\nG1Z" STRINGIFY(RECOVERY_ZRAISE) "\nG28R0" + #if ENABLED(MARLIN_DEV_MODE) + "S" + #elif !IS_KINEMATIC + "XY" + #endif #endif )); // Pretend that all axes are homed axis_homed = axis_known_position = xyz_bits; - char cmd[40], str_1[16], str_2[16]; + char cmd[50], str_1[16], str_2[16]; // Select the previously active tool (with no_move) #if EXTRUDERS > 1 @@ -315,16 +331,16 @@ void PrintJobRecovery::resume() { memcpy(&mixer.gradient, &info.gradient, sizeof(info.gradient)); #endif - // Restore Z (plus raise) and E positions with G92.0 - dtostrf(info.current_position[Z_AXIS] + RECOVERY_ZRAISE, 1, 3, str_1); - dtostrf(info.current_position[E_AXIS] - #if ENABLED(SAVE_EACH_CMD_MODE) - - 5 // Extra extrusion on restart - #endif - , 1, 3, str_2 - ); - sprintf_P(cmd, PSTR("G92.0 Z%s E%s"), str_1, str_2); - gcode.process_subcommands_now(cmd); + // Extrude and retract to clean the nozzle + #if POWER_LOSS_PURGE_LEN + //sprintf_P(cmd, PSTR("G1 E%d F200"), POWER_LOSS_PURGE_LEN); + //gcode.process_subcommands_now(cmd); + gcode.process_subcommands_now_P(PSTR("G1 E" STRINGIFY(POWER_LOSS_PURGE_LEN) " F200")); + #endif + #if POWER_LOSS_RETRACT_LEN + sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN - POWER_LOSS_RETRACT_LEN); + gcode.process_subcommands_now(cmd); + #endif // Move back to the saved XY dtostrf(info.current_position[X_AXIS], 1, 3, str_1); @@ -337,13 +353,37 @@ void PrintJobRecovery::resume() { sprintf_P(cmd, PSTR("G1 Z%s F200"), str_1); gcode.process_subcommands_now(cmd); + // Un-retract + #if POWER_LOSS_PURGE_LEN + //sprintf_P(cmd, PSTR("G1 E%d F3000"), POWER_LOSS_PURGE_LEN); + //gcode.process_subcommands_now(cmd); + gcode.process_subcommands_now_P(PSTR("G1 E" STRINGIFY(POWER_LOSS_PURGE_LEN) " F3000")); + #endif + // Restore the feedrate sprintf_P(cmd, PSTR("G1 F%d"), info.feedrate); gcode.process_subcommands_now(cmd); - //relative mode - if (info.relative_mode) relative_mode = true; - if (info.relative_modes_e) gcode.axis_relative_modes[E_AXIS] = true; + // Restore E position with G92.9 + dtostrf(info.current_position[E_AXIS], 1, 3, str_1); + sprintf_P(cmd, PSTR("G92.9 E%s"), str_1); + gcode.process_subcommands_now(cmd); + + // Relative mode + relative_mode = info.relative_mode; + gcode.axis_relative_modes[E_AXIS] = info.relative_modes_e; + + #if HAS_HOME_OFFSET || HAS_POSITION_SHIFT + LOOP_XYZ(i) { + #if HAS_HOME_OFFSET + home_offset[i] = info.home_offset[i]; + #endif + #if HAS_POSITION_SHIFT + position_shift[i] = info.position_shift[i]; + #endif + update_workspace_offset((AxisEnum)i); + } + #endif // Process commands from the old pending queue uint8_t c = info.commands_in_queue, r = info.cmd_queue_index_r; @@ -372,6 +412,25 @@ void PrintJobRecovery::resume() { DEBUG_ECHO(info.current_position[i]); } DEBUG_EOL(); + + #if HAS_HOME_OFFSET + DEBUG_ECHOPGM("home_offset: "); + LOOP_XYZ(i) { + if (i) DEBUG_CHAR(','); + DEBUG_ECHO(info.home_offset[i]); + } + DEBUG_EOL(); + #endif + + #if HAS_POSITION_SHIFT + DEBUG_ECHOPGM("position_shift: "); + LOOP_XYZ(i) { + if (i) DEBUG_CHAR(','); + DEBUG_ECHO(info.position_shift[i]); + } + DEBUG_EOL(); + #endif + DEBUG_ECHOLNPAIR("feedrate: ", info.feedrate); #if HOTENDS > 1 diff --git a/Marlin/src/feature/power_loss_recovery.h b/Marlin/src/feature/power_loss_recovery.h index 45b057e752..68554dc602 100644 --- a/Marlin/src/feature/power_loss_recovery.h +++ b/Marlin/src/feature/power_loss_recovery.h @@ -35,6 +35,8 @@ #define SAVE_INFO_INTERVAL_MS 0 //#define SAVE_EACH_CMD_MODE //#define DEBUG_POWER_LOSS_RECOVERY +#define POWER_LOSS_PURGE_LEN 20 +#define POWER_LOSS_RETRACT_LEN 10 typedef struct { uint8_t valid_head; @@ -42,6 +44,13 @@ typedef struct { // Machine state float current_position[NUM_AXIS]; + #if HAS_HOME_OFFSET + float home_offset[XYZ]; + #endif + #if HAS_POSITION_SHIFT + float position_shift[XYZ]; + #endif + uint16_t feedrate; #if HOTENDS > 1 diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index f87c60fecb..3ce43b2fef 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -32,6 +32,10 @@ #include "../../module/configuration_store.h" #endif +#if ENABLED(EXTENSIBLE_UI) + #include "../../lcd/extensible_ui/ui_api.h" +#endif + //#define M420_C_USE_MEAN /** @@ -175,14 +179,15 @@ void GcodeSuite::M420() { set_bed_leveling_enabled(false); // Subtract the mean from all values for (uint8_t x = GRID_MAX_POINTS_X; x--;) - for (uint8_t y = GRID_MAX_POINTS_Y; y--;) + for (uint8_t y = GRID_MAX_POINTS_Y; y--;) { Z_VALUES(x, y) -= zmean; + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)); + #endif + } #if ENABLED(ABL_BILINEAR_SUBDIVISION) bed_level_virt_interpolate(); #endif - #if ENABLED(EXTENSIBLE_UI) - ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)); - #endif } #endif diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 675cd2b88e..22cc0c1754 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -51,6 +51,10 @@ #define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE) #include "../../../core/debug_out.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" +#endif + #if ABL_GRID #if ENABLED(PROBE_Y_FIRST) #define PR_OUTER_VAR xCount diff --git a/Marlin/src/gcode/bedlevel/abl/M421.cpp b/Marlin/src/gcode/bedlevel/abl/M421.cpp index cba905b4fb..295911330c 100644 --- a/Marlin/src/gcode/bedlevel/abl/M421.cpp +++ b/Marlin/src/gcode/bedlevel/abl/M421.cpp @@ -31,6 +31,10 @@ #include "../../gcode.h" #include "../../../feature/bedlevel/abl/abl.h" +#if ENABLED(EXTENSIBLE_UI) + #include "../../../lcd/extensible_ui/ui_api.h" +#endif + /** * M421: Set a single Mesh Bed Leveling Z coordinate * diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index 9a26400a97..36550a7bd7 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -126,6 +126,12 @@ void GcodeSuite::G34() { extruder_duplication_enabled = false; #endif + // Before moving other axes raise Z, if needed. Never lower Z. + if (current_position[Z_AXIS] < Z_CLEARANCE_BETWEEN_PROBES) { + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Raise Z (before moving to probe pos) to ", Z_CLEARANCE_BETWEEN_PROBES); + do_blocking_move_to_z(Z_CLEARANCE_BETWEEN_PROBES); + } + // Remember corrections to determine errors on each iteration float last_z_align_move[Z_STEPPER_COUNT] = ARRAY_N(Z_STEPPER_COUNT, 10000.0f, 10000.0f, 10000.0f), z_measured[Z_STEPPER_COUNT] = { 0 }; diff --git a/Marlin/src/gcode/control/M3-M5.cpp b/Marlin/src/gcode/control/M3-M5.cpp index 8612e0c03f..132f7bb399 100644 --- a/Marlin/src/gcode/control/M3-M5.cpp +++ b/Marlin/src/gcode/control/M3-M5.cpp @@ -74,7 +74,9 @@ inline void delay_for_power_down() { safe_delay(SPINDLE_LASER_POWERDOWN_DELAY); inline void set_spindle_laser_ocr(const uint8_t ocr) { WRITE(SPINDLE_LASER_ENA_PIN, SPINDLE_LASER_ENABLE_INVERT); // turn spindle on (active low) - analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr); + #if ENABLED(SPINDLE_LASER_PWM) + analogWrite(SPINDLE_LASER_PWM_PIN, (SPINDLE_LASER_PWM_INVERT) ? 255 - ocr : ocr); + #endif } #if ENABLED(SPINDLE_LASER_PWM) diff --git a/Marlin/src/gcode/eeprom/M500-M504.cpp b/Marlin/src/gcode/eeprom/M500-M504.cpp index 12e323bd7b..e21e125066 100644 --- a/Marlin/src/gcode/eeprom/M500-M504.cpp +++ b/Marlin/src/gcode/eeprom/M500-M504.cpp @@ -25,18 +25,11 @@ #include "../../core/serial.h" #include "../../inc/MarlinConfig.h" -#if ENABLED(EXTENSIBLE_UI) - #include "../../lcd/extensible_ui/ui_api.h" -#endif - /** * M500: Store settings in EEPROM */ void GcodeSuite::M500() { (void)settings.save(); - #if ENABLED(EXTENSIBLE_UI) - ExtUI::onStoreSettings(); - #endif } /** @@ -44,9 +37,6 @@ void GcodeSuite::M500() { */ void GcodeSuite::M501() { (void)settings.load(); - #if ENABLED(EXTENSIBLE_UI) - ExtUI::onLoadSettings(); - #endif } /** @@ -54,9 +44,6 @@ void GcodeSuite::M501() { */ void GcodeSuite::M502() { (void)settings.reset(); - #if ENABLED(EXTENSIBLE_UI) - ExtUI::onFactoryReset(); - #endif } #if DISABLED(DISABLE_M503) diff --git a/Marlin/src/gcode/feature/trinamic/M906.cpp b/Marlin/src/gcode/feature/trinamic/M906.cpp index 51a3cefde2..0466bfff4e 100644 --- a/Marlin/src/gcode/feature/trinamic/M906.cpp +++ b/Marlin/src/gcode/feature/trinamic/M906.cpp @@ -29,8 +29,18 @@ #include "../../../module/stepper_indirection.h" /** - * M906: Set motor current in milliamps using axis codes X, Y, Z, E - * Report driver currents when no axis specified + * M906: Set motor current in milliamps. + * + * Parameters: + * X[current] - Set mA current for X driver(s) + * Y[current] - Set mA current for Y driver(s) + * Z[current] - Set mA current for Z driver(s) + * E[current] - Set mA current for E driver(s) + * + * I[index] - Axis sub-index (Omit or 0 for X, Y, Z; 1 for X2, Y2, Z2; 2 for Z3.) + * T[index] - Extruder index (Zero-based. Omit for E0 only.) + * + * With no parameters report driver currents. */ void GcodeSuite::M906() { #define TMC_SAY_CURRENT(Q) tmc_get_current(stepper##Q) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 546898433a..5b179dcaf0 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -278,7 +278,7 @@ void GcodeSuite::process_parsed_command( case 58: G58(); break; case 59: G59(); break; #endif - + #if ENABLED(GCODE_MOTION_MODES) case 80: G80(); break; // G80: Reset the current motion mode #endif diff --git a/Marlin/src/gcode/geometry/G92.cpp b/Marlin/src/gcode/geometry/G92.cpp index b01daf348d..01d42f7c23 100644 --- a/Marlin/src/gcode/geometry/G92.cpp +++ b/Marlin/src/gcode/geometry/G92.cpp @@ -33,9 +33,23 @@ */ void GcodeSuite::G92() { - #if ENABLED(CNC_COORDINATE_SYSTEMS) - switch (parser.subcode) { - case 1: + bool didE = false; + #if IS_SCARA || !HAS_POSITION_SHIFT + bool didXYZ = false; + #else + constexpr bool didXYZ = false; + #endif + + #if USE_GCODE_SUBCODES + const uint8_t subcode_G92 = parser.subcode; + #else + constexpr uint8_t subcode_G92 = 0; + #endif + + switch (subcode_G92) { + default: break; + #if ENABLED(CNC_COORDINATE_SYSTEMS) + case 1: { // Zero the G92 values and restore current position #if !IS_SCARA LOOP_XYZ(i) { @@ -46,44 +60,46 @@ void GcodeSuite::G92() { } } #endif // Not SCARA - return; - } - #endif - - #if ENABLED(CNC_COORDINATE_SYSTEMS) - #define IS_G92_0 (parser.subcode == 0) - #else - #define IS_G92_0 true - #endif - - bool didE = false; - #if IS_SCARA || !HAS_POSITION_SHIFT - bool didXYZ = false; - #else - constexpr bool didXYZ = false; - #endif - - if (IS_G92_0) LOOP_XYZE(i) { - if (parser.seenval(axis_codes[i])) { - const float l = parser.value_axis_units((AxisEnum)i), - v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i), - d = v - current_position[i]; - if (!NEAR_ZERO(d)) { - #if IS_SCARA || !HAS_POSITION_SHIFT - if (i == E_AXIS) didE = true; else didXYZ = true; - current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior - #elif HAS_POSITION_SHIFT - if (i == E_AXIS) { - didE = true; - current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly + } return; + #endif + #if ENABLED(POWER_LOSS_RECOVERY) + case 9: { + LOOP_XYZE(i) { + if (parser.seenval(axis_codes[i])) { + current_position[i] = parser.value_axis_units((AxisEnum)i); + #if IS_SCARA || !HAS_POSITION_SHIFT + if (i == E_AXIS) didE = true; else didXYZ = true; + #elif HAS_POSITION_SHIFT + if (i == E_AXIS) didE = true; + #endif } - else { - position_shift[i] += d; // Other axes simply offset the coordinate space - update_workspace_offset((AxisEnum)i); + } + } break; + #endif + case 0: { + LOOP_XYZE(i) { + if (parser.seenval(axis_codes[i])) { + const float l = parser.value_axis_units((AxisEnum)i), + v = i == E_AXIS ? l : LOGICAL_TO_NATIVE(l, i), + d = v - current_position[i]; + if (!NEAR_ZERO(d)) { + #if IS_SCARA || !HAS_POSITION_SHIFT + if (i == E_AXIS) didE = true; else didXYZ = true; + current_position[i] = v; // Without workspaces revert to Marlin 1.0 behavior + #elif HAS_POSITION_SHIFT + if (i == E_AXIS) { + didE = true; + current_position[E_AXIS] = v; // When using coordinate spaces, only E is set directly + } + else { + position_shift[i] += d; // Other axes simply offset the coordinate space + update_workspace_offset((AxisEnum)i); + } + #endif } - #endif + } } - } + } break; } #if ENABLED(CNC_COORDINATE_SYSTEMS) diff --git a/Marlin/src/gcode/host/M876.cpp b/Marlin/src/gcode/host/M876.cpp index f0850ce454..7f7d4c8c40 100644 --- a/Marlin/src/gcode/host/M876.cpp +++ b/Marlin/src/gcode/host/M876.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index f448efb117..817d6bca18 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -526,8 +526,9 @@ void gcode_line_error(PGM_P const err, const int8_t port) { #endif // BINARY_FILE_TRANSFER -FORCE_INLINE bool is_M29(const char * const cmd) { - return cmd[0] == 'M' && cmd[1] == '2' && cmd[2] == '9' && !WITHIN(cmd[3], '0', '9'); +FORCE_INLINE bool is_M29(const char * const cmd) { // matches "M29" & "M29 ", but not "M290", etc + const char * const m29 = strstr_P(cmd, PSTR("M29")); + return m29 && !NUMERIC(m29[3]); } /** diff --git a/Marlin/src/gcode/sdcard/M23.cpp b/Marlin/src/gcode/sdcard/M23.cpp index 92899a217a..7cdc976690 100644 --- a/Marlin/src/gcode/sdcard/M23.cpp +++ b/Marlin/src/gcode/sdcard/M23.cpp @@ -31,9 +31,6 @@ * M23: Open a file */ void GcodeSuite::M23() { - #if ENABLED(POWER_LOSS_RECOVERY) - card.removeJobRecoveryFile(); - #endif // Simplify3D includes the size, so zero out all spaces (#7227) for (char *fn = parser.string_arg; *fn; ++fn) if (*fn == ' ') *fn = '\0'; card.openFile(parser.string_arg, true); diff --git a/Marlin/src/gcode/temperature/M141_M191.cpp b/Marlin/src/gcode/temperature/M141_M191.cpp index 3aeba2bb0a..d65dc7c62f 100644 --- a/Marlin/src/gcode/temperature/M141_M191.cpp +++ b/Marlin/src/gcode/temperature/M141_M191.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 8581f2dd19..81c0678e3f 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -138,11 +138,15 @@ #elif ENABLED(MKS_MINI_12864) #define MINIPANEL + #define DEFAULT_LCD_CONTRAST 150 + #define LCD_CONTRAST_MAX 255 #elif ENABLED(FYSETC_MINI_12864) #define DOGLCD #define ULTIPANEL + #define LCD_CONTRAST_MIN 0 + #define LCD_CONTRAST_MAX 255 #define DEFAULT_LCD_CONTRAST 255 #define LED_COLORS_REDUCE_GREEN @@ -151,7 +155,9 @@ #if EITHER(MAKRPANEL, MINIPANEL) #define DOGLCD #define ULTIPANEL - #define DEFAULT_LCD_CONTRAST 17 + #ifndef DEFAULT_LCD_CONTRAST + #define DEFAULT_LCD_CONTRAST 17 + #endif #endif #if ENABLED(ULTI_CONTROLLER) @@ -323,7 +329,7 @@ /** * Default LCD contrast for Graphical LCD displays */ -#define HAS_LCD_CONTRAST HAS_GRAPHICAL_LCD && defined(DEFAULT_LCD_CONTRAST) +#define HAS_LCD_CONTRAST (HAS_GRAPHICAL_LCD && defined(DEFAULT_LCD_CONTRAST)) #if HAS_LCD_CONTRAST #ifndef LCD_CONTRAST_MIN #define LCD_CONTRAST_MIN 0 @@ -560,3 +566,5 @@ #if ENABLED(SLIM_LCD_MENUS) #define BOOT_MARLIN_LOGO_SMALL #endif + +#define IS_RE_ARM_BOARD (MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_14_RE_ARM_EEB) || MB(RAMPS_14_RE_ARM_EFF) || MB(RAMPS_14_RE_ARM_EEF) || MB(RAMPS_14_RE_ARM_SF)) diff --git a/Marlin/src/inc/Conditionals_post.h b/Marlin/src/inc/Conditionals_post.h index b1e53c608a..a4789f7d97 100644 --- a/Marlin/src/inc/Conditionals_post.h +++ b/Marlin/src/inc/Conditionals_post.h @@ -918,7 +918,7 @@ #define HAS_TEMP_HOTEND (HAS_TEMP_ADC_0 || ENABLED(HEATER_0_USES_MAX6675)) #define HAS_TEMP_BED HAS_TEMP_ADC_BED #define HAS_TEMP_CHAMBER HAS_TEMP_ADC_CHAMBER -#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(CHAMBER_HEATER)) +#define HAS_HEATED_CHAMBER (HAS_TEMP_CHAMBER && PIN_EXISTS(HEATER_CHAMBER)) // Heaters #define HAS_HEATER_0 (PIN_EXISTS(HEATER_0)) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index a927900557..d76c28bbf2 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -343,6 +343,8 @@ #error "MAX6675_SS2 is now MAX6675_SS2_PIN. Please update your configuration and/or pins." #elif defined(SPINDLE_LASER_ENABLE_PIN) #error "SPINDLE_LASER_ENABLE_PIN is now SPINDLE_LASER_ENA_PIN. Please update your configuration and/or pins." +#elif defined(CHAMBER_HEATER_PIN) + #error "CHAMBER_HEATER_PIN is now HEATER_CHAMBER_PIN. Please update your configuration and/or pins." #elif defined(TMC_Z_CALIBRATION) #error "TMC_Z_CALIBRATION has been deprecated in favor of Z_STEPPER_AUTO_ALIGN. Please update your configuration." #elif defined(Z_MIN_PROBE_ENDSTOP) diff --git a/Marlin/src/inc/Version.h b/Marlin/src/inc/Version.h index d724e1da28..9ff254ac47 100644 --- a/Marlin/src/inc/Version.h +++ b/Marlin/src/inc/Version.h @@ -39,7 +39,7 @@ /** * Marlin release version identifier */ - #define SHORT_BUILD_VERSION "2.0.x_TR12" + #define SHORT_BUILD_VERSION "2.0.x_TR13" /** * Verbose version identifier which should contain a reference to the location @@ -52,7 +52,7 @@ * here we define this default string as the date where the latest release * version was tagged. */ - #define STRING_DISTRIBUTION_DATE "2019-04-04" + #define STRING_DISTRIBUTION_DATE "2019-04-28" /** * Required minimum Configuration.h and Configuration_adv.h file versions. diff --git a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp index c493b371c2..57a6e96904 100644 --- a/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp +++ b/Marlin/src/lcd/HD44780/ultralcd_HD44780.cpp @@ -517,7 +517,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const else { #if DISABLED(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) if (!TEST(axis_known_position, axis)) - lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); + lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); else #endif lcd_put_u8str(value); @@ -1038,9 +1038,7 @@ void MarlinUI::draw_status_screen() { } void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) { - SETCURSOR(0, 0); lcd_put_u8str_P(pref); - if (string) wrap_string(1, string); - if (suff) lcd_put_u8str_P(suff); + ui.draw_select_screen_prompt(pref, string, suff); SETCURSOR(0, LCD_HEIGHT - 1); lcd_put_wchar(yesno ? ' ' : '['); lcd_put_u8str_P(no); lcd_put_wchar(yesno ? ' ' : ']'); SETCURSOR_RJ(utf8_strlen_P(yes) + 2, LCD_HEIGHT - 1); diff --git a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h index 7141eeb180..d25b58d9a4 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_class_defines.h @@ -94,3 +94,16 @@ public: : U8GLIB(&u8g_dev_tft_320x240_upscale_from_128x64, cs, rs, reset) { } }; + + +extern u8g_dev_t u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, u8g_dev_uc1701_mini12864_HAL_2x_hw_spi; + +class U8GLIB_MINI12864_2X_HAL : public U8GLIB { +public: + U8GLIB_MINI12864_2X_HAL(uint8_t sck, uint8_t mosi, uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_uc1701_mini12864_HAL_2x_sw_spi, sck, mosi, cs, a0, reset) + { } + U8GLIB_MINI12864_2X_HAL(uint8_t cs, uint8_t a0, uint8_t reset = U8G_PIN_NONE) + : U8GLIB(&u8g_dev_uc1701_mini12864_HAL_2x_hw_spi, cs, a0, reset) + { } +}; diff --git a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h index 0785cb79a6..79f7f2f358 100644 --- a/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h +++ b/Marlin/src/lcd/dogm/HAL_LCD_com_defines.h @@ -47,7 +47,7 @@ uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn - #if defined(ARDUINO_ARCH_STM32F1) + #ifdef ARDUINO_ARCH_STM32F1 uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr); #define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn #else diff --git a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp index e101a56829..a917bc2e84 100644 --- a/Marlin/src/lcd/dogm/status_screen_DOGM.cpp +++ b/Marlin/src/lcd/dogm/status_screen_DOGM.cpp @@ -245,7 +245,7 @@ FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const else { #if DISABLED(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING) if (!TEST(axis_known_position, axis)) - lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); + lcd_put_u8str_P(axis == Z_AXIS ? PSTR(" ") : PSTR(" ")); else #endif lcd_put_u8str(value); diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp index a72b3e4fc8..8b12a83570 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.cpp @@ -158,9 +158,7 @@ void ST7920_Lite_Status_Screen::entry_mode_select(const bool ac_increase, const // function for scroll_or_addr_select() void ST7920_Lite_Status_Screen::_scroll_or_addr_select(const bool sa) { extended_function_set(true); - cmd(0b00100010 | - (sa ? 0b000001 : 0) - ); + cmd(0b00000010 | (sa ? 0b00000001 : 0)); current_bits.sa = sa; } @@ -907,34 +905,6 @@ void ST7920_Lite_Status_Screen::clear_text_buffer() { ncs(); } -#if ENABLED(U8GLIB_ST7920) && !defined(U8G_HAL_LINKS) && !defined(__SAM3X8E__) - - #include "ultralcd_st7920_u8glib_rrd_AVR.h" - - void ST7920_Lite_Status_Screen::cs() { - ST7920_CS(); - current_bits.synced = false; - } - - void ST7920_Lite_Status_Screen::ncs() { - ST7920_NCS(); - current_bits.synced = false; - } - - void ST7920_Lite_Status_Screen::sync_cmd() { - ST7920_SET_CMD(); - } - - void ST7920_Lite_Status_Screen::sync_dat() { - ST7920_SET_DAT(); - } - - void ST7920_Lite_Status_Screen::write_byte(const uint8_t data) { - ST7920_WRITE_BYTE(data); - } - -#endif - void MarlinUI::draw_status_screen() { ST7920_Lite_Status_Screen::update(false); } diff --git a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h index 8a19030d6b..1fb707ca1d 100644 --- a/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h +++ b/Marlin/src/lcd/dogm/status_screen_lite_ST7920.h @@ -15,6 +15,8 @@ */ #pragma once +#include "../../HAL/shared/HAL_ST7920.h" + #include "../../core/macros.h" #include "../../libs/duration_t.h" @@ -28,11 +30,11 @@ class ST7920_Lite_Status_Screen { uint8_t sa : 1; } current_bits; - static void cs(); - static void ncs(); - static void sync_cmd(); - static void sync_dat(); - static void write_byte(const uint8_t w); + static void cs() { ST7920_cs(); current_bits.synced = false; } + static void ncs() { ST7920_cs(); current_bits.synced = false; } + static void sync_cmd() { ST7920_set_cmd(); } + static void sync_dat() { ST7920_set_dat(); } + static void write_byte(const uint8_t w) { ST7920_write_byte(w); } FORCE_INLINE static void write_word(const uint16_t w) { write_byte((w >> 8) & 0xFF); diff --git a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp index 35f7d4161a..4dd8759e7a 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_uc1701_mini12864_HAL.cpp @@ -66,42 +66,47 @@ #define PAGE_HEIGHT 8 static const uint8_t u8g_dev_uc1701_mini12864_HAL_init_seq[] PROGMEM = { - U8G_ESC_CS(0), /* disable chip */ - U8G_ESC_ADR(0), /* instruction mode */ - U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */ - U8G_ESC_CS(1), /* enable chip */ + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_ADR(0), /* instruction mode */ + U8G_ESC_RST(1), /* do reset low pulse with (1*16)+2 milliseconds */ + U8G_ESC_CS(1), /* enable chip */ - 0x0E2, /* soft reset */ - 0x040, /* set display start line to 0 */ - 0x0A0, /* ADC set to reverse */ - 0x0C8, /* common output mode */ - 0x0A6, /* display normal, bit val 0: LCD pixel off. */ - 0x0A2, /* LCD bias 1/9 */ - 0x02F, /* all power control circuits on */ - 0x0F8, /* set booster ratio to */ - 0x000, /* 4x */ - 0x023, /* set V0 voltage resistor ratio to large */ - 0x081, /* set contrast */ - 0x027, /* contrast value */ - 0x0AC, /* indicator */ - 0x000, /* disable */ - 0x0AF, /* display on */ + 0x0E2, /* soft reset */ + 0x040, /* set display start line to 0 */ + 0x0A0, /* ADC set to reverse */ + 0x0C8, /* common output mode */ + 0x0A6, /* display normal, bit val 0: LCD pixel off. */ + 0x0A2, /* LCD bias 1/9 */ + 0x02F, /* all power control circuits on */ + 0x0F8, /* set booster ratio to */ + 0x000, /* 4x */ + 0x023, /* set V0 voltage resistor ratio to large */ + 0x081, /* set contrast */ + 0x027, /* contrast value */ + 0x0AC, /* indicator */ + 0x000, /* disable */ + 0x0AF, /* display on */ - U8G_ESC_DLY(100), /* delay 100 ms */ - 0x0A5, /* display all points, ST7565 */ - U8G_ESC_DLY(100), /* delay 100 ms */ - U8G_ESC_DLY(100), /* delay 100 ms */ - 0x0A4, /* normal display */ - U8G_ESC_CS(0), /* disable chip */ - U8G_ESC_END /* end of sequence */ + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_DLY(100), /* delay 100 ms */ + U8G_ESC_CS(1), /* enable chip */ + + 0x0A5, /* display all points, ST7565 */ + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_DLY(100), /* delay 100 ms */ + U8G_ESC_DLY(100), /* delay 100 ms */ + U8G_ESC_CS(1), /* enable chip */ + 0x0A4, /* normal display */ + U8G_ESC_CS(0), /* disable chip */ + U8G_ESC_END /* end of sequence */ }; static const uint8_t u8g_dev_uc1701_mini12864_HAL_data_start[] PROGMEM = { - U8G_ESC_ADR(0), /* instruction mode */ - U8G_ESC_CS(1), /* enable chip */ - 0x010, /* set upper 4 bit of the col adr to 0 */ - 0x000, /* set lower 4 bit of the col adr to 4 */ - U8G_ESC_END /* end of sequence */ + U8G_ESC_ADR(0), /* instruction mode */ + U8G_ESC_CS(1), /* enable chip */ + 0x010, /* set upper 4 bit of the col adr to 0 */ + 0x000, /* set lower 4 bit of the col adr to 4 */ + U8G_ESC_END /* end of sequence */ }; uint8_t u8g_dev_uc1701_mini12864_HAL_fn(u8g_t *u8g, u8g_dev_t *dev, uint8_t msg, void *arg) { diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp index defbfc3bfa..4a33045592 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.cpp @@ -175,14 +175,14 @@ void MarlinUI::set_font(const MarlinFont font_nr) { // Can the text fit to the right of the bitmap? if (text_max_width < rspace) { - constexpr uint8_t inter = (width - text_max_width - (START_BMPWIDTH)) / 3; // Evenly distribute horizontal space + constexpr int8_t inter = (width - text_max_width - (START_BMPWIDTH)) / 3; // Evenly distribute horizontal space offx = inter; // First the boot logo... offy = (height - (START_BMPHEIGHT)) / 2; // ...V-aligned in the full height txt_offx_1 = txt_offx_2 = inter + (START_BMPWIDTH) + inter; // Text right of the bitmap txt_base = (height + MENU_FONT_ASCENT + text_total_height - (MENU_FONT_HEIGHT)) / 2; // Text vertical center } else { - constexpr uint8_t inter = (height - text_total_height - (START_BMPHEIGHT)) / 3; // Evenly distribute vertical space + constexpr int8_t inter = (height - text_total_height - (START_BMPHEIGHT)) / 3; // Evenly distribute vertical space offy = inter; // V-align boot logo proportionally offx = rspace / 2; // Center the boot logo in the whole space txt_offx_1 = (width - text_width_1) / 2; // Text 1 centered @@ -439,9 +439,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop } void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff) { - SETCURSOR(0, 0); lcd_put_u8str_P(pref); - if (string) wrap_string(1, string); - if (suff) lcd_put_u8str_P(suff); + ui.draw_select_screen_prompt(pref, string, suff); draw_boxed_string(1, LCD_HEIGHT - 1, no, !yesno); draw_boxed_string(LCD_WIDTH - (utf8_strlen_P(yes) + 1), LCD_HEIGHT - 1, yes, yesno); } @@ -554,22 +552,22 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop #if EITHER(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY) const unsigned char cw_bmp[] PROGMEM = { - B00000011,B11111000,B00000000, - B00001111,B11111110,B00000000, - B00011110,B00001111,B00000000, - B00111000,B00000111,B00000000, - B00111000,B00000011,B10000000, - B01110000,B00000011,B10000000, - B01110000,B00001111,B11100000, - B01110000,B00000111,B11000000, - B01110000,B00000011,B10000000, - B01110000,B00000001,B00000000, - B01110000,B00000000,B00000000, - B00111000,B00000000,B00000000, - B00111000,B00000111,B00000000, - B00011110,B00001111,B00000000, - B00001111,B11111110,B00000000, - B00000011,B11111000,B00000000 + B00000001,B11111100,B00000000, + B00000111,B11111111,B00000000, + B00001111,B00000111,B10000000, + B00001110,B00000001,B11000000, + B00000000,B00000001,B11000000, + B00000000,B00000000,B11100000, + B00001000,B00000000,B11100000, + B00011100,B00000000,B11100000, + B00111110,B00000000,B11100000, + B01111111,B00000000,B11100000, + B00011100,B00000000,B11100000, + B00001110,B00000000,B11100000, + B00001110,B00000001,B11000000, + B00000111,B10000011,B11000000, + B00000011,B11111111,B10000000, + B00000000,B11111110,B00000000 }; const unsigned char ccw_bmp[] PROGMEM = { @@ -669,10 +667,10 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop // Draw cw/ccw indicator and up/down arrows. if (PAGE_CONTAINS(47, 62)) { - u8g.drawBitmapP(left + 0, 47, 3, 16, rot_down); - u8g.drawBitmapP(right + 0, 47, 3, 16, rot_up); - u8g.drawBitmapP(right + 20, 48 - dir, 2, 13, up_arrow_bmp); - u8g.drawBitmapP(left + 20, 49 - dir, 2, 13, down_arrow_bmp); + u8g.drawBitmapP(right + 0, 48 - dir, 2, 13, up_arrow_bmp); + u8g.drawBitmapP(left + 0, 49 - dir, 2, 13, down_arrow_bmp); + u8g.drawBitmapP(left + 13, 47, 3, 16, rot_down); + u8g.drawBitmapP(right + 13, 47, 3, 16, rot_up); } } diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index fe799473f8..8ce25d0e77 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -111,8 +111,12 @@ // The MINIPanel display //#define U8G_CLASS U8GLIB_MINI12864 //#define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 8 stripes - #define U8G_CLASS U8GLIB_MINI12864_2X - #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes + #define U8G_CLASS U8GLIB_MINI12864_2X_HAL + #if BOTH(FYSETC_MINI_12864, FORCE_SOFT_SPI) + #define U8G_PARAM DOGLCD_SCK, DOGLCD_MOSI, DOGLCD_CS, DOGLCD_A0 // 4 stripes SW-SPI + #else + #define U8G_PARAM DOGLCD_CS, DOGLCD_A0 // 4 stripes HW-SPI + #endif #elif ENABLED(U8GLIB_SH1106_EINSTART) // Connected via motherboard header #define U8G_CLASS U8GLIB_SH1106_128X64 diff --git a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp index c99a7085a1..969cef10bb 100644 --- a/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp +++ b/Marlin/src/lcd/dogm/ultralcd_st7920_u8glib_rrd_AVR.cpp @@ -134,4 +134,13 @@ u8g_dev_t u8g_dev_st7920_128x64_rrd_sw_spi = {u8g_dev_rrd_st7920_128x64_fn, &u8g #pragma GCC reset_options +#if ENABLED(LIGHTWEIGHT_UI) + #include "../../HAL/shared/HAL_ST7920.h" + void ST7920_cs() { ST7920_CS(); } + void ST7920_ncs() { ST7920_NCS(); } + void ST7920_set_cmd() { ST7920_SET_CMD(); } + void ST7920_set_dat() { ST7920_SET_DAT(); } + void ST7920_write_byte(const uint8_t val) { ST7920_WRITE_BYTE(val); } +#endif + #endif // U8GLIB_ST7920 && !U8G_HAL_LINKS && !__SAM3X8E__ diff --git a/Marlin/src/lcd/extensible_ui/ui_api.cpp b/Marlin/src/lcd/extensible_ui/ui_api.cpp index aa71743e12..8e531ec2a9 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.cpp +++ b/Marlin/src/lcd/extensible_ui/ui_api.cpp @@ -715,6 +715,7 @@ namespace ExtUI { #if HAS_MESH bool getMeshValid() { return leveling_is_valid(); } bed_mesh_t getMeshArray() { return Z_VALUES_ARR; } + float getMeshPoint(const uint8_t xpos, const uint8_t ypos) { return Z_VALUES(xpos,ypos); } void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zoff) { if (WITHIN(xpos, 0, GRID_MAX_POINTS_X) && WITHIN(ypos, 0, GRID_MAX_POINTS_Y)) { Z_VALUES(xpos, ypos) = zoff; @@ -748,10 +749,15 @@ namespace ExtUI { enqueue_and_echo_commands_P(gcode); } + bool commandsInQueue() { return (planner.movesplanned() || commands_in_queue); } + bool isAxisPositionKnown(const axis_t axis) { return TEST(axis_known_position, axis); } + bool isPositionKnown() { return all_axes_known(); } + bool isMachineHomed() { return all_axes_homed(); } + PGM_P getFirmwareName_str() { static const char firmware_name[] PROGMEM = "Marlin " SHORT_BUILD_VERSION; return firmware_name; diff --git a/Marlin/src/lcd/extensible_ui/ui_api.h b/Marlin/src/lcd/extensible_ui/ui_api.h index b5be58dcca..2f2f99dc11 100644 --- a/Marlin/src/lcd/extensible_ui/ui_api.h +++ b/Marlin/src/lcd/extensible_ui/ui_api.h @@ -58,9 +58,12 @@ namespace ExtUI { bool isMoving(); bool isAxisPositionKnown(const axis_t); + bool isPositionKnown(); // Axis position guaranteed, steppers active since homing + bool isMachineHomed(); // Axis position most likely correct, steppers may have deactivated bool canMove(const axis_t); bool canMove(const extruder_t); void enqueueCommands_P(PGM_P const); + bool commandsInQueue(); /** * Getters and setters @@ -110,8 +113,10 @@ namespace ExtUI { bool getLevelingActive(); void setLevelingActive(const bool); #if HAS_MESH + #include "../../feature/bedlevel/bedlevel.h" bool getMeshValid(); bed_mesh_t getMeshArray(); + float getMeshPoint(const uint8_t xpos, const uint8_t ypos); void setMeshPoint(const uint8_t xpos, const uint8_t ypos, const float zval); void onMeshUpdate(const uint8_t xpos, const uint8_t ypos, const float zval); #endif diff --git a/Marlin/src/lcd/language/language_cz.h b/Marlin/src/lcd/language/language_cz.h index d53aa57097..d2a9e0811b 100644 --- a/Marlin/src/lcd/language/language_cz.h +++ b/Marlin/src/lcd/language/language_cz.h @@ -35,15 +35,20 @@ */ #define DISPLAY_CHARSET_ISO10646_CZ +#define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("áÁčČďĎéÉěĚíÍňŇóÓřŘšŠťŤúÚůŮýÝžŽ³") #define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" připraven.") +#define MSG_YES _UxGT("ANO") +#define MSG_NO _UxGT("NE") #define MSG_BACK _UxGT("Zpět") #define MSG_SD_INSERTED _UxGT("Karta vložena") #define MSG_SD_REMOVED _UxGT("Karta vyjmuta") #define MSG_LCD_ENDSTOPS _UxGT("Endstopy") // max 8 znaku #define MSG_LCD_SOFT_ENDSTOPS _UxGT("Soft Endstopy") #define MSG_MAIN _UxGT("Hlavní nabídka") +#define MSG_ADVANCED_SETTINGS _UxGT("Další nastavení") +#define MSG_CONFIGURATION _UxGT("Konfigurace") #define MSG_AUTOSTART _UxGT("Autostart") #define MSG_DISABLE_STEPPERS _UxGT("Uvolnit motory") #define MSG_DEBUG_MENU _UxGT("Nabídka ladění") @@ -56,6 +61,7 @@ #define MSG_AUTO_HOME_X _UxGT("Domů osa X") #define MSG_AUTO_HOME_Y _UxGT("Domů osa Y") #define MSG_AUTO_HOME_Z _UxGT("Domů osa Z") +#define MSG_AUTO_Z_ALIGN _UxGT("Auto srovnání Z") #define MSG_LEVEL_BED_HOMING _UxGT("Měření podložky") #define MSG_LEVEL_BED_WAITING _UxGT("Kliknutím spusťte") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Další bod") @@ -76,7 +82,13 @@ #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" hotend") #define MSG_PREHEAT_2_BEDONLY MSG_PREHEAT_2 _UxGT(" podlož") #define MSG_PREHEAT_2_SETTINGS MSG_PREHEAT_2 _UxGT(" nast") +#define MSG_PREHEAT_CUSTOM _UxGT("Zahřát vlastní") #define MSG_COOLDOWN _UxGT("Zchladit") +#define MSG_LASER_MENU _UxGT("Ovládání laseru") +#define MSG_LASER_OFF _UxGT("Vypnout laser") +#define MSG_LASER_ON _UxGT("Zapnout laser") +#define MSG_LASER_POWER _UxGT("Výkon laseru") +#define MSG_SPINDLE_REVERSE _UxGT("Vřeteno opačně") #define MSG_SWITCH_PS_ON _UxGT("Zapnout napájení") #define MSG_SWITCH_PS_OFF _UxGT("Vypnout napájení") #define MSG_EXTRUDE _UxGT("Vytlačit (extr.)") @@ -88,10 +100,23 @@ #define MSG_NEXT_CORNER _UxGT("Další roh") #define MSG_EDITING_STOPPED _UxGT("Konec úprav sítě") +#define MSG_MESH_X _UxGT("Index X") +#define MSG_MESH_Y _UxGT("Index Y") +#define MSG_MESH_EDIT_Z _UxGT("Hodnota Z") +#define MSG_USER_MENU _UxGT("Vlastní příkazy") #define MSG_UBL_DOING_G29 _UxGT("Provádím G29") #define MSG_UBL_UNHOMED _UxGT("Přejeďte domů") #define MSG_UBL_TOOLS _UxGT("UBL nástroje") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") +#define MSG_IDEX_MENU _UxGT("Režim IDEX") +#define MSG_OFFSETS_MENU _UxGT("Ofsety nástrojů") +#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") +#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplikace") +#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Zrcadlení") +#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Plná kontrola") +#define MSG_X_OFFSET _UxGT("2. tryska X") +#define MSG_Y_OFFSET _UxGT("2. tryska Y") +#define MSG_Z_OFFSET _UxGT("2. tryska Z") #define MSG_UBL_MANUAL_MESH _UxGT("Manuální síť bodů") #define MSG_UBL_BC_INSERT _UxGT("Vložte kartu, změřte") #define MSG_UBL_BC_INSERT2 _UxGT("Změřte") @@ -169,7 +194,6 @@ #define MSG_INTENSITY_B _UxGT("Modrá intenzita") #define MSG_INTENSITY_W _UxGT("Bílá intenzita") #define MSG_LED_BRIGHTNESS _UxGT("Jas") -#define MSG_USER_MENU _UxGT("Vlastní příkazy") #define MSG_MOVING _UxGT("Posouvání...") #define MSG_FREE_XY _UxGT("Uvolnit XY") @@ -177,6 +201,7 @@ #define MSG_MOVE_Y _UxGT("Posunout Y") #define MSG_MOVE_Z _UxGT("Posunout Z") #define MSG_MOVE_E _UxGT("Extrudér") +#define MSG_HOTEND_TOO_COLD _UxGT("Hotend je studený") #define MSG_MOVE_01MM _UxGT("Posunout o 0,1mm") #define MSG_MOVE_1MM _UxGT("Posunout o 1mm") #define MSG_MOVE_10MM _UxGT("Posunout o 10mm") @@ -184,6 +209,7 @@ #define MSG_BED_Z _UxGT("Výška podl.") #define MSG_NOZZLE _UxGT("Tryska") #define MSG_BED _UxGT("Podložka") +#define MSG_CHAMBER _UxGT("Komora") #define MSG_FAN_SPEED _UxGT("Rychlost vent.") #define MSG_EXTRA_FAN_SPEED _UxGT("Rychlost ex. vent.") #define MSG_FLOW _UxGT("Průtok") @@ -250,10 +276,15 @@ #define MSG_LOAD_EEPROM _UxGT("Načíst nastavení") #define MSG_RESTORE_FAILSAFE _UxGT("Obnovit výchozí") #define MSG_INIT_EEPROM _UxGT("Inic. EEPROM") +#define MSG_SD_UPDATE _UxGT("Aktualizace z SD") +#define MSG_RESET_PRINTER _UxGT("Reset tiskárny") #define MSG_REFRESH _UxGT("Obnovit") #define MSG_WATCH _UxGT("Info obrazovka") #define MSG_PREPARE _UxGT("Připrava tisku") #define MSG_TUNE _UxGT("Doladění tisku") +#define MSG_START_PRINT _UxGT("Spustit tisk") +#define MSG_BUTTON_PRINT _UxGT("Tisk") +#define MSG_BUTTON_CANCEL _UxGT("Zrušit") #define MSG_PAUSE_PRINT _UxGT("Pozastavit tisk") #define MSG_RESUME_PRINT _UxGT("Obnovit tisk") #define MSG_STOP_PRINT _UxGT("Zastavit tisk") @@ -277,6 +308,12 @@ #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("UnRet V") #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("S UnRet V") #define MSG_AUTORETRACT _UxGT("AutoRetr.") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Délka retrakce") +#define MSG_TOOL_CHANGE _UxGT("Výměna nástroje") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Zdvih Z") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Rychlost primár.") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Rychlost retrak.") +#define MSG_NOZZLE_STANDBY _UxGT("Tryska standby") #define MSG_FILAMENTCHANGE _UxGT("Vyměnit filament") #define MSG_FILAMENTLOAD _UxGT("Zavést filament") #define MSG_FILAMENTUNLOAD _UxGT("Vysunout filament") @@ -287,16 +324,22 @@ #define MSG_ZPROBE_OUT _UxGT("Sonda Z mimo podl") #define MSG_SKEW_FACTOR _UxGT("Faktor zkosení") #define MSG_BLTOUCH _UxGT("BLTouch") -#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Self-Test") -#define MSG_BLTOUCH_RESET _UxGT("BLTouch Reset") -#define MSG_BLTOUCH_DEPLOY _UxGT("BLTouch Vysunout") -#define MSG_BLTOUCH_STOW _UxGT("BLTouch Zasunout") +#define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch self-test") +#define MSG_BLTOUCH_RESET _UxGT("BLTouch reset") +#define MSG_BLTOUCH_DEPLOY _UxGT("BLTouch vysunout") +#define MSG_BLTOUCH_SW_MODE _UxGT("SW výsun BLTouch") +#define MSG_BLTOUCH_5V_MODE _UxGT("BLTouch 5V režim") +#define MSG_BLTOUCH_OD_MODE _UxGT("BLTouch OD režim") +#define MSG_BLTOUCH_STOW _UxGT("BLTouch zasunout") +#define MSG_MANUAL_DEPLOY _UxGT("Vysunout Z-sondu") +#define MSG_MANUAL_STOW _UxGT("Zasunout Z-sondu") #define MSG_HOME _UxGT("Domů") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("první") #define MSG_ZPROBE_ZOFFSET _UxGT("Z ofset") #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Celkem") #define MSG_ENDSTOP_ABORT _UxGT("Endstop abort") #define MSG_HEATING_FAILED_LCD _UxGT("Chyba zahřívání") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Chyba zahř.podl.") @@ -307,6 +350,8 @@ #define MSG_ERR_MINTEMP _UxGT("NÍZKA TEPLOTA") #define MSG_ERR_MAXTEMP_BED _UxGT("VYS. TEPL. PODL.") #define MSG_ERR_MINTEMP_BED _UxGT("NÍZ. TEPL. PODL.") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: MAXTEMP KOMORA") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: MINTEMP KOMORA") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("TISK. ZASTAVENA") #define MSG_PLEASE_RESET _UxGT("Proveďte reset") @@ -380,18 +425,82 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Vytlačit víc") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Obnovit tisk") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Tryska: ") +#define MSG_RUNOUT_SENSOR _UxGT("Senzor filamentu") #define MSG_ERR_HOMING_FAILED _UxGT("Parkování selhalo") #define MSG_ERR_PROBING_FAILED _UxGT("Kalibrace selhala") #define MSG_M600_TOO_COLD _UxGT("M600: Moc studený") +#define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("VÝMĚNA FILAMENTU") +#define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("VYBERTE FILAMENT") +#define MSG_MMU2_MENU _UxGT("MMU") +#define MSG_MMU2_WRONG_FIRMWARE _UxGT("Aktual. MMU firmware!") +#define MSG_MMU2_NOT_RESPONDING _UxGT("MMU potř. pozornost.") +#define MSG_MMU2_RESUME _UxGT("Obnovit tisk") +#define MSG_MMU2_RESUMING _UxGT("Obnovování...") +#define MSG_MMU2_LOAD_FILAMENT _UxGT("Zavést filament") +#define MSG_MMU2_LOAD_ALL _UxGT("Zavést všechny") +#define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Zavést do trysky") +#define MSG_MMU2_EJECT_FILAMENT _UxGT("Vysunout filament") +#define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Vysun. filament 1") +#define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Vysun. filament 2") +#define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Vysun. filament 3") +#define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Vysun. filament 4") +#define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Vysun. filament 5") +#define MSG_MMU2_UNLOAD_FILAMENT _UxGT("Vytáhnout filament") +#define MSG_MMU2_LOADING_FILAMENT _UxGT("Zavádění fil. %i...") +#define MSG_MMU2_EJECTING_FILAMENT _UxGT("Vytahování fil. ...") +#define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Vysouvání fil....") +#define MSG_MMU2_ALL _UxGT("Všechny") +#define MSG_MMU2_FILAMENT0 _UxGT("Filament 1") +#define MSG_MMU2_FILAMENT1 _UxGT("Filament 2") +#define MSG_MMU2_FILAMENT2 _UxGT("Filament 3") +#define MSG_MMU2_FILAMENT3 _UxGT("Filament 4") +#define MSG_MMU2_FILAMENT4 _UxGT("Filament 5") +#define MSG_MMU2_RESET _UxGT("Resetovat MMU") +#define MSG_MMU2_RESETTING _UxGT("Resetování MMU...") +#define MSG_MMU2_EJECT_RECOVER _UxGT("Vytáhněte, klikněte") + +#define MSG_MIX _UxGT("Mix") +#define MSG_MIX_COMPONENT _UxGT("Komponenta") +#define MSG_MIXER _UxGT("Mixér") +#define MSG_GRADIENT _UxGT("Přechod") +#define MSG_FULL_GRADIENT _UxGT("Celý přechod") +#define MSG_TOGGLE_MIX _UxGT("Přepnout mix") +#define MSG_CYCLE_MIX _UxGT("Střídat mix") +#define MSG_GRADIENT_MIX _UxGT("Přechod mix") +#define MSG_REVERSE_GRADIENT _UxGT("Opačný přechod") +#if LCD_WIDTH >= 20 + #define MSG_ACTIVE_VTOOL _UxGT("Aktivní V-nástroj") + #define MSG_START_VTOOL _UxGT("Spustit V-nástroj") + #define MSG_END_VTOOL _UxGT("Ukončit V-nástroj") + #define MSG_GRADIENT_ALIAS _UxGT("Alias V-nástroje") + #define MSG_RESET_VTOOLS _UxGT("Resetovat V-nástroj") + #define MSG_COMMIT_VTOOL _UxGT("Uložit V-nástroj mix") + #define MSG_VTOOLS_RESET _UxGT("V-nástroj resetovat") +#else + #define MSG_ACTIVE_VTOOL _UxGT("Aktivní V-nástr.") + #define MSG_START_VTOOL _UxGT("Spustit V-nástr.") + #define MSG_END_VTOOL _UxGT("Ukončit V-nástr.") + #define MSG_GRADIENT_ALIAS _UxGT("Alias V-nástr.") + #define MSG_RESET_VTOOLS _UxGT("Reset. V-nástr.") + #define MSG_COMMIT_VTOOL _UxGT("Uložit V-nás. mix") + #define MSG_VTOOLS_RESET _UxGT("V-nástr. reset.") +#endif +#define MSG_START_Z _UxGT("Počáteční Z") +#define MSG_END_Z _UxGT(" Koncové Z") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Bludiště") + #if LCD_HEIGHT >= 4 // Up to 3 lines allowed + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Stikněte tlačítko") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pro obnovení tisku") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parkování...") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čekejte prosím") #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("na zahájení") #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("výměny filamentu") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Čekejte prosím") - #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("na vysunuti") - #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("filamentu") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte filament") #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("a stiskněte") #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("tlačítko...") @@ -399,21 +508,46 @@ #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("nahřátí trysky") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Čekejte prosím") #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("na nahřátí tr.") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Čekejte prosím") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("na vysunuti") + #define MSG_FILAMENT_CHANGE_UNLOAD_3 _UxGT("filamentu") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Čekejte prosím") #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("na zavedení") #define MSG_FILAMENT_CHANGE_LOAD_3 _UxGT("filamentu") #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vyčkejte na") #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("vytlačení") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klikněte pro") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("ukončení") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_3 _UxGT("vytlačování") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Čekejte prosím") #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("na pokračování") #define MSG_FILAMENT_CHANGE_RESUME_3 _UxGT("tisku") #else // LCD_HEIGHT < 4 // Up to 2 lines allowed + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Stikněte tlač.") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pro obnovení") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parkování...") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Čekejte...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Vysouvání...") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Vložte, klikněte") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Klikněte pro") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("nahřátí") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Nahřívání...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Vysouvání...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Zavádění...") #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Vytlačování...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Klikněte pro") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("ukončení") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Pokračování...") #endif // LCD_HEIGHT < 4 + +#define MSG_TMC_DRIVERS _UxGT("TMC budiče") +#define MSG_TMC_CURRENT _UxGT("Proud budičů") +#define MSG_TMC_HYBRID_THRS _UxGT("Hybridní práh") +#define MSG_TMC_HOMING_THRS _UxGT("Domů bez senzorů") +#define MSG_TMC_STEPPING_MODE _UxGT("Režim kroků") +#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop povolen") +#define MSG_SERVICE_RESET _UxGT("Reset") +#define MSG_SERVICE_IN _UxGT(" za:") +#define MSG_BACKLASH _UxGT("Vůle") +#define MSG_BACKLASH_CORRECTION _UxGT("Korekce") +#define MSG_BACKLASH_SMOOTHING _UxGT("Vyhlazení") \ No newline at end of file diff --git a/Marlin/src/lcd/language/language_de.h b/Marlin/src/lcd/language/language_de.h index 241f3ab3cd..9275b08643 100644 --- a/Marlin/src/lcd/language/language_de.h +++ b/Marlin/src/lcd/language/language_de.h @@ -34,6 +34,8 @@ #define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("ÄäÖöÜüß²³") #define WELCOME_MSG MACHINE_NAME _UxGT(" bereit") +#define MSG_YES _UxGT("JA") +#define MSG_NO _UxGT("NEIN") #define MSG_BACK _UxGT("Zurück") #define MSG_SD_INSERTED _UxGT("SD-Karte erkannt") #define MSG_SD_REMOVED _UxGT("SD-Karte entfernt") @@ -97,6 +99,7 @@ #define MSG_UBL_TOOLS _UxGT("UBL-Werkzeuge") #define MSG_UBL_LEVEL_BED _UxGT("Unified Bed Leveling") #define MSG_IDEX_MENU _UxGT("IDEX-Modus") +#define MSG_OFFSETS_MENU _UxGT("Werkzeugversätze") #define MSG_IDEX_MODE_AUTOPARK _UxGT("Autom. Parken") #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplizieren") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Spiegelkopie") @@ -196,6 +199,7 @@ #define MSG_BED_Z _UxGT("Bett Z") #define MSG_NOZZLE _UxGT("Düse") #define MSG_BED _UxGT("Bett") +#define MSG_CHAMBER _UxGT("Gehäuse") #define MSG_FAN_SPEED _UxGT("Lüfter") #define MSG_EXTRA_FAN_SPEED _UxGT("Geschw. Extralüfter") #define MSG_FLOW _UxGT("Flussrate") @@ -268,6 +272,9 @@ #define MSG_WATCH _UxGT("Info") #define MSG_PREPARE _UxGT("Vorbereitung") #define MSG_TUNE _UxGT("Justierung") +#define MSG_START_PRINT _UxGT("Starte Druck") +#define MSG_BUTTON_PRINT _UxGT("Drucke") +#define MSG_BUTTON_CANCEL _UxGT("Abbrechen") #define MSG_PAUSE_PRINT _UxGT("SD-Druck pausieren") #define MSG_RESUME_PRINT _UxGT("SD-Druck fortsetzen") #define MSG_STOP_PRINT _UxGT("SD-Druck abbrechen") @@ -309,6 +316,9 @@ #define MSG_BLTOUCH_SELFTEST _UxGT("BLTouch Selbsttest") #define MSG_BLTOUCH_RESET _UxGT("BLTouch zurücks.") #define MSG_BLTOUCH_DEPLOY _UxGT("BLTouch ausfahren") +#define MSG_BLTOUCH_SW_MODE _UxGT("BLTouch SW-Modus") +#define MSG_BLTOUCH_5V_MODE _UxGT("BLTouch 5V-Modus") +#define MSG_BLTOUCH_STOW _UxGT("BLTouch einfahren") #define MSG_BLTOUCH_STOW _UxGT("BLTouch einfahren") #define MSG_MANUAL_DEPLOY _UxGT("Z-Sonde ausfahren") #define MSG_MANUAL_STOW _UxGT("Z-Sonde einfahren") @@ -318,16 +328,21 @@ #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Total") #define MSG_ENDSTOP_ABORT _UxGT("Endstopp Abbr.") #define MSG_HEATING_FAILED_LCD _UxGT("HEIZEN ERFOLGLOS") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Bett heizen fehlge.") +#define MSG_HEATING_FAILED_LCD_CHAMBER _UxGT("Geh. heizen fehlge.") #define MSG_ERR_REDUNDANT_TEMP _UxGT("REDUND. TEMP-ABWEI.") #define MSG_THERMAL_RUNAWAY LCD_STR_THERMOMETER _UxGT(" NICHT ERREICHT") #define MSG_THERMAL_RUNAWAY_BED _UxGT("BETT") MSG_THERMAL_RUNAWAY +#define MSG_THERMAL_RUNAWAY_CHAMBER _UxGT("GEH.") MSG_THERMAL_RUNAWAY #define MSG_ERR_MAXTEMP LCD_STR_THERMOMETER _UxGT(" ÜBERSCHRITTEN") #define MSG_ERR_MINTEMP LCD_STR_THERMOMETER _UxGT(" UNTERSCHRITTEN") #define MSG_ERR_MAXTEMP_BED _UxGT("BETT ") LCD_STR_THERMOMETER _UxGT(" ÜBERSCHRITTEN") #define MSG_ERR_MINTEMP_BED _UxGT("BETT ") LCD_STR_THERMOMETER _UxGT(" UNTERSCHRITTEN") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: GEHÄUSE MAX TEM") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: GEHÄUSE MIN TEM") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("DRUCKER STOPP") #define MSG_PLEASE_RESET _UxGT("Bitte neustarten") @@ -446,6 +461,10 @@ #define MSG_VTOOLS_RESET _UxGT("V-Tools ist resetet") #define MSG_START_Z _UxGT("Z Start") #define MSG_END_Z _UxGT("Z End") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Maze") // // Die Filament-Change-Bildschirme können bis zu 3 Zeilen auf einem 4-Zeilen-Display anzeigen @@ -453,6 +472,7 @@ #if LCD_HEIGHT >= 4 #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Knopf drücken um") #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("Druck fortzusetzen") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parken...") #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Warte auf den") #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("Start des") #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("Filamentwechsels...") @@ -498,3 +518,8 @@ #define MSG_TMC_HOMING_THRS _UxGT("Sensorloses Homing") #define MSG_TMC_STEPPING_MODE _UxGT("Schrittmodus") #define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop einsch.") +#define MSG_SERVICE_RESET _UxGT("Reset") +#define MSG_SERVICE_IN _UxGT(" im:") +#define MSG_BACKLASH _UxGT("Spiel") +#define MSG_BACKLASH_CORRECTION _UxGT("Korrektur") +#define MSG_BACKLASH_SMOOTHING _UxGT("Glätten") diff --git a/Marlin/src/lcd/language/language_en.h b/Marlin/src/lcd/language/language_en.h index dc6c26cf93..5677ecbae9 100644 --- a/Marlin/src/lcd/language/language_en.h +++ b/Marlin/src/lcd/language/language_en.h @@ -753,12 +753,27 @@ #ifndef MSG_START_PRINT #define MSG_START_PRINT _UxGT("Start print") #endif +#ifndef MSG_BUTTON_NEXT + #define MSG_BUTTON_NEXT _UxGT("Next") +#endif +#ifndef MSG_BUTTON_INIT + #define MSG_BUTTON_INIT _UxGT("Init") +#endif +#ifndef MSG_BUTTON_STOP + #define MSG_BUTTON_STOP _UxGT("Stop") +#endif #ifndef MSG_BUTTON_PRINT #define MSG_BUTTON_PRINT _UxGT("Print") #endif +#ifndef MSG_BUTTON_RESET + #define MSG_BUTTON_RESET _UxGT("Reset") +#endif #ifndef MSG_BUTTON_CANCEL #define MSG_BUTTON_CANCEL _UxGT("Cancel") #endif +#ifndef MSG_BUTTON_DONE + #define MSG_BUTTON_DONE _UxGT("Done") +#endif #ifndef MSG_PAUSE_PRINT #define MSG_PAUSE_PRINT _UxGT("Pause print") #endif @@ -930,6 +945,9 @@ #ifndef MSG_HEATING_FAILED_LCD_BED #define MSG_HEATING_FAILED_LCD_BED _UxGT("Bed heating failed") #endif +#ifndef MSG_HEATING_FAILED_LCD_CHAMBER + #define MSG_HEATING_FAILED_LCD_CHAMBER _UxGT("Chamber heating fail") +#endif #ifndef MSG_ERR_REDUNDANT_TEMP #define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: REDUNDANT TEMP") #endif @@ -939,6 +957,9 @@ #ifndef MSG_THERMAL_RUNAWAY_BED #define MSG_THERMAL_RUNAWAY_BED _UxGT("BED THERMAL RUNAWAY") #endif +#ifndef MSG_THERMAL_RUNAWAY_CHAMBER + #define MSG_THERMAL_RUNAWAY_CHAMBER _UxGT("CHAMBER T. RUNAWAY") +#endif #ifndef MSG_ERR_MAXTEMP #define MSG_ERR_MAXTEMP _UxGT("Err: MAXTEMP") #endif @@ -1362,6 +1383,9 @@ #ifndef MSG_ADVANCED_PAUSE_WAITING_1 #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Click to continue") #endif + #ifndef MSG_PAUSE_PRINT_INIT_1 + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parking...") + #endif #ifndef MSG_FILAMENT_CHANGE_INIT_1 #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Please wait...") #endif diff --git a/Marlin/src/lcd/language/language_fr.h b/Marlin/src/lcd/language/language_fr.h index 058062ee91..e45bb3277d 100644 --- a/Marlin/src/lcd/language/language_fr.h +++ b/Marlin/src/lcd/language/language_fr.h @@ -33,19 +33,25 @@ #define CHARSIZE 2 #define WELCOME_MSG MACHINE_NAME _UxGT(" prête.") +#define MSG_YES _UxGT("Oui") +#define MSG_NO _UxGT("Non") #define MSG_BACK _UxGT("Retour") #define MSG_SD_INSERTED _UxGT("Carte insérée") #define MSG_SD_REMOVED _UxGT("Carte retirée") -#define MSG_LCD_ENDSTOPS _UxGT("Butées") // Max length 8 characters +#define MSG_LCD_ENDSTOPS _UxGT("Butées") +#define MSG_LCD_SOFT_ENDSTOPS _UxGT("Butées SW") #define MSG_MAIN _UxGT("Menu principal") -#define MSG_AUTOSTART _UxGT("Demarrage auto") +#define MSG_ADVANCED_SETTINGS _UxGT("Config. avancée") +#define MSG_CONFIGURATION _UxGT("Configuration") +#define MSG_AUTOSTART _UxGT("Exéc. auto#.gcode") #define MSG_DISABLE_STEPPERS _UxGT("Arrêter moteurs") #define MSG_DEBUG_MENU _UxGT("Menu debug") #define MSG_PROGRESS_BAR_TEST _UxGT("Test barre progress.") #define MSG_AUTO_HOME _UxGT("Origine auto.") -#define MSG_AUTO_HOME_X _UxGT("Origine X Auto.") -#define MSG_AUTO_HOME_Y _UxGT("Origine Y Auto.") -#define MSG_AUTO_HOME_Z _UxGT("Origine Z Auto.") +#define MSG_AUTO_HOME_X _UxGT("Origine X auto.") +#define MSG_AUTO_HOME_Y _UxGT("Origine Y auto.") +#define MSG_AUTO_HOME_Z _UxGT("Origine Z auto.") +#define MSG_AUTO_Z_ALIGN _UxGT("Align. Z auto.") #define MSG_LEVEL_BED_HOMING _UxGT("Origine XYZ") #define MSG_LEVEL_BED_WAITING _UxGT("Clic pour commencer") #define MSG_LEVEL_BED_NEXT_POINT _UxGT("Point suivant") @@ -59,14 +65,20 @@ #define MSG_PREHEAT_1_ALL _UxGT("Préch. " PREHEAT_1_LABEL " Tout") #define MSG_PREHEAT_1_END MSG_PREHEAT_1 _UxGT(" buse") #define MSG_PREHEAT_1_BEDONLY _UxGT("Préch. " PREHEAT_1_LABEL " lit") -#define MSG_PREHEAT_1_SETTINGS _UxGT("Régl. prech. " PREHEAT_1_LABEL) +#define MSG_PREHEAT_1_SETTINGS _UxGT("Régl. préch. " PREHEAT_1_LABEL) #define MSG_PREHEAT_2 _UxGT("Préchauffage " PREHEAT_2_LABEL) #define MSG_PREHEAT_2_N _UxGT("Préchauff. " PREHEAT_2_LABEL " ") #define MSG_PREHEAT_2_ALL _UxGT("Préch. " PREHEAT_2_LABEL " Tout") #define MSG_PREHEAT_2_END MSG_PREHEAT_2 _UxGT(" buse") #define MSG_PREHEAT_2_BEDONLY _UxGT("Préch. " PREHEAT_2_LABEL " lit") -#define MSG_PREHEAT_2_SETTINGS _UxGT("Régl. prech. " PREHEAT_2_LABEL) +#define MSG_PREHEAT_2_SETTINGS _UxGT("Régl. préch. " PREHEAT_2_LABEL) +#define MSG_PREHEAT_CUSTOM _UxGT("Préchauff. perso.") #define MSG_COOLDOWN _UxGT("Refroidir") +#define MSG_LASER_MENU _UxGT("Contrôle Laser") +#define MSG_LASER_OFF _UxGT("Laser Off") +#define MSG_LASER_ON _UxGT("Laser On") +#define MSG_LASER_POWER _UxGT("Puissance") +#define MSG_SPINDLE_REVERSE _UxGT("Inverser broches") #define MSG_SWITCH_PS_ON _UxGT("Allumer alim.") #define MSG_SWITCH_PS_OFF _UxGT("Eteindre alim.") #define MSG_EXTRUDE _UxGT("Extrusion") @@ -77,12 +89,24 @@ #define MSG_LEVEL_CORNERS _UxGT("Niveau coins") #define MSG_NEXT_CORNER _UxGT("Coin suivant") #define MSG_EDITING_STOPPED _UxGT("Arrêt édit. maillage") -#define MSG_USER_MENU _UxGT("Commandes perso") +#define MSG_MESH_X _UxGT("Index X") +#define MSG_MESH_Y _UxGT("Index Y") +#define MSG_MESH_EDIT_Z _UxGT("Valeur Z") +#define MSG_USER_MENU _UxGT("Commandes perso.") #define MSG_UBL_DOING_G29 _UxGT("G29 en cours") #define MSG_UBL_UNHOMED _UxGT("Origine XYZ d'abord") #define MSG_UBL_TOOLS _UxGT("Outils UBL") #define MSG_UBL_LEVEL_BED _UxGT("Niveau lit unifié") +#define MSG_IDEX_MENU _UxGT("Mode IDEX") +#define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-Park") +#define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplication") +#define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Copie miroir") +#define MSG_IDEX_MODE_FULL_CTRL _UxGT("Contrôle complet") +#define MSG_OFFSETS_MENU _UxGT("Offsets Outil") +#define MSG_X_OFFSET _UxGT("Buse 2 X") +#define MSG_Y_OFFSET _UxGT("Buse 2 Y") +#define MSG_Z_OFFSET _UxGT("Buse 2 Z") #define MSG_UBL_MANUAL_MESH _UxGT("Maillage manuel") #define MSG_UBL_BC_INSERT _UxGT("Poser câle & mesurer") #define MSG_UBL_BC_INSERT2 _UxGT("Mesure") @@ -167,6 +191,7 @@ #define MSG_MOVE_Y _UxGT("Dépl. Y") #define MSG_MOVE_Z _UxGT("Dépl. Z") #define MSG_MOVE_E _UxGT("Extrudeur") +#define MSG_HOTEND_TOO_COLD _UxGT("Buse trop froide") #define MSG_MOVE_01MM _UxGT("Dépl. 0.1mm") #define MSG_MOVE_1MM _UxGT("Dépl. 1mm") #define MSG_MOVE_10MM _UxGT("Dépl. 10mm") @@ -174,6 +199,7 @@ #define MSG_BED_Z _UxGT("Lit Z") #define MSG_NOZZLE _UxGT("Buse") #define MSG_BED _UxGT("Lit") +#define MSG_CHAMBER _UxGT("Caisson") #define MSG_FAN_SPEED _UxGT("Vitesse ventil.") #define MSG_EXTRA_FAN_SPEED _UxGT("Extra V ventil.") @@ -203,6 +229,7 @@ #endif #define MSG_VE_JERK _UxGT("Ve jerk") #define MSG_VELOCITY _UxGT("Vélocité") +#define MSG_JUNCTION_DEVIATION _UxGT("Déviat. jonct.") #define MSG_VMAX _UxGT("Vmax ") #define MSG_VMIN _UxGT("Vmin ") #define MSG_VTRAV_MIN _UxGT("V dépl. min") @@ -240,19 +267,26 @@ #define MSG_LOAD_EEPROM _UxGT("Lire config") #define MSG_RESTORE_FAILSAFE _UxGT("Restaurer défauts") #define MSG_INIT_EEPROM _UxGT("Initialiser EEPROM") +#define MSG_SD_UPDATE _UxGT("MàJ. SD") +#define MSG_RESET_PRINTER _UxGT("RàZ. imprimante") #define MSG_REFRESH _UxGT("Actualiser") #define MSG_WATCH _UxGT("Surveiller") #define MSG_PREPARE _UxGT("Préparer") #define MSG_TUNE _UxGT("Régler") +#define MSG_START_PRINT _UxGT("Démarrer Impr.") +#define MSG_BUTTON_PRINT _UxGT("Imprimer") +#define MSG_BUTTON_CANCEL _UxGT("Annuler") #define MSG_PAUSE_PRINT _UxGT("Interrompre impr.") #define MSG_RESUME_PRINT _UxGT("Reprendre impr.") #define MSG_STOP_PRINT _UxGT("Arrêter impr.") +#define MSG_OUTAGE_RECOVERY _UxGT("Récupér. coupure") #define MSG_CARD_MENU _UxGT("Impr. depuis SD") #define MSG_NO_CARD _UxGT("Pas de carte") #define MSG_DWELL _UxGT("Repos...") -#define MSG_USERWAIT _UxGT("Atten. de l'util.") +#define MSG_USERWAIT _UxGT("Attente utilis.") #define MSG_PRINT_PAUSED _UxGT("Impr. en pause") -#define MSG_PRINT_ABORTED _UxGT("Impr. Annulée") +#define MSG_PRINTING _UxGT("Impression") +#define MSG_PRINT_ABORTED _UxGT("Impr. annulée") #define MSG_NO_MOVE _UxGT("Moteurs bloqués.") #define MSG_KILLED _UxGT("MORT.") #define MSG_STOPPED _UxGT("STOPPÉ.") @@ -264,34 +298,50 @@ #define MSG_CONTROL_RETRACT_RECOVER_SWAP _UxGT("Ech. Rappel mm") #define MSG_CONTROL_RETRACT_RECOVERF _UxGT("Rappel V") #define MSG_CONTROL_RETRACT_RECOVER_SWAPF _UxGT("Ech. Rappel V") -#define MSG_AUTORETRACT _UxGT("Retrait. Auto.") +#define MSG_AUTORETRACT _UxGT("Retrait auto.") +#define MSG_TOOL_CHANGE _UxGT("Changement outil") +#define MSG_TOOL_CHANGE_ZLIFT _UxGT("Augmenter Z") +#define MSG_SINGLENOZZLE_PRIME_SPD _UxGT("Vitesse primaire") +#define MSG_SINGLENOZZLE_RETRACT_SPD _UxGT("Vitesse retrait") +#define MSG_NOZZLE_STANDBY _UxGT("Attente buse") +#define MSG_FILAMENT_SWAP_LENGTH _UxGT("Distance retrait") #define MSG_FILAMENTCHANGE _UxGT("Changer filament") #define MSG_FILAMENTLOAD _UxGT("Charger fil.") #define MSG_FILAMENTUNLOAD _UxGT("Décharger fil.") #define MSG_FILAMENTUNLOAD_ALL _UxGT("Décharger tout") #define MSG_INIT_SDCARD _UxGT("Init. la carte SD") #define MSG_CHANGE_SDCARD _UxGT("Changer de carte") -#define MSG_ZPROBE_OUT _UxGT("Z sonde hors lit") +#define MSG_ZPROBE_OUT _UxGT("Sonde Z hors lit") #define MSG_SKEW_FACTOR _UxGT("Facteur écart") #define MSG_BLTOUCH _UxGT("BLTouch") #define MSG_BLTOUCH_SELFTEST _UxGT("Autotest BLTouch") #define MSG_BLTOUCH_RESET _UxGT("RaZ BLTouch") #define MSG_BLTOUCH_DEPLOY _UxGT("Déployer BLTouch") +#define MSG_BLTOUCH_SW_MODE _UxGT("Mode BLTouch SW") +#define MSG_BLTOUCH_5V_MODE _UxGT("Mode BLTouch 5V") +#define MSG_BLTOUCH_OD_MODE _UxGT("Mode BLTouch OD") #define MSG_BLTOUCH_STOW _UxGT("Ranger BLTouch") +#define MSG_MANUAL_DEPLOY _UxGT("Déployer Sonde Z") +#define MSG_MANUAL_STOW _UxGT("Ranger Sonde Z") #define MSG_HOME _UxGT("Origine") // Used as MSG_HOME " " MSG_X MSG_Y MSG_Z " " MSG_FIRST #define MSG_FIRST _UxGT("Premier") #define MSG_ZPROBE_ZOFFSET _UxGT("Décalage Z") #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Total") #define MSG_ENDSTOP_ABORT _UxGT("Butée abandon") #define MSG_HEATING_FAILED_LCD _UxGT("Erreur de chauffe") +#define MSG_HEATING_FAILED_LCD_BED _UxGT("Erreur de chauffe lit") #define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: TEMP. REDONDANTE") #define MSG_THERMAL_RUNAWAY _UxGT("EMBALLEMENT THERM.") +#define MSG_THERMAL_RUNAWAY_BED _UxGT("ERREUR THERMIQUE LIT") #define MSG_ERR_MAXTEMP _UxGT("Err: TEMP. MAX") #define MSG_ERR_MINTEMP _UxGT("Err: TEMP. MIN") #define MSG_ERR_MAXTEMP_BED _UxGT("Err: TEMP. MAX LIT") #define MSG_ERR_MINTEMP_BED _UxGT("Err: TEMP. MIN LIT") +#define MSG_ERR_MAXTEMP_CHAMBER _UxGT("Err: MAXTEMP CAISSON") +#define MSG_ERR_MINTEMP_CHAMBER _UxGT("Err: MINTEMP CAISSON") #define MSG_ERR_Z_HOMING MSG_HOME _UxGT(" ") MSG_X MSG_Y _UxGT(" ") MSG_FIRST #define MSG_HALTED _UxGT("IMPR. STOPPÉE") @@ -301,7 +351,9 @@ #define MSG_SHORT_MINUTE _UxGT("m") // One character only #define MSG_HEATING _UxGT("En chauffe...") +#define MSG_COOLING _UxGT("Refroidissement") #define MSG_BED_HEATING _UxGT("Lit en chauffe...") +#define MSG_BED_COOLING _UxGT("Refroid. du lit...") #define MSG_DELTA_CALIBRATE _UxGT("Calibration Delta") #define MSG_DELTA_CALIBRATE_X _UxGT("Calibrer X") #define MSG_DELTA_CALIBRATE_Y _UxGT("Calibrer Y") @@ -310,6 +362,7 @@ #define MSG_DELTA_SETTINGS _UxGT("Réglages Delta") #define MSG_DELTA_AUTO_CALIBRATE _UxGT("Calibration Auto") #define MSG_DELTA_HEIGHT_CALIBRATE _UxGT("Hauteur Delta") +#define MSG_DELTA_Z_OFFSET_CALIBRATE _UxGT("Delta Z sonde") #define MSG_DELTA_DIAG_ROD _UxGT("Diagonale") #define MSG_DELTA_HEIGHT _UxGT("Hauteur") #define MSG_DELTA_RADIUS _UxGT("Rayon") @@ -323,9 +376,9 @@ #define MSG_MESH_LEVELING _UxGT("Niveau maillage") #define MSG_INFO_STATS_MENU _UxGT("Stats. imprimante") #define MSG_INFO_BOARD_MENU _UxGT("Infos carte") -#define MSG_INFO_THERMISTOR_MENU _UxGT("Thermistors") +#define MSG_INFO_THERMISTOR_MENU _UxGT("Thermistances") #define MSG_INFO_EXTRUDERS _UxGT("Extrudeurs") -#define MSG_INFO_BAUDRATE _UxGT("Baud") +#define MSG_INFO_BAUDRATE _UxGT("Bauds") #define MSG_INFO_PROTOCOL _UxGT("Protocole") #define MSG_CASE_LIGHT _UxGT("Lumière caisson") #define MSG_CASE_LIGHT_BRIGHTNESS _UxGT("Luminosité") @@ -358,35 +411,109 @@ #define MSG_FILAMENT_CHANGE_OPTION_PURGE _UxGT("Purger encore") #define MSG_FILAMENT_CHANGE_OPTION_RESUME _UxGT("Reprendre impr.") #define MSG_FILAMENT_CHANGE_NOZZLE _UxGT(" Buse: ") +#define MSG_RUNOUT_SENSOR _UxGT("Capteur Fil.") #define MSG_ERR_HOMING_FAILED _UxGT("Echec origine") #define MSG_ERR_PROBING_FAILED _UxGT("Echec sonde") #define MSG_M600_TOO_COLD _UxGT("M600: Trop froid") +#define MSG_MMU2_FILAMENT_CHANGE_HEADER _UxGT("CHANGER FILAMENT") +#define MSG_MMU2_CHOOSE_FILAMENT_HEADER _UxGT("CHOISIR FILAMENT") +#define MSG_MMU2_MENU _UxGT("MMU") +#define MSG_MMU2_WRONG_FIRMWARE _UxGT("Update MMU firmware!") +#define MSG_MMU2_NOT_RESPONDING _UxGT("MMU ne répond plus") +#define MSG_MMU2_RESUME _UxGT("Continuer impr.") +#define MSG_MMU2_RESUMING _UxGT("Reprise...") +#define MSG_MMU2_LOAD_FILAMENT _UxGT("Charger filament") +#define MSG_MMU2_LOAD_ALL _UxGT("Charger tous") +#define MSG_MMU2_LOAD_TO_NOZZLE _UxGT("Charger dans buse") +#define MSG_MMU2_EJECT_FILAMENT _UxGT("Ejecter filament") +#define MSG_MMU2_EJECT_FILAMENT0 _UxGT("Ejecter fil. 1") +#define MSG_MMU2_EJECT_FILAMENT1 _UxGT("Ejecter fil. 2") +#define MSG_MMU2_EJECT_FILAMENT2 _UxGT("Ejecter fil. 3") +#define MSG_MMU2_EJECT_FILAMENT3 _UxGT("Ejecter fil. 4") +#define MSG_MMU2_EJECT_FILAMENT4 _UxGT("Ejecter fil. 5") +#define MSG_MMU2_UNLOAD_FILAMENT _UxGT("Retrait filament") +#define MSG_MMU2_LOADING_FILAMENT _UxGT("Chargem. fil. %i...") +#define MSG_MMU2_EJECTING_FILAMENT _UxGT("Ejection fil...") +#define MSG_MMU2_UNLOADING_FILAMENT _UxGT("Retrait fil....") +#define MSG_MMU2_ALL _UxGT("Tous") +#define MSG_MMU2_FILAMENT0 _UxGT("Filament 1") +#define MSG_MMU2_FILAMENT1 _UxGT("Filament 2") +#define MSG_MMU2_FILAMENT2 _UxGT("Filament 3") +#define MSG_MMU2_FILAMENT3 _UxGT("Filament 4") +#define MSG_MMU2_FILAMENT4 _UxGT("Filament 5") +#define MSG_MMU2_RESET _UxGT("Réinit. MMU") +#define MSG_MMU2_RESETTING _UxGT("Réinit. MMU...") +#define MSG_MMU2_EJECT_RECOVER _UxGT("Retrait, click") + +#define MSG_MIX _UxGT("Mix") +#define MSG_MIX_COMPONENT _UxGT("Composante") +#define MSG_MIXER _UxGT("Mixeur") +#define MSG_GRADIENT _UxGT("Dégradé") +#define MSG_FULL_GRADIENT _UxGT("Dégradé complet") +#define MSG_TOGGLE_MIX _UxGT("Toggle mix") +#define MSG_CYCLE_MIX _UxGT("Cycle mix") +#define MSG_GRADIENT_MIX _UxGT("Mix dégradé") +#define MSG_REVERSE_GRADIENT _UxGT("Inverser dégradé") +#define MSG_ACTIVE_VTOOL _UxGT("Active V-tool") +#define MSG_START_VTOOL _UxGT("Début V-tool") +#define MSG_END_VTOOL _UxGT(" Fin V-tool") +#define MSG_GRADIENT_ALIAS _UxGT("Alias V-tool") +#define MSG_RESET_VTOOLS _UxGT("Réinit. V-tools") +#define MSG_COMMIT_VTOOL _UxGT("Valider Mix V-tool") +#define MSG_VTOOLS_RESET _UxGT("V-tools réinit. ok") +#define MSG_START_Z _UxGT("Début Z") +#define MSG_END_Z _UxGT(" Fin Z") +#define MSG_BRICKOUT _UxGT("Casse-briques") +#define MSG_INVADERS _UxGT("Invaders") +#define MSG_SNAKE _UxGT("Sn4k3") +#define MSG_MAZE _UxGT("Labyrinthe") #if LCD_HEIGHT >= 4 // Up to 3 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Attente Démarrage") - #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("du filament") - #define MSG_FILAMENT_CHANGE_INIT_3 _UxGT("changer") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Attente de") - #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("décharger filament") + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Presser bouton") + #define MSG_ADVANCED_PAUSE_WAITING_2 _UxGT("pour reprendre") + #define MSG_PAUSE_PRINT_INIT_1 _UxGT("Parking...") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Attente filament") + #define MSG_FILAMENT_CHANGE_INIT_2 _UxGT("pour démarrer") #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insérer filament") #define MSG_FILAMENT_CHANGE_INSERT_2 _UxGT("et app. bouton") #define MSG_FILAMENT_CHANGE_INSERT_3 _UxGT("pour continuer...") #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Presser le bouton...") - #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("Pr chauffer la buse") + #define MSG_FILAMENT_CHANGE_HEAT_2 _UxGT("pr chauffer la buse") #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Buse en chauffe") - #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Patientez SVP...") - #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Attente de") - #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("Chargement filament") + #define MSG_FILAMENT_CHANGE_HEATING_2 _UxGT("Patienter SVP...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Attente") + #define MSG_FILAMENT_CHANGE_UNLOAD_2 _UxGT("retrait du filament") + #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Attente") + #define MSG_FILAMENT_CHANGE_LOAD_2 _UxGT("chargement filament") #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Attente") - #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("Purger filament") - #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Attente impression") - #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("pour reprendre") + #define MSG_FILAMENT_CHANGE_PURGE_2 _UxGT("Purge filament") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Presser pour finir") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_2 _UxGT("la purge du filament") + #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Attente reprise") + #define MSG_FILAMENT_CHANGE_RESUME_2 _UxGT("impression") #else // LCD_HEIGHT < 4 // Up to 2 lines allowed - #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Patientez...") - #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejection...") - #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insérer et clic") + #define MSG_ADVANCED_PAUSE_WAITING_1 _UxGT("Presser pr continuer") + #define MSG_FILAMENT_CHANGE_INIT_1 _UxGT("Patience...") + #define MSG_FILAMENT_CHANGE_INSERT_1 _UxGT("Insérer fil.") + #define MSG_FILAMENT_CHANGE_HEAT_1 _UxGT("Chauffer ?") + #define MSG_FILAMENT_CHANGE_HEATING_1 _UxGT("Chauffage...") + #define MSG_FILAMENT_CHANGE_UNLOAD_1 _UxGT("Ejecting...") #define MSG_FILAMENT_CHANGE_LOAD_1 _UxGT("Chargement...") + #define MSG_FILAMENT_CHANGE_PURGE_1 _UxGT("Purge...") + #define MSG_FILAMENT_CHANGE_CONT_PURGE_1 _UxGT("Terminer ?") #define MSG_FILAMENT_CHANGE_RESUME_1 _UxGT("Reprise...") #endif // LCD_HEIGHT < 4 + +#define MSG_TMC_DRIVERS _UxGT("Drivers TMC") +#define MSG_TMC_CURRENT _UxGT("Courant driver") +#define MSG_TMC_HYBRID_THRS _UxGT("Seuil hybride") +#define MSG_TMC_HOMING_THRS _UxGT("Home sans capteur") +#define MSG_TMC_STEPPING_MODE _UxGT("Mode pas à pas") +#define MSG_TMC_STEALTH_ENABLED _UxGT("StealthChop activé") +#define MSG_SERVICE_RESET _UxGT("Réinit.") +#define MSG_SERVICE_IN _UxGT(" dans:") +#define MSG_BACKLASH _UxGT("Backlash") +#define MSG_BACKLASH_CORRECTION _UxGT("Correction") +#define MSG_BACKLASH_SMOOTHING _UxGT("Lissage") diff --git a/Marlin/src/lcd/language/language_it.h b/Marlin/src/lcd/language/language_it.h index 36bfd70f19..78450b47bd 100644 --- a/Marlin/src/lcd/language/language_it.h +++ b/Marlin/src/lcd/language/language_it.h @@ -330,9 +330,11 @@ #define MSG_ENDSTOP_ABORT _UxGT("Finecorsa annullati") #define MSG_HEATING_FAILED_LCD _UxGT("Riscald. Fallito") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Risc. piatto fallito") +#define MSG_HEATING_FAILED_LCD_CHAMBER _UxGT("Risc. camera fallito") #define MSG_ERR_REDUNDANT_TEMP _UxGT("Err: TEMP RIDONDANTE") #define MSG_THERMAL_RUNAWAY _UxGT("TEMP FUORI CONTROLLO") #define MSG_THERMAL_RUNAWAY_BED _UxGT("TEMP PIAT.FUORI CTRL") +#define MSG_THERMAL_RUNAWAY_CHAMBER _UxGT("T.CAMERA FUORI CTRL") #define MSG_ERR_MAXTEMP _UxGT("Err: TEMP MASSIMA") #define MSG_ERR_MINTEMP _UxGT("Err: TEMP MINIMA") #define MSG_ERR_MAXTEMP_BED _UxGT("Err: TEMP MAX PIATTO") diff --git a/Marlin/src/lcd/language/language_sk.h b/Marlin/src/lcd/language/language_sk.h index 965ae22310..c069c780e9 100644 --- a/Marlin/src/lcd/language/language_sk.h +++ b/Marlin/src/lcd/language/language_sk.h @@ -40,6 +40,8 @@ #define THIS_LANGUAGES_SPECIAL_SYMBOLS _UxGT("äÄáÁčČďĎéÉíÍĺĹľĽňŇóÓôÔŕŔšŠťŤúÚýÝžŽ³") #define WELCOME_MSG MACHINE_NAME _UxGT(" pripravená.") +#define MSG_YES _UxGT("ÁNO") +#define MSG_NO _UxGT("NIE") #define MSG_BACK _UxGT("Naspäť") #define MSG_SD_INSERTED _UxGT("Karta vložená") #define MSG_SD_REMOVED _UxGT("Karta vybraná") @@ -104,6 +106,7 @@ #define MSG_UBL_TOOLS _UxGT("Nástroje UBL") #define MSG_UBL_LEVEL_BED _UxGT("UBL rovnanie") #define MSG_IDEX_MENU _UxGT("IDEX režim") +#define MSG_OFFSETS_MENU _UxGT("Offset nástrojov") #define MSG_IDEX_MODE_AUTOPARK _UxGT("Auto-parkovanie") #define MSG_IDEX_MODE_DUPLICATE _UxGT("Duplikácia") #define MSG_IDEX_MODE_MIRRORED_COPY _UxGT("Zrkadlená kópia") @@ -276,6 +279,9 @@ #define MSG_WATCH _UxGT("Info. obrazovka") #define MSG_PREPARE _UxGT("Príprava tlače") #define MSG_TUNE _UxGT("Doladenie tlače") +#define MSG_START_PRINT _UxGT("Spustiť tlač") +#define MSG_BUTTON_PRINT _UxGT("Tlačiť") +#define MSG_BUTTON_CANCEL _UxGT("Zrušiť") #define MSG_PAUSE_PRINT _UxGT("Pozastaviť tlač") #define MSG_RESUME_PRINT _UxGT("Obnoviť tlač") #define MSG_STOP_PRINT _UxGT("Zastaviť tlač") @@ -330,6 +336,7 @@ #define MSG_BABYSTEP_X _UxGT("Babystep X") #define MSG_BABYSTEP_Y _UxGT("Babystep Y") #define MSG_BABYSTEP_Z _UxGT("Babystep Z") +#define MSG_BABYSTEP_TOTAL _UxGT("Celkom") #define MSG_ENDSTOP_ABORT _UxGT("Zastavenie Endstop") #define MSG_HEATING_FAILED_LCD _UxGT("Chyba ohrevu") #define MSG_HEATING_FAILED_LCD_BED _UxGT("Chyba ohrevu podl.") @@ -461,6 +468,10 @@ #define MSG_VTOOLS_RESET _UxGT("V-tools resetované") #define MSG_START_Z _UxGT("Počiat.Z") #define MSG_END_Z _UxGT("Konečn.Z") +#define MSG_BRICKOUT _UxGT("Brickout") +#define MSG_INVADERS _UxGT("Nájazdníci") +#define MSG_SNAKE _UxGT("Had") +#define MSG_MAZE _UxGT("Bludisko") // // Filament Change screens show up to 3 lines on a 4-line display @@ -515,3 +526,6 @@ #define MSG_SERVICE_RESET _UxGT("Vynulovať") #define MSG_SERVICE_IN _UxGT(" za:") +#define MSG_BACKLASH _UxGT("Kompenz. vôle") +#define MSG_BACKLASH_CORRECTION _UxGT("Korekcia") +#define MSG_BACKLASH_SMOOTHING _UxGT("Vyhladzovanie") diff --git a/Marlin/src/lcd/menu/menu.cpp b/Marlin/src/lcd/menu/menu.cpp index 91b1ad448e..ba6957ddaf 100644 --- a/Marlin/src/lcd/menu/menu.cpp +++ b/Marlin/src/lcd/menu/menu.cpp @@ -167,9 +167,9 @@ DEFINE_MENU_EDIT_ITEM(float3); // 123 right-justified DEFINE_MENU_EDIT_ITEM(float52); // 123.45 DEFINE_MENU_EDIT_ITEM(float43); // 1.234 DEFINE_MENU_EDIT_ITEM(float5); // 12345 right-justified -DEFINE_MENU_EDIT_ITEM(float51); // +1234.5 +DEFINE_MENU_EDIT_ITEM(float51); // 1234.5 right-justified +DEFINE_MENU_EDIT_ITEM(float51sign); // +1234.5 DEFINE_MENU_EDIT_ITEM(float52sign); // +123.45 -DEFINE_MENU_EDIT_ITEM(float62); // 1234.56 right-justified DEFINE_MENU_EDIT_ITEM(long5); // 12345 right-justified void MenuItem_bool::action_edit(PGM_P pstr, bool *ptr, screenFunc_t callback) { @@ -268,6 +268,8 @@ void MarlinUI::goto_screen(screenFunc_t screen, const uint16_t encoder/*=0*/, co #if HAS_GRAPHICAL_LCD drawing_screen = false; #endif + + set_ui_selection(false); } } @@ -436,12 +438,21 @@ void _lcd_draw_homing() { void _lcd_toggle_bed_leveling() { set_bed_leveling_enabled(!planner.leveling_active); } #endif -void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) { +// +// Selection screen presents a prompt and two options +// +bool ui_selection; // = false +void set_ui_selection(const bool sel) { ui_selection = sel; } +void do_select_screen(PGM_P const yes, PGM_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string/*=NULL*/, PGM_P const suff/*=NULL*/) { if (ui.encoderPosition) { - yesno = int16_t(ui.encoderPosition) > 0; + ui_selection = int16_t(ui.encoderPosition) > 0; ui.encoderPosition = 0; } - draw_select_screen(yes, no, yesno, pref, string, suff); + const bool got_click = ui.use_click(); + if (got_click || ui.should_draw()) { + draw_select_screen(yes, no, ui_selection, pref, string, suff); + if (got_click) { ui_selection ? yesFunc() : noFunc(); } + } } #endif // HAS_LCD_MENU diff --git a/Marlin/src/lcd/menu/menu.h b/Marlin/src/lcd/menu/menu.h index 6e8d44b13e..de3bd210fb 100644 --- a/Marlin/src/lcd/menu/menu.h +++ b/Marlin/src/lcd/menu/menu.h @@ -24,6 +24,8 @@ #include "../ultralcd.h" #include "../../inc/MarlinConfig.h" +#include "limits.h" + extern int8_t encoderLine, encoderTopLine, screen_items; extern bool screen_changed; @@ -54,21 +56,24 @@ DECLARE_MENU_EDIT_TYPE(float, float3, ftostr3, 1 ); // 123 DECLARE_MENU_EDIT_TYPE(float, float52, ftostr52, 100 ); // 123.45 DECLARE_MENU_EDIT_TYPE(float, float43, ftostr43sign, 1000 ); // 1.234 DECLARE_MENU_EDIT_TYPE(float, float5, ftostr5rj, 0.01f ); // 12345 right-justified -DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51sign, 10 ); // +1234.5 +DECLARE_MENU_EDIT_TYPE(float, float51, ftostr51rj, 10 ); // 1234.5 right-justified +DECLARE_MENU_EDIT_TYPE(float, float51sign, ftostr51sign, 10 ); // +1234.5 DECLARE_MENU_EDIT_TYPE(float, float52sign, ftostr52sign, 100 ); // +123.45 -DECLARE_MENU_EDIT_TYPE(float, float62, ftostr62rj, 100 ); // 1234.56 right-justified DECLARE_MENU_EDIT_TYPE(uint32_t, long5, ftostr5rj, 0.01f ); // 12345 right-justified //////////////////////////////////////////// ///////// Menu Item Draw Functions ///////// //////////////////////////////////////////// -void draw_edit_screen(PGM_P const pstr, const char* const value=NULL); +typedef void (*selectFunc_t)(); void draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string, PGM_P const suff); -void do_select_screen(PGM_P const yes, PGM_P const no, bool &yesno, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL); -inline void do_select_screen_yn(bool &yesno, PGM_P const pref, const char * const string, PGM_P const suff) { - do_select_screen(PSTR(MSG_YES), PSTR(MSG_NO), yesno, pref, string, suff); +void set_ui_selection(const bool sel); +void do_select_screen(PGM_P const yes, PGM_P const no, selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL); +inline void do_select_screen_yn(selectFunc_t yesFunc, selectFunc_t noFunc, PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL) { + do_select_screen(PSTR(MSG_YES), PSTR(MSG_NO), yesFunc, noFunc, pref, string, suff); } + +void draw_edit_screen(PGM_P const pstr, const char* const value=NULL); void draw_menu_item(const bool sel, const uint8_t row, PGM_P const pstr, const char pre_char, const char post_char); void draw_menu_item_static(const uint8_t row, PGM_P const pstr, const bool center=true, const bool invert=false, const char *valstr=NULL); void _draw_menu_item_edit(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm); @@ -119,9 +124,9 @@ DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float3); // 123 right-justif DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52); // 123.45 DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float43); // 1.234 DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float5); // 12345 right-justified -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51); // +1234.5 +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51); // 1234.5 right-justified +DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float51sign); // +1234.5 DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float52sign); // +123.45 -DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(float62); // 1234.56 right-justified DEFINE_DRAW_MENU_ITEM_SETTING_EDIT(long5); // 12345 right-justified #define draw_menu_item_edit_bool(sel, row, pstr, pstr2, data, ...) DRAW_BOOL_SETTING(sel, row, pstr, data) @@ -179,8 +184,10 @@ class TMenuItem : MenuItemBase { static char* to_string(const int16_t value) { return NAME::strfunc(unscale(value)); } public: static void action_edit(PGM_P const pstr, type_t * const ptr, const type_t minValue, const type_t maxValue, const screenFunc_t callback=NULL, const bool live=false) { - const int16_t minv = scale(minValue); - init(pstr, ptr, minv, int16_t(scale(maxValue)) - minv, int16_t(scale(*ptr)) - minv, edit, callback, live); + // Make sure minv and maxv fit within int16_t + const int16_t minv = MAX(scale(minValue), INT16_MIN), + maxv = MIN(scale(maxValue), INT16_MAX); + init(pstr, ptr, minv, maxv - minv, scale(*ptr) - minv, edit, callback, live); } static void edit() { MenuItemBase::edit(to_string, load); } }; @@ -199,8 +206,8 @@ DECLARE_MENU_EDIT_ITEM(float52); DECLARE_MENU_EDIT_ITEM(float43); DECLARE_MENU_EDIT_ITEM(float5); DECLARE_MENU_EDIT_ITEM(float51); +DECLARE_MENU_EDIT_ITEM(float51sign); DECLARE_MENU_EDIT_ITEM(float52sign); -DECLARE_MENU_EDIT_ITEM(float62); DECLARE_MENU_EDIT_ITEM(long5); class MenuItem_bool { diff --git a/Marlin/src/lcd/menu/menu_advanced.cpp b/Marlin/src/lcd/menu/menu_advanced.cpp index 89955484b0..9d99d03962 100644 --- a/Marlin/src/lcd/menu/menu_advanced.cpp +++ b/Marlin/src/lcd/menu/menu_advanced.cpp @@ -571,14 +571,14 @@ void menu_backlash(); START_MENU(); MENU_BACK(MSG_ADVANCED_SETTINGS); - #define EDIT_QSTEPS(Q) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_##Q##STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, _planner_refresh_positioning) + #define EDIT_QSTEPS(Q) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_##Q##STEPS, &planner.settings.axis_steps_per_mm[_AXIS(Q)], 5, 9999, _planner_refresh_positioning) EDIT_QSTEPS(A); EDIT_QSTEPS(B); EDIT_QSTEPS(C); #if ENABLED(DISTINCT_E_FACTORS) - #define EDIT_ESTEPS(N,E) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_E##N##STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(E)], 5, 9999, _planner_refresh_e##E##_positioning) - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, _planner_refresh_positioning); + #define EDIT_ESTEPS(N,E) MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_E##N##STEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(E)], 5, 9999, _planner_refresh_e##E##_positioning) + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS_N(active_extruder)], 5, 9999, _planner_refresh_positioning); EDIT_ESTEPS(1,0); EDIT_ESTEPS(2,1); #if E_STEPPERS > 2 @@ -594,7 +594,7 @@ void menu_backlash(); #endif // E_STEPPERS > 3 #endif // E_STEPPERS > 2 #elif E_STEPPERS - MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float62, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); + MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float51, MSG_ESTEPS, &planner.settings.axis_steps_per_mm[E_AXIS], 5, 9999, _planner_refresh_positioning); #endif END_MENU(); @@ -604,16 +604,13 @@ void menu_backlash(); #include "../../module/configuration_store.h" - static void lcd_init_eeprom() { - ui.completion_feedback(settings.init_eeprom()); - ui.goto_previous_screen(); - } - static void lcd_init_eeprom_confirm() { - START_MENU(); - MENU_BACK(MSG_ADVANCED_SETTINGS); - MENU_ITEM(function, MSG_INIT_EEPROM, lcd_init_eeprom); - END_MENU(); + do_select_screen( + PSTR(MSG_BUTTON_INIT), PSTR(MSG_BUTTON_CANCEL), + []{ ui.completion_feedback(settings.init_eeprom()); }, + ui.goto_previous_screen, + PSTR(MSG_INIT_EEPROM), NULL, PSTR("?") + ); } #endif diff --git a/Marlin/src/lcd/menu/menu_bed_corners.cpp b/Marlin/src/lcd/menu/menu_bed_corners.cpp index b36d8dd3b1..de24ed5a56 100644 --- a/Marlin/src/lcd/menu/menu_bed_corners.cpp +++ b/Marlin/src/lcd/menu/menu_bed_corners.cpp @@ -50,13 +50,6 @@ static_assert(LEVEL_CORNERS_Z_HOP >= 0, "LEVEL_CORNERS_Z_HOP must be >= 0. Pleas static bool leveling_was_active = false; #endif -static inline void _lcd_level_bed_corners_back() { - #if HAS_LEVELING - set_bed_leveling_enabled(leveling_was_active); - #endif - ui.goto_previous_screen_no_defer(); -} - /** * Level corners, starting in the front-left corner. */ @@ -94,17 +87,23 @@ static inline void _lcd_goto_next_corner() { } static inline void menu_level_bed_corners() { - START_MENU(); - MENU_ITEM(function, - #if ENABLED(LEVEL_CENTER_TOO) - MSG_LEVEL_BED_NEXT_POINT - #else - MSG_NEXT_CORNER - #endif - , _lcd_goto_next_corner + do_select_screen( + PSTR(MSG_BUTTON_NEXT), PSTR(MSG_BUTTON_DONE), + _lcd_goto_next_corner, + []{ + #if HAS_LEVELING + set_bed_leveling_enabled(leveling_was_active); + #endif + ui.goto_previous_screen_no_defer(); + }, + PSTR( + #if ENABLED(LEVEL_CENTER_TOO) + MSG_LEVEL_BED_NEXT_POINT + #else + MSG_NEXT_CORNER + #endif + ), NULL, PSTR("?") ); - MENU_ITEM(function, MSG_BACK, _lcd_level_bed_corners_back); - END_MENU(); } static inline void _lcd_level_bed_corners_homing() { @@ -112,6 +111,7 @@ static inline void _lcd_level_bed_corners_homing() { if (all_axes_homed()) { bed_corner = 0; ui.goto_screen(menu_level_bed_corners); + set_ui_selection(true); _lcd_goto_next_corner(); } } diff --git a/Marlin/src/lcd/menu/menu_game.cpp b/Marlin/src/lcd/menu/menu_game.cpp index 9e0af2c7f0..93a5d9c49a 100644 --- a/Marlin/src/lcd/menu/menu_game.cpp +++ b/Marlin/src/lcd/menu/menu_game.cpp @@ -46,3 +46,4 @@ void menu_game() { } #endif // HAS_GAME_MENU + diff --git a/Marlin/src/lcd/menu/menu_job_recovery.cpp b/Marlin/src/lcd/menu/menu_job_recovery.cpp index 6d584948c4..f819052977 100644 --- a/Marlin/src/lcd/menu/menu_job_recovery.cpp +++ b/Marlin/src/lcd/menu/menu_job_recovery.cpp @@ -44,6 +44,8 @@ static void lcd_power_loss_recovery_cancel() { ui.return_to_status(); } +// TODO: Display long filename with Cancel/Resume buttons +// Requires supporting methods in PLR class. void menu_job_recovery() { ui.defer_status_screen(); START_MENU(); diff --git a/Marlin/src/lcd/menu/menu_main.cpp b/Marlin/src/lcd/menu/menu_main.cpp index 52178b873c..db9c6c867c 100644 --- a/Marlin/src/lcd/menu/menu_main.cpp +++ b/Marlin/src/lcd/menu/menu_main.cpp @@ -101,10 +101,7 @@ } void menu_abort_confirm() { - START_MENU(); - MENU_BACK(MSG_MAIN); - MENU_ITEM(function, MSG_STOP_PRINT, lcd_abort_job); - END_MENU(); + do_select_screen(PSTR(MSG_BUTTON_STOP), PSTR(MSG_BACK), lcd_abort_job, ui.goto_previous_screen, PSTR(MSG_STOP_PRINT), NULL, PSTR("?")); } #endif // MACHINE_CAN_STOP @@ -139,6 +136,16 @@ void menu_led(); #endif #endif +#if HAS_GAME_MENU + void menu_game(); +#elif ENABLED(MARLIN_BRICKOUT) + void lcd_goto_brickout(); +#elif ENABLED(MARLIN_INVADERS) + void lcd_goto_invaders(); +#elif ENABLED(MARLIN_SNAKE) + void lcd_goto_snake(); +#endif + void menu_main() { START_MENU(); MENU_BACK(MSG_WATCH); diff --git a/Marlin/src/lcd/menu/menu_mixer.cpp b/Marlin/src/lcd/menu/menu_mixer.cpp index 8e5b6f4d0f..77124d1146 100644 --- a/Marlin/src/lcd/menu/menu_mixer.cpp +++ b/Marlin/src/lcd/menu/menu_mixer.cpp @@ -250,17 +250,17 @@ void lcd_mixer_mix_edit() { // // Reset All V-Tools // -inline void _lcd_reset_vtools() { - LCD_MESSAGEPGM(MSG_VTOOLS_RESET); - ui.return_to_status(); - mixer.reset_vtools(); -} - void menu_mixer_vtools_reset_confirm() { - START_MENU(); - MENU_BACK(MSG_BACK); - MENU_ITEM(function, MSG_RESET_VTOOLS, _lcd_reset_vtools); - END_MENU(); + do_select_screen( + PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL), + []{ + mixer.reset_vtools(); + LCD_MESSAGEPGM(MSG_VTOOLS_RESET); + ui.return_to_status(); + }, + ui.goto_previous_screen, + PSTR(MSG_RESET_VTOOLS), NULL, PSTR("?") + ); } void menu_mixer() { diff --git a/Marlin/src/lcd/menu/menu_sdcard.cpp b/Marlin/src/lcd/menu/menu_sdcard.cpp index 274643841f..d574dc150e 100644 --- a/Marlin/src/lcd/menu/menu_sdcard.cpp +++ b/Marlin/src/lcd/menu/menu_sdcard.cpp @@ -81,17 +81,12 @@ inline void sdcard_start_selected_file() { #if ENABLED(SD_MENU_CONFIRM_START) - bool do_print_file; void menu_sd_confirm() { - if (ui.should_draw()) - do_select_screen(PSTR(MSG_BUTTON_PRINT), PSTR(MSG_BUTTON_CANCEL), do_print_file, PSTR(MSG_START_PRINT " "), card.longest_filename(), PSTR("?")); - - if (ui.use_click()) { - if (do_print_file) - sdcard_start_selected_file(); - else - ui.goto_previous_screen(); - } + do_select_screen( + PSTR(MSG_BUTTON_PRINT), PSTR(MSG_BUTTON_CANCEL), + sdcard_start_selected_file, ui.goto_previous_screen, + PSTR(MSG_START_PRINT " "), card.longest_filename(), PSTR("?") + ); } #endif @@ -106,7 +101,6 @@ class MenuItem_sdfile { sd_items = screen_items; #endif #if ENABLED(SD_MENU_CONFIRM_START) - do_print_file = false; MenuItem_submenu::action(menu_sd_confirm); #else sdcard_start_selected_file(); diff --git a/Marlin/src/lcd/menu/menu_service.cpp b/Marlin/src/lcd/menu/menu_service.cpp index c88ca6992f..3ab890d7bb 100644 --- a/Marlin/src/lcd/menu/menu_service.cpp +++ b/Marlin/src/lcd/menu/menu_service.cpp @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm @@ -31,52 +31,32 @@ #include "menu.h" #include "../../module/printcounter.h" -inline void _lcd_reset_service(const int index) { - print_job_timer.resetServiceInterval(index); - BUZZ(200, 404); - ui.reset_status(); - ui.return_to_status(); +inline void _menu_service(const int index, PGM_P const name) { + char sram[30]; + strncpy_P(sram, name, 29); + do_select_screen( + PSTR(MSG_BUTTON_RESET), PSTR(MSG_BUTTON_CANCEL), + []{ + print_job_timer.resetServiceInterval(index); + ui.completion_feedback(true); + ui.reset_status(); + ui.return_to_status(); + }, + ui.goto_previous_screen, + PSTR(MSG_SERVICE_RESET), sram, PSTR("?") + ); } #if SERVICE_INTERVAL_1 > 0 - void menu_action_reset_service1() { _lcd_reset_service(1); } + void menu_service1() { _menu_service(1, PSTR(SERVICE_NAME_1)); } #endif #if SERVICE_INTERVAL_2 > 0 - void menu_action_reset_service2() { _lcd_reset_service(2); } + void menu_service2() { _menu_service(2, PSTR(SERVICE_NAME_2)); } #endif #if SERVICE_INTERVAL_3 > 0 - void menu_action_reset_service3() { _lcd_reset_service(3); } -#endif - -inline void _menu_service(const int index) { - START_MENU(); - MENU_BACK(MSG_MAIN); - switch (index) { - #if SERVICE_INTERVAL_1 > 0 - case 1: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service1); break; - #endif - #if SERVICE_INTERVAL_2 > 0 - case 2: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service2); break; - #endif - #if SERVICE_INTERVAL_3 > 0 - case 3: MENU_ITEM(function, MSG_SERVICE_RESET, menu_action_reset_service3); break; - #endif - } - END_MENU(); -} - -#if SERVICE_INTERVAL_1 > 0 - void menu_service1() { _menu_service(1); } -#endif - -#if SERVICE_INTERVAL_2 > 0 - void menu_service2() { _menu_service(2); } -#endif - -#if SERVICE_INTERVAL_3 > 0 - void menu_service3() { _menu_service(3); } + void menu_service3() { _menu_service(3, PSTR(SERVICE_NAME_3)); } #endif #endif // HAS_LCD_MENU && HAS_SERVICE_INTERVALS && PRINTCOUNTER diff --git a/Marlin/src/lcd/menu/menu_tmc.cpp b/Marlin/src/lcd/menu/menu_tmc.cpp index 3d44649599..13634c5894 100644 --- a/Marlin/src/lcd/menu/menu_tmc.cpp +++ b/Marlin/src/lcd/menu/menu_tmc.cpp @@ -32,7 +32,7 @@ #include "../../module/stepper_indirection.h" #include "../../feature/tmc_util.h" -#define TMC_EDIT_STORED_I_RMS(ST) MENU_ITEM_EDIT_CALLBACK(uint16_4, MSG_##ST, &stepper##ST.val_mA, 100, 3000, refresh_stepper_current_##ST) +#define TMC_EDIT_STORED_I_RMS(ST,MSG) MENU_ITEM_EDIT_CALLBACK(uint16_4, MSG, &stepper##ST.val_mA, 100, 3000, refresh_stepper_current_##ST) #if AXIS_IS_TMC(X) void refresh_stepper_current_X() { stepperX.refresh_stepper_current(); } @@ -78,50 +78,50 @@ void menu_tmc_current() { START_MENU(); MENU_BACK(MSG_TMC_DRIVERS); #if AXIS_IS_TMC(X) - TMC_EDIT_STORED_I_RMS(X); + TMC_EDIT_STORED_I_RMS(X, MSG_X); #endif #if AXIS_IS_TMC(Y) - TMC_EDIT_STORED_I_RMS(Y); + TMC_EDIT_STORED_I_RMS(Y, MSG_Y); #endif #if AXIS_IS_TMC(Z) - TMC_EDIT_STORED_I_RMS(Z); + TMC_EDIT_STORED_I_RMS(Z, MSG_Z); #endif #if AXIS_IS_TMC(X2) - TMC_EDIT_STORED_I_RMS(X2); + TMC_EDIT_STORED_I_RMS(X2, MSG_X2); #endif #if AXIS_IS_TMC(Y2) - TMC_EDIT_STORED_I_RMS(Y2); + TMC_EDIT_STORED_I_RMS(Y2, MSG_Y2); #endif #if AXIS_IS_TMC(Z2) - TMC_EDIT_STORED_I_RMS(Z2); + TMC_EDIT_STORED_I_RMS(Z2, MSG_Z2); #endif #if AXIS_IS_TMC(Z3) - TMC_EDIT_STORED_I_RMS(Z3); + TMC_EDIT_STORED_I_RMS(Z3, MSG_Z3); #endif #if AXIS_IS_TMC(E0) - TMC_EDIT_STORED_I_RMS(E0); + TMC_EDIT_STORED_I_RMS(E0, MSG_E1); #endif #if AXIS_IS_TMC(E1) - TMC_EDIT_STORED_I_RMS(E1); + TMC_EDIT_STORED_I_RMS(E1, MSG_E2); #endif #if AXIS_IS_TMC(E2) - TMC_EDIT_STORED_I_RMS(E2); + TMC_EDIT_STORED_I_RMS(E2, MSG_E3); #endif #if AXIS_IS_TMC(E3) - TMC_EDIT_STORED_I_RMS(E3); + TMC_EDIT_STORED_I_RMS(E3, MSG_E4); #endif #if AXIS_IS_TMC(E4) - TMC_EDIT_STORED_I_RMS(E4); + TMC_EDIT_STORED_I_RMS(E4, MSG_E5); #endif #if AXIS_IS_TMC(E5) - TMC_EDIT_STORED_I_RMS(E5); + TMC_EDIT_STORED_I_RMS(E5, MSG_E6); #endif END_MENU(); } #if ENABLED(HYBRID_THRESHOLD) - #define TMC_EDIT_STORED_HYBRID_THRS(ST) MENU_ITEM_EDIT_CALLBACK(uint8, MSG_##ST, &stepper##ST.stored.hybrid_thrs, 0, 255, refresh_hybrid_thrs_##ST); + #define TMC_EDIT_STORED_HYBRID_THRS(ST, MSG) MENU_ITEM_EDIT_CALLBACK(uint8, MSG, &stepper##ST.stored.hybrid_thrs, 0, 255, refresh_hybrid_thrs_##ST); #if AXIS_HAS_STEALTHCHOP(X) void refresh_hybrid_thrs_X() { stepperX.refresh_hybrid_thrs(planner.settings.axis_steps_per_mm[X_AXIS]); } @@ -167,43 +167,43 @@ void menu_tmc_current() { START_MENU(); MENU_BACK(MSG_TMC_DRIVERS); #if AXIS_HAS_STEALTHCHOP(X) - TMC_EDIT_STORED_HYBRID_THRS(X); + TMC_EDIT_STORED_HYBRID_THRS(X, MSG_X); #endif #if AXIS_HAS_STEALTHCHOP(Y) - TMC_EDIT_STORED_HYBRID_THRS(Y); + TMC_EDIT_STORED_HYBRID_THRS(Y, MSG_Y); #endif #if AXIS_HAS_STEALTHCHOP(Z) - TMC_EDIT_STORED_HYBRID_THRS(Z); + TMC_EDIT_STORED_HYBRID_THRS(Z, MSG_Z); #endif #if AXIS_HAS_STEALTHCHOP(X2) - TMC_EDIT_STORED_HYBRID_THRS(X2); + TMC_EDIT_STORED_HYBRID_THRS(X2, MSG_X2); #endif #if AXIS_HAS_STEALTHCHOP(Y2) - TMC_EDIT_STORED_HYBRID_THRS(Y2); + TMC_EDIT_STORED_HYBRID_THRS(Y2, MSG_Y2); #endif #if AXIS_HAS_STEALTHCHOP(Z2) - TMC_EDIT_STORED_HYBRID_THRS(Z2); + TMC_EDIT_STORED_HYBRID_THRS(Z2, MSG_Z2); #endif #if AXIS_HAS_STEALTHCHOP(Z3) - TMC_EDIT_STORED_HYBRID_THRS(Z3); + TMC_EDIT_STORED_HYBRID_THRS(Z3, MSG_Z3); #endif #if AXIS_HAS_STEALTHCHOP(E0) - TMC_EDIT_STORED_HYBRID_THRS(E0); + TMC_EDIT_STORED_HYBRID_THRS(E0, MSG_E1); #endif #if AXIS_HAS_STEALTHCHOP(E1) - TMC_EDIT_STORED_HYBRID_THRS(E1); + TMC_EDIT_STORED_HYBRID_THRS(E1, MSG_E2); #endif #if AXIS_HAS_STEALTHCHOP(E2) - TMC_EDIT_STORED_HYBRID_THRS(E2); + TMC_EDIT_STORED_HYBRID_THRS(E2, MSG_E3); #endif #if AXIS_HAS_STEALTHCHOP(E3) - TMC_EDIT_STORED_HYBRID_THRS(E3); + TMC_EDIT_STORED_HYBRID_THRS(E3, MSG_E4); #endif #if AXIS_HAS_STEALTHCHOP(E4) - TMC_EDIT_STORED_HYBRID_THRS(E4); + TMC_EDIT_STORED_HYBRID_THRS(E4, MSG_E5); #endif #if AXIS_HAS_STEALTHCHOP(E5) - TMC_EDIT_STORED_HYBRID_THRS(E5); + TMC_EDIT_STORED_HYBRID_THRS(E5, MSG_E6); #endif END_MENU(); } @@ -243,7 +243,7 @@ void menu_tmc_current() { #if HAS_STEALTHCHOP - #define TMC_EDIT_STEP_MODE(ST) MENU_ITEM_EDIT_CALLBACK(bool, MSG_##ST, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST) + #define TMC_EDIT_STEP_MODE(ST, MSG) MENU_ITEM_EDIT_CALLBACK(bool, MSG, &stepper##ST.stored.stealthChop_enabled, refresh_stepping_mode_##ST) #if AXIS_HAS_STEALTHCHOP(X) void refresh_stepping_mode_X() { stepperX.refresh_stepping_mode(); } @@ -290,43 +290,43 @@ void menu_tmc_current() { STATIC_ITEM(MSG_TMC_STEALTH_ENABLED); MENU_BACK(MSG_TMC_DRIVERS); #if AXIS_HAS_STEALTHCHOP(X) - TMC_EDIT_STEP_MODE(X); + TMC_EDIT_STEP_MODE(X, MSG_X); #endif #if AXIS_HAS_STEALTHCHOP(Y) - TMC_EDIT_STEP_MODE(Y); + TMC_EDIT_STEP_MODE(Y, MSG_Y); #endif #if AXIS_HAS_STEALTHCHOP(Z) - TMC_EDIT_STEP_MODE(Z); + TMC_EDIT_STEP_MODE(Z, MSG_Z); #endif #if AXIS_HAS_STEALTHCHOP(X2) - TMC_EDIT_STEP_MODE(X2); + TMC_EDIT_STEP_MODE(X2, MSG_X2); #endif #if AXIS_HAS_STEALTHCHOP(Y2) - TMC_EDIT_STEP_MODE(Y2); + TMC_EDIT_STEP_MODE(Y2, MSG_Y2); #endif #if AXIS_HAS_STEALTHCHOP(Z2) - TMC_EDIT_STEP_MODE(Z2); + TMC_EDIT_STEP_MODE(Z2, MSG_Z2); #endif #if AXIS_HAS_STEALTHCHOP(Z3) - TMC_EDIT_STEP_MODE(Z3); + TMC_EDIT_STEP_MODE(Z3, MSG_Z3); #endif #if AXIS_HAS_STEALTHCHOP(E0) - TMC_EDIT_STEP_MODE(E0); + TMC_EDIT_STEP_MODE(E0, MSG_E1); #endif #if AXIS_HAS_STEALTHCHOP(E1) - TMC_EDIT_STEP_MODE(E1); + TMC_EDIT_STEP_MODE(E1, MSG_E2); #endif #if AXIS_HAS_STEALTHCHOP(E2) - TMC_EDIT_STEP_MODE(E2); + TMC_EDIT_STEP_MODE(E2, MSG_E3); #endif #if AXIS_HAS_STEALTHCHOP(E3) - TMC_EDIT_STEP_MODE(E3); + TMC_EDIT_STEP_MODE(E3, MSG_E4); #endif #if AXIS_HAS_STEALTHCHOP(E4) - TMC_EDIT_STEP_MODE(E4); + TMC_EDIT_STEP_MODE(E4, MSG_E5); #endif #if AXIS_HAS_STEALTHCHOP(E5) - TMC_EDIT_STEP_MODE(E5); + TMC_EDIT_STEP_MODE(E5, MSG_E6); #endif END_MENU(); } diff --git a/Marlin/src/lcd/menu/menu_ubl.cpp b/Marlin/src/lcd/menu/menu_ubl.cpp index 9b7a5b5fa6..8b182b89b9 100644 --- a/Marlin/src/lcd/menu/menu_ubl.cpp +++ b/Marlin/src/lcd/menu/menu_ubl.cpp @@ -615,8 +615,10 @@ void _lcd_ubl_step_by_step() { void _lcd_ubl_level_bed() { START_MENU(); MENU_BACK(MSG_MOTION); - MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); - MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); + if (planner.leveling_active) + MENU_ITEM(gcode, MSG_UBL_DEACTIVATE_MESH, PSTR("G29 D")); + else + MENU_ITEM(gcode, MSG_UBL_ACTIVATE_MESH, PSTR("G29 A")); MENU_ITEM(submenu, MSG_UBL_STEP_BY_STEP_MENU, _lcd_ubl_step_by_step); MENU_ITEM(function, MSG_UBL_MESH_EDIT, _lcd_ubl_output_map_lcd_cmd); MENU_ITEM(submenu, MSG_UBL_STORAGE_MESH_MENU, _lcd_ubl_storage_mesh); diff --git a/Marlin/src/lcd/ultralcd.cpp b/Marlin/src/lcd/ultralcd.cpp index cb8b308df3..f7381c1d14 100644 --- a/Marlin/src/lcd/ultralcd.cpp +++ b/Marlin/src/lcd/ultralcd.cpp @@ -25,6 +25,7 @@ // These displays all share the MarlinUI class #if HAS_SPI_LCD || EITHER(MALYAN_LCD, EXTENSIBLE_UI) #include "ultralcd.h" + #include "fontutils.h" MarlinUI ui; #include "../sd/cardreader.h" #if ENABLED(EXTENSIBLE_UI) @@ -192,24 +193,39 @@ millis_t next_button_update_ms; #endif - void wrap_string(uint8_t y, const char * const string) { - uint8_t x = LCD_WIDTH; + void _wrap_string(uint8_t &x, uint8_t &y, const char * const string, read_byte_cb_t cb_read_byte) { + SETCURSOR(x, y); if (string) { uint8_t *p = (uint8_t*)string; for (;;) { - if (x >= LCD_WIDTH) { - x = 0; - SETCURSOR(0, y++); - } wchar_t ch; - p = get_utf8_value_cb(p, read_byte_ram, &ch); + p = get_utf8_value_cb(p, cb_read_byte, &ch); if (!ch) break; lcd_put_wchar(ch); x++; + if (x >= LCD_WIDTH) { + x = 0; y++; + SETCURSOR(0, y); + } } } } + void MarlinUI::draw_select_screen_prompt(PGM_P const pref, const char * const string/*=NULL*/, PGM_P const suff/*=NULL*/) { + const uint8_t plen = utf8_strlen_P(pref), slen = suff ? utf8_strlen_P(suff) : 0; + uint8_t x = 0, y = 0; + if (!string && plen + slen <= LCD_WIDTH) { + x = (LCD_WIDTH - plen - slen) / 2; + y = LCD_HEIGHT > 3 ? 1 : 0; + } + wrap_string_P(x, y, pref); + if (string) { + if (x) { x = 0; y++; } // Move to the start of the next line + wrap_string(x, y, string); + } + if (suff) wrap_string_P(x, y, suff); + } + #endif // HAS_LCD_MENU void MarlinUI::init() { @@ -668,6 +684,7 @@ void MarlinUI::update() { static uint16_t max_display_update_time = 0; static millis_t next_lcd_update_ms; + millis_t ms = millis(); #if HAS_LCD_MENU @@ -729,11 +746,12 @@ void MarlinUI::update() { refresh(); init_lcd(); // May revive the LCD if static electricity killed it + ms = millis(); + next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL; // delay LCD update until after SD activity completes } #endif // SDSUPPORT && SD_DETECT_PIN - const millis_t ms = millis(); if (ELAPSED(ms, next_lcd_update_ms) #if HAS_GRAPHICAL_LCD || drawing_screen diff --git a/Marlin/src/lcd/ultralcd.h b/Marlin/src/lcd/ultralcd.h index be694ddfe4..2ea7f45279 100644 --- a/Marlin/src/lcd/ultralcd.h +++ b/Marlin/src/lcd/ultralcd.h @@ -72,7 +72,11 @@ #define LCDWRITE(c) lcd_put_wchar(c) #endif - void wrap_string(uint8_t y, const char * const string); + #include "fontutils.h" + + void _wrap_string(uint8_t &x, uint8_t &y, const char * const string, read_byte_cb_t cb_read_byte); + inline void wrap_string_P(uint8_t &x, uint8_t &y, PGM_P const pstr) { _wrap_string(x, y, pstr, read_byte_rom); } + inline void wrap_string(uint8_t &x, uint8_t &y, const char * const string) { _wrap_string(x, y, string, read_byte_ram); } #if ENABLED(SDSUPPORT) #include "../sd/cardreader.h" @@ -457,6 +461,8 @@ public: static void ubl_plot(const uint8_t x, const uint8_t inverted_y); #endif + static void draw_select_screen_prompt(PGM_P const pref, const char * const string=NULL, PGM_P const suff=NULL); + #elif HAS_SPI_LCD static constexpr bool lcd_clicked = false; diff --git a/Marlin/src/libs/bresenham.h b/Marlin/src/libs/bresenham.h index 139c3ba801..0cd8850022 100644 --- a/Marlin/src/libs/bresenham.h +++ b/Marlin/src/libs/bresenham.h @@ -1,6 +1,6 @@ /** * Marlin 3D Printer Firmware - * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] * * Based on Sprinter and grbl. * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 0552f555a5..a766d91b6e 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -64,6 +64,10 @@ #include "../feature/bedlevel/bedlevel.h" #endif +#if ENABLED(EXTENSIBLE_UI) + #include "../lcd/extensible_ui/ui_api.h" +#endif + #if HAS_SERVOS #include "servo.h" #endif @@ -1120,6 +1124,10 @@ void MarlinSettings::postprocess() { store_mesh(ubl.storage_slot); #endif + #if ENABLED(EXTENSIBLE_UI) + if (!eeprom_error) ExtUI::onStoreSettings(); + #endif + return !eeprom_error; } @@ -1874,7 +1882,13 @@ void MarlinSettings::postprocess() { } bool MarlinSettings::load() { - if (validate()) return _load(); + if (validate()) { + const bool success = _load(); + #if ENABLED(EXTENSIBLE_UI) + if (success) ExtUI::onLoadSettings(); + #endif + return success; + } reset(); return true; } @@ -2290,6 +2304,10 @@ void MarlinSettings::reset() { DEBUG_ECHO_START(); DEBUG_ECHOLNPGM("Hardcoded Default Settings Loaded"); + + #if ENABLED(EXTENSIBLE_UI) + ExtUI::onFactoryReset(); + #endif } #if DISABLED(DISABLE_M503) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index f32b5ae4d0..8988b15bea 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -310,24 +310,35 @@ inline void do_probe_raise(const float z_raise) { FORCE_INLINE void probe_specific_action(const bool deploy) { #if ENABLED(PAUSE_BEFORE_DEPLOY_STOW) + do { + #if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED) + if (deploy == (READ(Z_MIN_PROBE_PIN) == Z_MIN_PROBE_ENDSTOP_INVERTING)) break; + #endif - BUZZ(100, 659); - BUZZ(100, 698); + BUZZ(100, 659); + BUZZ(100, 698); - PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW); - ui.return_to_status(); // To display the new status message - ui.set_status_P(ds_str, 99); - serialprintPGM(ds_str); - SERIAL_EOL(); + PGM_P const ds_str = deploy ? PSTR(MSG_MANUAL_DEPLOY) : PSTR(MSG_MANUAL_STOW); + ui.return_to_status(); // To display the new status message + ui.set_status_P(ds_str, 99); + serialprintPGM(ds_str); + SERIAL_EOL(); - KEEPALIVE_STATE(PAUSED_FOR_USER); - wait_for_user = true; - #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), PSTR("Continue")); - #endif - while (wait_for_user) idle(); - ui.reset_status(); - KEEPALIVE_STATE(IN_HANDLER); + KEEPALIVE_STATE(PAUSED_FOR_USER); + wait_for_user = true; + #if ENABLED(HOST_PROMPT_SUPPORT) + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), PSTR("Continue")); + #endif + while (wait_for_user) idle(); + ui.reset_status(); + KEEPALIVE_STATE(IN_HANDLER); + } while( + #if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED) + true + #else + false + #endif + ); #endif // PAUSE_BEFORE_DEPLOY_STOW diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index d8bf25747e..25a45661aa 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -86,17 +86,17 @@ Temperature thermalManager; */ #if HAS_HEATED_BED - #define _BED_PSTR(E) (E) == -1 ? PSTR(MSG ## _BED) : + #define _BED_PSTR(M,E) (E) == -1 ? PSTR(M) : #else - #define _BED_PSTR(E) + #define _BED_PSTR(M,E) #endif #if HAS_HEATED_CHAMBER - #define _CHAMBER_PSTR(E) (E) == -2 ? PSTR(MSG ## _CHAMBER) : + #define _CHAMBER_PSTR(M,E) (E) == -2 ? PSTR(M) : #else - #define _CHAMBER_PSTR(E) + #define _CHAMBER_PSTR(M,E) #endif -#define _E_PSTR(M,E,N) (HOTENDS >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) : -#define TEMP_ERR_PSTR(M,E) _BED_PSTR(E) _CHAMBER_PSTR(E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M) +#define _E_PSTR(M,E,N) ((HOTENDS) >= (N) && (E) == (N)-1) ? PSTR(MSG_E##N " " M) : +#define TEMP_ERR_PSTR(M,E) _BED_PSTR(M##_BED,E) _CHAMBER_PSTR(M##_CHAMBER,E) _E_PSTR(M,E,2) _E_PSTR(M,E,3) _E_PSTR(M,E,4) _E_PSTR(M,E,5) _E_PSTR(M,E,6) PSTR(MSG_E1 " " M) // public: @@ -595,10 +595,23 @@ temp_range_t Temperature::temp_range[HOTENDS] = ARRAY_BY_HOTENDS(sensor_heater_0 Temperature::Temperature() { } -int Temperature::getHeaterPower(const int heater) { +int16_t Temperature::getHeaterPower(const int8_t heater) { return ( + #if HAS_HEATED_CHAMBER + #if HAS_HEATED_BED + heater == -2 + #else + heater < 0 + #endif + ? temp_chamber.soft_pwm_amount : + #endif #if HAS_HEATED_BED - heater < 0 ? temp_bed.soft_pwm_amount : + #if HAS_HEATED_CHAMBER + heater == -1 + #else + heater < 0 + #endif + ? temp_bed.soft_pwm_amount : #endif temp_hotend[heater].soft_pwm_amount ); @@ -931,11 +944,29 @@ void Temperature::manage_heater() { if (temp_hotend[1].current < MAX(HEATER_1_MINTEMP, HEATER_1_MAX6675_TMIN + .01)) min_temp_error(1); #endif - #if WATCH_HOTENDS || WATCH_BED || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER || WATCH_CHAMBER + #define HAS_THERMAL_PROTECTION (ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER)) + + #if HAS_THERMAL_PROTECTION || DISABLED(PIDTEMPBED) || HAS_AUTO_FAN || HEATER_IDLE_HANDLER millis_t ms = millis(); #endif + #if HAS_THERMAL_PROTECTION + #ifndef THERMAL_PROTECTION_GRACE_PERIOD + #define THERMAL_PROTECTION_GRACE_PERIOD 0 // No grace period needed on well-behaved boards + #endif + #if THERMAL_PROTECTION_GRACE_PERIOD > 0 + static millis_t grace_period = ms + THERMAL_PROTECTION_GRACE_PERIOD; + if (ELAPSED(ms, grace_period)) grace_period = 0UL; + #else + static constexpr millis_t grace_period = 0UL; + #endif + #endif + HOTEND_LOOP() { + #if ENABLED(THERMAL_PROTECTION_HOTENDS) + if (!grace_period && degHotend(e) > temp_range[e].maxtemp) + _temp_error(e, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, e)); + #endif #if HEATER_IDLE_HANDLER hotend_idle[e].update(ms); @@ -988,6 +1019,11 @@ void Temperature::manage_heater() { #if HAS_HEATED_BED + #if ENABLED(THERMAL_PROTECTION_BED) + if (!grace_period && degBed() > BED_MAXTEMP) + _temp_error(-1, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -1)); + #endif + #if WATCH_BED // Make sure temperature is increasing if (watch_bed.elapsed(ms)) { // Time to check the bed? @@ -1058,6 +1094,11 @@ void Temperature::manage_heater() { #if HAS_HEATED_CHAMBER + #if ENABLED(THERMAL_PROTECTION_CHAMBER) + if (!grace_period && degChamber() > CHAMBER_MAXTEMP) + _temp_error(-2, PSTR(MSG_T_THERMAL_RUNAWAY), TEMP_ERR_PSTR(MSG_THERMAL_RUNAWAY, -2)); + #endif + #if WATCH_CHAMBER // Make sure temperature is increasing if (watch_chamber.elapsed(ms)) { // Time to check the chamber? @@ -1073,11 +1114,11 @@ void Temperature::manage_heater() { if (WITHIN(temp_chamber.current, CHAMBER_MINTEMP, CHAMBER_MAXTEMP)) { #if ENABLED(CHAMBER_LIMIT_SWITCHING) - if (temp_chamber.current >= temp_chamber.target + CHAMBER_HYSTERESIS) + if (temp_chamber.current >= temp_chamber.target + TEMP_CHAMBER_HYSTERESIS) temp_chamber.soft_pwm_amount = 0; - else if (temp_chamber.current <= temp_chamber.target - (CHAMBER_HYSTERESIS)) + else if (temp_chamber.current <= temp_chamber.target - (TEMP_CHAMBER_HYSTERESIS)) temp_chamber.soft_pwm_amount = MAX_CHAMBER_POWER >> 1; - #else // !PIDTEMPCHAMBER && !CHAMBER_LIMIT_SWITCHING + #else temp_chamber.soft_pwm_amount = temp_chamber.current < temp_chamber.target ? MAX_CHAMBER_POWER >> 1 : 0; #endif } @@ -1589,7 +1630,7 @@ void Temperature::init() { } #endif -#if ENABLED(THERMAL_PROTECTION_HOTENDS) || HAS_THERMALLY_PROTECTED_BED || ENABLED(THERMAL_PROTECTION_CHAMBER) +#if HAS_THERMAL_PROTECTION #if ENABLED(THERMAL_PROTECTION_HOTENDS) Temperature::tr_state_machine_t Temperature::tr_state_machine[HOTENDS]; // = { { TRInactive, 0 } }; @@ -1606,17 +1647,17 @@ void Temperature::init() { static float tr_target_temperature[HOTENDS + 1] = { 0.0 }; /** - SERIAL_ECHO_START(); - SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: "); - if (heater_id == -2) 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(); - */ + SERIAL_ECHO_START(); + SERIAL_ECHOPGM("Thermal Thermal Runaway Running. Heater ID: "); + if (heater_id == -2) 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(); + //*/ const int heater_index = heater_id >= 0 ? heater_id : HOTENDS; @@ -2017,11 +2058,7 @@ void Temperature::readings_ready() { #else #define CHAMBERCMP(A,B) ((A)>=(B)) #endif - const bool chamber_on = (temp_chamber.target > 0) - #if ENABLED(PIDTEMPCHAMBER) - || (temp_chamber.soft_pwm_amount > 0) - #endif - ; + const bool chamber_on = (temp_chamber.target > 0); if (CHAMBERCMP(temp_chamber.raw, maxtemp_raw_CHAMBER)) max_temp_error(-2); if (chamber_on && CHAMBERCMP(mintemp_raw_CHAMBER, temp_chamber.raw)) min_temp_error(-2); #endif @@ -2602,11 +2639,12 @@ void Temperature::isr() { , e ); #endif - SERIAL_ECHOPGM(" @:"); - SERIAL_ECHO(getHeaterPower(target_extruder)); + SERIAL_ECHOPAIR(" @:", getHeaterPower(target_extruder)); #if HAS_HEATED_BED - SERIAL_ECHOPGM(" B@:"); - SERIAL_ECHO(getHeaterPower(-1)); + SERIAL_ECHOPAIR(" B@:", getHeaterPower(-1)); + #endif + #if HAS_HEATED_CHAMBER + SERIAL_ECHOPAIR(" C@:", getHeaterPower(-2)); #endif #if HOTENDS > 1 HOTEND_LOOP() { @@ -2637,7 +2675,7 @@ void Temperature::isr() { void Temperature::set_heating_message(const uint8_t e) { const bool heating = isHeatingHotend(e); #if HOTENDS > 1 - ui.status_printf_P(0, heating ? PSTR("E%i " MSG_HEATING) : PSTR("E%i " MSG_COOLING), int(e + 1)); + ui.status_printf_P(0, heating ? PSTR("E%c " MSG_HEATING) : PSTR("E%c " MSG_COOLING), '1' + e); #else ui.set_status_P(heating ? PSTR("E " MSG_HEATING) : PSTR("E " MSG_COOLING)); #endif diff --git a/Marlin/src/module/temperature.h b/Marlin/src/module/temperature.h index a8cfad34b3..b24f84fb58 100644 --- a/Marlin/src/module/temperature.h +++ b/Marlin/src/module/temperature.h @@ -206,16 +206,10 @@ struct PIDHeaterInfo : public HeaterInfo { typedef heater_info_t bed_info_t; #endif #endif -#if HAS_TEMP_CHAMBER - #if HAS_HEATED_CHAMBER - #if ENABLED(PIDTEMPCHAMBER) - typedef struct PIDHeaterInfo chamber_info_t; - #else - typedef heater_info_t chamber_info_t; - #endif - #else - typedef temp_info_t chamber_info_t; - #endif +#if HAS_HEATED_CHAMBER + typedef heater_info_t chamber_info_t; +#elif HAS_TEMP_CHAMBER + typedef temp_info_t chamber_info_t; #endif // Heater idle handling @@ -339,9 +333,7 @@ class Temperature { #if WATCH_CHAMBER static heater_watch_t watch_chamber; #endif - #if DISABLED(PIDTEMPCHAMBER) - static millis_t next_chamber_check_ms; - #endif + static millis_t next_chamber_check_ms; #ifdef CHAMBER_MINTEMP static int16_t mintemp_raw_CHAMBER; #endif @@ -653,7 +645,7 @@ class Temperature { /** * The software PWM power for a heater */ - static int getHeaterPower(const int heater); + static int16_t getHeaterPower(const int8_t heater); /** * Switch off all heaters, set all target temperatures to 0 diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 9108a23ab4..3b97cb60c1 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -280,47 +280,37 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { grabpos = parkingposx[tmp_extruder] + (tmp_extruder ? PARKING_EXTRUDER_GRAB_DISTANCE : -(PARKING_EXTRUDER_GRAB_DISTANCE)) + x_offset; /** - * 1. Raise Z-Axis to give enough clearance - * 2. Move to park position of old extruder - * 3. Disengage magnetic field, wait for delay - * 4. Move near new extruder - * 5. Engage magnetic field for new extruder - * 6. Move to parking incl. offset of new extruder - * 7. Lower Z-Axis + * 1. Move to park position of old extruder + * 2. Disengage magnetic field, wait for delay + * 3. Move near new extruder + * 4. Engage magnetic field for new extruder + * 5. Move to parking incl. offset of new extruder + * 6. Lower Z-Axis */ // STEP 1 if (DEBUGGING(LEVELING)) DEBUG_POS("Start Autopark", current_position); - current_position[Z_AXIS] += toolchange_settings.z_raise; - - if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); - - fast_line_to_current(Z_AXIS); - planner.synchronize(); - - // STEP 2 - current_position[X_AXIS] = parkingposx[active_extruder] + x_offset; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLNPAIR("(2) Park extruder ", int(active_extruder)); + DEBUG_ECHOLNPAIR("(1) Park extruder ", int(active_extruder)); DEBUG_POS("Moving ParkPos", current_position); } fast_line_to_current(X_AXIS); planner.synchronize(); - // STEP 3 + // STEP 2 - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Disengage magnet "); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Disengage magnet "); pe_deactivate_solenoid(active_extruder); - // STEP 4 + // STEP 3 - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Move to position near new extruder"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Move to position near new extruder"); current_position[X_AXIS] += active_extruder ? -10 : 10; // move 10mm away from parked extruder @@ -329,8 +319,8 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { fast_line_to_current(X_AXIS); planner.synchronize(); - // STEP 5 - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(5) Engage magnetic field"); + // STEP 4 + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Engage magnetic field"); #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT) pe_activate_solenoid(active_extruder); //just save power for inverted magnets @@ -338,16 +328,16 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { pe_activate_solenoid(tmp_extruder); - // STEP 6 + // STEP 5 current_position[X_AXIS] = grabpos + (tmp_extruder ? -10 : 10); fast_line_to_current(X_AXIS); current_position[X_AXIS] = grabpos; - if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Unpark extruder", current_position); + if (DEBUGGING(LEVELING)) DEBUG_POS("(5) Unpark extruder", current_position); planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS] * 0.5, active_extruder); planner.synchronize(); - // STEP 7 + // STEP 6 current_position[X_AXIS] = midpos #if HAS_HOTEND_OFFSET @@ -355,7 +345,7 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { #endif ; - if (DEBUGGING(LEVELING)) DEBUG_POS("(7) Move midway between hotends", current_position); + if (DEBUGGING(LEVELING)) DEBUG_POS("(6) Move midway between hotends", current_position); fast_line_to_current(X_AXIS); planner.synchronize(); @@ -385,30 +375,20 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { grabxpos = toolheadposx[tmp_extruder]; /** - * 1. Raise Z to give enough clearance - * 2. Move to switch position of current toolhead - * 3. Unlock tool and drop it in the dock - * 4. Move to the new toolhead - * 5. Grab and lock the new toolhead + * 1. Move to switch position of current toolhead + * 2. Unlock tool and drop it in the dock + * 3. Move to the new toolhead + * 4. Grab and lock the new toolhead */ - // 1. Raise Z to give enough clearance + // 1. Move to switch position of current toolhead if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); - current_position[Z_AXIS] += toolchange_settings.z_raise; - - if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); - - fast_line_to_current(Z_AXIS); - planner.synchronize(); - - // 2. Move to switch position of current toolhead - current_position[X_AXIS] = placexpos; if (DEBUGGING(LEVELING)) { - DEBUG_ECHOLNPAIR("(2) Place old tool ", int(active_extruder)); + DEBUG_ECHOLNPAIR("(1) Place old tool ", int(active_extruder)); DEBUG_POS("Move X SwitchPos", current_position); } @@ -422,9 +402,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { fast_line_to_current(Y_AXIS); planner.synchronize(); - // 3. Unlock tool and drop it in the dock + // 2. Unlock tool and drop it in the dock - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Unlock and Place Toolhead"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(2) Unlock and Place Toolhead"); MOVE_SERVO(SWITCHING_TOOLHEAD_SERVO_NR, angles[1]); safe_delay(500); @@ -443,9 +423,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { fast_line_to_current(Y_AXIS); // move away from docked toolhead planner.synchronize(); - // 4. Move to the new toolhead + // 3. Move to the new toolhead - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Move to new toolhead position"); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(3) Move to new toolhead position"); current_position[X_AXIS] = grabxpos; @@ -460,9 +440,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { fast_line_to_current(Y_AXIS); planner.synchronize(); - // 5. Grab and lock the new toolhead + // 4. Grab and lock the new toolhead - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(5) Grab and lock new toolhead "); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("(4) Grab and lock new toolhead "); current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS; @@ -497,30 +477,20 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { grabxpos = toolheadposx[tmp_extruder]; /** - * 1. Raise Z to give enough clearance - * 2. Move to switch position of current toolhead - * 3. Release and place toolhead in the dock - * 4. Move to the new toolhead - * 5. Grab the new toolhead and move to security position + * 1. Move to switch position of current toolhead + * 2. Release and place toolhead in the dock + * 3. Move to the new toolhead + * 4. Grab the new toolhead and move to security position */ if (DEBUGGING(LEVELING)) DEBUG_POS("Starting Toolhead change", current_position); - // 1. Raise Z to give enough clearance - - current_position[Z_AXIS] += toolchange_settings.z_raise; - - if (DEBUGGING(LEVELING)) DEBUG_POS("(1) Raise Z-Axis", current_position); - - planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[Z_AXIS], active_extruder); - planner.synchronize(); - - // 2. Move to switch position current toolhead + // 1. Move to switch position current toolhead current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_CLEAR; if (DEBUGGING(LEVELING)) { - SERIAL_ECHOLNPAIR("(2) Place old tool ", int(active_extruder)); + SERIAL_ECHOLNPAIR("(1) Place old tool ", int(active_extruder)); DEBUG_POS("Move Y SwitchPos + Security", current_position); } @@ -548,9 +518,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[X_AXIS] * 0.25), active_extruder); planner.synchronize(); - // 3. Release and place toolhead in the dock + // 2. Release and place toolhead in the dock - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Release and Place Toolhead"); + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(2) Release and Place Toolhead"); current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; @@ -566,9 +536,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { planner.buffer_line(current_position, (planner.settings.max_feedrate_mm_s[Y_AXIS]), active_extruder); planner.synchronize(); - // 4. Move to new toolhead position + // 3. Move to new toolhead position - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Move to new toolhead position"); + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(3) Move to new toolhead position"); current_position[X_AXIS] = grabxpos; @@ -577,9 +547,9 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { planner.buffer_line(current_position, planner.settings.max_feedrate_mm_s[X_AXIS], active_extruder); planner.synchronize(); - // 5. Grab the new toolhead and move to security position + // 4. Grab the new toolhead and move to security position - if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(5) Grab new toolhead and move to security position"); + if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("(4) Grab new toolhead and move to security position"); current_position[Y_AXIS] = SWITCHING_TOOLHEAD_Y_POS + SWITCHING_TOOLHEAD_Y_RELEASE; @@ -732,7 +702,11 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n if (tmp_extruder >= EXTRUDERS) return invalid_extruder_error(tmp_extruder); - if (!no_move && !all_axes_homed()) { + if (!no_move && (!all_axes_homed() + #if ENABLED(DUAL_X_CARRIAGE) + || dual_x_carriage_mode == DXC_FULL_CONTROL_MODE + #endif + )) { no_move = true; if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("No move on toolchange"); } @@ -785,14 +759,15 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n if (!no_move) { #if DISABLED(SWITCHING_NOZZLE) // Do a small lift to avoid the workpiece in the move back (below) - #if ENABLED(TOOLCHANGE_PARK) - current_position[X_AXIS] = toolchange_settings.change_point.x; - current_position[Y_AXIS] = toolchange_settings.change_point.y; - #endif current_position[Z_AXIS] += toolchange_settings.z_raise; #if HAS_SOFTWARE_ENDSTOPS NOMORE(current_position[Z_AXIS], soft_endstop[Z_AXIS].max); #endif + fast_line_to_current(Z_AXIS); + #if ENABLED(TOOLCHANGE_PARK) + current_position[X_AXIS] = toolchange_settings.change_point.x; + current_position[Y_AXIS] = toolchange_settings.change_point.y; + #endif planner.buffer_line(current_position, feedrate_mm_s, active_extruder); #endif planner.synchronize(); @@ -875,10 +850,10 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) if (should_swap && !too_cold) { #if ENABLED(ADVANCED_PAUSE_FEATURE) - do_pause_e_move(toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME, toolchange_settings.prime_speed); + do_pause_e_move(toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME, MMM_TO_MMS(toolchange_settings.prime_speed)); #else current_position[E_AXIS] += (toolchange_settings.swap_length + TOOLCHANGE_FIL_EXTRA_PRIME) / planner.e_factor[tmp_extruder]; - planner.buffer_line(current_position, toolchange_settings.prime_speed, tmp_extruder); + planner.buffer_line(current_position, MMM_TO_MMS(toolchange_settings.prime_speed), tmp_extruder); #endif planner.synchronize(); diff --git a/Marlin/src/pins/pins.h b/Marlin/src/pins/pins.h index 68de292c0c..bb7a10108e 100644 --- a/Marlin/src/pins/pins.h +++ b/Marlin/src/pins/pins.h @@ -316,6 +316,8 @@ #include "pins_RAMPS_RE_ARM.h" // LPC1768 env:LPC1768 #elif MB(MKS_SBASE) #include "pins_MKS_SBASE.h" // LPC1768 env:LPC1768 +#elif MB(MKS_SGEN) + #include "pins_MKS_SGEN.h" // LPC1769 env:LPC1769 #elif MB(AZSMZ_MINI) #include "pins_AZSMZ_MINI.h" // LPC1768 env:LPC1768 #elif MB(AZTEEG_X5_GT) diff --git a/Marlin/src/pins/pins_AZTEEG_X5_MINI.h b/Marlin/src/pins/pins_AZTEEG_X5_MINI.h index 91349c0f6e..f3ce5b4179 100644 --- a/Marlin/src/pins/pins_AZTEEG_X5_MINI.h +++ b/Marlin/src/pins/pins_AZTEEG_X5_MINI.h @@ -185,13 +185,9 @@ // // SD Support // -//#define USB_SD_DISABLED // Disable host access to SD card as mass storage device through USB -//#define USB_SD_ONBOARD // Enable host access to SD card as mass storage device through USB - -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board. There is no SD detect pin - // for the onboard card. Init card from LCD menu or send M21 whenever printer - // is powered on to enable SD access. +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #define LPC_SD_ONBOARD +#endif #if ENABLED(LPC_SD_LCD) diff --git a/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h b/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h index 2efb410b46..1a36c269a3 100644 --- a/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h +++ b/Marlin/src/pins/pins_BIGTREE_SKR_V1.3.h @@ -177,46 +177,97 @@ | EXP2 EXP1 */ #if ENABLED(ULTRA_LCD) - #define BEEPER_PIN P1_30 // (37) not 5V tolerant - #define BTN_ENC P0_28 // (58) open-drain + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #define BTN_ENC P0_28 // (58) open-drain #if ENABLED(CR10_STOCKDISPLAY) - #define LCD_PINS_RS P1_22 + #define LCD_PINS_RS P1_22 - #define BTN_EN1 P1_18 - #define BTN_EN2 P1_20 + #define BTN_EN1 P1_18 + #define BTN_EN2 P1_20 #define LCD_PINS_ENABLE P1_23 - #define LCD_PINS_D4 P1_21 + #define LCD_PINS_D4 P1_21 #else + #define LCD_PINS_RS P1_19 - #define LCD_PINS_RS P1_19 - - #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 - #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant) - - #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 + #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 #define LCD_PINS_ENABLE P1_18 - #define LCD_PINS_D4 P1_20 + #define LCD_PINS_D4 P1_20 - #if ENABLED(ULTIPANEL) - #define LCD_PINS_D5 P1_21 - #define LCD_PINS_D6 P1_22 - #define LCD_PINS_D7 P1_23 - #endif + #define LCD_SDSS P0_16 // (16) J3-7 & AUX-4 + #define SD_DETECT_PIN P1_31 // (49) (NOT 5V tolerant) + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS P1_18 + #define DOGLCD_A0 P1_19 + + #define LCD_BACKLIGHT_PIN -1 + + #define LCD_RESET_PIN P1_20 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #define RGB_LED + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN P1_21 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN P1_22 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN P1_23 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN P1_21 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + #define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + + #else // !FYSETC_MINI_12864 + + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS P1_21 + #define DOGLCD_A0 P1_22 + #endif + + #if ENABLED(ULTIPANEL) + #define LCD_PINS_D5 P1_21 + #define LCD_PINS_D6 P1_22 + #define LCD_PINS_D7 P1_23 + #endif + + #endif // !FYSETC_MINI_12864 #endif #endif // ULTRA_LCD -//#define USB_SD_DISABLED -#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device +// +// SD Support +// -#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -//#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #define LPC_SD_LCD +#endif #if ENABLED(LPC_SD_LCD) diff --git a/Marlin/src/pins/pins_BIQU_SKR_V1.1.h b/Marlin/src/pins/pins_BIQU_SKR_V1.1.h index 91e76d1b91..17af3c4d04 100644 --- a/Marlin/src/pins/pins_BIQU_SKR_V1.1.h +++ b/Marlin/src/pins/pins_BIQU_SKR_V1.1.h @@ -105,18 +105,29 @@ #define LCD_PINS_RS P0_16 #define LCD_PINS_ENABLE P0_18 #define LCD_PINS_D4 P0_15 + + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS P2_06 + #define DOGLCD_A0 P0_16 + #endif #endif // // SD Support // -//#define USB_SD_DISABLED // Disable host access to SD card as mass storage device through USB -#define USB_SD_ONBOARD // Enable host access to SD card as mass storage device through USB - -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board. There is no SD detect pin - // for the onboard card. Init card from LCD menu or send M21 whenever printer - // is powered on to enable SD access. +// MKS_MINI_12864 strongly prefers the SD card on the display and +// requires jumpers on the SKR V1.1 board as documented here: +// https://www.facebook.com/groups/505736576548648/permalink/630639874058317/ +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #if ENABLED(MKS_MINI_12864) + #define LPC_SD_LCD + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #else + #define USB_SD_ONBOARD + #define LPC_SD_ONBOARD + #endif +#endif #if ENABLED(LPC_SD_LCD) diff --git a/Marlin/src/pins/pins_ESP32.h b/Marlin/src/pins/pins_ESP32.h index 343f3841a6..9901dde200 100644 --- a/Marlin/src/pins/pins_ESP32.h +++ b/Marlin/src/pins/pins_ESP32.h @@ -72,3 +72,6 @@ #define HEATER_0_PIN 2 #define FAN_PIN 13 #define HEATER_BED_PIN 4 + +// SPI +#define SDSS 5 diff --git a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h index 5944be04af..10a517aec4 100644 --- a/Marlin/src/pins/pins_FORMBOT_RAPTOR.h +++ b/Marlin/src/pins/pins_FORMBOT_RAPTOR.h @@ -181,16 +181,16 @@ // Formbot only supports REPRAP_DISCOUNT_SMART_CONTROLLER // #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) - #define LCD_PINS_RS 16 - #define LCD_PINS_ENABLE 17 - #define LCD_PINS_D4 23 - #define LCD_PINS_D5 25 - #define LCD_PINS_D6 27 - #define LCD_PINS_D7 29 #define BEEPER_PIN 37 #define BTN_EN1 31 #define BTN_EN2 33 #define BTN_ENC 35 #define SD_DETECT_PIN 49 #define KILL_PIN 41 + #define LCD_PINS_RS 16 + #define LCD_PINS_ENABLE 17 + #define LCD_PINS_D4 23 + #define LCD_PINS_D5 25 + #define LCD_PINS_D6 27 + #define LCD_PINS_D7 29 #endif diff --git a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h index 5970123e1f..16649e42b5 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX2PLUS.h @@ -155,9 +155,8 @@ // // Misc. Functions // -#define CASE_LIGHT_PIN 8 #define SDSS 53 -#ifndef ROXYs_TRex +#ifndef LED_PIN #define LED_PIN 13 // The Formbot v 1 board has almost no unassigned pins on it. The Board's LED #endif // is a good place to get a signal to control the Max7219 LED Matrix. @@ -168,24 +167,28 @@ #define PS_ON_PIN 12 #endif +#define CASE_LIGHT_PIN 8 + // // LCD / Controller // // Formbot only supports REPRAP_DISCOUNT_SMART_CONTROLLER // #if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) + #ifndef BEEPER_PIN + #define BEEPER_PIN 37 + #endif + #define BTN_EN1 31 + #define BTN_EN2 33 + #define BTN_ENC 35 + #define SD_DETECT_PIN 49 + #ifndef KILL_PIN + #define KILL_PIN 41 + #endif #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 #define LCD_PINS_D4 23 #define LCD_PINS_D5 25 #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 - #define BTN_EN1 31 - #define BTN_EN2 33 - #define BTN_ENC 35 - #define SD_DETECT_PIN 49 - #ifndef ROXYs_TRex - #define KILL_PIN 41 - #define BEEPER_PIN 37 - #endif #endif diff --git a/Marlin/src/pins/pins_FORMBOT_TREX3.h b/Marlin/src/pins/pins_FORMBOT_TREX3.h index 3615ca742c..8ff09f47c5 100644 --- a/Marlin/src/pins/pins_FORMBOT_TREX3.h +++ b/Marlin/src/pins/pins_FORMBOT_TREX3.h @@ -139,11 +139,11 @@ // #define CASE_LIGHT_PIN 5 #define SDSS 53 -#ifndef ROXYs_TRex +#ifndef LED_PIN #define LED_PIN 13 #endif -#define SPINDLE_LASER_PWM_PIN 7 // MUST BE HARDWARE PWM +#define SPINDLE_LASER_PWM_PIN -1 // MUST BE HARDWARE PWM #define SPINDLE_LASER_ENA_PIN 4 // Pin should have a pullup! // Use the RAMPS 1.4 Analog input 5 on the AUX2 connector @@ -165,8 +165,10 @@ #define BTN_EN2 33 #define BTN_ENC 35 #define SD_DETECT_PIN 49 - #ifndef ROXYs_TRex + #ifndef KILL_PIN #define KILL_PIN 41 + #endif + #ifndef BEEPER_PIN #define BEEPER_PIN 37 #endif #endif diff --git a/Marlin/src/pins/pins_FYSETC_F6_13.h b/Marlin/src/pins/pins_FYSETC_F6_13.h index e725583008..d40abd1024 100644 --- a/Marlin/src/pins/pins_FYSETC_F6_13.h +++ b/Marlin/src/pins/pins_FYSETC_F6_13.h @@ -28,8 +28,8 @@ #error "Oops! Select 'FYSETC F6' in 'Tools > Board.'" #endif -#ifdef SD_DETECT_INVERTED - #error "SD_DETECT_INVERTED must be disabled for the FYSETC_F6_13 board." +#if ENABLED(SD_DETECT_INVERTED) + //#error "SD_DETECT_INVERTED must be disabled for the FYSETC_F6_13 board." #endif #define BOARD_NAME "FYSETC F6 1.3" @@ -184,25 +184,46 @@ #define BEEPER_PIN 37 #define SD_DETECT_PIN 49 -#if ENABLED(MKS_MINI_12864) - #define DOGLCD_A0 27 - #define DOGLCD_CS 25 -#endif - #if ENABLED(FYSETC_MINI_12864) // // See https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 // #define DOGLCD_A0 16 #define DOGLCD_CS 17 - #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 25 + + #define LCD_BACKLIGHT_PIN -1 + #define KILL_PIN 41 + + #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 25 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + #define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" #endif - #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN 27 - #endif - #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 29 + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" #endif #elif HAS_GRAPHICAL_LCD @@ -214,6 +235,11 @@ #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 + #if ENABLED(MKS_MINI_12864) + #define DOGLCD_CS 25 + #define DOGLCD_A0 27 + #endif + #endif #if ENABLED(NEWPANEL) @@ -222,20 +248,6 @@ #define BTN_ENC 35 #endif -#if ENABLED(FYSETC_MINI_12864) - #define LCD_BACKLIGHT_PIN -1 - #define LCD_RESET_PIN 23 - #define KILL_PIN 41 - #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 25 - #endif - #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN 27 - #endif - #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 29 - #endif -#endif #ifndef RGB_LED_R_PIN #define RGB_LED_R_PIN 3 #endif diff --git a/Marlin/src/pins/pins_GEN7_13.h b/Marlin/src/pins/pins_GEN7_13.h index 60c62bdc71..9b1f0d242e 100644 --- a/Marlin/src/pins/pins_GEN7_13.h +++ b/Marlin/src/pins/pins_GEN7_13.h @@ -24,7 +24,7 @@ * Gen7 v1.3 pin assignments */ - /** +/** * Rev B 26 DEC 2016 * * added pointer to a current Arduino IDE extension diff --git a/Marlin/src/pins/pins_MKS_SBASE.h b/Marlin/src/pins/pins_MKS_SBASE.h index 19f9e5acf4..a97bcd164d 100644 --- a/Marlin/src/pins/pins_MKS_SBASE.h +++ b/Marlin/src/pins/pins_MKS_SBASE.h @@ -28,8 +28,12 @@ #error "Oops! Make sure you have the LPC1768 environment selected in your IDE." #endif -#define BOARD_NAME "MKS SBASE" -#define BOARD_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SBASE" +#ifndef BOARD_NAME + #define BOARD_NAME "MKS SBASE" +#endif +#ifndef BOARD_WEBSITE_URL + #define BOARD_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SBASE" +#endif #define LED_PIN P1_18 // Used as a status indicator #define LED2_PIN P1_19 @@ -154,23 +158,11 @@ #define ENET_TXD0 P1_00 // J12-11 #define ENET_TXD1 P1_01 // J12-12 -/** - * The SBase can share the on-board SD card with a PC via USB the following - * definitions control this feature: - */ -//#define USB_SD_DISABLED -#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device - -/** - * There are a number of configurations available for the SBase SD card reader. - * - A custom cable can be used to allow access to the LCD based SD card. - * - A standard cable can be used for access to the LCD SD card (but no SD detect). - * - The onboard SD card can be used and optionally shared with a PC via USB. - */ - -//#define LPC_SD_CUSTOM_CABLE // Use a custom cable to access the SD -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive attached to the control board +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #define LPC_SD_ONBOARD +#endif #if ENABLED(LPC_SD_CUSTOM_CABLE) @@ -249,6 +241,41 @@ #define DOGLCD_SCK SCK_PIN #define DOGLCD_MOSI MOSI_PIN #endif + + #if ENABLED(FYSETC_MINI_12864) + /** + * The Fysetc display can NOT use the SCK and MOSI pins on EXP2, so a + * special cable is needed to go between EXP2 on the FYSETC and the + * controller board's EXP2 and J8. It also means that a software SPI + * is needed to drive those pins. + * + * The Fysetc requires mode 3 SPI interface. + * + * Pins 6, 7 & 8 on EXP2 are no connects. That means a second special + * cable will be needed if the RGB LEDs are to be active. + */ + #define DOGLCD_CS LCD_PINS_ENABLE // EXP1.3 (LCD_EN on Fysetc schematic) + #define DOGLCD_A0 LCD_PINS_RS // EXP1.4 (LCD_A0 on Fysetc schematic) + #define DOGLCD_SCK P2_11 // J8-5 (SCK on Fysetc schematic) + #define DOGLCD_MOSI P4_28 // J8-6 (MOSI on Fysetc schematic) + + #define RGB_LED + //#define RGBW_LED + #if EITHER(RGB_LED, RGBW_LED) + #define RGB_LED_R_PIN P2_12 // J8-4 (LCD_D6 on Fysetc schematic) + #define RGB_LED_G_PIN P1_23 // J8-3 (LCD_D5 on Fysetc schematic) + #define RGB_LED_B_PIN P1_22 // J8-2 (LCD_D7 on Fysetc schematic) + //#define RGB_LED_W_PIN -1 + #endif + + #elif ENABLED(MINIPANEL) + // GLCD features + // Uncomment screen orientation + //#define LCD_SCREEN_ROT_90 + //#define LCD_SCREEN_ROT_180 + //#define LCD_SCREEN_ROT_270 + #endif + #endif /** @@ -281,7 +308,7 @@ #endif #endif -#if HAS_DRIVER(TMC2208) +#if MB(MKS_SBASE) && HAS_DRIVER(TMC2208) // The shortage of pins becomes apparent. // Worst case you may have to give up the LCD // RX pins need to be interrupt capable diff --git a/Marlin/src/pins/pins_MKS_SGEN.h b/Marlin/src/pins/pins_MKS_SGEN.h new file mode 100644 index 0000000000..2aa6bcc551 --- /dev/null +++ b/Marlin/src/pins/pins_MKS_SGEN.h @@ -0,0 +1,60 @@ +/** + * Marlin 3D Printer Firmware + * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * Copyright (C) 2017 MarlinFirmware [https://github.com/MarlinFirmware/Marlin] + * + * Based on Sprinter and grbl. + * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * MKS SGen pin assignments + */ + +#ifndef LPC1769 + #error "Oops! Make sure you have the LPC1769 environment selected in your IDE." +#endif + +#define BOARD_NAME "MKS SGEN" +#define BOARD_WEBSITE_URL "https://github.com/makerbase-mks/MKS-SGEN" + +#include "pins_MKS_SBASE.h" + +#undef E1_STEP_PIN +#undef E1_DIR_PIN +#undef E1_ENABLE_PIN + +//#undef BTN_EN1 +//#undef BTN_EN2 +//#define BTN_EN1 P1_23 // EXP2.5 +//#define BTN_EN2 P1_22 // EXP2.3 + +#if HAS_DRIVER(TMC2208) + // The shortage of pins becomes apparent. + // In the worst case you may have to give up the LCD. + // RX pins must be interrupt-capable. + #define X_SERIAL_TX_PIN P4_29 // J8-2 + #define X_SERIAL_RX_PIN P4_29 // J8-2 + + #define Y_SERIAL_TX_PIN P2_08 // J8-3 + #define Y_SERIAL_RX_PIN P2_08 // J8-3 + + #define Z_SERIAL_TX_PIN P2_11 // J8-4 + #define Z_SERIAL_RX_PIN P2_11 // J8-4 + #define E0_SERIAL_TX_PIN P2_13 // J8-5 + #define E0_SERIAL_RX_PIN P2_13 // J8-5 +#endif diff --git a/Marlin/src/pins/pins_RAMPS.h b/Marlin/src/pins/pins_RAMPS.h index 40d3dd11e2..120748eeb3 100644 --- a/Marlin/src/pins/pins_RAMPS.h +++ b/Marlin/src/pins/pins_RAMPS.h @@ -436,7 +436,9 @@ #endif #define BTN_ENC 35 - #define SD_DETECT_PIN 49 + #ifndef SD_DETECT_PIN + #define SD_DETECT_PIN 49 + #endif #define KILL_PIN 41 #if ENABLED(BQ_LCD_SMART_CONTROLLER) @@ -526,7 +528,6 @@ // From https://wiki.fysetc.com/Mini12864_Panel/?fbclid=IwAR1FyjuNdVOOy9_xzky3qqo_WeM5h-4gpRnnWhQr_O1Ef3h0AFnFXmCehK8 #define BEEPER_PIN 37 - #define LCD_RESET_PIN 23 #define DOGLCD_A0 16 #define DOGLCD_CS 17 @@ -537,14 +538,36 @@ #define SD_DETECT_PIN 49 - #ifndef RGB_LED_R_PIN - #define RGB_LED_R_PIN 25 + #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 25 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + #define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" #endif - #ifndef RGB_LED_G_PIN - #define RGB_LED_G_PIN 27 - #endif - #ifndef RGB_LED_B_PIN - #define RGB_LED_B_PIN 29 + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" #endif #elif ENABLED(MINIPANEL) diff --git a/Marlin/src/pins/pins_RAMPS_FD_V1.h b/Marlin/src/pins/pins_RAMPS_FD_V1.h index 8cee2e7f4d..78e75d9116 100644 --- a/Marlin/src/pins/pins_RAMPS_FD_V1.h +++ b/Marlin/src/pins/pins_RAMPS_FD_V1.h @@ -150,29 +150,71 @@ #if ENABLED(NEWPANEL) #define LCD_PINS_RS 16 #define LCD_PINS_ENABLE 17 + #endif + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_CS LCD_PINS_ENABLE + #define DOGLCD_A0 LCD_PINS_RS + + //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes problems + + #define LCD_RESET_PIN 23 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 25 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 27 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 29 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 25 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + #define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + + #elif ENABLED(NEWPANEL) + #define LCD_PINS_D4 23 #define LCD_PINS_D5 25 #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 - #endif - #if ENABLED(MINIPANEL) - #define DOGLCD_CS 25 - #define DOGLCD_A0 27 + #if ENABLED(MINIPANEL) + #define DOGLCD_CS 25 + #define DOGLCD_A0 27 + #endif + #endif #if ANY(VIKI2, miniVIKI) - #define DOGLCD_A0 16 - #define KILL_PIN 51 - #define STAT_LED_BLUE_PIN 29 - #define STAT_LED_RED_PIN 23 - #define DOGLCD_CS 17 - #define DOGLCD_SCK 76 // SCK_PIN - These are required for DUE Hardware SPI - #define DOGLCD_MOSI 75 // MOSI_PIN - #define DOGLCD_MISO 74 // MISO_PIN + #define DOGLCD_A0 16 + #define KILL_PIN 51 + #define STAT_LED_BLUE_PIN 29 + #define STAT_LED_RED_PIN 23 + #define DOGLCD_CS 17 + #define DOGLCD_SCK 76 // SCK_PIN - Required for DUE Hardware SPI + #define DOGLCD_MOSI 75 // MOSI_PIN + #define DOGLCD_MISO 74 // MISO_PIN #endif - #endif // ULTRA_LCD #if HAS_DRIVER(TMC2208) @@ -198,10 +240,8 @@ // // M3/M4/M5 - Spindle/Laser Control // -#if ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) - #if HOTENDS < 3 - #define SPINDLE_LASER_ENA_PIN 45 // Use E2 ENA - #define SPINDLE_LASER_PWM_PIN 12 // MUST BE HARDWARE PWM - #define SPINDLE_DIR_PIN 47 // Use E2 DIR - #endif +#if HOTENDS < 3 && ENABLED(SPINDLE_LASER_ENABLE) && !PIN_EXISTS(SPINDLE_LASER_ENA) + #define SPINDLE_LASER_ENA_PIN 45 // Use E2 ENA + #define SPINDLE_LASER_PWM_PIN 12 // MUST BE HARDWARE PWM + #define SPINDLE_DIR_PIN 47 // Use E2 DIR #endif diff --git a/Marlin/src/pins/pins_RAMPS_RE_ARM.h b/Marlin/src/pins/pins_RAMPS_RE_ARM.h index 25c85a360f..5871b80d15 100644 --- a/Marlin/src/pins/pins_RAMPS_RE_ARM.h +++ b/Marlin/src/pins/pins_RAMPS_RE_ARM.h @@ -269,11 +269,21 @@ #elif ENABLED(ULTRA_LCD) - #define BEEPER_PIN P1_30 // (37) not 5V tolerant + //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 + //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 + //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 + //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) + + #if ENABLED(FYSETC_MINI_12864) + #define BEEPER_PIN P1_01 + #define BTN_ENC P1_04 + #else + #define BEEPER_PIN P1_30 // (37) not 5V tolerant + #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 + #endif #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 #define SD_DETECT_PIN P1_31 // (49) J3-1 & AUX-3 (NOT 5V tolerant) #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 @@ -296,13 +306,6 @@ #if ANY(VIKI2, miniVIKI) // #define LCD_SCREEN_ROT_180 - #define BTN_EN1 P3_26 // (31) J3-2 & AUX-4 - #define BTN_EN2 P3_25 // (33) J3-4 & AUX-4 - #define BTN_ENC P2_11 // (35) J3-3 & AUX-4 - - #define SD_DETECT_PIN P1_31 // (49) J3-1 & AUX-3 (NOT 5V tolerant) - #define KILL_PIN P1_22 // (41) J5-4 & AUX-4 - #define DOGLCD_CS P0_16 // (16) #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 #define DOGLCD_SCK SCK_PIN @@ -311,8 +314,18 @@ #define STAT_LED_BLUE_PIN P0_26 //(63) may change if cable changes #define STAT_LED_RED_PIN P1_21 // ( 6) may change if cable changes #else - #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 - #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 + + #if ENABLED(FYSETC_MINI_12864) + #define DOGLCD_SCK P0_15 + #define DOGLCD_MOSI P0_18 + #define DOGLCD_CS P1_09 // use Ethernet connector for EXP1 cable signals + #define DOGLCD_A0 P1_14 + #define FORCE_SOFT_SPI // required on a Re-ARM system + #else + #define DOGLCD_CS P0_26 // (63) J5-3 & AUX-2 + #define DOGLCD_A0 P2_06 // (59) J3-8 & AUX-2 + #endif + #define LCD_BACKLIGHT_PIN P0_16 //(16) J3-7 & AUX-4 - only used on DOGLCD controllers #define LCD_PINS_ENABLE P0_18 // (51) (MOSI) J3-10 & AUX-3 #define LCD_PINS_D4 P0_15 // (52) (SCK) J3-9 & AUX-3 @@ -323,11 +336,6 @@ #endif #endif - //#define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 - //#define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 - //#define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 - //#define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - #if ENABLED(MINIPANEL) // GLCD features // Uncomment screen orientation @@ -354,18 +362,21 @@ #define ENET_TXD0 P1_00 // (78) J12-11 #define ENET_TXD1 P1_01 // (79) J12-12 -//#define USB_SD_DISABLED -#define USB_SD_ONBOARD // Provide the onboard SD card to the host as a USB mass storage device - -//#define LPC_SD_LCD // Marlin uses the SD drive attached to the LCD -#define LPC_SD_ONBOARD // Marlin uses the SD drive on the control board +// +// SD Support +// +#if !ANY(LPC_SD_LCD, LPC_SD_ONBOARD, LPC_SD_CUSTOM_CABLE) + #undef USB_SD_DISABLED + #define USB_SD_ONBOARD + #define LPC_SD_ONBOARD +#endif #if ENABLED(LPC_SD_LCD) - #define SCK_PIN P0_15 - #define MISO_PIN P0_17 - #define MOSI_PIN P0_18 - #define SS_PIN P1_23 // Chip select for SD card used by Marlin + #define SCK_PIN P0_15 // (52) system defined J3-9 & AUX-3 + #define MISO_PIN P0_17 // (50) system defined J3-10 & AUX-3 + #define MOSI_PIN P0_18 // (51) system defined J3-10 & AUX-3 + #define SS_PIN P1_23 // (53) system defined J3-5 & AUX-3 (Sometimes called SDSS) - CS used by Marlin #define ONBOARD_SD_CS P0_06 // Chip select for "System" SD card #elif ENABLED(LPC_SD_ONBOARD) diff --git a/Marlin/src/pins/pins_RURAMPS4D_11.h b/Marlin/src/pins/pins_RURAMPS4D_11.h index 517be5b9b5..718e44651e 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_11.h +++ b/Marlin/src/pins/pins_RURAMPS4D_11.h @@ -202,31 +202,24 @@ // #if ENABLED(ULTRA_LCD) - #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) - + #if ANY(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER, REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define BEEPER_PIN 62 + #define LCD_PINS_D4 48 + #define LCD_PINS_D5 50 + #define LCD_PINS_D6 52 + #define LCD_PINS_D7 53 + #define SD_DETECT_PIN 51 + #endif + + #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) #define LCD_PINS_RS 63 #define LCD_PINS_ENABLE 64 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - - #define SD_DETECT_PIN 51 #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) - #define BEEPER_PIN 62 - #define LCD_PINS_RS 52 #define LCD_PINS_ENABLE 53 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - - #define SD_DETECT_PIN 51 #elif HAS_SSD1306_OLED_I2C @@ -234,16 +227,57 @@ #define LCD_SDSS 10 #define SD_DETECT_PIN 51 + #elif ENABLED(FYSETC_MINI_12864) + + #define BEEPER_PIN 62 + #define DOGLCD_CS 64 + #define DOGLCD_A0 63 + + //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes problems + + #define LCD_RESET_PIN 48 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #define RGB_LED + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 50 // D5 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 52 // D6 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 53 // D7 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 50 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + #define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + #elif ENABLED(SPARK_FULL_GRAPHICS) //http://doku.radds.org/dokumentation/other-electronics/sparklcd/ #error "Oops! SPARK_FULL_GRAPHICS not supported with RURAMPS4D." - //#define LCD_PINS_D4 29//? - //#define LCD_PINS_ENABLE 27//? - //#define LCD_PINS_RS 25//? - //#define BTN_EN1 35//? - //#define BTN_EN2 33//? - //#define BTN_ENC 37//? + //#define LCD_PINS_D4 29 //? + //#define LCD_PINS_ENABLE 27 //? + //#define LCD_PINS_RS 25 //? + //#define BTN_EN1 35 //? + //#define BTN_EN2 33 //? + //#define BTN_ENC 37 //? #endif // SPARK_FULL_GRAPHICS diff --git a/Marlin/src/pins/pins_RURAMPS4D_13.h b/Marlin/src/pins/pins_RURAMPS4D_13.h index ab4aea0f2b..ddae87c245 100644 --- a/Marlin/src/pins/pins_RURAMPS4D_13.h +++ b/Marlin/src/pins/pins_RURAMPS4D_13.h @@ -188,31 +188,24 @@ // #if ENABLED(ULTRA_LCD) - #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) - + #if ANY(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER, REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #define BEEPER_PIN 62 + #define LCD_PINS_D4 48 + #define LCD_PINS_D5 50 + #define LCD_PINS_D6 52 + #define LCD_PINS_D7 53 + #define SD_DETECT_PIN 51 + #endif + + #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER) #define LCD_PINS_RS 63 #define LCD_PINS_ENABLE 64 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - - #define SD_DETECT_PIN 51 #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) - #define BEEPER_PIN 62 - #define LCD_PINS_RS 52 #define LCD_PINS_ENABLE 53 - #define LCD_PINS_D4 48 - #define LCD_PINS_D5 50 - #define LCD_PINS_D6 52 - #define LCD_PINS_D7 53 - - #define SD_DETECT_PIN 51 #elif HAS_SSD1306_OLED_I2C @@ -220,6 +213,47 @@ #define LCD_SDSS 10 #define SD_DETECT_PIN 51 + #elif ENABLED(FYSETC_MINI_12864) + + #define BEEPER_PIN 62 + #define DOGLCD_CS 64 + #define DOGLCD_A0 63 + + //#define FORCE_SOFT_SPI // Use this if default of hardware SPI causes problems + + #define LCD_RESET_PIN 48 // Must be high or open for LCD to operate normally. + // Seems to work best if left open. + + #define FYSETC_MINI_12864_REV_1_2 + //#define FYSETC_MINI_12864_REV_2_0 + //#define FYSETC_MINI_12864_REV_2_1 + #if EITHER(FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0) + #define RGB_LED + #ifndef RGB_LED_R_PIN + #define RGB_LED_R_PIN 50 // D5 + #endif + #ifndef RGB_LED_G_PIN + #define RGB_LED_G_PIN 52 // D6 + #endif + #ifndef RGB_LED_B_PIN + #define RGB_LED_B_PIN 53 // D7 + #endif + #elif defined(FYSETC_MINI_12864_REV_2_1) + #define NEOPIXEL_LED + #define NEOPIXEL_TYPE NEO_GRB // NEO_GRBW / NEO_GRB - four/three channel driver type (defined in Adafruit_NeoPixel.h) + #define NEOPIXEL_PIN 50 // LED driving pin on motherboard 4 => D4 (EXP2-5 on Printrboard) / 30 => PC7 (EXP3-13 on Rumba) + #define NEOPIXEL_PIXELS 3 // Number of LEDs in the strip + #define NEOPIXEL_IS_SEQUENTIAL // Sequential display for temperature change - LED by LED. Disable to change all LEDs at once. + #define NEOPIXEL_BRIGHTNESS 127 // Initial brightness (0-255) + #define NEOPIXEL_STARTUP_TEST // Cycle through colors at startup + #else + #error "Either FYSETC_MINI_12864_REV_1_2, FYSETC_MINI_12864_REV_2_0 or FYSETC_MINI_12864_REV_2_1 must be defined" + #endif + + #if !defined(LED_USER_PRESET_STARTUP) && EITHER(FYSETC_MINI_12864_REV_2_0, FYSETC_MINI_12864_REV_2_1) + #error "LED_USER_PRESET_STARTUP must be enabled when using FYSETC_MINI_12864 REV 2.0 and later" + #endif + #elif ENABLED(MKS_MINI_12864) #define ORIG_BEEPER_PIN 62 diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 95527a9b85..7ac21b975b 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -1030,6 +1030,7 @@ void CardReader::printingHasFinished() { // be zeroed and written instead of deleted. void CardReader::removeJobRecoveryFile() { if (jobRecoverFileExists()) { + recovery.init(); removeFile(job_recovery_file_name); #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) SERIAL_ECHOPGM("Power-loss file delete");