Reduce string storage, use masking 'seen'

This commit is contained in:
Scott Lahteine
2019-09-26 03:47:26 -05:00
parent 455dabb183
commit 665e45e0ba
24 changed files with 70 additions and 94 deletions

View File

@ -178,7 +178,7 @@ bool UIFlashStorage::is_present = false;
((manufacturer_id == 0x1F) && (device_type == 0x86) && (capacity == 0x01)) ; // Adesto AT255F161
if (!is_known) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Unable to locate supported SPI Flash Memory.");
SERIAL_ECHO_MSG("Unable to locate supported SPI Flash Memory.");
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Manufacturer ID, got: ", manufacturer_id);
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Device Type , got: ", device_type);
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Capacity , got: ", capacity);
@ -252,7 +252,7 @@ bool UIFlashStorage::is_present = false;
return -1;
}
}
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("No LULZ delimiter found.");
SERIAL_ECHO_MSG("No LULZ delimiter found.");
return -1;
}
@ -264,7 +264,7 @@ bool UIFlashStorage::is_present = false;
int32_t write_offset = read_offset + 4 + block_size;
if ((write_offset + 4 + block_size) > data_storage_area_size) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Not enough free space in Flash.");
SERIAL_ECHO_MSG("Not enough free space in Flash.");
return -1; // Not enough free space
}
return write_offset;
@ -300,7 +300,7 @@ bool UIFlashStorage::is_present = false;
void UIFlashStorage::write_config_data(const void *data, size_t size) {
if (!is_present) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("SPI Flash chip not present. Not saving UI settings.");
SERIAL_ECHO_MSG("SPI Flash chip not present. Not saving UI settings.");
return;
}
@ -308,7 +308,7 @@ bool UIFlashStorage::is_present = false;
// make sure that the data is different before rewriting.
if (verify_config_data(data, size)) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("UI settings already written, skipping write.");
SERIAL_ECHO_MSG("UI settings already written, skipping write.");
return;
}
@ -427,12 +427,12 @@ bool UIFlashStorage::is_present = false;
MediaFileReader reader;
if (!reader.open((char*) buff)) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Unable to find media file");
SERIAL_ECHO_MSG("Unable to find media file");
return FILE_NOT_FOUND;
}
if (get_media_file_size(slot) != 0xFFFFFFFFUL) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Media file already exists");
SERIAL_ECHO_MSG("Media file already exists");
return WOULD_OVERWRITE;
}
@ -518,9 +518,8 @@ bool UIFlashStorage::is_present = false;
SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("Boot media file size:", bytes_remaining);
addr = get_media_file_start(slot);
return true;
} else {
return false;
}
return false;
}
int16_t UIFlashStorage::BootMediaReader::read(void *data, const size_t size) {

View File

@ -923,8 +923,7 @@ template <class T> bool CLCD::CommandFifo::_write_unaligned(T data, uint16_t len
#if ENABLED(TOUCH_UI_DEBUG)
if (command_write_ptr == 0xFFFFFFFFul) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Attempt to write to FIFO before CommandFifo::Cmd_Start().");
SERIAL_ECHO_MSG("Attempt to write to FIFO before CommandFifo::Cmd_Start().");
}
#endif
@ -1016,8 +1015,8 @@ template <class T> bool CLCD::CommandFifo::write(T data, uint16_t len) {
if (Command_Space < (len + padding)) {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Waiting for ", len + padding);
SERIAL_ECHOPAIR(" bytes in command queue, now free: ", Command_Space);
SERIAL_ECHOPAIR("Waiting for ", len + padding,
" bytes in command queue, now free: ", Command_Space);
#endif
do {
Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF;
@ -1071,8 +1070,7 @@ void CLCD::init() {
uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C;
if (device_id == 0x7c) {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("FTDI chip initialized ");
SERIAL_ECHO_MSG("FTDI chip initialized ");
#endif
break;
}

View File

@ -148,7 +148,7 @@ namespace FTDI {
constexpr uint8_t STENCIL_OP_DECR = 4;
constexpr uint8_t STENCIL_OP_INVERT = 5;
typedef enum: uint32_t {
typedef enum : uint32_t {
BITMAPS = 1,
POINTS = 2,
LINES = 3,
@ -281,7 +281,7 @@ namespace FTDI_FT810 {
}
namespace FTDI {
enum effect_t {
enum effect_t : unsigned char {
SILENCE = 0x00,
SQUARE_WAVE = 0x01,
SINE_WAVE = 0x02,
@ -342,7 +342,7 @@ namespace FTDI {
UNMUTE = 0x61
};
enum note_t {
enum note_t : unsigned char {
END_SONG = 0xFF,
REST = 0x00,

View File

@ -78,8 +78,7 @@ bool DLCache::wait_until_idle() {
const unsigned long startTime = millis();
do {
if ((millis() - startTime) > 250) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Timeout on DL_Cache::Wait_Until_Idle()");
SERIAL_ECHO_MSG("Timeout on DL_Cache::Wait_Until_Idle()");
CLCD::CommandFifo::reset();
return false;
}
@ -130,15 +129,15 @@ bool DLCache::store(uint32_t num_bytes /* = 0*/) {
// Not enough memory to cache the display list.
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Not enough space in GRAM to cache display list, free space: ", free_space);
SERIAL_ECHOLNPAIR(" Required: ", dl_size);
SERIAL_ECHOLNPAIR("Not enough space in GRAM to cache display list, free space: ", free_space,
" Required: ", dl_size);
#endif
return false;
} else {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Saving DL to RAMG cache, bytes: ", dl_size);
SERIAL_ECHOLNPAIR(" Free space: ", free_space);
SERIAL_ECHOLNPAIR("Saving DL to RAMG cache, bytes: ", dl_size,
" Free space: ", free_space);
#endif
cmd.memcpy(dl_addr, MAP::RAM_DL, dl_size);
cmd.execute();
@ -168,8 +167,8 @@ void DLCache::append() {
cmd.execute();
wait_until_idle();
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Appending to DL from RAMG cache, bytes: ", dl_size);
SERIAL_ECHOLNPAIR(" REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL));
SERIAL_ECHOLNPAIR("Appending to DL from RAMG cache, bytes: ", dl_size,
" REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL));
#endif
}

View File

@ -176,8 +176,7 @@ class CachedScreen {
static bool storeBackground() {
DLCache dlcache(DL_SLOT);
if (!dlcache.store(DL_SIZE)) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("CachedScreen::storeBackground() failed: not enough DL cache space");
SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space");
return false;
}
return true;

View File

@ -38,8 +38,7 @@ namespace FTDI {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOPAIR("Playing note ", note);
SERIAL_ECHOLNPAIR(", instrument ", effect);
SERIAL_ECHOLNPAIR("Playing note ", int(note), ", instrument ", int(effect));
#endif
// Play the note

View File

@ -66,8 +66,7 @@ bool MediaPlayerScreen::playCardMedia() {
if (!reader.open(fname))
return false;
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Starting to play STARTUP.AVI");
SERIAL_ECHO_MSG("Starting to play STARTUP.AVI");
playStream(&reader, MediaFileReader::read);
reader.close();
#endif
@ -79,8 +78,7 @@ bool MediaPlayerScreen::playBootMedia() {
UIFlashStorage::BootMediaReader reader;
if (!reader.isAvailable()) return false;
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Starting to play boot video");
SERIAL_ECHO_MSG("Starting to play boot video");
playStream(&reader, UIFlashStorage::BootMediaReader::read);
return true;
}
@ -138,8 +136,7 @@ void MediaPlayerScreen::playStream(void *obj, media_streamer_func_t *data_stream
t = millis();
timeouts--;
if (timeouts == 0) {
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Timeout playing video");
SERIAL_ECHO_MSG("Timeout playing video");
cmd.reset();
goto exit;
}
@ -151,8 +148,7 @@ void MediaPlayerScreen::playStream(void *obj, media_streamer_func_t *data_stream
CLCD::mem_write_32(CLCD::REG::MEDIAFIFO_WRITE, writePtr);
} while (nBytes == block_size);
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Done playing video");
SERIAL_ECHO_MSG("Done playing video");
exit:
spiInit(SPI_SPEED); // Restore default speed

View File

@ -52,8 +52,7 @@ void TouchCalibrationScreen::onEntry() {
while (CLCD::is_touching()) {
#if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START();
SERIAL_ECHOLNPGM("Waiting for touch release");
SERIAL_ECHO_MSG("Waiting for touch release");
#endif
}
}