- the logic is preatty complex and cannot be loaded into the small memory of the ATmega32u4;
- we need to interact with a logging system and a database, and it's much more easy to do that using already developed python libraries than reinventing the wheel in C.
The engine is based on three .PY files: the main file defining the logic and two simple library defining the bridge and the database objects.
- wnw_engine.py => the python script running the logic of the engine;
- wnw_bridge.py => the python class (WnWBridge) used to access the mailbox and share data and request with the lower layer (the sketch running on the ATmega 32u4 side);
- wnw_database.py => the python class (WnWDatabaseConnection) managing the connection to the database and wrapping the communication with it.
I created a shell script to automatically run the engine as soon as the system (Linux) completes the startup procedure. In order to be sure that the engine is always up and running, I added a line to the crontab calling the same script every minute. The script check if the engine is working and re-start it only in case it's not running.
No comments:
Post a Comment