Skip to content

Commit

Permalink
Merge pull request kruzhok-team#89 from bryzZz/fix-machine-controller…
Browse files Browse the repository at this point in the history
…-initialization

Fix machine controller initialization
  • Loading branch information
chekoopa authored Nov 16, 2023
2 parents a0732c7 + 99a298d commit a93fbf0
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 181 deletions.
70 changes: 70 additions & 0 deletions demos/child-before-parent.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"states": {
"childState": {
"parent": "diod1",
"name": "child state 1",
"events": [],
"bounds": {
"height": 85,
"width": 450,
"x": 50,
"y": 50
}
},
"childState2": {
"parent": "diod1",
"name": "child state 2",
"events": [],
"bounds": {
"height": 85,
"width": 450,
"x": 200,
"y": 200
}
},
"diod1": {
"name": "state1",
"events": [],
"bounds": {
"height": 95,
"width": 450,
"x": 50,
"y": 431
}
}
},
"initialState": {
"target": "diod1",
"position": {
"x": -180,
"y": 569
}
},
"transitions": [
{
"color": "#1100ff",
"position": {
"x": 600,
"y": 100
},
"source": "childState",
"target": "childState2",
"trigger": {
"component": "button1",
"method": "clicked"
}
}
],
"components": {
"button1": {
"parameters": {
"pin": "4",
"labelColor": "#c70000",
"label": "1"
},
"type": "Button"
}
},
"parameters": {},
"platform": "ArduinoUno"
}
158 changes: 79 additions & 79 deletions demos/demo4 (schema v2).json
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
{
"components": {
"diod1": {
"parameters": {
"pin": "12",
"labelColor": "#0008f5",
"label": "1"
},
"type": "LED"
},
"button1": {
"parameters": {
"pin": "4",
"labelColor": "#c70000",
"label": "1"
},
"type": "Button"
}
},
"initialState": {
"target": "diod1",
"position": {
"x": -180.56000000000003,
"y": 569.0000000000002
}
},
"parameters": {},
"platform": "ArduinoUno",
"states": {
"diod1": {
"name": "state1",
"bounds": {
"height": 95,
"width": 450,
"x": 50,
"y": 431
},
"events": [
{
"do": [
Expand All @@ -16,15 +48,15 @@
}
}
],
"bounds": {
"height": 95,
"width": 450,
"x": 50,
"y": 431
}
"name": "state1"
},
"diod2": {
"name": "state2",
"bounds": {
"height": 245,
"width": 450,
"x": 195,
"y": 141
},
"events": [
{
"do": [
Expand Down Expand Up @@ -75,15 +107,15 @@
}
}
],
"bounds": {
"height": 245,
"width": 450,
"x": 195,
"y": 141
}
"name": "state2"
},
"diod3": {
"name": "state3",
"bounds": {
"height": 95,
"width": 450,
"x": 188,
"y": 21
},
"events": [
{
"do": [
Expand All @@ -98,57 +130,62 @@
}
}
],
"bounds": {
"height": 95,
"width": 450,
"x": 188,
"y": 21
}
"name": "state3"
},
"childState": {
"parent": "diod1",
"name": "child state1",
"events": [],
"bounds": {
"height": 85,
"width": 450,
"x": 0,
"y": 117
}
},
"events": [],
"name": "child state1",
"parent": "diod1"
},
"childState2": {
"parent": "childState",
"name": "child state2",
"events": [],
"bounds": {
"height": 85,
"width": 450,
"x": 0,
"y": 0
}
},
"events": [],
"name": "child state2",
"parent": "childState"
},
"childState3": {
"parent": "diod1",
"name": "child state3",
"events": [],
"bounds": {
"height": 85,
"width": 450,
"x": 291,
"y": 0
}
}
},
"initialState": {
"target": "diod1",
"position": {
"x": -50,
"y": 331
},
"events": [],
"name": "child state3",
"parent": "diod1"
}
},
"transitions": [
{
"color": "#F24C3D",
"condition": {
"type": "greater",
"value": [
{
"type": "component",
"value": {
"args": {},
"component": "diod1",
"method": "value"
}
},
{
"type": "value",
"value": "1234"
}
]
},
"do": [
{
"component": "diod1",
Expand All @@ -171,23 +208,6 @@
"x": 16,
"y": 175
},
"condition": {
"type": "greater",
"value": [
{
"type": "component",
"value": {
"component": "diod1",
"method": "value",
"args": {}
}
},
{
"type": "value",
"value": "1234"
}
]
},
"source": "diod2",
"target": "diod1",
"trigger": {
Expand All @@ -208,25 +228,5 @@
"method": "clicked"
}
}
],
"components": {
"diod1": {
"parameters": {
"pin": "12",
"labelColor": "#0008f5",
"label": "1"
},
"type": "LED"
},
"button1": {
"parameters": {
"pin": "4",
"labelColor": "#c70000",
"label": "1"
},
"type": "Button"
}
},
"parameters": {},
"platform": "ArduinoUno"
}
]
}
Loading

0 comments on commit a93fbf0

Please sign in to comment.