diff --git a/uno-stats-monitor/uno_receiver.ino b/uno-stats-monitor/uno_receiver.ino index 14d8685..afa416f 100644 --- a/uno-stats-monitor/uno_receiver.ino +++ b/uno-stats-monitor/uno_receiver.ino @@ -1,7 +1,9 @@ /* - * UNO Monitor Receiver (4-bit LCD Version) + * UNO Monitor Receiver v.0.1.0 (4-bit LCD Version) * Kidacro - * + * https://kidacro.archamedis.net/git/kidacro/Arduino/src/branch/main/uno-stats-monitor + * uno_reciever.ino - Arduino Receiver + * * Waits for input over serial connection and displays on LCD & LED * Receives IR events and reports them over serial connection to a daemon * @@ -10,11 +12,16 @@ * End char is: '@' * 2nd char denotes which line number/mode to use * + * Setting Schema: + * LCDLength:LCDDelay:LEDBrightness:LEDDelay + * 16:5:1:3 + * * Example: * Line 1: #1Archamedis Status@ * Line 2: #299% free / etc.@ - * LAVG 3: #324@ - * + * LAVG -: #-24@ + * LSET 0: #016:5:1:3@ + * Output Schema: * Multimedia Controls use single characters to denote which button was pressed * P power @@ -56,7 +63,7 @@ * LCD R/W pin to ground * LCD VSS pin to ground * LCD VCC pin to 5V - * 10K resistor: + * 10K potentiometer: * ends to +5V and ground * wiper to LCD VO pin (pin 3) */ @@ -78,15 +85,14 @@ // LCD vars const int LCDRS = 12, LCDEN = 11, LCDD4 = 5, LCDD5 = 4, LCDD6 = 3, LCDD7 = 2; int LCDLength = 16; -int LCDDelay = 5; +int LCDDelay = 10; LiquidCrystal LCD(LCDRS, LCDEN, LCDD4, LCDD5, LCDD6, LCDD7); // LED vars const int LEDIN = 10, LEDCS = 9, LEDCLK = 8; LedControl LEDlc=LedControl(LEDIN,LEDCLK,LEDCS,1); -int LEDBrightness = 1; // default = 8 / max = 15 -unsigned long LEDdelaytime1=3; -unsigned long LEDdelaytime2=3; +int LEDBrightness = 8; // default = 8 / max = 15 +unsigned long LEDDelay=10; // IR vars const int IRSIG = 13; @@ -131,27 +137,27 @@ void IRSetup(void) Irrecv.enableIRIn(); } -void LcdL1(boolean wipe = false) +// dynamic lines & character wiping (LCDLength) +void LcdLd(int line = 1, boolean wipe = false) { - delay(LCDDelay); - LCD.setCursor(0, 0); // Define the cursor position as the 1st position of the 1st line + char myline[LCDLength]; + int x = 0; - if(wipe) { - LcdWrite(" "); // 16 spaces for a blank line - LCD.setCursor(0, 0); + // physical line #'s to logical + if(line > 0) { + line--; } delay(LCDDelay); -} - -void LcdL2(boolean wipe = false) -{ - delay(LCDDelay); - LCD.setCursor(0, 1); // Define the cursor position as the 1st position of the 2nd line + LCD.setCursor(0, line); // Define the cursor position as the 1st position of the specified line if(wipe) { - LcdWrite(" "); // 16 spaces for a blank line - LCD.setCursor(0, 1); + for(x=0;x