private void OnTick(CycleManager.TickState state) { switch (state) { case CycleManager.TickState.PreTick: mTickStarted = true; break; case CycleManager.TickState.Tick: var inputArray = IOGroups[Input].IOArray; var outputArray = IOGroups[Output].IOArray; var oldValue = outputArray[0]; outputArray[0] = inputArray[0]; if (oldValue != outputArray[0]) { RaiseChangedEvent(Output); } break; case CycleManager.TickState.PostTick: mTickStarted = false; IOGroups[Input].IOArray[0] = mLastValue; RaiseChangedEvent(Input); break; } }
private void OnTick(CycleManager.TickState state) { switch (state) { case CycleManager.TickState.PreTick: mTickStarted = true; break; case CycleManager.TickState.Tick: var load = IOGroups[Load].IOArray[0]; if (!load) { return; } var address = CalckAdress(IOGroups[Address].IOArray); mRam[address] = IOGroups[Input].IOArray; var oldValue = new BitArray(IOGroups[Output].IOArray); var newValue = mRam[address]; if (oldValue.Xor(newValue).Any((x) => x)) { IOGroups[Output].IOArray = newValue; RaiseChangedEvent(Output); } break; case CycleManager.TickState.PostTick: mTickStarted = false; if (mLastValue.ContainsKey(Input)) { IOGroups[Input].IOArray = mLastValue[Input]; RaiseChangedEvent(Input); } if (mLastValue.ContainsKey(Address)) { IOGroups[Address].IOArray = mLastValue[Address]; RaiseChangedEvent(Address); } if (mLastValue.ContainsKey(Load)) { IOGroups[Load].IOArray = mLastValue[Load]; RaiseChangedEvent(Load); } CheckAdress(); break; } }
private void OnTick(CycleManager.TickState state) { switch (state) { case CycleManager.TickState.PreTick: break; case CycleManager.TickState.Tick: break; case CycleManager.TickState.PostTick: if (IOGroups[Input].IOArray[0] && Enabled) { CycleManager.Instance.Stop(); } break; } }