From 487addbba5a090d37e7c59e856490e84a78a319a Mon Sep 17 00:00:00 2001 From: garfieldG Date: Wed, 31 Jul 2019 08:37:40 +0300 Subject: [PATCH] rc.autostart: add error reporting (#12527) -Fixed bug : cd to /etc/init.d/airframes, but no cd after -Added error report to user if value of SYS_AUTOSTART param value is incorrect --- Tools/px4airframes/rcout.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Tools/px4airframes/rcout.py b/Tools/px4airframes/rcout.py index 4142c44f46..080eb403b2 100644 --- a/Tools/px4airframes/rcout.py +++ b/Tools/px4airframes/rcout.py @@ -28,10 +28,10 @@ class RCOutput(): "# 12000 .. 12999 Octo Cox\n" "# 13000 .. 13999 VTOL\n" "# 14000 .. 14999 Tri Y\n" - "" - "" - "cd /etc/init.d/airframes\n" "\n") + result += "\n" + result += "set AIRFRAME none\n" + result += "\n" for group in groups: result += "# GROUP: %s\n\n" % group.GetName() for param in group.GetParams(): @@ -62,7 +62,7 @@ class RCOutput(): result += "# %s\n" % param.GetName() result += "if param compare SYS_AUTOSTART %s\n" % id_val result += "then\n" - result += "\tsh %s\n" % path + result += "\tset AIRFRAME %s\n" % path result += "fi\n" #if long_desc is not None: @@ -70,6 +70,17 @@ class RCOutput(): result += "\n" result += "\n" + result += "\n" + result += "if [ ${AIRFRAME} != none ]\n" + result += "then\n" + result += "\tsh /etc/init.d/airframes/${AIRFRAME}\n" + if not post_start: + result += "else\n" + result += "\techo \"ERROR [init] No file matches SYS_AUTOSTART value found in : /etc/init.d/airframes\"\n" + result += "\techo \"ERROR [init] No file matches SYS_AUTOSTART value found in : /etc/init.d/airframes\" >> $LOG_FILE\n" + result += "\ttone_alarm ${TUNE_ERR}\n" + result += "fi\n" + result += "unset AIRFRAME" self.output = result def Save(self, filename):