Browse Source

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
sbg
garfieldG 6 years ago committed by Beat Küng
parent
commit
487addbba5
  1. 19
      Tools/px4airframes/rcout.py

19
Tools/px4airframes/rcout.py

@ -28,10 +28,10 @@ class RCOutput(): @@ -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(): @@ -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(): @@ -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):

Loading…
Cancel
Save