🎨 Lowercase methods, functions, data members (#25939)
For: TFT, DGUS, MarlinUI, Anycubic, JyersUI, CrealityUI
This commit is contained in:
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE);
|
SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE);
|
||||||
|
|
||||||
void TFT_SPI::Init() {
|
void TFT_SPI::init() {
|
||||||
#if PIN_EXISTS(TFT_RESET)
|
#if PIN_EXISTS(TFT_RESET)
|
||||||
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||||
delay(100);
|
delay(100);
|
||||||
@@ -49,21 +49,21 @@ void TFT_SPI::Init() {
|
|||||||
SPIx.setDataMode(SPI_MODE0);
|
SPIx.setDataMode(SPI_MODE0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
|
||||||
SPIx.setDataSize(DataSize);
|
SPIx.setDataSize(dataSize);
|
||||||
SPIx.begin();
|
SPIx.begin();
|
||||||
WRITE(TFT_CS_PIN, LOW);
|
WRITE(TFT_CS_PIN, LOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_SPI::GetID() {
|
uint32_t TFT_SPI::getID() {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
id = ReadID(LCD_READ_ID);
|
id = readID(LCD_READ_ID);
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||||
id = ReadID(LCD_READ_ID4);
|
id = readID(LCD_READ_ID4);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
uint32_t TFT_SPI::readID(uint16_t reg) {
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
|
|
||||||
#if PIN_EXISTS(TFT_MISO)
|
#if PIN_EXISTS(TFT_MISO)
|
||||||
@@ -72,14 +72,14 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
|||||||
SPIx.setClock(SPI_CLOCK_DIV64);
|
SPIx.setClock(SPI_CLOCK_DIV64);
|
||||||
SPIx.begin();
|
SPIx.begin();
|
||||||
WRITE(TFT_CS_PIN, LOW);
|
WRITE(TFT_CS_PIN, LOW);
|
||||||
WriteReg(Reg);
|
writeReg(reg);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 4; ++i) {
|
for (uint8_t i = 0; i < 4; ++i) {
|
||||||
SPIx.read((uint8_t*)&d, 1);
|
SPIx.read((uint8_t*)&d, 1);
|
||||||
data = (data << 8) | d;
|
data = (data << 8) | d;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTransferEnd();
|
dataTransferEnd();
|
||||||
SPIx.setClock(SPI_CLOCK_MAX_TFT);
|
SPIx.setClock(SPI_CLOCK_MAX_TFT);
|
||||||
#endif
|
#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;
|
if ((SSP_GetStatus(LPC_SSPx, SSP_STAT_TXFIFO_EMPTY) == RESET) || (SSP_GetStatus(LPC_SSPx, SSP_STAT_BUSY) == SET)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Abort();
|
abort();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::Abort() {
|
void TFT_SPI::abort() {
|
||||||
// DMA Channel 0 is hardcoded in dmaSendAsync() and dmaSend()
|
// DMA Channel 0 is hardcoded in dmaSendAsync() and dmaSend()
|
||||||
|
|
||||||
// Disable DMA
|
// Disable DMA
|
||||||
@@ -126,20 +126,20 @@ void TFT_SPI::Abort() {
|
|||||||
LPC_GPDMACH0->DMACCSrcAddr = 0U;
|
LPC_GPDMACH0->DMACCSrcAddr = 0U;
|
||||||
LPC_GPDMACH0->DMACCDestAddr = 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) {
|
void TFT_SPI::transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
|
||||||
DataTransferBegin(DATASIZE_16BIT);
|
dataTransferBegin(DATASIZE_16BIT);
|
||||||
SPIx.dmaSend(Data, Count, MemoryIncrease);
|
SPIx.dmaSend(data, count, memoryIncrease);
|
||||||
Abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
|
||||||
DataTransferBegin(DATASIZE_16BIT);
|
dataTransferBegin(DATASIZE_16BIT);
|
||||||
SPIx.dmaSendAsync(Data, Count, MemoryIncrease);
|
SPIx.dmaSendAsync(data, count, memoryIncrease);
|
||||||
|
|
||||||
TERN_(TFT_SHARED_IO, while (isBusy()));
|
TERN_(TFT_SHARED_IO, while (isBusy()));
|
||||||
}
|
}
|
||||||
|
@@ -56,34 +56,34 @@
|
|||||||
|
|
||||||
class TFT_SPI {
|
class TFT_SPI {
|
||||||
private:
|
private:
|
||||||
static uint32_t ReadID(uint16_t Reg);
|
static uint32_t readID(uint16_t reg);
|
||||||
static void Transmit(uint16_t Data);
|
static void transmit(uint16_t data);
|
||||||
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
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 void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SPIClass SPIx;
|
static SPIClass SPIx;
|
||||||
|
|
||||||
static void Init();
|
static void init();
|
||||||
static uint32_t GetID();
|
static uint32_t getID();
|
||||||
static bool isBusy();
|
static bool isBusy();
|
||||||
static void Abort();
|
static void abort();
|
||||||
|
|
||||||
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
|
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
|
||||||
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
|
static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SSP_Cmd(LPC_SSPx, DISABLE); };
|
||||||
static void DataTransferAbort();
|
static void dataTransferAbort();
|
||||||
|
|
||||||
static void WriteData(uint16_t Data) { Transmit(Data); }
|
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 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 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 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 writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); }
|
||||||
static void WriteMultiple(uint16_t Color, uint32_t Count) {
|
static void writeMultiple(uint16_t color, uint32_t count) {
|
||||||
while (Count > 0) {
|
while (count > 0) {
|
||||||
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
|
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
|
||||||
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
|
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -45,7 +45,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; }
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void XPT2046::Init() {
|
void XPT2046::init() {
|
||||||
#if DISABLED(TOUCH_BUTTONS_HW_SPI)
|
#if DISABLED(TOUCH_BUTTONS_HW_SPI)
|
||||||
SET_INPUT(TOUCH_MISO_PIN);
|
SET_INPUT(TOUCH_MISO_PIN);
|
||||||
SET_OUTPUT(TOUCH_MOSI_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 XPT2046::getRawData(const XPTCoordinate coordinate) {
|
||||||
uint16_t data[3];
|
uint16_t data[3];
|
||||||
|
|
||||||
DataTransferBegin();
|
dataTransferBegin();
|
||||||
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin());
|
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin());
|
||||||
|
|
||||||
for (uint16_t i = 0; i < 3 ; i++) {
|
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());
|
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end());
|
||||||
DataTransferEnd();
|
dataTransferEnd();
|
||||||
|
|
||||||
uint16_t delta01 = delta(data[0], data[1]),
|
uint16_t delta01 = delta(data[0], data[1]),
|
||||||
delta02 = delta(data[0], data[2]),
|
delta02 = delta(data[0], data[2]),
|
||||||
@@ -107,18 +107,18 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t XPT2046::IO(uint16_t data) {
|
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);
|
extern uint8_t spiTransfer(uint8_t b);
|
||||||
|
|
||||||
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
#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);
|
return SPIx.transfer(data & 0xFF);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t XPT2046::SoftwareIO(uint16_t data) {
|
uint16_t XPT2046::softwareIO(uint16_t data) {
|
||||||
uint16_t result = 0;
|
uint16_t result = 0;
|
||||||
|
|
||||||
for (uint8_t j = 0x80; j; j >>= 1) {
|
for (uint8_t j = 0x80; j; j >>= 1) {
|
||||||
|
@@ -65,12 +65,12 @@ private:
|
|||||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||||
static bool isTouched();
|
static bool isTouched();
|
||||||
|
|
||||||
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
static void dataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
||||||
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||||
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
||||||
static uint16_t HardwareIO(uint16_t data);
|
static uint16_t hardwareIO(uint16_t data);
|
||||||
#endif
|
#endif
|
||||||
static uint16_t SoftwareIO(uint16_t data);
|
static uint16_t softwareIO(uint16_t data);
|
||||||
static uint16_t IO(uint16_t data = 0);
|
static uint16_t IO(uint16_t data = 0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -78,6 +78,6 @@ public:
|
|||||||
static SPIClass SPIx;
|
static SPIClass SPIx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void Init();
|
static void init();
|
||||||
static bool getRawPoint(int16_t *x, int16_t *y);
|
static bool getRawPoint(int16_t *x, int16_t *y);
|
||||||
};
|
};
|
||||||
|
@@ -40,28 +40,28 @@
|
|||||||
|
|
||||||
class TFT_SPI {
|
class TFT_SPI {
|
||||||
private:
|
private:
|
||||||
static uint32_t ReadID(uint16_t Reg);
|
static uint32_t readID(uint16_t reg);
|
||||||
static void Transmit(uint16_t Data);
|
static void transmit(uint16_t data);
|
||||||
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// static SPIClass SPIx;
|
// static SPIClass SPIx;
|
||||||
|
|
||||||
static void Init();
|
static void init();
|
||||||
static uint32_t GetID();
|
static uint32_t getID();
|
||||||
static bool isBusy();
|
static bool isBusy();
|
||||||
static void Abort();
|
static void abort();
|
||||||
|
|
||||||
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
|
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
|
||||||
static void DataTransferEnd();
|
static void dataTransferEnd();
|
||||||
static void DataTransferAbort();
|
static void dataTransferAbort();
|
||||||
|
|
||||||
static void WriteData(uint16_t Data);
|
static void writeData(uint16_t data);
|
||||||
static void WriteReg(uint16_t Reg);
|
static void writeReg(uint16_t reg);
|
||||||
|
|
||||||
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { WriteSequence(Data, 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 writeMultiple_DMA(uint16_t color, uint16_t count) { writeMultiple(color, count); }
|
||||||
|
|
||||||
static void WriteSequence(uint16_t *Data, uint16_t Count);
|
static void writeSequence(uint16_t *data, uint16_t count);
|
||||||
static void WriteMultiple(uint16_t Color, uint32_t Count);
|
static void writeMultiple(uint16_t color, uint32_t count);
|
||||||
};
|
};
|
||||||
|
@@ -62,12 +62,12 @@ private:
|
|||||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||||
static bool isTouched();
|
static bool isTouched();
|
||||||
|
|
||||||
static void DataTransferBegin();
|
static void dataTransferBegin();
|
||||||
static void DataTransferEnd();
|
static void dataTransferEnd();
|
||||||
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
||||||
static uint16_t HardwareIO(uint16_t data);
|
static uint16_t hardwareIO(uint16_t data);
|
||||||
#endif
|
#endif
|
||||||
static uint16_t SoftwareIO(uint16_t data);
|
static uint16_t softwareIO(uint16_t data);
|
||||||
static uint16_t IO(uint16_t data = 0);
|
static uint16_t IO(uint16_t data = 0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -75,6 +75,6 @@ public:
|
|||||||
static SPIClass SPIx;
|
static SPIClass SPIx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void Init();
|
static void init();
|
||||||
static bool getRawPoint(int16_t *x, int16_t *y);
|
static bool getRawPoint(int16_t *x, int16_t *y);
|
||||||
};
|
};
|
||||||
|
@@ -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();
|
sw_iic.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GT911::Init() {
|
void GT911::init() {
|
||||||
OUT_WRITE(GT911_RST_PIN, LOW);
|
OUT_WRITE(GT911_RST_PIN, LOW);
|
||||||
OUT_WRITE(GT911_INT_PIN, LOW);
|
OUT_WRITE(GT911_INT_PIN, LOW);
|
||||||
delay(11);
|
delay(11);
|
||||||
|
@@ -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);
|
static void read_reg(uint16_t reg, uint8_t reg_len, uint8_t* r_data, uint8_t r_len);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void init();
|
||||||
static bool getFirstTouchPoint(int16_t *x, int16_t *y);
|
static bool getFirstTouchPoint(int16_t *x, int16_t *y);
|
||||||
static bool getPoint(int16_t *x, int16_t *y);
|
static bool getPoint(int16_t *x, int16_t *y);
|
||||||
};
|
};
|
||||||
|
@@ -35,17 +35,17 @@ SRAM_HandleTypeDef TFT_FSMC::SRAMx;
|
|||||||
DMA_HandleTypeDef TFT_FSMC::DMAtx;
|
DMA_HandleTypeDef TFT_FSMC::DMAtx;
|
||||||
LCD_CONTROLLER_TypeDef *TFT_FSMC::LCD;
|
LCD_CONTROLLER_TypeDef *TFT_FSMC::LCD;
|
||||||
|
|
||||||
void TFT_FSMC::Init() {
|
void TFT_FSMC::init() {
|
||||||
uint32_t controllerAddress;
|
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
|
// Perform the SRAM1 memory initialization sequence
|
||||||
SRAMx.Instance = FSMC_NORSRAM_DEVICE;
|
SRAMx.Instance = FSMC_NORSRAM_DEVICE;
|
||||||
SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
|
SRAMx.Extended = FSMC_NORSRAM_EXTENDED_DEVICE;
|
||||||
// SRAMx.Init
|
// SRAMx.Init
|
||||||
SRAMx.Init.NSBank = NSBank;
|
SRAMx.Init.NSBank = nsBank;
|
||||||
SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
|
SRAMx.Init.DataAddressMux = FSMC_DATA_ADDRESS_MUX_DISABLE;
|
||||||
SRAMx.Init.MemoryType = FSMC_MEMORY_TYPE_SRAM;
|
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);
|
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
|
#endif
|
||||||
// Read Timing - relatively slow to ensure ID information is correctly read from TFT controller
|
// 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
|
// Can be decreases from 15-15-24 to 4-4-8 with risk of stability loss
|
||||||
Timing.AddressSetupTime = 15;
|
timing.AddressSetupTime = 15;
|
||||||
Timing.AddressHoldTime = 15;
|
timing.AddressHoldTime = 15;
|
||||||
Timing.DataSetupTime = 24;
|
timing.DataSetupTime = 24;
|
||||||
Timing.BusTurnAroundDuration = 0;
|
timing.BusTurnAroundDuration = 0;
|
||||||
Timing.CLKDivision = 16;
|
timing.CLKDivision = 16;
|
||||||
Timing.DataLatency = 17;
|
timing.DataLatency = 17;
|
||||||
Timing.AccessMode = FSMC_ACCESS_MODE_A;
|
timing.AccessMode = FSMC_ACCESS_MODE_A;
|
||||||
// Write Timing
|
// Write Timing
|
||||||
// Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss
|
// Can be decreased from 8-15-8 to 0-0-1 with risk of stability loss
|
||||||
ExtTiming.AddressSetupTime = 8;
|
extTiming.AddressSetupTime = 8;
|
||||||
ExtTiming.AddressHoldTime = 15;
|
extTiming.AddressHoldTime = 15;
|
||||||
ExtTiming.DataSetupTime = 8;
|
extTiming.DataSetupTime = 8;
|
||||||
ExtTiming.BusTurnAroundDuration = 0;
|
extTiming.BusTurnAroundDuration = 0;
|
||||||
ExtTiming.CLKDivision = 16;
|
extTiming.CLKDivision = 16;
|
||||||
ExtTiming.DataLatency = 17;
|
extTiming.DataLatency = 17;
|
||||||
ExtTiming.AccessMode = FSMC_ACCESS_MODE_A;
|
extTiming.AccessMode = FSMC_ACCESS_MODE_A;
|
||||||
|
|
||||||
__HAL_RCC_FSMC_CLK_ENABLE();
|
__HAL_RCC_FSMC_CLK_ENABLE();
|
||||||
|
|
||||||
for (uint16_t i = 0; PinMap_FSMC[i].pin != NC; i++)
|
for (uint16_t i = 0; pinMap_FSMC[i].pin != NC; i++)
|
||||||
pinmap_pinout(PinMap_FSMC[i].pin, PinMap_FSMC);
|
pinmap_pinout(pinMap_FSMC[i].pin, pinMap_FSMC);
|
||||||
pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), PinMap_FSMC_CS);
|
pinmap_pinout(digitalPinToPinName(TFT_CS_PIN), pinMap_FSMC_CS);
|
||||||
pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), PinMap_FSMC_RS);
|
pinmap_pinout(digitalPinToPinName(TFT_RS_PIN), pinMap_FSMC_RS);
|
||||||
|
|
||||||
controllerAddress = FSMC_BANK1_1;
|
controllerAddress = FSMC_BANK1_1;
|
||||||
#ifdef PF0
|
#ifdef PF0
|
||||||
switch (NSBank) {
|
switch (nsBank) {
|
||||||
case FSMC_NORSRAM_BANK2: controllerAddress = FSMC_BANK1_2 ; break;
|
case FSMC_NORSRAM_BANK2: controllerAddress = FSMC_BANK1_2 ; break;
|
||||||
case FSMC_NORSRAM_BANK3: controllerAddress = FSMC_BANK1_3 ; break;
|
case FSMC_NORSRAM_BANK3: controllerAddress = FSMC_BANK1_3 ; break;
|
||||||
case FSMC_NORSRAM_BANK4: controllerAddress = FSMC_BANK1_4 ; break;
|
case FSMC_NORSRAM_BANK4: controllerAddress = FSMC_BANK1_4 ; break;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
#ifdef STM32F1xx
|
||||||
__HAL_RCC_DMA1_CLK_ENABLE();
|
__HAL_RCC_DMA1_CLK_ENABLE();
|
||||||
@@ -123,23 +123,23 @@ void TFT_FSMC::Init() {
|
|||||||
LCD = (LCD_CONTROLLER_TypeDef *)controllerAddress;
|
LCD = (LCD_CONTROLLER_TypeDef *)controllerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_FSMC::GetID() {
|
uint32_t TFT_FSMC::getID() {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
WriteReg(0);
|
writeReg(0);
|
||||||
id = LCD->RAM;
|
id = LCD->RAM;
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
id = ReadID(LCD_READ_ID);
|
id = readID(LCD_READ_ID);
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||||
id = ReadID(LCD_READ_ID4);
|
id = readID(LCD_READ_ID4);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_FSMC::ReadID(tft_data_t Reg) {
|
uint32_t TFT_FSMC::readID(tft_data_t reg) {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
WriteReg(Reg);
|
writeReg(reg);
|
||||||
id = LCD->RAM; // dummy read
|
id = LCD->RAM; // dummy read
|
||||||
id = Reg << 24;
|
id = reg << 24;
|
||||||
id |= (LCD->RAM & 0x00FF) << 16;
|
id |= (LCD->RAM & 0x00FF) << 16;
|
||||||
id |= (LCD->RAM & 0x00FF) << 8;
|
id |= (LCD->RAM & 0x00FF) << 8;
|
||||||
id |= LCD->RAM & 0x00FF;
|
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;
|
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();
|
__DSB();
|
||||||
Abort();
|
abort();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_FSMC::Abort() {
|
void TFT_FSMC::abort() {
|
||||||
HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any
|
HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any
|
||||||
HAL_DMA_DeInit(&DMAtx); // Deconfigure DMA
|
HAL_DMA_DeInit(&DMAtx); // Deconfigure DMA
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
DMAtx.Init.PeriphInc = MemoryIncrease;
|
DMAtx.Init.PeriphInc = memoryIncrease;
|
||||||
HAL_DMA_Init(&DMAtx);
|
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()));
|
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) {
|
||||||
DMAtx.Init.PeriphInc = MemoryIncrease;
|
DMAtx.Init.PeriphInc = memoryIncrease;
|
||||||
HAL_DMA_Init(&DMAtx);
|
HAL_DMA_Init(&DMAtx);
|
||||||
DataTransferBegin();
|
dataTransferBegin();
|
||||||
HAL_DMA_Start(&DMAtx, (uint32_t)Data, (uint32_t)&(LCD->RAM), Count);
|
HAL_DMA_Start(&DMAtx, (uint32_t)data, (uint32_t)&(LCD->RAM), count);
|
||||||
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||||
Abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_FSMC_TFT
|
#endif // HAS_FSMC_TFT
|
||||||
|
@@ -62,31 +62,31 @@ class TFT_FSMC {
|
|||||||
|
|
||||||
static LCD_CONTROLLER_TypeDef *LCD;
|
static LCD_CONTROLLER_TypeDef *LCD;
|
||||||
|
|
||||||
static uint32_t ReadID(tft_data_t Reg);
|
static uint32_t readID(tft_data_t reg);
|
||||||
static void Transmit(tft_data_t Data) { LCD->RAM = Data; __DSB(); }
|
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 transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
static void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void init();
|
||||||
static uint32_t GetID();
|
static uint32_t getID();
|
||||||
static bool isBusy();
|
static bool isBusy();
|
||||||
static void Abort();
|
static void abort();
|
||||||
|
|
||||||
static void DataTransferBegin(uint16_t DataWidth=TFT_DATASIZE) {}
|
static void dataTransferBegin(uint16_t dataWidth=TFT_DATASIZE) {}
|
||||||
static void DataTransferEnd() {}
|
static void dataTransferEnd() {}
|
||||||
|
|
||||||
static void WriteData(uint16_t Data) { Transmit(tft_data_t(Data)); }
|
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 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 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 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 writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); }
|
||||||
static void WriteMultiple(uint16_t Color, uint32_t Count) {
|
static void writeMultiple(uint16_t color, uint32_t count) {
|
||||||
while (Count > 0) {
|
while (count > 0) {
|
||||||
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
|
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
|
||||||
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
|
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -103,7 +103,7 @@ class TFT_FSMC {
|
|||||||
#error No configuration for this MCU
|
#error No configuration for this MCU
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const PinMap PinMap_FSMC[] = {
|
const PinMap pinMap_FSMC[] = {
|
||||||
{PD_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D00
|
{PD_14, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D00
|
||||||
{PD_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D01
|
{PD_15, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D01
|
||||||
{PD_0, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D02
|
{PD_0, FSMC_NORSRAM_DEVICE, FSMC_PIN_DATA}, // FSMC_D02
|
||||||
@@ -127,7 +127,7 @@ const PinMap PinMap_FSMC[] = {
|
|||||||
{NC, NP, 0}
|
{NC, NP, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
const PinMap PinMap_FSMC_CS[] = {
|
const PinMap pinMap_FSMC_CS[] = {
|
||||||
{PD_7, (void *)FSMC_NORSRAM_BANK1, FSMC_PIN_DATA}, // FSMC_NE1
|
{PD_7, (void *)FSMC_NORSRAM_BANK1, FSMC_PIN_DATA}, // FSMC_NE1
|
||||||
#ifdef PF0
|
#ifdef PF0
|
||||||
{PG_9, (void *)FSMC_NORSRAM_BANK2, FSMC_PIN_DATA}, // FSMC_NE2
|
{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)
|
#define FSMC_RS(A) (void *)((2 << A) - 2)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const PinMap PinMap_FSMC_RS[] = {
|
const PinMap pinMap_FSMC_RS[] = {
|
||||||
#ifdef PF0
|
#ifdef PF0
|
||||||
{PF_0, FSMC_RS( 0), FSMC_PIN_DATA}, // FSMC_A0
|
{PF_0, FSMC_RS( 0), FSMC_PIN_DATA}, // FSMC_A0
|
||||||
{PF_1, FSMC_RS( 1), FSMC_PIN_DATA}, // FSMC_A1
|
{PF_1, FSMC_RS( 1), FSMC_PIN_DATA}, // FSMC_A1
|
||||||
|
@@ -246,28 +246,28 @@ uint16_t TFT_LTDC::y_cur = 0;
|
|||||||
uint8_t TFT_LTDC::reg = 0;
|
uint8_t TFT_LTDC::reg = 0;
|
||||||
volatile uint16_t* TFT_LTDC::framebuffer = (volatile uint16_t* )FRAME_BUFFER_ADDRESS;
|
volatile uint16_t* TFT_LTDC::framebuffer = (volatile uint16_t* )FRAME_BUFFER_ADDRESS;
|
||||||
|
|
||||||
void TFT_LTDC::Init() {
|
void TFT_LTDC::init() {
|
||||||
|
|
||||||
// SDRAM pins init
|
// SDRAM pins init
|
||||||
for (uint16_t i = 0; PinMap_SDRAM[i].pin != NC; i++)
|
for (uint16_t i = 0; pinMap_SDRAM[i].pin != NC; i++)
|
||||||
pinmap_pinout(PinMap_SDRAM[i].pin, PinMap_SDRAM);
|
pinmap_pinout(pinMap_SDRAM[i].pin, pinMap_SDRAM);
|
||||||
|
|
||||||
// SDRAM peripheral config
|
// SDRAM peripheral config
|
||||||
SDRAM_Config();
|
SDRAM_Config();
|
||||||
|
|
||||||
// LTDC pins init
|
// LTDC pins init
|
||||||
for (uint16_t i = 0; PinMap_LTDC[i].pin != NC; i++)
|
for (uint16_t i = 0; pinMap_LTDC[i].pin != NC; i++)
|
||||||
pinmap_pinout(PinMap_LTDC[i].pin, PinMap_LTDC);
|
pinmap_pinout(pinMap_LTDC[i].pin, pinMap_LTDC);
|
||||||
|
|
||||||
// LTDC peripheral config
|
// LTDC peripheral config
|
||||||
LTDC_Config();
|
LTDC_Config();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_LTDC::GetID() {
|
uint32_t TFT_LTDC::getID() {
|
||||||
return 0xABAB;
|
return 0xABAB;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_LTDC::ReadID(tft_data_t Reg) {
|
uint32_t TFT_LTDC::readID(tft_data_t reg) {
|
||||||
return 0xABAB;
|
return 0xABAB;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,15 +275,15 @@ bool TFT_LTDC::isBusy() {
|
|||||||
return false;
|
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];
|
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;
|
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;
|
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);
|
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;
|
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);
|
SBI(DMA2D->IFCR, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_LTDC::WriteData(uint16_t data) {
|
void TFT_LTDC::writeData(uint16_t data) {
|
||||||
switch (reg) {
|
switch (reg) {
|
||||||
case 0x01: x_cur = x_min = data; return;
|
case 0x01: x_cur = x_min = data; return;
|
||||||
case 0x02: x_max = data; return;
|
case 0x02: x_max = data; return;
|
||||||
case 0x03: y_cur = y_min = data; return;
|
case 0x03: y_cur = y_min = data; return;
|
||||||
case 0x04: y_max = data; return;
|
case 0x04: y_max = data; return;
|
||||||
}
|
}
|
||||||
Transmit(data);
|
transmit(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_LTDC::Transmit(tft_data_t Data) {
|
void TFT_LTDC::transmit(tft_data_t data) {
|
||||||
DrawPoint(x_cur, y_cur, Data);
|
drawPoint(x_cur, y_cur, data);
|
||||||
x_cur++;
|
x_cur++;
|
||||||
if (x_cur > x_max) {
|
if (x_cur > x_max) {
|
||||||
x_cur = x_min;
|
x_cur = x_min;
|
||||||
@@ -352,35 +352,35 @@ void TFT_LTDC::Transmit(tft_data_t Data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_LTDC::WriteReg(uint16_t Reg) {
|
void TFT_LTDC::writeReg(uint16_t reg) {
|
||||||
reg = 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) {
|
while (x_cur != x_min && count) {
|
||||||
Transmit(*Data);
|
transmit(*data);
|
||||||
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
|
if (memoryIncrease == DMA_PINC_ENABLE) data++;
|
||||||
Count--;
|
count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t width = x_max - x_min + 1;
|
uint16_t width = x_max - x_min + 1;
|
||||||
uint16_t height = Count / width;
|
uint16_t height = count / width;
|
||||||
uint16_t x_end_cnt = Count - (width * height);
|
uint16_t x_end_cnt = count - (width * height);
|
||||||
|
|
||||||
if (height) {
|
if (height) {
|
||||||
if (MemoryIncrease == DMA_PINC_ENABLE) {
|
if (memoryIncrease == DMA_PINC_ENABLE) {
|
||||||
DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
|
drawImage(x_min, y_cur, x_min + width, y_cur + height, data);
|
||||||
Data += width * height;
|
data += width * height;
|
||||||
}
|
}
|
||||||
else
|
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;
|
y_cur += height;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (x_end_cnt) {
|
while (x_end_cnt) {
|
||||||
Transmit(*Data);
|
transmit(*data);
|
||||||
if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
|
if (memoryIncrease == DMA_PINC_ENABLE) data++;
|
||||||
x_end_cnt--;
|
x_end_cnt--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -43,41 +43,41 @@ class TFT_LTDC {
|
|||||||
static uint16_t x_min, x_max, y_min, y_max, x_cur, y_cur;
|
static uint16_t x_min, x_max, y_min, y_max, x_cur, y_cur;
|
||||||
static uint8_t reg;
|
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 uint16_t readPoint(uint16_t x, uint16_t y);
|
||||||
static void DrawPoint(uint16_t x, uint16_t y, uint16_t color);
|
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 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 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(tft_data_t data);
|
||||||
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
static void transmit(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void init();
|
||||||
static uint32_t GetID();
|
static uint32_t getID();
|
||||||
static bool isBusy();
|
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 dataTransferBegin(uint16_t dataWidth=TFT_DATASIZE) {}
|
||||||
static void DataTransferEnd() {};
|
static void dataTransferEnd() {};
|
||||||
|
|
||||||
static void WriteData(uint16_t Data);
|
static void writeData(uint16_t data);
|
||||||
static void WriteReg(uint16_t Reg);
|
static void writeReg(uint16_t reg);
|
||||||
|
|
||||||
// Non-blocking DMA data transfer is not implemented for LTDC interface
|
// 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 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 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 writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); }
|
||||||
static void WriteMultiple(uint16_t Color, uint32_t Count) {
|
static void writeMultiple(uint16_t color, uint32_t count) {
|
||||||
while (Count > 0) {
|
while (count > 0) {
|
||||||
Transmit(DMA_PINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
|
transmit(DMA_PINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
|
||||||
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
|
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
|
{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
|
{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
|
{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}
|
{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_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_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
|
{PC_3, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCKE0
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
SPI_HandleTypeDef TFT_SPI::SPIx;
|
SPI_HandleTypeDef TFT_SPI::SPIx;
|
||||||
DMA_HandleTypeDef TFT_SPI::DMAtx;
|
DMA_HandleTypeDef TFT_SPI::DMAtx;
|
||||||
|
|
||||||
void TFT_SPI::Init() {
|
void TFT_SPI::init() {
|
||||||
SPI_TypeDef *spiInstance;
|
SPI_TypeDef *spiInstance;
|
||||||
|
|
||||||
OUT_WRITE(TFT_A0_PIN, HIGH);
|
OUT_WRITE(TFT_A0_PIN, HIGH);
|
||||||
@@ -122,8 +122,8 @@ void TFT_SPI::Init() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
|
||||||
SPIx.Init.DataSize = DataSize == DATASIZE_8BIT ? SPI_DATASIZE_8BIT : SPI_DATASIZE_16BIT;
|
SPIx.Init.DataSize = dataSize == DATASIZE_8BIT ? SPI_DATASIZE_8BIT : SPI_DATASIZE_16BIT;
|
||||||
HAL_SPI_Init(&SPIx);
|
HAL_SPI_Init(&SPIx);
|
||||||
WRITE(TFT_CS_PIN, LOW);
|
WRITE(TFT_CS_PIN, LOW);
|
||||||
}
|
}
|
||||||
@@ -132,11 +132,11 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
|||||||
#include "../../../lcd/tft_io/tft_ids.h"
|
#include "../../../lcd/tft_io/tft_ids.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t TFT_SPI::GetID() {
|
uint32_t TFT_SPI::getID() {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
id = ReadID(LCD_READ_ID);
|
id = readID(LCD_READ_ID);
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) {
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) {
|
||||||
id = ReadID(LCD_READ_ID4);
|
id = readID(LCD_READ_ID4);
|
||||||
#ifdef TFT_DEFAULT_DRIVER
|
#ifdef TFT_DEFAULT_DRIVER
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||||
id = TFT_DEFAULT_DRIVER;
|
id = TFT_DEFAULT_DRIVER;
|
||||||
@@ -145,15 +145,15 @@ uint32_t TFT_SPI::GetID() {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
uint32_t TFT_SPI::readID(uint16_t reg) {
|
||||||
uint32_t Data = 0;
|
uint32_t data = 0;
|
||||||
#if PIN_EXISTS(TFT_MISO)
|
#if PIN_EXISTS(TFT_MISO)
|
||||||
uint32_t BaudRatePrescaler = SPIx.Init.BaudRatePrescaler;
|
uint32_t BaudRatePrescaler = SPIx.Init.BaudRatePrescaler;
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
SPIx.Init.BaudRatePrescaler = SPIx.Instance == SPI1 ? SPI_BAUDRATEPRESCALER_8 : SPI_BAUDRATEPRESCALER_4;
|
SPIx.Init.BaudRatePrescaler = SPIx.Instance == SPI1 ? SPI_BAUDRATEPRESCALER_8 : SPI_BAUDRATEPRESCALER_4;
|
||||||
DataTransferBegin(DATASIZE_8BIT);
|
dataTransferBegin(DATASIZE_8BIT);
|
||||||
WriteReg(Reg);
|
writeReg(reg);
|
||||||
|
|
||||||
if (SPIx.Init.Direction == SPI_DIRECTION_1LINE) SPI_1LINE_RX(&SPIx);
|
if (SPIx.Init.Direction == SPI_DIRECTION_1LINE) SPI_1LINE_RX(&SPIx);
|
||||||
__HAL_SPI_ENABLE(&SPIx);
|
__HAL_SPI_ENABLE(&SPIx);
|
||||||
@@ -164,15 +164,15 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
|||||||
SPIx.Instance->DR = 0;
|
SPIx.Instance->DR = 0;
|
||||||
#endif
|
#endif
|
||||||
while (!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_RXNE)) {}
|
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;
|
SPIx.Init.BaudRatePrescaler = BaudRatePrescaler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return Data >> 7;
|
return data >> 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TFT_SPI::isBusy() {
|
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;
|
if ((!__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_TXE)) || (__HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY))) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Abort();
|
abort();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::Abort() {
|
void TFT_SPI::abort() {
|
||||||
HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any
|
HAL_DMA_Abort(&DMAtx); // Abort DMA transfer if any
|
||||||
HAL_DMA_DeInit(&DMAtx);
|
HAL_DMA_DeInit(&DMAtx);
|
||||||
|
|
||||||
CLEAR_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN);
|
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
|
#if TFT_MISO_PIN == TFT_MOSI_PIN
|
||||||
SPI_1LINE_TX(&SPIx);
|
SPI_1LINE_TX(&SPIx);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__HAL_SPI_ENABLE(&SPIx);
|
__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_TXE)) {}
|
||||||
while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {}
|
while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {}
|
||||||
@@ -227,17 +227,17 @@ void TFT_SPI::Transmit(uint16_t Data) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
|
void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
|
||||||
DMAtx.Init.MemInc = MemoryIncrease;
|
DMAtx.Init.MemInc = memoryIncrease;
|
||||||
HAL_DMA_Init(&DMAtx);
|
HAL_DMA_Init(&DMAtx);
|
||||||
|
|
||||||
#if TFT_MISO_PIN == TFT_MOSI_PIN
|
#if TFT_MISO_PIN == TFT_MOSI_PIN
|
||||||
SPI_1LINE_TX(&SPIx);
|
SPI_1LINE_TX(&SPIx);
|
||||||
#endif
|
#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);
|
__HAL_SPI_ENABLE(&SPIx);
|
||||||
|
|
||||||
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
|
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()));
|
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) {
|
||||||
DMAtx.Init.MemInc = MemoryIncrease;
|
DMAtx.Init.MemInc = memoryIncrease;
|
||||||
HAL_DMA_Init(&DMAtx);
|
HAL_DMA_Init(&DMAtx);
|
||||||
|
|
||||||
if (TFT_MISO_PIN == TFT_MOSI_PIN)
|
if (TFT_MISO_PIN == TFT_MOSI_PIN)
|
||||||
SPI_1LINE_TX(&SPIx);
|
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);
|
__HAL_SPI_ENABLE(&SPIx);
|
||||||
|
|
||||||
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
|
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
|
||||||
|
|
||||||
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
HAL_DMA_PollForTransfer(&DMAtx, HAL_DMA_FULL_TRANSFER, HAL_MAX_DELAY);
|
||||||
while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {}
|
while ( __HAL_SPI_GET_FLAG(&SPIx, SPI_FLAG_BSY)) {}
|
||||||
Abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ENABLED(USE_SPI_DMA_TC)
|
#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);
|
HAL_DMA_Init(&DMAtx);
|
||||||
|
|
||||||
if (TFT_MISO_PIN == TFT_MOSI_PIN)
|
if (TFT_MISO_PIN == TFT_MOSI_PIN)
|
||||||
SPI_1LINE_TX(&SPIx);
|
SPI_1LINE_TX(&SPIx);
|
||||||
|
|
||||||
DataTransferBegin();
|
dataTransferBegin();
|
||||||
|
|
||||||
HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 5, 0);
|
HAL_NVIC_SetPriority(DMA2_Stream3_IRQn, 5, 0);
|
||||||
HAL_NVIC_EnableIRQ(DMA2_Stream3_IRQn);
|
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);
|
__HAL_SPI_ENABLE(&SPIx);
|
||||||
|
|
||||||
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
|
SET_BIT(SPIx.Instance->CR2, SPI_CR2_TXDMAEN); // Enable Tx DMA Request
|
||||||
|
@@ -46,40 +46,40 @@ private:
|
|||||||
static SPI_HandleTypeDef SPIx;
|
static SPI_HandleTypeDef SPIx;
|
||||||
static DMA_HandleTypeDef DMAtx;
|
static DMA_HandleTypeDef DMAtx;
|
||||||
|
|
||||||
static uint32_t ReadID(uint16_t Reg);
|
static uint32_t readID(uint16_t reg);
|
||||||
static void Transmit(uint16_t Data);
|
static void transmit(uint16_t data);
|
||||||
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
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 void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
#if ENABLED(USE_SPI_DMA_TC)
|
#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
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void init();
|
||||||
static uint32_t GetID();
|
static uint32_t getID();
|
||||||
static bool isBusy();
|
static bool isBusy();
|
||||||
static void Abort();
|
static void abort();
|
||||||
|
|
||||||
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT);
|
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT);
|
||||||
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); };
|
static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); __HAL_SPI_DISABLE(&SPIx); };
|
||||||
static void DataTransferAbort();
|
static void dataTransferAbort();
|
||||||
|
|
||||||
static void WriteData(uint16_t Data) { Transmit(Data); }
|
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 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 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 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)
|
#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); }
|
inline static void DMA_IRQHandler() { HAL_DMA_IRQHandler(&TFT_SPI::DMAtx); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void WriteSequence(uint16_t *Data, uint16_t Count) { Transmit(DMA_MINC_ENABLE, 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) {
|
static void writeMultiple(uint16_t color, uint32_t count) {
|
||||||
while (Count > 0) {
|
while (count > 0) {
|
||||||
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
|
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
|
||||||
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
|
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -35,7 +35,7 @@ uint16_t delta(uint16_t a, uint16_t b) { return a > b ? a - b : b - a; }
|
|||||||
|
|
||||||
SPI_HandleTypeDef XPT2046::SPIx;
|
SPI_HandleTypeDef XPT2046::SPIx;
|
||||||
|
|
||||||
void XPT2046::Init() {
|
void XPT2046::init() {
|
||||||
SPI_TypeDef *spiInstance;
|
SPI_TypeDef *spiInstance;
|
||||||
|
|
||||||
OUT_WRITE(TOUCH_CS_PIN, HIGH);
|
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 XPT2046::getRawData(const XPTCoordinate coordinate) {
|
||||||
uint16_t data[3];
|
uint16_t data[3];
|
||||||
|
|
||||||
DataTransferBegin();
|
dataTransferBegin();
|
||||||
|
|
||||||
for (uint16_t i = 0; i < 3 ; i++) {
|
for (uint16_t i = 0; i < 3 ; i++) {
|
||||||
IO(coordinate);
|
IO(coordinate);
|
||||||
data[i] = (IO() << 4) | (IO() >> 4);
|
data[i] = (IO() << 4) | (IO() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTransferEnd();
|
dataTransferEnd();
|
||||||
|
|
||||||
uint16_t delta01 = delta(data[0], data[1]);
|
uint16_t delta01 = delta(data[0], data[1]);
|
||||||
uint16_t delta02 = delta(data[0], data[2]);
|
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;
|
return (data[0] + data[1]) >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t XPT2046::HardwareIO(uint16_t data) {
|
uint16_t XPT2046::hardwareIO(uint16_t data) {
|
||||||
__HAL_SPI_ENABLE(&SPIx);
|
__HAL_SPI_ENABLE(&SPIx);
|
||||||
while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
|
while ((SPIx.Instance->SR & SPI_FLAG_TXE) != SPI_FLAG_TXE) {}
|
||||||
SPIx.Instance->DR = data;
|
SPIx.Instance->DR = data;
|
||||||
@@ -150,7 +150,7 @@ uint16_t XPT2046::HardwareIO(uint16_t data) {
|
|||||||
return SPIx.Instance->DR;
|
return SPIx.Instance->DR;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t XPT2046::SoftwareIO(uint16_t data) {
|
uint16_t XPT2046::softwareIO(uint16_t data) {
|
||||||
uint16_t result = 0;
|
uint16_t result = 0;
|
||||||
|
|
||||||
for (uint8_t j = 0x80; j > 0; j >>= 1) {
|
for (uint8_t j = 0x80; j > 0; j >>= 1) {
|
||||||
|
@@ -69,13 +69,13 @@ private:
|
|||||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||||
static bool isTouched();
|
static bool isTouched();
|
||||||
|
|
||||||
static void DataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
|
static void dataTransferBegin() { if (SPIx.Instance) { HAL_SPI_Init(&SPIx); } WRITE(TOUCH_CS_PIN, LOW); };
|
||||||
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||||
static uint16_t HardwareIO(uint16_t data);
|
static uint16_t hardwareIO(uint16_t data);
|
||||||
static uint16_t SoftwareIO(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 uint16_t IO(uint16_t data = 0) { return SPIx.Instance ? hardwareIO(data) : softwareIO(data); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void init();
|
||||||
static bool getRawPoint(int16_t *x, int16_t *y);
|
static bool getRawPoint(int16_t *x, int16_t *y);
|
||||||
};
|
};
|
||||||
|
@@ -87,7 +87,7 @@ __attribute__((always_inline)) __STATIC_INLINE void __DSB() {
|
|||||||
#define FSMC_DATA_SETUP_TIME 15 // DataSetupTime
|
#define FSMC_DATA_SETUP_TIME 15 // DataSetupTime
|
||||||
|
|
||||||
static uint8_t fsmcInit = 0;
|
static uint8_t fsmcInit = 0;
|
||||||
void TFT_FSMC::Init() {
|
void TFT_FSMC::init() {
|
||||||
uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN;
|
uint8_t cs = FSMC_CS_PIN, rs = FSMC_RS_PIN;
|
||||||
uint32_t controllerAddress;
|
uint32_t controllerAddress;
|
||||||
|
|
||||||
@@ -181,35 +181,35 @@ void TFT_FSMC::Init() {
|
|||||||
LCD = (LCD_CONTROLLER_TypeDef*)controllerAddress;
|
LCD = (LCD_CONTROLLER_TypeDef*)controllerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_FSMC::Transmit(uint16_t Data) {
|
void TFT_FSMC::transmit(uint16_t data) {
|
||||||
LCD->RAM = Data;
|
LCD->RAM = data;
|
||||||
__DSB();
|
__DSB();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_FSMC::WriteReg(uint16_t Reg) {
|
void TFT_FSMC::writeReg(uint16_t reg) {
|
||||||
LCD->REG = Reg;
|
LCD->REG = reg;
|
||||||
__DSB();
|
__DSB();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_FSMC::GetID() {
|
uint32_t TFT_FSMC::getID() {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
WriteReg(0x0000);
|
writeReg(0x0000);
|
||||||
id = LCD->RAM;
|
id = LCD->RAM;
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
id = ReadID(LCD_READ_ID);
|
id = readID(LCD_READ_ID);
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||||
id = ReadID(LCD_READ_ID4);
|
id = readID(LCD_READ_ID4);
|
||||||
if ((id & 0xFF00) == 0 && (id & 0xFF) != 0)
|
if ((id & 0xFF00) == 0 && (id & 0xFF) != 0)
|
||||||
id = ReadID(LCD_READ_ID4);
|
id = readID(LCD_READ_ID4);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_FSMC::ReadID(uint16_t Reg) {
|
uint32_t TFT_FSMC::readID(uint16_t reg) {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
WriteReg(Reg);
|
writeReg(reg);
|
||||||
id = LCD->RAM; // dummy read
|
id = LCD->RAM; // dummy read
|
||||||
id = Reg << 24;
|
id = reg << 24;
|
||||||
id |= (LCD->RAM & 0x00FF) << 16;
|
id |= (LCD->RAM & 0x00FF) << 16;
|
||||||
id |= (LCD->RAM & 0x00FF) << 8;
|
id |= (LCD->RAM & 0x00FF) << 8;
|
||||||
id |= LCD->RAM & 0x00FF;
|
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;
|
if ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & (DMA_ISR_TCIF | DMA_ISR_TEIF)) == 0) return true;
|
||||||
|
|
||||||
__DSB();
|
__DSB();
|
||||||
Abort();
|
abort();
|
||||||
return false;
|
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_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
|
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;
|
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
|
// 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_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_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count);
|
||||||
dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
||||||
dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
dma_enable(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
||||||
|
|
||||||
TERN_(TFT_SHARED_IO, while (isBusy()));
|
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)
|
#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_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_set_num_transfers(FSMC_DMA_DEV, FSMC_DMA_CHANNEL, count);
|
||||||
dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
dma_clear_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL);
|
||||||
dma_enable(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) {}
|
while ((dma_get_isr_bits(FSMC_DMA_DEV, FSMC_DMA_CHANNEL) & (DMA_CCR_TEIE | DMA_CCR_TCIE)) == 0) {}
|
||||||
Abort();
|
abort();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -54,31 +54,31 @@ class TFT_FSMC {
|
|||||||
private:
|
private:
|
||||||
static LCD_CONTROLLER_TypeDef *LCD;
|
static LCD_CONTROLLER_TypeDef *LCD;
|
||||||
|
|
||||||
static uint32_t ReadID(uint16_t Reg);
|
static uint32_t readID(uint16_t reg);
|
||||||
static void Transmit(uint16_t Data);
|
static void transmit(uint16_t data);
|
||||||
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
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 void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init();
|
static void init();
|
||||||
static uint32_t GetID();
|
static uint32_t getID();
|
||||||
static bool isBusy();
|
static bool isBusy();
|
||||||
static void Abort();
|
static void abort();
|
||||||
|
|
||||||
static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) {};
|
static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT) {};
|
||||||
static void DataTransferEnd() {};
|
static void dataTransferEnd() {};
|
||||||
|
|
||||||
static void WriteData(uint16_t Data) { Transmit(Data); }
|
static void writeData(uint16_t data) { transmit(data); }
|
||||||
static void WriteReg(uint16_t Reg);
|
static void writeReg(uint16_t reg);
|
||||||
|
|
||||||
static void WriteSequence_DMA(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, 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 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 writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_PINC_ENABLE, data, count); }
|
||||||
static void WriteMultiple(uint16_t Color, uint32_t Count) {
|
static void writeMultiple(uint16_t color, uint32_t count) {
|
||||||
while (Count > 0) {
|
while (count > 0) {
|
||||||
Transmit(DMA_PINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
|
transmit(DMA_PINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
|
||||||
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
|
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE);
|
SPIClass TFT_SPI::SPIx(TFT_SPI_DEVICE);
|
||||||
|
|
||||||
void TFT_SPI::Init() {
|
void TFT_SPI::init() {
|
||||||
#if PIN_EXISTS(TFT_RESET)
|
#if PIN_EXISTS(TFT_RESET)
|
||||||
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
OUT_WRITE(TFT_RESET_PIN, HIGH);
|
||||||
delay(100);
|
delay(100);
|
||||||
@@ -70,8 +70,8 @@ void TFT_SPI::Init() {
|
|||||||
SPIx.setDataMode(SPI_MODE0);
|
SPIx.setDataMode(SPI_MODE0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
|
||||||
SPIx.setDataSize(DataSize);
|
SPIx.setDataSize(dataSize);
|
||||||
SPIx.begin();
|
SPIx.begin();
|
||||||
WRITE(TFT_CS_PIN, LOW);
|
WRITE(TFT_CS_PIN, LOW);
|
||||||
}
|
}
|
||||||
@@ -80,11 +80,11 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
|
|||||||
#include "../../../lcd/tft_io/tft_ids.h"
|
#include "../../../lcd/tft_io/tft_ids.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t TFT_SPI::GetID() {
|
uint32_t TFT_SPI::getID() {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
id = ReadID(LCD_READ_ID);
|
id = readID(LCD_READ_ID);
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) {
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) {
|
||||||
id = ReadID(LCD_READ_ID4);
|
id = readID(LCD_READ_ID4);
|
||||||
#ifdef TFT_DEFAULT_DRIVER
|
#ifdef TFT_DEFAULT_DRIVER
|
||||||
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
|
||||||
id = TFT_DEFAULT_DRIVER;
|
id = TFT_DEFAULT_DRIVER;
|
||||||
@@ -93,13 +93,13 @@ uint32_t TFT_SPI::GetID() {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
uint32_t TFT_SPI::readID(uint16_t reg) {
|
||||||
uint32_t data = 0;
|
uint32_t data = 0;
|
||||||
|
|
||||||
#if PIN_EXISTS(TFT_MISO)
|
#if PIN_EXISTS(TFT_MISO)
|
||||||
SPIx.setClockDivider(SPI_CLOCK_DIV16);
|
SPIx.setClockDivider(SPI_CLOCK_DIV16);
|
||||||
DataTransferBegin(DATASIZE_8BIT);
|
dataTransferBegin(DATASIZE_8BIT);
|
||||||
WriteReg(Reg);
|
writeReg(reg);
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 4; ++i) {
|
for (uint8_t i = 0; i < 4; ++i) {
|
||||||
uint8_t d;
|
uint8_t d;
|
||||||
@@ -107,7 +107,7 @@ uint32_t TFT_SPI::ReadID(uint16_t Reg) {
|
|||||||
data = (data << 8) | d;
|
data = (data << 8) | d;
|
||||||
}
|
}
|
||||||
|
|
||||||
DataTransferEnd();
|
dataTransferEnd();
|
||||||
SPIx.setClockDivider(SPI_CLOCK_MAX);
|
SPIx.setClockDivider(SPI_CLOCK_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -130,11 +130,11 @@ bool TFT_SPI::isBusy() {
|
|||||||
if (!(SPIdev->regs->SR & SPI_SR_TXE) || (SPIdev->regs->SR & SPI_SR_BSY)) return true;
|
if (!(SPIdev->regs->SR & SPI_SR_TXE) || (SPIdev->regs->SR & SPI_SR_BSY)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Abort();
|
abort();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT_SPI::Abort() {
|
void TFT_SPI::abort() {
|
||||||
dma_channel_reg_map *channel_regs = dma_channel_regs(DMAx, DMA_CHx);
|
dma_channel_reg_map *channel_regs = dma_channel_regs(DMAx, DMA_CHx);
|
||||||
|
|
||||||
dma_disable(DMAx, DMA_CHx); // Abort DMA transfer if any
|
dma_disable(DMAx, DMA_CHx); // Abort DMA transfer if any
|
||||||
@@ -146,23 +146,23 @@ void TFT_SPI::Abort() {
|
|||||||
channel_regs->CMAR = 0U;
|
channel_regs->CMAR = 0U;
|
||||||
channel_regs->CPAR = 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) {
|
void TFT_SPI::transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count) {
|
||||||
DataTransferBegin();
|
dataTransferBegin();
|
||||||
SPIx.dmaSendAsync(Data, Count, MemoryIncrease == DMA_MINC_ENABLE);
|
SPIx.dmaSendAsync(data, count, memoryIncrease == DMA_MINC_ENABLE);
|
||||||
|
|
||||||
TERN_(TFT_SHARED_IO, while (isBusy()));
|
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);
|
WRITE(TFT_DC_PIN, HIGH);
|
||||||
DataTransferBegin();
|
dataTransferBegin();
|
||||||
SPIx.dmaSend(Data, Count, MemoryIncrease == DMA_MINC_ENABLE);
|
SPIx.dmaSend(data, count, memoryIncrease == DMA_MINC_ENABLE);
|
||||||
DataTransferEnd();
|
dataTransferEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // HAS_SPI_TFT
|
#endif // HAS_SPI_TFT
|
||||||
|
@@ -63,34 +63,34 @@
|
|||||||
|
|
||||||
class TFT_SPI {
|
class TFT_SPI {
|
||||||
private:
|
private:
|
||||||
static uint32_t ReadID(uint16_t Reg);
|
static uint32_t readID(uint16_t reg);
|
||||||
static void Transmit(uint16_t Data);
|
static void transmit(uint16_t data);
|
||||||
static void Transmit(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
|
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 void transmitDMA(uint32_t memoryIncrease, uint16_t *data, uint16_t count);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SPIClass SPIx;
|
static SPIClass SPIx;
|
||||||
|
|
||||||
static void Init();
|
static void init();
|
||||||
static uint32_t GetID();
|
static uint32_t getID();
|
||||||
static bool isBusy();
|
static bool isBusy();
|
||||||
static void Abort();
|
static void abort();
|
||||||
|
|
||||||
static void DataTransferBegin(uint16_t DataWidth=DATA_SIZE_16BIT);
|
static void dataTransferBegin(uint16_t dataWidth=DATA_SIZE_16BIT);
|
||||||
static void DataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); };
|
static void dataTransferEnd() { WRITE(TFT_CS_PIN, HIGH); SPIx.end(); };
|
||||||
static void DataTransferAbort();
|
static void dataTransferAbort();
|
||||||
|
|
||||||
static void WriteData(uint16_t Data) { Transmit(Data); }
|
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 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 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 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 writeSequence(uint16_t *data, uint16_t count) { transmit(DMA_MINC_ENABLE, data, count); }
|
||||||
static void WriteMultiple(uint16_t Color, uint32_t Count) {
|
static void writeMultiple(uint16_t color, uint32_t count) {
|
||||||
while (Count > 0) {
|
while (count > 0) {
|
||||||
Transmit(DMA_MINC_DISABLE, &Color, Count > DMA_MAX_SIZE ? DMA_MAX_SIZE : Count);
|
transmit(DMA_MINC_DISABLE, &color, count > DMA_MAX_SIZE ? DMA_MAX_SIZE : count);
|
||||||
Count = Count > DMA_MAX_SIZE ? Count - DMA_MAX_SIZE : 0;
|
count = count > DMA_MAX_SIZE ? count - DMA_MAX_SIZE : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -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
|
#endif // TOUCH_BUTTONS_HW_SPI
|
||||||
|
|
||||||
void XPT2046::Init() {
|
void XPT2046::init() {
|
||||||
SET_INPUT(TOUCH_MISO_PIN);
|
SET_INPUT(TOUCH_MISO_PIN);
|
||||||
SET_OUTPUT(TOUCH_MOSI_PIN);
|
SET_OUTPUT(TOUCH_MOSI_PIN);
|
||||||
SET_OUTPUT(TOUCH_SCK_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 XPT2046::getRawData(const XPTCoordinate coordinate) {
|
||||||
uint16_t data[3];
|
uint16_t data[3];
|
||||||
|
|
||||||
DataTransferBegin();
|
dataTransferBegin();
|
||||||
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin());
|
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.begin());
|
||||||
|
|
||||||
for (uint16_t i = 0; i < 3 ; i++) {
|
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());
|
TERN_(TOUCH_BUTTONS_HW_SPI, SPIx.end());
|
||||||
DataTransferEnd();
|
dataTransferEnd();
|
||||||
|
|
||||||
uint16_t delta01 = delta(data[0], data[1]),
|
uint16_t delta01 = delta(data[0], data[1]),
|
||||||
delta02 = delta(data[0], data[2]),
|
delta02 = delta(data[0], data[2]),
|
||||||
@@ -119,17 +119,17 @@ uint16_t XPT2046::getRawData(const XPTCoordinate coordinate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t XPT2046::IO(uint16_t data) {
|
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)
|
#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);
|
uint16_t result = SPIx.transfer(data);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint16_t XPT2046::SoftwareIO(uint16_t data) {
|
uint16_t XPT2046::softwareIO(uint16_t data) {
|
||||||
uint16_t result = 0;
|
uint16_t result = 0;
|
||||||
|
|
||||||
for (uint8_t j = 0x80; j; j >>= 1) {
|
for (uint8_t j = 0x80; j; j >>= 1) {
|
||||||
|
@@ -65,12 +65,12 @@ private:
|
|||||||
static uint16_t getRawData(const XPTCoordinate coordinate);
|
static uint16_t getRawData(const XPTCoordinate coordinate);
|
||||||
static bool isTouched();
|
static bool isTouched();
|
||||||
|
|
||||||
static void DataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
static void dataTransferBegin() { WRITE(TOUCH_CS_PIN, LOW); };
|
||||||
static void DataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
static void dataTransferEnd() { WRITE(TOUCH_CS_PIN, HIGH); };
|
||||||
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
#if ENABLED(TOUCH_BUTTONS_HW_SPI)
|
||||||
static uint16_t HardwareIO(uint16_t data);
|
static uint16_t hardwareIO(uint16_t data);
|
||||||
#endif
|
#endif
|
||||||
static uint16_t SoftwareIO(uint16_t data);
|
static uint16_t softwareIO(uint16_t data);
|
||||||
static uint16_t IO(uint16_t data = 0);
|
static uint16_t IO(uint16_t data = 0);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -78,6 +78,6 @@ public:
|
|||||||
static SPIClass SPIx;
|
static SPIClass SPIx;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void Init();
|
static void init();
|
||||||
static bool getRawPoint(int16_t *x, int16_t *y);
|
static bool getRawPoint(int16_t *x, int16_t *y);
|
||||||
};
|
};
|
||||||
|
@@ -135,7 +135,7 @@
|
|||||||
// Generic ARM code, that's testing if an access to the given address would cause a fault or not
|
// 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
|
// 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_CFG_CTRL 0xE000ED14 // Configuration Control Register
|
||||||
#define NVIC_FAULT_STAT_BFARV 0x00008000 // BFAR is valid
|
#define NVIC_FAULT_STAT_BFARV 0x00008000 // BFAR is valid
|
||||||
#define NVIC_CFG_CTRL_BFHFNMIGN 0x00000100 // Ignore bus fault in NMI/fault
|
#define NVIC_CFG_CTRL_BFHFNMIGN 0x00000100 // Ignore bus fault in NMI/fault
|
||||||
|
@@ -819,7 +819,7 @@ void idle(const bool no_stepper_sleep/*=false*/) {
|
|||||||
TERN_(HAS_BEEPER, buzzer.tick());
|
TERN_(HAS_BEEPER, buzzer.tick());
|
||||||
|
|
||||||
// Handle UI input / draw events
|
// Handle UI input / draw events
|
||||||
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
|
TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update());
|
||||||
|
|
||||||
// Run i2c Position Encoders
|
// Run i2c Position Encoders
|
||||||
#if ENABLED(I2C_POSITION_ENCODERS)
|
#if ENABLED(I2C_POSITION_ENCODERS)
|
||||||
|
@@ -375,7 +375,7 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_LCDPRINT && HAS_EXTRA_PROGRESS && LCD_HEIGHT < 4
|
#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
|
#endif
|
||||||
|
|
||||||
#if !HAS_MARLINUI_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
#if !HAS_MARLINUI_MENU && ENABLED(SD_REPRINT_LAST_SELECTED_FILE)
|
||||||
|
@@ -787,9 +787,10 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
#define TPOFFSET (LCD_WIDTH - 1)
|
#define TPOFFSET (LCD_WIDTH - 1)
|
||||||
static uint8_t timepos = TPOFFSET - 6;
|
static uint8_t timepos = TPOFFSET - 6;
|
||||||
static char buffer[8];
|
static char buffer[8];
|
||||||
static lcd_uint_t pc, pr;
|
|
||||||
|
|
||||||
#if ENABLED(SHOW_PROGRESS_PERCENT)
|
#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() {
|
void MarlinUI::drawPercent() {
|
||||||
const uint8_t progress = ui.get_progress_percent();
|
const uint8_t progress = ui.get_progress_percent();
|
||||||
if (progress) {
|
if (progress) {
|
||||||
@@ -800,6 +801,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SHOW_REMAINING_TIME)
|
#if ENABLED(SHOW_REMAINING_TIME)
|
||||||
void MarlinUI::drawRemain() {
|
void MarlinUI::drawRemain() {
|
||||||
if (printJobOngoing()) {
|
if (printJobOngoing()) {
|
||||||
@@ -811,6 +813,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SHOW_INTERACTION_TIME)
|
#if ENABLED(SHOW_INTERACTION_TIME)
|
||||||
void MarlinUI::drawInter() {
|
void MarlinUI::drawInter() {
|
||||||
const duration_t interactt = ui.interaction_time;
|
const duration_t interactt = ui.interaction_time;
|
||||||
@@ -822,6 +825,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(SHOW_ELAPSED_TIME)
|
#if ENABLED(SHOW_ELAPSED_TIME)
|
||||||
void MarlinUI::drawElapsed() {
|
void MarlinUI::drawElapsed() {
|
||||||
if (printJobOngoing()) {
|
if (printJobOngoing()) {
|
||||||
@@ -947,7 +951,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
#if LCD_WIDTH < 20
|
#if LCD_WIDTH < 20
|
||||||
|
|
||||||
#if HAS_PRINT_PROGRESS
|
#if HAS_PRINT_PROGRESS
|
||||||
pc = 0; pr = 2;
|
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(0, 2));
|
||||||
rotate_progress();
|
rotate_progress();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1039,7 +1043,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
#if LCD_WIDTH >= 20
|
#if LCD_WIDTH >= 20
|
||||||
|
|
||||||
#if HAS_PRINT_PROGRESS
|
#if HAS_PRINT_PROGRESS
|
||||||
pc = 6; pr = 2;
|
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(6, 2));
|
||||||
rotate_progress();
|
rotate_progress();
|
||||||
#else
|
#else
|
||||||
char c;
|
char c;
|
||||||
@@ -1122,7 +1126,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
_draw_bed_status(blink);
|
_draw_bed_status(blink);
|
||||||
#elif HAS_PRINT_PROGRESS
|
#elif HAS_PRINT_PROGRESS
|
||||||
#define DREW_PRINT_PROGRESS 1
|
#define DREW_PRINT_PROGRESS 1
|
||||||
pc = 0; pr = 2;
|
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(0, 2));
|
||||||
rotate_progress();
|
rotate_progress();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1130,7 +1134,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
// All progress strings
|
// All progress strings
|
||||||
//
|
//
|
||||||
#if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
|
#if HAS_PRINT_PROGRESS && !DREW_PRINT_PROGRESS
|
||||||
pc = LCD_WIDTH - 9; pr = 2;
|
TERN_(SHOW_PROGRESS_PERCENT, setPercentPos(LCD_WIDTH - 9, 2));
|
||||||
rotate_progress();
|
rotate_progress();
|
||||||
#endif
|
#endif
|
||||||
#endif // LCD_INFO_SCREEN_STYLE 1
|
#endif // LCD_INFO_SCREEN_STYLE 1
|
||||||
|
@@ -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++)
|
for (uint16_t l = 0; l < UPSCALE0(length); l++)
|
||||||
buffer[l + n * UPSCALE0(length)] = buffer[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
|
#else
|
||||||
for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;)
|
for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;)
|
||||||
u8g_WriteSequence(u8g, dev, k << 1, (uint8_t*)buffer);
|
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);
|
setWindow(u8g, dev, 0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1);
|
||||||
#if HAS_LCD_IO
|
#if HAS_LCD_IO
|
||||||
UNUSED(buffer);
|
UNUSED(buffer);
|
||||||
tftio.WriteMultiple(TFT_MARLINBG_COLOR, (TFT_WIDTH) * (TFT_HEIGHT));
|
tftio.writeMultiple(TFT_MARLINBG_COLOR, (TFT_WIDTH) * (TFT_HEIGHT));
|
||||||
#else
|
#else
|
||||||
memset2(buffer, TFT_MARLINBG_COLOR, (TFT_WIDTH) / 2);
|
memset2(buffer, TFT_MARLINBG_COLOR, (TFT_WIDTH) / 2);
|
||||||
for (uint16_t i = 0; i < (TFT_HEIGHT) * sq(GRAPHICAL_TFT_UPSCALE); i++)
|
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;
|
if (msgInitCount) return -1;
|
||||||
tftio.Init();
|
tftio.init();
|
||||||
tftio.InitTFT();
|
tftio.initTFT();
|
||||||
TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset());
|
TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset());
|
||||||
u8g_upscale_clear_lcd(u8g, dev, buffer);
|
u8g_upscale_clear_lcd(u8g, dev, buffer);
|
||||||
return 0;
|
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++)
|
for (uint16_t l = 0; l < UPSCALE0(WIDTH); l++)
|
||||||
buffer[l + n * UPSCALE0(WIDTH)] = buffer[l];
|
buffer[l + n * UPSCALE0(WIDTH)] = buffer[l];
|
||||||
|
|
||||||
tftio.WriteSequence(buffer, COUNT(bufferA));
|
tftio.writeSequence(buffer, COUNT(bufferA));
|
||||||
#else
|
#else
|
||||||
uint8_t *bufptr = (uint8_t*) buffer;
|
uint8_t *bufptr = (uint8_t*) buffer;
|
||||||
for (uint8_t i = GRAPHICAL_TFT_UPSCALE; i--;) {
|
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;
|
break;
|
||||||
|
|
||||||
case U8G_COM_MSG_WRITE_BYTE:
|
case U8G_COM_MSG_WRITE_BYTE:
|
||||||
tftio.DataTransferBegin(DATASIZE_8BIT);
|
tftio.dataTransferBegin(DATASIZE_8BIT);
|
||||||
if (isCommand)
|
if (isCommand)
|
||||||
tftio.WriteReg(arg_val);
|
tftio.writeReg(arg_val);
|
||||||
else
|
else
|
||||||
tftio.WriteData((uint16_t)arg_val);
|
tftio.writeData((uint16_t)arg_val);
|
||||||
tftio.DataTransferEnd();
|
tftio.dataTransferEnd();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case U8G_COM_MSG_WRITE_SEQ:
|
case U8G_COM_MSG_WRITE_SEQ:
|
||||||
tftio.DataTransferBegin(DATASIZE_16BIT);
|
tftio.dataTransferBegin(DATASIZE_16BIT);
|
||||||
for (uint8_t i = 0; i < arg_val; i += 2)
|
for (uint8_t i = 0; i < arg_val; i += 2)
|
||||||
tftio.WriteData(*(uint16_t *)(((uintptr_t)arg_ptr) + i));
|
tftio.writeData(*(uint16_t *)(((uintptr_t)arg_ptr) + i));
|
||||||
tftio.DataTransferEnd();
|
tftio.dataTransferEnd();
|
||||||
break;
|
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) {
|
static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
|
||||||
tftio.set_window(x - 15, y, x + 15, y);
|
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.set_window(x, y - 15, x, y + 15);
|
||||||
tftio.WriteMultiple(color, 31);
|
tftio.writeMultiple(color, 31);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinUI::touch_calibration_screen() {
|
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);
|
defer_status_screen(true);
|
||||||
stage = touch_calibration.calibration_start();
|
stage = touch_calibration.calibration_start();
|
||||||
tftio.set_window(0, 0, (TFT_WIDTH) - 1, (TFT_HEIGHT) - 1);
|
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 {
|
else {
|
||||||
// clear last cross
|
// clear last cross
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -133,7 +133,7 @@ typedef struct {
|
|||||||
float Home_OffZ_scaled = 0;
|
float Home_OffZ_scaled = 0;
|
||||||
float Probe_OffX_scaled = 0;
|
float Probe_OffX_scaled = 0;
|
||||||
float Probe_OffY_scaled = 0;
|
float Probe_OffY_scaled = 0;
|
||||||
} HMI_value_t;
|
} hmi_value_t;
|
||||||
|
|
||||||
#define DWIN_CHINESE 123
|
#define DWIN_CHINESE 123
|
||||||
#define DWIN_ENGLISH 0
|
#define DWIN_ENGLISH 0
|
||||||
@@ -151,59 +151,59 @@ typedef struct {
|
|||||||
bool cold_flag:1;
|
bool cold_flag:1;
|
||||||
#endif
|
#endif
|
||||||
AxisEnum feedspeed_axis, acc_axis, jerk_axis, step_axis;
|
AxisEnum feedspeed_axis, acc_axis, jerk_axis, step_axis;
|
||||||
} HMI_flag_t;
|
} hmi_flag_t;
|
||||||
|
|
||||||
extern HMI_value_t HMI_ValueStruct;
|
extern hmi_value_t hmiValues;
|
||||||
extern HMI_flag_t HMI_flag;
|
extern hmi_flag_t hmiFlag;
|
||||||
|
|
||||||
#if HAS_HOTEND || HAS_HEATED_BED
|
#if HAS_HOTEND || HAS_HEATED_BED
|
||||||
// Popup message window
|
// Popup message window
|
||||||
void DWIN_Popup_Temperature(const bool toohigh);
|
void dwinPopupTemperature(const bool toohigh);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
void Popup_Window_ETempTooLow();
|
void popupWindowETempTooLow();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Popup_Window_Resume();
|
void popupWindowResume();
|
||||||
void Popup_Window_Home(const bool parking=false);
|
void popupWindowHome(const bool parking=false);
|
||||||
void Popup_Window_Leveling();
|
void popupWindowLeveling();
|
||||||
|
|
||||||
void Goto_PrintProcess();
|
void gotoPrintProcess();
|
||||||
void Goto_MainMenu();
|
void gotoMainMenu();
|
||||||
|
|
||||||
// Variable control
|
// Variable control
|
||||||
void HMI_Move_X();
|
void hmiMoveX();
|
||||||
void HMI_Move_Y();
|
void hmiMoveY();
|
||||||
void HMI_Move_Z();
|
void hmiMoveZ();
|
||||||
void HMI_Move_E();
|
void hmiMoveE();
|
||||||
|
|
||||||
void HMI_Zoffset();
|
void hmiZoffset();
|
||||||
|
|
||||||
#if HAS_HOTEND
|
#if HAS_HOTEND
|
||||||
void HMI_ETemp();
|
void hmiETemp();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
void HMI_BedTemp();
|
void hmiBedTemp();
|
||||||
#endif
|
#endif
|
||||||
#if HAS_FAN
|
#if HAS_FAN
|
||||||
void HMI_FanSpeed();
|
void hmiFanSpeed();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void HMI_PrintSpeed();
|
void hmiPrintSpeed();
|
||||||
|
|
||||||
void HMI_MaxFeedspeedXYZE();
|
void hmiMaxFeedspeedXYZE();
|
||||||
void HMI_MaxAccelerationXYZE();
|
void hmiMaxAccelerationXYZE();
|
||||||
void HMI_MaxJerkXYZE();
|
void hmiMaxJerkXYZE();
|
||||||
void HMI_StepXYZE();
|
void hmiStepXYZE();
|
||||||
void HMI_SetLanguageCache();
|
void hmiSetLanguageCache();
|
||||||
|
|
||||||
void update_variable();
|
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
|
// SD Card
|
||||||
void HMI_SDCardInit();
|
void hmiSDCardInit();
|
||||||
void HMI_SDCardUpdate();
|
void hmiSDCardUpdate();
|
||||||
|
|
||||||
// Main Process
|
// Main Process
|
||||||
void Icon_print(bool value);
|
void Icon_print(bool value);
|
||||||
@@ -212,39 +212,39 @@ void Icon_temperature(bool value);
|
|||||||
void Icon_leveling(bool value);
|
void Icon_leveling(bool value);
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
void Draw_Status_Area(const bool with_update); // Status Area
|
void drawStatusArea(const bool with_update); // Status Area
|
||||||
void HMI_StartFrame(const bool with_update); // Prepare the menu view
|
void hmiStartFrame(const bool with_update); // Prepare the menu view
|
||||||
void HMI_MainMenu(); // Main process screen
|
void hmiMainMenu(); // Main process screen
|
||||||
void HMI_SelectFile(); // File page
|
void hmiSelectFile(); // File page
|
||||||
void HMI_Printing(); // Print page
|
void hmiPrinting(); // Print page
|
||||||
void HMI_Prepare(); // Prepare page
|
void hmiPrepare(); // Prepare page
|
||||||
void HMI_Control(); // Control page
|
void hmiControl(); // Control page
|
||||||
void HMI_Leveling(); // Level the page
|
void hmiLeveling(); // Level the page
|
||||||
void HMI_AxisMove(); // Axis movement menu
|
void hmiAxisMove(); // Axis movement menu
|
||||||
void HMI_Temperature(); // Temperature menu
|
void hmiTemperature(); // Temperature menu
|
||||||
void HMI_Motion(); // Sports menu
|
void hmiMotion(); // Sports menu
|
||||||
void HMI_Info(); // Information menu
|
void hmiInfo(); // Information menu
|
||||||
void HMI_Tune(); // Adjust the menu
|
void hmiTune(); // Adjust the menu
|
||||||
|
|
||||||
#if HAS_PREHEAT
|
#if HAS_PREHEAT
|
||||||
void HMI_PLAPreheatSetting(); // PLA warm-up setting
|
void hmiPLAPreheatSetting(); // PLA warm-up setting
|
||||||
void HMI_ABSPreheatSetting(); // ABS warm-up setting
|
void hmiABSPreheatSetting(); // ABS warm-up setting
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void HMI_MaxSpeed(); // Maximum speed submenu
|
void hmiMaxSpeed(); // Maximum speed submenu
|
||||||
void HMI_MaxAcceleration(); // Maximum acceleration submenu
|
void hmiMaxAcceleration(); // Maximum acceleration submenu
|
||||||
void HMI_MaxJerk(); // Maximum jerk speed submenu
|
void hmiMaxJerk(); // Maximum jerk speed submenu
|
||||||
void HMI_Step(); // Transmission ratio
|
void hmiStep(); // Transmission ratio
|
||||||
|
|
||||||
void HMI_Init();
|
void hmiInit();
|
||||||
void DWIN_InitScreen();
|
void dwinInitScreen();
|
||||||
void DWIN_Update();
|
void dwinUpdate();
|
||||||
void EachMomentUpdate();
|
void eachMomentUpdate();
|
||||||
void DWIN_HandleScreen();
|
void dwinHandleScreen();
|
||||||
void DWIN_StatusChanged(const char * const cstr=nullptr);
|
void dwinStatusChanged(const char * const cstr=nullptr);
|
||||||
void DWIN_StatusChanged(FSTR_P const fstr);
|
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 dwinHomingDone();
|
||||||
void DWIN_LevelingDone();
|
void dwinLevelingDone();
|
||||||
|
@@ -41,16 +41,16 @@
|
|||||||
|
|
||||||
/*-------------------------------------- System variable function --------------------------------------*/
|
/*-------------------------------------- System variable function --------------------------------------*/
|
||||||
|
|
||||||
void DWIN_Startup() {
|
void dwinStartup() {
|
||||||
DEBUG_ECHOPGM("\r\nDWIN handshake ");
|
DEBUG_ECHOPGM("\r\nDWIN handshake ");
|
||||||
delay(750); // Delay here or init later in the boot process
|
delay(750); // Delay here or init later in the boot process
|
||||||
if (DWIN_Handshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
if (dwinHandshake()) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
||||||
DWIN_Frame_SetDir(1);
|
dwinFrameSetDir(1);
|
||||||
#if DISABLED(SHOW_BOOTSCREEN)
|
#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
|
#endif
|
||||||
DWIN_JPG_ShowAndCache(3);
|
dwinJPGShowAndCache(3);
|
||||||
DWIN_UpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
||||||
@@ -59,8 +59,8 @@ void DWIN_Startup() {
|
|||||||
// libID: Icon library ID
|
// libID: Icon library ID
|
||||||
// picID: Icon ID
|
// picID: Icon ID
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
||||||
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
|
dwinIconShow(true, false, false, libID, picID, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy area from virtual display area to current screen
|
// 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
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// 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;
|
size_t i = 0;
|
||||||
DWIN_Byte(i, 0x27);
|
dwinByte(i, 0x27);
|
||||||
DWIN_Byte(i, 0x80 | cacheID);
|
dwinByte(i, 0x80 | cacheID);
|
||||||
DWIN_Word(i, xStart);
|
dwinWord(i, xStart);
|
||||||
DWIN_Word(i, yStart);
|
dwinWord(i, yStart);
|
||||||
DWIN_Word(i, xEnd);
|
dwinWord(i, xEnd);
|
||||||
DWIN_Word(i, yEnd);
|
dwinWord(i, yEnd);
|
||||||
DWIN_Word(i, x);
|
dwinWord(i, x);
|
||||||
DWIN_Word(i, y);
|
dwinWord(i, y);
|
||||||
DWIN_Send(i);
|
dwinSend(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DWIN_CREALITY_LCD
|
#endif // DWIN_CREALITY_LCD
|
||||||
|
@@ -44,4 +44,4 @@
|
|||||||
// xStart/yStart: Upper-left of virtual area
|
// xStart/yStart: Upper-left of virtual area
|
||||||
// xEnd/yEnd: Lower-right of virtual area
|
// xEnd/yEnd: Lower-right of virtual area
|
||||||
// x/y: Screen paste point
|
// 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
@@ -148,7 +148,7 @@ enum colorID : uint8_t {
|
|||||||
#define Confirm_Color 0x34B9
|
#define Confirm_Color 0x34B9
|
||||||
#define Cancel_Color 0x3186
|
#define Cancel_Color 0x3186
|
||||||
|
|
||||||
class CrealityDWINClass {
|
class CrealityDWIN {
|
||||||
public:
|
public:
|
||||||
static constexpr size_t eeprom_data_size = 48;
|
static constexpr size_t eeprom_data_size = 48;
|
||||||
static struct EEPROM_Settings { // use bit fields to save space, max 48 bytes
|
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 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 constexpr const char * const preheat_modes[3] = { "Both", "Hotend", "Bed" };
|
||||||
|
|
||||||
static void Clear_Screen(const uint8_t e=3);
|
static void clearScreen(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 drawFloat(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 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 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 drawCheckbox(const uint8_t row, const bool value);
|
||||||
static void Draw_Title(const char * const title);
|
static void drawTitle(const char * const title);
|
||||||
static void Draw_Title(FSTR_P const title);
|
static void drawTitle(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 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 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 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 Draw_Menu(const uint8_t menu, const uint8_t select=0, const uint8_t scroll=0);
|
static void drawMenu(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 redrawMenu(const bool lastproc=true, const bool lastsel=false, const bool lastmenu=false);
|
||||||
static void Redraw_Screen();
|
static void redrawScreen();
|
||||||
|
|
||||||
static void Main_Menu_Icons();
|
static void mainMenuIcons();
|
||||||
static void Draw_Main_Menu(uint8_t select=0);
|
static void drawMainMenu(uint8_t select=0);
|
||||||
static void Print_Screen_Icons();
|
static void printScreenIcons();
|
||||||
static void Draw_Print_Screen();
|
static void drawPrintScreen();
|
||||||
static void Draw_Print_Filename(const bool reset=false);
|
static void drawPrintFilename(const bool reset=false);
|
||||||
static void Draw_Print_ProgressBar();
|
static void drawPrintProgressBar();
|
||||||
#if ENABLED(SET_REMAINING_TIME)
|
#if ENABLED(SET_REMAINING_TIME)
|
||||||
static void Draw_Print_ProgressRemain();
|
static void drawPrintProgressRemain();
|
||||||
#endif
|
#endif
|
||||||
static void Draw_Print_ProgressElapsed();
|
static void drawPrintProgressElapsed();
|
||||||
static void Draw_Print_confirm();
|
static void drawPrintConfirm();
|
||||||
static void Draw_SD_Item(const uint8_t item, const uint8_t row);
|
static void drawSDItem(const uint8_t item, const uint8_t row);
|
||||||
static void Draw_SD_List(const bool removed=false);
|
static void drawSDList(const bool removed=false);
|
||||||
static void Draw_Status_Area(const bool icons=false);
|
static void drawStatusArea(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 drawPopup(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 popupSelect();
|
||||||
static void Update_Status_Bar(const bool refresh=false);
|
static void updateStatusBar(const bool refresh=false);
|
||||||
|
|
||||||
#if HAS_MESH
|
#if HAS_MESH
|
||||||
static void Set_Mesh_Viewer_Status();
|
static void setMeshViewerStatus();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static FSTR_P Get_Menu_Title(const uint8_t menu);
|
static FSTR_P getMenuTitle(const uint8_t menu);
|
||||||
static uint8_t Get_Menu_Size(const uint8_t menu);
|
static uint8_t getMenuSize(const uint8_t menu);
|
||||||
static void Menu_Item_Handler(const uint8_t menu, const uint8_t item, bool draw=true);
|
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 popupHandler(const PopupID popupid, bool option=false);
|
||||||
static void Confirm_Handler(const PopupID popupid);
|
static void confirmHandler(const PopupID popupid);
|
||||||
|
|
||||||
static void Main_Menu_Control();
|
static void mainMenuControl();
|
||||||
static void Menu_Control();
|
static void menuControl();
|
||||||
static void Value_Control();
|
static void valueControl();
|
||||||
static void Option_Control();
|
static void optionControl();
|
||||||
static void File_Control();
|
static void fileControl();
|
||||||
static void Print_Screen_Control();
|
static void printScreenControl();
|
||||||
static void Popup_Control();
|
static void popupControl();
|
||||||
static void Confirm_Control();
|
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 setupValue(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 modifyValue(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 modifyValue(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 modifyValue(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 modifyValue(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 modifyValue(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 modifyValue(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 modifyOption(const uint8_t value, const char * const * options, const uint8_t max);
|
||||||
|
|
||||||
static void Update_Status(const char * const text);
|
static void updateStatus(const char * const text);
|
||||||
static void Start_Print(const bool sd);
|
static void startPrint(const bool sd);
|
||||||
static void Stop_Print();
|
static void stopPrint();
|
||||||
static void Update();
|
static void update();
|
||||||
static void State_Update();
|
static void stateUpdate();
|
||||||
static void Screen_Update();
|
static void screenUpdate();
|
||||||
static void AudioFeedback(const bool success=true);
|
static void audioFeedback(const bool success=true);
|
||||||
static void Save_Settings(char * const buff);
|
static void saveSettings(char * const buff);
|
||||||
static void Load_Settings(const char * const buff);
|
static void loadSettings(const char * const buff);
|
||||||
static void Reset_Settings();
|
static void resetSettings();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern CrealityDWINClass CrealityDWIN;
|
extern CrealityDWIN crealityDWIN;
|
||||||
|
@@ -33,22 +33,22 @@
|
|||||||
|
|
||||||
/*-------------------------------------- System variable function --------------------------------------*/
|
/*-------------------------------------- System variable function --------------------------------------*/
|
||||||
|
|
||||||
void DWIN_Startup() {}
|
void dwinStartup() {}
|
||||||
|
|
||||||
/*---------------------------------------- Drawing functions ----------------------------------------*/
|
/*---------------------------------------- Drawing functions ----------------------------------------*/
|
||||||
|
|
||||||
// Draw the degree (°) symbol
|
// Draw the degree (°) symbol
|
||||||
// Color: color
|
// color: color
|
||||||
// x/y: Upper-left coordinate of the first pixel
|
// 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) {
|
||||||
DWIN_Draw_Point(Color, 1, 1, x + 1, y);
|
dwinDrawPoint(color, 1, 1, x + 1, y);
|
||||||
DWIN_Draw_Point(Color, 1, 1, x + 2, y);
|
dwinDrawPoint(color, 1, 1, x + 2, y);
|
||||||
DWIN_Draw_Point(Color, 1, 1, x, y + 1);
|
dwinDrawPoint(color, 1, 1, x, y + 1);
|
||||||
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 1);
|
dwinDrawPoint(color, 1, 1, x + 3, y + 1);
|
||||||
DWIN_Draw_Point(Color, 1, 1, x, y + 2);
|
dwinDrawPoint(color, 1, 1, x, y + 2);
|
||||||
DWIN_Draw_Point(Color, 1, 1, x + 3, y + 2);
|
dwinDrawPoint(color, 1, 1, x + 3, y + 2);
|
||||||
DWIN_Draw_Point(Color, 1, 1, x + 1, y + 3);
|
dwinDrawPoint(color, 1, 1, x + 1, y + 3);
|
||||||
DWIN_Draw_Point(Color, 1, 1, x + 2, y + 3);
|
dwinDrawPoint(color, 1, 1, x + 2, y + 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
||||||
@@ -57,8 +57,8 @@ void DWIN_Draw_DegreeSymbol(uint16_t Color, uint16_t x, uint16_t y) {
|
|||||||
// libID: Icon library ID
|
// libID: Icon library ID
|
||||||
// picID: Icon ID
|
// picID: Icon ID
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
||||||
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
|
dwinIconShow(true, false, false, libID, picID, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // DWIN_CREALITY_LCD_JYERSUI
|
#endif // DWIN_CREALITY_LCD_JYERSUI
|
||||||
|
@@ -29,6 +29,6 @@
|
|||||||
#include "../common/dwin_api.h"
|
#include "../common/dwin_api.h"
|
||||||
|
|
||||||
// Draw the degree (°) symbol
|
// Draw the degree (°) symbol
|
||||||
// Color: color
|
// color: color
|
||||||
// x/y: Upper-left coordinate of the first pixel
|
// 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);
|
||||||
|
@@ -39,15 +39,15 @@
|
|||||||
|
|
||||||
/*-------------------------------------- System variable function --------------------------------------*/
|
/*-------------------------------------- System variable function --------------------------------------*/
|
||||||
|
|
||||||
void DWIN_Startup() {
|
void dwinStartup() {
|
||||||
DEBUG_ECHOPGM("\r\nDWIN handshake ");
|
DEBUG_ECHOPGM("\r\nDWIN handshake ");
|
||||||
delay(750); // Delay here or init later in the boot process
|
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.");
|
if (success) DEBUG_ECHOLNPGM("ok."); else DEBUG_ECHOLNPGM("error.");
|
||||||
DWIN_Frame_SetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1));
|
dwinFrameSetDir(TERN(DWIN_MARLINUI_LANDSCAPE, 0, 1));
|
||||||
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
|
||||||
DWIN_JPG_ShowAndCache(3);
|
dwinJPGShowAndCache(3);
|
||||||
DWIN_UpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
/*---------------------------------------- Picture related functions ----------------------------------------*/
|
||||||
@@ -56,8 +56,8 @@ void DWIN_Startup() {
|
|||||||
// libID: Icon library ID
|
// libID: Icon library ID
|
||||||
// picID: Icon ID
|
// picID: Icon ID
|
||||||
// x/y: Upper-left point
|
// x/y: Upper-left point
|
||||||
void DWIN_ICON_Show(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
void dwinIconShow(uint8_t libID, uint8_t picID, uint16_t x, uint16_t y) {
|
||||||
DWIN_ICON_Show(true, false, false, libID, picID, x, y);
|
dwinIconShow(true, false, false, libID, picID, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IS_DWIN_MARLINUI
|
#endif // IS_DWIN_MARLINUI
|
||||||
|
@@ -133,7 +133,7 @@ void DWIN_String::add_character(const char character) {
|
|||||||
if (length < MAX_STRING_LENGTH) {
|
if (length < MAX_STRING_LENGTH) {
|
||||||
data[length] = character;
|
data[length] = character;
|
||||||
length++;
|
length++;
|
||||||
//span += glyph(character)->DWidth;
|
//span += glyph(character)->dWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +141,7 @@ void DWIN_String::rtrim(const char character) {
|
|||||||
while (length) {
|
while (length) {
|
||||||
if (data[length - 1] == 0x20 || data[length - 1] == character) {
|
if (data[length - 1] == 0x20 || data[length - 1] == character) {
|
||||||
length--;
|
length--;
|
||||||
//span -= glyph(data[length])->DWidth;
|
//span -= glyph(data[length])->dWidth;
|
||||||
eol();
|
eol();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -152,7 +152,7 @@ void DWIN_String::rtrim(const char character) {
|
|||||||
void DWIN_String::ltrim(const char character) {
|
void DWIN_String::ltrim(const char character) {
|
||||||
uint16_t i, j;
|
uint16_t i, j;
|
||||||
for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) {
|
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;
|
if (i == 0) return;
|
||||||
for (j = 0; i < length; data[j++] = data[i++]);
|
for (j = 0; i < length; data[j++] = data[i++]);
|
||||||
|
@@ -55,7 +55,7 @@ class DWIN_String {
|
|||||||
//static void add_glyphs(const uint8_t *font);
|
//static void add_glyphs(const uint8_t *font);
|
||||||
|
|
||||||
//static font_t *font() { return font_header; };
|
//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 glyphs[character] ?: glyphs[0x3F]; } /* Use '?' for unknown glyphs */
|
||||||
//static glyph_t *glyph(uint8_t *character) { return glyph(*character); }
|
//static glyph_t *glyph(uint8_t *character) { return glyph(*character); }
|
||||||
|
|
||||||
|
@@ -56,7 +56,7 @@ void lcd_put_int(const int i) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int lcd_put_dwin_string() {
|
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);
|
lcd_advance_cursor(dwin_string.length);
|
||||||
return 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.set(c);
|
||||||
dwin_string.truncate(max_length);
|
dwin_string.truncate(max_length);
|
||||||
// Draw the char(s) at the cursor and advance the cursor
|
// 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);
|
lcd_advance_cursor(dwin_string.length);
|
||||||
return 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;
|
if (!wc) break;
|
||||||
dwin_string.add(wc);
|
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);
|
lcd_advance_cursor(dwin_string.length);
|
||||||
return 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*/) {
|
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.set(ptpl, ind, cstr, fstr);
|
||||||
dwin_string.truncate(maxlen);
|
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);
|
lcd_advance_cursor(dwin_string.length);
|
||||||
return dwin_string.length;
|
return dwin_string.length;
|
||||||
}
|
}
|
||||||
|
@@ -78,14 +78,14 @@ void MarlinUI::set_font(const uint8_t font_nr) {
|
|||||||
bool MarlinUI::detected() { return true; }
|
bool MarlinUI::detected() { return true; }
|
||||||
|
|
||||||
// Initialize or re-initialize the LCD
|
// 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
|
// This LCD should clear where it will draw anew
|
||||||
void MarlinUI::clear_lcd() {
|
void MarlinUI::clear_lcd() {
|
||||||
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations
|
dwinIconAnimationControl(0x0000); // disable all icon animations
|
||||||
DWIN_JPG_ShowAndCache(3);
|
dwinJPGShowAndCache(3);
|
||||||
DWIN_Frame_Clear(Color_Bg_Black);
|
dwinFrameClear(Color_Bg_Black);
|
||||||
DWIN_UpdateLCD();
|
dwinUpdateLCD();
|
||||||
|
|
||||||
did_first_redraw = false;
|
did_first_redraw = false;
|
||||||
}
|
}
|
||||||
@@ -109,25 +109,25 @@ void MarlinUI::clear_lcd() {
|
|||||||
#define VERSION_Y 84
|
#define VERSION_Y 84
|
||||||
#endif
|
#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));
|
TERN_(SHOW_CUSTOM_BOOTSCREEN, safe_delay(CUSTOM_BOOTSCREEN_TIMEOUT));
|
||||||
clear_lcd();
|
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)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, LOGO_CENTER - 174 / 2, 280);
|
dwinIconShow(BOOT_ICON, ICON_OpenSource, LOGO_CENTER - 174 / 2, 280);
|
||||||
DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, LOGO_CENTER - 180 / 2, 420);
|
dwinIconShow(BOOT_ICON, ICON_GitHubURL, LOGO_CENTER - 180 / 2, 420);
|
||||||
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, LOGO_CENTER - 100 / 2, 440);
|
dwinIconShow(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_Copyright, LOGO_CENTER - 126 / 2, 460);
|
||||||
#else
|
#else
|
||||||
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
|
dwinIconShow(BOOT_ICON, ICON_MarlinBoot, LOGO_CENTER - 266 / 2, 15);
|
||||||
DWIN_ICON_Show(BOOT_ICON, ICON_OpenSource, INFO_CENTER - 174 / 2, 60);
|
dwinIconShow(BOOT_ICON, ICON_OpenSource, INFO_CENTER - 174 / 2, 60);
|
||||||
DWIN_ICON_Show(BOOT_ICON, ICON_GitHubURL, INFO_CENTER - 180 / 2, 130);
|
dwinIconShow(BOOT_ICON, ICON_GitHubURL, INFO_CENTER - 180 / 2, 130);
|
||||||
DWIN_ICON_Show(BOOT_ICON, ICON_MarlinURL, INFO_CENTER - 100 / 2, 152);
|
dwinIconShow(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_Copyright, INFO_CENTER - 126 / 2, 200);
|
||||||
#endif
|
#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()));
|
||||||
DWIN_UpdateLCD();
|
dwinUpdateLCD();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarlinUI::bootscreen_completion(const millis_t sofar) {
|
void MarlinUI::bootscreen_completion(const millis_t sofar) {
|
||||||
@@ -140,23 +140,23 @@ void MarlinUI::clear_lcd() {
|
|||||||
// The kill screen is displayed for unrecoverable conditions
|
// The kill screen is displayed for unrecoverable conditions
|
||||||
void MarlinUI::draw_kill_screen() {
|
void MarlinUI::draw_kill_screen() {
|
||||||
set_font(DWIN_FONT_ALERT);
|
set_font(DWIN_FONT_ALERT);
|
||||||
DWIN_Frame_Clear(Color_Bg_Black);
|
dwinFrameClear(Color_Bg_Black);
|
||||||
dwin_font.fg = Color_Error_Red;
|
dwin_font.fg = Color_Error_Red;
|
||||||
dwin_font.solid = false;
|
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
|
// make the frame a few pixels thick
|
||||||
DWIN_Draw_Rectangle(0, Color_Yellow, 20, 20, LCD_PIXEL_WIDTH - 20, LCD_PIXEL_HEIGHT - 20);
|
dwinDrawRectangle(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);
|
dwinDrawRectangle(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, 22, 22, LCD_PIXEL_WIDTH - 22, LCD_PIXEL_HEIGHT - 22);
|
||||||
|
|
||||||
uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2),
|
uint8_t cx = (LCD_PIXEL_WIDTH / dwin_font.width / 2),
|
||||||
cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2);
|
cy = (LCD_PIXEL_HEIGHT / dwin_font.height / 2);
|
||||||
|
|
||||||
#if ENABLED(DWIN_MARLINUI_LANDSCAPE)
|
#if ENABLED(DWIN_MARLINUI_LANDSCAPE)
|
||||||
cx += (96 / 2 / dwin_font.width);
|
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
|
#else
|
||||||
DWIN_ICON_Show(ICON, ICON_Halted, (LCD_PIXEL_WIDTH - 96) / 2, 40);
|
dwinIconShow(ICON, ICON_Halted, (LCD_PIXEL_WIDTH - 96) / 2, 40);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t slen = utf8_strlen(status_message);
|
uint8_t slen = utf8_strlen(status_message);
|
||||||
@@ -260,7 +260,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_LCD_BRIGHTNESS
|
#if HAS_LCD_BRIGHTNESS
|
||||||
void MarlinUI::_set_brightness() { DWIN_LCD_Brightness(backlight ? brightness : 0); }
|
void MarlinUI::_set_brightness() { dwinLCDBrightness(backlight ? brightness : 0); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_MARLINUI_MENU
|
#if HAS_MARLINUI_MENU
|
||||||
@@ -295,13 +295,13 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
if (y >= LCD_PIXEL_HEIGHT) return false;
|
if (y >= LCD_PIXEL_HEIGHT) return false;
|
||||||
|
|
||||||
if (is_static && sel)
|
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 {
|
else {
|
||||||
#if ENABLED(MENU_HOLLOW_FRAME)
|
#if ENABLED(MENU_HOLLOW_FRAME)
|
||||||
DWIN_Draw_Box(1, Color_Bg_Black, 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) DWIN_Draw_Box(0, Select_Color, 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
|
#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
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +425,7 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
dwin_string.set(value);
|
dwin_string.set(value);
|
||||||
|
|
||||||
const dwin_coord_t by = (row * MENU_LINE_HEIGHT) + MENU_FONT_HEIGHT + EXTRA_ROW_HEIGHT / 2;
|
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()) {
|
if (ui.can_show_slider()) {
|
||||||
|
|
||||||
@@ -435,11 +435,11 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
slider_y = by + 32 + 4,
|
slider_y = by + 32 + 4,
|
||||||
amount = ui.encoderPosition * slider_length / maxEditValue;
|
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)
|
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)
|
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,
|
col = yesopt ? LCD_WIDTH - mar - len : mar,
|
||||||
row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1);
|
row = (LCD_HEIGHT >= 8 ? LCD_HEIGHT / 2 + 3 : LCD_HEIGHT - 1);
|
||||||
lcd_moveto(col, row);
|
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);
|
lcd_put_u8str(col, row, fstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,9 +512,9 @@ void MarlinUI::draw_status_message(const bool blink) {
|
|||||||
// Clear the Mesh Map
|
// Clear the Mesh Map
|
||||||
|
|
||||||
// First draw the bigger box in White so we have a border around the mesh map box
|
// 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
|
// 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
|
// 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.
|
// 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;
|
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), by,
|
||||||
x_offset + (x_plot * pixels_per_x_mesh_pnt) + pixels_per_x_mesh_pnt, by + pixels_per_y_mesh_pnt
|
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;
|
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 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)
|
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
|
// 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;
|
const int nozzle = (LCD_PIXEL_WIDTH / 2) - 20;
|
||||||
|
|
||||||
// Draw a representation of the nozzle
|
// 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
|
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
|
||||||
DWIN_ICON_Show(ICON, ICON_HotendOff, nozzle + 3, 10 - dir);
|
dwinIconShow(ICON, ICON_HotendOff, nozzle + 3, 10 - dir);
|
||||||
DWIN_ICON_Show(ICON, ICON_BedLine, nozzle, 10 + 36);
|
dwinIconShow(ICON, ICON_BedLine, nozzle, 10 + 36);
|
||||||
|
|
||||||
// Draw cw/ccw indicator and up/down arrows
|
// Draw cw/ccw indicator and up/down arrows
|
||||||
const int arrow_y = LCD_PIXEL_HEIGHT / 2 - 24;
|
const int arrow_y = LCD_PIXEL_HEIGHT / 2 - 24;
|
||||||
DWIN_ICON_Show(ICON, ICON_DownArrow, 0, arrow_y - dir);
|
dwinIconShow(ICON, ICON_DownArrow, 0, arrow_y - dir);
|
||||||
DWIN_ICON_Show(ICON, rot_down, 48, arrow_y);
|
dwinIconShow(ICON, rot_down, 48, arrow_y);
|
||||||
|
|
||||||
DWIN_ICON_Show(ICON, ICON_UpArrow, LCD_PIXEL_WIDTH - 10 - (48*2), arrow_y - dir);
|
dwinIconShow(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, rot_up, LCD_PIXEL_WIDTH - 10 - 48, arrow_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // BABYSTEP_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
|
#endif // BABYSTEP_GFX_OVERLAY || MESH_EDIT_GFX_OVERLAY
|
||||||
|
@@ -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();
|
const bool x_redraw = !ui.did_first_redraw || old_is_printing != print_job_timer.isRunning();
|
||||||
if (x_redraw) {
|
if (x_redraw) {
|
||||||
dwin_string.set('X' + axis);
|
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)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
x + (utf8_strlen(value) * 14 - 14) / 2, y + 2
|
x + (utf8_strlen(value) * 14 - 14) / 2, y + 2
|
||||||
#else
|
#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))
|
if (TERN0(LCD_SHOW_E_TOTAL, x_redraw && axis == X_AXIS))
|
||||||
dwin_string.add(F(" "));
|
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)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
x, y + 32
|
x, y + 32
|
||||||
#else
|
#else
|
||||||
@@ -117,26 +117,26 @@ void _draw_axis_value(const AxisEnum axis, const char *value, const bool blink,
|
|||||||
if (e_redraw) {
|
if (e_redraw) {
|
||||||
// Extra spaces to erase previous value
|
// Extra spaces to erase previous value
|
||||||
dwin_string.set(F("E "));
|
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_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
|
// 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
|
#else // !DWIN_MARLINUI_PORTRAIT
|
||||||
|
|
||||||
if (e_redraw) {
|
if (e_redraw) {
|
||||||
dwin_string.set(F("E "));
|
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_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
|
#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 uint16_t fanx = (4 * STATUS_CHR_WIDTH - STATUS_FAN_WIDTH) / 2;
|
||||||
const bool fan_on = !!thermalManager.scaledFanSpeed(0);
|
const bool fan_on = !!thermalManager.scaledFanSpeed(0);
|
||||||
if (fan_on) {
|
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.set(i8tostr3rj(thermalManager.scaledFanSpeedPercent(0)));
|
||||||
dwin_string.add('%');
|
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 {
|
else {
|
||||||
DWIN_ICON_AnimationControl(0x0000); // disable all icon animations (this is the only one)
|
dwinIconAnimationControl(0x0000); // disable all icon animations (this is the only one)
|
||||||
DWIN_ICON_Show(ICON, ICON_Fan0, x + fanx, y);
|
dwinIconShow(ICON, ICON_Fan0, x + fanx, y);
|
||||||
dwin_string.set(F(" "));
|
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
|
#endif
|
||||||
@@ -230,20 +230,20 @@ FORCE_INLINE void _draw_heater_status(const heater_id_t heater, const uint16_t x
|
|||||||
if (t_draw) {
|
if (t_draw) {
|
||||||
dwin_string.set(i16tostr3rj(tt + 0.5));
|
dwin_string.set(i16tostr3rj(tt + 0.5));
|
||||||
dwin_string.add(LCD_STR_DEGREE);
|
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
|
// Draw heater icon with on / off / leveled states
|
||||||
if (i_draw) {
|
if (i_draw) {
|
||||||
const uint8_t ico = isBed ? (TERN0(HAS_LEVELING, planner.leveling_active) ? ICON_BedLevelOff : ICON_BedOff) : ICON_HotendOff;
|
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
|
// Draw current temperature, if needed
|
||||||
if (c_draw) {
|
if (c_draw) {
|
||||||
dwin_string.set(i16tostr3rj(tc + 0.5));
|
dwin_string.set(i16tostr3rj(tc + 0.5));
|
||||||
dwin_string.add(LCD_STR_DEGREE);
|
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) {
|
FORCE_INLINE void _draw_feedrate_status(const char *value, uint16_t x, uint16_t y) {
|
||||||
if (!ui.did_first_redraw) {
|
if (!ui.did_first_redraw) {
|
||||||
dwin_string.set(LCD_STR_FEEDRATE);
|
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.set(value);
|
||||||
dwin_string.add('%');
|
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
|
// Logo/Status Icon
|
||||||
#define STATUS_LOGO_WIDTH 128
|
#define STATUS_LOGO_WIDTH 128
|
||||||
#define STATUS_LOGO_HEIGHT 40
|
#define STATUS_LOGO_HEIGHT 40
|
||||||
DWIN_ICON_Show(ICON, ICON_LOGO_Marlin,
|
dwinIconShow(ICON, ICON_LOGO_Marlin,
|
||||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
(LCD_PIXEL_WIDTH - (STATUS_LOGO_WIDTH)) / 2, ((STATUS_HEATERS_Y - 4) - (STATUS_LOGO_HEIGHT)) / 2
|
(LCD_PIXEL_WIDTH - (STATUS_LOGO_WIDTH)) / 2, ((STATUS_HEATERS_Y - 4) - (STATUS_LOGO_HEIGHT)) / 2
|
||||||
#else
|
#else
|
||||||
@@ -281,7 +281,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Draw a frame around the x/y/z values
|
// Draw a frame around the x/y/z values
|
||||||
DWIN_Draw_Rectangle(0, Select_Color,
|
dwinDrawRectangle(0, Select_Color,
|
||||||
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
#if ENABLED(DWIN_MARLINUI_PORTRAIT)
|
||||||
0, 193, LCD_PIXEL_WIDTH - 1, 260
|
0, 193, LCD_PIXEL_WIDTH - 1, 260
|
||||||
#else
|
#else
|
||||||
@@ -358,7 +358,7 @@ void MarlinUI::draw_status_screen() {
|
|||||||
time.toDigital(buffer);
|
time.toDigital(buffer);
|
||||||
dwin_string.add(prefix);
|
dwin_string.add(prefix);
|
||||||
dwin_string.add(buffer);
|
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
|
#else
|
||||||
|
|
||||||
@@ -367,23 +367,23 @@ void MarlinUI::draw_status_screen() {
|
|||||||
time.toDigital(buffer);
|
time.toDigital(buffer);
|
||||||
dwin_string.set(' ');
|
dwin_string.set(' ');
|
||||||
dwin_string.add(buffer);
|
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 ENABLED(SHOW_REMAINING_TIME)
|
||||||
if (print_job_timer.isRunning()) {
|
if (print_job_timer.isRunning()) {
|
||||||
time = get_remaining_time();
|
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)
|
if (print_job_timer.isPaused() && blink)
|
||||||
dwin_string.set(F(" "));
|
dwin_string.set(F(" "));
|
||||||
else {
|
else {
|
||||||
time.toDigital(buffer);
|
time.toDigital(buffer);
|
||||||
dwin_string.set(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()) {
|
else if (!ui.did_first_redraw || old_is_printing != print_job_timer.isRunning()) {
|
||||||
dwin_string.set(F(" "));
|
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
|
||||||
#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)();
|
const progress_t progress = TERN(HAS_PRINT_PROGRESS_PERMYRIAD, get_progress_permyriad, get_progress_percent)();
|
||||||
|
|
||||||
if (!ui.did_first_redraw)
|
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;
|
static uint16_t old_solid = 50;
|
||||||
const uint16_t pb_solid = (pb_width - 2) * (progress / (PROGRESS_SCALE)) * 0.01f;
|
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 (p_draw) {
|
||||||
//if (pb_solid)
|
//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)
|
//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)
|
#if ENABLED(SHOW_PROGRESS_PERCENT)
|
||||||
dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
|
dwin_string.set(TERN(PRINT_PROGRESS_SHOW_DECIMALS, permyriadtostr4(progress), ui8tostr3rj(progress / (PROGRESS_SCALE))));
|
||||||
dwin_string.add('%');
|
dwin_string.add('%');
|
||||||
DWIN_Draw_String(
|
dwinDrawString(
|
||||||
false, font16x32, Percent_Color, Color_Bg_Black,
|
false, font16x32, Percent_Color, Color_Bg_Black,
|
||||||
pb_left + (pb_width - dwin_string.length * 16) / 2,
|
pb_left + (pb_width - dwin_string.length * 16) / 2,
|
||||||
pb_top + (pb_height - 32) / 2 - 1,
|
pb_top + (pb_height - 32) / 2 - 1,
|
||||||
|
@@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
namespace Anycubic {
|
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;
|
const uint16_t wholenotelen = tune[0] / speed;
|
||||||
for (uint8_t pos = 1; pos < MAX_TUNE_LENGTH; pos += 2) {
|
for (uint8_t pos = 1; pos < MAX_TUNE_LENGTH; pos += 2) {
|
||||||
const uint16_t freq = tune[pos];
|
const uint16_t freq = tune[pos];
|
||||||
|
@@ -61,7 +61,7 @@ n_END=10000 // end of tune marker
|
|||||||
|
|
||||||
namespace Anycubic {
|
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
|
// Only uncomment the tunes you are using to save memory
|
||||||
// This will help you write tunes!
|
// This will help you write tunes!
|
||||||
|
@@ -103,7 +103,7 @@ void ChironTFT::startup() {
|
|||||||
injectCommands(AC_cmnd_enable_leveling);
|
injectCommands(AC_cmnd_enable_leveling);
|
||||||
|
|
||||||
// startup tunes are defined in Tunes.h
|
// 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
|
#if ACDEBUGLEVEL
|
||||||
DEBUG_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
|
DEBUG_ECHOLNPGM("AC Debug Level ", ACDEBUGLEVEL);
|
||||||
@@ -191,7 +191,7 @@ void ChironTFT::filamentRunout() {
|
|||||||
// 1 Signal filament out
|
// 1 Signal filament out
|
||||||
last_error = AC_error_filament_runout;
|
last_error = AC_error_filament_runout;
|
||||||
tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
|
tftSendLn(isPrintingFromMedia() ? AC_msg_filament_out_alert : AC_msg_filament_out_block);
|
||||||
PlayTune(FilamentOut);
|
playTune(FilamentOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChironTFT::confirmationRequest(const char * const msg) {
|
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) {
|
if (strcmp_P(msg, MARLIN_msg_heater_timeout) == 0) {
|
||||||
pause_state = AC_paused_heater_timed_out;
|
pause_state = AC_paused_heater_timed_out;
|
||||||
tftSendLn(AC_msg_paused); // enable continue button
|
tftSendLn(AC_msg_paused); // enable continue button
|
||||||
PlayTune(HeaterTimeout);
|
playTune(HeaterTimeout);
|
||||||
}
|
}
|
||||||
// Reheat finished, send acknowledgement
|
// Reheat finished, send acknowledgement
|
||||||
else if (strcmp_P(msg, MARLIN_msg_reheat_done) == 0) {
|
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 probing fails don't save the mesh raise the probe above the bad point
|
||||||
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
|
if (strcmp_P(msg, MARLIN_msg_probing_failed) == 0) {
|
||||||
PlayTune(BeepBeepBeeep);
|
playTune(BeepBeepBeeep);
|
||||||
injectCommands(F("G1 Z50 F500"));
|
injectCommands(F("G1 Z50 F500"));
|
||||||
tftSendLn(AC_msg_probing_complete);
|
tftSendLn(AC_msg_probing_complete);
|
||||||
printer_state = AC_printer_idle;
|
printer_state = AC_printer_idle;
|
||||||
@@ -306,7 +306,7 @@ void ChironTFT::statusChange(const char * const msg) {
|
|||||||
void ChironTFT::powerLossRecovery() {
|
void ChironTFT::powerLossRecovery() {
|
||||||
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
printer_state = AC_printer_resuming_from_power_outage; // Play tune to notify user we can recover.
|
||||||
last_error = AC_error_powerloss;
|
last_error = AC_error_powerloss;
|
||||||
PlayTune(SOS);
|
playTune(SOS);
|
||||||
SERIAL_ECHOLN(AC_msg_powerloss_recovery);
|
SERIAL_ECHOLN(AC_msg_powerloss_recovery);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
#if ENABLED(ANYCUBIC_LCD_I3MEGA)
|
#if ENABLED(ANYCUBIC_LCD_I3MEGA)
|
||||||
|
|
||||||
//#define ANYCUBIC_LCD_DEBUG
|
//#define ANYCUBIC_LCD_DEBUG
|
||||||
#define DEBUG_OUT ANYCUBIC_LCD_DEBUG
|
#define DEBUG_OUT ENABLED(ANYCUBIC_LCD_DEBUG)
|
||||||
#include "../../../core/debug_out.h"
|
#include "../../../core/debug_out.h"
|
||||||
|
|
||||||
#include "anycubic_i3mega_lcd.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_FILENAME(A) A TERN_(ANYCUBIC_LCD_GCODE_EXT, ".gcode")
|
||||||
#define SPECIAL_MENU_ALTNAME(A, B) TERN(ANYCUBIC_LCD_GCODE_EXT, A ".gcode", B)
|
#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];
|
char AnycubicTFT::tftCommands[TFTBUFSIZE][TFT_MAX_CMD_SIZE];
|
||||||
int AnycubicTFTClass::tftBufLen = 0,
|
int AnycubicTFT::tftBufLen = 0,
|
||||||
AnycubicTFTClass::tftBufIndR = 0,
|
AnycubicTFT::tftBufIndR = 0,
|
||||||
AnycubicTFTClass::tftBufIndW = 0;
|
AnycubicTFT::tftBufIndW = 0;
|
||||||
char AnycubicTFTClass::serial3_char;
|
char* AnycubicTFT::tftStrchrPtr;
|
||||||
char* AnycubicTFTClass::tftStrchrPtr;
|
uint8_t AnycubicTFT::specialMenu = false;
|
||||||
uint8_t AnycubicTFTClass::specialMenu = false;
|
AnycubicMediaPrintState AnycubicTFT::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
||||||
AnycubicMediaPrintState AnycubicTFTClass::mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
AnycubicMediaPauseState AnycubicTFT::mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
||||||
AnycubicMediaPauseState AnycubicTFTClass::mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
|
||||||
|
|
||||||
char AnycubicTFTClass::selectedDirectory[30];
|
char AnycubicTFT::selectedDirectory[30];
|
||||||
char AnycubicTFTClass::selectedFile[FILENAME_LENGTH];
|
char AnycubicTFT::selectedFile[FILENAME_LENGTH];
|
||||||
|
|
||||||
// Serial helpers
|
// Serial helpers
|
||||||
static void sendNewLine() { LCD_SERIAL.write('\r'); LCD_SERIAL.write('\n'); }
|
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;
|
using namespace ExtUI;
|
||||||
|
|
||||||
AnycubicTFTClass::AnycubicTFTClass() {}
|
AnycubicTFT::AnycubicTFT() {}
|
||||||
|
|
||||||
void AnycubicTFTClass::onSetup() {
|
void AnycubicTFT::onSetup() {
|
||||||
#ifndef LCD_BAUDRATE
|
#ifndef LCD_BAUDRATE
|
||||||
#define LCD_BAUDRATE 115200
|
#define LCD_BAUDRATE 115200
|
||||||
#endif
|
#endif
|
||||||
@@ -110,7 +109,7 @@ void AnycubicTFTClass::onSetup() {
|
|||||||
DEBUG_ECHOLNPGM("TFT Serial Debug: Finished startup");
|
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
|
static millis_t nextStopCheck = 0; // used to slow the stopped print check down to reasonable times
|
||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
if (ELAPSED(ms, nextStopCheck)) {
|
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");
|
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);
|
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardStateChange event triggered...", isInserted);
|
||||||
doSDCardStateCheck();
|
doSDCardStateCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::onSDCardError() {
|
void AnycubicTFT::onSDCardError() {
|
||||||
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardError event triggered...");
|
DEBUG_ECHOLNPGM("TFT Serial Debug: onSDCardError event triggered...");
|
||||||
SENDLINE_DBG_PGM("J21", "TFT Serial Debug: On SD Card Error ... J21");
|
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...");
|
DEBUG_ECHOLNPGM("TFT Serial Debug: onFilamentRunout triggered...");
|
||||||
doFilamentRunoutCheck();
|
doFilamentRunoutCheck();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::onUserConfirmRequired(const char * const msg) {
|
void AnycubicTFT::onUserConfirmRequired(const char * const msg) {
|
||||||
DEBUG_ECHOLNPGM("TFT Serial Debug: onUserConfirmRequired triggered... ", msg);
|
DEBUG_ECHOLNPGM("TFT Serial Debug: onUserConfirmRequired triggered... ", msg);
|
||||||
|
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
@@ -206,23 +205,23 @@ void AnycubicTFTClass::onUserConfirmRequired(const char * const msg) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
float AnycubicTFTClass::codeValue() {
|
float AnycubicTFT::codeValue() {
|
||||||
return (strtod(&tftCommands[tftBufIndR][tftStrchrPtr - tftCommands[tftBufIndR] + 1], nullptr));
|
return (strtod(&tftCommands[tftBufIndR][tftStrchrPtr - tftCommands[tftBufIndR] + 1], nullptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnycubicTFTClass::codeSeen(char code) {
|
bool AnycubicTFT::codeSeen(char code) {
|
||||||
tftStrchrPtr = strchr(tftCommands[tftBufIndR], code);
|
tftStrchrPtr = strchr(tftCommands[tftBufIndR], code);
|
||||||
return !!tftStrchrPtr; // Return True if a character was found
|
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 xPosition = getAxisPosition_mm((axis_t) X);
|
||||||
const float yPosition = getAxisPosition_mm((axis_t) Y);
|
const float yPosition = getAxisPosition_mm((axis_t) Y);
|
||||||
return WITHIN(xPosition, X_MIN_POS - 0.1, X_MIN_POS + 0.1) &&
|
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);
|
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.
|
* 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
|
#if HAS_MEDIA
|
||||||
uint16_t selectedNumber = 0;
|
uint16_t selectedNumber = 0;
|
||||||
selectedDirectory[0] = 0;
|
selectedDirectory[0] = 0;
|
||||||
@@ -383,7 +382,7 @@ void AnycubicTFTClass::renderCurrentFileList() {
|
|||||||
#endif // HAS_MEDIA
|
#endif // HAS_MEDIA
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::renderSpecialMenu(uint16_t selectedNumber) {
|
void AnycubicTFT::renderSpecialMenu(uint16_t selectedNumber) {
|
||||||
|
|
||||||
switch (selectedNumber) {
|
switch (selectedNumber) {
|
||||||
default: break;
|
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;
|
FileList currentFileList;
|
||||||
const uint16_t dir_files = currentFileList.count(),
|
const uint16_t dir_files = currentFileList.count(),
|
||||||
max_files = (dir_files - selectedNumber) < 4 ? dir_files : selectedNumber + 3;
|
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 HAS_MEDIA
|
||||||
if (mediaPrintingState == AMPRINTSTATE_PRINTING)
|
if (mediaPrintingState == AMPRINTSTATE_PRINTING)
|
||||||
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... J04"); // J04 Starting Print
|
SENDLINE_DBG_PGM("J04", "TFT Serial Debug: Starting SD Print... J04"); // J04 Starting Print
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::onPrintTimerPaused() {
|
void AnycubicTFT::onPrintTimerPaused() {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
if (isPrintingFromMedia()) {
|
if (isPrintingFromMedia()) {
|
||||||
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
mediaPrintingState = AMPRINTSTATE_PAUSED;
|
||||||
@@ -501,7 +500,7 @@ void AnycubicTFTClass::onPrintTimerPaused() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::onPrintTimerStopped() {
|
void AnycubicTFT::onPrintTimerStopped() {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
if (mediaPrintingState == AMPRINTSTATE_PRINTING) {
|
if (mediaPrintingState == AMPRINTSTATE_PRINTING) {
|
||||||
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
mediaPrintingState = AMPRINTSTATE_NOT_PRINTING;
|
||||||
@@ -514,7 +513,7 @@ void AnycubicTFTClass::onPrintTimerStopped() {
|
|||||||
|
|
||||||
#define ROUND(val) int((val)+0.5f)
|
#define ROUND(val) int((val)+0.5f)
|
||||||
|
|
||||||
void AnycubicTFTClass::getCommandFromTFT() {
|
void AnycubicTFT::getCommandFromTFT() {
|
||||||
static int serial_count = 0;
|
static int serial_count = 0;
|
||||||
|
|
||||||
char *starpos = nullptr;
|
char *starpos = nullptr;
|
||||||
@@ -884,7 +883,7 @@ void AnycubicTFTClass::getCommandFromTFT() {
|
|||||||
} // while
|
} // while
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::doSDCardStateCheck() {
|
void AnycubicTFT::doSDCardStateCheck() {
|
||||||
#if ALL(HAS_MEDIA, HAS_SD_DETECT)
|
#if ALL(HAS_MEDIA, HAS_SD_DETECT)
|
||||||
bool isInserted = isMediaInserted();
|
bool isInserted = isMediaInserted();
|
||||||
if (isInserted)
|
if (isInserted)
|
||||||
@@ -895,7 +894,7 @@ void AnycubicTFTClass::doSDCardStateCheck() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::doFilamentRunoutCheck() {
|
void AnycubicTFT::doFilamentRunoutCheck() {
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||||
// NOTE: getFilamentRunoutState() only returns the runout state if the job is printing
|
// 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
|
// 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
|
#endif // FILAMENT_RUNOUT_SENSOR
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::startPrint() {
|
void AnycubicTFT::startPrint() {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
if (!isPrinting() && strlen(selectedFile) > 0) {
|
if (!isPrinting() && strlen(selectedFile) > 0) {
|
||||||
DEBUG_ECHOLNPGM("TFT Serial Debug: About to print file ... ", isPrinting(), " ", selectedFile);
|
DEBUG_ECHOLNPGM("TFT Serial Debug: About to print file ... ", isPrinting(), " ", selectedFile);
|
||||||
@@ -925,7 +924,7 @@ void AnycubicTFTClass::startPrint() {
|
|||||||
#endif // SDUPPORT
|
#endif // SDUPPORT
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::pausePrint() {
|
void AnycubicTFT::pausePrint() {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) {
|
if (isPrintingFromMedia() && mediaPrintingState != AMPRINTSTATE_STOP_REQUESTED && mediaPauseState == AMPAUSESTATE_NOT_PAUSED) {
|
||||||
mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED;
|
mediaPrintingState = AMPRINTSTATE_PAUSE_REQUESTED;
|
||||||
@@ -939,7 +938,7 @@ void AnycubicTFTClass::pausePrint() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::resumePrint() {
|
void AnycubicTFT::resumePrint() {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
#if ENABLED(FILAMENT_RUNOUT_SENSOR)
|
||||||
if (READ(FIL_RUNOUT1_PIN)) {
|
if (READ(FIL_RUNOUT1_PIN)) {
|
||||||
@@ -973,7 +972,7 @@ void AnycubicTFTClass::resumePrint() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnycubicTFTClass::stopPrint() {
|
void AnycubicTFT::stopPrint() {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED;
|
mediaPrintingState = AMPRINTSTATE_STOP_REQUESTED;
|
||||||
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
mediaPauseState = AMPAUSESTATE_NOT_PAUSED;
|
||||||
|
@@ -45,9 +45,9 @@ enum AnycubicMediaPauseState {
|
|||||||
AMPAUSESTATE_REHEAT_FINISHED
|
AMPAUSESTATE_REHEAT_FINISHED
|
||||||
};
|
};
|
||||||
|
|
||||||
class AnycubicTFTClass {
|
class AnycubicTFT {
|
||||||
public:
|
public:
|
||||||
AnycubicTFTClass();
|
AnycubicTFT();
|
||||||
static void onSetup();
|
static void onSetup();
|
||||||
static void onCommandScan();
|
static void onCommandScan();
|
||||||
static void onKillTFT();
|
static void onKillTFT();
|
||||||
@@ -88,5 +88,5 @@ private:
|
|||||||
static char selectedFile[FILENAME_LENGTH];
|
static char selectedFile[FILENAME_LENGTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
extern AnycubicTFTClass anycubicTFT;
|
extern AnycubicTFT anycubicTFT;
|
||||||
extern const char G28_STR[];
|
extern const char G28_STR[];
|
||||||
|
@@ -91,7 +91,7 @@ namespace Anycubic {
|
|||||||
if (filelist.seek(_seek)) {
|
if (filelist.seek(_seek)) {
|
||||||
//sendFile();
|
//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)
|
#if ACDEBUG(AC_FILE)
|
||||||
SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n");
|
SERIAL_ECHOLNPGM("seek: ", _seek, " '", filelist.longFilename(), "' '", currentDirPath, "", filelist.shortFilename(), "'\n");
|
||||||
@@ -102,7 +102,7 @@ namespace Anycubic {
|
|||||||
SERIAL_ECHOLNPGM("over seek: ", _seek);
|
SERIAL_ECHOLNPGM("over seek: ", _seek);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DgusTFT::SendTxtToTFT("\0", TXT_FILE_0 + file_num*0x30);
|
DgusTFT::sendTxtToTFT("\0", TXT_FILE_0 + file_num*0x30);
|
||||||
}
|
}
|
||||||
|
|
||||||
file_num++;
|
file_num++;
|
||||||
@@ -115,7 +115,7 @@ namespace Anycubic {
|
|||||||
// Permitted special characters in file name: -_*#~
|
// Permitted special characters in file name: -_*#~
|
||||||
// Panel can display 22 characters per line.
|
// Panel can display 22 characters per line.
|
||||||
if (!filelist.isDir())
|
if (!filelist.isDir())
|
||||||
DgusTFT::SendTxtToTFT(filelist.longFilename(), TXT_FILE_0);
|
DgusTFT::sendTxtToTFT(filelist.longFilename(), TXT_FILE_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileNavigator::changeDIR(char *folder) {
|
void FileNavigator::changeDIR(char *folder) {
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -453,7 +453,7 @@ namespace Anycubic {
|
|||||||
static void tftSend(FSTR_P const=nullptr);
|
static void tftSend(FSTR_P const=nullptr);
|
||||||
static void tftSendLn(FSTR_P const=nullptr);
|
static void tftSendLn(FSTR_P const=nullptr);
|
||||||
static bool readTFTCommand();
|
static bool readTFTCommand();
|
||||||
static int8_t Findcmndpos(const char *, const char);
|
static int8_t findCmdPos(const char *, const char);
|
||||||
static void checkHeaters();
|
static void checkHeaters();
|
||||||
static void sendFileList(int8_t);
|
static void sendFileList(int8_t);
|
||||||
static void selectFile();
|
static void selectFile();
|
||||||
@@ -475,5 +475,5 @@ namespace Anycubic {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern DgusTFT Dgus;
|
extern DgusTFT dgus;
|
||||||
}
|
}
|
||||||
|
@@ -37,17 +37,17 @@ using namespace Anycubic;
|
|||||||
|
|
||||||
namespace ExtUI {
|
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) {
|
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 onMediaInserted() { dgus.mediaEvent(AC_media_inserted); }
|
||||||
void onMediaError() { Dgus.mediaEvent(AC_media_error); }
|
void onMediaError() { dgus.mediaEvent(AC_media_error); }
|
||||||
void onMediaRemoved() { Dgus.mediaEvent(AC_media_removed); }
|
void onMediaRemoved() { dgus.mediaEvent(AC_media_removed); }
|
||||||
|
|
||||||
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
void onPlayTone(const uint16_t frequency, const uint16_t duration) {
|
||||||
#if ENABLED(SPEAKER)
|
#if ENABLED(SPEAKER)
|
||||||
@@ -55,22 +55,22 @@ namespace ExtUI {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPrintTimerStarted() { Dgus.timerEvent(AC_timer_started); }
|
void onPrintTimerStarted() { dgus.timerEvent(AC_timer_started); }
|
||||||
void onPrintTimerPaused() { Dgus.timerEvent(AC_timer_paused); }
|
void onPrintTimerPaused() { dgus.timerEvent(AC_timer_paused); }
|
||||||
void onPrintTimerStopped() { Dgus.timerEvent(AC_timer_stopped); }
|
void onPrintTimerStopped() { dgus.timerEvent(AC_timer_stopped); }
|
||||||
void onPrintDone() {}
|
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 onUserConfirmRequired(const char * const msg) { dgus.confirmationRequest(msg); }
|
||||||
void onStatusChanged(const char * const msg) { Dgus.statusChange(msg); }
|
void onStatusChanged(const char * const msg) { dgus.statusChange(msg); }
|
||||||
|
|
||||||
void onHomingStart() { Dgus.HomingStart(); }
|
void onHomingStart() { dgus.homingStart(); }
|
||||||
void onHomingDone() { Dgus.HomingComplete(); }
|
void onHomingDone() { dgus.homingComplete(); }
|
||||||
|
|
||||||
void onFactoryReset() {
|
void onFactoryReset() {
|
||||||
Dgus.page_index_now = 121;
|
dgus.page_index_now = 121;
|
||||||
Dgus.lcd_info.audio_on = DISABLED(SPEAKER);
|
dgus.lcd_info.audio_on = DISABLED(SPEAKER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onStoreSettings(char *buff) {
|
void onStoreSettings(char *buff) {
|
||||||
@@ -78,8 +78,8 @@ namespace ExtUI {
|
|||||||
// permanent data to be stored, it can write up to eeprom_data_size bytes
|
// permanent data to be stored, it can write up to eeprom_data_size bytes
|
||||||
// into buff.
|
// into buff.
|
||||||
|
|
||||||
static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size);
|
static_assert(sizeof(dgus.lcd_info) <= ExtUI::eeprom_data_size);
|
||||||
memcpy(buff, &Dgus.lcd_info, sizeof(Dgus.lcd_info));
|
memcpy(buff, &dgus.lcd_info, sizeof(dgus.lcd_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onLoadSettings(const char *buff) {
|
void onLoadSettings(const char *buff) {
|
||||||
@@ -87,15 +87,15 @@ namespace ExtUI {
|
|||||||
// needs to retrieve data, it should copy up to eeprom_data_size bytes
|
// needs to retrieve data, it should copy up to eeprom_data_size bytes
|
||||||
// from buff
|
// from buff
|
||||||
|
|
||||||
static_assert(sizeof(Dgus.lcd_info) <= ExtUI::eeprom_data_size);
|
static_assert(sizeof(dgus.lcd_info) <= ExtUI::eeprom_data_size);
|
||||||
memcpy(&Dgus.lcd_info, buff, sizeof(Dgus.lcd_info));
|
memcpy(&dgus.lcd_info, buff, sizeof(dgus.lcd_info));
|
||||||
memcpy(&Dgus.lcd_info_back, buff, sizeof(Dgus.lcd_info_back));
|
memcpy(&dgus.lcd_info_back, buff, sizeof(dgus.lcd_info_back));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onPostprocessSettings() {
|
void onPostprocessSettings() {
|
||||||
// Called after loading or resetting stored settings
|
// Called after loading or resetting stored settings
|
||||||
Dgus.ParamInit();
|
dgus.paramInit();
|
||||||
Dgus.PowerLoss();
|
dgus.powerLoss();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onSettingsStored(const bool success) {
|
void onSettingsStored(const bool success) {
|
||||||
@@ -127,11 +127,11 @@ namespace ExtUI {
|
|||||||
|
|
||||||
#if ENABLED(POWER_LOSS_RECOVERY)
|
#if ENABLED(POWER_LOSS_RECOVERY)
|
||||||
// Called when power-loss is enabled/disabled
|
// 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
|
// Called when power-loss state is detected
|
||||||
void onPowerLoss() { /* handled internally */ }
|
void onPowerLoss() { /* handled internally */ }
|
||||||
// Called on resume from power-loss
|
// Called on resume from power-loss
|
||||||
void onPowerLossResume() { Dgus.powerLossRecovery(); }
|
void onPowerLossResume() { dgus.powerLossRecovery(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAS_PID_HEATING
|
#if HAS_PID_HEATING
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
#include "../../../gcode/queue.h"
|
#include "../../../gcode/queue.h"
|
||||||
|
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
bool DGUSSetupHandler::Print() {
|
bool DGUSSetupHandler::print() {
|
||||||
screen.filelist.refresh();
|
screen.filelist.refresh();
|
||||||
|
|
||||||
while (!screen.filelist.isAtRootDir()) {
|
while (!screen.filelist.isAtRootDir()) {
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool DGUSSetupHandler::PrintStatus() {
|
bool DGUSSetupHandler::printStatus() {
|
||||||
if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) {
|
if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -55,7 +55,7 @@ bool DGUSSetupHandler::PrintStatus() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::PrintAdjust() {
|
bool DGUSSetupHandler::printAdjust() {
|
||||||
if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) {
|
if (ExtUI::isPrinting() || ExtUI::isPrintingPaused()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ bool DGUSSetupHandler::PrintAdjust() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::LevelingMenu() {
|
bool DGUSSetupHandler::levelingMenu() {
|
||||||
ExtUI::setLevelingActive(screen.leveling_active);
|
ExtUI::setLevelingActive(screen.leveling_active);
|
||||||
|
|
||||||
if (!screen.isPrinterIdle()) {
|
if (!screen.isPrinterIdle()) {
|
||||||
@@ -87,7 +87,7 @@ bool DGUSSetupHandler::LevelingMenu() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::LevelingManual() {
|
bool DGUSSetupHandler::levelingManual() {
|
||||||
ExtUI::setLevelingActive(false);
|
ExtUI::setLevelingActive(false);
|
||||||
|
|
||||||
if (ExtUI::isPositionKnown()) {
|
if (ExtUI::isPositionKnown()) {
|
||||||
@@ -106,7 +106,7 @@ bool DGUSSetupHandler::LevelingManual() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::LevelingOffset() {
|
bool DGUSSetupHandler::levelingOffset() {
|
||||||
screen.offset_steps = DGUS_Data::StepSize::MMP1;
|
screen.offset_steps = DGUS_Data::StepSize::MMP1;
|
||||||
|
|
||||||
if (!screen.isPrinterIdle()) {
|
if (!screen.isPrinterIdle()) {
|
||||||
@@ -135,7 +135,7 @@ bool DGUSSetupHandler::LevelingOffset() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::LevelingAutomatic() {
|
bool DGUSSetupHandler::levelingAutomatic() {
|
||||||
if (ExtUI::getLevelingIsValid()) {
|
if (ExtUI::getLevelingIsValid()) {
|
||||||
screen.leveling_active = true;
|
screen.leveling_active = true;
|
||||||
|
|
||||||
@@ -145,21 +145,21 @@ bool DGUSSetupHandler::LevelingAutomatic() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::LevelingProbing() {
|
bool DGUSSetupHandler::levelingProbing() {
|
||||||
screen.probing_icons[0] = 0;
|
screen.probing_icons[0] = 0;
|
||||||
screen.probing_icons[1] = 0;
|
screen.probing_icons[1] = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::Filament() {
|
bool DGUSSetupHandler::filament() {
|
||||||
screen.filament_extruder = DGUS_Data::Extruder::CURRENT;
|
screen.filament_extruder = DGUS_Data::Extruder::CURRENT;
|
||||||
screen.filament_length = DGUS_DEFAULT_FILAMENT_LEN;
|
screen.filament_length = DGUS_DEFAULT_FILAMENT_LEN;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::Move() {
|
bool DGUSSetupHandler::move() {
|
||||||
screen.move_steps = DGUS_Data::StepSize::MM10;
|
screen.move_steps = DGUS_Data::StepSize::MM10;
|
||||||
|
|
||||||
if (!screen.isPrinterIdle()) {
|
if (!screen.isPrinterIdle()) {
|
||||||
@@ -170,7 +170,7 @@ bool DGUSSetupHandler::Move() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::Gcode() {
|
bool DGUSSetupHandler::gcode() {
|
||||||
ZERO(screen.gcode);
|
ZERO(screen.gcode);
|
||||||
|
|
||||||
if (dgus.gui_version < 0x30 || dgus.os_version < 0x21) {
|
if (dgus.gui_version < 0x30 || dgus.os_version < 0x21) {
|
||||||
@@ -181,14 +181,14 @@ bool DGUSSetupHandler::Gcode() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::PID() {
|
bool DGUSSetupHandler::pid() {
|
||||||
screen.pid_heater = DGUS_Data::Heater::H0;
|
screen.pid_heater = DGUS_Data::Heater::H0;
|
||||||
screen.pid_temp = DGUS_PLA_TEMP_HOTEND;
|
screen.pid_temp = DGUS_PLA_TEMP_HOTEND;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DGUSSetupHandler::Infos() {
|
bool DGUSSetupHandler::infos() {
|
||||||
screen.debug_count = 0;
|
screen.debug_count = 0;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@@ -24,19 +24,19 @@
|
|||||||
namespace DGUSSetupHandler {
|
namespace DGUSSetupHandler {
|
||||||
|
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
bool Print();
|
bool print();
|
||||||
#endif
|
#endif
|
||||||
bool PrintStatus();
|
bool printStatus();
|
||||||
bool PrintAdjust();
|
bool printAdjust();
|
||||||
bool LevelingMenu();
|
bool levelingMenu();
|
||||||
bool LevelingOffset();
|
bool levelingOffset();
|
||||||
bool LevelingManual();
|
bool levelingManual();
|
||||||
bool LevelingAutomatic();
|
bool levelingAutomatic();
|
||||||
bool LevelingProbing();
|
bool levelingProbing();
|
||||||
bool Filament();
|
bool filament();
|
||||||
bool Move();
|
bool move();
|
||||||
bool Gcode();
|
bool gcode();
|
||||||
bool PID();
|
bool pid();
|
||||||
bool Infos();
|
bool infos();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -34,20 +34,20 @@
|
|||||||
|
|
||||||
const struct DGUS_ScreenSetup screen_setup_list[] PROGMEM = {
|
const struct DGUS_ScreenSetup screen_setup_list[] PROGMEM = {
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::Print),
|
SETUP_HELPER(DGUS_ScreenID::PRINT, &DGUSSetupHandler::print),
|
||||||
#endif
|
#endif
|
||||||
SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::PrintStatus),
|
SETUP_HELPER(DGUS_ScreenID::PRINT_STATUS, &DGUSSetupHandler::printStatus),
|
||||||
SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::PrintAdjust),
|
SETUP_HELPER(DGUS_ScreenID::PRINT_ADJUST, &DGUSSetupHandler::printAdjust),
|
||||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::LevelingMenu),
|
SETUP_HELPER(DGUS_ScreenID::LEVELING_MENU, &DGUSSetupHandler::levelingMenu),
|
||||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::LevelingOffset),
|
SETUP_HELPER(DGUS_ScreenID::LEVELING_OFFSET, &DGUSSetupHandler::levelingOffset),
|
||||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::LevelingManual),
|
SETUP_HELPER(DGUS_ScreenID::LEVELING_MANUAL, &DGUSSetupHandler::levelingManual),
|
||||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::LevelingAutomatic),
|
SETUP_HELPER(DGUS_ScreenID::LEVELING_AUTOMATIC, &DGUSSetupHandler::levelingAutomatic),
|
||||||
SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::LevelingProbing),
|
SETUP_HELPER(DGUS_ScreenID::LEVELING_PROBING, &DGUSSetupHandler::levelingProbing),
|
||||||
SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::Filament),
|
SETUP_HELPER(DGUS_ScreenID::FILAMENT, &DGUSSetupHandler::filament),
|
||||||
SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::Move),
|
SETUP_HELPER(DGUS_ScreenID::MOVE, &DGUSSetupHandler::move),
|
||||||
SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::Gcode),
|
SETUP_HELPER(DGUS_ScreenID::GCODE, &DGUSSetupHandler::gcode),
|
||||||
SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::PID),
|
SETUP_HELPER(DGUS_ScreenID::PID, &DGUSSetupHandler::pid),
|
||||||
SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::Infos),
|
SETUP_HELPER(DGUS_ScreenID::INFOS, &DGUSSetupHandler::infos),
|
||||||
|
|
||||||
SETUP_HELPER((DGUS_ScreenID)0, nullptr)
|
SETUP_HELPER((DGUS_ScreenID)0, nullptr)
|
||||||
};
|
};
|
||||||
|
@@ -50,7 +50,7 @@ namespace ExtUI {
|
|||||||
screen.printerKilled(error, component);
|
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 onMediaError() { TERN_(HAS_MEDIA, screen.sdCardError()); }
|
||||||
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
void onMediaRemoved() { TERN_(HAS_MEDIA, screen.sdCardRemoved()); }
|
||||||
|
|
||||||
|
@@ -37,29 +37,29 @@
|
|||||||
TFT SPI_TFT;
|
TFT SPI_TFT;
|
||||||
|
|
||||||
// use SPI1 for the spi tft.
|
// use SPI1 for the spi tft.
|
||||||
void TFT::spi_init(uint8_t spiRate) {
|
void TFT::spiInit(uint8_t spiRate) {
|
||||||
tftio.Init();
|
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;
|
if ((x > 480) || (y > 320)) return;
|
||||||
|
|
||||||
setWindow(x, y, 1, 1);
|
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) {
|
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));
|
tftio.set_window(x, y, (x + with - 1), (y + height - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT::LCD_init() {
|
void TFT::lcdInit() {
|
||||||
tftio.InitTFT();
|
tftio.initTFT();
|
||||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||||
OUT_WRITE(TFT_BACKLIGHT_PIN, LOW);
|
OUT_WRITE(TFT_BACKLIGHT_PIN, LOW);
|
||||||
#endif
|
#endif
|
||||||
delay(100);
|
delay(100);
|
||||||
LCD_clear(0x0000);
|
lcdClear(0x0000);
|
||||||
LCD_Draw_Logo();
|
lcdDrawLogo();
|
||||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||||
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
OUT_WRITE(TFT_BACKLIGHT_PIN, HIGH);
|
||||||
#endif
|
#endif
|
||||||
@@ -68,17 +68,17 @@ void TFT::LCD_init() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void TFT::LCD_clear(uint16_t color) {
|
void TFT::lcdClear(uint16_t color) {
|
||||||
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
|
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
|
#if HAS_LOGO_IN_FLASH
|
||||||
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
|
setWindow(0, 0, TFT_WIDTH, TFT_HEIGHT);
|
||||||
for (uint16_t i = 0; i < (TFT_HEIGHT); i++) {
|
for (uint16_t i = 0; i < (TFT_HEIGHT); i++) {
|
||||||
Pic_Logo_Read((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2);
|
picLogoRead((uint8_t *)"", (uint8_t *)bmp_public_buf, (TFT_WIDTH) * 2);
|
||||||
tftio.WriteSequence((uint16_t *)bmp_public_buf, TFT_WIDTH);
|
tftio.writeSequence((uint16_t *)bmp_public_buf, TFT_WIDTH);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@@ -27,12 +27,12 @@
|
|||||||
class TFT {
|
class TFT {
|
||||||
public:
|
public:
|
||||||
TFT_IO tftio;
|
TFT_IO tftio;
|
||||||
void spi_init(uint8_t spiRate);
|
void spiInit(uint8_t spiRate);
|
||||||
void SetPoint(uint16_t x, uint16_t y, uint16_t point);
|
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 setWindow(uint16_t x, uint16_t y, uint16_t with, uint16_t height);
|
||||||
void LCD_init();
|
void lcdInit();
|
||||||
void LCD_clear(uint16_t color);
|
void lcdClear(uint16_t color);
|
||||||
void LCD_Draw_Logo();
|
void lcdDrawLogo();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern TFT SPI_TFT;
|
extern TFT SPI_TFT;
|
||||||
|
@@ -35,7 +35,7 @@ static lv_obj_t *scr;
|
|||||||
|
|
||||||
void lv_draw_error_message(FSTR_P const fmsg) {
|
void lv_draw_error_message(FSTR_P const fmsg) {
|
||||||
FSTR_P fhalted = F("PRINTER HALTED"), fplease = F("Please Reset");
|
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);
|
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(fhalted)) * 16) / 2, 140, fhalted, 0xFFFF, 0x0000);
|
||||||
disp_string((TFT_WIDTH - strlen_P(FTOP(fplease)) * 16) / 2, 180, fplease, 0xFFFF, 0x0000);
|
disp_string((TFT_WIDTH - strlen_P(FTOP(fplease)) * 16) / 2, 180, fplease, 0xFFFF, 0x0000);
|
||||||
|
@@ -47,9 +47,9 @@ enum {
|
|||||||
|
|
||||||
static void drawCross(uint16_t x, uint16_t y, uint16_t color) {
|
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.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.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() {
|
void lv_update_touch_calibration_screen() {
|
||||||
|
@@ -631,7 +631,7 @@ char *creat_title_text() {
|
|||||||
p_index = (uint16_t *)(&bmp_public_buf[i]);
|
p_index = (uint16_t *)(&bmp_public_buf[i]);
|
||||||
if (*p_index == 0x0000) *p_index = LV_COLOR_BACKGROUND.full;
|
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
|
#if HAS_BAK_VIEW_IN_FLASH
|
||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
|
if (row < 20) W25QXX.SPI_FLASH_SectorErase(BAK_VIEW_ADDR_TFT35 + row * 4096);
|
||||||
@@ -692,7 +692,7 @@ char *creat_title_text() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
SPI_TFT.setWindow(xpos_pixel, y_off * 20 + ypos_pixel, 200, 20); // 200*200
|
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++;
|
y_off++;
|
||||||
}
|
}
|
||||||
|
@@ -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++) {
|
for (uint16_t i = 0; i < 24; i++) {
|
||||||
const uint16_t tmp_char = pgm_read_word(&ASCII_Table_16x24[((c - 0x20) * 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++)
|
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() {
|
void disp_assets_update() {
|
||||||
SPI_TFT.LCD_clear(0x0000);
|
SPI_TFT.lcdClear(0x0000);
|
||||||
disp_string(100, 140, F("Assets Updating..."), 0xFFFF, 0x0000);
|
disp_string(100, 140, F("Assets Updating..."), 0xFFFF, 0x0000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -291,7 +291,7 @@ void spiFlashErase_PIC() {
|
|||||||
|
|
||||||
uint32_t LogoWrite_Addroffset = 0;
|
uint32_t LogoWrite_Addroffset = 0;
|
||||||
|
|
||||||
uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) {
|
uint8_t picLogoWrite(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWriteSize) {
|
||||||
if (LogoWriteSize <= 0) return 0;
|
if (LogoWriteSize <= 0) return 0;
|
||||||
|
|
||||||
W25QXX.SPI_FLASH_BufferWrite(Logo_Wbuff, PIC_LOGO_ADDR + LogoWrite_Addroffset, LogoWriteSize);
|
W25QXX.SPI_FLASH_BufferWrite(Logo_Wbuff, PIC_LOGO_ADDR + LogoWrite_Addroffset, LogoWriteSize);
|
||||||
@@ -308,7 +308,7 @@ uint8_t Pic_Logo_Write(uint8_t *LogoName, uint8_t *Logo_Wbuff, uint32_t LogoWrit
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t TitleLogoWrite_Addroffset = 0;
|
uint32_t TitleLogoWrite_Addroffset = 0;
|
||||||
uint8_t Pic_TitleLogo_Write(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) {
|
uint8_t picTitleLogoWrite(uint8_t *TitleLogoName, uint8_t *TitleLogo_Wbuff, uint32_t TitleLogoWriteSize) {
|
||||||
if (TitleLogoWriteSize <= 0)
|
if (TitleLogoWriteSize <= 0)
|
||||||
return 0;
|
return 0;
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
|
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;
|
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;
|
uint8_t pic_counter = 0;
|
||||||
uint32_t Pic_SaveAddr;
|
uint32_t picSaveAddr;
|
||||||
uint32_t Pic_SizeSaveAddr;
|
uint32_t Pic_SizeSaveAddr;
|
||||||
uint32_t Pic_NameSaveAddr;
|
uint32_t picNameSaveAddr;
|
||||||
uint8_t Pname_temp;
|
uint8_t pNameTemp;
|
||||||
uint32_t i, j;
|
uint32_t i, j;
|
||||||
uint32_t name_len = 0;
|
uint32_t name_len = 0;
|
||||||
uint32_t SaveName_len = 0;
|
uint32_t saveNameLen = 0;
|
||||||
union union32 size_tmp;
|
union union32 size_tmp;
|
||||||
|
|
||||||
W25QXX.SPI_FLASH_BufferRead(&pic_counter, PIC_COUNTER_ADDR, 1);
|
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;
|
pic_counter = 0;
|
||||||
|
|
||||||
if ((DeviceCode == 0x9488) || (DeviceCode == 0x5761))
|
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
|
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++) {
|
for (j = 0; j < pic_counter; j++) {
|
||||||
do {
|
do {
|
||||||
W25QXX.SPI_FLASH_BufferRead(&Pname_temp, PIC_NAME_ADDR + SaveName_len, 1);
|
W25QXX.SPI_FLASH_BufferRead(&pNameTemp, PIC_NAME_ADDR + saveNameLen, 1);
|
||||||
SaveName_len++;
|
saveNameLen++;
|
||||||
} while (Pname_temp != '\0');
|
} while (pNameTemp != '\0');
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((*(P_name + 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++;
|
name_len++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pic_NameSaveAddr = PIC_NAME_ADDR + SaveName_len;
|
picNameSaveAddr = PIC_NAME_ADDR + saveNameLen;
|
||||||
W25QXX.SPI_FLASH_BufferWrite(P_name, Pic_NameSaveAddr, name_len + 1);
|
W25QXX.SPI_FLASH_BufferWrite(P_name, picNameSaveAddr, name_len + 1);
|
||||||
Pic_SizeSaveAddr = PIC_SIZE_ADDR + 4 * pic_counter;
|
Pic_SizeSaveAddr = PIC_SIZE_ADDR + 4 * pic_counter;
|
||||||
size_tmp.dwords = P_size;
|
size_tmp.dwords = P_size;
|
||||||
W25QXX.SPI_FLASH_BufferWrite(size_tmp.bytes, Pic_SizeSaveAddr, 4);
|
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_SectorErase(PIC_COUNTER_ADDR);
|
||||||
W25QXX.SPI_FLASH_BufferWrite(&pic_counter, PIC_COUNTER_ADDR, 1);
|
W25QXX.SPI_FLASH_BufferWrite(&pic_counter, PIC_COUNTER_ADDR, 1);
|
||||||
|
|
||||||
return Pic_SaveAddr;
|
return picSaveAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAS_MEDIA
|
#if HAS_MEDIA
|
||||||
@@ -430,14 +430,14 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
|
|||||||
do {
|
do {
|
||||||
hal.watchdog_refresh();
|
hal.watchdog_refresh();
|
||||||
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
||||||
Pic_Logo_Write((uint8_t*)fn, public_buf, pbr);
|
picLogoWrite((uint8_t*)fn, public_buf, pbr);
|
||||||
} while (pbr >= BMP_WRITE_BUF_LEN);
|
} while (pbr >= BMP_WRITE_BUF_LEN);
|
||||||
}
|
}
|
||||||
else if (assetType == ASSET_TYPE_TITLE_LOGO) {
|
else if (assetType == ASSET_TYPE_TITLE_LOGO) {
|
||||||
do {
|
do {
|
||||||
hal.watchdog_refresh();
|
hal.watchdog_refresh();
|
||||||
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
pbr = file.read(public_buf, BMP_WRITE_BUF_LEN);
|
||||||
Pic_TitleLogo_Write((uint8_t*)fn, public_buf, pbr);
|
picTitleLogoWrite((uint8_t*)fn, public_buf, pbr);
|
||||||
} while (pbr >= BMP_WRITE_BUF_LEN);
|
} while (pbr >= BMP_WRITE_BUF_LEN);
|
||||||
}
|
}
|
||||||
else if (assetType == ASSET_TYPE_G_PREVIEW) {
|
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);
|
} while (pbr >= BMP_WRITE_BUF_LEN);
|
||||||
}
|
}
|
||||||
else if (assetType == ASSET_TYPE_ICON) {
|
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);
|
SPIFlash.beginWrite(Pic_Write_Addr);
|
||||||
#if HAS_SPI_FLASH_COMPRESSION
|
#if HAS_SPI_FLASH_COMPRESSION
|
||||||
do {
|
do {
|
||||||
@@ -550,7 +550,7 @@ uint32_t Pic_Info_Write(uint8_t *P_name, uint32_t P_size) {
|
|||||||
|
|
||||||
#endif // HAS_MEDIA
|
#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 i, j;
|
||||||
uint8_t Pic_cnt;
|
uint8_t Pic_cnt;
|
||||||
uint32_t tmp_cnt = 0;
|
uint32_t tmp_cnt = 0;
|
||||||
@@ -596,7 +596,7 @@ void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint32_t logo_addroffset = 0;
|
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.init(SPI_QUARTER_SPEED);
|
||||||
W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
|
W25QXX.SPI_FLASH_BufferRead(Logo_Rbuff, PIC_LOGO_ADDR + logo_addroffset, LogoReadsize);
|
||||||
logo_addroffset += LogoReadsize;
|
logo_addroffset += LogoReadsize;
|
||||||
|
@@ -154,8 +154,8 @@ typedef struct pic_msg PIC_MSG;
|
|||||||
#define PIC_SIZE_xM 6
|
#define PIC_SIZE_xM 6
|
||||||
#define FONT_SIZE_xM 2
|
#define FONT_SIZE_xM 2
|
||||||
|
|
||||||
void Pic_Read(uint8_t *Pname, uint8_t *P_Rbuff);
|
void picRead(uint8_t *Pname, uint8_t *P_Rbuff);
|
||||||
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);
|
||||||
void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
|
void lv_pic_test(uint8_t *P_Rbuff, uint32_t addr, uint32_t size);
|
||||||
uint32_t lv_get_pic_addr(uint8_t *Pname);
|
uint32_t lv_get_pic_addr(uint8_t *Pname);
|
||||||
void get_spi_flash_data(const char *rec_buf, int offset, int size);
|
void get_spi_flash_data(const char *rec_buf, int offset, int size);
|
||||||
|
@@ -129,8 +129,8 @@ void tft_lvgl_init() {
|
|||||||
hal.watchdog_refresh(); // LVGL init takes time
|
hal.watchdog_refresh(); // LVGL init takes time
|
||||||
|
|
||||||
// Init TFT first!
|
// Init TFT first!
|
||||||
SPI_TFT.spi_init(SPI_FULL_SPEED);
|
SPI_TFT.spiInit(SPI_FULL_SPEED);
|
||||||
SPI_TFT.LCD_init();
|
SPI_TFT.lcdInit();
|
||||||
|
|
||||||
hal.watchdog_refresh(); // LVGL init takes time
|
hal.watchdog_refresh(); // LVGL init takes time
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ void tft_lvgl_init() {
|
|||||||
TERN_(MKS_TEST, mks_test_get());
|
TERN_(MKS_TEST, mks_test_get());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
touch.Init();
|
touch.init();
|
||||||
|
|
||||||
lv_init();
|
lv_init();
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ void dmc_tc_handler(struct __DMA_HandleTypeDef * hdma) {
|
|||||||
#if ENABLED(USE_SPI_DMA_TC)
|
#if ENABLED(USE_SPI_DMA_TC)
|
||||||
lv_disp_flush_ready(disp_drv_p);
|
lv_disp_flush_ready(disp_drv_p);
|
||||||
lcd_dma_trans_lock = false;
|
lcd_dma_trans_lock = false;
|
||||||
TFT_SPI::Abort();
|
TFT_SPI::abort();
|
||||||
#endif
|
#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)
|
#if ENABLED(USE_SPI_DMA_TC)
|
||||||
lcd_dma_trans_lock = true;
|
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;
|
TFT_SPI::DMAtx.XferCpltCallback = dmc_tc_handler;
|
||||||
#else
|
#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
|
lv_disp_flush_ready(disp_drv_p); // Indicate you are ready with the flushing
|
||||||
#endif
|
#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;
|
width = x2 - x1 + 1;
|
||||||
height = y2 - y1 + 1;
|
height = y2 - y1 + 1;
|
||||||
SPI_TFT.setWindow((uint16_t)x1, (uint16_t)y1, width, height);
|
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);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -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_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);
|
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 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_setWindowArea(uint16_t StartX, uint16_t StartY, uint16_t width, uint16_t height);
|
||||||
void LCD_WriteRAM_Prepare();
|
void LCD_WriteRAM_Prepare();
|
||||||
|
@@ -55,7 +55,7 @@
|
|||||||
#define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH);
|
#define WIFI_IO1_SET() WRITE(WIFI_IO1_PIN, HIGH);
|
||||||
#define WIFI_IO1_RESET() WRITE(WIFI_IO1_PIN, LOW);
|
#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 commands_in_queue;
|
||||||
extern uint8_t sel_id;
|
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) {
|
else if (gCfgItems.fileSysType == FILE_SYS_USB) {
|
||||||
// udisk
|
// udisk
|
||||||
}
|
}
|
||||||
Explore_Disk(path, 0, with_longnames);
|
exploreDisk(path, 0, with_longnames);
|
||||||
}
|
}
|
||||||
|
|
||||||
char wait_ip_back_flag = 0;
|
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;
|
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];
|
char Fstream[200];
|
||||||
|
|
||||||
if (!path) return 0;
|
if (!path) return 0;
|
||||||
@@ -1805,7 +1805,7 @@ void stopEspTransfer() {
|
|||||||
W25QXX.init(SPI_QUARTER_SPEED);
|
W25QXX.init(SPI_QUARTER_SPEED);
|
||||||
|
|
||||||
// ?? Workaround for SPI / Servo issues ??
|
// ?? 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_SERVOS, servo_init());
|
||||||
TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init());
|
TERN_(HAS_Z_SERVO_PROBE, probe.servo_probe_init());
|
||||||
|
|
||||||
|
@@ -1179,7 +1179,7 @@ void MarlinUI::init() {
|
|||||||
run_current_screen();
|
run_current_screen();
|
||||||
|
|
||||||
// Apply all DWIN drawing after processing
|
// Apply all DWIN drawing after processing
|
||||||
TERN_(IS_DWIN_MARLINUI, DWIN_UpdateLCD());
|
TERN_(IS_DWIN_MARLINUI, dwinUpdateLCD());
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1609,9 +1609,9 @@ void MarlinUI::init() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onStatusChanged(status_message));
|
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_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)
|
#if ENABLED(STATUS_MESSAGE_SCROLLING)
|
||||||
|
@@ -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++) {
|
for (uint16_t i = 0 ; *(string + i) ; i++) {
|
||||||
glyph_t *pGlyph = glyph(string + i);
|
glyph_t *pGlyph = glyph(string + i);
|
||||||
if (stringWidth + pGlyph->BBXWidth > maxWidth) break;
|
if (stringWidth + pGlyph->bbxWidth > maxWidth) break;
|
||||||
switch (getFontType()) {
|
switch (getFontType()) {
|
||||||
case FONT_MARLIN_GLYPHS_1BPP:
|
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;
|
break;
|
||||||
case FONT_MARLIN_GLYPHS_2BPP:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
stringWidth += pGlyph->DWidth;
|
stringWidth += pGlyph->dWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,8 +33,8 @@
|
|||||||
uint16_t TFT::buffer[];
|
uint16_t TFT::buffer[];
|
||||||
|
|
||||||
void TFT::init() {
|
void TFT::init() {
|
||||||
io.Init();
|
io.init();
|
||||||
io.InitTFT();
|
io.initTFT();
|
||||||
}
|
}
|
||||||
|
|
||||||
TFT tft;
|
TFT tft;
|
||||||
|
@@ -69,9 +69,9 @@ class TFT {
|
|||||||
static void add_glyphs(const uint8_t *Font) { string.add_glyphs(Font); }
|
static void add_glyphs(const uint8_t *Font) { string.add_glyphs(Font); }
|
||||||
|
|
||||||
static bool is_busy() { return io.isBusy(); }
|
static bool is_busy() { return io.isBusy(); }
|
||||||
static void abort() { io.Abort(); }
|
static void abort() { io.abort(); }
|
||||||
static void write_multiple(uint16_t Data, uint16_t Count) { io.WriteMultipleDMA(Data, Count); }
|
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 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 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); }
|
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); }
|
||||||
|
@@ -59,11 +59,11 @@ void TFT_String::set_font(const uint8_t *font) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
DEBUG_ECHOLNPGM("Format: ", ((unifont_t *)font_header)->Format);
|
DEBUG_ECHOLNPGM("Format: ", ((unifont_t *)font_header)->Format);
|
||||||
DEBUG_ECHOLNPGM("CapitalAHeight: ", ((unifont_t *)font_header)->CapitalAHeight);
|
DEBUG_ECHOLNPGM("capitalAHeight: ", ((unifont_t *)font_header)->capitalAHeight);
|
||||||
DEBUG_ECHOLNPGM("FontStartEncoding: ", ((unifont_t *)font_header)->FontStartEncoding);
|
DEBUG_ECHOLNPGM("fontStartEncoding: ", ((unifont_t *)font_header)->fontStartEncoding);
|
||||||
DEBUG_ECHOLNPGM("FontEndEncoding: ", ((unifont_t *)font_header)->FontEndEncoding);
|
DEBUG_ECHOLNPGM("fontEndEncoding: ", ((unifont_t *)font_header)->fontEndEncoding);
|
||||||
DEBUG_ECHOLNPGM("FontAscent: ", ((unifont_t *)font_header)->FontAscent);
|
DEBUG_ECHOLNPGM("fontAscent: ", ((unifont_t *)font_header)->fontAscent);
|
||||||
DEBUG_ECHOLNPGM("FontDescent: ", ((unifont_t *)font_header)->FontDescent);
|
DEBUG_ECHOLNPGM("fontDescent: ", ((unifont_t *)font_header)->fontDescent);
|
||||||
|
|
||||||
add_glyphs(font);
|
add_glyphs(font);
|
||||||
}
|
}
|
||||||
@@ -72,15 +72,15 @@ void TFT_String::add_glyphs(const uint8_t *font) {
|
|||||||
uint16_t unicode, fontStartEncoding, fontEndEncoding;
|
uint16_t unicode, fontStartEncoding, fontEndEncoding;
|
||||||
uint8_t *pointer;
|
uint8_t *pointer;
|
||||||
|
|
||||||
fontStartEncoding = ((unifont_t *)font)->FontStartEncoding;
|
fontStartEncoding = ((unifont_t *)font)->fontStartEncoding;
|
||||||
fontEndEncoding = ((unifont_t *)font)->FontEndEncoding;
|
fontEndEncoding = ((unifont_t *)font)->fontEndEncoding;
|
||||||
pointer = (uint8_t *)font + sizeof(unifont_t);
|
pointer = (uint8_t *)font + sizeof(unifont_t);
|
||||||
|
|
||||||
if (fontEndEncoding < 0x0100) { // base and symbol fonts
|
if (fontEndEncoding < 0x0100) { // base and symbol fonts
|
||||||
for (unicode = fontStartEncoding; unicode <= fontEndEncoding; unicode++) {
|
for (unicode = fontStartEncoding; unicode <= fontEndEncoding; unicode++) {
|
||||||
if (*pointer != NO_GLYPH) {
|
if (*pointer != NO_GLYPH) {
|
||||||
glyphs[unicode] = (glyph_t *)pointer;
|
glyphs[unicode] = (glyph_t *)pointer;
|
||||||
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->DataSize;
|
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->dataSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pointer++;
|
pointer++;
|
||||||
@@ -98,7 +98,7 @@ void TFT_String::add_glyphs(const uint8_t *font) {
|
|||||||
}
|
}
|
||||||
if (*pointer != NO_GLYPH) {
|
if (*pointer != NO_GLYPH) {
|
||||||
glyphs_extra[unicode - fontStartEncoding] = pointer;
|
glyphs_extra[unicode - fontStartEncoding] = pointer;
|
||||||
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->DataSize;
|
pointer += sizeof(glyph_t) + ((glyph_t *)pointer)->dataSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pointer++;
|
pointer++;
|
||||||
@@ -112,7 +112,7 @@ void TFT_String::add_glyphs(const uint8_t *font) {
|
|||||||
}
|
}
|
||||||
glyphs_extra[i] = pointer;
|
glyphs_extra[i] = pointer;
|
||||||
unicode = *(uint16_t *) 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;
|
extra_count = i + 1;
|
||||||
if (unicode == fontEndEncoding)
|
if (unicode == fontEndEncoding)
|
||||||
break;
|
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 (character < 0x00ff) return glyphs[character] ?: glyphs['?']; /* Use '?' for unknown glyphs */
|
||||||
|
|
||||||
#if EXTRA_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 ((font_header_extra->Format & 0xF0) == FONT_MARLIN_GLYPHS) {
|
||||||
if (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];
|
return (glyph_t *)glyphs_extra[character - font_header_extra->fontStartEncoding];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if 0
|
#if 0
|
||||||
@@ -232,7 +232,7 @@ void TFT_String::add_character(const uint16_t character) {
|
|||||||
if (length < MAX_STRING_LENGTH) {
|
if (length < MAX_STRING_LENGTH) {
|
||||||
data[length] = character;
|
data[length] = character;
|
||||||
length++;
|
length++;
|
||||||
span += glyph(character)->DWidth;
|
span += glyph(character)->dWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ void TFT_String::rtrim(const uint16_t character) {
|
|||||||
while (length) {
|
while (length) {
|
||||||
if (data[length - 1] == 0x20 || data[length - 1] == character) {
|
if (data[length - 1] == 0x20 || data[length - 1] == character) {
|
||||||
length--;
|
length--;
|
||||||
span -= glyph(data[length])->DWidth;
|
span -= glyph(data[length])->dWidth;
|
||||||
eol();
|
eol();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -251,7 +251,7 @@ void TFT_String::rtrim(const uint16_t character) {
|
|||||||
void TFT_String::ltrim(const uint16_t character) {
|
void TFT_String::ltrim(const uint16_t character) {
|
||||||
uint16_t i, j;
|
uint16_t i, j;
|
||||||
for (i = 0; (i < length) && (data[i] == 0x20 || data[i] == character); i++) {
|
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;
|
if (i == 0) return;
|
||||||
for (j = 0; i < length; data[j++] = data[i++]);
|
for (j = 0; i < length; data[j++] = data[i++]);
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Marlin fonts with optional antialiasing. Fonts use unifont_t font header and glyph_t glyphs headers.
|
* 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
|
* Some glyphs may be left undefined with NO_GLYPH
|
||||||
*/
|
*/
|
||||||
#define FONT_MARLIN_GLYPHS 0x80
|
#define FONT_MARLIN_GLYPHS 0x80
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
*
|
*
|
||||||
* IMPORTANT NOTES:
|
* IMPORTANT NOTES:
|
||||||
* - glyphs fast search method REQUIRES glyphs to be ordered by unicode
|
* - 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 0xA0
|
||||||
#define FONT_MARLIN_HIEROGLYPHS_1BPP 0xA1
|
#define FONT_MARLIN_HIEROGLYPHS_1BPP 0xA1
|
||||||
@@ -146,22 +146,22 @@
|
|||||||
|
|
||||||
// TFT font with unicode support
|
// TFT font with unicode support
|
||||||
typedef struct __attribute__((__packed__)) {
|
typedef struct __attribute__((__packed__)) {
|
||||||
uint8_t Format;
|
uint8_t format;
|
||||||
uint8_t CapitalAHeight; // Not really needed, but helps with data alingment for uint16_t variables
|
uint8_t capitalAHeight; // Not really needed, but helps with data alignment for uint16_t variables
|
||||||
uint16_t FontStartEncoding;
|
uint16_t fontStartEncoding;
|
||||||
uint16_t FontEndEncoding;
|
uint16_t fontEndEncoding;
|
||||||
int8_t FontAscent;
|
int8_t fontAscent;
|
||||||
int8_t FontDescent;
|
int8_t fontDescent;
|
||||||
} unifont_t;
|
} unifont_t;
|
||||||
|
|
||||||
// TFT glyphs
|
// TFT glyphs
|
||||||
typedef struct __attribute__((__packed__)) {
|
typedef struct __attribute__((__packed__)) {
|
||||||
uint8_t BBXWidth;
|
uint8_t bbxWidth;
|
||||||
uint8_t BBXHeight;
|
uint8_t bbxHeight;
|
||||||
uint8_t DataSize;
|
uint8_t dataSize;
|
||||||
int8_t DWidth;
|
int8_t dWidth;
|
||||||
int8_t BBXOffsetX;
|
int8_t bbxOffsetX;
|
||||||
int8_t BBXOffsetY;
|
int8_t bbxOffsetY;
|
||||||
} glyph_t;
|
} glyph_t;
|
||||||
|
|
||||||
// unicode-prepended TFT glyphs
|
// unicode-prepended TFT glyphs
|
||||||
@@ -194,9 +194,9 @@ class TFT_String {
|
|||||||
static void set_font(const uint8_t *font);
|
static void set_font(const uint8_t *font);
|
||||||
static void add_glyphs(const uint8_t *font);
|
static void add_glyphs(const uint8_t *font);
|
||||||
|
|
||||||
static uint8_t font_type() { return font_header->Format; };
|
static uint8_t font_type() { return font_header->format; };
|
||||||
static uint16_t font_ascent() { return font_header->FontAscent; }
|
static uint16_t font_ascent() { return font_header->fontAscent; }
|
||||||
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(uint16_t character);
|
static glyph_t *glyph(uint16_t character);
|
||||||
static glyph_t *glyph(uint16_t *character) { return glyph(*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 *string() { return data; }
|
||||||
static uint16_t width() { return span; }
|
static uint16_t width() { return span; }
|
||||||
static uint16_t center(const uint16_t width) { return span > width ? 0 : (width - span) / 2; }
|
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;
|
extern TFT_String tft_string;
|
||||||
|
@@ -58,7 +58,7 @@ TouchControlType Touch::touch_control_type = NONE;
|
|||||||
void Touch::init() {
|
void Touch::init() {
|
||||||
TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset());
|
TERN_(TOUCH_SCREEN_CALIBRATION, touch_calibration.calibration_reset());
|
||||||
reset();
|
reset();
|
||||||
io.Init();
|
io.init();
|
||||||
TERN_(HAS_TOUCH_SLEEP, wakeUp());
|
TERN_(HAS_TOUCH_SLEEP, wakeUp());
|
||||||
enable();
|
enable();
|
||||||
}
|
}
|
||||||
|
@@ -118,27 +118,26 @@ void MarlinUI::draw_kill_screen() {
|
|||||||
tft.queue.sync();
|
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;
|
MarlinImage image = imgHotEnd;
|
||||||
uint16_t Color;
|
|
||||||
celsius_t currentTemperature, targetTemperature;
|
celsius_t currentTemperature, targetTemperature;
|
||||||
|
|
||||||
if (Heater >= 0) { // HotEnd
|
if (heater >= 0) { // HotEnd
|
||||||
#if HAS_EXTRUDERS
|
#if HAS_EXTRUDERS
|
||||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
currentTemperature = thermalManager.wholeDegHotend(heater);
|
||||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
targetTemperature = thermalManager.degTargetHotend(heater);
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (heater == H_BED) {
|
||||||
currentTemperature = thermalManager.wholeDegBed();
|
currentTemperature = thermalManager.wholeDegBed();
|
||||||
targetTemperature = thermalManager.degTargetBed();
|
targetTemperature = thermalManager.degTargetBed();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_CHAMBER
|
#if HAS_TEMP_CHAMBER
|
||||||
else if (Heater == H_CHAMBER) {
|
else if (heater == H_CHAMBER) {
|
||||||
currentTemperature = thermalManager.wholeDegChamber();
|
currentTemperature = thermalManager.wholeDegChamber();
|
||||||
#if HAS_HEATED_CHAMBER
|
#if HAS_HEATED_CHAMBER
|
||||||
targetTemperature = thermalManager.degTargetChamber();
|
targetTemperature = thermalManager.degTargetChamber();
|
||||||
@@ -148,54 +147,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_COOLER
|
#if HAS_TEMP_COOLER
|
||||||
else if (Heater == H_COOLER) {
|
else if (heater == H_COOLER) {
|
||||||
currentTemperature = thermalManager.wholeDegCooler();
|
currentTemperature = thermalManager.wholeDegCooler();
|
||||||
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else return;
|
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.canvas(x, y, 80, 120);
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
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 (heater >= 0) { // HotEnd
|
||||||
if (currentTemperature >= 50) Color = COLOR_HOTEND;
|
if (currentTemperature >= 50) color = COLOR_HOTEND;
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (heater == H_BED) {
|
||||||
if (currentTemperature >= 50) Color = COLOR_HEATED_BED;
|
if (currentTemperature >= 50) color = COLOR_HEATED_BED;
|
||||||
image = targetTemperature > 0 ? imgBedHeated : imgBed;
|
image = targetTemperature > 0 ? imgBedHeated : imgBed;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_CHAMBER
|
#if HAS_TEMP_CHAMBER
|
||||||
else if (Heater == H_CHAMBER) {
|
else if (heater == H_CHAMBER) {
|
||||||
if (currentTemperature >= 50) Color = COLOR_CHAMBER;
|
if (currentTemperature >= 50) color = COLOR_CHAMBER;
|
||||||
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
|
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_COOLER
|
#if HAS_TEMP_COOLER
|
||||||
else if (Heater == H_COOLER) {
|
else if (heater == H_COOLER) {
|
||||||
if (currentTemperature <= 26) Color = COLOR_COLD;
|
if (currentTemperature <= 26) color = COLOR_COLD;
|
||||||
if (currentTemperature > 26) Color = COLOR_RED;
|
if (currentTemperature > 26) color = COLOR_RED;
|
||||||
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
|
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tft.add_image(8, 28, image, Color);
|
tft.add_image(8, 28, image, color);
|
||||||
|
|
||||||
tft_string.set(i16tostr3rj(currentTemperature));
|
tft_string.set(i16tostr3rj(currentTemperature));
|
||||||
tft_string.add(LCD_STR_DEGREE);
|
tft_string.add(LCD_STR_DEGREE);
|
||||||
tft_string.trim();
|
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) {
|
if (targetTemperature >= 0) {
|
||||||
tft_string.set(i16tostr3rj(targetTemperature));
|
tft_string.set(i16tostr3rj(targetTemperature));
|
||||||
tft_string.add(LCD_STR_DEGREE);
|
tft_string.add(LCD_STR_DEGREE);
|
||||||
tft_string.trim();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -120,27 +120,26 @@ void MarlinUI::draw_kill_screen() {
|
|||||||
tft.queue.sync();
|
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;
|
MarlinImage image = imgHotEnd;
|
||||||
uint16_t Color;
|
|
||||||
celsius_t currentTemperature, targetTemperature;
|
celsius_t currentTemperature, targetTemperature;
|
||||||
|
|
||||||
if (Heater >= 0) { // HotEnd
|
if (heater >= 0) { // HotEnd
|
||||||
#if HAS_EXTRUDERS
|
#if HAS_EXTRUDERS
|
||||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
currentTemperature = thermalManager.wholeDegHotend(heater);
|
||||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
targetTemperature = thermalManager.degTargetHotend(heater);
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (heater == H_BED) {
|
||||||
currentTemperature = thermalManager.wholeDegBed();
|
currentTemperature = thermalManager.wholeDegBed();
|
||||||
targetTemperature = thermalManager.degTargetBed();
|
targetTemperature = thermalManager.degTargetBed();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_CHAMBER
|
#if HAS_TEMP_CHAMBER
|
||||||
else if (Heater == H_CHAMBER) {
|
else if (heater == H_CHAMBER) {
|
||||||
currentTemperature = thermalManager.wholeDegChamber();
|
currentTemperature = thermalManager.wholeDegChamber();
|
||||||
#if HAS_HEATED_CHAMBER
|
#if HAS_HEATED_CHAMBER
|
||||||
targetTemperature = thermalManager.degTargetChamber();
|
targetTemperature = thermalManager.degTargetChamber();
|
||||||
@@ -150,54 +149,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_COOLER
|
#if HAS_TEMP_COOLER
|
||||||
else if (Heater == H_COOLER) {
|
else if (heater == H_COOLER) {
|
||||||
currentTemperature = thermalManager.wholeDegCooler();
|
currentTemperature = thermalManager.wholeDegCooler();
|
||||||
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else return;
|
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.canvas(x, y, 64, 100);
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
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 (heater >= 0) { // HotEnd
|
||||||
if (currentTemperature >= 50) Color = COLOR_HOTEND;
|
if (currentTemperature >= 50) color = COLOR_HOTEND;
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (heater == H_BED) {
|
||||||
if (currentTemperature >= 50) Color = COLOR_HEATED_BED;
|
if (currentTemperature >= 50) color = COLOR_HEATED_BED;
|
||||||
image = targetTemperature > 0 ? imgBedHeated : imgBed;
|
image = targetTemperature > 0 ? imgBedHeated : imgBed;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_CHAMBER
|
#if HAS_TEMP_CHAMBER
|
||||||
else if (Heater == H_CHAMBER) {
|
else if (heater == H_CHAMBER) {
|
||||||
if (currentTemperature >= 50) Color = COLOR_CHAMBER;
|
if (currentTemperature >= 50) color = COLOR_CHAMBER;
|
||||||
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
|
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_COOLER
|
#if HAS_TEMP_COOLER
|
||||||
else if (Heater == H_COOLER) {
|
else if (heater == H_COOLER) {
|
||||||
if (currentTemperature <= 26) Color = COLOR_COLD;
|
if (currentTemperature <= 26) color = COLOR_COLD;
|
||||||
if (currentTemperature > 26) Color = COLOR_RED;
|
if (currentTemperature > 26) color = COLOR_RED;
|
||||||
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
|
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tft.add_image(0, 18, image, Color);
|
tft.add_image(0, 18, image, color);
|
||||||
|
|
||||||
tft_string.set(i16tostr3rj(currentTemperature));
|
tft_string.set(i16tostr3rj(currentTemperature));
|
||||||
tft_string.add(LCD_STR_DEGREE);
|
tft_string.add(LCD_STR_DEGREE);
|
||||||
tft_string.trim();
|
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) {
|
if (targetTemperature >= 0) {
|
||||||
tft_string.set(i16tostr3rj(targetTemperature));
|
tft_string.set(i16tostr3rj(targetTemperature));
|
||||||
tft_string.add(LCD_STR_DEGREE);
|
tft_string.add(LCD_STR_DEGREE);
|
||||||
tft_string.trim();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -118,27 +118,26 @@ void MarlinUI::draw_kill_screen() {
|
|||||||
tft.queue.sync();
|
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;
|
MarlinImage image = imgHotEnd;
|
||||||
uint16_t Color;
|
|
||||||
celsius_t currentTemperature, targetTemperature;
|
celsius_t currentTemperature, targetTemperature;
|
||||||
|
|
||||||
if (Heater >= 0) { // HotEnd
|
if (heater >= 0) { // HotEnd
|
||||||
#if HAS_EXTRUDERS
|
#if HAS_EXTRUDERS
|
||||||
currentTemperature = thermalManager.wholeDegHotend(Heater);
|
currentTemperature = thermalManager.wholeDegHotend(heater);
|
||||||
targetTemperature = thermalManager.degTargetHotend(Heater);
|
targetTemperature = thermalManager.degTargetHotend(heater);
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (heater == H_BED) {
|
||||||
currentTemperature = thermalManager.wholeDegBed();
|
currentTemperature = thermalManager.wholeDegBed();
|
||||||
targetTemperature = thermalManager.degTargetBed();
|
targetTemperature = thermalManager.degTargetBed();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_CHAMBER
|
#if HAS_TEMP_CHAMBER
|
||||||
else if (Heater == H_CHAMBER) {
|
else if (heater == H_CHAMBER) {
|
||||||
currentTemperature = thermalManager.wholeDegChamber();
|
currentTemperature = thermalManager.wholeDegChamber();
|
||||||
#if HAS_HEATED_CHAMBER
|
#if HAS_HEATED_CHAMBER
|
||||||
targetTemperature = thermalManager.degTargetChamber();
|
targetTemperature = thermalManager.degTargetChamber();
|
||||||
@@ -148,54 +147,54 @@ void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_COOLER
|
#if HAS_TEMP_COOLER
|
||||||
else if (Heater == H_COOLER) {
|
else if (heater == H_COOLER) {
|
||||||
currentTemperature = thermalManager.wholeDegCooler();
|
currentTemperature = thermalManager.wholeDegCooler();
|
||||||
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else return;
|
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.canvas(x, y, 80, 120);
|
||||||
tft.set_background(COLOR_BACKGROUND);
|
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 (heater >= 0) { // HotEnd
|
||||||
if (currentTemperature >= 50) Color = COLOR_HOTEND;
|
if (currentTemperature >= 50) color = COLOR_HOTEND;
|
||||||
}
|
}
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
else if (Heater == H_BED) {
|
else if (heater == H_BED) {
|
||||||
if (currentTemperature >= 50) Color = COLOR_HEATED_BED;
|
if (currentTemperature >= 50) color = COLOR_HEATED_BED;
|
||||||
image = targetTemperature > 0 ? imgBedHeated : imgBed;
|
image = targetTemperature > 0 ? imgBedHeated : imgBed;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_CHAMBER
|
#if HAS_TEMP_CHAMBER
|
||||||
else if (Heater == H_CHAMBER) {
|
else if (heater == H_CHAMBER) {
|
||||||
if (currentTemperature >= 50) Color = COLOR_CHAMBER;
|
if (currentTemperature >= 50) color = COLOR_CHAMBER;
|
||||||
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
|
image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if HAS_TEMP_COOLER
|
#if HAS_TEMP_COOLER
|
||||||
else if (Heater == H_COOLER) {
|
else if (heater == H_COOLER) {
|
||||||
if (currentTemperature <= 26) Color = COLOR_COLD;
|
if (currentTemperature <= 26) color = COLOR_COLD;
|
||||||
if (currentTemperature > 26) Color = COLOR_RED;
|
if (currentTemperature > 26) color = COLOR_RED;
|
||||||
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
|
image = targetTemperature > 26 ? imgCoolerHot : imgCooler;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tft.add_image(8, 28, image, Color);
|
tft.add_image(8, 28, image, color);
|
||||||
|
|
||||||
tft_string.set(i16tostr3rj(currentTemperature));
|
tft_string.set(i16tostr3rj(currentTemperature));
|
||||||
tft_string.add(LCD_STR_DEGREE);
|
tft_string.add(LCD_STR_DEGREE);
|
||||||
tft_string.trim();
|
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) {
|
if (targetTemperature >= 0) {
|
||||||
tft_string.set(i16tostr3rj(targetTemperature));
|
tft_string.set(i16tostr3rj(targetTemperature));
|
||||||
tft_string.add(LCD_STR_DEGREE);
|
tft_string.add(LCD_STR_DEGREE);
|
||||||
tft_string.trim();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@
|
|||||||
TFT_IO_DRIVER TFT_IO::io;
|
TFT_IO_DRIVER TFT_IO::io;
|
||||||
uint32_t TFT_IO::lcd_id = 0xFFFFFFFF;
|
uint32_t TFT_IO::lcd_id = 0xFFFFFFFF;
|
||||||
|
|
||||||
void TFT_IO::InitTFT() {
|
void TFT_IO::initTFT() {
|
||||||
if (lcd_id != 0xFFFFFFFF) return;
|
if (lcd_id != 0xFFFFFFFF) return;
|
||||||
|
|
||||||
#if PIN_EXISTS(TFT_BACKLIGHT)
|
#if PIN_EXISTS(TFT_BACKLIGHT)
|
||||||
@@ -81,7 +81,7 @@ void TFT_IO::InitTFT() {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// io.Init();
|
//io.init();
|
||||||
delay(100);
|
delay(100);
|
||||||
|
|
||||||
#if TFT_DRIVER != AUTO
|
#if TFT_DRIVER != AUTO
|
||||||
@@ -106,7 +106,7 @@ void TFT_IO::InitTFT() {
|
|||||||
write_esc_sequence(ili9488_init);
|
write_esc_sequence(ili9488_init);
|
||||||
#elif TFT_DRIVER == AUTO // autodetect
|
#elif TFT_DRIVER == AUTO // autodetect
|
||||||
|
|
||||||
lcd_id = io.GetID() & 0xFFFF;
|
lcd_id = io.getID() & 0xFFFF;
|
||||||
|
|
||||||
switch (lcd_id) {
|
switch (lcd_id) {
|
||||||
case LTDC_RGB:
|
case LTDC_RGB:
|
||||||
@@ -156,25 +156,25 @@ void TFT_IO::InitTFT() {
|
|||||||
#endif
|
#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
|
#ifdef OFFSET_X
|
||||||
Xmin += OFFSET_X; Xmax += OFFSET_X;
|
xMin += OFFSET_X; xMax += OFFSET_X;
|
||||||
#endif
|
#endif
|
||||||
#ifdef OFFSET_Y
|
#ifdef OFFSET_Y
|
||||||
Ymin += OFFSET_Y; Ymax += OFFSET_Y;
|
yMin += OFFSET_Y; yMax += OFFSET_Y;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (lcd_id) {
|
switch (lcd_id) {
|
||||||
case LTDC_RGB:
|
case LTDC_RGB:
|
||||||
io.WriteReg(0x01);
|
io.writeReg(0x01);
|
||||||
io.WriteData(Xmin);
|
io.writeData(xMin);
|
||||||
io.WriteReg(0x02);
|
io.writeReg(0x02);
|
||||||
io.WriteData(Xmax);
|
io.writeData(xMax);
|
||||||
io.WriteReg(0x03);
|
io.writeReg(0x03);
|
||||||
io.WriteData(Ymin);
|
io.writeData(yMin);
|
||||||
io.WriteReg(0x04);
|
io.writeReg(0x04);
|
||||||
io.WriteData(Ymax);
|
io.writeData(yMax);
|
||||||
io.WriteReg(0x00);
|
io.writeReg(0x00);
|
||||||
break;
|
break;
|
||||||
case ST7735: // ST7735 160x128
|
case ST7735: // ST7735 160x128
|
||||||
case ST7789: // ST7789V 320x240
|
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 ILI9488: // ILI9488 480x320
|
||||||
case SSD1963: // SSD1963
|
case SSD1963: // SSD1963
|
||||||
case ILI9488_ID1: // 0x8066 ILI9488 480x320
|
case ILI9488_ID1: // 0x8066 ILI9488 480x320
|
||||||
io.DataTransferBegin(DATASIZE_8BIT);
|
io.dataTransferBegin(DATASIZE_8BIT);
|
||||||
|
|
||||||
// CASET: Column Address Set
|
// CASET: Column Address Set
|
||||||
io.WriteReg(ILI9341_CASET);
|
io.writeReg(ILI9341_CASET);
|
||||||
io.WriteData((Xmin >> 8) & 0xFF);
|
io.writeData((xMin >> 8) & 0xFF);
|
||||||
io.WriteData(Xmin & 0xFF);
|
io.writeData(xMin & 0xFF);
|
||||||
io.WriteData((Xmax >> 8) & 0xFF);
|
io.writeData((xMax >> 8) & 0xFF);
|
||||||
io.WriteData(Xmax & 0xFF);
|
io.writeData(xMax & 0xFF);
|
||||||
|
|
||||||
// RASET: Row Address Set
|
// RASET: Row Address Set
|
||||||
io.WriteReg(ILI9341_PASET);
|
io.writeReg(ILI9341_PASET);
|
||||||
io.WriteData((Ymin >> 8) & 0xFF);
|
io.writeData((yMin >> 8) & 0xFF);
|
||||||
io.WriteData(Ymin & 0xFF);
|
io.writeData(yMin & 0xFF);
|
||||||
io.WriteData((Ymax >> 8) & 0xFF);
|
io.writeData((yMax >> 8) & 0xFF);
|
||||||
io.WriteData(Ymax & 0xFF);
|
io.writeData(yMax & 0xFF);
|
||||||
|
|
||||||
// RAMWR: Memory Write
|
// RAMWR: Memory Write
|
||||||
io.WriteReg(ILI9341_RAMWR);
|
io.writeReg(ILI9341_RAMWR);
|
||||||
break;
|
break;
|
||||||
case R61505: // R61505U 320x240
|
case R61505: // R61505U 320x240
|
||||||
case ILI9328: // ILI9328 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
|
// Mind the mess: with landscape screen orientation 'Horizontal' is Y and 'Vertical' is X
|
||||||
io.WriteReg(ILI9328_HASTART);
|
io.writeReg(ILI9328_HASTART);
|
||||||
io.WriteData(Ymin);
|
io.writeData(yMin);
|
||||||
io.WriteReg(ILI9328_HAEND);
|
io.writeReg(ILI9328_HAEND);
|
||||||
io.WriteData(Ymax);
|
io.writeData(yMax);
|
||||||
io.WriteReg(ILI9328_VASTART);
|
io.writeReg(ILI9328_VASTART);
|
||||||
io.WriteData(Xmin);
|
io.writeData(xMin);
|
||||||
io.WriteReg(ILI9328_VAEND);
|
io.writeReg(ILI9328_VAEND);
|
||||||
io.WriteData(Xmax);
|
io.writeData(xMax);
|
||||||
|
|
||||||
io.WriteReg(ILI9328_HASET);
|
io.writeReg(ILI9328_HASET);
|
||||||
io.WriteData(Ymin);
|
io.writeData(yMin);
|
||||||
io.WriteReg(ILI9328_VASET);
|
io.writeReg(ILI9328_VASET);
|
||||||
io.WriteData(Xmin);
|
io.writeData(xMin);
|
||||||
|
|
||||||
io.WriteReg(ILI9328_RAMWR);
|
io.writeReg(ILI9328_RAMWR);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
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;
|
uint16_t dataWidth, data;
|
||||||
|
|
||||||
dataWidth = *Sequence++;
|
dataWidth = *sequence++;
|
||||||
io.DataTransferBegin(dataWidth);
|
io.dataTransferBegin(dataWidth);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
data = *Sequence++;
|
data = *sequence++;
|
||||||
if (data != 0xFFFF) {
|
if (data != 0xFFFF) {
|
||||||
io.WriteData(data);
|
io.writeData(data);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
data = *Sequence++;
|
data = *sequence++;
|
||||||
if (data == 0x7FFF) break;
|
if (data == 0x7FFF) break;
|
||||||
if (data == 0xFFFF)
|
if (data == 0xFFFF)
|
||||||
io.WriteData(0xFFFF);
|
io.writeData(0xFFFF);
|
||||||
else if (data & 0x8000)
|
else if (data & 0x8000)
|
||||||
delay(data & 0x7FFF);
|
delay(data & 0x7FFF);
|
||||||
else if ((data & 0xFF00) == 0)
|
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
|
#endif // HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT
|
||||||
|
@@ -50,36 +50,36 @@ class TFT_IO {
|
|||||||
public:
|
public:
|
||||||
static TFT_IO_DRIVER io;
|
static TFT_IO_DRIVER io;
|
||||||
|
|
||||||
static void InitTFT();
|
static void initTFT();
|
||||||
static void set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax);
|
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 write_esc_sequence(const uint16_t *sequence);
|
||||||
|
|
||||||
// Deletaged methods
|
// Deletaged methods
|
||||||
inline static void Init() { io.Init(); }
|
inline static void init() { io.init(); }
|
||||||
inline static bool isBusy() { return io.isBusy(); }
|
inline static bool isBusy() { return io.isBusy(); }
|
||||||
inline static void Abort() { io.Abort(); }
|
inline static void abort() { io.abort(); }
|
||||||
inline static uint32_t GetID() { return io.GetID(); }
|
inline static uint32_t getID() { return io.getID(); }
|
||||||
|
|
||||||
inline static void DataTransferBegin(uint16_t DataWidth=DATASIZE_16BIT) { io.DataTransferBegin(DataWidth); }
|
inline static void dataTransferBegin(uint16_t dataWidth=DATASIZE_16BIT) { io.dataTransferBegin(dataWidth); }
|
||||||
inline static void DataTransferEnd() { io.DataTransferEnd(); }
|
inline static void dataTransferEnd() { io.dataTransferEnd(); }
|
||||||
|
|
||||||
inline static void WriteData(uint16_t Data) { io.WriteData(Data); }
|
inline static void writeData(uint16_t data) { io.writeData(data); }
|
||||||
inline static void WriteReg(uint16_t Reg) { io.WriteReg(Reg); }
|
inline static void writeReg(uint16_t reg) { io.writeReg(reg); }
|
||||||
|
|
||||||
// Blocking IO used by TFT_CLASSIC_UI and TFT_LVGL_UI
|
// Blocking IO used by TFT_CLASSIC_UI and TFT_LVGL_UI
|
||||||
// These functions start data transfer and WAIT for data transfer completion
|
// 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 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 writeMultiple(uint16_t color, uint32_t count) { io.writeMultiple(color, count); }
|
||||||
|
|
||||||
// Non-blocking DMA-based IO used by TFT_COLOR_UI only
|
// 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
|
// 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 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 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
|
// 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
|
// This function starts data transfer using DMA and does NOT wait for data transfer completion
|
||||||
#if ENABLED(USE_SPI_DMA_TC)
|
#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
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@@ -60,7 +60,7 @@
|
|||||||
TouchButtons touchBt;
|
TouchButtons touchBt;
|
||||||
|
|
||||||
void TouchButtons::init() {
|
void TouchButtons::init() {
|
||||||
touchIO.Init();
|
touchIO.init();
|
||||||
TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60));
|
TERN_(HAS_TOUCH_SLEEP, next_sleep_ms = millis() + SEC_TO_MS(ui.sleep_timeout_minutes * 60));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1607,8 +1607,8 @@ void MarlinSettings::postprocess() {
|
|||||||
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
#if ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
||||||
{
|
{
|
||||||
_FIELD_TEST(dwin_settings);
|
_FIELD_TEST(dwin_settings);
|
||||||
char dwin_settings[CrealityDWIN.eeprom_data_size] = { 0 };
|
char dwin_settings[crealityDWIN.eeprom_data_size] = { 0 };
|
||||||
CrealityDWIN.Save_Settings(dwin_settings);
|
crealityDWIN.saveSettings(dwin_settings);
|
||||||
EEPROM_WRITE(dwin_settings);
|
EEPROM_WRITE(dwin_settings);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -2661,10 +2661,10 @@ void MarlinSettings::postprocess() {
|
|||||||
}
|
}
|
||||||
#elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
|
#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);
|
_FIELD_TEST(dwin_settings);
|
||||||
EEPROM_READ(dwin_settings);
|
EEPROM_READ(dwin_settings);
|
||||||
if (!validating) CrealityDWIN.Load_Settings(dwin_settings);
|
if (!validating) crealityDWIN.loadSettings(dwin_settings);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -3147,7 +3147,7 @@ void MarlinSettings::reset() {
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TERN_(DWIN_CREALITY_LCD_JYERSUI, CrealityDWIN.Reset_Settings());
|
TERN_(DWIN_CREALITY_LCD_JYERSUI, crealityDWIN.resetSettings());
|
||||||
|
|
||||||
//
|
//
|
||||||
// Case Light Brightness
|
// Case Light Brightness
|
||||||
|
@@ -856,7 +856,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
|
#define MAX_CYCLE_TIME_PID_AUTOTUNE 20L
|
||||||
#endif
|
#endif
|
||||||
if ((ms - _MIN(t1, t2)) > (MAX_CYCLE_TIME_PID_AUTOTUNE * 60L * 1000L)) {
|
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_(DWIN_PID_TUNE, DWIN_PidTuning(PID_TUNING_TIMEOUT));
|
||||||
TERN_(EXTENSIBLE_UI, ExtUI::onPidTuning(ExtUI::result_t::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)));
|
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();
|
hal.idletask();
|
||||||
|
|
||||||
// Run UI update
|
// Run UI update
|
||||||
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
|
TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update());
|
||||||
}
|
}
|
||||||
wait_for_heatup = false;
|
wait_for_heatup = false;
|
||||||
|
|
||||||
@@ -1183,7 +1183,7 @@ volatile bool Temperature::raw_temps_ready = false;
|
|||||||
}
|
}
|
||||||
|
|
||||||
hal.idletask();
|
hal.idletask();
|
||||||
TERN(DWIN_CREALITY_LCD, DWIN_Update(), ui.update());
|
TERN(DWIN_CREALITY_LCD, dwinUpdate(), ui.update());
|
||||||
|
|
||||||
if (!wait_for_heatup) {
|
if (!wait_for_heatup) {
|
||||||
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED);
|
SERIAL_ECHOLNPGM(STR_MPC_AUTOTUNE_INTERRUPTED);
|
||||||
|
@@ -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_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_WRITE_TIMEOUT = 0x17, // Timeout occurred during write programming
|
||||||
SD_CARD_ERROR_SCK_RATE = 0x18, // Incorrect rate selected
|
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)
|
// 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_CARD_ERROR_READ_CRC = 0x1B // Invalid read CRC
|
||||||
} sd_error_code_t;
|
} sd_error_code_t;
|
||||||
|
@@ -621,7 +621,7 @@ void CardReader::startOrResumeFilePrinting() {
|
|||||||
//
|
//
|
||||||
void CardReader::endFilePrintNow(TERN_(SD_RESORT, const bool re_sort/*=false*/)) {
|
void CardReader::endFilePrintNow(TERN_(SD_RESORT, const bool re_sort/*=false*/)) {
|
||||||
TERN_(ADVANCED_PAUSE_FEATURE, did_pause_print = 0);
|
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;
|
flag.abort_sd_printing = false;
|
||||||
if (isFileOpen()) file.close();
|
if (isFileOpen()) file.close();
|
||||||
TERN_(SD_RESORT, if (re_sort) presort());
|
TERN_(SD_RESORT, if (re_sort) presort());
|
||||||
|
Reference in New Issue
Block a user