mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 04:07:47 +00:00
[P120] Disable SPI init in library, small code optimization
This commit is contained in:
@@ -47,8 +47,9 @@ ADXL345::ADXL345(int CS) {
|
||||
gains[2] = 0.00349265;
|
||||
_CS = CS;
|
||||
I2C = false;
|
||||
SPI.begin();
|
||||
SPI.setDataMode(SPI_MODE3);
|
||||
// tonhuisman: disabled as SPI is already initialized in ESPEasy core.
|
||||
// SPI.begin();
|
||||
// SPI.setDataMode(SPI_MODE3);
|
||||
pinMode(_CS, OUTPUT);
|
||||
digitalWrite(_CS, HIGH);
|
||||
}
|
||||
|
||||
@@ -133,9 +133,7 @@ boolean Plugin_120(uint8_t function, struct EventStruct *event, String& string)
|
||||
initPluginTaskData(event->TaskIndex, new (std::nothrow) P120_data_struct(static_cast<uint8_t>(P120_I2C_ADDR), P120_AVERAGE_BUFFER));
|
||||
P120_data_struct *P120_data = static_cast<P120_data_struct *>(getPluginTaskData(event->TaskIndex));
|
||||
|
||||
if (nullptr != P120_data) {
|
||||
success = true;
|
||||
}
|
||||
success = nullptr != P120_data;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user