remove newline from logging statements. (#5022)
remove newline from logging statements in code. The LOG_* functions will now magically add it at the end. --------- Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
co-authored by
GitHub
Ben Meadors
parent
fb9f361052
commit
05e4a639a1
@@ -62,14 +62,14 @@ class AccelerometerThread : public concurrency::OSThread
|
||||
return;
|
||||
|
||||
if (device.address.port == ScanI2C::I2CPort::NO_I2C || device.address.address == 0 || device.type == ScanI2C::NONE) {
|
||||
LOG_DEBUG("AccelerometerThread disabling due to no sensors found\n");
|
||||
LOG_DEBUG("AccelerometerThread disabling due to no sensors found");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef RAK_4631
|
||||
if (!config.display.wake_on_tap_or_motion && !config.device.double_tap_as_button_press) {
|
||||
LOG_DEBUG("AccelerometerThread disabling due to no interested configurations\n");
|
||||
LOG_DEBUG("AccelerometerThread disabling due to no interested configurations");
|
||||
disable();
|
||||
return;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ class AccelerometerThread : public concurrency::OSThread
|
||||
if (!isInitialised) {
|
||||
clean();
|
||||
}
|
||||
LOG_DEBUG("AccelerometerThread::init %s\n", isInitialised ? "ok" : "failed");
|
||||
LOG_DEBUG("AccelerometerThread::init %s", isInitialised ? "ok" : "failed");
|
||||
}
|
||||
|
||||
// Copy constructor (not implemented / included to avoid cppcheck warnings)
|
||||
|
||||
@@ -41,10 +41,10 @@ bool BMA423Sensor::init()
|
||||
|
||||
// It corresponds to isDoubleClick interrupt
|
||||
sensor.enableWakeupIRQ();
|
||||
LOG_DEBUG("BMA423Sensor::init ok\n");
|
||||
LOG_DEBUG("BMA423Sensor::init ok");
|
||||
return true;
|
||||
}
|
||||
LOG_DEBUG("BMA423Sensor::init failed\n");
|
||||
LOG_DEBUG("BMA423Sensor::init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ bool BMX160Sensor::init()
|
||||
if (sensor.begin()) {
|
||||
// set output data rate
|
||||
sensor.ODR_Config(BMX160_ACCEL_ODR_100HZ, BMX160_GYRO_ODR_100HZ);
|
||||
LOG_DEBUG("BMX160Sensor::init ok\n");
|
||||
LOG_DEBUG("BMX160Sensor::init ok");
|
||||
return true;
|
||||
}
|
||||
LOG_DEBUG("BMX160Sensor::init failed\n");
|
||||
LOG_DEBUG("BMX160Sensor::init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,14 @@ int32_t ICM20948Sensor::runOnce()
|
||||
// Wake on motion using polling - this is not as efficient as using hardware interrupt pin (see above)
|
||||
auto status = sensor->setBank(0);
|
||||
if (sensor->status != ICM_20948_Stat_Ok) {
|
||||
LOG_DEBUG("ICM20948Sensor::isWakeOnMotion failed to set bank - %s\n", sensor->statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::isWakeOnMotion failed to set bank - %s", sensor->statusString());
|
||||
return MOTION_SENSOR_CHECK_INTERVAL_MS;
|
||||
}
|
||||
|
||||
ICM_20948_INT_STATUS_t int_stat;
|
||||
status = sensor->read(AGB0_REG_INT_STATUS, (uint8_t *)&int_stat, sizeof(ICM_20948_INT_STATUS_t));
|
||||
if (status != ICM_20948_Stat_Ok) {
|
||||
LOG_DEBUG("ICM20948Sensor::isWakeOnMotion failed to read interrupts - %s\n", sensor->statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::isWakeOnMotion failed to read interrupts - %s", sensor->statusString());
|
||||
return MOTION_SENSOR_CHECK_INTERVAL_MS;
|
||||
}
|
||||
|
||||
@@ -99,25 +99,25 @@ bool ICM20948Singleton::init(ScanI2C::FoundDevice device)
|
||||
ICM_20948_Status_e status = begin(Wire, device.address.address == ICM20948_ADDR ? 1 : 0);
|
||||
#endif
|
||||
if (status != ICM_20948_Stat_Ok) {
|
||||
LOG_DEBUG("ICM20948Sensor::init begin - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init begin - %s", statusString());
|
||||
return false;
|
||||
}
|
||||
|
||||
// SW reset to make sure the device starts in a known state
|
||||
if (swReset() != ICM_20948_Stat_Ok) {
|
||||
LOG_DEBUG("ICM20948Sensor::init reset - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init reset - %s", statusString());
|
||||
return false;
|
||||
}
|
||||
delay(200);
|
||||
|
||||
// Now wake the sensor up
|
||||
if (sleep(false) != ICM_20948_Stat_Ok) {
|
||||
LOG_DEBUG("ICM20948Sensor::init wake - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init wake - %s", statusString());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (lowPower(false) != ICM_20948_Stat_Ok) {
|
||||
LOG_DEBUG("ICM20948Sensor::init high power - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init high power - %s", statusString());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -125,19 +125,19 @@ bool ICM20948Singleton::init(ScanI2C::FoundDevice device)
|
||||
|
||||
// Active low
|
||||
cfgIntActiveLow(true);
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntActiveLow - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntActiveLow - %s", statusString());
|
||||
|
||||
// Push-pull
|
||||
cfgIntOpenDrain(false);
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntOpenDrain - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntOpenDrain - %s", statusString());
|
||||
|
||||
// If enabled, *ANY* read will clear the INT_STATUS register.
|
||||
cfgIntAnyReadToClear(true);
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntAnyReadToClear - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntAnyReadToClear - %s", statusString());
|
||||
|
||||
// Latch the interrupt until cleared
|
||||
cfgIntLatch(true);
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntLatch - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init set cfgIntLatch - %s", statusString());
|
||||
|
||||
// Set up an interrupt pin with an internal pullup for active low
|
||||
pinMode(ICM_20948_INT_PIN, INPUT_PULLUP);
|
||||
@@ -168,13 +168,13 @@ bool ICM20948Singleton::setWakeOnMotion()
|
||||
|
||||
// Enable WoM Logic mode 1 = Compare the current sample with the previous sample
|
||||
status = WOMLogic(true, 1);
|
||||
LOG_DEBUG("ICM20948Sensor::init set WOMLogic - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init set WOMLogic - %s", statusString());
|
||||
if (status != ICM_20948_Stat_Ok)
|
||||
return false;
|
||||
|
||||
// Enable interrupts on WakeOnMotion
|
||||
status = intEnableWOM(true);
|
||||
LOG_DEBUG("ICM20948Sensor::init set intEnableWOM - %s\n", statusString());
|
||||
LOG_DEBUG("ICM20948Sensor::init set intEnableWOM - %s", statusString());
|
||||
return status == ICM_20948_Stat_Ok;
|
||||
|
||||
// Clear any current interrupts
|
||||
|
||||
@@ -10,10 +10,10 @@ bool LIS3DHSensor::init()
|
||||
sensor.setRange(LIS3DH_RANGE_2_G);
|
||||
// Adjust threshold, higher numbers are less sensitive
|
||||
sensor.setClick(config.device.double_tap_as_button_press ? 2 : 1, MOTION_SENSOR_CHECK_INTERVAL_MS);
|
||||
LOG_DEBUG("LIS3DHSensor::init ok\n");
|
||||
LOG_DEBUG("LIS3DHSensor::init ok");
|
||||
return true;
|
||||
}
|
||||
LOG_DEBUG("LIS3DHSensor::init failed\n");
|
||||
LOG_DEBUG("LIS3DHSensor::init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,10 +14,10 @@ bool LSM6DS3Sensor::init()
|
||||
// Duration is number of occurances needed to trigger, higher threshold is less sensitive
|
||||
sensor.enableWakeup(config.display.wake_on_tap_or_motion, 1, LSM6DS3_WAKE_THRESH);
|
||||
|
||||
LOG_DEBUG("LSM6DS3Sensor::init ok\n");
|
||||
LOG_DEBUG("LSM6DS3Sensor::init ok");
|
||||
return true;
|
||||
}
|
||||
LOG_DEBUG("LSM6DS3Sensor::init failed\n");
|
||||
LOG_DEBUG("LSM6DS3Sensor::init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,10 +13,10 @@ bool MPU6050Sensor::init()
|
||||
sensor.setMotionDetectionDuration(20);
|
||||
sensor.setInterruptPinLatch(true); // Keep it latched. Will turn off when reinitialized.
|
||||
sensor.setInterruptPinPolarity(true);
|
||||
LOG_DEBUG("MPU6050Sensor::init ok\n");
|
||||
LOG_DEBUG("MPU6050Sensor::init ok");
|
||||
return true;
|
||||
}
|
||||
LOG_DEBUG("MPU6050Sensor::init failed\n");
|
||||
LOG_DEBUG("MPU6050Sensor::init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ MotionSensor::MotionSensor(ScanI2C::FoundDevice foundDevice)
|
||||
device.address.address = foundDevice.address.address;
|
||||
device.address.port = foundDevice.address.port;
|
||||
device.type = foundDevice.type;
|
||||
LOG_DEBUG("MotionSensor::MotionSensor port: %s address: 0x%x type: %d\n",
|
||||
LOG_DEBUG("MotionSensor::MotionSensor port: %s address: 0x%x type: %d",
|
||||
devicePort() == ScanI2C::I2CPort::WIRE1 ? "Wire1" : "Wire", (uint8_t)deviceAddress(), deviceType());
|
||||
}
|
||||
|
||||
@@ -57,14 +57,14 @@ void MotionSensor::drawFrameCalibration(OLEDDisplay *display, OLEDDisplayUiState
|
||||
void MotionSensor::wakeScreen()
|
||||
{
|
||||
if (powerFSM.getState() == &stateDARK) {
|
||||
LOG_DEBUG("MotionSensor::wakeScreen detected\n");
|
||||
LOG_DEBUG("MotionSensor::wakeScreen detected");
|
||||
powerFSM.trigger(EVENT_INPUT);
|
||||
}
|
||||
}
|
||||
|
||||
void MotionSensor::buttonPress()
|
||||
{
|
||||
LOG_DEBUG("MotionSensor::buttonPress detected\n");
|
||||
LOG_DEBUG("MotionSensor::buttonPress detected");
|
||||
powerFSM.trigger(EVENT_PRESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@ bool STK8XXXSensor::init()
|
||||
attachInterrupt(
|
||||
digitalPinToInterrupt(STK8XXX_INT), [] { STK_IRQ = true; }, RISING);
|
||||
|
||||
LOG_DEBUG("STK8XXXSensor::init ok\n");
|
||||
LOG_DEBUG("STK8XXXSensor::init ok");
|
||||
return true;
|
||||
}
|
||||
LOG_DEBUG("STK8XXXSensor::init failed\n");
|
||||
LOG_DEBUG("STK8XXXSensor::init failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user