1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-03 09:17:58 +00:00

🎨 More lowercase

Followup to #25939
This commit is contained in:
Scott Lahteine 2023-06-16 18:12:01 -05:00
parent eca80db9b6
commit 41a5fbb16a
9 changed files with 220 additions and 220 deletions

View File

@ -78,7 +78,7 @@ static void pre_g29_return(const bool retry, const bool did) {
TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false)); TERN_(FULL_REPORT_TO_HOST_FEATURE, set_and_report_grblstate(M_IDLE, false));
} }
if (did) { if (did) {
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_LevelingDone()); TERN_(HAS_DWIN_E3V2_BASIC, dwinLevelingDone());
TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone());
} }
} }

View File

@ -236,7 +236,7 @@ void GcodeSuite::G28() {
set_and_report_grblstate(M_HOMING); set_and_report_grblstate(M_HOMING);
#endif #endif
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_HomingStart()); TERN_(HAS_DWIN_E3V2_BASIC, dwinHomingStart());
TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart()); TERN_(EXTENSIBLE_UI, ExtUI::onHomingStart());
planner.synchronize(); // Wait for planner moves to finish! planner.synchronize(); // Wait for planner moves to finish!
@ -649,7 +649,7 @@ void GcodeSuite::G28() {
ui.refresh(); ui.refresh();
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_HomingDone()); TERN_(HAS_DWIN_E3V2_BASIC, dwinHomingDone());
TERN_(EXTENSIBLE_UI, ExtUI::onHomingDone()); TERN_(EXTENSIBLE_UI, ExtUI::onHomingDone());
report_current_position(); report_current_position();

View File

@ -71,7 +71,7 @@ void GcodeSuite::M1000() {
#elif HAS_DWIN_E3V2_BASIC #elif HAS_DWIN_E3V2_BASIC
recovery.dwin_flag = true; recovery.dwin_flag = true;
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) // Temporary fix until it can be better implemented
CrealityDWIN.Popup_Handler(Resume); crealityDWIN.popupHandler(Resume);
#elif ENABLED(EXTENSIBLE_UI) #elif ENABLED(EXTENSIBLE_UI)
ExtUI::onPowerLossResume(); ExtUI::onPowerLossResume();
#else #else

View File

@ -31,21 +31,21 @@
#include <string.h> // for memset #include <string.h> // for memset
uint8_t DWIN_SendBuf[11 + DWIN_WIDTH / 6 * 2] = { 0xAA }; uint8_t dwinSendBuf[11 + DWIN_WIDTH / 6 * 2] = { 0xAA };
uint8_t DWIN_BufTail[4] = { 0xCC, 0x33, 0xC3, 0x3C }; uint8_t dwinBufTail[4] = { 0xCC, 0x33, 0xC3, 0x3C };
uint8_t databuf[26] = { 0 }; uint8_t databuf[26] = { 0 };
// Send the data in the buffer plus the packet tail // Send the data in the buffer plus the packet tail
void DWIN_Send(size_t &i) { void dwinSend(size_t &i) {
++i; ++i;
for (uint8_t n = 0; n < i; ++n) { LCD_SERIAL.write(DWIN_SendBuf[n]); delayMicroseconds(1); } for (uint8_t n = 0; n < i; ++n) { LCD_SERIAL.write(dwinSendBuf[n]); delayMicroseconds(1); }
for (uint8_t n = 0; n < 4; ++n) { LCD_SERIAL.write(DWIN_BufTail[n]); delayMicroseconds(1); } for (uint8_t n = 0; n < 4; ++n) { LCD_SERIAL.write(dwinBufTail[n]); delayMicroseconds(1); }
} }
/*-------------------------------------- System variable function --------------------------------------*/ /*-------------------------------------- System variable function --------------------------------------*/
// Handshake (1: Success, 0: Fail) // Handshake (1: Success, 0: Fail)
bool DWIN_Handshake() { bool dwinHandshake() {
static int recnum = 0; static int recnum = 0;
#ifndef LCD_BAUDRATE #ifndef LCD_BAUDRATE
#define LCD_BAUDRATE 115200 #define LCD_BAUDRATE 115200
@ -55,8 +55,8 @@ bool DWIN_Handshake() {
while (!LCD_SERIAL.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ } while (!LCD_SERIAL.connected() && PENDING(millis(), serial_connect_timeout)) { /*nada*/ }
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x00); dwinByte(i, 0x00);
DWIN_Send(i); dwinSend(i);
while (LCD_SERIAL.available() > 0 && recnum < (signed)sizeof(databuf)) { while (LCD_SERIAL.available() > 0 && recnum < (signed)sizeof(databuf)) {
databuf[recnum] = LCD_SERIAL.read(); databuf[recnum] = LCD_SERIAL.read();
@ -82,11 +82,11 @@ bool DWIN_Handshake() {
#if HAS_LCD_BRIGHTNESS #if HAS_LCD_BRIGHTNESS
// Set LCD backlight (from DWIN Enhanced) // Set LCD backlight (from DWIN Enhanced)
// brightness: 0x00-0xFF // brightness: 0x00-0xFF
void DWIN_LCD_Brightness(const uint8_t brightness) { void dwinLCDBrightness(const uint8_t brightness) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x30); dwinByte(i, 0x30);
DWIN_Byte(i, brightness); dwinByte(i, brightness);
DWIN_Send(i); dwinSend(i);
} }
#endif #endif
@ -126,31 +126,31 @@ uint8_t fontHeight(uint8_t cfont) {
// Set screen display direction // Set screen display direction
// dir: 0=0°, 1=90°, 2=180°, 3=270° // dir: 0=0°, 1=90°, 2=180°, 3=270°
void DWIN_Frame_SetDir(uint8_t dir) { void dwinFrameSetDir(uint8_t dir) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x34); dwinByte(i, 0x34);
DWIN_Byte(i, 0x5A); dwinByte(i, 0x5A);
DWIN_Byte(i, 0xA5); dwinByte(i, 0xA5);
DWIN_Byte(i, dir); dwinByte(i, dir);
DWIN_Send(i); dwinSend(i);
} }
// Update display // Update display
void DWIN_UpdateLCD() { void dwinUpdateLCD() {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x3D); dwinByte(i, 0x3D);
DWIN_Send(i); dwinSend(i);
} }
/*---------------------------------------- Drawing functions ----------------------------------------*/ /*---------------------------------------- Drawing functions ----------------------------------------*/
// Clear screen // Clear screen
// color: Clear screen color // color: Clear screen color
void DWIN_Frame_Clear(const uint16_t color) { void dwinFrameClear(const uint16_t color) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x01); dwinByte(i, 0x01);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Send(i); dwinSend(i);
} }
// Draw a point // Draw a point
@ -158,30 +158,30 @@ void DWIN_Frame_Clear(const uint16_t color) {
// width: point width 0x01-0x0F // width: point width 0x01-0x0F
// height: point height 0x01-0x0F // height: point height 0x01-0x0F
// x,y: upper left point // x,y: upper left point
void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) { void dwinDrawPoint(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x02); dwinByte(i, 0x02);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Byte(i, width); dwinByte(i, width);
DWIN_Byte(i, height); dwinByte(i, height);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Send(i); dwinSend(i);
} }
// Draw a line // Draw a line
// color: Line segment color // color: Line segment color
// xStart/yStart: Start point // xStart/yStart: Start point
// xEnd/yEnd: End 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 dwinDrawLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x03); dwinByte(i, 0x03);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Word(i, xStart); dwinWord(i, xStart);
DWIN_Word(i, yStart); dwinWord(i, yStart);
DWIN_Word(i, xEnd); dwinWord(i, xEnd);
DWIN_Word(i, yEnd); dwinWord(i, yEnd);
DWIN_Send(i); dwinSend(i);
} }
// Draw a rectangle // Draw a rectangle
@ -189,16 +189,16 @@ void DWIN_Draw_Line(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t x
// color: Rectangle color // color: Rectangle color
// xStart/yStart: upper left point // xStart/yStart: upper left point
// xEnd/yEnd: lower right point // xEnd/yEnd: lower right point
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd) { void dwinDrawRectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x05); dwinByte(i, 0x05);
DWIN_Byte(i, mode); dwinByte(i, mode);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Word(i, xStart); dwinWord(i, xStart);
DWIN_Word(i, yStart); dwinWord(i, yStart);
DWIN_Word(i, xEnd); dwinWord(i, xEnd);
DWIN_Word(i, yEnd); dwinWord(i, yEnd);
DWIN_Send(i); dwinSend(i);
} }
// Move a screen area // Move a screen area
@ -208,18 +208,18 @@ void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t
// color: Fill color // color: Fill color
// xStart/yStart: upper left point // xStart/yStart: upper left point
// xEnd/yEnd: bottom right point // xEnd/yEnd: bottom right point
void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, void dwinFrameAreaMove(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) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x09); dwinByte(i, 0x09);
DWIN_Byte(i, (mode << 7) | dir); dwinByte(i, (mode << 7) | dir);
DWIN_Word(i, dis); dwinWord(i, dis);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Word(i, xStart); dwinWord(i, xStart);
DWIN_Word(i, yStart); dwinWord(i, yStart);
DWIN_Word(i, xEnd); dwinWord(i, xEnd);
DWIN_Word(i, yEnd); dwinWord(i, yEnd);
DWIN_Send(i); dwinSend(i);
} }
/*---------------------------------------- Text related functions ----------------------------------------*/ /*---------------------------------------- Text related functions ----------------------------------------*/
@ -233,24 +233,24 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
// x/y: Upper-left coordinate of the string // x/y: Upper-left coordinate of the string
// *string: The string // *string: The string
// rlimit: To limit the drawn string length // rlimit: To limit the drawn string length
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit/*=0xFFFF*/) { void dwinDrawString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit/*=0xFFFF*/) {
#if NONE(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, IS_DWIN_MARLINUI) #if NONE(DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, IS_DWIN_MARLINUI)
DWIN_Draw_Rectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size)); dwinDrawRectangle(1, bColor, x, y, x + (fontWidth(size) * strlen_P(string)), y + fontHeight(size));
#endif #endif
constexpr uint8_t widthAdjust = 0; constexpr uint8_t widthAdjust = 0;
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x11); dwinByte(i, 0x11);
// Bit 7: widthAdjust // Bit 7: widthAdjust
// Bit 6: bShow // Bit 6: bShow
// Bit 5-4: Unused (0) // Bit 5-4: Unused (0)
// Bit 3-0: size // Bit 3-0: size
DWIN_Byte(i, (widthAdjust * 0x80) | (bShow * 0x40) | size); dwinByte(i, (widthAdjust * 0x80) | (bShow * 0x40) | size);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Word(i, bColor); dwinWord(i, bColor);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Text(i, string, rlimit); dwinText(i, string, rlimit);
DWIN_Send(i); dwinSend(i);
} }
// Draw a positive integer // Draw a positive integer
@ -263,28 +263,28 @@ void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor,
// iNum: Number of digits // iNum: Number of digits
// x/y: Upper-left coordinate // x/y: Upper-left coordinate
// value: Integer value // value: Integer value
void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void dwinDrawIntValue(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, uint32_t value) { uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint32_t value) {
size_t i = 0; size_t i = 0;
#if DISABLED(DWIN_CREALITY_LCD_JYERSUI) #if DISABLED(DWIN_CREALITY_LCD_JYERSUI)
DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size)); dwinDrawRectangle(1, bColor, x, y, x + fontWidth(size) * iNum + 1, y + fontHeight(size));
#endif #endif
DWIN_Byte(i, 0x14); dwinByte(i, 0x14);
// Bit 7: bshow // Bit 7: bshow
// Bit 6: 1 = signed; 0 = unsigned number; // Bit 6: 1 = signed; 0 = unsigned number;
// Bit 5: zeroFill // Bit 5: zeroFill
// Bit 4: zeroMode // Bit 4: zeroMode
// Bit 3-0: size // Bit 3-0: size
DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size); dwinByte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Word(i, bColor); dwinWord(i, bColor);
DWIN_Byte(i, iNum); dwinByte(i, iNum);
DWIN_Byte(i, 0); // fNum dwinByte(i, 0); // fNum
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
#if 0 #if 0
for (char count = 0; count < 8; count++) { for (char count = 0; count < 8; count++) {
DWIN_Byte(i, value); dwinByte(i, value);
value >>= 8; value >>= 8;
if (!(value & 0xFF)) break; if (!(value & 0xFF)) break;
} }
@ -293,12 +293,12 @@ void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t
const size_t p = i + 1; const size_t p = i + 1;
for (char count = 8; count--;) { // 7..0 for (char count = 8; count--;) { // 7..0
++i; ++i;
DWIN_SendBuf[p + count] = value; dwinSendBuf[p + count] = value;
value >>= 8; value >>= 8;
} }
#endif #endif
DWIN_Send(i); dwinSend(i);
} }
// Draw a floating point number // Draw a floating point number
@ -312,48 +312,48 @@ void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t
// fNum: Number of decimal digits // fNum: Number of decimal digits
// x/y: Upper-left point // x/y: Upper-left point
// value: Float value // value: Float value
void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void dwinDrawFloatValue(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, int32_t value) { uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value) {
//uint8_t *fvalue = (uint8_t*)&value; //uint8_t *fvalue = (uint8_t*)&value;
size_t i = 0; size_t i = 0;
#if DISABLED(DWIN_CREALITY_LCD_JYERSUI) #if DISABLED(DWIN_CREALITY_LCD_JYERSUI)
DWIN_Draw_Rectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size)); dwinDrawRectangle(1, bColor, x, y, x + fontWidth(size) * (iNum+fNum+1), y + fontHeight(size));
#endif #endif
DWIN_Byte(i, 0x14); dwinByte(i, 0x14);
DWIN_Byte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size); dwinByte(i, (bShow * 0x80) | (zeroFill * 0x20) | (zeroMode * 0x10) | size);
DWIN_Word(i, color); dwinWord(i, color);
DWIN_Word(i, bColor); dwinWord(i, bColor);
DWIN_Byte(i, iNum); dwinByte(i, iNum);
DWIN_Byte(i, fNum); dwinByte(i, fNum);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Long(i, value); dwinLong(i, value);
/* /*
DWIN_Byte(i, fvalue[3]); dwinByte(i, fvalue[3]);
DWIN_Byte(i, fvalue[2]); dwinByte(i, fvalue[2]);
DWIN_Byte(i, fvalue[1]); dwinByte(i, fvalue[1]);
DWIN_Byte(i, fvalue[0]); dwinByte(i, fvalue[0]);
*/ */
DWIN_Send(i); dwinSend(i);
} }
// Draw a floating point number // Draw a floating point number
// value: positive unscaled float value // value: positive unscaled float value
void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void dwinDrawFloatValue(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, float value) { uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value) {
const int32_t val = round(value * POW(10, fNum)); const int32_t val = round(value * POW(10, fNum));
DWIN_Draw_FloatValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, val); dwinDrawFloatValue(bShow, zeroFill, zeroMode, size, color, bColor, iNum, fNum, x, y, val);
} }
/*---------------------------------------- Picture related functions ----------------------------------------*/ /*---------------------------------------- Picture related functions ----------------------------------------*/
// Draw JPG and cached in #0 virtual display area // Draw JPG and cached in #0 virtual display area
// id: Picture ID // id: Picture ID
void DWIN_JPG_ShowAndCache(const uint8_t id) { void dwinJPGShowAndCache(const uint8_t id) {
size_t i = 0; size_t i = 0;
DWIN_Word(i, 0x2200); dwinWord(i, 0x2200);
DWIN_Byte(i, id); dwinByte(i, id);
DWIN_Send(i); // AA 23 00 00 00 00 08 00 01 02 03 CC 33 C3 3C dwinSend(i); // AA 23 00 00 00 00 08 00 01 02 03 CC 33 C3 3C
} }
// Draw an Icon // Draw an Icon
@ -363,16 +363,16 @@ void DWIN_JPG_ShowAndCache(const uint8_t id) {
// libID: Icon library ID // libID: Icon library ID
// picID: Icon ID // picID: Icon ID
// x/y: Upper-left point // x/y: Upper-left point
void DWIN_ICON_Show(bool IBD, bool BIR, bool BFI, uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) { void dwinIconShow(bool IBD, bool BIR, bool BFI, uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
NOMORE(x, DWIN_WIDTH - 1); NOMORE(x, DWIN_WIDTH - 1);
NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x23); dwinByte(i, 0x23);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Byte(i, (IBD << 7) | (BIR << 6) | (BFI << 5) | libID); dwinByte(i, (IBD << 7) | (BIR << 6) | (BFI << 5) | libID);
DWIN_Byte(i, picID); dwinByte(i, picID);
DWIN_Send(i); dwinSend(i);
} }
// Draw an Icon from SRAM // Draw an Icon from SRAM
@ -381,27 +381,27 @@ void DWIN_ICON_Show(bool IBD, bool BIR, bool BFI, uint8_t libID, uint8_t picID,
// BFI: Background filtering strength: 0=normal, 1=enhanced, (only valid when the icon background display=0) // BFI: Background filtering strength: 0=normal, 1=enhanced, (only valid when the icon background display=0)
// x/y: Upper-left point // x/y: Upper-left point
// addr: SRAM address // addr: SRAM address
void DWIN_ICON_Show(bool IBD, bool BIR, bool BFI, uint16_t x, uint16_t y, uint16_t addr) { void dwinIconShow(bool IBD, bool BIR, bool BFI, uint16_t x, uint16_t y, uint16_t addr) {
NOMORE(x, DWIN_WIDTH - 1); NOMORE(x, DWIN_WIDTH - 1);
NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x24); dwinByte(i, 0x24);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
DWIN_Byte(i, (IBD << 7) | (BIR << 6) | (BFI << 5) | 0x00); dwinByte(i, (IBD << 7) | (BIR << 6) | (BFI << 5) | 0x00);
DWIN_Word(i, addr); dwinWord(i, addr);
DWIN_Send(i); dwinSend(i);
} }
// Unzip the JPG picture to a virtual display area // Unzip the JPG picture to a virtual display area
// n: Cache index // n: Cache index
// id: Picture ID // id: Picture ID
void DWIN_JPG_CacheToN(uint8_t n, uint8_t id) { void dwinJPGCacheToN(uint8_t n, uint8_t id) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x25); dwinByte(i, 0x25);
DWIN_Byte(i, n); dwinByte(i, n);
DWIN_Byte(i, id); dwinByte(i, id);
DWIN_Send(i); dwinSend(i);
} }
// Animate a series of icons // Animate a series of icons
@ -412,32 +412,32 @@ void DWIN_JPG_CacheToN(uint8_t n, uint8_t id) {
// picIDe: Icon ending ID // picIDe: Icon ending ID
// x/y: Upper-left point // x/y: Upper-left point
// interval: Display time interval, unit 10mS // interval: Display time interval, unit 10mS
void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs, uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval) { void dwinIconAnimation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs, uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval) {
NOMORE(x, DWIN_WIDTH - 1); NOMORE(x, DWIN_WIDTH - 1);
NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl NOMORE(y, DWIN_HEIGHT - 1); // -- ozy -- srl
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x28); dwinByte(i, 0x28);
DWIN_Word(i, x); dwinWord(i, x);
DWIN_Word(i, y); dwinWord(i, y);
// Bit 7: animation on or off // Bit 7: animation on or off
// Bit 6: start from begin or end // Bit 6: start from begin or end
// Bit 5-4: unused (0) // Bit 5-4: unused (0)
// Bit 3-0: animID // Bit 3-0: animID
DWIN_Byte(i, (animate * 0x80) | 0x40 | animID); dwinByte(i, (animate * 0x80) | 0x40 | animID);
DWIN_Byte(i, libID); dwinByte(i, libID);
DWIN_Byte(i, picIDs); dwinByte(i, picIDs);
DWIN_Byte(i, picIDe); dwinByte(i, picIDe);
DWIN_Byte(i, interval); dwinByte(i, interval);
DWIN_Send(i); dwinSend(i);
} }
// Animation Control // Animation Control
// state: 16 bits, each bit is the state of an animation id // state: 16 bits, each bit is the state of an animation id
void DWIN_ICON_AnimationControl(uint16_t state) { void dwinIconAnimationControl(uint16_t state) {
size_t i = 0; size_t i = 0;
DWIN_Byte(i, 0x29); dwinByte(i, 0x29);
DWIN_Word(i, state); dwinWord(i, state);
DWIN_Send(i); dwinSend(i);
} }
/*---------------------------------------- Memory functions ----------------------------------------*/ /*---------------------------------------- Memory functions ----------------------------------------*/

View File

@ -39,101 +39,101 @@
#define DWIN_SCROLL_UP 2 #define DWIN_SCROLL_UP 2
#define DWIN_SCROLL_DOWN 3 #define DWIN_SCROLL_DOWN 3
// Make sure DWIN_SendBuf is large enough to hold the largest string plus draw command and tail. // Make sure dwinSendBuf 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.
extern uint8_t DWIN_SendBuf[11 + DWIN_WIDTH / 6 * 2]; extern uint8_t dwinSendBuf[11 + DWIN_WIDTH / 6 * 2];
extern uint8_t DWIN_BufTail[4]; extern uint8_t dwinBufTail[4];
extern uint8_t databuf[26]; extern uint8_t databuf[26];
inline void DWIN_Byte(size_t &i, const uint16_t bval) { inline void dwinByte(size_t &i, const uint16_t bval) {
DWIN_SendBuf[++i] = bval; dwinSendBuf[++i] = bval;
} }
inline void DWIN_Word(size_t &i, const uint16_t wval) { inline void dwinWord(size_t &i, const uint16_t wval) {
DWIN_SendBuf[++i] = wval >> 8; dwinSendBuf[++i] = wval >> 8;
DWIN_SendBuf[++i] = wval & 0xFF; dwinSendBuf[++i] = wval & 0xFF;
} }
inline void DWIN_Long(size_t &i, const uint32_t lval) { inline void dwinLong(size_t &i, const uint32_t lval) {
DWIN_SendBuf[++i] = (lval >> 24) & 0xFF; dwinSendBuf[++i] = (lval >> 24) & 0xFF;
DWIN_SendBuf[++i] = (lval >> 16) & 0xFF; dwinSendBuf[++i] = (lval >> 16) & 0xFF;
DWIN_SendBuf[++i] = (lval >> 8) & 0xFF; dwinSendBuf[++i] = (lval >> 8) & 0xFF;
DWIN_SendBuf[++i] = lval & 0xFF; dwinSendBuf[++i] = lval & 0xFF;
} }
// Send the data in the buffer plus the packet tail // Send the data in the buffer plus the packet tail
void DWIN_Send(size_t &i); void dwinSend(size_t &i);
inline void DWIN_Text(size_t &i, const char * const string, uint16_t rlimit=0xFFFF) { inline void dwinText(size_t &i, const char * const string, uint16_t rlimit=0xFFFF) {
if (!string) return; if (!string) return;
const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, _MIN(strlen(string), rlimit)); const size_t len = _MIN(sizeof(dwinSendBuf) - i, _MIN(strlen(string), rlimit));
if (len == 0) return; if (len == 0) return;
memcpy(&DWIN_SendBuf[i+1], string, len); memcpy(&dwinSendBuf[i+1], string, len);
i += len; i += len;
} }
inline void DWIN_Text(size_t &i, FSTR_P string, uint16_t rlimit=0xFFFF) { inline void dwinText(size_t &i, FSTR_P string, uint16_t rlimit=0xFFFF) {
if (!string) return; if (!string) return;
const size_t len = _MIN(sizeof(DWIN_SendBuf) - i, _MIN(rlimit, strlen_P(FTOP(string)))); const size_t len = _MIN(sizeof(dwinSendBuf) - i, _MIN(rlimit, strlen_P(FTOP(string))));
if (len == 0) return; if (len == 0) return;
memcpy_P(&DWIN_SendBuf[i+1], string, len); memcpy_P(&dwinSendBuf[i+1], string, len);
i += len; i += len;
} }
/*-------------------------------------- System variable function --------------------------------------*/ /*-------------------------------------- System variable function --------------------------------------*/
// Handshake (1: Success, 0: Fail) // Handshake (1: Success, 0: Fail)
bool DWIN_Handshake(); bool dwinHandshake();
// DWIN startup // DWIN startup
void DWIN_Startup(); void dwinStartup();
#if HAS_LCD_BRIGHTNESS #if HAS_LCD_BRIGHTNESS
// Set the backlight brightness // Set the backlight brightness
// brightness: (0x00-0xFF) // brightness: (0x00-0xFF)
void DWIN_LCD_Brightness(const uint8_t brightness); void dwinLCDBrightness(const uint8_t brightness);
#endif #endif
// Set screen display direction // Set screen display direction
// dir: 0=0°, 1=90°, 2=180°, 3=270° // dir: 0=0°, 1=90°, 2=180°, 3=270°
void DWIN_Frame_SetDir(uint8_t dir); void dwinFrameSetDir(uint8_t dir);
// Update display // Update display
void DWIN_UpdateLCD(); void dwinUpdateLCD();
/*---------------------------------------- Drawing functions ----------------------------------------*/ /*---------------------------------------- Drawing functions ----------------------------------------*/
// Clear screen // Clear screen
// color: Clear screen color // color: Clear screen color
void DWIN_Frame_Clear(const uint16_t color); void dwinFrameClear(const uint16_t color);
// Draw a point // Draw a point
// color: point color // color: point color
// width: point width 0x01-0x0F // width: point width 0x01-0x0F
// height: point height 0x01-0x0F // height: point height 0x01-0x0F
// x,y: upper left point // x,y: upper left point
void DWIN_Draw_Point(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y); void dwinDrawPoint(uint16_t color, uint8_t width, uint8_t height, uint16_t x, uint16_t y);
// Draw a line // Draw a line
// color: Line segment color // color: Line segment color
// xStart/yStart: Start point // xStart/yStart: Start point
// xEnd/yEnd: End 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 dwinDrawLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
// Draw a Horizontal line // Draw a Horizontal line
// color: Line segment color // color: Line segment color
// xStart/yStart: Start point // xStart/yStart: Start point
// xLength: Line Length // xLength: Line Length
inline void DWIN_Draw_HLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xLength) { inline void dwinDrawHLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xLength) {
DWIN_Draw_Line(color, xStart, yStart, xStart + xLength - 1, yStart); dwinDrawLine(color, xStart, yStart, xStart + xLength - 1, yStart);
} }
// Draw a Vertical line // Draw a Vertical line
// color: Line segment color // color: Line segment color
// xStart/yStart: Start point // xStart/yStart: Start point
// yLength: Line Length // yLength: Line Length
inline void DWIN_Draw_VLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t yLength) { inline void dwinDrawVLine(uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t yLength) {
DWIN_Draw_Line(color, xStart, yStart, xStart, yStart + yLength - 1); dwinDrawLine(color, xStart, yStart, xStart, yStart + yLength - 1);
} }
// Draw a rectangle // Draw a rectangle
@ -141,15 +141,15 @@ inline void DWIN_Draw_VLine(uint16_t color, uint16_t xStart, uint16_t yStart, ui
// color: Rectangle color // color: Rectangle color
// xStart/yStart: upper left point // xStart/yStart: upper left point
// xEnd/yEnd: lower right point // xEnd/yEnd: lower right point
void DWIN_Draw_Rectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd); void dwinDrawRectangle(uint8_t mode, uint16_t color, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd);
// Draw a box // Draw a box
// mode: 0=frame, 1=fill, 2=XOR fill // mode: 0=frame, 1=fill, 2=XOR fill
// color: Rectangle color // color: Rectangle color
// xStart/yStart: upper left point // xStart/yStart: upper left point
// xSize/ySize: box size // 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) { inline void dwinDrawBox(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); dwinDrawRectangle(mode, color, xStart, yStart, xStart + xSize - 1, yStart + ySize - 1);
} }
// Move a screen area // Move a screen area
@ -159,7 +159,7 @@ inline void DWIN_Draw_Box(uint8_t mode, uint16_t color, uint16_t xStart, uint16_
// color: Fill color // color: Fill color
// xStart/yStart: upper left point // xStart/yStart: upper left point
// xEnd/yEnd: bottom right point // xEnd/yEnd: bottom right point
void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis, void dwinFrameAreaMove(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);
@ -173,15 +173,15 @@ void DWIN_Frame_AreaMove(uint8_t mode, uint8_t dir, uint16_t dis,
// x/y: Upper-left coordinate of the string // x/y: Upper-left coordinate of the string
// *string: The string // *string: The string
// rlimit: For draw less chars than string length use rlimit // rlimit: For draw less chars than string length use rlimit
void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF); void dwinDrawString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, const char * const string, uint16_t rlimit=0xFFFF);
inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P const ftitle) { inline void dwinDrawString(bool bShow, uint8_t size, uint16_t color, uint16_t bColor, uint16_t x, uint16_t y, FSTR_P const ftitle) {
#ifdef __AVR__ #ifdef __AVR__
char ctitle[strlen_P(FTOP(ftitle)) + 1]; char ctitle[strlen_P(FTOP(ftitle)) + 1];
strcpy_P(ctitle, FTOP(ftitle)); strcpy_P(ctitle, FTOP(ftitle));
DWIN_Draw_String(bShow, size, color, bColor, x, y, ctitle); dwinDrawString(bShow, size, color, bColor, x, y, ctitle);
#else #else
DWIN_Draw_String(bShow, size, color, bColor, x, y, FTOP(ftitle)); dwinDrawString(bShow, size, color, bColor, x, y, FTOP(ftitle));
#endif #endif
} }
@ -195,7 +195,7 @@ inline void DWIN_Draw_String(bool bShow, uint8_t size, uint16_t color, uint16_t
// iNum: Number of digits // iNum: Number of digits
// x/y: Upper-left coordinate // x/y: Upper-left coordinate
// value: Integer value // value: Integer value
void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void dwinDrawIntValue(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, uint32_t value); uint16_t bColor, uint8_t iNum, uint16_t x, uint16_t y, uint32_t value);
// Draw a floating point number // Draw a floating point number
@ -209,25 +209,25 @@ void DWIN_Draw_IntValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t
// fNum: Number of decimal digits // fNum: Number of decimal digits
// x/y: Upper-left point // x/y: Upper-left point
// value: Float value // value: Float value
void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void dwinDrawFloatValue(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, int32_t value); uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, int32_t value);
// Draw a floating point number // Draw a floating point number
// value: positive unscaled float value // value: positive unscaled float value
void DWIN_Draw_FloatValue(uint8_t bShow, bool zeroFill, uint8_t zeroMode, uint8_t size, uint16_t color, void dwinDrawFloatValue(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, float value); uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, float value);
/*---------------------------------------- Picture related functions ----------------------------------------*/ /*---------------------------------------- Picture related functions ----------------------------------------*/
// Draw JPG and cached in #0 virtual display area // Draw JPG and cached in #0 virtual display area
// id: Picture ID // id: Picture ID
void DWIN_JPG_ShowAndCache(const uint8_t id); void dwinJPGShowAndCache(const uint8_t id);
// Draw an Icon // Draw an Icon
// libID: Icon library ID // libID: Icon library ID
// picID: Icon ID // picID: Icon ID
// x/y: Upper-left point // x/y: Upper-left point
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y); void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y);
// Draw an Icon // Draw an Icon
// IBD: The icon background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black // IBD: The icon background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black
@ -236,7 +236,7 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y);
// libID: Icon library ID // libID: Icon library ID
// picID: Icon ID // picID: Icon ID
// x/y: Upper-left point // x/y: Upper-left point
void DWIN_ICON_Show(bool IBD, bool BIR, bool BFI, uint8_t libID, uint8_t picID, uint16_t x, uint16_t y); void dwinIconShow(bool IBD, bool BIR, bool BFI, uint8_t libID, uint8_t picID, uint16_t x, uint16_t y);
// Draw an Icon from SRAM // Draw an Icon from SRAM
// IBD: The icon background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black // IBD: The icon background display: 0=Background filtering is not displayed, 1=Background display \\When setting the background filtering not to display, the background must be pure black
@ -244,16 +244,16 @@ void DWIN_ICON_Show(bool IBD, bool BIR, bool BFI, uint8_t libID, uint8_t picID,
// BFI: Background filtering strength: 0=normal, 1=enhanced, (only valid when the icon background display=0) // BFI: Background filtering strength: 0=normal, 1=enhanced, (only valid when the icon background display=0)
// x/y: Upper-left point // x/y: Upper-left point
// addr: SRAM address // addr: SRAM address
void DWIN_ICON_Show(bool IBD, bool BIR, bool BFI, uint16_t x, uint16_t y, uint16_t addr); void dwinIconShow(bool IBD, bool BIR, bool BFI, uint16_t x, uint16_t y, uint16_t addr);
// Unzip the JPG picture to a virtual display area // Unzip the JPG picture to a virtual display area
// n: Cache index // n: Cache index
// id: Picture ID // id: Picture ID
void DWIN_JPG_CacheToN(uint8_t n, uint8_t id); void dwinJPGCacheToN(uint8_t n, uint8_t id);
// Unzip the JPG picture to virtual display area #1 // Unzip the JPG picture to virtual display area #1
// id: Picture ID // id: Picture ID
inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); } inline void dwinJPGCacheTo1(uint8_t id) { dwinJPGCacheToN(1, id); }
// Animate a series of icons // Animate a series of icons
// animID: Animation ID up to 16 // animID: Animation ID up to 16
@ -263,8 +263,8 @@ inline void DWIN_JPG_CacheTo1(uint8_t id) { DWIN_JPG_CacheToN(1, id); }
// picIDe: Icon ending ID // picIDe: Icon ending ID
// x/y: Upper-left point // x/y: Upper-left point
// interval: Display time interval, unit 10mS // interval: Display time interval, unit 10mS
void DWIN_ICON_Animation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs, uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval); void dwinIconAnimation(uint8_t animID, bool animate, uint8_t libID, uint8_t picIDs, uint8_t picIDe, uint16_t x, uint16_t y, uint16_t interval);
// Animation Control // Animation Control
// state: 16 bits, each bit is the state of an animation id // state: 16 bits, each bit is the state of an animation id
void DWIN_ICON_AnimationControl(uint16_t state); void dwinIconAnimationControl(uint16_t state);

View File

@ -46,7 +46,7 @@
#define ENCODER_PULSES_PER_STEP 4 #define ENCODER_PULSES_PER_STEP 4
#endif #endif
ENCODER_Rate EncoderRate; EncoderRate encoderRate;
// TODO: Replace with ui.quick_feedback // TODO: Replace with ui.quick_feedback
void Encoder_tick() { void Encoder_tick() {
@ -54,7 +54,7 @@ void Encoder_tick() {
} }
// Encoder initialization // Encoder initialization
void Encoder_Configuration() { void encoderConfiguration() {
#if BUTTON_EXISTS(EN1) #if BUTTON_EXISTS(EN1)
SET_INPUT_PULLUP(BTN_EN1); SET_INPUT_PULLUP(BTN_EN1);
#endif #endif
@ -70,7 +70,7 @@ void Encoder_Configuration() {
} }
// Analyze encoder value and return state // Analyze encoder value and return state
EncoderState Encoder_ReceiveAnalyze() { EncoderState encoderReceiveAnalyze() {
const millis_t now = millis(); const millis_t now = millis();
static uint8_t lastEncoderBits; static uint8_t lastEncoderBits;
uint8_t newbutton = 0; uint8_t newbutton = 0;
@ -126,20 +126,20 @@ EncoderState Encoder_ReceiveAnalyze() {
int32_t encoderMultiplier = 1; int32_t encoderMultiplier = 1;
// if must encoder rati multiplier // if must encoder rati multiplier
if (EncoderRate.enabled) { if (encoderRate.enabled) {
const float abs_diff = ABS(temp_diff), const float abs_diff = ABS(temp_diff),
encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP); encoderMovementSteps = abs_diff / (ENCODER_PULSES_PER_STEP);
if (EncoderRate.lastEncoderTime) { if (encoderRate.lastEncoderTime) {
// Note that the rate is always calculated between two passes through the // Note that the rate is always calculated between two passes through the
// loop and that the abs of the temp_diff value is tracked. // loop and that the abs of the temp_diff value is tracked.
const float encoderStepRate = encoderMovementSteps / float(ms - EncoderRate.lastEncoderTime) * 1000; const float encoderStepRate = encoderMovementSteps / float(ms - encoderRate.lastEncoderTime) * 1000;
if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100; if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10; else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
#if ENCODER_5X_STEPS_PER_SEC #if ENCODER_5X_STEPS_PER_SEC
else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5; else if (encoderStepRate >= ENCODER_5X_STEPS_PER_SEC) encoderMultiplier = 5;
#endif #endif
} }
EncoderRate.lastEncoderTime = ms; encoderRate.lastEncoderTime = ms;
} }
#else #else
@ -148,9 +148,9 @@ EncoderState Encoder_ReceiveAnalyze() {
#endif #endif
// EncoderRate.encoderMoveValue += (temp_diff * encoderMultiplier) / (ENCODER_PULSES_PER_STEP); // encoderRate.encoderMoveValue += (temp_diff * encoderMultiplier) / (ENCODER_PULSES_PER_STEP);
EncoderRate.encoderMoveValue = (temp_diff * encoderMultiplier) / (ENCODER_PULSES_PER_STEP); encoderRate.encoderMoveValue = (temp_diff * encoderMultiplier) / (ENCODER_PULSES_PER_STEP);
if (EncoderRate.encoderMoveValue < 0) EncoderRate.encoderMoveValue = -EncoderRate.encoderMoveValue; if (encoderRate.encoderMoveValue < 0) encoderRate.encoderMoveValue = -encoderRate.encoderMoveValue;
temp_diff = 0; temp_diff = 0;
} }

View File

@ -34,9 +34,9 @@ typedef struct {
bool enabled = false; bool enabled = false;
int encoderMoveValue = 0; int encoderMoveValue = 0;
millis_t lastEncoderTime = 0; millis_t lastEncoderTime = 0;
} ENCODER_Rate; } EncoderRate;
extern ENCODER_Rate EncoderRate; extern EncoderRate encoderRate;
typedef enum { typedef enum {
ENCODER_DIFF_NO = 0, // no state ENCODER_DIFF_NO = 0, // no state
@ -48,26 +48,26 @@ typedef enum {
#define ENCODER_WAIT_MS 20 #define ENCODER_WAIT_MS 20
// Encoder initialization // Encoder initialization
void Encoder_Configuration(); void encoderConfiguration();
// Analyze encoder value and return state // Analyze encoder value and return state
EncoderState Encoder_ReceiveAnalyze(); EncoderState encoderReceiveAnalyze();
inline EncoderState get_encoder_state() { inline EncoderState get_encoder_state() {
static millis_t Encoder_ms = 0; static millis_t Encoder_ms = 0;
const millis_t ms = millis(); const millis_t ms = millis();
if (PENDING(ms, Encoder_ms)) return ENCODER_DIFF_NO; if (PENDING(ms, Encoder_ms)) return ENCODER_DIFF_NO;
const EncoderState state = Encoder_ReceiveAnalyze(); const EncoderState state = encoderReceiveAnalyze();
if (state != ENCODER_DIFF_NO) Encoder_ms = ms + ENCODER_WAIT_MS; if (state != ENCODER_DIFF_NO) Encoder_ms = ms + ENCODER_WAIT_MS;
return state; return state;
} }
template<typename T> template<typename T>
inline bool Apply_Encoder(const EncoderState &encoder_diffState, T &valref) { inline bool applyEncoder(const EncoderState &encoder_diffState, T &valref) {
if (encoder_diffState == ENCODER_DIFF_CW) if (encoder_diffState == ENCODER_DIFF_CW)
valref += EncoderRate.encoderMoveValue; valref += encoderRate.encoderMoveValue;
else if (encoder_diffState == ENCODER_DIFF_CCW) else if (encoder_diffState == ENCODER_DIFF_CCW)
valref -= EncoderRate.encoderMoveValue; valref -= encoderRate.encoderMoveValue;
return encoder_diffState == ENCODER_DIFF_ENTER; return encoder_diffState == ENCODER_DIFF_ENTER;
} }

View File

@ -535,7 +535,7 @@ typedef struct SettingsDataStruct {
#if ENABLED(DWIN_LCD_PROUI) #if ENABLED(DWIN_LCD_PROUI)
uint8_t dwin_data[eeprom_data_size]; uint8_t dwin_data[eeprom_data_size];
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI) #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
uint8_t dwin_settings[CrealityDWIN.eeprom_data_size]; uint8_t dwin_settings[crealityDWIN.eeprom_data_size];
#endif #endif
// //

View File

@ -1231,7 +1231,7 @@ volatile bool Temperature::raw_temps_ready = false;
// Heat to 200 degrees // Heat to 200 degrees
SERIAL_ECHOLNPGM(STR_MPC_HEATING_PAST_200); SERIAL_ECHOLNPGM(STR_MPC_HEATING_PAST_200);
TERN(DWIN_LCD_PROUI, LCD_ALERTMESSAGE(MSG_MPC_HEATING_PAST_200), LCD_MESSAGE(MSG_HEATING)); LCD_ALERTMESSAGE(MSG_MPC_HEATING_PAST_200);
if (tuner.measure_heatup() != MPC_autotuner::MeasurementState::SUCCESS) return; if (tuner.measure_heatup() != MPC_autotuner::MeasurementState::SUCCESS) return;
@ -1531,14 +1531,14 @@ void Temperature::_temp_error(const heater_id_t heater_id, FSTR_P const serial_m
void Temperature::maxtemp_error(const heater_id_t heater_id) { void Temperature::maxtemp_error(const heater_id_t heater_id) {
#if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED) #if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED)
DWIN_Popup_Temperature(1); dwinPopupTemperature(1);
#endif #endif
_temp_error(heater_id, F(STR_T_MAXTEMP), GET_TEXT_F(MSG_ERR_MAXTEMP)); _temp_error(heater_id, F(STR_T_MAXTEMP), GET_TEXT_F(MSG_ERR_MAXTEMP));
} }
void Temperature::mintemp_error(const heater_id_t heater_id) { void Temperature::mintemp_error(const heater_id_t heater_id) {
#if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED) #if HAS_DWIN_E3V2_BASIC && (HAS_HOTEND || HAS_HEATED_BED)
DWIN_Popup_Temperature(0); dwinPopupTemperature(0);
#endif #endif
_temp_error(heater_id, F(STR_T_MINTEMP), GET_TEXT_F(MSG_ERR_MINTEMP)); _temp_error(heater_id, F(STR_T_MINTEMP), GET_TEXT_F(MSG_ERR_MINTEMP));
} }
@ -1758,7 +1758,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
if (watch_hotend[e].check(degHotend(e))) // Increased enough? if (watch_hotend[e].check(degHotend(e))) // Increased enough?
start_watching_hotend(e); // If temp reached, turn off elapsed check start_watching_hotend(e); // If temp reached, turn off elapsed check
else { else {
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error((heater_id_t)e, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD)); _temp_error((heater_id_t)e, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD));
} }
} }
@ -1783,7 +1783,7 @@ void Temperature::mintemp_error(const heater_id_t heater_id) {
if (watch_bed.check(degBed())) // Increased enough? if (watch_bed.check(degBed())) // Increased enough?
start_watching_bed(); // If temp reached, turn off elapsed check start_watching_bed(); // If temp reached, turn off elapsed check
else { else {
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error(H_BED, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD)); _temp_error(H_BED, FPSTR(str_t_heating_failed), GET_TEXT_F(MSG_HEATING_FAILED_LCD));
} }
} }
@ -3179,12 +3179,12 @@ void Temperature::init() {
} // fall through } // fall through
case TRRunaway: case TRRunaway:
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY)); _temp_error(heater_id, FPSTR(str_t_thermal_runaway), GET_TEXT_F(MSG_THERMAL_RUNAWAY));
#if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR) #if ENABLED(THERMAL_PROTECTION_VARIANCE_MONITOR)
case TRMalfunction: case TRMalfunction:
TERN_(HAS_DWIN_E3V2_BASIC, DWIN_Popup_Temperature(0)); TERN_(HAS_DWIN_E3V2_BASIC, dwinPopupTemperature(0));
_temp_error(heater_id, FPSTR(str_t_temp_malfunction), GET_TEXT_F(MSG_TEMP_MALFUNCTION)); _temp_error(heater_id, FPSTR(str_t_temp_malfunction), GET_TEXT_F(MSG_TEMP_MALFUNCTION));
#endif #endif
} }
@ -4392,7 +4392,7 @@ void Temperature::isr() {
if (wait_for_heatup) { if (wait_for_heatup) {
wait_for_heatup = false; wait_for_heatup = false;
#if HAS_DWIN_E3V2_BASIC #if HAS_DWIN_E3V2_BASIC
HMI_flag.heat_flag = 0; hmiFlag.heat_flag = 0;
duration_t elapsed = print_job_timer.duration(); // Print timer duration_t elapsed = print_job_timer.duration(); // Print timer
dwin_heat_time = elapsed.value; dwin_heat_time = elapsed.value;
#else #else