🎨 Combine serial echos

This commit is contained in:
Scott Lahteine 2022-05-26 18:18:41 -05:00 committed by Scott Lahteine
parent ccf39b1c42
commit 800a936caa
6 changed files with 33 additions and 55 deletions

View File

@ -199,8 +199,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
for (i = 0; i <PageSize >> 2; i++) for (i = 0; i <PageSize >> 2; i++)
pageContents[i] = (((uint32_t*)data)[i]) | (~(pageContents[i] ^ ((uint32_t*)data)[i])); pageContents[i] = (((uint32_t*)data)[i]) | (~(pageContents[i] ^ ((uint32_t*)data)[i]));
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM PageWrite ", page);
DEBUG_ECHOLNPGM("EEPROM PageWrite ", page);
DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash); DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash);
DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0)); DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0));
DEBUG_FLUSH(); DEBUG_FLUSH();
@ -245,8 +244,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
// Reenable interrupts // Reenable interrupts
__enable_irq(); __enable_irq();
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Unlock failure for page ", page);
DEBUG_ECHOLNPGM("EEPROM Unlock failure for page ", page);
return false; return false;
} }
@ -270,8 +268,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
// Reenable interrupts // Reenable interrupts
__enable_irq(); __enable_irq();
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Write failure for page ", page);
DEBUG_ECHOLNPGM("EEPROM Write failure for page ", page);
return false; return false;
} }
@ -286,8 +283,7 @@ static bool ee_PageWrite(uint16_t page, const void *data) {
if (memcmp(getFlashStorage(page),data,PageSize)) { if (memcmp(getFlashStorage(page),data,PageSize)) {
#ifdef EE_EMU_DEBUG #ifdef EE_EMU_DEBUG
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Verify Write failure for page ", page);
DEBUG_ECHOLNPGM("EEPROM Verify Write failure for page ", page);
ee_Dump( page, (uint32_t *)addrflash); ee_Dump( page, (uint32_t *)addrflash);
ee_Dump(-page, data); ee_Dump(-page, data);
@ -325,8 +321,7 @@ static bool ee_PageErase(uint16_t page) {
uint16_t i; uint16_t i;
uint32_t addrflash = uint32_t(getFlashStorage(page)); uint32_t addrflash = uint32_t(getFlashStorage(page));
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM PageErase ", page);
DEBUG_ECHOLNPGM("EEPROM PageErase ", page);
DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash); DEBUG_ECHOLNPGM(" in FLASH address ", (uint32_t)addrflash);
DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0)); DEBUG_ECHOLNPGM(" base address ", (uint32_t)getFlashStorage(0));
DEBUG_FLUSH(); DEBUG_FLUSH();
@ -370,8 +365,7 @@ static bool ee_PageErase(uint16_t page) {
// Reenable interrupts // Reenable interrupts
__enable_irq(); __enable_irq();
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Unlock failure for page ",page);
DEBUG_ECHOLNPGM("EEPROM Unlock failure for page ",page);
return false; return false;
} }
@ -394,8 +388,7 @@ static bool ee_PageErase(uint16_t page) {
// Reenable interrupts // Reenable interrupts
__enable_irq(); __enable_irq();
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Erase failure for page ",page);
DEBUG_ECHOLNPGM("EEPROM Erase failure for page ",page);
return false; return false;
} }
@ -410,8 +403,7 @@ static bool ee_PageErase(uint16_t page) {
uint32_t * aligned_src = (uint32_t *) addrflash; uint32_t * aligned_src = (uint32_t *) addrflash;
for (i = 0; i < PageSize >> 2; i++) { for (i = 0; i < PageSize >> 2; i++) {
if (*aligned_src++ != 0xFFFFFFFF) { if (*aligned_src++ != 0xFFFFFFFF) {
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Verify Erase failure for page ",page);
DEBUG_ECHOLNPGM("EEPROM Verify Erase failure for page ",page);
ee_Dump(page, (uint32_t *)addrflash); ee_Dump(page, (uint32_t *)addrflash);
return false; return false;
} }
@ -921,8 +913,7 @@ static void ee_Init() {
// If all groups seem to be used, default to first group // If all groups seem to be used, default to first group
if (curGroup >= GroupCount) curGroup = 0; if (curGroup >= GroupCount) curGroup = 0;
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Current Group: ",curGroup);
DEBUG_ECHOLNPGM("EEPROM Current Group: ",curGroup);
DEBUG_FLUSH(); DEBUG_FLUSH();
// Now, validate that all the other group pages are empty // Now, validate that all the other group pages are empty
@ -931,8 +922,7 @@ static void ee_Init() {
for (int page = 0; page < PagesPerGroup; page++) { for (int page = 0; page < PagesPerGroup; page++) {
if (!ee_IsPageClean(grp * PagesPerGroup + page)) { if (!ee_IsPageClean(grp * PagesPerGroup + page)) {
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Page ", page, " not clean on group ", grp);
DEBUG_ECHOLNPGM("EEPROM Page ", page, " not clean on group ", grp);
DEBUG_FLUSH(); DEBUG_FLUSH();
ee_PageErase(grp * PagesPerGroup + page); ee_PageErase(grp * PagesPerGroup + page);
} }
@ -948,15 +938,13 @@ static void ee_Init() {
} }
} }
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Active page: ", curPage);
DEBUG_ECHOLNPGM("EEPROM Active page: ", curPage);
DEBUG_FLUSH(); DEBUG_FLUSH();
// Make sure the pages following the first clean one are also clean // Make sure the pages following the first clean one are also clean
for (int page = curPage + 1; page < PagesPerGroup; page++) { for (int page = curPage + 1; page < PagesPerGroup; page++) {
if (!ee_IsPageClean(curGroup * PagesPerGroup + page)) { if (!ee_IsPageClean(curGroup * PagesPerGroup + page)) {
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("EEPROM Page ", page, " not clean on active group ", curGroup);
DEBUG_ECHOLNPGM("EEPROM Page ", page, " not clean on active group ", curGroup);
DEBUG_FLUSH(); DEBUG_FLUSH();
ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page)); ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page));
ee_PageErase(curGroup * PagesPerGroup + page); ee_PageErase(curGroup * PagesPerGroup + page);

View File

@ -1031,8 +1031,7 @@ void MMU2::execute_extruder_sequence(const E_Step * sequence, int steps) {
const float es = pgm_read_float(&(step->extrude)); const float es = pgm_read_float(&(step->extrude));
const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate)); const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate));
DEBUG_ECHO_START(); DEBUG_ECHO_MSG("E step ", es, "/", fr_mm_m);
DEBUG_ECHOLNPGM("E step ", es, "/", fr_mm_m);
current_position.e += es; current_position.e += es;
line_to_current_position(MMM_TO_MMS(fr_mm_m)); line_to_current_position(MMM_TO_MMS(fr_mm_m));

View File

@ -32,13 +32,13 @@ mpe_settings_t mpe_settings;
inline void mpe_settings_report() { inline void mpe_settings_report() {
SERIAL_ECHO_MSG("Magnetic Parking Extruder"); SERIAL_ECHO_MSG("Magnetic Parking Extruder");
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("L: Left parking :", mpe_settings.parking_xpos[0]); SERIAL_ECHO_MSG("L: Left parking :", mpe_settings.parking_xpos[0]);
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("R: Right parking :", mpe_settings.parking_xpos[1]); SERIAL_ECHO_MSG("R: Right parking :", mpe_settings.parking_xpos[1]);
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("I: Grab Offset :", mpe_settings.grab_distance); SERIAL_ECHO_MSG("I: Grab Offset :", mpe_settings.grab_distance);
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("J: Normal speed :", long(MMS_TO_MMM(mpe_settings.slow_feedrate))); SERIAL_ECHO_MSG("J: Normal speed :", long(MMS_TO_MMM(mpe_settings.slow_feedrate)));
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("H: High speed :", long(MMS_TO_MMM(mpe_settings.fast_feedrate))); SERIAL_ECHO_MSG("H: High speed :", long(MMS_TO_MMM(mpe_settings.fast_feedrate)));
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("D: Distance trav.:", mpe_settings.travel_distance); SERIAL_ECHO_MSG("D: Distance trav.:", mpe_settings.travel_distance);
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("C: Compenstion :", mpe_settings.compensation_factor); SERIAL_ECHO_MSG("C: Compenstion :", mpe_settings.compensation_factor);
} }
void mpe_settings_init() { void mpe_settings_init() {

View File

@ -178,9 +178,9 @@ bool UIFlashStorage::is_present = false;
if (!is_known) { if (!is_known) {
SERIAL_ECHO_MSG("Unable to locate supported SPI Flash Memory."); SERIAL_ECHO_MSG("Unable to locate supported SPI Flash Memory.");
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(" Manufacturer ID, got: ", manufacturer_id); SERIAL_ECHO_MSG(" Manufacturer ID, got: ", manufacturer_id);
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(" Device Type , got: ", device_type); SERIAL_ECHO_MSG(" Device Type , got: ", device_type);
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM(" Capacity , got: ", capacity); SERIAL_ECHO_MSG(" Capacity , got: ", capacity);
} }
return is_known; return is_known;
@ -247,7 +247,7 @@ bool UIFlashStorage::is_present = false;
case 0xFFFFFFFFul: return read_offset; case 0xFFFFFFFFul: return read_offset;
case delimiter: read_offset = offset; break; case delimiter: read_offset = offset; break;
default: default:
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Invalid delimiter in Flash: ", delim); SERIAL_ECHO_MSG("Invalid delimiter in Flash: ", delim);
return -1; return -1;
} }
} }
@ -325,8 +325,7 @@ bool UIFlashStorage::is_present = false;
} }
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_ECHOPGM("Writing UI settings to SPI Flash (offset ", write_addr); SERIAL_ECHOPGM("Writing UI settings to SPI Flash (offset ", write_addr, ")...");
SERIAL_ECHOPGM(")...");
const uint32_t delim = delimiter; const uint32_t delim = delimiter;
write_addr = write(write_addr, &delim, sizeof(delim)); write_addr = write(write_addr, &delim, sizeof(delim));
@ -509,7 +508,7 @@ bool UIFlashStorage::is_present = false;
bytes_remaining = get_media_file_size(slot); bytes_remaining = get_media_file_size(slot);
if (bytes_remaining != 0xFFFFFFFFUL) { if (bytes_remaining != 0xFFFFFFFFUL) {
SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Boot media file size:", bytes_remaining); SERIAL_ECHO_MSG("Boot media file size:", bytes_remaining);
addr = get_media_file_start(slot); addr = get_media_file_start(slot);
return true; return true;
} }

View File

@ -1024,9 +1024,7 @@ template <class T> bool CLCD::CommandFifo::write(T data, uint16_t len) {
uint16_t Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF; uint16_t Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF;
if (Command_Space < (len + padding)) { if (Command_Space < (len + padding)) {
#if ENABLED(TOUCH_UI_DEBUG) #if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START(); SERIAL_ECHO_MSG("Waiting for ", len + padding, " bytes in command queue, now free: ", Command_Space);
SERIAL_ECHOPGM("Waiting for ", len + padding);
SERIAL_ECHOLNPGM(" bytes in command queue, now free: ", Command_Space);
#endif #endif
do { do {
Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF; Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF;

View File

@ -131,9 +131,7 @@ bool DLCache::store(uint32_t min_bytes /* = 0*/) {
if (dl_size > dl_slot_size) { if (dl_size > dl_slot_size) {
// Not enough memory to cache the display list. // Not enough memory to cache the display list.
#if ENABLED(TOUCH_UI_DEBUG) #if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START(); SERIAL_ECHO_MSG("Not enough space in GRAM to cache display list, free space: ", dl_slot_size, " Required: ", dl_size);
SERIAL_ECHOPGM ("Not enough space in GRAM to cache display list, free space: ", dl_slot_size);
SERIAL_ECHOLNPGM(" Required: ", dl_size);
#endif #endif
dl_slot_used = 0; dl_slot_used = 0;
save_slot(); save_slot();
@ -141,9 +139,7 @@ bool DLCache::store(uint32_t min_bytes /* = 0*/) {
} }
else { else {
#if ENABLED(TOUCH_UI_DEBUG) #if ENABLED(TOUCH_UI_DEBUG)
SERIAL_ECHO_START(); SERIAL_ECHO_MSG("Saving DL to RAMG cache, bytes: ", dl_slot_used, " Free space: ", dl_slot_size);
SERIAL_ECHOPGM ("Saving DL to RAMG cache, bytes: ", dl_slot_used);
SERIAL_ECHOLNPGM(" Free space: ", dl_slot_size);
#endif #endif
dl_slot_used = dl_size; dl_slot_used = dl_size;
save_slot(); save_slot();
@ -160,9 +156,9 @@ void DLCache::save_slot(uint8_t indx, uint32_t addr, uint16_t size, uint16_t use
} }
void DLCache::load_slot(uint8_t indx, uint32_t &addr, uint16_t &size, uint16_t &used) { void DLCache::load_slot(uint8_t indx, uint32_t &addr, uint16_t &size, uint16_t &used) {
addr = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 0); addr = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 0);
size = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 4); size = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 4);
used = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 8); used = CLCD::mem_read_32(DL_CACHE_START + indx * 12 + 8);
} }
void DLCache::append() { void DLCache::append() {
@ -171,9 +167,7 @@ void DLCache::append() {
#if ENABLED(TOUCH_UI_DEBUG) #if ENABLED(TOUCH_UI_DEBUG)
cmd.execute(); cmd.execute();
wait_until_idle(); wait_until_idle();
SERIAL_ECHO_START(); SERIAL_ECHO_MSG("Appending to DL from RAMG cache, bytes: ", dl_slot_used, " REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL));
SERIAL_ECHOPGM ("Appending to DL from RAMG cache, bytes: ", dl_slot_used);
SERIAL_ECHOLNPGM(" REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL));
#endif #endif
} }