I have made a few changes to the codebase.
- If there is no response from the Roomba (no data stream and no charging message) the data stream is started 5 times. If that has no effect, the Roomba is reset with an OC:7. This is repeated a few times. If that also does not get a response, a call-back function is triggered in the main Arduino sketch. This is a device trigger event that can get a response in Home Assistant with an automation. Although I was not able to test this properly, I can see the right commands being sent over serial (from the mock-up ESP running the same software connected to a PC);
- There are more call-back functions. A "started_cleaning event" is added;
- Latest libraries for I2C / MPU6050 are used;
- Extra's library with main-loop counter is changed. The counter now is an unsigned long to prevent rollover;
- The done cleaning event is also called in more states. For instance, when in "docking" state. This means that we can give the "docking" command while it's cleaning and the mapping will finish;
- The ESP exposes more information for troubleshooting to Home Assistant. For instance: The amount of free memory and heap fragmentation. This should give early signs of memory leaks;
- Newer version of ArduinoJSON library is used. The amount of allocated memory is better matched now;
- Roomba-state on startup is now "docked" and availability states are set;
- ESP8266 is running on 160MHz now. This seems to give the needed headroom for a stable WiFi connection;
- Full MPU data is now available for the posing algorithm in a stable manner;
Newer software will be added to the files section here.
I'm ready for more!
It's clearly not done yet. One of the weird things I can see is the amount of "main loops per second" will sometimes be doubled with some sketch-uploads. If I re-upload the same sketch the next day, the number will drop again. I was hoping it had something to do with the way I count the number of main loops, but I can't find the problem. There is no rollover.
Seems to be solved by removing the memory snapshot from the main loop. Running at ~25k loops/sec when docked now and ~10k when cleaning with full logging, pose calculation and magic.
It has plenty of spare processing at the moment, so I will ignore it for now. Any ideas?
Next up, scripting?
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.