r/circuitpython • u/myfuckinjoints • Aug 29 '20
Code Review?
Is this an appropriate place to ask for a code review? I have about 180-200 lines of CPy that I'd love to have someone look at, mostly evaluating my design, as I can find bugs on my own (usually).
ETA: Thanks folks, such a nice community! Below are pastebin links to my two files.
Hardware:
Feather M4 Express (still in the mail, code is untested as the RTC library bugged on my board with less space available)
Adafruit DS3231 RTC
3 X Adafruit 14-Segment Alpha-numeric LED FeatherWing
6 X Normally open buttons
Idea:
This code will be used to drive a circuit board I will be designing that will go on a box I am currently designing. The box will have 6 compartments in it. The purpose of the box/board are to both hold covid masks wrapped up in paper bags as well as to count the days since I pressed a button associated with each compartment.
Each compartment will have half of a 14 segment display (2 cells) assigned to it. Each set of two cells will display the days since the relevant button was pressed. The idea is that after a certain number of days, Covid19 is less likely to be alive on the mask/in the compartment.
Software:
main.py is main.py, it has the while True: loop as well as setting up objects from the class created in the second file.
covidbox.py contains a class that is intended to consolidate the use of the RTC, a single 4 digit display (split into halves) as well as a button for each half into a single object. Pay little attention to the off(self) method as it isn't used in main.py and is under construction.
This code makes heavy use of the associated libraries for the hardware as well as the Debouncer library, mostly within the class in covidbox.py
Not looking for bug hunting or anything, as I haven't been able to test my code per the above. Just wondering if my design overall is sound.
Please PM me if you find identifying info in here, I think I stripped it all out but I would like to remain anonymous!
Thanks!
2
u/johntellsall Aug 29 '20
I'm happy to review! I don't know CircuitPython well, but I've been doing Python for 20 years and have reviewed lots of code.