I am updating my Mechatronics course labs to use VSCode+PlatformIO instead of ArduinoIDE. For the most part, it has been going great and I really think the students are going to like it. However, I ran into one minor problem.
In one of our labs, we have students learn how to use the map() function and also create a custom y=mx+b function to convert between desired servo position and the associated microseconds from the servo motor datasheet. In the past, we have always has them use the parseInt or parseFloat function to read from the serial port. Of course, in the ArduinoIDE we always had to have them set the EOL to “None”. This was necessary because parseInt is a little deficient in that it sees the original int correctly, but then parses the EOL also and returns zero.
However, the PlatformIO console doesn’t have an option for EOL=None. We had been trying with
monitor_filters = send_on_enter
monitor_eol = LR
but it fails for the same reason it would fail in ArduinoIDE if we didn’t set the serial monitor EOL to None.
So, we found two workarounds, namely using Serial.readString() and then toInt(). My question is whether the PlatformIO team would be open to adding another option for monitor_eol, namely NONE. I think the code change would be as simple as adding the following 2 lines of code to the SendOnEnter class in the send_on_enter.py file.
if self.options.get("eol") == "CR": self._eol = "\r" elif self.options.get("eol") == "LF": self._eol = "\n" + elif self.options.get("eol") == "NONE": + self._eol = "" else: self._eol = "\r\n"
This would allow for a similar option set for the EOL as the ArduinoIDE and would make the parseInt not be broken for use with the PlatformIO monitor.