Add sensor AS5045, new PCB 0.4.2 adoption

This commit is contained in:
vanyabeat 2024-05-08 10:05:29 +00:00 committed by Igor Brylyov
parent 3fb5246306
commit e876d7e56c
24 changed files with 422 additions and 189 deletions

View file

@ -1,11 +0,0 @@
This directory is intended for PlatformIO Test Runner and project tests.
Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.
More information about PlatformIO Unit Testing:
- https://docs.platformio.org/en/latest/advanced/unit-testing/index.html

34
firmware/test/send_can.sh Executable file
View file

@ -0,0 +1,34 @@
#!/bin/bash
# Read 8 byte ascii from $1 and send it to CAN bus
# <can_id>:
# 3 (SFF) or 8 (EFF) hex chars
# {data}:
# 0..8 (0..64 CAN FD) ASCII hex-values (optionally separated by '.')
# {len}:
# an optional 0..8 value as RTR frames can contain a valid dlc field
# <flags>:
# a single ASCII Hex value (0 .. F) which defines canfd_frame.flags
can_id=$1
input=$2
if [[ ${#input} -gt 8 ]]; then
echo "Error: Input string must be no longer than 8 characters."
exit 1
fi
hex_output=""
for (( i=0; i<${#input}; i++ )); do
hex_char=$(printf "%02x" "'${input:$i:1}")
hex_output+="${hex_char}"
done
hex_output=$(printf "%-16s" "$hex_output")
hex_output=${hex_output// /0}
can_id=$(printf "%03X" $can_id)
cansend can0 $can_id#$hex_output

30
firmware/test/test_driver.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash
/bin/bash $(pwd)/send_can.sh 1 E0
/bin/bash $(pwd)/send_can.sh 1 E1
/bin/bash $(pwd)/send_can.sh 1 C2
/bin/bash $(pwd)/send_can.sh 1 1
sleep 1
/bin/bash $(pwd)/send_can.sh 1 -1
sleep 1
/bin/bash $(pwd)/send_can.sh 1 -1
sleep 1
/bin/bash $(pwd)/send_can.sh 1 2
sleep 1
/bin/bash $(pwd)/send_can.sh 1 C1
sleep 1
/bin/bash $(pwd)/send_can.sh 1 0.5
sleep 5
/bin/bash $(pwd)/send_can.sh 1 2
sleep 5
/bin/bash $(pwd)/send_can.sh 1 5
sleep 5
/bin/bash $(pwd)/send_can.sh 1 -5
sleep 5
/bin/bash $(pwd)/send_can.sh 1 20
sleep 5
/bin/bash $(pwd)/send_can.sh 1 E0