diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.cpp b/Marlin/src/lcd/e3v2/common/dwin_api.cpp index ebd56ca6ab..535bfae666 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.cpp +++ b/Marlin/src/lcd/e3v2/common/dwin_api.cpp @@ -126,12 +126,13 @@ void DWIN_Frame_Clear(const uint16_t color) { DWIN_Send(i); } -// Draw a point -// color: point color -// width: point width 0x01-0x0F -// height: point height 0x01-0x0F -// x,y: upper left point -void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) { +#if DISABLED(TJC_DISPLAY) + // Draw a point + // color: point color + // width: point width 0x01-0x0F + // height: point height 0x01-0x0F + // x,y: upper left point + void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) { size_t i = 0; DWIN_Byte(i, 0x02); DWIN_Word(i, color); @@ -140,7 +141,8 @@ void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, DWIN_Word(i, x); DWIN_Word(i, y); DWIN_Send(i); -} + } +#endif // Draw a line // color: Line segment color diff --git a/Marlin/src/lcd/e3v2/common/dwin_api.h b/Marlin/src/lcd/e3v2/common/dwin_api.h index 88697dccb5..ef4647a6b4 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_api.h +++ b/Marlin/src/lcd/e3v2/common/dwin_api.h @@ -112,7 +112,14 @@ void DWIN_Frame_Clear(const uint16_t color); // width: point width 0x01-0x0F // height: point height 0x01-0x0F // x,y: upper left point -void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y); +#if ENABLED(TJC_DISPLAY) + void DWIN_Draw_Box(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xSize, uint16_t ySize); + inline void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) { + DWIN_Draw_Box(1, color, x, y, 1, 1); + } +#else + void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y); +#endif // Draw a line // color: Line segment color diff --git a/Marlin/src/lcd/e3v2/common/dwin_font.h b/Marlin/src/lcd/e3v2/common/dwin_font.h index fec7447de3..cc6d512fb9 100644 --- a/Marlin/src/lcd/e3v2/common/dwin_font.h +++ b/Marlin/src/lcd/e3v2/common/dwin_font.h @@ -28,13 +28,15 @@ typedef uint8_t fontid_t; * 0x00=6*12 0x01=8*16 0x02=10*20 0x03=12*24 0x04=14*28 * 0x05=16*32 0x06=20*40 0x07=24*48 0x08=28*56 0x09=32*64 */ -#define font6x12 (fontid_t)0x00 +#if DISABLED(TJC_DISPLAY) + #define font6x12 (fontid_t)0x00 + #define font20x40 (fontid_t)0x06 + #define font24x48 (fontid_t)0x07 + #define font28x56 (fontid_t)0x08 + #define font32x64 (fontid_t)0x09 +#endif #define font8x16 (fontid_t)0x01 #define font10x20 (fontid_t)0x02 #define font12x24 (fontid_t)0x03 #define font14x28 (fontid_t)0x04 #define font16x32 (fontid_t)0x05 -#define font20x40 (fontid_t)0x06 -#define font24x48 (fontid_t)0x07 -#define font28x56 (fontid_t)0x08 -#define font32x64 (fontid_t)0x09 diff --git a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp index b58a4abded..5bf032ffa2 100644 --- a/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwin_lcd.cpp @@ -131,10 +131,10 @@ void DACAI_ICON_Show(uint16_t x, uint16_t y, uint16_t addr) { } void DWIN_ICON_Show(uint16_t x, uint16_t y, uint16_t addr) { - #if ENABLED(HAS_DACAI) || DISABLED(HAS_DWIN) + #if ENABLED(DACAI_DISPLAY) || DISABLED(DWIN_DISPLAY) DACAI_ICON_Show(x, y, addr); #endif - #if ENABLED(HAS_DWIN) || DISABLED(HAS_DACAI) + #if ENABLED(DWIN_DISPLAY) || DISABLED(DACAI_DISPLAY) DWIN_ICON_Show(0, 0, 1, x, y, addr); #endif } diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.cpp b/Marlin/src/lcd/e3v2/proui/dwinui.cpp index 5e94bfc026..a1e246932e 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.cpp +++ b/Marlin/src/lcd/e3v2/proui/dwinui.cpp @@ -1,8 +1,8 @@ /** * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * Version: 3.20.1 - * Date: 2022/10/25 + * Version: 3.21.1 + * Date: 2023/03/21 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -51,16 +51,18 @@ void DWINUI::setFont(fontid_t fid) { fontid = fid; } // Get font character width uint8_t DWINUI::fontWidth(fontid_t fid) { switch (fid) { + #if DISABLED(TJC_DISPLAY) case font6x12 : return 6; + case font20x40: return 20; + case font24x48: return 24; + case font28x56: return 28; + case font32x64: return 32; + #endif case font8x16 : return 8; case font10x20: return 10; case font12x24: return 12; case font14x28: return 14; case font16x32: return 16; - case font20x40: return 20; - case font24x48: return 24; - case font28x56: return 28; - case font32x64: return 32; default: return 0; } } @@ -68,16 +70,18 @@ uint8_t DWINUI::fontWidth(fontid_t fid) { // Get font character height uint8_t DWINUI::fontHeight(fontid_t fid) { switch (fid) { + #if DISABLED(TJC_DISPLAY) case font6x12 : return 12; + case font20x40: return 40; + case font24x48: return 48; + case font28x56: return 56; + case font32x64: return 64; + #endif case font8x16 : return 16; case font10x20: return 20; case font12x24: return 24; case font14x28: return 28; case font16x32: return 32; - case font20x40: return 40; - case font24x48: return 48; - case font28x56: return 56; - case font32x64: return 64; default: return 0; } } @@ -252,15 +256,13 @@ void DWINUI::Draw_Circle(uint16_t color, uint16_t x, uint16_t y, uint8_t r) { // y: ordinate of the center of the circle // r: circle radius void DWINUI::Draw_FillCircle(uint16_t bcolor, uint16_t x,uint16_t y,uint8_t r) { - int a = 0, b = 0; - while (a <= b) { - b = SQRT(sq(r) - sq(a)); // b=sqrt(r*r-a*a); - if (a == 0) b--; - DWIN_Draw_Line(bcolor, x-b,y-a,x+b,y-a); - DWIN_Draw_Line(bcolor, x-a,y-b,x+a,y-b); - DWIN_Draw_Line(bcolor, x-b,y+a,x+b,y+a); + DWIN_Draw_Line(bcolor, x-r,y,x+r,y); + uint16_t b = 1; + while (b <= r) { + uint16_t a = SQRT(sq(r) - sq(b)); DWIN_Draw_Line(bcolor, x-a,y+b,x+a,y+b); - a++; + DWIN_Draw_Line(bcolor, x-a,y-b,x+a,y-b); + b+=TERN(TJC_DISPLAY,2,1); } } diff --git a/Marlin/src/lcd/e3v2/proui/dwinui.h b/Marlin/src/lcd/e3v2/proui/dwinui.h index 12800483f5..87f101e501 100644 --- a/Marlin/src/lcd/e3v2/proui/dwinui.h +++ b/Marlin/src/lcd/e3v2/proui/dwinui.h @@ -2,7 +2,7 @@ * DWIN Enhanced implementation for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) * Version: 3.21.1 - * Date: 2022/12/02 + * Date: 2023/03/21 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp index 0bca974f50..80da04e4b1 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.cpp +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.cpp @@ -1,8 +1,8 @@ /** * Mesh Viewer for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * version: 3.15.1 - * Date: 2022/10/25 + * version: 4.1.1 + * Date: 2023/03/21 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -48,6 +48,12 @@ uint8_t rmax; // Maximum radius #define px(xp) (margin + (xp)*(width)/(sizex - 1)) #define py(yp) (30 + DWIN_WIDTH - margin - (yp)*(width)/(sizey - 1)) +#if ENABLED(TJC_DISPLAY) + #define meshfont font8x16 +#else + #define meshfont font6x12 +#endif + void MeshViewerClass::DrawMeshGrid(const uint8_t csizex, const uint8_t csizey) { sizex = csizex; sizey = csizey; @@ -61,41 +67,40 @@ void MeshViewerClass::DrawMeshGrid(const uint8_t csizex, const uint8_t csizey) { } void MeshViewerClass::DrawMeshPoint(const uint8_t x, const uint8_t y, const float z) { + const uint8_t fs = DWINUI::fontWidth(meshfont); int16_t v = isnan(z) ? 0 : round(z * 100); LIMIT(v, zmin, zmax); NOLESS(max, z); NOMORE(min, z); - - const int8_t radio = r(v); const uint16_t color = DWINUI::RainbowInt(v, zmin, zmax); - DWINUI::Draw_FillCircle(color, px(x), py(y), radio); - - if (sizex < 9) { - if (v == 0) DWINUI::Draw_Float(font6x12, 1, 2, px(x) - 12, py(y) - 6, 0); - else DWINUI::Draw_Signed_Float(font6x12, 1, 2, px(x) - 18, py(y) - 6, z); + DWINUI::Draw_FillCircle(color, px(x), py(y), r(v)); + TERN_(TJC_DISPLAY, delay(100)); + if (sizex < (ENABLED(TJC_DISPLAY) ? 8 : 9)) { + if (v == 0) DWINUI::Draw_Float(meshfont, 1, 2, px(x) - 2*fs, py(y) - fs, 0); + else DWINUI::Draw_Signed_Float(meshfont, 1, 2, px(x) - 3*fs, py(y) - fs, z); } else { char str_1[9]; str_1[0] = 0; switch (v) { case -999 ... -100: - DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 18, py(y) - 6, z); + DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z); break; case -99 ... -1: sprintf_P(str_1, PSTR("-.%02i"), -v); break; case 0: - DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - 6, "0"); + DWIN_Draw_String(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 4, py(y) - fs, "0"); break; case 1 ... 99: sprintf_P(str_1, PSTR(".%02i"), v); break; case 100 ... 999: - DWINUI::Draw_Signed_Float(font6x12, 1, 1, px(x) - 18, py(y) - 6, z); + DWINUI::Draw_Signed_Float(meshfont, 1, 1, px(x) - 3*fs, py(y) - fs, z); break; } if (str_1[0]) - DWIN_Draw_String(false, font6x12, DWINUI::textcolor, DWINUI::backcolor, px(x) - 12, py(y) - 6, str_1); + DWIN_Draw_String(false, meshfont, DWINUI::textcolor, DWINUI::backcolor, px(x) - 2*fs, py(y) - fs, str_1); } } diff --git a/Marlin/src/lcd/e3v2/proui/meshviewer.h b/Marlin/src/lcd/e3v2/proui/meshviewer.h index abc132892e..0f00a5f8de 100644 --- a/Marlin/src/lcd/e3v2/proui/meshviewer.h +++ b/Marlin/src/lcd/e3v2/proui/meshviewer.h @@ -1,8 +1,8 @@ /** * Mesh Viewer for PRO UI * Author: Miguel A. Risco-Castillo (MRISCOC) - * version: 3.15.1 - * Date: 2022/10/25 + * version: 4.1.1 + * Date: 2023/03/21 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as diff --git a/Marlin/src/lcd/e3v2/proui/proui.h b/Marlin/src/lcd/e3v2/proui/proui.h index 77e2cc6725..41558b402e 100644 --- a/Marlin/src/lcd/e3v2/proui/proui.h +++ b/Marlin/src/lcd/e3v2/proui/proui.h @@ -1,8 +1,8 @@ /** * Professional Firmware UI extensions * Author: Miguel A. Risco-Castillo - * Version: 1.8.0 - * Date: 2022/12/30 + * Version: 1.9.0 + * Date: 2023/03/21 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as