public bool doReset(DaemonConnection dc, byte receiver, byte sender, uint hwid) { bool success = false; if (HWID_INUSE) { byte[] data = new byte[8]; data[0] = (byte)(hwid&0xff); data[1] = (byte)((hwid>>8)&0xff); data[2] = (byte)((hwid>>16)&0xff); data[3] = (byte)((hwid>>24)&0xff); cp.setData(data); cp.setDataLength(4); } else { setReceiver(receiver); } dc.sendCanPacket(getResetPacket()); CanPacket getcp; running = true; dc.flushData(); for (int i = 0; i < 150; i++) { Thread.Sleep(50); if (dc.getData(out getcp)) { if (isBiosStart(getcp, receiver, hwid)) { success = true; break; } } if (!running) { break; } } if (!success) { Console.WriteLine("Timed out while waiting for node to reset"); } return success; }
public bool doReset(DaemonConnection dc, byte receiver, byte sender) { bool success = false; setReceiver(receiver); dc.sendCanPacket(getResetPacket()); CanPacket getcp; running = true; dc.flushData(); for (int i = 0; i < 150; i++) { Thread.Sleep(50); if (dc.getData(out getcp)) { if (isBiosStart(getcp, receiver)) { success = true; break; } } if (!running) { break; } } if (!success) { Console.WriteLine("Timed out while waiting for node to reset"); } return success; }