This commit is contained in:
RLF
2023-12-27 00:32:10 -05:00
parent e580c0d57f
commit 1769ebabbb

View File

@@ -1,5 +1,5 @@
/*
* UNO Monitor Receiver (4bit LCD Version)
* UNO Monitor Receiver (4-bit LCD Version)
* kidacro@archamedis.net
*
* Waits for input over serial connection and displays on LCD
@@ -48,6 +48,37 @@ boolean newData = false;
// Debugging (serial console must be connected)
bool DEBUG = 1;
void LcdL1(boolean wipe = false) {
delay(10);
LCD.setCursor(0, 0); // Define the cursor position as the 1st position of the 1st line
if(wipe) {
LcdWrite(" "); // 16 spaces for a blank line
LCD.setCursor(0, 0);
}
delay(10);
}
void LcdL2(boolean wipe = false) {
delay(10);
LCD.setCursor(0, 1); // Define the cursor position as the 1st position of the 2nd line
if(wipe) {
LcdWrite(" "); // 16 spaces for a blank line
LCD.setCursor(0, 1);
}
delay(10);
}
void LcdCls(void) {
delay(10);
LCD.clear(); // The screen is empty
LcdL1(); // the cursor position is zeroed
delay(10);
}
void LcdSetup(void) {
// set up the LCD's number of columns and rows:
LCD.begin(LCDLength, 2);
@@ -59,31 +90,12 @@ void LcdSetup(void) {
LCD.print("Waiting for data");
}
void LcdCls(void) {
delay(10);
LCD.clear(); // The screen is empty
LcdL1(); // the cursor position is zeroed
delay(10);
}
void LcdL1() {
delay(10);
LCD.setCursor(0, 0); // Define the cursor position as the 1st position of the 1st line
delay(10);
}
void LcdL2() {
delay(10);
LCD.setCursor(0, 1); // Define the cursor position as the 1st position of the 2nd line
delay(10);
}
// returns starting position of text
/* returns starting position of text
void LcdCenter(int mylen) {
int mypos = 0;
return mypos;
}
}*/
void LcdWrite(String mymessage) {
int i = 0;
@@ -121,9 +133,15 @@ void LcdWriteExample() {
LcdL1();
LcdWrite("Archamedis Stats");
LcdL2();
delay(20);
LcdL1(true);
LcdWrite("4.3ghz 89% 68C");
delay(20);
LcdL2();
LcdWrite("Ryzen 9 5950x");
}
void recvWithStartEndMarkers() {
@@ -169,16 +187,12 @@ void showNewData() {
// dev: fucking c and its fixed arrays
// we have to define 1st character (line number) as BS and when printing, search for that BS character to skip printing that 1 character, grrr
if(receivedChars[0] == '1') {
LcdL1();
LcdWrite(" "); // 16 spaces for a blank line
LcdL1();
LcdL1(true);
receivedChars[0] = '\b';
LcdWrite(receivedChars);
}
else if(receivedChars[0] == '2') {
LcdL2();
LcdWrite(" "); // 16 spaces for a blank line
LcdL2();
LcdL2(true);
receivedChars[0] = '\b';
LcdWrite(receivedChars);
}