From b6991b57a09a7a6b15763a612435591fa4e23fae Mon Sep 17 00:00:00 2001 From: Nicholas Sherlock Date: Wed, 4 Mar 2015 20:46:13 +1300 Subject: [PATCH] Fix invalid memory read during compass initialisation --- src/main/sensors/initialisation.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/sensors/initialisation.c b/src/main/sensors/initialisation.c index d3bf32a0e..4b9e20a26 100644 --- a/src/main/sensors/initialisation.c +++ b/src/main/sensors/initialisation.c @@ -457,10 +457,10 @@ static void detectMag(magSensor_e magHardwareToUse) magSensor_e magHardware; #ifdef USE_MAG_HMC5883 - static hmc5883Config_t *hmc5883Config = 0; + hmc5883Config_t *hmc5883Config = 0; #ifdef NAZE - hmc5883Config_t nazeHmc5883Config; + static hmc5883Config_t nazeHmc5883Config; if (hardwareRevision < NAZE32_REV5) { nazeHmc5883Config.gpioAPB2Peripherals = RCC_APB2Periph_GPIOB; @@ -476,7 +476,7 @@ static void detectMag(magSensor_e magHardwareToUse) #endif #ifdef SPRACINGF3 - hmc5883Config_t spRacingF3Hmc5883Config = { + static hmc5883Config_t spRacingF3Hmc5883Config = { .gpioAHBPeripherals = RCC_AHBPeriph_GPIOC, .gpioPin = Pin_14, .gpioPort = GPIOC