-
Notifications
You must be signed in to change notification settings - Fork 194
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
Add ATmega8 and fix some minor bugs with program-avr-spi applet #736
base: main
Are you sure you want to change the base?
Add ATmega8 and fix some minor bugs with program-avr-spi applet #736
Conversation
…fied check to before using the device object
if device.erase_time is not None: | ||
avr_iface.erase_time = device.erase_time | ||
if args.operation in (None, "identify"): | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This skips over iface.programming_disable()
.
@@ -256,12 +256,15 @@ async def interact(self, device, args, avr_iface): | |||
"{:02x} {:02x} {:02x}".format(*signature), | |||
"unknown" if device is None else device.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say add programming_disable
after the identify call here, and enable it once we operate on a known device.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, I'm wondering if it might be worth explicitly calling programming_disable
before the return
, and making ProgramAVRError
also call programming_disable
, unless I'm misinterpreting the reason for this suggestion or how the code works (both are entirely possible). I think any exception will leave it in this same state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless I'm misinterpreting the reason for this suggestion or how the code works (both are entirely possible)
There's a programming_disable
call at the very end that your return
was skipping over.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, but I think that any raised ProgramAVRError
will also miss the programming_disable
call, unless I'm misunderstanding. If it is doing that, would it be worth calling programming_disable
on all of the errors and explicitly doing it early for the case where the operation is blank or identify
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about putting the body of the function into a try..finally block which will call programming_disable()
? You'd want the initialization of the interface and the initial programming_enable()
command to be outside of the block, of course.
There are two changes here:
erase_time
was chosen to match the other entry with anerase_time
, since not having one seemed to lead to issues with verifying what had been written, and this one seems to work fineprogram-avr-spi
applet so it doesn't give a traceback whenever you're doing something with an unidentified deviceFor an explanation of the second one, see the following output I got before adding the ATmega8:
This is actually the result of two different things that needed to be fixed:
device
object before it checked to see if the device existed (so this change brings that further up)I don't know if a simple
return
is what's wanted here, but I assume the point of the check was to not error out on an unidentified device because it's already done everything that's needed for theidentify
command