Controllo:_ accetta solo 8 / 12 come numParams (Input) + fix hex a 2-3 digits (8-12 inputs)

This commit is contained in:
Samuele Locatelli
2026-05-12 17:46:28 +02:00
parent 1f31183e8d
commit 2198f01425
+9 -2
View File
@@ -107,7 +107,11 @@ class ReadParallelaIOB:
# 1. Determine number of parameters
try:
self.num_params = config.getint('id', 'numParams', fallback=12)
val = config.getint('id', 'numParams', fallback=12)
if val in [8, 12]:
self.num_params = val
else:
self.num_params = 12
except ValueError:
self.num_params = 12
@@ -286,7 +290,10 @@ class ReadParallelaIOB:
if output_arr[i]:
new_value |= (1 << i)
return hex(new_value)[2:].upper()
if self.num_params == 8:
return f"{new_value:02X}"
else:
return hex(new_value)[2:].upper()
except Exception as e:
self.logPro.error(f"Error in readParallelaFiltrata: {e}")