Skip to content

Commit

Permalink
* pmc and macro expando
Browse files Browse the repository at this point in the history
  • Loading branch information
MRIIOT committed Nov 16, 2023
1 parent e7c3193 commit d538eef
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
12 changes: 6 additions & 6 deletions examples/windows/config.machines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ machines:
##
- id: f_sim_mqtt_long
## enabled: enable or disable collection for this machine
enabled: !!bool true
enabled: !!bool false
## type: machine type
type: l99.driver.fanuc.FanucMachine, fanuc
## strategy: strategy type
Expand Down Expand Up @@ -275,7 +275,7 @@ machines:
## mtconnect example
##
- id: f_sim_mtc_long
enabled: !!bool false
enabled: !!bool true
type: l99.driver.fanuc.FanucMachine, fanuc
strategy: l99.driver.fanuc.strategies.FanucMultiStrategy, fanuc
handler: l99.driver.fanuc.handlers.FanucOne, fanuc
Expand All @@ -294,11 +294,11 @@ machines:
# 3: [ % ]
collectors:
- l99.driver.fanuc.collectors.MachineInfo, fanuc
#- l99.driver.fanuc.collectors.Alarms, fanuc
#- l99.driver.fanuc.collectors.Messages, fanuc
- l99.driver.fanuc.collectors.Alarms, fanuc
- l99.driver.fanuc.collectors.Messages, fanuc
- l99.driver.fanuc.collectors.StateData, fanuc
#- l99.driver.fanuc.collectors.ToolData, fanuc
#- l99.driver.fanuc.collectors.ProductionData, fanuc
- l99.driver.fanuc.collectors.ToolData, fanuc
- l99.driver.fanuc.collectors.ProductionData, fanuc
#- l99.driver.fanuc.collectors.GCodeData, fanuc
#- l99.driver.fanuc.collectors.AxisData, fanuc
#- l99.driver.fanuc.collectors.SpindleData, fanuc
Expand Down
16 changes: 15 additions & 1 deletion fanuc/veneers/Macro.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using l99.driver.@base;
using System.Dynamic;
using l99.driver.@base;

// ReSharper disable once CheckNamespace
namespace l99.driver.fanuc.veneers;
Expand All @@ -14,14 +15,27 @@ protected override async Task<dynamic> AnyAsync(dynamic[] nativeInputs, dynamic[
{
if (nativeInputs.All(o => o.success == true))
{
Func<dynamic, ExpandoObject> toExpando = (item) =>
{
dynamic eo = new ExpandoObject();
eo.address = item.request.cnc_rdmacro.number;
eo.value = item.response.cnc_rdmacro.macro.mcr_val /
(double)Math.Pow(10, item.response.cnc_rdmacro.macro.dec_val);
return eo;
};

var currentValue = nativeInputs.ToDictionary(
item => item.bag["id"],
item => toExpando(item));

/*
item => new
{
address = item.request.cnc_rdmacro.number,
value = item.response.cnc_rdmacro.macro.mcr_val /
(double)Math.Pow(10, item.response.cnc_rdmacro.macro.dec_val)
});
*/

await OnDataArrivedAsync(nativeInputs, additionalInputs, currentValue);

Expand Down
18 changes: 15 additions & 3 deletions fanuc/veneers/Pmc.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using l99.driver.@base;
using System.Dynamic;
using l99.driver.@base;

// ReSharper disable once CheckNamespace
namespace l99.driver.fanuc.veneers;
Expand All @@ -14,14 +15,25 @@ protected override async Task<dynamic> AnyAsync(dynamic[] nativeInputs, dynamic[
{
if (nativeInputs.All(o => o.success == true))
{
Func<dynamic, ExpandoObject> toExpando = (item) =>
{
dynamic eo = new ExpandoObject();
eo.address = item.bag["address"];
eo.type = item.bag["type"];
eo.value = item.bag["value"];
return eo;
};

var currentValue = nativeInputs.ToDictionary(
item => item.bag["id"],
item => new
item => toExpando(item));

/*item => new dynamic()
{
address = item.bag["address"],
type = item.bag["type"],
value = item.bag["value"]
});
});*/

await OnDataArrivedAsync(nativeInputs, additionalInputs, currentValue);

Expand Down

0 comments on commit d538eef

Please sign in to comment.