mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-12 01:24:04 +00:00
Improvements due to code review
This commit is contained in:
@@ -165,7 +165,7 @@ Adafruit_HMC5883_Unified::Adafruit_HMC5883_Unified(int32_t sensorID) {
|
||||
/**************************************************************************/
|
||||
bool Adafruit_HMC5883_Unified::begin() {
|
||||
// Enable I2C
|
||||
Wire.begin();
|
||||
//Wire.begin(); // This is already done by ESP Easy Core
|
||||
|
||||
// Enable the magnetometer
|
||||
write8(HMC5883_ADDRESS_MAG, HMC5883_REGISTER_MAG_MR_REG_M, 0x00);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <Adafruit_Sensor.h>
|
||||
#include <Adafruit_HMC5883_U.h>
|
||||
|
||||
bool P121_data_struct::begin(bool initSettings)
|
||||
bool P121_data_struct::begin()
|
||||
{
|
||||
if (!initialized)
|
||||
{
|
||||
@@ -18,16 +18,23 @@ bool P121_data_struct::begin(bool initSettings)
|
||||
// Set up oversampling and filter initialization
|
||||
sensor_t sensor;
|
||||
mag.getSensor(&sensor);
|
||||
#ifndef BUILD_NO_DEBUG
|
||||
addLog(LOG_LEVEL_DEBUG, F("------------------------------------"));
|
||||
String log = F("Sensor: ");
|
||||
log += sensor.name;
|
||||
log += "\nDriver Ver: " + sensor.version;
|
||||
log += "\nUnique ID: " + sensor.sensor_id;
|
||||
log += "\nMax Value: " + String(sensor.max_value);
|
||||
log += "\nMin Value: " + String(sensor.min_value);
|
||||
log += "\nResolution: " + String(sensor.resolution);
|
||||
log += F(sensor.name);
|
||||
log += F("\nDriver Ver: ");
|
||||
log += sensor.version;
|
||||
log += F("\nUnique ID: ");
|
||||
log += sensor.sensor_id;
|
||||
log += F("\nMax Value: ");
|
||||
log += String(sensor.max_value);
|
||||
log += F("\nMin Value: ");
|
||||
log += String(sensor.min_value);
|
||||
log += F("\nResolution: ");
|
||||
log += String(sensor.resolution);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
addLog(LOG_LEVEL_DEBUG, F("------------------------------------"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
struct P121_data_struct : public PluginTaskData_base
|
||||
{
|
||||
bool begin(bool initSettings = true);
|
||||
bool begin();
|
||||
|
||||
Adafruit_HMC5883_Unified mag = Adafruit_HMC5883_Unified(12345);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user