Skip to content

Commit 50cbc55

Browse files
committed
add tools which could help with pre-processing of the data collected over USB serial
1 parent e772678 commit 50cbc55

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# process_nicla_bhy2_log_base64.py
2+
This script is used to convert the log encoded in base64 to ascii
3+
## Usage
4+
```
5+
./process_nicla_bhy2_log_base64.py [log_file_name]
6+
```
7+
## Example
8+
./process_nicla_bhy2_log_base64.py log_nicla_bhy2.txt
9+
10+
11+
# check_for_data_loss.sh
12+
This script is used to check for any potential data loss during the transfer,
13+
and it reports some errors if it does find any data loss
14+
15+
## Usage
16+
```
17+
./check_for_data_loss.sh [OPTION] [log_file_name]
18+
```
19+
20+
## Example
21+
- Example 1
22+
```
23+
./check_for_data_loss.sh -b ./minicom.log
24+
```
25+
The above command check for the data loss using the log "./minicom.log" which is base on base64 encoding
26+
- Example 2
27+
```
28+
./check_for_data_loss.sh -a ./minicom.log
29+
```
30+
The above command check for the data loss using the log "./minicom.log" which is base on ascii encoding
31+
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/sh
2+
3+
4+
log_encoding_is_base64=false
5+
6+
if [ ":""$1" = ":-b" ] ; then
7+
log_encoding_is_base64=true
8+
echo "log is using base64 encoding"
9+
elif [ ":""$1" = ":-a" ] ; then
10+
log_encoding_is_base64=false
11+
echo "log is using ascii encoding"
12+
else
13+
echo "usage: ./check_for_data_loss.sh [OPTION] [log_filename]"
14+
echo "\t[OPTION]:"
15+
echo "\t\t" "-a"
16+
echo "\t\t" "\t:log use ascii encoding"
17+
echo "\t\t" "-b"
18+
echo "\t\t" "\t:log use base64 encoding"
19+
20+
echo "\texample: ./check_for_data_loss.sh -b minicom.cap"
21+
return
22+
fi
23+
24+
if [ ":""$2" = ":" ] ; then
25+
log_file="./minicom.cap"
26+
else
27+
log_file="$2"
28+
fi
29+
30+
31+
tmp_file="./tmp.csv"
32+
log_file_cp="${log_file}.cp"
33+
log_file_in="${log_file_cp}.tmp"
34+
35+
echo "log_file:$log_file"
36+
37+
38+
if [ $log_encoding_is_base64 = true ] ; then
39+
cp $log_file $log_file_cp
40+
./process_nicla_bhy2_log_base64.py $log_file_cp > $log_file_in
41+
else
42+
cp $log_file $log_file_in
43+
fi
44+
45+
echo "log_id,seq,ax,ay,az,gx,gy,gz" > $tmp_file
46+
47+
sed 's/.*\([a-zA-Z]\)\([0-9]\)/\1,\2/g' $log_file_in >> $tmp_file
48+
./check_for_data_loss.py $tmp_file

0 commit comments

Comments
 (0)