From ba85f568349f1d4239a40cc680286a764bd86551 Mon Sep 17 00:00:00 2001 From: Kirk Benell Date: Thu, 13 Feb 2025 16:32:50 -0700 Subject: [PATCH 1/7] fix issues related to name change --- src/SparkFun_Soil_Moisture_Sensor.h | 22 ++++---- .../sfDevSoilMoisture.cpp} | 50 +++++++++---------- .../sfDevSoilMoisture.h} | 46 ++++++++--------- 3 files changed, 59 insertions(+), 59 deletions(-) rename src/{sfeTk/sfeDevSoilMoisture.cpp => sfTk/sfDevSoilMoisture.cpp} (74%) rename src/{sfeTk/sfeDevSoilMoisture.h => sfTk/sfDevSoilMoisture.h} (79%) diff --git a/src/SparkFun_Soil_Moisture_Sensor.h b/src/SparkFun_Soil_Moisture_Sensor.h index 3666a0e..7b2727a 100644 --- a/src/SparkFun_Soil_Moisture_Sensor.h +++ b/src/SparkFun_Soil_Moisture_Sensor.h @@ -21,18 +21,18 @@ // To make the Arduino machine happy, include the toolkit header before the core implementation for this device #include -#include "sfeTk/sfeDevSoilMoisture.h" +#include "sfTk/sfDevSoilMoisture.h" // Note: -// The core of the implementation for this device library is in the SparkFun Toolkit object sfeDevSoilMoisture, -// contained in the directory sfeTk. This object implements all functionality independent of the bus type, I2C or SPI. +// The core of the implementation for this device library is in the SparkFun Toolkit object sfDevSoilMoisture, +// contained in the directory sfTk. This object implements all functionality independent of the bus type, I2C or SPI. // The SparkFunSoilMoistureSensorI2C and SparkFunSoilMoistureSensorSPI classes below are the Arduino-specific, // bus-specific implementations that inherit from the core toolkit class. // //----------------------------------------------------------------------------------------------- // Define our Arduino Object - I2C version -class SparkFunSoilMoistureSensorI2C : public sfeDevSoilMoisture +class SparkFunSoilMoistureSensorI2C : public sfDevSoilMoisture { public: /** @@ -45,13 +45,13 @@ class SparkFunSoilMoistureSensorI2C : public sfeDevSoilMoisture * @param wirePort Wire port to use for I2C communication (default is Wire) * @return true if successful, false otherwise */ - bool begin(const uint8_t address = SFE_SOIL_MOISTURE_DEFAULT_I2C_ADDRESS, TwoWire &wirePort = Wire) + bool begin(const uint8_t address = SF_SOIL_MOISTURE_DEFAULT_I2C_ADDRESS, TwoWire &wirePort = Wire) { // Setup Arduino I2C bus _theI2CBus.init(wirePort, address); // Begin the sensor and make sure it's connected. - return sfeDevSoilMoisture::begin(&_theI2CBus) == kSTkErrOk ? isConnected() : false; + return sfDevSoilMoisture::begin(&_theI2CBus) == ksfTkErrOk ? isConnected() : false; } /** @@ -64,16 +64,16 @@ class SparkFunSoilMoistureSensorI2C : public sfeDevSoilMoisture */ bool isConnected() { - return _theI2CBus.ping() == kSTkErrOk; + return _theI2CBus.ping() == ksfTkErrOk; } private: - sfeTkArdI2C _theI2CBus; + sfTkArdI2C _theI2CBus; }; //----------------------------------------------------------------------------------------------- // Define our Arduino Object - SPI version -class SparkFunSoilMoistureSensorSPI : public sfeDevSoilMoisture +class SparkFunSoilMoistureSensorSPI : public sfDevSoilMoisture { public: /** @@ -96,9 +96,9 @@ class SparkFunSoilMoistureSensorSPI : public sfeDevSoilMoisture _theSPIBus.init(spiPort, spiSettings, csPin, true); // Begin the sensor with the SPI bus connection - return (sfeDevSoilMoisture::begin(&_theSPIBus) == kSTkErrOk); + return (sfDevSoilMoisture::begin(&_theSPIBus) == ksfTkErrOk); } private: - sfeTkArdSPI _theSPIBus; + sfTkArdSPI _theSPIBus; }; \ No newline at end of file diff --git a/src/sfeTk/sfeDevSoilMoisture.cpp b/src/sfTk/sfDevSoilMoisture.cpp similarity index 74% rename from src/sfeTk/sfeDevSoilMoisture.cpp rename to src/sfTk/sfDevSoilMoisture.cpp index 510f27b..1cd47f3 100644 --- a/src/sfeTk/sfeDevSoilMoisture.cpp +++ b/src/sfTk/sfDevSoilMoisture.cpp @@ -1,5 +1,5 @@ /** - * @file sfeDevSoilMoisture.cpp + * @file sfDevSoilMoisture.cpp * @brief Implementation file for the soil moisture sensor class * * This file contains the implementation of the soil moisture sensor class, including @@ -14,7 +14,7 @@ */ -#include "sfeDevSoilMoisture.h" +#include "sfDevSoilMoisture.h" // Impl for the core driver @@ -48,34 +48,34 @@ // Core object implementation //--------------------------------------------------------------------- // start up the sensor -sfeTkError_t sfeDevSoilMoisture::begin(sfeTkIBus *theBus) +sfTkError_t sfDevSoilMoisture::begin(sfTkIBus *theBus) { // Nullptr check if (theBus == nullptr) - return kSTkErrBusNotInit; + return ksfTkErrBusNotInit; // Set bus pointer _theBus = theBus; - return kSTkErrOk; + return ksfTkErrOk; } //---------------------------------------------------------------------------------------- // LED off command -sfeTkError_t sfeDevSoilMoisture::LEDOff(void) +sfTkError_t sfDevSoilMoisture::LEDOff(void) { if (_theBus == nullptr) - return kSTkErrBusNotInit; + return ksfTkErrBusNotInit; // Send the command to turn the LED off return _theBus->writeByte(kCommandLEDOff); } //---------------------------------------------------------------------------------------- // LED on command -sfeTkError_t sfeDevSoilMoisture::LEDOn(void) +sfTkError_t sfDevSoilMoisture::LEDOn(void) { if (_theBus == nullptr) - return kSTkErrBusNotInit; + return ksfTkErrBusNotInit; // Send the command to turn the LED on return _theBus->writeByte(kCommandLEDOn); @@ -83,13 +83,13 @@ sfeTkError_t sfeDevSoilMoisture::LEDOn(void) //---------------------------------------------------------------------------------------- // Read the moisture value from the sensor - returns a resistance reading between 0 and 1023 -uint16_t sfeDevSoilMoisture::readMoistureValue(void) +uint16_t sfDevSoilMoisture::readMoistureValue(void) { if (_theBus == nullptr) return 0; uint16_t value = 0; - if (_theBus->readRegisterWord(kCommandGetValue, value) != kSTkErrOk) + if (_theBus->readRegisterWord(kCommandGetValue, value) != ksfTkErrOk) return 0; return value; @@ -97,53 +97,53 @@ uint16_t sfeDevSoilMoisture::readMoistureValue(void) //---------------------------------------------------------------------------------------- // Returns the moisture ratio from the sensor (0 - 1.0) -float sfeDevSoilMoisture::readMoistureRatio(void) +float sfDevSoilMoisture::readMoistureRatio(void) { if (_theBus == nullptr) return 0.0; - return (((float)SFE_SOIL_MOISTURE_MAX_VALUE - (float)readMoistureValue()) / (float)SFE_SOIL_MOISTURE_MAX_VALUE); + return (((float)SF_SOIL_MOISTURE_MAX_VALUE - (float)readMoistureValue()) / (float)SF_SOIL_MOISTURE_MAX_VALUE); } //---------------------------------------------------------------------------------------- // Returns the moisture percentage from the sensor (0 - 100%) -float sfeDevSoilMoisture::readMoisturePercentage(void) +float sfDevSoilMoisture::readMoisturePercentage(void) { return readMoistureRatio() * 100.0; } //---------------------------------------------------------------------------------------- // Change the I2C address of the sensor -sfeTkError_t sfeDevSoilMoisture::setI2CAddress(uint8_t newAddress) +sfTkError_t sfDevSoilMoisture::setI2CAddress(uint8_t newAddress) { if (_theBus == nullptr) - return kSTkErrBusNotInit; + return ksfTkErrBusNotInit; // Validate the new address if (newAddress < 0x07 || newAddress > 0x78) - return kSTkErrFail; + return ksfTkErrFail; // If in I2C mode, is the address the same as the current address? - if (_theBus->type() == kBusTypeI2C && ((sfeTkII2C *)_theBus)->address() == newAddress) - return kSTkErrOk; + if (_theBus->type() == ksfTkBusTypeI2C && ((sfTkII2C *)_theBus)->address() == newAddress) + return ksfTkErrOk; // Send the command to change the address. NOTE: Because of how the sensor works, // the following will return an error (since the sensor side resets the bus) (void)_theBus->writeRegisterByte(kCommandChangeAddress, newAddress); - return kSTkErrOk; + return ksfTkErrOk; } //---------------------------------------------------------------------------------------- // Return the address of the sensor bus. For I2C this is the address of the sensor, for // SPI this is the CS pin -uint8_t sfeDevSoilMoisture::address(void) +uint8_t sfDevSoilMoisture::address(void) { if (_theBus == nullptr) return 0; - if (_theBus->type() == kBusTypeSPI) - return ((sfeTkISPI *)_theBus)->cs(); - else if (_theBus->type() == kBusTypeI2C) - return ((sfeTkII2C *)_theBus)->address(); + if (_theBus->type() == ksfTkBusTypeSPI) + return ((sfTkISPI *)_theBus)->cs(); + else if (_theBus->type() == ksfTkBusTypeI2C) + return ((sfTkII2C *)_theBus)->address(); return 0; } diff --git a/src/sfeTk/sfeDevSoilMoisture.h b/src/sfTk/sfDevSoilMoisture.h similarity index 79% rename from src/sfeTk/sfeDevSoilMoisture.h rename to src/sfTk/sfDevSoilMoisture.h index 685144d..e610bac 100644 --- a/src/sfeTk/sfeDevSoilMoisture.h +++ b/src/sfTk/sfDevSoilMoisture.h @@ -1,5 +1,5 @@ /** - * @file sfeDevSoilMoisture.h + * @file sfDevSoilMoisture.h * @brief Header file for the soil moisture sensor class * * This file contains the class definition for the soil moisture sensor, including @@ -20,18 +20,18 @@ #include // include the sparkfun toolkit headers -#include +#include // Bus interfaces -#include -#include +#include +#include /** * @brief Default I2C address for the soil moisture sensor * * This macro defines the default I2C address (0x28) used by the soil moisture sensor. */ -#define SFE_SOIL_MOISTURE_DEFAULT_I2C_ADDRESS 0x28 +#define SF_SOIL_MOISTURE_DEFAULT_I2C_ADDRESS 0x28 /** * @brief Maximum value for the soil moisture sensor @@ -39,7 +39,7 @@ * This macro defines the maximum value (1023) for the soil moisture sensor, * which corresponds to the highest reading from the 10-bit ADC. 2^10 = 1024-1 */ -#define SFE_SOIL_MOISTURE_MAX_VALUE 1023 +#define SF_SOIL_MOISTURE_MAX_VALUE 1023 /** * @brief Class representing the soil moisture sensor @@ -47,12 +47,12 @@ * This class provides an interface to the soil moisture sensor, allowing for * initialization, reading moisture values and controlling the on-board LED. */ -class sfeDevSoilMoisture +class sfDevSoilMoisture { public: // ctor - sfeDevSoilMoisture() : _theBus{nullptr} + sfDevSoilMoisture() : _theBus{nullptr} { } @@ -63,36 +63,36 @@ class sfeDevSoilMoisture * communication with the sensor using the provided I2C bus interface. * * @param theBus Pointer to an I2C toolkit object. If nullptr, uses previously set bus - * @return kSTkErrOk if initialization succeeds - * @return kSTkErrBusNotInit if no valid bus interface is provided + * @return ksfTkErrOk if initialization succeeds + * @return ksfTkErrBusNotInit if no valid bus interface is provided */ - sfeTkError_t begin(sfeTkIBus *theBus = nullptr); + sfTkError_t begin(sfTkIBus *theBus = nullptr); /** * @brief Turns off the on-board LED * * Disables the sensor's built-in LED * - * @return kSTkErrOk if LED was successfully turned off - * @return kSTkErrBusNotInit if no bus interface is configured - * @return kSTkErrFail if sensor doesn't respond or a communication error occurs + * @return ksfTkErrOk if LED was successfully turned off + * @return ksfTkErrBusNotInit if no bus interface is configured + * @return ksfTkErrFail if sensor doesn't respond or a communication error occurs * * @see LEDOn() */ - sfeTkError_t LEDOff(void); + sfTkError_t LEDOff(void); /** * @brief Turns on the on-board LED * * Enables the sensor's built-in LED by sending the appropriate command * - * @return kSTkErrOk if LED was successfully turned on - * @return kSTkErrBusNotInit if no bus interface is configured - * @return kSTkErrFail if sensor doesn't respond or a communication error occurs + * @return ksfTkErrOk if LED was successfully turned on + * @return ksfTkErrBusNotInit if no bus interface is configured + * @return ksfTkErrFail if sensor doesn't respond or a communication error occurs * * @see LEDOff() */ - sfeTkError_t LEDOn(void); + sfTkError_t LEDOn(void); /** * @brief Reads the moisture value from the sensor @@ -134,10 +134,10 @@ class sfeDevSoilMoisture * for all future I2C communication with the sensor. This value is persistent * * @param newAddress The new I2C address to assign to the sensor - * @return kSTkErrOk if successful, otherwise an error code + * @return ksfTkErrOk if successful, otherwise an error code * @note If communicating via I2C, the provided address is used for future I2C communication */ - sfeTkError_t setI2CAddress(uint8_t newAddress); + sfTkError_t setI2CAddress(uint8_t newAddress); /** * @brief Returns the current address of the sensor @@ -156,6 +156,6 @@ class sfeDevSoilMoisture * This member variable holds a pointer to the bus interface (I2C or SPI) used * for communication with the soil moisture sensor. */ - sfeTkIBus *_theBus; + sfTkIBus *_theBus; -}; // class sfeDevSoilMoisture \ No newline at end of file +}; // class sfDevSoilMoisture \ No newline at end of file From ad7ad7e0a706b464541184d513db5dd4aeeee64d Mon Sep 17 00:00:00 2001 From: Kirk Benell Date: Sat, 15 Feb 2025 11:51:21 -0700 Subject: [PATCH 2/7] fix some links/titles... --- docs/doxygen/doxygen-custom/header.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/doxygen/doxygen-custom/header.html b/docs/doxygen/doxygen-custom/header.html index c66b4f6..b9a870e 100644 --- a/docs/doxygen/doxygen-custom/header.html +++ b/docs/doxygen/doxygen-custom/header.html @@ -10,14 +10,14 @@ - - - + + + - - + + From fd1021568c087e6c4236af71badbea9431dd9490 Mon Sep 17 00:00:00 2001 From: Kirk Benell Date: Sat, 15 Feb 2025 11:52:11 -0700 Subject: [PATCH 3/7] removed I2C from i2c classname - just make the default be i2c, which is qwiic... SPI is a *special* case --- examples/Example_01_BasicReadings/Example_01_BasicReadings.ino | 2 +- .../Example_02_ReadingsAndLED/Example_02_ReadingsAndLED.ino | 2 +- .../Example_03_LEDFlashMoisture/Example_03_LEDFlashMoisture.ino | 2 +- .../Example_04_ChangeI2CAddress/Example_04_ChangeI2CAddress.ino | 2 +- src/SparkFun_Soil_Moisture_Sensor.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/Example_01_BasicReadings/Example_01_BasicReadings.ino b/examples/Example_01_BasicReadings/Example_01_BasicReadings.ino index d447644..398de2b 100644 --- a/examples/Example_01_BasicReadings/Example_01_BasicReadings.ino +++ b/examples/Example_01_BasicReadings/Example_01_BasicReadings.ino @@ -22,7 +22,7 @@ #include "SparkFun_Soil_Moisture_Sensor.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_Soil_Moisture_Sensor #include -SparkFunSoilMoistureSensorI2C mySoilSensor; // Create an instance of the sensor class +SparkFunSoilMoistureSensor mySoilSensor; // Create an instance of the sensor class // Some Dev boards have their QWIIC connector on Wire or Wire1 // This #ifdef will help this sketch work across more products diff --git a/examples/Example_02_ReadingsAndLED/Example_02_ReadingsAndLED.ino b/examples/Example_02_ReadingsAndLED/Example_02_ReadingsAndLED.ino index 0b0c021..9895aca 100644 --- a/examples/Example_02_ReadingsAndLED/Example_02_ReadingsAndLED.ino +++ b/examples/Example_02_ReadingsAndLED/Example_02_ReadingsAndLED.ino @@ -22,7 +22,7 @@ #include "SparkFun_Soil_Moisture_Sensor.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_Soil_Moisture_Sensor #include -SparkFunSoilMoistureSensorI2C mySoilSensor; // Create an instance of the sensor class +SparkFunSoilMoistureSensor mySoilSensor; // Create an instance of the sensor class // Some Dev boards have their QWIIC connector on Wire or Wire1 // This #ifdef will help this sketch work across more products diff --git a/examples/Example_03_LEDFlashMoisture/Example_03_LEDFlashMoisture.ino b/examples/Example_03_LEDFlashMoisture/Example_03_LEDFlashMoisture.ino index 4b995a2..07b0481 100644 --- a/examples/Example_03_LEDFlashMoisture/Example_03_LEDFlashMoisture.ino +++ b/examples/Example_03_LEDFlashMoisture/Example_03_LEDFlashMoisture.ino @@ -26,7 +26,7 @@ #include "SparkFun_Soil_Moisture_Sensor.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_Soil_Moisture_Sensor #include -SparkFunSoilMoistureSensorI2C mySoilSensor; // Create an instance of the sensor class +SparkFunSoilMoistureSensor mySoilSensor; // Create an instance of the sensor class // The plan: // The value of the sensor has the following range: diff --git a/examples/Example_04_ChangeI2CAddress/Example_04_ChangeI2CAddress.ino b/examples/Example_04_ChangeI2CAddress/Example_04_ChangeI2CAddress.ino index 11438bd..94e2787 100644 --- a/examples/Example_04_ChangeI2CAddress/Example_04_ChangeI2CAddress.ino +++ b/examples/Example_04_ChangeI2CAddress/Example_04_ChangeI2CAddress.ino @@ -22,7 +22,7 @@ #include "SparkFun_Soil_Moisture_Sensor.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_Soil_Moisture_Sensor #include -SparkFunSoilMoistureSensorI2C mySoilSensor; // Create an instance of the sensor class +SparkFunSoilMoistureSensor mySoilSensor; // Create an instance of the sensor class // Define our alternate I2C address - the default address + 1 #define ALTERNATE_I2C_ADDRESS SFE_SOIL_MOISTURE_DEFAULT_I2C_ADDRESS + 1 diff --git a/src/SparkFun_Soil_Moisture_Sensor.h b/src/SparkFun_Soil_Moisture_Sensor.h index 7b2727a..85cbcd1 100644 --- a/src/SparkFun_Soil_Moisture_Sensor.h +++ b/src/SparkFun_Soil_Moisture_Sensor.h @@ -32,7 +32,7 @@ // //----------------------------------------------------------------------------------------------- // Define our Arduino Object - I2C version -class SparkFunSoilMoistureSensorI2C : public sfDevSoilMoisture +class SparkFunSoilMoistureSensor : public sfDevSoilMoisture { public: /** From ef12ef0568ef3c71e37e2e55b25a6ecaa9961e50 Mon Sep 17 00:00:00 2001 From: Kirk Benell Date: Sat, 15 Feb 2025 16:52:33 -0700 Subject: [PATCH 4/7] add formatting block on includes --- src/SparkFun_Soil_Moisture_Sensor.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/SparkFun_Soil_Moisture_Sensor.h b/src/SparkFun_Soil_Moisture_Sensor.h index 85cbcd1..49c801d 100644 --- a/src/SparkFun_Soil_Moisture_Sensor.h +++ b/src/SparkFun_Soil_Moisture_Sensor.h @@ -10,7 +10,7 @@ * @author SparkFun Electronics * @date 2025 * @copyright Copyright (c) 2025, SparkFun Electronics Inc. This project is released under the MIT License. - * + * * SPDX-License-Identifier: MIT */ @@ -20,9 +20,10 @@ #pragma once // To make the Arduino machine happy, include the toolkit header before the core implementation for this device +// clang-format off #include #include "sfTk/sfDevSoilMoisture.h" - +// clang-format on // Note: // The core of the implementation for this device library is in the SparkFun Toolkit object sfDevSoilMoisture, From ef33665de243ccbd054a807bdd830b95ecd33732 Mon Sep 17 00:00:00 2001 From: Kirk Benell Date: Mon, 17 Feb 2025 08:00:58 -0700 Subject: [PATCH 5/7] include inherited members --- docs/doxygen/doxygen-config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/doxygen/doxygen-config b/docs/doxygen/doxygen-config index 04fc211..76380c8 100644 --- a/docs/doxygen/doxygen-config +++ b/docs/doxygen/doxygen-config @@ -171,7 +171,7 @@ ALWAYS_DETAILED_SEC = YES # operators of the base classes will not be shown. # The default value is: NO. -INLINE_INHERITED_MEMB = NO +INLINE_INHERITED_MEMB = YES # If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path # before files name in the file list and in the header files. If set to NO the From 97b3d1a96c2d48748815279ec49afbe0afdc66a7 Mon Sep 17 00:00:00 2001 From: Kirk Benell Date: Fri, 21 Feb 2025 16:06:42 -0700 Subject: [PATCH 6/7] update method calls to bus - new names --- src/sfTk/sfDevSoilMoisture.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/sfTk/sfDevSoilMoisture.cpp b/src/sfTk/sfDevSoilMoisture.cpp index 1cd47f3..2457cd5 100644 --- a/src/sfTk/sfDevSoilMoisture.cpp +++ b/src/sfTk/sfDevSoilMoisture.cpp @@ -9,11 +9,10 @@ * @author SparkFun Electronics * @date 2025 * @copyright Copyright (c) 2025, SparkFun Electronics Inc. This project is released under the MIT License. - * + * * SPDX-License-Identifier: MIT */ - #include "sfDevSoilMoisture.h" // Impl for the core driver @@ -22,27 +21,27 @@ /** * @brief Command to turn off the on-board LED */ -#define kCommandLEDOff 0x00 +const uint8_t kCommandLEDOff = 0x00; /** * @brief Command to turn on the on-board LED */ -#define kCommandLEDOn 0x01 +const uint8_t kCommandLEDOn = 0x01; /** * @brief Command to change the I2C address of the sensor */ -#define kCommandChangeAddress 0x03 +const uint8_t kCommandChangeAddress = 0x03; /** * @brief Command to get the moisture value from the sensor */ -#define kCommandGetValue 0x05 +const uint8_t kCommandGetValue = 0x05; /** * @brief Command indicating no new data is available */ -#define kCommandNothingNew 0x99 +const uint8_t kCommandNothingNew = 0x99; //--------------------------------------------------------------------- // Core object implementation @@ -68,7 +67,7 @@ sfTkError_t sfDevSoilMoisture::LEDOff(void) return ksfTkErrBusNotInit; // Send the command to turn the LED off - return _theBus->writeByte(kCommandLEDOff); + return _theBus->writeData(kCommandLEDOff); } //---------------------------------------------------------------------------------------- // LED on command @@ -78,7 +77,7 @@ sfTkError_t sfDevSoilMoisture::LEDOn(void) return ksfTkErrBusNotInit; // Send the command to turn the LED on - return _theBus->writeByte(kCommandLEDOn); + return _theBus->writeData(kCommandLEDOn); } //---------------------------------------------------------------------------------------- @@ -89,7 +88,7 @@ uint16_t sfDevSoilMoisture::readMoistureValue(void) return 0; uint16_t value = 0; - if (_theBus->readRegisterWord(kCommandGetValue, value) != ksfTkErrOk) + if (_theBus->readRegister(kCommandGetValue, value) != ksfTkErrOk) return 0; return value; @@ -128,7 +127,7 @@ sfTkError_t sfDevSoilMoisture::setI2CAddress(uint8_t newAddress) // Send the command to change the address. NOTE: Because of how the sensor works, // the following will return an error (since the sensor side resets the bus) - (void)_theBus->writeRegisterByte(kCommandChangeAddress, newAddress); + (void)_theBus->writeRegister(kCommandChangeAddress, newAddress); return ksfTkErrOk; } From 33ef6de1a659c9b88f089818ca7a03c06cd6c437 Mon Sep 17 00:00:00 2001 From: Kirk Benell Date: Wed, 26 Feb 2025 14:57:10 -0700 Subject: [PATCH 7/7] updates for v1.0 of this library --- .github/workflows/test-compile-sketch.yml | 2 +- library.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-compile-sketch.yml b/.github/workflows/test-compile-sketch.yml index 4f3e8c3..17216d3 100644 --- a/.github/workflows/test-compile-sketch.yml +++ b/.github/workflows/test-compile-sketch.yml @@ -119,7 +119,7 @@ jobs: run: | arduino-cli config set library.enable_unsafe_install true arduino-cli version - arduino-cli lib install --git-url https://github.com/sparkfun/SparkFun_Toolkit.git#dc0f0ca + arduino-cli lib install "SparkFun Toolkit"@1.0.0 - name: Compile Sketch run: arduino-cli compile --fqbn ${{ matrix.board.fqbn }} examples/Example_01_BasicReadings --library . diff --git a/library.properties b/library.properties index abe7577..a45c246 100644 --- a/library.properties +++ b/library.properties @@ -8,5 +8,5 @@ category=Sensors url=https://github.com/sparkfun/SparkFun_Soil_Moisture_Arduino_Library architectures=* includes=SparkFun_Soil_Moisture_Sensor.h -depends=SparkFun Toolkit +depends=SparkFun Toolkit >=1.0.0