From e63a58cce9faa4c9e131d06179592eb038913061 Mon Sep 17 00:00:00 2001 From: nebulous Date: Thu, 19 Sep 2024 16:25:07 -0400 Subject: [PATCH] payload-parsing: add frame parser type to output --- docker-compose-dev.yaml | 10 ++++------ infinitude | 8 +++----- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/docker-compose-dev.yaml b/docker-compose-dev.yaml index 04cba91..d30c115 100644 --- a/docker-compose-dev.yaml +++ b/docker-compose-dev.yaml @@ -10,19 +10,17 @@ services: context: . dockerfile: Dockerfile network_mode: host - ports: - - "3000:3000" volumes: - ./:/infinitude/ environment: - APP_SECRET=Pogotudinal - PASS_REQS=300 - - SERIAL_TTY=/dev/ttyUSB0 - #- SERIAL_SOCKET=192.168.1.47:23 + #- SERIAL_TTY=/dev/ttyUSB0 + - SERIAL_SOCKET=192.168.1.23:23 - MOJO_MODE=development - MOJO_LOG_COLOR=1 - MOJO_LOG_LEVEL=debug - SCAN_THERMOSTAT=1 - devices: - - /dev/ttyUSB0:/dev/ttyUSB0 +# devices: +# - /dev/ttyUSB0:/dev/ttyUSB0 restart: always diff --git a/infinitude b/infinitude index e921bae..4731e91 100755 --- a/infinitude +++ b/infinitude @@ -17,7 +17,6 @@ use Time::HiRes qw/time/; use Try::Tiny; use XML::Simple::Minded; - my $store = CHI->new( driver => 'File', root_dir => 'state', @@ -453,14 +452,13 @@ websocket '/serial' => sub { my $fstruc = $frame->frame_hash; $fstruc->{timestamp} = time; - if ($fstruc->{Function} eq 'reply') { - my $payf = $fstruc->{payload}; - if ($payf) { + if ($fstruc->{Function} eq 'reply' and $fstruc->{type}) { + if (my $payf = $fstruc->{payload}) { if ($payf->{rows} and $ENV{SCAN_THERMOSTAT}) { $scanrow = $payf->{rows}+1; warn sprintf(">>>>>>>>>>> table %02x has %d rows <<<<<<<<<<<<<<<<<<<", $scantab, $payf->{rows}); } - $fstruc->{field} = $payf; + $fstruc->{field} = { $fstruc->{type}=>$fstruc->{payload} }; } }