mirror of
https://github.com/gtxaspec/wz_mini_hacks.git
synced 2024-11-22 21:47:19 +00:00
add car support to web server
This commit is contained in:
parent
63f2442d6c
commit
315dec23fc
@ -1 +1 @@
|
|||||||
Fri Jul 15 04:47:54 PM PDT 2022
|
Sun Jul 17 03:13:30 PM PDT 2022
|
||||||
|
16
SD_ROOT/wz_mini/www/car/car.css
Normal file
16
SD_ROOT/wz_mini/www/car/car.css
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.button {
|
||||||
|
background-color: #4CAF50; /* Green */
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
padding: 15px 32px;
|
||||||
|
text-align: center;
|
||||||
|
text-decoration: none;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 4px 2px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button1 {width: 60px;}
|
||||||
|
.button2 {width: 5%;}
|
||||||
|
.button3 {width: 100%;}
|
40
SD_ROOT/wz_mini/www/car/car.html
Normal file
40
SD_ROOT/wz_mini/www/car/car.html
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
|
||||||
|
<script src="car.js"></script>
|
||||||
|
<link rel="stylesheet" href="car.css">
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h2>wz_mini Car Control</h2>
|
||||||
|
|
||||||
|
<table style="width: 55%; border-collapse: collapse; float: left;" border="1">
|
||||||
|
<tbody>
|
||||||
|
<tr style="height: 21px;">
|
||||||
|
<td style="width: 33.3333%; height: 21px; text-align: left;"><button id="forward_left" class="button">q: forward left</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 21px; text-align: center;"><button id="forward" class="button">w: forward</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 21px; text-align: right;"><button id="forward_right" class="button">e: forward right</button></td>
|
||||||
|
</tr>
|
||||||
|
<tr style="height: 18px;">
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: left;"><button class="button" id="left">a; left</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: center;"><button class="button" id="reverse">s: rear</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: right;"><button class="button" id="right">d: right</button></td>
|
||||||
|
</tr>
|
||||||
|
<tr style="height: 18px;">
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: left;"><button class="button" id="reverse_left">z: rear left</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: center;"><button class="button" id="all_stop">x: all stop</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: right;"><button class="button" id="reverse_right">c: rear right</button></td>
|
||||||
|
</tr>
|
||||||
|
<td style="width: 33.3333%; height: 21px; text-align: left;"><button id="headlight" class="button">H: headlight</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: center;"><button class="button" id="irled">j: ir led</button></td>
|
||||||
|
<td style="width: 33.3333%; height: 18px; text-align: center;"><button class="button" id="honk">b: honk</button></td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
127
SD_ROOT/wz_mini/www/car/car.js
Normal file
127
SD_ROOT/wz_mini/www/car/car.js
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
$('#forward').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "forward" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "w") {
|
||||||
|
$.post("../cgi-bin/car.sh", "forward" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#reverse').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "reverse" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "s") {
|
||||||
|
$.post("../cgi-bin/car.sh", "reverse" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#left').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "left" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "a") {
|
||||||
|
$.post("../cgi-bin/car.sh", "left" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#right').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "right" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "d") {
|
||||||
|
$.post("../cgi-bin/car.sh", "right" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$('#forward_left').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "forward_left" );
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "q") {
|
||||||
|
$.post("../cgi-bin/car.sh", "forward_left" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#forward_right').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "forward_right" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "e") {
|
||||||
|
$.post("../cgi-bin/car.sh", "forward_right" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#reverse_left').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "reverse_left" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "z") {
|
||||||
|
$.post("../cgi-bin/car.sh", "reverse_left" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#reverse_right').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "reverse_right" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "c") {
|
||||||
|
$.post("../cgi-bin/car.sh", "reverse_right" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#all_stop').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "all_stop" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "x") {
|
||||||
|
$.post("../cgi-bin/car.sh", "all_stop" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#headlight').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "headlight" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "x") {
|
||||||
|
$.post("../cgi-bin/car.sh", "headlight" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#irled').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "irled" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "x") {
|
||||||
|
$.post("../cgi-bin/car.sh", "irled" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#honk').click(function() {
|
||||||
|
$.post("../cgi-bin/car.sh", "honk" );
|
||||||
|
});
|
||||||
|
|
||||||
|
addEventListener("keydown", function (e) {
|
||||||
|
if (e.key === "x") {
|
||||||
|
$.post("../cgi-bin/car.sh", "honk" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
63
SD_ROOT/wz_mini/www/cgi-bin/car.sh
Normal file
63
SD_ROOT/wz_mini/www/cgi-bin/car.sh
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SLEEP_TIME=0.1
|
||||||
|
|
||||||
|
read POST_STRING
|
||||||
|
|
||||||
|
if [ "$POST_STRING" = "forward" ]; then
|
||||||
|
echo "forward"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\xe3\x00\x02\xd4" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "reverse" ]; then
|
||||||
|
echo "reverse"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x36\x00\x02\x27" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "left" ]; then
|
||||||
|
echo "left"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x76\x81\x00\x02\x68" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "right" ]; then
|
||||||
|
echo "right"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x8a\x81\x00\x02\x7c" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "forward_left" ]; then
|
||||||
|
echo "left_forward"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x76\xe3\x00\x02\xca" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "forward_right" ]; then
|
||||||
|
echo "right_forward"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x8a\xe3\x00\x02\xde" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "reverse_left" ]; then
|
||||||
|
echo "left_reverse"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x76\x36\x00\x02\x1d" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "reverse_right" ]; then
|
||||||
|
echo "right_reverse"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x8a\x36\x00\x02\x31" > /dev/ttyUSB0
|
||||||
|
sleep $SLEEP_TIME
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "all_stop" ]; then
|
||||||
|
echo "all stop"
|
||||||
|
echo -ne "\xaa\x55\x43\x06\x29\x80\x80\x00\x02\x71" > /dev/ttyUSB0
|
||||||
|
elif [ "$POST_STRING" = "headlight" ]; then
|
||||||
|
echo "headlight"
|
||||||
|
headlight
|
||||||
|
elif [ "$POST_STRING" = "irled" ]; then
|
||||||
|
echo "irled"
|
||||||
|
irled
|
||||||
|
elif [ "$POST_STRING" = "honk" ]; then
|
||||||
|
echo "honk"
|
||||||
|
/opt/wz_mini/bin/cmd aplay /opt/wz_mini/usr/share/audio/honk.wav 70 > /dev/null 2>&1 &
|
||||||
|
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "no input"
|
||||||
|
fi
|
3
SD_ROOT/wz_mini/www/index.html
Normal file
3
SD_ROOT/wz_mini/www/index.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
<p><strong>wz_mini web server</strong></p>
|
||||||
|
<p><br /><a href="cgi-bin/index.cgi">Configuration Editor</a></p>
|
||||||
|
<p><a href="car/car.html">Car Interface</a></p>
|
@ -100,7 +100,7 @@ DEBUG_INITRAMFS_ENABLED="false"
|
|||||||
DEBUG_PASSWORD="false"
|
DEBUG_PASSWORD="false"
|
||||||
|
|
||||||
####WEB####
|
####WEB####
|
||||||
WEB_SERVER_ENABLED="true"
|
WEB_SERVER_ENABLED="false"
|
||||||
|
|
||||||
#####SCRIPTING#####
|
#####SCRIPTING#####
|
||||||
CUSTOM_SCRIPT_PATH=""
|
CUSTOM_SCRIPT_PATH=""
|
||||||
|
18
file.chk
18
file.chk
@ -1,15 +1,25 @@
|
|||||||
6324f7357788d664bae80bc9d41c04c6 SD_ROOT/factory_t31_ZMC6tiIDQN
|
6324f7357788d664bae80bc9d41c04c6 SD_ROOT/factory_t31_ZMC6tiIDQN
|
||||||
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/mnt/.gitignore
|
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/mnt/.gitignore
|
||||||
|
e3fc27b6c3095fc3f30c9af66088fc7c SD_ROOT/wz_mini/www/cgi-bin/wz_mini_web.css
|
||||||
|
ffc9d653967b2c25d9635d3240209db0 SD_ROOT/wz_mini/www/cgi-bin/DISABLE_FW_UPGRADE.md
|
||||||
|
7647093c8ce4b67ae9478ba4625f4b95 SD_ROOT/wz_mini/www/cgi-bin/index.cgi
|
||||||
|
b8f611d1dee2db10c8adf9f57e7274ad SD_ROOT/wz_mini/www/cgi-bin/ENABLE_USB_ETH.md
|
||||||
|
1013ee7201755bcf9047635b637e17c9 SD_ROOT/wz_mini/www/cgi-bin/ENABLE_WIREGUARD.md
|
||||||
|
38b9920ac65f5cf3179ece26b5fde345 SD_ROOT/wz_mini/www/cgi-bin/car.sh
|
||||||
|
50e2a1c097abf91978a04ff57ca72402 SD_ROOT/wz_mini/www/car/car.js
|
||||||
|
8beff5343278ee56c03137fc6b98313a SD_ROOT/wz_mini/www/car/car.css
|
||||||
|
38332e7d47417fca1834c149fb972042 SD_ROOT/wz_mini/www/car/car.html
|
||||||
|
30446891e0c43d41bf1f6ba363da8497 SD_ROOT/wz_mini/www/index.html
|
||||||
28cf061770da7b83fbc3752c455a02c3 SD_ROOT/wz_mini/etc/dnsmasq.conf
|
28cf061770da7b83fbc3752c455a02c3 SD_ROOT/wz_mini/etc/dnsmasq.conf
|
||||||
34c6a4c3a941ff2becd9f487826d7692 SD_ROOT/wz_mini/etc/uvc.config
|
34c6a4c3a941ff2becd9f487826d7692 SD_ROOT/wz_mini/etc/uvc.config
|
||||||
ad7d1a2f9db3079617731b5854ce3b6a SD_ROOT/wz_mini/etc/init.d/wz_cam.sh
|
ad7d1a2f9db3079617731b5854ce3b6a SD_ROOT/wz_mini/etc/init.d/wz_cam.sh
|
||||||
f97ffcb1482d564bf2557684a4c68846 SD_ROOT/wz_mini/etc/init.d/wz_init.sh
|
f97ffcb1482d564bf2557684a4c68846 SD_ROOT/wz_mini/etc/init.d/wz_init.sh
|
||||||
470ce77070b8f8abb3a0a9d059fac6fa SD_ROOT/wz_mini/etc/init.d/wz_user.sh
|
d50e3d2c32545cc6e418b3b7543def31 SD_ROOT/wz_mini/etc/init.d/wz_user.sh
|
||||||
4eaf541a47e60035992435b115463541 SD_ROOT/wz_mini/etc/init.d/wz_post.sh
|
4eaf541a47e60035992435b115463541 SD_ROOT/wz_mini/etc/init.d/wz_post.sh
|
||||||
e3034eac02d8eda9902ca9cf89f0a586 SD_ROOT/wz_mini/etc/inittab
|
e3034eac02d8eda9902ca9cf89f0a586 SD_ROOT/wz_mini/etc/inittab
|
||||||
840aa9c26726201f7cffbf001bee193a SD_ROOT/wz_mini/etc/uvc_jxf22.config
|
840aa9c26726201f7cffbf001bee193a SD_ROOT/wz_mini/etc/uvc_jxf22.config
|
||||||
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/etc/rc.local.d/.gitignore
|
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/etc/rc.local.d/.gitignore
|
||||||
7c885d8d7ea04c23d1e6622608d40cca SD_ROOT/wz_mini/etc/wz_mini.conf.dist
|
6862f4776949c788c89200344c1a3329 SD_ROOT/wz_mini/etc/wz_mini.conf.dist
|
||||||
8b5e58acfcbb20034dc4873a08b45fd9 SD_ROOT/wz_mini/etc/profile
|
8b5e58acfcbb20034dc4873a08b45fd9 SD_ROOT/wz_mini/etc/profile
|
||||||
2c2df1b9cb603f9c31c46162d6ac307f SD_ROOT/wz_mini/etc/alsa/alsa.conf
|
2c2df1b9cb603f9c31c46162d6ac307f SD_ROOT/wz_mini/etc/alsa/alsa.conf
|
||||||
9e5591da95042bcca910403bde25dc60 SD_ROOT/wz_mini/etc/fstab
|
9e5591da95042bcca910403bde25dc60 SD_ROOT/wz_mini/etc/fstab
|
||||||
@ -87,7 +97,7 @@ b339aee882a5d1c943ad08e4282ec3fd SD_ROOT/wz_mini/usr/bin/iCamera-dbg
|
|||||||
20b061689308b2cee7edf3b9b906bca7 SD_ROOT/wz_mini/usr/bin/ucamera
|
20b061689308b2cee7edf3b9b906bca7 SD_ROOT/wz_mini/usr/bin/ucamera
|
||||||
3777d9e80c8b517c01a124e6360b6525 SD_ROOT/wz_mini/usr/bin/imp_helper.sh
|
3777d9e80c8b517c01a124e6360b6525 SD_ROOT/wz_mini/usr/bin/imp_helper.sh
|
||||||
580b1b6e91e72b4a4fef7b21d8954403 SD_ROOT/wz_mini/usr/bin/getSensorType
|
580b1b6e91e72b4a4fef7b21d8954403 SD_ROOT/wz_mini/usr/bin/getSensorType
|
||||||
d13b4da22fb1f5878284395ae8da398f SD_ROOT/wz_mini/usr/bin/app.ver
|
82368a22ab782c2cbb746b7bfffa4b2c SD_ROOT/wz_mini/usr/bin/app.ver
|
||||||
4c780f0455481d106d47d89f0ae04ed5 SD_ROOT/wz_mini/lib/uClibc.tar
|
4c780f0455481d106d47d89f0ae04ed5 SD_ROOT/wz_mini/lib/uClibc.tar
|
||||||
9afeb088e4cbabbe0b04033b560204d0 SD_ROOT/wz_mini/lib/libimp.so
|
9afeb088e4cbabbe0b04033b560204d0 SD_ROOT/wz_mini/lib/libimp.so
|
||||||
4100755cb6cc6e3b76da20c7e3690e16 SD_ROOT/wz_mini/lib/libalog.so
|
4100755cb6cc6e3b76da20c7e3690e16 SD_ROOT/wz_mini/lib/libalog.so
|
||||||
@ -236,7 +246,7 @@ c6a2e765996b4a8bfe351757785fb989 SD_ROOT/wz_mini/lib/modules/3.10.14__isvp_swan
|
|||||||
14865a6e2e2df87a8362c6f20377a934 SD_ROOT/wz_mini/lib/libtinyalsa.so.2
|
14865a6e2e2df87a8362c6f20377a934 SD_ROOT/wz_mini/lib/libtinyalsa.so.2
|
||||||
bd383994491e4bdca81788c168feb2eb SD_ROOT/wz_mini/lib/libasound.so.2
|
bd383994491e4bdca81788c168feb2eb SD_ROOT/wz_mini/lib/libasound.so.2
|
||||||
f6f0d5a9ebd916de6bdb9695067809ae SD_ROOT/wz_mini/lib/libaudioProcess.so
|
f6f0d5a9ebd916de6bdb9695067809ae SD_ROOT/wz_mini/lib/libaudioProcess.so
|
||||||
7c885d8d7ea04c23d1e6622608d40cca SD_ROOT/wz_mini/wz_mini.conf
|
76c4c1f5cc168507bbbac50d096bc656 SD_ROOT/wz_mini/wz_mini.conf
|
||||||
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/tmp/.gitignore
|
d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/tmp/.gitignore
|
||||||
30cd28d6e52753c4afe5d6bca209bfc7 v2_install/compile_image.sh
|
30cd28d6e52753c4afe5d6bca209bfc7 v2_install/compile_image.sh
|
||||||
53db8da5b90bc9b219dbb1d58e934bda v2_install/fw_tool.sh
|
53db8da5b90bc9b219dbb1d58e934bda v2_install/fw_tool.sh
|
||||||
|
Loading…
Reference in New Issue
Block a user