• I have a problem of mostly my own making. My clock app writes various sensor settings to a log file and I have a python script that I can use to connect to the watch and download this log file (which is split by Bangle).

    However, deleting the files via the script doesn't quite have any effect on the files because my app I believe holds on to the file handle and keeps writing to the same file.
    To work around this, I put in a watch reboot using E.reboot() and this I believe clears the file handle and the files are actually gone for good and after reboot the app restarts and opens a new file handle.

    Now rebooting is a bazooka where a restart App would just do. If I could invoke a function on the app to tell it to reopen the file, that would be even more precise. Long-pressing BTN3 already does a reload, how can I mimic this via code?

    There is also the possibility I am using the StorageFile API incorrectly. There isn't a StorageFile.close() or Storage.close() so I didn't think I would need to close the file after each update and open it before each update.

    Any suggested approaches welcome. Thanks

    Python script for sync
    Custom BangleJS App

    Update: Reboot actually doesn't work. It leaves the watch storage in an inconsistent state and the app is unable to update the file anymore. Keeps throwing Uncaught Error: Unable to find or create file. Basically I have to now invoke Storage.eraseAll() and start fresh :(

    I'll have to think of a custom roll-over or something so the older log files are cleared out after it has been synced with a laptop.

About

Avatar for Robin @Robin started