From 8a7d7a498097dac33b4795068e41516c1422b67b Mon Sep 17 00:00:00 2001 From: Malte Bublitz Date: Thu, 26 Oct 2023 20:43:47 +0200 Subject: [PATCH] MAPID/CP: Added LCDON/LCDOFF --- MAPID-CP/MAPID-CP.ino | 38 +++++++++++++++++++++++++++++++++++--- MAPID-CP/config.h | 2 +- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/MAPID-CP/MAPID-CP.ino b/MAPID-CP/MAPID-CP.ino index b4bfe6f..900a4f7 100644 --- a/MAPID-CP/MAPID-CP.ino +++ b/MAPID-CP/MAPID-CP.ino @@ -37,6 +37,9 @@ void setup() { SCmd.addCommand("ON", ledOn); SCmd.addCommand("OFF", ledOff); // LCD + SCmd.addCommand("LCDON", lcdOn); + SCmd.addCommand("LCDOFF", lcdOff); + SCmd.addCommand("ECHO", lcdEcho); SCmd.addCommand("CLS", lcdClear); SCmd.addCommand("LINE", lcdLine); @@ -171,11 +174,16 @@ void help() { Serial.println(" VER"); Serial.println(" GETTY"); Serial.println(" HELP"); - Serial.println(" CLS"); Serial.println(" ON"); Serial.println(" OFF"); + Serial.println(" LCDON"); + Serial.println(" LCDOFF"); Serial.println(" ECHO Text"); + Serial.println(" CLS"); Serial.println(" LINE i"); + #ifdef README_PROGMEM + Serial.println(" README"); + #endif // Show prompt again Serial.println(); @@ -184,8 +192,8 @@ void help() { void ledOn() { Serial.println(""); - Serial.println("Turning LED to *ON*"); + Serial.println("Turning LED to *ON*"); //lcd.println("LED on"); digitalWrite(PIN_LED, HIGH); @@ -195,11 +203,35 @@ void ledOn() { void ledOff() { Serial.println(""); - Serial.println("Turning LED to *OFF*"); + Serial.println("Turning LED to *OFF*"); //lcd.println("LED off"); digitalWrite(PIN_LED, LOW); // Show prompt again Serial.print(TTY_PROMPT); } + +void lcdOn() { + Serial.println(""); + + // Turn display on + Serial.println("Turning LCD screen to *ON*"); + lcd.display(); + lcd.setBrightness(30); + + // Show prompt again + Serial.print(TTY_PROMPT); +} + +void lcdOff() { + Serial.println(""); + + // Turn display on + Serial.println("Turning LCD screen to *OFF*"); + lcd.noDisplay(); + lcd.setBrightness(1); + + // Show prompt again + Serial.print(TTY_PROMPT); +} diff --git a/MAPID-CP/config.h b/MAPID-CP/config.h index a945171..ff77ebb 100644 --- a/MAPID-CP/config.h +++ b/MAPID-CP/config.h @@ -2,7 +2,7 @@ #define _CONFIG_H_ #define OS_NAME "MAPID/CP" -#define OS_VERSION 4 +#define OS_VERSION 5 #define PIN_LED LED_BUILTIN #define PIN_LCD 2