public async Task <bool> EngageContactors() { CanPacket ControlPacket505 = new CanPacket(0x505); // 0x505 ControlPacket505.SetInt8(0, 0); CanService.Instance.SetCanToSendAt10Hertz(ControlPacket505); await Task.Delay(500); ControlPacket505.SetInt8(0, 112); CanService.Instance.SetCanToSendAt10Hertz(ControlPacket505); await Task.Delay(500); await WaitUntilBMUPrechargeStateEquals(BMU.PRECHARGE_STATUS_IDLE, 5000); // Set up the heartbeat for the battery so that we are ready to go CanPacket ControlPacket500 = new CanPacket(0x500); // 0x500 CanService.Instance.SetCanToSendAt10Hertz(ControlPacket500); await WaitUntilContactorsEngage(5000); return(true); }
public async void DisengageContactors() { CanPacket ControlPacket505 = new CanPacket(0x505); // 0x505 CanPacket ControlPacket500 = new CanPacket(0x500); // 0x500 ControlPacket505.SetInt8(0, 2); CanService.Instance.SetCanToSendAt10Hertz(ControlPacket505); await WaitUntilContactorsDisengage(5000); }
private BatteryService() { BatteryData = new Battery(TimeoutApplies); // Set up the heartbeat for the battery so that we are ready to go CanPacket ControlPacket500 = new CanPacket(0x500); // 0x500 ControlPacket500.SetInt16(0, 4098); ControlPacket500.SetInt16(2, 1); CanService.Instance.SetCanToSendAt10Hertz(ControlPacket500); // If we are not currently sending x505s then lets start as the battery likes them if (!CanService.Instance.IsPacketCurrent(0x505, 1000)) { CanPacket ControlPacket505 = new CanPacket(0x505); // 0x505 ControlPacket505.SetInt8(0, 0); CanService.Instance.SetCanToSendAt10Hertz(ControlPacket505); } }