diff --git a/Ai-Thinker_TB_Tools.py b/Ai-Thinker_TB_Tools.py index f58f8c3..69c96e1 100644 --- a/Ai-Thinker_TB_Tools.py +++ b/Ai-Thinker_TB_Tools.py @@ -26,7 +26,7 @@ class MainForm(QTabWidget): def __init__(self,parent=None): super().__init__(parent) - self.setWindowTitle("安信可TB模块调试工具 " + __version__) + self.setWindowTitle("Anxinke TB module debugging tool " + __version__) if not os.path.exists("combine/") : os.makedirs("combine/") @@ -44,11 +44,11 @@ def __init__(self,parent=None): self.tab_Dev_Doc=Dev_Document() self.tab_FW_Tools=FW_Tools() - self.addTab(self.tab_TB_Tools, "烧录固件") - self.addTab(self.tab_SP_Tools, "串口调试") - self.addTab(self.tab_FW_Market,"固件市场") - self.addTab(self.tab_Dev_Doc, "开发资料") - self.addTab(self.tab_FW_Tools, "合并固件") + self.addTab(self.tab_TB_Tools, "Burn firmware") + self.addTab(self.tab_SP_Tools, "Serial debugging") + self.addTab(self.tab_FW_Market,"Firmware market") + self.addTab(self.tab_Dev_Doc, "Development materials") + self.addTab(self.tab_FW_Tools, "Merge firmware") self.currentChanged['int'].connect(self.tabfun) diff --git a/Dev_Document.py b/Dev_Document.py index 0c98991..0743776 100644 --- a/Dev_Document.py +++ b/Dev_Document.py @@ -92,7 +92,7 @@ def __init__(self,parent=None): self.waitPage.setGeometry(0, 0, 600, 350) self.waitPage.setAlignment(Qt.AlignVCenter) - self.waitPage.setText("
正在获取文档列表......
") + self.waitPage.setText("
Getting list of documents......
") self.waitPage.setAutoFillBackground(True) self.waitPage.setPalette(palette) @@ -125,7 +125,7 @@ def show_doc_list(self, tbody): self.TableWidget.verticalHeader().setVisible(False) # 隐藏垂直表头 self.TableWidget.horizontalHeader().setVisible(True) # 显示水平表头 - font = QFont('微软雅黑', 10) + font = QFont('Arial', 10) font.setBold(True) #设置字体加粗 self.TableWidget.horizontalHeader().setFont(font) #设置表头字体 @@ -135,7 +135,7 @@ def show_doc_list(self, tbody): self.TableWidget.horizontalHeader().setSectionResizeMode(0,QHeaderView.Stretch)#设置第一列宽度自动调整,充满屏幕 # self.TableWidget.horizontalHeader().setStretchLastSection(True) ##设置最后一列拉伸至最大 - self.TableWidget.setHorizontalHeaderLabels(['文档名称','文档介绍','操作']) #设置表头内容 + self.TableWidget.setHorizontalHeaderLabels(['file name','Document introduction','operating']) #Set header content self.TableWidget.horizontalHeader().setSectionsClickable(False) self.TableWidget.horizontalHeader().setStyleSheet('QHeaderView::section{background:green}')#设置表头的背景色为绿色 @@ -167,7 +167,7 @@ def show_doc_list(self, tbody): def buttonForRow(self,id): widget=QWidget() # 修改 - downloadBtn = QPushButton('下载') + downloadBtn = QPushButton('download') downloadBtn.setStyleSheet(''' text-align : center; background-color : NavajoWhite; height : 30px; @@ -184,7 +184,7 @@ def buttonForRow(self,id): def download(self, id): - fileName, ok = QFileDialog.getSaveFileName(self, "文件保存", "./combine/" + self.TableWidget.item(id, 0).text(), "All Files (*);;Bin Files (*.pdf)") + fileName, ok = QFileDialog.getSaveFileName(self, "Save file", "./combine/" + self.TableWidget.item(id, 0).text(), "All Files (*);;Bin Files (*.pdf)") if ok: print(fileName) @@ -192,7 +192,7 @@ def download(self, id): self.mThread.formSignal.connect(self.waitPag_State) self.mThread.start() - self.waitPage.setText("
正在下载文档......
") + self.waitPage.setText("
Downloading document......
") self.waitPage.show() self.waitPage.raise_() @@ -201,4 +201,4 @@ def waitPag_State(self, state): self.waitPage.hide() elif state == CMD_DOWNLOAD_OK: self.waitPage.hide() - QMessageBox.information(self,"温馨提示","下载成功!") + QMessageBox.information(self,"Warning","download successful!") diff --git a/FW_Combin_Tool.py b/FW_Combin_Tool.py index c86fc72..38340eb 100644 --- a/FW_Combin_Tool.py +++ b/FW_Combin_Tool.py @@ -49,7 +49,7 @@ def __init__(self,parent=None): line_3=QHBoxLayout() - btn_burn_triad=QPushButton("合并固件") + btn_burn_triad=QPushButton("Merge firmware") btn_burn_triad.clicked.connect(self.combin_fn) line_3.addWidget(btn_burn_triad) @@ -62,8 +62,8 @@ def __init__(self,parent=None): self.setLayout(self.layout) - def open_file_fn(self,action): #选择固件 - directory = QFileDialog.getOpenFileName(self, "选择要烧录的固件",'',"固件 (*.bin)") + def open_file_fn(self,action): #Select firmware + directory = QFileDialog.getOpenFileName(self, "Choose the firmware to burn",'',"firmware (*.bin)") if len(str(directory[0])) > 5 : if action == "boot": @@ -73,16 +73,16 @@ def open_file_fn(self,action): #选择固件 self.tbox_app_file.setText(str(directory[0])) self.tbox_app_file.setStyleSheet("background-color:LightGreen;") - def combin_fn(self):#合并固件 + def combin_fn(self):#Merge firmware if not os.path.exists(self.tbox_boot_file.text()) or os.path.getsize(self.tbox_boot_file.text()) > 0x4000: self.tbox_boot_file.setStyleSheet("background-color:red;") - self.log_string("Boot固件不存在或大小错误") + self.log_string("Boot The firmware does not exist or is the wrong size") return if not os.path.exists(self.tbox_app_file.text()) or os.path.getsize(self.tbox_app_file.text()) > 0x2C000: self.tbox_app_file.setStyleSheet("background-color:red;") - self.log_string("APP固件不存在或大小错误") + self.log_string("APP The firmware does not exist or is the wrong size") return if not os.path.exists("combine/") : os.makedirs("combine/") @@ -92,29 +92,29 @@ def combin_fn(self):#合并固件 boot_app_file_name= self.tbox_app_file.text().replace('.bin','_with_boot.bin') boot_app = open(boot_app_file_name, "w+b") - boot_app.write(boot.read()) # 将Boot固件放在合并后固件的前16K + boot_app.write(boot.read()) # Put the Boot firmware in the first 16K of the merged firmware boot.close() boot_app.seek(0x4000,0) app.seek(0x4000,0) - boot_app.write(app.read()) # APP 固件的 16K 之后的部分 位置不变 + boot_app.write(app.read()) # The position of the APP firmware after 16K remains unchanged boot_app.seek(0x2c000,0) app.seek(0x00000,0) - boot_app.write(app.read(0x4000)) # 将APP固件的前16K放在合并后固件的0x2C000的位置 + boot_app.write(app.read(0x4000)) # Place the first 16K of the APP firmware at the position of 0x2C000 of the merged firmware app.close() boot_app.seek(0, 0) file_content = boot_app.read() - crc32_result = zlib.crc32(file_content) & 0xffffffff # 计算整个文件的CRC + crc32_result = zlib.crc32(file_content) & 0xffffffff # Calculate the CRC of the entire file boot_app.seek(176 * 1024 - 4, 0) - boot_app.write(struct.pack('>I', crc32_result)) #RAM Code 前4个字节也放置CRC校验 + boot_app.write(struct.pack('>I', crc32_result)) #RAM Code The first 4 bytes are also placed with CRC check boot_app.seek(0, 2) - boot_app.write(struct.pack('>I', crc32_result)) #文件的最末尾处,放置CRC校验 + boot_app.write(struct.pack('>I', crc32_result)) #At the end of the file, place a CRC check boot_app.seek(0, 0) file_content = boot_app.read() @@ -122,7 +122,7 @@ def combin_fn(self):#合并固件 boot_app.close() - self.log_string("Combine OK!\r\nFirmware CRC32: " + hex(crc32_result) +"\r\nFirmware MD5: " + md5_result + "\r\n合并好的固件为:" + boot_app_file_name) + self.log_string("Combine OK!\r\nFirmware CRC32: " + hex(crc32_result) +"\r\nFirmware MD5: " + md5_result + "\r\nThe merged firmware is:" + boot_app_file_name) - def log_string(self, s): #Log窗口日志输出 + def log_string(self, s): #Log window log output self.tbox_log.append(s) \ No newline at end of file diff --git a/FW_Market.py b/FW_Market.py index d00d18c..c40ad44 100644 --- a/FW_Market.py +++ b/FW_Market.py @@ -168,7 +168,7 @@ def show_bin_list(self, tbody): self.TableWidget.verticalHeader().setVisible(False) # 隐藏垂直表头 self.TableWidget.horizontalHeader().setVisible(True) # 显示水平表头 - font = QFont('微软雅黑', 10) + font = QFont('Arial', 10) font.setBold(True) #设置字体加粗 self.TableWidget.horizontalHeader().setFont(font) #设置表头字体 @@ -178,7 +178,7 @@ def show_bin_list(self, tbody): self.TableWidget.horizontalHeader().setSectionResizeMode(0,QHeaderView.Stretch)#设置第一列宽度自动调整,充满屏幕 # self.TableWidget.horizontalHeader().setStretchLastSection(True) ##设置最后一列拉伸至最大 - self.TableWidget.setHorizontalHeaderLabels(['固件名称','固件版本','更新日期','操作']) #设置表头内容 + self.TableWidget.setHorizontalHeaderLabels(['Firmware name','Firmware version','Updated','operating']) #设置表头内容 self.TableWidget.horizontalHeader().setSectionsClickable(False) self.TableWidget.horizontalHeader().setStyleSheet('QHeaderView::section{background:green}')#设置表头的背景色为绿色 @@ -214,7 +214,7 @@ def show_bin_list(self, tbody): def buttonForRow(self,id): widget=QWidget() # 修改 - downloadBtn = QPushButton('下载') + downloadBtn = QPushButton('download') downloadBtn.setStyleSheet(''' text-align : center; background-color : NavajoWhite; height : 30px; @@ -224,7 +224,7 @@ def buttonForRow(self,id): downloadBtn.clicked.connect(lambda:self.download(id)) # 查看 - docBtn = QPushButton('文档') + docBtn = QPushButton('Doc') docBtn.setStyleSheet(''' text-align : center; background-color : DarkSeaGreen; height : 30px; @@ -257,7 +257,7 @@ def save_File(self, fileUrl): tmp = re.findall('/([\w\W]+?).bin', tmp) raw_fileName = tmp[0].strip() + '.bin' - fileName, ok = QFileDialog.getSaveFileName(self, "文件保存", "./combine/" + raw_fileName, "All Files (*);;Bin Files (*.bin)") + fileName, ok = QFileDialog.getSaveFileName(self, "Save file", "./combine/" + raw_fileName, "All Files (*);;Bin Files (*.bin)") fileUrl = fileUrl.replace('/blob/','/raw/') if ok: print(fileName) @@ -265,7 +265,7 @@ def save_File(self, fileUrl): self.mThread = FwThread(action="down_bin", url="https://gitee.com" + fileUrl, fileName = fileName) self.mThread.formSignal.connect(self.waitPag_State) self.mThread.start() - self.waitPage.setText("
正在下载文档......
") + self.waitPage.setText("
Downloading document......
") else: self.waitPage.hide() @@ -274,11 +274,11 @@ def document(self, id): self.mThread.textSignal.connect(self.show_document) self.mThread.formSignal.connect(self.waitPag_State) self.mThread.start() - self.waitPage.setText("
正在获取文档......
") + self.waitPage.setText("
Fetching documents......
") self.waitPage.show() self.waitPage.raise_() - self.docPage_Title = self.TableWidget.item(id, 0).text() + " 固件使用说明" + self.docPage_Title = self.TableWidget.item(id, 0).text() + " Firmware instructions" def show_document(self, readme): self.waitPage.hide() @@ -292,7 +292,7 @@ def waitPag_State(self, state): self.waitPage.hide() elif state == CMD_DOWNLOAD_OK: self.waitPage.hide() - QMessageBox.information(self,"温馨提示","下载成功!") + QMessageBox.information(self,"warning","download successful!") if __name__ == '__main__': diff --git a/README-EN.md b/README-EN.md new file mode 100644 index 0000000..808da8b --- /dev/null +++ b/README-EN.md @@ -0,0 +1,97 @@ +# An Xinke TB series module serial port burning tool + +This repo is used for translation to English - by google translate + +This tool is used to burn firmware triplets of Enxin TB series modules, etc. It currently supports `` `TB-01```,` `` TB-02```. + +The download address of the latest Windows version of the graphical interface burning tool (CN)':https://ai-thinker.oss-cn-shenzhen.aliyuncs.com/TB_Tool/Ai-Thinker_TB_Tools.exe +Donwload English version here: TBD + +## Introduction to tool principles +This tool is written in python language and has a command line and a graphical interface with two versions. The command line version is highly efficient and easy to integrate; the graphical interface version is simple and intuitive to operate and easy to use. + +All the code of the command line tool is in the file `Telink_Tools.py`. + +The interface logic of the graphical interface tool is in `` `TBXX_Flash_Tool.py```, and the final operation still needs to call the function in the` Telink_Tools.py` file. + +## Module wiring instructions + +You need to use the USB to serial port module to connect to the TB module, and the USB to serial port must have `` `DTR``` and` `` RTS``` pins. + +### TB-01 module wiring method: + +| USB To TTL | TB-01 | +|:---------:|:------:| +| Vcc | | +| Gnd | Gnd | +| Tx | Rx | +| Rx | Tx | +| RTS | VCC | +| DTR | SWS | + +### TB-02 module wiring method: + +|USB To TTL |TB-01 | +|:---------:|:------:| +| Vcc | Vcc | +| Gnd | Gnd | +| Tx | Rx | +| Rx | Tx | +| RTS | RST | +| DTR | SWS | + +## Graphical interface version operating instructions + +![image](https://shyboy.oss-cn-shenzhen.aliyuncs.com/readonly/main.png) + +The graphical interface is shown in the figure above, which provides functions such as burning firmware, burning triples, and erasing firmware. + +### Burn firmware +First click the serial port selection box to select the corresponding serial port, and then click the `` `···` `button to select the firmware to be burned, click the burn```firmware button` '' to burn, after successful burning` The `` Log window '' will turn green, and the failed programming "Log window" will turn red. +### Burn the Tmall Genie Triad +There are three input boxes on the line where the triplet is burned on the graphical interface, corresponding to the triplet `` `ProductID```,` `` MAC```, `` `Secert```, in the input box Enter the corresponding data and select the serial port number correctly, click the `` `Burn Triad '' button to burn the triplet. Similarly, after successful programming, the `Log window` will turn green, and if the programming fails, the` Log window` will turn red. + +### Erase the firmware +Click the `` `Erase Firmware''` button to erase the firmware in the module. + +### Erase Mesh data +Click the `` `Erase Mesh Key` '' button to erase the Mesh configuration information in the module, including` `` Application Key``` and `` `NetWork Key```. + +### Whole Chip Erase +Clicking the `` `Whole Chip Erase` '' button will erase all flash areas outside the bootloader in the module. + +### common problem +#### Failed to open the serial port +If the prompt "` `Failed to open the serial port xxxx ...", it may be that the serial port is occupied by other software, try again after releasing the temporary use. + +#### Failed to connect the chip +If it prompts `` Failed to connect to the chip '', it may be a wiring error. Please check the wiring. If the wiring is correct and the connection fails, the bootloader may be damaged. If the bootloader is damaged, the official writer can only be used to reprogram the botloader. + +### Packaging executable files +    pyinstaller -F -w -i aithinker.ico Ai-Thinker_TB_Tools.py + +## Command line version operating instructions +The command format of the command line version is: + +    python Telink_Tools.py [--port PORT] {burn, burn_triad, write_flash, read_flash, erase_flash} + +### Burn firmware +Instruction example: + +    python Telink_Tools.py --port com3 burn at_v1.2.bin +`` `--port``` specifies the port number,` `` burn``` is the burn command, and the following parameters are the firmware to be burned + +### Burning triples +Instruction example: + +    python Telink_Tools.py --port com3 burn_triad 1345 78da07fa44a7 221746e805ac0e6269bd4d3e55f1145c +`` `--port``` specifies the port number,` `` burn_triad``` is the instruction to burn the triplet, and the following three parameters are in turn the triplet `` `ProductID```,` `` MAC```, `` `Secret``` + +### Erase Flash +Command example: +     +    python Telink_Tools.py --port com3 erase_flash 0x4000 16 + +`` `--port``` specifies the port number,` `` erase_flash``` erase flash command, the next two parameters are the starting address of the flash to be erased and the number of sectors erased. The minimum erase unit of Flash is one sector, and each sector of TB module Flash is 4096 bytes. + +The Flash size of the TB series module is 512KB, among which 0x0-0x4000 (16KB) stores the bootloader and cannot be erased. 0x4000-0x30000 (176KB) stores user firmware, 0x30000-0x40000 (64KB) stores Mesh configuration data, 0x76000-0x77000 stores module Mac address, and 0x78000-0x79000 stores Tmall Genie triplet. diff --git a/SP_Tools.py b/SP_Tools.py index 0df293d..e544f46 100644 --- a/SP_Tools.py +++ b/SP_Tools.py @@ -31,19 +31,19 @@ def send(self, data): if (self._port != None): self._port.write(data) else: - self.textSignal.emit("请先打开串口!") + self.textSignal.emit("Please open the serial port first!") def run(self): try: self._port = tl_open_port(self._port_name) except Exception: - self.textSignal.emit("串口 " + self._port_name + " 打开失败,请检查串口是否被占用!!!") + self.textSignal.emit("Serial port " + self._port_name + "Open failed, please check whether the serial port is occupied! ! !") self.stateSignal.emit(1) return self.stateSignal.emit(0) - self.textSignal.emit("打开串口成功!!!") + self.textSignal.emit("Successfully opened the serial port! ! !") self._port.setRTS(False) self._port.setDTR(False) @@ -70,11 +70,11 @@ def __init__(self,parent=None): self.layout=QVBoxLayout() - # 最上层的文本框 + # Top text box self.tbox_log=QTextEdit() self.tbox_log.setFontPointSize(10) - # 按钮及下拉框 + # Buttons and drop-down boxes line_1=QHBoxLayout() self.serial_cb=QComboBox() @@ -85,11 +85,11 @@ def __init__(self,parent=None): self.baudRate_cb.addItem("500000") self.baudRate_cb.addItem("921600") - btn_refresh_p=QPushButton("刷新串口") - btn_recv_cnt=QPushButton("收") - btn_send_cnt=QPushButton("发") - btn_clean_scn =QPushButton("清除窗口") - self.btn_Open=QPushButton("打开串口") + btn_refresh_p=QPushButton("Refresh the serial port") + btn_recv_cnt=QPushButton("receive") + btn_send_cnt=QPushButton("send") + btn_clean_scn =QPushButton("clear") + self.btn_Open=QPushButton("Open the serial port") btn_refresh_p.clicked.connect(self.refresh_p_fn) btn_clean_scn.clicked.connect(self.clean_screen_fn) @@ -106,19 +106,19 @@ def __init__(self,parent=None): line_1.setContentsMargins(0, 0, 0, 0) - # 发送文本框及发送按钮 + # Send text box and send button line_2=QHBoxLayout() self.cbox_sendData=QComboBox() self.cbox_sendData.setEditable(True) - self.checkBox_Hex = QCheckBox("HEX发送") + self.checkBox_Hex = QCheckBox("Send HEX") self.checkBox_Hex.setEnabled(False) - self.checkBox_CF = QCheckBox("加回车换行") + self.checkBox_CF = QCheckBox("Add carriage return") self.checkBox_CF.setChecked(True) - btn_Send=QPushButton("发送数据") + btn_Send=QPushButton("send data") btn_Send.clicked.connect(lambda:self.send_btn_fn()) @@ -132,7 +132,7 @@ def __init__(self,parent=None): line_2.setStretch(2, 10) line_2.setStretch(3, 10) - # 预定义的AT指令按键矩阵 + # Predefined AT command key matrix line_3=QGridLayout() names = ['AT', 'AT+GMR', 'AT+RST', 'AT+SLEEP','AT+RESTORE', 'AT+SCAN', 'AT+DISCONNECT', @@ -174,12 +174,12 @@ def log_string(self, s): #Log窗口日志输出 def set_sp_state(self, state): # 设置串口打开关闭状态 if(state == 0): #串口已打开 - self.btn_Open.setText("关闭串口") + self.btn_Open.setText("Close the serial port") elif(state == 1): #串口已关闭 - self.btn_Open.setText("打开串口") + self.btn_Open.setText("Open the serial port") def OpenSerial(self): - if(self.btn_Open.text() == '打开串口'): + if(self.btn_Open.text() == 'Open the serial port'): self.mThread = SP_Thread(_port_name=self.serial_cb.currentText(), baudRate=self.baudRate_cb.currentText()) self.mThread.textSignal.connect(self.log_string) self.mThread.stateSignal.connect(self.set_sp_state) @@ -192,7 +192,7 @@ def grid_btn_fn(self): sender = self.sender() self.mThread.send((sender.text() + '\r\n').encode('utf-8')) else: - self.log_string("请先打开串口!") + self.log_string("Please open the serial port first!") def send_btn_fn(self): @@ -202,4 +202,4 @@ def send_btn_fn(self): else: self.mThread.send((self.cbox_sendData.currentText()).encode('utf-8')) else: - self.log_string("请先打开串口!") \ No newline at end of file + self.log_string("Please open the serial port first!") \ No newline at end of file diff --git a/SimpleUpdata.py b/SimpleUpdata.py index d27f883..873b2eb 100644 --- a/SimpleUpdata.py +++ b/SimpleUpdata.py @@ -83,16 +83,16 @@ def __init__(self,parent=None): super().__init__(parent) self.setWindowFlags(Qt.WindowCloseButtonHint) - self.setWindowTitle("发现新版本") + self.setWindowTitle("New version found") self.resize(300,80) self.lable=QLabel() line_btn=QHBoxLayout() - btn_updata =QPushButton("立即更新") - btn_ignore =QPushButton("忽略该版本") - btn_next =QPushButton("下次提醒我") + btn_updata =QPushButton("update immediately") + btn_ignore =QPushButton("Ignore this version") + btn_next =QPushButton("Remind me next time") btn_updata.clicked.connect(self.updata) btn_ignore.clicked.connect(self.ignore) @@ -126,7 +126,7 @@ def show_form(self,cmd):#显示或关闭检查更新窗口 self.close() elif(cmd == CMD_UPDATA_OK):#新文件下载成功 - reply = QMessageBox.information(self, '升级成功', '请重新打开软件!!!') + reply = QMessageBox.information(self, 'update successed', 'Please reopen the software! ! !') with open("combine/tmp.bat", "w+") as new_file: new_file.write('del ' + sys.argv[0] + '\r\n') diff --git a/TBXX_Flash_Tool.py b/TBXX_Flash_Tool.py index aeca100..f883017 100644 --- a/TBXX_Flash_Tool.py +++ b/TBXX_Flash_Tool.py @@ -33,14 +33,14 @@ def run(self): try: _port = tl_open_port(self._port_name) except Exception: - self.textSignal.emit("串口 " + self._port_name + " 打开失败,请检查串口是否被占用!!!") + self.textSignal.emit("Serial port " + self._port_name + " Open failed, please check whether the serial port is occupied!") self.pressbarSignal.emit(200) return self.pressbarSignal.emit(1000) - self.textSignal.emit("打开串口成功!!!") + self.textSignal.emit("Successfully opened the serial port!") - if self.action == "reset":#复位模组,进入运行模式 + if self.action == "reset":#Reset the module and enter the operating mode _port.setRTS(True) _port.setDTR(False) @@ -48,43 +48,43 @@ def run(self): _port.setRTS(False) - self.textSignal.emit("模组已复位!!!") + self.textSignal.emit("Module has been reset!") self.pressbarSignal.emit(100) _port.close() return - if not connect_chip(_port): #连接芯片,进入烧录模式 - self.textSignal.emit("连接芯片失败!!!") + if not connect_chip(_port): #Connect the chip and enter the burning mode + self.textSignal.emit("Failed to connect the chip!") self.pressbarSignal.emit(200) _port.close() return - self.textSignal.emit("连接芯片成功!") + self.textSignal.emit("Connect the chip successfully!") - if self.action == "burn": #烧录固件 + if self.action == "burn": #Burn firmware - self.textSignal.emit("尝试提高波特率...") + self.textSignal.emit("Try to increase the baud rate ...") if change_baud(_port): - self.textSignal.emit("提高波特率成功!!!") + self.textSignal.emit("Success in increasing baud rate! ! !") - self.textSignal.emit("擦除固件 ... ... ") + self.textSignal.emit("Erase the firmware ...") if not telink_flash_erase(_port, 0x4000, 44): - self.textSignal.emit("擦除固件失败!!!") + self.textSignal.emit("Failed to erase firmware! ! !") self.pressbarSignal.emit(200) _port.close() return - self.textSignal.emit("擦除固件成功!") + self.textSignal.emit("Successfully erased the firmware!") - self.textSignal.emit("烧录固件 :" + self.args.file_name) + self.textSignal.emit("Burn firmware :" + self.args.file_name) fo = open(self.args.file_name, "rb") firmware_addr = 0 firmware_size = os.path.getsize(self.args.file_name) percent=0 - if(firmware_size >= 192 * 1024): # 固件大于192KB,说明是合并好的固件,要跳过Boot + if(firmware_size >= 192 * 1024): # The firmware is greater than 192KB, indicating that it is a merged firmware, you must skip Boot fo.seek(16 * 1024, 0) firmware_addr = 16 * 1024 @@ -93,47 +93,47 @@ def run(self): if len(data) < 1: break if not telink_flash_write(_port, firmware_addr, data): - self.textSignal.emit("烧录固件失败!!!") + self.textSignal.emit("Failed to burn firmware! ! !") self.pressbarSignal.emit(200) break firmware_addr += len(data) percent = (int)(firmware_addr *100 / firmware_size) - self.pressbarSignal.emit(percent) # 跟新进度条 + self.pressbarSignal.emit(percent) # Follow the new progress bar - if percent == 100 : self.textSignal.emit("烧录固件完成!") + if percent == 100 : self.textSignal.emit("The firmware is burned!") fo.close() - elif self.action == "burn_triad": #烧录三元组 + elif self.action == "burn_triad": #Burn triplet ProductID,MAC,Secert - self.textSignal.emit("擦除三元组 ... ... ") + self.textSignal.emit("Erase triplet ...") if not telink_flash_erase(_port, 0x78000, 1): - self.textSignal.emit("擦除三元组失败!!!") + self.textSignal.emit("Failed to erase triplet! ! !") self.pressbarSignal.emit(200) _port.close() return - self.textSignal.emit("擦除三元组成功!") + self.textSignal.emit("Successfully erased the triplet!") - self.textSignal.emit("烧录三元组 :" + str(self.args.triad)) + self.textSignal.emit("Burn triplet :" + str(self.args.triad)) if telink_flash_write(_port, 0x78000, self.args.triad): - self.textSignal.emit("烧录三元组成功!") + self.textSignal.emit("Successfully burned the triplet!") self.pressbarSignal.emit(100) else: - self.textSignal.emit("烧录三元组失败!!!") + self.textSignal.emit("Failed to burn the triplet! ! !") self.pressbarSignal.emit(200) - elif self.action == "erase":#擦除Flash + elif self.action == "erase":#Erase Flash - self.textSignal.emit("擦除Flash: 从 " + hex(self.args.addr) + " 擦除 " + str(self.args.len_t) + " 扇区... ... ") + self.textSignal.emit("Erase Flash: From " + hex(self.args.addr) + " Erase " + str(self.args.len_t) + " Sector ... ... ") if telink_flash_erase(_port, self.args.addr, self.args.len_t): - self.textSignal.emit("擦除成功!") + self.textSignal.emit("Successfully erased!") self.pressbarSignal.emit(100) else: - self.textSignal.emit("擦除失败!!!") + self.textSignal.emit("Erase failed! ! !") self.pressbarSignal.emit(200) _port.close() @@ -142,7 +142,7 @@ class TB_Tools(QWidget): def __init__(self,parent=None): super().__init__(parent) - self.setWindowTitle("安信可TB模块烧录工具 " + __version__) + self.setWindowTitle("Anxinke TB module burning tool " + __version__) # if not os.path.exists('aithinker.png'): # tmp = open('aithinker.png', 'wb+') @@ -161,12 +161,12 @@ def __init__(self,parent=None): self.serial_cb=QComboBox() - btn_refresh_p=QPushButton("刷新串口") - btn_erase_fw =QPushButton("擦除固件") - btn_erase_key=QPushButton("擦除Mesh Key") - btn_erase_all=QPushButton("整片擦除") - btn_rst_chip =QPushButton("复位芯片") - btn_clean_scn=QPushButton("清空窗口") + btn_refresh_p=QPushButton("Refresh the serial port") + btn_erase_fw =QPushButton("Erase firmware") + btn_erase_key=QPushButton("Erase Mesh Key") + btn_erase_all=QPushButton("Chip erase") + btn_rst_chip =QPushButton("Reset chip") + btn_clean_scn=QPushButton("Clear window") btn_refresh_p.clicked.connect(self.refresh_p_fn) btn_erase_fw.clicked.connect (lambda:self.erase_fn("fw")) @@ -190,7 +190,7 @@ def __init__(self,parent=None): self.tbox_file = QLineEdit() btn_open_file =QPushButton("···") - btn_burn=QPushButton("烧录固件") + btn_burn=QPushButton("Burn firmware") btn_open_file.clicked.connect(self.open_file_fn) btn_burn.clicked.connect(self.burn_fn) @@ -208,11 +208,11 @@ def __init__(self,parent=None): self.tbox_ali_Sct = QLineEdit() self.tbox_ali_pID.setPlaceholderText("Product ID") - self.tbox_ali_Mac.setPlaceholderText("MAC地址") + self.tbox_ali_Mac.setPlaceholderText("MAC address") self.tbox_ali_Sct.setPlaceholderText("Device Secret") - btn_burn_triad=QPushButton("烧录三元组") + btn_burn_triad=QPushButton("Burn triplet") btn_burn_triad.clicked.connect(self.burn_triad_fn) line_3.addWidget(self.tbox_ali_pID) @@ -240,7 +240,7 @@ def __init__(self,parent=None): self.refresh_p_fn() - def refresh_p_fn(self): #刷新串口号 + def refresh_p_fn(self): #Refresh the serial number self.serial_cb.clear() plist = get_port_list() for i in range(0, len(plist)): @@ -251,9 +251,9 @@ def clean_screen_fn(self): self.tbox_log.clear() self.tbox_log.setStyleSheet("background-color:white;") - def erase_fn(self, action):#擦除Flash + def erase_fn(self, action):#Erase Flash if not len(self.serial_cb.currentText()) > 0 : - self.log_string("请选择串口号!!!") + self.log_string("Please select the serial port number!") return args = argparse.Namespace() @@ -276,9 +276,9 @@ def erase_fn(self, action):#擦除Flash self.mThread.textSignal.connect(self.log_string) self.mThread.start() - def rst_chip_fn(self):#复位新片 + def rst_chip_fn(self):#Reset new movie if not len(self.serial_cb.currentText()) > 0 : - self.log_string("请选择串口号!!!") + self.log_string("Please select the serial port number!") return args = argparse.Namespace() @@ -289,21 +289,21 @@ def rst_chip_fn(self):#复位新片 self.mThread.textSignal.connect(self.log_string) self.mThread.start() - def open_file_fn(self): #选择固件 - directory = QFileDialog.getOpenFileName(self, "选择要烧录的固件",'',"固件 (*.bin)") + def open_file_fn(self): #Select firmware + directory = QFileDialog.getOpenFileName(self, "Choose the firmware to burn",'',"firmware (*.bin)") if len(str(directory[0])) > 5 : self.tbox_file.setText(str(directory[0])) self.tbox_file.setStyleSheet("background-color:LightGreen;") - def burn_fn(self):#烧录固件 + def burn_fn(self):#Burn firmware if not len(self.tbox_file.text()) > 5 : - self.log_string("请选择要烧录的固件!!!") + self.log_string("Please select the firmware to burn.") self.tbox_file.setStyleSheet("background-color:red;") return if not len(self.serial_cb.currentText()) > 0 : - self.log_string("请选择串口号!!!") + self.log_string("Please select a serial number! ! !") return args = argparse.Namespace() @@ -315,19 +315,19 @@ def burn_fn(self):#烧录固件 self.mThread.textSignal.connect(self.log_string) self.mThread.start() - def burn_triad_fn(self):#烧录三元组 + def burn_triad_fn(self):#Burn triplet try: data = struct.pack(' 0 : - self.log_string("请选择串口号!!!") + self.log_string("Please select a serial number! ! !") return args = argparse.Namespace() @@ -339,10 +339,10 @@ def burn_triad_fn(self):#烧录三元组 self.mThread.textSignal.connect(self.log_string) self.mThread.start() - def log_string(self, s): #Log窗口日志输出 + def log_string(self, s): #LogWindow log output self.tbox_log.append(s) - def pressBar_refresh(self, a):#刷新进度条及Log串口颜色 + def pressBar_refresh(self, a):#Refresh progress bar and Log serial port color if a < 101 : self.pbar.setValue(a)