smallneuron 2.2.1__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.1/src/smallneuron.egg-info → smallneuron-2.2.2}/PKG-INFO +1 -1
- {smallneuron-2.2.1 → smallneuron-2.2.2}/pyproject.toml +1 -1
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/smallneuron.py +22 -20
- {smallneuron-2.2.1 → smallneuron-2.2.2/src/smallneuron.egg-info}/PKG-INFO +1 -1
- {smallneuron-2.2.1 → smallneuron-2.2.2}/.gitignore +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/LICENSE +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/README.md +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/example.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/setup.cfg +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/__init__.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/build +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.c +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.h +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/gpio_h3.so +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/logger.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/sndummy.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/sngpio.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/sninput.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/snmqtt.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/snserial.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/sntimer.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron/snwatcher.py +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron.egg-info/SOURCES.txt +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron.egg-info/dependency_links.txt +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron.egg-info/top_level.txt +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/PKG-INFO +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/SOURCES.txt +0 -0
- {smallneuron-2.2.1 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/dependency_links.txt +0 -0
- {smallneuron-2.2.1 → 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()")
|
|
@@ -228,13 +232,6 @@ class EventManager:
|
|
|
228
232
|
self.putEvent("_start_") # lanzamos evento de inicio
|
|
229
233
|
|
|
230
234
|
def change_state(self,event, params,node_to:Node):
|
|
231
|
-
# indicamos al nodo actual que salimos
|
|
232
|
-
log.info("[",self.count,"] leave ", self.currentNode.state)
|
|
233
|
-
self.currentNode.leave(event,params,node_to.state)
|
|
234
|
-
|
|
235
|
-
# Entramos al nodo nuevo
|
|
236
|
-
log.info("[",self.count,"] enter ", node_to.state, params)
|
|
237
|
-
node_to.enter(event, params, self.currentState)
|
|
238
235
|
self.currentNode=node_to
|
|
239
236
|
self.prevState = self.currentState
|
|
240
237
|
self.currentState = node_to.state
|
|
@@ -269,24 +266,29 @@ class EventManager:
|
|
|
269
266
|
if not self.currentState in self.net[event]:
|
|
270
267
|
log.warn("[",self.count,"] ", event, " not valid for state ", self.currentState, "discarted!")
|
|
271
268
|
else:
|
|
272
|
-
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
|
|
273
280
|
self.change_state(event, params, node_to)
|
|
274
281
|
self.printGraph(event)
|
|
275
282
|
elif event in self.cmds:
|
|
276
283
|
log.info("[", self.count, "] Manager new cmd ", event)
|
|
277
284
|
node_to: Node = self.cmds[event][0]
|
|
278
285
|
log.perfMark(f" enter cmd")
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
else:
|
|
286
|
-
self.printGraph(event)
|
|
287
|
-
self.change_state(event, new_params, Node.nodelist[new_state])
|
|
288
|
-
except:
|
|
289
|
-
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)
|
|
290
292
|
self.printGraph(event)
|
|
291
293
|
else:
|
|
292
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.1 → smallneuron-2.2.2}/src/smallneuron_pelainux.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|