I have an Arduino Leonardo that is used with hardware to provide inputs to Windows. Those inputs have to be reported to an XML file every ~100ms. After several failed attempts at writing the bridge between the two myself, I came across GoBetwine (latest version).
The XML file is short, and with its ability to edit text files, GoBetwine successfully is updating the XML file with its new values with no larger than a 250ms delay. However, once GoBetwine reaches its approximately 66th command, it ceases to respond. Copying & editing of the XML ceases, and the only response that can be found is if the Arduino continues its output, GoBetwine's memory usage continues to grow, according to Windows.
Here's what GoBetwine is doing every loop (using GoBetwine's default command names):
#S|CPFIL[]# //Copies a blank XML template to a subfolder where the string will be written
#S|LGFIL|[] //Fills the XML with its needed variables and syntax
#S|CPFIL[]# //Copies the edited XML to the real XML's directory
Up until the ~66th command (22nd loop), everything works. The Arduino Leonardo functions fine on its own and continues to do so even after GoBetwine stops. The Leonardo does not require any input from GoBetwine. Adding delays to the Arduino did nothing to help; the crashes are related proportionally to the number of commands performed since opening GoBetwine. After crashing, GoBetwine's cooperation is random, usually crashing after completing its first command. After some time or attempts, GoBetwine will work again.
To summarize GoBetwine's behavior:
- GoBetwine is able to read as many serial.prints the Arduino spits out as long as they are not commands (although it lags behind)
- GoBetwine stops responding after ~66 commands
- GoBetwine continues to consume more memory despite no response
- The type of command does not matter (making the LGFIL comments and then vice versa the CPFILs)
- Delaying the Arduino's output does not change anything
- Windows does not pronounce the program as not responding, but the program cannot be interacted with
- The crash's cause persists even after exiting GoBetwine, but only randomly.
- GoBetwine never fails to complete its last issued command, meaning the error is occurring inbetween commands.
(ie: the entire string is written, and the last copy command successfully copied)
An additional concern with GoBetwine:
Since the output occurs several times a second, GoBetwine's log file (gobetwine.txt) will quickly become several kb in size. The time that GoBetwine will be in constant use will be anywhere from 30 minutes to an hour, meaning the log file may become several mb in size. Eventually, most programs become slowed once opening large text files. Is there any command to purge the log file, or would you need to tell Windows to restrict programs from editing any files in the directory to prevent GoBetwine from writing to the log?