Browse Source

Clean up LCD conditionals, DWIN

vanilla_fb_2.0.x
Scott Lahteine 4 years ago
committed by Scott Lahteine
parent
commit
c360705e6a
  1. 4
      Marlin/src/MarlinCore.cpp
  2. 4
      Marlin/src/feature/power_monitor.h
  3. 2
      Marlin/src/gcode/bedlevel/abl/G29.cpp
  4. 2
      Marlin/src/gcode/calibrate/G28.cpp
  5. 28
      Marlin/src/inc/Conditionals_LCD.h
  6. 4
      Marlin/src/inc/Conditionals_post.h
  7. 2
      Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp
  8. 28
      Marlin/src/lcd/dwin/dwin_lcd.cpp
  9. 139
      Marlin/src/lcd/dwin/dwin_lcd.h
  10. 0
      Marlin/src/lcd/dwin/e3v2/README.md
  11. 40
      Marlin/src/lcd/dwin/e3v2/dwin.cpp
  12. 4
      Marlin/src/lcd/dwin/e3v2/dwin.h
  13. 8
      Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp
  14. 4
      Marlin/src/lcd/dwin/e3v2/rotary_encoder.h
  15. 2
      Marlin/src/lcd/lcdprint.h
  16. 24
      Marlin/src/lcd/ultralcd.h
  17. 2
      Marlin/src/module/settings.cpp
  18. 2
      Marlin/src/module/temperature.cpp
  19. 27
      Marlin/src/pins/lpc1768/pins_MKS_SBASE.h
  20. 14
      Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h
  21. 2
      Marlin/src/pins/mega/pins_MEGATRONICS.h
  22. 9
      Marlin/src/pins/rambo/pins_EINSY_RETRO.h
  23. 2
      Marlin/src/pins/rambo/pins_MINIRAMBO.h
  24. 11
      Marlin/src/pins/sam/pins_ALLIGATOR_R2.h
  25. 8
      Marlin/src/pins/sam/pins_ARCHIM2.h
  26. 2
      Marlin/src/pins/sam/pins_DUE3DOM.h
  27. 2
      Marlin/src/pins/sam/pins_DUE3DOM_MINI.h
  28. 2
      Marlin/src/pins/sam/pins_RADDS.h
  29. 2
      Marlin/src/pins/sam/pins_RURAMPS4D_11.h
  30. 2
      Marlin/src/pins/sam/pins_RURAMPS4D_13.h
  31. 2
      Marlin/src/pins/sanguino/pins_ANET_10.h
  32. 2
      Marlin/src/pins/teensy2/pins_PRINTRBOARD.h
  33. 2
      Marlin/src/pins/teensy2/pins_TEENSYLU.h
  34. 2
      Marlin/src/sd/cardreader.cpp
  35. 32
      Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp

4
Marlin/src/MarlinCore.cpp

@ -72,9 +72,9 @@
#endif #endif
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "lcd/dwin/dwin.h" #include "lcd/dwin/e3v2/dwin.h"
#include "lcd/dwin/dwin_lcd.h" #include "lcd/dwin/dwin_lcd.h"
#include "lcd/dwin/rotary_encoder.h" #include "lcd/dwin/e3v2/rotary_encoder.h"
#endif #endif
#if ENABLED(IIC_BL24CXX_EEPROM) #if ENABLED(IIC_BL24CXX_EEPROM)

4
Marlin/src/feature/power_monitor.h

@ -89,7 +89,9 @@ public:
#endif #endif
#if HAS_SPI_LCD #if HAS_SPI_LCD
FORCE_INLINE static bool display_enabled() { return flags != 0x00; } #if HAS_GRAPHICAL_LCD && DISABLED(LIGHTWEIGHT_UI)
FORCE_INLINE static bool display_enabled() { return flags != 0x00; }
#endif
#if ENABLED(POWER_MONITOR_CURRENT) #if ENABLED(POWER_MONITOR_CURRENT)
static void draw_current(); static void draw_current();
FORCE_INLINE static bool current_display_enabled() { return TEST(flags, PM_DISP_BIT_I); } FORCE_INLINE static bool current_display_enabled() { return TEST(flags, PM_DISP_BIT_I); }

2
Marlin/src/gcode/bedlevel/abl/G29.cpp

@ -61,7 +61,7 @@
#endif #endif
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "../../../lcd/dwin/dwin.h" #include "../../../lcd/dwin/e3v2/dwin.h"
#endif #endif
#if HAS_MULTI_HOTEND #if HAS_MULTI_HOTEND

2
Marlin/src/gcode/calibrate/G28.cpp

@ -47,7 +47,7 @@
#include "../../lcd/ultralcd.h" #include "../../lcd/ultralcd.h"
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "../../lcd/dwin/dwin.h" #include "../../lcd/dwin/e3v2/dwin.h"
#endif #endif
#if HAS_L64XX // set L6470 absolute position registers to counts #if HAS_L64XX // set L6470 absolute position registers to counts

28
Marlin/src/inc/Conditionals_LCD.h

@ -26,6 +26,7 @@
* Conditionals that need to be set before Configuration_adv.h or pins.h * Conditionals that need to be set before Configuration_adv.h or pins.h
*/ */
// Kinematics
#if ENABLED(MORGAN_SCARA) #if ENABLED(MORGAN_SCARA)
#define IS_SCARA 1 #define IS_SCARA 1
#define IS_KINEMATIC 1 #define IS_KINEMATIC 1
@ -35,10 +36,26 @@
#define IS_CARTESIAN 1 #define IS_CARTESIAN 1
#endif #endif
// MKS_LCD12864 is a variant of MKS_MINI_12864
#if ENABLED(MKS_LCD12864) #if ENABLED(MKS_LCD12864)
#define MKS_MINI_12864 #define MKS_MINI_12864
#endif #endif
/**
* General Flags that may be set below by specific LCDs
*
* DOGLCD : Run a Graphical LCD through U8GLib (with MarlinUI)
* IS_ULTIPANEL : Define LCD_PINS_D5/6/7 for direct-connected "Ultipanel" LCDs
* IS_ULTRA_LCD : Ultra LCD, not necessarily Ultipanel. Used most often with NEWPANEL.
* IS_RRD_SC : Common RRD Smart Controller digital interface pins
* IS_RRD_FG_SC : Common RRD Full Graphical Smart Controller digital interface pins
* U8GLIB_ST7920 : Most common DOGM display SPI interface, supporting a "lightweight" display mode.
* U8GLIB_SH1106 : SH1106 OLED with I2C interface via U8GLib
* IS_U8GLIB_SSD1306 : SSD1306 OLED with I2C interface via U8GLib
* U8GLIB_SSD1309 : SSD1309 OLED with I2C interface via U8GLib
* U8GLIB_ST7565_64128N : ST7565 128x64 LCD with SPI interface via U8GLib
* U8GLIB_LM6059_AF : LM6059 with Hardware SPI via U8GLib
*/
#if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY) #if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
#define MINIPANEL #define MINIPANEL
@ -48,6 +65,11 @@
#define DOGLCD #define DOGLCD
#define IS_ULTIPANEL #define IS_ULTIPANEL
#elif EITHER(DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE)
#define IS_DWIN_MARLINUI 1
#define IS_ULTIPANEL
#elif ENABLED(ZONESTAR_LCD) #elif ENABLED(ZONESTAR_LCD)
#define ADC_KEYPAD #define ADC_KEYPAD
@ -85,7 +107,6 @@
#elif ANY(miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864) #elif ANY(miniVIKI, VIKI2, ELB_FULL_GRAPHIC_CONTROLLER, AZSMZ_12864)
#define IS_ULTRA_LCD
#define DOGLCD #define DOGLCD
#define IS_ULTIPANEL #define IS_ULTIPANEL
@ -234,9 +255,9 @@
// 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106 // 128x64 I2C OLED LCDs - SSD1306/SSD1309/SH1106
#if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106) #if ANY(U8GLIB_SSD1306, U8GLIB_SSD1309, U8GLIB_SH1106)
#define HAS_SSD1306_OLED_I2C 1 #define HAS_U8GLIB_I2C_OLED 1
#endif #endif
#if HAS_SSD1306_OLED_I2C #if HAS_U8GLIB_I2C_OLED
#define IS_ULTRA_LCD #define IS_ULTRA_LCD
#define DOGLCD #define DOGLCD
#endif #endif
@ -402,7 +423,6 @@
#define IS_ULTRA_LCD #define IS_ULTRA_LCD
#define NEWPANEL #define NEWPANEL
#endif #endif
#if ENABLED(IS_ULTRA_LCD) #if ENABLED(IS_ULTRA_LCD)
#define ULTRA_LCD #define ULTRA_LCD
#endif #endif

4
Marlin/src/inc/Conditionals_post.h

@ -2612,14 +2612,14 @@
#ifndef LCD_WIDTH #ifndef LCD_WIDTH
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
#define LCD_WIDTH 21 #define LCD_WIDTH 21
#else #elif HAS_CHARACTER_LCD
#define LCD_WIDTH TERN(ULTIPANEL, 20, 16) #define LCD_WIDTH TERN(ULTIPANEL, 20, 16)
#endif #endif
#endif #endif
#ifndef LCD_HEIGHT #ifndef LCD_HEIGHT
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
#define LCD_HEIGHT 5 #define LCD_HEIGHT 5
#else #elif HAS_CHARACTER_LCD
#define LCD_HEIGHT TERN(ULTIPANEL, 4, 2) #define LCD_HEIGHT TERN(ULTIPANEL, 4, 2)
#endif #endif
#endif #endif

2
Marlin/src/lcd/HD44780/lcdprint_hd44780.cpp

@ -982,7 +982,7 @@ int lcd_put_wchar_max(wchar_t c, pixel_len_t max_length) {
if (max_length < 1) return 0; if (max_length < 1) return 0;
// TODO: fix the '\\' that doesnt exist in the HD44870 // TODO: fix the '\\' that doesn't exist in the HD44870
if (c < 128) { if (c < 128) {
lcd.write((uint8_t)c); lcd.write((uint8_t)c);
return 1; return 1;

28
Marlin/src/lcd/dwin/dwin_lcd.cpp

@ -37,6 +37,9 @@
#include "dwin_lcd.h" #include "dwin_lcd.h"
#include <string.h> // for memset #include <string.h> // for memset
//#define DEBUG_OUT 1
#include "../../core/debug_out.h"
// Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail. // Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail.
// Assume the narrowest (6 pixel) font and 2-byte gb2312-encoded characters. // Assume the narrowest (6 pixel) font and 2-byte gb2312-encoded characters.
uint8_t DWIN_SendBuf[11 + DWIN_WIDTH / 6 * 2] = { 0xAA }; uint8_t DWIN_SendBuf[11 + DWIN_WIDTH / 6 * 2] = { 0xAA };
@ -79,10 +82,8 @@ inline void DWIN_String(size_t &i, const __FlashStringHelper * string) {
// Send the data in the buffer and the packet end // Send the data in the buffer and the packet end
inline void DWIN_Send(size_t &i) { inline void DWIN_Send(size_t &i) {
++i; ++i;
LOOP_L_N(n, i) { MYSERIAL1.write(DWIN_SendBuf[n]); LOOP_L_N(n, i) { MYSERIAL1.write(DWIN_SendBuf[n]); delayMicroseconds(1); }
delayMicroseconds(1); } LOOP_L_N(n, 4) { MYSERIAL1.write(DWIN_BufTail[n]); delayMicroseconds(1); }
LOOP_L_N(n, 4) { MYSERIAL1.write(DWIN_BufTail[n]);
delayMicroseconds(1); }
} }
/*-------------------------------------- System variable function --------------------------------------*/ /*-------------------------------------- System variable function --------------------------------------*/
@ -185,7 +186,6 @@ void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,
DWIN_Send(i); DWIN_Send(i);
} }
//
// Move a screen area // Move a screen area
// mode: 0, circle shift; 1, translation // mode: 0, circle shift; 1, translation
// dir: 0=left, 1=right, 2=up, 3=down // dir: 0=left, 1=right, 2=up, 3=down
@ -230,19 +230,6 @@ void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
DWIN_Send(i); DWIN_Send(i);
} }
void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *string) {
size_t i = 0;
DWIN_Byte(i, 0x11);
DWIN_Byte(i, (widthAdjust * 0x80) | (bShow * 0x40) | size);
DWIN_Word(i, color);
DWIN_Word(i, bColor);
DWIN_Word(i, x);
DWIN_Word(i, y);
DWIN_String(i, string);
DWIN_Send(i);
}
// Draw a positive integer // Draw a positive integer
// bShow: true=display background color; false=don't display background color // bShow: true=display background color; false=don't display background color
// zeroFill: true=zero fill; false=no zero fill // zeroFill: true=zero fill; false=no zero fill
@ -343,8 +330,9 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
DWIN_Send(i); DWIN_Send(i);
} }
// Unzip the JPG picture to virtual display area #1 // Unzip the JPG picture to a virtual display area
// id: picture ID // n: Cache index
// id: Picture ID
void DWIN_JPG_CacheToN(uint8_t n, uint8_t id) { void DWIN_JPG_CacheToN(uint8_t n, uint8_t id) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x25); DWIN_Byte(i, 0x25);

139
Marlin/src/lcd/dwin/dwin_lcd.h

@ -42,70 +42,151 @@
#define DWIN_WIDTH 272 #define DWIN_WIDTH 272
#define DWIN_HEIGHT 480 #define DWIN_HEIGHT 480
/*接收数据解析 返回值:true,接收到数据;false,未接收到数据*/ /*-------------------------------------- System variable function --------------------------------------*/
bool DWIN_ReceiveAnalyze(void);
/*发送当前BUF中的数据以及包尾数据 len:整包数据长度*/ // Handshake (1: Success, 0: Fail)
void DWIN_Send_BufTail(const uint8_t len);
/*----------------------------------------------系统变量函数----------------------------------------------*/
/*握手 1: 握手成功 2: 握手失败*/
bool DWIN_Handshake(void); bool DWIN_Handshake(void);
/*设定背光亮度 luminance:亮度(0x00~0xFF)*/ // Common DWIN startup
void DWIN_Startup(void);
// Set the backlight luminance
// luminance: (0x00-0xFF)
void DWIN_Backlight_SetLuminance(const uint8_t luminance); void DWIN_Backlight_SetLuminance(const uint8_t luminance);
/*设定画面显示方向 dir:0,0°; 1,90°; 2,180°; 3,270°*/ // Set screen display direction
// dir: 0=0°, 1=90°, 2=180°, 3=270°
void DWIN_Frame_SetDir(uint8_t dir); void DWIN_Frame_SetDir(uint8_t dir);
/*更新显示*/ // Update display
void DWIN_UpdateLCD(void); void DWIN_UpdateLCD(void);
/*----------------------------------------------绘图相关函数----------------------------------------------*/ /*---------------------------------------- Drawing functions ----------------------------------------*/
/*画面清屏 color:清屏颜色*/
// Clear screen
// color: Clear screen color
void DWIN_Frame_Clear(const uint16_t color); void DWIN_Frame_Clear(const uint16_t color);
/*画面画线 color:线段颜色 xStart:X起始坐标 yStart:Y起始坐标 xEnd:X终止坐标 yEnd:Y终止坐标*/ // Draw a line
// color: Line segment color
// xStart/yStart: Start point
// xEnd/yEnd: End point
void DWIN_Draw_Line(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd); void DWIN_Draw_Line(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
/*画面画矩形 mode:0,外框;1,填充;2,异或填充 color:颜色 xStart/yStart:矩形左上坐标 xEnd/yEnd:矩形右下坐标*/ // Draw a Horizontal line
// color: Line segment color
// xStart/yStart: Start point
// xLength: Line Length
inline void DWIN_Draw_HLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xLength) {
DWIN_Draw_Line(color, xStart, yStart, xStart + xLength - 1, yStart);
}
// Draw a Vertical line
// color: Line segment color
// xStart/yStart: Start point
// yLength: Line Length
inline void DWIN_Draw_VLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t yLength) {
DWIN_Draw_Line(color, xStart, yStart, xStart, yStart + yLength - 1);
}
// Draw a rectangle
// mode: 0=frame, 1=fill, 2=XOR fill
// color: Rectangle color
// xStart/yStart: upper left point
// xEnd/yEnd: lower right point
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color,
uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd); uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
/*画面区域移动 mode:0,环移;1,平移 dir:0,向左移动;1,向右移动;2,向上移动;3,向下移动 dis:移动距离 // Draw a box
color: xStart/yStart: xEnd/yEnd:*/ // mode: 0=frame, 1=fill, 2=XOR fill
// color: Rectangle color
// xStart/yStart: upper left point
// xSize/ySize: box size
inline void DWIN_Draw_Box(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xSize, uint16_t ySize) {
DWIN_Draw_Rectangle(mode, color, xStart, yStart, xStart + xSize - 1, yStart + ySize - 1);
}
// Move a screen area
// mode: 0, circle shift; 1, translation
// dir: 0=left, 1=right, 2=up, 3=down
// dis: Distance
// color: Fill color
// xStart/yStart: upper left point
// xEnd/yEnd: bottom right point
void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd); uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
/*----------------------------------------------文本相关函数----------------------------------------------*/ /*---------------------------------------- Text related functions ----------------------------------------*/
/*画面显示字符串 widthAdjust:true,自调整字符宽度;false,不调整字符宽度 bShow:true,显示背景色;false,不显示背景色 size:字号大小
color: bColor: x/y: *string:*/ // Draw a string
// widthAdjust: true=self-adjust character width; false=no adjustment
// bShow: true=display background color; false=don't display background color
// size: Font size
// color: Character color
// bColor: Background color
// x/y: Upper-left coordinate of the string
// *string: The string
void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size,
uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string); uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, char *string);
/*画面显示正整数 bShow:true,显示背景色;false,不显示背景色 zeroFill:true,补零;false,不补零 zeroMode:1,无效0显示为0; 0,无效0显示为空格 size:字号大小 class __FlashStringHelper;
color: bColor: iNum: x/y: value:*/
inline void DWIN_Draw_String(bool widthAdjust, bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const __FlashStringHelper *title) {
DWIN_Draw_String(widthAdjust, bShow, size, color, bColor, x, y, (char *)title);
}
// Draw a positive integer
// bShow: true=display background color; false=don't display background color
// zeroFill: true=zero fill; false=no zero fill
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
// size: Font size
// color: Character color
// bColor: Background color
// iNum: Number of digits
// x/y: Upper-left coordinate
// value: Integer value
void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint16_t value); uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint16_t value);
/*画面显示浮点数 bShow:true,显示背景色;false,不显示背景色 zeroFill:true,补零;false,不补零 zeroMode:1,无效0显示为0; 0,无效0显示为空格 size:字号大小 // Draw a floating point number
color: bColor: iNum: fNum: x/y: value:*/ // bShow: true=display background color; false=don't display background color
// zeroFill: true=zero fill; false=no zero fill
// zeroMode: 1=leading 0 displayed as 0; 0=leading 0 displayed as a space
// size: Font size
// color: Character color
// bColor: Background color
// iNum: Number of whole digits
// fNum: Number of decimal digits
// x/y: Upper-left point
// value: Float value
void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color,
uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value); uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
/*----------------------------------------------图片相关函数----------------------------------------------*/ /*---------------------------------------- Picture related functions ----------------------------------------*/
/*jpg图片显示并缓存在#0虚拟显示区 id:图片ID*/
// Draw JPG and cached in #0 virtual display area
// id: Picture ID
void DWIN_JPG_ShowAndCache(const uint8_t id); void DWIN_JPG_ShowAndCache(const uint8_t id);
/*图标显示 libID:图标库ID picID:图标ID x/y:图标左上坐标*/ // Draw an Icon
// libID: Icon library ID
// picID: Icon ID
// x/y: Upper-left point
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y); void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y);
/*jpg图片解压到#1虚拟显示区 id:图片ID*/ // Unzip the JPG picture to a virtual display area
// n: Cache index
// id: Picture ID
void DWIN_JPG_CacheToN(uint8_t n, uint8_t id); void DWIN_JPG_CacheToN(uint8_t n, uint8_t id);
/*jpg图片解压到#1虚拟显示区 id:图片ID*/ // Unzip the JPG picture to virtual display area #1
// id: Picture ID
inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); } inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); }
/*从虚拟显示区复制区域至当前画面 cacheID:虚拟区号 xStart/yStart:虚拟区左上坐标 xEnd/yEnd:虚拟区右下坐标 x/y:当前画面粘贴坐标*/ // Copy area from virtual display area to current screen
// cacheID: virtual area number
// xStart/yStart: Upper-left of virtual area
// xEnd/yEnd: Lower-right of virtual area
// x/y: Screen paste point
void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, void DWIN_Frame_AreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart,
uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y); uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);

0
Marlin/src/lcd/dwin/README.md → Marlin/src/lcd/dwin/e3v2/README.md

40
Marlin/src/lcd/dwin/dwin.cpp → Marlin/src/lcd/dwin/e3v2/dwin.cpp

@ -24,7 +24,7 @@
* DWIN by Creality3D * DWIN by Creality3D
*/ */
#include "../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
@ -38,35 +38,35 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "../fontutils.h" #include "../../fontutils.h"
#include "../ultralcd.h" #include "../../ultralcd.h"
#include "../../sd/cardreader.h" #include "../../../sd/cardreader.h"
#include "../../MarlinCore.h" #include "../../../MarlinCore.h"
#include "../../core/serial.h" #include "../../../core/serial.h"
#include "../../core/macros.h" #include "../../../core/macros.h"
#include "../../gcode/queue.h" #include "../../../gcode/queue.h"
#include "../../feature/powerloss.h" #include "../../../feature/powerloss.h"
#include "../../feature/babystep.h" #include "../../../feature/babystep.h"
#include "../../module/settings.h" #include "../../../module/settings.h"
#include "../../module/temperature.h" #include "../../../module/temperature.h"
#include "../../module/printcounter.h" #include "../../../module/printcounter.h"
#include "../../module/motion.h" #include "../../../module/motion.h"
#include "../../module/planner.h" #include "../../../module/planner.h"
#if ENABLED(HOST_ACTION_COMMANDS) #if ENABLED(HOST_ACTION_COMMANDS)
#include "../../feature/host_actions.h" #include "../../../feature/host_actions.h"
#endif #endif
#if HAS_ONESTEP_LEVELING #if HAS_ONESTEP_LEVELING
#include "../../feature/bedlevel/bedlevel.h" #include "../../../feature/bedlevel/bedlevel.h"
#endif #endif
#if HAS_BED_PROBE #if HAS_BED_PROBE
#include "../../module/probe.h" #include "../../../module/probe.h"
#endif #endif
#ifndef MACHINE_SIZE #ifndef MACHINE_SIZE
@ -1532,7 +1532,7 @@ void update_variable(void) {
#define strcasecmp_P(a, b) strcasecmp((a), (b)) #define strcasecmp_P(a, b) strcasecmp((a), (b))
#endif #endif
inline void make_name_without_ext(char *dst, char *src, int maxlen=MENU_CHAR_LIMIT) { inline void make_name_without_ext(char *dst, char *src, size_t maxlen=MENU_CHAR_LIMIT) {
char * const name = card.longest_filename(); char * const name = card.longest_filename();
size_t pos = strlen(name); // index of ending nul size_t pos = strlen(name); // index of ending nul
@ -2137,7 +2137,7 @@ inline void Draw_Move_Menu() {
LOOP_L_N(i, MROWS) Draw_Menu_Line(i + 1, ICON_MoveX + i); LOOP_L_N(i, MROWS) Draw_Menu_Line(i + 1, ICON_MoveX + i);
} }
#include "../../libs/buzzer.h" #include "../../../libs/buzzer.h"
void HMI_AudioFeedback(const bool success=true) { void HMI_AudioFeedback(const bool success=true) {
if (success) { if (success) {

4
Marlin/src/lcd/dwin/dwin.h → Marlin/src/lcd/dwin/e3v2/dwin.h

@ -25,9 +25,9 @@
* DWIN by Creality3D * DWIN by Creality3D
*/ */
#include "dwin_lcd.h" #include "../dwin_lcd.h"
#include "rotary_encoder.h" #include "rotary_encoder.h"
#include "../../libs/BL24CXX.h" #include "../../../libs/BL24CXX.h"
#include <stdint.h> #include <stdint.h>

8
Marlin/src/lcd/dwin/rotary_encoder.cpp → Marlin/src/lcd/dwin/e3v2/rotary_encoder.cpp

@ -30,17 +30,17 @@
****************************************************************************** ******************************************************************************
**/ **/
#include "../../inc/MarlinConfigPre.h" #include "../../../inc/MarlinConfigPre.h"
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "rotary_encoder.h" #include "rotary_encoder.h"
#include "../../MarlinCore.h" #include "../../../MarlinCore.h"
#include "../../HAL/shared/Delay.h" #include "../../../HAL/shared/Delay.h"
#if HAS_BUZZER #if HAS_BUZZER
#include "../../libs/buzzer.h" #include "../../../libs/buzzer.h"
#endif #endif
#include <stdlib.h> #include <stdlib.h>

4
Marlin/src/lcd/dwin/rotary_encoder.h → Marlin/src/lcd/dwin/e3v2/rotary_encoder.h

@ -31,8 +31,8 @@
****************************************************************************** ******************************************************************************
**/ **/
#include "../../inc/MarlinConfig.h" #include "../../../inc/MarlinConfig.h"
#include "../../MarlinCore.h" #include "../../../MarlinCore.h"
/*********************** Encoder Set ***********************/ /*********************** Encoder Set ***********************/

2
Marlin/src/lcd/lcdprint.h

@ -79,7 +79,7 @@
#define SETCURSOR(col, row) lcd_moveto((col) * (MENU_FONT_WIDTH), ((row) + 1) * (MENU_FONT_HEIGHT)) #define SETCURSOR(col, row) lcd_moveto((col) * (MENU_FONT_WIDTH), ((row) + 1) * (MENU_FONT_HEIGHT))
#define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), ((row) + 1) * (MENU_FONT_HEIGHT)) #define SETCURSOR_RJ(len, row) lcd_moveto(LCD_PIXEL_WIDTH - (len) * (MENU_FONT_WIDTH), ((row) + 1) * (MENU_FONT_HEIGHT))
#else #elif HAS_CHARACTER_LCD
#define _UxGT(a) a #define _UxGT(a) a
typedef uint8_t lcd_uint_t; typedef uint8_t lcd_uint_t;

24
Marlin/src/lcd/ultralcd.h

@ -312,16 +312,18 @@ public:
static void media_changed(const uint8_t old_stat, const uint8_t stat); static void media_changed(const uint8_t old_stat, const uint8_t stat);
#endif #endif
#if ENABLED(DWIN_CREALITY_LCD)
static void refresh();
#else
FORCE_INLINE static void refresh() {
TERN_(HAS_SPI_LCD, refresh(LCDVIEW_CLEAR_CALL_REDRAW));
}
#endif
#if HAS_SPI_LCD #if HAS_SPI_LCD
static bool detected(); static bool detected();
static void init_lcd(); static void init_lcd();
FORCE_INLINE static void refresh() { refresh(LCDVIEW_CLEAR_CALL_REDRAW); }
#else #else
#if ENABLED(DWIN_CREALITY_LCD)
static void refresh();
#else
static inline void refresh() {}
#endif
static inline bool detected() { return true; } static inline bool detected() { return true; }
static inline void init_lcd() {} static inline void init_lcd() {}
#endif #endif
@ -403,14 +405,10 @@ public:
#if HAS_GRAPHICAL_LCD #if HAS_GRAPHICAL_LCD
static bool drawing_screen, first_page;
static void set_font(const MarlinFont font_nr); static void set_font(const MarlinFont font_nr);
#else #else
static constexpr bool drawing_screen = false, first_page = true;
static void set_custom_characters(const HD44780CharSet screen_charset=CHARSET_INFO); static void set_custom_characters(const HD44780CharSet screen_charset=CHARSET_INFO);
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
@ -460,6 +458,12 @@ public:
#endif #endif
#if HAS_GRAPHICAL_LCD
static bool drawing_screen, first_page;
#else
static constexpr bool drawing_screen = false, first_page = true;
#endif
static bool get_blink(); static bool get_blink();
static void kill_screen(PGM_P const lcd_error, PGM_P const lcd_component); static void kill_screen(PGM_P const lcd_error, PGM_P const lcd_component);
static void draw_kill_screen(); static void draw_kill_screen();

2
Marlin/src/module/settings.cpp

@ -52,7 +52,7 @@
#include "temperature.h" #include "temperature.h"
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/dwin/dwin.h" #include "../lcd/dwin/e3v2/dwin.h"
#endif #endif
#include "../lcd/ultralcd.h" #include "../lcd/ultralcd.h"

2
Marlin/src/module/temperature.cpp

@ -37,7 +37,7 @@
#include "../lcd/ultralcd.h" #include "../lcd/ultralcd.h"
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/dwin/dwin.h" #include "../lcd/dwin/e3v2/dwin.h"
#endif #endif
#if ENABLED(EXTENSIBLE_UI) #if ENABLED(EXTENSIBLE_UI)

27
Marlin/src/pins/lpc1768/pins_MKS_SBASE.h

@ -289,20 +289,21 @@
#define E0_CS_PIN P2_11 #define E0_CS_PIN P2_11
#define E1_CS_PIN P4_28 #define E1_CS_PIN P4_28
// Hardware SPI is on EXP2. See if you can make it work: // Hardware SPI is on EXP2. See if you can make it work:
// https://github.com/makerbase-mks/MKS-SBASE/issues/25 // https://github.com/makerbase-mks/MKS-SBASE/issues/25
#define TMC_USE_SW_SPI #define TMC_USE_SW_SPI
#if ENABLED(TMC_USE_SW_SPI) #if ENABLED(TMC_USE_SW_SPI)
#ifndef TMC_SW_MOSI #ifndef TMC_SW_MOSI
#define TMC_SW_MOSI P0_03 // AUX1 #define TMC_SW_MOSI P0_03 // AUX1
#endif #endif
#ifndef TMC_SW_MISO #ifndef TMC_SW_MISO
#define TMC_SW_MISO P0_02 // AUX1 #define TMC_SW_MISO P0_02 // AUX1
#endif #endif
#ifndef TMC_SW_SCK #ifndef TMC_SW_SCK
#define TMC_SW_SCK P0_26 // TH4 #define TMC_SW_SCK P0_26 // TH4
#endif
#endif #endif
#endif
#endif #endif
#if MB(MKS_SBASE) && HAS_TMC_UART #if MB(MKS_SBASE) && HAS_TMC_UART

14
Marlin/src/pins/lpc1769/pins_SMOOTHIEBOARD.h

@ -125,16 +125,16 @@
// EXP1 Pins // EXP1 Pins
#define BEEPER_PIN P1_31 // EXP1 Pin 1 #define BEEPER_PIN P1_31 // EXP1 Pin 1
#define BTN_ENC P1_30 // EXP1 Pin 2 #define BTN_ENC P1_30 // EXP1 Pin 2
#define LCD_PINS_ENABLE P0_18 // EXP1 Pin 3 (MOSI) #define LCD_PINS_ENABLE P0_18 // EXP1 Pin 3 (MOSI)
#define LCD_PINS_RS P0_16 // EXP1 Pin 4 (CS) #define LCD_PINS_RS P0_16 // EXP1 Pin 4 (CS)
#define LCD_PINS_D4 P0_15 // EXP1 Pin 5 (SCK) #define LCD_PINS_D4 P0_15 // EXP1 Pin 5 (SCK)
// EXP2 Pins // EXP2 Pins
#define BTN_EN2 P3_26 // EXP2 Pin 3 #define BTN_EN2 P3_26 // EXP2 Pin 3
#define BTN_EN1 P3_25 // EXP2 Pin 5 #define BTN_EN1 P3_25 // EXP2 Pin 5
/* /*
SD Support SD Support
For the RRD GLCD it CANNOT share the same SPI as the LCD so it must be For the RRD GLCD it CANNOT share the same SPI as the LCD so it must be
hooked up to the onboard SDCard SPI and use a spare pin for the SDCS. hooked up to the onboard SDCard SPI and use a spare pin for the SDCS.
Also note that an external SDCard sharing the SPI port with the Also note that an external SDCard sharing the SPI port with the
@ -145,11 +145,11 @@
*/ */
#define MISO_PIN P0_08 // EXP2 Pin 1 (PB3, SD_MISO) #define MISO_PIN P0_08 // EXP2 Pin 1 (PB3, SD_MISO)
#define SCK_PIN P0_07 // EXP2 Pin 2 (SD_SCK) #define SCK_PIN P0_07 // EXP2 Pin 2 (SD_SCK)
#define SS_PIN P0_28 // EXP2 Pin 4 (SD_CSEL, SD_CS) #define SS_PIN P0_28 // EXP2 Pin 4 (SD_CSEL, SD_CS)
#define MOSI_PIN P0_09 // EXP2 Pin 6 (PB2, SD_MOSI) #define MOSI_PIN P0_09 // EXP2 Pin 6 (PB2, SD_MOSI)
#define SD_DETECT_PIN P0_27 // EXP2 Pin 7 (SD_CD, SD_DET) #define SD_DETECT_PIN P0_27 // EXP2 Pin 7 (SD_CD, SD_DET)
#else #else
#error "Marlin's Smoothieboard support cannot drive your LCD." #error "Marlin's Smoothieboard support cannot drive your LCD."
#endif #endif

2
Marlin/src/pins/mega/pins_MEGATRONICS.h

@ -124,7 +124,7 @@
#define SD_DETECT_PIN -1 // RAMPS doesn't use this #define SD_DETECT_PIN -1 // RAMPS doesn't use this
#endif // HAS_SPI_LCD && NEWPANEL #endif // ULTRA_LCD && NEWPANEL
// //
// M3/M4/M5 - Spindle/Laser Control // M3/M4/M5 - Spindle/Laser Control

9
Marlin/src/pins/rambo/pins_EINSY_RETRO.h

@ -166,11 +166,11 @@
// //
// LCD / Controller // LCD / Controller
// //
#if HAS_SPI_LCD || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) #if ANY(HAS_SPI_LCD, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE)
#define KILL_PIN 32 #define KILL_PIN 32
#if ENABLED(ULTIPANEL) || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) #if ANY(ULTIPANEL, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE)
#if ENABLED(CR10_STOCKDISPLAY) #if ENABLED(CR10_STOCKDISPLAY)
#define LCD_PINS_RS 85 #define LCD_PINS_RS 85
@ -194,5 +194,6 @@
#define SD_DETECT_PIN 15 #define SD_DETECT_PIN 15
#endif // ULTIPANEL || TOUCH_UI_ULTIPANEL #endif // ULTIPANEL || TOUCH_UI_ULTIPANEL || TOUCH_UI_FTDI_EVE
#endif // HAS_SPI_LCD
#endif // HAS_SPI_LCD || TOUCH_UI_ULTIPANEL || TOUCH_UI_FTDI_EVE

2
Marlin/src/pins/rambo/pins_MINIRAMBO.h

@ -189,4 +189,4 @@
#endif // ULTIPANEL || TOUCH_UI_ULTIPANEL #endif // ULTIPANEL || TOUCH_UI_ULTIPANEL
#endif // HAS_SPI_LCD #endif // HAS_SPI_LCD || TOUCH_UI_ULTIPANEL

11
Marlin/src/pins/sam/pins_ALLIGATOR_R2.h

@ -144,17 +144,16 @@
// LCD / Controller // LCD / Controller
// //
#if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
#define LCD_PINS_RS 18 #define LCD_PINS_RS 18
#define LCD_PINS_ENABLE 15 #define LCD_PINS_ENABLE 15
#define LCD_PINS_D4 19 #define LCD_PINS_D4 19
#define BEEPER_PIN 64 #define BEEPER_PIN 64
#undef UI_VOLTAGE_LEVEL
#define UI_VOLTAGE_LEVEL 1
#endif
#if ENABLED(NEWPANEL)
#define BTN_EN1 14 #define BTN_EN1 14
#define BTN_EN2 16 #define BTN_EN2 16
#define BTN_ENC 17 #define BTN_ENC 17
#endif
#undef UI_VOLTAGE_LEVEL
#define UI_VOLTAGE_LEVEL 1
#endif // REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER

8
Marlin/src/pins/sam/pins_ARCHIM2.h

@ -237,7 +237,7 @@
// //
// LCD / Controller // LCD / Controller
// //
#if HAS_SPI_LCD || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) #if ANY(HAS_SPI_LCD, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE)
#define BEEPER_PIN 23 // D24 PA15_CTS1 #define BEEPER_PIN 23 // D24 PA15_CTS1
#define LCD_PINS_RS 17 // D17 PA12_RXD1 #define LCD_PINS_RS 17 // D17 PA12_RXD1
#define LCD_PINS_ENABLE 24 // D23 PA14_RTS1 #define LCD_PINS_ENABLE 24 // D23 PA14_RTS1
@ -248,10 +248,10 @@
#define SD_DETECT_PIN 2 // D2 PB25_TIOA0 #define SD_DETECT_PIN 2 // D2 PB25_TIOA0
#if ENABLED(ULTIPANEL) || TOUCH_UI_ULTIPANEL || ENABLED(TOUCH_UI_FTDI_EVE) #if ANY(ULTIPANEL, TOUCH_UI_ULTIPANEL, TOUCH_UI_FTDI_EVE)
// Buttons on AUX-2 // Buttons on AUX-2
#define BTN_EN1 60 // D60 PA3_TIOB1 #define BTN_EN1 60 // D60 PA3_TIOB1
#define BTN_EN2 13 // D13 PB27_TIOB0 #define BTN_EN2 13 // D13 PB27_TIOB0
#define BTN_ENC 16 // D16 PA13_TXD1 // the click #define BTN_ENC 16 // D16 PA13_TXD1 // the click
#endif // ULTIPANEL || TOUCH_UI_ULTIPANEL #endif
#endif // HAS_SPI_LCD #endif

2
Marlin/src/pins/sam/pins_DUE3DOM.h

@ -147,7 +147,7 @@
#define SDSS 4 #define SDSS 4
#define SD_DETECT_PIN 14 #define SD_DETECT_PIN 14
#elif HAS_SSD1306_OLED_I2C #elif HAS_U8GLIB_I2C_OLED
#define BTN_EN1 50 #define BTN_EN1 50
#define BTN_EN2 52 #define BTN_EN2 52

2
Marlin/src/pins/sam/pins_DUE3DOM_MINI.h

@ -139,7 +139,7 @@
#define SDSS 4 #define SDSS 4
#define SD_DETECT_PIN 14 #define SD_DETECT_PIN 14
#elif HAS_SSD1306_OLED_I2C #elif HAS_U8GLIB_I2C_OLED
#define BTN_EN1 50 #define BTN_EN1 50
#define BTN_EN2 52 #define BTN_EN2 52

2
Marlin/src/pins/sam/pins_RADDS.h

@ -266,7 +266,7 @@
#define SDSS 10 #define SDSS 10
#define SD_DETECT_PIN 14 #define SD_DETECT_PIN 14
#elif HAS_SSD1306_OLED_I2C #elif HAS_U8GLIB_I2C_OLED
#define BTN_EN1 50 #define BTN_EN1 50
#define BTN_EN2 52 #define BTN_EN2 52

2
Marlin/src/pins/sam/pins_RURAMPS4D_11.h

@ -221,7 +221,7 @@
#define LCD_PINS_RS 52 #define LCD_PINS_RS 52
#define LCD_PINS_ENABLE 53 #define LCD_PINS_ENABLE 53
#elif HAS_SSD1306_OLED_I2C #elif HAS_U8GLIB_I2C_OLED
#define BEEPER_PIN 62 #define BEEPER_PIN 62
#define LCD_SDSS 10 #define LCD_SDSS 10

2
Marlin/src/pins/sam/pins_RURAMPS4D_13.h

@ -207,7 +207,7 @@
#define LCD_PINS_RS 52 #define LCD_PINS_RS 52
#define LCD_PINS_ENABLE 53 #define LCD_PINS_ENABLE 53
#elif HAS_SSD1306_OLED_I2C #elif HAS_U8GLIB_I2C_OLED
#define BEEPER_PIN 62 #define BEEPER_PIN 62
#define LCD_SDSS 10 #define LCD_SDSS 10

2
Marlin/src/pins/sanguino/pins_ANET_10.h

@ -163,7 +163,7 @@
#define LCD_PINS_D6 16 #define LCD_PINS_D6 16
#define LCD_PINS_D7 17 #define LCD_PINS_D7 17
#define ADC_KEYPAD_PIN 1 #define ADC_KEYPAD_PIN 1
#elif EITHER(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER, ANET_FULL_GRAPHICS_LCD) #elif EITHER(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
// Pin definitions for the Anet A6 Full Graphics display and the RepRapDiscount Full Graphics // Pin definitions for the Anet A6 Full Graphics display and the RepRapDiscount Full Graphics
// display using an adapter board // https://go.aisler.net/benlye/anet-lcd-adapter/pcb // display using an adapter board // https://go.aisler.net/benlye/anet-lcd-adapter/pcb
// See below for alternative pin definitions for use with https://www.thingiverse.com/thing:2103748 // See below for alternative pin definitions for use with https://www.thingiverse.com/thing:2103748

2
Marlin/src/pins/teensy2/pins_PRINTRBOARD.h

@ -166,4 +166,4 @@
#endif #endif
#endif // HAS_SPI_LCD && NEWPANEL #endif // ULTRA_LCD && NEWPANEL

2
Marlin/src/pins/teensy2/pins_TEENSYLU.h

@ -155,7 +155,7 @@
#define SD_DETECT_PIN -1 #define SD_DETECT_PIN -1
#endif // HAS_SPI_LCD && NEWPANEL #endif // ULTRA_LCD && NEWPANEL
// //
// M3/M4/M5 - Spindle/Laser Control // M3/M4/M5 - Spindle/Laser Control

2
Marlin/src/sd/cardreader.cpp

@ -32,7 +32,7 @@
#include "../lcd/ultralcd.h" #include "../lcd/ultralcd.h"
#if ENABLED(DWIN_CREALITY_LCD) #if ENABLED(DWIN_CREALITY_LCD)
#include "../lcd/dwin/dwin.h" #include "../lcd/dwin/e3v2/dwin.h"
#endif #endif
#include "../module/planner.h" // for synchronize #include "../module/planner.h" // for synchronize

32
Marlin/src/sd/usb_flashdrive/Sd2Card_FlashDrive.cpp

@ -94,9 +94,7 @@ static_assert(USB_INTR_PIN != -1, "USB_INTR_PIN must be defined");
#include "Sd2Card_FlashDrive.h" #include "Sd2Card_FlashDrive.h"
#if HAS_DISPLAY #include "../../lcd/ultralcd.h"
#include "../../lcd/ultralcd.h"
#endif
static enum { static enum {
UNINITIALIZED, UNINITIALIZED,
@ -116,9 +114,7 @@ bool Sd2Card::usbStartup() {
SERIAL_ECHOPGM("Starting USB host..."); SERIAL_ECHOPGM("Starting USB host...");
if (!UHS_START) { if (!UHS_START) {
SERIAL_ECHOLNPGM(" failed."); SERIAL_ECHOLNPGM(" failed.");
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) LCD_MESSAGEPGM(MSG_MEDIA_USB_FAILED);
LCD_MESSAGEPGM(MSG_MEDIA_USB_FAILED);
#endif
return false; return false;
} }
@ -213,9 +209,7 @@ void Sd2Card::idle() {
#if USB_DEBUG >= 1 #if USB_DEBUG >= 1
SERIAL_ECHOLNPGM("Waiting for media"); SERIAL_ECHOLNPGM("Waiting for media");
#endif #endif
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) LCD_MESSAGEPGM(MSG_MEDIA_WAITING);
LCD_MESSAGEPGM(MSG_MEDIA_WAITING);
#endif
GOTO_STATE_AFTER_DELAY(state, 2000); GOTO_STATE_AFTER_DELAY(state, 2000);
} }
break; break;
@ -229,11 +223,9 @@ void Sd2Card::idle() {
#if USB_DEBUG >= 1 #if USB_DEBUG >= 1
SERIAL_ECHOLNPGM("USB device removed"); SERIAL_ECHOLNPGM("USB device removed");
#endif #endif
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) if (state != MEDIA_READY)
if (state != MEDIA_READY) LCD_MESSAGEPGM(MSG_MEDIA_USB_REMOVED);
LCD_MESSAGEPGM(MSG_MEDIA_USB_REMOVED); GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0);
#endif
GOTO_STATE_AFTER_DELAY( WAIT_FOR_DEVICE, 0 );
} }
else if (state > WAIT_FOR_LUN && !bulk.LUNIsGood(0)) { else if (state > WAIT_FOR_LUN && !bulk.LUNIsGood(0)) {
@ -241,17 +233,13 @@ void Sd2Card::idle() {
#if USB_DEBUG >= 1 #if USB_DEBUG >= 1
SERIAL_ECHOLNPGM("Media removed"); SERIAL_ECHOLNPGM("Media removed");
#endif #endif
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) LCD_MESSAGEPGM(MSG_MEDIA_REMOVED);
LCD_MESSAGEPGM(MSG_MEDIA_REMOVED); GOTO_STATE_AFTER_DELAY(WAIT_FOR_DEVICE, 0);
#endif
GOTO_STATE_AFTER_DELAY( WAIT_FOR_DEVICE, 0 );
} }
else if (task_state == UHS_STATE(ERROR)) { else if (task_state == UHS_STATE(ERROR)) {
#if EITHER(ULTRA_LCD, EXTENSIBLE_UI) LCD_MESSAGEPGM(MSG_MEDIA_READ_ERROR);
LCD_MESSAGEPGM(MSG_MEDIA_READ_ERROR); GOTO_STATE_AFTER_DELAY(MEDIA_ERROR, 0);
#endif
GOTO_STATE_AFTER_DELAY( MEDIA_ERROR, 0 );
} }
} }
} }

Loading…
Cancel
Save