flash_dialog.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:uPyLoader 作者: BetaRavener 项目源码 文件源码
def _flash_finished(self, code):
        Logger.log("Flash output contents:\r\n")
        Logger.log(self._flash_output)

        if code == 0:
            self._flash_output.extend(b"Rebooting from flash mode...\n")
            self._update_output()
            try:
                s = serial.Serial(self._port, 115200)
                s.dtr = False
                s.rts = True
                time.sleep(0.1)
                s.rts = False
                time.sleep(0.1)
                self._flash_output.extend(b"Done, you may now use the device.\n")
                self._update_output()
            except (OSError, serial.SerialException):
                QMessageBox.critical(self, "Flashing Error", "Failed to reboot into working mode.")

        elif code == -1:
            QMessageBox.critical(self, "Flashing Error", "Failed to run script.\nCheck that path to python is correct.")
        else:
            QMessageBox.critical(self, "Flashing Error", "Failed to flash new firmware")
        self.eraseButton.setEnabled(True)
        self.flashButton.setEnabled(True)
        self._flashing = False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号