diff --git a/docs/Settings.md b/docs/Settings.md index 54c537cfbc4..0a4792476b7 100644 --- a/docs/Settings.md +++ b/docs/Settings.md @@ -2815,6 +2815,7 @@ Selection of mag hardware. See Wiki Sensor auto detect and hardware failure dete | RM3100 | | | VCM5883 | | | MLX90393 | | +| LIS2MDL | | | FAKE | | --- diff --git a/docs/development/msp/inav_enums.json b/docs/development/msp/inav_enums.json index 05b5eafedd3..7f5e0f6f1cb 100644 --- a/docs/development/msp/inav_enums.json +++ b/docs/development/msp/inav_enums.json @@ -650,7 +650,8 @@ "BOXGIMBALHTRK": "59", "BOXAUTOSPEED": "60", "BOXTERRAINAGLHOLD": "61", - "CHECKBOX_ITEM_COUNT": "62" + "BOXINFLIGHTMENU": "62", + "CHECKBOX_ITEM_COUNT": "63" }, "busIndex_e": { "_source": "inav/src/main/drivers/bus.h", @@ -847,32 +848,33 @@ "DEVHW_RM3100": "32", "DEVHW_VCM5883": "33", "DEVHW_MLX90393": "34", - "DEVHW_LM75_0": "35", - "DEVHW_LM75_1": "36", - "DEVHW_LM75_2": "37", - "DEVHW_LM75_3": "38", - "DEVHW_LM75_4": "39", - "DEVHW_LM75_5": "40", - "DEVHW_LM75_6": "41", - "DEVHW_LM75_7": "42", - "DEVHW_DS2482": "43", - "DEVHW_MAX7456": "44", - "DEVHW_SRF10": "45", - "DEVHW_VL53L0X": "46", - "DEVHW_VL53L1X": "47", - "DEVHW_US42": "48", - "DEVHW_TOF10120_I2C": "49", - "DEVHW_TERARANGER_EVO_I2C": "50", - "DEVHW_MS4525": "51", - "DEVHW_MS5525": "52", - "DEVHW_DLVR": "53", - "DEVHW_M25P16": "54", - "DEVHW_W25N": "55", - "DEVHW_UG2864": "56", - "DEVHW_SDCARD": "57", - "DEVHW_IRLOCK": "58", - "DEVHW_PCF8574": "59", - "DEVHW_INA226": "60" + "DEVHW_LIS2MDL": "35", + "DEVHW_LM75_0": "36", + "DEVHW_LM75_1": "37", + "DEVHW_LM75_2": "38", + "DEVHW_LM75_3": "39", + "DEVHW_LM75_4": "40", + "DEVHW_LM75_5": "41", + "DEVHW_LM75_6": "42", + "DEVHW_LM75_7": "43", + "DEVHW_DS2482": "44", + "DEVHW_MAX7456": "45", + "DEVHW_SRF10": "46", + "DEVHW_VL53L0X": "47", + "DEVHW_VL53L1X": "48", + "DEVHW_US42": "49", + "DEVHW_TOF10120_I2C": "50", + "DEVHW_TERARANGER_EVO_I2C": "51", + "DEVHW_MS4525": "52", + "DEVHW_MS5525": "53", + "DEVHW_DLVR": "54", + "DEVHW_M25P16": "55", + "DEVHW_W25N": "56", + "DEVHW_UG2864": "57", + "DEVHW_SDCARD": "58", + "DEVHW_IRLOCK": "59", + "DEVHW_PCF8574": "60", + "DEVHW_INA226": "61" }, "deviceFlags_e": { "_source": "inav/src/main/drivers/bus.h", @@ -2367,7 +2369,8 @@ "MAG_RM3100": "13", "MAG_VCM5883": "14", "MAG_MLX90393": "15", - "MAG_FAKE": "16", + "MAG_LIS2MDL": "16", + "MAG_FAKE": "17", "MAG_MAX": "MAG_FAKE" }, "mavlinkAutopilotType_e": { @@ -2997,6 +3000,14 @@ "NAV_WP_USER3": "(1<<3)", "NAV_WP_USER4": "(1<<4)" }, + "oledControllerType_e": { + "_source": "inav/src/main/drivers/display_ug2864hsweg01.c", + "OLED_CONTROLLER_UNKNOWN": "0", + "OLED_CONTROLLER_SSD1306": "1", + "OLED_CONTROLLER_SH1106": "2", + "OLED_CONTROLLER_SH1107": "3", + "OLED_CONTROLLER_SSD1309": "4" + }, "opflowQuality_e": { "_source": "inav/src/main/sensors/opflow.h", "OPFLOW_QUALITY_INVALID": "0", @@ -3213,7 +3224,8 @@ "OSD_THROTTLE_GAUGE": "168", "OSD_GPS_EXTRA_STATS": "169", "OSD_AUTO_SPEED": "170", - "OSD_ITEM_COUNT": "171" + "OSD_TERRAIN_AGL": "171", + "OSD_ITEM_COUNT": "172" }, "osd_sidebar_arrow_e": { "_source": "inav/src/main/io/osd_grid.c", @@ -3339,7 +3351,8 @@ "PID_ZERO_INTEGRATOR": "1 << 1", "PID_SHRINK_INTEGRATOR": "1 << 2", "PID_LIMIT_INTEGRATOR": "1 << 3", - "PID_FREEZE_INTEGRATOR": "1 << 4" + "PID_FREEZE_INTEGRATOR": "1 << 4", + "PID_USING_HEADING": "1 << 5" }, "pidIndex_e": { "_source": "inav/src/main/flight/pid.h", @@ -4025,6 +4038,12 @@ "SITL_CAN_MODE_STUB": "0", "SITL_CAN_MODE_SOCKETCAN": "1" }, + "sliceAssign_e": { + "_source": "inav/src/main/drivers/pwm_output_rp2350.c", + "SLICE_UNASSIGNED": "0", + "SLICE_AS_MOTOR": "1", + "SLICE_AS_SERVO": "2" + }, "smartAudioVersion_e": { "_source": "inav/src/main/io/vtx_smartaudio.h", "SA_UNKNOWN": "0", diff --git a/docs/development/msp/inav_enums_ref.md b/docs/development/msp/inav_enums_ref.md index 5f7116d71eb..87168663713 100644 --- a/docs/development/msp/inav_enums_ref.md +++ b/docs/development/msp/inav_enums_ref.md @@ -239,6 +239,7 @@ - [navWaypointFlags_e](#enum-navwaypointflags_e) - [navWaypointHeadings_e](#enum-navwaypointheadings_e) - [navWaypointP3Flags_e](#enum-navwaypointp3flags_e) +- [oledControllerType_e](#enum-oledcontrollertype_e) - [opflowQuality_e](#enum-opflowquality_e) - [opticalFlowSensor_e](#enum-opticalflowsensor_e) - [osd_adsb_warning_style_e](#enum-osd_adsb_warning_style_e) @@ -325,6 +326,7 @@ - [simTxFlags_e](#enum-simtxflags_e) - [simulatorFlags_t](#enum-simulatorflags_t) - [sitlCANMode_e](#enum-sitlcanmode_e) +- [sliceAssign_e](#enum-sliceassign_e) - [smartAudioVersion_e](#enum-smartaudioversion_e) - [smartportFuelUnit_e](#enum-smartportfuelunit_e) - [softSerialPortIndex_e](#enum-softserialportindex_e) @@ -1200,7 +1202,8 @@ | `BOXGIMBALHTRK` | 59 | | | `BOXAUTOSPEED` | 60 | | | `BOXTERRAINAGLHOLD` | 61 | | -| `CHECKBOX_ITEM_COUNT` | 62 | | +| `BOXINFLIGHTMENU` | 62 | | +| `CHECKBOX_ITEM_COUNT` | 63 | | --- ## `busIndex_e` @@ -1472,32 +1475,33 @@ | `DEVHW_RM3100` | 32 | | | `DEVHW_VCM5883` | 33 | | | `DEVHW_MLX90393` | 34 | | -| `DEVHW_LM75_0` | 35 | | -| `DEVHW_LM75_1` | 36 | | -| `DEVHW_LM75_2` | 37 | | -| `DEVHW_LM75_3` | 38 | | -| `DEVHW_LM75_4` | 39 | | -| `DEVHW_LM75_5` | 40 | | -| `DEVHW_LM75_6` | 41 | | -| `DEVHW_LM75_7` | 42 | | -| `DEVHW_DS2482` | 43 | | -| `DEVHW_MAX7456` | 44 | | -| `DEVHW_SRF10` | 45 | | -| `DEVHW_VL53L0X` | 46 | | -| `DEVHW_VL53L1X` | 47 | | -| `DEVHW_US42` | 48 | | -| `DEVHW_TOF10120_I2C` | 49 | | -| `DEVHW_TERARANGER_EVO_I2C` | 50 | | -| `DEVHW_MS4525` | 51 | | -| `DEVHW_MS5525` | 52 | | -| `DEVHW_DLVR` | 53 | | -| `DEVHW_M25P16` | 54 | | -| `DEVHW_W25N` | 55 | | -| `DEVHW_UG2864` | 56 | | -| `DEVHW_SDCARD` | 57 | | -| `DEVHW_IRLOCK` | 58 | | -| `DEVHW_PCF8574` | 59 | | -| `DEVHW_INA226` | 60 | | +| `DEVHW_LIS2MDL` | 35 | | +| `DEVHW_LM75_0` | 36 | | +| `DEVHW_LM75_1` | 37 | | +| `DEVHW_LM75_2` | 38 | | +| `DEVHW_LM75_3` | 39 | | +| `DEVHW_LM75_4` | 40 | | +| `DEVHW_LM75_5` | 41 | | +| `DEVHW_LM75_6` | 42 | | +| `DEVHW_LM75_7` | 43 | | +| `DEVHW_DS2482` | 44 | | +| `DEVHW_MAX7456` | 45 | | +| `DEVHW_SRF10` | 46 | | +| `DEVHW_VL53L0X` | 47 | | +| `DEVHW_VL53L1X` | 48 | | +| `DEVHW_US42` | 49 | | +| `DEVHW_TOF10120_I2C` | 50 | | +| `DEVHW_TERARANGER_EVO_I2C` | 51 | | +| `DEVHW_MS4525` | 52 | | +| `DEVHW_MS5525` | 53 | | +| `DEVHW_DLVR` | 54 | | +| `DEVHW_M25P16` | 55 | | +| `DEVHW_W25N` | 56 | | +| `DEVHW_UG2864` | 57 | | +| `DEVHW_SDCARD` | 58 | | +| `DEVHW_IRLOCK` | 59 | | +| `DEVHW_PCF8574` | 60 | | +| `DEVHW_INA226` | 61 | | --- ## `deviceFlags_e` @@ -3506,7 +3510,8 @@ | `MAG_RM3100` | 13 | | | `MAG_VCM5883` | 14 | | | `MAG_MLX90393` | 15 | | -| `MAG_FAKE` | 16 | | +| `MAG_LIS2MDL` | 16 | | +| `MAG_FAKE` | 17 | | | `MAG_MAX` | MAG_FAKE | | --- @@ -4413,6 +4418,19 @@ | `NAV_WP_USER3` | (1<<3) | | | `NAV_WP_USER4` | (1<<4) | | +--- +## `oledControllerType_e` + +> Source: ../../../src/main/drivers/display_ug2864hsweg01.c + +| Enumerator | Value | Condition | +|---|---:|---| +| `OLED_CONTROLLER_UNKNOWN` | 0 | | +| `OLED_CONTROLLER_SSD1306` | 1 | | +| `OLED_CONTROLLER_SH1106` | 2 | | +| `OLED_CONTROLLER_SH1107` | 3 | | +| `OLED_CONTROLLER_SSD1309` | 4 | | + --- ## `opflowQuality_e` @@ -4669,7 +4687,8 @@ | `OSD_THROTTLE_GAUGE` | 168 | | | `OSD_GPS_EXTRA_STATS` | 169 | | | `OSD_AUTO_SPEED` | 170 | | -| `OSD_ITEM_COUNT` | 171 | | +| `OSD_TERRAIN_AGL` | 171 | | +| `OSD_ITEM_COUNT` | 172 | | --- ## `osd_sidebar_arrow_e` @@ -4871,6 +4890,7 @@ | `PID_SHRINK_INTEGRATOR` | 1 << 2 | | | `PID_LIMIT_INTEGRATOR` | 1 << 3 | | | `PID_FREEZE_INTEGRATOR` | 1 << 4 | | +| `PID_USING_HEADING` | 1 << 5 | | --- ## `pidIndex_e` @@ -5829,6 +5849,17 @@ | `SITL_CAN_MODE_STUB` | 0 | | | `SITL_CAN_MODE_SOCKETCAN` | 1 | | +--- +## `sliceAssign_e` + +> Source: ../../../src/main/drivers/pwm_output_rp2350.c + +| Enumerator | Value | Condition | +|---|---:|---| +| `SLICE_UNASSIGNED` | 0 | | +| `SLICE_AS_MOTOR` | 1 | | +| `SLICE_AS_SERVO` | 2 | | + --- ## `smartAudioVersion_e` diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index 52cab01f68b..3320ada0a25 100755 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -153,6 +153,8 @@ main_sources(COMMON_SRC drivers/compass/compass_ist8308.h drivers/compass/compass_ist8310.c drivers/compass/compass_ist8310.h + drivers/compass/compass_lis2mdl.c + drivers/compass/compass_lis2mdl.h drivers/compass/compass_lis3mdl.c drivers/compass/compass_lis3mdl.h drivers/compass/compass_mag3110.c diff --git a/src/main/drivers/bus.h b/src/main/drivers/bus.h index be55d7e162f..75da648427b 100644 --- a/src/main/drivers/bus.h +++ b/src/main/drivers/bus.h @@ -115,6 +115,7 @@ typedef enum { DEVHW_RM3100, DEVHW_VCM5883, DEVHW_MLX90393, + DEVHW_LIS2MDL, /* Temp sensor chips */ DEVHW_LM75_0, diff --git a/src/main/drivers/compass/compass_lis2mdl.c b/src/main/drivers/compass/compass_lis2mdl.c new file mode 100644 index 00000000000..625d0c4de50 --- /dev/null +++ b/src/main/drivers/compass/compass_lis2mdl.c @@ -0,0 +1,135 @@ +/* + * This file is part of INAV Project. + * + * INAV Project is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV Project is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#include +#include + +#include "platform.h" + +#ifdef USE_MAG_LIS2MDL + +#include "common/axis.h" + +#include "drivers/time.h" +#include "drivers/sensor.h" + +#include "drivers/compass/compass.h" +#include "drivers/compass/compass_lis2mdl.h" + +// LIS2MDL, IIS2MDC, LSM303AGR and LSM303AH are firmware and pin-to-pin compatible solutions. + +#define LIS2MDL_DEVICE_ID 0x40 + +#define LIS2MDL_REG_WHO_AM_I 0x4F +#define LIS2MDL_REG_CFG_REG_A 0x60 +#define LIS2MDL_REG_CFG_REG_B 0x61 +#define LIS2MDL_REG_CFG_REG_C 0x62 +#define LIS2MDL_REG_STATUS_REG 0x67 +#define LIS2MDL_REG_OUTX_L 0x68 + +// CFG_REG_A +#define LIS2MDL_MD_CONTINUOUS 0x00 +#define LIS2MDL_ODR_100HZ 0x0C +#define LIS2MDL_COMP_TEMP_EN 0x80 + +// CFG_REG_B +#define LIS2MDL_OFF_CANC 0x02 + +// CFG_REG_C +#define LIS2MDL_BDU 0x10 + +// STATUS_REG +#define LIS2MDL_STATUS_ZYXDA 0x08 + +static bool lis2mdlInit(magDev_t *mag) +{ + bool ack = true; + + ack = ack && busWrite(mag->busDev, LIS2MDL_REG_CFG_REG_A, LIS2MDL_MD_CONTINUOUS | LIS2MDL_ODR_100HZ | LIS2MDL_COMP_TEMP_EN); + ack = ack && busWrite(mag->busDev, LIS2MDL_REG_CFG_REG_B, LIS2MDL_OFF_CANC); + ack = ack && busWrite(mag->busDev, LIS2MDL_REG_CFG_REG_C, LIS2MDL_BDU); + + return ack; +} + +static bool lis2mdlRead(magDev_t *mag) +{ + uint8_t status = 0; + uint8_t buf[6]; + + mag->magADCRaw[X] = 0; + mag->magADCRaw[Y] = 0; + mag->magADCRaw[Z] = 0; + + bool ack = busRead(mag->busDev, LIS2MDL_REG_STATUS_REG, &status); + if (!ack || !(status & LIS2MDL_STATUS_ZYXDA)) { + return false; + } + + ack = busReadBuf(mag->busDev, LIS2MDL_REG_OUTX_L, buf, 6); + if (!ack) { + return false; + } + + const int16_t x = (int16_t)(buf[1] << 8 | buf[0]); + const int16_t y = (int16_t)(buf[3] << 8 | buf[2]); + const int16_t z = (int16_t)(buf[5] << 8 | buf[4]); + + // Adapt LIS2MDL left-handed frame to common sensor axis orientation, matching Betaflight. + mag->magADCRaw[X] = -x; + mag->magADCRaw[Y] = y; + mag->magADCRaw[Z] = z; + + return true; +} + +#define DETECTION_MAX_RETRY_COUNT 5 +static bool deviceDetect(magDev_t *mag) +{ + for (int retryCount = 0; retryCount < DETECTION_MAX_RETRY_COUNT; retryCount++) { + delay(10); + + uint8_t sig = 0; + const bool ack = busRead(mag->busDev, LIS2MDL_REG_WHO_AM_I, &sig); + + if (ack && sig == LIS2MDL_DEVICE_ID) { + return true; + } + } + + return false; +} + +bool lis2mdlDetect(magDev_t *mag) +{ + mag->busDev = busDeviceInit(BUSTYPE_I2C, DEVHW_LIS2MDL, mag->magSensorToUse, OWNER_COMPASS); + if (mag->busDev == NULL) { + return false; + } + + if (!deviceDetect(mag)) { + busDeviceDeInit(mag->busDev); + return false; + } + + mag->init = lis2mdlInit; + mag->read = lis2mdlRead; + + return true; +} + +#endif diff --git a/src/main/drivers/compass/compass_lis2mdl.h b/src/main/drivers/compass/compass_lis2mdl.h new file mode 100644 index 00000000000..1d4ca62e082 --- /dev/null +++ b/src/main/drivers/compass/compass_lis2mdl.h @@ -0,0 +1,23 @@ +/* + * This file is part of INAV Project. + * + * INAV Project is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * INAV Project is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see http://www.gnu.org/licenses/. + */ + +#pragma once + +#include "drivers/io_types.h" +#include "drivers/compass/compass.h" + +bool lis2mdlDetect(magDev_t *mag); diff --git a/src/main/fc/settings.yaml b/src/main/fc/settings.yaml index 36012a9551f..fdf95504f3a 100644 --- a/src/main/fc/settings.yaml +++ b/src/main/fc/settings.yaml @@ -8,7 +8,7 @@ tables: values: ["NONE", "SRF10", "VL53L0X", "MSP", "BENEWAKE", "VL53L1X", "US42", "TOF10120_I2C", "FAKE", "TERARANGER_EVO", "USD1_V0", "NRA"] enum: rangefinderType_e - name: mag_hardware - values: ["NONE", "AUTO", "HMC5883", "AK8975", "MAG3110", "AK8963", "IST8310", "QMC5883", "QMC5883P", "MPU9250", "IST8308", "LIS3MDL", "MSP", "RM3100", "VCM5883", "MLX90393", "FAKE"] + values: ["NONE", "AUTO", "HMC5883", "AK8975", "MAG3110", "AK8963", "IST8310", "QMC5883", "QMC5883P", "MPU9250", "IST8308", "LIS3MDL", "MSP", "RM3100", "VCM5883", "MLX90393", "LIS2MDL", "FAKE"] enum: magSensor_e - name: opflow_hardware values: ["NONE", "CXOF", "MSP", "FAKE"] diff --git a/src/main/sensors/compass.c b/src/main/sensors/compass.c index 4e87b944168..bd61b2d8c38 100644 --- a/src/main/sensors/compass.c +++ b/src/main/sensors/compass.c @@ -40,6 +40,7 @@ #include "drivers/compass/compass_qmc5883l.h" #include "drivers/compass/compass_qmc5883p.h" #include "drivers/compass/compass_mpu9250.h" +#include "drivers/compass/compass_lis2mdl.h" #include "drivers/compass/compass_lis3mdl.h" #include "drivers/compass/compass_rm3100.h" #include "drivers/compass/compass_vcm5883.h" @@ -65,7 +66,7 @@ mag_t mag; // mag access functions #ifdef USE_MAG -PG_REGISTER_WITH_RESET_TEMPLATE(compassConfig_t, compassConfig, PG_COMPASS_CONFIG, 6); +PG_REGISTER_WITH_RESET_TEMPLATE(compassConfig_t, compassConfig, PG_COMPASS_CONFIG, 7); PG_RESET_TEMPLATE(compassConfig_t, compassConfig, .mag_align = SETTING_ALIGN_MAG_DEFAULT, @@ -206,6 +207,23 @@ bool compassDetect(magDev_t *dev, magSensor_e magHardwareToUse) break; } #endif + /* If we are asked for a specific sensor - break out, otherwise - fall through and continue */ + if (magHardwareToUse != MAG_AUTODETECT) { + break; + } + FALLTHROUGH; + + case MAG_LIS2MDL: +#ifdef USE_MAG_LIS2MDL + if (lis2mdlDetect(dev)) { + magHardware = MAG_LIS2MDL; + break; + } +#endif + /* If we are asked for a specific sensor - break out, otherwise - fall through and continue */ + if (magHardwareToUse != MAG_AUTODETECT) { + break; + } FALLTHROUGH; case MAG_LIS3MDL: diff --git a/src/main/sensors/compass.h b/src/main/sensors/compass.h index 17930678f58..f172f1601e2 100644 --- a/src/main/sensors/compass.h +++ b/src/main/sensors/compass.h @@ -44,6 +44,7 @@ typedef enum { MAG_RM3100, MAG_VCM5883, MAG_MLX90393, + MAG_LIS2MDL, MAG_FAKE, MAG_MAX = MAG_FAKE } magSensor_e; diff --git a/src/main/target/common_hardware.c b/src/main/target/common_hardware.c index bdb721ad209..f59d87c0be2 100755 --- a/src/main/target/common_hardware.c +++ b/src/main/target/common_hardware.c @@ -253,6 +253,13 @@ BUSDEV_REGISTER_I2C(busdev_mag3110, DEVHW_MAG3110, MAG3110_I2C_BUS, 0x0E, NONE, DEVFLAGS_NONE, 0); #endif +#if defined(USE_MAG_LIS2MDL) + #if !defined(LIS2MDL_I2C_BUS) + #define LIS2MDL_I2C_BUS MAG_I2C_BUS + #endif + BUSDEV_REGISTER_I2C(busdev_lis2mdl, DEVHW_LIS2MDL, LIS2MDL_I2C_BUS, 0x1E, NONE, DEVFLAGS_NONE, 0); +#endif + #if defined(USE_MAG_LIS3MDL) #if !defined(LIS3MDL_I2C_BUS) #define LIS3MDL_I2C_BUS MAG_I2C_BUS diff --git a/src/main/target/common_post.h b/src/main/target/common_post.h index 37270633797..f2c23e1287b 100644 --- a/src/main/target/common_post.h +++ b/src/main/target/common_post.h @@ -102,6 +102,7 @@ extern uint8_t __config_end; #define USE_MAG_HMC5883 #define USE_MAG_IST8310 +#define USE_MAG_LIS2MDL #define USE_MAG_LIS3MDL #define USE_MAG_MAG3110 #define USE_MAG_QMC5883