From cd4f3c387810a1a1d6f249beebb11db55fd33f0a Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Mon, 27 Mar 2023 10:43:16 -0500 Subject: [PATCH 01/89] GroPoint Profile draft wrapper For Modbus GPLP-8 sensor only, for now. --- src/sensors/GroPointParent.cpp | 263 +++++++++++++++++++++++++ src/sensors/GroPointParent.h | 211 ++++++++++++++++++++ src/sensors/GroPointProfileGPLP8.h | 298 +++++++++++++++++++++++++++++ src/sensors/YosemitechY700.h | 2 +- 4 files changed, 773 insertions(+), 1 deletion(-) create mode 100644 src/sensors/GroPointParent.cpp create mode 100644 src/sensors/GroPointParent.h create mode 100644 src/sensors/GroPointProfileGPLP8.h diff --git a/src/sensors/GroPointParent.cpp b/src/sensors/GroPointParent.cpp new file mode 100644 index 000000000..3bd836aa4 --- /dev/null +++ b/src/sensors/GroPointParent.cpp @@ -0,0 +1,263 @@ +/** + * @file GroPointParent.cpp + * @copyright 2017-2023 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Anthony Aufdenkampe + * + * @brief Implements the GroPointParent class. + */ + +#include "GroPointParent.h" + +// The constructor - need the sensor type, modbus address, power pin, stream for +// data, and number of readings to average +GroPointParent::GroPointParent( + byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, + int8_t enablePin, uint8_t measurementsToAverage, gropointModel model, + const char* sensName, uint8_t numVariables, uint32_t warmUpTime_ms, + uint32_t stabilizationTime_ms, uint32_t measurementTime_ms, + uint8_t incCalcValues) + : Sensor(sensName, numVariables, warmUpTime_ms, stabilizationTime_ms, + measurementTime_ms, powerPin, -1, measurementsToAverage, + incCalcValues), + _model(model), + _modbusAddress(modbusAddress), + _stream(stream), + _RS485EnablePin(enablePin), + _powerPin2(powerPin2) {} +GroPointParent::GroPointParent( + byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, + int8_t enablePin, uint8_t measurementsToAverage, gropointModel model, + const char* sensName, uint8_t numVariables, uint32_t warmUpTime_ms, + uint32_t stabilizationTime_ms, uint32_t measurementTime_ms, + uint8_t incCalcValues) + : Sensor(sensName, numVariables, warmUpTime_ms, stabilizationTime_ms, + measurementTime_ms, powerPin, -1, measurementsToAverage, + incCalcValues), + _model(model), + _modbusAddress(modbusAddress), + _stream(&stream), + _RS485EnablePin(enablePin), + _powerPin2(powerPin2) {} +// Destructor +GroPointParent::~GroPointParent() {} + + +// The sensor installation location on the Mayfly +String GroPointParent::getSensorLocation(void) { + String sensorLocation = F("modbus_0x"); + if (_modbusAddress < 16) sensorLocation += "0"; + sensorLocation += String(_modbusAddress, HEX); + return sensorLocation; +} + + +bool GroPointParent::setup(void) { + bool retVal = + Sensor::setup(); // this will set pin modes and the setup status bit + if (_RS485EnablePin >= 0) pinMode(_RS485EnablePin, OUTPUT); + if (_powerPin2 >= 0) pinMode(_powerPin2, OUTPUT); + +#ifdef MS_GROPOINTPARENT_DEBUG_DEEP + _gsensor.setDebugStream(&DEEP_DEBUGGING_SERIAL_OUTPUT); +#endif + + // This sensor begin is just setting more pin modes, etc, no sensor power + // required This realy can't fail so adding the return value is just for + // show + retVal &= _gsensor.begin(_model, _modbusAddress, _stream, _RS485EnablePin); + + return retVal; +} + + +// The function to wake up a sensor +// Different from the standard in that it waits for warm up and starts +// measurements +bool GroPointParent::wake(void) { + // Sensor::wake() checks if the power pin is on and sets the wake timestamp + // and status bits. If it returns false, there's no reason to go on. + if (!Sensor::wake()) return false; + + // Send the command to begin taking readings, trying up to 5 times + bool success = false; + uint8_t ntries = 0; + MS_DBG(F("Start Measurement on"), getSensorNameAndLocation()); + while (!success && ntries < 5) { + MS_DBG('(', ntries + 1, F("):")); + success = _gsensor.startMeasurement(); + ntries++; + } + + if (success) { + // Update the time that the sensor was activated + _millisSensorActivated = millis(); + MS_DBG(getSensorNameAndLocation(), F("activated and measuring.")); + } else { + MS_DBG(getSensorNameAndLocation(), F("was NOT activated!")); + // Make sure the activation time is zero and the wake success bit (bit + // 4) is unset + _millisSensorActivated = 0; + _sensorStatus &= 0b11101111; + } + + return success; +} + + +// The function to put the sensor to sleep +// Different from the standard in that it stops measurements +bool GroPointParent::sleep(void) { + if (!checkPowerOn()) { return true; } + if (_millisSensorActivated == 0) { + MS_DBG(getSensorNameAndLocation(), F("was not measuring!")); + return true; + } + + // Send the command to begin taking readings, trying up to 5 times + bool success = false; + uint8_t ntries = 0; + MS_DBG(F("Stop Measurement on"), getSensorNameAndLocation()); + while (!success && ntries < 5) { + MS_DBG('(', ntries + 1, F("):")); + success = _gsensor.stopMeasurement(); + ntries++; + } + if (success) { + // Unset the activation time + _millisSensorActivated = 0; + // Unset the measurement request time + _millisMeasurementRequested = 0; + // Unset the status bits for sensor activation (bits 3 & 4) and + // measurement request (bits 5 & 6) + _sensorStatus &= 0b10000111; + MS_DBG(F("Measurements stopped.")); + } else { + MS_DBG(F("Measurements NOT stopped!")); + } + + return success; +} + + +// This turns on sensor power +void GroPointParent::powerUp(void) { + if (_powerPin >= 0) { + MS_DBG(F("Powering"), getSensorNameAndLocation(), F("with pin"), + _powerPin); + digitalWrite(_powerPin, HIGH); + // Mark the time that the sensor was powered + _millisPowerOn = millis(); + } + if (_powerPin2 >= 0) { + MS_DBG(F("Applying secondary power to"), getSensorNameAndLocation(), + F("with pin"), _powerPin2); + digitalWrite(_powerPin2, HIGH); + } + if (_powerPin < 0 && _powerPin2 < 0) { + MS_DBG(F("Power to"), getSensorNameAndLocation(), + F("is not controlled by this library.")); + } + // Set the status bit for sensor power attempt (bit 1) and success (bit 2) + _sensorStatus |= 0b00000110; +} + + +// This turns off sensor power +void GroPointParent::powerDown(void) { + if (_powerPin >= 0) { + MS_DBG(F("Turning off power to"), getSensorNameAndLocation(), + F("with pin"), _powerPin); + digitalWrite(_powerPin, LOW); + // Unset the power-on time + _millisPowerOn = 0; + // Unset the activation time + _millisSensorActivated = 0; + // Unset the measurement request time + _millisMeasurementRequested = 0; + // Unset the status bits for sensor power (bits 1 & 2), + // activation (bits 3 & 4), and measurement request (bits 5 & 6) + _sensorStatus &= 0b10000001; + } + if (_powerPin2 >= 0) { + MS_DBG(F("Turning off secondary power to"), getSensorNameAndLocation(), + F("with pin"), _powerPin2); + digitalWrite(_powerPin2, LOW); + } + if (_powerPin < 0 && _powerPin2 < 0) { + MS_DBG(F("Power to"), getSensorNameAndLocation(), + F("is not controlled by this library.")); + // Do NOT unset any status bits or timestamps if we didn't really power + // down! + } +} + + +bool GroPointParent::addSingleMeasurementResult(void) { + bool success = false; + + // Check a measurement was *successfully* started (status bit 6 set) + // Only go on to get a result if it was + if (bitRead(_sensorStatus, 6)) { + switch (_model) { + case GPLP8: { + // Initialize float variables + float valueM1 = -9999; + float valueM2 = -9999; + float valueM3 = -9999; + float valueM4 = -9999; + float valueM5 = -9999; + float valueM6 = -9999; + float valueM7 = -9999; + float valueM8 = -9999; + + // Get Values + MS_DBG(F("Get Values from"), getSensorNameAndLocation()); + success = _gsensor.getValues(valueM1, valueM2, valueM3, + valueM4, valueM5, valueM6, + valueM7, valueM8); + + // Fix not-a-number values + if (!success || isnan(valueM1)) valueM1 = -9999; + if (!success || isnan(valueM2)) valueM2 = -9999; + if (!success || isnan(valueM3)) valueM3 = -9999; + if (!success || isnan(valueM4)) valueM4 = -9999; + if (!success || isnan(valueM5)) valueM5 = -9999; + if (!success || isnan(valueM6)) valueM6 = -9999; + if (!success || isnan(valueM7)) valueM7 = -9999; + if (!success || isnan(valueM8)) valueM8 = -9999; + + MS_DBG(F(" "), _gsensor.getParameter()); + MS_DBG(F(" "), DOmgL, ',', Turbidity, ',', Cond, ',', pH, + ',', Temp, ',', ORP, ',', Chlorophyll, ',', BGA); + + // Put values into the array + verifyAndAddMeasurementResult(0, valueM1); + verifyAndAddMeasurementResult(1, valueM2); + verifyAndAddMeasurementResult(2, valueM3); + verifyAndAddMeasurementResult(3, valueM4); + verifyAndAddMeasurementResult(4, valueM5); + verifyAndAddMeasurementResult(5, valueM6); + verifyAndAddMeasurementResult(6, valueM7); + verifyAndAddMeasurementResult(7, valueM8); + + break; + } + default: { + // Get Values + MS_DBG(F("Other GroPoint models not yet implemented.")); + + } + } + } else { + MS_DBG(getSensorNameAndLocation(), F("is not currently measuring!")); + } + + // Unset the time stamp for the beginning of this measurement + _millisMeasurementRequested = 0; + // Unset the status bits for a measurement request (bits 5 & 6) + _sensorStatus &= 0b10011111; + + // Return true when finished + return success; +} diff --git a/src/sensors/GroPointParent.h b/src/sensors/GroPointParent.h new file mode 100644 index 000000000..34cdad3c1 --- /dev/null +++ b/src/sensors/GroPointParent.h @@ -0,0 +1,211 @@ +/** + * @file GroPointParent.cpp + * @copyright 2017-2023 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Anthony Aufdenkampe + * + * @brief Contains the GroPointParent sensor subclass, itself a parent + * class for all GroPoint Soil Moisture and Temperature sensors + * that communicate via SDI-12 or Modbus. + * NOTE: Presently this library only supports Modbus communication and GroPoint + * Profile Multi Segment Soil Moisture & Temperature Profiling Probes (GPLP-X) + * via the EnviroDIY GroPointModbus library. + * + * Documentation for the GroPointModbus Modbus Protocol commands and responses, along with + * information about the various variables, can be found in the EnviroDIY + * GroPointModbus library at: https://github.com/EnviroDIY/GroPointModbus + */ +/* clang-format off */ +/** + * @defgroup gropoint_group GroPoint Sensors + * The Sensor and Variable objects for all GroPoint sensors. + * + * @ingroup the_sensors + * + * + * This library currently supports the following [GroPoint](https://www.gropoint.com) sensors: + * - [GroPoint Profile GPLP-8](https://www.gropoint.com/products/soil-sensors/gropoint-profile), 8-Segment Soil Moisture & Temperature Profiling Probe + * - [GroPoint Profile User Manual](https://www.gropoint.com/s/2625-N-T-GroPoint-Profile-User-Manual-V113.pdf), including Modbus Instructions. + * - [GroPoint Profile Technical Info](https://www.gropoint.com/s/GroPoint-Profile-Technical-Info.pdf) + * - [Class Documentation](@ref sensor_gplp8) + * + * These sensors operate a 7.5 to 14.0 VDC power supply (Max 18.0 VDC). The power supply can be stopped between measurements for all. + * They communicate via [Modbus RTU](https://en.wikipedia.org/wiki/Modbus) over [RS-485](https://en.wikipedia.org/wiki/RS-485). + * To interface with them, you will need an RS485-to-TTL adapter. + * + * The sensor constructor requires as input: the sensor modbus address, a stream instance for data (ie, ```Serial```), and one or two power pins. + * The Arduino pin controlling the receive and data enable on your RS485-to-TTL adapter and the number of readings to average are optional. + * (Use -1 for the second power pin and -1 for the enable pin if these don't apply and you want to average more than one reading.) + * Please see the section "[Notes on Arduino Streams and Software Serial](@ref page_arduino_streams)" + * for more information about what streams can be used along with this library. + * In tests on these sensors, SoftwareSerial_ExtInts _did not work_ to communicate with these sensors, because it isn't stable enough. + * AltSoftSerial and HardwareSerial work fine. + * Up to two power pins are provided so that the RS485 adapter, the sensor and/or an external power relay can be controlled separately. + * If the power to everything is controlled by the same pin, use -1 for the second power pin or omit the argument. + * If they are controlled by different pins _and no other sensors are dependent on power from either pin_ then the order of the pins doesn't matter. + * If the RS485 adapter, sensor, or relay are controlled by different pins _and any other sensors are controlled by the same pins_ you should put the shared pin first and the un-shared pin second. + * Both pins _cannot_ be shared pins. + * + * By default, this library cuts power to the sensors between readings, causing them to lose track of their brushing interval. + * The library manually activates the brushes as part of the "wake" command. + * There are currently no other ways to set the brushing interval in this library. + * + * The lower level details of the communication with the sensors is managed by the + * [EnviroDIY GroPointModbus library](https://github.com/EnviroDIY/GroPointModbus) + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_GROPOINTPARENT_H_ +#define SRC_SENSORS_GROPOINTPARENT_H_ + +// Debugging Statement +// #define MS_GROPOINTPARENT_DEBUG +// #define MS_GROPOINTPARENT_DEBUG_DEEP + +#ifdef MS_GROPOINTPARENT_DEBUG +#define MS_DEBUGGING_STD "GroPointParent" +#endif + +#ifdef MS_GROPOINTPARENT_DEBUG_DEEP +#define MS_DEBUGGING_DEEP "GroPointParent" +#endif + +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#undef MS_DEBUGGING_DEEP +#include "VariableBase.h" +#include "SensorBase.h" +#include "GroPointModbus.h" + +/* clang-format off */ +/** + * @brief The Sensor sub-class for all the [GroPoint sensors](@ref gropoint_group) + * + * @ingroup gropoint_group + */ +/* clang-format on */ +class GroPointParent : public Sensor { + public: + /** + * @brief Construct a new GroPoint Parent object. This is only intended + * to be used within this library. + * + * @param modbusAddress The modbus address of the sensor. + * @param stream An Arduino data stream for modbus communication. See + * [notes](@ref page_arduino_streams) for more information on what streams + * can be used. + * @param powerPin The pin on the mcu controlling power to the GroPoint. + * Use -1 if it is continuously powered. + * @param powerPin2 The pin on the mcu controlling power to the RS485 + * adapter, if it is different from that used to power the sensor. Use -1 + * or omit if not applicable. + * @param enablePin The pin on the mcu controlling the direction enable on + * the RS485 adapter, if necessary; use -1 or omit if not applicable. An + * RS485 adapter with integrated flow control is strongly recommended. + * @param measurementsToAverage The number of measurements to take and + * average before giving a "final" result from the sensor; optional with a + * default value of 1. + * @param model The model of GroPoint sensor. + * @param sensName The name of the sensor. Defaults to "SDI12-Sensor". + * @param numVariables The number of variable results returned by the + * sensor. Defaults to 2. + * @param warmUpTime_ms The time in ms between when the sensor is powered on + * and when it is ready to receive a wake command. Defaults to 1500. + * @param stabilizationTime_ms The time in ms between when the sensor + * receives a wake command and when it is able to return stable values. + * Defaults to 20,000 (20s). + * @param measurementTime_ms The time in ms between when a measurement is + * started and when the result value is available. Defaults to 2000. + * @param incCalcValues The number of included calculated variables from the + * sensor, if any. These are used for values that we would always calculate + * for a sensor and depend only on the raw results of that single sensor; + * optional with a default value of 0. + */ + GroPointParent(byte modbusAddress, Stream* stream, int8_t powerPin, + int8_t powerPin2, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1, + gropointModel model = UNKNOWN, + const char* sensName = "GroPoint-Sensor", + uint8_t numVariables = 2, + uint32_t warmUpTime_ms = 350, + uint32_t stabilizationTime_ms = 100, + uint32_t measurementTime_ms = 200, + uint8_t incCalcValues = 0); + /** + * @copydoc GroPointParent::GroPointParent + */ + GroPointParent(byte modbusAddress, Stream& stream, int8_t powerPin, + int8_t powerPin2, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1, + gropointModel model = UNKNOWN, + const char* sensName = "GroPoint-Sensor", + uint8_t numVariables = 2, + uint32_t warmUpTime_ms = 350, + uint32_t stabilizationTime_ms = 100, + uint32_t measurementTime_ms = 200, + uint8_t incCalcValues = 0); + /** + * @brief Destroy the GroPoint Parent object - no action taken + */ + virtual ~GroPointParent(); + + /** + * @copydoc Sensor::getSensorLocation() + */ + String getSensorLocation(void) override; + + /** + * @brief Do any one-time preparations needed before the sensor will be able + * to take readings. + * + * This sets pin modes on the #_powerPin, adapter power, and adapter + * enable pins. It also sets the expected stream timeout for modbus and + * updates the #_sensorStatus. No sensor power is required. This will + * always return true. + * + * @return **bool** True if the setup was successful. + */ + bool setup(void) override; + /** + * @brief Wake the sensor up, if necessary. Do whatever it takes to get a + * sensor in the proper state to begin a measurement. + * + * Verifies that the power is on and updates the #_sensorStatus. This also + * sets the #_millisSensorActivated timestamp. + * + * @note This does NOT include any wait for sensor readiness. + * + * @return **bool** True if the wake function completed successfully. + */ + bool wake(void) override; + /** + * @brief Puts the sensor to sleep, if necessary. + * + * This also un-sets the #_millisSensorActivated timestamp (sets it to 0). + * This does NOT power down the sensor! + * + * @return **bool** True if the sleep function completed successfully. + */ + bool sleep(void) override; + + // Override these to use two power pins + void powerUp(void) override; + void powerDown(void) override; + + /** + * @copydoc Sensor::addSingleMeasurementResult() + */ + bool addSingleMeasurementResult(void) override; + + private: + gropoint _gsensor; + gropointModel _model; + byte _modbusAddress; + Stream* _stream; + int8_t _RS485EnablePin; + int8_t _powerPin2; +}; + +#endif // SRC_SENSORS_GROPOINTPARENT_H_ diff --git a/src/sensors/GroPointProfileGPLP8.h b/src/sensors/GroPointProfileGPLP8.h new file mode 100644 index 000000000..ef53d7e34 --- /dev/null +++ b/src/sensors/GroPointProfileGPLP8.h @@ -0,0 +1,298 @@ +/** + * @file GroPointProfileGPLP8.h + * @copyright 2017-2023 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Anthony Aufdenkampe + * + * @brief Contains the GroPointProfileGPLP8 sensor subclass and the variable + * subclasses GroPointProfileGPLP8_Moist and GroPointProfileGPLP8_Temp + * + * These are for the GroPoint Profile GPLP-8 Eight-Segment Soil Moisture + * and Temperature Profiling Probe. + * + * This depends on the GroPointParent super class. + * + * Documentation for the Modbus Protocol commands and responses can be found + * within the documentation in the GroPointModbus library at: + * https://github.com/EnviroDIY/GroPointModbus + * + * More detailed infromation on each variable can be found in the documentation + * for the individual sensor probes + */ +/* clang-format off */ +/** + * @defgroup sensor_gplp8 GroPoint Profile GPLP-8 Soil Moisture & Temperature + * Profiling Probe. Classes for the GroPoint Profile GPLP-8 Soil Moisture & + * Temperature Probe. + * + * @ingroup GroPoint_group + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_gplp8_datasheet Sensor Datasheet + * - [GroPoint Profile User Manual](https://www.gropoint.com/s/2625-N-T-GroPoint-Profile-User-Manual-V113.pdf), including Modbus Instructions. + * - [GroPoint Profile Technical Info](https://www.gropoint.com/s/GroPoint-Profile-Technical-Info.pdf) + * * + * @section sensor_gplp8_ctor Sensor Constructor + * {{ @ref GroPointProfileGPLP8::GroPointProfileGPLP8 }} + * + * ___ + * @section sensor_gplp8_examples Example Code + * The GPLP-8 Probe is used in the @menulink{GroPoint_gplp8} example. + * + * @menusnip{gropoint_gplp8} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_GROPOINTPROFILEGPLP8_H_ +#define SRC_SENSORS_GROPOINTPROFILEGPLP8_H_ + +// Included Dependencies +#include "sensors/GroPointParent.h" + +/** @ingroup sensor_gplp8 */ +/**@{*/ + +// Sensor Specific Defines +/// @brief Sensor::_numReturnedValues; the GPLP8 can report 8 values. +#define GPLP8_NUM_VARIABLES 2 +/// @brief Sensor::_incCalcValues; we don't calculate any additional values. +#define GPLP8_INC_CALC_VARIABLES 0 + +/** + * @anchor sensor_gplp8_timing + * @name Sensor Timing + * The sensor timing for a GroPoint Profile GPLP-8 + */ +/**@{*/ +/** + * @brief Sensor::_warmUpTime_ms; time before sensor responds after power - 1.6 + * seconds (1600ms). + * + * This is the time for communication to begin. + */ +#define GPLP8_WARM_UP_TIME_MS 350 +/** + * @brief Sensor::_stabilizationTime_ms; the GPLP-8 is stable after 100 ms. + * + */ +#define GPLP8_STABILIZATION_TIME_MS 100 +/// @brief Sensor::_measurementTime_ms; the GPLP-8 takes ~200 ms to complete a +/// measurement. +#define GPLP8_MEASUREMENT_TIME_MS 200 +/**@}*/ + +/** + * @anchor sensor_gplp8_cond + * @name Conductivity + * The conductivity variable from a GroPoint Profile GPLP-8 + * - Range is 1 µS/cm to 200 mS/cm + * - Accuracy is ± 1 % Full Scale + * + * {{ @ref GroPointProfileGPLP8_Moist::GroPointProfileGPLP8_Moist }} + */ +/**@{*/ +/// @brief Decimals places in string representation; conductivity should have 1 +/// - resolution is 0.1 µS/cm. +#define GPLP8_MOIST_RESOLUTION 1 +/// @brief Sensor variable number; conductivity is stored in sensorValues[2]. +#define GPLP8_MOIST_VAR_NUM 2 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "specificConductance" +#define GPLP8_MOIST_VAR_NAME "specificConductance" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "microsiemenPerCentimeter" (µS/cm) +#define GPLP8_MOIST_UNIT_NAME "microsiemenPerCentimeter" +/// @brief Default variable short code; "GPLP8Moist" +#define GPLP8_MOIST_DEFAULT_CODE "GPLP8Moist" +/**@}*/ + +/** + * @anchor sensor_gplp8_temp + * @name Temperature + * The temperature variable from a GroPoint Profile GPLP-8 + * - Range is 0°C to + 50°C + * - Accuracy is ± 0.2°C + * + * {{ @ref GroPointProfileGPLP8_Temp::GroPointProfileGPLP8_Temp }} + */ +/**@{*/ +/// @brief Decimals places in string representation; temperature should have 1 - +/// resolution is 0.1°C. +#define GPLP8_TEMP_RESOLUTION 1 +/// @brief Sensor variable number; temperature is stored in sensorValues[4]. +#define GPLP8_TEMP_VAR_NUM 4 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "temperature" +#define GPLP8_TEMP_VAR_NAME "temperature" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "degreeCelsius" (°C) +#define GPLP8_TEMP_UNIT_NAME "degreeCelsius" +/// @brief Default variable short code; "GPLP8Temp" +#define GPLP8_TEMP_DEFAULT_CODE "GPLP8Temp" +/**@}*/ + + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the + * [GroPoint Profile GPLP8 probe](@ref sensor_gplp8). + * + * @ingroup sensor_gplp8 + */ +/* clang-format on */ +class GroPointProfileGPLP8 : public GroPointParent { + public: + // Constructors with overloads + /** + * @brief Construct a new GroPoint GPLP8 object. + * + * @param modbusAddress The modbus address of the sensor. + * @param stream An Arduino data stream for modbus communication. See + * [notes](@ref page_arduino_streams) for more information on what streams + * can be used. + * @param powerPin The pin on the mcu controlling power to the GPLP-8. + * Use -1 if it is continuously powered. + * @param powerPin2 The pin on the mcu controlling power to the RS485 + * adapter, if it is different from that used to power the sensor. Use -1 + * or omit if not applicable. + * @param enablePin The pin on the mcu controlling the direction enable on + * the RS485 adapter, if necessary; use -1 or omit if not applicable. + * @note An RS485 adapter with integrated flow control is strongly + * recommended. + * @param measurementsToAverage The number of measurements to take and + * average before giving a "final" result from the sensor; optional with a + * default value of 1. + */ + GroPointProfileGPLP8(byte modbusAddress, Stream* stream, int8_t powerPin, + int8_t powerPin2 = -1, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1) + : GroPointParent(modbusAddress, stream, powerPin, powerPin2, + enablePin, measurementsToAverage, GPLP8, + "GroPointProfileGPLP8", GPLP8_NUM_VARIABLES, + GPLP8_WARM_UP_TIME_MS, GPLP8_STABILIZATION_TIME_MS, + GPLP8_MEASUREMENT_TIME_MS, + GPLP8_INC_CALC_VARIABLES) {} + /** + * @copydoc GroPointProfileGPLP8::GroPointProfileGPLP8 + */ + GroPointProfileGPLP8(byte modbusAddress, Stream& stream, int8_t powerPin, + int8_t powerPin2 = -1, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1) + : GroPointParent(modbusAddress, stream, powerPin, powerPin2, + enablePin, measurementsToAverage, GPLP8, + "GroPointProfileGPLP8", GPLP8_NUM_VARIABLES, + GPLP8_WARM_UP_TIME_MS, GPLP8_STABILIZATION_TIME_MS, + GPLP8_MEASUREMENT_TIME_MS, + GPLP8_INC_CALC_VARIABLES) {} + /** + * @brief Destroy the GroPoint GPLP8 object + */ + ~GroPointProfileGPLP8() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [dissolved oxygen concentration output](@ref sensor_gplp8_domgl) from a + * [GroPoint Profile GPLP8 probe](@ref sensor_gplp8). + * + * @ingroup sensor_gplp8 + */ +/* clang-format on */ + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [conductivity output](@ref sensor_gplp8_cond) from a + * [GroPoint Profile GPLP8 probe](@ref sensor_gplp8). + * + * @ingroup sensor_gplp8 + */ +/* clang-format on */ +class GroPointProfileGPLP8_Moist : public Variable { + public: + /** + * @brief Construct a new GroPointProfileGPLP8_Moist object. + * + * @param parentSense The parent GroPointProfileGPLP8 providing the result + * values. + * @param uuid A universally unique identifier (UUID or GUID) for the + * variable; optional with the default value of an empty string. + * @param varCode A short code to help identify the variable in files; + * optional with a default value of "GPLP8Moist". + */ + explicit GroPointProfileGPLP8_Moist(GroPointProfileGPLP8* parentSense, + const char* uuid = "", + const char* varCode = GPLP8_MOIST_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)GPLP8_MOIST_VAR_NUM, + (uint8_t)GPLP8_MOIST_RESOLUTION, GPLP8_MOIST_VAR_NAME, + GPLP8_MOIST_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new GroPointProfileGPLP8_Moist object. + * + * @note This must be tied with a parent GroPointProfileGPLP8 before it can be + * used. + */ + GroPointProfileGPLP8_Moist() + : Variable((const uint8_t)GPLP8_MOIST_VAR_NUM, + (uint8_t)GPLP8_MOIST_RESOLUTION, GPLP8_MOIST_VAR_NAME, + GPLP8_MOIST_UNIT_NAME, GPLP8_MOIST_DEFAULT_CODE) {} + /** + * @brief Destroy the GroPointProfileGPLP8_Moist object - no action needed. + */ + ~GroPointProfileGPLP8_Moist() {} +}; + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature output](@ref sensor_gplp8_temp) from a + * [GroPoint Profile GPLP8 probe](@ref sensor_gplp8). + * + * @ingroup sensor_gplp8 + */ +/* clang-format on */ +class GroPointProfileGPLP8_Temp : public Variable { + public: + /** + * @brief Construct a new GroPointProfileGPLP8_Temp object. + * + * @param parentSense The parent GroPointProfileGPLP8 providing the result + * values. + * @param uuid A universally unique identifier (UUID or GUID) for the + * variable; optional with the default value of an empty string. + * @param varCode A short code to help identify the variable in files; + * optional with a default value of "GPLP8Temp". + */ + explicit GroPointProfileGPLP8_Temp(GroPointProfileGPLP8* parentSense, + const char* uuid = "", + const char* varCode = GPLP8_TEMP_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)GPLP8_TEMP_VAR_NUM, + (uint8_t)GPLP8_TEMP_RESOLUTION, GPLP8_TEMP_VAR_NAME, + GPLP8_TEMP_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new GroPointProfileGPLP8_Temp object. + * + * @note This must be tied with a parent GroPointProfileGPLP8 before it can be + * used. + */ + GroPointProfileGPLP8_Temp() + : Variable((const uint8_t)GPLP8_TEMP_VAR_NUM, + (uint8_t)GPLP8_TEMP_RESOLUTION, GPLP8_TEMP_VAR_NAME, + GPLP8_TEMP_UNIT_NAME, GPLP8_TEMP_DEFAULT_CODE) {} + /** + * @brief Destroy the GroPointProfileGPLP8_Temp object - no action needed. + */ + ~GroPointProfileGPLP8_Temp() {} +}; + +/**@}*/ +#endif // SRC_SENSORS_GROPOINTPROFILEGPLP8_H_ diff --git a/src/sensors/YosemitechY700.h b/src/sensors/YosemitechY700.h index 6a146bac6..809a0808f 100644 --- a/src/sensors/YosemitechY700.h +++ b/src/sensors/YosemitechY700.h @@ -7,7 +7,7 @@ * @brief Contains the YosemitechY700 sensor subclass and the variable * subclasses YosemitechY700_Pressure and YosemitechY700_Temp. * - * These are for the Yosemitech Y700 Pressure sensor. + * These are for the Yosemitech Y700 Pressure Sensor. * * This depends on the YosemitechParent super class. * From a4b6541423316b6ec2384bd812e2d1a09750ca12 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Tue, 28 Mar 2023 15:28:19 -0500 Subject: [PATCH 02/89] Update GroPointProfileGPLP8.h ...replacing any vestiges from `YosemitechY4000.h` --- src/sensors/GroPointProfileGPLP8.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/sensors/GroPointProfileGPLP8.h b/src/sensors/GroPointProfileGPLP8.h index ef53d7e34..18d4db37d 100644 --- a/src/sensors/GroPointProfileGPLP8.h +++ b/src/sensors/GroPointProfileGPLP8.h @@ -85,27 +85,27 @@ /**@}*/ /** - * @anchor sensor_gplp8_cond - * @name Conductivity - * The conductivity variable from a GroPoint Profile GPLP-8 - * - Range is 1 µS/cm to 200 mS/cm - * - Accuracy is ± 1 % Full Scale + * @anchor sensor_gplp8_moist + * @name Moisture + * The volumetric soil moisture variable from a GroPoint Profile GPLP-8 + * - Range is 0% to 50% volumetric water content + * - Accuracy is ± 1% * * {{ @ref GroPointProfileGPLP8_Moist::GroPointProfileGPLP8_Moist }} */ /**@{*/ -/// @brief Decimals places in string representation; conductivity should have 1 -/// - resolution is 0.1 µS/cm. +/// @brief Decimals places in string representation; soil moisture should have 1 +/// - resolution is 0.1 %. #define GPLP8_MOIST_RESOLUTION 1 -/// @brief Sensor variable number; conductivity is stored in sensorValues[2]. -#define GPLP8_MOIST_VAR_NUM 2 +/// @brief Sensor variable number; soil moisture is stored in sensorValues[2]. +#define GPLP8_MOIST_VAR_NUM 0 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); -/// "specificConductance" +/// "volumetricWaterContent" #define GPLP8_MOIST_VAR_NAME "specificConductance" /// @brief Variable unit name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); -/// "microsiemenPerCentimeter" (µS/cm) +/// "percent" (%) #define GPLP8_MOIST_UNIT_NAME "microsiemenPerCentimeter" /// @brief Default variable short code; "GPLP8Moist" #define GPLP8_MOIST_DEFAULT_CODE "GPLP8Moist" @@ -115,8 +115,8 @@ * @anchor sensor_gplp8_temp * @name Temperature * The temperature variable from a GroPoint Profile GPLP-8 - * - Range is 0°C to + 50°C - * - Accuracy is ± 0.2°C + * - Range is -20°C to + 70°C + * - Accuracy is ± 0.5°C * * {{ @ref GroPointProfileGPLP8_Temp::GroPointProfileGPLP8_Temp }} */ @@ -125,7 +125,7 @@ /// resolution is 0.1°C. #define GPLP8_TEMP_RESOLUTION 1 /// @brief Sensor variable number; temperature is stored in sensorValues[4]. -#define GPLP8_TEMP_VAR_NUM 4 +#define GPLP8_TEMP_VAR_NUM 1 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "temperature" @@ -211,7 +211,7 @@ class GroPointProfileGPLP8 : public GroPointParent { /* clang-format off */ /** * @brief The Variable sub-class used for the - * [conductivity output](@ref sensor_gplp8_cond) from a + * [soil moisture output](@ref sensor_gplp8_moist) from a * [GroPoint Profile GPLP8 probe](@ref sensor_gplp8). * * @ingroup sensor_gplp8 From 70182c3b86c9b325d15278ce6bfb358c0c4528f4 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Tue, 28 Mar 2023 21:42:31 -0500 Subject: [PATCH 03/89] Shorten naming to GroPointGPLP8 from GroPointProfileGPLP8 --- ...GroPointProfileGPLP8.h => GroPointGPLP8.h} | 74 +++++++++---------- src/sensors/GroPointParent.cpp | 25 +++---- 2 files changed, 48 insertions(+), 51 deletions(-) rename src/sensors/{GroPointProfileGPLP8.h => GroPointGPLP8.h} (79%) diff --git a/src/sensors/GroPointProfileGPLP8.h b/src/sensors/GroPointGPLP8.h similarity index 79% rename from src/sensors/GroPointProfileGPLP8.h rename to src/sensors/GroPointGPLP8.h index 18d4db37d..7b0b1f3d6 100644 --- a/src/sensors/GroPointProfileGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -1,11 +1,11 @@ /** - * @file GroPointProfileGPLP8.h + * @file GroPointGPLP8.h * @copyright 2017-2023 Stroud Water Research Center * Part of the EnviroDIY ModularSensors library for Arduino * @author Anthony Aufdenkampe * - * @brief Contains the GroPointProfileGPLP8 sensor subclass and the variable - * subclasses GroPointProfileGPLP8_Moist and GroPointProfileGPLP8_Temp + * @brief Contains the GroPointGPLP8 sensor subclass and the variable + * subclasses GroPointGPLP8_Moist and GroPointGPLP8_Temp * * These are for the GroPoint Profile GPLP-8 Eight-Segment Soil Moisture * and Temperature Profiling Probe. @@ -35,7 +35,7 @@ * - [GroPoint Profile Technical Info](https://www.gropoint.com/s/GroPoint-Profile-Technical-Info.pdf) * * * @section sensor_gplp8_ctor Sensor Constructor - * {{ @ref GroPointProfileGPLP8::GroPointProfileGPLP8 }} + * {{ @ref GroPointGPLP8::GroPointGPLP8 }} * * ___ * @section sensor_gplp8_examples Example Code @@ -46,8 +46,8 @@ /* clang-format on */ // Header Guards -#ifndef SRC_SENSORS_GROPOINTPROFILEGPLP8_H_ -#define SRC_SENSORS_GROPOINTPROFILEGPLP8_H_ +#ifndef SRC_SENSORS_GROPOINTGPLP8_H_ +#define SRC_SENSORS_GROPOINTGPLP8_H_ // Included Dependencies #include "sensors/GroPointParent.h" @@ -91,7 +91,7 @@ * - Range is 0% to 50% volumetric water content * - Accuracy is ± 1% * - * {{ @ref GroPointProfileGPLP8_Moist::GroPointProfileGPLP8_Moist }} + * {{ @ref GroPointGPLP8_Moist::GroPointGPLP8_Moist }} */ /**@{*/ /// @brief Decimals places in string representation; soil moisture should have 1 @@ -101,12 +101,10 @@ #define GPLP8_MOIST_VAR_NUM 0 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); -/// "volumetricWaterContent" -#define GPLP8_MOIST_VAR_NAME "specificConductance" +#define GPLP8_MOIST_VAR_NAME "volumetricWaterContent" /// @brief Variable unit name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); -/// "percent" (%) -#define GPLP8_MOIST_UNIT_NAME "microsiemenPerCentimeter" +#define GPLP8_MOIST_UNIT_NAME "percent" /// @brief Default variable short code; "GPLP8Moist" #define GPLP8_MOIST_DEFAULT_CODE "GPLP8Moist" /**@}*/ @@ -118,7 +116,7 @@ * - Range is -20°C to + 70°C * - Accuracy is ± 0.5°C * - * {{ @ref GroPointProfileGPLP8_Temp::GroPointProfileGPLP8_Temp }} + * {{ @ref GroPointGPLP8_Temp::GroPointGPLP8_Temp }} */ /**@{*/ /// @brief Decimals places in string representation; temperature should have 1 - @@ -147,7 +145,7 @@ * @ingroup sensor_gplp8 */ /* clang-format on */ -class GroPointProfileGPLP8 : public GroPointParent { +class GroPointGPLP8 : public GroPointParent { public: // Constructors with overloads /** @@ -170,31 +168,31 @@ class GroPointProfileGPLP8 : public GroPointParent { * average before giving a "final" result from the sensor; optional with a * default value of 1. */ - GroPointProfileGPLP8(byte modbusAddress, Stream* stream, int8_t powerPin, + GroPointGPLP8(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2 = -1, int8_t enablePin = -1, uint8_t measurementsToAverage = 1) : GroPointParent(modbusAddress, stream, powerPin, powerPin2, enablePin, measurementsToAverage, GPLP8, - "GroPointProfileGPLP8", GPLP8_NUM_VARIABLES, + "GroPointGPLP8", GPLP8_NUM_VARIABLES, GPLP8_WARM_UP_TIME_MS, GPLP8_STABILIZATION_TIME_MS, GPLP8_MEASUREMENT_TIME_MS, GPLP8_INC_CALC_VARIABLES) {} /** - * @copydoc GroPointProfileGPLP8::GroPointProfileGPLP8 + * @copydoc GroPointGPLP8::GroPointGPLP8 */ - GroPointProfileGPLP8(byte modbusAddress, Stream& stream, int8_t powerPin, + GroPointGPLP8(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2 = -1, int8_t enablePin = -1, uint8_t measurementsToAverage = 1) : GroPointParent(modbusAddress, stream, powerPin, powerPin2, enablePin, measurementsToAverage, GPLP8, - "GroPointProfileGPLP8", GPLP8_NUM_VARIABLES, + "GroPointGPLP8", GPLP8_NUM_VARIABLES, GPLP8_WARM_UP_TIME_MS, GPLP8_STABILIZATION_TIME_MS, GPLP8_MEASUREMENT_TIME_MS, GPLP8_INC_CALC_VARIABLES) {} /** * @brief Destroy the GroPoint GPLP8 object */ - ~GroPointProfileGPLP8() {} + ~GroPointGPLP8() {} }; @@ -217,38 +215,38 @@ class GroPointProfileGPLP8 : public GroPointParent { * @ingroup sensor_gplp8 */ /* clang-format on */ -class GroPointProfileGPLP8_Moist : public Variable { +class GroPointGPLP8_Moist : public Variable { public: /** - * @brief Construct a new GroPointProfileGPLP8_Moist object. + * @brief Construct a new GroPointGPLP8_Moist object. * - * @param parentSense The parent GroPointProfileGPLP8 providing the result + * @param parentSense The parent GroPointGPLP8 providing the result * values. * @param uuid A universally unique identifier (UUID or GUID) for the * variable; optional with the default value of an empty string. * @param varCode A short code to help identify the variable in files; * optional with a default value of "GPLP8Moist". */ - explicit GroPointProfileGPLP8_Moist(GroPointProfileGPLP8* parentSense, + explicit GroPointGPLP8_Moist(GroPointGPLP8* parentSense, const char* uuid = "", const char* varCode = GPLP8_MOIST_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)GPLP8_MOIST_VAR_NUM, (uint8_t)GPLP8_MOIST_RESOLUTION, GPLP8_MOIST_VAR_NAME, GPLP8_MOIST_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new GroPointProfileGPLP8_Moist object. + * @brief Construct a new GroPointGPLP8_Moist object. * - * @note This must be tied with a parent GroPointProfileGPLP8 before it can be + * @note This must be tied with a parent GroPointGPLP8 before it can be * used. */ - GroPointProfileGPLP8_Moist() + GroPointGPLP8_Moist() : Variable((const uint8_t)GPLP8_MOIST_VAR_NUM, (uint8_t)GPLP8_MOIST_RESOLUTION, GPLP8_MOIST_VAR_NAME, GPLP8_MOIST_UNIT_NAME, GPLP8_MOIST_DEFAULT_CODE) {} /** - * @brief Destroy the GroPointProfileGPLP8_Moist object - no action needed. + * @brief Destroy the GroPointGPLP8_Moist object - no action needed. */ - ~GroPointProfileGPLP8_Moist() {} + ~GroPointGPLP8_Moist() {} }; /* clang-format off */ @@ -260,39 +258,39 @@ class GroPointProfileGPLP8_Moist : public Variable { * @ingroup sensor_gplp8 */ /* clang-format on */ -class GroPointProfileGPLP8_Temp : public Variable { +class GroPointGPLP8_Temp : public Variable { public: /** - * @brief Construct a new GroPointProfileGPLP8_Temp object. + * @brief Construct a new GroPointGPLP8_Temp object. * - * @param parentSense The parent GroPointProfileGPLP8 providing the result + * @param parentSense The parent GroPointGPLP8 providing the result * values. * @param uuid A universally unique identifier (UUID or GUID) for the * variable; optional with the default value of an empty string. * @param varCode A short code to help identify the variable in files; * optional with a default value of "GPLP8Temp". */ - explicit GroPointProfileGPLP8_Temp(GroPointProfileGPLP8* parentSense, + explicit GroPointGPLP8_Temp(GroPointGPLP8* parentSense, const char* uuid = "", const char* varCode = GPLP8_TEMP_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)GPLP8_TEMP_VAR_NUM, (uint8_t)GPLP8_TEMP_RESOLUTION, GPLP8_TEMP_VAR_NAME, GPLP8_TEMP_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new GroPointProfileGPLP8_Temp object. + * @brief Construct a new GroPointGPLP8_Temp object. * - * @note This must be tied with a parent GroPointProfileGPLP8 before it can be + * @note This must be tied with a parent GroPointGPLP8 before it can be * used. */ - GroPointProfileGPLP8_Temp() + GroPointGPLP8_Temp() : Variable((const uint8_t)GPLP8_TEMP_VAR_NUM, (uint8_t)GPLP8_TEMP_RESOLUTION, GPLP8_TEMP_VAR_NAME, GPLP8_TEMP_UNIT_NAME, GPLP8_TEMP_DEFAULT_CODE) {} /** - * @brief Destroy the GroPointProfileGPLP8_Temp object - no action needed. + * @brief Destroy the GroPointGPLP8_Temp object - no action needed. */ - ~GroPointProfileGPLP8_Temp() {} + ~GroPointGPLP8_Temp() {} }; /**@}*/ -#endif // SRC_SENSORS_GROPOINTPROFILEGPLP8_H_ +#endif // SRC_SENSORS_GROPOINTGPLP8_H_ diff --git a/src/sensors/GroPointParent.cpp b/src/sensors/GroPointParent.cpp index 3bd836aa4..c230dc1b5 100644 --- a/src/sensors/GroPointParent.cpp +++ b/src/sensors/GroPointParent.cpp @@ -195,22 +195,21 @@ void GroPointParent::powerDown(void) { bool GroPointParent::addSingleMeasurementResult(void) { bool success = false; + // Initialize float variables + float valueM1 = -9999; + float valueM2 = -9999; + float valueM3 = -9999; + float valueM4 = -9999; + float valueM5 = -9999; + float valueM6 = -9999; + float valueM7 = -9999; + float valueM8 = -9999; // Check a measurement was *successfully* started (status bit 6 set) // Only go on to get a result if it was if (bitRead(_sensorStatus, 6)) { switch (_model) { case GPLP8: { - // Initialize float variables - float valueM1 = -9999; - float valueM2 = -9999; - float valueM3 = -9999; - float valueM4 = -9999; - float valueM5 = -9999; - float valueM6 = -9999; - float valueM7 = -9999; - float valueM8 = -9999; - // Get Values MS_DBG(F("Get Values from"), getSensorNameAndLocation()); success = _gsensor.getValues(valueM1, valueM2, valueM3, @@ -228,8 +227,9 @@ bool GroPointParent::addSingleMeasurementResult(void) { if (!success || isnan(valueM8)) valueM8 = -9999; MS_DBG(F(" "), _gsensor.getParameter()); - MS_DBG(F(" "), DOmgL, ',', Turbidity, ',', Cond, ',', pH, - ',', Temp, ',', ORP, ',', Chlorophyll, ',', BGA); + MS_DBG(F(" "), valueM1, ',', valueM2, ',', valueM3, ',', + valueM4, ',', valueM5, ',', valueM6, ',', valueM7, ',', + valueM8); // Put values into the array verifyAndAddMeasurementResult(0, valueM1); @@ -246,7 +246,6 @@ bool GroPointParent::addSingleMeasurementResult(void) { default: { // Get Values MS_DBG(F("Other GroPoint models not yet implemented.")); - } } } else { From fd02919205a4a91d6643fd3efa41381ea7c2a868 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:38:20 -0500 Subject: [PATCH 04/89] run clang-format on *.cpp and *.h --- src/VariableBase.cpp | 3 ++- src/sensors/YosemitechY700.h | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/VariableBase.cpp b/src/VariableBase.cpp index f330bf234..a557c267f 100644 --- a/src/VariableBase.cpp +++ b/src/VariableBase.cpp @@ -228,7 +228,8 @@ bool Variable::checkUUIDFormat(void) { int first_invalid = strspn(_uuid, acceptableChars); if (first_invalid != 36) { MS_DBG(F("UUID for"), getVarCode(), '(', _uuid, ')', - F("has a bad character"), _uuid[first_invalid], F("at"), first_invalid); + F("has a bad character"), _uuid[first_invalid], F("at"), + first_invalid); return false; } return true; diff --git a/src/sensors/YosemitechY700.h b/src/sensors/YosemitechY700.h index 6a146bac6..7db473937 100644 --- a/src/sensors/YosemitechY700.h +++ b/src/sensors/YosemitechY700.h @@ -70,11 +70,11 @@ /// 1000 ms. #define Y700_WARM_UP_TIME_MS 1000 /// @brief Sensor::_stabilizationTime_ms; time between "StartMeasurement" -/// command and stable reading - Y700 takes 4 s to get stability <1 mm, +/// command and stable reading - Y700 takes 4 s to get stability <1 mm, /// but 12 s for <0.1 mm. If highest precision is required, increase to 12000. #define Y700_STABILIZATION_TIME_MS 4000 /// @brief Sensor::_measurementTime_ms; the Y700 takes <1 s for new values. -/// but >1 s for values that don't seem autocorrelated. +/// but >1 s for values that don't seem autocorrelated. #define Y700_MEASUREMENT_TIME_MS 1000 /**@}*/ @@ -211,9 +211,9 @@ class YosemitechY700_Pressure : public Variable { * @param varCode A short code to help identify the variable in files; * optional with a default value of "Y700Pres". */ - explicit YosemitechY700_Pressure(YosemitechY700* parentSense, - const char* uuid = "", - const char* varCode = Y700_PRES_DEFAULT_CODE) + explicit YosemitechY700_Pressure( + YosemitechY700* parentSense, const char* uuid = "", + const char* varCode = Y700_PRES_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)Y700_PRES_VAR_NUM, (uint8_t)Y700_PRES_RESOLUTION, Y700_PRES_VAR_NAME, Y700_PRES_UNIT_NAME, varCode, uuid) {} From 55973fa77162409c65afe792b84404d33e9dd9f5 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 05/89] publishers: fix undefined behavior in response code processing Correctly initialize response code variable terminator. --- src/publishers/DreamHostPublisher.cpp | 1 + src/publishers/EnviroDIYPublisher.cpp | 1 + src/publishers/UbidotsPublisher.cpp | 1 + 3 files changed, 3 insertions(+) diff --git a/src/publishers/DreamHostPublisher.cpp b/src/publishers/DreamHostPublisher.cpp index fbfa07e7d..f3ae302f7 100644 --- a/src/publishers/DreamHostPublisher.cpp +++ b/src/publishers/DreamHostPublisher.cpp @@ -189,6 +189,7 @@ int16_t DreamHostPublisher::publishData(Client* outClient) { int16_t responseCode = 0; if (did_respond > 0) { char responseCode_char[4]; + responseCode_char[3] = 0; for (uint8_t i = 0; i < 3; i++) { responseCode_char[i] = tempBuffer[i + 9]; } diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index 5d017ea99..28ead3f78 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -260,6 +260,7 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { int16_t responseCode = 0; if (did_respond > 0) { char responseCode_char[4]; + responseCode_char[3] = 0; for (uint8_t i = 0; i < 3; i++) { responseCode_char[i] = tempBuffer[i + 9]; } diff --git a/src/publishers/UbidotsPublisher.cpp b/src/publishers/UbidotsPublisher.cpp index c840cdfcf..afd20a1e7 100644 --- a/src/publishers/UbidotsPublisher.cpp +++ b/src/publishers/UbidotsPublisher.cpp @@ -279,6 +279,7 @@ int16_t UbidotsPublisher::publishData(Client* outClient) { int16_t responseCode = 0; if (did_respond > 0) { char responseCode_char[4]; + responseCode_char[3] = 0; for (uint8_t i = 0; i < 3; i++) { responseCode_char[i] = tempBuffer[i + 9]; } From 507b3174929834e182b3dae43ed173351b789138 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 06/89] dataPublisherBase: remove redundant zero init of TX buffer Saves 750 bytes of flash as the buffer can be placed in .bss to be zero-initialized instead of .data. --- src/dataPublisherBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dataPublisherBase.cpp b/src/dataPublisherBase.cpp index 76e298b6c..e21c08285 100644 --- a/src/dataPublisherBase.cpp +++ b/src/dataPublisherBase.cpp @@ -10,7 +10,7 @@ */ #include "dataPublisherBase.h" -char dataPublisher::txBuffer[MS_SEND_BUFFER_SIZE] = {'\0'}; +char dataPublisher::txBuffer[MS_SEND_BUFFER_SIZE]; // Basic chunks of HTTP const char* dataPublisher::getHeader = "GET "; From 83b27ead472932b3ed8af229998c7eeca616ab76 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 07/89] LoggerBase: optimize setFileTimestamp Saves ~110 bytes of flash and substantial stack --- src/LoggerBase.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index c125f0180..6386c0380 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -1053,12 +1053,10 @@ bool Logger::initializeSDCard(void) { // Protected helper function - This sets a timestamp on a file void Logger::setFileTimestamp(File fileToStamp, uint8_t stampFlag) { - fileToStamp.timestamp(stampFlag, dtFromEpoch(getNowLocalEpoch()).year(), - dtFromEpoch(getNowLocalEpoch()).month(), - dtFromEpoch(getNowLocalEpoch()).date(), - dtFromEpoch(getNowLocalEpoch()).hour(), - dtFromEpoch(getNowLocalEpoch()).minute(), - dtFromEpoch(getNowLocalEpoch()).second()); + DateTime dt = dtFromEpoch(getNowLocalEpoch()); + + fileToStamp.timestamp(stampFlag, dt.year(), dt.month(), dt.date(), + dt.hour(), dt.minute(), dt.second()); } From f0d26374ec0f15f385b8ce4c1cfc8a8a4e57a35d Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 08/89] LoggerModem: optimize CSQ conversion functions Saves ~200 bytes of RAM and ~360 bytes of flash. The equations reproduce the tables previously found in the source code exactly. The reason for the values in the original tables is unknown. --- src/LoggerModem.cpp | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index b44fa8159..15ca08ba4 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -394,31 +394,16 @@ float loggerModem::getModemTemperature() { // Helper to get approximate RSSI from CSQ (assuming no noise) int16_t loggerModem::getRSSIFromCSQ(int16_t csq) { - int16_t CSQs[33] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 99}; - int16_t RSSIs[33] = {-113, -111, -109, -107, -105, -103, -101, -99, -97, - -95, -93, -91, -89, -87, -85, -83, -81, -79, - -77, -75, -73, -71, -69, -67, -65, -63, -61, - -59, -57, -55, -53, -51, 0}; - for (uint8_t i = 0; i < 33; i++) { - if (CSQs[i] == csq) return RSSIs[i]; - } - return 0; + if ((csq < 0) || (csq > 31)) return 0; + // equation matches previous table. not sure the original motivation. + return ((csq * 2) - 113); } // Helper to get signal percent from CSQ int16_t loggerModem::getPctFromCSQ(int16_t csq) { - int16_t CSQs[33] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 99}; - int16_t PCTs[33] = {0, 3, 6, 10, 13, 16, 19, 23, 26, 29, 32, - 36, 39, 42, 45, 48, 52, 55, 58, 61, 65, 68, - 71, 74, 78, 81, 84, 87, 90, 94, 97, 100, 0}; - for (uint8_t i = 0; i < 33; i++) { - if (CSQs[i] == csq) return PCTs[i]; - } - return 0; + if ((csq < 0) || (csq > 31)) return 0; + // equation matches previous table. not sure the original motivation. + return (csq * 827 + 127) >> 8; } // Helper to get signal percent from RSSI From 2692821e7faf30e6c904f44b174419bce6ceee9f Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 09/89] LoggerBase: always power down modem after RTC sync The test for "15 seconds before the next logging interval" has been wrong for years, possibly since this code was written, with no apparent consequence. The behavior is additionally confusing to users deploying the devices and causes problems with logging as the modem won't get turned off for a long time. Remove it completely to solve the problems. --- src/LoggerBase.cpp | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 6386c0380..0070e379b 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -305,25 +305,11 @@ bool Logger::syncRTC() { PRINTOUT(F("Could not wake modem for clock sync.")); } watchDogTimer.resetWatchDog(); - // Power down the modem - but only if there will be more than 15 seconds - // before the NEXT logging interval - it can take the modem that long to - // shut down - - uint32_t setupFinishTime = getNowLocalEpoch(); - if (setupFinishTime % (_loggingIntervalMinutes * 60) > 15) { - MS_DBG(F("At"), formatDateTime_ISO8601(setupFinishTime), F("with"), - setupFinishTime % (_loggingIntervalMinutes * 60), - F("seconds until next logging interval, putting modem to " - "sleep")); - _logModem->disconnectInternet(); - _logModem->modemSleepPowerDown(); - } else { - MS_DBG(F("At"), formatDateTime_ISO8601(setupFinishTime), - F("there are only"), - setupFinishTime % (_loggingIntervalMinutes * 60), - F("seconds until next logging interval; leaving modem on " - "and connected to the internet.")); - } + + // Power down the modem now that we are done with it + MS_DBG(F("Powering down modem after clock sync.")); + _logModem->disconnectInternet(); + _logModem->modemSleepPowerDown(); } watchDogTimer.resetWatchDog(); return success; From 389c16293a10237741db17d5aeeca77272fa89a3 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 10/89] publishers: remove unused functions --- src/publishers/DreamHostPublisher.cpp | 35 ----------------------- src/publishers/DreamHostPublisher.h | 21 -------------- src/publishers/EnviroDIYPublisher.cpp | 40 --------------------------- src/publishers/EnviroDIYPublisher.h | 34 +++-------------------- src/publishers/UbidotsPublisher.cpp | 40 --------------------------- src/publishers/UbidotsPublisher.h | 34 +++-------------------- 6 files changed, 8 insertions(+), 196 deletions(-) diff --git a/src/publishers/DreamHostPublisher.cpp b/src/publishers/DreamHostPublisher.cpp index f3ae302f7..b65c6caed 100644 --- a/src/publishers/DreamHostPublisher.cpp +++ b/src/publishers/DreamHostPublisher.cpp @@ -52,41 +52,6 @@ void DreamHostPublisher::setDreamHostPortalRX(const char* dhUrl) { } -// This prints the URL out to an Arduino stream -void DreamHostPublisher::printSensorDataDreamHost(Stream* stream) { - stream->print(_DreamHostPortalRX); - stream->print(loggerTag); - stream->print(_baseLogger->getLoggerID()); - stream->print(timestampTagDH); - stream->print(String(Logger::markedLocalEpochTime - - 946684800)); // Correct time from epoch to y2k - - for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { - stream->print('&'); - stream->print(_baseLogger->getVarCodeAtI(i)); - stream->print('='); - stream->print(_baseLogger->getValueStringAtI(i)); - } -} - - -// This prints a fully structured GET request for DreamHost to the -// specified stream -void DreamHostPublisher::printDreamHostRequest(Stream* stream) { - // Start the request - stream->print(getHeader); - - // Stream the full URL with parameters - printSensorDataDreamHost(stream); - - // Send the rest of the HTTP header - stream->print(HTTPtag); - stream->print(hostHeader); - stream->print(dreamhostHost); - stream->print(F("\r\n\r\n")); -} - - // A way to begin with everything already set void DreamHostPublisher::begin(Logger& baseLogger, Client* inClient, const char* dhUrl) { diff --git a/src/publishers/DreamHostPublisher.h b/src/publishers/DreamHostPublisher.h index 6a7fe1a46..584be2142 100644 --- a/src/publishers/DreamHostPublisher.h +++ b/src/publishers/DreamHostPublisher.h @@ -133,26 +133,6 @@ class DreamHostPublisher : public dataPublisher { */ void setDreamHostPortalRX(const char* dhUrl); - /** - * @brief This creates all of the URL parameter tags and values and writes - * the result to an Arduino stream. - * - * HTML headers are not included. - * - * @param stream The Arduino stream to write out the URL and parameters to. - */ - void printSensorDataDreamHost(Stream* stream); - - /** - * @brief This prints a fully structured GET request for DreamHost to the - * specified stream. - * - * This includes the HTML headers. - * - * @param stream The Arduino stream to write out the URL and parameters to. - */ - void printDreamHostRequest(Stream* stream); - // A way to begin with everything already set /** * @copydoc dataPublisher::begin(Logger& baseLogger, Client* inClient) @@ -165,7 +145,6 @@ class DreamHostPublisher : public dataPublisher { */ void begin(Logger& baseLogger, const char* dhUrl); - // int16_t postDataDreamHost(void); /** * @brief Utilizes an attached modem to make a TCP connection to the * DreamHost URL and then stream out a get request over that connection. diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index 28ead3f78..b27516106 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -83,45 +83,6 @@ uint16_t EnviroDIYPublisher::calculateJsonSize() { return jsonLength; } -// This prints a properly formatted JSON for EnviroDIY to an Arduino stream -void EnviroDIYPublisher::printSensorDataJSON(Stream* stream) { - stream->print(samplingFeatureTag); - stream->print(_baseLogger->getSamplingFeatureUUID()); - stream->print(timestampTag); - stream->print(Logger::formatDateTime_ISO8601(Logger::markedLocalEpochTime)); - stream->print(F("\",")); - - for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { - stream->print('"'); - stream->print(_baseLogger->getVarUUIDAtI(i)); - stream->print(F("\":")); - stream->print(_baseLogger->getValueStringAtI(i)); - if (i + 1 != _baseLogger->getArrayVarCount()) { stream->print(','); } - } - - stream->print('}'); -} - - -// This prints a fully structured post request for EnviroDIY to the -// specified stream. -void EnviroDIYPublisher::printEnviroDIYRequest(Stream* stream) { - // Stream the HTTP headers for the post request - stream->print(postHeader); - stream->print(postEndpoint); - stream->print(HTTPtag); - stream->print(hostHeader); - stream->print(enviroDIYHost); - stream->print(tokenHeader); - stream->print(_registrationToken); - stream->print(contentLengthHeader); - stream->print(calculateJsonSize()); - stream->print(contentTypeHeader); - - // Stream the JSON itself - printSensorDataJSON(stream); -} - // A way to begin with everything already set void EnviroDIYPublisher::begin(Logger& baseLogger, Client* inClient, @@ -144,7 +105,6 @@ void EnviroDIYPublisher::begin(Logger& baseLogger, // EnviroDIY/ODM2DataSharingPortal and then streams out a post request // over that connection. // The return is the http status code of the response. -// int16_t EnviroDIYPublisher::postDataEnviroDIY(void) int16_t EnviroDIYPublisher::publishData(Client* outClient) { // Create a buffer for the portions of the request and response char tempBuffer[37] = ""; diff --git a/src/publishers/EnviroDIYPublisher.h b/src/publishers/EnviroDIYPublisher.h index 8a728dd1d..145860908 100644 --- a/src/publishers/EnviroDIYPublisher.h +++ b/src/publishers/EnviroDIYPublisher.h @@ -149,30 +149,7 @@ class EnviroDIYPublisher : public dataPublisher { * @return uint16_t The number of characters in the JSON object. */ uint16_t calculateJsonSize(); - // /** - // * @brief Calculates how long the full post request will be, including - // * headers - // * - // * @return uint16_t The length of the full request including HTTP - // headers. - // */ - // uint16_t calculatePostSize(); - /** - * @brief This generates a properly formatted JSON for EnviroDIY and prints - * it to the input Arduino stream object. - * - * @param stream The Arduino stream to write out the JSON to. - */ - void printSensorDataJSON(Stream* stream); - - /** - * @brief This prints a fully structured post request for Monitor My - * Watershed/EnviroDIY to the specified stream. - * - * @param stream The Arduino stream to write out the request to. - */ - void printEnviroDIYRequest(Stream* stream); // A way to begin with everything already set /** @@ -194,7 +171,6 @@ class EnviroDIYPublisher : public dataPublisher { void begin(Logger& baseLogger, const char* registrationToken, const char* samplingFeatureUUID); - // int16_t postDataEnviroDIY(void); /** * @brief Utilize an attached modem to open a a TCP connection to the * EnviroDIY/ODM2DataSharingPortal and then stream out a post request over @@ -217,12 +193,10 @@ class EnviroDIYPublisher : public dataPublisher { * * @{ */ - static const char* postEndpoint; ///< The endpoint - static const char* enviroDIYHost; ///< The host name - static const int enviroDIYPort; ///< The host port - static const char* tokenHeader; ///< The token header text - // static const char *cacheHeader; ///< The cache header text - // static const char *connectionHeader; ///< The keep alive header text + static const char* postEndpoint; ///< The endpoint + static const char* enviroDIYHost; ///< The host name + static const int enviroDIYPort; ///< The host port + static const char* tokenHeader; ///< The token header text static const char* contentLengthHeader; ///< The content length header text static const char* contentTypeHeader; ///< The content type header text /**@}*/ diff --git a/src/publishers/UbidotsPublisher.cpp b/src/publishers/UbidotsPublisher.cpp index afd20a1e7..55f4f5227 100644 --- a/src/publishers/UbidotsPublisher.cpp +++ b/src/publishers/UbidotsPublisher.cpp @@ -93,46 +93,6 @@ uint16_t UbidotsPublisher::calculateJsonSize() { } -// This prints a properly formatted JSON for EnviroDIY to an Arduino stream -void UbidotsPublisher::printSensorDataJSON(Stream* stream) { - stream->print(payload); - - for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { - stream->print('"'); - stream->print(_baseLogger->getVarUUIDAtI(i)); - stream->print(F("\":{'value':")); - stream->print(_baseLogger->getValueStringAtI(i)); - stream->print(",'timestamp':"); - stream->print(Logger::markedUTCEpochTime); - stream->print( - F("000}")); // Convert microseconds to milliseconds for ubidots - if (i + 1 != _baseLogger->getArrayVarCount()) { stream->print(','); } - } - - stream->print(F("}}")); -} - - -// This prints a fully structured post request for Ubidots to the -// specified stream. -void UbidotsPublisher::printUbidotsRequest(Stream* stream) { - // Stream the HTTP headers for the post request - stream->print(postHeader); - stream->print(postEndpoint); - stream->print(HTTPtag); - stream->print(hostHeader); - stream->print(ubidotsHost); - stream->print(tokenHeader); - stream->print(_authentificationToken); - stream->print(contentLengthHeader); - stream->print(calculateJsonSize()); - stream->print(contentTypeHeader); - - // Stream the JSON itself - printSensorDataJSON(stream); -} - - // A way to begin with everything already set void UbidotsPublisher::begin(Logger& baseLogger, Client* inClient, const char* authentificationToken, diff --git a/src/publishers/UbidotsPublisher.h b/src/publishers/UbidotsPublisher.h index adb47f9e2..1562890c6 100644 --- a/src/publishers/UbidotsPublisher.h +++ b/src/publishers/UbidotsPublisher.h @@ -153,30 +153,6 @@ class UbidotsPublisher : public dataPublisher { * @return uint16_t The number of characters in the JSON object. */ uint16_t calculateJsonSize(); - // /** - // * @brief Calculates how long the full post request will be, including - // * headers - // * - // * @return uint16_t The length of the full request including HTTP - // headers. - // */ - // uint16_t calculatePostSize(); - - /** - * @brief This generates a properly formatted JSON for Ubidots and prints - * it to the input Arduino stream object. - * - * @param stream The Arduino stream to write out the JSON to. - */ - void printSensorDataJSON(Stream* stream); - - /** - * @brief This prints a fully structured post request for the Ubidots API - * to the specified stream. - * - * @param stream The Arduino stream to write out the request to. - */ - void printUbidotsRequest(Stream* stream); // A way to begin with everything already set /** @@ -225,12 +201,10 @@ class UbidotsPublisher : public dataPublisher { * * @{ */ - static const char* postEndpoint; ///< The endpoint - static const char* ubidotsHost; ///< The host name - static const int ubidotsPort; ///< The host port - static const char* tokenHeader; ///< The token header text - // static const char *cacheHeader; ///< The cache header text - // static const char *connectionHeader; ///< The keep alive header text + static const char* postEndpoint; ///< The endpoint + static const char* ubidotsHost; ///< The host name + static const int ubidotsPort; ///< The host port + static const char* tokenHeader; ///< The token header text static const char* contentLengthHeader; ///< The content length header text static const char* contentTypeHeader; ///< The content type header text /**@}*/ From 493215d0693daec6e634daf8643b28d2dbe8ffa9 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 11/89] publishers: refactor transmit buffer usage Use cleaner interface and common functions that avoid repeated snprintf and strlen usage to save ~2.5KB of flash and dozens of lines of code. Removes extra \r\n from HTTP requests as a side effect, which were against spec and caused spurious 400 Bad Request status messages from servers. --- src/dataPublisherBase.cpp | 52 +++++++++----- src/dataPublisherBase.h | 54 +++++++++----- src/publishers/DreamHostPublisher.cpp | 64 ++++++----------- src/publishers/EnviroDIYPublisher.cpp | 94 ++++++++---------------- src/publishers/ThingSpeakPublisher.cpp | 26 +++---- src/publishers/UbidotsPublisher.cpp | 99 +++++++------------------- 6 files changed, 159 insertions(+), 230 deletions(-) diff --git a/src/dataPublisherBase.cpp b/src/dataPublisherBase.cpp index e21c08285..6075d9bae 100644 --- a/src/dataPublisherBase.cpp +++ b/src/dataPublisherBase.cpp @@ -10,7 +10,9 @@ */ #include "dataPublisherBase.h" -char dataPublisher::txBuffer[MS_SEND_BUFFER_SIZE]; +char dataPublisher::txBuffer[MS_SEND_BUFFER_SIZE]; +Client* dataPublisher::txBufferOutClient = nullptr; +size_t dataPublisher::txBufferLen; // Basic chunks of HTTP const char* dataPublisher::getHeader = "GET "; @@ -71,34 +73,46 @@ void dataPublisher::begin(Logger& baseLogger) { } -// Empties the outgoing buffer -void dataPublisher::emptyTxBuffer(void) { - MS_DBG(F("Dumping the TX Buffer")); - for (int i = 0; i < MS_SEND_BUFFER_SIZE; i++) { txBuffer[i] = '\0'; } +void dataPublisher::txBufferInit(Client* outClient) { + // remember client we are sending to + txBufferOutClient = outClient; + + // reset buffer length to be empty + txBufferLen = 0; } +void dataPublisher::txBufferAppend(const char* data, size_t length) { + while (length > 0) { + size_t remaining = MS_SEND_BUFFER_SIZE - txBufferLen; + size_t amount = remaining < length ? remaining : length; + + memcpy(&txBuffer[txBufferLen], data, amount); + length -= amount; + data += amount; + txBufferLen += amount; + + if (txBufferLen == MS_SEND_BUFFER_SIZE) { txBufferFlush(); } + } +} -// Returns how much space is left in the buffer -int dataPublisher::bufferFree(void) { - MS_DBG(F("Current TX Buffer Size:"), strlen(txBuffer)); - return MS_SEND_BUFFER_SIZE - strlen(txBuffer); +void dataPublisher::txBufferAppend(const char* s) { + txBufferAppend(s, strlen(s)); } +void dataPublisher::txBufferAppend(char c) { + txBufferAppend(&c, 1); +} -// Sends the tx buffer to a stream and then clears it -void dataPublisher::printTxBuffer(Stream* stream, bool addNewLine) { -// Send the out buffer so far to the serial for debugging +void dataPublisher::txBufferFlush() { #if defined(STANDARD_SERIAL_OUTPUT) - STANDARD_SERIAL_OUTPUT.write(txBuffer, strlen(txBuffer)); - if (addNewLine) { PRINTOUT('\n'); } + // send to debugging stream + STANDARD_SERIAL_OUTPUT.write((const uint8_t*)txBuffer, txBufferLen); STANDARD_SERIAL_OUTPUT.flush(); #endif - stream->write(txBuffer, strlen(txBuffer)); - if (addNewLine) { stream->print("\r\n"); } - stream->flush(); + txBufferOutClient->write((const uint8_t*)txBuffer, txBufferLen); + txBufferOutClient->flush(); - // empty the buffer after printing it - emptyTxBuffer(); + txBufferLen = 0; } diff --git a/src/dataPublisherBase.h b/src/dataPublisherBase.h index d43ba5dde..91b4f9060 100644 --- a/src/dataPublisherBase.h +++ b/src/dataPublisherBase.h @@ -32,11 +32,10 @@ * @def MS_SEND_BUFFER_SIZE * @brief Send Buffer * - * This determines how many characters to set out at once over the TCP/UDP - * connection. Increasing this may decrease data use by a loger, while - * decreasing it will save memory. Do not make it smaller than 47 (to keep all - * variable values with their UUID's) or bigger than 1500 (a typical TCP/UDP - * Maximum Transmission Unit). + * This determines how many characters to set out at once over the TCP + * connection. Increasing this may decrease data use by a logger, while + * decreasing it will save memory. Do not make it smaller than 32 or bigger + * than 1500 (a typical TCP Maximum Transmission Unit). * * This can be changed by setting the build flag MS_SEND_BUFFER_SIZE when * compiling. @@ -280,29 +279,48 @@ class dataPublisher { Client* _inClient = nullptr; /** - * @brief A buffer for outgoing data. + * @brief The buffer for outgoing data. */ static char txBuffer[MS_SEND_BUFFER_SIZE]; /** - * @brief Get the number of empty spots in the buffer. + * @brief The pointer to the client instance the TX buffer is writing to. + */ + static Client* txBufferOutClient; + /** + * @brief The number of used characters in the TX buffer. + */ + static size_t txBufferLen; + /** + * @brief Initialize the TX buffer to be empty and start writing to the + * given client. + * + * @param client The client to transmit to. + */ + static void txBufferInit(Client* outClient); + /** + * @brief Append the given data to the TX buffer, flushing if necessary. * - * @return **int** The number of available characters in the buffer + * @param data The data start pointer. + * @param length The number of bytes to add. */ - static int bufferFree(void); + static void txBufferAppend(const char* data, size_t length); /** - * @brief Fill the TX buffer with nulls ('\0'). + * @brief Append the given string to the TX buffer, flushing if necessary. + * + * @param s The null-terminated string to append. */ - static void emptyTxBuffer(void); + static void txBufferAppend(const char* s); /** - * @brief Write the TX buffer to a stream and also to the debugging - * port. + * @brief Append the given char to the TX buffer, flushing if necessary. * - * @param stream A pointer to an Arduino Stream instance to use to print - * data - * @param addNewLine True to add a new line character ("\n") at the end of - * the print + * @param c The char to append. + */ + static void txBufferAppend(char c); + /** + * @brief Write the TX buffer contents to the initialized stream and also to + * the debugging port. */ - static void printTxBuffer(Stream* stream, bool addNewLine = false); + static void txBufferFlush(); /** * @brief Unimplemented; intended for future use to enable caching and bulk diff --git a/src/publishers/DreamHostPublisher.cpp b/src/publishers/DreamHostPublisher.cpp index b65c6caed..5c3db12f6 100644 --- a/src/publishers/DreamHostPublisher.cpp +++ b/src/publishers/DreamHostPublisher.cpp @@ -76,59 +76,41 @@ int16_t DreamHostPublisher::publishData(Client* outClient) { MS_START_DEBUG_TIMER; if (outClient->connect(dreamhostHost, dreamhostPort)) { MS_DBG(F("Client connected after"), MS_PRINT_DEBUG_TIMER, F("ms\n")); + txBufferInit(outClient); // copy the initial post header into the tx buffer - snprintf(txBuffer, sizeof(txBuffer), "%s", getHeader); + txBufferAppend(getHeader); // add in the dreamhost receiver URL - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", _DreamHostPortalRX); + txBufferAppend(_DreamHostPortalRX); // start the URL parameters - if (bufferFree() < 16) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", loggerTag); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", - _baseLogger->getLoggerID()); - - if (bufferFree() < 22) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", timestampTagDH); + txBufferAppend(loggerTag); + txBufferAppend(_baseLogger->getLoggerID()); + + txBufferAppend(timestampTagDH); ltoa((Logger::markedLocalEpochTime - 946684800), tempBuffer, 10); // BASE 10 - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); + txBufferAppend(tempBuffer); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { - // Once the buffer fills, send it out - if (bufferFree() < 47) printTxBuffer(outClient); - - txBuffer[strlen(txBuffer)] = '&'; - _baseLogger->getVarCodeAtI(i).toCharArray(tempBuffer, 37); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - txBuffer[strlen(txBuffer)] = '='; - _baseLogger->getValueStringAtI(i).toCharArray(tempBuffer, 37); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); + txBufferAppend('&'); + txBufferAppend(_baseLogger->getVarCodeAtI(i).c_str()); + txBufferAppend('='); + txBufferAppend(_baseLogger->getValueStringAtI(i).c_str()); } // add the rest of the HTTP GET headers to the outgoing buffer - if (bufferFree() < 52) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", HTTPtag); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", hostHeader); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", dreamhostHost); - txBuffer[strlen(txBuffer)] = '\r'; - txBuffer[strlen(txBuffer)] = '\n'; - txBuffer[strlen(txBuffer)] = '\r'; - txBuffer[strlen(txBuffer)] = '\n'; - - // Send out the finished request (or the last unsent section of it) - printTxBuffer(outClient); + txBufferAppend(HTTPtag); + txBufferAppend(hostHeader); + txBufferAppend(dreamhostHost); + txBufferAppend('\r'); + txBufferAppend('\n'); + txBufferAppend('\r'); + txBufferAppend('\n'); + + // Flush the complete request + txBufferFlush(); // Wait 10 seconds for a response from the server uint32_t start = millis(); @@ -163,7 +145,7 @@ int16_t DreamHostPublisher::publishData(Client* outClient) { responseCode = 504; } - PRINTOUT(F("-- Response Code --")); + PRINTOUT(F("\n-- Response Code --")); PRINTOUT(responseCode); return responseCode; diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index b27516106..4c8b7455a 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -117,83 +117,51 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { MS_START_DEBUG_TIMER; if (outClient->connect(enviroDIYHost, enviroDIYPort)) { MS_DBG(F("Client connected after"), MS_PRINT_DEBUG_TIMER, F("ms\n")); + txBufferInit(outClient); // copy the initial post header into the tx buffer - snprintf(txBuffer, sizeof(txBuffer), "%s", postHeader); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", postEndpoint); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", HTTPtag); + txBufferAppend(postHeader); + txBufferAppend(postEndpoint); + txBufferAppend(HTTPtag); // add the rest of the HTTP POST headers to the outgoing buffer - // before adding each line/chunk to the outgoing buffer, we make sure - // there is space for that line, sending out buffer if not - if (bufferFree() < 28) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", hostHeader); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", enviroDIYHost); - - if (bufferFree() < 47) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tokenHeader); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", _registrationToken); - - if (bufferFree() < 26) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", - contentLengthHeader); + txBufferAppend(hostHeader); + txBufferAppend(enviroDIYHost); + txBufferAppend(tokenHeader); + txBufferAppend(_registrationToken); + + txBufferAppend(contentLengthHeader); itoa(calculateJsonSize(), tempBuffer, 10); // BASE 10 - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); + txBufferAppend(tempBuffer); - if (bufferFree() < 42) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", contentTypeHeader); + txBufferAppend(contentTypeHeader); // put the start of the JSON into the outgoing response_buffer - if (bufferFree() < 21) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", samplingFeatureTag); - - if (bufferFree() < 36) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", - _baseLogger->getSamplingFeatureUUID()); - - if (bufferFree() < 42) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", timestampTag); - Logger::formatDateTime_ISO8601(Logger::markedLocalEpochTime) - .toCharArray(tempBuffer, 37); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - txBuffer[strlen(txBuffer)] = '"'; - txBuffer[strlen(txBuffer)] = ','; + txBufferAppend(samplingFeatureTag); + txBufferAppend(_baseLogger->getSamplingFeatureUUID()); + + txBufferAppend(timestampTag); + txBufferAppend( + Logger::formatDateTime_ISO8601(Logger::markedLocalEpochTime) + .c_str()); + txBufferAppend('"'); + txBufferAppend(','); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { - // Once the buffer fills, send it out - if (bufferFree() < 47) printTxBuffer(outClient); - - txBuffer[strlen(txBuffer)] = '"'; - _baseLogger->getVarUUIDAtI(i).toCharArray(tempBuffer, 37); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - txBuffer[strlen(txBuffer)] = '"'; - txBuffer[strlen(txBuffer)] = ':'; - _baseLogger->getValueStringAtI(i).toCharArray(tempBuffer, 37); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); + txBufferAppend('"'); + txBufferAppend(_baseLogger->getVarUUIDAtI(i).c_str()); + txBufferAppend('"'); + txBufferAppend(':'); + txBufferAppend(_baseLogger->getValueStringAtI(i).c_str()); if (i + 1 != _baseLogger->getArrayVarCount()) { - txBuffer[strlen(txBuffer)] = ','; + txBufferAppend(','); } else { - txBuffer[strlen(txBuffer)] = '}'; + txBufferAppend('}'); } } - // Send out the finished request (or the last unsent section of it) - printTxBuffer(outClient, true); + // Flush the complete request + txBufferFlush(); // Wait 10 seconds for a response from the server uint32_t start = millis(); @@ -229,7 +197,7 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { responseCode = 504; } - PRINTOUT(F("-- Response Code --")); + PRINTOUT(F("\n-- Response Code --")); PRINTOUT(responseCode); return responseCode; diff --git a/src/publishers/ThingSpeakPublisher.cpp b/src/publishers/ThingSpeakPublisher.cpp index e1b0e3a7f..f65d8e23f 100644 --- a/src/publishers/ThingSpeakPublisher.cpp +++ b/src/publishers/ThingSpeakPublisher.cpp @@ -129,27 +129,19 @@ int16_t ThingSpeakPublisher::publishData(Client* outClient) { _thingSpeakChannelKey); MS_DBG(F("Topic ["), strlen(topicBuffer), F("]:"), String(topicBuffer)); - emptyTxBuffer(); + // buffer is used only locally, it does not transmit + txBufferInit(nullptr); - Logger::formatDateTime_ISO8601(Logger::markedLocalEpochTime) - .toCharArray(tempBuffer, 26); - snprintf(txBuffer + strlen(txBuffer), sizeof(txBuffer) - strlen(txBuffer), - "%s", "created_at="); - snprintf(txBuffer + strlen(txBuffer), sizeof(txBuffer) - strlen(txBuffer), - "%s", tempBuffer); - txBuffer[strlen(txBuffer)] = '&'; + txBufferAppend("created_at="); + txBufferAppend( + Logger::formatDateTime_ISO8601(Logger::markedLocalEpochTime).c_str()); for (uint8_t i = 0; i < numChannels; i++) { - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", "field"); + txBufferAppend("&field"); itoa(i + 1, tempBuffer, 10); // BASE 10 - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - txBuffer[strlen(txBuffer)] = '='; - _baseLogger->getValueStringAtI(i).toCharArray(tempBuffer, 26); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - if (i + 1 != numChannels) { txBuffer[strlen(txBuffer)] = '&'; } + txBufferAppend(tempBuffer); + txBufferAppend('='); + txBufferAppend(_baseLogger->getValueStringAtI(i).c_str()); } MS_DBG(F("Message ["), strlen(txBuffer), F("]:"), String(txBuffer)); diff --git a/src/publishers/UbidotsPublisher.cpp b/src/publishers/UbidotsPublisher.cpp index 55f4f5227..c1e781d62 100644 --- a/src/publishers/UbidotsPublisher.cpp +++ b/src/publishers/UbidotsPublisher.cpp @@ -127,93 +127,48 @@ int16_t UbidotsPublisher::publishData(Client* outClient) { MS_START_DEBUG_TIMER; if (outClient->connect(ubidotsHost, ubidotsPort)) { MS_DBG(F("Client connected after"), MS_PRINT_DEBUG_TIMER, F("ms\n")); + txBufferInit(outClient); // copy the initial post header into the tx buffer - snprintf(txBuffer, sizeof(txBuffer), "%s", postHeader); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", postEndpoint); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", - _baseLogger->getSamplingFeatureUUID()); - txBuffer[strlen(txBuffer)] = '/'; - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", HTTPtag); + txBufferAppend(postHeader); + txBufferAppend(postEndpoint); + txBufferAppend(_baseLogger->getSamplingFeatureUUID()); + txBufferAppend('/'); + txBufferAppend(HTTPtag); // add the rest of the HTTP POST headers to the outgoing buffer - // before adding each line/chunk to the outgoing buffer, we make sure - // there is space for that line, sending out buffer if not - if (bufferFree() < 28) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", hostHeader); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", ubidotsHost); - - if (bufferFree() < 47) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tokenHeader); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", - _authentificationToken); - - if (bufferFree() < 26) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", - contentLengthHeader); + txBufferAppend(hostHeader); + txBufferAppend(ubidotsHost); + txBufferAppend(tokenHeader); + txBufferAppend(_authentificationToken); + + txBufferAppend(contentLengthHeader); itoa(calculateJsonSize(), tempBuffer, 10); // BASE 10 - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); + txBufferAppend(tempBuffer); - if (bufferFree() < 42) printTxBuffer(outClient); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", contentTypeHeader); + txBufferAppend(contentTypeHeader); // put the start of the JSON into the outgoing response_buffer - if (bufferFree() < 21) printTxBuffer(outClient); - - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", payload); + txBufferAppend(payload); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { - // Once the buffer fills, send it out - if (bufferFree() < 47) printTxBuffer(outClient); - - txBuffer[strlen(txBuffer)] = '"'; - _baseLogger->getVarUUIDAtI(i).toCharArray(tempBuffer, 37); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - txBuffer[strlen(txBuffer)] = '"'; - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", ":{"); - txBuffer[strlen(txBuffer)] = '"'; - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", "value"); - txBuffer[strlen(txBuffer)] = '"'; - txBuffer[strlen(txBuffer)] = ':'; - _baseLogger->getValueStringAtI(i).toCharArray(tempBuffer, 37); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - txBuffer[strlen(txBuffer)] = ','; - txBuffer[strlen(txBuffer)] = '"'; - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", "timestamp"); - txBuffer[strlen(txBuffer)] = '"'; - txBuffer[strlen(txBuffer)] = ':'; + txBufferAppend('"'); + txBufferAppend(_baseLogger->getVarUUIDAtI(i).c_str()); + txBufferAppend("\":{\"value\":"); + txBufferAppend(_baseLogger->getValueStringAtI(i).c_str()); + txBufferAppend(",\"timestamp\":"); ltoa(Logger::markedUTCEpochTime, tempBuffer, 10); // BASE 10 - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", tempBuffer); - snprintf(txBuffer + strlen(txBuffer), - sizeof(txBuffer) - strlen(txBuffer), "%s", "000"); + txBufferAppend(tempBuffer); + txBufferAppend("000}"); if (i + 1 != _baseLogger->getArrayVarCount()) { - txBuffer[strlen(txBuffer)] = '}'; - txBuffer[strlen(txBuffer)] = ','; + txBufferAppend(','); } else { - txBuffer[strlen(txBuffer)] = '}'; - txBuffer[strlen(txBuffer)] = '}'; + txBufferAppend('}'); } } - // Send out the finished request (or the last unsent section of it) - printTxBuffer(outClient, true); + // Flush the complete request + txBufferFlush(); // Wait 10 seconds for a response from the server uint32_t start = millis(); @@ -248,7 +203,7 @@ int16_t UbidotsPublisher::publishData(Client* outClient) { responseCode = 504; } - PRINTOUT(F("-- Response Code --")); + PRINTOUT(F("\n-- Response Code --")); PRINTOUT(responseCode); return responseCode; From 2c87ff0e68fac51d231e0c0f658d0ff958fd9967 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 12/89] dataPublisherBase: widen sendEveryX and ditch sendOffset sendEveryX will be used in the future for data buffering functionality. Increase its width to an int to allow larger buffers when desired. Delete sendOffset completely as there is little reason for that particular functionality. The offset will be in effect set randomly using the time the datalogger initially powers on. --- src/dataPublisherBase.cpp | 18 ++++------ src/dataPublisherBase.h | 46 ++++++++------------------ src/publishers/DreamHostPublisher.cpp | 18 +++++----- src/publishers/DreamHostPublisher.h | 37 +++++++-------------- src/publishers/EnviroDIYPublisher.cpp | 17 +++++----- src/publishers/EnviroDIYPublisher.h | 39 +++++++--------------- src/publishers/ThingSpeakPublisher.cpp | 17 +++++----- src/publishers/ThingSpeakPublisher.h | 38 +++++++-------------- src/publishers/UbidotsPublisher.cpp | 19 +++++------ src/publishers/UbidotsPublisher.h | 39 +++++++--------------- 10 files changed, 101 insertions(+), 187 deletions(-) diff --git a/src/dataPublisherBase.cpp b/src/dataPublisherBase.cpp index 6075d9bae..1f4ab0a51 100644 --- a/src/dataPublisherBase.cpp +++ b/src/dataPublisherBase.cpp @@ -23,19 +23,16 @@ const char* dataPublisher::hostHeader = "\r\nHost: "; // Constructors dataPublisher::dataPublisher() {} -dataPublisher::dataPublisher(Logger& baseLogger, uint8_t sendEveryX, - uint8_t sendOffset) +dataPublisher::dataPublisher(Logger& baseLogger, int sendEveryX) : _baseLogger(&baseLogger), - _sendEveryX(sendEveryX), - _sendOffset(sendOffset) { + _sendEveryX(sendEveryX) { _baseLogger->registerDataPublisher(this); // register self with logger } dataPublisher::dataPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX, uint8_t sendOffset) + int sendEveryX) : _baseLogger(&baseLogger), _inClient(inClient), - _sendEveryX(sendEveryX), - _sendOffset(sendOffset) { + _sendEveryX(sendEveryX) { _baseLogger->registerDataPublisher(this); // register self with logger } // Destructor @@ -55,11 +52,10 @@ void dataPublisher::attachToLogger(Logger& baseLogger) { } -// Sets the parameters for frequency of sending and any offset, if needed -// NOTE: These parameters are not currently used!! -void dataPublisher::setSendFrequency(uint8_t sendEveryX, uint8_t sendOffset) { +// Sets the interval (in units of the logging interval) between attempted +// data transmissions +void dataPublisher::setSendInterval(int sendEveryX) { _sendEveryX = sendEveryX; - _sendOffset = sendOffset; } diff --git a/src/dataPublisherBase.h b/src/dataPublisherBase.h index 91b4f9060..1f24430f9 100644 --- a/src/dataPublisherBase.h +++ b/src/dataPublisherBase.h @@ -85,11 +85,8 @@ class dataPublisher { * logger. * * @param baseLogger The logger supplying the data to be published - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. Not respected by all publishers. * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -97,8 +94,7 @@ class dataPublisher { * issue, use the null constructor and a populated begin(...) within your * set-up function. */ - explicit dataPublisher(Logger& baseLogger, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + explicit dataPublisher(Logger& baseLogger, int sendEveryX = 1); /** * @brief Construct a new data Publisher object. * @@ -106,11 +102,8 @@ class dataPublisher { * @param inClient An Arduino client instance to use to print data to. * Allows the use of any type of client and multiple clients tied to a * single TinyGSM modem instance - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. Not respected by all publishers. * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -118,8 +111,7 @@ class dataPublisher { * issue, use the null constructor and a populated begin(...) within your * set-up function. */ - dataPublisher(Logger& baseLogger, Client* inClient, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + dataPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1); /** * @brief Destroy the data Publisher object - no action is taken. */ @@ -144,18 +136,13 @@ class dataPublisher { */ void attachToLogger(Logger& baseLogger); /** - * @brief Set the parameters for frequency of sending and any offset, if - * needed. + * @brief Sets the interval (in units of the logging interval) between + * attempted data transmissions * - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected - * - * @note These parameters are not currently used! + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. Not respected by all publishers. */ - void setSendFrequency(uint8_t sendEveryX, uint8_t sendOffset); + void setSendInterval(int sendEveryX); /** * @brief Begin the publisher - linking it to the client and logger. @@ -323,15 +310,10 @@ class dataPublisher { static void txBufferFlush(); /** - * @brief Unimplemented; intended for future use to enable caching and bulk - * publishing. - */ - uint8_t _sendEveryX = 1; - /** - * @brief Unimplemented; intended for future use to enable publishing data - * at a time slightly delayed from when it is collected. + * @brief Interval (in units of the logging interval) between + * attempted data transmissions. Not respected by all publishers. */ - uint8_t _sendOffset = 0; + int _sendEveryX = 1; // Basic chunks of HTTP /** diff --git a/src/publishers/DreamHostPublisher.cpp b/src/publishers/DreamHostPublisher.cpp index 5c3db12f6..74412523e 100644 --- a/src/publishers/DreamHostPublisher.cpp +++ b/src/publishers/DreamHostPublisher.cpp @@ -23,23 +23,21 @@ const char* DreamHostPublisher::timestampTagDH = "&Loggertime="; // Constructors DreamHostPublisher::DreamHostPublisher() : dataPublisher() {} -DreamHostPublisher::DreamHostPublisher(Logger& baseLogger, uint8_t sendEveryX, - uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) {} +DreamHostPublisher::DreamHostPublisher(Logger& baseLogger, int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) {} DreamHostPublisher::DreamHostPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) {} + int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) {} DreamHostPublisher::DreamHostPublisher(Logger& baseLogger, const char* dhUrl, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) { + int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) { setDreamHostPortalRX(dhUrl); } DreamHostPublisher::DreamHostPublisher(Logger& baseLogger, Client* inClient, - const char* dhUrl, uint8_t sendEveryX, - uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { + const char* dhUrl, int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) { setDreamHostPortalRX(dhUrl); } // Destructor diff --git a/src/publishers/DreamHostPublisher.h b/src/publishers/DreamHostPublisher.h index 584be2142..e7a8a6fb6 100644 --- a/src/publishers/DreamHostPublisher.h +++ b/src/publishers/DreamHostPublisher.h @@ -51,11 +51,8 @@ class DreamHostPublisher : public dataPublisher { * logger. * * @param baseLogger The logger supplying the data to be published - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -63,8 +60,7 @@ class DreamHostPublisher : public dataPublisher { * issue, use the null constructor and a populated begin(...) within your * set-up function. */ - explicit DreamHostPublisher(Logger& baseLogger, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + explicit DreamHostPublisher(Logger& baseLogger, int sendEveryX = 1); /** * @brief Construct a new DreamHost Publisher object * @@ -72,11 +68,8 @@ class DreamHostPublisher : public dataPublisher { * @param inClient An Arduino client instance to use to print data to. * Allows the use of any type of client and multiple clients tied to a * single TinyGSM modem instance - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -85,20 +78,17 @@ class DreamHostPublisher : public dataPublisher { * set-up function. */ DreamHostPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + int sendEveryX = 1); /** * @brief Construct a new DreamHost Publisher object * * @param baseLogger The logger supplying the data to be published * @param dhUrl The URL for sending data to DreamHost - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ DreamHostPublisher(Logger& baseLogger, const char* dhUrl, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + int sendEveryX = 1); /** * @brief Construct a new DreamHost Publisher object * @@ -107,14 +97,11 @@ class DreamHostPublisher : public dataPublisher { * Allows the use of any type of client and multiple clients tied to a * single TinyGSM modem instance * @param dhUrl The URL for sending data to DreamHost - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ DreamHostPublisher(Logger& baseLogger, Client* inClient, const char* dhUrl, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + int sendEveryX = 1); /** * @brief Destroy the DreamHost Publisher object */ diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index 4c8b7455a..ec65e0f48 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -31,25 +31,24 @@ const char* EnviroDIYPublisher::timestampTag = "\",\"timestamp\":\""; // Constructors EnviroDIYPublisher::EnviroDIYPublisher() : dataPublisher() {} -EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, uint8_t sendEveryX, - uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) {} +EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) {} EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) {} + int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) {} EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, const char* registrationToken, const char* samplingFeatureUUID, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) { + int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client* inClient, const char* registrationToken, const char* samplingFeatureUUID, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { + int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); } diff --git a/src/publishers/EnviroDIYPublisher.h b/src/publishers/EnviroDIYPublisher.h index 145860908..9a37df180 100644 --- a/src/publishers/EnviroDIYPublisher.h +++ b/src/publishers/EnviroDIYPublisher.h @@ -51,11 +51,8 @@ class EnviroDIYPublisher : public dataPublisher { * logger. * * @param baseLogger The logger supplying the data to be published - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -63,8 +60,7 @@ class EnviroDIYPublisher : public dataPublisher { * issue, use the null constructor and a populated begin(...) within your * set-up function. */ - explicit EnviroDIYPublisher(Logger& baseLogger, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + explicit EnviroDIYPublisher(Logger& baseLogger, int sendEveryX = 1); /** * @brief Construct a new EnviroDIY Publisher object * @@ -72,11 +68,8 @@ class EnviroDIYPublisher : public dataPublisher { * @param inClient An Arduino client instance to use to print data to. * Allows the use of any type of client and multiple clients tied to a * single TinyGSM modem instance - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -85,7 +78,7 @@ class EnviroDIYPublisher : public dataPublisher { * set-up function. */ EnviroDIYPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + int sendEveryX = 1); /** * @brief Construct a new EnviroDIY Publisher object * @@ -94,15 +87,11 @@ class EnviroDIYPublisher : public dataPublisher { * Monitor My Watershed data portal. * @param samplingFeatureUUID The sampling feature UUID for the site on the * Monitor My Watershed data portal. - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ EnviroDIYPublisher(Logger& baseLogger, const char* registrationToken, - const char* samplingFeatureUUID, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + const char* samplingFeatureUUID, int sendEveryX = 1); /** * @brief Construct a new EnviroDIY Publisher object * @@ -114,16 +103,12 @@ class EnviroDIYPublisher : public dataPublisher { * Monitor My Watershed data portal. * @param samplingFeatureUUID The sampling feature UUID for the site on the * Monitor My Watershed data portal. - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ EnviroDIYPublisher(Logger& baseLogger, Client* inClient, const char* registrationToken, - const char* samplingFeatureUUID, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + const char* samplingFeatureUUID, int sendEveryX = 1); /** * @brief Destroy the EnviroDIY Publisher object */ diff --git a/src/publishers/ThingSpeakPublisher.cpp b/src/publishers/ThingSpeakPublisher.cpp index f65d8e23f..b3c9fb706 100644 --- a/src/publishers/ThingSpeakPublisher.cpp +++ b/src/publishers/ThingSpeakPublisher.cpp @@ -25,18 +25,17 @@ const char* ThingSpeakPublisher::mqttUser = THING_SPEAK_USER_NAME; // Constructors ThingSpeakPublisher::ThingSpeakPublisher() : dataPublisher() {} -ThingSpeakPublisher::ThingSpeakPublisher(Logger& baseLogger, uint8_t sendEveryX, - uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) {} +ThingSpeakPublisher::ThingSpeakPublisher(Logger& baseLogger, int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) {} ThingSpeakPublisher::ThingSpeakPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) {} + int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) {} ThingSpeakPublisher::ThingSpeakPublisher(Logger& baseLogger, const char* thingSpeakMQTTKey, const char* thingSpeakChannelID, const char* thingSpeakChannelKey, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) { + int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) { setMQTTKey(thingSpeakMQTTKey); setChannelID(thingSpeakChannelID); setChannelKey(thingSpeakChannelKey); @@ -45,8 +44,8 @@ ThingSpeakPublisher::ThingSpeakPublisher(Logger& baseLogger, Client* inClient, const char* thingSpeakMQTTKey, const char* thingSpeakChannelID, const char* thingSpeakChannelKey, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { + int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) { setMQTTKey(thingSpeakMQTTKey); setChannelID(thingSpeakChannelID); setChannelKey(thingSpeakChannelKey); diff --git a/src/publishers/ThingSpeakPublisher.h b/src/publishers/ThingSpeakPublisher.h index 2b0bbe89d..857efa42b 100644 --- a/src/publishers/ThingSpeakPublisher.h +++ b/src/publishers/ThingSpeakPublisher.h @@ -76,11 +76,8 @@ class ThingSpeakPublisher : public dataPublisher { * logger. * * @param baseLogger The logger supplying the data to be published - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -88,8 +85,7 @@ class ThingSpeakPublisher : public dataPublisher { * issue, use the null constructor and a populated begin(...) within your * set-up function. */ - explicit ThingSpeakPublisher(Logger& baseLogger, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + explicit ThingSpeakPublisher(Logger& baseLogger, int sendEveryX = 1); /** * @brief Construct a new ThingSpeak Publisher object * @@ -97,11 +93,8 @@ class ThingSpeakPublisher : public dataPublisher { * @param inClient An Arduino client instance to use to print data to. * Allows the use of any type of client and multiple clients tied to a * single TinyGSM modem instance - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -110,7 +103,7 @@ class ThingSpeakPublisher : public dataPublisher { * set-up function. */ ThingSpeakPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + int sendEveryX = 1); /** * @brief Construct a new ThingSpeak Publisher object * @@ -118,15 +111,12 @@ class ThingSpeakPublisher : public dataPublisher { * @param thingSpeakMQTTKey Your MQTT API Key from Account > MyProfile. * @param thingSpeakChannelID The numeric channel id for your channel * @param thingSpeakChannelKey The write API key for your channel - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ ThingSpeakPublisher(Logger& baseLogger, const char* thingSpeakMQTTKey, const char* thingSpeakChannelID, - const char* thingSpeakChannelKey, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + const char* thingSpeakChannelKey, int sendEveryX = 1); /** * @brief Construct a new ThingSpeak Publisher object * @@ -137,17 +127,13 @@ class ThingSpeakPublisher : public dataPublisher { * @param thingSpeakMQTTKey Your MQTT API Key from Account > MyProfile. * @param thingSpeakChannelID The numeric channel id for your channel * @param thingSpeakChannelKey The write API key for your channel - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ ThingSpeakPublisher(Logger& baseLogger, Client* inClient, const char* thingSpeakMQTTKey, const char* thingSpeakChannelID, - const char* thingSpeakChannelKey, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + const char* thingSpeakChannelKey, int sendEveryX = 1); /** * @brief Destroy the ThingSpeak Publisher object */ diff --git a/src/publishers/UbidotsPublisher.cpp b/src/publishers/UbidotsPublisher.cpp index c1e781d62..5477345a4 100644 --- a/src/publishers/UbidotsPublisher.cpp +++ b/src/publishers/UbidotsPublisher.cpp @@ -34,26 +34,23 @@ const char* UbidotsPublisher::payload = "{"; // Constructors UbidotsPublisher::UbidotsPublisher() : dataPublisher() {} -UbidotsPublisher::UbidotsPublisher(Logger& baseLogger, uint8_t sendEveryX, - uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) {} +UbidotsPublisher::UbidotsPublisher(Logger& baseLogger, int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) {} UbidotsPublisher::UbidotsPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX, uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) {} + int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) {} UbidotsPublisher::UbidotsPublisher(Logger& baseLogger, const char* authentificationToken, - const char* deviceID, uint8_t sendEveryX, - uint8_t sendOffset) - : dataPublisher(baseLogger, sendEveryX, sendOffset) { + const char* deviceID, int sendEveryX) + : dataPublisher(baseLogger, sendEveryX) { setToken(authentificationToken); _baseLogger->setSamplingFeatureUUID(deviceID); MS_DBG(F("dataPublisher object created")); } UbidotsPublisher::UbidotsPublisher(Logger& baseLogger, Client* inClient, const char* authentificationToken, - const char* deviceID, uint8_t sendEveryX, - uint8_t sendOffset) - : dataPublisher(baseLogger, inClient, sendEveryX, sendOffset) { + const char* deviceID, int sendEveryX) + : dataPublisher(baseLogger, inClient, sendEveryX) { setToken(authentificationToken); _baseLogger->setSamplingFeatureUUID(deviceID); MS_DBG(F("dataPublisher object created")); diff --git a/src/publishers/UbidotsPublisher.h b/src/publishers/UbidotsPublisher.h index 1562890c6..94853c79a 100644 --- a/src/publishers/UbidotsPublisher.h +++ b/src/publishers/UbidotsPublisher.h @@ -50,11 +50,8 @@ class UbidotsPublisher : public dataPublisher { * logger. * * @param baseLogger The logger supplying the data to be published - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -62,8 +59,7 @@ class UbidotsPublisher : public dataPublisher { * issue, use the null constructor and a populated begin(...) within your * set-up function. */ - explicit UbidotsPublisher(Logger& baseLogger, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + explicit UbidotsPublisher(Logger& baseLogger, int sendEveryX = 1); /** * @brief Construct a new Ubidots Publisher object * @@ -71,11 +67,8 @@ class UbidotsPublisher : public dataPublisher { * @param inClient An Arduino client instance to use to print data to. * Allows the use of any type of client and multiple clients tied to a * single TinyGSM modem instance - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! * * @note It is possible (though very unlikey) that using this constructor * could cause errors if the compiler attempts to initialize the publisher @@ -83,8 +76,7 @@ class UbidotsPublisher : public dataPublisher { * issue, use the null constructor and a populated begin(...) within your * set-up function. */ - UbidotsPublisher(Logger& baseLogger, Client* inClient, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + UbidotsPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1); /** * @brief Construct a new Ubidots Publisher object * @@ -95,15 +87,11 @@ class UbidotsPublisher : public dataPublisher { * specific device's setup panel). * @param deviceID The device API Label from Ubidots, derived from the * user-specified device name. - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ UbidotsPublisher(Logger& baseLogger, const char* authentificationToken, - const char* deviceID, uint8_t sendEveryX = 1, - uint8_t sendOffset = 0); + const char* deviceID, int sendEveryX = 1); /** * @brief Construct a new Ubidots Publisher object * @@ -117,15 +105,12 @@ class UbidotsPublisher : public dataPublisher { * specific device's setup panel). * @param deviceID The device API Label from Ubidots, derived from the * user-specified device name. - * @param sendEveryX Currently unimplemented, intended for future use to - * enable caching and bulk publishing - * @param sendOffset Currently unimplemented, intended for future use to - * enable publishing data at a time slightly delayed from when it is - * collected + * @param sendEveryX Interval (in units of the logging interval) between + * attempted data transmissions. NOTE: not implemented by this publisher! */ UbidotsPublisher(Logger& baseLogger, Client* inClient, const char* authentificationToken, const char* deviceID, - uint8_t sendEveryX = 1, uint8_t sendOffset = 0); + int sendEveryX = 1); /** * @brief Destroy the EnviroDIY Publisher object */ From f83a96f1318e86c3f6dd507f627df8c905c42cb5 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 14:24:40 -0500 Subject: [PATCH 13/89] publishers: remove hearsay about logger construction order The C++ standard specifies that all objects in the same translation unit (i.e. source file) are constructed in order of declaration. Since this is the most common case when using Modular Sensors, the described case cannot occur. --- src/dataPublisherBase.h | 28 ++-------------------------- src/publishers/DreamHostPublisher.h | 12 ------------ src/publishers/EnviroDIYPublisher.h | 12 ------------ src/publishers/ThingSpeakPublisher.h | 12 ------------ src/publishers/UbidotsPublisher.h | 12 ------------ 5 files changed, 2 insertions(+), 74 deletions(-) diff --git a/src/dataPublisherBase.h b/src/dataPublisherBase.h index 1f24430f9..bedaa1cf7 100644 --- a/src/dataPublisherBase.h +++ b/src/dataPublisherBase.h @@ -87,12 +87,6 @@ class dataPublisher { * @param baseLogger The logger supplying the data to be published * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. Not respected by all publishers. - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ explicit dataPublisher(Logger& baseLogger, int sendEveryX = 1); /** @@ -104,12 +98,6 @@ class dataPublisher { * single TinyGSM modem instance * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. Not respected by all publishers. - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ dataPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1); /** @@ -148,13 +136,7 @@ class dataPublisher { * @brief Begin the publisher - linking it to the client and logger. * * This can be used as an alternative to adding the logger and client in the - * constructor. This is slightly "safer" because we expect the publishers - * to be created in the "global scope" and we cannot control the order in - * which objects in that global scope will be created. That is, we cannot - * guarantee that the logger will actually be created before the publisher - * that wants to attach to it unless we wait to attach the publisher until - * in the setup or loop function of the main program. In reality, it is - * very unlikely that this is necessary. + * constructor. * * @param baseLogger The logger supplying the data to be published * @param inClient An Arduino client instance to use to print data to. @@ -172,13 +154,7 @@ class dataPublisher { * logger. * * This can be used as an alternative to adding the logger and client in the - * constructor. This is slightly "safer" because we expect the publishers - * to be created in the "global scope" and we cannot control the order in - * which objects in that global scope will be created. That is, we cannot - * guarantee that the logger will actually be created before the publisher - * that wants to attach to it unless we wait to attach the publisher until - * in the setup or loop function of the main program. In reality, it is - * very unlikely that this is necessary. + * constructor. * * @param baseLogger The logger supplying the data to be published */ diff --git a/src/publishers/DreamHostPublisher.h b/src/publishers/DreamHostPublisher.h index e7a8a6fb6..64a465be6 100644 --- a/src/publishers/DreamHostPublisher.h +++ b/src/publishers/DreamHostPublisher.h @@ -53,12 +53,6 @@ class DreamHostPublisher : public dataPublisher { * @param baseLogger The logger supplying the data to be published * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ explicit DreamHostPublisher(Logger& baseLogger, int sendEveryX = 1); /** @@ -70,12 +64,6 @@ class DreamHostPublisher : public dataPublisher { * single TinyGSM modem instance * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ DreamHostPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1); diff --git a/src/publishers/EnviroDIYPublisher.h b/src/publishers/EnviroDIYPublisher.h index 9a37df180..742681dc6 100644 --- a/src/publishers/EnviroDIYPublisher.h +++ b/src/publishers/EnviroDIYPublisher.h @@ -53,12 +53,6 @@ class EnviroDIYPublisher : public dataPublisher { * @param baseLogger The logger supplying the data to be published * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ explicit EnviroDIYPublisher(Logger& baseLogger, int sendEveryX = 1); /** @@ -70,12 +64,6 @@ class EnviroDIYPublisher : public dataPublisher { * single TinyGSM modem instance * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ EnviroDIYPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1); diff --git a/src/publishers/ThingSpeakPublisher.h b/src/publishers/ThingSpeakPublisher.h index 857efa42b..b0dec9cf1 100644 --- a/src/publishers/ThingSpeakPublisher.h +++ b/src/publishers/ThingSpeakPublisher.h @@ -78,12 +78,6 @@ class ThingSpeakPublisher : public dataPublisher { * @param baseLogger The logger supplying the data to be published * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ explicit ThingSpeakPublisher(Logger& baseLogger, int sendEveryX = 1); /** @@ -95,12 +89,6 @@ class ThingSpeakPublisher : public dataPublisher { * single TinyGSM modem instance * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ ThingSpeakPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1); diff --git a/src/publishers/UbidotsPublisher.h b/src/publishers/UbidotsPublisher.h index 94853c79a..6f4a7f328 100644 --- a/src/publishers/UbidotsPublisher.h +++ b/src/publishers/UbidotsPublisher.h @@ -52,12 +52,6 @@ class UbidotsPublisher : public dataPublisher { * @param baseLogger The logger supplying the data to be published * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ explicit UbidotsPublisher(Logger& baseLogger, int sendEveryX = 1); /** @@ -69,12 +63,6 @@ class UbidotsPublisher : public dataPublisher { * single TinyGSM modem instance * @param sendEveryX Interval (in units of the logging interval) between * attempted data transmissions. NOTE: not implemented by this publisher! - * - * @note It is possible (though very unlikey) that using this constructor - * could cause errors if the compiler attempts to initialize the publisher - * instance before the logger instance. If you suspect you are seeing that - * issue, use the null constructor and a populated begin(...) within your - * set-up function. */ UbidotsPublisher(Logger& baseLogger, Client* inClient, int sendEveryX = 1); /** From d82635ec4e78dbe0281cb3252b4c5cfe6f0a17f1 Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Thu, 16 Mar 2023 15:13:09 -0500 Subject: [PATCH 14/89] update changelog --- ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.md b/ChangeLog.md index f59567474..310041eaf 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed +- **BREAKING** Refactored how the publisher transmit buffer works. This will require adjustment to custom data publishers. ### Added From e766e3b47cd43b32a3cf6aeb9fd66aeee1bf67a5 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Mon, 17 Apr 2023 23:13:18 -0500 Subject: [PATCH 15/89] GroPoint all 21 vars logging Everything is working well! --- examples/menu_a_la_carte/menu_a_la_carte.ino | 115 ++++++++++++++++++- src/SensorBase.h | 4 +- src/sensors/GroPointGPLP8.h | 14 +-- src/sensors/GroPointParent.cpp | 99 ++++++++++------ 4 files changed, 185 insertions(+), 47 deletions(-) diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index eaa75eda7..35b834ba8 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1363,6 +1363,119 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( /** End [freescale_mpl115a2] */ #endif +#if defined BUILD_SENSOR_GROPOINT_GPLP8 +// ========================================================================== +// GroPoint Profile GPLP-8 Soil Moisture and Temperature Sensor +// ========================================================================== +/** Start [gropoint_gplp8] */ +#include + +// NOTE: Extra hardware and software serial ports are created in the "Settings +// for Additional Serial Ports" section + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte gplp8ModbusAddress = 0x19; // The modbus address of the gplp8 +// Raw Request >>> {0x19, 0x03, 0x00, 0xC8, 0x00, 0x01, 0x06, 0x2C} +const int8_t gplp8AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t gplp8SensorPower = modbusSensorPowerPin; // Sensor power pin +const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin +const uint8_t gplp8NumberReadings = 1; +// The manufacturer recommends averaging 10 readings, but we take 5 to minimize +// power consumption + +// Create a GroPoint Profile GPLP-8 sensor object +GroPointGPLP8 gplp8(gplp8ModbusAddress, modbusSerial, gplp8AdapterPower, + gplp8SensorPower, gplp8EnablePin, gplp8NumberReadings); + +// Create moisture and temperature variable pointers for the GPLP-8 +Variable* gplp8Moist1 = new Variable(&gplp8, 0, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M1", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist1", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist2 = new Variable(&gplp8, 1, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M2", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist2", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist3 = new Variable(&gplp8, 2, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M3", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist3", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist4 = new Variable(&gplp8, 3, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M4", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist4", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist5 = new Variable(&gplp8, 4, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M5", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist5", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist6 = new Variable(&gplp8, 5, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M6", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist6", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist7 = new Variable(&gplp8, 6, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M7", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist7", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist8 = new Variable(&gplp8, 7, + GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M8", + GPLP8_MOIST_UNIT_NAME, "GPLP8Moist8", + "12345678-abcd-1234-ef00-1234567890ab"); + +Variable* gplp8Temp1 = new Variable(&gplp8, 8, + GPLP8_TEMP_RESOLUTION, "temperature at T1", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp1", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp2 = new Variable(&gplp8, 9, + GPLP8_TEMP_RESOLUTION, "temperature at T2", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp1", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp3 = new Variable(&gplp8, 10, + GPLP8_TEMP_RESOLUTION, "temperature at T3", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp3", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp4 = new Variable(&gplp8, 11, + GPLP8_TEMP_RESOLUTION, "temperature at T4", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp4", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp5 = new Variable(&gplp8, 12, + GPLP8_TEMP_RESOLUTION, "temperature at T5", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp5", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp6 = new Variable(&gplp8, 13, + GPLP8_TEMP_RESOLUTION, "temperature at T6", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp6", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp7 = new Variable(&gplp8, 14, + GPLP8_TEMP_RESOLUTION, "temperature at T7", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp7", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp8 = new Variable(&gplp8, 15, + GPLP8_TEMP_RESOLUTION, "temperature at T8", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp8", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp9 = new Variable(&gplp8, 16, + GPLP8_TEMP_RESOLUTION, "temperature at T9", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp9", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp10 = new Variable(&gplp8, 17, + GPLP8_TEMP_RESOLUTION, "temperature at T10", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp10", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp11 = new Variable(&gplp8, 18, + GPLP8_TEMP_RESOLUTION, "temperature at T11", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp11", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp12 = new Variable(&gplp8, 19, + GPLP8_TEMP_RESOLUTION, "temperature at T12", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp12", + "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp13 = new Variable(&gplp8, 20, + GPLP8_TEMP_RESOLUTION, "temperature at T13", + GPLP8_TEMP_UNIT_NAME, "GPLP8Temp13", + "12345678-abcd-1234-ef00-1234567890ab"); +/** End [gropoint_gplp8] */ +#endif + #if defined BUILD_SENSOR_IN_SITU_RDO // ========================================================================== @@ -2376,7 +2489,7 @@ Variable* calculatedVar = new Variable( #if defined BUILD_TEST_CREATE_IN_ARRAY // ========================================================================== // Creating the Variable Array[s] and Filling with Variable Objects -// NOTE: This shows three differnt ways of creating the same variable array +// NOTE: This shows three different ways of creating the same variable array // and filling it with variables // ========================================================================== /** Start [variables_create_in_array] */ diff --git a/src/SensorBase.h b/src/SensorBase.h index 6d581e377..84d9e0468 100644 --- a/src/SensorBase.h +++ b/src/SensorBase.h @@ -38,8 +38,8 @@ /** * @brief The largest number of variables from a single sensor */ -#define MAX_NUMBER_VARS 8 - +#define MAX_NUMBER_VARS 21 + // GroPoint Profile GPLP-8 has 8 Moisture and 13 Temperature values class Variable; // Forward declaration diff --git a/src/sensors/GroPointGPLP8.h b/src/sensors/GroPointGPLP8.h index 7b0b1f3d6..3ed25ff14 100644 --- a/src/sensors/GroPointGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -57,7 +57,7 @@ // Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the GPLP8 can report 8 values. -#define GPLP8_NUM_VARIABLES 2 +#define GPLP8_NUM_VARIABLES 21 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define GPLP8_INC_CALC_VARIABLES 0 @@ -123,7 +123,7 @@ /// resolution is 0.1°C. #define GPLP8_TEMP_RESOLUTION 1 /// @brief Sensor variable number; temperature is stored in sensorValues[4]. -#define GPLP8_TEMP_VAR_NUM 1 +#define GPLP8_TEMP_VAR_NUM 8 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "temperature" @@ -196,16 +196,6 @@ class GroPointGPLP8 : public GroPointParent { }; -/* clang-format off */ -/** - * @brief The Variable sub-class used for the - * [dissolved oxygen concentration output](@ref sensor_gplp8_domgl) from a - * [GroPoint Profile GPLP8 probe](@ref sensor_gplp8). - * - * @ingroup sensor_gplp8 - */ -/* clang-format on */ - /* clang-format off */ /** * @brief The Variable sub-class used for the diff --git a/src/sensors/GroPointParent.cpp b/src/sensors/GroPointParent.cpp index c230dc1b5..fde34ed5e 100644 --- a/src/sensors/GroPointParent.cpp +++ b/src/sensors/GroPointParent.cpp @@ -195,51 +195,86 @@ void GroPointParent::powerDown(void) { bool GroPointParent::addSingleMeasurementResult(void) { bool success = false; - // Initialize float variables - float valueM1 = -9999; - float valueM2 = -9999; - float valueM3 = -9999; - float valueM4 = -9999; - float valueM5 = -9999; - float valueM6 = -9999; - float valueM7 = -9999; - float valueM8 = -9999; + bool successT = false; + // Initialize moisture variables for each probe segement + float M1, M2, M3, M4, M5, M6, M7, M8 = -9999; + // Initialize temperature variables for each probe sensor + float T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 = -9999; // Check a measurement was *successfully* started (status bit 6 set) // Only go on to get a result if it was if (bitRead(_sensorStatus, 6)) { switch (_model) { case GPLP8: { - // Get Values + // Get Moisture Values MS_DBG(F("Get Values from"), getSensorNameAndLocation()); - success = _gsensor.getValues(valueM1, valueM2, valueM3, - valueM4, valueM5, valueM6, - valueM7, valueM8); + success = _gsensor.getValues(M1, M2, M3, M4, M5, M6, M7, M8); // Fix not-a-number values - if (!success || isnan(valueM1)) valueM1 = -9999; - if (!success || isnan(valueM2)) valueM2 = -9999; - if (!success || isnan(valueM3)) valueM3 = -9999; - if (!success || isnan(valueM4)) valueM4 = -9999; - if (!success || isnan(valueM5)) valueM5 = -9999; - if (!success || isnan(valueM6)) valueM6 = -9999; - if (!success || isnan(valueM7)) valueM7 = -9999; - if (!success || isnan(valueM8)) valueM8 = -9999; + if (!success || isnan(M1)) M1 = -9999; + if (!success || isnan(M2)) M2 = -9999; + if (!success || isnan(M3)) M3 = -9999; + if (!success || isnan(M4)) M4 = -9999; + if (!success || isnan(M5)) M5 = -9999; + if (!success || isnan(M6)) M6 = -9999; + if (!success || isnan(M7)) M7 = -9999; + if (!success || isnan(M8)) M8 = -9999; MS_DBG(F(" "), _gsensor.getParameter()); - MS_DBG(F(" "), valueM1, ',', valueM2, ',', valueM3, ',', - valueM4, ',', valueM5, ',', valueM6, ',', valueM7, ',', - valueM8); + MS_DBG(F(" "), _gsensor.getUnits()); + MS_DBG(F(" "), M1,',', M2,',', M3,',', M4,',', M5,',', + M6,',', M7,',', M8); + + // Get Temperature Values + successT = _gsensor.getTemperatureValues(T1, T2, T3, T4, T5, + T6, T7, T8, T9, T10, T11, T12, T13); + + // Fix not-a-number values + if (!success || isnan(T1)) T1 = -9999; + if (!success || isnan(T2)) T2 = -9999; + if (!success || isnan(T3)) T3 = -9999; + if (!success || isnan(T4)) T4 = -9999; + if (!success || isnan(T5)) T5 = -9999; + if (!success || isnan(T6)) T6 = -9999; + if (!success || isnan(T7)) T7 = -9999; + if (!success || isnan(T8)) T8 = -9999; + if (!success || isnan(T9)) T9 = -9999; + if (!success || isnan(T10)) T10 = -9999; + if (!success || isnan(T11)) T11 = -9999; + if (!success || isnan(T12)) T12 = -9999; + if (!success || isnan(T13)) T13 = -9999; + + MS_DBG(F(" "), _gsensor.getParameter1()); + MS_DBG(F(" "), _gsensor.getUnits1()); + MS_DBG(F(" "), T1, ',', T2, ',', T3, ',', T4, ',', T5, ',', + T6, ',', T7, ',', T8, ',', T9, ',', T10, ',', + T11, ',', T12, ',', T13); + // Put values into the array - verifyAndAddMeasurementResult(0, valueM1); - verifyAndAddMeasurementResult(1, valueM2); - verifyAndAddMeasurementResult(2, valueM3); - verifyAndAddMeasurementResult(3, valueM4); - verifyAndAddMeasurementResult(4, valueM5); - verifyAndAddMeasurementResult(5, valueM6); - verifyAndAddMeasurementResult(6, valueM7); - verifyAndAddMeasurementResult(7, valueM8); + verifyAndAddMeasurementResult(0, M1); + verifyAndAddMeasurementResult(1, M2); + verifyAndAddMeasurementResult(2, M3); + verifyAndAddMeasurementResult(3, M4); + verifyAndAddMeasurementResult(4, M5); + verifyAndAddMeasurementResult(5, M6); + verifyAndAddMeasurementResult(6, M7); + verifyAndAddMeasurementResult(7, M8); + + verifyAndAddMeasurementResult(8, T1); + verifyAndAddMeasurementResult(9, T2); + verifyAndAddMeasurementResult(10, T3); + verifyAndAddMeasurementResult(11, T4); + verifyAndAddMeasurementResult(12, T5); + verifyAndAddMeasurementResult(13, T6); + verifyAndAddMeasurementResult(14, T7); + verifyAndAddMeasurementResult(15, T8); + verifyAndAddMeasurementResult(16, T9); + verifyAndAddMeasurementResult(17, T10); + verifyAndAddMeasurementResult(18, T11); + verifyAndAddMeasurementResult(19, T12); + verifyAndAddMeasurementResult(20, T13); + break; } From d9b1d63a4ee15fbe621d65cac0c6a56bd5323a9f Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Mon, 17 Apr 2023 23:35:01 -0500 Subject: [PATCH 16/89] Add GroPoint docs to ReadMe files --- README.md | 3 ++- examples/menu_a_la_carte/ReadMe.md | 10 ++++++++ examples/menu_a_la_carte/menu_a_la_carte.ino | 26 +++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 798aa5b85..b443cf312 100644 --- a/README.md +++ b/README.md @@ -62,8 +62,9 @@ For some generalized information about attaching sensors to an Arduino style boa - [Decagon Devices ES-2: conductivity ](https://envirodiy.github.io/ModularSensors/group__sensor__es2.html) - [Decagon Devices CTD-10: conductivity, temperature & depth ](https://envirodiy.github.io/ModularSensors/group__sensor__decagon__ctd.html) - [Everlight ALS-PT19 Analog Light Sensor (via processor ADC)](https://envirodiy.github.io/ModularSensors/group__sensor__alspt19.html) -- [Freescale Semiconductor MPL115A2: barometric pressure and temperature](https://envirodiy.github.io/ModularSensors/group__sensor__mpl115a2.html) - [External Arduino I2C Rain Tipping Bucket Counter: rainfall totals](https://envirodiy.github.io/ModularSensors/group__sensor__i2c__rain.html) +- [Freescale Semiconductor MPL115A2: barometric pressure and temperature](https://envirodiy.github.io/ModularSensors/group__sensor__mpl115a2.html) +- [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](https://envirodiy.github.io/ModularSensors/group__sensor__gplp8.html) - [In-Situ RDO PRO-X: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__insitu__rdo.html) - [In-Situ SDI-12 TROLLs: pressure, temperature, and depth](https://envirodiy.github.io/ModularSensors/group__sensor__insitu__troll.html) - [Keller Submersible Level Transmitters: pressure and temperature](https://envirodiy.github.io/ModularSensors/group__keller__group.html) diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 34fb35438..96b5275b4 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -77,6 +77,7 @@ ___ - [Everlight ALS-PT19 Ambient Light Sensor ](#everlight-als-pt19-ambient-light-sensor-) - [External Voltage via TI ADS1x15 ](#external-voltage-via-ti-ads1x15-) - [Freescale Semiconductor MPL115A2 Miniature I2C Digital Barometer ](#freescale-semiconductor-mpl115a2-miniature-i2c-digital-barometer-) + - [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe ](#gropoint-profile-gplp-8-eight-segment-soil-moisture-and-temperature-profiling-probe-) - [In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor ](#in-situ-aqualevel-troll-pressure-temperature-and-depth-sensor-) - [In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe ](#in-situ-rdo-pro-x-rugged-dissolved-oxygen-probe-) - [Keller RS485/Modbus Water Level Sensors ](#keller-rs485modbus-water-level-sensors-) @@ -832,6 +833,15 @@ Because this sensor can have only one I2C address (0x60), it is only possible to ___ +### GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe + +@see @ref sensor_gplp8 + +[//]: # ( @menusnip{gropoint_gplp8} ) + +___ + + #### In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor @see @ref sensor_insitu_troll diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 35b834ba8..94219df1b 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1387,7 +1387,7 @@ const uint8_t gplp8NumberReadings = 1; GroPointGPLP8 gplp8(gplp8ModbusAddress, modbusSerial, gplp8AdapterPower, gplp8SensorPower, gplp8EnablePin, gplp8NumberReadings); -// Create moisture and temperature variable pointers for the GPLP-8 +// Create moisture variable pointers for each segment of the GPLP-8 Variable* gplp8Moist1 = new Variable(&gplp8, 0, GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M1", GPLP8_MOIST_UNIT_NAME, "GPLP8Moist1", @@ -1421,6 +1421,7 @@ Variable* gplp8Moist8 = new Variable(&gplp8, 7, GPLP8_MOIST_UNIT_NAME, "GPLP8Moist8", "12345678-abcd-1234-ef00-1234567890ab"); +// Create temperature variable pointers for each sensor of the GPLP-8 Variable* gplp8Temp1 = new Variable(&gplp8, 8, GPLP8_TEMP_RESOLUTION, "temperature at T1", GPLP8_TEMP_UNIT_NAME, "GPLP8Temp1", @@ -2652,6 +2653,29 @@ Variable* variableList[] = { mplTemp, mplPress, #endif +#if defined BUILD_SENSOR_GROPOINT_GPLP8 + gplp8Moist1, + gplp8Moist2, + gplp8Moist3, + gplp8Moist4, + gplp8Moist5, + gplp8Moist6, + gplp8Moist7, + gplp8Moist8, + gplp8Temp1, + gplp8Temp2, + gplp8Temp3, + gplp8Temp4, + gplp8Temp5, + gplp8Temp6, + gplp8Temp7, + gplp8Temp8, + gplp8Temp9, + gplp8Temp10, + gplp8Temp11, + gplp8Temp12, + gplp8Temp13, +#endif #if defined BUILD_SENSOR_IN_SITU_RDO rdoTemp, rdoDOpct, From 0c94041dc7a14920bd9364b5952091e5d890f213 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Mon, 17 Apr 2023 23:59:03 -0500 Subject: [PATCH 17/89] Bump version number; add to changelog --- ChangeLog.md | 2 +- VERSION | 2 +- docs/Doxyfile | 2 +- library.json | 2 +- library.properties | 2 +- src/ModularSensors.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f59567474..53f67e106 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Added - +- Support [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](https://www.gropoint.com/products/soil-sensors/gropoint-profile) ### Removed ### Fixed diff --git a/VERSION b/VERSION index 85e60ed18..7b52f5e51 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.34.0 +0.35.0 diff --git a/docs/Doxyfile b/docs/Doxyfile index db06a11c2..840f599d3 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = ModularSensors # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.34.0 +PROJECT_NUMBER = 0.35.0 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/library.json b/library.json index 58ec993c2..bc920620e 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "EnviroDIY_ModularSensors", - "version": "0.34.0", + "version": "0.35.0", "description": "A library that allows access to multiple sensors through a unified interface. This allows the user to simply access many sensors to log the data or send the data to data repositories like the EnviroDIY data portal.", "keywords": "modular, sensor, sensors, datalogger, logger, low power, sleeping, EnviroDIY, ModularSensors, Mayfly, WikiWatershed, Monitor My Watershed, ThingSpeak", "platforms": "atmelavr, atmelsam", diff --git a/library.properties b/library.properties index fe0a35b7b..8fd05ee5d 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ModularSensors -version=0.34.0 +version=0.35.0 author=Sara Damiano , Shannon Hicks maintainer=Sara Damiano sentence=A library that allows access to multiple sensors through a unified interface. diff --git a/src/ModularSensors.h b/src/ModularSensors.h index 32fe3c74b..bf56bc164 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -14,7 +14,7 @@ /** * @brief The current library version number */ -#define MODULAR_SENSORS_VERSION "0.34.0" +#define MODULAR_SENSORS_VERSION "0.35.0" // To get all of the base classes for ModularSensors, include LoggerBase. // NOTE: Individual sensor definitions must be included separately. From 382875aa3f236f7ca538129e5cbb6d059178e89f Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Tue, 18 Apr 2023 00:16:01 -0500 Subject: [PATCH 18/89] Add GropointModbus to `library.json` Depends on https://github.com/EnviroDIY/GroPointModbus --- library.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library.json b/library.json index bc920620e..d98250881 100644 --- a/library.json +++ b/library.json @@ -329,6 +329,15 @@ "authors": ["Sara Damiano", "Anthony Aufdenkampe"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" + }, + { + "name": "GropointModbus", + "owner": "envirodiy", + "version": "https://github.com/EnviroDIY/GroPointModbus.git", + "note": "AA library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", + "authors": ["Anthony Aufdenkampe"], + "frameworks": "arduino", + "platforms": "atmelavr, atmelsam" } ] } From 64b573062f6f66f2edb2d42b293ce66e4de5eaf3 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Tue, 9 May 2023 16:45:44 -0500 Subject: [PATCH 19/89] Update menu_a_la_carte.ino --- examples/menu_a_la_carte/menu_a_la_carte.ino | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 94219df1b..8dce201cb 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -2963,15 +2963,15 @@ float getBatteryVoltage() { // Arduino Setup Function // ========================================================================== void setup() { -/** Start [setup_wait] */ -// Wait for USB connection to be established by PC -// NOTE: Only use this when debugging - if not connected to a PC, this -// could prevent the script from starting -#if defined SERIAL_PORT_USBVIRTUAL - while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000L)) { - // wait - } -#endif + /** Start [setup_wait] */ + // Wait for USB connection to be established by PC + // NOTE: Only use this when debugging - if not connected to a PC, this + // could prevent the script from starting + #if defined SERIAL_PORT_USBVIRTUAL + while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000L)) { + // wait + } + #endif /** End [setup_wait] */ /** Start [setup_prints] */ @@ -2990,7 +2990,7 @@ void setup() { Serial.print(F("TinyGSM Library version ")); Serial.println(TINYGSM_VERSION); Serial.println(); -/** End [setup_prints] */ + /** End [setup_prints] */ /** Start [setup_softserial] */ // Allow interrupts for software serial From 4e280004aaac792f31d6ea31f1d0dc658c6c7e74 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Wed, 31 May 2023 16:49:56 -0400 Subject: [PATCH 20/89] gropointModel = GPLPX vs UNKNOWN Replace UNKNOWN w/ GPLPX for `gropointModel`, because it conflicted with YosemiTechModbus `UNKNOWN` --- src/sensors/GroPointParent.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sensors/GroPointParent.h b/src/sensors/GroPointParent.h index 34cdad3c1..32ea22cc3 100644 --- a/src/sensors/GroPointParent.h +++ b/src/sensors/GroPointParent.h @@ -126,7 +126,7 @@ class GroPointParent : public Sensor { GroPointParent(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, - gropointModel model = UNKNOWN, + gropointModel model = GPLPX, const char* sensName = "GroPoint-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, @@ -139,7 +139,7 @@ class GroPointParent : public Sensor { GroPointParent(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, int8_t enablePin = -1, uint8_t measurementsToAverage = 1, - gropointModel model = UNKNOWN, + gropointModel model = GPLPX, const char* sensName = "GroPoint-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, From 94480e6dcce0829375b20a53728f9be97bff11b7 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 14 Jun 2023 10:11:38 -0400 Subject: [PATCH 21/89] Handle no sim card on SIM7080 Signed-off-by: Sara Damiano --- src/modems/SIMComSIM7080.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/modems/SIMComSIM7080.cpp b/src/modems/SIMComSIM7080.cpp index 4a644fe1a..1c6874c36 100644 --- a/src/modems/SIMComSIM7080.cpp +++ b/src/modems/SIMComSIM7080.cpp @@ -58,7 +58,18 @@ bool SIMComSIM7080::modemWakeFxn(void) { digitalWrite(_modemSleepRqPin, _wakeLevel); delay(_wakePulse_ms); // >1s digitalWrite(_modemSleepRqPin, !_wakeLevel); - return gsmModem.waitResponse(30000L, GF("SMS Ready")) == 1; + int ready_response = gsmModem.waitResponse(30000L, GF("SMS Ready"), + GF("+CPIN: NOT INSERTED")); + if (ready_response == 1) { + MS_DBG(F("Got SMS Ready indicating modem is awake and ready")); + } else if (ready_response == 2) { + MS_DBG(F("Got +CPIN: NOT INSERTED indicating modem is awake and " + "ready but has no SIM card")); + } else { + MS_DBG(F("Didn't get expected finish URC for modem wake!")); + } + + return ready_response == 1 || ready_response == 2; } return true; } From 4123f6acd5d46387e535c65205348b827837cd6c Mon Sep 17 00:00:00 2001 From: neilh20 Date: Wed, 21 Jun 2023 12:09:41 -0700 Subject: [PATCH 22/89] build files for Digi WiFi s6b https://github.com/EnviroDIY/ModularSensors/issues/347 --- a/DRWI_SIM7080LTE/.clang-format | 127 +++++ a/DRWI_SIM7080LTE/.gitignore | 109 ++++ a/DRWI_SIM7080LTE/ReadMe.md | 2 + a/DRWI_SIM7080LTE/platformio.ini | 119 +++++ a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp | 497 ++++++++++++++++++ sensors_test/DRWI_SIM7080LTE/.clang-format | 127 +++++ sensors_test/DRWI_SIM7080LTE/.gitignore | 110 ++++ sensors_test/DRWI_SIM7080LTE/ReadMe.md | 43 ++ .../DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp | 497 ++++++++++++++++++ 9 files changed, 1631 insertions(+) create mode 100644 a/DRWI_SIM7080LTE/.clang-format create mode 100644 a/DRWI_SIM7080LTE/.gitignore create mode 100644 a/DRWI_SIM7080LTE/ReadMe.md create mode 100644 a/DRWI_SIM7080LTE/platformio.ini create mode 100644 a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp create mode 100644 sensors_test/DRWI_SIM7080LTE/.clang-format create mode 100644 sensors_test/DRWI_SIM7080LTE/.gitignore create mode 100644 sensors_test/DRWI_SIM7080LTE/ReadMe.md create mode 100644 sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp diff --git a/a/DRWI_SIM7080LTE/.clang-format b/a/DRWI_SIM7080LTE/.clang-format new file mode 100644 index 000000000..6e42a7597 --- /dev/null +++ b/a/DRWI_SIM7080LTE/.clang-format @@ -0,0 +1,127 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -3 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignEscapedNewlines: Left +AlignOperands: false +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BreakAfterJavaFieldAnnotations: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Leave +EmptyLineBeforeAccessModifier: Leave +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: 'TinyGsmClient.h' + Priority: -1 + - Regex: 'VariableBase.h' + Priority: -1 + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: Indent +IndentGotoLabels: true +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +# ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: CurrentLine +PenaltyBreakAssignment: 25 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 600 +PenaltyReturnTypeOnItsOwnLine: 50 +PointerAlignment: Left +PointerBindsToType: true +QualifierAlignment: Left +ReferenceAlignment: Left +ReflowComments: true +SeparateDefinitionBlocks: Leave +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInLineCommentPrefix: + Minimum: 1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 4 +UseTab: Never +--- diff --git a/a/DRWI_SIM7080LTE/.gitignore b/a/DRWI_SIM7080LTE/.gitignore new file mode 100644 index 000000000..ca3297356 --- /dev/null +++ b/a/DRWI_SIM7080LTE/.gitignore @@ -0,0 +1,109 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db +~* + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# PyCharm +.idea/ + +# Atom / PlatformIO +.pio +.pio_del +.pioenvs +.piolibdeps +.pio +.pio/libdeps +.pio/build +.pio/* +.clang_complete +.gcc-flags.json +.atomrc.cson +lib/* +include/* +.sconsign.dblite + +# VSCode +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode +.history + +# Other +compile_tests/ +logger_test*/ +YosemitechDO/ +LongTermLogger/ +barometric_correction/ +3G_Test/ + +__pycache__/ +runDoxygen.bat +docs/examples/* +output_doxygen.log +output_doxygen_run.log +output_mcss_run.log +output_mcss.log +docs/examples.dox_x +platformio_extra_envs.ini +src/sensors/table.md +cache +docs/output_copyFunctions.log +docs/output_documentExamples.log +docs/output_fixSectionsInXml.log +examples/DRWI_Mayfly1_Wifi_5tm_ds18b20_1/DRWI_Mayfly1_Wifi_5tm_ds18b20_1.ino +clang_format_all.bat +arduino_lint.md +arduino_lint.json +**/home/arduino/* +examples/test_code/* +compile_results.md +arduino_cli_log.log +continuous_integration/arduino_cli_local.yaml +compile_results.log +continuous_integration_artifacts/* +arduino_cli.log diff --git a/a/DRWI_SIM7080LTE/ReadMe.md b/a/DRWI_SIM7080LTE/ReadMe.md new file mode 100644 index 000000000..cf82d18e4 --- /dev/null +++ b/a/DRWI_SIM7080LTE/ReadMe.md @@ -0,0 +1,2 @@ +# DRWI Sites with EnviroDIY LTE Bees +Development Build from local ModularSensors/src directories \ No newline at end of file diff --git a/a/DRWI_SIM7080LTE/platformio.ini b/a/DRWI_SIM7080LTE/platformio.ini new file mode 100644 index 000000000..494ca3c12 --- /dev/null +++ b/a/DRWI_SIM7080LTE/platformio.ini @@ -0,0 +1,119 @@ +; PlatformIO Project Configuration File +; +; Build options: build flags, source filter +; Upload options: custom upload port, speed and extra flags +; Library options: dependencies, extra library storages +; Advanced options: extra scripting +; +; Please visit documentation for the other options and examples +; http://docs.platformio.org/page/projectconf.html +; https://envirodiy.github.io/ModularSensors/page_for_developers.html + +[platformio] +description = ModularSensors alpha build for DRWI on local sensors and a WiFi or EnviroDIY SIM7080G LTE modem +default_envs = mayfly +;src_dir = src + +[env] +monitor_speed = 115200 ;57600 +framework = arduino +; deep search for dependencies, evalulating preprocessor conditionals +lib_ldf_mode = deep+ +; look for the library director +lib_extra_dirs = . +; We have to ignore these folders or PlatformIO will double count all the dependencies +lib_ignore = + .git + .pio + .vscode + doc + examples + sensor_tests + extras + build + RTCZero + Adafruit NeoPixel + Adafruit GFX Library + Adafruit SSD1306 + Adafruit ADXL343 + Adafruit STMPE610 + Adafruit TouchScreen + Adafruit ILI9341 +; All these library dependencies must be listed out since we're in the library +; source code and won't read the dependencies from the library.json like a +; typical user would +lib_deps = + envirodiy/EnviroDIY_DS3231 + arduino-libraries/RTCZero + greygnome/EnableInterrupt + greiman/SdFat + ;vshymanskyy/TinyGSM + https://github.com/neilh10/TinyGSM#iss347_digi_wifi_s6b_becomes_unstable + knolleary/PubSubClient + adafruit/Adafruit BusIO + adafruit/Adafruit Unified Sensor + https://github.com/soligen2010/Adafruit_ADS1X15.git + adafruit/Adafruit AM2315 + adafruit/Adafruit BME280 Library + adafruit/DHT sensor library + adafruit/Adafruit INA219 + adafruit/Adafruit MPL115A2 + adafruit/Adafruit SHT4x Library + https://github.com/MartinL1/BMP388_DEV + paulstoffregen/OneWire + milesburton/DallasTemperature + envirodiy/SDI-12 + northernwidget/MS5803 + https://github.com/EnviroDIY/Tally_Library.git#Dev_I2C + envirodiy/SensorModbusMaster + envirodiy/KellerModbus + envirodiy/YosemitechModbus + vshymanskyy/StreamDebugger +; The directories for the ModularSensors library source code +build_src_filter = +<*> +<../../../src> +<../../../src/sensors> +<../../../src/publishers> +<../../../src/modems> + + +; Some common build flags +build_flags = + -Isrc + -I../../src ; .h For easy debug + -I../../src/sensors ; .h For easy debug + -Ilib/TinyGSM/src + -D SDI12_EXTERNAL_PCINT + -D NEOSWSERIAL_EXTERNAL_PCINT + -D MQTT_MAX_PACKET_SIZE=240 + -D TINY_GSM_RX_BUFFER=64 + -D TINY_GSM_YIELD_MS=2 + ;-D STREAMDEBUGGER_DBG + ;-D TinyGsmClientXbee_DBG=Serial + ;-D MS_DIGIXBEEWIFI_DEBUG + ;-D MS_DIGIXBEE_DEBUG + ;-D MS_LOGGERMODEM_DEBUG +;extra_scripts = pre:pioScripts/generate_compile_commands.py + + + +[env:mayfly] +board = mayfly +platform = atmelavr + +lib_deps = ${env.lib_deps} +; envirodiy/EnviroDIY_ModularSensors +; ^^ Use this when working from an official release of the library + ;https://github.com/neilh10/ModularSensors.git#develop + ;https://github.com/neilh10/ModularSensors.git#dvlp_batch_build +; ^^ Use this when if you want to pull from the develop branch + https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git + https://github.com/PaulStoffregen/AltSoftSerial.git + https://github.com/SRGDamia1/NeoSWSerial.git + +lib_ignore = + ${env.lib_ignore} + RTCZero + Adafruit Zero DMA Library + +build_flags = + ${env.build_flags} + -D STANDARD_SERIAL_OUTPUT=Serial + -D DEBUGGING_SERIAL_OUTPUT=Serial + -D DEEP_DEBUGGING_SERIAL_OUTPUT=Serial \ No newline at end of file diff --git a/a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp b/a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp new file mode 100644 index 000000000..a91906f11 --- /dev/null +++ b/a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp @@ -0,0 +1,497 @@ +/** ========================================================================= + * @file DRWI_SIM7080LTE.ino + * @brief Example for DRWI CitSci LTE sites. + * + * This example shows proper settings for the following configuration: + * + * Mayfly v1.0 board + * EnviroDIY SIM7080 LTE module (with Hologram SIM card) + * Hydros21 CTD sensor + * Campbell Scientific OBS3+ Turbidity sensor + * + * @author Sara Geleskie Damiano + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) + * and the EnviroDIY Development Team + * This example is published under the BSD-3 license. + * + + * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger + * + * DISCLAIMER: + * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. + * ======================================================================= */ + +// ========================================================================== +// Defines for the Arduino IDE +// NOTE: These are ONLY needed to compile with the Arduino IDE. +// If you use PlatformIO, you should set these build flags in your +// platformio.ini +// ========================================================================== +/** Start [defines] */ +#ifndef TINY_GSM_RX_BUFFER +#define TINY_GSM_RX_BUFFER 64 +#endif +#ifndef TINY_GSM_YIELD_MS +#define TINY_GSM_YIELD_MS 2 +#endif +/** End [defines] */ + +// ========================================================================== +// Include the libraries required for any data logger +// ========================================================================== +/** Start [includes] */ +// The Arduino library is needed for every Arduino program. +#include + +// EnableInterrupt is used by ModularSensors for external and pin change +// interrupts and must be explicitly included in the main program. +#include + +// Include the main header for ModularSensors +#include +/** End [includes] */ + + +// ========================================================================== +// Data Logging Options +// ========================================================================== +// Details for this build +extern const String build_ref = "a\\" __FILE__ " " __DATE__ " " __TIME__ " "; +#ifdef PIO_SRC_REV +const char git_branch[] = PIO_SRC_REV; +#else +const char git_branch[] = "brnch"; +#endif +#ifdef PIO_SRC_USR +const char git_usr[] = PIO_SRC_USR; +#else +const char git_usr[] = "usr"; +#endif +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "DRWI_SIM7080LTE.cpp"; +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char* LoggerID = "XXXXX"; +// How frequently (in minutes) to log data +const uint8_t loggingInterval = 2; +// Your logger's timezone. +const int8_t timeZone = -5; // Eastern Standard Time +// NOTE: Daylight savings time will not be applied! Please use standard time! + +// Set the input and output pins for the logger +// NOTE: Use -1 for pins that do not apply +const int32_t serialBaud = 115200; // 57600 Baud rate for debugging +const int8_t greenLED = 8; // Pin for the green LED +const int8_t redLED = 9; // Pin for the red LED +const int8_t buttonPin = 21; // Pin for debugging mode (ie, button pin) +const int8_t wakePin = 31; // MCU interrupt/alarm pin to wake from sleep +// Mayfly 0.x D31 = A7 +const int8_t sdCardPwrPin = -1; // MCU SD card power pin +const int8_t sdCardSSPin = 12; // SD card chip select/slave select pin +const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power +/** End [logging_options] */ + + +// ========================================================================== +// Wifi/Cellular Modem Options +// ========================================================================== +HardwareSerial& modemSerial = Serial1; // Use hardware serial if possible +#if defined STREAMDEBUGGER_DBG +#include +StreamDebugger modemDebugger(modemSerial, STANDARD_SERIAL_OUTPUT); +#define modemSerHw modemDebugger +#else +#define modemSerHw modemSerial +#endif // STREAMDEBUGGER_DBG + +#define sim_com_xbee_wifi +#if defined sim_com_sim7080 +/** Start [sim_com_sim7080] */ + +// For almost anything based on the SIMCom SIM7080G +#include + +// Create a reference to the serial port for the modem +const int32_t modemBaud = 9600; // SIM7080 does auto-bauding by default, but + // for simplicity we set to 9600 + +// Modem Pins - Describe the physical pin connection of your modem to your board +// NOTE: Use -1 for pins that do not apply + +const int8_t modemVccPin = + 18; // MCU pin controlling modem power --- + // Pin 18 is the power enable pin + // for the bee socket on Mayfly v1.0, + // use -1 if using Mayfly 0.5b or if the bee socket is constantly + // powered (ie you changed SJ18 on Mayfly 1.x to 3.3v) +const int8_t modemStatusPin = 19; // MCU pin used to read modem status +const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request +const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem + // status + +// Network connection information +const char* apn = + "hologram"; // APN connection name, typically Hologram unless you have a + // different provider's SIM card. Change as needed + +// Create the modem object +SIMComSIM7080 modem7080(&modemSerHw, modemVccPin, modemStatusPin, + modemSleepRqPin, apn); +// Create an extra reference to the modem by a generic name +SIMComSIM7080 modem = modem7080; +/** End [sim_com_sim7080] */ +#elif defined sim_com_xbee_wifi +/** Start [sim_com_xbee_wifi] */ +// For the Digi Wifi XBee (S6B) +#include +// Create a reference to the serial port for the modem + +const int32_t modemBaud = 9600; // All XBee's use 9600 by default + +// Modem Pins - Describe the physical pin connection of your modem to your board +// NOTE: Use -1 for pins that do not apply +const int8_t modemVccPin = 18; // Mayfly1.1 pin controlling modem power +const int8_t modemStatusPin = 19; // MCU pin used to read modem status +const bool useCTSforStatus = true; // Flag to use the modem CTS pin for status +const int8_t modemResetPin = 20; // MCU pin connected to modem reset pin +const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request +const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem + // status (-1 if unconnected) + +// Network connection information +const char* wifiId = "ArthurGuestSsid"; // WiFi access point, unnecessary for GPRS +const char* wifiPwd = "Arthur8166"; // WiFi password, unnecessary for GPRS + +DigiXBeeWifi modemXBWF(&modemSerHw, modemVccPin, modemStatusPin, + useCTSforStatus, modemResetPin, modemSleepRqPin, wifiId, + wifiPwd); +// Create an extra reference to the modem by a generic name +DigiXBeeWifi modemPhy = modemXBWF; +/** End [sim_com_xbee_wifi] */ +#endif //Modem options + +// ========================================================================== +// Using the Processor as a Sensor +// ========================================================================== +/** Start [processor_sensor] */ +#include + +// Create the main processor chip "sensor" - for general metadata +const char* mcuBoardVersion = "v1.1"; +ProcessorStats mcuBoard(mcuBoardVersion); +/** End [processor_sensor] */ + + +// ========================================================================== +// Maxim DS3231 RTC (Real Time Clock) +// ========================================================================== +/** Start [ds3231] */ +#include + +// Create a DS3231 sensor object +MaximDS3231 ds3231(1); +/** End [ds3231] */ + +//#define SENSORS_EXTERNAL +#if defined SENSORS_EXTERNAL +// ========================================================================== +// Meter Hydros 21 Conductivity, Temperature, and Depth Sensor +// ========================================================================== +/** Start [hydros21] */ +#include + +const char* hydrosSDI12address = "1"; // The SDI-12 Address of the Hydros 21 +const uint8_t hydrosNumberReadings = 6; // The number of readings to average +const int8_t SDI12Power = sensorPowerPin; // Power pin (-1 if unconnected) +const int8_t SDI12Data = 7; // The SDI12 data pin + +// Create a Meter Hydros 21 sensor object +MeterHydros21 hydros(*hydrosSDI12address, SDI12Power, SDI12Data, + hydrosNumberReadings); +/** End [hydros21] */ + + +// ========================================================================== +// Campbell OBS 3 / OBS 3+ Analog Turbidity Sensor +// ========================================================================== +/** Start [obs3] */ +#include + +const int8_t OBS3Power = sensorPowerPin; // Power pin (-1 if unconnected) +const uint8_t OBS3NumberReadings = 10; +const uint8_t ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC +// Campbell OBS 3+ *Low* Range Calibration in Volts +const int8_t OBSLowADSChannel = 0; // ADS channel for *low* range output +const float OBSLow_A = 0.000E+00; // "A" value (X^2) [*low* range] +const float OBSLow_B = 1.000E+00; // "B" value (X) [*low* range] +const float OBSLow_C = 0.000E+00; // "C" value [*low* range] + +// Create a Campbell OBS3+ *low* range sensor object +CampbellOBS3 osb3low(OBS3Power, OBSLowADSChannel, OBSLow_A, OBSLow_B, OBSLow_C, + ADSi2c_addr, OBS3NumberReadings); + + +// Campbell OBS 3+ *High* Range Calibration in Volts +const int8_t OBSHighADSChannel = 1; // ADS channel for *high* range output +const float OBSHigh_A = 0.000E+00; // "A" value (X^2) [*high* range] +const float OBSHigh_B = 1.000E+00; // "B" value (X) [*high* range] +const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] + +// Create a Campbell OBS3+ *high* range sensor object +CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, + OBSHigh_C, ADSi2c_addr, OBS3NumberReadings); +/** End [obs3] */ + +#endif // SENSORS_EXTERNAL +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + #if defined SENSORS_EXTERNAL + new MeterHydros21_Cond(&hydros), + new MeterHydros21_Depth(&hydros), + new MeterHydros21_Temp(&hydros), + new CampbellOBS3_Turbidity(&osb3low, "", "TurbLow"), + new CampbellOBS3_Turbidity(&osb3high, "", "TurbHigh"), + new ProcessorStats_Battery(&mcuBoard), + #endif //SENSORS_EXTERNAL + new MaximDS3231_Temp(&ds3231), + new ProcessorStats_SampleNumber(&mcuBoard), + // Fut Sensiron Temperature + // Fut Sensirom Humidity + //new Modem_SignalPercent(&modem), +}; + +// All UUID's, device registration, and sampling feature information can be +// pasted directly from Monitor My Watershed. +// To get the list, click the "View token UUID list" button on the upper right +// of the site page. + +// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** +// Check the order of your variables in the variable list!!! +// Be VERY certain that they match the order of your UUID's! +// Rearrange the variables in the variable list ABOVE if necessary to match! +// Do not change the order of the variables in the section below. +// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** + +// Replace all of the text in the following section with the UUID array from +// MonitorMyWatershed + +/* clang-format off */ +// --------------------- Beginning of Token UUID List --------------------- + +//Site https://monitormywatershed.org/sites/bq_test01/ +const char* UUIDs[] = // UUID array for device sensors + { + #if defined SENSORS_EXTERNAL + "12345678-abcd-1234-ef00-1234567890ab", // Specific conductance (Meter_Hydros21_Cond) + "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Meter_Hydros21_Depth) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Meter_Hydros21_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (Low) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (High) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + #endif // SENSORS_EXTERNAL + "9fdcefc1-b43f-4c3c-8d46-ca0e90845153", // Temperature (Maxim_DS3231_Temp) + "e0d7b81b-0241-4017-b5dc-e90ecdb7c279", // Sequence number (EnviroDIY_Mayfly_SampleNum) + //"d73e060d-df4e-4f29-8b69-34891f518bdf", // Temperature (Sensirion_SHT40_Temperature) + //"acc456aa-1148-4385-a984-a68b6eb6b044", // Relative humidity (Sensirion_SHT40_Humidity) + //"97893988-6c2d-43ee-9cfe-3715d45019db" // Percent full scale (Digi_Cellular_SignalPercent) +}; +const char* registrationToken = "22752220-5925-4a2c-aeb1-a57b58e1c246"; // Device registration token +const char* samplingFeature = "747478ef-4e80-4cc8-921e-89172d05ea42"; // Sampling feature UUID + + +// ----------------------- End of Token UUID List ----------------------- +/* clang-format on */ + +// Count up the number of pointers in the array +int variableCount = sizeof(variableList) / sizeof(variableList[0]); + +// Create the VariableArray object +VariableArray varArray(variableCount, variableList, UUIDs); +/** End [variable_arrays] */ + + +// ========================================================================== +// The Logger Object[s] +// ========================================================================== +/** Start [loggers] */ +// Create a new logger instance +Logger dataLogger(LoggerID, loggingInterval, &varArray); +/** End [loggers] */ + + +// ========================================================================== +// Creating Data Publisher[s] +// ========================================================================== +/** Start [publishers] */ +// Create a data publisher for the Monitor My Watershed/EnviroDIY POST endpoint +#include +EnviroDIYPublisher EnviroDIYPOST(dataLogger, &modemPhy.gsmClient, + registrationToken, samplingFeature); +/** End [publishers] */ + + +// ========================================================================== +// Working Functions +// ========================================================================== +/** Start [working_functions] */ +// Flashes the LED's on the primary board +void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { + for (uint8_t i = 0; i < numFlash; i++) { + digitalWrite(greenLED, HIGH); + digitalWrite(redLED, LOW); + delay(rate); + digitalWrite(greenLED, LOW); + digitalWrite(redLED, HIGH); + delay(rate); + } + digitalWrite(redLED, LOW); +} + +// Reads the battery voltage +// NOTE: This will actually return the battery level from the previous update! +float getBatteryVoltage() { + if (mcuBoard.sensorValues[0] == -9999) mcuBoard.update(); + return mcuBoard.sensorValues[0]; +} + + +// ========================================================================== +// Arduino Setup Function +// ========================================================================== +/** Start [setup] */ +void setup() { + // Start the primary serial connection + Serial.begin(serialBaud); + Serial.print(F("\n---Boot. Sw Build: ")); + Serial.print(build_ref); + Serial.print(" "); + Serial.println(git_usr); + Serial.print(" "); + Serial.println(git_branch); + + // Print a start-up note to the first serial port + Serial.print(F("\nNow running ")); + Serial.print(sketchName); + Serial.print(F(" on Logger ")); + Serial.println(LoggerID); + Serial.println(); + + Serial.print(F("Using ModularSensors Library version ")); + Serial.println(MODULAR_SENSORS_VERSION); + Serial.print(F("TinyGSM Library version ")); + Serial.println(TINYGSM_VERSION); + Serial.println(); + + // Start the serial connection with the modem + modemSerial.begin(modemBaud); + + // Set up pins for the LED's + pinMode(greenLED, OUTPUT); + digitalWrite(greenLED, LOW); + pinMode(redLED, OUTPUT); + digitalWrite(redLED, LOW); + // Blink the LEDs to show the board is on and starting up + greenredflash(); + + pinMode(20, OUTPUT); // for proper operation of the onboard flash memory + // chip's ChipSelect (Mayfly v1.0 and later) + + // Set the timezones for the logger/data and the RTC + // Logging in the given time zone + Logger::setLoggerTimeZone(timeZone); + // It is STRONGLY RECOMMENDED that you set the RTC to be in UTC (UTC+0) + Logger::setRTCTimeZone(0); + + // Attach the modem and information pins to the logger + dataLogger.attachModem(modemPhy); + modemPhy.setModemLED(modemLEDPin); + dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, + greenLED); + + // Begin the logger + dataLogger.begin(); + + // Note: Please change these battery voltages to match your battery + // Set up the sensors, except at lowest battery level + if (getBatteryVoltage() > 3.4) { + Serial.println(F("Setting up sensors...")); + varArray.setupSensors(); + } + + #if defined sim_com_sim700 + /** Start [setup_sim7080] */ + modem.setModemWakeLevel(HIGH); // ModuleFun Bee inverts the signal + modem.setModemResetLevel(HIGH); // ModuleFun Bee inverts the signal + Serial.println(F("Waking modem and setting Cellular Carrier Options...")); + modem.modemWake(); // NOTE: This will also set up the modem + modem.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! + modem.gsmModem.setNetworkMode(38); // set to LTE only + // 2 Automatic + // 13 GSM only + // 38 LTE only + // 51 GSM and LTE only + modem.gsmModem.setPreferredMode(1); // set to CAT-M + // 1 CAT-M + // 2 NB-IoT + // 3 CAT-M and NB-IoT + /** End [setup_sim7080] */ + #elif defined sim_com_xbee_wifi + /** Start [setup_sim7080] */ + + Serial.println(F("Waking modem WiFi ...")); + modemPhy.modemWake(); // NOTE: This will also set up the modem + modemPhy.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! + #endif //Modem setup + + // Sync the clock if it isn't valid or we have battery to spare + if (getBatteryVoltage() > 3.55 || !dataLogger.isRTCSane()) { + // Synchronize the RTC with NIST + // This will also set up the modem + dataLogger.syncRTC(); + } + + // Create the log file, adding the default header to it + // Do this last so we have the best chance of getting the time correct and + // all sensor names correct + // Writing to the SD card can be power intensive, so if we're skipping + // the sensor setup we'll skip this too. + if (getBatteryVoltage() > 3.4) { + Serial.println(F("Setting up file on SD card")); + dataLogger.turnOnSDcard( + true); // true = wait for card to settle after power up + dataLogger.createLogFile(true); // true = write a new header + dataLogger.turnOffSDcard( + true); // true = wait for internal housekeeping after write + } + + // Call the processor sleep + Serial.println(F("Putting processor to sleep\n")); + dataLogger.systemSleep(); +} +/** End [setup] */ + + +// ========================================================================== +// Arduino Loop Function +// ========================================================================== +/** Start [loop] */ +// Use this short loop for simple data logging and sending +void loop() { + // Note: Please change these battery voltages to match your battery + // At very low battery, just go back to sleep + if (getBatteryVoltage() < 3.4) { + dataLogger.systemSleep(); + } + // At moderate voltage, log data but don't send it over the modem + else if (getBatteryVoltage() < 3.55) { + dataLogger.logData(); + } + // If the battery is good, send the data to the world + else { + dataLogger.logDataAndPublish(); + } +} +/** End [loop] */ diff --git a/sensors_test/DRWI_SIM7080LTE/.clang-format b/sensors_test/DRWI_SIM7080LTE/.clang-format new file mode 100644 index 000000000..6e42a7597 --- /dev/null +++ b/sensors_test/DRWI_SIM7080LTE/.clang-format @@ -0,0 +1,127 @@ +--- +Language: Cpp +# BasedOnStyle: Google +AccessModifierOffset: -3 +AlignAfterOpenBracket: Align +AlignConsecutiveMacros: false +AlignConsecutiveAssignments: true +AlignConsecutiveDeclarations: true +AlignEscapedNewlines: Left +AlignOperands: false +AlignTrailingComments: true +AllowAllArgumentsOnNextLine: true +AllowAllConstructorInitializersOnNextLine: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: Always +AllowShortCaseLabelsOnASingleLine: true +AllowShortEnumsOnASingleLine: true +AllowShortFunctionsOnASingleLine: Empty +AllowShortIfStatementsOnASingleLine: WithoutElse +AllowShortLambdasOnASingleLine: All +AllowShortLoopsOnASingleLine: true +AlwaysBreakAfterDefinitionReturnType: None +AlwaysBreakAfterReturnType: None +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: Yes +BinPackArguments: true +BinPackParameters: true +BreakAfterJavaFieldAnnotations: false +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Attach +BreakBeforeInheritanceComma: false +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +BreakConstructorInitializers: BeforeColon +BreakInheritanceList: BeforeColon +BreakStringLiterals: true +ColumnLimit: 80 +CommentPragmas: '^ IWYU pragma:' +CompactNamespaces: false +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 4 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +EmptyLineAfterAccessModifier: Leave +EmptyLineBeforeAccessModifier: Leave +ExperimentalAutoDetectBinPacking: false +FixNamespaceComments: true +ForEachMacros: + - foreach + - Q_FOREACH + - BOOST_FOREACH +IncludeBlocks: Preserve +IncludeCategories: + - Regex: 'TinyGsmClient.h' + Priority: -1 + - Regex: 'VariableBase.h' + Priority: -1 + - Regex: '^"(llvm|llvm-c|clang|clang-c)/' + Priority: 2 + - Regex: '^(<|"(gtest|gmock|isl|json)/)' + Priority: 3 + - Regex: '.*' + Priority: 1 +IncludeIsMainRegex: '([-_](test|unittest))?$' +IndentAccessModifiers: false +IndentCaseBlocks: false +IndentCaseLabels: true +IndentExternBlock: Indent +IndentGotoLabels: true +IndentPPDirectives: None +IndentWidth: 4 +IndentWrappedFunctionNames: false +InsertTrailingCommas: None +JavaScriptQuotes: Leave +JavaScriptWrapImports: true +KeepEmptyLinesAtTheStartOfBlocks: false +MacroBlockBegin: '' +MacroBlockEnd: '' +MaxEmptyLinesToKeep: 2 +NamespaceIndentation: None +# ObjCBinPackProtocolList: Auto +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PackConstructorInitializers: CurrentLine +PenaltyBreakAssignment: 25 +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyBreakTemplateDeclaration: 10 +PenaltyExcessCharacter: 600 +PenaltyReturnTypeOnItsOwnLine: 50 +PointerAlignment: Left +PointerBindsToType: true +QualifierAlignment: Left +ReferenceAlignment: Left +ReflowComments: true +SeparateDefinitionBlocks: Leave +SortIncludes: false +SortUsingDeclarations: true +SpaceAfterCStyleCast: false +SpaceAfterLogicalNot: false +SpaceAfterTemplateKeyword: true +SpaceBeforeAssignmentOperators: true +SpaceBeforeCaseColon: false +SpaceBeforeCpp11BracedList: false +SpaceBeforeCtorInitializerColon: true +SpaceBeforeInheritanceColon: true +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: true +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 2 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInConditionalStatement: false +SpacesInLineCommentPrefix: + Minimum: 1 +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 4 +UseTab: Never +--- diff --git a/sensors_test/DRWI_SIM7080LTE/.gitignore b/sensors_test/DRWI_SIM7080LTE/.gitignore new file mode 100644 index 000000000..e427ce655 --- /dev/null +++ b/sensors_test/DRWI_SIM7080LTE/.gitignore @@ -0,0 +1,110 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db +~* + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +# PyCharm +.idea/ + +# Atom / PlatformIO +.pio +.pio_del +.pioenvs +.piolibdeps +.pio +.pio/libdeps +.pio/build +.pio/* +.clang_complete +.gcc-flags.json +.atomrc.cson +lib/* +include/* +/platformio.ini +.sconsign.dblite + +# VSCode +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode +.history + +# Other +compile_tests/ +logger_test*/ +YosemitechDO/ +LongTermLogger/ +barometric_correction/ +3G_Test/ + +__pycache__/ +runDoxygen.bat +docs/examples/* +output_doxygen.log +output_doxygen_run.log +output_mcss_run.log +output_mcss.log +docs/examples.dox_x +platformio_extra_envs.ini +src/sensors/table.md +cache +docs/output_copyFunctions.log +docs/output_documentExamples.log +docs/output_fixSectionsInXml.log +examples/DRWI_Mayfly1_Wifi_5tm_ds18b20_1/DRWI_Mayfly1_Wifi_5tm_ds18b20_1.ino +clang_format_all.bat +arduino_lint.md +arduino_lint.json +**/home/arduino/* +examples/test_code/* +compile_results.md +arduino_cli_log.log +continuous_integration/arduino_cli_local.yaml +compile_results.log +continuous_integration_artifacts/* +arduino_cli.log diff --git a/sensors_test/DRWI_SIM7080LTE/ReadMe.md b/sensors_test/DRWI_SIM7080LTE/ReadMe.md new file mode 100644 index 000000000..b0139c4b8 --- /dev/null +++ b/sensors_test/DRWI_SIM7080LTE/ReadMe.md @@ -0,0 +1,43 @@ +# DRWI Sites with EnviroDIY LTE Bees +Build sketch for testing batch queue using the SIM7080G LTE cellular module with an EnviroDIY Mayfly Data Logger. + +The exact hardware configuration used in this example: + * Mayfly v1.2 board + * EnviroDIY SIM7080 LTE module (with Hologram SIM card) + + +An EnviroDIY LTE SIM7080 module can be used with the older Mayfly v0.5b boards if you change line 101 (for modemVccPin) from 18 to -1. +This is because the Mayfly v1.0 board has a separate 3.3v regulator to power the Bee socket and is controlled by turning pin 18 on or off. +Mayfly v0.5b has the Bee socket constantly powered, therefore using "-1" is the proper setting for that line of code. + +The EnviroDIY LTE SIM7080 module includes 2 antennas in the package. The small thin one is the cellular antenna, and should be connected to the socket labeled "CELL". The thicker block is the GPS antenna, and should be connected to the "GPS" socket, but only if you intend to use the GPS functionality of the module. ModularSensors does not currently suport GPS functionality, but other libraries such as TinyGPS can work with the SIM7080 module. + +The included cell antenna works best in high-signal-strength areas. For most remote areas and logger deployments, we suggest a larger LTE antenna, like the W3907B0100 +from PulseLarsen (Digikey 1837-1003-ND or Mouser 673-W3907B0100) + +_______ + +[//]: # ( @tableofcontents ) + +[//]: # ( @m_footernavigation ) + +[//]: # ( Start GitHub Only ) +- [DRWI Sites with EnviroDIY LTE Bees](#drwi-sites-with-envirodiy-lte-bees) +- [Unique Features of the DRWI EnviroDIY LTE Example](#unique-features-of-the-drwi-envirodiy-lte-example) + +[//]: # ( End GitHub Only ) + +_______ + +# Unique Features of the DRWI EnviroDIY LTE Example +- Specifically for sites within the Delaware River Watershed Initiative. +- Uses a EnviroDIY LTE Bee based on the SIMCom SIM7080G + + +[//]: # ( @section example_drwi_ediylte_pio_config PlatformIO Configuration ) + +[//]: # ( @include{lineno} DRWI_SIM7080LTE/platformio.ini ) + +[//]: # ( @section example_drwi_ediylte_code The Complete Code ) + +[//]: # ( @include{lineno} DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino ) diff --git a/sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp b/sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp new file mode 100644 index 000000000..d7cc9203c --- /dev/null +++ b/sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp @@ -0,0 +1,497 @@ +/** ========================================================================= + * @file DRWI_SIM7080LTE.ino + * @brief Example for DRWI CitSci LTE sites. + * + * This example shows proper settings for the following configuration: + * + * Mayfly v1.0 board + * EnviroDIY SIM7080 LTE module (with Hologram SIM card) + * Hydros21 CTD sensor + * Campbell Scientific OBS3+ Turbidity sensor + * + * @author Sara Geleskie Damiano + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) + * and the EnviroDIY Development Team + * This example is published under the BSD-3 license. + * + + * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger + * + * DISCLAIMER: + * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. + * ======================================================================= */ + +// ========================================================================== +// Defines for the Arduino IDE +// NOTE: These are ONLY needed to compile with the Arduino IDE. +// If you use PlatformIO, you should set these build flags in your +// platformio.ini +// ========================================================================== +/** Start [defines] */ +#ifndef TINY_GSM_RX_BUFFER +#define TINY_GSM_RX_BUFFER 64 +#endif +#ifndef TINY_GSM_YIELD_MS +#define TINY_GSM_YIELD_MS 2 +#endif +/** End [defines] */ + +// ========================================================================== +// Include the libraries required for any data logger +// ========================================================================== +/** Start [includes] */ +// The Arduino library is needed for every Arduino program. +#include + +// EnableInterrupt is used by ModularSensors for external and pin change +// interrupts and must be explicitly included in the main program. +#include + +// Include the main header for ModularSensors +#include +/** End [includes] */ + + +// ========================================================================== +// Data Logging Options +// ========================================================================== +// Details for this build +extern const String build_ref = "a\\" __FILE__ " " __DATE__ " " __TIME__ " "; +#ifdef PIO_SRC_REV +const char git_branch[] = PIO_SRC_REV; +#else +const char git_branch[] = "brnch"; +#endif +#ifdef PIO_SRC_USR +const char git_usr[] = PIO_SRC_USR; +#else +const char git_usr[] = "usr"; +#endif +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "sensorTest/DRWI_SIM7080LTE.cpp"; +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char* LoggerID = "snsrTst"; +// How frequently (in minutes) to log data +const uint8_t loggingInterval = 2; +// Your logger's timezone. +const int8_t timeZone = -5; // Eastern Standard Time +// NOTE: Daylight savings time will not be applied! Please use standard time! + +// Set the input and output pins for the logger +// NOTE: Use -1 for pins that do not apply +const int32_t serialBaud = 115200; // 57600 Baud rate for debugging +const int8_t greenLED = 8; // Pin for the green LED +const int8_t redLED = 9; // Pin for the red LED +const int8_t buttonPin = 21; // Pin for debugging mode (ie, button pin) +const int8_t wakePin = 31; // MCU interrupt/alarm pin to wake from sleep +// Mayfly 0.x D31 = A7 +const int8_t sdCardPwrPin = -1; // MCU SD card power pin +const int8_t sdCardSSPin = 12; // SD card chip select/slave select pin +const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power +/** End [logging_options] */ + + +// ========================================================================== +// Wifi/Cellular Modem Options +// ========================================================================== +HardwareSerial& modemSerial = Serial1; // Use hardware serial if possible +#if defined STREAMDEBUGGER_DBG +#include +StreamDebugger modemDebugger(modemSerial, STANDARD_SERIAL_OUTPUT); +#define modemSerHw modemDebugger +#else +#define modemSerHw modemSerial +#endif // STREAMDEBUGGER_DBG + +#define sim_com_xbee_wifi +#if defined sim_com_sim7080 +/** Start [sim_com_sim7080] */ + +// For almost anything based on the SIMCom SIM7080G +#include + +// Create a reference to the serial port for the modem +const int32_t modemBaud = 9600; // SIM7080 does auto-bauding by default, but + // for simplicity we set to 9600 + +// Modem Pins - Describe the physical pin connection of your modem to your board +// NOTE: Use -1 for pins that do not apply + +const int8_t modemVccPin = + 18; // MCU pin controlling modem power --- + // Pin 18 is the power enable pin + // for the bee socket on Mayfly v1.0, + // use -1 if using Mayfly 0.5b or if the bee socket is constantly + // powered (ie you changed SJ18 on Mayfly 1.x to 3.3v) +const int8_t modemStatusPin = 19; // MCU pin used to read modem status +const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request +const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem + // status + +// Network connection information +const char* apn = + "hologram"; // APN connection name, typically Hologram unless you have a + // different provider's SIM card. Change as needed + +// Create the modem object +SIMComSIM7080 modem7080(&modemSerHw, modemVccPin, modemStatusPin, + modemSleepRqPin, apn); +// Create an extra reference to the modem by a generic name +SIMComSIM7080 modem = modem7080; +/** End [sim_com_sim7080] */ +#elif defined sim_com_xbee_wifi +/** Start [sim_com_xbee_wifi] */ +// For the Digi Wifi XBee (S6B) +#include +// Create a reference to the serial port for the modem + +const int32_t modemBaud = 9600; // All XBee's use 9600 by default + +// Modem Pins - Describe the physical pin connection of your modem to your board +// NOTE: Use -1 for pins that do not apply +const int8_t modemVccPin = 18; // Mayfly1.1 pin controlling modem power +const int8_t modemStatusPin = 19; // MCU pin used to read modem status +const bool useCTSforStatus = true; // Flag to use the modem CTS pin for status +const int8_t modemResetPin = 20; // MCU pin connected to modem reset pin +const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request +const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem + // status (-1 if unconnected) + +// Network connection information +const char* wifiId = "ArthurGuestSsid"; // WiFi access point, unnecessary for GPRS +const char* wifiPwd = "Arthur8166"; // WiFi password, unnecessary for GPRS + +DigiXBeeWifi modemXBWF(&modemSerHw, modemVccPin, modemStatusPin, + useCTSforStatus, modemResetPin, modemSleepRqPin, wifiId, + wifiPwd); +// Create an extra reference to the modem by a generic name +DigiXBeeWifi modemPhy = modemXBWF; +/** End [sim_com_xbee_wifi] */ +#endif //Modem options + +// ========================================================================== +// Using the Processor as a Sensor +// ========================================================================== +/** Start [processor_sensor] */ +#include + +// Create the main processor chip "sensor" - for general metadata +const char* mcuBoardVersion = "v1.1"; +ProcessorStats mcuBoard(mcuBoardVersion); +/** End [processor_sensor] */ + + +// ========================================================================== +// Maxim DS3231 RTC (Real Time Clock) +// ========================================================================== +/** Start [ds3231] */ +#include + +// Create a DS3231 sensor object +MaximDS3231 ds3231(1); +/** End [ds3231] */ + +//#define SENSORS_EXTERNAL +#if defined SENSORS_EXTERNAL +// ========================================================================== +// Meter Hydros 21 Conductivity, Temperature, and Depth Sensor +// ========================================================================== +/** Start [hydros21] */ +#include + +const char* hydrosSDI12address = "1"; // The SDI-12 Address of the Hydros 21 +const uint8_t hydrosNumberReadings = 6; // The number of readings to average +const int8_t SDI12Power = sensorPowerPin; // Power pin (-1 if unconnected) +const int8_t SDI12Data = 7; // The SDI12 data pin + +// Create a Meter Hydros 21 sensor object +MeterHydros21 hydros(*hydrosSDI12address, SDI12Power, SDI12Data, + hydrosNumberReadings); +/** End [hydros21] */ + + +// ========================================================================== +// Campbell OBS 3 / OBS 3+ Analog Turbidity Sensor +// ========================================================================== +/** Start [obs3] */ +#include + +const int8_t OBS3Power = sensorPowerPin; // Power pin (-1 if unconnected) +const uint8_t OBS3NumberReadings = 10; +const uint8_t ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC +// Campbell OBS 3+ *Low* Range Calibration in Volts +const int8_t OBSLowADSChannel = 0; // ADS channel for *low* range output +const float OBSLow_A = 0.000E+00; // "A" value (X^2) [*low* range] +const float OBSLow_B = 1.000E+00; // "B" value (X) [*low* range] +const float OBSLow_C = 0.000E+00; // "C" value [*low* range] + +// Create a Campbell OBS3+ *low* range sensor object +CampbellOBS3 osb3low(OBS3Power, OBSLowADSChannel, OBSLow_A, OBSLow_B, OBSLow_C, + ADSi2c_addr, OBS3NumberReadings); + + +// Campbell OBS 3+ *High* Range Calibration in Volts +const int8_t OBSHighADSChannel = 1; // ADS channel for *high* range output +const float OBSHigh_A = 0.000E+00; // "A" value (X^2) [*high* range] +const float OBSHigh_B = 1.000E+00; // "B" value (X) [*high* range] +const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] + +// Create a Campbell OBS3+ *high* range sensor object +CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, + OBSHigh_C, ADSi2c_addr, OBS3NumberReadings); +/** End [obs3] */ + +#endif // SENSORS_EXTERNAL +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + #if defined SENSORS_EXTERNAL + new MeterHydros21_Cond(&hydros), + new MeterHydros21_Depth(&hydros), + new MeterHydros21_Temp(&hydros), + new CampbellOBS3_Turbidity(&osb3low, "", "TurbLow"), + new CampbellOBS3_Turbidity(&osb3high, "", "TurbHigh"), + new ProcessorStats_Battery(&mcuBoard), + #endif //SENSORS_EXTERNAL + new MaximDS3231_Temp(&ds3231), + new ProcessorStats_SampleNumber(&mcuBoard), + // Fut Sensiron Temperature + // Fut Sensirom Humidity + //new Modem_SignalPercent(&modem), +}; + +// All UUID's, device registration, and sampling feature information can be +// pasted directly from Monitor My Watershed. +// To get the list, click the "View token UUID list" button on the upper right +// of the site page. + +// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** +// Check the order of your variables in the variable list!!! +// Be VERY certain that they match the order of your UUID's! +// Rearrange the variables in the variable list ABOVE if necessary to match! +// Do not change the order of the variables in the section below. +// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** + +// Replace all of the text in the following section with the UUID array from +// MonitorMyWatershed + +/* clang-format off */ +// --------------------- Beginning of Token UUID List --------------------- + +//Site https://monitormywatershed.org/sites/bq_test01/ +const char* UUIDs[] = // UUID array for device sensors + { + #if defined SENSORS_EXTERNAL + "12345678-abcd-1234-ef00-1234567890ab", // Specific conductance (Meter_Hydros21_Cond) + "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Meter_Hydros21_Depth) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Meter_Hydros21_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (Low) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (High) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + #endif // SENSORS_EXTERNAL + "9fdcefc1-b43f-4c3c-8d46-ca0e90845153", // Temperature (Maxim_DS3231_Temp) + "e0d7b81b-0241-4017-b5dc-e90ecdb7c279", // Sequence number (EnviroDIY_Mayfly_SampleNum) + //"d73e060d-df4e-4f29-8b69-34891f518bdf", // Temperature (Sensirion_SHT40_Temperature) + //"acc456aa-1148-4385-a984-a68b6eb6b044", // Relative humidity (Sensirion_SHT40_Humidity) + //"97893988-6c2d-43ee-9cfe-3715d45019db" // Percent full scale (Digi_Cellular_SignalPercent) +}; +const char* registrationToken = "22752220-5925-4a2c-aeb1-a57b58e1c246"; // Device registration token +const char* samplingFeature = "747478ef-4e80-4cc8-921e-89172d05ea42"; // Sampling feature UUID + + +// ----------------------- End of Token UUID List ----------------------- +/* clang-format on */ + +// Count up the number of pointers in the array +int variableCount = sizeof(variableList) / sizeof(variableList[0]); + +// Create the VariableArray object +VariableArray varArray(variableCount, variableList, UUIDs); +/** End [variable_arrays] */ + + +// ========================================================================== +// The Logger Object[s] +// ========================================================================== +/** Start [loggers] */ +// Create a new logger instance +Logger dataLogger(LoggerID, loggingInterval, &varArray); +/** End [loggers] */ + + +// ========================================================================== +// Creating Data Publisher[s] +// ========================================================================== +/** Start [publishers] */ +// Create a data publisher for the Monitor My Watershed/EnviroDIY POST endpoint +#include +EnviroDIYPublisher EnviroDIYPOST(dataLogger, &modemPhy.gsmClient, + registrationToken, samplingFeature); +/** End [publishers] */ + + +// ========================================================================== +// Working Functions +// ========================================================================== +/** Start [working_functions] */ +// Flashes the LED's on the primary board +void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { + for (uint8_t i = 0; i < numFlash; i++) { + digitalWrite(greenLED, HIGH); + digitalWrite(redLED, LOW); + delay(rate); + digitalWrite(greenLED, LOW); + digitalWrite(redLED, HIGH); + delay(rate); + } + digitalWrite(redLED, LOW); +} + +// Reads the battery voltage +// NOTE: This will actually return the battery level from the previous update! +float getBatteryVoltage() { + if (mcuBoard.sensorValues[0] == -9999) mcuBoard.update(); + return mcuBoard.sensorValues[0]; +} + + +// ========================================================================== +// Arduino Setup Function +// ========================================================================== +/** Start [setup] */ +void setup() { + // Start the primary serial connection + Serial.begin(serialBaud); + Serial.print(F("\n---Boot. Sw Build: ")); + Serial.print(build_ref); + Serial.print(" "); + Serial.println(git_usr); + Serial.print(" "); + Serial.println(git_branch); + + // Print a start-up note to the first serial port + Serial.print(F("\nNow running ")); + Serial.print(sketchName); + Serial.print(F(" on Logger ")); + Serial.println(LoggerID); + Serial.println(); + + Serial.print(F("Using ModularSensors Library version ")); + Serial.println(MODULAR_SENSORS_VERSION); + Serial.print(F("TinyGSM Library version ")); + Serial.println(TINYGSM_VERSION); + Serial.println(); + + // Start the serial connection with the modem + modemSerial.begin(modemBaud); + + // Set up pins for the LED's + pinMode(greenLED, OUTPUT); + digitalWrite(greenLED, LOW); + pinMode(redLED, OUTPUT); + digitalWrite(redLED, LOW); + // Blink the LEDs to show the board is on and starting up + greenredflash(); + + pinMode(20, OUTPUT); // for proper operation of the onboard flash memory + // chip's ChipSelect (Mayfly v1.0 and later) + + // Set the timezones for the logger/data and the RTC + // Logging in the given time zone + Logger::setLoggerTimeZone(timeZone); + // It is STRONGLY RECOMMENDED that you set the RTC to be in UTC (UTC+0) + Logger::setRTCTimeZone(0); + + // Attach the modem and information pins to the logger + dataLogger.attachModem(modemPhy); + modemPhy.setModemLED(modemLEDPin); + dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, + greenLED); + + // Begin the logger + dataLogger.begin(); + + // Note: Please change these battery voltages to match your battery + // Set up the sensors, except at lowest battery level + if (getBatteryVoltage() > 3.4) { + Serial.println(F("Setting up sensors...")); + varArray.setupSensors(); + } + + #if defined sim_com_sim700 + /** Start [setup_sim7080] */ + modem.setModemWakeLevel(HIGH); // ModuleFun Bee inverts the signal + modem.setModemResetLevel(HIGH); // ModuleFun Bee inverts the signal + Serial.println(F("Waking modem and setting Cellular Carrier Options...")); + modem.modemWake(); // NOTE: This will also set up the modem + modem.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! + modem.gsmModem.setNetworkMode(38); // set to LTE only + // 2 Automatic + // 13 GSM only + // 38 LTE only + // 51 GSM and LTE only + modem.gsmModem.setPreferredMode(1); // set to CAT-M + // 1 CAT-M + // 2 NB-IoT + // 3 CAT-M and NB-IoT + /** End [setup_sim7080] */ + #elif defined sim_com_xbee_wifi + /** Start [setup_sim7080] */ + + Serial.println(F("Waking modem WiFi ...")); + modemPhy.modemWake(); // NOTE: This will also set up the modem + modemPhy.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! + #endif //Modem setup + + // Sync the clock if it isn't valid or we have battery to spare + if (getBatteryVoltage() > 3.55 || !dataLogger.isRTCSane()) { + // Synchronize the RTC with NIST + // This will also set up the modem + dataLogger.syncRTC(); + } + + // Create the log file, adding the default header to it + // Do this last so we have the best chance of getting the time correct and + // all sensor names correct + // Writing to the SD card can be power intensive, so if we're skipping + // the sensor setup we'll skip this too. + if (getBatteryVoltage() > 3.4) { + Serial.println(F("Setting up file on SD card")); + dataLogger.turnOnSDcard( + true); // true = wait for card to settle after power up + dataLogger.createLogFile(true); // true = write a new header + dataLogger.turnOffSDcard( + true); // true = wait for internal housekeeping after write + } + + // Call the processor sleep + Serial.println(F("Putting processor to sleep\n")); + dataLogger.systemSleep(); +} +/** End [setup] */ + + +// ========================================================================== +// Arduino Loop Function +// ========================================================================== +/** Start [loop] */ +// Use this short loop for simple data logging and sending +void loop() { + // Note: Please change these battery voltages to match your battery + // At very low battery, just go back to sleep + if (getBatteryVoltage() < 3.4) { + dataLogger.systemSleep(); + } + // At moderate voltage, log data but don't send it over the modem + else if (getBatteryVoltage() < 3.55) { + dataLogger.logData(); + } + // If the battery is good, send the data to the world + else { + dataLogger.logDataAndPublish(); + } +} +/** End [loop] */ From 18257c70567f338a33d724196874d9dfe70094a8 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Wed, 21 Jun 2023 13:13:13 -0700 Subject: [PATCH 23/89] update for Digi WiFi s6b https://github.com/EnviroDIY/ModularSensors/issues/347 --- src/LoggerModem.cpp | 19 +- src/LoggerModem.h | 93 ++++++ src/ModularSensors.h | 6 +- src/modems/DigiXBeeWifi.cpp | 543 ++++++++++++++++++++++++++++-------- src/modems/DigiXBeeWifi.h | 15 + 5 files changed, 557 insertions(+), 119 deletions(-) diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index b44fa8159..48404d67e 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -10,12 +10,16 @@ #include "LoggerModem.h" // Initialize the static members -int16_t loggerModem::_priorRSSI = -9999; -int16_t loggerModem::_priorSignalPercent = -9999; -float loggerModem::_priorModemTemp = -9999; -float loggerModem::_priorBatteryState = -9999; -float loggerModem::_priorBatteryPercent = -9999; -float loggerModem::_priorBatteryVoltage = -9999; +loggerModem::PollModemMetaData_t loggerModem::_pollModemMetaData = + POLL_MODEM_META_DATA_DEF; + +int16_t loggerModem::_priorRSSI = SENSOR_DEFAULT_I; +int16_t loggerModem::_priorSignalPercent = SENSOR_DEFAULT_I; +float loggerModem::_priorModemTemp = SENSOR_DEFAULT_F; +float loggerModem::_priorBatteryState = SENSOR_DEFAULT_F; +float loggerModem::_priorBatteryPercent = SENSOR_DEFAULT_F; +float loggerModem::_priorBatteryVoltage = SENSOR_DEFAULT_F; + // Constructor loggerModem::loggerModem(int8_t powerPin, int8_t statusPin, bool statusLevel, @@ -305,6 +309,9 @@ void loggerModem::setModemPinModes(void) { } +void loggerModem::pollModemMetadata(PollModemMetaData_t status) { + _pollModemMetaData = status; +} bool loggerModem::updateModemMetadata(void) { bool success = true; diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 2b2c7b116..3564e1781 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -989,6 +989,99 @@ class loggerModem { // modemType gsmModem; // modemClientType gsmClient; + + /** + * @brief The retreived modem paramters + * + */ + String _modemHwVersion; + String _modemSerialNumber; + String _modemFwVersion; + + /** + * @brief Get a printable description of the modem. + * + * + * @note These values are polled for and cached in memory till needed + * + * @return *string discritption of modem. + */ + String getModemDevId(void) + {return _modemName+F(" Sn ")+_modemSerialNumber+F(" HwVer " )+_modemHwVersion+F(" FwVer ")+_modemFwVersion;} + + /** + * @brief modem management data setup + * + * Set in setup() + * + * @param status type of default polling + */ +#if !defined POLL_MODEM_META_DATA_ON +#define POLL_MODEM_META_DATA_ALL 0xFF +#endif // POLL_MODEM_META_DATA_ON + typedef enum { + POLL_MODEM_META_DATA_OFF = 0x0, + POLL_MODEM_META_DATA_RSSI = 0x01, + POLL_MODEM_META_DATA_VCC = 0x02, + POLL_MODEM_META_DATA_TEMP = 0x04, + POLL_MODEM_META_DATA_PARM4 = 0x08, + POLL_MODEM_META_DATA_PARM5 = 0x010, + POLL_MODEM_META_DATA_DEF = POLL_MODEM_META_DATA_ALL, + } PollModemMetaData_t; + /** + * @brief poll modem meta data + * + * Set polling status. + * Default won't poll + */ + void pollModemMetadata(PollModemMetaData_t status = POLL_MODEM_META_DATA_DEF); + + /** + * @brief return state of modem poll and what to poll for + * + * Set polling status. + * @param status return poll status ~ one of PollModemMetaData_t + */ + uint8_t getModemMetadata() { + return _pollModemMetaData; + } + + +#if not defined SENSOR_DEFAULT_I +#define SENSOR_DEFAULT_I -1 +// old standard -9999 +#endif // SENSOR_DEFAULT + +#if not defined SENSOR_DEFAULT_F +#define SENSOR_DEFAULT_F -0.0099 +// old standard -9999 +#endif // SENSOR_DEFAULT + +public: + /** + * @brief Set the power pin. + * + * If this function is not called, the power pin is defined on init + * + * @param powerPin The arduino pin number or if none <0 . + */ + inline void setPowerPin(int8_t powerPin) {_powerPin = powerPin;} + + /** + * @brief get the power pin. + * + * @returns powerPin + */ + inline int8_t getPowerPin() {return _powerPin;} + + protected: + /** + * @brief poll the modem management data + * + * Set in the init() portion of the #modemSetup(). + */ + PollModemMetaData_t static _pollModemMetaData; + }; // typedef float (loggerModem::_*loggerGetValueFxn)(void); diff --git a/src/ModularSensors.h b/src/ModularSensors.h index 32fe3c74b..a23778a70 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -13,8 +13,12 @@ /** * @brief The current library version number + * https://semver.org/ + * Add hypen '-' and alpha number for a branches unique tracking number + * A pre-release version will always be indeiciated as slightly ahead + * of the envirodiy branch that it is based on. */ -#define MODULAR_SENSORS_VERSION "0.34.0" +#define MODULAR_SENSORS_VERSION "0.34.1-iss347a" // To get all of the base classes for ModularSensors, include LoggerBase. // NOTE: Individual sensor definitions must be included separately. diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index cb782f0bf..9392f75b1 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -35,7 +35,21 @@ DigiXBeeWifi::~DigiXBeeWifi() {} MS_IS_MODEM_AWAKE(DigiXBeeWifi); MS_MODEM_WAKE(DigiXBeeWifi); -MS_MODEM_CONNECT_INTERNET(DigiXBeeWifi); +// MS_MODEM_CONNECT_INTERNET(DigiXBeeWifi); has instability +// See https://github.com/neilh10/ModularSensors/issues/125 +bool DigiXBeeWifi::connectInternet(uint32_t maxConnectionTime) { + MS_START_DEBUG_TIMER + MS_DBG(F("\nDigiXbee Attempting to connect to WiFi network...")); + if (!(gsmModem.isNetworkConnected())) { + if (!gsmModem.waitForNetwork(maxConnectionTime)) { + PRINTOUT(F("... WiFi connection failed")); + return false; + } + } + MS_DBG(F("... WiFi connected after"), MS_PRINT_DEBUG_TIMER, + F("milliseconds!")); + return true; +} MS_MODEM_IS_INTERNET_AVAILABLE(DigiXBeeWifi); MS_MODEM_GET_MODEM_BATTERY_DATA(DigiXBeeWifi); @@ -46,90 +60,250 @@ bool DigiXBeeWifi::extraModemSetup(void) { /** First run the TinyGSM init() function for the XBee. */ MS_DBG(F("Initializing the XBee...")); success &= gsmModem.init(); + if (!success) { MS_DBG(F("Failed init")); } gsmClient.init(&gsmModem); _modemName = gsmModem.getModemName(); /** Then enter command mode to set pin outputs. */ - MS_DBG(F("Putting XBee into command mode...")); if (gsmModem.commandMode()) { - MS_DBG(F("Setting I/O Pins...")); - /** Enable pin sleep functionality on `DIO9`. - * NOTE: Only the `DTR_N/SLEEP_RQ/DIO8` pin (9 on the bee socket) can be - * used for this pin sleep/wake. */ - gsmModem.sendAT(GF("D8"), 1); + String xbeeSnLow,xbeeSnHigh;//XbeeDevHwVer,XbeeFwVer; + gsmModem.getSeries(); + _modemName = gsmModem.getModemName(); + gsmModem.sendAT(F("SL")); // Request Module MAC/Serial Number Low + gsmModem.waitResponse(1000, xbeeSnLow); + gsmModem.sendAT(F("SH")); // Request Module MAC/Serial Number High + gsmModem.waitResponse(1000, xbeeSnHigh); + _modemSerialNumber = xbeeSnHigh+xbeeSnLow; + gsmModem.sendAT(F("HV")); // Request Module Hw Version + gsmModem.waitResponse(1000, _modemHwVersion); + gsmModem.sendAT(F("VR")); // Firmware Version + gsmModem.waitResponse(1000, _modemFwVersion); + PRINTOUT(F("XbeeWiFi internet comms with"),_modemName, + F("Mac/Sn "), _modemSerialNumber,F("HwVer"),_modemHwVersion, F("FwVer"), _modemFwVersion); + + // Leave all unused pins disconnected. Use the PR command to pull all of + // the inputs on the device high using 40 k internal pull-up resistors. + // You do not need a specific treatment for unused outputs. + // Mask Bit Description + // 1 0001 0 TH11 DIO4 + // 1 0002 1 TH17 DIO3 + // 1 0004 2 TH18 DIO2 + // 1 0008 3 TH19 DIO1 + // 1 0010 4 TH20 DIO0 + // 1 0020 5 TH16 DIO6/RTS + // 0 0040 6 TH09 DIO8/DTR/Sleep Request + // 0 0080 7 TH03 DIN + // 1 0100 8 TH15 DIO5/Associate + // 0 0200 9 TH13 DIO9/- OnSLEEP + // 1 0400 10 TH04 DIO12 + // 1 0800 11 TH06 DIO10/PWM RSSI + // 1 1000 12 TH07 DIO11/PWM1 + // 1 2000 13 TH12 DIO7/-CTR + // 0 4000 14 TH02 DIO13/DOUT + // 3D3F + gsmModem.sendAT(GF("PR"), "3D3F"); success &= gsmModem.waitResponse() == 1; - /** Enable status indication on `DIO9` - it will be HIGH when the XBee - * is awake. - * NOTE: Only the `ON/SLEEP_N/DIO9` pin (13 on the bee socket) can be - * used for direct status indication. */ - gsmModem.sendAT(GF("D9"), 1); + if (!success) { MS_DBG(F("Fail PR "), success); } +#if !defined MODEMPHY_NEVER_SLEEPS +#define XBEE_SLEEP_SETTING 1 +#define XBEE_SLEEP_ASSOCIATE 100 +#else +#define XBEE_SLEEP_SETTING 0 +#define XBEE_SLEEP_ASSOCIATE 40 +#endif // MODEMPHY_NEVER_SLEEPS + // To use sleep pins they physically need to be enabled. + // Set DIO8 to be used for sleep requests + // NOTE: Only pin 9/DIO8/DTR can be used for this function + gsmModem.sendAT(GF("D8"), XBEE_SLEEP_SETTING); success &= gsmModem.waitResponse() == 1; - /** Enable CTS on `DIO7` - it will be `LOW` when it is clear to send - * data to the XBee. This can be used as proxy for status indication if - * that pin is not readable. - * NOTE: Only the `CTS_N/DIO7` pin (12 on the bee socket) can be used - * for CTS. */ - gsmModem.sendAT(GF("D7"), 1); + // Turn on status indication pin - it will be HIGH when the XBee is + // awake NOTE: Only pin 13/ON/SLEEPnot/DIO9 can be used for this + // function + gsmModem.sendAT(GF("D9"), XBEE_SLEEP_SETTING); success &= gsmModem.waitResponse() == 1; - /** Enable association indication on `DIO5` - this is should be directly - * attached to an LED if possible. - * - Solid light indicates no connection - * - Single blink indicates connection - * - double blink indicates connection but failed TCP link on last - * attempt - * - * NOTE: Only the `Associate/DIO5` pin (15 on the bee socket) can be - * used for this function. */ - gsmModem.sendAT(GF("D5"), 1); + if (!success) { MS_DBG(F("Fail D9 "), success); } /**/ + // /#endif //MODEMPHY_USE_SLEEP_PINS_SETTING + // Turn on CTS pin - it will be LOW when the XBee is ready to receive + // commands This can be used as proxy for status indication if the true + // status pin is not accessible NOTE: Only pin 12/DIO7/CTS can be used + // for this function + /*gsmModem.sendAT(GF("D7"),1); success &= gsmModem.waitResponse() == 1; - /** Enable RSSI PWM output on `DIO10` - this should be directly attached - * to an LED if possible. A higher PWM duty cycle (and thus brighter - * LED) indicates better signal quality. - * NOTE: Only the `DIO10/PWM0` pin (6 on the bee socket) can be used for - * this function. */ - gsmModem.sendAT(GF("P0"), 1); + if (!success) {MS_DBG(F("Fail D7 "),success);}*/ + // Turn on the associate LED (if you're using a board with one) + // NOTE: Only pin 15/DIO5 can be used for this function + // gsmModem.sendAT(GF("D5"),1); + // success &= gsmModem.waitResponse() == 1; + // Turn on the RSSI indicator LED (if you're using a board with one) + // NOTE: Only pin 6/DIO10/PWM0 can be used for this function + // gsmModem.sendAT(GF("P0"),1); + // success &= gsmModem.waitResponse() == 1; + // Set to TCP mode + gsmModem.sendAT(GF("IP"), 1); success &= gsmModem.waitResponse() == 1; - /** Enable pin sleep on the XBee. */ + if (!success) { MS_DBG(F("Fail IP "), success); } + + // Put the XBee in pin sleep mode in conjuction with D8=1 MS_DBG(F("Setting Sleep Options...")); - gsmModem.sendAT(GF("SM"), 1); + gsmModem.sendAT(GF("SM"), XBEE_SLEEP_SETTING); success &= gsmModem.waitResponse() == 1; - /** Disassociate from the network for the lowest power deep sleep. */ - gsmModem.sendAT(GF("SO"), 200); + // Disassociate from network for lowest power deep sleep + // 40 - Aay associated with AP during sleep - draws more current + // (+10mA?) 100 -Cyclic sleep ST specifies time before reutnring to + // sleep 200 - SRGD magic number + gsmModem.sendAT(GF("SO"), XBEE_SLEEP_ASSOCIATE); success &= gsmModem.waitResponse() == 1; + MS_DBG(F("Setting Wifi Network Options...")); - /** Set the socket timeout to 10s (this is default). */ + // Put the network connection parameters into flash + success &= gsmModem.networkConnect(_ssid, _pwd); + // Set the socket timeout to 10s (this is default) + if (!success) { + MS_DBG(F("Fail Connect "), success); + success = true; + } gsmModem.sendAT(GF("TM"), 64); success &= gsmModem.waitResponse() == 1; - /** Save the network connection parameters. */ - success &= gsmModem.networkConnect(_ssid, _pwd); - MS_DBG(F("Ensuring XBee is in transparent mode...")); - /* Make sure we're really in transparent mode. */ - gsmModem.sendAT(GF("AP0")); + //IPAddress newHostIp = IPAddress(0, 0, 0, 0); //default in NV + gsmModem.sendAT(GF("DL"), GF("0.0.0.0")); success &= gsmModem.waitResponse() == 1; - /** Write all changes to flash and apply them. */ - MS_DBG(F("Applying changes...")); + + + if (success) { + MS_DBG(F("Setup Wifi Network "), _ssid); + } else { + MS_DBG(F("Failed Setting WiFi"), _ssid); + } + // Write changes to flash and apply them gsmModem.writeChanges(); - /** Finally, exit command mode. */ - gsmModem.exitCommand(); - /** Force restart the modem to make sure all settings take. */ - MS_DBG(F("Restarting XBee...")); - success &= gsmModem.restart(); + + // Scan for AI last node join request + uint16_t loops = 0; + int16_t ui_db; + uint8_t status; + String ui_op; + bool apRegistered = false; + PRINTOUT(F("Loop=Sec] rx db : Status #Polled Status every 1sec/30sec")); + uint8_t reg_count = 0; + #define TIMER_POLL_AP_STATUS_MSEC 300000 + for (unsigned long start = millis(); millis() - start < 300000; + loops++) { + ui_db = 0; // gsmModem.getSignalQuality(); + gsmModem.sendAT(GF("AI")); + status = gsmModem.readResponseInt(10000L); + ui_op = String(loops) + "=" + String((float)millis() / 1000) + + "] " + String(ui_db) + ":0x" + String(status, HEX); + if (0 == status) { + ui_op += " Cnt=" + String(reg_count); +#define XBEE_SUCCESS_CNTS 3 + if (++reg_count > XBEE_SUCCESS_CNTS) { + PRINTOUT(ui_op); + apRegistered = true; + break; + } + } else { + reg_count =0; //reset + } + PRINTOUT(ui_op); + //Need to pet the watchDog as 8sec timeout ~ but how, LoggerBase::petDog() + delay(1000); + } + if (apRegistered) + { + MS_DBG(F("Get IP number")); + String xbeeRsp; + uint8_t index = 0; + bool AllocatedIpSuccess = false; +// Checkfor IP allocation +#define MDM_IP_STR_MIN_LEN 7 +#define MDM_LP_IPMAX 16 + for (int mdm_lp = 1; mdm_lp <= MDM_LP_IPMAX; mdm_lp++) { + delay(mdm_lp * 500); + gsmModem.sendAT(F("MY")); // Request IP # + index = gsmModem.waitResponse(1000, xbeeRsp); + MS_DBG(F("mdmIP["), mdm_lp, "/", MDM_LP_IPMAX, F("] '"), + xbeeRsp, "'=", xbeeRsp.length()); + if (0 != xbeeRsp.compareTo("0.0.0.0") && + (xbeeRsp.length() > MDM_IP_STR_MIN_LEN)) { + AllocatedIpSuccess = true; + break; + } + xbeeRsp = ""; + } + if (!AllocatedIpSuccess) { + PRINTOUT( + F("XbeeWiFi not received IP# -hope it works next time")); + // delay(1000); + // NVIC_SystemReset(); + success = false; + } else { + // success &= AllocatedIpSuccess; + PRINTOUT(F("XbeeWiFi IP# ["), xbeeRsp, F("]")); + xbeeRsp = ""; + // Display DNS allocation + bool DnsIpSuccess = false; +#define MDM_LP_DNSMAX 11 + for (int mdm_lp = 1; mdm_lp <= MDM_LP_DNSMAX; mdm_lp++) { + delay(mdm_lp * 500); + gsmModem.sendAT(F("NS")); // Request DNS # + index &= gsmModem.waitResponse(1000, xbeeRsp); + MS_DBG(F("mdmDNS["), mdm_lp, "/", MDM_LP_DNSMAX, F("] '"), + xbeeRsp, "'"); + if (0 != xbeeRsp.compareTo("0.0.0.0") && + (xbeeRsp.length() > MDM_IP_STR_MIN_LEN)) { + DnsIpSuccess = true; + break; + } + xbeeRsp = ""; + } + + if (false == DnsIpSuccess) { + success = false; + PRINTOUT(F( + "XbeeWifi init test FAILED - hope it works next time")); + } else { + PRINTOUT(F("XbeeWifi init test PASSED")); + } + } +#if 0 // defined MS_DIGIXBEEWIFI_DEBUG + // as of 0.23.15 the modem as sensor has problems + int16_t rssi, percent; + getModemSignalQuality(rssi, percent); + MS_DBG(F("mdmSQ["),toAscii(rssi),F(","),percent,F("%]")); +#endif // MS_DIGIXBEEWIFI_DEBUG + gsmModem.exitCommand(); + } + else + { // !apRegistered could be invalid SSID, no SSID, or stuck module + PRINTOUT(F( + "XbeeWiFi AP not Registered - reseting module, hope it works " + "next time")); + loggerModem::modemHardReset(); + delay(50); + // NVIC_SystemReset(); + success = false; + } } else { success = false; } - if (success) { - MS_DBG(F("... setup successful!")); - } else { - MS_DBG(F("... setup failed!")); - } + if (false == success) { PRINTOUT(F("Xbee '"), _modemName, F("' failed.")); } + return success; } void DigiXBeeWifi::disconnectInternet(void) { - // Wifi XBee doesn't like to disconnect AT ALL, so we're doing nothing - // If you do disconnect, you must power cycle before you can reconnect - // to the same access point. + // Ensure Wifi XBee IP socket torn down by forcing connection to localhost IP + // For A XBee S6B bug, then force restart + // Note: TinyGsmClientXbee.h:modemStop() had a hack for closing socket with Timeout=0 "TM0" for S6B disabled + + String oldRemoteIp = gsmClient.remoteIP(); + IPAddress newHostIp = IPAddress(127, 0, 0, 1); //localhost + gsmClient.connect(newHostIp,80); + //??gsmClient.modemConnect(newHostpP,80);// doesn't work + MS_DBG(gsmModem.getBeeName(), oldRemoteIp, F(" disconnectInternet set to "),gsmClient.remoteIP()); + + gsmModem.restart(); } @@ -144,7 +318,12 @@ uint32_t DigiXBeeWifi::getNISTTime(void) { gsmClient.stop(); // Try up to 12 times to get a timestamp from NIST - for (uint8_t i = 0; i < 12; i++) { +#if !defined NIST_SERVER_RETRYS +#define NIST_SERVER_RETRYS 4 +#endif // NIST_SERVER_RETRYS + String nistIpStr; + __attribute__((unused)) uint8_t index = 0; + for (uint8_t i = 0; i < NIST_SERVER_RETRYS; i++) { // Must ensure that we do not ping the daylight more than once every 4 // seconds. NIST clearly specifies here that this is a requirement for // all software that accesses its servers: @@ -161,8 +340,41 @@ uint32_t DigiXBeeWifi::getNISTTime(void) { // XBee's address lookup falters on time.nist.gov // NOTE: This "connect" only sets up the connection parameters, the TCP // socket isn't actually opened until we first send data (the '!' below) - IPAddress ip(132, 163, 97, 6); - connectionMade = gsmClient.connect(ip, 37); + + // Uses "TIME" protocol on port 37 NIST: This protocol is expensive, since it + // uses the complete tcp machinery to transmit only 32 bits of data. + // FUTURE Users are *strongly* encouraged to upgrade to the network time protocol + // (NTP), which is both more accurate and more robust.*/ +#define TIME_PROTOCOL_PORT 37 +#define IP_STR_LEN 18 + const char ipAddr[NIST_SERVER_RETRYS][IP_STR_LEN] = { + {"132,163, 97, 1"}, + {"132, 163, 97, 2"}, + {"132, 163, 97, 3"}, + {"132, 163, 97, 4"}}; + IPAddress ip1(132, 163, 97, 1); // Initialize +#if 0 + gsmModem.sendAT(F("time-e-wwv.nist.gov")); + index = gsmModem.waitResponse(4000, nistIpStr); + nistIpStr.trim(); + uint16_t nistIp_len = nistIpStr.length(); + if ((nistIp_len < 7) || (nistIp_len > 20)) + { + ip1.fromString(ipAddr[i]); + MS_DBG(F("Bad lookup"), nistIpStr, "'=", nistIp_len, F(" Using "), + ipAddr[i]); + } else { + ip1.fromString(nistIpStr); + PRINTOUT(F("Good lookup mdmIP["), i, "/", NIST_SERVER_RETRYS, + F("] '"), nistIpStr, "'=", nistIp_len); + } +#else + ip1.fromString(ipAddr[i]); + PRINTOUT(F("NIST lookup mdmIP["), i, "/", NIST_SERVER_RETRYS, + F("] with "), ip1); +// F("] with "), ipAddr[i]); +#endif + connectionMade = gsmClient.connect(ip1, TIME_PROTOCOL_PORT); // Need to send something before connection is made gsmClient.println('!'); @@ -206,20 +418,18 @@ bool DigiXBeeWifi::getModemSignalQuality(int16_t& rssi, int16_t& percent) { // XBee's address lookup falters on time.nist.gov // NOTE: This "connect" only sets up the connection parameters, the TCP // socket isn't actually opened until we first send data (the '!' below) - IPAddress ip(132, 163, 97, 6); - gsmClient.connect(ip, 37); + // IPAddress ip(132, 163, 97, 6); + // gsmClient.connect(ip, 37); // Wait so NIST doesn't refuse us! - while (millis() < _lastNISTrequest + 4000) { - // wait - } + //while (millis() < _lastNISTrequest + 4000) {} // Need to send something before connection is made - gsmClient.println('!'); - uint32_t start = millis(); - delay(100); // Need this delay! Can get away with 50, but 100 is safer. - while (gsmClient && gsmClient.available() < 4 && millis() - start < 5000L) { - // wait - } + //gsmClient.println('!'); + //uint32_t start = millis(); + //delay(100); // Need this delay! Can get away with 50, but 100 is safer. + //while (gsmClient && gsmClient.available() < 4 && millis() - start < 5000L) { + //} + // Assume measurement from previous connection // Get signal quality // NOTE: We can't actually distinguish between a bad modem response, no // modem response, and a real response from the modem of no service/signal. @@ -246,52 +456,161 @@ bool DigiXBeeWifi::updateModemMetadata(void) { bool success = true; // Unset whatever we had previously - loggerModem::_priorRSSI = -9999; - loggerModem::_priorSignalPercent = -9999; - loggerModem::_priorBatteryState = -9999; - loggerModem::_priorBatteryPercent = -9999; - loggerModem::_priorBatteryPercent = -9999; - loggerModem::_priorModemTemp = -9999; + loggerModem::_priorRSSI = SENSOR_DEFAULT_I; + loggerModem::_priorSignalPercent = SENSOR_DEFAULT_I; + loggerModem::_priorBatteryState = SENSOR_DEFAULT_I; + loggerModem::_priorBatteryPercent = SENSOR_DEFAULT_I; + loggerModem::_priorBatteryPercent = SENSOR_DEFAULT_I; + loggerModem::_priorModemTemp = SENSOR_DEFAULT_F; // Initialize variable - int16_t rssi = -9999; - int16_t percent = -9999; - uint16_t volt = 9999; - - // Try up to 5 times to get a signal quality - that is, ping NIST 5 times - // and see if the value updates - int8_t num_pings_remaining = 5; - do { - getModemSignalQuality(rssi, percent); - MS_DBG(F("Raw signal quality:"), rssi); - if (percent != 0 && percent != -9999) break; - num_pings_remaining--; - } while ((percent == 0 || percent == -9999) && num_pings_remaining); + int16_t rssi = SENSOR_DEFAULT_I; + // int16_t percent = SENSOR_DEFAULT_I; +#define XBEE_V_KEY 9999 + uint16_t volt_mV = XBEE_V_KEY; + + // if not enabled don't collect data + if (0 == loggerModem::_pollModemMetaData) { + MS_DBG(F("updateModemMetadata None to update")); + return false; + } + // Enter command mode only once for temp and battery + MS_DBG(F("updateModemMetadata Entering Command Mode:")); + success &= gsmModem.commandMode(); + if (POLL_MODEM_META_DATA_RSSI & loggerModem::_pollModemMetaData) { + // Assume a signal has already been established. + // Try to get a valid signal quality + // NOTE: We can't actually distinguish between a bad modem response, no + // modem response, and a real response from the modem of no + // service/signal. The TinyGSM getSignalQuality function returns the + // same "no signal" value (99 CSQ or 0 RSSI) in all 3 cases. Try up to 5 + // times to get a signal quality - that is, ping NIST 5 times and see if + // the value updates + int8_t num_trys_remaining = 5; + do { + rssi = gsmModem.getSignalQuality(); + MS_DBG(F("Raw signal quality("), num_trys_remaining, F("):"), rssi); + if (rssi != 0 && rssi != SENSOR_DEFAULT_I) break; + num_trys_remaining--; + } while ((rssi == 0 || rssi == SENSOR_DEFAULT_I) && num_trys_remaining); + + + loggerModem::_priorSignalPercent = getPctFromRSSI(rssi); + MS_DBG(F("CURRENT Percent signal strength:"), + loggerModem::_priorSignalPercent); + + loggerModem::_priorRSSI = rssi; + MS_DBG(F("CURRENT RSSI:"), rssi); + } + if (POLL_MODEM_META_DATA_VCC & loggerModem::_pollModemMetaData) { + // MS_DBG(F("Getting input voltage:")); + volt_mV = gsmModem.getBattVoltage(); + MS_DBG(F("CURRENT Modem battery (mV):"), volt_mV); + if (volt_mV != XBEE_V_KEY) { + loggerModem::_priorBatteryVoltage = + static_cast(volt_mV / 1000); + } else { + loggerModem::_priorBatteryVoltage = + static_cast(SENSOR_DEFAULT_I); + } + } + if (POLL_MODEM_META_DATA_TEMP & loggerModem::_pollModemMetaData) { + // MS_DBG(F("Getting chip temperature:")); + loggerModem::_priorModemTemp = getModemChipTemperature(); + MS_DBG(F("CURRENT Modem temperature(C):"), + loggerModem::_priorModemTemp); + } + // Exit command modem + MS_DBG(F("updateModemMetadata Leaving Command Mode:")); + gsmModem.exitCommand(); - // Convert signal quality to RSSI - loggerModem::_priorRSSI = rssi; - loggerModem::_priorSignalPercent = percent; + ++updateModemMetadata_cnt; + if (0 == rssi || (XBEE_RESET_THRESHOLD <= updateModemMetadata_cnt)) { + updateModemMetadata_cnt = 0; + /** Since not giving an rssi value, restart the modem for next time. + * This is likely to take over 2 seconds */ + PRINTOUT(F("updateModemMetadata forcing restart xbee...")); + success &= gsmModem.restart(); + } + return success; +} - // Enter command mode only once for temp and battery - MS_DBG(F("Entering Command Mode:")); - success &= gsmModem.commandMode(); - MS_DBG(F("Getting input voltage:")); - volt = gsmModem.getBattVoltage(); - MS_DBG(F("CURRENT Modem input battery voltage:"), volt); - if (volt != 9999) - loggerModem::_priorBatteryVoltage = static_cast(volt); - else - loggerModem::_priorBatteryVoltage = static_cast(-9999); +// Az extensions +void DigiXBeeWifi::setWiFiId(const char* newSsid, bool copyId) { + uint8_t newSsid_sz = strlen(newSsid); + _ssid = newSsid; + if (copyId) { +/* Do size checks, allocate memory for the LoggerID, copy it there + * then set assignment. + */ +#define WIFI_SSID_MAX_sz 32 + if (newSsid_sz > WIFI_SSID_MAX_sz) { + char* WiFiId2 = (char*)newSsid; + PRINTOUT(F("\n\r LoggerModem:setWiFiId too long: Trimmed to "), + newSsid_sz); + WiFiId2[newSsid_sz] = 0; // Trim max size + newSsid_sz = WIFI_SSID_MAX_sz; + } + if (NULL == _ssid_buf) { + _ssid_buf = new char[newSsid_sz + 2]; // Allow for trailing 0 + } else { + PRINTOUT(F("\nLoggerModem::setWiFiId error - expected NULL ptr")); + } + if (NULL == _ssid_buf) { + // Major problem + PRINTOUT(F("\nLoggerModem::setWiFiId error -no buffer "), + _ssid_buf); + } else { + strcpy(_ssid_buf, newSsid); + _ssid = _ssid_buf; + //_ssid2 = _ssid_buf; + } + MS_DBG(F("\nsetWiFiId cp "), _ssid, " sz: ", newSsid_sz); + } +} - MS_DBG(F("Getting chip temperature:")); - loggerModem::_priorModemTemp = getModemChipTemperature(); - MS_DBG(F("CURRENT Modem temperature:"), loggerModem::_priorModemTemp); +void DigiXBeeWifi::setWiFiPwd(const char* newPwd, bool copyId) { + uint8_t newPwd_sz = strlen(newPwd); + _pwd = newPwd; - // Exit command modem - MS_DBG(F("Leaving Command Mode:")); - gsmModem.exitCommand(); + if (copyId) { +/* Do size checks, allocate memory for the LoggerID, copy it there + * then set assignment. + */ +#define WIFI_PWD_MAX_sz 63 // Len 63 printable chars + 0 + if (newPwd_sz > WIFI_PWD_MAX_sz) { + char* pwd2 = (char*)newPwd; + PRINTOUT(F("\n\r LoggerModem:setWiFiPwd too long: Trimmed to "), + newPwd_sz); + pwd2[newPwd_sz] = 0; // Trim max size + newPwd_sz = WIFI_PWD_MAX_sz; + } + if (NULL == _pwd_buf) { + _pwd_buf = new char[newPwd_sz + 2]; // Allow for trailing 0 + } else { + PRINTOUT(F("\nLoggerModem::setWiFiPwd error - expected NULL ptr")); + } + if (NULL == _pwd_buf) { + // Major problem + PRINTOUT(F("\nLoggerModem::setWiFiPwd error -no buffer "), + _pwd_buf); + } else { + strcpy(_pwd_buf, newPwd); + _pwd = _pwd_buf; + } + MS_DEEP_DBG(F("\nsetWiFiPwd cp "), _ssid, " sz: ", newPwd_sz); + } +} - return success; +String DigiXBeeWifi::getWiFiId(void) { + return _ssid; +} +String DigiXBeeWifi::getWiFiPwd(void) { + return _pwd; } +//If needed can provide specific information +//String DigiXBeeWifi::getModemDevId(void) {return "DigiXbeeWiFiId";} + + diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index 1354addea..5d7a31106 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -128,6 +128,12 @@ class DigiXBeeWifi : public DigiXBee { bool updateModemMetadata(void) override; + // Access Management + void setWiFiId(const char* WiFiId, bool copyId = false); + void setWiFiPwd(const char* WiFiPwd, bool copyId = false); + String getWiFiId(void); + String getWiFiPwd(void); + #ifdef MS_DIGIXBEEWIFI_DEBUG_DEEP StreamDebugger _modemATDebugger; #endif @@ -158,6 +164,15 @@ class DigiXBeeWifi : public DigiXBee { private: const char* _ssid; const char* _pwd; + + // Access Management + char* _ssid_buf = NULL; + char* _pwd_buf = NULL; + + uint16_t updateModemMetadata_cnt = 0; + //This causes the Xbee to reset afte this number of transmission attempts +#define XBEE_RESET_THRESHOLD 4 + }; /**@}*/ #endif // SRC_MODEMS_DIGIXBEEWIFI_H_ From b4eca912e547909c6f7dff40aaee83637f83bda1 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 10:32:13 -0400 Subject: [PATCH 24/89] Bump SHT dependecy Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 2 +- library.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index d64492000..2e7be5caa 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -164,7 +164,7 @@ "owner": "adafruit", "library id": "11710", "url": "https://github.com/adafruit/Adafruit_SHT4X", - "version": "~1.0.2", + "version": "~1.0.4", "note": "Sensirion SHT4x Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino" diff --git a/library.json b/library.json index 58ec993c2..52d5f9fbe 100644 --- a/library.json +++ b/library.json @@ -225,7 +225,7 @@ "owner": "adafruit", "library id": "11710", "url": "https://github.com/adafruit/Adafruit_SHT4X", - "version": "~1.0.2", + "version": "~1.0.4", "note": "Sensirion SHT4x Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino" From 9ba15db313ef76234f66e7ad2575a53d1874a00a Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 10:59:25 -0400 Subject: [PATCH 25/89] removed extra a and sensor tests folders Signed-off-by: Sara Damiano --- a/DRWI_SIM7080LTE/.clang-format | 127 ----- a/DRWI_SIM7080LTE/.gitignore | 109 ---- a/DRWI_SIM7080LTE/ReadMe.md | 2 - a/DRWI_SIM7080LTE/platformio.ini | 119 ----- a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp | 497 ------------------ sensors_test/DRWI_SIM7080LTE/.clang-format | 127 ----- sensors_test/DRWI_SIM7080LTE/.gitignore | 110 ---- sensors_test/DRWI_SIM7080LTE/ReadMe.md | 43 -- .../DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp | 497 ------------------ 9 files changed, 1631 deletions(-) delete mode 100644 a/DRWI_SIM7080LTE/.clang-format delete mode 100644 a/DRWI_SIM7080LTE/.gitignore delete mode 100644 a/DRWI_SIM7080LTE/ReadMe.md delete mode 100644 a/DRWI_SIM7080LTE/platformio.ini delete mode 100644 a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp delete mode 100644 sensors_test/DRWI_SIM7080LTE/.clang-format delete mode 100644 sensors_test/DRWI_SIM7080LTE/.gitignore delete mode 100644 sensors_test/DRWI_SIM7080LTE/ReadMe.md delete mode 100644 sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp diff --git a/a/DRWI_SIM7080LTE/.clang-format b/a/DRWI_SIM7080LTE/.clang-format deleted file mode 100644 index 6e42a7597..000000000 --- a/a/DRWI_SIM7080LTE/.clang-format +++ /dev/null @@ -1,127 +0,0 @@ ---- -Language: Cpp -# BasedOnStyle: Google -AccessModifierOffset: -3 -AlignAfterOpenBracket: Align -AlignConsecutiveMacros: false -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: true -AlignEscapedNewlines: Left -AlignOperands: false -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: Always -AllowShortCaseLabelsOnASingleLine: true -AllowShortEnumsOnASingleLine: true -AllowShortFunctionsOnASingleLine: Empty -AllowShortIfStatementsOnASingleLine: WithoutElse -AllowShortLambdasOnASingleLine: All -AllowShortLoopsOnASingleLine: true -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: true -BinPackParameters: true -BreakAfterJavaFieldAnnotations: false -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakInheritanceList: BeforeColon -BreakStringLiterals: true -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -EmptyLineAfterAccessModifier: Leave -EmptyLineBeforeAccessModifier: Leave -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IncludeBlocks: Preserve -IncludeCategories: - - Regex: 'TinyGsmClient.h' - Priority: -1 - - Regex: 'VariableBase.h' - Priority: -1 - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - - Regex: '.*' - Priority: 1 -IncludeIsMainRegex: '([-_](test|unittest))?$' -IndentAccessModifiers: false -IndentCaseBlocks: false -IndentCaseLabels: true -IndentExternBlock: Indent -IndentGotoLabels: true -IndentPPDirectives: None -IndentWidth: 4 -IndentWrappedFunctionNames: false -InsertTrailingCommas: None -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 2 -NamespaceIndentation: None -# ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PackConstructorInitializers: CurrentLine -PenaltyBreakAssignment: 25 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 600 -PenaltyReturnTypeOnItsOwnLine: 50 -PointerAlignment: Left -PointerBindsToType: true -QualifierAlignment: Left -ReferenceAlignment: Left -ReflowComments: true -SeparateDefinitionBlocks: Leave -SortIncludes: false -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 2 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInConditionalStatement: false -SpacesInLineCommentPrefix: - Minimum: 1 -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp11 -TabWidth: 4 -UseTab: Never ---- diff --git a/a/DRWI_SIM7080LTE/.gitignore b/a/DRWI_SIM7080LTE/.gitignore deleted file mode 100644 index ca3297356..000000000 --- a/a/DRWI_SIM7080LTE/.gitignore +++ /dev/null @@ -1,109 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db -~* - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# PyCharm -.idea/ - -# Atom / PlatformIO -.pio -.pio_del -.pioenvs -.piolibdeps -.pio -.pio/libdeps -.pio/build -.pio/* -.clang_complete -.gcc-flags.json -.atomrc.cson -lib/* -include/* -.sconsign.dblite - -# VSCode -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode -.history - -# Other -compile_tests/ -logger_test*/ -YosemitechDO/ -LongTermLogger/ -barometric_correction/ -3G_Test/ - -__pycache__/ -runDoxygen.bat -docs/examples/* -output_doxygen.log -output_doxygen_run.log -output_mcss_run.log -output_mcss.log -docs/examples.dox_x -platformio_extra_envs.ini -src/sensors/table.md -cache -docs/output_copyFunctions.log -docs/output_documentExamples.log -docs/output_fixSectionsInXml.log -examples/DRWI_Mayfly1_Wifi_5tm_ds18b20_1/DRWI_Mayfly1_Wifi_5tm_ds18b20_1.ino -clang_format_all.bat -arduino_lint.md -arduino_lint.json -**/home/arduino/* -examples/test_code/* -compile_results.md -arduino_cli_log.log -continuous_integration/arduino_cli_local.yaml -compile_results.log -continuous_integration_artifacts/* -arduino_cli.log diff --git a/a/DRWI_SIM7080LTE/ReadMe.md b/a/DRWI_SIM7080LTE/ReadMe.md deleted file mode 100644 index cf82d18e4..000000000 --- a/a/DRWI_SIM7080LTE/ReadMe.md +++ /dev/null @@ -1,2 +0,0 @@ -# DRWI Sites with EnviroDIY LTE Bees -Development Build from local ModularSensors/src directories \ No newline at end of file diff --git a/a/DRWI_SIM7080LTE/platformio.ini b/a/DRWI_SIM7080LTE/platformio.ini deleted file mode 100644 index 494ca3c12..000000000 --- a/a/DRWI_SIM7080LTE/platformio.ini +++ /dev/null @@ -1,119 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; http://docs.platformio.org/page/projectconf.html -; https://envirodiy.github.io/ModularSensors/page_for_developers.html - -[platformio] -description = ModularSensors alpha build for DRWI on local sensors and a WiFi or EnviroDIY SIM7080G LTE modem -default_envs = mayfly -;src_dir = src - -[env] -monitor_speed = 115200 ;57600 -framework = arduino -; deep search for dependencies, evalulating preprocessor conditionals -lib_ldf_mode = deep+ -; look for the library director -lib_extra_dirs = . -; We have to ignore these folders or PlatformIO will double count all the dependencies -lib_ignore = - .git - .pio - .vscode - doc - examples - sensor_tests - extras - build - RTCZero - Adafruit NeoPixel - Adafruit GFX Library - Adafruit SSD1306 - Adafruit ADXL343 - Adafruit STMPE610 - Adafruit TouchScreen - Adafruit ILI9341 -; All these library dependencies must be listed out since we're in the library -; source code and won't read the dependencies from the library.json like a -; typical user would -lib_deps = - envirodiy/EnviroDIY_DS3231 - arduino-libraries/RTCZero - greygnome/EnableInterrupt - greiman/SdFat - ;vshymanskyy/TinyGSM - https://github.com/neilh10/TinyGSM#iss347_digi_wifi_s6b_becomes_unstable - knolleary/PubSubClient - adafruit/Adafruit BusIO - adafruit/Adafruit Unified Sensor - https://github.com/soligen2010/Adafruit_ADS1X15.git - adafruit/Adafruit AM2315 - adafruit/Adafruit BME280 Library - adafruit/DHT sensor library - adafruit/Adafruit INA219 - adafruit/Adafruit MPL115A2 - adafruit/Adafruit SHT4x Library - https://github.com/MartinL1/BMP388_DEV - paulstoffregen/OneWire - milesburton/DallasTemperature - envirodiy/SDI-12 - northernwidget/MS5803 - https://github.com/EnviroDIY/Tally_Library.git#Dev_I2C - envirodiy/SensorModbusMaster - envirodiy/KellerModbus - envirodiy/YosemitechModbus - vshymanskyy/StreamDebugger -; The directories for the ModularSensors library source code -build_src_filter = +<*> +<../../../src> +<../../../src/sensors> +<../../../src/publishers> +<../../../src/modems> - - -; Some common build flags -build_flags = - -Isrc - -I../../src ; .h For easy debug - -I../../src/sensors ; .h For easy debug - -Ilib/TinyGSM/src - -D SDI12_EXTERNAL_PCINT - -D NEOSWSERIAL_EXTERNAL_PCINT - -D MQTT_MAX_PACKET_SIZE=240 - -D TINY_GSM_RX_BUFFER=64 - -D TINY_GSM_YIELD_MS=2 - ;-D STREAMDEBUGGER_DBG - ;-D TinyGsmClientXbee_DBG=Serial - ;-D MS_DIGIXBEEWIFI_DEBUG - ;-D MS_DIGIXBEE_DEBUG - ;-D MS_LOGGERMODEM_DEBUG -;extra_scripts = pre:pioScripts/generate_compile_commands.py - - - -[env:mayfly] -board = mayfly -platform = atmelavr - -lib_deps = ${env.lib_deps} -; envirodiy/EnviroDIY_ModularSensors -; ^^ Use this when working from an official release of the library - ;https://github.com/neilh10/ModularSensors.git#develop - ;https://github.com/neilh10/ModularSensors.git#dvlp_batch_build -; ^^ Use this when if you want to pull from the develop branch - https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git - https://github.com/PaulStoffregen/AltSoftSerial.git - https://github.com/SRGDamia1/NeoSWSerial.git - -lib_ignore = - ${env.lib_ignore} - RTCZero - Adafruit Zero DMA Library - -build_flags = - ${env.build_flags} - -D STANDARD_SERIAL_OUTPUT=Serial - -D DEBUGGING_SERIAL_OUTPUT=Serial - -D DEEP_DEBUGGING_SERIAL_OUTPUT=Serial \ No newline at end of file diff --git a/a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp b/a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp deleted file mode 100644 index a91906f11..000000000 --- a/a/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/** ========================================================================= - * @file DRWI_SIM7080LTE.ino - * @brief Example for DRWI CitSci LTE sites. - * - * This example shows proper settings for the following configuration: - * - * Mayfly v1.0 board - * EnviroDIY SIM7080 LTE module (with Hologram SIM card) - * Hydros21 CTD sensor - * Campbell Scientific OBS3+ Turbidity sensor - * - * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. - * - - * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger - * - * DISCLAIMER: - * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. - * ======================================================================= */ - -// ========================================================================== -// Defines for the Arduino IDE -// NOTE: These are ONLY needed to compile with the Arduino IDE. -// If you use PlatformIO, you should set these build flags in your -// platformio.ini -// ========================================================================== -/** Start [defines] */ -#ifndef TINY_GSM_RX_BUFFER -#define TINY_GSM_RX_BUFFER 64 -#endif -#ifndef TINY_GSM_YIELD_MS -#define TINY_GSM_YIELD_MS 2 -#endif -/** End [defines] */ - -// ========================================================================== -// Include the libraries required for any data logger -// ========================================================================== -/** Start [includes] */ -// The Arduino library is needed for every Arduino program. -#include - -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - -// Include the main header for ModularSensors -#include -/** End [includes] */ - - -// ========================================================================== -// Data Logging Options -// ========================================================================== -// Details for this build -extern const String build_ref = "a\\" __FILE__ " " __DATE__ " " __TIME__ " "; -#ifdef PIO_SRC_REV -const char git_branch[] = PIO_SRC_REV; -#else -const char git_branch[] = "brnch"; -#endif -#ifdef PIO_SRC_USR -const char git_usr[] = PIO_SRC_USR; -#else -const char git_usr[] = "usr"; -#endif -/** Start [logging_options] */ -// The name of this program file -const char* sketchName = "DRWI_SIM7080LTE.cpp"; -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char* LoggerID = "XXXXX"; -// How frequently (in minutes) to log data -const uint8_t loggingInterval = 2; -// Your logger's timezone. -const int8_t timeZone = -5; // Eastern Standard Time -// NOTE: Daylight savings time will not be applied! Please use standard time! - -// Set the input and output pins for the logger -// NOTE: Use -1 for pins that do not apply -const int32_t serialBaud = 115200; // 57600 Baud rate for debugging -const int8_t greenLED = 8; // Pin for the green LED -const int8_t redLED = 9; // Pin for the red LED -const int8_t buttonPin = 21; // Pin for debugging mode (ie, button pin) -const int8_t wakePin = 31; // MCU interrupt/alarm pin to wake from sleep -// Mayfly 0.x D31 = A7 -const int8_t sdCardPwrPin = -1; // MCU SD card power pin -const int8_t sdCardSSPin = 12; // SD card chip select/slave select pin -const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power -/** End [logging_options] */ - - -// ========================================================================== -// Wifi/Cellular Modem Options -// ========================================================================== -HardwareSerial& modemSerial = Serial1; // Use hardware serial if possible -#if defined STREAMDEBUGGER_DBG -#include -StreamDebugger modemDebugger(modemSerial, STANDARD_SERIAL_OUTPUT); -#define modemSerHw modemDebugger -#else -#define modemSerHw modemSerial -#endif // STREAMDEBUGGER_DBG - -#define sim_com_xbee_wifi -#if defined sim_com_sim7080 -/** Start [sim_com_sim7080] */ - -// For almost anything based on the SIMCom SIM7080G -#include - -// Create a reference to the serial port for the modem -const int32_t modemBaud = 9600; // SIM7080 does auto-bauding by default, but - // for simplicity we set to 9600 - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply - -const int8_t modemVccPin = - 18; // MCU pin controlling modem power --- - // Pin 18 is the power enable pin - // for the bee socket on Mayfly v1.0, - // use -1 if using Mayfly 0.5b or if the bee socket is constantly - // powered (ie you changed SJ18 on Mayfly 1.x to 3.3v) -const int8_t modemStatusPin = 19; // MCU pin used to read modem status -const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request -const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status - -// Network connection information -const char* apn = - "hologram"; // APN connection name, typically Hologram unless you have a - // different provider's SIM card. Change as needed - -// Create the modem object -SIMComSIM7080 modem7080(&modemSerHw, modemVccPin, modemStatusPin, - modemSleepRqPin, apn); -// Create an extra reference to the modem by a generic name -SIMComSIM7080 modem = modem7080; -/** End [sim_com_sim7080] */ -#elif defined sim_com_xbee_wifi -/** Start [sim_com_xbee_wifi] */ -// For the Digi Wifi XBee (S6B) -#include -// Create a reference to the serial port for the modem - -const int32_t modemBaud = 9600; // All XBee's use 9600 by default - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply -const int8_t modemVccPin = 18; // Mayfly1.1 pin controlling modem power -const int8_t modemStatusPin = 19; // MCU pin used to read modem status -const bool useCTSforStatus = true; // Flag to use the modem CTS pin for status -const int8_t modemResetPin = 20; // MCU pin connected to modem reset pin -const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request -const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status (-1 if unconnected) - -// Network connection information -const char* wifiId = "ArthurGuestSsid"; // WiFi access point, unnecessary for GPRS -const char* wifiPwd = "Arthur8166"; // WiFi password, unnecessary for GPRS - -DigiXBeeWifi modemXBWF(&modemSerHw, modemVccPin, modemStatusPin, - useCTSforStatus, modemResetPin, modemSleepRqPin, wifiId, - wifiPwd); -// Create an extra reference to the modem by a generic name -DigiXBeeWifi modemPhy = modemXBWF; -/** End [sim_com_xbee_wifi] */ -#endif //Modem options - -// ========================================================================== -// Using the Processor as a Sensor -// ========================================================================== -/** Start [processor_sensor] */ -#include - -// Create the main processor chip "sensor" - for general metadata -const char* mcuBoardVersion = "v1.1"; -ProcessorStats mcuBoard(mcuBoardVersion); -/** End [processor_sensor] */ - - -// ========================================================================== -// Maxim DS3231 RTC (Real Time Clock) -// ========================================================================== -/** Start [ds3231] */ -#include - -// Create a DS3231 sensor object -MaximDS3231 ds3231(1); -/** End [ds3231] */ - -//#define SENSORS_EXTERNAL -#if defined SENSORS_EXTERNAL -// ========================================================================== -// Meter Hydros 21 Conductivity, Temperature, and Depth Sensor -// ========================================================================== -/** Start [hydros21] */ -#include - -const char* hydrosSDI12address = "1"; // The SDI-12 Address of the Hydros 21 -const uint8_t hydrosNumberReadings = 6; // The number of readings to average -const int8_t SDI12Power = sensorPowerPin; // Power pin (-1 if unconnected) -const int8_t SDI12Data = 7; // The SDI12 data pin - -// Create a Meter Hydros 21 sensor object -MeterHydros21 hydros(*hydrosSDI12address, SDI12Power, SDI12Data, - hydrosNumberReadings); -/** End [hydros21] */ - - -// ========================================================================== -// Campbell OBS 3 / OBS 3+ Analog Turbidity Sensor -// ========================================================================== -/** Start [obs3] */ -#include - -const int8_t OBS3Power = sensorPowerPin; // Power pin (-1 if unconnected) -const uint8_t OBS3NumberReadings = 10; -const uint8_t ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC -// Campbell OBS 3+ *Low* Range Calibration in Volts -const int8_t OBSLowADSChannel = 0; // ADS channel for *low* range output -const float OBSLow_A = 0.000E+00; // "A" value (X^2) [*low* range] -const float OBSLow_B = 1.000E+00; // "B" value (X) [*low* range] -const float OBSLow_C = 0.000E+00; // "C" value [*low* range] - -// Create a Campbell OBS3+ *low* range sensor object -CampbellOBS3 osb3low(OBS3Power, OBSLowADSChannel, OBSLow_A, OBSLow_B, OBSLow_C, - ADSi2c_addr, OBS3NumberReadings); - - -// Campbell OBS 3+ *High* Range Calibration in Volts -const int8_t OBSHighADSChannel = 1; // ADS channel for *high* range output -const float OBSHigh_A = 0.000E+00; // "A" value (X^2) [*high* range] -const float OBSHigh_B = 1.000E+00; // "B" value (X) [*high* range] -const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] - -// Create a Campbell OBS3+ *high* range sensor object -CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, - OBSHigh_C, ADSi2c_addr, OBS3NumberReadings); -/** End [obs3] */ - -#endif // SENSORS_EXTERNAL -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== -/** Start [variable_arrays] */ -Variable* variableList[] = { - #if defined SENSORS_EXTERNAL - new MeterHydros21_Cond(&hydros), - new MeterHydros21_Depth(&hydros), - new MeterHydros21_Temp(&hydros), - new CampbellOBS3_Turbidity(&osb3low, "", "TurbLow"), - new CampbellOBS3_Turbidity(&osb3high, "", "TurbHigh"), - new ProcessorStats_Battery(&mcuBoard), - #endif //SENSORS_EXTERNAL - new MaximDS3231_Temp(&ds3231), - new ProcessorStats_SampleNumber(&mcuBoard), - // Fut Sensiron Temperature - // Fut Sensirom Humidity - //new Modem_SignalPercent(&modem), -}; - -// All UUID's, device registration, and sampling feature information can be -// pasted directly from Monitor My Watershed. -// To get the list, click the "View token UUID list" button on the upper right -// of the site page. - -// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** -// Check the order of your variables in the variable list!!! -// Be VERY certain that they match the order of your UUID's! -// Rearrange the variables in the variable list ABOVE if necessary to match! -// Do not change the order of the variables in the section below. -// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** - -// Replace all of the text in the following section with the UUID array from -// MonitorMyWatershed - -/* clang-format off */ -// --------------------- Beginning of Token UUID List --------------------- - -//Site https://monitormywatershed.org/sites/bq_test01/ -const char* UUIDs[] = // UUID array for device sensors - { - #if defined SENSORS_EXTERNAL - "12345678-abcd-1234-ef00-1234567890ab", // Specific conductance (Meter_Hydros21_Cond) - "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Meter_Hydros21_Depth) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Meter_Hydros21_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (Low) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (High) - "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) - #endif // SENSORS_EXTERNAL - "9fdcefc1-b43f-4c3c-8d46-ca0e90845153", // Temperature (Maxim_DS3231_Temp) - "e0d7b81b-0241-4017-b5dc-e90ecdb7c279", // Sequence number (EnviroDIY_Mayfly_SampleNum) - //"d73e060d-df4e-4f29-8b69-34891f518bdf", // Temperature (Sensirion_SHT40_Temperature) - //"acc456aa-1148-4385-a984-a68b6eb6b044", // Relative humidity (Sensirion_SHT40_Humidity) - //"97893988-6c2d-43ee-9cfe-3715d45019db" // Percent full scale (Digi_Cellular_SignalPercent) -}; -const char* registrationToken = "22752220-5925-4a2c-aeb1-a57b58e1c246"; // Device registration token -const char* samplingFeature = "747478ef-4e80-4cc8-921e-89172d05ea42"; // Sampling feature UUID - - -// ----------------------- End of Token UUID List ----------------------- -/* clang-format on */ - -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray(variableCount, variableList, UUIDs); -/** End [variable_arrays] */ - - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== -/** Start [loggers] */ -// Create a new logger instance -Logger dataLogger(LoggerID, loggingInterval, &varArray); -/** End [loggers] */ - - -// ========================================================================== -// Creating Data Publisher[s] -// ========================================================================== -/** Start [publishers] */ -// Create a data publisher for the Monitor My Watershed/EnviroDIY POST endpoint -#include -EnviroDIYPublisher EnviroDIYPOST(dataLogger, &modemPhy.gsmClient, - registrationToken, samplingFeature); -/** End [publishers] */ - - -// ========================================================================== -// Working Functions -// ========================================================================== -/** Start [working_functions] */ -// Flashes the LED's on the primary board -void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { - for (uint8_t i = 0; i < numFlash; i++) { - digitalWrite(greenLED, HIGH); - digitalWrite(redLED, LOW); - delay(rate); - digitalWrite(greenLED, LOW); - digitalWrite(redLED, HIGH); - delay(rate); - } - digitalWrite(redLED, LOW); -} - -// Reads the battery voltage -// NOTE: This will actually return the battery level from the previous update! -float getBatteryVoltage() { - if (mcuBoard.sensorValues[0] == -9999) mcuBoard.update(); - return mcuBoard.sensorValues[0]; -} - - -// ========================================================================== -// Arduino Setup Function -// ========================================================================== -/** Start [setup] */ -void setup() { - // Start the primary serial connection - Serial.begin(serialBaud); - Serial.print(F("\n---Boot. Sw Build: ")); - Serial.print(build_ref); - Serial.print(" "); - Serial.println(git_usr); - Serial.print(" "); - Serial.println(git_branch); - - // Print a start-up note to the first serial port - Serial.print(F("\nNow running ")); - Serial.print(sketchName); - Serial.print(F(" on Logger ")); - Serial.println(LoggerID); - Serial.println(); - - Serial.print(F("Using ModularSensors Library version ")); - Serial.println(MODULAR_SENSORS_VERSION); - Serial.print(F("TinyGSM Library version ")); - Serial.println(TINYGSM_VERSION); - Serial.println(); - - // Start the serial connection with the modem - modemSerial.begin(modemBaud); - - // Set up pins for the LED's - pinMode(greenLED, OUTPUT); - digitalWrite(greenLED, LOW); - pinMode(redLED, OUTPUT); - digitalWrite(redLED, LOW); - // Blink the LEDs to show the board is on and starting up - greenredflash(); - - pinMode(20, OUTPUT); // for proper operation of the onboard flash memory - // chip's ChipSelect (Mayfly v1.0 and later) - - // Set the timezones for the logger/data and the RTC - // Logging in the given time zone - Logger::setLoggerTimeZone(timeZone); - // It is STRONGLY RECOMMENDED that you set the RTC to be in UTC (UTC+0) - Logger::setRTCTimeZone(0); - - // Attach the modem and information pins to the logger - dataLogger.attachModem(modemPhy); - modemPhy.setModemLED(modemLEDPin); - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, - greenLED); - - // Begin the logger - dataLogger.begin(); - - // Note: Please change these battery voltages to match your battery - // Set up the sensors, except at lowest battery level - if (getBatteryVoltage() > 3.4) { - Serial.println(F("Setting up sensors...")); - varArray.setupSensors(); - } - - #if defined sim_com_sim700 - /** Start [setup_sim7080] */ - modem.setModemWakeLevel(HIGH); // ModuleFun Bee inverts the signal - modem.setModemResetLevel(HIGH); // ModuleFun Bee inverts the signal - Serial.println(F("Waking modem and setting Cellular Carrier Options...")); - modem.modemWake(); // NOTE: This will also set up the modem - modem.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! - modem.gsmModem.setNetworkMode(38); // set to LTE only - // 2 Automatic - // 13 GSM only - // 38 LTE only - // 51 GSM and LTE only - modem.gsmModem.setPreferredMode(1); // set to CAT-M - // 1 CAT-M - // 2 NB-IoT - // 3 CAT-M and NB-IoT - /** End [setup_sim7080] */ - #elif defined sim_com_xbee_wifi - /** Start [setup_sim7080] */ - - Serial.println(F("Waking modem WiFi ...")); - modemPhy.modemWake(); // NOTE: This will also set up the modem - modemPhy.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! - #endif //Modem setup - - // Sync the clock if it isn't valid or we have battery to spare - if (getBatteryVoltage() > 3.55 || !dataLogger.isRTCSane()) { - // Synchronize the RTC with NIST - // This will also set up the modem - dataLogger.syncRTC(); - } - - // Create the log file, adding the default header to it - // Do this last so we have the best chance of getting the time correct and - // all sensor names correct - // Writing to the SD card can be power intensive, so if we're skipping - // the sensor setup we'll skip this too. - if (getBatteryVoltage() > 3.4) { - Serial.println(F("Setting up file on SD card")); - dataLogger.turnOnSDcard( - true); // true = wait for card to settle after power up - dataLogger.createLogFile(true); // true = write a new header - dataLogger.turnOffSDcard( - true); // true = wait for internal housekeeping after write - } - - // Call the processor sleep - Serial.println(F("Putting processor to sleep\n")); - dataLogger.systemSleep(); -} -/** End [setup] */ - - -// ========================================================================== -// Arduino Loop Function -// ========================================================================== -/** Start [loop] */ -// Use this short loop for simple data logging and sending -void loop() { - // Note: Please change these battery voltages to match your battery - // At very low battery, just go back to sleep - if (getBatteryVoltage() < 3.4) { - dataLogger.systemSleep(); - } - // At moderate voltage, log data but don't send it over the modem - else if (getBatteryVoltage() < 3.55) { - dataLogger.logData(); - } - // If the battery is good, send the data to the world - else { - dataLogger.logDataAndPublish(); - } -} -/** End [loop] */ diff --git a/sensors_test/DRWI_SIM7080LTE/.clang-format b/sensors_test/DRWI_SIM7080LTE/.clang-format deleted file mode 100644 index 6e42a7597..000000000 --- a/sensors_test/DRWI_SIM7080LTE/.clang-format +++ /dev/null @@ -1,127 +0,0 @@ ---- -Language: Cpp -# BasedOnStyle: Google -AccessModifierOffset: -3 -AlignAfterOpenBracket: Align -AlignConsecutiveMacros: false -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: true -AlignEscapedNewlines: Left -AlignOperands: false -AlignTrailingComments: true -AllowAllArgumentsOnNextLine: true -AllowAllConstructorInitializersOnNextLine: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortBlocksOnASingleLine: Always -AllowShortCaseLabelsOnASingleLine: true -AllowShortEnumsOnASingleLine: true -AllowShortFunctionsOnASingleLine: Empty -AllowShortIfStatementsOnASingleLine: WithoutElse -AllowShortLambdasOnASingleLine: All -AllowShortLoopsOnASingleLine: true -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: Yes -BinPackArguments: true -BinPackParameters: true -BreakAfterJavaFieldAnnotations: false -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Attach -BreakBeforeInheritanceComma: false -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: false -BreakConstructorInitializers: BeforeColon -BreakInheritanceList: BeforeColon -BreakStringLiterals: true -ColumnLimit: 80 -CommentPragmas: '^ IWYU pragma:' -CompactNamespaces: false -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -EmptyLineAfterAccessModifier: Leave -EmptyLineBeforeAccessModifier: Leave -ExperimentalAutoDetectBinPacking: false -FixNamespaceComments: true -ForEachMacros: - - foreach - - Q_FOREACH - - BOOST_FOREACH -IncludeBlocks: Preserve -IncludeCategories: - - Regex: 'TinyGsmClient.h' - Priority: -1 - - Regex: 'VariableBase.h' - Priority: -1 - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - - Regex: '^(<|"(gtest|gmock|isl|json)/)' - Priority: 3 - - Regex: '.*' - Priority: 1 -IncludeIsMainRegex: '([-_](test|unittest))?$' -IndentAccessModifiers: false -IndentCaseBlocks: false -IndentCaseLabels: true -IndentExternBlock: Indent -IndentGotoLabels: true -IndentPPDirectives: None -IndentWidth: 4 -IndentWrappedFunctionNames: false -InsertTrailingCommas: None -JavaScriptQuotes: Leave -JavaScriptWrapImports: true -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: '' -MacroBlockEnd: '' -MaxEmptyLinesToKeep: 2 -NamespaceIndentation: None -# ObjCBinPackProtocolList: Auto -ObjCBlockIndentWidth: 2 -ObjCSpaceAfterProperty: false -ObjCSpaceBeforeProtocolList: true -PackConstructorInitializers: CurrentLine -PenaltyBreakAssignment: 25 -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 300 -PenaltyBreakFirstLessLess: 120 -PenaltyBreakString: 1000 -PenaltyBreakTemplateDeclaration: 10 -PenaltyExcessCharacter: 600 -PenaltyReturnTypeOnItsOwnLine: 50 -PointerAlignment: Left -PointerBindsToType: true -QualifierAlignment: Left -ReferenceAlignment: Left -ReflowComments: true -SeparateDefinitionBlocks: Leave -SortIncludes: false -SortUsingDeclarations: true -SpaceAfterCStyleCast: false -SpaceAfterLogicalNot: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeCaseColon: false -SpaceBeforeCpp11BracedList: false -SpaceBeforeCtorInitializerColon: true -SpaceBeforeInheritanceColon: true -SpaceBeforeParens: ControlStatements -SpaceBeforeRangeBasedForLoopColon: true -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 2 -SpacesInAngles: false -SpacesInContainerLiterals: true -SpacesInCStyleCastParentheses: false -SpacesInConditionalStatement: false -SpacesInLineCommentPrefix: - Minimum: 1 -SpacesInParentheses: false -SpacesInSquareBrackets: false -Standard: Cpp11 -TabWidth: 4 -UseTab: Never ---- diff --git a/sensors_test/DRWI_SIM7080LTE/.gitignore b/sensors_test/DRWI_SIM7080LTE/.gitignore deleted file mode 100644 index e427ce655..000000000 --- a/sensors_test/DRWI_SIM7080LTE/.gitignore +++ /dev/null @@ -1,110 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db -~* - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# PyCharm -.idea/ - -# Atom / PlatformIO -.pio -.pio_del -.pioenvs -.piolibdeps -.pio -.pio/libdeps -.pio/build -.pio/* -.clang_complete -.gcc-flags.json -.atomrc.cson -lib/* -include/* -/platformio.ini -.sconsign.dblite - -# VSCode -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode -.history - -# Other -compile_tests/ -logger_test*/ -YosemitechDO/ -LongTermLogger/ -barometric_correction/ -3G_Test/ - -__pycache__/ -runDoxygen.bat -docs/examples/* -output_doxygen.log -output_doxygen_run.log -output_mcss_run.log -output_mcss.log -docs/examples.dox_x -platformio_extra_envs.ini -src/sensors/table.md -cache -docs/output_copyFunctions.log -docs/output_documentExamples.log -docs/output_fixSectionsInXml.log -examples/DRWI_Mayfly1_Wifi_5tm_ds18b20_1/DRWI_Mayfly1_Wifi_5tm_ds18b20_1.ino -clang_format_all.bat -arduino_lint.md -arduino_lint.json -**/home/arduino/* -examples/test_code/* -compile_results.md -arduino_cli_log.log -continuous_integration/arduino_cli_local.yaml -compile_results.log -continuous_integration_artifacts/* -arduino_cli.log diff --git a/sensors_test/DRWI_SIM7080LTE/ReadMe.md b/sensors_test/DRWI_SIM7080LTE/ReadMe.md deleted file mode 100644 index b0139c4b8..000000000 --- a/sensors_test/DRWI_SIM7080LTE/ReadMe.md +++ /dev/null @@ -1,43 +0,0 @@ -# DRWI Sites with EnviroDIY LTE Bees -Build sketch for testing batch queue using the SIM7080G LTE cellular module with an EnviroDIY Mayfly Data Logger. - -The exact hardware configuration used in this example: - * Mayfly v1.2 board - * EnviroDIY SIM7080 LTE module (with Hologram SIM card) - - -An EnviroDIY LTE SIM7080 module can be used with the older Mayfly v0.5b boards if you change line 101 (for modemVccPin) from 18 to -1. -This is because the Mayfly v1.0 board has a separate 3.3v regulator to power the Bee socket and is controlled by turning pin 18 on or off. -Mayfly v0.5b has the Bee socket constantly powered, therefore using "-1" is the proper setting for that line of code. - -The EnviroDIY LTE SIM7080 module includes 2 antennas in the package. The small thin one is the cellular antenna, and should be connected to the socket labeled "CELL". The thicker block is the GPS antenna, and should be connected to the "GPS" socket, but only if you intend to use the GPS functionality of the module. ModularSensors does not currently suport GPS functionality, but other libraries such as TinyGPS can work with the SIM7080 module. - -The included cell antenna works best in high-signal-strength areas. For most remote areas and logger deployments, we suggest a larger LTE antenna, like the W3907B0100 -from PulseLarsen (Digikey 1837-1003-ND or Mouser 673-W3907B0100) - -_______ - -[//]: # ( @tableofcontents ) - -[//]: # ( @m_footernavigation ) - -[//]: # ( Start GitHub Only ) -- [DRWI Sites with EnviroDIY LTE Bees](#drwi-sites-with-envirodiy-lte-bees) -- [Unique Features of the DRWI EnviroDIY LTE Example](#unique-features-of-the-drwi-envirodiy-lte-example) - -[//]: # ( End GitHub Only ) - -_______ - -# Unique Features of the DRWI EnviroDIY LTE Example -- Specifically for sites within the Delaware River Watershed Initiative. -- Uses a EnviroDIY LTE Bee based on the SIMCom SIM7080G - - -[//]: # ( @section example_drwi_ediylte_pio_config PlatformIO Configuration ) - -[//]: # ( @include{lineno} DRWI_SIM7080LTE/platformio.ini ) - -[//]: # ( @section example_drwi_ediylte_code The Complete Code ) - -[//]: # ( @include{lineno} DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino ) diff --git a/sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp b/sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp deleted file mode 100644 index d7cc9203c..000000000 --- a/sensors_test/DRWI_SIM7080LTE/src/DRWI_SIM7080LTE.cpp +++ /dev/null @@ -1,497 +0,0 @@ -/** ========================================================================= - * @file DRWI_SIM7080LTE.ino - * @brief Example for DRWI CitSci LTE sites. - * - * This example shows proper settings for the following configuration: - * - * Mayfly v1.0 board - * EnviroDIY SIM7080 LTE module (with Hologram SIM card) - * Hydros21 CTD sensor - * Campbell Scientific OBS3+ Turbidity sensor - * - * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. - * - - * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger - * - * DISCLAIMER: - * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. - * ======================================================================= */ - -// ========================================================================== -// Defines for the Arduino IDE -// NOTE: These are ONLY needed to compile with the Arduino IDE. -// If you use PlatformIO, you should set these build flags in your -// platformio.ini -// ========================================================================== -/** Start [defines] */ -#ifndef TINY_GSM_RX_BUFFER -#define TINY_GSM_RX_BUFFER 64 -#endif -#ifndef TINY_GSM_YIELD_MS -#define TINY_GSM_YIELD_MS 2 -#endif -/** End [defines] */ - -// ========================================================================== -// Include the libraries required for any data logger -// ========================================================================== -/** Start [includes] */ -// The Arduino library is needed for every Arduino program. -#include - -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - -// Include the main header for ModularSensors -#include -/** End [includes] */ - - -// ========================================================================== -// Data Logging Options -// ========================================================================== -// Details for this build -extern const String build_ref = "a\\" __FILE__ " " __DATE__ " " __TIME__ " "; -#ifdef PIO_SRC_REV -const char git_branch[] = PIO_SRC_REV; -#else -const char git_branch[] = "brnch"; -#endif -#ifdef PIO_SRC_USR -const char git_usr[] = PIO_SRC_USR; -#else -const char git_usr[] = "usr"; -#endif -/** Start [logging_options] */ -// The name of this program file -const char* sketchName = "sensorTest/DRWI_SIM7080LTE.cpp"; -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char* LoggerID = "snsrTst"; -// How frequently (in minutes) to log data -const uint8_t loggingInterval = 2; -// Your logger's timezone. -const int8_t timeZone = -5; // Eastern Standard Time -// NOTE: Daylight savings time will not be applied! Please use standard time! - -// Set the input and output pins for the logger -// NOTE: Use -1 for pins that do not apply -const int32_t serialBaud = 115200; // 57600 Baud rate for debugging -const int8_t greenLED = 8; // Pin for the green LED -const int8_t redLED = 9; // Pin for the red LED -const int8_t buttonPin = 21; // Pin for debugging mode (ie, button pin) -const int8_t wakePin = 31; // MCU interrupt/alarm pin to wake from sleep -// Mayfly 0.x D31 = A7 -const int8_t sdCardPwrPin = -1; // MCU SD card power pin -const int8_t sdCardSSPin = 12; // SD card chip select/slave select pin -const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power -/** End [logging_options] */ - - -// ========================================================================== -// Wifi/Cellular Modem Options -// ========================================================================== -HardwareSerial& modemSerial = Serial1; // Use hardware serial if possible -#if defined STREAMDEBUGGER_DBG -#include -StreamDebugger modemDebugger(modemSerial, STANDARD_SERIAL_OUTPUT); -#define modemSerHw modemDebugger -#else -#define modemSerHw modemSerial -#endif // STREAMDEBUGGER_DBG - -#define sim_com_xbee_wifi -#if defined sim_com_sim7080 -/** Start [sim_com_sim7080] */ - -// For almost anything based on the SIMCom SIM7080G -#include - -// Create a reference to the serial port for the modem -const int32_t modemBaud = 9600; // SIM7080 does auto-bauding by default, but - // for simplicity we set to 9600 - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply - -const int8_t modemVccPin = - 18; // MCU pin controlling modem power --- - // Pin 18 is the power enable pin - // for the bee socket on Mayfly v1.0, - // use -1 if using Mayfly 0.5b or if the bee socket is constantly - // powered (ie you changed SJ18 on Mayfly 1.x to 3.3v) -const int8_t modemStatusPin = 19; // MCU pin used to read modem status -const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request -const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status - -// Network connection information -const char* apn = - "hologram"; // APN connection name, typically Hologram unless you have a - // different provider's SIM card. Change as needed - -// Create the modem object -SIMComSIM7080 modem7080(&modemSerHw, modemVccPin, modemStatusPin, - modemSleepRqPin, apn); -// Create an extra reference to the modem by a generic name -SIMComSIM7080 modem = modem7080; -/** End [sim_com_sim7080] */ -#elif defined sim_com_xbee_wifi -/** Start [sim_com_xbee_wifi] */ -// For the Digi Wifi XBee (S6B) -#include -// Create a reference to the serial port for the modem - -const int32_t modemBaud = 9600; // All XBee's use 9600 by default - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply -const int8_t modemVccPin = 18; // Mayfly1.1 pin controlling modem power -const int8_t modemStatusPin = 19; // MCU pin used to read modem status -const bool useCTSforStatus = true; // Flag to use the modem CTS pin for status -const int8_t modemResetPin = 20; // MCU pin connected to modem reset pin -const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request -const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status (-1 if unconnected) - -// Network connection information -const char* wifiId = "ArthurGuestSsid"; // WiFi access point, unnecessary for GPRS -const char* wifiPwd = "Arthur8166"; // WiFi password, unnecessary for GPRS - -DigiXBeeWifi modemXBWF(&modemSerHw, modemVccPin, modemStatusPin, - useCTSforStatus, modemResetPin, modemSleepRqPin, wifiId, - wifiPwd); -// Create an extra reference to the modem by a generic name -DigiXBeeWifi modemPhy = modemXBWF; -/** End [sim_com_xbee_wifi] */ -#endif //Modem options - -// ========================================================================== -// Using the Processor as a Sensor -// ========================================================================== -/** Start [processor_sensor] */ -#include - -// Create the main processor chip "sensor" - for general metadata -const char* mcuBoardVersion = "v1.1"; -ProcessorStats mcuBoard(mcuBoardVersion); -/** End [processor_sensor] */ - - -// ========================================================================== -// Maxim DS3231 RTC (Real Time Clock) -// ========================================================================== -/** Start [ds3231] */ -#include - -// Create a DS3231 sensor object -MaximDS3231 ds3231(1); -/** End [ds3231] */ - -//#define SENSORS_EXTERNAL -#if defined SENSORS_EXTERNAL -// ========================================================================== -// Meter Hydros 21 Conductivity, Temperature, and Depth Sensor -// ========================================================================== -/** Start [hydros21] */ -#include - -const char* hydrosSDI12address = "1"; // The SDI-12 Address of the Hydros 21 -const uint8_t hydrosNumberReadings = 6; // The number of readings to average -const int8_t SDI12Power = sensorPowerPin; // Power pin (-1 if unconnected) -const int8_t SDI12Data = 7; // The SDI12 data pin - -// Create a Meter Hydros 21 sensor object -MeterHydros21 hydros(*hydrosSDI12address, SDI12Power, SDI12Data, - hydrosNumberReadings); -/** End [hydros21] */ - - -// ========================================================================== -// Campbell OBS 3 / OBS 3+ Analog Turbidity Sensor -// ========================================================================== -/** Start [obs3] */ -#include - -const int8_t OBS3Power = sensorPowerPin; // Power pin (-1 if unconnected) -const uint8_t OBS3NumberReadings = 10; -const uint8_t ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC -// Campbell OBS 3+ *Low* Range Calibration in Volts -const int8_t OBSLowADSChannel = 0; // ADS channel for *low* range output -const float OBSLow_A = 0.000E+00; // "A" value (X^2) [*low* range] -const float OBSLow_B = 1.000E+00; // "B" value (X) [*low* range] -const float OBSLow_C = 0.000E+00; // "C" value [*low* range] - -// Create a Campbell OBS3+ *low* range sensor object -CampbellOBS3 osb3low(OBS3Power, OBSLowADSChannel, OBSLow_A, OBSLow_B, OBSLow_C, - ADSi2c_addr, OBS3NumberReadings); - - -// Campbell OBS 3+ *High* Range Calibration in Volts -const int8_t OBSHighADSChannel = 1; // ADS channel for *high* range output -const float OBSHigh_A = 0.000E+00; // "A" value (X^2) [*high* range] -const float OBSHigh_B = 1.000E+00; // "B" value (X) [*high* range] -const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] - -// Create a Campbell OBS3+ *high* range sensor object -CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, - OBSHigh_C, ADSi2c_addr, OBS3NumberReadings); -/** End [obs3] */ - -#endif // SENSORS_EXTERNAL -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== -/** Start [variable_arrays] */ -Variable* variableList[] = { - #if defined SENSORS_EXTERNAL - new MeterHydros21_Cond(&hydros), - new MeterHydros21_Depth(&hydros), - new MeterHydros21_Temp(&hydros), - new CampbellOBS3_Turbidity(&osb3low, "", "TurbLow"), - new CampbellOBS3_Turbidity(&osb3high, "", "TurbHigh"), - new ProcessorStats_Battery(&mcuBoard), - #endif //SENSORS_EXTERNAL - new MaximDS3231_Temp(&ds3231), - new ProcessorStats_SampleNumber(&mcuBoard), - // Fut Sensiron Temperature - // Fut Sensirom Humidity - //new Modem_SignalPercent(&modem), -}; - -// All UUID's, device registration, and sampling feature information can be -// pasted directly from Monitor My Watershed. -// To get the list, click the "View token UUID list" button on the upper right -// of the site page. - -// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** -// Check the order of your variables in the variable list!!! -// Be VERY certain that they match the order of your UUID's! -// Rearrange the variables in the variable list ABOVE if necessary to match! -// Do not change the order of the variables in the section below. -// *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** - -// Replace all of the text in the following section with the UUID array from -// MonitorMyWatershed - -/* clang-format off */ -// --------------------- Beginning of Token UUID List --------------------- - -//Site https://monitormywatershed.org/sites/bq_test01/ -const char* UUIDs[] = // UUID array for device sensors - { - #if defined SENSORS_EXTERNAL - "12345678-abcd-1234-ef00-1234567890ab", // Specific conductance (Meter_Hydros21_Cond) - "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Meter_Hydros21_Depth) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Meter_Hydros21_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (Low) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) (High) - "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) - #endif // SENSORS_EXTERNAL - "9fdcefc1-b43f-4c3c-8d46-ca0e90845153", // Temperature (Maxim_DS3231_Temp) - "e0d7b81b-0241-4017-b5dc-e90ecdb7c279", // Sequence number (EnviroDIY_Mayfly_SampleNum) - //"d73e060d-df4e-4f29-8b69-34891f518bdf", // Temperature (Sensirion_SHT40_Temperature) - //"acc456aa-1148-4385-a984-a68b6eb6b044", // Relative humidity (Sensirion_SHT40_Humidity) - //"97893988-6c2d-43ee-9cfe-3715d45019db" // Percent full scale (Digi_Cellular_SignalPercent) -}; -const char* registrationToken = "22752220-5925-4a2c-aeb1-a57b58e1c246"; // Device registration token -const char* samplingFeature = "747478ef-4e80-4cc8-921e-89172d05ea42"; // Sampling feature UUID - - -// ----------------------- End of Token UUID List ----------------------- -/* clang-format on */ - -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray(variableCount, variableList, UUIDs); -/** End [variable_arrays] */ - - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== -/** Start [loggers] */ -// Create a new logger instance -Logger dataLogger(LoggerID, loggingInterval, &varArray); -/** End [loggers] */ - - -// ========================================================================== -// Creating Data Publisher[s] -// ========================================================================== -/** Start [publishers] */ -// Create a data publisher for the Monitor My Watershed/EnviroDIY POST endpoint -#include -EnviroDIYPublisher EnviroDIYPOST(dataLogger, &modemPhy.gsmClient, - registrationToken, samplingFeature); -/** End [publishers] */ - - -// ========================================================================== -// Working Functions -// ========================================================================== -/** Start [working_functions] */ -// Flashes the LED's on the primary board -void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { - for (uint8_t i = 0; i < numFlash; i++) { - digitalWrite(greenLED, HIGH); - digitalWrite(redLED, LOW); - delay(rate); - digitalWrite(greenLED, LOW); - digitalWrite(redLED, HIGH); - delay(rate); - } - digitalWrite(redLED, LOW); -} - -// Reads the battery voltage -// NOTE: This will actually return the battery level from the previous update! -float getBatteryVoltage() { - if (mcuBoard.sensorValues[0] == -9999) mcuBoard.update(); - return mcuBoard.sensorValues[0]; -} - - -// ========================================================================== -// Arduino Setup Function -// ========================================================================== -/** Start [setup] */ -void setup() { - // Start the primary serial connection - Serial.begin(serialBaud); - Serial.print(F("\n---Boot. Sw Build: ")); - Serial.print(build_ref); - Serial.print(" "); - Serial.println(git_usr); - Serial.print(" "); - Serial.println(git_branch); - - // Print a start-up note to the first serial port - Serial.print(F("\nNow running ")); - Serial.print(sketchName); - Serial.print(F(" on Logger ")); - Serial.println(LoggerID); - Serial.println(); - - Serial.print(F("Using ModularSensors Library version ")); - Serial.println(MODULAR_SENSORS_VERSION); - Serial.print(F("TinyGSM Library version ")); - Serial.println(TINYGSM_VERSION); - Serial.println(); - - // Start the serial connection with the modem - modemSerial.begin(modemBaud); - - // Set up pins for the LED's - pinMode(greenLED, OUTPUT); - digitalWrite(greenLED, LOW); - pinMode(redLED, OUTPUT); - digitalWrite(redLED, LOW); - // Blink the LEDs to show the board is on and starting up - greenredflash(); - - pinMode(20, OUTPUT); // for proper operation of the onboard flash memory - // chip's ChipSelect (Mayfly v1.0 and later) - - // Set the timezones for the logger/data and the RTC - // Logging in the given time zone - Logger::setLoggerTimeZone(timeZone); - // It is STRONGLY RECOMMENDED that you set the RTC to be in UTC (UTC+0) - Logger::setRTCTimeZone(0); - - // Attach the modem and information pins to the logger - dataLogger.attachModem(modemPhy); - modemPhy.setModemLED(modemLEDPin); - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, - greenLED); - - // Begin the logger - dataLogger.begin(); - - // Note: Please change these battery voltages to match your battery - // Set up the sensors, except at lowest battery level - if (getBatteryVoltage() > 3.4) { - Serial.println(F("Setting up sensors...")); - varArray.setupSensors(); - } - - #if defined sim_com_sim700 - /** Start [setup_sim7080] */ - modem.setModemWakeLevel(HIGH); // ModuleFun Bee inverts the signal - modem.setModemResetLevel(HIGH); // ModuleFun Bee inverts the signal - Serial.println(F("Waking modem and setting Cellular Carrier Options...")); - modem.modemWake(); // NOTE: This will also set up the modem - modem.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! - modem.gsmModem.setNetworkMode(38); // set to LTE only - // 2 Automatic - // 13 GSM only - // 38 LTE only - // 51 GSM and LTE only - modem.gsmModem.setPreferredMode(1); // set to CAT-M - // 1 CAT-M - // 2 NB-IoT - // 3 CAT-M and NB-IoT - /** End [setup_sim7080] */ - #elif defined sim_com_xbee_wifi - /** Start [setup_sim7080] */ - - Serial.println(F("Waking modem WiFi ...")); - modemPhy.modemWake(); // NOTE: This will also set up the modem - modemPhy.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! - #endif //Modem setup - - // Sync the clock if it isn't valid or we have battery to spare - if (getBatteryVoltage() > 3.55 || !dataLogger.isRTCSane()) { - // Synchronize the RTC with NIST - // This will also set up the modem - dataLogger.syncRTC(); - } - - // Create the log file, adding the default header to it - // Do this last so we have the best chance of getting the time correct and - // all sensor names correct - // Writing to the SD card can be power intensive, so if we're skipping - // the sensor setup we'll skip this too. - if (getBatteryVoltage() > 3.4) { - Serial.println(F("Setting up file on SD card")); - dataLogger.turnOnSDcard( - true); // true = wait for card to settle after power up - dataLogger.createLogFile(true); // true = write a new header - dataLogger.turnOffSDcard( - true); // true = wait for internal housekeeping after write - } - - // Call the processor sleep - Serial.println(F("Putting processor to sleep\n")); - dataLogger.systemSleep(); -} -/** End [setup] */ - - -// ========================================================================== -// Arduino Loop Function -// ========================================================================== -/** Start [loop] */ -// Use this short loop for simple data logging and sending -void loop() { - // Note: Please change these battery voltages to match your battery - // At very low battery, just go back to sleep - if (getBatteryVoltage() < 3.4) { - dataLogger.systemSleep(); - } - // At moderate voltage, log data but don't send it over the modem - else if (getBatteryVoltage() < 3.55) { - dataLogger.logData(); - } - // If the battery is good, send the data to the world - else { - dataLogger.logDataAndPublish(); - } -} -/** End [loop] */ From b1f3afcf53067379f642475405c0058f4ad1f38b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 13:26:07 -0400 Subject: [PATCH 26/89] Removed code to not update metadata, for now Signed-off-by: Sara Damiano --- src/LoggerModem.cpp | 19 ++---- src/LoggerModem.h | 93 ----------------------------- src/modems/DigiXBeeWifi.cpp | 113 +++++++++++++++++------------------- 3 files changed, 58 insertions(+), 167 deletions(-) diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index 48404d67e..b44fa8159 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -10,16 +10,12 @@ #include "LoggerModem.h" // Initialize the static members -loggerModem::PollModemMetaData_t loggerModem::_pollModemMetaData = - POLL_MODEM_META_DATA_DEF; - -int16_t loggerModem::_priorRSSI = SENSOR_DEFAULT_I; -int16_t loggerModem::_priorSignalPercent = SENSOR_DEFAULT_I; -float loggerModem::_priorModemTemp = SENSOR_DEFAULT_F; -float loggerModem::_priorBatteryState = SENSOR_DEFAULT_F; -float loggerModem::_priorBatteryPercent = SENSOR_DEFAULT_F; -float loggerModem::_priorBatteryVoltage = SENSOR_DEFAULT_F; - +int16_t loggerModem::_priorRSSI = -9999; +int16_t loggerModem::_priorSignalPercent = -9999; +float loggerModem::_priorModemTemp = -9999; +float loggerModem::_priorBatteryState = -9999; +float loggerModem::_priorBatteryPercent = -9999; +float loggerModem::_priorBatteryVoltage = -9999; // Constructor loggerModem::loggerModem(int8_t powerPin, int8_t statusPin, bool statusLevel, @@ -309,9 +305,6 @@ void loggerModem::setModemPinModes(void) { } -void loggerModem::pollModemMetadata(PollModemMetaData_t status) { - _pollModemMetaData = status; -} bool loggerModem::updateModemMetadata(void) { bool success = true; diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 3564e1781..2b2c7b116 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -989,99 +989,6 @@ class loggerModem { // modemType gsmModem; // modemClientType gsmClient; - - /** - * @brief The retreived modem paramters - * - */ - String _modemHwVersion; - String _modemSerialNumber; - String _modemFwVersion; - - /** - * @brief Get a printable description of the modem. - * - * - * @note These values are polled for and cached in memory till needed - * - * @return *string discritption of modem. - */ - String getModemDevId(void) - {return _modemName+F(" Sn ")+_modemSerialNumber+F(" HwVer " )+_modemHwVersion+F(" FwVer ")+_modemFwVersion;} - - /** - * @brief modem management data setup - * - * Set in setup() - * - * @param status type of default polling - */ -#if !defined POLL_MODEM_META_DATA_ON -#define POLL_MODEM_META_DATA_ALL 0xFF -#endif // POLL_MODEM_META_DATA_ON - typedef enum { - POLL_MODEM_META_DATA_OFF = 0x0, - POLL_MODEM_META_DATA_RSSI = 0x01, - POLL_MODEM_META_DATA_VCC = 0x02, - POLL_MODEM_META_DATA_TEMP = 0x04, - POLL_MODEM_META_DATA_PARM4 = 0x08, - POLL_MODEM_META_DATA_PARM5 = 0x010, - POLL_MODEM_META_DATA_DEF = POLL_MODEM_META_DATA_ALL, - } PollModemMetaData_t; - /** - * @brief poll modem meta data - * - * Set polling status. - * Default won't poll - */ - void pollModemMetadata(PollModemMetaData_t status = POLL_MODEM_META_DATA_DEF); - - /** - * @brief return state of modem poll and what to poll for - * - * Set polling status. - * @param status return poll status ~ one of PollModemMetaData_t - */ - uint8_t getModemMetadata() { - return _pollModemMetaData; - } - - -#if not defined SENSOR_DEFAULT_I -#define SENSOR_DEFAULT_I -1 -// old standard -9999 -#endif // SENSOR_DEFAULT - -#if not defined SENSOR_DEFAULT_F -#define SENSOR_DEFAULT_F -0.0099 -// old standard -9999 -#endif // SENSOR_DEFAULT - -public: - /** - * @brief Set the power pin. - * - * If this function is not called, the power pin is defined on init - * - * @param powerPin The arduino pin number or if none <0 . - */ - inline void setPowerPin(int8_t powerPin) {_powerPin = powerPin;} - - /** - * @brief get the power pin. - * - * @returns powerPin - */ - inline int8_t getPowerPin() {return _powerPin;} - - protected: - /** - * @brief poll the modem management data - * - * Set in the init() portion of the #modemSetup(). - */ - PollModemMetaData_t static _pollModemMetaData; - }; // typedef float (loggerModem::_*loggerGetValueFxn)(void); diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 9392f75b1..36ccb049c 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -456,72 +456,63 @@ bool DigiXBeeWifi::updateModemMetadata(void) { bool success = true; // Unset whatever we had previously - loggerModem::_priorRSSI = SENSOR_DEFAULT_I; - loggerModem::_priorSignalPercent = SENSOR_DEFAULT_I; - loggerModem::_priorBatteryState = SENSOR_DEFAULT_I; - loggerModem::_priorBatteryPercent = SENSOR_DEFAULT_I; - loggerModem::_priorBatteryPercent = SENSOR_DEFAULT_I; - loggerModem::_priorModemTemp = SENSOR_DEFAULT_F; + loggerModem::_priorRSSI = -9999; + loggerModem::_priorSignalPercent = -9999; + loggerModem::_priorBatteryState = -9999; + loggerModem::_priorBatteryPercent = -9999; + loggerModem::_priorBatteryPercent = -9999; + loggerModem::_priorModemTemp = -9999; // Initialize variable - int16_t rssi = SENSOR_DEFAULT_I; - // int16_t percent = SENSOR_DEFAULT_I; -#define XBEE_V_KEY 9999 - uint16_t volt_mV = XBEE_V_KEY; - - // if not enabled don't collect data - if (0 == loggerModem::_pollModemMetaData) { - MS_DBG(F("updateModemMetadata None to update")); - return false; - } + int16_t rssi = -9999; + // int16_t percent = -9999; + uint16_t volt_mV = 9999; + // Enter command mode only once for temp and battery - MS_DBG(F("updateModemMetadata Entering Command Mode:")); + MS_DBG(F("Entering Command Mode to update modem metadata:")); success &= gsmModem.commandMode(); - if (POLL_MODEM_META_DATA_RSSI & loggerModem::_pollModemMetaData) { - // Assume a signal has already been established. - // Try to get a valid signal quality - // NOTE: We can't actually distinguish between a bad modem response, no - // modem response, and a real response from the modem of no - // service/signal. The TinyGSM getSignalQuality function returns the - // same "no signal" value (99 CSQ or 0 RSSI) in all 3 cases. Try up to 5 - // times to get a signal quality - that is, ping NIST 5 times and see if - // the value updates - int8_t num_trys_remaining = 5; - do { - rssi = gsmModem.getSignalQuality(); - MS_DBG(F("Raw signal quality("), num_trys_remaining, F("):"), rssi); - if (rssi != 0 && rssi != SENSOR_DEFAULT_I) break; - num_trys_remaining--; - } while ((rssi == 0 || rssi == SENSOR_DEFAULT_I) && num_trys_remaining); - - - loggerModem::_priorSignalPercent = getPctFromRSSI(rssi); - MS_DBG(F("CURRENT Percent signal strength:"), - loggerModem::_priorSignalPercent); - - loggerModem::_priorRSSI = rssi; - MS_DBG(F("CURRENT RSSI:"), rssi); - } - if (POLL_MODEM_META_DATA_VCC & loggerModem::_pollModemMetaData) { - // MS_DBG(F("Getting input voltage:")); - volt_mV = gsmModem.getBattVoltage(); - MS_DBG(F("CURRENT Modem battery (mV):"), volt_mV); - if (volt_mV != XBEE_V_KEY) { - loggerModem::_priorBatteryVoltage = - static_cast(volt_mV / 1000); - } else { - loggerModem::_priorBatteryVoltage = - static_cast(SENSOR_DEFAULT_I); - } - } - if (POLL_MODEM_META_DATA_TEMP & loggerModem::_pollModemMetaData) { - // MS_DBG(F("Getting chip temperature:")); - loggerModem::_priorModemTemp = getModemChipTemperature(); - MS_DBG(F("CURRENT Modem temperature(C):"), - loggerModem::_priorModemTemp); + + // Assume a signal has already been established. + // Try to get a valid signal quality + // NOTE: We can't actually distinguish between a bad modem response, no + // modem response, and a real response from the modem of no + // service/signal. The TinyGSM getSignalQuality function returns the + // same "no signal" value (99 CSQ or 0 RSSI) in all 3 cases. + + // Try up to 5 times to get a signal quality + int8_t num_trys_remaining = 5; + do { + rssi = gsmModem.getSignalQuality(); + MS_DBG(F("Raw signal quality("), num_trys_remaining, F("):"), rssi); + if (rssi != 0 && rssi != -9999) break; + num_trys_remaining--; + } while ((rssi == 0 || rssi == -9999) && num_trys_remaining); + + + // Convert signal quality to a percent + loggerModem::_priorSignalPercent = getPctFromRSSI(rssi); + MS_DBG(F("CURRENT Percent signal strength:"), + loggerModem::_priorSignalPercent); + + loggerModem::_priorRSSI = rssi; + MS_DBG(F("CURRENT RSSI:"), rssi); + + + MS_DBG(F("Getting input voltage:")); + volt_mV = gsmModem.getBattVoltage(); + MS_DBG(F("CURRENT Modem battery (mV):"), volt_mV); + if (volt_mV != 9999) { + loggerModem::_priorBatteryVoltage = static_cast(volt_mV / 1000); + } else { + loggerModem::_priorBatteryVoltage = static_cast(-9999); } - // Exit command modem - MS_DBG(F("updateModemMetadata Leaving Command Mode:")); + + MS_DBG(F("Getting chip temperature:")); + loggerModem::_priorModemTemp = getModemChipTemperature(); + MS_DBG(F("CURRENT Modem temperature(C):"), loggerModem::_priorModemTemp); + + // Exit command mode + MS_DBG(F("Leaving Command Mode:")); gsmModem.exitCommand(); ++updateModemMetadata_cnt; From 49d1811b112799f88718a82eab371d9f18380ca1 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 13:26:52 -0400 Subject: [PATCH 27/89] Add wake and power on checks to connectInternet Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 60 ++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 14 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 36ccb049c..aec6d3b81 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -35,20 +35,52 @@ DigiXBeeWifi::~DigiXBeeWifi() {} MS_IS_MODEM_AWAKE(DigiXBeeWifi); MS_MODEM_WAKE(DigiXBeeWifi); -// MS_MODEM_CONNECT_INTERNET(DigiXBeeWifi); has instability -// See https://github.com/neilh10/ModularSensors/issues/125 -bool DigiXBeeWifi::connectInternet(uint32_t maxConnectionTime) { - MS_START_DEBUG_TIMER - MS_DBG(F("\nDigiXbee Attempting to connect to WiFi network...")); - if (!(gsmModem.isNetworkConnected())) { - if (!gsmModem.waitForNetwork(maxConnectionTime)) { - PRINTOUT(F("... WiFi connection failed")); - return false; - } - } - MS_DBG(F("... WiFi connected after"), MS_PRINT_DEBUG_TIMER, - F("milliseconds!")); - return true; + +// This is different MS_MODEM_CONNECT_INTERNET in that it doesn't attempt to +// resend credentials +bool DigiXBeeWifi::connectInternet(uint32_t maxConnectionTime) { + bool success = true; + + /** Power up, if necessary */ + bool wasPowered = true; + if (_millisPowerOn == 0) { + modemPowerUp(); + wasPowered = false; + } + + /** Check if the modem was awake, wake it if not */ + bool wasAwake = isModemAwake(); + if (!wasAwake) { + MS_DBG(F("Waiting for modem to boot after power on ...")); + while (millis() - _millisPowerOn < _wakeDelayTime_ms) { /** wait */ + } + MS_DBG(F("Waking up the modem to connect to the internet ...")); + success &= modemWake(); + } else { + MS_DBG(F("Modem was already awake and should be ready.")); + } + + if (success) { + MS_START_DEBUG_TIMER + MS_DBG(F("\nAttempting to connect to WiFi without sending new " + "credentials...")); + if (!(gsmModem.isNetworkConnected())) { + if (!gsmModem.waitForNetwork(maxConnectionTime)) { + PRINTOUT(F("... WiFi connection failed")); + return false; + } + } + MS_DBG(F("... WiFi connected after"), MS_PRINT_DEBUG_TIMER, + F("milliseconds!")); + return true; + } + if (!wasPowered) { + MS_DBG(F("Modem was powered to connect to the internet! " + "Remember to turn it off when you're done.")); + } else if (!wasAwake) { + MS_DBG(F("Modem was woken up to connect to the internet! " + "Remember to put it to sleep when you're done.")); + } } MS_MODEM_IS_INTERNET_AVAILABLE(DigiXBeeWifi); From 98cf411e4d427525b99bc220c7cb6241f75de8bf Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 13:27:34 -0400 Subject: [PATCH 28/89] Add comments to modem setup Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 111 +++++++++++++++++++++++------------- 1 file changed, 72 insertions(+), 39 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index aec6d3b81..43a7b20dc 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -92,29 +92,36 @@ bool DigiXBeeWifi::extraModemSetup(void) { /** First run the TinyGSM init() function for the XBee. */ MS_DBG(F("Initializing the XBee...")); success &= gsmModem.init(); - if (!success) { MS_DBG(F("Failed init")); } + if (!success) { MS_DBG(F("Failed TinyGSM init")); } gsmClient.init(&gsmModem); _modemName = gsmModem.getModemName(); /** Then enter command mode to set pin outputs. */ + MS_DBG(F("Putting XBee into command mode...")); if (gsmModem.commandMode()) { - String xbeeSnLow,xbeeSnHigh;//XbeeDevHwVer,XbeeFwVer; + MS_DBG(F("Getting Detailed Modem Version...")); + String xbeeSnLow; + String xbeeSnHigh; + String _modemHwVersion; + String _modemFwVersion; gsmModem.getSeries(); _modemName = gsmModem.getModemName(); gsmModem.sendAT(F("SL")); // Request Module MAC/Serial Number Low gsmModem.waitResponse(1000, xbeeSnLow); gsmModem.sendAT(F("SH")); // Request Module MAC/Serial Number High gsmModem.waitResponse(1000, xbeeSnHigh); - _modemSerialNumber = xbeeSnHigh+xbeeSnLow; gsmModem.sendAT(F("HV")); // Request Module Hw Version gsmModem.waitResponse(1000, _modemHwVersion); gsmModem.sendAT(F("VR")); // Firmware Version gsmModem.waitResponse(1000, _modemFwVersion); - PRINTOUT(F("XbeeWiFi internet comms with"),_modemName, - F("Mac/Sn "), _modemSerialNumber,F("HwVer"),_modemHwVersion, F("FwVer"), _modemFwVersion); - - // Leave all unused pins disconnected. Use the PR command to pull all of - // the inputs on the device high using 40 k internal pull-up resistors. - // You do not need a specific treatment for unused outputs. + PRINTOUT(F("Digi XBee"), _modemName, F("Mac/SN"), xbeeSnHigh, , + xbeeSnLow, F("HwVer"), _modemHwVersion, F("FwVer"), + _modemFwVersion); + + MS_DBG(F("Enabling XBee Pin Pullups...")); + // Leave all unused pins disconnected. Use the PR command to pull + // all of the inputs on the device high using 40 k internal pull-up + // resistors. You do not need a specific treatment for unused + // outputs. // Mask Bit Description // 1 0001 0 TH11 DIO4 // 1 0002 1 TH17 DIO3 @@ -134,7 +141,8 @@ bool DigiXBeeWifi::extraModemSetup(void) { // 3D3F gsmModem.sendAT(GF("PR"), "3D3F"); success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Fail PR "), success); } + if (!success) { MS_DBG(F("Failed to set pin pullups"), success); } + #if !defined MODEMPHY_NEVER_SLEEPS #define XBEE_SLEEP_SETTING 1 #define XBEE_SLEEP_ASSOCIATE 100 @@ -142,46 +150,69 @@ bool DigiXBeeWifi::extraModemSetup(void) { #define XBEE_SLEEP_SETTING 0 #define XBEE_SLEEP_ASSOCIATE 40 #endif // MODEMPHY_NEVER_SLEEPS + + MS_DBG(F("Setting I/O Pins...")); // To use sleep pins they physically need to be enabled. - // Set DIO8 to be used for sleep requests - // NOTE: Only pin 9/DIO8/DTR can be used for this function + /** Enable pin sleep functionality on `DIO8`. + * NOTE: Only the `DTR_N/SLEEP_RQ/DIO8` pin (9 on the bee socket) can be + * used for this pin sleep/wake. */ gsmModem.sendAT(GF("D8"), XBEE_SLEEP_SETTING); success &= gsmModem.waitResponse() == 1; - // Turn on status indication pin - it will be HIGH when the XBee is - // awake NOTE: Only pin 13/ON/SLEEPnot/DIO9 can be used for this - // function + if (!success) { + MS_DBG(F("Failed to set DTR_N/SLEEP_RQ/DIO8"), success); + } + /** Enable status indication on `DIO9` - it will be HIGH when the XBee + * is awake. + * NOTE: Only the `ON/SLEEP_N/DIO9` pin (13 on the bee socket) can be + * used for direct status indication. */ gsmModem.sendAT(GF("D9"), XBEE_SLEEP_SETTING); success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Fail D9 "), success); } /**/ - // /#endif //MODEMPHY_USE_SLEEP_PINS_SETTING - // Turn on CTS pin - it will be LOW when the XBee is ready to receive - // commands This can be used as proxy for status indication if the true - // status pin is not accessible NOTE: Only pin 12/DIO7/CTS can be used - // for this function - /*gsmModem.sendAT(GF("D7"),1); + if (!success) { MS_DBG(F("Failed to set ON/SLEEP_N/DIO9"), success); } + /** Enable CTS on `DIO7` - it will be `LOW` when it is clear to send + * data to the XBee. This can be used as proxy for status indication if + * that pin is not readable. + * NOTE: Only the `CTS_N/DIO7` pin (12 on the bee socket) can be used + * for CTS. */ + gsmModem.sendAT(GF("D7"), 1); + success &= gsmModem.waitResponse() == 1; + if (!success) { MS_DBG(F("Failed to set CTS_N/DIO7"), success); } + /** Enable association indication on `DIO5` - this is should be + * directly attached to an LED if possible. + * - Solid light indicates no connection + * - Single blink indicates connection + * - double blink indicates connection but failed TCP link on last + * attempt + * + * NOTE: Only the `Associate/DIO5` pin (15 on the bee socket) can be + * used for this function. */ + gsmModem.sendAT(GF("D5"), 1); success &= gsmModem.waitResponse() == 1; - if (!success) {MS_DBG(F("Fail D7 "),success);}*/ - // Turn on the associate LED (if you're using a board with one) - // NOTE: Only pin 15/DIO5 can be used for this function - // gsmModem.sendAT(GF("D5"),1); - // success &= gsmModem.waitResponse() == 1; - // Turn on the RSSI indicator LED (if you're using a board with one) - // NOTE: Only pin 6/DIO10/PWM0 can be used for this function - // gsmModem.sendAT(GF("P0"),1); - // success &= gsmModem.waitResponse() == 1; + if (!success) { MS_DBG(F("Failed to set Associate/DIO5"), success); } + /** Enable RSSI PWM output on `DIO10` - this should be directly + * attached to an LED if possible. A higher PWM duty cycle (and + * thus brighter LED) indicates better signal quality. NOTE: Only + * the `DIO10/PWM0` pin (6 on the bee socket) can be used for this + * function. */ + gsmModem.sendAT(GF("P0"), 1); + success &= gsmModem.waitResponse() == 1; + if (!success) { MS_DBG(F("Failed to set DIO10/PWM0"), success); } + // Set to TCP mode gsmModem.sendAT(GF("IP"), 1); success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Fail IP "), success); } + if (!success) { MS_DBG(F("Fail to set IP mode"), success); } - // Put the XBee in pin sleep mode in conjuction with D8=1 + /** Put the XBee in pin sleep mode in conjuction with D8=1 */ MS_DBG(F("Setting Sleep Options...")); gsmModem.sendAT(GF("SM"), XBEE_SLEEP_SETTING); success &= gsmModem.waitResponse() == 1; - // Disassociate from network for lowest power deep sleep - // 40 - Aay associated with AP during sleep - draws more current - // (+10mA?) 100 -Cyclic sleep ST specifies time before reutnring to - // sleep 200 - SRGD magic number + // Disassociate from the network for the lowest power deep sleep. + // 40 - Stay associated with AP during sleep - draws more current + // (+10mA?) + // 100 - For cyclic sleep, ST specifies the time before + // returning to sleep. With this bit set, new receptions from either + // the serial or the RF port do not restart the ST timer. Current + // implementation does not support this bit being turned off. gsmModem.sendAT(GF("SO"), XBEE_SLEEP_ASSOCIATE); success &= gsmModem.waitResponse() == 1; @@ -193,9 +224,10 @@ bool DigiXBeeWifi::extraModemSetup(void) { MS_DBG(F("Fail Connect "), success); success = true; } + /** Set the socket timeout to 10s (this is default). */ gsmModem.sendAT(GF("TM"), 64); success &= gsmModem.waitResponse() == 1; - //IPAddress newHostIp = IPAddress(0, 0, 0, 0); //default in NV + /** Set the destination IP to 0 (this is default). */ gsmModem.sendAT(GF("DL"), GF("0.0.0.0")); success &= gsmModem.waitResponse() == 1; @@ -205,7 +237,8 @@ bool DigiXBeeWifi::extraModemSetup(void) { } else { MS_DBG(F("Failed Setting WiFi"), _ssid); } - // Write changes to flash and apply them + /** Write all changes to flash and apply them. */ + MS_DBG(F("Applying changes...")); gsmModem.writeChanges(); // Scan for AI last node join request From 7abc2972c7e170338ed2bfcfc0ff95096a409e1c Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 13:29:48 -0400 Subject: [PATCH 29/89] Add comments to NIST connection Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 74 +++++++++++++++---------------------- 1 file changed, 29 insertions(+), 45 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 43a7b20dc..a8e0b0eee 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -358,16 +358,17 @@ bool DigiXBeeWifi::extraModemSetup(void) { void DigiXBeeWifi::disconnectInternet(void) { - // Ensure Wifi XBee IP socket torn down by forcing connection to localhost IP - // For A XBee S6B bug, then force restart - // Note: TinyGsmClientXbee.h:modemStop() had a hack for closing socket with Timeout=0 "TM0" for S6B disabled - - String oldRemoteIp = gsmClient.remoteIP(); - IPAddress newHostIp = IPAddress(127, 0, 0, 1); //localhost - gsmClient.connect(newHostIp,80); - //??gsmClient.modemConnect(newHostpP,80);// doesn't work - MS_DBG(gsmModem.getBeeName(), oldRemoteIp, F(" disconnectInternet set to "),gsmClient.remoteIP()); - + // Ensure Wifi XBee IP socket torn down by forcing connection to + // localhost IP For A XBee S6B bug, then force restart. Note: + // TinyGsmClientXbee.h:modemStop() had a hack for closing socket with + // Timeout=0 "TM0" for S6B disabled + + String oldRemoteIp = gsmClient.remoteIP(); + IPAddress newHostIp = IPAddress(127, 0, 0, 1); // localhost + gsmClient.connect(newHostIp, 80); + MS_DBG(gsmModem.getBeeName(), oldRemoteIp, F(" disconnectInternet set to "), + gsmClient.remoteIP()); + gsmModem.restart(); } @@ -382,63 +383,46 @@ uint32_t DigiXBeeWifi::getNISTTime(void) { gsmClient.stop(); - // Try up to 12 times to get a timestamp from NIST + // Try up to 4 NIST IP addresses attempting to get a timestamp from NIST #if !defined NIST_SERVER_RETRYS #define NIST_SERVER_RETRYS 4 #endif // NIST_SERVER_RETRYS - String nistIpStr; - __attribute__((unused)) uint8_t index = 0; + for (uint8_t i = 0; i < NIST_SERVER_RETRYS; i++) { - // Must ensure that we do not ping the daylight more than once every 4 - // seconds. NIST clearly specifies here that this is a requirement for - // all software that accesses its servers: + // Must ensure that we do not ping the daylight servers more than once + // every 4 seconds. NIST clearly specifies here that this is a + // requirement for all software that accesses its servers: // https://tf.nist.gov/tf-cgi/servers.cgi while (millis() < _lastNISTrequest + 4000) { // wait } // Make TCP connection + // Uses "TIME" protocol on port 37 NIST: This protocol is expensive, + // since it uses the complete tcp machinery to transmit only 32 bits + // of data. FUTURE Users are *strongly* encouraged to upgrade to the + // network time protocol (NTP), which is both more accurate and more + // robust. MS_DBG(F("\nConnecting to NIST daytime Server")); bool connectionMade = false; - // This is the IP address of time-e-wwv.nist.gov + // These are is the IP address of time-[a,b,c,d]-wwv.nist.gov // XBee's address lookup falters on time.nist.gov - // NOTE: This "connect" only sets up the connection parameters, the TCP - // socket isn't actually opened until we first send data (the '!' below) - - // Uses "TIME" protocol on port 37 NIST: This protocol is expensive, since it - // uses the complete tcp machinery to transmit only 32 bits of data. - // FUTURE Users are *strongly* encouraged to upgrade to the network time protocol - // (NTP), which is both more accurate and more robust.*/ + #define TIME_PROTOCOL_PORT 37 #define IP_STR_LEN 18 const char ipAddr[NIST_SERVER_RETRYS][IP_STR_LEN] = { - {"132,163, 97, 1"}, + {"132, 163, 97, 1"}, {"132, 163, 97, 2"}, {"132, 163, 97, 3"}, {"132, 163, 97, 4"}}; IPAddress ip1(132, 163, 97, 1); // Initialize -#if 0 - gsmModem.sendAT(F("time-e-wwv.nist.gov")); - index = gsmModem.waitResponse(4000, nistIpStr); - nistIpStr.trim(); - uint16_t nistIp_len = nistIpStr.length(); - if ((nistIp_len < 7) || (nistIp_len > 20)) - { - ip1.fromString(ipAddr[i]); - MS_DBG(F("Bad lookup"), nistIpStr, "'=", nistIp_len, F(" Using "), - ipAddr[i]); - } else { - ip1.fromString(nistIpStr); - PRINTOUT(F("Good lookup mdmIP["), i, "/", NIST_SERVER_RETRYS, - F("] '"), nistIpStr, "'=", nistIp_len); - } -#else ip1.fromString(ipAddr[i]); - PRINTOUT(F("NIST lookup mdmIP["), i, "/", NIST_SERVER_RETRYS, - F("] with "), ip1); -// F("] with "), ipAddr[i]); -#endif + MS_DBG(F("NIST lookup mdmIP["), i, "/", NIST_SERVER_RETRYS, + F("] with "), ip1); + + // NOTE: This "connect" only sets up the connection parameters, the TCP + // socket isn't actually opened until we first send data (the '!' below) connectionMade = gsmClient.connect(ip1, TIME_PROTOCOL_PORT); // Need to send something before connection is made gsmClient.println('!'); From 470c1df55408dbc6d99a687054c469c5e86e792b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 13:30:35 -0400 Subject: [PATCH 30/89] Remove commented code in getModemSignalQuality Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index a8e0b0eee..4e1a1dc02 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -461,29 +461,13 @@ bool DigiXBeeWifi::getModemSignalQuality(int16_t& rssi, int16_t& percent) { percent = -9999; rssi = -9999; - // NOTE: using Google doesn't work because there's no reply - MS_DBG(F("Opening connection to NIST to check connection strength...")); - // This is the IP address of time-c-g.nist.gov - // XBee's address lookup falters on time.nist.gov - // NOTE: This "connect" only sets up the connection parameters, the TCP - // socket isn't actually opened until we first send data (the '!' below) - // IPAddress ip(132, 163, 97, 6); - // gsmClient.connect(ip, 37); - // Wait so NIST doesn't refuse us! - //while (millis() < _lastNISTrequest + 4000) {} - // Need to send something before connection is made - //gsmClient.println('!'); - //uint32_t start = millis(); - //delay(100); // Need this delay! Can get away with 50, but 100 is safer. - //while (gsmClient && gsmClient.available() < 4 && millis() - start < 5000L) { - //} // Assume measurement from previous connection // Get signal quality // NOTE: We can't actually distinguish between a bad modem response, no // modem response, and a real response from the modem of no service/signal. - // The TinyGSM getSignalQuality function returns the same "no signal" - // value (99 CSQ or 0 RSSI) in all 3 cases. + // The TinyGSM getSignalQuality function returns the same "no signal" value + // (99 CSQ or 0 RSSI) in all 3 cases. MS_DBG(F("Getting signal quality:")); signalQual = gsmModem.getSignalQuality(); MS_DBG(F("Raw signal quality:"), signalQual); From 63b311030c2ea3be7b0f80ae79238431f292dda6 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 23 Jun 2023 14:01:46 -0400 Subject: [PATCH 31/89] Removed errant comma Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 4e1a1dc02..fc7ac8c6c 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -113,9 +113,8 @@ bool DigiXBeeWifi::extraModemSetup(void) { gsmModem.waitResponse(1000, _modemHwVersion); gsmModem.sendAT(F("VR")); // Firmware Version gsmModem.waitResponse(1000, _modemFwVersion); - PRINTOUT(F("Digi XBee"), _modemName, F("Mac/SN"), xbeeSnHigh, , - xbeeSnLow, F("HwVer"), _modemHwVersion, F("FwVer"), - _modemFwVersion); + PRINTOUT(F("Digi XBee"), _modemName, F("Mac/SN"), xbeeSnHigh, xbeeSnLow, + F("HwVer"), _modemHwVersion, F("FwVer"), _modemFwVersion); MS_DBG(F("Enabling XBee Pin Pullups...")); // Leave all unused pins disconnected. Use the PR command to pull From 390f8444c8fc7a9c0466f35ee8c422f391093757 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 26 Jun 2023 12:52:26 -0400 Subject: [PATCH 32/89] Restore modem detailed versioning Signed-off-by: Sara Damiano --- src/LoggerModem.cpp | 5 +++++ src/LoggerModem.h | 32 ++++++++++++++++++++++++++++++++ src/modems/DigiXBeeWifi.cpp | 3 +-- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index b44fa8159..7dbd69b78 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -63,6 +63,11 @@ String loggerModem::getModemName(void) { return _modemName; } +String loggerModem::getModemDevId(void) { + return _modemName + F(" Sn ") + _modemSerialNumber + F(" HwVer ") + + _modemHwVersion + F(" FwVer ") + _modemFwVersion; +} + void loggerModem::modemPowerUp(void) { if (_powerPin >= 0) { if (_modemSleepRqPin >= 0) { diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 2b2c7b116..591bf0b1d 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -340,6 +340,16 @@ class loggerModem { */ String getModemName(void); + /** + * @brief Get a detailed printable description of the modem. + * + * @note These values are polled for and cached in memory till needed + * + * @return **String** The concatenated name, hardware version, firmware + * version, and serial number fo the modem.. + */ + String getModemDevId(void); + /** * @brief Set up the modem before first use. * @@ -989,6 +999,28 @@ class loggerModem { // modemType gsmModem; // modemClientType gsmClient; + + /** + * @brief The modem hardware version. + * + * Set in #modemSetup(). + * Returned as a portion of the #getModemDevId(). + */ + String _modemHwVersion; + /** + * @brief The modem firmware version. + * + * Set in #modemSetup(). + * Returned as a portion of the #getModemDevId(). + */ + String _modemFwVersion; + /** + * @brief The modem serial number. + * + * Set in #modemSetup(). + * Returned as a portion of the #getModemDevId(). + */ + String _modemSerialNumber; }; // typedef float (loggerModem::_*loggerGetValueFxn)(void); diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index fc7ac8c6c..5206a1fa3 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -101,14 +101,13 @@ bool DigiXBeeWifi::extraModemSetup(void) { MS_DBG(F("Getting Detailed Modem Version...")); String xbeeSnLow; String xbeeSnHigh; - String _modemHwVersion; - String _modemFwVersion; gsmModem.getSeries(); _modemName = gsmModem.getModemName(); gsmModem.sendAT(F("SL")); // Request Module MAC/Serial Number Low gsmModem.waitResponse(1000, xbeeSnLow); gsmModem.sendAT(F("SH")); // Request Module MAC/Serial Number High gsmModem.waitResponse(1000, xbeeSnHigh); + _modemSerialNumber = xbeeSnHigh + xbeeSnLow; gsmModem.sendAT(F("HV")); // Request Module Hw Version gsmModem.waitResponse(1000, _modemHwVersion); gsmModem.sendAT(F("VR")); // Firmware Version From 8d9152b10dcc950f5967015261f9b9e7303c9828 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 26 Jun 2023 13:52:15 -0400 Subject: [PATCH 33/89] Ctor for sleep assoc, check pins for sleep opts Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 98 +++++++++++++++++++++++-------------- src/modems/DigiXBeeWifi.h | 13 +++-- 2 files changed, 70 insertions(+), 41 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 5206a1fa3..d51f47491 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -15,7 +15,8 @@ DigiXBeeWifi::DigiXBeeWifi(Stream* modemStream, int8_t powerPin, int8_t statusPin, bool useCTSStatus, int8_t modemResetPin, int8_t modemSleepRqPin, - const char* ssid, const char* pwd) + const char* ssid, const char* pwd, + bool maintainAssociation) : DigiXBee(powerPin, statusPin, useCTSStatus, modemResetPin, modemSleepRqPin), #ifdef MS_DIGIXBEEWIFI_DEBUG_DEEP @@ -26,7 +27,8 @@ DigiXBeeWifi::DigiXBeeWifi(Stream* modemStream, int8_t powerPin, #endif gsmClient(gsmModem), _ssid(ssid), - _pwd(pwd) { + _pwd(pwd), + _maintainAssociation(maintainAssociation) { } // Destructor @@ -67,12 +69,11 @@ bool DigiXBeeWifi::connectInternet(uint32_t maxConnectionTime) { if (!(gsmModem.isNetworkConnected())) { if (!gsmModem.waitForNetwork(maxConnectionTime)) { PRINTOUT(F("... WiFi connection failed")); - return false; + success = false; } } MS_DBG(F("... WiFi connected after"), MS_PRINT_DEBUG_TIMER, F("milliseconds!")); - return true; } if (!wasPowered) { MS_DBG(F("Modem was powered to connect to the internet! " @@ -81,6 +82,7 @@ bool DigiXBeeWifi::connectInternet(uint32_t maxConnectionTime) { MS_DBG(F("Modem was woken up to connect to the internet! " "Remember to put it to sleep when you're done.")); } + return success; } MS_MODEM_IS_INTERNET_AVAILABLE(DigiXBeeWifi); @@ -141,39 +143,41 @@ bool DigiXBeeWifi::extraModemSetup(void) { success &= gsmModem.waitResponse() == 1; if (!success) { MS_DBG(F("Failed to set pin pullups"), success); } -#if !defined MODEMPHY_NEVER_SLEEPS -#define XBEE_SLEEP_SETTING 1 -#define XBEE_SLEEP_ASSOCIATE 100 -#else -#define XBEE_SLEEP_SETTING 0 -#define XBEE_SLEEP_ASSOCIATE 40 -#endif // MODEMPHY_NEVER_SLEEPS - MS_DBG(F("Setting I/O Pins...")); // To use sleep pins they physically need to be enabled. - /** Enable pin sleep functionality on `DIO8`. + /** Enable pin sleep functionality on `DIO8` if a pin is assigned. * NOTE: Only the `DTR_N/SLEEP_RQ/DIO8` pin (9 on the bee socket) can be * used for this pin sleep/wake. */ - gsmModem.sendAT(GF("D8"), XBEE_SLEEP_SETTING); + gsmModem.sendAT(GF("D8"), _modemSleepRqPin >= 0); success &= gsmModem.waitResponse() == 1; if (!success) { - MS_DBG(F("Failed to set DTR_N/SLEEP_RQ/DIO8"), success); + MS_DBG(F("Failed to set DTR_N/SLEEP_RQ/DIO8 to"), + _modemSleepRqPin >= 0, success); } - /** Enable status indication on `DIO9` - it will be HIGH when the XBee - * is awake. + + /** Enable status indication on `DIO9` if a pin is assigned - it will be + * HIGH when the XBee is awake. * NOTE: Only the `ON/SLEEP_N/DIO9` pin (13 on the bee socket) can be * used for direct status indication. */ - gsmModem.sendAT(GF("D9"), XBEE_SLEEP_SETTING); + gsmModem.sendAT(GF("D9"), _statusPin >= 0); success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Failed to set ON/SLEEP_N/DIO9"), success); } - /** Enable CTS on `DIO7` - it will be `LOW` when it is clear to send - * data to the XBee. This can be used as proxy for status indication if - * that pin is not readable. + if (!success) { + MS_DBG(F("Failed to set ON/SLEEP_N/DIO9 to"), _statusPin >= 0, + success); + } + + /** Enable CTS on `DIO7` if a pin is assigned - it will be `LOW` when + * it is clear to send data to the XBee. This can be used as proxy for + * status indication if that pin is not readable. * NOTE: Only the `CTS_N/DIO7` pin (12 on the bee socket) can be used * for CTS. */ - gsmModem.sendAT(GF("D7"), 1); + gsmModem.sendAT(GF("D7"), _statusPin >= 0 && !_statusLevel); success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Failed to set CTS_N/DIO7"), success); } + if (!success) { + MS_DBG(F("Failed to set CTS_N/DIO7 to"), + _statusPin >= 0 && !_statusLevel, success); + } + /** Enable association indication on `DIO5` - this is should be * directly attached to an LED if possible. * - Solid light indicates no connection @@ -201,18 +205,40 @@ bool DigiXBeeWifi::extraModemSetup(void) { if (!success) { MS_DBG(F("Fail to set IP mode"), success); } /** Put the XBee in pin sleep mode in conjuction with D8=1 */ - MS_DBG(F("Setting Sleep Options...")); - gsmModem.sendAT(GF("SM"), XBEE_SLEEP_SETTING); - success &= gsmModem.waitResponse() == 1; + // From the S6B User Guide: + // 0 - Normal. In this mode the device never sleeps. + // 1 - Pin Sleep. In this mode the device honors the SLEEP_RQ pin. + // Set D8 (DIO8 Configuration) to the sleep request function: 1. + // 4 - Cyclic Sleep. In this mode the device repeatedly sleeps for the + // value specified by SP and spends ST time awake. + // 5 - Cyclic Sleep with Pin Wake. In this mode the device acts as in + // Cyclic Sleep but does not sleep if the SLEEP_RQ pin is inactive, + // allowing the device to be kept awake or woken by the connected + // system. + if (_modemSleepRqPin >= 0) { + MS_DBG(F("Setting Sleep Options...")); + gsmModem.sendAT(GF("SM"), _modemSleepRqPin >= 0); + success &= gsmModem.waitResponse() == 1; + } + if (!success) { + MS_DBG(F("Failed to set sleep mode to"), _modemSleepRqPin >= 0, + success); + } // Disassociate from the network for the lowest power deep sleep. - // 40 - Stay associated with AP during sleep - draws more current - // (+10mA?) - // 100 - For cyclic sleep, ST specifies the time before - // returning to sleep. With this bit set, new receptions from either - // the serial or the RF port do not restart the ST timer. Current - // implementation does not support this bit being turned off. - gsmModem.sendAT(GF("SO"), XBEE_SLEEP_ASSOCIATE); + // From S6B User Guide: + // 0x40 - Stay associated with AP during sleep. Draw more current + // (+10mA?) during sleep with this option enabled, but also avoid data + // loss. + // 0x100 - For cyclic sleep, ST specifies the time before returning + // to sleep. With this bit set, new receptions from either the serial or + // the RF port do not restart the ST timer. Current implementation does + // not support this bit being turned off. + gsmModem.sendAT(GF("SO"), _maintainAssociation ? 0x40 : 0x100); success &= gsmModem.waitResponse() == 1; + if (!success) { + MS_DBG(F("Failed to set sleep mode to"), + _maintainAssociation ? 0x40 : 0x100, success); + } MS_DBG(F("Setting Wifi Network Options...")); // Put the network connection parameters into flash @@ -357,9 +383,7 @@ bool DigiXBeeWifi::extraModemSetup(void) { void DigiXBeeWifi::disconnectInternet(void) { // Ensure Wifi XBee IP socket torn down by forcing connection to - // localhost IP For A XBee S6B bug, then force restart. Note: - // TinyGsmClientXbee.h:modemStop() had a hack for closing socket with - // Timeout=0 "TM0" for S6B disabled + // localhost IP For A XBee S6B bug, then force restart. String oldRemoteIp = gsmClient.remoteIP(); IPAddress newHostIp = IPAddress(127, 0, 0, 1); // localhost diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index 5d7a31106..f236ed0de 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -105,10 +105,15 @@ class DigiXBeeWifi : public DigiXBee { * reference. * @param ssid The wifi network ID. * @param pwd The wifi network password, assuming WPA2. + * @param maintainAssociation Whether to maintain association with the + * access point during sleep. Maitaining the association during sleep draws + * more current (+10mA?), but also allows a faster reconnection on the next + * wake. */ DigiXBeeWifi(Stream* modemStream, int8_t powerPin, int8_t statusPin, bool useCTSStatus, int8_t modemResetPin, - int8_t modemSleepRqPin, const char* ssid, const char* pwd); + int8_t modemSleepRqPin, const char* ssid, const char* pwd, + bool maintainAssociation = false); /** * @brief Destroy the Digi XBee Wifi object - no action taken */ @@ -133,7 +138,7 @@ class DigiXBeeWifi : public DigiXBee { void setWiFiPwd(const char* WiFiPwd, bool copyId = false); String getWiFiId(void); String getWiFiPwd(void); - + #ifdef MS_DIGIXBEEWIFI_DEBUG_DEEP StreamDebugger _modemATDebugger; #endif @@ -164,15 +169,15 @@ class DigiXBeeWifi : public DigiXBee { private: const char* _ssid; const char* _pwd; + bool _maintainAssociation; // Access Management char* _ssid_buf = NULL; char* _pwd_buf = NULL; uint16_t updateModemMetadata_cnt = 0; - //This causes the Xbee to reset afte this number of transmission attempts + // This causes the Xbee to reset after this number of transmission attempts #define XBEE_RESET_THRESHOLD 4 - }; /**@}*/ #endif // SRC_MODEMS_DIGIXBEEWIFI_H_ From a008a69813ccd692757adb936c11db66feba9ac7 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 26 Jun 2023 14:37:57 -0400 Subject: [PATCH 34/89] Bump TinyGSM Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 2 +- library.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 2e7be5caa..0fcf0cf75 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -48,7 +48,7 @@ { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.5", + "version": "~0.11.6", "note": "A small Arduino library for GPRS modules.", "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", diff --git a/library.json b/library.json index 52d5f9fbe..157e60989 100644 --- a/library.json +++ b/library.json @@ -109,7 +109,7 @@ { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.5", + "version": "~0.11.6", "note": "A small Arduino library for GPRS modules.", "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", From 9082d424a0ac25ce4e6d311bda54178eed43c48b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 26 Jun 2023 16:43:31 -0400 Subject: [PATCH 35/89] Use changeSettingIfNeeded throughout setup Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 169 +++++++++++++++++++++++++----------- src/modems/DigiXBeeWifi.h | 4 + 2 files changed, 120 insertions(+), 53 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index d51f47491..b1460c8ff 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -117,6 +117,7 @@ bool DigiXBeeWifi::extraModemSetup(void) { PRINTOUT(F("Digi XBee"), _modemName, F("Mac/SN"), xbeeSnHigh, xbeeSnLow, F("HwVer"), _modemHwVersion, F("FwVer"), _modemFwVersion); + bool changesMade = false; MS_DBG(F("Enabling XBee Pin Pullups...")); // Leave all unused pins disconnected. Use the PR command to pull // all of the inputs on the device high using 40 k internal pull-up @@ -139,31 +140,40 @@ bool DigiXBeeWifi::extraModemSetup(void) { // 1 2000 13 TH12 DIO7/-CTR // 0 4000 14 TH02 DIO13/DOUT // 3D3F - gsmModem.sendAT(GF("PR"), "3D3F"); - success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Failed to set pin pullups"), success); } + bool changedRP = gsmModem.changeSettingIfNeeded(GF("PR"), "3D3F"); + changesMade |= changedRP; + if (changedRP) { + MS_DBG(F("Pin pullup bits changed to"), F("3D3F")); + } else { + MS_DEEP_DBG(F("Pin pullup bits not changed")); + } + MS_DBG(F("Setting I/O Pins...")); // To use sleep pins they physically need to be enabled. /** Enable pin sleep functionality on `DIO8` if a pin is assigned. * NOTE: Only the `DTR_N/SLEEP_RQ/DIO8` pin (9 on the bee socket) can be * used for this pin sleep/wake. */ - gsmModem.sendAT(GF("D8"), _modemSleepRqPin >= 0); - success &= gsmModem.waitResponse() == 1; - if (!success) { - MS_DBG(F("Failed to set DTR_N/SLEEP_RQ/DIO8 to"), - _modemSleepRqPin >= 0, success); + bool changedD8 = gsmModem.changeSettingIfNeeded(GF("D8"), + _modemSleepRqPin >= 0); + changesMade |= changedD8; + if (changedD8) { + MS_DBG(F("DTR_N/SLEEP_RQ/DIO8 changed to"), _modemSleepRqPin >= 0); + } else { + MS_DEEP_DBG(F("DTR_N/SLEEP_RQ/DIO8 not changed")); } /** Enable status indication on `DIO9` if a pin is assigned - it will be * HIGH when the XBee is awake. * NOTE: Only the `ON/SLEEP_N/DIO9` pin (13 on the bee socket) can be * used for direct status indication. */ - gsmModem.sendAT(GF("D9"), _statusPin >= 0); - success &= gsmModem.waitResponse() == 1; - if (!success) { - MS_DBG(F("Failed to set ON/SLEEP_N/DIO9 to"), _statusPin >= 0, - success); + bool changedD9 = gsmModem.changeSettingIfNeeded(GF("D9"), + _statusPin >= 0); + changesMade |= changedD9; + if (changedD9) { + MS_DBG(F("ON/SLEEP_N/DIO9 changed to"), _statusPin >= 0); + } else { + MS_DEEP_DBG(F("ON/SLEEP_N/DIO9 not changed")); } /** Enable CTS on `DIO7` if a pin is assigned - it will be `LOW` when @@ -171,11 +181,14 @@ bool DigiXBeeWifi::extraModemSetup(void) { * status indication if that pin is not readable. * NOTE: Only the `CTS_N/DIO7` pin (12 on the bee socket) can be used * for CTS. */ - gsmModem.sendAT(GF("D7"), _statusPin >= 0 && !_statusLevel); - success &= gsmModem.waitResponse() == 1; - if (!success) { - MS_DBG(F("Failed to set CTS_N/DIO7 to"), - _statusPin >= 0 && !_statusLevel, success); + bool changedD7 = gsmModem.changeSettingIfNeeded( + GF("D7"), _statusPin >= 0 && !_statusLevel); + changesMade |= changedD7; + if (changedD7) { + MS_DBG(F("CTS_N/DIO7 changed to"), + _statusPin >= 0 && !_statusLevel); + } else { + MS_DEEP_DBG(F("CTS_N/DIO7 not changed")); } /** Enable association indication on `DIO5` - this is should be @@ -187,22 +200,26 @@ bool DigiXBeeWifi::extraModemSetup(void) { * * NOTE: Only the `Associate/DIO5` pin (15 on the bee socket) can be * used for this function. */ - gsmModem.sendAT(GF("D5"), 1); - success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Failed to set Associate/DIO5"), success); } + bool changedD5 = gsmModem.changeSettingIfNeeded(GF("D5"), 1); + changesMade |= changedD5; + if (changedD5) { + MS_DBG(F("Associate/DIO5 changed to"), 1); + } else { + MS_DEEP_DBG(F("Associate/DIO5 not changed")); + } + /** Enable RSSI PWM output on `DIO10` - this should be directly * attached to an LED if possible. A higher PWM duty cycle (and * thus brighter LED) indicates better signal quality. NOTE: Only * the `DIO10/PWM0` pin (6 on the bee socket) can be used for this * function. */ - gsmModem.sendAT(GF("P0"), 1); - success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Failed to set DIO10/PWM0"), success); } - - // Set to TCP mode - gsmModem.sendAT(GF("IP"), 1); - success &= gsmModem.waitResponse() == 1; - if (!success) { MS_DBG(F("Fail to set IP mode"), success); } + bool changedP0 = gsmModem.changeSettingIfNeeded(GF("D5"), 1); + changesMade |= changedP0; + if (changedP0) { + MS_DBG(F("DIO10/PWM0 changed to"), 1); + } else { + MS_DEEP_DBG(F("ADIO10/PWM0 not changed")); + } /** Put the XBee in pin sleep mode in conjuction with D8=1 */ // From the S6B User Guide: @@ -215,57 +232,103 @@ bool DigiXBeeWifi::extraModemSetup(void) { // Cyclic Sleep but does not sleep if the SLEEP_RQ pin is inactive, // allowing the device to be kept awake or woken by the connected // system. - if (_modemSleepRqPin >= 0) { - MS_DBG(F("Setting Sleep Options...")); - gsmModem.sendAT(GF("SM"), _modemSleepRqPin >= 0); - success &= gsmModem.waitResponse() == 1; - } - if (!success) { - MS_DBG(F("Failed to set sleep mode to"), _modemSleepRqPin >= 0, - success); + bool changedSM = gsmModem.changeSettingIfNeeded(GF("SM"), + _modemSleepRqPin >= 0); + changesMade |= changedSM; + if (changedSM) { + MS_DBG(F("Sleep mode changed to"), _modemSleepRqPin >= 0); + } else { + MS_DEEP_DBG(F("Sleep mode not changed")); } // Disassociate from the network for the lowest power deep sleep. // From S6B User Guide: // 0x40 - Stay associated with AP during sleep. Draw more current // (+10mA?) during sleep with this option enabled, but also avoid data - // loss. + // loss. [0x40 = 64] // 0x100 - For cyclic sleep, ST specifies the time before returning // to sleep. With this bit set, new receptions from either the serial or // the RF port do not restart the ST timer. Current implementation does - // not support this bit being turned off. - gsmModem.sendAT(GF("SO"), _maintainAssociation ? 0x40 : 0x100); - success &= gsmModem.waitResponse() == 1; - if (!success) { - MS_DBG(F("Failed to set sleep mode to"), - _maintainAssociation ? 0x40 : 0x100, success); + // not support this bit being turned off. [0x100 = 256] + bool changedSO = gsmModem.changeSettingIfNeeded( + GF("SO"), _maintainAssociation ? "40" : "100"); + changesMade |= changedSO; + if (changedSO) { + MS_DBG(F("Sleep mode changed to"), + _maintainAssociation ? "0x40" : "0x100"); + } else { + MS_DEEP_DBG(F("Sleep mode not changed")); + } + + /** Write pin and sleep options to flash and apply them, if needed. */ + if (changesMade) { + MS_DBG(F("Applying changes to pin and sleep options...")); + gsmModem.writeChanges(); + } else { + MS_DBG(F("No pin or sleep option changes to apply")); } MS_DBG(F("Setting Wifi Network Options...")); // Put the network connection parameters into flash + // NOTE: This will write to the flash every time if there is a password + // set! success &= gsmModem.networkConnect(_ssid, _pwd); // Set the socket timeout to 10s (this is default) if (!success) { MS_DBG(F("Fail Connect "), success); success = true; } - /** Set the socket timeout to 10s (this is default). */ - gsmModem.sendAT(GF("TM"), 64); - success &= gsmModem.waitResponse() == 1; + + // Set to TCP mode + // NOTE: If + // gsmModem.sendAT(GF("IP"), 1); + // success &= gsmModem.waitResponse() == 1; + // if (!success) { MS_DBG(F("Fail to set IP mode"), success); } + changesMade = false; + bool changedIPMode = gsmModem.changeSettingIfNeeded(GF("IP"), 1); + changesMade |= changedIPMode; + if (changedIPMode) { + MS_DBG(F("IP mode changed to"), 1); + } else { + MS_DEEP_DBG(F("IP mode not changed")); + } + + + /** Set the socket timeout to 10s (this is default).*/ + // gsmModem.sendAT(GF("TM"), 64); + // success &= gsmModem.waitResponse() == 1; + bool changedTM = gsmModem.changeSettingIfNeeded(GF("TM"), "64"); + changesMade |= changedTM; + if (changedTM) { + MS_DBG(F("Socket timeout changed to"), F("0x64")); + } else { + MS_DEEP_DBG(F("Socket timeout not changed")); + } + /** Set the destination IP to 0 (this is default). */ - gsmModem.sendAT(GF("DL"), GF("0.0.0.0")); - success &= gsmModem.waitResponse() == 1; + // gsmModem.sendAT(GF("DL"), GF("0.0.0.0")); + // success &= gsmModem.waitResponse() == 1; + bool changedDL = gsmModem.changeSettingIfNeeded(GF("DL"), + GF("0.0.0.0")); + changesMade |= changedDL; + if (changedDL) { + MS_DBG(F("Destination IP changed to"), F("0.0.0.0")); + } else { + MS_DEEP_DBG(F("Destination IP not changed")); + } + /** Write all changes to flash and apply them. */ + if (changesMade) { + MS_DBG(F("Applying changes to socket times...")); + success &= gsmModem.writeChanges(); + } if (success) { MS_DBG(F("Setup Wifi Network "), _ssid); } else { MS_DBG(F("Failed Setting WiFi"), _ssid); } - /** Write all changes to flash and apply them. */ - MS_DBG(F("Applying changes...")); - gsmModem.writeChanges(); - // Scan for AI last node join request + // Scan for AI last node join request uint16_t loops = 0; int16_t ui_db; uint8_t status; diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index f236ed0de..21355ec90 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -50,6 +50,10 @@ #define MS_DEBUGGING_STD "DigiXBeeWifi" #endif +#ifdef MS_DIGIXBEEWIFI_DEBUG_DEEP +#define MS_DEBUGGING_DEEP "DigiXBeeWifi" +#endif + /** @ingroup modem_digi_wifi */ /**@{*/ From dc23a83edf1e28a8c27e521b32a771f0a5e815cb Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 28 Jun 2023 10:44:25 -0400 Subject: [PATCH 36/89] Simplified XBee setup connection check Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 2 +- src/modems/DigiXBeeWifi.cpp | 139 +++-------------------- 2 files changed, 19 insertions(+), 122 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 0fcf0cf75..bc5362b2f 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -48,7 +48,7 @@ { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.6", + "version": "~0.11.7", "note": "A small Arduino library for GPRS modules.", "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index b1460c8ff..7e7334ac8 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -253,10 +253,10 @@ bool DigiXBeeWifi::extraModemSetup(void) { GF("SO"), _maintainAssociation ? "40" : "100"); changesMade |= changedSO; if (changedSO) { - MS_DBG(F("Sleep mode changed to"), + MS_DBG(F("Sleep options changed to"), _maintainAssociation ? "0x40" : "0x100"); } else { - MS_DEEP_DBG(F("Sleep mode not changed")); + MS_DEEP_DBG(F("Sleep options not changed")); } /** Write pin and sleep options to flash and apply them, if needed. */ @@ -279,10 +279,6 @@ bool DigiXBeeWifi::extraModemSetup(void) { } // Set to TCP mode - // NOTE: If - // gsmModem.sendAT(GF("IP"), 1); - // success &= gsmModem.waitResponse() == 1; - // if (!success) { MS_DBG(F("Fail to set IP mode"), success); } changesMade = false; bool changedIPMode = gsmModem.changeSettingIfNeeded(GF("IP"), 1); changesMade |= changedIPMode; @@ -294,8 +290,6 @@ bool DigiXBeeWifi::extraModemSetup(void) { /** Set the socket timeout to 10s (this is default).*/ - // gsmModem.sendAT(GF("TM"), 64); - // success &= gsmModem.waitResponse() == 1; bool changedTM = gsmModem.changeSettingIfNeeded(GF("TM"), "64"); changesMade |= changedTM; if (changedTM) { @@ -305,8 +299,6 @@ bool DigiXBeeWifi::extraModemSetup(void) { } /** Set the destination IP to 0 (this is default). */ - // gsmModem.sendAT(GF("DL"), GF("0.0.0.0")); - // success &= gsmModem.waitResponse() == 1; bool changedDL = gsmModem.changeSettingIfNeeded(GF("DL"), GF("0.0.0.0")); changesMade |= changedDL; @@ -323,123 +315,32 @@ bool DigiXBeeWifi::extraModemSetup(void) { } if (success) { - MS_DBG(F("Setup Wifi Network "), _ssid); + MS_DBG(F("Successfully setup Wifi Network"), _ssid); } else { MS_DBG(F("Failed Setting WiFi"), _ssid); } - // Scan for AI last node join request - uint16_t loops = 0; - int16_t ui_db; - uint8_t status; - String ui_op; - bool apRegistered = false; - PRINTOUT(F("Loop=Sec] rx db : Status #Polled Status every 1sec/30sec")); - uint8_t reg_count = 0; - #define TIMER_POLL_AP_STATUS_MSEC 300000 - for (unsigned long start = millis(); millis() - start < 300000; - loops++) { - ui_db = 0; // gsmModem.getSignalQuality(); - gsmModem.sendAT(GF("AI")); - status = gsmModem.readResponseInt(10000L); - ui_op = String(loops) + "=" + String((float)millis() / 1000) + - "] " + String(ui_db) + ":0x" + String(status, HEX); - if (0 == status) { - ui_op += " Cnt=" + String(reg_count); -#define XBEE_SUCCESS_CNTS 3 - if (++reg_count > XBEE_SUCCESS_CNTS) { - PRINTOUT(ui_op); - apRegistered = true; - break; - } - } else { - reg_count =0; //reset - } - PRINTOUT(ui_op); - //Need to pet the watchDog as 8sec timeout ~ but how, LoggerBase::petDog() - delay(1000); - } - if (apRegistered) - { - MS_DBG(F("Get IP number")); - String xbeeRsp; - uint8_t index = 0; - bool AllocatedIpSuccess = false; -// Checkfor IP allocation -#define MDM_IP_STR_MIN_LEN 7 -#define MDM_LP_IPMAX 16 - for (int mdm_lp = 1; mdm_lp <= MDM_LP_IPMAX; mdm_lp++) { - delay(mdm_lp * 500); - gsmModem.sendAT(F("MY")); // Request IP # - index = gsmModem.waitResponse(1000, xbeeRsp); - MS_DBG(F("mdmIP["), mdm_lp, "/", MDM_LP_IPMAX, F("] '"), - xbeeRsp, "'=", xbeeRsp.length()); - if (0 != xbeeRsp.compareTo("0.0.0.0") && - (xbeeRsp.length() > MDM_IP_STR_MIN_LEN)) { - AllocatedIpSuccess = true; - break; - } - xbeeRsp = ""; - } - if (!AllocatedIpSuccess) { + // Since this is the only time we're going to send the credentials, + // confirm that we can connect to the network and get both an IP and DNS + // address. + if (!(gsmModem.isNetworkConnected())) { + if (!gsmModem.waitForNetwork()) { PRINTOUT( - F("XbeeWiFi not received IP# -hope it works next time")); - // delay(1000); - // NVIC_SystemReset(); + F("... Initial WiFi connection failed - resetting module")); + loggerModem::modemHardReset(); + delay(50); success = false; } else { - // success &= AllocatedIpSuccess; - PRINTOUT(F("XbeeWiFi IP# ["), xbeeRsp, F("]")); - xbeeRsp = ""; - // Display DNS allocation - bool DnsIpSuccess = false; -#define MDM_LP_DNSMAX 11 - for (int mdm_lp = 1; mdm_lp <= MDM_LP_DNSMAX; mdm_lp++) { - delay(mdm_lp * 500); - gsmModem.sendAT(F("NS")); // Request DNS # - index &= gsmModem.waitResponse(1000, xbeeRsp); - MS_DBG(F("mdmDNS["), mdm_lp, "/", MDM_LP_DNSMAX, F("] '"), - xbeeRsp, "'"); - if (0 != xbeeRsp.compareTo("0.0.0.0") && - (xbeeRsp.length() > MDM_IP_STR_MIN_LEN)) { - DnsIpSuccess = true; - break; - } - xbeeRsp = ""; - } - - if (false == DnsIpSuccess) { - success = false; - PRINTOUT(F( - "XbeeWifi init test FAILED - hope it works next time")); - } else { - PRINTOUT(F("XbeeWifi init test PASSED")); - } + PRINTOUT(F("... Initial WiFi connection succeeded!")); + success = true; } -#if 0 // defined MS_DIGIXBEEWIFI_DEBUG - // as of 0.23.15 the modem as sensor has problems - int16_t rssi, percent; - getModemSignalQuality(rssi, percent); - MS_DBG(F("mdmSQ["),toAscii(rssi),F(","),percent,F("%]")); -#endif // MS_DIGIXBEEWIFI_DEBUG - gsmModem.exitCommand(); - } - else - { // !apRegistered could be invalid SSID, no SSID, or stuck module - PRINTOUT(F( - "XbeeWiFi AP not Registered - reseting module, hope it works " - "next time")); - loggerModem::modemHardReset(); - delay(50); - // NVIC_SystemReset(); - success = false; + } else { + PRINTOUT(F("... Initial WiFi connection succeeded!")); + success = true; } - } else { - success = false; + gsmModem.exitCommand(); } - if (false == success) { PRINTOUT(F("Xbee '"), _modemName, F("' failed.")); } - return success; } @@ -451,7 +352,7 @@ void DigiXBeeWifi::disconnectInternet(void) { String oldRemoteIp = gsmClient.remoteIP(); IPAddress newHostIp = IPAddress(127, 0, 0, 1); // localhost gsmClient.connect(newHostIp, 80); - MS_DBG(gsmModem.getBeeName(), oldRemoteIp, F(" disconnectInternet set to "), + MS_DBG(gsmModem.getBeeName(), oldRemoteIp, F("disconnectInternet set to"), gsmClient.remoteIP()); gsmModem.restart(); @@ -719,7 +620,3 @@ String DigiXBeeWifi::getWiFiId(void) { String DigiXBeeWifi::getWiFiPwd(void) { return _pwd; } -//If needed can provide specific information -//String DigiXBeeWifi::getModemDevId(void) {return "DigiXbeeWiFiId";} - - From fd3a696e63546f4cad49b320792f53bbc162bcd3 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 28 Jun 2023 11:13:50 -0400 Subject: [PATCH 37/89] Remove outdated comment Signed-off-by: Sara Damiano --- src/LoggerBase.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index c125f0180..2e1a54c5a 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -1272,14 +1272,6 @@ void Logger::testingMode() { PRINTOUT(F("------------------------------------------")); // Update the modem metadata - // NOTE: the extra get signal quality is an annoying redundancy - // needed only for the wifi XBee. Update metadata will also ask the - // module for current signal quality using the underlying TinyGSM - // getSignalQuality() function, but for the WiFi XBee it will not - // actually measure anything except by explicitly making a connection, - // which getModemSignalQuality() does. For all of the other modules, - // getModemSignalQuality() is just a straight pass-through to - // getSignalQuality(). if (gotInternetConnection) { _logModem->updateModemMetadata(); } watchDogTimer.resetWatchDog(); From 93db57813dda08324f62c79b4165fd79c528d90c Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 28 Jun 2023 11:17:08 -0400 Subject: [PATCH 38/89] Reimplement modem polling config Signed-off-by: Sara Damiano --- src/LoggerModem.cpp | 103 ++++++++++++++++++++++++------------ src/LoggerModem.h | 93 ++++++++++++++++++++++++++++---- src/modems/DigiXBeeWifi.cpp | 101 ++++++++++++++++++++++------------- 3 files changed, 217 insertions(+), 80 deletions(-) diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index 7dbd69b78..ff6737708 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -310,6 +310,17 @@ void loggerModem::setModemPinModes(void) { } +void loggerModem::enableMetadataPolling(uint8_t pollingBitmask) { + _pollModemMetaData |= pollingBitmask; +} +void loggerModem::disableMetadataPolling(uint8_t pollingBitmask) { + _pollModemMetaData |= ~pollingBitmask; +} +void loggerModem::setMetadataPolling(uint8_t pollingBitmask) { + _pollModemMetaData = pollingBitmask; +} + + bool loggerModem::updateModemMetadata(void) { bool success = true; @@ -328,40 +339,64 @@ bool loggerModem::updateModemMetadata(void) { int8_t bpercent = -99; uint16_t volt = 9999; - // Try for up to 15 seconds to get a valid signal quality - uint32_t startMillis = millis(); - do { - success &= getModemSignalQuality(rssi, percent); - loggerModem::_priorRSSI = rssi; - loggerModem::_priorSignalPercent = percent; - if (rssi != 0 && rssi != -9999) break; - delay(250); - } while ((rssi == 0 || rssi == -9999) && millis() - startMillis < 15000L && - success); - MS_DBG(F("CURRENT RSSI:"), rssi); - MS_DBG(F("CURRENT Percent signal strength:"), percent); - - success &= getModemBatteryStats(state, bpercent, volt); - MS_DBG(F("CURRENT Modem Battery Charge State:"), state); - MS_DBG(F("CURRENT Modem Battery Charge Percentage:"), bpercent); - MS_DBG(F("CURRENT Modem Battery Voltage:"), volt); - if (state != 99) - loggerModem::_priorBatteryState = static_cast(state); - else - loggerModem::_priorBatteryState = static_cast(-9999); - - if (bpercent != -99) - loggerModem::_priorBatteryPercent = static_cast(bpercent); - else - loggerModem::_priorBatteryPercent = static_cast(-9999); - - if (volt != 9999) - loggerModem::_priorBatteryVoltage = static_cast(volt); - else - loggerModem::_priorBatteryVoltage = static_cast(-9999); - - loggerModem::_priorModemTemp = getModemChipTemperature(); - MS_DBG(F("CURRENT Modem Chip Temperature:"), loggerModem::_priorModemTemp); + MS_DBG(F("Modem polling settings:"), String(_pollModemMetaData, BIN)); + + if ((_pollModemMetaData & MODEM_RSSI_ENABLE_BITMASK) == + MODEM_RSSI_ENABLE_BITMASK || + (_pollModemMetaData & MODEM_PERCENT_SIGNAL_ENABLE_BITMASK) == + MODEM_PERCENT_SIGNAL_ENABLE_BITMASK) { + // Try for up to 15 seconds to get a valid signal quality + uint32_t startMillis = millis(); + do { + success &= getModemSignalQuality(rssi, percent); + loggerModem::_priorRSSI = rssi; + loggerModem::_priorSignalPercent = percent; + if (rssi != 0 && rssi != -9999) break; + delay(250); + } while ((rssi == 0 || rssi == -9999) && + millis() - startMillis < 15000L && success); + MS_DBG(F("CURRENT RSSI:"), rssi); + MS_DBG(F("CURRENT Percent signal strength:"), percent); + } else { + MS_DBG(F("Polling for both RSSI and signal strength is disabled")); + } + + if ((_pollModemMetaData & MODEM_BATTERY_STATE_ENABLE_BITMASK) == + MODEM_BATTERY_STATE_ENABLE_BITMASK || + (_pollModemMetaData & MODEM_BATTERY_PERCENT_ENABLE_BITMASK) == + MODEM_BATTERY_PERCENT_ENABLE_BITMASK || + (_pollModemMetaData & MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK) == + MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK) { + success &= getModemBatteryStats(state, bpercent, volt); + MS_DBG(F("CURRENT Modem Battery Charge State:"), state); + MS_DBG(F("CURRENT Modem Battery Charge Percentage:"), bpercent); + MS_DBG(F("CURRENT Modem Battery Voltage:"), volt); + if (state != 99) + loggerModem::_priorBatteryState = static_cast(state); + else + loggerModem::_priorBatteryState = static_cast(-9999); + + if (bpercent != -99) + loggerModem::_priorBatteryPercent = static_cast(bpercent); + else + loggerModem::_priorBatteryPercent = static_cast(-9999); + + if (volt != 9999) + loggerModem::_priorBatteryVoltage = static_cast(volt); + else + loggerModem::_priorBatteryVoltage = static_cast(-9999); + } else { + MS_DBG(F("Polling for all modem battery parameters is disabled")); + } + + if ((_pollModemMetaData & MODEM_TEMPERATURE_ENABLE_BITMASK) == + MODEM_TEMPERATURE_ENABLE_BITMASK) { + loggerModem::_priorModemTemp = getModemChipTemperature(); + MS_DBG(F("CURRENT Modem Chip Temperature:"), + loggerModem::_priorModemTemp); + } else { + MS_DBG(F("Polling for modem chip temperature is disabled")); + } return success; } diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 591bf0b1d..8765e23db 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -68,6 +68,8 @@ * RSSI is a rough calculation, so it has 0 decimal place resolution */ #define MODEM_RSSI_RESOLUTION 0 +/// @brief The bit mask for #_pollModemMetaData to enable RSSI polling. +#define MODEM_RSSI_ENABLE_BITMASK 0b00000001 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "RSSI" @@ -94,6 +96,9 @@ * Percent signal is a rough calculation, so it has 0 decimal place resolution */ #define MODEM_PERCENT_SIGNAL_RESOLUTION 0 +/// @brief The bit mask for #_pollModemMetaData to enable percent signal +/// polling. +#define MODEM_PERCENT_SIGNAL_ENABLE_BITMASK 0b00000010 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "signalPercent" @@ -124,6 +129,9 @@ * Battery state is a code value; it has 0 decimal place resolution */ #define MODEM_BATTERY_STATE_RESOLUTION 0 +/// @brief The bit mask for #_pollModemMetaData to enable modem battery charging +/// state polling. +#define MODEM_BATTERY_STATE_ENABLE_BITMASK 0b00000100 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "batteryChargeState" @@ -151,6 +159,9 @@ /// @brief Decimals places in string representation; battery charge percent /// should have 0. #define MODEM_BATTERY_PERCENT_RESOLUTION 0 +/// @brief The bit mask for #_pollModemMetaData to enable modem battery percent +/// polling. +#define MODEM_BATTERY_PERCENT_ENABLE_BITMASK 0b00001000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "batteryVoltage" @@ -181,6 +192,9 @@ * No supported module has higher than 1mV resolution in battery reading. */ #define MODEM_BATTERY_VOLTAGE_RESOLUTION 0 +/// @brief The bit mask for #_pollModemMetaData to enable modem battery voltage +/// polling. +#define MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK 0b00010000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "batteryVoltage" @@ -210,6 +224,9 @@ * Most modules that can measure temperature measure to 0.1°C */ #define MODEM_TEMPERATURE_RESOLUTION 1 +/// @brief The bit mask for #_pollModemMetaData to enable modem temperature +/// polling. +#define MODEM_TEMPERATURE_ENABLE_BITMASK 0b00100000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "temperature" @@ -236,6 +253,9 @@ /// @brief Decimals places in string representation; total active time should /// have 3. #define MODEM_ACTIVATION_RESOLUTION 3 +/// @brief The bit mask for #_pollModemMetaData to enable modem activation time +/// polling. +#define MODEM_ACTIVATION_ENABLE_BITMASK 0b01000000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "timeElapsed" @@ -260,6 +280,9 @@ /// @brief Decimals places in string representation; total powered time should /// have 3. #define MODEM_POWERED_RESOLUTION 3 +/// @brief The bit mask for #_pollModemMetaData to enable modem power time +/// polling +#define MODEM_POWERED_ENABLE_BITMASK 0b10000000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "timeElapsed" @@ -545,6 +568,7 @@ class loggerModem { * called after the modem is connected to the internet. */ /**@{*/ + /** * @brief Query the modem for the current signal quality and write the * results to the supplied non-constant references. @@ -582,13 +606,45 @@ class loggerModem { */ virtual float getModemChipTemperature(void) = 0; + + /** + * @brief Enables metadata polling for one or more modem measured + * variables. Setting this to 0b11111111 will enable polling for all modem + * measured variables. + * + * @note This will **not** disable polling for any unset bits in the + * provided bitmask. It will only enable those bits that are set. + */ + void enableMetadataPolling(uint8_t pollingBitmask); + + /** + * @brief Disables metadata polling for one or more modem measured + * variables. Setting this to 0b11111111 will disable polling for all modem + * measured variables. + * + * @note This will **not** enable polling for any unset bits in the + * provided bitmask. It will only disable polling for those bits that are + * set. + */ + void disableMetadataPolling(uint8_t pollingBitmask); + + /** + * @brief Sets the bitmask for modem metadata polling. + * + * This will enable polling for 1 bits and disable polling for 0 bits. + * Setting this to 0 (0b00000000) will disable polling for all metadata + * parameters. Setting it to 256 (0b11111111) will enable polling for all + * parameters. + */ + void setMetadataPolling(uint8_t pollingBitmask); + /** * @brief Query the modem for signal quality, battery, and temperature * information and store the values to the static internal variables. * - * @return **bool** True indicates that the communication with the modem was - * successful and the values of the internal static variables should be - * valid. + * @return **bool** True indicates that the communication with the modem + * was successful and the values of the internal static variables should + * be valid. */ virtual bool updateModemMetadata(void); /**@}*/ @@ -1021,6 +1077,11 @@ class loggerModem { * Returned as a portion of the #getModemDevId(). */ String _modemSerialNumber; + + /** + * @brief An 8-bit code for the enabled modem polling variables + */ + uint8_t _pollModemMetaData = 0; }; // typedef float (loggerModem::_*loggerGetValueFxn)(void); @@ -1049,7 +1110,9 @@ class Modem_RSSI : public Variable { const char* varCode = MODEM_RSSI_DEFAULT_CODE) : Variable(&parentModem->getModemRSSI, (uint8_t)MODEM_RSSI_RESOLUTION, &*MODEM_RSSI_VAR_NAME, &*MODEM_RSSI_UNIT_NAME, varCode, - uuid) {} + uuid) { + parentModem->enableMetadataPolling(MODEM_RSSI_ENABLE_BITMASK); + } /** * @brief Destroy the Modem_RSSI object - no action needed. */ @@ -1082,7 +1145,9 @@ class Modem_SignalPercent : public Variable { : Variable(&parentModem->getModemSignalPercent, (uint8_t)MODEM_PERCENT_SIGNAL_RESOLUTION, &*MODEM_PERCENT_SIGNAL_VAR_NAME, - &*MODEM_PERCENT_SIGNAL_UNIT_NAME, varCode, uuid) {} + &*MODEM_PERCENT_SIGNAL_UNIT_NAME, varCode, uuid) { + parentModem->enableMetadataPolling(MODEM_PERCENT_SIGNAL_ENABLE_BITMASK); + } /** * @brief Destroy the Modem_SignalPercent object - no action needed. */ @@ -1118,7 +1183,9 @@ class Modem_BatteryState : public Variable { : Variable(&parentModem->getModemBatteryChargeState, (uint8_t)MODEM_BATTERY_STATE_RESOLUTION, &*MODEM_BATTERY_STATE_VAR_NAME, - &*MODEM_BATTERY_STATE_UNIT_NAME, varCode, uuid) {} + &*MODEM_BATTERY_STATE_UNIT_NAME, varCode, uuid) { + parentModem->enableMetadataPolling(MODEM_BATTERY_STATE_ENABLE_BITMASK); + } /** * @brief Destroy the Modem_BatteryState object - no action needed. */ @@ -1154,7 +1221,10 @@ class Modem_BatteryPercent : public Variable { : Variable(&parentModem->getModemBatteryChargePercent, (uint8_t)MODEM_BATTERY_PERCENT_RESOLUTION, &*MODEM_BATTERY_PERCENT_VAR_NAME, - &*MODEM_BATTERY_PERCENT_UNIT_NAME, varCode, uuid) {} + &*MODEM_BATTERY_PERCENT_UNIT_NAME, varCode, uuid) { + parentModem->enableMetadataPolling( + MODEM_BATTERY_PERCENT_ENABLE_BITMASK); + } /** * @brief Destroy the Modem_BatteryPercent object - no action needed. */ @@ -1190,7 +1260,10 @@ class Modem_BatteryVoltage : public Variable { : Variable(&parentModem->getModemBatteryVoltage, (uint8_t)MODEM_BATTERY_VOLTAGE_RESOLUTION, &*MODEM_BATTERY_VOLTAGE_VAR_NAME, - &*MODEM_BATTERY_VOLTAGE_UNIT_NAME, varCode, uuid) {} + &*MODEM_BATTERY_VOLTAGE_UNIT_NAME, varCode, uuid) { + parentModem->enableMetadataPolling( + MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK); + } /** * @brief Destroy the Modem_BatteryVoltage object - no action needed. */ @@ -1225,7 +1298,9 @@ class Modem_Temp : public Variable { : Variable(&parentModem->getModemTemperature, (uint8_t)MODEM_TEMPERATURE_RESOLUTION, &*MODEM_TEMPERATURE_VAR_NAME, &*MODEM_TEMPERATURE_UNIT_NAME, - varCode, uuid) {} + varCode, uuid) { + parentModem->enableMetadataPolling(MODEM_TEMPERATURE_ENABLE_BITMASK); + } /** * @brief Destroy the Modem_Temp object - no action needed. */ diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 7e7334ac8..258d9bf7b 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -487,51 +487,78 @@ bool DigiXBeeWifi::updateModemMetadata(void) { // int16_t percent = -9999; uint16_t volt_mV = 9999; - // Enter command mode only once for temp and battery + MS_DBG(F("Modem polling settings:"), String(_pollModemMetaData, BIN)); + + // if not enabled don't collect data + if (_pollModemMetaData == 0) { + MS_DBG(F("No modem metadata to update")); + return false; + } + + // Enter command mode only once MS_DBG(F("Entering Command Mode to update modem metadata:")); success &= gsmModem.commandMode(); + if ((_pollModemMetaData & MODEM_RSSI_ENABLE_BITMASK) == + MODEM_RSSI_ENABLE_BITMASK || + (_pollModemMetaData & MODEM_PERCENT_SIGNAL_ENABLE_BITMASK) == + MODEM_PERCENT_SIGNAL_ENABLE_BITMASK) { + // Assume a signal has already been established. + // Try to get a valid signal quality + // NOTE: We can't actually distinguish between a bad modem response, no + // modem response, and a real response from the modem of no + // service/signal. The TinyGSM getSignalQuality function returns the + // same "no signal" value (99 CSQ or 0 RSSI) in all 3 cases. + + // Try up to 5 times to get a signal quality + int8_t num_trys_remaining = 5; + do { + rssi = gsmModem.getSignalQuality(); + MS_DBG(F("Raw signal quality ("), num_trys_remaining, F("):"), + rssi); + if (rssi != 0 && rssi != -9999) break; + num_trys_remaining--; + } while ((rssi == 0 || rssi == -9999) && num_trys_remaining); + + + // Convert signal quality to a percent + loggerModem::_priorSignalPercent = getPctFromRSSI(rssi); + MS_DBG(F("CURRENT Percent signal strength:"), + loggerModem::_priorSignalPercent); + + loggerModem::_priorRSSI = rssi; + MS_DBG(F("CURRENT RSSI:"), rssi); + } else { + MS_DBG(F("Polling for both RSSI and signal strength is disabled")); + } - // Assume a signal has already been established. - // Try to get a valid signal quality - // NOTE: We can't actually distinguish between a bad modem response, no - // modem response, and a real response from the modem of no - // service/signal. The TinyGSM getSignalQuality function returns the - // same "no signal" value (99 CSQ or 0 RSSI) in all 3 cases. - - // Try up to 5 times to get a signal quality - int8_t num_trys_remaining = 5; - do { - rssi = gsmModem.getSignalQuality(); - MS_DBG(F("Raw signal quality("), num_trys_remaining, F("):"), rssi); - if (rssi != 0 && rssi != -9999) break; - num_trys_remaining--; - } while ((rssi == 0 || rssi == -9999) && num_trys_remaining); - - - // Convert signal quality to a percent - loggerModem::_priorSignalPercent = getPctFromRSSI(rssi); - MS_DBG(F("CURRENT Percent signal strength:"), - loggerModem::_priorSignalPercent); - - loggerModem::_priorRSSI = rssi; - MS_DBG(F("CURRENT RSSI:"), rssi); - - - MS_DBG(F("Getting input voltage:")); - volt_mV = gsmModem.getBattVoltage(); - MS_DBG(F("CURRENT Modem battery (mV):"), volt_mV); - if (volt_mV != 9999) { - loggerModem::_priorBatteryVoltage = static_cast(volt_mV / 1000); + + if ((_pollModemMetaData & MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK) == + MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK) { + MS_DBG(F("Getting input voltage:")); + volt_mV = gsmModem.getBattVoltage(); + MS_DBG(F("CURRENT Modem battery (mV):"), volt_mV); + if (volt_mV != 9999) { + loggerModem::_priorBatteryVoltage = + static_cast(volt_mV / 1000); + } else { + loggerModem::_priorBatteryVoltage = static_cast(-9999); + } } else { - loggerModem::_priorBatteryVoltage = static_cast(-9999); + MS_DBG(F("Polling for modem battery voltage is disabled")); } - MS_DBG(F("Getting chip temperature:")); - loggerModem::_priorModemTemp = getModemChipTemperature(); - MS_DBG(F("CURRENT Modem temperature(C):"), loggerModem::_priorModemTemp); + if ((_pollModemMetaData & MODEM_TEMPERATURE_ENABLE_BITMASK) == + MODEM_TEMPERATURE_ENABLE_BITMASK) { + MS_DBG(F("Getting chip temperature:")); + loggerModem::_priorModemTemp = getModemChipTemperature(); + MS_DBG(F("CURRENT Modem temperature(C):"), + loggerModem::_priorModemTemp); + } else { + MS_DBG(F("Polling for modem chip temperature is disabled")); + } // Exit command mode - MS_DBG(F("Leaving Command Mode:")); + MS_DBG(F("Leaving Command Mode after updating modem metadata:")); gsmModem.exitCommand(); ++updateModemMetadata_cnt; From f9d9476c0cea0824188d0bf4f98b2161926fed78 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 28 Jun 2023 11:23:00 -0400 Subject: [PATCH 39/89] Apply polling to other XBee Signed-off-by: Sara Damiano --- library.json | 2 +- src/modems/DigiXBeeCellularTransparent.cpp | 70 ++++++++++++++-------- src/modems/DigiXBeeWifi.cpp | 1 + 3 files changed, 48 insertions(+), 25 deletions(-) diff --git a/library.json b/library.json index 157e60989..758c15636 100644 --- a/library.json +++ b/library.json @@ -109,7 +109,7 @@ { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.6", + "version": "~0.11.7", "note": "A small Arduino library for GPRS modules.", "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", diff --git a/src/modems/DigiXBeeCellularTransparent.cpp b/src/modems/DigiXBeeCellularTransparent.cpp index 69694405f..5705f8e4e 100644 --- a/src/modems/DigiXBeeCellularTransparent.cpp +++ b/src/modems/DigiXBeeCellularTransparent.cpp @@ -259,37 +259,59 @@ bool DigiXBeeCellularTransparent::updateModemMetadata(void) { // Initialize variable int16_t signalQual = -9999; + MS_DBG(F("Modem polling settings:"), String(_pollModemMetaData, BIN)); + + // if not enabled don't collect data + if (_pollModemMetaData == 0) { + MS_DBG(F("No modem metadata to update")); + return false; + } + // Enter command mode only once - MS_DBG(F("Entering Command Mode:")); + MS_DBG(F("Entering Command Mode to update modem metadata:")); gsmModem.commandMode(); - // Try for up to 15 seconds to get a valid signal quality - // NOTE: We can't actually distinguish between a bad modem response, no - // modem response, and a real response from the modem of no service/signal. - // The TinyGSM getSignalQuality function returns the same "no signal" - // value (99 CSQ or 0 RSSI) in all 3 cases. - uint32_t startMillis = millis(); - do { - MS_DBG(F("Getting signal quality:")); - signalQual = gsmModem.getSignalQuality(); - MS_DBG(F("Raw signal quality:"), signalQual); - if (signalQual != 0 && signalQual != -9999) break; - delay(250); - } while ((signalQual == 0 || signalQual == -9999) && - millis() - startMillis < 15000L && success); + if ((_pollModemMetaData & MODEM_RSSI_ENABLE_BITMASK) == + MODEM_RSSI_ENABLE_BITMASK || + (_pollModemMetaData & MODEM_PERCENT_SIGNAL_ENABLE_BITMASK) == + MODEM_PERCENT_SIGNAL_ENABLE_BITMASK) { // Try for up to 15 seconds + // to get a valid signal + // quality + // NOTE: We can't actually distinguish between a bad modem response, no + // modem response, and a real response from the modem of no + // service/signal. The TinyGSM getSignalQuality function returns the + // same "no signal" value (99 CSQ or 0 RSSI) in all 3 cases. + uint32_t startMillis = millis(); + do { + MS_DBG(F("Getting signal quality:")); + signalQual = gsmModem.getSignalQuality(); + MS_DBG(F("Raw signal quality:"), signalQual); + if (signalQual != 0 && signalQual != -9999) break; + delay(250); + } while ((signalQual == 0 || signalQual == -9999) && + millis() - startMillis < 15000L && success); - // Convert signal quality to RSSI - loggerModem::_priorRSSI = signalQual; - MS_DBG(F("CURRENT RSSI:"), signalQual); - loggerModem::_priorSignalPercent = getPctFromRSSI(signalQual); - MS_DBG(F("CURRENT Percent signal strength:"), getPctFromRSSI(signalQual)); + // Convert signal quality to RSSI + loggerModem::_priorRSSI = signalQual; + MS_DBG(F("CURRENT RSSI:"), signalQual); + loggerModem::_priorSignalPercent = getPctFromRSSI(signalQual); + MS_DBG(F("CURRENT Percent signal strength:"), + getPctFromRSSI(signalQual)); + } else { + MS_DBG(F("Polling for both RSSI and signal strength is disabled")); + } - MS_DBG(F("Getting chip temperature:")); - loggerModem::_priorModemTemp = getModemChipTemperature(); - MS_DBG(F("CURRENT Modem temperature:"), loggerModem::_priorModemTemp); + if ((_pollModemMetaData & MODEM_TEMPERATURE_ENABLE_BITMASK) == + MODEM_TEMPERATURE_ENABLE_BITMASK) { + MS_DBG(F("Getting chip temperature:")); + loggerModem::_priorModemTemp = getModemChipTemperature(); + MS_DBG(F("CURRENT Modem temperature:"), loggerModem::_priorModemTemp); + } else { + MS_DBG(F("Polling for modem chip temperature is disabled")); + } // Exit command modem - MS_DBG(F("Leaving Command Mode:")); + MS_DBG(F("Leaving Command Mode after updating modem metadata:")); gsmModem.exitCommand(); return success; diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 258d9bf7b..fbfe56aed 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -498,6 +498,7 @@ bool DigiXBeeWifi::updateModemMetadata(void) { // Enter command mode only once MS_DBG(F("Entering Command Mode to update modem metadata:")); success &= gsmModem.commandMode(); + if ((_pollModemMetaData & MODEM_RSSI_ENABLE_BITMASK) == MODEM_RSSI_ENABLE_BITMASK || (_pollModemMetaData & MODEM_PERCENT_SIGNAL_ENABLE_BITMASK) == From 1e096c932c9f908368a9b5df1d8a0d9a68ea998d Mon Sep 17 00:00:00 2001 From: neilh Date: Fri, 30 Jun 2023 08:45:06 -0700 Subject: [PATCH 40/89] Update ChangeLog.md #347 fixes --- ChangeLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index f59567474..07bc8de63 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -21,6 +21,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *** +## [0.34.1] +### Fixed +#347 -WiFi S6B stability - tears dwon TCP/IP before going to sleep, doesn't automatically poll for meta data ## [0.34.0] From 0ba34d7bc3bec5a805ae5bd789e99dc605b123d6 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 11:45:15 -0400 Subject: [PATCH 41/89] change version Signed-off-by: Sara Damiano --- ChangeLog.md | 10 ++++++++++ VERSION | 2 +- docs/Doxyfile | 2 +- library.json | 2 +- library.properties | 2 +- src/ModularSensors.h | 9 +++++---- 6 files changed, 19 insertions(+), 8 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index f59567474..e5b5fb79e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -22,6 +22,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *** +## [0.34.1] + +### Changed +- Incorporated improvements to the XBee Wifi - from [neilh10](https://github.com/EnviroDIY/ModularSensors/commits?author=neilh10) + +### Added +- Added the ability to enable or disable polling of modem attached variables. +By default, all polling is off, but polling is enabled for a modem sensor when a sensor is created and attached to a modem. +This functionailty is inspired from [neilh10](https://github.com/EnviroDIY/ModularSensors/commits?author=neilh10). + ## [0.34.0] ### Changed diff --git a/VERSION b/VERSION index 85e60ed18..cd46610fe 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.34.0 +0.34.1 diff --git a/docs/Doxyfile b/docs/Doxyfile index db06a11c2..478f8e3ed 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -48,7 +48,7 @@ PROJECT_NAME = ModularSensors # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.34.0 +PROJECT_NUMBER = 0.34.1 # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a diff --git a/library.json b/library.json index 758c15636..f1647af88 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "EnviroDIY_ModularSensors", - "version": "0.34.0", + "version": "0.34.1", "description": "A library that allows access to multiple sensors through a unified interface. This allows the user to simply access many sensors to log the data or send the data to data repositories like the EnviroDIY data portal.", "keywords": "modular, sensor, sensors, datalogger, logger, low power, sleeping, EnviroDIY, ModularSensors, Mayfly, WikiWatershed, Monitor My Watershed, ThingSpeak", "platforms": "atmelavr, atmelsam", diff --git a/library.properties b/library.properties index fe0a35b7b..e8ef04e42 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=ModularSensors -version=0.34.0 +version=0.34.1 author=Sara Damiano , Shannon Hicks maintainer=Sara Damiano sentence=A library that allows access to multiple sensors through a unified interface. diff --git a/src/ModularSensors.h b/src/ModularSensors.h index a23778a70..04563fdf7 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -14,11 +14,12 @@ /** * @brief The current library version number * https://semver.org/ - * Add hypen '-' and alpha number for a branches unique tracking number - * A pre-release version will always be indeiciated as slightly ahead - * of the envirodiy branch that it is based on. + * Add hypen '-' and alpha number for a branches unique tracking number + * A pre-release version will always be indicated as slightly ahead of the + * EnviroDIY branch that it is based on. */ -#define MODULAR_SENSORS_VERSION "0.34.1-iss347a" +#define MODULAR_SENSORS_VERSION "0.34.1" + // To get all of the base classes for ModularSensors, include LoggerBase. // NOTE: Individual sensor definitions must be included separately. From 8097325cba824e500dfb2f20594f77f0e6f064f9 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 11:50:59 -0400 Subject: [PATCH 42/89] Fixed GroPoint build if flag Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 113 +++++++++++++++---- examples/menu_a_la_carte/menu_a_la_carte.ino | 4 +- 2 files changed, 91 insertions(+), 26 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index d64492000..4a871c64d 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 15, + "action_cache_version": 16, "dependencies": [ { "name": "EnviroDIY_DS3231", @@ -8,7 +8,10 @@ "url": "https://github.com/EnviroDIY/Sodaq_DS3231", "version": "~1.3.4", "note": "An Arduino library for the DS3231 RTC (Real Time Clock), based off of the Sodaq_DS3231 library.", - "authors": ["Kees Bakker", "Sara Damiano"], + "authors": [ + "Kees Bakker", + "Sara Damiano" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -19,7 +22,9 @@ "url": "https://github.com/arduino-libraries/RTCZero", "version": "~1.6.0", "note": "Functions for using the processor real time clock in SAMD21 processors", - "authors": ["Arduino"], + "authors": [ + "Arduino" + ], "frameworks": "arduino", "platforms": "atmelsam" }, @@ -30,7 +35,9 @@ "url": "https://github.com/GreyGnome/EnableInterrupt", "version": "~1.1.0", "note": "GreyGnome's EnableInterrupt - Assign an interrupt to any supported pin on all Arduinos", - "authors": ["Mike 'GreyGnome' Schwager"], + "authors": [ + "Mike 'GreyGnome' Schwager" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -41,7 +48,9 @@ "url": "https://github.com/greiman/SdFat", "version": "~2.1.2", "note": "SdFat - FAT16/FAT32 file system for SD cards.", - "authors": ["Bill Greiman"], + "authors": [ + "Bill Greiman" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -50,7 +59,10 @@ "owner": "vshymanskyy", "version": "~0.11.5", "note": "A small Arduino library for GPRS modules.", - "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], + "authors": [ + "Volodymyr Shymanskyy", + "Sara Damiano" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -61,7 +73,9 @@ "url": "https://github.com/knolleary/pubsubclient", "version": "~2.8", "note": "A client library for MQTT messaging.", - "authors": ["Nick O'Leary"] + "authors": [ + "Nick O'Leary" + ] }, { "name": "Adafruit BusIO", @@ -70,7 +84,9 @@ "url": "https://github.com/adafruit/Adafruit_BusIO", "version": "~1.11.6", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -81,7 +97,9 @@ "url": "https://github.com/adafruit/Adafruit_Sensor", "version": "~1.1.9", "note": "Adafruit's unified sensor library is used by their other libraries", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -91,7 +109,9 @@ "version_note": "=1.2.0", "version": "https://github.com/soligen2010/Adafruit_ADS1X15.git#7d67b451f739e9a63f40f2d6d139ab582258572b", "note": "Driver for TI's ADS1015: 12-bit Differential or Single-Ended ADC with PGA and Comparator. This fork removes bugs in the Adafruit original library.", - "authors_note": ["soligen2010"], + "authors_note": [ + "soligen2010" + ], "frameworks_note": "arduino", "platforms_note": "*" }, @@ -102,7 +122,9 @@ "url": "https://github.com/adafruit/Adafruit_AM2315", "version": "~2.2.1", "note": "AOSong AM2315 I2C Temp/Humidity Sensor Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -113,7 +135,9 @@ "url": "https://github.com/adafruit/Adafruit_BME280_Library", "version": "~2.2.2", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -123,7 +147,9 @@ "version": "https://github.com/MartinL1/BMP388_DEV.git", "version_note": "~1.0.9", "note": "An Arduino compatible, non-blocking, I2C/SPI library for the Bosch BMP388 barometer.", - "authors": ["Martin Lindupp"], + "authors": [ + "Martin Lindupp" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -134,7 +160,9 @@ "url": "https://github.com/adafruit/DHT-sensor-library", "version": "~1.4.4", "note": "AOSong DHT Sensor Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -145,7 +173,9 @@ "url": "https://github.com/adafruit/Adafruit_INA219", "version": "~1.2.1", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -156,7 +186,9 @@ "url": "https://github.com/adafruit/Adafruit_MPL115A2", "version": "~2.0.0", "note": "MPL115A2 Barometer Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino" }, { @@ -166,7 +198,9 @@ "url": "https://github.com/adafruit/Adafruit_SHT4X", "version": "~1.0.2", "note": "Sensirion SHT4x Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino" }, { @@ -200,7 +234,12 @@ "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library", "version": "~3.9.1", "note": "DallasTemperature - Arduino Library for Dallas Temperature ICs (DS18B20, DS18S20, DS1822, DS1820)", - "authors": ["Guil Barros", "Miles Burton", "Rob Tillart", "Tim Nuewsome"], + "authors": [ + "Guil Barros", + "Miles Burton", + "Rob Tillart", + "Tim Nuewsome" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -227,14 +266,22 @@ "url": "https://github.com/NorthernWidget/MS5803", "version": "~0.1.2", "note": "General interface to MS5803-series pressure transducers", - "authors": ["Bobby Schulz", "Andrew Wickert", "Chad Sandell", "Sara Damiano"] + "authors": [ + "Bobby Schulz", + "Andrew Wickert", + "Chad Sandell", + "Sara Damiano" + ] }, { "name": "Tally_Library_I2C", "version": "https://github.com/EnviroDIY/Tally_Library.git#Dev_I2C", "version_note": "Uses `Dev_I2C` feature branch", "note": "An Arduino library for interfacing to the Project Tally Event counter from NorthernWidget.", - "authors": ["Bobby Schulz", "Anthony Aufdenkampe"], + "authors": [ + "Bobby Schulz", + "Anthony Aufdenkampe" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -245,7 +292,9 @@ "url": "https://github.com/EnviroDIY/SensorModbusMaster", "version": "~0.6.8", "note": "EnviroDIY SensorModbusMaster - Arduino library for communicating via modbus with the Arduino acting as the modbus master.", - "authors": ["Sara Damiano"], + "authors": [ + "Sara Damiano" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -256,7 +305,9 @@ "url": "https://github.com/EnviroDIY/KellerModbus", "version": "~0.2.2", "note": "Arduino library for communication with Keller pressure and water level sensors via Modbus.", - "authors": ["Anthony Aufdenkampe"] + "authors": [ + "Anthony Aufdenkampe" + ] }, { "name": "YosemitechModbus", @@ -265,9 +316,23 @@ "url": "https://github.com/EnviroDIY/YosemitechModbus", "version": "~0.4.0", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", - "authors": ["Sara Damiano", "Anthony Aufdenkampe"], + "authors": [ + "Sara Damiano", + "Anthony Aufdenkampe" + ], + "frameworks": "arduino", + "platforms": "atmelavr, atmelsam" + }, + { + "name": "GropointModbus", + "owner": "envirodiy", + "version": "https://github.com/EnviroDIY/GroPointModbus.git", + "note": "AA library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", + "authors": [ + "Anthony Aufdenkampe" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" } ] -} +} \ No newline at end of file diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 8dce201cb..f6e7e0614 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1363,7 +1363,7 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( /** End [freescale_mpl115a2] */ #endif -#if defined BUILD_SENSOR_GROPOINT_GPLP8 +#if defined BUILD_SENSOR_GRO_POINT_GPLP8 // ========================================================================== // GroPoint Profile GPLP-8 Soil Moisture and Temperature Sensor // ========================================================================== @@ -2653,7 +2653,7 @@ Variable* variableList[] = { mplTemp, mplPress, #endif -#if defined BUILD_SENSOR_GROPOINT_GPLP8 +#if defined BUILD_SENSOR_GRO_POINT_GPLP8 gplp8Moist1, gplp8Moist2, gplp8Moist3, From 7db7d3ac595a33370861f0fefaad5e11810795c8 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 12:06:58 -0400 Subject: [PATCH 43/89] Made sensor var number required input for GroPoint Signed-off-by: Sara Damiano --- src/sensors/GroPointGPLP8.h | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/sensors/GroPointGPLP8.h b/src/sensors/GroPointGPLP8.h index 3ed25ff14..dcf79757e 100644 --- a/src/sensors/GroPointGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -218,21 +218,22 @@ class GroPointGPLP8_Moist : public Variable { * optional with a default value of "GPLP8Moist". */ explicit GroPointGPLP8_Moist(GroPointGPLP8* parentSense, - const char* uuid = "", - const char* varCode = GPLP8_MOIST_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)GPLP8_MOIST_VAR_NUM, - (uint8_t)GPLP8_MOIST_RESOLUTION, GPLP8_MOIST_VAR_NAME, - GPLP8_MOIST_UNIT_NAME, varCode, uuid) {} + const uint8_t sensorVarNum, + const char* uuid = "", + const char* varCode = GPLP8_MOIST_DEFAULT_CODE) + : Variable(parentSense, sensorVarNum, (uint8_t)GPLP8_MOIST_RESOLUTION, + GPLP8_MOIST_VAR_NAME, GPLP8_MOIST_UNIT_NAME, varCode, uuid) { + } /** * @brief Construct a new GroPointGPLP8_Moist object. * * @note This must be tied with a parent GroPointGPLP8 before it can be * used. */ - GroPointGPLP8_Moist() - : Variable((const uint8_t)GPLP8_MOIST_VAR_NUM, - (uint8_t)GPLP8_MOIST_RESOLUTION, GPLP8_MOIST_VAR_NAME, - GPLP8_MOIST_UNIT_NAME, GPLP8_MOIST_DEFAULT_CODE) {} + GroPointGPLP8_Moist(const uint8_t sensorVarNum) + : Variable(sensorVarNum, (uint8_t)GPLP8_MOIST_RESOLUTION, + GPLP8_MOIST_VAR_NAME, GPLP8_MOIST_UNIT_NAME, + GPLP8_MOIST_DEFAULT_CODE) {} /** * @brief Destroy the GroPointGPLP8_Moist object - no action needed. */ @@ -261,21 +262,21 @@ class GroPointGPLP8_Temp : public Variable { * optional with a default value of "GPLP8Temp". */ explicit GroPointGPLP8_Temp(GroPointGPLP8* parentSense, - const char* uuid = "", - const char* varCode = GPLP8_TEMP_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)GPLP8_TEMP_VAR_NUM, - (uint8_t)GPLP8_TEMP_RESOLUTION, GPLP8_TEMP_VAR_NAME, - GPLP8_TEMP_UNIT_NAME, varCode, uuid) {} + const uint8_t sensorVarNum, + const char* uuid = "", + const char* varCode = GPLP8_TEMP_DEFAULT_CODE) + : Variable(parentSense, sensorVarNum, (uint8_t)GPLP8_TEMP_RESOLUTION, + GPLP8_TEMP_VAR_NAME, GPLP8_TEMP_UNIT_NAME, varCode, uuid) {} /** * @brief Construct a new GroPointGPLP8_Temp object. * * @note This must be tied with a parent GroPointGPLP8 before it can be * used. */ - GroPointGPLP8_Temp() - : Variable((const uint8_t)GPLP8_TEMP_VAR_NUM, - (uint8_t)GPLP8_TEMP_RESOLUTION, GPLP8_TEMP_VAR_NAME, - GPLP8_TEMP_UNIT_NAME, GPLP8_TEMP_DEFAULT_CODE) {} + GroPointGPLP8_Temp(const uint8_t sensorVarNum) + : Variable(sensorVarNum, (uint8_t)GPLP8_TEMP_RESOLUTION, + GPLP8_TEMP_VAR_NAME, GPLP8_TEMP_UNIT_NAME, + GPLP8_TEMP_DEFAULT_CODE) {} /** * @brief Destroy the GroPointGPLP8_Temp object - no action needed. */ From 750efd2691c74eae0e388b3c4c45b9a94521d0ef Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 12:07:21 -0400 Subject: [PATCH 44/89] Reflow some comments (clang formatted) Signed-off-by: Sara Damiano --- src/sensors/GroPointGPLP8.h | 42 +++++++++----------- src/sensors/GroPointParent.cpp | 70 ++++++++++++++++++---------------- src/sensors/GroPointParent.h | 55 +++++++++++++------------- 3 files changed, 82 insertions(+), 85 deletions(-) diff --git a/src/sensors/GroPointGPLP8.h b/src/sensors/GroPointGPLP8.h index dcf79757e..81fb78156 100644 --- a/src/sensors/GroPointGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -7,7 +7,7 @@ * @brief Contains the GroPointGPLP8 sensor subclass and the variable * subclasses GroPointGPLP8_Moist and GroPointGPLP8_Temp * - * These are for the GroPoint Profile GPLP-8 Eight-Segment Soil Moisture + * These are for the GroPoint Profile GPLP-8 Eight-Segment Soil Moisture * and Temperature Profiling Probe. * * This depends on the GroPointParent super class. @@ -21,8 +21,8 @@ */ /* clang-format off */ /** - * @defgroup sensor_gplp8 GroPoint Profile GPLP-8 Soil Moisture & Temperature - * Profiling Probe. Classes for the GroPoint Profile GPLP-8 Soil Moisture & + * @defgroup sensor_gplp8 GroPoint Profile GPLP-8 Soil Moisture & Temperature + * Profiling Probe. Classes for the GroPoint Profile GPLP-8 Soil Moisture & * Temperature Probe. * * @ingroup GroPoint_group @@ -97,8 +97,6 @@ /// @brief Decimals places in string representation; soil moisture should have 1 /// - resolution is 0.1 %. #define GPLP8_MOIST_RESOLUTION 1 -/// @brief Sensor variable number; soil moisture is stored in sensorValues[2]. -#define GPLP8_MOIST_VAR_NUM 0 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); #define GPLP8_MOIST_VAR_NAME "volumetricWaterContent" @@ -112,7 +110,7 @@ /** * @anchor sensor_gplp8_temp * @name Temperature - * The temperature variable from a GroPoint Profile GPLP-8 + * The temperature variable from a GroPoint Profile GPLP-8 * - Range is -20°C to + 70°C * - Accuracy is ± 0.5°C * @@ -122,8 +120,6 @@ /// @brief Decimals places in string representation; temperature should have 1 - /// resolution is 0.1°C. #define GPLP8_TEMP_RESOLUTION 1 -/// @brief Sensor variable number; temperature is stored in sensorValues[4]. -#define GPLP8_TEMP_VAR_NUM 8 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "temperature" @@ -169,26 +165,24 @@ class GroPointGPLP8 : public GroPointParent { * default value of 1. */ GroPointGPLP8(byte modbusAddress, Stream* stream, int8_t powerPin, - int8_t powerPin2 = -1, int8_t enablePin = -1, - uint8_t measurementsToAverage = 1) - : GroPointParent(modbusAddress, stream, powerPin, powerPin2, - enablePin, measurementsToAverage, GPLP8, - "GroPointGPLP8", GPLP8_NUM_VARIABLES, - GPLP8_WARM_UP_TIME_MS, GPLP8_STABILIZATION_TIME_MS, - GPLP8_MEASUREMENT_TIME_MS, - GPLP8_INC_CALC_VARIABLES) {} + int8_t powerPin2 = -1, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1) + : GroPointParent(modbusAddress, stream, powerPin, powerPin2, enablePin, + measurementsToAverage, GPLP8, "GroPointGPLP8", + GPLP8_NUM_VARIABLES, GPLP8_WARM_UP_TIME_MS, + GPLP8_STABILIZATION_TIME_MS, GPLP8_MEASUREMENT_TIME_MS, + GPLP8_INC_CALC_VARIABLES) {} /** * @copydoc GroPointGPLP8::GroPointGPLP8 */ GroPointGPLP8(byte modbusAddress, Stream& stream, int8_t powerPin, - int8_t powerPin2 = -1, int8_t enablePin = -1, - uint8_t measurementsToAverage = 1) - : GroPointParent(modbusAddress, stream, powerPin, powerPin2, - enablePin, measurementsToAverage, GPLP8, - "GroPointGPLP8", GPLP8_NUM_VARIABLES, - GPLP8_WARM_UP_TIME_MS, GPLP8_STABILIZATION_TIME_MS, - GPLP8_MEASUREMENT_TIME_MS, - GPLP8_INC_CALC_VARIABLES) {} + int8_t powerPin2 = -1, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1) + : GroPointParent(modbusAddress, stream, powerPin, powerPin2, enablePin, + measurementsToAverage, GPLP8, "GroPointGPLP8", + GPLP8_NUM_VARIABLES, GPLP8_WARM_UP_TIME_MS, + GPLP8_STABILIZATION_TIME_MS, GPLP8_MEASUREMENT_TIME_MS, + GPLP8_INC_CALC_VARIABLES) {} /** * @brief Destroy the GroPoint GPLP8 object */ diff --git a/src/sensors/GroPointParent.cpp b/src/sensors/GroPointParent.cpp index fde34ed5e..5ee723148 100644 --- a/src/sensors/GroPointParent.cpp +++ b/src/sensors/GroPointParent.cpp @@ -11,34 +11,38 @@ // The constructor - need the sensor type, modbus address, power pin, stream for // data, and number of readings to average -GroPointParent::GroPointParent( - byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2, - int8_t enablePin, uint8_t measurementsToAverage, gropointModel model, - const char* sensName, uint8_t numVariables, uint32_t warmUpTime_ms, - uint32_t stabilizationTime_ms, uint32_t measurementTime_ms, - uint8_t incCalcValues) +GroPointParent::GroPointParent(byte modbusAddress, Stream* stream, + int8_t powerPin, int8_t powerPin2, + int8_t enablePin, uint8_t measurementsToAverage, + gropointModel model, const char* sensName, + uint8_t numVariables, uint32_t warmUpTime_ms, + uint32_t stabilizationTime_ms, + uint32_t measurementTime_ms, + uint8_t incCalcValues) : Sensor(sensName, numVariables, warmUpTime_ms, stabilizationTime_ms, measurementTime_ms, powerPin, -1, measurementsToAverage, incCalcValues), - _model(model), - _modbusAddress(modbusAddress), - _stream(stream), - _RS485EnablePin(enablePin), - _powerPin2(powerPin2) {} -GroPointParent::GroPointParent( - byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2, - int8_t enablePin, uint8_t measurementsToAverage, gropointModel model, - const char* sensName, uint8_t numVariables, uint32_t warmUpTime_ms, - uint32_t stabilizationTime_ms, uint32_t measurementTime_ms, - uint8_t incCalcValues) + _model(model), + _modbusAddress(modbusAddress), + _stream(stream), + _RS485EnablePin(enablePin), + _powerPin2(powerPin2) {} +GroPointParent::GroPointParent(byte modbusAddress, Stream& stream, + int8_t powerPin, int8_t powerPin2, + int8_t enablePin, uint8_t measurementsToAverage, + gropointModel model, const char* sensName, + uint8_t numVariables, uint32_t warmUpTime_ms, + uint32_t stabilizationTime_ms, + uint32_t measurementTime_ms, + uint8_t incCalcValues) : Sensor(sensName, numVariables, warmUpTime_ms, stabilizationTime_ms, measurementTime_ms, powerPin, -1, measurementsToAverage, incCalcValues), - _model(model), - _modbusAddress(modbusAddress), - _stream(&stream), - _RS485EnablePin(enablePin), - _powerPin2(powerPin2) {} + _model(model), + _modbusAddress(modbusAddress), + _stream(&stream), + _RS485EnablePin(enablePin), + _powerPin2(powerPin2) {} // Destructor GroPointParent::~GroPointParent() {} @@ -194,7 +198,7 @@ void GroPointParent::powerDown(void) { bool GroPointParent::addSingleMeasurementResult(void) { - bool success = false; + bool success = false; bool successT = false; // Initialize moisture variables for each probe segement float M1, M2, M3, M4, M5, M6, M7, M8 = -9999; @@ -221,13 +225,13 @@ bool GroPointParent::addSingleMeasurementResult(void) { if (!success || isnan(M8)) M8 = -9999; MS_DBG(F(" "), _gsensor.getParameter()); - MS_DBG(F(" "), _gsensor.getUnits()); - MS_DBG(F(" "), M1,',', M2,',', M3,',', M4,',', M5,',', - M6,',', M7,',', M8); - + MS_DBG(F(" "), _gsensor.getUnits()); + MS_DBG(F(" "), M1, ',', M2, ',', M3, ',', M4, ',', M5, ',', + M6, ',', M7, ',', M8); + // Get Temperature Values - successT = _gsensor.getTemperatureValues(T1, T2, T3, T4, T5, - T6, T7, T8, T9, T10, T11, T12, T13); + successT = _gsensor.getTemperatureValues( + T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13); // Fix not-a-number values if (!success || isnan(T1)) T1 = -9999; @@ -245,10 +249,10 @@ bool GroPointParent::addSingleMeasurementResult(void) { if (!success || isnan(T13)) T13 = -9999; MS_DBG(F(" "), _gsensor.getParameter1()); - MS_DBG(F(" "), _gsensor.getUnits1()); - MS_DBG(F(" "), T1, ',', T2, ',', T3, ',', T4, ',', T5, ',', - T6, ',', T7, ',', T8, ',', T9, ',', T10, ',', - T11, ',', T12, ',', T13); + MS_DBG(F(" "), _gsensor.getUnits1()); + MS_DBG(F(" "), T1, ',', T2, ',', T3, ',', T4, ',', T5, ',', + T6, ',', T7, ',', T8, ',', T9, ',', T10, ',', T11, ',', + T12, ',', T13); // Put values into the array diff --git a/src/sensors/GroPointParent.h b/src/sensors/GroPointParent.h index 32ea22cc3..2772fde94 100644 --- a/src/sensors/GroPointParent.h +++ b/src/sensors/GroPointParent.h @@ -4,16 +4,17 @@ * Part of the EnviroDIY ModularSensors library for Arduino * @author Anthony Aufdenkampe * - * @brief Contains the GroPointParent sensor subclass, itself a parent + * @brief Contains the GroPointParent sensor subclass, itself a parent * class for all GroPoint Soil Moisture and Temperature sensors * that communicate via SDI-12 or Modbus. * NOTE: Presently this library only supports Modbus communication and GroPoint * Profile Multi Segment Soil Moisture & Temperature Profiling Probes (GPLP-X) * via the EnviroDIY GroPointModbus library. * - * Documentation for the GroPointModbus Modbus Protocol commands and responses, along with - * information about the various variables, can be found in the EnviroDIY - * GroPointModbus library at: https://github.com/EnviroDIY/GroPointModbus + * Documentation for the GroPointModbus Modbus Protocol commands and responses, + * along with information about the various variables, can be found in the + * EnviroDIY GroPointModbus library at: + * https://github.com/EnviroDIY/GroPointModbus */ /* clang-format off */ /** @@ -124,28 +125,26 @@ class GroPointParent : public Sensor { * optional with a default value of 0. */ GroPointParent(byte modbusAddress, Stream* stream, int8_t powerPin, - int8_t powerPin2, int8_t enablePin = -1, - uint8_t measurementsToAverage = 1, - gropointModel model = GPLPX, - const char* sensName = "GroPoint-Sensor", - uint8_t numVariables = 2, - uint32_t warmUpTime_ms = 350, - uint32_t stabilizationTime_ms = 100, - uint32_t measurementTime_ms = 200, - uint8_t incCalcValues = 0); + int8_t powerPin2, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1, + gropointModel model = GPLPX, + const char* sensName = "GroPoint-Sensor", + uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, + uint32_t stabilizationTime_ms = 100, + uint32_t measurementTime_ms = 200, + uint8_t incCalcValues = 0); /** * @copydoc GroPointParent::GroPointParent */ GroPointParent(byte modbusAddress, Stream& stream, int8_t powerPin, - int8_t powerPin2, int8_t enablePin = -1, - uint8_t measurementsToAverage = 1, - gropointModel model = GPLPX, - const char* sensName = "GroPoint-Sensor", - uint8_t numVariables = 2, - uint32_t warmUpTime_ms = 350, - uint32_t stabilizationTime_ms = 100, - uint32_t measurementTime_ms = 200, - uint8_t incCalcValues = 0); + int8_t powerPin2, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1, + gropointModel model = GPLPX, + const char* sensName = "GroPoint-Sensor", + uint8_t numVariables = 2, uint32_t warmUpTime_ms = 350, + uint32_t stabilizationTime_ms = 100, + uint32_t measurementTime_ms = 200, + uint8_t incCalcValues = 0); /** * @brief Destroy the GroPoint Parent object - no action taken */ @@ -200,12 +199,12 @@ class GroPointParent : public Sensor { bool addSingleMeasurementResult(void) override; private: - gropoint _gsensor; - gropointModel _model; - byte _modbusAddress; - Stream* _stream; - int8_t _RS485EnablePin; - int8_t _powerPin2; + gropoint _gsensor; + gropointModel _model; + byte _modbusAddress; + Stream* _stream; + int8_t _RS485EnablePin; + int8_t _powerPin2; }; #endif // SRC_SENSORS_GROPOINTPARENT_H_ From 9860be16f5e96fb9c028d2a5346208c0976a0536 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 12:22:39 -0400 Subject: [PATCH 45/89] Using new GroPoint variables in example Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/menu_a_la_carte.ino | 154 +++++++------------ 1 file changed, 56 insertions(+), 98 deletions(-) diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index f6e7e0614..40042250f 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -267,7 +267,7 @@ const int8_t greenLED = 8; // Pin for the green LED const int8_t redLED = 9; // Pin for the red LED const int8_t buttonPin = 21; // Pin for debugging mode (ie, button pin) const int8_t wakePin = 31; // MCU interrupt/alarm pin to wake from sleep -// Mayfly 0.x D31 = A7 +// Mayfly 0.x, 1.x D31 = A7 // Set the wake pin to -1 if you do not want the main processor to sleep. // In a SAMD system where you are using the built-in rtc, set wakePin to 1 const int8_t sdCardPwrPin = -1; // MCU SD card power pin @@ -1374,106 +1374,64 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( // for Additional Serial Ports" section // NOTE: Use -1 for any pins that don't apply or aren't being used. -byte gplp8ModbusAddress = 0x19; // The modbus address of the gplp8 +byte gplp8ModbusAddress = 0x19; // The modbus address of the gplp8 // Raw Request >>> {0x19, 0x03, 0x00, 0xC8, 0x00, 0x01, 0x06, 0x2C} const int8_t gplp8AdapterPower = sensorPowerPin; // RS485 adapter power pin -const int8_t gplp8SensorPower = modbusSensorPowerPin; // Sensor power pin -const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin +const int8_t gplp8SensorPower = modbusSensorPowerPin; // Sensor power pin +const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin const uint8_t gplp8NumberReadings = 1; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption // Create a GroPoint Profile GPLP-8 sensor object GroPointGPLP8 gplp8(gplp8ModbusAddress, modbusSerial, gplp8AdapterPower, - gplp8SensorPower, gplp8EnablePin, gplp8NumberReadings); + gplp8SensorPower, gplp8EnablePin, gplp8NumberReadings); // Create moisture variable pointers for each segment of the GPLP-8 -Variable* gplp8Moist1 = new Variable(&gplp8, 0, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M1", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist1", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Moist2 = new Variable(&gplp8, 1, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M2", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist2", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Moist3 = new Variable(&gplp8, 2, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M3", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist3", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Moist4 = new Variable(&gplp8, 3, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M4", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist4", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Moist5 = new Variable(&gplp8, 4, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M5", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist5", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Moist6 = new Variable(&gplp8, 5, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M6", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist6", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Moist7 = new Variable(&gplp8, 6, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M7", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist7", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Moist8 = new Variable(&gplp8, 7, - GPLP8_MOIST_RESOLUTION, "volumetricWaterContent at M8", - GPLP8_MOIST_UNIT_NAME, "GPLP8Moist8", - "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Moist1 = new GroPointGPLP8_Moist( + &gplp8, 0, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist1"); +Variable* gplp8Moist2 = new GroPointGPLP8_Moist( + &gplp8, 1, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist2"); +Variable* gplp8Moist3 = new GroPointGPLP8_Moist( + &gplp8, 2, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist3"); +Variable* gplp8Moist4 = new GroPointGPLP8_Moist( + &gplp8, 3, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist4"); +Variable* gplp8Moist5 = new GroPointGPLP8_Moist( + &gplp8, 4, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist5"); +Variable* gplp8Moist6 = new GroPointGPLP8_Moist( + &gplp8, 5, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist6"); +Variable* gplp8Moist7 = new GroPointGPLP8_Moist( + &gplp8, 6, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist7"); +Variable* gplp8Moist8 = new GroPointGPLP8_Moist( + &gplp8, 7, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Moist8"); // Create temperature variable pointers for each sensor of the GPLP-8 -Variable* gplp8Temp1 = new Variable(&gplp8, 8, - GPLP8_TEMP_RESOLUTION, "temperature at T1", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp1", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp2 = new Variable(&gplp8, 9, - GPLP8_TEMP_RESOLUTION, "temperature at T2", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp1", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp3 = new Variable(&gplp8, 10, - GPLP8_TEMP_RESOLUTION, "temperature at T3", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp3", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp4 = new Variable(&gplp8, 11, - GPLP8_TEMP_RESOLUTION, "temperature at T4", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp4", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp5 = new Variable(&gplp8, 12, - GPLP8_TEMP_RESOLUTION, "temperature at T5", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp5", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp6 = new Variable(&gplp8, 13, - GPLP8_TEMP_RESOLUTION, "temperature at T6", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp6", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp7 = new Variable(&gplp8, 14, - GPLP8_TEMP_RESOLUTION, "temperature at T7", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp7", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp8 = new Variable(&gplp8, 15, - GPLP8_TEMP_RESOLUTION, "temperature at T8", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp8", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp9 = new Variable(&gplp8, 16, - GPLP8_TEMP_RESOLUTION, "temperature at T9", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp9", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp10 = new Variable(&gplp8, 17, - GPLP8_TEMP_RESOLUTION, "temperature at T10", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp10", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp11 = new Variable(&gplp8, 18, - GPLP8_TEMP_RESOLUTION, "temperature at T11", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp11", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp12 = new Variable(&gplp8, 19, - GPLP8_TEMP_RESOLUTION, "temperature at T12", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp12", - "12345678-abcd-1234-ef00-1234567890ab"); -Variable* gplp8Temp13 = new Variable(&gplp8, 20, - GPLP8_TEMP_RESOLUTION, "temperature at T13", - GPLP8_TEMP_UNIT_NAME, "GPLP8Temp13", - "12345678-abcd-1234-ef00-1234567890ab"); +Variable* gplp8Temp1 = new GroPointGPLP8_Temp( + &gplp8, 8, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp1"); +Variable* gplp8Temp2 = new GroPointGPLP8_Temp( + &gplp8, 9, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp1"); +Variable* gplp8Temp3 = new GroPointGPLP8_Temp( + &gplp8, 10, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp3"); +Variable* gplp8Temp4 = new GroPointGPLP8_Temp( + &gplp8, 11, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp4"); +Variable* gplp8Temp5 = new GroPointGPLP8_Temp( + &gplp8, 12, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp5"); +Variable* gplp8Temp6 = new GroPointGPLP8_Temp( + &gplp8, 13, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp6"); +Variable* gplp8Temp7 = new GroPointGPLP8_Temp( + &gplp8, 14, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp7"); +Variable* gplp8Temp8 = new GroPointGPLP8_Temp( + &gplp8, 15, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp8"); +Variable* gplp8Temp9 = new GroPointGPLP8_Temp( + &gplp8, 16, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp9"); +Variable* gplp8Temp10 = new GroPointGPLP8_Temp( + &gplp8, 17, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp10"); +Variable* gplp8Temp11 = new GroPointGPLP8_Temp( + &gplp8, 18, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp11"); +Variable* gplp8Temp12 = new GroPointGPLP8_Temp( + &gplp8, 19, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp12"); +Variable* gplp8Temp13 = new GroPointGPLP8_Temp( + &gplp8, 20, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp13"); /** End [gropoint_gplp8] */ #endif @@ -2963,15 +2921,15 @@ float getBatteryVoltage() { // Arduino Setup Function // ========================================================================== void setup() { - /** Start [setup_wait] */ - // Wait for USB connection to be established by PC - // NOTE: Only use this when debugging - if not connected to a PC, this - // could prevent the script from starting - #if defined SERIAL_PORT_USBVIRTUAL - while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000L)) { - // wait - } - #endif +/** Start [setup_wait] */ +// Wait for USB connection to be established by PC +// NOTE: Only use this when debugging - if not connected to a PC, this +// could prevent the script from starting +#if defined SERIAL_PORT_USBVIRTUAL + while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000L)) { + // wait + } +#endif /** End [setup_wait] */ /** Start [setup_prints] */ From 0e5bb2c6d3fdd8e01f370f457180e5f402cb8a9c Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 12:26:23 -0400 Subject: [PATCH 46/89] Fixed snaked GroPoint snipped tags Signed-off-by: Sara Damiano --- ChangeLog.md | 10 ++++++++-- examples/menu_a_la_carte/ReadMe.md | 2 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 4 ++-- src/sensors/GroPointGPLP8.h | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 53f67e106..d841da3d4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -13,15 +13,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Added -- Support [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](https://www.gropoint.com/products/soil-sensors/gropoint-profile) ### Removed ### Fixed -- Fixed GitHub actions for pull requests from forks. *** +## [0.35.0] + +### Added +- Support [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](https://www.gropoint.com/products/soil-sensors/gropoint-profile) + +### Fixed +- Fixed GitHub actions for pull requests from forks. + ## [0.34.0] ### Changed diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 96b5275b4..ded077ec1 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -837,7 +837,7 @@ ___ @see @ref sensor_gplp8 -[//]: # ( @menusnip{gropoint_gplp8} ) +[//]: # ( @menusnip{gro_point_gplp8} ) ___ diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 40042250f..f51652a96 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1367,7 +1367,7 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( // ========================================================================== // GroPoint Profile GPLP-8 Soil Moisture and Temperature Sensor // ========================================================================== -/** Start [gropoint_gplp8] */ +/** Start [gro_point_gplp8] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1432,7 +1432,7 @@ Variable* gplp8Temp12 = new GroPointGPLP8_Temp( &gplp8, 19, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp12"); Variable* gplp8Temp13 = new GroPointGPLP8_Temp( &gplp8, 20, "12345678-abcd-1234-ef00-1234567890ab", "GPLP8Temp13"); -/** End [gropoint_gplp8] */ +/** End [gro_point_gplp8] */ #endif diff --git a/src/sensors/GroPointGPLP8.h b/src/sensors/GroPointGPLP8.h index 81fb78156..fe676c600 100644 --- a/src/sensors/GroPointGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -41,7 +41,7 @@ * @section sensor_gplp8_examples Example Code * The GPLP-8 Probe is used in the @menulink{GroPoint_gplp8} example. * - * @menusnip{gropoint_gplp8} + * @menusnip{gro_point_gplp8} */ /* clang-format on */ From a7a09c7c9c96e73c4c2107650ecc4ce78f8ab04a Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 12:29:52 -0400 Subject: [PATCH 47/89] Woops, fixed double tag in changelog Signed-off-by: Sara Damiano --- ChangeLog.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index cdb84cf8c..fb7d45237 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -21,14 +21,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *** -## [0.34.1] -### Fixed -#347 -WiFi S6B stability - tears dwon TCP/IP before going to sleep, doesn't automatically poll for meta data - ## [0.34.1] ### Changed - Incorporated improvements to the XBee Wifi - from [neilh10](https://github.com/EnviroDIY/ModularSensors/commits?author=neilh10) + - #347 -WiFi S6B stability - tears dwon TCP/IP before going to sleep, doesn't automatically poll for meta data ### Added - Added the ability to enable or disable polling of modem attached variables. From 2289e58de524b1a12b337328de02ab34cae2f419 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 30 Jun 2023 13:54:13 -0400 Subject: [PATCH 48/89] Add GroPoint to dependency installs Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 113 +++++------------- .../install-deps-arduino-cli.sh | 3 + .../install-deps-platformio.sh | 3 + library.json | 15 +-- 4 files changed, 43 insertions(+), 91 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 4a871c64d..163e0908c 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 16, + "action_cache_version": 17, "dependencies": [ { "name": "EnviroDIY_DS3231", @@ -8,10 +8,7 @@ "url": "https://github.com/EnviroDIY/Sodaq_DS3231", "version": "~1.3.4", "note": "An Arduino library for the DS3231 RTC (Real Time Clock), based off of the Sodaq_DS3231 library.", - "authors": [ - "Kees Bakker", - "Sara Damiano" - ], + "authors": ["Kees Bakker", "Sara Damiano"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -22,9 +19,7 @@ "url": "https://github.com/arduino-libraries/RTCZero", "version": "~1.6.0", "note": "Functions for using the processor real time clock in SAMD21 processors", - "authors": [ - "Arduino" - ], + "authors": ["Arduino"], "frameworks": "arduino", "platforms": "atmelsam" }, @@ -35,9 +30,7 @@ "url": "https://github.com/GreyGnome/EnableInterrupt", "version": "~1.1.0", "note": "GreyGnome's EnableInterrupt - Assign an interrupt to any supported pin on all Arduinos", - "authors": [ - "Mike 'GreyGnome' Schwager" - ], + "authors": ["Mike 'GreyGnome' Schwager"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -48,9 +41,7 @@ "url": "https://github.com/greiman/SdFat", "version": "~2.1.2", "note": "SdFat - FAT16/FAT32 file system for SD cards.", - "authors": [ - "Bill Greiman" - ], + "authors": ["Bill Greiman"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -59,10 +50,7 @@ "owner": "vshymanskyy", "version": "~0.11.5", "note": "A small Arduino library for GPRS modules.", - "authors": [ - "Volodymyr Shymanskyy", - "Sara Damiano" - ], + "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -73,9 +61,7 @@ "url": "https://github.com/knolleary/pubsubclient", "version": "~2.8", "note": "A client library for MQTT messaging.", - "authors": [ - "Nick O'Leary" - ] + "authors": ["Nick O'Leary"] }, { "name": "Adafruit BusIO", @@ -84,9 +70,7 @@ "url": "https://github.com/adafruit/Adafruit_BusIO", "version": "~1.11.6", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -97,9 +81,7 @@ "url": "https://github.com/adafruit/Adafruit_Sensor", "version": "~1.1.9", "note": "Adafruit's unified sensor library is used by their other libraries", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -109,9 +91,7 @@ "version_note": "=1.2.0", "version": "https://github.com/soligen2010/Adafruit_ADS1X15.git#7d67b451f739e9a63f40f2d6d139ab582258572b", "note": "Driver for TI's ADS1015: 12-bit Differential or Single-Ended ADC with PGA and Comparator. This fork removes bugs in the Adafruit original library.", - "authors_note": [ - "soligen2010" - ], + "authors_note": ["soligen2010"], "frameworks_note": "arduino", "platforms_note": "*" }, @@ -122,9 +102,7 @@ "url": "https://github.com/adafruit/Adafruit_AM2315", "version": "~2.2.1", "note": "AOSong AM2315 I2C Temp/Humidity Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -135,9 +113,7 @@ "url": "https://github.com/adafruit/Adafruit_BME280_Library", "version": "~2.2.2", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -147,9 +123,7 @@ "version": "https://github.com/MartinL1/BMP388_DEV.git", "version_note": "~1.0.9", "note": "An Arduino compatible, non-blocking, I2C/SPI library for the Bosch BMP388 barometer.", - "authors": [ - "Martin Lindupp" - ], + "authors": ["Martin Lindupp"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -160,9 +134,7 @@ "url": "https://github.com/adafruit/DHT-sensor-library", "version": "~1.4.4", "note": "AOSong DHT Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -173,9 +145,7 @@ "url": "https://github.com/adafruit/Adafruit_INA219", "version": "~1.2.1", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -186,9 +156,7 @@ "url": "https://github.com/adafruit/Adafruit_MPL115A2", "version": "~2.0.0", "note": "MPL115A2 Barometer Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino" }, { @@ -198,9 +166,7 @@ "url": "https://github.com/adafruit/Adafruit_SHT4X", "version": "~1.0.2", "note": "Sensirion SHT4x Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino" }, { @@ -234,12 +200,7 @@ "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library", "version": "~3.9.1", "note": "DallasTemperature - Arduino Library for Dallas Temperature ICs (DS18B20, DS18S20, DS1822, DS1820)", - "authors": [ - "Guil Barros", - "Miles Burton", - "Rob Tillart", - "Tim Nuewsome" - ], + "authors": ["Guil Barros", "Miles Burton", "Rob Tillart", "Tim Nuewsome"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -266,22 +227,14 @@ "url": "https://github.com/NorthernWidget/MS5803", "version": "~0.1.2", "note": "General interface to MS5803-series pressure transducers", - "authors": [ - "Bobby Schulz", - "Andrew Wickert", - "Chad Sandell", - "Sara Damiano" - ] + "authors": ["Bobby Schulz", "Andrew Wickert", "Chad Sandell", "Sara Damiano"] }, { "name": "Tally_Library_I2C", "version": "https://github.com/EnviroDIY/Tally_Library.git#Dev_I2C", "version_note": "Uses `Dev_I2C` feature branch", "note": "An Arduino library for interfacing to the Project Tally Event counter from NorthernWidget.", - "authors": [ - "Bobby Schulz", - "Anthony Aufdenkampe" - ], + "authors": ["Bobby Schulz", "Anthony Aufdenkampe"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -292,9 +245,7 @@ "url": "https://github.com/EnviroDIY/SensorModbusMaster", "version": "~0.6.8", "note": "EnviroDIY SensorModbusMaster - Arduino library for communicating via modbus with the Arduino acting as the modbus master.", - "authors": [ - "Sara Damiano" - ], + "authors": ["Sara Damiano"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -305,9 +256,7 @@ "url": "https://github.com/EnviroDIY/KellerModbus", "version": "~0.2.2", "note": "Arduino library for communication with Keller pressure and water level sensors via Modbus.", - "authors": [ - "Anthony Aufdenkampe" - ] + "authors": ["Anthony Aufdenkampe"] }, { "name": "YosemitechModbus", @@ -316,23 +265,19 @@ "url": "https://github.com/EnviroDIY/YosemitechModbus", "version": "~0.4.0", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", - "authors": [ - "Sara Damiano", - "Anthony Aufdenkampe" - ], + "authors": ["Sara Damiano", "Anthony Aufdenkampe"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, { - "name": "GropointModbus", + "name": "GroPointModbus", "owner": "envirodiy", - "version": "https://github.com/EnviroDIY/GroPointModbus.git", - "note": "AA library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", - "authors": [ - "Anthony Aufdenkampe" - ], + "url": "https://github.com/EnviroDIY/GroPointModbus.git", + "version": "~0.1.0", + "note": "A library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", + "authors": ["Anthony Aufdenkampe"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" } ] -} \ No newline at end of file +} diff --git a/continuous_integration/install-deps-arduino-cli.sh b/continuous_integration/install-deps-arduino-cli.sh index 1fb6d4667..364f03a82 100644 --- a/continuous_integration/install-deps-arduino-cli.sh +++ b/continuous_integration/install-deps-arduino-cli.sh @@ -132,6 +132,9 @@ arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install Ke echo "\n\e[32mInstalling EnviroDIY YosemitechModbus library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install YosemitechModbus +echo "\n\e[32mInstalling EnviroDIY GropointModbus library from Arduino library index\e[0m" +arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install GropointModbus + echo "\n\e[32mInstalling StreamDebugger library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install StreamDebugger diff --git a/continuous_integration/install-deps-platformio.sh b/continuous_integration/install-deps-platformio.sh index 7866985ad..f8b08f7d6 100644 --- a/continuous_integration/install-deps-platformio.sh +++ b/continuous_integration/install-deps-platformio.sh @@ -107,6 +107,9 @@ pio pkg install -g --library envirodiy/KellerModbus echo "\e[32mInstalling envirodiy/YosemitechModbus\e[0m" pio pkg install -g --library envirodiy/YosemitechModbus +echo "\e[32mInstalling envirodiy/GroPointModbus\e[0m" +pio pkg install -g --library envirodiy/GroPointModbus + echo "\e[32mInstalling vshymanskyy/StreamDebugger\e[0m" pio pkg install -g --library vshymanskyy/StreamDebugger diff --git a/library.json b/library.json index d98250881..6394a051b 100644 --- a/library.json +++ b/library.json @@ -331,13 +331,14 @@ "platforms": "atmelavr, atmelsam" }, { - "name": "GropointModbus", - "owner": "envirodiy", - "version": "https://github.com/EnviroDIY/GroPointModbus.git", - "note": "AA library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", - "authors": ["Anthony Aufdenkampe"], - "frameworks": "arduino", - "platforms": "atmelavr, atmelsam" + "name": "GroPointModbus", + "owner": "envirodiy", + "url": "https://github.com/EnviroDIY/GroPointModbus.git", + "version": "~0.1.0", + "note": "A library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", + "authors": ["Anthony Aufdenkampe"], + "frameworks": "arduino", + "platforms": "atmelavr, atmelsam" } ] } From e2d99ce4192c586e88843001b5d8eec492b36da6 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 11 Jul 2023 12:50:55 -0400 Subject: [PATCH 49/89] Fix doxygen linkage Signed-off-by: Sara Damiano --- src/LoggerModem.h | 48 +++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 8765e23db..6b358d38e 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -43,7 +43,7 @@ * Variable objects to be tied to a loggerModem. These are measured by a modem, * but are implemented as calculated variables. * - * @note The modem is NOT set up as a sensor. ALl of these variables for the + * @note The modem is NOT set up as a sensor. ALL of these variables for the * modem object are actually being called as calculated variables where the * calculation function is to ask the modem object for the values from the last * time it connected to the internet. @@ -68,7 +68,8 @@ * RSSI is a rough calculation, so it has 0 decimal place resolution */ #define MODEM_RSSI_RESOLUTION 0 -/// @brief The bit mask for #_pollModemMetaData to enable RSSI polling. +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable RSSI +/// polling. #define MODEM_RSSI_ENABLE_BITMASK 0b00000001 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -96,8 +97,8 @@ * Percent signal is a rough calculation, so it has 0 decimal place resolution */ #define MODEM_PERCENT_SIGNAL_RESOLUTION 0 -/// @brief The bit mask for #_pollModemMetaData to enable percent signal -/// polling. +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable percent +/// signal polling. #define MODEM_PERCENT_SIGNAL_ENABLE_BITMASK 0b00000010 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -129,8 +130,8 @@ * Battery state is a code value; it has 0 decimal place resolution */ #define MODEM_BATTERY_STATE_RESOLUTION 0 -/// @brief The bit mask for #_pollModemMetaData to enable modem battery charging -/// state polling. +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable modem +/// battery charging state polling. #define MODEM_BATTERY_STATE_ENABLE_BITMASK 0b00000100 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -159,8 +160,8 @@ /// @brief Decimals places in string representation; battery charge percent /// should have 0. #define MODEM_BATTERY_PERCENT_RESOLUTION 0 -/// @brief The bit mask for #_pollModemMetaData to enable modem battery percent -/// polling. +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable modem +/// battery percent polling. #define MODEM_BATTERY_PERCENT_ENABLE_BITMASK 0b00001000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -192,8 +193,8 @@ * No supported module has higher than 1mV resolution in battery reading. */ #define MODEM_BATTERY_VOLTAGE_RESOLUTION 0 -/// @brief The bit mask for #_pollModemMetaData to enable modem battery voltage -/// polling. +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable modem +/// battery voltage polling. #define MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK 0b00010000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -224,8 +225,8 @@ * Most modules that can measure temperature measure to 0.1°C */ #define MODEM_TEMPERATURE_RESOLUTION 1 -/// @brief The bit mask for #_pollModemMetaData to enable modem temperature -/// polling. +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable modem +/// temperature polling. #define MODEM_TEMPERATURE_ENABLE_BITMASK 0b00100000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -253,8 +254,8 @@ /// @brief Decimals places in string representation; total active time should /// have 3. #define MODEM_ACTIVATION_RESOLUTION 3 -/// @brief The bit mask for #_pollModemMetaData to enable modem activation time -/// polling. +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable modem +/// activation time polling. #define MODEM_ACTIVATION_ENABLE_BITMASK 0b01000000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -280,8 +281,8 @@ /// @brief Decimals places in string representation; total powered time should /// have 3. #define MODEM_POWERED_RESOLUTION 3 -/// @brief The bit mask for #_pollModemMetaData to enable modem power time -/// polling +/// @brief The bit mask for loggerModem::_pollModemMetaData to enable modem +/// power time polling #define MODEM_POWERED_ENABLE_BITMASK 0b10000000 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); @@ -1080,6 +1081,21 @@ class loggerModem { /** * @brief An 8-bit code for the enabled modem polling variables + * + * Setting a bit to 0 will disable polling, to 1 will enable it. By default + * no polling is enabled to save time and power by not requesting + * unnecessary information from the modem. When modem measured variables + * are attached to a modem, polling for those results is automatically + * enabled. + * + * Bit | Variable Class | Relevent Define + * ----|----------------|---------------- + * 0 | #Modem_RSSI | #MODEM_RSSI_ENABLE_BITMASK + * 1 | #Modem_SignalPercent | #MODEM_PERCENT_SIGNAL_ENABLE_BITMASK + * 2 | #Modem_BatteryState | #MODEM_BATTERY_STATE_ENABLE_BITMASK + * 3 | #Modem_BatteryPercent | #MODEM_BATTERY_PERCENT_ENABLE_BITMASK + * 4 | #Modem_BatteryVoltage | #MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK + * 5 | #Modem_Temp | #MODEM_TEMPERATURE_ENABLE_BITMASK */ uint8_t _pollModemMetaData = 0; }; From 48d9338af345fa1c08cb34fc89daaecc07979cd1 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 11 Jul 2023 12:59:26 -0400 Subject: [PATCH 50/89] Fix undefined variable in example Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/menu_a_la_carte.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index f51652a96..836c5cd92 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1377,7 +1377,7 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( byte gplp8ModbusAddress = 0x19; // The modbus address of the gplp8 // Raw Request >>> {0x19, 0x03, 0x00, 0xC8, 0x00, 0x01, 0x06, 0x2C} const int8_t gplp8AdapterPower = sensorPowerPin; // RS485 adapter power pin -const int8_t gplp8SensorPower = modbusSensorPowerPin; // Sensor power pin +const int8_t gplp8SensorPower = A3; // Sensor power pin const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin const uint8_t gplp8NumberReadings = 1; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize From 7171ba2741901bfe49f67623dd8f2f5bcffd4101 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 12 Sep 2023 11:45:50 -0400 Subject: [PATCH 51/89] Bump Adafruit Unified Sensor Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 2 +- library.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 8b788f53d..50094cc2e 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -79,7 +79,7 @@ "owner": "adafruit", "library id": "31", "url": "https://github.com/adafruit/Adafruit_Sensor", - "version": "~1.1.9", + "version": "~1.1.13", "note": "Adafruit's unified sensor library is used by their other libraries", "authors": ["Adafruit"], "frameworks": "arduino", diff --git a/library.json b/library.json index 20a12a8c7..e7c54c58c 100644 --- a/library.json +++ b/library.json @@ -140,7 +140,7 @@ "owner": "adafruit", "library id": "31", "url": "https://github.com/adafruit/Adafruit_Sensor", - "version": "~1.1.9", + "version": "~1.1.13", "note": "Adafruit's unified sensor library is used by their other libraries", "authors": ["Adafruit"], "frameworks": "arduino", From 4a993a673df74c6406a9517966dea3670e649eb3 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 14 Sep 2023 12:51:50 -0400 Subject: [PATCH 52/89] fix typo Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index b5513bad1..dcc844542 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -43,7 +43,7 @@ jobs: with: python-version: '3.x' - # Using anwer from here to get the exit code and pass the output: https://stackoverflow.com/questions/59191913/how-do-i-get-the-output-of-a-specific-step-in-github-actions + # Using answer from here to get the exit code and pass the output: https://stackoverflow.com/questions/59191913/how-do-i-get-the-output-of-a-specific-step-in-github-actions - name: check for classes in the menu example id: check_component continue-on-error: true From 5a4d77f50a15b23f1580c5254c6a8879f1848d77 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 21 Sep 2023 12:50:20 -0400 Subject: [PATCH 53/89] Fix GroPoint success for temperature Signed-off-by: Sara Damiano --- src/sensors/GroPointParent.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sensors/GroPointParent.cpp b/src/sensors/GroPointParent.cpp index 5ee723148..e66ed0c70 100644 --- a/src/sensors/GroPointParent.cpp +++ b/src/sensors/GroPointParent.cpp @@ -234,19 +234,19 @@ bool GroPointParent::addSingleMeasurementResult(void) { T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13); // Fix not-a-number values - if (!success || isnan(T1)) T1 = -9999; - if (!success || isnan(T2)) T2 = -9999; - if (!success || isnan(T3)) T3 = -9999; - if (!success || isnan(T4)) T4 = -9999; - if (!success || isnan(T5)) T5 = -9999; - if (!success || isnan(T6)) T6 = -9999; - if (!success || isnan(T7)) T7 = -9999; - if (!success || isnan(T8)) T8 = -9999; - if (!success || isnan(T9)) T9 = -9999; - if (!success || isnan(T10)) T10 = -9999; - if (!success || isnan(T11)) T11 = -9999; - if (!success || isnan(T12)) T12 = -9999; - if (!success || isnan(T13)) T13 = -9999; + if (!successT || isnan(T1)) T1 = -9999; + if (!successT || isnan(T2)) T2 = -9999; + if (!successT || isnan(T3)) T3 = -9999; + if (!successT || isnan(T4)) T4 = -9999; + if (!successT || isnan(T5)) T5 = -9999; + if (!successT || isnan(T6)) T6 = -9999; + if (!successT || isnan(T7)) T7 = -9999; + if (!successT || isnan(T8)) T8 = -9999; + if (!successT || isnan(T9)) T9 = -9999; + if (!successT || isnan(T10)) T10 = -9999; + if (!successT || isnan(T11)) T11 = -9999; + if (!successT || isnan(T12)) T12 = -9999; + if (!successT || isnan(T13)) T13 = -9999; MS_DBG(F(" "), _gsensor.getParameter1()); MS_DBG(F(" "), _gsensor.getUnits1()); @@ -297,5 +297,5 @@ bool GroPointParent::addSingleMeasurementResult(void) { _sensorStatus &= 0b10011111; // Return true when finished - return success; + return success && successT; } From 0e25aa6e70e452f16fa90348e7e79598b2a982be Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 27 Mar 2024 16:38:38 -0400 Subject: [PATCH 54/89] Remove year from copyright lines Signed-off-by: Sara Damiano --- examples/DRWI_2G/DRWI_2G.ino | 7 +++---- examples/DRWI_DigiLTE/DRWI_DigiLTE.ino | 7 +++---- examples/DRWI_Mayfly1/DRWI_Mayfly1.ino | 5 ++--- examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino | 5 ++--- examples/DRWI_NoCellular/DRWI_NoCellular.ino | 7 +++---- examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino | 5 ++--- examples/baro_rho_correction/baro_rho_correction.ino | 7 +++---- examples/data_saving/data_saving.ino | 7 +++---- examples/double_logger/double_logger.ino | 7 +++---- examples/logging_to_MMW/logging_to_MMW.ino | 7 +++---- .../logging_to_ThingSpeak/logging_to_ThingSpeak.ino | 7 +++---- examples/menu_a_la_carte/menu_a_la_carte.ino | 11 +++++------ examples/simple_logging/simple_logging.ino | 7 +++---- .../simple_logging_LearnEnviroDIY.ino | 7 +++---- examples/single_sensor/single_sensor.ino | 7 +++---- src/LoggerBase.cpp | 5 +++-- src/LoggerBase.h | 5 +++-- src/LoggerModem.cpp | 5 +++-- src/LoggerModem.h | 5 +++-- src/ModSensorDebugger.h | 5 +++-- src/ModularSensors.h | 5 +++-- src/SensorBase.cpp | 5 +++-- src/SensorBase.h | 7 ++++--- src/VariableArray.cpp | 5 +++-- src/VariableArray.h | 5 +++-- src/VariableBase.cpp | 5 +++-- src/VariableBase.h | 5 +++-- src/WatchDogs/WatchDogAVR.cpp | 5 +++-- src/WatchDogs/WatchDogAVR.h | 5 +++-- src/WatchDogs/WatchDogSAMD.cpp | 5 +++-- src/WatchDogs/WatchDogSAMD.h | 5 +++-- src/dataPublisherBase.cpp | 5 +++-- src/dataPublisherBase.h | 5 +++-- src/modems/DigiXBee.cpp | 5 +++-- src/modems/DigiXBee.h | 5 +++-- src/modems/DigiXBee3GBypass.cpp | 5 +++-- src/modems/DigiXBee3GBypass.h | 5 +++-- src/modems/DigiXBeeCellularTransparent.cpp | 5 +++-- src/modems/DigiXBeeCellularTransparent.h | 5 +++-- src/modems/DigiXBeeLTEBypass.cpp | 5 +++-- src/modems/DigiXBeeLTEBypass.h | 5 +++-- src/modems/DigiXBeeWifi.cpp | 5 +++-- src/modems/DigiXBeeWifi.h | 5 +++-- src/modems/EspressifESP32.h | 5 +++-- src/modems/EspressifESP8266.cpp | 5 +++-- src/modems/EspressifESP8266.h | 5 +++-- src/modems/LoggerModemMacros.h | 5 +++-- src/modems/QuectelBG96.cpp | 5 +++-- src/modems/QuectelBG96.h | 5 +++-- src/modems/SIMComSIM7000.cpp | 5 +++-- src/modems/SIMComSIM7000.h | 5 +++-- src/modems/SIMComSIM7080.cpp | 5 +++-- src/modems/SIMComSIM7080.h | 5 +++-- src/modems/SIMComSIM800.cpp | 5 +++-- src/modems/SIMComSIM800.h | 5 +++-- src/modems/SequansMonarch.cpp | 5 +++-- src/modems/SequansMonarch.h | 5 +++-- src/modems/Sodaq2GBeeR6.cpp | 5 +++-- src/modems/Sodaq2GBeeR6.h | 5 +++-- src/modems/SodaqUBeeR410M.cpp | 5 +++-- src/modems/SodaqUBeeR410M.h | 5 +++-- src/modems/SodaqUBeeU201.cpp | 5 +++-- src/modems/SodaqUBeeU201.h | 5 +++-- src/publishers/DreamHostPublisher.cpp | 5 +++-- src/publishers/DreamHostPublisher.h | 5 +++-- src/publishers/EnviroDIYPublisher.cpp | 5 +++-- src/publishers/EnviroDIYPublisher.h | 5 +++-- src/publishers/ThingSpeakPublisher.cpp | 5 +++-- src/publishers/ThingSpeakPublisher.h | 5 +++-- src/publishers/UbidotsPublisher.cpp | 5 +++-- src/publishers/UbidotsPublisher.h | 5 +++-- src/sensors/AOSongAM2315.cpp | 5 +++-- src/sensors/AOSongAM2315.h | 5 +++-- src/sensors/AOSongDHT.cpp | 5 +++-- src/sensors/AOSongDHT.h | 5 +++-- src/sensors/AnalogElecConductivity.cpp | 2 +- src/sensors/AnalogElecConductivity.h | 2 +- src/sensors/ApogeeSQ212.cpp | 5 +++-- src/sensors/ApogeeSQ212.h | 5 +++-- src/sensors/AtlasParent.cpp | 5 +++-- src/sensors/AtlasParent.h | 5 +++-- src/sensors/AtlasScientificCO2.cpp | 5 +++-- src/sensors/AtlasScientificCO2.h | 5 +++-- src/sensors/AtlasScientificDO.cpp | 5 +++-- src/sensors/AtlasScientificDO.h | 5 +++-- src/sensors/AtlasScientificEC.cpp | 5 +++-- src/sensors/AtlasScientificEC.h | 5 +++-- src/sensors/AtlasScientificORP.h | 5 +++-- src/sensors/AtlasScientificRTD.h | 5 +++-- src/sensors/AtlasScientificpH.h | 5 +++-- src/sensors/BoschBME280.cpp | 5 +++-- src/sensors/BoschBME280.h | 5 +++-- src/sensors/BoschBMP3xx.cpp | 5 +++-- src/sensors/BoschBMP3xx.h | 5 +++-- src/sensors/CampbellClariVUE10.h | 5 +++-- src/sensors/CampbellOBS3.cpp | 5 +++-- src/sensors/CampbellOBS3.h | 5 +++-- src/sensors/CampbellRainVUE10.h | 5 +++-- src/sensors/Decagon5TM.cpp | 5 +++-- src/sensors/Decagon5TM.h | 5 +++-- src/sensors/DecagonCTD.h | 5 +++-- src/sensors/DecagonES2.h | 5 +++-- src/sensors/EverlightALSPT19.cpp | 5 +++-- src/sensors/EverlightALSPT19.h | 5 +++-- src/sensors/ExternalVoltage.h | 5 +++-- src/sensors/FreescaleMPL115A2.cpp | 5 +++-- src/sensors/FreescaleMPL115A2.h | 5 +++-- src/sensors/InSituRDO.h | 5 +++-- src/sensors/InSituTrollSdi12a.h | 2 +- src/sensors/KellerAcculevel.h | 5 +++-- src/sensors/KellerNanolevel.h | 5 +++-- src/sensors/KellerParent.cpp | 5 +++-- src/sensors/KellerParent.h | 5 +++-- src/sensors/MaxBotixSonar.cpp | 5 +++-- src/sensors/MaxBotixSonar.h | 5 +++-- src/sensors/MaximDS18.cpp | 5 +++-- src/sensors/MaximDS18.h | 5 +++-- src/sensors/MaximDS3231.cpp | 5 +++-- src/sensors/MaximDS3231.h | 5 +++-- src/sensors/MeaSpecMS5803.cpp | 5 +++-- src/sensors/MeaSpecMS5803.h | 5 +++-- src/sensors/MeterHydros21.h | 5 +++-- src/sensors/MeterTeros11.cpp | 5 +++-- src/sensors/MeterTeros11.h | 5 +++-- src/sensors/PaleoTerraRedox.h | 5 +++-- src/sensors/ProcessorStats.cpp | 5 +++-- src/sensors/ProcessorStats.h | 5 +++-- src/sensors/RainCounterI2C.cpp | 5 +++-- src/sensors/RainCounterI2C.h | 5 +++-- src/sensors/SDI12Sensors.cpp | 5 +++-- src/sensors/SDI12Sensors.h | 5 +++-- src/sensors/SensirionSHT4x.cpp | 5 +++-- src/sensors/SensirionSHT4x.h | 5 +++-- src/sensors/TIADS1x15.cpp | 5 +++-- src/sensors/TIADS1x15.h | 5 +++-- src/sensors/TIINA219.cpp | 5 +++-- src/sensors/TIINA219.h | 5 +++-- src/sensors/TallyCounterI2C.cpp | 5 +++-- src/sensors/TallyCounterI2C.h | 5 +++-- src/sensors/TurnerCyclops.cpp | 5 +++-- src/sensors/TurnerCyclops.h | 5 +++-- src/sensors/YosemitechParent.cpp | 5 +++-- src/sensors/YosemitechParent.h | 5 +++-- src/sensors/YosemitechY4000.h | 5 +++-- src/sensors/YosemitechY504.h | 5 +++-- src/sensors/YosemitechY510.h | 5 +++-- src/sensors/YosemitechY511.h | 5 +++-- src/sensors/YosemitechY514.h | 5 +++-- src/sensors/YosemitechY520.h | 5 +++-- src/sensors/YosemitechY532.h | 5 +++-- src/sensors/YosemitechY533.h | 5 +++-- src/sensors/YosemitechY551.h | 5 +++-- src/sensors/YosemitechY560.h | 5 +++-- src/sensors/YosemitechY700.h | 5 +++-- src/sensors/ZebraTechDOpto.h | 5 +++-- 155 files changed, 459 insertions(+), 337 deletions(-) diff --git a/examples/DRWI_2G/DRWI_2G.ino b/examples/DRWI_2G/DRWI_2G.ino index d236f369c..853be8352 100644 --- a/examples/DRWI_2G/DRWI_2G.ino +++ b/examples/DRWI_2G/DRWI_2G.ino @@ -3,11 +3,10 @@ * @brief Example for DRWI CitSci 2G sites. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino index 4f23db6e2..e0a0286ff 100644 --- a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino +++ b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino @@ -3,11 +3,10 @@ * @brief Example for DRWI CitSci LTE sites. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino index 9df2638da..aaf59c6ce 100644 --- a/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino +++ b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino @@ -9,9 +9,8 @@ * Hydros21 CTD sensor * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger diff --git a/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino b/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino index 90742932d..86caf5eea 100644 --- a/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino +++ b/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino @@ -9,9 +9,8 @@ * Hydros21 CTD sensor * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger diff --git a/examples/DRWI_NoCellular/DRWI_NoCellular.ino b/examples/DRWI_NoCellular/DRWI_NoCellular.ino index cc40aab26..27eb408fe 100644 --- a/examples/DRWI_NoCellular/DRWI_NoCellular.ino +++ b/examples/DRWI_NoCellular/DRWI_NoCellular.ino @@ -3,11 +3,10 @@ * @brief Example for DRWI CitSci without cellular service. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino index 440671d9f..fee9b0a72 100644 --- a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino +++ b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino @@ -10,9 +10,8 @@ * Campbell Scientific OBS3+ Turbidity sensor * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger diff --git a/examples/baro_rho_correction/baro_rho_correction.ino b/examples/baro_rho_correction/baro_rho_correction.ino index 01a10cf6f..5d5eff405 100644 --- a/examples/baro_rho_correction/baro_rho_correction.ino +++ b/examples/baro_rho_correction/baro_rho_correction.ino @@ -3,11 +3,10 @@ * @brief Example demonstrating calculated variables. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/data_saving/data_saving.ino b/examples/data_saving/data_saving.ino index 0283b7409..75272d7fe 100644 --- a/examples/data_saving/data_saving.ino +++ b/examples/data_saving/data_saving.ino @@ -3,11 +3,10 @@ * @brief Example publishing only a portion of the logged variables. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/double_logger/double_logger.ino b/examples/double_logger/double_logger.ino index a560601de..462991c36 100644 --- a/examples/double_logger/double_logger.ino +++ b/examples/double_logger/double_logger.ino @@ -3,11 +3,10 @@ * @brief Example logging at two different timing intervals * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/logging_to_MMW/logging_to_MMW.ino b/examples/logging_to_MMW/logging_to_MMW.ino index c590dabec..a4e124826 100644 --- a/examples/logging_to_MMW/logging_to_MMW.ino +++ b/examples/logging_to_MMW/logging_to_MMW.ino @@ -3,11 +3,10 @@ * @brief Example logging data and publishing to Monitor My Watershed. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino b/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino index 9e584a7ea..4f8692421 100644 --- a/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino +++ b/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino @@ -3,11 +3,10 @@ * @brief Example logging data and publishing to ThingSpeak. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 836c5cd92..1c4d3135f 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -3,11 +3,10 @@ * @brief Example with all possible functionality. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: @@ -1377,8 +1376,8 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( byte gplp8ModbusAddress = 0x19; // The modbus address of the gplp8 // Raw Request >>> {0x19, 0x03, 0x00, 0xC8, 0x00, 0x01, 0x06, 0x2C} const int8_t gplp8AdapterPower = sensorPowerPin; // RS485 adapter power pin -const int8_t gplp8SensorPower = A3; // Sensor power pin -const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin +const int8_t gplp8SensorPower = A3; // Sensor power pin +const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin const uint8_t gplp8NumberReadings = 1; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption diff --git a/examples/simple_logging/simple_logging.ino b/examples/simple_logging/simple_logging.ino index ec810f886..ecd48f9a0 100644 --- a/examples/simple_logging/simple_logging.ino +++ b/examples/simple_logging/simple_logging.ino @@ -3,11 +3,10 @@ * @brief A simple data logging example. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino b/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino index 9b69aae8e..8edde3546 100644 --- a/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino +++ b/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino @@ -3,11 +3,10 @@ * @brief A data logging example for the Learn EnviroDIY tutorial. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/examples/single_sensor/single_sensor.ino b/examples/single_sensor/single_sensor.ino index b0b7bdf6c..76d3863df 100644 --- a/examples/single_sensor/single_sensor.ino +++ b/examples/single_sensor/single_sensor.ino @@ -3,11 +3,10 @@ * @brief An example using only sensor functions and no logging. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 08be51e40..b924314fe 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -1,7 +1,8 @@ /** * @file LoggerBase.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the Logger class. diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 36040f426..3470d5ca3 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -1,7 +1,8 @@ /** * @file LoggerBase.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the LoggerBase class which handles basic logging functions. diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index 7b6d2b4d1..427df904a 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -1,7 +1,8 @@ /** * @file LoggerModem.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the loggerModem class. diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 6b358d38e..9eda36916 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -1,7 +1,8 @@ /** * @file LoggerModem.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the loggerModem class and the variable subclasses diff --git a/src/ModSensorDebugger.h b/src/ModSensorDebugger.h index 5693906e9..669f07ace 100644 --- a/src/ModSensorDebugger.h +++ b/src/ModSensorDebugger.h @@ -1,7 +1,8 @@ /** * @file ModSensorDebugger.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @author Volodymyr Shymanskyy * diff --git a/src/ModularSensors.h b/src/ModularSensors.h index 9ab625b6b..df503b6d6 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -1,7 +1,8 @@ /** * @file ModularSensors.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief A simple include file for the Arduino command line interface (CLI).s diff --git a/src/SensorBase.cpp b/src/SensorBase.cpp index f89d8ab64..f3a056141 100644 --- a/src/SensorBase.cpp +++ b/src/SensorBase.cpp @@ -1,7 +1,8 @@ /** * @file SensorBase.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the Sensor class. diff --git a/src/SensorBase.h b/src/SensorBase.h index 84d9e0468..089d8762e 100644 --- a/src/SensorBase.h +++ b/src/SensorBase.h @@ -1,7 +1,8 @@ /** * @file SensorBase.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the Sensor class. @@ -39,7 +40,7 @@ * @brief The largest number of variables from a single sensor */ #define MAX_NUMBER_VARS 21 - // GroPoint Profile GPLP-8 has 8 Moisture and 13 Temperature values +// GroPoint Profile GPLP-8 has 8 Moisture and 13 Temperature values class Variable; // Forward declaration diff --git a/src/VariableArray.cpp b/src/VariableArray.cpp index b6e37b7c9..161af36be 100644 --- a/src/VariableArray.cpp +++ b/src/VariableArray.cpp @@ -1,7 +1,8 @@ /** * @file VariableArray.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the VariableArray class. diff --git a/src/VariableArray.h b/src/VariableArray.h index 6675d4867..8e768aaa8 100644 --- a/src/VariableArray.h +++ b/src/VariableArray.h @@ -1,7 +1,8 @@ /** * @file VariableArray.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the VariableArray class. diff --git a/src/VariableBase.cpp b/src/VariableBase.cpp index a557c267f..4fc8cc0ab 100644 --- a/src/VariableBase.cpp +++ b/src/VariableBase.cpp @@ -1,7 +1,8 @@ /** * @file VariableBase.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the Variable class. diff --git a/src/VariableBase.h b/src/VariableBase.h index 83b1c007e..35c413acd 100644 --- a/src/VariableBase.h +++ b/src/VariableBase.h @@ -1,7 +1,8 @@ /** * @file VariableBase.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the Variable class. diff --git a/src/WatchDogs/WatchDogAVR.cpp b/src/WatchDogs/WatchDogAVR.cpp index 6144bbf9a..b3614b88f 100644 --- a/src/WatchDogs/WatchDogAVR.cpp +++ b/src/WatchDogs/WatchDogAVR.cpp @@ -1,7 +1,8 @@ /** * @file WatchDogAVR.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the extendedWatchDogAVR class. diff --git a/src/WatchDogs/WatchDogAVR.h b/src/WatchDogs/WatchDogAVR.h index b816eaf57..30b48454f 100644 --- a/src/WatchDogs/WatchDogAVR.h +++ b/src/WatchDogs/WatchDogAVR.h @@ -1,7 +1,8 @@ /** * @file WatchDogAVR.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the extendedWatchDogAVR class diff --git a/src/WatchDogs/WatchDogSAMD.cpp b/src/WatchDogs/WatchDogSAMD.cpp index 3e680b7cc..0a78677a2 100644 --- a/src/WatchDogs/WatchDogSAMD.cpp +++ b/src/WatchDogs/WatchDogSAMD.cpp @@ -1,7 +1,8 @@ /** * @file WatchDogSAMD.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the extendedWatchDogSAMD class diff --git a/src/WatchDogs/WatchDogSAMD.h b/src/WatchDogs/WatchDogSAMD.h index c11eada2c..9b3fe1681 100644 --- a/src/WatchDogs/WatchDogSAMD.h +++ b/src/WatchDogs/WatchDogSAMD.h @@ -1,7 +1,8 @@ /** * @file WatchDogSAMD.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the extendedWatchDogSAMD class. diff --git a/src/dataPublisherBase.cpp b/src/dataPublisherBase.cpp index 1f4ab0a51..b58645bc8 100644 --- a/src/dataPublisherBase.cpp +++ b/src/dataPublisherBase.cpp @@ -1,7 +1,8 @@ /** * @file dataPublisherBase.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the dataPublisher class. diff --git a/src/dataPublisherBase.h b/src/dataPublisherBase.h index bedaa1cf7..3ff0b4237 100644 --- a/src/dataPublisherBase.h +++ b/src/dataPublisherBase.h @@ -1,7 +1,8 @@ /** * @file dataPublisherBase.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the dataPublisher class - a virtual class used by other diff --git a/src/modems/DigiXBee.cpp b/src/modems/DigiXBee.cpp index f179a04ad..4030367f3 100644 --- a/src/modems/DigiXBee.cpp +++ b/src/modems/DigiXBee.cpp @@ -1,7 +1,8 @@ /** * @file DigiXBee.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the DigiXBee class. diff --git a/src/modems/DigiXBee.h b/src/modems/DigiXBee.h index bc72bfc0a..52e522d7a 100644 --- a/src/modems/DigiXBee.h +++ b/src/modems/DigiXBee.h @@ -1,7 +1,8 @@ /** * @file DigiXBee.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the DigiXBee modem subclass of loggerModem, which itself is a diff --git a/src/modems/DigiXBee3GBypass.cpp b/src/modems/DigiXBee3GBypass.cpp index 6b494aaa6..9b5906056 100644 --- a/src/modems/DigiXBee3GBypass.cpp +++ b/src/modems/DigiXBee3GBypass.cpp @@ -1,7 +1,8 @@ /** * @file DigiXBee3GBypass.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the DigiXBee3GBypass class. diff --git a/src/modems/DigiXBee3GBypass.h b/src/modems/DigiXBee3GBypass.h index 0e793952d..c9767e34b 100644 --- a/src/modems/DigiXBee3GBypass.h +++ b/src/modems/DigiXBee3GBypass.h @@ -1,7 +1,8 @@ /** * @file DigiXBee3GBypass.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the DigiXBee3GBypass subclass of the DigiXBee class for Digi diff --git a/src/modems/DigiXBeeCellularTransparent.cpp b/src/modems/DigiXBeeCellularTransparent.cpp index 5705f8e4e..02eed366e 100644 --- a/src/modems/DigiXBeeCellularTransparent.cpp +++ b/src/modems/DigiXBeeCellularTransparent.cpp @@ -1,7 +1,8 @@ /** * @file DigiXBeeCellularTransparent.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * @author Greg Cutrell * diff --git a/src/modems/DigiXBeeCellularTransparent.h b/src/modems/DigiXBeeCellularTransparent.h index 26ef52fc7..602e2f3a3 100644 --- a/src/modems/DigiXBeeCellularTransparent.h +++ b/src/modems/DigiXBeeCellularTransparent.h @@ -1,7 +1,8 @@ /** * @file DigiXBeeCellularTransparent.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * @author Greg Cutrell * diff --git a/src/modems/DigiXBeeLTEBypass.cpp b/src/modems/DigiXBeeLTEBypass.cpp index 4873c1f4a..3b32264a9 100644 --- a/src/modems/DigiXBeeLTEBypass.cpp +++ b/src/modems/DigiXBeeLTEBypass.cpp @@ -1,7 +1,8 @@ /** * @file DigiXBeeLTEBypass.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the DigiXBeeLTEBypass class. diff --git a/src/modems/DigiXBeeLTEBypass.h b/src/modems/DigiXBeeLTEBypass.h index bd6d2853f..0f473dce7 100644 --- a/src/modems/DigiXBeeLTEBypass.h +++ b/src/modems/DigiXBeeLTEBypass.h @@ -1,7 +1,8 @@ /** * @file DigiXBeeLTEBypass.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the DigiXBeeLTEBypass subclass of the DigiXBee class for Digi diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index fbfe56aed..07ae21630 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -1,7 +1,8 @@ /** * @file DigiXBeeWifi.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the DigiXBeeWifi class. diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index 21355ec90..1c4923286 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -1,7 +1,8 @@ /** * @file DigiXBeeWifi.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the DigiXBeeWifi subclass of the DigiXBee class for Digi S6B diff --git a/src/modems/EspressifESP32.h b/src/modems/EspressifESP32.h index 7cbe0468a..d136fec5e 100644 --- a/src/modems/EspressifESP32.h +++ b/src/modems/EspressifESP32.h @@ -1,7 +1,8 @@ /** * @file EspressifESP32.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the EspressifESP32 subclass of loggerModem which is merely a diff --git a/src/modems/EspressifESP8266.cpp b/src/modems/EspressifESP8266.cpp index d4a2bdb1e..d0d6e6ee1 100644 --- a/src/modems/EspressifESP8266.cpp +++ b/src/modems/EspressifESP8266.cpp @@ -1,7 +1,8 @@ /** * @file EspressifESP8266.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the EspressifESP8266 class. diff --git a/src/modems/EspressifESP8266.h b/src/modems/EspressifESP8266.h index 71ce94792..0a2641101 100644 --- a/src/modems/EspressifESP8266.h +++ b/src/modems/EspressifESP8266.h @@ -1,7 +1,8 @@ /** * @file EspressifESP8266.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the EspressifESP8266 subclass of loggerModem which _SHOULD_ diff --git a/src/modems/LoggerModemMacros.h b/src/modems/LoggerModemMacros.h index 8fa3a4be4..9b36d60f0 100644 --- a/src/modems/LoggerModemMacros.h +++ b/src/modems/LoggerModemMacros.h @@ -1,7 +1,8 @@ /** * @file LoggerModemMacros.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains PRE-ROCESSOR MACROS for use with logger modems. diff --git a/src/modems/QuectelBG96.cpp b/src/modems/QuectelBG96.cpp index 8b8a39e96..ca1530654 100644 --- a/src/modems/QuectelBG96.cpp +++ b/src/modems/QuectelBG96.cpp @@ -1,7 +1,8 @@ /** * @file QuectelBG96.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the QuectelBG96 class. diff --git a/src/modems/QuectelBG96.h b/src/modems/QuectelBG96.h index 00fca3d6b..94185ecd4 100644 --- a/src/modems/QuectelBG96.h +++ b/src/modems/QuectelBG96.h @@ -1,7 +1,8 @@ /** * @file QuectelBG96.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the QuectelBG96 subclass of loggerModem for Dragino, diff --git a/src/modems/SIMComSIM7000.cpp b/src/modems/SIMComSIM7000.cpp index dc3f90d06..026fcb93c 100644 --- a/src/modems/SIMComSIM7000.cpp +++ b/src/modems/SIMComSIM7000.cpp @@ -1,7 +1,8 @@ /** * @file SIMComSIM7000.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SIMComSIM7000 class. diff --git a/src/modems/SIMComSIM7000.h b/src/modems/SIMComSIM7000.h index 6ff7511c4..ad23daa76 100644 --- a/src/modems/SIMComSIM7000.h +++ b/src/modems/SIMComSIM7000.h @@ -1,7 +1,8 @@ /** * @file SIMComSIM7000.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SIMComSIM7000 subclass of loggerModem for diff --git a/src/modems/SIMComSIM7080.cpp b/src/modems/SIMComSIM7080.cpp index 1c6874c36..834712154 100644 --- a/src/modems/SIMComSIM7080.cpp +++ b/src/modems/SIMComSIM7080.cpp @@ -1,7 +1,8 @@ /** * @file SIMComSIM7080.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SIMComSIM7080 class. diff --git a/src/modems/SIMComSIM7080.h b/src/modems/SIMComSIM7080.h index 26a1d643d..ef0f10e2e 100644 --- a/src/modems/SIMComSIM7080.h +++ b/src/modems/SIMComSIM7080.h @@ -1,7 +1,8 @@ /** * @file SIMComSIM7080.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SIMComSIM7080 subclass of loggerModem for diff --git a/src/modems/SIMComSIM800.cpp b/src/modems/SIMComSIM800.cpp index f3211390f..94d0ee942 100644 --- a/src/modems/SIMComSIM800.cpp +++ b/src/modems/SIMComSIM800.cpp @@ -1,7 +1,8 @@ /** * @file SIMComSIM800.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SIMComSIM800 class. diff --git a/src/modems/SIMComSIM800.h b/src/modems/SIMComSIM800.h index 751fc853c..51ebeb421 100644 --- a/src/modems/SIMComSIM800.h +++ b/src/modems/SIMComSIM800.h @@ -1,7 +1,8 @@ /** * @file SIMComSIM800.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SIMComSIM800 subclass of loggerModem for Adafruit Fona diff --git a/src/modems/SequansMonarch.cpp b/src/modems/SequansMonarch.cpp index 01e82f87b..4ea31e30b 100644 --- a/src/modems/SequansMonarch.cpp +++ b/src/modems/SequansMonarch.cpp @@ -1,7 +1,8 @@ /** * @file SequansMonarch.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SequansMonarch class. diff --git a/src/modems/SequansMonarch.h b/src/modems/SequansMonarch.h index 5a08de4e8..a1262ef90 100644 --- a/src/modems/SequansMonarch.h +++ b/src/modems/SequansMonarch.h @@ -1,7 +1,8 @@ /** * @file SequansMonarch.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SequansMonarch subclass of loggerModem for Nimbelink or diff --git a/src/modems/Sodaq2GBeeR6.cpp b/src/modems/Sodaq2GBeeR6.cpp index 204e3ec38..8d75f67a0 100644 --- a/src/modems/Sodaq2GBeeR6.cpp +++ b/src/modems/Sodaq2GBeeR6.cpp @@ -1,7 +1,8 @@ /** * @file Sodaq2GBeeR6.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the Sodaq2GBeeR6 class. diff --git a/src/modems/Sodaq2GBeeR6.h b/src/modems/Sodaq2GBeeR6.h index 013385ace..07302642b 100644 --- a/src/modems/Sodaq2GBeeR6.h +++ b/src/modems/Sodaq2GBeeR6.h @@ -1,7 +1,8 @@ /** * @file Sodaq2GBeeR6.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the Sodaq2GBeeR6 subclass of the SIMComSIM800 class and is diff --git a/src/modems/SodaqUBeeR410M.cpp b/src/modems/SodaqUBeeR410M.cpp index b7a4090ea..76f419aec 100644 --- a/src/modems/SodaqUBeeR410M.cpp +++ b/src/modems/SodaqUBeeR410M.cpp @@ -1,7 +1,8 @@ /** * @file SodaqUBeeR410M.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SodaqUBeeR410M class. diff --git a/src/modems/SodaqUBeeR410M.h b/src/modems/SodaqUBeeR410M.h index 8d2d3af71..103b52747 100644 --- a/src/modems/SodaqUBeeR410M.h +++ b/src/modems/SodaqUBeeR410M.h @@ -1,7 +1,8 @@ /** * @file SodaqUBeeR410M.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SodaqUBeeR410M subclass of loggerModem for the Sodaq UBee diff --git a/src/modems/SodaqUBeeU201.cpp b/src/modems/SodaqUBeeU201.cpp index 543f19168..6e7b33e58 100644 --- a/src/modems/SodaqUBeeU201.cpp +++ b/src/modems/SodaqUBeeU201.cpp @@ -1,7 +1,8 @@ /** * @file SodaqUBeeU201.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SodaqUBeeU201 class. diff --git a/src/modems/SodaqUBeeU201.h b/src/modems/SodaqUBeeU201.h index 666a83f00..e71e7eb85 100644 --- a/src/modems/SodaqUBeeU201.h +++ b/src/modems/SodaqUBeeU201.h @@ -1,7 +1,8 @@ /** * @file SodaqUBeeU201.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SodaqUBeeU201 subclass of loggerModem for the Sodaq UBee diff --git a/src/publishers/DreamHostPublisher.cpp b/src/publishers/DreamHostPublisher.cpp index 74412523e..40ffad715 100644 --- a/src/publishers/DreamHostPublisher.cpp +++ b/src/publishers/DreamHostPublisher.cpp @@ -1,7 +1,8 @@ /** * @file DreamHostPublisher.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the DreamHostPublisher class. diff --git a/src/publishers/DreamHostPublisher.h b/src/publishers/DreamHostPublisher.h index 64a465be6..ba88e4d11 100644 --- a/src/publishers/DreamHostPublisher.h +++ b/src/publishers/DreamHostPublisher.h @@ -1,7 +1,8 @@ /** * @file DreamHostPublisher.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the DreamHostPublisher subclass of dataPublisher for diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index ec65e0f48..7afc0dbe7 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -1,7 +1,8 @@ /** * @file EnviroDIYPublisher.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the EnviroDIYPublisher class. diff --git a/src/publishers/EnviroDIYPublisher.h b/src/publishers/EnviroDIYPublisher.h index 742681dc6..025ece3df 100644 --- a/src/publishers/EnviroDIYPublisher.h +++ b/src/publishers/EnviroDIYPublisher.h @@ -1,7 +1,8 @@ /** * @file EnviroDIYPublisher.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the EnviroDIYPublisher subclass of dataPublisher for diff --git a/src/publishers/ThingSpeakPublisher.cpp b/src/publishers/ThingSpeakPublisher.cpp index b3c9fb706..f13780260 100644 --- a/src/publishers/ThingSpeakPublisher.cpp +++ b/src/publishers/ThingSpeakPublisher.cpp @@ -1,7 +1,8 @@ /** * @file ThingSpeakPublisher.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the ThingSpeakPublisher class. diff --git a/src/publishers/ThingSpeakPublisher.h b/src/publishers/ThingSpeakPublisher.h index b0dec9cf1..1a924b500 100644 --- a/src/publishers/ThingSpeakPublisher.h +++ b/src/publishers/ThingSpeakPublisher.h @@ -1,7 +1,8 @@ /** * @file ThingSpeakPublisher.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the ThingSpeakPublisher subclass of dataPublisher for diff --git a/src/publishers/UbidotsPublisher.cpp b/src/publishers/UbidotsPublisher.cpp index 5477345a4..4a111d631 100644 --- a/src/publishers/UbidotsPublisher.cpp +++ b/src/publishers/UbidotsPublisher.cpp @@ -1,7 +1,8 @@ /** * @file UbidotsPublisher.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Greg Cutrell * @author Sara Geleskie Damiano * diff --git a/src/publishers/UbidotsPublisher.h b/src/publishers/UbidotsPublisher.h index 6f4a7f328..c8926eb2e 100644 --- a/src/publishers/UbidotsPublisher.h +++ b/src/publishers/UbidotsPublisher.h @@ -1,7 +1,8 @@ /** * @file UbidotsPublisher.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Greg Cutrell * @author Sara Geleskie Damiano * diff --git a/src/sensors/AOSongAM2315.cpp b/src/sensors/AOSongAM2315.cpp index bf801c334..7735dd11b 100644 --- a/src/sensors/AOSongAM2315.cpp +++ b/src/sensors/AOSongAM2315.cpp @@ -1,7 +1,8 @@ /** * @file AOSongAM2315.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the AOSongAM2315 class. diff --git a/src/sensors/AOSongAM2315.h b/src/sensors/AOSongAM2315.h index 33ff73ca5..2788b5842 100644 --- a/src/sensors/AOSongAM2315.h +++ b/src/sensors/AOSongAM2315.h @@ -1,7 +1,8 @@ /** * @file AOSongAM2315.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the AOSongAM2315 sensor subclass and the variable subclasses diff --git a/src/sensors/AOSongDHT.cpp b/src/sensors/AOSongDHT.cpp index f00dc0557..8475feb3f 100644 --- a/src/sensors/AOSongDHT.cpp +++ b/src/sensors/AOSongDHT.cpp @@ -1,7 +1,8 @@ /** * @file AOSongDHT.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the AOSongDHT class. diff --git a/src/sensors/AOSongDHT.h b/src/sensors/AOSongDHT.h index eb206e3cf..45e99f55e 100644 --- a/src/sensors/AOSongDHT.h +++ b/src/sensors/AOSongDHT.h @@ -1,7 +1,8 @@ /** * @file AOSongDHT.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the AOSongDHT sensor subclass and the variable subclasses diff --git a/src/sensors/AnalogElecConductivity.cpp b/src/sensors/AnalogElecConductivity.cpp index 560558080..deed2dee1 100644 --- a/src/sensors/AnalogElecConductivity.cpp +++ b/src/sensors/AnalogElecConductivity.cpp @@ -1,6 +1,6 @@ /** * @file AnalogElecConductivity.cpp - * @copyright 2017-2022 Stroud Water Research Center + * @copyright 2017-2024 Stroud Water Research Center * Part of the EnviroDIY ModularSensors library * @copyright 2020 Neil Hancock * diff --git a/src/sensors/AnalogElecConductivity.h b/src/sensors/AnalogElecConductivity.h index d29d96672..9d1b263db 100644 --- a/src/sensors/AnalogElecConductivity.h +++ b/src/sensors/AnalogElecConductivity.h @@ -1,6 +1,6 @@ /** * @file AnalogElecConductivity.h - * @copyright 2017-2022 Stroud Water Research Center + * @copyright 2017-2024 Stroud Water Research Center * Part of the EnviroDIY ModularSensors library * @copyright 2020 Neil Hancock * @author Written By: Neil Hancock ; Edited by Sara diff --git a/src/sensors/ApogeeSQ212.cpp b/src/sensors/ApogeeSQ212.cpp index 9a0936712..ff5936b76 100644 --- a/src/sensors/ApogeeSQ212.cpp +++ b/src/sensors/ApogeeSQ212.cpp @@ -1,7 +1,8 @@ /** * @file ApogeeSQ212.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * Adapted from CampbellOBS3.cpp by Sara Geleskie Damiano diff --git a/src/sensors/ApogeeSQ212.h b/src/sensors/ApogeeSQ212.h index cad5dca4f..c2b4d3c24 100644 --- a/src/sensors/ApogeeSQ212.h +++ b/src/sensors/ApogeeSQ212.h @@ -1,7 +1,8 @@ /** * @file ApogeeSQ212.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * Adapted from CampbellOBS3.h by Sara Geleskie Damiano diff --git a/src/sensors/AtlasParent.cpp b/src/sensors/AtlasParent.cpp index 94496c2df..a055ebb5a 100644 --- a/src/sensors/AtlasParent.cpp +++ b/src/sensors/AtlasParent.cpp @@ -1,7 +1,8 @@ /** * @file AtlasParent.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasParent.h b/src/sensors/AtlasParent.h index 6e308b143..e872f3204 100644 --- a/src/sensors/AtlasParent.h +++ b/src/sensors/AtlasParent.h @@ -1,7 +1,8 @@ /** * @file AtlasParent.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificCO2.cpp b/src/sensors/AtlasScientificCO2.cpp index 8c17ebfc2..df2994d4e 100644 --- a/src/sensors/AtlasScientificCO2.cpp +++ b/src/sensors/AtlasScientificCO2.cpp @@ -1,7 +1,8 @@ /** * @file AtlasScientificCO2.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificCO2.h b/src/sensors/AtlasScientificCO2.h index 559fdce73..fdaa99cea 100644 --- a/src/sensors/AtlasScientificCO2.h +++ b/src/sensors/AtlasScientificCO2.h @@ -1,7 +1,8 @@ /** * @file AtlasScientificCO2.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificDO.cpp b/src/sensors/AtlasScientificDO.cpp index 5994be05b..5a46e246e 100644 --- a/src/sensors/AtlasScientificDO.cpp +++ b/src/sensors/AtlasScientificDO.cpp @@ -1,7 +1,8 @@ /** * @file AtlasScientificDO.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificDO.h b/src/sensors/AtlasScientificDO.h index 76f0ba693..3cafe86c9 100644 --- a/src/sensors/AtlasScientificDO.h +++ b/src/sensors/AtlasScientificDO.h @@ -1,7 +1,8 @@ /** * @file AtlasScientificDO.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificEC.cpp b/src/sensors/AtlasScientificEC.cpp index d91e087af..e35513a0f 100644 --- a/src/sensors/AtlasScientificEC.cpp +++ b/src/sensors/AtlasScientificEC.cpp @@ -1,7 +1,8 @@ /** * @file AtlasScientificEC.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificEC.h b/src/sensors/AtlasScientificEC.h index 746702b38..9908c810f 100644 --- a/src/sensors/AtlasScientificEC.h +++ b/src/sensors/AtlasScientificEC.h @@ -1,7 +1,8 @@ /** * @file AtlasScientificEC.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificORP.h b/src/sensors/AtlasScientificORP.h index 8219997c1..e722dfc38 100644 --- a/src/sensors/AtlasScientificORP.h +++ b/src/sensors/AtlasScientificORP.h @@ -1,7 +1,8 @@ /** * @file AtlasScientificORP.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificRTD.h b/src/sensors/AtlasScientificRTD.h index 2502e64d2..b9b20b066 100644 --- a/src/sensors/AtlasScientificRTD.h +++ b/src/sensors/AtlasScientificRTD.h @@ -1,7 +1,8 @@ /** * @file AtlasScientificRTD.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/AtlasScientificpH.h b/src/sensors/AtlasScientificpH.h index f2c7c2e97..c2d198445 100644 --- a/src/sensors/AtlasScientificpH.h +++ b/src/sensors/AtlasScientificpH.h @@ -1,7 +1,8 @@ /** * @file AtlasScientificpH.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Initial developement for Atlas Sensors was done by Adam Gold * Files were edited by Sara Damiano * diff --git a/src/sensors/BoschBME280.cpp b/src/sensors/BoschBME280.cpp index 13bfcac80..ac63bcf00 100644 --- a/src/sensors/BoschBME280.cpp +++ b/src/sensors/BoschBME280.cpp @@ -1,7 +1,8 @@ /** * @file BoschBME280.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the BoschBME280 class. diff --git a/src/sensors/BoschBME280.h b/src/sensors/BoschBME280.h index bd9b77e5d..6edd6ac26 100644 --- a/src/sensors/BoschBME280.h +++ b/src/sensors/BoschBME280.h @@ -1,7 +1,8 @@ /** * @file BoschBME280.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the BoschBME280 sensor subclass and the variable subclasses diff --git a/src/sensors/BoschBMP3xx.cpp b/src/sensors/BoschBMP3xx.cpp index e3797aadf..6a7bfdf3e 100644 --- a/src/sensors/BoschBMP3xx.cpp +++ b/src/sensors/BoschBMP3xx.cpp @@ -1,7 +1,8 @@ /** * @file BoschBMP3xx.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the BoschBMP3xx class. diff --git a/src/sensors/BoschBMP3xx.h b/src/sensors/BoschBMP3xx.h index d64e1d68c..9f7899d61 100644 --- a/src/sensors/BoschBMP3xx.h +++ b/src/sensors/BoschBMP3xx.h @@ -1,7 +1,8 @@ /** * @file BoschBMP3xx.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the BoschBMP3xx sensor subclass and the variable subclasses diff --git a/src/sensors/CampbellClariVUE10.h b/src/sensors/CampbellClariVUE10.h index 3f3f0ca8e..3b6012221 100644 --- a/src/sensors/CampbellClariVUE10.h +++ b/src/sensors/CampbellClariVUE10.h @@ -1,7 +1,8 @@ /** * @file CampbellClariVUE10.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the CampbellClariVUE10 sensor subclass and the variable diff --git a/src/sensors/CampbellOBS3.cpp b/src/sensors/CampbellOBS3.cpp index bd270d683..fc7ab97d7 100644 --- a/src/sensors/CampbellOBS3.cpp +++ b/src/sensors/CampbellOBS3.cpp @@ -1,7 +1,8 @@ /** * @file CampbellOBS3.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the CampbellOBS3 class. diff --git a/src/sensors/CampbellOBS3.h b/src/sensors/CampbellOBS3.h index 7b0a0a9f9..bfe92c782 100644 --- a/src/sensors/CampbellOBS3.h +++ b/src/sensors/CampbellOBS3.h @@ -1,7 +1,8 @@ /** * @file CampbellOBS3.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the CampbellOBS3 sensor subclass and the variable subclasses diff --git a/src/sensors/CampbellRainVUE10.h b/src/sensors/CampbellRainVUE10.h index 41f0c8b45..bbf8b938c 100644 --- a/src/sensors/CampbellRainVUE10.h +++ b/src/sensors/CampbellRainVUE10.h @@ -1,7 +1,8 @@ /** * @file CampbellRainVUE10.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the CampbellRainVUE10 sensor subclass and the variable diff --git a/src/sensors/Decagon5TM.cpp b/src/sensors/Decagon5TM.cpp index 9244afdc3..e5bfb046a 100644 --- a/src/sensors/Decagon5TM.cpp +++ b/src/sensors/Decagon5TM.cpp @@ -1,7 +1,8 @@ /** * @file Decagon5TM.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the Decagon5TM class. diff --git a/src/sensors/Decagon5TM.h b/src/sensors/Decagon5TM.h index a0f18c4bb..fcee6d289 100644 --- a/src/sensors/Decagon5TM.h +++ b/src/sensors/Decagon5TM.h @@ -1,7 +1,8 @@ /** * @file Decagon5TM.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the Decagon5TM subclass of the SDI12Sensors class along with diff --git a/src/sensors/DecagonCTD.h b/src/sensors/DecagonCTD.h index 9649a3f32..59efae7d3 100644 --- a/src/sensors/DecagonCTD.h +++ b/src/sensors/DecagonCTD.h @@ -1,7 +1,8 @@ /** * @file DecagonCTD.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the DecagonCTD subclass of the SDI12Sensors class along with diff --git a/src/sensors/DecagonES2.h b/src/sensors/DecagonES2.h index 11e55ba74..956847ebd 100644 --- a/src/sensors/DecagonES2.h +++ b/src/sensors/DecagonES2.h @@ -1,7 +1,8 @@ /** * @file DecagonES2.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the DecagonES2 subclass of the SDI12Sensors class along with diff --git a/src/sensors/EverlightALSPT19.cpp b/src/sensors/EverlightALSPT19.cpp index e34d25816..9f885f87f 100644 --- a/src/sensors/EverlightALSPT19.cpp +++ b/src/sensors/EverlightALSPT19.cpp @@ -1,7 +1,8 @@ /** * @file EverlightALSPT19.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the EverlightALSPT19 class. diff --git a/src/sensors/EverlightALSPT19.h b/src/sensors/EverlightALSPT19.h index 3518e879f..53508dd45 100644 --- a/src/sensors/EverlightALSPT19.h +++ b/src/sensors/EverlightALSPT19.h @@ -1,7 +1,8 @@ /** * @file EverlightALSPT19.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the EverlightALSPT19 sensor subclass and the variable diff --git a/src/sensors/ExternalVoltage.h b/src/sensors/ExternalVoltage.h index 3ad9e6672..308bbd0a2 100644 --- a/src/sensors/ExternalVoltage.h +++ b/src/sensors/ExternalVoltage.h @@ -1,7 +1,8 @@ /** * @file ExternalVoltage.h * - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * Adapted from CampbellOBS3.h by Sara Geleskie Damiano diff --git a/src/sensors/FreescaleMPL115A2.cpp b/src/sensors/FreescaleMPL115A2.cpp index a1b817d44..98367d49a 100644 --- a/src/sensors/FreescaleMPL115A2.cpp +++ b/src/sensors/FreescaleMPL115A2.cpp @@ -1,7 +1,8 @@ /** * @file FreescaleMPL115A2.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/FreescaleMPL115A2.h b/src/sensors/FreescaleMPL115A2.h index 8fb079dc1..1a27efdfc 100644 --- a/src/sensors/FreescaleMPL115A2.h +++ b/src/sensors/FreescaleMPL115A2.h @@ -1,7 +1,8 @@ /** * @file FreescaleMPL115A2.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/InSituRDO.h b/src/sensors/InSituRDO.h index 5c468ef33..09e43ba9e 100644 --- a/src/sensors/InSituRDO.h +++ b/src/sensors/InSituRDO.h @@ -1,7 +1,8 @@ /** * @file InSituRDO.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the InSituRDO sensor subclass and the variable subclasses diff --git a/src/sensors/InSituTrollSdi12a.h b/src/sensors/InSituTrollSdi12a.h index 442f60895..dc200c820 100644 --- a/src/sensors/InSituTrollSdi12a.h +++ b/src/sensors/InSituTrollSdi12a.h @@ -1,6 +1,6 @@ /* * @file InSituTrollSdi12a.h - * @copyright 2017-2022 Stroud Water Research Center + * @copyright 2017-2024 Stroud Water Research Center * Part of the EnviroDIY modular sensors * @author Neil Hancock https://github.com/neilh10/ModularSensors/ * @author Sara Geleskie Damiano diff --git a/src/sensors/KellerAcculevel.h b/src/sensors/KellerAcculevel.h index 7a60fbd1b..45e81a439 100644 --- a/src/sensors/KellerAcculevel.h +++ b/src/sensors/KellerAcculevel.h @@ -1,7 +1,8 @@ /** * @file KellerAcculevel.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/KellerNanolevel.h b/src/sensors/KellerNanolevel.h index e3449d7a7..bcffae086 100644 --- a/src/sensors/KellerNanolevel.h +++ b/src/sensors/KellerNanolevel.h @@ -1,7 +1,8 @@ /** * @file KellerNanolevel.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe and Neil * Hancock Edited by Sara Geleskie Damiano * diff --git a/src/sensors/KellerParent.cpp b/src/sensors/KellerParent.cpp index ff51a1e3e..b0cc878cf 100644 --- a/src/sensors/KellerParent.cpp +++ b/src/sensors/KellerParent.cpp @@ -1,7 +1,8 @@ /** * @file KellerParent.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/KellerParent.h b/src/sensors/KellerParent.h index 98e26e490..98e7c70b1 100644 --- a/src/sensors/KellerParent.h +++ b/src/sensors/KellerParent.h @@ -1,7 +1,8 @@ /** * @file KellerParent.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/MaxBotixSonar.cpp b/src/sensors/MaxBotixSonar.cpp index 001d1093d..84dfac7b8 100644 --- a/src/sensors/MaxBotixSonar.cpp +++ b/src/sensors/MaxBotixSonar.cpp @@ -1,7 +1,8 @@ /** * @file MaxBotixSonar.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the MaxBotixSonar class. diff --git a/src/sensors/MaxBotixSonar.h b/src/sensors/MaxBotixSonar.h index 676886f6f..8c0a43b06 100644 --- a/src/sensors/MaxBotixSonar.h +++ b/src/sensors/MaxBotixSonar.h @@ -1,7 +1,8 @@ /** * @file MaxBotixSonar.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the MaxBotixSonar sensor subclass and the MaxBotixSonar_Range diff --git a/src/sensors/MaximDS18.cpp b/src/sensors/MaximDS18.cpp index d1f6d010c..93946c6b4 100644 --- a/src/sensors/MaximDS18.cpp +++ b/src/sensors/MaximDS18.cpp @@ -1,7 +1,8 @@ /** * @file MaximDS18.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the MaximDS18 class. diff --git a/src/sensors/MaximDS18.h b/src/sensors/MaximDS18.h index d5de1c32d..09562d726 100644 --- a/src/sensors/MaximDS18.h +++ b/src/sensors/MaximDS18.h @@ -1,7 +1,8 @@ /** * @file MaximDS18.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the MaximDS18 sensor subclass and the MaximDS18_Temp variable diff --git a/src/sensors/MaximDS3231.cpp b/src/sensors/MaximDS3231.cpp index e5d601909..21431a0ff 100644 --- a/src/sensors/MaximDS3231.cpp +++ b/src/sensors/MaximDS3231.cpp @@ -1,7 +1,8 @@ /** * @file MaximDS3231.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the MaximDS18 class. diff --git a/src/sensors/MaximDS3231.h b/src/sensors/MaximDS3231.h index 9be37f0fc..42f0f9b98 100644 --- a/src/sensors/MaximDS3231.h +++ b/src/sensors/MaximDS3231.h @@ -1,7 +1,8 @@ /** * @file MaximDS3231.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the MaximDS3231 sensor subclass and the MaximDS3231_Temp diff --git a/src/sensors/MeaSpecMS5803.cpp b/src/sensors/MeaSpecMS5803.cpp index 7569ba6a1..0e2a9ca84 100644 --- a/src/sensors/MeaSpecMS5803.cpp +++ b/src/sensors/MeaSpecMS5803.cpp @@ -1,7 +1,8 @@ /** * @file MeaSpecMS5803.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe with help from Beth * Fisher, Evan Host and Bobby Schulz. * Edited by Sara Geleskie Damiano diff --git a/src/sensors/MeaSpecMS5803.h b/src/sensors/MeaSpecMS5803.h index e16650782..f8c764685 100644 --- a/src/sensors/MeaSpecMS5803.h +++ b/src/sensors/MeaSpecMS5803.h @@ -1,7 +1,8 @@ /** * @file MeaSpecMS5803.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe with help from Beth * Fisher, Evan Host and Bobby Schulz. * Heavliy edited by Sara Geleskie Damiano diff --git a/src/sensors/MeterHydros21.h b/src/sensors/MeterHydros21.h index e948c4751..f66b8f926 100644 --- a/src/sensors/MeterHydros21.h +++ b/src/sensors/MeterHydros21.h @@ -1,7 +1,8 @@ /** * @file MeterHydros21.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the MeterHydros21 subclass of the SDI12Sensors class along diff --git a/src/sensors/MeterTeros11.cpp b/src/sensors/MeterTeros11.cpp index bf8dab12c..d6e4b4e15 100644 --- a/src/sensors/MeterTeros11.cpp +++ b/src/sensors/MeterTeros11.cpp @@ -1,7 +1,8 @@ /** * @file MeterTeros11.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/MeterTeros11.h b/src/sensors/MeterTeros11.h index d75b7b777..6f8b92361 100644 --- a/src/sensors/MeterTeros11.h +++ b/src/sensors/MeterTeros11.h @@ -1,7 +1,8 @@ /** * @file MeterTeros11.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/PaleoTerraRedox.h b/src/sensors/PaleoTerraRedox.h index 64a4c8ce1..6419bf0cc 100644 --- a/src/sensors/PaleoTerraRedox.h +++ b/src/sensors/PaleoTerraRedox.h @@ -1,7 +1,8 @@ /** * @file PaleoTerraRedox.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe with help from Beth * Fisher, Evan Host and Bobby Schulz. * Heavliy edited by Sara Geleskie Damiano diff --git a/src/sensors/ProcessorStats.cpp b/src/sensors/ProcessorStats.cpp index 3dd860646..791ee60a4 100644 --- a/src/sensors/ProcessorStats.cpp +++ b/src/sensors/ProcessorStats.cpp @@ -1,7 +1,8 @@ /** * @file ProcessorStats.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the ProcessorStats class. diff --git a/src/sensors/ProcessorStats.h b/src/sensors/ProcessorStats.h index 29babfbd0..34b4d95ff 100644 --- a/src/sensors/ProcessorStats.h +++ b/src/sensors/ProcessorStats.h @@ -1,7 +1,8 @@ /** * @file ProcessorStats.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the ProcessorStats sensor subclass and the variable diff --git a/src/sensors/RainCounterI2C.cpp b/src/sensors/RainCounterI2C.cpp index a334a6895..b2777f1cf 100644 --- a/src/sensors/RainCounterI2C.cpp +++ b/src/sensors/RainCounterI2C.cpp @@ -1,7 +1,8 @@ /** * @file RainCounterI2C.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/RainCounterI2C.h b/src/sensors/RainCounterI2C.h index 80f617368..69034d88c 100644 --- a/src/sensors/RainCounterI2C.h +++ b/src/sensors/RainCounterI2C.h @@ -1,7 +1,8 @@ /** * @file RainCounterI2C.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/SDI12Sensors.cpp b/src/sensors/SDI12Sensors.cpp index 90665fce2..e7fb298be 100644 --- a/src/sensors/SDI12Sensors.cpp +++ b/src/sensors/SDI12Sensors.cpp @@ -1,7 +1,8 @@ /** * @file SDI12Sensors.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SDI12Sensors class. diff --git a/src/sensors/SDI12Sensors.h b/src/sensors/SDI12Sensors.h index 3b2016f2e..d779a8591 100644 --- a/src/sensors/SDI12Sensors.h +++ b/src/sensors/SDI12Sensors.h @@ -1,7 +1,8 @@ /** * @file SDI12Sensors.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SDI12Sensors sensor subclass, itself a parent class for diff --git a/src/sensors/SensirionSHT4x.cpp b/src/sensors/SensirionSHT4x.cpp index 62615e0c8..c63a042f6 100644 --- a/src/sensors/SensirionSHT4x.cpp +++ b/src/sensors/SensirionSHT4x.cpp @@ -1,7 +1,8 @@ /** * @file SensirionSHT4x.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the SensirionSHT4x class. diff --git a/src/sensors/SensirionSHT4x.h b/src/sensors/SensirionSHT4x.h index d240b8708..39e0e1e60 100644 --- a/src/sensors/SensirionSHT4x.h +++ b/src/sensors/SensirionSHT4x.h @@ -1,7 +1,8 @@ /** * @file SensirionSHT4x.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the SensirionSHT4x sensor subclass and the variable diff --git a/src/sensors/TIADS1x15.cpp b/src/sensors/TIADS1x15.cpp index bd9119d47..edb2b5d77 100644 --- a/src/sensors/TIADS1x15.cpp +++ b/src/sensors/TIADS1x15.cpp @@ -1,7 +1,8 @@ /** * @file TIADS1x15.cpp * - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * Adapted from CampbellOBS3.h by Sara Geleskie Damiano diff --git a/src/sensors/TIADS1x15.h b/src/sensors/TIADS1x15.h index 7e4803802..cc13be6f7 100644 --- a/src/sensors/TIADS1x15.h +++ b/src/sensors/TIADS1x15.h @@ -1,7 +1,8 @@ /** * @file TIADS1x15.h * - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * Adapted from CampbellOBS3.h by Sara Geleskie Damiano diff --git a/src/sensors/TIINA219.cpp b/src/sensors/TIINA219.cpp index 3042ecb65..d1a82b212 100644 --- a/src/sensors/TIINA219.cpp +++ b/src/sensors/TIINA219.cpp @@ -1,7 +1,8 @@ /** * @file TIINA219.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Neil Hancock * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/TIINA219.h b/src/sensors/TIINA219.h index 8bb9189b4..0f0995030 100644 --- a/src/sensors/TIINA219.h +++ b/src/sensors/TIINA219.h @@ -1,7 +1,8 @@ /** * @file TIINA219.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Neil Hancock * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/TallyCounterI2C.cpp b/src/sensors/TallyCounterI2C.cpp index 79ccd9571..47df771fc 100644 --- a/src/sensors/TallyCounterI2C.cpp +++ b/src/sensors/TallyCounterI2C.cpp @@ -1,7 +1,8 @@ /** * @file TallyCounterI2C.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/TallyCounterI2C.h b/src/sensors/TallyCounterI2C.h index 79dbb1fc5..a42fd13f9 100644 --- a/src/sensors/TallyCounterI2C.h +++ b/src/sensors/TallyCounterI2C.h @@ -1,7 +1,8 @@ /** * @file TallyCounterI2C.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/TurnerCyclops.cpp b/src/sensors/TurnerCyclops.cpp index ee5864267..0f74fc0e9 100644 --- a/src/sensors/TurnerCyclops.cpp +++ b/src/sensors/TurnerCyclops.cpp @@ -1,7 +1,8 @@ /** * @file TurnerCyclops.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the TurnerCyclops class. diff --git a/src/sensors/TurnerCyclops.h b/src/sensors/TurnerCyclops.h index 1db566b9a..753e61433 100644 --- a/src/sensors/TurnerCyclops.h +++ b/src/sensors/TurnerCyclops.h @@ -1,7 +1,8 @@ /** * @file TurnerCyclops.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the TurnerCyclops sensor subclass and the variable subclasses diff --git a/src/sensors/YosemitechParent.cpp b/src/sensors/YosemitechParent.cpp index 6100c833e..eebe0e6b4 100644 --- a/src/sensors/YosemitechParent.cpp +++ b/src/sensors/YosemitechParent.cpp @@ -1,7 +1,8 @@ /** * @file YosemitechParent.cpp - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Implements the YosemitechParent class. diff --git a/src/sensors/YosemitechParent.h b/src/sensors/YosemitechParent.h index b3fa4bcbe..b034177b1 100644 --- a/src/sensors/YosemitechParent.h +++ b/src/sensors/YosemitechParent.h @@ -1,7 +1,8 @@ /** * @file YosemitechParent.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechParent sensor subclass, itself a parent class diff --git a/src/sensors/YosemitechY4000.h b/src/sensors/YosemitechY4000.h index 70a7ca487..400d61ddc 100644 --- a/src/sensors/YosemitechY4000.h +++ b/src/sensors/YosemitechY4000.h @@ -1,7 +1,8 @@ /** * @file YosemitechY4000.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Written By: Anthony Aufdenkampe * Edited by Sara Geleskie Damiano * diff --git a/src/sensors/YosemitechY504.h b/src/sensors/YosemitechY504.h index db28088d3..2f5ff2019 100644 --- a/src/sensors/YosemitechY504.h +++ b/src/sensors/YosemitechY504.h @@ -1,7 +1,8 @@ /** * @file YosemitechY504.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY504 sensor subclass and the variable diff --git a/src/sensors/YosemitechY510.h b/src/sensors/YosemitechY510.h index 85b832375..c726f67d3 100644 --- a/src/sensors/YosemitechY510.h +++ b/src/sensors/YosemitechY510.h @@ -1,7 +1,8 @@ /** * @file YosemitechY510.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY510 sensor subclass and the variable diff --git a/src/sensors/YosemitechY511.h b/src/sensors/YosemitechY511.h index 63947ea45..e49ee49ae 100644 --- a/src/sensors/YosemitechY511.h +++ b/src/sensors/YosemitechY511.h @@ -1,7 +1,8 @@ /** * @file YosemitechY511.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY511 sensor subclass and the variable diff --git a/src/sensors/YosemitechY514.h b/src/sensors/YosemitechY514.h index 60158bb22..138f44cea 100644 --- a/src/sensors/YosemitechY514.h +++ b/src/sensors/YosemitechY514.h @@ -1,7 +1,8 @@ /** * @file YosemitechY514.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY514 sensor subclass and the variable diff --git a/src/sensors/YosemitechY520.h b/src/sensors/YosemitechY520.h index 9f673fee2..755db66e6 100644 --- a/src/sensors/YosemitechY520.h +++ b/src/sensors/YosemitechY520.h @@ -1,7 +1,8 @@ /** * @file YosemitechY520.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY520 sensor subclass and the variable diff --git a/src/sensors/YosemitechY532.h b/src/sensors/YosemitechY532.h index 8ce218470..3ca91bdec 100644 --- a/src/sensors/YosemitechY532.h +++ b/src/sensors/YosemitechY532.h @@ -1,7 +1,8 @@ /** * @file YosemitechY532.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY532 sensor subclass and the variable diff --git a/src/sensors/YosemitechY533.h b/src/sensors/YosemitechY533.h index a5c170bfe..8e5e81627 100644 --- a/src/sensors/YosemitechY533.h +++ b/src/sensors/YosemitechY533.h @@ -1,7 +1,8 @@ /** * @file YosemitechY533.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY533 sensor subclass and the variable diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index 7227f61b7..8cc2fbb13 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -1,7 +1,8 @@ /** * @file YosemitechY551.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY551 sensor subclass and the variable diff --git a/src/sensors/YosemitechY560.h b/src/sensors/YosemitechY560.h index 6d8d44795..31bb9227c 100644 --- a/src/sensors/YosemitechY560.h +++ b/src/sensors/YosemitechY560.h @@ -1,7 +1,8 @@ /** * @file YosemitechY560.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the YosemitechY560 sensor subclass and the variable diff --git a/src/sensors/YosemitechY700.h b/src/sensors/YosemitechY700.h index 83cde2428..f4923a472 100644 --- a/src/sensors/YosemitechY700.h +++ b/src/sensors/YosemitechY700.h @@ -1,7 +1,8 @@ /** * @file YosemitechY700.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe * * @brief Contains the YosemitechY700 sensor subclass and the variable diff --git a/src/sensors/ZebraTechDOpto.h b/src/sensors/ZebraTechDOpto.h index 92e618d23..26c4780d1 100644 --- a/src/sensors/ZebraTechDOpto.h +++ b/src/sensors/ZebraTechDOpto.h @@ -1,7 +1,8 @@ /** * @file ZebraTechDOpto.h - * @copyright 2017-2022 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * * @brief Contains the ZebraTechDOpto sensor subclass and the variable From 3fc1f68802fb635c0e95c4224b43c3b0ff4752f9 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 27 Mar 2024 17:44:46 -0400 Subject: [PATCH 55/89] preliminary implementation of VegaPuls Signed-off-by: Sara Damiano --- src/sensors/VegaPuls21.h | 530 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 530 insertions(+) create mode 100644 src/sensors/VegaPuls21.h diff --git a/src/sensors/VegaPuls21.h b/src/sensors/VegaPuls21.h new file mode 100644 index 000000000..d0e1a18ac --- /dev/null +++ b/src/sensors/VegaPuls21.h @@ -0,0 +1,530 @@ +/** + * @file VegaPuls21.h + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. + * @author Sara Geleskie Damiano + * + * @brief Contains the VegaPuls21 sensor subclass and the variable + * subclasses VegaPuls21_Stage, VegaPuls21_Distance, VegaPuls21_Reliability, and + * VegaPuls21_ErrorCode. + * + * These are for the VEGAPULS C 21 digital SDI-12 radar level sensor. + * + * This depends on the SDI12Sensors parent class. + */ +/* clang-format off */ +/** + * @defgroup sensor_vegapuls VEGAPULS C 21 + * Classes for the [VEGAPULS C 21](https://www.vega.com/en-us/products/product-catalog/level/radar/vegapuls-c-21) radar sensor. + * + * @ingroup sdi12_group + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_vegapuls21_intro Introduction + * + * > VEGAPULS C 21 is the ideal sensor for non-contact level measurement in simple applications + * > where a high degree of protection is required. It is particularly suitable for use in water treatment, + * > pumping stations and rain overflow basins, for flow measurement in open channels and level monitoring. + * > In bulk solids the sensors are used in small bulk solids silos or open containers. + * + * The sensor is implemented as a sub-classes of the SDI12Sensors class. + * It requires a 8 to 30 Vdc power supply, which can be turned off between measurements. + * It pulls 25 mW in low-power mode and 100 mW in standard mode. + * + * @section sensor_vegapuls21_datasheet Sensor Datasheet + * The specifications and datasheet are available at https://www.vega.com/api/sitecore/DocumentDownload/Handler?documentContainerId=1006748&languageId=2&fileExtension=pdf&softwareVersion=&documentGroupId=58354&version=03-04-2023 + * + * @section sensor_vegapuls21_flags Build flags + * @see @ref sdi12_group_flags + * + * @section sensor_vegapuls21_ctor Sensor Constructor + * {{ @ref VegaPuls21::VegaPuls21 }} + * + * ___ + * @section sensor_vegapuls21_examples Example Code + * The VEGAPULS C 21 is used in the @menulink{vega_puls_21} example. + * + * @menusnip{vega_puls_21} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_VEGAPULS21_H_ +#define SRC_SENSORS_VEGAPULS21_H_ + +// Included Dependencies +#include "sensors/SDI12Sensors.h" + +/** @ingroup sensor_vegapuls */ +/**@{*/ + +// Sensor Specific Defines +/// @brief Sensor::_numReturnedValues; the VEGA PULS 21 can report 5 values +#define VEGAPULS21_NUM_VARIABLES 5 +/// @brief Sensor::_incCalcValues; +#define VEGAPULS21_INC_CALC_VARIABLES 0 + +/** + * @anchor sensor_vegapuls21_timing + * @name Sensor Timing + * The sensor timing for a VEGAPULS C 21 + */ +/**@{*/ +/** @brief Sensor::_warmUpTime_ms; the VEGA PULS 21 warms up in ~4400ms. + * + * This is longer than the expected 250ms for a SDI-12 sensor, but I couldn't + * get a response from the sensor faster than that. The instruction sheet says + * the warm-up is less than 10s. + */ +#define VEGAPULS21_WARM_UP_TIME_MS 4500 +/// @brief Sensor::_stabilizationTime_ms; the VEGA PULS 21 is stable as soon as +/// it warms up (0ms stabilization). +#define VEGAPULS21_STABILIZATION_TIME_MS 0 +/** + * @brief Sensor::_measurementTime_ms; the VEGA PULS 21 takes ~6000ms to + * complete a measurement. + * + * Spec sheet says the measurement time is 250ms but when you ask the sensor it + * says it won't return for 14s. When taking a standard measurement I was + * getting a result after about 5800ms. + */ +#define VEGAPULS21_MEASUREMENT_TIME_MS 6000 +/// @brief Extra wake time required for an SDI-12 sensor between the "break" +/// and the time the command is sent. The VEGA PULS 21 requires no extra time. +#define VEGAPULS21_EXTRA_WAKE_TIME_MS 0 +/**@}*/ + +/** + * @anchor sensor_vegapuls21_stage + * @name Stage + * The stage variable from a VEGAPULS C 21 + * - Accuracy is ≤ 2 mm (meas. distance > 0.25 m/0.8202 ft) + * + * {{ @ref VegaPuls21_Stage::VegaPuls21_Stage }} + */ +/**@{*/ +/// @brief Decimals places in string representation; stage in meters should have +/// 3 - resolution is 1mm. +#define VEGAPULS21_STAGE_RESOLUTION 3 +/// @brief Sensor variable number; stage is stored in sensorValues[0]. +#define VEGAPULS21_STAGE_VAR_NUM 0 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "gageHeight" +#define VEGAPULS21_STAGE_VAR_NAME "gageHeight" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "meter" (m) +#define VEGAPULS21_STAGE_UNIT_NAME "meter" +/// @brief Default variable short code; "VegaPulsStage" +#define VEGAPULS21_STAGE_DEFAULT_CODE "VegaPulsStage" +/**@}*/ + +/** + * @anchor sensor_vegapuls21_distance + * @name Distance + * The distance variable from a VEGAPULS C 21 + * - Accuracy is ≤ 2 mm (meas. distance > 0.25 m/0.8202 ft) + * + * {{ @ref VegaPuls21_Distance::VegaPuls21_Distance }} + */ +/**@{*/ +/// @brief Decimals places in string representation; distance in meters should +/// have 3 - resolution is 1mm. +#define VEGAPULS21_DISTANCE_RESOLUTION 3 +/// @brief Sensor variable number; stage is stored in sensorValues[1]. +#define VEGAPULS21_DISTANCE_VAR_NUM 1 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "distance" +#define VEGAPULS21_DISTANCE_VAR_NAME "distance" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "meter" (m) +#define VEGAPULS21_DISTANCE_UNIT_NAME "meter" +/// @brief Default variable short code; "VegaPulsDistance" +#define VEGAPULS21_DISTANCE_DEFAULT_CODE "VegaPulsDistance" +/**@}*/ + +/** + * @anchor sensor_vegapuls_temp + * @name Temperature + * The temperature variable from a VEGAPULS C 21 + * + * {{ @ref VegaPuls21_Temp::VegaPuls21_Temp }} + */ +/**@{*/ +/// @brief Decimals places in string representation; temperature should have 1 - +/// resolution is 0.1°C. +#define VEGAPULS21_TEMP_RESOLUTION 1 +/// @brief Sensor variable number; temperature is stored in sensorValues[2]. +#define VEGAPULS21_TEMP_VAR_NUM 2 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "temperature" +#define VEGAPULS21_TEMP_VAR_NAME "temperature" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "degreeCelsius" (°C) +#define VEGAPULS21_TEMP_UNIT_NAME "degreeCelsius" +/// @brief Default variable short code; "VegaPulsTemp" +#define VEGAPULS21_TEMP_DEFAULT_CODE "VegaPulsTemp" +/**@}*/ + +/** + * @anchor sensor_vegapuls21_reliability + * @name Reliability + * The reliability variable from a VEGAPULS C 21 + * + * {{ @ref VegaPuls21_Reliability::VegaPuls21_Reliability }} + */ +/**@{*/ +/// @brief Decimals places in string representation; reliability should have 1 +/// (resolution is 0.1 dB). +#define VEGAPULS21_RELIABILITY_RESOLUTION 1 +/// @brief Sensor variable number; reliability is stored in sensorValues[3] +#define VEGAPULS21_RELIABILITY_VAR_NUM 3 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "reliability" +#define VEGAPULS21_RELIABILITY_VAR_NAME "reliability" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "decibel" (dB) +#define VEGAPULS21_RELIABILITY_UNIT_NAME "decibel" +/// @brief Default variable short code; "VegaPulsReliability" +#define VEGAPULS21_RELIABILITY_DEFAULT_CODE "VegaPulsReliability" +/**@}*/ + +/** + * @anchor sensor_vegapuls21_error + * @name Error Code + * The error code variable from a VEGAPULS C 21 + * - Significance of error code values is unknown. + * + * {{ @ref VegaPuls21_ErrorCode::VegaPuls21_ErrorCode }} + */ +/**@{*/ +/// @brief Decimals places in string representation; the error code has 0. +#define VEGAPULS21_ERRORCODE_RESOLUTION 0 +/// @brief Sensor variable number; error code is stored in sensorValues[4] +#define VEGAPULS21_ERRORCODE_VAR_NUM 4 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "instrumentStatusCode" +#define VEGAPULS21_ERRORCODE_VAR_NAME "instrumentStatusCode" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "dimensionless" +#define VEGAPULS21_ERRORCODE_UNIT_NAME "dimensionless" +/// @brief Default variable short code; "VegaPulsError" +#define VEGAPULS21_ERRORCODE_DEFAULT_CODE "VegaPulsError" +/**@}*/ + + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the + * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * + * @ingroup sensor_vegapuls + */ +/* clang-format on */ +class VegaPuls21 : public SDI12Sensors { + public: + // Constructors with overloads + /** + * @brief Construct a new VEGAPULS C 21 object. + * + * The SDI-12 address of the sensor, the Arduino pin controlling power + * on/off, and the Arduino pin sending and receiving data are required + * for the sensor constructor. Optionally, you can include a number of + * distinct readings to average. The data pin must be a pin that + * supports pin-change interrupts. + * + * @param SDI12address The SDI-12 address of the VEGA PULS 21; can be a + * char, char*, or int. + * @param powerPin The pin on the mcu controlling power to the + * VEGA PULS 21 Use -1 if it is continuously powered. + * - The VEGA PULS 21 requires a 8 to 30 Vdc power supply, which can be + * turned off between measurements + * @param dataPin The pin on the mcu connected to the data line of the + * SDI-12 circuit. + * @param measurementsToAverage The number of measurements to take and + * average before giving a "final" result from the sensor; optional with + * a default value of 1. + */ + VegaPuls21(char SDI12address, int8_t powerPin, int8_t dataPin, + uint8_t measurementsToAverage = 1) + : SDI12Sensors( + SDI12address, powerPin, dataPin, measurementsToAverage, + "VEGAPULS C 21", VEGAPULS21_NUM_VARIABLES, + VEGAPULS21_WARM_UP_TIME_MS, VEGAPULS21_STABILIZATION_TIME_MS, + VEGAPULS21_MEASUREMENT_TIME_MS, VEGAPULS21_EXTRA_WAKE_TIME_MS, + VEGAPULS21_INC_CALC_VARIABLES) {} + /** + * @copydoc VegaPuls21::VegaPuls21 + */ + VegaPuls21(char* SDI12address, int8_t powerPin, int8_t dataPin, + uint8_t measurementsToAverage = 1) + : SDI12Sensors( + SDI12address, powerPin, dataPin, measurementsToAverage, + "VEGAPULS C 21", VEGAPULS21_NUM_VARIABLES, + VEGAPULS21_WARM_UP_TIME_MS, VEGAPULS21_STABILIZATION_TIME_MS, + VEGAPULS21_MEASUREMENT_TIME_MS, VEGAPULS21_EXTRA_WAKE_TIME_MS, + VEGAPULS21_INC_CALC_VARIABLES) {} + /** + * @copydoc VegaPuls21::VegaPuls21 + */ + VegaPuls21(int SDI12address, int8_t powerPin, int8_t dataPin, + uint8_t measurementsToAverage = 1) + : SDI12Sensors( + SDI12address, powerPin, dataPin, measurementsToAverage, + "VEGAPULS C 21", VEGAPULS21_NUM_VARIABLES, + VEGAPULS21_WARM_UP_TIME_MS, VEGAPULS21_STABILIZATION_TIME_MS, + VEGAPULS21_MEASUREMENT_TIME_MS, VEGAPULS21_EXTRA_WAKE_TIME_MS, + VEGAPULS21_INC_CALC_VARIABLES) {} + + /** + * @brief Destroy the VEGAPULS C 21 object + */ + ~VegaPuls21() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature output](@ref sensor_vegapuls21_stage) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * + * @ingroup sensor_vegapuls + */ +/* clang-format on */ +class VegaPuls21_Stage : public Variable { + public: + /** + * @brief Construct a new VegaPuls21_Stage object. + * + * @param parentSense The parent VegaPuls21 providing the result + * values. + * @param uuid A universally unique identifier (UUID or GUID) for the + * variable; optional with the default value of an empty string. + * @param varCode A short code to help identify the variable in files; + * optional with a default value of "VegaPulsStage". + */ + explicit VegaPuls21_Stage( + VegaPuls21* parentSense, const char* uuid = "", + const char* varCode = VEGAPULS21_STAGE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)VEGAPULS21_STAGE_VAR_NUM, + (uint8_t)VEGAPULS21_STAGE_RESOLUTION, + VEGAPULS21_STAGE_VAR_NAME, VEGAPULS21_STAGE_UNIT_NAME, + varCode, uuid) {} + /** + * @brief Construct a new VegaPuls21_Stage object. + * + * @note This must be tied with a parent VegaPuls21 before it can be + * used. + */ + VegaPuls21_Stage() + : Variable((const uint8_t)VEGAPULS21_STAGE_VAR_NUM, + (uint8_t)VEGAPULS21_STAGE_RESOLUTION, + VEGAPULS21_STAGE_VAR_NAME, VEGAPULS21_STAGE_UNIT_NAME, + VEGAPULS21_STAGE_DEFAULT_CODE) {} + /** + * @brief Destroy the VegaPuls21_Stage object - no action needed. + */ + ~VegaPuls21_Stage() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature output](@ref sensor_vegapuls21_distance) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * + * @ingroup sensor_vegapuls + */ +/* clang-format on */ +class VegaPuls21_Distance : public Variable { + public: + /** + * @brief Construct a new VegaPuls21_Distance object. + * + * @param parentSense The parent VegaPuls21 providing the result + * values. + * @param uuid A universally unique identifier (UUID or GUID) for the + * variable; optional with the default value of an empty string. + * @param varCode A short code to help identify the variable in files; + * optional with a default value of "VegaPulsDistance". + */ + explicit VegaPuls21_Distance( + VegaPuls21* parentSense, const char* uuid = "", + const char* varCode = VEGAPULS21_DISTANCE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)VEGAPULS21_DISTANCE_VAR_NUM, + (uint8_t)VEGAPULS21_DISTANCE_RESOLUTION, + VEGAPULS21_DISTANCE_VAR_NAME, VEGAPULS21_DISTANCE_UNIT_NAME, + varCode, uuid) {} + /** + * @brief Construct a new VegaPuls21_Distance object. + * + * @note This must be tied with a parent VegaPuls21 before it can be + * used. + */ + VegaPuls21_Distance() + : Variable((const uint8_t)VEGAPULS21_DISTANCE_VAR_NUM, + (uint8_t)VEGAPULS21_DISTANCE_RESOLUTION, + VEGAPULS21_DISTANCE_VAR_NAME, VEGAPULS21_DISTANCE_UNIT_NAME, + VEGAPULS21_DISTANCE_DEFAULT_CODE) {} + /** + * @brief Destroy the VegaPuls21_Distance object - no action needed. + */ + ~VegaPuls21_Distance() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature output](@ref sensor_vegapuls_temp) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * + * @ingroup sensor_vegapuls + */ +/* clang-format on */ +class VegaPuls21_Temp : public Variable { + public: + /** + * @brief Construct a new VegaPuls21_Temp object. + * + * @param parentSense The parent VegaPuls21 providing the result + * values. + * @param uuid A universally unique identifier (UUID or GUID) for the + * variable; optional with the default value of an empty string. + * @param varCode A short code to help identify the variable in files; + * optional with a default value of "VegaPulsTemp". + */ + explicit VegaPuls21_Temp(VegaPuls21* parentSense, const char* uuid = "", + const char* varCode = VEGAPULS21_TEMP_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)VEGAPULS21_TEMP_VAR_NUM, + (uint8_t)VEGAPULS21_TEMP_RESOLUTION, + VEGAPULS21_TEMP_VAR_NAME, VEGAPULS21_TEMP_UNIT_NAME, varCode, + uuid) {} + /** + * @brief Construct a new VegaPuls21_Temp object. + * + * @note This must be tied with a parent VegaPuls21 before it can be + * used. + */ + VegaPuls21_Temp() + : Variable((const uint8_t)VEGAPULS21_TEMP_VAR_NUM, + (uint8_t)VEGAPULS21_TEMP_RESOLUTION, + VEGAPULS21_TEMP_VAR_NAME, VEGAPULS21_TEMP_UNIT_NAME, + VEGAPULS21_TEMP_DEFAULT_CODE) {} + /** + * @brief Destroy the VegaPuls21_Temp object - no action needed. + */ + ~VegaPuls21_Temp() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [reliability output](@ref sensor_vegapuls21_reliability) + * from a [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * + * @ingroup sensor_vegapuls + */ +/* clang-format on */ +class VegaPuls21_Reliability : public Variable { + public: + /** + * @brief Construct a new VegaPuls21_Reliability object. + * + * @param parentSense The parent VegaPuls21 providing the result + * values. + * @param uuid A universally unique identifier (UUID or GUID) for the + * variable; optional with the default value of an empty string. + * @param varCode A short code to help identify the variable in files; + * optional with a default value of "VegaPulsReliability". + */ + explicit VegaPuls21_Reliability( + VegaPuls21* parentSense, const char* uuid = "", + const char* varCode = VEGAPULS21_RELIABILITY_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)VEGAPULS21_RELIABILITY_VAR_NUM, + (uint8_t)VEGAPULS21_RELIABILITY_RESOLUTION, + VEGAPULS21_RELIABILITY_VAR_NAME, + VEGAPULS21_RELIABILITY_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new VegaPuls21_Reliability object. + * + * @note This must be tied with a parent VegaPuls21 before it can be + * used. + */ + VegaPuls21_Reliability() + : Variable((const uint8_t)VEGAPULS21_RELIABILITY_VAR_NUM, + (uint8_t)VEGAPULS21_RELIABILITY_RESOLUTION, + VEGAPULS21_RELIABILITY_VAR_NAME, + VEGAPULS21_RELIABILITY_UNIT_NAME, + VEGAPULS21_RELIABILITY_DEFAULT_CODE) {} + /** + * @brief Destroy the VegaPuls21_Reliability object - no action + * needed. + */ + ~VegaPuls21_Reliability() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [error code output](@ref sensor_vegapuls21_error) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * + * @ingroup sensor_vegapuls + */ +/* clang-format on */ +class VegaPuls21_ErrorCode : public Variable { + public: + /** + * @brief Construct a new VegaPuls21_ErrorCode object. + * + * @param parentSense The parent VegaPuls21 providing the result + * values. + * @param uuid A universally unique identifier (UUID or GUID) for the + * variable; optional with the default value of an empty string. + * @param varCode A short code to help identify the variable in files; + * optional with a default value of "VegaPulsError". + */ + explicit VegaPuls21_ErrorCode( + VegaPuls21* parentSense, const char* uuid = "", + const char* varCode = VEGAPULS21_ERRORCODE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)VEGAPULS21_ERRORCODE_VAR_NUM, + (uint8_t)VEGAPULS21_ERRORCODE_RESOLUTION, + VEGAPULS21_ERRORCODE_VAR_NAME, + VEGAPULS21_ERRORCODE_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new VegaPuls21_ErrorCode object. + * + * @note This must be tied with a parent VegaPuls21 before it can be + * used. + */ + VegaPuls21_ErrorCode() + : Variable((const uint8_t)VEGAPULS21_ERRORCODE_VAR_NUM, + (uint8_t)VEGAPULS21_ERRORCODE_RESOLUTION, + VEGAPULS21_ERRORCODE_VAR_NAME, + VEGAPULS21_ERRORCODE_UNIT_NAME, + VEGAPULS21_ERRORCODE_DEFAULT_CODE) {} + /** + * @brief Destroy the VegaPuls21_ErrorCode object - no action + * needed. + */ + ~VegaPuls21_ErrorCode() {} +}; +/**@}*/ +#endif // SRC_SENSORS_VEGAPULS21_H_ From 45180528ce4fee75ac46be4cee3ce0f42cdf763e Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 28 Mar 2024 15:29:18 -0400 Subject: [PATCH 56/89] Add docs and adjust doxygen tags Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/ReadMe.md | 10 +++ examples/menu_a_la_carte/menu_a_la_carte.ino | 47 ++++++++++++-- src/sensors/VegaPuls21.h | 64 ++++++++++---------- 3 files changed, 85 insertions(+), 36 deletions(-) diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index ded077ec1..89b97f61d 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -97,6 +97,7 @@ ___ - [TI INA219 High Side Current Sensor ](#ti-ina219-high-side-current-sensor-) - [Turner Cyclops-7F Submersible Fluorometer ](#turner-cyclops-7f-submersible-fluorometer-) - [Analog Electrical Conductivity using the Processor's Analog Pins ](#analog-electrical-conductivity-using-the-processors-analog-pins-) + - [VEGA VEGA PULS 21 ](#vega-vega-puls-21-) - [Yosemitech RS485/Modbus Environmental Sensors ](#yosemitech-rs485modbus-environmental-sensors-) - [Yosemitech Y504 Dissolved Oxygen Sensor ](#yosemitech-y504-dissolved-oxygen-sensor-) - [Yosemitech Y510 Turbidity Sensor ](#yosemitech-y510-turbidity-sensor-) @@ -1086,6 +1087,15 @@ For best results, you should also connect the AREF pin of your processors ADC to ___ +#### VEGA VEGA PULS 21 + +@see @ref sensor_vega_puls21 + +[//]: # ( @menusnip{vega_puls21} ) + +___ + + ### Yosemitech RS485/Modbus Environmental Sensors The next several sections are for Yosemitech brand sensors. diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 836c5cd92..ef800b18d 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -3,11 +3,10 @@ * @brief Example with all possible functionality. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. * - * Build Environment: Visual Studios Code with PlatformIO + * Build Environment: Visual Studio Code with PlatformIO * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger * * DISCLAIMER: @@ -2003,6 +2002,39 @@ Variable* analogEc_spcond = new Variable( #endif +#if defined BUILD_SENSOR_VEGA_PULS21 +// ========================================================================== +// VEGA PULS 21 Radar Sensor +// ========================================================================== +/** Start [vega_puls21] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const char* VegaPulsSDI12address = "0"; // The SDI-12 Address of the VegaPuls10 +const int8_t VegaPulsPower = sensorPowerPin; // Power pin +const int8_t VegaPulsData = 7; // The SDI-12 data pin +// NOTE: you should NOT take more than one readings. THe sensor already takes +// and averages 8 by default. + +// Create a Campbell VegaPusl21 sensor object +VegaPuls21 VegaPuls(*VegaPulsSDI12address, VegaPulsPower, VegaPulsData); + +// Create stage, distance, temperature, reliability, and error variable pointers +// for the VegaPuls21 +Variable* VegaPulsStage = + new VegaPuls21_Stage(&VegaPuls, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* VegaPulsDistance = + new VegaPuls21_Distance(&VegaPuls, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* VegaPulsTemp = + new VegaPuls21_Temp(&VegaPuls, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* VegaPulsRelia = new VegaPuls21_Reliability( + &VegaPuls, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* VegaPulsError = + new VegaPuls21_ErrorCode(&VegaPuls, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [vega_puls21] */ +#endif + + #if defined BUILD_SENSOR_YOSEMITECH_Y504 // ========================================================================== // Yosemitech Y504 Dissolved Oxygen Sensor @@ -2720,6 +2752,13 @@ Variable* variableList[] = { analogEc_cond, analogEc_spcond, #endif +#if defined BUILD_SENSOR_VEGA_PULS21 + VegaPulsStage, + VegaPulsDistance, + VegaPulsTemp, + VegaPulsRelia, + VegaPulsError, +#endif #if defined BUILD_SENSOR_YOSEMITECH_Y504 y504DOpct, y504DOmgL, diff --git a/src/sensors/VegaPuls21.h b/src/sensors/VegaPuls21.h index d0e1a18ac..285560c37 100644 --- a/src/sensors/VegaPuls21.h +++ b/src/sensors/VegaPuls21.h @@ -15,7 +15,7 @@ */ /* clang-format off */ /** - * @defgroup sensor_vegapuls VEGAPULS C 21 + * @defgroup sensor_vega_puls21 VEGAPULS C 21 * Classes for the [VEGAPULS C 21](https://www.vega.com/en-us/products/product-catalog/level/radar/vegapuls-c-21) radar sensor. * * @ingroup sdi12_group @@ -23,7 +23,7 @@ * @tableofcontents * @m_footernavigation * - * @section sensor_vegapuls21_intro Introduction + * @section sensor_vega_puls21_intro Introduction * * > VEGAPULS C 21 is the ideal sensor for non-contact level measurement in simple applications * > where a high degree of protection is required. It is particularly suitable for use in water treatment, @@ -34,20 +34,20 @@ * It requires a 8 to 30 Vdc power supply, which can be turned off between measurements. * It pulls 25 mW in low-power mode and 100 mW in standard mode. * - * @section sensor_vegapuls21_datasheet Sensor Datasheet + * @section sensor_vega_puls21_datasheet Sensor Datasheet * The specifications and datasheet are available at https://www.vega.com/api/sitecore/DocumentDownload/Handler?documentContainerId=1006748&languageId=2&fileExtension=pdf&softwareVersion=&documentGroupId=58354&version=03-04-2023 * - * @section sensor_vegapuls21_flags Build flags + * @section sensor_vega_puls21_flags Build flags * @see @ref sdi12_group_flags * - * @section sensor_vegapuls21_ctor Sensor Constructor + * @section sensor_vega_puls21_ctor Sensor Constructor * {{ @ref VegaPuls21::VegaPuls21 }} * * ___ - * @section sensor_vegapuls21_examples Example Code - * The VEGAPULS C 21 is used in the @menulink{vega_puls_21} example. + * @section sensor_vega_puls21_examples Example Code + * The VEGAPULS C 21 is used in the @menulink{vega_puls21} example. * - * @menusnip{vega_puls_21} + * @menusnip{vega_puls21} */ /* clang-format on */ @@ -58,7 +58,7 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -/** @ingroup sensor_vegapuls */ +/** @ingroup sensor_vega_puls21 */ /**@{*/ // Sensor Specific Defines @@ -68,7 +68,7 @@ #define VEGAPULS21_INC_CALC_VARIABLES 0 /** - * @anchor sensor_vegapuls21_timing + * @anchor sensor_vega_puls21_timing * @name Sensor Timing * The sensor timing for a VEGAPULS C 21 */ @@ -98,7 +98,7 @@ /**@}*/ /** - * @anchor sensor_vegapuls21_stage + * @anchor sensor_vega_puls21_stage * @name Stage * The stage variable from a VEGAPULS C 21 * - Accuracy is ≤ 2 mm (meas. distance > 0.25 m/0.8202 ft) @@ -124,7 +124,7 @@ /**@}*/ /** - * @anchor sensor_vegapuls21_distance + * @anchor sensor_vega_puls21_distance * @name Distance * The distance variable from a VEGAPULS C 21 * - Accuracy is ≤ 2 mm (meas. distance > 0.25 m/0.8202 ft) @@ -150,7 +150,7 @@ /**@}*/ /** - * @anchor sensor_vegapuls_temp + * @anchor sensor_vega_puls21_temp * @name Temperature * The temperature variable from a VEGAPULS C 21 * @@ -175,7 +175,7 @@ /**@}*/ /** - * @anchor sensor_vegapuls21_reliability + * @anchor sensor_vega_puls21_reliability * @name Reliability * The reliability variable from a VEGAPULS C 21 * @@ -200,7 +200,7 @@ /**@}*/ /** - * @anchor sensor_vegapuls21_error + * @anchor sensor_vega_puls21_error * @name Error Code * The error code variable from a VEGAPULS C 21 * - Significance of error code values is unknown. @@ -228,9 +228,9 @@ /* clang-format off */ /** * @brief The Sensor sub-class for the - * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * [VEGAPULS C 21 radar level sensor](@ref sensor_vega_puls21). * - * @ingroup sensor_vegapuls + * @ingroup sensor_vega_puls21 */ /* clang-format on */ class VegaPuls21 : public SDI12Sensors { @@ -298,10 +298,10 @@ class VegaPuls21 : public SDI12Sensors { /* clang-format off */ /** * @brief The Variable sub-class used for the - * [temperature output](@ref sensor_vegapuls21_stage) from a - * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * [temperature output](@ref sensor_vega_puls21_stage) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vega_puls21). * - * @ingroup sensor_vegapuls + * @ingroup sensor_vega_puls21 */ /* clang-format on */ class VegaPuls21_Stage : public Variable { @@ -344,10 +344,10 @@ class VegaPuls21_Stage : public Variable { /* clang-format off */ /** * @brief The Variable sub-class used for the - * [temperature output](@ref sensor_vegapuls21_distance) from a - * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * [temperature output](@ref sensor_vega_puls21_distance) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vega_puls21). * - * @ingroup sensor_vegapuls + * @ingroup sensor_vega_puls21 */ /* clang-format on */ class VegaPuls21_Distance : public Variable { @@ -390,10 +390,10 @@ class VegaPuls21_Distance : public Variable { /* clang-format off */ /** * @brief The Variable sub-class used for the - * [temperature output](@ref sensor_vegapuls_temp) from a - * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * [temperature output](@ref sensor_vega_puls21_temp) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vega_puls21). * - * @ingroup sensor_vegapuls + * @ingroup sensor_vega_puls21 */ /* clang-format on */ class VegaPuls21_Temp : public Variable { @@ -435,10 +435,10 @@ class VegaPuls21_Temp : public Variable { /* clang-format off */ /** * @brief The Variable sub-class used for the - * [reliability output](@ref sensor_vegapuls21_reliability) - * from a [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * [reliability output](@ref sensor_vega_puls21_reliability) + * from a [VEGAPULS C 21 radar level sensor](@ref sensor_vega_puls21). * - * @ingroup sensor_vegapuls + * @ingroup sensor_vega_puls21 */ /* clang-format on */ class VegaPuls21_Reliability : public Variable { @@ -483,10 +483,10 @@ class VegaPuls21_Reliability : public Variable { /* clang-format off */ /** * @brief The Variable sub-class used for the - * [error code output](@ref sensor_vegapuls21_error) from a - * [VEGAPULS C 21 radar level sensor](@ref sensor_vegapuls). + * [error code output](@ref sensor_vega_puls21_error) from a + * [VEGAPULS C 21 radar level sensor](@ref sensor_vega_puls21). * - * @ingroup sensor_vegapuls + * @ingroup sensor_vega_puls21 */ /* clang-format on */ class VegaPuls21_ErrorCode : public Variable { From 186db9735f62777113dda4d32b2eae9befcd9a3f Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 3 Apr 2024 11:25:28 -0400 Subject: [PATCH 57/89] Update python regex Signed-off-by: Sara Damiano --- continuous_integration/check_component_inclusion.py | 2 +- docs/copyFunctions.py | 4 ++-- docs/markdown_prefilter.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/continuous_integration/check_component_inclusion.py b/continuous_integration/check_component_inclusion.py index 9e8080cc9..485926cf5 100644 --- a/continuous_integration/check_component_inclusion.py +++ b/continuous_integration/check_component_inclusion.py @@ -65,7 +65,7 @@ def camel_to_snake(name, lower_case=True): #%% # make sure class names match file names -class_pattern = re.compile("^\s*class[\s\n]+(\w+)[\s\n]", re.MULTILINE) +class_pattern = re.compile(r"^\s*class[\s\n]+(\w+)[\s\n]", re.MULTILINE) for header_file in header_files: textfile = open(header_file, mode="r", encoding="utf-8") diff --git a/docs/copyFunctions.py b/docs/copyFunctions.py index 802179121..3e0c64f56 100644 --- a/docs/copyFunctions.py +++ b/docs/copyFunctions.py @@ -68,13 +68,13 @@ def get_section_to_paste(match: re.Match) -> str: i += 1 new_line = line match = re.search( - '\{\{ Date: Wed, 3 Apr 2024 11:26:15 -0400 Subject: [PATCH 58/89] Update VegaPuls timing Signed-off-by: Sara Damiano --- .gitignore | 1 + src/sensors/VegaPuls21.h | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f668ae57c..016e2171b 100644 --- a/.gitignore +++ b/.gitignore @@ -109,3 +109,4 @@ continuous_integration_artifacts/* arduino_cli.log **/sensor_tests/* docs/Doxyfile.bak +continuous_integration/output_check_component_inclusion.log diff --git a/src/sensors/VegaPuls21.h b/src/sensors/VegaPuls21.h index 285560c37..815739b1b 100644 --- a/src/sensors/VegaPuls21.h +++ b/src/sensors/VegaPuls21.h @@ -73,13 +73,14 @@ * The sensor timing for a VEGAPULS C 21 */ /**@{*/ -/** @brief Sensor::_warmUpTime_ms; the VEGA PULS 21 warms up in ~4400ms. +/** @brief Sensor::_warmUpTime_ms; the VEGA PULS 21 warms up in ~5200ms. * * This is longer than the expected 250ms for a SDI-12 sensor, but I couldn't * get a response from the sensor faster than that. The instruction sheet says - * the warm-up is less than 10s. + * the warm-up is less than 10s, but also says that the initial tests on + * power-up can take up to 3 minutes. */ -#define VEGAPULS21_WARM_UP_TIME_MS 4500 +#define VEGAPULS21_WARM_UP_TIME_MS 5200 /// @brief Sensor::_stabilizationTime_ms; the VEGA PULS 21 is stable as soon as /// it warms up (0ms stabilization). #define VEGAPULS21_STABILIZATION_TIME_MS 0 @@ -89,9 +90,9 @@ * * Spec sheet says the measurement time is 250ms but when you ask the sensor it * says it won't return for 14s. When taking a standard measurement I was - * getting a result after about 5800ms. + * getting a result after about 5800-6000 ms. */ -#define VEGAPULS21_MEASUREMENT_TIME_MS 6000 +#define VEGAPULS21_MEASUREMENT_TIME_MS 6050 /// @brief Extra wake time required for an SDI-12 sensor between the "break" /// and the time the command is sent. The VEGA PULS 21 requires no extra time. #define VEGAPULS21_EXTRA_WAKE_TIME_MS 0 From 19a46739f6fa13b6bda99a2b251730a631e0ab71 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 3 Apr 2024 12:17:04 -0400 Subject: [PATCH 59/89] Fix documented param name Signed-off-by: Sara Damiano --- src/dataPublisherBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dataPublisherBase.h b/src/dataPublisherBase.h index bedaa1cf7..e370dcd50 100644 --- a/src/dataPublisherBase.h +++ b/src/dataPublisherBase.h @@ -257,7 +257,7 @@ class dataPublisher { * @brief Initialize the TX buffer to be empty and start writing to the * given client. * - * @param client The client to transmit to. + * @param outClient The client to transmit to. */ static void txBufferInit(Client* outClient); /** From cef39216452def373a2efa93b8df1680bfe776bc Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 3 Apr 2024 14:33:30 -0400 Subject: [PATCH 60/89] Wait for ESP to connect on saved credentials Signed-off-by: Sara Damiano --- src/modems/EspressifESP8266.cpp | 2 +- src/modems/EspressifESP8266.h | 6 ++++++ src/modems/LoggerModemMacros.h | 17 +++++++++++++++-- src/publishers/EnviroDIYPublisher.cpp | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/modems/EspressifESP8266.cpp b/src/modems/EspressifESP8266.cpp index d4a2bdb1e..e65391b95 100644 --- a/src/modems/EspressifESP8266.cpp +++ b/src/modems/EspressifESP8266.cpp @@ -38,7 +38,7 @@ EspressifESP8266::~EspressifESP8266() {} MS_IS_MODEM_AWAKE(EspressifESP8266); MS_MODEM_WAKE(EspressifESP8266); -MS_MODEM_CONNECT_INTERNET(EspressifESP8266); +MS_MODEM_CONNECT_INTERNET(EspressifESP8266, ESP8266_RECONNECT_TIME_MS); MS_MODEM_DISCONNECT_INTERNET(EspressifESP8266); MS_MODEM_IS_INTERNET_AVAILABLE(EspressifESP8266); diff --git a/src/modems/EspressifESP8266.h b/src/modems/EspressifESP8266.h index 71ce94792..5fcc3ab6d 100644 --- a/src/modems/EspressifESP8266.h +++ b/src/modems/EspressifESP8266.h @@ -173,6 +173,12 @@ */ #define ESP8266_DISCONNECT_TIME_MS 500 +/** + * @brief The amount of time in ms it takes the ESP8266 to reconnect using saved + * credentials. + */ +#define ESP8266_RECONNECT_TIME_MS 2500 + // Included Dependencies #include "ModSensorDebugger.h" #undef MS_DEBUGGING_STD diff --git a/src/modems/LoggerModemMacros.h b/src/modems/LoggerModemMacros.h index 8fa3a4be4..c4193386e 100644 --- a/src/modems/LoggerModemMacros.h +++ b/src/modems/LoggerModemMacros.h @@ -358,12 +358,16 @@ * wait for network registration, then provide the access point name, and then * establish a GPRS/EPS connection. * + * @note WiFi modems can frequently reconnect with saved credentials instead of + * sending new credentials each time. This function waits for an automatic + * connection to be made, if possible. + * * @param specificModem The modem subclass * * @return The text of a connectInternet(uint32_t maxConnectionTime) function * specific to a single modem subclass. */ -#define MS_MODEM_CONNECT_INTERNET(specificModem) \ +#define MS_MODEM_CONNECT_INTERNET(specificModem, auto_reconnect_time) \ bool specificModem::connectInternet(uint32_t maxConnectionTime) { \ bool success = true; \ \ @@ -387,9 +391,17 @@ MS_DBG(F("Modem was already awake and should be ready.")); \ } \ \ + /** Wait to see if a connection was made automatically from saved \ + * credentials */ \ if (success) { \ MS_START_DEBUG_TIMER \ - MS_DBG(F("\nAttempting to connect to WiFi network...")); \ + MS_DBG(F("\nWaiting"), auto_reconnect_time, \ + F("ms to see if WiFi connects without sending new " \ + "credentials...")); \ + if (!(gsmModem.isNetworkConnected())) { \ + gsmModem.waitForNetwork(auto_reconnect_time); \ + } \ + /** If still not connected, send new credentials */ \ if (!(gsmModem.isNetworkConnected())) { \ MS_DBG(F("Sending credentials...")); \ for (uint8_t i = 0; i < 5; i++) { \ @@ -405,6 +417,7 @@ MS_DBG(F("... WiFi connected after"), MS_PRINT_DEBUG_TIMER, \ F("milliseconds!")); \ } \ + \ if (!wasPowered) { \ MS_DBG(F("Modem was powered to connect to the internet! " \ "Remember to turn it off when you're done.")); \ diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index ec65e0f48..b5e962da3 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -115,7 +115,7 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { MS_DBG(F("Connecting client")); MS_START_DEBUG_TIMER; if (outClient->connect(enviroDIYHost, enviroDIYPort)) { - MS_DBG(F("Client connected after"), MS_PRINT_DEBUG_TIMER, F("ms\n")); + MS_DBG(F("Client connected after"), MS_PRINT_DEBUG_TIMER, F("ms")); txBufferInit(outClient); // copy the initial post header into the tx buffer From e601ab533f8f37547356667256afc74a434b0a33 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Tue, 16 Apr 2024 13:55:39 -0500 Subject: [PATCH 61/89] Fix debug for Keller @hodsonm-cws, this clears the compile error when you define `MS_KELLERPARENT_DEBUG_DEEP` in the platoformio.ini. --- src/sensors/KellerParent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sensors/KellerParent.cpp b/src/sensors/KellerParent.cpp index b0cc878cf..532db6927 100644 --- a/src/sensors/KellerParent.cpp +++ b/src/sensors/KellerParent.cpp @@ -63,7 +63,7 @@ bool KellerParent::setup(void) { if (_powerPin2 >= 0) pinMode(_powerPin2, OUTPUT); #ifdef MS_KELLERPARENT_DEBUG_DEEP - sensor.setDebugStream(&DEEP_DEBUGGING_SERIAL_OUTPUT); + _ksensor.setDebugStream(&DEEP_DEBUGGING_SERIAL_OUTPUT); #endif // This sensor begin is just setting more pin modes, etc, no sensor power From 077656db691262b279729015091e869f94b45cb2 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 9 May 2024 13:01:14 -0400 Subject: [PATCH 62/89] Update actions Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 8 ++++---- .github/workflows/build_examples.yaml | 8 ++++---- .github/workflows/prepare_release.yaml | 2 +- .github/workflows/verify_library_structure.yaml | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index 16b79a170..87b7be34b 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -39,7 +39,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' @@ -89,12 +89,12 @@ jobs: path: code_docs/ModularSensors - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' - name: Restore Python Dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache_python with: path: ~/.cache/pip @@ -107,7 +107,7 @@ jobs: - name: Restore Doxygen, Graphviz, and TeX Live id: cache_doxygen - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | /usr/lib/x86_64-linux-gnu/texlive diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml index 4c86d8be2..d0852c996 100644 --- a/.github/workflows/build_examples.yaml +++ b/.github/workflows/build_examples.yaml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' cache: 'pip' @@ -126,7 +126,7 @@ jobs: uses: arduino/setup-arduino-cli@v1.1.2 - name: Restore Arduino platforms and libraries - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache_libraries with: path: | @@ -188,7 +188,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' cache: 'pip' @@ -197,7 +197,7 @@ jobs: run: pip install -r continuous_integration/requirements.txt - name: Restore PlatformIO and Arduino platforms and libraries - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache_libraries with: path: | diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index ef54a2e54..299b2ebd9 100644 --- a/.github/workflows/prepare_release.yaml +++ b/.github/workflows/prepare_release.yaml @@ -30,7 +30,7 @@ jobs: echo "ZIP_NAME=$ZIP_FILE" >> $GITHUB_ENV - name: Set up python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' diff --git a/.github/workflows/verify_library_structure.yaml b/.github/workflows/verify_library_structure.yaml index 753fd2bd7..2d8aad016 100644 --- a/.github/workflows/verify_library_structure.yaml +++ b/.github/workflows/verify_library_structure.yaml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.x' From ba2c205d2dc00cbdb896ac14675460f4b6bd9fbe Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 9 May 2024 13:03:44 -0400 Subject: [PATCH 63/89] Update gropoint docs Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/ReadMe.md | 2 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 53 +++++++++++++++++--- extras/mega_serial_spy/mega_serial_spy.ino | 2 + src/sensors/GroPointGPLP8.h | 20 +++++++- src/sensors/ProcessorStats.cpp | 18 +++++-- 5 files changed, 81 insertions(+), 14 deletions(-) diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 89b97f61d..a67c77ae7 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -834,7 +834,7 @@ Because this sensor can have only one I2C address (0x60), it is only possible to ___ -### GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe +### GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe @see @ref sensor_gplp8 diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index ef800b18d..46fdb76f3 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -432,8 +432,7 @@ DigiXBeeWifi modem = modemXBWF; // ========================================================================== -#elif defined BUILD_MODEM_ESPRESSIF_ESP8266 || \ - defined BUILD_MODEM_ESPRESSIF_ESP32 +#elif defined BUILD_MODEM_ESPRESSIF_ESP8266 /** Start [espressif_esp8266] */ // For almost anything based on the Espressif ESP8266 using the // AT command firmware @@ -468,6 +467,41 @@ EspressifESP8266 modem = modemESP; // ========================================================================== +#elif defined BUILD_MODEM_ESPRESSIF_ESP32 +/** Start [espressif_esp32] */ +// For almost anything based on the Espressif ESP8266 using the +// AT command firmware +#include + +// NOTE: Extra hardware and software serial ports are created in the "Settings +// for Additional Serial Ports" section +const int32_t modemBaud = 57600; // Communication speed of the modem +// NOTE: This baud rate too fast for an 8MHz board, like the Mayfly! The +// module should be programmed to a slower baud rate or set to auto-baud using +// the AT+UART_CUR or AT+UART_DEF command. + +// Modem Pins - Describe the physical pin connection of your modem to your board +// NOTE: Use -1 for pins that do not apply +// Example pins here are for a EnviroDIY ESP32 Bluetooth/Wifi Bee with +// Mayfly 1.1 +const int8_t modemVccPin = 18; // MCU pin controlling modem power +const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin +const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem + // status + +// Network connection information +const char* wifiId = "xxxxx"; // WiFi access point name +const char* wifiPwd = "xxxxx"; // WiFi password (WPA2) + +// Create the modem object +EspressifESP32 modemESP(&modemSerial, modemVccPin, modemResetPin, wifiId, + wifiPwd); +// Create an extra reference to the modem by a generic name +EspressifESP32 modem = modemESP; +/** End [espressif_esp32] */ +// ========================================================================== + + #elif defined BUILD_MODEM_QUECTEL_BG96 /** Start [quectel_bg96] */ // For the Dragino, Nimbelink or other boards based on the Quectel BG96 @@ -1376,8 +1410,8 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( byte gplp8ModbusAddress = 0x19; // The modbus address of the gplp8 // Raw Request >>> {0x19, 0x03, 0x00, 0xC8, 0x00, 0x01, 0x06, 0x2C} const int8_t gplp8AdapterPower = sensorPowerPin; // RS485 adapter power pin -const int8_t gplp8SensorPower = A3; // Sensor power pin -const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin +const int8_t gplp8SensorPower = A3; // Sensor power pin +const int8_t gplp8EnablePin = -1; // Adapter RE/DE pin const uint8_t gplp8NumberReadings = 1; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -2950,8 +2984,8 @@ void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { // Uses the processor sensor object to read the battery voltage // NOTE: This will actually return the battery level from the previous update! float getBatteryVoltage() { - if (mcuBoard.sensorValues[0] == -9999) mcuBoard.update(); - return mcuBoard.sensorValues[0]; + if (mcuBoard.sensorValues[PROCESSOR_BATTERY_VAR_NUM] == -9999) mcuBoard.update(); + return mcuBoard.sensorValues[PROCESSOR_BATTERY_VAR_NUM]; } /** End [working_functions] */ @@ -2991,11 +3025,11 @@ void setup() { /** Start [setup_softserial] */ // Allow interrupts for software serial -#if defined SoftwareSerial_ExtInts_h +#if defined BUILD_TEST_SOFTSERIAL enableInterrupt(softSerialRx, SoftwareSerial_ExtInts::handle_interrupt, CHANGE); #endif -#if defined NeoSWSerial_h +#if defined BUILD_TEST_NEOSWSERIAL enableInterrupt(neoSSerial1Rx, neoSSerial1ISR, CHANGE); #endif /** End [setup_softserial] */ @@ -3040,6 +3074,9 @@ void setup() { greenredflash(); /** End [setup_flashing_led] */ + pinMode(20, OUTPUT); // for proper operation of the onboard flash memory + // chip's ChipSelect (Mayfly v1.0 and later) + /** Start [setup_logger] */ // Set the timezones for the logger/data and the RTC // Logging in the given time zone diff --git a/extras/mega_serial_spy/mega_serial_spy.ino b/extras/mega_serial_spy/mega_serial_spy.ino index 019393f52..7d9316369 100644 --- a/extras/mega_serial_spy/mega_serial_spy.ino +++ b/extras/mega_serial_spy/mega_serial_spy.ino @@ -10,6 +10,7 @@ void changeBauds(void) { Serial.println("[1] - 9600"); Serial.println("[2] - 57600"); Serial.println("[3] - 115200"); + Serial.println("[4] - 74880"); Serial.println(""); Serial.println( "Enter you selection in the Serial Monitor and press "); @@ -38,6 +39,7 @@ void changeBauds(void) { default: baud = 9600; break; case 2: baud = 57600; break; case 3: baud = 115200; break; + case 4: baud = 74880; break; } } diff --git a/src/sensors/GroPointGPLP8.h b/src/sensors/GroPointGPLP8.h index fe676c600..0065f873f 100644 --- a/src/sensors/GroPointGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -39,7 +39,7 @@ * * ___ * @section sensor_gplp8_examples Example Code - * The GPLP-8 Probe is used in the @menulink{GroPoint_gplp8} example. + * The GPLP-8 Probe is used in the @menulink{gro_point_gplp8} example. * * @menusnip{gro_point_gplp8} */ @@ -206,6 +206,10 @@ class GroPointGPLP8_Moist : public Variable { * * @param parentSense The parent GroPointGPLP8 providing the result * values. + * @param sensorVarNum The position the variable result holds in the + * variable result array. The GroPoint GPLP8 can have up to 8 soil moisture + * results. When creating the variable for soil moisture, you must specify + * the output number from the sensor. * @param uuid A universally unique identifier (UUID or GUID) for the * variable; optional with the default value of an empty string. * @param varCode A short code to help identify the variable in files; @@ -221,6 +225,11 @@ class GroPointGPLP8_Moist : public Variable { /** * @brief Construct a new GroPointGPLP8_Moist object. * + * @param sensorVarNum The position the variable result holds in the + * variable result array. The GroPoint GPLP8 can have up to 8 soil moisture + * results. When creating the variable for soil moisture, you must specify + * the output number from the sensor. + * * @note This must be tied with a parent GroPointGPLP8 before it can be * used. */ @@ -250,6 +259,10 @@ class GroPointGPLP8_Temp : public Variable { * * @param parentSense The parent GroPointGPLP8 providing the result * values. + * @param sensorVarNum The position the variable result holds in the + * variable result array. The GroPoint GPLP8 can have up to 8 temperature + * results. When creating the variable for temperature, you must specify the + * output number from the sensor. * @param uuid A universally unique identifier (UUID or GUID) for the * variable; optional with the default value of an empty string. * @param varCode A short code to help identify the variable in files; @@ -264,6 +277,11 @@ class GroPointGPLP8_Temp : public Variable { /** * @brief Construct a new GroPointGPLP8_Temp object. * + * @param sensorVarNum The position the variable result holds in the + * variable result array. The GroPoint GPLP8 can have up to 8 temperature + * results. When creating the variable for temperature, you must specify the + * output number from the sensor. + * * @note This must be tied with a parent GroPointGPLP8 before it can be * used. */ diff --git a/src/sensors/ProcessorStats.cpp b/src/sensors/ProcessorStats.cpp index 3dd860646..18cc4d37b 100644 --- a/src/sensors/ProcessorStats.cpp +++ b/src/sensors/ProcessorStats.cpp @@ -136,7 +136,7 @@ int16_t FreeRam() { bool ProcessorStats::addSingleMeasurementResult(void) { // Get the battery voltage - MS_DBG(F("Getting battery voltage")); + MS_DBG(F("Getting battery voltage from pin"), _batteryPin); float sensorValue_battery = -9999; @@ -146,8 +146,10 @@ bool ProcessorStats::addSingleMeasurementResult(void) { // The return value from analogRead() is IN BITS NOT IN VOLTS!! analogRead(_batteryPin); // priming reading float rawBattery = analogRead(_batteryPin); + MS_DBG(F("Raw battery pin reading in bits:"), rawBattery); // convert bits to volts sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery; + MS_DBG(F("Battery in Volts:"), sensorValue_battery); } if (strcmp(_version, "v0.5") == 0 || strcmp(_version, "v0.5b") || strcmp(_version, "v1.0") || strcmp(_version, "v1.1") == 0) { @@ -155,8 +157,10 @@ bool ProcessorStats::addSingleMeasurementResult(void) { // The return value from analogRead() is IN BITS NOT IN VOLTS!! analogRead(_batteryPin); // priming reading float rawBattery = analogRead(_batteryPin); + MS_DBG(F("Raw battery pin reading in bits:"), rawBattery); // convert bits to volts sensorValue_battery = (3.3 / 1023.) * 4.7 * rawBattery; + MS_DBG(F("Battery in Volts:"), sensorValue_battery); } #elif defined(ARDUINO_AVR_FEATHER32U4) || defined(ARDUINO_SAMD_FEATHER_M0) || \ @@ -170,20 +174,26 @@ bool ProcessorStats::addSingleMeasurementResult(void) { #elif defined(ARDUINO_SODAQ_ONE) || defined(ARDUINO_SODAQ_ONE_BETA) if (strcmp(_version, "v0.1") == 0) { // Get the battery voltage - float rawBattery = analogRead(_batteryPin); + float rawBattery = analogRead(_batteryPin); + MS_DBG(F("Raw battery pin reading in bits:"), rawBattery); sensorValue_battery = (3.3 / 1023.) * 2 * rawBattery; + MS_DBG(F("Battery in Volts:"), sensorValue_battery); } if (strcmp(_version, "v0.2") == 0) { // Get the battery voltage - float rawBattery = analogRead(_batteryPin); + float rawBattery = analogRead(_batteryPin); + MS_DBG(F("Raw battery pin reading in bits:"), rawBattery); sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery; + MS_DBG(F("Battery in Volts:"), sensorValue_battery); } #elif defined(ARDUINO_AVR_SODAQ_NDOGO) || defined(ARDUINO_SODAQ_AUTONOMO) || \ defined(ARDUINO_AVR_SODAQ_MBILI) // Get the battery voltage - float rawBattery = analogRead(_batteryPin); + float rawBattery = analogRead(_batteryPin); + MS_DBG(F("Raw battery pin reading in bits:"), rawBattery); sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery; + MS_DBG(F("Battery in Volts:"), sensorValue_battery); #else sensorValue_battery = -9999; From 6f08feee00f54bdd129584026c5c0bf651487fd7 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 10 May 2024 13:43:18 -0400 Subject: [PATCH 64/89] Add M4's to test Signed-off-by: Sara Damiano --- .github/workflows/build_examples.yaml | 2 +- continuous_integration/generate_job_matrix.py | 34 ++++++++++--------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml index d0852c996..e63cf4169 100644 --- a/.github/workflows/build_examples.yaml +++ b/.github/workflows/build_examples.yaml @@ -196,7 +196,7 @@ jobs: - name: Install python dependencies, including PlatformIO run: pip install -r continuous_integration/requirements.txt - - name: Restore PlatformIO and Arduino platforms and libraries + - name: Restore PlatformIO platforms and libraries uses: actions/cache@v4 id: cache_libraries with: diff --git a/continuous_integration/generate_job_matrix.py b/continuous_integration/generate_job_matrix.py index 3c05f66a4..d4ed318ea 100644 --- a/continuous_integration/generate_job_matrix.py +++ b/continuous_integration/generate_job_matrix.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -#%% +# %% import json import shutil import re @@ -9,7 +9,7 @@ import os import copy -#%% +# %% # Some working directories # The workspace directory if "GITHUB_WORKSPACE" in os.environ.keys(): @@ -37,7 +37,7 @@ os.makedirs(artifact_dir) compilers = ["Arduino CLI", "PlatformIO"] -#%% +# %% # The locations of some important files # The massive "menu" example @@ -72,6 +72,8 @@ "megaatmega2560": {"fqbn": "arduino:avr:mega"}, "zeroUSB": {"fqbn": "arduino:samd:mzero_bl"}, "adafruit_feather_m0": {"fqbn": "adafruit:samd:adafruit_feather_m0"}, + "adafruit_feather_m4": {"fqbn": "adafruit:samd:adafruit_feather_m4"}, + "adafruit_grandcentral_m4": {"fqbn": "adafruit:samd:adafruit_grandcentral_m4"}, } @@ -183,14 +185,14 @@ def snake_to_camel(snake_str): return camel_str -#%% +# %% # set up outputs arduino_job_matrix = [] pio_job_matrix = [] start_job_commands = "status=0" end_job_commands = "\n\nexit $status" -#%% +# %% # Create job info for the basic examples # Use one job per board with one command per example for pio_env in pio_config.envs(): @@ -234,7 +236,7 @@ def snake_to_camel(snake_str): ) -#%% +# %% # Helper functions for preparing the menu-a-la-carte example for building def modify_example_filename(example_subfolder, in_file_defines): @@ -309,7 +311,7 @@ def extend_pio_config(added_envs): return new_config_path -#%% read build flags out of the menu-a-la-cart example +# %% read build flags out of the menu-a-la-cart example # Pattern for flags in the menu-a-la-cart example pattern = re.compile( "^(?:#if|#elif) defined[\s\(](?PBUILD_\w+)((?:[\s\n\\\)]*?\|\|[\s\n\\]*defined[\s\n\\\(]*?)(?PBUILD_\w+))*", @@ -350,7 +352,7 @@ def extend_pio_config(added_envs): all_publisher_flags.append(match.group("flag1")) -#%% +# %% # Create jobs for all of the modems together for pio_env in pio_config.envs(): arduino_modem_commands = [ @@ -396,7 +398,7 @@ def extend_pio_config(added_envs): } ) -#%% +# %% # Create jobs for all of the publishers together for pio_env in pio_config.envs(): arduino_pub_commands = [ @@ -442,7 +444,7 @@ def extend_pio_config(added_envs): } ) -#%% +# %% # Create jobs for all of the sensors together # The sensors are a bit different because we run extra PlatformIO enviroments for some of the sensors for pio_env in pio_config.envs(): @@ -540,7 +542,7 @@ def extend_pio_config(added_envs): } ) -#%% +# %% # Tack on a few extra build configurations for the menu example for pio_env in pio_config.envs(): arduino_loop_commands = [ @@ -596,7 +598,7 @@ def extend_pio_config(added_envs): } ) -#%% +# %% # Tack on a few more extra build configurations for the software serial libraries for pio_env in ["Mayfly"]: arduino_serial_commands = [ @@ -654,7 +656,7 @@ def extend_pio_config(added_envs): ) -#%% +# %% # Convert commands in the matrix into bash scripts for matrix_job in arduino_job_matrix + pio_job_matrix: bash_file_name = matrix_job["job_name"].replace(" ", "") + ".sh" @@ -676,7 +678,7 @@ def extend_pio_config(added_envs): del items["command"] -#%% +# %% # Write out output print( 'echo "arduino_job_matrix={}" >> $GITHUB_OUTPUT'.format( @@ -694,14 +696,14 @@ def extend_pio_config(added_envs): json_out.close() -#%% +# %% # different attempt to save output with open(os.environ["GITHUB_OUTPUT"], "a") as fh: print("arduino_job_matrix={}".format(json.dumps(arduino_job_matrix)), file=fh) print("pio_job_matrix={}".format(json.dumps(pio_job_matrix)), file=fh) -#%% +# %% if "GITHUB_WORKSPACE" not in os.environ.keys(): try: shutil.rmtree(artifact_dir) From 44504caa91a35c30e244913d2240626caf3629ba Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 13 May 2024 14:11:27 -0400 Subject: [PATCH 65/89] Add XBee Mayfly 1.x pins Signed-off-by: Sara Damiano --- src/modems/DigiXBee.cpp | 2 +- src/modems/DigiXBee.h | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/modems/DigiXBee.cpp b/src/modems/DigiXBee.cpp index f179a04ad..c1a8f9bae 100644 --- a/src/modems/DigiXBee.cpp +++ b/src/modems/DigiXBee.cpp @@ -27,7 +27,7 @@ DigiXBee::~DigiXBee() {} // Create the wake and sleep methods for the modem // These can be functions of any type and must return a boolean // After enabling pin sleep, the sleep request pin is held `LOW` to keep the -// XBee on Enable pin sleep in the setup function or using XCTU prior to +// XBee on. Enable pin sleep in the setup function or using XCTU prior to // connecting the XBee bool DigiXBee::modemWakeFxn(void) { if (_modemSleepRqPin >= 0) { diff --git a/src/modems/DigiXBee.h b/src/modems/DigiXBee.h index bc72bfc0a..4f5004dec 100644 --- a/src/modems/DigiXBee.h +++ b/src/modems/DigiXBee.h @@ -31,6 +31,18 @@ * * @section modem_digi_mayfly-and-digi-xbee-connections Mayfly and Digi XBee Connections * + * @subsection modem_digi_raw_pins_1x Pin Numbers for connecting Digi XBee's Directly to a Mayfly v1.x + * + * This applies to _all_ Digi XBees and XBee3's when attached directly to the Mayfly's bee slot. + * @code{cpp} + * const int8_t modemVccPin = 18; // MCU pin controlling modem power + * const bool useCTSforStatus = true; // Flag to use the XBee `CTS` pin for status + * const int8_t modemStatusPin = 19; // MCU pin used to read modem status + * const int8_t modemResetPin = A5; // MCU pin connected to modem reset pin + * const int8_t modemSleepRqPin = 23; // MCU pin used for modem sleep/wake request + * const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem status + * @endcode + * * @subsection modem_digi_raw_pins Pin Numbers for connecting Digi XBee's Directly to a Mayfly v0.3-v0.5c * * This applies to _all_ Digi XBees and XBee3's when attached directly to the Mayfly's bee slot. @@ -96,7 +108,7 @@ * - the `ON/SLEEP_N/DIO9` will be `HIGH` when the XBee is awake * (ie, yes, I am not sleeping) * - but the `CTS_N/DIO7` will be `LOW` when the - * board is away (ie, no it's not not clear to send). + * board is awake (ie, no it's not not clear to send). * * To use the `CTS_N/DIO7` as the status indicator, set useCTSStatus to true in * the constructor. From 120cc68425bdba58d111f7cb78d4ce46cb9c48fd Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 13 May 2024 14:12:14 -0400 Subject: [PATCH 66/89] Some publisher comments Signed-off-by: Sara Damiano --- src/LoggerBase.h | 2 ++ src/dataPublisherBase.cpp | 14 ++++++++++++-- src/publishers/EnviroDIYPublisher.cpp | 2 +- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 36040f426..586cf996b 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -47,6 +47,7 @@ // clock This also implements a needed date/time class #include +#ifndef EPOCH_TIME_OFF /** * @brief January 1, 2000 00:00:00 in "epoch" time * @@ -55,6 +56,7 @@ * epoch beginning 1970-jan-01 00:00:00. */ #define EPOCH_TIME_OFF 946684800 +#endif #include // To communicate with the SD card diff --git a/src/dataPublisherBase.cpp b/src/dataPublisherBase.cpp index 1f4ab0a51..550e37599 100644 --- a/src/dataPublisherBase.cpp +++ b/src/dataPublisherBase.cpp @@ -79,14 +79,23 @@ void dataPublisher::txBufferInit(Client* outClient) { void dataPublisher::txBufferAppend(const char* data, size_t length) { while (length > 0) { + // space left in the buffer size_t remaining = MS_SEND_BUFFER_SIZE - txBufferLen; - size_t amount = remaining < length ? remaining : length; + // the number of characters that will be added to the buffer + // this will be the lesser of the length desired and the space left in + // the buffer + size_t amount = remaining < length ? remaining : length; + // copy as much as possible into the buffer memcpy(&txBuffer[txBufferLen], data, amount); + // re-count how much is left to go length -= amount; + // bump forward the pointer to where we're currently adding data += amount; + // bump up the current length of the buffer txBufferLen += amount; + // write out the buffer if it fills if (txBufferLen == MS_SEND_BUFFER_SIZE) { txBufferFlush(); } } } @@ -101,10 +110,11 @@ void dataPublisher::txBufferAppend(char c) { void dataPublisher::txBufferFlush() { #if defined(STANDARD_SERIAL_OUTPUT) - // send to debugging stream + // write out to the printout stream STANDARD_SERIAL_OUTPUT.write((const uint8_t*)txBuffer, txBufferLen); STANDARD_SERIAL_OUTPUT.flush(); #endif + // write out to the client txBufferOutClient->write((const uint8_t*)txBuffer, txBufferLen); txBufferOutClient->flush(); diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index b5e962da3..2b9db9149 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -159,7 +159,7 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { } } - // Flush the complete request + // Write out the complete request txBufferFlush(); // Wait 10 seconds for a response from the server From 5ce948e68f204b32f97674b48a66fa0e964793de Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 13 May 2024 14:12:42 -0400 Subject: [PATCH 67/89] Always attempt last connection on WiFi Signed-off-by: Sara Damiano --- src/modems/LoggerModemMacros.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/modems/LoggerModemMacros.h b/src/modems/LoggerModemMacros.h index c4193386e..54fe1d3b8 100644 --- a/src/modems/LoggerModemMacros.h +++ b/src/modems/LoggerModemMacros.h @@ -100,13 +100,14 @@ */ #define MS_MODEM_WAKE(specificModem) \ bool specificModem::modemWake(void) { \ - /* Power up */ \ - if (_millisPowerOn == 0) { modemPowerUp(); } \ - \ /** Set-up pin modes. \ Because the modem calls wake BEFORE the first setup, we must set \ the pin modes in the wake function. */ \ setModemPinModes(); \ + \ + /* Power up */ \ + if (_millisPowerOn == 0) { modemPowerUp(); } \ + \ if (millis() - _millisPowerOn < _wakeDelayTime_ms) { \ MS_DBG(F("Wait"), _wakeDelayTime_ms - (millis() - _millisPowerOn), \ F("ms longer for warm-up")); \ @@ -399,19 +400,18 @@ F("ms to see if WiFi connects without sending new " \ "credentials...")); \ if (!(gsmModem.isNetworkConnected())) { \ - gsmModem.waitForNetwork(auto_reconnect_time); \ - } \ - /** If still not connected, send new credentials */ \ - if (!(gsmModem.isNetworkConnected())) { \ - MS_DBG(F("Sending credentials...")); \ - for (uint8_t i = 0; i < 5; i++) { \ - if (gsmModem.networkConnect(_ssid, _pwd)) { break; } \ - } \ - MS_DBG(F("Waiting up to"), maxConnectionTime / 1000, \ - F("seconds for connection")); \ - if (!gsmModem.waitForNetwork(maxConnectionTime)) { \ - MS_DBG(F("... WiFi connection failed")); \ - return false; \ + /** If still not connected, send new credentials */ \ + if (!(gsmModem.waitForNetwork(auto_reconnect_time))) { \ + MS_DBG(F("Sending credentials...")); \ + for (uint8_t i = 0; i < 5; i++) { \ + if (gsmModem.networkConnect(_ssid, _pwd)) { break; } \ + } \ + MS_DBG(F("Waiting up to"), maxConnectionTime / 1000, \ + F("seconds for connection")); \ + if (!gsmModem.waitForNetwork(maxConnectionTime)) { \ + MS_DBG(F("... WiFi connection failed")); \ + return false; \ + } \ } \ } \ MS_DBG(F("... WiFi connected after"), MS_PRINT_DEBUG_TIMER, \ From e9717d0f6c52f3a2d0e7ee43fbb993583ecffa7c Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 15 May 2024 12:05:45 -0400 Subject: [PATCH 68/89] XBee Tweek Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index fbfe56aed..3257a5d61 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -101,19 +101,18 @@ bool DigiXBeeWifi::extraModemSetup(void) { MS_DBG(F("Putting XBee into command mode...")); if (gsmModem.commandMode()) { MS_DBG(F("Getting Detailed Modem Version...")); - String xbeeSnLow; - String xbeeSnHigh; + gsmModem.getSeries(); - _modemName = gsmModem.getModemName(); - gsmModem.sendAT(F("SL")); // Request Module MAC/Serial Number Low - gsmModem.waitResponse(1000, xbeeSnLow); - gsmModem.sendAT(F("SH")); // Request Module MAC/Serial Number High - gsmModem.waitResponse(1000, xbeeSnHigh); + _modemName = gsmModem.getModemName(); + String xbeeSnLow = gsmModem.sendATGetString( + F("SL")); // Request Module MAC/Serial Number Low + String xbeeSnHigh = gsmModem.sendATGetString( + F("SH")); // Request Module MAC/Serial Number High _modemSerialNumber = xbeeSnHigh + xbeeSnLow; - gsmModem.sendAT(F("HV")); // Request Module Hw Version - gsmModem.waitResponse(1000, _modemHwVersion); - gsmModem.sendAT(F("VR")); // Firmware Version - gsmModem.waitResponse(1000, _modemFwVersion); + _modemHwVersion = + gsmModem.sendATGetString(F("HV")); // Request Module Hw Version + _modemFwVersion = + gsmModem.sendATGetString(F("VR")); // Firmware Version PRINTOUT(F("Digi XBee"), _modemName, F("Mac/SN"), xbeeSnHigh, xbeeSnLow, F("HwVer"), _modemHwVersion, F("FwVer"), _modemFwVersion); From a9b307c3c9dbf931dcd2b624f36e5c1d7e9a8437 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 15 May 2024 12:23:49 -0400 Subject: [PATCH 69/89] Move XBee doc Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 4 ++-- src/modems/DigiXBeeWifi.h | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 3257a5d61..bacbe78e4 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -564,8 +564,8 @@ bool DigiXBeeWifi::updateModemMetadata(void) { ++updateModemMetadata_cnt; if (0 == rssi || (XBEE_RESET_THRESHOLD <= updateModemMetadata_cnt)) { updateModemMetadata_cnt = 0; - /** Since not giving an rssi value, restart the modem for next time. - * This is likely to take over 2 seconds */ + // Since not giving an rssi value, restart the modem for next time. + // This is likely to take over 2 seconds PRINTOUT(F("updateModemMetadata forcing restart xbee...")); success &= gsmModem.restart(); } diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index 21355ec90..72854f4d5 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -79,6 +79,12 @@ #include #endif +/** + * @brief This causes the Xbee to reset after this number of transmission + * attempts + */ +#define XBEE_RESET_THRESHOLD 4 + /** * @brief The class for the [Digi XBee](@ref modem_digi) * [S6B wifi](@ref modem_digi_wifi) module operating in Digi's "transparent" @@ -180,8 +186,6 @@ class DigiXBeeWifi : public DigiXBee { char* _pwd_buf = NULL; uint16_t updateModemMetadata_cnt = 0; - // This causes the Xbee to reset after this number of transmission attempts -#define XBEE_RESET_THRESHOLD 4 }; /**@}*/ #endif // SRC_MODEMS_DIGIXBEEWIFI_H_ From f45d5068813a9137fcd5c31904c5c01abc145abc Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 15 May 2024 12:24:55 -0400 Subject: [PATCH 70/89] Update readme and change log Signed-off-by: Sara Damiano --- ChangeLog.md | 15 +++++++++++++++ README.md | 1 + 2 files changed, 16 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 7acb088e7..b16e41bb8 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -10,10 +10,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +### Added + +### Removed + +### Fixed + +*** + + +## [0.36.0] + ### Changed - **BREAKING** Refactored how the publisher transmit buffer works. This will require adjustment to custom data publishers. ### Added +- Support [Vega Puls 21 Radar](https://www.vega.com/en-us/products/product-catalog/level/radar/vegapuls-21) +- ### Removed ### Fixed diff --git a/README.md b/README.md index b443cf312..557731c0f 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,7 @@ For some generalized information about attaching sensors to an Arduino style boa - [TI ADS1115: external voltage with support for divided current](https://envirodiy.github.io/ModularSensors/group__sensor__ads1x15.html) - [TI INA219: current, voltage, and power draw](https://envirodiy.github.io/ModularSensors/group__sensor__ina219.html) - [Turner Cyclops-7F: various parameters](https://envirodiy.github.io/ModularSensors/group__sensor__cyclops.html) +- [Vega Puls 21: radar distance](https://envirodiy.github.io/ModularSensors/group__sensor__vega__puls21.html) - [Yosemitech: water quality sensors](https://envirodiy.github.io/ModularSensors/group__yosemitech__group.html) - [Y502-A or Y504-A: Optical DO and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y504.html) - [Y510-B: Optical Turbidity and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y510.html) From 621497f55b43c176aaefa6f17a3327d4633c4e15 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 15 May 2024 12:29:11 -0400 Subject: [PATCH 71/89] Adjust version in change log Signed-off-by: Sara Damiano --- ChangeLog.md | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index b16e41bb8..7d3c6ab3f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -21,25 +21,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *** -## [0.36.0] +## [0.35.0] ### Changed - **BREAKING** Refactored how the publisher transmit buffer works. This will require adjustment to custom data publishers. -### Added -- Support [Vega Puls 21 Radar](https://www.vega.com/en-us/products/product-catalog/level/radar/vegapuls-21) -- -### Removed - -### Fixed - -*** - - -## [0.35.0] - ### Added - Support [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](https://www.gropoint.com/products/soil-sensors/gropoint-profile) +- Support [Vega Puls 21 Radar](https://www.vega.com/en-us/products/product-catalog/level/radar/vegapuls-21) ## [0.34.1] From d660e8802c93c1caeec61d896feb10e8e9429d08 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 09:59:58 -0400 Subject: [PATCH 72/89] Allow MAX_NUMBER_VARS to be defined by build flag Signed-off-by: Sara Damiano --- src/SensorBase.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SensorBase.h b/src/SensorBase.h index 089d8762e..44a1d68a3 100644 --- a/src/SensorBase.h +++ b/src/SensorBase.h @@ -36,11 +36,13 @@ #undef MS_DEBUGGING_STD #include +#ifndef MAX_NUMBER_VARS /** * @brief The largest number of variables from a single sensor */ #define MAX_NUMBER_VARS 21 // GroPoint Profile GPLP-8 has 8 Moisture and 13 Temperature values +#endif class Variable; // Forward declaration From 479eb66981947ef1568de33fb5e39644e3a358df Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 10:15:17 -0400 Subject: [PATCH 73/89] Clean some lingering copyrights Signed-off-by: Sara Damiano --- LICENSE.md | 2 +- src/modems/DigiXBeeWifi.cpp | 1 - src/sensors/AnalogElecConductivity.cpp | 10 ++++++---- src/sensors/AnalogElecConductivity.h | 5 ++--- src/sensors/GroPointGPLP8.h | 5 +++-- src/sensors/GroPointParent.cpp | 5 +++-- src/sensors/GroPointParent.h | 5 +++-- src/sensors/InSituTrollSdi12a.h | 5 +++-- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 4f77081af..5e24c3b2f 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # Software License Agreement (BSD-3 License) -**Copyright (c) 2010-2017, Stroud Water Research Center (SWRC) and the EnviroDIY Development Team.** +**Copyright (c) 2010-2024, Stroud Water Research Center (SWRC) and the EnviroDIY Development Team.** All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index b0b8ab2bf..576b6d1f6 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -272,7 +272,6 @@ bool DigiXBeeWifi::extraModemSetup(void) { // NOTE: This will write to the flash every time if there is a password // set! success &= gsmModem.networkConnect(_ssid, _pwd); - // Set the socket timeout to 10s (this is default) if (!success) { MS_DBG(F("Fail Connect "), success); success = true; diff --git a/src/sensors/AnalogElecConductivity.cpp b/src/sensors/AnalogElecConductivity.cpp index deed2dee1..e1b49b01e 100644 --- a/src/sensors/AnalogElecConductivity.cpp +++ b/src/sensors/AnalogElecConductivity.cpp @@ -1,11 +1,13 @@ /** * @file AnalogElecConductivity.cpp - * @copyright 2017-2024 Stroud Water Research Center + * @copyright Stroud Water Research Center and Neil Hancock * Part of the EnviroDIY ModularSensors library - * @copyright 2020 Neil Hancock + * This library is published under the BSD-3 license. + * @author Written By: Neil Hancock ; Edited by Sara + * Geleskie Damiano * - * * @brief This encapsulates an Electrical Conductivity sensors using an anlog - *input and onboard ADC and ADC ref. + * @brief This encapsulates an Electrical Conductivity sensors using an anlog + * input and onboard ADC and ADC ref. */ #include "AnalogElecConductivity.h" diff --git a/src/sensors/AnalogElecConductivity.h b/src/sensors/AnalogElecConductivity.h index 9d1b263db..57351fe86 100644 --- a/src/sensors/AnalogElecConductivity.h +++ b/src/sensors/AnalogElecConductivity.h @@ -1,12 +1,11 @@ /** * @file AnalogElecConductivity.h - * @copyright 2017-2024 Stroud Water Research Center + * @copyright Stroud Water Research Center and Neil Hancock * Part of the EnviroDIY ModularSensors library - * @copyright 2020 Neil Hancock + * This library is published under the BSD-3 license. * @author Written By: Neil Hancock ; Edited by Sara * Geleskie Damiano * - * * @brief Encapsulates an Electrical Conductivity sensors using an anlog * input and onboard ADC and ADC ref. */ diff --git a/src/sensors/GroPointGPLP8.h b/src/sensors/GroPointGPLP8.h index 0065f873f..869ea74b3 100644 --- a/src/sensors/GroPointGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -1,7 +1,8 @@ /** * @file GroPointGPLP8.h - * @copyright 2017-2023 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe * * @brief Contains the GroPointGPLP8 sensor subclass and the variable diff --git a/src/sensors/GroPointParent.cpp b/src/sensors/GroPointParent.cpp index e66ed0c70..038b4f768 100644 --- a/src/sensors/GroPointParent.cpp +++ b/src/sensors/GroPointParent.cpp @@ -1,7 +1,8 @@ /** * @file GroPointParent.cpp - * @copyright 2017-2023 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe * * @brief Implements the GroPointParent class. diff --git a/src/sensors/GroPointParent.h b/src/sensors/GroPointParent.h index 2772fde94..8a27f0b59 100644 --- a/src/sensors/GroPointParent.h +++ b/src/sensors/GroPointParent.h @@ -1,7 +1,8 @@ /** * @file GroPointParent.cpp - * @copyright 2017-2023 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Anthony Aufdenkampe * * @brief Contains the GroPointParent sensor subclass, itself a parent diff --git a/src/sensors/InSituTrollSdi12a.h b/src/sensors/InSituTrollSdi12a.h index dc200c820..b8031cd84 100644 --- a/src/sensors/InSituTrollSdi12a.h +++ b/src/sensors/InSituTrollSdi12a.h @@ -1,7 +1,8 @@ /* * @file InSituTrollSdi12a.h - * @copyright 2017-2024 Stroud Water Research Center - * Part of the EnviroDIY modular sensors + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. * @author Neil Hancock https://github.com/neilh10/ModularSensors/ * @author Sara Geleskie Damiano * From 03687033377b198f7277db70237f7947f637cc69 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 11:06:29 -0400 Subject: [PATCH 74/89] Only reset XBee Wifi after 4 *failed* metadata attempts Signed-off-by: Sara Damiano --- src/modems/DigiXBeeWifi.cpp | 42 ++++++++++++++++++++++++------------- src/modems/DigiXBeeWifi.h | 2 +- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index 576b6d1f6..c44bc3c0e 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -481,11 +481,6 @@ bool DigiXBeeWifi::updateModemMetadata(void) { loggerModem::_priorBatteryPercent = -9999; loggerModem::_priorModemTemp = -9999; - // Initialize variable - int16_t rssi = -9999; - // int16_t percent = -9999; - uint16_t volt_mV = 9999; - MS_DBG(F("Modem polling settings:"), String(_pollModemMetaData, BIN)); // if not enabled don't collect data @@ -510,7 +505,8 @@ bool DigiXBeeWifi::updateModemMetadata(void) { // same "no signal" value (99 CSQ or 0 RSSI) in all 3 cases. // Try up to 5 times to get a signal quality - int8_t num_trys_remaining = 5; + int8_t num_trys_remaining = 5; + int16_t rssi = -9999; do { rssi = gsmModem.getSignalQuality(); MS_DBG(F("Raw signal quality ("), num_trys_remaining, F("):"), @@ -527,6 +523,8 @@ bool DigiXBeeWifi::updateModemMetadata(void) { loggerModem::_priorRSSI = rssi; MS_DBG(F("CURRENT RSSI:"), rssi); + + success &= ((rssi != -9999) && (rssi != 0)); } else { MS_DBG(F("Polling for both RSSI and signal strength is disabled")); } @@ -535,7 +533,8 @@ bool DigiXBeeWifi::updateModemMetadata(void) { if ((_pollModemMetaData & MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK) == MODEM_BATTERY_VOLTAGE_ENABLE_BITMASK) { MS_DBG(F("Getting input voltage:")); - volt_mV = gsmModem.getBattVoltage(); + uint16_t volt_mV = 9999; + volt_mV = gsmModem.getBattVoltage(); MS_DBG(F("CURRENT Modem battery (mV):"), volt_mV); if (volt_mV != 9999) { loggerModem::_priorBatteryVoltage = @@ -543,6 +542,8 @@ bool DigiXBeeWifi::updateModemMetadata(void) { } else { loggerModem::_priorBatteryVoltage = static_cast(-9999); } + + success &= ((volt_mV != 9999) && (volt_mV != 0)); } else { MS_DBG(F("Polling for modem battery voltage is disabled")); } @@ -550,9 +551,17 @@ bool DigiXBeeWifi::updateModemMetadata(void) { if ((_pollModemMetaData & MODEM_TEMPERATURE_ENABLE_BITMASK) == MODEM_TEMPERATURE_ENABLE_BITMASK) { MS_DBG(F("Getting chip temperature:")); - loggerModem::_priorModemTemp = getModemChipTemperature(); + float chip_temp = -9999; + chip_temp = getModemChipTemperature(); MS_DBG(F("CURRENT Modem temperature(C):"), loggerModem::_priorModemTemp); + if (chip_temp != -9999.f) { + loggerModem::_priorModemTemp = chip_temp; + } else { + loggerModem::_priorModemTemp = static_cast(-9999); + } + + success &= ((chip_temp != -9999.f) && (chip_temp != 0)); } else { MS_DBG(F("Polling for modem chip temperature is disabled")); } @@ -561,13 +570,18 @@ bool DigiXBeeWifi::updateModemMetadata(void) { MS_DBG(F("Leaving Command Mode after updating modem metadata:")); gsmModem.exitCommand(); - ++updateModemMetadata_cnt; - if (0 == rssi || (XBEE_RESET_THRESHOLD <= updateModemMetadata_cnt)) { - updateModemMetadata_cnt = 0; - // Since not giving an rssi value, restart the modem for next time. - // This is likely to take over 2 seconds + + // bump up the failure count if we didn't successfully update any of the + // metadata parameters + if (!success) { metadata_failure_count++; } + + // If the metadata update has failed more than the XBEE_RESET_THRESHOLD + // number of times, restart the modem for next time. This is likely to take + // over 2 seconds. + if (metadata_failure_count >= XBEE_RESET_THRESHOLD) { + metadata_failure_count = 0; // reset the count PRINTOUT(F("updateModemMetadata forcing restart xbee...")); - success &= gsmModem.restart(); + gsmModem.restart(); } return success; diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index 9d1746e26..9be12dc88 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -186,7 +186,7 @@ class DigiXBeeWifi : public DigiXBee { char* _ssid_buf = NULL; char* _pwd_buf = NULL; - uint16_t updateModemMetadata_cnt = 0; + uint16_t metadata_failure_count = 0; }; /**@}*/ #endif // SRC_MODEMS_DIGIXBEEWIFI_H_ From 8a23cc5edd9915d5c30556a5169b5d38eccdbfe0 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 11:09:43 -0400 Subject: [PATCH 75/89] Add to-do notes for missing modem info pieces. Signed-off-by: Sara Damiano --- src/LoggerModem.cpp | 1 + src/LoggerModem.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index 427df904a..3b3be5cd7 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -64,6 +64,7 @@ String loggerModem::getModemName(void) { return _modemName; } +// @TODO Implement this for all modems String loggerModem::getModemDevId(void) { return _modemName + F(" Sn ") + _modemSerialNumber + F(" HwVer ") + _modemHwVersion + F(" FwVer ") + _modemFwVersion; diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 9eda36916..a55736dcc 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -371,7 +371,9 @@ class loggerModem { * @note These values are polled for and cached in memory till needed * * @return **String** The concatenated name, hardware version, firmware - * version, and serial number fo the modem.. + * version, and serial number of the modem. + * + * @todo Implement this for modems other than the XBee WiFi */ String getModemDevId(void); @@ -1058,11 +1060,15 @@ class loggerModem { // modemType gsmModem; // modemClientType gsmClient; + // @TODO: Implement these for all modems; most support it. + /** * @brief The modem hardware version. * * Set in #modemSetup(). * Returned as a portion of the #getModemDevId(). + * + * @todo Implement this for modems other than the XBee WiFi */ String _modemHwVersion; /** @@ -1070,6 +1076,8 @@ class loggerModem { * * Set in #modemSetup(). * Returned as a portion of the #getModemDevId(). + * + * @todo Implement this for modems other than the XBee WiFi */ String _modemFwVersion; /** @@ -1077,6 +1085,8 @@ class loggerModem { * * Set in #modemSetup(). * Returned as a portion of the #getModemDevId(). + * + * @todo Implement this for modems other than the XBee WiFi */ String _modemSerialNumber; From 5ca53f1b7cee557e5c9d1f6dbecb71929b03264a Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 11:29:36 -0400 Subject: [PATCH 76/89] Change token for changelog reminder Signed-off-by: Sara Damiano --- .github/workflows/changelog_reminder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog_reminder.yaml b/.github/workflows/changelog_reminder.yaml index c0af65bcb..90115a0cb 100644 --- a/.github/workflows/changelog_reminder.yaml +++ b/.github/workflows/changelog_reminder.yaml @@ -15,4 +15,4 @@ jobs: changelog_regex: '/CHANGELOG\/.*\/*.md' customPrMessage: 'Please add your changes to the change log!' env: - GITHUB_TOKEN: ${{ secrets.SARA_PUSH_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From cb13b942ea50a682623329cb4541021c768049e0 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 11:29:57 -0400 Subject: [PATCH 77/89] Add more details to changelog Signed-off-by: Sara Damiano --- ChangeLog.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 7d3c6ab3f..67d73b31d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -25,10 +25,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - **BREAKING** Refactored how the publisher transmit buffer works. This will require adjustment to custom data publishers. +- Update GitHub actions +- Remove date from copyright for easier tracking +- Turn modem off at end of setup, regardless of time +- Clean function to set file timestamp on SD card +- Use equation rather than table for CSQ +- Only polling modem for enabled parameters +- INCREASED THE MAXIMUM NUMBER OF VARIABLES FROM A SINGLE SENSOR and implemented an option to set this by build flag. + - This will increase memory use for the entire library. +If you are not using the GroPoint sensors which require many variables, I recommend you change this value via the build flag `-D MAX_NUMBER_VARS=8` +- Allow all WiFi modems to first attempt to connect using existing on-modem saved credentials rather than immediately sending new credentials. +- Add further debug printouts to the processor stats ### Added - Support [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](https://www.gropoint.com/products/soil-sensors/gropoint-profile) - Support [Vega Puls 21 Radar](https://www.vega.com/en-us/products/product-catalog/level/radar/vegapuls-21) +- Functions to enable and disable modem metadata polling by bitmask + +### Removed +- Removed the (unused) sendOffset parameter from dataPublisherBase. + +### Fixed +- Minor bug fixes for XBee Wifi +- Handle no SIM card response from SIM7080G (EnviroDIY LTE Bee) +- Fixed Keller debugging output. + +### Known Issues +- The modem hardware, firmware, and serial number is only implemented for the Digi XBee WiFi. ## [0.34.1] From 7f3447fc9a10ac367eb6e65c568c67362ca78d36 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 11:39:57 -0400 Subject: [PATCH 78/89] Fix refs to BMP388 library in actions Signed-off-by: Sara Damiano --- continuous_integration/install-deps-arduino-cli.sh | 10 ++-------- continuous_integration/install-deps-platformio.sh | 2 +- docs/FAQ/Developer-Setup.md | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/continuous_integration/install-deps-arduino-cli.sh b/continuous_integration/install-deps-arduino-cli.sh index 364f03a82..61ba26a4b 100644 --- a/continuous_integration/install-deps-arduino-cli.sh +++ b/continuous_integration/install-deps-arduino-cli.sh @@ -91,14 +91,8 @@ arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "A echo "\n\e[32mInstalling Adafruit SHT4x Library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "Adafruit SHT4x Library" -echo "\n\e[32mDownloading Martin Lindupp's BMP388 Library as a zip" -# Soligen fork needs to be manually unzipped and moved because the CLI chokes on the library name not matching the h file -curl -L --retry 15 --retry-delay 0 https://github.com/MartinL1/BMP388_DEV/archive/master.zip --create-dirs -o home/arduino/downloads/BMP388_DEV.zip -echo "\e[32mDecompressing BMP388_DEV\e[0m" -unzip -q -o home/arduino/downloads/BMP388_DEV.zip -d home/arduino/downloads/ -echo "\e[32mMoving BMP388_DEV to the libraries folder\e[0m" -mkdir -p home/arduino/user/libraries/BMP388_DEV -mv home/arduino/downloads/BMP388_DEV-master/* home/arduino/user/libraries/BMP388_DEV +echo "\n\e[32mInstalling Martin Lindupp's BMP388 Library from Arduino library index\e[0m" +arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "BMP388_DEV" echo "\n\e[32mInstalling OneWire library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install OneWire diff --git a/continuous_integration/install-deps-platformio.sh b/continuous_integration/install-deps-platformio.sh index f8b08f7d6..22219218e 100644 --- a/continuous_integration/install-deps-platformio.sh +++ b/continuous_integration/install-deps-platformio.sh @@ -81,7 +81,7 @@ echo "\e[32mInstalling adafruit/'Adafruit SHT'\e[0m" pio pkg install -g --library adafruit/'Adafruit SHT4x Library' echo "\e[32mInstalling Martin Lindupp's BMP388 Library\e[0m" -pio pkg install -g --library https://github.com/MartinL1/BMP388_DEV.git +pio pkg install -g --library MartinL1/BMP388_DEV echo "\e[32mInstalling paulstoffregen/OneWire\e[0m" pio pkg install -g --library paulstoffregen/OneWire diff --git a/docs/FAQ/Developer-Setup.md b/docs/FAQ/Developer-Setup.md index 152ce82f2..19db0b93c 100644 --- a/docs/FAQ/Developer-Setup.md +++ b/docs/FAQ/Developer-Setup.md @@ -78,7 +78,7 @@ lib_deps = adafruit/Adafruit INA219 adafruit/Adafruit MPL115A2 adafruit/Adafruit SHT4x Library - https://github.com/MartinL1/BMP388_DEV + MartinL1/BMP388_DEV paulstoffregen/OneWire milesburton/DallasTemperature envirodiy/SDI-12 From 4a572459d5c94d0e6fae8a3eb7024444d3a2f4fc Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 11:44:01 -0400 Subject: [PATCH 79/89] Bump version of upload artifact Signed-off-by: Sara Damiano --- .github/workflows/build_examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml index e63cf4169..f2dd49d77 100644 --- a/.github/workflows/build_examples.yaml +++ b/.github/workflows/build_examples.yaml @@ -34,7 +34,7 @@ jobs: python continuous_integration/generate_job_matrix.py - name: Store generated examples - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: generated_examples path: | From 93ba36817863e44b1db8509a81eefd9274366082 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 15:01:31 -0400 Subject: [PATCH 80/89] XBee fix for non-AVR Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 22 ++++++++++++---------- src/LoggerBase.cpp | 2 +- src/modems/DigiXBeeWifi.cpp | 8 ++++---- src/sensors/SDI12Sensors.cpp | 3 ++- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 609f999d1..86575f6a3 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 17, + "action_cache_version": 18, "dependencies": [ { "name": "EnviroDIY_DS3231", @@ -46,7 +46,7 @@ "owner": "greiman", "library id": "322", "url": "https://github.com/greiman/SdFat", - "version": "~2.1.2", + "version": "~2.2.3", "note": "SdFat - FAT16/FAT32 file system for SD cards.", "authors": [ "Bill Greiman" @@ -82,7 +82,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO", - "version": "~1.11.6", + "version": "~1.16.0", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": [ "Adafruit" @@ -95,7 +95,7 @@ "owner": "adafruit", "library id": "31", "url": "https://github.com/adafruit/Adafruit_Sensor", - "version": "~1.1.13", + "version": "~1.1.14", "note": "Adafruit's unified sensor library is used by their other libraries", "authors": [ "Adafruit" @@ -133,7 +133,7 @@ "owner": "adafruit", "library id": "166", "url": "https://github.com/adafruit/Adafruit_BME280_Library", - "version": "~2.2.2", + "version": "~2.2.4", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", "authors": [ "Adafruit" @@ -157,7 +157,7 @@ "owner": "adafruit", "library id": "19", "url": "https://github.com/adafruit/DHT-sensor-library", - "version": "~1.4.4", + "version": "~1.4.6", "note": "AOSong DHT Sensor Library by Adafruit", "authors": [ "Adafruit" @@ -170,7 +170,7 @@ "owner": "adafruit", "library id": "160", "url": "https://github.com/adafruit/Adafruit_INA219", - "version": "~1.2.1", + "version": "~1.2.3", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", "authors": [ "Adafruit" @@ -207,7 +207,7 @@ "owner": "paulstoffregen", "library id": "1", "url": "https://github.com/PaulStoffregen/OneWire", - "version": "~2.3.7", + "version": "~2.3.8", "note": "OneWire - Control 1-Wire protocol (DS18S20, DS18B20, DS2408 and etc)", "authors": [ "Paul Stoffregen", @@ -231,7 +231,7 @@ "owner": "milesburton", "library id": "54", "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library", - "version": "~3.9.1", + "version": "~3.11.0", "note": "DallasTemperature - Arduino Library for Dallas Temperature ICs (DS18B20, DS18S20, DS1822, DS1820)", "authors": [ "Guil Barros", @@ -328,7 +328,9 @@ "url": "https://github.com/EnviroDIY/GroPointModbus.git", "version": "~0.1.0", "note": "A library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", - "authors": ["Anthony Aufdenkampe"], + "authors": [ + "Anthony Aufdenkampe" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" } diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index b924314fe..212aff743 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -486,7 +486,7 @@ String Logger::formatDateTime_ISO8601(DateTime& dt) { tzString = tzString.substring(0, 1) + '0' + tzString.substring(1, 2) + F(":00"); } else if (_loggerTimeZone == 0) { - tzString = 'Z'; + tzString = "Z"; } else if (0 < _loggerTimeZone && _loggerTimeZone < 10) { tzString = "+0" + tzString + F(":00"); } else if (10 <= _loggerTimeZone && _loggerTimeZone <= 24) { diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index c44bc3c0e..a874915ab 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -106,14 +106,14 @@ bool DigiXBeeWifi::extraModemSetup(void) { gsmModem.getSeries(); _modemName = gsmModem.getModemName(); String xbeeSnLow = gsmModem.sendATGetString( - F("SL")); // Request Module MAC/Serial Number Low + GFP("SL")); // Request Module MAC/Serial Number Low String xbeeSnHigh = gsmModem.sendATGetString( - F("SH")); // Request Module MAC/Serial Number High + GFP("SH")); // Request Module MAC/Serial Number High _modemSerialNumber = xbeeSnHigh + xbeeSnLow; _modemHwVersion = - gsmModem.sendATGetString(F("HV")); // Request Module Hw Version + gsmModem.sendATGetString(GFP("HV")); // Request Module Hw Version _modemFwVersion = - gsmModem.sendATGetString(F("VR")); // Firmware Version + gsmModem.sendATGetString(GFP("VR")); // Firmware Version PRINTOUT(F("Digi XBee"), _modemName, F("Mac/SN"), xbeeSnHigh, xbeeSnLow, F("HwVer"), _modemHwVersion, F("FwVer"), _modemFwVersion); diff --git a/src/sensors/SDI12Sensors.cpp b/src/sensors/SDI12Sensors.cpp index e7fb298be..caa93c502 100644 --- a/src/sensors/SDI12Sensors.cpp +++ b/src/sensors/SDI12Sensors.cpp @@ -550,7 +550,8 @@ bool SDI12Sensors::addSingleMeasurementResult(void) { // that the measurement is ready. uint32_t timerStart = millis(); - while ((millis() - timerStart) < (1000 * (wait))) { + while ((millis() - timerStart) < + static_cast(1000 * (wait))) { // sensor can interrupt us to let us know it is done early if (_SDI12Internal.available()) { #ifdef MS_SDI12SENSORS_DEBUG_DEEP From c96337b19eccd801fcabec8b2686c09430fd9dd2 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 15:02:15 -0400 Subject: [PATCH 81/89] CI adjustments Signed-off-by: Sara Damiano --- .github/workflows/build_examples.yaml | 2 +- .gitignore | 1 + continuous_integration/generate_job_matrix.py | 4 +- continuous_integration/platformio.ini | 41 ++++++++++++++----- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml index f2dd49d77..fd60ce965 100644 --- a/.github/workflows/build_examples.yaml +++ b/.github/workflows/build_examples.yaml @@ -179,7 +179,7 @@ jobs: runs-on: ubuntu-latest needs: [generate_matrix, determine_library_source] env: - LIBRARY_INSTALL_GIT: ${{ needs.determine_library_source.outputs.library_install_zip }} + LIBRARY_INSTALL_GIT: ${{ needs.determine_library_source.outputs.library_install_git }} strategy: matrix: job_info: ${{ fromJSON(needs.generate_matrix.outputs.pio_job_matrix) }} diff --git a/.gitignore b/.gitignore index 016e2171b..323e9ac4c 100644 --- a/.gitignore +++ b/.gitignore @@ -110,3 +110,4 @@ arduino_cli.log **/sensor_tests/* docs/Doxyfile.bak continuous_integration/output_check_component_inclusion.log +continuous_integration/platformio_ci_local.ini diff --git a/continuous_integration/generate_job_matrix.py b/continuous_integration/generate_job_matrix.py index d4ed318ea..495ee97ff 100644 --- a/continuous_integration/generate_job_matrix.py +++ b/continuous_integration/generate_job_matrix.py @@ -112,8 +112,6 @@ def create_pio_ci_command(pio_env_file: str, pio_env: str, code_subfolder: str) # "--verbose", "--project-conf", pio_env_file, - "--project-conf", - pio_env_file, "--environment", pio_env, os.path.join(examples_path, code_subfolder), @@ -314,7 +312,7 @@ def extend_pio_config(added_envs): # %% read build flags out of the menu-a-la-cart example # Pattern for flags in the menu-a-la-cart example pattern = re.compile( - "^(?:#if|#elif) defined[\s\(](?PBUILD_\w+)((?:[\s\n\\\)]*?\|\|[\s\n\\]*defined[\s\n\\\(]*?)(?PBUILD_\w+))*", + r"^(?:#if|#elif) defined[\s\(](?PBUILD_\w+)((?:[\s\n\\\)]*?\|\|[\s\n\\]*defined[\s\n\\\(]*?)(?PBUILD_\w+))*", re.MULTILINE, ) diff --git a/continuous_integration/platformio.ini b/continuous_integration/platformio.ini index ee9ea3d7a..ee48936ef 100644 --- a/continuous_integration/platformio.ini +++ b/continuous_integration/platformio.ini @@ -6,20 +6,13 @@ ; Advanced options: extra scripting ; ; Please visit documentation for the other options and examples -; http://docs.platformio.org/page/projectconf.html -; -; src_dir = sensor_tests/XBee_Command -; src_dir = examples/logger_test/ -; build_flags = -E -dD -; +; https://docs.platformio.org/page/projectconf.html [platformio] [env] framework = arduino lib_ldf_mode = deep+ -build_flags = - -D SDI12_EXTERNAL_PCINT lib_ignore = Adafruit NeoPixel Adafruit GFX Library @@ -28,6 +21,10 @@ lib_ignore = Adafruit STMPE610 Adafruit TouchScreen Adafruit ILI9341 +build_flags = + -Wextra + -D SDI12_EXTERNAL_PCINT + -D NEOSWSERIAL_EXTERNAL_PCINT [env:Mayfly] board = mayfly @@ -49,7 +46,6 @@ lib_ignore = build_flags = ${env.build_flags} - [env:ArduinoZero] platform = atmelsam board = zeroUSB @@ -62,10 +58,35 @@ lib_ignore = build_flags = ${env.build_flags} - [env:AdafruitFeatherM0] platform = atmelsam board = adafruit_feather_m0 +lib_ignore = + ${env.lib_ignore} + SoftwareSerial_ExtInts + AltSoftSerial + NeoSWSerial + SoftwareWire +build_unflags = -D USE_TINYUSB + +[env:AdafruitFeatherM4] +platform = atmelsam +board = adafruit_feather_m4 +lib_ignore = + ${env.lib_ignore} + SoftwareSerial_ExtInts + AltSoftSerial + NeoSWSerial + SoftwareWire +build_unflags = -D USE_TINYUSB + +[env:adafruit_grandcentral_m4] +platform = atmelsam +board = adafruit_grandcentral_m4 +framework = arduino +lib_deps = + ${env.lib_deps} + RTCZero lib_ignore = ${env.lib_ignore} SoftwareSerial_ExtInts From 2e543140858a5103e95e50ef7c24a149bdd25225 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 15:49:44 -0400 Subject: [PATCH 82/89] Bump dependencies, fix file reference for SDFat 2.2.3 Signed-off-by: Sara Damiano --- ChangeLog.md | 1 + continuous_integration/dependencies.json | 106 ++++++----------------- library.json | 18 ++-- src/LoggerBase.cpp | 2 +- src/LoggerBase.h | 2 +- 5 files changed, 37 insertions(+), 92 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 67d73b31d..54f53cbc7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -49,6 +49,7 @@ If you are not using the GroPoint sensors which require many variables, I recomm - Minor bug fixes for XBee Wifi - Handle no SIM card response from SIM7080G (EnviroDIY LTE Bee) - Fixed Keller debugging output. +- Fixed file reference for SDFat 2.2.3 ### Known Issues - The modem hardware, firmware, and serial number is only implemented for the Digi XBee WiFi. diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 86575f6a3..874230ccb 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -8,10 +8,7 @@ "url": "https://github.com/EnviroDIY/Sodaq_DS3231", "version": "~1.3.4", "note": "An Arduino library for the DS3231 RTC (Real Time Clock), based off of the Sodaq_DS3231 library.", - "authors": [ - "Kees Bakker", - "Sara Damiano" - ], + "authors": ["Kees Bakker", "Sara Damiano"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -22,9 +19,7 @@ "url": "https://github.com/arduino-libraries/RTCZero", "version": "~1.6.0", "note": "Functions for using the processor real time clock in SAMD21 processors", - "authors": [ - "Arduino" - ], + "authors": ["Arduino"], "frameworks": "arduino", "platforms": "atmelsam" }, @@ -35,9 +30,7 @@ "url": "https://github.com/GreyGnome/EnableInterrupt", "version": "~1.1.0", "note": "GreyGnome's EnableInterrupt - Assign an interrupt to any supported pin on all Arduinos", - "authors": [ - "Mike 'GreyGnome' Schwager" - ], + "authors": ["Mike 'GreyGnome' Schwager"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -48,9 +41,7 @@ "url": "https://github.com/greiman/SdFat", "version": "~2.2.3", "note": "SdFat - FAT16/FAT32 file system for SD cards.", - "authors": [ - "Bill Greiman" - ], + "authors": ["Bill Greiman"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -59,10 +50,7 @@ "owner": "vshymanskyy", "version": "~0.11.7", "note": "A small Arduino library for GPRS modules.", - "authors": [ - "Volodymyr Shymanskyy", - "Sara Damiano" - ], + "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -73,9 +61,7 @@ "url": "https://github.com/knolleary/pubsubclient", "version": "~2.8", "note": "A client library for MQTT messaging.", - "authors": [ - "Nick O'Leary" - ] + "authors": ["Nick O'Leary"] }, { "name": "Adafruit BusIO", @@ -84,9 +70,7 @@ "url": "https://github.com/adafruit/Adafruit_BusIO", "version": "~1.16.0", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -97,9 +81,7 @@ "url": "https://github.com/adafruit/Adafruit_Sensor", "version": "~1.1.14", "note": "Adafruit's unified sensor library is used by their other libraries", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -109,9 +91,7 @@ "version_note": "=1.2.0", "version": "https://github.com/soligen2010/Adafruit_ADS1X15.git#7d67b451f739e9a63f40f2d6d139ab582258572b", "note": "Driver for TI's ADS1015: 12-bit Differential or Single-Ended ADC with PGA and Comparator. This fork removes bugs in the Adafruit original library.", - "authors_note": [ - "soligen2010" - ], + "authors_note": ["soligen2010"], "frameworks_note": "arduino", "platforms_note": "*" }, @@ -122,9 +102,7 @@ "url": "https://github.com/adafruit/Adafruit_AM2315", "version": "~2.2.3", "note": "AOSong AM2315 I2C Temp/Humidity Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -135,9 +113,7 @@ "url": "https://github.com/adafruit/Adafruit_BME280_Library", "version": "~2.2.4", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -146,9 +122,7 @@ "owner": "MartinL1", "version": "~1.0.11", "note": "An Arduino compatible, non-blocking, I2C/SPI library for the Bosch BMP388 barometer.", - "authors": [ - "Martin Lindupp" - ], + "authors": ["Martin Lindupp"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -159,9 +133,7 @@ "url": "https://github.com/adafruit/DHT-sensor-library", "version": "~1.4.6", "note": "AOSong DHT Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -172,9 +144,7 @@ "url": "https://github.com/adafruit/Adafruit_INA219", "version": "~1.2.3", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -185,9 +155,7 @@ "url": "https://github.com/adafruit/Adafruit_MPL115A2", "version": "~2.0.2", "note": "MPL115A2 Barometer Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino" }, { @@ -197,9 +165,7 @@ "url": "https://github.com/adafruit/Adafruit_SHT4X", "version": "~1.0.4", "note": "Sensirion SHT4x Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino" }, { @@ -233,12 +199,7 @@ "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library", "version": "~3.11.0", "note": "DallasTemperature - Arduino Library for Dallas Temperature ICs (DS18B20, DS18S20, DS1822, DS1820)", - "authors": [ - "Guil Barros", - "Miles Burton", - "Rob Tillart", - "Tim Nuewsome" - ], + "authors": ["Guil Barros", "Miles Burton", "Rob Tillart", "Tim Nuewsome"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -265,22 +226,14 @@ "url": "https://github.com/NorthernWidget/MS5803", "version": "~0.1.2", "note": "General interface to MS5803-series pressure transducers", - "authors": [ - "Bobby Schulz", - "Andrew Wickert", - "Chad Sandell", - "Sara Damiano" - ] + "authors": ["Bobby Schulz", "Andrew Wickert", "Chad Sandell", "Sara Damiano"] }, { "name": "Tally_Library_I2C", "version": "https://github.com/EnviroDIY/Tally_Library.git#Dev_I2C", "version_note": "Uses `Dev_I2C` feature branch", "note": "An Arduino library for interfacing to the Project Tally Event counter from NorthernWidget.", - "authors": [ - "Bobby Schulz", - "Anthony Aufdenkampe" - ], + "authors": ["Bobby Schulz", "Anthony Aufdenkampe"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -291,9 +244,7 @@ "url": "https://github.com/EnviroDIY/SensorModbusMaster", "version": "~0.6.8", "note": "EnviroDIY SensorModbusMaster - Arduino library for communicating via modbus with the Arduino acting as the modbus master.", - "authors": [ - "Sara Damiano" - ], + "authors": ["Sara Damiano"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -304,21 +255,16 @@ "url": "https://github.com/EnviroDIY/KellerModbus", "version": "~0.2.2", "note": "Arduino library for communication with Keller pressure and water level sensors via Modbus.", - "authors": [ - "Anthony Aufdenkampe" - ] + "authors": ["Anthony Aufdenkampe"] }, { "name": "YosemitechModbus", "owner": "envirodiy", "library id": "2078", "url": "https://github.com/EnviroDIY/YosemitechModbus", - "version": "~0.4.0", + "version": "~0.4.1", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", - "authors": [ - "Sara Damiano", - "Anthony Aufdenkampe" - ], + "authors": ["Sara Damiano", "Anthony Aufdenkampe"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -328,11 +274,9 @@ "url": "https://github.com/EnviroDIY/GroPointModbus.git", "version": "~0.1.0", "note": "A library to use an Arduino as a master to control and communicate via modbus with GroPoint soil moisture sensors. ", - "authors": [ - "Anthony Aufdenkampe" - ], + "authors": ["Anthony Aufdenkampe"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" } ] -} \ No newline at end of file +} diff --git a/library.json b/library.json index a20b4dad4..687ebf63a 100644 --- a/library.json +++ b/library.json @@ -100,7 +100,7 @@ "owner": "greiman", "library id": "322", "url": "https://github.com/greiman/SdFat", - "version": "~2.1.2", + "version": "~2.2.3", "note": "SdFat - FAT16/FAT32 file system for SD cards.", "authors": ["Bill Greiman"], "frameworks": "arduino", @@ -129,7 +129,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO", - "version": "~1.11.6", + "version": "~1.16.0", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": ["Adafruit"], "frameworks": "arduino", @@ -140,7 +140,7 @@ "owner": "adafruit", "library id": "31", "url": "https://github.com/adafruit/Adafruit_Sensor", - "version": "~1.1.13", + "version": "~1.1.14", "note": "Adafruit's unified sensor library is used by their other libraries", "authors": ["Adafruit"], "frameworks": "arduino", @@ -172,7 +172,7 @@ "owner": "adafruit", "library id": "166", "url": "https://github.com/adafruit/Adafruit_BME280_Library", - "version": "~2.2.2", + "version": "~2.2.4", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino", @@ -192,7 +192,7 @@ "owner": "adafruit", "library id": "19", "url": "https://github.com/adafruit/DHT-sensor-library", - "version": "~1.4.4", + "version": "~1.4.6", "note": "AOSong DHT Sensor Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino", @@ -203,7 +203,7 @@ "owner": "adafruit", "library id": "160", "url": "https://github.com/adafruit/Adafruit_INA219", - "version": "~1.2.1", + "version": "~1.2.3", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", "authors": ["Adafruit"], "frameworks": "arduino", @@ -234,7 +234,7 @@ "owner": "paulstoffregen", "library id": "1", "url": "https://github.com/PaulStoffregen/OneWire", - "version": "~2.3.7", + "version": "~2.3.8", "note": "OneWire - Control 1-Wire protocol (DS18S20, DS18B20, DS2408 and etc)", "authors": [ "Paul Stoffregen", @@ -258,7 +258,7 @@ "owner": "milesburton", "library id": "54", "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library", - "version": "~3.9.1", + "version": "~3.11.0", "note": "DallasTemperature - Arduino Library for Dallas Temperature ICs (DS18B20, DS18S20, DS1822, DS1820)", "authors": ["Guil Barros", "Miles Burton", "Rob Tillart", "Tim Nuewsome"], "frameworks": "arduino", @@ -323,7 +323,7 @@ "owner": "envirodiy", "library id": "2078", "url": "https://github.com/EnviroDIY/YosemitechModbus", - "version": "~0.4.0", + "version": "~0.4.1", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", "authors": ["Sara Damiano", "Anthony Aufdenkampe"], "frameworks": "arduino", diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 212aff743..eaeb0de72 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -1039,7 +1039,7 @@ bool Logger::initializeSDCard(void) { // Protected helper function - This sets a timestamp on a file -void Logger::setFileTimestamp(File fileToStamp, uint8_t stampFlag) { +void Logger::setFileTimestamp(File& fileToStamp, uint8_t stampFlag) { DateTime dt = dtFromEpoch(getNowLocalEpoch()); fileToStamp.timestamp(stampFlag, dt.year(), dt.month(), dt.date(), diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 913f8d379..a7a8c1ef9 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -1060,7 +1060,7 @@ class Logger { * @param stampFlag The "flag" of the timestamp to change - should be * T_CREATE, T_WRITE, or T_ACCESS */ - void setFileTimestamp(File fileToStamp, uint8_t stampFlag); + void setFileTimestamp(File& fileToStamp, uint8_t stampFlag); /** * @brief Open or creates a file, converting a string file name to a From 7acf8510141a59600aacd86ecf27f639dd1ddfb9 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 16:13:07 -0400 Subject: [PATCH 83/89] Bump download artifact version Signed-off-by: Sara Damiano --- .github/workflows/build_examples.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml index fd60ce965..38ce0ac8b 100644 --- a/.github/workflows/build_examples.yaml +++ b/.github/workflows/build_examples.yaml @@ -150,7 +150,7 @@ jobs: sh continuous_integration/install-test-version-arduino-cli.sh - name: Download the prepared examples - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: generated_examples path: | @@ -222,7 +222,7 @@ jobs: pio pkg install -g --library ${{ env.LIBRARY_INSTALL_GIT }} - name: Download the prepared examples - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: generated_examples path: | From 6c3df68519ed3d38ceaee63d2eebad1b4a343cf7 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 16:16:21 -0400 Subject: [PATCH 84/89] Shorten env names Signed-off-by: Sara Damiano --- continuous_integration/platformio.ini | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/continuous_integration/platformio.ini b/continuous_integration/platformio.ini index ee48936ef..b3bf29540 100644 --- a/continuous_integration/platformio.ini +++ b/continuous_integration/platformio.ini @@ -46,7 +46,7 @@ lib_ignore = build_flags = ${env.build_flags} -[env:ArduinoZero] +[env:Zero] platform = atmelsam board = zeroUSB lib_ignore = @@ -58,7 +58,7 @@ lib_ignore = build_flags = ${env.build_flags} -[env:AdafruitFeatherM0] +[env:FeatherM0] platform = atmelsam board = adafruit_feather_m0 lib_ignore = @@ -69,7 +69,7 @@ lib_ignore = SoftwareWire build_unflags = -D USE_TINYUSB -[env:AdafruitFeatherM4] +[env:FeatherM4] platform = atmelsam board = adafruit_feather_m4 lib_ignore = @@ -80,7 +80,7 @@ lib_ignore = SoftwareWire build_unflags = -D USE_TINYUSB -[env:adafruit_grandcentral_m4] +[env:GrandCentralM4] platform = atmelsam board = adafruit_grandcentral_m4 framework = arduino From d2450460cfaf3a55c5fc1c2dd365c7c4897d2ab3 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 17:25:04 -0400 Subject: [PATCH 85/89] SAMD51 watchdog fix Signed-off-by: Sara Damiano --- src/ModSensorDebugger.h | 2 +- src/WatchDogs/WatchDogSAMD.cpp | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/ModSensorDebugger.h b/src/ModSensorDebugger.h index 669f07ace..7561c33ff 100644 --- a/src/ModSensorDebugger.h +++ b/src/ModSensorDebugger.h @@ -1,5 +1,5 @@ /** - * @file ModSensorDebugger.h + * @file ModSensorDebugger.h * @copyright Stroud Water Research Center * Part of the EnviroDIY ModularSensors library for Arduino. * This library is published under the BSD-3 license. diff --git a/src/WatchDogs/WatchDogSAMD.cpp b/src/WatchDogs/WatchDogSAMD.cpp index 0a78677a2..ff63e78bd 100644 --- a/src/WatchDogs/WatchDogSAMD.cpp +++ b/src/WatchDogs/WatchDogSAMD.cpp @@ -98,10 +98,19 @@ void extendedWatchDogSAMD::setupWatchDog(uint32_t resetTime_s) { #endif // Set up the watch dog control parameters - WDT->CTRL.bit.WEN = 0; // Disable window mode - waitForWDTBitSync(); // ?? Needed here ?? +#if defined(__SAMD51__) + WDT->CTRLA.bit.WEN = 0; // Disable window mode +#else + WDT->CTRL.bit.WEN = 0; // Disable window mode +#endif + waitForWDTBitSync(); // ?? Needed here ?? +#if defined(__SAMD51__) + WDT->CTRLA.bit.ALWAYSON = 0; // NOT always on! +#else WDT->CTRL.bit.ALWAYSON = 0; // NOT always on! - waitForWDTBitSync(); // ?? Needed here ?? +#endif + + waitForWDTBitSync(); // ?? Needed here ?? WDT->CONFIG.bit.PER = 0xB; // Period = 16384 clockcycles @ 1024hz = 16 seconds @@ -135,7 +144,7 @@ void extendedWatchDogSAMD::enableWatchDog() { #if defined(__SAMD51__) WDT->CTRLA.bit.ENABLE = 1; #else - WDT->CTRL.bit.ENABLE = 1; + WDT->CTRL.bit.ENABLE = 1; #endif waitForWDTBitSync(); } @@ -145,7 +154,7 @@ void extendedWatchDogSAMD::disableWatchDog() { #if defined(__SAMD51__) WDT->CTRLA.bit.ENABLE = 0; #else - WDT->CTRL.bit.ENABLE = 0; + WDT->CTRL.bit.ENABLE = 0; #endif waitForWDTBitSync(); MS_DBG(F("Watch dog disabled.")); From 16966014126ece5814db12ebd086f2e2ec8e90c8 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 17:45:31 -0400 Subject: [PATCH 86/89] Workaround for boards not supported by Enable Interrupts Signed-off-by: Sara Damiano --- examples/DRWI_2G/DRWI_2G.ino | 4 --- examples/DRWI_DigiLTE/DRWI_DigiLTE.ino | 4 --- examples/DRWI_Mayfly1/DRWI_Mayfly1.ino | 4 --- .../DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino | 4 --- examples/DRWI_NoCellular/DRWI_NoCellular.ino | 4 --- examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino | 4 --- .../baro_rho_correction.ino | 4 --- examples/data_saving/data_saving.ino | 4 --- examples/double_logger/double_logger.ino | 4 --- examples/logging_to_MMW/logging_to_MMW.ino | 4 --- .../logging_to_ThingSpeak.ino | 4 --- examples/menu_a_la_carte/menu_a_la_carte.ino | 4 --- examples/simple_logging/simple_logging.ino | 4 --- .../simple_logging_LearnEnviroDIY.ino | 4 --- src/LoggerBase.cpp | 2 +- src/ModSensorInterrupts.h | 29 +++++++++++++++++++ src/ModularSensors.h | 5 +++- src/sensors/SDI12Sensors.cpp | 10 +++++-- 18 files changed, 42 insertions(+), 60 deletions(-) create mode 100644 src/ModSensorInterrupts.h diff --git a/examples/DRWI_2G/DRWI_2G.ino b/examples/DRWI_2G/DRWI_2G.ino index 853be8352..f87e4d531 100644 --- a/examples/DRWI_2G/DRWI_2G.ino +++ b/examples/DRWI_2G/DRWI_2G.ino @@ -32,10 +32,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino index e0a0286ff..c051cf25f 100644 --- a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino +++ b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino @@ -32,10 +32,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino index aaf59c6ce..469752715 100644 --- a/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino +++ b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino @@ -38,10 +38,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino b/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino index 86caf5eea..5ca4cb510 100644 --- a/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino +++ b/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino @@ -38,10 +38,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/DRWI_NoCellular/DRWI_NoCellular.ino b/examples/DRWI_NoCellular/DRWI_NoCellular.ino index 27eb408fe..e5928cedb 100644 --- a/examples/DRWI_NoCellular/DRWI_NoCellular.ino +++ b/examples/DRWI_NoCellular/DRWI_NoCellular.ino @@ -20,10 +20,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino index fee9b0a72..3b08000e3 100644 --- a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino +++ b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino @@ -39,10 +39,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/baro_rho_correction/baro_rho_correction.ino b/examples/baro_rho_correction/baro_rho_correction.ino index 5d5eff405..929f08184 100644 --- a/examples/baro_rho_correction/baro_rho_correction.ino +++ b/examples/baro_rho_correction/baro_rho_correction.ino @@ -34,10 +34,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/data_saving/data_saving.ino b/examples/data_saving/data_saving.ino index 75272d7fe..ce4e179ac 100644 --- a/examples/data_saving/data_saving.ino +++ b/examples/data_saving/data_saving.ino @@ -33,10 +33,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/double_logger/double_logger.ino b/examples/double_logger/double_logger.ino index 462991c36..85f7f2f63 100644 --- a/examples/double_logger/double_logger.ino +++ b/examples/double_logger/double_logger.ino @@ -32,10 +32,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/logging_to_MMW/logging_to_MMW.ino b/examples/logging_to_MMW/logging_to_MMW.ino index a4e124826..d48d98046 100644 --- a/examples/logging_to_MMW/logging_to_MMW.ino +++ b/examples/logging_to_MMW/logging_to_MMW.ino @@ -32,10 +32,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino b/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino index 4f8692421..7a0044662 100644 --- a/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino +++ b/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino @@ -35,10 +35,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 46fdb76f3..89ceb7e85 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -36,10 +36,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/simple_logging/simple_logging.ino b/examples/simple_logging/simple_logging.ino index ecd48f9a0..a31804449 100644 --- a/examples/simple_logging/simple_logging.ino +++ b/examples/simple_logging/simple_logging.ino @@ -20,10 +20,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino b/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino index 8edde3546..5edeaa3ab 100644 --- a/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino +++ b/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino @@ -20,10 +20,6 @@ // The Arduino library is needed for every Arduino program. #include -// EnableInterrupt is used by ModularSensors for external and pin change -// interrupts and must be explicitly included in the main program. -#include - // Include the main header for ModularSensors #include /** End [includes] */ diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index eaeb0de72..d3ebe3464 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -18,7 +18,7 @@ */ #define LIBCALL_ENABLEINTERRUPT // To handle external and pin change interrupts -#include +#include "ModSensorInterrupts.h" // For all i2c communication, including with the real time clock #include diff --git a/src/ModSensorInterrupts.h b/src/ModSensorInterrupts.h new file mode 100644 index 000000000..cb3650f81 --- /dev/null +++ b/src/ModSensorInterrupts.h @@ -0,0 +1,29 @@ +/** + * @file ModSensorInterrupts.h + * @copyright Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino. + * This library is published under the BSD-3 license. + * @author Sara Geleskie Damiano + * + * @brief A work-around for the AVR interrupt library not supporting SAMD + * boards. That libary isn't necessary for them. + */ + + +// Header Guards +#ifndef SRC_MODSENSORINTERRUPTS_H_ +#define SRC_MODSENSORINTERRUPTS_H_ + +#if defined(__AVR__) || defined(ARDUINO_ARCH_AVR) || defined __SAM3U4E__ || \ + defined __SAM3X8E__ || defined __SAM3X8H__ || defined ARDUINO_SAMD_ZERO || \ + defined __SAMD21G18A__ || defined __SAMD21J18A__ +// #define LIBCALL_ENABLEINTERRUPT // To prevent compiler/linker crashes +#include // To handle external and pin change interrupts +#else +#define enableInterrupt(pin, userFunc, mode) \ + attachInterrupt(pin, userFunc, mode) +#define disableInterrupt(pin) detachInterrupt(pin) +#endif + + +#endif // SRC_MODSENSORINTERRUPTS_H_ diff --git a/src/ModularSensors.h b/src/ModularSensors.h index df503b6d6..313cb58cd 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -5,7 +5,7 @@ * This library is published under the BSD-3 license. * @author Sara Geleskie Damiano * - * @brief A simple include file for the Arduino command line interface (CLI).s + * @brief A simple include file for the Arduino command line interface (CLI). */ // Header Guards @@ -21,6 +21,9 @@ */ #define MODULAR_SENSORS_VERSION "0.35.0" +// To support interrupts +#include "ModSensorInterrupts.h" + // To get all of the base classes for ModularSensors, include LoggerBase. // NOTE: Individual sensor definitions must be included separately. #include "LoggerBase.h" diff --git a/src/sensors/SDI12Sensors.cpp b/src/sensors/SDI12Sensors.cpp index caa93c502..132f5929e 100644 --- a/src/sensors/SDI12Sensors.cpp +++ b/src/sensors/SDI12Sensors.cpp @@ -8,8 +8,14 @@ * @brief Implements the SDI12Sensors class. */ -#define LIBCALL_ENABLEINTERRUPT // To prevent compiler/linker crashes -#include // To handle external and pin change interrupts +/** + * @brief To prevent compiler/linker crashes with enable interrupt library, we + * must define LIBCALL_ENABLEINTERRUPT before importing EnableInterrupt within a + * library. + */ +#define LIBCALL_ENABLEINTERRUPT +// To handle external and pin change interrupts +#include "ModSensorInterrupts.h" #include "SDI12Sensors.h" From 336e3128d668b6c36166ff64a2f0bf67d9e150b9 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 16 May 2024 18:26:36 -0400 Subject: [PATCH 87/89] No M4 for now Signed-off-by: Sara Damiano --- continuous_integration/platformio.ini | 46 ++++++++++++--------------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/continuous_integration/platformio.ini b/continuous_integration/platformio.ini index b3bf29540..9549ee2b6 100644 --- a/continuous_integration/platformio.ini +++ b/continuous_integration/platformio.ini @@ -69,30 +69,24 @@ lib_ignore = SoftwareWire build_unflags = -D USE_TINYUSB -[env:FeatherM4] -platform = atmelsam -board = adafruit_feather_m4 -lib_ignore = - ${env.lib_ignore} - SoftwareSerial_ExtInts - AltSoftSerial - NeoSWSerial - SoftwareWire -build_unflags = -D USE_TINYUSB +; [env:FeatherM4] +; platform = atmelsam +; board = adafruit_feather_m4 +; lib_ignore = +; ${env.lib_ignore} +; SoftwareSerial_ExtInts +; AltSoftSerial +; NeoSWSerial +; SoftwareWire +; build_unflags = -D USE_TINYUSB -[env:GrandCentralM4] -platform = atmelsam -board = adafruit_grandcentral_m4 -framework = arduino -lib_deps = - ${env.lib_deps} - RTCZero -lib_ignore = - ${env.lib_ignore} - SoftwareSerial_ExtInts - AltSoftSerial - NeoSWSerial - SoftwareWire -build_flags = - ${env.build_flags} -build_unflags = -D USE_TINYUSB +; [env:GrandCentralM4] +; platform = atmelsam +; board = adafruit_grandcentral_m4 +; lib_ignore = +; ${env.lib_ignore} +; SoftwareSerial_ExtInts +; AltSoftSerial +; NeoSWSerial +; SoftwareWire +; build_unflags = -D USE_TINYUSB From 6db4f4bfe3dda804fabb0f9a6a83607e4d791cdf Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 17 May 2024 12:37:53 -0400 Subject: [PATCH 88/89] No RTCZero for M4 Signed-off-by: Sara Damiano --- .gitignore | 1 + continuous_integration/platformio.ini | 10 ++++++++++ pioScripts/generate_compile_commands.py | 7 ++++++- src/LoggerBase.cpp | 6 +++--- src/LoggerBase.h | 5 ++++- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 323e9ac4c..9c278f49b 100644 --- a/.gitignore +++ b/.gitignore @@ -111,3 +111,4 @@ arduino_cli.log docs/Doxyfile.bak continuous_integration/output_check_component_inclusion.log continuous_integration/platformio_ci_local.ini +pioScripts/install_shared_deps.py diff --git a/continuous_integration/platformio.ini b/continuous_integration/platformio.ini index 9549ee2b6..263173d30 100644 --- a/continuous_integration/platformio.ini +++ b/continuous_integration/platformio.ini @@ -67,6 +67,8 @@ lib_ignore = AltSoftSerial NeoSWSerial SoftwareWire +build_flags = + ${env.build_flags} build_unflags = -D USE_TINYUSB ; [env:FeatherM4] @@ -74,10 +76,14 @@ build_unflags = -D USE_TINYUSB ; board = adafruit_feather_m4 ; lib_ignore = ; ${env.lib_ignore} +; RTCZero ; SoftwareSerial_ExtInts ; AltSoftSerial ; NeoSWSerial ; SoftwareWire +; build_flags = +; ${env.build_flags} +; -D MS_SAMD_DS3231 ; build_unflags = -D USE_TINYUSB ; [env:GrandCentralM4] @@ -85,8 +91,12 @@ build_unflags = -D USE_TINYUSB ; board = adafruit_grandcentral_m4 ; lib_ignore = ; ${env.lib_ignore} +; RTCZero ; SoftwareSerial_ExtInts ; AltSoftSerial ; NeoSWSerial ; SoftwareWire +; build_flags = +; ${env.build_flags} +; -D MS_SAMD_DS3231 ; build_unflags = -D USE_TINYUSB diff --git a/pioScripts/generate_compile_commands.py b/pioScripts/generate_compile_commands.py index 6e584b3a6..f3e9ccaa8 100644 --- a/pioScripts/generate_compile_commands.py +++ b/pioScripts/generate_compile_commands.py @@ -1,8 +1,13 @@ import os + Import("env") +print("Generating compile commands!") + # include toolchain paths env.Replace(COMPILATIONDB_INCLUDE_TOOLCHAIN=True) # override compilation DB path -env.Replace(COMPILATIONDB_PATH=os.path.join("$PROJECT_DIR/.vscode", "compile_commands.json")) \ No newline at end of file +env.Replace( + COMPILATIONDB_PATH=os.path.join("$PROJECT_DIR/.vscode", "compile_commands.json") +) diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index d3ebe3464..cfe4db7bc 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -35,8 +35,8 @@ volatile bool Logger::isLoggingNow = false; volatile bool Logger::isTestingNow = false; volatile bool Logger::startTesting = false; -// Initialize the RTC for the SAMD boards -#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAMD_ZERO) +// Initialize the RTC for the SAMD boards using build in RTC +#if not defined(MS_SAMD_DS3231) && defined(ARDUINO_ARCH_SAMD) RTCZero Logger::zero_sleep_rtc; #endif @@ -1329,7 +1329,7 @@ void Logger::begin() { // Enable the watchdog watchDogTimer.enableWatchDog(); -#if defined ARDUINO_ARCH_SAMD +#if not defined(MS_SAMD_DS3231) && defined(ARDUINO_ARCH_SAMD) MS_DBG(F("Beginning internal real time clock")); zero_sleep_rtc.begin(); #endif diff --git a/src/LoggerBase.h b/src/LoggerBase.h index a7a8c1ef9..57556b40e 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -36,7 +36,9 @@ // Bring in the libraries to handle the processor sleep/standby modes // The SAMD library can also the built-in clock on those modules #if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAMD_ZERO) +#if not defined(MS_SAMD_DS3231) #include +#endif #include "WatchDogs/WatchDogSAMD.h" #elif defined(ARDUINO_ARCH_AVR) || defined(__AVR__) #include @@ -680,7 +682,8 @@ class Logger { // This gets the current epoch time (unix time, ie, the number of seconds // from January 1, 1970 00:00:00 UTC) and corrects it for the specified time // zone -#if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAMD_ZERO) +#if (defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAMD_ZERO)) && \ + not defined(MS_SAMD_DS3231) /** * @brief The RTC object. * From 1c2c2758df0c87f39d49bf723e958fd9566b2c3f Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 17 May 2024 12:40:09 -0400 Subject: [PATCH 89/89] Add missing slash Signed-off-by: Sara Damiano --- .github/workflows/build_examples.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_examples.yaml b/.github/workflows/build_examples.yaml index 38ce0ac8b..bfdc620ee 100644 --- a/.github/workflows/build_examples.yaml +++ b/.github/workflows/build_examples.yaml @@ -83,7 +83,7 @@ jobs: run: | echo "Pull Request from the fork ${{ github.event.pull_request.head.repo.full_name }} at ${{ github.event.pull_request.head.ref }}" echo "LIBRARY_INSTALL_ZIP=https://github.com/${{ github.event.pull_request.head.repo.full_name }}/archive/${{ github.event.pull_request.head.ref }}.zip" >> $GITHUB_ENV - echo "LIBRARY_INSTALL_GIT=https://github.com${{ github.event.pull_request.head.repo.full_name }}.git#${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV + echo "LIBRARY_INSTALL_GIT=https://github.com/${{ github.event.pull_request.head.repo.full_name }}.git#${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV - name: store enviroment variables as output id: store_vars