Reduce RAM usage for TFT Color UI on SGen-L (#20179)

This commit is contained in:
Victor Oliveira 2020-11-17 17:32:30 -03:00 committed by Scott Lahteine
parent 550306d1b6
commit dc644df9bc
3 changed files with 7 additions and 4 deletions

View file

@ -210,7 +210,7 @@ void TFT_Queue::set_background(uint16_t color) {
#define QUEUE_SAFETY_FREE_SPACE 100 #define QUEUE_SAFETY_FREE_SPACE 100
void TFT_Queue::handle_queue_overflow(uint16_t sizeNeeded) { void TFT_Queue::handle_queue_overflow(uint16_t sizeNeeded) {
if (uintptr_t(end_of_queue) + sizeNeeded + (QUEUE_SAFETY_FREE_SPACE) - uintptr_t(queue) >= QUEUE_SIZE) { if (uintptr_t(end_of_queue) + sizeNeeded + (QUEUE_SAFETY_FREE_SPACE) - uintptr_t(queue) >= TFT_QUEUE_SIZE) {
end_of_queue = queue; end_of_queue = queue;
((parametersCanvasText_t *)last_parameter)->nextParameter = end_of_queue; ((parametersCanvasText_t *)last_parameter)->nextParameter = end_of_queue;
} }

View file

@ -25,7 +25,9 @@
#include "tft_string.h" #include "tft_string.h"
#include "tft_image.h" #include "tft_image.h"
#define QUEUE_SIZE 8192 #ifndef TFT_QUEUE_SIZE
#define TFT_QUEUE_SIZE 8192
#endif
enum QueueTaskType : uint8_t { enum QueueTaskType : uint8_t {
TASK_END_OF_QUEUE = 0x00, TASK_END_OF_QUEUE = 0x00,
@ -118,7 +120,7 @@ typedef struct __attribute__((__packed__)) {
class TFT_Queue { class TFT_Queue {
private: private:
static uint8_t queue[QUEUE_SIZE]; static uint8_t queue[TFT_QUEUE_SIZE];
static uint8_t *end_of_queue; static uint8_t *end_of_queue;
static uint8_t *current_task; static uint8_t *current_task;
static uint8_t *last_task; static uint8_t *last_task;

View file

@ -268,7 +268,8 @@
#define LCD_PINS_ENABLE -1 #define LCD_PINS_ENABLE -1
#define LCD_PINS_RS -1 #define LCD_PINS_RS -1
#define TFT_BUFFER_SIZE 2400 #define TFT_BUFFER_SIZE 1200
#define TFT_QUEUE_SIZE 6144
#define BTN_EN1 P3_25 #define BTN_EN1 P3_25
#define BTN_EN2 P3_26 #define BTN_EN2 P3_26