smallneuron 2.2.0__tar.gz → 2.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {smallneuron-2.2.0/src/smallneuron.egg-info → smallneuron-2.2.2}/PKG-INFO +1 -1
- {smallneuron-2.2.0 → smallneuron-2.2.2}/pyproject.toml +1 -1
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/smallneuron.py +23 -24
- {smallneuron-2.2.0 → smallneuron-2.2.2/src/smallneuron.egg-info}/PKG-INFO +1 -1
- {smallneuron-2.2.0 → smallneuron-2.2.2}/.gitignore +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/LICENSE +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/README.md +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/example.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/setup.cfg +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/__init__.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/build +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.c +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.h +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.so +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/logger.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sndummy.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sngpio.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sninput.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/snmqtt.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/snserial.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/sntimer.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron/snwatcher.py +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron.egg-info/SOURCES.txt +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron.egg-info/dependency_links.txt +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron.egg-info/top_level.txt +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/PKG-INFO +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/SOURCES.txt +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/dependency_links.txt +0 -0
- {smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/top_level.txt +0 -0
|
@@ -29,8 +29,9 @@ def ttfmt(txt):
|
|
|
29
29
|
class Node:
|
|
30
30
|
nodelist = {}
|
|
31
31
|
|
|
32
|
-
def __init__(self, state, desc="", style=""):
|
|
32
|
+
def __init__(self, state, change_state=False, desc="", style=""):
|
|
33
33
|
self.state = state
|
|
34
|
+
self.change_state=change_state
|
|
34
35
|
self.event_manager = None # Este link es llenado durante addEdge del event manager
|
|
35
36
|
self.desc = desc
|
|
36
37
|
self.style = style
|
|
@@ -38,6 +39,9 @@ class Node:
|
|
|
38
39
|
if state in Node.nodelist:
|
|
39
40
|
raise "Estado ya existe como Nodo" + state
|
|
40
41
|
Node.nodelist[state] = self
|
|
42
|
+
|
|
43
|
+
def leave(self, event, params, stateTo):
|
|
44
|
+
log.perfMark(" In Node.leave()")
|
|
41
45
|
|
|
42
46
|
def enter(self, event, params, stateFrom):
|
|
43
47
|
log.perfMark(" In Node.enter()")
|
|
@@ -88,10 +92,7 @@ class EventManager:
|
|
|
88
92
|
log.notice("*** STARTED ***")
|
|
89
93
|
|
|
90
94
|
def linkEdge(self, event, nodeFrom: Node, nodeTo: Node, desc=""):
|
|
91
|
-
if
|
|
92
|
-
print("Error node can't be None ")
|
|
93
|
-
raise "Error node can't be None "
|
|
94
|
-
elif event in self.cmds:
|
|
95
|
+
if event in self.cmds:
|
|
95
96
|
print("Error event already in cmds ", event)
|
|
96
97
|
raise "Error event already in cmds"
|
|
97
98
|
elif event in self.net:
|
|
@@ -231,13 +232,6 @@ class EventManager:
|
|
|
231
232
|
self.putEvent("_start_") # lanzamos evento de inicio
|
|
232
233
|
|
|
233
234
|
def change_state(self,event, params,node_to:Node):
|
|
234
|
-
# indicamos al nodo actual que salimos
|
|
235
|
-
log.info("[",self.count,"] leave ", self.currentNode.state)
|
|
236
|
-
self.currentNode.leave(event,params,node_to.state)
|
|
237
|
-
|
|
238
|
-
# Entramos al nodo nuevo
|
|
239
|
-
log.info("[",self.count,"] enter ", node_to.state, params)
|
|
240
|
-
node_to.enter(event, params, self.currentState)
|
|
241
235
|
self.currentNode=node_to
|
|
242
236
|
self.prevState = self.currentState
|
|
243
237
|
self.currentState = node_to.state
|
|
@@ -272,24 +266,29 @@ class EventManager:
|
|
|
272
266
|
if not self.currentState in self.net[event]:
|
|
273
267
|
log.warn("[",self.count,"] ", event, " not valid for state ", self.currentState, "discarted!")
|
|
274
268
|
else:
|
|
275
|
-
node_to: Node = self.net[event][self.currentState][0]
|
|
269
|
+
node_to: Node = self.net[event][self.currentState][0]
|
|
270
|
+
|
|
271
|
+
# indicamos al nodo actual que salimos
|
|
272
|
+
log.info("[",self.count,"] leave ", self.currentNode.state)
|
|
273
|
+
self.currentNode.leave(event,params,node_to.state)
|
|
274
|
+
|
|
275
|
+
# Entramos al nodo nuevo
|
|
276
|
+
log.info("[",self.count,"] enter ", node_to.state, params)
|
|
277
|
+
node_to.enter(event, params, self.currentState)
|
|
278
|
+
|
|
279
|
+
# Cambiamos de estado
|
|
276
280
|
self.change_state(event, params, node_to)
|
|
277
281
|
self.printGraph(event)
|
|
278
282
|
elif event in self.cmds:
|
|
279
283
|
log.info("[", self.count, "] Manager new cmd ", event)
|
|
280
284
|
node_to: Node = self.cmds[event][0]
|
|
281
285
|
log.perfMark(f" enter cmd")
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
else:
|
|
289
|
-
self.printGraph(event)
|
|
290
|
-
self.change_state(event, new_params, Node.nodelist[new_state])
|
|
291
|
-
except:
|
|
292
|
-
log.error(f"Invalid respond of cmd {event} in node {node_to.state}")
|
|
286
|
+
if node_to.change_state:
|
|
287
|
+
self.currentNode.leave(event,params,node_to.state)
|
|
288
|
+
node_to.enter(event, params, self.currentState)
|
|
289
|
+
self.change_state(event, params, node_to)
|
|
290
|
+
else:
|
|
291
|
+
node_to.enter(event, params, self.currentState)
|
|
293
292
|
self.printGraph(event)
|
|
294
293
|
else:
|
|
295
294
|
log.warn("[",self.count,"] ", event, " not exist")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smallneuron-2.2.0 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|