mirror of
https://github.com/alexhopeoconnor/firmware.git
synced 2026-10-17 00:51:30 +10:00
I thought git would be smart enough to understand all the whitespace changes but even with all the flags I know to make it ignore theses it still blows up if there are identical changes on both sides.
I have a solution but it require creating a new commit at the merge base for each conflicting PR and merging it into develop.
I don't think blowing up all PRs is worth for now, maybe if we can coordinate this for V3 let's say.
This reverts commit 0d11331d18.
This commit is contained in:
+51
-47
@@ -12,37 +12,39 @@ volatile static bool BMM150_IRQ = false;
|
||||
|
||||
BMM150Sensor::BMM150Sensor(ScanI2C::FoundDevice foundDevice) : MotionSensor::MotionSensor(foundDevice) {}
|
||||
|
||||
bool BMM150Sensor::init() {
|
||||
// Initialise the sensor
|
||||
sensor = BMM150Singleton::GetInstance(device);
|
||||
return sensor->init(device);
|
||||
bool BMM150Sensor::init()
|
||||
{
|
||||
// Initialise the sensor
|
||||
sensor = BMM150Singleton::GetInstance(device);
|
||||
return sensor->init(device);
|
||||
}
|
||||
|
||||
int32_t BMM150Sensor::runOnce() {
|
||||
int32_t BMM150Sensor::runOnce()
|
||||
{
|
||||
#if !defined(MESHTASTIC_EXCLUDE_SCREEN) && HAS_SCREEN
|
||||
float heading = sensor->getCompassDegree();
|
||||
float heading = sensor->getCompassDegree();
|
||||
|
||||
switch (config.display.compass_orientation) {
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0_INVERTED:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0:
|
||||
break;
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90_INVERTED:
|
||||
heading += 90;
|
||||
break;
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180_INVERTED:
|
||||
heading += 180;
|
||||
break;
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270_INVERTED:
|
||||
heading += 270;
|
||||
break;
|
||||
}
|
||||
if (screen)
|
||||
screen->setHeading(heading);
|
||||
switch (config.display.compass_orientation) {
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0_INVERTED:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_0:
|
||||
break;
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_90_INVERTED:
|
||||
heading += 90;
|
||||
break;
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_180_INVERTED:
|
||||
heading += 180;
|
||||
break;
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270:
|
||||
case meshtastic_Config_DisplayConfig_CompassOrientation_DEGREES_270_INVERTED:
|
||||
heading += 270;
|
||||
break;
|
||||
}
|
||||
if (screen)
|
||||
screen->setHeading(heading);
|
||||
#endif
|
||||
return MOTION_SENSOR_CHECK_INTERVAL_MS;
|
||||
return MOTION_SENSOR_CHECK_INTERVAL_MS;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
@@ -50,16 +52,17 @@ int32_t BMM150Sensor::runOnce() {
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Get a singleton wrapper for an Sparkfun BMM_150_I2C
|
||||
BMM150Singleton *BMM150Singleton::GetInstance(ScanI2C::FoundDevice device) {
|
||||
BMM150Singleton *BMM150Singleton::GetInstance(ScanI2C::FoundDevice device)
|
||||
{
|
||||
#if defined(WIRE_INTERFACES_COUNT) && (WIRE_INTERFACES_COUNT > 1)
|
||||
TwoWire &bus = (device.address.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
||||
TwoWire &bus = (device.address.port == ScanI2C::I2CPort::WIRE1 ? Wire1 : Wire);
|
||||
#else
|
||||
TwoWire &bus = Wire; // fallback if only one I2C interface
|
||||
TwoWire &bus = Wire; // fallback if only one I2C interface
|
||||
#endif
|
||||
if (pinstance == nullptr) {
|
||||
pinstance = new BMM150Singleton(&bus, device.address.address);
|
||||
}
|
||||
return pinstance;
|
||||
if (pinstance == nullptr) {
|
||||
pinstance = new BMM150Singleton(&bus, device.address.address);
|
||||
}
|
||||
return pinstance;
|
||||
}
|
||||
|
||||
BMM150Singleton::~BMM150Singleton() {}
|
||||
@@ -68,22 +71,23 @@ BMM150Singleton *BMM150Singleton::pinstance{nullptr};
|
||||
|
||||
// Initialise the BMM150 Sensor
|
||||
// https://github.com/DFRobot/DFRobot_BMM150/blob/master/examples/getGeomagneticData/getGeomagneticData.ino
|
||||
bool BMM150Singleton::init(ScanI2C::FoundDevice device) {
|
||||
bool BMM150Singleton::init(ScanI2C::FoundDevice device)
|
||||
{
|
||||
|
||||
// startup
|
||||
LOG_DEBUG("BMM150 begin on addr 0x%02X (port=%d)", device.address.address, device.address.port);
|
||||
uint8_t status = begin();
|
||||
if (status != 0) {
|
||||
LOG_DEBUG("BMM150 init error %u", status);
|
||||
return false;
|
||||
}
|
||||
// startup
|
||||
LOG_DEBUG("BMM150 begin on addr 0x%02X (port=%d)", device.address.address, device.address.port);
|
||||
uint8_t status = begin();
|
||||
if (status != 0) {
|
||||
LOG_DEBUG("BMM150 init error %u", status);
|
||||
return false;
|
||||
}
|
||||
|
||||
// SW reset to make sure the device starts in a known state
|
||||
setOperationMode(BMM150_POWERMODE_NORMAL);
|
||||
setPresetMode(BMM150_PRESETMODE_LOWPOWER);
|
||||
setRate(BMM150_DATA_RATE_02HZ);
|
||||
setMeasurementXYZ();
|
||||
return true;
|
||||
// SW reset to make sure the device starts in a known state
|
||||
setOperationMode(BMM150_POWERMODE_NORMAL);
|
||||
setPresetMode(BMM150_PRESETMODE_LOWPOWER);
|
||||
setRate(BMM150_DATA_RATE_02HZ);
|
||||
setMeasurementXYZ();
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user