Ejemplo n.º 1
0
        public override CommandResult WriteManualCommands(params string[] commands)
        {
            if (commands.Length != 1)
            {
                throw new ArgumentException("Must always send exactly one command to the bootloader");
            }

            if (Status != PrinterStatus.Bootloader_Ready && commands[0].Contains("Q"))
            {
                WriteLog(">> Unable to start printer because it not ready.", Logger.TextType.Error);
                return(CommandResult.Failed_PrinterInUnconfiguredState);
            }
            if (CurrentBootloaderStep == BootloaderController.BootLoaderStep.Waiting)
            {
                if (commands[0] == "Q")
                {
                    GotoFirmware();
                }
                else
                {
                    lock (m_oLockBootloaderWait)
                    {
                        m_oBootloaderConnection.SPout(commands[0]);
                        WriteLog("<< " + commands[0], Logger.TextType.Write);
                    }
                }
            }
            return(CommandResult.Success);
        }