px4io:Add 'supported' command and uses it in rcS

This commit is contained in:
David Sidrane
2023-11-15 09:53:40 -08:00
committed by David Sidrane
parent 9bed8f48c7
commit 8f02184669
2 changed files with 27 additions and 21 deletions
+23 -21
View File
@@ -274,37 +274,39 @@ else
. $FCONFIG . $FCONFIG
fi fi
# Check if PX4IO present and update firmware if needed. if px4io supported
if [ -f $IOFW ]
then then
if ! px4io checkcrc ${IOFW} # Check if PX4IO present and update firmware if needed.
if [ -f $IOFW ]
then then
# tune Program PX4IO if ! px4io checkcrc ${IOFW}
tune_control play -t 16 # tune 16 = PROG_PX4IO
if px4io update ${IOFW}
then then
usleep 10000 # tune Program PX4IO
tune_control stop tune_control play -t 16 # tune 16 = PROG_PX4IO
if px4io checkcrc ${IOFW}
if px4io update ${IOFW}
then then
tune_control play -t 17 # tune 17 = PROG_PX4IO_OK usleep 10000
tune_control stop
if px4io checkcrc ${IOFW}
then
tune_control play -t 17 # tune 17 = PROG_PX4IO_OK
else
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR
fi
else else
tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR tune_control stop
fi fi
else fi
tune_control stop
if ! px4io start
then
echo "PX4IO start failed"
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
fi fi
fi fi
if ! px4io start
then
echo "PX4IO start failed"
set STARTUP_TUNE 2 # tune 2 = ERROR_TUNE
fi
fi fi
# #
# RC update (map raw RC input to calibrate manual control) # RC update (map raw RC input to calibrate manual control)
# start before commander # start before commander
+4
View File
@@ -1556,6 +1556,10 @@ int PX4IO::custom_command(int argc, char *argv[])
{ {
const char *verb = argv[0]; const char *verb = argv[0];
if (!strcmp(verb, "supported")) {
return 0;
}
if (!strcmp(verb, "checkcrc")) { if (!strcmp(verb, "checkcrc")) {
if (is_running()) { if (is_running()) {
PX4_ERR("io must be stopped"); PX4_ERR("io must be stopped");