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

program_radio.py failing on exit, needs better semantic exit codes #23

Open
pencerw opened this issue Mar 5, 2018 · 0 comments
Open
Assignees

Comments

@pencerw
Copy link
Member

pencerw commented Mar 5, 2018

Python doesn't seem to want to exit with no exit code. Which is convenient, because I actually need better semantic exit codes in order for this to wire up to Tulip nicely :)

What I need is a list of exit codes that mean specific things. There are a few reasons that this script would fail, and Tulip needs to know a little more about why it does so. At minimum, the script should report back one code when avrdude fails and another when usage is incorrect. More testing would be needed to determine whether there are other exit conditions that need to be tracked, but our current Tulip process does look for avrdude's exit code when it calls that directly and i'd like to be able to continue that practice. Better yet, we should look at the different ways that avrdude fails (not connected to a radio in the first place, verification fails, wrong programmer specified) and see if any of them are worth reporting back to Tulip.

Full output here:
`pi@TPR-0:~/ops_tools $ python program_radio.py
program_radio.py:39: RuntimeWarning: A physical pull up resistor is fitted on this channel!
GPIO.setup(2, GPIO.IN, pull_up_down=GPIO.PUD_UP)

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9108 (probably t25)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "/home/pi/ops_tools/data/3044a9415d9b2becb2ee44bd759a0c9f6be66109.hex"
avrdude: input file /home/pi/ops_tools/data/3044a9415d9b2becb2ee44bd759a0c9f6be66109.hex auto detected as Intel Hex
avrdude: writing flash (1454 bytes):

Writing | ################################################## | 100% 0.61s

avrdude: 1454 bytes of flash written
avrdude: verifying flash memory against /home/pi/ops_tools/data/3044a9415d9b2becb2ee44bd759a0c9f6be66109.hex:
avrdude: load data flash data from input file /home/pi/ops_tools/data/3044a9415d9b2becb2ee44bd759a0c9f6be66109.hex:
avrdude: input file /home/pi/ops_tools/data/3044a9415d9b2becb2ee44bd759a0c9f6be66109.hex auto detected as Intel Hex
avrdude: input file /home/pi/ops_tools/data/3044a9415d9b2becb2ee44bd759a0c9f6be66109.hex contains 1454 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.50s

avrdude: verifying ...
avrdude: 1454 bytes of flash verified
avrdude: reading input file "/home/pi/ops_tools/temp/eeprom"
avrdude: input file /home/pi/ops_tools/temp/eeprom auto detected as Intel Hex
avrdude: writing eeprom (32 bytes):

Writing | ################################################## | 100% 0.04s

avrdude: 32 bytes of eeprom written
avrdude: verifying eeprom memory against /home/pi/ops_tools/temp/eeprom:
avrdude: load data eeprom data from input file /home/pi/ops_tools/temp/eeprom:
avrdude: input file /home/pi/ops_tools/temp/eeprom auto detected as Intel Hex
avrdude: input file /home/pi/ops_tools/temp/eeprom contains 32 bytes
avrdude: reading on-chip eeprom data:

Reading | ################################################## | 100% 0.02s

avrdude: verifying ...
avrdude: 32 bytes of eeprom verified

avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)

avrdude done. Thank you.

Traceback (most recent call last):
File "program_radio.py", line 47, in
exit()
TypeError: 'int' object is not callable
pi@TPR-0:~/ops_tools $ `

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

No branches or pull requests

2 participants