Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove boot rollover code #75

Closed
nateinaction opened this issue Jan 6, 2025 · 4 comments
Closed

Remove boot rollover code #75

nateinaction opened this issue Jan 6, 2025 · 4 comments
Labels
good first issue Good for newcomers

Comments

@nateinaction
Copy link
Member

pysquared tracks how many boot cycles a system has gone through by storing a count in a byte in persistent memory. We believe that the count will automatically rollover after it hits 255 but we have added a safety catch that forces a rollover at 200:

if self.c_boot > 200:
self.c_boot = 0

To improve code flow and reduce complexity we could remove this rollover code if someone proves that we don't need it...

Thoughts on how to test:
Create a simple/blank main.py, on boot set a byte in persistent memory to 255, add 1 to that byte and set it, read the byte. If the byte reads 0 and no errors are found, we should be able to remove this code.

@nateinaction nateinaction added the good first issue Good for newcomers label Jan 6, 2025
@Mikefly123
Copy link
Member

I concur on this. For whomever decides to tackle this I believe you can also run the test from the REPL using the following lines of code:

from pysquared import cubesat as c #If not already imported

c.c_boot = 255
print(c.c_boot)

c.c_boot += 1
print(c.c_boot)

@Alandlt15
Copy link
Contributor

I gave this a shot using Michael's suggestion by using the REPL.

After adding 1 to c.c_boot, it kept staying at 255. I'm a little unsure on what I should do next.

@nateinaction
Copy link
Member Author

nateinaction commented Jan 7, 2025

It looks like bitflags is a library that we created. It is possible to add automatic rollover to the entire library if that's the behavior we prefer. Are we using this anywhere else that would expect different behavior?

https://github.com/proveskit/circuitpy_flight_software/compare/main...bitflagrollover?expand=1#diff-e3516aa414af49bb3696ce619921f6e94007c64d7e26589d3e3e6ffe43ccacfdL46-R47

@nateinaction
Copy link
Member Author

Completed in #87. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants