private void SetQ(int value, int nid) { int oldQ = Q; Q = value; if (oldQ == 0 && Q > 0) { Logger.Instance.Debug(this, "empty slot", $"N{nid}: empty slot appeared"); EmptySlotAppeared?.Invoke(); } else if (oldQ > 0 && value == 0) { Logger.Instance.Debug(this, "empty slot", $"N{nid}: empty slots ended"); EmptySlotsEnded?.Invoke(); } SlotsNumberReceived?.Invoke(nid); }
private void RunThreadProc() { while (running) { if (commandsRun.TryDequeue(out Command cmd)) { Started?.Invoke(cmd.id); Dictionary <string, string> results; if (cmd.command == "M114" || cmd.command == "M119") { results = new Dictionary <string, string>(); if (cmd.command == "M114") { results["X"] = "0.0"; results["Y"] = "0.0"; results["Z"] = "0.0"; } if (cmd.command == "M119") { results["EX"] = "0"; results["EY"] = "0"; results["EZ"] = "0"; results["EP"] = "0"; } } else { if (cmd.command == "M999") { Reseted?.Invoke(); continue; } results = opts; } Completed?.Invoke(cmd.id, results); if (commandsRun.Count == maxLength - 1) { EmptySlotAppeared?.Invoke(); } SlotsNumberReceived?.Invoke(cmd.id); } Thread.Sleep(50); } }
private void RTSender_EmptySlotAppeared() { EmptySlotAppeared?.Invoke(); }