Skip to content

Commit

Permalink
update board select default auto
Browse files Browse the repository at this point in the history
  • Loading branch information
Neutree committed Jul 20, 2020
1 parent c217f7b commit d9b2e5d
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 44 deletions.
93 changes: 93 additions & 0 deletions boards_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"Auto": {
"lang": {
"en": "Auto",
"zh": "自动选择"
},
"type": null
},
"Sipeed Maix Dock": {
"lang": {
"en": "Sipeed Maix Dock",
"zh": "Sipeed Maix Dock"
},
"type": "dan"
},
"Sipeed Maix Bit ( with Mic )": {
"lang": {
"en": "Sipeed Maix Bit ( with Mic )",
"zh": "Sipeed Maix Bit ( 带麦克风 )"
},
"type": "bit_mic"
},
"Sipeed Maix Bit (No Mic)": {
"lang": {
"en": "Sipeed Maix Bit (No Mic)",
"zh": "Sipeed Maix Bit (无麦克风)"
},
"type": "bit"
},
"Sipeed Maixduino": {
"lang": {
"en": "Sipeed Maixduino",
"zh": "Sipeed Maixduino"
},
"type": "goE"
},
"Sipeed Maix Amigo": {
"lang": {
"en": "Sipeed Maix Amigo",
"zh": "Sipeed Maix Amigo"
},
"type": "goE"
},
"Sipeed Maix Cube": {
"lang": {
"en": "Sipeed Maix Cube",
"zh": "Sipeed Maix Cube"
},
"type": "goE"
},
"Sipeed Maix Go ( open-ec & new CMSIS-DAP )": {
"lang": {
"en": "Sipeed Maix Go ( open-ec & new CMSIS-DAP )",
"zh": "Sipeed Maix Go ( open-ec 或新 CMSIS-DAP )"
},
"type": "goE"
},
"Sipeed Maix Go ( Old CMSIS-DAP )": {
"lang": {
"en": "Sipeed Maix Go ( Old CMSIS-DAP )",
"zh": "Sipeed Maix Go ( 旧版 CMSIS-DAP )"
},
"type": "goD"
},
"Sipeed Maix Nano": {
"lang": {
"en": "Sipeed Maix Nano",
"zh": "Sipeed Maix Nano"
},
"type": "goE"
},
"M5StickV": {
"lang": {
"en": "M5StickV",
"zh": "M5StickV"
},
"type": "goE"
},
"Kendryte KD233": {
"lang": {
"en": "Kendryte KD233",
"zh": "Kendryte KD233"
},
"type": "kd233"
},
"kendryte Trainer": {
"lang": {
"en": "kendryte Trainer",
"zh": "kendryte Trainer"
},
"type": "trainer"
}
}
6 changes: 3 additions & 3 deletions helpAbout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import time

versionMajor = 1
versionMinor = 5
versionDev = 5
versionMinor = 6
versionDev = 0

date = "2020.02.17"
date = "2020.07.20"

def strAbout():
pathDirList = sys.argv[0].replace("\\", "/").split("/")
Expand Down
48 changes: 18 additions & 30 deletions kflash_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,17 @@ def initVar(self):
for key in self.eraseTemplateConfigs:
config[self.eraseTemplateConfigs[key]["lang"][current_lang]] = self.eraseTemplateConfigs[key]["config"]
self.eraseTemplateConfigs = config
# load boards info
self.boardsInfo = {}
boardsInfoPath = "boards_info.json"
if os.path.exists(boardsInfoPath):
with open(boardsInfoPath) as f:
self.boardsInfo = json.load(f)
# convert language to local
boards = {}
for key in self.boardsInfo:
boards[self.boardsInfo[key]['lang'][current_lang]] = self.boardsInfo[key]['type']
self.boardsInfo = boards

def setWindowSize(self, w=520, h=550):
self.resize(w, h)
Expand Down Expand Up @@ -280,16 +291,8 @@ def initWindow(self):
boardSettingsGroupBox.setLayout(boardSettingsLayout)
self.boardLabel = QLabel(tr("Board"))
self.boardCombobox = ComboBox()
self.boardCombobox.addItem(parameters.SipeedMaixDock)
self.boardCombobox.addItem(parameters.SipeedMaixBitMic)
self.boardCombobox.addItem(parameters.SipeedMaixBit)
self.boardCombobox.addItem(parameters.SipeedMaixduino)
self.boardCombobox.addItem(parameters.SipeedMaixGo)
self.boardCombobox.addItem(parameters.SipeedMaixGoD)
self.boardCombobox.addItem(parameters.M5StickV)
self.boardCombobox.addItem(parameters.KendryteKd233)
self.boardCombobox.addItem(parameters.kendryteTrainer)
self.boardCombobox.addItem(parameters.Auto)
for key in self.boardsInfo:
self.boardCombobox.addItem(key)
self.burnPositionLabel = QLabel(tr("BurnTo"))
self.burnPositionCombobox = ComboBox()
self.burnPositionCombobox.addItem(tr("Flash"))
Expand Down Expand Up @@ -1077,7 +1080,7 @@ def detectSerialPortProcess(self):

def programExitSaveParameters(self):
paramObj = paremeters_save.ParametersToSave()
paramObj.board = self.boardCombobox.currentText()
paramObj.board = self.boardCombobox.currentIndex()
paramObj.burnPosition = self.burnPositionCombobox.currentText()
paramObj.baudRate = self.serailBaudrateCombobox.currentIndex()
paramObj.skin = self.param.skin
Expand Down Expand Up @@ -1115,7 +1118,9 @@ def updateFrameParams(self):
else:
self.fileSelectShow(None, path, addr, firmware, enable=enable, loadFirst = False)
count += 1
self.boardCombobox.setCurrentText(self.param.board)
if type(self.param.board) == str:
self.param.board = 0
self.boardCombobox.setCurrentIndex(self.param.board)
self.burnPositionCombobox.setCurrentText(self.param.burnPosition)
self.serailBaudrateCombobox.setCurrentIndex(self.param.baudRate)
if self.param.slowMode:
Expand Down Expand Up @@ -1194,24 +1199,7 @@ def getSerialSettings(self):
color = False
board = "dan"
boardText = self.boardCombobox.currentText()
if boardText == parameters.SipeedMaixGo:
board = "goE"
elif boardText == parameters.SipeedMaixGoD:
board = "goD"
elif boardText == parameters.SipeedMaixduino:
board = "maixduino"
elif boardText == parameters.SipeedMaixBit:
board = "bit"
elif boardText == parameters.SipeedMaixBitMic:
board = "bit_mic"
elif boardText == parameters.KendryteKd233:
board = "kd233"
elif boardText == parameters.kendryteTrainer:
board = "trainer"
elif boardText == parameters.M5StickV:
board = "goE"
elif boardText == parameters.Auto:
board = None
board = self.boardsInfo[boardText]

sram = False
if self.burnPositionCombobox.currentText()==tr("SRAM") or \
Expand Down
11 changes: 1 addition & 10 deletions parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,7 @@
else:
configFilePath = os.path.join(os.getcwd(), configFileName)

SipeedMaixDock = "Sipeed Maix Dock"
SipeedMaixBitMic = "Sipeed Maix Bit ( with Mic )"
SipeedMaixBit = "Sipeed Maix Bit (Old)"
SipeedMaixGo = "Sipeed Maix Go ( open-ec & new CMSIS-DAP )"
SipeedMaixGoD = "Sipeed Maix Go ( Old CMSIS-DAP )"
SipeedMaixduino = "Sipeed Maixduino"
KendryteKd233 = "Kendryte KD233"
kendryteTrainer = "kendryte Trainer"
M5StickV = "M5StickV"
Auto = "Auto"


# get data path
pathDirList = sys.argv[0].replace("\\", "/").split("/")
Expand Down
2 changes: 1 addition & 1 deletion paremeters_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ParametersToSave:

def __init__(self):
self.files = [] # [ (path, addr, firmware, enable), ...]
self.board = parameters.SipeedMaixBit
self.board = 0
self.burnPosition = tr_en("Flash")
self.baudRate = 2
self.skin = 2
Expand Down

0 comments on commit d9b2e5d

Please sign in to comment.