pez-globo / pufferfish-software

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

Add RTC support #199

Closed ethanjli closed 3 years ago

ethanjli commented 4 years ago

We will need to support a hardware RTC module on the Raspberry Pi so that it can keep accurate time even when the RPi is shut off and disconnected from wi-fi. This will be either an I2C or SPI device and we will need to have a kernel module driver supporting it so that it adjusts the RPi's system time.

ethanjli commented 3 years ago

Attached are the instructions @mathengejob found to work in setting up the MAX3231 RTC. I will try to follow these instructions on my own Raspberry Pi with my own MAX3231 module and report my findings; afterwards, we can work on making a script to automatically apply these setup steps.

Configuring RTC Time as defualt for Raspberry PI.pdf

ethanjli commented 3 years ago

My findings from trying to follow Job's instructions:

Right now our deployment scripts are not really designed to have the system restart in between. I think what we could do is have a setup_rtc.sh script which runs at the start of the deployment pipeline (maybe even before install.sh) and can be run multiple times (detecting what it needs to do based on what's inside /boot/config.txt) so that we don't try to run install.sh multiple times - as that would slow down the deployment process by causing yarn build to be run twice. Another option is to move yarn build into deploy.sh instead of install.sh which could make more sense; then we could run setup_rtc.sh at the start of deploy.sh instead. This is probably the best option.

The other option is to include something to track and check the phase of the deployment process in a file on the filesystem, but that seems like it could be more error-prone in edge cases.

mathengejob commented 3 years ago

Well noted,
Steps 1-6 will be done before the creation of the OS- image Step 7 is to be run during , by the end user using an interface, only once when commissioning, assuming the Wifi feature will be turned off.