Exemple #1
0
        private bool QuitBootloaderAndGotoApp()
        {
            var flag = true;

            foreach (KeyValuePair <char, FirmwareDetails> firmware in MyPrinterProfile.ProductConstants.FirmwareList)
            {
                FirmwareDetails firmwareDetails = firmware.Value;
                var             key             = firmware.Key;
                if (mCheckedFirmwareStatus.ContainsKey(key))
                {
                    switch (mCheckedFirmwareStatus[key])
                    {
                    case BootloaderController.FirmwareStatus.Unknown:
                    case BootloaderController.FirmwareStatus.Good:
                        if (mInterfaceVersion == BootloaderController.BootloaderInterfaceVersion.V2)
                        {
                            SetBootloader(key);
                            if (key != 'M')
                            {
                                flag = QuitSecondaryBootloader();
                                break;
                            }
                            break;
                        }
                        break;

                    case BootloaderController.FirmwareStatus.GoodQuit:
                        continue;

                    default:
                        flag = false;
                        break;
                    }
                    if (flag)
                    {
                        mCheckedFirmwareStatus[key] = BootloaderController.FirmwareStatus.GoodQuit;
                    }
                    else
                    {
                        mCheckedFirmwareStatus[key] = BootloaderController.FirmwareStatus.Bad;
                        return(false);
                    }
                }
            }
            broadcast_shutdown = false;
            m_oBootloaderConnection.FlushIncomingBytes();
            WriteLog("<< Q", Logger.TextType.Write);
            if (!m_oBootloaderConnection.JumpToApplication())
            {
                return(false);
            }

            Status = PrinterStatus.Error_PrinterNotAlive;
            return(true);
        }