CreaTe-M8-BME / CreaTeBME

Python Package for interfacing the bluetooth IMU module for CreaTe M8 BME.
GNU General Public License v3.0
0 stars 2 forks source link

Repeat recording #5

Closed Frank-Bosman closed 5 months ago

Frank-Bosman commented 1 year ago

Repeat recording

Currently to repeat a recording an new SensorEmulator should be made. This is because it can not start the timer again as that would recreate an existing thread.

To fix this I did the following in the PlotterDemo, but it is kinda messy because you reassign the manager.

 if not manager.is_running():
        print(f"Emulation ended, {'restarting..' if repeat_recording else 'shutting down...'}")
        if repeat_recording and not live_data_mode:
            manager.stop()
            manager = SensorEmulator(recording_file)
            manager.start()
        else:
            plt.close("all")

Recreate the bug

Start an emulator, stop it and then start it again:

manager = SensorEmulator('demoRecording')
manager.start()
time.sleep(1)
manager.stop()
manager.start()
time.sleep(2)
manager.stop()
JonaMata commented 1 year ago

When fixing this, do you think automatically repeating the recording as long as the emulator runs would be okay?

FrankBosman commented 6 months ago

When fixing this, do you think automatically repeating the recording as long as the emulator runs would be okay?

yeah, just repeat it automatically until they call manager.stop. Furthermore, make it an opt-in feature.