TFT_COLOR_UI async DMA SPI (#24980)

This commit is contained in:
Alexander Gavrilenko
2022-12-13 00:13:31 +03:00
committed by Scott Lahteine
parent d082223fee
commit ec6349f2ac
31 changed files with 500 additions and 227 deletions

View File

@ -65,9 +65,9 @@
#endif
#endif
#if TFT_BUFFER_SIZE > 65535
#if TFT_BUFFER_SIZE > DMA_MAX_SIZE
// DMA Count parameter is uint16_t
#error "TFT_BUFFER_SIZE can not exceed 65535"
#error "TFT_BUFFER_SIZE can not exceed DMA_MAX_SIZE"
#endif
class TFT {
@ -86,8 +86,8 @@ class TFT {
static bool is_busy() { return io.isBusy(); }
static void abort() { io.Abort(); }
static void write_multiple(uint16_t Data, uint16_t Count) { io.WriteMultiple(Data, Count); }
static void write_sequence(uint16_t *Data, uint16_t Count) { io.WriteSequence(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 set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ymax) { io.set_window(Xmin, Ymin, Xmax, Ymax); }
static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color) { queue.fill(x, y, width, height, color); }

View File

@ -86,9 +86,9 @@ void TFT_Queue::fill(queueTask_t *task) {
task->state = TASK_STATE_IN_PROGRESS;
}
if (task_parameters->count > 65535) {
count = 65535;
task_parameters->count -= 65535;
if (task_parameters->count > DMA_MAX_SIZE) {
count = DMA_MAX_SIZE;
task_parameters->count -= DMA_MAX_SIZE;
}
else {
count = task_parameters->count;

View File

@ -135,6 +135,7 @@ class TFT_Queue {
static void reset();
static void async();
static void sync() { while (current_task != nullptr) async(); }
static bool is_empty() { return current_task == nullptr; }
static void fill(uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t color);
static void canvas(uint16_t x, uint16_t y, uint16_t width, uint16_t height);

View File

@ -57,7 +57,8 @@ void MarlinUI::tft_idle() {
#endif
tft.queue.async();
TERN_(TOUCH_SCREEN, touch.idle());
TERN_(TOUCH_SCREEN, if (tft.queue.is_empty()) touch.idle()); // Touch driver is not DMA-aware, so only check for touch controls after screen drawing is completed
}
#if ENABLED(SHOW_BOOTSCREEN)
@ -325,7 +326,10 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(TOUCH_SCREEN)
add_control(900, y, menu_main, imgSettings);
TERN_(SDSUPPORT, add_control(12, y, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
#if ENABLED(SDSUPPORT)
const bool cm = card.isMounted(), pa = printingIsActive();
add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
#endif
#endif
y += 100;

View File

@ -57,7 +57,8 @@ void MarlinUI::tft_idle() {
#endif
tft.queue.async();
TERN_(TOUCH_SCREEN, touch.idle());
TERN_(TOUCH_SCREEN, if (tft.queue.is_empty()) touch.idle()); // Touch driver is not DMA-aware, so only check for touch controls after screen drawing is completed
}
#if ENABLED(SHOW_BOOTSCREEN)
@ -342,7 +343,10 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(TOUCH_SCREEN)
add_control(256, 130, menu_main, imgSettings);
TERN_(SDSUPPORT, add_control(0, 130, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
#if ENABLED(SDSUPPORT)
const bool cm = card.isMounted(), pa = printingIsActive();
add_control(0, 130, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
#endif
#endif
}

View File

@ -57,7 +57,8 @@ void MarlinUI::tft_idle() {
#endif
tft.queue.async();
TERN_(TOUCH_SCREEN, touch.idle());
TERN_(TOUCH_SCREEN, if (tft.queue.is_empty()) touch.idle()); // Touch driver is not DMA-aware, so only check for touch controls after screen drawing is completed
}
#if ENABLED(SHOW_BOOTSCREEN)
@ -319,7 +320,10 @@ void MarlinUI::draw_status_screen() {
#if ENABLED(TOUCH_SCREEN)
add_control(404, y, menu_main, imgSettings);
TERN_(SDSUPPORT, add_control(12, y, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
#if ENABLED(SDSUPPORT)
const bool cm = card.isMounted(), pa = printingIsActive();
add_control(12, y, menu_media, imgSD, cm && !pa, COLOR_CONTROL_ENABLED, cm && pa ? COLOR_BUSY : COLOR_CONTROL_DISABLED);
#endif
#endif
y += TERN(HAS_UI_480x272, 36, 44);