Skip to content

Commit

Permalink
Merge JoaoLopesF#56 pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
karol-brejna-i committed Sep 27, 2020
1 parent 64228e4 commit 99c4441
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 11 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ with Print commands like Serial Monitor.
By default the Arduino only has as debug possibility via the Serial port.
This has a few disadvantages:

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

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

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

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

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

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

## How it looks

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

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

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

## News

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

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

- The telnet connection remains, to any want this,
or to internet offline uses.
Expand Down
20 changes: 18 additions & 2 deletions src/RemoteDebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,9 @@ void RemoteDebug::handle() {
if (_password != "" && !_passwordOk) { // Request password - 18/08/08
maxTime = 60000; // One minute to password
}
else maxTime = connectionTimeout; // When password is ok set normal timeout

if ((millis() - _lastTimeCommand) > maxTime) {
if ((maxTime > 0) && ((millis() - _lastTimeCommand) > maxTime)) {

debugPrintln("* Closing session by inactivity");

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

#ifdef COLOR_NEW_SYSTEM
_bufferPrint.concat(COLOR_RESET);
if (_showColors) _bufferPrint.concat(COLOR_RESET);
#endif
// Send to telnet or websocket (buffered)

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

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

} else if (_command.startsWith("timeout")) {

// Set or get connection timeout

if (options.length() > 0) { // With minimal time
if ((options.toInt() >= 60) || (options.toInt() == 0)) {
connectionTimeout = options.toInt() * 1000;
}
else {
debugPrintf("* Connection Timeout must be minimal 60 seconds.\r\n");
}
}
debugPrintf("* Connection Timeout: %d seconds (0=disabled)\r\n", connectionTimeout/1000);

} else if (_command == "s") {

// Toogle silence (new) = 28/08/18
Expand Down
2 changes: 2 additions & 0 deletions src/RemoteDebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ class RemoteDebug: public Print
boolean _resetCommandEnabled=false; // Enable command to reset the board

boolean _newLine = true; // New line write ?

uint32_t connectionTimeout = MAX_TIME_INACTIVE; // Connection Timeout

String _command = ""; // Command received
String _lastCommand = ""; // Last Command received
Expand Down

0 comments on commit 99c4441

Please sign in to comment.