From b5ef6995233f4166a726bbda7d53aa9e2eecc472 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sat, 7 Nov 2020 16:20:19 -0600 Subject: [PATCH] TFT cleanup --- Marlin/src/HAL/STM32/tft/tft_fsmc.h | 20 +++++++++----------- Marlin/src/HAL/STM32F1/tft/tft_fsmc.h | 8 ++++---- Marlin/src/lcd/tft/ui_480x320.cpp | 14 +++++++------- Marlin/src/lcd/tft_io/ssd1963.h | 2 +- 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Marlin/src/HAL/STM32/tft/tft_fsmc.h b/Marlin/src/HAL/STM32/tft/tft_fsmc.h index cbec7613ef..e2e0128c5e 100644 --- a/Marlin/src/HAL/STM32/tft/tft_fsmc.h +++ b/Marlin/src/HAL/STM32/tft/tft_fsmc.h @@ -21,30 +21,28 @@ */ #pragma once +#include "../../../inc/MarlinConfig.h" + #ifdef STM32F1xx #include "stm32f1xx_hal.h" + #define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN) #elif defined(STM32F4xx) #include "stm32f4xx_hal.h" + #define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN) #else - #error FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware. + #error "FSMC TFT is currently only supported on STM32F1 and STM32F4 hardware." #endif #ifndef LCD_READ_ID - #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) + #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) #endif #ifndef LCD_READ_ID4 #define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341) #endif -#define DATASIZE_8BIT SPI_DATASIZE_8BIT -#define DATASIZE_16BIT SPI_DATASIZE_16BIT -#define TFT_IO_DRIVER TFT_FSMC - -#ifdef STM32F1xx - #define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CCR & DMA_CCR_EN) -#elif defined(STM32F4xx) - #define __IS_DMA_ENABLED(__HANDLE__) ((__HANDLE__)->Instance->CR & DMA_SxCR_EN) -#endif +#define DATASIZE_8BIT SPI_DATASIZE_8BIT +#define DATASIZE_16BIT SPI_DATASIZE_16BIT +#define TFT_IO_DRIVER TFT_FSMC typedef struct { __IO uint16_t REG; diff --git a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h index 11eb1ffa84..d9ee1f4c77 100644 --- a/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h +++ b/Marlin/src/HAL/STM32F1/tft/tft_fsmc.h @@ -22,7 +22,7 @@ #pragma once #ifndef LCD_READ_ID - #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) + #define LCD_READ_ID 0x04 // Read display identification information (0xD3 on ILI9341) #endif #ifndef LCD_READ_ID4 #define LCD_READ_ID4 0xD3 // Read display identification information (0xD3 on ILI9341) @@ -30,9 +30,9 @@ #include -#define DATASIZE_8BIT DMA_SIZE_8BITS -#define DATASIZE_16BIT DMA_SIZE_16BITS -#define TFT_IO_DRIVER TFT_FSMC +#define DATASIZE_8BIT DMA_SIZE_8BITS +#define DATASIZE_16BIT DMA_SIZE_16BITS +#define TFT_IO_DRIVER TFT_FSMC typedef struct { __IO uint16_t REG; diff --git a/Marlin/src/lcd/tft/ui_480x320.cpp b/Marlin/src/lcd/tft/ui_480x320.cpp index 9ba5c1b157..e2bbdcde7f 100644 --- a/Marlin/src/lcd/tft/ui_480x320.cpp +++ b/Marlin/src/lcd/tft/ui_480x320.cpp @@ -428,21 +428,21 @@ void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char* const valu extern screenFunc_t _manual_move_func_ptr; if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) { - #define SLIDER_LENGHT 336 + #define SLIDER_LENGTH 336 #define SLIDER_Y_POSITION 186 - tft.canvas((TFT_WIDTH - SLIDER_LENGHT) / 2, SLIDER_Y_POSITION, SLIDER_LENGHT, 16); + tft.canvas((TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION, SLIDER_LENGTH, 16); tft.set_background(COLOR_BACKGROUND); - int16_t position = (SLIDER_LENGHT - 2) * ui.encoderPosition / maxEditValue; + int16_t position = (SLIDER_LENGTH - 2) * ui.encoderPosition / maxEditValue; tft.add_bar(0, 7, 1, 2, ui.encoderPosition == 0 ? COLOR_SLIDER_INACTIVE : COLOR_SLIDER); tft.add_bar(1, 6, position, 4, COLOR_SLIDER); - tft.add_bar(position + 1, 6, SLIDER_LENGHT - 2 - position, 4, COLOR_SLIDER_INACTIVE); - tft.add_bar(SLIDER_LENGHT - 1, 7, 1, 2, int32_t(ui.encoderPosition) == maxEditValue ? COLOR_SLIDER : COLOR_SLIDER_INACTIVE); + tft.add_bar(position + 1, 6, SLIDER_LENGTH - 2 - position, 4, COLOR_SLIDER_INACTIVE); + tft.add_bar(SLIDER_LENGTH - 1, 7, 1, 2, int32_t(ui.encoderPosition) == maxEditValue ? COLOR_SLIDER : COLOR_SLIDER_INACTIVE); #if ENABLED(TOUCH_SCREEN) - tft.add_image((SLIDER_LENGHT - 8) * ui.encoderPosition / maxEditValue, 0, imgSlider, COLOR_SLIDER); - touch.add_control(SLIDER, (TFT_WIDTH - SLIDER_LENGHT) / 2, SLIDER_Y_POSITION - 8, SLIDER_LENGHT, 32, maxEditValue); + tft.add_image((SLIDER_LENGTH - 8) * ui.encoderPosition / maxEditValue, 0, imgSlider, COLOR_SLIDER); + touch.add_control(SLIDER, (TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION - 8, SLIDER_LENGTH, 32, maxEditValue); #endif } diff --git a/Marlin/src/lcd/tft_io/ssd1963.h b/Marlin/src/lcd/tft_io/ssd1963.h index 4953a96233..af42e306c6 100644 --- a/Marlin/src/lcd/tft_io/ssd1963.h +++ b/Marlin/src/lcd/tft_io/ssd1963.h @@ -125,7 +125,7 @@ static const uint16_t ssd1963_init[] = { ESC_REG(SSD1963_NORON), ESC_REG(SSD1963_DISPON), - ESC_REG(SSD1963_SPWMCFG), 0x0006, 0x00f0, 0x0001, 0x00f0, 0x0000, 0x0000, + ESC_REG(SSD1963_SPWMCFG), 0x0006, 0x00F0, 0x0001, 0x00F0, 0x0000, 0x0000, ESC_REG(SSD1963_SDBCCFG), 0x000D, ESC_END };