[nps] bat_voltage adjustable via settings

This commit is contained in:
Felix Ruess
2013-09-13 13:18:09 +02:00
parent 6ea53c5c15
commit 3e1b88fe3e
6 changed files with 16 additions and 18 deletions
@@ -217,7 +217,7 @@
<section name="BAT">
<define name="CATASTROPHIC_BAT_LEVEL" value="9.3" unit="V"/>
<define name="CRITIC_BAT_LEVEL" value="9.6" unit="V"/>
<define name="LOW_BAT_LEVEL" value="9.7" unit="V"/>
<define name="LOW_BAT_LEVEL" value="10.1" unit="V"/>
<define name="MAX_BAT_LEVEL" value="12.4" unit="V"/>
</section>
@@ -52,6 +52,7 @@ nps.srcs += $(NPSDIR)/nps_main.c \
$(NPSDIR)/nps_sensor_mag.c \
$(NPSDIR)/nps_sensor_baro.c \
$(NPSDIR)/nps_sensor_gps.c \
$(NPSDIR)/nps_electrical.c \
$(NPSDIR)/nps_radio_control.c \
$(NPSDIR)/nps_radio_control_joystick.c \
$(NPSDIR)/nps_radio_control_spektrum.c \
@@ -48,6 +48,7 @@ nps.srcs += $(NPSDIR)/nps_main.c \
$(NPSDIR)/nps_sensor_mag.c \
$(NPSDIR)/nps_sensor_baro.c \
$(NPSDIR)/nps_sensor_gps.c \
$(NPSDIR)/nps_electrical.c \
$(NPSDIR)/nps_radio_control.c \
$(NPSDIR)/nps_radio_control_joystick.c \
$(NPSDIR)/nps_radio_control_spektrum.c \
+1
View File
@@ -6,6 +6,7 @@
<dl_settings NAME="Sim">
<dl_setting var="nps_bypass_ahrs" min="0" step="1" max="1" module="nps/nps_autopilot_rotorcraft" shortname="bypass_ahrs" values="No|Yes"/>
<dl_setting var="nps_bypass_ins" min="0" step="1" max="1" module="nps/nps_autopilot_rotorcraft" shortname="bypass_ins" values="No|Yes"/>
<dl_setting var="nps_electrical.supply_voltage" min="0" step="0.1" max="24" module="nps/nps_electrical" shortname="bat_voltage" unit="V"/>
</dl_settings>
</dl_settings>
+6 -9
View File
@@ -38,13 +38,13 @@
#include "nps_sensors.h"
#include "nps_radio_control.h"
#include "nps_electrical.h"
#include "nps_fdm.h"
#include "subsystems/radio_control.h"
#include "subsystems/imu.h"
#include "subsystems/sensors/baro.h"
#include "baro_board.h"
#include "subsystems/electrical.h"
#include "mcu_periph/sys_time.h"
#include "state.h"
#include "subsystems/commands.h"
@@ -65,18 +65,13 @@ bool_t nps_bypass_ahrs;
void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char* rc_dev) {
nps_radio_control_init(type_rc, num_rc_script, rc_dev);
nps_electrical_init();
nps_bypass_ahrs = NPS_BYPASS_AHRS;
Fbw(init);
Ap(init);
#ifdef MAX_BAT_LEVEL
electrical.vsupply = MAX_BAT_LEVEL * 10;
#else
electrical.vsupply = 111;
#endif
}
void nps_autopilot_run_systime_step( void ) {
@@ -86,7 +81,9 @@ void nps_autopilot_run_systime_step( void ) {
#include <stdio.h>
#include "subsystems/gps.h"
void nps_autopilot_run_step(double time __attribute__ ((unused))) {
void nps_autopilot_run_step(double time) {
nps_electrical_run_step(time);
#ifdef RADIO_CONTROL_TYPE_PPM
if (nps_radio_control_available(time)) {
+6 -8
View File
@@ -24,13 +24,13 @@
#include "firmwares/rotorcraft/main.h"
#include "nps_sensors.h"
#include "nps_radio_control.h"
#include "nps_electrical.h"
#include "nps_fdm.h"
#include "subsystems/radio_control.h"
#include "subsystems/imu.h"
#include "subsystems/sensors/baro.h"
#include "baro_board.h"
#include "subsystems/electrical.h"
#include "mcu_periph/sys_time.h"
#include "state.h"
#include "subsystems/ahrs.h"
@@ -56,17 +56,13 @@ bool_t nps_bypass_ins;
void nps_autopilot_init(enum NpsRadioControlType type_rc, int num_rc_script, char* rc_dev) {
nps_radio_control_init(type_rc, num_rc_script, rc_dev);
nps_electrical_init();
nps_bypass_ahrs = NPS_BYPASS_AHRS;
nps_bypass_ins = NPS_BYPASS_INS;
main_init();
#ifdef MAX_BAT_LEVEL
electrical.vsupply = MAX_BAT_LEVEL * 10;
#else
electrical.vsupply = 111;
#endif
}
void nps_autopilot_run_systime_step( void ) {
@@ -76,7 +72,9 @@ void nps_autopilot_run_systime_step( void ) {
#include <stdio.h>
#include "subsystems/gps.h"
void nps_autopilot_run_step(double time __attribute__ ((unused))) {
void nps_autopilot_run_step(double time) {
nps_electrical_run_step(time);
#ifdef RADIO_CONTROL_TYPE_PPM
if (nps_radio_control_available(time)) {