private void CheckEEPROMValuesAfterUpdate() { var eepromMapping = new EEPROMMapping(m_oBootloaderConnection.ReadAllReadableEEPROM(), MyPrinterProfile.EEPROMConstants); var uint32 = (int)eepromMapping.GetUInt32("FirmwareVersion"); byte[] bytes = new byte[4]; if (eepromMapping.GetUInt16("SavedZState") != 0) { return; } m_oBootloaderConnection.WriteToEEPROM(GetEEPROMDataLocation("LastRecordedZValue"), bytes); }
private void CheckFirmwareStep() { foreach (KeyValuePair <char, FirmwareDetails> firmware in MyPrinterProfile.ProductConstants.FirmwareList) { var key = firmware.Key; FirmwareDetails firmwareDetails = firmware.Value; if (mInterfaceVersion == BootloaderController.BootloaderInterfaceVersion.V2) { SetBootloader(key); } var eepromMapping = new EEPROMMapping(m_oBootloaderConnection.ReadAllReadableEEPROM(), MyPrinterProfile.EEPROMConstants); var uint32_1 = eepromMapping.GetUInt32("FirmwareVersion"); var uint32_2 = eepromMapping.GetUInt32("FirmwareCRC"); BootloaderController.FirmwareStatus firmwareStatus = BootloadCheckFirmware(firmwareDetails, uint32_1, uint32_2); if (mCheckedFirmwareStatus.ContainsKey(key)) { mCheckedFirmwareStatus[key] = firmwareStatus; } else { mCheckedFirmwareStatus.Add(key, firmwareStatus); } } var bFirmwareIsInvalid = false; foreach (KeyValuePair <char, BootloaderController.FirmwareStatus> checkedFirmwareStatu in mCheckedFirmwareStatus) { if (BootloaderController.FirmwareStatus.Bad == checkedFirmwareStatu.Value) { bFirmwareIsInvalid = true; break; } } SetNextActionFromFirmwareStatus(bFirmwareIsInvalid); }
private void BootLoaderStartup() { FirmwareDetails firmware = MyPrinterProfile.ProductConstants.FirmwareList['M']; if (mInterfaceVersion == BootloaderController.BootloaderInterfaceVersion.V2) { SetBootloader('M'); } MyPrinterInfo.hardware.machine_type = "The_Micro"; var eepromMapping = new EEPROMMapping(m_oBootloaderConnection.ReadAllReadableEEPROM(), MyPrinterProfile.EEPROMConstants); var flag = false; var str = ""; byte[] bytesFromLocation = eepromMapping.GetBytesFromLocation("SerialNumber", 16); for (var index = 0; index < 16; ++index) { if (bytesFromLocation[index] == byte.MaxValue) { flag = true; } str += ((char)bytesFromLocation[index]).ToString(); } if (flag) { BroadcastServer.BroadcastMessage(new SpoolerMessage(MessageType.UserDefined, MySerialNumber, "There was a major error in your printer. Please reset the printer. If the problem persist, contact M3D.").Serialize()); Status = PrinterStatus.Error_PrinterNotAlive; } else { MySerialNumber = new PrinterSerialNumber(str); foreach (IFirstRunUpdater updater in MyPrinterProfile.FirstRunConstants.updater_list) { updater.CheckForUpdate(str, eepromMapping.GetAllEEPROMData(), m_oBootloaderConnection, MyPrinterProfile); } logger.ResetWithSerialNumber(MySerialNumber.ToString()); LoadPersistantData(); PersistantDetails.hours_used = eepromMapping.GetFloat("HoursCounterSpooler"); HardwareDetails.firmware_version = eepromMapping.GetUInt32("FirmwareVersion"); PersistantData.RestartOptions restartOptions = PersistantDetails.PopRestartAction(); SavePersistantData(); CurrentBootloaderStep = BootloaderController.BootLoaderStep.CheckFirmware; if (restartOptions.RestartAction == PersistantData.RestartAction.SetExtruderCurrent) { SetExtruderCurrent((ushort)restartOptions.RestartActionParam); } else if (restartOptions.RestartAction == PersistantData.RestartAction.SetFan) { SetFanConstants((FanConstValues.FanType)restartOptions.RestartActionParam); } else if (restartOptions.RestartAction == PersistantData.RestartAction.ForceStayBootloader) { Status = PrinterStatus.Bootloader_Ready; CurrentBootloaderStep = BootloaderController.BootLoaderStep.Waiting; } else { if (restartOptions.RestartAction != PersistantData.RestartAction.ForceUpdateFirmware) { return; } CurrentBootloaderStep = BootloaderController.BootLoaderStep.ForceFirmwareUpdate; } } }