cleanup
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* UNO Monitor Receiver (4bit LCD Version)
|
* UNO Monitor Receiver (4-bit LCD Version)
|
||||||
* kidacro@archamedis.net
|
* kidacro@archamedis.net
|
||||||
*
|
*
|
||||||
* Waits for input over serial connection and displays on LCD
|
* Waits for input over serial connection and displays on LCD
|
||||||
@@ -47,7 +47,38 @@ boolean newData = false;
|
|||||||
|
|
||||||
// Debugging (serial console must be connected)
|
// Debugging (serial console must be connected)
|
||||||
bool DEBUG = 1;
|
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) {
|
void LcdSetup(void) {
|
||||||
// set up the LCD's number of columns and rows:
|
// set up the LCD's number of columns and rows:
|
||||||
LCD.begin(LCDLength, 2);
|
LCD.begin(LCDLength, 2);
|
||||||
@@ -59,31 +90,12 @@ void LcdSetup(void) {
|
|||||||
LCD.print("Waiting for data");
|
LCD.print("Waiting for data");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LcdCls(void) {
|
/* returns starting position of text
|
||||||
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
|
|
||||||
void LcdCenter(int mylen) {
|
void LcdCenter(int mylen) {
|
||||||
int mypos = 0;
|
int mypos = 0;
|
||||||
|
|
||||||
return mypos;
|
return mypos;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
void LcdWrite(String mymessage) {
|
void LcdWrite(String mymessage) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -121,9 +133,15 @@ void LcdWriteExample() {
|
|||||||
LcdL1();
|
LcdL1();
|
||||||
LcdWrite("Archamedis Stats");
|
LcdWrite("Archamedis Stats");
|
||||||
|
|
||||||
LcdL2();
|
delay(20);
|
||||||
|
|
||||||
|
LcdL1(true);
|
||||||
LcdWrite("4.3ghz 89% 68C");
|
LcdWrite("4.3ghz 89% 68C");
|
||||||
|
|
||||||
|
delay(20);
|
||||||
|
|
||||||
|
LcdL2();
|
||||||
|
LcdWrite("Ryzen 9 5950x");
|
||||||
}
|
}
|
||||||
|
|
||||||
void recvWithStartEndMarkers() {
|
void recvWithStartEndMarkers() {
|
||||||
@@ -169,16 +187,12 @@ void showNewData() {
|
|||||||
// dev: fucking c and its fixed arrays
|
// 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
|
// 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') {
|
if(receivedChars[0] == '1') {
|
||||||
LcdL1();
|
LcdL1(true);
|
||||||
LcdWrite(" "); // 16 spaces for a blank line
|
|
||||||
LcdL1();
|
|
||||||
receivedChars[0] = '\b';
|
receivedChars[0] = '\b';
|
||||||
LcdWrite(receivedChars);
|
LcdWrite(receivedChars);
|
||||||
}
|
}
|
||||||
else if(receivedChars[0] == '2') {
|
else if(receivedChars[0] == '2') {
|
||||||
LcdL2();
|
LcdL2(true);
|
||||||
LcdWrite(" "); // 16 spaces for a blank line
|
|
||||||
LcdL2();
|
|
||||||
receivedChars[0] = '\b';
|
receivedChars[0] = '\b';
|
||||||
LcdWrite(receivedChars);
|
LcdWrite(receivedChars);
|
||||||
}
|
}
|
||||||
@@ -211,4 +225,4 @@ void loop (void) {
|
|||||||
// process input
|
// process input
|
||||||
recvWithStartEndMarkers();
|
recvWithStartEndMarkers();
|
||||||
showNewData();
|
showNewData();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user