Skip to content

Commit

Permalink
Fix: Added missing voltage values on LP2 & LP3 - SDM630 (snaptec#1588)
Browse files Browse the repository at this point in the history
* Fix: Added missing voltage values on LP2 & LP3 - SDM630
  • Loading branch information
EmbeddedTec authored Jan 17, 2022
1 parent 63e10ea commit 9fa2a3b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
22 changes: 22 additions & 0 deletions modules/sdm630modbuslls1/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,28 @@ while read -r line; do
if (( $n == 6 )); then
wl3=$(echo "$line" | cut -c2- |sed 's/\..*$//')
fi
if (( $n == 7 )); then
llvs11=$(echo "$line" | cut -c2- )
llvs11=${llvs11%??}
echo "scale=3; $llvs11/1" | bc -l > /var/www/html/openWB/ramdisk/llvs11
# LANG=C printf "%.1f\n" $llvs11 > /var/www/html/openWB/ramdisk/llvs11
# echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llvs11
fi
if (( $n == 8 )); then
llvs12=$(echo "$line" | cut -c2- )
llvs12=${llvs12%??}
echo "scale=3; $llvs12/1" | bc -l > /var/www/html/openWB/ramdisk/llvs12
# LANG=C printf "%.1f\n" $llvs12 > /var/www/html/openWB/ramdisk/llvs12
# echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llvs12
fi
if (( $n == 9 )); then
llvs13=$(echo "$line" | cut -c2- )
llvs13=${llvs13%??}
echo "scale=3; $llvs13/1" | bc -l > /var/www/html/openWB/ramdisk/llvs13
# LANG=C printf "%.1f\n" $llvs13 > /var/www/html/openWB/ramdisk/llvs13
# echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llvs13
fi


n=$((n + 1))
done <<< "$output"
Expand Down
7 changes: 7 additions & 0 deletions modules/sdm630modbuslls1/readsdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,10 @@
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x10,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
# voltages
resp = client.read_input_registers(0x00,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x02,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x04,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
21 changes: 21 additions & 0 deletions modules/sdm630modbuslls2/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,27 @@ while read -r line; do
if (( $n == 6 )); then
wl3=$(echo "$line" | cut -c2- |sed 's/\..*$//')
fi
if (( $n == 7 )); then
llvs21=$(echo "$line" | cut -c2- )
llvs21=${llvs21%??}
echo "scale=3; $llvs21/1" | bc -l > /var/www/html/openWB/ramdisk/llvs21
# LANG=C printf "%.1f\n" $llvs21 > /var/www/html/openWB/ramdisk/llvs21
# echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llvs21
fi
if (( $n == 8 )); then
llvs22=$(echo "$line" | cut -c2- )
llvs22=${llvs22%??}
echo "scale=3; $llvs22/1" | bc -l > /var/www/html/openWB/ramdisk/llvs22
# LANG=C printf "%.1f\n" $llvs22 > /var/www/html/openWB/ramdisk/llvs22
# echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llvs22
fi
if (( $n == 9 )); then
llvs23=$(echo "$line" | cut -c2- )
llvs23=${llvs23%??}
echo "scale=3; $llvs23/1" | bc -l > /var/www/html/openWB/ramdisk/llvs23
# LANG=C printf "%.1f\n" $llvs23 > /var/www/html/openWB/ramdisk/llvs23
# echo "$line" | cut -c2- |sed 's/\..*$//' > /var/www/html/openWB/ramdisk/llvs23
fi
n=$((n + 1))
done <<< "$output"

Expand Down
7 changes: 7 additions & 0 deletions modules/sdm630modbuslls2/readsdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,10 @@
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x10,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
# voltages
resp = client.read_input_registers(0x00,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x02,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))
resp = client.read_input_registers(0x04,2, unit=sdmid)
print(struct.unpack('>f',struct.pack('>HH',*resp.registers)))

0 comments on commit 9fa2a3b

Please sign in to comment.