Add TFT_LVGL_UI support (#18438)
This commit is contained in:
parent
39105384ba
commit
e5bc9d31cc
|
@ -2135,9 +2135,12 @@
|
||||||
//#define FSMC_GRAPHICAL_TFT
|
//#define FSMC_GRAPHICAL_TFT
|
||||||
|
|
||||||
//
|
//
|
||||||
// TFT Little VGL UI
|
// TFT LVGL UI
|
||||||
//
|
//
|
||||||
//#define TFT_LITTLE_VGL_UI
|
// Default MKS icons and fonts: https://git.io/JJvzK
|
||||||
|
// Copy mks_pic and mks_font folders to the root of your SD
|
||||||
|
//
|
||||||
|
//#define TFT_LVGL_UI
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//============================ Other Controllers ============================
|
//============================ Other Controllers ============================
|
||||||
|
|
|
@ -291,7 +291,7 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
|
||||||
return uint32_t(data);
|
return uint32_t(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(LCD_USE_DMA_FSMC)
|
#ifdef LCD_USE_DMA_FSMC
|
||||||
|
|
||||||
void LCD_IO_WriteMultiple(uint16_t color, uint32_t count) {
|
void LCD_IO_WriteMultiple(uint16_t color, uint32_t count) {
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
#include "gcode/parser.h"
|
#include "gcode/parser.h"
|
||||||
#include "gcode/queue.h"
|
#include "gcode/queue.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "lcd/extui/lib/mks_ui/tft_lvgl_configuration.h"
|
#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/draw_ui.h"
|
||||||
|
@ -743,7 +743,7 @@ void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) {
|
||||||
// Direct Stepping
|
// Direct Stepping
|
||||||
TERN_(DIRECT_STEPPING, page_manager.write_responses());
|
TERN_(DIRECT_STEPPING, page_manager.write_responses());
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
LV_TASK_HANDLER();
|
LV_TASK_HANDLER();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1180,8 @@ void setup() {
|
||||||
SETUP_RUN(page_manager.init());
|
SETUP_RUN(page_manager.init());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
if (!card.isMounted()) SETUP_RUN(card.mount()); // Mount SD to load graphics and fonts
|
||||||
SETUP_RUN(tft_lvgl_init());
|
SETUP_RUN(tft_lvgl_init());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1216,7 +1217,7 @@ void loop() {
|
||||||
|
|
||||||
endstops.event_handler();
|
endstops.event_handler();
|
||||||
|
|
||||||
TERN_(TFT_LITTLE_VGL_UI, printer_state_polling());
|
TERN_(TFT_LVGL_UI, printer_state_polling());
|
||||||
|
|
||||||
} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
|
} while (ENABLED(__AVR__)); // Loop forever on slower (AVR) boards
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,7 @@ void XPT2046::init() {
|
||||||
#include "../../lcd/ultralcd.h" // For EN_C bit mask
|
#include "../../lcd/ultralcd.h" // For EN_C bit mask
|
||||||
|
|
||||||
uint8_t XPT2046::read_buttons() {
|
uint8_t XPT2046::read_buttons() {
|
||||||
|
#ifdef HAS_SPI_LCD
|
||||||
int16_t tsoffsets[4] = { 0 };
|
int16_t tsoffsets[4] = { 0 };
|
||||||
|
|
||||||
if (tsoffsets[0] + tsoffsets[1] == 0) {
|
if (tsoffsets[0] + tsoffsets[1] == 0) {
|
||||||
|
@ -134,6 +135,7 @@ uint8_t XPT2046::read_buttons() {
|
||||||
|
|
||||||
// Send the touch to the UI (which will simulate the encoder wheel)
|
// Send the touch to the UI (which will simulate the encoder wheel)
|
||||||
MarlinUI::screen_click(row, col, x, y);
|
MarlinUI::screen_click(row, col, x, y);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#if ENABLED(LCD_USE_DMA_FSMC)
|
#ifdef LCD_USE_DMA_FSMC
|
||||||
extern void LCD_IO_WriteReg(uint16_t Reg);
|
extern void LCD_IO_WriteReg(uint16_t Reg);
|
||||||
extern void LCD_IO_WriteData(uint16_t RegValue);
|
extern void LCD_IO_WriteData(uint16_t RegValue);
|
||||||
extern void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
|
extern void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if 1 // ENABLED(SPI_FLASH)
|
#if 1 // ENABLED(SPI_FLASH)
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "../../../../inc/MarlinConfig.h"
|
#include "../../../../inc/MarlinConfig.h"
|
||||||
|
@ -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);}
|
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_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
#endif // 1 ... SPI_FLASH
|
#endif // 1 ... SPI_FLASH
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -99,29 +99,28 @@ void lv_draw_about(void) {
|
||||||
|
|
||||||
fw_version = lv_label_create(scr, NULL);
|
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_lable_rel);
|
||||||
lv_label_set_text(fw_version, "Version: V_2.0.5.3");
|
lv_label_set_text(fw_version, SHORT_BUILD_VERSION);
|
||||||
lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
|
lv_obj_align(fw_version, NULL, LV_ALIGN_CENTER, 0, -60);
|
||||||
|
|
||||||
fw_type = lv_label_create(scr, NULL);
|
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_lable_rel);
|
||||||
#if (MOTHERBOARD == BOARD_MKS_ROBIN_PRO)
|
lv_label_set_text(fw_type,
|
||||||
lv_label_set_text(fw_type, "Firmware: Robin_Pro35");
|
#if MB(MKS_ROBIN_PRO)
|
||||||
#elif (MOTHERBOARD == BOARD_MKS_ROBIN_NANO)
|
"Firmware: Robin_Pro35"
|
||||||
lv_label_set_text(fw_type, "Firmware: Robin_Nano35");
|
#elif MB(MKS_ROBIN_NANO)
|
||||||
|
"Firmware: Robin_Nano35"
|
||||||
|
#else
|
||||||
|
CUSTOM_MACHINE_NAME
|
||||||
#endif
|
#endif
|
||||||
|
);
|
||||||
lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
|
lv_obj_align(fw_type, NULL, LV_ALIGN_CENTER, 0, -20);
|
||||||
|
|
||||||
board = lv_label_create(scr, NULL);
|
board = lv_label_create(scr, NULL);
|
||||||
lv_obj_set_style(board, &tft_style_lable_rel);
|
lv_obj_set_style(board, &tft_style_lable_rel);
|
||||||
#if (MOTHERBOARD == BOARD_MKS_ROBIN_PRO)
|
lv_label_set_text(board, "Board: " BOARD_INFO_NAME);
|
||||||
lv_label_set_text(board, "Board: MKS Robin pro");
|
|
||||||
#elif (MOTHERBOARD == BOARD_MKS_ROBIN_NANO)
|
|
||||||
lv_label_set_text(board, "Board: MKS Robin nano");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, 20);
|
lv_obj_align(board, NULL, LV_ALIGN_CENTER, 0, 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_clear_about() { lv_obj_del(scr); }
|
void lv_clear_about() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -310,13 +310,13 @@ void disp_print_speed() {
|
||||||
void disp_speed_type() {
|
void disp_speed_type() {
|
||||||
switch (speedType) {
|
switch (speedType) {
|
||||||
case 1:
|
case 1:
|
||||||
lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_Extruct_speed_sel.bin", 0);
|
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_speed.bin", 0);
|
lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_changespeed.bin", 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_Extruct_speed.bin", 0);
|
lv_obj_set_event_cb_mks(buttonExt, event_handler, ID_C_EXT, "bmp_Extruct.bin", 0);
|
||||||
lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_Mov_speed_sel.bin", 0);
|
lv_obj_set_event_cb_mks(buttonMov, event_handler, ID_C_MOVE, "bmp_mov_sel.bin", 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lv_obj_refresh_ext_draw_pad(buttonExt);
|
lv_obj_refresh_ext_draw_pad(buttonExt);
|
||||||
|
@ -333,4 +333,4 @@ void disp_speed_type() {
|
||||||
|
|
||||||
void lv_clear_change_speed() { lv_obj_del(scr); }
|
void lv_clear_change_speed() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
|
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -61,7 +61,9 @@ static void btn_ok_event_cb(lv_obj_t * btn, lv_event_t event) {
|
||||||
}
|
}
|
||||||
else if (event == LV_EVENT_RELEASED) {
|
else if (event == LV_EVENT_RELEASED) {
|
||||||
if (DialogType == DIALOG_TYPE_PRINT_FILE) {
|
if (DialogType == DIALOG_TYPE_PRINT_FILE) {
|
||||||
|
#if HAS_GCODE_PREVIEW
|
||||||
preview_gcode_prehandle(list_file.file_name[sel_id]);
|
preview_gcode_prehandle(list_file.file_name[sel_id]);
|
||||||
|
#endif
|
||||||
reset_print_time();
|
reset_print_time();
|
||||||
start_print_time();
|
start_print_time();
|
||||||
|
|
||||||
|
@ -202,7 +204,7 @@ void lv_draw_dialog(uint8_t type) {
|
||||||
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
|
style_btn_rel.body.shadow.type = LV_SHADOW_BOTTOM;
|
||||||
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
style_btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
||||||
style_btn_rel.text.color = lv_color_hex3(0xDEF);
|
style_btn_rel.text.color = lv_color_hex3(0xDEF);
|
||||||
style_btn_rel.text.font = &gb2312_puhui32;
|
style_btn_rel.text.font = &lv_font_roboto_22;
|
||||||
|
|
||||||
static lv_style_t style_btn_pr; // A variable to store the pressed 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
|
lv_style_copy(&style_btn_pr, &style_btn_rel); // Initialize from the released style
|
||||||
|
@ -211,7 +213,7 @@ void lv_draw_dialog(uint8_t type) {
|
||||||
style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
|
style_btn_pr.body.grad_color = lv_color_hex3(0x24A);
|
||||||
style_btn_pr.body.shadow.width = 2;
|
style_btn_pr.body.shadow.width = 2;
|
||||||
style_btn_pr.text.color = lv_color_hex3(0xBCD);
|
style_btn_pr.text.color = lv_color_hex3(0xBCD);
|
||||||
style_btn_pr.text.font = &gb2312_puhui32;
|
style_btn_pr.text.font = &lv_font_roboto_22;
|
||||||
|
|
||||||
lv_obj_t * labelDialog = lv_label_create(scr, NULL);
|
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_lable_rel);
|
||||||
|
@ -340,4 +342,4 @@ void lv_draw_dialog(uint8_t type) {
|
||||||
|
|
||||||
void lv_clear_dialog() { lv_obj_del(scr); }
|
void lv_clear_dialog() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -81,4 +81,4 @@ void lv_draw_error_message(PGM_P const msg) {
|
||||||
|
|
||||||
void lv_clear_error_message() { lv_obj_del(scr); }
|
void lv_clear_error_message() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -375,4 +375,4 @@ void disp_ext_step() {
|
||||||
|
|
||||||
void lv_clear_extrusion() { lv_obj_del(scr); }
|
void lv_clear_extrusion() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
|
@ -244,4 +244,4 @@ void disp_fan_value() {
|
||||||
|
|
||||||
void lv_clear_fan() { lv_obj_del(scr); }
|
void lv_clear_fan() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "draw_ready_print.h"
|
#include "draw_ready_print.h"
|
||||||
|
@ -190,13 +190,13 @@ void lv_draw_home(void) {
|
||||||
lv_imgbtn_set_style(buttonHomeZ, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
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_REL, &tft_style_lable_rel);
|
||||||
|
|
||||||
lv_obj_set_event_cb_mks(buttonOffAll, event_handler, ID_H_OFF_ALL, "bmp_Motor_off.bin", 0);
|
lv_obj_set_event_cb_mks(buttonOffAll, event_handler, ID_H_OFF_ALL, "bmp_manual_off.bin", 0);
|
||||||
lv_imgbtn_set_src(buttonOffAll, LV_BTN_STATE_REL, &bmp_pic);
|
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_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_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_REL, &tft_style_lable_rel);
|
||||||
|
|
||||||
lv_obj_set_event_cb_mks(buttonOffXY, event_handler, ID_H_OFF_XY, "bmp_Motor_off.bin", 0);
|
lv_obj_set_event_cb_mks(buttonOffXY, event_handler, ID_H_OFF_XY, "bmp_manual_off.bin", 0);
|
||||||
lv_imgbtn_set_src(buttonOffXY, LV_BTN_STATE_REL, &bmp_pic);
|
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_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_PR, &tft_style_lable_pre);
|
||||||
|
@ -280,4 +280,4 @@ void lv_draw_home(void) {
|
||||||
|
|
||||||
void lv_clear_home() { lv_obj_del(scr); }
|
void lv_clear_home() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -61,7 +61,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||||
}
|
}
|
||||||
else if (event == LV_EVENT_RELEASED) {
|
else if (event == LV_EVENT_RELEASED) {
|
||||||
disp_language(gCfgItems.language, UNSELECTED);
|
disp_language(gCfgItems.language, UNSELECTED);
|
||||||
lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, "bmp_Simple_cn_sel.bin", 0);
|
lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, "bmp_simplified_cn_sel.bin", 0);
|
||||||
gCfgItems.language = LANG_SIMPLE_CHINESE;
|
gCfgItems.language = LANG_SIMPLE_CHINESE;
|
||||||
gCfg_to_spiFlah();
|
gCfg_to_spiFlah();
|
||||||
disp_language_init();
|
disp_language_init();
|
||||||
|
@ -73,7 +73,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||||
}
|
}
|
||||||
else if (event == LV_EVENT_RELEASED) {
|
else if (event == LV_EVENT_RELEASED) {
|
||||||
disp_language(gCfgItems.language, UNSELECTED);
|
disp_language(gCfgItems.language, UNSELECTED);
|
||||||
lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, "bmp_Tradition_cn_sel.bin", 0);
|
lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, "bmp_traditional_cn_sel.bin", 0);
|
||||||
gCfgItems.language = LANG_COMPLEX_CHINESE;
|
gCfgItems.language = LANG_COMPLEX_CHINESE;
|
||||||
gCfg_to_spiFlah();
|
gCfg_to_spiFlah();
|
||||||
disp_language_init();
|
disp_language_init();
|
||||||
|
@ -258,14 +258,14 @@ void lv_draw_language(void) {
|
||||||
buttonBack = lv_imgbtn_create(scr, NULL);
|
buttonBack = lv_imgbtn_create(scr, NULL);
|
||||||
|
|
||||||
|
|
||||||
lv_obj_set_event_cb_mks(buttonCN, event_handler, ID_CN, "bmp_Simple_cn.bin", 0);
|
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_REL, &bmp_pic);
|
||||||
lv_imgbtn_set_src(buttonCN, LV_BTN_STATE_PR, &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_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_REL, &tft_style_lable_rel);
|
||||||
lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
|
lv_obj_clear_protect(buttonCN, LV_PROTECT_FOLLOW);
|
||||||
#if 1
|
#if 1
|
||||||
lv_obj_set_event_cb_mks(buttonT_CN, event_handler, ID_T_CN, "bmp_Tradition_cn.bin", 0);
|
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_REL, &bmp_pic);
|
||||||
lv_imgbtn_set_src(buttonT_CN, LV_BTN_STATE_PR, &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_PR, &tft_style_lable_pre);
|
||||||
|
@ -367,4 +367,4 @@ void lv_draw_language(void) {
|
||||||
|
|
||||||
void lv_clear_language() { lv_obj_del(scr); }
|
void lv_clear_language() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
|
@ -281,4 +281,4 @@ void lv_draw_manualLevel(void) {
|
||||||
|
|
||||||
void lv_clear_manualLevel() { lv_obj_del(scr); }
|
void lv_clear_manualLevel() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
|
@ -326,4 +326,4 @@ void disp_move_dist() {
|
||||||
|
|
||||||
void lv_clear_move_motor() { lv_obj_del(scr); }
|
void lv_clear_move_motor() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -116,7 +116,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||||
else if (event == LV_EVENT_RELEASED) {
|
else if (event == LV_EVENT_RELEASED) {
|
||||||
if (gCfgItems.finish_power_off == 1) {
|
if (gCfgItems.finish_power_off == 1) {
|
||||||
gCfgItems.finish_power_off = 0;
|
gCfgItems.finish_power_off = 0;
|
||||||
lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_Mamual.bin", 0);
|
lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_manual_off.bin", 0); //dindt find bmp_Mamual...
|
||||||
lv_label_set_text(label_PowerOff, printing_more_menu.manual);
|
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_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||||
lv_obj_refresh_ext_draw_pad(label_PowerOff);
|
lv_obj_refresh_ext_draw_pad(label_PowerOff);
|
||||||
|
@ -124,7 +124,7 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
gCfgItems.finish_power_off = 1;
|
gCfgItems.finish_power_off = 1;
|
||||||
lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_Auto.bin", 0);
|
lv_obj_set_event_cb_mks(obj, event_handler, ID_O_POWER_OFF, "bmp_auto_off.bin", 0);
|
||||||
lv_label_set_text(label_PowerOff, printing_more_menu.auto_close);
|
lv_label_set_text(label_PowerOff, printing_more_menu.auto_close);
|
||||||
lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
lv_obj_align(label_PowerOff, buttonPowerOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||||
lv_obj_refresh_ext_draw_pad(label_PowerOff);
|
lv_obj_refresh_ext_draw_pad(label_PowerOff);
|
||||||
|
@ -218,9 +218,9 @@ void lv_draw_opration(void) {
|
||||||
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
lv_imgbtn_set_style(buttonMove, LV_BTN_STATE_REL, &tft_style_lable_rel);
|
||||||
}
|
}
|
||||||
if (gCfgItems.finish_power_off == 1)
|
if (gCfgItems.finish_power_off == 1)
|
||||||
lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_Auto.bin", 0);
|
lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_auto_off.bin", 0);
|
||||||
else
|
else
|
||||||
lv_obj_set_event_cb_mks(buttonPowerOff, event_handler, ID_O_POWER_OFF, "bmp_Mamual.bin", 0);
|
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_REL, &bmp_pic);
|
||||||
lv_imgbtn_set_src(buttonPowerOff, LV_BTN_STATE_PR, &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_PR, &tft_style_lable_pre);
|
||||||
|
@ -319,4 +319,4 @@ void lv_draw_opration(void) {
|
||||||
|
|
||||||
void lv_clear_opration() { lv_obj_del(scr); }
|
void lv_clear_opration() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if BOTH(TFT_LITTLE_VGL_UI, ADVANCED_PAUSE_FEATURE)
|
#if BOTH(TFT_LVGL_UI, ADVANCED_PAUSE_FEATURE)
|
||||||
|
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
|
@ -52,4 +52,4 @@ void lv_draw_pause_message(const PauseMessage msg) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI && ADVANCED_PAUSE_FEATURE
|
#endif // TFT_LVGL_UI && ADVANCED_PAUSE_FEATURE
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -389,4 +389,4 @@ void disp_step_heat() {
|
||||||
|
|
||||||
void lv_clear_preHeat() { lv_obj_del(scr); }
|
void lv_clear_preHeat() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
|
@ -324,7 +324,7 @@ void disp_gcode_icon(uint8_t file_num) {
|
||||||
lv_imgbtn_set_style(buttonPageDown, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
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_REL, &tft_style_lable_rel);
|
||||||
|
|
||||||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_P_RETURN, "bmp_Back.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_117x92);
|
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_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_PR, &tft_style_lable_pre);
|
||||||
|
@ -445,21 +445,9 @@ void disp_gcode_icon(uint8_t file_num) {
|
||||||
|
|
||||||
void lv_open_gcode_file(char *path) {
|
void lv_open_gcode_file(char *path) {
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
//uint32_t read;
|
|
||||||
uint32_t *ps4;
|
|
||||||
int pre_sread_cnt;
|
|
||||||
char *cur_name;
|
char *cur_name;
|
||||||
|
|
||||||
cur_name = strrchr(path, '/');
|
cur_name = strrchr(path, '/');
|
||||||
|
|
||||||
card.openFileRead(cur_name);
|
card.openFileRead(cur_name);
|
||||||
card.read(public_buf, 512);
|
|
||||||
ps4 = (uint32_t *)strstr((char *)public_buf, ";simage:");
|
|
||||||
|
|
||||||
if (ps4) {
|
|
||||||
pre_sread_cnt = (uint32_t)ps4 - (uint32_t)((uint32_t *)(&public_buf[0]));
|
|
||||||
card.setIndex(pre_sread_cnt + 8);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,29 +468,63 @@ int ascii2dec_test(char *ascii) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lv_gcode_file_read(uint8_t *data_buf) {
|
void lv_gcode_file_read(uint8_t *data_buf)
|
||||||
#if ENABLED(SDSUPPORT)
|
{
|
||||||
uint16_t i = 0, j = 0, k = 0;
|
#if ENABLED (SDSUPPORT)
|
||||||
//uint32_t read;
|
uint16_t i=0,j=0,k=0;
|
||||||
uint16_t row_1 = 0;
|
uint16_t row_1=0;
|
||||||
|
bool ignore_start = true;
|
||||||
char temp_test[200];
|
char temp_test[200];
|
||||||
|
volatile uint16_t *p_index;
|
||||||
|
|
||||||
while (1) {
|
memset(public_buf, 0, 200);
|
||||||
card.read(temp_test, 200);
|
|
||||||
for (i = 0; i < 200;) {
|
while(card.isFileOpen())
|
||||||
public_buf[row_1 * 200 + 100 * k + j] = (char)(ascii2dec_test(&temp_test[i]) << 4 | ascii2dec_test(&temp_test[i + 1]));
|
{
|
||||||
j++;
|
if (ignore_start) card.read(temp_test, 8); //line start -> ignore
|
||||||
i += 2;
|
card.read(temp_test, 200); //data
|
||||||
}
|
//\r;;gimage: we got the bit img, so stop here
|
||||||
k++;
|
if (temp_test[1] == ';') {
|
||||||
j = 0;
|
card.closefile();
|
||||||
if (k >= 2) {
|
|
||||||
k = 0;
|
|
||||||
card.read(temp_test, 9);
|
|
||||||
break;
|
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]));
|
||||||
|
j++;
|
||||||
|
i+=2;
|
||||||
}
|
}
|
||||||
memcpy(data_buf, public_buf, 200);
|
|
||||||
|
uint16_t c = card.get();
|
||||||
|
//check if we have more data or finished the line (CR)
|
||||||
|
if (c == '\r') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
card.setIndex(card.getIndex());
|
||||||
|
k++;
|
||||||
|
j=0;
|
||||||
|
ignore_start = false;
|
||||||
|
}
|
||||||
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
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; //
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
memcpy(data_buf,public_buf,200);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -592,4 +614,4 @@ void cutFileName(char *path, int len, int bytePerLine, char *outStr) {
|
||||||
|
|
||||||
void lv_clear_print_file() { lv_obj_del(scr); }
|
void lv_clear_print_file() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -308,13 +308,13 @@ void lv_draw_printing(void) {
|
||||||
lv_label_set_text(labelPause, printing_menu.pause);
|
lv_label_set_text(labelPause, printing_menu.pause);
|
||||||
else
|
else
|
||||||
lv_label_set_text(labelPause, printing_menu.resume);
|
lv_label_set_text(labelPause, printing_menu.resume);
|
||||||
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 30, 0);
|
lv_obj_align(labelPause, buttonPause, LV_ALIGN_CENTER, 20, 0);
|
||||||
|
|
||||||
lv_label_set_text(labelStop, printing_menu.stop);
|
lv_label_set_text(labelStop, printing_menu.stop);
|
||||||
lv_obj_align(labelStop, buttonStop, LV_ALIGN_CENTER, 30, 0);
|
lv_obj_align(labelStop, buttonStop, LV_ALIGN_CENTER, 20, 0);
|
||||||
|
|
||||||
lv_label_set_text(labelOperat, printing_menu.option);
|
lv_label_set_text(labelOperat, printing_menu.option);
|
||||||
lv_obj_align(labelOperat, buttonOperat, LV_ALIGN_CENTER, 30, 0);
|
lv_obj_align(labelOperat, buttonOperat, LV_ALIGN_CENTER, 20, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
lv_style_copy(&lv_bar_style_indic, &lv_style_pretty_color);
|
lv_style_copy(&lv_bar_style_indic, &lv_style_pretty_color);
|
||||||
|
@ -440,4 +440,4 @@ void setProBarRate() {
|
||||||
|
|
||||||
void lv_clear_printing() { lv_obj_del(scr); }
|
void lv_clear_printing() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "draw_ready_print.h"
|
#include "draw_ready_print.h"
|
||||||
#include "draw_tool.h"
|
#include "draw_tool.h"
|
||||||
|
@ -260,7 +260,7 @@ void lv_draw_ready_print(void) {
|
||||||
buttonTool = lv_imgbtn_create(scr, NULL);
|
buttonTool = lv_imgbtn_create(scr, NULL);
|
||||||
buttonSet = lv_imgbtn_create(scr, NULL);
|
buttonSet = lv_imgbtn_create(scr, NULL);
|
||||||
|
|
||||||
lv_obj_set_event_cb_mks(buttonPrint, event_handler, ID_PRINT, "bmp_Print.bin", 0);
|
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_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_REL, &bmp_pic);
|
||||||
lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_PR, &bmp_pic);
|
lv_imgbtn_set_src(buttonPrint, LV_BTN_STATE_PR, &bmp_pic);
|
||||||
|
@ -316,4 +316,4 @@ void lv_draw_ready_print(void) {
|
||||||
|
|
||||||
void lv_clear_ready_print() { lv_obj_del(scr); }
|
void lv_clear_ready_print() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "draw_ready_print.h"
|
#include "draw_ready_print.h"
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
//#include "../lvgl/src/lv_core/lv_refr.h"
|
//#include "../lvgl/src/lv_core/lv_refr.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
#include "../../../../gcode/queue.h"
|
#include "../../../../gcode/queue.h"
|
||||||
|
#include "pic_manager.h"
|
||||||
|
|
||||||
static lv_obj_t * scr;
|
static lv_obj_t * scr;
|
||||||
|
|
||||||
|
@ -110,7 +111,10 @@ static void event_handler(lv_obj_t * obj, lv_event_t event) {
|
||||||
|
|
||||||
void lv_draw_set(void) {
|
void lv_draw_set(void) {
|
||||||
lv_obj_t *buttonFan, *buttonAbout;
|
lv_obj_t *buttonFan, *buttonAbout;
|
||||||
lv_obj_t *buMotorOff, *buttonLanguage, *buttonBack;
|
lv_obj_t *buMotorOff, *buttonBack;
|
||||||
|
#if HAS_LANG_SELECT_SCREEN
|
||||||
|
lv_obj_t *buttonLanguage;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != SET_UI) {
|
if (disp_state_stack._disp_state[disp_state_stack._disp_index] != SET_UI) {
|
||||||
disp_state_stack._disp_index++;
|
disp_state_stack._disp_index++;
|
||||||
|
@ -141,7 +145,9 @@ void lv_draw_set(void) {
|
||||||
buttonAbout = lv_imgbtn_create(scr, NULL);
|
buttonAbout = lv_imgbtn_create(scr, NULL);
|
||||||
//buttonContinue = lv_imgbtn_create(scr, NULL);
|
//buttonContinue = lv_imgbtn_create(scr, NULL);
|
||||||
buMotorOff = lv_imgbtn_create(scr, NULL);
|
buMotorOff = lv_imgbtn_create(scr, NULL);
|
||||||
|
#if HAS_LANG_SELECT_SCREEN
|
||||||
buttonLanguage = lv_imgbtn_create(scr, NULL);
|
buttonLanguage = lv_imgbtn_create(scr, NULL);
|
||||||
|
#endif
|
||||||
buttonBack = lv_imgbtn_create(scr, NULL);
|
buttonBack = lv_imgbtn_create(scr, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
@ -170,20 +176,22 @@ void lv_draw_set(void) {
|
||||||
//lv_imgbtn_set_style(buttonContinue, LV_BTN_STATE_PR, &tft_style_lable_pre);
|
//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_REL, &tft_style_lable_rel);
|
||||||
#if HAS_SUICIDE
|
#if HAS_SUICIDE
|
||||||
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_Mamual.bin", 0);
|
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_manual_off.bin", 0);
|
||||||
#else
|
#else
|
||||||
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_Motor_off.bin", 0);
|
lv_obj_set_event_cb_mks(buMotorOff, event_handler, ID_S_MOTOR_OFF, "bmp_manual_off.bin", 0);
|
||||||
#endif
|
#endif
|
||||||
lv_imgbtn_set_src(buMotorOff, LV_BTN_STATE_REL, &bmp_pic);
|
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_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_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_REL, &tft_style_lable_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_REL, &bmp_pic);
|
||||||
lv_imgbtn_set_src(buttonLanguage, LV_BTN_STATE_PR, &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_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_REL, &tft_style_lable_rel);
|
||||||
|
#endif
|
||||||
|
|
||||||
lv_obj_set_event_cb_mks(buttonBack, event_handler, ID_S_RETURN, "bmp_Return.bin", 0);
|
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_REL, &bmp_pic);
|
||||||
|
@ -205,7 +213,9 @@ void lv_draw_set(void) {
|
||||||
lv_obj_set_pos(buttonAbout, BTN_X_PIXEL * 2 + INTERVAL_V * 3, 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(buttonContinue,BTN_X_PIXEL*3+INTERVAL_V*4,titleHeight);
|
||||||
lv_obj_set_pos(buMotorOff, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
|
lv_obj_set_pos(buMotorOff, BTN_X_PIXEL * 3 + INTERVAL_V * 4, titleHeight);
|
||||||
|
#if HAS_LANG_SELECT_SCREEN
|
||||||
lv_obj_set_pos(buttonLanguage, INTERVAL_V, titleHeight);
|
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(buttonBack, BTN_X_PIXEL * 3 + INTERVAL_V * 4, BTN_Y_PIXEL + INTERVAL_H + titleHeight);
|
||||||
|
|
||||||
/*Create a label on the Image button*/
|
/*Create a label on the Image button*/
|
||||||
|
@ -214,7 +224,9 @@ void lv_draw_set(void) {
|
||||||
lv_btn_set_layout(buttonAbout, LV_LAYOUT_OFF);
|
lv_btn_set_layout(buttonAbout, LV_LAYOUT_OFF);
|
||||||
//lv_btn_set_layout(buttonContinue, LV_LAYOUT_OFF);
|
//lv_btn_set_layout(buttonContinue, LV_LAYOUT_OFF);
|
||||||
lv_btn_set_layout(buMotorOff, LV_LAYOUT_OFF);
|
lv_btn_set_layout(buMotorOff, LV_LAYOUT_OFF);
|
||||||
|
#if HAS_LANG_SELECT_SCREEN
|
||||||
lv_btn_set_layout(buttonLanguage, LV_LAYOUT_OFF);
|
lv_btn_set_layout(buttonLanguage, LV_LAYOUT_OFF);
|
||||||
|
#endif
|
||||||
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
|
lv_btn_set_layout(buttonBack, LV_LAYOUT_OFF);
|
||||||
|
|
||||||
//lv_obj_t * labelWifi= lv_label_create(buttonWifi, NULL);
|
//lv_obj_t * labelWifi= lv_label_create(buttonWifi, NULL);
|
||||||
|
@ -222,7 +234,9 @@ void lv_draw_set(void) {
|
||||||
lv_obj_t * label_About = lv_label_create(buttonAbout, 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_Continue = lv_label_create(buttonContinue, NULL);
|
||||||
lv_obj_t * label_MotorOff = lv_label_create(buMotorOff, 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);
|
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_Back = lv_label_create(buttonBack, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,8 +259,10 @@ void lv_draw_set(void) {
|
||||||
#endif
|
#endif
|
||||||
lv_obj_align(label_MotorOff, buMotorOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
lv_obj_align(label_MotorOff, buMotorOff, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||||
|
|
||||||
|
#if HAS_LANG_SELECT_SCREEN
|
||||||
lv_label_set_text(label_Language, set_menu.language);
|
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);
|
lv_obj_align(label_Language, buttonLanguage, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||||
|
#endif
|
||||||
|
|
||||||
lv_label_set_text(label_Back, common_menu.text_back);
|
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);
|
lv_obj_align(label_Back, buttonBack, LV_ALIGN_IN_BOTTOM_MID, 0, BUTTON_TEXT_Y_OFFSET);
|
||||||
|
@ -255,4 +271,4 @@ void lv_draw_set(void) {
|
||||||
|
|
||||||
void lv_clear_set() { lv_obj_del(scr); }
|
void lv_clear_set() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "lv_conf.h"
|
#include "lv_conf.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
@ -267,4 +267,4 @@ void lv_draw_tool(void) {
|
||||||
|
|
||||||
void lv_clear_tool() { lv_obj_del(scr); }
|
void lv_clear_tool() { lv_obj_del(scr); }
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,11 +21,10 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "W25Qxx.h"
|
#include "W25Qxx.h"
|
||||||
#include "tft_lvgl_configuration.h"
|
#include "tft_lvgl_configuration.h"
|
||||||
#include "pic_manager.h"
|
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
|
||||||
|
@ -38,6 +37,8 @@
|
||||||
#include "../../../../module/motion.h"
|
#include "../../../../module/motion.h"
|
||||||
#include "../../../../module/planner.h"
|
#include "../../../../module/planner.h"
|
||||||
|
|
||||||
|
#include "pic_manager.h"
|
||||||
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
#include "../../../../feature/powerloss.h"
|
#include "../../../../feature/powerloss.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -73,7 +74,33 @@ extern void LCD_IO_WriteData(uint16_t RegValue);
|
||||||
|
|
||||||
void gCfgItems_init() {
|
void gCfgItems_init() {
|
||||||
gCfgItems.multiple_language = MULTI_LANGUAGE_ENABLE;
|
gCfgItems.multiple_language = MULTI_LANGUAGE_ENABLE;
|
||||||
|
#if 1 //LCD_LANGUAGE == en
|
||||||
gCfgItems.language = LANG_ENGLISH;
|
gCfgItems.language = LANG_ENGLISH;
|
||||||
|
#elif LCD_LANGUAGE == zh_CN
|
||||||
|
gCfgItems.language = LANG_SIMPLE_CHINESE;
|
||||||
|
#elif LCD_LANGUAGE == zh_TW
|
||||||
|
gCfgItems.language = LANG_COMPLEX_CHINESE;
|
||||||
|
#elif LCD_LANGUAGE == jp_kana
|
||||||
|
gCfgItems.language = LANG_JAPAN;
|
||||||
|
#elif LCD_LANGUAGE == de
|
||||||
|
gCfgItems.language = LANG_GERMAN;
|
||||||
|
#elif LCD_LANGUAGE == fr
|
||||||
|
gCfgItems.language = LANG_FRENCH;
|
||||||
|
#elif LCD_LANGUAGE == ru
|
||||||
|
gCfgItems.language = LANG_RUSSIAN;
|
||||||
|
#elif LCD_LANGUAGE == ko_KR
|
||||||
|
gCfgItems.language = LANG_KOREAN;
|
||||||
|
#elif LCD_LANGUAGE == tr
|
||||||
|
gCfgItems.language = LANG_TURKISH;
|
||||||
|
#elif LCD_LANGUAGE == es
|
||||||
|
gCfgItems.language = LANG_SPANISH;
|
||||||
|
#elif LCD_LANGUAGE == el
|
||||||
|
gCfgItems.language = LANG_GREEK;
|
||||||
|
#elif LCD_LANGUAGE == it
|
||||||
|
gCfgItems.language = LANG_ITALY;
|
||||||
|
#elif LCD_LANGUAGE == pt
|
||||||
|
gCfgItems.language = LANG_PORTUGUESE;
|
||||||
|
#endif
|
||||||
gCfgItems.leveling_mode = 0;
|
gCfgItems.leveling_mode = 0;
|
||||||
gCfgItems.from_flash_pic = 0;
|
gCfgItems.from_flash_pic = 0;
|
||||||
gCfgItems.curFilesize = 0;
|
gCfgItems.curFilesize = 0;
|
||||||
|
@ -139,8 +166,13 @@ void tft_style_init() {
|
||||||
tft_style_lable_rel.body.grad_color = LV_COLOR_BACKGROUND;
|
tft_style_lable_rel.body.grad_color = LV_COLOR_BACKGROUND;
|
||||||
tft_style_lable_rel.text.color = LV_COLOR_TEXT;
|
tft_style_lable_rel.text.color = LV_COLOR_TEXT;
|
||||||
tft_style_lable_rel.text.sel_color = LV_COLOR_TEXT;
|
tft_style_lable_rel.text.sel_color = LV_COLOR_TEXT;
|
||||||
|
#if HAS_SPI_FLASH_FONT
|
||||||
tft_style_lable_pre.text.font = &gb2312_puhui32;
|
tft_style_lable_pre.text.font = &gb2312_puhui32;
|
||||||
tft_style_lable_rel.text.font = &gb2312_puhui32;
|
tft_style_lable_rel.text.font = &gb2312_puhui32;
|
||||||
|
#else
|
||||||
|
tft_style_lable_pre.text.font = LV_FONT_DEFAULT;
|
||||||
|
tft_style_lable_rel.text.font = LV_FONT_DEFAULT;
|
||||||
|
#endif
|
||||||
tft_style_lable_pre.line.width = 0;
|
tft_style_lable_pre.line.width = 0;
|
||||||
tft_style_lable_rel.line.width = 0;
|
tft_style_lable_rel.line.width = 0;
|
||||||
tft_style_lable_pre.text.letter_space = 0;
|
tft_style_lable_pre.text.letter_space = 0;
|
||||||
|
@ -325,6 +357,9 @@ char *creat_title_text() {
|
||||||
return public_buf_m;
|
return public_buf_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAS_GCODE_PREVIEW
|
||||||
|
uint32_t gPicturePreviewStart = 0;
|
||||||
|
|
||||||
void preview_gcode_prehandle(char *path) {
|
void preview_gcode_prehandle(char *path) {
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
//uint8_t re;
|
//uint8_t re;
|
||||||
|
@ -333,6 +368,7 @@ void preview_gcode_prehandle(char *path) {
|
||||||
uint32_t *p1;
|
uint32_t *p1;
|
||||||
char *cur_name;
|
char *cur_name;
|
||||||
|
|
||||||
|
gPicturePreviewStart = 0;
|
||||||
cur_name = strrchr(path, '/');
|
cur_name = strrchr(path, '/');
|
||||||
card.openFileRead(cur_name);
|
card.openFileRead(cur_name);
|
||||||
card.read(public_buf, 512);
|
card.read(public_buf, 512);
|
||||||
|
@ -369,7 +405,24 @@ void gcode_preview(char *path, int xpos_pixel, int ypos_pixel) {
|
||||||
cur_name = strrchr(path, '/');
|
cur_name = strrchr(path, '/');
|
||||||
card.openFileRead(cur_name);
|
card.openFileRead(cur_name);
|
||||||
|
|
||||||
card.setIndex((PREVIEW_LITTLE_PIC_SIZE + To_pre_view) + size * row + 8);
|
if (gPicturePreviewStart <= 0) {
|
||||||
|
while (1) {
|
||||||
|
uint32_t br = card.read(public_buf, 400);
|
||||||
|
uint32_t* p1 = (uint32_t *)strstr((char *)public_buf, ";gimage:");
|
||||||
|
if (p1) {
|
||||||
|
gPicturePreviewStart += (uint32_t)p1 - (uint32_t)((uint32_t *)(&public_buf[0]));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gPicturePreviewStart += br;
|
||||||
|
}
|
||||||
|
if (br < 400) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// SERIAL_ECHOLNPAIR("gPicturePreviewStart: ", gPicturePreviewStart, " PREVIEW_LITTLE_PIC_SIZE: ", PREVIEW_LITTLE_PIC_SIZE);
|
||||||
|
|
||||||
|
card.setIndex((gPicturePreviewStart + To_pre_view) + size * row + 8);
|
||||||
#if ENABLED(SPI_GRAPHICAL_TFT)
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
SPI_TFT.spi_init(SPI_FULL_SPEED);
|
SPI_TFT.spi_init(SPI_FULL_SPEED);
|
||||||
//SPI_TFT.SetCursor(0,0);
|
//SPI_TFT.SetCursor(0,0);
|
||||||
|
@ -417,14 +470,16 @@ void gcode_preview(char *path, int xpos_pixel, int ypos_pixel) {
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < 400;) {
|
for (i = 0; i < 400;) {
|
||||||
p_index = (uint16_t *)(&bmp_public_buf[i]);
|
p_index = (uint16_t *)(&bmp_public_buf[i]);
|
||||||
//if (*p_index == 0x0000)*p_index=gCfgItems.preview_bk_color;
|
if (*p_index == 0x0000)*p_index=LV_COLOR_BACKGROUND.full; //gCfgItems.preview_bk_color;
|
||||||
LCD_IO_WriteData(*p_index);
|
LCD_IO_WriteData(*p_index);
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#if HAS_BAK_VIEW_IN_FLASH
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
|
if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
|
||||||
W25QXX.SPI_FLASH_BufferWrite(bmp_public_buf, BAK_VIEW_ADDR_TFT35 + row * 400, 400);
|
W25QXX.SPI_FLASH_BufferWrite(bmp_public_buf, BAK_VIEW_ADDR_TFT35 + row * 400, 400);
|
||||||
|
#endif
|
||||||
row++;
|
row++;
|
||||||
if (row >= 200) {
|
if (row >= 200) {
|
||||||
size = 809;
|
size = 809;
|
||||||
|
@ -489,15 +544,19 @@ void Draw_default_preview(int xpos_pixel, int ypos_pixel, uint8_t sel) {
|
||||||
int x_off = 0, y_off = 0;
|
int x_off = 0, y_off = 0;
|
||||||
int _y;
|
int _y;
|
||||||
uint16_t *p_index;
|
uint16_t *p_index;
|
||||||
int i, j;
|
int i;
|
||||||
uint16_t temp_p, Color;
|
uint16_t temp_p;
|
||||||
|
|
||||||
for (index = 0; index < 10; index++) { // 200*200
|
for (index = 0; index < 10; index++) { // 200*200
|
||||||
|
#if HAS_BAK_VIEW_IN_FLASH
|
||||||
if (sel == 1) flash_view_Read(bmp_public_buf, 8000); //20k
|
if (sel == 1) flash_view_Read(bmp_public_buf, 8000); //20k
|
||||||
//memset(bmp_public_buf,0x1f,8000);
|
//memset(bmp_public_buf,0x1f,8000);
|
||||||
else
|
else
|
||||||
//memset(bmp_public_buf,0x1f,8000);
|
//memset(bmp_public_buf,0x1f,8000);
|
||||||
default_view_Read(bmp_public_buf, 8000); //20k
|
default_view_Read(bmp_public_buf, DEFAULT_VIEW_MAX_SIZE / 10); //20k
|
||||||
|
#else
|
||||||
|
default_view_Read(bmp_public_buf, DEFAULT_VIEW_MAX_SIZE / 10); //20k
|
||||||
|
#endif
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
#if ENABLED(SPI_GRAPHICAL_TFT)
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
|
@ -534,6 +593,7 @@ void Draw_default_preview(int xpos_pixel, int ypos_pixel, uint8_t sel) {
|
||||||
else {
|
else {
|
||||||
p_index = (uint16_t *)(&bmp_public_buf[i]);
|
p_index = (uint16_t *)(&bmp_public_buf[i]);
|
||||||
}
|
}
|
||||||
|
if (*p_index == 0x0000)*p_index=LV_COLOR_BACKGROUND.full; //gCfgItems.preview_bk_color;
|
||||||
LCD_IO_WriteData(*p_index);
|
LCD_IO_WriteData(*p_index);
|
||||||
i += 2;
|
i += 2;
|
||||||
}
|
}
|
||||||
|
@ -547,15 +607,20 @@ void Draw_default_preview(int xpos_pixel, int ypos_pixel, uint8_t sel) {
|
||||||
|
|
||||||
void disp_pre_gcode(int xpos_pixel, int ypos_pixel) {
|
void disp_pre_gcode(int xpos_pixel, int ypos_pixel) {
|
||||||
if (gcode_preview_over == 1) gcode_preview(list_file.file_name[sel_id], xpos_pixel, ypos_pixel);
|
if (gcode_preview_over == 1) gcode_preview(list_file.file_name[sel_id], xpos_pixel, ypos_pixel);
|
||||||
|
#if HAS_BAK_VIEW_IN_FLASH
|
||||||
if (flash_preview_begin == 1) {
|
if (flash_preview_begin == 1) {
|
||||||
flash_preview_begin = 0;
|
flash_preview_begin = 0;
|
||||||
Draw_default_preview(xpos_pixel, ypos_pixel, 1);
|
Draw_default_preview(xpos_pixel, ypos_pixel, 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
|
||||||
if (default_preview_flg == 1) {
|
if (default_preview_flg == 1) {
|
||||||
Draw_default_preview(xpos_pixel, ypos_pixel, 0);
|
Draw_default_preview(xpos_pixel, ypos_pixel, 0);
|
||||||
default_preview_flg = 0;
|
default_preview_flg = 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void print_time_run() {
|
void print_time_run() {
|
||||||
static uint8_t lastSec = 0;
|
static uint8_t lastSec = 0;
|
||||||
|
@ -1175,9 +1240,11 @@ void LV_TASK_HANDLER() {
|
||||||
//lv_tick_inc(1);
|
//lv_tick_inc(1);
|
||||||
lv_task_handler();
|
lv_task_handler();
|
||||||
TERN_(MKS_TEST, mks_test());
|
TERN_(MKS_TEST, mks_test());
|
||||||
|
#if HAS_GCODE_PREVIEW
|
||||||
disp_pre_gcode(2, 36);
|
disp_pre_gcode(2, 36);
|
||||||
|
#endif
|
||||||
GUI_RefreshPage();
|
GUI_RefreshPage();
|
||||||
//sd_detection();
|
//sd_detection();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -28,6 +28,11 @@ extern "C" { /* C-declarations for C++ */
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
|
//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)
|
||||||
|
|
||||||
#include "tft_multi_language.h"
|
#include "tft_multi_language.h"
|
||||||
#include "draw_ready_print.h"
|
#include "draw_ready_print.h"
|
||||||
#include "draw_language.h"
|
#include "draw_language.h"
|
||||||
|
@ -214,7 +219,9 @@ extern void tft_style_init();
|
||||||
extern char *creat_title_text(void);
|
extern char *creat_title_text(void);
|
||||||
extern void preview_gcode_prehandle(char *path);
|
extern void preview_gcode_prehandle(char *path);
|
||||||
extern void update_spi_flash();
|
extern void update_spi_flash();
|
||||||
extern void disp_pre_gcode(int xpos_pixel, int ypos_pixel);
|
#if HAS_GCODE_PREVIEW
|
||||||
|
extern void disp_pre_gcode(int xpos_pixel, int ypos_pixel);
|
||||||
|
#endif
|
||||||
extern void GUI_RefreshPage();
|
extern void GUI_RefreshPage();
|
||||||
extern void clear_cur_ui();
|
extern void clear_cur_ui();
|
||||||
extern void draw_return_ui();
|
extern void draw_return_ui();
|
||||||
|
|
|
@ -21,12 +21,14 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "pic_manager.h"
|
#include "pic_manager.h"
|
||||||
|
|
||||||
|
#if HAS_SPI_FLASH_FONT
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint16_t min;
|
uint16_t min;
|
||||||
uint16_t max;
|
uint16_t max;
|
||||||
|
@ -108,4 +110,6 @@ void init_gb2312_font() {
|
||||||
gb2312_puhui32.base_line = 0;
|
gb2312_puhui32.base_line = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // HAS_SPI_FLASH_FONT
|
||||||
|
|
||||||
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,19 +21,20 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "tft_lvgl_configuration.h"
|
#include "tft_lvgl_configuration.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "draw_ready_print.h"
|
#include "draw_ready_print.h"
|
||||||
#include "W25Qxx.h"
|
#include "W25Qxx.h"
|
||||||
#include "pic_manager.h"
|
|
||||||
#include "mks_hardware_test.h"
|
#include "mks_hardware_test.h"
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
#include "../../../../module/temperature.h"
|
#include "../../../../module/temperature.h"
|
||||||
#include "../../../../feature/touch/xpt2046.h"
|
#include "../../../../feature/touch/xpt2046.h"
|
||||||
|
|
||||||
|
#include "pic_manager.h"
|
||||||
|
|
||||||
#if ENABLED(MKS_TEST)
|
#if ENABLED(MKS_TEST)
|
||||||
|
|
||||||
extern uint8_t curent_disp_ui;
|
extern uint8_t curent_disp_ui;
|
||||||
|
@ -591,4 +592,4 @@ void disp_font_update() {
|
||||||
disp_string(120, 150, "FONT Updating...", 0xFFFF, 0x0000);
|
disp_string(120, 150, "FONT Updating...", 0xFFFF, 0x0000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,11 +21,10 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
|
|
||||||
//#include "type_define.h"
|
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
#include "pic_manager.h"
|
#include "pic_manager.h"
|
||||||
|
@ -34,10 +33,6 @@
|
||||||
#include "draw_ready_print.h"
|
#include "draw_ready_print.h"
|
||||||
#include "mks_hardware_test.h"
|
#include "mks_hardware_test.h"
|
||||||
|
|
||||||
//#include "gui.h"
|
|
||||||
//#include "spi_flash.h"
|
|
||||||
|
|
||||||
//uint8_t DMA_ERRO_FLAG;
|
|
||||||
extern uint16_t DeviceCode;
|
extern uint16_t DeviceCode;
|
||||||
extern unsigned char bmp_public_buf[17 * 1024];
|
extern unsigned char bmp_public_buf[17 * 1024];
|
||||||
|
|
||||||
|
@ -45,7 +40,158 @@ extern unsigned char bmp_public_buf[17 * 1024];
|
||||||
extern char *createFilename(char * const buffer, const dir_t &p);
|
extern char *createFilename(char * const buffer, const dir_t &p);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead) {}*/
|
static char assets[][30] = {
|
||||||
|
//homing screen
|
||||||
|
"bmp_Zero.bin",
|
||||||
|
"bmp_zeroX.bin",
|
||||||
|
"bmp_zeroY.bin",
|
||||||
|
"bmp_zeroZ.bin",
|
||||||
|
"bmp_manual_off.bin",
|
||||||
|
|
||||||
|
//tool screen
|
||||||
|
"bmp_PreHeat.bin",
|
||||||
|
"bmp_Extruct.bin",
|
||||||
|
"bmp_Mov.bin",
|
||||||
|
// "bmp_Zero.bin",
|
||||||
|
"bmp_Leveling.bin",
|
||||||
|
|
||||||
|
//fan screen
|
||||||
|
"bmp_Add.bin",
|
||||||
|
"bmp_Dec.bin",
|
||||||
|
"bmp_Speed255.bin",
|
||||||
|
"bmp_Speed127.bin",
|
||||||
|
"bmp_Speed0.bin",
|
||||||
|
|
||||||
|
//preheat screen
|
||||||
|
// "bmp_Add.bin",
|
||||||
|
// "bmp_Dec.bin",
|
||||||
|
"bmp_Speed0.bin",
|
||||||
|
// "bmp_Extru2.bin",
|
||||||
|
// "bmp_Extru1.bin",
|
||||||
|
"bmp_Bed.bin",
|
||||||
|
"bmp_Step1_degree.bin",
|
||||||
|
"bmp_Step5_degree.bin",
|
||||||
|
"bmp_Step10_degree.bin",
|
||||||
|
|
||||||
|
//extrusion screen
|
||||||
|
"bmp_In.bin",
|
||||||
|
"bmp_Out.bin",
|
||||||
|
"bmp_Extru1.bin",
|
||||||
|
#if EXTRUDERS > 1
|
||||||
|
"bmp_Extru2.bin",
|
||||||
|
#endif
|
||||||
|
"bmp_Speed_high.bin",
|
||||||
|
"bmp_Speed_slow.bin",
|
||||||
|
"bmp_Speed_normal.bin",
|
||||||
|
"bmp_Step1_mm.bin",
|
||||||
|
"bmp_Step5_mm.bin",
|
||||||
|
"bmp_Step10_mm.bin",
|
||||||
|
|
||||||
|
//select file screen
|
||||||
|
"bmp_pageUp.bin",
|
||||||
|
"bmp_pageDown.bin",
|
||||||
|
//"bmp_Back.bin", //TODO: why two back buttons? Why not just one? (return / back)
|
||||||
|
"bmp_Dir.bin",
|
||||||
|
"bmp_File.bin",
|
||||||
|
|
||||||
|
//move motor screen
|
||||||
|
//TODO: 6 equal icons, just in diffenct rotation... it may be optimized too
|
||||||
|
"bmp_xAdd.bin",
|
||||||
|
"bmp_xDec.bin",
|
||||||
|
"bmp_yAdd.bin",
|
||||||
|
"bmp_yDec.bin",
|
||||||
|
"bmp_zAdd.bin",
|
||||||
|
"bmp_zDec.bin",
|
||||||
|
"bmp_Step_move0_1.bin",
|
||||||
|
"bmp_Step_move1.bin",
|
||||||
|
"bmp_Step_move10.bin",
|
||||||
|
|
||||||
|
//operation screen
|
||||||
|
"bmp_auto_off.bin",
|
||||||
|
"bmp_Speed.bin",
|
||||||
|
//"bmp_Mamual.bin", //TODO: didn't find it.. changed to bmp_manual_off.bin
|
||||||
|
"bmp_Fan.bin",
|
||||||
|
//"bmp_PreHeat.bin",
|
||||||
|
//"bmp_Extruct.bin",
|
||||||
|
// "bmp_Mov.bin",
|
||||||
|
|
||||||
|
//change speed screen
|
||||||
|
"bmp_Step1_percent.bin",
|
||||||
|
"bmp_Step5_percent.bin",
|
||||||
|
"bmp_Step10_percent.bin",
|
||||||
|
"bmp_extruct_sel.bin",
|
||||||
|
"bmp_mov_changespeed.bin",
|
||||||
|
// "bmp_extrude_opr.bin", equal to "bmp_Extruct.bin"
|
||||||
|
"bmp_mov_sel.bin",
|
||||||
|
|
||||||
|
//printing screen
|
||||||
|
"bmp_Pause.bin",
|
||||||
|
"bmp_Resume.bin",
|
||||||
|
"bmp_Stop.bin",
|
||||||
|
"bmp_Ext1_state.bin",
|
||||||
|
#if EXTRUDERS > 1
|
||||||
|
"bmp_Ext2_state.bin",
|
||||||
|
#endif
|
||||||
|
"bmp_Bed_state.bin",
|
||||||
|
"bmp_Fan_state.bin",
|
||||||
|
"bmp_Time_state.bin",
|
||||||
|
"bmp_Zpos_state.bin",
|
||||||
|
"bmp_Operate.bin",
|
||||||
|
|
||||||
|
//manual leval screen (only if disabled auto level)
|
||||||
|
#if DISABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||||
|
"bmp_Leveling1.bin",
|
||||||
|
"bmp_Leveling2.bin",
|
||||||
|
"bmp_Leveling3.bin",
|
||||||
|
"bmp_Leveling4.bin",
|
||||||
|
"bmp_Leveling5.bin",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//lang select screen
|
||||||
|
#if HAS_LANG_SELECT_SCREEN
|
||||||
|
"bmp_Language.bin",
|
||||||
|
"bmp_simplified_cn.bin",
|
||||||
|
"bmp_simplified_cn_sel.bin",
|
||||||
|
"bmp_traditional_cn.bin",
|
||||||
|
"bmp_traditional_cn_sel.bin",
|
||||||
|
"bmp_English.bin",
|
||||||
|
"bmp_English_sel.bin",
|
||||||
|
"bmp_Russian.bin",
|
||||||
|
"bmp_Russian_sel.bin",
|
||||||
|
"bmp_Spanish.bin",
|
||||||
|
"bmp_Spanish_sel.bin",
|
||||||
|
"bmp_French.bin",
|
||||||
|
"bmp_French_sel.bin",
|
||||||
|
"bmp_Italy.bin",
|
||||||
|
"bmp_Italy_sel.bin",
|
||||||
|
#endif //HAS_LANG_SELECT_SCREEN
|
||||||
|
|
||||||
|
//gcode preview
|
||||||
|
#if HAS_GCODE_DEFAULT_VIEW_IN_FLASH
|
||||||
|
"bmp_preview.bin",
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//settings screen
|
||||||
|
"bmp_About.bin",
|
||||||
|
//"bmp_Language.bin",
|
||||||
|
//"bmp_Fan.bin",
|
||||||
|
//"bmp_manual_off.bin",
|
||||||
|
|
||||||
|
//start screen
|
||||||
|
"bmp_printing.bin",
|
||||||
|
"bmp_Set.bin",
|
||||||
|
"bmp_Tool.bin",
|
||||||
|
|
||||||
|
//base icons
|
||||||
|
"bmp_Return.bin"
|
||||||
|
};
|
||||||
|
|
||||||
|
#if HAS_SPI_FLASH_FONT
|
||||||
|
static char fonts[][50] = {
|
||||||
|
"GBK16.bin",
|
||||||
|
"UNIGBK.bin",
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32_t lv_get_pic_addr(uint8_t *Pname) {
|
uint32_t lv_get_pic_addr(uint8_t *Pname) {
|
||||||
uint8_t Pic_cnt;
|
uint8_t Pic_cnt;
|
||||||
|
@ -54,21 +200,22 @@ uint32_t lv_get_pic_addr(uint8_t *Pname) {
|
||||||
uint32_t tmp_cnt = 0;
|
uint32_t tmp_cnt = 0;
|
||||||
uint32_t addr = 0;
|
uint32_t addr = 0;
|
||||||
|
|
||||||
|
#if ENABLED(MARLIN_DEV_MODE)
|
||||||
|
SERIAL_ECHOLNPAIR("Getting picture SPI Flash Address: ", (const char*)Pname);
|
||||||
|
#endif
|
||||||
|
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(&Pic_cnt, PIC_COUNTER_ADDR, 1);
|
W25QXX.SPI_FLASH_BufferRead(&Pic_cnt, PIC_COUNTER_ADDR, 1);
|
||||||
if (Pic_cnt == 0xff)
|
if (Pic_cnt == 0xFF) Pic_cnt = 0;
|
||||||
Pic_cnt = 0;
|
|
||||||
for (i = 0; i < Pic_cnt; i++) {
|
for (i = 0; i < Pic_cnt; i++) {
|
||||||
j = 0;
|
j = 0;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(&PIC.name[j], PIC_NAME_ADDR + tmp_cnt, 1);
|
W25QXX.SPI_FLASH_BufferRead(&PIC.name[j], PIC_NAME_ADDR + tmp_cnt, 1);
|
||||||
tmp_cnt++;
|
tmp_cnt++;
|
||||||
}while (PIC.name[j++] != '\0');
|
} while (PIC.name[j++] != '\0');
|
||||||
|
|
||||||
if ((strcmp((char*)Pname, (char*)PIC.name)) == 0) {
|
|
||||||
|
|
||||||
|
if ((strcasecmp((char*)Pname, (char*)PIC.name)) == 0) {
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
|
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
|
||||||
addr = PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35;
|
addr = PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35;
|
||||||
else
|
else
|
||||||
|
@ -86,111 +233,40 @@ const char *bakPath = "bak_pic";
|
||||||
const char *fontPath = "mks_font";
|
const char *fontPath = "mks_font";
|
||||||
const char *bakFont = "bak_font";
|
const char *bakFont = "bak_font";
|
||||||
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
void spiFlashErase_PIC() {
|
void spiFlashErase_PIC() {
|
||||||
#if 1
|
|
||||||
volatile uint32_t pic_sectorcnt = 0;
|
volatile uint32_t pic_sectorcnt = 0;
|
||||||
|
for (pic_sectorcnt = 0; pic_sectorcnt < TERN(MKS_TEST, 2, PIC_SIZE_xM * 1024 / 64); pic_sectorcnt++)
|
||||||
//LCD_Clear(BACK_COLOR);
|
|
||||||
//LCD_DisplayString(90,80,"SPI Flash");
|
|
||||||
//LCD_DisplayString(120,90,"PIC Erasing...");
|
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) {
|
|
||||||
//LCD_ShowString(180,100,200,24,24,"SPI Flash");
|
|
||||||
//LCD_ShowString(170,130,200,24,24,"PIC Erasing...");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//LCD_ShowString(100,90,200,24,24,"SPI Flash");
|
|
||||||
//LCD_ShowString(100,120,200,24,24,"PIC Erasing...");
|
|
||||||
}
|
|
||||||
#if ENABLED(MKS_TEST)
|
|
||||||
for (pic_sectorcnt = 0; pic_sectorcnt < 2; pic_sectorcnt++)
|
|
||||||
W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
|
W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
|
||||||
|
|
||||||
#else
|
|
||||||
for (pic_sectorcnt = 0; pic_sectorcnt < PIC_SIZE_xM * 1024 / 64; pic_sectorcnt++)
|
|
||||||
W25QXX.SPI_FLASH_BlockErase(PICINFOADDR + pic_sectorcnt * 64 * 1024);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
/*
|
|
||||||
FLASH_Unlock();
|
|
||||||
spiFlashEraseFlag = SPI_FLASH_ERASE_FLAG_DATA;
|
|
||||||
FLASH_ProgramHalfWord(SPI_FLASH_ERASE_FLAG_ADDR,spiFlashEraseFlag);
|
|
||||||
FLASH_Lock();
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
if (DeviceCode == 0x9488)
|
|
||||||
LCD_ShowString(170, 130, 200, 24, 24, "PIC Erase Done");
|
|
||||||
else
|
|
||||||
LCD_ShowString(100, 120, 200, 24, 24, "PIC Erase Done");
|
|
||||||
|
|
||||||
#endif
|
|
||||||
//spiFlashEraseFlag = 1;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void spiFlashErase_FONT() {
|
#if HAS_SPI_FLASH_FONT
|
||||||
|
void spiFlashErase_FONT() {
|
||||||
volatile uint32_t Font_sectorcnt = 0;
|
volatile uint32_t Font_sectorcnt = 0;
|
||||||
|
|
||||||
//LCD_Clear(BACK_COLOR);
|
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) {
|
|
||||||
//LCD_ShowString(180,100,200,24,24,"SPI Flash");
|
|
||||||
//LCD_ShowString(170,130,200,24,24,"FONT Erasing...");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//LCD_ShowString(100,90,200,24,24,"SPI Flash");
|
|
||||||
//LCD_ShowString(90,120,200,24,24,"FONT Erasing...");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Font_sectorcnt = 0; Font_sectorcnt < FONT_SIZE_xM * 1024 / 64; Font_sectorcnt++)
|
for (Font_sectorcnt = 0; Font_sectorcnt < FONT_SIZE_xM * 1024 / 64; Font_sectorcnt++)
|
||||||
W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
|
W25QXX.SPI_FLASH_BlockErase(FONTINFOADDR + Font_sectorcnt * 64 * 1024);
|
||||||
|
}
|
||||||
/*
|
#endif
|
||||||
FLASH_Unlock();
|
|
||||||
spiFlashEraseFlag = SPI_FLASH_ERASE_FLAG_DATA;
|
|
||||||
FLASH_ProgramHalfWord(SPI_FLASH_ERASE_FLAG_ADDR,spiFlashEraseFlag);
|
|
||||||
FLASH_Lock();
|
|
||||||
*/
|
|
||||||
#if 0
|
|
||||||
if (DeviceCode == 0x9488)
|
|
||||||
LCD_ShowString(170, 130, 200, 24, 24, "FONT Erase Done");
|
|
||||||
else
|
|
||||||
LCD_ShowString(90, 120, 200, 24, 24, "FONT Erase Done");
|
|
||||||
//LCD_DisplayString(120,90,"FONT Erase Done");
|
|
||||||
#endif
|
|
||||||
//spiFlashEraseFlag = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t LogoWrite_Addroffset = 0;
|
uint32_t LogoWrite_Addroffset = 0;
|
||||||
|
|
||||||
uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) {
|
uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) {
|
||||||
//uint16_t n;
|
|
||||||
uint32_t i;
|
|
||||||
uint8_t temp1;
|
|
||||||
static uint32_t logo_maxsize;
|
|
||||||
|
|
||||||
if (LogoWriteSize <= 0) return 0;
|
if (LogoWriteSize <= 0) return 0;
|
||||||
|
|
||||||
W25QXX.SPI_FLASH_BufferWrite(Logo_Wbuff, PIC_LOGO_ADDR + LogoWrite_Addroffset, LogoWriteSize);
|
W25QXX.SPI_FLASH_BufferWrite(Logo_Wbuff, PIC_LOGO_ADDR + LogoWrite_Addroffset, LogoWriteSize);
|
||||||
|
|
||||||
for (i = 0; i < LogoWriteSize; i++) {
|
for (uint32_t i = 0; i < LogoWriteSize; i++) {
|
||||||
|
uint8_t temp1;
|
||||||
W25QXX.SPI_FLASH_BufferRead(&temp1, PIC_LOGO_ADDR + LogoWrite_Addroffset + i, 1);
|
W25QXX.SPI_FLASH_BufferRead(&temp1, PIC_LOGO_ADDR + LogoWrite_Addroffset + i, 1);
|
||||||
if (*(Logo_Wbuff + i) != temp1) return 0;
|
if (*(Logo_Wbuff + i) != temp1) return 0;
|
||||||
}
|
}
|
||||||
LogoWrite_Addroffset += LogoWriteSize;
|
LogoWrite_Addroffset += LogoWriteSize;
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
|
const uint32_t logo_maxsize = DeviceCode == 0x9488 || DeviceCode == 0x5761 ? LOGO_MAX_SIZE_TFT35 : LOGO_MAX_SIZE_TFT32;
|
||||||
logo_maxsize = LOGO_MAX_SIZE_TFT35;
|
if (LogoWrite_Addroffset >= logo_maxsize) LogoWrite_Addroffset = 0;
|
||||||
else
|
|
||||||
logo_maxsize = LOGO_MAX_SIZE_TFT32;
|
|
||||||
if (LogoWrite_Addroffset >= logo_maxsize)
|
|
||||||
LogoWrite_Addroffset = 0;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TitleLogoWrite_Addroffset = 0;
|
uint32_t TitleLogoWrite_Addroffset = 0;
|
||||||
uint8_t Pic_TitleLogo_Write(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) {
|
uint8_t Pic_TitleLogo_Write(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) {
|
||||||
//uint32_t i;
|
|
||||||
//uint8_t temp1;
|
|
||||||
if (TitleLogoWriteSize <= 0)
|
if (TitleLogoWriteSize <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
|
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
|
||||||
|
@ -216,18 +292,11 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
|
||||||
uint32_t Pic_SaveAddr;
|
uint32_t Pic_SaveAddr;
|
||||||
uint32_t Pic_SizeSaveAddr;
|
uint32_t Pic_SizeSaveAddr;
|
||||||
uint32_t Pic_NameSaveAddr;
|
uint32_t Pic_NameSaveAddr;
|
||||||
//uint8_t temp;
|
|
||||||
uint8_t Pname_temp;
|
uint8_t Pname_temp;
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
uint32_t name_len = 0;
|
uint32_t name_len = 0;
|
||||||
uint32_t SaveName_len = 0;
|
uint32_t SaveName_len = 0;
|
||||||
union union32 size_tmp;
|
union union32 size_tmp;
|
||||||
//union union32 size1;
|
|
||||||
//uint8_t Pn[PIC_NAME_MAX_LEN];
|
|
||||||
//uint8_t cnt_temp;
|
|
||||||
//uint16_t n0;
|
|
||||||
//uint32_t Name_saveAddr = 0;
|
|
||||||
//uint8_t pic_position;
|
|
||||||
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1);
|
W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1);
|
||||||
|
|
||||||
|
@ -266,38 +335,25 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
|
||||||
|
|
||||||
uint8_t public_buf[512];
|
uint8_t public_buf[512];
|
||||||
|
|
||||||
//uint8_t public_buf_test[512];
|
#if ENABLED(SDSUPPORT)
|
||||||
#if ENABLED(SDSUPPORT)
|
|
||||||
void UpdatePic() {
|
static void dosName2LongName(const char dosName[11], char* longName) {
|
||||||
//int r;
|
uint8_t j = 0;
|
||||||
//unsigned char *p;
|
LOOP_L_N(i, 11) {
|
||||||
//char rootPath[10]={0};
|
if (i == 8) longName[j++] = '.';
|
||||||
|
if (dosName[i] == '\0' || dosName[i] == ' ') continue;
|
||||||
|
longName[j++] = dosName[i];
|
||||||
|
}
|
||||||
|
longName[j] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdatePic() {
|
||||||
char *fn;
|
char *fn;
|
||||||
unsigned char logoFlag;
|
unsigned char logoFlag;
|
||||||
uint16_t pbr;
|
uint16_t pbr;
|
||||||
uint32_t pfileSize;
|
uint32_t pfileSize;
|
||||||
|
uint32_t totalSizeLoaded = 0;
|
||||||
uint32_t Pic_Write_Addr;
|
uint32_t Pic_Write_Addr;
|
||||||
/*----------------------------------*/
|
|
||||||
|
|
||||||
// FILINFO fno;
|
|
||||||
//DIR dir;
|
|
||||||
//char tmp[30];
|
|
||||||
#if 0//_USE_LFN
|
|
||||||
static char lfn[_MAX_LFN + 1];
|
|
||||||
finfo.lfname = lfn;
|
|
||||||
finfo.lfsize = sizeof(lfn);
|
|
||||||
#endif
|
|
||||||
//SdFile curDir;
|
|
||||||
//if (f_opendir(&dirs, picPath) == FR_OK)
|
|
||||||
//card.cd(picPath);
|
|
||||||
|
|
||||||
//const uint16_t fileCnt = card.get_num_Files();
|
|
||||||
|
|
||||||
//SdFile *curDir;
|
|
||||||
//SdFile dir;
|
|
||||||
//dir.open(picPath, O_READ);
|
|
||||||
//const char * const fname = card.diveToFile(true, curDir, picPath);
|
|
||||||
//if (!fname) return;
|
|
||||||
|
|
||||||
SdFile dir, root = card.getroot();
|
SdFile dir, root = card.getroot();
|
||||||
if (dir.open(&root, picPath, O_RDONLY)) {
|
if (dir.open(&root, picPath, O_RDONLY)) {
|
||||||
|
@ -307,42 +363,36 @@ void UpdatePic() {
|
||||||
|
|
||||||
dir_t d;
|
dir_t d;
|
||||||
while (dir.readDir(&d, card.longFilename) > 0) {
|
while (dir.readDir(&d, card.longFilename) > 0) {
|
||||||
#if 1
|
// if we dont get a long name, but gets a short one, try it
|
||||||
/*
|
if (card.longFilename[0] == 0 && d.name[0] != 0) {
|
||||||
if (power_det == 0) {
|
dosName2LongName((const char*)d.name, card.longFilename);
|
||||||
PW_DET_ON;
|
|
||||||
power_det=0;
|
|
||||||
}
|
}
|
||||||
SPI_FLASH_Init();
|
|
||||||
*/
|
|
||||||
|
|
||||||
//for (uint16_t i = 0; i < fileCnt; i++) {
|
|
||||||
//res = f_readdir(&dirs, &finfo);
|
|
||||||
//card.getfilename_sorted(i);
|
|
||||||
|
|
||||||
if (card.longFilename[0] == 0)
|
if (card.longFilename[0] == 0)
|
||||||
break;
|
|
||||||
/*if ( card.filename[0] == '.')
|
|
||||||
continue;
|
continue;
|
||||||
*/
|
|
||||||
if (card.longFilename[0] == '.')
|
if (card.longFilename[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fn = card.longFilename;
|
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;
|
||||||
|
|
||||||
/*if ((finfo.lfname[0] == 0) || (finfo.lfname == 0))
|
fn = assets[a];
|
||||||
fn = finfo.fname;
|
char dosFilename[FILENAME_LENGTH];
|
||||||
else
|
createFilename(dosFilename, d);
|
||||||
fn = finfo.lfname;*/
|
|
||||||
|
|
||||||
/* if (fno.fattrib & AM_DIR)
|
SdFile file;
|
||||||
{
|
if (!file.open(&dir, dosFilename, O_READ)) {
|
||||||
|
#if ENABLED(MARLIN_DEV_MODE)
|
||||||
|
SERIAL_ECHOLNPAIR("Error opening Asset: ", fn);
|
||||||
|
#endif
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else */
|
|
||||||
//{
|
|
||||||
//if ((strstr(fn, ".gco")) || (strstr(fn, ".GCO")) || (fno.fattrib & AM_DIR))
|
|
||||||
if (strstr(fn, ".bin")) {
|
|
||||||
if (strstr(fn, "_logo"))
|
if (strstr(fn, "_logo"))
|
||||||
logoFlag = 1;
|
logoFlag = 1;
|
||||||
else if (strstr(fn, "_titlelogo"))
|
else if (strstr(fn, "_titlelogo"))
|
||||||
|
@ -352,143 +402,68 @@ void UpdatePic() {
|
||||||
else
|
else
|
||||||
logoFlag = 0;
|
logoFlag = 0;
|
||||||
|
|
||||||
//public_buf[0] = '\0';
|
pfileSize = file.fileSize();
|
||||||
//strcat(public_buf, picPath);
|
totalSizeLoaded += pfileSize;
|
||||||
//strcat(public_buf, "/");
|
|
||||||
char dosFilename[FILENAME_LENGTH];
|
|
||||||
createFilename(dosFilename, d);
|
|
||||||
//strcat(public_buf, dosFilename);
|
|
||||||
|
|
||||||
SdFile file;
|
|
||||||
if (file.open(&dir, dosFilename, O_READ)) {
|
|
||||||
#if 1
|
|
||||||
/*LCD_Clear(BACK_COLOR);
|
|
||||||
|
|
||||||
if ((DeviceCode==0x9488)||(DeviceCode==0x5761)) {
|
|
||||||
LCD_ShowString(170,100,200,24,24,(u8 *)fn);
|
|
||||||
LCD_ShowString(180,130,200,24,24,"Updating...");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LCD_ShowString(90,90,200,24,24,(u8 *)fn);
|
|
||||||
LCD_ShowString(90,120,200,24,24,"Updating...");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (logoFlag == 1) {
|
if (logoFlag == 1) {
|
||||||
while (1) {
|
while (1) {
|
||||||
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
||||||
Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); //
|
Pic_Logo_Write((uint8_t *)fn, public_buf, pbr); //
|
||||||
if (pbr < BMP_WRITE_BUF_LEN) break;
|
if (pbr < BMP_WRITE_BUF_LEN)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (logoFlag == 2) {
|
else if (logoFlag == 2) {
|
||||||
while (1) {
|
while (1) {
|
||||||
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
||||||
Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); //
|
Pic_TitleLogo_Write((uint8_t *)fn, public_buf, pbr); //
|
||||||
if (pbr < BMP_WRITE_BUF_LEN) break;
|
if (pbr < BMP_WRITE_BUF_LEN)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (logoFlag == 3) {
|
else if (logoFlag == 3) {
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
||||||
default_view_Write(public_buf, pbr); //
|
default_view_Write(public_buf, pbr); //
|
||||||
if (pbr < BMP_WRITE_BUF_LEN) break;
|
if (pbr < BMP_WRITE_BUF_LEN)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pfileSize = file.fileSize();
|
|
||||||
Pic_Write_Addr = Pic_Info_Write((uint8_t *)fn, pfileSize);
|
Pic_Write_Addr = Pic_Info_Write((uint8_t *)fn, pfileSize);
|
||||||
//uint32_t addr_test = Pic_Write_Addr;
|
while (1) {
|
||||||
//memset(bmp_public_buf, 0xff, BMP_WRITE_BUF_LEN);
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
||||||
W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
|
W25QXX.SPI_FLASH_BufferWrite(public_buf, Pic_Write_Addr, pbr);
|
||||||
Pic_Write_Addr += pbr;
|
Pic_Write_Addr += pbr;
|
||||||
if (pbr < BMP_WRITE_BUF_LEN) break;
|
if (pbr < BMP_WRITE_BUF_LEN)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
//W25QXX.SPI_FLASH_BufferRead(public_buf_test,addr_test,BMP_WRITE_BUF_LEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*--------------read test--------------------*/
|
#if ENABLED(MARLIN_DEV_MODE)
|
||||||
/*
|
SERIAL_ECHOLNPAIR("Asset added: ", fn);
|
||||||
BufferSet(picBuffer, 0xff, PICTURE_MAX_SIZE);
|
#endif
|
||||||
if (logoFlag == 0)
|
|
||||||
{
|
|
||||||
PicMsg_Init();
|
|
||||||
Pic_Read(fn,picBuffer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Pic_Logo_Read(fn,picBuffer,PICTURE_MAX_SIZE);
|
|
||||||
*/
|
|
||||||
/*--------------read test--------------------*/
|
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//}
|
|
||||||
//}
|
|
||||||
/*
|
|
||||||
LCD_Clear(LCD_COLOR_BLACK);
|
|
||||||
//LCD_ShowString(110,100,200,24,24,"Complete");
|
|
||||||
LCD_DisplayString(110,80,"Complete");
|
|
||||||
delay(0xfffff);
|
|
||||||
*/
|
|
||||||
//r = f_chdir("/");
|
|
||||||
#if 1
|
|
||||||
//SdFile dir, root = card.getroot();
|
|
||||||
/*if (dir.open(&root, bakPath, O_RDONLY))
|
|
||||||
{
|
|
||||||
dir.remove();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
//r = f_rename(picPath, bakPath);
|
|
||||||
|
|
||||||
|
|
||||||
//update_flag_ok = 1;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
dir.rename(&root, bakPath);
|
dir.rename(&root, bakPath);
|
||||||
}
|
}
|
||||||
}
|
dir.close();
|
||||||
|
|
||||||
|
#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);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void spi_flash_read_test() {W25QXX.SPI_FLASH_BufferRead(public_buf, UNIGBK_FLASH_ADDR, BMP_WRITE_BUF_LEN);}
|
#if HAS_SPI_FLASH_FONT
|
||||||
|
|
||||||
void UpdateFont() {
|
void spi_flash_read_test() { W25QXX.SPI_FLASH_BufferRead(public_buf, UNIGBK_FLASH_ADDR, BMP_WRITE_BUF_LEN); }
|
||||||
//int r;
|
|
||||||
//unsigned char *p;
|
void UpdateFont() {
|
||||||
//char rootPath[10]={0};
|
|
||||||
char *fn;
|
char *fn;
|
||||||
//unsigned char logoFlag;
|
|
||||||
uint16_t pbr;
|
uint16_t pbr;
|
||||||
uint32_t flashaddr = 0;
|
uint32_t flashaddr = 0;
|
||||||
//uint32_t pfileSize;
|
|
||||||
//uint32_t Pic_Write_Addr;
|
|
||||||
/*----------------------------------*/
|
|
||||||
|
|
||||||
// FILINFO fno;
|
|
||||||
//DIR dir;
|
|
||||||
//char tmp[30];
|
|
||||||
#if 0//_USE_LFN
|
|
||||||
static char lfn[_MAX_LFN + 1];
|
|
||||||
finfo.lfname = lfn;
|
|
||||||
finfo.lfsize = sizeof(lfn);
|
|
||||||
#endif
|
|
||||||
//SdFile curDir;
|
|
||||||
//if (f_opendir(&dirs, picPath) == FR_OK)
|
|
||||||
//card.cd(picPath);
|
|
||||||
|
|
||||||
//const uint16_t fileCnt = card.get_num_Files();
|
|
||||||
|
|
||||||
//SdFile *curDir;
|
|
||||||
//SdFile dir;
|
|
||||||
//dir.open(picPath, O_READ);
|
|
||||||
//const char * const fname = card.diveToFile(true, curDir, picPath);
|
|
||||||
//if (!fname) return;
|
|
||||||
|
|
||||||
SdFile dir, root = card.getroot();
|
SdFile dir, root = card.getroot();
|
||||||
if (dir.open(&root, fontPath, O_RDONLY)) {
|
if (dir.open(&root, fontPath, O_RDONLY)) {
|
||||||
|
@ -497,44 +472,15 @@ void UpdateFont() {
|
||||||
spiFlashErase_FONT();
|
spiFlashErase_FONT();
|
||||||
|
|
||||||
dir_t d;
|
dir_t d;
|
||||||
while (dir.readDir(&d, card.longFilename) > 0)
|
while (dir.readDir(&d, card.longFilename) > 0) {
|
||||||
{
|
|
||||||
#if 1
|
|
||||||
/*if (power_det == 0)
|
|
||||||
{
|
|
||||||
PW_DET_ON;
|
|
||||||
power_det=0;
|
|
||||||
}
|
|
||||||
SPI_FLASH_Init();*/
|
|
||||||
|
|
||||||
|
|
||||||
//for (uint16_t i = 0; i < fileCnt; i++)
|
|
||||||
//{
|
|
||||||
//res = f_readdir(&dirs, &finfo);
|
|
||||||
//card.getfilename_sorted(i);
|
|
||||||
|
|
||||||
if (card.longFilename[0] == 0)
|
if (card.longFilename[0] == 0)
|
||||||
break;
|
break;
|
||||||
/*if ( card.filename[0] == '.')
|
|
||||||
continue;
|
|
||||||
*/
|
|
||||||
if (card.longFilename[0] == '.')
|
if (card.longFilename[0] == '.')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fn = card.longFilename;
|
fn = card.longFilename;
|
||||||
|
|
||||||
/*if ((finfo.lfname[0] == 0) || (finfo.lfname == 0))
|
|
||||||
fn = finfo.fname;
|
|
||||||
else
|
|
||||||
fn = finfo.lfname;*/
|
|
||||||
|
|
||||||
/* if (fno.fattrib & AM_DIR)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else */
|
|
||||||
//{
|
|
||||||
//if ((strstr(fn, ".gco")) || (strstr(fn, ".GCO")) || (fno.fattrib & AM_DIR))
|
|
||||||
if (strstr(fn, ".bin")) {
|
if (strstr(fn, ".bin")) {
|
||||||
char dosFilename[FILENAME_LENGTH];
|
char dosFilename[FILENAME_LENGTH];
|
||||||
createFilename(dosFilename, d);
|
createFilename(dosFilename, d);
|
||||||
|
@ -543,109 +489,28 @@ void UpdateFont() {
|
||||||
SdFile file;
|
SdFile file;
|
||||||
if (file.open(&dir, dosFilename, O_READ)) {
|
if (file.open(&dir, dosFilename, O_READ)) {
|
||||||
|
|
||||||
#if 1
|
|
||||||
/*LCD_Clear(BACK_COLOR);
|
|
||||||
|
|
||||||
if ((DeviceCode==0x9488)||(DeviceCode==0x5761))
|
|
||||||
{
|
|
||||||
LCD_ShowString(170,100,200,24,24,(u8 *)fn);
|
|
||||||
LCD_ShowString(180,130,200,24,24,"Updating...");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
LCD_ShowString(90,90,200,24,24,(u8 *)fn);
|
|
||||||
LCD_ShowString(90,120,200,24,24,"Updating...");
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
flashaddr = UNIGBK_FLASH_ADDR;
|
flashaddr = UNIGBK_FLASH_ADDR;
|
||||||
pbr = 0;
|
pbr = 0;
|
||||||
while (1)
|
while (1) {
|
||||||
{
|
|
||||||
flashaddr += pbr;
|
flashaddr += pbr;
|
||||||
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
||||||
W25QXX.SPI_FLASH_BufferWrite(public_buf, flashaddr, pbr);
|
W25QXX.SPI_FLASH_BufferWrite(public_buf, flashaddr, pbr);
|
||||||
//W25QXX.SPI_FLASH_BufferRead(public_buf_test,flashaddr,pbr);
|
|
||||||
/*if (UNIGBKFlag == 1)
|
|
||||||
{
|
|
||||||
fontrate = (uint16_t)(((float)(flashaddr - UNIGBK_FLASH_ADDR)/(float)(psrc.fsize))*100);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fontrate = (uint16_t)(((float)(flashaddr - GBK_FLASH_ADDR)/(float)(psrc.fsize))*100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fontrate > 99) fontrate=99;
|
|
||||||
|
|
||||||
if (fontrate < 10)
|
|
||||||
{
|
|
||||||
fontString[0] = fontrate%10 + 0x30;
|
|
||||||
fontString[1] = '%';
|
|
||||||
fontString[2] = '\0';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fontString[0] = fontrate/10 + 0x30;
|
|
||||||
fontString[1] = fontrate%10 + 0x30;
|
|
||||||
fontString[2] = '%';
|
|
||||||
fontString[3] = '\0';
|
|
||||||
}*/
|
|
||||||
//LCD_DisplayString(140,130,fontString);
|
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761)) {
|
|
||||||
//LCD_ShowString(200,160,200,24,24,fontString);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
//LCD_ShowString(140,150,200,24,24,fontString);
|
|
||||||
}
|
|
||||||
if (pbr < BMP_WRITE_BUF_LEN) break;
|
if (pbr < BMP_WRITE_BUF_LEN) break;
|
||||||
}
|
}
|
||||||
/*--------------read test--------------------*/
|
|
||||||
/*
|
|
||||||
BufferSet(picBuffer, 0xff, PICTURE_MAX_SIZE);
|
|
||||||
if (logoFlag == 0)
|
|
||||||
{
|
|
||||||
PicMsg_Init();
|
|
||||||
Pic_Read(fn,picBuffer);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Pic_Logo_Read(fn,picBuffer,PICTURE_MAX_SIZE);
|
|
||||||
*/
|
|
||||||
/*--------------read test--------------------*/
|
|
||||||
|
|
||||||
file.close();
|
file.close();
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
//}
|
|
||||||
/*
|
|
||||||
LCD_Clear(LCD_COLOR_BLACK);
|
|
||||||
//LCD_ShowString(110,100,200,24,24,"Complete");
|
|
||||||
LCD_DisplayString(110,80,"Complete");
|
|
||||||
delay(0xfffff);
|
|
||||||
*/
|
|
||||||
//r = f_chdir("/");
|
|
||||||
#if 1
|
|
||||||
//SdFile dir, root = card.getroot();
|
|
||||||
/*if (dir.open(&root, bakPath, O_RDONLY))
|
|
||||||
{
|
|
||||||
dir.remove();
|
|
||||||
}*/
|
|
||||||
dir.rename(&root, bakFont);
|
dir.rename(&root, bakFont);
|
||||||
//r = f_rename(picPath, bakPath);
|
dir.close();
|
||||||
|
|
||||||
|
|
||||||
//update_flag_ok = 1;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
#endif // SDSUPPORT
|
|
||||||
|
|
||||||
#endif
|
#endif // HAS_SPI_FLASH_FONT
|
||||||
|
|
||||||
#if 1
|
#endif // SDSUPPORT
|
||||||
|
|
||||||
void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
|
void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
|
||||||
uint8_t i, j;
|
uint8_t i, j;
|
||||||
|
@ -653,30 +518,21 @@ void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
|
||||||
uint32_t tmp_cnt = 0;
|
uint32_t tmp_cnt = 0;
|
||||||
PIC_MSG PIC;
|
PIC_MSG PIC;
|
||||||
|
|
||||||
//void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead);
|
|
||||||
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(&Pic_cnt, PIC_COUNTER_ADDR, 1);
|
W25QXX.SPI_FLASH_BufferRead(&Pic_cnt, PIC_COUNTER_ADDR, 1);
|
||||||
if (Pic_cnt == 0xff)
|
if (Pic_cnt == 0xff)
|
||||||
Pic_cnt = 0;
|
Pic_cnt = 0;
|
||||||
|
|
||||||
for (i = 0; i < Pic_cnt; i++) {
|
for (i = 0; i < Pic_cnt; i++) {
|
||||||
//pic name
|
|
||||||
j = 0;
|
j = 0;
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(&PIC.name[j], PIC_NAME_ADDR + tmp_cnt, 1);
|
W25QXX.SPI_FLASH_BufferRead(&PIC.name[j], PIC_NAME_ADDR + tmp_cnt, 1);
|
||||||
tmp_cnt++;
|
tmp_cnt++;
|
||||||
}while (PIC.name[j++] != '\0');
|
} while (PIC.name[j++] != '\0');
|
||||||
//pic size
|
//pic size
|
||||||
W25QXX.SPI_FLASH_BufferRead(PIC.size.bytes, PIC_SIZE_ADDR + i * 4, 4);
|
W25QXX.SPI_FLASH_BufferRead(PIC.size.bytes, PIC_SIZE_ADDR + i * 4, 4);
|
||||||
|
|
||||||
if ((strcmp((char*)Pname, (char*)PIC.name)) == 0) {
|
if ((strcmp((char*)Pname, (char*)PIC.name)) == 0) {
|
||||||
W25QXX.SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35, PIC.size.dwords);
|
W25QXX.SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, PIC_DATA_ADDR_TFT35 + i * PER_PIC_MAX_SPACE_TFT35, PIC.size.dwords);
|
||||||
/*if (DMA_ERRO_FLAG)
|
|
||||||
{
|
|
||||||
DMA_ERRO_FLAG = 0;
|
|
||||||
SPI_FLASH_BufferRead((uint8_t *)P_Rbuff,PIC_DATA_ADDR+i*PER_PIC_MAX_SPACE,PIC.size.dwords);
|
|
||||||
}*/
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -685,41 +541,34 @@ void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
|
||||||
void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {
|
void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
W25QXX.SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, addr, size);
|
W25QXX.SPI_FLASH_BufferRead((uint8_t *)P_Rbuff, addr, size);
|
||||||
/*if (DMA_ERRO_FLAG) {
|
|
||||||
DMA_ERRO_FLAG = 0;
|
|
||||||
SPI_FLASH_BufferRead((uint8_t *)P_Rbuff,addr,size);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_spi_flash_data(const char *rec_buf, int addr, int size) {
|
#if HAS_SPI_FLASH_FONT
|
||||||
|
void get_spi_flash_data(const char *rec_buf, int addr, int size) {
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
W25QXX.SPI_FLASH_BufferRead((uint8_t *)rec_buf, UNIGBK_FLASH_ADDR + addr, size);
|
W25QXX.SPI_FLASH_BufferRead((uint8_t *)rec_buf, UNIGBK_FLASH_ADDR + addr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 1
|
uint32_t logo_addroffset = 0;
|
||||||
|
void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) {
|
||||||
uint32_t logo_addroffset = 0;
|
|
||||||
void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) {
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
|
W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
|
||||||
logo_addroffset += LogoReadsize;
|
logo_addroffset += LogoReadsize;
|
||||||
if (logo_addroffset >= LOGO_MAX_SIZE_TFT35)
|
if (logo_addroffset >= LOGO_MAX_SIZE_TFT35)
|
||||||
logo_addroffset = 0;
|
logo_addroffset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t default_view_addroffset = 0;
|
uint32_t default_view_addroffset = 0;
|
||||||
void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize) {
|
void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize) {
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(default_view_Rbuff, DEFAULT_VIEW_ADDR_TFT35 + default_view_addroffset + 4, default_view_Readsize);
|
W25QXX.SPI_FLASH_BufferRead(default_view_Rbuff, DEFAULT_VIEW_ADDR_TFT35 + default_view_addroffset, default_view_Readsize);
|
||||||
default_view_addroffset += default_view_Readsize;
|
default_view_addroffset += default_view_Readsize;
|
||||||
if (default_view_addroffset >= DEFAULT_VIEW_MAX_SIZE)
|
if (default_view_addroffset >= DEFAULT_VIEW_MAX_SIZE)
|
||||||
default_view_addroffset = 0;
|
default_view_addroffset = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
#if HAS_BAK_VIEW_IN_FLASH
|
||||||
|
|
||||||
uint32_t flash_view_addroffset = 0;
|
uint32_t flash_view_addroffset = 0;
|
||||||
void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize) {
|
void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize) {
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
|
@ -728,9 +577,7 @@ void get_spi_flash_data(const char *rec_buf, int addr, int size) {
|
||||||
flash_view_addroffset += flash_view_Readsize;
|
flash_view_addroffset += flash_view_Readsize;
|
||||||
if (flash_view_addroffset >= FLASH_VIEW_MAX_SIZE)
|
if (flash_view_addroffset >= FLASH_VIEW_MAX_SIZE)
|
||||||
flash_view_addroffset = 0;
|
flash_view_addroffset = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -29,21 +29,61 @@ extern "C" { /* C-declarations for C++ */
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
|
|
||||||
#if 1
|
#include "../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#define PIC_MAX_CN 100 // Maximum number of pictures
|
#ifndef HAS_SPI_FLASH_FONT
|
||||||
#define PIC_NAME_MAX_LEN 50 // Picture name maximum length
|
#define HAS_SPI_FLASH_FONT 0 //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
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_BAK_VIEW_IN_FLASH
|
||||||
|
#define HAS_BAK_VIEW_IN_FLASH 1
|
||||||
|
#endif
|
||||||
|
#ifndef HAS_GCODE_DEFAULT_VIEW_IN_FLASH
|
||||||
|
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 1
|
||||||
|
#endif
|
||||||
|
#ifndef SPI_FLASH_SIZE
|
||||||
|
#define SPI_FLASH_SIZE 0x1000000 // 16MB
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOGO_MAX_SIZE_TFT35 (300*1024)
|
#define PIC_MAX_CN 100 // Maximum number of pictures
|
||||||
#define LOGO_MAX_SIZE_TFT32 (150*1024)
|
#define PIC_NAME_MAX_LEN 50 // Picture name maximum length
|
||||||
#define TITLELOGO_MAX_SIZE (150*1024) // Little logo maximum
|
|
||||||
#define DEFAULT_VIEW_MAX_SIZE (200*200*2)
|
|
||||||
#define FLASH_VIEW_MAX_SIZE (200*200*2)
|
|
||||||
|
|
||||||
#define PER_PIC_MAX_SPACE_TFT35 (32*1024)
|
#define LOGO_MAX_SIZE_TFT35 (300*1024)
|
||||||
#define PER_PIC_MAX_SPACE_TFT32 (16*1024)
|
#define LOGO_MAX_SIZE_TFT32 (150*1024)
|
||||||
#define PER_FONT_MAX_SPACE (16*1024)
|
#define TITLELOGO_MAX_SIZE (150*1024) // Little logo maximum
|
||||||
|
#define DEFAULT_VIEW_MAX_SIZE (200*200*2)
|
||||||
|
#define FLASH_VIEW_MAX_SIZE (200*200*2)
|
||||||
|
|
||||||
|
#define PER_PIC_MAX_SPACE_TFT35 (32*1024)
|
||||||
|
#define PER_PIC_MAX_SPACE_TFT32 (16*1024)
|
||||||
|
#define PER_FONT_MAX_SPACE (16*1024)
|
||||||
|
|
||||||
|
#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 //
|
||||||
|
|
||||||
|
// 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 PIC_DATA_ADDR_TFT32 0x00F000
|
||||||
|
#define PIC_ICON_LOGO_ADDR_TFT32 0x5D8000
|
||||||
|
#define PIC_OTHER_SIZE_ADDR_TFT32 0x5EE000
|
||||||
|
|
||||||
|
#else
|
||||||
//pic
|
//pic
|
||||||
//Robin_pro pic addr
|
//Robin_pro pic addr
|
||||||
#define PIC_NAME_ADDR 0x003000 // Pic information addr
|
#define PIC_NAME_ADDR 0x003000 // Pic information addr
|
||||||
|
@ -54,10 +94,10 @@ extern "C" { /* C-declarations for C++ */
|
||||||
//#define PIC_DATA_ADDR 0x02F000 //
|
//#define PIC_DATA_ADDR 0x02F000 //
|
||||||
|
|
||||||
// TFT35
|
// TFT35
|
||||||
#define DEFAULT_VIEW_ADDR_TFT35 0XC5800
|
#define DEFAULT_VIEW_ADDR_TFT35 0xC5800
|
||||||
#define BAK_VIEW_ADDR_TFT35 (DEFAULT_VIEW_ADDR_TFT35+90*1024)
|
#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_ICON_LOGO_ADDR_TFT35 (BAK_VIEW_ADDR_TFT35+80*1024)
|
||||||
#define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35+350*1024)//0XC5800
|
#define PIC_DATA_ADDR_TFT35 (PIC_ICON_LOGO_ADDR_TFT35+350*1024) //0xC5800
|
||||||
|
|
||||||
// TFT32
|
// TFT32
|
||||||
#define PIC_DATA_ADDR_TFT32 0x02F000
|
#define PIC_DATA_ADDR_TFT32 0x02F000
|
||||||
|
@ -69,48 +109,37 @@ extern "C" { /* C-declarations for C++ */
|
||||||
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
|
#define UNIGBK_FLASH_ADDR (FONTINFOADDR+4096) // 4*1024
|
||||||
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
|
#define GBK_FLASH_ADDR (UNIGBK_FLASH_ADDR+180224) // 176*1024
|
||||||
|
|
||||||
// Flash flag
|
|
||||||
#define FLASH_INF_VALID_FLAG 0xAA558761
|
|
||||||
// SD card information first addr
|
|
||||||
#define VAR_INF_ADDR 0x000000
|
|
||||||
|
|
||||||
union union32 {
|
|
||||||
uint8_t bytes[4];
|
|
||||||
uint32_t dwords;
|
|
||||||
};
|
|
||||||
|
|
||||||
// pic information
|
|
||||||
struct pic_msg {
|
|
||||||
uint8_t name[PIC_NAME_MAX_LEN];
|
|
||||||
union union32 size;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct pic_msg PIC_MSG;
|
|
||||||
|
|
||||||
#define BMP_WRITE_BUF_LEN 512
|
|
||||||
|
|
||||||
#define PICINFOADDR 0
|
|
||||||
|
|
||||||
#define PIC_SIZE_xM 6
|
|
||||||
#define FONT_SIZE_xM 2
|
|
||||||
|
|
||||||
//extern void PicMsg_Init(void);
|
|
||||||
extern void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
|
|
||||||
//extern void bindBmpFileData(const uint8_t **pBuf, uint8_t *pName);
|
|
||||||
//extern void Pic_Logo_Read(uint8_t *LogoName,uint8_t *Logo_Rbuff,uint32_t LogoReadsize);
|
|
||||||
//extern void default_view_Read(uint8_t *default_view_Rbuff,uint32_t default_view_Readsize);
|
|
||||||
//extern void flash_view_Read(uint8_t *flash_view_Rbuff,uint32_t flash_view_Readsize);
|
|
||||||
|
|
||||||
//extern void lv_Pic_Read(uint8_t *Pname,uint8_t *P_Rbuff,uint32_t addr,uint32_t size);
|
|
||||||
extern void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Flash flag
|
||||||
|
#define FLASH_INF_VALID_FLAG 0xAA558761
|
||||||
|
// SD card information first addr
|
||||||
|
#define VAR_INF_ADDR 0x000000
|
||||||
|
|
||||||
|
union union32 {
|
||||||
|
uint8_t bytes[4];
|
||||||
|
uint32_t dwords;
|
||||||
|
};
|
||||||
|
|
||||||
|
// pic information
|
||||||
|
struct pic_msg {
|
||||||
|
uint8_t name[PIC_NAME_MAX_LEN];
|
||||||
|
union union32 size;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct pic_msg PIC_MSG;
|
||||||
|
|
||||||
|
#define BMP_WRITE_BUF_LEN 512
|
||||||
|
|
||||||
|
#define PICINFOADDR 0
|
||||||
|
|
||||||
|
#define PIC_SIZE_xM 6
|
||||||
|
#define FONT_SIZE_xM 2
|
||||||
|
|
||||||
|
extern void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
|
||||||
|
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 uint32_t lv_get_pic_addr(uint8_t *Pname);
|
||||||
|
|
||||||
extern void get_spi_flash_data(const char *rec_buf, int offset, int size);
|
extern void get_spi_flash_data(const char *rec_buf, int offset, int size);
|
||||||
//extern void SPI_FLASH_BufferRead(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
|
|
||||||
|
|
||||||
extern void spi_flash_read_test();
|
extern void spi_flash_read_test();
|
||||||
extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
|
extern void default_view_Read(uint8_t *default_view_Rbuff, uint32_t default_view_Readsize);
|
||||||
extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
|
extern void flash_view_Read(uint8_t *flash_view_Rbuff, uint32_t flash_view_Readsize);
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
|
|
||||||
|
@ -215,4 +215,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "../../../../inc/MarlinConfig.h"
|
#include "../../../../inc/MarlinConfig.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS) // FSMC on 100/144 pins SoCs
|
#if defined(ARDUINO_ARCH_STM32F1) && PIN_EXISTS(FSMC_CS) // FSMC on 100/144 pins SoCs
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
return uint32_t(data);
|
return uint32_t(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(LCD_USE_DMA_FSMC)
|
#ifdef LCD_USE_DMA_FSMC
|
||||||
|
|
||||||
void LCD_IO_WriteMultiple(uint16_t color, uint32_t count) {
|
void LCD_IO_WriteMultiple(uint16_t color, uint32_t count) {
|
||||||
while (count > 0) {
|
while (count > 0) {
|
||||||
|
@ -270,4 +270,4 @@
|
||||||
|
|
||||||
#endif // LCD_USE_DMA_FSMC
|
#endif // LCD_USE_DMA_FSMC
|
||||||
#endif // ARDUINO_ARCH_STM32F1 && FSMC_CS_PIN
|
#endif // ARDUINO_ARCH_STM32F1 && FSMC_CS_PIN
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -27,120 +27,76 @@
|
||||||
|
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
|
|
||||||
#include "tft_lvgl_configuration.h"
|
#include "tft_lvgl_configuration.h"
|
||||||
#include "lvgl.h"
|
#include "lvgl.h"
|
||||||
#include "../../../../feature/touch/xpt2046.h"
|
#include "../../../../feature/touch/xpt2046.h"
|
||||||
#include "draw_ready_print.h"
|
#include "draw_ready_print.h"
|
||||||
#include "W25Qxx.h"
|
#include "W25Qxx.h"
|
||||||
#include "pic_manager.h"
|
#include "pic_manager.h"
|
||||||
|
|
||||||
#include "mks_hardware_test.h"
|
#include "mks_hardware_test.h"
|
||||||
#include "draw_ui.h"
|
#include "draw_ui.h"
|
||||||
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
#include "../../../../feature/powerloss.h"
|
#include "../../../../feature/powerloss.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
|
|
||||||
#if ENABLED(SPI_GRAPHICAL_TFT)
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
#include "SPI_TFT.h"
|
#include "SPI_TFT.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#include "../../Configuration.h"
|
extern void LCD_IO_Init(uint8_t cs, uint8_t rs);
|
||||||
//#include "../../src/core/macros.h"
|
extern void LCD_IO_WriteData(uint16_t RegValue);
|
||||||
|
extern void LCD_IO_WriteReg(uint16_t Reg);
|
||||||
extern void LCD_IO_Init(uint8_t cs, uint8_t rs);
|
extern void LCD_IO_WriteSequence(uint16_t *data, uint16_t length);
|
||||||
extern void LCD_IO_WriteData(uint16_t RegValue);
|
extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
|
||||||
extern void LCD_IO_WriteReg(uint16_t Reg);
|
|
||||||
|
|
||||||
extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count);
|
|
||||||
|
|
||||||
|
#if HAS_SPI_FLASH_FONT
|
||||||
extern void init_gb2312_font();
|
extern void init_gb2312_font();
|
||||||
|
#endif
|
||||||
|
|
||||||
static lv_disp_buf_t disp_buf;
|
static lv_disp_buf_t disp_buf;
|
||||||
//static lv_color_t buf[LV_HOR_RES_MAX * 18];
|
#if ENABLED(SDSUPPORT)
|
||||||
//static lv_color_t buf[10*5];
|
|
||||||
//extern lv_obj_t * scr;
|
|
||||||
#if ENABLED(SDSUPPORT)
|
|
||||||
extern void UpdatePic();
|
extern void UpdatePic();
|
||||||
|
#if HAS_SPI_FLASH_FONT
|
||||||
extern void UpdateFont();
|
extern void UpdateFont();
|
||||||
#endif
|
#endif
|
||||||
uint16_t DeviceCode = 0x9488;
|
#endif
|
||||||
extern uint8_t sel_id;
|
uint16_t DeviceCode = 0x9488;
|
||||||
|
extern uint8_t sel_id;
|
||||||
|
|
||||||
#define SetCs
|
#define SetCs
|
||||||
#define ClrCs
|
#define ClrCs
|
||||||
|
|
||||||
#define HDP 799//Horizontal Display Period //**
|
#define HDP 799 // Horizontal Display Period
|
||||||
#define HT 1000//Horizontal Total
|
#define HT 1000 // Horizontal Total
|
||||||
#define HPS 51//LLINE Pulse Start Position
|
#define HPS 51 // LLINE Pulse Start Position
|
||||||
#define LPS 3 // Horizontal Display Period Start Position
|
#define LPS 3 // Horizontal Display Period Start Position
|
||||||
#define HPW 8 // LLINE Pulse Width
|
#define HPW 8 // LLINE Pulse Width
|
||||||
|
|
||||||
#define VDP 479//Vertical Display Period
|
#define VDP 479 // Vertical Display Period
|
||||||
#define VT 530//Vertical Total
|
#define VT 530 // Vertical Total
|
||||||
#define VPS 24// LFRAME Pulse Start Position
|
#define VPS 24 // LFRAME Pulse Start Position
|
||||||
#define FPS 23//Vertical Display Period Start Positio
|
#define FPS 23 // Vertical Display Period Start Positio
|
||||||
#define VPW 3 // LFRAME Pulse Width //**
|
#define VPW 3 // LFRAME Pulse Width
|
||||||
|
|
||||||
#define MAX_HZ_POSX HDP+1
|
#define MAX_HZ_POSX HDP+1
|
||||||
#define MAX_HZ_POSY VDP+1
|
#define MAX_HZ_POSY VDP+1
|
||||||
|
|
||||||
extern uint8_t gcode_preview_over, flash_preview_begin, default_preview_flg;
|
extern uint8_t gcode_preview_over, flash_preview_begin, default_preview_flg;
|
||||||
|
|
||||||
void SysTick_Callback() {
|
void SysTick_Callback() {
|
||||||
lv_tick_inc(1);
|
lv_tick_inc(1);
|
||||||
print_time_count();
|
print_time_count();
|
||||||
}
|
}
|
||||||
|
|
||||||
void tft_set_cursor(uint16_t x, uint16_t y) {
|
void tft_set_cursor(uint16_t x, uint16_t y) {
|
||||||
#if 0
|
|
||||||
if (DeviceCode == 0x8989) {
|
|
||||||
LCD_WriteReg(0x004E, y); //行
|
|
||||||
LCD_WriteReg(0x004F, x); //列
|
|
||||||
}
|
|
||||||
else if ((DeviceCode == 0x9919)) {
|
|
||||||
LCD_WriteReg(0x004E, x); // 行
|
|
||||||
LCD_WriteReg(0x004F, y); // 列
|
|
||||||
}
|
|
||||||
else if ((DeviceCode == 0x5761)) { //SSD1963
|
|
||||||
LCD_WrtReg(0x002A);
|
|
||||||
LCD_WrtRAM(x >> 8);
|
|
||||||
LCD_WrtRAM(x & 0x00FF);
|
|
||||||
LCD_WrtRAM(HDP >> 8);
|
|
||||||
LCD_WrtRAM(HDP & 0x00FF);
|
|
||||||
LCD_WrtReg(0x002B);
|
|
||||||
LCD_WrtRAM(y >> 8);
|
|
||||||
LCD_WrtRAM(y & 0x00FF);
|
|
||||||
LCD_WrtRAM(VDP >> 8);
|
|
||||||
LCD_WrtRAM(VDP & 0x00FF);
|
|
||||||
}
|
|
||||||
else if (DeviceCode == 0x9488) {
|
|
||||||
ILI9488_WriteCmd(0x002A);
|
|
||||||
ILI9488_WriteData(x >> 8);
|
|
||||||
ILI9488_WriteData(x & 0x00FF);
|
|
||||||
ILI9488_WriteData(x >> 8);
|
|
||||||
ILI9488_WriteData(x & 0x00FF);
|
|
||||||
//ILI9488_WriteData(0x01);
|
|
||||||
//ILI9488_WriteData(0xDF);
|
|
||||||
ILI9488_WriteCmd(0x002B);
|
|
||||||
ILI9488_WriteData(y >> 8);
|
|
||||||
ILI9488_WriteData(y & 0x00FF);
|
|
||||||
ILI9488_WriteData(y >> 8);
|
|
||||||
ILI9488_WriteData(y & 0x00FF);
|
|
||||||
//ILI9488_WriteData(0x01);
|
|
||||||
//ILI9488_WriteData(0x3F);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
LCD_WriteReg(0x0020, y); // 行
|
|
||||||
LCD_WriteReg(0x0021, 0x13f - x); // 列
|
|
||||||
}
|
|
||||||
#else // if 0
|
|
||||||
LCD_IO_WriteReg(0x002A);
|
LCD_IO_WriteReg(0x002A);
|
||||||
LCD_IO_WriteData(x >> 8);
|
LCD_IO_WriteData(x >> 8);
|
||||||
LCD_IO_WriteData(x & 0x00FF);
|
LCD_IO_WriteData(x & 0x00FF);
|
||||||
|
@ -155,10 +111,9 @@
|
||||||
LCD_IO_WriteData(y & 0x00FF);
|
LCD_IO_WriteData(y & 0x00FF);
|
||||||
//ILI9488_WriteData(0x01);
|
//ILI9488_WriteData(0x01);
|
||||||
//ILI9488_WriteData(0x3F);
|
//ILI9488_WriteData(0x3F);
|
||||||
#endif // if 0
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void LCD_WriteRAM_Prepare(void) {
|
void LCD_WriteRAM_Prepare(void) {
|
||||||
#if 0
|
#if 0
|
||||||
if ((DeviceCode == 0x9325) || (DeviceCode == 0x9328) || (DeviceCode == 0x8989)) {
|
if ((DeviceCode == 0x9325) || (DeviceCode == 0x9328) || (DeviceCode == 0x8989)) {
|
||||||
ClrCs
|
ClrCs
|
||||||
|
@ -171,9 +126,9 @@
|
||||||
#else
|
#else
|
||||||
LCD_IO_WriteReg(0x002C);
|
LCD_IO_WriteReg(0x002C);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void tft_set_point(uint16_t x, uint16_t y, uint16_t point) {
|
void tft_set_point(uint16_t x, uint16_t y, uint16_t point) {
|
||||||
//if (DeviceCode == 0x9488) {
|
//if (DeviceCode == 0x9488) {
|
||||||
if ((x > 480) || (y > 320)) return;
|
if ((x > 480) || (y > 320)) return;
|
||||||
//}
|
//}
|
||||||
|
@ -183,20 +138,19 @@
|
||||||
LCD_WriteRAM_Prepare(); /* 开始写入GRAM*/
|
LCD_WriteRAM_Prepare(); /* 开始写入GRAM*/
|
||||||
//LCD_WriteRAM(point);
|
//LCD_WriteRAM(point);
|
||||||
LCD_IO_WriteData(point);
|
LCD_IO_WriteData(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LCD_WriteReg(uint16_t LCD_Reg, uint16_t LCD_RegValue) {
|
void LCD_WriteReg(uint16_t LCD_Reg, uint16_t LCD_RegValue) {
|
||||||
/* Write 16-bit Index, then Write Reg */
|
/* Write 16-bit Index, then Write Reg */
|
||||||
ClrCs
|
ClrCs
|
||||||
LCD_IO_WriteReg(LCD_Reg);
|
LCD_IO_WriteReg(LCD_Reg);
|
||||||
/* Write 16-bit Reg */
|
/* Write 16-bit Reg */
|
||||||
LCD_IO_WriteData(LCD_RegValue);
|
LCD_IO_WriteData(LCD_RegValue);
|
||||||
SetCs
|
SetCs
|
||||||
}
|
}
|
||||||
|
|
||||||
void ili9320_SetWindows(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t heigh) {
|
void ili9320_SetWindows(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t heigh) {
|
||||||
uint16_t s_h, s_l, e_h, e_l;
|
uint16_t s_h, s_l, e_h, e_l;
|
||||||
|
|
||||||
uint16_t xEnd, yEnd;
|
uint16_t xEnd, yEnd;
|
||||||
xEnd = StartX + width;
|
xEnd = StartX + width;
|
||||||
yEnd = StartY + heigh - 1;
|
yEnd = StartY + heigh - 1;
|
||||||
|
@ -265,9 +219,9 @@
|
||||||
LCD_IO_WriteData(e_h);
|
LCD_IO_WriteData(e_h);
|
||||||
LCD_IO_WriteData(e_l);
|
LCD_IO_WriteData(e_l);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LCD_Clear(uint16_t Color) {
|
void LCD_Clear(uint16_t Color) {
|
||||||
uint32_t index = 0;
|
uint32_t index = 0;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
|
||||||
|
@ -275,9 +229,13 @@
|
||||||
tft_set_cursor(0, 0);
|
tft_set_cursor(0, 0);
|
||||||
ili9320_SetWindows(0, 0, 480, 320);
|
ili9320_SetWindows(0, 0, 480, 320);
|
||||||
LCD_WriteRAM_Prepare();
|
LCD_WriteRAM_Prepare();
|
||||||
|
#ifdef LCD_USE_DMA_FSMC
|
||||||
|
LCD_IO_WriteMultiple(Color, LCD_FULL_PIXEL_WIDTH * LCD_FULL_PIXEL_HEIGHT);
|
||||||
|
#else
|
||||||
//index = (160*480);
|
//index = (160*480);
|
||||||
for (index = 0; index < 320 * 480; index++)
|
for (index = 0; index < 320 * 480; index++)
|
||||||
LCD_IO_WriteData(Color);
|
LCD_IO_WriteData(Color);
|
||||||
|
#endif
|
||||||
//LCD_IO_WriteMultiple(Color, (480*320));
|
//LCD_IO_WriteMultiple(Color, (480*320));
|
||||||
//while(index --) LCD_IO_WriteData(Color);
|
//while(index --) LCD_IO_WriteData(Color);
|
||||||
}
|
}
|
||||||
|
@ -303,16 +261,41 @@
|
||||||
for (index = 0; index < 76800; index++)
|
for (index = 0; index < 76800; index++)
|
||||||
LCD_IO_WriteData(Color);
|
LCD_IO_WriteData(Color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extern uint16_t ILI9488_ReadRAM();
|
extern uint16_t ILI9488_ReadRAM();
|
||||||
|
|
||||||
#if DISABLED(SPI_GRAPHICAL_TFT)
|
#if DISABLED(SPI_GRAPHICAL_TFT)
|
||||||
|
|
||||||
void init_tft() {
|
void init_tft() {
|
||||||
uint16_t i;
|
uint16_t i;
|
||||||
//************* Start Initial Sequence **********//
|
//************* Start Initial Sequence **********//
|
||||||
|
|
||||||
|
//start lcd pins and dma
|
||||||
|
#if PIN_EXISTS(LCD_BACKLIGHT)
|
||||||
|
OUT_WRITE(LCD_BACKLIGHT_PIN, DISABLED(DELAYED_BACKLIGHT_INIT)); // Illuminate after reset or right away
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PIN_EXISTS(LCD_RESET)
|
||||||
|
// Perform a clean hardware reset with needed delays
|
||||||
|
OUT_WRITE(LCD_RESET_PIN, LOW);
|
||||||
|
_delay_ms(5);
|
||||||
|
WRITE(LCD_RESET_PIN, HIGH);
|
||||||
|
_delay_ms(5);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PIN_EXISTS(LCD_BACKLIGHT) && ENABLED(DELAYED_BACKLIGHT_INIT)
|
||||||
|
WRITE(LCD_BACKLIGHT_PIN, HIGH);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TERN_(HAS_LCD_CONTRAST, refresh_contrast());
|
||||||
|
|
||||||
|
#ifdef LCD_USE_DMA_FSMC
|
||||||
|
dma_init(FSMC_DMA_DEV);
|
||||||
|
dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
||||||
|
dma_set_priority(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, DMA_PRIORITY_MEDIUM);
|
||||||
|
#endif
|
||||||
|
|
||||||
LCD_IO_Init(FSMC_CS_PIN, FSMC_RS_PIN);
|
LCD_IO_Init(FSMC_CS_PIN, FSMC_RS_PIN);
|
||||||
|
|
||||||
_delay_ms(5);
|
_delay_ms(5);
|
||||||
|
@ -421,30 +404,38 @@
|
||||||
|
|
||||||
OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
|
OUT_WRITE(LCD_BACKLIGHT_PIN, HIGH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // if DISABLED(SPI_GRAPHICAL_TFT)
|
#endif // if DISABLED(SPI_GRAPHICAL_TFT)
|
||||||
|
|
||||||
extern uint8_t bmp_public_buf[17 * 1024];
|
extern uint8_t bmp_public_buf[17 * 1024];
|
||||||
void tft_lvgl_init() {
|
void tft_lvgl_init() {
|
||||||
//uint16_t test_id=0;
|
//uint16_t test_id=0;
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
//test_id=W25QXX.W25QXX_ReadID();
|
//test_id=W25QXX.W25QXX_ReadID();
|
||||||
|
|
||||||
|
//init tft first!
|
||||||
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
|
SPI_TFT.spi_init(SPI_FULL_SPEED);
|
||||||
|
SPI_TFT.LCD_init();
|
||||||
|
#else
|
||||||
|
init_tft();
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SDSUPPORT)
|
#if ENABLED(SDSUPPORT)
|
||||||
UpdatePic();
|
UpdatePic();
|
||||||
|
#if HAS_SPI_FLASH_FONT
|
||||||
UpdateFont();
|
UpdateFont();
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
gCfgItems_init();
|
gCfgItems_init();
|
||||||
ui_cfg_init();
|
ui_cfg_init();
|
||||||
disp_language_init();
|
disp_language_init();
|
||||||
//spi_flash_read_test();
|
//spi_flash_read_test();
|
||||||
|
|
||||||
#if ENABLED(SPI_GRAPHICAL_TFT)
|
#if ENABLED(TOUCH_BUTTONS)
|
||||||
SPI_TFT.spi_init(SPI_FULL_SPEED);
|
touch.init();
|
||||||
SPI_TFT.LCD_init();
|
|
||||||
#else
|
|
||||||
init_tft();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lv_init();
|
lv_init();
|
||||||
|
@ -465,7 +456,9 @@
|
||||||
|
|
||||||
systick_attach_callback(SysTick_Callback);
|
systick_attach_callback(SysTick_Callback);
|
||||||
|
|
||||||
|
#if HAS_SPI_FLASH_FONT
|
||||||
init_gb2312_font();
|
init_gb2312_font();
|
||||||
|
#endif
|
||||||
|
|
||||||
tft_style_init();
|
tft_style_init();
|
||||||
|
|
||||||
|
@ -495,22 +488,9 @@
|
||||||
#if ENABLED(MKS_TEST)
|
#if ENABLED(MKS_TEST)
|
||||||
Test_GPIO();
|
Test_GPIO();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * color_p) {
|
||||||
void LCD_WriteRAM(uint16_t RGB_Code) {
|
|
||||||
#if 0
|
|
||||||
ClrCs
|
|
||||||
/* Write 16-bit GRAM Reg */
|
|
||||||
LCD->LCD_RAM = RGB_Code;
|
|
||||||
SetCs
|
|
||||||
#else
|
|
||||||
LCD_IO_WriteData(RGB_Code);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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(SPI_GRAPHICAL_TFT)
|
||||||
uint16_t i, width, height;
|
uint16_t i, width, height;
|
||||||
uint16_t clr_temp;
|
uint16_t clr_temp;
|
||||||
|
@ -549,50 +529,32 @@
|
||||||
#if 1
|
#if 1
|
||||||
uint16_t i, width, height;
|
uint16_t i, width, height;
|
||||||
uint16_t clr_temp;
|
uint16_t clr_temp;
|
||||||
#if 0
|
|
||||||
int32_t x, y;
|
|
||||||
for (y = area->y1; y <= area->y2; y++)
|
|
||||||
for (x = area->x1; x <= area->x2; x++) {
|
|
||||||
//set_pixel(x, y, *color_p); /* Put a pixel to the display.*/
|
|
||||||
clr_temp = (uint16_t)(((uint16_t)color_p->ch.red << 11)
|
|
||||||
| ((uint16_t)color_p->ch.green << 5)
|
|
||||||
| ((uint16_t)color_p->ch.blue));
|
|
||||||
tft_set_point(x, y, clr_temp);
|
|
||||||
color_p++;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
width = area->x2 - area->x1 + 1;
|
width = area->x2 - area->x1 + 1;
|
||||||
height = area->y2 - area->y1 + 1;
|
height = area->y2 - area->y1 + 1;
|
||||||
//tft_set_cursor((uint16_t)area->x1,(uint16_t)area->y1);
|
|
||||||
ili9320_SetWindows((uint16_t)area->x1, (uint16_t)area->y1, width, height);
|
ili9320_SetWindows((uint16_t)area->x1, (uint16_t)area->y1, width, height);
|
||||||
LCD_WriteRAM_Prepare();
|
LCD_WriteRAM_Prepare();
|
||||||
for (i = 0; i < width * height; i++) {
|
for (i = 0; i < width * height - 2; i++) {
|
||||||
clr_temp = (uint16_t)(((uint16_t)color_p->ch.red << 11)
|
clr_temp = (uint16_t)(((uint16_t)color_p->ch.red << 11)
|
||||||
| ((uint16_t)color_p->ch.green << 5)
|
| ((uint16_t)color_p->ch.green << 5)
|
||||||
| ((uint16_t)color_p->ch.blue));
|
| ((uint16_t)color_p->ch.blue));
|
||||||
LCD_IO_WriteData(clr_temp);
|
LCD_IO_WriteData(clr_temp);
|
||||||
color_p++;
|
color_p++;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
|
lv_disp_flush_ready(disp); /* Indicate you are ready with the flushing*/
|
||||||
#endif
|
#endif
|
||||||
#endif // SPI_GRAPHICAL_TFT
|
#endif // SPI_GRAPHICAL_TFT
|
||||||
}
|
}
|
||||||
|
|
||||||
#define TICK_CYCLE 1
|
#define TICK_CYCLE 1
|
||||||
|
|
||||||
static int32_t touch_time1 = 0;
|
static int32_t touch_time1 = 0;
|
||||||
|
|
||||||
unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
|
unsigned int getTickDiff(unsigned int curTick, unsigned int lastTick) {
|
||||||
if (lastTick <= curTick)
|
return TICK_CYCLE * (lastTick <= curTick ? (curTick - lastTick) : (0xFFFFFFFF - lastTick + curTick));
|
||||||
return (curTick - lastTick) * TICK_CYCLE;
|
}
|
||||||
else
|
|
||||||
return (0xFFFFFFFF - lastTick + curTick) * TICK_CYCLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if ENABLED(SPI_GRAPHICAL_TFT)
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
|
|
||||||
#ifndef USE_XPT2046
|
#ifndef USE_XPT2046
|
||||||
#define USE_XPT2046 1
|
#define USE_XPT2046 1
|
||||||
|
@ -612,29 +574,51 @@
|
||||||
#define XPT2046_INV 1
|
#define XPT2046_INV 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#ifndef USE_XPT2046
|
#ifndef USE_XPT2046
|
||||||
#define USE_XPT2046 1
|
#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
|
||||||
|
#endif
|
||||||
|
|
||||||
#if USE_XPT2046
|
#if USE_XPT2046
|
||||||
|
#ifndef XPT2046_HOR_RES 480
|
||||||
#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
|
#define XPT2046_AVG 4
|
||||||
|
#endif
|
||||||
|
#ifndef XPT2046_INV
|
||||||
#define XPT2046_INV 0
|
#define XPT2046_INV 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void xpt2046_corr(uint16_t *x, uint16_t *y) {
|
#endif
|
||||||
|
|
||||||
|
static void xpt2046_corr(uint16_t *x, uint16_t *y) {
|
||||||
#if XPT2046_XY_SWAP
|
#if XPT2046_XY_SWAP
|
||||||
int16_t swap_tmp;
|
int16_t swap_tmp;
|
||||||
swap_tmp = *x;
|
swap_tmp = *x;
|
||||||
|
@ -651,13 +635,13 @@
|
||||||
#if XPT2046_Y_INV
|
#if XPT2046_Y_INV
|
||||||
(*y) = XPT2046_VER_RES - (*y);
|
(*y) = XPT2046_VER_RES - (*y);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define times 4
|
#define times 4
|
||||||
#define CHX 0x90// 0x90
|
#define CHX 0x90
|
||||||
#define CHY 0xD0// 0xD0
|
#define CHY 0xD0
|
||||||
|
|
||||||
int SPI2_ReadWrite2Bytes(void) {
|
int SPI2_ReadWrite2Bytes(void) {
|
||||||
volatile uint16_t ans = 0;
|
volatile uint16_t ans = 0;
|
||||||
uint16_t temp = 0;
|
uint16_t temp = 0;
|
||||||
#if ENABLED(SPI_GRAPHICAL_TFT)
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
|
@ -674,13 +658,11 @@
|
||||||
ans >>= 3;
|
ans >>= 3;
|
||||||
#endif
|
#endif
|
||||||
return ans & 0x0FFF;
|
return ans & 0x0FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t x_addata[times], y_addata[times];
|
uint16_t x_addata[times], y_addata[times];
|
||||||
void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
|
void XPT2046_Rd_Addata(uint16_t *X_Addata, uint16_t *Y_Addata) {
|
||||||
uint16_t i, j, k;
|
uint16_t i, j, k;
|
||||||
//int result;
|
|
||||||
//#if ENABLED(TOUCH_BUTTONS)
|
|
||||||
|
|
||||||
#if ENABLED(SPI_GRAPHICAL_TFT)
|
#if ENABLED(SPI_GRAPHICAL_TFT)
|
||||||
SPI_TFT.spi_init(SPI_QUARTER_SPEED);
|
SPI_TFT.spi_init(SPI_QUARTER_SPEED);
|
||||||
|
@ -710,8 +692,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
//#endif
|
|
||||||
//result = x_addata[0];
|
|
||||||
for (i = 0; i < times; i++)
|
for (i = 0; i < times; i++)
|
||||||
for (j = i + 1; j < times; j++)
|
for (j = i + 1; j < times; j++)
|
||||||
if (x_addata[j] > x_addata[i]) {
|
if (x_addata[j] > x_addata[i]) {
|
||||||
|
@ -726,7 +707,6 @@
|
||||||
|
|
||||||
*X_Addata = (x_addata[times / 2 - 1] + x_addata[times / 2]) / 2;
|
*X_Addata = (x_addata[times / 2 - 1] + x_addata[times / 2]) / 2;
|
||||||
|
|
||||||
//result = y_addata[0];
|
|
||||||
for (i = 0; i < times; i++)
|
for (i = 0; i < times; i++)
|
||||||
for (j = i + 1; j < times; j++)
|
for (j = i + 1; j < times; j++)
|
||||||
if (y_addata[j] > y_addata[i]) {
|
if (y_addata[j] > y_addata[i]) {
|
||||||
|
@ -741,21 +721,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
*Y_Addata = (y_addata[times / 2 - 1] + y_addata[times / 2]) / 2;
|
*Y_Addata = (y_addata[times / 2 - 1] + y_addata[times / 2]) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADC_VALID_OFFSET 10
|
#define ADC_VALID_OFFSET 10
|
||||||
|
|
||||||
uint8_t TOUCH_PressValid(uint16_t _usX, uint16_t _usY) {
|
uint8_t TOUCH_PressValid(uint16_t _usX, uint16_t _usY) {
|
||||||
if ((_usX <= ADC_VALID_OFFSET) || (_usY <= ADC_VALID_OFFSET)
|
if ( (_usX <= ADC_VALID_OFFSET) || (_usY <= ADC_VALID_OFFSET)
|
||||||
|| (_usX >= 4095 - ADC_VALID_OFFSET) || (_usY >= 4095 - ADC_VALID_OFFSET)
|
|| (_usX >= 4095 - ADC_VALID_OFFSET) || (_usY >= 4095 - ADC_VALID_OFFSET)
|
||||||
) return 0;
|
) return 0;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static lv_coord_t last_x = 0, last_y = 0;
|
static lv_coord_t last_x = 0, last_y = 0;
|
||||||
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
|
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data) {
|
||||||
#if 1
|
|
||||||
uint32_t tmpTime, diffTime = 0;
|
uint32_t tmpTime, diffTime = 0;
|
||||||
|
|
||||||
tmpTime = millis();
|
tmpTime = millis();
|
||||||
|
@ -766,17 +744,26 @@
|
||||||
//touchpad_get_xy(&last_x, &last_y);
|
//touchpad_get_xy(&last_x, &last_y);
|
||||||
/*Save the pressed coordinates and the state*/
|
/*Save the pressed coordinates and the state*/
|
||||||
if (diffTime > 10) {
|
if (diffTime > 10) {
|
||||||
|
//use marlin touch code if enabled
|
||||||
|
#if ENABLED(TOUCH_BUTTONS)
|
||||||
|
touch.getTouchPoint(reinterpret_cast<uint16_t&>(last_x), reinterpret_cast<uint16_t&>(last_y));
|
||||||
|
#else
|
||||||
XPT2046_Rd_Addata((uint16_t *)&last_x, (uint16_t *)&last_y);
|
XPT2046_Rd_Addata((uint16_t *)&last_x, (uint16_t *)&last_y);
|
||||||
|
#endif
|
||||||
if (TOUCH_PressValid(last_x, last_y)) {
|
if (TOUCH_PressValid(last_x, last_y)) {
|
||||||
|
|
||||||
data->state = LV_INDEV_STATE_PR;
|
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);
|
xpt2046_corr((uint16_t *)&last_x, (uint16_t *)&last_y);
|
||||||
|
// SERIAL_ECHOLNPAIR("X: ", last_x, ", y: ", last_y);
|
||||||
data->point.x = last_x;
|
data->point.x = last_x;
|
||||||
data->point.y = last_y;
|
data->point.y = last_y;
|
||||||
|
|
||||||
|
last_x = 0;
|
||||||
|
last_y = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
|
@ -785,7 +772,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
return false; /*Return `false` because we are not buffering and no more data to read*/
|
return false; /*Return `false` because we are not buffering and no more data to read*/
|
||||||
#endif
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*/
|
*/
|
||||||
#include "../../../../inc/MarlinConfigPre.h"
|
#include "../../../../inc/MarlinConfigPre.h"
|
||||||
|
|
||||||
#if ENABLED(TFT_LITTLE_VGL_UI)
|
#if ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#include "../../../../MarlinCore.h"
|
#include "../../../../MarlinCore.h"
|
||||||
|
|
||||||
|
@ -1900,4 +1900,4 @@ void disp_language_init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // TFT_LITTLE_VGL_UI
|
#endif // TFT_LVGL_UI
|
||||||
|
|
|
@ -541,9 +541,9 @@
|
||||||
#elif MB(CCROBOT_MEEB_3DP)
|
#elif MB(CCROBOT_MEEB_3DP)
|
||||||
#include "stm32f1/pins_CCROBOT_MEEB_3DP.h" // STM32F1 env:STM32F103RC_meeb
|
#include "stm32f1/pins_CCROBOT_MEEB_3DP.h" // STM32F1 env:STM32F103RC_meeb
|
||||||
#elif MB(CHITU3D_V5)
|
#elif MB(CHITU3D_V5)
|
||||||
#include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_v5_gpio_init
|
#include "stm32f1/pins_CHITU3D_V5.h" // STM32F1 env:chitu_f103 env:chitu_v5_gpio_init env:chitu_f103_lvgl
|
||||||
#elif MB(CHITU3D_V6)
|
#elif MB(CHITU3D_V6)
|
||||||
#include "stm32f1/pins_CHITU3D_V6.h" // STM32F1 env:chitu_f103
|
#include "stm32f1/pins_CHITU3D_V6.h" // STM32F1 env:chitu_f103 env:chitu_f103_lvgl
|
||||||
#elif MB(CREALITY_V4)
|
#elif MB(CREALITY_V4)
|
||||||
#include "stm32f1/pins_CREALITY_V4.h" // STM32F1 env:STM32F103RET6_creality
|
#include "stm32f1/pins_CREALITY_V4.h" // STM32F1 env:STM32F103RET6_creality
|
||||||
|
|
||||||
|
|
|
@ -142,6 +142,71 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SPI_FLASH_SIZE 0x200000 // 2MB
|
||||||
|
|
||||||
|
#if ENABLED(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
|
||||||
|
|
||||||
|
//SPI 2
|
||||||
|
#define W25QXX_CS_PIN PB12
|
||||||
|
#define W25QXX_MOSI_PIN PB15
|
||||||
|
#define W25QXX_MISO_PIN PB14
|
||||||
|
#define W25QXX_SCK_PIN PB13
|
||||||
|
|
||||||
|
#define TOUCH_CS_PIN PB7 // SPI1_NSS
|
||||||
|
#define TOUCH_SCK_PIN PA5 // SPI1_SCK
|
||||||
|
#define TOUCH_MISO_PIN PA6 // SPI1_MISO
|
||||||
|
#define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
|
||||||
|
// #define TOUCH_INT_PIN PB6
|
||||||
|
|
||||||
|
#define SPI_TFT_CS_PIN TOUCH_CS_PIN
|
||||||
|
#define SPI_TFT_SCK_PIN TOUCH_SCK_PIN
|
||||||
|
#define SPI_TFT_MISO_PIN TOUCH_MISO_PIN
|
||||||
|
#define SPI_TFT_MOSI_PIN TOUCH_MOSI_PIN
|
||||||
|
#define SPI_TFT_DC_PIN PB6
|
||||||
|
#define SPI_TFT_RST_PIN PF11
|
||||||
|
|
||||||
|
#define LCD_RESET_PIN PF11
|
||||||
|
#define LCD_BACKLIGHT_PIN PD13
|
||||||
|
#define FSMC_CS_PIN PD7
|
||||||
|
#define FSMC_RS_PIN PD11
|
||||||
|
|
||||||
|
#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
|
||||||
|
#define FSMC_DMA_DEV DMA2
|
||||||
|
#define FSMC_DMA_CHANNEL DMA_CH5
|
||||||
|
|
||||||
|
#define LCD_FULL_PIXEL_WIDTH 480
|
||||||
|
#define LCD_PIXEL_OFFSET_X 48
|
||||||
|
#define LCD_FULL_PIXEL_HEIGHT 320
|
||||||
|
#define LCD_PIXEL_OFFSET_Y 48
|
||||||
|
|
||||||
|
#define LCD_PIXEL_HEIGHT 320
|
||||||
|
#define LCD_PIXEL_WIDTH 480
|
||||||
|
|
||||||
|
#define XPT2046_X_CALIBRATION -12316
|
||||||
|
#define XPT2046_Y_CALIBRATION 8981
|
||||||
|
#define XPT2046_X_OFFSET 340
|
||||||
|
#define XPT2046_Y_OFFSET -20
|
||||||
|
|
||||||
|
#define USE_XPT2046 1
|
||||||
|
#define XPT2046_XY_SWAP 0
|
||||||
|
#define XPT2046_X_INV 1
|
||||||
|
#define XPT2046_Y_INV 0
|
||||||
|
|
||||||
|
#define XPT2046_HOR_RES 480
|
||||||
|
#define XPT2046_VER_RES 320
|
||||||
|
#define XPT2046_X_MIN 140
|
||||||
|
#define XPT2046_Y_MIN 200
|
||||||
|
#define XPT2046_X_MAX 1900
|
||||||
|
#define XPT2046_Y_MAX 1900
|
||||||
|
#define XPT2046_AVG 4
|
||||||
|
#define XPT2046_INV 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
|
// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
|
||||||
// We nee to use the SPI2
|
// We nee to use the SPI2
|
||||||
#define ENABLE_SPI2
|
#define ENABLE_SPI2
|
||||||
|
|
|
@ -147,6 +147,71 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SPI_FLASH_SIZE 0x200000 // 2MB
|
||||||
|
|
||||||
|
#if ENABLED(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
|
||||||
|
|
||||||
|
//SPI 2
|
||||||
|
#define W25QXX_CS_PIN PB12
|
||||||
|
#define W25QXX_MOSI_PIN PB15
|
||||||
|
#define W25QXX_MISO_PIN PB14
|
||||||
|
#define W25QXX_SCK_PIN PB13
|
||||||
|
|
||||||
|
#define TOUCH_CS_PIN PB7 // SPI1_NSS
|
||||||
|
#define TOUCH_SCK_PIN PA5 // SPI1_SCK
|
||||||
|
#define TOUCH_MISO_PIN PA6 // SPI1_MISO
|
||||||
|
#define TOUCH_MOSI_PIN PA7 // SPI1_MOSI
|
||||||
|
// #define TOUCH_INT_PIN PB6
|
||||||
|
|
||||||
|
#define SPI_TFT_CS_PIN TOUCH_CS_PIN
|
||||||
|
#define SPI_TFT_SCK_PIN TOUCH_SCK_PIN
|
||||||
|
#define SPI_TFT_MISO_PIN TOUCH_MISO_PIN
|
||||||
|
#define SPI_TFT_MOSI_PIN TOUCH_MOSI_PIN
|
||||||
|
#define SPI_TFT_DC_PIN PB6
|
||||||
|
#define SPI_TFT_RST_PIN PF11
|
||||||
|
|
||||||
|
#define LCD_RESET_PIN PF11
|
||||||
|
#define LCD_BACKLIGHT_PIN PD13
|
||||||
|
#define FSMC_CS_PIN PD7
|
||||||
|
#define FSMC_RS_PIN PD11
|
||||||
|
|
||||||
|
#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
|
||||||
|
#define FSMC_DMA_DEV DMA2
|
||||||
|
#define FSMC_DMA_CHANNEL DMA_CH5
|
||||||
|
|
||||||
|
#define LCD_FULL_PIXEL_WIDTH 480
|
||||||
|
#define LCD_PIXEL_OFFSET_X 48
|
||||||
|
#define LCD_FULL_PIXEL_HEIGHT 320
|
||||||
|
#define LCD_PIXEL_OFFSET_Y 48
|
||||||
|
|
||||||
|
#define LCD_PIXEL_HEIGHT 320
|
||||||
|
#define LCD_PIXEL_WIDTH 480
|
||||||
|
|
||||||
|
#define XPT2046_X_CALIBRATION -12316
|
||||||
|
#define XPT2046_Y_CALIBRATION 8981
|
||||||
|
#define XPT2046_X_OFFSET 340
|
||||||
|
#define XPT2046_Y_OFFSET -20
|
||||||
|
|
||||||
|
#define USE_XPT2046 1
|
||||||
|
#define XPT2046_XY_SWAP 0
|
||||||
|
#define XPT2046_X_INV 1
|
||||||
|
#define XPT2046_Y_INV 0
|
||||||
|
|
||||||
|
#define XPT2046_HOR_RES 480
|
||||||
|
#define XPT2046_VER_RES 320
|
||||||
|
#define XPT2046_X_MIN 140
|
||||||
|
#define XPT2046_Y_MIN 200
|
||||||
|
#define XPT2046_X_MAX 1900
|
||||||
|
#define XPT2046_Y_MAX 1900
|
||||||
|
#define XPT2046_AVG 4
|
||||||
|
#define XPT2046_INV 0
|
||||||
|
#endif
|
||||||
|
|
||||||
// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
|
// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
|
||||||
// so SPI2 is required.
|
// so SPI2 is required.
|
||||||
#define ENABLE_SPI2
|
#define ENABLE_SPI2
|
||||||
|
|
|
@ -231,7 +231,7 @@
|
||||||
|
|
||||||
#endif // HAS_SPI_LCD
|
#endif // HAS_SPI_LCD
|
||||||
|
|
||||||
#elif ENABLED(TFT_LITTLE_VGL_UI)
|
#elif ENABLED(TFT_LVGL_UI)
|
||||||
|
|
||||||
#define FSMC_CS_PIN PD7 // NE4
|
#define FSMC_CS_PIN PD7 // NE4
|
||||||
#define FSMC_RS_PIN PD11 // A0
|
#define FSMC_RS_PIN PD11 // A0
|
||||||
|
|
|
@ -267,7 +267,7 @@ build_flags = ${common.build_flags} -std=gnu++17 -Wno-register
|
||||||
build_unflags = -std=gnu++11
|
build_unflags = -std=gnu++11
|
||||||
src_filter = ${common.default_src_filter} +<src/HAL/SAMD51>
|
src_filter = ${common.default_src_filter} +<src/HAL/SAMD51>
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
|
SoftwareSerialM
|
||||||
Adafruit_SPIFlash=https://github.com/adafruit/Adafruit_SPIFlash/archive/master.zip
|
Adafruit_SPIFlash=https://github.com/adafruit/Adafruit_SPIFlash/archive/master.zip
|
||||||
debug_tool = jlink
|
debug_tool = jlink
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ lib_ignore =
|
||||||
Adafruit NeoPixel
|
Adafruit NeoPixel
|
||||||
SPI
|
SPI
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
|
SoftwareSerialM
|
||||||
|
|
||||||
#
|
#
|
||||||
# STM32F103RC
|
# STM32F103RC
|
||||||
|
@ -385,7 +385,7 @@ lib_deps =
|
||||||
LiquidTWI2@1.2.7
|
LiquidTWI2@1.2.7
|
||||||
Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use
|
Adafruit NeoPixel=https://github.com/ccccmagicboy/Adafruit_NeoPixel#meeb_3dp_use
|
||||||
SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
|
SailfishLCD=https://github.com/mikeshub/SailfishLCD/archive/master.zip
|
||||||
SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
|
SoftwareSerialM
|
||||||
USBComposite for STM32F1@0.91
|
USBComposite for STM32F1@0.91
|
||||||
lib_ignore = SPI
|
lib_ignore = SPI
|
||||||
debug_tool = stlink
|
debug_tool = stlink
|
||||||
|
@ -640,7 +640,7 @@ build_unflags = -std=gnu++11
|
||||||
extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
|
extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin_nano35.py
|
||||||
src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
|
src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
|
||||||
lib_deps = ${common.lib_deps}
|
lib_deps = ${common.lib_deps}
|
||||||
SoftwareSerialM=https://github.com/FYSETC/SoftwareSerialM/archive/master.zip
|
SoftwareSerialM
|
||||||
MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
|
MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
|
||||||
lib_ignore = Adafruit NeoPixel, SPI
|
lib_ignore = Adafruit NeoPixel, SPI
|
||||||
|
|
||||||
|
@ -691,6 +691,17 @@ platform = ${common_stm32f1.platform}
|
||||||
extends = env:chitu_f103
|
extends = env:chitu_f103
|
||||||
build_flags = ${env:chitu_f103.build_flags} -DCHITU_V5_Z_MIN_BUGFIX
|
build_flags = ${env:chitu_f103.build_flags} -DCHITU_V5_Z_MIN_BUGFIX
|
||||||
|
|
||||||
|
#
|
||||||
|
# Chitu boards like Tronxy X5SA (STM32F103ZET6) using TFT LVGL UI
|
||||||
|
#
|
||||||
|
[env:chitu_f103_lvgl]
|
||||||
|
platform = ${common_stm32f1.platform}
|
||||||
|
extends = env:chitu_f103
|
||||||
|
src_filter = ${common.default_src_filter} +<src/HAL/STM32F1>
|
||||||
|
lib_deps = ${common.lib_deps}
|
||||||
|
SoftwareSerialM
|
||||||
|
MKS-LittlevGL=https://github.com/makerbase-mks/MKS-LittlevGL/archive/master.zip
|
||||||
|
|
||||||
#
|
#
|
||||||
# Creality (STM32F103RET6)
|
# Creality (STM32F103RET6)
|
||||||
#
|
#
|
||||||
|
|
Loading…
Reference in a new issue