pijuice_gui.py 文件源码

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

项目:PiJuice 作者: PiSupply 项目源码 文件源码
def _UpdateFirmwareCmd(self):
        q = tkMessageBox.showwarning('Update Fimware','Warning! Interrupting firmare update may lead to non functional PiJuice HAT.', parent=self.frame)
        if q:
            print 'Updating fimware'
            inputFile = '/usr/share/pijuice/data/firmware/PiJuice.elf.binary'
            curAdr = pijuice.config.interface.GetAddress()
            if curAdr:
                adr = format(curAdr, 'x')
                ret = 256 - subprocess.call(['pijuiceboot', adr, inputFile])#subprocess.call([os.getcwd() + '/stmboot', adr, inputFile])
                print 'firm res', ret 
                if ret == 256:
                    tkMessageBox.showinfo('Firmware update', 'Finished succesfully!', parent=self.frame)
                else:
                    errorStatus = self.firmUpdateErrors[ret] if ret < 11 else ' UNKNOWN'
                    msg = ''
                    if errorStatus == 'I2C_BUS_ACCESS_ERROR':
                        msg = 'Check if I2C bus is enabled.'
                    elif errorStatus == 'INPUT_FILE_OPEN_ERROR':
                        msg = 'Firmware binary file might be missing or damaged.'
                    elif errorStatus == 'STARTING_BOOTLOADER_ERROR':
                        msg = 'Try to start bootloader manualy. Press and hold button SW3 while powering up RPI and PiJuice.'
                    tkMessageBox.showerror('Firmware update failed', 'Reason: ' + errorStatus + '. ' + msg, parent=self.frame)
            else:
                tkMessageBox.showerror('Firmware update', 'Unknown pijuice I2C address', parent=self.frame)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号