-
Notifications
You must be signed in to change notification settings - Fork 132
Enhanced Serial Monitor
The idea is to give the serial monitor a little more power to be able to specify different formats for the data that the user inputs in the text box. In a sense this would be a "plug-in" function that's inserted before calling write(bytes[]).
Sending the content of a file (based on URI?) over the serial connection (marcelo: I like the URI idea).
Sending hexadecimal data
Sending binary data
Sending strings
Combining all the above in one line
Have a combo box or radio button to switch between normal and enhanced modes.
Normal mode is what we have today.
In enhanced mode, the text is parsed and the following options are available:
!h AEFFA2 Hexadecimal values to be parsed in pairs so as to produce values in 0-255 range.
!b Same but for binary.
!s "string" for string data. Line ending specified in the checkbox as we have it now, or introduced by the user with \n.
!f "file path" to read the bytes from a file.
!d for decimal
Anything that is not part of the character set for the given format or special symbol, is interpreted as separator. The idea behind this is to allow copy paste of long streams of numbers coming from another program, which might be using commas or semi-colons or spaces as separator. So for instance !h FF,AA,BB would be valid and !h AA BB CC would be valid as well.
Anything that comes after a type specifier is interpreted as that type until a new specifier shows up.
A somewhat interesting byproduct of this, is the fact that types can be mixed. Something like !h AA BB !b 0100 !f "file.dat" is valid. Useful for those cases where you are inputting numbers in hex but you find out in the docs that you should send a 237 instead of FE somewhere, and you don't feel like opening the calculator to convert 237 to hex.
In enhanced mode, if the text doesn't start with a specific modifier, it's interpreted as the string type.
Caveat: format specifiers can appear on a string so there's the possibility of unwanted effects due to the user not knowing that typing !hello puts the terminal in hex mode.
There's no enhanced nor normal mode. There's a combo box with the data types. String, binary, hex, and so on.
User selects the data type and types stuff in the text box. You can't mix data types obviously.