diff --git a/uno-stats-monitor/uno_receiver.ino b/uno-stats-monitor/uno_receiver.ino index afa416f..ac7aa17 100644 --- a/uno-stats-monitor/uno_receiver.ino +++ b/uno-stats-monitor/uno_receiver.ino @@ -2,6 +2,7 @@ * 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 @@ -13,14 +14,14 @@ * 2nd char denotes which line number/mode to use * * Setting Schema: - * LCDLength:LCDDelay:LEDBrightness:LEDDelay - * 16:5:1:3 + * LCDLength:LCDRows:LCDDelay:LEDBrightness:LEDDelay + * 16:2:5:1:3 * * Example: * Line 1: #1Archamedis Status@ * Line 2: #299% free / etc.@ * LAVG -: #-24@ - * LSET 0: #016:5:1:3@ + * LSET 0: #016:2:5:1:3@ * Output Schema: * Multimedia Controls use single characters to denote which button was pressed @@ -85,6 +86,7 @@ // LCD vars const int LCDRS = 12, LCDEN = 11, LCDD4 = 5, LCDD5 = 4, LCDD6 = 3, LCDD7 = 2; int LCDLength = 16; +int LCDRows = 2; int LCDDelay = 10; LiquidCrystal LCD(LCDRS, LCDEN, LCDD4, LCDD5, LCDD6, LCDD7); @@ -125,7 +127,7 @@ void LEDSetup(void) void LcdSetup(void) { // set up the LCD's number of columns and rows: - LCD.begin(LCDLength, 2); + LCD.begin(LCDLength, LCDRows); // clear LCD.clear(); @@ -148,6 +150,11 @@ void LcdLd(int line = 1, boolean wipe = false) line--; } + // don't go past last row + if(line > LCDRows) { + line = LCDRows; + } + delay(LCDDelay); LCD.setCursor(0, line); // Define the cursor position as the 1st position of the specified line @@ -241,13 +248,6 @@ void LedShowLoad(const char *load) int myload = atoi(load); int segments = 0; - if(DEBUG) { - Serial.print("My input load: "); - Serial.println(load); - Serial.print("My calculated load: "); - Serial.println(myload); - } - LEDlc.clearDisplay(0); /* @@ -400,16 +400,18 @@ void procNewData() } } +// settings schema: +// LCDLength:LCDRows:LCDDelay:LEDBrightness:LEDDelay +// 16:2:5:1:3 void LoadSettings(char* mysettings) { - // Settings schema: - // LCDLength:LCDDelay:LEDBrightness:LEDDelay - // 16:5:1:3 - LCDLength = atoi(strtok(mysettings, ":")); + LCDRows = atoi(strtok(NULL, ":")); LCDDelay = atoi(strtok(NULL, ":")); LEDBrightness = atoi(strtok(NULL, ":")); LEDDelay = atoi(strtok(NULL, ":")); + + LEDlc.setIntensity(0,LEDBrightness); } void setup (void)