void SetA2PPins(ActiveToPassivePinsState pinsState) { lastSetA2PPins = pinsState; lastSetA2PPins.IFaceName = PartID; lastSetA2PPins.XferILock = true; // so that log messages do not complain SelectedActiveToPassivePinsStateIVA.Set(lastSetA2PPins as IActiveToPassivePinsState); }
private void UpdateLabelContents(ActiveToPassivePinsState state) { string pwStr = "${0:X4}".CheckedFormat(unchecked ((int)state.PackedWord)); if (pwStr != (packedWordLabel.Content as string)) { packedWordLabel.Content = pwStr; } }
void ServiceResetActivity() { using (var eeLog = new Logging.EnterExitTrace(Log)) { // clear the enable auto load and enable auto unload values if (enableAutoLoadIVA.Update().VC.GetValue <bool>(false)) { enableAutoLoadIVA.Set(false); } if (enableAutoUnloadIVA.Update().VC.GetValue <bool>(false)) { enableAutoUnloadIVA.Set(false); } IValueAccessor a2pPinsStateIVA = SelectedActiveToPassivePinsStateIVA; IValueAccessor p2aPinsStateIVA = SelectedPassiveToActivePinsStateIVA; IActiveToPassivePinsState a2pPinsState = new ActiveToPassivePinsState(a2pPinsStateIVA.Update().VC); IPassiveToActivePinsState p2aPinsState = new PassiveToActivePinsState(p2aPinsStateIVA.Update().VC); if (!a2pPinsState.IsIdle) { lastSetA2PPins = new ActiveToPassivePinsState(); lastSetA2PPins.IFaceName = PartID; lastSetA2PPins.XferILock = true; a2pPinsStateIVA.Set(lastSetA2PPins as IActiveToPassivePinsState); } if (config.GetConfigKeyAccessOnce("E84Sim.ResetForcesESandHO").GetValue <bool>(false) && !p2aPinsState.IsSelectable) { p2aPinsStateIVA.Set(new PassiveToActivePinsState(p2aPinsState) { ES = true, HO_AVBL = true } as IPassiveToActivePinsState); } Spin(TimeSpan.FromSeconds(0.5)); a2pPinsState = new ActiveToPassivePinsState(a2pPinsStateIVA.Update().VC); p2aPinsState = new PassiveToActivePinsState(p2aPinsStateIVA.Update().VC); if (!p2aPinsState.IsSelectable) { SetCurrentActivity(ActivitySelect.WaitForPinsReady, Utils.Fcns.CheckedFormat("Reset complete with E84 P->A pins not selectable [{0}]", p2aPinsState)); } else if (!a2pPinsState.IsIdle) { SetCurrentActivity(ActivitySelect.WaitForPinsReady, Utils.Fcns.CheckedFormat("Reset complete with E84 A->P pins not idle [{0}]", a2pPinsState)); } else { SetCurrentActivity(ActivitySelect.Ready, "Reset complete and Ready for select"); } } }
void ServiceReadyActivity() { IValueAccessor a2pPinsStateIVA = SelectedActiveToPassivePinsStateIVA; IValueAccessor p2aPinsStateIVA = SelectedPassiveToActivePinsStateIVA; IActiveToPassivePinsState a2pPinsState = new ActiveToPassivePinsState(a2pPinsStateIVA.Update().VC); IPassiveToActivePinsState p2aPinsState = new PassiveToActivePinsState(p2aPinsStateIVA.Update().VC); if (!a2pPinsState.IsIdle) { SetCurrentActivity(ActivitySelect.WaitForPinsReady, Utils.Fcns.CheckedFormat("A2P pins are no longer idle [{0}]", a2pPinsState)); return; } if (!p2aPinsState.IsSelectable) { SetCurrentActivity(ActivitySelect.WaitForPinsReady, Utils.Fcns.CheckedFormat("P2A pins are no longer selectable [{0}]", p2aPinsState)); return; } // interface is idle and is selectable. detect auto trigger conditions and automatically request next transition accordingly. UpdateReadyToLoadAndUnload(false, true); if (nextActivitySelect == ActivitySelect.None) { PresentPlaced presentPlacedInput = lpmPresentPlacedInputIVA.Update().VC.GetValue <PresentPlaced>(false); if (presentPlacedInput.IsNeitherPresentNorPlaced() && enableAutoLoadIVA.Update().VC.GetValue <bool>(false)) { if (loadUnloadStartHoldoffTimer.StartIfNeeded(configValues.LoadUnloadStartHoldoff).IsTriggered) { nextActivitySelect = ActivitySelect.PerformLoad; loadUnloadStartHoldoffTimer.Stop(); } } else if (presentPlacedInput.IsProperlyPlaced() && enableAutoUnloadIVA.Update().VC.GetValue <bool>(false)) { if (loadUnloadStartHoldoffTimer.StartIfNeeded(configValues.LoadUnloadStartHoldoff).IsTriggered) { nextActivitySelect = ActivitySelect.PerformUnload; loadUnloadStartHoldoffTimer.Stop(); } } else { loadUnloadStartHoldoffTimer.StopIfNeeded(); } } else { loadUnloadStartHoldoffTimer.StopIfNeeded(); } }
protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e) { if (e.Property == pinsStateDP) { ActiveToPassivePinsState a2pPinsState = new ActiveToPassivePinsState(e.NewValue); if (E84_VALID_LED.IsActive != a2pPinsState.VALID) { E84_VALID_LED.IsActive = a2pPinsState.VALID; } if (E84_CS_0_LED.IsActive != a2pPinsState.CS_0) { E84_CS_0_LED.IsActive = a2pPinsState.CS_0; } if (E84_CS_1_LED.IsActive != a2pPinsState.CS_1) { E84_CS_1_LED.IsActive = a2pPinsState.CS_1; } if (E84_TR_REQ_LED.IsActive != a2pPinsState.TR_REQ) { E84_TR_REQ_LED.IsActive = a2pPinsState.TR_REQ; } if (E84_BUSY_LED.IsActive != a2pPinsState.BUSY) { E84_BUSY_LED.IsActive = a2pPinsState.BUSY; } if (E84_COMPT_LED.IsActive != a2pPinsState.COMPT) { E84_COMPT_LED.IsActive = a2pPinsState.COMPT; } if (E84_XferILock_LED.IsActive != a2pPinsState.XferILock) { E84_XferILock_LED.IsActive = a2pPinsState.XferILock; } UpdateLabelContents(a2pPinsState); } else { base.OnPropertyChanged(e); } }
private void E084_AtoP_CheckBox_Clicked(object sender, RoutedEventArgs e) { ActiveToPassivePinsState a2pPinsState = new ActiveToPassivePinsState(PinsState); ActiveToPassivePinBits entryPackedWord = a2pPinsState.PackedWord; a2pPinsState.CS_0 = E84_CS0_CB.IsChecked.GetValueOrDefault(); a2pPinsState.CS_1 = E84_CS1_CB.IsChecked.GetValueOrDefault(); a2pPinsState.VALID = E84_VALID_CB.IsChecked.GetValueOrDefault(); a2pPinsState.TR_REQ = E84_TR_REQ_CB.IsChecked.GetValueOrDefault(); a2pPinsState.BUSY = E84_BUSY_CB.IsChecked.GetValueOrDefault(); a2pPinsState.COMPT = E84_COMPT_CB.IsChecked.GetValueOrDefault(); a2pPinsState.XferILock = E84_XferILock_CB.IsChecked.GetValueOrDefault(); a2pPinsState.IFaceName = "From:E084_AtoP_CheckBox_Clicked"; UpdateLabelContents(a2pPinsState); if (entryPackedWord != a2pPinsState.PackedWord) { PinsState = a2pPinsState as IActiveToPassivePinsState; } }
void ServiceWaitForPinsReadyActivity() { IValueAccessor a2pPinsStateIVA = SelectedActiveToPassivePinsStateIVA; IValueAccessor p2aPinsStateIVA = SelectedPassiveToActivePinsStateIVA; IActiveToPassivePinsState a2pPinsState = new ActiveToPassivePinsState(a2pPinsStateIVA.Update().VC); IPassiveToActivePinsState p2aPinsState = new PassiveToActivePinsState(p2aPinsStateIVA.Update().VC); if (!a2pPinsState.IsIdle) { privateState.TransferProgressStr = Utils.Fcns.CheckedFormat("Wait A2P Idle: {0}", a2pPinsState); } else if (!p2aPinsState.IsSelectable) { privateState.TransferProgressStr = Utils.Fcns.CheckedFormat("Wait P2A Selectable: {0}", p2aPinsState); } else { SetCurrentActivity(ActivitySelect.Ready, "A2P pins are selectable now"); } }
protected override string PerformGoOfflineAction() { SetBaseState(UseState.Offline, "GoOffline Action has been performed", true); SetCurrentActivity(ActivitySelect.Offline, "Performing GoOffline Action"); nextActivitySelect = ActivitySelect.None; lastSetA2PPins = new ActiveToPassivePinsState(); lastSetA2PPins.IFaceName = PartID; lastSetA2PPins.XferILock = true; ohtActiveToPassivePinsStateIVA.Set(lastSetA2PPins as IActiveToPassivePinsState); agvActiveToPassivePinsStateIVA.Set(lastSetA2PPins as IActiveToPassivePinsState); privateState = new E084ActiveTransferSimEngineState() { StateStr = "Offline" }; PublishPrivateState(); return(String.Empty); }