TJREVERB / pfs

Flight software for TJREVERB's nanosat.
7 stars 5 forks source link

I2C time.sleep() issue #94

Closed srikarg89 closed 4 years ago

srikarg89 commented 4 years ago

Currently, both EPS and AntennaDeployer use the following sequence of actions to read data: 1) I2C write the command for the data you want to read 2) time.sleep() - Wait for the device to update a buffer with the data that was queried 3) I2C read from a specified register

The problem with the above sequence is that the time.sleep generally requires a long sleep (approximately 0.5 seconds in most cases). Because EPS and AntennaDeployer have a few things to read every MCL cycle, such as which pins are active, which pins have power, getting antenna deployment status, and getting temperature, the time.sleep will cause the MCL loop to be extremely slow.

srikarg89 commented 4 years ago

One possible solution would be to not read the above data everytime, however this would make the SFR out of date most of the time. Instead, we can just read whenever important (for example reading Antenna Deployment status right after deploying to confirm that it was deployed).