🎨 Lowercase methods, functions, data members (#25939)

For: TFT, DGUS, MarlinUI, Anycubic, JyersUI, CrealityUI
This commit is contained in:
Scott Lahteine
2023-06-14 17:24:50 -05:00
committed by GitHub
parent 1726ba5bda
commit c3694f1c03
82 changed files with 3702 additions and 3710 deletions

View File

@@ -30,7 +30,7 @@
SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE);
void TFT_SPI::Init() {
void TFT_SPI::init() {
#if PIN_EXISTS(TFT_RESET)
OUT_WRITE(TFT_RESET_PIN, HIGH);
delay(100);
@@ -49,21 +49,21 @@ void TFT_SPI::Init() {
SPIx.setDataMode(SPI_MODE0);
}
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
SPIx.setDataSize(DataSize);
void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
SPIx.setDataSize(dataSize);
SPIx.begin();
WRITE(TFT_CS_PIN, LOW);
}
uint32_t TFT_SPI::GetID() {
uint32_t TFT_SPI::getID() {
uint32_t id;
id = ReadID(LCD_READ_ID);
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = ReadID(LCD_READ_ID4);
id = readID(LCD_READ_ID4);
return id;
}
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
uint32_t TFT_SPI::readID(uint16_t reg) {
uint32_t data = 0;
#if PIN_EXISTS(TFT_MISO)
@@ -72,14 +72,14 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
SPIx.setClock(SPI_CLOCK_DIV64);
SPIx.begin();
WRITE(TFT_CS_PIN, LOW);
WriteReg(Reg);
writeReg(reg);
for (uint8_t i = 0; i < 4; ++i) {
SPIx.read((uint8_t*)&d, 1);
data = (data << 8) | d;
}
DataTransferEnd();
dataTransferEnd();
SPIx.setClock(SPI_CLOCK_MAX_TFT);
#endif
@@ -103,11 +103,11 @@ bool TFT_SPI::isBusy() {
if ((SSP_GetStatus(LPC_SSPx, SSP_STAT_TXFIFO_EMPTY) == RESET) || (SSP_GetStatus(LPC_SSPx, SSP_STAT_BUSY) == SET)) return true;
}
Abort();
abort();
return false;
}
void TFT_SPI::Abort() {
void TFT_SPI::abort() {
// DMA Channel 0 is hardcoded in dmaSendAsync() and dmaSend()
// Disable DMA
@@ -126,20 +126,20 @@ void TFT_SPI::Abort() {
LPC_GPDMACH0->DMACCSrcAddr = 0U;
LPC_GPDMACH0->DMACCDestAddr = 0U;
DataTransferEnd();
dataTransferEnd();
}
void TFT_SPI::Transmit(uint16_t Data) { SPIx.transfer(Data); }
void TFT_SPI::transmit(uint16_t data) { SPIx.transfer(data); }
void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSend(Data, Count, MemoryIncrease);
Abort();
void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
dataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSend(data, count, memoryIncrease);
abort();
}
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSendAsync(Data, Count, MemoryIncrease);
void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
dataTransferBegin(DATASIZE_16BIT);
SPIx.dmaSendAsync(data, count, memoryIncrease);
TERN_(TFT_SHARED_IO, while (isBusy()));
}

View File

@@ -56,34 +56,34 @@
class TFT_SPI {
private:
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(uint16_t reg);
static void transmit(uint16_t data);
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
public:
static SPIClass SPIx;
static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
static void DataTransferAbort();
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
static void dataTransferAbort();
static void WriteData(uint16_t Data) { Transmit(Data); }
static void WriteReg(uint16_t Reg) { WRITE(TFT_DC_PIN, LOW); Transmit(Reg); WRITE(TFT_DC_PIN, HIGH); }
static void writeData(uint16_t data) { transmit(data); }
static void writeReg(uint16_t reg) { WRITE(TFT_DC_PIN, LOW); transmit(reg); WRITE(TFT_DC_PIN, HIGH); }
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_MINC_ENABLE, data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_MINC_DISABLE, &data, count); }
static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
while (Count > 0) {
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); }
static void writeMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
}
}
};

View File

@@ -45,7 +45,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; }
}
#endif
void XPT2046::Init() {
void XPT2046::init() {
#if DISABLED(TOUCH_BUTTONS_HW_SPI)
SET_INPUT(TOUCH_MISO_PIN);
SET_OUTPUT(TOUCH_MOSI_PIN);
@@ -85,7 +85,7 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) {
uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
uint16_t data[3];
DataTransferBegin();
dataTransferBegin();
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin());
for (uint16_t i = 0; i < 3 ; i++) {
@@ -94,7 +94,7 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
}
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end());
DataTransferEnd();
dataTransferEnd();
uint16_t delta01 = delta(data[0], data[1]),
delta02 = delta(data[0], data[2]),
@@ -107,18 +107,18 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
}
uint16_t XPT2046::IO(uint16_t data) {
return TERN(TOUCH_BUTTONS_HW_SPI, HardwareIO, SoftwareIO)(data);
return TERN(TOUCH_BUTTONS_HW_SPI, hardwareIO, softwareIO)(data);
}
extern uint8_t spiTransfer(uint8_t b);
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
uint16_t XPT2046::HardwareIO(uint16_t data) {
uint16_t XPT2046::hardwareIO(uint16_t data) {
return SPIx.transfer(data & 0xFF);
}
#endif
uint16_t XPT2046::SoftwareIO(uint16_t data) {
uint16_t XPT2046::softwareIO(uint16_t data) {
uint16_t result = 0;
for (uint8_t j = 0x80; j; j >>= 1) {

View File

@@ -65,12 +65,12 @@ private:
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static void dataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
static uint16_t hardwareIO(uint16_t data);
#endif
static uint16_t SoftwareIO(uint16_t data);
static uint16_t softwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0);
public:
@@ -78,6 +78,6 @@ public:
static SPIClass SPIx;
#endif
static void Init();
static void init();
static bool getRawPoint(int16_t *x, int16_t *y);
};

View File

@@ -40,28 +40,28 @@
class TFT_SPI {
private:
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(uint16_t reg);
static void transmit(uint16_t data);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
public:
// static SPIClass SPIx;
static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd();
static void DataTransferAbort();
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
static void dataTransferEnd();
static void dataTransferAbort();
static void WriteData(uint16_t Data);
static void WriteReg(uint16_t Reg);
static void writeData(uint16_t data);
static void writeReg(uint16_t reg);
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { WriteSequence(Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { WriteMultiple(Color, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { writeSequence(data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { writeMultiple(color, count); }
static void WriteSequence(uint16_t *Data, uint16_t Count);
static void WriteMultiple(uint16_t Color, uint32_t Count);
static void writeSequence(uint16_t *data, uint16_t count);
static void writeMultiple(uint16_t color, uint32_t count);
};

View File

@@ -62,12 +62,12 @@ private:
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();
static void DataTransferBegin();
static void DataTransferEnd();
static void dataTransferBegin();
static void dataTransferEnd();
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
static uint16_t hardwareIO(uint16_t data);
#endif
static uint16_t SoftwareIO(uint16_t data);
static uint16_t softwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0);
public:
@@ -75,6 +75,6 @@ public:
static SPIClass SPIx;
#endif
static void Init();
static void init();
static bool getRawPoint(int16_t *x, int16_t *y);
};

View File

@@ -156,7 +156,7 @@ void GT911::read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_l
sw_iic.stop();
}
void GT911::Init() {
void GT911::init() {
OUT_WRITE(GT911_RST_PIN, LOW);
OUT_WRITE(GT911_INT_PIN, LOW);
delay(11);

View File

@@ -90,7 +90,7 @@ class GT911 {
static void read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len);
public:
static void Init();
static void init();
static bool getFirstTouchPoint(int16_t *x, int16_t *y);
static bool getPoint(int16_t *x, int16_t *y);
};

View File

@@ -35,17 +35,17 @@ SRAM_HandleTypeDef TFT_FSMC::SRAMx;
DMA_HandleTypeDef TFT_FSMC::DMAtx;
LCD_CONTROLLER_TypeDef *TFT_FSMC::LCD;
void TFT_FSMC::Init() {
void TFT_FSMC::init() {
uint32_t controllerAddress;
FSMC_NORSRAM_TimingTypeDef Timing, ExtTiming;
FSMC_NORSRAM_TimingTypeDef timing, extTiming;
uint32_t NSBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
uint32_t nsBank = (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS);
// Perform the SRAM1 memory initialization sequence
SRAMx.Instance = FSMC_NORSRAM_DEVICE;
SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
// SRAMx.Init
SRAMx.Init.NSBank = NSBank;
SRAMx.Init.NSBank = nsBank;
SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
SRAMx.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
SRAMx.Init.MemoryDataWidth = TERN(TFT_INTERFACE_FSMC_8BIT, FSMC_NORSRAM_MEM_BUS_WIDTH_8, FSMC_NORSRAM_MEM_BUS_WIDTH_16);
@@ -63,42 +63,42 @@ void TFT_FSMC::Init() {
#endif
// Read Timing - relatively slow to ensure ID information is correctly read from TFT controller
// Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss
Timing.AddressSetupTime = 15;
Timing.AddressHoldTime = 15;
Timing.DataSetupTime = 24;
Timing.BusTurnAroundDuration = 0;
Timing.CLKDivision = 16;
Timing.DataLatency = 17;
Timing.AccessMode = FSMC_ACCESS_MODE_A;
timing.AddressSetupTime = 15;
timing.AddressHoldTime = 15;
timing.DataSetupTime = 24;
timing.BusTurnAroundDuration = 0;
timing.CLKDivision = 16;
timing.DataLatency = 17;
timing.AccessMode = FSMC_ACCESS_MODE_A;
// Write Timing
// Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss
ExtTiming.AddressSetupTime = 8;
ExtTiming.AddressHoldTime = 15;
ExtTiming.DataSetupTime = 8;
ExtTiming.BusTurnAroundDuration = 0;
ExtTiming.CLKDivision = 16;
ExtTiming.DataLatency = 17;
ExtTiming.AccessMode = FSMC_ACCESS_MODE_A;
extTiming.AddressSetupTime = 8;
extTiming.AddressHoldTime = 15;
extTiming.DataSetupTime = 8;
extTiming.BusTurnAroundDuration = 0;
extTiming.CLKDivision = 16;
extTiming.DataLatency = 17;
extTiming.AccessMode = FSMC_ACCESS_MODE_A;
__HAL_RCC_FSMC_CLK_ENABLE();
for (uint16_t i = 0; PinMap_FSMC[i].pin != NC; i++)
pinmap_pinout(PinMap_FSMC[i].pin, PinMap_FSMC);
pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), PinMap_FSMC_RS);
for (uint16_t i = 0; pinMap_FSMC[i].pin != NC; i++)
pinmap_pinout(pinMap_FSMC[i].pin, pinMap_FSMC);
pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS);
pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), pinMap_FSMC_RS);
controllerAddress = FSMC_BANK1_1;
#ifdef PF0
switch (NSBank) {
switch (nsBank) {
case FSMC_NORSRAM_BANK2: controllerAddress = FSMC_BANK1_2 ; break;
case FSMC_NORSRAM_BANK3: controllerAddress = FSMC_BANK1_3 ; break;
case FSMC_NORSRAM_BANK4: controllerAddress = FSMC_BANK1_4 ; break;
}
#endif
controllerAddress |= (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_RS_PIN), PinMap_FSMC_RS);
controllerAddress |= (uint32_t)pinmap_peripheral(digitalPinToPinName(TFT_RS_PIN), pinMap_FSMC_RS);
HAL_SRAM_Init(&SRAMx, &Timing, &ExtTiming);
HAL_SRAM_Init(&SRAMx, &timing, &extTiming);
#ifdef STM32F1xx
__HAL_RCC_DMA1_CLK_ENABLE();
@@ -123,23 +123,23 @@ void TFT_FSMC::Init() {
LCD = (LCD_CONTROLLER_TypeDef *)controllerAddress;
}
uint32_t TFT_FSMC::GetID() {
uint32_t TFT_FSMC::getID() {
uint32_t id;
WriteReg(0);
writeReg(0);
id = LCD->RAM;
if (id == 0)
id = ReadID(LCD_READ_ID);
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = ReadID(LCD_READ_ID4);
id = readID(LCD_READ_ID4);
return id;
}
uint32_t TFT_FSMC::ReadID(tft_data_t Reg) {
uint32_t TFT_FSMC::readID(tft_data_t reg) {
uint32_t id;
WriteReg(Reg);
writeReg(reg);
id = LCD->RAM; // dummy read
id = Reg << 24;
id = reg << 24;
id |= (LCD->RAM & 0x00FF) << 16;
id |= (LCD->RAM & 0x00FF) << 8;
id |= LCD->RAM & 0x00FF;
@@ -161,30 +161,30 @@ bool TFT_FSMC::isBusy() {
if ((__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TE_FLAG_INDEX(&DMAtx)) == 0) && (__HAL_DMA_GET_FLAG(&DMAtx, __HAL_DMA_GET_TC_FLAG_INDEX(&DMAtx)) == 0)) return true;
__DSB();
Abort();
abort();
return false;
}
void TFT_FSMC::Abort() {
void TFT_FSMC::abort() {
HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any
HAL_DMA_DeInit(&DMAtx); // Deconfigure DMA
}
void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DMAtx.Init.PeriphInc = MemoryIncrease;
void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
DMAtx.Init.PeriphInc = memoryIncrease;
HAL_DMA_Init(&DMAtx);
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(LCD->RAM), Count);
HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count);
TERN_(TFT_SHARED_IO, while (isBusy()));
}
void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DMAtx.Init.PeriphInc = MemoryIncrease;
void TFT_FSMC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
DMAtx.Init.PeriphInc = memoryIncrease;
HAL_DMA_Init(&DMAtx);
DataTransferBegin();
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(LCD->RAM), Count);
dataTransferBegin();
HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count);
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
Abort();
abort();
}
#endif // HAS_FSMC_TFT

View File

@@ -62,31 +62,31 @@ class TFT_FSMC {
static LCD_CONTROLLER_TypeDef *LCD;
static uint32_t ReadID(tft_data_t Reg);
static void Transmit(tft_data_t Data) { LCD->RAM = Data; __DSB(); }
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(tft_data_t reg);
static void transmit(tft_data_t data) { LCD->RAM = data; __DSB(); }
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
public:
static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();
static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {}
static void DataTransferEnd() {}
static void dataTransferBegin(uint16_t dataWidth=TFT_DATASIZE) {}
static void dataTransferEnd() {}
static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); }
static void WriteReg(uint16_t Reg) { LCD->REG = tft_data_t(Reg); __DSB(); }
static void writeData(uint16_t data) { transmit(tft_data_t(data)); }
static void writeReg(uint16_t reg) { LCD->REG = tft_data_t(reg); __DSB(); }
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_PINC_ENABLE, data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_PINC_DISABLE, &data, count); }
static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_PINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
while (Count > 0) {
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); }
static void writeMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
}
}
};
@@ -103,7 +103,7 @@ class TFT_FSMC {
#error No configuration for this MCU
#endif
const PinMap PinMap_FSMC[] = {
const PinMap pinMap_FSMC[] = {
{PD_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D00
{PD_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D01
{PD_0, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D02
@@ -127,7 +127,7 @@ const PinMap PinMap_FSMC[] = {
{NC, NP, 0}
};
const PinMap PinMap_FSMC_CS[] = {
const PinMap pinMap_FSMC_CS[] = {
{PD_7, (void *)FSMC_NORSRAM_BANK1, FSMC_PIN_DATA}, // FSMC_NE1
#ifdef PF0
{PG_9, (void *)FSMC_NORSRAM_BANK2, FSMC_PIN_DATA}, // FSMC_NE2
@@ -143,7 +143,7 @@ const PinMap PinMap_FSMC_CS[] = {
#define FSMC_RS(A) (void *)((2 << A) - 2)
#endif
const PinMap PinMap_FSMC_RS[] = {
const PinMap pinMap_FSMC_RS[] = {
#ifdef PF0
{PF_0, FSMC_RS( 0), FSMC_PIN_DATA}, // FSMC_A0
{PF_1, FSMC_RS( 1), FSMC_PIN_DATA}, // FSMC_A1

View File

@@ -246,28 +246,28 @@ uint16_t TFT_LTDC::y_cur = 0;
uint8_t TFT_LTDC::reg = 0;
volatile uint16_t* TFT_LTDC::framebuffer = (volatile uint16_t* )FRAME_BUFFER_ADDRESS;
void TFT_LTDC::Init() {
void TFT_LTDC::init() {
// SDRAM pins init
for (uint16_t i = 0; PinMap_SDRAM[i].pin != NC; i++)
pinmap_pinout(PinMap_SDRAM[i].pin, PinMap_SDRAM);
for (uint16_t i = 0; pinMap_SDRAM[i].pin != NC; i++)
pinmap_pinout(pinMap_SDRAM[i].pin, pinMap_SDRAM);
// SDRAM peripheral config
SDRAM_Config();
// LTDC pins init
for (uint16_t i = 0; PinMap_LTDC[i].pin != NC; i++)
pinmap_pinout(PinMap_LTDC[i].pin, PinMap_LTDC);
for (uint16_t i = 0; pinMap_LTDC[i].pin != NC; i++)
pinmap_pinout(pinMap_LTDC[i].pin, pinMap_LTDC);
// LTDC peripheral config
LTDC_Config();
}
uint32_t TFT_LTDC::GetID() {
uint32_t TFT_LTDC::getID() {
return 0xABAB;
}
uint32_t TFT_LTDC::ReadID(tft_data_t Reg) {
uint32_t TFT_LTDC::readID(tft_data_t reg) {
return 0xABAB;
}
@@ -275,15 +275,15 @@ bool TFT_LTDC::isBusy() {
return false;
}
uint16_t TFT_LTDC::ReadPoint(uint16_t x, uint16_t y) {
uint16_t TFT_LTDC::readPoint(uint16_t x, uint16_t y) {
return framebuffer[(TFT_WIDTH * y) + x];
}
void TFT_LTDC::DrawPoint(uint16_t x, uint16_t y, uint16_t color) {
void TFT_LTDC::drawPoint(uint16_t x, uint16_t y, uint16_t color) {
framebuffer[(TFT_WIDTH * y) + x] = color;
}
void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color) {
void TFT_LTDC::drawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color) {
if (sx == ex || sy == ey) return;
@@ -307,7 +307,7 @@ void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint
SBI(DMA2D->IFCR, 1);
}
void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) {
void TFT_LTDC::drawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) {
if (sx == ex || sy == ey) return;
@@ -332,18 +332,18 @@ void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uin
SBI(DMA2D->IFCR, 1);
}
void TFT_LTDC::WriteData(uint16_t data) {
void TFT_LTDC::writeData(uint16_t data) {
switch (reg) {
case 0x01: x_cur = x_min = data; return;
case 0x02: x_max = data; return;
case 0x03: y_cur = y_min = data; return;
case 0x04: y_max = data; return;
}
Transmit(data);
transmit(data);
}
void TFT_LTDC::Transmit(tft_data_t Data) {
DrawPoint(x_cur, y_cur, Data);
void TFT_LTDC::transmit(tft_data_t data) {
drawPoint(x_cur, y_cur, data);
x_cur++;
if (x_cur > x_max) {
x_cur = x_min;
@@ -352,35 +352,35 @@ void TFT_LTDC::Transmit(tft_data_t Data) {
}
}
void TFT_LTDC::WriteReg(uint16_t Reg) {
reg = Reg;
void TFT_LTDC::writeReg(uint16_t reg) {
reg = reg;
}
void TFT_LTDC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
void TFT_LTDC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
while (x_cur != x_min && Count) {
Transmit(*Data);
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
Count--;
while (x_cur != x_min && count) {
transmit(*data);
if (memoryIncrease == DMA_PINC_ENABLE) data++;
count--;
}
uint16_t width = x_max - x_min + 1;
uint16_t height = Count / width;
uint16_t x_end_cnt = Count - (width * height);
uint16_t height = count / width;
uint16_t x_end_cnt = count - (width * height);
if (height) {
if (MemoryIncrease == DMA_PINC_ENABLE) {
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
Data += width * height;
if (memoryIncrease == DMA_PINC_ENABLE) {
drawImage(x_min, y_cur, x_min + width, y_cur + height, data);
data += width * height;
}
else
DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
drawRect(x_min, y_cur, x_min + width, y_cur + height, *data);
y_cur += height;
}
while (x_end_cnt) {
Transmit(*Data);
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
transmit(*data);
if (memoryIncrease == DMA_PINC_ENABLE) data++;
x_end_cnt--;
}
}

View File

@@ -43,41 +43,41 @@ class TFT_LTDC {
static uint16_t x_min, x_max, y_min, y_max, x_cur, y_cur;
static uint8_t reg;
static uint32_t ReadID(tft_data_t Reg);
static uint32_t readID(tft_data_t reg);
static uint16_t ReadPoint(uint16_t x, uint16_t y);
static void DrawPoint(uint16_t x, uint16_t y, uint16_t color);
static void DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color);
static void DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors);
static void Transmit(tft_data_t Data);
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint16_t readPoint(uint16_t x, uint16_t y);
static void drawPoint(uint16_t x, uint16_t y, uint16_t color);
static void drawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color);
static void drawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors);
static void transmit(tft_data_t data);
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
public:
static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ }
static void abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ }
static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {}
static void DataTransferEnd() {};
static void dataTransferBegin(uint16_t dataWidth=TFT_DATASIZE) {}
static void dataTransferEnd() {};
static void WriteData(uint16_t Data);
static void WriteReg(uint16_t Reg);
static void writeData(uint16_t data);
static void writeReg(uint16_t reg);
// Non-blocking DMA data transfer is not implemented for LTDC interface
inline static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { WriteSequence(Data, Count); }
inline static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { WriteMultiple(Color, Count); }
inline static void writeSequence_DMA(uint16_t *data, uint16_t count) { writeSequence(data, count); }
inline static void writeMultiple_DMA(uint16_t color, uint16_t count) { writeMultiple(color, count); }
static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_PINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
while (Count > 0) {
Transmit(DMA_PINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); }
static void writeMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
transmit(DMA_PINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
}
}
};
const PinMap PinMap_LTDC[] = {
const PinMap pinMap_LTDC[] = {
{PF_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_DE
{PG_7, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_CLK
{PI_9, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_VSYNC
@@ -104,7 +104,7 @@ const PinMap PinMap_LTDC[] = {
{NC, NP, 0}
};
const PinMap PinMap_SDRAM[] = {
const PinMap pinMap_SDRAM[] = {
{PC_0, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNWE
{PC_2, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNE0
{PC_3, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCKE0

View File

@@ -34,7 +34,7 @@
SPI_HandleTypeDef TFT_SPI::SPIx;
DMA_HandleTypeDef TFT_SPI::DMAtx;
void TFT_SPI::Init() {
void TFT_SPI::init() {
SPI_TypeDef *spiInstance;
OUT_WRITE(TFT_A0_PIN, HIGH);
@@ -122,8 +122,8 @@ void TFT_SPI::Init() {
#endif
}
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
SPIx.Init.DataSize = DataSize == DATASIZE_8BIT ? SPI_DATASIZE_8BIT : SPI_DATASIZE_16BIT;
void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
SPIx.Init.DataSize = dataSize == DATASIZE_8BIT ? SPI_DATASIZE_8BIT : SPI_DATASIZE_16BIT;
HAL_SPI_Init(&SPIx);
WRITE(TFT_CS_PIN, LOW);
}
@@ -132,11 +132,11 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
#include "../../../lcd/tft_io/tft_ids.h"
#endif
uint32_t TFT_SPI::GetID() {
uint32_t TFT_SPI::getID() {
uint32_t id;
id = ReadID(LCD_READ_ID);
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) {
id = ReadID(LCD_READ_ID4);
id = readID(LCD_READ_ID4);
#ifdef TFT_DEFAULT_DRIVER
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = TFT_DEFAULT_DRIVER;
@@ -145,15 +145,15 @@ uint32_t TFT_SPI::GetID() {
return id;
}
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
uint32_t Data = 0;
uint32_t TFT_SPI::readID(uint16_t reg) {
uint32_t data = 0;
#if PIN_EXISTS(TFT_MISO)
uint32_t BaudRatePrescaler = SPIx.Init.BaudRatePrescaler;
uint32_t i;
SPIx.Init.BaudRatePrescaler = SPIx.Instance == SPI1 ? SPI_BAUDRATEPRESCALER_8 : SPI_BAUDRATEPRESCALER_4;
DataTransferBegin(DATASIZE_8BIT);
WriteReg(Reg);
dataTransferBegin(DATASIZE_8BIT);
writeReg(reg);
if (SPIx.Init.Direction == SPI_DIRECTION_1LINE) SPI_1LINE_RX(&SPIx);
__HAL_SPI_ENABLE(&SPIx);
@@ -164,15 +164,15 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
SPIx.Instance->DR = 0;
#endif
while (!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_RXNE)) {}
Data = (Data << 8) | SPIx.Instance->DR;
data = (data << 8) | SPIx.Instance->DR;
}
DataTransferEnd();
dataTransferEnd();
SPIx.Init.BaudRatePrescaler = BaudRatePrescaler;
#endif
return Data >> 7;
return data >> 7;
}
bool TFT_SPI::isBusy() {
@@ -197,27 +197,27 @@ bool TFT_SPI::isBusy() {
if ((!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_TXE)) || (__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY))) return true;
}
Abort();
abort();
return false;
}
void TFT_SPI::Abort() {
void TFT_SPI::abort() {
HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any
HAL_DMA_DeInit(&DMAtx);
CLEAR_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN);
DataTransferEnd(); // Stop SPI and deselect CS
dataTransferEnd(); // Stop SPI and deselect CS
}
void TFT_SPI::Transmit(uint16_t Data) {
void TFT_SPI::transmit(uint16_t data) {
#if TFT_MISO_PIN == TFT_MOSI_PIN
SPI_1LINE_TX(&SPIx);
#endif
__HAL_SPI_ENABLE(&SPIx);
SPIx.Instance->DR = Data;
SPIx.Instance->DR = data;
while (!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_TXE)) {}
while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {}
@@ -227,17 +227,17 @@ void TFT_SPI::Transmit(uint16_t Data) {
#endif
}
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DMAtx.Init.MemInc = MemoryIncrease;
void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
DMAtx.Init.MemInc = memoryIncrease;
HAL_DMA_Init(&DMAtx);
#if TFT_MISO_PIN == TFT_MOSI_PIN
SPI_1LINE_TX(&SPIx);
#endif
DataTransferBegin();
dataTransferBegin();
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count);
HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(SPIx.Instance->DR), count);
__HAL_SPI_ENABLE(&SPIx);
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
@@ -245,39 +245,39 @@ void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Coun
TERN_(TFT_SHARED_IO, while (isBusy()));
}
void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DMAtx.Init.MemInc = MemoryIncrease;
void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
DMAtx.Init.MemInc = memoryIncrease;
HAL_DMA_Init(&DMAtx);
if (TFT_MISO_PIN == TFT_MOSI_PIN)
SPI_1LINE_TX(&SPIx);
DataTransferBegin();
dataTransferBegin();
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count);
HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(SPIx.Instance->DR), count);
__HAL_SPI_ENABLE(&SPIx);
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {}
Abort();
abort();
}
#if ENABLED(USE_SPI_DMA_TC)
void TFT_SPI::TransmitDMA_IT(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
void TFT_SPI::TransmitDMA_IT(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
DMAtx.Init.MemInc = MemoryIncrease;
DMAtx.Init.MemInc = memoryIncrease;
HAL_DMA_Init(&DMAtx);
if (TFT_MISO_PIN == TFT_MOSI_PIN)
SPI_1LINE_TX(&SPIx);
DataTransferBegin();
dataTransferBegin();
HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
HAL_DMA_Start_IT(&DMAtx, (uint32_t)Data, (uint32_t)&(SPIx.Instance->DR), Count);
HAL_DMA_Start_IT(&DMAtx, (uint32_t)data, (uint32_t)&(SPIx.Instance->DR), count);
__HAL_SPI_ENABLE(&SPIx);
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request

View File

@@ -46,40 +46,40 @@ private:
static SPI_HandleTypeDef SPIx;
static DMA_HandleTypeDef DMAtx;
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(uint16_t reg);
static void transmit(uint16_t data);
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
#if ENABLED(USE_SPI_DMA_TC)
static void TransmitDMA_IT(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static void TransmitDMA_IT(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
#endif
public:
static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); };
static void DataTransferAbort();
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); };
static void dataTransferAbort();
static void WriteData(uint16_t Data) { Transmit(Data); }
static void WriteReg(uint16_t Reg) { WRITE(TFT_A0_PIN, LOW); Transmit(Reg); WRITE(TFT_A0_PIN, HIGH); }
static void writeData(uint16_t data) { transmit(data); }
static void writeReg(uint16_t reg) { WRITE(TFT_A0_PIN, LOW); transmit(reg); WRITE(TFT_A0_PIN, HIGH); }
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_MINC_ENABLE, data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_MINC_DISABLE, &data, count); }
#if ENABLED(USE_SPI_DMA_TC)
static void WriteSequenceIT(uint16_t *Data, uint16_t Count) { TransmitDMA_IT(DMA_MINC_ENABLE, Data, Count); }
static void writeSequenceIT(uint16_t *data, uint16_t count) { TransmitDMA_IT(DMA_MINC_ENABLE, data, count); }
inline static void DMA_IRQHandler() { HAL_DMA_IRQHandler(&TFT_SPI::DMAtx); }
#endif
static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
while (Count > 0) {
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); }
static void writeMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
}
}
};

View File

@@ -35,7 +35,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; }
SPI_HandleTypeDef XPT2046::SPIx;
void XPT2046::Init() {
void XPT2046::init() {
SPI_TypeDef *spiInstance;
OUT_WRITE(TOUCH_CS_PIN, HIGH);
@@ -117,14 +117,14 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) {
uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
uint16_t data[3];
DataTransferBegin();
dataTransferBegin();
for (uint16_t i = 0; i < 3 ; i++) {
IO(coordinate);
data[i] = (IO() << 4) | (IO() >> 4);
}
DataTransferEnd();
dataTransferEnd();
uint16_t delta01 = delta(data[0], data[1]);
uint16_t delta02 = delta(data[0], data[2]);
@@ -140,7 +140,7 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
return (data[0] + data[1]) >> 1;
}
uint16_t XPT2046::HardwareIO(uint16_t data) {
uint16_t XPT2046::hardwareIO(uint16_t data) {
__HAL_SPI_ENABLE(&SPIx);
while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
SPIx.Instance->DR = data;
@@ -150,7 +150,7 @@ uint16_t XPT2046::HardwareIO(uint16_t data) {
return SPIx.Instance->DR;
}
uint16_t XPT2046::SoftwareIO(uint16_t data) {
uint16_t XPT2046::softwareIO(uint16_t data) {
uint16_t result = 0;
for (uint8_t j = 0x80; j > 0; j >>= 1) {

View File

@@ -69,13 +69,13 @@ private:
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();
static void DataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static uint16_t HardwareIO(uint16_t data);
static uint16_t SoftwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0) { return SPIx.Instance ? HardwareIO(data) : SoftwareIO(data); }
static void dataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static uint16_t hardwareIO(uint16_t data);
static uint16_t softwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0) { return SPIx.Instance ? hardwareIO(data) : softwareIO(data); }
public:
static void Init();
static void init();
static bool getRawPoint(int16_t *x, int16_t *y);
};

View File

@@ -87,7 +87,7 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB() {
#define FSMC_DATA_SETUP_TIME 15 // DataSetupTime
static uint8_t fsmcInit = 0;
void TFT_FSMC::Init() {
void TFT_FSMC::init() {
uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN;
uint32_t controllerAddress;
@@ -181,35 +181,35 @@ void TFT_FSMC::Init() {
LCD = (LCD_CONTROLLER_TypeDef*)controllerAddress;
}
void TFT_FSMC::Transmit(uint16_t Data) {
LCD->RAM = Data;
void TFT_FSMC::transmit(uint16_t data) {
LCD->RAM = data;
__DSB();
}
void TFT_FSMC::WriteReg(uint16_t Reg) {
LCD->REG = Reg;
void TFT_FSMC::writeReg(uint16_t reg) {
LCD->REG = reg;
__DSB();
}
uint32_t TFT_FSMC::GetID() {
uint32_t TFT_FSMC::getID() {
uint32_t id;
WriteReg(0x0000);
writeReg(0x0000);
id = LCD->RAM;
if (id == 0)
id = ReadID(LCD_READ_ID);
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = ReadID(LCD_READ_ID4);
id = readID(LCD_READ_ID4);
if ((id & 0xFF00) == 0 && (id & 0xFF) != 0)
id = ReadID(LCD_READ_ID4);
id = readID(LCD_READ_ID4);
return id;
}
uint32_t TFT_FSMC::ReadID(uint16_t Reg) {
uint32_t TFT_FSMC::readID(uint16_t reg) {
uint32_t id;
WriteReg(Reg);
writeReg(reg);
id = LCD->RAM; // dummy read
id = Reg << 24;
id = reg << 24;
id |= (LCD->RAM & 0x00FF) << 16;
id |= (LCD->RAM & 0x00FF) << 8;
id |= LCD->RAM & 0x00FF;
@@ -225,11 +225,11 @@ bool TFT_FSMC::isBusy() {
if ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & (DMA_ISR_TCIF | DMA_ISR_TEIF)) == 0) return true;
__DSB();
Abort();
abort();
return false;
}
void TFT_FSMC::Abort() {
void TFT_FSMC::abort() {
dma_channel_reg_map *channel_regs = dma_channel_regs(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
dma_disable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL); // Abort DMA transfer if any
@@ -241,25 +241,25 @@ void TFT_FSMC::Abort() {
channel_regs->CPAR = 0U;
}
void TFT_FSMC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
void TFT_FSMC::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
// TODO: HAL STM32 uses DMA2_Channel1 for FSMC on STM32F1
dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | MemoryIncrease);
dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Count);
dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | memoryIncrease);
dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count);
dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
TERN_(TFT_SHARED_IO, while (isBusy()));
}
void TFT_FSMC::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
void TFT_FSMC::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
#if defined(FSMC_DMA_DEV) && defined(FSMC_DMA_CHANNEL)
dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | MemoryIncrease);
dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, Count);
dma_setup_transfer(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, data, DMA_SIZE_16BITS, &LCD->RAM, DMA_SIZE_16BITS, DMA_MEM_2_MEM | memoryIncrease);
dma_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count);
dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & (DMA_CCR_TEIE | DMA_CCR_TCIE)) == 0) {}
Abort();
abort();
#endif
}

View File

@@ -54,31 +54,31 @@ class TFT_FSMC {
private:
static LCD_CONTROLLER_TypeDef *LCD;
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(uint16_t reg);
static void transmit(uint16_t data);
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
public:
static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) {};
static void DataTransferEnd() {};
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT) {};
static void dataTransferEnd() {};
static void WriteData(uint16_t Data) { Transmit(Data); }
static void WriteReg(uint16_t Reg);
static void writeData(uint16_t data) { transmit(data); }
static void writeReg(uint16_t reg);
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_PINC_ENABLE, data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_PINC_DISABLE, &data, count); }
static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_PINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
while (Count > 0) {
Transmit(DMA_PINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); }
static void writeMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
transmit(DMA_PINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
}
}
};

View File

@@ -30,7 +30,7 @@
SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE);
void TFT_SPI::Init() {
void TFT_SPI::init() {
#if PIN_EXISTS(TFT_RESET)
OUT_WRITE(TFT_RESET_PIN, HIGH);
delay(100);
@@ -70,8 +70,8 @@ void TFT_SPI::Init() {
SPIx.setDataMode(SPI_MODE0);
}
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
SPIx.setDataSize(DataSize);
void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
SPIx.setDataSize(dataSize);
SPIx.begin();
WRITE(TFT_CS_PIN, LOW);
}
@@ -80,11 +80,11 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
#include "../../../lcd/tft_io/tft_ids.h"
#endif
uint32_t TFT_SPI::GetID() {
uint32_t TFT_SPI::getID() {
uint32_t id;
id = ReadID(LCD_READ_ID);
id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) {
id = ReadID(LCD_READ_ID4);
id = readID(LCD_READ_ID4);
#ifdef TFT_DEFAULT_DRIVER
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = TFT_DEFAULT_DRIVER;
@@ -93,13 +93,13 @@ uint32_t TFT_SPI::GetID() {
return id;
}
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
uint32_t TFT_SPI::readID(uint16_t reg) {
uint32_t data = 0;
#if PIN_EXISTS(TFT_MISO)
SPIx.setClockDivider(SPI_CLOCK_DIV16);
DataTransferBegin(DATASIZE_8BIT);
WriteReg(Reg);
dataTransferBegin(DATASIZE_8BIT);
writeReg(reg);
for (uint8_t i = 0; i < 4; ++i) {
uint8_t d;
@@ -107,7 +107,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
data = (data << 8) | d;
}
DataTransferEnd();
dataTransferEnd();
SPIx.setClockDivider(SPI_CLOCK_MAX);
#endif
@@ -130,11 +130,11 @@ bool TFT_SPI::isBusy() {
if (!(SPIdev->regs->SR & SPI_SR_TXE) || (SPIdev->regs->SR & SPI_SR_BSY)) return true;
}
Abort();
abort();
return false;
}
void TFT_SPI::Abort() {
void TFT_SPI::abort() {
dma_channel_reg_map *channel_regs = dma_channel_regs(DMAx, DMA_CHx);
dma_disable(DMAx, DMA_CHx); // Abort DMA transfer if any
@@ -146,23 +146,23 @@ void TFT_SPI::Abort() {
channel_regs->CMAR = 0U;
channel_regs->CPAR = 0U;
DataTransferEnd();
dataTransferEnd();
}
void TFT_SPI::Transmit(uint16_t Data) { SPIx.send(Data); }
void TFT_SPI::transmit(uint16_t data) { SPIx.send(data); }
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
DataTransferBegin();
SPIx.dmaSendAsync(Data, Count, MemoryIncrease == DMA_MINC_ENABLE);
void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
dataTransferBegin();
SPIx.dmaSendAsync(data, count, memoryIncrease == DMA_MINC_ENABLE);
TERN_(TFT_SHARED_IO, while (isBusy()));
}
void TFT_SPI::Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
WRITE(TFT_DC_PIN, HIGH);
DataTransferBegin();
SPIx.dmaSend(Data, Count, MemoryIncrease == DMA_MINC_ENABLE);
DataTransferEnd();
dataTransferBegin();
SPIx.dmaSend(data, count, memoryIncrease == DMA_MINC_ENABLE);
dataTransferEnd();
}
#endif // HAS_SPI_TFT

View File

@@ -63,34 +63,34 @@
class TFT_SPI {
private:
static uint32_t ReadID(uint16_t Reg);
static void Transmit(uint16_t Data);
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
static uint32_t readID(uint16_t reg);
static void transmit(uint16_t data);
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
public:
static SPIClass SPIx;
static void Init();
static uint32_t GetID();
static void init();
static uint32_t getID();
static bool isBusy();
static void Abort();
static void abort();
static void DataTransferBegin(uint16_t DataWidth=DATA_SIZE_16BIT);
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); };
static void DataTransferAbort();
static void dataTransferBegin(uint16_t dataWidth=DATA_SIZE_16BIT);
static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); };
static void dataTransferAbort();
static void WriteData(uint16_t Data) { Transmit(Data); }
static void WriteReg(uint16_t Reg) { WRITE(TFT_DC_PIN, LOW); Transmit(Reg); WRITE(TFT_DC_PIN, HIGH); }
static void writeData(uint16_t data) { transmit(data); }
static void writeReg(uint16_t reg) { WRITE(TFT_DC_PIN, LOW); transmit(reg); WRITE(TFT_DC_PIN, HIGH); }
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple_DMA(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_MINC_DISABLE, &Data, Count); }
static void writeSequence_DMA(uint16_t *data, uint16_t count) { transmitDMA(DMA_MINC_ENABLE, data, count); }
static void writeMultiple_DMA(uint16_t color, uint16_t count) { static uint16_t data; data = color; transmitDMA(DMA_MINC_DISABLE, &data, count); }
static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, Data, Count); }
static void WriteMultiple(uint16_t Color, uint32_t Count) {
while (Count > 0) {
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
static void writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); }
static void writeMultiple(uint16_t color, uint32_t count) {
while (count > 0) {
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
}
}
};

View File

@@ -59,7 +59,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; }
}
#endif // TOUCH_BUTTONS_HW_SPI
void XPT2046::Init() {
void XPT2046::init() {
SET_INPUT(TOUCH_MISO_PIN);
SET_OUTPUT(TOUCH_MOSI_PIN);
SET_OUTPUT(TOUCH_SCK_PIN);
@@ -97,7 +97,7 @@ bool XPT2046::getRawPoint(int16_t *x, int16_t *y) {
uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
uint16_t data[3];
DataTransferBegin();
dataTransferBegin();
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin());
for (uint16_t i = 0; i < 3 ; i++) {
@@ -106,7 +106,7 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
}
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end());
DataTransferEnd();
dataTransferEnd();
uint16_t delta01 = delta(data[0], data[1]),
delta02 = delta(data[0], data[2]),
@@ -119,17 +119,17 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
}
uint16_t XPT2046::IO(uint16_t data) {
return TERN(TOUCH_BUTTONS_HW_SPI, HardwareIO, SoftwareIO)(data);
return TERN(TOUCH_BUTTONS_HW_SPI, hardwareIO, softwareIO)(data);
}
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
uint16_t XPT2046::HardwareIO(uint16_t data) {
uint16_t XPT2046::hardwareIO(uint16_t data) {
uint16_t result = SPIx.transfer(data);
return result;
}
#endif
uint16_t XPT2046::SoftwareIO(uint16_t data) {
uint16_t XPT2046::softwareIO(uint16_t data) {
uint16_t result = 0;
for (uint8_t j = 0x80; j; j >>= 1) {

View File

@@ -65,12 +65,12 @@ private:
static uint16_t getRawData(const XPTCoordinate coordinate);
static bool isTouched();
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
static void dataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
static uint16_t HardwareIO(uint16_t data);
static uint16_t hardwareIO(uint16_t data);
#endif
static uint16_t SoftwareIO(uint16_t data);
static uint16_t softwareIO(uint16_t data);
static uint16_t IO(uint16_t data = 0);
public:
@@ -78,6 +78,6 @@ public:
static SPIClass SPIx;
#endif
static void Init();
static void init();
static bool getRawPoint(int16_t *x, int16_t *y);
};

View File

@@ -135,7 +135,7 @@
// Generic ARM code, that's testing if an access to the given address would cause a fault or not
// It can't guarantee an address is in RAM or Flash only, but we usually don't care
#define NVIC_FAULT_STAT 0xE000ED28 // Configurable Fault Status Reg.
#define NVIC_FAULT_STAT 0xE000ED28 // Configurable Fault Status reg.
#define NVIC_CFG_CTRL 0xE000ED14 // Configuration Control Register
#define NVIC_FAULT_STAT_BFARV 0x00008000 // BFAR is valid
#define NVIC_CFG_CTRL_BFHFNMIGN 0x00000100 // Ignore bus fault in NMI/fault

View File

@@ -819,7 +819,7 @@ void idle(const bool no_stepper_sleep/*=false*/) {
TERN_(HAS_BEEPER, buzzer.tick());
// Handle UI input / draw events
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update());
// Run i2c Position Encoders
#if ENABLED(I2C_POSITION_ENCODERS)

View File

@@ -375,7 +375,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
#endif
#if HAS_LCDPRINT && HAS_EXTRA_PROGRESS && LCD_HEIGHT < 4
#error "Displays with fewer than 4 rows of text can't show progress values."
#error "Displays with fewer than 4 rows can't show progress values (e.g., SHOW_PROGRESS_PERCENT, SHOW_ELAPSED_TIME, SHOW_REMAINING_TIME, SHOW_INTERACTION_TIME)."
#endif
#if !HAS_MARLINUI_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)

View File

@@ -787,9 +787,10 @@ void MarlinUI::draw_status_message(const bool blink) {
#define TPOFFSET (LCD_WIDTH - 1)
static uint8_t timepos = TPOFFSET - 6;
static char buffer[8];
static lcd_uint_t pc, pr;
#if ENABLED(SHOW_PROGRESS_PERCENT)
static lcd_uint_t pc = 0, pr = 2;
inline void setPercentPos(const lcd_uint_t c, const lcd_uint_t r) { pc = c; pr = r; }
void MarlinUI::drawPercent() {
const uint8_t progress = ui.get_progress_percent();
if (progress) {
@@ -800,6 +801,7 @@ void MarlinUI::draw_status_message(const bool blink) {
}
}
#endif
#if ENABLED(SHOW_REMAINING_TIME)
void MarlinUI::drawRemain() {
if (printJobOngoing()) {
@@ -811,6 +813,7 @@ void MarlinUI::draw_status_message(const bool blink) {
}
}
#endif
#if ENABLED(SHOW_INTERACTION_TIME)
void MarlinUI::drawInter() {
const duration_t interactt = ui.interaction_time;
@@ -822,6 +825,7 @@ void MarlinUI::draw_status_message(const bool blink) {
}
}
#endif
#if ENABLED(SHOW_ELAPSED_TIME)
void MarlinUI::drawElapsed() {
if (printJobOngoing()) {
@@ -947,7 +951,7 @@ void MarlinUI::draw_status_screen() {
#if LCD_WIDTH < 20
#if HAS_PRINT_PROGRESS
pc = 0; pr = 2;
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(0, 2));
rotate_progress();
#endif
@@ -1039,7 +1043,7 @@ void MarlinUI::draw_status_screen() {
#if LCD_WIDTH >= 20
#if HAS_PRINT_PROGRESS
pc = 6; pr = 2;
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(6, 2));
rotate_progress();
#else
char c;
@@ -1122,7 +1126,7 @@ void MarlinUI::draw_status_screen() {
_draw_bed_status(blink);
#elif HAS_PRINT_PROGRESS
#define DREW_PRINT_PROGRESS 1
pc = 0; pr = 2;
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(0, 2));
rotate_progress();
#endif
@@ -1130,7 +1134,7 @@ void MarlinUI::draw_status_screen() {
// All progress strings
//
#if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
pc = LCD_WIDTH - 9; pr = 2;
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(LCD_WIDTH - 9, 2));
rotate_progress();
#endif
#endif // LCD_INFO_SCREEN_STYLE 1

View File

@@ -305,7 +305,7 @@ static void setWindow(u8g_t *u8g, u8g_dev_t *dev, uint16_t Xmin, uint16_t Ymin,
for (uint16_t l = 0; l < UPSCALE0(length); l++)
buffer[l + n * UPSCALE0(length)] = buffer[l];
tftio.WriteSequence(buffer, length * sq(GRAPHICAL_TFT_UPSCALE));
tftio.writeSequence(buffer, length * sq(GRAPHICAL_TFT_UPSCALE));
#else
for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;)
u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
@@ -351,7 +351,7 @@ static void u8g_upscale_clear_lcd(u8g_t *u8g, u8g_dev_t *dev, uint16_t *buffer)
setWindow(u8g, dev, 0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1);
#if HAS_LCD_IO
UNUSED(buffer);
tftio.WriteMultiple(TFT_MARLINBG_COLOR, (TFT_WIDTH) * (TFT_HEIGHT));
tftio.writeMultiple(TFT_MARLINBG_COLOR, (TFT_WIDTH) * (TFT_HEIGHT));
#else
memset2(buffer, TFT_MARLINBG_COLOR, (TFT_WIDTH) / 2);
for (uint16_t i = 0; i < (TFT_HEIGHT) * sq(GRAPHICAL_TFT_UPSCALE); i++)
@@ -381,8 +381,8 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
}
if (msgInitCount) return -1;
tftio.Init();
tftio.InitTFT();
tftio.init();
tftio.initTFT();
TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset());
u8g_upscale_clear_lcd(u8g, dev, buffer);
return 0;
@@ -425,7 +425,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u
for (uint16_t l = 0; l < UPSCALE0(WIDTH); l++)
buffer[l + n * UPSCALE0(WIDTH)] = buffer[l];
tftio.WriteSequence(buffer, COUNT(bufferA));
tftio.writeSequence(buffer, COUNT(bufferA));
#else
uint8_t *bufptr = (uint8_t*) buffer;
for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;) {
@@ -469,19 +469,19 @@ uint8_t u8g_com_hal_tft_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_p
break;
case U8G_COM_MSG_WRITE_BYTE:
tftio.DataTransferBegin(DATASIZE_8BIT);
tftio.dataTransferBegin(DATASIZE_8BIT);
if (isCommand)
tftio.WriteReg(arg_val);
tftio.writeReg(arg_val);
else
tftio.WriteData((uint16_t)arg_val);
tftio.DataTransferEnd();
tftio.writeData((uint16_t)arg_val);
tftio.dataTransferEnd();
break;
case U8G_COM_MSG_WRITE_SEQ:
tftio.DataTransferBegin(DATASIZE_16BIT);
tftio.dataTransferBegin(DATASIZE_16BIT);
for (uint8_t i = 0; i < arg_val; i += 2)
tftio.WriteData(*(uint16_t *)(((uintptr_t)arg_ptr) + i));
tftio.DataTransferEnd();
tftio.writeData(*(uint16_t *)(((uintptr_t)arg_ptr) + i));
tftio.dataTransferEnd();
break;
}
@@ -494,9 +494,9 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
tftio.set_window(x - 15, y, x + 15, y);
tftio.WriteMultiple(color, 31);
tftio.writeMultiple(color, 31);
tftio.set_window(x, y - 15, x, y + 15);
tftio.WriteMultiple(color, 31);
tftio.writeMultiple(color, 31);
}
void MarlinUI::touch_calibration_screen() {
@@ -508,7 +508,7 @@ U8G_PB_DEV(u8g_dev_tft_320x240_upscale_from_128x64, WIDTH, HEIGHT, PAGE_HEIGHT,
defer_status_screen(true);
stage = touch_calibration.calibration_start();
tftio.set_window(0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1);
tftio.WriteMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT));
tftio.writeMultiple(TFT_MARLINBG_COLOR, uint32_t(TFT_WIDTH) * (TFT_HEIGHT));
}
else {
// clear last cross

File diff suppressed because it is too large Load Diff

View File

@@ -133,7 +133,7 @@ typedef struct {
float Home_OffZ_scaled = 0;
float Probe_OffX_scaled = 0;
float Probe_OffY_scaled = 0;
} HMI_value_t;
} hmi_value_t;
#define DWIN_CHINESE 123
#define DWIN_ENGLISH 0
@@ -151,59 +151,59 @@ typedef struct {
bool cold_flag:1;
#endif
AxisEnum feedspeed_axis, acc_axis, jerk_axis, step_axis;
} HMI_flag_t;
} hmi_flag_t;
extern HMI_value_t HMI_ValueStruct;
extern HMI_flag_t HMI_flag;
extern hmi_value_t hmiValues;
extern hmi_flag_t hmiFlag;
#if HAS_HOTEND || HAS_HEATED_BED
// Popup message window
void DWIN_Popup_Temperature(const bool toohigh);
void dwinPopupTemperature(const bool toohigh);
#endif
#if HAS_HOTEND
void Popup_Window_ETempTooLow();
void popupWindowETempTooLow();
#endif
void Popup_Window_Resume();
void Popup_Window_Home(const bool parking=false);
void Popup_Window_Leveling();
void popupWindowResume();
void popupWindowHome(const bool parking=false);
void popupWindowLeveling();
void Goto_PrintProcess();
void Goto_MainMenu();
void gotoPrintProcess();
void gotoMainMenu();
// Variable control
void HMI_Move_X();
void HMI_Move_Y();
void HMI_Move_Z();
void HMI_Move_E();
void hmiMoveX();
void hmiMoveY();
void hmiMoveZ();
void hmiMoveE();
void HMI_Zoffset();
void hmiZoffset();
#if HAS_HOTEND
void HMI_ETemp();
void hmiETemp();
#endif
#if HAS_HEATED_BED
void HMI_BedTemp();
void hmiBedTemp();
#endif
#if HAS_FAN
void HMI_FanSpeed();
void hmiFanSpeed();
#endif
void HMI_PrintSpeed();
void hmiPrintSpeed();
void HMI_MaxFeedspeedXYZE();
void HMI_MaxAccelerationXYZE();
void HMI_MaxJerkXYZE();
void HMI_StepXYZE();
void HMI_SetLanguageCache();
void hmiMaxFeedspeedXYZE();
void hmiMaxAccelerationXYZE();
void hmiMaxJerkXYZE();
void hmiStepXYZE();
void hmiSetLanguageCache();
void update_variable();
void DWIN_Draw_Signed_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
void dwinDrawSigned_Float(uint8_t size, uint16_t bColor, uint8_t iNum, uint8_t fNum, uint16_t x, uint16_t y, long value);
// SD Card
void HMI_SDCardInit();
void HMI_SDCardUpdate();
void hmiSDCardInit();
void hmiSDCardUpdate();
// Main Process
void Icon_print(bool value);
@@ -212,39 +212,39 @@ void Icon_temperature(bool value);
void Icon_leveling(bool value);
// Other
void Draw_Status_Area(const bool with_update); // Status Area
void HMI_StartFrame(const bool with_update); // Prepare the menu view
void HMI_MainMenu(); // Main process screen
void HMI_SelectFile(); // File page
void HMI_Printing(); // Print page
void HMI_Prepare(); // Prepare page
void HMI_Control(); // Control page
void HMI_Leveling(); // Level the page
void HMI_AxisMove(); // Axis movement menu
void HMI_Temperature(); // Temperature menu
void HMI_Motion(); // Sports menu
void HMI_Info(); // Information menu
void HMI_Tune(); // Adjust the menu
void drawStatusArea(const bool with_update); // Status Area
void hmiStartFrame(const bool with_update); // Prepare the menu view
void hmiMainMenu(); // Main process screen
void hmiSelectFile(); // File page
void hmiPrinting(); // Print page
void hmiPrepare(); // Prepare page
void hmiControl(); // Control page
void hmiLeveling(); // Level the page
void hmiAxisMove(); // Axis movement menu
void hmiTemperature(); // Temperature menu
void hmiMotion(); // Sports menu
void hmiInfo(); // Information menu
void hmiTune(); // Adjust the menu
#if HAS_PREHEAT
void HMI_PLAPreheatSetting(); // PLA warm-up setting
void HMI_ABSPreheatSetting(); // ABS warm-up setting
void hmiPLAPreheatSetting(); // PLA warm-up setting
void hmiABSPreheatSetting(); // ABS warm-up setting
#endif
void HMI_MaxSpeed(); // Maximum speed submenu
void HMI_MaxAcceleration(); // Maximum acceleration submenu
void HMI_MaxJerk(); // Maximum jerk speed submenu
void HMI_Step(); // Transmission ratio
void hmiMaxSpeed(); // Maximum speed submenu
void hmiMaxAcceleration(); // Maximum acceleration submenu
void hmiMaxJerk(); // Maximum jerk speed submenu
void hmiStep(); // Transmission ratio
void HMI_Init();
void DWIN_InitScreen();
void DWIN_Update();
void EachMomentUpdate();
void DWIN_HandleScreen();
void DWIN_StatusChanged(const char * const cstr=nullptr);
void DWIN_StatusChanged(FSTR_P const fstr);
void hmiInit();
void dwinInitScreen();
void dwinUpdate();
void eachMomentUpdate();
void dwinHandleScreen();
void dwinStatusChanged(const char * const cstr=nullptr);
void dwinStatusChanged(FSTR_P const fstr);
inline void DWIN_HomingStart() { HMI_flag.home_flag = true; }
inline void dwinHomingStart() { hmiFlag.home_flag = true; }
void DWIN_HomingDone();
void DWIN_LevelingDone();
void dwinHomingDone();
void dwinLevelingDone();

View File

@@ -41,16 +41,16 @@
/*-------------------------------------- System variable function --------------------------------------*/
void DWIN_Startup() {
void dwinStartup() {
DEBUG_ECHOPGM("\r\nDWIN handshake ");
delay(750); // Delay here or init later in the boot process
if (DWIN_Handshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
DWIN_Frame_SetDir(1);
if (dwinHandshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
dwinFrameSetDir(1);
#if DISABLED(SHOW_BOOTSCREEN)
DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
#endif
DWIN_JPG_ShowAndCache(3);
DWIN_UpdateLCD();
dwinJPGShowAndCache(3);
dwinUpdateLCD();
}
/*---------------------------------------- Picture related functions ----------------------------------------*/
@@ -59,8 +59,8 @@ void DWIN_Startup() {
// 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) {
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
dwinIconShow(true, false, false, libID, picID, x, y);
}
// Copy area from virtual display area to current screen
@@ -68,17 +68,17 @@ void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
// 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, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y) {
size_t i = 0;
DWIN_Byte(i, 0x27);
DWIN_Byte(i, 0x80 | cacheID);
DWIN_Word(i, xStart);
DWIN_Word(i, yStart);
DWIN_Word(i, xEnd);
DWIN_Word(i, yEnd);
DWIN_Word(i, x);
DWIN_Word(i, y);
DWIN_Send(i);
dwinByte(i, 0x27);
dwinByte(i, 0x80 | cacheID);
dwinWord(i, xStart);
dwinWord(i, yStart);
dwinWord(i, xEnd);
dwinWord(i, yEnd);
dwinWord(i, x);
dwinWord(i, y);
dwinSend(i);
}
#endif // DWIN_CREALITY_LCD

View File

@@ -44,4 +44,4 @@
// 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, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);
void dwinFrameAreaCopy(uint8_t cacheID, uint16_t xStart, uint16_t yStart, uint16_t xEnd, uint16_t yEnd, uint16_t x, uint16_t y);

File diff suppressed because it is too large Load Diff

View File

@@ -148,7 +148,7 @@ enum colorID : uint8_t {
#define Confirm_Color 0x34B9
#define Cancel_Color 0x3186
class CrealityDWINClass {
class CrealityDWIN {
public:
static constexpr size_t eeprom_data_size = 48;
static struct EEPROM_Settings { // use bit fields to save space, max 48 bytes
@@ -173,76 +173,76 @@ public:
static constexpr const char * const color_names[11] = { "Default", "White", "Green", "Cyan", "Blue", "Magenta", "Red", "Orange", "Yellow", "Brown", "Black" };
static constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" };
static void Clear_Screen(const uint8_t e=3);
static void Draw_Float(const_float_t value, const uint8_t row, const bool selected=false, const uint8_t minunit=10);
static void Draw_Option(const uint8_t value, const char * const * options, const uint8_t row, const bool selected=false, const bool color=false);
static uint16_t GetColor(const uint8_t color, const uint16_t original, const bool light=false);
static void Draw_Checkbox(const uint8_t row, const bool value);
static void Draw_Title(const char * const title);
static void Draw_Title(FSTR_P const title);
static void Draw_Menu_Item(const uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, const bool more=false, const bool centered=false);
static void Draw_Menu_Item(const uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, const bool more=false, const bool centered=false);
static void Draw_Menu(const uint8_t menu, const uint8_t select=0, const uint8_t scroll=0);
static void Redraw_Menu(const bool lastproc=true, const bool lastsel=false, const bool lastmenu=false);
static void Redraw_Screen();
static void clearScreen(const uint8_t e=3);
static void drawFloat(const_float_t value, const uint8_t row, const bool selected=false, const uint8_t minunit=10);
static void drawOption(const uint8_t value, const char * const * options, const uint8_t row, const bool selected=false, const bool color=false);
static uint16_t getColor(const uint8_t color, const uint16_t original, const bool light=false);
static void drawCheckbox(const uint8_t row, const bool value);
static void drawTitle(const char * const title);
static void drawTitle(FSTR_P const title);
static void drawMenuItem(const uint8_t row, uint8_t icon=0, const char * const label1=nullptr, const char * const label2=nullptr, const bool more=false, const bool centered=false);
static void drawMenuItem(const uint8_t row, uint8_t icon=0, FSTR_P const flabel1=nullptr, FSTR_P const flabel2=nullptr, const bool more=false, const bool centered=false);
static void drawMenu(const uint8_t menu, const uint8_t select=0, const uint8_t scroll=0);
static void redrawMenu(const bool lastproc=true, const bool lastsel=false, const bool lastmenu=false);
static void redrawScreen();
static void Main_Menu_Icons();
static void Draw_Main_Menu(uint8_t select=0);
static void Print_Screen_Icons();
static void Draw_Print_Screen();
static void Draw_Print_Filename(const bool reset=false);
static void Draw_Print_ProgressBar();
static void mainMenuIcons();
static void drawMainMenu(uint8_t select=0);
static void printScreenIcons();
static void drawPrintScreen();
static void drawPrintFilename(const bool reset=false);
static void drawPrintProgressBar();
#if ENABLED(SET_REMAINING_TIME)
static void Draw_Print_ProgressRemain();
static void drawPrintProgressRemain();
#endif
static void Draw_Print_ProgressElapsed();
static void Draw_Print_confirm();
static void Draw_SD_Item(const uint8_t item, const uint8_t row);
static void Draw_SD_List(const bool removed=false);
static void Draw_Status_Area(const bool icons=false);
static void Draw_Popup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0);
static void Popup_Select();
static void Update_Status_Bar(const bool refresh=false);
static void drawPrintProgressElapsed();
static void drawPrintConfirm();
static void drawSDItem(const uint8_t item, const uint8_t row);
static void drawSDList(const bool removed=false);
static void drawStatusArea(const bool icons=false);
static void drawPopup(FSTR_P const line1, FSTR_P const line2, FSTR_P const line3, uint8_t mode, uint8_t icon=0);
static void popupSelect();
static void updateStatusBar(const bool refresh=false);
#if HAS_MESH
static void Set_Mesh_Viewer_Status();
static void setMeshViewerStatus();
#endif
static FSTR_P Get_Menu_Title(const uint8_t menu);
static uint8_t Get_Menu_Size(const uint8_t menu);
static void Menu_Item_Handler(const uint8_t menu, const uint8_t item, bool draw=true);
static FSTR_P getMenuTitle(const uint8_t menu);
static uint8_t getMenuSize(const uint8_t menu);
static void menuItemHandler(const uint8_t menu, const uint8_t item, bool draw=true);
static void Popup_Handler(const PopupID popupid, bool option=false);
static void Confirm_Handler(const PopupID popupid);
static void popupHandler(const PopupID popupid, bool option=false);
static void confirmHandler(const PopupID popupid);
static void Main_Menu_Control();
static void Menu_Control();
static void Value_Control();
static void Option_Control();
static void File_Control();
static void Print_Screen_Control();
static void Popup_Control();
static void Confirm_Control();
static void mainMenuControl();
static void menuControl();
static void valueControl();
static void optionControl();
static void fileControl();
static void printScreenControl();
static void popupControl();
static void confirmControl();
static void Setup_Value(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type);
static void Modify_Value(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void Modify_Value(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void Modify_Value(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void Modify_Value(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void Modify_Value(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void Modify_Value(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void Modify_Option(const uint8_t value, const char * const * options, const uint8_t max);
static void setupValue(const_float_t value, const_float_t min, const_float_t max, const_float_t unit, const uint8_t type);
static void modifyValue(float &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void modifyValue(uint8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void modifyValue(uint16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void modifyValue(int16_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void modifyValue(uint32_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void modifyValue(int8_t &value, const_float_t min, const_float_t max, const_float_t unit, void (*f)()=nullptr);
static void modifyOption(const uint8_t value, const char * const * options, const uint8_t max);
static void Update_Status(const char * const text);
static void Start_Print(const bool sd);
static void Stop_Print();
static void Update();
static void State_Update();
static void Screen_Update();
static void AudioFeedback(const bool success=true);
static void Save_Settings(char * const buff);
static void Load_Settings(const char * const buff);
static void Reset_Settings();
static void updateStatus(const char * const text);
static void startPrint(const bool sd);
static void stopPrint();
static void update();
static void stateUpdate();
static void screenUpdate();
static void audioFeedback(const bool success=true);
static void saveSettings(char * const buff);
static void loadSettings(const char * const buff);
static void resetSettings();
};
extern CrealityDWINClass CrealityDWIN;
extern CrealityDWIN crealityDWIN;

View File

@@ -33,22 +33,22 @@
/*-------------------------------------- System variable function --------------------------------------*/
void DWIN_Startup() {}
void dwinStartup() {}
/*---------------------------------------- Drawing functions ----------------------------------------*/
// Draw the degree (°) symbol
// Color: color
// color: color
// x/y: Upper-left coordinate of the first pixel
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
DWIN_Draw_Point(Color, 1, 1, x + 1, y);
DWIN_Draw_Point(Color, 1, 1, x + 2, y);
DWIN_Draw_Point(Color, 1, 1, x, y + 1);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1);
DWIN_Draw_Point(Color, 1, 1, x, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2);
DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3);
DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3);
void dwinDrawDegreeSymbol(uint16_t color, uint16_t x, uint16_t y) {
dwinDrawPoint(color, 1, 1, x + 1, y);
dwinDrawPoint(color, 1, 1, x + 2, y);
dwinDrawPoint(color, 1, 1, x, y + 1);
dwinDrawPoint(color, 1, 1, x + 3, y + 1);
dwinDrawPoint(color, 1, 1, x, y + 2);
dwinDrawPoint(color, 1, 1, x + 3, y + 2);
dwinDrawPoint(color, 1, 1, x + 1, y + 3);
dwinDrawPoint(color, 1, 1, x + 2, y + 3);
}
/*---------------------------------------- Picture related functions ----------------------------------------*/
@@ -57,8 +57,8 @@ void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
// 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) {
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
dwinIconShow(true, false, false, libID, picID, x, y);
}
#endif // DWIN_CREALITY_LCD_JYERSUI

View File

@@ -29,6 +29,6 @@
#include "../common/dwin_api.h"
// Draw the degree (°) symbol
// Color: color
// color: color
// x/y: Upper-left coordinate of the first pixel
void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y);
void dwinDrawDegreeSymbol(uint16_t color, uint16_t x, uint16_t y);

View File

@@ -39,15 +39,15 @@
/*-------------------------------------- System variable function --------------------------------------*/
void DWIN_Startup() {
void dwinStartup() {
DEBUG_ECHOPGM("\r\nDWIN handshake ");
delay(750); // Delay here or init later in the boot process
const bool success = DWIN_Handshake();
const bool success = dwinHandshake();
if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
DWIN_Frame_SetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1));
DWIN_Frame_Clear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
DWIN_JPG_ShowAndCache(3);
DWIN_UpdateLCD();
dwinFrameSetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1));
dwinFrameClear(Color_Bg_Black); // MarlinUI handles the bootscreen so just clear here
dwinJPGShowAndCache(3);
dwinUpdateLCD();
}
/*---------------------------------------- Picture related functions ----------------------------------------*/
@@ -56,8 +56,8 @@ void DWIN_Startup() {
// 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) {
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
dwinIconShow(true, false, false, libID, picID, x, y);
}
#endif // IS_DWIN_MARLINUI

View File

@@ -133,7 +133,7 @@ void DWIN_String::add_character(const char character) {
if (length < MAX_STRING_LENGTH) {
data[length] = character;
length++;
//span += glyph(character)->DWidth;
//span += glyph(character)->dWidth;
}
}
@@ -141,7 +141,7 @@ void DWIN_String::rtrim(const char character) {
while (length) {
if (data[length - 1] == 0x20 || data[length - 1] == character) {
length--;
//span -= glyph(data[length])->DWidth;
//span -= glyph(data[length])->dWidth;
eol();
}
else
@@ -152,7 +152,7 @@ void DWIN_String::rtrim(const char character) {
void DWIN_String::ltrim(const char character) {
uint16_t i, j;
for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) {
//span -= glyph(data[i])->DWidth;
//span -= glyph(data[i])->dWidth;
}
if (i == 0) return;
for (j = 0; i < length; data[j++] = data[i++]);

View File

@@ -55,7 +55,7 @@ class DWIN_String {
//static void add_glyphs(const uint8_t *font);
//static font_t *font() { return font_header; };
//static uint16_t font_height() { return font_header->FontAscent - font_header->FontDescent; }
//static uint16_t font_height() { return font_header->fontAscent - font_header->fontDescent; }
//static glyph_t *glyph(uint8_t character) { return glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */
//static glyph_t *glyph(uint8_t *character) { return glyph(*character); }

View File

@@ -56,7 +56,7 @@ void lcd_put_int(const int i) {
}
int lcd_put_dwin_string() {
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
lcd_advance_cursor(dwin_string.length);
return dwin_string.length;
}
@@ -67,7 +67,7 @@ int lcd_put_lchar_max(const lchar_t &c, const pixel_len_t max_length) {
dwin_string.set(c);
dwin_string.truncate(max_length);
// Draw the char(s) at the cursor and advance the cursor
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
lcd_advance_cursor(dwin_string.length);
return dwin_string.length;
}
@@ -92,7 +92,7 @@ static int lcd_put_u8str_max_cb(const char * utf8_str, read_byte_cb_t cb_read_by
if (!wc) break;
dwin_string.add(wc);
}
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
lcd_advance_cursor(dwin_string.length);
return dwin_string.length;
}
@@ -108,7 +108,7 @@ int lcd_put_u8str_max_P(PGM_P utf8_pstr, const pixel_len_t max_length) {
lcd_uint_t lcd_put_u8str_P(PGM_P const ptpl, const int8_t ind, const char * const cstr/*=nullptr*/, FSTR_P const fstr/*=nullptr*/, const lcd_uint_t maxlen/*=LCD_WIDTH*/) {
dwin_string.set(ptpl, ind, cstr, fstr);
dwin_string.truncate(maxlen);
DWIN_Draw_String(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
dwinDrawString(dwin_font.solid, dwin_font.index, dwin_font.fg, dwin_font.bg, cursor.x, cursor.y, dwin_string.string());
lcd_advance_cursor(dwin_string.length);
return dwin_string.length;
}

View File

@@ -78,14 +78,14 @@ void MarlinUI::set_font(const uint8_t font_nr) {
bool MarlinUI::detected() { return true; }
// Initialize or re-initialize the LCD
void MarlinUI::init_lcd() { DWIN_Startup(); }
void MarlinUI::init_lcd() { dwinStartup(); }
// This LCD should clear where it will draw anew
void MarlinUI::clear_lcd() {
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations
DWIN_JPG_ShowAndCache(3);
DWIN_Frame_Clear(Color_Bg_Black);
DWIN_UpdateLCD();
dwinIconAnimationControl(0x0000); // disable all icon animations
dwinJPGShowAndCache(3);
dwinFrameClear(Color_Bg_Black);
dwinUpdateLCD();
did_first_redraw = false;
}
@@ -109,25 +109,25 @@ void MarlinUI::clear_lcd() {
#define VERSION_Y 84
#endif
DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
clear_lcd();
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
dwinIconShow(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, LOGO_CENTER - 174 / 2, 280);
DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, LOGO_CENTER - 180 / 2, 420);
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, LOGO_CENTER - 100 / 2, 440);
DWIN_ICON_Show(BOOT_ICON, ICON_Copyright, LOGO_CENTER - 126 / 2, 460);
dwinIconShow(BOOT_ICON, ICON_OpenSource, LOGO_CENTER - 174 / 2, 280);
dwinIconShow(BOOT_ICON, ICON_GitHubURL, LOGO_CENTER - 180 / 2, 420);
dwinIconShow(BOOT_ICON, ICON_MarlinURL, LOGO_CENTER - 100 / 2, 440);
dwinIconShow(BOOT_ICON, ICON_Copyright, LOGO_CENTER - 126 / 2, 460);
#else
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, INFO_CENTER - 174 / 2, 60);
DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, INFO_CENTER - 180 / 2, 130);
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152);
DWIN_ICON_Show(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200);
dwinIconShow(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
dwinIconShow(BOOT_ICON, ICON_OpenSource, INFO_CENTER - 174 / 2, 60);
dwinIconShow(BOOT_ICON, ICON_GitHubURL, INFO_CENTER - 180 / 2, 130);
dwinIconShow(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152);
dwinIconShow(BOOT_ICON, ICON_Copyright, INFO_CENTER - 126 / 2, 200);
#endif
DWIN_Draw_String(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
DWIN_UpdateLCD();
dwinDrawString(false, font10x20, Color_Yellow, Color_Bg_Black, INFO_CENTER - (dwin_string.length * 10) / 2, VERSION_Y, S(dwin_string.string()));
dwinUpdateLCD();
}
void MarlinUI::bootscreen_completion(const millis_t sofar) {
@@ -140,23 +140,23 @@ void MarlinUI::clear_lcd() {
// The kill screen is displayed for unrecoverable conditions
void MarlinUI::draw_kill_screen() {
set_font(DWIN_FONT_ALERT);
DWIN_Frame_Clear(Color_Bg_Black);
dwinFrameClear(Color_Bg_Black);
dwin_font.fg = Color_Error_Red;
dwin_font.solid = false;
DWIN_Draw_Rectangle(1, Color_Bg_Window, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
dwinDrawRectangle(1, Color_Bg_Window, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
// make the frame a few pixels thick
DWIN_Draw_Rectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
DWIN_Draw_Rectangle(0, Color_Yellow, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21);
DWIN_Draw_Rectangle(0, Color_Yellow, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22);
dwinDrawRectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
dwinDrawRectangle(0, Color_Yellow, 21, 21, LCD_PIXEL_WIDTH - 21, LCD_PIXEL_HEIGHT - 21);
dwinDrawRectangle(0, Color_Yellow, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22);
uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2),
cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2);
#if ENABLED(DWIN_MARLINUI_LANDSCAPE)
cx += (96 / 2 / dwin_font.width);
DWIN_ICON_Show(ICON, ICON_Halted, 40, (LCD_PIXEL_HEIGHT - 96) / 2);
dwinIconShow(ICON, ICON_Halted, 40, (LCD_PIXEL_HEIGHT - 96) / 2);
#else
DWIN_ICON_Show(ICON, ICON_Halted, (LCD_PIXEL_WIDTH - 96) / 2, 40);
dwinIconShow(ICON, ICON_Halted, (LCD_PIXEL_WIDTH - 96) / 2, 40);
#endif
uint8_t slen = utf8_strlen(status_message);
@@ -260,7 +260,7 @@ void MarlinUI::draw_status_message(const bool blink) {
}
#if HAS_LCD_BRIGHTNESS
void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); }
void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); }
#endif
#if HAS_MARLINUI_MENU
@@ -295,13 +295,13 @@ void MarlinUI::draw_status_message(const bool blink) {
if (y >= LCD_PIXEL_HEIGHT) return false;
if (is_static && sel)
DWIN_Draw_Box(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
dwinDrawBox(1, Color_Bg_Heading, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
else {
#if ENABLED(MENU_HOLLOW_FRAME)
DWIN_Draw_Box(1, Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
if (sel) DWIN_Draw_Box(0, Select_Color, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
dwinDrawBox(1, Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
if (sel) dwinDrawBox(0, Select_Color, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
#else
DWIN_Draw_Box(1, sel ? Select_Color : Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
dwinDrawBox(1, sel ? Select_Color : Color_Bg_Black, 0, y, LCD_PIXEL_WIDTH, MENU_LINE_HEIGHT - 1);
#endif
}
@@ -425,7 +425,7 @@ void MarlinUI::draw_status_message(const bool blink) {
dwin_string.set(value);
const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2;
DWIN_Draw_String(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string()));
dwinDrawString(true, font16x32, Color_Yellow, Color_Bg_Black, (LCD_PIXEL_WIDTH - vallen * 16) / 2, by, S(dwin_string.string()));
if (ui.can_show_slider()) {
@@ -435,11 +435,11 @@ void MarlinUI::draw_status_message(const bool blink) {
slider_y = by + 32 + 4,
amount = ui.encoderPosition * slider_length / maxEditValue;
DWIN_Draw_Rectangle(1, Color_Bg_Window, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1);
dwinDrawRectangle(1, Color_Bg_Window, slider_x - 1, slider_y - 1, slider_x - 1 + slider_length + 2 - 1, slider_y - 1 + slider_height + 2 - 1);
if (amount > 0)
DWIN_Draw_Box(1, BarFill_Color, slider_x, slider_y, amount, slider_height);
dwinDrawBox(1, BarFill_Color, slider_x, slider_y, amount, slider_height);
if (amount < slider_length)
DWIN_Draw_Box(1, Color_Bg_Black, slider_x + amount, slider_y, slider_length - amount, slider_height);
dwinDrawBox(1, Color_Bg_Black, slider_x + amount, slider_y, slider_length - amount, slider_height);
}
}
}
@@ -450,7 +450,7 @@ void MarlinUI::draw_status_message(const bool blink) {
col = yesopt ? LCD_WIDTH - mar - len : mar,
row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1);
lcd_moveto(col, row);
DWIN_Draw_Box(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2);
dwinDrawBox(1, inv ? Select_Color : Color_Bg_Black, cursor.x - dwin_font.width, cursor.y + 1, dwin_font.width * (len + 2), dwin_font.height + 2);
lcd_put_u8str(col, row, fstr);
}
@@ -512,9 +512,9 @@ void MarlinUI::draw_status_message(const bool blink) {
// Clear the Mesh Map
// First draw the bigger box in White so we have a border around the mesh map box
DWIN_Draw_Rectangle(1, Color_White, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels);
dwinDrawRectangle(1, Color_White, x_offset - 2, y_offset - 2, x_offset + 2 + x_map_pixels, y_offset + 2 + y_map_pixels);
// Now actually clear the mesh map box
DWIN_Draw_Rectangle(1, Color_Bg_Black, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels);
dwinDrawRectangle(1, Color_Bg_Black, x_offset, y_offset, x_offset + x_map_pixels, y_offset + y_map_pixels);
// Fill in the Specified Mesh Point
@@ -522,7 +522,7 @@ void MarlinUI::draw_status_message(const bool blink) {
// invert the Y to get it to plot in the right location.
const dwin_coord_t by = y_offset + y_plot_inv * pixels_per_y_mesh_pnt;
DWIN_Draw_Rectangle(1, Select_Color,
dwinDrawRectangle(1, Select_Color,
x_offset + (x_plot * pixels_per_x_mesh_pnt), by,
x_offset + (x_plot * pixels_per_x_mesh_pnt) + pixels_per_x_mesh_pnt, by + pixels_per_y_mesh_pnt
);
@@ -532,7 +532,7 @@ void MarlinUI::draw_status_message(const bool blink) {
dwin_coord_t y = y_offset + pixels_per_y_mesh_pnt / 2;
for (uint8_t j = 0; j < (GRID_MAX_POINTS_Y); j++, y += pixels_per_y_mesh_pnt)
for (uint8_t i = 0, x = sx; i < (GRID_MAX_POINTS_X); i++, x += pixels_per_x_mesh_pnt)
DWIN_Draw_Point(Color_White, 1, 1, x, y);
dwinDrawPoint(Color_White, 1, 1, x, y);
// Put Relevant Text on Display
@@ -591,17 +591,17 @@ void MarlinUI::draw_status_message(const bool blink) {
const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20;
// Draw a representation of the nozzle
DWIN_Draw_Box(1, Color_Bg_Black, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down
DWIN_ICON_Show(ICON, ICON_HotendOff, nozzle + 3, 10 - dir);
DWIN_ICON_Show(ICON, ICON_BedLine, nozzle, 10 + 36);
dwinDrawBox(1, Color_Bg_Black, nozzle + 3, 8, 48, 52); // 'clear' the area where the nozzle is drawn in case it was moved up/down
dwinIconShow(ICON, ICON_HotendOff, nozzle + 3, 10 - dir);
dwinIconShow(ICON, ICON_BedLine, nozzle, 10 + 36);
// Draw cw/ccw indicator and up/down arrows
const int arrow_y = LCD_PIXEL_HEIGHT / 2 - 24;
DWIN_ICON_Show(ICON, ICON_DownArrow, 0, arrow_y - dir);
DWIN_ICON_Show(ICON, rot_down, 48, arrow_y);
dwinIconShow(ICON, ICON_DownArrow, 0, arrow_y - dir);
dwinIconShow(ICON, rot_down, 48, arrow_y);
DWIN_ICON_Show(ICON, ICON_UpArrow, LCD_PIXEL_WIDTH - 10 - (48*2), arrow_y - dir);
DWIN_ICON_Show(ICON, rot_up, LCD_PIXEL_WIDTH - 10 - 48, arrow_y);
dwinIconShow(ICON, ICON_UpArrow, LCD_PIXEL_WIDTH - 10 - (48*2), arrow_y - dir);
dwinIconShow(ICON, rot_up, LCD_PIXEL_WIDTH - 10 - 48, arrow_y);
}
#endif // BABYSTEP_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY

View File

@@ -72,7 +72,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning();
if (x_redraw) {
dwin_string.set('X' + axis);
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black,
dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black,
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
x + (utf8_strlen(value) * 14 - 14) / 2, y + 2
#else
@@ -96,7 +96,7 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
if (TERN0(LCD_SHOW_E_TOTAL, x_redraw && axis == X_AXIS))
dwin_string.add(F(" "));
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black,
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black,
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
x, y + 32
#else
@@ -117,26 +117,26 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
if (e_redraw) {
// Extra spaces to erase previous value
dwin_string.set(F("E "));
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string()));
dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x + (4 * 14 / 2) - 7, y + 2, S(dwin_string.string()));
}
dwin_string.set(ui16tostr5rj(value / scale));
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 32, S(dwin_string.string()));
// Extra spaces to erase previous value
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm "));
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (5 * 14), y + 32, S(scale == 1 ? "mm " : "cm "));
#else // !DWIN_MARLINUI_PORTRAIT
if (e_redraw) {
dwin_string.set(F("E "));
DWIN_Draw_String(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
dwinDrawString(true, font16x32, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
}
dwin_string.set(ui16tostr5rj(value / scale));
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 32, y + 4, S(dwin_string.string()));
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm "));
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x + (32 + 70), y + 4, S(scale == 1 ? "mm " : "cm "));
#endif // !DWIN_MARLINUI_PORTRAIT
}
@@ -151,16 +151,16 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
const uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2;
const bool fan_on = !!thermalManager.scaledFanSpeed(0);
if (fan_on) {
DWIN_ICON_Animation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25);
dwinIconAnimation(0, fan_on, ICON, ICON_Fan0, ICON_Fan3, x + fanx, y, 25);
dwin_string.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0)));
dwin_string.add('%');
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
}
else {
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one)
DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y);
dwinIconAnimationControl(0x0000); // disable all icon animations (this is the only one)
dwinIconShow(ICON, ICON_Fan0, x + fanx, y);
dwin_string.set(F(" "));
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + STATUS_FAN_HEIGHT, S(dwin_string.string()));
}
}
#endif
@@ -230,20 +230,20 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
if (t_draw) {
dwin_string.set(i16tostr3rj(tt + 0.5));
dwin_string.add(LCD_STR_DEGREE);
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y, S(dwin_string.string()));
}
// Draw heater icon with on / off / leveled states
if (i_draw) {
const uint8_t ico = isBed ? (TERN0(HAS_LEVELING, planner.leveling_active) ? ICON_BedLevelOff : ICON_BedOff) : ICON_HotendOff;
DWIN_ICON_Show(ICON, ico + ta, x, y + STATUS_CHR_HEIGHT + 2);
dwinIconShow(ICON, ico + ta, x, y + STATUS_CHR_HEIGHT + 2);
}
// Draw current temperature, if needed
if (c_draw) {
dwin_string.set(i16tostr3rj(tc + 0.5));
dwin_string.add(LCD_STR_DEGREE);
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x, y + 70, S(dwin_string.string()));
}
}
@@ -253,12 +253,12 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t y) {
if (!ui.did_first_redraw) {
dwin_string.set(LCD_STR_FEEDRATE);
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, x, y, S(dwin_string.string()));
}
dwin_string.set(value);
dwin_string.add('%');
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, x + 14, y, S(dwin_string.string()));
}
/**
@@ -272,7 +272,7 @@ void MarlinUI::draw_status_screen() {
// Logo/Status Icon
#define STATUS_LOGO_WIDTH 128
#define STATUS_LOGO_HEIGHT 40
DWIN_ICON_Show(ICON, ICON_LOGO_Marlin,
dwinIconShow(ICON, ICON_LOGO_Marlin,
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
(LCD_PIXEL_WIDTH - (STATUS_LOGO_WIDTH)) / 2, ((STATUS_HEATERS_Y - 4) - (STATUS_LOGO_HEIGHT)) / 2
#else
@@ -281,7 +281,7 @@ void MarlinUI::draw_status_screen() {
);
// Draw a frame around the x/y/z values
DWIN_Draw_Rectangle(0, Select_Color,
dwinDrawRectangle(0, Select_Color,
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
0, 193, LCD_PIXEL_WIDTH - 1, 260
#else
@@ -358,7 +358,7 @@ void MarlinUI::draw_status_screen() {
time.toDigital(buffer);
dwin_string.add(prefix);
dwin_string.add(buffer);
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, (LCD_PIXEL_WIDTH - ((dwin_string.length + 1) * 14)), 290, S(dwin_string.string()));
#else
@@ -367,23 +367,23 @@ void MarlinUI::draw_status_screen() {
time.toDigital(buffer);
dwin_string.set(' ');
dwin_string.add(buffer);
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 230, 170, S(dwin_string.string()));
#if ENABLED(SHOW_REMAINING_TIME)
if (print_job_timer.isRunning()) {
time = get_remaining_time();
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R "));
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(" R "));
if (print_job_timer.isPaused() && blink)
dwin_string.set(F(" "));
else {
time.toDigital(buffer);
dwin_string.set(buffer);
}
DWIN_Draw_String(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_White, Color_Bg_Black, 378, 170, S(dwin_string.string()));
}
else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) {
dwin_string.set(F(" "));
DWIN_Draw_String(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string()));
dwinDrawString(true, font14x28, Color_IconBlue, Color_Bg_Black, 336, 170, S(dwin_string.string()));
}
#endif
#endif
@@ -403,7 +403,7 @@ void MarlinUI::draw_status_screen() {
const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
if (!ui.did_first_redraw)
DWIN_Draw_Rectangle(0, Select_Color, pb_left, pb_top, pb_right, pb_bottom); // Outline
dwinDrawRectangle(0, Select_Color, pb_left, pb_top, pb_right, pb_bottom); // Outline
static uint16_t old_solid = 50;
const uint16_t pb_solid = (pb_width - 2) * (progress / (PROGRESS_SCALE)) * 0.01f;
@@ -411,15 +411,15 @@ void MarlinUI::draw_status_screen() {
if (p_draw) {
//if (pb_solid)
DWIN_Draw_Rectangle(1, Select_Color, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part
dwinDrawRectangle(1, Select_Color, pb_left + 1, pb_top + 1, pb_left + pb_solid, pb_bottom - 1); // Fill the solid part
//if (pb_solid < old_solid)
DWIN_Draw_Rectangle(1, Color_Bg_Black, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest
dwinDrawRectangle(1, Color_Bg_Black, pb_left + 1 + pb_solid, pb_top + 1, pb_right - 1, pb_bottom - 1); // Erase the rest
#if ENABLED(SHOW_PROGRESS_PERCENT)
dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
dwin_string.add('%');
DWIN_Draw_String(
dwinDrawString(
false, font16x32, Percent_Color, Color_Bg_Black,
pb_left + (pb_width - dwin_string.length * 16) / 2,
pb_top + (pb_height - 32) / 2 - 1,

View File

@@ -39,7 +39,7 @@
namespace Anycubic {
void PlayTune(const uint16_t *tune, const uint8_t speed/*=1*/) {
void playTune(const uint16_t *tune, const uint8_t speed/*=1*/) {
const uint16_t wholenotelen = tune[0] / speed;
for (uint8_t pos = 1; pos < MAX_TUNE_LENGTH; pos += 2) {
const uint16_t freq = tune[pos];

View File

@@ -61,7 +61,7 @@ n_END=10000 // end of tune marker
namespace Anycubic {
void PlayTune(const uint16_t *tune, const uint8_t speed=1);
void playTune(const uint16_t *tune, const uint8_t speed=1);
// Only uncomment the tunes you are using to save memory
// This will help you write tunes!

View File

@@ -103,7 +103,7 @@ void ChironTFT::startup() {
injectCommands(AC_cmnd_enable_leveling);
// startup tunes are defined in Tunes.h
PlayTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn));
playTune(TERN(AC_DEFAULT_STARTUP_TUNE, Anycubic_PowerOn, GB_PowerOn));
#if ACDEBUGLEVEL
DEBUG_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
@@ -191,7 +191,7 @@ void ChironTFT::filamentRunout() {
// 1 Signal filament out
last_error = AC_error_filament_runout;
tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
PlayTune(FilamentOut);
playTune(FilamentOut);
}
void ChironTFT::confirmationRequest(const char * const msg) {
@@ -214,7 +214,7 @@ void ChironTFT::confirmationRequest(const char * const msg) {
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
pause_state = AC_paused_heater_timed_out;
tftSendLn(AC_msg_paused); // enable continue button
PlayTune(HeaterTimeout);
playTune(HeaterTimeout);
}
// Reheat finished, send acknowledgement
else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) {
@@ -252,7 +252,7 @@ void ChironTFT::statusChange(const char * const msg) {
}
// If probing fails don't save the mesh raise the probe above the bad point
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
PlayTune(BeepBeepBeeep);
playTune(BeepBeepBeeep);
injectCommands(F("G1 Z50 F500"));
tftSendLn(AC_msg_probing_complete);
printer_state = AC_printer_idle;
@@ -306,7 +306,7 @@ void ChironTFT::statusChange(const char * const msg) {
void ChironTFT::powerLossRecovery() {
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
last_error = AC_error_powerloss;
PlayTune(SOS);
playTune(SOS);
SERIAL_ECHOLN(AC_msg_powerloss_recovery);
}

View File

@@ -24,7 +24,7 @@
#if ENABLED(ANYCUBIC_LCD_I3MEGA)
//#define ANYCUBIC_LCD_DEBUG
#define DEBUG_OUT ANYCUBIC_LCD_DEBUG
#define DEBUG_OUT ENABLED(ANYCUBIC_LCD_DEBUG)
#include "../../../core/debug_out.h"
#include "anycubic_i3mega_lcd.h"
@@ -51,20 +51,19 @@
#define SPECIAL_MENU_FILENAME(A) A TERN_(ANYCUBIC_LCD_GCODE_EXT, ".gcode")
#define SPECIAL_MENU_ALTNAME(A, B) TERN(ANYCUBIC_LCD_GCODE_EXT, A ".gcode", B)
AnycubicTFTClass anycubicTFT;
AnycubicTFT anycubicTFT;
char AnycubicTFTClass::tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
int AnycubicTFTClass::tftBufLen = 0,
AnycubicTFTClass::tftBufIndR = 0,
AnycubicTFTClass::tftBufIndW = 0;
char AnycubicTFTClass::serial3_char;
char* AnycubicTFTClass::tftStrchrPtr;
uint8_t AnycubicTFTClass::specialMenu = false;
AnycubicMediaPrintState AnycubicTFTClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
AnycubicMediaPauseState AnycubicTFTClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
char AnycubicTFT::tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
int AnycubicTFT::tftBufLen = 0,
AnycubicTFT::tftBufIndR = 0,
AnycubicTFT::tftBufIndW = 0;
char* AnycubicTFT::tftStrchrPtr;
uint8_t AnycubicTFT::specialMenu = false;
AnycubicMediaPrintState AnycubicTFT::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
AnycubicMediaPauseState AnycubicTFT::mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
char AnycubicTFTClass::selectedDirectory[30];
char AnycubicTFTClass::selectedFile[FILENAME_LENGTH];
char AnycubicTFT::selectedDirectory[30];
char AnycubicTFT::selectedFile[FILENAME_LENGTH];
// Serial helpers
static void sendNewLine() { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); }
@@ -78,9 +77,9 @@ static void sendLine_P(PGM_P str) { send_P(str); sendNewLine(); }
using namespace ExtUI;
AnycubicTFTClass::AnycubicTFTClass() {}
AnycubicTFT::AnycubicTFT() {}
void AnycubicTFTClass::onSetup() {
void AnycubicTFT::onSetup() {
#ifndef LCD_BAUDRATE
#define LCD_BAUDRATE 115200
#endif
@@ -110,7 +109,7 @@ void AnycubicTFTClass::onSetup() {
DEBUG_ECHOLNPGM("TFT Serial Debug: Finished startup");
}
void AnycubicTFTClass::onCommandScan() {
void AnycubicTFT::onCommandScan() {
static millis_t nextStopCheck = 0; // used to slow the stopped print check down to reasonable times
const millis_t ms = millis();
if (ELAPSED(ms, nextStopCheck)) {
@@ -135,26 +134,26 @@ void AnycubicTFTClass::onCommandScan() {
}
}
void AnycubicTFTClass::onKillTFT() {
void AnycubicTFT::onKillTFT() {
SENDLINE_DBG_PGM("J11", "TFT Serial Debug: Kill command... J11");
}
void AnycubicTFTClass::onSDCardStateChange(bool isInserted) {
void AnycubicTFT::onSDCardStateChange(bool isInserted) {
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isInserted);
doSDCardStateCheck();
}
void AnycubicTFTClass::onSDCardError() {
void AnycubicTFT::onSDCardError() {
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardError event triggered...");
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: On SD Card Error ... J21");
}
void AnycubicTFTClass::onFilamentRunout() {
void AnycubicTFT::onFilamentRunout() {
DEBUG_ECHOLNPGM("TFT Serial Debug: onFilamentRunout triggered...");
doFilamentRunoutCheck();
}
void AnycubicTFTClass::onUserConfirmRequired(const char * const msg) {
void AnycubicTFT::onUserConfirmRequired(const char * const msg) {
DEBUG_ECHOLNPGM("TFT Serial Debug: onUserConfirmRequired triggered... ", msg);
#if HAS_MEDIA
@@ -206,23 +205,23 @@ void AnycubicTFTClass::onUserConfirmRequired(const char * const msg) {
#endif
}
float AnycubicTFTClass::codeValue() {
float AnycubicTFT::codeValue() {
return (strtod(&tftCommands[tftBufIndR][tftStrchrPtr - tftCommands[tftBufIndR] + 1], nullptr));
}
bool AnycubicTFTClass::codeSeen(char code) {
bool AnycubicTFT::codeSeen(char code) {
tftStrchrPtr = strchr(tftCommands[tftBufIndR], code);
return !!tftStrchrPtr; // Return True if a character was found
}
bool AnycubicTFTClass::isNozzleHomed() {
bool AnycubicTFT::isNozzleHomed() {
const float xPosition = getAxisPosition_mm((axis_t) X);
const float yPosition = getAxisPosition_mm((axis_t) Y);
return WITHIN(xPosition, X_MIN_POS - 0.1, X_MIN_POS + 0.1) &&
WITHIN(yPosition, Y_MIN_POS - 0.1, Y_MIN_POS + 0.1);
}
void AnycubicTFTClass::handleSpecialMenu() {
void AnycubicTFT::handleSpecialMenu() {
/**
* NOTE: that the file selection command actual lowercases the entire selected file/foldername, so charracter comparisons need to be lowercase.
*/
@@ -355,7 +354,7 @@ void AnycubicTFTClass::handleSpecialMenu() {
}
void AnycubicTFTClass::renderCurrentFileList() {
void AnycubicTFT::renderCurrentFileList() {
#if HAS_MEDIA
uint16_t selectedNumber = 0;
selectedDirectory[0] = 0;
@@ -383,7 +382,7 @@ void AnycubicTFTClass::renderCurrentFileList() {
#endif // HAS_MEDIA
}
void AnycubicTFTClass::renderSpecialMenu(uint16_t selectedNumber) {
void AnycubicTFT::renderSpecialMenu(uint16_t selectedNumber) {
switch (selectedNumber) {
default: break;
@@ -450,7 +449,7 @@ void AnycubicTFTClass::renderSpecialMenu(uint16_t selectedNumber) {
}
}
void AnycubicTFTClass::renderCurrentFolder(uint16_t selectedNumber) {
void AnycubicTFT::renderCurrentFolder(uint16_t selectedNumber) {
FileList currentFileList;
const uint16_t dir_files = currentFileList.count(),
max_files = (dir_files - selectedNumber) < 4 ? dir_files : selectedNumber + 3;
@@ -485,14 +484,14 @@ void AnycubicTFTClass::renderCurrentFolder(uint16_t selectedNumber) {
}
}
void AnycubicTFTClass::onPrintTimerStarted() {
void AnycubicTFT::onPrintTimerStarted() {
#if HAS_MEDIA
if (mediaPrintingState == AMPRINTSTATE_PRINTING)
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... J04"); // J04 Starting Print
#endif
}
void AnycubicTFTClass::onPrintTimerPaused() {
void AnycubicTFT::onPrintTimerPaused() {
#if HAS_MEDIA
if (isPrintingFromMedia()) {
mediaPrintingState = AMPRINTSTATE_PAUSED;
@@ -501,7 +500,7 @@ void AnycubicTFTClass::onPrintTimerPaused() {
#endif
}
void AnycubicTFTClass::onPrintTimerStopped() {
void AnycubicTFT::onPrintTimerStopped() {
#if HAS_MEDIA
if (mediaPrintingState == AMPRINTSTATE_PRINTING) {
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
@@ -514,7 +513,7 @@ void AnycubicTFTClass::onPrintTimerStopped() {
#define ROUND(val) int((val)+0.5f)
void AnycubicTFTClass::getCommandFromTFT() {
void AnycubicTFT::getCommandFromTFT() {
static int serial_count = 0;
char *starpos = nullptr;
@@ -884,7 +883,7 @@ void AnycubicTFTClass::getCommandFromTFT() {
} // while
}
void AnycubicTFTClass::doSDCardStateCheck() {
void AnycubicTFT::doSDCardStateCheck() {
#if ALL(HAS_MEDIA, HAS_SD_DETECT)
bool isInserted = isMediaInserted();
if (isInserted)
@@ -895,7 +894,7 @@ void AnycubicTFTClass::doSDCardStateCheck() {
#endif
}
void AnycubicTFTClass::doFilamentRunoutCheck() {
void AnycubicTFT::doFilamentRunoutCheck() {
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
// NOTE: getFilamentRunoutState() only returns the runout state if the job is printing
// we want to actually check the status of the pin here, regardless of printstate
@@ -914,7 +913,7 @@ void AnycubicTFTClass::doFilamentRunoutCheck() {
#endif // FILAMENT_RUNOUT_SENSOR
}
void AnycubicTFTClass::startPrint() {
void AnycubicTFT::startPrint() {
#if HAS_MEDIA
if (!isPrinting() && strlen(selectedFile) > 0) {
DEBUG_ECHOLNPGM("TFT Serial Debug: About to print file ... ", isPrinting(), " ", selectedFile);
@@ -925,7 +924,7 @@ void AnycubicTFTClass::startPrint() {
#endif // SDUPPORT
}
void AnycubicTFTClass::pausePrint() {
void AnycubicTFT::pausePrint() {
#if HAS_MEDIA
if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) {
mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED;
@@ -939,7 +938,7 @@ void AnycubicTFTClass::pausePrint() {
#endif
}
void AnycubicTFTClass::resumePrint() {
void AnycubicTFT::resumePrint() {
#if HAS_MEDIA
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
if (READ(FIL_RUNOUT1_PIN)) {
@@ -973,7 +972,7 @@ void AnycubicTFTClass::resumePrint() {
#endif
}
void AnycubicTFTClass::stopPrint() {
void AnycubicTFT::stopPrint() {
#if HAS_MEDIA
mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED;
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;

View File

@@ -45,9 +45,9 @@ enum AnycubicMediaPauseState {
AMPAUSESTATE_REHEAT_FINISHED
};
class AnycubicTFTClass {
class AnycubicTFT {
public:
AnycubicTFTClass();
AnycubicTFT();
static void onSetup();
static void onCommandScan();
static void onKillTFT();
@@ -88,5 +88,5 @@ private:
static char selectedFile[FILENAME_LENGTH];
};
extern AnycubicTFTClass anycubicTFT;
extern AnycubicTFT anycubicTFT;
extern const char G28_STR[];

View File

@@ -91,7 +91,7 @@ namespace Anycubic {
if (filelist.seek(_seek)) {
//sendFile();
DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0 + file_num*0x30);
DgusTFT::sendTxtToTFT(filelist.longFilename(), TXT_FILE_0 + file_num*0x30);
#if ACDEBUG(AC_FILE)
SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n");
@@ -102,7 +102,7 @@ namespace Anycubic {
SERIAL_ECHOLNPGM("over seek: ", _seek);
#endif
DgusTFT::SendTxtToTFT("\0", TXT_FILE_0 + file_num*0x30);
DgusTFT::sendTxtToTFT("\0", TXT_FILE_0 + file_num*0x30);
}
file_num++;
@@ -115,7 +115,7 @@ namespace Anycubic {
// Permitted special characters in file name: -_*#~
// Panel can display 22 characters per line.
if (!filelist.isDir())
DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0);
DgusTFT::sendTxtToTFT(filelist.longFilename(), TXT_FILE_0);
}
void FileNavigator::changeDIR(char *folder) {

File diff suppressed because it is too large Load Diff

View File

@@ -453,7 +453,7 @@ namespace Anycubic {
static void tftSend(FSTR_P const=nullptr);
static void tftSendLn(FSTR_P const=nullptr);
static bool readTFTCommand();
static int8_t Findcmndpos(const char *, const char);
static int8_t findCmdPos(const char *, const char);
static void checkHeaters();
static void sendFileList(int8_t);
static void selectFile();
@@ -475,5 +475,5 @@ namespace Anycubic {
};
extern DgusTFT Dgus;
extern DgusTFT dgus;
}

View File

@@ -37,17 +37,17 @@ using namespace Anycubic;
namespace ExtUI {
void onStartup() { Dgus.startup(); }
void onStartup() { dgus.startup(); }
void onIdle() { Dgus.idleLoop(); }
void onIdle() { dgus.idleLoop(); }
void onPrinterKilled(FSTR_P const error, FSTR_P const component) {
Dgus.printerKilled(error, component);
dgus.printerKilled(error, component);
}
void onMediaInserted() { Dgus.mediaEvent(AC_media_inserted); }
void onMediaError() { Dgus.mediaEvent(AC_media_error); }
void onMediaRemoved() { Dgus.mediaEvent(AC_media_removed); }
void onMediaInserted() { dgus.mediaEvent(AC_media_inserted); }
void onMediaError() { dgus.mediaEvent(AC_media_error); }
void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); }
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
#if ENABLED(SPEAKER)
@@ -55,22 +55,22 @@ namespace ExtUI {
#endif
}
void onPrintTimerStarted() { Dgus.timerEvent(AC_timer_started); }
void onPrintTimerPaused() { Dgus.timerEvent(AC_timer_paused); }
void onPrintTimerStopped() { Dgus.timerEvent(AC_timer_stopped); }
void onPrintTimerStarted() { dgus.timerEvent(AC_timer_started); }
void onPrintTimerPaused() { dgus.timerEvent(AC_timer_paused); }
void onPrintTimerStopped() { dgus.timerEvent(AC_timer_stopped); }
void onPrintDone() {}
void onFilamentRunout(const extruder_t) { Dgus.filamentRunout(); }
void onFilamentRunout(const extruder_t) { dgus.filamentRunout(); }
void onUserConfirmRequired(const char * const msg) { Dgus.confirmationRequest(msg); }
void onStatusChanged(const char * const msg) { Dgus.statusChange(msg); }
void onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); }
void onStatusChanged(const char * const msg) { dgus.statusChange(msg); }
void onHomingStart() { Dgus.HomingStart(); }
void onHomingDone() { Dgus.HomingComplete(); }
void onHomingStart() { dgus.homingStart(); }
void onHomingDone() { dgus.homingComplete(); }
void onFactoryReset() {
Dgus.page_index_now = 121;
Dgus.lcd_info.audio_on = DISABLED(SPEAKER);
dgus.page_index_now = 121;
dgus.lcd_info.audio_on = DISABLED(SPEAKER);
}
void onStoreSettings(char *buff) {
@@ -78,8 +78,8 @@ namespace ExtUI {
// permanent data to be stored, it can write up to eeprom_data_size bytes
// into buff.
static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size);
memcpy(buff, &Dgus.lcd_info, sizeof(Dgus.lcd_info));
static_assert(sizeof(dgus.lcd_info) <= ExtUI::eeprom_data_size);
memcpy(buff, &dgus.lcd_info, sizeof(dgus.lcd_info));
}
void onLoadSettings(const char *buff) {
@@ -87,15 +87,15 @@ namespace ExtUI {
// needs to retrieve data, it should copy up to eeprom_data_size bytes
// from buff
static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size);
memcpy(&Dgus.lcd_info, buff, sizeof(Dgus.lcd_info));
memcpy(&Dgus.lcd_info_back, buff, sizeof(Dgus.lcd_info_back));
static_assert(sizeof(dgus.lcd_info) <= ExtUI::eeprom_data_size);
memcpy(&dgus.lcd_info, buff, sizeof(dgus.lcd_info));
memcpy(&dgus.lcd_info_back, buff, sizeof(dgus.lcd_info_back));
}
void onPostprocessSettings() {
// Called after loading or resetting stored settings
Dgus.ParamInit();
Dgus.PowerLoss();
dgus.paramInit();
dgus.powerLoss();
}
void onSettingsStored(const bool success) {
@@ -127,11 +127,11 @@ namespace ExtUI {
#if ENABLED(POWER_LOSS_RECOVERY)
// Called when power-loss is enabled/disabled
void onSetPowerLoss(const bool) { Dgus.PowerLoss(); }
void onSetPowerLoss(const bool) { dgus.powerLoss(); }
// Called when power-loss state is detected
void onPowerLoss() { /* handled internally */ }
// Called on resume from power-loss
void onPowerLossResume() { Dgus.powerLossRecovery(); }
void onPowerLossResume() { dgus.powerLossRecovery(); }
#endif
#if HAS_PID_HEATING

View File

@@ -32,7 +32,7 @@
#include "../../../gcode/queue.h"
#if HAS_MEDIA
bool DGUSSetupHandler::Print() {
bool DGUSSetupHandler::print() {
screen.filelist.refresh();
while (!screen.filelist.isAtRootDir()) {
@@ -46,7 +46,7 @@
}
#endif
bool DGUSSetupHandler::PrintStatus() {
bool DGUSSetupHandler::printStatus() {
if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) {
return true;
}
@@ -55,7 +55,7 @@ bool DGUSSetupHandler::PrintStatus() {
return false;
}
bool DGUSSetupHandler::PrintAdjust() {
bool DGUSSetupHandler::printAdjust() {
if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) {
return true;
}
@@ -64,7 +64,7 @@ bool DGUSSetupHandler::PrintAdjust() {
return false;
}
bool DGUSSetupHandler::LevelingMenu() {
bool DGUSSetupHandler::levelingMenu() {
ExtUI::setLevelingActive(screen.leveling_active);
if (!screen.isPrinterIdle()) {
@@ -87,7 +87,7 @@ bool DGUSSetupHandler::LevelingMenu() {
return false;
}
bool DGUSSetupHandler::LevelingManual() {
bool DGUSSetupHandler::levelingManual() {
ExtUI::setLevelingActive(false);
if (ExtUI::isPositionKnown()) {
@@ -106,7 +106,7 @@ bool DGUSSetupHandler::LevelingManual() {
return false;
}
bool DGUSSetupHandler::LevelingOffset() {
bool DGUSSetupHandler::levelingOffset() {
screen.offset_steps = DGUS_Data::StepSize::MMP1;
if (!screen.isPrinterIdle()) {
@@ -135,7 +135,7 @@ bool DGUSSetupHandler::LevelingOffset() {
return false;
}
bool DGUSSetupHandler::LevelingAutomatic() {
bool DGUSSetupHandler::levelingAutomatic() {
if (ExtUI::getLevelingIsValid()) {
screen.leveling_active = true;
@@ -145,21 +145,21 @@ bool DGUSSetupHandler::LevelingAutomatic() {
return true;
}
bool DGUSSetupHandler::LevelingProbing() {
bool DGUSSetupHandler::levelingProbing() {
screen.probing_icons[0] = 0;
screen.probing_icons[1] = 0;
return true;
}
bool DGUSSetupHandler::Filament() {
bool DGUSSetupHandler::filament() {
screen.filament_extruder = DGUS_Data::Extruder::CURRENT;
screen.filament_length = DGUS_DEFAULT_FILAMENT_LEN;
return true;
}
bool DGUSSetupHandler::Move() {
bool DGUSSetupHandler::move() {
screen.move_steps = DGUS_Data::StepSize::MM10;
if (!screen.isPrinterIdle()) {
@@ -170,7 +170,7 @@ bool DGUSSetupHandler::Move() {
return true;
}
bool DGUSSetupHandler::Gcode() {
bool DGUSSetupHandler::gcode() {
ZERO(screen.gcode);
if (dgus.gui_version < 0x30 || dgus.os_version < 0x21) {
@@ -181,14 +181,14 @@ bool DGUSSetupHandler::Gcode() {
return true;
}
bool DGUSSetupHandler::PID() {
bool DGUSSetupHandler::pid() {
screen.pid_heater = DGUS_Data::Heater::H0;
screen.pid_temp = DGUS_PLA_TEMP_HOTEND;
return true;
}
bool DGUSSetupHandler::Infos() {
bool DGUSSetupHandler::infos() {
screen.debug_count = 0;
return true;

View File

@@ -24,19 +24,19 @@
namespace DGUSSetupHandler {
#if HAS_MEDIA
bool Print();
bool print();
#endif
bool PrintStatus();
bool PrintAdjust();
bool LevelingMenu();
bool LevelingOffset();
bool LevelingManual();
bool LevelingAutomatic();
bool LevelingProbing();
bool Filament();
bool Move();
bool Gcode();
bool PID();
bool Infos();
bool printStatus();
bool printAdjust();
bool levelingMenu();
bool levelingOffset();
bool levelingManual();
bool levelingAutomatic();
bool levelingProbing();
bool filament();
bool move();
bool gcode();
bool pid();
bool infos();
}

View File

@@ -34,20 +34,20 @@
const struct DGUS_ScreenSetup screen_setup_list[] PROGMEM = {
#if HAS_MEDIA
SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::Print),
SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::print),
#endif
SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::PrintStatus),
SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::PrintAdjust),
SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::LevelingMenu),
SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::LevelingOffset),
SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::LevelingManual),
SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::LevelingAutomatic),
SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::LevelingProbing),
SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::Filament),
SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::Move),
SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::Gcode),
SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::PID),
SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::Infos),
SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::printStatus),
SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::printAdjust),
SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::levelingMenu),
SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::levelingOffset),
SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::levelingManual),
SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::levelingAutomatic),
SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::levelingProbing),
SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::filament),
SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::move),
SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::gcode),
SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::pid),
SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::infos),
SETUP_HELPER((DGUS_ScreenID)0, nullptr)
};

View File

@@ -50,7 +50,7 @@ namespace ExtUI {
screen.printerKilled(error, component);
}
void onMediaInserted() { TERN_(HAS_MEDIA, screen.sDCardInserted()); }
void onMediaInserted() { TERN_(HAS_MEDIA, screen.sdCardInserted()); }
void onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }

View File

@@ -37,29 +37,29 @@
TFT SPI_TFT;
// use SPI1 for the spi tft.
void TFT::spi_init(uint8_t spiRate) {
tftio.Init();
void TFT::spiInit(uint8_t spiRate) {
tftio.init();
}
void TFT::SetPoint(uint16_t x, uint16_t y, uint16_t point) {
void TFT::setPoint(uint16_t x, uint16_t y, uint16_t point) {
if ((x > 480) || (y > 320)) return;
setWindow(x, y, 1, 1);
tftio.WriteMultiple(point, (uint16_t)1);
tftio.writeMultiple(point, (uint16_t)1);
}
void TFT::setWindow(uint16_t x, uint16_t y, uint16_t with, uint16_t height) {
tftio.set_window(x, y, (x + with - 1), (y + height - 1));
}
void TFT::LCD_init() {
tftio.InitTFT();
void TFT::lcdInit() {
tftio.initTFT();
#if PIN_EXISTS(TFT_BACKLIGHT)
OUT_WRITE(TFT_BACKLIGHT_PIN, LOW);
#endif
delay(100);
LCD_clear(0x0000);
LCD_Draw_Logo();
lcdClear(0x0000);
lcdDrawLogo();
#if PIN_EXISTS(TFT_BACKLIGHT)
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
#endif
@@ -68,17 +68,17 @@ void TFT::LCD_init() {
#endif
}
void TFT::LCD_clear(uint16_t color) {
void TFT::lcdClear(uint16_t color) {
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
tftio.WriteMultiple(color, uint32_t(TFT_WIDTH) * uint32_t(TFT_HEIGHT));
tftio.writeMultiple(color, uint32_t(TFT_WIDTH) * uint32_t(TFT_HEIGHT));
}
void TFT::LCD_Draw_Logo() {
void TFT::lcdDrawLogo() {
#if HAS_LOGO_IN_FLASH
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
for (uint16_t i = 0; i < (TFT_HEIGHT); i++) {
Pic_Logo_Read((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2);
tftio.WriteSequence((uint16_t *)bmp_public_buf, TFT_WIDTH);
picLogoRead((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2);
tftio.writeSequence((uint16_t *)bmp_public_buf, TFT_WIDTH);
}
#endif
}

View File

@@ -27,12 +27,12 @@
class TFT {
public:
TFT_IO tftio;
void spi_init(uint8_t spiRate);
void SetPoint(uint16_t x, uint16_t y, uint16_t point);
void spiInit(uint8_t spiRate);
void setPoint(uint16_t x, uint16_t y, uint16_t point);
void setWindow(uint16_t x, uint16_t y, uint16_t with, uint16_t height);
void LCD_init();
void LCD_clear(uint16_t color);
void LCD_Draw_Logo();
void lcdInit();
void lcdClear(uint16_t color);
void lcdDrawLogo();
};
extern TFT SPI_TFT;

View File

@@ -35,7 +35,7 @@ static lv_obj_t *scr;
void lv_draw_error_message(FSTR_P const fmsg) {
FSTR_P fhalted = F("PRINTER HALTED"), fplease = F("Please Reset");
SPI_TFT.LCD_clear(0x0000);
SPI_TFT.lcdClear(0x0000);
if (fmsg) disp_string((TFT_WIDTH - strlen_P(FTOP(fmsg)) * 16) / 2, 100, fmsg, 0xFFFF, 0x0000);
disp_string((TFT_WIDTH - strlen_P(FTOP(fhalted)) * 16) / 2, 140, fhalted, 0xFFFF, 0x0000);
disp_string((TFT_WIDTH - strlen_P(FTOP(fplease)) * 16) / 2, 180, fplease, 0xFFFF, 0x0000);

View File

@@ -47,9 +47,9 @@ enum {
static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
SPI_TFT.tftio.set_window(x - 15, y, x + 15, y);
SPI_TFT.tftio.WriteMultiple(color, 31);
SPI_TFT.tftio.writeMultiple(color, 31);
SPI_TFT.tftio.set_window(x, y - 15, x, y + 15);
SPI_TFT.tftio.WriteMultiple(color, 31);
SPI_TFT.tftio.writeMultiple(color, 31);
}
void lv_update_touch_calibration_screen() {

View File

@@ -631,7 +631,7 @@ char *creat_title_text() {
p_index = (uint16_t *)(&bmp_public_buf[i]);
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
}
SPI_TFT.tftio.WriteSequence((uint16_t*)bmp_public_buf, 200);
SPI_TFT.tftio.writeSequence((uint16_t*)bmp_public_buf, 200);
#if HAS_BAK_VIEW_IN_FLASH
W25QXX.init(SPI_QUARTER_SPEED);
if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
@@ -692,7 +692,7 @@ char *creat_title_text() {
#endif
SPI_TFT.setWindow(xpos_pixel, y_off * 20 + ypos_pixel, 200, 20); // 200*200
SPI_TFT.tftio.WriteSequence((uint16_t*)(bmp_public_buf), DEFAULT_VIEW_MAX_SIZE / 20);
SPI_TFT.tftio.writeSequence((uint16_t*)(bmp_public_buf), DEFAULT_VIEW_MAX_SIZE / 20);
y_off++;
}

View File

@@ -648,7 +648,7 @@ void disp_char_1624(uint16_t x, uint16_t y, uint8_t c, uint16_t charColor, uint1
for (uint16_t i = 0; i < 24; i++) {
const uint16_t tmp_char = pgm_read_word(&ASCII_Table_16x24[((c - 0x20) * 24) + i]);
for (uint16_t j = 0; j < 16; j++)
SPI_TFT.SetPoint(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor);
SPI_TFT.setPoint(x + j, y + i, ((tmp_char >> j) & 0x01) ? charColor : bkColor);
}
}
@@ -664,7 +664,7 @@ void disp_string(uint16_t x, uint16_t y, FSTR_P const fstr, uint16_t charColor,
}
void disp_assets_update() {
SPI_TFT.LCD_clear(0x0000);
SPI_TFT.lcdClear(0x0000);
disp_string(100, 140, F("Assets Updating..."), 0xFFFF, 0x0000);
}

View File

@@ -291,7 +291,7 @@ void spiFlashErase_PIC() {
uint32_t LogoWrite_Addroffset = 0;
uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) {
uint8_t picLogoWrite(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) {
if (LogoWriteSize <= 0) return 0;
W25QXX.SPI_FLASH_BufferWrite(Logo_Wbuff, PIC_LOGO_ADDR + LogoWrite_Addroffset, LogoWriteSize);
@@ -308,7 +308,7 @@ uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWrit
}
uint32_t TitleLogoWrite_Addroffset = 0;
uint8_t Pic_TitleLogo_Write(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) {
uint8_t picTitleLogoWrite(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) {
if (TitleLogoWriteSize <= 0)
return 0;
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
@@ -329,15 +329,15 @@ void default_view_Write(uint8_t *default_view__Rbuff, uint32_t default_view_Writ
default_view_addroffset_r = 0;
}
uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
uint32_t picInfoWrite(uint8_t *P_name, uint32_t P_size) {
uint8_t pic_counter = 0;
uint32_t Pic_SaveAddr;
uint32_t picSaveAddr;
uint32_t Pic_SizeSaveAddr;
uint32_t Pic_NameSaveAddr;
uint8_t Pname_temp;
uint32_t picNameSaveAddr;
uint8_t pNameTemp;
uint32_t i, j;
uint32_t name_len = 0;
uint32_t SaveName_len = 0;
uint32_t saveNameLen = 0;
union union32 size_tmp;
W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1);
@@ -346,15 +346,15 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
pic_counter = 0;
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
Pic_SaveAddr = PIC_DATA_ADDR_TFT35 + pic_counter * PER_PIC_MAX_SPACE_TFT35;
picSaveAddr = PIC_DATA_ADDR_TFT35 + pic_counter * PER_PIC_MAX_SPACE_TFT35;
else
Pic_SaveAddr = PIC_DATA_ADDR_TFT32 + pic_counter * PER_PIC_MAX_SPACE_TFT32;
picSaveAddr = PIC_DATA_ADDR_TFT32 + pic_counter * PER_PIC_MAX_SPACE_TFT32;
for (j = 0; j < pic_counter; j++) {
do {
W25QXX.SPI_FLASH_BufferRead(&Pname_temp, PIC_NAME_ADDR + SaveName_len, 1);
SaveName_len++;
} while (Pname_temp != '\0');
W25QXX.SPI_FLASH_BufferRead(&pNameTemp, PIC_NAME_ADDR + saveNameLen, 1);
saveNameLen++;
} while (pNameTemp != '\0');
}
i = 0;
while ((*(P_name + i) != '\0')) {
@@ -362,8 +362,8 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
name_len++;
}
Pic_NameSaveAddr = PIC_NAME_ADDR + SaveName_len;
W25QXX.SPI_FLASH_BufferWrite(P_name, Pic_NameSaveAddr, name_len + 1);
picNameSaveAddr = PIC_NAME_ADDR + saveNameLen;
W25QXX.SPI_FLASH_BufferWrite(P_name, picNameSaveAddr, name_len + 1);
Pic_SizeSaveAddr = PIC_SIZE_ADDR + 4 * pic_counter;
size_tmp.dwords = P_size;
W25QXX.SPI_FLASH_BufferWrite(size_tmp.bytes, Pic_SizeSaveAddr, 4);
@@ -372,7 +372,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
W25QXX.SPI_FLASH_SectorErase(PIC_COUNTER_ADDR);
W25QXX.SPI_FLASH_BufferWrite(&pic_counter, PIC_COUNTER_ADDR, 1);
return Pic_SaveAddr;
return picSaveAddr;
}
#if HAS_MEDIA
@@ -430,14 +430,14 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
do {
hal.watchdog_refresh();
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_Logo_Write((uint8_t*)fn, public_buf, pbr);
picLogoWrite((uint8_t*)fn, public_buf, pbr);
} while (pbr >= BMP_WRITE_BUF_LEN);
}
else if (assetType == ASSET_TYPE_TITLE_LOGO) {
do {
hal.watchdog_refresh();
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
Pic_TitleLogo_Write((uint8_t*)fn, public_buf, pbr);
picTitleLogoWrite((uint8_t*)fn, public_buf, pbr);
} while (pbr >= BMP_WRITE_BUF_LEN);
}
else if (assetType == ASSET_TYPE_G_PREVIEW) {
@@ -448,7 +448,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
} while (pbr >= BMP_WRITE_BUF_LEN);
}
else if (assetType == ASSET_TYPE_ICON) {
Pic_Write_Addr = Pic_Info_Write((uint8_t*)fn, pfileSize);
Pic_Write_Addr = picInfoWrite((uint8_t*)fn, pfileSize);
SPIFlash.beginWrite(Pic_Write_Addr);
#if HAS_SPI_FLASH_COMPRESSION
do {
@@ -550,7 +550,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
#endif // HAS_MEDIA
void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff) {
void picRead(uint8_t *Pname, uint8_t *P_Rbuff) {
uint8_t i, j;
uint8_t Pic_cnt;
uint32_t tmp_cnt = 0;
@@ -596,7 +596,7 @@ void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {
#endif
uint32_t logo_addroffset = 0;
void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) {
void picLogoRead(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize) {
W25QXX.init(SPI_QUARTER_SPEED);
W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
logo_addroffset += LogoReadsize;

View File

@@ -154,8 +154,8 @@ typedef struct pic_msg PIC_MSG;
#define PIC_SIZE_xM 6
#define FONT_SIZE_xM 2
void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
void Pic_Logo_Read(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize);
void picRead(uint8_t *Pname, uint8_t *P_Rbuff);
void picLogoRead(uint8_t *LogoName, uint8_t *Logo_Rbuff, uint32_t LogoReadsize);
void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
uint32_t lv_get_pic_addr(uint8_t *Pname);
void get_spi_flash_data(const char *rec_buf, int offset, int size);

View File

@@ -129,8 +129,8 @@ void tft_lvgl_init() {
hal.watchdog_refresh(); // LVGL init takes time
// Init TFT first!
SPI_TFT.spi_init(SPI_FULL_SPEED);
SPI_TFT.LCD_init();
SPI_TFT.spiInit(SPI_FULL_SPEED);
SPI_TFT.lcdInit();
hal.watchdog_refresh(); // LVGL init takes time
@@ -162,7 +162,7 @@ void tft_lvgl_init() {
TERN_(MKS_TEST, mks_test_get());
#endif
touch.Init();
touch.init();
lv_init();
@@ -264,7 +264,7 @@ void dmc_tc_handler(struct __DMA_HandleTypeDef * hdma) {
#if ENABLED(USE_SPI_DMA_TC)
lv_disp_flush_ready(disp_drv_p);
lcd_dma_trans_lock = false;
TFT_SPI::Abort();
TFT_SPI::abort();
#endif
}
@@ -278,10 +278,10 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co
#if ENABLED(USE_SPI_DMA_TC)
lcd_dma_trans_lock = true;
SPI_TFT.tftio.WriteSequenceIT((uint16_t*)color_p, width * height);
SPI_TFT.tftio.writeSequenceIT((uint16_t*)color_p, width * height);
TFT_SPI::DMAtx.XferCpltCallback = dmc_tc_handler;
#else
SPI_TFT.tftio.WriteSequence((uint16_t*)color_p, width * height);
SPI_TFT.tftio.writeSequence((uint16_t*)color_p, width * height);
lv_disp_flush_ready(disp_drv_p); // Indicate you are ready with the flushing
#endif
@@ -297,7 +297,7 @@ void lv_fill_rect(lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2, lv
width = x2 - x1 + 1;
height = y2 - y1 + 1;
SPI_TFT.setWindow((uint16_t)x1, (uint16_t)y1, width, height);
SPI_TFT.tftio.WriteMultiple(bk_color.full, width * height);
SPI_TFT.tftio.writeMultiple(bk_color.full, width * height);
W25QXX.init(SPI_QUARTER_SPEED);
}

View File

@@ -40,7 +40,7 @@ void my_disp_flush(lv_disp_drv_t * disp, const lv_area_t * area, lv_color_t * co
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data);
bool my_mousewheel_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
void LCD_Clear(uint16_t Color);
void LCD_Clear(uint16_t color);
void tft_set_point(uint16_t x, uint16_t y, uint16_t point);
void LCD_setWindowArea(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t height);
void LCD_WriteRAM_Prepare();

View File

@@ -55,7 +55,7 @@
#define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH);
#define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW);
uint8_t Explore_Disk(const char * const path, const uint8_t recu_level, const bool with_longnames);
uint8_t exploreDisk(const char * const path, const uint8_t recu_level, const bool with_longnames);
extern uint8_t commands_in_queue;
extern uint8_t sel_id;
@@ -723,7 +723,7 @@ void get_file_list(const char * const path, const bool with_longnames) {
else if (gCfgItems.fileSysType == FILE_SYS_USB) {
// udisk
}
Explore_Disk(path, 0, with_longnames);
exploreDisk(path, 0, with_longnames);
}
char wait_ip_back_flag = 0;
@@ -818,7 +818,7 @@ static int cut_msg_head(uint8_t * const msg, const uint16_t msgLen, uint16_t cut
return msgLen - cutLen;
}
uint8_t Explore_Disk(const char * const path, const uint8_t recu_level, const bool with_longnames) {
uint8_t exploreDisk(const char * const path, const uint8_t recu_level, const bool with_longnames) {
char Fstream[200];
if (!path) return 0;
@@ -1805,7 +1805,7 @@ void stopEspTransfer() {
W25QXX.init(SPI_QUARTER_SPEED);
// ?? Workaround for SPI / Servo issues ??
TERN_(HAS_TFT_LVGL_UI_SPI, SPI_TFT.spi_init(SPI_FULL_SPEED));
TERN_(HAS_TFT_LVGL_UI_SPI, SPI_TFT.spiInit(SPI_FULL_SPEED));
TERN_(HAS_SERVOS, servo_init());
TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init());

View File

@@ -1179,7 +1179,7 @@ void MarlinUI::init() {
run_current_screen();
// Apply all DWIN drawing after processing
TERN_(IS_DWIN_MARLINUI, DWIN_UpdateLCD());
TERN_(IS_DWIN_MARLINUI, dwinUpdateLCD());
#endif
@@ -1609,9 +1609,9 @@ void MarlinUI::init() {
#endif
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
TERN_(DWIN_CREALITY_LCD, DWIN_StatusChanged(status_message));
TERN_(DWIN_CREALITY_LCD, dwinStatusChanged(status_message));
TERN_(DWIN_LCD_PROUI, DWIN_CheckStatusMessage());
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Update_Status(status_message));
TERN_(DWIN_CREALITY_LCD_JYERSUI, crealityDWIN.updateStatus(status_message));
}
#if ENABLED(STATUS_MESSAGE_SCROLLING)

View File

@@ -82,16 +82,16 @@ void Canvas::addText(uint16_t x, uint16_t y, uint16_t color, uint16_t *string, u
}
for (uint16_t i = 0 ; *(string + i) ; i++) {
glyph_t *pGlyph = glyph(string + i);
if (stringWidth + pGlyph->BBXWidth > maxWidth) break;
if (stringWidth + pGlyph->bbxWidth > maxWidth) break;
switch (getFontType()) {
case FONT_MARLIN_GLYPHS_1BPP:
addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE1, ((uint8_t *)pGlyph) + sizeof(glyph_t), &color);
addImage(x + stringWidth + pGlyph->bbxOffsetX, y + getFontAscent() - pGlyph->bbxHeight - pGlyph->bbxOffsetY, pGlyph->bbxWidth, pGlyph->bbxHeight, GREYSCALE1, ((uint8_t *)pGlyph) + sizeof(glyph_t), &color);
break;
case FONT_MARLIN_GLYPHS_2BPP:
addImage(x + stringWidth + pGlyph->BBXOffsetX, y + getFontAscent() - pGlyph->BBXHeight - pGlyph->BBXOffsetY, pGlyph->BBXWidth, pGlyph->BBXHeight, GREYSCALE2, ((uint8_t *)pGlyph) + sizeof(glyph_t), colors);
addImage(x + stringWidth + pGlyph->bbxOffsetX, y + getFontAscent() - pGlyph->bbxHeight - pGlyph->bbxOffsetY, pGlyph->bbxWidth, pGlyph->bbxHeight, GREYSCALE2, ((uint8_t *)pGlyph) + sizeof(glyph_t), colors);
break;
}
stringWidth += pGlyph->DWidth;
stringWidth += pGlyph->dWidth;
}
}

View File

@@ -33,8 +33,8 @@
uint16_t TFT::buffer[];
void TFT::init() {
io.Init();
io.InitTFT();
io.init();
io.initTFT();
}
TFT tft;

View File

@@ -69,9 +69,9 @@ class TFT {
static void add_glyphs(const uint8_t *Font) { string.add_glyphs(Font); }
static bool is_busy() { return io.isBusy(); }
static void abort() { io.Abort(); }
static void write_multiple(uint16_t Data, uint16_t Count) { io.WriteMultipleDMA(Data, Count); }
static void write_sequence(uint16_t *Data, uint16_t Count) { io.WriteSequenceDMA(Data, Count); }
static void abort() { io.abort(); }
static void write_multiple(uint16_t data, uint16_t count) { io.WriteMultipleDMA(data, count); }
static void write_sequence(uint16_t *data, uint16_t count) { io.writeSequenceDMA(data, count); }
static void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) { io.set_window(Xmin, Ymin, Xmax, Ymax); }
static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.fill(x, y, width, height, color); }

View File

@@ -59,11 +59,11 @@ void TFT_String::set_font(const uint8_t *font) {
#endif
DEBUG_ECHOLNPGM("Format: ", ((unifont_t *)font_header)->Format);
DEBUG_ECHOLNPGM("CapitalAHeight: ", ((unifont_t *)font_header)->CapitalAHeight);
DEBUG_ECHOLNPGM("FontStartEncoding: ", ((unifont_t *)font_header)->FontStartEncoding);
DEBUG_ECHOLNPGM("FontEndEncoding: ", ((unifont_t *)font_header)->FontEndEncoding);
DEBUG_ECHOLNPGM("FontAscent: ", ((unifont_t *)font_header)->FontAscent);
DEBUG_ECHOLNPGM("FontDescent: ", ((unifont_t *)font_header)->FontDescent);
DEBUG_ECHOLNPGM("capitalAHeight: ", ((unifont_t *)font_header)->capitalAHeight);
DEBUG_ECHOLNPGM("fontStartEncoding: ", ((unifont_t *)font_header)->fontStartEncoding);
DEBUG_ECHOLNPGM("fontEndEncoding: ", ((unifont_t *)font_header)->fontEndEncoding);
DEBUG_ECHOLNPGM("fontAscent: ", ((unifont_t *)font_header)->fontAscent);
DEBUG_ECHOLNPGM("fontDescent: ", ((unifont_t *)font_header)->fontDescent);
add_glyphs(font);
}
@@ -72,15 +72,15 @@ void TFT_String::add_glyphs(const uint8_t *font) {
uint16_t unicode, fontStartEncoding, fontEndEncoding;
uint8_t *pointer;
fontStartEncoding = ((unifont_t *)font)->FontStartEncoding;
fontEndEncoding = ((unifont_t *)font)->FontEndEncoding;
fontStartEncoding = ((unifont_t *)font)->fontStartEncoding;
fontEndEncoding = ((unifont_t *)font)->fontEndEncoding;
pointer = (uint8_t *)font + sizeof(unifont_t);
if (fontEndEncoding < 0x0100) { // base and symbol fonts
for (unicode = fontStartEncoding; unicode <= fontEndEncoding; unicode++) {
if (*pointer != NO_GLYPH) {
glyphs[unicode] = (glyph_t *)pointer;
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->DataSize;
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->dataSize;
}
else
pointer++;
@@ -98,7 +98,7 @@ void TFT_String::add_glyphs(const uint8_t *font) {
}
if (*pointer != NO_GLYPH) {
glyphs_extra[unicode - fontStartEncoding] = pointer;
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->DataSize;
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->dataSize;
}
else
pointer++;
@@ -112,7 +112,7 @@ void TFT_String::add_glyphs(const uint8_t *font) {
}
glyphs_extra[i] = pointer;
unicode = *(uint16_t *) pointer;
pointer += sizeof(uniglyph_t) + ((uniglyph_t *)pointer)->glyph.DataSize;
pointer += sizeof(uniglyph_t) + ((uniglyph_t *)pointer)->glyph.dataSize;
extra_count = i + 1;
if (unicode == fontEndEncoding)
break;
@@ -127,11 +127,11 @@ glyph_t *TFT_String::glyph(uint16_t character) {
if (character < 0x00ff) return glyphs[character] ?: glyphs['?']; /* Use '?' for unknown glyphs */
#if EXTRA_GLYPHS
if (font_header_extra == nullptr || character < font_header_extra->FontStartEncoding || character > font_header_extra->FontEndEncoding) return glyphs['?'];
if (font_header_extra == nullptr || character < font_header_extra->fontStartEncoding || character > font_header_extra->fontEndEncoding) return glyphs['?'];
if ((font_header_extra->Format & 0xF0) == FONT_MARLIN_GLYPHS) {
if (glyphs_extra[character - font_header_extra->FontStartEncoding])
return (glyph_t *)glyphs_extra[character - font_header_extra->FontStartEncoding];
if (glyphs_extra[character - font_header_extra->fontStartEncoding])
return (glyph_t *)glyphs_extra[character - font_header_extra->fontStartEncoding];
}
else {
#if 0
@@ -232,7 +232,7 @@ void TFT_String::add_character(const uint16_t character) {
if (length < MAX_STRING_LENGTH) {
data[length] = character;
length++;
span += glyph(character)->DWidth;
span += glyph(character)->dWidth;
}
}
@@ -240,7 +240,7 @@ void TFT_String::rtrim(const uint16_t character) {
while (length) {
if (data[length - 1] == 0x20 || data[length - 1] == character) {
length--;
span -= glyph(data[length])->DWidth;
span -= glyph(data[length])->dWidth;
eol();
}
else
@@ -251,7 +251,7 @@ void TFT_String::rtrim(const uint16_t character) {
void TFT_String::ltrim(const uint16_t character) {
uint16_t i, j;
for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) {
span -= glyph(data[i])->DWidth;
span -= glyph(data[i])->dWidth;
}
if (i == 0) return;
for (j = 0; i < length; data[j++] = data[i++]);

View File

@@ -29,7 +29,7 @@
/*
* Marlin fonts with optional antialiasing. Fonts use unifont_t font header and glyph_t glyphs headers.
* Number of glyphs (FontEndEncoding - FontStartEncoding) can not exceed 256 (TBD).
* Number of glyphs (fontEndEncoding - fontStartEncoding) can not exceed 256 (TBD).
* Some glyphs may be left undefined with NO_GLYPH
*/
#define FONT_MARLIN_GLYPHS 0x80
@@ -44,7 +44,7 @@
*
* IMPORTANT NOTES:
* - glyphs fast search method REQUIRES glyphs to be ordered by unicode
* - last glyph's code MUST be FontEndEncoding
* - last glyph's code MUST be fontEndEncoding
*/
#define FONT_MARLIN_HIEROGLYPHS 0xA0
#define FONT_MARLIN_HIEROGLYPHS_1BPP 0xA1
@@ -146,22 +146,22 @@
// TFT font with unicode support
typedef struct __attribute__((__packed__)) {
uint8_t Format;
uint8_t CapitalAHeight; // Not really needed, but helps with data alingment for uint16_t variables
uint16_t FontStartEncoding;
uint16_t FontEndEncoding;
int8_t FontAscent;
int8_t FontDescent;
uint8_t format;
uint8_t capitalAHeight; // Not really needed, but helps with data alignment for uint16_t variables
uint16_t fontStartEncoding;
uint16_t fontEndEncoding;
int8_t fontAscent;
int8_t fontDescent;
} unifont_t;
// TFT glyphs
typedef struct __attribute__((__packed__)) {
uint8_t BBXWidth;
uint8_t BBXHeight;
uint8_t DataSize;
int8_t DWidth;
int8_t BBXOffsetX;
int8_t BBXOffsetY;
uint8_t bbxWidth;
uint8_t bbxHeight;
uint8_t dataSize;
int8_t dWidth;
int8_t bbxOffsetX;
int8_t bbxOffsetY;
} glyph_t;
// unicode-prepended TFT glyphs
@@ -194,9 +194,9 @@ class TFT_String {
static void set_font(const uint8_t *font);
static void add_glyphs(const uint8_t *font);
static uint8_t font_type() { return font_header->Format; };
static uint16_t font_ascent() { return font_header->FontAscent; }
static uint16_t font_height() { return font_header->FontAscent - font_header->FontDescent; }
static uint8_t font_type() { return font_header->format; };
static uint16_t font_ascent() { return font_header->fontAscent; }
static uint16_t font_height() { return font_header->fontAscent - font_header->fontDescent; }
static glyph_t *glyph(uint16_t character);
static glyph_t *glyph(uint16_t *character) { return glyph(*character); }
@@ -264,7 +264,7 @@ class TFT_String {
static uint16_t *string() { return data; }
static uint16_t width() { return span; }
static uint16_t center(const uint16_t width) { return span > width ? 0 : (width - span) / 2; }
static uint16_t vcenter(const uint16_t height) { return (height + font_header->CapitalAHeight + 1) / 2 > font_header->FontAscent ? (height + font_header->CapitalAHeight + 1) / 2 - font_header->FontAscent : 0 ; }
static uint16_t vcenter(const uint16_t height) { return (height + font_header->capitalAHeight + 1) / 2 > font_header->fontAscent ? (height + font_header->capitalAHeight + 1) / 2 - font_header->fontAscent : 0 ; }
};
extern TFT_String tft_string;

View File

@@ -58,7 +58,7 @@ TouchControlType Touch::touch_control_type = NONE;
void Touch::init() {
TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset());
reset();
io.Init();
io.init();
TERN_(HAS_TOUCH_SLEEP, wakeUp());
enable();
}

View File

@@ -118,27 +118,26 @@ void MarlinUI::draw_kill_screen() {
tft.queue.sync();
}
void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
void draw_heater_status(uint16_t x, uint16_t y, const int8_t heater) {
MarlinImage image = imgHotEnd;
uint16_t Color;
celsius_t currentTemperature, targetTemperature;
if (Heater >= 0) { // HotEnd
if (heater >= 0) { // HotEnd
#if HAS_EXTRUDERS
currentTemperature = thermalManager.wholeDegHotend(Heater);
targetTemperature = thermalManager.degTargetHotend(Heater);
currentTemperature = thermalManager.wholeDegHotend(heater);
targetTemperature = thermalManager.degTargetHotend(heater);
#else
return;
#endif
}
#if HAS_HEATED_BED
else if (Heater == H_BED) {
else if (heater == H_BED) {
currentTemperature = thermalManager.wholeDegBed();
targetTemperature = thermalManager.degTargetBed();
}
#endif
#if HAS_TEMP_CHAMBER
else if (Heater == H_CHAMBER) {
else if (heater == H_CHAMBER) {
currentTemperature = thermalManager.wholeDegChamber();
#if HAS_HEATED_CHAMBER
targetTemperature = thermalManager.degTargetChamber();
@@ -148,54 +147,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
}
#endif
#if HAS_TEMP_COOLER
else if (Heater == H_COOLER) {
else if (heater == H_COOLER) {
currentTemperature = thermalManager.wholeDegCooler();
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
}
#endif
else return;
TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, Heater));
TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, heater));
tft.canvas(x, y, 80, 120);
tft.set_background(COLOR_BACKGROUND);
Color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD;
uint16_t color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD;
if (Heater >= 0) { // HotEnd
if (currentTemperature >= 50) Color = COLOR_HOTEND;
if (heater >= 0) { // HotEnd
if (currentTemperature >= 50) color = COLOR_HOTEND;
}
#if HAS_HEATED_BED
else if (Heater == H_BED) {
if (currentTemperature >= 50) Color = COLOR_HEATED_BED;
else if (heater == H_BED) {
if (currentTemperature >= 50) color = COLOR_HEATED_BED;
image = targetTemperature > 0 ? imgBedHeated : imgBed;
}
#endif
#if HAS_TEMP_CHAMBER
else if (Heater == H_CHAMBER) {
if (currentTemperature >= 50) Color = COLOR_CHAMBER;
else if (heater == H_CHAMBER) {
if (currentTemperature >= 50) color = COLOR_CHAMBER;
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
}
#endif
#if HAS_TEMP_COOLER
else if (Heater == H_COOLER) {
if (currentTemperature <= 26) Color = COLOR_COLD;
if (currentTemperature > 26) Color = COLOR_RED;
else if (heater == H_COOLER) {
if (currentTemperature <= 26) color = COLOR_COLD;
if (currentTemperature > 26) color = COLOR_RED;
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
}
#endif
tft.add_image(8, 28, image, Color);
tft.add_image(8, 28, image, color);
tft_string.set(i16tostr3rj(currentTemperature));
tft_string.add(LCD_STR_DEGREE);
tft_string.trim();
tft.add_text(tft_string.center(80) + 2, 82, Color, tft_string);
tft.add_text(tft_string.center(80) + 2, 82, color, tft_string);
if (targetTemperature >= 0) {
tft_string.set(i16tostr3rj(targetTemperature));
tft_string.add(LCD_STR_DEGREE);
tft_string.trim();
tft.add_text(tft_string.center(80) + 2, 8, Color, tft_string);
tft.add_text(tft_string.center(80) + 2, 8, color, tft_string);
}
}

View File

@@ -120,27 +120,26 @@ void MarlinUI::draw_kill_screen() {
tft.queue.sync();
}
void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
void draw_heater_status(uint16_t x, uint16_t y, const int8_t heater) {
MarlinImage image = imgHotEnd;
uint16_t Color;
celsius_t currentTemperature, targetTemperature;
if (Heater >= 0) { // HotEnd
if (heater >= 0) { // HotEnd
#if HAS_EXTRUDERS
currentTemperature = thermalManager.wholeDegHotend(Heater);
targetTemperature = thermalManager.degTargetHotend(Heater);
currentTemperature = thermalManager.wholeDegHotend(heater);
targetTemperature = thermalManager.degTargetHotend(heater);
#else
return;
#endif
}
#if HAS_HEATED_BED
else if (Heater == H_BED) {
else if (heater == H_BED) {
currentTemperature = thermalManager.wholeDegBed();
targetTemperature = thermalManager.degTargetBed();
}
#endif
#if HAS_TEMP_CHAMBER
else if (Heater == H_CHAMBER) {
else if (heater == H_CHAMBER) {
currentTemperature = thermalManager.wholeDegChamber();
#if HAS_HEATED_CHAMBER
targetTemperature = thermalManager.degTargetChamber();
@@ -150,54 +149,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
}
#endif
#if HAS_TEMP_COOLER
else if (Heater == H_COOLER) {
else if (heater == H_COOLER) {
currentTemperature = thermalManager.wholeDegCooler();
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
}
#endif
else return;
TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 64, 100, Heater));
TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 64, 100, heater));
tft.canvas(x, y, 64, 100);
tft.set_background(COLOR_BACKGROUND);
Color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD;
uint16_t color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD;
if (Heater >= 0) { // HotEnd
if (currentTemperature >= 50) Color = COLOR_HOTEND;
if (heater >= 0) { // HotEnd
if (currentTemperature >= 50) color = COLOR_HOTEND;
}
#if HAS_HEATED_BED
else if (Heater == H_BED) {
if (currentTemperature >= 50) Color = COLOR_HEATED_BED;
else if (heater == H_BED) {
if (currentTemperature >= 50) color = COLOR_HEATED_BED;
image = targetTemperature > 0 ? imgBedHeated : imgBed;
}
#endif
#if HAS_TEMP_CHAMBER
else if (Heater == H_CHAMBER) {
if (currentTemperature >= 50) Color = COLOR_CHAMBER;
else if (heater == H_CHAMBER) {
if (currentTemperature >= 50) color = COLOR_CHAMBER;
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
}
#endif
#if HAS_TEMP_COOLER
else if (Heater == H_COOLER) {
if (currentTemperature <= 26) Color = COLOR_COLD;
if (currentTemperature > 26) Color = COLOR_RED;
else if (heater == H_COOLER) {
if (currentTemperature <= 26) color = COLOR_COLD;
if (currentTemperature > 26) color = COLOR_RED;
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
}
#endif
tft.add_image(0, 18, image, Color);
tft.add_image(0, 18, image, color);
tft_string.set(i16tostr3rj(currentTemperature));
tft_string.add(LCD_STR_DEGREE);
tft_string.trim();
tft.add_text(tft_string.center(64) + 2, 69 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string);
tft.add_text(tft_string.center(64) + 2, 69 + tft_string.vcenter(FONT_LINE_HEIGHT), color, tft_string);
if (targetTemperature >= 0) {
tft_string.set(i16tostr3rj(targetTemperature));
tft_string.add(LCD_STR_DEGREE);
tft_string.trim();
tft.add_text(tft_string.center(64) + 2, 5 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string);
tft.add_text(tft_string.center(64) + 2, 5 + tft_string.vcenter(FONT_LINE_HEIGHT), color, tft_string);
}
}

View File

@@ -118,27 +118,26 @@ void MarlinUI::draw_kill_screen() {
tft.queue.sync();
}
void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
void draw_heater_status(uint16_t x, uint16_t y, const int8_t heater) {
MarlinImage image = imgHotEnd;
uint16_t Color;
celsius_t currentTemperature, targetTemperature;
if (Heater >= 0) { // HotEnd
if (heater >= 0) { // HotEnd
#if HAS_EXTRUDERS
currentTemperature = thermalManager.wholeDegHotend(Heater);
targetTemperature = thermalManager.degTargetHotend(Heater);
currentTemperature = thermalManager.wholeDegHotend(heater);
targetTemperature = thermalManager.degTargetHotend(heater);
#else
return;
#endif
}
#if HAS_HEATED_BED
else if (Heater == H_BED) {
else if (heater == H_BED) {
currentTemperature = thermalManager.wholeDegBed();
targetTemperature = thermalManager.degTargetBed();
}
#endif
#if HAS_TEMP_CHAMBER
else if (Heater == H_CHAMBER) {
else if (heater == H_CHAMBER) {
currentTemperature = thermalManager.wholeDegChamber();
#if HAS_HEATED_CHAMBER
targetTemperature = thermalManager.degTargetChamber();
@@ -148,54 +147,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
}
#endif
#if HAS_TEMP_COOLER
else if (Heater == H_COOLER) {
else if (heater == H_COOLER) {
currentTemperature = thermalManager.wholeDegCooler();
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
}
#endif
else return;
TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, Heater));
TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, heater));
tft.canvas(x, y, 80, 120);
tft.set_background(COLOR_BACKGROUND);
Color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD;
uint16_t color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD;
if (Heater >= 0) { // HotEnd
if (currentTemperature >= 50) Color = COLOR_HOTEND;
if (heater >= 0) { // HotEnd
if (currentTemperature >= 50) color = COLOR_HOTEND;
}
#if HAS_HEATED_BED
else if (Heater == H_BED) {
if (currentTemperature >= 50) Color = COLOR_HEATED_BED;
else if (heater == H_BED) {
if (currentTemperature >= 50) color = COLOR_HEATED_BED;
image = targetTemperature > 0 ? imgBedHeated : imgBed;
}
#endif
#if HAS_TEMP_CHAMBER
else if (Heater == H_CHAMBER) {
if (currentTemperature >= 50) Color = COLOR_CHAMBER;
else if (heater == H_CHAMBER) {
if (currentTemperature >= 50) color = COLOR_CHAMBER;
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
}
#endif
#if HAS_TEMP_COOLER
else if (Heater == H_COOLER) {
if (currentTemperature <= 26) Color = COLOR_COLD;
if (currentTemperature > 26) Color = COLOR_RED;
else if (heater == H_COOLER) {
if (currentTemperature <= 26) color = COLOR_COLD;
if (currentTemperature > 26) color = COLOR_RED;
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
}
#endif
tft.add_image(8, 28, image, Color);
tft.add_image(8, 28, image, color);
tft_string.set(i16tostr3rj(currentTemperature));
tft_string.add(LCD_STR_DEGREE);
tft_string.trim();
tft.add_text(tft_string.center(80) + 2, 80 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string);
tft.add_text(tft_string.center(80) + 2, 80 + tft_string.vcenter(FONT_LINE_HEIGHT), color, tft_string);
if (targetTemperature >= 0) {
tft_string.set(i16tostr3rj(targetTemperature));
tft_string.add(LCD_STR_DEGREE);
tft_string.trim();
tft.add_text(tft_string.center(80) + 2, 6 + tft_string.vcenter(FONT_LINE_HEIGHT), Color, tft_string);
tft.add_text(tft_string.center(80) + 2, 6 + tft_string.vcenter(FONT_LINE_HEIGHT), color, tft_string);
}
}

View File

@@ -59,7 +59,7 @@
TFT_IO_DRIVER TFT_IO::io;
uint32_t TFT_IO::lcd_id = 0xFFFFFFFF;
void TFT_IO::InitTFT() {
void TFT_IO::initTFT() {
if (lcd_id != 0xFFFFFFFF) return;
#if PIN_EXISTS(TFT_BACKLIGHT)
@@ -81,7 +81,7 @@ void TFT_IO::InitTFT() {
#endif
#endif
// io.Init();
//io.init();
delay(100);
#if TFT_DRIVER != AUTO
@@ -106,7 +106,7 @@ void TFT_IO::InitTFT() {
write_esc_sequence(ili9488_init);
#elif TFT_DRIVER == AUTO // autodetect
lcd_id = io.GetID() & 0xFFFF;
lcd_id = io.getID() & 0xFFFF;
switch (lcd_id) {
case LTDC_RGB:
@@ -156,25 +156,25 @@ void TFT_IO::InitTFT() {
#endif
}
void TFT_IO::set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) {
void TFT_IO::set_window(uint16_t xMin, uint16_t yMin, uint16_t xMax, uint16_t yMax) {
#ifdef OFFSET_X
Xmin += OFFSET_X; Xmax += OFFSET_X;
xMin += OFFSET_X; xMax += OFFSET_X;
#endif
#ifdef OFFSET_Y
Ymin += OFFSET_Y; Ymax += OFFSET_Y;
yMin += OFFSET_Y; yMax += OFFSET_Y;
#endif
switch (lcd_id) {
case LTDC_RGB:
io.WriteReg(0x01);
io.WriteData(Xmin);
io.WriteReg(0x02);
io.WriteData(Xmax);
io.WriteReg(0x03);
io.WriteData(Ymin);
io.WriteReg(0x04);
io.WriteData(Ymax);
io.WriteReg(0x00);
io.writeReg(0x01);
io.writeData(xMin);
io.writeReg(0x02);
io.writeData(xMax);
io.writeReg(0x03);
io.writeData(yMin);
io.writeReg(0x04);
io.writeData(yMax);
io.writeReg(0x00);
break;
case ST7735: // ST7735 160x128
case ST7789: // ST7789V 320x240
@@ -183,76 +183,76 @@ void TFT_IO::set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ym
case ILI9488: // ILI9488 480x320
case SSD1963: // SSD1963
case ILI9488_ID1: // 0x8066 ILI9488 480x320
io.DataTransferBegin(DATASIZE_8BIT);
io.dataTransferBegin(DATASIZE_8BIT);
// CASET: Column Address Set
io.WriteReg(ILI9341_CASET);
io.WriteData((Xmin >> 8) & 0xFF);
io.WriteData(Xmin & 0xFF);
io.WriteData((Xmax >> 8) & 0xFF);
io.WriteData(Xmax & 0xFF);
io.writeReg(ILI9341_CASET);
io.writeData((xMin >> 8) & 0xFF);
io.writeData(xMin & 0xFF);
io.writeData((xMax >> 8) & 0xFF);
io.writeData(xMax & 0xFF);
// RASET: Row Address Set
io.WriteReg(ILI9341_PASET);
io.WriteData((Ymin >> 8) & 0xFF);
io.WriteData(Ymin & 0xFF);
io.WriteData((Ymax >> 8) & 0xFF);
io.WriteData(Ymax & 0xFF);
io.writeReg(ILI9341_PASET);
io.writeData((yMin >> 8) & 0xFF);
io.writeData(yMin & 0xFF);
io.writeData((yMax >> 8) & 0xFF);
io.writeData(yMax & 0xFF);
// RAMWR: Memory Write
io.WriteReg(ILI9341_RAMWR);
io.writeReg(ILI9341_RAMWR);
break;
case R61505: // R61505U 320x240
case ILI9328: // ILI9328 320x240
io.DataTransferBegin(DATASIZE_16BIT);
io.dataTransferBegin(DATASIZE_16BIT);
// Mind the mess: with landscape screen orientation 'Horizontal' is Y and 'Vertical' is X
io.WriteReg(ILI9328_HASTART);
io.WriteData(Ymin);
io.WriteReg(ILI9328_HAEND);
io.WriteData(Ymax);
io.WriteReg(ILI9328_VASTART);
io.WriteData(Xmin);
io.WriteReg(ILI9328_VAEND);
io.WriteData(Xmax);
io.writeReg(ILI9328_HASTART);
io.writeData(yMin);
io.writeReg(ILI9328_HAEND);
io.writeData(yMax);
io.writeReg(ILI9328_VASTART);
io.writeData(xMin);
io.writeReg(ILI9328_VAEND);
io.writeData(xMax);
io.WriteReg(ILI9328_HASET);
io.WriteData(Ymin);
io.WriteReg(ILI9328_VASET);
io.WriteData(Xmin);
io.writeReg(ILI9328_HASET);
io.writeData(yMin);
io.writeReg(ILI9328_VASET);
io.writeData(xMin);
io.WriteReg(ILI9328_RAMWR);
io.writeReg(ILI9328_RAMWR);
break;
default:
break;
}
io.DataTransferEnd();
io.dataTransferEnd();
}
void TFT_IO::write_esc_sequence(const uint16_t *Sequence) {
void TFT_IO::write_esc_sequence(const uint16_t *sequence) {
uint16_t dataWidth, data;
dataWidth = *Sequence++;
io.DataTransferBegin(dataWidth);
dataWidth = *sequence++;
io.dataTransferBegin(dataWidth);
for (;;) {
data = *Sequence++;
data = *sequence++;
if (data != 0xFFFF) {
io.WriteData(data);
io.writeData(data);
continue;
}
data = *Sequence++;
data = *sequence++;
if (data == 0x7FFF) break;
if (data == 0xFFFF)
io.WriteData(0xFFFF);
io.writeData(0xFFFF);
else if (data & 0x8000)
delay(data & 0x7FFF);
else if ((data & 0xFF00) == 0)
io.WriteReg(data);
io.writeReg(data);
}
io.DataTransferEnd();
io.dataTransferEnd();
}
#endif // HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT

View File

@@ -50,36 +50,36 @@ class TFT_IO {
public:
static TFT_IO_DRIVER io;
static void InitTFT();
static void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax);
static void write_esc_sequence(const uint16_t *Sequence);
static void initTFT();
static void set_window(uint16_t xMin, uint16_t yMin, uint16_t xMax, uint16_t yMax);
static void write_esc_sequence(const uint16_t *sequence);
// Deletaged methods
inline static void Init() { io.Init(); }
inline static void init() { io.init(); }
inline static bool isBusy() { return io.isBusy(); }
inline static void Abort() { io.Abort(); }
inline static uint32_t GetID() { return io.GetID(); }
inline static void abort() { io.abort(); }
inline static uint32_t getID() { return io.getID(); }
inline static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) { io.DataTransferBegin(DataWidth); }
inline static void DataTransferEnd() { io.DataTransferEnd(); }
inline static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT) { io.dataTransferBegin(dataWidth); }
inline static void dataTransferEnd() { io.dataTransferEnd(); }
inline static void WriteData(uint16_t Data) { io.WriteData(Data); }
inline static void WriteReg(uint16_t Reg) { io.WriteReg(Reg); }
inline static void writeData(uint16_t data) { io.writeData(data); }
inline static void writeReg(uint16_t reg) { io.writeReg(reg); }
// Blocking IO used by TFT_CLASSIC_UI and TFT_LVGL_UI
// These functions start data transfer and WAIT for data transfer completion
inline static void WriteSequence(uint16_t *Data, uint16_t Count) { io.WriteSequence(Data, Count); }
inline static void WriteMultiple(uint16_t Color, uint32_t Count) { io.WriteMultiple(Color, Count); }
inline static void writeSequence(uint16_t *data, uint16_t count) { io.writeSequence(data, count); }
inline static void writeMultiple(uint16_t color, uint32_t count) { io.writeMultiple(color, count); }
// Non-blocking DMA-based IO used by TFT_COLOR_UI only
// These functions start data transfer using DMA and do NOT wait for data transfer completion
inline static void WriteSequenceDMA(uint16_t *Data, uint16_t Count) { io.WriteSequence_DMA(Data, Count); }
inline static void WriteMultipleDMA(uint16_t Color, uint16_t Count) { io.WriteMultiple_DMA(Color, Count); }
inline static void writeSequenceDMA(uint16_t *data, uint16_t count) { io.writeSequence_DMA(data, count); }
inline static void WriteMultipleDMA(uint16_t color, uint16_t count) { io.writeMultiple_DMA(color, count); }
// Non-blocking DMA-based IO with IRQ callback used by TFT_LVGL_UI only
// This function starts data transfer using DMA and does NOT wait for data transfer completion
#if ENABLED(USE_SPI_DMA_TC)
inline static void WriteSequenceIT(uint16_t *Data, uint16_t Count) { io.WriteSequenceIT(Data, Count); }
inline static void writeSequenceIT(uint16_t *data, uint16_t count) { io.writeSequenceIT(data, count); }
#endif
protected:

View File

@@ -60,7 +60,7 @@
TouchButtons touchBt;
void TouchButtons::init() {
touchIO.Init();
touchIO.init();
TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60));
}

View File

@@ -1607,8 +1607,8 @@ void MarlinSettings::postprocess() {
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
{
_FIELD_TEST(dwin_settings);
char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
CrealityDWIN.Save_Settings(dwin_settings);
char dwin_settings[crealityDWIN.eeprom_data_size] = { 0 };
crealityDWIN.saveSettings(dwin_settings);
EEPROM_WRITE(dwin_settings);
}
#endif
@@ -2661,10 +2661,10 @@ void MarlinSettings::postprocess() {
}
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
{
const char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
const char dwin_settings[crealityDWIN.eeprom_data_size] = { 0 };
_FIELD_TEST(dwin_settings);
EEPROM_READ(dwin_settings);
if (!validating) CrealityDWIN.Load_Settings(dwin_settings);
if (!validating) crealityDWIN.loadSettings(dwin_settings);
}
#endif
@@ -3147,7 +3147,7 @@ void MarlinSettings::reset() {
#endif
#endif
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
TERN_(DWIN_CREALITY_LCD_JYERSUI, crealityDWIN.resetSettings());
//
// Case Light Brightness

View File

@@ -856,7 +856,7 @@ volatile bool Temperature::raw_temps_ready = false;
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
#endif
if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
TERN_(DWIN_CREALITY_LCD, DWIN_Popup_Temperature(0));
TERN_(DWIN_CREALITY_LCD, dwinPopupTemperature(0));
TERN_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TUNING_TIMEOUT));
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::PID_TUNING_TIMEOUT));
TERN_(HOST_PROMPT_SUPPORT, hostui.notify(GET_TEXT_F(MSG_PID_TIMEOUT)));
@@ -919,7 +919,7 @@ volatile bool Temperature::raw_temps_ready = false;
hal.idletask();
// Run UI update
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update());
}
wait_for_heatup = false;
@@ -1183,7 +1183,7 @@ volatile bool Temperature::raw_temps_ready = false;
}
hal.idletask();
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update());
if (!wait_for_heatup) {
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED);

View File

@@ -70,7 +70,7 @@ typedef enum : uint8_t {
SD_CARD_ERROR_WRITE_PROGRAMMING = 0x16, // Card returned an error to a CMD13 status check after a write
SD_CARD_ERROR_WRITE_TIMEOUT = 0x17, // Timeout occurred during write programming
SD_CARD_ERROR_SCK_RATE = 0x18, // Incorrect rate selected
SD_CARD_ERROR_INIT_NOT_CALLED = 0x19, // Init() not called
SD_CARD_ERROR_INIT_NOT_CALLED = 0x19, // init() not called
// 0x1A is unused now, it was: card returned an error for CMD59 (CRC_ON_OFF)
SD_CARD_ERROR_READ_CRC = 0x1B // Invalid read CRC
} sd_error_code_t;

View File

@@ -621,7 +621,7 @@ void CardReader::startOrResumeFilePrinting() {
//
void CardReader::endFilePrintNow(TERN_(SD_RESORT, const bool re_sort/*=false*/)) {
TERN_(ADVANCED_PAUSE_FEATURE, did_pause_print = 0);
TERN_(DWIN_CREALITY_LCD, HMI_flag.print_finish = flag.sdprinting);
TERN_(DWIN_CREALITY_LCD, hmiFlag.print_finish = flag.sdprinting);
flag.abort_sd_printing = false;
if (isFileOpen()) file.close();
TERN_(SD_RESORT, if (re_sort) presort());