add car supports for unsupported devices

added support for tto usecar accessory with devices normally unsupported.  You may control it via the command line.  Unsupported devices will not work using the car app.
This commit is contained in:
Alfonso Gamboa 2022-07-14 13:56:47 -07:00
parent 3fa72158e7
commit 84c893e593
6 changed files with 133 additions and 6 deletions

View File

@ -450,14 +450,26 @@ Disable the movement capability on motorized devices. You will no longer be abl
---
ENABLE_FSCK_ON_BOOT="false"
ENABLE_FSCK_ON_BOOT="true"
run fsck.vfat on boot. This runs fsck.vfat, the FAT disk repair utility on the micro sd card, automatically repairing most issues, including corruption. Increases boot time. During the repair process, the LEDs on the camera will flash RED-off-BLUE-off-PURPLE-off to inform the user the repair program is running. Once the program has completed, the LED will switch to RED, resuming the normal boot process.
---
ENABLE_CAR_DRIVER="true"
Loads the appropriate driver for the car to function. On devices other than a V2 with the car firmware, the car may be controlled via `car_control.sh` on the command line. experimental!
`car_control.sh` defaults to high speed
`car_control.sh low_speed` low speed
`car_control constant` direction is constant, car keeps moving the direction you select without holding down any keys.
`car_control.sh constant low_speed` like above, but in low speed
---
## Latest Updates
* 07-14-22: Add car compatability with normally unsupported devices.
* 07-13-22: Includes latest build of libcallback, better RTSP video and audio performance: fixed broken audio caused by motor_stop on T20 devices, fixed waitMotion errors. `cmd jpeg` currently still broken on T20 devices, updated scripts to account for changed. Some usage of `cmd` has changes, please see command output. Kernel & modules updated to prepare for H265 support on T31.
* 07-08-22: Added support for multiple custom scripts, simply create scripts ending in .sh in wz_mini/etc/rc.local.d. You can prefix them with numbers to order execution if desired.
* 07-08-22: Updated T31 Kernel & Modules, added cp210x serial kernel module to support car. Add motor disable, fsck on boot. Disable debug logging for wifi drivers to prevent log spam, improved method of setting imp variables, fixed soundcard issues in the kernel, revert libcallback to account for this change.

View File

@ -0,0 +1,113 @@
#!/bin/sh
echo "=== CAR CONTROL over COMMAND LINE! ==="
echo "CAR: car_control.sh"
echo "CAR: car_control.sh constant"
echo "CAR: car_control.sh constant low_speed"
echo "CAR: car_control.sh low_speed"
echo "CAR: w: forward "
echo "CAR: d: reverse"
echo "CAR: a: turn wheel left"
echo "CAR: d: turn wheel right"
echo "CAR: q: forward left"
echo "CAR: e: forward right"
echo "CAR: z: reverse left"
echo "CAR: c: reverse right"
echo "CAR: x: all stop"
echo "CAR: use 1 to quit ASAP!"
echo -e ""
echo "Ready!"
trap control_c SIGINT
control_c()
{
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
echo "control-c KILL"
pkill -9 -f car_control.sh
}
#idle background loop
while true; do
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
#fw sends 0.2
sleep 0.2
done &
while true; do
if [ "$1" == "constant" ]; then
read -s -n1 -t 0.05 input
else
read -rsn1 input
fi
if [ "$input" = "w" ]; then
#forward
if [ "$1" == "low_speed" ] || [ "$2" == "low_speed" ]; then
echo -ne "\xaa\x55\x43\x06\x29\x80\xca\x00\x02\xbb" > /dev/ttyUSB0
else
echo -ne "\xaa\x55\x43\x06\x29\x80\xe3\x00\x02\xd4" > /dev/ttyUSB0
fi
elif [ "$input" = "s" ]; then
#reverse
if [ "$1" == "low_speed" ] || [ "$2" == "low_speed" ]; then
echo -ne "\xaa\x55\x43\x06\x29\x80\x3b\x00\x02\x2c" > /dev/ttyUSB0
else
echo -ne "\xaa\x55\x43\x06\x29\x80\x36\x00\x02\x27" > /dev/ttyUSB0
fi
elif [ "$input" = "a" ]; then
#left
echo -ne "\xaa\x55\x43\x06\x29\x76\x81\x00\x02\x68" > /dev/ttyUSB0
elif [ "$input" = "d" ]; then
#right
echo -ne "\xaa\x55\x43\x06\x29\x8a\x81\x00\x02\x7c" > /dev/ttyUSB0
elif [ "$input" = "q" ]; then
#forward left
if [ "$1" == "low_speed" ] || [ "$2" == "low_speed" ]; then
echo -ne "\xaa\x55\x43\x06\x29\x76\xca\x00\x02\xb1" > /dev/ttyUSB0
else
echo -ne "\xaa\x55\x43\x06\x29\x76\xe3\x00\x02\xca" > /dev/ttyUSB0
fi
elif [ "$input" = "e" ]; then
#forward right
if [ "$1" == "low_speed" ] || [ "$2" == "low_speed" ]; then
echo -ne "\xaa\x55\x43\x06\x29\x8a\xca\x00\x02\xc5" > /dev/ttyUSB0
else
echo -ne "\xaa\x55\x43\x06\x29\x8a\xe3\x00\x02\xde" > /dev/ttyUSB0
fi
elif [ "$input" = "z" ]; then
#reverse left
if [ "$1" == "low_speed" ] || [ "$2" == "low_speed" ]; then
echo "low speed"
echo -ne "\xaa\x55\x43\x06\x29\x76\x3b\x00\x02\x22" > /dev/ttyUSB0
else
echo "hi speed"
echo -ne "\xaa\x55\x43\x06\x29\x76\x36\x00\x02\x1d" > /dev/ttyUSB0
fi
elif [ "$input" = "c" ]; then
#reverse right
if [ "$1" == "low_speed" ] || [ "$2" == "low_speed" ]; then
echo -ne "\xaa\x55\x43\x06\x29\x8a\x3b\x00\x02\x36" > /dev/ttyUSB0
else
echo -ne "\xaa\x55\x43\x06\x29\x8a\x36\x00\x02\x31" > /dev/ttyUSB0
fi
elif [ "$input" = "c" ]; then
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
elif [ "$input" = "1" ]; then
#exit
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
pkill -9 -f car_control.sh
break
fi
done

View File

@ -139,7 +139,7 @@ if [[ "$DISABLE_MOTOR" == "true" ]]; then
fi
#Enable serial driver for car
if [ -f /opt/wz_mini/tmp/.CAR ]; then
if [ -f /opt/wz_mini/tmp/.CAR ] || [[ "$ENABLE_CAR_DRIVER" == "true"]]; then
modprobe cp210x
fi

View File

@ -1 +1 @@
Wed Jul 13 06:14:04 PM PDT 2022
Thu Jul 14 01:55:48 PM PDT 2022

View File

@ -91,6 +91,7 @@ ENABLE_MP4_WRITE="false"
NIGHT_DROP_DISABLE="false"
DISABLE_MOTOR="false"
ENABLE_FSCK_ON_BOOT="false"
ENABLE_CAR_DRIVER="false"
#####DEBUG#####
#drops you to a shell via serial, doesn't load app_init.sh

View File

@ -5,7 +5,7 @@ d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/mnt/.gitignore
ad7d1a2f9db3079617731b5854ce3b6a SD_ROOT/wz_mini/etc/init.d/wz_cam.sh
f97ffcb1482d564bf2557684a4c68846 SD_ROOT/wz_mini/etc/init.d/wz_init.sh
52c9d41071b59825a9b8c66e55289f0d SD_ROOT/wz_mini/etc/init.d/wz_user.sh
d87991fe006c4dc0d554b1517d8f1b2c SD_ROOT/wz_mini/etc/init.d/wz_post.sh
f334234afd94e7ef128b2b1629925de9 SD_ROOT/wz_mini/etc/init.d/wz_post.sh
e3034eac02d8eda9902ca9cf89f0a586 SD_ROOT/wz_mini/etc/inittab
840aa9c26726201f7cffbf001bee193a SD_ROOT/wz_mini/etc/uvc_jxf22.config
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/etc/rc.local.d/.gitignore
@ -42,6 +42,7 @@ c77675d150e2274de3cfe08c5c295f8f SD_ROOT/wz_mini/bin/ld
14e944353e335cff9430080e1ca007f6 SD_ROOT/wz_mini/bin/busybox
aba4bad7530f7f702d4c27b103cc970d SD_ROOT/wz_mini/bin/scp
c5d2801b7117b8db6275647110e6c8f1 SD_ROOT/wz_mini/bin/iwconfig.sh
8c5872a72e602f0c58b4742388523b16 SD_ROOT/wz_mini/bin/car_control.sh
67ab51181a29f16e60d879d793d4407f SD_ROOT/wz_mini/bin/audioplay_t20
78aaf46b312749d71c1f93a97f80fa74 SD_ROOT/wz_mini/bin/nm
e6bcaf0465750b67cff55eb3e380e624 SD_ROOT/wz_mini/bin/curl
@ -85,7 +86,7 @@ b339aee882a5d1c943ad08e4282ec3fd SD_ROOT/wz_mini/usr/bin/iCamera-dbg
20b061689308b2cee7edf3b9b906bca7 SD_ROOT/wz_mini/usr/bin/ucamera
3777d9e80c8b517c01a124e6360b6525 SD_ROOT/wz_mini/usr/bin/imp_helper.sh
580b1b6e91e72b4a4fef7b21d8954403 SD_ROOT/wz_mini/usr/bin/getSensorType
e5e998dfeb2d6de1ff0890d3aae3f878 SD_ROOT/wz_mini/usr/bin/app.ver
d439b71bcc808556457716103c206b4c SD_ROOT/wz_mini/usr/bin/app.ver
4c780f0455481d106d47d89f0ae04ed5 SD_ROOT/wz_mini/lib/uClibc.tar
9afeb088e4cbabbe0b04033b560204d0 SD_ROOT/wz_mini/lib/libimp.so
4100755cb6cc6e3b76da20c7e3690e16 SD_ROOT/wz_mini/lib/libalog.so
@ -234,7 +235,7 @@ c6a2e765996b4a8bfe351757785fb989 SD_ROOT/wz_mini/lib/modules/3.10.14__isvp_swan
14865a6e2e2df87a8362c6f20377a934 SD_ROOT/wz_mini/lib/libtinyalsa.so.2
bd383994491e4bdca81788c168feb2eb SD_ROOT/wz_mini/lib/libasound.so.2
f6f0d5a9ebd916de6bdb9695067809ae SD_ROOT/wz_mini/lib/libaudioProcess.so
f9fea7e8c6926879a1088d41c8a616e9 SD_ROOT/wz_mini/wz_mini.conf
7c885d8d7ea04c23d1e6622608d40cca SD_ROOT/wz_mini/wz_mini.conf
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/tmp/.gitignore
30cd28d6e52753c4afe5d6bca209bfc7 v2_install/compile_image.sh
53db8da5b90bc9b219dbb1d58e934bda v2_install/fw_tool.sh