diff --git a/conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml b/conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml
index d2b0a0ab4d..4d68ce1534 100644
--- a/conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml
+++ b/conf/airframes/examples/quadrotor_lisa_m_2_pwm_spektrum.xml
@@ -217,7 +217,7 @@
diff --git a/conf/firmwares/subsystems/fixedwing/fdm_jsbsim.makefile b/conf/firmwares/subsystems/fixedwing/fdm_jsbsim.makefile
index 688d5b7cb4..ed7ce66951 100644
--- a/conf/firmwares/subsystems/fixedwing/fdm_jsbsim.makefile
+++ b/conf/firmwares/subsystems/fixedwing/fdm_jsbsim.makefile
@@ -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 \
diff --git a/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile b/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile
index 25afc4658b..45b618f08d 100644
--- a/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile
+++ b/conf/firmwares/subsystems/rotorcraft/fdm_jsbsim.makefile
@@ -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 \
diff --git a/conf/settings/nps.xml b/conf/settings/nps.xml
index 8fb6ed6513..279caca01c 100644
--- a/conf/settings/nps.xml
+++ b/conf/settings/nps.xml
@@ -6,6 +6,7 @@
+
diff --git a/sw/simulator/nps/nps_autopilot_fixedwing.c b/sw/simulator/nps/nps_autopilot_fixedwing.c
index 5cf695e12c..27826df4e3 100644
--- a/sw/simulator/nps/nps_autopilot_fixedwing.c
+++ b/sw/simulator/nps/nps_autopilot_fixedwing.c
@@ -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
#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)) {
diff --git a/sw/simulator/nps/nps_autopilot_rotorcraft.c b/sw/simulator/nps/nps_autopilot_rotorcraft.c
index 0064c2f897..6641cc5dc8 100644
--- a/sw/simulator/nps/nps_autopilot_rotorcraft.c
+++ b/sw/simulator/nps/nps_autopilot_rotorcraft.c
@@ -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
#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)) {