From 74607242422269e4d492437dafeaddf943dd5f01 Mon Sep 17 00:00:00 2001 From: Andreas Antener Date: Tue, 4 Aug 2015 11:37:08 +0200 Subject: [PATCH 1/5] fix current scaling for mavlink message --- src/modules/mavlink/mavlink_messages.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/mavlink/mavlink_messages.cpp b/src/modules/mavlink/mavlink_messages.cpp index cb56331e95f..0b6dfcab5fc 100644 --- a/src/modules/mavlink/mavlink_messages.cpp +++ b/src/modules/mavlink/mavlink_messages.cpp @@ -537,7 +537,7 @@ protected: msg.onboard_control_sensors_health = status.onboard_control_sensors_health; msg.load = status.load * 1000.0f; msg.voltage_battery = status.battery_voltage * 1000.0f; - msg.current_battery = status.battery_current / 10.0f; + msg.current_battery = status.battery_current * 100.0f; msg.drop_rate_comm = status.drop_rate_comm; msg.errors_comm = status.errors_comm; msg.errors_count1 = status.errors_count1; @@ -562,7 +562,7 @@ protected: bat_msg.voltages[i] = 0; } } - bat_msg.current_battery = status.battery_current / 10.0f; + bat_msg.current_battery = status.battery_current * 100.0f; bat_msg.current_consumed = status.battery_discharged_mah; bat_msg.energy_consumed = -1.0f; bat_msg.battery_remaining = (status.battery_voltage > 0) ? From fc1924deeca434b8ac668f5d56b1aace2dbd82f1 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Tue, 4 Aug 2015 23:26:54 +0200 Subject: [PATCH 2/5] Support the SYS_USE_IO=0 operation mode even with AUX mixer file present --- ROMFS/px4fmu_common/init.d/rc.interface | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.interface b/ROMFS/px4fmu_common/init.d/rc.interface index 71b670888e4..571e808b6fb 100644 --- a/ROMFS/px4fmu_common/init.d/rc.interface +++ b/ROMFS/px4fmu_common/init.d/rc.interface @@ -98,6 +98,13 @@ then fi # check if should load secondary mixer +set OUTPUT_AUX_DEV /dev/pwm_output1 +if [ -f $OUTPUT_AUX_DEV ] +then +else + set MIXER_AUX none +fi + if [ $MIXER_AUX != none ] then # @@ -105,7 +112,6 @@ then # set MIXER_AUX_FILE none - set OUTPUT_AUX_DEV /dev/pwm_output1 if [ -f $SDCARD_MIXERS_PATH/$MIXER_AUX.aux.mix ] then @@ -169,3 +175,4 @@ then fi fi unset OUTPUT_DEV +unset OUTPUT_AUX_DEV From 9918ff9bd43493d59e4bc40b74adc624acc9eb26 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 6 Aug 2015 00:12:14 +0200 Subject: [PATCH 3/5] Fix AUX ports, still retain successful boot for systems without IO --- ROMFS/px4fmu_common/init.d/rc.interface | 25 +++++++++++++------------ ROMFS/px4fmu_common/init.d/rcS | 14 +++++++------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.interface b/ROMFS/px4fmu_common/init.d/rc.interface index 571e808b6fb..61abda34279 100644 --- a/ROMFS/px4fmu_common/init.d/rc.interface +++ b/ROMFS/px4fmu_common/init.d/rc.interface @@ -97,14 +97,6 @@ then fi fi -# check if should load secondary mixer -set OUTPUT_AUX_DEV /dev/pwm_output1 -if [ -f $OUTPUT_AUX_DEV ] -then -else - set MIXER_AUX none -fi - if [ $MIXER_AUX != none ] then # @@ -112,6 +104,7 @@ then # set MIXER_AUX_FILE none + set OUTPUT_AUX_DEV /dev/pwm_output1 if [ -f $SDCARD_MIXERS_PATH/$MIXER_AUX.aux.mix ] then @@ -128,16 +121,24 @@ then then if fmu mode_pwm then - if mixer load $OUTPUT_AUX_DEV $MIXER_AUX_FILE + if [ -f $OUTPUT_AUX_DEV ] then - echo "[i] Mixer: $MIXER_AUX_FILE on $OUTPUT_AUX_DEV" + if mixer load $OUTPUT_AUX_DEV $MIXER_AUX_FILE + then + echo "[i] Mixer: $MIXER_AUX_FILE on $OUTPUT_AUX_DEV" + else + echo "[i] Error loading mixer: $MIXER_AUX_FILE" + echo "ERROR: Could not load mixer: $MIXER_AUX_FILE" >> $LOG_FILE + fi else - echo "[i] Error loading mixer: $MIXER_AUX_FILE" - echo "ERROR: Could not load mixer: $MIXER_AUX_FILE" >> $LOG_FILE + set PWM_AUX_OUT none + set FAILSAFE_AUX none fi else echo "ERROR: Could not start: fmu mode_pwm" >> $LOG_FILE tone_alarm $TUNE_ERR + set PWM_AUX_OUT none + set FAILSAFE_AUX none fi if [ $PWM_AUX_OUT != none ] diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 608ac95ef97..ad9a311ab44 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -694,13 +694,6 @@ then fi unset FEXTRAS - if [ $EXIT_ON_END == yes ] - then - echo "Exit from nsh" - exit - fi - unset EXIT_ON_END - # Run no SD alarm if [ $LOG_FILE == /dev/null ] then @@ -712,6 +705,13 @@ then # Boot is complete, inform MAVLink app(s) that the system is now fully up and running mavlink boot_complete + if [ $EXIT_ON_END == yes ] + then + echo "Exit from nsh" + exit + fi + unset EXIT_ON_END + # End of autostart fi From e2c657ede0049d372b7171b696ba1ef64f309ba4 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 6 Aug 2015 00:13:09 +0200 Subject: [PATCH 4/5] MAVLink params: Eventually time out to make QGC happy, but let the user know that the boot failed. --- src/modules/mavlink/mavlink_parameters.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/modules/mavlink/mavlink_parameters.cpp b/src/modules/mavlink/mavlink_parameters.cpp index 66c6a871762..6903ebfc8c7 100644 --- a/src/modules/mavlink/mavlink_parameters.cpp +++ b/src/modules/mavlink/mavlink_parameters.cpp @@ -215,6 +215,10 @@ MavlinkParametersManager::send(const hrt_abstime t) if ((p == PARAM_INVALID) || (_send_all_index >= (int) param_count())) { _send_all_index = -1; } + } else if (_send_all_index == 0 && hrt_absolute_time() > 20 * 1000 * 1000) { + /* the boot did not seem to ever complete, warn user and set boot complete */ + _mavlink->send_statustext_critical("WARNING: SYSTEM BOOT INCOMPLETE. CHECK CONFIG."); + _mavlink->set_boot_complete(); } } From 003a3b0b3663b03b07bdb2f6771b80b2a190a7d0 Mon Sep 17 00:00:00 2001 From: Lorenz Meier Date: Thu, 6 Aug 2015 09:38:15 +0200 Subject: [PATCH 5/5] Fix file presence operator (thanks to @sjwilks) --- ROMFS/px4fmu_common/init.d/rc.interface | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ROMFS/px4fmu_common/init.d/rc.interface b/ROMFS/px4fmu_common/init.d/rc.interface index 61abda34279..f3761200a13 100644 --- a/ROMFS/px4fmu_common/init.d/rc.interface +++ b/ROMFS/px4fmu_common/init.d/rc.interface @@ -121,7 +121,7 @@ then then if fmu mode_pwm then - if [ -f $OUTPUT_AUX_DEV ] + if [ -e $OUTPUT_AUX_DEV ] then if mixer load $OUTPUT_AUX_DEV $MIXER_AUX_FILE then