smallneuron 2.4.14__tar.gz → 2.4.15__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.
Files changed (29) hide show
  1. {smallneuron-2.4.14/src/smallneuron.egg-info → smallneuron-2.4.15}/PKG-INFO +1 -1
  2. {smallneuron-2.4.14 → smallneuron-2.4.15}/pyproject.toml +1 -1
  3. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/smallneuron.py +33 -18
  4. {smallneuron-2.4.14 → smallneuron-2.4.15/src/smallneuron.egg-info}/PKG-INFO +1 -1
  5. {smallneuron-2.4.14 → smallneuron-2.4.15}/.gitignore +0 -0
  6. {smallneuron-2.4.14 → smallneuron-2.4.15}/LICENSE +0 -0
  7. {smallneuron-2.4.14 → smallneuron-2.4.15}/README.md +0 -0
  8. {smallneuron-2.4.14 → smallneuron-2.4.15}/example.py +0 -0
  9. {smallneuron-2.4.14 → smallneuron-2.4.15}/setup.cfg +0 -0
  10. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/__init__.py +0 -0
  11. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/build +0 -0
  12. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/gpio_h3.c +0 -0
  13. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/gpio_h3.h +0 -0
  14. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/gpio_h3.so +0 -0
  15. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/logger.py +0 -0
  16. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/sndummy.py +0 -0
  17. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/sngpio.py +0 -0
  18. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/sninput.py +0 -0
  19. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/snmqtt.py +0 -0
  20. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/snserial.py +0 -0
  21. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/sntimer.py +0 -0
  22. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron/snwatcher.py +0 -0
  23. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron.egg-info/SOURCES.txt +0 -0
  24. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron.egg-info/dependency_links.txt +0 -0
  25. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron.egg-info/top_level.txt +0 -0
  26. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron_pelainux.egg-info/PKG-INFO +0 -0
  27. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron_pelainux.egg-info/SOURCES.txt +0 -0
  28. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron_pelainux.egg-info/dependency_links.txt +0 -0
  29. {smallneuron-2.4.14 → smallneuron-2.4.15}/src/smallneuron_pelainux.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smallneuron
3
- Version: 2.4.14
3
+ Version: 2.4.15
4
4
  Summary: Small Neuron Workflow
5
5
  Author-email: Andres Artigas <andres@artigas.cl>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "smallneuron"
7
- version = "2.4.14"
7
+ version = "2.4.15"
8
8
  license = "MIT"
9
9
  description = "Small Neuron Workflow"
10
10
  readme = "README.md"
@@ -273,20 +273,44 @@ class EventManager:
273
273
  threading.Thread(target=self.loop).start()
274
274
  self.putEvent("_start_") # lanzamos evento de inicio
275
275
 
276
- def change_state(self,event, params,node_to:Node):
276
+ def change_state_deprecated(self,event, params,node_to:Node):
277
277
  self.currentNode=node_to
278
278
  self.prevState = self.currentState
279
279
  self.currentState = node_to.state
280
280
  self.currentArgs = params
281
281
  self.count = self.count + 1 # increment event count
282
282
  log.perfMark(f" print graph")
283
+
284
+
285
+ def do_change(self,event, params,node_to:Node):
286
+ # copiamos por si leave o enter los modifica y reportar lo que llego
287
+ original_params=copy.deepcopy(params)
288
+
289
+
290
+ # indicamos al nodo actual que salimos
291
+ log.info("[",self.count,"] Leave:", self.currentNode.state)
292
+ self.currentNode.leave(event,params,node_to.state)
293
+
294
+
295
+ # Cambiamos de estado
296
+ self.currentNode=node_to
297
+ self.prevState = self.currentState
298
+ self.currentState = node_to.state
299
+ self.currentArgs = original_params
300
+ self.count = self.count + 1 # increment event count
301
+
302
+ # Entramos al nodo nuevo
303
+ log.info("[",self.count,"] Enter:", node_to.state, params)
304
+ node_to.enter(event, params, self.currentState)
305
+
306
+
283
307
 
284
308
  def loop(self):
285
309
  log.debug( "main loop start, tid ",threading.get_native_id())
286
310
  try:
287
311
  self.printGraph()
288
312
  while True:
289
- log.notice("[-",self.count,"-] State:", self.currentState)
313
+ log.notice("[",self.count,"] State:", self.currentState)
290
314
  log.perfMark("event end:")
291
315
  eventTuple = self.events.get()
292
316
  event = eventTuple[0] # text del evento
@@ -303,35 +327,26 @@ class EventManager:
303
327
  if event in self.net:
304
328
  log.perfMark(f" event in net")
305
329
  if not self.currentState in self.net[event]:
306
- log.warn("[",self.count,"] ", event, " not valid for state ", self.currentState, "discarted!")
330
+ log.warn("[",self.count,"] Invalid:", event, "not valid for state ", self.currentState, "discarted!")
307
331
  else:
308
332
  node_to: Node = self.net[event][self.currentState][0]
309
-
310
- # indicamos al nodo actual que salimos
311
- log.info("[",self.count,"] leave ", self.currentNode.state)
312
- self.currentNode.leave(event,params,node_to.state)
313
333
 
314
- # Entramos al nodo nuevo
315
- original_params=copy.deepcopy(params) # por si enter los modifica y reportar lo que llego
316
- log.info("[",self.count,"] enter ", node_to.state, params)
317
- node_to.enter(event, params, self.currentState)
334
+ self.do_change(event, params, node_to)
318
335
 
319
- # Cambiamos de estado
320
- self.change_state(event, original_params, node_to)
336
+ # Imprimimos el estado actual despues del enter
321
337
  self.printGraph(event)
322
338
  elif event in self.cmds:
323
- log.info("[", self.count, "] Manager new cmd ", event)
339
+ log.info("[", self.count, "] Command:", event)
324
340
  node_to: Node = self.cmds[event][0]
325
341
  log.perfMark(f" enter cmd")
326
342
  if node_to.change_state:
327
- self.currentNode.leave(event,params,node_to.state)
328
- node_to.enter(event, params, self.currentState)
329
- self.change_state(event, params, node_to)
343
+ self.do_change(event, params, node_to)
330
344
  else:
345
+ log.info("[",self.count,"] Enter:", node_to.state, params)
331
346
  node_to.enter(event, params, self.currentState)
332
347
  self.printGraph(event)
333
348
  else:
334
- log.warn("[",self.count,"] ", event, " not exist")
349
+ log.warn("[",self.count,"] Unknown:", event, " not exist")
335
350
  except Exception as e:
336
351
  log.error(e)
337
352
  log.error(traceback.format_exc())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: smallneuron
3
- Version: 2.4.14
3
+ Version: 2.4.15
4
4
  Summary: Small Neuron Workflow
5
5
  Author-email: Andres Artigas <andres@artigas.cl>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes
File without changes
File without changes