Skip to content

Commit 99c4441

Browse files
Merge JoaoLopesF#56 pull request
1 parent 64228e4 commit 99c4441

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ with Print commands like Serial Monitor.
4242
By default the Arduino only has as debug possibility via the Serial port.
4343
This has a few disadvantages:
4444

45-
- requires a physical cable to the Arduino device (if the device is far away or in a remote location this is not easy)
45+
- it requires a physical cable to the Arduino device (if the device is far away or in a remote location this is not easy)
4646
- debugging multiple Arduinos at the same time requires many serial ports and a lot of cables
4747

4848
With the ESP8266 (NodeMCU) or ESP32 we now have network connectivity (WiFi) which can be used for streaming debugging information in real-time.
4949

50-
This library is good for IoT projects, home automation, mobile robots (can debug it in moviment with a cable ?) or
50+
This library is good for IoT projects, home automation, mobile robots (when they are moving, can you debug them with a cable?) or
5151
another WiFi projects.
5252

5353
In fact, this library was born of a need to debug an IoT project of home automation.
@@ -62,13 +62,13 @@ See it in: [MiP_ESP8266_Library](https://github.com/Tiogaplanet/MiP_ESP8266_Lib
6262
__RemoteDebug__ is improved with client buffering (is last send is <= 10ms),
6363
to avoid mysterious delays of WiFi networking on ESP32 and ESP8266 boards
6464

65-
Note: If your project not use WiFi, you can use my another library,
65+
Note: If your project don't use WiFi, you can use my other library,
6666
the __[SerialDebug](https://github.com/JoaoLopesF/SerialDebug)__ library,
6767
this library works with any Arduino board.
6868

69-
Note II: __RemoteDebug__ library is now only to Espressif boards, as ESP32 and ESP8266,
70-
If need for another WiFi boards, please add an issue about this
71-
and we will see if it is possible made the port for your board.
69+
Note II: __RemoteDebug__ library works only on Espressif boards, such as ESP32 and ESP8266,
70+
If you need to make it work with another WiFi boards, please add an issue about this
71+
and we will see if it is possible.
7272

7373
## How it looks
7474

@@ -93,9 +93,9 @@ Youtube (3 telnet connections with RemoteDebug) v1:
9393
Contribute to this library development by creating an account on GitHub.
9494

9595
Please give a star, if you find this library useful,
96-
this help an another people, discover it too.
96+
this help other people to discover it.
9797

98-
Please add an issue for problems or suggestion.
98+
Don't hesitate to add an issue or to request a new feature.
9999

100100
## News
101101

@@ -115,7 +115,7 @@ Please add an issue for problems or suggestion.
115115
to support the RemoteDebugApp connection.
116116

117117
- RemoteDebugApp is in beta,
118-
if you have any problems or suggestions, please add issue about this.
118+
if you have any problems or suggestions, please add an issue about this.
119119

120120
- The telnet connection remains, to any want this,
121121
or to internet offline uses.

src/RemoteDebug.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,9 @@ void RemoteDebug::handle() {
576576
if (_password != "" && !_passwordOk) { // Request password - 18/08/08
577577
maxTime = 60000; // One minute to password
578578
}
579+
else maxTime = connectionTimeout; // When password is ok set normal timeout
579580

580-
if ((millis() - _lastTimeCommand) > maxTime) {
581+
if ((maxTime > 0) && ((millis() - _lastTimeCommand) > maxTime)) {
581582

582583
debugPrintln("* Closing session by inactivity");
583584

@@ -1194,7 +1195,7 @@ size_t RemoteDebug::write(uint8_t character) {
11941195
if (noPrint == false) {
11951196

11961197
#ifdef COLOR_NEW_SYSTEM
1197-
_bufferPrint.concat(COLOR_RESET);
1198+
if (_showColors) _bufferPrint.concat(COLOR_RESET);
11981199
#endif
11991200
// Send to telnet or websocket (buffered)
12001201

@@ -1326,6 +1327,7 @@ void RemoteDebug::showHelp() {
13261327
help.concat(" s -> set debug silence on/off\r\n");
13271328
help.concat(" l -> show debug level\r\n");
13281329
help.concat(" t -> show time (millis)\r\n");
1330+
help.concat(" timeout -> set connection timeout (sec, 0 = disabled)\r\n");
13291331
help.concat(" profiler:\r\n");
13301332
help.concat(
13311333
" p -> show time between actual and last message (in millis)\r\n");
@@ -1617,6 +1619,20 @@ void RemoteDebug::processCommand() {
16171619

16181620
debugPrintf("* Show time: %s\r\n", (_showTime) ? "On" : "Off");
16191621

1622+
} else if (_command.startsWith("timeout")) {
1623+
1624+
// Set or get connection timeout
1625+
1626+
if (options.length() > 0) { // With minimal time
1627+
if ((options.toInt() >= 60) || (options.toInt() == 0)) {
1628+
connectionTimeout = options.toInt() * 1000;
1629+
}
1630+
else {
1631+
debugPrintf("* Connection Timeout must be minimal 60 seconds.\r\n");
1632+
}
1633+
}
1634+
debugPrintf("* Connection Timeout: %d seconds (0=disabled)\r\n", connectionTimeout/1000);
1635+
16201636
} else if (_command == "s") {
16211637

16221638
// Toogle silence (new) = 28/08/18

src/RemoteDebug.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ class RemoteDebug: public Print
353353
boolean _resetCommandEnabled=false; // Enable command to reset the board
354354

355355
boolean _newLine = true; // New line write ?
356+
357+
uint32_t connectionTimeout = MAX_TIME_INACTIVE; // Connection Timeout
356358

357359
String _command = ""; // Command received
358360
String _lastCommand = ""; // Last Command received

0 commit comments

Comments
 (0)