JoaoLopesF / RemoteDebug

Library for Arduino to debug projects over WiFi, with web app or telnet, with print commands like Serial Monitor
MIT License
613 stars 127 forks source link

A couple suggestions #26

Closed GitBeagle closed 6 years ago

GitBeagle commented 6 years ago

After a little more understanding of your code I see the custom callback function that will easily accomplish what I was trying to do with this suggestion in a much better way.

Thank you again...

First, thank you for a great troubleshooting tool!

A have two suggestions. The "m" command only shows the free heap memory which is certainly useful. I have added the flash chip size, sketch size and free sketch space.

//Added the following lines to get more info; 
telnetClient.print("* Flash Chip Size: "); 
telnetClient.println(ESP.getFlashChipSize()); 
telnetClient.print("* Sketch Size: "); 
telnetClient.println(ESP.getSketchSize()); 
telnetClient.print("* Free Sketch Space: "); 
telnetClient.println(ESP.getFreeSketchSpace());

This could arguably be included in the second but I like them separate.

The second suggestion is to add a flag to enable some output configured in the user's sketch triggered by a command. The existing mechanisms are great for periodic diagnostic messages. I often find the desire for diagnostic information on command.

Added to RemoteDebug.h in the public section:

 boolean userInfo;

Added to RemoteDebug.cpp:

help.concat("    u -> trigger user info\r\n");

and

       } else if (_command == "u") {
    // Set flag to enable output of user configured data
    // User must set the flag false
    userInfo = true;
    telnetClient.printf("* User info triggered:\r\n");

Then the user can add something like this to the loop section:

if(Debug.userInfo) {
    // Add code here to output disgnostic information
    INFO("User Info Flag detected\n");
    Debug.userInfo = false;  // Set the flag false to prevent repeating the information
}

Thank you for your great work and consideration of these suggestions.

John