From 5dc0f397a6e64cfd6621ff5d5d5ec07a4471106c Mon Sep 17 00:00:00 2001 From: James Cotton Date: Fri, 7 Oct 2011 14:08:56 -0500 Subject: [PATCH 1/3] OP-499 Erase settings bug: Make hte flash chip read a wrong value for 1 second before wiping settings. --- flight/PiOS/Common/pios_flashfs_objlist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/PiOS/Common/pios_flashfs_objlist.c b/flight/PiOS/Common/pios_flashfs_objlist.c index 2b2fe06fa..b252ef81e 100644 --- a/flight/PiOS/Common/pios_flashfs_objlist.c +++ b/flight/PiOS/Common/pios_flashfs_objlist.c @@ -61,7 +61,7 @@ struct fileHeader { #define OBJECT_TABLE_START 0x00000010 #define OBJECT_TABLE_END 0x00001000 #define SECTOR_SIZE 0x00001000 -#define MAX_BADMAGIC 4 +#define MAX_BADMAGIC 1000 /** * @brief Initialize the flash object setting FS @@ -72,7 +72,7 @@ int32_t PIOS_FLASHFS_Init() // Check for valid object table or create one uint32_t object_table_magic; - uint8_t magic_fail_count = 0; + uint32_t magic_fail_count = 0; bool magic_good = false; while(!magic_good) { @@ -85,7 +85,7 @@ int32_t PIOS_FLASHFS_Init() magic_fail_count = 0; magic_good = true; } else { - PIOS_DELAY_WaituS(100); + PIOS_DELAY_WaituS(1000); } } From 0f1a6264de51948de685f54ca59afcf2a9379166 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sat, 8 Oct 2011 14:12:53 -0500 Subject: [PATCH 2/3] Fix jtag programming of bootloader --- flight/Bootloaders/AHRS/Makefile | 2 +- flight/Bootloaders/CopterControl/Makefile | 2 +- flight/Bootloaders/OpenPilot/Makefile | 2 +- flight/Bootloaders/PipXtreme/Makefile | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/flight/Bootloaders/AHRS/Makefile b/flight/Bootloaders/AHRS/Makefile index 18bf8a269..fe52f8ae0 100644 --- a/flight/Bootloaders/AHRS/Makefile +++ b/flight/Bootloaders/AHRS/Makefile @@ -354,7 +354,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin # Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/Bootloaders/CopterControl/Makefile b/flight/Bootloaders/CopterControl/Makefile index 99521020d..cc98fb777 100644 --- a/flight/Bootloaders/CopterControl/Makefile +++ b/flight/Bootloaders/CopterControl/Makefile @@ -413,7 +413,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin # Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/Bootloaders/OpenPilot/Makefile b/flight/Bootloaders/OpenPilot/Makefile index cad11dedf..d4a944c0d 100644 --- a/flight/Bootloaders/OpenPilot/Makefile +++ b/flight/Bootloaders/OpenPilot/Makefile @@ -419,7 +419,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin # Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf diff --git a/flight/Bootloaders/PipXtreme/Makefile b/flight/Bootloaders/PipXtreme/Makefile index 19b651a5f..94d7206ed 100644 --- a/flight/Bootloaders/PipXtreme/Makefile +++ b/flight/Bootloaders/PipXtreme/Makefile @@ -414,7 +414,7 @@ $(eval $(call PARTIAL_COMPILE_ARM_TEMPLATE, SRCARM)) $(OUTDIR)/$(TARGET).bin.o: $(OUTDIR)/$(TARGET).bin # Add jtag targets (program and wipe) -$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(BL_BANK_BASE),$(BL_BANK_SIZE))) +$(eval $(call JTAG_TEMPLATE,$(OUTDIR)/$(TARGET).bin,$(FW_BANK_BASE),$(FW_BANK_SIZE),$(OPENOCD_CONFIG))) .PHONY: elf lss sym hex bin bino elf: $(OUTDIR)/$(TARGET).elf From 7da8cb2079c3c59aee0d10f51cc15ff2db3f39f8 Mon Sep 17 00:00:00 2001 From: James Cotton Date: Sat, 8 Oct 2011 14:15:48 -0500 Subject: [PATCH 3/3] CC: After attitude calibration always reenable BiasCorrectGyro. Fixes odd bug if people have it crash in the middle. --- .../openpilotgcs/src/plugins/config/configccattitudewidget.cpp | 3 +-- .../openpilotgcs/src/plugins/config/configccattitudewidget.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp index c659180af..6ad28c666 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.cpp @@ -98,7 +98,7 @@ void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) { attitudeSettingsData.GyroBias[0] = -x_gyro_bias; attitudeSettingsData.GyroBias[1] = -y_gyro_bias; attitudeSettingsData.GyroBias[2] = -z_gyro_bias; - attitudeSettingsData.BiasCorrectGyro = initialBiasCorrected; + attitudeSettingsData.BiasCorrectGyro = AttitudeSettings::BIASCORRECTGYRO_TRUE; AttitudeSettings::GetInstance(getObjectManager())->setData(attitudeSettingsData); } else { @@ -134,7 +134,6 @@ void ConfigCCAttitudeWidget::startAccelCalibration() { // Disable gyro bias correction to see raw data AttitudeSettings::DataFields attitudeSettingsData = AttitudeSettings::GetInstance(getObjectManager())->getData(); - initialBiasCorrected = attitudeSettingsData.BiasCorrectGyro; attitudeSettingsData.BiasCorrectGyro = AttitudeSettings::BIASCORRECTGYRO_FALSE; AttitudeSettings::GetInstance(getObjectManager())->setData(attitudeSettingsData); diff --git a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h index 09dfdb222..af107f670 100644 --- a/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h +++ b/ground/openpilotgcs/src/plugins/config/configccattitudewidget.h @@ -57,7 +57,6 @@ private: Ui_ccattitude *ui; QTimer timer; UAVObject::Metadata initialMdata; - quint8 initialBiasCorrected; int updates;