Preventing flickers in examples caused by slow logging

This commit is contained in:
Rodrigo Alfonso
2024-08-15 11:09:46 -03:00
parent d63dc3f250
commit a5dd98c4fc
11 changed files with 44 additions and 0 deletions

View File

@@ -129,8 +129,12 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}

View File

@@ -73,8 +73,12 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}

View File

@@ -315,10 +315,14 @@ void forceSync() {
linkConnection->read(remotePlayerId);
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}
void waitFor(u16 key) {

View File

@@ -86,10 +86,14 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}
std::string mode(std::string name, LinkGPIO::Pin pin) {

View File

@@ -69,8 +69,12 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}

View File

@@ -68,8 +68,12 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}

View File

@@ -115,10 +115,14 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}
void wait(u32 verticalLines) {

View File

@@ -107,10 +107,14 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}
void wait(u32 verticalLines) {

View File

@@ -89,8 +89,12 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}

View File

@@ -123,10 +123,14 @@ int main() {
return 0;
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}
void waitFor(u16 key) {

View File

@@ -443,10 +443,14 @@ void messageLoop() {
}
}
std::string lastLoggedText = "";
void log(std::string text) {
if (text == lastLoggedText)
return;
tte_erase_screen();
tte_write("#{P:0,0}");
tte_write(text.c_str());
lastLoggedText = text;
}
void waitFor(u16 key) {