Skip to content

Commit d538eef

Browse files
committed
* pmc and macro expando
1 parent e7c3193 commit d538eef

3 files changed

Lines changed: 36 additions & 10 deletions

File tree

examples/windows/config.machines.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ machines:
7272
##
7373
- id: f_sim_mqtt_long
7474
## enabled: enable or disable collection for this machine
75-
enabled: !!bool true
75+
enabled: !!bool false
7676
## type: machine type
7777
type: l99.driver.fanuc.FanucMachine, fanuc
7878
## strategy: strategy type
@@ -275,7 +275,7 @@ machines:
275275
## mtconnect example
276276
##
277277
- id: f_sim_mtc_long
278-
enabled: !!bool false
278+
enabled: !!bool true
279279
type: l99.driver.fanuc.FanucMachine, fanuc
280280
strategy: l99.driver.fanuc.strategies.FanucMultiStrategy, fanuc
281281
handler: l99.driver.fanuc.handlers.FanucOne, fanuc
@@ -294,11 +294,11 @@ machines:
294294
# 3: [ % ]
295295
collectors:
296296
- l99.driver.fanuc.collectors.MachineInfo, fanuc
297-
#- l99.driver.fanuc.collectors.Alarms, fanuc
298-
#- l99.driver.fanuc.collectors.Messages, fanuc
297+
- l99.driver.fanuc.collectors.Alarms, fanuc
298+
- l99.driver.fanuc.collectors.Messages, fanuc
299299
- l99.driver.fanuc.collectors.StateData, fanuc
300-
#- l99.driver.fanuc.collectors.ToolData, fanuc
301-
#- l99.driver.fanuc.collectors.ProductionData, fanuc
300+
- l99.driver.fanuc.collectors.ToolData, fanuc
301+
- l99.driver.fanuc.collectors.ProductionData, fanuc
302302
#- l99.driver.fanuc.collectors.GCodeData, fanuc
303303
#- l99.driver.fanuc.collectors.AxisData, fanuc
304304
#- l99.driver.fanuc.collectors.SpindleData, fanuc

fanuc/veneers/Macro.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using l99.driver.@base;
1+
using System.Dynamic;
2+
using l99.driver.@base;
23

34
// ReSharper disable once CheckNamespace
45
namespace l99.driver.fanuc.veneers;
@@ -14,14 +15,27 @@ protected override async Task<dynamic> AnyAsync(dynamic[] nativeInputs, dynamic[
1415
{
1516
if (nativeInputs.All(o => o.success == true))
1617
{
18+
Func<dynamic, ExpandoObject> toExpando = (item) =>
19+
{
20+
dynamic eo = new ExpandoObject();
21+
eo.address = item.request.cnc_rdmacro.number;
22+
eo.value = item.response.cnc_rdmacro.macro.mcr_val /
23+
(double)Math.Pow(10, item.response.cnc_rdmacro.macro.dec_val);
24+
return eo;
25+
};
26+
1727
var currentValue = nativeInputs.ToDictionary(
1828
item => item.bag["id"],
29+
item => toExpando(item));
30+
31+
/*
1932
item => new
2033
{
2134
address = item.request.cnc_rdmacro.number,
2235
value = item.response.cnc_rdmacro.macro.mcr_val /
2336
(double)Math.Pow(10, item.response.cnc_rdmacro.macro.dec_val)
2437
});
38+
*/
2539

2640
await OnDataArrivedAsync(nativeInputs, additionalInputs, currentValue);
2741

fanuc/veneers/Pmc.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using l99.driver.@base;
1+
using System.Dynamic;
2+
using l99.driver.@base;
23

34
// ReSharper disable once CheckNamespace
45
namespace l99.driver.fanuc.veneers;
@@ -14,14 +15,25 @@ protected override async Task<dynamic> AnyAsync(dynamic[] nativeInputs, dynamic[
1415
{
1516
if (nativeInputs.All(o => o.success == true))
1617
{
18+
Func<dynamic, ExpandoObject> toExpando = (item) =>
19+
{
20+
dynamic eo = new ExpandoObject();
21+
eo.address = item.bag["address"];
22+
eo.type = item.bag["type"];
23+
eo.value = item.bag["value"];
24+
return eo;
25+
};
26+
1727
var currentValue = nativeInputs.ToDictionary(
1828
item => item.bag["id"],
19-
item => new
29+
item => toExpando(item));
30+
31+
/*item => new dynamic()
2032
{
2133
address = item.bag["address"],
2234
type = item.bag["type"],
2335
value = item.bag["value"]
24-
});
36+
});*/
2537

2638
await OnDataArrivedAsync(nativeInputs, additionalInputs, currentValue);
2739

0 commit comments

Comments
 (0)