Merge branch 'release/AgenticRefactorReadParallela_04'

This commit is contained in:
Samuele Locatelli
2026-05-13 09:55:27 +02:00
4 changed files with 19 additions and 13 deletions
+9 -6
View File
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# readParallela v. 3.1.2 12 Ingressi
# readParallela v. 3.1.3 8/12 Ingressi
# - single instance timer
# - invio multiplo x send eventi accodati
# - gestione segnali BLINKING
@@ -19,6 +19,7 @@
# - (2.6.2) Fix in global di to_retry in send_coda per evitare problemi
# - (3.0.0) Prima versione code-assisted: riformulazione e ottimizzazione globale programma
# - (3.1.2) Ottimizzazione gestione letture GPIO (sempre code-assisted)
# - (3.1.3) Fix 12bit output, test 8/12 bit OK
import time
@@ -47,7 +48,7 @@ except ImportError:
class ReadParallelaIOB:
def __init__(self, config_path='IOB.cfg'):
self.PROGRAM_NAME = "ReadPar IOB-pi v.3.1.2 (2026)"
self.PROGRAM_NAME = "ReadPar IOB-pi v.3.1.3 (2026)"
self.MAXRETRY = 10
self.MAX_COUNTER_BLINK = 10
@@ -290,13 +291,11 @@ class ReadParallelaIOB:
if output_arr[i]:
new_value |= (1 << i)
# Different output for 8 and 12 bit config
if self.num_params == 8:
return f"{new_value:02X}"
else:
# For 12 bits, we want to ensure we don't have leading 0s if not needed,
# but the user's log showed F83, which is a 3-digit hex.
# hex(new_value)[2:].upper() is fine.
return hex(new_value)[2:].upper()
return f"{new_value:03X}"
except Exception as e:
self.logPro.error(f"Error in readParallelaFiltrata: {e}")
@@ -375,8 +374,11 @@ class ReadParallelaIOB:
2. Spawns a background daemon thread to empty the Redis queue.
3. Enters a loop to sample GPIO inputs, apply filters/blinking, and queue changes.
"""
self.logPro.info(" ")
self.logPro.info("-----------------------------")
self.logPro.info(self.PROGRAM_NAME)
self.logPro.info(f"v: {self.num_params} bit")
self.logPro.info("-----------------------------")
self.setup_gpio()
@@ -391,6 +393,7 @@ class ReadParallelaIOB:
old_value = ''
self.logPro.info("Starting main loop")
self.logPro.info(" ")
while True:
try:
Binary file not shown.
+1 -1
View File
@@ -1 +1 @@
62A7CB8F9ACAD5845EEF438CE166A77B
DB70E2092CB7BDC266426A6E1B126C23
+9 -6
View File
@@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# readParallela v. 3.1.2 12 Ingressi
# readParallela v. 3.1.3 8/12 Ingressi
# - single instance timer
# - invio multiplo x send eventi accodati
# - gestione segnali BLINKING
@@ -19,6 +19,7 @@
# - (2.6.2) Fix in global di to_retry in send_coda per evitare problemi
# - (3.0.0) Prima versione code-assisted: riformulazione e ottimizzazione globale programma
# - (3.1.2) Ottimizzazione gestione letture GPIO (sempre code-assisted)
# - (3.1.3) Fix 12bit output, test 8/12 bit OK
import time
@@ -47,7 +48,7 @@ except ImportError:
class ReadParallelaIOB:
def __init__(self, config_path='IOB.cfg'):
self.PROGRAM_NAME = "ReadPar IOB-pi v.3.1.2 (2026)"
self.PROGRAM_NAME = "ReadPar IOB-pi v.3.1.3 (2026)"
self.MAXRETRY = 10
self.MAX_COUNTER_BLINK = 10
@@ -290,13 +291,11 @@ class ReadParallelaIOB:
if output_arr[i]:
new_value |= (1 << i)
# Different output for 8 and 12 bit config
if self.num_params == 8:
return f"{new_value:02X}"
else:
# For 12 bits, we want to ensure we don't have leading 0s if not needed,
# but the user's log showed F83, which is a 3-digit hex.
# hex(new_value)[2:].upper() is fine.
return hex(new_value)[2:].upper()
return f"{new_value:03X}"
except Exception as e:
self.logPro.error(f"Error in readParallelaFiltrata: {e}")
@@ -375,8 +374,11 @@ class ReadParallelaIOB:
2. Spawns a background daemon thread to empty the Redis queue.
3. Enters a loop to sample GPIO inputs, apply filters/blinking, and queue changes.
"""
self.logPro.info(" ")
self.logPro.info("-----------------------------")
self.logPro.info(self.PROGRAM_NAME)
self.logPro.info(f"v: {self.num_params} bit")
self.logPro.info("-----------------------------")
self.setup_gpio()
@@ -391,6 +393,7 @@ class ReadParallelaIOB:
old_value = ''
self.logPro.info("Starting main loop")
self.logPro.info(" ")
while True:
try: