Merge branch 'gtxaspec:master' into master

This commit is contained in:
virmaior
2022-07-18 12:38:24 +09:00
committed by GitHub
10 changed files with 269 additions and 10 deletions

View File

@@ -48,10 +48,10 @@ wait_wlan() {
##Check if the driver has been loaded for the onboard wlan0, store the MAC.
while true
do
if ifconfig wlan0 | grep "inet addr"; then
if ifconfig wlan0 | grep "HWaddr"; then
store_mac
break
elif ifconfig wlan0 | grep "inet addr" && [[ "$ENABLE_USB_ETH" == "true" || "$ENABLE_USB_DIRECT" == "true" ]]; then
elif ifconfig wlan0 | grep "HWaddr" && [[ "$ENABLE_USB_ETH" == "true" || "$ENABLE_USB_DIRECT" == "true" ]]; then
store_mac
break
fi
@@ -169,6 +169,7 @@ eth_wlan_up() {
wpa_check() {
#Check if wpa_supplicant has been created by iCamera
if [ -e /tmp/wpa_supplicant.conf ]; then
wait_wlan
echo "wpa_supplicant.conf ready"
wlanold_check $1
else
@@ -249,7 +250,6 @@ done
}
first_run_check
wait_wlan
#Set module dir depending on platform
if [ -f /opt/wz_mini/tmp/.T20 ]; then

View File

@@ -1 +1 @@
Fri Jul 15 04:47:54 PM PDT 2022
Sun Jul 17 04:47:48 PM PDT 2022

View 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%;}

View 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>

View 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" );
}
});
});

View 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

View File

@@ -1,4 +1,4 @@
#we!/bin/sh
#!/bin/sh
# This serves a rudimentary webpage based on wz_mini.conf
base_dir=/opt/wz_mini/
hack_ini=/opt/wz_mini/wz_mini.conf

View 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>

View File

@@ -100,7 +100,7 @@ DEBUG_INITRAMFS_ENABLED="false"
DEBUG_PASSWORD="false"
####WEB####
WEB_SERVER_ENABLED="true"
WEB_SERVER_ENABLED="false"
#####SCRIPTING#####
CUSTOM_SCRIPT_PATH=""