mirror of
https://github.com/avrdudes/avrdude.git
synced 2026-09-29 04:18:54 +03:00
Only allow access to flash and EEPROM tabs after reading signature
Also mark by green or red color if the signature matches the selected device, and log a if they do not match. Tune the error and warning colors a bit.
This commit is contained in:
@@ -241,8 +241,8 @@ class adgui(QObject):
|
||||
# level to color mapping
|
||||
colors = [
|
||||
'#804040', # MSG_EXT_ERROR
|
||||
'#603030', # MSG_ERROR
|
||||
'#605000', # MSG_WARNING
|
||||
'#A03030', # MSG_ERROR
|
||||
'#A08000', # MSG_WARNING
|
||||
'#000000', # MSG_INFO
|
||||
'#006000', # MSG_NOTICE
|
||||
'#005030', # MSG_NOTICE2
|
||||
@@ -463,12 +463,22 @@ class adgui(QObject):
|
||||
self.pgm.teardown()
|
||||
|
||||
def read_signature(self):
|
||||
sig_ok = "background-color: rgb(255, 255, 255);\ncolor: rgb(0, 100, 0);"
|
||||
sig_bad = "background-color: rgb(255, 255, 255);\ncolor: rgb(150, 0, 0);"
|
||||
if self.connected:
|
||||
m = ad.avr_locate_mem(self.dev, 'signature')
|
||||
if m:
|
||||
ad.avr_read_mem(self.pgm, self.dev, m)
|
||||
self.progress_callback(100, 0, "", 0) # clear progress bar
|
||||
read_sig = m.get(3)
|
||||
if read_sig == self.dev.signature:
|
||||
self.memories.deviceSig.setStyleSheet(sig_ok)
|
||||
else:
|
||||
self.memories.deviceSig.setStyleSheet(sig_bad)
|
||||
self.log("Signature read from device does not match config file",
|
||||
ad.MSG_WARNING)
|
||||
self.memories.flash.setEnabled(True)
|
||||
self.memories.eeprom.setEnabled(True)
|
||||
sigstr = read_sig.hex(' ').upper()
|
||||
self.memories.deviceSig.setText(sigstr)
|
||||
p = ad.locate_part_by_signature(ad.cvar.part_list, read_sig)
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
@@ -182,7 +185,7 @@
|
||||
</widget>
|
||||
<widget class="QWidget" name="flash">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Flash</string>
|
||||
@@ -434,6 +437,9 @@
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="eeprom">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>EEPROM</string>
|
||||
</attribute>
|
||||
|
||||
Reference in New Issue
Block a user