Merge branch 'bugfix-2.0.x' into Trex_2.0.x_Devel
This commit is contained in:
@@ -58,15 +58,16 @@ jobs:
|
||||
|
||||
#- STM32F103RC_btt_maple
|
||||
- STM32F103RC_btt_USB_maple
|
||||
- STM32F103RC_fysetc
|
||||
- STM32F103RC_fysetc_maple
|
||||
- STM32F103RC_meeb
|
||||
- jgaurora_a5s_a1
|
||||
- jgaurora_a5s_a1_maple
|
||||
- STM32F103VE_longer_maple
|
||||
#- mks_robin_maple
|
||||
- mks_robin_lite
|
||||
- mks_robin_pro
|
||||
- mks_robin_lite_maple
|
||||
- mks_robin_pro_maple
|
||||
#- mks_robin_nano35_maple
|
||||
#- STM32F103RET6_creality_maple
|
||||
- STM32F103VE_ZM3E4V2_USB_maple
|
||||
|
||||
# STM32 (ST) Environments
|
||||
|
||||
|
||||
@@ -455,6 +455,7 @@
|
||||
//#define PSU_NAME "Power Supply"
|
||||
|
||||
#if ENABLED(PSU_CONTROL)
|
||||
//#define MKS_PWC // Using the MKS PWC add-on
|
||||
//#define PS_OFF_CONFIRM // Confirm dialog when power off
|
||||
//#define PS_OFF_SOUND // Beep 1s when power off
|
||||
#define PSU_ACTIVE_STATE LOW // Set 'LOW' for ATX, 'HIGH' for X-Box
|
||||
@@ -2976,6 +2977,12 @@
|
||||
//
|
||||
//#define DWIN_CREALITY_LCD
|
||||
|
||||
//
|
||||
// MarlinUI for Creality's DWIN display (and others)
|
||||
//
|
||||
//#define DWIN_MARLINUI_PORTRAIT
|
||||
//#define DWIN_MARLINUI_LANDSCAPE
|
||||
|
||||
//
|
||||
// Touch Screen Settings
|
||||
//
|
||||
|
||||
+16
-14
@@ -1333,7 +1333,7 @@
|
||||
|
||||
// LCD Print Progress options
|
||||
#if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
|
||||
#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL)
|
||||
#if ANY(HAS_MARLINUI_U8GLIB, EXTENSIBLE_UI, HAS_MARLINUI_HD44780, IS_TFTGLCD_PANEL, IS_DWIN_MARLINUI)
|
||||
//#define SHOW_REMAINING_TIME // Display estimated time to completion
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
//#define USE_M73_REMAINING_TIME // Use remaining time from M73 command instead of estimation
|
||||
@@ -1608,16 +1608,10 @@
|
||||
* printing performance versus fast display updates.
|
||||
*/
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
// Show SD percentage next to the progress bar
|
||||
//#define DOGM_SD_PERCENT
|
||||
|
||||
// Save many cycles by drawing a hollow frame or no frame on the Info Screen
|
||||
//#define XYZ_NO_FRAME
|
||||
#define XYZ_HOLLOW_FRAME
|
||||
|
||||
// Enable to save many cycles by drawing a hollow frame on Menu Screens
|
||||
#define MENU_HOLLOW_FRAME
|
||||
|
||||
// A bigger font is available for edit items. Costs 3120 bytes of PROGMEM.
|
||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||
//#define USE_BIG_EDIT_FONT
|
||||
@@ -1626,9 +1620,6 @@
|
||||
// Western only. Not available for Cyrillic, Kana, Turkish, Greek, or Chinese.
|
||||
//#define USE_SMALL_INFOFONT
|
||||
|
||||
// Swap the CW/CCW indicators in the graphics overlay
|
||||
//#define OVERLAY_GFX_REVERSE
|
||||
|
||||
/**
|
||||
* ST7920-based LCDs can emulate a 16 x 4 character display using
|
||||
* the ST7920 character-generator for very fast screen updates.
|
||||
@@ -1684,6 +1675,17 @@
|
||||
|
||||
#endif // HAS_MARLINUI_U8GLIB
|
||||
|
||||
#if HAS_MARLINUI_U8GLIB || IS_DWIN_MARLINUI
|
||||
// Show SD percentage next to the progress bar
|
||||
//#define SHOW_SD_PERCENT
|
||||
|
||||
// Enable to save many cycles by drawing a hollow frame on Menu Screens
|
||||
#define MENU_HOLLOW_FRAME
|
||||
|
||||
// Swap the CW/CCW indicators in the graphics overlay
|
||||
//#define OVERLAY_GFX_REVERSE
|
||||
#endif
|
||||
|
||||
//
|
||||
// Additional options for DGUS / DWIN displays
|
||||
//
|
||||
@@ -1749,7 +1751,7 @@
|
||||
//
|
||||
// Specify additional languages for the UI. Default specified by LCD_LANGUAGE.
|
||||
//
|
||||
#if ANY(DOGLCD, TFT_COLOR_UI, TOUCH_UI_FTDI_EVE)
|
||||
#if ANY(DOGLCD, TFT_COLOR_UI, TOUCH_UI_FTDI_EVE, IS_DWIN_MARLINUI)
|
||||
//#define LCD_LANGUAGE_2 fr
|
||||
//#define LCD_LANGUAGE_3 de
|
||||
//#define LCD_LANGUAGE_4 es
|
||||
@@ -1768,7 +1770,7 @@
|
||||
//#define LCD_4DSYSTEMS_4DLCD_FT843 // 4D Systems 4.3" (480x272)
|
||||
//#define LCD_HAOYU_FT800CB // Haoyu with 4.3" or 5" (480x272)
|
||||
//#define LCD_HAOYU_FT810CB // Haoyu with 5" (800x480)
|
||||
//#define LCD_ALEPHOBJECTS_CLCD_UI // Aleph Objects Color LCD UI
|
||||
//#define LCD_LULZBOT_CLCD_UI // LulzBot Color LCD UI
|
||||
//#define LCD_FYSETC_TFT81050 // FYSETC with 5" (800x480)
|
||||
//#define LCD_EVE3_50G // Matrix Orbital 5.0", 800x480, BT815
|
||||
//#define LCD_EVE2_50G // Matrix Orbital 5.0", 800x480, FT813
|
||||
@@ -1779,8 +1781,8 @@
|
||||
//#define TOUCH_UI_800x480
|
||||
|
||||
// Mappings for boards with a standard RepRapDiscount Display connector
|
||||
//#define AO_EXP1_PINMAP // AlephObjects CLCD UI EXP1 mapping
|
||||
//#define AO_EXP2_PINMAP // AlephObjects CLCD UI EXP2 mapping
|
||||
//#define AO_EXP1_PINMAP // LulzBot CLCD UI EXP1 mapping
|
||||
//#define AO_EXP2_PINMAP // LulzBot CLCD UI EXP2 mapping
|
||||
//#define CR10_TFT_PINMAP // Rudolph Riedel's CR10 pin mapping
|
||||
//#define S6_TFT_PINMAP // FYSETC S6 pin mapping
|
||||
//#define F6_TFT_PINMAP // FYSETC F6 pin mapping
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
/**
|
||||
* Marlin release version identifier
|
||||
*/
|
||||
#define SHORT_BUILD_VERSION "2.0.9_TR1"
|
||||
#define SHORT_BUILD_VERSION "2.0.9_TR2"
|
||||
|
||||
/**
|
||||
* Verbose version identifier which should contain a reference to the location
|
||||
@@ -41,7 +41,7 @@
|
||||
* here we define this default string as the date where the latest release
|
||||
* version was tagged.
|
||||
*/
|
||||
#define STRING_DISTRIBUTION_DATE "2021-08-05"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-08-28"
|
||||
|
||||
/**
|
||||
* Defines a generic printer name to be output to the LCD after booting Marlin.
|
||||
|
||||
@@ -393,3 +393,4 @@ static void pwm_details(uint8_t pin) {
|
||||
#endif
|
||||
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
|
||||
@@ -594,18 +594,14 @@
|
||||
SPI_Configure(SPI0, ID_SPI0, SPI_MR_MSTR | SPI_MR_MODFDIS | SPI_MR_PS);
|
||||
SPI_Enable(SPI0);
|
||||
|
||||
SET_OUTPUT(DAC0_SYNC);
|
||||
SET_OUTPUT(DAC0_SYNC_PIN);
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
SET_OUTPUT(DAC1_SYNC);
|
||||
WRITE(DAC1_SYNC, HIGH);
|
||||
OUT_WRITE(DAC1_SYNC_PIN, HIGH);
|
||||
#endif
|
||||
SET_OUTPUT(SPI_EEPROM1_CS);
|
||||
SET_OUTPUT(SPI_EEPROM2_CS);
|
||||
SET_OUTPUT(SPI_FLASH_CS);
|
||||
WRITE(DAC0_SYNC, HIGH);
|
||||
WRITE(SPI_EEPROM1_CS, HIGH);
|
||||
WRITE(SPI_EEPROM2_CS, HIGH);
|
||||
WRITE(SPI_FLASH_CS, HIGH);
|
||||
WRITE(DAC0_SYNC_PIN, HIGH);
|
||||
OUT_WRITE(SPI_EEPROM1_CS_PIN, HIGH);
|
||||
OUT_WRITE(SPI_EEPROM2_CS_PIN, HIGH);
|
||||
OUT_WRITE(SPI_FLASH_CS_PIN, HIGH);
|
||||
WRITE(SD_SS_PIN, HIGH);
|
||||
|
||||
OUT_WRITE(SDSS, LOW);
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#define PRINT_PORT(p)
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
||||
#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL ? 1 : 0)
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
#define SD_MMC_REMOVING 2
|
||||
|
||||
|
||||
//---- CONTROL FONCTIONS ----
|
||||
//---- CONTROL FUNCTIONS ----
|
||||
//!
|
||||
//! @brief This function initializes the hw/sw resources required to drive the SD_MMC_SPI.
|
||||
//!/
|
||||
@@ -134,7 +134,7 @@ extern bool sd_mmc_spi_wr_protect(void);
|
||||
extern bool sd_mmc_spi_removal(void);
|
||||
|
||||
|
||||
//---- ACCESS DATA FONCTIONS ----
|
||||
//---- ACCESS DATA FUNCTIONS ----
|
||||
|
||||
#if ACCESS_USB == true
|
||||
// Standard functions for open in read/write mode the device
|
||||
|
||||
@@ -135,7 +135,7 @@ typedef void (*udd_callback_halt_cleared_t)(void);
|
||||
* \param n number of data transferred
|
||||
*/
|
||||
typedef void (*udd_callback_trans_t) (udd_ep_status_t status,
|
||||
iram_size_t nb_transfered, udd_ep_id_t ep);
|
||||
iram_size_t nb_transferred, udd_ep_id_t ep);
|
||||
|
||||
/**
|
||||
* \brief Authorizes the VBUS event
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
// active ADC function/mode/code values for PINSEL registers
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#define PRINT_PORT(p)
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%d.%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("P%d_%02d"), LPC176x::pin_port(p), LPC176x::pin_bit(p)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR("_A%d "), LPC176x::pin_get_adc_channel(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
// pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
|
||||
@@ -48,6 +49,4 @@ bool GET_PINMODE(const pin_t pin) {
|
||||
return LPC176x::gpio_direction(pin);
|
||||
}
|
||||
|
||||
bool GET_ARRAY_IS_DIGITAL(const pin_t pin) {
|
||||
return (!LPC176x::pin_has_adc(pin) || !LPC176x::pin_adc_enabled(pin));
|
||||
}
|
||||
#define GET_ARRAY_IS_DIGITAL(x) ((bool) pin_array[x].is_digital)
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
* Support routines for X86_64
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Translation of routines & variables used by pinsDebug.h
|
||||
*/
|
||||
@@ -34,19 +36,20 @@
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 16 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
// active ADC function/mode/code values for PINSEL registers
|
||||
constexpr int8_t ADC_pin_mode(pin_t pin) {
|
||||
inline constexpr int8_t ADC_pin_mode(pin_t pin) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
int8_t get_pin_mode(pin_t pin) {
|
||||
inline int8_t get_pin_mode(pin_t pin) {
|
||||
if (!VALID_PIN(pin)) return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool GET_PINMODE(pin_t pin) {
|
||||
inline bool GET_PINMODE(pin_t pin) {
|
||||
int8_t pin_mode = get_pin_mode(pin);
|
||||
if (pin_mode == -1 || pin_mode == ADC_pin_mode(pin)) // found an invalid pin or active analog pin
|
||||
return false;
|
||||
@@ -54,6 +57,6 @@ bool GET_PINMODE(pin_t pin) {
|
||||
return (Gpio::getMode(pin) != 0); //input/output state
|
||||
}
|
||||
|
||||
bool GET_ARRAY_IS_DIGITAL(pin_t pin) {
|
||||
inline bool GET_ARRAY_IS_DIGITAL(pin_t pin) {
|
||||
return (!IS_ANALOG(pin) || get_pin_mode(pin) != ADC_pin_mode(pin));
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
#if ENABLED(U8GLIB_ST7920)
|
||||
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
#include "../../shared/Delay.h"
|
||||
|
||||
#undef SPI_SPEED
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
#define SPI_SPEED 2 // About 2 MHz
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -209,7 +209,7 @@ uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_pt
|
||||
#endif
|
||||
|
||||
#elif !ANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI, HAS_MARLINUI_HD44780) && HAS_MARLINUI_U8GLIB
|
||||
#include <U8glib.h>
|
||||
#include <U8glib-HAL.h>
|
||||
uint8_t u8g_com_sw_spi_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr) {return 0;}
|
||||
#endif // HAS_MARLINUI_U8GLIB && !U8GLIB_ST7920
|
||||
#endif // __PLAT_NATIVE_SIM__
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0)
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
||||
#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL)
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "HAL.h"
|
||||
#include "usb_serial.h"
|
||||
@@ -61,8 +63,6 @@ TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
|
||||
|
||||
// HAL initialization task
|
||||
void HAL_init() {
|
||||
FastIO_init();
|
||||
|
||||
// Ensure F_CPU is a constant expression.
|
||||
// If the compiler breaks here, it means that delay code that should compute at compile time will not work.
|
||||
// So better safe than sorry here.
|
||||
@@ -165,4 +165,4 @@ void HAL_SYSTICK_Callback() {
|
||||
if (systick_user_callback) systick_user_callback();
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -149,4 +151,4 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#endif // POSTMORTEM_DEBUGGING
|
||||
#endif // ARDUINO_ARCH_STM32
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -224,4 +226,4 @@ static SPISettings spiConfig;
|
||||
|
||||
#endif // SOFTWARE_SPI
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1) && !defined(STM32H7xx)
|
||||
#include "../platforms.h"
|
||||
|
||||
#if defined(HAL_STM32) && !defined(STM32H7xx)
|
||||
|
||||
#include "MarlinSPI.h"
|
||||
|
||||
@@ -165,4 +167,4 @@ uint8_t MarlinSPI::dmaSend(const void * transmitBuf, uint16_t length, bool minc)
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1 && !STM32H7xx
|
||||
#endif // HAL_STM32 && !STM32H7xx
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "MarlinSerial.h"
|
||||
@@ -101,4 +103,4 @@ void MarlinSerial::_rx_complete_irq(serial_t *obj) {
|
||||
}
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -320,4 +322,4 @@ extern "C" void SDIO_IRQHandler(void) { HAL_SD_IRQHandler(&hsd); }
|
||||
extern "C" void DMA_IRQ_HANDLER(void) { HAL_DMA_IRQHandler(&hdma_sdio); }
|
||||
|
||||
#endif // SDIO_SUPPORT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -107,4 +109,4 @@ void libServo::setInterruptPriority(uint32_t preemptPriority, uint32_t subPriori
|
||||
}
|
||||
|
||||
#endif // HAS_SERVOS
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#ifdef STM32F1
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
/**
|
||||
* PersistentStore for Arduino-style EEPROM interface
|
||||
@@ -79,4 +81,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
|
||||
}
|
||||
|
||||
#endif // IIC_BL24CXX_EEPROM
|
||||
#endif // STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -104,6 +106,8 @@ size_t PersistentStore::capacity() { return MARLIN_EEPROM_SIZE; }
|
||||
|
||||
bool PersistentStore::access_start() {
|
||||
|
||||
EEPROM.begin(); // Avoid STM32 EEPROM.h warning (do nothing)
|
||||
|
||||
#if ENABLED(FLASH_EEPROM_LEVELING)
|
||||
|
||||
if (current_slot == -1 || eeprom_data_written) {
|
||||
@@ -270,4 +274,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
|
||||
}
|
||||
|
||||
#endif // FLASH_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,14 +19,15 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
/**
|
||||
* Platform-independent Arduino functions for I2C EEPROM.
|
||||
* Enable USE_SHARED_EEPROM if not supplied by the framework.
|
||||
*/
|
||||
|
||||
#ifdef STM32F1
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
#if ENABLED(IIC_BL24CXX_EEPROM)
|
||||
@@ -51,4 +52,4 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
|
||||
}
|
||||
|
||||
#endif // IIC_BL24CXX_EEPROM
|
||||
#endif // STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
/**
|
||||
* Implementation of EEPROM settings in SD Card
|
||||
@@ -88,4 +90,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, const size_t size, uin
|
||||
}
|
||||
|
||||
#endif // SDCARD_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -65,4 +67,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
|
||||
}
|
||||
|
||||
#endif // SRAM_EEPROM_EMULATION
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -75,4 +77,4 @@ bool PersistentStore::read_data(int &pos, uint8_t *value, size_t size, uint16_t
|
||||
}
|
||||
|
||||
#endif // USE_WIRED_EEPROM
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -56,4 +58,4 @@ void set_pwm_duty(const pin_t pin, const uint16_t v, const uint16_t v_size/*=255
|
||||
}
|
||||
|
||||
#endif // NEEDS_HARDWARE_PWM
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -20,15 +20,17 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
GPIO_TypeDef* FastIOPortMap[LastPort + 1];
|
||||
GPIO_TypeDef* FastIOPortMap[LastPort + 1] = { 0 };
|
||||
|
||||
void FastIO_init() {
|
||||
LOOP_L_N(i, NUM_DIGITAL_PINS)
|
||||
FastIOPortMap[STM_PORT(digitalPin[i])] = get_GPIO_Port(STM_PORT(digitalPin[i]));
|
||||
}
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -38,6 +38,7 @@ extern GPIO_TypeDef * FastIOPortMap[];
|
||||
// ------------------------
|
||||
|
||||
void FastIO_init(); // Must be called before using fast io macros
|
||||
#define FASTIO_INIT() FastIO_init()
|
||||
|
||||
// ------------------------
|
||||
// Defines
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -125,4 +127,4 @@ void MSC_SD_init() {
|
||||
}
|
||||
|
||||
#endif // HAS_SD_HOST_DRIVE
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -109,6 +109,7 @@ const XrefInfo pin_xref[] PROGMEM = {
|
||||
#define VALID_PIN(ANUM) ((ANUM) >= 0 && (ANUM) < NUMBER_PINS_TOTAL)
|
||||
#define digitalRead_mod(Ard_num) extDigitalRead(Ard_num) // must use Arduino pin numbers when doing reads
|
||||
#define PRINT_PIN(Q)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PORT(ANUM) port_print(ANUM)
|
||||
#define DIGITAL_PIN_TO_ANALOG_PIN(ANUM) -1 // will report analog pin number in the print port routine
|
||||
#define GET_PIN_MAP_PIN_M43(Index) pin_xref[Index].Ard_num
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -199,4 +201,4 @@ bool GT911::getPoint(int16_t *x, int16_t *y) {
|
||||
}
|
||||
|
||||
#endif // TFT_TOUCH_DEVICE_GT911
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -34,16 +36,6 @@ LCD_CONTROLLER_TypeDef *TFT_FSMC::LCD;
|
||||
|
||||
void TFT_FSMC::Init() {
|
||||
uint32_t controllerAddress;
|
||||
|
||||
#if PIN_EXISTS(TFT_RESET)
|
||||
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||
HAL_Delay(100);
|
||||
#endif
|
||||
|
||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
FSMC_NORSRAM_TimingTypeDef Timing, ExtTiming;
|
||||
|
||||
uint32_t NSBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
|
||||
@@ -178,4 +170,4 @@ void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
|
||||
}
|
||||
|
||||
#endif // HAS_FSMC_TFT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -181,7 +183,7 @@ void LTDC_Config() {
|
||||
hltdc_F.Init.AccumulatedVBP = (LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
|
||||
hltdc_F.Init.AccumulatedActiveH = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
|
||||
hltdc_F.Init.AccumulatedActiveW = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
|
||||
hltdc_F.Init.TotalHeigh = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
|
||||
hltdc_F.Init.TotalHeight = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
|
||||
hltdc_F.Init.TotalWidth = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP + LTDC_LCD_HFP - 1);
|
||||
|
||||
/* Configure R,G,B component values for LCD background color : all black background */
|
||||
@@ -203,7 +205,7 @@ void LTDC_Config() {
|
||||
pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
|
||||
|
||||
/* Start Address configuration : frame buffer is located at SDRAM memory */
|
||||
pLayerCfg.FBStartAdress = (uint32_t)(FRAME_BUFFER_ADDRESS);
|
||||
pLayerCfg.FBStartAddress = (uint32_t)(FRAME_BUFFER_ADDRESS);
|
||||
|
||||
/* Alpha constant (255 == totally opaque) */
|
||||
pLayerCfg.Alpha = 255;
|
||||
@@ -384,4 +386,4 @@ void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Cou
|
||||
}
|
||||
|
||||
#endif // HAS_LTDC_TFT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -240,4 +242,4 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
|
||||
}
|
||||
|
||||
#endif // HAS_SPI_TFT
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -167,4 +169,4 @@ uint16_t XPT2046::SoftwareIO(uint16_t data) {
|
||||
}
|
||||
|
||||
#endif // HAS_TFT_XPT2046
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -319,4 +321,4 @@ static constexpr bool verify_no_timer_conflicts() {
|
||||
// when hovering over it, making it easy to identify the conflicting timers.
|
||||
static_assert(verify_no_timer_conflicts(), "One or more timer conflict detected. Examine \"timers_in_use\" to help identify conflict.");
|
||||
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#include "../platforms.h"
|
||||
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
|
||||
@@ -114,4 +115,4 @@ uint8_t BulkStorage::Write(uint8_t lun, uint32_t addr, uint16_t bsize, uint8_t b
|
||||
}
|
||||
|
||||
#endif // USE_OTG_USB_HOST && USBHOST
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -51,4 +53,4 @@ void USB_Hook_init() {
|
||||
}
|
||||
|
||||
#endif // EMERGENCY_PARSER && USBD_USE_CDC
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -19,7 +19,9 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#include "../platforms.h"
|
||||
|
||||
#ifdef HAL_STM32
|
||||
|
||||
#include "../../inc/MarlinConfigPre.h"
|
||||
|
||||
@@ -46,4 +48,4 @@ void HAL_watchdog_refresh() {
|
||||
}
|
||||
|
||||
#endif // USE_WATCHDOG
|
||||
#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC && !MAPLE_STM32F1
|
||||
#endif // HAL_STM32
|
||||
|
||||
@@ -44,7 +44,7 @@ bool PersistentStore::access_start() {
|
||||
SET_OUTPUT(BOARD_SPI1_SCK_PIN);
|
||||
SET_OUTPUT(BOARD_SPI1_MOSI_PIN);
|
||||
SET_INPUT(BOARD_SPI1_MISO_PIN);
|
||||
SET_OUTPUT(SPI_EEPROM1_CS);
|
||||
SET_OUTPUT(SPI_EEPROM1_CS_PIN);
|
||||
#endif
|
||||
spiInit(0);
|
||||
#endif
|
||||
|
||||
@@ -158,7 +158,7 @@ static void sd_power_on() {
|
||||
ONBOARD_SD_SPI.begin();
|
||||
ONBOARD_SD_SPI.setBitOrder(MSBFIRST);
|
||||
ONBOARD_SD_SPI.setDataMode(SPI_MODE0);
|
||||
OUT_WRITE(ONBOARD_SD_CS_PIN, HIGH); // Set CS# high
|
||||
CS_HIGH();
|
||||
}
|
||||
|
||||
// Disable SPI function
|
||||
|
||||
@@ -19,15 +19,15 @@
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Support routines for STM32GENERIC (Maple)
|
||||
* Support routines for MAPLE_STM32F1
|
||||
*/
|
||||
|
||||
/**
|
||||
* Translation of routines & variables used by pinsDebug.h
|
||||
*/
|
||||
|
||||
#ifndef BOARD_NR_GPIO_PINS // Only in STM32GENERIC (Maple)
|
||||
#error "Expected BOARD_NR_GPIO_PINS not found"
|
||||
#ifndef BOARD_NR_GPIO_PINS // Only in MAPLE_STM32F1
|
||||
#error "Expected BOARD_NR_GPIO_PINS not found"
|
||||
#endif
|
||||
|
||||
#include "fastio.h"
|
||||
@@ -41,6 +41,7 @@ extern const stm32_pin_info PIN_MAP[BOARD_NR_GPIO_PINS];
|
||||
#define pwm_status(pin) PWM_PIN(pin)
|
||||
#define digitalRead_mod(p) extDigitalRead(p)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3hd "), int16_t(p)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PORT(p) print_port(p)
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define MULTI_NAME_PAD 21 // space needed to be pretty if not first name assigned to a pin
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#define PRINT_PORT(p)
|
||||
#define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%02d"), p); SERIAL_ECHO(buffer); }while(0)
|
||||
#define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
|
||||
#define GET_ARRAY_PIN(p) pin_array[p].pin
|
||||
#define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
|
||||
#define VALID_PIN(pin) (pin >= 0 && pin < (int8_t)NUMBER_PINS_TOTAL ? 1 : 0)
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#elif defined(__STM32F1__) || defined(TARGET_STM32F1)
|
||||
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32F1/NAME)
|
||||
#elif defined(ARDUINO_ARCH_STM32)
|
||||
#ifndef HAL_STM32
|
||||
#define HAL_STM32
|
||||
#endif
|
||||
#define HAL_PATH(PATH, NAME) XSTR(PATH/STM32/NAME)
|
||||
#elif defined(ARDUINO_ARCH_ESP32)
|
||||
#define HAL_PATH(PATH, NAME) XSTR(PATH/ESP32/NAME)
|
||||
|
||||
@@ -322,7 +322,7 @@ void hook_cpu_exceptions() {
|
||||
|
||||
unsigned long *vecAddr = (unsigned long*)get_vtor();
|
||||
SERIAL_ECHOPGM("Vector table addr: ");
|
||||
SERIAL_PRINTLN(get_vtor(), HEX);
|
||||
SERIAL_PRINTLN(get_vtor(), PrintBase::Hex);
|
||||
|
||||
#ifdef VECTOR_TABLE_SIZE
|
||||
uint32_t vec_size = VECTOR_TABLE_SIZE;
|
||||
@@ -349,7 +349,7 @@ void hook_cpu_exceptions() {
|
||||
alignas(128) static unsigned long vectable[VECTOR_TABLE_SENTINEL];
|
||||
|
||||
SERIAL_ECHOPGM("Detected vector table size: ");
|
||||
SERIAL_PRINTLN(vec_size, HEX);
|
||||
SERIAL_PRINTLN(vec_size, PrintBase::Hex);
|
||||
#endif
|
||||
|
||||
uint32_t defaultFaultHandler = vecAddr[(unsigned)7];
|
||||
|
||||
@@ -49,8 +49,8 @@ static void _eeprom_begin(uint8_t * const pos, const uint8_t cmd) {
|
||||
(unsigned(pos) >> 8) & 0xFF, // Address High
|
||||
unsigned(pos) & 0xFF // Address Low
|
||||
};
|
||||
WRITE(SPI_EEPROM1_CS, HIGH); // Usually free already
|
||||
WRITE(SPI_EEPROM1_CS, LOW); // Activate the Bus
|
||||
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Usually free already
|
||||
WRITE(SPI_EEPROM1_CS_PIN, LOW); // Activate the Bus
|
||||
spiSend(SPI_CHAN_EEPROM1, eeprom_temp, 3);
|
||||
// Leave the Bus in-use
|
||||
}
|
||||
@@ -60,23 +60,23 @@ uint8_t eeprom_read_byte(uint8_t *pos) {
|
||||
|
||||
const uint8_t v = spiRec(SPI_CHAN_EEPROM1); // After READ a value sits on the Bus
|
||||
|
||||
WRITE(SPI_EEPROM1_CS, HIGH); // Done with device
|
||||
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with device
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
void eeprom_write_byte(uint8_t *pos, uint8_t value) {
|
||||
const uint8_t eeprom_temp = CMD_WREN;
|
||||
WRITE(SPI_EEPROM1_CS, LOW);
|
||||
WRITE(SPI_EEPROM1_CS_PIN, LOW);
|
||||
spiSend(SPI_CHAN_EEPROM1, &eeprom_temp, 1); // Write Enable
|
||||
|
||||
WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus
|
||||
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus
|
||||
delay(1); // For a small amount of time
|
||||
|
||||
_eeprom_begin(pos, CMD_WRITE); // Set write address and begin transmission
|
||||
|
||||
spiSend(SPI_CHAN_EEPROM1, value); // Send the value to be written
|
||||
WRITE(SPI_EEPROM1_CS, HIGH); // Done with the Bus
|
||||
WRITE(SPI_EEPROM1_CS_PIN, HIGH); // Done with the Bus
|
||||
delay(EEPROM_WRITE_DELAY); // Give page write time to complete
|
||||
}
|
||||
|
||||
|
||||
@@ -1131,6 +1131,10 @@ inline void tmc_standby_setup() {
|
||||
* - Set Marlin to RUNNING State
|
||||
*/
|
||||
void setup() {
|
||||
#ifdef FASTIO_INIT
|
||||
FASTIO_INIT();
|
||||
#endif
|
||||
|
||||
#ifdef BOARD_PREINIT
|
||||
BOARD_PREINIT(); // Low-level init (before serial init)
|
||||
#endif
|
||||
@@ -1188,7 +1192,7 @@ void setup() {
|
||||
|
||||
#if HAS_SUICIDE
|
||||
SETUP_LOG("SUICIDE_PIN");
|
||||
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
|
||||
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE);
|
||||
#endif
|
||||
|
||||
#ifdef JTAGSWD_RESET
|
||||
@@ -1275,14 +1279,13 @@ void setup() {
|
||||
HAL_clear_reset_source();
|
||||
|
||||
SERIAL_ECHOLNPGM("Marlin " SHORT_BUILD_VERSION);
|
||||
SERIAL_EOL();
|
||||
#if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR)
|
||||
SERIAL_ECHO_MSG(
|
||||
" Last Updated: " STRING_DISTRIBUTION_DATE
|
||||
" | Author: " STRING_CONFIG_H_AUTHOR
|
||||
);
|
||||
#endif
|
||||
SERIAL_ECHO_MSG("Compiled: " __DATE__);
|
||||
SERIAL_ECHO_MSG(" Compiled: " __DATE__);
|
||||
SERIAL_ECHO_MSG(STR_FREE_MEMORY, freeMemory(), STR_PLANNER_BUFFER_BYTES, sizeof(block_t) * (BLOCK_BUFFER_SIZE));
|
||||
|
||||
// Some HAL need precise delay adjustment
|
||||
@@ -1587,7 +1590,7 @@ void setup() {
|
||||
#if ENABLED(DWIN_CREALITY_LCD)
|
||||
Encoder_Configuration();
|
||||
HMI_Init();
|
||||
DWIN_JPG_CacheTo1(Language_English);
|
||||
HMI_SetLanguageCache();
|
||||
HMI_StartFrame(true);
|
||||
DWIN_StatusChanged_P(GET_TEXT(WELCOME_MSG));
|
||||
#endif
|
||||
|
||||
@@ -84,7 +84,7 @@ extern bool wait_for_heatup;
|
||||
bool pin_is_protected(const pin_t pin);
|
||||
|
||||
#if HAS_SUICIDE
|
||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_INVERTING); }
|
||||
inline void suicide() { OUT_WRITE(SUICIDE_PIN, SUICIDE_PIN_STATE); }
|
||||
#endif
|
||||
|
||||
#if HAS_KILL
|
||||
|
||||
+32
-27
@@ -346,6 +346,9 @@
|
||||
#define BOARD_BEAST 4048 // STM32F103RET6 Libmaple-based controller
|
||||
#define BOARD_MINGDA_MPX_ARM_MINI 4049 // STM32F103ZET6 Mingda MD-16
|
||||
#define BOARD_GTM32_PRO_VD 4050 // STM32F103VET6 controller
|
||||
#define BOARD_ZONESTAR_ZM3E2 4051 // Zonestar ZM3E2 (STM32F103RCT6)
|
||||
#define BOARD_ZONESTAR_ZM3E4 4052 // Zonestar ZM3E4 V1 (STM32F103VCT6)
|
||||
#define BOARD_ZONESTAR_ZM3E4V2 4053 // Zonestar ZM3E4 V2 (STM32F103VCT6)
|
||||
|
||||
//
|
||||
// ARM Cortex-M4F
|
||||
@@ -362,33 +365,35 @@
|
||||
#define BOARD_RUMBA32_V1_0 4201 // RUMBA32 STM32F446VET6 based controller from Aus3D
|
||||
#define BOARD_RUMBA32_V1_1 4202 // RUMBA32 STM32F446VET6 based controller from Aus3D
|
||||
#define BOARD_RUMBA32_MKS 4203 // RUMBA32 STM32F446VET6 based controller from Makerbase
|
||||
#define BOARD_BLACK_STM32F407VE 4204 // BLACK_STM32F407VE
|
||||
#define BOARD_BLACK_STM32F407ZE 4205 // BLACK_STM32F407ZE
|
||||
#define BOARD_STEVAL_3DP001V1 4206 // STEVAL-3DP001V1 3D PRINTER BOARD
|
||||
#define BOARD_BTT_SKR_PRO_V1_1 4207 // BigTreeTech SKR Pro v1.1 (STM32F407ZGT6)
|
||||
#define BOARD_BTT_SKR_PRO_V1_2 4208 // BigTreeTech SKR Pro v1.2 (STM32F407ZGT6)
|
||||
#define BOARD_BTT_BTT002_V1_0 4209 // BigTreeTech BTT002 v1.0 (STM32F407VGT6)
|
||||
#define BOARD_BTT_E3_RRF 4210 // BigTreeTech E3 RRF (STM32F407VGT6)
|
||||
#define BOARD_BTT_SKR_V2_0_REV_A 4211 // BigTreeTech SKR v2.0 Rev A (STM32F407VGT6)
|
||||
#define BOARD_BTT_SKR_V2_0_REV_B 4212 // BigTreeTech SKR v2.0 Rev B (STM32F407VGT6)
|
||||
#define BOARD_BTT_GTR_V1_0 4213 // BigTreeTech GTR v1.0 (STM32F407IGT)
|
||||
#define BOARD_BTT_OCTOPUS_V1_0 4214 // BigTreeTech Octopus v1.0 (STM32F446ZET6)
|
||||
#define BOARD_BTT_OCTOPUS_V1_1 4215 // BigTreeTech Octopus v1.1 (STM32F446ZET6)
|
||||
#define BOARD_LERDGE_K 4216 // Lerdge K (STM32F407ZG)
|
||||
#define BOARD_LERDGE_S 4217 // Lerdge S (STM32F407VE)
|
||||
#define BOARD_LERDGE_X 4218 // Lerdge X (STM32F407VE)
|
||||
#define BOARD_VAKE403D 4219 // VAkE 403D (STM32F446VET6)
|
||||
#define BOARD_FYSETC_S6 4220 // FYSETC S6 (STM32F446VET6)
|
||||
#define BOARD_FYSETC_S6_V2_0 4221 // FYSETC S6 v2.0 (STM32F446VET6)
|
||||
#define BOARD_FYSETC_SPIDER 4222 // FYSETC Spider (STM32F446VET6)
|
||||
#define BOARD_FLYF407ZG 4223 // FLYmaker FLYF407ZG (STM32F407ZG)
|
||||
#define BOARD_MKS_ROBIN2 4224 // MKS_ROBIN2 (STM32F407ZE)
|
||||
#define BOARD_MKS_ROBIN_PRO_V2 4225 // MKS Robin Pro V2 (STM32F407VE)
|
||||
#define BOARD_MKS_ROBIN_NANO_V3 4226 // MKS Robin Nano V3 (STM32F407VG)
|
||||
#define BOARD_MKS_MONSTER8 4227 // MKS Monster8 (STM32F407VGT6)
|
||||
#define BOARD_ANET_ET4 4228 // ANET ET4 V1.x (STM32F407VGT6)
|
||||
#define BOARD_ANET_ET4P 4229 // ANET ET4P V1.x (STM32F407VGT6)
|
||||
#define BOARD_FYSETC_CHEETAH_V20 4230 // FYSETC Cheetah V2.0
|
||||
#define BOARD_RUMBA32_BTT 4204 // RUMBA32 STM32F446VET6 based controller from BIGTREETECH
|
||||
#define BOARD_BLACK_STM32F407VE 4205 // BLACK_STM32F407VE
|
||||
#define BOARD_BLACK_STM32F407ZE 4206 // BLACK_STM32F407ZE
|
||||
#define BOARD_STEVAL_3DP001V1 4207 // STEVAL-3DP001V1 3D PRINTER BOARD
|
||||
#define BOARD_BTT_SKR_PRO_V1_1 4208 // BigTreeTech SKR Pro v1.1 (STM32F407ZGT6)
|
||||
#define BOARD_BTT_SKR_PRO_V1_2 4209 // BigTreeTech SKR Pro v1.2 (STM32F407ZGT6)
|
||||
#define BOARD_BTT_BTT002_V1_0 4210 // BigTreeTech BTT002 v1.0 (STM32F407VGT6)
|
||||
#define BOARD_BTT_E3_RRF 4211 // BigTreeTech E3 RRF (STM32F407VGT6)
|
||||
#define BOARD_BTT_SKR_V2_0_REV_A 4212 // BigTreeTech SKR v2.0 Rev A (STM32F407VGT6)
|
||||
#define BOARD_BTT_SKR_V2_0_REV_B 4213 // BigTreeTech SKR v2.0 Rev B (STM32F407VGT6)
|
||||
#define BOARD_BTT_GTR_V1_0 4214 // BigTreeTech GTR v1.0 (STM32F407IGT)
|
||||
#define BOARD_BTT_OCTOPUS_V1_0 4215 // BigTreeTech Octopus v1.0 (STM32F446ZET6)
|
||||
#define BOARD_BTT_OCTOPUS_V1_1 4216 // BigTreeTech Octopus v1.1 (STM32F446ZET6)
|
||||
#define BOARD_LERDGE_K 4217 // Lerdge K (STM32F407ZG)
|
||||
#define BOARD_LERDGE_S 4218 // Lerdge S (STM32F407VE)
|
||||
#define BOARD_LERDGE_X 4219 // Lerdge X (STM32F407VE)
|
||||
#define BOARD_VAKE403D 4220 // VAkE 403D (STM32F446VET6)
|
||||
#define BOARD_FYSETC_S6 4221 // FYSETC S6 (STM32F446VET6)
|
||||
#define BOARD_FYSETC_S6_V2_0 4222 // FYSETC S6 v2.0 (STM32F446VET6)
|
||||
#define BOARD_FYSETC_SPIDER 4223 // FYSETC Spider (STM32F446VET6)
|
||||
#define BOARD_FLYF407ZG 4224 // FLYmaker FLYF407ZG (STM32F407ZG)
|
||||
#define BOARD_MKS_ROBIN2 4225 // MKS_ROBIN2 (STM32F407ZE)
|
||||
#define BOARD_MKS_ROBIN_PRO_V2 4226 // MKS Robin Pro V2 (STM32F407VE)
|
||||
#define BOARD_MKS_ROBIN_NANO_V3 4227 // MKS Robin Nano V3 (STM32F407VG)
|
||||
#define BOARD_MKS_MONSTER8 4228 // MKS Monster8 (STM32F407VGT6)
|
||||
#define BOARD_ANET_ET4 4229 // ANET ET4 V1.x (STM32F407VGT6)
|
||||
#define BOARD_ANET_ET4P 4230 // ANET ET4P V1.x (STM32F407VGT6)
|
||||
#define BOARD_FYSETC_CHEETAH_V20 4231 // FYSETC Cheetah V2.0
|
||||
#define BOARD_TH3D_EZBOARD_LITE_V2 4232 // TH3D EZBoard Lite v2.0
|
||||
|
||||
//
|
||||
// ARM Cortex M7
|
||||
|
||||
@@ -76,17 +76,6 @@ void serialprintPGM(PGM_P str) {
|
||||
void serial_echo_start() { static PGMSTR(echomagic, "echo:"); serialprintPGM(echomagic); }
|
||||
void serial_error_start() { static PGMSTR(errormagic, "Error:"); serialprintPGM(errormagic); }
|
||||
|
||||
void serial_echopair_PGM(PGM_P const s_P, serial_char_t v) { serialprintPGM(s_P); SERIAL_CHAR(v.c); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, char v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, float v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, double v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, unsigned char v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, unsigned int v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
void serial_echopair_PGM(PGM_P const s_P, unsigned long v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
|
||||
void serial_spaces(uint8_t count) { count *= (PROPORTIONAL_FONT_RATIO); while (count--) SERIAL_CHAR(' '); }
|
||||
|
||||
void serial_ternary(const bool onoff, PGM_P const pre, PGM_P const on, PGM_P const off, PGM_P const post/*=nullptr*/) {
|
||||
|
||||
+13
-16
@@ -88,7 +88,7 @@ extern uint8_t marlin_debug_flags;
|
||||
#if HAS_MULTI_SERIAL
|
||||
#define _PORT_REDIRECT(n,p) REMEMBER(n,multiSerial.portMask,p)
|
||||
#define _PORT_RESTORE(n,p) RESTORE(n)
|
||||
#define SERIAL_ASSERT(P) if(multiSerial.portMask!=(P)){ debugger(); }
|
||||
#define SERIAL_ASSERT(P) if (multiSerial.portMask!=(P)) { debugger(); }
|
||||
// If we have a catchall, use that directly
|
||||
#ifdef SERIAL_CATCHALL
|
||||
#define _SERIAL_LEAF_2 SERIAL_CATCHALL
|
||||
@@ -177,8 +177,8 @@ void SERIAL_ECHOLN(T x) { SERIAL_IMPL.println(x); }
|
||||
template <typename T, typename U>
|
||||
void SERIAL_PRINT(T x, U y) { SERIAL_IMPL.print(x, y); }
|
||||
|
||||
template <typename T, typename U>
|
||||
void SERIAL_PRINTLN(T x, U y) { SERIAL_IMPL.println(x, y); }
|
||||
template <typename T>
|
||||
void SERIAL_PRINTLN(T x, PrintBase y) { SERIAL_IMPL.println(x, y); }
|
||||
|
||||
// Flush the serial port
|
||||
inline void SERIAL_FLUSH() { SERIAL_IMPL.flush(); }
|
||||
@@ -293,21 +293,18 @@ void serialprintPGM(PGM_P str);
|
||||
//
|
||||
// Functions for serial printing from PROGMEM. (Saves loads of SRAM.)
|
||||
//
|
||||
void serial_echopair_PGM(PGM_P const s_P, serial_char_t v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, const char *v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, char v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, int v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, long v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, float v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, double v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, unsigned char v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, unsigned int v);
|
||||
void serial_echopair_PGM(PGM_P const s_P, unsigned long v);
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, serial_char_t v) { serialprintPGM(s_P); SERIAL_CHAR(v.c); }
|
||||
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, float v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, double v) { serialprintPGM(s_P); SERIAL_DECIMAL(v); }
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, const char *v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
|
||||
// Default implementation for types without a specialization. Handles integers.
|
||||
template <typename T>
|
||||
void serial_echopair_PGM(PGM_P const s_P, T v) { serialprintPGM(s_P); SERIAL_ECHO(v); }
|
||||
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, bool v) { serial_echopair_PGM(s_P, (int)v); }
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, void *v) { serial_echopair_PGM(s_P, (uintptr_t)v); }
|
||||
#if __INTPTR_WIDTH__ != __SIZE_WIDTH__
|
||||
inline void serial_echopair_PGM(PGM_P const s_P, size_t v) { serial_echopair_PGM(s_P, (long int)v); }
|
||||
#endif
|
||||
|
||||
void serial_echo_start();
|
||||
void serial_error_start();
|
||||
|
||||
@@ -74,12 +74,12 @@ CALL_IF_EXISTS_IMPL(SerialFeature, features, SerialFeature::None);
|
||||
// for any type other than double/float. For double/float, a conversion exists so the call will be invisible.
|
||||
struct EnsureDouble {
|
||||
double a;
|
||||
FORCE_INLINE operator double() { return a; }
|
||||
operator double() { return a; }
|
||||
// If the compiler breaks on ambiguity here, it's likely because print(X, base) is called with X not a double/float, and
|
||||
// a base that's not a PrintBase value. This code is made to detect the error. You MUST set a base explicitly like this:
|
||||
// SERIAL_PRINT(v, PrintBase::Hex)
|
||||
FORCE_INLINE EnsureDouble(double a) : a(a) {}
|
||||
FORCE_INLINE EnsureDouble(float a) : a(a) {}
|
||||
EnsureDouble(double a) : a(a) {}
|
||||
EnsureDouble(float a) : a(a) {}
|
||||
};
|
||||
|
||||
// Using Curiously-Recurring Template Pattern here to avoid virtual table cost when compiling.
|
||||
@@ -136,70 +136,90 @@ struct SerialBase {
|
||||
void flushTX() { CALL_IF_EXISTS(void, SerialChild, flushTX); }
|
||||
|
||||
// Glue code here
|
||||
FORCE_INLINE void write(const char *str) { while (*str) write(*str++); }
|
||||
FORCE_INLINE void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); }
|
||||
FORCE_INLINE void print(const char *str) { write(str); }
|
||||
void write(const char *str) { while (*str) write(*str++); }
|
||||
void write(const uint8_t *buffer, size_t size) { while (size--) write(*buffer++); }
|
||||
void print(char *str) { write(str); }
|
||||
void print(const char *str) { write(str); }
|
||||
// No default argument to avoid ambiguity
|
||||
NO_INLINE void print(char c, PrintBase base) { printNumber((signed long)c, (uint8_t)base); }
|
||||
NO_INLINE void print(unsigned char c, PrintBase base) { printNumber((unsigned long)c, (uint8_t)base); }
|
||||
NO_INLINE void print(int c, PrintBase base) { printNumber((signed long)c, (uint8_t)base); }
|
||||
NO_INLINE void print(unsigned int c, PrintBase base) { printNumber((unsigned long)c, (uint8_t)base); }
|
||||
void print(unsigned long c, PrintBase base) { printNumber((unsigned long)c, (uint8_t)base); }
|
||||
void print(long c, PrintBase base) { printNumber((signed long)c, (uint8_t)base); }
|
||||
void print(EnsureDouble c, int digits) { printFloat(c, digits); }
|
||||
|
||||
// Define print for every fundamental integer type, to ensure that all redirect properly
|
||||
// to the correct underlying implementation.
|
||||
|
||||
// Prints are performed with a single size, to avoid needing multiple print functions.
|
||||
// The fixed integer size used for prints will be the larger of long or a pointer.
|
||||
#if __LONG_WIDTH__ >= __INTPTR_WIDTH__
|
||||
typedef long int_fixed_print_t;
|
||||
typedef unsigned long uint_fixed_print_t;
|
||||
#else
|
||||
typedef intptr_t int_fixed_print_t;
|
||||
typedef uintptr_t uint_fixed_print_t;
|
||||
|
||||
FORCE_INLINE void print(intptr_t c, PrintBase base) { printNumber_signed(c, base); }
|
||||
FORCE_INLINE void print(uintptr_t c, PrintBase base) { printNumber_unsigned(c, base); }
|
||||
#endif
|
||||
|
||||
FORCE_INLINE void print(char c, PrintBase base) { printNumber_signed(c, base); }
|
||||
FORCE_INLINE void print(short c, PrintBase base) { printNumber_signed(c, base); }
|
||||
FORCE_INLINE void print(int c, PrintBase base) { printNumber_signed(c, base); }
|
||||
FORCE_INLINE void print(long c, PrintBase base) { printNumber_signed(c, base); }
|
||||
FORCE_INLINE void print(unsigned char c, PrintBase base) { printNumber_unsigned(c, base); }
|
||||
FORCE_INLINE void print(unsigned short c, PrintBase base) { printNumber_unsigned(c, base); }
|
||||
FORCE_INLINE void print(unsigned int c, PrintBase base) { printNumber_unsigned(c, base); }
|
||||
FORCE_INLINE void print(unsigned long c, PrintBase base) { printNumber_unsigned(c, base); }
|
||||
|
||||
|
||||
void print(EnsureDouble c, int digits) { printFloat(c, digits); }
|
||||
|
||||
// Forward the call to the former's method
|
||||
FORCE_INLINE void print(char c) { print(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void print(unsigned char c) { print(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void print(int c) { print(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void print(unsigned int c) { print(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void print(unsigned long c) { print(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void print(long c) { print(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void print(double c) { print(c, 2); }
|
||||
|
||||
FORCE_INLINE void println(const char s[]) { print(s); println(); }
|
||||
FORCE_INLINE void println(char c, PrintBase base) { print(c, base); println(); }
|
||||
FORCE_INLINE void println(unsigned char c, PrintBase base) { print(c, base); println(); }
|
||||
FORCE_INLINE void println(int c, PrintBase base) { print(c, base); println(); }
|
||||
FORCE_INLINE void println(unsigned int c, PrintBase base) { print(c, base); println(); }
|
||||
FORCE_INLINE void println(long c, PrintBase base) { print(c, base); println(); }
|
||||
FORCE_INLINE void println(unsigned long c, PrintBase base) { print(c, base); println(); }
|
||||
FORCE_INLINE void println(double c, int digits) { print(c, digits); println(); }
|
||||
FORCE_INLINE void println() { write('\r'); write('\n'); }
|
||||
// Default implementation for anything without a specialization
|
||||
// This handles integers since they are the most common
|
||||
template <typename T>
|
||||
void print(T c) { print(c, PrintBase::Dec); }
|
||||
|
||||
void print(float c) { print(c, 2); }
|
||||
void print(double c) { print(c, 2); }
|
||||
|
||||
void println(char *s) { print(s); println(); }
|
||||
void println(const char *s) { print(s); println(); }
|
||||
void println(float c, int digits) { print(c, digits); println(); }
|
||||
void println(double c, int digits) { print(c, digits); println(); }
|
||||
void println() { write('\r'); write('\n'); }
|
||||
|
||||
// Default implementations for types without a specialization. Handles integers.
|
||||
template <typename T>
|
||||
void println(T c, PrintBase base) { print(c, base); println(); }
|
||||
|
||||
template <typename T>
|
||||
void println(T c) { println(c, PrintBase::Dec); }
|
||||
|
||||
// Forward the call to the former's method
|
||||
FORCE_INLINE void println(char c) { println(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void println(unsigned char c) { println(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void println(int c) { println(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void println(unsigned int c) { println(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void println(unsigned long c) { println(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void println(long c) { println(c, PrintBase::Dec); }
|
||||
FORCE_INLINE void println(double c) { println(c, 2); }
|
||||
void println(float c) { println(c, 2); }
|
||||
void println(double c) { println(c, 2); }
|
||||
|
||||
// Print a number with the given base
|
||||
NO_INLINE void printNumber(unsigned long n, const uint8_t base) {
|
||||
if (!base) return; // Hopefully, this should raise visible bug immediately
|
||||
|
||||
NO_INLINE void printNumber_unsigned(uint_fixed_print_t n, PrintBase 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;
|
||||
buf[i++] = n % (uint_fixed_print_t)base;
|
||||
n /= (uint_fixed_print_t)base;
|
||||
}
|
||||
while (i--) write((char)(buf[i] + (buf[i] < 10 ? '0' : 'A' - 10)));
|
||||
}
|
||||
else write('0');
|
||||
}
|
||||
void printNumber(signed long n, const uint8_t base) {
|
||||
if (base == 10 && n < 0) {
|
||||
|
||||
NO_INLINE void printNumber_signed(int_fixed_print_t n, PrintBase base) {
|
||||
if (base == PrintBase::Dec && n < 0) {
|
||||
n = -n; // This works because all platforms Marlin's builds on are using 2-complement encoding for negative number
|
||||
// On such CPU, changing the sign of a number is done by inverting the bits and adding one, so if n = 0x80000000 = -2147483648 then
|
||||
// -n = 0x7FFFFFFF + 1 => 0x80000000 = 2147483648 (if interpreted as unsigned) or -2147483648 if interpreted as signed.
|
||||
// On non 2-complement CPU, there would be no possible representation for 2147483648.
|
||||
write('-');
|
||||
}
|
||||
printNumber((unsigned long)n , base);
|
||||
printNumber_unsigned((uint_fixed_print_t)n , base);
|
||||
}
|
||||
|
||||
// Print a decimal number
|
||||
@@ -218,7 +238,7 @@ struct SerialBase {
|
||||
// Extract the integer part of the number and print it
|
||||
unsigned long int_part = (unsigned long)number;
|
||||
double remainder = number - (double)int_part;
|
||||
printNumber(int_part, 10);
|
||||
printNumber_unsigned(int_part, PrintBase::Dec);
|
||||
|
||||
// Print the decimal point, but only if there are digits beyond
|
||||
if (digits) {
|
||||
@@ -227,7 +247,7 @@ struct SerialBase {
|
||||
while (digits--) {
|
||||
remainder *= 10.0;
|
||||
unsigned long toPrint = (unsigned long)remainder;
|
||||
printNumber(toPrint, 10);
|
||||
printNumber_unsigned(toPrint, PrintBase::Dec);
|
||||
remainder -= toPrint;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,9 +148,9 @@ public:
|
||||
case FileTransfer::QUERY:
|
||||
SERIAL_ECHOPAIR("PFT:version:", VERSION_MAJOR, ".", VERSION_MINOR, ".", VERSION_PATCH);
|
||||
#if ENABLED(BINARY_STREAM_COMPRESSION)
|
||||
SERIAL_ECHOLNPAIR(":compresion:heatshrink,", HEATSHRINK_STATIC_WINDOW_BITS, ",", HEATSHRINK_STATIC_LOOKAHEAD_BITS);
|
||||
SERIAL_ECHOLNPAIR(":compression:heatshrink,", HEATSHRINK_STATIC_WINDOW_BITS, ",", HEATSHRINK_STATIC_LOOKAHEAD_BITS);
|
||||
#else
|
||||
SERIAL_ECHOLNPGM(":compresion:none");
|
||||
SERIAL_ECHOLNPGM(":compression:none");
|
||||
#endif
|
||||
break;
|
||||
case FileTransfer::OPEN:
|
||||
|
||||
@@ -20,35 +20,35 @@ void dac084s085::begin() {
|
||||
uint8_t externalDac_buf[] = { 0x20, 0x00 }; // all off
|
||||
|
||||
// All SPI chip-select HIGH
|
||||
SET_OUTPUT(DAC0_SYNC);
|
||||
SET_OUTPUT(DAC0_SYNC_PIN);
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
SET_OUTPUT(DAC1_SYNC);
|
||||
SET_OUTPUT(DAC1_SYNC_PIN);
|
||||
#endif
|
||||
cshigh();
|
||||
spiBegin();
|
||||
|
||||
//init onboard DAC
|
||||
DELAY_US(2);
|
||||
WRITE(DAC0_SYNC, LOW);
|
||||
WRITE(DAC0_SYNC_PIN, LOW);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC0_SYNC, HIGH);
|
||||
WRITE(DAC0_SYNC_PIN, HIGH);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC0_SYNC, LOW);
|
||||
WRITE(DAC0_SYNC_PIN, LOW);
|
||||
|
||||
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
|
||||
WRITE(DAC0_SYNC, HIGH);
|
||||
WRITE(DAC0_SYNC_PIN, HIGH);
|
||||
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
//init Piggy DAC
|
||||
DELAY_US(2);
|
||||
WRITE(DAC1_SYNC, LOW);
|
||||
WRITE(DAC1_SYNC_PIN, LOW);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC1_SYNC, HIGH);
|
||||
WRITE(DAC1_SYNC_PIN, HIGH);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC1_SYNC, LOW);
|
||||
WRITE(DAC1_SYNC_PIN, LOW);
|
||||
|
||||
spiSend(SPI_CHAN_DAC, externalDac_buf, COUNT(externalDac_buf));
|
||||
WRITE(DAC1_SYNC, HIGH);
|
||||
WRITE(DAC1_SYNC_PIN, HIGH);
|
||||
#endif
|
||||
|
||||
return;
|
||||
@@ -66,18 +66,18 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
|
||||
cshigh();
|
||||
|
||||
if (channel > 3) { // DAC Piggy E1,E2,E3
|
||||
WRITE(DAC1_SYNC, LOW);
|
||||
WRITE(DAC1_SYNC_PIN, LOW);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC1_SYNC, HIGH);
|
||||
WRITE(DAC1_SYNC_PIN, HIGH);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC1_SYNC, LOW);
|
||||
WRITE(DAC1_SYNC_PIN, LOW);
|
||||
}
|
||||
else { // DAC onboard X,Y,Z,E0
|
||||
WRITE(DAC0_SYNC, LOW);
|
||||
WRITE(DAC0_SYNC_PIN, LOW);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC0_SYNC, HIGH);
|
||||
WRITE(DAC0_SYNC_PIN, HIGH);
|
||||
DELAY_US(2);
|
||||
WRITE(DAC0_SYNC, LOW);
|
||||
WRITE(DAC0_SYNC_PIN, LOW);
|
||||
}
|
||||
|
||||
DELAY_US(2);
|
||||
@@ -85,13 +85,13 @@ void dac084s085::setValue(const uint8_t channel, const uint8_t value) {
|
||||
}
|
||||
|
||||
void dac084s085::cshigh() {
|
||||
WRITE(DAC0_SYNC, HIGH);
|
||||
WRITE(DAC0_SYNC_PIN, HIGH);
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
WRITE(DAC1_SYNC, HIGH);
|
||||
WRITE(DAC1_SYNC_PIN, HIGH);
|
||||
#endif
|
||||
WRITE(SPI_EEPROM1_CS, HIGH);
|
||||
WRITE(SPI_EEPROM2_CS, HIGH);
|
||||
WRITE(SPI_FLASH_CS, HIGH);
|
||||
WRITE(SPI_EEPROM1_CS_PIN, HIGH);
|
||||
WRITE(SPI_EEPROM2_CS_PIN, HIGH);
|
||||
WRITE(SPI_FLASH_CS_PIN, HIGH);
|
||||
WRITE(SD_SS_PIN, HIGH);
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ void MarlinEthernet::check() {
|
||||
" | Author: " STRING_CONFIG_H_AUTHOR
|
||||
);
|
||||
#endif
|
||||
telnetClient.println("Compiled: " __DATE__);
|
||||
telnetClient.println(" Compiled: " __DATE__);
|
||||
|
||||
SERIAL_ECHOLNPGM("Client connected");
|
||||
have_telnet_client = true;
|
||||
|
||||
@@ -169,14 +169,12 @@ void Mixer::refresh_collector(const float proportion/*=1.0*/, const uint8_t t/*=
|
||||
#include "../module/planner.h"
|
||||
|
||||
gradient_t Mixer::gradient = {
|
||||
false, // enabled
|
||||
{0}, // color (array)
|
||||
0, 0, // start_z, end_z
|
||||
0, 1, // start_vtool, end_vtool
|
||||
{0}, {0} // start_mix[], end_mix[]
|
||||
#if ENABLED(GRADIENT_VTOOL)
|
||||
, -1 // vtool_index
|
||||
#endif
|
||||
false, // enabled
|
||||
{0}, // color (array)
|
||||
0, 0, // start_z, end_z
|
||||
0, 1, // start_vtool, end_vtool
|
||||
{0}, {0} // start_mix[], end_mix[]
|
||||
OPTARG(GRADIENT_VTOOL, -1) // vtool_index
|
||||
};
|
||||
|
||||
float Mixer::prev_z; // = 0
|
||||
|
||||
@@ -191,13 +191,14 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
|
||||
|
||||
KEEPALIVE_STATE(PAUSED_FOR_USER);
|
||||
wait_for_user = true; // LCD click or M108 will clear this
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
|
||||
|
||||
#if ENABLED(HOST_PROMPT_SUPPORT)
|
||||
const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, active_extruder);
|
||||
host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Load Filament T"), tool, CONTINUE_STR);
|
||||
#endif
|
||||
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Load Filament")));
|
||||
|
||||
while (wait_for_user) {
|
||||
impatient_beep(max_beep_count);
|
||||
idle_no_sleep();
|
||||
@@ -237,8 +238,8 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
|
||||
|
||||
if (show_lcd) ui.pause_show_message(PAUSE_MESSAGE_PURGE);
|
||||
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purging..."), CONTINUE_STR));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Filament Purging...")));
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(GET_TEXT(MSG_FILAMENT_CHANGE_PURGE)));
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, GET_TEXT(MSG_FILAMENT_CHANGE_PURGE), CONTINUE_STR));
|
||||
wait_for_user = true; // A click or M108 breaks the purge_length loop
|
||||
for (float purge_count = purge_length; purge_count > 0 && wait_for_user; --purge_count)
|
||||
unscaled_e_move(1, ADVANCED_PAUSE_PURGE_FEEDRATE);
|
||||
@@ -272,7 +273,7 @@ bool load_filament(const_float_t slow_load_length/*=0*/, const_float_t fast_load
|
||||
#endif
|
||||
|
||||
// Keep looping if "Purge More" was selected
|
||||
} while (TERN0(M600_PURGE_MORE_RESUMABLE, show_lcd && pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
|
||||
} while (TERN0(M600_PURGE_MORE_RESUMABLE, pause_menu_response == PAUSE_RESPONSE_EXTRUDE_MORE));
|
||||
|
||||
#endif
|
||||
TERN_(HOST_PROMPT_SUPPORT, host_action_prompt_end());
|
||||
|
||||
@@ -38,16 +38,12 @@ int16_t ProbeTempComp::z_offsets_probe[cali_info_init[TSI_PROBE].measurements],
|
||||
|
||||
int16_t *ProbeTempComp::sensor_z_offsets[TSI_COUNT] = {
|
||||
ProbeTempComp::z_offsets_probe, ProbeTempComp::z_offsets_bed
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
, ProbeTempComp::z_offsets_ext
|
||||
#endif
|
||||
OPTARG(USE_TEMP_EXT_COMPENSATION, ProbeTempComp::z_offsets_ext)
|
||||
};
|
||||
|
||||
const temp_calib_t ProbeTempComp::cali_info[TSI_COUNT] = {
|
||||
cali_info_init[TSI_PROBE], cali_info_init[TSI_BED]
|
||||
#if ENABLED(USE_TEMP_EXT_COMPENSATION)
|
||||
, cali_info_init[TSI_EXT]
|
||||
#endif
|
||||
OPTARG(USE_TEMP_EXT_COMPENSATION, cali_info_init[TSI_EXT])
|
||||
};
|
||||
|
||||
constexpr xyz_pos_t ProbeTempComp::park_point;
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
#if ENABLED(STOP_ON_ERROR)
|
||||
void report_driver_error(const TMC_driver_data &data) {
|
||||
SERIAL_ECHOPGM(" driver error detected: 0x");
|
||||
SERIAL_PRINTLN(data.drv_status, HEX);
|
||||
SERIAL_PRINTLN(data.drv_status, PrintBase::Hex);
|
||||
if (data.is_ot) SERIAL_ECHOLNPGM("overtemperature");
|
||||
if (data.is_s2g) SERIAL_ECHOLNPGM("coil short circuit");
|
||||
TERN_(TMC_DEBUG, tmc_report_all());
|
||||
|
||||
@@ -330,7 +330,7 @@ void tmc_print_current(TMC &st) {
|
||||
void tmc_print_sgt(TMC &st) {
|
||||
st.printLabel();
|
||||
SERIAL_ECHOPGM(" homing sensitivity: ");
|
||||
SERIAL_PRINTLN(st.homing_threshold(), DEC);
|
||||
SERIAL_PRINTLN(st.homing_threshold(), PrintBase::Dec);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -363,8 +363,6 @@ G29_TYPE GcodeSuite::G29() {
|
||||
#if ABL_USES_GRID
|
||||
|
||||
xy_probe_feedrate_mm_s = MMM_TO_MMS(parser.linearval('S', XY_PROBE_FEEDRATE));
|
||||
if (!xy_probe_feedrate_mm_s) xy_probe_feedrate_mm_s = PLANNER_XY_FEEDRATE();
|
||||
NOLESS(xy_probe_feedrate_mm_s, planner.settings.min_feedrate_mm_s);
|
||||
|
||||
const float x_min = probe.min_x(), x_max = probe.max_x(),
|
||||
y_min = probe.min_y(), y_max = probe.max_y();
|
||||
@@ -880,9 +878,7 @@ G29_TYPE GcodeSuite::G29() {
|
||||
// Sync the planner from the current_position
|
||||
if (planner.leveling_active) sync_plan_position();
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
probe.move_z_after_probing();
|
||||
#endif
|
||||
TERN_(HAS_BED_PROBE, probe.move_z_after_probing());
|
||||
|
||||
#ifdef Z_PROBE_END_SCRIPT
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Z Probe End Script: ", Z_PROBE_END_SCRIPT);
|
||||
|
||||
@@ -52,19 +52,25 @@ void GcodeSuite::M575() {
|
||||
case 2400: case 9600: case 19200: case 38400: case 57600:
|
||||
case 115200: case 250000: case 500000: case 1000000: {
|
||||
const int8_t port = parser.intval('P', -99);
|
||||
const bool set0 = (port == -99 || port == 0);
|
||||
if (set0) SERIAL_ECHO_MSG(" Serial ", '0', " baud rate set to ", baud);
|
||||
const bool set1 = (port == -99 || port == 0);
|
||||
if (set1) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('0'), " baud rate set to ", baud);
|
||||
#if HAS_MULTI_SERIAL
|
||||
const bool set1 = (port == -99 || port == 1);
|
||||
if (set1) SERIAL_ECHO_MSG(" Serial ", '1', " baud rate set to ", baud);
|
||||
const bool set2 = (port == -99 || port == 1);
|
||||
if (set2) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('1'), " baud rate set to ", baud);
|
||||
#ifdef SERIAL_PORT_3
|
||||
const bool set3 = (port == -99 || port == 2);
|
||||
if (set3) SERIAL_ECHO_MSG(" Serial ", AS_CHAR('2'), " baud rate set to ", baud);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
SERIAL_FLUSH();
|
||||
|
||||
if (set0) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
|
||||
|
||||
if (set1) { MYSERIAL1.end(); MYSERIAL1.begin(baud); }
|
||||
#if HAS_MULTI_SERIAL
|
||||
if (set1) { MYSERIAL2.end(); MYSERIAL2.begin(baud); }
|
||||
if (set2) { MYSERIAL2.end(); MYSERIAL2.begin(baud); }
|
||||
#ifdef SERIAL_PORT_3
|
||||
if (set3) { MYSERIAL3.end(); MYSERIAL3.begin(baud); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
} break;
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
* a print without suicide...
|
||||
*/
|
||||
#if HAS_SUICIDE
|
||||
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_INVERTING);
|
||||
OUT_WRITE(SUICIDE_PIN, !SUICIDE_PIN_STATE);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_LCD_MENU, ui.reset_status());
|
||||
|
||||
@@ -135,17 +135,8 @@ void GcodeSuite::M240() {
|
||||
};
|
||||
|
||||
#ifdef PHOTO_RETRACT_MM
|
||||
const float rval = parser.seenval('R') ? parser.value_linear_units() : _PHOTO_RETRACT_MM;
|
||||
feedRate_t sval = (
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
PAUSE_PARK_RETRACT_FEEDRATE
|
||||
#elif ENABLED(FWRETRACT)
|
||||
RETRACT_FEEDRATE
|
||||
#else
|
||||
45
|
||||
#endif
|
||||
);
|
||||
if (parser.seenval('S')) sval = parser.value_feedrate();
|
||||
const float rval = parser.linearval('R', _PHOTO_RETRACT_MM);
|
||||
const feedRate_t sval = parser.feedrateval('S', TERN(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_RETRACT_FEEDRATE, TERN(FWRETRACT, RETRACT_FEEDRATE, 45)));
|
||||
e_move_m240(-rval, sval);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -32,16 +32,7 @@
|
||||
* G10 - Retract filament according to settings of M207
|
||||
* TODO: Handle 'G10 P' for tool settings and 'G10 L' for workspace settings
|
||||
*/
|
||||
void GcodeSuite::G10() {
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
const bool rs = parser.boolval('S');
|
||||
#endif
|
||||
fwretract.retract(true
|
||||
#if HAS_MULTI_EXTRUDER
|
||||
, rs
|
||||
#endif
|
||||
);
|
||||
}
|
||||
void GcodeSuite::G10() { fwretract.retract(true OPTARG(HAS_MULTI_EXTRUDER, parser.boolval('S'))); }
|
||||
|
||||
/**
|
||||
* G11 - Recover filament according to settings of M208
|
||||
|
||||
@@ -114,9 +114,7 @@ void GcodeSuite::M701() {
|
||||
true, // show_lcd
|
||||
thermalManager.still_heating(target_extruder), // pause_for_user
|
||||
PAUSE_MODE_LOAD_FILAMENT // pause_mode
|
||||
#if ENABLED(DUAL_X_CARRIAGE)
|
||||
, target_extruder // Dual X target
|
||||
#endif
|
||||
OPTARG(DUAL_X_CARRIAGE, target_extruder) // Dual X target
|
||||
);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -43,10 +43,13 @@ void GcodeSuite::M122() {
|
||||
|
||||
#if ENABLED(TMC_DEBUG)
|
||||
#if ENABLED(MONITOR_DRIVER_STATUS)
|
||||
uint16_t interval = MONITOR_DRIVER_STATUS_INTERVAL_MS;
|
||||
if (parser.seen('S') && !parser.value_bool()) interval = 0;
|
||||
if (parser.seenval('P')) NOMORE(interval, parser.value_ushort());
|
||||
tmc_set_report_interval(interval);
|
||||
const bool sflag = parser.seen_test('S'), sval = sflag && parser.value_bool();
|
||||
if (sflag && !sval)
|
||||
tmc_set_report_interval(0);
|
||||
else if (parser.seenval('P'))
|
||||
tmc_set_report_interval(_MAX(250, parser.value_ushort()));
|
||||
else if (sval)
|
||||
tmc_set_report_interval(MONITOR_DRIVER_STATUS_INTERVAL_MS);
|
||||
#endif
|
||||
|
||||
if (parser.seen_test('V'))
|
||||
|
||||
@@ -166,9 +166,11 @@ void GcodeSuite::M115() {
|
||||
|
||||
// Machine Geometry
|
||||
#if ENABLED(M115_GEOMETRY_REPORT)
|
||||
const xyz_pos_t dmin = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
|
||||
const xyz_pos_t bmin = { 0, 0, 0 },
|
||||
bmax = { X_BED_SIZE , Y_BED_SIZE, Z_MAX_POS },
|
||||
dmin = { X_MIN_POS, Y_MIN_POS, Z_MIN_POS },
|
||||
dmax = { X_MAX_POS, Y_MAX_POS, Z_MAX_POS };
|
||||
xyz_pos_t cmin = dmin, cmax = dmax;
|
||||
xyz_pos_t cmin = bmin, cmax = bmax;
|
||||
apply_motion_limits(cmin);
|
||||
apply_motion_limits(cmax);
|
||||
const xyz_pos_t lmin = dmin.asLogical(), lmax = dmax.asLogical(),
|
||||
|
||||
@@ -40,7 +40,7 @@ void GcodeSuite::M73() {
|
||||
? parser.value_float() * (PROGRESS_SCALE)
|
||||
: parser.value_byte()
|
||||
);
|
||||
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
|
||||
#if ENABLED(USE_M73_REMAINING_TIME)
|
||||
if (parser.seenval('R')) ui.set_remaining_time(60 * parser.value_ulong());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#include "../gcode.h"
|
||||
|
||||
#if ENABLED(TFT_LVGL_UI)
|
||||
#if HAS_TFT_LVGL_UI
|
||||
#include "../../lcd/extui/mks_ui/draw_touch_calibration.h"
|
||||
#else
|
||||
#include "../../lcd/menu/menu.h"
|
||||
@@ -37,7 +37,7 @@
|
||||
*/
|
||||
void GcodeSuite::M995() {
|
||||
|
||||
#if ENABLED(TFT_LVGL_UI)
|
||||
#if HAS_TFT_LVGL_UI
|
||||
lv_draw_touch_calibration_screen();
|
||||
#else
|
||||
ui.goto_screen(touch_screen_calibration);
|
||||
|
||||
@@ -416,7 +416,8 @@ public:
|
||||
static inline float linearval(const char c, const float dval=0) { return seenval(c) ? value_linear_units() : dval; }
|
||||
static inline float axisunitsval(const char c, const AxisEnum a, const float dval=0)
|
||||
{ return seenval(c) ? value_axis_units(a) : dval; }
|
||||
static inline celsius_t celsiusval(const char c, const float dval=0) { return seenval(c) ? value_celsius() : dval; }
|
||||
static inline celsius_t celsiusval(const char c, const celsius_t dval=0) { return seenval(c) ? value_celsius() : dval; }
|
||||
static inline feedRate_t feedrateval(const char c, const feedRate_t dval=0) { return seenval(c) ? value_feedrate() : dval; }
|
||||
|
||||
#if ENABLED(MARLIN_DEV_MODE)
|
||||
|
||||
|
||||
@@ -118,11 +118,7 @@ bool GCodeQueue::RingBuffer::enqueue(const char *cmd, bool skip_ok/*=true*/
|
||||
) {
|
||||
if (*cmd == ';' || length >= BUFSIZE) return false;
|
||||
strcpy(commands[index_w].buffer, cmd);
|
||||
commit_command(skip_ok
|
||||
#if HAS_MULTI_SERIAL
|
||||
, serial_ind
|
||||
#endif
|
||||
);
|
||||
commit_command(skip_ok OPTARG(HAS_MULTI_SERIAL, serial_ind));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -538,11 +534,7 @@ void GCodeQueue::get_serial_commands() {
|
||||
#endif
|
||||
|
||||
// Add the command to the queue
|
||||
ring_buffer.enqueue(serial.line_buffer, false
|
||||
#if HAS_MULTI_SERIAL
|
||||
, p
|
||||
#endif
|
||||
);
|
||||
ring_buffer.enqueue(serial.line_buffer, false OPTARG(HAS_MULTI_SERIAL, p));
|
||||
}
|
||||
else
|
||||
process_stream_char(serial_char, serial.input_state, serial.line_buffer, serial.count);
|
||||
|
||||
@@ -488,7 +488,10 @@
|
||||
#define HAS_MARLINUI_U8GLIB 1
|
||||
#elif IS_TFTGLCD_PANEL
|
||||
// Neither DOGM nor HD44780. Fully customized interface.
|
||||
#elif DISABLED(HAS_GRAPHICAL_TFT)
|
||||
#elif IS_DWIN_MARLINUI
|
||||
// Since HAS_MARLINUI_U8GLIB refers to U8G displays
|
||||
// the DWIN display can define its own flags
|
||||
#elif !HAS_GRAPHICAL_TFT
|
||||
#define HAS_MARLINUI_HD44780 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -1087,7 +1090,7 @@
|
||||
#define HAS_ETHERNET 1
|
||||
#endif
|
||||
|
||||
#if ENABLED(DWIN_CREALITY_LCD)
|
||||
#if EITHER(DWIN_CREALITY_LCD, IS_DWIN_MARLINUI)
|
||||
#define SERIAL_CATCHALL 0
|
||||
#ifndef LCD_SERIAL_PORT
|
||||
#if MB(BTT_SKR_MINI_E3_V1_0, BTT_SKR_MINI_E3_V1_2, BTT_SKR_MINI_E3_V2_0, BTT_SKR_E3_TURBO)
|
||||
|
||||
@@ -461,7 +461,7 @@
|
||||
|
||||
#endif
|
||||
|
||||
#if ANY(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT) || !PIN_EXISTS(SD_DETECT)
|
||||
#if ANY(HAS_GRAPHICAL_TFT, LCD_USE_DMA_FSMC, HAS_FSMC_GRAPHICAL_TFT, HAS_SPI_GRAPHICAL_TFT, IS_DWIN_MARLINUI) || !PIN_EXISTS(SD_DETECT)
|
||||
#define NO_LCD_REINIT 1 // Suppress LCD re-initialization
|
||||
#endif
|
||||
|
||||
@@ -2122,83 +2122,78 @@
|
||||
#define IS_Z4_ENDSTOP(A,M) (ENABLED(Z_MULTI_ENDSTOPS) && NUM_Z_STEPPER_DRIVERS >= 4 && Z4_USE_ENDSTOP == _##A##M##_)
|
||||
|
||||
#define _HAS_STOP(A,M) (PIN_EXISTS(A##_##M) && !IS_PROBE_PIN(A,M) && !IS_X2_ENDSTOP(A,M) && !IS_Y2_ENDSTOP(A,M) && !IS_Z2_ENDSTOP(A,M) && !IS_Z3_ENDSTOP(A,M) && !IS_Z4_ENDSTOP(A,M))
|
||||
#if BOTH(X_HOME_TO_MIN, USE_XMIN_PLUG) && _HAS_STOP(X,MIN)
|
||||
#if _HAS_STOP(X,MIN)
|
||||
#define HAS_X_MIN 1
|
||||
#endif
|
||||
#if (BOTH(X_HOME_TO_MAX, USE_XMAX_PLUG) || ENABLED(DUAL_X_CARRIAGE)) && _HAS_STOP(X,MAX)
|
||||
#if _HAS_STOP(X,MAX)
|
||||
#define HAS_X_MAX 1
|
||||
#endif
|
||||
#if ALL(HAS_Y_AXIS, Y_HOME_TO_MIN, USE_YMIN_PLUG) && _HAS_STOP(Y,MIN)
|
||||
#if _HAS_STOP(Y,MIN)
|
||||
#define HAS_Y_MIN 1
|
||||
#endif
|
||||
#if ALL(HAS_Y_AXIS, Y_HOME_TO_MAX, USE_YMAX_PLUG) && _HAS_STOP(Y,MAX)
|
||||
#if _HAS_STOP(Y,MAX)
|
||||
#define HAS_Y_MAX 1
|
||||
#endif
|
||||
#if BOTH(HAS_Z_AXIS, USE_ZMIN_PLUG) && _HAS_STOP(Z,MIN)
|
||||
#if _HAS_STOP(Z,MIN)
|
||||
#define HAS_Z_MIN 1
|
||||
#endif
|
||||
#if ALL(HAS_Z_AXIS, Z_HOME_TO_MAX, USE_ZMAX_PLUG) && _HAS_STOP(Z,MAX)
|
||||
#if _HAS_STOP(Z,MAX)
|
||||
#define HAS_Z_MAX 1
|
||||
#endif
|
||||
#if LINEAR_AXES >= 4 && BOTH(I_HOME_TO_MIN, USE_IMIN_PLUG) && _HAS_STOP(I,MIN)
|
||||
#if _HAS_STOP(I,MIN)
|
||||
#define HAS_I_MIN 1
|
||||
#endif
|
||||
#if LINEAR_AXES >= 4 && BOTH(I_HOME_TO_MAX, USE_IMAX_PLUG) && _HAS_STOP(I,MAX)
|
||||
#if _HAS_STOP(I,MAX)
|
||||
#define HAS_I_MAX 1
|
||||
#endif
|
||||
#if LINEAR_AXES >= 5 && BOTH(J_HOME_TO_MIN, USE_JMIN_PLUG) && _HAS_STOP(J,MIN)
|
||||
#if _HAS_STOP(J,MIN)
|
||||
#define HAS_J_MIN 1
|
||||
#endif
|
||||
#if LINEAR_AXES >= 5 && BOTH(J_HOME_TO_MAX, USE_JMAX_PLUG) && _HAS_STOP(J,MAX)
|
||||
#if _HAS_STOP(J,MAX)
|
||||
#define HAS_J_MAX 1
|
||||
#endif
|
||||
#if LINEAR_AXES >= 6 && BOTH(K_HOME_TO_MIN, USE_KMIN_PLUG) && _HAS_STOP(K,MIN)
|
||||
#if _HAS_STOP(K,MIN)
|
||||
#define HAS_K_MIN 1
|
||||
#endif
|
||||
#if LINEAR_AXES >= 6 && BOTH(K_HOME_TO_MAX, USE_KMAX_PLUG) && _HAS_STOP(K,MAX)
|
||||
#if _HAS_STOP(K,MAX)
|
||||
#define HAS_K_MAX 1
|
||||
#endif
|
||||
#if BOTH(X_HOME_TO_MIN, X_DUAL_ENDSTOPS) && PIN_EXISTS(X2_MIN)
|
||||
#if PIN_EXISTS(X2_MIN)
|
||||
#define HAS_X2_MIN 1
|
||||
#endif
|
||||
#if BOTH(X_HOME_TO_MAX, X_DUAL_ENDSTOPS) && PIN_EXISTS(X2_MAX)
|
||||
#if PIN_EXISTS(X2_MAX)
|
||||
#define HAS_X2_MAX 1
|
||||
#endif
|
||||
#if BOTH(Y_HOME_TO_MIN, Y_DUAL_ENDSTOPS) && PIN_EXISTS(Y2_MIN)
|
||||
#if PIN_EXISTS(Y2_MIN)
|
||||
#define HAS_Y2_MIN 1
|
||||
#endif
|
||||
#if BOTH(Y_HOME_TO_MAX, Y_DUAL_ENDSTOPS) && PIN_EXISTS(Y2_MAX)
|
||||
#if PIN_EXISTS(Y2_MAX)
|
||||
#define HAS_Y2_MAX 1
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
#if Z_HOME_TO_MIN && PIN_EXISTS(Z2_MIN)
|
||||
#define HAS_Z2_MIN 1
|
||||
#endif
|
||||
#if Z_HOME_TO_MAX && PIN_EXISTS(Z2_MAX)
|
||||
#define HAS_Z2_MAX 1
|
||||
#endif
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
#if Z_HOME_TO_MIN && PIN_EXISTS(Z3_MIN)
|
||||
#define HAS_Z3_MIN 1
|
||||
#endif
|
||||
#if Z_HOME_TO_MAX && PIN_EXISTS(Z3_MAX)
|
||||
#define HAS_Z3_MAX 1
|
||||
#endif
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
#if Z_HOME_TO_MIN && PIN_EXISTS(Z4_MIN)
|
||||
#define HAS_Z4_MIN 1
|
||||
#endif
|
||||
#if Z_HOME_TO_MAX && PIN_EXISTS(Z4_MAX)
|
||||
#define HAS_Z4_MAX 1
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if PIN_EXISTS(Z2_MIN)
|
||||
#define HAS_Z2_MIN 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z2_MAX)
|
||||
#define HAS_Z2_MAX 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z3_MIN)
|
||||
#define HAS_Z3_MIN 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z3_MAX)
|
||||
#define HAS_Z3_MAX 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z4_MIN)
|
||||
#define HAS_Z4_MIN 1
|
||||
#endif
|
||||
#if PIN_EXISTS(Z4_MAX)
|
||||
#define HAS_Z4_MAX 1
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE && PIN_EXISTS(Z_MIN_PROBE)
|
||||
#define HAS_Z_MIN_PROBE_PIN 1
|
||||
#endif
|
||||
|
||||
#undef _HAS_STOP
|
||||
#undef IS_PROBE_PIN
|
||||
#undef IS_X2_ENDSTOP
|
||||
#undef IS_Y2_ENDSTOP
|
||||
@@ -2937,10 +2932,9 @@
|
||||
#endif
|
||||
#if !BOTH(HAS_BED_PROBE, HAS_EXTRUDERS)
|
||||
#undef PROBING_ESTEPPERS_OFF
|
||||
#endif
|
||||
#if BOTH(PROBING_STEPPERS_OFF, PROBING_ESTEPPERS_OFF)
|
||||
#undef PROBING_ESTEPPERS_OFF
|
||||
#warning "PROBING_STEPPERS_OFF includes PROBING_ESTEPPERS_OFF. Disabling PROBING_ESTEPPERS_OFF."
|
||||
#elif ENABLED(PROBING_STEPPERS_OFF)
|
||||
// PROBING_STEPPERS_OFF implies PROBING_ESTEPPERS_OFF, make sure it is defined
|
||||
#define PROBING_ESTEPPERS_OFF
|
||||
#endif
|
||||
#if EITHER(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF)
|
||||
#define HEATER_IDLE_HANDLER 1
|
||||
@@ -3264,6 +3258,8 @@
|
||||
#ifndef LCD_WIDTH
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
#define LCD_WIDTH 21
|
||||
#elif IS_DWIN_MARLINUI
|
||||
// Defined by header
|
||||
#else
|
||||
#define LCD_WIDTH TERN(IS_ULTIPANEL, 20, 16)
|
||||
#endif
|
||||
@@ -3271,6 +3267,8 @@
|
||||
#ifndef LCD_HEIGHT
|
||||
#if HAS_MARLINUI_U8GLIB
|
||||
#define LCD_HEIGHT 5
|
||||
#elif IS_DWIN_MARLINUI
|
||||
// Defined by header
|
||||
#else
|
||||
#define LCD_HEIGHT TERN(IS_ULTIPANEL, 4, 2)
|
||||
#endif
|
||||
|
||||
@@ -577,6 +577,8 @@
|
||||
#error "CUSTOM_USER_MENUS has been replaced by CUSTOM_MENU_MAIN and CUSTOM_MENU_CONFIG."
|
||||
#elif defined(MKS_LCD12864)
|
||||
#error "MKS_LCD12864 is now MKS_LCD12864A or MKS_LCD12864B."
|
||||
#elif defined(DOGM_SD_PERCENT)
|
||||
#error "DOGM_SD_PERCENT is now SHOW_SD_PERCENT."
|
||||
#elif defined(NEOPIXEL_BKGD_LED_INDEX)
|
||||
#error "NEOPIXEL_BKGD_LED_INDEX is now NEOPIXEL_BKGD_INDEX_FIRST."
|
||||
#elif defined(TEMP_SENSOR_1_AS_REDUNDANT)
|
||||
@@ -587,6 +589,8 @@
|
||||
#warning "Onboard temperature sensor for BOARD_DUE3DOM_MINI has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
|
||||
#elif MOTHERBOARD == BOARD_BTT_SKR_E3_TURBO && PIN_EXISTS(TEMP_2) && DISABLED(TEMP_SENSOR_BOARD)
|
||||
#warning "Onboard temperature sensor for BOARD_BTT_SKR_E3_TURBO has moved from TEMP_SENSOR_2 (TEMP_2_PIN) to TEMP_SENSOR_BOARD (TEMP_BOARD_PIN)."
|
||||
#elif defined(LCD_ALEPHOBJECTS_CLCD_UI)
|
||||
#warning "LCD_ALEPHOBJECTS_CLCD_UI is now LCD_LULZBOT_CLCD_UI."
|
||||
#endif
|
||||
|
||||
constexpr float arm[] = AXIS_RELATIVE_MODES;
|
||||
@@ -796,8 +800,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "PROGRESS_MSG_EXPIRE must be greater than or equal to 0."
|
||||
#endif
|
||||
#elif ENABLED(LCD_SET_PROGRESS_MANUALLY)
|
||||
#if NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI)
|
||||
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, or EXTENSIBLE_UI."
|
||||
#if NONE(HAS_MARLINUI_U8GLIB, HAS_GRAPHICAL_TFT, HAS_MARLINUI_HD44780, EXTENSIBLE_UI, IS_DWIN_MARLINUI)
|
||||
#error "LCD_SET_PROGRESS_MANUALLY requires LCD_PROGRESS_BAR, Character LCD, Graphical LCD, TFT, EXTENSIBLE_UI, OR DWIN MarlinUI."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1182,6 +1186,8 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "Please select either MIXING_EXTRUDER or SWITCHING_EXTRUDER, not both."
|
||||
#elif ENABLED(SINGLENOZZLE)
|
||||
#error "MIXING_EXTRUDER is incompatible with SINGLENOZZLE."
|
||||
#elif ENABLED(DISABLE_INACTIVE_EXTRUDER)
|
||||
#error "MIXING_EXTRUDER is incompatible with DISABLE_INACTIVE_EXTRUDER."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1208,6 +1214,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
);
|
||||
#if ENABLED(S_CURVE_ACCELERATION) && DISABLED(EXPERIMENTAL_SCURVE)
|
||||
#error "LIN_ADVANCE and S_CURVE_ACCELERATION may not play well together! Enable EXPERIMENTAL_SCURVE to continue."
|
||||
#elif ENABLED(DIRECT_STEPPING)
|
||||
#error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible."
|
||||
#elif !HAS_JUNCTION_DEVIATION && defined(DEFAULT_EJERK)
|
||||
static_assert(DEFAULT_EJERK >= 10, "It is strongly recommended to set DEFAULT_EJERK >= 10 when using LIN_ADVANCE.");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1377,6 +1387,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#if LINEAR_AXES >= 4
|
||||
#if AXIS4_NAME != 'A' && AXIS4_NAME != 'B' && AXIS4_NAME != 'C' && AXIS4_NAME != 'U' && AXIS4_NAME != 'V' && AXIS4_NAME != 'W'
|
||||
#error "AXIS4_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
|
||||
#elif !defined(I_MIN_POS) || !defined(I_MAX_POS)
|
||||
#error "I_MIN_POS and I_MAX_POS are required with LINEAR_AXES >= 4."
|
||||
#elif !defined(I_HOME_DIR)
|
||||
#error "I_HOME_DIR is required with LINEAR_AXES >= 4."
|
||||
#elif HAS_I_ENABLE && !defined(I_ENABLE_ON)
|
||||
#error "I_ENABLE_ON is required for your I driver with LINEAR_AXES >= 4."
|
||||
#endif
|
||||
#endif
|
||||
#if LINEAR_AXES >= 5
|
||||
@@ -1384,6 +1400,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "AXIS5_NAME must be different from AXIS4_NAME and AXIS6_NAME"
|
||||
#elif AXIS5_NAME != 'A' && AXIS5_NAME != 'B' && AXIS5_NAME != 'C' && AXIS5_NAME != 'U' && AXIS5_NAME != 'V' && AXIS5_NAME != 'W'
|
||||
#error "AXIS5_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
|
||||
#elif !defined(J_MIN_POS) || !defined(J_MAX_POS)
|
||||
#error "J_MIN_POS and J_MAX_POS are required with LINEAR_AXES >= 5."
|
||||
#elif !defined(J_HOME_DIR)
|
||||
#error "J_HOME_DIR is required with LINEAR_AXES >= 5."
|
||||
#elif HAS_J_ENABLE && !defined(J_ENABLE_ON)
|
||||
#error "J_ENABLE_ON is required for your J driver with LINEAR_AXES >= 5."
|
||||
#endif
|
||||
#endif
|
||||
#if LINEAR_AXES >= 6
|
||||
@@ -1391,6 +1413,12 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#error "AXIS6_NAME must be different from AXIS5_NAME and AXIS4_NAME."
|
||||
#elif AXIS6_NAME != 'A' && AXIS6_NAME != 'B' && AXIS6_NAME != 'C' && AXIS6_NAME != 'U' && AXIS6_NAME != 'V' && AXIS6_NAME != 'W'
|
||||
#error "AXIS6_NAME can only be one of 'A', 'B', 'C', 'U', 'V', or 'W'."
|
||||
#elif !defined(K_MIN_POS) || !defined(K_MAX_POS)
|
||||
#error "K_MIN_POS and K_MAX_POS are required with LINEAR_AXES >= 6."
|
||||
#elif !defined(K_HOME_DIR)
|
||||
#error "K_HOME_DIR is required with LINEAR_AXES >= 6."
|
||||
#elif HAS_K_ENABLE && !defined(K_ENABLE_ON)
|
||||
#error "K_ENABLE_ON is required for your K driver with LINEAR_AXES >= 6."
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1695,7 +1723,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(MESH_EDIT_GFX_OVERLAY) && !BOTH(AUTO_BED_LEVELING_UBL, HAS_MARLINUI_U8GLIB)
|
||||
#if ENABLED(MESH_EDIT_GFX_OVERLAY) && !(ENABLED(AUTO_BED_LEVELING_UBL) && EITHER(HAS_MARLINUI_U8GLIB, IS_DWIN_MARLINUI))
|
||||
#error "MESH_EDIT_GFX_OVERLAY requires AUTO_BED_LEVELING_UBL and a Graphical LCD."
|
||||
#endif
|
||||
|
||||
@@ -2002,7 +2030,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
#endif
|
||||
|
||||
#if REDUNDANT_TEMP_MATCH(SOURCE, E0) && HAS_HOTEND
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be 0 if a hotend is used. E0 always uses TEMP_SENSOR_0."
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be E0 if a hotend is used. E0 always uses TEMP_SENSOR_0."
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, COOLER) && HAS_TEMP_COOLER
|
||||
#error "TEMP_SENSOR_REDUNDANT_SOURCE can't be COOLER. TEMP_SENSOR_COOLER is in use."
|
||||
#elif REDUNDANT_TEMP_MATCH(SOURCE, PROBE) && HAS_TEMP_PROBE
|
||||
@@ -2614,6 +2642,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
|
||||
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35) \
|
||||
+ COUNT_ENABLED(DGUS_LCD_UI_ORIGIN, DGUS_LCD_UI_FYSETC, DGUS_LCD_UI_HIPRECY, DGUS_LCD_UI_MKS) \
|
||||
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY, DWIN_CREALITY_LCD) \
|
||||
+ COUNT_ENABLED(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE) \
|
||||
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, FYSETC_GENERIC_12864_1_1) \
|
||||
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
|
||||
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
|
||||
@@ -3449,6 +3478,13 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Validate MKS_PWC
|
||||
*/
|
||||
#if ENABLED(MKS_PWC) && PSU_ACTIVE_STATE != HIGH
|
||||
#error "MKS_PWC requires PSU_ACTIVE_STATE to be set HIGH."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Ensure this option is set intentionally
|
||||
*/
|
||||
@@ -3598,13 +3634,6 @@ static_assert( _ARR_TEST(3,0) && _ARR_TEST(3,1) && _ARR_TEST(3,2)
|
||||
#error "SAVED_POSITIONS must be an integer from 0 to 256."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Stepper Chunk support
|
||||
*/
|
||||
#if BOTH(DIRECT_STEPPING, LIN_ADVANCE)
|
||||
#error "DIRECT_STEPPING is incompatible with LIN_ADVANCE. Enable in external planner if possible."
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Touch Screen Calibration
|
||||
*/
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
* version was tagged.
|
||||
*/
|
||||
#ifndef STRING_DISTRIBUTION_DATE
|
||||
#define STRING_DISTRIBUTION_DATE "2021-08-05"
|
||||
#define STRING_DISTRIBUTION_DATE "2021-08-28"
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -105,18 +105,18 @@
|
||||
* Currently only supported by DUE platform
|
||||
*/
|
||||
#ifndef USB_DEVICE_VENDOR_ID
|
||||
#define USB_DEVICE_VENDOR_ID 0x03EB /* ATMEL VID */
|
||||
#define USB_DEVICE_VENDOR_ID 0x03EB /* ATMEL VID */
|
||||
#endif
|
||||
#ifndef USB_DEVICE_PRODUCT_ID
|
||||
#define USB_DEVICE_PRODUCT_ID 0x2424 /* MSC / CDC */
|
||||
#define USB_DEVICE_PRODUCT_ID 0x2424 /* MSC / CDC */
|
||||
#endif
|
||||
//! USB Device string definitions (Optional)
|
||||
#ifndef USB_DEVICE_MANUFACTURE_NAME
|
||||
#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL
|
||||
#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL
|
||||
#endif
|
||||
#ifdef CUSTOM_MACHINE_NAME
|
||||
#define USB_DEVICE_PRODUCT_NAME CUSTOM_MACHINE_NAME
|
||||
#define USB_DEVICE_PRODUCT_NAME CUSTOM_MACHINE_NAME
|
||||
#else
|
||||
#define USB_DEVICE_PRODUCT_NAME MACHINE_NAME
|
||||
#define USB_DEVICE_PRODUCT_NAME MACHINE_NAME
|
||||
#endif
|
||||
#define USB_DEVICE_SERIAL_NAME "123985739853"
|
||||
#define USB_DEVICE_SERIAL_NAME "123985739853"
|
||||
|
||||
@@ -354,12 +354,11 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
|
||||
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
|
||||
row_y1 = row * (MENU_FONT_HEIGHT) + 1;
|
||||
row_y2 = row_y1 + MENU_FONT_HEIGHT - 1;
|
||||
u8g_uint_t y1 = row * (MENU_FONT_HEIGHT) + 1, y2 = y1 + MENU_FONT_HEIGHT - 1;
|
||||
|
||||
if (!PAGE_CONTAINS(row_y1 + 1, row_y2 + 2)) return;
|
||||
if (!PAGE_CONTAINS(y1 + 1, y2 + 2)) return;
|
||||
|
||||
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), row_y2, 'E');
|
||||
lcd_put_wchar(LCD_PIXEL_WIDTH - 11 * (MENU_FONT_WIDTH), y2, 'E');
|
||||
lcd_put_wchar((char)('1' + extruder));
|
||||
lcd_put_wchar(' ');
|
||||
lcd_put_u8str(i16tostr3rj(thermalManager.wholeDegHotend(extruder)));
|
||||
|
||||
@@ -456,13 +456,13 @@ void MarlinUI::draw_status_screen() {
|
||||
#endif
|
||||
|
||||
#if HAS_PRINT_PROGRESS
|
||||
#if DISABLED(DOGM_SD_PERCENT)
|
||||
#if DISABLED(SHOW_SD_PERCENT)
|
||||
#define _SD_INFO_X(len) (PROGRESS_BAR_X + (PROGRESS_BAR_WIDTH) / 2 - (len) * (MENU_FONT_WIDTH) / 2)
|
||||
#else
|
||||
#define _SD_INFO_X(len) (LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH))
|
||||
#endif
|
||||
|
||||
#if ENABLED(DOGM_SD_PERCENT)
|
||||
#if ENABLED(SHOW_SD_PERCENT)
|
||||
static char progress_string[5];
|
||||
#endif
|
||||
static uint8_t lastElapsed = 0xFF, lastProgress = 0xFF;
|
||||
@@ -471,7 +471,7 @@ void MarlinUI::draw_status_screen() {
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
static u8g_uint_t estimation_x_pos = 0;
|
||||
static char estimation_string[10];
|
||||
#if BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
|
||||
#if BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
|
||||
static u8g_uint_t progress_x_pos = 0;
|
||||
static uint8_t progress_state = 0;
|
||||
static bool prev_blink = 0;
|
||||
@@ -526,7 +526,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
progress_bar_solid_width = u8g_uint_t((PROGRESS_BAR_WIDTH - 2) * (progress / (PROGRESS_SCALE)) * 0.01f);
|
||||
|
||||
#if ENABLED(DOGM_SD_PERCENT)
|
||||
#if ENABLED(SHOW_SD_PERCENT)
|
||||
if (progress == 0) {
|
||||
progress_string[0] = '\0';
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
@@ -543,7 +543,7 @@ void MarlinUI::draw_status_screen() {
|
||||
#endif
|
||||
}
|
||||
|
||||
constexpr bool can_show_days = DISABLED(DOGM_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
|
||||
constexpr bool can_show_days = DISABLED(SHOW_SD_PERCENT) || ENABLED(ROTATE_PROGRESS_DISPLAY);
|
||||
if (ev != lastElapsed) {
|
||||
lastElapsed = ev;
|
||||
const uint8_t len = elapsed.toDigital(elapsed_string, can_show_days && elapsed.value >= 60*60*24L);
|
||||
@@ -564,11 +564,7 @@ void MarlinUI::draw_status_screen() {
|
||||
else {
|
||||
duration_t estimation = timeval;
|
||||
const uint8_t len = estimation.toDigital(estimation_string, can_show_days && estimation.value >= 60*60*24L);
|
||||
estimation_x_pos = _SD_INFO_X(len
|
||||
#if !BOTH(DOGM_SD_PERCENT, ROTATE_PROGRESS_DISPLAY)
|
||||
+ 1
|
||||
#endif
|
||||
);
|
||||
estimation_x_pos = _SD_INFO_X(len + !BOTH(SHOW_SD_PERCENT, ROTATE_PROGRESS_DISPLAY));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -767,7 +763,7 @@ void MarlinUI::draw_status_screen() {
|
||||
|
||||
if (PAGE_CONTAINS(EXTRAS_BASELINE - INFO_FONT_ASCENT, EXTRAS_BASELINE - 1)) {
|
||||
|
||||
#if ALL(DOGM_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY)
|
||||
#if ALL(SHOW_SD_PERCENT, SHOW_REMAINING_TIME, ROTATE_PROGRESS_DISPLAY)
|
||||
|
||||
if (prev_blink != blink) {
|
||||
prev_blink = blink;
|
||||
@@ -789,13 +785,13 @@ void MarlinUI::draw_status_screen() {
|
||||
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
|
||||
}
|
||||
|
||||
#else // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
|
||||
#else // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
|
||||
|
||||
//
|
||||
// SD Percent Complete
|
||||
//
|
||||
|
||||
#if ENABLED(DOGM_SD_PERCENT)
|
||||
#if ENABLED(SHOW_SD_PERCENT)
|
||||
if (progress_string[0]) {
|
||||
lcd_put_u8str(55, EXTRAS_BASELINE, progress_string); // Percent complete
|
||||
lcd_put_wchar('%');
|
||||
@@ -815,7 +811,7 @@ void MarlinUI::draw_status_screen() {
|
||||
#endif
|
||||
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
|
||||
|
||||
#endif // !DOGM_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
|
||||
#endif // !SHOW_SD_PERCENT || !SHOW_REMAINING_TIME || !ROTATE_PROGRESS_DISPLAY
|
||||
}
|
||||
|
||||
#endif // HAS_PRINT_PROGRESS
|
||||
|
||||
@@ -390,9 +390,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
|
||||
|
||||
LOOP_L_N(y, PAGE_HEIGHT) {
|
||||
uint32_t k = 0;
|
||||
#if HAS_LCD_IO
|
||||
buffer = (y & 1) ? bufferB : bufferA;
|
||||
#endif
|
||||
TERN_(HAS_LCD_IO, buffer = (y & 1) ? bufferB : bufferA);
|
||||
for (uint16_t i = 0; i < (uint32_t)pb->width; i++) {
|
||||
const uint8_t b = *(((uint8_t *)pb->buf) + i);
|
||||
const uint16_t c = TEST(b, y) ? TFT_MARLINUI_COLOR : TFT_MARLINBG_COLOR;
|
||||
|
||||
+1162
-1007
File diff suppressed because it is too large
Load Diff
@@ -163,18 +163,6 @@ typedef struct {
|
||||
extern HMI_value_t HMI_ValueStruct;
|
||||
extern HMI_Flag_t HMI_flag;
|
||||
|
||||
// Show ICO
|
||||
void ICON_Print(bool show);
|
||||
void ICON_Prepare(bool show);
|
||||
void ICON_Control(bool show);
|
||||
void ICON_Leveling(bool show);
|
||||
void ICON_StartInfo(bool show);
|
||||
|
||||
void ICON_Setting(bool show);
|
||||
void ICON_Pause(bool show);
|
||||
void ICON_Continue(bool show);
|
||||
void ICON_Stop(bool show);
|
||||
|
||||
#if HAS_HOTEND || HAS_HEATED_BED
|
||||
// Popup message window
|
||||
void DWIN_Popup_Temperature(const bool toohigh);
|
||||
@@ -215,6 +203,7 @@ void HMI_MaxFeedspeedXYZE();
|
||||
void HMI_MaxAccelerationXYZE();
|
||||
void HMI_MaxJerkXYZE();
|
||||
void HMI_StepXYZE();
|
||||
void HMI_SetLanguageCache();
|
||||
|
||||
void update_variable();
|
||||
void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
|
||||
@@ -260,7 +249,6 @@ void EachMomentUpdate();
|
||||
void DWIN_HandleScreen();
|
||||
void DWIN_StatusChanged(const char *text);
|
||||
void DWIN_StatusChanged_P(PGM_P const pstr);
|
||||
void DWIN_Draw_Checkbox(uint16_t color, uint16_t bcolor, uint16_t x, uint16_t y, bool mode /* = false*/);
|
||||
|
||||
inline void DWIN_StartHoming() { HMI_flag.home_flag = true; }
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
//#define USE_STRING_HEADINGS
|
||||
//#define USE_STRING_TITLES
|
||||
|
||||
#define RECEIVED_NO_DATA 0x00
|
||||
#define RECEIVED_SHAKE_HAND_ACK 0x01
|
||||
|
||||
@@ -42,17 +45,12 @@
|
||||
#define DWIN_WIDTH 272
|
||||
#define DWIN_HEIGHT 480
|
||||
|
||||
// Character matrix width x height
|
||||
//#define LCD_WIDTH ((DWIN_WIDTH) / 8)
|
||||
//#define LCD_HEIGHT ((DWIN_HEIGHT) / 12)
|
||||
|
||||
// Picture ID
|
||||
#define DWIN_Boot_Screen 0
|
||||
#define Language_English 1
|
||||
#define Language_Chinese 2
|
||||
|
||||
// ICON ID
|
||||
#define ICON 0x09
|
||||
#define ICON 7 // Icon set file 7.ICO
|
||||
|
||||
#define ICON_LOGO 0
|
||||
#define ICON_Print_0 1
|
||||
@@ -258,8 +256,7 @@ inline void DWIN_Draw_VLine(uint16_t color, uint16_t xStart, uint16_t yStart, ui
|
||||
// color: Rectangle color
|
||||
// xStart/yStart: upper left point
|
||||
// xEnd/yEnd: lower right point
|
||||
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,
|
||||
uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
|
||||
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
|
||||
|
||||
// Draw a box
|
||||
// mode: 0=frame, 1=fill, 2=XOR fill
|
||||
|
||||
@@ -0,0 +1,470 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/********************************************************************************
|
||||
* @file lcd/e3v2/marlinui/dwin_lcd.cpp
|
||||
* @brief DWIN screen control functions
|
||||
********************************************************************************/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if IS_DWIN_MARLINUI
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#include "dwin_lcd.h"
|
||||
#include <string.h> // for memset
|
||||
|
||||
//#define DEBUG_OUT 1
|
||||
#include "../../../core/debug_out.h"
|
||||
|
||||
// Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail.
|
||||
// Assume the narrowest (6 pixel) font and 2-byte gb2312-encoded characters.
|
||||
uint8_t DWIN_SendBuf[11 + DWIN_WIDTH / 6 * 2] = { 0xAA };
|
||||
uint8_t DWIN_BufTail[4] = { 0xCC, 0x33, 0xC3, 0x3C };
|
||||
uint8_t databuf[26] = { 0 };
|
||||
uint8_t receivedType;
|
||||
|
||||
int recnum = 0;
|
||||
|
||||
inline void DWIN_Byte(size_t &i, const uint16_t bval) {
|
||||
DWIN_SendBuf[++i] = bval;
|
||||
}
|
||||
|
||||
inline void DWIN_Word(size_t &i, const uint16_t wval) {
|
||||
DWIN_SendBuf[++i] = wval >> 8;
|
||||
DWIN_SendBuf[++i] = wval & 0xFF;
|
||||
}
|
||||
|
||||
inline void DWIN_Long(size_t &i, const uint32_t lval) {
|
||||
DWIN_SendBuf[++i] = (lval >> 24) & 0xFF;
|
||||
DWIN_SendBuf[++i] = (lval >> 16) & 0xFF;
|
||||
DWIN_SendBuf[++i] = (lval >> 8) & 0xFF;
|
||||
DWIN_SendBuf[++i] = lval & 0xFF;
|
||||
}
|
||||
|
||||
inline void DWIN_String(size_t &i, char * const string) {
|
||||
const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, strlen(string));
|
||||
memcpy(&DWIN_SendBuf[i+1], string, len);
|
||||
i += len;
|
||||
}
|
||||
|
||||
inline void DWIN_String(size_t &i, const __FlashStringHelper * string) {
|
||||
if (!string) return;
|
||||
const size_t len = strlen_P((PGM_P)string); // cast it to PGM_P, which is basically const char *, and measure it using the _P version of strlen.
|
||||
if (len == 0) return;
|
||||
memcpy(&DWIN_SendBuf[i+1], string, len);
|
||||
i += len;
|
||||
}
|
||||
|
||||
// Send the data in the buffer and the packet end
|
||||
inline void DWIN_Send(size_t &i) {
|
||||
++i;
|
||||
LOOP_L_N(n, i) { LCD_SERIAL.write(DWIN_SendBuf[n]); delayMicroseconds(1); }
|
||||
LOOP_L_N(n, 4) { LCD_SERIAL.write(DWIN_BufTail[n]); delayMicroseconds(1); }
|
||||
}
|
||||
|
||||
/*-------------------------------------- System variable function --------------------------------------*/
|
||||
|
||||
// Handshake (1: Success, 0: Fail)
|
||||
bool DWIN_Handshake(void) {
|
||||
#ifndef LCD_BAUDRATE
|
||||
#define LCD_BAUDRATE 115200
|
||||
#endif
|
||||
LCD_SERIAL.begin(LCD_BAUDRATE);
|
||||
const millis_t serial_connect_timeout = millis() + 1000UL;
|
||||
while (!LCD_SERIAL.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
|
||||
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x00);
|
||||
DWIN_Send(i);
|
||||
|
||||
while (LCD_SERIAL.available() > 0 && recnum < (signed)sizeof(databuf)) {
|
||||
databuf[recnum] = LCD_SERIAL.read();
|
||||
// ignore the invalid data
|
||||
if (databuf[0] != FHONE) { // prevent the program from running.
|
||||
if (recnum > 0) {
|
||||
recnum = 0;
|
||||
ZERO(databuf);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
delay(10);
|
||||
recnum++;
|
||||
}
|
||||
|
||||
return ( recnum >= 3
|
||||
&& databuf[0] == FHONE
|
||||
&& databuf[1] == '\0'
|
||||
&& databuf[2] == 'O'
|
||||
&& databuf[3] == 'K' );
|
||||
}
|
||||
|
||||
void DWIN_Startup(void) {
|
||||
DEBUG_ECHOPGM("\r\nDWIN handshake ");
|
||||
delay(750); // Delay here or init later in the boot process
|
||||
const bool success = DWIN_Handshake();
|
||||
if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
||||
DWIN_Frame_SetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1));
|
||||
DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
|
||||
DWIN_UpdateLCD();
|
||||
}
|
||||
|
||||
// Set the backlight luminance
|
||||
// luminance: (0x00-0xFF)
|
||||
void DWIN_Backlight_SetLuminance(const uint8_t luminance) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x30);
|
||||
DWIN_Byte(i, _MAX(luminance, 0x1F));
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Set screen display direction
|
||||
// dir: 0=0°, 1=90°, 2=180°, 3=270°
|
||||
void DWIN_Frame_SetDir(uint8_t dir) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x34);
|
||||
DWIN_Byte(i, 0x5A);
|
||||
DWIN_Byte(i, 0xA5);
|
||||
DWIN_Byte(i, dir);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Update display
|
||||
void DWIN_UpdateLCD(void) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x3D);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
/*---------------------------------------- Drawing functions ----------------------------------------*/
|
||||
|
||||
// Clear screen
|
||||
// color: Clear screen color
|
||||
void DWIN_Frame_Clear(const uint16_t color) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x01);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Draw a point
|
||||
// width: point width 0x01-0x0F
|
||||
// height: point height 0x01-0x0F
|
||||
// x,y: upper left point
|
||||
void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x02);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Byte(i, width);
|
||||
DWIN_Byte(i, height);
|
||||
DWIN_Word(i, x);
|
||||
DWIN_Word(i, y);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Draw a line
|
||||
// color: Line segment color
|
||||
// xStart/yStart: Start point
|
||||
// xEnd/yEnd: End point
|
||||
void DWIN_Draw_Line(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x03);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Word(i, xStart);
|
||||
DWIN_Word(i, yStart);
|
||||
DWIN_Word(i, xEnd);
|
||||
DWIN_Word(i, yEnd);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Draw a rectangle
|
||||
// mode: 0=frame, 1=fill, 2=XOR fill
|
||||
// color: Rectangle color
|
||||
// xStart/yStart: upper left point
|
||||
// xEnd/yEnd: lower right point
|
||||
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,
|
||||
uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x05);
|
||||
DWIN_Byte(i, mode);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Word(i, xStart);
|
||||
DWIN_Word(i, yStart);
|
||||
DWIN_Word(i, xEnd);
|
||||
DWIN_Word(i, yEnd);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Move a screen area
|
||||
// mode: 0, circle shift; 1, translation
|
||||
// dir: 0=left, 1=right, 2=up, 3=down
|
||||
// dis: Distance
|
||||
// color: Fill color
|
||||
// xStart/yStart: upper left point
|
||||
// xEnd/yEnd: bottom right point
|
||||
void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
|
||||
uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x09);
|
||||
DWIN_Byte(i, (mode << 7) | dir);
|
||||
DWIN_Word(i, dis);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Word(i, xStart);
|
||||
DWIN_Word(i, yStart);
|
||||
DWIN_Word(i, xEnd);
|
||||
DWIN_Word(i, yEnd);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
/*---------------------------------------- Text related functions ----------------------------------------*/
|
||||
|
||||
// Draw a string
|
||||
// bShow: true=display background color; false=don't display background color
|
||||
// size: Font size
|
||||
// color: Character color
|
||||
// bColor: Background color
|
||||
// x/y: Upper-left coordinate of the string
|
||||
// *string: The string
|
||||
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string) {
|
||||
uint8_t widthAdjust = 0;
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x11);
|
||||
// Bit 7: widthAdjust
|
||||
// Bit 6: bShow
|
||||
// Bit 5-4: Unused (0)
|
||||
// Bit 3-0: size
|
||||
DWIN_Byte(i, (widthAdjust * 0x80) | (bShow * 0x40) | size);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Word(i, bColor);
|
||||
DWIN_Word(i, x);
|
||||
DWIN_Word(i, y);
|
||||
DWIN_String(i, string);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Draw a positive integer
|
||||
// bShow: true=display background color; false=don't display background color
|
||||
// zeroFill: true=zero fill; false=no zero fill
|
||||
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||
// size: Font size
|
||||
// color: Character color
|
||||
// bColor: Background color
|
||||
// iNum: Number of digits
|
||||
// x/y: Upper-left coordinate
|
||||
// value: Integer value
|
||||
void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||
uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint16_t value) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x14);
|
||||
// Bit 7: bshow
|
||||
// Bit 6: 1 = signed; 0 = unsigned number;
|
||||
// Bit 5: zeroFill
|
||||
// Bit 4: zeroMode
|
||||
// Bit 3-0: size
|
||||
DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Word(i, bColor);
|
||||
DWIN_Byte(i, iNum);
|
||||
DWIN_Byte(i, 0); // fNum
|
||||
DWIN_Word(i, x);
|
||||
DWIN_Word(i, y);
|
||||
#if 0
|
||||
for (char count = 0; count < 8; count++) {
|
||||
DWIN_Byte(i, value);
|
||||
value >>= 8;
|
||||
if (!(value & 0xFF)) break;
|
||||
}
|
||||
#else
|
||||
// Write a big-endian 64 bit integer
|
||||
const size_t p = i + 1;
|
||||
for (char count = 8; count--;) { // 7..0
|
||||
++i;
|
||||
DWIN_SendBuf[p + count] = value;
|
||||
value >>= 8;
|
||||
}
|
||||
#endif
|
||||
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Draw a floating point number
|
||||
// bShow: true=display background color; false=don't display background color
|
||||
// zeroFill: true=zero fill; false=no zero fill
|
||||
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||
// size: Font size
|
||||
// color: Character color
|
||||
// bColor: Background color
|
||||
// iNum: Number of whole digits
|
||||
// fNum: Number of decimal digits
|
||||
// x/y: Upper-left point
|
||||
// value: Float value
|
||||
void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value) {
|
||||
//uint8_t *fvalue = (uint8_t*)&value;
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x14);
|
||||
DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
|
||||
DWIN_Word(i, color);
|
||||
DWIN_Word(i, bColor);
|
||||
DWIN_Byte(i, iNum);
|
||||
DWIN_Byte(i, fNum);
|
||||
DWIN_Word(i, x);
|
||||
DWIN_Word(i, y);
|
||||
DWIN_Long(i, value);
|
||||
/*
|
||||
DWIN_Byte(i, fvalue[3]);
|
||||
DWIN_Byte(i, fvalue[2]);
|
||||
DWIN_Byte(i, fvalue[1]);
|
||||
DWIN_Byte(i, fvalue[0]);
|
||||
*/
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
||||
|
||||
// Draw JPG and cached in #0 virtual display area
|
||||
// id: Picture ID
|
||||
void DWIN_JPG_ShowAndCache(const uint8_t id) {
|
||||
size_t i = 0;
|
||||
DWIN_Word(i, 0x2200);
|
||||
DWIN_Byte(i, id);
|
||||
DWIN_Send(i); // AA 23 00 00 00 00 08 00 01 02 03 CC 33 C3 3C
|
||||
}
|
||||
|
||||
// Draw an Icon
|
||||
// libID: Icon library ID
|
||||
// picID: Icon ID
|
||||
// x/y: Upper-left point
|
||||
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
||||
NOMORE(x, DWIN_WIDTH - 1);
|
||||
NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x23);
|
||||
DWIN_Word(i, x);
|
||||
DWIN_Word(i, y);
|
||||
DWIN_Byte(i, 0x80 | libID);
|
||||
//DWIN_Byte(i, libID);
|
||||
DWIN_Byte(i, picID);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Unzip the JPG picture to a virtual display area
|
||||
// n: Cache index
|
||||
// id: Picture ID
|
||||
void DWIN_JPG_CacheToN(uint8_t n, uint8_t id) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x25);
|
||||
DWIN_Byte(i, n);
|
||||
DWIN_Byte(i, id);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Copy area from virtual display area to current screen
|
||||
// cacheID: virtual area number
|
||||
// xStart/yStart: Upper-left of virtual area
|
||||
// xEnd/yEnd: Lower-right of virtual area
|
||||
// x/y: Screen paste point
|
||||
void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart,
|
||||
uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x27);
|
||||
DWIN_Byte(i, 0x80 | cacheID);
|
||||
DWIN_Word(i, xStart);
|
||||
DWIN_Word(i, yStart);
|
||||
DWIN_Word(i, xEnd);
|
||||
DWIN_Word(i, yEnd);
|
||||
DWIN_Word(i, x);
|
||||
DWIN_Word(i, y);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Animate a series of icons
|
||||
// animID: Animation ID; 0x00-0x0F
|
||||
// animate: true on; false off;
|
||||
// libID: Icon library ID
|
||||
// picIDs: Icon starting ID
|
||||
// picIDe: Icon ending ID
|
||||
// x/y: Upper-left point
|
||||
// interval: Display time interval, unit 10mS
|
||||
void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs, uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval) {
|
||||
NOMORE(x, DWIN_WIDTH - 1);
|
||||
NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x28);
|
||||
DWIN_Word(i, x);
|
||||
DWIN_Word(i, y);
|
||||
// Bit 7: animation on or off
|
||||
// Bit 6: start from begin or end
|
||||
// Bit 5-4: unused (0)
|
||||
// Bit 3-0: animID
|
||||
DWIN_Byte(i, (animate * 0x80) | 0x40 | animID);
|
||||
DWIN_Byte(i, libID);
|
||||
DWIN_Byte(i, picIDs);
|
||||
DWIN_Byte(i, picIDe);
|
||||
DWIN_Byte(i, interval);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
// Animation Control
|
||||
// state: 16 bits, each bit is the state of an animation id
|
||||
void DWIN_ICON_AnimationControl(uint16_t state) {
|
||||
size_t i = 0;
|
||||
DWIN_Byte(i, 0x29);
|
||||
DWIN_Word(i, state);
|
||||
DWIN_Send(i);
|
||||
}
|
||||
|
||||
/*---------------------------------------- Memory functions ----------------------------------------*/
|
||||
// The LCD has an additional 32KB SRAM and 16KB Flash
|
||||
|
||||
// Data can be written to the sram and save to one of the jpeg page files
|
||||
|
||||
// Write Data Memory
|
||||
// command 0x31
|
||||
// Type: Write memory selection; 0x5A=SRAM; 0xA5=Flash
|
||||
// Address: Write data memory address; 0x000-0x7FFF for SRAM; 0x000-0x3FFF for Flash
|
||||
// Data: data
|
||||
//
|
||||
// Flash writing returns 0xA5 0x4F 0x4B
|
||||
|
||||
// Read Data Memory
|
||||
// command 0x32
|
||||
// Type: Read memory selection; 0x5A=SRAM; 0xA5=Flash
|
||||
// Address: Read data memory address; 0x000-0x7FFF for SRAM; 0x000-0x3FFF for Flash
|
||||
// Length: leangth of data to read; 0x01-0xF0
|
||||
//
|
||||
// Response:
|
||||
// Type, Address, Length, Data
|
||||
|
||||
// Write Picture Memory
|
||||
// Write the contents of the 32KB SRAM data memory into the designated image memory space
|
||||
// Issued: 0x5A, 0xA5, PIC_ID
|
||||
// Response: 0xA5 0x4F 0x4B
|
||||
//
|
||||
// command 0x33
|
||||
// 0x5A, 0xA5
|
||||
// PicId: Picture Memory location, 0x00-0x0F
|
||||
//
|
||||
// Flash writing returns 0xA5 0x4F 0x4B
|
||||
|
||||
#endif // IS_DWIN_MARLINUI
|
||||
@@ -0,0 +1,302 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/********************************************************************************
|
||||
* @file lcd/e3v2/marlinui/dwin_lcd.h
|
||||
* @brief DWIN screen control functions
|
||||
********************************************************************************/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define RECEIVED_NO_DATA 0x00
|
||||
#define RECEIVED_SHAKE_HAND_ACK 0x01
|
||||
|
||||
#define FHONE 0xAA
|
||||
|
||||
#define DWIN_SCROLL_UP 2
|
||||
#define DWIN_SCROLL_DOWN 3
|
||||
|
||||
#if DISABLED(DWIN_MARLINUI_LANDSCAPE)
|
||||
#define DWIN_WIDTH 272
|
||||
#define DWIN_HEIGHT 480
|
||||
#else
|
||||
#define DWIN_WIDTH 480
|
||||
#define DWIN_HEIGHT 272
|
||||
#endif
|
||||
|
||||
// Picture ID
|
||||
#define DWIN_Boot_Horiz 0
|
||||
#define DWIN_Boot_Vert 1
|
||||
#define DWIN_MarlinUI_Assets 2
|
||||
|
||||
/**
|
||||
* 3-.0:The font size, 0x00-0x09, corresponds to the font size below:
|
||||
* 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28
|
||||
* 0x05=16*32 0x06=20*40 0x07=24*48 0x08=28*56 0x09=32*64
|
||||
*/
|
||||
#define font6x12 0x00
|
||||
#define font8x16 0x01
|
||||
#define font10x20 0x02
|
||||
#define font12x24 0x03
|
||||
#define font14x28 0x04
|
||||
#define font16x32 0x05
|
||||
#define font20x40 0x06
|
||||
#define font24x48 0x07
|
||||
#define font28x56 0x08
|
||||
#define font32x64 0x09
|
||||
|
||||
#define DWIN_FONT_MENU font10x20
|
||||
#define DWIN_FONT_STAT font14x28
|
||||
#define DWIN_FONT_HEAD font10x20
|
||||
#define DWIN_FONT_ALERT font14x28
|
||||
|
||||
// Color
|
||||
#define Color_White 0xFFFF
|
||||
#define Color_Yellow 0xFF0F
|
||||
#define Color_Error_Red 0xB000 // Error!
|
||||
#define Color_Bg_Red 0xF00F // Red background color
|
||||
#define Color_Bg_Window 0x31E8 // Popup background color
|
||||
#define Color_Bg_Heading 0x3344 // Static Heading
|
||||
#define Color_Bg_Blue 0x1125 // Dark blue background color
|
||||
#define Color_Bg_Black 0x0841 // Black background color
|
||||
#define Color_IconBlue 0x45FA // Lighter blue that matches icons/accents
|
||||
#define Popup_Text_Color 0xD6BA // Popup font background color
|
||||
#define Line_Color 0x3A6A // Split line color
|
||||
#define Rectangle_Color 0xEE2F // Blue square cursor color
|
||||
#define Percent_Color 0xFE29 // Percentage color
|
||||
#define BarFill_Color 0x10E4 // Fill color of progress bar
|
||||
#define Select_Color 0x33BB // Selected color
|
||||
|
||||
// Character matrix width x height
|
||||
//#define LCD_WIDTH ((DWIN_WIDTH) / 8)
|
||||
//#define LCD_HEIGHT ((DWIN_HEIGHT) / 12)
|
||||
|
||||
// ICON ID
|
||||
#define BOOT_ICON 3 // Icon set file 3.ICO
|
||||
#define ICON 4 // Icon set file 4.ICO
|
||||
|
||||
// MarlinUI Boot Icons
|
||||
#define ICON_MarlinBoot 0
|
||||
#define ICON_OpenSource 1
|
||||
#define ICON_GitHubURL 2
|
||||
#define ICON_MarlinURL 3
|
||||
#define ICON_Copyright 4
|
||||
|
||||
// MarlinUI Icons
|
||||
#define ICON_LOGO_Marlin 0
|
||||
#define ICON_HotendOff 1
|
||||
#define ICON_HotendOn 2
|
||||
#define ICON_BedOff 3
|
||||
#define ICON_BedOn 4
|
||||
#define ICON_Fan0 5
|
||||
#define ICON_Fan1 6
|
||||
#define ICON_Fan2 7
|
||||
#define ICON_Fan3 8
|
||||
#define ICON_Halted 9
|
||||
#define ICON_Question 10
|
||||
#define ICON_Alert 11
|
||||
#define ICON_RotateCW 12
|
||||
#define ICON_RotateCCW 13
|
||||
#define ICON_UpArrow 14
|
||||
#define ICON_DownArrow 15
|
||||
#define ICON_BedLine 16
|
||||
|
||||
#define ICON_AdvSet ICON_Language
|
||||
#define ICON_HomeOff ICON_AdvSet
|
||||
#define ICON_HomeOffX ICON_StepX
|
||||
#define ICON_HomeOffY ICON_StepY
|
||||
#define ICON_HomeOffZ ICON_StepZ
|
||||
#define ICON_ProbeOff ICON_AdvSet
|
||||
#define ICON_ProbeOffX ICON_StepX
|
||||
#define ICON_ProbeOffY ICON_StepY
|
||||
#define ICON_PIDNozzle ICON_SetEndTemp
|
||||
#define ICON_PIDbed ICON_SetBedTemp
|
||||
|
||||
/*-------------------------------------- System variable function --------------------------------------*/
|
||||
|
||||
// Handshake (1: Success, 0: Fail)
|
||||
bool DWIN_Handshake(void);
|
||||
|
||||
// Common DWIN startup
|
||||
void DWIN_Startup(void);
|
||||
|
||||
// Set the backlight luminance
|
||||
// luminance: (0x00-0xFF)
|
||||
void DWIN_Backlight_SetLuminance(const uint8_t luminance);
|
||||
|
||||
// Set screen display direction
|
||||
// dir: 0=0°, 1=90°, 2=180°, 3=270°
|
||||
void DWIN_Frame_SetDir(uint8_t dir);
|
||||
|
||||
// Update display
|
||||
void DWIN_UpdateLCD(void);
|
||||
|
||||
/*---------------------------------------- Drawing functions ----------------------------------------*/
|
||||
|
||||
// Clear screen
|
||||
// color: Clear screen color
|
||||
void DWIN_Frame_Clear(const uint16_t color);
|
||||
|
||||
// Draw a point
|
||||
// color: point color
|
||||
// width: point width 0x01-0x0F
|
||||
// height: point height 0x01-0x0F
|
||||
// x,y: upper left point
|
||||
void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y);
|
||||
|
||||
// Draw a line
|
||||
// color: Line segment color
|
||||
// xStart/yStart: Start point
|
||||
// xEnd/yEnd: End point
|
||||
void DWIN_Draw_Line(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
|
||||
|
||||
// Draw a Horizontal line
|
||||
// color: Line segment color
|
||||
// xStart/yStart: Start point
|
||||
// xLength: Line Length
|
||||
inline void DWIN_Draw_HLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xLength) {
|
||||
DWIN_Draw_Line(color, xStart, yStart, xStart + xLength - 1, yStart);
|
||||
}
|
||||
|
||||
// Draw a Vertical line
|
||||
// color: Line segment color
|
||||
// xStart/yStart: Start point
|
||||
// yLength: Line Length
|
||||
inline void DWIN_Draw_VLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t yLength) {
|
||||
DWIN_Draw_Line(color, xStart, yStart, xStart, yStart + yLength - 1);
|
||||
}
|
||||
|
||||
// Draw a rectangle
|
||||
// mode: 0=frame, 1=fill, 2=XOR fill
|
||||
// color: Rectangle color
|
||||
// xStart/yStart: upper left point
|
||||
// xEnd/yEnd: lower right point
|
||||
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,
|
||||
uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
|
||||
|
||||
// Draw a box
|
||||
// mode: 0=frame, 1=fill, 2=XOR fill
|
||||
// color: Rectangle color
|
||||
// xStart/yStart: upper left point
|
||||
// xSize/ySize: box size
|
||||
inline void DWIN_Draw_Box(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xSize, uint16_t ySize) {
|
||||
DWIN_Draw_Rectangle(mode, color, xStart, yStart, xStart + xSize - 1, yStart + ySize - 1);
|
||||
}
|
||||
|
||||
// Move a screen area
|
||||
// mode: 0, circle shift; 1, translation
|
||||
// dir: 0=left, 1=right, 2=up, 3=down
|
||||
// dis: Distance
|
||||
// color: Fill color
|
||||
// xStart/yStart: upper left point
|
||||
// xEnd/yEnd: bottom right point
|
||||
void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
|
||||
uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
|
||||
|
||||
/*---------------------------------------- Text related functions ----------------------------------------*/
|
||||
|
||||
// Draw a string
|
||||
// bShow: true=display background color; false=don't display background color
|
||||
// size: Font size
|
||||
// color: Character color
|
||||
// bColor: Background color
|
||||
// x/y: Upper-left coordinate of the string
|
||||
// *string: The string
|
||||
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string);
|
||||
|
||||
class __FlashStringHelper;
|
||||
|
||||
inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) {
|
||||
DWIN_Draw_String(bShow, size, color, bColor, x, y, (char *)title);
|
||||
}
|
||||
|
||||
// Draw a positive integer
|
||||
// bShow: true=display background color; false=don't display background color
|
||||
// zeroFill: true=zero fill; false=no zero fill
|
||||
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||
// size: Font size
|
||||
// color: Character color
|
||||
// bColor: Background color
|
||||
// iNum: Number of digits
|
||||
// x/y: Upper-left coordinate
|
||||
// value: Integer value
|
||||
void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||
uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint16_t value);
|
||||
|
||||
// Draw a floating point number
|
||||
// bShow: true=display background color; false=don't display background color
|
||||
// zeroFill: true=zero fill; false=no zero fill
|
||||
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
|
||||
// size: Font size
|
||||
// color: Character color
|
||||
// bColor: Background color
|
||||
// iNum: Number of whole digits
|
||||
// fNum: Number of decimal digits
|
||||
// x/y: Upper-left point
|
||||
// value: Float value
|
||||
void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
|
||||
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
|
||||
|
||||
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
||||
|
||||
// Draw JPG and cached in #0 virtual display area
|
||||
// id: Picture ID
|
||||
void DWIN_JPG_ShowAndCache(const uint8_t id);
|
||||
|
||||
// Draw an Icon
|
||||
// libID: Icon library ID
|
||||
// picID: Icon ID
|
||||
// x/y: Upper-left point
|
||||
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y);
|
||||
|
||||
// Unzip the JPG picture to a virtual display area
|
||||
// n: Cache index
|
||||
// id: Picture ID
|
||||
void DWIN_JPG_CacheToN(uint8_t n, uint8_t id);
|
||||
|
||||
// Unzip the JPG picture to virtual display area #1
|
||||
// id: Picture ID
|
||||
inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); }
|
||||
|
||||
// Copy area from virtual display area to current screen
|
||||
// cacheID: virtual area number
|
||||
// xStart/yStart: Upper-left of virtual area
|
||||
// xEnd/yEnd: Lower-right of virtual area
|
||||
// x/y: Screen paste point
|
||||
void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart,
|
||||
uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
|
||||
|
||||
// Animate a series of icons
|
||||
// animID: Animation ID up to 16
|
||||
// animate: animation on or off
|
||||
// libID: Icon library ID
|
||||
// picIDs: Icon starting ID
|
||||
// picIDe: Icon ending ID
|
||||
// x/y: Upper-left point
|
||||
// interval: Display time interval, unit 10mS
|
||||
void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs,
|
||||
uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval);
|
||||
|
||||
// Animation Control
|
||||
// state: 16 bits, each bit is the state of an animation id
|
||||
void DWIN_ICON_AnimationControl(uint16_t state);
|
||||
@@ -0,0 +1,180 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfig.h"
|
||||
|
||||
#if IS_DWIN_MARLINUI
|
||||
|
||||
#include "dwin_string.h"
|
||||
//#include "../../fontutils.h"
|
||||
|
||||
uint8_t DWIN_String::data[];
|
||||
uint16_t DWIN_String::span;
|
||||
uint8_t DWIN_String::len;
|
||||
|
||||
void DWIN_String::set() {
|
||||
//*data = 0x00;
|
||||
memset(data, 0x00, sizeof(data));
|
||||
span = 0;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
uint8_t read_byte(uint8_t *byte) { return *byte; }
|
||||
|
||||
/**
|
||||
* Add a string, applying substitutions for the following characters:
|
||||
*
|
||||
* = displays '0'....'10' for indexes 0 - 10
|
||||
* ~ displays '1'....'11' for indexes 0 - 10
|
||||
* * displays 'E1'...'E11' for indexes 0 - 10 (By default. Uses LCD_FIRST_TOOL)
|
||||
*/
|
||||
void DWIN_String::add(uint8_t *string, int8_t index, uint8_t *itemString) {
|
||||
wchar_t wchar;
|
||||
|
||||
while (*string) {
|
||||
string = get_utf8_value_cb(string, read_byte, &wchar);
|
||||
if (wchar > 255) wchar |= 0x0080;
|
||||
uint8_t ch = uint8_t(wchar & 0x00FF);
|
||||
|
||||
if (ch == '=' || ch == '~' || ch == '*') {
|
||||
if (index >= 0) {
|
||||
int8_t inum = index + ((ch == '=') ? 0 : LCD_FIRST_TOOL);
|
||||
if (ch == '*') add_character('E');
|
||||
if (inum >= 10) { add_character('0' + (inum / 10)); inum %= 10; }
|
||||
add_character('0' + inum);
|
||||
}
|
||||
else {
|
||||
add(index == -2 ? GET_TEXT(MSG_CHAMBER) : GET_TEXT(MSG_BED));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else if (ch == '$' && itemString) {
|
||||
add(itemString);
|
||||
continue;
|
||||
}
|
||||
|
||||
add_character(ch);
|
||||
}
|
||||
eol();
|
||||
}
|
||||
|
||||
void DWIN_String::add(uint8_t *string, uint8_t max_len) {
|
||||
wchar_t wchar;
|
||||
while (*string && max_len) {
|
||||
string = get_utf8_value_cb(string, read_byte, &wchar);
|
||||
/*
|
||||
if (wchar > 255) wchar |= 0x0080;
|
||||
uint8_t ch = uint8_t(wchar & 0x00FF);
|
||||
add_character(ch);
|
||||
*/
|
||||
add(wchar);
|
||||
max_len--;
|
||||
}
|
||||
eol();
|
||||
}
|
||||
|
||||
void DWIN_String::add(wchar_t character) {
|
||||
int ret;
|
||||
size_t idx = 0;
|
||||
dwin_charmap_t pinval;
|
||||
dwin_charmap_t *copy_address = nullptr;
|
||||
pinval.uchar = character;
|
||||
pinval.idx = -1;
|
||||
|
||||
// For 8-bit ASCII just print the single character
|
||||
char str[] = { '?', 0 };
|
||||
if (character < 255) {
|
||||
str[0] = (char)character;
|
||||
}
|
||||
else {
|
||||
copy_address = nullptr;
|
||||
ret = pf_bsearch_r((void *)g_dwin_charmap_device, COUNT(g_dwin_charmap_device), pf_bsearch_cb_comp_dwinmap_pgm, (void *)&pinval, &idx);
|
||||
if (ret >= 0) {
|
||||
copy_address = (dwin_charmap_t*)(g_dwin_charmap_device + idx);
|
||||
}
|
||||
else {
|
||||
ret = pf_bsearch_r((void *)g_dwin_charmap_common, COUNT(g_dwin_charmap_common), pf_bsearch_cb_comp_dwinmap_pgm, (void *)&pinval, &idx);
|
||||
if (ret >= 0)
|
||||
copy_address = (dwin_charmap_t*)(g_dwin_charmap_common + idx);
|
||||
}
|
||||
if (ret >= 0) {
|
||||
dwin_charmap_t localval;
|
||||
memcpy_P(&localval, copy_address, sizeof(localval));
|
||||
str[0] = localval.idx;
|
||||
str[1] = localval.idx2;
|
||||
}
|
||||
}
|
||||
if (str[0]) add_character(str[0]);
|
||||
if (str[1]) add_character(str[1]);
|
||||
}
|
||||
|
||||
void DWIN_String::add_character(uint8_t character) {
|
||||
if (len < MAX_STRING_LENGTH) {
|
||||
data[len] = character;
|
||||
len++;
|
||||
//span += glyph(character)->DWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void DWIN_String::rtrim(uint8_t character) {
|
||||
while (len) {
|
||||
if (data[len - 1] == 0x20 || data[len - 1] == character) {
|
||||
len--;
|
||||
//span -= glyph(data[length])->DWidth;
|
||||
eol();
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void DWIN_String::ltrim(uint8_t character) {
|
||||
uint16_t i, j;
|
||||
for (i = 0; (i < len) && (data[i] == 0x20 || data[i] == character); i++) {
|
||||
//span -= glyph(data[i])->DWidth;
|
||||
}
|
||||
if (i == 0) return;
|
||||
for (j = 0; i < len; data[j++] = data[i++]);
|
||||
len = j;
|
||||
eol();
|
||||
}
|
||||
|
||||
void DWIN_String::trim(uint8_t character) {
|
||||
rtrim(character);
|
||||
ltrim(character);
|
||||
}
|
||||
|
||||
/* return v1 - v2 */
|
||||
int dwin_charmap_compare(dwin_charmap_t *v1, dwin_charmap_t *v2) {
|
||||
return (v1->uchar < v2->uchar) ? -1 : (v1->uchar > v2->uchar) ? 1 : 0;
|
||||
}
|
||||
|
||||
int pf_bsearch_cb_comp_dwinmap_pgm(void *userdata, size_t idx, void * data_pin) {
|
||||
dwin_charmap_t localval;
|
||||
dwin_charmap_t *p_dwin_charmap = (dwin_charmap_t *)userdata;
|
||||
memcpy_P(&localval, p_dwin_charmap + idx, sizeof(localval));
|
||||
return dwin_charmap_compare(&localval, (dwin_charmap_t *)data_pin);
|
||||
}
|
||||
|
||||
DWIN_String dwin_string;
|
||||
|
||||
#endif // IS_DWIN_MARLINUI
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,193 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* lcd/e3v2/marlinui/lcdprint_dwin.cpp
|
||||
*
|
||||
* Due to DWIN hardware limitations simplified characters are used
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if IS_DWIN_MARLINUI
|
||||
|
||||
#include "lcdprint_dwin.h"
|
||||
#include "dwin_lcd.h"
|
||||
#include "dwin_string.h"
|
||||
|
||||
#include "../../marlinui.h"
|
||||
#include "../../../MarlinCore.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
cursor_t cursor;
|
||||
|
||||
extern dwin_font_t dwin_font;
|
||||
|
||||
void lcd_moveto_xy(const lcd_uint_t x, const lcd_uint_t y) { cursor.x = x; cursor.y = y; }
|
||||
|
||||
void lcd_moveto(const lcd_uint_t col, const lcd_uint_t row) {
|
||||
cursor.x = col * dwin_font.width;
|
||||
cursor.y = (row * (dwin_font.height + EXTRA_ROW_HEIGHT)) + (EXTRA_ROW_HEIGHT / 2);
|
||||
}
|
||||
|
||||
inline void lcd_advance_cursor() { cursor.x += dwin_font.width; }
|
||||
|
||||
void lcd_put_int(const int i) {
|
||||
// TODO: Draw an int at the cursor position, advance the cursor
|
||||
}
|
||||
|
||||
int lcd_put_dwin_string() {
|
||||
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
||||
cursor.x += dwin_string.length() * dwin_font.width;
|
||||
return dwin_string.length();
|
||||
}
|
||||
|
||||
// return < 0 on error
|
||||
// return the advanced cols
|
||||
int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
|
||||
dwin_string.set();
|
||||
dwin_string.add(c);
|
||||
dwin_string.truncate(max_length);
|
||||
// Draw the char(s) at the cursor and advance the cursor
|
||||
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
||||
cursor.x += dwin_string.length() * dwin_font.width;
|
||||
return dwin_string.length();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Draw a UTF-8 string
|
||||
*
|
||||
* @param utf8_str : the UTF-8 string
|
||||
* @param cb_read_byte : the callback function to read one byte from the utf8_str (from RAM or ROM)
|
||||
* @param max_length : the pixel length of the string allowed (or number of slots in HD44780)
|
||||
*
|
||||
* @return the number of pixels advanced
|
||||
*
|
||||
* Draw a UTF-8 string
|
||||
*/
|
||||
static int lcd_put_u8str_max_cb(const char * utf8_str, uint8_t (*cb_read_byte)(uint8_t * str), pixel_len_t max_length) {
|
||||
uint8_t *p = (uint8_t *)utf8_str;
|
||||
dwin_string.set();
|
||||
while (dwin_string.length() < max_length) {
|
||||
wchar_t ch = 0;
|
||||
p = get_utf8_value_cb(p, cb_read_byte, &ch);
|
||||
if (!ch) break;
|
||||
dwin_string.add(ch);
|
||||
}
|
||||
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
||||
cursor.x += dwin_string.length() * dwin_font.width;
|
||||
return dwin_string.length();
|
||||
}
|
||||
|
||||
int lcd_put_u8str_max(const char * utf8_str, pixel_len_t max_length) {
|
||||
return lcd_put_u8str_max_cb(utf8_str, read_byte_ram, max_length);
|
||||
}
|
||||
|
||||
int lcd_put_u8str_max_P(PGM_P utf8_str_P, pixel_len_t max_length) {
|
||||
return lcd_put_u8str_max_cb(utf8_str_P, read_byte_rom, max_length);
|
||||
}
|
||||
|
||||
lcd_uint_t lcd_put_u8str_ind_P(PGM_P const pstr, const int8_t ind, PGM_P const inStr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
|
||||
dwin_string.set();
|
||||
dwin_string.add((uint8_t*)pstr, ind, (uint8_t*)inStr);
|
||||
dwin_string.truncate(maxlen);
|
||||
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, (char*)dwin_string.string());
|
||||
cursor.x += dwin_string.length() * dwin_font.width;
|
||||
return dwin_string.length();
|
||||
}
|
||||
|
||||
#if ENABLED(DEBUG_LCDPRINT)
|
||||
|
||||
int test_dwin_charmap(dwin_charmap_t *data, size_t size, char *name, char flg_show_contents) {
|
||||
int ret;
|
||||
size_t idx = 0;
|
||||
dwin_charmap_t preval = { 0, 0, 0 };
|
||||
dwin_charmap_t pinval = { 0, 0, 0 };
|
||||
char flg_error = 0;
|
||||
|
||||
int i;
|
||||
|
||||
TRACE("Test %s\n", name);
|
||||
|
||||
for (i = 0; i < size; i ++) {
|
||||
memcpy_P(&pinval, &(data[i]), sizeof(pinval));
|
||||
|
||||
if (flg_show_contents) {
|
||||
#if 1
|
||||
TRACE("[% 4d] % 6" PRIu32 "(0x%04" PRIX32 ") --> 0x%02X,0x%02X%s\n", i, pinval.uchar, pinval.uchar, (unsigned int)(pinval.idx), (unsigned int)(pinval.idx2), (preval.uchar < pinval.uchar?"":" <--- ERROR"));
|
||||
#else
|
||||
TRACE("[% 4d]", i);
|
||||
TRACE("% 6" PRIu32 "(0x%04" PRIX32 "),", pinval.uchar, pinval.uchar);
|
||||
TRACE("0x%02X,", (unsigned int)(pinval.idx));
|
||||
TRACE("0x%02X,", (unsigned int)(pinval.idx2));
|
||||
TRACE("%s", (preval.uchar < pinval.uchar?"":" <--- ERROR"));
|
||||
#endif
|
||||
}
|
||||
if (preval.uchar >= pinval.uchar) {
|
||||
flg_error = 1;
|
||||
//TRACE("Error: out of order in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
|
||||
//return -1;
|
||||
}
|
||||
memcpy(&preval, &pinval, sizeof(pinval));
|
||||
|
||||
ret = pf_bsearch_r((void *)data, size, pf_bsearch_cb_comp_dwinmap_pgm, (void *)&pinval, &idx);
|
||||
if (ret < 0) {
|
||||
flg_error = 1;
|
||||
TRACE("Error: not found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
|
||||
//return -1;
|
||||
}
|
||||
if (idx != i) {
|
||||
flg_error = 1;
|
||||
TRACE("Error: wrong index found item in array %s: idx=%d, val=%d(0x%x)\n", name, i, pinval.uchar, pinval.uchar);
|
||||
//return -1;
|
||||
}
|
||||
}
|
||||
if (flg_error) {
|
||||
TRACE("\nError: in array %s\n\n", name);
|
||||
return -1;
|
||||
}
|
||||
TRACE("\nPASS array %s\n\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_dwin_charmap_all() {
|
||||
int flg_error = 0;
|
||||
if (test_dwin_charmap(g_dwin_charmap_device, COUNT(g_dwin_charmap_device), "g_dwin_charmap_device", 0) < 0) {
|
||||
flg_error = 1;
|
||||
test_dwin_charmap(g_dwin_charmap_device, COUNT(g_dwin_charmap_device), "g_dwin_charmap_device", 1);
|
||||
}
|
||||
if (test_dwin_charmap(g_dwin_charmap_common, COUNT(g_dwin_charmap_common), "g_dwin_charmap_common", 0) < 0) {
|
||||
flg_error = 1;
|
||||
test_dwin_charmap(g_dwin_charmap_common, COUNT(g_dwin_charmap_common), "g_dwin_charmap_common", 1);
|
||||
}
|
||||
if (flg_error) {
|
||||
TRACE("\nFAILED in dwin tests!\n");
|
||||
return -1;
|
||||
}
|
||||
TRACE("\nPASS in dwin tests.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // DEBUG_LCDPRINT
|
||||
|
||||
#endif // IS_DWIN_MARLINUI
|
||||
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../../lcdprint.h"
|
||||
|
||||
typedef struct { int16_t x, y; } cursor_t;
|
||||
extern cursor_t cursor;
|
||||
|
||||
int lcd_put_dwin_string();
|
||||
void lcd_moveto_xy(const lcd_uint_t, const lcd_uint_t);
|
||||
@@ -0,0 +1,146 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* lcd/e3v2/marlinui/lcdprint_dwin.h
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
#include "dwin_lcd.h"
|
||||
|
||||
typedef uint16_t dwin_coord_t; // Screen can be pretty big
|
||||
typedef uint16_t lcd_uint_t;
|
||||
typedef int16_t lcd_int_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t index, width, height;
|
||||
uint16_t fg, bg;
|
||||
bool solid;
|
||||
} dwin_font_t;
|
||||
|
||||
extern dwin_font_t dwin_font;
|
||||
|
||||
// Only Western languages support big / small fonts
|
||||
//#if DISABLED(DISPLAY_CHARSET_ISO10646_1)
|
||||
// #undef USE_BIG_EDIT_FONT
|
||||
// #undef USE_SMALL_INFOFONT
|
||||
//#endif
|
||||
|
||||
#if ENABLED(USE_BIG_EDIT_FONT)
|
||||
#define DWIN_FONT_EDIT font10x20
|
||||
#else
|
||||
#define DWIN_FONT_EDIT font8x16
|
||||
#endif
|
||||
|
||||
#define DWIN_FONT_INFO font8x16
|
||||
|
||||
#if DWIN_FONT_MENU == font6x12
|
||||
#define MENU_FONT_WIDTH 6
|
||||
#define MENU_FONT_ASCENT 10
|
||||
#define MENU_FONT_DESCENT 2
|
||||
#elif DWIN_FONT_MENU == font8x16
|
||||
#define MENU_FONT_WIDTH 8
|
||||
#define MENU_FONT_ASCENT 13
|
||||
#define MENU_FONT_DESCENT 3
|
||||
#elif DWIN_FONT_MENU == font10x20
|
||||
#define MENU_FONT_WIDTH 10
|
||||
#define MENU_FONT_ASCENT 16
|
||||
#define MENU_FONT_DESCENT 4
|
||||
#endif
|
||||
#define MENU_FONT_HEIGHT (MENU_FONT_ASCENT + MENU_FONT_DESCENT)
|
||||
|
||||
#define EXTRA_ROW_HEIGHT 8
|
||||
#define MENU_LINE_HEIGHT (MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT)
|
||||
|
||||
#if DWIN_FONT_EDIT == font6x12
|
||||
#define EDIT_FONT_WIDTH 6
|
||||
#define EDIT_FONT_ASCENT 10
|
||||
#define EDIT_FONT_DESCENT 2
|
||||
#elif DWIN_FONT_EDIT == font8x16
|
||||
#define EDIT_FONT_WIDTH 8
|
||||
#define EDIT_FONT_ASCENT 13
|
||||
#define EDIT_FONT_DESCENT 3
|
||||
#elif DWIN_FONT_EDIT == font10x20
|
||||
#define EDIT_FONT_WIDTH 10
|
||||
#define EDIT_FONT_ASCENT 16
|
||||
#define EDIT_FONT_DESCENT 4
|
||||
#endif
|
||||
#define EDIT_FONT_HEIGHT (EDIT_FONT_ASCENT + EDIT_FONT_DESCENT)
|
||||
|
||||
#if DWIN_FONT_INFO == font6x12
|
||||
#define INFO_FONT_WIDTH 6
|
||||
#define INFO_FONT_ASCENT 10
|
||||
#define INFO_FONT_DESCENT 2
|
||||
#elif DWIN_FONT_INFO == font8x16
|
||||
#define INFO_FONT_WIDTH 8
|
||||
#define INFO_FONT_ASCENT 13
|
||||
#define INFO_FONT_DESCENT 3
|
||||
#elif DWIN_FONT_INFO == font10x20
|
||||
#define INFO_FONT_WIDTH 10
|
||||
#define INFO_FONT_ASCENT 16
|
||||
#define INFO_FONT_DESCENT 4
|
||||
#endif
|
||||
#define INFO_FONT_HEIGHT (INFO_FONT_ASCENT + INFO_FONT_DESCENT)
|
||||
|
||||
#if DWIN_FONT_STAT == font6x12
|
||||
#define STAT_FONT_WIDTH 6
|
||||
#define STAT_FONT_ASCENT 10
|
||||
#define STAT_FONT_DESCENT 2
|
||||
#elif DWIN_FONT_STAT == font8x16
|
||||
#define STAT_FONT_WIDTH 8
|
||||
#define STAT_FONT_ASCENT 13
|
||||
#define STAT_FONT_DESCENT 3
|
||||
#elif DWIN_FONT_STAT == font10x20
|
||||
#define STAT_FONT_WIDTH 10
|
||||
#define STAT_FONT_ASCENT 16
|
||||
#define STAT_FONT_DESCENT 4
|
||||
#elif DWIN_FONT_STAT == font12x24
|
||||
#define STAT_FONT_WIDTH 12
|
||||
#define STAT_FONT_ASCENT 19
|
||||
#define STAT_FONT_DESCENT 5
|
||||
#elif DWIN_FONT_STAT == font14x28
|
||||
#define STAT_FONT_WIDTH 14
|
||||
#define STAT_FONT_ASCENT 22
|
||||
#define STAT_FONT_DESCENT 6
|
||||
#elif DWIN_FONT_STAT == font16x32
|
||||
#define STAT_FONT_WIDTH 16
|
||||
#define STAT_FONT_ASCENT 26
|
||||
#define STAT_FONT_DESCENT 6
|
||||
#elif DWIN_FONT_STAT == font20x40
|
||||
#define STAT_FONT_WIDTH 20
|
||||
#define STAT_FONT_ASCENT 32
|
||||
#define STAT_FONT_DESCENT 8
|
||||
#elif DWIN_FONT_STAT == font24x48
|
||||
#define STAT_FONT_WIDTH 24
|
||||
#define STAT_FONT_ASCENT 38
|
||||
#define STAT_FONT_DESCENT 10
|
||||
#elif DWIN_FONT_STAT == font28x56
|
||||
#define STAT_FONT_WIDTH 28
|
||||
#define STAT_FONT_ASCENT 44
|
||||
#define STAT_FONT_DESCENT 12
|
||||
#elif DWIN_FONT_STAT == font32x64
|
||||
#define STAT_FONT_WIDTH 32
|
||||
#define STAT_FONT_ASCENT 50
|
||||
#define STAT_FONT_DESCENT 14
|
||||
#endif
|
||||
#define STAT_FONT_HEIGHT (STAT_FONT_ASCENT + STAT_FONT_DESCENT)
|
||||
@@ -0,0 +1,595 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if IS_DWIN_MARLINUI
|
||||
|
||||
#include "marlinui_dwin.h"
|
||||
#include "dwin_lcd.h"
|
||||
#include "dwin_string.h"
|
||||
|
||||
//#include "../../lcdprint.h"
|
||||
#include "lcdprint_dwin.h"
|
||||
#include "../../fontutils.h"
|
||||
#include "../../../libs/numtostr.h"
|
||||
#include "../../marlinui.h"
|
||||
|
||||
#include "../../../sd/cardreader.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../module/temperature.h"
|
||||
#include "../../../module/printcounter.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#include "../../../libs/duration_t.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
#include "../../../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
|
||||
// DWIN printing specifies the font on each string operation
|
||||
// but we'll make the font modal for Marlin
|
||||
dwin_font_t dwin_font = { font8x16, 8, 16, Color_White, Color_Bg_Black, true };
|
||||
void MarlinUI::set_font(const uint8_t font_nr) {
|
||||
if (font_nr != dwin_font.index) {
|
||||
dwin_font.index = font_nr;
|
||||
uint8_t w, h;
|
||||
switch (font_nr) {
|
||||
default:
|
||||
case font6x12: w = 6; h = 12; break;
|
||||
case font8x16: w = 8; h = 16; break;
|
||||
case font10x20: w = 10; h = 20; break;
|
||||
case font12x24: w = 12; h = 24; break;
|
||||
case font14x28: w = 14; h = 28; break;
|
||||
case font16x32: w = 16; h = 32; break;
|
||||
case font20x40: w = 20; h = 40; break;
|
||||
case font24x48: w = 24; h = 48; break;
|
||||
case font28x56: w = 28; h = 56; break;
|
||||
case font32x64: w = 32; h = 64; break;
|
||||
}
|
||||
dwin_font.width = w;
|
||||
dwin_font.height = h;
|
||||
// TODO: Array with dimensions, auto fit menu items,
|
||||
// update char width / height of the screen based on
|
||||
// new (fixed-width) font size.
|
||||
}
|
||||
}
|
||||
|
||||
// This display is always detected
|
||||
bool MarlinUI::detected() { return true; }
|
||||
|
||||
// Initialize or re-initialize the LCD
|
||||
void MarlinUI::init_lcd() {
|
||||
DWIN_Startup();
|
||||
|
||||
// Load the assets JPG (currently just the status screen 'icon')
|
||||
DWIN_JPG_CacheToN(1, DWIN_MarlinUI_Assets);
|
||||
}
|
||||
|
||||
// This LCD should clear where it will draw anew
|
||||
void MarlinUI::clear_lcd() {
|
||||
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations
|
||||
DWIN_Frame_Clear(Color_Bg_Black);
|
||||
DWIN_UpdateLCD();
|
||||
|
||||
did_first_redraw = false;
|
||||
}
|
||||
|
||||
#if ENABLED(SHOW_BOOTSCREEN)
|
||||
|
||||
void MarlinUI::show_bootscreen() {
|
||||
clear_lcd();
|
||||
dwin_string.set(F(SHORT_BUILD_VERSION));
|
||||
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
#define LOGO_CENTER ((LCD_PIXEL_WIDTH) / 2)
|
||||
#define INFO_CENTER LOGO_CENTER
|
||||
#define VERSION_Y 330
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, LOGO_CENTER - 174 / 2, 280);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, LOGO_CENTER - 180 / 2, 420);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, LOGO_CENTER - 100 / 2, 440);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_Copyright, LOGO_CENTER - 126 / 2, 460);
|
||||
#else
|
||||
#define LOGO_CENTER (280 / 2)
|
||||
#define INFO_CENTER ((LCD_PIXEL_WIDTH) - 200 / 2)
|
||||
#define VERSION_Y 84
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, INFO_CENTER - 174 / 2, 60);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, INFO_CENTER - 180 / 2, 130);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152);
|
||||
DWIN_ICON_Show(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200);
|
||||
#endif
|
||||
|
||||
DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length() * 10) / 2, VERSION_Y, S(dwin_string.string()));
|
||||
DWIN_UpdateLCD();
|
||||
}
|
||||
|
||||
void MarlinUI::bootscreen_completion(const millis_t sofar) {
|
||||
if ((BOOTSCREEN_TIMEOUT) > sofar) safe_delay((BOOTSCREEN_TIMEOUT) - sofar);
|
||||
clear_lcd();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// The kill screen is displayed for unrecoverable conditions
|
||||
void MarlinUI::draw_kill_screen() {
|
||||
set_font(DWIN_FONT_ALERT);
|
||||
DWIN_Frame_Clear(Color_Bg_Black);
|
||||
dwin_font.fg = Color_Error_Red;
|
||||
dwin_font.solid = false;
|
||||
DWIN_Draw_Rectangle(1, Color_Bg_Window, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
|
||||
// make the frame a few pixels thick
|
||||
DWIN_Draw_Rectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
|
||||
DWIN_Draw_Rectangle(0, Color_Yellow, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21);
|
||||
DWIN_Draw_Rectangle(0, Color_Yellow, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22);
|
||||
|
||||
uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2),
|
||||
cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2);
|
||||
|
||||
#if ENABLED(DWIN_MARLINUI_LANDSCAPE)
|
||||
cx += (96 / 2 / dwin_font.width);
|
||||
DWIN_ICON_Show(ICON, ICON_Halted, 40, (LCD_PIXEL_HEIGHT - 96) / 2);
|
||||
#else
|
||||
DWIN_ICON_Show(ICON, ICON_Halted, (LCD_PIXEL_WIDTH - 96) / 2, 40);
|
||||
#endif
|
||||
|
||||
uint8_t slen = utf8_strlen(status_message);
|
||||
lcd_moveto(cx - (slen / 2), cy - 1);
|
||||
lcd_put_u8str(status_message);
|
||||
|
||||
slen = utf8_strlen(S(GET_TEXT_F(MSG_HALTED)));
|
||||
lcd_moveto(cx - (slen / 2), cy);
|
||||
lcd_put_u8str_P((const char*)GET_TEXT_F(MSG_HALTED));
|
||||
|
||||
slen = utf8_strlen(S(GET_TEXT_F(MSG_HALTED)));
|
||||
lcd_moveto(cx - (slen / 2), cy + 1);
|
||||
lcd_put_u8str_P((const char*)GET_TEXT_F(MSG_HALTED));
|
||||
}
|
||||
|
||||
//
|
||||
// Status Message
|
||||
//
|
||||
void MarlinUI::draw_status_message(const bool blink) {
|
||||
set_font(DWIN_FONT_STAT);
|
||||
dwin_font.solid = true;
|
||||
dwin_font.fg = Color_White;
|
||||
dwin_font.bg = Color_Bg_Black;
|
||||
lcd_moveto_xy(0, LCD_PIXEL_HEIGHT - (STAT_FONT_HEIGHT) - 1);
|
||||
|
||||
constexpr uint8_t max_status_chars = (LCD_PIXEL_WIDTH) / (STAT_FONT_WIDTH);
|
||||
|
||||
auto status_changed = []{
|
||||
static uint16_t old_hash = 0x0000;
|
||||
uint16_t hash = 0x0000;
|
||||
for (uint8_t i = 0; i < MAX_MESSAGE_LENGTH; i++) {
|
||||
const char c = ui.status_message[i];
|
||||
if (!c) break;
|
||||
hash = ((hash << 1) | (hash >> 15)) ^ c;
|
||||
}
|
||||
const bool hash_changed = hash != old_hash;
|
||||
old_hash = hash;
|
||||
return hash_changed || !ui.did_first_redraw;
|
||||
};
|
||||
|
||||
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||
static bool last_blink = false;
|
||||
|
||||
// Get the UTF8 character count of the string
|
||||
uint8_t slen = utf8_strlen(status_message);
|
||||
|
||||
// If the string fits into the LCD, just print it and do not scroll it
|
||||
if (slen <= max_status_chars) {
|
||||
|
||||
if (status_changed()) {
|
||||
|
||||
// The string isn't scrolling and may not fill the screen
|
||||
lcd_put_u8str(status_message);
|
||||
|
||||
// Fill the rest with spaces
|
||||
while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; }
|
||||
}
|
||||
}
|
||||
else {
|
||||
// String is larger than the available line space
|
||||
|
||||
// Get a pointer to the next valid UTF8 character
|
||||
// and the string remaining length
|
||||
uint8_t rlen;
|
||||
const char *stat = status_and_len(rlen);
|
||||
lcd_put_u8str_max(stat, max_status_chars);
|
||||
|
||||
// If the string doesn't completely fill the line...
|
||||
if (rlen < max_status_chars) {
|
||||
lcd_put_wchar('.'); // Always at 1+ spaces left, draw a dot
|
||||
uint8_t chars = max_status_chars - rlen; // Amount of space left in characters
|
||||
if (--chars) { // Draw a second dot if there's space
|
||||
lcd_put_wchar('.');
|
||||
if (--chars)
|
||||
lcd_put_u8str_max(status_message, chars); // Print a second copy of the message
|
||||
}
|
||||
}
|
||||
|
||||
if (last_blink != blink) {
|
||||
last_blink = blink;
|
||||
advance_status_scroll();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
UNUSED(blink);
|
||||
|
||||
if (status_changed()) {
|
||||
// Get the UTF8 character count of the string
|
||||
uint8_t slen = utf8_strlen(status_message);
|
||||
|
||||
// Just print the string to the LCD
|
||||
lcd_put_u8str_max(status_message, max_status_chars);
|
||||
|
||||
// Fill the rest with spaces if there are missing spaces
|
||||
while (slen < max_status_chars) { lcd_put_wchar(' '); ++slen; }
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
|
||||
#include "../../menu/menu.h"
|
||||
|
||||
#if ENABLED(ADVANCED_PAUSE_FEATURE)
|
||||
|
||||
void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
|
||||
|
||||
dwin_font.solid = false;
|
||||
dwin_font.fg = Color_White;
|
||||
dwin_string.set("E");
|
||||
dwin_string.add('1' + extruder);
|
||||
dwin_string.add(' ');
|
||||
dwin_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
|
||||
dwin_string.add('/');
|
||||
if (get_blink() || !thermalManager.heater_idle[thermalManager.idle_index_for_id(extruder)].timed_out)
|
||||
dwin_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
|
||||
else
|
||||
dwin_string.add(PSTR(" "));
|
||||
|
||||
lcd_moveto(LCD_WIDTH - dwin_string.length(), row);
|
||||
lcd_put_dwin_string();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Set the colors for a menu item based on whether it is selected
|
||||
static bool mark_as_selected(const uint8_t row, const bool sel, const bool is_static=false) {
|
||||
const dwin_coord_t y = row * (MENU_LINE_HEIGHT) + 1;
|
||||
if (y >= LCD_PIXEL_HEIGHT) return false;
|
||||
|
||||
if (is_static && sel)
|
||||
DWIN_Draw_Box(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||
else {
|
||||
#if ENABLED(MENU_HOLLOW_FRAME)
|
||||
DWIN_Draw_Box(1, Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||
if (sel) DWIN_Draw_Box(0, Select_Color, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||
#else
|
||||
DWIN_Draw_Box(1, sel ? Select_Color : Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Draw a static line of text in the same idiom as a menu item
|
||||
|
||||
void MenuItem_static::draw(const uint8_t row, PGM_P const pstr, const uint8_t style/*=SS_DEFAULT*/, const char * const vstr/*=nullptr*/) {
|
||||
// Call mark_as_selected to draw a bigger selection box
|
||||
// and draw the text without a background
|
||||
if (mark_as_selected(row, (bool)(style & SS_INVERT), true)) {
|
||||
ui.set_font(DWIN_FONT_MENU);
|
||||
dwin_font.solid = false;
|
||||
dwin_font.fg = Color_White;
|
||||
|
||||
dwin_string.set();
|
||||
const int8_t plen = pstr ? utf8_strlen_P(pstr) : 0,
|
||||
vlen = vstr ? utf8_strlen(vstr) : 0;
|
||||
if (style & SS_CENTER) {
|
||||
int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2;
|
||||
while (--pad) dwin_string.add(' ');
|
||||
}
|
||||
|
||||
if (plen) dwin_string.add((uint8_t*)pstr, itemIndex, (uint8_t*)itemString);
|
||||
if (vlen) dwin_string.add((uint8_t*)vstr);
|
||||
if (style & SS_CENTER) {
|
||||
int8_t pad = (LCD_WIDTH - 1 - plen - vlen) / 2;
|
||||
while (--pad) dwin_string.add(' ');
|
||||
}
|
||||
|
||||
lcd_moveto(1, row);
|
||||
lcd_put_dwin_string();
|
||||
}
|
||||
}
|
||||
|
||||
// Draw a generic menu item
|
||||
void MenuItemBase::_draw(const bool sel, const uint8_t row, PGM_P const pstr, const char, const char post_char) {
|
||||
if (mark_as_selected(row, sel)) {
|
||||
ui.set_font(DWIN_FONT_MENU);
|
||||
dwin_font.solid = false;
|
||||
dwin_font.fg = Color_White;
|
||||
|
||||
dwin_string.set(pstr, itemIndex, itemString);
|
||||
|
||||
pixel_len_t n = LCD_WIDTH - 1 - dwin_string.length();
|
||||
while (--n > 1) dwin_string.add(' ');
|
||||
|
||||
dwin_string.add(post_char);
|
||||
|
||||
lcd_moveto(1, row);
|
||||
lcd_put_dwin_string();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw a menu item with an editable value
|
||||
//
|
||||
void MenuEditItemBase::draw(const bool sel, const uint8_t row, PGM_P const pstr, const char* const data, const bool pgm) {
|
||||
if (mark_as_selected(row, sel)) {
|
||||
ui.set_font(DWIN_FONT_MENU);
|
||||
dwin_font.solid = false;
|
||||
dwin_font.fg = Color_White;
|
||||
|
||||
const uint8_t vallen = (pgm ? utf8_strlen_P(data) : utf8_strlen(S(data)));
|
||||
|
||||
dwin_string.set(pstr, itemIndex, itemString);
|
||||
if (vallen) dwin_string.add(':');
|
||||
|
||||
lcd_moveto(1, row);
|
||||
lcd_put_dwin_string();
|
||||
|
||||
if (vallen) {
|
||||
dwin_font.fg = Color_Yellow;
|
||||
dwin_string.set(data);
|
||||
lcd_moveto(LCD_WIDTH - vallen - 1, row);
|
||||
lcd_put_dwin_string();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Draw an edit screen with label and current value
|
||||
//
|
||||
void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const value/*=nullptr*/) {
|
||||
ui.encoder_direction_normal();
|
||||
|
||||
const dwin_coord_t labellen = utf8_strlen_P(pstr), vallen = utf8_strlen(value);
|
||||
|
||||
dwin_string.set();
|
||||
dwin_string.add((uint8_t*)pstr, itemIndex);
|
||||
if (vallen) dwin_string.add(':'); // If a value is included, add a colon
|
||||
|
||||
// Assume the label is alpha-numeric (with a descender)
|
||||
const uint16_t row = (LCD_HEIGHT / 2) - 1;
|
||||
|
||||
dwin_font.fg = Color_White;
|
||||
dwin_font.solid = true;
|
||||
lcd_moveto((LCD_WIDTH - labellen + !!vallen) / 2, row);
|
||||
lcd_put_dwin_string();
|
||||
|
||||
// If a value is included, print the value in larger text below the label
|
||||
if (vallen) {
|
||||
dwin_string.set();
|
||||
dwin_string.add(value);
|
||||
|
||||
const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2;
|
||||
DWIN_Draw_String(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string()));
|
||||
|
||||
extern screenFunc_t _manual_move_func_ptr;
|
||||
if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) {
|
||||
|
||||
const dwin_coord_t slider_length = LCD_PIXEL_WIDTH - TERN(DWIN_MARLINUI_LANDSCAPE, 120, 20),
|
||||
slider_height = 16,
|
||||
slider_x = (LCD_PIXEL_WIDTH - slider_length) / 2,
|
||||
slider_y = by + 32 + 4,
|
||||
amount = ui.encoderPosition * slider_length / maxEditValue;
|
||||
|
||||
DWIN_Draw_Rectangle(1, Color_Bg_Window, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1);
|
||||
if (amount > 0)
|
||||
DWIN_Draw_Box(1, BarFill_Color, slider_x, slider_y, amount, slider_height);
|
||||
if (amount < slider_length)
|
||||
DWIN_Draw_Box(1, Color_Bg_Black, slider_x + amount, slider_y, slider_length - amount, slider_height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void draw_boxed_string(const bool yesopt, PGM_P const pstr, const bool inv) {
|
||||
const uint8_t len = utf8_strlen_P(pstr),
|
||||
mar = TERN(DWIN_MARLINUI_PORTRAIT, 1, 4),
|
||||
col = yesopt ? LCD_WIDTH - mar - len : mar,
|
||||
row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1);
|
||||
lcd_moveto(col, row);
|
||||
DWIN_Draw_Box(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2);
|
||||
lcd_put_u8str_P(col, row, pstr);
|
||||
}
|
||||
|
||||
void MenuItem_confirm::draw_select_screen(
|
||||
PGM_P const yes, PGM_P const no, const bool yesno,
|
||||
PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/
|
||||
) {
|
||||
ui.set_font(DWIN_FONT_MENU);
|
||||
dwin_font.solid = false;
|
||||
dwin_font.fg = Color_White;
|
||||
ui.draw_select_screen_prompt(pref, string, suff);
|
||||
draw_boxed_string(false, no, !yesno);
|
||||
draw_boxed_string(true, yes, yesno);
|
||||
}
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
|
||||
void MenuItem_sdbase::draw(const bool sel, const uint8_t row, PGM_P const, CardReader &theCard, const bool isDir) {
|
||||
if (mark_as_selected(row, sel)) {
|
||||
dwin_string.set();
|
||||
|
||||
uint8_t maxlen = LCD_WIDTH - 1;
|
||||
if (isDir) {
|
||||
dwin_string.add(LCD_STR_FOLDER " ");
|
||||
maxlen -= 2;
|
||||
}
|
||||
|
||||
dwin_string.add((uint8_t*)ui.scrolled_filename(theCard, maxlen, row, sel), maxlen);
|
||||
uint8_t n = maxlen - dwin_string.length();
|
||||
while (n > 0) { dwin_string.add(' '); --n; }
|
||||
lcd_moveto(1, row);
|
||||
lcd_put_dwin_string();
|
||||
}
|
||||
}
|
||||
|
||||
#endif // SDSUPPORT
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
||||
/**
|
||||
* UBL LCD "radar" map data
|
||||
*/
|
||||
#define MAP_UPPER_LEFT_CORNER_X 5 // These probably should be moved to the .h file But for now,
|
||||
#define MAP_UPPER_LEFT_CORNER_Y 5 // it is easier to play with things having them here
|
||||
#define MAP_MAX_PIXELS_X 262 // 272 - 10
|
||||
#define MAP_MAX_PIXELS_Y 262
|
||||
|
||||
void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
|
||||
// Scale the box pixels appropriately
|
||||
dwin_coord_t x_map_pixels = ((MAP_MAX_PIXELS_X - 4) / (GRID_MAX_POINTS_X)) * (GRID_MAX_POINTS_X),
|
||||
y_map_pixels = ((MAP_MAX_PIXELS_Y - 4) / (GRID_MAX_POINTS_Y)) * (GRID_MAX_POINTS_Y),
|
||||
|
||||
pixels_per_x_mesh_pnt = x_map_pixels / (GRID_MAX_POINTS_X),
|
||||
pixels_per_y_mesh_pnt = y_map_pixels / (GRID_MAX_POINTS_Y),
|
||||
|
||||
x_offset = MAP_UPPER_LEFT_CORNER_X + 1 + (MAP_MAX_PIXELS_X - x_map_pixels - 2) / 2,
|
||||
y_offset = MAP_UPPER_LEFT_CORNER_Y + 1 + (MAP_MAX_PIXELS_Y - y_map_pixels - 2) / 2;
|
||||
|
||||
// Clear the Mesh Map
|
||||
|
||||
// First draw the bigger box in White so we have a border around the mesh map box
|
||||
DWIN_Draw_Rectangle(1, Color_White, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels);
|
||||
// Now actually clear the mesh map box
|
||||
DWIN_Draw_Rectangle(1, Color_Bg_Black, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels);
|
||||
|
||||
// Fill in the Specified Mesh Point
|
||||
|
||||
const uint8_t y_plot_inv = (GRID_MAX_POINTS_Y - 1) - y_plot; // The origin is typically in the lower right corner. We need to
|
||||
// invert the Y to get it to plot in the right location.
|
||||
|
||||
const dwin_coord_t by = y_offset + y_plot_inv * pixels_per_y_mesh_pnt;
|
||||
DWIN_Draw_Rectangle(1, Select_Color,
|
||||
x_offset + (x_plot * pixels_per_x_mesh_pnt), by,
|
||||
x_offset + (x_plot * pixels_per_x_mesh_pnt) + pixels_per_x_mesh_pnt, by + pixels_per_y_mesh_pnt
|
||||
);
|
||||
|
||||
// Display Mesh Point Locations
|
||||
const dwin_coord_t sx = x_offset + pixels_per_x_mesh_pnt / 2;
|
||||
dwin_coord_t y = y_offset + pixels_per_y_mesh_pnt / 2;
|
||||
for (uint8_t j = 0; j < GRID_MAX_POINTS_Y; j++, y += pixels_per_y_mesh_pnt)
|
||||
for (uint8_t i = 0, x = sx; i < GRID_MAX_POINTS_X; i++, x += pixels_per_x_mesh_pnt)
|
||||
DWIN_Draw_Point(Color_White, 1, 1, x, y);
|
||||
|
||||
// Put Relevant Text on Display
|
||||
|
||||
// Show X and Y positions at top of screen
|
||||
dwin_font.fg = Color_White;
|
||||
dwin_font.solid = true;
|
||||
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
|
||||
lpos = pos.asLogical();
|
||||
|
||||
lcd_moveto(
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, 1),
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, 1, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 1)
|
||||
);
|
||||
lcd_put_u8str_P(X_LBL);
|
||||
lcd_put_u8str(ftostr52(lpos.x));
|
||||
lcd_moveto(
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, 1),
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, 3, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 2)
|
||||
);
|
||||
lcd_put_u8str_P(Y_LBL);
|
||||
lcd_put_u8str(ftostr52(lpos.y));
|
||||
|
||||
// Print plot position
|
||||
dwin_string.set("(");
|
||||
dwin_string.add(i8tostr3rj(x_plot));
|
||||
dwin_string.add(",");
|
||||
dwin_string.add(i8tostr3rj(y_plot));
|
||||
dwin_string.add(")");
|
||||
lcd_moveto(
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length()),
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 2, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 1)
|
||||
);
|
||||
lcd_put_dwin_string();
|
||||
|
||||
// Show the location value
|
||||
dwin_string.set(Z_LBL);
|
||||
if (!isnan(ubl.z_values[x_plot][y_plot]))
|
||||
dwin_string.add(ftostr43sign(ubl.z_values[x_plot][y_plot]));
|
||||
else
|
||||
dwin_string.add(PSTR(" -----"));
|
||||
lcd_moveto(
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, ((x_offset + x_map_pixels) / MENU_FONT_WIDTH) + 2, LCD_WIDTH - dwin_string.length()),
|
||||
TERN(DWIN_MARLINUI_LANDSCAPE, LCD_HEIGHT - 1, ((y_offset + y_map_pixels) / MENU_LINE_HEIGHT) + 2)
|
||||
);
|
||||
lcd_put_dwin_string();
|
||||
}
|
||||
|
||||
#endif // AUTO_BED_LEVELING_UBL
|
||||
|
||||
#if ANY(BABYSTEP_ZPROBE_GFX_OVERLAY, MESH_EDIT_GFX_OVERLAY, BABYSTEP_GFX_OVERLAY)
|
||||
|
||||
void _lcd_zoffset_overlay_gfx(const float zvalue) {
|
||||
// Determine whether the user is raising or lowering the nozzle.
|
||||
static int8_t dir;
|
||||
static float old_zvalue;
|
||||
if (zvalue != old_zvalue) {
|
||||
dir = zvalue ? zvalue < old_zvalue ? -1 : 1 : 0;
|
||||
old_zvalue = zvalue;
|
||||
}
|
||||
|
||||
const int rot_up = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCCW, ICON_RotateCW),
|
||||
rot_down = TERN(OVERLAY_GFX_REVERSE, ICON_RotateCW, ICON_RotateCCW);
|
||||
|
||||
const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20;
|
||||
|
||||
// Draw a representation of the nozzle
|
||||
DWIN_Draw_Box(1, Color_Bg_Black, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down
|
||||
DWIN_ICON_Show(ICON, ICON_HotendOff, nozzle + 3, 10 - dir);
|
||||
DWIN_ICON_Show(ICON, ICON_BedLine, nozzle, 10 + 36);
|
||||
|
||||
// Draw cw/ccw indicator and up/down arrows
|
||||
const int arrow_y = LCD_PIXEL_HEIGHT / 2 - 24;
|
||||
DWIN_ICON_Show(ICON, ICON_DownArrow, 0, arrow_y - dir);
|
||||
DWIN_ICON_Show(ICON, rot_down, 48, arrow_y);
|
||||
|
||||
DWIN_ICON_Show(ICON, ICON_UpArrow, LCD_PIXEL_WIDTH - 10 - (48*2), arrow_y - dir);
|
||||
DWIN_ICON_Show(ICON, rot_up, LCD_PIXEL_WIDTH - 10 - 48, arrow_y);
|
||||
}
|
||||
|
||||
#endif // BABYSTEP_ZPROBE_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
|
||||
|
||||
#endif // HAS_LCD_MENU
|
||||
|
||||
#endif // IS_DWIN_MARLINUI
|
||||
@@ -0,0 +1,391 @@
|
||||
/**
|
||||
* Marlin 3D Printer Firmware
|
||||
* Copyright (c) 2021 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 <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "../../../inc/MarlinConfigPre.h"
|
||||
|
||||
#if IS_DWIN_MARLINUI
|
||||
|
||||
#include "marlinui_dwin.h"
|
||||
#include "dwin_lcd.h"
|
||||
#include "dwin_string.h"
|
||||
#include "lcdprint_dwin.h"
|
||||
|
||||
#include "../../fontutils.h"
|
||||
#include "../../../libs/numtostr.h"
|
||||
#include "../../marlinui.h"
|
||||
|
||||
#include "../../../sd/cardreader.h"
|
||||
#include "../../../module/motion.h"
|
||||
#include "../../../module/temperature.h"
|
||||
#include "../../../module/printcounter.h"
|
||||
|
||||
#if ENABLED(SDSUPPORT)
|
||||
#include "../../../libs/duration_t.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
#include "../../../MarlinCore.h" // for printingIsActive
|
||||
#endif
|
||||
|
||||
#define STATUS_HEATERS_X 15
|
||||
#define STATUS_HEATERS_Y 56
|
||||
#define STATUS_HEATERS_XSPACE 64
|
||||
#define STATUS_FAN_WIDTH 48
|
||||
#define STATUS_FAN_HEIGHT 48
|
||||
#define STATUS_FAN_Y STATUS_HEATERS_Y + 22
|
||||
#define STATUS_CHR_WIDTH 14
|
||||
#define STATUS_CHR_HEIGHT 28
|
||||
|
||||
//
|
||||
// Before homing, blink '123' <-> '???'.
|
||||
// Homed but unknown... '123' <-> ' '.
|
||||
// Homed and known, display constantly.
|
||||
//
|
||||
FORCE_INLINE void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink, const uint16_t x, const uint16_t y) {
|
||||
uint8_t vallen = utf8_strlen(value);
|
||||
|
||||
if (!ui.did_first_redraw) {
|
||||
dwin_string.set();
|
||||
dwin_string.add('X' + axis);
|
||||
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (vallen * 14 - 14) / 2, y + 2, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
dwin_string.set();
|
||||
if (blink)
|
||||
dwin_string.add(value);
|
||||
else {
|
||||
if (!TEST(axis_homed, axis))
|
||||
while (const char c = *value++) dwin_string.add(c <= '.' ? c : '?');
|
||||
else {
|
||||
#if NONE(HOME_AFTER_DEACTIVATE, DISABLE_REDUCED_ACCURACY_WARNING)
|
||||
if (!TEST(axis_trusted, axis))
|
||||
dwin_string.add(TERN1(DWIN_MARLINUI_PORTRAIT, axis == Z_AXIS) ? PSTR(" ") : PSTR(" "));
|
||||
else
|
||||
#endif
|
||||
dwin_string.add(value);
|
||||
}
|
||||
}
|
||||
|
||||
// For E_TOTAL there may be some characters to cover up
|
||||
if (BOTH(DWIN_MARLINUI_PORTRAIT, LCD_SHOW_E_TOTAL) && axis == X_AXIS)
|
||||
dwin_string.add(" ");
|
||||
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
|
||||
FORCE_INLINE void _draw_e_value(const_float_t value, const uint16_t x, const uint16_t y) {
|
||||
const uint8_t scale = value >= 100000.0f ? 10 : 1; // show cm after 99,999mm
|
||||
|
||||
if (!ui.did_first_redraw) {
|
||||
// Extra spaces so we don't have to clear the 'Y' label separately
|
||||
dwin_string.set("E ");
|
||||
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
dwin_string.set(ui16tostr5rj(value / scale));
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string()));
|
||||
|
||||
// Extra spaces so we don't have to clear out the Y value separately
|
||||
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm "));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
// Fan Icon and Percentage
|
||||
//
|
||||
FORCE_INLINE void _draw_fan_status(const uint16_t x, const uint16_t y) {
|
||||
const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2;
|
||||
const uint8_t fan_pct = thermalManager.scaledFanSpeedPercent(0);
|
||||
const bool fan_on = !!fan_pct;
|
||||
if (fan_on) {
|
||||
DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25);
|
||||
dwin_string.set(i8tostr3rj(fan_pct));
|
||||
dwin_string.add('%');
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
|
||||
}
|
||||
else {
|
||||
DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y);
|
||||
dwin_string.set(PSTR(" "));
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
|
||||
}
|
||||
}
|
||||
|
||||
#if HOTENDS > 2
|
||||
#define HOTEND_STATS 3
|
||||
#elif HOTENDS > 1
|
||||
#define HOTEND_STATS 2
|
||||
#elif HAS_HOTEND
|
||||
#define HOTEND_STATS 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Draw a single heater icon with current and target temperature, at the given XY
|
||||
*/
|
||||
FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x, const uint16_t y) {
|
||||
|
||||
#if HAS_HOTEND
|
||||
static celsius_t old_temp[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500),
|
||||
old_target[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, 500);
|
||||
static bool old_on[HOTEND_STATS] = ARRAY_N_1(HOTEND_STATS, false);
|
||||
#endif
|
||||
|
||||
#if HAS_HEATED_BED
|
||||
static celsius_t old_bed_temp = 500, old_bed_target = 500;
|
||||
static bool old_bed_on = false;
|
||||
#endif
|
||||
|
||||
#if HAS_HOTEND && HAS_HEATED_BED
|
||||
const bool isBed = heater < 0;
|
||||
const float tc = (isBed ? thermalManager.degBed() : thermalManager.degHotend(heater)),
|
||||
tt = (isBed ? thermalManager.degTargetBed() : thermalManager.degTargetHotend(heater));
|
||||
const uint8_t ta = isBed ? thermalManager.isHeatingBed() : thermalManager.isHeatingHotend(heater);
|
||||
const bool c_draw = tc != (isBed ? old_bed_temp : old_temp[heater]),
|
||||
t_draw = tt != (isBed ? old_bed_target : old_target[heater]),
|
||||
i_draw = ta != (isBed ? old_bed_on : old_on[heater]);
|
||||
if (isBed) { old_bed_temp = tc; old_bed_target = tt; old_bed_on = ta; }
|
||||
else { old_temp[heater] = tc; old_target[heater] = tt; old_on[heater] = ta; }
|
||||
#elif HAS_HOTEND
|
||||
constexpr bool isBed = false;
|
||||
const float tc = thermalManager.degHotend(heater), tt = thermalManager.degTargetHotend(heater);
|
||||
const uint8_t ta = thermalManager.isHeatingHotend(heater);
|
||||
const bool c_draw = tc != old_bed_temp, t_draw = tt != old_bed_target, i_draw = ta != old_bed_on;
|
||||
old_temp[heater] = tc; old_target[heater] = tt; old_on[heater] = ta;
|
||||
#elif HAS_HEATED_BED
|
||||
constexpr bool isBed = true;
|
||||
const float tc = thermalManager.degBed(), tt = thermalManager.degTargetBed();
|
||||
const uint8_t ta = thermalManager.isHeatingBed();
|
||||
const bool c_draw = tc != old_temp[heater], t_draw = tt != old_target[heater], i_draw = ta != old_on[heater];
|
||||
old_bed_temp = tc; old_bed_target = tt; old_bed_on = ta;
|
||||
#endif
|
||||
|
||||
if (!ui.did_first_redraw || t_draw) {
|
||||
dwin_string.set(i16tostr3rj(tt + 0.5));
|
||||
dwin_string.add(LCD_STR_DEGREE);
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
if (!ui.did_first_redraw || i_draw)
|
||||
DWIN_ICON_Show(ICON, (isBed ? ICON_BedOff : ICON_HotendOff) + ta, x, y + STATUS_CHR_HEIGHT + 2);
|
||||
|
||||
if (!ui.did_first_redraw || c_draw) {
|
||||
dwin_string.set(i16tostr3rj(tc + 0.5));
|
||||
dwin_string.add(LCD_STR_DEGREE);
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the current "feed rate" percentage preceded by the >> character
|
||||
*/
|
||||
FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t y) {
|
||||
if (!ui.did_first_redraw) {
|
||||
dwin_string.set(LCD_STR_FEEDRATE);
|
||||
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
dwin_string.set(value);
|
||||
dwin_string.add(PSTR("%"));
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the MarlinUI Status Screen for Ender 3 V2
|
||||
*/
|
||||
void MarlinUI::draw_status_screen() {
|
||||
const bool blink = get_blink();
|
||||
|
||||
// Draw elements that never change
|
||||
if (!ui.did_first_redraw) {
|
||||
// Logo/Status Icon
|
||||
#define STATUS_LOGO_WIDTH 128
|
||||
#define STATUS_LOGO_HEIGHT 40
|
||||
DWIN_ICON_Show(ICON, ICON_LOGO_Marlin, (LCD_PIXEL_WIDTH - (STATUS_LOGO_WIDTH)) / 2, ((STATUS_HEATERS_Y - 4) - (STATUS_LOGO_HEIGHT)) / 2);
|
||||
|
||||
// Draw a frame around the x/y/z values
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
DWIN_Draw_Rectangle(0, Select_Color, 0, 193, LCD_PIXEL_WIDTH, 260);
|
||||
#else
|
||||
//DWIN_Draw_Rectangle(0, Select_Color, LCD_PIXEL_WIDTH - 106, 50, LCD_PIXEL_WIDTH - 1, 230);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint16_t hx = STATUS_HEATERS_X;
|
||||
#if HAS_HOTEND
|
||||
_draw_heater_status(H_E0, hx, STATUS_HEATERS_Y);
|
||||
hx += STATUS_HEATERS_XSPACE;
|
||||
#endif
|
||||
#if HAS_MULTI_HOTEND
|
||||
_draw_heater_status(H_E1, hx, STATUS_HEATERS_Y);
|
||||
hx += STATUS_HEATERS_XSPACE;
|
||||
#endif
|
||||
#if HAS_HEATED_BED
|
||||
_draw_heater_status(H_BED, hx, STATUS_HEATERS_Y);
|
||||
#endif
|
||||
|
||||
#if HAS_FAN
|
||||
// Fan display, pinned to the right side
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
_draw_fan_status(LCD_PIXEL_WIDTH - STATUS_CHR_WIDTH * 4, STATUS_FAN_Y);
|
||||
#else
|
||||
_draw_fan_status(212, STATUS_FAN_Y);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Axis values
|
||||
const xyz_pos_t lpos = current_position.asLogical();
|
||||
const bool show_e_total = TERN0(LCD_SHOW_E_TOTAL, printingIsActive()); UNUSED(show_e_total);
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
constexpr int16_t cpy = 195;
|
||||
if (show_e_total) {
|
||||
TERN_(LCD_SHOW_E_TOTAL, _draw_e_value(e_move_accumulator, 6, cpy));
|
||||
}
|
||||
else {
|
||||
_draw_axis_value(X_AXIS, ftostr4sign(lpos.x), blink, 6, cpy);
|
||||
TERN_(HAS_Y_AXIS, _draw_axis_value(Y_AXIS, ftostr4sign(lpos.y), blink, 95, cpy));
|
||||
}
|
||||
TERN_(HAS_Z_AXIS, _draw_axis_value(Z_AXIS, ftostr52sp(lpos.z), blink, 165, cpy));
|
||||
#else
|
||||
constexpr int16_t cpx = LCD_PIXEL_WIDTH - 104;
|
||||
_draw_axis_value(X_AXIS, ftostr52sp(lpos.x), blink, cpx, STATUS_HEATERS_Y);
|
||||
TERN_(HAS_Y_AXIS, _draw_axis_value(Y_AXIS, ftostr52sp(lpos.y), blink, cpx, STATUS_HEATERS_Y + 59));
|
||||
TERN_(HAS_Z_AXIS, _draw_axis_value(Z_AXIS, ftostr52sp(lpos.z), blink, cpx, STATUS_HEATERS_Y + 118));
|
||||
#endif
|
||||
|
||||
// Feedrate
|
||||
static uint16_t old_fp = 0;
|
||||
if (!ui.did_first_redraw || old_fp != feedrate_percentage) {
|
||||
old_fp = feedrate_percentage;
|
||||
_draw_feedrate_status(i16tostr3rj(feedrate_percentage),
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
5, 290
|
||||
#else
|
||||
294, STATUS_HEATERS_Y
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
//
|
||||
// Elapsed time
|
||||
//
|
||||
char buffer[14];
|
||||
duration_t time;
|
||||
|
||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||
|
||||
// Portrait mode only shows one value at a time, and will rotate if ROTATE_PROGRESS_DISPLAY
|
||||
dwin_string.set();
|
||||
char prefix = ' ';
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
if (TERN1(ROTATE_PROGRESS_DISPLAY, blink) && print_job_timer.isRunning()) {
|
||||
time = get_remaining_time();
|
||||
prefix = 'R';
|
||||
}
|
||||
else
|
||||
#endif
|
||||
time = print_job_timer.duration();
|
||||
|
||||
time.toDigital(buffer);
|
||||
dwin_string.add(prefix);
|
||||
dwin_string.add(buffer);
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length() + 1) * 14)), 290, S(dwin_string.string()));
|
||||
|
||||
#else
|
||||
|
||||
// landscape mode shows both elapsed and remaining (if SHOW_REMAINING_TIME)
|
||||
time = print_job_timer.duration();
|
||||
time.toDigital(buffer);
|
||||
dwin_string.set(" ");
|
||||
dwin_string.add(buffer);
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 280, 100, S(dwin_string.string()));
|
||||
|
||||
#if ENABLED(LCD_SHOW_E_TOTAL)
|
||||
if (show_e_total && TERN1(SHOW_REMAINING_TIME, !blink)) { // if SHOW_REMAINING_TIME is also
|
||||
const uint8_t escale = e_move_accumulator >= 100000.0f ? 10 : 1; // show cm after 99,000mm
|
||||
|
||||
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 249, 135, S("E"));
|
||||
dwin_string.set(ui16tostr5rj(e_move_accumulator * escale));
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 263, 135, S(dwin_string.string()));
|
||||
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 333, 135, S(escale==1 ? "mm" : "cm"));
|
||||
}
|
||||
#endif
|
||||
#if ENABLED(SHOW_REMAINING_TIME)
|
||||
if (!show_e_total || blink) {
|
||||
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 249, 135, S(" R "));
|
||||
time = get_remaining_time();
|
||||
time.toDigital(buffer);
|
||||
dwin_string.set(buffer);
|
||||
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 291, 135, S(dwin_string.string()));
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//
|
||||
// Progress Bar
|
||||
//
|
||||
constexpr int16_t pb_margin = 5, pb_left = pb_margin, pb_height = 60,
|
||||
pb_right = LCD_PIXEL_WIDTH - TERN(DWIN_MARLINUI_PORTRAIT, 0, 107) - pb_margin,
|
||||
pb_bottom = TERN(DWIN_MARLINUI_PORTRAIT, 410, 230),
|
||||
pb_top = pb_bottom - pb_height,
|
||||
pb_width = pb_right - pb_left;
|
||||
|
||||
const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
|
||||
|
||||
if (!ui.did_first_redraw)
|
||||
DWIN_Draw_Rectangle(0, Select_Color, pb_left, pb_top, pb_right, pb_bottom); // Outline
|
||||
|
||||
static uint16_t old_solid = 50;
|
||||
const uint16_t pb_solid = (pb_width - 2) * (progress / (PROGRESS_SCALE)) * 0.01f;
|
||||
const bool p_draw = !ui.did_first_redraw || old_solid != pb_solid;
|
||||
|
||||
if (p_draw) {
|
||||
//if (pb_solid)
|
||||
DWIN_Draw_Rectangle(1, Select_Color, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part
|
||||
|
||||
//if (pb_solid < old_solid)
|
||||
DWIN_Draw_Rectangle(1, Color_Bg_Black, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest
|
||||
|
||||
#if ENABLED(SHOW_SD_PERCENT)
|
||||
dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
|
||||
dwin_string.add(PSTR("%"));
|
||||
DWIN_Draw_String(
|
||||
false, font16x32, Percent_Color, Color_Bg_Black,
|
||||
pb_left + (pb_width - dwin_string.length() * 16) / 2,
|
||||
pb_top + (pb_height - 32) / 2,
|
||||
S(dwin_string.string())
|
||||
);
|
||||
#endif
|
||||
|
||||
old_solid = pb_solid;
|
||||
}
|
||||
|
||||
//
|
||||
// Status Message
|
||||
//
|
||||
draw_status_message(blink);
|
||||
|
||||
ui.did_first_redraw = true;
|
||||
}
|
||||
|
||||
#endif // IS_DWIN_MARLINUI
|
||||
@@ -64,7 +64,7 @@ namespace ExtUI {
|
||||
ScreenHandler.SetupConfirmAction(setUserConfirmed);
|
||||
ScreenHandler.GotoScreen(DGUSLCD_SCREEN_POPUP);
|
||||
}
|
||||
else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP ) {
|
||||
else if (ScreenHandler.getCurrentScreen() == DGUSLCD_SCREEN_POPUP) {
|
||||
ScreenHandler.SetupConfirmAction(nullptr);
|
||||
ScreenHandler.PopToOldScreen();
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@
|
||||
#define LOGO_TIME_DELAY TERN(USE_MKS_GREEN_UI, 8000, 1500)
|
||||
|
||||
#if ENABLED(DGUS_MKS_RUNOUT_SENSOR)
|
||||
#define MT_DET_1_PIN 1
|
||||
#define MT_DET_2_PIN 2
|
||||
#define MT_DET_PIN_INVERTING false
|
||||
#define MT_DET_1_PIN 1
|
||||
#define MT_DET_2_PIN 2
|
||||
#define MT_DET_PIN_STATE LOW
|
||||
#endif
|
||||
|
||||
#define MKS_FINSH
|
||||
|
||||
@@ -1495,17 +1495,17 @@ void DGUSScreenHandler::DGUS_Runout_Idle(void) {
|
||||
break;
|
||||
|
||||
case UNRUNOUT_STATUS:
|
||||
if (READ(MT_DET_1_PIN) == LOW)
|
||||
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
|
||||
runout_mks.runout_status = RUNOUT_STATUS;
|
||||
break;
|
||||
|
||||
case RUNOUT_BEGIN_STATUS:
|
||||
if (READ(MT_DET_1_PIN) == HIGH)
|
||||
if (READ(MT_DET_1_PIN) != MT_DET_PIN_STATE)
|
||||
runout_mks.runout_status = RUNOUT_WAITTING_STATUS;
|
||||
break;
|
||||
|
||||
case RUNOUT_WAITTING_STATUS:
|
||||
if (READ(MT_DET_1_PIN) == LOW)
|
||||
if (READ(MT_DET_1_PIN) == MT_DET_PIN_STATE)
|
||||
runout_mks.runout_status = RUNOUT_BEGIN_STATUS;
|
||||
break;
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@
|
||||
* Settings for the Aleph Objects Color LCD User Interface
|
||||
* Datasheet https://www.hantronix.com/files/data/s1501799605s500-gh7.pdf
|
||||
*/
|
||||
#elif defined(LCD_ALEPHOBJECTS_CLCD_UI)
|
||||
#elif defined(LCD_LULZBOT_CLCD_UI)
|
||||
#if !HAS_RESOLUTION
|
||||
#define TOUCH_UI_800x480
|
||||
#endif
|
||||
|
||||
@@ -288,7 +288,7 @@
|
||||
|
||||
// Remove compiler warning on an unused variable
|
||||
#ifndef UNUSED
|
||||
#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(MAPLE_STM32F1)
|
||||
#ifdef HAL_STM32
|
||||
#define UNUSED(X) (void)X
|
||||
#else
|
||||
#define UNUSED(x) ((void)(x))
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace FTDI {
|
||||
strcat_P(str, (const char*) units);
|
||||
}
|
||||
|
||||
cmd.text(VAL_POS, str);
|
||||
cmd.tag(0).text(VAL_POS, str);
|
||||
}
|
||||
|
||||
void draw_adjuster(CommandProcessor& cmd, int16_t x, int16_t y, int16_t w, int16_t h, uint8_t tag, float value, progmem_str units, int8_t width, uint8_t precision, draw_mode_t what) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user