Update uno-stats-monitor/monitor_uno.ino
cleanup
This commit is contained in:
@@ -252,7 +252,7 @@ void LedShowLoad(const char *load)
|
||||
else if(myload <= 60 && myload > 50) segments = 5;
|
||||
else if(myload <= 70 && myload > 60) segments = 6;
|
||||
else if(myload <= 85 && myload > 70) segments = 7;
|
||||
else if(myload > 84) segments = 8;
|
||||
else if(myload >= 86) segments = 8;
|
||||
|
||||
// segments as rows
|
||||
for(int row=0;row<8;row++) {
|
||||
@@ -305,7 +305,7 @@ void IRtranslate()
|
||||
delay(500);
|
||||
}
|
||||
|
||||
// serial/IR receive
|
||||
// serial receive
|
||||
void SERrecv()
|
||||
{
|
||||
static boolean recvInProgress = false;
|
||||
@@ -333,15 +333,20 @@ void SERrecv()
|
||||
SERnewData = true;
|
||||
}
|
||||
}
|
||||
|
||||
else if(rc == startMarker) {
|
||||
recvInProgress = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// display stats on LCD and load average on LED
|
||||
void showNewData()
|
||||
// process new data
|
||||
// data schema:
|
||||
// 1st character denotes function:
|
||||
// 1 - print on 1st line as is
|
||||
// 2 - print on 2nd line as is
|
||||
// 3 - display load on LCD matrix
|
||||
// 4 - set a setting
|
||||
void procNewData()
|
||||
{
|
||||
if(SERnewData == true) {
|
||||
if(DEBUG) {
|
||||
@@ -349,19 +354,23 @@ void showNewData()
|
||||
Serial.println(SERrecvChars);
|
||||
}
|
||||
|
||||
// Print on line 1 or 2
|
||||
// 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
|
||||
// Chooser
|
||||
// dev: we have to define 1st character (line number) as BS and when printing, search for that BS character to skip printing that 1 character
|
||||
// print on line 1
|
||||
if(SERrecvChars[0] == '1') {
|
||||
LcdL1(true);
|
||||
SERrecvChars[0] = '\b';
|
||||
LcdWrite(SERrecvChars);
|
||||
}
|
||||
|
||||
// print on line 2
|
||||
else if(SERrecvChars[0] == '2') {
|
||||
LcdL2(true);
|
||||
SERrecvChars[0] = '\b';
|
||||
LcdWrite(SERrecvChars);
|
||||
}
|
||||
|
||||
// show load on led matrix
|
||||
else if(SERrecvChars[0] == '3') {
|
||||
SERrecvChars[0] = ' ';
|
||||
LedShowLoad(SERrecvChars);
|
||||
@@ -398,6 +407,6 @@ void loop (void)
|
||||
// process serial input
|
||||
SERrecv();
|
||||
|
||||
// display new data
|
||||
showNewData();
|
||||
// process new data
|
||||
procNewData();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user