Critial Bug Fix in Connector. Samples Bug Fix.
This commit is contained in:
@@ -41,7 +41,7 @@ namespace TripleAdd.Controllers
|
||||
{
|
||||
if (utility == null)
|
||||
{
|
||||
utility = new ModbusUtility(ModbusType.Tcp, "192.168.0.172", 2, 0);
|
||||
utility = new ModbusUtility(ModbusType.Tcp, "192.168.0.161", 2, 0);
|
||||
utility.AddressTranslator = new AddressTranslatorModbus();
|
||||
}
|
||||
object[] getNum = await utility.GetDatasAsync("4X 1", new KeyValuePair<Type, int>(typeof(ushort), 4));
|
||||
@@ -53,7 +53,7 @@ namespace TripleAdd.Controllers
|
||||
{
|
||||
if (machine == null)
|
||||
{
|
||||
machine = new ModbusMachine("1", ModbusType.Tcp, "192.168.3.10", new List<AddressUnit>()
|
||||
machine = new ModbusMachine("1", ModbusType.Tcp, "192.168.0.161", new List<AddressUnit>()
|
||||
{
|
||||
new AddressUnit() {Id = "1", Area = "4X", Address = 1, CommunicationTag = "Add1", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
||||
new AddressUnit() {Id = "2", Area = "4X", Address = 2, CommunicationTag = "Add2", DataType = typeof(ushort), Zoom = 1, DecimalPos = 0},
|
||||
@@ -79,20 +79,20 @@ namespace TripleAdd.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<JsonResult> SetUtility(TripleAddViewModel model)
|
||||
public async Task<ActionResult> SetUtility(TripleAddViewModel model)
|
||||
{
|
||||
ushort add1 = model.Add1, add2 = model.Add2, add3 = model.Add3;
|
||||
var ans = await await utility.SetDatasAsync("4X 1", new object[] { add1, add2, add3 }).ContinueWith(async p => await GetUtilityEnter());
|
||||
return Json(ans);
|
||||
await utility.SetDatasAsync("4X 1", new object[] { add1, add2, add3 });
|
||||
return RedirectToAction("Utility");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<JsonResult> SetMachine(TripleAddViewModel model)
|
||||
public async Task<ActionResult> SetMachine(TripleAddViewModel model)
|
||||
{
|
||||
ushort add1 = model.Add1, add2 = model.Add2, add3 = model.Add3;
|
||||
var setDic = new Dictionary<string, double> { { "Add1", add1 }, { "Add2", add2 }, { "Add3", add3 } };
|
||||
var ans = await await machine.SetDatasAsync(MachineDataType.CommunicationTag, setDic).ContinueWith(async p => await GetMachineEnter());
|
||||
return Json(ans);
|
||||
await machine.SetDatasAsync(MachineDataType.CommunicationTag, setDic);
|
||||
return RedirectToAction("Machine");
|
||||
}
|
||||
|
||||
public IActionResult Privacy()
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus.NA200H\Modbus.Net.Modbus.NA200H.csproj" />
|
||||
<ProjectReference Include="..\..\Modbus.Net\Modbus.Net.Modbus\Modbus.Net.Modbus.csproj" />
|
||||
<ProjectReference Include="..\..\Modbus.Net\Modbus.Net\Modbus.Net.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
}
|
||||
|
||||
|
||||
<form asp-controller="Home" asp-action="@ViewBag.Method"
|
||||
data-ajax-failure="DisplayError(data)" data-ajax-success="Reload(data)"
|
||||
data-ajax-mode="replace" data-ajax="true" data-ajax-method="POST">
|
||||
<form asp-controller="Home" asp-action="@ViewBag.Method">
|
||||
<div class="col-md-12 form-inline form-group" style="margin-top: 20px; padding-top: 5px; background-color: #E5E1DB">
|
||||
<label>
|
||||
@Html.TextBoxFor(p => p.Add1, new {@id="add1", Class = "form-control input-lg" })
|
||||
@@ -30,8 +28,4 @@
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<br/>
|
||||
|
||||
@section scripts {
|
||||
<script src="~/js/refresh.js"></script>
|
||||
}
|
||||
<br/>
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
function Reload(data) {
|
||||
$('#add1').val(data.Add1);
|
||||
$('#add2').val(data.Add2);
|
||||
$('#add3').val(data.Add3);
|
||||
$('#ans').val(data.Ans);
|
||||
}
|
||||
|
||||
function DisplayError(data) {
|
||||
alert(data);
|
||||
}
|
||||
Reference in New Issue
Block a user