added LCDRows support
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
* UNO Monitor Receiver v.0.1.0 (4-bit LCD Version)
|
* UNO Monitor Receiver v.0.1.0 (4-bit LCD Version)
|
||||||
* Kidacro <kidacro@archamedis.net>
|
* Kidacro <kidacro@archamedis.net>
|
||||||
* https://kidacro.archamedis.net/git/kidacro/Arduino/src/branch/main/uno-stats-monitor
|
* https://kidacro.archamedis.net/git/kidacro/Arduino/src/branch/main/uno-stats-monitor
|
||||||
|
*
|
||||||
* uno_reciever.ino - Arduino Receiver
|
* uno_reciever.ino - Arduino Receiver
|
||||||
*
|
*
|
||||||
* Waits for input over serial connection and displays on LCD & LED
|
* Waits for input over serial connection and displays on LCD & LED
|
||||||
@@ -13,14 +14,14 @@
|
|||||||
* 2nd char denotes which line number/mode to use
|
* 2nd char denotes which line number/mode to use
|
||||||
*
|
*
|
||||||
* Setting Schema:
|
* Setting Schema:
|
||||||
* LCDLength:LCDDelay:LEDBrightness:LEDDelay
|
* LCDLength:LCDRows:LCDDelay:LEDBrightness:LEDDelay
|
||||||
* 16:5:1:3
|
* 16:2:5:1:3
|
||||||
*
|
*
|
||||||
* Example:
|
* Example:
|
||||||
* Line 1: #1Archamedis Status@
|
* Line 1: #1Archamedis Status@
|
||||||
* Line 2: #299% free / etc.@
|
* Line 2: #299% free / etc.@
|
||||||
* LAVG -: #-24@
|
* LAVG -: #-24@
|
||||||
* LSET 0: #016:5:1:3@
|
* LSET 0: #016:2:5:1:3@
|
||||||
|
|
||||||
* Output Schema:
|
* Output Schema:
|
||||||
* Multimedia Controls use single characters to denote which button was pressed
|
* Multimedia Controls use single characters to denote which button was pressed
|
||||||
@@ -85,6 +86,7 @@
|
|||||||
// LCD vars
|
// LCD vars
|
||||||
const int LCDRS = 12, LCDEN = 11, LCDD4 = 5, LCDD5 = 4, LCDD6 = 3, LCDD7 = 2;
|
const int LCDRS = 12, LCDEN = 11, LCDD4 = 5, LCDD5 = 4, LCDD6 = 3, LCDD7 = 2;
|
||||||
int LCDLength = 16;
|
int LCDLength = 16;
|
||||||
|
int LCDRows = 2;
|
||||||
int LCDDelay = 10;
|
int LCDDelay = 10;
|
||||||
LiquidCrystal LCD(LCDRS, LCDEN, LCDD4, LCDD5, LCDD6, LCDD7);
|
LiquidCrystal LCD(LCDRS, LCDEN, LCDD4, LCDD5, LCDD6, LCDD7);
|
||||||
|
|
||||||
@@ -125,7 +127,7 @@ void LEDSetup(void)
|
|||||||
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, LCDRows);
|
||||||
|
|
||||||
// clear
|
// clear
|
||||||
LCD.clear();
|
LCD.clear();
|
||||||
@@ -148,6 +150,11 @@ void LcdLd(int line = 1, boolean wipe = false)
|
|||||||
line--;
|
line--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// don't go past last row
|
||||||
|
if(line > LCDRows) {
|
||||||
|
line = LCDRows;
|
||||||
|
}
|
||||||
|
|
||||||
delay(LCDDelay);
|
delay(LCDDelay);
|
||||||
LCD.setCursor(0, line); // Define the cursor position as the 1st position of the specified line
|
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 myload = atoi(load);
|
||||||
int segments = 0;
|
int segments = 0;
|
||||||
|
|
||||||
if(DEBUG) {
|
|
||||||
Serial.print("My input load: ");
|
|
||||||
Serial.println(load);
|
|
||||||
Serial.print("My calculated load: ");
|
|
||||||
Serial.println(myload);
|
|
||||||
}
|
|
||||||
|
|
||||||
LEDlc.clearDisplay(0);
|
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)
|
void LoadSettings(char* mysettings)
|
||||||
{
|
{
|
||||||
// Settings schema:
|
|
||||||
// LCDLength:LCDDelay:LEDBrightness:LEDDelay
|
|
||||||
// 16:5:1:3
|
|
||||||
|
|
||||||
LCDLength = atoi(strtok(mysettings, ":"));
|
LCDLength = atoi(strtok(mysettings, ":"));
|
||||||
|
LCDRows = atoi(strtok(NULL, ":"));
|
||||||
LCDDelay = atoi(strtok(NULL, ":"));
|
LCDDelay = atoi(strtok(NULL, ":"));
|
||||||
LEDBrightness = atoi(strtok(NULL, ":"));
|
LEDBrightness = atoi(strtok(NULL, ":"));
|
||||||
LEDDelay = atoi(strtok(NULL, ":"));
|
LEDDelay = atoi(strtok(NULL, ":"));
|
||||||
|
|
||||||
|
LEDlc.setIntensity(0,LEDBrightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup (void)
|
void setup (void)
|
||||||
|
|||||||
Reference in New Issue
Block a user