|
|
|
working serial parser Sunday, January 4 2026
I've had coffee every morning for so many days now that today I had tea just because I was a little sick of coffee. I also took a recreational 120 mg dose of pseudoephedrine n the late morning in hopes that it would help me power through the many problems with my nascent slave Arduino serial parsing system.
A big problem with the serial parser was that the Atmega328 was losing random characters from the serial stream, which was making it difficult to parse reliably. I asked ChatGPT about how to deal with this, and it had some suggestions, none of which helped. For a time this put me in a funk, as it suggested that perhaps an Atmega328 was insufficiently powerful to do what I needed.
But I didn't give up. I tried commenting out code in the main loop, and, to my delight, that totally fixed the problem. Then I saw why: the code I'd commented out was a system for reading any data that appears on the serial port, and it had been running at the same time as the serial parser. With both systems trying to read serial data from the same port and doing different things with it, it made sense that each would only get a portion of that data. I saw that I now needed to have separate serial modes for the slave. If the serial parser wasn't being used, I could forward serial data to the master. But if I wanted to use the serial parser, I had to turn that functionality off.
Later I asked ChatGPT for clarifications of some data structures it had created for the serial parser, and once I fully understood those and had a way to dump their data, I could see that one of the parsers wasn't configured correctly. This turned out to be the result of an arbitrary 70-character cutoff for configuration strings, something I was easily able to fix. I also fixed a series of problems with handshaking between the master in the slave to return a packet of parsed data. Once I had all of these things fixed, the parser started to work reliably. It seemed like I really would be able to use an Arduino slave to handle all the logic necessary to grab data from the SolArk inverter. And, since the parser is reasonably generic, I would be able to use it for many other tasks.
It was after 4:00pm and the light was getting a little murky when I took Charlotte for her walk this evening. It was another one where we went up the Farm Road and then trudged home off-trail east of the wetlands east of the Farm Road. This is a path I take to avoid disturbing Georges and his family at the farm at the end of the Farm Road when he is up from the City on the weekends.
Meanwhile Gretchen had met for lunch with our friend Falafel Cathy at Mother Fucking Earth, and she'd bought some groceries, including much-needed mushrooms and vegetables. Then she went to pilates in Glenford again and later prepared elaborate meal from a recipe she'd found on the New York Times website. In involved a Middle Eastern mix of couscous and orzo, marinaded tofu, chickpeas, spinach, and some sort of sauce. For alk the work she put into it, I didn't think it was all that great, but Gretchen wouldn't stop talking about how amazing it was.
I ended up staying up past 1:00am on that pleasant combination of pseudoephedrine and diphenhydramine that I've mentioned before. I was ironing out bugs in my Arduino slave parser code, and at times I felt like perhaps the diphenhydramine was clouding my thoughts a bit too much to be doing such work. But I kept at it, and by the time I went to bed (on the laboratory bean bag) I was satisfied with all that I'd managed to get done today.
For linking purposes this article's URL is: http://asecular.com/blog.php?260104 feedback previous | next |