pez-globo / pufferfish-software

All software for the Pufferfish ventilator.
Apache License 2.0
0 stars 1 forks source link

Generate firmware log events & alarms for connection/disconnection to backend #392

Closed ethanjli closed 3 years ago

ethanjli commented 3 years ago

This PR fixes #353 by adding a message receipt timer to the Driver::Serial::Backend::Backend class with a timeout of 500 ms and using it to set a boolean flag in the store about whether the connection is active, and by adding a Driver::Serial::Backend::AlarmsService class to update the events log on rising and falling edges for that flag.

This PR also lightly refactors the various AlarmsService classes by taking the responsibility for updating store.active_log_events() out of their transform methods; instead, main.cpp calls alarms_manager.transform(store.active_log_events()) once during every iteration of the main loop.

Finally, this PR changes the behavior of the Nucleo's LED LD1 so that it blinks slowly when running normally and is solid-on when an alarm is active. This allows some visibility into the state of alarms on the Nucleo board when it's not connected to the frontend.

For records-keeping:

  1. This project is licensed under Apache License v2.0 for any software, and Solderpad Hardware License v2.1 for any hardware - do you agree that your contributions to this project will be under these licenses, too? Yes
  2. Were any of these contributions also part of work you did for an employer or a client? No
  3. Does this work include, or is it based on, any third-party work which you did not create? No
ethanjli commented 3 years ago

@rohanpurohit Can you try this out on your setup to see if it works for you?