protected virtual void OnZubehoerServoAction(int servo, ServoAction richtung) { if (this.ZubehoerServoAction != null) { this.ZubehoerServoAction(servo, richtung); } }
public void BedienenServoManuell(ServoAction action) { Logging.Log.Schreibe("Servo Action " + action); if (this._zeichnenElemente.AktiverServo != null && _ardController.IsPortOpen()) { OnZubehoerServoAction(this.ZeichnenElemente.AktiverServo.ID, action); //if (keyData == Keys.Left) { // OnZubehoerServoAction(this.ZeichnenElemente.AktiverServo.ID, ServoAction.LinksClick); //} //else if(keyData == Keys.Right) { // OnZubehoerServoAction(this.ZeichnenElemente.AktiverServo.ID, ServoAction.RechtsClick); //} } }
private void Model_ZubehoerServoAction(int servo, ServoAction action) { if (this.AppTyp == AppTyp.Master) { if (_model.ServoBewegungManuell(servo, action)) { //if (master != null) { // master.SendeAnlageZustandsDatenAnAlle(this._model.AnlagenZustandsDatenAuslesen()); //} } } if (this.AppTyp == AppTyp.Slave) { if (slave != null) { //slave.SlaveAnMasterMouseClick(el[0].GetType().Name, el[0].ID); } } }
public bool ServoBewegungManuell(int servo, ServoAction action) { Servo s = this.ZeichnenElemente.ServoElemente.Element(servo); if (s != null) { byte[] befehl = new byte[5]; befehl[0] = (byte)s.Ausgang.ArdNr; befehl[1] = 72; befehl[2] = (byte)(s.Ausgang.AdressenNr * 2 + s.Ausgang.BitNr); if (action == ServoAction.LinksClick || action == ServoAction.RechtsClick) { befehl[2] |= 0x080; befehl[3] = (byte)ZubehörServoSchrittweite; if (action == ServoAction.LinksClick) { befehl[3] = (byte)-befehl[3]; } } else if (action == ServoAction.RechtsHold || action == ServoAction.LinksHold || action == ServoAction.HoldStop) { befehl[2] |= 0x40; switch (action) { case ServoAction.RechtsHold: befehl[3] = 255; break; case ServoAction.LinksHold: befehl[3] = 1; break; case ServoAction.HoldStop: befehl[3] = 0; break; } } befehl[4] = (byte)((befehl[0] + befehl[1] + befehl[2] + befehl[3]) % 256); _ardController.SendData(befehl); } return(false); }