if hackish then hackish

This commit is contained in:
gutmet 2020-04-30 16:30:26 +02:00
parent 1b339ae6d0
commit df77a0b33e
2 changed files with 17 additions and 18 deletions

View File

@ -1,19 +1,19 @@
big endian big endian
: byte[offset] : byte[offset]
HeaderMagic : byte[1] : byte[1]
: byte[1] : byte[1]
: byte[2] : byte[2]
: byte[4] : byte[4]
HeaderTimestamp : byte[4] Timestamp : byte[4]
HeaderUserID : uint16 UserID : uint16
: byte[4] : byte[4]
HeaderRecordID : uint8 RecordID : uint8
HeaderMagic2 : byte[3] : byte[3]
HeaderTotalDuration : uint16 TotalDuration : uint16
HeaderTotalDistance : uint32 TotalDistance : uint32
HeaderSPM : uint8 SPM : uint8
: byte[1] : byte[1]
HeaderSplitSize : uint16 SplitSize : uint16
: byte[18] : byte[18]
: byte[splitNo*32] : byte[splitNo*32]
SplitDistance : uint16 SplitDistance : uint16

View File

@ -5,7 +5,7 @@ cmd="laymanshex"
accTable="LogDataAccessTbl.bin" accTable="LogDataAccessTbl.bin"
storage="LogDataStorage.bin" storage="LogDataStorage.bin"
assignVariables='while read -r line; do typeset -x "$line"; done <<< ' # uses evil eval
function printNonEmpty { function printNonEmpty {
varname='$'"$1" varname='$'"$1"
@ -19,7 +19,7 @@ function printSplit {
outputSplit="$($cmd -nopadding -fvar=offset=$1,splitNo=$2 $storage-Workout$3.layhex $storage 2> /dev/null)" outputSplit="$($cmd -nopadding -fvar=offset=$1,splitNo=$2 $storage-Workout$3.layhex $storage 2> /dev/null)"
status=$? status=$?
if [ $status -eq 0 ]; then if [ $status -eq 0 ]; then
eval "$assignVariables $outputSplit" eval "$outputSplit"
echo echo
echo "Split $(($2+1))" echo "Split $(($2+1))"
echo "----------" echo "----------"
@ -36,11 +36,11 @@ function printWorkout {
outputHeader="$($cmd -nopadding -fvar=offset=$2,splitNo=0 $storage-Workout$3.layhex $storage 2> /dev/null)" outputHeader="$($cmd -nopadding -fvar=offset=$2,splitNo=0 $storage-Workout$3.layhex $storage 2> /dev/null)"
status=$? status=$?
if [ $status -eq 0 ]; then if [ $status -eq 0 ]; then
eval "$assignVariables $outputHeader" eval "$outputHeader"
printNonEmpty "HeaderTotalDuration" printNonEmpty "TotalDuration"
printNonEmpty "HeaderTotalDistance" printNonEmpty "TotalDistance"
printNonEmpty "HeaderSplitSize" printNonEmpty "SplitSize"
printNonEmpty "HeaderSPM" printNonEmpty "SPM"
j=0 j=0
while [ "$j" -lt "$NoSplits" ]; do while [ "$j" -lt "$NoSplits" ]; do
printSplit $2 $j $3 printSplit $2 $j $3
@ -50,7 +50,6 @@ function printWorkout {
fi fi
} }
function printAll { function printAll {
i=0 i=0
while : ; do while : ; do
@ -60,7 +59,7 @@ function printAll {
if [ $status -ne 0 ]; then if [ $status -ne 0 ]; then
break break
else else
eval "$assignVariables $output" eval "$output"
printWorkout $Index $Offset $WorkoutType printWorkout $Index $Offset $WorkoutType
fi fi
i=$((i+1)) i=$((i+1))