Skip to content

Commit

Permalink
payload-parsing: add frame parser type to output
Browse files Browse the repository at this point in the history
  • Loading branch information
nebulous committed Sep 19, 2024
1 parent 1d0da4f commit e63a58c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 4 additions & 6 deletions docker-compose-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 3 additions & 5 deletions infinitude
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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} };
}
}

Expand Down

0 comments on commit e63a58c

Please sign in to comment.