Rex Lin | 231a75f | 2022-08-01 15:16:20 +0800 | [diff] [blame] | 1 | #!/vendor/bin/sh |
| 2 | # only use xtal_trim from factory calibration |
| 3 | if [ -z "$2" ] |
| 4 | then |
| 5 | echo "usage is $0 input-calibration output_calibration" |
| 6 | exit 0 |
| 7 | fi |
| 8 | OUTPUT_CALIB="$2" |
| 9 | if [ ! -f "$OUTPUT_CALIB" ]; then |
| 10 | touch $OUTPUT_CALIB |
| 11 | chmod 0644 $OUTPUT_CALIB |
| 12 | file="$1" |
| 13 | while IFS=, read -r f1 f2 |
| 14 | do |
| 15 | case $f1 in |
| 16 | "UWB_cal_tx_xtal_reg_final_value") |
| 17 | if [ $((0x$f2)) -gt 63 ]; then |
| 18 | f2=63 |
| 19 | fi |
| 20 | echo 'xtal_trim=0x'$f2 >> $OUTPUT_CALIB |
| 21 | ;; |
| 22 | esac |
| 23 | done <"$file" |
| 24 | exit 0 |
| 25 | fi |
| 26 | |