Robin nano V2, TFT LVGL UI parameters, and more (#18500)

This commit is contained in:
MKS-Sean 2020-07-25 13:52:07 +08:00 committed by Scott Lahteine
parent c5ec80d6c7
commit d20d459132
90 changed files with 11656 additions and 4119 deletions

View file

@ -135,7 +135,7 @@
//#define CUSTOM_MACHINE_NAME "3D Printer"
// Printer's unique ID, used by some programs to differentiate between machines.
// Choose your own or use a service like http://www.uuidgenerator.net/version4
// Choose your own or use a service like https://www.uuidgenerator.net/version4
//#define MACHINE_UUID "00000000-0000-0000-0000-000000000000"
// @section extruder
@ -2148,20 +2148,23 @@
//
// TFT LVGL UI
//
// Default MKS icons and fonts: https://git.io/JJvzK
// Copy mks_pic and mks_font folders to the root of your SD
// Using default MKS icons and fonts from: https://git.io/JJvzK
// Just copy the `assets` folder from the build directory to the
// root of your SD card, together with the compiled firmware.
//
//#define TFT_LVGL_UI
// Robin nano v1.2 uses FSMC
//
//#define TFT_LVGL_UI_FSMC
// Robin nano v2.0 uses SPI
//
//#define TFT_LVGL_UI_SPI
//=============================================================================
//============================ Other Controllers ============================
//=============================================================================
//
// Robin nano v2.0 SPI touch screen
//
//#define SPI_GRAPHICAL_TFT
//
// Ender-3 v2 OEM display. A DWIN display with Rotary Encoder.
//

View file

@ -71,6 +71,6 @@
* Set the vendor info the serial USB interface, if changable
* Currently only supported by DUE platform
*/
//#define USB_DEVICE_VENDOR_ID 0x0000
//#define USB_DEVICE_PRODUCT_ID 0x0000
//#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL
//#define USB_DEVICE_VENDOR_ID 0x0000
//#define USB_DEVICE_PRODUCT_ID 0x0000
//#define USB_DEVICE_MANUFACTURE_NAME WEBSITE_URL

View file

@ -59,10 +59,11 @@
#include "gcode/parser.h"
#include "gcode/queue.h"
#if ENABLED(TFT_LVGL_UI)
#include "lvgl.h"
#if HAS_TFT_LVGL_UI
#include "lcd/extui/lib/mks_ui/tft_lvgl_configuration.h"
#include "lcd/extui/lib/mks_ui/draw_ui.h"
#include "lcd/extui/lib/mks_ui/mks_hardware_test.h"
#include <lvgl.h>
#endif
#if ENABLED(DWIN_CREALITY_LCD)
@ -755,7 +756,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
// Direct Stepping
TERN_(DIRECT_STEPPING, page_manager.write_responses());
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
LV_TASK_HANDLER();
#endif
}
@ -1192,7 +1193,7 @@ void setup() {
SETUP_RUN(page_manager.init());
#endif
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
if (!card.isMounted()) SETUP_RUN(card.mount()); // Mount SD to load graphics and fonts
SETUP_RUN(tft_lvgl_init());
#endif
@ -1229,7 +1230,7 @@ void loop() {
endstops.event_handler();
TERN_(TFT_LVGL_UI, printer_state_polling());
TERN_(HAS_TFT_LVGL_UI, printer_state_polling());
} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
}

View file

@ -288,30 +288,31 @@
#define BOARD_MKS_ROBIN 4007 // MKS Robin (STM32F103ZET6)
#define BOARD_MKS_ROBIN_MINI 4008 // MKS Robin Mini (STM32F103VET6)
#define BOARD_MKS_ROBIN_NANO 4009 // MKS Robin Nano (STM32F103VET6)
#define BOARD_MKS_ROBIN_LITE 4010 // MKS Robin Lite/Lite2 (STM32F103RCT6)
#define BOARD_MKS_ROBIN_LITE3 4011 // MKS Robin Lite3 (STM32F103RCT6)
#define BOARD_MKS_ROBIN_PRO 4012 // MKS Robin Pro (STM32F103ZET6)
#define BOARD_BTT_SKR_MINI_V1_1 4013 // BigTreeTech SKR Mini v1.1 (STM32F103RC)
#define BOARD_BTT_SKR_MINI_E3_V1_0 4014 // BigTreeTech SKR Mini E3 (STM32F103RC)
#define BOARD_BTT_SKR_MINI_E3_V1_2 4015 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
#define BOARD_BTT_SKR_MINI_E3_V2_0 4016 // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC)
#define BOARD_BTT_SKR_E3_DIP 4017 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
#define BOARD_JGAURORA_A5S_A1 4018 // JGAurora A5S A1 (STM32F103ZET6)
#define BOARD_FYSETC_AIO_II 4019 // FYSETC AIO_II
#define BOARD_FYSETC_CHEETAH 4020 // FYSETC Cheetah
#define BOARD_FYSETC_CHEETAH_V12 4021 // FYSETC Cheetah V1.2
#define BOARD_LONGER3D_LK 4022 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
#define BOARD_GTM32_MINI 4023 // STM32F103VET6 controller
#define BOARD_GTM32_MINI_A30 4024 // STM32F103VET6 controller
#define BOARD_GTM32_REV_B 4025 // STM32F103VET6 controller
#define BOARD_MKS_ROBIN_E3D 4026 // MKS Robin E3D (STM32F103RCT6)
#define BOARD_MKS_ROBIN_E3 4027 // MKS Robin E3 (STM32F103RCT6)
#define BOARD_MALYAN_M300 4028 // STM32F070-based delta
#define BOARD_CCROBOT_MEEB_3DP 4029 // ccrobot-online.com MEEB_3DP (STM32F103RC)
#define BOARD_CHITU3D_V5 4030 // Chitu3D TronXY X5SA V5 Board
#define BOARD_CHITU3D_V6 4031 // Chitu3D TronXY X5SA V5 Board
#define BOARD_CREALITY_V4 4032 // Creality v4.x (STM32F103RE)
#define BOARD_TRIGORILLA_PRO 4033 // Trigorilla Pro (STM32F103ZET6)
#define BOARD_MKS_ROBIN_NANO_V2 4010 // MKS Robin Nano V2 (STM32F103VET6)
#define BOARD_MKS_ROBIN_LITE 4011 // MKS Robin Lite/Lite2 (STM32F103RCT6)
#define BOARD_MKS_ROBIN_LITE3 4012 // MKS Robin Lite3 (STM32F103RCT6)
#define BOARD_MKS_ROBIN_PRO 4013 // MKS Robin Pro (STM32F103ZET6)
#define BOARD_BTT_SKR_MINI_V1_1 4014 // BigTreeTech SKR Mini v1.1 (STM32F103RC)
#define BOARD_BTT_SKR_MINI_E3_V1_0 4015 // BigTreeTech SKR Mini E3 (STM32F103RC)
#define BOARD_BTT_SKR_MINI_E3_V1_2 4016 // BigTreeTech SKR Mini E3 V1.2 (STM32F103RC)
#define BOARD_BTT_SKR_MINI_E3_V2_0 4017 // BigTreeTech SKR Mini E3 V2.0 (STM32F103RC)
#define BOARD_BTT_SKR_E3_DIP 4018 // BigTreeTech SKR E3 DIP V1.0 (STM32F103RC / STM32F103RE)
#define BOARD_JGAURORA_A5S_A1 4019 // JGAurora A5S A1 (STM32F103ZET6)
#define BOARD_FYSETC_AIO_II 4020 // FYSETC AIO_II
#define BOARD_FYSETC_CHEETAH 4021 // FYSETC Cheetah
#define BOARD_FYSETC_CHEETAH_V12 4022 // FYSETC Cheetah V1.2
#define BOARD_LONGER3D_LK 4023 // Alfawise U20/U20+/U30 (Longer3D LK1/2) / STM32F103VET6
#define BOARD_GTM32_MINI 4024 // STM32F103VET6 controller
#define BOARD_GTM32_MINI_A30 4025 // STM32F103VET6 controller
#define BOARD_GTM32_REV_B 4026 // STM32F103VET6 controller
#define BOARD_MKS_ROBIN_E3D 4027 // MKS Robin E3D (STM32F103RCT6)
#define BOARD_MKS_ROBIN_E3 4028 // MKS Robin E3 (STM32F103RCT6)
#define BOARD_MALYAN_M300 4029 // STM32F070-based delta
#define BOARD_CCROBOT_MEEB_3DP 4030 // ccrobot-online.com MEEB_3DP (STM32F103RC)
#define BOARD_CHITU3D_V5 4031 // Chitu3D TronXY X5SA V5 Board
#define BOARD_CHITU3D_V6 4032 // Chitu3D TronXY X5SA V5 Board
#define BOARD_CREALITY_V4 4033 // Creality v4.x (STM32F103RE)
#define BOARD_TRIGORILLA_PRO 4034 // Trigorilla Pro (STM32F103ZET6)
//
// ARM Cortex-M4F

View file

@ -255,12 +255,17 @@
#define IS_ULTIPANEL
#endif
// LVGL UI, SPI or FSMC
#if EITHER(TFT_LVGL_UI_SPI, TFT_LVGL_UI_FSMC)
#define HAS_TFT_LVGL_UI 1
#endif
// FSMC/SPI TFT Panels
#if ENABLED(FSMC_GRAPHICAL_TFT)
#define DOGLCD
#define IS_ULTIPANEL
#define DELAYED_BACKLIGHT_INIT
#elif ENABLED(SPI_GRAPHICAL_TFT)
#elif ENABLED(TFT_LVGL_UI_SPI)
#define DELAYED_BACKLIGHT_INIT
#endif

View file

@ -449,6 +449,10 @@
#error "POWER_SUPPLY is now obsolete. Please remove it from Configuration.h."
#elif defined(MKS_ROBIN_TFT)
#error "MKS_ROBIN_TFT is now FSMC_GRAPHICAL_TFT. Please update your configuration."
#elif defined(TFT_LVGL_UI)
#error "TFT_LVGL_UI is now TFT_LVGL_UI_FSMC. Please update your configuration."
#elif defined(SPI_GRAPHICAL_TFT)
#error "SPI_GRAPHICAL_TFT is now TFT_LVGL_UI_SPI. Please update your configuration."
#elif defined(SDPOWER)
#error "SDPOWER is now SDPOWER_PIN. Please update your configuration and/or pins."
#elif defined(STRING_SPLASH_LINE1) || defined(STRING_SPLASH_LINE2)
@ -2217,8 +2221,8 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
+ ENABLED(MALYAN_LCD) \
+ ENABLED(TOUCH_UI_FTDI_EVE) \
+ ENABLED(FSMC_GRAPHICAL_TFT) \
+ ENABLED(TFT_LVGL_UI) \
+ ENABLED(SPI_GRAPHICAL_TFT)
+ ENABLED(TFT_LVGL_UI_FSMC) \
+ ENABLED(TFT_LVGL_UI_SPI)
#error "Please select no more than one LCD controller option."
#endif

View file

@ -22,69 +22,72 @@
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(SPI_GRAPHICAL_TFT)
#if ENABLED(TFT_LVGL_UI_SPI)
#include <SPI.h>
#include "../../../../inc/MarlinConfig.h"
#include "SPI_TFT.h"
#include "SPI_TFT.h"
#include "pic_manager.h"
TFT SPI_TFT;
#include "../../../../inc/MarlinConfig.h"
#ifndef SPI_TFT_MISO_PIN
#define SPI_TFT_MISO_PIN PA6
#endif
#ifndef SPI_TFT_MOSI_PIN
#define SPI_TFT_MOSI_PIN PA7
#endif
#ifndef SPI_TFT_SCK_PIN
#define SPI_TFT_SCK_PIN PA5
#endif
#ifndef SPI_TFT_CS_PIN
#define SPI_TFT_CS_PIN PD11
#endif
#ifndef SPI_TFT_DC_PIN
#define SPI_TFT_DC_PIN PD10
#endif
#ifndef SPI_TFT_RST_PIN
#define SPI_TFT_RST_PIN PC6
#endif
#include <SPI.h>
TFT SPI_TFT;
#ifndef SPI_TFT_MISO_PIN
#define SPI_TFT_MISO_PIN PA6
#endif
#ifndef SPI_TFT_MOSI_PIN
#define SPI_TFT_MOSI_PIN PA7
#endif
#ifndef SPI_TFT_SCK_PIN
#define SPI_TFT_SCK_PIN PA5
#endif
#ifndef SPI_TFT_CS_PIN
#define SPI_TFT_CS_PIN PD11
#endif
#ifndef SPI_TFT_DC_PIN
#define SPI_TFT_DC_PIN PD10
#endif
#ifndef SPI_TFT_RST_PIN
#define SPI_TFT_RST_PIN PC6
#endif
// use SPI1 for the spi tft.
void TFT::spi_init(uint8_t spiRate) {
void TFT::spi_init(uint8_t spiRate) {
SPI_TFT_CS_H;
SPI_TFT_CS_H;
/**
* STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
* STM32F1 has 3 SPI ports, SPI1 in APB2, SPI2/SPI3 in APB1
* so the minimum prescale of SPI1 is DIV4, SPI2/SPI3 is DIV2
*/
uint8_t clock;
switch (spiRate) {
case SPI_FULL_SPEED: clock = SPI_CLOCK_DIV4; break;
case SPI_HALF_SPEED: clock = SPI_CLOCK_DIV4; break;
case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break;
case SPI_EIGHTH_SPEED: clock = SPI_CLOCK_DIV16; break;
case SPI_SPEED_5: clock = SPI_CLOCK_DIV32; break;
case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break;
default: clock = SPI_CLOCK_DIV2; // Default from the SPI library
}
SPI.setModule(1);
SPI.begin();
SPI.setClockDivider(clock);
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
/**
* STM32F1 APB2 = 72MHz, APB1 = 36MHz, max SPI speed of this MCU if 18Mhz
* STM32F1 has 3 SPI ports, SPI1 in APB2, SPI2/SPI3 in APB1
* so the minimum prescale of SPI1 is DIV4, SPI2/SPI3 is DIV2
*/
uint8_t clock;
switch (spiRate) {
case SPI_FULL_SPEED: clock = SPI_CLOCK_DIV4; break;
case SPI_HALF_SPEED: clock = SPI_CLOCK_DIV4; break;
case SPI_QUARTER_SPEED: clock = SPI_CLOCK_DIV8; break;
case SPI_EIGHTH_SPEED: clock = SPI_CLOCK_DIV16; break;
case SPI_SPEED_5: clock = SPI_CLOCK_DIV32; break;
case SPI_SPEED_6: clock = SPI_CLOCK_DIV64; break;
default: clock = SPI_CLOCK_DIV2; // Default from the SPI library
}
SPI.setModule(1);
SPI.begin();
SPI.setClockDivider(clock);
SPI.setBitOrder(MSBFIRST);
SPI.setDataMode(SPI_MODE0);
}
uint8_t TFT::spi_Rec() {
uint8_t returnByte = SPI.transfer(ff);
return returnByte;
}
uint8_t TFT::spi_Rec() {
uint8_t returnByte = SPI.transfer(ff);
return returnByte;
}
uint8_t TFT::spi_read_write_byte(uint8_t data) {
uint8_t returnByte = SPI.transfer(data);
return returnByte;
}
uint8_t TFT::spi_read_write_byte(uint8_t data) {
uint8_t returnByte = SPI.transfer(data);
return returnByte;
}
/**
* @brief Receive a number of bytes from the SPI port to a buffer
@ -95,7 +98,7 @@
*
* @details Uses DMA
*/
void TFT::spi_Read(uint8_t* buf, uint16_t nbyte) {SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);}
void TFT::spi_Read(uint8_t* buf, uint16_t nbyte) {SPI.dmaTransfer(0, const_cast<uint8_t*>(buf), nbyte);}
/**
* @brief Send a single byte on SPI port
@ -104,7 +107,7 @@
*
* @details
*/
void TFT::spi_Send(uint8_t b) {SPI.send(b);}
void TFT::spi_Send(uint8_t b) {SPI.send(b);}
/**
* @brief Write token and then write from 512 byte buffer to SPI (for SD card)
@ -114,158 +117,222 @@
*
* @details Use DMA
*/
void TFT::spi_SendBlock(uint8_t token, const uint8_t* buf) {
SPI.send(token);
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
void TFT::spi_SendBlock(uint8_t token, const uint8_t* buf) {
SPI.send(token);
SPI.dmaSend(const_cast<uint8_t*>(buf), 512);
}
void TFT::LCD_WR_REG(uint8_t cmd) {
SPI_TFT_CS_L;
SPI_TFT_DC_L;
spi_Send(cmd);
SPI_TFT_CS_H;
}
void TFT::LCD_WR_DATA(uint8_t data) {
SPI_TFT_CS_L;
SPI_TFT_DC_H;
spi_Send(data);
SPI_TFT_CS_H;
}
void TFT::LCD_WriteRAM_Prepare() {LCD_WR_REG(0X2C);}
void TFT::SetCursor(uint16_t x, uint16_t y) {
LCD_WR_REG(0x2A);
LCD_WR_DATA(x >> 8);
LCD_WR_DATA(x);
LCD_WR_DATA(x >> 8);
LCD_WR_DATA(x);
LCD_WR_REG(0x2B);
LCD_WR_DATA(y >> 8);
LCD_WR_DATA(y);
LCD_WR_DATA(y >> 8);
LCD_WR_DATA(y);
}
void TFT::SetPoint(uint16_t x, uint16_t y, uint16_t point) {
if ((x > 480) || (y > 320)) return;
SetCursor(x, y);
LCD_WriteRAM_Prepare();
LCD_WR_DATA((uint8_t)(point >> 8));
LCD_WR_DATA((uint8_t)point);
}
void TFT::SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height) {
LCD_WR_REG(0x2A);
LCD_WR_DATA(x >> 8);
LCD_WR_DATA(x);
LCD_WR_DATA((x + with - 1) >> 8);
LCD_WR_DATA((x + with - 1));
LCD_WR_REG(0x2B);
LCD_WR_DATA(y >> 8);
LCD_WR_DATA(y);
LCD_WR_DATA((y + height - 1) >> 8);
LCD_WR_DATA(y + height - 1);
}
void TFT::LCD_init() {
SPI_TFT_RST_H;
delay(150);
SPI_TFT_RST_L;
delay(150);
SPI_TFT_RST_H;
delay(120);
LCD_WR_REG(0x11);
delay(120);
LCD_WR_REG(0xF0);
LCD_WR_DATA(0xC3);
LCD_WR_REG(0xF0);
LCD_WR_DATA(0x96);
LCD_WR_REG(0x36);
LCD_WR_DATA(0x28);
LCD_WR_REG(0x3A);
LCD_WR_DATA(0x55);
LCD_WR_REG(0xB4);
LCD_WR_DATA(0x01);
LCD_WR_REG(0xB7);
LCD_WR_DATA(0xC6);
LCD_WR_REG(0xE8);
LCD_WR_DATA(0x40);
LCD_WR_DATA(0x8A);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x29);
LCD_WR_DATA(0x19);
LCD_WR_DATA(0xA5);
LCD_WR_DATA(0x33);
LCD_WR_REG(0xC1);
LCD_WR_DATA(0x06);
LCD_WR_REG(0xC2);
LCD_WR_DATA(0xA7);
LCD_WR_REG(0xC5);
LCD_WR_DATA(0x18);
LCD_WR_REG(0xE0); // Positive Voltage Gamma Control
LCD_WR_DATA(0xF0);
LCD_WR_DATA(0x09);
LCD_WR_DATA(0x0B);
LCD_WR_DATA(0x06);
LCD_WR_DATA(0x04);
LCD_WR_DATA(0x15);
LCD_WR_DATA(0x2F);
LCD_WR_DATA(0x54);
LCD_WR_DATA(0x42);
LCD_WR_DATA(0x3C);
LCD_WR_DATA(0x17);
LCD_WR_DATA(0x14);
LCD_WR_DATA(0x18);
LCD_WR_DATA(0x1B);
LCD_WR_REG(0xE1); // Negative Voltage Gamma Control
LCD_WR_DATA(0xF0);
LCD_WR_DATA(0x09);
LCD_WR_DATA(0x0B);
LCD_WR_DATA(0x06);
LCD_WR_DATA(0x04);
LCD_WR_DATA(0x03);
LCD_WR_DATA(0x2D);
LCD_WR_DATA(0x43);
LCD_WR_DATA(0x42);
LCD_WR_DATA(0x3B);
LCD_WR_DATA(0x16);
LCD_WR_DATA(0x14);
LCD_WR_DATA(0x17);
LCD_WR_DATA(0x1B);
LCD_WR_REG(0xF0);
LCD_WR_DATA(0x3C);
LCD_WR_REG(0xF0);
LCD_WR_DATA(0x69);
delay(120); // Delay 120ms
LCD_WR_REG(0x29); // Display ON
LCD_clear(0x0000); //
LCD_Draw_Logo();
SPI_TFT_BLK_H;
delay(2000);
}
void TFT::LCD_clear(uint16_t color) {
unsigned int i;
uint8_t tbuf[960];
SetCursor(0, 0);
SetWindows(0, 0, 480 - 1, 320 - 1);
LCD_WriteRAM_Prepare();
SPI_TFT_CS_L;
SPI_TFT_DC_H;
for (i = 0; i < 960;) {
tbuf[i] = color >> 8;
tbuf[i + 1] = color;
i += 2;
}
void TFT::LCD_WR_REG(uint8_t cmd) {
SPI_TFT_CS_L;
SPI_TFT_DC_L;
spi_Send(cmd);
SPI_TFT_CS_H;
for (i = 0; i < 320; i++) {
// for (m=0;m<480;m++)
// {
// LCD_WR_DATA(color>>8);
// LCD_WR_DATA(color);
SPI.dmaSend(tbuf, 960, true);
// SPI_TFT_CS_H;
// }
}
void TFT::LCD_WR_DATA(uint8_t data) {
SPI_TFT_CS_L;
SPI_TFT_DC_H;
spi_Send(data);
SPI_TFT_CS_H;
}
void TFT::LCD_WriteRAM_Prepare() {LCD_WR_REG(0X2C);}
void TFT::SetCursor(uint16_t x, uint16_t y) {
LCD_WR_REG(0x2a);
LCD_WR_DATA(x >> 8);
LCD_WR_DATA(x);
LCD_WR_DATA(x >> 8);
LCD_WR_DATA(x);
SPI_TFT_CS_H;
}
LCD_WR_REG(0x2b);
LCD_WR_DATA(y >> 8);
LCD_WR_DATA(y);
LCD_WR_DATA(y >> 8);
LCD_WR_DATA(y);
}
void TFT::SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height) {
LCD_WR_REG(0x2a);
LCD_WR_DATA(x >> 8);
LCD_WR_DATA(x);
LCD_WR_DATA((x + with) >> 8);
LCD_WR_DATA((x + with));
extern unsigned char bmp_public_buf[17 * 1024];
LCD_WR_REG(0x2b);
LCD_WR_DATA(y >> 8);
LCD_WR_DATA(y);
LCD_WR_DATA((y + height) >> 8);
LCD_WR_DATA(y + height);
}
void TFT::LCD_init() {
SPI_TFT_RST_H;
delay(150);
SPI_TFT_RST_L;
delay(150);
SPI_TFT_RST_H;
void TFT::LCD_Draw_Logo() {
uint16_t i,y_off = 0;
uint16_t *p_index;
uint16_t Color;
delay(120);
LCD_WR_REG(0x11);
delay(120);
#if 1
for (y_off = 0; y_off < 320; y_off ++) {
Pic_Logo_Read((uint8_t *)"", (uint8_t *)bmp_public_buf, 960);
LCD_WR_REG(0xf0);
LCD_WR_DATA(0xc3);
LCD_WR_REG(0xf0);
LCD_WR_DATA(0x96);
LCD_WR_REG(0x36);
LCD_WR_DATA(0x28);
LCD_WR_REG(0x3A);
LCD_WR_DATA(0x55);
LCD_WR_REG(0xB4);
LCD_WR_DATA(0x01);
LCD_WR_REG(0xB7);
LCD_WR_DATA(0xC6);
LCD_WR_REG(0xe8);
LCD_WR_DATA(0x40);
LCD_WR_DATA(0x8a);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x00);
LCD_WR_DATA(0x29);
LCD_WR_DATA(0x19);
LCD_WR_DATA(0xa5);
LCD_WR_DATA(0x33);
LCD_WR_REG(0xc1);
LCD_WR_DATA(0x06);
LCD_WR_REG(0xc2);
LCD_WR_DATA(0xa7);
LCD_WR_REG(0xc5);
LCD_WR_DATA(0x18);
LCD_WR_REG(0xe0); // Positive Voltage Gamma Control
LCD_WR_DATA(0xf0);
LCD_WR_DATA(0x09);
LCD_WR_DATA(0x0b);
LCD_WR_DATA(0x06);
LCD_WR_DATA(0x04);
LCD_WR_DATA(0x15);
LCD_WR_DATA(0x2f);
LCD_WR_DATA(0x54);
LCD_WR_DATA(0x42);
LCD_WR_DATA(0x3c);
LCD_WR_DATA(0x17);
LCD_WR_DATA(0x14);
LCD_WR_DATA(0x18);
LCD_WR_DATA(0x1b);
LCD_WR_REG(0xe1); // Negative Voltage Gamma Control
LCD_WR_DATA(0xf0);
LCD_WR_DATA(0x09);
LCD_WR_DATA(0x0b);
LCD_WR_DATA(0x06);
LCD_WR_DATA(0x04);
LCD_WR_DATA(0x03);
LCD_WR_DATA(0x2d);
LCD_WR_DATA(0x43);
LCD_WR_DATA(0x42);
LCD_WR_DATA(0x3b);
LCD_WR_DATA(0x16);
LCD_WR_DATA(0x14);
LCD_WR_DATA(0x17);
LCD_WR_DATA(0x1b);
LCD_WR_REG(0xf0);
LCD_WR_DATA(0x3c);
LCD_WR_REG(0xf0);
LCD_WR_DATA(0x69);
delay(120); // Delay 120ms
LCD_WR_REG(0x29); // Display ON
LCD_clear(0x0000); //
SPI_TFT_BLK_H;
}
void TFT::LCD_clear(uint16_t color) {
unsigned int i, m;
uint32_t count;
uint8_t tbuf[960];
SetCursor(0, 0);
SetWindows(0, 0, 480 - 1, 320 - 1);
LCD_WriteRAM_Prepare();
SPI_TFT_CS_L;
SPI_TFT_DC_H;
for (i = 0; i < 960;) {
tbuf[i] = color >> 8;
tbuf[i + 1] = color;
i += 2;
SPI_TFT.spi_init(SPI_FULL_SPEED);
SetWindows(0, y_off, 480, 1);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
for (i = 0; i < 960;) {
p_index = (uint16_t *)(&bmp_public_buf[i]);
Color = (*p_index >> 8);
*p_index = Color | ((*p_index & 0xFF) << 8);
i+=2;
}
SPI_TFT_CS_L;
SPI_TFT_DC_H;
SPI.dmaSend(bmp_public_buf,960,true);
SPI_TFT_CS_H;
}
for (i = 0; i < 320; i++) {
// for(m=0;m<480;m++)
// {
// LCD_WR_DATA(color>>8);
// LCD_WR_DATA(color);
SPI.dmaSend(tbuf, 960, true);
// SPI_TFT_CS_H;
// }
#else
for (index = 0; index < 40; index ++) {
Pic_Logo_Read((uint8_t *)"", bmp_public_buf, 480*8*2);
i = 0;
SetCursor(0,0);
SetWindows(0, y_off * 8, 480, 8);
LCD_WriteRAM_Prepare(); /* Prepare to write GRAM */
for (i = 0; i < 480 * 8 * 2;) {
p_index = (uint16_t *)(&bmp_public_buf[i]);
Color = (*p_index >> 8);
*p_index = Color | ((*p_index & 0xFF) << 8);
i += 2;
}
SPI_TFT_CS_L;
SPI_TFT_DC_H;
SPI.dmaSend(bmp_public_buf,480*8*2,true);
SPI_TFT_CS_H;
y_off++;
}
SPI_TFT_CS_H;
}
#endif
#endif // SPI_GRAPHICAL_TFT
SetWindows(0, 0, 479, 319);
}
#endif // HAS_TFT_LVGL_UI_SPI

View file

@ -46,10 +46,12 @@ public:
void LCD_WR_REG(uint8_t cmd);
void LCD_WR_DATA(uint8_t data);
void SetCursor(uint16_t x, uint16_t y);
void SetPoint(uint16_t x, uint16_t y, uint16_t point);
void SetWindows(uint16_t x, uint16_t y, uint16_t with, uint16_t height);
void LCD_init();
void LCD_clear(uint16_t color);
void LCD_WriteRAM_Prepare();
void LCD_Draw_Logo();
};
extern TFT SPI_TFT;

View file

@ -22,7 +22,7 @@
#include "../../../../inc/MarlinConfigPre.h"
#if 1 // ENABLED(SPI_FLASH)
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include <SPI.h>
#include "../../../../inc/MarlinConfig.h"
@ -131,7 +131,7 @@ void ext_FLASH::spi_flash_SendBlock(uint8_t token, const uint8_t* buf) {
uint16_t ext_FLASH::W25QXX_ReadID(void) {
uint16_t Temp = 0;
W25QXX_CS_L;
spi_flash_Send(0x90);//<2F><><EFBFBD>Ͷ<EFBFBD>ȡID<49><44><EFBFBD><EFBFBD>
spi_flash_Send(0x90);
spi_flash_Send(0x00);
spi_flash_Send(0x00);
spi_flash_Send(0x00);
@ -391,5 +391,5 @@ void ext_FLASH::SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16
void ext_FLASH::lv_pic_read(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, addr, size);}
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI
#endif // 1 ... SPI_FLASH

View file

@ -56,38 +56,35 @@
#define PIC_NAME_MAX_LEN 50
#define LOGO_MAX_SIZE (300*1024)//logo<67><6F><EFBFBD>ֵ
#define TITLELOGO_MAX_SIZE (150*1024)//logo<67><6F><EFBFBD>ֵ
#define LOGO_MAX_SIZE (300*1024)
#define TITLELOGO_MAX_SIZE (150*1024)
#define DEFAULT_VIEW_MAX_SIZE (200*200*2)
#define FLASH_VIEW_MAX_SIZE (200*200*2)
//ͼƬ
//Robin2<6E><EFBFBD><E6B4A2>ַ
#define PIC_NAME_ADDR 0x003000 //ͼƬ<CDBC><C6AC>Ϣ<EFBFBD><EFBFBD><E6B4A2>ַ<EFBFBD><D6B7>ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>
#define PIC_SIZE_ADDR 0x007000 //ͼƬ<CDBC><C6AC>Ϣ<EFBFBD><EFBFBD><E6B4A2>ַ<EFBFBD><D6B7>ͼƬ<CDBC><C6AC>Сֵ
#define PIC_COUNTER_ADDR 0x008000 //ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><E6B4A2>ַ
#define PIC_LOGO_ADDR 0x009000 //ͼƬlogo<67><EFBFBD><E6B4A2>ַ
//#define PIC_DATA_ADDR 0x02f000 //ͼƬ<CDBC><C6AC><EFBFBD>ݴ洢<DDB4><E6B4A2>ַ
//Robin 2
#define PIC_NAME_ADDR 0x003000
#define PIC_SIZE_ADDR 0x007000
#define PIC_COUNTER_ADDR 0x008000
#define PIC_LOGO_ADDR 0x009000
//#define PIC_DATA_ADDR 0x02f000
#define DEFAULT_VIEW_ADDR 0XC5800
#define BAK_VIEW_ADDR (DEFAULT_VIEW_ADDR+90*1024)
#define PIC_ICON_LOGO_ADDR (BAK_VIEW_ADDR+80*1024)
#define PIC_DATA_ADDR (PIC_ICON_LOGO_ADDR+350*1024) //ͼƬ<CDBC><C6AC><EFBFBD>ݴ洢<DDB4><E6B4A2>ַ//(800*240)
#define PIC_DATA_ADDR (PIC_ICON_LOGO_ADDR+350*1024)
// <20>ֿ<EFBFBD>
#define FONTINFOADDR 0x600000 // 6M<36>Ժ<EFBFBD><D4BA>ַΪ<D6B7>ֿ<EFBFBD>
#define FONTINFOADDR 0x600000
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
#define PER_PIC_MAX_SPACE (32*1024) // Ϊ<>˷<EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⣬ÿ<E2A3AC><C3BF>СͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BBAE>Ӧ<EFBFBD><D3A6>ȡ<EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD><EFBFBD><EFBFBD>4K<34><4B>ֵ
#define PER_PIC_MAX_SPACE (32*1024)
//
union union32 {
uint8_t bytes[4];
uint32_t dwords;
};
// ͼƬ<CDBC><C6AC>Ϣ<EFBFBD><EFBFBD><E1B9B9>
struct pic_msg {
uint8_t name[PIC_NAME_MAX_LEN];
union union32 size;

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -67,7 +67,7 @@ void lv_draw_about(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -79,14 +79,14 @@ void lv_draw_about(void) {
buttonBack = lv_imgbtn_create(scr, NULL);
#if 1
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_A_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
/*Create a label on the Image button*/
@ -98,16 +98,16 @@ void lv_draw_about(void) {
}
fw_version = lv_label_create(scr, NULL);
lv_obj_set_style(fw_version, &tft_style_lable_rel);
lv_obj_set_style(fw_version, &tft_style_label_rel);
lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
fw_type = lv_label_create(scr, NULL);
lv_obj_set_style(fw_type, &tft_style_lable_rel);
lv_obj_set_style(fw_type, &tft_style_label_rel);
lv_label_set_text(fw_type,
#if MB(MKS_ROBIN_PRO)
"Firmware: Robin_Pro35"
#elif MB(MKS_ROBIN_NANO)
#elif MB(MKS_ROBIN_NANO, MKS_ROBIN_NANO_V2)
"Firmware: Robin_Nano35"
#else
CUSTOM_MACHINE_NAME
@ -116,11 +116,11 @@ void lv_draw_about(void) {
lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
board = lv_label_create(scr, NULL);
lv_obj_set_style(board, &tft_style_lable_rel);
lv_obj_set_style(board, &tft_style_label_rel);
lv_label_set_text(board, "Board: " BOARD_INFO_NAME);
lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, 20);
}
void lv_clear_about() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,483 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/planner.h"
static lv_obj_t * scr;
#define ID_ACCE_RETURN 1
#define ID_ACCE_PRINT 2
#define ID_ACCE_RETRA 3
#define ID_ACCE_TRAVEL 4
#define ID_ACCE_X 5
#define ID_ACCE_Y 6
#define ID_ACCE_Z 7
#define ID_ACCE_E0 8
#define ID_ACCE_E1 9
#define ID_ACCE_UP 10
#define ID_ACCE_DOWN 11
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_ACCE_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_acceleration_settings();
draw_return_ui();
}
break;
case ID_ACCE_PRINT:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = PrintAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_RETRA:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = RetractAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_TRAVEL:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = TravelAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = XAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = YAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = ZAcceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_E0:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E0Acceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_E1:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E1Acceleration;
lv_clear_acceleration_settings();
lv_draw_number_key();
}
break;
case ID_ACCE_UP:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_acceleration_settings();
lv_draw_acceleration_settings();
}
break;
case ID_ACCE_DOWN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 1;
lv_clear_acceleration_settings();
lv_draw_acceleration_settings();
}
break;
}
}
void lv_draw_acceleration_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *buttonPrintText = NULL, *labelPrintText = NULL, *buttonPrintValue = NULL, *labelPrintValue = NULL;
lv_obj_t *buttonRetraText = NULL, *labelRetraText = NULL, *buttonRetraValue = NULL, *labelRetraValue = NULL;
lv_obj_t *buttonTravelText = NULL, *labelTravelText = NULL, *buttonTravelValue = NULL, *labelTravelValue = NULL;
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ACCELERATION_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ACCELERATION_UI;
}
disp_state = ACCELERATION_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.AccelerationConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
// LV_IMG_DECLARE(bmp_para_arrow);
LV_IMG_DECLARE(bmp_para_bank);
if (uiCfg.para_ui_page != 1) {
buttonPrintText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonPrintText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonPrintText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonPrintText, event_handler);
lv_btn_set_style(buttonPrintText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonPrintText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonPrintText, LV_LAYOUT_OFF);
labelPrintText = lv_label_create(buttonPrintText, NULL); /*Add a label to the button*/
buttonPrintValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonPrintValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonPrintValue, event_handler, ID_ACCE_PRINT, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonPrintValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonPrintValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonPrintValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonPrintValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonPrintValue, LV_LAYOUT_OFF);
labelPrintValue = lv_label_create(buttonPrintValue, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonRetraText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonRetraText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonRetraText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonRetraText, event_handler);
lv_btn_set_style(buttonRetraText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonRetraText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonRetraText, LV_LAYOUT_OFF);
labelRetraText = lv_label_create(buttonRetraText, NULL); /*Add a label to the button*/
buttonRetraValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonRetraValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonRetraValue, event_handler, ID_ACCE_RETRA, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonRetraValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonRetraValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonRetraValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonRetraValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonRetraValue, LV_LAYOUT_OFF);
labelRetraValue = lv_label_create(buttonRetraValue, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonTravelText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonTravelText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonTravelText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonTravelText, event_handler);
lv_btn_set_style(buttonTravelText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonTravelText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonTravelText, LV_LAYOUT_OFF);
labelTravelText = lv_label_create(buttonTravelText, NULL); /*Add a label to the button*/
buttonTravelValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonTravelValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonTravelValue, event_handler, ID_ACCE_TRAVEL, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonTravelValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonTravelValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonTravelValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonTravelValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonTravelValue, LV_LAYOUT_OFF);
labelTravelValue = lv_label_create(buttonTravelValue, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_ACCE_X, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
labelXValue = lv_label_create(buttonXValue, NULL);
line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_DOWN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
}
else {
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_ACCE_Y, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
labelYValue = lv_label_create(buttonYValue, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_ACCE_Z, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
labelZValue = lv_label_create(buttonZValue, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE0Text, event_handler);
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
labelE0Text = lv_label_create(buttonE0Text, NULL); /*Add a label to the button*/
buttonE0Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_ACCE_E0, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
labelE0Value = lv_label_create(buttonE0Value, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/
lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE1Text, event_handler);
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
labelE1Text = lv_label_create(buttonE1Text, NULL); /*Add a label to the button*/
buttonE1Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_ACCE_E1, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
labelE1Value = lv_label_create(buttonE1Value, NULL);
line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_ACCE_UP, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
}
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
labelTurnPage = lv_label_create(buttonTurnPage, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ACCE_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.para_ui_page != 1) {
lv_label_set_text(labelPrintText, machine_menu.PrintAcceleration);
lv_obj_align(labelPrintText, buttonPrintText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelRetraText, machine_menu.RetractAcceleration);
lv_obj_align(labelRetraText, buttonRetraText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTravelText, machine_menu.TravelAcceleration);
lv_obj_align(labelTravelText, buttonTravelText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelXText, machine_menu.X_Acceleration);
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.next);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.acceleration);
lv_label_set_text(labelPrintValue, public_buf_l);
lv_obj_align(labelPrintValue, buttonPrintValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.retract_acceleration);
lv_label_set_text(labelRetraValue, public_buf_l);
lv_obj_align(labelRetraValue, buttonRetraValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.travel_acceleration);
lv_label_set_text(labelTravelValue, public_buf_l);
lv_obj_align(labelTravelValue, buttonTravelValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
lv_label_set_text(labelXValue, public_buf_l);
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
}
else {
lv_label_set_text(labelYText, machine_menu.Y_Acceleration);
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelZText, machine_menu.Z_Acceleration);
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelE0Text, machine_menu.E0_Acceleration);
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelE1Text, machine_menu.E1_Acceleration);
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.previous);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
lv_label_set_text(labelYValue, public_buf_l);
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
lv_label_set_text(labelZValue, public_buf_l);
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
lv_label_set_text(labelE0Value, public_buf_l);
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
lv_label_set_text(labelE1Value, public_buf_l);
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
}
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
}
}
void lv_clear_acceleration_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_acceleration_settings(void);
extern void lv_clear_acceleration_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -0,0 +1,140 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
static lv_obj_t * scr;
#define ID_ADVANCE_RETURN 1
#define ID_PAUSE_POS 2
#define ID_PAUSE_POS_ARROW 3
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_ADVANCE_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_advance_settings();
draw_return_ui();
}
break;
case ID_PAUSE_POS:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_advance_settings();
lv_draw_pause_position();
}
break;
case ID_PAUSE_POS_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_advance_settings();
lv_draw_pause_position();
}
break;
}
}
void lv_draw_advance_settings(void) {
lv_obj_t *buttonBack, *label_Back;
lv_obj_t *buttonPausePos, *labelPausePos, *buttonPausePosNarrow;
lv_obj_t * line1;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != ADVANCED_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = ADVANCED_UI;
}
disp_state = ADVANCED_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.AdvancedConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
LV_IMG_DECLARE(bmp_para_arrow);
buttonPausePos = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonPausePos, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonPausePos, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonPausePos, event_handler, ID_PAUSE_POS, NULL, 0);
lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonPausePos, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonPausePos, LV_LAYOUT_OFF);
labelPausePos = lv_label_create(buttonPausePos, NULL); /*Add a label to the button*/
buttonPausePosNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonPausePosNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonPausePosNarrow, event_handler, ID_PAUSE_POS_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonPausePosNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonPausePosNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPausePosNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonPausePosNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line1, line_points[0]);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_ADVANCE_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelPausePos, machine_menu.PausePosition);
lv_obj_align(labelPausePos, buttonPausePos, LV_ALIGN_IN_LEFT_MID, 0, 0);
}
}
void lv_clear_advance_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_advance_settings(void);
extern void lv_clear_advance_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -44,7 +44,7 @@ static lv_obj_t * printSpeedText;
#define ID_C_MOVE 3
#define ID_C_EXT 4
#define ID_C_STEP 5
#define ID_C_RETURN 6
#define ID_C_RETURN 6
static uint8_t speedType;
@ -169,7 +169,7 @@ void lv_draw_change_speed(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -178,56 +178,55 @@ void lv_draw_change_speed(void) {
LV_IMG_DECLARE(bmp_pic);
/*Create an Image button*/
buttonAdd = lv_imgbtn_create(scr, NULL);
buttonDec = lv_imgbtn_create(scr, NULL);
buttonMov = lv_imgbtn_create(scr, NULL);
buttonExt = lv_imgbtn_create(scr, NULL);
buttonAdd = lv_imgbtn_create(scr, NULL);
buttonDec = lv_imgbtn_create(scr, NULL);
buttonMov = lv_imgbtn_create(scr, NULL);
buttonExt = lv_imgbtn_create(scr, NULL);
buttonStep = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_C_ADD, "bmp_Add.bin", 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_C_DEC, "bmp_Dec.bin", 0);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonMov, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMov, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonExt, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExt, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_C_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_C_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonMov, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonMov, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonExt, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonStep, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonStep, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
@ -239,8 +238,8 @@ void lv_draw_change_speed(void) {
lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
labelMov = lv_label_create(buttonMov, NULL);
labelExt = lv_label_create(buttonExt, NULL);
labelMov = lv_label_create(buttonMov, NULL);
labelExt = lv_label_create(buttonExt, NULL);
labelStep = lv_label_create(buttonStep, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
@ -258,17 +257,17 @@ void lv_draw_change_speed(void) {
disp_speed_step();
printSpeedText = lv_label_create(scr, NULL);
lv_obj_set_style(printSpeedText, &tft_style_lable_rel);
lv_obj_set_style(printSpeedText, &tft_style_label_rel);
disp_print_speed();
}
void disp_speed_step() {
if (uiCfg.stepPrintSpeed == 1)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step1_percent.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_step1_percent.bin", 0);
else if (uiCfg.stepPrintSpeed == 5)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step5_percent.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_step5_percent.bin", 0);
else if (uiCfg.stepPrintSpeed == 10)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_Step10_percent.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_C_STEP, "bmp_step10_percent.bin", 0);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.stepPrintSpeed == 1) {
@ -291,16 +290,16 @@ void disp_print_speed() {
public_buf_l[0] = '\0';
if (speedType == 0) { //move
if (speedType == 0) { // move
strcat(public_buf_l, speed_menu.move_speed);
strcat(public_buf_l, ": ");
sprintf(buf, "%d%%", feedrate_percentage);
strcat_P(public_buf_l, PSTR(": "));
sprintf_P(buf, PSTR("%d%%"), feedrate_percentage);
strcat(public_buf_l, buf);
}
else if (speedType == 1) { // e1
strcat(public_buf_l, speed_menu.extrude_speed);
strcat(public_buf_l, ": ");
sprintf(buf, "%d%%", planner.flow_percentage[0]);
strcat_P(public_buf_l, PSTR(": "));
sprintf_P(buf, PSTR("%d%%"), planner.flow_percentage[0]);
strcat(public_buf_l, buf);
}
lv_label_set_text(printSpeedText, public_buf_l);
@ -311,11 +310,11 @@ void disp_speed_type() {
switch (speedType) {
case 1:
lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_extruct_sel.bin", 0);
lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_changespeed.bin", 0);
lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_changeSpeed.bin", 0);
break;
default:
lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_Extruct.bin", 0);
lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_speed_extruct.bin", 0);
lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_sel.bin", 0);
break;
}
@ -333,4 +332,4 @@ void disp_speed_type() {
void lv_clear_change_speed() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -26,10 +26,11 @@
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
//#include "../lvgl/src/lv_objx/lv_img.h"
//#include "../lvgl/src/lv_core/lv_disp.h"
@ -48,6 +49,7 @@
#if ENABLED(PARK_HEAD_ON_PAUSE)
#include "../../../../feature/pause.h"
#endif
#include "../../../../gcode/gcode.h"
static lv_obj_t * scr;
extern uint8_t sel_id;
@ -72,36 +74,36 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
lv_draw_printing();
#if ENABLED(SDSUPPORT)
if (gcode_preview_over != 1) {
char *cur_name;
cur_name = strrchr(list_file.file_name[sel_id], '/');
if (gcode_preview_over != 1) {
char *cur_name;
cur_name = strrchr(list_file.file_name[sel_id], '/');
SdFile file, *curDir;
card.endFilePrint();
const char * const fname = card.diveToFile(true, curDir, cur_name);
if (!fname) return;
if (file.open(curDir, fname, O_READ)) {
gCfgItems.curFilesize = file.fileSize();
file.close();
update_spi_flash();
SdFile file, *curDir;
card.endFilePrint();
const char * const fname = card.diveToFile(true, curDir, cur_name);
if (!fname) return;
if (file.open(curDir, fname, O_READ)) {
gCfgItems.curFilesize = file.fileSize();
file.close();
update_spi_flash();
}
card.openFileRead(cur_name);
if (card.isFileOpen()) {
feedrate_percentage = 100;
//saved_feedrate_percentage = feedrate_percentage;
planner.flow_percentage[0] = 100;
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
#if EXTRUDERS == 2
planner.flow_percentage[1] = 100;
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
#endif
card.startFileprint();
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.prepare();
#endif
once_flag = 0;
}
}
card.openFileRead(cur_name);
if (card.isFileOpen()) {
feedrate_percentage = 100;
//saved_feedrate_percentage = feedrate_percentage;
planner.flow_percentage[0] = 100;
planner.e_factor[0] = planner.flow_percentage[0] * 0.01f;
#if EXTRUDERS == 2
planner.flow_percentage[1] = 100;
planner.e_factor[1] = planner.flow_percentage[1] * 0.01f;
#endif
card.startFileprint();
#if ENABLED(POWER_LOSS_RECOVERY)
recovery.prepare();
#endif
once_flag = 0;
}
}
#endif
}
else if (DialogType == DIALOG_TYPE_STOP) {
@ -112,7 +114,7 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
#if ENABLED(SDSUPPORT)
//card.endFilePrint();
//wait_for_heatup = false;
uiCfg.print_state = IDLE;
uiCfg.print_state = IDLE;
card.flag.abort_sd_printing = true;
//queue.clear();
//quickstop_stepper();
@ -120,12 +122,9 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
//thermalManager.disable_all_heaters();
//#if ENABLED(POWER_LOSS_RECOVERY)
//recovery.purge();
// recovery.purge();
//#endif
//queue.enqueue_one_now(PSTR("G91"));
//queue.enqueue_one_now(PSTR("G1 Z10"));
//queue.enqueue_one_now(PSTR("G90"));
//queue.enqueue_one_now(PSTR("G28 X0 Y0"));
//queue.enqueue_now_P(PSTR("G91\nG1 Z10\nG90\nG28 X0 Y0"));
//queue.inject_P(PSTR("G91\nG1 Z10\nG90\nG28 X0 Y0\nM84\nM107"));
#endif
}
@ -148,6 +147,21 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
draw_return_ui();
}
#endif
else if (DialogType == DIALOG_STORE_EEPROM_TIPS) {
gcode.process_subcommands_now_P(PSTR("M500"));
clear_cur_ui();
draw_return_ui();
}
else if (DialogType == DIALOG_READ_EEPROM_TIPS) {
gcode.process_subcommands_now_P(PSTR("M501"));
clear_cur_ui();
draw_return_ui();
}
else if (DialogType == DIALOG_REVERT_EEPROM_TIPS) {
gcode.process_subcommands_now_P(PSTR("M502"));
clear_cur_ui();
draw_return_ui();
}
}
}
@ -186,7 +200,7 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -194,51 +208,52 @@ void lv_draw_dialog(uint8_t type) {
//LV_IMG_DECLARE(bmp_pic);
static lv_style_t style_btn_rel; // A variable to store the released style
lv_style_copy(&style_btn_rel, &lv_style_plain); // Initialize from a built-in style
static lv_style_t style_btn_rel; // A variable to store the released style
lv_style_copy(&style_btn_rel, &lv_style_plain); // Initialize from a built-in style
style_btn_rel.body.border.color = lv_color_hex3(0x269);
style_btn_rel.body.border.width = 1;
style_btn_rel.body.main_color = lv_color_hex3(0xADF);
style_btn_rel.body.grad_color = lv_color_hex3(0x46B);
style_btn_rel.body.main_color = lv_color_hex3(0xADF);
style_btn_rel.body.grad_color = lv_color_hex3(0x46B);
style_btn_rel.body.shadow.width = 4;
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
style_btn_rel.text.color = lv_color_hex3(0xDEF);
style_btn_rel.text.font = &lv_font_roboto_22;
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
style_btn_rel.text.color = lv_color_hex3(0xDEF);
style_btn_rel.text.font = &TERN(HAS_SPI_FLASH_FONT, gb2312_puhui32, lv_font_roboto_22);
static lv_style_t style_btn_pr; // A variable to store the pressed style
lv_style_copy(&style_btn_pr, &style_btn_rel); // Initialize from the released style
static lv_style_t style_btn_pr; // A variable to store the pressed style
lv_style_copy(&style_btn_pr, &style_btn_rel); // Initialize from the released style
style_btn_pr.body.border.color = lv_color_hex3(0x46B);
style_btn_pr.body.main_color = lv_color_hex3(0x8BD);
style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
style_btn_pr.body.main_color = lv_color_hex3(0x8BD);
style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
style_btn_pr.body.shadow.width = 2;
style_btn_pr.text.color = lv_color_hex3(0xBCD);
style_btn_pr.text.font = &lv_font_roboto_22;
style_btn_pr.text.color = lv_color_hex3(0xBCD);
style_btn_pr.text.font = &TERN(HAS_SPI_FLASH_FONT, gb2312_puhui32, lv_font_roboto_22);
lv_obj_t * labelDialog = lv_label_create(scr, NULL);
lv_obj_set_style(labelDialog, &tft_style_lable_rel);
lv_obj_set_style(labelDialog, &tft_style_label_rel);
if (DialogType == DIALOG_TYPE_FINISH_PRINT || DialogType == DIALOG_PAUSE_MESSAGE_RESUME) {
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
lv_obj_set_size(btnOk, 100, 50); // Set its size
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
lv_obj_set_size(btnOk, 100, 50); // Set its size
lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
}
else if (DialogType == DIALOG_PAUSE_MESSAGE_WAITING
|| DialogType == DIALOG_PAUSE_MESSAGE_INSERT
|| DialogType == DIALOG_PAUSE_MESSAGE_HEAT) {
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
lv_obj_set_size(btnOk, 100, 50); // Set its size
|| DialogType == DIALOG_PAUSE_MESSAGE_INSERT
|| DialogType == DIALOG_PAUSE_MESSAGE_HEAT
) {
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnOk, BTN_OK_X + 90, BTN_OK_Y); // Set its position
lv_obj_set_size(btnOk, 100, 50); // Set its size
lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
}
else if (DialogType == DIALOG_PAUSE_MESSAGE_PAUSING
|| DialogType == DIALOG_PAUSE_MESSAGE_CHANGING
@ -251,28 +266,28 @@ void lv_draw_dialog(uint8_t type) {
// nothing to do
}
else {
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y); // Set its position
lv_obj_set_size(btnOk, 100, 50); // Set its size
lv_obj_t * btnOk = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnOk, BTN_OK_X, BTN_OK_Y); // Set its position
lv_obj_set_size(btnOk, 100, 50); // Set its size
lv_obj_set_event_cb(btnOk, btn_ok_event_cb);
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
lv_btn_set_style(btnOk, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnOk, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelOk = lv_label_create(btnOk, NULL); // Add a label to the button
lv_obj_t * btnCancel = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y); // Set its position
lv_obj_set_size(btnCancel, 100, 50); // Set its size
lv_obj_t * btnCancel = lv_btn_create(scr, NULL); // Add a button the current screen
lv_obj_set_pos(btnCancel, BTN_CANCEL_X, BTN_CANCEL_Y); // Set its position
lv_obj_set_size(btnCancel, 100, 50); // Set its size
lv_obj_set_event_cb(btnCancel, btn_cancel_event_cb);
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelCancel = lv_label_create(btnCancel, NULL); // Add a label to the button
lv_btn_set_style(btnCancel, LV_BTN_STYLE_REL, &style_btn_rel); // Set the button's released style
lv_btn_set_style(btnCancel, LV_BTN_STYLE_PR, &style_btn_pr); // Set the button's pressed style
lv_obj_t * labelCancel = lv_label_create(btnCancel, NULL); // Add a label to the button
if (DialogType == DIALOG_PAUSE_MESSAGE_OPTION) {
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
lv_label_set_text(labelOk, pause_msg_menu.purgeMore); // Set the labels text
lv_label_set_text(labelCancel, pause_msg_menu.continuePrint);
}
else {
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_label_set_text(labelOk, print_file_dialog_menu.confirm); // Set the labels text
lv_label_set_text(labelCancel, print_file_dialog_menu.cancle);
}
}
@ -281,7 +296,7 @@ void lv_draw_dialog(uint8_t type) {
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
lv_obj_t * labelFile = lv_label_create(scr, NULL);
lv_obj_set_style(labelFile, &tft_style_lable_rel);
lv_obj_set_style(labelFile, &tft_style_label_rel);
lv_label_set_text(labelFile, list_file.long_name[sel_id]);
lv_obj_align(labelFile, NULL, LV_ALIGN_CENTER, 0, -60);
@ -338,8 +353,20 @@ void lv_draw_dialog(uint8_t type) {
lv_label_set_text(labelDialog, pause_msg_menu.option);
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
}
else if (DialogType == DIALOG_STORE_EEPROM_TIPS) {
lv_label_set_text(labelDialog, eeprom_menu.storeTips);
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
}
else if (DialogType == DIALOG_READ_EEPROM_TIPS) {
lv_label_set_text(labelDialog, eeprom_menu.readTips);
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
}
else if (DialogType == DIALOG_REVERT_EEPROM_TIPS) {
lv_label_set_text(labelDialog, eeprom_menu.revertTips);
lv_obj_align(labelDialog, NULL, LV_ALIGN_CENTER, 0, -20);
}
}
void lv_clear_dialog() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -30,7 +30,7 @@ extern "C" { /* C-declarations for C++ */
#define DIALOG_TYPE_REPRINT_NO_FILE 2
#define DIALOG_TYPE_M80_FAIL 3 //**
#define DIALOG_TYPE_MESSEGE_ERR1 4 //**
#define DIALOG_TYPE_MESSAGE_ERR1 4 //**
#define DIALOG_TYPE_UPDATE_ESP_FIRMARE 5
#define DIALOG_TYPE_UPDATE_ESP_DATA 6
@ -65,6 +65,10 @@ extern "C" { /* C-declarations for C++ */
#define DIALOG_PAUSE_MESSAGE_HEATING 30
#define DIALOG_PAUSE_MESSAGE_OPTION 31
#define DIALOG_STORE_EEPROM_TIPS 32
#define DIALOG_READ_EEPROM_TIPS 33
#define DIALOG_REVERT_EEPROM_TIPS 34
#define BTN_OK_X 100
#define BTN_OK_Y 180
#define BTN_CANCEL_X 280

View file

@ -0,0 +1,237 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
static lv_obj_t * scr;
#define ID_EEPROM_RETURN 1
#define ID_EEPROM_STORE 2
#define ID_EEPROM_STORE_ARROW 3
#define ID_EEPROM_READ 4
#define ID_EEPROM_READ_ARROW 5
#define ID_EEPROM_REVERT 6
#define ID_EEPROM_REVERT_ARROW 7
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_EEPROM_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_eeprom_settings();
draw_return_ui();
}
break;
#if 0
case ID_EEPROM_STORE:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS);
}
break;
case ID_EEPROM_STORE_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_STORE_EEPROM_TIPS);
}
break;
case ID_EEPROM_READ:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_READ_EEPROM_TIPS);
}
break;
case ID_EEPROM_READ_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_READ_EEPROM_TIPS);
}
break;
#endif
case ID_EEPROM_REVERT:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS);
}
break;
case ID_EEPROM_REVERT_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_eeprom_settings();
lv_draw_dialog(DIALOG_REVERT_EEPROM_TIPS);
}
break;
}
}
void lv_draw_eeprom_settings(void) {
lv_obj_t *buttonBack, *label_Back;
//lv_obj_t *buttonStore,*labelStore,*buttonStoreNarrow;
//lv_obj_t *buttonRead,*labelRead,*buttonReadNarrow;
lv_obj_t *buttonRevert, *labelRevert, *buttonRevertNarrow;
lv_obj_t * line1; // * line2,* line3;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != EEPROM_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = EEPROM_SETTINGS_UI;
}
disp_state = EEPROM_SETTINGS_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
LV_IMG_DECLARE(bmp_para_arrow);
#if 0
buttonStore = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonStore, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonStore, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonStore, event_handler, ID_EEPROM_STORE, NULL, 0);
lv_btn_set_style(buttonStore, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonStore, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonStore, LV_LAYOUT_OFF);
labelStore = lv_label_create(buttonStore, NULL); /*Add a label to the button*/
buttonStoreNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonStoreNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonStoreNarrow, event_handler, ID_EEPROM_STORE_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonStoreNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonStoreNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStoreNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonStoreNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonRead = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonRead, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonRead, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonRead, event_handler, ID_EEPROM_READ, NULL, 0);
lv_btn_set_style(buttonRead, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonRead, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonRead, LV_LAYOUT_OFF);
labelRead = lv_label_create(buttonRead, NULL); /*Add a label to the button*/
buttonReadNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonReadNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonReadNarrow, event_handler, ID_EEPROM_READ_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonReadNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonReadNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonReadNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonReadNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonReadNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
#endif // if 0
buttonRevert = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonRevert, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonRevert, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
//lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonRevert, event_handler, ID_EEPROM_REVERT, NULL, 0);
lv_btn_set_style(buttonRevert, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonRevert, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonRevert, LV_LAYOUT_OFF);
labelRevert = lv_label_create(buttonRevert, NULL); /*Add a label to the button*/
buttonRevertNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonRevertNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonRevertNarrow, event_handler, ID_EEPROM_REVERT_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonRevertNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonRevertNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonRevertNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonRevertNarrow, LV_LAYOUT_OFF);
//line3 = lv_line_create(scr, NULL);
//lv_ex_line(line3,line_points[2]);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_EEPROM_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
//lv_label_set_text(labelStore, eeprom_menu.store);
//lv_obj_align(labelStore, buttonStore, LV_ALIGN_IN_LEFT_MID,0, 0);
//lv_label_set_text(labelRead, eeprom_menu.read);
//lv_obj_align(labelRead, buttonRead, LV_ALIGN_IN_LEFT_MID,0, 0);
lv_label_set_text(labelRevert, eeprom_menu.revert);
lv_obj_align(labelRevert, buttonRevert, LV_ALIGN_IN_LEFT_MID, 0, 0);
}
}
void lv_clear_eeprom_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_eeprom_settings(void);
extern void lv_clear_eeprom_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,11 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#if ENABLED(TFT_LVGL_UI_SPI)
#include "SPI_TFT.h"
#endif
#include "lv_conf.h"
#include "draw_ui.h"
@ -55,30 +59,30 @@ void lv_draw_error_message(PGM_P const msg) {
if (msg) {
message = lv_label_create(scr, NULL);
lv_obj_set_style(message, &tft_style_lable_rel);
lv_obj_set_style(message, &tft_style_label_rel);
lv_label_set_text(message, msg);
lv_obj_align(message, NULL, LV_ALIGN_CENTER, 0, -50);
}
kill_message = lv_label_create(scr, NULL);
lv_obj_set_style(kill_message, &tft_style_lable_rel);
lv_obj_set_style(kill_message, &tft_style_label_rel);
lv_label_set_text(kill_message, "PRINTER HALTED");
lv_obj_align(kill_message, NULL, LV_ALIGN_CENTER, 0, -10);
reset_tips = lv_label_create(scr, NULL);
lv_obj_set_style(reset_tips, &tft_style_lable_rel);
lv_obj_set_style(reset_tips, &tft_style_label_rel);
lv_label_set_text(reset_tips, "Please Reset");
lv_obj_align(reset_tips, NULL, LV_ALIGN_CENTER, 0, 30);
lv_task_handler();
#endif
LCD_Clear(0x0000);
TERN(TFT_LVGL_UI_SPI, SPI_TFT.LCD_clear, LCD_Clear)(0x0000);
if (msg) disp_string((TFT_WIDTH - strlen(msg) * 16) / 2, 100, msg, 0xFFFF, 0x0000);
disp_string((TFT_WIDTH - strlen("PRINTER HALTED") * 16) / 2, 140, "PRINTER HALTED", 0xFFFF, 0x0000);
disp_string((TFT_WIDTH - strlen("Please Reset") * 16) / 2, 180, "Please Reset", 0xFFFF, 0x0000);
}
void lv_clear_error_message() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -59,11 +59,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
queue.enqueue_one_now(PSTR("G91"));
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf((char *)public_buf_l, "G1 E%d F%d", uiCfg.extruStep, 60 * uiCfg.extruSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
queue.enqueue_one_now(PSTR("G90"));
queue.enqueue_now_P(PSTR("G91"));
ZERO(public_buf_l);
sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), uiCfg.extruStep, 60 * uiCfg.extruSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G90"));
extructAmount += uiCfg.extruStep;
disp_extru_amount();
}
@ -75,11 +75,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius >= EXTRUDE_MINTEMP) {
queue.enqueue_one_now(PSTR("G91"));
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf((char *)public_buf_l, "G1 E%d F%d", 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
queue.enqueue_one_now(PSTR("G90"));
queue.enqueue_now_P(PSTR("G91"));
ZERO(public_buf_l);
sprintf_P((char *)public_buf_l, PSTR("G1 E%d F%d"), 0 - uiCfg.extruStep, 60 * uiCfg.extruSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G90"));
extructAmount -= uiCfg.extruStep;
disp_extru_amount();
}
@ -166,7 +166,7 @@ void lv_draw_extrusion(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -175,55 +175,54 @@ void lv_draw_extrusion(void) {
LV_IMG_DECLARE(bmp_pic);
/*Create an Image button*/
buttonAdd = lv_imgbtn_create(scr, NULL);
buttonDec = lv_imgbtn_create(scr, NULL);
buttoType = lv_imgbtn_create(scr, NULL);
buttonStep = lv_imgbtn_create(scr, NULL);
buttonAdd = lv_imgbtn_create(scr, NULL);
buttonDec = lv_imgbtn_create(scr, NULL);
buttoType = lv_imgbtn_create(scr, NULL);
buttonStep = lv_imgbtn_create(scr, NULL);
buttonSpeed = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, "bmp_In.bin", 0);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_E_ADD, "bmp_in.bin", 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, "bmp_Out.bin", 0);
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_E_DEC, "bmp_out.bin", 0);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_E_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_E_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonStep, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
@ -235,8 +234,8 @@ void lv_draw_extrusion(void) {
lv_obj_t * labelAdd = lv_label_create(buttonAdd, NULL);
lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
labelType = lv_label_create(buttoType, NULL);
labelStep = lv_label_create(buttonStep, NULL);
labelType = lv_label_create(buttoType, NULL);
labelStep = lv_label_create(buttonStep, NULL);
labelSpeed = lv_label_create(buttonSpeed, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
@ -256,24 +255,24 @@ void lv_draw_extrusion(void) {
disp_ext_speed();
tempText = lv_label_create(scr, NULL);
lv_obj_set_style(tempText, &tft_style_lable_rel);
lv_obj_set_style(tempText, &tft_style_label_rel);
disp_hotend_temp();
ExtruText = lv_label_create(scr, NULL);
lv_obj_set_style(ExtruText, &tft_style_lable_rel);
lv_obj_set_style(ExtruText, &tft_style_label_rel);
disp_extru_amount();
}
void disp_ext_type() {
if (uiCfg.curSprayerChoose == 1) {
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru2.bin", 0);
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_extru2.bin", 0);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(labelType, extrude_menu.ext2);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
else {
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_Extru1.bin", 0);
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_E_TYPE, "bmp_extru1.bin", 0);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(labelType, extrude_menu.ext1);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@ -283,11 +282,11 @@ void disp_ext_type() {
void disp_ext_speed() {
if (uiCfg.extruSpeed == 20)
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_high.bin", 0);
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_high.bin", 0);
else if (uiCfg.extruSpeed == 1)
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_slow.bin", 0);
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_slow.bin", 0);
else
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_Speed_normal.bin", 0);
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_E_SPEED, "bmp_speed_normal.bin", 0);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.extruSpeed == 20) {
@ -351,11 +350,11 @@ void disp_extru_amount() {
void disp_ext_step() {
if (uiCfg.extruStep == 1)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step1_mm.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step1_mm.bin", 0);
else if (uiCfg.extruStep == 5)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step5_mm.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step5_mm.bin", 0);
else if (uiCfg.extruStep == 10)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_Step10_mm.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_E_STEP, "bmp_step10_mm.bin", 0);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.extruStep == 1) {
@ -375,4 +374,4 @@ void disp_ext_step() {
void lv_clear_extrusion() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "lv_conf.h"
@ -33,6 +33,7 @@
#include "draw_ui.h"
#include "../../../../module/temperature.h"
#include "../../../../gcode/queue.h"
#include "../../../../gcode/gcode.h"
static lv_obj_t * scr;
static lv_obj_t * fanText;
@ -55,9 +56,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (fanSpeed + 1 <= 255) {
fanSpeed++;
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "M106 S%d", fanSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("M106 S%d"), fanSpeed);
gcode.process_subcommands_now(public_buf_l);
}
}
break;
@ -68,9 +69,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (fanSpeed > 0) {
fanSpeed--;
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "M106 S%d", fanSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("M106 S%d"), fanSpeed);
gcode.process_subcommands_now(public_buf_l);
}
}
@ -80,7 +81,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
queue.enqueue_one_now(PSTR("M106 S255"));
gcode.process_subcommands_now_P(PSTR("M106 S255"));
}
break;
case ID_F_MID:
@ -88,7 +89,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
queue.enqueue_one_now(PSTR("M106 S127"));
gcode.process_subcommands_now_P(PSTR("M106 S127"));
}
break;
case ID_F_OFF:
@ -96,7 +97,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
queue.enqueue_one_now(PSTR("M107"));
gcode.process_subcommands_now_P(PSTR("M107"));
}
break;
case ID_F_RETURN:
@ -111,11 +112,13 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
}
void lv_draw_fan(void) {
lv_obj_t *buttonAdd, *buttonDec, *buttonHigh, *buttonMid;
lv_obj_t *buttonOff, *buttonBack;
#if HAS_FAN
fanSpeed = thermalManager.fan_speed[0];
#endif
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != FAN_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = FAN_UI;
@ -129,7 +132,7 @@ void lv_draw_fan(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -148,39 +151,39 @@ void lv_draw_fan(void) {
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_F_ADD, "bmp_Add.bin", 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_F_DEC, "bmp_Dec.bin", 0);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHigh, event_handler, ID_F_HIGH, "bmp_Speed255.bin", 0);
lv_obj_set_event_cb_mks(buttonHigh, event_handler,ID_F_HIGH,"bmp_speed255.bin",0);
lv_imgbtn_set_src(buttonHigh, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonHigh, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHigh, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonMid, event_handler, ID_F_MID, "bmp_Speed127.bin", 0);
lv_obj_set_event_cb_mks(buttonMid, event_handler,ID_F_MID,"bmp_speed127.bin",0);
lv_imgbtn_set_src(buttonMid, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonMid, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMid, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_F_OFF, "bmp_Speed0.bin", 0);
lv_obj_set_event_cb_mks(buttonOff, event_handler,ID_F_OFF,"bmp_speed0.bin",0);
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_F_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_F_RETURN,"bmp_return.bin",0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
@ -227,7 +230,7 @@ void lv_draw_fan(void) {
}
fanText = lv_label_create(scr, NULL);
lv_obj_set_style(fanText, &tft_style_lable_rel);
lv_obj_set_style(fanText, &tft_style_label_rel);
disp_fan_value();
}
@ -235,8 +238,8 @@ void disp_fan_value() {
char buf1[10] = {0};
public_buf_l[0] = '\0';
strcat(public_buf_l, fan_menu.state);
strcat(public_buf_l, ": ");
sprintf(buf1, "%3d", thermalManager.fan_speed[0]);
strcat_P(public_buf_l, PSTR(": "));
sprintf_P(buf1, PSTR("%3d"), thermalManager.fan_speed[0]);
strcat(public_buf_l, buf1);
lv_label_set_text(fanText, public_buf_l);
lv_obj_align(fanText, NULL, LV_ALIGN_CENTER, 0, -65);
@ -244,4 +247,4 @@ void disp_fan_value() {
void lv_clear_fan() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "draw_ready_print.h"
@ -48,8 +48,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_H_ALL:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
queue.inject_P(PSTR("G28"));
@ -57,8 +55,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
break;
case ID_H_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
queue.inject_P(PSTR("G28 X0"));
@ -66,8 +62,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
break;
case ID_H_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
queue.inject_P(PSTR("G28 Y0"));
@ -75,8 +69,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
break;
case ID_H_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
queue.inject_P(PSTR("G28 Z0"));
@ -84,8 +76,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
break;
case ID_H_OFF_ALL:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
queue.inject_P(PSTR("M84"));
@ -93,8 +83,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
break;
case ID_H_OFF_XY:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
queue.inject_P(PSTR("M84 X Y"));
@ -102,7 +90,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
break;
case ID_H_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_obj_del(scr);
@ -113,7 +100,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
}
void lv_draw_home(void) {
lv_obj_t *buttonHomeAll, *buttonHomeX, *buttonHomeY, *buttonHomeZ;
lv_obj_t *buttonBack;
@ -134,7 +120,7 @@ void lv_draw_home(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -156,67 +142,68 @@ void lv_draw_home(void) {
//lv_obj_set_event_cb_mks(buttonWifi, event_handler,ID_S_WIFI,"bmp_Wifi.bin",0);
//lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_lable_pre);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_lable_rel);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_clear_protect(buttonWifi, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonHomeAll, event_handler, ID_H_ALL, "bmp_Zero.bin", 0);
lv_obj_set_event_cb_mks(buttonHomeAll, event_handler,ID_H_ALL,"bmp_zero.bin",0);
lv_imgbtn_set_src(buttonHomeAll, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonHomeAll, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeAll, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHomeX, event_handler, ID_H_X, "bmp_zeroX.bin", 0);
lv_imgbtn_set_src(buttonHomeX, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonHomeX, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeX, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_event_cb_mks(buttonContinue, event_handler,ID_S_CONTINUE,"bmp_Breakpoint.bin",0);
//lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_lable_pre);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_lable_rel);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHomeY, event_handler, ID_H_Y, "bmp_zeroY.bin", 0);
lv_imgbtn_set_src(buttonHomeY, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonHomeY, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeY, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHomeZ, event_handler, ID_H_Z, "bmp_zeroZ.bin", 0);
lv_imgbtn_set_src(buttonHomeZ, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonHomeZ, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOffAll, event_handler, ID_H_OFF_ALL, "bmp_manual_off.bin", 0);
lv_obj_set_event_cb_mks(buttonOffAll, event_handler,ID_H_OFF_ALL,"bmp_function1.bin",0);
lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOffAll, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOffXY, event_handler, ID_H_OFF_XY, "bmp_manual_off.bin", 0);
lv_obj_set_event_cb_mks(buttonOffXY, event_handler,ID_H_OFF_XY,"bmp_function1.bin",0);
lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOffXY, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_H_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler,ID_H_RETURN,"bmp_return.bin",0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
/*lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
lv_obj_set_pos(buttonFan,BTN_X_PIXEL+INTERVAL_V*2,titleHeight);
lv_obj_set_pos(buttonAbout,BTN_X_PIXEL*2+INTERVAL_V*3,titleHeight);
lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
lv_obj_set_pos(buMotorOff,INTERVAL_V, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonLanguage,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4, BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
//lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
/*lv_obj_set_pos(buttonWifi, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonFan, BTN_X_PIXEL+INTERVAL_V*2, titleHeight);
lv_obj_set_pos(buttonAbout, BTN_X_PIXEL*2+INTERVAL_V*3, titleHeight);
lv_obj_set_pos(buttonContinue, BTN_X_PIXEL*3+INTERVAL_V*4, titleHeight);
lv_obj_set_pos(buMotorOff, INTERVAL_V, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonLanguage, BTN_X_PIXEL+INTERVAL_V*2, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL*3+INTERVAL_V*4, BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
//lv_obj_set_pos(buttonWifi, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonHomeX, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonHomeY, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
//lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
@ -280,4 +267,4 @@ void lv_draw_home(void) {
void lv_clear_home() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,263 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if BOTH(HAS_TFT_LVGL_UI, HAS_CLASSIC_JERK)
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/planner.h"
static lv_obj_t * scr;
#define ID_JERK_RETURN 1
#define ID_JERK_X 2
#define ID_JERK_Y 3
#define ID_JERK_Z 4
#define ID_JERK_E 5
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_JERK_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_jerk_settings();
draw_return_ui();
}
break;
case ID_JERK_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = XJerk;
lv_clear_jerk_settings();
lv_draw_number_key();
}
break;
case ID_JERK_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = YJerk;
lv_clear_jerk_settings();
lv_draw_number_key();
}
break;
case ID_JERK_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = ZJerk;
lv_clear_jerk_settings();
lv_draw_number_key();
}
break;
case ID_JERK_E:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = EJerk;
lv_clear_jerk_settings();
lv_draw_number_key();
}
break;
}
}
void lv_draw_jerk_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *buttonEText = NULL, *labelEText = NULL, *buttonEValue = NULL, *labelEValue = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != JERK_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = JERK_UI;
}
disp_state = JERK_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.JerkConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
// LV_IMG_DECLARE(bmp_para_arrow);
LV_IMG_DECLARE(bmp_para_bank);
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_JERK_X, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_JERK_Y, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_JERK_Z, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonEText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonEText, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/
lv_obj_set_size(buttonEText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonEText, event_handler);
lv_btn_set_style(buttonEText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonEText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonEText, LV_LAYOUT_OFF);
labelEText = lv_label_create(buttonEText, NULL); /*Add a label to the button*/
buttonEValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonEValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonEValue, event_handler, ID_JERK_E, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonEValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonEValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonEValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonEValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonEValue, LV_LAYOUT_OFF);
labelEValue = lv_label_create(buttonEValue, NULL);
line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_JERK_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
lv_label_set_text(labelXValue, public_buf_l);
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[Y_AXIS]);
lv_label_set_text(labelYValue, public_buf_l);
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[Z_AXIS]);
lv_label_set_text(labelZValue, public_buf_l);
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.max_jerk[E_AXIS]);
lv_label_set_text(labelEValue, public_buf_l);
lv_obj_align(labelEValue, buttonEValue, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelXText, machine_menu.X_Jerk);
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelYText, machine_menu.Y_Jerk);
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelZText, machine_menu.Z_Jerk);
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelEText, machine_menu.E_Jerk);
lv_obj_align(labelEText, buttonEText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
}
}
void lv_clear_jerk_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI && HAS_CLASSIC_JERK

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_jerk_settings(void);
extern void lv_clear_jerk_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -35,17 +35,17 @@
//static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
#define ID_CN 1
#define ID_T_CN 2
#define ID_EN 3
#define ID_RU 4
#define ID_ES 5
#define ID_FR 6
#define ID_IT 7
#define ID_L_RETURN 8
#define ID_CN 1
#define ID_T_CN 2
#define ID_EN 3
#define ID_RU 4
#define ID_ES 5
#define ID_FR 6
#define ID_IT 7
#define ID_L_RETURN 8
#define SELECTED 1
#define UNSELECTED 0
#define SELECTED 1
#define UNSELECTED 0
static void disp_language(uint8_t language, uint8_t state);
@ -85,7 +85,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED);
lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_English_sel.bin", 0);
lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_english_sel.bin", 0);
gCfgItems.language = LANG_ENGLISH;
gCfg_to_spiFlah();
disp_language_init();
@ -97,7 +97,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED);
lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_Russian_sel.bin", 0);
lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_russian_sel.bin", 0);
gCfgItems.language = LANG_RUSSIAN;
gCfg_to_spiFlah();
disp_language_init();
@ -109,7 +109,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED);
lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_Spanish_sel.bin", 0);
lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_spanish_sel.bin", 0);
gCfgItems.language = LANG_SPANISH;
gCfg_to_spiFlah();
disp_language_init();
@ -121,7 +121,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED);
lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_French_sel.bin", 0);
lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_french_sel.bin", 0);
gCfgItems.language = LANG_FRENCH;
gCfg_to_spiFlah();
disp_language_init();
@ -133,7 +133,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
disp_language(gCfgItems.language, UNSELECTED);
lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_FR, "bmp_Italy_sel.bin", 0);
lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_FR, "bmp_italy_sel.bin", 0);
gCfgItems.language = LANG_ITALY;
gCfg_to_spiFlah();
disp_language_init();
@ -145,14 +145,14 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
buttonCN = NULL;
buttonCN = NULL;
buttonT_CN = NULL;
buttonEN = NULL;
buttonRU = NULL;
buttonES = NULL;
buttonFR = NULL;
buttonFR = NULL;
buttonIT = NULL;
buttonEN = NULL;
buttonRU = NULL;
buttonES = NULL;
buttonFR = NULL;
buttonFR = NULL;
buttonIT = NULL;
buttonBack = NULL;
lv_obj_del(scr);
@ -170,52 +170,51 @@ static void disp_language(uint8_t language, uint8_t state) {
public_buf_l[0] = '\0';
switch (language) {
case LANG_SIMPLE_CHINESE:
id = ID_CN;
strcat(public_buf_l, "bmp_Simple_cn");
strcpy_P(public_buf_l, PSTR("bmp_simplified_cn"));
obj = buttonCN;
break;
case LANG_COMPLEX_CHINESE:
id = ID_T_CN;
strcat(public_buf_l, "bmp_Tradition_cn");
strcpy_P(public_buf_l, PSTR("bmp_traditional_cn"));
obj = buttonT_CN;
break;
case LANG_ENGLISH:
id = ID_EN;
strcat(public_buf_l, "bmp_English");
strcpy_P(public_buf_l, PSTR("bmp_english"));
obj = buttonEN;
break;
case LANG_RUSSIAN:
id = ID_RU;
strcat(public_buf_l, "bmp_Russian");
strcpy_P(public_buf_l, PSTR("bmp_russian"));
obj = buttonRU;
break;
case LANG_SPANISH:
id = ID_ES;
strcat(public_buf_l, "bmp_Spanish");
strcpy_P(public_buf_l, PSTR("bmp_spanish"));
obj = buttonES;
break;
case LANG_FRENCH:
id = ID_FR;
strcat(public_buf_l, "bmp_French");
strcpy_P(public_buf_l, PSTR("bmp_french"));
obj = buttonFR;
break;
case LANG_ITALY:
id = ID_IT;
strcat(public_buf_l, "bmp_Italy");
strcpy_P(public_buf_l, PSTR("bmp_italy"));
obj = buttonIT;
break;
default:
id = ID_CN;
strcat(public_buf_l, "bmp_Simple_cn");
strcpy_P(public_buf_l, PSTR("bmp_simplified_cn"));
obj = buttonCN;
break;
}
if (state == SELECTED) strcat(public_buf_l, "_sel.bin");
else strcat(public_buf_l, ".bin");
if (state == SELECTED) strcat_P(public_buf_l, PSTR("_sel"));
strcat_P(public_buf_l, PSTR(".bin"));
lv_obj_set_event_cb_mks(obj, event_handler, id, public_buf_l, 0);
@ -232,14 +231,14 @@ void lv_draw_language(void) {
scr = lv_obj_create(NULL, NULL);
//static lv_style_t tool_style;
// static lv_style_t tool_style;
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -248,74 +247,73 @@ void lv_draw_language(void) {
LV_IMG_DECLARE(bmp_pic);
/*Create an Image button*/
buttonCN = lv_imgbtn_create(scr, NULL);
buttonCN = lv_imgbtn_create(scr, NULL);
buttonT_CN = lv_imgbtn_create(scr, NULL);
buttonEN = lv_imgbtn_create(scr, NULL);
buttonRU = lv_imgbtn_create(scr, NULL);
buttonES = lv_imgbtn_create(scr, NULL);
buttonFR = lv_imgbtn_create(scr, NULL);
buttonIT = lv_imgbtn_create(scr, NULL);
buttonEN = lv_imgbtn_create(scr, NULL);
buttonRU = lv_imgbtn_create(scr, NULL);
buttonES = lv_imgbtn_create(scr, NULL);
buttonFR = lv_imgbtn_create(scr, NULL);
buttonIT = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, "bmp_simplified_cn.bin", 0);
lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonCN, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, "bmp_traditional_cn.bin", 0);
lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonT_CN, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_English.bin", 0);
lv_obj_set_event_cb_mks(buttonEN, event_handler, ID_EN, "bmp_english.bin", 0);
lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonEN, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonEN, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_Russian.bin", 0);
lv_obj_set_event_cb_mks(buttonRU, event_handler, ID_RU, "bmp_russian.bin", 0);
lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonRU, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonRU, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_Spanish.bin", 0);
lv_obj_set_event_cb_mks(buttonES, event_handler, ID_ES, "bmp_spanish.bin", 0);
lv_imgbtn_set_src(buttonES, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonES, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonES, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonES, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonES, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonES, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_French.bin", 0);
lv_obj_set_event_cb_mks(buttonFR, event_handler, ID_FR, "bmp_french.bin", 0);
lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonFR, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFR, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_IT, "bmp_Italy.bin", 0);
lv_obj_set_event_cb_mks(buttonIT, event_handler, ID_IT, "bmp_italy.bin", 0);
lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonIT, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonIT, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_L_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_L_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
#endif
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif // if 1
lv_obj_set_pos(buttonCN, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonT_CN, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonEN, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonRU, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonES, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonES, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonFR, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonIT, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonIT, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonCN, LV_LAYOUT_OFF);
@ -327,13 +325,13 @@ void lv_draw_language(void) {
lv_btn_set_layout(buttonIT, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
lv_obj_t * label_CN = lv_label_create(buttonCN, NULL);
lv_obj_t * label_CN = lv_label_create(buttonCN, NULL);
lv_obj_t * label_T_CN = lv_label_create(buttonT_CN, NULL);
lv_obj_t * label_EN = lv_label_create(buttonEN, NULL);
lv_obj_t * label_RU = lv_label_create(buttonRU, NULL);
lv_obj_t * label_ES = lv_label_create(buttonES, NULL);
lv_obj_t * label_FR = lv_label_create(buttonFR, NULL);
lv_obj_t * label_IT = lv_label_create(buttonIT, NULL);
lv_obj_t * label_EN = lv_label_create(buttonEN, NULL);
lv_obj_t * label_RU = lv_label_create(buttonRU, NULL);
lv_obj_t * label_ES = lv_label_create(buttonES, NULL);
lv_obj_t * label_FR = lv_label_create(buttonFR, NULL);
lv_obj_t * label_IT = lv_label_create(buttonIT, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
disp_language(gCfgItems.language, SELECTED);
@ -367,4 +365,4 @@ void lv_draw_language(void) {
void lv_clear_language() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,232 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
static lv_obj_t * scr;
#define ID_PARA_RETURN 1
#define ID_PARA_MACHINE 2
#define ID_PARA_MACHINE_ARROW 3
#define ID_PARA_MOTOR 4
#define ID_PARA_MOTOR_ARROW 5
#define ID_PARA_ADVANCE 6
#define ID_PARA_ADVANCE_ARROW 7
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_PARA_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_para();
draw_return_ui();
}
break;
case ID_PARA_MACHINE:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_para();
lv_draw_machine_settings();
}
break;
case ID_PARA_MACHINE_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_para();
lv_draw_machine_settings();
}
break;
case ID_PARA_MOTOR:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_para();
lv_draw_motor_settings();
}
break;
case ID_PARA_MOTOR_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_para();
lv_draw_motor_settings();
}
break;
case ID_PARA_ADVANCE:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_para();
lv_draw_advance_settings();
}
break;
case ID_PARA_ADVANCE_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_para();
lv_draw_advance_settings();
}
break;
}
}
void lv_draw_machine_para(void) {
lv_obj_t *buttonBack, *label_Back;
lv_obj_t *buttonMachine, *labelMachine, *buttonMachineNarrow;
lv_obj_t *buttonMotor, *labelMotor, *buttonMotorNarrow;
lv_obj_t *buttonAdvance, *labelAdvance, *buttonAdvanceNarrow;
lv_obj_t * line1, * line2, * line3;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_PARA_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_PARA_UI;
}
disp_state = MACHINE_PARA_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
LV_IMG_DECLARE(bmp_para_arrow);
buttonMachine = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonMachine, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonMachine, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonMachine, event_handler, ID_PARA_MACHINE, NULL, 0);
lv_btn_set_style(buttonMachine, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonMachine, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonMachine, LV_LAYOUT_OFF);
labelMachine = lv_label_create(buttonMachine, NULL); /*Add a label to the button*/
buttonMachineNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonMachineNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonMachineNarrow, event_handler, ID_PARA_MACHINE_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonMachineNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonMachineNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMachineNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonMachineNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonMotor = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonMotor, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonMotor, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonMotor, event_handler, ID_PARA_MOTOR, NULL, 0);
lv_btn_set_style(buttonMotor, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonMotor, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonMotor, LV_LAYOUT_OFF);
labelMotor = lv_label_create(buttonMotor, NULL); /*Add a label to the button*/
buttonMotorNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonMotorNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonMotorNarrow, event_handler, ID_PARA_MOTOR_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonMotorNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonMotorNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMotorNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonMotorNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonAdvance = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonAdvance, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonAdvance, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonAdvance, event_handler, ID_PARA_ADVANCE, NULL, 0);
lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonAdvance, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonAdvance, LV_LAYOUT_OFF);
labelAdvance = lv_label_create(buttonAdvance, NULL); /*Add a label to the button*/
buttonAdvanceNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonAdvanceNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonAdvanceNarrow, event_handler, ID_PARA_ADVANCE_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonAdvanceNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonAdvanceNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAdvanceNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonAdvanceNarrow, LV_LAYOUT_OFF);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PARA_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelMachine, MachinePara_menu.MachineSetting);
lv_obj_align(labelMachine, buttonMachine, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelMotor, MachinePara_menu.MotorSetting);
lv_obj_align(labelMotor, buttonMotor, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelAdvance, MachinePara_menu.AdvanceSetting);
lv_obj_align(labelAdvance, buttonAdvance, LV_ALIGN_IN_LEFT_MID, 0, 0);
}
}
void lv_clear_machine_para() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_machine_para(void);
extern void lv_clear_machine_para();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -0,0 +1,241 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
static lv_obj_t * scr;
#define ID_MACHINE_RETURN 1
#define ID_MACHINE_ACCELERATION 2
#define ID_MACHINE_ACCELERATION_ARROW 3
#define ID_MACHINE_FEEDRATE 4
#define ID_MACHINE_FEEDRATE_ARROW 5
#define ID_MACHINE_JERK 6
#define ID_MACHINE_JERK_ARROW 7
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_MACHINE_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_settings();
draw_return_ui();
}
break;
case ID_MACHINE_ACCELERATION:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_settings();
lv_draw_acceleration_settings();
}
break;
case ID_MACHINE_ACCELERATION_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_settings();
lv_draw_acceleration_settings();
}
break;
case ID_MACHINE_FEEDRATE:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_settings();
lv_draw_max_feedrate_settings();
}
break;
case ID_MACHINE_FEEDRATE_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_settings();
lv_draw_max_feedrate_settings();
}
break;
#if HAS_CLASSIC_JERK
case ID_MACHINE_JERK:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_settings();
lv_draw_jerk_settings();
}
break;
case ID_MACHINE_JERK_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_machine_settings();
lv_draw_jerk_settings();
}
break;
#endif
}
}
void lv_draw_machine_settings(void) {
lv_obj_t *buttonBack, *label_Back;
lv_obj_t *buttonAcceleration, *labelAcceleration, *buttonAccelerationNarrow;
lv_obj_t *buttonMaxFeedrate, *labelMaxFeedrate, *buttonMaxFeedrateNarrow;
#if HAS_CLASSIC_JERK
lv_obj_t *buttonJerk, *labelJerk, *buttonJerkNarrow;
#endif
lv_obj_t * line1, * line2;
#if HAS_CLASSIC_JERK
lv_obj_t * line3;
#endif
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MACHINE_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MACHINE_SETTINGS_UI;
}
disp_state = MACHINE_SETTINGS_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.MachineConfigTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
LV_IMG_DECLARE(bmp_para_arrow);
buttonAcceleration = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonAcceleration, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonAcceleration, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonAcceleration, event_handler, ID_MACHINE_ACCELERATION, NULL, 0);
lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonAcceleration, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonAcceleration, LV_LAYOUT_OFF);
labelAcceleration = lv_label_create(buttonAcceleration, NULL); /*Add a label to the button*/
buttonAccelerationNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonAccelerationNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonAccelerationNarrow, event_handler, ID_MACHINE_ACCELERATION_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonAccelerationNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonAccelerationNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAccelerationNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonAccelerationNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line1, line_points[0]);
buttonMaxFeedrate = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonMaxFeedrate, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonMaxFeedrate, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonMaxFeedrate, event_handler, ID_MACHINE_FEEDRATE, NULL, 0);
lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonMaxFeedrate, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonMaxFeedrate, LV_LAYOUT_OFF);
labelMaxFeedrate = lv_label_create(buttonMaxFeedrate, NULL); /*Add a label to the button*/
buttonMaxFeedrateNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonMaxFeedrateNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonMaxFeedrateNarrow, event_handler, ID_MACHINE_FEEDRATE_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonMaxFeedrateNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonMaxFeedrateNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMaxFeedrateNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonMaxFeedrateNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line2, line_points[1]);
#if HAS_CLASSIC_JERK
buttonJerk = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonJerk, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonJerk, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMotor, event_handler);
lv_obj_set_event_cb_mks(buttonJerk, event_handler, ID_MACHINE_JERK, NULL, 0);
lv_btn_set_style(buttonJerk, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonJerk, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonJerk, LV_LAYOUT_OFF);
labelJerk = lv_label_create(buttonJerk, NULL); /*Add a label to the button*/
buttonJerkNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonJerkNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonJerkNarrow, event_handler, ID_MACHINE_JERK_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonJerkNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonJerkNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonJerkNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonJerkNarrow, LV_LAYOUT_OFF);
line3 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line3, line_points[2]);
#endif
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MACHINE_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelAcceleration, machine_menu.AccelerationConf);
lv_obj_align(labelAcceleration, buttonAcceleration, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelMaxFeedrate, machine_menu.MaxFeedRateConf);
lv_obj_align(labelMaxFeedrate, buttonMaxFeedrate, LV_ALIGN_IN_LEFT_MID, 0, 0);
#if HAS_CLASSIC_JERK
lv_label_set_text(labelJerk, machine_menu.JerkConf);
lv_obj_align(labelJerk, buttonJerk, LV_ALIGN_IN_LEFT_MID, 0, 0);
#endif
}
}
void lv_clear_machine_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_machine_settings(void);
extern void lv_clear_machine_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "lv_conf.h"
@ -35,13 +35,12 @@
//static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
static lv_obj_t * scr;
#define ID_M_POINT1 1
#define ID_M_POINT2 2
#define ID_M_POINT3 3
#define ID_M_POINT4 4
#define ID_M_POINT5 5
#define ID_MANUAL_RETURN 6
#define ID_M_POINT1 1
#define ID_M_POINT2 2
#define ID_M_POINT3 3
#define ID_M_POINT4 4
#define ID_M_POINT5 5
#define ID_MANUAL_RETURN 6
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
@ -53,16 +52,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
if (queue.length == 0) {
if (uiCfg.leveling_first_time) {
queue.enqueue_one_P(PSTR("G28"));
queue.enqueue_now_P(PSTR("G28"));
uiCfg.leveling_first_time = 0;
}
queue.enqueue_one_P(PSTR("G1 Z10"));
queue.enqueue_now_P(PSTR("G1 Z10"));
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "G1 X%d Y%d", X_MIN_POS + 30, Y_MIN_POS + 30);
queue.enqueue_one_P(PSTR(public_buf_l));
queue.enqueue_one_P(PSTR("G1 Z0"));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MIN_POS + 30, Y_MIN_POS + 30);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G1 Z0"));
}
}
break;
@ -73,16 +72,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (queue.length == 0) {
if (uiCfg.leveling_first_time) {
queue.enqueue_one_P(PSTR("G28"));
queue.enqueue_now_P(PSTR("G28"));
uiCfg.leveling_first_time = 0;
}
queue.enqueue_one_P(PSTR("G1 Z10"));
queue.enqueue_now_P(PSTR("G1 Z10"));
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "G1 X%d Y%d", X_MAX_POS - 30, Y_MIN_POS + 30);
queue.enqueue_one_P(PSTR(public_buf_l));
queue.enqueue_one_P(PSTR("G1 Z0"));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MAX_POS - 30, Y_MIN_POS + 30);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G1 Z0"));
}
}
break;
@ -93,16 +92,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (queue.length == 0) {
if (uiCfg.leveling_first_time) {
queue.enqueue_one_P(PSTR("G28"));
queue.enqueue_now_P(PSTR("G28"));
uiCfg.leveling_first_time = 0;
}
queue.enqueue_one_P(PSTR("G1 Z10"));
queue.enqueue_now_P(PSTR("G1 Z10"));
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "G1 X%d Y%d", X_MAX_POS - 30, Y_MAX_POS - 30);
queue.enqueue_one_P(PSTR(public_buf_l));
queue.enqueue_one_P(PSTR("G1 Z0"));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MAX_POS - 30, Y_MAX_POS - 30);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G1 Z0"));
}
}
@ -114,16 +113,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (queue.length == 0) {
if (uiCfg.leveling_first_time) {
queue.enqueue_one_P(PSTR("G28"));
queue.enqueue_now_P(PSTR("G28"));
uiCfg.leveling_first_time = 0;
}
queue.enqueue_one_P(PSTR("G1 Z10"));
queue.enqueue_now_P(PSTR("G1 Z10"));
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "G1 X%d Y%d", X_MIN_POS + 30, Y_MAX_POS - 30);
queue.enqueue_one_P(PSTR(public_buf_l));
queue.enqueue_one_P(PSTR("G1 Z0"));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_MIN_POS + 30, Y_MAX_POS - 30);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G1 Z0"));
}
}
break;
@ -134,16 +133,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (queue.length == 0) {
if (uiCfg.leveling_first_time) {
queue.enqueue_one_P(PSTR("G28"));
queue.enqueue_now_P(PSTR("G28"));
uiCfg.leveling_first_time = 0;
}
queue.enqueue_one_P(PSTR("G1 Z10"));
queue.enqueue_now_P(PSTR("G1 Z10"));
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "G1 X%d Y%d", X_BED_SIZE / 2, Y_BED_SIZE / 2);
queue.enqueue_one_P(PSTR(public_buf_l));
queue.enqueue_one_P(PSTR("G1 Z0"));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("G1 X%d Y%d"), X_BED_SIZE / 2, Y_BED_SIZE / 2);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G1 Z0"));
}
}
@ -157,7 +156,6 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
lv_draw_tool();
}
break;
}
}
@ -174,14 +172,14 @@ void lv_draw_manualLevel(void) {
scr = lv_obj_create(NULL, NULL);
//static lv_style_t tool_style;
// static lv_style_t tool_style;
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -195,52 +193,52 @@ void lv_draw_manualLevel(void) {
buttonPoint3 = lv_imgbtn_create(scr, NULL);
buttonPoint4 = lv_imgbtn_create(scr, NULL);
buttonPoint5 = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPoint1, event_handler, ID_M_POINT1, "bmp_Leveling1.bin", 0);
lv_obj_set_event_cb_mks(buttonPoint1, event_handler, ID_M_POINT1, "bmp_leveling1.bin", 0);
lv_imgbtn_set_src(buttonPoint1, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPoint1, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint1, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonPoint1, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonPoint2, event_handler, ID_M_POINT2, "bmp_Leveling2.bin", 0);
lv_obj_set_event_cb_mks(buttonPoint2, event_handler, ID_M_POINT2, "bmp_leveling2.bin", 0);
lv_imgbtn_set_src(buttonPoint2, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPoint2, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint2, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonPoint3, event_handler, ID_M_POINT3, "bmp_Leveling3.bin", 0);
lv_obj_set_event_cb_mks(buttonPoint3, event_handler, ID_M_POINT3, "bmp_leveling3.bin", 0);
lv_imgbtn_set_src(buttonPoint3, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPoint3, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint3, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonPoint4, event_handler, ID_M_POINT4, "bmp_Leveling4.bin", 0);
lv_obj_set_event_cb_mks(buttonPoint4, event_handler, ID_M_POINT4, "bmp_leveling4.bin", 0);
lv_imgbtn_set_src(buttonPoint4, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPoint4, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint4, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonPoint5, event_handler, ID_M_POINT5, "bmp_Leveling5.bin", 0);
lv_obj_set_event_cb_mks(buttonPoint5, event_handler, ID_M_POINT5, "bmp_leveling5.bin", 0);
lv_imgbtn_set_src(buttonPoint5, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPoint5, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPoint5, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MANUAL_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonPoint1, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonPoint2, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonPoint3, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonPoint4, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonPoint5, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonPoint5, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonPoint1, LV_LAYOUT_OFF);
@ -255,8 +253,7 @@ void lv_draw_manualLevel(void) {
lv_obj_t * label_Point3 = lv_label_create(buttonPoint3, NULL);
lv_obj_t * label_Point4 = lv_label_create(buttonPoint4, NULL);
lv_obj_t * label_Point5 = lv_label_create(buttonPoint5, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_Point1, leveling_menu.position1);
@ -281,4 +278,4 @@ void lv_draw_manualLevel(void) {
void lv_clear_manualLevel() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,359 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/planner.h"
static lv_obj_t * scr;
#define ID_FEED_RETURN 1
#define ID_FEED_X 2
#define ID_FEED_Y 3
#define ID_FEED_Z 4
#define ID_FEED_E0 5
#define ID_FEED_E1 6
#define ID_FEED_DOWN 7
#define ID_FEED_UP 8
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_FEED_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_max_feedrate_settings();
draw_return_ui();
}
break;
case ID_FEED_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = XMaxFeedRate;
lv_clear_max_feedrate_settings();
lv_draw_number_key();
}
break;
case ID_FEED_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = YMaxFeedRate;
lv_clear_max_feedrate_settings();
lv_draw_number_key();
}
break;
case ID_FEED_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = ZMaxFeedRate;
lv_clear_max_feedrate_settings();
lv_draw_number_key();
}
break;
case ID_FEED_E0:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E0MaxFeedRate;
lv_clear_max_feedrate_settings();
lv_draw_number_key();
}
break;
case ID_FEED_E1:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E1MaxFeedRate;
lv_clear_max_feedrate_settings();
lv_draw_number_key();
}
break;
case ID_FEED_UP:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_max_feedrate_settings();
lv_draw_max_feedrate_settings();
}
break;
case ID_FEED_DOWN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 1;
lv_clear_max_feedrate_settings();
lv_draw_max_feedrate_settings();
}
break;
}
}
void lv_draw_max_feedrate_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MAXFEEDRATE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MAXFEEDRATE_UI;
}
disp_state = MAXFEEDRATE_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.MaxFeedRateConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
// LV_IMG_DECLARE(bmp_para_arrow);
LV_IMG_DECLARE(bmp_para_bank);
if (uiCfg.para_ui_page != 1) {
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_FEED_X, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_FEED_Y, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_FEED_Z, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/
lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE0Text, event_handler);
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
labelE0Text = lv_label_create(buttonE0Text, NULL); /*Add a label to the button*/
buttonE0Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_FEED_E0, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
labelE0Value = lv_label_create(buttonE0Value, NULL);
line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_DOWN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
}
else {
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE1Text, event_handler);
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
labelE1Text = lv_label_create(buttonE1Text, NULL); /*Add a label to the button*/
buttonE1Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_FEED_E1, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
labelE1Value = lv_label_create(buttonE1Value, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_FEED_UP, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
}
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
labelTurnPage = lv_label_create(buttonTurnPage, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_FEED_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.para_ui_page != 1) {
lv_label_set_text(labelXText, machine_menu.XMaxFeedRate);
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelYText, machine_menu.YMaxFeedRate);
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelZText, machine_menu.ZMaxFeedRate);
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelE0Text, machine_menu.E0MaxFeedRate);
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.next);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);
lv_label_set_text(labelXValue, public_buf_l);
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]);
lv_label_set_text(labelYValue, public_buf_l);
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]);
lv_label_set_text(labelZValue, public_buf_l);
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]);
lv_label_set_text(labelE0Value, public_buf_l);
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
}
else {
lv_label_set_text(labelE1Text, machine_menu.E1MaxFeedRate);
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.previous);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]);
lv_label_set_text(labelE1Value, public_buf_l);
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
}
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
}
}
void lv_clear_max_feedrate_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_max_feedrate_settings(void);
extern void lv_clear_max_feedrate_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -0,0 +1,247 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
static lv_obj_t * scr;
#define ID_MOTOR_RETURN 1
#define ID_MOTOR_STEPS 2
#define ID_MOTOR_STEPS_ARROW 3
#define ID_MOTOR_TMC_CURRENT 4
#define ID_MOTOR_TMC_CURRENT_ARROW 5
#define ID_MOTOR_STEP_MODE 6
#define ID_MOTOR_STEP_MODE_ARROW 7
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_MOTOR_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_motor_settings();
draw_return_ui();
}
break;
case ID_MOTOR_STEPS:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_motor_settings();
lv_draw_step_settings();
}
break;
case ID_MOTOR_STEPS_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_motor_settings();
lv_draw_step_settings();
}
break;
#if HAS_TRINAMIC_CONFIG
case ID_MOTOR_TMC_CURRENT:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_motor_settings();
lv_draw_tmc_current_settings();
}
break;
case ID_MOTOR_TMC_CURRENT_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_motor_settings();
lv_draw_tmc_current_settings();
}
break;
#if HAS_STEALTHCHOP
case ID_MOTOR_STEP_MODE:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_motor_settings();
lv_draw_tmc_step_mode_settings();
}
break;
case ID_MOTOR_STEP_MODE_ARROW:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_motor_settings();
lv_draw_tmc_step_mode_settings();
}
break;
#endif
#endif
}
}
void lv_draw_motor_settings(void) {
lv_obj_t *buttonBack, *label_Back;
lv_obj_t *buttonSteps, *labelSteps, *buttonStepsNarrow;
#if HAS_TRINAMIC_CONFIG
lv_obj_t *buttonTMCcurrent, *labelTMCcurrent, *buttonTMCcurrentNarrow;
lv_obj_t * line2;
#if HAS_STEALTHCHOP
lv_obj_t *buttonStepMode, *labelStepMode, *buttonStepModeNarrow;
lv_obj_t * line3;
#endif
#endif
lv_obj_t * line1;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOTOR_SETTINGS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = MOTOR_SETTINGS_UI;
}
disp_state = MOTOR_SETTINGS_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.MotorConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
LV_IMG_DECLARE(bmp_para_arrow);
buttonSteps = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonSteps, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonSteps, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonSteps, event_handler, ID_MOTOR_STEPS, NULL, 0);
lv_btn_set_style(buttonSteps, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonSteps, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonSteps, LV_LAYOUT_OFF);
labelSteps = lv_label_create(buttonSteps, NULL); /*Add a label to the button*/
buttonStepsNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonStepsNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonStepsNarrow, event_handler, ID_MOTOR_STEPS_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonStepsNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonStepsNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStepsNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonStepsNarrow, LV_LAYOUT_OFF);
line1 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line1, line_points[0]);
#if HAS_TRINAMIC_CONFIG
buttonTMCcurrent = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonTMCcurrent, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonTMCcurrent, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonTMCcurrent, event_handler, ID_MOTOR_TMC_CURRENT, NULL, 0);
lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonTMCcurrent, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonTMCcurrent, LV_LAYOUT_OFF);
labelTMCcurrent = lv_label_create(buttonTMCcurrent, NULL); /*Add a label to the button*/
buttonTMCcurrentNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonTMCcurrentNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 2 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonTMCcurrentNarrow, event_handler, ID_MOTOR_TMC_CURRENT_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonTMCcurrentNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonTMCcurrentNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTMCcurrentNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonTMCcurrentNarrow, LV_LAYOUT_OFF);
line2 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line2, line_points[1]);
#if HAS_STEALTHCHOP
buttonStepMode = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonStepMode, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonStepMode, PARA_UI_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
// lv_obj_set_event_cb(buttonMachine, event_handler);
lv_obj_set_event_cb_mks(buttonStepMode, event_handler, ID_MOTOR_STEP_MODE, NULL, 0);
lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonStepMode, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonStepMode, LV_LAYOUT_OFF);
labelStepMode = lv_label_create(buttonStepMode, NULL); /*Add a label to the button*/
buttonStepModeNarrow = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonStepModeNarrow, PARA_UI_POS_X + PARA_UI_SIZE_X, PARA_UI_POS_Y * 3 + PARA_UI_ARROW_V);
lv_obj_set_event_cb_mks(buttonStepModeNarrow, event_handler, ID_MOTOR_STEP_MODE_ARROW, "bmp_arrow.bin", 0);
lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_REL, &bmp_para_arrow);
lv_imgbtn_set_src(buttonStepModeNarrow, LV_BTN_STATE_PR, &bmp_para_arrow);
lv_imgbtn_set_style(buttonStepModeNarrow, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStepModeNarrow, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonStepModeNarrow, LV_LAYOUT_OFF);
line3 = lv_line_create(lv_scr_act(), NULL);
lv_ex_line(line3, line_points[2]);
#endif
#endif // HAS_TRINAMIC_CONFIG
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_MOTOR_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelSteps, machine_menu.StepsConf);
lv_obj_align(labelSteps, buttonSteps, LV_ALIGN_IN_LEFT_MID, 0, 0);
#if HAS_TRINAMIC_CONFIG
lv_label_set_text(labelTMCcurrent, machine_menu.TMCcurrentConf);
lv_obj_align(labelTMCcurrent, buttonTMCcurrent, LV_ALIGN_IN_LEFT_MID, 0, 0);
#if HAS_STEALTHCHOP
lv_label_set_text(labelStepMode, machine_menu.TMCStepModeConf);
lv_obj_align(labelStepMode, buttonStepMode, LV_ALIGN_IN_LEFT_MID, 0, 0);
#endif
#endif
}
}
void lv_clear_motor_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_motor_settings(void);
extern void lv_clear_motor_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "lv_conf.h"
@ -53,10 +53,10 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (queue.length <= (BUFSIZE - 3)) {
memset(public_buf_l, 0, sizeof(public_buf_l));
ZERO(public_buf_l);
queue.enqueue_one_P(PSTR("G91"));
sprintf(public_buf_l, "G1 X%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_P(PSTR(public_buf_l));
sprintf_P(public_buf_l, PSTR("G1 X%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_one_P(PSTR("G90"));
}
}
@ -67,11 +67,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (queue.length <= (BUFSIZE - 3)) {
memset(public_buf_l, 0, sizeof(public_buf_l));
queue.enqueue_one_now(PSTR("G91"));
sprintf(public_buf_l, "G1 X-%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
queue.enqueue_one_now(PSTR("G90"));
ZERO(public_buf_l);
queue.enqueue_now_P(PSTR("G91"));
sprintf_P(public_buf_l, PSTR("G1 X-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G90"));
}
}
break;
@ -81,11 +81,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (queue.length <= (BUFSIZE - 3)) {
memset(public_buf_l, 0, sizeof(public_buf_l));
queue.enqueue_one_now(PSTR("G91"));
sprintf(public_buf_l, "G1 Y%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
queue.enqueue_one_now(PSTR("G90"));
ZERO(public_buf_l);
queue.enqueue_now_P(PSTR("G91"));
sprintf_P(public_buf_l, PSTR("G1 Y%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G90"));
}
}
break;
@ -95,11 +95,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (queue.length <= (BUFSIZE - 3)) {
memset(public_buf_l, 0, sizeof(public_buf_l));
queue.enqueue_one_now(PSTR("G91"));
sprintf(public_buf_l, "G1 Y-%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
queue.enqueue_one_now(PSTR("G90"));
ZERO(public_buf_l);
queue.enqueue_now_P(PSTR("G91"));
sprintf_P(public_buf_l, PSTR("G1 Y-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G90"));
}
}
break;
@ -109,11 +109,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (queue.length <= (BUFSIZE - 3)) {
memset(public_buf_l, 0, sizeof(public_buf_l));
queue.enqueue_one_now(PSTR("G91"));
sprintf(public_buf_l, "G1 Z%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
queue.enqueue_one_now(PSTR("G90"));
ZERO(public_buf_l);
queue.enqueue_now_P(PSTR("G91"));
sprintf_P(public_buf_l, PSTR("G1 Z%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G90"));
}
}
break;
@ -123,11 +123,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (queue.length <= (BUFSIZE - 3)) {
memset(public_buf_l, 0, sizeof(public_buf_l));
queue.enqueue_one_now(PSTR("G91"));
sprintf(public_buf_l, "G1 Z-%3.1f F%d", uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(PSTR(public_buf_l));
queue.enqueue_one_now(PSTR("G90"));
ZERO(public_buf_l);
queue.enqueue_now_P(PSTR("G91"));
sprintf_P(public_buf_l, PSTR("G1 Z-%3.1f F%d"), uiCfg.move_dist, uiCfg.moveSpeed);
queue.enqueue_one_now(public_buf_l);
queue.enqueue_now_P(PSTR("G90"));
}
}
break;
@ -154,14 +154,11 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
draw_return_ui();
}
break;
}
}
void lv_draw_move_motor(void) {
lv_obj_t *buttonXI, *buttonXD, *buttonYI, *buttonYD;
lv_obj_t *buttonZI, *buttonZD, *buttonBack;
lv_obj_t *buttonXI, *buttonXD, *buttonYI, *buttonYD, *buttonZI, *buttonZD, *buttonBack;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != MOVE_MOTOR_UI) {
disp_state_stack._disp_index++;
@ -176,7 +173,7 @@ void lv_draw_move_motor(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -184,74 +181,73 @@ void lv_draw_move_motor(void) {
LV_IMG_DECLARE(bmp_pic);
/*Create an Image button*/
buttonXI = lv_imgbtn_create(scr, NULL);
buttonXD = lv_imgbtn_create(scr, NULL);
buttonYI = lv_imgbtn_create(scr, NULL);
buttonYD = lv_imgbtn_create(scr, NULL);
buttonZI = lv_imgbtn_create(scr, NULL);
buttonZD = lv_imgbtn_create(scr, NULL);
buttonV = lv_imgbtn_create(scr, NULL);
buttonXI = lv_imgbtn_create(scr, NULL);
buttonXD = lv_imgbtn_create(scr, NULL);
buttonYI = lv_imgbtn_create(scr, NULL);
buttonYD = lv_imgbtn_create(scr, NULL);
buttonZI = lv_imgbtn_create(scr, NULL);
buttonZD = lv_imgbtn_create(scr, NULL);
buttonV = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonXI, event_handler, ID_M_X_P, "bmp_xAdd.bin", 0);
lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonXI, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonXI, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonXD, event_handler, ID_M_X_N, "bmp_xDec.bin", 0);
lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonXD, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXD, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonYI, event_handler, ID_M_Y_P, "bmp_yAdd.bin", 0);
lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonYI, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonYD, event_handler, ID_M_Y_N, "bmp_yDec.bin", 0);
lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonYD, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYD, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonZI, event_handler, ID_M_Z_P, "bmp_zAdd.bin", 0);
lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonZI, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZI, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonZD, event_handler, ID_M_Z_N, "bmp_zDec.bin", 0);
lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonZD, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZD, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0);
// lv_obj_set_event_cb_mks(buttonV, event_handler,ID_T_MORE,"bmp_More.bin",0);
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonV, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonV, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_M_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_M_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
#endif
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif // if 1
lv_obj_set_pos(buttonXI, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonYI, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonZI, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonV, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonXD, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonXD, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonYD, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonZD, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonZD, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonXI, LV_LAYOUT_OFF);
@ -272,7 +268,6 @@ void lv_draw_move_motor(void) {
labelV = lv_label_create(buttonV, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(labelXI, move_menu.x_add);
lv_obj_align(labelXI, buttonXI, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@ -300,14 +295,14 @@ void lv_draw_move_motor(void) {
}
void disp_move_dist() {
//char buf[30] = {0};
// char buf[30] = {0};
if ((int)(10 * uiCfg.move_dist) == 1)
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_Step_move0_1.bin", 0);
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_step_move0_1.bin", 0);
else if ((int)(10 * uiCfg.move_dist) == 10)
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_Step_move1.bin", 0);
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_step_move1.bin", 0);
else if ((int)(10 * uiCfg.move_dist) == 100)
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_Step_move10.bin", 0);
lv_obj_set_event_cb_mks(buttonV, event_handler, ID_M_STEP, "bmp_step_move10.bin", 0);
if (gCfgItems.multiple_language != 0) {
if ((int)(10 * uiCfg.move_dist) == 1) {
lv_label_set_text(labelV, move_menu.step_01mm);
@ -326,4 +321,4 @@ void disp_move_dist() {
void lv_clear_move_motor() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,799 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
//#include "../../lvgl/src/lv_objx/lv_imgbtn.h"
//#include "../../lvgl/src/lv_objx/lv_img.h"
//#include "../../lvgl/src/lv_core/lv_disp.h"
//#include "../../lvgl/src/lv_core/lv_refr.h"
//#include "../../MarlinCore.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/temperature.h"
#include "../../../../gcode/queue.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../../../feature/powerloss.h"
#endif
#include "../../../../gcode/gcode.h"
#include "../../../../module/planner.h"
#if HAS_TRINAMIC_CONFIG
#include "../../../../module/stepper/indirection.h"
#include "../../../../feature/tmc_util.h"
#endif
static lv_obj_t * scr;
static lv_obj_t *buttonValue = NULL;
static lv_obj_t *labelValue = NULL;
static char key_value[11] = {0};
static uint8_t cnt = 0;
static char point_flg = 1;
#define ID_NUM_KEY1 1
#define ID_NUM_KEY2 2
#define ID_NUM_KEY3 3
#define ID_NUM_KEY4 4
#define ID_NUM_KEY5 5
#define ID_NUM_KEY6 6
#define ID_NUM_KEY7 7
#define ID_NUM_KEY8 8
#define ID_NUM_KEY9 9
#define ID_NUM_KEY0 10
#define ID_NUM_BACK 11
#define ID_NUM_RESET 12
#define ID_NUM_CONFIRM 13
#define ID_NUM_POINT 14
#define ID_NUM_NAGETIVE 15
static void disp_key_value() {
char *temp;
#if HAS_TRINAMIC_CONFIG
float milliamps;
#endif
switch (value) {
case PrintAcceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.acceleration);
break;
case RetractAcceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.retract_acceleration);
break;
case TravelAcceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.travel_acceleration);
break;
case XAcceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[X_AXIS]);
break;
case YAcceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
break;
case ZAcceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[Z_AXIS]);
break;
case E0Acceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS]);
break;
case E1Acceleration:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%d"), (int)planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)]);
break;
case XMaxFeedRate:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[X_AXIS]);
break;
case YMaxFeedRate:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Y_AXIS]);
break;
case ZMaxFeedRate:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[Z_AXIS]);
break;
case E0MaxFeedRate:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS]);
break;
case E1MaxFeedRate:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.max_feedrate_mm_s[E_AXIS_N(1)]);
break;
case XJerk:
#if HAS_CLASSIC_JERK
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[X_AXIS]);
#endif
break;
case YJerk:
#if HAS_CLASSIC_JERK
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Y_AXIS]);
#endif
break;
case ZJerk:
#if HAS_CLASSIC_JERK
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[Z_AXIS]);
#endif
break;
case EJerk:
#if HAS_CLASSIC_JERK
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.max_jerk[E_AXIS]);
#endif
break;
case Xstep:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);
break;
case Ystep:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]);
break;
case Zstep:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]);
break;
case E0step:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]);
break;
case E1step:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]);
break;
case Xcurrent:
#if AXIS_IS_TMC(X)
ZERO(public_buf_m);
milliamps = stepperX.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
#endif
break;
case Ycurrent:
#if AXIS_IS_TMC(Y)
ZERO(public_buf_m);
milliamps = stepperY.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
#endif
break;
case Zcurrent:
#if AXIS_IS_TMC(Z)
ZERO(public_buf_m);
milliamps = stepperZ.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
#endif
break;
case E0current:
#if AXIS_IS_TMC(E0)
ZERO(public_buf_m);
milliamps = stepperE0.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
#endif
break;
case E1current:
#if AXIS_IS_TMC(E1)
ZERO(public_buf_m);
milliamps = stepperE1.getMilliamps();
sprintf_P(public_buf_m, PSTR("%.1f"), milliamps);
#endif
break;
case pause_pos_x:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosX);
break;
case pause_pos_y:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosY);
break;
case pause_pos_z:
ZERO(public_buf_m);
sprintf_P(public_buf_m, PSTR("%.1f"), gCfgItems.pausePosZ);
break;
}
ZERO(key_value);
strcpy(key_value, public_buf_m);
cnt = strlen(key_value);
temp = strchr(key_value, '.');
if (temp)
point_flg = 0;
else
point_flg = 1;
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
}
static void set_value_confirm() {
#if HAS_TRINAMIC_CONFIG
uint16_t current_mA;
#endif
switch (value) {
case PrintAcceleration:
planner.settings.acceleration = atof(key_value);
break;
case RetractAcceleration:
planner.settings.retract_acceleration = atof(key_value);
break;
case TravelAcceleration:
planner.settings.travel_acceleration = atof(key_value);
break;
case XAcceleration:
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = atof(key_value);
break;
case YAcceleration:
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = atof(key_value);
break;
case ZAcceleration:
planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = atof(key_value);
break;
case E0Acceleration:
planner.settings.max_acceleration_mm_per_s2[E_AXIS] = atof(key_value);
break;
case E1Acceleration:
planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(1)] = atof(key_value);
break;
case XMaxFeedRate:
planner.settings.max_feedrate_mm_s[X_AXIS] = atof(key_value);
break;
case YMaxFeedRate:
planner.settings.max_feedrate_mm_s[Y_AXIS] = atof(key_value);
break;
case ZMaxFeedRate:
planner.settings.max_feedrate_mm_s[Z_AXIS] = atof(key_value);
break;
case E0MaxFeedRate:
planner.settings.max_feedrate_mm_s[E_AXIS] = atof(key_value);
break;
case E1MaxFeedRate:
planner.settings.max_feedrate_mm_s[E_AXIS_N(1)] = atof(key_value);
break;
case XJerk:
#if HAS_CLASSIC_JERK
planner.max_jerk[X_AXIS] = atof(key_value);
#endif
break;
case YJerk:
#if HAS_CLASSIC_JERK
planner.max_jerk[Y_AXIS] = atof(key_value);
#endif
break;
case ZJerk:
#if HAS_CLASSIC_JERK
planner.max_jerk[Z_AXIS] = atof(key_value);
#endif
break;
case EJerk:
#if HAS_CLASSIC_JERK
planner.max_jerk[E_AXIS] = atof(key_value);
#endif
break;
case Xstep:
planner.settings.axis_steps_per_mm[X_AXIS] = atof(key_value);
break;
case Ystep:
planner.settings.axis_steps_per_mm[Y_AXIS] = atof(key_value);
break;
case Zstep:
planner.settings.axis_steps_per_mm[Z_AXIS] = atof(key_value);
break;
case E0step:
planner.settings.axis_steps_per_mm[E_AXIS] = atof(key_value);
break;
case E1step:
planner.settings.axis_steps_per_mm[E_AXIS_N(1)] = atof(key_value);
break;
case Xcurrent:
#if AXIS_IS_TMC(X)
current_mA = atoi(key_value);
stepperX.rms_current(current_mA);
#endif
break;
case Ycurrent:
#if AXIS_IS_TMC(Y)
current_mA = atoi(key_value);
stepperY.rms_current(current_mA);
#endif
break;
case Zcurrent:
#if AXIS_IS_TMC(Z)
current_mA = atoi(key_value);
stepperZ.rms_current(current_mA);
#endif
break;
case E0current:
#if AXIS_IS_TMC(E0)
current_mA = atoi(key_value);
stepperE0.rms_current(current_mA);
#endif
break;
case E1current:
#if AXIS_IS_TMC(E1)
current_mA = atoi(key_value);
stepperE1.rms_current(current_mA);
#endif
break;
break;
case pause_pos_x:
gCfgItems.pausePosX = atof(key_value);
update_spi_flash();
break;
case pause_pos_y:
gCfgItems.pausePosY = atof(key_value);
update_spi_flash();
break;
case pause_pos_z:
gCfgItems.pausePosZ = atof(key_value);
update_spi_flash();
break;
}
gcode.process_subcommands_now_P(PSTR("M500"));
}
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_NUM_KEY1:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'1';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY2:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'2';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY3:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'3';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY4:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'4';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY5:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'5';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY6:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'6';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY7:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'7';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY8:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'8';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY9:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'9';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_KEY0:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt <= 10) {
key_value[cnt] = (char)'0';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_BACK:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt > 0)
cnt--;
if (key_value[cnt] == (char)'.') point_flg = 1;
key_value[cnt] = (char)'\0';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
}
break;
case ID_NUM_RESET:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
ZERO(key_value);
cnt = 0;
key_value[cnt] = (char)'0';
point_flg = 1;
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
}
break;
case ID_NUM_POINT:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if ((cnt != 0) && (point_flg == 1)) {
point_flg = 0;
key_value[cnt] = (char)'.';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_NAGETIVE:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (cnt == 0) {
key_value[cnt] = (char)'-';
lv_label_set_text(labelValue, key_value);
lv_obj_align(labelValue, buttonValue, LV_ALIGN_CENTER, 0, 0);
cnt++;
}
}
break;
case ID_NUM_CONFIRM:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
last_disp_state = NUMBER_KEY_UI;
if (strlen(key_value) != 0)
set_value_confirm();
lv_clear_number_key();
draw_return_ui();
}
break;
}
}
void lv_draw_number_key(void) {
lv_obj_t *NumberKey_1 = NULL, *NumberKey_2 = NULL, *NumberKey_3 = NULL, *NumberKey_4 = NULL, *NumberKey_5 = NULL;
lv_obj_t *NumberKey_6 = NULL, *NumberKey_7 = NULL, *NumberKey_8 = NULL, *NumberKey_9 = NULL, *NumberKey_0 = NULL;
lv_obj_t *KeyPoint = NULL, *KeyConfirm = NULL, *KeyReset = NULL, *KeyBack = NULL;
lv_obj_t *Minus = NULL;
lv_obj_t *labelKey_1 = NULL, *labelKey_2 = NULL, *labelKey_3 = NULL, *labelKey_4 = NULL, *labelKey_5 = NULL;
lv_obj_t *labelKey_6 = NULL, *labelKey_7 = NULL, *labelKey_8 = NULL, *labelKey_9 = NULL, *labelKey_0 = NULL;
lv_obj_t *labelKeyPoint = NULL, *labelKeyConfirm = NULL, *labelKeyReset = NULL, *labelKeyBack = NULL;
lv_obj_t *labelMinus = NULL;
buttonValue = NULL;
labelValue = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != NUMBER_KEY_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = NUMBER_KEY_UI;
}
disp_state = NUMBER_KEY_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
//lv_obj_t * title = lv_label_create(scr, NULL);
//lv_obj_set_style(title, &tft_style_label_rel);
//lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
//lv_label_set_text(title, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
//LV_IMG_DECLARE(bmp_pic);
buttonValue = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonValue, 92, 40); /*Set its position*/
lv_obj_set_size(buttonValue, 296, 40);
lv_obj_set_event_cb_mks(buttonValue, event_handler, ID_NUM_KEY1, NULL, 0);
lv_btn_set_style(buttonValue, LV_BTN_STYLE_REL, &style_num_text); /*Set the button's released style*/
lv_btn_set_style(buttonValue, LV_BTN_STYLE_PR, &style_num_text); /*Set the button's pressed style*/
lv_btn_set_layout(buttonValue, LV_LAYOUT_OFF);
labelValue = lv_label_create(buttonValue, NULL); /*Add a label to the button*/
NumberKey_1 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_1, 92, 90); /*Set its position*/
lv_obj_set_size(NumberKey_1, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_1, event_handler, ID_NUM_KEY1, NULL, 0);
lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_1, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_1, LV_LAYOUT_OFF);
labelKey_1 = lv_label_create(NumberKey_1, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_1, machine_menu.key_1);
lv_obj_align(labelKey_1, NumberKey_1, LV_ALIGN_CENTER, 0, 0);
NumberKey_2 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_2, 168, 90); /*Set its position*/
lv_obj_set_size(NumberKey_2, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_2, event_handler, ID_NUM_KEY2, NULL, 0);
lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_2, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_2, LV_LAYOUT_OFF);
labelKey_2 = lv_label_create(NumberKey_2, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_2, machine_menu.key_2);
lv_obj_align(labelKey_2, NumberKey_2, LV_ALIGN_CENTER, 0, 0);
NumberKey_3 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_3, 244, 90); /*Set its position*/
lv_obj_set_size(NumberKey_3, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_3, event_handler, ID_NUM_KEY3, NULL, 0);
lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_3, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_3, LV_LAYOUT_OFF);
labelKey_3 = lv_label_create(NumberKey_3, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_3, machine_menu.key_3);
lv_obj_align(labelKey_3, NumberKey_3, LV_ALIGN_CENTER, 0, 0);
NumberKey_4 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_4, 92, 140); /*Set its position*/
lv_obj_set_size(NumberKey_4, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_4, event_handler, ID_NUM_KEY4, NULL, 0);
lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_4, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_4, LV_LAYOUT_OFF);
labelKey_4 = lv_label_create(NumberKey_4, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_4, machine_menu.key_4);
lv_obj_align(labelKey_4, NumberKey_4, LV_ALIGN_CENTER, 0, 0);
NumberKey_5 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_5, 168, 140); /*Set its position*/
lv_obj_set_size(NumberKey_5, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_5, event_handler, ID_NUM_KEY5, NULL, 0);
lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_5, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_5, LV_LAYOUT_OFF);
labelKey_5 = lv_label_create(NumberKey_5, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_5, machine_menu.key_5);
lv_obj_align(labelKey_5, NumberKey_5, LV_ALIGN_CENTER, 0, 0);
NumberKey_6 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_6, 244, 140); /*Set its position*/
lv_obj_set_size(NumberKey_6, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_6, event_handler, ID_NUM_KEY6, NULL, 0);
lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_6, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_6, LV_LAYOUT_OFF);
labelKey_6 = lv_label_create(NumberKey_6, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_6, machine_menu.key_6);
lv_obj_align(labelKey_6, NumberKey_6, LV_ALIGN_CENTER, 0, 0);
NumberKey_7 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_7, 92, 190); /*Set its position*/
lv_obj_set_size(NumberKey_7, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_7, event_handler, ID_NUM_KEY7, NULL, 0);
lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_7, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_7, LV_LAYOUT_OFF);
labelKey_7 = lv_label_create(NumberKey_7, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_7, machine_menu.key_7);
lv_obj_align(labelKey_7, NumberKey_7, LV_ALIGN_CENTER, 0, 0);
NumberKey_8 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_8, 168, 190); /*Set its position*/
lv_obj_set_size(NumberKey_8, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_8, event_handler, ID_NUM_KEY8, NULL, 0);
lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_8, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_8, LV_LAYOUT_OFF);
labelKey_8 = lv_label_create(NumberKey_8, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_8, machine_menu.key_8);
lv_obj_align(labelKey_8, NumberKey_8, LV_ALIGN_CENTER, 0, 0);
NumberKey_9 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_9, 244, 190); /*Set its position*/
lv_obj_set_size(NumberKey_9, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_9, event_handler, ID_NUM_KEY9, NULL, 0);
lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_9, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_9, LV_LAYOUT_OFF);
labelKey_9 = lv_label_create(NumberKey_9, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_9, machine_menu.key_9);
lv_obj_align(labelKey_9, NumberKey_9, LV_ALIGN_CENTER, 0, 0);
NumberKey_0 = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(NumberKey_0, 92, 240); /*Set its position*/
lv_obj_set_size(NumberKey_0, 68, 40);
lv_obj_set_event_cb_mks(NumberKey_0, event_handler, ID_NUM_KEY0, NULL, 0);
lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(NumberKey_0, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(NumberKey_0, LV_LAYOUT_OFF);
labelKey_0 = lv_label_create(NumberKey_0, NULL); /*Add a label to the button*/
lv_label_set_text(labelKey_0, machine_menu.key_0);
lv_obj_align(labelKey_0, NumberKey_0, LV_ALIGN_CENTER, 0, 0);
KeyBack = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(KeyBack, 320, 90); /*Set its position*/
lv_obj_set_size(KeyBack, 68, 40);
lv_obj_set_event_cb_mks(KeyBack, event_handler, ID_NUM_BACK, NULL, 0);
lv_btn_set_style(KeyBack, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyBack, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(KeyBack, LV_LAYOUT_OFF);
labelKeyBack = lv_label_create(KeyBack, NULL); /*Add a label to the button*/
lv_label_set_text(labelKeyBack, machine_menu.key_back);
lv_obj_align(labelKeyBack, KeyBack, LV_ALIGN_CENTER, 0, 0);
KeyReset = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(KeyReset, 320, 140); /*Set its position*/
lv_obj_set_size(KeyReset, 68, 40);
lv_obj_set_event_cb_mks(KeyReset, event_handler, ID_NUM_RESET, NULL, 0);
lv_btn_set_style(KeyReset, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyReset, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(KeyReset, LV_LAYOUT_OFF);
labelKeyReset = lv_label_create(KeyReset, NULL); /*Add a label to the button*/
lv_label_set_text(labelKeyReset, machine_menu.key_reset);
lv_obj_align(labelKeyReset, KeyReset, LV_ALIGN_CENTER, 0, 0);
KeyConfirm = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(KeyConfirm, 320, 190); /*Set its position*/
lv_obj_set_size(KeyConfirm, 68, 90);
lv_obj_set_event_cb_mks(KeyConfirm, event_handler, ID_NUM_CONFIRM, NULL, 0);
lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyConfirm, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(KeyConfirm, LV_LAYOUT_OFF);
labelKeyConfirm = lv_label_create(KeyConfirm, NULL); /*Add a label to the button*/
lv_label_set_text(labelKeyConfirm, machine_menu.key_confirm);
lv_obj_align(labelKeyConfirm, KeyConfirm, LV_ALIGN_CENTER, 0, 0);
KeyPoint = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(KeyPoint, 244, 240); /*Set its position*/
lv_obj_set_size(KeyPoint, 68, 40);
lv_obj_set_event_cb_mks(KeyPoint, event_handler, ID_NUM_POINT, NULL, 0);
lv_btn_set_style(KeyPoint, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(KeyPoint, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(KeyPoint, LV_LAYOUT_OFF);
labelKeyPoint = lv_label_create(KeyPoint, NULL); /*Add a label to the button*/
lv_label_set_text(labelKeyPoint, machine_menu.key_point);
lv_obj_align(labelKeyPoint, KeyPoint, LV_ALIGN_CENTER, 0, 0);
Minus = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(Minus, 168, 240); /*Set its position*/
lv_obj_set_size(Minus, 68, 40);
lv_obj_set_event_cb_mks(Minus, event_handler, ID_NUM_NAGETIVE, NULL, 0);
lv_btn_set_style(Minus, LV_BTN_STYLE_REL, &style_num_key_pre); /*Set the button's released style*/
lv_btn_set_style(Minus, LV_BTN_STYLE_PR, &style_num_key_rel); /*Set the button's pressed style*/
lv_btn_set_layout(Minus, LV_LAYOUT_OFF);
labelMinus = lv_label_create(Minus, NULL); /*Add a label to the button*/
lv_label_set_text(labelMinus, machine_menu.negative);
lv_obj_align(labelMinus, Minus, LV_ALIGN_CENTER, 0, 0);
disp_key_value();
}
void lv_clear_number_key() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_number_key(void);
extern void lv_clear_number_key();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -53,7 +53,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_opration();
lv_clear_operation();
lv_draw_preHeat();
}
break;
@ -62,7 +62,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_opration();
lv_clear_operation();
lv_draw_extrusion();
}
break;
@ -71,7 +71,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_opration();
lv_clear_operation();
lv_draw_move_motor();
}
break;
@ -87,7 +87,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_opration();
lv_clear_operation();
lv_draw_fan();
}
break;
@ -96,7 +96,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_opration();
lv_clear_operation();
lv_draw_change_speed();
}
break;
@ -116,7 +116,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (gCfgItems.finish_power_off == 1) {
gCfgItems.finish_power_off = 0;
lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_manual_off.bin", 0); //dindt find bmp_Mamual...
lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_manual_off.bin", 0); // didn't find bmp_Mamual...
lv_label_set_text(label_PowerOff, printing_more_menu.manual);
lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
lv_obj_refresh_ext_draw_pad(label_PowerOff);
@ -136,7 +136,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
}
void lv_draw_opration(void) {
void lv_draw_operation(void) {
lv_obj_t *buttonPreHeat, *buttonExtrusion, *buttonSpeed;
lv_obj_t *buttonBack, *buttonFan;
lv_obj_t *labelPreHeat, *labelExtrusion;
@ -156,7 +156,7 @@ void lv_draw_opration(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -165,57 +165,59 @@ void lv_draw_opration(void) {
LV_IMG_DECLARE(bmp_pic);
/*Create an Image button*/
buttonPreHeat = lv_imgbtn_create(scr, NULL);
buttonPreHeat = lv_imgbtn_create(scr, NULL);
buttonExtrusion = lv_imgbtn_create(scr, NULL);
buttonFan = lv_imgbtn_create(scr, NULL);
buttonSpeed = lv_imgbtn_create(scr, NULL);
buttonFan = lv_imgbtn_create(scr, NULL);
buttonSpeed = lv_imgbtn_create(scr, NULL);
if (uiCfg.print_state != WORKING)
if (uiCfg.print_state != WORKING) {
//buttonFilament = lv_imgbtn_create(scr, NULL);
//else
//} else {
buttonMove = lv_imgbtn_create(scr, NULL);
buttonPowerOff = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
}
lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_O_PRE_HEAT, "bmp_PreHeat.bin", 0);
buttonPowerOff = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_O_PRE_HEAT, "bmp_temp.bin", 0);
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonPreHeat, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_O_EXTRUCT, "bmp_Extruct.bin", 0);
lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_O_EXTRUCT, "bmp_extrude_opr.bin", 0);
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_O_FAN, "bmp_Fan.bin", 0);
lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_O_FAN, "bmp_fan.bin", 0);
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_O_SPEED, "bmp_Speed.bin", 0);
lv_obj_set_event_cb_mks(buttonSpeed, event_handler, ID_O_SPEED, "bmp_speed.bin", 0);
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonSpeed, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonSpeed, LV_BTN_STATE_REL, &tft_style_label_rel);
if (uiCfg.print_state != WORKING) {
/*{
lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_O_FILAMENT,"bmp_Filamentchange.bin",0);
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_lable_rel);
}
else*/
lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_O_MOV, "bmp_Mov.bin", 0);
/*
lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_O_FILAMENT,"bmp_Filamentchange.bin",0);
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel);
} else {
*/
lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_O_MOV, "bmp_move_opr.bin", 0);
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_label_rel);
}
if (gCfgItems.finish_power_off == 1)
lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_auto_off.bin", 0);
@ -223,15 +225,15 @@ void lv_draw_opration(void) {
lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_manual_off.bin", 0);
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPowerOff, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_O_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_O_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
#endif
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif // if 1
lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonExtrusion, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
@ -240,17 +242,17 @@ void lv_draw_opration(void) {
lv_obj_set_pos(buttonSpeed, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
if (uiCfg.print_state != WORKING) {
/*{
lv_obj_set_pos(buttonFilament,INTERVAL_V,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
}
else*/
/*
lv_obj_set_pos(buttonFilament,INTERVAL_V,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
} else {
*/
lv_obj_set_pos(buttonMove, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonPowerOff, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
}
else {
lv_obj_set_pos(buttonPowerOff, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
}
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF);
@ -258,27 +260,29 @@ void lv_draw_opration(void) {
lv_btn_set_layout(buttonFan, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonSpeed, LV_LAYOUT_OFF);
if (uiCfg.print_state != WORKING)
/*{
lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
}
else*/
if (uiCfg.print_state != WORKING) {
/*
lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
} else {
*/
lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF);
}
lv_btn_set_layout(buttonPowerOff, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
labelPreHeat = lv_label_create(buttonPreHeat, NULL);
labelPreHeat = lv_label_create(buttonPreHeat, NULL);
labelExtrusion = lv_label_create(buttonExtrusion, NULL);
label_Fan = lv_label_create(buttonFan, NULL);
label_Fan = lv_label_create(buttonFan, NULL);
label_Speed = lv_label_create(buttonSpeed, NULL);
if (uiCfg.print_state != WORKING)
/*{
label_Filament = lv_label_create(buttonFilament, NULL);
if (uiCfg.print_state != WORKING) {
/*
label_Filament = lv_label_create(buttonFilament, NULL);
} else {
*/
label_Move = lv_label_create(buttonMove, NULL);
}
else*/
label_Move = lv_label_create(buttonMove, NULL);
label_PowerOff = lv_label_create(buttonPowerOff, NULL);
label_Back = lv_label_create(buttonBack, NULL);
@ -297,11 +301,11 @@ void lv_draw_opration(void) {
lv_obj_align(label_Speed, buttonSpeed, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
if (uiCfg.print_state != WORKING) {
/*{
lv_label_set_text(label_Filament, operation_menu.filament);
lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
}
else*/
/*
lv_label_set_text(label_Filament, operation_menu.filament);
lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
} else {
*/
lv_label_set_text(label_Move, operation_menu.move);
lv_obj_align(label_Move, buttonMove, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
@ -317,6 +321,6 @@ void lv_draw_opration(void) {
}
}
void lv_clear_opration() { lv_obj_del(scr); }
void lv_clear_operation() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -25,8 +25,8 @@
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_opration(void);
extern void lv_clear_opration();
extern void lv_draw_operation(void);
extern void lv_clear_operation();
//extern void disp_temp_ready_print();
#ifdef __cplusplus

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if BOTH(TFT_LVGL_UI, ADVANCED_PAUSE_FEATURE)
#if BOTH(HAS_TFT_LVGL_UI, ADVANCED_PAUSE_FEATURE)
#include "draw_ui.h"
#include "lv_conf.h"
@ -52,4 +52,4 @@ void lv_draw_pause_message(const PauseMessage msg) {
}
}
#endif // TFT_LVGL_UI && ADVANCED_PAUSE_FEATURE
#endif // HAS_TFT_LVGL_UI && ADVANCED_PAUSE_FEATURE

View file

@ -0,0 +1,222 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/planner.h"
static lv_obj_t * scr;
#define ID_PAUSE_RETURN 1
#define ID_PAUSE_X 2
#define ID_PAUSE_Y 3
#define ID_PAUSE_Z 4
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_PAUSE_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_clear_pause_position();
draw_return_ui();
}
break;
case ID_PAUSE_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = pause_pos_x;
lv_clear_pause_position();
lv_draw_number_key();
}
break;
case ID_PAUSE_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = pause_pos_y;
lv_clear_pause_position();
lv_draw_number_key();
}
break;
case ID_PAUSE_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = pause_pos_z;
lv_clear_pause_position();
lv_draw_number_key();
}
break;
}
}
void lv_draw_pause_position(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != PAUSE_POS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = PAUSE_POS_UI;
}
disp_state = PAUSE_POS_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.PausePosText);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
// LV_IMG_DECLARE(bmp_para_arrow);
LV_IMG_DECLARE(bmp_para_bank);
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_PAUSE_X, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_PAUSE_Y, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_PAUSE_Z, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_PAUSE_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosX);
lv_label_set_text(labelXValue, public_buf_l);
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosY);
lv_label_set_text(labelYValue, public_buf_l);
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), gCfgItems.pausePosZ);
lv_label_set_text(labelZValue, public_buf_l);
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelXText, machine_menu.xPos);
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelYText, machine_menu.yPos);
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelZText, machine_menu.zPos);
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
}
}
void lv_clear_pause_position() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_pause_position(void);
extern void lv_clear_pause_position();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -58,29 +58,24 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
if (uiCfg.curSprayerChoose == 0) {
if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_0_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
}
}
#if !defined(SINGLENOZZLE) && EXTRUDERS >= 2
else if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
}
else if ((int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target > (HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1))) {
thermalManager.temp_hotend[uiCfg.curSprayerChoose].target = (float)HEATER_1_MAXTEMP - (WATCH_TEMP_INCREASE + TEMP_HYSTERESIS + 1);
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
}
#endif
}
#if HAS_HEATED_BED
else {
thermalManager.temp_bed.target += uiCfg.stepHeat;
if ((int)thermalManager.temp_bed.target > BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) {
thermalManager.temp_bed.target = (float)BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
thermalManager.start_watching_bed();
else {
thermalManager.temp_bed.target += uiCfg.stepHeat;
if ((int)thermalManager.temp_bed.target > BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1)) {
thermalManager.temp_bed.target = (float)BED_MAXTEMP - (WATCH_BED_TEMP_INCREASE + TEMP_BED_HYSTERESIS + 1);
thermalManager.start_watching_bed();
}
}
}
#endif
disp_desire_temp();
}
@ -101,16 +96,16 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
}
#if HAS_HEATED_BED
else {
if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat) {
thermalManager.temp_bed.target -= uiCfg.stepHeat;
thermalManager.start_watching_bed();
}
else {
thermalManager.temp_bed.target = (float)0;
thermalManager.start_watching_bed();
if ((int)thermalManager.temp_bed.target > uiCfg.stepHeat) {
thermalManager.temp_bed.target -= uiCfg.stepHeat;
thermalManager.start_watching_bed();
}
else {
thermalManager.temp_bed.target = (float)0;
thermalManager.start_watching_bed();
}
}
}
#endif
disp_desire_temp();
}
@ -131,12 +126,12 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
uiCfg.curTempType = 1;
}
else {
uiCfg.curTempType = 0;
uiCfg.curTempType = 0;
uiCfg.curSprayerChoose = 0;
}
}
}
else if (uiCfg.curSprayerChoose == 0) {
else if (uiCfg.curSprayerChoose == 0) {
if (TEMP_SENSOR_BED != 0)
uiCfg.curTempType = 1;
else
@ -145,7 +140,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (uiCfg.curTempType == 1) {
uiCfg.curSprayerChoose = 0;
uiCfg.curTempType = 0;
uiCfg.curTempType = 0;
}
disp_temp_type();
}
@ -174,10 +169,10 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
thermalManager.start_watching_hotend(uiCfg.curSprayerChoose);
}
#if HAS_HEATED_BED
else {
thermalManager.temp_bed.target = (float)0;
thermalManager.start_watching_bed();
}
else {
thermalManager.temp_bed.target = (float)0;
thermalManager.start_watching_bed();
}
#endif
disp_desire_temp();
}
@ -211,7 +206,7 @@ void lv_draw_preHeat(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -220,57 +215,57 @@ void lv_draw_preHeat(void) {
LV_IMG_DECLARE(bmp_pic);
/*Create an Image button*/
buttonAdd = lv_imgbtn_create(scr, NULL);
buttonDec = lv_imgbtn_create(scr, NULL);
buttoType = lv_imgbtn_create(scr, NULL);
buttonAdd = lv_imgbtn_create(scr, NULL);
buttonDec = lv_imgbtn_create(scr, NULL);
buttoType = lv_imgbtn_create(scr, NULL);
buttonStep = lv_imgbtn_create(scr, NULL);
buttonOff = lv_imgbtn_create(scr, NULL);
buttonOff = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonAdd, event_handler, ID_P_ADD, "bmp_Add.bin", 0);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonAdd, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAdd, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonAdd, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonDec, event_handler, ID_P_DEC, "bmp_Dec.bin", 0);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonDec, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonDec, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttoType, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttoType, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonStep, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStep, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_P_OFF, "bmp_Speed0.bin", 0);
lv_obj_set_event_cb_mks(buttonOff, event_handler, ID_P_OFF, "bmp_speed0.bin", 0);
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonOff, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOff, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonAdd, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonDec, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttoType, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonStep, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonOff, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonOff, BTN_X_PIXEL * 2 + INTERVAL_V * 3, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonAdd, LV_LAYOUT_OFF);
@ -284,7 +279,7 @@ void lv_draw_preHeat(void) {
lv_obj_t * labelDec = lv_label_create(buttonDec, NULL);
labelType = lv_label_create(buttoType, NULL);
labelStep = lv_label_create(buttonStep, NULL);
lv_obj_t * labelOff = lv_label_create(buttonOff, NULL);
lv_obj_t * labelOff = lv_label_create(buttonOff, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
@ -306,7 +301,7 @@ void lv_draw_preHeat(void) {
disp_step_heat();
tempText1 = lv_label_create(scr, NULL);
lv_obj_set_style(tempText1, &tft_style_lable_rel);
lv_obj_set_style(tempText1, &tft_style_label_rel);
disp_desire_temp();
}
@ -314,14 +309,14 @@ void disp_temp_type() {
if (uiCfg.curTempType == 0) {
if (uiCfg.curSprayerChoose == 1) {
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Extru2.bin", 0);
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_extru2.bin", 0);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(labelType, preheat_menu.ext2);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
}
else {
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Extru1.bin", 0);
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_extru1.bin", 0);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(labelType, preheat_menu.ext1);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@ -330,7 +325,7 @@ void disp_temp_type() {
}
else {
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_Bed.bin", 0);
lv_obj_set_event_cb_mks(buttoType, event_handler, ID_P_TYPE, "bmp_bed.bin", 0);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(labelType, preheat_menu.hotbed);
lv_obj_align(labelType, buttoType, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@ -352,12 +347,12 @@ void disp_desire_temp() {
sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].celsius, (int)thermalManager.temp_hotend[uiCfg.curSprayerChoose].target);
}
#if HAS_HEATED_BED
else {
strcat(public_buf_l, preheat_menu.hotbed);
sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target);
}
else {
strcat(public_buf_l, preheat_menu.hotbed);
sprintf(buf, preheat_menu.value_state, (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target);
}
#endif
strcat(public_buf_l, ": ");
strcat_P(public_buf_l, PSTR(": "));
strcat(public_buf_l, buf);
lv_label_set_text(tempText1, public_buf_l);
lv_obj_align(tempText1, NULL, LV_ALIGN_CENTER, 0, -50);
@ -365,11 +360,11 @@ void disp_desire_temp() {
void disp_step_heat() {
if (uiCfg.stepHeat == 1)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step1_degree.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_step1_degree.bin", 0);
else if (uiCfg.stepHeat == 5)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step5_degree.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_step5_degree.bin", 0);
else if (uiCfg.stepHeat == 10)
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_Step10_degree.bin", 0);
lv_obj_set_event_cb_mks(buttonStep, event_handler, ID_P_STEP, "bmp_step10_degree.bin", 0);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.stepHeat == 1) {
@ -389,4 +384,4 @@ void disp_step_heat() {
void lv_clear_preHeat() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "lv_conf.h"
@ -34,9 +34,8 @@
static lv_obj_t * scr;
static lv_obj_t *buttonPageUp, *buttonPageDown, *buttonBack, *buttonGcode[FILE_BTN_CNT];
static lv_obj_t * labelPageUp[FILE_BTN_CNT];
static lv_obj_t *buttonText[FILE_BTN_CNT];
static lv_obj_t *buttonPageUp, *buttonPageDown, *buttonBack,
*buttonGcode[FILE_BTN_CNT], *labelPageUp[FILE_BTN_CNT], *buttonText[FILE_BTN_CNT];
#define ID_P_UP 7
#define ID_P_DOWN 8
@ -53,64 +52,62 @@ uint8_t sel_id = 0;
#if ENABLED(SDSUPPORT)
static uint8_t search_file() {
int valid_name_cnt = 0;
//char tmp[SHORT_NEME_LEN*MAX_DIR_LEVEL+1];
static uint8_t search_file() {
int valid_name_cnt = 0;
//char tmp[SHORT_NEME_LEN*MAX_DIR_LEVEL+1];
list_file.Sd_file_cnt = 0;
//list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
list_file.Sd_file_cnt = 0;
//list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
//root2.rewind();
//SERIAL_ECHOLN(list_file.curDirPath);
//root2.rewind();
//SERIAL_ECHOLN(list_file.curDirPath);
if (curDirLever != 0) card.cd(list_file.curDirPath);
else card.cdroot(); //while(card.cdup());
if (curDirLever != 0) card.cd(list_file.curDirPath);
else card.cdroot(); // while(card.cdup());
const uint16_t fileCnt = card.get_num_Files();
const uint16_t fileCnt = card.get_num_Files();
for (uint16_t i = 0; i < fileCnt; i++) {
if (list_file.Sd_file_cnt == list_file.Sd_file_offset) {
const uint16_t nr = SD_ORDER(i, fileCnt);
card.getfilename_sorted(nr);
for (uint16_t i = 0; i < fileCnt; i++) {
if (list_file.Sd_file_cnt == list_file.Sd_file_offset) {
const uint16_t nr = SD_ORDER(i, fileCnt);
card.getfilename_sorted(nr);
if (card.flag.filenameIsDir)
/*
SERIAL_ECHOLN(card.longest_filename);
*/
list_file.IsFolder[valid_name_cnt] = 1;
else
//SERIAL_ECHOLN(card.longFilename);
list_file.IsFolder[valid_name_cnt] = 0;
#if 1
//
memset(list_file.file_name[valid_name_cnt], 0, strlen(list_file.file_name[valid_name_cnt]));
strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath);
strcat(list_file.file_name[valid_name_cnt], "/");
strcat(list_file.file_name[valid_name_cnt], card.filename);
//
memset(list_file.long_name[valid_name_cnt], 0, strlen(list_file.long_name[valid_name_cnt]));
if (card.longFilename[0] == 0)
strncpy(list_file.long_name[valid_name_cnt], card.filename, strlen(card.filename));
if (card.flag.filenameIsDir)
//SERIAL_ECHOLN(card.longest_filename);
list_file.IsFolder[valid_name_cnt] = 1;
else
strncpy(list_file.long_name[valid_name_cnt], card.longFilename, strlen(card.longFilename));
//SERIAL_ECHOLN(card.longFilename);
list_file.IsFolder[valid_name_cnt] = 0;
valid_name_cnt++;
if (valid_name_cnt == 1)
dir_offset[curDirLever].cur_page_first_offset = list_file.Sd_file_offset;
if (valid_name_cnt >= FILE_NUM) {
dir_offset[curDirLever].cur_page_last_offset = list_file.Sd_file_offset;
#if 1
//
memset(list_file.file_name[valid_name_cnt], 0, strlen(list_file.file_name[valid_name_cnt]));
strcpy(list_file.file_name[valid_name_cnt], list_file.curDirPath);
strcat_P(list_file.file_name[valid_name_cnt], PSTR("/"));
strcat(list_file.file_name[valid_name_cnt], card.filename);
//
memset(list_file.long_name[valid_name_cnt], 0, strlen(list_file.long_name[valid_name_cnt]));
if (card.longFilename[0] == 0)
strncpy(list_file.long_name[valid_name_cnt], card.filename, strlen(card.filename));
else
strncpy(list_file.long_name[valid_name_cnt], card.longFilename, strlen(card.longFilename));
valid_name_cnt++;
if (valid_name_cnt == 1)
dir_offset[curDirLever].cur_page_first_offset = list_file.Sd_file_offset;
if (valid_name_cnt >= FILE_NUM) {
dir_offset[curDirLever].cur_page_last_offset = list_file.Sd_file_offset;
list_file.Sd_file_offset++;
break;
}
list_file.Sd_file_offset++;
break;
}
list_file.Sd_file_offset++;
#endif
#endif
}
list_file.Sd_file_cnt++;
}
list_file.Sd_file_cnt++;
//card.closefile(false);
return valid_name_cnt;
}
//card.closefile(false);
return valid_name_cnt;
}
#endif // SDSUPPORT
@ -147,7 +144,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (dir_offset[curDirLever].curPage > 0) {
//2015.05.19
// 2015.05.19
list_file.Sd_file_cnt = 0;
if (dir_offset[curDirLever].cur_page_first_offset >= FILE_NUM)
@ -169,7 +166,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
else if (event == LV_EVENT_RELEASED) {
if (dir_offset[curDirLever].cur_page_last_offset > 0) {
list_file.Sd_file_cnt = 0;
list_file.Sd_file_cnt = 0;
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_last_offset + 1;
#if ENABLED(SDSUPPORT)
file_count = search_file();
@ -195,9 +192,9 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
#if ENABLED(SDSUPPORT)
card.cdup();
#endif
dir_offset[curDirLever].curPage = 0;
dir_offset[curDirLever].curPage = 0;
dir_offset[curDirLever].cur_page_first_offset = 0;
dir_offset[curDirLever].cur_page_last_offset = 0;
dir_offset[curDirLever].cur_page_last_offset = 0;
curDirLever--;
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
#if ENABLED(SDSUPPORT)
@ -221,7 +218,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (list_file.file_name[i][0] != 0) {
if (list_file.IsFolder[i] == 1) {
memset(list_file.curDirPath, 0, sizeof(list_file.curDirPath));
ZERO(list_file.curDirPath);
strcpy(list_file.curDirPath, list_file.file_name[i]);
curDirLever++;
list_file.Sd_file_offset = dir_offset[curDirLever].cur_page_first_offset;
@ -253,11 +250,11 @@ void lv_draw_print_file(void) {
}
disp_state = PRINT_FILE_UI;
curDirLever = 0;
curDirLever = 0;
dir_offset[curDirLever].curPage = 0;
list_file.Sd_file_offset = 0;
list_file.Sd_file_cnt = 0;
list_file.Sd_file_cnt = 0;
ZERO(dir_offset);
ZERO(list_file.IsFolder);
@ -300,35 +297,35 @@ void disp_gcode_icon(uint8_t file_num) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
lv_refr_now(lv_refr_get_disp_refreshing());
buttonPageUp = lv_imgbtn_create(scr, NULL);
buttonPageUp = lv_imgbtn_create(scr, NULL);
buttonPageDown = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPageUp, event_handler, ID_P_UP, "bmp_pageUp.bin", 0);
lv_imgbtn_set_src(buttonPageUp, LV_BTN_STATE_REL, &bmp_pic_117x92);
lv_imgbtn_set_src(buttonPageUp, LV_BTN_STATE_PR, &bmp_pic_117x92);
lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPageUp, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonPageUp, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonPageDown, event_handler, ID_P_DOWN, "bmp_pageDown.bin", 0);
lv_imgbtn_set_src(buttonPageDown, LV_BTN_STATE_REL, &bmp_pic_117x92);
lv_imgbtn_set_src(buttonPageDown, LV_BTN_STATE_PR, &bmp_pic_117x92);
lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_back.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic_117x92);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic_117x92);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonPageUp, OTHER_BTN_XPIEL * 3 + INTERVAL_V * 4, titleHeight);
@ -343,7 +340,7 @@ void disp_gcode_icon(uint8_t file_num) {
for (i = 0; i < FILE_BTN_CNT; i++) {
/*
if(seq) {
if (seq) {
j = (FILE_BTN_CNT-1) - i;
back_flg = 1;
}
@ -357,8 +354,8 @@ void disp_gcode_icon(uint8_t file_num) {
#ifdef TFT35
buttonGcode[i] = lv_imgbtn_create(scr, NULL);
lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonGcode[i], LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonGcode[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonGcode[i], LV_LAYOUT_OFF);
@ -366,7 +363,7 @@ void disp_gcode_icon(uint8_t file_num) {
cutFileName((char *)list_file.long_name[i], 16, 8, (char *)public_buf_m);
if (list_file.IsFolder[i] == 1) {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_Dir.bin", 0);
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_dir.bin", 0);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, &bmp_pic);
if (i < 3)
@ -375,7 +372,7 @@ void disp_gcode_icon(uint8_t file_num) {
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
labelPageUp[i] = lv_label_create(buttonGcode[i], NULL);
lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
lv_label_set_text(labelPageUp[i], public_buf_m);
lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
}
@ -389,10 +386,10 @@ void disp_gcode_icon(uint8_t file_num) {
buttonText[i] = lv_btn_create(scr, NULL);
//lv_obj_set_event_cb(buttonText[i], event_handler);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
//lv_obj_set_style(buttonText[i], &tft_style_lable_pre);
//lv_obj_set_style(buttonText[i], &tft_style_lable_rel);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_label_pre);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_style(buttonText[i], &tft_style_label_pre);
//lv_obj_set_style(buttonText[i], &tft_style_label_rel);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0);
@ -406,10 +403,10 @@ void disp_gcode_icon(uint8_t file_num) {
buttonText[i] = lv_btn_create(scr, NULL);
//lv_obj_set_event_cb(buttonText[i], event_handler);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_PR, &tft_style_label_pre);
lv_btn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_imgbtn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_lable_rel);
//lv_imgbtn_set_style(buttonText[i], LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonText[i], LV_PROTECT_FOLLOW);
lv_btn_set_layout(buttonText[i], LV_LAYOUT_OFF);
//lv_obj_set_event_cb_mks(buttonText[i], event_handler,(i+10),NULL,0);
@ -419,12 +416,12 @@ void disp_gcode_icon(uint8_t file_num) {
lv_obj_set_size(buttonText[i], 100, 40);
}
labelPageUp[i] = lv_label_create(buttonText[i], NULL);
lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
lv_label_set_text(labelPageUp[i], public_buf_m);
lv_obj_align(labelPageUp[i], buttonText[i], LV_ALIGN_IN_BOTTOM_MID, 0, 0);
}
else {
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_File.bin", 0);
lv_obj_set_event_cb_mks(buttonGcode[i], event_handler, (i + 1), "bmp_file.bin", 0);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonGcode[i], LV_BTN_STATE_PR, &bmp_pic);
if (i < 3)
@ -433,27 +430,38 @@ void disp_gcode_icon(uint8_t file_num) {
lv_obj_set_pos(buttonGcode[i], BTN_X_PIXEL * (i - 3) + INTERVAL_V * ((i - 3) + 1), BTN_Y_PIXEL + INTERVAL_H + titleHeight);
labelPageUp[i] = lv_label_create(buttonGcode[i], NULL);
lv_obj_set_style(labelPageUp[i], &tft_style_lable_rel);
lv_obj_set_style(labelPageUp[i], &tft_style_label_rel);
lv_label_set_text(labelPageUp[i], public_buf_m);
lv_obj_align(labelPageUp[i], buttonGcode[i], LV_ALIGN_IN_BOTTOM_MID, 0, -5);
}
}
#else // ifdef TFT35
#endif // ifdef TFT35
#else // !TFT35
#endif // !TFT35
}
}
void lv_open_gcode_file(char *path) {
#if ENABLED(SDSUPPORT)
uint32_t *ps4;
int pre_sread_cnt;
char *cur_name;
cur_name = strrchr(path, '/');
card.openFileRead(cur_name);
#endif
card.read(public_buf, 512);
ps4 = (uint32_t *)strstr((char *)public_buf, ";simage:");
// Ignore the beginning message of gcode file
if (ps4) {
pre_sread_cnt = (uint32_t)ps4 - (uint32_t)((uint32_t *)(&public_buf[0]));
card.setIndex(pre_sread_cnt);
}
#endif // SDSUPPORT
}
int ascii2dec_test(char *ascii) {
int result = 0;
if (ascii == 0) return 0;
if (*(ascii) >= '0' && *(ascii) <= '9')
@ -468,64 +476,58 @@ int ascii2dec_test(char *ascii) {
return result;
}
void lv_gcode_file_read(uint8_t *data_buf)
{
#if ENABLED (SDSUPPORT)
uint16_t i=0,j=0,k=0;
uint16_t row_1=0;
void lv_gcode_file_read(uint8_t *data_buf) {
#if ENABLED(SDSUPPORT)
uint16_t i = 0, j = 0, k = 0;
uint16_t row_1 = 0;
bool ignore_start = true;
char temp_test[200];
volatile uint16_t *p_index;
memset(public_buf, 0, 200);
while(card.isFileOpen())
{
if (ignore_start) card.read(temp_test, 8); //line start -> ignore
card.read(temp_test, 200); //data
//\r;;gimage: we got the bit img, so stop here
while (card.isFileOpen()) {
if (ignore_start) card.read(temp_test, 8); // line start -> ignore
card.read(temp_test, 200); // data
// \r;;gimage: we got the bit img, so stop here
if (temp_test[1] == ';') {
card.closefile();
break;
}
for(i=0;i<200;) {
public_buf[row_1*200+100*k+j] = (char)(ascii2dec_test(&temp_test[i])<<4|ascii2dec_test(&temp_test[i+1]));
for (i = 0; i < 200;) {
public_buf[row_1 * 200 + 100 * k + j] = (char)(ascii2dec_test(&temp_test[i]) << 4 | ascii2dec_test(&temp_test[i + 1]));
j++;
i+=2;
i += 2;
}
uint16_t c = card.get();
//check if we have more data or finished the line (CR)
if (c == '\r') {
break;
}
// check if we have more data or finished the line (CR)
if (c == '\r') break;
card.setIndex(card.getIndex());
k++;
j=0;
j = 0;
ignore_start = false;
}
#if ENABLED(SPI_GRAPHICAL_TFT)
for(i=0;i<200;)
{
#if ENABLED(TFT_LVGL_UI_SPI)
for (i = 0; i < 200;) {
p_index = (uint16_t *)(&public_buf[i]);
//Color = (*p_index >> 8);
//Color = (*p_index >> 8);
//*p_index = Color | ((*p_index & 0xff) << 8);
i+=2;
if(*p_index == 0x0000)*p_index=LV_COLOR_BACKGROUND.full;
i += 2;
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
}
#else
for(i=0;i<200;)
{
for (i = 0; i < 200;) {
p_index = (uint16_t *)(&public_buf[i]);
//Color = (*p_index >> 8);
//*p_index = Color | ((*p_index & 0xff) << 8);
i+=2;
if(*p_index == 0x0000)*p_index=LV_COLOR_BACKGROUND.full; // 0x18C3; //
i += 2;
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full; // 0x18C3; //
}
#endif
memcpy(data_buf,public_buf,200);
#endif
#endif // TFT_LVGL_UI_SPI
memcpy(data_buf, public_buf, 200);
#endif // SDSUPPORT
}
void lv_close_gcode_file() {TERN_(SDSUPPORT, card.closefile());}
@ -534,7 +536,7 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) {
#if _LFN_UNICODE
TCHAR *tmpFile;
TCHAR *strIndex1 = 0, *strIndex2 = 0, *beginIndex;
TCHAR secSeg[10] = {0};
TCHAR secSeg[10] = {0};
TCHAR gFileTail[4] = {'~', '.', 'g', '\0'};
#else
char *tmpFile;
@ -570,7 +572,7 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) {
strcpy(outStr, beginIndex);
#endif
}
else { //gcode file
else { // gcode file
if (strIndex2 - beginIndex > (len - 2)) {
#if _LFN_UNICODE
wcsncpy(outStr, (const WCHAR *)beginIndex, len - 3);
@ -578,7 +580,7 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) {
#else
//strncpy(outStr, beginIndex, len - 3);
strncpy(outStr, beginIndex, len - 4);
strcat(outStr, "~.g");
strcat_P(outStr, PSTR("~.g"));
#endif
}
else {
@ -587,7 +589,7 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) {
wcscat(outStr, (const WCHAR *)&gFileTail[3]);
#else
strncpy(outStr, beginIndex, strIndex2 - beginIndex + 1);
strcat(outStr, "g");
strcat_P(outStr, PSTR("g"));
#endif
}
}
@ -595,23 +597,23 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) {
#if _LFN_UNICODE
if (wcslen(outStr) > bytePerLine) {
wcscpy(secSeg, (const WCHAR *)&outStr[bytePerLine]);
outStr[bytePerLine] = '\n';
outStr[bytePerLine] = '\n';
outStr[bytePerLine + 1] = '\0';
wcscat(outStr, (const WCHAR *)secSeg);
}
#else
if ((int)strlen(outStr) > bytePerLine) {
strcpy(secSeg, &outStr[bytePerLine]);
outStr[bytePerLine] = '\n';
outStr[bytePerLine] = '\n';
outStr[bytePerLine + 1] = '\0';
strcat(outStr, secSeg);
}
else {
strcat(outStr, "\n");
strcat_P(outStr, PSTR("\n"));
}
#endif
}
void lv_clear_print_file() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -53,7 +53,7 @@ static lv_obj_t * buttonPause, *buttonOperat, *buttonStop;
static lv_obj_t* labelBed;
#endif
#define ID_PAUSE 1
#define ID_PAUSE 1
#define ID_STOP 2
#define ID_OPTION 3
@ -74,36 +74,36 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (gcode_preview_over != 1) {
if (uiCfg.print_state == WORKING) {
//#if ENABLED(PARK_HEAD_ON_PAUSE)
//queue.inject_P(PSTR("M25 P\nM24"));
// #if ENABLED(PARK_HEAD_ON_PAUSE)
// queue.inject_P(PSTR("M25 P\nM24"));
#if ENABLED(SDSUPPORT)
//queue.inject_P(PSTR("M25\nG91\nG1 Z10\nG90"));
// queue.inject_P(PSTR("M25\nG91\nG1 Z10\nG90"));
card.pauseSDPrint();
stop_print_time();
uiCfg.print_state = PAUSING;
#endif
lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Pause.bin", 0);
lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_resume.bin", 0);
lv_label_set_text(labelPause, printing_menu.resume);
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
}
else if (uiCfg.print_state == PAUSED) {
uiCfg.print_state = RESUMING;
//if (IS_SD_PAUSED())queue.inject_P(PSTR("M24"));// queue.inject_P(M24_STR);
lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
// if (IS_SD_PAUSED())queue.inject_P(PSTR("M24"));// queue.inject_P(M24_STR);
lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_pause.bin", 0);
lv_label_set_text(labelPause, printing_menu.pause);
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
}
#if ENABLED(POWER_LOSS_RECOVERY)
else if (uiCfg.print_state == REPRINTING) {
uiCfg.print_state = REPRINTED;
lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
lv_label_set_text(labelPause, printing_menu.pause);
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
//recovery.resume();
print_time.minutes = recovery.info.print_job_elapsed / 60;
print_time.seconds = recovery.info.print_job_elapsed % 60;
print_time.hours = print_time.minutes / 60;
}
else if (uiCfg.print_state == REPRINTING) {
uiCfg.print_state = REPRINTED;
lv_obj_set_event_cb_mks(obj, event_handler, ID_PAUSE, "bmp_pause.bin", 0);
lv_label_set_text(labelPause, printing_menu.pause);
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
// recovery.resume();
print_time.minutes = recovery.info.print_job_elapsed / 60;
print_time.seconds = recovery.info.print_job_elapsed % 60;
print_time.hours = print_time.minutes / 60;
}
#endif
}
}
@ -127,7 +127,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
else if (event == LV_EVENT_RELEASED) {
if (gcode_preview_over != 1) {
lv_obj_del(scr);
lv_draw_opration();
lv_draw_operation();
}
}
break;
@ -146,14 +146,14 @@ void lv_draw_printing(void) {
scr = lv_obj_create(NULL, NULL);
//static lv_style_t tool_style;
// static lv_style_t tool_style;
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -172,74 +172,74 @@ void lv_draw_printing(void) {
#endif
buttonFanstate = lv_imgbtn_create(scr, NULL);
buttonZpos = lv_imgbtn_create(scr, NULL);
buttonPause = lv_imgbtn_create(scr, NULL);
buttonStop = lv_imgbtn_create(scr, NULL);
buttonOperat = lv_imgbtn_create(scr, NULL);
buttonTime = lv_imgbtn_create(scr, NULL);
buttonZpos = lv_imgbtn_create(scr, NULL);
buttonPause = lv_imgbtn_create(scr, NULL);
buttonStop = lv_imgbtn_create(scr, NULL);
buttonOperat = lv_imgbtn_create(scr, NULL);
buttonTime = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonExt1, event_handler, 0, "bmp_Ext1_state.bin", 0);
lv_obj_set_event_cb_mks(buttonExt1, event_handler, 0, "bmp_ext1_state.bin", 0);
lv_imgbtn_set_src(buttonExt1, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonExt1, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExt1, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonExt1, LV_PROTECT_FOLLOW);
#if 1
if (EXTRUDERS == 2) {
lv_obj_set_event_cb_mks(buttonExt2, event_handler, 0, "bmp_Ext2_state.bin", 0);
lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_REL, &tft_style_lable_rel);
}
#if HAS_HEATED_BED
lv_obj_set_event_cb_mks(buttonBedstate, event_handler, 0, "bmp_Bed_state.bin", 0);
lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_REL, &tft_style_lable_rel);
#endif
if (EXTRUDERS == 2) {
lv_obj_set_event_cb_mks(buttonExt2, event_handler, 0, "bmp_ext2_state.bin", 0);
lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonExt2, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExt2, LV_BTN_STATE_REL, &tft_style_label_rel);
}
#if HAS_HEATED_BED
lv_obj_set_event_cb_mks(buttonBedstate, event_handler, 0, "bmp_bed_state.bin", 0);
lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonBedstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBedstate, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_event_cb_mks(buttonFanstate, event_handler, 0, "bmp_Fan_state.bin", 0);
lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_obj_set_event_cb_mks(buttonFanstate, event_handler, 0, "bmp_fan_state.bin", 0);
lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonFanstate, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFanstate, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonTime, event_handler, 0, "bmp_Time_state.bin", 0);
lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_obj_set_event_cb_mks(buttonTime, event_handler, 0, "bmp_time_state.bin", 0);
lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonTime, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTime, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonZpos, event_handler, 0, "bmp_Zpos_state.bin", 0);
lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_obj_set_event_cb_mks(buttonZpos, event_handler, 0, "bmp_zpos_state.bin", 0);
lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_REL, &bmp_pic_45x45);
lv_imgbtn_set_src(buttonZpos, LV_BTN_STATE_PR, &bmp_pic_45x45);
lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZpos, LV_BTN_STATE_REL, &tft_style_label_rel);
if (uiCfg.print_state == WORKING)
lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Resume.bin", 0);
else
lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_Pause.bin", 0);
if (uiCfg.print_state == WORKING)
lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_pause.bin", 0);
else
lv_obj_set_event_cb_mks(buttonPause, event_handler, ID_PAUSE, "bmp_resume.bin", 0);
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, &bmp_pic_150x80);
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, &bmp_pic_150x80);
lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_REL, &bmp_pic_150x80);
lv_imgbtn_set_src(buttonPause, LV_BTN_STATE_PR, &bmp_pic_150x80);
lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPause, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonStop, event_handler, ID_STOP, "bmp_Stop.bin", 0);
lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_REL, &bmp_pic_150x80);
lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_PR, &bmp_pic_150x80);
lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_obj_set_event_cb_mks(buttonStop, event_handler, ID_STOP, "bmp_stop.bin", 0);
lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_REL, &bmp_pic_150x80);
lv_imgbtn_set_src(buttonStop, LV_BTN_STATE_PR, &bmp_pic_150x80);
lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonStop, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonOperat, event_handler, ID_OPTION, "bmp_Operate.bin", 0);
lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_REL, &bmp_pic_150x80);
lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_PR, &bmp_pic_150x80);
lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_REL, &tft_style_lable_rel);
#endif
lv_obj_set_event_cb_mks(buttonOperat, event_handler, ID_OPTION, "bmp_operate.bin", 0);
lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_REL, &bmp_pic_150x80);
lv_imgbtn_set_src(buttonOperat, LV_BTN_STATE_PR, &bmp_pic_150x80);
lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonOperat, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif // if 1
lv_obj_set_pos(buttonExt1, 205, 136);
if (EXTRUDERS == 2)
@ -272,35 +272,35 @@ void lv_draw_printing(void) {
lv_btn_set_layout(buttonOperat, LV_LAYOUT_OFF);
labelExt1 = lv_label_create(scr, NULL);
lv_obj_set_style(labelExt1, &tft_style_lable_rel);
lv_obj_set_style(labelExt1, &tft_style_label_rel);
lv_obj_set_pos(labelExt1, 250, 146);
if (EXTRUDERS == 2) {
labelExt2 = lv_label_create(scr, NULL);
lv_obj_set_style(labelExt2, &tft_style_lable_rel);
lv_obj_set_style(labelExt2, &tft_style_label_rel);
lv_obj_set_pos(labelExt2, 395, 146);
}
#if HAS_HEATED_BED
labelBed = lv_label_create(scr, NULL);
lv_obj_set_style(labelBed, &tft_style_lable_rel);
lv_obj_set_style(labelBed, &tft_style_label_rel);
lv_obj_set_pos(labelBed, 250, 196);
#endif
labelFan = lv_label_create(scr, NULL);
lv_obj_set_style(labelFan, &tft_style_lable_rel);
lv_obj_set_style(labelFan, &tft_style_label_rel);
lv_obj_set_pos(labelFan, 395, 196);
labelZpos = lv_label_create(scr, NULL);
lv_obj_set_style(labelZpos, &tft_style_lable_rel);
lv_obj_set_style(labelZpos, &tft_style_label_rel);
lv_obj_set_pos(labelZpos, 395, 96);
labelTime = lv_label_create(scr, NULL);
lv_obj_set_style(labelTime, &tft_style_lable_rel);
lv_obj_set_style(labelTime, &tft_style_label_rel);
lv_obj_set_pos(labelTime, 250, 96);
labelPause = lv_label_create(buttonPause, NULL);
labelStop = lv_label_create(buttonStop, NULL);
labelPause = lv_label_create(buttonPause, NULL);
labelStop = lv_label_create(buttonStop, NULL);
labelOperat = lv_label_create(buttonOperat, NULL);
if (gCfgItems.multiple_language != 0) {
@ -318,11 +318,11 @@ void lv_draw_printing(void) {
}
lv_style_copy(&lv_bar_style_indic, &lv_style_pretty_color);
lv_bar_style_indic.text.color = lv_color_hex3(0xADF);
lv_bar_style_indic.image.color = lv_color_hex3(0xADF);
lv_bar_style_indic.line.color = lv_color_hex3(0xADF);
lv_bar_style_indic.body.main_color = lv_color_hex3(0xADF);
lv_bar_style_indic.body.grad_color = lv_color_hex3(0xADF);
lv_bar_style_indic.text.color = lv_color_hex3(0xADF);
lv_bar_style_indic.image.color = lv_color_hex3(0xADF);
lv_bar_style_indic.line.color = lv_color_hex3(0xADF);
lv_bar_style_indic.body.main_color = lv_color_hex3(0xADF);
lv_bar_style_indic.body.grad_color = lv_color_hex3(0xADF);
lv_bar_style_indic.body.border.color = lv_color_hex3(0xADF);
bar1 = lv_bar_create(scr, NULL);
@ -340,12 +340,12 @@ void lv_draw_printing(void) {
}
void disp_ext_temp() {
memset(public_buf_l, 0, sizeof(public_buf_l));
ZERO(public_buf_l);
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[0].celsius, (int)thermalManager.temp_hotend[0].target);
lv_label_set_text(labelExt1, public_buf_l);
if (EXTRUDERS == 2) {
memset(public_buf_l, 0, sizeof(public_buf_l));
ZERO(public_buf_l);
sprintf(public_buf_l, printing_menu.temp1, (int)thermalManager.temp_hotend[1].celsius, (int)thermalManager.temp_hotend[1].target);
lv_label_set_text(labelExt2, public_buf_l);
}
@ -353,42 +353,42 @@ void disp_ext_temp() {
void disp_bed_temp() {
#if HAS_HEATED_BED
memset(public_buf_l, 0, sizeof(public_buf_l));
ZERO(public_buf_l);
sprintf(public_buf_l, printing_menu.bed_temp, (int)thermalManager.temp_bed.celsius, (int)thermalManager.temp_bed.target);
lv_label_set_text(labelBed, public_buf_l);
#endif
}
void disp_fan_speed() {
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "%3d", thermalManager.fan_speed[0]);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%3d"), thermalManager.fan_speed[0]);
lv_label_set_text(labelFan, public_buf_l);
}
void disp_print_time() {
memset(public_buf_l, 0, sizeof(public_buf_l));
ZERO(public_buf_l);
#if BOTH(LCD_SET_PROGRESS_MANUALLY, USE_M73_REMAINING_TIME)
const uint32_t r = ui.get_remaining_time();
sprintf(public_buf_l, "%02d:%02d R", r / 3600, (r % 3600) / 60);
sprintf_P(public_buf_l, PSTR("%02d:%02d R"), r / 3600, (r % 3600) / 60);
#else
sprintf(public_buf_l, "%d%d:%d%d:%d%d", print_time.hours / 10, print_time.hours % 10, print_time.minutes / 10, print_time.minutes % 10, print_time.seconds / 10, print_time.seconds % 10);
sprintf_P(public_buf_l, PSTR("%d%d:%d%d:%d%d"), print_time.hours / 10, print_time.hours % 10, print_time.minutes / 10, print_time.minutes % 10, print_time.seconds / 10, print_time.seconds % 10);
#endif
lv_label_set_text(labelTime, public_buf_l);
}
void disp_fan_Zpos() {
memset(public_buf_l, 0, sizeof(public_buf_l));
sprintf(public_buf_l, "%.3f", current_position[Z_AXIS]);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.3f"), current_position[Z_AXIS]);
lv_label_set_text(labelZpos, public_buf_l);
}
void reset_print_time() {
//print_time.days = 0;
print_time.hours = 0;
// print_time.days = 0;
print_time.hours = 0;
print_time.minutes = 0;
print_time.seconds = 0;
print_time.ms_10 = 0;
//print_time.start = 1;
print_time.ms_10 = 0;
// print_time.start = 1;
}
void start_print_time() { print_time.start = 1; }
@ -411,7 +411,7 @@ void setProBarRate() {
#endif
rate = (rate_tmp_r - (PREVIEW_SIZE + To_pre_view)) * 100 / (gCfgItems.curFilesize - (PREVIEW_SIZE + To_pre_view));
}
//gCurFileState.totalSend = rate;
// gCurFileState.totalSend = rate;
if (rate <= 0) return;
@ -440,4 +440,4 @@ void setProBarRate() {
void lv_clear_printing() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,12 +21,11 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "draw_ready_print.h"
#include "draw_tool.h"
#include "lv_conf.h"
#include "lvgl.h"
//#include "../lvgl/src/lv_objx/lv_imgbtn.h"
//#include "../lvgl/src/lv_objx/lv_img.h"
//#include "../lvgl/src/lv_core/lv_disp.h"
@ -35,11 +34,13 @@
#include "mks_hardware_test.h"
#include "draw_ui.h"
#include <stdio.h>
#include <lvgl.h>
#include "../../../../MarlinCore.h"
#include "../../../../module/temperature.h"
#include <stdio.h>
//static lv_obj_t *buttonPrint,*buttonTool,*buttonSet;
static lv_obj_t * scr;
#if ENABLED(MKS_TEST)
@ -57,9 +58,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
// nothing to do
}
else if (event == LV_EVENT_RELEASED) {
#if ENABLED(MKS_TEST)
curent_disp_ui = 2;
#endif
lv_obj_del(scr);
lv_draw_tool();
}
@ -85,203 +84,222 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
}
}
lv_obj_t *limit_info, *det_info;
lv_style_t limit_style, det_style;
void disp_Limit_ok() {
limit_style.text.color.full = 0xFFFF;
lv_obj_set_style(limit_info, &limit_style);
lv_label_set_text(limit_info, "Limit:ok");
}
void disp_Limit_error() {
limit_style.text.color.full = 0xF800;
lv_obj_set_style(limit_info, &limit_style);
lv_label_set_text(limit_info, "Limit:error");
}
#if ENABLED(MKS_TEST)
void disp_det_ok() {
det_style.text.color.full = 0xFFFF;
lv_obj_set_style(det_info, &det_style);
lv_label_set_text(det_info, "det:ok");
}
void disp_det_error() {
det_style.text.color.full = 0xF800;
lv_obj_set_style(det_info, &det_style);
lv_label_set_text(det_info, "det:error");
}
lv_obj_t *limit_info, *det_info;
lv_style_t limit_style, det_style;
void disp_Limit_ok() {
limit_style.text.color.full = 0xFFFF;
lv_obj_set_style(limit_info, &limit_style);
lv_label_set_text(limit_info, "Limit:ok");
}
void disp_Limit_error() {
limit_style.text.color.full = 0xF800;
lv_obj_set_style(limit_info, &limit_style);
lv_label_set_text(limit_info, "Limit:error");
}
void disp_det_ok() {
det_style.text.color.full = 0xFFFF;
lv_obj_set_style(det_info, &det_style);
lv_label_set_text(det_info, "det:ok");
}
void disp_det_error() {
det_style.text.color.full = 0xF800;
lv_obj_set_style(det_info, &det_style);
lv_label_set_text(det_info, "det:error");
}
lv_obj_t *e1, *e2, *e3, *bed;
void disp_test() {
char buf[30] = {0};
//lv_obj_t * label_tool2 = lv_label_create(scr, NULL);
//lv_obj_set_pos(label_tool,20,50);
memset(buf, 0, sizeof(buf));
sprintf(buf, "e1:%d", (int)thermalManager.temp_hotend[0].celsius);
lv_label_set_text(e1, buf);
memset(buf, 0, sizeof(buf));
sprintf(buf, "e2:%d", (int)thermalManager.temp_hotend[1].celsius);
lv_obj_t *e1, *e2, *e3, *bed;
void mks_disp_test() {
char buf[30] = {0};
//lv_obj_t * label_tool2 = lv_label_create(scr, NULL);
//lv_obj_set_pos(label_tool,20,50);
ZERO(buf);
sprintf_P(buf, PSTR("e1:%d"), (int)thermalManager.temp_hotend[0].celsius);
lv_label_set_text(e1, buf);
#if HAS_MULTI_HOTEND
ZERO(buf);
sprintf_P(buf, PSTR("e2:%d"), (int)thermalManager.temp_hotend[1].celsius);
lv_label_set_text(e2, buf);
#endif
memset(buf, 0, sizeof(buf));
sprintf(buf, "e3:%d", (int)thermalManager.temp_hotend[2].celsius);
lv_label_set_text(e3, buf);
memset(buf, 0, sizeof(buf));
sprintf(buf, "bed:%d", (int)thermalManager.temp_bed.celsius);
//ZERO(buf);
//sprintf_P(buf, PSTR("e3:%d"), (int)thermalManager.temp_hotend[2].celsius);
//lv_label_set_text(e3, buf);
#if HAS_HEATED_BED
ZERO(buf);
sprintf_P(buf, PSTR("bed:%d"), (int)thermalManager.temp_bed.celsius);
lv_label_set_text(bed, buf);
}
#endif // MKS_TEST
#endif
}
extern unsigned char bmp_public_buf[17 * 1024];
void lv_draw_ready_print(void) {
#if ENABLED(MKS_TEST)
char buf[30] = {0};
lv_obj_t *buttonTool;
char buf[30] = {0};
lv_obj_t *buttonPrint, *buttonTool, *buttonSet;
static lv_style_t style_pr, style_rel;
disp_state_stack._disp_index = 0;
ZERO(disp_state_stack._disp_state);
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_READY_UI;
curent_disp_ui = 1;
disp_state = PRINT_READY_UI;
scr = lv_obj_create(NULL, NULL);
scr = lv_obj_create(NULL, NULL);
static lv_style_t ready_style;
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
//lv_obj_set_hidden(scr,true);
lv_refr_now(lv_refr_get_disp_refreshing());
lv_style_copy(&ready_style, &lv_style_scr);
//ready_style.body.main_color.full = 0X18C3;
//ready_style.body.grad_color.full = 0X18C3;
ready_style.body.main_color.full = 0X0000;
ready_style.body.grad_color.full = 0X0000;
ready_style.text.color.full = 0Xffff;
lv_obj_set_style(scr, &ready_style);
lv_scr_load(scr);
lv_obj_clean(scr);
//lv_obj_set_hidden(scr,true);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_pic);
LV_IMG_DECLARE(bmp_pic);
//LV_IMG_DECLARE(bmp_pic2);
//LV_IMG_DECLARE(bmp_pic3);
//scr = lv_obj_create(NULL, NULL);
//lv_scr_load(scr);
if (mks_test_flag == 0x1e) {
//lv_obj_t * title = lv_label_create(scr, NULL);
//lv_obj_set_style(title, &tft_style_label_rel);
//lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
//lv_label_set_text(title, creat_title_text());
/*Create an Image button*/
//buttonPrint = lv_imgbtn_create(scr, NULL);
buttonTool = lv_imgbtn_create(scr, NULL);
//buttonSet = lv_imgbtn_create(scr, NULL);
//lv_btn_setting(&style_pr,0x5d8f16,0x5d8f16);
//lv_btn_setting(&style_rel,0x5d8f16,0x5d8f16);
//lv_obj_set_event_cb_mks(buttonPrint, event_handler,ID_PRINT,"bmp_printing.bin",0);
//lv_imgbtn_set_src_mks(buttonPrint, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_printing.bin");
//lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_clear_protect(buttonPrint, LV_PROTECT_FOLLOW);
lv_obj_set_event_cb_mks(buttonTool, event_handler, 3, "bmp_Tool.bin", 0);
//lv_imgbtn_set_src_mks(buttonTool, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_tool.bin");
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &style_pr);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &style_rel);
#if 1
//lv_obj_set_event_cb_mks(buttonSet, event_handler,ID_SET,"bmp_set.bin",0);
//lv_imgbtn_set_src_mks(buttonSet, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_set.bin");
//lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, "bmp_tool.bin", 0);
//lv_imgbtn_set_src_mks(buttonTool, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_tool.bin");
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonTool, 360, 180);
//lv_obj_set_pos(buttonSet,180,90);
//lv_obj_set_pos(buttonPrint,340,90);
//lv_obj_set_pos(buttonTool,SIMPLE_FIRST_PAGE_GRAP+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
//lv_obj_set_pos(buttonSet,BTN_X_PIXEL+SIMPLE_FIRST_PAGE_GRAP*2+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
//lv_obj_set_pos(buttonPrint,BTN_X_PIXEL*2+SIMPLE_FIRST_PAGE_GRAP*3+1,(TFT_HEIGHT-BTN_Y_PIXEL)/2+2);
/*Create a label on the Image button*/
//lv_btn_set_layout(buttonPrint, LV_LAYOUT_OFF);
//lv_btn_set_layout(buttonSet, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
//lv_obj_t * label_print = lv_label_create(buttonPrint, NULL);
//lv_obj_t * label_set = lv_label_create(buttonSet, NULL);
lv_obj_t * label_tool = lv_label_create(buttonTool, NULL);
if (gCfgItems.multiple_language != 0) {
//lv_label_set_text(label_print, main_menu.print);
//lv_obj_align(label_print, buttonPrint, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
lv_obj_set_pos(label_tool, 30, 100);
lv_label_set_text(label_tool, "Back");
//lv_label_set_text(label_set, main_menu.set);
//lv_obj_align(label_set, buttonSet, LV_ALIGN_IN_BOTTOM_MID,0, BUTTON_TEXT_Y_OFFSET);
e1 = lv_label_create(scr, NULL);
lv_obj_set_pos(e1, 20, 20);
sprintf(buf, "e1: %d", (int)thermalManager.temp_hotend[0].celsius);
lv_label_set_text(e1, buf);
//lv_label_set_style(label_tool,LV_BTN_STATE_PR,&tft_style_label_pre);
//lv_label_set_style(label_tool,LV_BTN_STATE_REL,&tft_style_label_rel);
lv_label_set_text(label_tool, main_menu.tool);
lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
e2 = lv_label_create(scr, NULL);
lv_obj_set_pos(e2, 20, 45);
sprintf(buf, "e1: %d", (int)thermalManager.temp_hotend[1].celsius);
lv_label_set_text(e2, buf);
#if 1
e1 = lv_label_create(scr, NULL);
lv_obj_set_pos(e1, 20, 20);
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[0].celsius);
lv_label_set_text(e1, buf);
#if HAS_MULTI_HOTEND
e2 = lv_label_create(scr, NULL);
lv_obj_set_pos(e2, 20, 45);
sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[1].celsius);
lv_label_set_text(e2, buf);
#endif
e3 = lv_label_create(scr, NULL);
lv_obj_set_pos(e3, 20, 70);
sprintf(buf, "e1: %d", (int)thermalManager.temp_hotend[2].celsius);
lv_label_set_text(e3, buf);
//e3 = lv_label_create(scr, NULL);
//lv_obj_set_pos(e3,20,70);
//sprintf_P(buf, PSTR("e1: %d"), (int)thermalManager.temp_hotend[2].celsius);
//lv_label_set_text(e3, buf);
bed = lv_label_create(scr, NULL);
lv_obj_set_pos(bed, 20, 95);
sprintf(buf, "bed: %d", (int)thermalManager.temp_bed.celsius);
lv_label_set_text(bed, buf);
#if HAS_HEATED_BED
bed = lv_label_create(scr, NULL);
lv_obj_set_pos(bed, 20, 95);
sprintf_P(buf, PSTR("bed: %d"), (int)thermalManager.temp_bed.celsius);
lv_label_set_text(bed, buf);
#endif
limit_info = lv_label_create(scr, NULL);
limit_info = lv_label_create(scr, NULL);
lv_style_copy(&limit_style, &lv_style_scr);
limit_style.body.main_color.full = 0X0000;
limit_style.body.grad_color.full = 0X0000;
limit_style.text.color.full = 0Xffff;
lv_obj_set_style(limit_info, &limit_style);
lv_style_copy(&limit_style, &lv_style_scr);
limit_style.body.main_color.full = 0X0000;
limit_style.body.grad_color.full = 0X0000;
limit_style.text.color.full = 0Xffff;
lv_obj_set_style(limit_info, &limit_style);
lv_obj_set_pos(limit_info, 20, 120);
lv_label_set_text(limit_info, " ");
lv_obj_set_pos(limit_info, 20, 120);
lv_label_set_text(limit_info, " ");
det_info = lv_label_create(scr, NULL);
det_info = lv_label_create(scr, NULL);
lv_style_copy(&det_style, &lv_style_scr);
det_style.body.main_color.full = 0X0000;
det_style.body.grad_color.full = 0X0000;
det_style.text.color.full = 0Xffff;
lv_obj_set_style(det_info, &det_style);
lv_style_copy(&det_style, &lv_style_scr);
det_style.body.main_color.full = 0X0000;
det_style.body.grad_color.full = 0X0000;
det_style.text.color.full = 0Xffff;
lv_obj_set_style(det_info, &det_style);
lv_obj_set_pos(det_info, 20, 145);
lv_label_set_text(det_info, " ");
#else // !MKS_TEST
lv_obj_t *buttonPrint, *buttonTool, *buttonSet;
disp_state_stack._disp_index = 0;
memset(disp_state_stack._disp_state, 0, sizeof(disp_state_stack._disp_state));
disp_state_stack._disp_state[disp_state_stack._disp_index] = PRINT_READY_UI;
disp_state = PRINT_READY_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
//lv_obj_set_hidden(scr,true);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_pic);
lv_obj_set_pos(det_info, 20, 145);
lv_label_set_text(det_info, " ");
#endif // if 1
}
else {
//lv_obj_t * title = lv_label_create(scr, NULL);
//lv_obj_set_style(title, &tft_style_lable_rel);
//lv_obj_set_style(title, &tft_style_label_rel);
//lv_obj_set_pos(title,TITLE_XPOS,TITLE_YPOS);
//lv_label_set_text(title, creat_title_text());
/*Create an Image button*/
buttonPrint = lv_imgbtn_create(scr, NULL);
buttonTool = lv_imgbtn_create(scr, NULL);
buttonSet = lv_imgbtn_create(scr, NULL);
buttonTool = lv_imgbtn_create(scr, NULL);
buttonSet = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPrint, event_handler, ID_PRINT, "bmp_printing.bin", 0);
//lv_imgbtn_set_src_mks(buttonPrint, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_printing.bin");
lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPrint, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonPrint, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonSet, event_handler, ID_SET, "bmp_Set.bin", 0);
lv_obj_set_event_cb_mks(buttonSet, event_handler, ID_SET, "bmp_set.bin", 0);
//lv_imgbtn_set_src_mks(buttonSet, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_set.bin");
lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonSet, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonSet, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, "bmp_Tool.bin", 0);
lv_obj_set_event_cb_mks(buttonTool, event_handler, ID_TOOL, "bmp_tool.bin", 0);
//lv_imgbtn_set_src_mks(buttonTool, LV_BTN_STATE_REL, &bmp_pic,(uint8_t *)"bmp_tool.bin");
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonTool, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTool, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_pos(buttonTool, 20, 90);
lv_obj_set_pos(buttonSet, 180, 90);
lv_obj_set_pos(buttonPrint, 340, 90);
@ -296,24 +314,23 @@ void lv_draw_ready_print(void) {
lv_btn_set_layout(buttonTool, LV_LAYOUT_OFF);
lv_obj_t * label_print = lv_label_create(buttonPrint, NULL);
lv_obj_t * label_set = lv_label_create(buttonSet, NULL);
lv_obj_t * label_tool = lv_label_create(buttonTool, NULL);
lv_obj_t * label_set = lv_label_create(buttonSet, NULL);
lv_obj_t * label_tool = lv_label_create(buttonTool, NULL);
if (gCfgItems.multiple_language != 0) {
lv_label_set_text(label_print, main_menu.print);
lv_obj_align(label_print, buttonPrint, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
lv_label_set_text(label_set, main_menu.set);
lv_obj_align(label_set, buttonSet, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
//lv_label_set_style(label_tool,LV_BTN_STATE_PR,&tft_style_lable_pre);
//lv_label_set_style(label_tool,LV_BTN_STATE_REL,&tft_style_lable_rel);
//lv_label_set_style(label_tool,LV_BTN_STATE_PR,&tft_style_label_pre);
//lv_label_set_style(label_tool,LV_BTN_STATE_REL,&tft_style_label_rel);
lv_label_set_text(label_tool, main_menu.tool);
lv_obj_align(label_tool, buttonTool, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
}
#endif // !MKS_TEST
}
}
void lv_clear_ready_print() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -26,7 +26,7 @@ extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_ready_print(void);
extern void disp_test();
extern void mks_disp_test();
extern void disp_Limit_ok();
extern void disp_Limit_error();
extern void disp_det_error();

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "draw_ready_print.h"
@ -37,13 +37,15 @@
static lv_obj_t * scr;
#define ID_S_WIFI 1
#define ID_S_FAN 2
#define ID_S_ABOUT 3
#define ID_S_CONTINUE 4
#define ID_S_MOTOR_OFF 5
#define ID_S_LANGUAGE 6
#define ID_S_RETURN 7
#define ID_S_WIFI 1
#define ID_S_FAN 2
#define ID_S_ABOUT 3
#define ID_S_CONTINUE 4
#define ID_S_MOTOR_OFF 5
#define ID_S_LANGUAGE 6
#define ID_S_MACHINE_PARA 7
#define ID_S_EEPROM_SET 8
#define ID_S_RETURN 9
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
@ -83,7 +85,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
#if HAS_SUICIDE
suicide();
#else
queue.enqueue_one_now(PSTR("M84"));
queue.enqueue_now_P(PSTR("M84"));
#endif
}
break;
@ -96,6 +98,24 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
lv_draw_language();
}
break;
case ID_S_MACHINE_PARA:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_obj_del(scr);
lv_draw_machine_para();
}
break;
case ID_S_EEPROM_SET:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
lv_obj_del(scr);
lv_draw_eeprom_settings();
}
break;
case ID_S_RETURN:
if (event == LV_EVENT_CLICKED) {
// nothing to do
@ -115,6 +135,8 @@ void lv_draw_set(void) {
#if HAS_LANG_SELECT_SCREEN
lv_obj_t *buttonLanguage;
#endif
lv_obj_t *buttonMachinePara;
lv_obj_t *buttonEepromSet;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != SET_UI) {
disp_state_stack._disp_index++;
@ -131,7 +153,7 @@ void lv_draw_set(void) {
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -141,72 +163,84 @@ void lv_draw_set(void) {
/*Create an Image button*/
//buttonWifi = lv_imgbtn_create(scr, NULL);
buttonFan = lv_imgbtn_create(scr, NULL);
buttonFan = lv_imgbtn_create(scr, NULL);
buttonAbout = lv_imgbtn_create(scr, NULL);
//buttonContinue = lv_imgbtn_create(scr, NULL);
buMotorOff = lv_imgbtn_create(scr, NULL);
#if HAS_LANG_SELECT_SCREEN
buttonLanguage = lv_imgbtn_create(scr, NULL);
#endif
buttonBack = lv_imgbtn_create(scr, NULL);
buttonMachinePara = lv_imgbtn_create(scr, NULL);
buttonEepromSet = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
//lv_obj_set_event_cb_mks(buttonWifi, event_handler,ID_S_WIFI,"bmp_Wifi.bin",0);
//lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonWifi, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_lable_pre);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_lable_rel);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_imgbtn_set_style(buttonWifi, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_clear_protect(buttonWifi, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_S_FAN, "bmp_Fan.bin", 0);
lv_obj_set_event_cb_mks(buttonFan, event_handler, ID_S_FAN, "bmp_fan.bin", 0);
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonFan, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonFan, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonAbout, event_handler, ID_S_ABOUT, "bmp_About.bin", 0);
lv_obj_set_event_cb_mks(buttonAbout, event_handler, ID_S_ABOUT, "bmp_about.bin", 0);
lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonAbout, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonAbout, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_event_cb_mks(buttonContinue, event_handler,ID_S_CONTINUE,"bmp_Breakpoint.bin",0);
//lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonContinue, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_lable_pre);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_lable_rel);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_label_pre);
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_SUICIDE
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_manual_off.bin", 0);
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_Mamual.bin", 0);
#else
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_manual_off.bin", 0);
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_function1.bin", 0);
#endif
lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buMotorOff, LV_BTN_STATE_REL, &tft_style_label_rel);
#if HAS_LANG_SELECT_SCREEN
lv_obj_set_event_cb_mks(buttonLanguage, event_handler, ID_S_LANGUAGE, "bmp_Language.bin", 0);
lv_obj_set_event_cb_mks(buttonLanguage, event_handler, ID_S_LANGUAGE, "bmp_language.bin", 0);
lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonLanguage, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
lv_obj_set_event_cb_mks(buttonMachinePara, event_handler, ID_S_MACHINE_PARA, "bmp_machine_para.bin", 0);
lv_imgbtn_set_src(buttonMachinePara, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonMachinePara, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonMachinePara, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMachinePara, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_S_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonEepromSet, event_handler, ID_S_EEPROM_SET, "bmp_eeprom_settings.bin", 0);
lv_imgbtn_set_src(buttonEepromSet, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonEepromSet, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonEepromSet, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonEepromSet, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_S_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
#endif
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif // if 1
/*lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
lv_obj_set_pos(buttonFan,BTN_X_PIXEL+INTERVAL_V*2,titleHeight);
lv_obj_set_pos(buttonAbout,BTN_X_PIXEL*2+INTERVAL_V*3,titleHeight);
lv_obj_set_pos(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
lv_obj_set_pos(buMotorOff,INTERVAL_V, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buMotorOff,INTERVAL_V, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonLanguage,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4, BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
lv_obj_set_pos(buttonBack,BTN_X_PIXEL*3+INTERVAL_V*4, BTN_Y_PIXEL+INTERVAL_H+titleHeight);*/
//lv_obj_set_pos(buttonWifi,INTERVAL_V,titleHeight);
lv_obj_set_pos(buttonFan, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
@ -216,7 +250,9 @@ void lv_draw_set(void) {
#if HAS_LANG_SELECT_SCREEN
lv_obj_set_pos(buttonLanguage, INTERVAL_V, titleHeight);
#endif
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonMachinePara, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonEepromSet, BTN_X_PIXEL + INTERVAL_V * 2, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
//lv_btn_set_layout(buttonWifi, LV_LAYOUT_OFF);
@ -227,18 +263,21 @@ void lv_draw_set(void) {
#if HAS_LANG_SELECT_SCREEN
lv_btn_set_layout(buttonLanguage, LV_LAYOUT_OFF);
#endif
lv_btn_set_layout(buttonMachinePara, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonEepromSet, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
//lv_obj_t * labelWifi= lv_label_create(buttonWifi, NULL);
lv_obj_t * labelFan = lv_label_create(buttonFan, NULL);
lv_obj_t * labelFan = lv_label_create(buttonFan, NULL);
lv_obj_t * label_About = lv_label_create(buttonAbout, NULL);
//lv_obj_t * label_Continue = lv_label_create(buttonContinue, NULL);
lv_obj_t * label_MotorOff = lv_label_create(buMotorOff, NULL);
#if HAS_LANG_SELECT_SCREEN
lv_obj_t * label_Language = lv_label_create(buttonLanguage, NULL);
#endif
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
lv_obj_t * label_MachinePara = lv_label_create(buttonMachinePara, NULL);
lv_obj_t * label_EepromSet = lv_label_create(buttonEepromSet, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
//lv_label_set_text(labelWifi, set_menu.wifi);
@ -263,6 +302,11 @@ void lv_draw_set(void) {
lv_label_set_text(label_Language, set_menu.language);
lv_obj_align(label_Language, buttonLanguage, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
#endif
lv_label_set_text(label_MachinePara, set_menu.machine_para);
lv_obj_align(label_MachinePara, buttonMachinePara, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
lv_label_set_text(label_EepromSet, set_menu.eepromSet);
lv_obj_align(label_EepromSet, buttonEepromSet, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@ -271,4 +315,4 @@ void lv_draw_set(void) {
void lv_clear_set() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,358 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/planner.h"
static lv_obj_t * scr;
#define ID_STEP_RETURN 1
#define ID_STEP_X 2
#define ID_STEP_Y 3
#define ID_STEP_Z 4
#define ID_STEP_E0 5
#define ID_STEP_E1 6
#define ID_STEP_DOWN 7
#define ID_STEP_UP 8
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_STEP_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_step_settings();
draw_return_ui();
}
break;
case ID_STEP_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = Xstep;
lv_clear_step_settings();
lv_draw_number_key();
}
break;
case ID_STEP_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = Ystep;
lv_clear_step_settings();
lv_draw_number_key();
}
break;
case ID_STEP_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = Zstep;
lv_clear_step_settings();
lv_draw_number_key();
}
break;
case ID_STEP_E0:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E0step;
lv_clear_step_settings();
lv_draw_number_key();
}
break;
case ID_STEP_E1:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E1step;
lv_clear_step_settings();
lv_draw_number_key();
}
break;
case ID_STEP_UP:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_step_settings();
lv_draw_step_settings();
}
break;
case ID_STEP_DOWN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 1;
lv_clear_step_settings();
lv_draw_step_settings();
}
break;
}
}
void lv_draw_step_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL, *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != STEPS_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = STEPS_UI;
}
disp_state = STEPS_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.StepsConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
// LV_IMG_DECLARE(bmp_para_arrow);
LV_IMG_DECLARE(bmp_para_bank);
if (uiCfg.para_ui_page != 1) {
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_STEP_X, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_STEP_Y, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_STEP_Z, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/
lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE0Text, event_handler);
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
labelE0Text = lv_label_create(buttonE0Text, NULL); /*Add a label to the button*/
buttonE0Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_STEP_E0, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
labelE0Value = lv_label_create(buttonE0Value, NULL);
line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_DOWN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
}
else {
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE1Text, event_handler);
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
labelE1Text = lv_label_create(buttonE1Text, NULL); /*Add a label to the button*/
buttonE1Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_STEP_E1, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
labelE1Value = lv_label_create(buttonE1Value, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_STEP_UP, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
}
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
labelTurnPage = lv_label_create(buttonTurnPage, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_STEP_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.para_ui_page != 1) {
lv_label_set_text(labelXText, machine_menu.X_Steps);
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelYText, machine_menu.Y_Steps);
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelZText, machine_menu.Z_Steps);
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelE0Text, machine_menu.E0_Steps);
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.next);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[X_AXIS]);
lv_label_set_text(labelXValue, public_buf_l);
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Y_AXIS]);
lv_label_set_text(labelYValue, public_buf_l);
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[Z_AXIS]);
lv_label_set_text(labelZValue, public_buf_l);
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS]);
lv_label_set_text(labelE0Value, public_buf_l);
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
}
else {
lv_label_set_text(labelE1Text, machine_menu.E1_Steps);
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.previous);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), planner.settings.axis_steps_per_mm[E_AXIS_N(1)]);
lv_label_set_text(labelE1Value, public_buf_l);
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
}
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
}
}
void lv_clear_step_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_step_settings(void);
extern void lv_clear_step_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -0,0 +1,385 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if BOTH(HAS_TFT_LVGL_UI, HAS_TRINAMIC_CONFIG)
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/planner.h"
#include "../../../../module/stepper/indirection.h"
#include "../../../../feature/tmc_util.h"
static lv_obj_t * scr;
#define ID_TMC_CURRENT_RETURN 1
#define ID_TMC_CURRENT_X 2
#define ID_TMC_CURRENT_Y 3
#define ID_TMC_CURRENT_Z 4
#define ID_TMC_CURRENT_E0 5
#define ID_TMC_CURRENT_E1 6
#define ID_TMC_CURRENT_DOWN 7
#define ID_TMC_CURRENT_UP 8
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_TMC_CURRENT_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_tmc_current_settings();
draw_return_ui();
}
break;
case ID_TMC_CURRENT_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = Xcurrent;
lv_clear_tmc_current_settings();
lv_draw_number_key();
}
break;
case ID_TMC_CURRENT_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = Ycurrent;
lv_clear_tmc_current_settings();
lv_draw_number_key();
}
break;
case ID_TMC_CURRENT_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = Zcurrent;
lv_clear_tmc_current_settings();
lv_draw_number_key();
}
break;
case ID_TMC_CURRENT_E0:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E0current;
lv_clear_tmc_current_settings();
lv_draw_number_key();
}
break;
#if AXIS_IS_TMC(E1)
case ID_TMC_CURRENT_E1:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
value = E1current;
lv_clear_tmc_current_settings();
lv_draw_number_key();
}
break;
case ID_TMC_CURRENT_UP:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_tmc_current_settings();
lv_draw_tmc_current_settings();
}
break;
case ID_TMC_CURRENT_DOWN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 1;
lv_clear_tmc_current_settings();
lv_draw_tmc_current_settings();
}
break;
#endif
}
}
void lv_draw_tmc_current_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *buttonXText = NULL, *labelXText = NULL, *buttonXValue = NULL, *labelXValue = NULL;
lv_obj_t *buttonYText = NULL, *labelYText = NULL, *buttonYValue = NULL, *labelYValue = NULL;
lv_obj_t *buttonZText = NULL, *labelZText = NULL, *buttonZValue = NULL, *labelZValue = NULL;
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL, *buttonE0Value = NULL, *labelE0Value = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
#if AXIS_IS_TMC(E1)
lv_obj_t *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL, *buttonE1Value = NULL, *labelE1Value = NULL;
#endif
float milliamps;
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_CURRENT_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_CURRENT_UI;
}
disp_state = TMC_CURRENT_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.TmcCurrentConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
// LV_IMG_DECLARE(bmp_para_arrow);
LV_IMG_DECLARE(bmp_para_bank);
if (uiCfg.para_ui_page != 1) {
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonXValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonXValue, event_handler, ID_TMC_CURRENT_X, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonXValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonXValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonXValue, LV_LAYOUT_OFF);
labelXValue = lv_label_create(buttonXValue, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonYValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonYValue, event_handler, ID_TMC_CURRENT_Y, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonYValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonYValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonYValue, LV_LAYOUT_OFF);
labelYValue = lv_label_create(buttonYValue, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZValue = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonZValue, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonZValue, event_handler, ID_TMC_CURRENT_Z, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonZValue, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonZValue, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonZValue, LV_LAYOUT_OFF);
labelZValue = lv_label_create(buttonZValue, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/
lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE0Text, event_handler);
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
labelE0Text = lv_label_create(buttonE0Text, NULL); /*Add a label to the button*/
buttonE0Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE0Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE0Value, event_handler, ID_TMC_CURRENT_E0, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE0Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE0Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE0Value, LV_LAYOUT_OFF);
labelE0Value = lv_label_create(buttonE0Value, NULL);
line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]);
#if AXIS_IS_TMC(E1)
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_DOWN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
}
else {
#if AXIS_IS_TMC(E1)
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE1Text, event_handler);
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
labelE1Text = lv_label_create(buttonE1Text, NULL); /*Add a label to the button*/
buttonE1Value = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE1Value, PARA_UI_VALUE_POS_X, PARA_UI_POS_Y + PARA_UI_VALUE_V);
lv_obj_set_event_cb_mks(buttonE1Value, event_handler, ID_TMC_CURRENT_E1, "bmp_value_blank.bin", 0);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_REL, &bmp_para_bank);
lv_imgbtn_set_src(buttonE1Value, LV_BTN_STATE_PR, &bmp_para_bank);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_PR, &style_para_value_pre);
lv_imgbtn_set_style(buttonE1Value, LV_BTN_STATE_REL, &style_para_value_rel);
lv_btn_set_layout(buttonE1Value, LV_LAYOUT_OFF);
labelE1Value = lv_label_create(buttonE1Value, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_CURRENT_UP, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
}
#if AXIS_IS_TMC(E1)
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
labelTurnPage = lv_label_create(buttonTurnPage, NULL);
#endif
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_CURRENT_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.para_ui_page != 1) {
lv_label_set_text(labelXText, machine_menu.X_Current);
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelYText, machine_menu.Y_Current);
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelZText, machine_menu.Z_Current);
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelE0Text, machine_menu.E0_Current);
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
#if AXIS_IS_TMC(E1)
lv_label_set_text(labelTurnPage, machine_menu.next);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
#endif
#if AXIS_IS_TMC(X)
milliamps = stepperX.getMilliamps();
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
lv_label_set_text(labelXValue, public_buf_l);
lv_obj_align(labelXValue, buttonXValue, LV_ALIGN_CENTER, 0, 0);
#endif
#if AXIS_IS_TMC(Y)
milliamps = stepperY.getMilliamps();
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
lv_label_set_text(labelYValue, public_buf_l);
lv_obj_align(labelYValue, buttonYValue, LV_ALIGN_CENTER, 0, 0);
#endif
#if AXIS_IS_TMC(Z)
milliamps = stepperZ.getMilliamps();
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
lv_label_set_text(labelZValue, public_buf_l);
lv_obj_align(labelZValue, buttonZValue, LV_ALIGN_CENTER, 0, 0);
#endif
#if AXIS_IS_TMC(E0)
milliamps = stepperE0.getMilliamps();
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
lv_label_set_text(labelE0Value, public_buf_l);
lv_obj_align(labelE0Value, buttonE0Value, LV_ALIGN_CENTER, 0, 0);
#endif
}
else {
#if AXIS_IS_TMC(E1)
lv_label_set_text(labelE1Text, machine_menu.E1_Current);
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.previous);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
milliamps = stepperE1.getMilliamps();
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("%.1f"), milliamps);
lv_label_set_text(labelE1Value, public_buf_l);
lv_obj_align(labelE1Value, buttonE1Value, LV_ALIGN_CENTER, 0, 0);
#endif
}
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
}
}
void lv_clear_tmc_current_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI && HAS_TRINAMIC_CONFIG

View file

@ -0,0 +1,34 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_tmc_current_settings(void);
extern void lv_clear_tmc_current_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -0,0 +1,478 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if BOTH(HAS_TFT_LVGL_UI, HAS_STEALTHCHOP)
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../MarlinCore.h"
#include "../../../../module/planner.h"
#include "../../../../module/stepper/indirection.h"
#include "../../../../feature/tmc_util.h"
#include "../../../../gcode/gcode.h"
#include "../../../../module/planner.h"
static lv_obj_t * scr;
#define ID_TMC_MODE_RETURN 1
#define ID_TMC_MODE_X 2
#define ID_TMC_MODE_Y 3
#define ID_TMC_MODE_Z 4
#define ID_TMC_MODE_E0 5
#define ID_TMC_MODE_E1 6
#define ID_TMC_MODE_DOWN 7
#define ID_TMC_MODE_UP 8
static lv_obj_t *labelXState = NULL, *labelYState = NULL, *labelZState = NULL, *labelE0State = NULL;
static lv_obj_t *buttonXState = NULL, *buttonYState = NULL, *buttonZState = NULL, *buttonE0State = NULL;
#if AXIS_HAS_STEALTHCHOP(E1)
static lv_obj_t *labelE1State = NULL, *buttonE1State = NULL;
#endif
static void event_handler(lv_obj_t * obj, lv_event_t event) {
switch (obj->mks_obj_id) {
case ID_TMC_MODE_RETURN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_tmc_step_mode_settings();
draw_return_ui();
}
break;
case ID_TMC_MODE_X:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (stepperX.stored.stealthChop_enabled == true) {
stepperX.stored.stealthChop_enabled = false;
stepperX.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_disable.bin", 0);
lv_label_set_text(labelXState, machine_menu.disable);
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
// gcode.process_subcommands_now_P(PSTR("M500"));
}
else {
stepperX.stored.stealthChop_enabled = true;
stepperX.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_enable.bin", 0);
lv_label_set_text(labelXState, machine_menu.enable);
// gcode.process_subcommands_now_P(PSTR("M500"));
}
gcode.process_subcommands_now_P(PSTR("M500"));
}
break;
case ID_TMC_MODE_Y:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (stepperY.stored.stealthChop_enabled == true) {
stepperY.stored.stealthChop_enabled = false;
stepperY.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_disable.bin", 0);
lv_label_set_text(labelYState, machine_menu.disable);
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
}
else {
stepperY.stored.stealthChop_enabled = true;
stepperY.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_enable.bin", 0);
lv_label_set_text(labelYState, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
}
break;
case ID_TMC_MODE_Z:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (stepperZ.stored.stealthChop_enabled == true) {
stepperZ.stored.stealthChop_enabled = false;
stepperZ.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_disable.bin", 0);
lv_label_set_text(labelZState, machine_menu.disable);
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
}
else {
stepperZ.stored.stealthChop_enabled = true;
stepperZ.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_enable.bin", 0);
lv_label_set_text(labelZState, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
}
break;
case ID_TMC_MODE_E0:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (stepperE0.stored.stealthChop_enabled == true) {
stepperE0.stored.stealthChop_enabled = false;
stepperE0.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_disable.bin", 0);
lv_label_set_text(labelE0State, machine_menu.disable);
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
}
else {
stepperE0.stored.stealthChop_enabled = true;
stepperE0.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_enable.bin", 0);
lv_label_set_text(labelE0State, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
}
break;
#if AXIS_HAS_STEALTHCHOP(E1)
case ID_TMC_MODE_E1:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
if (stepperE1.stored.stealthChop_enabled == true) {
stepperE1.stored.stealthChop_enabled = false;
stepperE1.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_disable.bin", 0);
lv_label_set_text(labelE1State, machine_menu.disable);
// lv_obj_align(labelXState, buttonE1State, LV_ALIGN_IN_LEFT_MID,0, 0);
}
else {
stepperE1.stored.stealthChop_enabled = true;
stepperE1.refresh_stepping_mode();
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_enable.bin", 0);
lv_label_set_text(labelE1State, machine_menu.enable);
}
gcode.process_subcommands_now_P(PSTR("M500"));
}
break;
case ID_TMC_MODE_UP:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 0;
lv_clear_tmc_step_mode_settings();
lv_draw_tmc_step_mode_settings();
}
break;
case ID_TMC_MODE_DOWN:
if (event == LV_EVENT_CLICKED) {
}
else if (event == LV_EVENT_RELEASED) {
uiCfg.para_ui_page = 1;
lv_clear_tmc_step_mode_settings();
lv_draw_tmc_step_mode_settings();
}
break;
#endif // if AXIS_HAS_STEALTHCHOP(E1)
}
}
void lv_draw_tmc_step_mode_settings(void) {
lv_obj_t *buttonBack = NULL, *label_Back = NULL;
lv_obj_t *buttonXText = NULL, *labelXText = NULL;
lv_obj_t *buttonYText = NULL, *labelYText = NULL;
lv_obj_t *buttonZText = NULL, *labelZText = NULL;
lv_obj_t *buttonE0Text = NULL, *labelE0Text = NULL;
lv_obj_t * line1 = NULL, * line2 = NULL, * line3 = NULL, * line4 = NULL;
#if AXIS_HAS_STEALTHCHOP(E1)
lv_obj_t *buttonTurnPage = NULL, *labelTurnPage = NULL;
lv_obj_t *buttonE1Text = NULL, *labelE1Text = NULL;
#endif
labelXState = NULL;
buttonXState = NULL;
labelYState = NULL;
buttonYState = NULL;
labelZState = NULL;
buttonZState = NULL;
labelE0State = NULL;
buttonE0State = NULL;
#if AXIS_HAS_STEALTHCHOP(E1)
labelE1State = NULL;
buttonE1State = NULL;
#endif
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != TMC_MODE_UI) {
disp_state_stack._disp_index++;
disp_state_stack._disp_state[disp_state_stack._disp_index] = TMC_MODE_UI;
}
disp_state = TMC_MODE_UI;
scr = lv_obj_create(NULL, NULL);
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, machine_menu.TmcStepModeConfTitle);
lv_refr_now(lv_refr_get_disp_refreshing());
LV_IMG_DECLARE(bmp_para_back);
LV_IMG_DECLARE(bmp_para_state);
// LV_IMG_DECLARE(bmp_para_bank);
if (uiCfg.para_ui_page != 1) {
buttonXText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonXText, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonXText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonXText, event_handler);
lv_btn_set_style(buttonXText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonXText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonXText, LV_LAYOUT_OFF);
labelXText = lv_label_create(buttonXText, NULL); /*Add a label to the button*/
buttonXState = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonXState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V);
if (stepperX.get_stealthChop_status())
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_enable.bin", 0);
else
lv_obj_set_event_cb_mks(buttonXState, event_handler, ID_TMC_MODE_X, "bmp_disable.bin", 0);
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_REL, &bmp_para_state);
lv_imgbtn_set_src(buttonXState, LV_BTN_STATE_PR, &bmp_para_state);
lv_imgbtn_set_style(buttonXState, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonXState, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonXState, LV_LAYOUT_OFF);
labelXState = lv_label_create(buttonXState, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonYText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonYText, PARA_UI_POS_X, PARA_UI_POS_Y * 2); /*Set its position*/
lv_obj_set_size(buttonYText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonYText, event_handler);
lv_btn_set_style(buttonYText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonYText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonYText, LV_LAYOUT_OFF);
labelYText = lv_label_create(buttonYText, NULL); /*Add a label to the button*/
buttonYState = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonYState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 2 + PARA_UI_STATE_V);
if (stepperY.get_stealthChop_status())
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_enable.bin", 0);
else
lv_obj_set_event_cb_mks(buttonYState, event_handler, ID_TMC_MODE_Y, "bmp_disable.bin", 0);
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_REL, &bmp_para_state);
lv_imgbtn_set_src(buttonYState, LV_BTN_STATE_PR, &bmp_para_state);
lv_imgbtn_set_style(buttonYState, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonYState, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonYState, LV_LAYOUT_OFF);
labelYState = lv_label_create(buttonYState, NULL);
line2 = lv_line_create(scr, NULL);
lv_ex_line(line2, line_points[1]);
buttonZText = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonZText, PARA_UI_POS_X, PARA_UI_POS_Y * 3); /*Set its position*/
lv_obj_set_size(buttonZText, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonZText, event_handler);
lv_btn_set_style(buttonZText, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonZText, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonZText, LV_LAYOUT_OFF);
labelZText = lv_label_create(buttonZText, NULL); /*Add a label to the button*/
buttonZState = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonZState, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 3 + PARA_UI_STATE_V);
if (stepperZ.get_stealthChop_status())
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_enable.bin", 0);
else
lv_obj_set_event_cb_mks(buttonZState, event_handler, ID_TMC_MODE_Z, "bmp_disable.bin", 0);
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_REL, &bmp_para_state);
lv_imgbtn_set_src(buttonZState, LV_BTN_STATE_PR, &bmp_para_state);
lv_imgbtn_set_style(buttonZState, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonZState, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonZState, LV_LAYOUT_OFF);
labelZState = lv_label_create(buttonZState, NULL);
line3 = lv_line_create(scr, NULL);
lv_ex_line(line3, line_points[2]);
buttonE0Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE0Text, PARA_UI_POS_X, PARA_UI_POS_Y * 4); /*Set its position*/
lv_obj_set_size(buttonE0Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE0Text, event_handler);
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE0Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE0Text, LV_LAYOUT_OFF);
labelE0Text = lv_label_create(buttonE0Text, NULL); /*Add a label to the button*/
buttonE0State = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE0State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y * 4 + PARA_UI_STATE_V);
if (stepperE0.get_stealthChop_status())
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_enable.bin", 0);
else
lv_obj_set_event_cb_mks(buttonE0State, event_handler, ID_TMC_MODE_E0, "bmp_disable.bin", 0);
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_REL, &bmp_para_state);
lv_imgbtn_set_src(buttonE0State, LV_BTN_STATE_PR, &bmp_para_state);
lv_imgbtn_set_style(buttonE0State, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonE0State, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonE0State, LV_LAYOUT_OFF);
labelE0State = lv_label_create(buttonE0State, NULL);
line4 = lv_line_create(scr, NULL);
lv_ex_line(line4, line_points[3]);
#if AXIS_HAS_STEALTHCHOP(E1)
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_DOWN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
}
else {
#if AXIS_HAS_STEALTHCHOP(E1)
buttonE1Text = lv_btn_create(scr, NULL); /*Add a button the current screen*/
lv_obj_set_pos(buttonE1Text, PARA_UI_POS_X, PARA_UI_POS_Y); /*Set its position*/
lv_obj_set_size(buttonE1Text, PARA_UI_VALUE_SIZE_X, PARA_UI_SIZE_Y); /*Set its size*/
lv_obj_set_event_cb(buttonE1Text, event_handler);
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_REL, &tft_style_label_rel); /*Set the button's released style*/
lv_btn_set_style(buttonE1Text, LV_BTN_STYLE_PR, &tft_style_label_pre); /*Set the button's pressed style*/
lv_btn_set_layout(buttonE1Text, LV_LAYOUT_OFF);
labelE1Text = lv_label_create(buttonE1Text, NULL); /*Add a label to the button*/
buttonE1State = lv_imgbtn_create(scr, NULL);
lv_obj_set_pos(buttonE1State, PARA_UI_STATE_POS_X, PARA_UI_POS_Y + PARA_UI_STATE_V);
if (stepperE1.get_stealthChop_status())
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_enable.bin", 0);
else
lv_obj_set_event_cb_mks(buttonE1State, event_handler, ID_TMC_MODE_E1, "bmp_disable.bin", 0);
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_REL, &bmp_para_state);
lv_imgbtn_set_src(buttonE1State, LV_BTN_STATE_PR, &bmp_para_state);
lv_imgbtn_set_style(buttonE1State, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonE1State, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_btn_set_layout(buttonE1State, LV_LAYOUT_OFF);
labelE1State = lv_label_create(buttonE1State, NULL);
line1 = lv_line_create(scr, NULL);
lv_ex_line(line1, line_points[0]);
buttonTurnPage = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonTurnPage, event_handler, ID_TMC_MODE_UP, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonTurnPage, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonTurnPage, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif
}
#if AXIS_HAS_STEALTHCHOP(E1)
lv_obj_set_pos(buttonTurnPage, PARA_UI_TURN_PAGE_POS_X, PARA_UI_TURN_PAGE_POS_Y);
lv_btn_set_layout(buttonTurnPage, LV_LAYOUT_OFF);
labelTurnPage = lv_label_create(buttonTurnPage, NULL);
#endif
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_TMC_MODE_RETURN, "bmp_back70x40.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_para_back);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_para_back);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_pos(buttonBack, PARA_UI_BACL_POS_X, PARA_UI_BACL_POS_Y);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
label_Back = lv_label_create(buttonBack, NULL);
if (gCfgItems.multiple_language != 0) {
if (uiCfg.para_ui_page != 1) {
lv_label_set_text(labelXText, machine_menu.X_StepMode);
lv_obj_align(labelXText, buttonXText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelYText, machine_menu.Y_StepMode);
lv_obj_align(labelYText, buttonYText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelZText, machine_menu.Z_StepMode);
lv_obj_align(labelZText, buttonZText, LV_ALIGN_IN_LEFT_MID, 0, 0);
lv_label_set_text(labelE0Text, machine_menu.E0_StepMode);
lv_obj_align(labelE0Text, buttonE0Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
if (stepperX.get_stealthChop_status())
lv_label_set_text(labelXState, machine_menu.enable);
else
lv_label_set_text(labelXState, machine_menu.disable);
lv_obj_align(labelXState, buttonXState, LV_ALIGN_CENTER, 0, 0);
if (stepperY.get_stealthChop_status())
lv_label_set_text(labelYState, machine_menu.enable);
else
lv_label_set_text(labelYState, machine_menu.disable);
lv_obj_align(labelYState, buttonYState, LV_ALIGN_CENTER, 0, 0);
if (stepperZ.get_stealthChop_status())
lv_label_set_text(labelZState, machine_menu.enable);
else
lv_label_set_text(labelZState, machine_menu.disable);
lv_obj_align(labelZState, buttonZState, LV_ALIGN_CENTER, 0, 0);
if (stepperE0.get_stealthChop_status())
lv_label_set_text(labelE0State, machine_menu.enable);
else
lv_label_set_text(labelE0State, machine_menu.disable);
lv_obj_align(labelE0State, buttonE0State, LV_ALIGN_CENTER, 0, 0);
#if AXIS_HAS_STEALTHCHOP(E1)
lv_label_set_text(labelTurnPage, machine_menu.next);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
#endif
}
else {
#if AXIS_HAS_STEALTHCHOP(E1)
lv_label_set_text(labelE1Text, machine_menu.E1_StepMode);
lv_obj_align(labelE1Text, buttonE1Text, LV_ALIGN_IN_LEFT_MID, 0, 0);
if (stepperE1.get_stealthChop_status())
lv_label_set_text(labelE1State, machine_menu.enable);
else
lv_label_set_text(labelE1State, machine_menu.disable);
lv_obj_align(labelE1State, buttonE1State, LV_ALIGN_CENTER, 0, 0);
lv_label_set_text(labelTurnPage, machine_menu.previous);
lv_obj_align(labelTurnPage, buttonTurnPage, LV_ALIGN_CENTER, 0, 0);
#endif
}
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_CENTER, 0, 0);
}
}
void lv_clear_tmc_step_mode_settings() { lv_obj_del(scr); }
#endif // HAS_TFT_LVGL_UI && HAS_STEALTHCHOP

View file

@ -0,0 +1,33 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
#endif
extern void lv_draw_tmc_step_mode_settings(void);
extern void lv_clear_tmc_step_mode_settings();
#ifdef __cplusplus
} /* C-declarations for C++ */
#endif

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "lv_conf.h"
#include "draw_ui.h"
@ -33,11 +33,8 @@
#include "../../../../MarlinCore.h"
#include "../../../../gcode/queue.h"
//static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
// static lv_obj_t *buttonMoveZ,*buttonTest,*buttonZ0,*buttonStop,*buttonReturn;
static lv_obj_t * scr;
#if ENABLED(MKS_TEST)
extern uint8_t curent_disp_ui;
#endif
#define ID_T_PRE_HEAT 1
#define ID_T_EXTRUCT 2
@ -128,14 +125,14 @@ void lv_draw_tool(void) {
scr = lv_obj_create(NULL, NULL);
//static lv_style_t tool_style;
// static lv_style_t tool_style;
lv_obj_set_style(scr, &tft_style_scr);
lv_scr_load(scr);
lv_obj_clean(scr);
lv_obj_t * title = lv_label_create(scr, NULL);
lv_obj_set_style(title, &tft_style_lable_rel);
lv_obj_set_style(title, &tft_style_label_rel);
lv_obj_set_pos(title, TITLE_XPOS, TITLE_YPOS);
lv_label_set_text(title, creat_title_text());
@ -144,74 +141,74 @@ void lv_draw_tool(void) {
LV_IMG_DECLARE(bmp_pic);
/*Create an Image button*/
buttonPreHeat = lv_imgbtn_create(scr, NULL);
buttonPreHeat = lv_imgbtn_create(scr, NULL);
buttonExtrusion = lv_imgbtn_create(scr, NULL);
buttonMove = lv_imgbtn_create(scr, NULL);
buttonHome = lv_imgbtn_create(scr, NULL);
buttonLevel = lv_imgbtn_create(scr, NULL);
//buttonFilament = lv_imgbtn_create(scr, NULL);
//buttonMore = lv_imgbtn_create(scr, NULL);
buttonMove = lv_imgbtn_create(scr, NULL);
buttonHome = lv_imgbtn_create(scr, NULL);
buttonLevel = lv_imgbtn_create(scr, NULL);
// buttonFilament = lv_imgbtn_create(scr, NULL);
// buttonMore = lv_imgbtn_create(scr, NULL);
buttonBack = lv_imgbtn_create(scr, NULL);
lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_T_PRE_HEAT, "bmp_PreHeat.bin", 0);
lv_obj_set_event_cb_mks(buttonPreHeat, event_handler, ID_T_PRE_HEAT, "bmp_preHeat.bin", 0);
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonPreHeat, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonPreHeat, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_clear_protect(buttonPreHeat, LV_PROTECT_FOLLOW);
#if 1
lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_T_EXTRUCT, "bmp_Extruct.bin", 0);
lv_obj_set_event_cb_mks(buttonExtrusion, event_handler, ID_T_EXTRUCT, "bmp_extruct.bin", 0);
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonExtrusion, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonExtrusion, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_T_MOV, "bmp_Mov.bin", 0);
lv_obj_set_event_cb_mks(buttonMove, event_handler, ID_T_MOV, "bmp_mov.bin", 0);
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonMove, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonHome, event_handler, ID_T_HOME, "bmp_Zero.bin", 0);
lv_obj_set_event_cb_mks(buttonHome, event_handler, ID_T_HOME, "bmp_zero.bin", 0);
lv_imgbtn_set_src(buttonHome, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonHome, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonHome, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonLevel, event_handler, ID_T_LEVELING, "bmp_Leveling.bin", 0);
lv_obj_set_event_cb_mks(buttonLevel, event_handler, ID_T_LEVELING, "bmp_leveling.bin", 0);
lv_imgbtn_set_src(buttonLevel, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonLevel, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_REL, &tft_style_lable_rel);
lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonLevel, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_T_FILAMENT,"bmp_Filamentchange.bin",0);
//lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_lable_pre);
//lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_lable_rel);
// lv_obj_set_event_cb_mks(buttonFilament, event_handler,ID_T_FILAMENT,"bmp_Filamentchange.bin",0);
// lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_REL, &bmp_pic);
// lv_imgbtn_set_src(buttonFilament, LV_BTN_STATE_PR, &bmp_pic);
// lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_PR, &tft_style_label_pre);
// lv_imgbtn_set_style(buttonFilament, LV_BTN_STATE_REL, &tft_style_label_rel);
//lv_obj_set_event_cb_mks(buttonMore, event_handler,ID_T_MORE,"bmp_More.bin",0);
//lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_REL, &bmp_pic);
//lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_PR, &bmp_pic);
//lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_PR, &tft_style_lable_pre);
//lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_REL, &tft_style_lable_rel);
// lv_obj_set_event_cb_mks(buttonMore, event_handler,ID_T_MORE,"bmp_More.bin",0);
// lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_REL, &bmp_pic);
// lv_imgbtn_set_src(buttonMore, LV_BTN_STATE_PR, &bmp_pic);
// lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_PR, &tft_style_label_pre);
// lv_imgbtn_set_style(buttonMore, LV_BTN_STATE_REL, &tft_style_label_rel);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_T_RETURN, "bmp_Return.bin", 0);
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_T_RETURN, "bmp_return.bin", 0);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_REL, &bmp_pic);
lv_imgbtn_set_src(buttonBack, LV_BTN_STATE_PR, &bmp_pic);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_lable_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_lable_rel);
#endif
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_PR, &tft_style_label_pre);
lv_imgbtn_set_style(buttonBack, LV_BTN_STATE_REL, &tft_style_label_rel);
#endif // if 1
lv_obj_set_pos(buttonPreHeat, INTERVAL_V, titleHeight);
lv_obj_set_pos(buttonExtrusion, BTN_X_PIXEL + INTERVAL_V * 2, titleHeight);
lv_obj_set_pos(buttonMove, BTN_X_PIXEL * 2 + INTERVAL_V * 3, titleHeight);
lv_obj_set_pos(buttonHome, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
lv_obj_set_pos(buttonLevel, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
//lv_obj_set_pos(buttonFilament,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
//lv_obj_set_pos(buttonMore,BTN_X_PIXEL*2+INTERVAL_V*3, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
lv_obj_set_pos(buttonLevel, INTERVAL_V, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
// lv_obj_set_pos(buttonFilament,BTN_X_PIXEL+INTERVAL_V*2,BTN_Y_PIXEL+INTERVAL_H+titleHeight);
// lv_obj_set_pos(buttonMore,BTN_X_PIXEL*2+INTERVAL_V*3, BTN_Y_PIXEL+INTERVAL_H+titleHeight);
lv_obj_set_pos(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
/*Create a label on the Image button*/
lv_btn_set_layout(buttonPreHeat, LV_LAYOUT_OFF);
@ -219,15 +216,15 @@ void lv_draw_tool(void) {
lv_btn_set_layout(buttonMove, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonHome, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonLevel, LV_LAYOUT_OFF);
//lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
//lv_btn_set_layout(buttonMore, LV_LAYOUT_OFF);
// lv_btn_set_layout(buttonFilament, LV_LAYOUT_OFF);
// lv_btn_set_layout(buttonMore, LV_LAYOUT_OFF);
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
lv_obj_t * labelPreHeat = lv_label_create(buttonPreHeat, NULL);
lv_obj_t * labelPreHeat = lv_label_create(buttonPreHeat, NULL);
lv_obj_t * labelExtrusion = lv_label_create(buttonExtrusion, NULL);
lv_obj_t * label_Move = lv_label_create(buttonMove, NULL);
lv_obj_t * label_Home = lv_label_create(buttonHome, NULL);
lv_obj_t * label_Level = lv_label_create(buttonLevel, NULL);
lv_obj_t * label_Move = lv_label_create(buttonMove, NULL);
lv_obj_t * label_Home = lv_label_create(buttonHome, NULL);
lv_obj_t * label_Level = lv_label_create(buttonLevel, NULL);
//lv_obj_t * label_Filament = lv_label_create(buttonFilament, NULL);
//lv_obj_t * label_More = lv_label_create(buttonMore, NULL);
lv_obj_t * label_Back = lv_label_create(buttonBack, NULL);
@ -254,11 +251,11 @@ void lv_draw_tool(void) {
lv_label_set_text(label_Level, tool_menu.TERN(AUTO_BED_LEVELING_BILINEAR, autoleveling, leveling));
lv_obj_align(label_Level, buttonLevel, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
//lv_label_set_text(label_Filament, tool_menu.filament);
//lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
// lv_label_set_text(label_Filament, tool_menu.filament);
// lv_obj_align(label_Filament, buttonFilament, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
//lv_label_set_text(label_More, tool_menu.more);
//lv_obj_align(label_More, buttonMore, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
// lv_label_set_text(label_More, tool_menu.more);
// lv_obj_align(label_More, buttonMore, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
lv_label_set_text(label_Back, common_menu.text_back);
lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
@ -267,4 +264,4 @@ void lv_draw_tool(void) {
void lv_clear_tool() { lv_obj_del(scr); }
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

File diff suppressed because it is too large Load diff

View file

@ -22,16 +22,17 @@
#pragma once
#ifdef __cplusplus
extern "C" { /* C-declarations for C++ */
extern "C" { /* C-declarations for C++ */
#endif
#include <lvgl.h>
#include <stdint.h>
#include <string.h>
#include "lvgl.h"
//the colors of the last MKS Ui
// the colors of the last MKS Ui
#undef LV_COLOR_BACKGROUND
#define LV_COLOR_BACKGROUND LV_COLOR_MAKE(0x1A, 0x1A, 0x1A) //LV_COLOR_MAKE(0x00, 0x00, 0x00)
#define LV_COLOR_BACKGROUND LV_COLOR_MAKE(0x1A, 0x1A, 0x1A) // LV_COLOR_MAKE(0x00, 0x00, 0x00)
#include "tft_multi_language.h"
#include "draw_ready_print.h"
@ -41,7 +42,7 @@ extern "C" { /* C-declarations for C++ */
#include "draw_print_file.h"
#include "draw_dialog.h"
#include "draw_printing.h"
#include "draw_opration.h"
#include "draw_operation.h"
#include "draw_preHeat.h"
#include "draw_extrusion.h"
#include "draw_home.h"
@ -51,7 +52,22 @@ extern "C" { /* C-declarations for C++ */
#include "draw_change_speed.h"
#include "draw_manuaLevel.h"
#include "draw_error_message.h"
#include "printer_opration.h"
#include "printer_operation.h"
#include "draw_machine_para.h"
#include "draw_machine_settings.h"
#include "draw_motor_settings.h"
#include "draw_advance_settings.h"
#include "draw_acceleration_settings.h"
#include "draw_number_key.h"
#include "draw_jerk_settings.h"
#include "draw_pause_position.h"
#include "draw_step_settings.h"
#include "draw_tmc_current_settings.h"
#include "draw_eeprom_settings.h"
#include "draw_max_feedrate_settings.h"
#include "draw_tmc_step_mode_settings.h"
#include "../../inc/MarlinConfigPre.h"
#define TFT35
@ -70,8 +86,8 @@ extern "C" { /* C-declarations for C++ */
#define BUTTON_TEXT_Y_OFFSET -20
#define TITLE_XPOS 3 //TFT_screen.title_xpos
#define TITLE_YPOS 5 //TFT_screen.title_ypos
#define TITLE_XPOS 3 // TFT_screen.title_xpos
#define TITLE_YPOS 5 // TFT_screen.title_ypos
#define FILE_BTN_CNT 6
@ -81,17 +97,39 @@ extern "C" { /* C-declarations for C++ */
#define FILE_PRE_PIC_X_OFFSET 8
#define FILE_PRE_PIC_Y_OFFSET 0
#define PREVIEW_LITTLE_PIC_SIZE 40910//400*100+9*101+1
#define PREVIEW_SIZE 202720//(PREVIEW_LITTLE_PIC_SIZE+800*200+201*9+1)
#define PREVIEW_LITTLE_PIC_SIZE 40910 // 400*100+9*101+1
#define PREVIEW_SIZE 202720 // (PREVIEW_LITTLE_PIC_SIZE+800*200+201*9+1)
#define GCFG_FLAG_VALUE 0xEE
#else
// machine parameter ui
#define PARA_UI_POS_X 10
#define PARA_UI_POS_Y 50
#define PARA_UI_SIZE_X 450
#define PARA_UI_SIZE_Y 40
#define PARA_UI_ARROW_V 12
#define PARA_UI_BACL_POS_X 400
#define PARA_UI_BACL_POS_Y 270
#define PARA_UI_TURN_PAGE_POS_X 320
#define PARA_UI_TURN_PAGE_POS_Y 270
#define PARA_UI_VALUE_SIZE_X 370
#define PARA_UI_VALUE_POS_X 400
#define PARA_UI_VALUE_V 5
#define PARA_UI_STATE_POS_X 380
#define PARA_UI_STATE_V 2
#else // ifdef TFT35
#define TFT_WIDTH 320
#define TFT_HEIGHT 240
#endif
#endif // ifdef TFT35
extern char public_buf_m[100];
extern char public_buf_l[30];
@ -104,6 +142,9 @@ typedef struct {
uint8_t from_flash_pic;
uint8_t finish_power_off;
uint8_t pause_reprint;
float pausePosX;
float pausePosY;
float pausePosZ;
uint32_t curFilesize;
} CFG_ITMES;
@ -111,7 +152,8 @@ typedef struct {
uint8_t curTempType : 1,
curSprayerChoose : 3,
stepHeat : 4;
uint8_t leveling_first_time : 1;
uint8_t leveling_first_time : 1,
para_ui_page : 1;
uint8_t extruStep;
uint8_t extruSpeed;
uint8_t print_state;
@ -185,7 +227,11 @@ typedef enum {
ENABLE_INVERT_UI,
NUMBER_KEY_UI,
BABY_STEP_UI,
ERROR_MESSAGE_UI
ERROR_MESSAGE_UI,
PAUSE_POS_UI,
TMC_CURRENT_UI,
TMC_MODE_UI,
EEPROM_SETTINGS_UI
} DISP_STATE;
typedef struct {
@ -203,6 +249,46 @@ typedef struct {
} PRINT_TIME;
extern PRINT_TIME print_time;
typedef enum {
PrintAcceleration,
RetractAcceleration,
TravelAcceleration,
XAcceleration,
YAcceleration,
ZAcceleration,
E0Acceleration,
E1Acceleration,
XMaxFeedRate,
YMaxFeedRate,
ZMaxFeedRate,
E0MaxFeedRate,
E1MaxFeedRate,
XJerk,
YJerk,
ZJerk,
EJerk,
Xstep,
Ystep,
Zstep,
E0step,
E1step,
Xcurrent,
Ycurrent,
Zcurrent,
E0current,
E1current,
pause_pos_x,
pause_pos_y,
pause_pos_z
}value_state;
extern value_state value;
extern CFG_ITMES gCfgItems;
extern UI_CFG uiCfg;
extern DISP_STATE disp_state;
@ -210,8 +296,16 @@ extern DISP_STATE last_disp_state;
extern DISP_STATE_STACK disp_state_stack;
extern lv_style_t tft_style_scr;
extern lv_style_t tft_style_lable_pre;
extern lv_style_t tft_style_lable_rel;
extern lv_style_t tft_style_label_pre;
extern lv_style_t tft_style_label_rel;
extern lv_style_t style_line;
extern lv_style_t style_para_value_pre;
extern lv_style_t style_para_value_rel;
extern lv_style_t style_num_key_pre;
extern lv_style_t style_num_key_rel;
extern lv_style_t style_num_text;
extern lv_point_t line_points[4][2];
extern void gCfgItems_init();
extern void ui_cfg_init();
@ -230,6 +324,7 @@ extern void gCfg_to_spiFlah();
extern void print_time_count();
extern void LV_TASK_HANDLER();
extern void lv_ex_line(lv_obj_t * line, lv_point_t *points);
#ifdef __cplusplus
} /* C-declarations for C++ */

View file

@ -21,11 +21,12 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "lvgl.h"
#include "pic_manager.h"
#include <lvgl.h>
#include "../../../../inc/MarlinConfig.h"
#if HAS_SPI_FLASH_FONT
@ -46,10 +47,10 @@ typedef struct {
} glyph_dsc_t;
static x_header_t __g_xbf_hd = { .min = 0, .max = 0, .bpp = 0 };
static uint8_t __g_font_buf[75];
static uint8_t __g_font_buf[63];
static uint8_t *__user_font_getdata(int offset, int size) {
//memset(__g_font_buf,0,sizeof(__g_font_buf));
//ZERO(__g_font_buf);
get_spi_flash_data((char *)__g_font_buf, offset, size);
return __g_font_buf;
//return &buf_test[offset];
@ -106,10 +107,9 @@ lv_font_t gb2312_puhui32;
void init_gb2312_font() {
gb2312_puhui32.get_glyph_bitmap = __user_font_get_bitmap;
gb2312_puhui32.get_glyph_dsc = __user_font_get_glyph_dsc;
gb2312_puhui32.line_height = 25;
gb2312_puhui32.line_height = 21;
gb2312_puhui32.base_line = 0;
}
#endif // HAS_SPI_FLASH_FONT
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,63 +21,69 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#if ENABLED(TFT_LVGL_UI_SPI)
#include "SPI_TFT.h"
#endif
#include "tft_lvgl_configuration.h"
#include "lvgl.h"
#include "draw_ready_print.h"
#include "W25Qxx.h"
#include "mks_hardware_test.h"
#include "draw_ui.h"
#include "pic_manager.h"
#include <lvgl.h>
#include "../../../../MarlinCore.h"
#include "../../../../module/temperature.h"
#include "../../../../feature/touch/xpt2046.h"
#include "../../../../sd/cardreader.h"
#include "pic_manager.h"
#if ENABLED(MKS_TEST)
extern uint8_t curent_disp_ui;
uint8_t pw_det_sta, pw_off_sta, mt_det_sta, mt_det2_sta, mt_det3_sta;
uint8_t endstopx1_sta, endstopx2_sta, endstopy1_sta, endstopy2_sta, endstopz1_sta, endstopz2_sta;
void test_gpio_readlevel_L() {
uint8_t pw_det_sta, pw_off_sta, mt_det_sta, mt_det2_sta, mt_det3_sta;
uint8_t endstopx1_sta, endstopx2_sta, endstopy1_sta, endstopy2_sta, endstopz1_sta, endstopz2_sta;
void test_gpio_readlevel_L() {
#if ENABLED(MKS_TEST)
volatile uint32_t itest;
WRITE(WIFI_IO2_PIN, HIGH);
WRITE(WIFI_IO0_PIN, HIGH);
itest = 10000;
while (itest--);
pw_det_sta = (READ(POWER_LOSS_PIN) == 0);
pw_off_sta = (READ(PS_ON_PIN) == 0);
mt_det_sta = (READ(FIL_RUNOUT_PIN) == 0);
mt_det2_sta = (READ(FIL_RUNOUT_2_PIN) == 0);
mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 0);
mt_det_sta = (READ(MT_DET_1_PIN) == 0);
mt_det2_sta = (READ(MT_DET_2_PIN) == 0);
//mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 0);
endstopx1_sta = (READ(X_MIN_PIN) == 0);
endstopx2_sta = (READ(X_MAX_PIN) == 0);
endstopy1_sta = (READ(Y_MIN_PIN) == 0);
endstopy2_sta = (READ(Y_MAX_PIN) == 0);
endstopz1_sta = (READ(Z_MIN_PIN) == 0);
endstopz2_sta = (READ(Z_MAX_PIN) == 0);
}
#endif
}
void test_gpio_readlevel_H() {
void test_gpio_readlevel_H() {
#if ENABLED(MKS_TEST)
volatile uint32_t itest;
WRITE(WIFI_IO2_PIN, LOW);
WRITE(WIFI_IO0_PIN, LOW);
itest = 10000;
while (itest--);
pw_det_sta = (READ(POWER_LOSS_PIN) == 1);
pw_off_sta = (READ(PS_ON_PIN) == 1);
mt_det_sta = (READ(FIL_RUNOUT_PIN) == 1);
mt_det2_sta = (READ(FIL_RUNOUT_2_PIN) == 1);
mt_det3_sta = (READ(FIL_RUNOUT_3_PIN) == 1);
mt_det_sta = (READ(MT_DET_1_PIN) == 1);
mt_det2_sta = (READ(MT_DET_2_PIN) == 1);
//mt_det3_sta = (READ(MT_DET_3_PIN) == 1);
endstopx1_sta = (READ(X_MIN_PIN) == 1);
endstopx2_sta = (READ(X_MAX_PIN) == 1);
endstopy1_sta = (READ(Y_MIN_PIN) == 1);
endstopy2_sta = (READ(Y_MAX_PIN) == 1);
endstopz1_sta = (READ(Z_MIN_PIN) == 1);
endstopz2_sta = (READ(Z_MAX_PIN) == 1);
}
#endif
}
void init_Tst_GPIO() {
void init_test_gpio() {
#ifdef MKS_TEST
SET_INPUT_PULLUP(X_MIN_PIN);
SET_INPUT_PULLUP(X_MAX_PIN);
SET_INPUT_PULLUP(Y_MIN_PIN);
@ -85,70 +91,77 @@
SET_INPUT_PULLUP(Z_MIN_PIN);
SET_INPUT_PULLUP(Z_MAX_PIN);
SET_OUTPUT(WIFI_IO2_PIN);
SET_OUTPUT(WIFI_IO0_PIN);
SET_INPUT_PULLUP(FIL_RUNOUT_PIN);
SET_INPUT_PULLUP(FIL_RUNOUT_2_PIN);
SET_INPUT_PULLUP(FIL_RUNOUT_3_PIN);
SET_INPUT_PULLUP(MT_DET_1_PIN);
SET_INPUT_PULLUP(MT_DET_2_PIN);
//SET_INPUT_PULLUP(MT_DET_3_PIN);
SET_INPUT_PULLUP(POWER_LOSS_PIN);
SET_INPUT_PULLUP(PS_ON_PIN);
SET_INPUT_PULLUP(SERVO0_PIN);
SET_OUTPUT(E0_ENABLE_PIN);
SET_OUTPUT(X_ENABLE_PIN);
SET_OUTPUT(Y_ENABLE_PIN);
SET_OUTPUT(Z_ENABLE_PIN);
SET_OUTPUT(E0_ENABLE_PIN);
SET_OUTPUT(E1_ENABLE_PIN);
WRITE(X_ENABLE_PIN, LOW);
WRITE(Y_ENABLE_PIN, LOW);
WRITE(Z_ENABLE_PIN, LOW);
WRITE(E0_ENABLE_PIN, LOW);
WRITE(E1_ENABLE_PIN, LOW);
WRITE(E2_ENABLE_PIN, LOW);
}
//WRITE(E2_ENABLE_PIN, LOW);
#endif
}
void mks_test_beeper() {
void mks_test_beeper() {
#ifdef MKS_TEST
WRITE(BEEPER_PIN, HIGH);
delay(100);
WRITE(BEEPER_PIN, LOW);
delay(100);
}
#endif
}
void Test_GPIO() {
init_Tst_GPIO();
void mks_gpio_test(){
#if ENABLED(MKS_TEST)
init_test_gpio();
test_gpio_readlevel_L();
test_gpio_readlevel_H();
test_gpio_readlevel_L();
if ((pw_det_sta == 1) && (mt_det_sta == 1) && (mt_det2_sta == 1) && (mt_det3_sta == 1)) {
if (curent_disp_ui == 1) disp_det_ok();
}
else if (curent_disp_ui == 1) disp_det_error();
if ((endstopx1_sta == 1)
&& (endstopx2_sta == 1)
&& (endstopy1_sta == 1)
&& (endstopy2_sta == 1)
&& (endstopz1_sta == 1)
&& (endstopz2_sta == 1)
) {
if (curent_disp_ui == 1) disp_Limit_ok();
}
else if (curent_disp_ui == 1)
if ((pw_det_sta == 1) && (mt_det_sta == 1) && (mt_det2_sta == 1)) // &&(mt_det3_sta == 1))
disp_det_ok();
else
disp_det_error();
if ( (endstopx1_sta == 1)
&& (endstopx2_sta == 1)
&& (endstopy1_sta == 1)
&& (endstopy2_sta == 1)
&& (endstopz1_sta == 1)
&& (endstopz2_sta == 1)
)
disp_Limit_ok();
else
disp_Limit_error();
//mks_test_beeper();
#endif
}
}
void mks_test() {
void mks_hardware_test(){
#if ENABLED(MKS_TEST)
if (millis() % 2000 < 1000) {
WRITE(X_DIR_PIN, LOW);
WRITE(Y_DIR_PIN, LOW);
WRITE(Z_DIR_PIN, LOW);
WRITE(E0_DIR_PIN, LOW);
WRITE(E1_DIR_PIN, LOW);
WRITE(E2_DIR_PIN, LOW);
//WRITE(E2_DIR_PIN, LOW);
thermalManager.fan_speed[0] = 255;
WRITE(HEATER_2_PIN, HIGH); // HE2
//WRITE(HEATER_2_PIN, HIGH); // HE2
WRITE(HEATER_1_PIN, HIGH); // HE1
WRITE(HEATER_0_PIN, HIGH); // HE0
WRITE(HEATER_BED_PIN, HIGH); // HOT-BED
@ -159,28 +172,29 @@
WRITE(Z_DIR_PIN, HIGH);
WRITE(E0_DIR_PIN, HIGH);
WRITE(E1_DIR_PIN, HIGH);
WRITE(E2_DIR_PIN, HIGH);
//WRITE(E2_DIR_PIN, HIGH);
thermalManager.fan_speed[0] = 0;
WRITE(HEATER_2_PIN, LOW); // HE2
//WRITE(HEATER_2_PIN, LOW); // HE2
WRITE(HEATER_1_PIN, LOW); // HE1
WRITE(HEATER_0_PIN, LOW); // HE0
WRITE(HEATER_BED_PIN, LOW); // HOT-BED
}
if ((endstopx1_sta == 1) && (endstopx2_sta == 1)
&& (endstopy1_sta == 1) && (endstopy2_sta == 1)
&& (endstopz1_sta == 1) && (endstopz2_sta == 1)
) {
if ( (endstopx1_sta == 1) && (endstopx2_sta == 1)
&& (endstopy1_sta == 1) && (endstopy2_sta == 1)
&& (endstopz1_sta == 1) && (endstopz2_sta == 1)
) {
// nothing here
}
else {
mks_test_beeper();
//mks_test_beeper();
}
if (curent_disp_ui == 1)
disp_test();
}
if (disp_state == PRINT_READY_UI)
mks_disp_test();
#endif // MKS_TEST
#endif
}
static const uint16_t ASCII_Table_16x24[] PROGMEM = {
// Space ' '
@ -568,8 +582,10 @@ static const uint16_t ASCII_Table_16x24[] PROGMEM = {
void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint16_t bkColor) {
for (uint16_t i = 0; i < 24; i++) {
const uint16_t tmp_char = pgm_read_word(&ASCII_Table_16x24[((c - 0x20) * 24) + i]);
for (uint16_t j = 0; j < 16; j++)
tft_set_point(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor);
for (uint16_t j = 0; j < 16; j++) {
TERN(TFT_LVGL_UI_SPI, SPI_TFT.SetPoint, tft_set_point)
(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor);
}
}
}
@ -582,14 +598,30 @@ void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor
}
//static lv_obj_t * scr_test;
void disp_pic_update() {
LCD_Clear(0x0000);
disp_string(120, 150, "PIC Updating...", 0xFFFF, 0x0000);
void disp_assets_update() {
#if DISABLED(TFT_LVGL_UI_SPI)
LCD_Clear(0x0000);
#endif
disp_string(100, 150, "Assets Updating...", 0xFFFF, 0x0000);
}
void disp_font_update() {
LCD_Clear(0x0000);
disp_string(120, 150, "FONT Updating...", 0xFFFF, 0x0000);
void disp_assets_update_progress(const char *msg) {
char buf[30];
memset(buf, ' ', COUNT(buf));
strncpy(buf, msg, strlen(msg));
buf[COUNT(buf)-1] = '\0';
disp_string(100, 200, buf, 0xFFFF, 0x0000);
}
#endif // TFT_LVGL_UI
uint8_t mks_test_flag = 0;
const char *MKSTestPath = "MKS_TEST";
#if ENABLED(SDSUPPORT)
void mks_test_get() {
SdFile dir, root = card.getroot();
if (dir.open(&root, MKSTestPath, O_RDONLY))
mks_test_flag = 0x1e;
}
#endif
#endif // HAS_TFT_LVGL_UI

View file

@ -21,11 +21,13 @@
*/
#pragma once
#include "lvgl.h"
#include <lvgl.h>
void Test_GPIO();
void mks_gpio_test();
void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint16_t bkColor);
void disp_string(uint16_t x, uint16_t y, const char * string, uint16_t charColor, uint16_t bkColor);
void mks_test();
void disp_pic_update();
void disp_font_update();
void mks_hardware_test();
void disp_assets_update();
void disp_assets_update_progress(const char *msg);
void mks_test_get();
extern uint8_t mks_test_flag;

View file

@ -21,7 +21,7 @@
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
@ -40,7 +40,7 @@ extern unsigned char bmp_public_buf[17 * 1024];
extern char *createFilename(char * const buffer, const dir_t &p);
#endif
static char assets[][30] = {
static char assets[][LONG_FILENAME_LENGTH] = {
//homing screen
"bmp_Zero.bin",
"bmp_zeroX.bin",
@ -90,7 +90,7 @@ static char assets[][30] = {
//select file screen
"bmp_pageUp.bin",
"bmp_pageDown.bin",
//"bmp_Back.bin", //TODO: why two back buttons? Why not just one? (return / back)
"bmp_Back.bin", //TODO: why two back buttons? Why not just one? (return / back)
"bmp_Dir.bin",
"bmp_File.bin",
@ -164,14 +164,18 @@ static char assets[][30] = {
"bmp_French_sel.bin",
"bmp_Italy.bin",
"bmp_Italy_sel.bin",
#endif //HAS_LANG_SELECT_SCREEN
#endif // HAS_LANG_SELECT_SCREEN
//gcode preview
// gcode preview
#if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
"bmp_preview.bin",
#endif
//settings screen
#if HAS_LOGO_IN_FLASH
"bmp_logo.bin",
#endif
// settings screen
"bmp_About.bin",
//"bmp_Language.bin",
//"bmp_Fan.bin",
@ -182,14 +186,27 @@ static char assets[][30] = {
"bmp_Set.bin",
"bmp_Tool.bin",
//base icons
#if ENABLED(HAS_STEALTHCHOP)
//"bmp_back70x40.bin",
"bmp_disable.bin",
"bmp_enable.bin",
#endif
// settings screen
"bmp_eeprom_settings.bin",
"bmp_machine_para.bin",
"bmp_function1.bin",
// base icons
"bmp_arrow.bin",
"bmp_back70x40.bin",
"bmp_value_blank.bin",
"bmp_Return.bin"
};
#if HAS_SPI_FLASH_FONT
static char fonts[][50] = {
"GBK16.bin",
"UNIGBK.bin",
static char fonts[][LONG_FILENAME_LENGTH] = {
"FontUNIGBK.bin",
};
#endif
@ -220,22 +237,19 @@ uint32_t lv_get_pic_addr(uint8_t *Pname) {
addr = PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35;
else
addr = PIC_DATA_ADDR_TFT32 + i * PER_PIC_MAX_SPACE_TFT32;
return (addr + 4);//The purpose of adding 4 is to remove 4-byte picture header information.
return addr;
}
}
return addr;
}
const char *picPath = "mks_pic";
const char *bakPath = "bak_pic";
const char *fontPath = "mks_font";
const char *bakFont = "bak_font";
const char *assetsPath = "assets";
const char *bakPath = "_assets";
void spiFlashErase_PIC() {
volatile uint32_t pic_sectorcnt = 0;
for (pic_sectorcnt = 0; pic_sectorcnt < TERN(MKS_TEST, 2, PIC_SIZE_xM * 1024 / 64); pic_sectorcnt++)
for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++)
W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
}
@ -347,103 +361,123 @@ uint8_t public_buf[512];
longName[j] = '\0';
}
void UpdatePic() {
char *fn;
unsigned char logoFlag;
static int8_t arrayFindStr(const char arr[][LONG_FILENAME_LENGTH], uint8_t arraySize, const char* str) {
for (uint8_t a = 0; a < arraySize; a++) {
if (strcasecmp(arr[a], str) == 0)
return a;
}
return -1;
}
#define ASSET_TYPE_ICON 0
#define ASSET_TYPE_LOGO 1
#define ASSET_TYPE_TITLE_LOGO 2
#define ASSET_TYPE_G_PREVIEW 3
#define ASSET_TYPE_FONT 4
static void loadAsset(SdFile &dir, dir_t& entry, const char *fn, int8_t assetType) {
SdFile file;
char dosFilename[FILENAME_LENGTH];
createFilename(dosFilename, entry);
if (!file.open(&dir, dosFilename, O_READ)) {
#if ENABLED(MARLIN_DEV_MODE)
SERIAL_ECHOLNPAIR("Error opening Asset: ", fn);
#endif
return;
}
disp_assets_update_progress(fn);
uint16_t pbr;
uint32_t pfileSize;
uint32_t totalSizeLoaded = 0;
uint32_t Pic_Write_Addr;
pfileSize = file.fileSize();
totalSizeLoaded += pfileSize;
if (assetType == ASSET_TYPE_LOGO) {
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); //
if (pbr < BMP_WRITE_BUF_LEN) break;
}
}
else if (assetType == ASSET_TYPE_TITLE_LOGO) {
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); //
if (pbr < BMP_WRITE_BUF_LEN) break;
}
}
else if (assetType == ASSET_TYPE_G_PREVIEW) {
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
default_view_Write(public_buf, pbr); //
if (pbr < BMP_WRITE_BUF_LEN) break;
}
}
else if (assetType == ASSET_TYPE_ICON) {
Pic_Write_Addr = Pic_Info_Write((uint8_t *)fn, pfileSize);
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
Pic_Write_Addr += pbr;
if (pbr < BMP_WRITE_BUF_LEN) break;
}
}
else if (assetType == ASSET_TYPE_FONT) {
Pic_Write_Addr = UNIGBK_FLASH_ADDR;
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
Pic_Write_Addr += pbr;
if (pbr < BMP_WRITE_BUF_LEN) break;
}
}
file.close();
#if ENABLED(MARLIN_DEV_MODE)
SERIAL_ECHOLNPAIR("Asset added: ", fn);
#endif
}
void UpdateAssets() {
SdFile dir, root = card.getroot();
if (dir.open(&root, picPath, O_RDONLY)) {
if (dir.open(&root, assetsPath, O_RDONLY)) {
disp_pic_update();
disp_assets_update();
spiFlashErase_PIC();
#if HAS_SPI_FLASH_FONT
spiFlashErase_FONT();
#endif
dir_t d;
while (dir.readDir(&d, card.longFilename) > 0) {
// if we dont get a long name, but gets a short one, try it
if (card.longFilename[0] == 0 && d.name[0] != 0) {
if (card.longFilename[0] == 0 && d.name[0] != 0)
dosName2LongName((const char*)d.name, card.longFilename);
}
if (card.longFilename[0] == 0) continue;
if (card.longFilename[0] == '.') continue;
if (card.longFilename[0] == 0)
continue;
if (card.longFilename[0] == '.')
continue;
uint8_t a = arrayFindStr(assets, COUNT(assets), card.longFilename);
if (a >= 0 && a < COUNT(assets)) {
uint8_t assetType = ASSET_TYPE_ICON;
if (strstr(assets[a], "_logo"))
assetType = ASSET_TYPE_LOGO;
else if (strstr(assets[a], "_titlelogo"))
assetType = ASSET_TYPE_TITLE_LOGO;
else if (strstr(assets[a], "_preview"))
assetType = ASSET_TYPE_G_PREVIEW;
uint8_t a = -1;
for(a = 0; a < COUNT(assets); a++) {
if (strcasecmp(assets[a], card.longFilename) == 0) {
break;
}
}
if (a < 0 || a >= COUNT(assets)) continue;
loadAsset(dir, d, assets[a], assetType);
fn = assets[a];
char dosFilename[FILENAME_LENGTH];
createFilename(dosFilename, d);
SdFile file;
if (!file.open(&dir, dosFilename, O_READ)) {
#if ENABLED(MARLIN_DEV_MODE)
SERIAL_ECHOLNPAIR("Error opening Asset: ", fn);
#endif
continue;
}
if (strstr(fn, "_logo"))
logoFlag = 1;
else if (strstr(fn, "_titlelogo"))
logoFlag = 2;
else if (strstr(fn, "_preview"))
logoFlag = 3;
else
logoFlag = 0;
pfileSize = file.fileSize();
totalSizeLoaded += pfileSize;
if (logoFlag == 1) {
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); //
if (pbr < BMP_WRITE_BUF_LEN)
break;
#if HAS_SPI_FLASH_FONT
a = arrayFindStr(fonts, COUNT(fonts), card.longFilename);
if (a >= 0 && a < COUNT(fonts)) {
loadAsset(dir, d, fonts[a], ASSET_TYPE_FONT);
}
}
else if (logoFlag == 2) {
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); //
if (pbr < BMP_WRITE_BUF_LEN)
break;
}
}
else if (logoFlag == 3) {
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
default_view_Write(public_buf, pbr); //
if (pbr < BMP_WRITE_BUF_LEN)
break;
}
}
else {
Pic_Write_Addr = Pic_Info_Write((uint8_t *)fn, pfileSize);
while (1) {
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
Pic_Write_Addr += pbr;
if (pbr < BMP_WRITE_BUF_LEN)
break;
}
}
#if ENABLED(MARLIN_DEV_MODE)
SERIAL_ECHOLNPAIR("Asset added: ", fn);
#endif
file.close();
}
dir.rename(&root, bakPath);
}
@ -452,62 +486,12 @@ uint8_t public_buf[512];
#if ENABLED(MARLIN_DEV_MODE)
uint8_t pic_counter = 0;
W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1);
SERIAL_ECHOLNPAIR("Total assets loaded: ", pic_counter, ", Total size: ", totalSizeLoaded);
SERIAL_ECHOLNPAIR("Total assets loaded: ", pic_counter);
#endif
}
#if HAS_SPI_FLASH_FONT
void spi_flash_read_test() { W25QXX.SPI_FLASH_BufferRead(public_buf, UNIGBK_FLASH_ADDR, BMP_WRITE_BUF_LEN); }
void UpdateFont() {
char *fn;
uint16_t pbr;
uint32_t flashaddr = 0;
SdFile dir, root = card.getroot();
if (dir.open(&root, fontPath, O_RDONLY)) {
disp_font_update();
spiFlashErase_FONT();
dir_t d;
while (dir.readDir(&d, card.longFilename) > 0) {
if (card.longFilename[0] == 0)
break;
if (card.longFilename[0] == '.')
continue;
fn = card.longFilename;
if (strstr(fn, ".bin")) {
char dosFilename[FILENAME_LENGTH];
createFilename(dosFilename, d);
//strcat(public_buf, dosFilename);
SdFile file;
if (file.open(&dir, dosFilename, O_READ)) {
flashaddr = UNIGBK_FLASH_ADDR;
pbr = 0;
while (1) {
flashaddr += pbr;
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
W25QXX.SPI_FLASH_BufferWrite(public_buf, flashaddr, pbr);
if (pbr < BMP_WRITE_BUF_LEN) break;
}
file.close();
}
}
}
dir.rename(&root, bakFont);
dir.close();
}
}
#endif // HAS_SPI_FLASH_FONT
#endif // SDSUPPORT
@ -552,6 +536,7 @@ void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {
uint32_t logo_addroffset = 0;
void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) {
W25QXX.init(SPI_QUARTER_SPEED);
W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
logo_addroffset += LogoReadsize;
if (logo_addroffset >= LOGO_MAX_SIZE_TFT35)
@ -561,7 +546,6 @@ void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize
uint32_t default_view_addroffset = 0;
void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize) {
W25QXX.init(SPI_QUARTER_SPEED);
W25QXX.SPI_FLASH_BufferRead(default_view_Rbuff, DEFAULT_VIEW_ADDR_TFT35 + default_view_addroffset, default_view_Readsize);
default_view_addroffset += default_view_Readsize;
if (default_view_addroffset >= DEFAULT_VIEW_MAX_SIZE)
@ -572,7 +556,6 @@ void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsi
uint32_t flash_view_addroffset = 0;
void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize) {
W25QXX.init(SPI_QUARTER_SPEED);
W25QXX.SPI_FLASH_BufferRead(flash_view_Rbuff, BAK_VIEW_ADDR_TFT35 + flash_view_addroffset, flash_view_Readsize);
flash_view_addroffset += flash_view_Readsize;
if (flash_view_addroffset >= FLASH_VIEW_MAX_SIZE)
@ -580,4 +563,4 @@ void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsi
}
#endif
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -25,29 +25,33 @@
extern "C" { /* C-declarations for C++ */
#endif
#include <stdint.h>
#include <string.h>
#include "lvgl.h"
#include "../../inc/MarlinConfigPre.h"
#include <lvgl.h>
#include <stdint.h>
#include <string.h>
#ifndef HAS_SPI_FLASH_FONT
#define HAS_SPI_FLASH_FONT 0 //disabled until fix the font load code
#define HAS_SPI_FLASH_FONT 1 // Disabled until fix the font load code
#endif
#ifndef HAS_GCODE_PREVIEW
#define HAS_GCODE_PREVIEW 1
#endif
#ifndef HAS_LANG_SELECT_SCREEN
#define HAS_LANG_SELECT_SCREEN 0
#define HAS_LANG_SELECT_SCREEN 1
#endif
#ifndef HAS_BAK_VIEW_IN_FLASH
#define HAS_BAK_VIEW_IN_FLASH 1
#define HAS_BAK_VIEW_IN_FLASH 1
#endif
#ifndef HAS_GCODE_DEFAULT_VIEW_IN_FLASH
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 1
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 1
#endif
#ifndef HAS_LOGO_IN_FLASH
#define HAS_LOGO_IN_FLASH 1
#endif
#ifndef SPI_FLASH_SIZE
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#endif
#define PIC_MAX_CN 100 // Maximum number of pictures
@ -66,48 +70,52 @@ extern "C" { /* C-declarations for C++ */
#if SPI_FLASH_SIZE == 0x200000
//pic
//Robin_pro pic addr
#define PIC_NAME_ADDR 0x001000 // Pic information addr
#define PIC_SIZE_ADDR 0x001800 // Pic size information addr
#define PIC_COUNTER_ADDR 0x002000 // Pic total number
#define PER_PIC_SAVE_ADDR 0x000000 // Storage address of each picture
#define PIC_LOGO_ADDR 0x000000 // Logo addr
#define PIC_DATA_ADDR 0x003000 //
#define PIC_NAME_ADDR 0x001000 // Pic information addr
#define PIC_SIZE_ADDR 0x001800 // Pic size information addr
#define PIC_COUNTER_ADDR 0x002000 // Pic total number
#define PER_PIC_SAVE_ADDR 0x000000 // Storage address of each picture
#define PIC_LOGO_ADDR 0x000000 // Logo addr
#define PIC_DATA_ADDR 0x003000 //
// TFT35
#define DEFAULT_VIEW_ADDR_TFT35 0x1ea070
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
#define PIC_DATA_ADDR_TFT35 0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
#define DEFAULT_VIEW_ADDR_TFT35 0x1ea070
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
#define PIC_DATA_ADDR_TFT35 0x003000 // (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
#define PIC_DATA_ADDR_TFT32 0x00F000
#define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
#define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
#define PIC_DATA_ADDR_TFT32 0x00F000
#define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
#define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
// font
#define FONTINFOADDR 0x183000 // 6M -- font addr
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
#else
//pic
//Robin_pro pic addr
#define PIC_NAME_ADDR 0x003000 // Pic information addr
#define PIC_SIZE_ADDR 0x007000 // Pic size information addr
#define PIC_COUNTER_ADDR 0x008000 // Pic total number
#define PER_PIC_SAVE_ADDR 0x009000 // Storage address of each picture
#define PIC_LOGO_ADDR 0x00A000 // Logo addr
//#define PIC_DATA_ADDR 0x02F000 //
#define PIC_NAME_ADDR 0x003000 // Pic information addr
#define PIC_SIZE_ADDR 0x007000 // Pic size information addr
#define PIC_COUNTER_ADDR 0x008000 // Pic total number
//#define PER_PIC_SAVE_ADDR 0x009000 // Storage address of each picture
#define PIC_LOGO_ADDR 0x009000 // Logo addr
//#define PIC_DATA_ADDR 0x02F000 //
// TFT35
#define DEFAULT_VIEW_ADDR_TFT35 0xC5800
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
#define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
#define DEFAULT_VIEW_ADDR_TFT35 0xC5800
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
#define PIC_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
#define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
// TFT32
#define PIC_DATA_ADDR_TFT32 0x02F000
#define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
#define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
#define PIC_DATA_ADDR_TFT32 0x02F000
#define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
#define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
// font
#define FONTINFOADDR 0x600000 // 6M -- font addr
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
#define FONTINFOADDR 0x600000 // 6M -- font addr
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
#endif
@ -137,6 +145,7 @@ typedef struct pic_msg PIC_MSG;
#define FONT_SIZE_xM 2
extern void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
extern void Pic_Logo_Read(uint8_t *LogoName,uint8_t *Logo_Rbuff,uint32_t LogoReadsize);
extern void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
extern uint32_t lv_get_pic_addr(uint8_t *Pname);
extern void get_spi_flash_data(const char *rec_buf, int offset, int size);

View file

@ -0,0 +1,217 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../module/temperature.h"
#include "../../../../module/motion.h"
#include "../../../../sd/cardreader.h"
#include "../../../../gcode/queue.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../../feature/powerloss.h"
#endif
#include "../../../../gcode/gcode.h"
#include "../../../../module/planner.h"
extern uint32_t To_pre_view;
extern uint8_t flash_preview_begin, default_preview_flg, gcode_preview_over;
void printer_state_polling() {
if (uiCfg.print_state == PAUSING) {
#if ENABLED(SDSUPPORT)
if (!planner.has_blocks_queued() && card.getIndex() > MIN_FILE_PRINTED)
uiCfg.waitEndMoves++;
if (uiCfg.waitEndMoves > 20) {
uiCfg.waitEndMoves = 0;
planner.synchronize();
gcode.process_subcommands_now_P(PSTR("M25"));
if (gCfgItems.pausePosZ != (float)-1) {
gcode.process_subcommands_now_P(PSTR("G91"));
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("G1 Z%.1f"), gCfgItems.pausePosZ);
gcode.process_subcommands_now(public_buf_l);
gcode.process_subcommands_now_P(PSTR("G90"));
}
if (gCfgItems.pausePosX != (float)-1 && gCfgItems.pausePosY != (float)-1) {
ZERO(public_buf_l);
sprintf_P(public_buf_l, PSTR("G1 X%.1f Y%.1f"), gCfgItems.pausePosX, gCfgItems.pausePosY);
gcode.process_subcommands_now(public_buf_l);
}
uiCfg.print_state = PAUSED;
// #if ENABLED(POWER_LOSS_RECOVERY)
// if (recovery.enabled) recovery.save(true);
// #endif
gCfgItems.pause_reprint = 1;
update_spi_flash();
}
#endif
}
else
uiCfg.waitEndMoves = 0;
if (uiCfg.print_state == PAUSED) {
}
if (uiCfg.print_state == RESUMING) {
if (IS_SD_PAUSED()) {
gcode.process_subcommands_now_P(PSTR("M24\nG91\nG1 Z-5\nG90"));
uiCfg.print_state = WORKING;
start_print_time();
gCfgItems.pause_reprint = 0;
update_spi_flash();
}
}
#if ENABLED(POWER_LOSS_RECOVERY)
if (uiCfg.print_state == REPRINTED) {
ZERO(public_buf_m);
#if HAS_HOTEND
HOTEND_LOOP() {
const int16_t et = recovery.info.target_temperature[e];
if (et) {
#if HAS_MULTI_HOTEND
sprintf_P(public_buf_m, PSTR("T%i"), e);
gcode.process_subcommands_now(public_buf_m);
#endif
sprintf_P(public_buf_m, PSTR("M109 S%i"), et);
gcode.process_subcommands_now(public_buf_m);
}
}
#endif
if (gCfgItems.pause_reprint == 1) {
gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90"));
}
recovery.resume();
uiCfg.print_state = WORKING;
start_print_time();
gCfgItems.pause_reprint = 0;
update_spi_flash();
}
#endif
if (uiCfg.print_state == WORKING)
filament_check();
}
void filament_pin_setup() {
#if PIN_EXISTS(MT_DET_1)
pinMode(MT_DET_1_PIN, INPUT_PULLUP);
#endif
#if PIN_EXISTS(MT_DET_2)
pinMode(MT_DET_2_PIN, INPUT_PULLUP);
#endif
#if PIN_EXISTS(MT_DET_3)
pinMode(MT_DET_3_PIN, INPUT_PULLUP);
#endif
}
void filament_check() {
const int FIL_DELAY = 20;
#if PIN_EXISTS(MT_DET_1)
static int fil_det_count_1 = 0;
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (fil_det_count_1 > 0)
fil_det_count_1--;
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (fil_det_count_1 > 0)
fil_det_count_1--;
#endif
#if PIN_EXISTS(MT_DET_2)
static int fil_det_count_2 = 0;
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (fil_det_count_2 > 0)
fil_det_count_2--;
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (fil_det_count_2 > 0)
fil_det_count_2--;
#endif
#if PIN_EXISTS(MT_DET_3)
static int fil_det_count_3 = 0;
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (fil_det_count_3 > 0)
fil_det_count_3--;
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (fil_det_count_3 > 0)
fil_det_count_3--;
#endif
if (false
#if PIN_EXISTS(MT_DET_1)
|| fil_det_count_1 >= FIL_DELAY
#endif
#if PIN_EXISTS(MT_DET_2)
|| fil_det_count_2 >= FIL_DELAY
#endif
#if PIN_EXISTS(MT_DET_3)
|| fil_det_count_3 >= FIL_DELAY
#endif
) {
clear_cur_ui();
card.pauseSDPrint();
stop_print_time();
uiCfg.print_state = PAUSING;
if (gCfgItems.from_flash_pic == 1)
flash_preview_begin = 1;
else
default_preview_flg = 1;
lv_draw_printing();
}
}
#endif // HAS_TFT_LVGL_UI

View file

@ -1,209 +0,0 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#include "../../../../MarlinCore.h"
#include "lv_conf.h"
#include "draw_ui.h"
#include "../../../../module/temperature.h"
#include "../../../../module/motion.h"
#include "../../../../sd/cardreader.h"
#include "../../../../gcode/queue.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../../feature/powerloss.h"
#endif
#include "../../../../gcode/gcode.h"
#include "../../../../module/planner.h"
extern uint32_t To_pre_view;
extern uint8_t flash_preview_begin, default_preview_flg, gcode_preview_over;
void printer_state_polling() {
if (uiCfg.print_state == PAUSING) {
#if ENABLED(SDSUPPORT)
if (!planner.has_blocks_queued() && card.getIndex() > MIN_FILE_PRINTED) //<2F><><EFBFBD><EFBFBD> <20>ļ<EFBFBD><C4BC><EFBFBD> M109<30><39>M190ָ<30><D6B8>
uiCfg.waitEndMoves++;
if (uiCfg.waitEndMoves > 20) {
uiCfg.waitEndMoves = 0;
planner.synchronize();
gcode.process_subcommands_now_P(PSTR("M25\nG91\nG1 Z5\nG90"));
uiCfg.print_state = PAUSED;
//#if ENABLED(POWER_LOSS_RECOVERY)
// if (recovery.enabled) recovery.save(true);
//#endif
gCfgItems.pause_reprint = 1;
update_spi_flash();
}
#endif
}
else {
uiCfg.waitEndMoves = 0;
}
if (uiCfg.print_state == PAUSED) {
}
if (uiCfg.print_state == RESUMING) {
if (IS_SD_PAUSED()) {
gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90\nM24"));
uiCfg.print_state = WORKING;
start_print_time();
gCfgItems.pause_reprint = 0;
update_spi_flash();
}
}
#if ENABLED(POWER_LOSS_RECOVERY)
if (uiCfg.print_state == REPRINTED) {
memset(public_buf_m, 0, sizeof(public_buf_m));
#if HOTENDS
HOTEND_LOOP() {
const int16_t et = recovery.info.target_temperature[e];
if (et) {
#if HOTENDS > 1
sprintf_P(public_buf_m, PSTR("T%i"), e);
gcode.process_subcommands_now(public_buf_m);
#endif
sprintf_P(public_buf_m, PSTR("M109 S%i"), et);
gcode.process_subcommands_now(public_buf_m);
}
}
#endif
if (gCfgItems.pause_reprint == 1)
gcode.process_subcommands_now_P(PSTR("G91\nG1 Z-5\nG90"));
recovery.resume();
uiCfg.print_state = WORKING;
start_print_time();
gCfgItems.pause_reprint = 0;
update_spi_flash();
}
#endif
if (uiCfg.print_state == WORKING)
filament_check();
}
void filament_pin_setup() {
#if PIN_EXISTS(MT_DET_1)
pinMode(MT_DET_1_PIN, INPUT_PULLUP);
#endif
#if PIN_EXISTS(MT_DET_2)
pinMode(MT_DET_2_PIN, INPUT_PULLUP);
#endif
#if PIN_EXISTS(MT_DET_3)
pinMode(MT_DET_3_PIN, INPUT_PULLUP);
#endif
}
void filament_check() {
const int FIL_DELAY = 20;
#if PIN_EXISTS(MT_DET_1)
static int fil_det_count_1 = 0;
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (fil_det_count_1 > 0)
fil_det_count_1--;
if (!READ(MT_DET_1_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (READ(MT_DET_1_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_1++;
else if (fil_det_count_1 > 0)
fil_det_count_1--;
#endif
#if PIN_EXISTS(MT_DET_2)
static int fil_det_count_2 = 0;
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (fil_det_count_2 > 0)
fil_det_count_2--;
if (!READ(MT_DET_2_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (READ(MT_DET_2_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_2++;
else if (fil_det_count_2 > 0)
fil_det_count_2--;
#endif
#if PIN_EXISTS(MT_DET_3)
static int fil_det_count_3 = 0;
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (fil_det_count_3 > 0)
fil_det_count_3--;
if (!READ(MT_DET_3_PIN) && !MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (READ(MT_DET_3_PIN) && MT_DET_PIN_INVERTING)
fil_det_count_3++;
else if (fil_det_count_3 > 0)
fil_det_count_3--;
#endif
if (
#if PIN_EXISTS(MT_DET_1)
fil_det_count_1 >= FIL_DELAY
#else
false
#endif
#if PIN_EXISTS(MT_DET_2)
|| fil_det_count_2 >= FIL_DELAY
#endif
#if PIN_EXISTS(MT_DET_3)
|| fil_det_count_3 >= FIL_DELAY
#endif
) {
clear_cur_ui();
card.pauseSDPrint();
stop_print_time();
uiCfg.print_state = PAUSING;
if (gCfgItems.from_flash_pic == 1)
flash_preview_begin = 1;
else
default_preview_flg = 1;
lv_draw_printing();
}
}
#endif // TFT_LVGL_UI

View file

@ -22,13 +22,13 @@
#pragma once
//****************英文***************************//
#define MACHINE_CONFIG_EN "Machine\nSettings"
#define MACHINE_CONFIG_EN "Config"
#define NEXT_EN "Next"
#define PREVIOUS_EN "Previous"
#define DEFAULT_EN "Default"
#define KEY_BACK_EN "Del"
#define KEY_REST_EN "Rest"
#define KEY_REST_EN "Reset"
#define KEY_CONFIRM_EN "Confirm"
#define KEYBOARD_KEY0_EN "0"
@ -44,12 +44,11 @@
#define KEYBOARD_KEY_POINT_EN "."
#define KEYBOARD_KEY_NEGATIVE_EN "-"
#define MACHINE_PARA_EN "Machine\nsettings"
#define MACHINE_PARA_TITLE_EN "Machine settings"
#define MACHINE_TYPE_CNOFIG_EN "Machine"
#define TEMPERATURE_CONFIG_EN "Temperature"
#define MOTOR_CONFIG_EN "Motor"
#define ADVANCE_CONFIG_EN "Adavance"
#define MACHINE_PARA_TITLE_EN "Config"
#define MACHINE_TYPE_CNOFIG_EN "Machine settings"
#define TEMPERATURE_CONFIG_EN "Temperature settings"
#define MOTOR_CONFIG_EN "Motor settings"
#define ADVANCE_CONFIG_EN "Adavance settings"
#define MACHINE_CONFIG_TITLE_EN "Machine Settings"
#define MACHINE_TYPE_EN "Machine type"
@ -158,6 +157,8 @@
#define ACCELERATION_CONF_EN "Acceleration settings"
#define JERKCONF_EN "Jerk settings"
#define STEPSCONF_EN "Steps settings"
#define TMC_CURRENT_EN "TMC Current settings"
#define TMC_STEP_MODE_EN "TMC Step mode settings"
#define MOTORDIRCONF_EN "Motor direction settings"
#define HOMEFEEDRATECONF_EN "Home speed setting"
@ -191,6 +192,20 @@
#define E0_STEPS_EN "E0-axis steps"
#define E1_STEPS_EN "E1-axis steps"
#define TMC_CURRENT_CONF_TITLE_EN "Machine Settings>TMC current settings"
#define X_TMC_CURRENT_EN "X axis current (mA)"
#define Y_TMC_CURRENT_EN "Y axis current (mA)"
#define Z_TMC_CURRENT_EN "Z axis current (mA)"
#define E0_TMC_CURRENT_EN "E0 axis current (mA)"
#define E1_TMC_CURRENT_EN "E1 axis current (mA)"
#define TMC_MODE_CONF_TITLE_EN "Machine Settings>TMC step mode settings"
#define X_TMC_MODE_EN "Whether X axis enable stealthChop modes"
#define Y_TMC_MODE_EN "Whether Y axis enable stealthChop modes"
#define Z_TMC_MODE_EN "Whether Z axis enable stealthChop modes"
#define E0_TMC_MODE_EN "Whether E0 axis enable stealthChop modes"
#define E1_TMC_MODE_EN "Whether E1 axis enable stealthChop modes"
#define MOTORDIR_CONF_TITLE_EN "Machine Settings>Motor direction"
#define X_MOTORDIR_EN "X-axis motor direction invert"
#define Y_MOTORDIR_EN "Y-axis motor direction invert"
@ -223,6 +238,11 @@
#define Z_ENABLE_PINS_INVERT_EN "Z_ENABLE_PIN_INVERT"
#define E_ENABLE_PINS_INVERT_EN "E_ENABLE_PIN_INVERT"
#define PAUSE_POSITION_EN "Printing pause position settings"
#define PAUSE_POSITION_X_EN "X axis position (Absolute position,-1 invalid)"
#define PAUSE_POSITION_Y_EN "Y axis position (Absolute position,-1 invalid)"
#define PAUSE_POSITION_Z_EN "Z axis position (Relative position,-1 invalid)"
#define TOOL_TEXT_EN "Tool"
#define PREHEAT_TEXT_EN "Preheat"
#define MOVE_TEXT_EN "Move"
@ -299,6 +319,8 @@
#define MOTOR_OFF_TEXT_EN "Motor-off"
#define MOTOR_OFF_XY_TEXT_EN "Off-XY"
#define SHUTDOWN_TEXT_EN "Shutdown"
#define MACHINE_PARA_EN "Config"
#define EEPROM_SETTINGS_EN "Eeprom Set"
#define U_DISK_TEXT_EN "USB"
#define SD_CARD_TEXT_EN "SD"
@ -368,8 +390,8 @@
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_EN "Unload filament completed,\nclick <confirm> for return!"
#define PRE_HEAT_EXT_TEXT_EN "E"
#define PRE_HEAT_BED_TEXT_EN "Bed"
#define PRE_HEAT_EXT_TEXT_EN "E"
#define PRE_HEAT_BED_TEXT_EN "Bed"
#define FILE_LOADING_EN "Loading......"
#if 0
@ -703,16 +725,24 @@
#define PRINTING_OPERATION_OTHER_LANGUGE "Operation"
#define PRINTING_PAUSE_OTHER_LANGUGE "Pause"
#define MESSEGE_PAUSING_EN "Parking..."
#define MESSEGE_CHANGING_EN "Wait for filament change to start"
#define MESSEGE_UNLOAD_EN "Wait for filament unload"
#define MESSEGE_WAITING_EN "Press Button to resume print"
#define MESSEGE_INSERT_EN "Insert filament and press button to continue"
#define MESSEGE_LOAD_EN "Wait for filament load"
#define MESSEGE_PURGE_EN "Wait for filament purge"
#define MESSEGE_RESUME_EN "Wait for print to resume..."
#define MESSEGE_HEAT_EN "Press button to heat nozzle"
#define MESSEGE_HEATING_EN "Nozzle heating Please wait..."
#define MESSEGE_OPTION_EN "Purge more or continue print?"
#define MESSEGE_PURGE_MORE_EN "Purge"
#define MESSEGE_CONTINUE_PRINT_EN "Print"
#define MESSAGE_PAUSING_EN "Parking..."
#define MESSAGE_CHANGING_EN "Wait for filament change to start"
#define MESSAGE_UNLOAD_EN "Wait for filament unload"
#define MESSAGE_WAITING_EN "Press Button to resume print"
#define MESSAGE_INSERT_EN "Insert filament and press button to continue"
#define MESSAGE_LOAD_EN "Wait for filament load"
#define MESSAGE_PURGE_EN "Wait for filament purge"
#define MESSAGE_RESUME_EN "Wait for print to resume..."
#define MESSAGE_HEAT_EN "Press button to heat nozzle"
#define MESSAGE_HEATING_EN "Nozzle heating Please wait..."
#define MESSAGE_OPTION_EN "Purge more or continue print?"
#define MESSAGE_PURGE_MORE_EN "Purge"
#define MESSAGE_CONTINUE_PRINT_EN "Print"
#define EEPROM_SETTINGS_TITLE_EN "EEPROM Settings"
#define EEPROM_SETTINGS_STORE_EN "Store settings to EEPROM"
#define EEPROM_SETTINGS_READ_EN "Read settings from EEPROM"
#define EEPROM_SETTINGS_REVERT_EN "Revert settings to factory defaults"
#define EEPROM_STORE_TIPS_EN "Store settings to EEPROM?"
#define EEPROM_READ_TIPS_EN "Read settings from EEPROM?"
#define EEPROM_REVERT_TIPS_EN "Revert settings to factory defaults?"

View file

@ -98,6 +98,8 @@
#define MOTOR_OFF_TEXT_FR "M-hors"
#define MOTOR_OFF_XY_TEXT_FR "M-hors-XY"
#define SHUTDOWN_TEXT_FR "Eteindre"
#define MACHINE_PARA_FR "Config"
#define EEPROM_SETTINGS_FR "Eeprom Set"
#define U_DISK_TEXT_FR "Clé usb"
#define SD_CARD_TEXT_FR "Carte SD"
@ -249,28 +251,36 @@
#define DIALOG_CANCEL_PRINT_FR "Arrêter?"
#define DIALOG_STOP_FR "Arrêter"
#define DIALOG_REPRINT_FROM_BREAKPOINT_FR "Continuer?"
//#define DIALOG_UNBIND_PRINTER_FR "Non lié?"
#define DIALOG_ERROR_TIPS1_FR "Erreur:error:Aucun fichier, \nvérifiez à nouveau."
#define DIALOG_ERROR_TIPS2_FR "Erreur:La opération a échoué. \nVerifiez que le baudrate de l'écran et de \nla carte mère soient identique!"
#define DIALOG_ERROR_TIPS3_FR "Erreur: le nom du fichier ou le \nchemin d'accès est trop long."
#define DIALOG_UNBIND_PRINTER_FR "Unbind the printer?"
#define DIALOG_FILAMENT_NO_PRESS_FR "Filament detection switch is not pressed"
#define DIALOG_PRINT_FINISH_FR "L'impression est terminée!"
#define DIALOG_PRINT_TIME_FR "Temps d'impression: "
#define DIALOG_REPRINT_FR "Print again"
#define DIALOG_WIFI_ENABLE_TIPS_FR "The wifi module is being configured,\nplease wait a moment....."
#define DIALOG_REPRINT_FROM_BREAKPOINT_FR "Continuer?"
//#define DIALOG_UNBIND_PRINTER_FR "Non lié?"
#define DIALOG_ERROR_TIPS1_FR "Erreur:error:Aucun fichier, \nvérifiez à nouveau."
#define DIALOG_ERROR_TIPS2_FR "Erreur:La opération a échoué. \nVerifiez que le baudrate de l'écran et de \nla carte mère soient identique!"
#define DIALOG_ERROR_TIPS3_FR "Erreur: le nom du fichier ou le \nchemin d'accès est trop long."
#define DIALOG_UNBIND_PRINTER_FR "Unbind the printer?"
#define DIALOG_FILAMENT_NO_PRESS_FR "Filament detection switch is not pressed"
#define DIALOG_PRINT_FINISH_FR "L'impression est terminée!"
#define DIALOG_PRINT_TIME_FR "Temps d'impression: "
#define DIALOG_REPRINT_FR "Print again"
#define DIALOG_WIFI_ENABLE_TIPS_FR "The wifi module is being configured,\nplease wait a moment....."
#define MESSEGE_PAUSING_FR "Parking..."
#define MESSEGE_CHANGING_FR "Attente filament pour démarrer"
#define MESSEGE_UNLOAD_FR "Attente retrait du filament"
#define MESSEGE_WAITING_FR "Presser bouton,pour reprendre"
#define MESSEGE_INSERT_FR "Insérer filament et app. bouton pour continuer..."
#define MESSEGE_LOAD_FR "Attente chargement filament"
#define MESSEGE_PURGE_FR "Attente Purge filament"
#define MESSEGE_RESUME_FR "Attente reprise impression"
#define MESSEGE_HEAT_FR "Presser le bouton pour chauffer..."
#define MESSEGE_HEATING_FR "Buse en chauffe Patienter SVP..."
#define MESSEGE_OPTION_FR "Purger davantage ou continuer l'impression?"
#define MESSEGE_PURGE_MORE_FR "Purge"
#define MESSEGE_CONTINUE_PRINT_FR "Impression"
#define MESSAGE_PAUSING_FR "Parking..."
#define MESSAGE_CHANGING_FR "Attente filament pour démarrer"
#define MESSAGE_UNLOAD_FR "Attente retrait du filament"
#define MESSAGE_WAITING_FR "Presser bouton,pour reprendre"
#define MESSAGE_INSERT_FR "Insérer filament et app. bouton pour continuer..."
#define MESSAGE_LOAD_FR "Attente chargement filament"
#define MESSAGE_PURGE_FR "Attente Purge filament"
#define MESSAGE_RESUME_FR "Attente reprise impression"
#define MESSAGE_HEAT_FR "Presser le bouton pour chauffer..."
#define MESSAGE_HEATING_FR "Buse en chauffe Patienter SVP..."
#define MESSAGE_OPTION_FR "Purger davantage ou continuer l'impression?"
#define MESSAGE_PURGE_MORE_FR "Purge"
#define MESSAGE_CONTINUE_PRINT_FR "Impression"
#define EEPROM_SETTINGS_TITLE_FR "Paramètres EEPROM"
#define EEPROM_SETTINGS_STORE_FR "Stocker les paramètres dans l'EEPROM"
#define EEPROM_SETTINGS_READ_FR "Lire les paramètres de l'EEPROM"
#define EEPROM_SETTINGS_REVERT_FR "Rétablir les paramètres par défaut d'usine"
#define EEPROM_STORE_TIPS_FR "Stocker les paramètres dans l'EEPROM?"
#define EEPROM_READ_TIPS_FR "Lire les paramètres de l'EEPROM?"
#define EEPROM_REVERT_TIPS_FR "Rétablir les paramètres par défaut d'usine?"

View file

@ -22,250 +22,260 @@
#pragma once
//****************意大利语***************************//
#define TOOL_TEXT_IT "Strumento"
#define PREHEAT_TEXT_IT "Prerisc"
#define MOVE_TEXT_IT "Muovi"
#define HOME_TEXT_IT "Home"
#define PRINT_TEXT_IT "Stampa"
#define EXTRUDE_TEXT_IT "Estrude"
#define LEVELING_TEXT_IT "Leveling"
#define AUTO_LEVELING_TEXT_IT "AutoLevel"
#define SET_TEXT_IT "Imposta"
#define MORE_TEXT_IT "Di più"
#define TOOL_TEXT_IT "Strumento"
#define PREHEAT_TEXT_IT "Prerisc"
#define MOVE_TEXT_IT "Muovi"
#define HOME_TEXT_IT "Home"
#define PRINT_TEXT_IT "Stampa"
#define EXTRUDE_TEXT_IT "Estrude"
#define LEVELING_TEXT_IT "Leveling"
#define AUTO_LEVELING_TEXT_IT "AutoLevel"
#define SET_TEXT_IT "Imposta"
#define MORE_TEXT_IT "Di più"
#define ADD_TEXT_IT "Aumentare"
#define DEC_TEXT_IT "Ridurre"
#define EXTRUDER_1_TEXT_IT "Estrude1"
#define EXTRUDER_2_TEXT_IT "Estrude2"
#define HEATBED_TEXT_IT "Piano"
#define TEXT_1C_IT "1℃"
#define TEXT_5C_IT "5℃"
#define TEXT_10C_IT "10℃"
#define CLOSE_TEXT_IT "Spento"
#define ADD_TEXT_IT "Aumentare"
#define DEC_TEXT_IT "Ridurre"
#define EXTRUDER_1_TEXT_IT "Estrude1"
#define EXTRUDER_2_TEXT_IT "Estrude2"
#define HEATBED_TEXT_IT "Piano"
#define TEXT_1C_IT "1℃"
#define TEXT_5C_IT "5℃"
#define TEXT_10C_IT "10℃"
#define CLOSE_TEXT_IT "Spento"
#define BACK_TEXT_IT "Indietro"
#define BACK_TEXT_IT "Indietro"
#define TOOL_PREHEAT_IT "Prerisc"
#define TOOL_EXTRUDE_IT "Estrude"
#define TOOL_MOVE_IT "Muovi"
#define TOOL_HOME_IT "Home"
#define TOOL_LEVELING_IT "Leveling"
#define TOOL_PREHEAT_IT "Prerisc"
#define TOOL_EXTRUDE_IT "Estrude"
#define TOOL_MOVE_IT "Muovi"
#define TOOL_HOME_IT "Home"
#define TOOL_LEVELING_IT "Leveling"
#define TOOL_AUTO_LEVELING_IT "Autolevel"
#define TOOL_FILAMENT_IT "Filamento"
#define TOOL_MORE_IT "Di più"
#define TOOL_FILAMENT_IT "Filamento"
#define TOOL_MORE_IT "Di più"
#define AXIS_X_ADD_TEXT_IT "X+"
#define AXIS_X_DEC_TEXT_IT "X-"
#define AXIS_Y_ADD_TEXT_IT "Y+"
#define AXIS_Y_DEC_TEXT_IT "Y-"
#define AXIS_Z_ADD_TEXT_IT "Z+"
#define AXIS_Z_DEC_TEXT_IT "Z-"
#define TEXT_01MM_IT "0.1mm"
#define TEXT_1MM_IT "1mm"
#define TEXT_10MM_IT "10mm"
#define AXIS_X_ADD_TEXT_IT "X+"
#define AXIS_X_DEC_TEXT_IT "X-"
#define AXIS_Y_ADD_TEXT_IT "Y+"
#define AXIS_Y_DEC_TEXT_IT "Y-"
#define AXIS_Z_ADD_TEXT_IT "Z+"
#define AXIS_Z_DEC_TEXT_IT "Z-"
#define TEXT_01MM_IT "0.1mm"
#define TEXT_1MM_IT "1mm"
#define TEXT_10MM_IT "10mm"
#define HOME_X_TEXT_IT "X"
#define HOME_Y_TEXT_IT "Y"
#define HOME_Z_TEXT_IT "Z"
#define HOME_ALL_TEXT_IT "All"
#define HOME_STOPMOVE_IT "Quickstop"
#define HOME_X_TEXT_IT "X"
#define HOME_Y_TEXT_IT "Y"
#define HOME_Z_TEXT_IT "Z"
#define HOME_ALL_TEXT_IT "All"
#define HOME_STOPMOVE_IT "Quickstop"
#define PAGE_UP_TEXT_IT "Pagina su"
#define PAGE_DOWN_TEXT_IT "Pagina giù"
#define PAGE_UP_TEXT_IT "Pagina su"
#define PAGE_DOWN_TEXT_IT "Pagina giù"
#define EXTRUDER_IN_TEXT_IT "Estru"
#define EXTRUDER_OUT_TEXT_IT "Ritra"
#define EXTRUDE_1MM_TEXT_IT "1mm"
#define EXTRUDE_5MM_TEXT_IT "5mm"
#define EXTRUDE_10MM_TEXT_IT "10mm"
#define EXTRUDE_LOW_SPEED_TEXT_IT "Bassa"
#define EXTRUDE_MEDIUM_SPEED_TEXT_IT "Media"
#define EXTRUDE_HIGH_SPEED_TEXT_IT "Alta"
#define EXTRUDER_IN_TEXT_IT "Estru"
#define EXTRUDER_OUT_TEXT_IT "Ritra"
#define EXTRUDE_1MM_TEXT_IT "1mm"
#define EXTRUDE_5MM_TEXT_IT "5mm"
#define EXTRUDE_10MM_TEXT_IT "10mm"
#define EXTRUDE_LOW_SPEED_TEXT_IT "Bassa"
#define EXTRUDE_MEDIUM_SPEED_TEXT_IT "Media"
#define EXTRUDE_HIGH_SPEED_TEXT_IT "Alta"
#define LEVELING_POINT1_TEXT_IT "Primo"
#define LEVELING_POINT2_TEXT_IT "Secondo"
#define LEVELING_POINT3_TEXT_IT "Terzo"
#define LEVELING_POINT4_TEXT_IT "Quarto"
#define LEVELING_POINT5_TEXT_IT "Quinto"
#define LEVELING_POINT1_TEXT_IT "Primo"
#define LEVELING_POINT2_TEXT_IT "Secondo"
#define LEVELING_POINT3_TEXT_IT "Terzo"
#define LEVELING_POINT4_TEXT_IT "Quarto"
#define LEVELING_POINT5_TEXT_IT "Quinto"
#define FILESYS_TEXT_IT "FileSys"
#define WIFI_TEXT_IT "WIFI"
#define FAN_TEXT_IT "Ventola"
#define ABOUT_TEXT_IT "Circa"
#define BREAK_POINT_TEXT_IT "Continua"
#define FILAMENT_TEXT_IT "Filamento"
#define LANGUAGE_TEXT_IT "Lingua"
#define MOTOR_OFF_TEXT_IT "Motor off"
#define MOTOR_OFF_XY_TEXT_IT "Off-XY"
#define SHUTDOWN_TEXT_IT "Spento"
#define FILESYS_TEXT_IT "FileSys"
#define WIFI_TEXT_IT "WIFI"
#define FAN_TEXT_IT "Ventola"
#define ABOUT_TEXT_IT "Circa"
#define BREAK_POINT_TEXT_IT "Continua"
#define FILAMENT_TEXT_IT "Filamento"
#define LANGUAGE_TEXT_IT "Lingua"
#define MOTOR_OFF_TEXT_IT "Motor off"
#define MOTOR_OFF_XY_TEXT_IT "Off-XY"
#define SHUTDOWN_TEXT_IT "Spento"
#define MACHINE_PARA_IT "Config"
#define EEPROM_SETTINGS_IT "Eeprom Set"
#define U_DISK_TEXT_IT "USB"
#define SD_CARD_TEXT_IT "SD"
#define WIFI_NAME_TEXT_IT "WIFI: "
#define WIFI_KEY_TEXT_IT "KEY: "
#define WIFI_IP_TEXT_IT "IP: "
#define WIFI_AP_TEXT_IT "Stato: AP"
#define WIFI_STA_TEXT_IT "Stato: STA"
#define WIFI_CONNECTED_TEXT_IT "Connesso"
#define WIFI_DISCONNECTED_TEXT_IT "Disconnesso"
#define WIFI_EXCEPTION_TEXT_IT "Eccezione"
#define WIFI_RECONNECT_TEXT_IT "Reconnect"
#define CLOUD_TEXT_IT "Cloud"
#define CLOUD_BIND_IT "Legato"
#define CLOUD_UNBIND_IT "Libero"
#define CLOUD_DISCONNECTED_IT "Disconnesso"
#define CLOUD_UNBINDING_IT "Libero"
#define CLOUD_UNBINDED_IT "Sciolto"
#define CLOUD_BINDED_IT "Legato"
#define CLOUD_DISABLE_IT "Disable"
#define U_DISK_TEXT_IT "USB"
#define SD_CARD_TEXT_IT "SD"
#define WIFI_NAME_TEXT_IT "WIFI: "
#define WIFI_KEY_TEXT_IT "KEY: "
#define WIFI_IP_TEXT_IT "IP: "
#define WIFI_AP_TEXT_IT "Stato: AP"
#define WIFI_STA_TEXT_IT "Stato: STA"
#define WIFI_CONNECTED_TEXT_IT "Connesso"
#define WIFI_DISCONNECTED_TEXT_IT "Disconnesso"
#define WIFI_EXCEPTION_TEXT_IT "Eccezione"
#define WIFI_RECONNECT_TEXT_IT "Reconnect"
#define CLOUD_TEXT_IT "Cloud"
#define CLOUD_BIND_IT "Legato"
#define CLOUD_UNBIND_IT "Libero"
#define CLOUD_DISCONNECTED_IT "Disconnesso"
#define CLOUD_UNBINDING_IT "Libero"
#define CLOUD_UNBINDED_IT "Sciolto"
#define CLOUD_BINDED_IT "Legato"
#define CLOUD_DISABLE_IT "Disable"
#define FAN_ADD_TEXT_IT "Aumentare"
#define FAN_DEC_TEXT_IT "Ridurre"
#define FAN_OPEN_TEXT_IT "100%"
#define FAN_HALF_TEXT_IT "50%"
#define FAN_CLOSE_TEXT_IT "Spento"
#define FAN_TIPS1_TEXT_IT "Ventola"
#define FAN_TIPS2_TEXT_IT "Ventola\n0"
#define FAN_ADD_TEXT_IT "Aumentare"
#define FAN_DEC_TEXT_IT "Ridurre"
#define FAN_OPEN_TEXT_IT "100%"
#define FAN_HALF_TEXT_IT "50%"
#define FAN_CLOSE_TEXT_IT "Spento"
#define FAN_TIPS1_TEXT_IT "Ventola"
#define FAN_TIPS2_TEXT_IT "Ventola\n0"
#define FILAMENT_IN_TEXT_IT "Inser"
#define FILAMENT_OUT_TEXT_IT "Estra"
#define FILAMENT_EXT0_TEXT_IT "Estrude1"
#define FILAMENT_EXT1_TEXT_IT "Estrude2"
#define FILAMENT_HEAT_TEXT_IT "Preriscaldamento"
#define FILAMENT_STOP_TEXT_IT "Stop"
//#define FILAMENT_CHANGE_TEXT_IT "Filamento"
#define FILAMENT_TIPS2_TEXT_IT "T:"
#define FILAMENT_TIPS3_TEXT_IT "Inserimento del filamento..."
#define FILAMENT_TIPS4_TEXT_IT "Estrazione del filamento..."
#define FILAMENT_TIPS5_TEXT_IT "Temp is too low to go,please heat"
#define FILAMENT_TIPS6_TEXT_IT "Completato"
#define FILAMENT_IN_TEXT_IT "Inser"
#define FILAMENT_OUT_TEXT_IT "Estra"
#define FILAMENT_EXT0_TEXT_IT "Estrude1"
#define FILAMENT_EXT1_TEXT_IT "Estrude2"
#define FILAMENT_HEAT_TEXT_IT "Preriscaldamento"
#define FILAMENT_STOP_TEXT_IT "Stop"
//#define FILAMENT_CHANGE_TEXT_IT "Filamento"
#define FILAMENT_TIPS2_TEXT_IT "T:"
#define FILAMENT_TIPS3_TEXT_IT "Inserimento del filamento..."
#define FILAMENT_TIPS4_TEXT_IT "Estrazione del filamento..."
#define FILAMENT_TIPS5_TEXT_IT "Temp is too low to go,please heat"
#define FILAMENT_TIPS6_TEXT_IT "Completato"
#if 0
#define FILAMENT_REPLAYS_IDLE_TEXT_IT "Please click <Estru> or <Ritra> \nto replace filament!"
#define FILAMENT_CHANGE_TEXT_IT "Please click <Estru> or <Ritra>,\nAfter pinter pause."
#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT "Heat completed,please load filament to extruder,and click <Conferma> for start loading."
#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT "Please load filament to extruder,and click <Conferma> for start loading."
#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT "Heat completed,please click <Conferma> for start unloading.!"
#define FILAMENT_DIALOG_LOADING_TIPS_IT "Is loading ,please wait!"
#define FILAMENT_DIALOG_UNLOADING_TIPS_IT "Is unloading,please wait!"
#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT "Load filament completed,click <Conferma> for return!"
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT "Unload filament completed,click <Conferma> for return!"
#define FILAMENT_REPLAYS_IDLE_TEXT_IT "Please click <Estru> or <Ritra> \nto replace filament!"
#define FILAMENT_CHANGE_TEXT_IT "Please click <Estru> or <Ritra>,\nAfter pinter pause."
#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT "Heat completed,please load filament to extruder,and click <Conferma> for start loading."
#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT "Please load filament to extruder,and click <Conferma> for start loading."
#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT "Heat completed,please click <Conferma> for start unloading.!"
#define FILAMENT_DIALOG_LOADING_TIPS_IT "Is loading ,please wait!"
#define FILAMENT_DIALOG_UNLOADING_TIPS_IT "Is unloading,please wait!"
#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT "Load filament completed,click <Conferma> for return!"
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT "Unload filament completed,click <Conferma> for return!"
#endif
#define FILAMENT_CHANGE_TEXT_IT "Please click <Load> \nor <unload>,After \npinter pause."
#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT "Please load filament to extruder,\nand click <confirm> for start loading."
#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT "Heat completed,please \nclick <confirm> for start unloading.!"
#define FILAMENT_DIALOG_LOADING_TIPS_IT "Is loading ,please wait!"
#define FILAMENT_DIALOG_UNLOADING_TIPS_IT "Is unloading,please wait!"
#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT "Load filament completed,\nclick <confirm> for return!"
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT "Unload filament completed,\nclick <confirm> for return!"
#define FILAMENT_CHANGE_TEXT_IT "Please click <Load> \nor <unload>,After \npinter pause."
#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_IT "Heating up the nozzle,please wait..."
#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_IT "Heat completed,please load filament \nto extruder,and click <confirm> \nfor start loading."
#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_IT "Please load filament to extruder,\nand click <confirm> for start loading."
#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_IT "Heat completed,please \nclick <confirm> for start unloading.!"
#define FILAMENT_DIALOG_LOADING_TIPS_IT "Is loading ,please wait!"
#define FILAMENT_DIALOG_UNLOADING_TIPS_IT "Is unloading,please wait!"
#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_IT "Load filament completed,\nclick <confirm> for return!"
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_IT "Unload filament completed,\nclick <confirm> for return!"
#define PRE_HEAT_EXT_TEXT_IT "E"
#define PRE_HEAT_BED_TEXT_IT "Piano"
#define PRE_HEAT_EXT_TEXT_IT "E"
#define PRE_HEAT_BED_TEXT_IT "Piano"
#define FILE_LOADING_IT "Caricamento......"
#define FILE_LOADING_IT "Caricamento......"
#if 0
#define NO_FILE_AND_CHECK_IT "Nessun file trovato! Inserisci la scheda SD o il disco U!"
#define NO_FILE_AND_CHECK_IT "Nessun file trovato! Inserisci la scheda SD o il disco U!"
#endif
#define NO_FILE_AND_CHECK_IT "Nessun file,\n per favore controllare di nuovo!"
#define NO_FILE_AND_CHECK_IT "Nessun file,\n per favore controllare di nuovo!"
#define NO_FILE_IT "Nessun file!"
#define NO_FILE_IT "Nessun file!"
#define EXTRUDER_TEMP_TEXT_IT "Temper"
#define EXTRUDER_E_LENGTH1_TEXT_IT "Estrude1"
#define EXTRUDER_E_LENGTH2_TEXT_IT "Estrude2"
#define EXTRUDER_E_LENGTH3_TEXT_IT "Estrude3"
#define EXTRUDER_TEMP_TEXT_IT "Temper"
#define EXTRUDER_E_LENGTH1_TEXT_IT "Estrude1"
#define EXTRUDER_E_LENGTH2_TEXT_IT "Estrude2"
#define EXTRUDER_E_LENGTH3_TEXT_IT "Estrude3"
#define ABOUT_TYPE_TEXT_IT "Type: "
#define ABOUT_VERSION_TEXT_IT "Firmware: "
#define ABOUT_WIFI_TEXT_IT "WiFi: "
#define ABOUT_TYPE_TEXT_IT "Type: "
#define ABOUT_VERSION_TEXT_IT "Firmware: "
#define ABOUT_WIFI_TEXT_IT "WiFi: "
#define PRINTING_OPERATION_IT "Opzioni"
#define PRINTING_PAUSE_IT "Pause"
#define PRINTING_TEMP_IT "Temp."
#define PRINTING_CHANGESPEED_IT "Velocità"
#define PRINTING_RESUME_IT "Recupero"
#define PRINTING_STOP_IT "Stop"
#define PRINTING_MORE_IT "Di più"
#define PRINTING_EXTRUDER_IT "Estrude"
#define PRINTING_MOVE_IT "Muovi"
#define PRINTING_OPERATION_IT "Opzioni"
#define PRINTING_PAUSE_IT "Pause"
#define PRINTING_TEMP_IT "Temp."
#define PRINTING_CHANGESPEED_IT "Velocità"
#define PRINTING_RESUME_IT "Recupero"
#define PRINTING_STOP_IT "Stop"
#define PRINTING_MORE_IT "Di più"
#define PRINTING_EXTRUDER_IT "Estrude"
#define PRINTING_MOVE_IT "Muovi"
#define EXTRUDER_SPEED_IT "Estrude"
#define MOVE_SPEED_IT "Muovi"
#define EXTRUDER_SPEED_STATE_IT "Estrusione"
#define MOVE_SPEED_STATE_IT "Movimento"
#define STEP_1PERCENT_IT "1%"
#define STEP_5PERCENT_IT "5%"
#define STEP_10PERCENT_IT "10%"
#define EXTRUDER_SPEED_IT "Estrude"
#define MOVE_SPEED_IT "Muovi"
#define EXTRUDER_SPEED_STATE_IT "Estrusione"
#define MOVE_SPEED_STATE_IT "Movimento"
#define STEP_1PERCENT_IT "1%"
#define STEP_5PERCENT_IT "5%"
#define STEP_10PERCENT_IT "10%"
#define ZOFFSET_IT "Z Offset"
#define ZOFFSET_INC_IT "Add"
#define ZOFFSET_DEC_IT "Dec"
#define ZOFFSET_IT "Z Offset"
#define ZOFFSET_INC_IT "Add"
#define ZOFFSET_DEC_IT "Dec"
#define TITLE_READYPRINT_IT "Pronto"
#define TITLE_PREHEAT_IT "Preris"
#define TITLE_MOVE_IT "Muovi"
#define TITLE_HOME_IT "Home"
#define TITLE_EXTRUDE_IT "Estrude"
#define TITLE_LEVELING_IT "Livella"
#define TITLE_SET_IT "Impostare"
#define TITLE_MORE_IT "Di più"
#define TITLE_CHOOSEFILE_IT "File"
#define TITLE_PRINTING_IT "Stampa"
#define TITLE_OPERATION_IT "Opzioni"
#define TITLE_ADJUST_IT "Regolare"
#define TITLE_WIRELESS_IT "Wireless"
#define TITLE_FILAMENT_IT "Filamento"
#define TITLE_ABOUT_IT "Circa"
#define TITLE_FAN_IT "Ventola"
#define TITLE_LANGUAGE_IT "Lingua"
#define TITLE_PAUSE_IT "Pausa"
#define TITLE_CHANGESPEED_IT "Velocità"
#define TITLE_CLOUD_TEXT_IT "Cloud"
#define TITLE_DIALOG_CONFIRM_IT "Confirm"
#define TITLE_FILESYS_IT "FileSys"
#define TITLE_ZOFFSET_IT "Z Offset"
#define TITLE_READYPRINT_IT "Pronto"
#define TITLE_PREHEAT_IT "Preris"
#define TITLE_MOVE_IT "Muovi"
#define TITLE_HOME_IT "Home"
#define TITLE_EXTRUDE_IT "Estrude"
#define TITLE_LEVELING_IT "Livella"
#define TITLE_SET_IT "Impostare"
#define TITLE_MORE_IT "Di più"
#define TITLE_CHOOSEFILE_IT "File"
#define TITLE_PRINTING_IT "Stampa"
#define TITLE_OPERATION_IT "Opzioni"
#define TITLE_ADJUST_IT "Regolare"
#define TITLE_WIRELESS_IT "Wireless"
#define TITLE_FILAMENT_IT "Filamento"
#define TITLE_ABOUT_IT "Circa"
#define TITLE_FAN_IT "Ventola"
#define TITLE_LANGUAGE_IT "Lingua"
#define TITLE_PAUSE_IT "Pausa"
#define TITLE_CHANGESPEED_IT "Velocità"
#define TITLE_CLOUD_TEXT_IT "Cloud"
#define TITLE_DIALOG_CONFIRM_IT "Confirm"
#define TITLE_FILESYS_IT "FileSys"
#define TITLE_ZOFFSET_IT "Z Offset"
#define AUTO_SHUTDOWN_IT "Auto"
#define MANUAL_SHUTDOWN_IT "Manuale"
#define AUTO_SHUTDOWN_IT "Auto"
#define MANUAL_SHUTDOWN_IT "Manuale"
#define DIALOG_CONFIRM_IT "Conferma"
#define DIALOG_CANCLE_IT "Cancella"
#define DIALOG_OK_IT "OK"
#define DIALOG_RESET_IT "Resettare"
#define DIALOG_RETRY_IT "Riprovare"
#define DIALOG_DISABLE_IT "Disable"
#define DIALOG_PRINT_MODEL_IT "Gcode stampa?"
#define DIALOG_CANCEL_PRINT_IT "Stop stampa?"
#define DIALOG_STOP_IT "Stop"
#define DIALOG_REPRINT_FROM_BREAKPOINT_IT "Continua a stampare dal \npunto di interruzione?"
//#define DIALOG_UNBIND_PRINTER_IT "Libero?"
#define DIALOG_ERROR_TIPS1_IT "Errore: nessun file, \nper favore controllare di nuovo."
#define DIALOG_ERROR_TIPS2_IT "Errore: operazione non riuscita, \nsi prega di controllare se il baudrate del \ndisplay è lo stesso scheda madre"
#define DIALOG_ERROR_TIPS3_IT "Errore: il nome del file o il \npercorso è troppo lungo!"
#define DIALOG_CLOSE_MACHINE_IT "Closing machine......"
#define DIALOG_UNBIND_PRINTER_IT "Unbind the printer?"
#define DIALOG_FILAMENT_NO_PRESS_IT "Filament detection switch is not pressed"
#define DIALOG_PRINT_FINISH_IT "La stampa è completa!"
#define DIALOG_CONFIRM_IT "Conferma"
#define DIALOG_CANCLE_IT "Cancella"
#define DIALOG_OK_IT "OK"
#define DIALOG_RESET_IT "Resettare"
#define DIALOG_RETRY_IT "Riprovare"
#define DIALOG_DISABLE_IT "Disable"
#define DIALOG_PRINT_MODEL_IT "Gcode stampa?"
#define DIALOG_CANCEL_PRINT_IT "Stop stampa?"
#define DIALOG_STOP_IT "Stop"
#define DIALOG_REPRINT_FROM_BREAKPOINT_IT "Continua a stampare dal \npunto di interruzione?"
//#define DIALOG_UNBIND_PRINTER_IT "Libero?"
#define DIALOG_ERROR_TIPS1_IT "Errore: nessun file, \nper favore controllare di nuovo."
#define DIALOG_ERROR_TIPS2_IT "Errore: operazione non riuscita, \nsi prega di controllare se il baudrate del \ndisplay è lo stesso scheda madre"
#define DIALOG_ERROR_TIPS3_IT "Errore: il nome del file o il \npercorso è troppo lungo!"
#define DIALOG_CLOSE_MACHINE_IT "Closing machine......"
#define DIALOG_UNBIND_PRINTER_IT "Unbind the printer?"
#define DIALOG_FILAMENT_NO_PRESS_IT "Filament detection switch is not pressed"
#define DIALOG_PRINT_FINISH_IT "La stampa è completa!"
#define DIALOG_PRINT_TIME_IT "Tempo di stampa: "
#define DIALOG_REPRINT_IT "Print again"
#define DIALOG_WIFI_ENABLE_TIPS_IT "The wifi module is being configured,\nplease wait a moment....."
#define DIALOG_WIFI_ENABLE_TIPS_IT "The wifi module is being configured,\nplease wait a moment....."
#define MESSEGE_PAUSING_IT "Parcheggiando..."
#define MESSEGE_CHANGING_IT "Attendere avvio del cambio di filamento"
#define MESSEGE_UNLOAD_IT "Attendere l'espulsione del filamento"
#define MESSEGE_WAITING_IT "Premi per riprendere la stampa"
#define MESSEGE_INSERT_IT "Inserisci il filamento e premi per continuare"
#define MESSEGE_LOAD_IT "Attendere il caricamento del filamento"
#define MESSEGE_PURGE_IT "Attendere lo spurgo del filamento"
#define MESSEGE_RESUME_IT "Attendere la ripresa della stampa..."
#define MESSEGE_HEAT_IT "Premi per riscaldare ugello"
#define MESSEGE_HEATING_IT "Riscaldam. ugello Attendere prego..."
#define MESSEGE_OPTION_IT "Eliminare di più o continuare a stampare?"
#define MESSEGE_PURGE_MORE_IT "Epurazione"
#define MESSEGE_CONTINUE_PRINT_IT "Stampa"
#define MESSAGE_PAUSING_IT "Parcheggiando..."
#define MESSAGE_CHANGING_IT "Attendere avvio del cambio di filamento"
#define MESSAGE_UNLOAD_IT "Attendere l'espulsione del filamento"
#define MESSAGE_WAITING_IT "Premi per riprendere la stampa"
#define MESSAGE_INSERT_IT "Inserisci il filamento e premi per continuare"
#define MESSAGE_LOAD_IT "Attendere il caricamento del filamento"
#define MESSAGE_PURGE_IT "Attendere lo spurgo del filamento"
#define MESSAGE_RESUME_IT "Attendere la ripresa della stampa..."
#define MESSAGE_HEAT_IT "Premi per riscaldare ugello"
#define MESSAGE_HEATING_IT "Riscaldam. ugello Attendere prego..."
#define MESSAGE_OPTION_IT "Eliminare di più o continuare a stampare?"
#define MESSAGE_PURGE_MORE_IT "Epurazione"
#define MESSAGE_CONTINUE_PRINT_IT "Stampa"
#define EEPROM_SETTINGS_TITLE_IT "Impostazioni EEPROM"
#define EEPROM_SETTINGS_STORE_IT "Memorizzare le impostazioni su EEPROM"
#define EEPROM_SETTINGS_READ_IT "Leggi le impostazioni dalla EEPROM"
#define EEPROM_SETTINGS_REVERT_IT "Ripristina le impostazioni predefinite di fabbrica"
#define EEPROM_STORE_TIPS_IT "Memorizzare le impostazioni su EEPROM?"
#define EEPROM_READ_TIPS_IT "Leggi le impostazioni dalla EEPROM?"
#define EEPROM_REVERT_TIPS_IT "Ripristinare le impostazioni predefinite?"

View file

@ -98,6 +98,8 @@
#define MOTOR_OFF_TEXT_RU "отклмотор"
#define MOTOR_OFF_XY_TEXT_RU "Off-XY"
#define SHUTDOWN_TEXT_RU "выключение"
#define MACHINE_PARA_RU "конфиг"
#define EEPROM_SETTINGS_RU "Eeprom Set"
#define U_DISK_TEXT_RU "U диск"
#define SD_CARD_TEXT_RU "SD диск"
@ -257,16 +259,24 @@
#define DIALOG_REPRINT_RU "Print again"
#define DIALOG_WIFI_ENABLE_TIPS_RU "The wifi module is being configured,\nplease wait a moment....."
#define MESSEGE_PAUSING_RU "Стоянка..."
#define MESSEGE_CHANGING_RU "Подождите, пока начнется смена филамента"
#define MESSEGE_UNLOAD_RU "Дождитесь выгрузки нити"
#define MESSEGE_WAITING_RU "Нажмите кнопку,чтобы возобновить печать"
#define MESSEGE_INSERT_RU "Вставьте нить и нажмите кнопку,чтобы продолжить"
#define MESSEGE_LOAD_RU "Дождитесь загрузки нити"
#define MESSEGE_PURGE_RU "Дождитесь чистки нити"
#define MESSEGE_RESUME_RU "Подождите,пока печать возобновится ..."
#define MESSEGE_HEAT_RU "Нажмите кнопку, чтобы нагреть форсунку"
#define MESSEGE_HEATING_RU "Подогрев форсунки Пожалуйста, подождите ..."
#define MESSEGE_OPTION_RU "Очистить больше или продолжить печать?"
#define MESSEGE_PURGE_MORE_RU "чистка"
#define MESSEGE_CONTINUE_PRINT_RU "Распечатать"
#define MESSAGE_PAUSING_RU "Стоянка..."
#define MESSAGE_CHANGING_RU "Подождите, пока начнется смена филамента"
#define MESSAGE_UNLOAD_RU "Дождитесь выгрузки нити"
#define MESSAGE_WAITING_RU "Нажмите кнопку,чтобы возобновить печать"
#define MESSAGE_INSERT_RU "Вставьте нить и нажмите кнопку,чтобы продолжить"
#define MESSAGE_LOAD_RU "Дождитесь загрузки нити"
#define MESSAGE_PURGE_RU "Дождитесь чистки нити"
#define MESSAGE_RESUME_RU "Подождите,пока печать возобновится ..."
#define MESSAGE_HEAT_RU "Нажмите кнопку, чтобы нагреть форсунку"
#define MESSAGE_HEATING_RU "Подогрев форсунки Пожалуйста, подождите ..."
#define MESSAGE_OPTION_RU "Очистить больше или продолжить печать?"
#define MESSAGE_PURGE_MORE_RU "чистка"
#define MESSAGE_CONTINUE_PRINT_RU "Распечатать"
#define EEPROM_SETTINGS_TITLE_RU "Настройки EEPROM"
#define EEPROM_SETTINGS_STORE_RU "Сохранение настроек в EEPROM"
#define EEPROM_SETTINGS_READ_RU "Чтение настроек из EEPROM"
#define EEPROM_SETTINGS_REVERT_RU "Восстановить заводские настройки по умолчанию"
#define EEPROM_STORE_TIPS_RU "Сохранить настройки в EEPROM?"
#define EEPROM_READ_TIPS_RU "Читать настройки из EEPROM?"
#define EEPROM_REVERT_TIPS_RU "Revert settings to factory defaults?"

View file

@ -22,6 +22,211 @@
#pragma once
//*************简体中文***********************//
#define NEXT_CN "下一页"
#define PREVIOUS_CN "上一页"
#define DEFAULT_CN "默认值"
#define KEY_BACK_CN "退格"
#define KEY_REST_CN "重置"
#define KEY_CONFIRM_CN "确定"
#define MACHINE_PARA_TITLE_CN "机器参数"
#define MACHINE_TYPE_CNOFIG_CN "机器设置"
#define TEMPERATURE_CONFIG_CN "温度设置"
#define MOTOR_CONFIG_CN "电机设置"
#define ADVANCE_CONFIG_CN "高级设置"
#define MACHINE_CONFIG_TITLE_CN "机器参数>机器配置"
#define MACHINE_TYPE_CN "机型选择"
#define MACHINE_STROKE_CN "行程设置"
#define MACHINE_HOMEDIR_CN "归零方向"
#define MACHINE_ENDSTOP_TYPE_CN "限位开关类型"
#define MACHINE_FILAMENT_CONFIG_CN "换料设置"
#define MACHINE_LEVELING_CONFIG_CN "调平设置"
#define MACHINE_TYPE_CONFIG_TITLE_CN "机器参数>机型选择"
#define MACHINE_TYPE_XYZ_CN "XYZ机型"
#define MACHINE_TYPE_DELTA_CN "Delta机型"
#define MACHINE_TYPE_COREXY_CN "Corexy机型"
#define MACHINE_STROKE_CONF_TITLE_CN "机器参数>机器行程"
#define X_MAX_LENGTH_CN "X轴最大行程"
#define Y_MAX_LENGTH_CN "Y轴最大行程"
#define Z_MAX_LENGTH_CN "Z轴最大行程"
#define X_MIN_LENGTH_CN "X轴最小行程"
#define Y_MIN_LENGTH_CN "Y轴最小行程"
#define Z_MIN_LENGTH_CN "Z轴最小行程"
#define HOME_DIR_CONF_TITLE_CN "机器参数>归零方向"
#define HOME_DIR_X_CN "X轴归零方向"
#define HOME_DIR_Y_CN "Y轴归零方向"
#define HOME_DIR_Z_CN "Z轴归零方向"
#define HOME_MIN_CN "MIN"
#define HOME_MAX_CN "MAX"
#define ENDSTOP_CONF_TITLE_CN "机器参数>限位开关"
#define MIN_ENDSTOP_X_CN "X轴最小限位"
#define MIN_ENDSTOP_Y_CN "Y轴最小限位"
#define MIN_ENDSTOP_Z_CN "Z轴最小限位"
#define MAX_ENDSTOP_X_CN "X轴最大限位"
#define MAX_ENDSTOP_Y_CN "Y轴最大限位"
#define MAX_ENDSTOP_Z_CN "Z轴最大限位"
#define ENDSTOP_FIL_CN "断料开关类型"
#define ENDSTOP_LEVEL_CN "调平开关类型"
#define ENDSTOP_OPENED_CN "常开"
#define ENDSTOP_CLOSED_CN "常闭"
#define FILAMENT_CONF_TITLE_CN "换料设置"
#define FILAMENT_IN_TEMPERATURE_CN "进料温度"
#define FILAMENT_IN_LENGTH_CN "进料长度"
#define FILAMENT_IN_SPEED_CN "进料速度"
#define FILAMENT_OUT_TEMPERATURE_CN "退料温度"
#define FILAMENT_OUT_LENGTH_CN "退料长度"
#define FILAMENT_OUT_SPEED_CN "退料速度"
#define LEVELING_CONF_TITLE_CN "调平设置"
#define LEVELING_PARA_CONF_CN "调平设置"
#define LEVELING_DELTA_CN "delta机型设置"
#define LEVELING_XYZ_CN "手动调平坐标设置"
#define LEVELING_PARA_CONF_TITLE_CN "调平参数"
#define AUTO_LEVELING_ENABLE_CN "自动调平"
#define BLTOUCH_LEVELING_ENABLE_CN "启动BLtouch"
#define PROBE_PORT_CN "调平探针接口"
#define PROBE_X_OFFSET_CN "探针X方向偏移"
#define PROBE_Y_OFFSET_CN "探针Y方向偏移"
#define PROBE_Z_OFFSET_CN "探针Z方向偏移"
#define PROBE_XY_SPEED_CN "探针XY方向移动速度"
#define PROBE_Z_SPEED_CN "探针Z方向移动速度"
#define ENABLE_CN "是"
#define DISABLE_CN "否"
#define Z_MIN_CN "ZMin"
#define Z_MAX_CN "ZMax"
#define DELTA_LEVEL_CONF_TITLE_CN "Delta机器参数"
#define DELTA_LEVEL_CONF_CN "Delta机器调平"
#define DELTA_MACHINE_RADIUS_CN "机器半径"
#define DELTA_DIAGONAL_ROD_CN "机器杆长"
#define DELTA_PRINT_RADIUS_CN "打印半径"
#define DELTA_HEIGHT_CN "打印高度"
#define SMOOTH_ROD_OFFSET_CN "滑块偏移"
#define EFFECTOR_OFFSET_CN "效应器偏移"
#define CALIBRATION_RADIUS_CN "调平半径"
#define XYZ_LEVEL_CONF_TITLE_CN "XYZ机器参数"
#define PROBE_REACH_MAX_LEFT_CN "探针达到最左位置"
#define PROBE_REACH_MAX_RIGHT_CN "探针达到最右位置"
#define PROBE_REACH_MAX_FRONT_CN "探针达到最前位置"
#define PROBE_REACH_MAX_BACK_CN "探针达到最后位置"
#define TEMPERATURE_CONF_TITLE_CN "机器参数>温度设置"
#define NOZZLE_CONF_CN "喷头设置"
#define HOTBED_CONF_CN "热床设置"
#define PREHEAT_TEMPER_CN "预设温度"
#define NOZZLE_CONF_TITLE_CN "机器参数>喷头设置"
#define NOZZLECNT_CN "喷头数量"
#define NOZZLE_TYPE_CN "E0温感类型"
#define NOZZLE_ADJUST_TYPE_CN "PID调温"
#define NOZZLE_MIN_TEMPERATURE_CN "最低温度"
#define NOZZLE_MAX_TEMPERATURE_CN "最高温度"
#define EXTRUD_MIN_TEMPER_CN "最低挤出温度"
#define HOTBED_CONF_TITLE_CN "机器参数>热床设置"
#define HOTBED_ADJUST_CN "PID调温"
#define HOTBED_MIN_TEMPERATURE_CN "最低温度"
#define HOTBED_MAX_TEMPERATURE_CN "最高温度"
#define MOTOR_CONF_TITLE_CN "机器参数>电机设置"
#define MAXFEEDRATE_CONF_CN "最大速度设置"
#define ACCELERATION_CONF_CN "加速度设置"
#define JERKCONF_CN "突变速度设置"
#define STEPSCONF_CN "脉冲设置"
#define TMC_CURRENT_CN "TMC 驱动电流设置"
#define TMC_STEP_MODE_CN "TMC 驱动模式设置"
#define MOTORDIRCONF_CN "电机方向设置"
#define HOMEFEEDRATECONF_CN "归零速度设置"
#define MAXFEEDRATE_CONF_TITLE_CN "机器参数>最大速度"
#define X_MAXFEEDRATE_CN "X轴最大速度"
#define Y_MAXFEEDRATE_CN "Y轴最大速度"
#define Z_MAXFEEDRATE_CN "Z轴最大速度"
#define E0_MAXFEEDRATE_CN "E0轴最大速度"
#define E1_MAXFEEDRATE_CN "E1轴最大速度"
#define ACCELERATION_CONF_TITLE_CN "机器参数>加速度"
#define PRINT_ACCELERATION_CN "打印加速度"
#define RETRACT_ACCELERATION_CN "回抽加速度"
#define TRAVEL_ACCELERATION_CN "空载加速度"
#define X_ACCELERATION_CN "X轴加速度"
#define Y_ACCELERATION_CN "Y轴加速度"
#define Z_ACCELERATION_CN "Z轴加速度"
#define E0_ACCELERATION_CN "E0轴加速度"
#define E1_ACCELERATION_CN "E1轴加速度"
#define JERK_CONF_TITLE_CN "机器参数>突变速度"
#define X_JERK_CN "X轴突变速度"
#define Y_JERK_CN "Y轴突变速度"
#define Z_JERK_CN "Z轴突变速度"
#define E_JERK_CN "E轴突变速度"
#define STEPS_CONF_TITLE_CN "机器参数>脉冲设置"
#define X_STEPS_CN "X轴脉冲"
#define Y_STEPS_CN "Y轴脉冲"
#define Z_STEPS_CN "Z轴脉冲"
#define E0_STEPS_CN "E0轴脉冲"
#define E1_STEPS_CN "E1轴脉冲"
#define TMC_CURRENT_CONF_TITLE_CN "机器参数>TMC电流设置"
#define X_TMC_CURRENT_CN "X轴电流(毫安)"
#define Y_TMC_CURRENT_CN "Y轴电流(毫安)"
#define Z_TMC_CURRENT_CN "Z轴电流(毫安)"
#define E0_TMC_CURRENT_CN "E0轴电流(毫安)"
#define E1_TMC_CURRENT_CN "E1轴电流(毫安)"
#define TMC_MODE_CONF_TITLE_CN "机器参数>TMC模式设置"
#define X_TMC_MODE_CN "X轴是否使能静音模式"
#define Y_TMC_MODE_CN "Y轴是否使能静音模式"
#define Z_TMC_MODE_CN "Z轴是否使能静音模式"
#define E0_TMC_MODE_CN "E0轴是否使能静音模式"
#define E1_TMC_MODE_CN "E1轴是否使能静音模式"
#define MOTORDIR_CONF_TITLE_CN "机器参数>电机方向"
#define X_MOTORDIR_CN "X轴电机方向"
#define Y_MOTORDIR_CN "Y轴电机方向"
#define Z_MOTORDIR_CN "Z轴电机方向"
#define E0_MOTORDIR_CN "E0轴电机方向"
#define E1_MOTORDIR_CN "E1轴电机方向"
#define INVERT_P_CN "正向"
#define INVERT_N_CN "反向"
#define HOMEFEEDRATE_CONF_TITLE_CN "机器参数>归零速度"
#define X_HOMESPEED_CN "XY轴归零速度"
#define Y_HOMESPEED_CN "Y轴归零速度"
#define Z_HOMESPEED_CN "Z轴归零速度"
#define ADVANCED_CONF_TITLE_CN "机器参数>高级设置"
#define PWROFF_DECTION_CN "断电检测模块"
#define PWROFF_AFTER_PRINT_CN "启动打完关机功能"
#define HAVE_UPS_CN "机器配备UPS电源"
#define Z2_AND_Z2ENDSTOP_CONF_CN "双Z轴双限位功能设置"
#define ENABLE_PINS_CONF_CN "电机使能脚电平设置"
#define Z2_AND_Z2ENDSTOP_CONF_TITLE_CN "双z双限位设置"
#define Z2_ENABLE_CN "启用Z2轴"
#define Z2_ENDSTOP_CN "启用Z2限位"
#define Z2_PORT_CN "Z2限位接口"
#define ENABLE_PINS_CONF_TITLE_CN "电机使能脚电平"
#define X_ENABLE_PINS_INVERT_CN "X轴电机使能电平"
#define Y_ENABLE_PINS_INVERT_CN "Y轴电机使能电平"
#define Z_ENABLE_PINS_INVERT_CN "Z轴电机使能电平"
#define E_ENABLE_PINS_INVERT_CN "E轴电机使能电平"
#define PAUSE_POSITION_CN "打印暂停位置设置"
#define PAUSE_POSITION_X_CN "X轴暂停位置(绝对位置,-1无效)"
#define PAUSE_POSITION_Y_CN "Y轴暂停位置(绝对位置,-1无效)"
#define PAUSE_POSITION_Z_CN "Z轴暂停位置(相对位置,-1无效)"
#define TOOL_TEXT_CN "工具"
#define PREHEAT_TEXT_CN "预热"
#define MOVE_TEXT_CN "移动"
@ -98,6 +303,8 @@
#define MOTOR_OFF_TEXT_CN "关闭电机"
#define MOTOR_OFF_XY_TEXT_CN "关闭XY"
#define SHUTDOWN_TEXT_CN "关机"
#define MACHINE_PARA_CN "机器参数"
#define EEPROM_SETTINGS_CN "Eeprom设置"
#define U_DISK_TEXT_CN "U盘"
#define SD_CARD_TEXT_CN "SD卡"
@ -249,16 +456,24 @@
#define PRINTING_OPERATION_GBK "操作"
#define PRINTING_PAUSE_GBK "暂停"
#define MESSEGE_PAUSING_CN "暂停中..."
#define MESSEGE_CHANGING_CN "等待换料开始..."
#define MESSEGE_UNLOAD_CN "退料中,请稍等..."
#define MESSEGE_WAITING_CN "点击按钮恢复打印"
#define MESSEGE_INSERT_CN "装载耗材后,点击按钮开始打印"
#define MESSEGE_LOAD_CN "进料中,请稍等..."
#define MESSEGE_PURGE_CN "等待挤出..."
#define MESSEGE_RESUME_CN "等待恢复打印..."
#define MESSEGE_HEAT_CN "按下按钮,加热喷头"
#define MESSEGE_HEATING_CN "喷头加热中,请等待..."
#define MESSEGE_OPTION_CN "挤出更多还是继续打印?"
#define MESSEGE_PURGE_MORE_CN "挤出"
#define MESSEGE_CONTINUE_PRINT_CN "打印"
#define MESSAGE_PAUSING_CN "暂停中..."
#define MESSAGE_CHANGING_CN "等待换料开始..."
#define MESSAGE_UNLOAD_CN "退料中,请稍等..."
#define MESSAGE_WAITING_CN "点击按钮恢复打印"
#define MESSAGE_INSERT_CN "装载耗材后,点击按钮开始打印"
#define MESSAGE_LOAD_CN "进料中,请稍等..."
#define MESSAGE_PURGE_CN "等待挤出..."
#define MESSAGE_RESUME_CN "等待恢复打印..."
#define MESSAGE_HEAT_CN "按下按钮,加热喷头"
#define MESSAGE_HEATING_CN "喷头加热中,请等待..."
#define MESSAGE_OPTION_CN "挤出更多还是继续打印?"
#define MESSAGE_PURGE_MORE_CN "挤出"
#define MESSAGE_CONTINUE_PRINT_CN "打印"
#define EEPROM_SETTINGS_TITLE_CN "EEPROM 设置"
#define EEPROM_SETTINGS_STORE_CN "保存参数至EEPROM"
#define EEPROM_SETTINGS_READ_CN "读取EEPROM参数"
#define EEPROM_SETTINGS_REVERT_CN "恢复默认参数"
#define EEPROM_STORE_TIPS_CN "是否保存参数到EEPROM?"
#define EEPROM_READ_TIPS_CN "是否使用EEPROM参数?"
#define EEPROM_REVERT_TIPS_CN "是否恢复默认参数?"

View file

@ -98,6 +98,8 @@
#define MOTOR_OFF_TEXT_SP "Apagar motor"
#define MOTOR_OFF_XY_TEXT_SP "Off-XY"
#define SHUTDOWN_TEXT_SP "Apagar"
#define MACHINE_PARA_SP "Config"
#define EEPROM_SETTINGS_SP "Eeprom Set"
#define U_DISK_TEXT_SP "PENDRIVE"
#define SD_CARD_TEXT_SP "SD"
@ -245,9 +247,9 @@
#define DIALOG_PRINT_MODEL_SP "¿Está seguro?"
#define DIALOG_CANCEL_PRINT_SP "¿Está seguro que desea detener la impresión?"
#define DIALOG_RETRY_SP "Reintentar"
#define DIALOG_STOP_SP "Stop"
#define DIALOG_REPRINT_FROM_BREAKPOINT_SP "Reprint from breakpoint?"
#define DIALOG_RETRY_SP "Reintentar"
#define DIALOG_STOP_SP "Stop"
#define DIALOG_REPRINT_FROM_BREAKPOINT_SP "Reprint from breakpoint?"
//#define DIALOG_UNBIND_PRINTER_SP "Unbind the printer?"
#define DIALOG_ERROR_TIPS1_SP "Error:archivo no encontrado, \npor favor insertar SD o disco USB."
#define DIALOG_ERROR_TIPS2_SP "error:transacción fallida, \nconfigurar baudrate del \ndisplay para la placa base!"
@ -260,20 +262,28 @@
#define DIALOG_REPRINT_SP "Print again"
#define DIALOG_WIFI_ENABLE_TIPS_SP "The wifi module is being configured,\nplease wait a moment....."
#define PRINTING_SP "Imprimiendo"
#define PRINTING_AJUSTES_SP "Ajustes"
#define PRINTING_PAUSAR_SP "Pausar"
#define PRINTING_SP "Imprimiendo"
#define PRINTING_AJUSTES_SP "Ajustes"
#define PRINTING_PAUSAR_SP "Pausar"
#define MESSEGE_PAUSING_SP "Aparcando..."
#define MESSEGE_CHANGING_SP "Esperando para iniciar el cambio de filamento"
#define MESSEGE_UNLOAD_SP "Espere para liberar el filamento"
#define MESSEGE_WAITING_SP "Pulsar el botón para reanudar impresión"
#define MESSEGE_INSERT_SP "Inserte el filamento y pulse el botón para continuar..."
#define MESSEGE_LOAD_SP "Espere para purgar el filamento"
#define MESSEGE_PURGE_SP "Espere para purgar el filamento"
#define MESSEGE_RESUME_SP "Esperando impresora para reanudar..."
#define MESSEGE_HEAT_SP "Pulse el botón para calentar la boquilla"
#define MESSEGE_HEATING_SP "Calentando boquilla Espere por favor..."
#define MESSEGE_OPTION_SP "¿Purgar más o continuar con la impresión?"
#define MESSEGE_PURGE_MORE_SP "Purga"
#define MESSEGE_CONTINUE_PRINT_SP "Impresión"
#define MESSAGE_PAUSING_SP "Aparcando..."
#define MESSAGE_CHANGING_SP "Esperando para iniciar el cambio de filamento"
#define MESSAGE_UNLOAD_SP "Espere para liberar el filamento"
#define MESSAGE_WAITING_SP "Pulsar el botón para reanudar impresión"
#define MESSAGE_INSERT_SP "Inserte el filamento y pulse el botón para continuar..."
#define MESSAGE_LOAD_SP "Espere para purgar el filamento"
#define MESSAGE_PURGE_SP "Espere para purgar el filamento"
#define MESSAGE_RESUME_SP "Esperando impresora para reanudar..."
#define MESSAGE_HEAT_SP "Pulse el botón para calentar la boquilla"
#define MESSAGE_HEATING_SP "Calentando boquilla Espere por favor..."
#define MESSAGE_OPTION_SP "¿Purgar más o continuar con la impresión?"
#define MESSAGE_PURGE_MORE_SP "Purga"
#define MESSAGE_CONTINUE_PRINT_SP "Impresión"
#define EEPROM_SETTINGS_TITLE_SP "Configuraciones EEPROM"
#define EEPROM_SETTINGS_STORE_SP "Guardar configuración en EEPROM"
#define EEPROM_SETTINGS_READ_SP "Leer la configuración de EEPROM"
#define EEPROM_SETTINGS_REVERT_SP "Revert settings to factory defaults"
#define EEPROM_STORE_TIPS_SP "¿Guardar ajustes en EEPROM?"
#define EEPROM_READ_TIPS_SP "Leer la configuración de EEPROM?"
#define EEPROM_REVERT_TIPS_SP "Revert settings to factory defaults?"

View file

@ -0,0 +1,480 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
//***************繁体中文**********************//
#define NEXT_T_CN "下一頁"
#define PREVIOUS_T_CN "上一頁"
#define DEFAULT_T_CN "默認值"
#define KEY_BACK_T_CN "退格"
#define KEY_REST_T_CN "重置"
#define KEY_CONFIRM_T_CN "確定"
#define MACHINE_PARA_TITLE_T_CN "機器參數"
#define MACHINE_TYPE_CNOFIG_T_CN "機器設置"
#define TEMPERATURE_CONFIG_T_CN "溫度設置"
#define MOTOR_CONFIG_T_CN "電機設置"
#define ADVANCE_CONFIG_T_CN "高級設置"
#define MACHINE_CONFIG_TITLE_T_CN "機器參數>機器配置"
#define MACHINE_TYPE_T_CN "機型選擇"
#define MACHINE_STROKE_T_CN "行程設置"
#define MACHINE_HOMEDIR_T_CN "歸零方向"
#define MACHINE_ENDSTOP_TYPE_T_CN "限位開關類型"
#define MACHINE_FILAMENT_CONFIG_T_CN "換料設置"
#define MACHINE_LEVELING_CONFIG_T_CN "調平設置"
#define MACHINE_TYPE_CONFIG_TITLE_T_CN "機器參數>機型選擇"
#define MACHINE_TYPE_XYZ_T_CN "XYZ機型"
#define MACHINE_TYPE_DELTA_T_CN "Delta機型"
#define MACHINE_TYPE_COREXY_T_CN "Corexy機型"
#define MACHINE_STROKE_CONF_TITLE_T_CN "機器參數>機器行程"
#define X_MAX_LENGTH_T_CN "X軸最大行程"
#define Y_MAX_LENGTH_T_CN "Y軸最大行程"
#define Z_MAX_LENGTH_T_CN "Z軸最大行程"
#define X_MIN_LENGTH_T_CN "X軸最小行程"
#define Y_MIN_LENGTH_T_CN "Y軸最小行程"
#define Z_MIN_LENGTH_T_CN "Z軸最小行程"
#define HOME_DIR_CONF_TITLE_T_CN "機器參數>歸零方向"
#define HOME_DIR_X_T_CN "X軸歸零方向"
#define HOME_DIR_Y_T_CN "Y軸歸零方向"
#define HOME_DIR_Z_T_CN "Z軸歸零方向"
#define HOME_MIN_T_CN "MIN"
#define HOME_MAX_T_CN "MAX"
#define ENDSTOP_CONF_TITLE_T_CN "機器參數>限位開關"
#define MIN_ENDSTOP_X_T_CN "X軸最小限位"
#define MIN_ENDSTOP_Y_T_CN "Y軸最小限位"
#define MIN_ENDSTOP_Z_T_CN "Z軸最小限位"
#define MAX_ENDSTOP_X_T_CN "X軸最大限位"
#define MAX_ENDSTOP_Y_T_CN "Y軸最大限位"
#define MAX_ENDSTOP_Z_T_CN "Z軸最大限位"
#define ENDSTOP_FIL_T_CN "斷料開關類型"
#define ENDSTOP_LEVEL_T_CN "調平開關類型"
#define ENDSTOP_OPENED_T_CN "常開"
#define ENDSTOP_CLOSED_T_CN "常閉"
#define FILAMENT_CONF_TITLE_T_CN "換料設置"
#define FILAMENT_IN_TEMPERATURE_T_CN "進料溫度"
#define FILAMENT_IN_LENGTH_T_CN "進料長度"
#define FILAMENT_IN_SPEED_T_CN "進料速度"
#define FILAMENT_OUT_TEMPERATURE_T_CN "退料溫度"
#define FILAMENT_OUT_LENGTH_T_CN "退料長度"
#define FILAMENT_OUT_SPEED_T_CN "退料速度"
#define LEVELING_CONF_TITLE_T_CN "調平設置"
#define LEVELING_PARA_CONF_T_CN "調平設置"
#define LEVELING_DELTA_T_CN "delta機型設置"
#define LEVELING_XYZ_T_CN "手動調平坐標設置"
#define LEVELING_PARA_CONF_TITLE_T_CN "調平參數"
#define AUTO_LEVELING_ENABLE_T_CN "自動調平"
#define BLTOUCH_LEVELING_ENABLE_T_CN "啟動BLtouch"
#define PROBE_PORT_T_CN "調平探針接口"
#define PROBE_X_OFFSET_T_CN "探針X方向偏移"
#define PROBE_Y_OFFSET_T_CN "探针Y方向偏移"
#define PROBE_Z_OFFSET_T_CN "探针Z方向偏移"
#define PROBE_XY_SPEED_T_CN "探针XY方向移動速度"
#define PROBE_Z_SPEED_T_CN "探针Z方向移動速度"
#define ENABLE_T_CN "是"
#define DISABLE_T_CN "否"
#define Z_MIN_T_CN "ZMin"
#define Z_MAX_T_CN "ZMax"
#define DELTA_LEVEL_CONF_TITLE_T_CN "Delta機器參數"
#define DELTA_LEVEL_CONF_T_CN "Delta機器調平"
#define DELTA_MACHINE_RADIUS_T_CN "機器半徑"
#define DELTA_DIAGONAL_ROD_T_CN "機器桿長"
#define DELTA_PRINT_RADIUS_T_CN "打印半徑"
#define DELTA_HEIGHT_T_CN "打印高度"
#define SMOOTH_ROD_OFFSET_T_CN "滑塊偏移"
#define EFFECTOR_OFFSET_T_CN "效應器偏移"
#define CALIBRATION_RADIUS_T_CN "調平半徑"
#define XYZ_LEVEL_CONF_TITLE_T_CN "XYZ機器參數"
#define PROBE_REACH_MAX_LEFT_T_CN "探针達到最左位置"
#define PROBE_REACH_MAX_RIGHT_T_CN "探针達到最右位置"
#define PROBE_REACH_MAX_FRONT_T_CN "探针達到最前位置"
#define PROBE_REACH_MAX_BACK_T_CN "探针達到最後位置"
#define TEMPERATURE_CONF_TITLE_T_CN "機器參數>溫度設置"
#define NOZZLE_CONF_T_CN "噴頭設置"
#define HOTBED_CONF_T_CN "熱床設置"
#define PREHEAT_TEMPER_T_CN "預設溫度"
#define NOZZLE_CONF_TITLE_T_CN "機器參數>噴頭設置"
#define NOZZLECNT_T_CN "噴頭數量"
#define NOZZLE_TYPE_T_CN "E0溫感類型"
#define NOZZLE_ADJUST_TYPE_T_CN "PID調溫"
#define NOZZLE_MIN_TEMPERATURE_T_CN "最低溫度"
#define NOZZLE_MAX_TEMPERATURE_T_CN "最高溫度"
#define EXTRUD_MIN_TEMPER_T_CN "最低擠出溫度"
#define HOTBED_CONF_TITLE_T_CN "機器參數>熱床設置"
#define HOTBED_ADJUST_T_CN "PID調溫"
#define HOTBED_MIN_TEMPERATURE_T_CN "最低溫度"
#define HOTBED_MAX_TEMPERATURE_T_CN "最高溫度"
#define MOTOR_CONF_TITLE_T_CN "機器參數>電機設置"
#define MAXFEEDRATE_CONF_T_CN "最大速度設置"
#define ACCELERATION_CONF_T_CN "加速度設置"
#define JERKCONF_T_CN "突變速度設置"
#define STEPSCONF_T_CN "脈沖設置"
#define TMC_CURRENT_T_CN "TMC 驅動電流設置"
#define TMC_STEP_MODE_T_CN "TMC 驅動模式設置"
#define MOTORDIRCONF_T_CN "電機方向設置"
#define HOMEFEEDRATECONF_T_CN "歸零速度設置"
#define MAXFEEDRATE_CONF_TITLE_T_CN "機器參數>最大速度"
#define X_MAXFEEDRATE_T_CN "X軸最大速度"
#define Y_MAXFEEDRATE_T_CN "Y軸最大速度"
#define Z_MAXFEEDRATE_T_CN "Z軸最大速度"
#define E0_MAXFEEDRATE_T_CN "E0軸最大速度"
#define E1_MAXFEEDRATE_T_CN "E1軸最大速度"
#define ACCELERATION_CONF_TITLE_T_CN "機器參數>加速度"
#define PRINT_ACCELERATION_T_CN "打印加速度"
#define RETRACT_ACCELERATION_T_CN "回抽加速度"
#define TRAVEL_ACCELERATION_T_CN "空載加速度"
#define X_ACCELERATION_T_CN "X軸加速度"
#define Y_ACCELERATION_T_CN "Y軸加速度"
#define Z_ACCELERATION_T_CN "Z軸加速度"
#define E0_ACCELERATION_T_CN "E0軸加速度"
#define E1_ACCELERATION_T_CN "E1軸加速度"
#define JERK_CONF_TITLE_T_CN "機器參數>突變速度"
#define X_JERK_T_CN "X軸突變速度"
#define Y_JERK_T_CN "Y軸突變速度"
#define Z_JERK_T_CN "Z軸突變速度"
#define E_JERK_T_CN "E軸突變速度"
#define STEPS_CONF_TITLE_T_CN "機器參數>脈衝設置"
#define X_STEPS_T_CN "X軸脈沖"
#define Y_STEPS_T_CN "Y軸脈沖"
#define Z_STEPS_T_CN "Z軸脈沖"
#define E0_STEPS_T_CN "E0軸脈沖"
#define E1_STEPS_T_CN "E1軸脈沖"
#define TMC_CURRENT_CONF_TITLE_T_CN "機器參數>TMC電流設置"
#define X_TMC_CURRENT_T_CN "X軸電流(毫安)"
#define Y_TMC_CURRENT_T_CN "Y軸電流(毫安)"
#define Z_TMC_CURRENT_T_CN "Z軸電流(毫安)"
#define E0_TMC_CURRENT_T_CN "E0軸電流(毫安)"
#define E1_TMC_CURRENT_T_CN "E1軸電流(毫安)"
#define TMC_MODE_CONF_TITLE_T_CN "機器參數>TMC模式設置"
#define X_TMC_MODE_T_CN "X軸是否使能靜音模式"
#define Y_TMC_MODE_T_CN "Y軸是否使能靜音模式"
#define Z_TMC_MODE_T_CN "Z軸是否使能靜音模式"
#define E0_TMC_MODE_T_CN "E0軸是否使能靜音模式"
#define E1_TMC_MODE_T_CN "E1軸是否使能靜音模式"
#define MOTORDIR_CONF_TITLE_T_CN "機器參數>電機方向"
#define X_MOTORDIR_T_CN "X軸電機方向"
#define Y_MOTORDIR_T_CN "Y軸電機方向"
#define Z_MOTORDIR_T_CN "Z軸電機方向"
#define E0_MOTORDIR_T_CN "E0軸電機方向"
#define E1_MOTORDIR_T_CN "E1軸電機方向"
#define INVERT_P_T_CN "正向"
#define INVERT_N_T_CN "反向"
#define HOMEFEEDRATE_CONF_TITLE_T_CN "機器參數>歸零速度"
#define X_HOMESPEED_T_CN "XY軸歸零速度"
#define Y_HOMESPEED_T_CN "Y軸歸零速度"
#define Z_HOMESPEED_T_CN "Z軸歸零速度"
#define ADVANCED_CONF_TITLE_T_CN "機器參數>高級設置"
#define PWROFF_DECTION_T_CN "斷電檢測模塊"
#define PWROFF_AFTER_PRINT_T_CN "啟動打完關機功能"
#define HAVE_UPS_T_CN "機器配備UPS電壓"
#define Z2_AND_Z2ENDSTOP_CONF_T_CN "雙z軸雙限位功能設置"
#define ENABLE_PINS_CONF_T_CN "電機使能腳電平設置"
#define Z2_AND_Z2ENDSTOP_CONF_TITLE_T_CN "雙z軸雙限位設置"
#define Z2_ENABLE_T_CN "啟用Z2軸"
#define Z2_ENDSTOP_T_CN "啟用Z2限位"
#define Z2_PORT_T_CN "Z2限位接口"
#define ENABLE_PINS_CONF_TITLE_T_CN "電機使能腳電平"
#define X_ENABLE_PINS_INVERT_T_CN "X軸電機使能電平"
#define Y_ENABLE_PINS_INVERT_T_CN "Y軸電機使能電平"
#define Z_ENABLE_PINS_INVERT_T_CN "Z軸電機使能電平"
#define E_ENABLE_PINS_INVERT_T_CN "E軸電機使能電平"
#define PAUSE_POSITION_T_CN "打印暫停位置設置"
#define PAUSE_POSITION_X_T_CN "X軸暫停位置(絕對位置,-1無效)"
#define PAUSE_POSITION_Y_T_CN "Y軸暫停位置(絕對位置,-1無效)"
#define PAUSE_POSITION_Z_T_CN "Z軸暫停位置(相對位置,-1無效)"
#define TOOL_TEXT_T_CN "工具"
#define PREHEAT_TEXT_T_CN "預熱"
#define MOVE_TEXT_T_CN "移動"
#define HOME_TEXT_T_CN "回零"
#define PRINT_TEXT_T_CN "打印"
#define EXTRUDE_TEXT_T_CN "擠出"
#define LEVELING_TEXT_T_CN "調平"
#define AUTO_LEVELING_TEXT_T_CN "自動調平"
#define SET_TEXT_T_CN "設置"
#define MORE_TEXT_T_CN "更多"
#define ADD_TEXT_T_CN "增加"
#define DEC_TEXT_T_CN "減少"
#define EXTRUDER_1_TEXT_T_CN "噴頭1"
#define EXTRUDER_2_TEXT_T_CN "噴頭2"
#define HEATBED_TEXT_T_CN "熱床"
#define TEXT_1C_T_CN "1℃"
#define TEXT_5C_T_CN "5℃"
#define TEXT_10C_T_CN "10℃"
#define CLOSE_TEXT_T_CN "關閉"
#define BACK_TEXT_T_CN "返回"
#define TOOL_PREHEAT_T_CN "預熱"
#define TOOL_EXTRUDE_T_CN "擠出"
#define TOOL_MOVE_T_CN "移動"
#define TOOL_HOME_T_CN "回零"
#define TOOL_LEVELING_T_CN "調平"
#define TOOL_AUTO_LEVELING_T_CN "自動調平"
#define TOOL_FILAMENT_T_CN "換料"
#define TOOL_MORE_T_CN "更多"
#define AXIS_X_ADD_TEXT_T_CN "X+"
#define AXIS_X_DEC_TEXT_T_CN "X-"
#define AXIS_Y_ADD_TEXT_T_CN "Y+"
#define AXIS_Y_DEC_TEXT_T_CN "Y-"
#define AXIS_Z_ADD_TEXT_T_CN "Z+"
#define AXIS_Z_DEC_TEXT_T_CN "Z-"
#define TEXT_01MM_T_CN "0.1mm"
#define TEXT_1MM_T_CN "1mm"
#define TEXT_10MM_T_CN "10mm"
#define HOME_X_TEXT_T_CN "X"
#define HOME_Y_TEXT_T_CN "Y"
#define HOME_Z_TEXT_T_CN "Z"
#define HOME_ALL_TEXT_T_CN "回零"
#define HOME_STOPMOVE_T_CN "急停"
#define PAGE_UP_TEXT_T_CN "上一頁"
#define PAGE_DOWN_TEXT_T_CN "下一頁"
#define EXTRUDER_IN_TEXT_T_CN "進料"
#define EXTRUDER_OUT_TEXT_T_CN "退料"
#define EXTRUDE_1MM_TEXT_T_CN "1mm"
#define EXTRUDE_5MM_TEXT_T_CN "5mm"
#define EXTRUDE_10MM_TEXT_T_CN "10mm"
#define EXTRUDE_LOW_SPEED_TEXT_T_CN "低速"
#define EXTRUDE_MEDIUM_SPEED_TEXT_T_CN "常速"
#define EXTRUDE_HIGH_SPEED_TEXT_T_CN "高速"
#define LEVELING_POINT1_TEXT_T_CN "第一點"
#define LEVELING_POINT2_TEXT_T_CN "第二點"
#define LEVELING_POINT3_TEXT_T_CN "第三點"
#define LEVELING_POINT4_TEXT_T_CN "第四點"
#define LEVELING_POINT5_TEXT_T_CN "第五點"
#define FILESYS_TEXT_T_CN "文件系統"
#define WIFI_TEXT_T_CN "WIFI"
#define FAN_TEXT_T_CN "風扇"
#define ABOUT_TEXT_T_CN "關於"
#define BREAK_POINT_TEXT_T_CN "斷點續打"
#define FILAMENT_TEXT_T_CN "換料"
#define LANGUAGE_TEXT_T_CN "語言"
#define MOTOR_OFF_TEXT_T_CN "關閉電機"
#define MOTOR_OFF_XY_TEXT_T_CN "關閉XY"
#define SHUTDOWN_TEXT_T_CN "關機"
#define MACHINE_PARA_T_CN "機器參數"
#define EEPROM_SETTINGS_T_CN "Eeprom設置"
#define U_DISK_TEXT_T_CN "U盤"
#define SD_CARD_TEXT_T_CN "SD卡"
#define WIFI_NAME_TEXT_T_CN "無線網絡:"
#define WIFI_KEY_TEXT_T_CN "密碼: "
#define WIFI_IP_TEXT_T_CN "IP: "
#define WIFI_AP_TEXT_T_CN "狀態: AP"
#define WIFI_STA_TEXT_T_CN "狀態: STA"
#define WIFI_CONNECTED_TEXT_T_CN "已連接"
#define WIFI_DISCONNECTED_TEXT_T_CN "未連接"
#define WIFI_EXCEPTION_TEXT_T_CN "模塊異常"
#define CLOUD_TEXT_T_CN "雲服務"
#define CLOUD_BIND_T_CN "已綁定"
#define CLOUD_UNBIND_T_CN "解綁"
#define CLOUD_UNBINDING_T_CN "解绑中"
#define CLOUD_DISCONNECTED_T_CN "未連接"
#define CLOUD_UNBINDED_T_CN "未綁定"
#define CLOUD_BINDED_T_CN "已綁定"
#define CLOUD_DISABLE_T_CN "已禁用"
#define FAN_ADD_TEXT_T_CN "增加"
#define FAN_DEC_TEXT_T_CN "減少"
#define FAN_OPEN_TEXT_T_CN "100%"
#define FAN_HALF_TEXT_T_CN "50%"
#define FAN_CLOSE_TEXT_T_CN "關閉"
#define FAN_TIPS1_TEXT_T_CN "風扇"
#define FAN_TIPS2_TEXT_T_CN "FAN\nClose"
#define FILAMENT_IN_TEXT_T_CN "進料"
#define FILAMENT_OUT_TEXT_T_CN "退料"
#define FILAMENT_EXT0_TEXT_T_CN "噴頭1"
#define FILAMENT_EXT1_TEXT_T_CN "噴頭2"
#define FILAMENT_HEAT_TEXT_T_CN "預熱"
#define FILAMENT_STOP_TEXT_T_CN "停止"
//#define FILAMENT_CHANGE_TEXT_T_CN "準備換料"
#define FILAMENT_TIPS2_TEXT_T_CN "T:"
#define FILAMENT_TIPS3_TEXT_T_CN "正在進料"
#define FILAMENT_TIPS4_TEXT_T_CN "正在退料"
#define FILAMENT_TIPS5_TEXT_T_CN "溫度太低,請先預熱"
#define FILAMENT_TIPS6_TEXT_T_CN "換料完成"
#if 0
#define FILAMENT_REPLAYS_IDLE_TEXT_T_CN "請按<進料>或<退料>進行換料!"
#define FILAMENT_CHANGE_TEXT_T_CN "待打印機暫停后,請按<進料>或<退料>進行換料!"
#endif
#define FILAMENT_CHANGE_TEXT_T_CN "待打印機暫停后,\n請按<進料>或<退料>"
#define FILAMENT_DIALOG_LOAD_HEAT_TIPS_T_CN "準備進料,正在加熱,請稍等"
#define FILAMENT_DIALOG_UNLOAD_HEAT_TIPS_T_CN "準備退料,正在加熱,請稍等"
#define FILAMENT_DIALOG_LOAD_CONFIRM1_TIPS_T_CN "加熱完成,請裝載耗材后,按<確定>開始進料"
#define FILAMENT_DIALOG_LOAD_CONFIRM2_TIPS_T_CN "請裝載耗,按<確定>開始進料!"
#define FILAMENT_DIALOG_UNLOAD_CONFIRM_TIPS_T_CN "加熱完成,请按<確定>開始退料!"
#define FILAMENT_DIALOG_LOADING_TIPS_T_CN "正在進料,请等待耗材加載完成!"
#define FILAMENT_DIALOG_UNLOADING_TIPS_T_CN "正在退料,请等待耗材卸載完成!"
#define FILAMENT_DIALOG_LOAD_COMPLETE_TIPS_T_CN "進料完成,请按<確定>返回"
#define FILAMENT_DIALOG_UNLOAD_COMPLETE_TIPS_T_CN "退料完成,请按<確定>返回"
#define PRE_HEAT_EXT_TEXT_T_CN "噴頭"
#define PRE_HEAT_BED_TEXT_T_CN "熱床"
#define FILE_LOADING_T_CN "正在載入......"
#define NO_FILE_AND_CHECK_T_CN "無文件!請插入sd卡/u盤!"
#define NO_FILE_T_CN "無文件!"
#define EXTRUDER_TEMP_TEXT_T_CN "溫度"
#define EXTRUDER_E_LENGTH1_TEXT_T_CN "噴頭"
#define EXTRUDER_E_LENGTH2_TEXT_T_CN "噴頭"
#define EXTRUDER_E_LENGTH3_TEXT_T_CN "噴頭"
#define ABOUT_TYPE_TEXT_T_CN "Type: "
#define ABOUT_VERSION_TEXT_T_CN "Firmware: "
#define ABOUT_WIFI_TEXT_T_CN "Wifi: "
#define PRINTING_OPERATION_T_CN "操作"
#define PRINTING_PAUSE_T_CN "暫停"
#define PRINTING_TEMP_T_CN "溫度"
#define PRINTING_CHANGESPEED_T_CN "變速"
#define PRINTING_RESUME_T_CN "恢復"
#define PRINTING_STOP_T_CN "停止"
#define PRINTING_MORE_T_CN "更多"
#define PRINTING_EXTRUDER_T_CN "擠出"
#define PRINTING_MOVE_T_CN "移動"
#define EXTRUDER_SPEED_T_CN "擠出"
#define MOVE_SPEED_T_CN "移動"
#define EXTRUDER_SPEED_STATE_T_CN "擠出速度"
#define MOVE_SPEED_STATE_T_CN "移動速度"
#define STEP_1PERCENT_T_CN "1%%"
#define STEP_5PERCENT_T_CN "5%%"
#define STEP_10PERCENT_T_CN "10%%"
#define ZOFFSET_T_CN "Z Offset"
#define ZOFFSET_INC_T_CN "增加"
#define ZOFFSET_DEC_T_CN "減少"
#define TITLE_READYPRINT_T_CN "準備打印"
#define TITLE_PREHEAT_T_CN "預熱"
#define TITLE_MOVE_T_CN "移動"
#define TITLE_HOME_T_CN "回零"
#define TITLE_EXTRUDE_T_CN "擠出"
#define TITLE_LEVELING_T_CN "調平"
#define TITLE_SET_T_CN "設置"
#define TITLE_MORE_T_CN "更多"
#define TITLE_CHOOSEFILE_T_CN "選擇文件"
#define TITLE_PRINTING_T_CN "正在打印"
#define TITLE_OPERATION_T_CN "操作"
#define TITLE_ADJUST_T_CN "調整"
#define TITLE_WIRELESS_T_CN "無線網絡"
#define TITLE_FILAMENT_T_CN "換料"
#define TITLE_ABOUT_T_CN "關於"
#define TITLE_FAN_T_CN "風扇"
#define TITLE_LANGUAGE_T_CN "語言"
#define TITLE_PAUSE_T_CN "暫停"
#define TITLE_CHANGESPEED_T_CN "變速"
#define TITLE_CLOUD_TEXT_T_CN "雲服務"
#define TITLE_DIALOG_CONFIRM_T_CN "確認"
#define TITLE_FILESYS_T_CN "文件系統"
#define TITLE_ZOFFSET_T_CN "Z Offset"
#define AUTO_SHUTDOWN_T_CN "自動關機"
#define MANUAL_SHUTDOWN_T_CN "手動關機"
#define DIALOG_CONFIRM_T_CN "確定"
#define DIALOG_CANCLE_T_CN "取消"
#define DIALOG_OK_T_CN "確認"
#define DIALOG_RESET_T_CN "重設"
#define DIALOG_RETRY_T_CN "重試"
#define DIALOG_DISABLE_T_CN "禁用"
#define DIALOG_PRINT_MODEL_T_CN "打印模型?"
#define DIALOG_CANCEL_PRINT_T_CN "停止打印?"
#define DIALOG_RETRY_T_CN "重試"
#define DIALOG_STOP_T_CN "停止"
#define DIALOG_REPRINT_FROM_BREAKPOINT_T_CN "從斷點續打?"
//#define DIALOG_UNBIND_PRINTER_T_CN "解除綁定?"
#define DIALOG_ERROR_TIPS1_T_CN "錯誤:找不到文件,請插入sd卡/u盤!"
#define DIALOG_ERROR_TIPS2_T_CN "錯誤:通信失敗,請檢查波特率或主板硬件!"
#define DIALOG_ERROR_TIPS3_T_CN "錯誤:文件名或文件路徑太長!"
#define DIALOG_CLOSE_MACHINE_T_CN "正在關機......"
#define DIALOG_UNBIND_PRINTER_T_CN "解除綁定?"
#define DIALOG_FILAMENT_NO_PRESS_T_CN "請先裝載耗材!"
#define DIALOG_PRINT_FINISH_T_CN "打印完成!"
#define DIALOG_PRINT_TIME_T_CN "打印時間: "
#define DIALOG_REPRINT_T_CN "再打印壹次"
#define DIALOG_WIFI_ENABLE_TIPS_T_CN "wifi模塊正在配置中,請稍等......"
#define TEXT_VALUE_T_CN "%d℃/%d℃"
#define EXTRUDE_TEXT_VALUE_T_T_CN ": %d℃"
#define WIFI_RECONNECT_TEXT_T_CN "重新連接"
#define MESSAGE_PAUSING_T_CN "暫停中..."
#define MESSAGE_CHANGING_T_CN "等待換料開始..."
#define MESSAGE_UNLOAD_T_CN "退料中,請稍等..."
#define MESSAGE_WAITING_T_CN "點擊按鈕恢復打印"
#define MESSAGE_INSERT_T_CN "裝載耗材後,點擊按鈕開始打印"
#define MESSAGE_LOAD_T_CN "進料中,請稍等..."
#define MESSAGE_PURGE_T_CN "等待擠出..."
#define MESSAGE_RESUME_T_CN "等待恢復打印..."
#define MESSAGE_HEAT_T_CN "按下按鈕,加熱噴頭"
#define MESSAGE_HEATING_T_CN "噴頭加熱中,請等待..."
#define MESSAGE_OPTION_T_CN "擠出更多還是繼續打印"
#define MESSAGE_PURGE_MORE_T_CN "擠出"
#define MESSAGE_CONTINUE_PRINT_T_CN "打印"
#define EEPROM_SETTINGS_TITLE_T_CN "EEPROM 設置"
#define EEPROM_SETTINGS_STORE_T_CN "保存參數至EEPROM"
#define EEPROM_SETTINGS_READ_T_CN "讀取EEPROM參數"
#define EEPROM_SETTINGS_REVERT_T_CN "恢復默認參數"
#define EEPROM_STORE_TIPS_T_CN "是否保存參數到EEPROM?"
#define EEPROM_READ_TIPS_T_CN "是否使用EEPROM參數?"
#define EEPROM_REVERT_TIPS_T_CN "是否恢復默認參數?"

View file

@ -22,7 +22,7 @@
#include "../../../../inc/MarlinConfig.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS) // FSMC on 100/144 pins SoCs
@ -270,4 +270,4 @@
#endif // LCD_USE_DMA_FSMC
#endif // ARDUINO_ARCH_STM32F1 && FSMC_CS_PIN
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -21,25 +21,28 @@
*/
/**
* @file lcd_lvgl_configuration.c
* @file tft_lvgl_configuration.cpp
* @date 2020-02-21
*/
#include "../../../../inc/MarlinConfigPre.h"
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#include "../../../../MarlinCore.h"
#if ENABLED(TFT_LVGL_UI_SPI)
#include "SPI_TFT.h"
#endif
#include "tft_lvgl_configuration.h"
#include "lvgl.h"
#include "../../../../feature/touch/xpt2046.h"
#include "draw_ready_print.h"
#include "W25Qxx.h"
#include "pic_manager.h"
#include "mks_hardware_test.h"
#include "draw_ui.h"
#include <lvgl.h>
#include "../../../../MarlinCore.h"
#include "../../../../feature/touch/xpt2046.h"
#if ENABLED(POWER_LOSS_RECOVERY)
#include "../../../../feature/powerloss.h"
@ -47,26 +50,13 @@
#include <SPI.h>
#if ENABLED(SPI_GRAPHICAL_TFT)
#include "SPI_TFT.h"
#endif
extern void LCD_IO_Init(uint8_t cs, uint8_t rs);
extern void LCD_IO_WriteData(uint16_t RegValue);
extern void LCD_IO_WriteReg(uint16_t Reg);
extern void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
#if HAS_SPI_FLASH_FONT
extern void init_gb2312_font();
#endif
static lv_disp_buf_t disp_buf;
#if ENABLED(SDSUPPORT)
extern void UpdatePic();
#if HAS_SPI_FLASH_FONT
extern void UpdateFont();
#endif
extern void UpdateAssets();
#endif
uint16_t DeviceCode = 0x9488;
extern uint8_t sel_id;
@ -96,6 +86,13 @@ void SysTick_Callback() {
print_time_count();
}
#if DISABLED(TFT_LVGL_UI_SPI)
extern void LCD_IO_Init(uint8_t cs, uint8_t rs);
extern void LCD_IO_WriteData(uint16_t RegValue);
extern void LCD_IO_WriteReg(uint16_t Reg);
extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
void tft_set_cursor(uint16_t x, uint16_t y) {
LCD_IO_WriteReg(0x002A);
LCD_IO_WriteData(x >> 8);
@ -133,9 +130,9 @@ void tft_set_point(uint16_t x, uint16_t y, uint16_t point) {
if ((x > 480) || (y > 320)) return;
//}
//**if ( (x>320)||(y>240) ) return;
tft_set_cursor(x, y); /*设置光标位置*/
tft_set_cursor(x, y);
LCD_WriteRAM_Prepare(); /* 开始写入GRAM*/
LCD_WriteRAM_Prepare();
//LCD_WriteRAM(point);
LCD_IO_WriteData(point);
}
@ -143,7 +140,7 @@ void tft_set_point(uint16_t x, uint16_t y, uint16_t point) {
void LCD_WriteReg(uint16_t LCD_Reg, uint16_t LCD_RegValue) {
/* Write 16-bit Index, then Write Reg */
ClrCs
LCD_IO_WriteReg(LCD_Reg);
LCD_IO_WriteReg(LCD_Reg);
/* Write 16-bit Reg */
LCD_IO_WriteData(LCD_RegValue);
SetCs
@ -265,7 +262,6 @@ void LCD_Clear(uint16_t Color) {
extern uint16_t ILI9488_ReadRAM();
#if DISABLED(SPI_GRAPHICAL_TFT)
void init_tft() {
uint16_t i;
@ -356,12 +352,10 @@ void init_tft() {
LCD_IO_WriteReg(0x0036);
//ILI9488_WriteData(0x0068);
//if (gCfgItems.overturn_180 != 0xEE)
//{
//if (gCfgItems.overturn_180 != 0xEE) {
LCD_IO_WriteData(0x0068);
//}
//else
//{
//else {
//ILI9488_WriteData(0x00A8);
//}
@ -406,16 +400,22 @@ void init_tft() {
}
}
#endif // if DISABLED(SPI_GRAPHICAL_TFT)
#endif // !TFT_LVGL_UI_SPI
extern uint8_t bmp_public_buf[17 * 1024];
void tft_lvgl_init() {
//uint16_t test_id=0;
W25QXX.init(SPI_QUARTER_SPEED);
//test_id=W25QXX.W25QXX_ReadID();
gCfgItems_init();
ui_cfg_init();
disp_language_init();
//init tft first!
#if ENABLED(SPI_GRAPHICAL_TFT)
#if ENABLED(TFT_LVGL_UI_SPI)
SPI_TFT.spi_init(SPI_FULL_SPEED);
SPI_TFT.LCD_init();
#else
@ -423,20 +423,13 @@ void tft_lvgl_init() {
#endif
#if ENABLED(SDSUPPORT)
UpdatePic();
#if HAS_SPI_FLASH_FONT
UpdateFont();
#endif
UpdateAssets();
#endif
mks_test_get();
gCfgItems_init();
ui_cfg_init();
disp_language_init();
//spi_flash_read_test();
#if ENABLED(TOUCH_BUTTONS)
touch.init();
#endif
TERN_(TOUCH_BUTTONS, touch.init());
lv_init();
@ -465,33 +458,32 @@ void tft_lvgl_init() {
filament_pin_setup();
#if ENABLED(POWER_LOSS_RECOVERY)
if (recovery.valid()) {
if (gCfgItems.from_flash_pic == 1)
flash_preview_begin = 1;
if (recovery.valid()) {
if (gCfgItems.from_flash_pic == 1)
flash_preview_begin = 1;
else
default_preview_flg = 1;
uiCfg.print_state = REPRINTING;
ZERO(public_buf_m);
strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
card.printLongPath(public_buf_m);
strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id]));
lv_draw_printing();
}
else
default_preview_flg = 1;
uiCfg.print_state = REPRINTING;
memset(public_buf_m, 0, sizeof(public_buf_m));
strncpy(public_buf_m, recovery.info.sd_filename, sizeof(public_buf_m));
card.printLongPath(public_buf_m);
strncpy(list_file.long_name[sel_id], card.longFilename, sizeof(list_file.long_name[sel_id]));
lv_draw_printing();
}
else
#endif
lv_draw_ready_print();
lv_draw_ready_print();
#if ENABLED(MKS_TEST)
Test_GPIO();
#endif
if (mks_test_flag == 0x1E)
mks_gpio_test();
}
void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) {
#if ENABLED(SPI_GRAPHICAL_TFT)
#if ENABLED(TFT_LVGL_UI_SPI)
uint16_t i, width, height;
uint16_t clr_temp;
uint8_t tbuf[480 * 2];
@ -525,7 +517,9 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
W25QXX.init(SPI_QUARTER_SPEED);
#else
#else // !TFT_LVGL_UI_SPI
#if 1
uint16_t i, width, height;
uint16_t clr_temp;
@ -543,7 +537,8 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
#endif
#endif // SPI_GRAPHICAL_TFT
#endif // !TFT_LVGL_UI_SPI
}
#define TICK_CYCLE 1
@ -554,7 +549,7 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
return TICK_CYCLE * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick));
}
#if ENABLED(SPI_GRAPHICAL_TFT)
#if ENABLED(TFT_LVGL_UI_SPI)
#ifndef USE_XPT2046
#define USE_XPT2046 1
@ -564,12 +559,12 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
#endif
#if USE_XPT2046
#define XPT2046_HOR_RES 480
#define XPT2046_VER_RES 320
#define XPT2046_X_MIN 201
#define XPT2046_Y_MIN 164
#define XPT2046_X_MAX 3919
#define XPT2046_Y_MAX 3776
#define XPT2046_HOR_RES 480
#define XPT2046_VER_RES 320
#define XPT2046_X_MIN 201
#define XPT2046_Y_MIN 164
#define XPT2046_X_MAX 3919
#define XPT2046_Y_MAX 3776
#define XPT2046_AVG 4
#define XPT2046_INV 1
#endif
@ -579,34 +574,34 @@ unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
#ifndef USE_XPT2046
#define USE_XPT2046 1
#ifndef XPT2046_XY_SWAP
#define XPT2046_XY_SWAP 1
#define XPT2046_XY_SWAP 1
#endif
#ifndef XPT2046_X_INV
#define XPT2046_X_INV 0
#define XPT2046_X_INV 0
#endif
#ifndef XPT2046_Y_INV
#define XPT2046_Y_INV 1
#define XPT2046_Y_INV 1
#endif
#endif
#if USE_XPT2046
#ifndef XPT2046_HOR_RES
#define XPT2046_HOR_RES 480
#define XPT2046_HOR_RES 480
#endif
#ifndef XPT2046_VER_RES
#define XPT2046_VER_RES 320
#define XPT2046_VER_RES 320
#endif
#ifndef XPT2046_X_MIN
#define XPT2046_X_MIN 201
#define XPT2046_X_MIN 201
#endif
#ifndef XPT2046_Y_MIN
#define XPT2046_Y_MIN 164
#define XPT2046_Y_MIN 164
#endif
#ifndef XPT2046_X_MAX
#define XPT2046_X_MAX 3919
#define XPT2046_X_MAX 3919
#endif
#ifndef XPT2046_Y_MAX
#define XPT2046_Y_MAX 3776
#define XPT2046_Y_MAX 3776
#endif
#ifndef XPT2046_AVG
#define XPT2046_AVG 4
@ -637,39 +632,25 @@ static void xpt2046_corr(uint16_t *x, uint16_t *y) {
#endif
}
#define times 4
#define times 4
#define CHX 0x90
#define CHY 0xD0
int SPI2_ReadWrite2Bytes(void) {
volatile uint16_t ans = 0;
uint16_t temp = 0;
#if ENABLED(SPI_GRAPHICAL_TFT)
temp = SPI_TFT.spi_read_write_byte(0xFF);
ans = temp << 8;
temp = SPI_TFT.spi_read_write_byte(0xFF);
ans |= temp;
ans >>= 3;
#else
temp = W25QXX.spi_flash_read_write_byte(0xFF);
ans = temp << 8;
temp = W25QXX.spi_flash_read_write_byte(0xFF);
ans |= temp;
ans >>= 3;
#endif
return ans & 0x0FFF;
#define SPI_READ_WRITE_BYTE(B) TERN(TFT_LVGL_UI_SPI, SPI_TFT.spi_read_write_byte, W25QXX.spi_flash_read_write_byte)(B)
const uint16_t t1 = SPI_READ_WRITE_BYTE(0xFF),
t2 = SPI_READ_WRITE_BYTE(0xFF);
return (((t1 << 8) | t2) >> 3) & 0x0FFF;
}
uint16_t x_addata[times], y_addata[times];
void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
uint16_t i, j, k;
#if ENABLED(SPI_GRAPHICAL_TFT)
SPI_TFT.spi_init(SPI_QUARTER_SPEED);
#endif
TERN(TFT_LVGL_UI_SPI, SPI_TFT.spi_init, W25QXX.init)(SPI_SPEED_6);
for (i = 0; i < times; i++) {
#if ENABLED(SPI_GRAPHICAL_TFT)
#if ENABLED(TFT_LVGL_UI_SPI)
OUT_WRITE(TOUCH_CS_PIN, LOW);
SPI_TFT.spi_read_write_byte(CHX);
y_addata[i] = SPI2_ReadWrite2Bytes();
@ -692,6 +673,7 @@ void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
#endif
}
TERN(TFT_LVGL_UI_SPI,,W25QXX.init(SPI_QUARTER_SPEED));
for (i = 0; i < times; i++)
for (j = i + 1; j < times; j++)
@ -726,8 +708,10 @@ void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
#define ADC_VALID_OFFSET 10
uint8_t TOUCH_PressValid(uint16_t _usX, uint16_t _usY) {
if ( (_usX <= ADC_VALID_OFFSET) || (_usY <= ADC_VALID_OFFSET)
|| (_usX >= 4095 - ADC_VALID_OFFSET) || (_usY >= 4095 - ADC_VALID_OFFSET)
if ( (_usX <= ADC_VALID_OFFSET)
|| (_usY <= ADC_VALID_OFFSET)
|| (_usX >= 4095 - ADC_VALID_OFFSET)
|| (_usY >= 4095 - ADC_VALID_OFFSET)
) return 0;
return 1;
}
@ -754,7 +738,7 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
data->state = LV_INDEV_STATE_PR;
/*Set the coordinates (if released use the last pressed coordinates)*/
/* Set the coordinates (if released use the last pressed coordinates) */
// SERIAL_ECHOLNPAIR("antes X: ", last_x, ", y: ", last_y);
xpt2046_corr((uint16_t *)&last_x, (uint16_t *)&last_y);
@ -774,4 +758,4 @@ bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
return false; /*Return `false` because we are not buffering and no more data to read*/
}
#endif // TFT_LVGL_UI
#endif // HAS_TFT_LVGL_UI

View file

@ -30,7 +30,7 @@
//extern "C" {
//#endif
#include "lvgl.h"
#include <lvgl.h>
void tft_lvgl_init();
void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p);

File diff suppressed because it is too large Load diff

View file

@ -48,6 +48,228 @@ extern void disp_language_init();
#define MULTI_LANGUAGE_ENABLE 1
#define MULTI_LANGUAGE_DISABLE 0
typedef struct machine_common_disp{
const char *default_value;
const char *next;
const char *previous;
const char *MachineConfigTitle;
const char *MachineType;
const char *Stroke;
const char *HomeDir;
const char *EndStopType;
const char *FilamentConf;
const char *LevelingConf;
const char *MachineTypeConfTitle;
const char *xyz;
const char *delta;
const char *corexy;
const char *StrokeConfTitle;
const char *xStroke;
const char *yStroke;
const char *zStroke;
const char *xmin;
const char *ymin;
const char *zmin;
const char *HomeDirConfTitle;
const char *xHomeDir;
const char *yHomeDir;
const char *zHomeDir;
const char *min;
const char *max;
const char *EndstopConfTitle;
const char *xEndstop_min;
const char *yEndstop_min;
const char *zEndstop_min;
const char *xEndstop_max;
const char *yEndstop_max;
const char *zEndstop_max;
const char *FilamentEndstop;
const char *LevelingEndstop;
const char *opened;
const char *closed;
const char *FilamentConfTitle;
const char *InTemperature;
const char *InLength;
const char *InSpeed;
const char *OutTemperature;
const char *OutLength;
const char *OutSpeed;
const char *LevelingParaConfTitle;
const char *LevelingParaConf;
const char *DeltaLevelConf;
const char *XYZLevelconf;
const char *LevelingSubConfTitle;
const char *AutoLevelEnable;
const char *BLtouchEnable;
const char *ProbePort;
const char *ProbeXoffset;
const char *ProbeYoffset;
const char *ProbeZoffset;
const char *ProbeXYspeed;
const char *ProbeZspeed;
const char *enable;
const char *disable;
const char *z_min;
const char *z_max;
const char *LevelingSubDeltaConfTitle;
const char *MachineRadius;
const char *DiagonalRod;
const char *PrintableRadius;
const char *DeltaHeight;
const char *SmoothRodOffset;
const char *EffectorOffset;
const char *CalibrationRadius;
const char *LevelingSubXYZConfTitle;
//const char *Level_positon1;
//const char *Level_positon2;
//const char *Level_positon3;
//const char *Level_positon4;
const char *TemperatureConfTitle;
const char *NozzleConf;
const char *HotBedConf;
const char *PreheatTemperConf;
const char *NozzleCnt;
const char *NozzleConfTitle;
const char *NozzleType;
const char *NozzleAdjustType;
const char *NozzleMinTemperature;
const char *NozzleMaxTemperature;
const char *Extrude_Min_Temper;
const char *HotbedEnable;
const char *HotbedConfTitle;
const char *HotbedAjustType;
const char *HotbedMinTemperature;
const char *HotbedMaxTemperature;
const char *MotorConfTitle;
const char *MaxFeedRateConf;
const char *AccelerationConf;
const char *JerkConf;
const char *StepsConf;
const char *MotorDirConf;
const char *HomeFeedRateConf;
const char *TMCcurrentConf;
const char *TMCStepModeConf;
const char *MaxFeedRateConfTitle;
const char *XMaxFeedRate;
const char *YMaxFeedRate;
const char *ZMaxFeedRate;
const char *E0MaxFeedRate;
const char *E1MaxFeedRate;
const char *AccelerationConfTitle;
const char *PrintAcceleration;
const char *RetractAcceleration;
const char *TravelAcceleration;
const char *X_Acceleration;
const char *Y_Acceleration;
const char *Z_Acceleration;
const char *E0_Acceleration;
const char *E1_Acceleration;
const char *JerkConfTitle;
const char *X_Jerk;
const char *Y_Jerk;
const char *Z_Jerk;
const char *E_Jerk;
const char *StepsConfTitle;
const char *X_Steps;
const char *Y_Steps;
const char *Z_Steps;
const char *E0_Steps;
const char *E1_Steps;
const char *TmcCurrentConfTitle;
const char *X_Current;
const char *Y_Current;
const char *Z_Current;
const char *E0_Current;
const char *E1_Current;
const char *TmcStepModeConfTitle;
const char *X_StepMode;
const char *Y_StepMode;
const char *Z_StepMode;
const char *E0_StepMode;
const char *E1_StepMode;
const char *MotorDirConfTitle;
const char *X_MotorDir;
const char *Y_MotorDir;
const char *Z_MotorDir;
const char *E0_MotorDir;
const char *E1_MotorDir;
const char *Invert_1;
const char *Invert_0;
const char *HomeFeedRateConfTitle;
const char *XY_HomeFeedRate;
const char *Y_HomeFeedRate;
const char *Z_HomeFeedRate;
const char *AdvancedConfTitle;
const char *PwrOffDection;
const char *PwrOffAfterPrint;
const char *HaveUps;
const char *Z2andZ2Endstop;
const char *EnablePinsInvert;
const char *PausePosition;
const char *Z2ConfTitle;
const char *Z2Enable;
const char *Z2EndstopEnable;
const char *Z2Port;
const char *EnablePinsInvertTitle;
const char *XInvert;
const char *YInvert;
const char *ZInvert;
const char *EInvert;
const char *key_1;
const char *key_2;
const char *key_3;
const char *key_4;
const char *key_5;
const char *key_6;
const char *key_7;
const char *key_8;
const char *key_9;
const char *key_0;
const char *key_point;
const char *key_back;
const char *key_reset;
const char *key_confirm;
const char *negative;
const char *low_level;
const char *high_level;
const char *PausePosText;
const char *xPos;
const char *yPos;
const char *zPos;
} machine_common_def;
extern machine_common_def machine_menu;
typedef struct common_menu_disp {
const char *text_back;
const char *dialog_confirm_title;
@ -59,6 +281,7 @@ typedef struct common_menu_disp {
const char *next;
const char *previous;
} common_menu_def;
extern common_menu_def common_menu;
typedef struct main_menu_disp {
@ -76,6 +299,7 @@ typedef struct main_menu_disp {
const char *more;
const char *machine_para;
} main_menu_def;
extern main_menu_def main_menu;
typedef struct preheat_menu_disp {
@ -96,7 +320,8 @@ typedef struct preheat_menu_disp {
const char *dialog_tips;
}preheat_menu_def;
} preheat_menu_def;
extern preheat_menu_def preheat_menu;
typedef struct move_menu_disp {
@ -114,6 +339,7 @@ typedef struct move_menu_disp {
const char *step_10mm;
const char *back;
} move_menu_def;
extern move_menu_def move_menu;
typedef struct home_menu_disp {
@ -125,6 +351,7 @@ typedef struct home_menu_disp {
const char *stopmove;
const char *back;
} home_menu_def;
extern home_menu_def home_menu;
typedef struct file_menu_disp {
@ -137,7 +364,8 @@ typedef struct file_menu_disp {
const char *no_file;
const char *no_file_and_check;
}file_menu_def;
} file_menu_def;
extern file_menu_def file_menu;
typedef struct extrude_menu_disp {
@ -160,6 +388,7 @@ typedef struct extrude_menu_disp {
const char *temp_value;
const char *temper_text;
} extrude_menu_def;
extern extrude_menu_def extrude_menu;
typedef struct leveling_menu_disp {
@ -172,6 +401,7 @@ typedef struct leveling_menu_disp {
char *back;
} leveling_menu_def;
extern leveling_menu_def leveling_menu;
typedef struct set_menu_disp {
@ -187,8 +417,10 @@ typedef struct set_menu_disp {
const char *shutdown;
const char *language;
const char *machine_para;
const char *eepromSet;
const char *back;
} set_menu_def;
extern set_menu_def set_menu;
typedef struct filesys_menu_disp {
@ -198,6 +430,7 @@ typedef struct filesys_menu_disp {
const char *usb_sys;
const char *back;
} filesys_menu_def;
extern filesys_menu_def filesys_menu;
typedef struct more_menu_disp {
@ -205,6 +438,7 @@ typedef struct more_menu_disp {
const char *zoffset;
const char *back;
} more_menu_def;
extern more_menu_def more_menu;
typedef struct wifi_menu_disp {
@ -221,6 +455,7 @@ typedef struct wifi_menu_disp {
const char *back;
const char *reconnect;
} wifi_menu_def;
extern wifi_menu_def wifi_menu;
typedef struct cloud_menu_disp {
@ -236,6 +471,7 @@ typedef struct cloud_menu_disp {
const char *back;
const char *unbind_printer_tips;
} cloud_menu_def;
extern cloud_menu_def cloud_menu;
typedef struct about_menu_disp {
@ -249,6 +485,7 @@ typedef struct about_menu_disp {
const char *type_robin_mini;
const char *back;
} about_menu_def;
extern about_menu_def about_menu;
typedef struct fan_menu_disp {
@ -263,6 +500,7 @@ typedef struct fan_menu_disp {
const char *state;
const char *state_value;
} fan_menu_def;
extern fan_menu_def fan_menu;
typedef struct filament_menu_disp {
@ -290,6 +528,7 @@ typedef struct filament_menu_disp {
const char *filament_dialog_ok;
const char *filament_dialog_back;
} filament_menu_def;
extern filament_menu_def filament_menu;
typedef struct language_menu {
@ -310,6 +549,7 @@ typedef struct language_menu {
const char *up;
const char *back;
} language_menu_def;
extern language_menu_def language_menu;
typedef struct printing_menu_disp {
@ -323,6 +563,7 @@ typedef struct printing_menu_disp {
const char *resume;
const char *stop;
} printing_menu_def;
extern printing_menu_def printing_menu;
typedef struct operation_menu_disp {
@ -341,6 +582,7 @@ typedef struct operation_menu_disp {
const char *back;
const char *babystep;
} operation_menu_def;
extern operation_menu_def operation_menu;
typedef struct pause_menu_disp {
@ -352,6 +594,7 @@ typedef struct pause_menu_disp {
const char *filament;
const char *more;
} pause_menu_def;
extern pause_menu_def pause_menu;
typedef struct speed_menu_disp {
@ -367,6 +610,7 @@ typedef struct speed_menu_disp {
const char *move_speed;
const char *extrude_speed;
} speed_menu_def;
extern speed_menu_def speed_menu;
typedef struct printing_more_menu_disp {
@ -378,6 +622,7 @@ typedef struct printing_more_menu_disp {
const char *speed;
const char *back;
} printing_more_menu_def;
extern printing_more_menu_def printing_more_menu;
typedef struct dialog_menu_disp {
@ -392,6 +637,7 @@ typedef struct dialog_menu_disp {
const char *tip1_print_file;
const char *tip2_stop_file;
} dialog_menu_def;
extern dialog_menu_def dialog_menu;
typedef struct print_file_dialog_disp {
@ -412,6 +658,7 @@ typedef struct print_file_dialog_disp {
const char *reprint;
const char *wifi_enable_tips;
} print_file_dialog_menu_def;
extern print_file_dialog_menu_def print_file_dialog_menu;
typedef struct zoffset_menu_disp {
@ -423,6 +670,7 @@ typedef struct zoffset_menu_disp {
const char *step1;
const char *back;
} zoffset_menu_def;
extern zoffset_menu_def zoffset_menu;
typedef struct tool_menu_disp {
@ -437,6 +685,7 @@ typedef struct tool_menu_disp {
const char *more;
const char *back;
} tool_menu_def;
extern tool_menu_def tool_menu;
typedef struct MachinePara_menu_disp {
@ -447,6 +696,7 @@ typedef struct MachinePara_menu_disp {
const char *AdvanceSetting;
//const char *back;
} MachinePara_menu_def;
extern MachinePara_menu_def MachinePara_menu;
typedef struct MachineSettings_menu_disp {
@ -459,6 +709,7 @@ typedef struct MachineSettings_menu_disp {
const char *leveling;
const char *back;
} MachineSettings_menu_def;
extern MachineSettings_menu_def MachineSettings_menu;
typedef struct TemperatureSettings_menu_disp {
@ -468,6 +719,7 @@ typedef struct TemperatureSettings_menu_disp {
const char *preheat;
const char *back;
} TemperatureSettings_menu_def;
extern TemperatureSettings_menu_def TemperatureSettings_menu;
typedef struct pause_msg_disp {
@ -485,23 +737,35 @@ typedef struct pause_msg_disp {
const char *purgeMore;
const char *continuePrint;
} pause_msg_def;
extern pause_msg_def pause_msg_menu;
typedef struct eeprom_disp{
const char *title;
const char *store;
const char *read;
const char *revert;
const char *storeTips;
const char *readTips;
const char *revertTips;
} eeprom_def;
extern eeprom_def eeprom_menu;
/*****************************************/
//********************************************//
//#if defined(TFT70)
//
//#elif defined(TFT35)
#define TEXT_VALUE "%d/%d"
#define TEXT_VALUE "%d/%d"
//#endif
#define TEXT_VALUE_T ": %d℃"
#define TEXT_VALUE_mm ": %dmm"
#define TEXT_VALUE_cm ": %dcm"
#define TEXT_VALUE_m ": %dm"
#define TEXT_VALUE_T ": %d℃"
#define TEXT_VALUE_mm ": %dmm"
#define TEXT_VALUE_cm ": %dcm"
#define TEXT_VALUE_m ": %dm"
#define TEMP_UNIT_SYBOL "%d℃"
#define FLOAT_TEMP_UNIT_SYBOL "%.1f℃"
#define TEMP_UNIT_SYBOL "%d℃"
#define FLOAT_TEMP_UNIT_SYBOL "%.1f℃"
#define TEXT_1C "1℃"
#define TEXT_5C "5℃"
@ -533,7 +797,7 @@ extern pause_msg_def pause_msg_menu;
#define LANGUAGE_JP "日本語"
#define LANGUAGE_GE "Deutsch"
#define LANGUAGE_FR "français"
#define LANGUAGE_IT "Italia"
#define LANGUAGE_IT "Italiano"
#define LANGUAGE_PR "português"
#define LANGUAGE_KR "Korean"
#define LANGUAGE_BR "Brazil"

View file

@ -1098,11 +1098,7 @@ void prepare_line_to_destination() {
}
uint8_t axes_need_homing(uint8_t axis_bits/*=0x07*/) {
#if ENABLED(HOME_AFTER_DEACTIVATE)
#define HOMED_FLAGS axis_known_position
#else
#define HOMED_FLAGS axis_homed
#endif
#define HOMED_FLAGS TERN(HOME_AFTER_DEACTIVATE, axis_known_position, axis_homed)
// Clear test bits that are homed
if (TEST(axis_bits, X_AXIS) && TEST(HOMED_FLAGS, X_AXIS)) CBI(axis_bits, X_AXIS);
if (TEST(axis_bits, Y_AXIS) && TEST(HOMED_FLAGS, Y_AXIS)) CBI(axis_bits, Y_AXIS);

View file

@ -2551,7 +2551,7 @@ void Stepper::init() {
AXIS_INIT(Z, Z);
#endif
#if E_STEPPERS > 0 && HAS_E0_STEP
#if E_STEPPERS && HAS_E0_STEP
E_AXIS_INIT(0);
#endif
#if E_STEPPERS > 1 && HAS_E1_STEP

View file

@ -865,14 +865,14 @@ void reset_stepper_drivers(); // Called by settings.load / settings.reset
#endif
#ifndef ENABLE_AXIS_E0
#if E_STEPPERS > 0 && HAS_E0_ENABLE
#if E_STEPPERS && HAS_E0_ENABLE
#define ENABLE_AXIS_E0() ENABLE_STEPPER_E0()
#else
#define ENABLE_AXIS_E0() NOOP
#endif
#endif
#ifndef DISABLE_AXIS_E0
#if E_STEPPERS > 0 && HAS_E0_ENABLE
#if E_STEPPERS && HAS_E0_ENABLE
#define DISABLE_AXIS_E0() DISABLE_STEPPER_E0()
#else
#define DISABLE_AXIS_E0() NOOP

View file

@ -507,7 +507,9 @@
#elif MB(MKS_ROBIN_MINI)
#include "stm32f1/pins_MKS_ROBIN_MINI.h" // STM32F1 env:mks_robin_mini
#elif MB(MKS_ROBIN_NANO)
#include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano
#include "stm32f1/pins_MKS_ROBIN_NANO.h" // STM32F1 env:mks_robin_nano env:mks_robin_nano35
#elif MB(MKS_ROBIN_NANO_V2)
#include "stm32f1/pins_MKS_ROBIN_NANO_V2.h" // STM32F1 env:mks_robin_nano env:mks_robin_nano35
#elif MB(MKS_ROBIN_LITE)
#include "stm32f1/pins_MKS_ROBIN_LITE.h" // STM32F1 env:mks_robin_lite
#elif MB(BTT_SKR_MINI_V1_1)

View file

@ -31,6 +31,14 @@
#define BOARD_INFO_NAME "RADDS"
//
// EEPROM
//
#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
#define I2C_EEPROM
#define MARLIN_EEPROM_SIZE 0x2000 // 8KB
#endif
//
// Servos
//
@ -205,9 +213,6 @@
#define FIL_RUNOUT_PIN 39 // SERVO2_PIN
#endif
#define I2C_EEPROM
#define MARLIN_EEPROM_SIZE 0x2000 // 8KB
//
// M3/M4/M5 - Spindle/Laser Control
//

View file

@ -144,12 +144,13 @@
#define SPI_FLASH_SIZE 0x200000 // 2MB
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#define HAS_SPI_FLASH_FONT 0
#define HAS_GCODE_PREVIEW 1
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0
#define HAS_LANG_SELECT_SCREEN 0
#define HAS_BAK_VIEW_IN_FLASH 0
#define HAS_LOGO_IN_FLASH 0
//SPI 2
#define W25QXX_CS_PIN PB12

View file

@ -150,12 +150,13 @@
#define SPI_FLASH_SIZE 0x200000 // 2MB
#if ENABLED(TFT_LVGL_UI)
#if HAS_TFT_LVGL_UI
#define HAS_SPI_FLASH_FONT 0
#define HAS_GCODE_PREVIEW 1
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0
#define HAS_LANG_SELECT_SCREEN 0
#define HAS_BAK_VIEW_IN_FLASH 0
#define HAS_LOGO_IN_FLASH 0
//SPI 2
#define W25QXX_CS_PIN PB12

View file

@ -45,7 +45,7 @@
#define FLASH_EEPROM_EMULATION
#define EEPROM_PAGE_SIZE (0x800U) // 2KB
#define EEPROM_START_ADDRESS (0x8000000UL + (STM32_FLASH_SIZE) * 1024UL - (EEPROM_PAGE_SIZE) * 2UL)
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2KB
#endif
#define ENABLE_SPI2
@ -123,8 +123,8 @@
//
// Misc. Functions
//
//#define POWER_LOSS_PIN PA2 // PW_DET
//#define PS_ON_PIN PA3 // PW_OFF
#define POWER_LOSS_PIN PA2 // PW_DET
#define PS_ON_PIN PA3 // PW_OFF
//#define SUICIDE_PIN PB2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
//#define SUICIDE_PIN_INVERTING false
@ -132,13 +132,16 @@
//#define KILL_PIN PA2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
//#define KILL_PIN_INVERTING true // Enable MKSPWC support ROBIN NANO v1.2 ONLY
//#define SERVO0_PIN PA8 // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
#define SERVO0_PIN PA8 // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
//#define LED_PIN PB2
#define MT_DET_1_PIN PA4
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_INVERTING false
#define WIFI_IO0_PIN PC13
//
// SD Card
//
@ -162,76 +165,28 @@
* to let the bootloader init the screen.
*/
#if ENABLED(SPI_GRAPHICAL_TFT)
#if ENABLED(TFT_LVGL_UI_SPI)
#if HAS_SPI_LCD
#define SPI_TFT_CS_PIN PD11
#define SPI_TFT_SCK_PIN PA5
#define SPI_TFT_MISO_PIN PA6
#define SPI_TFT_MOSI_PIN PA7
#define SPI_TFT_DC_PIN PD10
#define SPI_TFT_RST_PIN PC6
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#define LCD_PINS_ENABLE PD13
#define LCD_PINS_RS PC6
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define LCD_BACKLIGHT_PIN -1
#define LCD_BACKLIGHT_PIN PD13
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
#if ENABLED(MKS_MINI_12864)
#define LCD_BACKLIGHT_PIN -1
#define LCD_RESET_PIN -1
#define DOGLCD_A0 PD11
#define DOGLCD_CS PE15
#define DOGLCD_SCK PA5
#define DOGLCD_MOSI PA7
#define TOUCH_CS_PIN PE14 // SPI1_NSS
#define TOUCH_SCK_PIN PA5 // SPI1_SCK
#define TOUCH_MISO_PIN PA6 // SPI1_MISO
#define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
// Required for MKS_MINI_12864 with this board
#define MKS_LCD12864B
#undef SHOW_BOOTSCREEN
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#else // !MKS_MINI_12864
#define LCD_PINS_D4 PE14
#if ENABLED(ULTIPANEL)
#define LCD_PINS_D5 PE15
#define LCD_PINS_D6 PD11
#define LCD_PINS_D7 PD10
#endif
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(125)
#endif
#endif // !MKS_MINI_12864
#else
#define SPI_TFT_CS_PIN PD11
#define SPI_TFT_SCK_PIN PA5
#define SPI_TFT_MISO_PIN PA6
#define SPI_TFT_MOSI_PIN PA7
#define SPI_TFT_DC_PIN PD10
#define SPI_TFT_RST_PIN PC6
#define LCD_BACKLIGHT_PIN PD13
#define TOUCH_CS_PIN PE14 // SPI1_NSS
#define TOUCH_SCK_PIN PA5 // SPI1_SCK
#define TOUCH_MISO_PIN PA6 // SPI1_MISO
#define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#endif // HAS_SPI_LCD
#elif ENABLED(TFT_LVGL_UI)
#elif ENABLED(TFT_LVGL_UI_FSMC)
#define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0
@ -243,7 +198,11 @@
#define LCD_BACKLIGHT_PIN PD13
#elif ENABLED(FSMC_GRAPHICAL_TFT)
#endif
#if ENABLED(FSMC_GRAPHICAL_TFT)
//#define DOGLCD_MOSI -1 // prevent redefine Conditionals_post.h
//#define DOGLCD_SCK -1
#define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0
@ -257,9 +216,54 @@
#define TOUCH_MISO_PIN PB14 // SPI2_MISO
#define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
#endif
#endif
#if HAS_SPI_LCD
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#define LCD_PINS_ENABLE PD13
#define LCD_PINS_RS PC6
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define LCD_BACKLIGHT_PIN -1
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
#if ENABLED(MKS_MINI_12864)
#define LCD_BACKLIGHT_PIN -1
#define LCD_RESET_PIN -1
#define DOGLCD_A0 PD11
#define DOGLCD_CS PE15
#define DOGLCD_SCK PA5
#define DOGLCD_MOSI PA7
// Required for MKS_MINI_12864 with this board
#define MKS_LCD12864B
#undef SHOW_BOOTSCREEN
#else // !MKS_MINI_12864
#define LCD_PINS_D4 PE14
#if ENABLED(ULTIPANEL)
#define LCD_PINS_D5 PE15
#define LCD_PINS_D6 PD11
#define LCD_PINS_D7 PD10
#endif
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(125)
#endif
#endif // !MKS_MINI_12864
#endif // HAS_SPI_LCD
#define SPI_FLASH
#if ENABLED(SPI_FLASH)
#define W25QXX_CS_PIN PB12

View file

@ -0,0 +1,325 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
/**
* MKS Robin nano (STM32F130VET6) board pin assignments
*/
#ifndef __STM32F1__
#error "Oops! Select an STM32F1 board in 'Tools > Board.'"
#elif HOTENDS > 2 || E_STEPPERS > 2
#error "MKS Robin nano supports up to 2 hotends / E-steppers. Comment out this line to continue."
#endif
#define BOARD_INFO_NAME "MKS Robin nano V2.0"
//
// Release PB4 (Y_ENABLE_PIN) from JTAG NRST role
//
//#define DISABLE_DEBUG
//
// EEPROM
//
//#define FLASH_EEPROM_EMULATION
//#define SDCARD_EEPROM_EMULATION
#if EITHER(NO_EEPROM_SELECTED, I2C_EEPROM)
#define I2C_EEPROM // EEPROM on I2C-0
#define MARLIN_EEPROM_SIZE 0x1000 // 4KB
#endif
//
// Note: MKS Robin board is using SPI2 interface.
//
//#define SPI_MODULE 2
#define ENABLE_SPI2
//
// Limit Switches
//
#define X_DIAG_PIN PA15
#define Y_DIAG_PIN PA12
#define Z_DIAG_PIN PA11
#define E0_DIAG_PIN PC4
#define E1_DIAG_PIN PE7
#define X_STOP_PIN PA15
#define Y_STOP_PIN PA12
#define Z_MIN_PIN PA11
#define Z_MAX_PIN PC4
//
// Steppers
//
#define X_ENABLE_PIN PE4
#define X_STEP_PIN PE3
#define X_DIR_PIN PE2
#ifndef X_CS_PIN
#define X_CS_PIN PD5
#endif
#define Y_ENABLE_PIN PE1
#define Y_STEP_PIN PE0
#define Y_DIR_PIN PB9
#ifndef Y_CS_PIN
#define Y_CS_PIN PD7
#endif
#define Z_ENABLE_PIN PB8
#define Z_STEP_PIN PB5
#define Z_DIR_PIN PB4
#ifndef Z_CS_PIN
#define Z_CS_PIN PD4
#endif
#define E0_ENABLE_PIN PB3
#define E0_STEP_PIN PD6
#define E0_DIR_PIN PD3
#ifndef E0_CS_PIN
#define E0_CS_PIN PD9
#endif
#define E1_ENABLE_PIN PA3
#define E1_STEP_PIN PD15
#define E1_DIR_PIN PA1
#ifndef E1_CS_PIN
#define E1_CS_PIN PD8
#endif
//
// Software SPI pins for TMC2130 stepper drivers
//
#if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI
#define TMC_SW_MOSI PD14
#endif
#ifndef TMC_SW_MISO
#define TMC_SW_MISO PD1
#endif
#ifndef TMC_SW_SCK
#define TMC_SW_SCK PD0
#endif
#endif
#if HAS_TMC_UART
/**
* TMC2208/TMC2209 stepper drivers
*
* Hardware serial communication ports.
* If undefined software serial is used according to the pins below
*/
//#define X_HARDWARE_SERIAL Serial
//#define X2_HARDWARE_SERIAL Serial1
//#define Y_HARDWARE_SERIAL Serial1
//#define Y2_HARDWARE_SERIAL Serial1
//#define Z_HARDWARE_SERIAL Serial1
//#define Z2_HARDWARE_SERIAL Serial1
//#define E0_HARDWARE_SERIAL Serial1
//#define E1_HARDWARE_SERIAL Serial1
//#define E2_HARDWARE_SERIAL Serial1
//#define E3_HARDWARE_SERIAL Serial1
//#define E4_HARDWARE_SERIAL Serial1
//
// Software serial
//
#define X_SERIAL_TX_PIN PD5
#define X_SERIAL_RX_PIN PD5
#define Y_SERIAL_TX_PIN PD7
#define Y_SERIAL_RX_PIN PD7
#define Z_SERIAL_TX_PIN PD4
#define Z_SERIAL_RX_PIN PD4
#define E0_SERIAL_TX_PIN PD9
#define E0_SERIAL_RX_PIN PD9
#define E1_SERIAL_TX_PIN PD8
#define E1_SERIAL_RX_PIN PD8
// Reduce baud rate to improve software serial reliability
#define TMC_BAUD_RATE 19200
#endif // TMC2208 || TMC2209
//
// Temperature Sensors
//
#define TEMP_0_PIN PC1 // TH1
#define TEMP_1_PIN PC2 // TH2
#define TEMP_BED_PIN PC0 // TB1
//
// Heaters / Fans
//
#define HEATER_0_PIN PC3 // HEATER1
#define HEATER_1_PIN PB0 // HEATER2
#define HEATER_BED_PIN PA0 // HOT BED
#define FAN_PIN PB1 // FAN
//
// Thermocouples
//
//#define MAX6675_SS_PIN PE5 // TC1 - CS1
//#define MAX6675_SS_PIN PE6 // TC2 - CS2
//
// Misc. Functions
//
#define POWER_LOSS_PIN PA2 // PW_DET
#define PS_ON_PIN PA3 // PW_OFF
//#define SUICIDE_PIN PB2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
//#define SUICIDE_PIN_INVERTING false
//#define KILL_PIN PA2 // Enable MKSPWC support ROBIN NANO v1.2 ONLY
//#define KILL_PIN_INVERTING true // Enable MKSPWC support ROBIN NANO v1.2 ONLY
#define SERVO0_PIN PA8 // Enable BLTOUCH support ROBIN NANO v1.2 ONLY
//#define LED_PIN PB2
#define MT_DET_1_PIN PA4
#define MT_DET_2_PIN PE6
#define MT_DET_PIN_INVERTING false
#define WIFI_IO0_PIN PC13
//
// SD Card
//
#ifndef SDCARD_CONNECTION
#define SDCARD_CONNECTION ONBOARD
#endif
#define SDIO_SUPPORT
#define SDIO_CLOCK 4500000 // 4.5 MHz
#define SD_DETECT_PIN PD12
#define ONBOARD_SD_CS_PIN PC11
//
// LCD / Controller
//
#define BEEPER_PIN PC5
/**
* Note: MKS Robin TFT screens use various TFT controllers.
* If the screen stays white, disable 'LCD_RESET_PIN'
* to let the bootloader init the screen.
*/
#if ENABLED(TFT_LVGL_UI_SPI)
#define SPI_TFT_CS_PIN PD11
#define SPI_TFT_SCK_PIN PA5
#define SPI_TFT_MISO_PIN PA6
#define SPI_TFT_MOSI_PIN PA7
#define SPI_TFT_DC_PIN PD10
#define SPI_TFT_RST_PIN PC6
#define LCD_BACKLIGHT_PIN PD13
#define TOUCH_CS_PIN PE14 // SPI1_NSS
#define TOUCH_SCK_PIN PA5 // SPI1_SCK
#define TOUCH_MISO_PIN PA6 // SPI1_MISO
#define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#else
#if ENABLED(TFT_LITTLE_VGL_UI)
//FSMC LCD
#define FSMC_CS_PIN PD7 // NE4
#define FSMC_RS_PIN PD11 // A0
#define TOUCH_CS_PIN PA7 // SPI2_NSS
#define TOUCH_SCK_PIN PB13 // SPI2_SCK
#define TOUCH_MISO_PIN PB14 // SPI2_MISO
#define TOUCH_MOSI_PIN PB15 // SPI2_MOSI
#define LCD_BACKLIGHT_PIN PD13
#endif // TFT_LITTLE_VGL_UI
#endif // TFT_LVGL_UI_SPI
#if HAS_SPI_LCD
#define BEEPER_PIN PC5
#define BTN_ENC PE13
#define LCD_PINS_ENABLE PD13
#define LCD_PINS_RS PC6
#define BTN_EN1 PE8
#define BTN_EN2 PE11
#define LCD_BACKLIGHT_PIN -1
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
#if ENABLED(MKS_MINI_12864)
#define LCD_BACKLIGHT_PIN -1
#define LCD_RESET_PIN -1
#define DOGLCD_A0 PD11
#define DOGLCD_CS PE15
#define DOGLCD_SCK PA5
#define DOGLCD_MOSI PA7
// Required for MKS_MINI_12864 with this board
#define MKS_LCD12864B
#undef SHOW_BOOTSCREEN
#else // !MKS_MINI_12864
#define LCD_PINS_D4 PE14
#if ENABLED(ULTIPANEL)
#define LCD_PINS_D5 PE15
#define LCD_PINS_D6 PD11
#define LCD_PINS_D7 PD10
#endif
#ifndef BOARD_ST7920_DELAY_1
#define BOARD_ST7920_DELAY_1 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_2
#define BOARD_ST7920_DELAY_2 DELAY_NS(125)
#endif
#ifndef BOARD_ST7920_DELAY_3
#define BOARD_ST7920_DELAY_3 DELAY_NS(125)
#endif
#endif // !MKS_MINI_12864
#endif // HAS_SPI_LCD
#define SPI_FLASH
#if ENABLED(SPI_FLASH)
#define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14
#define W25QXX_SCK_PIN PB13
#endif

View file

@ -0,0 +1,46 @@
Import("env")
import os
import requests
import zipfile
import tempfile
import shutil
url = "https://github.com/makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware/archive/master.zip"
zip_path = os.path.join(env.Dictionary("PROJECT_LIBDEPS_DIR"), "mks-assets.zip")
assets_path = os.path.join(env.Dictionary("PROJECT_BUILD_DIR"), env.Dictionary("PIOENV"), "assets")
def download_mks_assets():
print("Downloading MKS Assets")
r = requests.get(url, stream=True)
# the user may have a very clean workspace,
# so create the PROJECT_LIBDEPS_DIR directory if not exits
if os.path.exists(env.Dictionary("PROJECT_LIBDEPS_DIR")) == False:
os.mkdir(env.Dictionary("PROJECT_LIBDEPS_DIR"))
with open(zip_path, 'wb') as fd:
for chunk in r.iter_content(chunk_size=128):
fd.write(chunk)
def copy_mks_assets():
print("Copying MKS Assets")
output_path = tempfile.mkdtemp()
zip_obj = zipfile.ZipFile(zip_path, 'r')
zip_obj.extractall(output_path)
zip_obj.close()
if os.path.exists(assets_path) == True and os.path.isdir(assets_path) == False:
os.unlink(assets_path)
if os.path.exists(assets_path) == False:
os.mkdir(assets_path)
base_path = ''
for filename in os.listdir(output_path):
base_path = filename
for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_font')):
shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_font', filename), assets_path)
for filename in os.listdir(os.path.join(output_path, base_path, 'Firmware', 'mks_pic')):
shutil.copy(os.path.join(output_path, base_path, 'Firmware', 'mks_pic', filename), assets_path)
shutil.rmtree(output_path, ignore_errors=True)
if os.path.exists(zip_path) == False:
download_mks_assets()
if os.path.exists(assets_path) == False:
copy_mks_assets()

View file

@ -37,8 +37,9 @@ lib_deps =
# Feature Dependencies
#
[features]
TFT_LVGL_UI = MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
HAS_TFT_LVGL_UI = lvgl=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
src_filter=+<src/lcd/extui/lib/mks_ui>
extra_scripts=download_mks_assets.py
HAS_TRINAMIC_CONFIG = TMCStepper@~0.7.1
SR_LCD_3W_NL = SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
DIGIPOT_MCP4... = SlowSoftI2CMaster
@ -525,7 +526,7 @@ build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE -DARDUINO_GENERIC_STM32F103V -DARDUINO_ARCH_STM32F1 -DBOARD_generic_stm32f103v
-DDEBUG_LEVEL=DEBUG_NONE -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DVECT_TAB_ADDR=0x8000000
-DERROR_LED_PORT=GPIOE -DERROR_LED_PIN=6
upload_protocol = serial
upload_protocol = serial
#
# Longer 3D board in Alfawise U20 (STM32F103VET6)
@ -555,7 +556,7 @@ build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE
#
# MKS Robin Nano (STM32F103VET6) - Emulated Graphical 128x64 (DOGM) UI
# MKS Robin Nano (STM32F103VET6) - Emulated Graphical 128x64 (DOGM) UI and LVGL UI
#
[env:mks_robin_nano]
platform = ${common_stm32f1.platform}
@ -567,6 +568,18 @@ extra_scripts = ${common.extra_scripts}
build_flags = ${common_stm32f1.build_flags}
-DMCU_STM32F103VE -DSS_TIMER=4
#
# MKS Robin Nano v2.0 (STM32F103VET6) - LVGL UI
#
[env:mks_robin_nano35_v2]
platform = ${common_stm32f1.platform}
extends = env:mks_robin_nano
extra_scripts = ${common.extra_scripts}
buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
lib_deps = ${common_stm32f1.lib_deps}
debug_tool = jlink
upload_protocol = jlink
#
# MKS Robin (STM32F103ZET6)
#
@ -753,8 +766,8 @@ extra_scripts = ${common.extra_scripts}
# FYSETC S6 (STM32F446VET6 ARM Cortex-M4)
#
[env:FYSETC_S6]
platform = ${common_stm32.platform}
extends = common_stm32
platform = ${common_stm32.platform}
extends = common_stm32
platform_packages = ${common_stm32.platform_packages}
tool-stm32duino
board = fysetc_s6