Added TX/RX status via blinking button LED's when UI is timed out/off
This commit is contained in:
parent
8e1be396d4
commit
c6c7ec4ad5
|
@ -217,35 +217,56 @@ void Config::processSerialData() {
|
||||||
//if (DEBUG) {
|
//if (DEBUG) {
|
||||||
// Serial.println("Config::processSerialData()");
|
// Serial.println("Config::processSerialData()");
|
||||||
//}
|
//}
|
||||||
|
//#if DEBUG == 2
|
||||||
|
//DateTime now = rtc.now();
|
||||||
|
//Serial.print(now.year(), DEC);
|
||||||
|
//Serial.print('/');
|
||||||
|
//Serial.print(now.month(), DEC);
|
||||||
|
//Serial.print('/');
|
||||||
|
//Serial.print(now.day(), DEC);
|
||||||
|
//Serial.print(' ');
|
||||||
|
//Serial.print(now.hour(), DEC);
|
||||||
|
//Serial.print(':');
|
||||||
|
//Serial.print(now.minute(), DEC);
|
||||||
|
//Serial.print(':');
|
||||||
|
//Serial.print(now.second(), DEC);
|
||||||
|
//Serial.println();
|
||||||
|
//#endif
|
||||||
switch (currentMode) {
|
switch (currentMode) {
|
||||||
case 0: // ttl
|
case 0: // ttl
|
||||||
if (Serial3.available()) {
|
if (Serial3.available()) {
|
||||||
int inByte = Serial3.read();
|
int inByte = Serial3.read();
|
||||||
Serial.write(inByte);
|
Serial.write(inByte);
|
||||||
|
ui->blinkCancelButton();
|
||||||
}
|
}
|
||||||
if (Serial.available()) {
|
if (Serial.available()) {
|
||||||
int inByte = Serial.read();
|
int inByte = Serial.read();
|
||||||
Serial3.write(inByte);
|
Serial3.write(inByte);
|
||||||
|
ui->blinkOKButton();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // db9_null
|
case 1: // db9_null
|
||||||
if (Serial2.available()) {
|
if (Serial2.available()) {
|
||||||
int inByte = Serial2.read();
|
int inByte = Serial2.read();
|
||||||
Serial.write(inByte);
|
Serial.write(inByte);
|
||||||
|
ui->blinkCancelButton();
|
||||||
}
|
}
|
||||||
if (Serial.available()) {
|
if (Serial.available()) {
|
||||||
int inByte = Serial.read();
|
int inByte = Serial.read();
|
||||||
Serial2.write(inByte);
|
Serial2.write(inByte);
|
||||||
|
ui->blinkOKButton();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: // cisco
|
case 2: // cisco
|
||||||
if (Serial1.available()) {
|
if (Serial1.available()) {
|
||||||
int inByte = Serial1.read();
|
int inByte = Serial1.read();
|
||||||
Serial.write(inByte);
|
Serial.write(inByte);
|
||||||
|
ui->blinkCancelButton();
|
||||||
}
|
}
|
||||||
if (Serial.available()) {
|
if (Serial.available()) {
|
||||||
int inByte = Serial.read();
|
int inByte = Serial.read();
|
||||||
Serial1.write(inByte);
|
Serial1.write(inByte);
|
||||||
|
ui->blinkOKButton();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,20 @@ UI::UI() {
|
||||||
startUI();
|
startUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UI::blinkOKButton() {
|
||||||
|
if (!config->isUIEnabled()) {
|
||||||
|
okButton->turnOnLed();
|
||||||
|
okButton->turnOffLed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UI::blinkCancelButton() {
|
||||||
|
if (!config->isUIEnabled()) {
|
||||||
|
cancelButton->turnOnLed();
|
||||||
|
cancelButton->turnOffLed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UI::setLCDTimeout() {
|
void UI::setLCDTimeout() {
|
||||||
uiTimeout->interval(config->getTimeoutMilis());
|
uiTimeout->interval(config->getTimeoutMilis());
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,6 +50,9 @@ public:
|
||||||
|
|
||||||
void setLCDTimeout();
|
void setLCDTimeout();
|
||||||
void resetTimeout();
|
void resetTimeout();
|
||||||
|
|
||||||
|
void blinkOKButton();
|
||||||
|
void blinkCancelButton();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -610,7 +610,7 @@ void UILCD::bmpDraw(char *filename, uint8_t x, uint8_t y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bmpFile.close();
|
bmpFile.close();
|
||||||
if(!goodBmp && DEBUG) Serial.println("BMP format not recognized.");
|
if(!goodBmp && DEBUG == 2) Serial.println("BMP format not recognized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// These read 16- and 32-bit types from the SD card file.
|
// These read 16- and 32-bit types from the SD card file.
|
||||||
|
|
|
@ -66,22 +66,6 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if (DEBUG) {
|
|
||||||
DateTime now = rtc.now();
|
|
||||||
Serial.print(now.year(), DEC);
|
|
||||||
Serial.print('/');
|
|
||||||
Serial.print(now.month(), DEC);
|
|
||||||
Serial.print('/');
|
|
||||||
Serial.print(now.day(), DEC);
|
|
||||||
Serial.print(' ');
|
|
||||||
Serial.print(now.hour(), DEC);
|
|
||||||
Serial.print(':');
|
|
||||||
Serial.print(now.minute(), DEC);
|
|
||||||
Serial.print(':');
|
|
||||||
Serial.print(now.second(), DEC);
|
|
||||||
Serial.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Serial data is processed via an interrupt so isn't needed in the main loop
|
// Serial data is processed via an interrupt so isn't needed in the main loop
|
||||||
ui->processInputEvents();
|
ui->processInputEvents();
|
||||||
ui->processTimeoutEvents();
|
ui->processTimeoutEvents();
|
||||||
|
|
Reference in a new issue