Browse Source

fixed Reset Position

main
jkpete 3 weeks ago
parent
commit
92a7ed19ed
  1. 1
      Script/Model/ModelTrackControl.cs
  2. 12
      Script/Protocol/RequestTargetEngine.cs

1
Script/Model/ModelTrackControl.cs

@ -44,6 +44,7 @@ public class ModelTrackControl : EGModule, IEGFramework
if (CurrentRotation != 0) if (CurrentRotation != 0)
{ {
this.EGSendMessage(new RequestTargetControl(2000, 500, true), this.GetModule<ModelSerialTest>().EngineSerialPort, ProtocolType.SerialPort); this.EGSendMessage(new RequestTargetControl(2000, 500, true), this.GetModule<ModelSerialTest>().EngineSerialPort, ProtocolType.SerialPort);
this.EGSendMessage(new RequestTargetResetPosition(), this.GetModule<ModelSerialTest>().EngineSerialPort, ProtocolType.SerialPort);
CurrentRotation = 0; CurrentRotation = 0;
this.GetModule<ModelActionStatus>().SetRotation(CurrentRotation); this.GetModule<ModelActionStatus>().SetRotation(CurrentRotation);
} }

12
Script/Protocol/RequestTargetEngine.cs

@ -29,3 +29,15 @@ public class RequestTargetControl : ModbusRTU_WriteMultiHoldingRegister, IEGFram
return resultValues; return resultValues;
} }
} }
public class RequestTargetResetPosition : ModbusRTU_WriteSingleHoldingRegister, IEGFramework
{
public RequestTargetResetPosition()
{
this.DeviceAddress = 0x01;
this.RegisterAddress = 0x700A;
this.Value = 0x01;
EG.Print("[TargetSend]" + this.ToProtocolByteData().ToStringByHex());
}
}
Loading…
Cancel
Save