diff --git a/conf/Makefile.stm32 b/conf/Makefile.stm32 index fb7fe7ea20..be9a360e33 100644 --- a/conf/Makefile.stm32 +++ b/conf/Makefile.stm32 @@ -138,7 +138,7 @@ else LDFLAGS = -D__thumb2__ -T$(LDSCRIPT) -nostartfiles -L$(GCC_LIB_DIR) -O$(OPT) --gc-sections endif LDFLAGS += -Wl,-Map=$(OBJDIR)/$(TARGET).map,--cref,--gc-sections -LDLIBS += -lc -lm -lgcc -lcmsis -lstm32 +LDLIBS += -lc -lm -lgcc -lcmsis -lstm32 -lopencm3_stm32 CPFLAGS = -j .isr_vector -j .text -j .data CPFLAGS_BIN = -Obinary diff --git a/conf/autopilot/rotorcraft.makefile b/conf/autopilot/rotorcraft.makefile index 69a38e4fa8..67742ac630 100644 --- a/conf/autopilot/rotorcraft.makefile +++ b/conf/autopilot/rotorcraft.makefile @@ -93,6 +93,8 @@ endif # or # include subsystems/rotorcraft/telemetry_xbee_api.makefile # +ap.srcs += subsystems/settings.c +ap.srcs += $(SRC_ARCH)/subsystems/settings_arch.c ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c # I2C is needed for speed controllers and barometers on lisa diff --git a/sw/airborne/arch/lpc21/subsystems/settings_arch.c b/sw/airborne/arch/lpc21/subsystems/settings_arch.c new file mode 100644 index 0000000000..517749b900 --- /dev/null +++ b/sw/airborne/arch/lpc21/subsystems/settings_arch.c @@ -0,0 +1,10 @@ +#include "subsystems/settings.h" + + +int32_t persistent_write(uint32_t ptr, uint32_t size) { + return 0; +} + +int32_t persistent_read(uint32_t ptr, uint32_t size) { + return 0; +} diff --git a/sw/airborne/firmwares/rotorcraft/main.c b/sw/airborne/firmwares/rotorcraft/main.c index fd6ce9a3ee..1a960eda0c 100644 --- a/sw/airborne/firmwares/rotorcraft/main.c +++ b/sw/airborne/firmwares/rotorcraft/main.c @@ -32,6 +32,7 @@ #include "downlink.h" #include "firmwares/rotorcraft/telemetry.h" #include "datalink.h" +#include "subsystems/settings.h" #include "xbee.h" #include "booz2_commands.h" @@ -46,7 +47,6 @@ #include "subsystems/electrical.h" -// #include "booz_fms.h" // FIXME #include "firmwares/rotorcraft/autopilot.h" #include "firmwares/rotorcraft/stabilization.h" @@ -108,7 +108,6 @@ STATIC_INLINE void main_init( void ) { baro_init(); imu_init(); - // booz_fms_init(); // FIXME autopilot_init(); nav_init(); guidance_h_init(); @@ -126,6 +125,8 @@ STATIC_INLINE void main_init( void ) { modules_init(); + settings_init(); + mcu_int_enable(); } diff --git a/sw/airborne/subsystems/settings.c b/sw/airborne/subsystems/settings.c index 6453235c6e..1332f5831e 100644 --- a/sw/airborne/subsystems/settings.c +++ b/sw/airborne/subsystems/settings.c @@ -6,9 +6,11 @@ bool_t settings_store_now; void settings_init(void) { +#ifdef USE_PERMANENT_SETTINGS if (persistent_read((uint32_t)&pers_settings, sizeof(struct PersistentSettings))) return; // return -1 ? persitent_settings_load(); +#endif } diff --git a/sw/airborne/test/subsystems/test_settings.c b/sw/airborne/test/subsystems/test_settings.c index cf37af0782..1f33f4aad1 100644 --- a/sw/airborne/test/subsystems/test_settings.c +++ b/sw/airborne/test/subsystems/test_settings.c @@ -34,6 +34,7 @@ #include "mcu_periph/uart.h" #include "messages.h" +#include "my_debug_servo.h" static inline void main_init( void ); static inline void main_periodic( void ); @@ -61,13 +62,22 @@ static inline void main_init( void ) { mcu_init(); sys_time_init(); settings_init(); + // DEBUG_SERVO2_INIT(); + // LED_ON(1); + // LED_ON(2); + // DEBUG_S4_ON(); + // DEBUG_S5_ON(); + // DEBUG_S6_ON(); mcu_int_enable(); } static inline void main_periodic( void ) { - RunOnceEvery(100, {DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM);}); + RunOnceEvery(100, { + DOWNLINK_SEND_ALIVE(DefaultChannel, 16, MD5SUM); + PeriodicSendDlValue(DefaultChannel); + }); } diff --git a/sw/tools/gen_settings.ml b/sw/tools/gen_settings.ml index fdd5363cc8..5619e088a1 100644 --- a/sw/tools/gen_settings.ml +++ b/sw/tools/gen_settings.ml @@ -138,14 +138,14 @@ let print_dl_settings = fun settings -> left() (* - Blaaaaaa + Generate code for persitent settings *) let print_persistent_settings = fun settings -> let settings = flatten settings [] in let pers_settings = List.filter (fun x -> try let _ = Xml.attrib x "persistent" in true with _ -> false) settings in (* structure declaration *) - if List.length pers_settings > 0 then begin +(* if List.length pers_settings > 0 then begin *) lprintf "\n/* Persistent Settings */\n"; lprintf "struct PersistentSettings {\n"; right(); @@ -180,7 +180,7 @@ let print_persistent_settings = fun settings -> pers_settings; left(); lprintf "};\n" - end +(* end *) (*