From 87cd0c995e5f6358fa3c11f25295d3a13e01c6fc Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Mon, 5 Apr 2021 21:07:45 -0500 Subject: [PATCH 01/94] Update RainCounterIC2 to int32. Works! Updating to a 32-bit count enables use with a reed-switch anemometer (https://github.com/EnviroDIY/TippingBucketRainCounter/issues/4) and also fixes a bug described in https://github.com/EnviroDIY/TippingBucketRainCounter/issues/5. Tested and works, including backward compatibility. --- .../RainCounter_simple_logging.ino | 270 ++++++++++++++++++ src/SensorBase.cpp | 5 + src/SensorBase.h | 6 + src/sensors/RainCounterI2C.cpp | 39 ++- 4 files changed, 315 insertions(+), 5 deletions(-) create mode 100644 sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino diff --git a/sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino b/sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino new file mode 100644 index 000000000..b3400617c --- /dev/null +++ b/sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino @@ -0,0 +1,270 @@ +/** ========================================================================= + * @file RainCounter_simple_logging.ino + * @brief Test improvements to RainCounterI2C, based on simple logging example. + * + * @author Sara Geleskie Damiano + * @author Anthony Aufdenkampe + * @copyright (c) 2017-2020 Stroud Water Research Center (SWRC) + * and the EnviroDIY Development Team + * This example is published under the BSD-3 license. + * + * Build Environment: Atom with PlatformIO Core 5.1.1·Home 3.3.4 + * Modular Sensors v0.28.3 as of April 5, 2021 + * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger + * + * DISCLAIMER: + * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. + * ======================================================================= */ + +// ========================================================================== +// 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 + +// To get all of the base classes for ModularSensors, include LoggerBase. +// NOTE: Individual sensor definitions must be included separately. +#include +/** End [includes] */ + + +// ========================================================================== +// Data Logging Options +// ========================================================================== +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "RainCounter_simple_logging.ino"; +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char* LoggerID = "RainCounter_Tester"; +// How frequently (in minutes) to log data +const uint8_t loggingInterval = 1; +// Your logger's timezone. +const int8_t timeZone = -6; // 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; // 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 = A7; // MCU interrupt/alarm pin to wake from sleep +// 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 +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] */ + + +// ========================================================================== +// Using the Processor as a Sensor +// ========================================================================== +/** Start [processor_sensor] */ +#include + +// Create the main processor chip "sensor" - for general metadata +const char* mcuBoardVersion = "v0.5b"; +ProcessorStats mcuBoard(mcuBoardVersion); +/** End [processor_sensor] */ + + +// ========================================================================== +// Maxim DS3231 RTC (Real Time Clock) +// ========================================================================== +/** Start [ds3231] */ +#include // Includes wrapper functions for Maxim DS3231 RTC + +// Create a DS3231 sensor object, using this constructor function: +MaximDS3231 ds3231(1); +/** End [ds3231] */ + + +// ========================================================================== +// Settings for Additional Sensors +// ========================================================================== + +// ========================================================================== +// External I2C Rain Tipping Bucket Counter, connected to an anemometer +// ========================================================================== +/** Start [i2c_rain] */ +#include + +const uint8_t RainCounterI2CAddress = 0x08; +// I2C Address for EnviroDIY external tip counter; 0x08 by default +const float depthPerTipEvent = 0.2; // rain depth in mm per tip event + +// Create a Rain Counter sensor object +RainCounterI2C tbi2c(RainCounterI2CAddress, depthPerTipEvent); + +// Create number of tips and rain depth variable pointers for the tipping bucket +Variable* tbi2cTips = + new RainCounterI2C_Tips(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); +// Variable* tbi2cDepth = +// new RainCounterI2C_Depth(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [i2c_rain] */ + + +// ========================================================================== +// Calculated Variables +// ========================================================================== + +// Create the function to give your calculated result. +// The function should take no input (void) and return a float. +// You can use any named variable pointers to access values by way of +// variable->getValue() + +float calculateWindSpeed(void) { + float windSpeed = -9999; // Always safest to start with a bad value + float period = -9999; // seconds between gettting event counts + float frequency = -9999; // average event frequency in Hz + float eventCount = tbi2cTips->getValue(); + if (eventCount != -9999) // make sure both inputs are good + { + period = loggingInterval * 60.0; // in seconds + frequency = eventCount/period; // average event frequency in Hz + windSpeed = frequency * 2.5 * 1.60934; // in km/h, + // 2.5 mph/Hz & 1.60934 kmph/mph and 2.5 mph/Hz conversion factor from + // https://www.store.inspeed.com/Inspeed-Version-II-Reed-Switch-Anemometer-Sensor-Only-WS2R.htm + } + return windSpeed; +} + +// Properties of the calculated variable +// The number of digits after the decimal place +const uint8_t calculatedVarResolution = 3; +// This must be a value from http://vocabulary.odm2.org/variablename/ +const char *calculatedVarName = "windSpeed"; +// This must be a value from http://vocabulary.odm2.org/units/ +const char *calculatedVarUnit = "KilometerPerHour"; +// A short code for the variable +const char *calculatedVarCode = "WindSpeed"; +// The (optional) universallly unique identifier +const char *calculatedVarUUID = "12345678-abcd-1234-ef00-1234567890ab"; + +// Create a calculated variable pointer and return a variable pointer to it +Variable *calculatedWindSpeed = new Variable( + calculateWindSpeed, calculatedVarResolution, calculatedVarName, + calculatedVarUnit, calculatedVarCode, calculatedVarUUID); + + +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + new ProcessorStats_SampleNumber(&mcuBoard), + new ProcessorStats_FreeRam(&mcuBoard), + new ProcessorStats_Battery(&mcuBoard), + new MaximDS3231_Temp(&ds3231), + // Additional sensor variables can be added here, by copying the syntax + // for creating the variable pointer (FORM1) from the + // `menu_a_la_carte.ino` example + // The example code snippets in the wiki are primarily FORM2. + tbi2cTips, + calculatedWindSpeed, +}; +// Count up the number of pointers in the array +int variableCount = sizeof(variableList) / sizeof(variableList[0]); + +// Create the VariableArray object +VariableArray varArray; +/** End [variable_arrays] */ + + +// ========================================================================== +// The Logger Object[s] +// ========================================================================== +/** Start [loggers] */ +// Create a logger instance +Logger dataLogger; +/** End [loggers] */ + + +// ========================================================================== +// 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); +} +/** End [working_functions] */ + + +// ========================================================================== +// Arduino Setup Function +// ========================================================================== +/** Start [setup] */ +void setup() { + // Start the primary serial connection + Serial.begin(serialBaud); + + // Print a start-up note to the first serial port + Serial.print(F("Now 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); + + // 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(); + + // 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); + + // Set information pins + dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, + greenLED); + + // Begin the variable array[s], logger[s], and publisher[s] + varArray.begin(variableCount, variableList); + dataLogger.begin(LoggerID, loggingInterval, &varArray); + + // Set up the sensors + Serial.println(F("Setting up sensors...")); + varArray.setupSensors(); + + // 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 + dataLogger.createLogFile(true); // true = write a new header + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [setup] */ + + +// ========================================================================== +// Arduino Loop Function +// ========================================================================== +/** Start [loop] */ +void loop() { + dataLogger.logData(); +} +/** End [loop] */ diff --git a/src/SensorBase.cpp b/src/SensorBase.cpp index 5109e154a..afdab42f6 100644 --- a/src/SensorBase.cpp +++ b/src/SensorBase.cpp @@ -362,6 +362,11 @@ void Sensor::verifyAndAddMeasurementResult(uint8_t resultNumber, float float_val = resultValue; // cast the int16_t to a float verifyAndAddMeasurementResult(resultNumber, float_val); } +void Sensor::verifyAndAddMeasurementResult(uint8_t resultNumber, + int32_t resultValue) { + float float_val = resultValue; // cast the int32_t to a float + verifyAndAddMeasurementResult(resultNumber, float_val); +} void Sensor::averageMeasurements(void) { diff --git a/src/SensorBase.h b/src/SensorBase.h index f3ed18ab5..c9f517448 100644 --- a/src/SensorBase.h +++ b/src/SensorBase.h @@ -347,6 +347,12 @@ class Sensor { * @brief Average the results of all measurements by dividing the sum of * all measurements by the number of measurements taken. */ + void verifyAndAddMeasurementResult(uint8_t resultNumber, + int32_t resultValue); + /** + * @brief Average the results of all measurements by dividing the sum of + * all measurements by the number of measurements taken. + */ void averageMeasurements(void); /** diff --git a/src/sensors/RainCounterI2C.cpp b/src/sensors/RainCounterI2C.cpp index d80292d7b..cee837dc5 100644 --- a/src/sensors/RainCounterI2C.cpp +++ b/src/sensors/RainCounterI2C.cpp @@ -96,18 +96,47 @@ bool RainCounterI2C::setup(void) { bool RainCounterI2C::addSingleMeasurementResult(void) { // intialize values float rain = -9999; // Number of mm of rain - int16_t tips = -9999; // Number of tip events + int32_t tips = -9999; // Number of tip events, increased for anemometer // Get data from external tip counter // if the 'requestFrom' returns 0, it means no bytes were received if (_i2c->requestFrom(static_cast(_i2cAddressHex), - static_cast(2))) { + static_cast(4))) { MS_DBG(getSensorNameAndLocation(), F("is reporting:")); - uint8_t Byte1 = _i2c->read(); // Low byte of data - uint8_t Byte2 = _i2c->read(); // High byte of data + uint8_t SerialBuffer[4]; // Create a byte array of 4 bytes + uint8_t byte_in = 0; // Start iterator for reading Bytes + while (Wire.available()) { // slave may send less than requested + SerialBuffer[byte_in] = Wire.read(); + MS_DBG(F(" SerialBuffer["), byte_in, F("] = "), + SerialBuffer[byte_in]); + byte_in++; // increment by 1 + } + + // Concatenate bytes into uint32_t by bit-shifting + // https://thewanderingengineer.com/2015/05/06/sending-16-bit-and-32-bit-numbers-with-arduino-i2c/# + if ( (SerialBuffer[0] > 0) + ) { + // for Slave with libVersion = v0.1.0, which only sends 1-byte + // NOTE: this can not be falsely selected because it would require + // > 16,777,216 counts from a v0.2.0 slave, which is not possible in 24 hours + MS_DBG(F(" Counted with slave libVersion = v0.1.0")); + tips = SerialBuffer[0]; + } else if ( (SerialBuffer[1] == 0) && + (SerialBuffer[2] == 255) ) { + // for Slave with libVersion = v0.1.0, in which no counts are made + // NOTE: this will be falsely selected if exactly 65535 counts + // were made by a v0.2.0 slave + MS_DBG(F(" No counts with slave libVersion = v0.1.0")); + tips = SerialBuffer[0]; + } else { + // for Slave with libVersion >= v0.2.0 + tips = SerialBuffer[0]; + tips = (tips << 8) | SerialBuffer[1]; + tips = (tips << 8) | SerialBuffer[2]; + tips = (tips << 8) | SerialBuffer[3]; + } - tips = (Byte2 << 8) | (Byte1); // Concatenate tip values rain = static_cast(tips) * _rainPerTip; // Multiply by tip coefficient (0.2 by default) From 3cb98142b0723f2e69b4eb9833cdee39354348bb Mon Sep 17 00:00:00 2001 From: "neilh20.gitk" Date: Thu, 16 Sep 2021 15:46:22 -0700 Subject: [PATCH 02/94] Add sensor to read Insitu Level Troll series depth gauges --- examples/test_lt500/.gitignore | 5 + examples/test_lt500/platformio.ini | 43 +++ examples/test_lt500/src/simple_logging.cpp | 227 ++++++++++++ src/sensors/InsituTrollSdi12a.h | 384 +++++++++++++++++++++ 4 files changed, 659 insertions(+) create mode 100644 examples/test_lt500/.gitignore create mode 100644 examples/test_lt500/platformio.ini create mode 100644 examples/test_lt500/src/simple_logging.cpp create mode 100644 src/sensors/InsituTrollSdi12a.h diff --git a/examples/test_lt500/.gitignore b/examples/test_lt500/.gitignore new file mode 100644 index 000000000..89cc49cbd --- /dev/null +++ b/examples/test_lt500/.gitignore @@ -0,0 +1,5 @@ +.pio +.vscode/.browse.c_cpp.db* +.vscode/c_cpp_properties.json +.vscode/launch.json +.vscode/ipch diff --git a/examples/test_lt500/platformio.ini b/examples/test_lt500/platformio.ini new file mode 100644 index 000000000..e7982632c --- /dev/null +++ b/examples/test_lt500/platformio.ini @@ -0,0 +1,43 @@ +; 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 + +[platformio] +description = ModularSensors example logging data to an SD card + +[env:mayfly] +monitor_speed = 115200 +board = mayfly +platform = atmelavr +framework = arduino +lib_ldf_mode = deep+ +lib_ignore = + RTCZero + Adafruit NeoPixel + Adafruit GFX Library + Adafruit SSD1306 + Adafruit ADXL343 + Adafruit STMPE610 + Adafruit TouchScreen + Adafruit ILI9341 +build_flags = + -DSDI12_EXTERNAL_PCINT + -DNEOSWSERIAL_EXTERNAL_PCINT + -DMQTT_MAX_PACKET_SIZE=240 + -DTINY_GSM_RX_BUFFER=64 + -DTINY_GSM_YIELD_MS=2 +lib_deps = + ;envirodiy/EnviroDIY_ModularSensors +; ^^ Use this when working from an official release of the library + https://github.com/EnviroDIY/ModularSensors.git#develop +; ^^ Use this when if you want to pull from the develop branch + https://github.com/PaulStoffregen/AltSoftSerial.git + https://github.com/SRGDamia1/NeoSWSerial.git + https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git +; ^^ These are software serial port emulator libraries, you may not need them diff --git a/examples/test_lt500/src/simple_logging.cpp b/examples/test_lt500/src/simple_logging.cpp new file mode 100644 index 000000000..13feded5f --- /dev/null +++ b/examples/test_lt500/src/simple_logging.cpp @@ -0,0 +1,227 @@ +/** ========================================================================= + * @file simple_logging.ino + * @brief A simple data logging example. + * + * @author Sara Geleskie Damiano + * @copyright (c) 2017-2020 Stroud Water Research Center (SWRC) + * and the EnviroDIY Development Team + * This example is published under the BSD-3 license. + * + * Build Environment: Visual Studios Code with PlatformIO + * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger + * + * DISCLAIMER: + * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. + * ======================================================================= */ + +// ========================================================================== +// 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 +// ========================================================================== +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "simple_logging.ino"; +// 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 = 5; +// 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; // 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 +// 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 +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] */ + + +// ========================================================================== +// Using the Processor as a Sensor +// ========================================================================== +/** Start [processor_sensor] */ +#include + +// Create the main processor chip "sensor" - for general metadata +const char* mcuBoardVersion = "v0.5b"; +ProcessorStats mcuBoard(mcuBoardVersion); +/** End [processor_sensor] */ + + +// ========================================================================== +// Insitu Aqua/Level Troll Pressure, Temperature, and Depth Sensor +// ========================================================================== +#include + +const char* ITROLLSDI12address = "1"; // SDI12 Address ITROLL +const uint8_t ITROLLNumberReadings = 2; // The number of readings to average +const int8_t IT_SDI12Power = + sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) +const int8_t IT_SDI12Data = 7; // The SDI12 data pin + +// Create a ITROLL sensor object +InsituTrollSdi12a itrollPhy(*ITROLLSDI12address, IT_SDI12Power, IT_SDI12Data, + ITROLLNumberReadings); + +// ========================================================================== +// Maxim DS3231 RTC (Real Time Clock) +// ========================================================================== +/** Start [ds3231] */ +#include // Includes wrapper functions for Maxim DS3231 RTC + +// Create a DS3231 sensor object, using this constructor function: +MaximDS3231 ds3231(1); +/** End [ds3231] */ + + +// ========================================================================== +// Settings for Additional Sensors +// ========================================================================== +// Additional sensors can setup here, similar to the RTC, but only if +// they have been supported with ModularSensors wrapper functions. See: +// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started +// Syntax for the include statement and constructor function for each sensor is +// at +// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported +// or can be copied from the `menu_a_la_carte.ino` example + + +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + new InsituTrollSdi12a_Depth(&itrollPhy), + new InsituTrollSdi12a_Temp(&itrollPhy), + new ProcessorStats_SampleNumber(&mcuBoard), + new ProcessorStats_FreeRam(&mcuBoard), + new ProcessorStats_Battery(&mcuBoard), new MaximDS3231_Temp(&ds3231), + + // Additional sensor variables can be added here, by copying the syntax + // for creating the variable pointer (FORM1) from the + // `menu_a_la_carte.ino` example + // The example code snippets in the wiki are primarily FORM2. +}; +// Count up the number of pointers in the array +int variableCount = sizeof(variableList) / sizeof(variableList[0]); + +// Create the VariableArray object +VariableArray varArray; +/** End [variable_arrays] */ + + +// ========================================================================== +// The Logger Object[s] +// ========================================================================== +/** Start [loggers] */ +// Create a logger instance +Logger dataLogger; +/** End [loggers] */ + + +// ========================================================================== +// 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); +} +/** End [working_functions] */ + + +// ========================================================================== +// Arduino Setup Function +// ========================================================================== +/** Start [setup] */ +void setup() { + // Start the primary serial connection + Serial.begin(serialBaud); + + // Print a start-up note to the first serial port + Serial.print(F("Now 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); + + // 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(); + + // 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); + + // Set information pins + dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, + greenLED); + + // Begin the variable array[s], logger[s], and publisher[s] + varArray.begin(variableCount, variableList); + dataLogger.begin(LoggerID, loggingInterval, &varArray); + + // Set up the sensors + Serial.println(F("Setting up sensors...")); + varArray.setupSensors(); + + // 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 + dataLogger.createLogFile(true); // true = write a new header + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [setup] */ + + +// ========================================================================== +// Arduino Loop Function +// ========================================================================== +/** Start [loop] */ +void loop() { + dataLogger.logData(); +} +/** End [loop] */ diff --git a/src/sensors/InsituTrollSdi12a.h b/src/sensors/InsituTrollSdi12a.h new file mode 100644 index 000000000..9b4b0ffbf --- /dev/null +++ b/src/sensors/InsituTrollSdi12a.h @@ -0,0 +1,384 @@ +/* + * @file InsituTrollSdi12a.h + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY modular sensors + * @author Neil Hancock https://github.com/neilh10/ModularSensors/ + * @author Sara Geleskie Damiano + * + * @brief Contains the InsituTrollSdi12a subclass of the SDI12Sensors class + * along with the variable subclasses InsituTrollSdi12a_Pressure, + * InsituTrollSdi12a_Temp, and InsituTrollSdi12a_Depth + * + * These are used for the Insitu Troll. + * The order and units are the default settings for the ITROLL + * + * This depends on the EnviroDIY SDI-12 library and the SDI12Sensors super + * class. + * + */ +/* clang-format off */ +/** + * @defgroup sensor_instutroll Insitu LevelTroll 400 500 700 + * Classes for the Insitru LevelTroll feature sensors pressure, temperature, and depth. + * + * @ingroup sdi12_group + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_instutroll_intro Introduction + * + * > A slim 1.8 cm diameter sensor, + * > depth measuremente temperature compensated to 0.1% (0.05%) across Full Scale depth range and across temperature range. + * > + * > Has an internal logger for reliable data collection. + * > + * > Reports sensor serial number and model in uSD .csv file + + * + * The Insitu Aqua/Level Troll require 8-36VDC + * This can be achieved a Polo #boost device, instructions are at the end + * + * @warning Coming from the factory, Troll sensors are set at SDI-12 address '0'. + * + * The Insitu Aqua/Level Trolls are programmed through WinSitu. + * + * The SDI address needs to be changed to what the class is set to - default is '1'. + * + * Parameters are very flexible and need to be aligned used WinSitu with this module. + * + * The depth sensor third paramter may need to be created. The expected + * paramters and order are Pressure (PSI), Temperature (C), Depth (ft). + * + * Tested with Level Troll 500. + * + * @section sensor_instutroll_datasheet Sensor Datasheet + * Documentation for the SDI-12 Protocol commands and responses + * The Insitu Level/Aqua Troll can be found at: + * + * https://in-situ.com/en/pub/media/support/documents/SDI-12_Commands_Tech_Note.pdf + * + * https://in-situ.com/us/support/documents/sdi-12-commands-and-level-troll-400500700-responses + * + * @section sensor_instutroll_flags Build flags + * @see @ref sdi12_group_flags + * + * @menusnip{instutroll} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_INSITUTROLLSDI12_H_ +#define SRC_SENSORS_INSITUTROLLSDI12_H_ + +// Included Dependencies +#include "sensors/SDI12Sensors.h" + +// Sensor Specific Defines +/** @ingroup sensor_insitutroll */ +/**@{*/ +/// @brief Sensor::_numReturnedValues; the Troll 500 can report 3 values. +#define ITROLLA_NUM_VARIABLES 3 + +/** + * @anchor sensor_insitutroll_timing + * @name Sensor Timing + * The sensor timing for a Insitu Troll + */ +/**@{*/ +/// @brief Sensor::_warmUpTime_ms; maximum warm-up time in SDI-12 mode: 500ms +#define ITROLLA_WARM_UP_TIME_MS 500 + + +/// @brief Sensor::_stabilizationTime_ms; the Troll 500 is stable as soon as it +/// warms up (0ms stabilization). +#define ITROLLA_STABILIZATION_TIME_MS 0 + +/// @brief Sensor::_measurementTime_ms; maximum measurement duration: 500ms. +#define ITROLLA_MEASUREMENT_TIME_MS 500 + +/** + * @anchor sensor_insitutroll_pressure + * @name Pressure + * The pressue variable from a Insitu Troll + * - Range is 0 – x (depends on range eg 5psig) + + * + * {{ @ref InsituTrollSdi12a_Pressure::InsituTrollSdi12a_Pressure }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; conductivity should have 1. + * + * 0 are reported, adding extra digit to resolution to allow the proper number + * of significant figures for averaging - resolution is 0.001 mS/cm = 1 µS/cm + */ +#define ITROLLA_PRESSURE_RESOLUTION 5 +/// @brief Sensor variable number; pressure is stored in sensorValues[0]. +#define ITROLLA_PRESSURE_VAR_NUM 0 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "specificConductance" +#define ITROLLA_PRESSURE_VAR_NAME "pressureGauge" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "pounds per square inch" (psi) +#define ITROLLA_PRESSURE_UNIT_NAME "psi" +/// @brief Default variable short code; "ITROLLpressure" +#define ITROLLA_PRESSURE_DEFAULT_CODE "ITROLLpressure" +/**@}*/ + +/** + * @anchor sensor_insitutroll_temp + * @name Temperature + * The temperature variable from a Insitu Troll + * - Range is -11°C to +49°C + * - Accuracy is ±1°C + * + * {{ @ref InsituTrollSdi12a_Temp::InsituTrollSdi12a_Temp }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; temperature should have 2. + * + * 1 is reported, adding extra digit to resolution to allow the proper number + * of significant figures for averaging - resolution is 0.1°C + */ +#define ITROLLA_TEMP_RESOLUTION 2 +/// @brief Sensor variable number; temperature is stored in sensorValues[1]. +#define ITROLLA_TEMP_VAR_NUM 1 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "temperature" +#define ITROLLA_TEMP_TEMP_VAR_NAME "temperature" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "degreeCelsius" (°C) +#define ITROLLA_TEMP_TEMP_UNIT_NAME "degreeCelsius" +/// @brief Default variable short code; "ITROLLtemp" +#define ITROL_TEMP_DEFAULT_CODE "ITROLLtemp" +/**@}*/ + +/** + * @anchor sensor_insitutroll_depth + * @name Water Depth + * The water depth variable from a Insitu Troll + * - Range is 0 to 3.5m to 350m depending on model + * - Accuracy is ±0.05% of full scale + * + * {{ @ref InsituTrollSdi12a_Depth::InsituTrollSdi12a_Depth }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; depth should have 1. + * + * 0 are reported, adding extra digit to resolution to allow the proper number + * of significant figures for averaging - resolution is 2 mm + */ +#define ITROLLA_DEPTH_RESOLUTION 5 +/// @brief Sensor variable number; depth is stored in sensorValues[2]. +#define ITROLLA_DEPTH_VAR_NUM 2 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "waterDepth" +#define ITROLLA_DEPTH_VAR_NAME "waterDepth" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "millimeter" +#define ITROLLA_DEPTH_UNIT_NAME "feet" +/// @brief Default variable short code; "ITROLLdepth" +#define ITROLLA_DEPTH_DEFAULT_CODE "ITROLLdepth" +/**@}*/ + + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the + * [Insitu Level/Aqua Troll pressure, temperature, and depth sensor](@ref sensor_insitutroll) + * + * @ingroup sensor_insitutroll + */ +/* clang-format on */ + +class InsituTrollSdi12a : public SDI12Sensors { + public: + // Constructors with overloads + /** + * @brief Construct a new ITROLL 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; can be a char, + * char*, or int. + * @warning The SDI-12 address **must** be changed from the factory + * programmed value of "0" before the sensor can be used with + * ModularSensors! + * @param powerPin The pin on the mcu controlling power to the sensor. + * Use -1 if it is continuously powered. + * - The ITROLL requires a 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. + */ + InsituTrollSdi12a(char SDI12address, int8_t powerPin, int8_t dataPin, + uint8_t measurementsToAverage = 1) + : SDI12Sensors(SDI12address, powerPin, dataPin, measurementsToAverage, + "InsituTrollSdi12a", ITROLLA_NUM_VARIABLES, + ITROLLA_WARM_UP_TIME_MS, ITROLLA_STABILIZATION_TIME_MS, + ITROLLA_MEASUREMENT_TIME_MS) {} + InsituTrollSdi12a(char* SDI12address, int8_t powerPin, int8_t dataPin, + uint8_t measurementsToAverage = 1) + : SDI12Sensors(SDI12address, powerPin, dataPin, measurementsToAverage, + "InsituTrollSdi12a", ITROLLA_NUM_VARIABLES, + ITROLLA_WARM_UP_TIME_MS, ITROLLA_STABILIZATION_TIME_MS, + ITROLLA_MEASUREMENT_TIME_MS) {} + InsituTrollSdi12a(int SDI12address, int8_t powerPin, int8_t dataPin, + uint8_t measurementsToAverage = 1) + : SDI12Sensors(SDI12address, powerPin, dataPin, measurementsToAverage, + "InsituTrollSdi12a", ITROLLA_NUM_VARIABLES, + ITROLLA_WARM_UP_TIME_MS, ITROLLA_STABILIZATION_TIME_MS, + ITROLLA_MEASUREMENT_TIME_MS) {} + /** + * @brief Destroy the ITROL object + */ + ~InsituTrollSdi12a() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [pressure output](@ref sensor_insitutroll_pressure) from a + * [Insitu Troll 3-in-1 water level sensor.](@ref sensor_insitutroll) + * + * @ingroup sensor_insitutroll + */ +/* clang-format on */ +class InsituTrollSdi12a_Pressure : public Variable { + public: + /** + * @brief Construct a new InsituTrollSdi12a_Pressure object. + * + * @param parentSense The parent InsituTrollSdi12a providing 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 "ITROLLPressure". + */ + InsituTrollSdi12a_Pressure( + Sensor* parentSense, const char* uuid = "", + const char* varCode = ITROLLA_PRESSURE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)ITROLLA_PRESSURE_VAR_NUM, + (uint8_t)ITROLLA_PRESSURE_RESOLUTION, + ITROLLA_PRESSURE_VAR_NAME, ITROLLA_PRESSURE_UNIT_NAME, + varCode, uuid) {} + /** + * @brief Construct a new InsituTrollSdi12a_Pressure object. + * + * @note This must be tied with a parent InsituTrollSdi12a before it can be + * used. + */ + InsituTrollSdi12a_Pressure() + : Variable((const uint8_t)ITROLLA_PRESSURE_VAR_NUM, + (uint8_t)ITROLLA_PRESSURE_RESOLUTION, + ITROLLA_PRESSURE_VAR_NAME, ITROLLA_PRESSURE_UNIT_NAME, + ITROLLA_PRESSURE_DEFAULT_CODE) {} + /** + * @brief Destroy the InsituTrollSdi12a_Pressure object - no action needed. + */ + ~InsituTrollSdi12a_Pressure() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature Output](@ref sensor_insitutroll_temp) from a + * [Insitu Troll 3-in-1 water level sensor.](@ref sensor_insitutroll) + * + * @ingroup sensor_insitutroll + */ +/* clang-format on */ +class InsituTrollSdi12a_Temp : public Variable { + public: + /** + * @brief Construct a new InsituTrollSdi12a_Temp object. + * + * @param parentSense The parent InsituTrollSdi12a providing the 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 "ITROLLtemp". + */ + InsituTrollSdi12a_Temp(Sensor* parentSense, const char* uuid = "", + const char* varCode = ITROL_TEMP_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)ITROLLA_TEMP_VAR_NUM, + (uint8_t)ITROLLA_TEMP_RESOLUTION, ITROLLA_TEMP_TEMP_VAR_NAME, + ITROLLA_TEMP_TEMP_UNIT_NAME, varCode, uuid) {} + + /** + * @brief Construct a new InsituTrollSdi12a_Temp object. + * + * @note This must be tied with a parent InsituTrollSdi12a before it can be + * used. + */ + InsituTrollSdi12a_Temp() + : Variable((const uint8_t)ITROLLA_TEMP_VAR_NUM, + (uint8_t)ITROLLA_TEMP_RESOLUTION, ITROLLA_TEMP_TEMP_VAR_NAME, + ITROLLA_TEMP_TEMP_UNIT_NAME, ITROL_TEMP_DEFAULT_CODE) {} + /** + * @brief Destroy the InsituTrollSdi12a_Temp object - no action needed. + */ + ~InsituTrollSdi12a_Temp() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [depth output](@ref sensor_insitutroll_depth) from a + * [Insitu Troll 3-in-1 water level sensor.](@ref sensor_insitutroll) + * + * @ingroup sensor_insitutroll + */ +/* clang-format on */ +class InsituTrollSdi12a_Depth : public Variable { + public: + /** + * @brief Construct a new InsituTrollSdi12a_Depth object. + * + * @param parentSense The parent InsituTrollSdi12a providing the 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 "ITROLLdepth". + */ + InsituTrollSdi12a_Depth(Sensor* parentSense, const char* uuid = "", + const char* varCode = ITROLLA_DEPTH_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)ITROLLA_DEPTH_VAR_NUM, + (uint8_t)ITROLLA_DEPTH_RESOLUTION, ITROLLA_DEPTH_VAR_NAME, + ITROLLA_DEPTH_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new InsituTrollSdi12a_Depth object. + * + * @note This must be tied with a parent InsituTrollSdi12a before it can be + * used. + */ + InsituTrollSdi12a_Depth() + : Variable((const uint8_t)ITROLLA_DEPTH_VAR_NUM, + (uint8_t)ITROLLA_DEPTH_RESOLUTION, ITROLLA_DEPTH_VAR_NAME, + ITROLLA_DEPTH_UNIT_NAME, ITROLLA_DEPTH_DEFAULT_CODE) {} + /** + * @brief Destroy the InsituTrollSdi12a_Depth object - no action needed. + */ + ~InsituTrollSdi12a_Depth() {} +}; +/**@}*/ +#endif // SRC_SENSORS_INSITUTROLLSDI12_H_ From 239c3d61a4983f0f4aedf73e50141c7eb02a7cc9 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Fri, 1 Oct 2021 19:11:16 -0500 Subject: [PATCH 03/94] Bump version and add to changelog --- ChangeLog.md | 7 +++++++ VERSION | 2 +- docs/Doxyfile | 2 +- library.json | 2 +- library.properties | 2 +- src/ModularSensors.h | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index dcc1ce1c1..43243d5e4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -5,6 +5,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). **** +## v0.30.1 (2021-10-01) Add support for TippingBucketRainCounter v0.2.0 + +### Improvements +- Added support for [v0.2.0](https://github.com/EnviroDIY/TippingBucketRainCounter/releases) of the [EnviroDIY/TippingBucketRainCounter](https://github.com/EnviroDIY/TippingBucketRainCounter) device firmware, which added capability to count rotations on a reed-switch anemometer and fixed a critical bug that failed to count high rainfall rates. For details, see: + - https://github.com/EnviroDIY/TippingBucketRainCounter/releases/tag/v0.2.0 + + ## v0.30.0 (2021-07-06) Remove support for SoftwareWire for Atlas sensors ### New Features diff --git a/VERSION b/VERSION index 9388ecbd5..c173e42d7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v0.30.0 +v0.30.1 diff --git a/docs/Doxyfile b/docs/Doxyfile index 369352c0f..218998ea8 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = ModularSensors # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.30.0 +PROJECT_NUMBER = 0.30.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 7632b413d..0ef6786f3 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "EnviroDIY_ModularSensors", - "version": "0.30.0", + "version": "0.30.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 03658cdfc..8397d33d9 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=EnviroDIY_ModularSensors -version=0.30.0 +version=0.30.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 8774802e1..b7aa56dfe 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -14,7 +14,7 @@ /** * @brief The current library version number */ -#define MODULAR_SENSORS_VERSION "0.30.0" +#define MODULAR_SENSORS_VERSION "0.30.1" // To get all of the base classes for ModularSensors, include LoggerBase. // NOTE: Individual sensor definitions must be included separately. From 81330a513f1bf5dbb589853a5b85efd11ae71a75 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 22 Nov 2021 10:42:13 -0500 Subject: [PATCH 04/94] Delete extra sensor test Signed-off-by: Sara Damiano --- .../RainCounter_simple_logging.ino | 270 ------------------ 1 file changed, 270 deletions(-) delete mode 100644 sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino diff --git a/sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino b/sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino deleted file mode 100644 index b3400617c..000000000 --- a/sensor_tests/RainCounter_simple_logging/RainCounter_simple_logging.ino +++ /dev/null @@ -1,270 +0,0 @@ -/** ========================================================================= - * @file RainCounter_simple_logging.ino - * @brief Test improvements to RainCounterI2C, based on simple logging example. - * - * @author Sara Geleskie Damiano - * @author Anthony Aufdenkampe - * @copyright (c) 2017-2020 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. - * - * Build Environment: Atom with PlatformIO Core 5.1.1·Home 3.3.4 - * Modular Sensors v0.28.3 as of April 5, 2021 - * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger - * - * DISCLAIMER: - * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. - * ======================================================================= */ - -// ========================================================================== -// 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 - -// To get all of the base classes for ModularSensors, include LoggerBase. -// NOTE: Individual sensor definitions must be included separately. -#include -/** End [includes] */ - - -// ========================================================================== -// Data Logging Options -// ========================================================================== -/** Start [logging_options] */ -// The name of this program file -const char* sketchName = "RainCounter_simple_logging.ino"; -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char* LoggerID = "RainCounter_Tester"; -// How frequently (in minutes) to log data -const uint8_t loggingInterval = 1; -// Your logger's timezone. -const int8_t timeZone = -6; // 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; // 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 = A7; // MCU interrupt/alarm pin to wake from sleep -// 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 -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] */ - - -// ========================================================================== -// Using the Processor as a Sensor -// ========================================================================== -/** Start [processor_sensor] */ -#include - -// Create the main processor chip "sensor" - for general metadata -const char* mcuBoardVersion = "v0.5b"; -ProcessorStats mcuBoard(mcuBoardVersion); -/** End [processor_sensor] */ - - -// ========================================================================== -// Maxim DS3231 RTC (Real Time Clock) -// ========================================================================== -/** Start [ds3231] */ -#include // Includes wrapper functions for Maxim DS3231 RTC - -// Create a DS3231 sensor object, using this constructor function: -MaximDS3231 ds3231(1); -/** End [ds3231] */ - - -// ========================================================================== -// Settings for Additional Sensors -// ========================================================================== - -// ========================================================================== -// External I2C Rain Tipping Bucket Counter, connected to an anemometer -// ========================================================================== -/** Start [i2c_rain] */ -#include - -const uint8_t RainCounterI2CAddress = 0x08; -// I2C Address for EnviroDIY external tip counter; 0x08 by default -const float depthPerTipEvent = 0.2; // rain depth in mm per tip event - -// Create a Rain Counter sensor object -RainCounterI2C tbi2c(RainCounterI2CAddress, depthPerTipEvent); - -// Create number of tips and rain depth variable pointers for the tipping bucket -Variable* tbi2cTips = - new RainCounterI2C_Tips(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); -// Variable* tbi2cDepth = -// new RainCounterI2C_Depth(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [i2c_rain] */ - - -// ========================================================================== -// Calculated Variables -// ========================================================================== - -// Create the function to give your calculated result. -// The function should take no input (void) and return a float. -// You can use any named variable pointers to access values by way of -// variable->getValue() - -float calculateWindSpeed(void) { - float windSpeed = -9999; // Always safest to start with a bad value - float period = -9999; // seconds between gettting event counts - float frequency = -9999; // average event frequency in Hz - float eventCount = tbi2cTips->getValue(); - if (eventCount != -9999) // make sure both inputs are good - { - period = loggingInterval * 60.0; // in seconds - frequency = eventCount/period; // average event frequency in Hz - windSpeed = frequency * 2.5 * 1.60934; // in km/h, - // 2.5 mph/Hz & 1.60934 kmph/mph and 2.5 mph/Hz conversion factor from - // https://www.store.inspeed.com/Inspeed-Version-II-Reed-Switch-Anemometer-Sensor-Only-WS2R.htm - } - return windSpeed; -} - -// Properties of the calculated variable -// The number of digits after the decimal place -const uint8_t calculatedVarResolution = 3; -// This must be a value from http://vocabulary.odm2.org/variablename/ -const char *calculatedVarName = "windSpeed"; -// This must be a value from http://vocabulary.odm2.org/units/ -const char *calculatedVarUnit = "KilometerPerHour"; -// A short code for the variable -const char *calculatedVarCode = "WindSpeed"; -// The (optional) universallly unique identifier -const char *calculatedVarUUID = "12345678-abcd-1234-ef00-1234567890ab"; - -// Create a calculated variable pointer and return a variable pointer to it -Variable *calculatedWindSpeed = new Variable( - calculateWindSpeed, calculatedVarResolution, calculatedVarName, - calculatedVarUnit, calculatedVarCode, calculatedVarUUID); - - -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== -/** Start [variable_arrays] */ -Variable* variableList[] = { - new ProcessorStats_SampleNumber(&mcuBoard), - new ProcessorStats_FreeRam(&mcuBoard), - new ProcessorStats_Battery(&mcuBoard), - new MaximDS3231_Temp(&ds3231), - // Additional sensor variables can be added here, by copying the syntax - // for creating the variable pointer (FORM1) from the - // `menu_a_la_carte.ino` example - // The example code snippets in the wiki are primarily FORM2. - tbi2cTips, - calculatedWindSpeed, -}; -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray; -/** End [variable_arrays] */ - - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== -/** Start [loggers] */ -// Create a logger instance -Logger dataLogger; -/** End [loggers] */ - - -// ========================================================================== -// 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); -} -/** End [working_functions] */ - - -// ========================================================================== -// Arduino Setup Function -// ========================================================================== -/** Start [setup] */ -void setup() { - // Start the primary serial connection - Serial.begin(serialBaud); - - // Print a start-up note to the first serial port - Serial.print(F("Now 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); - - // 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(); - - // 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); - - // Set information pins - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, - greenLED); - - // Begin the variable array[s], logger[s], and publisher[s] - varArray.begin(variableCount, variableList); - dataLogger.begin(LoggerID, loggingInterval, &varArray); - - // Set up the sensors - Serial.println(F("Setting up sensors...")); - varArray.setupSensors(); - - // 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 - dataLogger.createLogFile(true); // true = write a new header - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [setup] */ - - -// ========================================================================== -// Arduino Loop Function -// ========================================================================== -/** Start [loop] */ -void loop() { - dataLogger.logData(); -} -/** End [loop] */ From 72360c89d2ffd100def16d603336b0f43f73163e Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 24 Nov 2021 17:38:16 -0500 Subject: [PATCH 05/94] Minor adjustments for ESP32 with AT 2.2 Signed-off-by: Sara Damiano --- .github/workflows/prepare_release.yaml | 2 +- ChangeLog.md | 9 ++ continuous_integration/dependencies.json | 108 ++++++++++++++----- examples/menu_a_la_carte/menu_a_la_carte.ino | 4 +- library.json | 14 +-- src/modems/EspressifESP8266.cpp | 31 +++--- src/modems/EspressifESP8266.h | 5 +- 7 files changed, 120 insertions(+), 53 deletions(-) diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index 4416b772f..08b0981f0 100644 --- a/.github/workflows/prepare_release.yaml +++ b/.github/workflows/prepare_release.yaml @@ -162,4 +162,4 @@ jobs: # Publish the new release to the PlatformIO package manager - name: Publish release to the PlatformIO package manager id: publish-pio - run: pio package publish --owner EnviroDIY --non-interactive + run: pio package publish --owner envirodiy --non-interactive diff --git a/ChangeLog.md b/ChangeLog.md index b04e5c500..db2258726 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -9,6 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Added a longer warm up time and removed some of the set-up to work with the ESP-IDF AT firmware versions >2.0 + +### Added + +### Removed + +### Fixed + *** ## [0.32.2] diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 7846f17c6..cfa55d3de 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 5, + "action_cache_version": 6, "dependencies": [ { "name": "EnviroDIY_DS3231", @@ -8,7 +8,10 @@ "url": "https://github.com/EnviroDIY/Sodaq_DS3231.git", "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.git", "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.git", "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" }, @@ -39,18 +46,23 @@ "owner": "greiman", "library id": "322", "url": "https://github.com/greiman/SdFat.git", - "version": "~2.0.6", + "version": "~2.1.2", "note": "SdFat - FAT16/FAT32 file system for SD cards.", - "authors": ["Bill Greiman"], + "authors": [ + "Bill Greiman" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.3", + "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,16 +73,20 @@ "url": "https://github.com/knolleary/pubsubclient.git", "version": "~2.8", "note": "A client library for MQTT messaging.", - "authors": ["Nick O'Leary"] + "authors": [ + "Nick O'Leary" + ] }, { "name": "Adafruit BusIO", "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.7.3", + "version": "~1.9.7", "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.git", "version": "~1.1.4", "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.git", "version": "~2.2.0", "note": "AOSong AM2315 I2C Temp/Humidity Sensor Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -111,9 +133,11 @@ "owner": "adafruit", "library id": "166", "url": "https://github.com/adafruit/Adafruit_BME280_Library.git", - "version": "~2.1.3", + "version": "~2.2.1", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -122,9 +146,11 @@ "owner": "adafruit", "library id": "19", "url": "https://github.com/adafruit/DHT-sensor-library.git", - "version": "~1.4.2", + "version": "~1.4.3", "note": "AOSong DHT Sensor Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -133,9 +159,11 @@ "owner": "adafruit", "library id": "160", "url": "https://github.com/adafruit/Adafruit_INA219.git", - "version": "~1.1.0", + "version": "~1.1.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" }, @@ -144,9 +172,11 @@ "owner": "adafruit", "library id": "406", "url": "https://github.com/adafruit/Adafruit_MPL115A2.git", - "version": "~1.1.3", + "version": "~2.0.0", "note": "MPL115A2 Barometer Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino" }, { @@ -180,7 +210,12 @@ "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library.git", "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" }, @@ -207,14 +242,22 @@ "url": "https://github.com/NorthernWidget/MS5803.git", "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" }, @@ -225,7 +268,9 @@ "url": "https://github.com/EnviroDIY/SensorModbusMaster.git", "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" }, @@ -236,7 +281,9 @@ "url": "https://github.com/EnviroDIY/KellerModbus.git", "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", @@ -245,9 +292,12 @@ "url": "https://github.com/EnviroDIY/YosemitechModbus.git", "version": "~0.2.5", "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" } ] -} +} \ 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 95c9753e9..4c9b875af 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -424,7 +424,7 @@ DigiXBeeWifi modem = modemXBWF; // ========================================================================== -#elif defined BUILD_MODEM_ESP8266 +#elif defined BUILD_MODEM_ESP8266 || defined BUILD_MODEM_ESP32 /** Start [esp8266] */ // For almost anything based on the Espressif ESP8266 using the // AT command firmware @@ -2644,7 +2644,7 @@ void setup() { } /** End [setup_sesors] */ -#if defined BUILD_MODEM_ESP8266 && F_CPU == 8000000L +#if (defined BUILD_MODEM_ESP8266 || defined BUILD_MODEM_ESP32) && F_CPU == 8000000L /** Start [setup_esp] */ if (modemBaud > 57600) { modem.modemWake(); // NOTE: This will also set up the modem diff --git a/library.json b/library.json index c29bcc5ac..3d781d526 100644 --- a/library.json +++ b/library.json @@ -100,7 +100,7 @@ "owner": "greiman", "library id": "322", "url": "https://github.com/greiman/SdFat.git", - "version": "~2.0.6", + "version": "~2.1.2", "note": "SdFat - FAT16/FAT32 file system for SD cards.", "authors": ["Bill Greiman"], "frameworks": "arduino", @@ -109,7 +109,7 @@ { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.3", + "version": "~0.11.5", "note": "A small Arduino library for GPRS modules.", "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", @@ -129,7 +129,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.7.3", + "version": "~1.9.7", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": ["Adafruit"], "frameworks": "arduino", @@ -172,7 +172,7 @@ "owner": "adafruit", "library id": "166", "url": "https://github.com/adafruit/Adafruit_BME280_Library.git", - "version": "~2.1.3", + "version": "~2.2.1", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino", @@ -183,7 +183,7 @@ "owner": "adafruit", "library id": "19", "url": "https://github.com/adafruit/DHT-sensor-library.git", - "version": "~1.4.2", + "version": "~1.4.3", "note": "AOSong DHT Sensor Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino", @@ -194,7 +194,7 @@ "owner": "adafruit", "library id": "160", "url": "https://github.com/adafruit/Adafruit_INA219.git", - "version": "~1.1.0", + "version": "~1.1.1", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", "authors": ["Adafruit"], "frameworks": "arduino", @@ -205,7 +205,7 @@ "owner": "adafruit", "library id": "406", "url": "https://github.com/adafruit/Adafruit_MPL115A2.git", - "version": "~1.1.3", + "version": "~2.0.0", "note": "MPL115A2 Barometer Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino" diff --git a/src/modems/EspressifESP8266.cpp b/src/modems/EspressifESP8266.cpp index 886e82450..cf4b487ae 100644 --- a/src/modems/EspressifESP8266.cpp +++ b/src/modems/EspressifESP8266.cpp @@ -200,19 +200,24 @@ bool EspressifESP8266::extraModemSetup(void) { gsmModem.init(); gsmClient.init(&gsmModem); _modemName = gsmModem.getModemName(); - // And make sure we're staying in station mode so sleep can happen - gsmModem.sendAT(GF("+CWMODE_DEF=1")); - gsmModem.waitResponse(); - // Make sure that, at minimum, modem-sleep is on - gsmModem.sendAT(GF("+SLEEP=2")); - gsmModem.waitResponse(); - // Set the wifi settings as default - // This will speed up connecting after resets - gsmModem.sendAT(GF("+CWJAP_DEF=\""), _ssid, GF("\",\""), _pwd, GF("\"")); - if (gsmModem.waitResponse(30000L, GFP(GSM_OK), GF(GSM_NL "FAIL" GSM_NL)) != - 1) { - return false; - } + // // And make sure we're staying in station mode so sleep can happen + // gsmModem.sendAT(GF("+CWMODE_DEF=1")); + // gsmModem.waitResponse(); + // // Make sure that, at minimum, modem-sleep is on + // gsmModem.sendAT(GF("+SLEEP=2")); + // gsmModem.waitResponse(); + // // Set the wifi settings as default + // // This will speed up connecting after resets + // gsmModem.sendAT(GF("+CWJAP_DEF=\""), _ssid, GF("\",\""), _pwd, GF("\"")); + // if (gsmModem.waitResponse(30000L, GFP(GSM_OK), GF(GSM_NL "FAIL" GSM_NL)) + // != + // 1) { + // gsmModem.sendAT(GF("+CWJAP=\""), _ssid, GF("\",\""), _pwd, GF("\"")); + // if (gsmModem.waitResponse(30000L, GFP(GSM_OK), + // GF(GSM_NL "FAIL" GSM_NL)) != 1) { + // return false; + // } + // } // Slow down the baud rate for slow processors - and save the change to // the ESP's non-volatile memory so we don't have to do it every time // #if F_CPU == 8000000L diff --git a/src/modems/EspressifESP8266.h b/src/modems/EspressifESP8266.h index ac184489b..4daf59d3f 100644 --- a/src/modems/EspressifESP8266.h +++ b/src/modems/EspressifESP8266.h @@ -158,9 +158,12 @@ * The serial response time after boot (via power on or reset) is undocumented * for the ESP8266. Other users online estimate about 350ms. * + * In my fiddling, the ESP32 running AT firmware takes a bit longer; 700ms may + * be safe. + * * The serial response time on waking from light sleep is 5ms. */ -#define ESP8266_ATRESPONSE_TIME_MS 350 +#define ESP8266_ATRESPONSE_TIME_MS 700 /** * @brief The loggerModem::_disconnetTime_ms. From b244b2de7c3ae0e7d0e573009413d45fb4f43443 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Wed, 15 Dec 2021 14:25:50 -0600 Subject: [PATCH 06/94] Rename Y550.h to Y551.h We will remove the earlier Y550 from the library, as it was never tested and is no longer available form YosemiTech. If anyone has a Y550 sensor, the Y551 commands should work. Let us know if they don't. See https://github.com/EnviroDIY/YosemitechModbus/releases/tag/v0.3.0 --- src/sensors/{YosemitechY550.h => YosemitechY551.h} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/sensors/{YosemitechY550.h => YosemitechY551.h} (100%) diff --git a/src/sensors/YosemitechY550.h b/src/sensors/YosemitechY551.h similarity index 100% rename from src/sensors/YosemitechY550.h rename to src/sensors/YosemitechY551.h From 42b3225bde5a394a37f945ec0bb81a518d5ec383 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Thu, 16 Dec 2021 12:45:56 -0600 Subject: [PATCH 07/94] Replace Y550 w/ Y551 everywhere; Update YosemiTech links ... to all sensors' web pages and manuals. --- .github/workflows/build_menu.yaml | 2 +- README.md | 2 +- build-menu-configurations.ps1 | 2 +- examples/menu_a_la_carte/ReadMe.md | 10 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 48 ++-- src/sensors/YosemitechParent.cpp | 2 +- src/sensors/YosemitechParent.h | 37 +-- src/sensors/YosemitechY551.h | 266 +++++++++---------- 8 files changed, 188 insertions(+), 181 deletions(-) diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 8944bc293..59d536867 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -167,7 +167,7 @@ jobs: sensorFlag: BUILD_SENSOR_Y533 publisherFlag: BUILD_PUB_MMW - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y550 + sensorFlag: BUILD_SENSOR_Y551 publisherFlag: BUILD_PUB_MMW - modemFlag: BUILD_MODEM_SIM7080 sensorFlag: BUILD_SENSOR_Y4000 diff --git a/README.md b/README.md index eab185683..830b6b298 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ For some generalized information about attaching sensors to an Arduino style boa - [Y520-A: Conductivity and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y520.html) - [Y532-A: Digital pH and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y532.html) - [Y533: ORP, and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y533.html) - - [Y550-B: UV254/COD, Turbidity, and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y550.html) + - [Y551-B: UV254/COD, Turbidity, and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y551.html) - [Y4000 Multiparameter Sonde](https://envirodiy.github.io/ModularSensors/group__sensor__y4000.html) - [Zebra-Tech D-Opto: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__dopto.html) diff --git a/build-menu-configurations.ps1 b/build-menu-configurations.ps1 index e2ccfa216..5a4ee023b 100644 --- a/build-menu-configurations.ps1 +++ b/build-menu-configurations.ps1 @@ -108,7 +108,7 @@ $sensorFlags = @(` 'BUILD_SENSOR_Y520', ` 'BUILD_SENSOR_Y532', ` 'BUILD_SENSOR_Y533', ` - 'BUILD_SENSOR_Y550', ` + 'BUILD_SENSOR_Y551', ` 'BUILD_SENSOR_Y4000', ` 'BUILD_SENSOR_DOPTO') diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index a1956ce50..c5d8d0451 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -93,7 +93,7 @@ ___ - [Yosemitech Y520 Yosemitech Y520 Conductivity Sensor](#yosemitech-y520-yosemitech-y520-conductivity-sensor) - [Yosemitech Y532 Yosemitech Y532 pH Sensor](#yosemitech-y532-yosemitech-y532-ph-sensor) - [Yosemitech Y533 Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor](#yosemitech-y533-yosemitech-y533-oxidation-reduction-potential-orp-sensor) - - [Yosemitech Y550 Yosemitech Y550 Carbon Oxygen Demand (COD) Sensor with Wiper](#yosemitech-y550-yosemitech-y550-carbon-oxygen-demand-cod-sensor-with-wiper) + - [Yosemitech Y551 Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper](#yosemitech-y551-yosemitech-y551-carbon-oxygen-demand-cod-sensor-with-wiper) - [Yosemitech Y4000 Yosemitech Y4000 Multi-Parameter Sonde](#yosemitech-y4000-yosemitech-y4000-multi-parameter-sonde) - [Zebra Tech D-Opto Dissolved Oxygen Sensor](#zebra-tech-d-opto-dissolved-oxygen-sensor) - [Calculated Variables](#calculated-variables) @@ -1073,12 +1073,12 @@ ___ ___ -[//]: # ( @subsubsection menu_y550 Yosemitech Y550 Carbon Oxygen Demand (COD) Sensor with Wiper ) -#### Yosemitech Y550 Yosemitech Y550 Carbon Oxygen Demand (COD) Sensor with Wiper +[//]: # ( @subsubsection menu_y551 Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper ) +#### Yosemitech Y551 Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper -@see @ref sensor_y550 +@see @ref sensor_y551 -[//]: # ( @menusnip{y550} ) +[//]: # ( @menusnip{y551} ) ___ 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 4c9b875af..19f2e14a3 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -2007,37 +2007,37 @@ Variable* y533Temp = #endif -#if defined BUILD_SENSOR_Y550 +#if defined BUILD_SENSOR_Y551 // ========================================================================== -// Yosemitech Y550 COD Sensor with Wiper +// Yosemitech Y551 COD Sensor with Wiper // ========================================================================== -/** Start [y550] */ -#include +/** Start [y551] */ +#include // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y550ModbusAddress = 0x50; // The modbus address of the Y550 -const int8_t y550AdapterPower = sensorPowerPin; // RS485 adapter power pin +byte y551ModbusAddress = 0x50; // The modbus address of the Y551 +const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin // (-1 if unconnected) -const int8_t y550SensorPower = A3; // Sensor power pin -const int8_t y550EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) -const uint8_t y550NumberReadings = 5; +const int8_t y551SensorPower = A3; // Sensor power pin +const int8_t y551EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +const uint8_t y551NumberReadings = 5; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption -// Create a Y550 chemical oxygen demand sensor object -YosemitechY550 y550(y550ModbusAddress, modbusSerial, y550AdapterPower, - y550SensorPower, y550EnablePin, y550NumberReadings); +// Create a Y551 chemical oxygen demand sensor object +YosemitechY551 y551(y551ModbusAddress, modbusSerial, y551AdapterPower, + y551SensorPower, y551EnablePin, y551NumberReadings); -// Create COD, turbidity, and temperature variable pointers for the Y550 -Variable* y550COD = - new YosemitechY550_COD(&y550, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y550Turbid = - new YosemitechY550_Turbidity(&y550, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y550Temp = - new YosemitechY550_Temp(&y550, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y550] */ +// Create COD, turbidity, and temperature variable pointers for the Y551 +Variable* y551COD = + new YosemitechY551_COD(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y551Turbid = + new YosemitechY551_Turbidity(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y551Temp = + new YosemitechY551_Temp(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [y551] */ #endif @@ -2399,10 +2399,10 @@ Variable* variableList[] = { y533ORP, y533Temp, #endif -#if defined BUILD_SENSOR_Y550 - y550COD, - y550Turbid, - y550Temp, +#if defined BUILD_SENSOR_Y551 + y551COD, + y551Turbid, + y551Temp, #endif #if defined BUILD_SENSOR_Y4000 y4000DO, diff --git a/src/sensors/YosemitechParent.cpp b/src/sensors/YosemitechParent.cpp index b3f1bcdcd..6460ec80a 100644 --- a/src/sensors/YosemitechParent.cpp +++ b/src/sensors/YosemitechParent.cpp @@ -97,7 +97,7 @@ bool YosemitechParent::wake(void) { // Manually activate the brush // Needed for newer sensors that do not immediate activate on getting power - if (_model == Y511 || _model == Y514 || _model == Y550 || _model == Y4000) { + if (_model == Y511 || _model == Y514 || _model == Y551 || _model == Y4000) { MS_DBG(F("Activate Brush on"), getSensorNameAndLocation()); if (_ysensor.activateBrush()) { MS_DBG(F("Brush activated.")); diff --git a/src/sensors/YosemitechParent.h b/src/sensors/YosemitechParent.h index dc6ad5e95..4b81cefe6 100644 --- a/src/sensors/YosemitechParent.h +++ b/src/sensors/YosemitechParent.h @@ -20,46 +20,53 @@ * @ingroup the_sensors * * - * This library currently supports the following [Yosemitech](http://www.yosemitech.com/en/) sensors: - * - [Y502-A or Y504-A Optical Dissolved Oxygen Sensors](http://www.yosemitech.com/en/product-10.html) + * This library currently supports the following [Yosemitech](http://en.yosemitech.com/) sensors: + * - [Y502-A or Y504-A Optical Dissolved Oxygen Sensors](http://en.yosemitech.com/aspcms/product/2021-3-1/161.html) * - [Y504 Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y504-DO_UserManual-v1.1.pdf) - * - [Y504 Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y505-DO_UserManual-v1.2.pdf) + * - [Y505 Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y505-DO_UserManual-v1.2.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y504-DO-v6.2_ModbusInstructions.pdf) * - [Class Documentation](@ref sensor_y504) - * - [Y510-B Optical Turbidity Sensor](http://www.yosemitech.com/en/product-17.html) + * - [Y510-B Optical Turbidity Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/76.html) * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y510-Turbidity_UserManual-v1.1.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y510-Turbidity_1.7-ModbusInstruction-en.pdf) * - [Class Documentation](@ref sensor_y510) - * - [Y511-A Optical Turbidity Sensor with Wiper](http://www.yosemitech.com/en/product-16.html) + * - [Y511-A Optical Turbidity Sensor with Wiper](http://en.yosemitech.com/aspcms/product/2020-5-8/76.html) * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y511-Turbidity+Wiper_UserManual-v1.1.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y511-Turbidity+Wiper-v1.7_ModbusInstructions.pdf) * - [Class Documentation](@ref sensor_y511) - * - [Y514-A Chlorophyll Sensor with Wiper](http://www.yosemitech.com/en/product-14.html) + * - [Y514-A Chlorophyll Sensor with Wiper](http://en.yosemitech.com/aspcms/product/2020-4-23/39.html) * - [Y514 Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y514-Chlorophyl+Wiper_UserManual-v1.0.pdf) * - [Y515 Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y515-Chlorophyll_UserManual-v1.0_en.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y514-Chlorophyl+Wiper-v1.6_ModbusInstructions.pdf) * - [Class Documentation](@ref sensor_y514) - * - [Y520-A 4-Electrode Conductivity Sensor](http://www.yosemitech.com/en/product-18.html) - * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y520-Conductivity_UserManual-v1.1.pdf) + * - [Y520-A or Y521-A 4-Electrode Conductivity Sensor](http://en.yosemitech.com/aspcms/product/2020-4-23/58.html) + * - [Y520 Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y520-Conductivity_UserManual-v1.1.pdf) + * - [Y521 Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y521-Conductivity_UserManual-v1.1.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y520-Conductivity-v1.8_ModbusInstructions.pdf) * - [Class Documentation](@ref sensor_y520) - * - Y532-A Digital pH Sensor + * - [Y532-A Digital pH Sensor](http://en.yosemitech.com/aspcms/product/2020-6-15/154.html) * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y532-pH_UserManual-v1.0.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y532-pH-ORP-v1.7_ModbusInstructions.pdf) * - [Class Documentation](@ref sensor_y532) - * - Y533 ORP Sensor + * - [Y533 ORP Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/91.html) * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y532-pH_UserManual-v1.0.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y532-pH-ORP-v1.7_ModbusInstructions.pdf) * - [Class Documentation](@ref sensor_y533) - * - [Y550-B UV254/COD Sensor with Wiper](http://www.yosemitech.com/en/product-21.html) - * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y550-COD-UV254-1.5_ModbusInstruction-en.pdf) - * - [Class Documentation](@ref sensor_y550) - * - [Y4000 Multiparameter Sonde](http://www.yosemitech.com/en/product-20.html) + * - [Y551 COD/UV254 Sensor with Wiper](http://en.yosemitech.com/aspcms/product/2020-5-8/94.html) + * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y551-UV254-COD_UserManual_v1.0.pdf) + * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y551-UV254-COD_Modbus_v2020-05-11.pdf) + * - [Class Documentation](@ref sensor_y551) + * - [Y560 Ammoinum Probe with Wiper](http://en.yosemitech.com/aspcms/product/2020-4-23/61.html) + * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y560-NH4_UserManual_v1.0.pdf) + * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y560-NH4_Modbus_v2020-05-11.pdf) + * - [Class Documentation](@ref sensor_y560) + * - [Y4000 Multiparameter Sonde](http://en.yosemitech.com/aspcms/product/2020-5-8/95.html) * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y4000-Sonde_UserManual_v2.0.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y4000-Sonde-1.6-ModbusInstruction-en.pdf) * - [Class Documentation](@ref sensor_y4000) * - * All of these sensors require a 5-12V power supply and the power supply can be stopped between measurements. + * Most of these sensors require a 9-12V power supply, but some require 12V and + * some can opperate as low as 5V. The power supply can be stopped between measurements for all. * (_Note that any user settings (such as brushing frequency) will be lost if the sensor loses power._) * 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. diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index 48c41cf68..d750cf6fb 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -1,14 +1,14 @@ /** - * @file YosemitechY550.h + * @file YosemitechY551.h * @copyright 2020 Stroud Water Research Center * Part of the EnviroDIY ModularSensors library for Arduino * @author Sara Geleskie Damiano * - * @brief Contains the YosemitechY550 sensor subclass and the variable - * subclasses YosemitechY550_COD, YosemitechY550_Temp, and - * YosemitechY550_Turbidity. + * @brief Contains the YosemitechY551 sensor subclass and the variable + * subclasses YosemitechY551_COD, YosemitechY551_Temp, and + * YosemitechY551_Turbidity. * - * These are for the Yosemitech Y550 COD sensor with wiper. + * These are for the Yosemitech Y551 COD sensor with wiper. * * This depends on the YosemitechParent super class. * @@ -18,169 +18,169 @@ */ /* clang-format off */ /** - * @defgroup sensor_y550 Yosemitech Y550 UV245/COD Sensor - * Classes for the Yosemitech Y550 UV245/COD sensor with wiper. + * @defgroup sensor_y551 Yosemitech Y551 UV245/COD Sensor + * Classes for the Yosemitech Y551 UV245/COD sensor with wiper. * * @ingroup yosemitech_group * * @tableofcontents * @m_footernavigation * - * @section sensor_y550_datasheet Sensor Datasheet - * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y550-COD-UV254-1.5_ModbusInstruction-en.pdf) + * @section sensor_Y551_datasheet Sensor Datasheet + * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y551-UV254-COD_Modbus_v2020-05-11.pdf) * * @note The reported resolution (32 bit) gives far more precision than is significant * based on the specified accuracy of the sensor, so the resolutions kept in the * string representation of the variable values is based on the accuracy not the * maximum reported resolution of the sensor. * - * @section sensor_y550_ctor Sensor Constructor - * {{ @ref YosemitechY550::YosemitechY550 }} + * @section sensor_y551_ctor Sensor Constructor + * {{ @ref YosemitechY551::YosemitechY551 }} * * ___ - * @section sensor_y550_examples Example Code - * The Yosemitech Y550 UV245/COD sensor is used in the @menulink{y550} example. + * @section sensor_y551_examples Example Code + * The Yosemitech Y551 UV245/COD sensor is used in the @menulink{y551} example. * - * @menusnip{y550} + * @menusnip{y551} */ /* clang-format on */ // Header Guards -#ifndef SRC_SENSORS_YOSEMITECHY550_H_ -#define SRC_SENSORS_YOSEMITECHY550_H_ +#ifndef SRC_SENSORS_YOSEMITECHY551_H_ +#define SRC_SENSORS_YOSEMITECHY551_H_ // Included Dependencies #include "sensors/YosemitechParent.h" // Sensor Specific Defines -/** @ingroup sensor_y550 */ +/** @ingroup sensor_y551 */ /**@{*/ -/// @brief Sensor::_numReturnedValues; the Y550 can report 2 values. -#define Y550_NUM_VARIABLES 2 +/// @brief Sensor::_numReturnedValues; the Y551 can report 2 values. +#define Y551_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. -#define Y550_INC_CALC_VARIABLES 0 +#define Y551_INC_CALC_VARIABLES 0 /** - * @anchor sensor_y550_timing + * @anchor sensor_y551_timing * @name Sensor Timing - * The sensor timing for a Yosemitch Y550 + * The sensor timing for a Yosemitch Y551 */ /**@{*/ /// @brief Sensor::_warmUpTime_ms; time before sensor responds after power - /// 1500ms. -#define Y550_WARM_UP_TIME_MS 1500 +#define Y551_WARM_UP_TIME_MS 1500 /// @brief Sensor::_stabilizationTime_ms; time between "StartMeasurement" /// command and stable reading - 2sec. -#define Y550_STABILIZATION_TIME_MS 2000 -/// @brief Sensor::_measurementTime_ms; the Y550 takes ~2000ms to complete a +#define Y551_STABILIZATION_TIME_MS 2000 +/// @brief Sensor::_measurementTime_ms; the Y551 takes ~2000ms to complete a /// measurement. -#define Y550_MEASUREMENT_TIME_MS 2000 +#define Y551_MEASUREMENT_TIME_MS 2000 /**@}*/ /** - * @anchor sensor_y550_cod + * @anchor sensor_y551_cod * @name Carbon Oxygen Demand - * The COD variable from a Yosemitch Y550 + * The COD variable from a Yosemitch Y551 * - Range is: * - 0.75 to 370 mg/L COD (equiv. KHP) * - 0.2 to 150 mg/L TOC (equiv. KHP) * - Accuracy is not reported on sensor datasheet * - * {{ @ref YosemitechY550_COD::YosemitechY550_COD }} + * {{ @ref YosemitechY551_COD::YosemitechY551_COD }} */ /**@{*/ /// @brief Decimals places in string representation; cod should have 2 - /// resolution is 0.01 mg/L COD. -#define Y550_COD_RESOLUTION 2 +#define Y551_COD_RESOLUTION 2 /// @brief Sensor variable number; COD is stored in sensorValues[0]. -#define Y550_COD_VAR_NUM 0 +#define Y551_COD_VAR_NUM 0 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "COD" -#define Y550_COD_VAR_NAME "COD" +#define Y551_COD_VAR_NAME "COD" /// @brief Variable unit name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); /// "milligramPerLiter" (mg/L) -#define Y550_COD_UNIT_NAME "milligramPerLiter" -/// @brief Default variable short code; "Y550COD" -#define Y550_COD_DEFAULT_CODE "Y550COD" +#define Y551_COD_UNIT_NAME "milligramPerLiter" +/// @brief Default variable short code; "Y551COD" +#define Y551_COD_DEFAULT_CODE "Y551COD" /**@}*/ /** - * @anchor sensor_y550_temp + * @anchor sensor_y551_temp * @name Temperature - * The temperature variable from a Yosemitch Y550 + * The temperature variable from a Yosemitch Y551 * - Range is 5°C to + 45°C * - Accuracy is ± 0.2°C * - * {{ @ref YosemitechY550_Temp::YosemitechY550_Temp }} + * {{ @ref YosemitechY551_Temp::YosemitechY551_Temp }} */ /**@{*/ /// @brief Decimals places in string representation; temperature should have 2 - /// resolution is 0.01°C. -#define Y550_TEMP_RESOLUTION 2 +#define Y551_TEMP_RESOLUTION 2 /// @brief Sensor variable number; temperature is stored in sensorValues[1]. -#define Y550_TEMP_VAR_NUM 1 +#define Y551_TEMP_VAR_NUM 1 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "temperature" -#define Y550_TEMP_VAR_NAME "temperature" +#define Y551_TEMP_VAR_NAME "temperature" /// @brief Variable unit name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); /// "degreeCelsius" (°C) -#define Y550_TEMP_UNIT_NAME "degreeCelsius" -/// @brief Default variable short code; "Y550Temp" -#define Y550_TEMP_DEFAULT_CODE "Y550Temp" +#define Y551_TEMP_UNIT_NAME "degreeCelsius" +/// @brief Default variable short code; "Y551Temp" +#define Y551_TEMP_DEFAULT_CODE "Y551Temp" /**@}*/ /** - * @anchor sensor_y550_turb + * @anchor sensor_y551_turb * @name Turbidity - * The turbidity variable from a Yosemitch Y550 + * The turbidity variable from a Yosemitch Y551 * - Range is 0.1~1000 NTU * - Accuracy is <5% or 0.3NTU * - * {{ @ref YosemitechY550_Turbidity::YosemitechY550_Turbidity }} + * {{ @ref YosemitechY551_Turbidity::YosemitechY551_Turbidity }} */ /**@{*/ /// @brief Decimals places in string representation; turbidity should have 2 - /// resolution is 0.01 NTU. -#define Y550_TURB_RESOLUTION 2 +#define Y551_TURB_RESOLUTION 2 /// @brief Sensor variable number; turbidity is stored in sensorValues[2]. -#define Y550_TURB_VAR_NUM 2 +#define Y551_TURB_VAR_NUM 2 /// @brief Variable name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); /// "turbidity" -#define Y550_TURB_VAR_NAME "turbidity" +#define Y551_TURB_VAR_NAME "turbidity" /// @brief Variable unit name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); /// "nephelometricTurbidityUnit" (NTU) -#define Y550_TURB_UNIT_NAME "nephelometricTurbidityUnit" -/// @brief Default variable short code; "Y550Turbidity" -#define Y550_TURB_DEFAULT_CODE "Y550Turbidity" +#define Y551_TURB_UNIT_NAME "nephelometricTurbidityUnit" +/// @brief Default variable short code; "Y551Turbidity" +#define Y551_TURB_DEFAULT_CODE "Y551Turbidity" /**@}*/ /* clang-format off */ /** * @brief The Sensor sub-class for the - * [Yosemitech Y550-B UV254/COD sensor with wiper](@ref sensor_y550). + * [Yosemitech Y551-B UV254/COD sensor with wiper](@ref sensor_y551). * - * @ingroup sensor_y550 + * @ingroup sensor_y551 */ /* clang-format on */ -class YosemitechY550 : public YosemitechParent { +class YosemitechY551 : public YosemitechParent { public: // Constructors with overloads /** - * @brief Construct a new Yosemitech Y550 object. + * @brief Construct a new Yosemitech Y551 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 Y550. + * @param powerPin The pin on the mcu controlling power to the Y551. * 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 @@ -193,161 +193,161 @@ class YosemitechY550 : public YosemitechParent { * average before giving a "final" result from the sensor; optional with a * default value of 1. */ - YosemitechY550(byte modbusAddress, Stream* stream, int8_t powerPin, + YosemitechY551(byte modbusAddress, Stream* stream, int8_t powerPin, int8_t powerPin2 = -1, int8_t enablePin = -1, uint8_t measurementsToAverage = 1) : YosemitechParent(modbusAddress, stream, powerPin, powerPin2, - enablePin, measurementsToAverage, Y550, - "YosemitechY550", Y550_NUM_VARIABLES, - Y550_WARM_UP_TIME_MS, Y550_STABILIZATION_TIME_MS, - Y550_MEASUREMENT_TIME_MS, Y550_INC_CALC_VARIABLES) {} + enablePin, measurementsToAverage, Y551, + "YosemitechY551", Y551_NUM_VARIABLES, + Y551_WARM_UP_TIME_MS, Y551_STABILIZATION_TIME_MS, + Y551_MEASUREMENT_TIME_MS, Y551_INC_CALC_VARIABLES) {} /** - * @copydoc YosemitechY550::YosemitechY550 + * @copydoc YosemitechY551::YosemitechY551 */ - YosemitechY550(byte modbusAddress, Stream& stream, int8_t powerPin, + YosemitechY551(byte modbusAddress, Stream& stream, int8_t powerPin, int8_t powerPin2 = -1, int8_t enablePin = -1, uint8_t measurementsToAverage = 1) : YosemitechParent(modbusAddress, stream, powerPin, powerPin2, - enablePin, measurementsToAverage, Y550, - "YosemitechY550", Y550_NUM_VARIABLES, - Y550_WARM_UP_TIME_MS, Y550_STABILIZATION_TIME_MS, - Y550_MEASUREMENT_TIME_MS, Y550_INC_CALC_VARIABLES) {} + enablePin, measurementsToAverage, Y551, + "YosemitechY551", Y551_NUM_VARIABLES, + Y551_WARM_UP_TIME_MS, Y551_STABILIZATION_TIME_MS, + Y551_MEASUREMENT_TIME_MS, Y551_INC_CALC_VARIABLES) {} /** - * @brief Destroy the Yosemitech Y550 object + * @brief Destroy the Yosemitech Y551 object */ - ~YosemitechY550() {} + ~YosemitechY551() {} }; /* clang-format off */ /** * @brief The Variable sub-class used for the - * [carbon oxygen demand (COD) output](@ref sensor_y550_cod) from a - * [Yosemitech Y550-B UV254/COD sensor with wiper](@ref sensor_y550). + * [carbon oxygen demand (COD) output](@ref sensor_y551_cod) from a + * [Yosemitech Y551-B UV254/COD sensor with wiper](@ref sensor_y551). * - * @ingroup sensor_y550 + * @ingroup sensor_y551 */ /* clang-format on */ -class YosemitechY550_COD : public Variable { +class YosemitechY551_COD : public Variable { public: /** - * @brief Construct a new YosemitechY550_COD object. + * @brief Construct a new YosemitechY551_COD object. * - * @param parentSense The parent YosemitechY550 providing the result + * @param parentSense The parent YosemitechY551 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 "Y550COD". + * optional with a default value of "Y551COD". */ - explicit YosemitechY550_COD(YosemitechY550* parentSense, + explicit YosemitechY551_COD(YosemitechY551* parentSense, const char* uuid = "", - const char* varCode = Y550_COD_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)Y550_COD_VAR_NUM, - (uint8_t)Y550_COD_RESOLUTION, Y550_COD_VAR_NAME, - Y550_COD_UNIT_NAME, varCode, uuid) {} + const char* varCode = Y551_COD_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)Y551_COD_VAR_NUM, + (uint8_t)Y551_COD_RESOLUTION, Y551_COD_VAR_NAME, + Y551_COD_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new YosemitechY550_COD object. + * @brief Construct a new YosemitechY551_COD object. * - * @note This must be tied with a parent YosemitechY550 before it can be + * @note This must be tied with a parent YosemitechY551 before it can be * used. */ - YosemitechY550_COD() - : Variable((const uint8_t)Y550_COD_VAR_NUM, - (uint8_t)Y550_COD_RESOLUTION, Y550_COD_VAR_NAME, - Y550_COD_UNIT_NAME, Y550_COD_DEFAULT_CODE) {} + YosemitechY551_COD() + : Variable((const uint8_t)Y551_COD_VAR_NUM, + (uint8_t)Y551_COD_RESOLUTION, Y551_COD_VAR_NAME, + Y551_COD_UNIT_NAME, Y551_COD_DEFAULT_CODE) {} /** - * @brief Destroy the YosemitechY550_COD object - no action needed. + * @brief Destroy the YosemitechY551_COD object - no action needed. */ - ~YosemitechY550_COD() {} + ~YosemitechY551_COD() {} }; /* clang-format off */ /** * @brief The Variable sub-class used for the - * [temperature output](@ref sensor_y550_temp) from a - * [Yosemitech Y550-B UV254/COD sensor with wiper](@ref sensor_y550). + * [temperature output](@ref sensor_y551_temp) from a + * [Yosemitech Y551-B UV254/COD sensor with wiper](@ref sensor_y551). * - * @ingroup sensor_y550 + * @ingroup sensor_y551 */ /* clang-format on */ -class YosemitechY550_Temp : public Variable { +class YosemitechY551_Temp : public Variable { public: /** - * @brief Construct a new YosemitechY550_Temp object. + * @brief Construct a new YosemitechY551_Temp object. * - * @param parentSense The parent YosemitechY550 providing the result + * @param parentSense The parent YosemitechY551 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 "Y550Temp". + * optional with a default value of "Y551Temp". */ - explicit YosemitechY550_Temp(YosemitechY550* parentSense, + explicit YosemitechY551_Temp(YosemitechY551* parentSense, const char* uuid = "", - const char* varCode = Y550_TEMP_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)Y550_TEMP_VAR_NUM, - (uint8_t)Y550_TEMP_RESOLUTION, Y550_TEMP_VAR_NAME, - Y550_TEMP_UNIT_NAME, varCode, uuid) {} + const char* varCode = Y551_TEMP_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)Y551_TEMP_VAR_NUM, + (uint8_t)Y551_TEMP_RESOLUTION, Y551_TEMP_VAR_NAME, + Y551_TEMP_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new YosemitechY550_Temp object. + * @brief Construct a new YosemitechY551_Temp object. * - * @note This must be tied with a parent YosemitechY550 before it can be + * @note This must be tied with a parent YosemitechY551 before it can be * used. */ - YosemitechY550_Temp() - : Variable((const uint8_t)Y550_TEMP_VAR_NUM, - (uint8_t)Y550_TEMP_RESOLUTION, Y550_TEMP_VAR_NAME, - Y550_TEMP_UNIT_NAME, Y550_TEMP_DEFAULT_CODE) {} + YosemitechY551_Temp() + : Variable((const uint8_t)Y551_TEMP_VAR_NUM, + (uint8_t)Y551_TEMP_RESOLUTION, Y551_TEMP_VAR_NAME, + Y551_TEMP_UNIT_NAME, Y551_TEMP_DEFAULT_CODE) {} /** - * @brief Destroy the YosemitechY550_Temp object - no action needed. + * @brief Destroy the YosemitechY551_Temp object - no action needed. */ - ~YosemitechY550_Temp() {} + ~YosemitechY551_Temp() {} }; /* clang-format off */ /** * @brief The Variable sub-class used for the - * [turbidity output](@ref sensor_y550_turb) from a - * [Yosemitech Y550-B UV254/COD sensor with wiper](@ref sensor_y550). + * [turbidity output](@ref sensor_y551_turb) from a + * [Yosemitech Y551-B UV254/COD sensor with wiper](@ref sensor_y551). * - * @ingroup sensor_y550 + * @ingroup sensor_y551 */ /* clang-format on */ -class YosemitechY550_Turbidity : public Variable { +class YosemitechY551_Turbidity : public Variable { public: /** - * @brief Construct a new YosemitechY550_Turbidity object. + * @brief Construct a new YosemitechY551_Turbidity object. * - * @param parentSense The parent YosemitechY550 providing the result + * @param parentSense The parent YosemitechY551 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 "Y550Turbidity". + * optional with a default value of "Y551Turbidity". */ - explicit YosemitechY550_Turbidity( - YosemitechY550* parentSense, const char* uuid = "", - const char* varCode = Y550_TURB_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)Y550_TURB_VAR_NUM, - (uint8_t)Y550_TURB_RESOLUTION, Y550_TURB_VAR_NAME, - Y550_TURB_UNIT_NAME, varCode, uuid) {} + explicit YosemitechY551_Turbidity( + YosemitechY551* parentSense, const char* uuid = "", + const char* varCode = Y551_TURB_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)Y551_TURB_VAR_NUM, + (uint8_t)Y551_TURB_RESOLUTION, Y551_TURB_VAR_NAME, + Y551_TURB_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new YosemitechY550_Turbidity object. + * @brief Construct a new YosemitechY551_Turbidity object. * - * @note This must be tied with a parent YosemitechY550 before it can be + * @note This must be tied with a parent YosemitechY551 before it can be * used. */ - YosemitechY550_Turbidity() - : Variable((const uint8_t)Y550_TURB_VAR_NUM, - (uint8_t)Y550_TURB_RESOLUTION, Y550_TURB_VAR_NAME, - Y550_TURB_UNIT_NAME, Y550_TURB_DEFAULT_CODE) {} + YosemitechY551_Turbidity() + : Variable((const uint8_t)Y551_TURB_VAR_NUM, + (uint8_t)Y551_TURB_RESOLUTION, Y551_TURB_VAR_NAME, + Y551_TURB_UNIT_NAME, Y551_TURB_DEFAULT_CODE) {} /** - * @brief Destroy the YosemitechY550_Turbidity object - no action needed. + * @brief Destroy the YosemitechY551_Turbidity object - no action needed. */ - ~YosemitechY550_Turbidity() {} + ~YosemitechY551_Turbidity() {} }; /**@}*/ -#endif // SRC_SENSORS_YOSEMITECHY550_H_ +#endif // SRC_SENSORS_YOSEMITECHY551_H_ From 1e761905c9818da91516ff552ade4cb351f87e08 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Thu, 16 Dec 2021 12:56:28 -0600 Subject: [PATCH 08/94] Update Y551 warm, stable, meas times from testing --- src/sensors/YosemitechY551.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index d750cf6fb..3195ceca5 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -68,14 +68,15 @@ */ /**@{*/ /// @brief Sensor::_warmUpTime_ms; time before sensor responds after power - -/// 1500ms. -#define Y551_WARM_UP_TIME_MS 1500 +/// <500ms based on testing. +#define Y551_WARM_UP_TIME_MS 500 /// @brief Sensor::_stabilizationTime_ms; time between "StartMeasurement" -/// command and stable reading - 2sec. +/// command and stable reading - 2sec in manual & confirmed by testing. #define Y551_STABILIZATION_TIME_MS 2000 /// @brief Sensor::_measurementTime_ms; the Y551 takes ~2000ms to complete a -/// measurement. -#define Y551_MEASUREMENT_TIME_MS 2000 +/// measurement according to manual, but testing shows ~1s for a new number +/// but 4-12s to elimniate memory effects, potentially from internal averaging. +#define Y551_MEASUREMENT_TIME_MS 4000 /**@}*/ /** From 5b96d3670402d10033938f09020f174d554838ac Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Thu, 16 Dec 2021 14:25:31 -0600 Subject: [PATCH 09/94] YosemiTech Y551 COD sensor works! using simple logging test sketch, for COD, temp, and turbidity. --- library.json | 2 +- sensor_tests/simple_logging_Y551/ReadMe.md | 66 +++ .../simple_logging_Y551/platformio.ini | 43 ++ .../simple_logging_Y551.ino | 414 ++++++++++++++++++ src/sensors/YosemitechY551.h | 2 +- 5 files changed, 525 insertions(+), 2 deletions(-) create mode 100644 sensor_tests/simple_logging_Y551/ReadMe.md create mode 100644 sensor_tests/simple_logging_Y551/platformio.ini create mode 100644 sensor_tests/simple_logging_Y551/simple_logging_Y551.ino diff --git a/library.json b/library.json index 3d781d526..1dfe0e784 100644 --- a/library.json +++ b/library.json @@ -304,7 +304,7 @@ "owner": "envirodiy", "library id": "2078", "url": "https://github.com/EnviroDIY/YosemitechModbus.git", - "version": "~0.2.5", + "version": "~0.3.0", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", "authors": ["Sara Damiano", "Anthony Aufdenkampe"], "frameworks": "arduino", diff --git a/sensor_tests/simple_logging_Y551/ReadMe.md b/sensor_tests/simple_logging_Y551/ReadMe.md new file mode 100644 index 000000000..d98588f96 --- /dev/null +++ b/sensor_tests/simple_logging_Y551/ReadMe.md @@ -0,0 +1,66 @@ +[//]: # ( @page example_learn_envirodiy Learn EnviroDIY Example ) +# Using ModularSensors to save data to an SD card + +This shows the simplest use of a "logger" object. +That is, creating an array of variable objects and then creating a logger object that utilizes those variables to update all of the variable results together and save the data to a SD card. +The processor then goes to sleep between readings. +This example calls on two of the sensors available in this library. +The example may be run exactly as written. + +This is the example you should use to deploy a logger somewhere where you don't want or have access to a way of streaming live data and you won't want to upload data to the Monitor My Watershed data portal. + +_______ + +[//]: # ( @tableofcontents ) + +[//]: # ( Start GitHub Only ) +- [Using ModularSensors to save data to an SD card](#using-modularsensors-to-save-data-to-an-sd-card) +- [Unique Features of the Learn EnviroDIY Example](#unique-features-of-the-learn-envirodiy-example) +- [To Use this Example:](#to-use-this-example) + - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) + - [Set the logger ID](#set-the-logger-id) + - [Upload!](#upload) + +[//]: # ( End GitHub Only ) + +_______ + +[//]: # ( @section example_learn_envirodiy_unique Unique Features of the Learn EnviroDIY Example ) +# Unique Features of the Learn EnviroDIY Example +- Only logs data to an SD card. +- Uses a few more sensors than the other simple logging example + +[//]: # ( @section example_learn_envirodiy_using To Use this Example: ) +# To Use this Example: + +[//]: # ( @subsection example_learn_envirodiy_pio Prepare and set up PlatformIO ) +## Prepare and set up PlatformIO +- Create a new PlatformIO project +- Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/platformio.ini) file in the examples/simple_logging_LearnEnviroDIY folder on GitHub. + - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. + - Without this, the program won't compile. +- Open [simple_logging_LearnEnviroDIY.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino) and save it to your computer. Put it into the src directory of your project. + - Delete main.cpp in that folder. + +[//]: # ( @subsection example_learn_envirodiy_logger_id Set the logger ID ) +## Set the logger ID +- Change the "XXXX" in this section of code to the loggerID assigned by Stroud: + +```cpp +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char *LoggerID = "XXXX"; +``` + +[//]: # ( @subsection example_learn_envirodiy_upload Upload! ) +## Upload! +- Test everything at home **before** deploying out in the wild! + +_______ + + + +[//]: # ( @section example_learn_envirodiy_pio_config PlatformIO Configuration ) + +[//]: # ( @include{lineno} simple_logging_LearnEnviroDIY/platformio.ini ) + +[//]: # ( @section example_learn_envirodiy_code The Complete Code ) diff --git a/sensor_tests/simple_logging_Y551/platformio.ini b/sensor_tests/simple_logging_Y551/platformio.ini new file mode 100644 index 000000000..08d007b3e --- /dev/null +++ b/sensor_tests/simple_logging_Y551/platformio.ini @@ -0,0 +1,43 @@ +; 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 + +[platformio] +description = ModularSensors example logging data to an SD card from external sensors + +[env:mayfly] +monitor_speed = 115200 +board = mayfly +platform = atmelavr +framework = arduino +lib_ldf_mode = deep+ +lib_ignore = + RTCZero + Adafruit NeoPixel + Adafruit GFX Library + Adafruit SSD1306 + Adafruit ADXL343 + Adafruit STMPE610 + Adafruit TouchScreen + Adafruit ILI9341 +build_flags = + -DSDI12_EXTERNAL_PCINT + -DNEOSWSERIAL_EXTERNAL_PCINT + -DMQTT_MAX_PACKET_SIZE=240 + -DTINY_GSM_RX_BUFFER=64 + -DTINY_GSM_YIELD_MS=2 +lib_deps = + envirodiy/EnviroDIY_ModularSensors +; ^^ Use this when working from an official release of the library +; https://github.com/EnviroDIY/ModularSensors.git#develop +; ^^ Use this when if you want to pull from the develop branch + https://github.com/PaulStoffregen/AltSoftSerial.git + https://github.com/SRGDamia1/NeoSWSerial.git + https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git +; ^^ These are software serial port emulator libraries, you may not need them diff --git a/sensor_tests/simple_logging_Y551/simple_logging_Y551.ino b/sensor_tests/simple_logging_Y551/simple_logging_Y551.ino new file mode 100644 index 000000000..803673153 --- /dev/null +++ b/sensor_tests/simple_logging_Y551/simple_logging_Y551.ino @@ -0,0 +1,414 @@ +/** ========================================================================= + * @file simple_logging_Y551.ino + * @brief A data logging example for the Learn EnviroDIY tutorial. + * + * @author Sara Geleskie Damiano + * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * and the EnviroDIY Development Team + * This example is published under the BSD-3 license. + * + * Build Environment: Visual Studios Code with PlatformIO + * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger + * Created with ModularSensors v0.32.2 + * + * DISCLAIMER: + * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. + * ======================================================================= */ + +// ========================================================================== +// 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] */ + + +// ========================================================================== +// Creating Additional Serial Ports +// ========================================================================== +// The modem and a number of sensors communicate over UART/TTL - often called +// "serial". "Hardware" serial ports (automatically controlled by the MCU) are +// generally the most accurate and should be configured and used for as many +// peripherals as possible. In some cases (ie, modbus communication) many +// sensors can share the same serial port. + +// Unfortunately, most AVR boards have only one or two hardware serial ports, +// so we'll set up three types of extra software serial ports to use + +// AltSoftSerial by Paul Stoffregen +// (https://github.com/PaulStoffregen/AltSoftSerial) is the most accurate +// software serial port for AVR boards. AltSoftSerial can only be used on one +// set of pins on each board so only one AltSoftSerial port can be used. Not all +// AVR boards are supported by AltSoftSerial. +/** Start [altsoftserial] */ +#include +AltSoftSerial altSoftSerial; +/** End [altsoftserial] */ + + +// ========================================================================== +// Assigning Serial Port Functionality +// ========================================================================== + +/** Start [assign_ports_sw] */ + +// Define the serial port for modbus +// Modbus (at 9600 8N1) is used by the Keller level loggers and Yosemitech +// sensors +// Since AltSoftSerial is the best software option, we use it for modbus +// If AltSoftSerial (or its pins) aren't avaiable, use NeoSWSerial +// SoftwareSerial **WILL NOT** work for modbus! +#define modbusSerial altSoftSerial // For AltSoftSerial +// #define modbusSerial neoSSerial1 // For Neo software serial +// #define modbusSerial softSerial1 // For software serial + +/** End [assign_ports_sw] */ + + +// ========================================================================== +// Data Logging Options +// ========================================================================== +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "simple_logging_Y551.ino"; +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char* LoggerID = "simple_logging_Y551"; +// How frequently (in minutes) to log data +const uint8_t loggingInterval = 1; +// 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; // 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 +// 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 +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] */ + + +// ========================================================================== +// 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 // Includes wrapper functions for Maxim DS3231 RTC + +// Create a DS3231 sensor object, using this constructor function: +MaximDS3231 ds3231(1); +/** End [ds3231] */ + + +// ========================================================================== +// Settings for Additional Sensors +// ========================================================================== +// Additional sensors can setup here, similar to the RTC, but only if +// they have been supported with ModularSensors wrapper functions. See: +// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started +// Syntax for the include statement and constructor function for each sensor is +// at +// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported +// or can be copied from the `menu_a_la_carte.ino` example + +// ========================================================================== +// Yosemitech Y551 COD Sensor with Wiper +// ========================================================================== +/** Start [y551] */ +#include + +// NOTE: Extra hardware and software serial ports are created in the "Settings +// for Additional Serial Ports" section + +byte y551ModbusAddress = 0x01; // The modbus address of the Y551 +const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin + // (-1 if unconnected) +const int8_t y551SensorPower = sensorPowerPin; // Sensor power pin +const int8_t y551EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +const uint8_t y551NumberReadings = 5; +// The manufacturer recommends averaging 10 readings, but we take 5 to minimize +// power consumption + +// Create a Y551 chemical oxygen demand sensor object +YosemitechY551 y551(y551ModbusAddress, modbusSerial, y551AdapterPower, + y551SensorPower, y551EnablePin, y551NumberReadings); + +// Create COD, turbidity, and temperature variable pointers for the Y551 +Variable* y551COD = + new YosemitechY551_COD(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y551Turbid = + new YosemitechY551_Turbidity(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y551Temp = + new YosemitechY551_Temp(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [y551] */ + + +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + new ProcessorStats_SampleNumber(&mcuBoard), + new ProcessorStats_FreeRam(&mcuBoard), + new ProcessorStats_Battery(&mcuBoard), + new MaximDS3231_Temp(&ds3231), + y551COD, + y551Turbid, + y551Temp, + // Additional sensor variables can be added here, by copying the syntax + // for creating the variable pointer (FORM1) from the + // `menu_a_la_carte.ino` example + // The example code snippets in the wiki are primarily FORM2. +}; +// Count up the number of pointers in the array +int variableCount = sizeof(variableList) / sizeof(variableList[0]); + +// Create the VariableArray object +VariableArray varArray; +/** End [variable_arrays] */ + + +// ========================================================================== +// The Logger Object[s] +// ========================================================================== +/** Start [loggers] */ +// Create a logger instance +Logger dataLogger; +/** End [loggers] */ + + +// ========================================================================== +// 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); +} + +// 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]; +} +/** End [working_functions] */ + + +// ========================================================================== +// Arduino Setup Function +// ========================================================================== +/** Start [setup] */ +void setup() { + // Start the primary serial connection + Serial.begin(serialBaud); + + // Print a start-up note to the first serial port + Serial.print(F("Now 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); + + // 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(); + + // 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); + + // Set information pins + dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, + greenLED); + + // Begin the variable array[s], logger[s], and publisher[s] + varArray.begin(variableCount, variableList); + dataLogger.begin(LoggerID, loggingInterval, &varArray); + + // Set up the sensors + Serial.println(F("Setting up sensors...")); + varArray.setupSensors(); + + // 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 + dataLogger.createLogFile(true); // true = write a new header + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [setup] */ + + +// ========================================================================== +// Arduino Loop Function +// ========================================================================== +/** Start [complex_loop] */ +// Use this long loop when you want to do something special +// Because of the way alarms work on the RTC, it will wake the processor and +// start the loop every minute exactly on the minute. +// The processor may also be woken up by another interrupt or level change on a +// pin - from a button or some other input. +// The "if" statements in the loop determine what will happen - whether the +// sensors update, testing mode starts, or it goes back to sleep. +void loop() { + // Reset the watchdog + dataLogger.watchDogTimer.resetWatchDog(); + + // Assuming we were woken up by the clock, check if the current time is an + // even interval of the logging interval + // We're only doing anything at all if the battery is above 3.4V + if (dataLogger.checkInterval() && getBatteryVoltage() > 3.4) { + // Flag to notify that we're in already awake and logging a point + Logger::isLoggingNow = true; + dataLogger.watchDogTimer.resetWatchDog(); + + // Print a line to show new reading + Serial.println(F("------------------------------------------")); + // Turn on the LED to show we're taking a reading + dataLogger.alertOn(); + // Power up the SD Card, but skip any waits after power up + dataLogger.turnOnSDcard(false); + dataLogger.watchDogTimer.resetWatchDog(); + + // // Turn on the modem to let it start searching for the network + // // Only turn the modem on if the battery at the last interval was high + // // enough + // // NOTE: if the modemPowerUp function is not run before the + // // completeUpdate + // // function is run, the modem will not be powered and will not + // // return a signal strength reading. + // if (getBatteryVoltage() > 3.6) modem.modemPowerUp(); + + // Start the stream for the modbus sensors, if your RS485 adapter bleeds + // current from data pins when powered off & you stop modbus serial + // connection with digitalWrite(5, LOW), below. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + altSoftSerial.begin(9600); + + // Do a complete update on the variable array. + // This this includes powering all of the sensors, getting updated + // values, and turing them back off. + // NOTE: The wake function for each sensor should force sensor setup + // to run if the sensor was not previously set up. + varArray.completeUpdate(); + + dataLogger.watchDogTimer.resetWatchDog(); + + // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power + // on sleep, because Modbus Stop bit leaves these pins HIGH. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW + digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW + + // Create a csv data record and save it to the log file + dataLogger.logToSD(); + dataLogger.watchDogTimer.resetWatchDog(); + + // // Connect to the network + // // Again, we're only doing this if the battery is doing well + // if (getBatteryVoltage() > 3.55) { + // dataLogger.watchDogTimer.resetWatchDog(); + // if (modem.connectInternet()) { + // dataLogger.watchDogTimer.resetWatchDog(); + // // Publish data to remotes + // Serial.println(F("Modem connected to internet.")); + // dataLogger.publishDataToRemotes(); + // + // // Sync the clock at midnight + // dataLogger.watchDogTimer.resetWatchDog(); + // if (Logger::markedEpochTime != 0 && + // Logger::markedEpochTime % 86400 == 0) { + // Serial.println(F("Running a daily clock sync...")); + // dataLogger.setRTClock(modem.getNISTTime()); + // dataLogger.watchDogTimer.resetWatchDog(); + // modem.updateModemMetadata(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + // + // // Disconnect from the network + // modem.disconnectInternet(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + // // Turn the modem off + // modem.modemSleepPowerDown(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + + // Cut power from the SD card - without additional housekeeping wait + dataLogger.turnOffSDcard(false); + dataLogger.watchDogTimer.resetWatchDog(); + // Turn off the LED + dataLogger.alertOff(); + // Print a line to show reading ended + Serial.println(F("------------------------------------------\n")); + + // Unset flag + Logger::isLoggingNow = false; + } + + // Check if it was instead the testing interrupt that woke us up + if (Logger::startTesting) { + // Start the stream for the modbus sensors, if your RS485 adapter bleeds + // current from data pins when powered off & you stop modbus serial + // connection with digitalWrite(5, LOW), below. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + altSoftSerial.begin(9600); + + dataLogger.testingMode(); + } + + // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power + // on sleep, because Modbus Stop bit leaves these pins HIGH. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW + digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [complex_loop] */ diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index 3195ceca5..5b71e1da8 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -57,7 +57,7 @@ /**@{*/ /// @brief Sensor::_numReturnedValues; the Y551 can report 2 values. -#define Y551_NUM_VARIABLES 2 +#define Y551_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y551_INC_CALC_VARIABLES 0 From 3182287b0173938d59db618b1306ae85e863d066 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Thu, 16 Dec 2021 15:32:13 -0600 Subject: [PATCH 10/94] Create Y560.h for YosemiTech Ammonium probe Based on Y532.h for pH sensor. This is a first cut, with no testing. --- src/sensors/YosemitechParent.h | 4 +- src/sensors/YosemitechY560.h | 350 +++++++++++++++++++++++++++++++++ 2 files changed, 352 insertions(+), 2 deletions(-) create mode 100644 src/sensors/YosemitechY560.h diff --git a/src/sensors/YosemitechParent.h b/src/sensors/YosemitechParent.h index 4b81cefe6..215a31c46 100644 --- a/src/sensors/YosemitechParent.h +++ b/src/sensors/YosemitechParent.h @@ -65,8 +65,8 @@ * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y4000-Sonde-1.6-ModbusInstruction-en.pdf) * - [Class Documentation](@ref sensor_y4000) * - * Most of these sensors require a 9-12V power supply, but some require 12V and - * some can opperate as low as 5V. The power supply can be stopped between measurements for all. + * Most of these sensors require a 9-12V power supply, but some can opperate as + * low as 5V and sondes (Y560 & Y4000) require 12V. The power supply can be stopped between measurements for all. * (_Note that any user settings (such as brushing frequency) will be lost if the sensor loses power._) * 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. diff --git a/src/sensors/YosemitechY560.h b/src/sensors/YosemitechY560.h new file mode 100644 index 000000000..168508d10 --- /dev/null +++ b/src/sensors/YosemitechY560.h @@ -0,0 +1,350 @@ +/** + * @file YosemitechY560.h + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Sara Geleskie Damiano + * + * @brief Contains the YosemitechY560 sensor subclass and the variable + * subclasses YosemitechY560_NH4_N, YosemitechY560_Temp, and + * YosemitechY560_pH. + * + * These are for the Yosemitech Y560 Ammonium sensor. + * + * This depends on the YosemitechParent super class. + * + * Documentation for the Modbus Protocol commands and responses can be found + * within the documentation in the YosemitechModbus library at: + * https://github.com/EnviroDIY/YosemitechModbus + */ +/* clang-format off */ +/** + * @defgroup sensor_y560 Yosemitech Y560 Ammonium Sensor + * Classes for the Yosemitech Y560 Ammonium sensor. + * + * @ingroup yosemitech_group + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_y560_datasheet Sensor Datasheet + * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y560-NH4_UserManual_v1.0.pdf) + * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y560-NH4_Modbus_v2020-05-11.pdf) + * + * @note The reported resolution (32 bit) gives far more precision than is significant + * based on the specified accuracy of the sensor, so the resolutions kept in the + * string representation of the variable values is based on the accuracy not the + * maximum reported resolution of the sensor. + * + * @section sensor_y560_ctor Sensor Constructor + * {{ @ref YosemitechY560::YosemitechY560 }} + * + * ___ + * @section sensor_y560_examples Example Code + * The Yosemitech Y560 Ammonium sensor is used in the @menulink{y560} example. + * + * @menusnip{y560} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_YOSEMITECHY560_H_ +#define SRC_SENSORS_YOSEMITECHY560_H_ + +// Included Dependencies +#include "sensors/YosemitechParent.h" + +// Sensor Specific Defines +/** @ingroup sensor_y560 */ +/**@{*/ + +/// @brief Sensor::_numReturnedValues; the Y560 can report 3 values. +#define Y560_NUM_VARIABLES 3 +/// @brief Sensor::_incCalcValues; we don't calculate any additional values. +#define Y560_INC_CALC_VARIABLES 0 + +/** + * @anchor sensor_y560_timing + * @name Sensor Timing + * The sensor timing for a Yosemitch Y560 + */ +/**@{*/ +/// @brief Sensor::_warmUpTime_ms; time before sensor responds after power - +/// <200ms based on testing. +#define Y560_WARM_UP_TIME_MS 500 +/// @brief Sensor::_stabilizationTime_ms; time between "StartMeasurement" +/// command and stable reading 20s in manual but this includes 15s for brushing. +/// Setting to 20s because brush autostarts on powerUp. +#define Y560_STABILIZATION_TIME_MS 20000 +/// @brief Sensor::_measurementTime_ms; the Y560 takes 2s to complete a +/// measurement according to manual, but testing shows ~1.5s for a new number. +#define Y560_MEASUREMENT_TIME_MS 1500 +/**@}*/ + +/** + * @anchor sensor_y560_nh4 + * @name NH4_N + * The NH4_N variable from a Yosemitch Y560 + * - Range is 0-10 or 0-100 mg/L NH4-N + * - Accuracy is ±(5% + 0.2 mg/L) + * + * {{ @ref YosemitechY560_NH4_N::YosemitechY560_NH4_N }} + */ +/**@{*/ +/// @brief Decimals places in string representation; NH4_N should have 1 - +/// resolution is 0.1 mg/L. +#define Y560_NH4_N_RESOLUTION +/// @brief Sensor variable number; NH4_N is stored in sensorValues[0]. +#define Y560_NH4_N_VAR_NUM 0 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "nitrogen_NH4" +#define Y560_NH4_N_VAR_NAME "nitrogen_NH4" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "milligramPerLiter" +#define Y560_NH4_N_UNIT_NAME "milligramPerLiter" +/// @brief Default variable short code; "Y560NH4_N" +#define Y560_NH4_N_DEFAULT_CODE "Y560NH4_N" +/**@}*/ + +/** + * @anchor sensor_y560_temp + * @name Temperature + * The temperature variable from a Yosemitch Y560 + * - Range is 0°C to + 50°C + * - Accuracy is ± 0.2°C + * + * {{ @ref YosemitechY560_Temp::YosemitechY560_Temp }} + */ +/**@{*/ +/// @brief Decimals places in string representation; temperature should have 1 - +/// resolution is 0.1°C. +#define Y560_TEMP_RESOLUTION 1 +/// @brief Sensor variable number; temperature is stored in sensorValues[1]. +#define Y560_TEMP_VAR_NUM 1 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "temperature" +#define Y560_TEMP_VAR_NAME "temperature" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "degreeCelsius" (°C) +#define Y560_TEMP_UNIT_NAME "degreeCelsius" +/// @brief Default variable short code; "Y560Temp" +#define Y560_TEMP_DEFAULT_CODE "Y560Temp" +/**@}*/ + +/** + * @anchor sensor_y560_pH + * @name pH + * The pH variable from a Yosemitch Y560 + * - Range is 2 to 12 pH units + * - Accuracy is ± 0.1 pH units + * + * {{ @ref YosemitechY560_pH::YosemitechY560_pH }} + */ +/**@{*/ +/// @brief Decimals places in string representation; pH should have 2 - +/// resolution is 0.01 pH units. +#define Y560_PH_RESOLUTION 2 +/// @brief Sensor variable number; pH is stored in sensorValues[2]. +#define Y560_PH_VAR_NUM 2 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); "pH" +#define Y560_PH_VAR_NAME "pH" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "pH" +/// (dimensionless pH units) +#define Y560_PH_UNIT_NAME "pH" +/// @brief Default variable short code; "Y560pH" +#define Y560_PH_DEFAULT_CODE "Y560pH" +/**@}*/ + + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the + * [Yosemitech Y560-A digital pH sensor](@ref sensor_y560). + * + * @ingroup sensor_y560 + */ +/* clang-format on */ +class YosemitechY560 : public YosemitechParent { + public: + // Constructors with overloads + /** + * @brief Construct a new Yosemitech Y560 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 Y560. + * 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. + */ + YosemitechY560(byte modbusAddress, Stream* stream, int8_t powerPin, + int8_t powerPin2 = -1, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1) + : YosemitechParent(modbusAddress, stream, powerPin, powerPin2, + enablePin, measurementsToAverage, Y560, + "YosemitechY560", Y560_NUM_VARIABLES, + Y560_WARM_UP_TIME_MS, Y560_STABILIZATION_TIME_MS, + Y560_MEASUREMENT_TIME_MS, Y560_INC_CALC_VARIABLES) {} + /** + * @copydoc YosemitechY560::YosemitechY560 + */ + YosemitechY560(byte modbusAddress, Stream& stream, int8_t powerPin, + int8_t powerPin2 = -1, int8_t enablePin = -1, + uint8_t measurementsToAverage = 1) + : YosemitechParent(modbusAddress, stream, powerPin, powerPin2, + enablePin, measurementsToAverage, Y560, + "YosemitechY560", Y560_NUM_VARIABLES, + Y560_WARM_UP_TIME_MS, Y560_STABILIZATION_TIME_MS, + Y560_MEASUREMENT_TIME_MS, Y560_INC_CALC_VARIABLES) {} + /** + * @brief Destroy the Yosemitech Y560 object + */ + ~YosemitechY560() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [NH4_N output](@ref sensor_y560_nh4) + * from a [Yosemitech Y560-Ammonium sensor](@ref sensor_y560). + * + * @ingroup sensor_y560 + */ +/* clang-format on */ +class YosemitechY560_NH4_N : public Variable { + public: + /** + * @brief Construct a new YosemitechY560_NH4_N object. + * + * @param parentSense The parent YosemitechY560 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 "Y560NH4_N". + */ + explicit YosemitechY560_NH4_N(YosemitechY560* parentSense, + const char* uuid = "", + const char* varCode = Y560_NH4_N_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)Y560_NH4_N_VAR_NUM, + (uint8_t)Y560_NH4_N_RESOLUTION, Y560_NH4_N_VAR_NAME, + Y560_NH4_N_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new YosemitechY560_NH4_N object. + * + * @note This must be tied with a parent YosemitechY560 before it can be + * used. + */ + YosemitechY560_NH4_N() + : Variable((const uint8_t)Y560_NH4_N_VAR_NUM, (uint8_t)Y560_NH4_N_RESOLUTION, + Y560_NH4_N_VAR_NAME, Y560_NH4_N_UNIT_NAME, Y560_NH4_N_DEFAULT_CODE) {} + /** + * @brief Destroy the YosemitechY560_NH4_N object - no action needed. + */ + ~YosemitechY560_NH4_N() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature output](@ref sensor_y560_temp) from a + * [Yosemitech Y560-Ammonium sensor](@ref sensor_y560). + * + * @ingroup sensor_y560 + */ +/* clang-format on */ +class YosemitechY560_Temp : public Variable { + public: + /** + * @brief Construct a new YosemitechY560_Temp object. + * + * @param parentSense The parent YosemitechY560 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 "Y560Temp". + */ + explicit YosemitechY560_Temp(YosemitechY560* parentSense, + const char* uuid = "", + const char* varCode = Y560_TEMP_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)Y560_TEMP_VAR_NUM, + (uint8_t)Y560_TEMP_RESOLUTION, Y560_TEMP_VAR_NAME, + Y560_TEMP_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new YosemitechY560_Temp object. + * + * @note This must be tied with a parent YosemitechY560 before it can be + * used. + */ + YosemitechY560_Temp() + : Variable((const uint8_t)Y560_TEMP_VAR_NUM, + (uint8_t)Y560_TEMP_RESOLUTION, Y560_TEMP_VAR_NAME, + Y560_TEMP_UNIT_NAME, Y560_TEMP_DEFAULT_CODE) {} + /** + * @brief Destroy the YosemitechY560_Temp object - no action needed. + */ + ~YosemitechY560_Temp() {} +}; + + +/* clang-format off */ +/** +* @brief The Variable sub-class used for the +* [pH output](@ref sensor_y560_pH) +* from a [Yosemitech Y560-Ammonium sensor](@ref sensor_y560). +* +* @ingroup sensor_y560 +*/ +/* clang-format on */ +class YosemitechY560_pH : public Variable { +public: + /** + * @brief Construct a new YosemitechY560_pH object. + * + * @param parentSense The parent YosemitechY560 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 "Y560pH". + */ + explicit YosemitechY560_pH(YosemitechY560* parentSense, + const char* uuid = "", + const char* varCode = Y560_PH_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)Y560_PH_VAR_NUM, + (uint8_t)Y560_PH_RESOLUTION, Y560_PH_VAR_NAME, + Y560_PH_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new YosemitechY560_pH object. + * + * @note This must be tied with a parent YosemitechY560 before it can be + * used. + */ + YosemitechY560_pH() + : Variable((const uint8_t)Y560_PH_VAR_NUM, (uint8_t)Y560_PH_RESOLUTION, + Y560_PH_VAR_NAME, Y560_PH_UNIT_NAME, Y560_PH_DEFAULT_CODE) {} + /** + * @brief Destroy the YosemitechY560_pH object - no action needed. + */ + ~YosemitechY560_pH() {} +}; +/**@}*/ +#endif // SRC_SENSORS_YOSEMITECHY560_H_ From d1b38ba916400a6dc0584323758af342c4d51f41 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Thu, 16 Dec 2021 16:10:45 -0600 Subject: [PATCH 11/94] Tweaks to finalize Y560 Ammonium; working well! --- sensor_tests/simple_logging_Y560/ReadMe.md | 66 +++ .../simple_logging_Y560/platformio.ini | 43 ++ .../simple_logging_Y560.ino | 414 ++++++++++++++++++ src/sensors/YosemitechParent.cpp | 3 +- src/sensors/YosemitechY560.h | 19 +- 5 files changed, 536 insertions(+), 9 deletions(-) create mode 100644 sensor_tests/simple_logging_Y560/ReadMe.md create mode 100644 sensor_tests/simple_logging_Y560/platformio.ini create mode 100644 sensor_tests/simple_logging_Y560/simple_logging_Y560.ino diff --git a/sensor_tests/simple_logging_Y560/ReadMe.md b/sensor_tests/simple_logging_Y560/ReadMe.md new file mode 100644 index 000000000..d98588f96 --- /dev/null +++ b/sensor_tests/simple_logging_Y560/ReadMe.md @@ -0,0 +1,66 @@ +[//]: # ( @page example_learn_envirodiy Learn EnviroDIY Example ) +# Using ModularSensors to save data to an SD card + +This shows the simplest use of a "logger" object. +That is, creating an array of variable objects and then creating a logger object that utilizes those variables to update all of the variable results together and save the data to a SD card. +The processor then goes to sleep between readings. +This example calls on two of the sensors available in this library. +The example may be run exactly as written. + +This is the example you should use to deploy a logger somewhere where you don't want or have access to a way of streaming live data and you won't want to upload data to the Monitor My Watershed data portal. + +_______ + +[//]: # ( @tableofcontents ) + +[//]: # ( Start GitHub Only ) +- [Using ModularSensors to save data to an SD card](#using-modularsensors-to-save-data-to-an-sd-card) +- [Unique Features of the Learn EnviroDIY Example](#unique-features-of-the-learn-envirodiy-example) +- [To Use this Example:](#to-use-this-example) + - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) + - [Set the logger ID](#set-the-logger-id) + - [Upload!](#upload) + +[//]: # ( End GitHub Only ) + +_______ + +[//]: # ( @section example_learn_envirodiy_unique Unique Features of the Learn EnviroDIY Example ) +# Unique Features of the Learn EnviroDIY Example +- Only logs data to an SD card. +- Uses a few more sensors than the other simple logging example + +[//]: # ( @section example_learn_envirodiy_using To Use this Example: ) +# To Use this Example: + +[//]: # ( @subsection example_learn_envirodiy_pio Prepare and set up PlatformIO ) +## Prepare and set up PlatformIO +- Create a new PlatformIO project +- Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/platformio.ini) file in the examples/simple_logging_LearnEnviroDIY folder on GitHub. + - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. + - Without this, the program won't compile. +- Open [simple_logging_LearnEnviroDIY.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino) and save it to your computer. Put it into the src directory of your project. + - Delete main.cpp in that folder. + +[//]: # ( @subsection example_learn_envirodiy_logger_id Set the logger ID ) +## Set the logger ID +- Change the "XXXX" in this section of code to the loggerID assigned by Stroud: + +```cpp +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char *LoggerID = "XXXX"; +``` + +[//]: # ( @subsection example_learn_envirodiy_upload Upload! ) +## Upload! +- Test everything at home **before** deploying out in the wild! + +_______ + + + +[//]: # ( @section example_learn_envirodiy_pio_config PlatformIO Configuration ) + +[//]: # ( @include{lineno} simple_logging_LearnEnviroDIY/platformio.ini ) + +[//]: # ( @section example_learn_envirodiy_code The Complete Code ) diff --git a/sensor_tests/simple_logging_Y560/platformio.ini b/sensor_tests/simple_logging_Y560/platformio.ini new file mode 100644 index 000000000..08d007b3e --- /dev/null +++ b/sensor_tests/simple_logging_Y560/platformio.ini @@ -0,0 +1,43 @@ +; 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 + +[platformio] +description = ModularSensors example logging data to an SD card from external sensors + +[env:mayfly] +monitor_speed = 115200 +board = mayfly +platform = atmelavr +framework = arduino +lib_ldf_mode = deep+ +lib_ignore = + RTCZero + Adafruit NeoPixel + Adafruit GFX Library + Adafruit SSD1306 + Adafruit ADXL343 + Adafruit STMPE610 + Adafruit TouchScreen + Adafruit ILI9341 +build_flags = + -DSDI12_EXTERNAL_PCINT + -DNEOSWSERIAL_EXTERNAL_PCINT + -DMQTT_MAX_PACKET_SIZE=240 + -DTINY_GSM_RX_BUFFER=64 + -DTINY_GSM_YIELD_MS=2 +lib_deps = + envirodiy/EnviroDIY_ModularSensors +; ^^ Use this when working from an official release of the library +; https://github.com/EnviroDIY/ModularSensors.git#develop +; ^^ Use this when if you want to pull from the develop branch + https://github.com/PaulStoffregen/AltSoftSerial.git + https://github.com/SRGDamia1/NeoSWSerial.git + https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git +; ^^ These are software serial port emulator libraries, you may not need them diff --git a/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino b/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino new file mode 100644 index 000000000..658960ef1 --- /dev/null +++ b/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino @@ -0,0 +1,414 @@ +/** ========================================================================= + * @file simple_logging_Y560.ino + * @brief A data logging example for the Learn EnviroDIY tutorial. + * + * @author Sara Geleskie Damiano + * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * and the EnviroDIY Development Team + * This example is published under the BSD-3 license. + * + * Build Environment: Visual Studios Code with PlatformIO + * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger + * Created with ModularSensors v0.32.2 + * + * DISCLAIMER: + * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. + * ======================================================================= */ + +// ========================================================================== +// 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] */ + + +// ========================================================================== +// Creating Additional Serial Ports +// ========================================================================== +// The modem and a number of sensors communicate over UART/TTL - often called +// "serial". "Hardware" serial ports (automatically controlled by the MCU) are +// generally the most accurate and should be configured and used for as many +// peripherals as possible. In some cases (ie, modbus communication) many +// sensors can share the same serial port. + +// Unfortunately, most AVR boards have only one or two hardware serial ports, +// so we'll set up three types of extra software serial ports to use + +// AltSoftSerial by Paul Stoffregen +// (https://github.com/PaulStoffregen/AltSoftSerial) is the most accurate +// software serial port for AVR boards. AltSoftSerial can only be used on one +// set of pins on each board so only one AltSoftSerial port can be used. Not all +// AVR boards are supported by AltSoftSerial. +/** Start [altsoftserial] */ +#include +AltSoftSerial altSoftSerial; +/** End [altsoftserial] */ + + +// ========================================================================== +// Assigning Serial Port Functionality +// ========================================================================== + +/** Start [assign_ports_sw] */ + +// Define the serial port for modbus +// Modbus (at 9600 8N1) is used by the Keller level loggers and Yosemitech +// sensors +// Since AltSoftSerial is the best software option, we use it for modbus +// If AltSoftSerial (or its pins) aren't avaiable, use NeoSWSerial +// SoftwareSerial **WILL NOT** work for modbus! +#define modbusSerial altSoftSerial // For AltSoftSerial +// #define modbusSerial neoSSerial1 // For Neo software serial +// #define modbusSerial softSerial1 // For software serial + +/** End [assign_ports_sw] */ + + +// ========================================================================== +// Data Logging Options +// ========================================================================== +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "simple_logging_Y560.ino"; +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char* LoggerID = "simple_logging_Y560"; +// How frequently (in minutes) to log data +const uint8_t loggingInterval = 1; +// 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; // 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 +// 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 +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] */ + + +// ========================================================================== +// 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 // Includes wrapper functions for Maxim DS3231 RTC + +// Create a DS3231 sensor object, using this constructor function: +MaximDS3231 ds3231(1); +/** End [ds3231] */ + + +// ========================================================================== +// Settings for Additional Sensors +// ========================================================================== +// Additional sensors can setup here, similar to the RTC, but only if +// they have been supported with ModularSensors wrapper functions. See: +// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started +// Syntax for the include statement and constructor function for each sensor is +// at +// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported +// or can be copied from the `menu_a_la_carte.ino` example + +// ========================================================================== +// Yosemitech Y560 Ammonium Probe with Wiper +// ========================================================================== +/** Start [y560] */ +#include + +// NOTE: Extra hardware and software serial ports are created in the "Settings +// for Additional Serial Ports" section + +byte y560ModbusAddress = 0x01; // The modbus address of the Y560 +const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin + // (-1 if unconnected) +const int8_t y560SensorPower = sensorPowerPin; // Sensor power pin +const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +const uint8_t y560NumberReadings = 5; +// The manufacturer recommends averaging 10 readings, but we take 5 to minimize +// power consumption + +// Create a Y560 Ammonium Probe object +YosemitechY560 y560(y560ModbusAddress, modbusSerial, y560AdapterPower, + y560SensorPower, y560EnablePin, y560NumberReadings); + +// Create COD, turbidity, and temperature variable pointers for the Y560 +Variable* y560NH4_N = + new YosemitechY560_NH4_N(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y560pH = + new YosemitechY560_pH(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y560Temp = + new YosemitechY560_Temp(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [y560] */ + + +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + new ProcessorStats_SampleNumber(&mcuBoard), + new ProcessorStats_FreeRam(&mcuBoard), + new ProcessorStats_Battery(&mcuBoard), + new MaximDS3231_Temp(&ds3231), + y560NH4_N, + y560pH, + y560Temp, + // Additional sensor variables can be added here, by copying the syntax + // for creating the variable pointer (FORM1) from the + // `menu_a_la_carte.ino` example + // The example code snippets in the wiki are primarily FORM2. +}; +// Count up the number of pointers in the array +int variableCount = sizeof(variableList) / sizeof(variableList[0]); + +// Create the VariableArray object +VariableArray varArray; +/** End [variable_arrays] */ + + +// ========================================================================== +// The Logger Object[s] +// ========================================================================== +/** Start [loggers] */ +// Create a logger instance +Logger dataLogger; +/** End [loggers] */ + + +// ========================================================================== +// 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); +} + +// 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]; +} +/** End [working_functions] */ + + +// ========================================================================== +// Arduino Setup Function +// ========================================================================== +/** Start [setup] */ +void setup() { + // Start the primary serial connection + Serial.begin(serialBaud); + + // Print a start-up note to the first serial port + Serial.print(F("Now 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); + + // 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(); + + // 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); + + // Set information pins + dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, + greenLED); + + // Begin the variable array[s], logger[s], and publisher[s] + varArray.begin(variableCount, variableList); + dataLogger.begin(LoggerID, loggingInterval, &varArray); + + // Set up the sensors + Serial.println(F("Setting up sensors...")); + varArray.setupSensors(); + + // 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 + dataLogger.createLogFile(true); // true = write a new header + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [setup] */ + + +// ========================================================================== +// Arduino Loop Function +// ========================================================================== +/** Start [complex_loop] */ +// Use this long loop when you want to do something special +// Because of the way alarms work on the RTC, it will wake the processor and +// start the loop every minute exactly on the minute. +// The processor may also be woken up by another interrupt or level change on a +// pin - from a button or some other input. +// The "if" statements in the loop determine what will happen - whether the +// sensors update, testing mode starts, or it goes back to sleep. +void loop() { + // Reset the watchdog + dataLogger.watchDogTimer.resetWatchDog(); + + // Assuming we were woken up by the clock, check if the current time is an + // even interval of the logging interval + // We're only doing anything at all if the battery is above 3.4V + if (dataLogger.checkInterval() && getBatteryVoltage() > 3.4) { + // Flag to notify that we're in already awake and logging a point + Logger::isLoggingNow = true; + dataLogger.watchDogTimer.resetWatchDog(); + + // Print a line to show new reading + Serial.println(F("------------------------------------------")); + // Turn on the LED to show we're taking a reading + dataLogger.alertOn(); + // Power up the SD Card, but skip any waits after power up + dataLogger.turnOnSDcard(false); + dataLogger.watchDogTimer.resetWatchDog(); + + // // Turn on the modem to let it start searching for the network + // // Only turn the modem on if the battery at the last interval was high + // // enough + // // NOTE: if the modemPowerUp function is not run before the + // // completeUpdate + // // function is run, the modem will not be powered and will not + // // return a signal strength reading. + // if (getBatteryVoltage() > 3.6) modem.modemPowerUp(); + + // Start the stream for the modbus sensors, if your RS485 adapter bleeds + // current from data pins when powered off & you stop modbus serial + // connection with digitalWrite(5, LOW), below. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + altSoftSerial.begin(9600); + + // Do a complete update on the variable array. + // This this includes powering all of the sensors, getting updated + // values, and turing them back off. + // NOTE: The wake function for each sensor should force sensor setup + // to run if the sensor was not previously set up. + varArray.completeUpdate(); + + dataLogger.watchDogTimer.resetWatchDog(); + + // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power + // on sleep, because Modbus Stop bit leaves these pins HIGH. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW + digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW + + // Create a csv data record and save it to the log file + dataLogger.logToSD(); + dataLogger.watchDogTimer.resetWatchDog(); + + // // Connect to the network + // // Again, we're only doing this if the battery is doing well + // if (getBatteryVoltage() > 3.55) { + // dataLogger.watchDogTimer.resetWatchDog(); + // if (modem.connectInternet()) { + // dataLogger.watchDogTimer.resetWatchDog(); + // // Publish data to remotes + // Serial.println(F("Modem connected to internet.")); + // dataLogger.publishDataToRemotes(); + // + // // Sync the clock at midnight + // dataLogger.watchDogTimer.resetWatchDog(); + // if (Logger::markedEpochTime != 0 && + // Logger::markedEpochTime % 86400 == 0) { + // Serial.println(F("Running a daily clock sync...")); + // dataLogger.setRTClock(modem.getNISTTime()); + // dataLogger.watchDogTimer.resetWatchDog(); + // modem.updateModemMetadata(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + // + // // Disconnect from the network + // modem.disconnectInternet(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + // // Turn the modem off + // modem.modemSleepPowerDown(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + + // Cut power from the SD card - without additional housekeeping wait + dataLogger.turnOffSDcard(false); + dataLogger.watchDogTimer.resetWatchDog(); + // Turn off the LED + dataLogger.alertOff(); + // Print a line to show reading ended + Serial.println(F("------------------------------------------\n")); + + // Unset flag + Logger::isLoggingNow = false; + } + + // Check if it was instead the testing interrupt that woke us up + if (Logger::startTesting) { + // Start the stream for the modbus sensors, if your RS485 adapter bleeds + // current from data pins when powered off & you stop modbus serial + // connection with digitalWrite(5, LOW), below. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + altSoftSerial.begin(9600); + + dataLogger.testingMode(); + } + + // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power + // on sleep, because Modbus Stop bit leaves these pins HIGH. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW + digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [complex_loop] */ diff --git a/src/sensors/YosemitechParent.cpp b/src/sensors/YosemitechParent.cpp index 6460ec80a..4965cf12f 100644 --- a/src/sensors/YosemitechParent.cpp +++ b/src/sensors/YosemitechParent.cpp @@ -97,7 +97,8 @@ bool YosemitechParent::wake(void) { // Manually activate the brush // Needed for newer sensors that do not immediate activate on getting power - if (_model == Y511 || _model == Y514 || _model == Y551 || _model == Y4000) { + if (_model == Y511 || _model == Y514 || _model == Y551 || _model == Y560 || + _model == Y4000) { MS_DBG(F("Activate Brush on"), getSensorNameAndLocation()); if (_ysensor.activateBrush()) { MS_DBG(F("Brush activated.")); diff --git a/src/sensors/YosemitechY560.h b/src/sensors/YosemitechY560.h index 168508d10..ecea847fb 100644 --- a/src/sensors/YosemitechY560.h +++ b/src/sensors/YosemitechY560.h @@ -30,7 +30,7 @@ * - [Manual](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y560-NH4_UserManual_v1.0.pdf) * - [Modbus Instructions](https://github.com/EnviroDIY/YosemitechModbus/tree/master/doc/Y560-NH4_Modbus_v2020-05-11.pdf) * - * @note The reported resolution (32 bit) gives far more precision than is significant + * @note The reported resolution (32 bit) gives more precision than significant * based on the specified accuracy of the sensor, so the resolutions kept in the * string representation of the variable values is based on the accuracy not the * maximum reported resolution of the sensor. @@ -73,7 +73,7 @@ #define Y560_WARM_UP_TIME_MS 500 /// @brief Sensor::_stabilizationTime_ms; time between "StartMeasurement" /// command and stable reading 20s in manual but this includes 15s for brushing. -/// Setting to 20s because brush autostarts on powerUp. +/// Setting to 20s to allow for 5s after brushing completes, based on testing. #define Y560_STABILIZATION_TIME_MS 20000 /// @brief Sensor::_measurementTime_ms; the Y560 takes 2s to complete a /// measurement according to manual, but testing shows ~1.5s for a new number. @@ -92,7 +92,7 @@ /**@{*/ /// @brief Decimals places in string representation; NH4_N should have 1 - /// resolution is 0.1 mg/L. -#define Y560_NH4_N_RESOLUTION +#define Y560_NH4_N_RESOLUTION 1 /// @brief Sensor variable number; NH4_N is stored in sensorValues[0]. #define Y560_NH4_N_VAR_NUM 0 /// @brief Variable name in @@ -241,10 +241,11 @@ class YosemitechY560_NH4_N : public Variable { */ explicit YosemitechY560_NH4_N(YosemitechY560* parentSense, const char* uuid = "", - const char* varCode = Y560_NH4_N_DEFAULT_CODE) + const char* varCode =Y560_NH4_N_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)Y560_NH4_N_VAR_NUM, - (uint8_t)Y560_NH4_N_RESOLUTION, Y560_NH4_N_VAR_NAME, - Y560_NH4_N_UNIT_NAME, varCode, uuid) {} + (const uint8_t)Y560_NH4_N_RESOLUTION, + Y560_NH4_N_VAR_NAME, Y560_NH4_N_UNIT_NAME, + varCode, uuid) {} /** * @brief Construct a new YosemitechY560_NH4_N object. * @@ -252,8 +253,10 @@ class YosemitechY560_NH4_N : public Variable { * used. */ YosemitechY560_NH4_N() - : Variable((const uint8_t)Y560_NH4_N_VAR_NUM, (uint8_t)Y560_NH4_N_RESOLUTION, - Y560_NH4_N_VAR_NAME, Y560_NH4_N_UNIT_NAME, Y560_NH4_N_DEFAULT_CODE) {} + : Variable((const uint8_t)Y560_NH4_N_VAR_NUM, + (const uint8_t)Y560_NH4_N_RESOLUTION, + Y560_NH4_N_VAR_NAME, Y560_NH4_N_UNIT_NAME, + Y560_NH4_N_DEFAULT_CODE) {} /** * @brief Destroy the YosemitechY560_NH4_N object - no action needed. */ From f55b239da4da2db4aa6c7f56a975f922f56f2e0b Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Thu, 16 Dec 2021 16:14:52 -0600 Subject: [PATCH 12/94] Update .ini files for sensor_tests This are temporary testing files and will be removed before releasing. --- sensor_tests/simple_logging_Y551/platformio.ini | 6 +++--- sensor_tests/simple_logging_Y560/platformio.ini | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sensor_tests/simple_logging_Y551/platformio.ini b/sensor_tests/simple_logging_Y551/platformio.ini index 08d007b3e..dee5ef352 100644 --- a/sensor_tests/simple_logging_Y551/platformio.ini +++ b/sensor_tests/simple_logging_Y551/platformio.ini @@ -10,6 +10,7 @@ [platformio] description = ModularSensors example logging data to an SD card from external sensors +src_dir = sensor_tests/simple_logging_Y551 [env:mayfly] monitor_speed = 115200 @@ -32,10 +33,9 @@ build_flags = -DMQTT_MAX_PACKET_SIZE=240 -DTINY_GSM_RX_BUFFER=64 -DTINY_GSM_YIELD_MS=2 + -DMS_YOSEMITECHPARENT_DEBUG lib_deps = - envirodiy/EnviroDIY_ModularSensors -; ^^ Use this when working from an official release of the library -; https://github.com/EnviroDIY/ModularSensors.git#develop + https://github.com/EnviroDIY/ModularSensors.git#Y551_Y550 ; ^^ Use this when if you want to pull from the develop branch https://github.com/PaulStoffregen/AltSoftSerial.git https://github.com/SRGDamia1/NeoSWSerial.git diff --git a/sensor_tests/simple_logging_Y560/platformio.ini b/sensor_tests/simple_logging_Y560/platformio.ini index 08d007b3e..4224fe29a 100644 --- a/sensor_tests/simple_logging_Y560/platformio.ini +++ b/sensor_tests/simple_logging_Y560/platformio.ini @@ -10,6 +10,7 @@ [platformio] description = ModularSensors example logging data to an SD card from external sensors +src_dir = sensor_tests/simple_logging_Y560 [env:mayfly] monitor_speed = 115200 @@ -32,10 +33,9 @@ build_flags = -DMQTT_MAX_PACKET_SIZE=240 -DTINY_GSM_RX_BUFFER=64 -DTINY_GSM_YIELD_MS=2 + -DMS_YOSEMITECHPARENT_DEBUG lib_deps = - envirodiy/EnviroDIY_ModularSensors -; ^^ Use this when working from an official release of the library -; https://github.com/EnviroDIY/ModularSensors.git#develop + https://github.com/EnviroDIY/ModularSensors.git#Y551_Y550 ; ^^ Use this when if you want to pull from the develop branch https://github.com/PaulStoffregen/AltSoftSerial.git https://github.com/SRGDamia1/NeoSWSerial.git From ee474db04c7af3fbd34d7fe13ea65b691f6fba46 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Thu, 16 Dec 2021 16:18:14 -0600 Subject: [PATCH 13/94] Add Y560 to menu-a-la-carte example --- examples/menu_a_la_carte/menu_a_la_carte.ino | 36 +++++++++++++++++++- 1 file changed, 35 insertions(+), 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 19f2e14a3..79d9a4ce3 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -2022,7 +2022,7 @@ const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin // (-1 if unconnected) const int8_t y551SensorPower = A3; // Sensor power pin const int8_t y551EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) -const uint8_t y551NumberReadings = 5; +const uint8_t y551NumberReadings = 3; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -2041,6 +2041,40 @@ Variable* y551Temp = #endif +#if defined BUILD_SENSOR_Y560 +// ========================================================================== +// Yosemitech Y560 Ammonium Probe with Wiper +// ========================================================================== +/** Start [y560] */ +#include + +// NOTE: Extra hardware and software serial ports are created in the "Settings +// for Additional Serial Ports" section + +byte y560ModbusAddress = 0x60; // The modbus address of the Y560 +const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin + // (-1 if unconnected) +const int8_t y560SensorPower = A3; // Sensor power pin +const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +const uint8_t y560NumberReadings = 3; +// The manufacturer recommends averaging 10 readings, but we take 5 to minimize +// power consumption + +// Create a Y560 Ammonium Probe object +YosemitechY560 y560(y560ModbusAddress, modbusSerial, y560AdapterPower, + y560SensorPower, y560EnablePin, y560NumberReadings); + +// Create COD, turbidity, and temperature variable pointers for the Y560 +Variable* y560NH4_N = + new YosemitechY560_NH4_N(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y560pH = + new YosemitechY560_pH(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y560Temp = + new YosemitechY560_Temp(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [y560] */ +#endif + + #if defined BUILD_SENSOR_Y4000 // ========================================================================== // Yosemitech Y4000 Multiparameter Sonde (DOmgL, Turbidity, Cond, pH, Temp, From d5000c3af4f5f7043c9f45f1e8cb87f3256824b5 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Tue, 21 Dec 2021 17:47:21 -0600 Subject: [PATCH 14/94] Update Y560 warmup time to charge capacitor for brushing When using a new Mayfly-Modbus-Wingshield, I needed to increase the warm up time to 7s, versus 0.5s with separate 12V power source used for testing. Tested with new sketch to run both Y551 and Y560 at the same time from the same Mayfly-Modbus-Wingshield. --- examples/menu_a_la_carte/menu_a_la_carte.ino | 3 +- ...semitech_test_Y551_Y560_simple_logging.ino | 451 ++++++++++++++++++ .../platformio.ini | 44 ++ sensor_tests/simple_logging_Y551/ReadMe.md | 66 --- sensor_tests/simple_logging_Y560/ReadMe.md | 66 --- .../simple_logging_Y560.ino | 6 +- src/sensors/YosemitechY551.h | 4 +- src/sensors/YosemitechY560.h | 6 +- 8 files changed, 506 insertions(+), 140 deletions(-) create mode 100644 sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino create mode 100644 sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini delete mode 100644 sensor_tests/simple_logging_Y551/ReadMe.md delete mode 100644 sensor_tests/simple_logging_Y560/ReadMe.md 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 79d9a4ce3..6e283fbae 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -2051,7 +2051,8 @@ Variable* y551Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y560ModbusAddress = 0x60; // The modbus address of the Y560 +byte y560ModbusAddress = 0x60; // The modbus address of the Y560. + // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin // (-1 if unconnected) const int8_t y560SensorPower = A3; // Sensor power pin diff --git a/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino new file mode 100644 index 000000000..1e3931f5a --- /dev/null +++ b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino @@ -0,0 +1,451 @@ +/** ========================================================================= + * @file Yosemitech_test_Y551_Y560_simple_logging.ino + * @brief A data logging example for the Learn EnviroDIY tutorial. + * + * @author Sara Geleskie Damiano + * @author Anthony Aufdenkampe + * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * and the EnviroDIY Development Team + * This example is published under the BSD-3 license. + * + * Build Environment: Visual Studios Code with PlatformIO + * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger + * Created with ModularSensors v0.32.2 + * + * DISCLAIMER: + * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. + * ======================================================================= */ + +// ========================================================================== +// 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] */ + + +// ========================================================================== +// Creating Additional Serial Ports +// ========================================================================== +// The modem and a number of sensors communicate over UART/TTL - often called +// "serial". "Hardware" serial ports (automatically controlled by the MCU) are +// generally the most accurate and should be configured and used for as many +// peripherals as possible. In some cases (ie, modbus communication) many +// sensors can share the same serial port. + +// Unfortunately, most AVR boards have only one or two hardware serial ports, +// so we'll set up three types of extra software serial ports to use + +// AltSoftSerial by Paul Stoffregen +// (https://github.com/PaulStoffregen/AltSoftSerial) is the most accurate +// software serial port for AVR boards. AltSoftSerial can only be used on one +// set of pins on each board so only one AltSoftSerial port can be used. Not all +// AVR boards are supported by AltSoftSerial. +/** Start [altsoftserial] */ +#include +AltSoftSerial altSoftSerial; +/** End [altsoftserial] */ + + +// ========================================================================== +// Assigning Serial Port Functionality +// ========================================================================== + +/** Start [assign_ports_sw] */ + +// Define the serial port for modbus +// Modbus (at 9600 8N1) is used by the Keller level loggers and Yosemitech +// sensors +// Since AltSoftSerial is the best software option, we use it for modbus +// If AltSoftSerial (or its pins) aren't avaiable, use NeoSWSerial +// SoftwareSerial **WILL NOT** work for modbus! +#define modbusSerial altSoftSerial // For AltSoftSerial +// #define modbusSerial neoSSerial1 // For Neo software serial +// #define modbusSerial softSerial1 // For software serial + +/** End [assign_ports_sw] */ + + +// ========================================================================== +// Data Logging Options +// ========================================================================== +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "Yosemitech_test_Y551_Y560_simple_logging.ino"; +// Logger ID, also becomes the prefix for the name of the data file on SD card +const char* LoggerID = "Yosemitech_test_Y551_Y560_simple_logging"; +// How frequently (in minutes) to log data +const uint8_t loggingInterval = 1; +// 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; // 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 +// 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 +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] */ + + +// ========================================================================== +// 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 // Includes wrapper functions for Maxim DS3231 RTC + +// Create a DS3231 sensor object, using this constructor function: +MaximDS3231 ds3231(1); +/** End [ds3231] */ + + +// ========================================================================== +// Settings for Additional Sensors +// ========================================================================== +// Additional sensors can setup here, similar to the RTC, but only if +// they have been supported with ModularSensors wrapper functions. See: +// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started +// Syntax for the include statement and constructor function for each sensor is +// at +// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported +// or can be copied from the `menu_a_la_carte.ino` example + +// ========================================================================== +// Yosemitech Y551 COD Sensor with Wiper +// ========================================================================== +/** Start [y551] */ +#include + +// NOTE: Extra hardware and software serial ports are created in the "Settings +// for Additional Serial Ports" section + +byte y551ModbusAddress = 0x01; // The modbus address of the Y551 +const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin + // (-1 if unconnected) +const int8_t y551SensorPower = sensorPowerPin; // Sensor power pin +const int8_t y551EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +const uint8_t y551NumberReadings = 5; +// The manufacturer recommends averaging 10 readings, but we take 5 to minimize +// power consumption + +// Create a Y551 chemical oxygen demand sensor object +YosemitechY551 y551(y551ModbusAddress, modbusSerial, y551AdapterPower, + y551SensorPower, y551EnablePin, y551NumberReadings); + +// Create COD, turbidity, and temperature variable pointers for the Y551 +Variable* y551COD = + new YosemitechY551_COD(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y551Turbid = + new YosemitechY551_Turbidity(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y551Temp = + new YosemitechY551_Temp(&y551, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [y551] */ + + +// ========================================================================== +// Yosemitech Y560 Ammonium Probe with Wiper +// ========================================================================== +/** Start [y560] */ +#include + +// NOTE: Extra hardware and software serial ports are created in the "Settings +// for Additional Serial Ports" section + +byte y560ModbusAddress = 0x60; // The modbus address of the Y560 + // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC +const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin + // (-1 if unconnected) +const int8_t y560SensorPower = sensorPowerPin; // Sensor power pin +const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +const uint8_t y560NumberReadings = 5; +// The manufacturer recommends averaging 10 readings, but we take 5 to minimize +// power consumption + +// Create a Y560 Ammonium Probe object +YosemitechY560 y560(y560ModbusAddress, modbusSerial, y560AdapterPower, + y560SensorPower, y560EnablePin, y560NumberReadings); + +// Create COD, turbidity, and temperature variable pointers for the Y560 +Variable* y560NH4_N = + new YosemitechY560_NH4_N(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y560pH = + new YosemitechY560_pH(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* y560Temp = + new YosemitechY560_Temp(&y560, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [y560] */ + + +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + new ProcessorStats_SampleNumber(&mcuBoard), + new ProcessorStats_FreeRam(&mcuBoard), + new ProcessorStats_Battery(&mcuBoard), + new MaximDS3231_Temp(&ds3231), + y551COD, + y551Turbid, + y551Temp, + y560NH4_N, + y560pH, + y560Temp, + // Additional sensor variables can be added here, by copying the syntax + // for creating the variable pointer (FORM1) from the + // `menu_a_la_carte.ino` example + // The example code snippets in the wiki are primarily FORM2. +}; +// Count up the number of pointers in the array +int variableCount = sizeof(variableList) / sizeof(variableList[0]); + +// Create the VariableArray object +VariableArray varArray; +/** End [variable_arrays] */ + + +// ========================================================================== +// The Logger Object[s] +// ========================================================================== +/** Start [loggers] */ +// Create a logger instance +Logger dataLogger; +/** End [loggers] */ + + +// ========================================================================== +// 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); +} + +// 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]; +} +/** End [working_functions] */ + + +// ========================================================================== +// Arduino Setup Function +// ========================================================================== +/** Start [setup] */ +void setup() { + // Start the primary serial connection + Serial.begin(serialBaud); + + // Print a start-up note to the first serial port + Serial.print(F("Now 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); + + // 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(); + + // 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); + + // Set information pins + dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, + greenLED); + + // Begin the variable array[s], logger[s], and publisher[s] + varArray.begin(variableCount, variableList); + dataLogger.begin(LoggerID, loggingInterval, &varArray); + + // Set up the sensors + Serial.println(F("Setting up sensors...")); + varArray.setupSensors(); + + // 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 + dataLogger.createLogFile(true); // true = write a new header + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [setup] */ + + +// ========================================================================== +// Arduino Loop Function +// ========================================================================== +/** Start [complex_loop] */ +// Use this long loop when you want to do something special +// Because of the way alarms work on the RTC, it will wake the processor and +// start the loop every minute exactly on the minute. +// The processor may also be woken up by another interrupt or level change on a +// pin - from a button or some other input. +// The "if" statements in the loop determine what will happen - whether the +// sensors update, testing mode starts, or it goes back to sleep. +void loop() { + // Reset the watchdog + dataLogger.watchDogTimer.resetWatchDog(); + + // Assuming we were woken up by the clock, check if the current time is an + // even interval of the logging interval + // We're only doing anything at all if the battery is above 3.4V + if (dataLogger.checkInterval() && getBatteryVoltage() > 3.4) { + // Flag to notify that we're in already awake and logging a point + Logger::isLoggingNow = true; + dataLogger.watchDogTimer.resetWatchDog(); + + // Print a line to show new reading + Serial.println(F("------------------------------------------")); + // Turn on the LED to show we're taking a reading + dataLogger.alertOn(); + // Power up the SD Card, but skip any waits after power up + dataLogger.turnOnSDcard(false); + dataLogger.watchDogTimer.resetWatchDog(); + + // // Turn on the modem to let it start searching for the network + // // Only turn the modem on if the battery at the last interval was high + // // enough + // // NOTE: if the modemPowerUp function is not run before the + // // completeUpdate + // // function is run, the modem will not be powered and will not + // // return a signal strength reading. + // if (getBatteryVoltage() > 3.6) modem.modemPowerUp(); + + // Start the stream for the modbus sensors, if your RS485 adapter bleeds + // current from data pins when powered off & you stop modbus serial + // connection with digitalWrite(5, LOW), below. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + altSoftSerial.begin(9600); + + // Do a complete update on the variable array. + // This this includes powering all of the sensors, getting updated + // values, and turing them back off. + // NOTE: The wake function for each sensor should force sensor setup + // to run if the sensor was not previously set up. + varArray.completeUpdate(); + + dataLogger.watchDogTimer.resetWatchDog(); + + // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power + // on sleep, because Modbus Stop bit leaves these pins HIGH. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW + digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW + + // Create a csv data record and save it to the log file + dataLogger.logToSD(); + dataLogger.watchDogTimer.resetWatchDog(); + + // // Connect to the network + // // Again, we're only doing this if the battery is doing well + // if (getBatteryVoltage() > 3.55) { + // dataLogger.watchDogTimer.resetWatchDog(); + // if (modem.connectInternet()) { + // dataLogger.watchDogTimer.resetWatchDog(); + // // Publish data to remotes + // Serial.println(F("Modem connected to internet.")); + // dataLogger.publishDataToRemotes(); + // + // // Sync the clock at midnight + // dataLogger.watchDogTimer.resetWatchDog(); + // if (Logger::markedEpochTime != 0 && + // Logger::markedEpochTime % 86400 == 0) { + // Serial.println(F("Running a daily clock sync...")); + // dataLogger.setRTClock(modem.getNISTTime()); + // dataLogger.watchDogTimer.resetWatchDog(); + // modem.updateModemMetadata(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + // + // // Disconnect from the network + // modem.disconnectInternet(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + // // Turn the modem off + // modem.modemSleepPowerDown(); + // dataLogger.watchDogTimer.resetWatchDog(); + // } + + // Cut power from the SD card - without additional housekeeping wait + dataLogger.turnOffSDcard(false); + dataLogger.watchDogTimer.resetWatchDog(); + // Turn off the LED + dataLogger.alertOff(); + // Print a line to show reading ended + Serial.println(F("------------------------------------------\n")); + + // Unset flag + Logger::isLoggingNow = false; + } + + // Check if it was instead the testing interrupt that woke us up + if (Logger::startTesting) { + // Start the stream for the modbus sensors, if your RS485 adapter bleeds + // current from data pins when powered off & you stop modbus serial + // connection with digitalWrite(5, LOW), below. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + altSoftSerial.begin(9600); + + dataLogger.testingMode(); + } + + // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power + // on sleep, because Modbus Stop bit leaves these pins HIGH. + // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 + digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW + digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW + + // Call the processor sleep + dataLogger.systemSleep(); +} +/** End [complex_loop] */ diff --git a/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini new file mode 100644 index 000000000..3cbbcc85c --- /dev/null +++ b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini @@ -0,0 +1,44 @@ +; 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 + +[platformio] +description = ModularSensors example logging data to an SD card from external sensors +src_dir = utilities/Yosemitech_test_Y551_Y560_simple_logging + +[env:mayfly] +monitor_speed = 115200 +board = mayfly +platform = atmelavr +framework = arduino +lib_ldf_mode = deep+ +lib_ignore = + RTCZero + Adafruit NeoPixel + Adafruit GFX Library + Adafruit SSD1306 + Adafruit ADXL343 + Adafruit STMPE610 + Adafruit TouchScreen + Adafruit ILI9341 +build_flags = + -DSDI12_EXTERNAL_PCINT + -DNEOSWSERIAL_EXTERNAL_PCINT + -DMQTT_MAX_PACKET_SIZE=240 + -DTINY_GSM_RX_BUFFER=64 + -DTINY_GSM_YIELD_MS=2 + -DMS_YOSEMITECHPARENT_DEBUG + ; -D MS_YOSEMITECHPARENT_DEBUG_DEEP +lib_deps = + https://github.com/EnviroDIY/ModularSensors.git#Y551_Y550 +; ^^ Use this when if you want to pull from the develop branch + https://github.com/PaulStoffregen/AltSoftSerial.git + https://github.com/SRGDamia1/NeoSWSerial.git + https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git +; ^^ These are software serial port emulator libraries, you may not need them diff --git a/sensor_tests/simple_logging_Y551/ReadMe.md b/sensor_tests/simple_logging_Y551/ReadMe.md deleted file mode 100644 index d98588f96..000000000 --- a/sensor_tests/simple_logging_Y551/ReadMe.md +++ /dev/null @@ -1,66 +0,0 @@ -[//]: # ( @page example_learn_envirodiy Learn EnviroDIY Example ) -# Using ModularSensors to save data to an SD card - -This shows the simplest use of a "logger" object. -That is, creating an array of variable objects and then creating a logger object that utilizes those variables to update all of the variable results together and save the data to a SD card. -The processor then goes to sleep between readings. -This example calls on two of the sensors available in this library. -The example may be run exactly as written. - -This is the example you should use to deploy a logger somewhere where you don't want or have access to a way of streaming live data and you won't want to upload data to the Monitor My Watershed data portal. - -_______ - -[//]: # ( @tableofcontents ) - -[//]: # ( Start GitHub Only ) -- [Using ModularSensors to save data to an SD card](#using-modularsensors-to-save-data-to-an-sd-card) -- [Unique Features of the Learn EnviroDIY Example](#unique-features-of-the-learn-envirodiy-example) -- [To Use this Example:](#to-use-this-example) - - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - - [Set the logger ID](#set-the-logger-id) - - [Upload!](#upload) - -[//]: # ( End GitHub Only ) - -_______ - -[//]: # ( @section example_learn_envirodiy_unique Unique Features of the Learn EnviroDIY Example ) -# Unique Features of the Learn EnviroDIY Example -- Only logs data to an SD card. -- Uses a few more sensors than the other simple logging example - -[//]: # ( @section example_learn_envirodiy_using To Use this Example: ) -# To Use this Example: - -[//]: # ( @subsection example_learn_envirodiy_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO -- Create a new PlatformIO project -- Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/platformio.ini) file in the examples/simple_logging_LearnEnviroDIY folder on GitHub. - - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. - - Without this, the program won't compile. -- Open [simple_logging_LearnEnviroDIY.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino) and save it to your computer. Put it into the src directory of your project. - - Delete main.cpp in that folder. - -[//]: # ( @subsection example_learn_envirodiy_logger_id Set the logger ID ) -## Set the logger ID -- Change the "XXXX" in this section of code to the loggerID assigned by Stroud: - -```cpp -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char *LoggerID = "XXXX"; -``` - -[//]: # ( @subsection example_learn_envirodiy_upload Upload! ) -## Upload! -- Test everything at home **before** deploying out in the wild! - -_______ - - - -[//]: # ( @section example_learn_envirodiy_pio_config PlatformIO Configuration ) - -[//]: # ( @include{lineno} simple_logging_LearnEnviroDIY/platformio.ini ) - -[//]: # ( @section example_learn_envirodiy_code The Complete Code ) diff --git a/sensor_tests/simple_logging_Y560/ReadMe.md b/sensor_tests/simple_logging_Y560/ReadMe.md deleted file mode 100644 index d98588f96..000000000 --- a/sensor_tests/simple_logging_Y560/ReadMe.md +++ /dev/null @@ -1,66 +0,0 @@ -[//]: # ( @page example_learn_envirodiy Learn EnviroDIY Example ) -# Using ModularSensors to save data to an SD card - -This shows the simplest use of a "logger" object. -That is, creating an array of variable objects and then creating a logger object that utilizes those variables to update all of the variable results together and save the data to a SD card. -The processor then goes to sleep between readings. -This example calls on two of the sensors available in this library. -The example may be run exactly as written. - -This is the example you should use to deploy a logger somewhere where you don't want or have access to a way of streaming live data and you won't want to upload data to the Monitor My Watershed data portal. - -_______ - -[//]: # ( @tableofcontents ) - -[//]: # ( Start GitHub Only ) -- [Using ModularSensors to save data to an SD card](#using-modularsensors-to-save-data-to-an-sd-card) -- [Unique Features of the Learn EnviroDIY Example](#unique-features-of-the-learn-envirodiy-example) -- [To Use this Example:](#to-use-this-example) - - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - - [Set the logger ID](#set-the-logger-id) - - [Upload!](#upload) - -[//]: # ( End GitHub Only ) - -_______ - -[//]: # ( @section example_learn_envirodiy_unique Unique Features of the Learn EnviroDIY Example ) -# Unique Features of the Learn EnviroDIY Example -- Only logs data to an SD card. -- Uses a few more sensors than the other simple logging example - -[//]: # ( @section example_learn_envirodiy_using To Use this Example: ) -# To Use this Example: - -[//]: # ( @subsection example_learn_envirodiy_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO -- Create a new PlatformIO project -- Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/platformio.ini) file in the examples/simple_logging_LearnEnviroDIY folder on GitHub. - - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. - - Without this, the program won't compile. -- Open [simple_logging_LearnEnviroDIY.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino) and save it to your computer. Put it into the src directory of your project. - - Delete main.cpp in that folder. - -[//]: # ( @subsection example_learn_envirodiy_logger_id Set the logger ID ) -## Set the logger ID -- Change the "XXXX" in this section of code to the loggerID assigned by Stroud: - -```cpp -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char *LoggerID = "XXXX"; -``` - -[//]: # ( @subsection example_learn_envirodiy_upload Upload! ) -## Upload! -- Test everything at home **before** deploying out in the wild! - -_______ - - - -[//]: # ( @section example_learn_envirodiy_pio_config PlatformIO Configuration ) - -[//]: # ( @include{lineno} simple_logging_LearnEnviroDIY/platformio.ini ) - -[//]: # ( @section example_learn_envirodiy_code The Complete Code ) diff --git a/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino b/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino index 658960ef1..5712c3f72 100644 --- a/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino +++ b/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino @@ -3,6 +3,7 @@ * @brief A data logging example for the Learn EnviroDIY tutorial. * * @author Sara Geleskie Damiano + * @author Anthony Aufdenkampe * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. @@ -146,12 +147,13 @@ MaximDS3231 ds3231(1); // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y560ModbusAddress = 0x01; // The modbus address of the Y560 +byte y560ModbusAddress = 0x60; // The modbus address of the Y560 + // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin // (-1 if unconnected) const int8_t y560SensorPower = sensorPowerPin; // Sensor power pin const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) -const uint8_t y560NumberReadings = 5; +const uint8_t y560NumberReadings = 3; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index 5b71e1da8..0a3a2e938 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -68,8 +68,8 @@ */ /**@{*/ /// @brief Sensor::_warmUpTime_ms; time before sensor responds after power - -/// <500ms based on testing. -#define Y551_WARM_UP_TIME_MS 500 +/// <500ms for response, but need >1000ms to load capcitors for brush & measure. +#define Y551_WARM_UP_TIME_MS 1000 /// @brief Sensor::_stabilizationTime_ms; time between "StartMeasurement" /// command and stable reading - 2sec in manual & confirmed by testing. #define Y551_STABILIZATION_TIME_MS 2000 diff --git a/src/sensors/YosemitechY560.h b/src/sensors/YosemitechY560.h index ecea847fb..d03ccffc6 100644 --- a/src/sensors/YosemitechY560.h +++ b/src/sensors/YosemitechY560.h @@ -69,12 +69,12 @@ */ /**@{*/ /// @brief Sensor::_warmUpTime_ms; time before sensor responds after power - -/// <200ms based on testing. -#define Y560_WARM_UP_TIME_MS 500 +/// <200ms for response, but need 2-10s to load capcitors for brush & measure. +#define Y560_WARM_UP_TIME_MS 7000 /// @brief Sensor::_stabilizationTime_ms; time between "StartMeasurement" /// command and stable reading 20s in manual but this includes 15s for brushing. /// Setting to 20s to allow for 5s after brushing completes, based on testing. -#define Y560_STABILIZATION_TIME_MS 20000 +#define Y560_STABILIZATION_TIME_MS 18000 /// @brief Sensor::_measurementTime_ms; the Y560 takes 2s to complete a /// measurement according to manual, but testing shows ~1.5s for a new number. #define Y560_MEASUREMENT_TIME_MS 1500 From e27236f22d311d43800b34dd9d064b503848dbe9 Mon Sep 17 00:00:00 2001 From: Anthony Aufdenkampe Date: Wed, 22 Dec 2021 07:25:03 -0600 Subject: [PATCH 15/94] Bump version to 0.33.0 --- ChangeLog.md | 19 ++++++++++++++++++- VERSION | 2 +- docs/Doxyfile | 2 +- library.json | 2 +- library.properties | 2 +- .../platformio.ini | 2 +- src/ModularSensors.h | 2 +- 7 files changed, 24 insertions(+), 7 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index db2258726..285bd9732 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Changed -- Added a longer warm up time and removed some of the set-up to work with the ESP-IDF AT firmware versions >2.0 + ### Added @@ -20,6 +20,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *** +## [0.33.0] + +### Changed +- Renamed the YosemiTech Y550 COD sensor as Y551. See below. +- Added a longer warm up time and removed some of the set-up to work with the ESP-IDF AT firmware versions >2.0 + +### Added +- Added support for the [YosemiTech Y551 COD Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/94.html), which makes a UV254 light absorption and translates it to estimates of Chemical Oxygen Demand (COD) (or Total Organic Carbon (TOC)) and Turbidity. + - NOTE that this upgrade removes the earlier Y550 from the library, as it was never tested and is no longer available form YosemiTech. If anyone has a Y550 sensor, the Y551 commands should work. Let us know if they don't. +- Added support for the [YosemiTech Y560 Ammonium Probe](http://en.yosemitech.com/aspcms/product/2020-4-23/61.html), which is a mini sonde for three Ion Selective Electrode (ISE) sensors (pH, NH4+, K+) that together are used to provide a corrected estimate of total ammonium nitrogen (NH4_N) in mg/L. + - NOTE that this release only includes outputs for NH4_N, pH, and temperature. A future release will also include estimates of potassium (K) and raw potential values from each of the electrodes. +### Removed + +### Fixed + +*** + ## [0.32.2] ### Changed diff --git a/VERSION b/VERSION index 989b29cc3..be386c9ed 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.32.2 +0.33.0 diff --git a/docs/Doxyfile b/docs/Doxyfile index 4f42ba24c..7c24bab51 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -38,7 +38,7 @@ PROJECT_NAME = ModularSensors # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 0.32.2 +PROJECT_NUMBER = 0.33.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 1dfe0e784..46ca778ff 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "EnviroDIY_ModularSensors", - "version": "0.32.2", + "version": "0.33.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 dcf537bb6..1062dea7a 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=EnviroDIY_ModularSensors -version=0.32.2 +version=0.33.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/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini index 3cbbcc85c..ef4439393 100644 --- a/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini +++ b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini @@ -10,7 +10,7 @@ [platformio] description = ModularSensors example logging data to an SD card from external sensors -src_dir = utilities/Yosemitech_test_Y551_Y560_simple_logging +src_dir = sensor_tests/Yosemitech_test_Y551_Y560_simple_logging [env:mayfly] monitor_speed = 115200 diff --git a/src/ModularSensors.h b/src/ModularSensors.h index ed2f57e15..dd1153756 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -14,7 +14,7 @@ /** * @brief The current library version number */ -#define MODULAR_SENSORS_VERSION "0.32.2" +#define MODULAR_SENSORS_VERSION "0.33.0" // To get all of the base classes for ModularSensors, include LoggerBase. // NOTE: Individual sensor definitions must be included separately. From c494c704ee2ce2c899cdfdc08415744436b0078f Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 6 Jan 2022 12:16:59 -0500 Subject: [PATCH 16/94] Some doc edits on Serial Signed-off-by: Sara Damiano --- docs/FAQ/Arduino-Streams.md | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/docs/FAQ/Arduino-Streams.md b/docs/FAQ/Arduino-Streams.md index 5d9772467..527bada18 100644 --- a/docs/FAQ/Arduino-Streams.md +++ b/docs/FAQ/Arduino-Streams.md @@ -20,6 +20,9 @@ The streams can either be an instance of - [NeoSWSerial](https://github.com/SRGDamia1/NeoSWSerial), - [the EnviroDIY modified version of SoftwareSerial](https://github.com/EnviroDIY/SoftwaterSerial_ExternalInts), - or any other stream type you desire. + +Because of the limited number of serial ports available on most boards, I suggest giving first priority (i.e. the first (or only) hardware serial port, "Serial") to your programming and debugging stream going to your PC (if you intend to debug), second priority to the stream for the modem, and third priority to any sensors that require a stream for communication. + The very commonly used build-in version of the software serial library for AVR processors uses interrupts that conflict with several other sub-libraries or this library and _cannot be used_. I repeat. _**You cannot use the built-in version of SoftwareSerial!**_. @@ -28,6 +31,8 @@ It will not work. Period. This is not a bug that will be fixed. +See the section on [Processor/Board Compatibility](https://envirodiy.github.io/ModularSensors/page_processor_compatibility.html) for more specific notes on what serial ports are available on the various supported processors. + [//]: # ( @section page_arduino_hw Hardware Serial ) ## Hardware Serial @@ -38,7 +43,7 @@ Hardware serial ports are also the only option if you need to communicate with a Again, _**always use a hardware serial port for communication if possible!**_ To use a hardware serial stream, you do not need to include any libraries or write any extra lines. -You can simply write in "Serial#" where ever you need a stream. +You can simply write in `Serial#` where ever you need a stream. If you would like to give your hardware serial port an easy-to-remember alias, you can use code like this: ```cpp @@ -50,9 +55,10 @@ HardwareSerial* streamName = &Serial; ## AltSoftSerial If the [proper pins](https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html) are available, **[AltSoftSerial](https://github.com/PaulStoffregen/AltSoftSerial)** by Paul Stoffregen is also superior to SoftwareSerial, especially at slow baud rates. -Neither hardware serial nor AltSoftSerial require any modifications. -Because of the limited number of serial ports available on most boards, I suggest giving first priority (i.e. the first (or only) hardware serial port, "Serial") to your debugging stream going to your PC (if you intend to debug), second priority to the stream for the modem, and third priority to any sensors that require a stream for communication. -See the section on [Processor/Board Compatibility](https://envirodiy.github.io/ModularSensors/page_processor_compatibility.html) for more specific notes on what serial ports are available on the various supported processors. +AltSoftSerial is compatible with ModularSensors "out of the box" - that is, you don't need and modifications to the library or extra defines or build flags to make it work. +The biggest drawback to AltSoftSerial is that it is limited to _a single set of pins on any given processor_. +That means you can only ever have one instance of it running at a time. +On the EnviroDIY Mayfly, the AltSoftSerial pins are 5 (Transmit/Tx/Dout) and 6 (Receive/Rx/Din). To use AltSoftSerial: @@ -69,11 +75,13 @@ AltSoftSerial streamName. Another possible serial port emulator is [NeoSWSerial](https://github.com/SRGDamia1/NeoSWSerial). While not as stable as AltSoftSerial, it supports using any pin with pin change interrupts for communication. -To use NeoSWSerial, you must add the line `-D NEOSWSERIAL_EXTERNAL_PCINT` to the build flags section of your platformio.ini file (or open the NeoSWSerial.h file and find and remove the two slashes from the start of the line `//#define NEOSWSERIAL_EXTERNAL_PCINT`) and then recompile the library. +To use NeoSWSerial with ModularSensors, you must add the line `-D NEOSWSERIAL_EXTERNAL_PCINT` to the build flags section of your platformio.ini file +If you are using the ArduinoIDE, you must find and open the library install location and open and modify the NeoSWSerial.h file. +Find and remove the two slashes from the start of the line `//#define NEOSWSERIAL_EXTERNAL_PCINT`) and then recompile the library. There are instructions in the NeoSWSerial ReadMe on how to use EnableInterrupt to activate NeoSWSerial. -Note that NeoSWSerial is generally incompatible with the SDI-12 communication library on most 8MHz processors (including the EnviroDIY Mayfly). -The two libraries can be compiled together, but because they are in competition for a timer, they cannot be used together. -The way this (ModularSensors) uses the SDI-12 library resets the timer settings when ending communication, so you may be able to use the two libraries together if the communication is not simultaneous. +Note that NeoSWSerial must be used with great care with the SDI-12 communication library on most 8MHz processors (including the EnviroDIY Mayfly). +The two libraries can be compiled together, but because they are in competition for a timer, you must be very careful to enable and disable each when using the other.. +The way this (ModularSensors) uses the SDI-12 library resets the timer settings when ending communication, so you should be able to use the two libraries together. Please test your configuration before deploying it! After correctly compiling NeoSWSerial, to use it: @@ -108,7 +116,7 @@ enableInterrupt(rx_pin, neoSSerial1ISR, CHANGE); ## Neutered SoftwareSerial [The EnviroDIY modified version of SoftwareSerial](https://github.com/EnviroDIY/SoftwaterSerial_ExternalInts) removes direct interrupt control from the SoftwareSerial library, making it dependent on another interrupt library, but able to be compiled with ModularSensors. -This is, by far, the least stable serial port option and should only be used on sensors that are not very picky about the quality of the serial stream or that only require one-way communication (ie, only posting data rather than needing to receive commands). +This is, _by far_, the _least_ stable serial port option and should only be used on sensors that are not very picky about the quality of the serial stream or that only require one-way communication (ie, only posting data rather than needing to receive commands). To use the EnviroDIY modified version of SoftwareSerial: From 33216ef1db2cb03188ad0c0afaeea6f76522b26e Mon Sep 17 00:00:00 2001 From: neilh20 Date: Tue, 18 Jan 2022 16:21:09 -0800 Subject: [PATCH 17/94] fix for potential null pointer logModem --- src/LoggerBase.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index b801fd56c..5f5c197d9 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -337,16 +337,17 @@ bool Logger::syncRTC() { } else { 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 + if (Logger::getNowEpochUTC() % (_loggingIntervalMinutes * 60) > 15) { + Serial.println(F("Putting modem to sleep")); + _logModem->disconnectInternet(); + _logModem->modemSleepPowerDown(); + } } - - // 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 - if (Logger::getNowEpoch() % (_loggingIntervalMinutes * 60) > 15) { - Serial.println(F("Putting modem to sleep")); - _logModem->disconnectInternet(); - _logModem->modemSleepPowerDown(); - } + watchDogTimer.resetWatchDog(); return success; } From 912f04235544d016ea59bd241580d2a11ae207dd Mon Sep 17 00:00:00 2001 From: Shannon Hicks Date: Wed, 26 Jan 2022 13:26:31 -0500 Subject: [PATCH 18/94] Update DRWI_SIM7080LTE.ino --- examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino index 633b4a0bf..84a13760c 100644 --- a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino +++ b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino @@ -97,9 +97,9 @@ const int32_t modemBaud = 9600; // SIM7080 does auto-bauding by default, but // 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, +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 Mayfly1.0 to 3.3v) const int8_t modemStatusPin = 19; // MCU pin used to read modem status From 230637bc61e86ea27cf2657dc42857142d48dc8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 4 Feb 2022 17:08:49 +0000 Subject: [PATCH 19/94] ci: bump actions/setup-python from 2.3.0 to 2.3.2 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2.3.0 to 2.3.2. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2.3.0...v2.3.2) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/build_documentation.yaml | 2 +- .github/workflows/build_examples_platformio.yaml | 2 +- .github/workflows/build_menu.yaml | 2 +- .github/workflows/prepare_release.yaml | 2 +- .github/workflows/verify_library_json.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index cce7693fc..f8ef3aae3 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -23,7 +23,7 @@ jobs: path: code_docs/ModularSensors - name: Set up Python - uses: actions/setup-python@v2.3.0 + uses: actions/setup-python@v2.3.2 - name: Restore Python Dependencies uses: actions/cache@v2.1.7 diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml index 59bb37bf9..a17dad186 100644 --- a/.github/workflows/build_examples_platformio.yaml +++ b/.github/workflows/build_examples_platformio.yaml @@ -41,7 +41,7 @@ jobs: fi - name: Set up Python - uses: actions/setup-python@v2.3.0 + uses: actions/setup-python@v2.3.2 - name: Install PlatformIO run: | diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 8944bc293..0c29fc3d3 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -202,7 +202,7 @@ jobs: fi - name: Set up Python - uses: actions/setup-python@v2.3.0 + uses: actions/setup-python@v2.3.2 - name: Install PlatformIO run: | diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index 4416b772f..137c4c2d0 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@v2.3.0 + uses: actions/setup-python@v2.3.2 - name: Install PlatformIO run: | diff --git a/.github/workflows/verify_library_json.yaml b/.github/workflows/verify_library_json.yaml index 5080c22b2..e1b56b784 100644 --- a/.github/workflows/verify_library_json.yaml +++ b/.github/workflows/verify_library_json.yaml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2.4.0 - name: Set up Python - uses: actions/setup-python@v2.3.0 + uses: actions/setup-python@v2.3.2 - name: Install PlatformIO run: | From 47260c3a93e66915ded3709b7409a899f356f0d4 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 28 Feb 2022 10:58:14 -0500 Subject: [PATCH 20/94] Delete extra sensor tests Signed-off-by: Sara Damiano --- .github/workflows/build_menu.yaml | 3 + continuous_integration/dependencies.json | 4 +- examples/test_lt500/.gitignore | 5 - examples/test_lt500/platformio.ini | 43 -- examples/test_lt500/src/simple_logging.cpp | 227 --------- ...semitech_test_Y551_Y560_simple_logging.ino | 451 ------------------ .../platformio.ini | 44 -- .../simple_logging_Y551/platformio.ini | 43 -- .../simple_logging_Y551.ino | 414 ---------------- .../simple_logging_Y560/platformio.ini | 43 -- .../simple_logging_Y560.ino | 416 ---------------- 11 files changed, 5 insertions(+), 1688 deletions(-) delete mode 100644 examples/test_lt500/.gitignore delete mode 100644 examples/test_lt500/platformio.ini delete mode 100644 examples/test_lt500/src/simple_logging.cpp delete mode 100644 sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino delete mode 100644 sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini delete mode 100644 sensor_tests/simple_logging_Y551/platformio.ini delete mode 100644 sensor_tests/simple_logging_Y551/simple_logging_Y551.ino delete mode 100644 sensor_tests/simple_logging_Y560/platformio.ini delete mode 100644 sensor_tests/simple_logging_Y560/simple_logging_Y560.ino diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 59d536867..6d6ea6c9f 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -169,6 +169,9 @@ jobs: - modemFlag: BUILD_MODEM_SIM7080 sensorFlag: BUILD_SENSOR_Y551 publisherFlag: BUILD_PUB_MMW + - modemFlag: BUILD_MODEM_SIM7080 + sensorFlag: BUILD_SENSOR_Y560 + publisherFlag: BUILD_PUB_MMW - modemFlag: BUILD_MODEM_SIM7080 sensorFlag: BUILD_SENSOR_Y4000 publisherFlag: BUILD_PUB_MMW diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index cfa55d3de..278e9178b 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 6, + "action_cache_version": 7, "dependencies": [ { "name": "EnviroDIY_DS3231", @@ -290,7 +290,7 @@ "owner": "envirodiy", "library id": "2078", "url": "https://github.com/EnviroDIY/YosemitechModbus.git", - "version": "~0.2.5", + "version": "~0.3.0", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", "authors": [ "Sara Damiano", diff --git a/examples/test_lt500/.gitignore b/examples/test_lt500/.gitignore deleted file mode 100644 index 89cc49cbd..000000000 --- a/examples/test_lt500/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -.pio -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch diff --git a/examples/test_lt500/platformio.ini b/examples/test_lt500/platformio.ini deleted file mode 100644 index e7982632c..000000000 --- a/examples/test_lt500/platformio.ini +++ /dev/null @@ -1,43 +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 - -[platformio] -description = ModularSensors example logging data to an SD card - -[env:mayfly] -monitor_speed = 115200 -board = mayfly -platform = atmelavr -framework = arduino -lib_ldf_mode = deep+ -lib_ignore = - RTCZero - Adafruit NeoPixel - Adafruit GFX Library - Adafruit SSD1306 - Adafruit ADXL343 - Adafruit STMPE610 - Adafruit TouchScreen - Adafruit ILI9341 -build_flags = - -DSDI12_EXTERNAL_PCINT - -DNEOSWSERIAL_EXTERNAL_PCINT - -DMQTT_MAX_PACKET_SIZE=240 - -DTINY_GSM_RX_BUFFER=64 - -DTINY_GSM_YIELD_MS=2 -lib_deps = - ;envirodiy/EnviroDIY_ModularSensors -; ^^ Use this when working from an official release of the library - https://github.com/EnviroDIY/ModularSensors.git#develop -; ^^ Use this when if you want to pull from the develop branch - https://github.com/PaulStoffregen/AltSoftSerial.git - https://github.com/SRGDamia1/NeoSWSerial.git - https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git -; ^^ These are software serial port emulator libraries, you may not need them diff --git a/examples/test_lt500/src/simple_logging.cpp b/examples/test_lt500/src/simple_logging.cpp deleted file mode 100644 index 13feded5f..000000000 --- a/examples/test_lt500/src/simple_logging.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/** ========================================================================= - * @file simple_logging.ino - * @brief A simple data logging example. - * - * @author Sara Geleskie Damiano - * @copyright (c) 2017-2020 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. - * - * Build Environment: Visual Studios Code with PlatformIO - * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger - * - * DISCLAIMER: - * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. - * ======================================================================= */ - -// ========================================================================== -// 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 -// ========================================================================== -/** Start [logging_options] */ -// The name of this program file -const char* sketchName = "simple_logging.ino"; -// 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 = 5; -// 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; // 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 -// 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 -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] */ - - -// ========================================================================== -// Using the Processor as a Sensor -// ========================================================================== -/** Start [processor_sensor] */ -#include - -// Create the main processor chip "sensor" - for general metadata -const char* mcuBoardVersion = "v0.5b"; -ProcessorStats mcuBoard(mcuBoardVersion); -/** End [processor_sensor] */ - - -// ========================================================================== -// Insitu Aqua/Level Troll Pressure, Temperature, and Depth Sensor -// ========================================================================== -#include - -const char* ITROLLSDI12address = "1"; // SDI12 Address ITROLL -const uint8_t ITROLLNumberReadings = 2; // The number of readings to average -const int8_t IT_SDI12Power = - sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) -const int8_t IT_SDI12Data = 7; // The SDI12 data pin - -// Create a ITROLL sensor object -InsituTrollSdi12a itrollPhy(*ITROLLSDI12address, IT_SDI12Power, IT_SDI12Data, - ITROLLNumberReadings); - -// ========================================================================== -// Maxim DS3231 RTC (Real Time Clock) -// ========================================================================== -/** Start [ds3231] */ -#include // Includes wrapper functions for Maxim DS3231 RTC - -// Create a DS3231 sensor object, using this constructor function: -MaximDS3231 ds3231(1); -/** End [ds3231] */ - - -// ========================================================================== -// Settings for Additional Sensors -// ========================================================================== -// Additional sensors can setup here, similar to the RTC, but only if -// they have been supported with ModularSensors wrapper functions. See: -// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started -// Syntax for the include statement and constructor function for each sensor is -// at -// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported -// or can be copied from the `menu_a_la_carte.ino` example - - -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== -/** Start [variable_arrays] */ -Variable* variableList[] = { - new InsituTrollSdi12a_Depth(&itrollPhy), - new InsituTrollSdi12a_Temp(&itrollPhy), - new ProcessorStats_SampleNumber(&mcuBoard), - new ProcessorStats_FreeRam(&mcuBoard), - new ProcessorStats_Battery(&mcuBoard), new MaximDS3231_Temp(&ds3231), - - // Additional sensor variables can be added here, by copying the syntax - // for creating the variable pointer (FORM1) from the - // `menu_a_la_carte.ino` example - // The example code snippets in the wiki are primarily FORM2. -}; -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray; -/** End [variable_arrays] */ - - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== -/** Start [loggers] */ -// Create a logger instance -Logger dataLogger; -/** End [loggers] */ - - -// ========================================================================== -// 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); -} -/** End [working_functions] */ - - -// ========================================================================== -// Arduino Setup Function -// ========================================================================== -/** Start [setup] */ -void setup() { - // Start the primary serial connection - Serial.begin(serialBaud); - - // Print a start-up note to the first serial port - Serial.print(F("Now 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); - - // 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(); - - // 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); - - // Set information pins - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, - greenLED); - - // Begin the variable array[s], logger[s], and publisher[s] - varArray.begin(variableCount, variableList); - dataLogger.begin(LoggerID, loggingInterval, &varArray); - - // Set up the sensors - Serial.println(F("Setting up sensors...")); - varArray.setupSensors(); - - // 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 - dataLogger.createLogFile(true); // true = write a new header - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [setup] */ - - -// ========================================================================== -// Arduino Loop Function -// ========================================================================== -/** Start [loop] */ -void loop() { - dataLogger.logData(); -} -/** End [loop] */ diff --git a/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino deleted file mode 100644 index 1e3931f5a..000000000 --- a/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/Yosemitech_test_Y551_Y560_simple_logging.ino +++ /dev/null @@ -1,451 +0,0 @@ -/** ========================================================================= - * @file Yosemitech_test_Y551_Y560_simple_logging.ino - * @brief A data logging example for the Learn EnviroDIY tutorial. - * - * @author Sara Geleskie Damiano - * @author Anthony Aufdenkampe - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. - * - * Build Environment: Visual Studios Code with PlatformIO - * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger - * Created with ModularSensors v0.32.2 - * - * DISCLAIMER: - * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. - * ======================================================================= */ - -// ========================================================================== -// 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] */ - - -// ========================================================================== -// Creating Additional Serial Ports -// ========================================================================== -// The modem and a number of sensors communicate over UART/TTL - often called -// "serial". "Hardware" serial ports (automatically controlled by the MCU) are -// generally the most accurate and should be configured and used for as many -// peripherals as possible. In some cases (ie, modbus communication) many -// sensors can share the same serial port. - -// Unfortunately, most AVR boards have only one or two hardware serial ports, -// so we'll set up three types of extra software serial ports to use - -// AltSoftSerial by Paul Stoffregen -// (https://github.com/PaulStoffregen/AltSoftSerial) is the most accurate -// software serial port for AVR boards. AltSoftSerial can only be used on one -// set of pins on each board so only one AltSoftSerial port can be used. Not all -// AVR boards are supported by AltSoftSerial. -/** Start [altsoftserial] */ -#include -AltSoftSerial altSoftSerial; -/** End [altsoftserial] */ - - -// ========================================================================== -// Assigning Serial Port Functionality -// ========================================================================== - -/** Start [assign_ports_sw] */ - -// Define the serial port for modbus -// Modbus (at 9600 8N1) is used by the Keller level loggers and Yosemitech -// sensors -// Since AltSoftSerial is the best software option, we use it for modbus -// If AltSoftSerial (or its pins) aren't avaiable, use NeoSWSerial -// SoftwareSerial **WILL NOT** work for modbus! -#define modbusSerial altSoftSerial // For AltSoftSerial -// #define modbusSerial neoSSerial1 // For Neo software serial -// #define modbusSerial softSerial1 // For software serial - -/** End [assign_ports_sw] */ - - -// ========================================================================== -// Data Logging Options -// ========================================================================== -/** Start [logging_options] */ -// The name of this program file -const char* sketchName = "Yosemitech_test_Y551_Y560_simple_logging.ino"; -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char* LoggerID = "Yosemitech_test_Y551_Y560_simple_logging"; -// How frequently (in minutes) to log data -const uint8_t loggingInterval = 1; -// 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; // 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 -// 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 -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] */ - - -// ========================================================================== -// 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 // Includes wrapper functions for Maxim DS3231 RTC - -// Create a DS3231 sensor object, using this constructor function: -MaximDS3231 ds3231(1); -/** End [ds3231] */ - - -// ========================================================================== -// Settings for Additional Sensors -// ========================================================================== -// Additional sensors can setup here, similar to the RTC, but only if -// they have been supported with ModularSensors wrapper functions. See: -// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started -// Syntax for the include statement and constructor function for each sensor is -// at -// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported -// or can be copied from the `menu_a_la_carte.ino` example - -// ========================================================================== -// Yosemitech Y551 COD Sensor with Wiper -// ========================================================================== -/** Start [y551] */ -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section - -byte y551ModbusAddress = 0x01; // The modbus address of the Y551 -const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y551SensorPower = sensorPowerPin; // Sensor power pin -const int8_t y551EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) -const uint8_t y551NumberReadings = 5; -// The manufacturer recommends averaging 10 readings, but we take 5 to minimize -// power consumption - -// Create a Y551 chemical oxygen demand sensor object -YosemitechY551 y551(y551ModbusAddress, modbusSerial, y551AdapterPower, - y551SensorPower, y551EnablePin, y551NumberReadings); - -// Create COD, turbidity, and temperature variable pointers for the Y551 -Variable* y551COD = - new YosemitechY551_COD(&y551, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y551Turbid = - new YosemitechY551_Turbidity(&y551, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y551Temp = - new YosemitechY551_Temp(&y551, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y551] */ - - -// ========================================================================== -// Yosemitech Y560 Ammonium Probe with Wiper -// ========================================================================== -/** Start [y560] */ -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section - -byte y560ModbusAddress = 0x60; // The modbus address of the Y560 - // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC -const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y560SensorPower = sensorPowerPin; // Sensor power pin -const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) -const uint8_t y560NumberReadings = 5; -// The manufacturer recommends averaging 10 readings, but we take 5 to minimize -// power consumption - -// Create a Y560 Ammonium Probe object -YosemitechY560 y560(y560ModbusAddress, modbusSerial, y560AdapterPower, - y560SensorPower, y560EnablePin, y560NumberReadings); - -// Create COD, turbidity, and temperature variable pointers for the Y560 -Variable* y560NH4_N = - new YosemitechY560_NH4_N(&y560, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y560pH = - new YosemitechY560_pH(&y560, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y560Temp = - new YosemitechY560_Temp(&y560, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y560] */ - - -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== -/** Start [variable_arrays] */ -Variable* variableList[] = { - new ProcessorStats_SampleNumber(&mcuBoard), - new ProcessorStats_FreeRam(&mcuBoard), - new ProcessorStats_Battery(&mcuBoard), - new MaximDS3231_Temp(&ds3231), - y551COD, - y551Turbid, - y551Temp, - y560NH4_N, - y560pH, - y560Temp, - // Additional sensor variables can be added here, by copying the syntax - // for creating the variable pointer (FORM1) from the - // `menu_a_la_carte.ino` example - // The example code snippets in the wiki are primarily FORM2. -}; -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray; -/** End [variable_arrays] */ - - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== -/** Start [loggers] */ -// Create a logger instance -Logger dataLogger; -/** End [loggers] */ - - -// ========================================================================== -// 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); -} - -// 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]; -} -/** End [working_functions] */ - - -// ========================================================================== -// Arduino Setup Function -// ========================================================================== -/** Start [setup] */ -void setup() { - // Start the primary serial connection - Serial.begin(serialBaud); - - // Print a start-up note to the first serial port - Serial.print(F("Now 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); - - // 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(); - - // 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); - - // Set information pins - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, - greenLED); - - // Begin the variable array[s], logger[s], and publisher[s] - varArray.begin(variableCount, variableList); - dataLogger.begin(LoggerID, loggingInterval, &varArray); - - // Set up the sensors - Serial.println(F("Setting up sensors...")); - varArray.setupSensors(); - - // 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 - dataLogger.createLogFile(true); // true = write a new header - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [setup] */ - - -// ========================================================================== -// Arduino Loop Function -// ========================================================================== -/** Start [complex_loop] */ -// Use this long loop when you want to do something special -// Because of the way alarms work on the RTC, it will wake the processor and -// start the loop every minute exactly on the minute. -// The processor may also be woken up by another interrupt or level change on a -// pin - from a button or some other input. -// The "if" statements in the loop determine what will happen - whether the -// sensors update, testing mode starts, or it goes back to sleep. -void loop() { - // Reset the watchdog - dataLogger.watchDogTimer.resetWatchDog(); - - // Assuming we were woken up by the clock, check if the current time is an - // even interval of the logging interval - // We're only doing anything at all if the battery is above 3.4V - if (dataLogger.checkInterval() && getBatteryVoltage() > 3.4) { - // Flag to notify that we're in already awake and logging a point - Logger::isLoggingNow = true; - dataLogger.watchDogTimer.resetWatchDog(); - - // Print a line to show new reading - Serial.println(F("------------------------------------------")); - // Turn on the LED to show we're taking a reading - dataLogger.alertOn(); - // Power up the SD Card, but skip any waits after power up - dataLogger.turnOnSDcard(false); - dataLogger.watchDogTimer.resetWatchDog(); - - // // Turn on the modem to let it start searching for the network - // // Only turn the modem on if the battery at the last interval was high - // // enough - // // NOTE: if the modemPowerUp function is not run before the - // // completeUpdate - // // function is run, the modem will not be powered and will not - // // return a signal strength reading. - // if (getBatteryVoltage() > 3.6) modem.modemPowerUp(); - - // Start the stream for the modbus sensors, if your RS485 adapter bleeds - // current from data pins when powered off & you stop modbus serial - // connection with digitalWrite(5, LOW), below. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - altSoftSerial.begin(9600); - - // Do a complete update on the variable array. - // This this includes powering all of the sensors, getting updated - // values, and turing them back off. - // NOTE: The wake function for each sensor should force sensor setup - // to run if the sensor was not previously set up. - varArray.completeUpdate(); - - dataLogger.watchDogTimer.resetWatchDog(); - - // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power - // on sleep, because Modbus Stop bit leaves these pins HIGH. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW - digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW - - // Create a csv data record and save it to the log file - dataLogger.logToSD(); - dataLogger.watchDogTimer.resetWatchDog(); - - // // Connect to the network - // // Again, we're only doing this if the battery is doing well - // if (getBatteryVoltage() > 3.55) { - // dataLogger.watchDogTimer.resetWatchDog(); - // if (modem.connectInternet()) { - // dataLogger.watchDogTimer.resetWatchDog(); - // // Publish data to remotes - // Serial.println(F("Modem connected to internet.")); - // dataLogger.publishDataToRemotes(); - // - // // Sync the clock at midnight - // dataLogger.watchDogTimer.resetWatchDog(); - // if (Logger::markedEpochTime != 0 && - // Logger::markedEpochTime % 86400 == 0) { - // Serial.println(F("Running a daily clock sync...")); - // dataLogger.setRTClock(modem.getNISTTime()); - // dataLogger.watchDogTimer.resetWatchDog(); - // modem.updateModemMetadata(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - // - // // Disconnect from the network - // modem.disconnectInternet(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - // // Turn the modem off - // modem.modemSleepPowerDown(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - - // Cut power from the SD card - without additional housekeeping wait - dataLogger.turnOffSDcard(false); - dataLogger.watchDogTimer.resetWatchDog(); - // Turn off the LED - dataLogger.alertOff(); - // Print a line to show reading ended - Serial.println(F("------------------------------------------\n")); - - // Unset flag - Logger::isLoggingNow = false; - } - - // Check if it was instead the testing interrupt that woke us up - if (Logger::startTesting) { - // Start the stream for the modbus sensors, if your RS485 adapter bleeds - // current from data pins when powered off & you stop modbus serial - // connection with digitalWrite(5, LOW), below. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - altSoftSerial.begin(9600); - - dataLogger.testingMode(); - } - - // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power - // on sleep, because Modbus Stop bit leaves these pins HIGH. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW - digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [complex_loop] */ diff --git a/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini b/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini deleted file mode 100644 index ef4439393..000000000 --- a/sensor_tests/Yosemitech_test_Y551_Y560_simple_logging/platformio.ini +++ /dev/null @@ -1,44 +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 - -[platformio] -description = ModularSensors example logging data to an SD card from external sensors -src_dir = sensor_tests/Yosemitech_test_Y551_Y560_simple_logging - -[env:mayfly] -monitor_speed = 115200 -board = mayfly -platform = atmelavr -framework = arduino -lib_ldf_mode = deep+ -lib_ignore = - RTCZero - Adafruit NeoPixel - Adafruit GFX Library - Adafruit SSD1306 - Adafruit ADXL343 - Adafruit STMPE610 - Adafruit TouchScreen - Adafruit ILI9341 -build_flags = - -DSDI12_EXTERNAL_PCINT - -DNEOSWSERIAL_EXTERNAL_PCINT - -DMQTT_MAX_PACKET_SIZE=240 - -DTINY_GSM_RX_BUFFER=64 - -DTINY_GSM_YIELD_MS=2 - -DMS_YOSEMITECHPARENT_DEBUG - ; -D MS_YOSEMITECHPARENT_DEBUG_DEEP -lib_deps = - https://github.com/EnviroDIY/ModularSensors.git#Y551_Y550 -; ^^ Use this when if you want to pull from the develop branch - https://github.com/PaulStoffregen/AltSoftSerial.git - https://github.com/SRGDamia1/NeoSWSerial.git - https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git -; ^^ These are software serial port emulator libraries, you may not need them diff --git a/sensor_tests/simple_logging_Y551/platformio.ini b/sensor_tests/simple_logging_Y551/platformio.ini deleted file mode 100644 index dee5ef352..000000000 --- a/sensor_tests/simple_logging_Y551/platformio.ini +++ /dev/null @@ -1,43 +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 - -[platformio] -description = ModularSensors example logging data to an SD card from external sensors -src_dir = sensor_tests/simple_logging_Y551 - -[env:mayfly] -monitor_speed = 115200 -board = mayfly -platform = atmelavr -framework = arduino -lib_ldf_mode = deep+ -lib_ignore = - RTCZero - Adafruit NeoPixel - Adafruit GFX Library - Adafruit SSD1306 - Adafruit ADXL343 - Adafruit STMPE610 - Adafruit TouchScreen - Adafruit ILI9341 -build_flags = - -DSDI12_EXTERNAL_PCINT - -DNEOSWSERIAL_EXTERNAL_PCINT - -DMQTT_MAX_PACKET_SIZE=240 - -DTINY_GSM_RX_BUFFER=64 - -DTINY_GSM_YIELD_MS=2 - -DMS_YOSEMITECHPARENT_DEBUG -lib_deps = - https://github.com/EnviroDIY/ModularSensors.git#Y551_Y550 -; ^^ Use this when if you want to pull from the develop branch - https://github.com/PaulStoffregen/AltSoftSerial.git - https://github.com/SRGDamia1/NeoSWSerial.git - https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git -; ^^ These are software serial port emulator libraries, you may not need them diff --git a/sensor_tests/simple_logging_Y551/simple_logging_Y551.ino b/sensor_tests/simple_logging_Y551/simple_logging_Y551.ino deleted file mode 100644 index 803673153..000000000 --- a/sensor_tests/simple_logging_Y551/simple_logging_Y551.ino +++ /dev/null @@ -1,414 +0,0 @@ -/** ========================================================================= - * @file simple_logging_Y551.ino - * @brief A data logging example for the Learn EnviroDIY tutorial. - * - * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. - * - * Build Environment: Visual Studios Code with PlatformIO - * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger - * Created with ModularSensors v0.32.2 - * - * DISCLAIMER: - * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. - * ======================================================================= */ - -// ========================================================================== -// 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] */ - - -// ========================================================================== -// Creating Additional Serial Ports -// ========================================================================== -// The modem and a number of sensors communicate over UART/TTL - often called -// "serial". "Hardware" serial ports (automatically controlled by the MCU) are -// generally the most accurate and should be configured and used for as many -// peripherals as possible. In some cases (ie, modbus communication) many -// sensors can share the same serial port. - -// Unfortunately, most AVR boards have only one or two hardware serial ports, -// so we'll set up three types of extra software serial ports to use - -// AltSoftSerial by Paul Stoffregen -// (https://github.com/PaulStoffregen/AltSoftSerial) is the most accurate -// software serial port for AVR boards. AltSoftSerial can only be used on one -// set of pins on each board so only one AltSoftSerial port can be used. Not all -// AVR boards are supported by AltSoftSerial. -/** Start [altsoftserial] */ -#include -AltSoftSerial altSoftSerial; -/** End [altsoftserial] */ - - -// ========================================================================== -// Assigning Serial Port Functionality -// ========================================================================== - -/** Start [assign_ports_sw] */ - -// Define the serial port for modbus -// Modbus (at 9600 8N1) is used by the Keller level loggers and Yosemitech -// sensors -// Since AltSoftSerial is the best software option, we use it for modbus -// If AltSoftSerial (or its pins) aren't avaiable, use NeoSWSerial -// SoftwareSerial **WILL NOT** work for modbus! -#define modbusSerial altSoftSerial // For AltSoftSerial -// #define modbusSerial neoSSerial1 // For Neo software serial -// #define modbusSerial softSerial1 // For software serial - -/** End [assign_ports_sw] */ - - -// ========================================================================== -// Data Logging Options -// ========================================================================== -/** Start [logging_options] */ -// The name of this program file -const char* sketchName = "simple_logging_Y551.ino"; -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char* LoggerID = "simple_logging_Y551"; -// How frequently (in minutes) to log data -const uint8_t loggingInterval = 1; -// 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; // 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 -// 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 -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] */ - - -// ========================================================================== -// 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 // Includes wrapper functions for Maxim DS3231 RTC - -// Create a DS3231 sensor object, using this constructor function: -MaximDS3231 ds3231(1); -/** End [ds3231] */ - - -// ========================================================================== -// Settings for Additional Sensors -// ========================================================================== -// Additional sensors can setup here, similar to the RTC, but only if -// they have been supported with ModularSensors wrapper functions. See: -// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started -// Syntax for the include statement and constructor function for each sensor is -// at -// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported -// or can be copied from the `menu_a_la_carte.ino` example - -// ========================================================================== -// Yosemitech Y551 COD Sensor with Wiper -// ========================================================================== -/** Start [y551] */ -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section - -byte y551ModbusAddress = 0x01; // The modbus address of the Y551 -const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y551SensorPower = sensorPowerPin; // Sensor power pin -const int8_t y551EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) -const uint8_t y551NumberReadings = 5; -// The manufacturer recommends averaging 10 readings, but we take 5 to minimize -// power consumption - -// Create a Y551 chemical oxygen demand sensor object -YosemitechY551 y551(y551ModbusAddress, modbusSerial, y551AdapterPower, - y551SensorPower, y551EnablePin, y551NumberReadings); - -// Create COD, turbidity, and temperature variable pointers for the Y551 -Variable* y551COD = - new YosemitechY551_COD(&y551, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y551Turbid = - new YosemitechY551_Turbidity(&y551, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y551Temp = - new YosemitechY551_Temp(&y551, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y551] */ - - -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== -/** Start [variable_arrays] */ -Variable* variableList[] = { - new ProcessorStats_SampleNumber(&mcuBoard), - new ProcessorStats_FreeRam(&mcuBoard), - new ProcessorStats_Battery(&mcuBoard), - new MaximDS3231_Temp(&ds3231), - y551COD, - y551Turbid, - y551Temp, - // Additional sensor variables can be added here, by copying the syntax - // for creating the variable pointer (FORM1) from the - // `menu_a_la_carte.ino` example - // The example code snippets in the wiki are primarily FORM2. -}; -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray; -/** End [variable_arrays] */ - - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== -/** Start [loggers] */ -// Create a logger instance -Logger dataLogger; -/** End [loggers] */ - - -// ========================================================================== -// 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); -} - -// 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]; -} -/** End [working_functions] */ - - -// ========================================================================== -// Arduino Setup Function -// ========================================================================== -/** Start [setup] */ -void setup() { - // Start the primary serial connection - Serial.begin(serialBaud); - - // Print a start-up note to the first serial port - Serial.print(F("Now 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); - - // 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(); - - // 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); - - // Set information pins - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, - greenLED); - - // Begin the variable array[s], logger[s], and publisher[s] - varArray.begin(variableCount, variableList); - dataLogger.begin(LoggerID, loggingInterval, &varArray); - - // Set up the sensors - Serial.println(F("Setting up sensors...")); - varArray.setupSensors(); - - // 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 - dataLogger.createLogFile(true); // true = write a new header - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [setup] */ - - -// ========================================================================== -// Arduino Loop Function -// ========================================================================== -/** Start [complex_loop] */ -// Use this long loop when you want to do something special -// Because of the way alarms work on the RTC, it will wake the processor and -// start the loop every minute exactly on the minute. -// The processor may also be woken up by another interrupt or level change on a -// pin - from a button or some other input. -// The "if" statements in the loop determine what will happen - whether the -// sensors update, testing mode starts, or it goes back to sleep. -void loop() { - // Reset the watchdog - dataLogger.watchDogTimer.resetWatchDog(); - - // Assuming we were woken up by the clock, check if the current time is an - // even interval of the logging interval - // We're only doing anything at all if the battery is above 3.4V - if (dataLogger.checkInterval() && getBatteryVoltage() > 3.4) { - // Flag to notify that we're in already awake and logging a point - Logger::isLoggingNow = true; - dataLogger.watchDogTimer.resetWatchDog(); - - // Print a line to show new reading - Serial.println(F("------------------------------------------")); - // Turn on the LED to show we're taking a reading - dataLogger.alertOn(); - // Power up the SD Card, but skip any waits after power up - dataLogger.turnOnSDcard(false); - dataLogger.watchDogTimer.resetWatchDog(); - - // // Turn on the modem to let it start searching for the network - // // Only turn the modem on if the battery at the last interval was high - // // enough - // // NOTE: if the modemPowerUp function is not run before the - // // completeUpdate - // // function is run, the modem will not be powered and will not - // // return a signal strength reading. - // if (getBatteryVoltage() > 3.6) modem.modemPowerUp(); - - // Start the stream for the modbus sensors, if your RS485 adapter bleeds - // current from data pins when powered off & you stop modbus serial - // connection with digitalWrite(5, LOW), below. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - altSoftSerial.begin(9600); - - // Do a complete update on the variable array. - // This this includes powering all of the sensors, getting updated - // values, and turing them back off. - // NOTE: The wake function for each sensor should force sensor setup - // to run if the sensor was not previously set up. - varArray.completeUpdate(); - - dataLogger.watchDogTimer.resetWatchDog(); - - // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power - // on sleep, because Modbus Stop bit leaves these pins HIGH. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW - digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW - - // Create a csv data record and save it to the log file - dataLogger.logToSD(); - dataLogger.watchDogTimer.resetWatchDog(); - - // // Connect to the network - // // Again, we're only doing this if the battery is doing well - // if (getBatteryVoltage() > 3.55) { - // dataLogger.watchDogTimer.resetWatchDog(); - // if (modem.connectInternet()) { - // dataLogger.watchDogTimer.resetWatchDog(); - // // Publish data to remotes - // Serial.println(F("Modem connected to internet.")); - // dataLogger.publishDataToRemotes(); - // - // // Sync the clock at midnight - // dataLogger.watchDogTimer.resetWatchDog(); - // if (Logger::markedEpochTime != 0 && - // Logger::markedEpochTime % 86400 == 0) { - // Serial.println(F("Running a daily clock sync...")); - // dataLogger.setRTClock(modem.getNISTTime()); - // dataLogger.watchDogTimer.resetWatchDog(); - // modem.updateModemMetadata(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - // - // // Disconnect from the network - // modem.disconnectInternet(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - // // Turn the modem off - // modem.modemSleepPowerDown(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - - // Cut power from the SD card - without additional housekeeping wait - dataLogger.turnOffSDcard(false); - dataLogger.watchDogTimer.resetWatchDog(); - // Turn off the LED - dataLogger.alertOff(); - // Print a line to show reading ended - Serial.println(F("------------------------------------------\n")); - - // Unset flag - Logger::isLoggingNow = false; - } - - // Check if it was instead the testing interrupt that woke us up - if (Logger::startTesting) { - // Start the stream for the modbus sensors, if your RS485 adapter bleeds - // current from data pins when powered off & you stop modbus serial - // connection with digitalWrite(5, LOW), below. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - altSoftSerial.begin(9600); - - dataLogger.testingMode(); - } - - // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power - // on sleep, because Modbus Stop bit leaves these pins HIGH. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW - digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [complex_loop] */ diff --git a/sensor_tests/simple_logging_Y560/platformio.ini b/sensor_tests/simple_logging_Y560/platformio.ini deleted file mode 100644 index 4224fe29a..000000000 --- a/sensor_tests/simple_logging_Y560/platformio.ini +++ /dev/null @@ -1,43 +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 - -[platformio] -description = ModularSensors example logging data to an SD card from external sensors -src_dir = sensor_tests/simple_logging_Y560 - -[env:mayfly] -monitor_speed = 115200 -board = mayfly -platform = atmelavr -framework = arduino -lib_ldf_mode = deep+ -lib_ignore = - RTCZero - Adafruit NeoPixel - Adafruit GFX Library - Adafruit SSD1306 - Adafruit ADXL343 - Adafruit STMPE610 - Adafruit TouchScreen - Adafruit ILI9341 -build_flags = - -DSDI12_EXTERNAL_PCINT - -DNEOSWSERIAL_EXTERNAL_PCINT - -DMQTT_MAX_PACKET_SIZE=240 - -DTINY_GSM_RX_BUFFER=64 - -DTINY_GSM_YIELD_MS=2 - -DMS_YOSEMITECHPARENT_DEBUG -lib_deps = - https://github.com/EnviroDIY/ModularSensors.git#Y551_Y550 -; ^^ Use this when if you want to pull from the develop branch - https://github.com/PaulStoffregen/AltSoftSerial.git - https://github.com/SRGDamia1/NeoSWSerial.git - https://github.com/EnviroDIY/SoftwareSerial_ExternalInts.git -; ^^ These are software serial port emulator libraries, you may not need them diff --git a/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino b/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino deleted file mode 100644 index 5712c3f72..000000000 --- a/sensor_tests/simple_logging_Y560/simple_logging_Y560.ino +++ /dev/null @@ -1,416 +0,0 @@ -/** ========================================================================= - * @file simple_logging_Y560.ino - * @brief A data logging example for the Learn EnviroDIY tutorial. - * - * @author Sara Geleskie Damiano - * @author Anthony Aufdenkampe - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) - * and the EnviroDIY Development Team - * This example is published under the BSD-3 license. - * - * Build Environment: Visual Studios Code with PlatformIO - * Hardware Platform: EnviroDIY Mayfly Arduino Datalogger - * Created with ModularSensors v0.32.2 - * - * DISCLAIMER: - * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. - * ======================================================================= */ - -// ========================================================================== -// 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] */ - - -// ========================================================================== -// Creating Additional Serial Ports -// ========================================================================== -// The modem and a number of sensors communicate over UART/TTL - often called -// "serial". "Hardware" serial ports (automatically controlled by the MCU) are -// generally the most accurate and should be configured and used for as many -// peripherals as possible. In some cases (ie, modbus communication) many -// sensors can share the same serial port. - -// Unfortunately, most AVR boards have only one or two hardware serial ports, -// so we'll set up three types of extra software serial ports to use - -// AltSoftSerial by Paul Stoffregen -// (https://github.com/PaulStoffregen/AltSoftSerial) is the most accurate -// software serial port for AVR boards. AltSoftSerial can only be used on one -// set of pins on each board so only one AltSoftSerial port can be used. Not all -// AVR boards are supported by AltSoftSerial. -/** Start [altsoftserial] */ -#include -AltSoftSerial altSoftSerial; -/** End [altsoftserial] */ - - -// ========================================================================== -// Assigning Serial Port Functionality -// ========================================================================== - -/** Start [assign_ports_sw] */ - -// Define the serial port for modbus -// Modbus (at 9600 8N1) is used by the Keller level loggers and Yosemitech -// sensors -// Since AltSoftSerial is the best software option, we use it for modbus -// If AltSoftSerial (or its pins) aren't avaiable, use NeoSWSerial -// SoftwareSerial **WILL NOT** work for modbus! -#define modbusSerial altSoftSerial // For AltSoftSerial -// #define modbusSerial neoSSerial1 // For Neo software serial -// #define modbusSerial softSerial1 // For software serial - -/** End [assign_ports_sw] */ - - -// ========================================================================== -// Data Logging Options -// ========================================================================== -/** Start [logging_options] */ -// The name of this program file -const char* sketchName = "simple_logging_Y560.ino"; -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char* LoggerID = "simple_logging_Y560"; -// How frequently (in minutes) to log data -const uint8_t loggingInterval = 1; -// 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; // 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 -// 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 -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] */ - - -// ========================================================================== -// 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 // Includes wrapper functions for Maxim DS3231 RTC - -// Create a DS3231 sensor object, using this constructor function: -MaximDS3231 ds3231(1); -/** End [ds3231] */ - - -// ========================================================================== -// Settings for Additional Sensors -// ========================================================================== -// Additional sensors can setup here, similar to the RTC, but only if -// they have been supported with ModularSensors wrapper functions. See: -// https://github.com/EnviroDIY/ModularSensors/wiki#just-getting-started -// Syntax for the include statement and constructor function for each sensor is -// at -// https://github.com/EnviroDIY/ModularSensors/wiki#these-sensors-are-currently-supported -// or can be copied from the `menu_a_la_carte.ino` example - -// ========================================================================== -// Yosemitech Y560 Ammonium Probe with Wiper -// ========================================================================== -/** Start [y560] */ -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section - -byte y560ModbusAddress = 0x60; // The modbus address of the Y560 - // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC -const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y560SensorPower = sensorPowerPin; // Sensor power pin -const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) -const uint8_t y560NumberReadings = 3; -// The manufacturer recommends averaging 10 readings, but we take 5 to minimize -// power consumption - -// Create a Y560 Ammonium Probe object -YosemitechY560 y560(y560ModbusAddress, modbusSerial, y560AdapterPower, - y560SensorPower, y560EnablePin, y560NumberReadings); - -// Create COD, turbidity, and temperature variable pointers for the Y560 -Variable* y560NH4_N = - new YosemitechY560_NH4_N(&y560, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y560pH = - new YosemitechY560_pH(&y560, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* y560Temp = - new YosemitechY560_Temp(&y560, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y560] */ - - -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== -/** Start [variable_arrays] */ -Variable* variableList[] = { - new ProcessorStats_SampleNumber(&mcuBoard), - new ProcessorStats_FreeRam(&mcuBoard), - new ProcessorStats_Battery(&mcuBoard), - new MaximDS3231_Temp(&ds3231), - y560NH4_N, - y560pH, - y560Temp, - // Additional sensor variables can be added here, by copying the syntax - // for creating the variable pointer (FORM1) from the - // `menu_a_la_carte.ino` example - // The example code snippets in the wiki are primarily FORM2. -}; -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray; -/** End [variable_arrays] */ - - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== -/** Start [loggers] */ -// Create a logger instance -Logger dataLogger; -/** End [loggers] */ - - -// ========================================================================== -// 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); -} - -// 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]; -} -/** End [working_functions] */ - - -// ========================================================================== -// Arduino Setup Function -// ========================================================================== -/** Start [setup] */ -void setup() { - // Start the primary serial connection - Serial.begin(serialBaud); - - // Print a start-up note to the first serial port - Serial.print(F("Now 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); - - // 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(); - - // 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); - - // Set information pins - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, buttonPin, - greenLED); - - // Begin the variable array[s], logger[s], and publisher[s] - varArray.begin(variableCount, variableList); - dataLogger.begin(LoggerID, loggingInterval, &varArray); - - // Set up the sensors - Serial.println(F("Setting up sensors...")); - varArray.setupSensors(); - - // 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 - dataLogger.createLogFile(true); // true = write a new header - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [setup] */ - - -// ========================================================================== -// Arduino Loop Function -// ========================================================================== -/** Start [complex_loop] */ -// Use this long loop when you want to do something special -// Because of the way alarms work on the RTC, it will wake the processor and -// start the loop every minute exactly on the minute. -// The processor may also be woken up by another interrupt or level change on a -// pin - from a button or some other input. -// The "if" statements in the loop determine what will happen - whether the -// sensors update, testing mode starts, or it goes back to sleep. -void loop() { - // Reset the watchdog - dataLogger.watchDogTimer.resetWatchDog(); - - // Assuming we were woken up by the clock, check if the current time is an - // even interval of the logging interval - // We're only doing anything at all if the battery is above 3.4V - if (dataLogger.checkInterval() && getBatteryVoltage() > 3.4) { - // Flag to notify that we're in already awake and logging a point - Logger::isLoggingNow = true; - dataLogger.watchDogTimer.resetWatchDog(); - - // Print a line to show new reading - Serial.println(F("------------------------------------------")); - // Turn on the LED to show we're taking a reading - dataLogger.alertOn(); - // Power up the SD Card, but skip any waits after power up - dataLogger.turnOnSDcard(false); - dataLogger.watchDogTimer.resetWatchDog(); - - // // Turn on the modem to let it start searching for the network - // // Only turn the modem on if the battery at the last interval was high - // // enough - // // NOTE: if the modemPowerUp function is not run before the - // // completeUpdate - // // function is run, the modem will not be powered and will not - // // return a signal strength reading. - // if (getBatteryVoltage() > 3.6) modem.modemPowerUp(); - - // Start the stream for the modbus sensors, if your RS485 adapter bleeds - // current from data pins when powered off & you stop modbus serial - // connection with digitalWrite(5, LOW), below. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - altSoftSerial.begin(9600); - - // Do a complete update on the variable array. - // This this includes powering all of the sensors, getting updated - // values, and turing them back off. - // NOTE: The wake function for each sensor should force sensor setup - // to run if the sensor was not previously set up. - varArray.completeUpdate(); - - dataLogger.watchDogTimer.resetWatchDog(); - - // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power - // on sleep, because Modbus Stop bit leaves these pins HIGH. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW - digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW - - // Create a csv data record and save it to the log file - dataLogger.logToSD(); - dataLogger.watchDogTimer.resetWatchDog(); - - // // Connect to the network - // // Again, we're only doing this if the battery is doing well - // if (getBatteryVoltage() > 3.55) { - // dataLogger.watchDogTimer.resetWatchDog(); - // if (modem.connectInternet()) { - // dataLogger.watchDogTimer.resetWatchDog(); - // // Publish data to remotes - // Serial.println(F("Modem connected to internet.")); - // dataLogger.publishDataToRemotes(); - // - // // Sync the clock at midnight - // dataLogger.watchDogTimer.resetWatchDog(); - // if (Logger::markedEpochTime != 0 && - // Logger::markedEpochTime % 86400 == 0) { - // Serial.println(F("Running a daily clock sync...")); - // dataLogger.setRTClock(modem.getNISTTime()); - // dataLogger.watchDogTimer.resetWatchDog(); - // modem.updateModemMetadata(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - // - // // Disconnect from the network - // modem.disconnectInternet(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - // // Turn the modem off - // modem.modemSleepPowerDown(); - // dataLogger.watchDogTimer.resetWatchDog(); - // } - - // Cut power from the SD card - without additional housekeeping wait - dataLogger.turnOffSDcard(false); - dataLogger.watchDogTimer.resetWatchDog(); - // Turn off the LED - dataLogger.alertOff(); - // Print a line to show reading ended - Serial.println(F("------------------------------------------\n")); - - // Unset flag - Logger::isLoggingNow = false; - } - - // Check if it was instead the testing interrupt that woke us up - if (Logger::startTesting) { - // Start the stream for the modbus sensors, if your RS485 adapter bleeds - // current from data pins when powered off & you stop modbus serial - // connection with digitalWrite(5, LOW), below. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - altSoftSerial.begin(9600); - - dataLogger.testingMode(); - } - - // Reset modbus serial pins to LOW, if your RS485 adapter bleeds power - // on sleep, because Modbus Stop bit leaves these pins HIGH. - // https://github.com/EnviroDIY/ModularSensors/issues/140#issuecomment-389380833 - digitalWrite(5, LOW); // Reset AltSoftSerial Tx pin to LOW - digitalWrite(6, LOW); // Reset AltSoftSerial Rx pin to LOW - - // Call the processor sleep - dataLogger.systemSleep(); -} -/** End [complex_loop] */ From e684ee1c1e52cd9644c67f43f242c816be8a387e Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 28 Feb 2022 11:18:47 -0500 Subject: [PATCH 21/94] Add new sensors to tests Signed-off-by: Sara Damiano --- .github/workflows/build_menu.yaml | 3 + build-menu-configurations.ps1 | 2 + examples/menu_a_la_carte/menu_a_la_carte.ino | 59 +++++++++++++++++--- 3 files changed, 56 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 6d6ea6c9f..eab721d1e 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -103,6 +103,9 @@ jobs: - modemFlag: BUILD_MODEM_SIM7080 sensorFlag: BUILD_SENSOR_INSITURDO publisherFlag: BUILD_PUB_MMW + - modemFlag: BUILD_MODEM_SIM7080 + sensorFlag: BUILD_SENSOR_INSITUTROOLSDI12A + publisherFlag: BUILD_PUB_MMW - modemFlag: BUILD_MODEM_SIM7080 sensorFlag: BUILD_SENSOR_ACCULEVEL publisherFlag: BUILD_PUB_MMW diff --git a/build-menu-configurations.ps1 b/build-menu-configurations.ps1 index 5a4ee023b..eb7d8a7a7 100644 --- a/build-menu-configurations.ps1 +++ b/build-menu-configurations.ps1 @@ -87,6 +87,7 @@ $sensorFlags = @(` 'BUILD_SENSOR_VOLTAGE', ` 'BUILD_SENSOR_MPL115A2', ` 'BUILD_SENSOR_INSITURDO', ` + 'BUILD_SENSOR_INSITUTROOLSDI12A', ` 'BUILD_SENSOR_ACCULEVEL', ` 'BUILD_SENSOR_NANOLEVEL', ` 'BUILD_SENSOR_MAXBOTIX', ` @@ -109,6 +110,7 @@ $sensorFlags = @(` 'BUILD_SENSOR_Y532', ` 'BUILD_SENSOR_Y533', ` 'BUILD_SENSOR_Y551', ` + 'BUILD_SENSOR_Y560', ` 'BUILD_SENSOR_Y4000', ` 'BUILD_SENSOR_DOPTO') 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 6e283fbae..9b8bd4202 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -832,7 +832,7 @@ Variable* dhtHumid = Variable* dhtTemp = new AOSongDHT_Temp(&dht, "12345678-abcd-1234-ef00-1234567890ab"); Variable* dhtHI = new AOSongDHT_HI(&dht, - "12345678-abcd-1234-ef00-1234567890ab"); + "12345678-abcd-1234-ef00-1234567890ab"); /** End [dht] */ #endif @@ -1298,6 +1298,36 @@ Variable* rdoO2pp = #endif +#if defined BUILD_SENSOR_INSITUTROOLSDI12A +// ========================================================================== +// In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor +// ========================================================================== +/** Start [insitu_troll] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const char* TROLLSDI12address = + "1"; // The SDI-12 Address of the Aqua/Level Troll +const int8_t TROLLPower = + sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) +const int8_t TROLLData = 7; // The SDI-12 data pin +const uint8_t TROLLNumberReadings = 2; // The number of readings to average + +// Create an In-Situ Troll sensor object +InsituTrollSdi12a insutuTROLL(*TROLLSDI12address, TROLLPower, TROLLData, + TROLLNumberReadings); + +// Create pressure, temperature, and depth variable pointers for the TROLL +Variable* trollPressure = new InsituTrollSdi12a_Pressure( + &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* trollTemp = new InsituTrollSdi12a_Temp( + &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* trollDepth = new InsituTrollSdi12a_Depth( + &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [insitu_troll] */ +#endif + + #if defined BUILD_SENSOR_ACCULEVEL // ========================================================================== // Keller Acculevel High Accuracy Submersible Level Transmitter @@ -1648,7 +1678,7 @@ TIINA219 ina219(INA219Power, INA219i2c_addr, INA219ReadingsToAvg); Variable* inaCurrent = new TIINA219_Current(&ina219, "12345678-abcd-1234-ef00-1234567890ab"); Variable* inaVolt = new TIINA219_Volt(&ina219, - "12345678-abcd-1234-ef00-1234567890ab"); + "12345678-abcd-1234-ef00-1234567890ab"); Variable* inaPower = new TIINA219_Power(&ina219, "12345678-abcd-1234-ef00-1234567890ab"); /** End [ina219] */ @@ -2051,11 +2081,12 @@ Variable* y551Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y560ModbusAddress = 0x60; // The modbus address of the Y560. - // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC -const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y560SensorPower = A3; // Sensor power pin +byte y560ModbusAddress = + 0x60; // The modbus address of the Y560. + // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC +const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin + // (-1 if unconnected) +const int8_t y560SensorPower = A3; // Sensor power pin const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) const uint8_t y560NumberReadings = 3; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize @@ -2334,6 +2365,11 @@ Variable* variableList[] = { rdoDOmgL, rdoO2pp, #endif +#if defined BUILD_SENSOR_INSITUTROOLSDI12A + trollPressure, + trollTemp, + trollDepth, +#endif #if defined BUILD_SENSOR_ACCULEVEL acculevPress, acculevTemp, @@ -2439,6 +2475,12 @@ Variable* variableList[] = { y551Turbid, y551Temp, #endif + +#if defined BUILD_SENSOR_Y560 + y560NH4_N, + y560pH, + y560Temp, +#endif #if defined BUILD_SENSOR_Y4000 y4000DO, y4000Turb, @@ -2679,7 +2721,8 @@ void setup() { } /** End [setup_sesors] */ -#if (defined BUILD_MODEM_ESP8266 || defined BUILD_MODEM_ESP32) && F_CPU == 8000000L +#if (defined BUILD_MODEM_ESP8266 || defined BUILD_MODEM_ESP32) && \ + F_CPU == 8000000L /** Start [setup_esp] */ if (modemBaud > 57600) { modem.modemWake(); // NOTE: This will also set up the modem From f25803b8b8b2841418477266e69a45aea6e824a9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Feb 2022 17:06:53 +0000 Subject: [PATCH 22/94] ci: bump actions/setup-python from 2.3.2 to 3 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 2.3.2 to 3. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v2.3.2...v3) --- updated-dependencies: - dependency-name: actions/setup-python dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build_documentation.yaml | 2 +- .github/workflows/build_examples_platformio.yaml | 2 +- .github/workflows/build_menu.yaml | 2 +- .github/workflows/prepare_release.yaml | 2 +- .github/workflows/verify_library_json.yaml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index f8ef3aae3..fa002d219 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -23,7 +23,7 @@ jobs: path: code_docs/ModularSensors - name: Set up Python - uses: actions/setup-python@v2.3.2 + uses: actions/setup-python@v3 - name: Restore Python Dependencies uses: actions/cache@v2.1.7 diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml index a17dad186..fa8a625db 100644 --- a/.github/workflows/build_examples_platformio.yaml +++ b/.github/workflows/build_examples_platformio.yaml @@ -41,7 +41,7 @@ jobs: fi - name: Set up Python - uses: actions/setup-python@v2.3.2 + uses: actions/setup-python@v3 - name: Install PlatformIO run: | diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 0c29fc3d3..a8777da81 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -202,7 +202,7 @@ jobs: fi - name: Set up Python - uses: actions/setup-python@v2.3.2 + uses: actions/setup-python@v3 - name: Install PlatformIO run: | diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index 137c4c2d0..834ce45e8 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@v2.3.2 + uses: actions/setup-python@v3 - name: Install PlatformIO run: | diff --git a/.github/workflows/verify_library_json.yaml b/.github/workflows/verify_library_json.yaml index e1b56b784..a608b16e8 100644 --- a/.github/workflows/verify_library_json.yaml +++ b/.github/workflows/verify_library_json.yaml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v2.4.0 - name: Set up Python - uses: actions/setup-python@v2.3.2 + uses: actions/setup-python@v3 - name: Install PlatformIO run: | From da01f75f0697391ce6e2d67a977ef36799d624fa Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 28 Feb 2022 12:27:25 -0500 Subject: [PATCH 23/94] Attempt to clear confusion in local and UTC time Signed-off-by: Sara Damiano --- examples/data_saving/data_saving.ino | 6 +- examples/double_logger/double_logger.ino | 8 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 6 +- src/LoggerBase.cpp | 84 ++++++++++++-------- src/LoggerBase.h | 27 ++++++- src/publishers/DreamHostPublisher.cpp | 5 +- src/publishers/EnviroDIYPublisher.cpp | 5 +- src/publishers/ThingSpeakPublisher.cpp | 2 +- src/publishers/UbidotsPublisher.cpp | 4 +- 9 files changed, 94 insertions(+), 53 deletions(-) diff --git a/examples/data_saving/data_saving.ino b/examples/data_saving/data_saving.ino index 03518c69f..8e416a615 100644 --- a/examples/data_saving/data_saving.ino +++ b/examples/data_saving/data_saving.ino @@ -580,10 +580,10 @@ void loop() { modem.updateModemMetadata(); loggerAllVars.watchDogTimer.resetWatchDog(); - // Sync the clock at midnight + // Sync the clock at noon // NOTE: All loggers have the same clock, pick one - if (Logger::markedEpochTime != 0 && - Logger::markedEpochTime % 86400 == 0) { + if (Logger::markedLocalEpochTime != 0 && + Logger::markedLocalEpochTime % 86400 == 43200) { Serial.println(F("Running a daily clock sync...")); loggerAllVars.setRTClock(modem.getNISTTime()); } diff --git a/examples/double_logger/double_logger.ino b/examples/double_logger/double_logger.ino index 3ed70b035..14a143d09 100644 --- a/examples/double_logger/double_logger.ino +++ b/examples/double_logger/double_logger.ino @@ -258,7 +258,9 @@ void setup() { // Print out the current time Serial.print(F("Current RTC time is: ")); - Serial.println(Logger::formatDateTime_ISO8601(Logger::getNowEpoch())); + Serial.println(Logger::formatDateTime_ISO8601(Logger::getNowUTCEpoch())); + Serial.print(F("Current localized logger time is: ")); + Serial.println(Logger::formatDateTime_ISO8601(Logger::getNowLocalEpoch())); // Connect to the network if (modem.connectInternet()) { // Synchronize the RTC @@ -395,8 +397,8 @@ void loop() { // Print a line to show reading ended Serial.println(F("--------------------<555>---------------------\n")); } - // Once a day, at midnight, sync the clock - if (Logger::markedEpochTime % 86400 == 0) { + // Once a day, at noon, sync the clock + if (Logger::markedLocalEpochTime % 86400 == 43200) { // Turn on the modem modem.modemWake(); // Connect to the network 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 9b8bd4202..aa9c93584 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -2960,10 +2960,10 @@ void loop() { Serial.println(F("Modem connected to internet.")); dataLogger.publishDataToRemotes(); - // Sync the clock at midnight + // Sync the clock at noon dataLogger.watchDogTimer.resetWatchDog(); - if (Logger::markedEpochTime != 0 && - Logger::markedEpochTime % 86400 == 0) { + if (Logger::markedLocalEpochTime != 0 && + Logger::markedLocalEpochTime % 86400 == 43200) { Serial.println(F("Running a daily clock sync...")); dataLogger.setRTClock(modem.getNISTTime()); dataLogger.watchDogTimer.resetWatchDog(); diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 5f5c197d9..383418640 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -27,8 +27,8 @@ int8_t Logger::_loggerTimeZone = 0; // Initialize the static time adjustment int8_t Logger::_loggerRTCOffset = 0; // Initialize the static timestamps -uint32_t Logger::markedEpochTime = 0; -uint32_t Logger::markedEpochTimeUTC = 0; +uint32_t Logger::markedLocalEpochTime = 0; +uint32_t Logger::markedUTCEpochTime = 0; // Initialize the testing/logging flags volatile bool Logger::isLoggingNow = false; volatile bool Logger::isTestingNow = false; @@ -341,7 +341,7 @@ bool Logger::syncRTC() { // 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 - if (Logger::getNowEpochUTC() % (_loggingIntervalMinutes * 60) > 15) { + if (Logger::getNowLocalEpoch() % (_loggingIntervalMinutes * 60) > 15) { Serial.println(F("Putting modem to sleep")); _logModem->disconnectInternet(); _logModem->modemSleepPowerDown(); @@ -464,27 +464,32 @@ int8_t Logger::getTZOffset(void) { // This gets the current epoch time (unix time, ie, the number of seconds // from January 1, 1970 00:00:00 UTC) and corrects it to the specified time zone -#if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD uint32_t Logger::getNowEpoch(void) { - uint32_t currentEpochTime = rtc.now().getEpoch(); + // Depreciated in 0.33.0, left in for compatiblity + return getNowLocalEpoch(); +} +uint32_t Logger::getNowLocalEpoch(void) { + uint32_t currentEpochTime = getNowUTCEpoch(); // Do NOT apply an offset if the timestamp is obviously bad if (isRTCSane(currentEpochTime)) currentEpochTime += ((uint32_t)_loggerRTCOffset) * 3600; return currentEpochTime; } + +#if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD + +uint32_t Logger::getNowUTCEpoch(void) { + return rtc.now().getEpoch(); +} void Logger::setNowEpoch(uint32_t ts) { rtc.setEpoch(ts); } #elif defined ARDUINO_ARCH_SAMD -uint32_t Logger::getNowEpoch(void) { - uint32_t currentEpochTime = zero_sleep_rtc.getEpoch(); - // Do NOT apply an offset if the timestamp is obviously bad - if (isRTCSane(currentEpochTime)) - currentEpochTime += ((uint32_t)_loggerRTCOffset) * 3600; - return currentEpochTime; +uint32_t Logger::getNowUTCEpoch(void) { + return zero_sleep_rtc.getEpoch(); } void Logger::setNowEpoch(uint32_t ts) { zero_sleep_rtc.setEpoch(ts); @@ -550,18 +555,25 @@ bool Logger::setRTClock(uint32_t UTCEpochSeconds) { // We're interested in the setTime in the logger's and RTC's timezone // The RTC's timezone is equal to the logger's timezone minus the offset // between the logger and the RTC. + uint32_t set_rtcTZ = UTCEpochSeconds; + // NOTE: We're only looking at local time here in order to print it out for + // the user uint32_t set_logTZ = UTCEpochSeconds + ((uint32_t)getLoggerTimeZone()) * 3600; - uint32_t set_rtcTZ = set_logTZ - ((uint32_t)getTZOffset()) * 3600; MS_DBG(F(" Time for Logger supplied by NIST:"), set_logTZ, F("->"), formatDateTime_ISO8601(set_logTZ)); // Check the current RTC time - uint32_t cur_logTZ = getNowEpoch(); + uint32_t cur_logTZ = getNowLocalEpoch(); MS_DBG(F(" Current Time on RTC:"), cur_logTZ, F("->"), formatDateTime_ISO8601(cur_logTZ)); MS_DBG(F(" Offset between NIST and RTC:"), abs(set_logTZ - cur_logTZ)); + // NOTE: Because we take the time to do some UTC/Local conversions and + // print stuff out, the clock might end up being set up to a few + // milliseconds behind the input time. Given the clock is only accurate to + // seconds (not milliseconds or less), I don't think this is a problem. + // If the RTC and NIST disagree by more than 5 seconds, set the clock if (abs(set_logTZ - cur_logTZ) > 5) { setNowEpoch(set_rtcTZ); @@ -575,7 +587,7 @@ bool Logger::setRTClock(uint32_t UTCEpochSeconds) { // This checks that the logger time is within a "sane" range bool Logger::isRTCSane(void) { - uint32_t curRTC = getNowEpoch(); + uint32_t curRTC = getNowLocalEpoch(); return isRTCSane(curRTC); } bool Logger::isRTCSane(uint32_t epochTime) { @@ -596,8 +608,8 @@ bool Logger::isRTCSane(uint32_t epochTime) { // sensor was updated, just a single marked time. By custom, this should be // called before updating the sensors, not after. void Logger::markTime(void) { - Logger::markedEpochTime = getNowEpoch(); - Logger::markedEpochTimeUTC = markedEpochTime - + Logger::markedUTCEpochTime = getNowUTCEpoch(); + Logger::markedLocalEpochTime = markedUTCEpochTime + ((uint32_t)_loggerRTCOffset) * 3600; } @@ -606,7 +618,7 @@ void Logger::markTime(void) { // rate bool Logger::checkInterval(void) { bool retval; - uint32_t checkTime = getNowEpoch(); + uint32_t checkTime = getNowLocalEpoch(); MS_DBG(F("Current Unix Timestamp:"), checkTime, F("->"), formatDateTime_ISO8601(checkTime)); MS_DBG(F("Logging interval in seconds:"), (_loggingIntervalMinutes * 60)); @@ -616,7 +628,7 @@ bool Logger::checkInterval(void) { if (checkTime % (_loggingIntervalMinutes * 60) == 0) { // Update the time variables with the current time markTime(); - MS_DBG(F("Time marked at (unix):"), Logger::markedEpochTime); + MS_DBG(F("Time marked at (unix):"), Logger::markedLocalEpochTime); MS_DBG(F("Time to log!")); retval = true; } else { @@ -677,13 +689,13 @@ bool Logger::checkInterval(void) { // This checks to see if the MARKED time is an even interval of the logging rate bool Logger::checkMarkedInterval(void) { bool retval; - MS_DBG(F("Marked Time:"), Logger::markedEpochTime, + MS_DBG(F("Marked Time:"), Logger::markedLocalEpochTime, F("Logging interval in seconds:"), (_loggingIntervalMinutes * 60), F("Mod of Logging Interval:"), - Logger::markedEpochTime % (_loggingIntervalMinutes * 60)); + Logger::markedLocalEpochTime % (_loggingIntervalMinutes * 60)); - if (Logger::markedEpochTime != 0 && - (Logger::markedEpochTime % (_loggingIntervalMinutes * 60) == 0)) { + if (Logger::markedLocalEpochTime != 0 && + (Logger::markedLocalEpochTime % (_loggingIntervalMinutes * 60) == 0)) { MS_DBG(F("Time to log!")); retval = true; } else { @@ -960,7 +972,7 @@ void Logger::generateAutoFileName(void) { // Generate the file name from logger ID and date String fileName = String(_loggerID); fileName += "_"; - fileName += formatDateTime_ISO8601(getNowEpoch()).substring(0, 10); + fileName += formatDateTime_ISO8601(getNowLocalEpoch()).substring(0, 10); fileName += ".csv"; setFileName(fileName); _fileName = fileName; @@ -1029,7 +1041,7 @@ void Logger::printFileHeader(Stream* stream) { // time - out over an Arduino stream void Logger::printSensorDataCSV(Stream* stream) { String csvString = ""; - dtFromEpoch(Logger::markedEpochTime).addToString(csvString); + dtFromEpoch(Logger::markedLocalEpochTime).addToString(csvString); csvString += ','; stream->print(csvString); for (uint8_t i = 0; i < getArrayVarCount(); i++) { @@ -1064,11 +1076,12 @@ 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(getNowEpoch()).year(), - dtFromEpoch(getNowEpoch()).month(), dtFromEpoch(getNowEpoch()).date(), - dtFromEpoch(getNowEpoch()).hour(), dtFromEpoch(getNowEpoch()).minute(), - dtFromEpoch(getNowEpoch()).second()); + fileToStamp.timestamp(stampFlag, dtFromEpoch(getNowLocalEpoch()).year(), + dtFromEpoch(getNowLocalEpoch()).month(), + dtFromEpoch(getNowLocalEpoch()).date(), + dtFromEpoch(getNowLocalEpoch()).hour(), + dtFromEpoch(getNowLocalEpoch()).minute(), + dtFromEpoch(getNowLocalEpoch()).second()); } @@ -1324,7 +1337,7 @@ void Logger::testingMode() { _internalArray->updateAllSensors(); // Print out the current logger time PRINTOUT(F("Current logger time is"), - formatDateTime_ISO8601(getNowEpoch())); + formatDateTime_ISO8601(getNowLocalEpoch())); PRINTOUT(F("-----------------------")); // Print out the sensor data #if defined(STANDARD_SERIAL_OUTPUT) @@ -1451,7 +1464,10 @@ void Logger::begin() { watchDogTimer.resetWatchDog(); // Print out the current time - PRINTOUT(F("Current RTC time is:"), formatDateTime_ISO8601(getNowEpoch())); + PRINTOUT(F("Current RTC time is:"), + formatDateTime_ISO8601(getNowUTCEpoch())); + PRINTOUT(F("Current localized logger time is:"), + formatDateTime_ISO8601(getNowLocalEpoch())); // Reset the watchdog watchDogTimer.resetWatchDog(); @@ -1568,9 +1584,9 @@ void Logger::logDataAndPublish(void) { publishDataToRemotes(); watchDogTimer.resetWatchDog(); - if ((Logger::markedEpochTime != 0 && - Logger::markedEpochTime % 86400 == 43200) || - !isRTCSane(Logger::markedEpochTime)) { + if ((Logger::markedLocalEpochTime != 0 && + Logger::markedLocalEpochTime % 86400 == 43200) || + !isRTCSane(Logger::markedLocalEpochTime)) { // Sync the clock at noon MS_DBG(F("Running a daily clock sync...")); setRTClock(_logModem->getNISTTime()); diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 868398122..7980368e8 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -619,8 +619,29 @@ class Logger { * * @return **uint32_t** The number of seconds from January 1, 1970 in the * logging time zone. + * + * @m_deprecated_since{0,33} */ static uint32_t getNowEpoch(void); + + /** + * @brief Get the current epoch time from the RTC (unix time, ie, the + * number of seconds from January 1, 1970 00:00:00) and correct it to the + * logging time zone. + * + * @return **uint32_t** The number of seconds from January 1, 1970 in the + * logging time zone. + */ + static uint32_t getNowLocalEpoch(void); + + /** + * @brief Get the current Universal Coordinated Time (UTC) epoch time from + * the RTC (unix time, ie, the number of seconds from January 1, 1970 + * 00:00:00 UTC) + * + * @return **uint32_t** The number of seconds from 1970-01-01T00:00:00Z0000 + */ + static uint32_t getNowUTCEpoch(void); /** * @brief Set the real time clock to the given number of seconds from * January 1, 1970. @@ -716,7 +737,7 @@ class Logger { /** * @brief Check if the MARKED time is an even interval of the logging rate - - * That is the value saved in the static variable markedEpochTime. + * That is the value saved in the static variable markedLocalEpochTime. * * This should be used in conjunction with markTime() to ensure that all * data outputs from a single data update session (SD, EnviroDIY, serial @@ -1074,12 +1095,12 @@ class Logger { /** * @brief The static "marked" epoch time for the local timezone. */ - static uint32_t markedEpochTime; + static uint32_t markedLocalEpochTime; /** * @brief The static "marked" epoch time for UTC. */ - static uint32_t markedEpochTimeUTC; + static uint32_t markedUTCEpochTime; // These are flag fariables noting the current state (logging/testing) // NOTE: if the logger isn't currently logging or testing or in the middle diff --git a/src/publishers/DreamHostPublisher.cpp b/src/publishers/DreamHostPublisher.cpp index f4996cb18..4a7945cf1 100644 --- a/src/publishers/DreamHostPublisher.cpp +++ b/src/publishers/DreamHostPublisher.cpp @@ -66,7 +66,7 @@ void DreamHostPublisher::printSensorDataDreamHost(Stream* stream) { stream->print(loggerTag); stream->print(_baseLogger->getLoggerID()); stream->print(timestampTagDH); - stream->print(String(Logger::markedEpochTime - + stream->print(String(Logger::markedLocalEpochTime - 946684800)); // Correct time from epoch to y2k for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { @@ -133,7 +133,8 @@ int16_t DreamHostPublisher::publishData(Client* outClient) { if (bufferFree() < 22) printTxBuffer(outClient); strcat(txBuffer, timestampTagDH); - ltoa((Logger::markedEpochTime - 946684800), tempBuffer, 10); // BASE 10 + ltoa((Logger::markedLocalEpochTime - 946684800), tempBuffer, + 10); // BASE 10 strcat(txBuffer, tempBuffer); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index b0b955396..94d22cb1b 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -122,7 +122,8 @@ void EnviroDIYPublisher::printSensorDataJSON(Stream* stream) { stream->print(samplingFeatureTag); stream->print(_baseLogger->getSamplingFeatureUUID()); stream->print(timestampTag); - stream->print(_baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime)); + stream->print( + _baseLogger->formatDateTime_ISO8601(Logger::markedLocalEpochTime)); stream->print(F("\",")); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { @@ -233,7 +234,7 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { if (bufferFree() < 42) printTxBuffer(outClient); strcat(txBuffer, timestampTag); - _baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime) + _baseLogger->formatDateTime_ISO8601(Logger::markedLocalEpochTime) .toCharArray(tempBuffer, 37); strcat(txBuffer, tempBuffer); txBuffer[strlen(txBuffer)] = '"'; diff --git a/src/publishers/ThingSpeakPublisher.cpp b/src/publishers/ThingSpeakPublisher.cpp index 1c0bac04b..d1503c6b2 100644 --- a/src/publishers/ThingSpeakPublisher.cpp +++ b/src/publishers/ThingSpeakPublisher.cpp @@ -146,7 +146,7 @@ int16_t ThingSpeakPublisher::publishData(Client* outClient) { emptyTxBuffer(); - _baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime) + _baseLogger->formatDateTime_ISO8601(Logger::markedLocalEpochTime) .toCharArray(tempBuffer, 26); strcat(txBuffer, "created_at="); strcat(txBuffer, tempBuffer); diff --git a/src/publishers/UbidotsPublisher.cpp b/src/publishers/UbidotsPublisher.cpp index 1aa01bfc6..9143dd06e 100644 --- a/src/publishers/UbidotsPublisher.cpp +++ b/src/publishers/UbidotsPublisher.cpp @@ -111,7 +111,7 @@ void UbidotsPublisher::printSensorDataJSON(Stream* stream) { stream->print(F("\":{'value':")); stream->print(_baseLogger->getValueStringAtI(i)); stream->print(",'timestamp':"); - stream->print(Logger::markedEpochTimeUTC); + stream->print(Logger::markedUTCEpochTime); stream->print( F("000}")); // Convert microseconds to milliseconds for ubidots if (i + 1 != _baseLogger->getArrayVarCount()) { stream->print(','); } @@ -229,7 +229,7 @@ int16_t UbidotsPublisher::publishData(Client* outClient) { strcat(txBuffer, "timestamp"); txBuffer[strlen(txBuffer)] = '"'; txBuffer[strlen(txBuffer)] = ':'; - ltoa((Logger::markedEpochTimeUTC), tempBuffer, 10); // BASE 10 + ltoa((Logger::markedUTCEpochTime), tempBuffer, 10); // BASE 10 strcat(txBuffer, tempBuffer); strcat(txBuffer, "000"); if (i + 1 != _baseLogger->getArrayVarCount()) { From 4f963fa9018d2a2ab2b75c4c60768420a72e4411 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 28 Feb 2022 12:31:36 -0500 Subject: [PATCH 24/94] Rename setNowEpoch to setNowUTCEpoch Signed-off-by: Sara Damiano --- src/LoggerBase.cpp | 6 +++--- src/LoggerBase.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 383418640..17dc66135 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -482,7 +482,7 @@ uint32_t Logger::getNowLocalEpoch(void) { uint32_t Logger::getNowUTCEpoch(void) { return rtc.now().getEpoch(); } -void Logger::setNowEpoch(uint32_t ts) { +void Logger::setNowUTCEpoch(uint32_t ts) { rtc.setEpoch(ts); } @@ -491,7 +491,7 @@ void Logger::setNowEpoch(uint32_t ts) { uint32_t Logger::getNowUTCEpoch(void) { return zero_sleep_rtc.getEpoch(); } -void Logger::setNowEpoch(uint32_t ts) { +void Logger::setNowUTCEpoch(uint32_t ts) { zero_sleep_rtc.setEpoch(ts); } @@ -576,7 +576,7 @@ bool Logger::setRTClock(uint32_t UTCEpochSeconds) { // If the RTC and NIST disagree by more than 5 seconds, set the clock if (abs(set_logTZ - cur_logTZ) > 5) { - setNowEpoch(set_rtcTZ); + setNowUTCEpoch(set_rtcTZ); PRINTOUT(F("Clock set!")); return true; } else { diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 7980368e8..f1cc33720 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -652,7 +652,7 @@ class Logger { * * @param ts The number of seconds since 1970. */ - static void setNowEpoch(uint32_t ts); + static void setNowUTCEpoch(uint32_t ts); /** * @brief Convert the number of seconds from January 1, 1970 to a DateTime From bd9db7743e0e6892e586590499cf7a5d7210b746 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 28 Feb 2022 12:42:49 -0500 Subject: [PATCH 25/94] Change In-Situ and TROLL caps/punctuation Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/menu_a_la_carte.ino | 4 +- src/sensors/InSituRDO.h | 2 +- src/sensors/InsituTrollSdi12a.h | 60 ++++++++++---------- 3 files changed, 33 insertions(+), 33 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 aa9c93584..a9b4d0f67 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1307,13 +1307,13 @@ Variable* rdoO2pp = // NOTE: Use -1 for any pins that don't apply or aren't being used. const char* TROLLSDI12address = - "1"; // The SDI-12 Address of the Aqua/Level Troll + "1"; // The SDI-12 Address of the Aqua/Level TROLL const int8_t TROLLPower = sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) const int8_t TROLLData = 7; // The SDI-12 data pin const uint8_t TROLLNumberReadings = 2; // The number of readings to average -// Create an In-Situ Troll sensor object +// Create an In-Situ TROLL sensor object InsituTrollSdi12a insutuTROLL(*TROLLSDI12address, TROLLPower, TROLLData, TROLLNumberReadings); diff --git a/src/sensors/InSituRDO.h b/src/sensors/InSituRDO.h index 0648c6faa..8bc41b767 100644 --- a/src/sensors/InSituRDO.h +++ b/src/sensors/InSituRDO.h @@ -58,7 +58,7 @@ * Win-Situ to change some of the default settings on the sensor. * * To connect the sensor to Win-Situ, you can use any form of RS485 to USB interface. - * Insitu sells one that specifially works with their cables, but any + * In-Situ sells one that specifially works with their cables, but any * inexpensive converter adapter with automatic flow control should work. * The sensor must be powered at a minimum of **12V** (12-36V) to use the * RS485/modbus interface. This is different than the 9.6V - 16V required for diff --git a/src/sensors/InsituTrollSdi12a.h b/src/sensors/InsituTrollSdi12a.h index 9b4b0ffbf..54866ed5a 100644 --- a/src/sensors/InsituTrollSdi12a.h +++ b/src/sensors/InsituTrollSdi12a.h @@ -9,7 +9,7 @@ * along with the variable subclasses InsituTrollSdi12a_Pressure, * InsituTrollSdi12a_Temp, and InsituTrollSdi12a_Depth * - * These are used for the Insitu Troll. + * These are used for the In-Situ Level TROLL® 400, 500 & 700 Data Loggers. * The order and units are the default settings for the ITROLL * * This depends on the EnviroDIY SDI-12 library and the SDI12Sensors super @@ -18,9 +18,9 @@ */ /* clang-format off */ /** - * @defgroup sensor_instutroll Insitu LevelTroll 400 500 700 - * Classes for the Insitru LevelTroll feature sensors pressure, temperature, and depth. - * + * @defgroup sensor_instutroll In-Situ LevelTROLL 400, 500, and 700 Data Loggers + * Classes for the In-Situ LevelTROLL feature sensors pressure, temperature, and depth. + * * @ingroup sdi12_group * * @tableofcontents @@ -28,36 +28,36 @@ * * @section sensor_instutroll_intro Introduction * - * > A slim 1.8 cm diameter sensor, - * > depth measuremente temperature compensated to 0.1% (0.05%) across Full Scale depth range and across temperature range. + * > A slim 1.8 cm diameter sensor, + * > depth measuremente temperature compensated to 0.1% (0.05%) across Full Scale depth range and across temperature range. * > * > Has an internal logger for reliable data collection. * > * > Reports sensor serial number and model in uSD .csv file * - * The Insitu Aqua/Level Troll require 8-36VDC + * The In-Situ Aqua/Level TROLL require 8-36VDC * This can be achieved a Polo #boost device, instructions are at the end * - * @warning Coming from the factory, Troll sensors are set at SDI-12 address '0'. + * @warning Coming from the factory, TROLL sensors are set at SDI-12 address '0'. + * + * The In-Situ Aqua/Level TROLLs are programmed through WinSitu. * - * The Insitu Aqua/Level Trolls are programmed through WinSitu. - * * The SDI address needs to be changed to what the class is set to - default is '1'. * * Parameters are very flexible and need to be aligned used WinSitu with this module. - * + * * The depth sensor third paramter may need to be created. The expected - * paramters and order are Pressure (PSI), Temperature (C), Depth (ft). + * paramters and order are Pressure (PSI), Temperature (C), Depth (ft). + * + * Tested with Level TROLL 500. * - * Tested with Level Troll 500. - * * @section sensor_instutroll_datasheet Sensor Datasheet * Documentation for the SDI-12 Protocol commands and responses - * The Insitu Level/Aqua Troll can be found at: - * + * The In-Situ Level/Aqua TROLL can be found at: + * * https://in-situ.com/en/pub/media/support/documents/SDI-12_Commands_Tech_Note.pdf - * + * * https://in-situ.com/us/support/documents/sdi-12-commands-and-level-troll-400500700-responses * * @section sensor_instutroll_flags Build flags @@ -77,20 +77,20 @@ // Sensor Specific Defines /** @ingroup sensor_insitutroll */ /**@{*/ -/// @brief Sensor::_numReturnedValues; the Troll 500 can report 3 values. +/// @brief Sensor::_numReturnedValues; the TROLL 500 can report 3 values. #define ITROLLA_NUM_VARIABLES 3 /** * @anchor sensor_insitutroll_timing * @name Sensor Timing - * The sensor timing for a Insitu Troll + * The sensor timing for a In-Situ TROLL */ /**@{*/ /// @brief Sensor::_warmUpTime_ms; maximum warm-up time in SDI-12 mode: 500ms #define ITROLLA_WARM_UP_TIME_MS 500 -/// @brief Sensor::_stabilizationTime_ms; the Troll 500 is stable as soon as it +/// @brief Sensor::_stabilizationTime_ms; the TROLL 500 is stable as soon as it /// warms up (0ms stabilization). #define ITROLLA_STABILIZATION_TIME_MS 0 @@ -100,7 +100,7 @@ /** * @anchor sensor_insitutroll_pressure * @name Pressure - * The pressue variable from a Insitu Troll + * The pressue variable from a In-Situ TROLL * - Range is 0 – x (depends on range eg 5psig) * @@ -131,7 +131,7 @@ /** * @anchor sensor_insitutroll_temp * @name Temperature - * The temperature variable from a Insitu Troll + * The temperature variable from a In-Situ TROLL * - Range is -11°C to +49°C * - Accuracy is ±1°C * @@ -156,13 +156,13 @@ /// "degreeCelsius" (°C) #define ITROLLA_TEMP_TEMP_UNIT_NAME "degreeCelsius" /// @brief Default variable short code; "ITROLLtemp" -#define ITROL_TEMP_DEFAULT_CODE "ITROLLtemp" +#define ITROLLA_TEMP_DEFAULT_CODE "ITROLLtemp" /**@}*/ /** * @anchor sensor_insitutroll_depth * @name Water Depth - * The water depth variable from a Insitu Troll + * The water depth variable from a In-Situ TROLL * - Range is 0 to 3.5m to 350m depending on model * - Accuracy is ±0.05% of full scale * @@ -194,7 +194,7 @@ /* clang-format off */ /** * @brief The Sensor sub-class for the - * [Insitu Level/Aqua Troll pressure, temperature, and depth sensor](@ref sensor_insitutroll) + * [Insitu Level/Aqua TROLL pressure, temperature, and depth sensor](@ref sensor_insitutroll) * * @ingroup sensor_insitutroll */ @@ -256,7 +256,7 @@ class InsituTrollSdi12a : public SDI12Sensors { /** * @brief The Variable sub-class used for the * [pressure output](@ref sensor_insitutroll_pressure) from a - * [Insitu Troll 3-in-1 water level sensor.](@ref sensor_insitutroll) + * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitutroll) * * @ingroup sensor_insitutroll */ @@ -301,7 +301,7 @@ class InsituTrollSdi12a_Pressure : public Variable { /** * @brief The Variable sub-class used for the * [temperature Output](@ref sensor_insitutroll_temp) from a - * [Insitu Troll 3-in-1 water level sensor.](@ref sensor_insitutroll) + * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitutroll) * * @ingroup sensor_insitutroll */ @@ -318,7 +318,7 @@ class InsituTrollSdi12a_Temp : public Variable { * optional with a default value of "ITROLLtemp". */ InsituTrollSdi12a_Temp(Sensor* parentSense, const char* uuid = "", - const char* varCode = ITROL_TEMP_DEFAULT_CODE) + const char* varCode = ITROLLA_TEMP_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)ITROLLA_TEMP_VAR_NUM, (uint8_t)ITROLLA_TEMP_RESOLUTION, ITROLLA_TEMP_TEMP_VAR_NAME, ITROLLA_TEMP_TEMP_UNIT_NAME, varCode, uuid) {} @@ -332,7 +332,7 @@ class InsituTrollSdi12a_Temp : public Variable { InsituTrollSdi12a_Temp() : Variable((const uint8_t)ITROLLA_TEMP_VAR_NUM, (uint8_t)ITROLLA_TEMP_RESOLUTION, ITROLLA_TEMP_TEMP_VAR_NAME, - ITROLLA_TEMP_TEMP_UNIT_NAME, ITROL_TEMP_DEFAULT_CODE) {} + ITROLLA_TEMP_TEMP_UNIT_NAME, ITROLLA_TEMP_DEFAULT_CODE) {} /** * @brief Destroy the InsituTrollSdi12a_Temp object - no action needed. */ @@ -344,7 +344,7 @@ class InsituTrollSdi12a_Temp : public Variable { /** * @brief The Variable sub-class used for the * [depth output](@ref sensor_insitutroll_depth) from a - * [Insitu Troll 3-in-1 water level sensor.](@ref sensor_insitutroll) + * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitutroll) * * @ingroup sensor_insitutroll */ From ea5bdf7ca7069b0f3f71e420cad8d06cf1749b3f Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 28 Feb 2022 12:43:01 -0500 Subject: [PATCH 26/94] Update changelog and readme Signed-off-by: Sara Damiano --- ChangeLog.md | 15 ++++++++++++--- README.md | 6 ++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 285bd9732..6743fdcea 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -23,14 +23,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.33.0] ### Changed -- Renamed the YosemiTech Y550 COD sensor as Y551. See below. +- **Breaking:** Renamed the static `markedEpochTime` variable to `markedLocalEpochTime`. + - This was sometimes used in "complex" loops. Code utilizing it will have to be changed. + - This is part of the effort to clarify where localized and UTC time are being used. +We recommend a logger's real time clock always be set in UTC and then localized for printing and storing data. +- **Breaking:** Renamed the function `setNowEpoch(uint32_t)` to `setNowUTCEpoch(uint32_t)`. + - Although public, this was never intended to be used externally. +- **Breaking:** Renamed the YosemiTech Y550 COD sensor as Y551. See below. - Added a longer warm up time and removed some of the set-up to work with the ESP-IDF AT firmware versions >2.0 +- Made sure that all example clock synchronization happens at noon instead of midnight. ### Added -- Added support for the [YosemiTech Y551 COD Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/94.html), which makes a UV254 light absorption and translates it to estimates of Chemical Oxygen Demand (COD) (or Total Organic Carbon (TOC)) and Turbidity. +- **Sensor** Added support for the [YosemiTech Y551 COD Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/94.html), which makes a UV254 light absorption and translates it to estimates of Chemical Oxygen Demand (COD) (or Total Organic Carbon (TOC)) and Turbidity. - NOTE that this upgrade removes the earlier Y550 from the library, as it was never tested and is no longer available form YosemiTech. If anyone has a Y550 sensor, the Y551 commands should work. Let us know if they don't. -- Added support for the [YosemiTech Y560 Ammonium Probe](http://en.yosemitech.com/aspcms/product/2020-4-23/61.html), which is a mini sonde for three Ion Selective Electrode (ISE) sensors (pH, NH4+, K+) that together are used to provide a corrected estimate of total ammonium nitrogen (NH4_N) in mg/L. +- **Sensor** Added support for the [YosemiTech Y560 Ammonium Probe](http://en.yosemitech.com/aspcms/product/2020-4-23/61.html), which is a mini sonde for three Ion Selective Electrode (ISE) sensors (pH, NH4+, K+) that together are used to provide a corrected estimate of total ammonium nitrogen (NH4_N) in mg/L. - NOTE that this release only includes outputs for NH4_N, pH, and temperature. A future release will also include estimates of potassium (K) and raw potential values from each of the electrodes. +- **Sensor** Added support for the SDI-12 In-Situ [Level TROLL 400, 500 & 700 Data Loggers](https://in-situ.com/pub/media/support/documents/LevelTROLL_SS.pdf) + ### Removed ### Fixed diff --git a/README.md b/README.md index 830b6b298..86ae16f5a 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,8 @@ For some generalized information about attaching sensors to an Arduino style boa - [Decagon Devices CTD-10: conductivity, temperature & depth ](https://envirodiy.github.io/ModularSensors/group__sensor__es2.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) -- [Insitu RDO PRO-X: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__insitu__rdo.html.html) +- [In-Situ RDO PRO-X: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__insitu__rdo.html.html) +- [In-Situ SDI-12 TROLLs: pressure, temperature, and depth](https://envirodiy.github.io/ModularSensors/group__sensor__instutroll.html.html) - [Keller Submersible Level Transmitters: pressure and temperature](https://envirodiy.github.io/ModularSensors/group__keller__group.html) - [Acculevel](https://envirodiy.github.io/ModularSensors/group__sensor__acculevel.html) - [Nanolevel](https://envirodiy.github.io/ModularSensors/group__sensor__nanolevel.html) @@ -85,7 +86,8 @@ For some generalized information about attaching sensors to an Arduino style boa - [Y520-A: Conductivity and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y520.html) - [Y532-A: Digital pH and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y532.html) - [Y533: ORP, and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y533.html) - - [Y551-B: UV254/COD, Turbidity, and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y551.html) + - [Y551: UV254/COD, Turbidity, and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y551.html) + - [Y560: Ammonium, Temperature, and pH](https://envirodiy.github.io/ModularSensors/group__sensor__y560.html) - [Y4000 Multiparameter Sonde](https://envirodiy.github.io/ModularSensors/group__sensor__y4000.html) - [Zebra-Tech D-Opto: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__dopto.html) From 34e91b5b2307160a3a3ad05c9b00d16fc59aae65 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 28 Feb 2022 12:52:39 -0500 Subject: [PATCH 27/94] Exclude MonitorMW copy/paste sections from clang format Signed-off-by: Sara Damiano --- examples/DRWI_2G/DRWI_2G.ino | 29 ++++++++------------ examples/DRWI_2G/ReadMe.md | 20 ++++++++------ examples/DRWI_DigiLTE/ReadMe.md | 20 ++++++++------ examples/DRWI_NoCellular/DRWI_NoCellular.ino | 23 ++++++---------- examples/DRWI_NoCellular/ReadMe.md | 16 ++++++----- 5 files changed, 51 insertions(+), 57 deletions(-) diff --git a/examples/DRWI_2G/DRWI_2G.ino b/examples/DRWI_2G/DRWI_2G.ino index ca0fbdf30..56b4c4342 100644 --- a/examples/DRWI_2G/DRWI_2G.ino +++ b/examples/DRWI_2G/DRWI_2G.ino @@ -199,28 +199,21 @@ Variable* variableList[] = { // Be VERY certain that they match the order of your UUID's! // Rearrange the variables in the variable list if necessary to match! // *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** +/* clang-format off */ const char* UUIDs[] = { - "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity - // (Decagon_CTD-10_Cond) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature - // (Decagon_CTD-10_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Water depth - // (Decagon_CTD-10_Depth) + "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage - // (EnviroDIY_Mayfly_Batt) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature - // (EnviroDIY_Mayfly_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Received signal strength - // indication (Sodaq_2GBee_RSSI) - "12345678-abcd-1234-ef00-1234567890ab" // Percent full scale - // (Sodaq_2GBee_SignalPercent) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (EnviroDIY_Mayfly_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Received signal strength indication (Sodaq_2GBee_RSSI) + "12345678-abcd-1234-ef00-1234567890ab" // Percent full scale (Sodaq_2GBee_SignalPercent) }; -const char* registrationToken = - "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token -const char* samplingFeature = - "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token +const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +/* clang-format on */ // Count up the number of pointers in the array int variableCount = sizeof(variableList) / sizeof(variableList[0]); diff --git a/examples/DRWI_2G/ReadMe.md b/examples/DRWI_2G/ReadMe.md index 7c29e5147..013d26817 100644 --- a/examples/DRWI_2G/ReadMe.md +++ b/examples/DRWI_2G/ReadMe.md @@ -106,19 +106,21 @@ Variable* variableList[] = { // Be VERY certain that they match the order of your UUID's! // Rearrange the variables in the variable list if necessary to match! // *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** +/* clang-format off */ const char* UUIDs[] = { - "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (EnviroDIY_Mayfly_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Received signal strength indication (Sodaq_2GBee_RSSI) - "12345678-abcd-1234-ef00-1234567890ab" // Percent full scale (Sodaq_2GBee_SignalPercent) + "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (EnviroDIY_Mayfly_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Received signal strength indication (Sodaq_2GBee_RSSI) + "12345678-abcd-1234-ef00-1234567890ab" // Percent full scale (Sodaq_2GBee_SignalPercent) }; const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +/* clang-format on */ ``` diff --git a/examples/DRWI_DigiLTE/ReadMe.md b/examples/DRWI_DigiLTE/ReadMe.md index 4009f6c9d..139aadfa0 100644 --- a/examples/DRWI_DigiLTE/ReadMe.md +++ b/examples/DRWI_DigiLTE/ReadMe.md @@ -106,19 +106,21 @@ Variable* variableList[] = { // Be VERY certain that they match the order of your UUID's! // Rearrange the variables in the variable list if necessary to match! // *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** +/* clang-format off */ const char* UUIDs[] = { - "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (EnviroDIY_Mayfly_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Received signal strength indication (Digi_Cellular_RSSI) - "12345678-abcd-1234-ef00-1234567890ab" // Percent full scale (Digi_Cellular_SignalPercent) + "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (EnviroDIY_Mayfly_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Received signal strength indication (Digi_Cellular_RSSI) + "12345678-abcd-1234-ef00-1234567890ab" // Percent full scale (Digi_Cellular_SignalPercent) }; const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +/* clang-format on */ ``` diff --git a/examples/DRWI_NoCellular/DRWI_NoCellular.ino b/examples/DRWI_NoCellular/DRWI_NoCellular.ino index e9e468372..ae715354c 100644 --- a/examples/DRWI_NoCellular/DRWI_NoCellular.ino +++ b/examples/DRWI_NoCellular/DRWI_NoCellular.ino @@ -158,24 +158,19 @@ Variable* variableList[] = { // Be VERY certain that they match the order of your UUID's! // Rearrange the variables in the variable list if necessary to match! // *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** +/* clang-format off */ const char* UUIDs[] = { - "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity - // (Decagon_CTD-10_Cond) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature - // (Decagon_CTD-10_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Water depth - // (Decagon_CTD-10_Depth) + "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage - // (EnviroDIY_Mayfly_Batt) - "12345678-abcd-1234-ef00-1234567890ab" // Temperature - // (EnviroDIY_Mayfly_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab" // Temperature (EnviroDIY_Mayfly_Temp) }; -const char* registrationToken = - "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token -const char* samplingFeature = - "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token +const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +/* clang-format on */ // Count up the number of pointers in the array int variableCount = sizeof(variableList) / sizeof(variableList[0]); diff --git a/examples/DRWI_NoCellular/ReadMe.md b/examples/DRWI_NoCellular/ReadMe.md index 17b70ef73..fa400c5b8 100644 --- a/examples/DRWI_NoCellular/ReadMe.md +++ b/examples/DRWI_NoCellular/ReadMe.md @@ -108,17 +108,19 @@ Variable* variableList[] = { // Be VERY certain that they match the order of your UUID's! // Rearrange the variables in the variable list if necessary to match! // *** CAUTION --- CAUTION --- CAUTION --- CAUTION --- CAUTION *** +/* clang-format off */ const char* UUIDs[] = { - "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) - "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature (EnviroDIY_Mayfly_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Electrical conductivity (Decagon_CTD-10_Cond) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Decagon_CTD-10_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Water depth (Decagon_CTD-10_Depth) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) + "12345678-abcd-1234-ef00-1234567890ab", // Turbidity (Campbell_OBS3_Turb) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (EnviroDIY_Mayfly_Temp) }; const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +/* clang-format on */ ``` From 37c97f258af4ced869f75ede5d658475422bce81 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 1 Mar 2022 13:04:12 -0500 Subject: [PATCH 28/94] Version bump of some dependencies Signed-off-by: Sara Damiano --- ...son.yaml => verify_library_structure.yaml} | 14 ++- continuous_integration/dependencies.json | 10 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 99 ++++++++++--------- library.json | 8 +- 4 files changed, 71 insertions(+), 60 deletions(-) rename .github/workflows/{verify_library_json.yaml => verify_library_structure.yaml} (56%) diff --git a/.github/workflows/verify_library_json.yaml b/.github/workflows/verify_library_structure.yaml similarity index 56% rename from .github/workflows/verify_library_json.yaml rename to .github/workflows/verify_library_structure.yaml index a608b16e8..2b0b6cbf2 100644 --- a/.github/workflows/verify_library_json.yaml +++ b/.github/workflows/verify_library_structure.yaml @@ -4,7 +4,7 @@ name: Verify JSON structure for library manifest on: [push, pull_request] jobs: - build: + lint: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" @@ -19,5 +19,15 @@ jobs: python -m pip install --upgrade pip pip install --upgrade platformio - - name: Run python script to verify library structure + - name: Run python script to verify structure of library.json for PlatformIO run: python continuous_integration/validate_manifest.py + + - name: Run Arduino-Lint to verify the library structure and syntax for the Arduino IDE + env: + ARDUINO_LINT_LIBRARY_MANAGER_INDEXING: true + uses: arduino/arduino-lint-action@v1 + with: + project-type: library + library-manager: update + compliance: strict + verbose: true diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 278e9178b..2fd7d82fb 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 7, + "action_cache_version": 8, "dependencies": [ { "name": "EnviroDIY_DS3231", @@ -82,7 +82,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.9.7", + "version": "~1.11.1", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": [ "Adafruit" @@ -120,7 +120,7 @@ "owner": "adafruit", "library id": "773", "url": "https://github.com/adafruit/Adafruit_AM2315.git", - "version": "~2.2.0", + "version": "~2.2.1", "note": "AOSong AM2315 I2C Temp/Humidity Sensor Library by Adafruit", "authors": [ "Adafruit" @@ -133,7 +133,7 @@ "owner": "adafruit", "library id": "166", "url": "https://github.com/adafruit/Adafruit_BME280_Library.git", - "version": "~2.2.1", + "version": "~2.2.2", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", "authors": [ "Adafruit" @@ -290,7 +290,7 @@ "owner": "envirodiy", "library id": "2078", "url": "https://github.com/EnviroDIY/YosemitechModbus.git", - "version": "~0.3.0", + "version": "~0.3.2", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", "authors": [ "Sara Damiano", 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 a9b4d0f67..528b5e96d 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1148,9 +1148,10 @@ Variable* obs3VoltHigh = new CampbellOBS3_Voltage( /** Start [clarivue] */ #include +// NOTE: Use -1 for any pins that don't apply or aren't being used. const char* ClariVUESDI12address = "0"; // The SDI-12 Address of the ClariVUE10 -const int8_t ClariVUEPower = sensorPowerPin; // Power pin (-1 if unconnected) -const int8_t ClariVUEData = 7; // The SDI12 data pin +const int8_t ClariVUEPower = sensorPowerPin; // Power pin +const int8_t ClariVUEData = 7; // The SDI-12 data pin // NOTE: you should NOT take more than one readings. THe sensor already takes // and averages 8 by default. @@ -1179,7 +1180,7 @@ Variable* clarivueError = new CampbellClariVUE10_ErrorCode( const char* CTDSDI12address = "1"; // The SDI-12 Address of the CTD const uint8_t CTDNumberReadings = 6; // The number of readings to average const int8_t CTDPower = sensorPowerPin; // Power pin -const int8_t CTDData = 7; // The SDI12 data pin +const int8_t CTDData = 7; // The SDI-12 data pin // Create a Decagon CTD sensor object DecagonCTD ctd(*CTDSDI12address, CTDPower, CTDData, CTDNumberReadings); @@ -1205,7 +1206,7 @@ Variable* ctdDepth = // NOTE: Use -1 for any pins that don't apply or aren't being used. const char* ES2SDI12address = "3"; // The SDI-12 Address of the ES2 const int8_t ES2Power = sensorPowerPin; // Power pin -const int8_t ES2Data = 7; // The SDI12 data pin +const int8_t ES2Data = 7; // The SDI-12 data pin const uint8_t ES2NumberReadings = 5; // Create a Decagon ES2 sensor object @@ -1278,7 +1279,7 @@ Variable* mplTemp = new MPL115A2_Temp(&mpl115a2, // NOTE: Use -1 for any pins that don't apply or aren't being used. const char* RDOSDI12address = "5"; // The SDI-12 Address of the RDO PRO-X const int8_t RDOPower = sensorPowerPin; // Power pin -const int8_t RDOData = 7; // The SDI12 data pin +const int8_t RDOData = 7; // The SDI-12 data pin const uint8_t RDONumberReadings = 3; // Create an In-Situ RDO PRO-X dissolved oxygen sensor object @@ -1494,7 +1495,7 @@ Variable* ms5803Temp = // NOTE: Use -1 for any pins that don't apply or aren't being used. const char* TMSDI12address = "2"; // The SDI-12 Address of the 5-TM const int8_t TMPower = sensorPowerPin; // Power pin -const int8_t TMData = 7; // The SDI12 data pin +const int8_t TMData = 7; // The SDI-12 data pin // Create a Decagon 5TM sensor object Decagon5TM fivetm(*TMSDI12address, TMPower, TMData); @@ -1522,7 +1523,7 @@ Variable* fivetmTemp = const char* hydros21SDI12address = "1"; // The SDI-12 Address of the Hydros21 const uint8_t hydros21NumberReadings = 6; // The number of readings to average const int8_t hydros21Power = sensorPowerPin; // Power pin -const int8_t hydros21Data = 7; // The SDI12 data pin +const int8_t hydros21Data = 7; // The SDI-12 data pin // Create a Decagon Hydros21 sensor object MeterHydros21 hydros21(*hydros21SDI12address, hydros21Power, hydros21Data, @@ -1550,7 +1551,7 @@ Variable* hydros21Depth = // NOTE: Use -1 for any pins that don't apply or aren't being used. const char* teros11SDI12address = "4"; // The SDI-12 Address of the Teros 11 const int8_t terosPower = sensorPowerPin; // Power pin -const int8_t terosData = 7; // The SDI12 data pin +const int8_t terosData = 7; // The SDI-12 data pin const uint8_t teros11NumberReadings = 3; // The number of readings to average // Create a METER TEROS 11 sensor object @@ -1576,6 +1577,7 @@ Variable* teros11VWC = /** Start [pt_redox] */ #include +// NOTE: Use -1 for any pins that don't apply or aren't being used. int8_t paleoTerraPower = sensorPowerPin; // Power pin uint8_t paleoI2CAddress = 0x68; // the I2C address of the redox sensor @@ -1818,11 +1820,11 @@ Variable* analogEc_spcond = new Variable( // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y504ModbusAddress = 0x04; // The modbus address of the Y504 -const int8_t y504AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y504SensorPower = A3; // Sensor power pin -const int8_t y504EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte y504ModbusAddress = 0x04; // The modbus address of the Y504 +const int8_t y504AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y504SensorPower = A3; // Sensor power pin +const int8_t y504EnablePin = -1; // Adapter RE/DE pin const uint8_t y504NumberReadings = 5; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -1853,11 +1855,11 @@ Variable* y504Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y510ModbusAddress = 0x0B; // The modbus address of the Y510 -const int8_t y510AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y510SensorPower = A3; // Sensor power pin -const int8_t y510EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte y510ModbusAddress = 0x0B; // The modbus address of the Y510 +const int8_t y510AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y510SensorPower = A3; // Sensor power pin +const int8_t y510EnablePin = -1; // Adapter RE/DE pin const uint8_t y510NumberReadings = 5; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -1885,11 +1887,11 @@ Variable* y510Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y511ModbusAddress = 0x1A; // The modbus address of the Y511 -const int8_t y511AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y511SensorPower = A3; // Sensor power pin -const int8_t y511EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte y511ModbusAddress = 0x1A; // The modbus address of the Y511 +const int8_t y511AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y511SensorPower = A3; // Sensor power pin +const int8_t y511EnablePin = -1; // Adapter RE/DE pin const uint8_t y511NumberReadings = 5; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -1950,11 +1952,11 @@ Variable* y514Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y520ModbusAddress = 0x20; // The modbus address of the Y520 -const int8_t y520AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y520SensorPower = A3; // Sensor power pin -const int8_t y520EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte y520ModbusAddress = 0x20; // The modbus address of the Y520 +const int8_t y520AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y520SensorPower = A3; // Sensor power pin +const int8_t y520EnablePin = -1; // Adapter RE/DE pin const uint8_t y520NumberReadings = 5; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -2016,11 +2018,11 @@ Variable* y532Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y533ModbusAddress = 0x32; // The modbus address of the Y533 -const int8_t y533AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y533SensorPower = A3; // Sensor power pin -const int8_t y533EnablePin = 4; // Adapter RE/DE pin (-1 if not applicable) +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte y533ModbusAddress = 0x32; // The modbus address of the Y533 +const int8_t y533AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y533SensorPower = A3; // Sensor power pin +const int8_t y533EnablePin = 4; // Adapter RE/DE pin const uint8_t y533NumberReadings = 1; // The manufacturer actually doesn't mention averaging for this one @@ -2047,11 +2049,11 @@ Variable* y533Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y551ModbusAddress = 0x50; // The modbus address of the Y551 -const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y551SensorPower = A3; // Sensor power pin -const int8_t y551EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte y551ModbusAddress = 0x50; // The modbus address of the Y551 +const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y551SensorPower = A3; // Sensor power pin +const int8_t y551EnablePin = -1; // Adapter RE/DE pin const uint8_t y551NumberReadings = 3; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -2081,13 +2083,13 @@ Variable* y551Temp = // 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 y560ModbusAddress = 0x60; // The modbus address of the Y560. // NOTE: Hexidecimal 0x60 = 96 decimal used by Yosemitech SmartPC -const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y560SensorPower = A3; // Sensor power pin -const int8_t y560EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +const int8_t y560AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y560SensorPower = A3; // Sensor power pin +const int8_t y560EnablePin = -1; // Adapter RE/DE pin const uint8_t y560NumberReadings = 3; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -2118,11 +2120,11 @@ Variable* y560Temp = // NOTE: Extra hardware and software serial ports are created in the "Settings // for Additional Serial Ports" section -byte y4000ModbusAddress = 0x05; // The modbus address of the Y4000 -const int8_t y4000AdapterPower = sensorPowerPin; // RS485 adapter power pin - // (-1 if unconnected) -const int8_t y4000SensorPower = A3; // Sensor power pin -const int8_t y4000EnablePin = -1; // Adapter RE/DE pin (-1 if not applicable) +// NOTE: Use -1 for any pins that don't apply or aren't being used. +byte y4000ModbusAddress = 0x05; // The modbus address of the Y4000 +const int8_t y4000AdapterPower = sensorPowerPin; // RS485 adapter power pin +const int8_t y4000SensorPower = A3; // Sensor power pin +const int8_t y4000EnablePin = -1; // Adapter RE/DE pin const uint8_t y4000NumberReadings = 5; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -2162,7 +2164,7 @@ Variable* y4000BGA = // NOTE: Use -1 for any pins that don't apply or aren't being used. const char* DOptoSDI12address = "5"; // The SDI-12 Address of the D-Opto const int8_t ZTPower = sensorPowerPin; // Power pin -const int8_t ZTData = 7; // The SDI12 data pin +const int8_t ZTData = 7; // The SDI-12 data pin // Create a Zebra Tech DOpto dissolved oxygen sensor object ZebraTechDOpto dopto(*DOptoSDI12address, ZTPower, ZTData); @@ -2475,7 +2477,6 @@ Variable* variableList[] = { y551Turbid, y551Temp, #endif - #if defined BUILD_SENSOR_Y560 y560NH4_N, y560pH, diff --git a/library.json b/library.json index 46ca778ff..9b3707fbc 100644 --- a/library.json +++ b/library.json @@ -129,7 +129,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.9.7", + "version": "~1.11.1", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": ["Adafruit"], "frameworks": "arduino", @@ -161,7 +161,7 @@ "owner": "adafruit", "library id": "773", "url": "https://github.com/adafruit/Adafruit_AM2315.git", - "version": "~2.2.0", + "version": "~2.2.1", "note": "AOSong AM2315 I2C Temp/Humidity Sensor Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino", @@ -172,7 +172,7 @@ "owner": "adafruit", "library id": "166", "url": "https://github.com/adafruit/Adafruit_BME280_Library.git", - "version": "~2.2.1", + "version": "~2.2.2", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino", @@ -304,7 +304,7 @@ "owner": "envirodiy", "library id": "2078", "url": "https://github.com/EnviroDIY/YosemitechModbus.git", - "version": "~0.3.0", + "version": "~0.3.2", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", "authors": ["Sara Damiano", "Anthony Aufdenkampe"], "frameworks": "arduino", From 0ac9fdd939087be8da0f65d5356c46a50b2427b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 17:06:22 +0000 Subject: [PATCH 29/94] ci: bump actions/checkout from 2.4.0 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build_documentation.yaml | 4 ++-- .github/workflows/build_examples_arduino_cli.yaml | 2 +- .github/workflows/build_examples_platformio.yaml | 2 +- .github/workflows/build_menu.yaml | 2 +- .github/workflows/changelog_reminder.yaml | 2 +- .github/workflows/prepare_release.yaml | 2 +- .github/workflows/verify_library_json.yaml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index fa002d219..e81d7f7d7 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -18,7 +18,7 @@ jobs: steps: # check out the ModularSensors repo - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 with: path: code_docs/ModularSensors @@ -59,7 +59,7 @@ jobs: # check out my fork of m.css, for processing Doxygen output - name: Checkout m.css - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3 with: # Repository name with owner. For example, actions/checkout repository: SRGDamia1/m.css diff --git a/.github/workflows/build_examples_arduino_cli.yaml b/.github/workflows/build_examples_arduino_cli.yaml index e70b46a7b..15016bc9f 100644 --- a/.github/workflows/build_examples_arduino_cli.yaml +++ b/.github/workflows/build_examples_arduino_cli.yaml @@ -36,7 +36,7 @@ jobs: ] steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - name: Set environment variable for library installation source run: | diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml index fa8a625db..033baeeae 100644 --- a/.github/workflows/build_examples_platformio.yaml +++ b/.github/workflows/build_examples_platformio.yaml @@ -28,7 +28,7 @@ jobs: pio_environment: [mayfly, mega, arduino_zero, adafruit_feather_m0, autonomo] steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - name: Set environment variable for library installation source run: | diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index a8777da81..3422652e1 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -182,7 +182,7 @@ jobs: sensorFlag: NO_SENSORS publisherFlag: BUILD_PUB_THINGSPEAK steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - name: Set environment variable for library installation source run: | diff --git a/.github/workflows/changelog_reminder.yaml b/.github/workflows/changelog_reminder.yaml index 5fd25a7e9..e6aa9beee 100644 --- a/.github/workflows/changelog_reminder.yaml +++ b/.github/workflows/changelog_reminder.yaml @@ -5,7 +5,7 @@ jobs: name: Changelog Reminder runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 with: persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token diff --git a/.github/workflows/prepare_release.yaml b/.github/workflows/prepare_release.yaml index 834ce45e8..366c0f1e2 100644 --- a/.github/workflows/prepare_release.yaml +++ b/.github/workflows/prepare_release.yaml @@ -19,7 +19,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2.4.0 + uses: actions/checkout@v3 - name: Set environment variable for current library version run: | diff --git a/.github/workflows/verify_library_json.yaml b/.github/workflows/verify_library_json.yaml index a608b16e8..48ed639e9 100644 --- a/.github/workflows/verify_library_json.yaml +++ b/.github/workflows/verify_library_json.yaml @@ -9,7 +9,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'ci skip')" steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v3 From 2cf8f518288d5265a7e71c3519fedefc6e8621a6 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 3 Mar 2022 11:23:24 -0500 Subject: [PATCH 30/94] Preliminary SHT support Signed-off-by: Sara Damiano --- .github/workflows/build_menu.yaml | 319 ++++++++-------- ChangeLog.md | 3 +- README.md | 1 + continuous_integration/dependencies.json | 14 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 24 +- library.json | 10 + src/sensors/SensirionSHT4x.cpp | 184 +++++++++ src/sensors/SensirionSHT4x.h | 375 +++++++++++++++++++ 8 files changed, 768 insertions(+), 162 deletions(-) create mode 100644 src/sensors/SensirionSHT4x.cpp create mode 100644 src/sensors/SensirionSHT4x.h diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 02a04353b..404b6ce16 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -13,180 +13,183 @@ jobs: strategy: matrix: include: - - modemFlag: BUILD_MODEM_SIM7080 + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_CELLULAR + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_LTE_B + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_LTE_BYPASS sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_3G_B + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_3G_BYPASS sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_WIFI + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_WIFI sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_ESP8266 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_ESPRESSIF_ESP8266 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_BG96 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_QUECTEL_BG96 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_MONARCH + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SEQUANS_MONARCH sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM800 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM800 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7000 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7000 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_S2GB + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SODAQ_2GBEE_R6 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_UBEE_R410M + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SODAQ_UBEE_R410M sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_UBEE_U201 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SODAQ_UBEE_U201 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_AM2315 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_DHT - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_SQ212 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASCO2 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASDO - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASORP - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASPH - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASRTD - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASEC - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_BME280 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_OBS3 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_CLARIVUE10 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_CTD - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ES2 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_VOLTAGE - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_AO_SONG_AM2315 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_AO_SONG_DHT + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_APOGEE_SQ212 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_DO + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_PH + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_RTD + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_EC + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_BOSCH_BME280 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_CAMPBELL_CLARI_VUE10 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_CAMPBELL_OBS3 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_DECAGON_CTD + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_DECAGON_ES2 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_EXTERNAL_VOLTAGE + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_MPL115A2 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_INSITURDO - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_INSITUTROOLSDI12A - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ACCULEVEL - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_NANOLEVEL - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_MAXBOTIX - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_DS18 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_MS5803 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_5TM - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_HYDROS21 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_TEROS11 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_PALEOTERRA - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_RAINI2C - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_TALLY - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_INA219 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_CYCLOPS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ANALOGEC - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y504 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y510 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y511 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y514 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y520 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y532 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y533 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y551 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y560 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y4000 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_DOPTO - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_IN_SITU_RDO + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_INSITU_TROLL_SDI12A + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_KELLER_ACCULEVEL + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_KELLER_NANOLEVEL + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_MAX_BOTIX_SONAR + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_MAXIM_DS18 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_MEA_SPEC_MS5803 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_DECAGON_5TM + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_METER_HYDROS21 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_METER_TEROS11 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_PALEO_TERRA_REDOX + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_RAIN_COUNTER_I2C + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_SENSIRION_SHT4X + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_TALLY_COUNTER_I2C + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_TI_INA219 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_TURNER_CYCLOPS + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y504 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y510 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y511 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y514 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y520 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y532 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y533 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y551 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y560 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y4000 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ZEBRA_TECH_D_OPTO + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_DREAMHOST - - modemFlag: BUILD_MODEM_SIM7080 + publisherFlag: BUILD_PUB_DREAM_HOST_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_THINGSPEAK + publisherFlag: BUILD_PUB_THING_SPEAK_PUBLISHER steps: - uses: actions/checkout@v2.4.0 diff --git a/ChangeLog.md b/ChangeLog.md index 6743fdcea..2ca8a22c0 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -11,9 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - ### Added - +- Added support for Sensirion SHT4x sensors. ### Removed ### Fixed diff --git a/README.md b/README.md index 86ae16f5a..7fb76346b 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ For some generalized information about attaching sensors to an Arduino style boa - [Meter Environmental Hydros 21: conductivity, temperature & depth](https://envirodiy.github.io/ModularSensors/group__sensor__hydros21.html) - [Northern Widget Tally Event Counter: number of events](https://envirodiy.github.io/ModularSensors/group__sensor__tally.html) - [PaleoTerra Redox Sensor: redox potential](https://envirodiy.github.io/ModularSensors/group__sensor__pt__redox.html) +- [Sensirion SHT40: humidity & temperature](https://envirodiy.github.io/ModularSensors/group__sensor__sht4x.html) - [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) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 2fd7d82fb..c27e45cdb 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 8, + "action_cache_version": 9, "dependencies": [ { "name": "EnviroDIY_DS3231", @@ -179,6 +179,18 @@ ], "frameworks": "arduino" }, + { + "name": "Adafruit SHT4x Library", + "owner": "adafruit", + "library id": "11710", + "url": "https://github.com/adafruit/Adafruit_SHT4X", + "version": "~1.0.0", + "note": "Sensirion SHT4x Library by Adafruit", + "authors": [ + "Adafruit" + ], + "frameworks": "arduino" + }, { "name": "OneWire", "owner": "paulstoffregen", 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 528b5e96d..e30007451 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1622,7 +1622,29 @@ Variable* tbi2cTips = new RainCounterI2C_Tips(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); Variable* tbi2cDepth = new RainCounterI2C_Depth(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [i2c_rain] */ +#endif + + +#if defined BUILD_SENSOR_SENSIRION_SHT4X +// ========================================================================== +// Sensirion SHT4X Digital Humidity and Temperature Sensor +// ========================================================================== +/** Start [sensirion_sht4x] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const int8_t SHT4xPower = sensorPowerPin; // Power pin +const bool SHT4xUseHeater = true; + +// Create an Sensirion SHT4X sensor object +SensirionSHT4x sht4x(SHT4xPower, SHT4xUseHeater); + +// Create humidity and temperature variable pointers for the SHT4X +Variable* sht4xHumid = + new SensirionSHT4x_Humidity(&sht4x, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* sht4xTemp = + new SensirionSHT4x_Temp(&sht4x, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [sensirion_sht4x] */ #endif diff --git a/library.json b/library.json index 9b3707fbc..30dd118ce 100644 --- a/library.json +++ b/library.json @@ -210,6 +210,16 @@ "authors": ["Adafruit"], "frameworks": "arduino" }, + { + "name": "Adafruit SHT4x Library", + "owner": "adafruit", + "library id": "11710", + "url": "https://github.com/adafruit/Adafruit_SHT4X", + "version": "~1.0.0", + "note": "Sensirion SHT4x Library by Adafruit", + "authors": ["Adafruit"], + "frameworks": "arduino" + }, { "name": "OneWire", "owner": "paulstoffregen", diff --git a/src/sensors/SensirionSHT4x.cpp b/src/sensors/SensirionSHT4x.cpp new file mode 100644 index 000000000..92c1d2710 --- /dev/null +++ b/src/sensors/SensirionSHT4x.cpp @@ -0,0 +1,184 @@ +/** + * @file SensirionSHT4x.cpp + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Sara Geleskie Damiano + * + * @brief Implements the SensirionSHT4x class. + */ + +#include "SensirionSHT4x.h" + + +// The constructors +SensirionSHT4x::SensirionSHT4x(TwoWire* theI2C, int8_t powerPin, bool useHeater, + uint8_t measurementsToAverage) + : Sensor("SensirionSHT4x", SHT4X_NUM_VARIABLES, SHT4X_WARM_UP_TIME_MS, + SHT4X_STABILIZATION_TIME_MS, SHT4X_MEASUREMENT_TIME_MS, powerPin, + -1, measurementsToAverage) { + _useHeater = useHeater; + _i2c = theI2C; +} +SensirionSHT4x::SensirionSHT4x(int8_t powerPin, bool useHeater, + uint8_t measurementsToAverage) + : Sensor("SensirionSHT4x", SHT4X_NUM_VARIABLES, SHT4X_WARM_UP_TIME_MS, + SHT4X_STABILIZATION_TIME_MS, SHT4X_MEASUREMENT_TIME_MS, powerPin, + -1, measurementsToAverage, SHT4X_INC_CALC_VARIABLES) { + _useHeater = useHeater; + _i2c = &Wire; +} +// Destructor +SensirionSHT4x::~SensirionSHT4x() {} + + +String SensirionSHT4x::getSensorLocation(void) { + return F("I2C_0x44"); +} + + +bool SensirionSHT4x::setup(void) { + _i2c->begin(); // Start the wire library (sensor power not required) + // Eliminate any potential extra waits in the wire library + // These waits would be caused by a readBytes or parseX being called + // on wire after the Wire buffer has emptied. The default stream + // functions - used by wire - wait a timeout period after reading the + // end of the buffer to see if an interrupt puts something into the + // buffer. In the case of the Wire library, that will never happen and + // the timeout period is a useless delay. + _i2c->setTimeout(0); + + bool retVal = + Sensor::setup(); // this will set pin modes and the setup status bit + + // This sensor needs power for setup! + // The SHT4x's begin() does a soft reset to check for sensor communication. + bool wasOn = checkPowerOn(); + if (!wasOn) { powerUp(); } + waitForWarmUp(); + + // Run begin fxn because it returns true or false for success in contact + // Make 5 attempts + uint8_t ntries = 0; + bool success = false; + while (!success && ntries < 5) { + success = sht4x_internal.begin(_i2c); + ntries++; + } + + // Set sensor for high precision + sht4x_internal.setPrecision(SHT4X_HIGH_PRECISION); + + // Initially, set the sensor up to *not* use the heater + sht4x_internal.setHeater(SHT4X_NO_HEATER); + + // Set status bits + if (!success) { + // Set the status error bit (bit 7) + _sensorStatus |= 0b10000000; + // UN-set the set-up bit (bit 0) since setup failed! + _sensorStatus &= 0b11111110; + } + retVal &= success; + + // Turn the power back off it it had been turned on + if (!wasOn) { powerDown(); } + + return retVal; +} + + +bool SensirionSHT4x::addSingleMeasurementResult(void) { + // Initialize float variables + float temp_val = -9999; + float humid_val = -9999; + bool ret_val = 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)) { + MS_DBG(getSensorNameAndLocation(), F("is reporting:")); + + // Make sure the heater is *not* going to run. We want the ambient + // values. + sht4x_internal.setHeater(SHT4X_NO_HEATER); + + // we need to create Adafruit "sensor events" to use the library + sensors_event_t temp_event, humidity_event; + ret_val = sht4x_internal.getEvent(&humidity_event, &temp_event); + + // get the values from the sensor events + temp_val = temp_event.temperature; + humid_val = humidity_event.relative_humidity; + + if (!ret_val || isnan(temp_val)) temp_val = -9999; + if (!ret_val || isnan(humid_val)) humid_val = -9999; + + MS_DBG(F(" Temp:"), temp_val, F("°C")); + MS_DBG(F(" Humidity:"), humid_val, '%'); + } else { + MS_DBG(getSensorNameAndLocation(), F("is not currently measuring!")); + } + + verifyAndAddMeasurementResult(SHT4X_TEMP_VAR_NUM, temp_val); + verifyAndAddMeasurementResult(SHT4X_HUMIDITY_VAR_NUM, humid_val); + + // 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 ret_val; +} + + +// The function to run the internal heater before going to sleep +bool SensirionSHT4x::sleep(void) { + if (_useHeater) { return Sensor::sleep(); } + + if (!checkPowerOn()) { return true; } + if (_millisSensorActivated == 0) { + MS_DBG(getSensorNameAndLocation(), F("was not measuring!")); + return true; + } + + bool success = true; + MS_DBG(F("Running heater on"), getSensorNameAndLocation(), + F("at maximum for 1s to remove condensation.")); + + + // Set up to send a heat command at the highest and longest cycle. + // Because we're only doing this once per logging cycle (most commonly every + // 5 minutes, we want to blast the heater for the tiny bit of time it will + // be on. + sht4x_internal.setHeater(SHT4X_HIGH_HEATER_1S); + + // we need to create Adafruit "sensor events" to use the library + // NOTE: we're not going to use the temperatures and humidity returned + // here. The SHT4x simply doesn't have any way command to run the heater + // without measuring. It's a sensor limitation, not a library limit. The + // Adafruit library will always block until the heater turns off - in this + // case 1 second. Usually blocking steps are a problem, but in this case we + // need the block because ModularSensors does not currently support a sleep + // time like it supports a wake time. + sensors_event_t temp_event, humidity_event; + success = sht4x_internal.getEvent(&humidity_event, &temp_event); + + // Set the command back to no heat for the next measurement. + sht4x_internal.setHeater(SHT4X_NO_HEATER); + + 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("Done")); + } else { + MS_DBG(getSensorNameAndLocation(), + F("did not successfully run the heater.")); + } + + return success; +} diff --git a/src/sensors/SensirionSHT4x.h b/src/sensors/SensirionSHT4x.h new file mode 100644 index 000000000..201439e98 --- /dev/null +++ b/src/sensors/SensirionSHT4x.h @@ -0,0 +1,375 @@ +/** + * @file SensirionSHT4x.h + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Sara Geleskie Damiano + * + * @brief Contains the SensirionSHT4x sensor subclass and the variable + * subclasses SensirionSHT4x_Humidity and SensirionSHT4x_Temp. + * + * These are used for the Sensirion SHT40, SHT41, and SHT45 capacitive humidity + * and temperature sensor. + * + * This depends on the [Adafruit SHT40 + * library](https://github.com/adafruit/Adafruit_SHT4X). + */ +/* clang-format off */ +/** + * @defgroup sensor_sht4x Sensirion SHT40, SHT41, and SHT45 + * Classes for the Sensirion SHT40, SHT41, and SHT45 I2C humidity and temperature sensors. + * + * @ingroup the_sensors + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_sht4x_intro Introduction + * + * > SHT4x is a digital sensor platform for measuring relative humidity and + * > temperature at different accuracy classes. The I2C interface provides + * > several preconfigured I2C addresses and maintains an ultra-low power + * > budget. The power-trimmed internal heater can be used at three heating + * > levels thus enabling sensor operation in demanding environments. + * + + * - The code for this library should work for 0x44 addressed SHT4x sensors - the SHT40, SHT41, and SHT45. + * - Depends on the [Adafruit SHT4x Library](https://github.com/adafruit/Adafruit_SHT40). + * - Communicates via I2C + * - There are versions of the SHT40, SHT40-AD1B with the I2C address 0x44 + * and SHT40-BD1B with the I2C address 0x45. + * **This library only supports the 0x44 addressed sensor!** + * - The SHT41 and SHT45 only have one possible address, 0x44. + * - **Only 1 can be connected to a single I2C bus at a time** + * - Requires a 3.3 power source + * + * @note Software I2C is *not* supported for the SHT4x. + * A secondary hardware I2C on a SAMD board is supported. + * + * @section sensor_sht4x_datasheet Sensor Datasheet + * [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Sensirion_Humidity_Sensors_SHT4x_Datasheet.pdf) + * + * @section sensor_sht4x_ctor Sensor Constructors + * {{ @ref SensirionSHT4x::SensirionSHT4x(int8_t, uint8_t) }} + * {{ @ref SensirionSHT4x::SensirionSHT4x(TwoWire*, int8_t, uint8_t) }} + * + * @section sensor_sht4x_examples Example Code + * + * The SHT40 is used in the @menulink{sht4x} example + * + * @menusnip{sensirion_sht4x} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_SENSIRIONSHT4X_H_ +#define SRC_SENSORS_SENSIRIONSHT4X_H_ + +// Debugging Statement +// #define MS_SENSIRIONSHT4X_DEBUG + +#ifdef MS_SENSIRIONSHT4X_DEBUG +#define MS_DEBUGGING_STD "SensirionSHT4x" +#endif + +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "VariableBase.h" +#include "SensorBase.h" +#include + +// Sensor Specific Defines +/** @ingroup sensor_sht4x */ +/**@{*/ + +/// @brief Sensor::_numReturnedValues; the SHT4x can report 2 values. +#define SHT4X_NUM_VARIABLES 2 +/// @brief Sensor::_incCalcValues; we don't calculate any additional values. +#define SHT4X_INC_CALC_VARIABLES 0 + +/** + * @anchor sensor_sht4x_timing + * @name Sensor Timing + * The sensor timing for an Sensirion SHT4x + */ +/**@{*/ +/// @brief Sensor::_warmUpTime_ms; SHT4x warms up in 0.3ms (typical) and +/// soft-resets in 1ms (max). +#define SHT4X_WARM_UP_TIME_MS 1 +/// @brief Sensor::_stabilizationTime_ms; SHT4x is assumed to be immediately +/// stable. +#define SHT4X_STABILIZATION_TIME_MS 0 +/// @brief Sensor::_measurementTime_ms; SHT4x takes 8.2ms (max) to complete a +/// measurement at the highest precision. At medium precision measurement time +/// is 4.5ms (max) and it is 1.7ms (max) at low precision. +#define SHT4X_MEASUREMENT_TIME_MS 9 +/**@}*/ + +/** + * @anchor sensor_sht4x_humidity + * @name Humidity + * The humidity variable from an Sensirion SHT4x + * - Range is 0 to 100% RH + * - Accuracy is ± 1.8 % RH (typical) + * + * {{ @ref SensirionSHT4x_Humidity::SensirionSHT4x_Humidity }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; humidity should have 2 (0.01 + * % RH). + * + * @note This resolution is some-what silly in light of the ± 1.8 % RH accuracy. + */ +#define SHT4X_HUMIDITY_RESOLUTION 2 +/// @brief Sensor variable number; humidity is stored in sensorValues[0]. +#define SHT4X_HUMIDITY_VAR_NUM 0 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "relativeHumidity" +#define SHT4X_HUMIDITY_VAR_NAME "relativeHumidity" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "percent" +/// (percent relative humidity) +#define SHT4X_HUMIDITY_UNIT_NAME "percent" +/// @brief Default variable short code; "SHT4xHumidity" +#define SHT4X_HUMIDITY_DEFAULT_CODE "SHT4xHumidity" +/**@}*/ + +/** + * @anchor sensor_sht4x_temperature + * @name Temperature + * The temperature variable from an Sensirion SHT4x + * - Range is -40°C to +125°C + * - Accuracy is ±0.2°C + * + * {{ @ref SensirionSHT4x_Temp::SensirionSHT4x_Temp }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; humidity should have 2 (0.01 + * °C). + * + * @note This resolution is some-what silly in light of the ± 0.2°C accuracy. + */ +#define SHT4X_TEMP_RESOLUTION 2 +/// @brief Sensor variable number; temperature is stored in sensorValues[1]. +#define SHT4X_TEMP_VAR_NUM 1 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "temperature" +#define SHT4X_TEMP_VAR_NAME "temperature" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "degreeCelsius" (°C) +#define SHT4X_TEMP_UNIT_NAME "degreeCelsius" +/// @brief Default variable short code; "SHT4xTemp" +#define SHT4X_TEMP_DEFAULT_CODE "SHT4xTemp" +/**@}*/ + + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the [Sensirion SHT4x](@ref sensor_sht4x). + */ +/* clang-format on */ +class SensirionSHT4x : public Sensor { + public: + /** + * @brief Construct a new SensirionSHT4x object using a secondary *hardware* + * I2C instance. + * + * This is only applicable to SAMD boards that are able to have multiple + * hardware I2C ports in use via SERCOMs. + * + * @note It is only possible to connect *one* SHT4x at a time on a single + * I2C bus. Only the 0x44 addressed version is supported. + * + * @param theI2C A TwoWire instance for I2C communication. Due to the + * limitations of the Arduino core, only a hardware I2C instance can be + * used. For an AVR board, there is only one I2C instance possible and this + * form of the constructor should not be used. For a SAMD board, this can + * be used if a secondary I2C port is created on one of the extra SERCOMs. + * @param powerPin The pin on the mcu controlling power to the Sensirion + * SHT4x. Use -1 if it is continuously powered. + * - The SHT4x requires a 3.3V power source + * @param useHeater Whether or not to run the internal heater of the SHT4x + * when shutting down the sensor; optional with a default value of true. The + * internal heater is designed to remove condensed water from the sensor - + * which will make the sensor stop responding to air humidity changes - and + * to allow creep-free operation in high humidity environments. The longest + * the internal heater can run at a time is 1s and the maximum duty load is + * 5%. Running only 1s per measurment cycle probably isn't enough to help + * with more than very minimal condensation, but it's probably the best we + * can easily do. + * @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. + */ + SensirionSHT4x(TwoWire* theI2C, int8_t powerPin, bool useHeater = true, + uint8_t measurementsToAverage = 1); + /** + * @brief Construct a new SensirionSHT4x object using the primary hardware + * I2C instance. + * + * Because this is I2C and has only 1 possible address (0x44), we only need + * the power pin. + * + * @note It is only possible to connect *one* SHT4x at a time on a single + * I2C bus. Only the 0x44 addressed version is supported. + * + * @param powerPin The pin on the mcu controlling power to the Sensirion + * SHT4x. Use -1 if it is continuously powered. + * - The SHT4x requires a 3.3V power source + * @param useHeater Whether or not to run the internal heater of the SHT4x + * when shutting down the sensor; optional with a default value of true. The + * internal heater is designed to remove condensed water from the sensor - + * which will make the sensor stop responding to air humidity changes - and + * to allow creep-free operation in high humidity environments. The longest + * the internal heater can run at a time is 1s and the maximum duty load is + * 5%. Running only 1s per measurment cycle probably isn't enough to help + * with more than very minimal condensation, but it's probably the best we + * can easily do. + * @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. + */ + explicit SensirionSHT4x(int8_t powerPin, bool useHeater = true, + uint8_t measurementsToAverage = 1); + /** + * @brief Destroy the SensirionSHT4x object - no action needed. + */ + ~SensirionSHT4x(); + + /** + * @brief Report the I2C address of the SHT4x - which is always 0x44. + * + * @return **String** Text describing how the sensor is attached to the mcu. + */ + String getSensorLocation(void) override; + + /** + * @brief Do any one-time preparations needed before the sensor will be able + * to take readings. + * + * This sets the #_powerPin mode, begins the Wire library (sets pin levels + * and modes for I2C), and updates the #_sensorStatus. No sensor power is + * required. + * + * @return **bool** True if the setup was successful. + */ + bool setup(void) override; + + /** + * @copydoc Sensor::addSingleMeasurementResult() + */ + bool addSingleMeasurementResult(void) override; + + /** + * @copydoc Sensor::sleep() + * + * If opted for, we run the SHT4x's internal heater for 1s before going to + * sleep. + */ + bool sleep(void) override; + + private: + /** + * @brief Internal variable for the heating setting + */ + bool _useHeater; + /** + * @brief Internal reference the the Adafruit BME object + */ + Adafruit_SHT4x sht4x_internal; + /** + * @brief An internal reference to the hardware Wire instance. + */ + TwoWire* _i2c; +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [relative humidity output](@ref sensor_sht4x_humidity) from an + * [Sensirion SHT4x](@ref sensor_sht4x). + */ +/* clang-format on */ +class SensirionSHT4x_Humidity : public Variable { + public: + /** + * @brief Construct a new SensirionSHT4x_Humidity object. + * + * @param parentSense The parent SensirionSHT4x 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 "SHT4xHumidity". + */ + explicit SensirionSHT4x_Humidity( + SensirionSHT4x* parentSense, const char* uuid = "", + const char* varCode = SHT4X_HUMIDITY_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)SHT4X_HUMIDITY_VAR_NUM, + (uint8_t)SHT4X_HUMIDITY_RESOLUTION, SHT4X_HUMIDITY_VAR_NAME, + SHT4X_HUMIDITY_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new SensirionSHT4x_Humidity object. + * + * @note This must be tied with a parent SensirionSHT4x before it can be + * used. + */ + SensirionSHT4x_Humidity() + : Variable((const uint8_t)SHT4X_HUMIDITY_VAR_NUM, + (uint8_t)SHT4X_HUMIDITY_RESOLUTION, SHT4X_HUMIDITY_VAR_NAME, + SHT4X_HUMIDITY_UNIT_NAME, SHT4X_HUMIDITY_DEFAULT_CODE) {} + /** + * @brief Destroy the SensirionSHT4x_Humidity object - no action needed. + */ + ~SensirionSHT4x_Humidity() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature output](@ref sensor_sht4x_temperature) from an + * [Sensirion SHTx0](@ref sensor_sht4x). + */ +/* clang-format on */ +class SensirionSHT4x_Temp : public Variable { + public: + /** + * @brief Construct a new SensirionSHT4x_Temp object. + * + * @param parentSense The parent SensirionSHT4x 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 "SHT4xTemp". + */ + explicit SensirionSHT4x_Temp(SensirionSHT4x* parentSense, + const char* uuid = "", + const char* varCode = SHT4X_TEMP_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)SHT4X_TEMP_VAR_NUM, + (uint8_t)SHT4X_TEMP_RESOLUTION, SHT4X_TEMP_VAR_NAME, + SHT4X_TEMP_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new SensirionSHT4x_Temp object. + * + * @note This must be tied with a parent SensirionSHT4x before it can be + * used. + */ + SensirionSHT4x_Temp() + : Variable((const uint8_t)SHT4X_TEMP_VAR_NUM, + (uint8_t)SHT4X_TEMP_RESOLUTION, SHT4X_TEMP_VAR_NAME, + SHT4X_TEMP_UNIT_NAME, SHT4X_TEMP_DEFAULT_CODE) {} + /** + * @brief Destroy the SensirionSHT4x_Temp object - no action needed. + */ + ~SensirionSHT4x_Temp() {} +}; +/**@}*/ +#endif // SRC_SENSORS_SENSIRIONSHT4X_H_ From c793c2614aa48b6e824b6b92bdb16076f422cdd1 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 10 Mar 2022 15:57:31 -0500 Subject: [PATCH 31/94] Update doxgen, adjust all markdown headings, rewrite markdown prefilter, update copyright, rename snippet tags and build flags Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 2 +- .github/workflows/build_menu.yaml | 316 +++++------ .gitignore | 10 +- ChangeLog.md | 47 +- LICENSE.md | 2 +- README.md | 52 +- build-menu-configurations.ps1 | 115 ++-- .../generate-documentation.sh | 10 +- .../pre-commit-generate-build-matrix.py | 4 +- docs/Doxyfile | 89 ++- docs/DoxygenLayout.xml | 4 +- docs/FAQ/Arduino-Streams.md | 28 +- docs/FAQ/Code-Debugging.md | 3 +- docs/FAQ/Deceasing-Memory-Use.md | 3 +- docs/FAQ/Developer-Setup.md | 3 +- docs/FAQ/Power-Parasites.md | 3 +- ...tibility.md => Processor-Compatibility.md} | 38 +- docs/General-Sensor-Notes.md | 7 +- docs/Getting-Started/Getting-Started.md | 23 +- docs/Getting-Started/Library-Dependencies.md | 3 +- docs/Getting-Started/Physical-Dependencies.md | 3 +- docs/Getting-Started/Terminology.md | 24 +- docs/Modem-Notes.md | 20 +- .../m-EnviroDIY+documentation.compiled.css | 213 ++++--- docs/documentExamples.py | 123 ---- docs/doxygen_extra_pages.dox | 2 +- docs/fixSectionsInXml.py | 137 +++++ docs/fixXmlExampleSections.py | 58 -- docs/markdown_prefilter.py | 379 +++++++++++-- docs/mcss-conf.py | 2 + examples/DRWI_2G/DRWI_2G.ino | 6 +- examples/DRWI_2G/ReadMe.md | 28 +- examples/DRWI_DigiLTE/DRWI_DigiLTE.ino | 6 +- examples/DRWI_DigiLTE/ReadMe.md | 28 +- examples/DRWI_NoCellular/DRWI_NoCellular.ino | 3 +- examples/DRWI_NoCellular/ReadMe.md | 28 +- examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino | 9 +- examples/DRWI_SIM7080LTE/ReadMe.md | 10 +- examples/ReadMe.md | 83 ++- examples/baro_rho_correction/ReadMe.md | 25 +- .../baro_rho_correction.ino | 6 +- examples/data_saving/ReadMe.md | 25 +- examples/data_saving/data_saving.ino | 6 +- examples/double_logger/ReadMe.md | 22 +- examples/double_logger/double_logger.ino | 6 +- examples/examples.dox | 116 ++++ examples/logging_to_MMW/ReadMe.md | 25 +- examples/logging_to_MMW/logging_to_MMW.ino | 6 +- examples/logging_to_ThingSpeak/ReadMe.md | 22 +- .../logging_to_ThingSpeak.ino | 6 +- examples/menu_a_la_carte/ReadMe.md | 533 ++++++++---------- examples/menu_a_la_carte/menu_a_la_carte.ino | 518 ++++++++--------- examples/menu_a_la_carte/platformio.ini | 2 +- examples/simple_logging/ReadMe.md | 26 +- examples/simple_logging/simple_logging.ino | 2 +- .../simple_logging_LearnEnviroDIY/ReadMe.md | 22 +- .../simple_logging_LearnEnviroDIY.ino | 2 +- examples/single_sensor/ReadMe.md | 19 +- examples/single_sensor/single_sensor.ino | 2 +- src/LoggerBase.h | 3 +- src/modems/DigiXBee.h | 4 +- src/modems/DigiXBee3GBypass.h | 4 +- src/modems/DigiXBeeCellularTransparent.h | 4 +- src/modems/DigiXBeeLTEBypass.h | 4 +- src/modems/DigiXBeeWifi.h | 4 +- src/modems/EspressifESP8266.h | 4 +- src/modems/QuectelBG96.h | 4 +- src/modems/SIMComSIM7000.h | 4 +- src/modems/SIMComSIM7080.h | 4 +- src/modems/SIMComSIM800.h | 4 +- src/modems/SequansMonarch.h | 4 +- src/modems/Sodaq2GBeeR6.h | 6 +- src/modems/SodaqUBeeR410M.h | 4 +- src/modems/SodaqUBeeU201.h | 4 +- src/sensors/AOSongAM2315.h | 4 +- src/sensors/AOSongDHT.h | 4 +- src/sensors/AnalogElecConductivity.h | 11 +- src/sensors/ApogeeSQ212.h | 15 +- src/sensors/AtlasScientificCO2.h | 4 +- src/sensors/AtlasScientificDO.h | 4 +- src/sensors/AtlasScientificEC.h | 4 +- src/sensors/AtlasScientificORP.h | 4 +- src/sensors/AtlasScientificRTD.h | 4 +- src/sensors/AtlasScientificpH.h | 4 +- src/sensors/BoschBME280.cpp | 2 +- src/sensors/BoschBME280.h | 7 +- src/sensors/CampbellClariVUE10.h | 4 +- src/sensors/CampbellOBS3.h | 7 +- src/sensors/Decagon5TM.h | 4 +- src/sensors/DecagonCTD.h | 4 +- src/sensors/DecagonES2.h | 4 +- src/sensors/ExternalVoltage.h | 4 +- src/sensors/InsituTrollSdi12a.h | 1 + src/sensors/KellerAcculevel.h | 4 +- src/sensors/KellerNanolevel.h | 4 +- src/sensors/KellerParent.h | 2 +- src/sensors/MaxBotixSonar.h | 6 +- src/sensors/MaximDS18.h | 4 +- src/sensors/MaximDS3231.h | 4 +- src/sensors/MeaSpecMS5803.h | 4 +- src/sensors/MeterHydros21.h | 4 +- src/sensors/MeterTeros11.h | 4 +- src/sensors/PaleoTerraRedox.h | 4 +- src/sensors/ProcessorStats.h | 4 +- src/sensors/RainCounterI2C.h | 7 +- src/sensors/TIINA219.h | 4 +- src/sensors/TurnerCyclops.h | 7 +- src/sensors/YosemitechParent.h | 8 +- src/sensors/YosemitechY4000.h | 4 +- src/sensors/YosemitechY504.h | 4 +- src/sensors/YosemitechY510.h | 4 +- src/sensors/YosemitechY511.h | 4 +- src/sensors/YosemitechY514.h | 4 +- src/sensors/YosemitechY520.h | 4 +- src/sensors/YosemitechY532.h | 4 +- src/sensors/YosemitechY533.h | 4 +- src/sensors/YosemitechY551.h | 4 +- src/sensors/YosemitechY560.h | 78 ++- src/sensors/ZebraTechDOpto.h | 4 +- 119 files changed, 2025 insertions(+), 1634 deletions(-) rename docs/FAQ/{Processor Compatibility.md => Processor-Compatibility.md} (87%) delete mode 100644 docs/documentExamples.py create mode 100644 docs/fixSectionsInXml.py delete mode 100644 docs/fixXmlExampleSections.py create mode 100644 examples/examples.dox diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index fa002d219..e720f4e70 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -9,7 +9,7 @@ on: workflow_dispatch: env: - DOXYGEN_VERSION: Release_1_9_2 + DOXYGEN_VERSION: Release_1_9_3 jobs: build: diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 02a04353b..72ef85943 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -13,180 +13,180 @@ jobs: strategy: matrix: include: - - modemFlag: BUILD_MODEM_SIM7080 + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_CELLULAR + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_LTE_B + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_LTE_BYPASS sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_3G_B + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_3G_BYPASS sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_XBEE_WIFI + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_DIGI_XBEE_WIFI sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_ESP8266 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_ESPRESSIF_ESP8266 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_BG96 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_QUECTEL_BG96 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_MONARCH + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SEQUANS_MONARCH sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM800 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM800 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7000 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7000 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_S2GB + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SODAQ_2G_BEE_R6 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_UBEE_R410M + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SODAQ_UBEE_R410M sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_UBEE_U201 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SODAQ_UBEE_U201 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_AM2315 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_DHT - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_SQ212 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASCO2 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASDO - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASORP - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASPH - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASRTD - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ATLASEC - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_BME280 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_OBS3 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_CLARIVUE10 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_CTD - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ES2 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_VOLTAGE - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_AO_SONG_AM2315 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_AO_SONG_DHT + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_APOGEE_SQ212 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_DO + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_PH + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_RTD + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ATLAS_SCIENTIFIC_EC + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_BOSCH_BME280 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_CAMPBELL_CLARI_VUE10 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_CAMPBELL_OBS3 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_DECAGON_CTD + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_DECAGON_ES2 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_EXTERNAL_VOLTAGE + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_MPL115A2 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_INSITURDO - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_INSITUTROOLSDI12A - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ACCULEVEL - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_NANOLEVEL - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_MAXBOTIX - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_DS18 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_MS5803 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_5TM - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_HYDROS21 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_TEROS11 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_PALEOTERRA - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_RAINI2C - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_TALLY - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_INA219 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_CYCLOPS - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_ANALOGEC - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y504 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y510 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y511 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y514 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y520 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y532 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y533 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y551 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y560 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_Y4000 - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 - sensorFlag: BUILD_SENSOR_DOPTO - publisherFlag: BUILD_PUB_MMW - - modemFlag: BUILD_MODEM_SIM7080 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_IN_SITU_RDO + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_INSITU_TROLL_SDI12A + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_KELLER_ACCULEVEL + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_KELLER_NANOLEVEL + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_MAX_BOTIX_SONAR + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_MAXIM_DS18 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_MEA_SPEC_MS5803 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_DECAGON_5TM + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_METER_HYDROS21 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_METER_TEROS11 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_PALEO_TERRA_REDOX + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_RAIN_COUNTER_I2C + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_TALLY_COUNTER_I2C + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_TI_INA219 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_TURNER_CYCLOPS + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y504 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y510 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y511 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y514 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y520 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y532 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y533 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y551 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y560 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_YOSEMITECH_Y4000 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_ZEBRA_TECH_D_OPTO + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_DREAMHOST - - modemFlag: BUILD_MODEM_SIM7080 + publisherFlag: BUILD_PUB_DREAM_HOST_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: NO_SENSORS - publisherFlag: BUILD_PUB_THINGSPEAK + publisherFlag: BUILD_PUB_THING_SPEAK_PUBLISHER steps: - uses: actions/checkout@v2.4.0 diff --git a/.gitignore b/.gitignore index 68c3034d5..bf63dcacd 100644 --- a/.gitignore +++ b/.gitignore @@ -84,13 +84,13 @@ __pycache__/ runDoxygen.bat docs/examples/* output_doxygen.log -doygen-run.log -mcss-doxy-output.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/copyFunctions.log -docs/documentExamples.log -docs/fixXmlExampleSections.log +docs/output_copyFunctions.log +docs/output_documentExamples.log +docs/output_fixSectionsInXml.log diff --git a/ChangeLog.md b/ChangeLog.md index 6743fdcea..50f18fa89 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,4 @@ -# Changelog +# ChangeLog All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) @@ -7,11 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 *** + ## [Unreleased] ### Changed - ### Added ### Removed @@ -32,6 +32,7 @@ We recommend a logger's real time clock always be set in UTC and then localized - **Breaking:** Renamed the YosemiTech Y550 COD sensor as Y551. See below. - Added a longer warm up time and removed some of the set-up to work with the ESP-IDF AT firmware versions >2.0 - Made sure that all example clock synchronization happens at noon instead of midnight. +- **Documentation:** Migrated to latest version of Doxygen (1.9.3). ### Added - **Sensor** Added support for the [YosemiTech Y551 COD Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/94.html), which makes a UV254 light absorption and translates it to estimates of Chemical Oxygen Demand (COD) (or Total Organic Carbon (TOC)) and Turbidity. @@ -69,6 +70,7 @@ For the SDI-12 sensors, I'm actually using this to make sure I'm getting the num *** ## [0.32.0] - 2021-11-19 + Reinstate support for AOSong DHT ### Changed @@ -82,6 +84,7 @@ Reinstate support for AOSong DHT *** ## [0.31.2] - 2021-11-03 + Fix build without AOSong DHT ### Fixed @@ -90,6 +93,7 @@ Fix build without AOSong DHT *** ## [0.31.0] - 2021-11-02 + Remove support for AOSong DHT ### Added @@ -102,6 +106,7 @@ Remove support for AOSong DHT *** ## [0.30.0] - 2021-07-06 + Remove support for SoftwareWire for Atlas sensors ### Changed @@ -122,6 +127,7 @@ As I think this feature was completely unused for the Atlas sensors and I see no *** ## [0.29.1] - 2021-07-01 + Fix YosemiTech Y533 ORP sensor outputs ### Fixed @@ -130,6 +136,7 @@ Fix YosemiTech Y533 ORP sensor outputs *** ## [0.29.0] - 2021-05-19 + Create a ModularSensors.h ### Changed @@ -144,6 +151,7 @@ This makes it much easiler to install and use the library from the Arduino CLI. *** ## [0.28.5] - 2021-05-11 + Duplicate and Rename Hydros 21 ### Added @@ -157,6 +165,7 @@ The addition was only made to stop complaints about typing in an older name. *** ## [0.28.4] - 2021-05-05 + SDI-12 Timing Sensor Customization ### Changed @@ -169,6 +178,7 @@ This was added to support conflicting delay needs; the RDO needed a short delay, *** ## [0.28.3] - 2021-03-24 + Valid version number ### Fixed @@ -177,6 +187,7 @@ Valid version number *** ## [0.28.01] - 2021-02-10 + Gigantic SDI-12 bug ### Fixed @@ -188,6 +199,7 @@ Gigantic SDI-12 bug *** ## [0.28.0] - 2021-02-10 + Add Support for Turner Cyclops ### Added @@ -203,6 +215,7 @@ Add Support for Turner Cyclops *** ## [0.27.8] - 2021-01-19 + Fix GitHub Action ### Fixed @@ -211,6 +224,7 @@ Fix GitHub Action *** ## [0.27.7] - 2021-01-19 + SDI-12 Bug Fix ### Fixed @@ -219,6 +233,7 @@ SDI-12 Bug Fix *** ## [0.27.6] - 2021-01-19 + Update Documentation ### Changed @@ -228,6 +243,7 @@ Update Documentation *** ## [0.27.5] - 2020-12-15 + Multiple new Sensors and Workflows ### Changed @@ -243,7 +259,7 @@ Multiple new Sensors and Workflows - **Sensor:** PaleoTerra Redox sensors - **Sensor:** Northern Widget Tally Counters - **Sensor:** simple analog electrical conductance sensors -- **Sensor:** InSitu RDO PRO-X rugged dissolved oxygen sensors +- **Sensor:** In-Situ RDO PRO-X rugged dissolved oxygen sensors - **Publisher:** Add Soracom/Ubidots as a data publisher - Migrated from Travis CI to Github Actions for continuous integration - Deprecated wiki, moving contents to docs folder where needed @@ -257,6 +273,7 @@ Multiple new Sensors and Workflows *** ## [0.25.0] - 2020-06-25 + Styling & Doxygen Code Documentation [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3908530.svg)](https://doi.org/10.5281/zenodo.3908530) @@ -284,6 +301,7 @@ For more details, see [Pull Request #309: The style sheet](https://github.com/En *** ## [0.24.1] - 2020-03-02 + Modem Restructuring [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3693784.svg)](https://doi.org/10.5281/zenodo.3693784) @@ -295,6 +313,7 @@ Modem Restructuring *** ## [0.23.13] - 2019-09-19 + More agressive attempts to set clock [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3451413.svg)](https://doi.org/10.5281/zenodo.3451413) @@ -310,6 +329,7 @@ More agressive attempts to set clock *** ## [0.23.11] - 2019-09-11 + Watchdogs and More [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3405562.svg)](https://doi.org/10.5281/zenodo.3405562) @@ -337,6 +357,7 @@ Watchdogs and More *** ## [0.22.5] - 2019-06-24 + Modem Simplification [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3255084.svg)](https://doi.org/10.5281/zenodo.3255084) @@ -380,6 +401,7 @@ Modem Simplification *** ## [0.21.4] - 2019-05-02 + Deep debug error ### Fixed @@ -388,6 +410,7 @@ Deep debug error *** ## [0.21.3] - 2019-05-02 + Minor Bugs and Simplified Debugging ### Added @@ -403,6 +426,7 @@ Minor Bugs and Simplified Debugging *** ## [0.21.2] - 2019-03-19 + Fix write to SD card ### Fixed @@ -411,6 +435,7 @@ Fix write to SD card *** ## [0.21.0] - 2019-03-06 + Support for all Atlas Scientific I2C sensors, compiler-safe begin functions [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2586200.svg)](https://doi.org/10.5281/zenodo.2586200) @@ -452,6 +477,7 @@ Support for all Atlas Scientific I2C sensors, compiler-safe begin functions *** ## [0.19.6] - 2019-02-27 + Modem Improvements & ADS1X15 Generalization [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2579301.svg)](https://doi.org/10.5281/zenodo.2579301) @@ -470,6 +496,7 @@ Modem Improvements & ADS1X15 Generalization *** ## [0.19.3] - 2019-01-15 + Bug fix and example re-working ### Changed @@ -481,6 +508,7 @@ Bug fix and example re-working *** ## [0.19.2] - 2018-12-22 + Decreased Data Consumption ### Changed @@ -495,6 +523,7 @@ Decreased Data Consumption *** ## [0.17.2] - 2018-11-27 + Major Update! **NOTE: THIS RELEASE DESTROYS BACKWARDS COMPATIBILITY!!** @@ -509,6 +538,7 @@ Major Update! *** ## [0.12.2] - 2018-09-25 + Calculated variables and bug fixes NOTE: This **THIS RELEASE DESTROYS BACKWARDS COMPATIBILITY!!** All `.ino` files will need to be updated to follow the updated examples. @@ -524,6 +554,7 @@ See PR #160 for a full list of improvements and fixes. *** ## [0.11.6] - 2018-05-11 + Fixed Longer Logger Intervals and Improved Documentation ### Changed @@ -537,6 +568,7 @@ Fixed Longer Logger Intervals and Improved Documentation *** ## [0.11.3] - 2018-05-03 + Added sensors and fixed timing bugs ### Changed @@ -564,6 +596,7 @@ Added sensors and fixed timing bugs *** ## [0.9.0] - 2018-04-17 + Timing Improvements ### Changed @@ -579,6 +612,7 @@ Timing Improvements *** ## [0.6.10] - 2018-02-26 + Fixes bugs in description and examples ### Fixed @@ -587,6 +621,7 @@ Fixes bugs in description and examples *** ## [0.6.9] - 2018-02-26 + Uniformity of missing values, averaging for all sensors ### Changed @@ -613,6 +648,7 @@ Uniformity of missing values, averaging for all sensors *** ## [0.3.0]-beta - 2017-06-07 + Beta Release ### Changed @@ -626,6 +662,7 @@ Beta Release *** ## [0.2.5]-beta - 2017-05-31 + Impoved setup functions ### Changed @@ -634,6 +671,7 @@ Impoved setup functions *** ## [0.2.4]-beta - 2017-05-17 + Another beta release ### Changed @@ -650,6 +688,7 @@ Another beta release *** ## [0.2.2]-beta - 2017-05-09 + Initial release Our first release of the modular sensors library to support easily logging data from a variety of environmental sensors and sending that data to the EnviroDIY data portal. @@ -695,3 +734,5 @@ Our first release of the modular sensors library to support easily logging data [0.2.5-beta]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.2.5-beta [0.2.4-beta]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.2.4-beta [0.2.2-beta]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.2.2-beta + +[//]: # ( @tableofcontents{XML:1} ) diff --git a/LICENSE.md b/LICENSE.md index b53292dbe..4f77081af 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,4 +1,4 @@ -## Software License Agreement (BSD-3 License) +# Software License Agreement (BSD-3 License) **Copyright (c) 2010-2017, Stroud Water Research Center (SWRC) and the EnviroDIY Development Team.** All rights reserved. diff --git a/README.md b/README.md index 86ae16f5a..7ea88dd7b 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,17 @@ -[//]: # ( @mainpage ModularSensors ) -# ModularSensors +# ModularSensors + ___ -[//]: # ( @section mainpage_intro The EnviroDIY ModularSensors Library ) -## The EnviroDIY ModularSensors Library +## The EnviroDIY ModularSensors Library If you're new to EnviroDIY, I suggest you check out the [Just Getting Started](https://envirodiy.github.io/ModularSensors/page_getting_started.html) section of the documentation! This Arduino library gives environmental sensors a common interface of functions for use with Arduino-compatible dataloggers, such as the EnviroDIY Mayfly. The ModularSensors library is specifically designed to support wireless, solar-powered environmental data logging applications, that is, to: -* Retrieve data from many physical sensors; -* Save that data to a SD memory card; -* Transmit that data wirelessly to a web server; and -* Put the processor, sensors and all other peripherals to sleep between readings to conserve power. +- Retrieve data from many physical sensors; +- Save that data to a SD memory card; +- Transmit that data wirelessly to a web server; and +- **Put the processor, sensors and all other peripherals to sleep between readings to conserve power.** The ModularSensors library coordinates these tasks by "wrapping" native sensor libraries into a common interface of functions and returns. These [wrapper functions](https://en.wikipedia.org/wiki/Wrapper_function) serve to harmonize and simplify the process of iterating through and logging data from a diverse set of sensors and variables. @@ -36,10 +35,9 @@ There is extensive documentation available in the [ModularSensors github pages]( [//]: # ( End GitHub Only ) -[//]: # ( @section mainpage_supported_sensors Supported Sensors ) -## Supported Sensors +## Supported Sensors -For some generalized information about attaching sensors to an Arduino style board, see the [Sensor Notes page](https://envirodiy.github.io/ModularSensors/page_sensor_notes.html) +For some generalized information about attaching sensors to an Arduino style board, see the [Sensor Notes page](https://envirodiy.github.io/ModularSensors/page_sensor_notes.html). - [Processor Metrics: battery voltage, free RAM, sample count](https://envirodiy.github.io/ModularSensors/group__sensor__processor.html) - [Maxim DS3231: real time clock](https://envirodiy.github.io/ModularSensors/group__sensor__ds3231.html) @@ -92,8 +90,7 @@ For some generalized information about attaching sensors to an Arduino style boa - [Zebra-Tech D-Opto: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__dopto.html) -[//]: # ( @section mainpage_data_receivers Data Endpoints ) -## Data Endpoints +## Data Endpoints Within ModularSensors, the "dataPublisher" objects add the functionality to send data to remote web services. The currently supported services are the [Monitor My Watershed data portal](http://data.envirodiy.org/), [ThingSpeak](https://thingspeak.com/), and the [Ubidots IoT platform](https://ubidots.com). @@ -105,8 +102,7 @@ The currently supported services are the [Monitor My Watershed data portal](http [//]: # ( @todo Page on Data Endpoints ) -[//]: # ( @section mainpage_modems Supported Cellular/Wifi Modules ) -## Supported Cellular/Wifi Modules: +## Supported Cellular/Wifi Modules: For information common to all modems and for tables of the proper class, baud rate, and pins to uses, see the [Modem Notes page](https://envirodiy.github.io/ModularSensors/page_modem_notes.html). @@ -126,8 +122,7 @@ For information common to all modems and for tables of the proper class, baud ra - u-blox 2G, 3G, and 4G, including the [Sodaq 3GBee](https://envirodiy.github.io/ModularSensors/group__modem__ubee__3g.html) -[//]: # ( @section mainpage_contributing Contributing ) -## Contributing +## Contributing Open an [issue](https://github.com/EnviroDIY/ModularSensors/issues) to suggest and discuss potential changes/additions. Feel free to open issues about any bugs you find or any sensors you would like to have added. @@ -137,16 +132,14 @@ This library is built to fully take advantage of Objecting Oriented Programing ( There is _extensive_ documentation on our [github pages](https://envirodiy.github.io/ModularSensors/index.html) and an _enormous_ number of comments and debugging printouts in the code itself to help you get going. -[//]: # ( @section mainpage_license License ) -## License +## License Software sketches and code are released under the BSD 3-Clause License -- See [LICENSE.md](https://github.com/EnviroDIY/ModularSensors/blob/master/LICENSE.md) file for details. Documentation is licensed as [Creative Commons Attribution-ShareAlike 4.0](https://creativecommons.org/licenses/by-sa/4.0/) (CC-BY-SA) copyright. Hardware designs shared are released, unless otherwise indicated, under the [CERN Open Hardware License 1.2](http://www.ohwr.org/licenses/cern-ohl/v1.2) (CERN_OHL). -[//]: # ( @section mainpage_acknowledgments Acknowledgments ) -## Acknowledgments +## Acknowledgments [EnviroDIY](http://envirodiy.org/)™ is presented by the Stroud Water Research Center, with contributions from a community of enthusiasts sharing do-it-yourself ideas for environmental science and monitoring. [Sara Damiano](https://github.com/SRGDamia1) is the primary developer of the EnviroDIY ModularSensors library, with input from many [other contributors](https://github.com/EnviroDIY/ModularSensors/graphs/contributors). @@ -157,3 +150,20 @@ This project has benefited from the support from the following funders: * US Environmental Protection Agency (EPA) * National Science Foundation, awards [EAR-0724971](http://www.nsf.gov/awardsearch/showAward?AWD_ID=0724971), [EAR-1331856](http://www.nsf.gov/awardsearch/showAward?AWD_ID=1331856), [ACI-1339834](http://www.nsf.gov/awardsearch/showAward?AWD_ID=1339834) * Stroud Water Research Center endowment + + +[//]: # ( @m_innerpage{page_getting_started} ) + +[//]: # ( @m_innerpage{page_faq} ) + +[//]: # ( @m_innerpage{page_other_notes} ) + +[//]: # ( @m_innerpage{page_the_examples} ) + +[//]: # ( @m_innerpage{license_software-license-agreement-bsd-3-license} ) + +[//]: # ( @m_innerpage{change_log} ) + +[//]: # ( @m_innerpage{todo} ) + +[//]: # ( @m_innerpage{deprecated} ) diff --git a/build-menu-configurations.ps1 b/build-menu-configurations.ps1 index eb7d8a7a7..eb5e9d0f4 100644 --- a/build-menu-configurations.ps1 +++ b/build-menu-configurations.ps1 @@ -29,18 +29,18 @@ $pioCommand = "pio run --project-conf=""continuous_integration/platformio.ini"" $pioCommand += ';$?' $modemFlags = @(` - 'BUILD_MODEM_XBEE_CELLULAR', ` - 'BUILD_MODEM_XBEE_LTE_B', ` - 'BUILD_MODEM_XBEE_3G_B', ` - 'BUILD_MODEM_XBEE_WIFI', ` - 'BUILD_MODEM_ESP8266', ` - 'BUILD_MODEM_BG96', ` - 'BUILD_MODEM_MONARCH', ` - 'BUILD_MODEM_SIM800', ` - 'BUILD_MODEM_SIM7000', ` - 'BUILD_MODEM_S2GB', ` - 'BUILD_MODEM_UBEE_R410M', ` - 'BUILD_MODEM_UBEE_U201') + 'BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT', ` + 'BUILD_MODEM_DIGI_XBEE_LTE_BYPASS', ` + 'BUILD_MODEM_DIGI_XBEE_3G_BYPASS', ` + 'BUILD_MODEM_DIGI_XBEE_WIFI', ` + 'BUILD_MODEM_ESPRESSIF_ESP8266', ` + 'BUILD_MODEM_QUECTEL_BG96', ` + 'BUILD_MODEM_SEQUANS_MONARCH', ` + 'BUILD_MODEM_SIM_COM_SIM800', ` + 'BUILD_MODEM_SIM_COM_SIM7000', ` + 'BUILD_MODEM_SODAQ2_G_BEE_R6', ` + 'BUILD_MODEM_SODAQ_UBEE_R410M', ` + 'BUILD_MODEM_SODAQ_UBEE_U201') Foreach ($modemFlag in $modemFlags) { @@ -72,47 +72,48 @@ Foreach ($modemFlag in $modemFlags) } $sensorFlags = @(` - 'BUILD_SENSOR_AM2315', ` - # 'BUILD_SENSOR_DHT', ` - 'BUILD_SENSOR_SQ212', ` - 'BUILD_SENSOR_ATLASCO2', ` - 'BUILD_SENSOR_ATLASDO', ` - 'BUILD_SENSOR_ATLASORP', ` - 'BUILD_SENSOR_ATLASPH', ` - 'BUILD_SENSOR_ATLASRTD', ` - 'BUILD_SENSOR_ATLASEC', ` - 'BUILD_SENSOR_BME280', ` - 'BUILD_SENSOR_OBS3', ` - 'BUILD_SENSOR_ES2', ` - 'BUILD_SENSOR_VOLTAGE', ` + 'BUILD_SENSOR_AO_SONG_AM2315', ` + 'BUILD_SENSOR_AO_SONG_DHT', ` + 'BUILD_SENSOR_APOGEE_SQ212', ` + 'BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2', ` + 'BUILD_SENSOR_ATLAS_SCIENTIFIC_DO', ` + 'BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP', ` + 'BUILD_SENSOR_ATLAS_SCIENTIFIC_PH', ` + 'BUILD_SENSOR_ATLAS_SCIENTIFIC_RTD', ` + 'BUILD_SENSOR_ATLAS_SCIENTIFIC_EC', ` + 'BUILD_SENSOR_BOSCH_BME280', ` + 'BUILD_SENSOR_CAMPBELL_OBS3', ` + 'BUILD_SENSOR_DECAGON_ES2', ` + 'BUILD_SENSOR_EXTERNAL_VOLTAGE', ` 'BUILD_SENSOR_MPL115A2', ` - 'BUILD_SENSOR_INSITURDO', ` - 'BUILD_SENSOR_INSITUTROOLSDI12A', ` - 'BUILD_SENSOR_ACCULEVEL', ` - 'BUILD_SENSOR_NANOLEVEL', ` - 'BUILD_SENSOR_MAXBOTIX', ` - 'BUILD_SENSOR_DS18', ` - 'BUILD_SENSOR_MS5803', ` - 'BUILD_SENSOR_5TM', ` - 'BUILD_SENSOR_CTD', ` - 'BUILD_SENSOR_TEROS11', ` - 'BUILD_SENSOR_PALEOTERRA', ` - 'BUILD_SENSOR_RAINI2C', ` - 'BUILD_SENSOR_TALLY', ` - 'BUILD_SENSOR_INA219', ` - 'BUILD_SENSOR_CYCLOPS', ` - 'BUILD_SENSOR_ANALOGEC', ` - 'BUILD_SENSOR_Y504', ` - 'BUILD_SENSOR_Y510', ` - 'BUILD_SENSOR_Y511', ` - 'BUILD_SENSOR_Y514', ` - 'BUILD_SENSOR_Y520', ` - 'BUILD_SENSOR_Y532', ` - 'BUILD_SENSOR_Y533', ` - 'BUILD_SENSOR_Y551', ` - 'BUILD_SENSOR_Y560', ` - 'BUILD_SENSOR_Y4000', ` - 'BUILD_SENSOR_DOPTO') + 'BUILD_SENSOR_IN_SITU_RDO', ` + 'BUILD_SENSOR_INSITU_TROLL_SDI12A', ` + 'BUILD_SENSOR_KELLER_ACCULEVEL', ` + 'BUILD_SENSOR_KELLER_NANOLEVEL', ` + 'BUILD_SENSOR_MAX_BOTIX_SONAR', ` + 'BUILD_SENSOR_MAXIM_DS18', ` + 'BUILD_SENSOR_MEA_SPEC_MS5803', ` + 'BUILD_SENSOR_DECAGON_5TM', ` + 'BUILD_SENSOR_DECAGON_CTD', ` + 'BUILD_SENSOR_METER_TEROS11', ` + 'BUILD_SENSOR_PALEO_TERRA_REDOX', ` + 'BUILD_SENSOR_RAIN_COUNTER_I2C', ` + 'BUILD_SENSOR_TALLY_COUNTER_I2C', ` + 'BUILD_SENSOR_SENSIRION_SHT4X', ` + 'BUILD_SENSOR_TI_INA219', ` + 'BUILD_SENSOR_TURNER_CYCLOPS', ` + 'BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY', ` + 'BUILD_SENSOR_YOSEMITECH_Y504', ` + 'BUILD_SENSOR_YOSEMITECH_Y510', ` + 'BUILD_SENSOR_YOSEMITECH_Y511', ` + 'BUILD_SENSOR_YOSEMITECH_Y514', ` + 'BUILD_SENSOR_YOSEMITECH_Y520', ` + 'BUILD_SENSOR_YOSEMITECH_Y532', ` + 'BUILD_SENSOR_YOSEMITECH_Y533', ` + 'BUILD_SENSOR_YOSEMITECH_Y551', ` + 'BUILD_SENSOR_YOSEMITECH_Y560', ` + 'BUILD_SENSOR_YOSEMITECH_Y4000', ` + 'BUILD_SENSOR_ZEBRA_TECH_D_OPTO') Foreach ($sensorFlag in $sensorFlags) { @@ -126,7 +127,7 @@ Foreach ($sensorFlag in $sensorFlags) Write-Host "----------------------------------------------------------------------------" -ForegroundColor Cyan Write-Host "----------------------------------------------------------------------------" -ForegroundColor Cyan $originalMenu = Get-Content -Path "examples/menu_a_la_carte/menu_a_la_carte.ino" -Encoding UTF8 -Raw - $newHeading = "#define BUILD_MODEM_XBEE_CELLULAR`n#define BUILD_TEST_PRE_NAMED_VARS`n#define $sensorFlag`n" + $newHeading = "#define BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT`n#define BUILD_TEST_PRE_NAMED_VARS`n#define $sensorFlag`n" $newHeading += $originalMenu $newHeading | Add-Content -Path $tempFile -Encoding UTF8 @@ -144,9 +145,9 @@ Foreach ($sensorFlag in $sensorFlags) } $publisherFlag = @(` - 'BUILD_PUB_MMW', ` - 'BUILD_PUB_DREAMHOST', ` - 'BUILD_PUB_THINGSPEAK') + 'BUILD_PUB_ENVIRO_DIY_PUBLISHER', ` + 'BUILD_PUB_DREAM_HOST_PUBLISHER', ` + 'BUILD_PUB_THING_SPEAK_PUBLISHER') Foreach ($publisherFlag in $publisherFlags) { @@ -160,7 +161,7 @@ Foreach ($publisherFlag in $publisherFlags) Write-Host "----------------------------------------------------------------------------" -ForegroundColor Cyan Write-Host "----------------------------------------------------------------------------" -ForegroundColor Cyan $originalMenu = Get-Content -Path "examples/menu_a_la_carte/menu_a_la_carte.ino" -Encoding UTF8 -Raw - $newHeading = "#define BUILD_MODEM_XBEE_CELLULAR`n#define BUILD_TEST_PRE_NAMED_VARS`n#define $publisherFlag`n" + $newHeading = "#define BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT`n#define BUILD_TEST_PRE_NAMED_VARS`n#define $publisherFlag`n" $newHeading += $originalMenu $newHeading | Add-Content -Path $tempFile -Encoding UTF8 diff --git a/continuous_integration/generate-documentation.sh b/continuous_integration/generate-documentation.sh index 63645a653..6a6b2d995 100644 --- a/continuous_integration/generate-documentation.sh +++ b/continuous_integration/generate-documentation.sh @@ -16,9 +16,9 @@ python $TRAVIS_BUILD_DIR/code_docs/m.css/css/postprocess.py "m-EnviroDIY.css" "m python $TRAVIS_BUILD_DIR/code_docs/m.css/css/postprocess.py "m-EnviroDIY.css" "m-theme-EnviroDIY.css" "m-documentation.css" --no-import -o "m-EnviroDIY.documentation.compiled.css" cp $TRAVIS_BUILD_DIR/code_docs/m.css/css/EnviroDIY/m-EnviroDIY+documentation.compiled.css $TRAVIS_BUILD_DIR/code_docs/ModularSensors/docs/css -echo "\n\e[32mCreating dox files from example read-me files\e[0m" -cd $TRAVIS_BUILD_DIR/code_docs/ModularSensors/docs -python documentExamples.py +# echo "\n\e[32mCreating dox files from example read-me files\e[0m" +# cd $TRAVIS_BUILD_DIR/code_docs/ModularSensors/docs +# python documentExamples.py echo "\n\e[32mCurrent Doxygen version...\e[0m" $TRAVIS_BUILD_DIR/doxygen-src/build/bin/doxygen -v 2>&1 @@ -28,12 +28,12 @@ echo "\n\e[32mGenerating Doxygen code documentation...\e[0m" $TRAVIS_BUILD_DIR/doxygen-src/build/bin/doxygen Doxyfile 2>&1 | tee doxygen.log echo "\n\e[32mFixing errant xml section names in examples as generated by Doxygen...\e[0m" -python fixXmlExampleSections.py +python fixSectionsInXml.py # echo "\n\e[32mFixing copied function documentation in group documentation\e[0m" # python fixFunctionsInGroups.py -python $TRAVIS_BUILD_DIR/code_docs/m.css/documentation/doxygen.py "mcss-conf.py" --no-doxygen --output output_mcss.log --templates "$TRAVIS_BUILD_DIR/code_docs/m.css/documentation/templates/EnviroDIY" --debug > mcss-doxy-output.log +python $TRAVIS_BUILD_DIR/code_docs/m.css/documentation/doxygen.py "mcss-conf.py" --no-doxygen --output output_mcss.log --templates "$TRAVIS_BUILD_DIR/code_docs/m.css/documentation/templates/EnviroDIY" --debug echo "\n\e[32mCopying function documentation\e[0m" python copyFunctions.py \ No newline at end of file diff --git a/continuous_integration/pre-commit-generate-build-matrix.py b/continuous_integration/pre-commit-generate-build-matrix.py index ad5e3a5d8..10cd7bebf 100644 --- a/continuous_integration/pre-commit-generate-build-matrix.py +++ b/continuous_integration/pre-commit-generate-build-matrix.py @@ -19,13 +19,13 @@ # set flags all_modem_flags = [ - "BUILD_MODEM_SIM7080", + "BUILD_MODEM_SIM_COM_SIM7080", ] all_sensor_flags = [ "NO_SENSORS", ] all_publisher_flags = [ - "BUILD_PUB_MMW", + "BUILD_PUB_ENVIRO_DIY_PUBLISHER", ] #%% Read flags out of the menu example diff --git a/docs/Doxyfile b/docs/Doxyfile index 7c24bab51..fab21680c 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -1,4 +1,4 @@ -# Doxyfile 1.9.2 +# Doxyfile 1.9.3 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -162,7 +162,7 @@ FULL_PATH_NAMES = YES # will be relative from the directory where doxygen is started. # This tag requires that the tag FULL_PATH_NAMES is set to YES. -STRIP_FROM_PATH = ../src +STRIP_FROM_PATH = .. # The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the # path mentioned in the documentation of a class, which tells the reader which @@ -276,9 +276,11 @@ ALIASES = "license=@par License:\n" \ "m_enum_values_as_keywords=@xmlonly@endxmlonly" \ "m_since{2}=@since @m_class{m-label m-success m-flat} @ref changelog-\1-\2 \"since v\1.\2\"" \ "m_deprecated_since{2}=@since deprecated in v\1.\2 @deprecated" \ - "menulink{1}=[menu a la carte](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_\1)" \ - "menusnip{1}=@snippet{lineno} menu_a_la_carte.ino \1 ^^ ^^ " + "menulink{1}=[menu a la carte](@ref menu_walk_\1)" \ + "menusnip{1}=@snippet{lineno} menu_a_la_carte.ino \1 ^^ ^^ " \ + "m_innerpage{1}=@xmlonly @endxmlonly" + # "menulink{1}=[menu a la carte](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_\1)" \ # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -873,7 +875,10 @@ WARN_FORMAT = "$file:$line: $text" # The WARN_LOGFILE tag can be used to specify a file to which warning and error # messages should be written. If left blank the output is written to standard -# error (stderr). +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). WARN_LOGFILE = output_doxygen.log @@ -887,9 +892,11 @@ WARN_LOGFILE = output_doxygen.log # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ../README.md \ - ../src \ - ../docs +# INPUT = ../README.md \ +# ../src \ +# ../examples \ +# ../docs +INPUT = .. # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -954,7 +961,8 @@ RECURSIVE = YES EXCLUDE = ../src/ReadMe.md \ ../examples/logger_test \ ../examples/logger_test_nonew \ - ../examples/YosemitechDO + ../examples/YosemitechDO \ + ../src/sensors/table.md # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -976,7 +984,7 @@ EXCLUDE_PATTERNS = # (namespaces, classes, functions, etc.) that should be excluded from the # output. The symbol name can be a fully qualified name, a word, or if the # wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test +# ANamespace::AClass, ANamespace::*Test # # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories use the pattern */test/* @@ -1400,6 +1408,13 @@ GENERATE_DOCSET = NO DOCSET_FEEDNAME = "Doxygen generated docs" +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + # This tag specifies a string that should uniquely identify the documentation # set bundle. This should be a reverse domain-name style string, e.g. # com.mycompany.MyDocSet. Doxygen will append .docset to the name. @@ -1604,7 +1619,7 @@ GENERATE_TREEVIEW = YES # area (value NO) or if it should extend to the full height of the window (value # YES). Setting this to YES gives a layout similar to # https://docs.readthedocs.io with more room for contents, but less room for the -# project logo, title, and description. If either GENERATOR_TREEVIEW or +# project logo, title, and description. If either GENERATE_TREEVIEW or # DISABLE_INDEX is set to NO, this option has no effect. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1635,6 +1650,13 @@ TREEVIEW_WIDTH = 200 EXT_LINKS_IN_WINDOW = NO +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + # If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg # tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see # https://inkscape.org) to generate formulas as SVG images instead of PNGs for @@ -2182,6 +2204,10 @@ DOCBOOK_OUTPUT = docbook GENERATE_AUTOGEN_DEF = NO +#--------------------------------------------------------------------------- +# Configuration options related to Sqlite3 output +#--------------------------------------------------------------------------- + #--------------------------------------------------------------------------- # Configuration options related to the Perl module output #--------------------------------------------------------------------------- @@ -2400,15 +2426,6 @@ EXTERNAL_PAGES = YES # Configuration options related to the dot tool #--------------------------------------------------------------------------- -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. @@ -2465,11 +2482,14 @@ DOT_FONTSIZE = 10 DOT_FONTPATH = -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. +# If the CLASS_GRAPH tag is set to YES (or GRAPH) then doxygen will generate a +# graph for each documented class showing the direct and indirect inheritance +# relations. In case HAVE_DOT is set as well dot will be used to draw the graph, +# otherwise the built-in generator will be used. If the CLASS_GRAPH tag is set +# to TEXT the direct and indirect inheritance relations will be shown as texts / +# links. +# Possible values are: NO, YES, TEXT and GRAPH. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. CLASS_GRAPH = YES @@ -2568,7 +2588,7 @@ INCLUDED_BY_GRAPH = YES # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALL_GRAPH = NO +CALL_GRAPH = YES # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller # dependency graph for every global function or class method. @@ -2580,7 +2600,7 @@ CALL_GRAPH = NO # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALLER_GRAPH = NO +CALLER_GRAPH = YES # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical # hierarchy of all classes instead of a textual one. @@ -2598,6 +2618,13 @@ GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES +# The DIR_GRAPH_MAX_DEPTH tag can be used to limit the maximum number of levels +# of child directories generated in directory dependency graphs by dot. +# Minimum value: 1, maximum value: 25, default value: 1. +# This tag requires that the tag DIRECTORY_GRAPH is set to YES. + +DIR_GRAPH_MAX_DEPTH = 5 + # The DOT_IMAGE_FORMAT tag can be used to set the image format of the images # generated by dot. For an explanation of the image formats see the section # output formats in the documentation of the dot tool (Graphviz (see: @@ -2651,10 +2678,10 @@ MSCFILE_DIRS = DIAFILE_DIRS = # When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. +# path where java can find the plantuml.jar file or to the filename of jar file +# to be used. If left blank, it is assumed PlantUML is not used or called during +# a preprocessing step. Doxygen will generate a warning when it encounters a +# \startuml command in this case and will not generate output for the diagram. PLANTUML_JAR_PATH = @@ -2716,6 +2743,8 @@ DOT_MULTI_TARGETS = NO # If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page # explaining the meaning of the various boxes and arrows in the dot generated # graphs. +# Note: This tag requires that UML_LOOK isn't set, i.e. the doxygen internal +# graphical representation for inheritance and collaboration diagrams is used. # The default value is: YES. # This tag requires that the tag HAVE_DOT is set to YES. diff --git a/docs/DoxygenLayout.xml b/docs/DoxygenLayout.xml index d94079f53..05380cd27 100644 --- a/docs/DoxygenLayout.xml +++ b/docs/DoxygenLayout.xml @@ -92,7 +92,7 @@ - + @@ -135,7 +135,7 @@ - + diff --git a/docs/FAQ/Arduino-Streams.md b/docs/FAQ/Arduino-Streams.md index 527bada18..2bef4f8bd 100644 --- a/docs/FAQ/Arduino-Streams.md +++ b/docs/FAQ/Arduino-Streams.md @@ -1,15 +1,14 @@ -[//]: # ( @page page_arduino_streams Arduino Streams and Software Serial ) -## Notes on Arduino Streams and Software Serial +# Notes on Arduino Streams and Software Serial [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) - [Notes on Arduino Streams and Software Serial](#notes-on-arduino-streams-and-software-serial) -- [Hardware Serial](#hardware-serial) -- [AltSoftSerial](#altsoftserial) -- [NeoSWSerial](#neoswserial) -- [Neutered SoftwareSerial](#neutered-softwareserial) -- [SAMD SERCOMs](#samd-sercoms) + - [Hardware Serial](#hardware-serial) + - [AltSoftSerial](#altsoftserial) + - [NeoSWSerial](#neoswserial) + - [Neutered SoftwareSerial](#neutered-softwareserial) + - [SAMD SERCOMs](#samd-sercoms) [//]: # ( End GitHub Only ) @@ -33,8 +32,7 @@ This is not a bug that will be fixed. See the section on [Processor/Board Compatibility](https://envirodiy.github.io/ModularSensors/page_processor_compatibility.html) for more specific notes on what serial ports are available on the various supported processors. -[//]: # ( @section page_arduino_hw Hardware Serial ) -## Hardware Serial +## Hardware Serial For stream communication, **hardware serial** should _always_ be your first choice, if your processor has enough hardware serial ports. Hardware serial ports are the most stable and have the best performance of any of the other streams. @@ -51,8 +49,7 @@ HardwareSerial* streamName = &Serial; ``` -[//]: # ( @section page_arduino_altss AltSoftSerial ) -## AltSoftSerial +## AltSoftSerial If the [proper pins](https://www.pjrc.com/teensy/td_libs_AltSoftSerial.html) are available, **[AltSoftSerial](https://github.com/PaulStoffregen/AltSoftSerial)** by Paul Stoffregen is also superior to SoftwareSerial, especially at slow baud rates. AltSoftSerial is compatible with ModularSensors "out of the box" - that is, you don't need and modifications to the library or extra defines or build flags to make it work. @@ -70,8 +67,7 @@ AltSoftSerial streamName. ``` -[//]: # ( @section page_arduino_neosw NeoSWSerial ) -## NeoSWSerial +## NeoSWSerial Another possible serial port emulator is [NeoSWSerial](https://github.com/SRGDamia1/NeoSWSerial). While not as stable as AltSoftSerial, it supports using any pin with pin change interrupts for communication. @@ -112,8 +108,7 @@ enableInterrupt(rx_pin, neoSSerial1ISR, CHANGE); ``` -[//]: # ( @section page_arduino_ss Neutered SoftwareSerial ) -## Neutered SoftwareSerial +## Neutered SoftwareSerial [The EnviroDIY modified version of SoftwareSerial](https://github.com/EnviroDIY/SoftwaterSerial_ExternalInts) removes direct interrupt control from the SoftwareSerial library, making it dependent on another interrupt library, but able to be compiled with ModularSensors. This is, _by far_, the _least_ stable serial port option and should only be used on sensors that are not very picky about the quality of the serial stream or that only require one-way communication (ie, only posting data rather than needing to receive commands). @@ -140,8 +135,7 @@ enableInterrupt(rx_pin, SoftwareSerial_ExtInts::handle_interrupt, CHANGE); ``` -[//]: # ( @section page_arduino_samd SAMD SERCOMs ) -## SAMD SERCOMs +## SAMD SERCOMs Example code for creating more serial ports on an Adafruit feather M0 using the SERCOMs is available [in the menu a la carte example](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_samd_serial_ports). diff --git a/docs/FAQ/Code-Debugging.md b/docs/FAQ/Code-Debugging.md index 135512666..7fd708768 100644 --- a/docs/FAQ/Code-Debugging.md +++ b/docs/FAQ/Code-Debugging.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_code_debugging In-Library Debugging ) -## In-Library Debugging +# In-Library Debugging For intense _code_ debugging for any individual component of the library (sensor communication, modem communication, variable array functions, etc), open the source file header (\*.h), for that component. Find the line `// #define DEBUGGING_SERIAL_OUTPUT xxxxx`, where xxxxx is the name of a serial output (ie, Serial or USBSerial). diff --git a/docs/FAQ/Deceasing-Memory-Use.md b/docs/FAQ/Deceasing-Memory-Use.md index 8c11cf43b..65d4f18a6 100644 --- a/docs/FAQ/Deceasing-Memory-Use.md +++ b/docs/FAQ/Deceasing-Memory-Use.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_memory_use Decreasing Memory Footprint ) -## Decreasing Memory Footprint +# Decreasing Memory Footprint There are things you could do to decrease memory use. diff --git a/docs/FAQ/Developer-Setup.md b/docs/FAQ/Developer-Setup.md index c155f6a69..3d9d25e00 100644 --- a/docs/FAQ/Developer-Setup.md +++ b/docs/FAQ/Developer-Setup.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_for_developers Developer Setup ) -## Developer Setup +# Developer Setup If you want to fork this repository and work with it, you'll need to set PlatformIO up a bit differently than you would to merely use this library. diff --git a/docs/FAQ/Power-Parasites.md b/docs/FAQ/Power-Parasites.md index 345e0920e..5d7c907c5 100644 --- a/docs/FAQ/Power-Parasites.md +++ b/docs/FAQ/Power-Parasites.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_power_parasites Power Draw over Data Lines ) -## Power Draw over Data Lines +# Power Draw over Data Lines When deploying a logger out into the wild and depending on only battery or solar charging, getting the power draw from sensors to be as low as possible is crucial. This library assumes that the main power/Vcc supply to each sensor can be turned on by setting its powerPin high and off by setting its powerPin low. diff --git a/docs/FAQ/Processor Compatibility.md b/docs/FAQ/Processor-Compatibility.md similarity index 87% rename from docs/FAQ/Processor Compatibility.md rename to docs/FAQ/Processor-Compatibility.md index 85ac52c00..fba44fccb 100644 --- a/docs/FAQ/Processor Compatibility.md +++ b/docs/FAQ/Processor-Compatibility.md @@ -1,8 +1,20 @@ -[//]: # ( @page page_processor_compatibility Processor Compatibility ) -## Processor Compatibility +# Processor Compatibility -[//]: # ( @section processor_1284p AtMega1284p ([EnviroDIY Mayfly, Sodaq Mbili, Mighty 1284) ) -### AtMega1284p ([EnviroDIY Mayfly](https://envirodiy.org/mayfly/), Sodaq Mbili, Mighty 1284) +[//]: # ( @tableofcontents ) + +[//]: # ( Start GitHub Only ) +- [Processor Compatibility](#processor-compatibility) + - [AtMega1284p (EnviroDIY Mayfly, Sodaq Mbili, Mighty 1284)](#atmega1284p-envirodiy-mayfly-sodaq-mbili-mighty-1284) + - [AtSAMD21 (Arduino Zero, Adafruit Feather M0, Sodaq Autonomo)](#atsamd21-arduino-zero-adafruit-feather-m0-sodaq-autonomo) + - [AtMega2560 (Arduino Mega)](#atmega2560-arduino-mega) + - [AtMega644p (Sanguino)](#atmega644p-sanguino) + - [AtMega328p (Arduino Uno, Duemilanove, LilyPad, Mini, Seeeduino Stalker, etc)](#atmega328p-arduino-uno-duemilanove-lilypad-mini-seeeduino-stalker-etc) + - [AtMega32u4 (Arduino Leonardo/Micro, Adafruit Flora/Feather, etc)](#atmega32u4-arduino-leonardomicro-adafruit-florafeather-etc) + - [Unsupported Processors](#unsupported-processors) + +[//]: # ( End GitHub Only ) + +## AtMega1284p ([EnviroDIY Mayfly](https://envirodiy.org/mayfly/), Sodaq Mbili, Mighty 1284) The [EnviroDIY Mayfly](https://envirodiy.org/mayfly/) _is_ the test board for this library. _Everything_ is designed to work with this processor. @@ -28,8 +40,7 @@ Pin 12 should not be used while using AltSoftSerial on the Mighty 1284. - Any digital pin can be used with NeoSWSerial, SoftwareSerial_ExtInts, or SDI-12. ___ -[//]: # ( @section processor_samd21 AtSAMD21 (Arduino Zero, Adafruit Feather M0, Sodaq Autonomo) ) -### AtSAMD21 (Arduino Zero, Adafruit Feather M0, Sodaq Autonomo) +## AtSAMD21 (Arduino Zero, Adafruit Feather M0, Sodaq Autonomo) Fully supported [Datasheet Summary](https://github.com/EnviroDIY/ModularSensors/wiki/Processor-Datasheets/Atmel-SAMD21-Datasheet-Summary.pdf) @@ -64,8 +75,7 @@ Otherwise, you will have to rely on lights on your alert pin or your modem to ve Turn off the debugging and double-tap to reset and reprogram if this happens. ___ -[//]: # ( @section processor_mega AtMega2560 (Arduino Mega) ) -### AtMega2560 (Arduino Mega) +## AtMega2560 (Arduino Mega) Should be fully functional, but untested. - An external DS3231 or DS3232 RTC is required. @@ -78,8 +88,7 @@ Pins 44 and 45 cannot be used while using AltSoftSerial on the AtMega2560. - Pins 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), and A15 (69) can be used with NeoSWSerial, SoftwareSerial_ExtInts, or SDI-12. ___ -[//]: # ( @section processor_664p AtMega644p (Sanguino) ) -### AtMega644p (Sanguino) +## AtMega644p (Sanguino) Should be fully functional, but untested. @@ -94,8 +103,7 @@ Pin 12 cannot be used while using AltSoftSerial on the AtMega644p. - Any digital pin can be used with NeoSWSerial, SoftwareSerial_ExtInts, or SDI-12. ___ -[//]: # ( @section processor_uno AtMega328p (Arduino Uno, Duemilanove, LilyPad, Mini, Seeeduino Stalker, etc) ) -### AtMega328p (Arduino Uno, Duemilanove, LilyPad, Mini, Seeeduino Stalker, etc) +## AtMega328p (Arduino Uno, Duemilanove, LilyPad, Mini, Seeeduino Stalker, etc) All functions are supported, but processor doesn't have sufficient power to use all of the functionality of the library. You will only be able to use a small number of sensors at one time and may not be able to log data. @@ -111,8 +119,7 @@ Pin 10 cannot be used while using AltSoftSerial on the AtMega328p. - Any digital pin can be used with NeoSWSerial, SoftwareSerial_ExtInts, or SDI-12. ___ -[//]: # ( @section processor_32u4 AtMega32u4 (Arduino Leonardo/Micro, Adafruit Flora/Feather, etc) ) -### AtMega32u4 (Arduino Leonardo/Micro, Adafruit Flora/Feather, etc) +## AtMega32u4 (Arduino Leonardo/Micro, Adafruit Flora/Feather, etc) All functions are supported, but processor doesn't have sufficient power to use all of the functionality of the library. You will only be able to use a small number of sensors at one time and may not be able to log data. @@ -134,8 +141,7 @@ If you need to debug, I recommend using a serial port monitor like Tera Term whi Otherwise, you will have to rely on lights on your alert pin or your modem to verify the processor is waking/sleeping properly. ___ -[//]: # ( @section processor_unsupported Unsupported Processors ) -### Unsupported Processors +## Unsupported Processors - **ESP8266/ESP32** - Supported _only_ as a communications module (modem) with the default AT command firmware, not supported as an independent controller - **AtSAM3X (Arduino Due)** - Unsupported at this time due to clock and sleep issues. diff --git a/docs/General-Sensor-Notes.md b/docs/General-Sensor-Notes.md index 983839ebb..b7dac75da 100644 --- a/docs/General-Sensor-Notes.md +++ b/docs/General-Sensor-Notes.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_sensor_notes Notes about Sensors ) -# Notes about Sensors +# Notes about Sensors There are a number of sensors supported by this library. Depending on the sensor, it may communicate with the Arduino board using as a serial peripheral interface (SPI), inter-integrated circuit (I2C, also called "Wire," "Two Wire", or "TWI"), or some type of universal synchronous/asynchronous receiver/transmitter (UART/USART, or simply "serial") protocol. @@ -11,4 +10,6 @@ When the sensor constructor asks for the Arduino pin controlling power on/off, u Please, please, when setting up multiple sensors on a logger, be smart about it. Don't try to connect too many sensors all at once or you're likely to exceed your logger's power regulator or come across strange interferences between them. -_**TEST YOUR LOGGER WITH ALL SENSORS ATTACHED BEFORE DEPLOYING IT TO THE FIELD!**_ Don't even think about skipping the in-lab testing! Theoretically every single sensor possible could be attached to the same processor, but the reality is that boards have finite numbers of pins, solar panels can only create so much charge, and not all sensors like each other very much. \ No newline at end of file +_**TEST YOUR LOGGER WITH ALL SENSORS ATTACHED BEFORE DEPLOYING IT TO THE FIELD!**_ +Don't even think about skipping the in-lab testing! +Theoretically every single sensor possible could be attached to the same processor, but the reality is that boards have finite numbers of pins, solar panels can only create so much charge, and not all sensors like each other very much. diff --git a/docs/Getting-Started/Getting-Started.md b/docs/Getting-Started/Getting-Started.md index da2df7540..1b8107ef6 100644 --- a/docs/Getting-Started/Getting-Started.md +++ b/docs/Getting-Started/Getting-Started.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_getting_started Getting Started ) -# Getting Started +# Getting Started [//]: # ( @tableofcontents ) @@ -17,8 +16,7 @@ Note: These instructions pertain almost entirely to using this specific library. There is an [extensive manual](https://www.envirodiy.org/mayfly-sensor-station-manual/) , set of [appendices](https://www.envirodiy.org/mayfly-sensor-station-manual/appendices/), and [video tutorials](https://www.envirodiy.org/videos/) for planning, installing, and maintaining a stream-side sensor station on the EnviroDIY website. -[//]: # ( @section page_getting_started_ide IDE and Driver Installation ) -## IDE and Driver Installation +## IDE and Driver Installation To interface with your board and send it programs, you'll need to install drivers and an [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment) or editor with a compiler on your computer. @@ -44,8 +42,7 @@ To access the menu, click the button that looks like a bug face on the left in V You create new "projects" in PlatformIO from the PlatformIO home page. That home page can be accessed from the PlatformIO menu. -[//]: # ( @section page_getting_started_libraries Library Installation ) -## Library Installation +## Library Installation Before you can use this library, you'll need to install it and all of its [dependencies](https://github.com/EnviroDIY/ModularSensors/wiki/Library-Dependencies) so your compiler in the IDE can find them. Because this library has a large number of dependencies, I, again, _very, **very** strongly_ suggest using [PlatformIO](https://platformio.org/). @@ -53,8 +50,7 @@ If you use PlatformIO, the library will automatically be installed when you list If you really must use the Arduino IDE, this library and all is dependencies can be downloaded in one large zip file [here](https://github.com/EnviroDIY/Libraries/blob/master/libraries.zip?raw=true). -[//]: # ( @section page_getting_started_clock Setting the Clock ) -## Setting the Clock +## Setting the Clock Most of this library's functionality depends on having a working DS3231 real time clock attached to your Arduino, so the first thing you need to do is get the time right. For the rank beginners out there; I feel your pain. @@ -87,8 +83,7 @@ You shouldn't have to open or modify the program at all. - Your clock should be set! -[//]: # ( @section page_getting_started_program Writing Your Logger Program ) -## Writing Your Logger Program +## Writing Your Logger Program The set-up in for your logger program PlatformIO is pretty simple: @@ -120,8 +115,7 @@ The download only happens once. - If the build succeeds, you're ready to move on. -[//]: # ( @section page_getting_started_examples Modifying the Examples ) -## Modifying the Examples +## Modifying the Examples There are a number of examples in the [examples](https://github.com/EnviroDIY/ModularSensors/tree/master/examples) folder for different logger functionalities. If you are unsure which to use, the "menu_a_la_carte" example has code in it for every possible sensor and modem. @@ -159,8 +153,7 @@ Because each sensor outputs temperature and we don't want to waste cellular data This example also shows how to stop power draw from an RS485 adapter with automatic flow detection. -[//]: # ( @section page_getting_started_deploying Deploying your Station ) -## Deploying your Station +## Deploying your Station To start getting data from the wild, you'll need some [stuff](https://github.com/EnviroDIY/ModularSensors/wiki/Physical-Dependencies) to power your logger and keep it safe from the elements. There are [video instructions](https://www.envirodiy.org/videos/) on the EnviroDIY website showing how to prepare and install a typical steam-side logger box and seniors. @@ -172,4 +165,4 @@ There are [video instructions](https://www.envirodiy.org/videos/) on the EnviroD [//]: # ( @subpage page_physical_dependencies ) -[//]: # ( @subpage page_library_terminology ) \ No newline at end of file +[//]: # ( @subpage page_library_terminology ) diff --git a/docs/Getting-Started/Library-Dependencies.md b/docs/Getting-Started/Library-Dependencies.md index 3ce035846..e182a4cc6 100644 --- a/docs/Getting-Started/Library-Dependencies.md +++ b/docs/Getting-Started/Library-Dependencies.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_library_dependencies Library Dependencies ) -# Library Dependencies +# Library Dependencies In order to support multiple functions and sensors, there are quite a lot of sub-libraries that this library depends on. _Even if you do not use the modules, you must have all of the dependencies installed for the library itself to properly compile._ diff --git a/docs/Getting-Started/Physical-Dependencies.md b/docs/Getting-Started/Physical-Dependencies.md index 9076e6bd3..3adc2bfe4 100644 --- a/docs/Getting-Started/Physical-Dependencies.md +++ b/docs/Getting-Started/Physical-Dependencies.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_physical_dependencies Physical Dependencies ) -# Physical Dependencies +# Physical Dependencies This library is designed for wireless, solar-powered environmental data logging applications, that is, to log data from many physical sensors and to put the processor and all peripherals to sleep to conserver power between readings. The most banal functions of the library require only an AVR or SAMD processor, but making real use of this library requires: diff --git a/docs/Getting-Started/Terminology.md b/docs/Getting-Started/Terminology.md index d0f453c22..467522375 100644 --- a/docs/Getting-Started/Terminology.md +++ b/docs/Getting-Started/Terminology.md @@ -1,8 +1,6 @@ -[//]: # ( @page page_library_terminology Library Terminology ) -# Library Terminology +# Library Terminology -[//]: # ( @section library_terminology_terms The Terms ) -## Terms +## Terms Within this library, a Sensor, a Variable, and a Logger mean very specific things: @@ -20,8 +18,7 @@ Within this library, a Sensor, a Variable, and a Logger mean very specific thing [//]: # ( End GitHub Only ) -[//]: # ( @subsection library_terminology_sensor Sensor ) -### Sensor +### Sensor A Sensor is some sort of device that is capable of taking one or more measurements using some sort of method. Most often we can think of these as probes or other instruments that can give back information about the world around them. @@ -32,8 +29,7 @@ They _**must**_ be capable of returning the value of their readings to a logger The detailed Sensor class documentation is here: https://envirodiy.github.io/ModularSensors/class_sensor.html -[//]: # ( @subsection library_terminology_variable Variable ) -### Variable +### Variable A Variable is a result value taken by a Sensor _or_ calculated from the results of one or more sensors. It is characterized by a name (what it is a measurement of), a unit of measurement, and a resolution. @@ -52,16 +48,14 @@ The Variable class documentation is here: https://envirodiy.github.io/ModularSe Variables are grouped together into VariableArrays. The VariableArray class documentation is here: https://envirodiy.github.io/ModularSensors/class_variable_array.html -[//]: # ( @subsection library_terminology_logger Logger ) -### Logger +### Logger A logger is a circuit board with a processor or microcontroller unit (MCU) that can control all functions of the modem and sensors that are attached to it and save the values of all variables measured by those sensors to an attached SD card. In this library, all loggers are Arduino-style small processor circuit boards. The Logger class documentation is here: https://envirodiy.github.io/ModularSensors/class_logger.html -[//]: # ( @subsection library_terminology_modem Modem ) -### Modem +### Modem ![](https://en.wikipedia.org/wiki/Modem#/media/File:Analogue_modem_-_acoustic_coupler.jpg) @@ -76,8 +70,7 @@ All loggerModem functions are heavily dependent on the [TinyGSM](https://github. The loggerModem class documentation is available here: https://envirodiy.github.io/ModularSensors/classlogger_modem.html -[//]: # ( @subsection library_terminology_publiser DataPublisher ) -### DataPublisher +### DataPublisher Unlike the other components, a dataPublisher object doesn't represent any physical device. It's an object only in the sense of object oriented programming - not something you could hold. @@ -86,8 +79,7 @@ Within the functioning of the library, the dataPublisher "watches" the logger fo The dataPublisher class documentation is available here: https://envirodiy.github.io/ModularSensors/classdata_publisher.html -[//]: # ( @section library_terminology_structure Library Structure ) -## Library Structure +## Library Structure This library is built to fully take advantage of Objecting Oriented Programing (OOP) approaches. This means there are a number of base abstract classes with virtual functions and then many more daughter classes which inherit the functions of their parents and implement others themselves. diff --git a/docs/Modem-Notes.md b/docs/Modem-Notes.md index 2b78c07a5..67c843cca 100644 --- a/docs/Modem-Notes.md +++ b/docs/Modem-Notes.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_modem_notes Notes about Modems ) -# Notes about Modems +# Notes about Modems [//]: # ( @tableofcontents ) @@ -16,8 +15,7 @@ If you are having trouble, please see the pages for the specific modems and the TinyGSM [getting started](https://github.com/vshymanskyy/TinyGSM#getting-started) and [troubleshooting](https://github.com/vshymanskyy/TinyGSM#troubleshooting) sections. -[//]: # ( @section modem_notes_classes Summary of Classes to use for Various Manufactured Modules ) -## Summary of Classes to use for Various Manufactured Modules +## Summary of Classes to use for Various Manufactured Modules | Module | Class | | :-------------------------------------------: | :----------------------------------------------: | @@ -54,8 +52,7 @@ If you are having trouble, please see the pages for the specific modems and the ² The NB IOT UBee based on the SARA N211 is _not_ supported. -[//]: # ( @section modem_notes_bauds Default Baud Rates of Supported Modems ) -## Default baud rates of supported modules +## Default baud rates of supported modules | Module | Default Baud Rate | | :--------------------------------: | :------------------------------------------------------: | @@ -69,8 +66,7 @@ If you are having trouble, please see the pages for the specific modems and the | u-blox 2G, 3G, and 4G modules | varies by module, most auto-baud or use 9600 | -[//]: # ( @section modem_notes_power Power Requirements of Supported Modems ) -## Power Requirements of Supported Modems +## Power Requirements of Supported Modems @note Standard USB ports and most Arduino boards (including the Mayfly) are only cabable of supplying **500mA** of power. Any model that requires a higher level of current (almost all of them) should be given a separate power supply than the main processor. @@ -102,8 +98,7 @@ Most modules are capable of serial communication and some level of functionality ¹ This is a firm minimum; the SIM7000 _will not connect to the internet_ if only powered at 500mA. -[//]: # ( @section modem_notes_sleep Sleep and Reset Pin Labels ) -## Sleep and Reset Pin Labels +## Sleep and Reset Pin Labels | Module | Status Pin Label | Reset Label | Wake / Sleep Request | | :---------------------------: | :-----------------------------------------: | :---------: | :-----------------------------------------: | @@ -128,8 +123,7 @@ Most modules are capable of serial communication and some level of functionality -[//]: # ( @section modem_notes_mayfly_pins Pin Numbers to Use when Connecting to the Mayfly ) -## Pin Numbers to Use when Connecting to the Mayfly +## Pin Numbers to Use when Connecting to the Mayfly Here are the pin numbers to use for modules that can be attached directly to an EnviroDIY Mayfly v0.x using its Bee socket. @@ -174,4 +168,4 @@ To use it, you must add these commands to your setup: ```cpp modem.setModemWakeLevel(HIGH); modem.setModemResetLevel(HIGH); -``` \ No newline at end of file +``` diff --git a/docs/css/m-EnviroDIY+documentation.compiled.css b/docs/css/m-EnviroDIY+documentation.compiled.css index 4e5dc9297..ce5c1158e 100644 --- a/docs/css/m-EnviroDIY+documentation.compiled.css +++ b/docs/css/m-EnviroDIY+documentation.compiled.css @@ -3,7 +3,8 @@ /* This file is part of m.css. - Copyright © 2017, 2018, 2019, 2020 Vladimír Vondruš + Copyright © 2017, 2018, 2019, 2020, 2021, 2022 + Vladimír Vondruš Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), @@ -36,7 +37,7 @@ body { margin: 0; } margin-left: -1rem; margin-right: -1rem; } -.m-row:after { +.m-row::after { content: ' '; clear: both; display: table; @@ -1031,7 +1032,7 @@ figure.m-figure { position: relative; display: table; } -figure.m-figure:before { +figure.m-figure::before { position: absolute; content: " "; top: 0; @@ -1044,7 +1045,7 @@ figure.m-figure:before { border-radius: 0px; border-color: #ddd; } -figure.m-figure.m-flat:before { +figure.m-figure.m-flat::before { border-color: transparent; } figure.m-figure > * { @@ -1090,7 +1091,7 @@ figure.m-figure.m-fullwidth img, figure.m-figure.m-fullwidth svg { width: 100%; } -figure.m-figure.m-fullwidth:after { +figure.m-figure.m-fullwidth::after { content: " "; display: block; margin-top: 1rem; @@ -1104,8 +1105,8 @@ figure.m-figure.m-fullwidth:after { position: relative; padding: 1rem; } -.m-code-figure:before, -.m-console-figure:before { +.m-code-figure::before, +.m-console-figure::before { position: absolute; content: " "; top: 0; @@ -1117,14 +1118,14 @@ figure.m-figure.m-fullwidth:after { border-width: 0.125rem; border-radius: 0px; } -.m-code-figure:before { +.m-code-figure::before { border-color: #f7f7f7; } -.m-console-figure:before { +.m-console-figure::before { border-color: #f7f7f7; } -.m-code-figure.m-flat:before, -.m-console-figure.m-flat:before { +.m-code-figure.m-flat::before, +.m-console-figure.m-flat::before { border-color: transparent; } .m-code-figure > pre:first-child, @@ -1150,10 +1151,21 @@ figure.m-figure figcaption, font-weight: 300; font-size: 1.17rem; } +figure.m-figure figcaption a, +.m-code-figure figcaption a, +.m-console-figure figcaption a { + text-decoration: none; +} +figure.m-figure figcaption .m-figure-description { + margin-top: 0.5rem; + font-weight: normal; + font-size: 1rem; +} +figure.m-figure figcaption .m-figure-description a { + text-decoration: underline; +} .m-imagegrid > div { - background-color: var( - --background-color - ); + background-color: #e8e8e8; } .m-imagegrid > div > figure { display: block; @@ -1250,11 +1262,7 @@ figure.m-figure figcaption, .m-container-inflatable > .m-row > [class*="m-col-"] section > .m-imagegrid, .m-container-inflatable > .m-row > [class*="m-col-"] section > pre, .m-container-inflatable > .m-row > [class*="m-col-"] section > .m-code-figure, -.m-container-inflatable - > .m-row - > [class*="m-col-"] - section - > .m-console-figure, +.m-container-inflatable > .m-row > [class*="m-col-"] section > .m-console-figure, .m-container-inflatable [class*="m-center-"] > .m-note, .m-container-inflatable [class*="m-center-"] > .m-frame, .m-container-inflatable [class*="m-center-"] > .m-block, @@ -1509,6 +1517,7 @@ div.m-plot svg .m-label.m-dim { fill: #666; } .m-graph g.m-edge path, +.m-graph g.m-cluster polygon, .m-graph g.m-node.m-flat ellipse, .m-graph g.m-node.m-flat polygon { fill: none; @@ -2311,49 +2320,64 @@ table.m-table tr.m-param th a:active, table.m-table th.m-param a:active { color: #9ad36a; } -figure.m-figure.m-default:before { +figure.m-figure.m-default::before { border-color: transparent; } figure.m-figure.m-default figcaption { color: #000000; } -figure.m-figure.m-primary:before { +figure.m-figure.m-primary::before { border-color: transparent; } figure.m-figure.m-primary figcaption { color: #31708f; } -figure.m-figure.m-success:before { +figure.m-figure.m-primary figcaption .m-figure-description { + color: #000000; +} +figure.m-figure.m-success::before { border-color: transparent; } figure.m-figure.m-success figcaption { color: #9ad36a; } -figure.m-figure.m-warning:before { +figure.m-figure.m-success figcaption .m-figure-description { + color: #000000; +} +figure.m-figure.m-warning::before { border-color: transparent; } figure.m-figure.m-warning figcaption { color: #f9cf79; } -figure.m-figure.m-danger:before { +figure.m-figure.m-warning figcaption .m-figure-description { + color: #000000; +} +figure.m-figure.m-danger::before { border-color: transparent; } figure.m-figure.m-danger figcaption { color: #f60000; } -figure.m-figure.m-info:before { +figure.m-figure.m-danger figcaption .m-figure-description { + color: #000000; +} +figure.m-figure.m-info::before { border-color: transparent; } figure.m-figure.m-info figcaption { color: #31708f; } -figure.m-figure.m-param:before { +figure.m-figure.m-info figcaption .m-figure-description { + color: #000000; +} +figure.m-figure.m-param::before { border-color: transparent; } figure.m-figure.m-param figcaption { color: #9ad36a; } -figure.m-figure.m-dim:before { +figure.m-figure.m-dim::before { border-color: transparent; } figure.m-figure.m-dim { @@ -2379,11 +2403,13 @@ div.m-plot svg .m-bar.m-default, .m-graph g.m-node:not(.m-flat) polygon, .m-graph g.m-edge text, .m-graph g.m-node.m-flat text, +.m-graph g.m-cluster text, .m-graph.m-default g.m-edge polygon, .m-graph.m-default g.m-node:not(.m-flat) ellipse, .m-graph.m-default g.m-node:not(.m-flat) polygon, .m-graph.m-default g.m-edge text, -.m-graph.m-default g.m-node.m-flat text { +.m-graph.m-default g.m-node.m-flat text, +.m-graph.m-default g.m-cluster text { fill: #000000; } .m-graph g.m-edge polygon, @@ -2391,11 +2417,13 @@ div.m-plot svg .m-bar.m-default, .m-graph g.m-node ellipse, .m-graph g.m-node polygon, .m-graph g.m-node polyline, +.m-graph g.m-cluster polygon, .m-graph.m-default g.m-edge polygon, .m-graph.m-default g.m-edge path, .m-graph.m-default g.m-node ellipse, .m-graph.m-default g.m-node polygon, -.m-graph.m-default g.m-node polyline { +.m-graph.m-default g.m-node polyline, +.m-graph.m-default g.m-cluster polygon { stroke: #000000; } .m-math.m-primary, @@ -2406,14 +2434,16 @@ div.m-plot svg .m-bar.m-primary, .m-graph.m-primary g.m-node:not(.m-flat) ellipse, .m-graph.m-primary g.m-node:not(.m-flat) polygon, .m-graph.m-primary g.m-edge text, -.m-graph.m-primary g.m-node.m-flat text { +.m-graph.m-primary g.m-node.m-flat text, +.m-graph.m-primary g.m-cluster text { fill: #31708f; } .m-graph.m-primary g.m-edge polygon, .m-graph.m-primary g.m-edge path, .m-graph.m-primary g.m-node ellipse, .m-graph.m-primary g.m-node polygon, -.m-graph.m-primary g.m-node polyline { +.m-graph.m-primary g.m-node polyline, +.m-graph.m-primary g.m-cluster polygon { stroke: #31708f; } .m-math.m-success, @@ -2424,14 +2454,16 @@ div.m-plot svg .m-bar.m-success, .m-graph.m-success g.m-node:not(.m-flat) ellipse, .m-graph.m-success g.m-node:not(.m-flat) polygon, .m-graph.m-success g.m-edge text, -.m-graph.m-success g.m-node.m-flat text { +.m-graph.m-success g.m-node.m-flat text, +.m-graph.m-success g.m-cluster text { fill: #9ad36a; } .m-graph.m-success g.m-edge polygon, .m-graph.m-success g.m-edge path, .m-graph.m-success g.m-node ellipse, .m-graph.m-success g.m-node polygon, -.m-graph.m-success g.m-node polyline { +.m-graph.m-success g.m-node polyline, +.m-graph.m-success g.m-cluster polygon { stroke: #9ad36a; } .m-math.m-warning, @@ -2442,14 +2474,16 @@ div.m-plot svg .m-bar.m-warning, .m-graph.m-warning g.m-node:not(.m-flat) ellipse, .m-graph.m-warning g.m-node:not(.m-flat) polygon, .m-graph.m-warning g.m-edge text, -.m-graph.m-warning g.m-node.m-flat text { +.m-graph.m-warning g.m-node.m-flat text, +.m-graph.m-warning g.m-cluster text { fill: #f9cf79; } .m-graph.m-warning g.m-edge polygon, .m-graph.m-warning g.m-edge path, .m-graph.m-warning g.m-node ellipse, .m-graph.m-warning g.m-node polygon, -.m-graph.m-warning g.m-node polyline { +.m-graph.m-warning g.m-node polyline, +.m-graph.m-warning g.m-cluster polygon { stroke: #f9cf79; } .m-math.m-danger, @@ -2460,14 +2494,16 @@ div.m-plot svg .m-bar.m-danger, .m-graph.m-danger g.m-node:not(.m-flat) ellipse, .m-graph.m-danger g.m-node:not(.m-flat) polygon, .m-graph.m-danger g.m-edge text, -.m-graph.m-danger g.m-node.m-flat text { +.m-graph.m-danger g.m-node.m-flat text, +.m-graph.m-danger g.m-cluster text { fill: #f60000; } .m-graph.m-danger g.m-edge polygon, .m-graph.m-danger g.m-edge path, .m-graph.m-danger g.m-node ellipse, .m-graph.m-danger g.m-node polygon, -.m-graph.m-danger g.m-node polyline { +.m-graph.m-danger g.m-node polyline, +.m-graph.m-danger g.m-cluster polygon { stroke: #f60000; } .m-math.m-info, @@ -2478,14 +2514,16 @@ div.m-plot svg .m-bar.m-info, .m-graph.m-info g.m-node:not(.m-flat) ellipse, .m-graph.m-info g.m-node:not(.m-flat) polygon, .m-graph.m-info g.m-edge text, -.m-graph.m-info g.m-node.m-flat text { +.m-graph.m-info g.m-node.m-flat text, +.m-graph.m-info g.m-cluster text { fill: #31708f; } .m-graph.m-info g.m-edge polygon, .m-graph.m-info g.m-edge path, .m-graph.m-info g.m-node ellipse, .m-graph.m-info g.m-node polygon, -.m-graph.m-info g.m-node polyline { +.m-graph.m-info g.m-node polyline, +.m-graph.m-info g.m-cluster polygon { stroke: #31708f; } .m-math.m-dim, @@ -2496,14 +2534,16 @@ div.m-plot svg .m-bar.m-dim, .m-graph.m-dim g.m-node:not(.m-flat) ellipse, .m-graph.m-dim g.m-node:not(.m-flat) polygon, .m-graph.m-dim g.m-edge text, -.m-graph.m-dim g.m-node.m-flat text { +.m-graph.m-dim g.m-node.m-flat text, +.m-graph.m-dim g.m-cluster text { fill: #666; } .m-graph.m-dim g.m-edge polygon, .m-graph.m-dim g.m-edge path, .m-graph.m-dim g.m-node ellipse, .m-graph.m-dim g.m-node polygon, -.m-graph.m-dim g.m-node polyline { +.m-graph.m-dim g.m-node polyline, +.m-graph.m-dim g.m-cluster polygon { stroke: #666; } .m-math.m-param, @@ -2528,98 +2568,112 @@ div.m-plot svg .m-bar.m-param, .m-graph g.m-node.m-default:not(.m-flat) ellipse, .m-graph g.m-node.m-default:not(.m-flat) polygon, .m-graph g.m-edge.m-default text, -.m-graph g.m-node.m-default.m-flat text { +.m-graph g.m-node.m-default.m-flat text, +.m-graph g.m-cluster.m-default text { fill: #000000; } .m-graph g.m-edge.m-default polygon, .m-graph g.m-edge.m-default path, .m-graph g.m-node.m-default ellipse, .m-graph g.m-node.m-default polygon, -.m-graph g.m-node.m-default polyline { +.m-graph g.m-node.m-default polyline, +.m-graph g.m-cluster.m-default polygon { stroke: #000000; } .m-graph g.m-edge.m-primary polygon, .m-graph g.m-node.m-primary:not(.m-flat) ellipse, .m-graph g.m-node.m-primary:not(.m-flat) polygon, .m-graph g.m-edge.m-primary text, -.m-graph g.m-node.m-primary.m-flat text { +.m-graph g.m-node.m-primary.m-flat text, +.m-graph g.m-cluster.m-primary text { fill: #31708f; } .m-graph g.m-edge.m-primary polygon, .m-graph g.m-edge.m-primary path, .m-graph g.m-node.m-primary ellipse, .m-graph g.m-node.m-primary polygon, -.m-graph g.m-node.m-primary polyline { +.m-graph g.m-node.m-primary polyline, +.m-graph g.m-cluster.m-primary polygon { stroke: #31708f; } .m-graph g.m-edge.m-success polygon, .m-graph g.m-node.m-success:not(.m-flat) ellipse, .m-graph g.m-node.m-success:not(.m-flat) polygon, .m-graph g.m-edge.m-success text, -.m-graph g.m-node.m-success.m-flat text { +.m-graph g.m-node.m-success.m-flat text, +.m-graph g.m-cluster.m-success text { fill: #9ad36a; } .m-graph g.m-edge.m-success polygon, .m-graph g.m-edge.m-success path, .m-graph g.m-node.m-success ellipse, .m-graph g.m-node.m-success polygon, -.m-graph g.m-node.m-success polyline { +.m-graph g.m-node.m-success polyline, +.m-graph g.m-cluster.m-success polygon { stroke: #9ad36a; } .m-graph g.m-edge.m-warning polygon, .m-graph g.m-node.m-warning:not(.m-flat) ellipse, .m-graph g.m-node.m-warning:not(.m-flat) polygon, .m-graph g.m-edge.m-warning text, -.m-graph g.m-node.m-warning.m-flat text { +.m-graph g.m-node.m-warning.m-flat text, +.m-graph g.m-cluster.m-warning text { fill: #f9cf79; } .m-graph g.m-edge.m-warning polygon, .m-graph g.m-edge.m-warning path, .m-graph g.m-node.m-warning ellipse, .m-graph g.m-node.m-warning polygon, -.m-graph g.m-node.m-warning polyline { +.m-graph g.m-node.m-warning polyline, +.m-graph g.m-cluster.m-warning polygon { stroke: #f9cf79; } .m-graph g.m-edge.m-danger polygon, .m-graph g.m-node.m-danger:not(.m-flat) ellipse, .m-graph g.m-node.m-danger:not(.m-flat) polygon, .m-graph g.m-edge.m-danger text, -.m-graph g.m-node.m-danger.m-flat text { +.m-graph g.m-node.m-danger.m-flat text, +.m-graph g.m-cluster.m-danger text { fill: #f60000; } .m-graph g.m-edge.m-danger polygon, .m-graph g.m-edge.m-danger path, .m-graph g.m-node.m-danger ellipse, .m-graph g.m-node.m-danger polygon, -.m-graph g.m-node.m-danger polyline { +.m-graph g.m-node.m-danger polyline, +.m-graph g.m-cluster.m-danger polygon { stroke: #f60000; } .m-graph g.m-edge.m-info polygon, .m-graph g.m-node.m-info:not(.m-flat) ellipse, .m-graph g.m-node.m-info:not(.m-flat) polygon, .m-graph g.m-edge.m-info text, -.m-graph g.m-node.m-info.m-flat text { +.m-graph g.m-node.m-info.m-flat text, +.m-graph g.m-cluster.m-info text { fill: #31708f; } .m-graph g.m-edge.m-info polygon, .m-graph g.m-edge.m-info path, .m-graph g.m-node.m-info ellipse, .m-graph g.m-node.m-info polygon, -.m-graph g.m-node.m-info polyline { +.m-graph g.m-node.m-info polyline, +.m-graph g.m-cluster.m-info polygon { stroke: #31708f; } .m-graph g.m-edge.m-dim polygon, .m-graph g.m-node.m-dim:not(.m-flat) ellipse, .m-graph g.m-node.m-dim:not(.m-flat) polygon, .m-graph g.m-edge.m-dim text, -.m-graph g.m-node.m-dim.m-flat text { +.m-graph g.m-node.m-dim.m-flat text, +.m-graph g.m-cluster.m-dim text { fill: #666; } .m-graph g.m-edge.m-dim polygon, .m-graph g.m-edge.m-dim path, .m-graph g.m-node.m-dim ellipse, .m-graph g.m-node.m-dim polygon, -.m-graph g.m-node.m-dim polyline { +.m-graph g.m-node.m-dim polyline, +.m-graph g.m-cluster.m-dim polygon { stroke: #666; } .m-graph g.m-edge.m-param polygon, @@ -2633,7 +2687,8 @@ div.m-plot svg .m-bar.m-param, .m-graph g.m-edge.m-param path, .m-graph g.m-node.m-param ellipse, .m-graph g.m-node.m-param polygon, -.m-graph g.m-node.m-param polyline { +.m-graph g.m-node.m-param polyline, +.m-graph g.m-cluster.m-param polygon { stroke: #9ad36a; } p, @@ -2846,8 +2901,8 @@ body > header > nav #m-navbar-brand .m-thin { body > header > nav #m-navbar-brand .m-breadcrumb { color: #bdbdbd; } -body > header > nav a#m-navbar-show:before, -body > header > nav a#m-navbar-hide:before { +body > header > nav a#m-navbar-show::before, +body > header > nav a#m-navbar-hide::before { content: "\2630"; } body > header > nav #m-navbar-collapse { @@ -4051,8 +4106,8 @@ ul.m-doc li.m-doc-collapsible > a:first-child:active { color: #000000; } a.m-doc-self, -ul.m-doc li.m-doc-expansible > a:first-child:before, -ul.m-doc li.m-doc-collapsible > a:first-child:before { +ul.m-doc li.m-doc-expansible > a:first-child::before, +ul.m-doc li.m-doc-collapsible > a:first-child::before { color: #26a9e0; } a.m-doc-self:hover, @@ -4111,18 +4166,18 @@ ul.m-doc li.m-doc-expansible > ul.m-doc, ul.m-doc li.m-doc-collapsible > ul.m-doc { margin-left: 0.5rem; } -ul.m-doc li.m-doc-expansible > a:first-child:before, -ul.m-doc li.m-doc-collapsible > a:first-child:before { +ul.m-doc li.m-doc-expansible > a:first-child::before, +ul.m-doc li.m-doc-collapsible > a:first-child::before { background-color: #e8e8e8; display: inline-block; width: 0.4rem; font-weight: bold; } -ul.m-doc li.m-doc-expansible > a:first-child:before { - content: "+"; +ul.m-doc li.m-doc-expansible > a:first-child::before { + content: '+'; } -ul.m-doc li.m-doc-collapsible > a:first-child:before { - content: "-"; +ul.m-doc li.m-doc-collapsible > a:first-child::before { + content: '-'; } h1 .m-doc-template, h1 .m-doc-include { @@ -4181,7 +4236,7 @@ article section.m-doc-details > div { } article section.m-doc-details > div::before { position: absolute; - content: " "; + content: ' '; top: 0; bottom: 0; left: 0; @@ -4211,25 +4266,21 @@ article section.m-doc-details:target { article section.m-doc-details:target > div { z-index: 1; } -.m-container-inflatable - > .m-row - > [class*="m-col-"] - section.m-doc-details - > div { +.m-container-inflatable > .m-row > [class*='m-col-'] section.m-doc-details > div { margin-left: -1rem; margin-right: -1rem; } #m-search-button { - color:#fff; + color: #fff; margin-left: 30px; cursor: pointer; font-size: 18px; line-height: 1; - padding:30.5px 0; + padding: 30.5px 0; } #m-search-button:before { - font-family: "FontAwesome"; - content: "\f002"; + font-family: 'FontAwesome'; + content: '\f002'; } a.m-doc-search-icon { padding-left: 1rem; @@ -4335,12 +4386,12 @@ a.m-doc-search-icon:active svg { .m-doc-search-typed { color: #26a9e0; } -.m-doc-search input[type="search"] { +.m-doc-search input[type='search'] { -webkit-appearance: textfield; } -.m-doc-search input[type="search"]::-webkit-search-decoration, -.m-doc-search input[type="search"]::-webkit-search-cancel-button, -.m-doc-search input[type="search"]::-webkit-search-results-button, -.m-doc-search input[type="search"]::-webkit-search-results-decoration { +.m-doc-search input[type='search']::-webkit-search-decoration, +.m-doc-search input[type='search']::-webkit-search-cancel-button, +.m-doc-search input[type='search']::-webkit-search-results-button, +.m-doc-search input[type='search']::-webkit-search-results-decoration { display: none; } diff --git a/docs/documentExamples.py b/docs/documentExamples.py deleted file mode 100644 index 92ac3bf71..000000000 --- a/docs/documentExamples.py +++ /dev/null @@ -1,123 +0,0 @@ -#!/usr/bin/env python -import fileinput -import re -import os -import glob - -fileDir = os.path.dirname(os.path.realpath("__file__")) -# print(fileDir) - -output_file = "examples.dox" -read_mes = [ - "../examples/ReadMe.md", - "../examples/baro_rho_correction/ReadMe.md", - "../examples/data_saving/ReadMe.md", - "../examples/double_logger/ReadMe.md", - "../examples/DRWI_2G/ReadMe.md", - "../examples/DRWI_DigiLTE/ReadMe.md", - "../examples/DRWI_SIM7080LTE/ReadMe.md", - "../examples/DRWI_NoCellular/ReadMe.md", - "../examples/logging_to_MMW/ReadMe.md", - "../examples/logging_to_ThingSpeak/ReadMe.md", - "../examples/menu_a_la_carte/ReadMe.md", - "../examples/simple_logging/ReadMe.md", - "../examples/simple_logging_LearnEnviroDIY/ReadMe.md", - "../examples/single_sensor/ReadMe.md", -] - -if not os.path.exists(os.path.join(fileDir, "examples")): - os.makedirs(os.path.join(fileDir, "examples")) - -for filename in read_mes: - out_path = os.path.join(fileDir, "examples") - out_dir = filename.split("/")[2] - out_name = out_dir + ".dox" - if out_name == "ReadMe.md.dox": - out_name = "examples.dox" - abs_out = os.path.join(out_path, out_name) - # print(abs_out) - # with open(output_file, 'w+') as out_file: - with open(abs_out, "w+") as out_file: - - abs_file_path = os.path.join(fileDir, filename) - abs_file_path = os.path.abspath(os.path.realpath(abs_file_path)) - # print(abs_file_path) - - with open(abs_file_path, "r") as in_file: # open in readonly mode - out_file.write("/**\n") - if out_name != "examples.dox": - # out_file.write( - # "@example{{lineno}} {} @m_examplenavigation{{page_the_examples,{}/}} @m_footernavigation \n\n".format( - # filename.replace("..\\examples\\", "").replace( - # "\\ReadMe.md", ".ino" - # ), out_dir - # ) - # ) - out_file.write( - "@example{{lineno}} {} @m_examplenavigation{{page_the_examples,}} @m_footernavigation \n\n".format( - filename.replace("../examples/", "").replace( - "/ReadMe.md", ".ino" - ) - ) - ) - # out_file.write( - # "@example{{lineno}} {} \n\n".format( - # filename.replace("..\\examples\\", "").replace( - # "\\ReadMe.md", ".ino" - # ) - # ) - # ) - # out_file.write('\n@tableofcontents\n\n') - - print_me = True - skip_me = False - i = 1 - lines = in_file.readlines() - for line in lines: - # print(i, print_me, skip_me, line) - - # Remove markdown comment tags from doxygen commands within the markdown - if print_me and not skip_me: - new_line = ( - re.sub(r"\[//\]: # \( @(\w+?.*) \)", r"@\1", line) - .replace("```ini", "@code{.ini}") - .replace("```cpp", "@code{.cpp}") - .replace("```", "@endcode") - ) - if out_name != "examples.dox": - new_line = new_line.replace("@page", "@section") - # .replace('@section', '') - # .replace('@subsection', '') - # .replace('@subsubsection', '') - # .replace('@paragraph', '') - # .replace('@par', '') - out_file.write(new_line) - - # using skip_me to skip single lines, so unset it after reading a line - if skip_me: - skip_me = False - - # a page, section, subsection, or subsubsection commands followed - # immediately with by a markdown header leads to that section appearing - # twice in the doxygen html table of contents. - # I'm putting the section markers right above the header and then will skip the header. - if re.match(r"\[//\]: # \( @mainpage", line) is not None: - skip_me = True - if re.match(r"\[//\]: # \( @page", line) is not None: - skip_me = True - if re.match(r"\[//\]: # \( @.*section", line) is not None: - skip_me = True - if re.match(r"\[//\]: # \( @paragraph", line) is not None: - skip_me = True - - # I'm using these comments to fence off content that is only intended for - # github mardown rendering - if "[//]: # ( Start GitHub Only )" in line: - print_me = False - - if "[//]: # ( End GitHub Only )" in line: - print_me = True - - i += 1 - - out_file.write("\n*/\n\n") diff --git a/docs/doxygen_extra_pages.dox b/docs/doxygen_extra_pages.dox index 8fd512a03..22c3817dd 100644 --- a/docs/doxygen_extra_pages.dox +++ b/docs/doxygen_extra_pages.dox @@ -19,7 +19,7 @@ Here are some links to pages with more detailed information about some common is */ /** -@page page_other_reading Other Reading +@page page_other_notes Other Sensor and Modem Notes Here are links to detailed information about the various supported sensors and modems. diff --git a/docs/fixSectionsInXml.py b/docs/fixSectionsInXml.py new file mode 100644 index 000000000..682c64b89 --- /dev/null +++ b/docs/fixSectionsInXml.py @@ -0,0 +1,137 @@ +#!/usr/bin/env python +#%% +import fileinput +import re +import os +import glob +import xml.etree.ElementTree as ET + +fileDir = os.path.dirname(os.path.realpath("__file__")) +# print("Program Directory: {}".format(fileDir)) +relative_dir = "../../ModularSensorsDoxygen/xml/" +abs_file_path = os.path.join(fileDir, relative_dir) +abs_file_path = os.path.abspath(os.path.realpath(abs_file_path)) +# print("XML Directory: {}".format(fileDir)) + +all_files = [ + f + for f in os.listdir(abs_file_path) + if os.path.isfile( + os.path.join(abs_file_path, f) + ) # and f.endswith("8ino-example.xml") +] + +compound_def = r".+?)\" kind=\"\w+?\">" +section_header = r"[123456]) id=\"(?P.+)\">" +doxy_file_location = r".+)\"/>" +#%% +for filename in all_files: + # print("Now on {}".format(os.path.join(abs_file_path, filename))) + + needs_to_be_fixed = False + + doxygen_compound_id = None + section_number = None + doxygen_sect_id = None + sections_to_fix = [] + # First search the xml for the location of the original file. + # This will be at the end of the xml, so we need to find this, close the file, + # and then reopen to search for the compound def and section. + original_xml = open( + os.path.join(abs_file_path, filename), mode="r", encoding="utf-8" + ) + # filetext = original_xml.read() + for line in original_xml.readlines(): + if re.search(doxy_file_location, line) is not None: + file_location = re.search(doxy_file_location, line).group("file_location") + original_xml.close() + + # Now search for the sections + original_xml = open( + os.path.join(abs_file_path, filename), mode="r", encoding="utf-8" + ) + for line in original_xml.readlines(): + # print(line, end="") + if re.search(compound_def, line) is not None: + doxygen_compound_id = re.search(compound_def, line).group( + "doxygen_compound_id" + ) + if re.search(section_header, line) is not None: + section_number = re.search(section_header, line).group("section_number") + doxygen_sect_id = re.search(section_header, line).group("doxygen_sect_id") + # print( + # "section_number:", section_number, "doxygen_sect_id:", doxygen_sect_id + # ) + if ( + not doxygen_sect_id.startswith(doxygen_compound_id) + and file_location in doxygen_sect_id + ): + needs_to_be_fixed = True + file_name_loc = doxygen_sect_id.find(file_location) + section_suffix = doxygen_sect_id[ + file_name_loc + len(file_location) + 2 : + ] + corrected_id = doxygen_compound_id + "_" + section_suffix + sections_to_fix.append( + { + "doxygen_compound_id": doxygen_compound_id, + "section_number": section_number, + "doxygen_sect_id": doxygen_sect_id, + "file_location": file_location, + "needs_to_be_fixed": True, + "corrected_id": corrected_id, + } + ) + print( + "Will correct:\n\t{}\nTo:\n\t{}".format( + doxygen_sect_id, corrected_id + ) + ) + + original_xml.close() + + # Now we're going to open the file and copy to a new one with corrections applied + if needs_to_be_fixed: + original_xml = open( + os.path.join(abs_file_path, filename), mode="r", encoding="utf-8" + ) + corrected_xml = open( + os.path.join(abs_file_path, filename + "_fixed"), mode="w", encoding="utf-8" + ) + for line in original_xml.readlines(): + corrected_line = line + for section_to_fix in sections_to_fix: + corrected_line = re.sub( + r"[123456]) id=\"" + + section_to_fix["doxygen_sect_id"] + + r"\">", + r' id="' + + section_to_fix["corrected_id"] + + r'">', + corrected_line, + ) + # corrected_line = corrected_line.replace( + # ' id="{}"'.format(section_to_fix["doxygen_sect_id"]), + # ' id="{}"'.format(section_to_fix["corrected_id"]), + # ) + corrected_xml.write(corrected_line) + original_xml.close() + corrected_xml.close() + + if needs_to_be_fixed: + os.rename( + os.path.join(abs_file_path, filename), + os.path.join(abs_file_path, filename + "_original"), + ) + os.rename( + os.path.join(abs_file_path, filename + "_fixed"), + os.path.join(abs_file_path, filename), + ) + print("Saved changed file") + print("-----\n\n\n") + # else: + # print("No changes needed") + # print("-----\n") + # break + +# %% diff --git a/docs/fixXmlExampleSections.py b/docs/fixXmlExampleSections.py deleted file mode 100644 index c462a4c03..000000000 --- a/docs/fixXmlExampleSections.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python -import fileinput -import re -import os -import glob -import xml.etree.ElementTree as ET - -fileDir = os.path.dirname(os.path.realpath("__file__")) -# print("Program Directory: {}".format(fileDir)) -relative_dir = "../../ModularSensorsDoxygen/xml/" -abs_file_path = os.path.join(fileDir, relative_dir) -abs_file_path = os.path.abspath(os.path.realpath(abs_file_path)) -# print("XML Directory: {}".format(fileDir)) - -all_files = [ - f - for f in os.listdir(abs_file_path) - if os.path.isfile(os.path.join(abs_file_path, f)) and f.endswith("8ino-example.xml") -] - -for filename in all_files: - print(filename) - - tree = ET.parse(os.path.join(abs_file_path, filename)) - root = tree.getroot() - - needs_to_be_fixed = False - for definition in root.iter("compounddef"): - # print(definition.attrib) - compound_id = definition.attrib["id"] - # print(compound_id) - # print("---") - - for i in range(6): - for section in definition.iter("sect" + str(i)): - # print(section.attrib) - section_id = section.attrib["id"] - if not section_id.startswith(compound_id): - # print("problem!") - needs_to_be_fixed = True - dox_loc = section_id.find(".dox_") - section_suffix = section_id[dox_loc + 6 :] - # print(section_suffix) - corrected_id = compound_id + "_" + section_suffix - # print(corrected_id) - section.attrib["id"] = corrected_id - - if needs_to_be_fixed: - tree.write(os.path.join(abs_file_path, filename + "_fixed")) - os.rename( - os.path.join(abs_file_path, filename), - os.path.join(abs_file_path, filename + "_original"), - ) - os.rename( - os.path.join(abs_file_path, filename + "_fixed"), - os.path.join(abs_file_path, filename), - ) - # print() diff --git a/docs/markdown_prefilter.py b/docs/markdown_prefilter.py index 3335fdbde..2c26f7b30 100644 --- a/docs/markdown_prefilter.py +++ b/docs/markdown_prefilter.py @@ -1,41 +1,352 @@ #!/usr/bin/env python +#%% +import enum import fileinput import re +import sys +import string +# a helper function to go from snake back to camel +def snake_to_camel(snake_str): + components = snake_str.strip().split("_") + # We capitalize the first letter of each component except the first one + # with the 'title' method and join them together. + camel_str = components[0] + "".join(x.title() for x in components[1:]) + if camel_str.startswith("_"): + return camel_str[1:] + else: + return camel_str + + +def camel_to_snake(name): + name = name.strip().replace(" ", "_") + name = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name.strip()) + return re.sub("([a-z0-9])([A-Z])", r"\1_\2", name).lower() + + +def github_slugify(name): + return ( + name.strip() + .lower() + .replace( + "-", " " + ) # convert dashes to spaces so they don't get lost with other punctuation + .translate(str.maketrans("", "", string.punctuation)) + .replace(" ", " ") + .replace(" ", " ") + .replace(" ", "-") + ) + + +# Add a start comment to make the entire markdown file function as a comment block +# Without this doxygen sometimes recognizes its own special commands, but mostly doesn't +# Not needed anymore with doxygen 1.9.3? +# try: +# sys.stdout.buffer.write("\n/**\n".encode("utf-8")) +# except Exception as e: +# print("\n*/\n\n") + +#%% print_me = True skip_me = False i = 1 -# for line in fileinput.input(openhook=fileinput.hook_encoded("utf-8", "surrogateescape")): -for line in fileinput.input(): - # print(i, print_me, skip_me, line) - - # Remove markdown comment tags from doxygen commands within the markdown - if print_me and not skip_me: - print(re.sub(r'\[//\]: # \( @(\w+?.*) \)', r'@\1', line), end="") - - # using skip_me to skip single lines, so unset it after reading a line - if skip_me: - skip_me = False - - # a page, section, subsection, or subsubsection commands followed - # immediately with by a markdown header leads to that section appearing - # twice in the doxygen html table of contents. - # I'm putting the section markers right above the header and then will skip the header. - if re.match(r'\[//\]: # \( @mainpage', line) is not None: - skip_me = True - if re.match(r'\[//\]: # \( @page', line) is not None: - skip_me = True - if re.match(r'\[//\]: # \( @.*section', line) is not None: - skip_me = True - if re.match(r'\[//\]: # \( @paragraph', line) is not None: - skip_me = True - - # I'm using these comments to fence off content that is only intended for - # github mardown rendering - if "[//]: # ( Start GitHub Only )" in line: - print_me = False - - if "[//]: # ( End GitHub Only )" in line: - print_me = True - - i += 1 + +# when testing use: +# with fileinput.FileInput("..\\ChangeLog.md", +# openhook=fileinput.hook_encoded("utf-8", "surrogateescape") +# ) as input: + +with fileinput.FileInput( + openhook=fileinput.hook_encoded("utf-8", "surrogateescape") +) as input: + for line in input: + if input.isfirstline(): + # Get the file name and directory + # We'll use this to create the section id comment + file_name_dir = input.filename() + if "\\" in file_name_dir: + seper = "\\" + else: + seper = "/" + # sys.stdout.buffer.write("Separator: '{}'\n".format(seper).encode("utf-8")) + file_dir = file_name_dir.rsplit(sep=seper, maxsplit=1)[0] + file_name_ext = file_name_dir.rsplit(sep=seper, maxsplit=1)[1] + file_name = file_name_ext.rsplit(sep=".", maxsplit=1)[0] + file_ext = file_name_ext.rsplit(sep=".", maxsplit=1)[1] + # sys.stdout.buffer.write( + # "File Directory: {}, File Name: {}, File Extension: {}\n".format( + # file_dir, file_name, file_ext + # ).encode("utf-8") + # ) + # For the example walk-throughs, written in the ReadMe files, + # we want the example name, which is part of the directory. + if "examples" in file_dir and file_name == "ReadMe": + file_name = "example_" + file_dir.rsplit(sep=seper, maxsplit=1)[-1] + + # print(i, print_me, skip_me, line) + + # I'm using these comments to fence off content that is only intended for + # github mardown rendering + if "[//]: # ( Start GitHub Only )" in line: + print_me = False + + # copy the original line to work with + massaged_line = line + # Convert markdown comment tags to c++/dox style comment tags + massaged_line = re.sub(r"\[//\]: # \( @(\w+?.*) \)", r"@\1", massaged_line) + # Convert GitHub pages url's to refs + # I'm putting the long URL in the markdown because I want the links there to + # work and go to the pages. But when feeding it to Doxygen, I want them to be + # ref's so Doxygen will both check the existence of the refs and create new + # links for them. + + # For links to sections, doxygen cuts off the first letter of the section name + # in the examples (UGH), so some acrobatics to find them + massaged_line = re.sub( + r"https://envirodiy.github.io/ModularSensors/[\w/-]+\.html#enu_(?P[\w/-]+)", + r"@ref menu_\g", + massaged_line, + ) + # for classes, we need to switch camel and snake cases + class_link = re.search( + r"https://envirodiy.github.io/ModularSensors/(?:class)(?P[\w/-]+)\.html", + massaged_line, + ) + if class_link is not None: + camel_link = snake_to_camel(class_link.group("class_link")) + massaged_line = re.sub( + r"https://envirodiy.github.io/ModularSensors/(?:class)(?P[\w/-]+)\.html", + r"@ref #" + camel_link, + massaged_line, + ) + # for groups, we need to clean out extra underscores + group_link = re.search( + r"https://envirodiy.github.io/ModularSensors/(?:group__)(?P[\w/-]+)\.html", + massaged_line, + ) + if group_link is not None: + camel_link = group_link.group("group_link").replace("__", "_") + massaged_line = re.sub( + r"https://envirodiy.github.io/ModularSensors/(?:group__)(?P[\w/-]+)\.html", + r"@ref #" + camel_link, + massaged_line, + ) + # for examples, we need to clean out extra underscores + example_link = re.search( + r"https://envirodiy.github.io/ModularSensors/(?P[\w/-]+)_8ino-example\.html", + massaged_line, + ) + if example_link is not None: + camel_link = snake_to_camel(example_link.group("example_name")) + massaged_line = re.sub( + r"https://envirodiy.github.io/ModularSensors/(?P[\w/-]+)_8ino-example\.html", + "@ref " + snake_to_camel(example_link.group("example_name")) + ".ino", + massaged_line, + ) + + # If it's the index itself, we want to replace with a reference to the mainpage + massaged_line = re.sub( + r"https://envirodiy.github.io/ModularSensors/index.html#(?P[\w/-]+)", + r"@ref \g", + massaged_line, + ) + massaged_line = re.sub( + r"https://envirodiy.github.io/ModularSensors/index.html", + "@ref mainpage", + massaged_line, + ) + + # for anything other link to the docs, we the text as it is and hope it + # lines up with a real reference + massaged_line = re.sub( + r"https://envirodiy.github.io/ModularSensors/(?P[\w/-]+)\.html", + r"@ref \g", + massaged_line, + ) + + # Add a PHP Markdown Extra style header id to the end of header sections + # use the GitHub anchor plus the file name as the section id. + # GitHub anchors for headers are the text, stripped of punctuation, + # with the spaces replaced by hyphens. + markdown_header = re.match( + r"(?P#{1,6})\s+(?P[^<>\{\}\#]+)", + massaged_line, + ) + php_extra_header_label = re.search(r"\{#(.+)\}", massaged_line) + anchor_header = re.search( + r"\w+)\">", massaged_line + ) + if ( + file_name is not None + and file_name != "ChangeLog" + and markdown_header is not None + and php_extra_header_label is None + and anchor_header is None + ): + massaged_line = ( + markdown_header.group("heading_pounds") + + " " + + markdown_header.group("section_name").strip() + + " {#" + + camel_to_snake(file_name) + + "_" + + github_slugify(markdown_header.group("section_name")) + + "}\n" + ) + + elif ( + file_name is not None + and file_name != "ChangeLog" + and markdown_header is not None + and php_extra_header_label is not None + ): + # unhide PHP Markdown Extra header id's hidding in GitHub flavored markdown comments + massaged_line = re.sub(r"", r"{#\1}", massaged_line,) + # if input.isfirstline(): + # else: + # massaged_line = ( + # markdown_header.group("heading_pounds") + # + " " + # + markdown_header.group("section_name").strip() + # + " {#" + # + camel_to_snake(file_name) + # + "_" + # + github_slugify(markdown_header.group("section_name")) + # + "}\n" + # ) + + elif ( + file_name is not None + and file_name != "ChangeLog" + and markdown_header is not None + and anchor_header is not None + ): + # convert anchors to section names + massaged_line = re.sub( + r"\w+)\">", + r"{#\g}", + massaged_line, + ) + + # Special work-arounds for the change log + if file_name is not None and file_name == "ChangeLog": + if line.startswith("# ChangeLog"): + massaged_line = "# ChangeLog {#change_log}\n" + version_re = re.match( + r"#{2}\s+(?P\[(?P[^\{\}\#]+?)\])(?P.*)", + massaged_line, + ) + version_action_re = re.match( + r"#{3}\s+(?P(?:Changed)|(?:Added)|(?:Removed)|(?:Fixed)|(?:Known Issues))", + massaged_line, + ) + if version_re is not None: + change_log_version = ( + version_re.group("version_number").strip().lower().replace(".", "-") + ) + change_log_link = version_re.group("changelog_link") + massaged_line = ( + "@section " + + camel_to_snake(file_name) + + "_" + + change_log_version + + " " + + version_re.group("version_number") + + version_re.group("version_info") + + "\n" + + "GitHub Release: " + + change_log_link + # + "\n" #NOTE: Adding the new line here would offset all doxygen line numbers + ) + if version_action_re is not None: + massaged_line = ( + massaged_line.rstrip() + + " {#" + + camel_to_snake(file_name) + + "_" + + change_log_version + + "_" + + camel_to_snake(version_action_re.group("section_name")) + + "}\n" + ) + + # convert internal hash-tag links to reference links + internal_hash_link = re.search( + r"\]\(#(?P[\w/-]+)\)", massaged_line, + ) + if internal_hash_link is not None: + massaged_line = re.sub( + r"\]\(#(?P[\w/-]+)\)", + "](@ref " + + camel_to_snake(file_name) + + "_" + + github_slugify(internal_hash_link.group("internal_anchor")) + + ")", + massaged_line, + ) + + # finally replace code blocks with doxygen's prefered code block + massaged_line = ( + massaged_line.replace("```ini", "@code{.ini}") + .replace("```cpp", "@code{.cpp}") + .replace("```", "@endcode") + ) + + # hide lines that are not printed or skipped + # write out an empty comment line to keep the line numbers identical + if skip_me or not print_me: + massaged_line = "\n" + + if ( + massaged_line.count("\n") != line.count("\n") + or line.count("\n") != 1 + or massaged_line.count("\n") != 1 + ): + raise Exception( + '\n\nNot exactly one new lines\nFile:{}\nLine Number:{}\nNew Lines in Original: {}\nOriginal Line:\n"{}"\nNew Lines after Massage: {}\nMassaged Line:\n"{}"\n\n'.format( + input.filename(), + input.filelineno(), + line.count("\n"), + line, + massaged_line.count("\n"), + massaged_line, + ) + ) + + # write out the result + try: + sys.stdout.buffer.write(massaged_line.encode("utf-8")) + except Exception as e: + print(massaged_line, end="") + + # using skip_me to skip single lines, so unset it after reading a line + if skip_me: + skip_me = False + + # a page, section, subsection, or subsubsection commands followed + # immediately with by a markdown header leads to that section appearing + # twice in the doxygen html table of contents. + # I'm putting the section markers right above the header and then will skip the header. + if re.match(r"\[//\]: # \( @mainpage", line) is not None: + skip_me = True + if re.match(r"\[//\]: # \( @page", line) is not None: + skip_me = True + if re.match(r"\[//\]: # \( @.*section", line) is not None: + skip_me = True + if re.match(r"\[//\]: # \( @paragraph", line) is not None: + skip_me = True + + # I'm using these comments to fence off content that is only intended for + # github mardown rendering + if "[//]: # ( End GitHub Only )" in line: + print_me = True + + i += 1 + +#%% +# Close the comment for doxygen +# Not needed anymore with doxygen 1.9.3? +# try: +# sys.stdout.buffer.write("\n*/\n\n".encode("utf-8")) +# except Exception as e: +# print("\n*/\n\n") diff --git a/docs/mcss-conf.py b/docs/mcss-conf.py index 111a2a291..fe3e32edb 100644 --- a/docs/mcss-conf.py +++ b/docs/mcss-conf.py @@ -13,6 +13,7 @@ ('Contributing',), ('License',), ('Acknowledgments',), + ('ChangeLog',), ], ), ( @@ -47,6 +48,7 @@ ("Library Dependencies", "page_library_dependencies",), ("Physical Dependencies", "page_physical_dependencies",), ("Terminology", "page_library_terminology",), + ("Other Sensor and Modem Notes", "page_other_notes",), ], ), ( diff --git a/examples/DRWI_2G/DRWI_2G.ino b/examples/DRWI_2G/DRWI_2G.ino index 56b4c4342..2d04e1a28 100644 --- a/examples/DRWI_2G/DRWI_2G.ino +++ b/examples/DRWI_2G/DRWI_2G.ino @@ -3,7 +3,7 @@ * @brief Example for DRWI CitSci 2G sites. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -78,7 +78,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // ========================================================================== // Wifi/Cellular Modem Options // ========================================================================== -/** Start [gprsbee] */ +/** Start [sodaq_2g_bee_r6] */ // For the Sodaq 2GBee R6 and R7 based on the SIMCom SIM800 // NOTE: The Sodaq GPRSBee doesn't expose the SIM800's reset pin #include @@ -100,7 +100,7 @@ const char* apn = "hologram"; // The APN for the gprs connection Sodaq2GBeeR6 modem2GB(&modemSerial, modemVccPin, modemStatusPin, apn); // Create an extra reference to the modem by a generic name Sodaq2GBeeR6 modem = modem2GB; -/** End [gprsbee] */ +/** End [sodaq_2g_bee_r6] */ // ========================================================================== diff --git a/examples/DRWI_2G/ReadMe.md b/examples/DRWI_2G/ReadMe.md index 013d26817..b39aad7db 100644 --- a/examples/DRWI_2G/ReadMe.md +++ b/examples/DRWI_2G/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_drwi_2g DRWI CitSci 2G Sites ) -# ModularSensors DRWI 2G Sites +# DRWI 2G Sites This is the code example that should be used for all groups working with the Stroud Water Research Center within the Delaware River Watershed Initiative. This should be used at all sites with cellular 2G service. @@ -12,7 +11,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [ModularSensors DRWI 2G Sites](#modularsensors-drwi-2g-sites) +- [DRWI 2G Sites](#drwi-2g-sites) - [Unique Features of the DRWI 2G Example](#unique-features-of-the-drwi-2g-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -25,16 +24,13 @@ _______ _______ -[//]: # ( @section example_drwi_2g_unique Unique Features of the DRWI 2G Example ) -# Unique Features of the DRWI 2G Example +# Unique Features of the DRWI 2G Example - Specifically for sites within the Delaware River Watershed Initiative. - Uses a Sodaq 2GBee for live data. -[//]: # ( @section example_drwi_2g_use To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_drwi_2g_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/DRWI_CitSci/platformio.ini) file in the examples/DRWI_CitSci folder on GitHub. @@ -45,8 +41,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_drwi_2g_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -54,8 +49,7 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_drwi_2g_obs3_calibration Set the calibration coefficients for the Campbell OBS3+ ) -## Set the calibration coefficients for the Campbell OBS3+ +## Set the calibration coefficients for the Campbell OBS3+ - The OBS3+ ships with a calibration certificate; you need this sheet! - Change _**all**_ of the the `0.000E+00` and `1.000E+00` values in this section of code to the values on that calibration sheet. Use numbers from the side of the calibration sheet that shows the calibration in _**volts**_. @@ -84,8 +78,7 @@ const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, OBSHigh_C, ADSi2c_addr, OBS3numberReadings); ``` -[//]: # ( @subsection example_drwi_2g_uuids Set the universally universal identifiers (UUID) for each variable ) -## Set the universally universal identifiers (UUID) for each variable +## Set the universally universal identifiers (UUID) for each variable - Go back to the web page for your site at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Find and click the white "View Token UUID List" button above the small map on your site page - **VERY CAREFULLY** check that the variables are in exactly the same order as in the variable array: @@ -124,8 +117,7 @@ const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampli ``` -[//]: # ( @subsection example_drwi_2g_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -136,3 +128,5 @@ _______ [//]: # ( @include{lineno} DRWI_2G/platformio.ini ) [//]: # ( @section example_drwi_2g_code The Complete Code ) + +[//]: # ( @include{lineno} DRWI_2G/DRWI_2G.ino ) diff --git a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino index eac7032ef..a94453221 100644 --- a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino +++ b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino @@ -3,7 +3,7 @@ * @brief Example for DRWI CitSci LTE sites. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -78,7 +78,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // ========================================================================== // Wifi/Cellular Modem Options // ========================================================================== -/** Start [xbee_cell_transparent] */ +/** Start [digi_xbee_cellular_transparent] */ // For any Digi Cellular XBee's // NOTE: The u-blox based Digi XBee's (3G global and LTE-M global) // are more stable used in bypass mode (below) @@ -107,7 +107,7 @@ DigiXBeeCellularTransparent modemXBCT(&modemSerial, modemVccPin, modemStatusPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name DigiXBeeCellularTransparent modem = modemXBCT; -/** End [xbee_cell_transparent] */ +/** End [digi_xbee_cellular_transparent] */ // ========================================================================== diff --git a/examples/DRWI_DigiLTE/ReadMe.md b/examples/DRWI_DigiLTE/ReadMe.md index 139aadfa0..0678e1d11 100644 --- a/examples/DRWI_DigiLTE/ReadMe.md +++ b/examples/DRWI_DigiLTE/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_drwi_digilte DRWI CitSci Digi LTE Sites ) -# Example using the Modular Sensors Library for DRWI Digi LTE Sites +# DRWI Digi LTE Sites This is the code example that should be used for all groups working with the Stroud Water Research Center within the Delaware River Watershed Initiative. This should be used at all sites with cellular LTE service. @@ -12,7 +11,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Example using the Modular Sensors Library for DRWI Digi LTE Sites](#example-using-the-modular-sensors-library-for-drwi-digi-lte-sites) +- [DRWI Digi LTE Sites](#drwi-digi-lte-sites) - [Unique Features of the DRWI Digi LTE Example](#unique-features-of-the-drwi-digi-lte-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -25,16 +24,13 @@ _______ _______ -[//]: # ( @section example_drwi_digilte_unique Unique Features of the DRWI Digi LTE Example ) -# Unique Features of the DRWI Digi LTE Example +# Unique Features of the DRWI Digi LTE Example - Specifically for sites within the Delaware River Watershed Initiative. - Uses a Digi XBee3 LTE-M for live data. -[//]: # ( @section example_drwi_digilte_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_drwi_digilte_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/DRWI_DigiLTE/platformio.ini) file in the examples/DRWI_DigiLTE folder on GitHub. @@ -45,8 +41,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_drwi_digilte_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -54,8 +49,7 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_drwi_digilte_obs3_calibration Set the calibration coefficients for the Campbell OBS3+ ) -## Set the calibration coefficients for the Campbell OBS3+ +## Set the calibration coefficients for the Campbell OBS3+ - The OBS3+ ships with a calibration certificate; you need this sheet! - Change _**all**_ of the the `0.000E+00` and `1.000E+00` values in this section of code to the values on that calibration sheet. Use numbers from the side of the calibration sheet that shows the calibration in _**volts**_. @@ -84,8 +78,7 @@ const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, OBSHigh_C, ADSi2c_addr, OBS3numberReadings); ``` -[//]: # ( @subsection example_drwi_digilte_uuids Set the universally universal identifiers (UUID) for each variable ) -## Set the universally universal identifiers (UUID) for each variable +## Set the universally universal identifiers (UUID) for each variable - Go back to the web page for your site at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Find and click the white "View Token UUID List" button above the small map on your site page - **VERY CAREFULLY** check that the variables are in exactly the same order as in the variable array: @@ -124,8 +117,7 @@ const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampli ``` -[//]: # ( @subsection example_drwi_digilte_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -136,3 +128,5 @@ _______ [//]: # ( @include{lineno} DRWI_DigiLTE/platformio.ini ) [//]: # ( @section example_drwi_digilte_code The Complete Code ) + +[//]: # ( @include{lineno} DRWI_DigiLTE/DRWI_DigiLTE.ino ) diff --git a/examples/DRWI_NoCellular/DRWI_NoCellular.ino b/examples/DRWI_NoCellular/DRWI_NoCellular.ino index ae715354c..f4afe8bde 100644 --- a/examples/DRWI_NoCellular/DRWI_NoCellular.ino +++ b/examples/DRWI_NoCellular/DRWI_NoCellular.ino @@ -3,7 +3,7 @@ * @brief Example for DRWI CitSci without cellular service. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -14,7 +14,6 @@ * THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. * ======================================================================= */ - // ========================================================================== // Include the libraries required for any data logger // ========================================================================== diff --git a/examples/DRWI_NoCellular/ReadMe.md b/examples/DRWI_NoCellular/ReadMe.md index fa400c5b8..982a481dd 100644 --- a/examples/DRWI_NoCellular/ReadMe.md +++ b/examples/DRWI_NoCellular/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_drwi_no_cell DRWI CitSci Sites without Live Data ) -# ModularSensors for DRWI sites with no Cellular Service +# DRWI sites with no Cellular Service This is the code example that should be used for all groups working with the Stroud Water Research Center within the Delaware River Watershed Initiative. This example should be used in cases where no cellular service of any kind is available and the data will only be logged on the SD card. @@ -14,7 +13,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [ModularSensors for DRWI sites with no Cellular Service](#modularsensors-for-drwi-sites-with-no-cellular-service) +- [DRWI sites with no Cellular Service](#drwi-sites-with-no-cellular-service) - [Unique Features of the DRWI LTE Example](#unique-features-of-the-drwi-lte-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -27,16 +26,13 @@ _______ _______ -[//]: # ( @section example_drwi_no_cell_unique Unique Features of the DRWI No Cellular Example ) -# Unique Features of the DRWI LTE Example +# Unique Features of the DRWI LTE Example - Specifically for sites within the Delaware River Watershed Initiative. - Does *not* include any live data uploads. -[//]: # ( @section example_drwi_no_cell_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_drwi_no_cell_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/DRWI_NoCellular/platformio.ini) file in the examples/DRWI_NoCellular folder on GitHub. @@ -47,8 +43,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_drwi_no_cell_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -56,8 +51,7 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_drwi_no_cell_obs3_calibration Set the calibration coefficients for the Campbell OBS3+ ) -## Set the calibration coefficients for the Campbell OBS3+ +## Set the calibration coefficients for the Campbell OBS3+ - The OBS3+ ships with a calibration certificate; you need this sheet! - Change _**all**_ of the the `0.000E+00` and `1.000E+00` values in this section of code to the values on that calibration sheet. Use numbers from the side of the calibration sheet that shows the calibration in _**volts**_. @@ -86,8 +80,7 @@ const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, OBSHigh_C, ADSi2c_addr, OBS3numberReadings); ``` -[//]: # ( @subsection example_drwi_no_cell_uuids Set the universally universal identifiers (UUID) for each variable ) -## Set the universally universal identifiers (UUID) for each variable +## Set the universally universal identifiers (UUID) for each variable - Go back to the web page for your site at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Find and click the white "View Token UUID List" button above the small map on your site page - **VERY CAREFULLY** check that the variables are in exactly the same order as in the variable array: @@ -124,8 +117,7 @@ const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampli ``` -[//]: # ( @subsection example_drwi_no_cell_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -136,3 +128,5 @@ _______ [//]: # ( @include{lineno} DRWI_NoCellular/platformio.ini ) [//]: # ( @section example_drwi_no_cell_code The Complete Code ) + +[//]: # ( @include{lineno} DRWI_NoCellular/DRWI_NoCellular.ino ) diff --git a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino index 84a13760c..ef55c40e6 100644 --- a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino +++ b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino @@ -10,7 +10,7 @@ * Campbell Scientific OBS3+ Turbidity sensor * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -85,7 +85,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // ========================================================================== // Wifi/Cellular Modem Options // ========================================================================== -/** Start [sim7080] */ +/** Start [sim_com_sim7080] */ // For almost anything based on the SIMCom SIM7080G #include @@ -97,7 +97,8 @@ const int32_t modemBaud = 9600; // SIM7080 does auto-bauding by default, but // 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 --- +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 @@ -117,7 +118,7 @@ SIMComSIM7080 modem7080(&modemSerial, modemVccPin, modemStatusPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name SIMComSIM7080 modem = modem7080; -/** End [sim7080] */ +/** End [sim_com_sim7080] */ // ========================================================================== diff --git a/examples/DRWI_SIM7080LTE/ReadMe.md b/examples/DRWI_SIM7080LTE/ReadMe.md index b71349bdb..ac22bf359 100644 --- a/examples/DRWI_SIM7080LTE/ReadMe.md +++ b/examples/DRWI_SIM7080LTE/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_drwi_ediylte DRWI CitSci Sites with EnviroDIY LTE Bees ) -# Example using the Modular Sensors Library for DRWI Sites with EnviroDIY LTE Bees +# DRWI Sites with EnviroDIY LTE Bees Example sketch for using the EnviroDIY SIM7080G LTE cellular module with an EnviroDIY Mayfly Data Logger. The exact hardware configuration used in this example: @@ -22,15 +21,14 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Example using the Modular Sensors Library for DRWI Sites with EnviroDIY LTE Bees](#example-using-the-modular-sensors-library-for-drwi-sites-with-envirodiy-lte-bees) +- [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 ) _______ -[//]: # ( @section example_drwi_ediylte_unique Unique Features of the DRWI EnviroDIY LTE Example ) -# Unique Features of the DRWI EnviroDIY LTE Example +# 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 @@ -40,3 +38,5 @@ _______ [//]: # ( @include{lineno} DRWI_SIM7080LTE/platformio.ini ) [//]: # ( @section example_drwi_ediylte_code The Complete Code ) + +[//]: # ( @include{lineno} DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino ) diff --git a/examples/ReadMe.md b/examples/ReadMe.md index 9cd6931c9..494ec7333 100644 --- a/examples/ReadMe.md +++ b/examples/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page page_the_examples Examples ) -# Examples Using ModularSensors +# Examples Using ModularSensors These example programs demonstrate how to use the modular sensors library. Each example has slightly different functionality. @@ -31,155 +30,137 @@ ___ [//]: # ( @tableofcontents ) -[//]: # ( @section examples_basic Basic Functionality ) -## Basic Functionality +## Basic Functionality -[//]: # ( @subsection examples_single_sensor Single Sensor ) -### Single Sensor +### Single Sensor The single_sensor example shows making use of the unified set of commands to print data from a MaxBotix ultrasonic range finder to the serial port. It also shows creating a calculated variable which is the water depth. -- [Instructions for the single sensor example](https://envirodiy.github.io/ModularSensors/single_sensor_8ino-example.html) +- [Instructions for the single sensor example](https://envirodiy.github.io/ModularSensors/example_single_sensor.html) - [The single sensor example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/single_sensor) -[//]: # ( @subsection examples_simple_logging Simple Logging ) -### Simple Logging +### Simple Logging The simple logging example shows how to create multiple sensors, create variables for the sensors in a variable array, and log the data from the sensors to an SD card. -- [Instructions for the simple logging example](https://envirodiy.github.io/ModularSensors/simple_logging_8ino-example.html) +- [Instructions for the simple logging example](https://envirodiy.github.io/ModularSensors/example_simple_logging.html) - [The simple logging example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/simple_logging) -[//]: # ( @subsection examples_learn_envirodiy Simple Logging for the Learn EnviroDIY course ) -### Simple Logging for the Learn EnviroDIY course +### Simple Logging for the Learn EnviroDIY course The simple logging example for the [Learn EnviroDIY programming course](https://envirodiy.github.io/LearnEnviroDIY/) shows how to create multiple sensors, create variables for the sensors in a variable array, and log the data from the sensors to an SD card. It is very similar to the other simple logging example, with just a few extra sensors. -- [Instructions for the learn EnviroDIY course example](https://envirodiy.github.io/ModularSensors/simple_logging__learn_enviro_d_i_y_8ino-example.html) +- [Instructions for the learn EnviroDIY course example](https://envirodiy.github.io/ModularSensors/example_learn_envirodiy.html) - [The learn EnviroDIY course example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/simple_logging_LearnEnviroDIY) ___ -[//]: # ( @section examples_publishing Publishing Data ) -## Publishing Data +## Publishing Data -[//]: # ( @subsection examples_mmw Publishing to Monitor My Watershed ) -### Publishing to Monitor My Watershed +### Publishing to Monitor My Watershed The logging to Monitor My Watershed example uses a Digi XBee in transparent mode to publish data live from a BME280 and Maxim DS18 to the Monitor My Watershed data portal. -- [Instructions for the logging to Monitor My Watershed example](https://envirodiy.github.io/ModularSensors/logging_to__m_m_w_8ino-example.html) +- [Instructions for the logging to Monitor My Watershed example](https://envirodiy.github.io/ModularSensors/example_mmw.html) - [The logging to Monitor My Watershed example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/logging_to_MMW) -[//]: # ( @subsection examples_thingspeak Publishing to ThingSpeak ) -### Publishing to ThingSpeak +### Publishing to ThingSpeak The logging to ThingSpeak example uses an ESP8266 to send data to ThingSpeak. It also includes a Meter Hydros 21 (formerly know as a Decagon CTD) and a Campbell OBS3+. -- [Instructions for the logging to ThingSpeak example](https://envirodiy.github.io/ModularSensors/logging_to__thing_speak_8ino-example.html) +- [Instructions for the logging to ThingSpeak example](https://envirodiy.github.io/ModularSensors/example_thingspeak.html) - [The logging to ThingSpeak example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/logging_to_ThingSpeak) ___ -[//]: # ( @section examples_complex Calculations and Complex Logging ) -## Calculations and Complex Logging +## Calculations and Complex Logging -[//]: # ( @subsection examples_baro_rho Barometric Pressure Correction ) -### Barometric Pressure Correction +### Barometric Pressure Correction The barometric pressure correction example demonstrates how to work with calculated variables and calculates water depth by correcting the total pressure measured by a MeaSpec MS5803 with the atmospheric pressure measured by a Bosch BME280 environmental sensor and the temperature measured by a Maxim DS18 temperature probe. -- [Instructions for the barometric pressure correction example](https://envirodiy.github.io/ModularSensors/baro_rho_correction_8ino-example.html) +- [Instructions for the barometric pressure correction example](https://envirodiy.github.io/ModularSensors/example_baro_rho.html) - [The barometric pressure correction example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/baro_rho_correction) -[//]: # ( @subsection examples_double_log Multiple Logging Intervals ) -### Multiple Logging Intervals +### Multiple Logging Intervals The more complicated double logger example using two different logger instances to log data at two different intervals, in this case, an AM3215 logging every minute, while checking the battery voltage only every 5 minutes. This showcases both how to use two different logging instances and how to use some of the functions to set up your own logging loop rather than using the logData() function. -- [Instructions for the double logger example](https://envirodiy.github.io/ModularSensors/double_logger_8ino-example.html) +- [Instructions for the double logger example](https://envirodiy.github.io/ModularSensors/example_double_log.html) - [The double logger example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/double_logger) -[//]: # ( @subsection examples_data_saving Minimizing Cell Data Usage ) -### Minimizing Cell Data Usage +### Minimizing Cell Data Usage The data saving example is another double logger example, but in this case, both loggers are going at the same interval and the only difference between the loggers is the list of variables. There are two sets of variables, all coming from Yosemitech sensors. Because each sensor outputs temperature and we don't want to waste cellular data sending out multiple nearly identical temperature values, we have one logger that logs every possible variable result to the SD card and another logger that sends only unique results to the EnviroDIY data portal. This example also shows how to stop power draw from an RS485 adapter with automatic flow detection. -- [Instructions for the data saving example](https://envirodiy.github.io/ModularSensors/data_saving_8ino-example.html) +- [Instructions for the data saving example](https://envirodiy.github.io/ModularSensors/example_data_saving.html) - [The data saving example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/data_saving) ___ -[//]: # ( @section examples_drwi DRWI Citizen Science ) -## DRWI Citizen Science +## DRWI Citizen Science -[//]: # ( @subsection examples_drwi_ediylte DRWI EnviroDIY Bee LTE ) -### DRWI EnviroDIY Bee LTE +### DRWI EnviroDIY Bee LTE The DRWI EnviroDIY Bee LTE example uses the sensors and equipment standard groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros 21, a Campbell OBS3+, and a SIM7080G-based EnviroDIY Bee for communication. The results are saved to the SD card and posted to the Monitor My Watershed data portal. The only difference between this and the other cellular DRWI examples is the type of modem used. -- [Instructions for the EnviroDIY LTE DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/_d_r_w_i__l_t_e_8ino-example.html) +- [Instructions for the EnviroDIY LTE DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_ediylte.html) - [The LTEG DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) -[//]: # ( @subsection examples_drwi_digilte DRWI Digi LTE ) -### DRWI Digi LTE +### DRWI Digi LTE The DRWI Digi LTE example uses the sensors and equipment standard groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros 21 (formerly know as a Decagon CTD), a Campbell OBS3+, and a Digi XBee3 LTE-M for communication. The results are saved to the SD card and posted to the Monitor My Watershed data portal. The only difference between this and the other cellular DRWI examples is the type of modem used. -- [Instructions for the Digi LTE DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/_d_r_w_i__digi_l_t_e_8ino-example.html) +- [Instructions for the Digi LTE DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_digilte.html) - [The LTEG DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) -[//]: # ( @subsection examples_drwi_2g DRWI CitSci (2G) ) -### DRWI CitSci (2G) +### DRWI CitSci (2G) The 2G DRWI Citizen Science example uses the sensors and equipment standard groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros 21 (formerly know as a Decagon CTD), a Campbell OBS3+, and a Sodaq GPRSBee for communication. The results are saved to the SD card and posted to the Monitor My Watershed data portal. The only difference between this and the other cellular DRWI examples is the type of modem used. -- [Instructions for the 2G DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/_d_r_w_i__cit_sci_8ino-example.html) +- [Instructions for the 2G DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_2g.html) - [The 2G DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_CitSci) -[//]: # ( @subsection examples_drwi_no_cell DRWI CitSci No Cellular ) -### DRWI CitSci No Cellular +### DRWI CitSci No Cellular The DRWI no cellular example uses the sensors and equipment standard to the DRWI Citizen Science grant but omits the data publisher for circumstances where there is no cellular signal. The exclusion of the modem and publisher simplifies the code from the other DRWI examples and uses less power than running one of cellular versions without attaching the modem. -- [Instructions for the no-cellular DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/_d_r_w_i__no_cellular_8ino-example.html) +- [Instructions for the no-cellular DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_no_cell.html) - [The no-cellular DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_NoCellular) ___ -[//]: # ( @section examples_everything Everything at Once - a la carte ) -## Everything at Once - a la carte +## Everything at Once - a la carte -[//]: # ( @subsection examples_menu Menu a la carte ) -### Menu a la carte +### Menu a la carte The "menu a la carte" example shows most of the functions of the library in one gigantic program. It has code in it for every possible sensor and modem and for both AVR and SAMD boards. @@ -187,7 +168,7 @@ It is also over 1500 lines long. This examples is intended to be used like an a la carte menu of all possible options where you selected only the portions of code pertenent to you and delete everything else. This example is *NOT* intended to be run in its entirety -- [The menu a la carte walkthrough](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html) +- [The menu a la carte walkthrough](https://envirodiy.github.io/ModularSensors/example_menu.html) - Unlike the instructions for the other examples which show how to modify the example for your own use, this is a chunk-by-chunk step through of the code with explanations of each portion of the code and links to further documentation on each sensor. - There is a table of contents at the top of the walkthrough; I *strongly* recommend using that to skip through to the portions you are interested in - [The a la carte example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/menu_a_la_carte) diff --git a/examples/baro_rho_correction/ReadMe.md b/examples/baro_rho_correction/ReadMe.md index 13216c296..e50395b0d 100644 --- a/examples/baro_rho_correction/ReadMe.md +++ b/examples/baro_rho_correction/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_baro_rho Barometric Pressure Correction ) -# Using ModularSensors to Calculate Results based on Measured Values +# Calculating Results based on Measured Values This example demonstrates how to work with calculated variables and calculates water depth by correcting the total pressure measured by a MeaSpec MS5803 with the atmospheric pressure measured by a Bosch BME280 environmental sensor and the temperature measured by a Maxim DS18 temperature probe. @@ -12,7 +11,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to Calculate Results based on Measured Values](#using-modularsensors-to-calculate-results-based-on-measured-values) +- [Calculating Results based on Measured Values](#calculating-results-based-on-measured-values) - [Unique Features of the Barometric Correction Example](#unique-features-of-the-barometric-correction-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -24,16 +23,13 @@ _______ _______ -[//]: # ( @section example_baro_rho_unique Unique Features of the Barometric Correction Example ) -# Unique Features of the Barometric Correction Example +# Unique Features of the Barometric Correction Example - All variables are created and named with their parent sensor (as opposed to being created within the variable array). - There are multiple calculated variables created and used. -[//]: # ( @section example_baro_rho_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_baro_rho_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/baro_rho_correction/platformio.ini) file in the examples/baro_rho_correction folder on GitHub. @@ -44,8 +40,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_baro_rho_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -53,13 +48,11 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_baro_rho_uuids Set the universally universal identifiers (UUID) for each variable ) -## Set the universally universal identifiers (UUID) for each variable +## Set the universally universal identifiers (UUID) for each variable - Go back to the web page for your site at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - For each variable, find the dummy UUID (`"12345678-abcd-1234-ef00-1234567890ab"`) and replace it with the real UUID for the variable. -[//]: # ( @subsection example_baro_rho_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -69,3 +62,5 @@ _______ [//]: # ( @include{lineno} baro_rho_correction/platformio.ini ) [//]: # ( @section example_baro_rho_code The Complete Code ) + +[//]: # ( @include{lineno} baro_rho_correction/baro_rho_correction.ino ) diff --git a/examples/baro_rho_correction/baro_rho_correction.ino b/examples/baro_rho_correction/baro_rho_correction.ino index f7f1a4b95..b28f0038b 100644 --- a/examples/baro_rho_correction/baro_rho_correction.ino +++ b/examples/baro_rho_correction/baro_rho_correction.ino @@ -3,7 +3,7 @@ * @brief Example demonstrating calculated variables. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -79,7 +79,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // ========================================================================== // Wifi/Cellular Modem Options // ========================================================================== -/** Start [gprsbee] */ +/** Start [sodaq_2g_bee_r6] */ // For the Sodaq 2GBee R6 and R7 based on the SIMCom SIM800 // NOTE: The Sodaq GPRSBee doesn't expose the SIM800's reset pin #include @@ -112,7 +112,7 @@ Variable* modemRSSI = new Modem_RSSI(&modem, "12345678-abcd-1234-ef00-1234567890ab", "RSSI"); Variable* modemSignalPct = new Modem_SignalPercent( &modem, "12345678-abcd-1234-ef00-1234567890ab", "signalPercent"); -/** End [gprsbee] */ +/** End [sodaq_2g_bee_r6] */ // ========================================================================== diff --git a/examples/data_saving/ReadMe.md b/examples/data_saving/ReadMe.md index 46e124d11..48c002046 100644 --- a/examples/data_saving/ReadMe.md +++ b/examples/data_saving/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_data_saving Data Saving Example ) -# Using ModularSensors to Record data from Many Variables but Only Send a Portion to the EnviroDIY Data Portal +# Minimizing Cellular Data Use This is another double logger example, but in this case, both loggers are going at the same interval and the only difference between the loggers is the list of variables. There are two sets of variables, all coming from Yosemitech sensors. @@ -14,7 +13,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to Record data from Many Variables but Only Send a Portion to the EnviroDIY Data Portal](#using-modularsensors-to-record-data-from-many-variables-but-only-send-a-portion-to-the-envirodiy-data-portal) +- [Minimizing Cellular Data Use](#minimizing-cellular-data-use) - [Unique Features of the Data Saving Example](#unique-features-of-the-data-saving-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -26,8 +25,7 @@ _______ _______ -[//]: # ( @section example_data_saving_unique Unique Features of the Data Saving Example ) -# Unique Features of the Data Saving Example +# Unique Features of the Data Saving Example - Uses AltSoftSerial to create an additional serial port for RS485 communication. - All variables are created and named with their parent sensor (as opposed to being created within the variable array). - Two different variable arrays and loggers are created and used. @@ -37,11 +35,9 @@ _______ - This demonstrates *how* to write the loop out, without using the `logData` functions. - It also shows how to forcibly set serial pins `LOW` at the start and end of the loop in order to prevent power loss through an RS485 adapter. -[//]: # ( @section example_data_saving_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_data_saving_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/data_saving/platformio.ini) file in the examples/data_saving folder on GitHub. @@ -52,8 +48,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_data_saving_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -61,13 +56,11 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_data_saving_uuids Set the universally universal identifiers (UUID) for each variable ) -## Set the universally universal identifiers (UUID) for each variable +## Set the universally universal identifiers (UUID) for each variable - Go back to the web page for your site at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - For each variable, find the dummy UUID (`"12345678-abcd-1234-ef00-1234567890ab"`) and replace it with the real UUID for the variable. -[//]: # ( @subsection example_data_saving_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -78,3 +71,5 @@ _______ [//]: # ( @include{lineno} data_saving/platformio.ini ) [//]: # ( @section example_data_saving_code The Complete Code ) + +[//]: # ( @include{lineno} data_saving/data_saving.ino ) diff --git a/examples/data_saving/data_saving.ino b/examples/data_saving/data_saving.ino index 8e416a615..6c8a3d304 100644 --- a/examples/data_saving/data_saving.ino +++ b/examples/data_saving/data_saving.ino @@ -3,7 +3,7 @@ * @brief Example publishing only a portion of the logged variables. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -125,7 +125,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // ========================================================================== // Wifi/Cellular Modem Options // ========================================================================== -/** Start [gprsbee] */ +/** Start [sodaq_2g_bee_r6] */ // For the Sodaq 2GBee R6 and R7 based on the SIMCom SIM800 // NOTE: The Sodaq GPRSBee doesn't expose the SIM800's reset pin #include @@ -152,7 +152,7 @@ Variable* modemRSSI = new Modem_RSSI(&modem, "12345678-abcd-1234-ef00-1234567890ab"); Variable* modemSignalPct = new Modem_SignalPercent(&modem, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [gprsbee] */ +/** End [sodaq_2g_bee_r6] */ // ========================================================================== diff --git a/examples/double_logger/ReadMe.md b/examples/double_logger/ReadMe.md index 7d6e32166..c34f66cc6 100644 --- a/examples/double_logger/ReadMe.md +++ b/examples/double_logger/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_double_log Double %Logger Example ) -# Using ModularSensors to Record data from Two Different Groups of Sensors at Two Different Time Intervals +# Multiple Time Intervals This is a more complicated example using two different logger instances to log data at two different intervals, in this case, an AM3215 logging every minute, while checking the battery voltage only every 5 minutes. This showcases both how to use two different logging instances and how to use some of the functions to set up your own logging loop rather than using the logData() function. @@ -9,7 +8,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to Record data from Two Different Groups of Sensors at Two Different Time Intervals](#using-modularsensors-to-record-data-from-two-different-groups-of-sensors-at-two-different-time-intervals) +- [Multiple Time Intervals](#multiple-time-intervals) - [Unique Features of the Double Logger Example](#unique-features-of-the-double-logger-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -20,8 +19,7 @@ _______ _______ -[//]: # ( @section example_double_log_unique Unique Features of the Double %Logger Example ) -# Unique Features of the Double Logger Example +# Unique Features of the Double Logger Example - Two different variable arrays and loggers are created and used. - The Variables for the arrays are created within the array. - There is no variable overlap between the two arrays or loggers. @@ -29,11 +27,9 @@ _______ - This demonstrates *how* to write the loop out, without using the `logData` functions. - This shows which functions are required for each of the two loggers and which can be used in common. -[//]: # ( @section example_double_log_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_double_log_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/double_logger/platformio.ini) file in the examples/double_logger folder on GitHub. - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. @@ -43,8 +39,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_double_log_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -52,8 +47,7 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_double_log_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -64,3 +58,5 @@ _______ [//]: # ( @include{lineno} double_logger/platformio.ini ) [//]: # ( @section example_double_log_code The Complete Code ) + +[//]: # ( @include{lineno} double_logger/double_logger.ino ) diff --git a/examples/double_logger/double_logger.ino b/examples/double_logger/double_logger.ino index 14a143d09..1421d09dd 100644 --- a/examples/double_logger/double_logger.ino +++ b/examples/double_logger/double_logger.ino @@ -3,7 +3,7 @@ * @brief Example logging at two different timing intervals * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -135,14 +135,14 @@ MaximDS3231 ds3231(1); // ========================================================================== // AOSong AM2315 Digital Humidity and Temperature Sensor // ========================================================================== -/** Start [am2315] */ +/** Start [ao_song_am2315] */ #include const int8_t I2CPower = sensorPowerPin; // Power pin (-1 if unconnected) // Create and return the AOSong AM2315 sensor object AOSongAM2315 am2315(I2CPower); -/** End [am2315] */ +/** End [ao_song_am2315] */ // ========================================================================== diff --git a/examples/examples.dox b/examples/examples.dox new file mode 100644 index 000000000..786e2f156 --- /dev/null +++ b/examples/examples.dox @@ -0,0 +1,116 @@ +/** + * @page page_the_examples + * @m_innerpage{page_examples_basic} + * @page page_examples_basic Basic Functionality + * [Basic Functionality](@ref examples_basic) + * @m_innerpage{example_single_sensor} + * @m_innerpage{example_simple_logging} + * @m_innerpage{example_learn_envirodiy} + */ +/** + * @example{lineno} single_sensor.ino @m_examplenavigation{example_single_sensor,} @m_footernavigation + * @brief An example using only sensor functions and no logging. + * See [the walkthrough page](@ref example_single_sensor) for detailed instructions. + */ +/** + * @example{lineno} simple_logging.ino @m_examplenavigation{example_simple_logging,} @m_footernavigation + * @brief A simple data logging example. + * See [the walkthrough page](@ref example_simple_logging) for detailed instructions. + */ +/** + * @example{lineno} simple_logging_LearnEnviroDIY.ino @m_examplenavigation{example_learn_envirodiy,} @m_footernavigation + * @brief A data logging example for the Learn EnviroDIY tutorial. + * See [the walkthrough page](@ref example_learn_envirodiy) for detailed instructions. + */ + + +/** + * @page page_the_examples + * @m_innerpage{page_examples_outgoing_data} + * @page page_examples_outgoing_data Publishing Data + * [Publishing Data](@ref examples_publishing) + * @m_innerpage{example_mmw} + * @m_innerpage{example_thingspeak} + */ +/** + * @example{lineno} logging_to_MMW.ino @m_examplenavigation{example_mmw,} @m_footernavigation + * @brief Example logging data and publishing to Monitor My Watershed. + * See [the walkthrough page](@ref example_mmw) for detailed instructions. + */ +/** + * @example{lineno} logging_to_ThingSpeak.ino @m_examplenavigation{example_thingspeak,} @m_footernavigation + * @brief Example logging data and publishing to ThingSpeak. + * See [the walkthrough page](@ref example_thingspeak) for detailed instructions. + */ + + +/** + * @page page_the_examples + * @m_innerpage{page_examples_complex} + * @page page_examples_complex Calculations and Complex Logging + * [Calculations and Complex Logging](@ref examples_complex) + * @m_innerpage{example_baro_rho} + * @m_innerpage{example_double_log} + * @m_innerpage{example_data_saving} + */ +/** + * @example{lineno} baro_rho_correction.ino @m_examplenavigation{example_baro_rho,} @m_footernavigation + * @brief Example demonstrating calculated variables. + * See [the walkthrough page](@ref example_baro_rho) for detailed instructions. + */ +/** + * @example{lineno} double_logger.ino @m_examplenavigation{example_double_log,} @m_footernavigation + * @brief Example logging at two different timing intervals + * See [the walkthrough page](@ref example_double_log) for detailed instructions. + */ +/** + * @example{lineno} data_saving.ino @m_examplenavigation{example_data_saving,} @m_footernavigation + * @brief Example publishing only a portion of the logged variables. + * See [the walkthrough page](@ref example_data_saving) for detailed instructions. + */ + + +/** + * @page page_the_examples + * @m_innerpage{page_examples_drwi} + * @page page_examples_drwi DRWI Citizen Science + * [DRWI Citizen Science](@ref examples_drwi) + * @m_innerpage{example_drwi_ediylte} + * @m_innerpage{example_drwi_digilte} + * @m_innerpage{example_drwi_2g} + * @m_innerpage{example_drwi_no_cell} + */ +/** + * @example{lineno} DRWI_SIM7080LTE.ino @m_examplenavigation{example_drwi_ediylte,} @m_footernavigation + * @brief Example for DRWI CitSci LTE sites. + * See [the walkthrough page](@ref example_drwi_ediylte) for detailed instructions. + */ +/** + * @example{lineno} DRWI_DigiLTE.ino @m_examplenavigation{example_drwi_digilte,} @m_footernavigation + * @brief Example for DRWI CitSci LTE sites. + * See [the walkthrough page](@ref example_drwi_digilte) for detailed instructions. + */ +/** + * @example{lineno} DRWI_2G.ino @m_examplenavigation{example_drwi_2g,} @m_footernavigation + * @brief Example for DRWI CitSci 2G sites. + * See [the walkthrough page](@ref example_drwi_2g) for detailed instructions. + */ +/** + * @example{lineno} DRWI_NoCellular.ino @m_examplenavigation{example_drwi_no_cell,} @m_footernavigation + * @brief Example for DRWI CitSci without cellular service. + * See [the walkthrough page](@ref example_drwi_no_cell) for detailed instructions. + */ + + +/** + * @page page_the_examples + * @m_innerpage{page_examples_menu} + * @page page_examples_menu Everything at Once - a la carte + * [Everything at Once - a la carte](@ref examples_everything) + * @m_innerpage{example_menu} + */ +/** + * @example{lineno} menu_a_la_carte.ino @m_examplenavigation{example_menu,} @m_footernavigation + * @brief Example with all possible functionality. + * See [the walkthrough page](@ref example_menu) for detailed instructions. + */ \ No newline at end of file diff --git a/examples/logging_to_MMW/ReadMe.md b/examples/logging_to_MMW/ReadMe.md index 291212bec..c58f6e4cb 100644 --- a/examples/logging_to_MMW/ReadMe.md +++ b/examples/logging_to_MMW/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_mmw Monitor My Watershed Example ) -# Using ModularSensors to log data to Monitor My Watershed/EnviroDIY +# Sending Data to Monitor My Watershed/EnviroDIY This sketch reduces menu_a_la_carte.ino to provide an example of how to log to https://monitormywatershed.org/ from two sensors, the BME280 and DS18. To complete the set up for logging to the web portal, the UUIDs for the site and each variable would need to be added to the sketch. @@ -14,7 +13,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to log data to Monitor My Watershed/EnviroDIY](#using-modularsensors-to-log-data-to-monitor-my-watershedenvirodiy) +- [Sending Data to Monitor My Watershed/EnviroDIY](#sending-data-to-monitor-my-watershedenvirodiy) - [Unique Features of the Monitor My Watershed Example](#unique-features-of-the-monitor-my-watershed-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -26,16 +25,13 @@ _______ _______ -[//]: # ( @section example_mmw_unique Unique Features of the Monitor My Watershed Example ) -# Unique Features of the Monitor My Watershed Example +# Unique Features of the Monitor My Watershed Example - A single logger publishes data to the Monitor My Watershed data portal. - Uses a cellular Digi XBee or XBee3 -[//]: # ( @section example_mmw_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_mmw_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/logging_to_MMW/platformio.ini) file in the examples/logging_to_MMW folder on GitHub. @@ -46,8 +42,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_mmw_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -55,13 +50,11 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_mmw_uuids Set the universally universal identifiers (UUID) for each variable ) -## Set the universally universal identifiers (UUID) for each variable +## Set the universally universal identifiers (UUID) for each variable - Go back to the web page for your site at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) - For each variable, find the dummy UUID (`"12345678-abcd-1234-ef00-1234567890ab"`) and replace it with the real UUID for the variable. -[//]: # ( @subsection example_mmw_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -71,3 +64,5 @@ _______ [//]: # ( @include{lineno} logging_to_MMW/platformio.ini ) [//]: # ( @section example_mmw_code The Complete Code ) + +[//]: # ( @include{lineno} logging_to_MMW/logging_to_MMW.ino ) diff --git a/examples/logging_to_MMW/logging_to_MMW.ino b/examples/logging_to_MMW/logging_to_MMW.ino index 172e9d09a..cd2827572 100644 --- a/examples/logging_to_MMW/logging_to_MMW.ino +++ b/examples/logging_to_MMW/logging_to_MMW.ino @@ -3,7 +3,7 @@ * @brief Example logging data and publishing to Monitor My Watershed. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -78,7 +78,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // ========================================================================== // Wifi/Cellular Modem Options // ========================================================================== -/** Start [xbee_cell_transparent] */ +/** Start [digi_xbee_cellular_transparent] */ // For any Digi Cellular XBee's // NOTE: The u-blox based Digi XBee's (3G global and LTE-M global) can be used // in either bypass or transparent mode, each with pros and cons @@ -109,7 +109,7 @@ DigiXBeeCellularTransparent modemXBCT(&modemSerial, modemVccPin, modemStatusPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name DigiXBeeCellularTransparent modem = modemXBCT; -/** End [xbee_cell_transparent] */ +/** End [digi_xbee_cellular_transparent] */ // ========================================================================== diff --git a/examples/logging_to_ThingSpeak/ReadMe.md b/examples/logging_to_ThingSpeak/ReadMe.md index e426ddf21..5e7560e44 100644 --- a/examples/logging_to_ThingSpeak/ReadMe.md +++ b/examples/logging_to_ThingSpeak/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_thingspeak ThingSpeak Example ) -# Using ModularSensors to save data to an SD card and send data to ThingSpeak +# Sending data to ThingSpeak This shows the use of a "ThingSpeak logger" object. Data is sent to [ThingSpeak](https://thingspeak.com) using MQTT. @@ -9,7 +8,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to save data to an SD card and send data to ThingSpeak](#using-modularsensors-to-save-data-to-an-sd-card-and-send-data-to-thingspeak) +- [Sending data to ThingSpeak](#sending-data-to-thingspeak) - [Unique Features of the ThingSpeak Example](#unique-features-of-the-thingspeak-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -20,16 +19,13 @@ _______ _______ -[//]: # ( @section example_thingspeak_unique Unique Features of the ThingSpeak Example ) -# Unique Features of the ThingSpeak Example +# Unique Features of the ThingSpeak Example - A single logger publishes data to ThingSpeak. - Uses an Espressif ESP8266 to publish data. -[//]: # ( @section example_thingspeak_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_thingspeak_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Create a channel on ThingSpeak with fields to receive your data. - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/logging_to_ThingSpeak/platformio.ini) file in the examples/logging_to_ThingSpeak folder on GitHub. @@ -40,8 +36,7 @@ _______ - Move it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_thingspeak_modify Modify the Example ) -## Modify the Example +## Modify the Example - Modify logging_to_ThingSpeak.ino to have the modem, sensor, and variable objects that you are interested in. - This example is written for an _ESP8266 (wifi)_ modem. Change this to whatever modem you are using. @@ -66,8 +61,7 @@ const char *thingSpeakChannelID = "######"; // The numeric channel id for your const char *thingSpeakChannelKey = "XXXXXXXXXXXXXXXX"; // The Write API Key for your channel ``` -[//]: # ( @subsection example_thingspeak_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -78,3 +72,5 @@ _______ [//]: # ( @include{lineno} logging_to_ThingSpeak/platformio.ini ) [//]: # ( @section example_thingspeak_code The Complete Code ) + +[//]: # ( @include{lineno} logging_to_ThingSpeak/logging_to_ThingSpeak.ino ) diff --git a/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino b/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino index bcf4ee357..2d2c5b367 100644 --- a/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino +++ b/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino @@ -3,7 +3,7 @@ * @brief Example logging data and publishing to ThingSpeak. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -81,7 +81,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // ========================================================================== // Wifi/Cellular Modem Options // ========================================================================== -/** Start [esp8266] */ +/** Start [espressif_esp8266] */ // For almost anything based on the Espressif ESP8266 using the AT command // firmware #include @@ -118,7 +118,7 @@ EspressifESP8266 modemESP(&modemSerial, modemVccPin, modemStatusPin, espSleepRqPin, espStatusPin); // Create an extra reference to the modem by a generic name EspressifESP8266 modem = modemESP; -/** End [esp8266] */ +/** End [espressif_esp8266] */ // ========================================================================== diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index c5d8d0451..9ee0f73e1 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_menu A la carte Example ) -# Example showing all possible functionality +# Example showing all possible functionality This shows most of the functionality of the library at once. It has code in it for every possible sensor and modem and for both AVR and SAMD boards. @@ -9,11 +8,12 @@ To create your own code, I recommend starting from a much simpler targeted examp _______ -[//]: # ( @section example_menu_walk Walking Through the Code ) -# Walking Through the Code +# Walking Through the Code -_NOTE: This walkthrough is intended to be viewed here: https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html_ +[//]: # ( @note ) +*NOTE: This walkthrough is intended to be viewed on GitHub pages at https://envirodiy.github.io/ModularSensors/example_menu.html* +[//]: # ( @warning ) WARNING: This example is long. This walk-through is really, really long. Make use of the table of contents to skip to the parts you need. @@ -87,14 +87,15 @@ ___ - [Analog Electrical Conductivity using the Processor's Analog Pins](#analog-electrical-conductivity-using-the-processors-analog-pins) - [Yosemitech RS485/Modbus Environmental Sensors](#yosemitech-rs485modbus-environmental-sensors) - [Yosemitech Y504 Dissolved Oxygen Sensor](#yosemitech-y504-dissolved-oxygen-sensor) - - [Yosemitech Y510 Yosemitech Y510 Turbidity Sensor](#yosemitech-y510-yosemitech-y510-turbidity-sensor) - - [Yosemitech Y511 Yosemitech Y511 Turbidity Sensor with Wiper](#yosemitech-y511-yosemitech-y511-turbidity-sensor-with-wiper) - - [Yosemitech Y514 Yosemitech Y514 Chlorophyll Sensor](#yosemitech-y514-yosemitech-y514-chlorophyll-sensor) - - [Yosemitech Y520 Yosemitech Y520 Conductivity Sensor](#yosemitech-y520-yosemitech-y520-conductivity-sensor) - - [Yosemitech Y532 Yosemitech Y532 pH Sensor](#yosemitech-y532-yosemitech-y532-ph-sensor) - - [Yosemitech Y533 Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor](#yosemitech-y533-yosemitech-y533-oxidation-reduction-potential-orp-sensor) - - [Yosemitech Y551 Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper](#yosemitech-y551-yosemitech-y551-carbon-oxygen-demand-cod-sensor-with-wiper) - - [Yosemitech Y4000 Yosemitech Y4000 Multi-Parameter Sonde](#yosemitech-y4000-yosemitech-y4000-multi-parameter-sonde) + - [Yosemitech Y510 Turbidity Sensor](#yosemitech-y510-turbidity-sensor) + - [Yosemitech Y511 Turbidity Sensor with Wiper](#yosemitech-y511-turbidity-sensor-with-wiper) + - [Yosemitech Y514 Chlorophyll Sensor](#yosemitech-y514-chlorophyll-sensor) + - [Yosemitech Y520 Conductivity Sensor](#yosemitech-y520-conductivity-sensor) + - [Yosemitech Y532 pH Sensor](#yosemitech-y532-ph-sensor) + - [Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor](#yosemitech-y533-oxidation-reduction-potential-orp-sensor) + - [Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper](#yosemitech-y551-carbon-oxygen-demand-cod-sensor-with-wiper) + - [Yosemitech Y560 Ammonium Sensor](#yosemitech-y560-ammonium-sensor) + - [Yosemitech Y4000 Multi-Parameter Sonde](#yosemitech-y4000-multi-parameter-sonde) - [Zebra Tech D-Opto Dissolved Oxygen Sensor](#zebra-tech-d-opto-dissolved-oxygen-sensor) - [Calculated Variables](#calculated-variables) - [Creating the array, logger, publishers](#creating-the-array-logger-publishers) @@ -134,11 +135,9 @@ ___ [//]: # ( End GitHub Only ) -[//]: # ( @section menu_defines-and-includes Defines and Includes ) -## Defines and Includes +## Defines and Includes -[//]: # ( @subsection menu_defines Defines for the Arduino IDE ) -### Defines for the Arduino IDE +### Defines for the Arduino IDE The top few lines of the examples set defines of buffer sizes and yields needed for the Arduino IDE. That IDE read any defines within the top few lines and applies them as build flags for the processor. This is _not_ standard behavior for C++ (which is what Arduino code really is) - this is a unique aspect of the Arduino IDE. @@ -158,19 +157,17 @@ build_flags = ``` ___ -[//]: # ( @subsection menu_includes Library Includes ) -### Library Includes +### Library Includes Next, include the libraries needed for every program using ModularSensors. [//]: # ( @menusnip{includes} ) + ___ -[//]: # ( @section menu_logger_and_modem_settings Logger Settings ) -## Logger Settings +## Logger Settings -[//]: # ( @subsection menu_serial_ports Creating Extra Serial Ports ) -### Creating Extra Serial Ports +### Creating Extra Serial Ports This section of the example has all the code to create and link to serial ports for both AVR and SAMD based boards. The EnviroDIY Mayfly, the Arduino Mega, UNO, and Leonardo are all AVR boards. @@ -183,16 +180,14 @@ Most processors have built in dedicated wires for serial communication - "Hardwa See the page on [Arduino streams](@ref page_arduino_streams) for much more detail about serial connections with Arduino processors. _______ -[//]: # ( @subsubsection menu_avr_serial_ports AVR Boards ) -#### AVR Boards +#### AVR Boards Most Arduino AVR style boards have very few (ie, one, or none) dedicated serial ports _available_ after counting out the programming serial port. So to connect anything else, we need to try to emulate the processor serial functionality with a software library. This example shows three possible libraries that can be used to emulate a serial port on an AVR board. -[//]: # ( @paragraph menu_altsoftseral AltSoftSerial ) -##### AltSoftSerial +##### AltSoftSerial [AltSoftSerial](https://github.com/PaulStoffregen/AltSoftSerial) by Paul Stoffregen is the most accurate software serial port for AVR boards. AltSoftSerial can only be used on one set of pins on each board so only one AltSoftSerial port can be used. @@ -202,8 +197,7 @@ See the [processor compatibility](@ref page_processor_compatibility) page for mo [//]: # ( @menusnip{altsoftserial} ) -[//]: # ( @paragraph menu_neoswserial NeoSWSerial ) -##### NeoSWSerial +##### NeoSWSerial [NeoSWSerial](https://github.com/SRGDamia1/NeoSWSerial) is the best software serial that can be used on any pin supporting interrupts. You can use as many instances of NeoSWSerial as you want. @@ -216,8 +210,7 @@ Not all AVR boards are supported by NeoSWSerial. When using NeoSWSerial we will also have to actually set the data receiving (Rx) pin modes for interrupt in the [setup function](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_serial_interrupts). -[//]: # ( @paragraph menu_softwareseraial SoftwareSerial with External Interrupts ) -##### SoftwareSerial with External Interrupts +##### SoftwareSerial with External Interrupts The "standard" software serial library uses interrupts that conflict with several other libraries used within this program. I've created a [version of software serial that has been stripped of interrupts](https://github.com/EnviroDIY/SoftwareSerial_ExtInts) but it is still far from ideal. @@ -233,8 +226,7 @@ If you only want to use the serial line for incoming or outgoing data, set the o When using SoftwareSerial with External Interrupts we will also have to actually set the data receiving (Rx) pin modes for interrupt in the [setup function](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_serial_interrupts). -[//]: # ( @paragraph menu_softwarewire Software I2C/Wire ) -##### Software I2C/Wire +##### Software I2C/Wire This creates a software I2C (wire) instance that can be shared between multiple sensors. Only Testato's [SoftwareWire](https://github.com/Testato/SoftwareWire) library is supported. @@ -243,8 +235,7 @@ Only Testato's [SoftwareWire](https://github.com/Testato/SoftwareWire) library i --- -[//]: # ( @subsubsection menu_samd_serial_ports SAMD Boards ) -#### SAMD Boards +#### SAMD Boards The SAMD21 supports up to 6 _hardware_ serial ports, which is _awesome_. But, the Arduino core doesn't make use of all of them, so we have to assign them ourselves. @@ -262,28 +253,28 @@ NOTE: The SAMD51 board has an amazing _8_ available SERCOM's, but I do not have --- -[//]: # ( @subsection menu_serial_func Assigning Serial Port Functionality ) -### Assigning Serial Port Functionality +### Assigning Serial Port Functionality This section just assigns all the serial ports from the @ref menu_serial_ports section above to specific functionality. For a board with the option of up to 4 hardware serial ports, like the SAMD21 or Arduino Mega, we use the Serial1 to talk to the modem, Serial2 for modbus, and Serial3 for the Maxbotix. For an AVR board where we're relying on a mix of hardware and software ports, we use hardware Serial 1 for the modem, AltSoftSerial for modbus, and NeoSWSerial for the Maxbotix. Depending on how you rank the importance of each component, you can adjust these to your liking. +[//]: # ( @menusnip{assign_ports_sw} ) + --- -[//]: # ( @subsection menu_logger_opts Logging Options ) -### Logging Options +### Logging Options Here we set options for the logging and dataLogger object. This includes setting the time zone (daylight savings time is **NOT** applied) and setting all of the input and output pins related to the logger. [//]: # ( @menusnip{logging_options} ) + ___ -[//]: # ( @section menu_modem_settings Wifi/Cellular Modem Options ) -## Wifi/Cellular Modem Options +## Wifi/Cellular Modem Options This modem section is very lengthy because it contains the code with the constructor for every possible supported modem module. Do _NOT_ try to use more than one modem at a time - it will _NOT_ work. @@ -304,8 +295,7 @@ For WiFi modems, you need the network name and password (assuming WPA2). For cellular models, you will need the APN assigned to you by the carrier you bought your SIM card from. -[//]: # ( @subsection menu_xbee_cell_trans Digi XBee Cellular ) -### Digi XBee Cellular - Transparent Mode +### Digi XBee Cellular - Transparent Mode This is the code to use for _any_ of Digi's cellular XBee or XBee3 modules. All of them can be implented as a DigiXBeeCellularTransparent object - a subclass of DigiXBee and loggerModem. @@ -321,15 +311,13 @@ To create a DigiXBeeCellularTransparent object we need to know @note The u-blox based Digi XBee's (3G global and LTE-M global) may be more stable used in bypass mode (below). The Telit based Digi XBees (LTE Cat1 both Verizon and AT&T) can only use this mode. -[//]: # ( @menusnip{xbee_cell_transparent} ) - +[//]: # ( @menusnip{digi_xbee_cellular_transparent} ) Depending on your cellular carrier, it is best to select the proper carrier profile and network. Setting these helps the modem to connect to network faster. This is shows in the [XBee Cellular Carrier](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_xbeec_carrier) chunk of the setup function. -[//]: # ( @subsection menu_xbee_ltem_by Digi XBee3 LTE-M Bypass ) -### Digi XBee3 LTE-M - Bypass Mode +### Digi XBee3 LTE-M - Bypass Mode This code is for Digi's LTE-M XBee3 based on the u-blox SARA R410M - used in bypass mode. To create a DigiXBeeLTEBypass object we need to know @@ -343,15 +331,13 @@ To create a DigiXBeeLTEBypass object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{xbee3_ltem_bypass} ) - +[//]: # ( @menusnip{digi_xbee_lte_bypass} ) Depending on your cellular carrier, it is best to select the proper carrier profile and network. Setting these helps the modem to connect to network faster. This is shows in the [SARA R4 Cellular Carrier](@ref setup_r4_carrrier) chunk of the setup function. -[//]: # ( @subsubsection menu_digi_3gby Digi XBee 3G - Bypass Mode ) -### Digi XBee 3G - Bypass Mode +### Digi XBee 3G - Bypass Mode This code is for Digi's 3G/2G XBee based on the u-blox SARA U201 - used in bypass mode. To create a DigiXBee3GBypass object we need to know @@ -365,11 +351,9 @@ To create a DigiXBee3GBypass object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{xbee_3g_bypass} ) +[//]: # ( @menusnip{digi_xbee_3g_bypass} ) - -[//]: # ( @subsection menu_xbee_wifi Digi XBee S6B Wifi ) -### Digi XBee S6B Wifi +### Digi XBee S6B Wifi This code is for the Digi's S6B wifi module. To create a DigiXBeeWifi object we need to know @@ -384,11 +368,10 @@ To create a DigiXBeeWifi object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{xbee_wifi} ) +[//]: # ( @menusnip{digi_xbee_wifi} ) -[//]: # ( @subsection menu_esp Espressif ESP8266 ) -### Espressif ESP8266 +### Espressif ESP8266 This code is for the Espressif ESP8266 or ESP32 operating with "AT" firmware. To create a EspressifESP8266 object we need to know @@ -402,14 +385,13 @@ To create a EspressifESP8266 object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{esp8266} ) +[//]: # ( @menusnip{espressif_esp8266} ) Because the ESP8266's default baud rate is too fast for an 8MHz board like the Mayfly, to use it you need to drop the baud rate down for sucessful communication. You can set the slower baud rate using some external method, or useing the code from the ESP8266 Baud Rate(https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_esp) part of the setup function below. -[//]: # ( @subsection menu_bg96 Quectel BG96 ) -### Quectel BG96 +### Quectel BG96 This code is for the Dragino, Nimbelink or other boards based on the Quectel BG96. To create a QuectelBG96 object we need to know @@ -422,14 +404,12 @@ To create a QuectelBG96 object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{bg96} ) - +[//]: # ( @menusnip{quectel_bg96} ) If you are interfacing with a Nimbelink Skywire board via the Skywire development board, you also need to handle the fact that the development board reverses the levels of the status, wake, and reset pins. Code to invert the pin levels is in the [Skywire Pin Inversions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_skywire) part of the setup function below. -[//]: # ( @subsection menu_monarch Sequans Monarch ) -### Sequans Monarch +### Sequans Monarch This code is for the Nimbelink LTE-M Verizon/Sequans or other boards based on the Sequans Monarch series SoC. To create a SequansMonarch object we need to know @@ -442,7 +422,7 @@ To create a SequansMonarch object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{monarch} ) +[//]: # ( @menusnip{sequans_monarch} ) If you are interfacing with a Nimbelink Skywire board via the Skywire development board, you also need to handle the fact that the development board reverses the levels of the status, wake, and reset pins. Code to invert the pin levels is in the [Skywire Pin Inversions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_skywire) part of the setup function below. @@ -452,8 +432,7 @@ _Before_ attampting to connect a SVZM20 to an Arduino you should connect it to y The proper command to decrease the baud rate to 9600 (8N1) is: `AT+IPR=9600`. -[//]: # ( @subsection menu_sim800 SIMCom SIM800 ) -### SIMCom SIM800 +### SIMCom SIM800 This code is for a SIMCom SIM800 or SIM900 or one of their many variants, including the Adafruit Fona and the Sodaq 2GBee R4. To create a SIMComSIM800 object we need to know @@ -469,11 +448,10 @@ Pins that do not apply should be set as -1. _NOTE:_ This is NOT the correct form for a Sodaq 2GBee R6 or R7. See the section for a 2GBee R6. -[//]: # ( @menusnip{sim800} ) +[//]: # ( @menusnip{sim_com_sim800} ) -[//]: # ( @subsection menu_sim7000 SIMCom SIM7000 ) -### SIMCom SIM7000 +### SIMCom SIM7000 This code is for a SIMCom SIM7000 or one of its variants. To create a SIMComSIM7000 object we need to know @@ -486,11 +464,10 @@ To create a SIMComSIM7000 object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{sim7000} ) +[//]: # ( @menusnip{sim_com_sim7000} ) -[//]: # ( @subsection menu_gprsbee Sodaq GPRSBee ) -### Sodaq GPRSBee +### Sodaq GPRSBee This code is for the Sodaq 2GBee R6 and R7 based on the SIMCom SIM800. To create a Sodaq2GBeeR6 object we need to know @@ -503,11 +480,9 @@ Pins that do not apply should be set as -1. The GPRSBee R6/R7 does not expose the `RESET` pin of the SIM800. The `PWRKEY` is held `LOW` as long as the SIM800 is powered (as mentioned above). -[//]: # ( @menusnip{gprsbee} ) +[//]: # ( @menusnip{sodaq_2g_bee_r6} ) - -[//]: # ( @subsection menu_ubeer410 u-blox SARA R410M ) -### u-blox SARA R410M +### u-blox SARA R410M This code is for modules based on the 4G LTE-M u-blox SARA R410M including the Sodaq UBee. To create a SodaqUBeeR410M object we need to know @@ -520,14 +495,12 @@ To create a SodaqUBeeR410M object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{sara_r410m} ) - +[//]: # ( @menusnip{sodaq_ubee_r410m} ) Depending on your cellular carrier, it is best to select the proper carrier profile and network. Setting these helps the modem to connect to network faster. This is shows in the [SARA R4 Cellular Carrier](@ref setup_r4_carrrier) chunk of the setup function. -[//]: # ( @subsection menu_ubeeu201 u-blox SARA U201 ) -### u-blox SARA U201 +### u-blox SARA U201 This code is for modules based on the 3G/2G u-blox SARA U201 including the Sodaq UBee or the Sodaq 3GBee. To create a SodaqUBeeU201 object we need to know @@ -540,11 +513,9 @@ To create a SodaqUBeeU201 object we need to know Pins that do not apply should be set as -1. -[//]: # ( @menusnip{sara_u201} ) +[//]: # ( @menusnip{sodaq_ubee_u201} ) - -[//]: # ( @subsection menu_modem_vars Modem Measured Variables ) -### Modem Measured Variables +### Modem Measured Variables After creating the modem object, we can create Variable objects for each of the variables the modem is capable of measuring (Modem_SignalPercent, Modem_BatteryState, Modem_BatteryPercent, Modem_BatteryVoltage, and Modem_Temp). When we create the modem-linked variable objects, the first argument of the constructor, the loggerModem to like the variables to is required. @@ -556,11 +527,9 @@ Some modem-measured values may be meaningless depending on the board configurati ___ -[//]: # ( @section menu_sensors_and_vars Sensors and Measured Variables ) -## Sensors and Measured Variables +## Sensors and Measured Variables -[//]: # ( @subsection menu_processor_sensor The processor as a sensor ) -### The processor as a sensor +### The processor as a sensor Set options and create the objects for using the processor as a sensor to report battery level, processor free ram, and sample number. @@ -572,11 +541,11 @@ The number of "samples" taken will increase by one for each time another process @see @ref sensor_processor -[//]: # ( @menusnip{processor_sensor} ) +[//]: # ( @menusnip{processor_stats} ) + ___ -[//]: # ( @subsection menu_ds3231 Maxim DS3231 RTC as a sensor ) -### Maxim DS3231 RTC as a sensor +### Maxim DS3231 RTC as a sensor In addition to the time, we can also use the required DS3231 real time clock to report the temperature of the circuit board. This temperature is _not_ equivalent to an environmental temperature measurement and should only be used to as a diagnostic. @@ -584,11 +553,11 @@ As above, we create both the sensor and the variables measured by it. @see @ref sensor_ds3231 -[//]: # ( @menusnip{ds3231} ) +[//]: # ( @menusnip{maxim_ds3231} ) + ___ -[//]: # ( @subsection menu_am2315 AOSong AM2315 ) -### AOSong AM2315 +### AOSong AM2315 Here is the code for the AOSong AM2315 temperature and humidity sensor. This is an I2C sensor with only one possible address so the only argument required for the constructor is the pin on the MCU controlling power to the AM2315 (AM2315Power). @@ -596,11 +565,11 @@ The number of readings to average from the sensor is optional, but can be suppli @see @ref sensor_am2315 -[//]: # ( @menusnip{am2315} ) +[//]: # ( @menusnip{ao_song_am2315} ) + ___ -[//]: # ( @subsection menu_dht AOSong DHT ) -### AOSong DHT +### AOSong DHT Here is the code for the AOSong DHT temperature and humidity sensor. To create the DHT Sensor we need the power pin, the data pin, and the DHT type. @@ -608,11 +577,11 @@ The number of readings to average from the sensor is optional, but can be suppli @see @ref sensor_dht -[//]: # ( @menusnip{dht} ) +[//]: # ( @menusnip{ao_song_dht} ) + ___ -[//]: # ( @subsection menu_sq212 Apogee SQ-212 Quantum Light Sensor ) -### Apogee SQ-212 Quantum Light Sensor +### Apogee SQ-212 Quantum Light Sensor Here is the code for the Apogee SQ-212 Quantum Light Sensor. The SQ-212 is not directly connected to the MCU, but rather to an TI ADS1115 that communicates with the MCU. @@ -622,12 +591,12 @@ The number of readings to average from the sensor is optional, but can be suppli @see @ref sensor_sq212 -[//]: # ( @menusnip{dht} ) +[//]: # ( @menusnip{apogee_sq212} ) + ___ -[//]: # ( @subsection menu_atlas_sensors Atlas Scientific EZO Circuits ) -### Atlas Scientific EZO Circuits +### Atlas Scientific EZO Circuits The next several sections are for Atlas Scientific EZO circuts and sensors. The sensor class constructors for each are nearly identical, except for the class name. @@ -649,62 +618,61 @@ To use multiple circuits of the same type, re-address them. @see @ref atlas_group -[//]: # ( @subsubsection menu_atlas_co2 Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor ) -#### Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor +#### Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor @see @ref sensor_atlas_co2 -[//]: # ( @menusnip{atlas_co2} ) +[//]: # ( @menusnip{atlas_scientific_co2} ) + ___ -[//]: # ( @subsubsection menu_atlas_do Atlas Scientific EZO-DO Dissolved Oxygen Sensor ) -#### Atlas Scientific EZO-DO Dissolved Oxygen Sensor +#### Atlas Scientific EZO-DO Dissolved Oxygen Sensor @see @ref sensor_atlas_do -[//]: # ( @menusnip{atlas_do} ) +[//]: # ( @menusnip{atlas_scientific_do} ) + ___ -[//]: # ( @subsubsection menu_atlas_orp Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor ) -#### Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor +#### Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor @see @ref sensor_atlas_orp -[//]: # ( @menusnip{atlas_orp} ) +[//]: # ( @menusnip{atlas_scientific_orp} ) + ___ -[//]: # ( @subsubsection menu_atlas_ph Atlas Scientific EZO-pH Sensor ) -#### Atlas Scientific EZO-pH Sensor +#### Atlas Scientific EZO-pH Sensor @see @ref sensor_atlas_ph -[//]: # ( @menusnip{atlas_ph} ) +[//]: # ( @menusnip{atlas_scientific_ph} ) + ___ -[//]: # ( @subsubsection menu_atlas_rtd Atlas Scientific EZO-RTD Temperature Sensor ) -#### Atlas Scientific EZO-RTD Temperature Sensor +#### Atlas Scientific EZO-RTD Temperature Sensor @see @ref sensor_atlas_rtd -[//]: # ( @menusnip{atlas_rtd} ) +[//]: # ( @menusnip{atlas_scientific_rtd} ) + ___ -[//]: # ( @subsubsection menu_atlas_ec Atlas Scientific EZO-EC Conductivity Sensor ) -#### Atlas Scientific EZO-EC Conductivity Sensor +#### Atlas Scientific EZO-EC Conductivity Sensor @see @ref sensor_atlas_cond -[//]: # ( @menusnip{atlas_ec} ) +[//]: # ( @menusnip{atlas_scientific_ec} ) + ___ -[//]: # ( @subsection menu_bme280 Bosch BME280 Environmental Sensor ) -### Bosch BME280 Environmental Sensor +### Bosch BME280 Environmental Sensor Here is the code for the Bosch BME280 environmental sensor. The only input needed is the Arduino pin controlling power on/off; the i2cAddressHex is optional as is the number of readings to average. @@ -712,12 +680,12 @@ Keep in mind that the possible I2C addresses of the BME280 match those of the MS @see @ref sensor_bme280 -[//]: # ( @menusnip{bme280} ) +[//]: # ( @menusnip{bosch_bme280} ) + ___ -[//]: # ( @subsection menu_obs3 Campbell OBS3+ Analog Turbidity Sensor ) -### Campbell OBS3+ Analog Turbidity Sensor +### Campbell OBS3+ Analog Turbidity Sensor This is the code for the Campbell OBS3+. The Arduino pin controlling power on/off, analog data channel _on the TI ADS1115_, and calibration values _in Volts_ for Ax^2 + Bx + C are required for the sensor constructor. @@ -729,12 +697,12 @@ Note that to access both the high and low range returns, two instances must be c @see @ref sensor_obs3 -[//]: # ( @menusnip{obs3} ) +[//]: # ( @menusnip{campbell_obs3} ) + ___ -[//]: # ( @subsection menu_es2 Decagon ES2 Conductivity and Temperature Sensor ) -### Decagon ES2 Conductivity and Temperature Sensor +### Decagon ES2 Conductivity and Temperature Sensor 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. @@ -742,12 +710,12 @@ The data pin must be a pin that supports pin-change interrupts. @see @ref sensor_es2 -[//]: # ( @menusnip{es2} ) +[//]: # ( @menusnip{decagon_es2} ) + ___ -[//]: # ( @subsection menu_ext_volt External Voltage via TI ADS1x15 ) -### External Voltage via TI ADS1x15 +### External Voltage via TI ADS1x15 The Arduino pin controlling power on/off and the analog data channel _on the TI ADS1115_ are required for the sensor constructor. If using a voltage divider to increase the measurable voltage range, enter the gain multiplier as the third argument. @@ -756,12 +724,12 @@ The number of measurements to average, if more than one is desired, goes as the @see @ref sensor_ads1x15 -[//]: # ( @menusnip{ext_volt} ) +[//]: # ( @menusnip{external_voltage} ) + ___ -[//]: # ( @subsection menu_mpl115a2 Freescale Semiconductor MPL115A2 Miniature I2C Digital Barometer ) -### Freescale Semiconductor MPL115A2 Miniature I2C Digital Barometer +### Freescale Semiconductor MPL115A2 Miniature I2C Digital Barometer The only input needed for the sensor constructor is the Arduino pin controlling power on/off and optionally the number of readings to average. Because this sensor can have only one I2C address (0x60), it is only possible to connect one of these sensors to your system. @@ -769,11 +737,11 @@ Because this sensor can have only one I2C address (0x60), it is only possible to @see @ref sensor_mpl115a2 [//]: # ( @menusnip{mpl115a2} ) + ___ -[//]: # ( @subsection menu_keller_sensors Keller RS485/Modbus Water Level Sensors ) -### Keller RS485/Modbus Water Level Sensors +### Keller RS485/Modbus Water Level Sensors The next two sections are for Keller RS485/Modbus water level sensors. The sensor class constructors for each are nearly identical, except for the class name. @@ -783,7 +751,7 @@ The Arduino pin controlling the receive and data enable on your RS485-to-TTL ada 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. -The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to modbus functionality in the @ref menu_serial_func section. +The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to modbus functionality in the @ref menu_assign_ports_sw section. 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. @@ -794,41 +762,40 @@ Both pins _cannot_ be shared pins. @see @ref keller_group -[//]: # ( @subsubsection menu_nanolevel Keller Nanolevel Level Transmitter ) -#### Keller Nanolevel Level Transmitter +#### Keller Nanolevel Level Transmitter @see @ref sensor_nanolevel -[//]: # ( @menusnip{nanolevel} ) +[//]: # ( @menusnip{keller_nanolevel} ) + ___ -[//]: # ( @subsubsection menu_acculevel Keller Acculevel High Accuracy Submersible Level Transmitter ) -#### Keller Acculevel High Accuracy Submersible Level Transmitter +#### Keller Acculevel High Accuracy Submersible Level Transmitter @see @ref sensor_acculevel -[//]: # ( @menusnip{acculevel} ) +[//]: # ( @menusnip{keller_acculevel} ) + ___ -[//]: # ( @subsection menu_maxbotics Maxbotix HRXL Ultrasonic Range Finder ) -### Maxbotix HRXL Ultrasonic Range Finder +### Maxbotix HRXL Ultrasonic Range Finder The Arduino pin controlling power on/off, a stream instance for received data (ie, `Serial`), and the Arduino pin controlling the trigger are required for the sensor constructor. (Use -1 for the trigger pin if you do not have it connected.) Please see the section "[Notes on Arduino Streams and Software Serial](https://envirodiy.github.io/ModularSensors/page_arduino_streams.html)" for more information about what streams can be used along with this library. -The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to the sonar functionality in the @ref menu_serial_func section. +The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to the sonar functionality in the @ref menu_assign_ports_sw section. @see @ref sensor_maxbotix -[//]: # ( @menusnip{maxbotics} ) +[//]: # ( @menusnip{max_botix_sonar} ) + ___ -[//]: # ( @subsection menu_ds18 Maxim DS18 One Wire Temperature Sensor ) -### Maxim DS18 One Wire Temperature Sensor +### Maxim DS18 One Wire Temperature Sensor The OneWire hex 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, though the address can be omitted if only one sensor is used. The OneWire address is an array of 8 hex values, for example: {0x28, 0x1D, 0x39, 0x31, 0x2, 0x0, 0x0, 0xF0}. @@ -837,24 +804,24 @@ The sensor address is programmed at the factory and cannot be changed. @see @ref sensor_ds18 -[//]: # ( @menusnip{ds18} ) +[//]: # ( @menusnip{maxim_ds18} ) + ___ -[//]: # ( @subsection menu_ms5803 Measurement Specialties MS5803-14BA Pressure Sensor ) -### Measurement Specialties MS5803-14BA Pressure Sensor +### Measurement Specialties MS5803-14BA Pressure Sensor The only input needed is the Arduino pin controlling power on/off; the i2cAddressHex and maximum pressure are optional as is the number of readings to average. Keep in mind that the possible I2C addresses of the MS5803 match those of the BME280. @see @ref sensor_ms5803 -[//]: # ( @menusnip{ms5803} ) +[//]: # ( @menusnip{mea_spec_ms5803} ) + ___ -[//]: # ( @subsection menu_meter_sensors Meter SDI-12 Sensors ) -### Meter SDI-12 Sensors +### Meter SDI-12 Sensors The next few sections are for Meter SDI-12 sensors. 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. @@ -862,35 +829,34 @@ Optionally, you can include a number of distinct readings to average. The data pin must be a pin that supports pin-change interrupts. -[//]: # ( @subsubsection menu_fivetm Meter ECH2O Soil Moisture Sensor ) -#### Meter ECH2O Soil Moisture Sensor +#### Meter ECH2O Soil Moisture Sensor @see @ref sensor_fivetm -[//]: # ( @menusnip{fivetm} ) +[//]: # ( @menusnip{decagon_5tm} ) + ___ -[//]: # ( @subsubsection menu_hydros21 Meter Hydros 21 Conductivity, Temperature, and Depth Sensor ) -#### Meter Hydros 21 Conductivity, Temperature, and Depth Sensor +#### Meter Hydros 21 Conductivity, Temperature, and Depth Sensor @see @ref sensor_hydros21 -[//]: # ( @menusnip{hydros21} ) +[//]: # ( @menusnip{meter_hydros21} ) + ___ -[//]: # ( @subsubsection menu_teros Meter Teros 11 Soil Moisture Sensor ) -#### Meter Teros 11 Soil Moisture Sensor +#### Meter Teros 11 Soil Moisture Sensor @see @ref sensor_teros11 -[//]: # ( @menusnip{teros} ) +[//]: # ( @menusnip{meter_teros11} ) + ___ -[//]: # ( @subsection menu_pt_redox PaleoTerra Redox Sensors ) -### PaleoTerra Redox Sensors +### PaleoTerra Redox Sensors Because older versions of these sensors all ship with the same I2C address, and more than one is frequently used at different soil depths in the same profile, this module has an optional dependence on Testato's [SoftwareWire](https://github.com/Testato/SoftwareWire) library for software I2C. @@ -907,12 +873,12 @@ Using some with software I2C and others with hardware I2C is not supported. @see @ref sensor_pt_redox -[//]: # ( @menusnip{pt_redox} ) +[//]: # ( @menusnip{paleo_terra_redox} ) + ___ -[//]: # ( @subsection menu_i2c_rain Trinket-Based Tipping Bucket Rain Gauge ) -### Trinket-Based Tipping Bucket Rain Gauge +### Trinket-Based Tipping Bucket Rain Gauge This is for use with a simple external I2C tipping bucket counter based on the [Adafriut Trinket](https://www.adafruit.com/product/1501). All constructor arguments are optional, but the first argument is for the I2C address of the tip counter (if not 0x08) and the second is for the depth of rain (in mm) per tip event (if not 0.2mm). @@ -922,12 +888,12 @@ Note that you cannot input a number of measurements to average because averaging @see @ref sensor_i2c_rain -[//]: # ( @menusnip{i2c_rain} ) +[//]: # ( @menusnip{rain_counter_i2c} ) + ___ -[//]: # ( @subsection menu_tally Northern Widget Tally Event Counter ) -### Northern Widget Tally Event Counter +### Northern Widget Tally Event Counter This is for use with Northern Widget's Tally event counter @@ -940,12 +906,12 @@ The counter should be continuously powered. @see @ref sensor_tally -[//]: # ( @menusnip{i2c_wind_tally} ) +[//]: # ( @menusnip{tally_counter_i2c} ) + ___ -[//]: # ( @subsection menu_ina219 TI INA219 High Side Current Sensor ) -### TI INA219 High Side Current Sensor +### TI INA219 High Side Current Sensor This is the code for the TI INA219 high side current and voltage sensor. The Arduino pin controlling power on/off is all that is required for the constructor. @@ -954,12 +920,12 @@ The number of measurements to average, if more than one is desired, goes as the @see @ref sensor_ina219 -[//]: # ( @menusnip{ina219} ) +[//]: # ( @menusnip{ti_ina219} ) + ___ -[//]: # ( @subsection menu_cyclops Turner Cyclops-7F Submersible Fluorometer ) -### Turner Cyclops-7F Submersible Fluorometer +### Turner Cyclops-7F Submersible Fluorometer This is the code for the Turner Cyclops-7F submersible fluorometer. The Arduino pin controlling power on/off and all calibration information is needed for the constructor. @@ -970,13 +936,13 @@ The Cyclops sensors are *NOT* pre-calibrated and must be calibrated prior to dep @see @ref sensor_cyclops -[//]: # ( @menusnip{cyclops} ) +[//]: # ( @menusnip{turner_cyclops} ) + ___ -[//]: # ( @subsection menu_analog_cond Analog Electrical Conductivity using the Processor's Analog Pins ) -### Analog Electrical Conductivity using the Processor's Analog Pins +### Analog Electrical Conductivity using the Processor's Analog Pins This is the code for the measuring electrical conductivity using the processor's internal ADC and analog input pins. The Arduino pin controlling power on/off and the sensing pin are required for the constuctor. @@ -987,12 +953,12 @@ For best results, you should also connect the AREF pin of your processors ADC to @see @ref sensor_analog_cond -[//]: # ( @menusnip{analog_cond} ) +[//]: # ( @menusnip{analog_elec_conductivity} ) + ___ -[//]: # ( @subsection menu_yosemitech_sensors Yosemitech RS485/Modbus Environmental Sensors ) -### Yosemitech RS485/Modbus Environmental Sensors +### Yosemitech RS485/Modbus Environmental Sensors The next several sections are for Yosemitech brand sensors. The sensor class constructors for each are nearly identical, except for the class name. @@ -1005,94 +971,102 @@ In tests on these sensors, SoftwareSerial_ExtInts _did not work_ to communicate AltSoftSerial and HardwareSerial work fine. NeoSWSerial is a bit hit or miss, but can be used in a pinch. -The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to modbus functionality in the @ref menu_serial_func section. +The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to modbus functionality in the @ref menu_assign_ports_sw section. @see @ref yosemitech_group -[//]: # ( @subsubsection menu_y504 Yosemitech Y504 Dissolved Oxygen Sensor ) -#### Yosemitech Y504 Dissolved Oxygen Sensor +#### Yosemitech Y504 Dissolved Oxygen Sensor @see @ref sensor_y504 -[//]: # ( @menusnip{y504} ) +[//]: # ( @menusnip{yosemitech_y504} ) + ___ -[//]: # ( @subsubsection menu_y510 Yosemitech Y510 Turbidity Sensor ) -#### Yosemitech Y510 Yosemitech Y510 Turbidity Sensor +#### Yosemitech Y510 Turbidity Sensor @see @ref sensor_y510 -[//]: # ( @menusnip{y510} ) +[//]: # ( @menusnip{yosemitech_y510} ) + ___ -[//]: # ( @subsubsection menu_y511 Yosemitech Y511 Turbidity Sensor with Wiper ) -#### Yosemitech Y511 Yosemitech Y511 Turbidity Sensor with Wiper +#### Yosemitech Y511 Turbidity Sensor with Wiper @see @ref sensor_y511 -[//]: # ( @menusnip{y511} ) +[//]: # ( @menusnip{yosemitech_y511} ) + ___ -[//]: # ( @subsubsection menu_y514 Yosemitech Y514 Chlorophyll Sensor ) -#### Yosemitech Y514 Yosemitech Y514 Chlorophyll Sensor +#### Yosemitech Y514 Chlorophyll Sensor @see @ref sensor_y514 -[//]: # ( @menusnip{y514} ) +[//]: # ( @menusnip{yosemitech_y514} ) + ___ -[//]: # ( @subsubsection menu_y520 Yosemitech Y520 Conductivity Sensor ) -#### Yosemitech Y520 Yosemitech Y520 Conductivity Sensor +#### Yosemitech Y520 Conductivity Sensor @see @ref sensor_y520 -[//]: # ( @menusnip{y520} ) +[//]: # ( @menusnip{yosemitech_y520} ) + ___ -[//]: # ( @subsubsection menu_y532 Yosemitech Y532 pH Sensor ) -#### Yosemitech Y532 Yosemitech Y532 pH Sensor +#### Yosemitech Y532 pH Sensor @see @ref sensor_y532 -[//]: # ( @menusnip{y532} ) +[//]: # ( @menusnip{yosemitech_y532} ) + ___ -[//]: # ( @subsubsection menu_y533 Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor ) -#### Yosemitech Y533 Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor +#### Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor @see @ref sensor_y533 -[//]: # ( @menusnip{y533} ) +[//]: # ( @menusnip{yosemitech_y533} ) + ___ -[//]: # ( @subsubsection menu_y551 Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper ) -#### Yosemitech Y551 Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper +#### Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper @see @ref sensor_y551 -[//]: # ( @menusnip{y551} ) +[//]: # ( @menusnip{yosemitech_y551} ) + ___ -[//]: # ( @subsubsection menu_y4000 Yosemitech Y4000 Multi-Parameter Sonde ) -#### Yosemitech Y4000 Yosemitech Y4000 Multi-Parameter Sonde +#### Yosemitech Y560 Ammonium Sensor + +@see @ref sensor_y551 + +[//]: # ( @menusnip{yosemitech_y560} ) + +___ + + +#### Yosemitech Y4000 Multi-Parameter Sonde @see @ref sensor_y4000 -[//]: # ( @menusnip{y4000} ) +[//]: # ( @menusnip{yosemitech_y4000} ) + ___ -[//]: # ( @subsection menu_dopto Zebra Tech D-Opto Dissolved Oxygen Sensor ) -### Zebra Tech D-Opto Dissolved Oxygen Sensor +### Zebra Tech D-Opto Dissolved Oxygen Sensor 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. @@ -1100,40 +1074,37 @@ The data pin must be a pin that supports pin-change interrupts. @see @ref sensor_dopto -[//]: # ( @menusnip{dopto} ) +[//]: # ( @menusnip{zebra_tech_d_opto} ) + ___ -[//]: # ( @section menu_calc_vars Calculated Variables ) -## Calculated Variables +## Calculated Variables Create new Variable objects calculated from the measured variables. For these calculate variables, we must not only supply a function for the calculation, but also all of the metadata about the variable - like the name of the variable and its units. [//]: # ( @menusnip{calculated_variables} ) + ___ -[//]: # ( @section menu_create_objs Creating the array, logger, publishers ) -## Creating the array, logger, publishers +## Creating the array, logger, publishers -[//]: # ( @subsection menu_variable_array The variable array ) -### The variable array +### The variable array Create a VariableArray containing all of the Variable objects that we are logging the values of. This shows three differnt ways of creating the same variable array and filling it with variables. You should only use **ONE** of these in your own code -[//]: # ( @subsubsection menu_variables_create_in_array Creating Variables within an Array ) -#### Creating Variables within an Array +#### Creating Variables within an Array Here we use the `new` keyword to create multiple variables and get pointers to them all at the same time within the arry. [//]: # ( @menusnip{variables_create_in_array} ) -[//]: # ( @subsubsection menu_variables_separate_uuids Using Already-Created Variables ) -#### Creating Variables and Pasting UUIDs from MonitorMyWatershed +#### Creating Variables and Pasting UUIDs from MonitorMyWatershed If you are sending data to monitor my watershed, it is much easier to create the variables in an array and then to paste the UUID's all together as copied from the "View Token UUID List" link for a site. If using this method, be very, very, very careful to make sure the order of your variables exactly matches the order of your UUID's. @@ -1141,69 +1112,67 @@ If using this method, be very, very, very careful to make sure the order of your [//]: # ( @menusnip{variables_separate_uuids} ) -[//]: # ( @subsubsection menu_variables_pre_named Using Already-Created Variables ) -#### Creating Variables within an Array +#### Creating Variables within an Array You can also create and name variable pointer objects outside of the array (as is demonstrated in all of the code chunks here) and then reference those pointers inside of the array like so: [//]: # ( @menusnip{variables_pre_named} ) + ___ -[//]: # ( @subsection menu_logger_obj The Logger Object ) -### The Logger Object +### The Logger Object Now that we've created the array, we can actually create the #Logger object. [//]: # ( @menusnip{loggers} ) + ___ -[//]: # ( @subsection menu_data_publisher Data Publisher ) -### Data Publishers +### Data Publishers Here we set up all three possible data publisers and link all of them to the same Logger object. -[//]: # ( @subsubsection menu_mmw_publisher Monitor My Watershed ) -#### Monitor My Watershed +#### Monitor My Watershed To publish data to the Monitor My Watershed / EnviroDIY Data Sharing Portal first you must register yourself as a user at https://monitormywatershed.org or https://data.envirodiy.org. Then you must register your site. After registering your site, a sampling feature and registration token for that site should be visible on the site page. -[//]: # ( @menusnip{monitormw} ) +[//]: # ( @menusnip{enviro_diy_publisher} ) + ___ -[//]: # ( @subsubsection menu_dh_publisher DreamHost ) -#### DreamHost +#### DreamHost It is extrmemly unlikely you will use this. You should ignore this section. -[//]: # ( @menusnip{dreamhost} ) +[//]: # ( @menusnip{dream_host_publisher} ) + ___ -[//]: # ( @subsubsection menu_thingspeak_publisher ThingSpeak ) -#### ThingSpeak +#### ThingSpeak After you have set up channels on ThingSpeak, you can use this code to publish your data to it. Keep in mind that the order of variables in the VariableArray is **crucial** when publishing to ThingSpeak. -[//]: # ( @menusnip{dreamhost} ) +[//]: # ( @menusnip{thing_speak_publisher} ) + ___ -[//]: # ( @section menu_working Extra Working Functions ) -## Extra Working Functions +## Extra Working Functions Here we're creating a few extra functions on the global scope. The flash function is used at board start up just to give an indication that the board has restarted. The battery function calls the #ProcessorStats sensor to check the battery level before attempting to log or publish data. [//]: # ( @menusnip{working_functions} ) + ___ -[//]: # ( @section menu_setup Arduino Setup Function ) -## Arduino Setup Function +## Arduino Setup Function This is our setup function. In Arduino coding, the classic "main" function is replaced by two functions: setup() and loop(). @@ -1214,8 +1183,7 @@ Because we have a _lot_ of parts to set up, there's a lot going on in this funct Let's break it down. -[//]: # ( @subsection menu_setup_open Starting the Function ) -### Starting the Function +### Starting the Function First we just open the function definitions: @@ -1223,8 +1191,7 @@ First we just open the function definitions: void setup() { ``` -[//]: # ( @subsection menu_setup_wait Wait for USB ) -### Wait for USB +### Wait for USB Next we wait for the USB debugging port to initialize. This only applies to SAMD and 32U4 boards that have built-in USB support. @@ -1232,20 +1199,18 @@ This code should not be used for deployed loggers; it's only for using a USB for [//]: # ( @menusnip{setup_wait} ) -[//]: # ( @subsection menu_setup_prints Printing a Hello ) -### Printing a Hello +### Printing a Hello Next we print a message out to the debugging port. This is also just for debugging - it's very helpful when connected to the logger via USB to see a clear indication that the board is starting [//]: # ( @menusnip{setup_prints} ) -[//]: # ( @subsection menu_setup_serial_interrupts Serial Interrupts ) -### Serial Interrupts +### Serial Interrupts If we're using either NeoSWSerial or SoftwareSerial_ExtInts we need to assign the data receiver pins to interrupt functionality here in the setup. -The [NeoSWSerial](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_neoswserial) and [SoftwareSerial_ExtInts](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_softwareseraial) objects were created way up in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_serial_ports) section. +The [NeoSWSerial](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_neoswserial) and [SoftwareSerial_ExtInts](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_softwareserial) objects were created way up in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_serial_ports) section. **NOTE:** If you create more than one NeoSWSerial or Software serial object, you need to call the enableInterrupt function for each Rx pin! @@ -1260,16 +1225,14 @@ For SoftwareSerial with External interrupts we use: CHANGE); ``` -[//]: # ( @subsection menu_setup_serial_begin Serial Begin ) -### Serial Begin +### Serial Begin Every serial port setup and used in the program must be "begun" in the setup function. This section calls the begin functions for all of the various ports defined in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_serial_ports) section [//]: # ( @menusnip{setup_serial_begins} ) -[//]: # ( @subsection menu_setup_pin_periph SAMD Pin Peripherals ) -### SAMD Pin Peripherals +### SAMD Pin Peripherals After beginning all of the serial ports, we need to set the pin peripheral settings for any SERCOM's we assigned to serial functionality on the SAMD boards. These were created in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_samd_serial_ports) section above. @@ -1277,16 +1240,14 @@ This does not need to be done for an AVR board (like the Mayfly). [//]: # ( @menusnip{setup_samd_pins} ) -[//]: # ( @subsection menu_setup_flash Flash the LEDs ) -### Flash the LEDs +### Flash the LEDs Like printing debugging information to the serial port, flashing the board LED's is a very helpful indication that the board just restarted. Here we set the pin modes for the LED pins and flash them back and forth using the greenredflash() function we created back in the [working functions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_working) section. [//]: # ( @menusnip{setup_flashing_led} ) -[//]: # ( @subsection menu_setup_logger Begin the Logger ) -### Begin the Logger +### Begin the Logger Next get ready and begin the logger. We set the logger time zone and the clock time zone. @@ -1297,8 +1258,7 @@ Then we finally run the logger's begin function. [//]: # ( @menusnip{setup_logger} ) -[//]: # ( @subsection menu_setup_sensors Setup the Sensors ) -### Setup the Sensors +### Setup the Sensors After beginning the logger, we setup all the sensors. Unlike all the previous chuncks of the setup that are preparation steps only requiring the mcu processor, this might involve powering up the sensors. @@ -1306,48 +1266,42 @@ To prevent a low power restart loop, we put a battery voltage condition on the s This prevents a solar powered board whose battery has died from continuously restarting as soon as it gains any power on sunrise. Without the condition the board would boot with power, try to power hungry sensors, brown out, and restart over and over. -[//]: # ( @menusnip{setup_sesors} ) +[//]: # ( @menusnip{setup_sensors} ) -[//]: # ( @subsection menu_setup_modem Custom Modem Setup ) -### Custom Modem Setup +### Custom Modem Setup Next we can opt to do some special setup needed for a few of the modems. You should only use the one chunk that applies to your specific modem configuration and delete the others. -[//]: # ( @subsubsection menu_setup_esp ESP8266 Baud Rate ) -#### ESP8266 Baud Rate +#### ESP8266 Baud Rate This chunk of code reduces the baud rate of the ESP8266 from its default of 115200 to 9600. This is only needed for 8MHz boards (like the Mayfly) that cannot communicate at 115200 baud. [//]: # ( @menusnip{setup_esp} ) -[//]: # ( @subsubsection menu_setup_skywire Skywire Pin Inversions ) -#### Skywire Pin Inversions +#### Skywire Pin Inversions This chunk of code inverts the pin levels for status, wake, and reset of the modem. This is necessary for the Skywire development board and some other breakouts. [//]: # ( @menusnip{setup_skywire} ) -[//]: # ( @subsubsection menu_setup_xbeec_carrier XBee Cellular Carrier ) -#### XBee Cellular Carrier +#### XBee Cellular Carrier This chunk of code sets the carrier profile and network technology for a Digi XBee or XBee3. You should change the lines with the `CP` and `N#` commands to the proper number to match your SIM card. [//]: # ( @menusnip{setup_xbeec_carrier} ) -[//]: # ( @subsubsection setup_r4_carrrier SARA R4 Cellular Carrier ) -#### SARA R4 Cellular Carrier +#### SARA R4 Cellular Carrier This chunk of code sets the carrier profile and network technology for a u-blox SARA R4 or N4 module, including a Sodaq R410 UBee or a Digi XBee3 LTE-M in bypass mode.. You should change the lines with the `UMNOPROF` and `URAT` commands to the proper number to match your SIM card. [//]: # ( @menusnip{setup_r4_carrrier} ) -[//]: # ( @subsection menu_setup_rtc Sync the Real Time Clock ) -### Sync the Real Time Clock +### Sync the Real Time Clock After any special modem options, we can opt to use the modem to synchronize the real time clock with the NIST time servers. This is very helpful in keeping the clock from drifting or resetting it if it lost time due to power loss. @@ -1358,9 +1312,7 @@ To be considered "sane" the clock has to set somewhere between 2020 and 2025. It's a broad range, but it will automatically flag values like Jan 1, 2000 - which are the default start value of the clock on power up. [//]: # ( @menusnip{setup_clock} ) - -[//]: # ( @subsection menu_setup_file Setup a File on the SD card ) -### Setup File on the SD card +### Setup File on the SD card We're getting close to the end of the setup function! This section verifies that the SD card is communicating with the MCU and sets up a file on it for saved data. @@ -1368,16 +1320,14 @@ Like with the sensors and the modem, we check for battery level before attemptin [//]: # ( @menusnip{setup_file} ) -[//]: # ( @subsection menu_setup_sleep Sleep until the First Data Collection Time ) -### Sleep until the First Data Collection Time +### Sleep until the First Data Collection Time We're finally fished with setup! This chunk puts the system into low power deep sleep until the next logging interval. [//]: # ( @menusnip{setup_sleep} ) -[//]: # ( @subsection menu_setup_done Setup Complete ) -### Setup Complete +### Setup Complete Set up is done! This setup function is *really* long. @@ -1389,15 +1339,13 @@ But don't forget you need to close it with a final curly brace. ___ -[//]: # ( @section menu_loop Arduino Loop Function ) -## Arduino Loop Function +## Arduino Loop Function This is the loop function which will run repeatedly as long as the board is turned on. **NOTE:** This example has code for both a typical simple loop and a complex loop that calls lower level logger functions. You should only pick _one_ loop function and delete the other. -[//]: # ( @subsection menu_simple_loop A Typical Loop ) -### A Typical Loop +### A Typical Loop After the incredibly long setup function, we can do the vast majority of all logger work in a very simple loop function. Every time the logger wakes we check the battery voltage and do 1 of three things: @@ -1409,8 +1357,7 @@ At full power, do everything. [//]: # ( @menusnip{simple_loop} ) -[//]: # ( @subsection menu_complex_loop A Complex Loop ) -### A Complex Loop +### A Complex Loop If you need finer control over the steps of the logging function, this code demonstrates how the loop should be constructed. @@ -1445,3 +1392,5 @@ The [data_saving example program](https://github.com/EnviroDIY/ModularSensors/tr [//]: # ( @include{lineno} menu_a_la_carte/platformio.ini ) [//]: # ( @section example_menu_code The Complete Code ) + +[//]: # ( @include{lineno} menu_a_la_carte/menu_a_la_carte.ino ) 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 528b5e96d..5b694d1f7 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -3,7 +3,7 @@ * @brief Example with all possible functionality. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * @@ -273,8 +273,8 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // Delete the sections you are not using! // ========================================================================== -#if defined BUILD_MODEM_XBEE_CELLULAR -/** Start [xbee_cell_transparent] */ +#if defined BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT +/** Start [digi_xbee_cellular_transparent] */ // For any Digi Cellular XBee's // NOTE: The u-blox based Digi XBee's (3G global and LTE-M global) can be used // in either bypass or transparent mode, each with pros and cons @@ -310,12 +310,12 @@ DigiXBeeCellularTransparent modemXBCT(&modemSerial, modemVccPin, modemStatusPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name DigiXBeeCellularTransparent modem = modemXBCT; -/** End [xbee_cell_transparent] */ +/** End [digi_xbee_cellular_transparent] */ // ========================================================================== -#elif defined BUILD_MODEM_XBEE_LTE_B -/** Start [xbee3_ltem_bypass] */ +#elif defined BUILD_MODEM_DIGI_XBEE_LTE_BYPASS +/** Start [digi_xbee_lte_bypass] */ // For the u-blox SARA R410M based Digi LTE-M XBee3 // NOTE: According to the manual, this should be less stable than transparent // mode, but my experience is the complete reverse. @@ -347,12 +347,12 @@ DigiXBeeLTEBypass modemXBLTEB(&modemSerial, modemVccPin, modemStatusPin, apn); // Create an extra reference to the modem by a generic name DigiXBeeLTEBypass modem = modemXBLTEB; -/** End [xbee3_ltem_bypass] */ +/** End [digi_xbee_lte_bypass] */ // ========================================================================== -#elif defined BUILD_MODEM_XBEE_3G_B -/** Start [xbee_3g_bypass] */ +#elif defined BUILD_MODEM_DIGI_XBEE_3G_BYPASS +/** Start [digi_xbee_3g_bypass] */ // For the u-blox SARA U201 based Digi 3G XBee with 2G fallback // NOTE: According to the manual, this should be less stable than transparent // mode, but my experience is the complete reverse. @@ -384,12 +384,12 @@ DigiXBee3GBypass modemXB3GB(&modemSerial, modemVccPin, modemStatusPin, apn); // Create an extra reference to the modem by a generic name DigiXBee3GBypass modem = modemXB3GB; -/** End [xbee_3g_bypass] */ +/** End [digi_xbee_3g_bypass] */ // ========================================================================== -#elif defined BUILD_MODEM_XBEE_WIFI -/** Start [xbee_wifi] */ +#elif defined BUILD_MODEM_DIGI_XBEE_WIFI +/** Start [digi_xbee_wifi] */ // For the Digi Wifi XBee (S6B) #include @@ -420,12 +420,13 @@ DigiXBeeWifi modemXBWF(&modemSerial, modemVccPin, modemStatusPin, wifiPwd); // Create an extra reference to the modem by a generic name DigiXBeeWifi modem = modemXBWF; -/** End [xbee_wifi] */ +/** End [digi_xbee_wifi] */ // ========================================================================== -#elif defined BUILD_MODEM_ESP8266 || defined BUILD_MODEM_ESP32 -/** Start [esp8266] */ +#elif defined BUILD_MODEM_ESPRESSIF_ESP8266 || \ + defined BUILD_MODEM_ESPRESSIF_ESP32 +/** Start [espressif_esp8266] */ // For almost anything based on the Espressif ESP8266 using the // AT command firmware #include @@ -465,12 +466,12 @@ EspressifESP8266 modemESP(&modemSerial, modemVccPin, modemStatusPin, ); // Create an extra reference to the modem by a generic name EspressifESP8266 modem = modemESP; -/** End [esp8266] */ +/** End [espressif_esp8266] */ // ========================================================================== -#elif defined BUILD_MODEM_BG96 -/** Start [bg96] */ +#elif defined BUILD_MODEM_QUECTEL_BG96 +/** Start [quectel_bg96] */ // For the Dragino, Nimbelink or other boards based on the Quectel BG96 #include @@ -499,12 +500,12 @@ QuectelBG96 modemBG96(&modemSerial, modemVccPin, modemStatusPin, modemResetPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name QuectelBG96 modem = modemBG96; -/** End [bg96] */ +/** End [quectel_bg96] */ // ========================================================================== -#elif defined BUILD_MODEM_MONARCH -/** Start [monarch] */ +#elif defined BUILD_MODEM_SEQUANS_MONARCH +/** Start [sequans_monarch] */ // For the Nimbelink LTE-M Verizon/Sequans or other boards based on the Sequans // Monarch series #include @@ -534,12 +535,12 @@ SequansMonarch modemSVZM(&modemSerial, modemVccPin, modemStatusPin, modemResetPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name SequansMonarch modem = modemSVZM; -/** End [monarch] */ +/** End [sequans_monarch] */ // ========================================================================== -#elif defined BUILD_MODEM_SIM800 -/** Start [sim800] */ +#elif defined BUILD_MODEM_SIM_COM_SIM800 +/** Start [sim_com_sim800] */ // For almost anything based on the SIMCom SIM800 EXCEPT the Sodaq 2GBee R6 and // higher #include @@ -566,12 +567,12 @@ SIMComSIM800 modemS800(&modemSerial, modemVccPin, modemStatusPin, modemResetPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name SIMComSIM800 modem = modemS800; -/** End [sim800] */ +/** End [sim_com_sim800] */ // ========================================================================== -#elif defined BUILD_MODEM_SIM7000 -/** Start [sim7000] */ +#elif defined BUILD_MODEM_SIM_COM_SIM7000 +/** Start [sim_com_sim7000] */ // For almost anything based on the SIMCom SIM7000 #include @@ -596,12 +597,12 @@ SIMComSIM7000 modem7000(&modemSerial, modemVccPin, modemStatusPin, modemResetPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name SIMComSIM7000 modem = modem7000; -/** End [sim7000] */ +/** End [sim_com_sim7000] */ // ========================================================================== -#elif defined BUILD_MODEM_SIM7080 -/** Start [sim7080] */ +#elif defined BUILD_MODEM_SIM_COM_SIM7080 +/** Start [sim_com_sim7080] */ // For almost anything based on the SIMCom SIM7080G #include @@ -627,12 +628,12 @@ SIMComSIM7080 modem7080(&modemSerial, modemVccPin, modemStatusPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name SIMComSIM7080 modem = modem7080; -/** End [sim7080] */ +/** End [sim_com_sim7080] */ // ========================================================================== -#elif defined BUILD_MODEM_S2GB -/** Start [gprsbee] */ +#elif defined BUILD_MODEM_SODAQ_2G_BEE_R6 +/** Start [sodaq_2g_bee_r6] */ // For the Sodaq 2GBee R6 and R7 based on the SIMCom SIM800 // NOTE: The Sodaq GPRSBee doesn't expose the SIM800's reset pin #include @@ -658,12 +659,12 @@ const char* apn = "xxxxx"; // APN for GPRS connection Sodaq2GBeeR6 modem2GB(&modemSerial, modemVccPin, modemStatusPin, apn); // Create an extra reference to the modem by a generic name Sodaq2GBeeR6 modem = modem2GB; -/** End [gprsbee] */ +/** End [sodaq_2g_bee_r6] */ // ========================================================================== -#elif defined BUILD_MODEM_UBEE_R410M -/** Start [sara_r410m] */ +#elif defined BUILD_MODEM_SODAQ_UBEE_R410M +/** Start [sodaq_ubee_r410m] */ // For the Sodaq UBee based on the 4G LTE-M u-blox SARA R410M #include @@ -696,12 +697,12 @@ SodaqUBeeR410M modemR410(&modemSerial, modemVccPin, modemStatusPin, modemResetPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name SodaqUBeeR410M modem = modemR410; -/** End [sara_r410m] */ +/** End [sodaq_ubee_r410m] */ // ========================================================================== -#elif defined BUILD_MODEM_UBEE_U201 -/** Start [sara_u201] */ +#elif defined BUILD_MODEM_SODAQ_UBEE_U201 +/** Start [sodaq_ubee_u201] */ // For the Sodaq UBee based on the 3G u-blox SARA U201 #include @@ -728,7 +729,7 @@ SodaqUBeeU201 modemU201(&modemSerial, modemVccPin, modemStatusPin, modemResetPin, modemSleepRqPin, apn); // Create an extra reference to the modem by a generic name SodaqUBeeU201 modem = modemU201; -/** End [sara_u201] */ +/** End [sodaq_ubee_u201] */ // ========================================================================== #endif @@ -753,7 +754,7 @@ Variable* modemTemperature = // ========================================================================== // Using the Processor as a Sensor // ========================================================================== -/** Start [processor_sensor] */ +/** Start [processor_stats] */ #include // Create the main processor chip "sensor" - for general metadata @@ -768,14 +769,14 @@ Variable* mcuBoardAvailableRAM = new ProcessorStats_FreeRam( &mcuBoard, "12345678-abcd-1234-ef00-1234567890ab"); Variable* mcuBoardSampNo = new ProcessorStats_SampleNumber( &mcuBoard, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [processor_sensor] */ +/** End [processor_stats] */ #if defined ARDUINO_ARCH_AVR || defined MS_SAMD_DS3231 // ========================================================================== // Maxim DS3231 RTC (Real Time Clock) // ========================================================================== -/** Start [ds3231] */ +/** Start [maxim_ds3231] */ #include // Create a DS3231 sensor object @@ -784,15 +785,15 @@ MaximDS3231 ds3231(1); // Create a temperature variable pointer for the DS3231 Variable* ds3231Temp = new MaximDS3231_Temp(&ds3231, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [ds3231] */ +/** End [maxim_ds3231] */ #endif -#if defined BUILD_SENSOR_AM2315 +#if defined BUILD_SENSOR_AO_SONG_AM2315 // ========================================================================== // AOSong AM2315 Digital Humidity and Temperature Sensor // ========================================================================== -/** Start [am2315] */ +/** Start [ao_song_am2315] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -806,15 +807,15 @@ Variable* am2315Humid = new AOSongAM2315_Humidity(&am2315, "12345678-abcd-1234-ef00-1234567890ab"); Variable* am2315Temp = new AOSongAM2315_Temp(&am2315, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [am2315] */ +/** End [ao_song_am2315] */ #endif -#if defined BUILD_SENSOR_DHT +#if defined BUILD_SENSOR_AO_SONG_DHT // ========================================================================== // AOSong DHT 11/21 (AM2301)/22 (AM2302) Digital Humidity and Temperature // ========================================================================== -/** Start [dht] */ +/** Start [ao_song_dht] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -833,15 +834,15 @@ Variable* dhtTemp = new AOSongDHT_Temp(&dht, "12345678-abcd-1234-ef00-1234567890ab"); Variable* dhtHI = new AOSongDHT_HI(&dht, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [dht] */ +/** End [ao_song_dht] */ #endif -#if defined BUILD_SENSOR_SQ212 +#if defined BUILD_SENSOR_APOGEE_SQ212 // ========================================================================== // Apogee SQ-212 Photosynthetically Active Radiation (PAR) Sensor // ========================================================================== -/** Start [sq212] */ +/** Start [apogee_sq212] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -857,15 +858,15 @@ Variable* sq212PAR = new ApogeeSQ212_PAR(&SQ212, "12345678-abcd-1234-ef00-1234567890ab"); Variable* sq212voltage = new ApogeeSQ212_Voltage(&SQ212, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [sq212] */ +/** End [apogee_sq212] */ #endif -#if defined BUILD_SENSOR_ATLASCO2 +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2 // ========================================================================== // Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor // ========================================================================== -/** Start [atlas_co2] */ +/** Start [atlas_scientific_co2] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -884,15 +885,15 @@ Variable* atlasCO2CO2 = new AtlasScientificCO2_CO2( &atlasCO2, "12345678-abcd-1234-ef00-1234567890ab"); Variable* atlasCO2Temp = new AtlasScientificCO2_Temp( &atlasCO2, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [atlas_co2] */ +/** End [atlas_scientific_co2] */ #endif -#if defined BUILD_SENSOR_ATLASDO +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_DO // ========================================================================== // Atlas Scientific EZO-DO Dissolved Oxygen Sensor // ========================================================================== -/** Start [atlas_do] */ +/** Start [atlas_scientific_do] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -911,15 +912,15 @@ Variable* atlasDOconc = new AtlasScientificDO_DOmgL( &atlasDO, "12345678-abcd-1234-ef00-1234567890ab"); Variable* atlasDOpct = new AtlasScientificDO_DOpct( &atlasDO, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [atlas_do] */ +/** End [atlas_scientific_do] */ #endif -#if defined BUILD_SENSOR_ATLASORP +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP // ========================================================================== // Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor // ========================================================================== -/** Start [atlas_orp] */ +/** Start [atlas_scientific_orp] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -936,15 +937,15 @@ AtlasScientificORP atlasORP(AtlasORPPower); // Create a potential variable pointer for the ORP Variable* atlasORPot = new AtlasScientificORP_Potential( &atlasORP, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [atlas_orp] */ +/** End [atlas_scientific_orp] */ #endif -#if defined BUILD_SENSOR_ATLASPH +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_PH // ========================================================================== // Atlas Scientific EZO-pH Sensor // ========================================================================== -/** Start [atlas_ph] */ +/** Start [atlas_scientific_ph] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -961,15 +962,16 @@ AtlasScientificpH atlaspH(AtlaspHPower); // Create a pH variable pointer for the pH sensor Variable* atlaspHpH = new AtlasScientificpH_pH(&atlaspH, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [atlas_ph] */ +/** End [atlas_scientific_ph] */ #endif -#if defined BUILD_SENSOR_ATLASRTD || defined BUILD_SENSOR_ATLASEC +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_RTD || \ + defined BUILD_SENSOR_ATLAS_SCIENTIFIC_EC // ========================================================================== // Atlas Scientific EZO-RTD Temperature Sensor // ========================================================================== -/** Start [atlas_rtd] */ +/** Start [atlas_scientific_rtd] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -986,15 +988,15 @@ AtlasScientificRTD atlasRTD(AtlasRTDPower); // Create a temperature variable pointer for the RTD Variable* atlasTemp = new AtlasScientificRTD_Temp( &atlasRTD, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [atlas_rtd] */ +/** End [atlas_scientific_rtd] */ #endif -#if defined BUILD_SENSOR_ATLASEC +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_EC // ========================================================================== // Atlas Scientific EZO-EC Conductivity Sensor // ========================================================================== -/** Start [atlas_ec] */ +/** Start [atlas_scientific_ec] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1058,15 +1060,15 @@ const char* atlasSpCondUUID = "12345678-abcd-1234-ef00-1234567890ab"; Variable* atlasSpCond = new Variable(calculateAtlasSpCond, atlasSpCondResolution, atlasSpCondName, atlasSpCondUnit, atlasSpCondCode, atlasSpCondUUID); -/** End [atlas_ec] */ +/** End [atlas_scientific_ec] */ #endif -#if defined BUILD_SENSOR_BME280 +#if defined BUILD_SENSOR_BOSCH_BME280 // ========================================================================== // Bosch BME280 Environmental Sensor // ========================================================================== -/** Start [bme280] */ +/** Start [bosch_bme280] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1087,15 +1089,43 @@ Variable* bme280Press = new BoschBME280_Pressure(&bme280, "12345678-abcd-1234-ef00-1234567890ab"); Variable* bme280Alt = new BoschBME280_Altitude(&bme280, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [bme280] */ +/** End [bosch_bme280] */ #endif -#if defined BUILD_SENSOR_OBS3 +#if defined BUILD_SENSOR_CAMPBELL_CLARI_VUE10 +// ========================================================================== +// Campbell ClariVUE Turbidity Sensor +// ========================================================================== +/** Start [campbell_clari_vue10] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const char* ClariVUESDI12address = "0"; // The SDI-12 Address of the ClariVUE10 +const int8_t ClariVUEPower = sensorPowerPin; // Power pin +const int8_t ClariVUEData = 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 ClariVUE10 sensor object +CampbellClariVUE10 clarivue(*ClariVUESDI12address, ClariVUEPower, ClariVUEData); + +// Create turbidity, temperature, and error variable pointers for the ClariVUE10 +Variable* clarivueTurbidity = new CampbellClariVUE10_Turbidity( + &clarivue, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* clarivueTemp = new CampbellClariVUE10_Temp( + &clarivue, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* clarivueError = new CampbellClariVUE10_ErrorCode( + &clarivue, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [campbell_clari_vue10] */ +#endif + + +#if defined BUILD_SENSOR_CAMPBELL_OBS3 // ========================================================================== // Campbell OBS 3 / OBS 3+ Analog Turbidity Sensor // ========================================================================== -/** Start [obs3] */ +/** Start [campbell_obs3] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1137,43 +1167,15 @@ Variable* obs3TurbHigh = new CampbellOBS3_Turbidity( &osb3high, "12345678-abcd-1234-ef00-1234567890ab", "TurbHigh"); Variable* obs3VoltHigh = new CampbellOBS3_Voltage( &osb3high, "12345678-abcd-1234-ef00-1234567890ab", "TurbHighV"); -/** End [obs3] */ +/** End [campbell_obs3] */ #endif -#if defined BUILD_SENSOR_CLARIVUE10 -// ========================================================================== -// Campbell ClariVUE Turbidity Sensor -// ========================================================================== -/** Start [clarivue] */ -#include - -// NOTE: Use -1 for any pins that don't apply or aren't being used. -const char* ClariVUESDI12address = "0"; // The SDI-12 Address of the ClariVUE10 -const int8_t ClariVUEPower = sensorPowerPin; // Power pin -const int8_t ClariVUEData = 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 ClariVUE10 sensor object -CampbellClariVUE10 clarivue(*ClariVUESDI12address, ClariVUEPower, ClariVUEData); - -// Create turbidity, temperature, and error variable pointers for the ClariVUE10 -Variable* clarivueTurbidity = new CampbellClariVUE10_Turbidity( - &clarivue, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* clarivueTemp = new CampbellClariVUE10_Temp( - &clarivue, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* clarivueError = new CampbellClariVUE10_ErrorCode( - &clarivue, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [clarivue] */ -#endif - - -#if defined BUILD_SENSOR_CTD +#if defined BUILD_SENSOR_DECAGON_CTD // ========================================================================== // Decagon CTD-10 Conductivity, Temperature, and Depth Sensor // ========================================================================== -/** Start [decagonCTD] */ +/** Start [decagon_ctd] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1192,15 +1194,15 @@ Variable* ctdTemp = new DecagonCTD_Temp(&ctd, "12345678-abcd-1234-ef00-1234567890ab"); Variable* ctdDepth = new DecagonCTD_Depth(&ctd, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [decagonCTD] */ +/** End [decagon_ctd] */ #endif -#if defined BUILD_SENSOR_ES2 +#if defined BUILD_SENSOR_DECAGON_ES2 // ========================================================================== // Decagon ES2 Conductivity and Temperature Sensor // ========================================================================== -/** Start [es2] */ +/** Start [decagon_es2] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1217,15 +1219,15 @@ Variable* es2Cond = new DecagonES2_Cond(&es2, "12345678-abcd-1234-ef00-1234567890ab"); Variable* es2Temp = new DecagonES2_Temp(&es2, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [es2] */ +/** End [decagon_es2] */ #endif -#if defined BUILD_SENSOR_VOLTAGE +#if defined BUILD_SENSOR_EXTERNAL_VOLTAGE // ========================================================================== // External Voltage via TI ADS1115 // ========================================================================== -/** Start [ext_volt] */ +/** Start [external_voltage] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1242,7 +1244,7 @@ ExternalVoltage extvolt(ADSPower, ADSChannel, dividerGain, evADSi2c_addr, // Create a voltage variable pointer Variable* extvoltV = new ExternalVoltage_Volt(&extvolt, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [ext_volt] */ +/** End [external_voltage] */ #endif @@ -1269,11 +1271,11 @@ Variable* mplTemp = new MPL115A2_Temp(&mpl115a2, #endif -#if defined BUILD_SENSOR_INSITURDO +#if defined BUILD_SENSOR_IN_SITU_RDO // ========================================================================== // InSitu RDO PRO-X Rugged Dissolved Oxygen Probe // ========================================================================== -/** Start [insitu_rdo] */ +/** Start [in_situ_rdo] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1295,15 +1297,15 @@ Variable* rdoTemp = new InSituRDO_Temp(&insituRDO, "12345678-abcd-1234-ef00-1234567890ab"); Variable* rdoO2pp = new InSituRDO_Pressure(&insituRDO, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [insitu_rdo] */ +/** End [in_situ_rdo] */ #endif -#if defined BUILD_SENSOR_INSITUTROOLSDI12A +#if defined BUILD_SENSOR_INSITU_TROLL_SDI12A // ========================================================================== // In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor // ========================================================================== -/** Start [insitu_troll] */ +/** Start [insitu_troll_sdi12a] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1325,15 +1327,15 @@ Variable* trollTemp = new InsituTrollSdi12a_Temp( &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); Variable* trollDepth = new InsituTrollSdi12a_Depth( &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [insitu_troll] */ +/** End [insitu_troll_sdi12a] */ #endif -#if defined BUILD_SENSOR_ACCULEVEL +#if defined BUILD_SENSOR_KELLER_ACCULEVEL // ========================================================================== // Keller Acculevel High Accuracy Submersible Level Transmitter // ========================================================================== -/** Start [acculevel] */ +/** Start [keller_acculevel] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1359,15 +1361,15 @@ Variable* acculevTemp = new KellerAcculevel_Temp( &acculevel, "12345678-abcd-1234-ef00-1234567890ab"); Variable* acculevHeight = new KellerAcculevel_Height( &acculevel, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [acculevel] */ +/** End [keller_acculevel] */ #endif -#if defined BUILD_SENSOR_NANOLEVEL +#if defined BUILD_SENSOR_KELLER_NANOLEVEL // ========================================================================== // Keller Nanolevel High Accuracy Submersible Level Transmitter // ========================================================================== -/** Start [nanolevel] */ +/** Start [keller_nanolevel] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1393,15 +1395,15 @@ Variable* nanolevTemp = new KellerNanolevel_Temp( &nanolevel, "12345678-abcd-1234-ef00-1234567890ab"); Variable* nanolevHeight = new KellerNanolevel_Height( &nanolevel, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [nanolevel] */ +/** End [keller_nanolevel] */ #endif -#if defined BUILD_SENSOR_MAXBOTIX +#if defined BUILD_SENSOR_MAX_BOTIX_SONAR // ========================================================================== // Maxbotix HRXL Ultrasonic Range Finder // ========================================================================== -/** Start [maxbotics] */ +/** Start [max_botix_sonar] */ #include // A Maxbotix sonar with the trigger pin disconnect CANNOT share the serial port @@ -1423,15 +1425,16 @@ MaxBotixSonar sonar1(sonarSerial, SonarPower, Sonar1Trigger, // Create an ultrasonic range variable pointer Variable* sonar1Range = new MaxBotixSonar_Range(&sonar1, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [maxbotics] */ +/** End [max_botix_sonar] */ #endif -#if defined BUILD_SENSOR_DS18 || defined BUILD_SENSOR_ANALOGEC +#if defined BUILD_SENSOR_MAXIM_DS18 || \ + defined BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY // ========================================================================== // Maxim DS18 One Wire Temperature Sensor // ========================================================================== -/** Start [ds18] */ +/** Start [maxim_ds18] */ #include // OneWire Address [array of 8 hex characters] @@ -1453,15 +1456,15 @@ MaximDS18 ds18(OneWireAddress1, OneWirePower, OneWireBus, ds18NumberReadings); // Create a temperature variable pointer for the DS18 Variable* ds18Temp = new MaximDS18_Temp(&ds18, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [ds18] */ +/** End [maxim_ds18] */ #endif -#if defined BUILD_SENSOR_MS5803 +#if defined BUILD_SENSOR_MEA_SPEC_MS5803 // ========================================================================== // Measurement Specialties MS5803-14BA pressure sensor // ========================================================================== -/** Start [ms5803] */ +/** Start [mea_spec_ms5803] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1481,15 +1484,15 @@ Variable* ms5803Press = new MeaSpecMS5803_Pressure(&ms5803, "12345678-abcd-1234-ef00-1234567890ab"); Variable* ms5803Temp = new MeaSpecMS5803_Temp(&ms5803, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [ms5803] */ +/** End [mea_spec_ms5803] */ #endif -#if defined BUILD_SENSOR_5TM +#if defined BUILD_SENSOR_DECAGON_5TM // ========================================================================== // Meter ECH2O Soil Moisture Sensor // ========================================================================== -/** Start [fivetm] */ +/** Start [decagon_5tm] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1508,15 +1511,15 @@ Variable* fivetmVWC = new Decagon5TM_VWC(&fivetm, "12345678-abcd-1234-ef00-1234567890ab"); Variable* fivetmTemp = new Decagon5TM_Temp(&fivetm, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [fivetm] */ +/** End [decagon_5tm] */ #endif -#if defined BUILD_SENSOR_HYDROS21 +#if defined BUILD_SENSOR_METER_HYDROS21 // ========================================================================== // Meter Hydros 21 Conductivity, Temperature, and Depth Sensor // ========================================================================== -/** Start [hydros21] */ +/** Start [meter_hydros21] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1537,15 +1540,15 @@ Variable* hydros21Temp = new MeterHydros21_Temp(&hydros21, "12345678-abcd-1234-ef00-1234567890ab"); Variable* hydros21Depth = new MeterHydros21_Depth(&hydros21, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [hydros21] */ +/** End [meter_hydros21] */ #endif -#if defined BUILD_SENSOR_TEROS11 +#if defined BUILD_SENSOR_METER_TEROS11 // ========================================================================== // Meter Teros 11 Soil Moisture Sensor // ========================================================================== -/** Start [teros] */ +/** Start [meter_teros11] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1566,15 +1569,17 @@ Variable* teros11Temp = new MeterTeros11_Temp(&teros11, "12345678-abcd-1234-ef00-1234567890ab"); Variable* teros11VWC = new MeterTeros11_VWC(&teros11, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [teros] */ +Variable* teros11Count = + new MeterTeros11_Count(&teros11, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [meter_teros11] */ #endif -#if defined BUILD_SENSOR_PALEOTERRA +#if defined BUILD_SENSOR_PALEO_TERRA_REDOX // ========================================================================== // PaleoTerra Redox Sensors // ========================================================================== -/** Start [pt_redox] */ +/** Start [paleo_terra_redox] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1593,15 +1598,15 @@ PaleoTerraRedox ptRedox(paleoTerraPower, paleoI2CAddress); // Create the voltage variable for the redox sensor Variable* ptVolt = new PaleoTerraRedox_Volt(&ptRedox, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [pt_redox] */ +/** End [paleo_terra_redox] */ #endif -#if defined BUILD_SENSOR_RAINI2C +#if defined BUILD_SENSOR_RAIN_COUNTER_I2C // ========================================================================== // External I2C Rain Tipping Bucket Counter // ========================================================================== -/** Start [i2c_rain] */ +/** Start [rain_counter_i2c] */ #include const uint8_t RainCounterI2CAddress = 0x08; @@ -1622,15 +1627,15 @@ Variable* tbi2cTips = new RainCounterI2C_Tips(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); Variable* tbi2cDepth = new RainCounterI2C_Depth(&tbi2c, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [i2c_rain] */ +/** End [rain_counter_i2c] */ #endif -#if defined BUILD_SENSOR_TALLY +#if defined BUILD_SENSOR_TALLY_COUNTER_I2C // ========================================================================== // Tally I2C Event Counter for rain or wind reed-switch sensors // ========================================================================== -/** Start [i2c_wind_tally] */ +/** Start [tally_counter_i2c] */ #include const int8_t TallyPower = -1; // Power pin (-1 if continuously powered) @@ -1655,15 +1660,15 @@ Variable* tallyEvents = new TallyCounterI2C_Events( // tallyWindSpeed = frequency * 2.5 * 1.60934; // in km/h // 2.5 mph/Hz & 1.60934 kmph/mph and 2.5 mph/Hz conversion factor from // web: Inspeed-Version-II-Reed-Switch-Anemometer-Sensor-Only-WS2R -/** End [i2c_wind_tally] */ +/** End [tally_counter_i2c] */ #endif -#if defined BUILD_SENSOR_INA219 +#if defined BUILD_SENSOR_TI_INA219 // ========================================================================== // TI INA219 High Side Current/Voltage Sensor (Current mA, Voltage, Power) // ========================================================================== -/** Start [ina219] */ +/** Start [ti_ina219] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1683,15 +1688,15 @@ Variable* inaVolt = new TIINA219_Volt(&ina219, "12345678-abcd-1234-ef00-1234567890ab"); Variable* inaPower = new TIINA219_Power(&ina219, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [ina219] */ +/** End [ti_ina219] */ #endif -#if defined BUILD_SENSOR_CYCLOPS +#if defined BUILD_SENSOR_TURNER_CYCLOPS // ========================================================================== // Turner Cyclops-7F Submersible Fluorometer // ========================================================================== -/** Start [cyclops] */ +/** Start [turner_cyclops] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1745,15 +1750,15 @@ Variable* cyclopsTryptophan = new TurnerCyclops_Tryptophan( &cyclops, "12345678-abcd-1234-ef00-1234567890ab"); Variable* cyclopsRedChloro = new TurnerCyclops_RedChlorophyll( &cyclops, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [cyclops] */ +/** End [turner_cyclops] */ #endif -#if defined BUILD_SENSOR_ANALOGEC +#if defined BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY // ========================================================================== // Analog Electrical Conductivity using the Processor's Analog Pins // ========================================================================== -/** Start [analog_cond] */ +/** Start [analog_elec_conductivity] */ #include const int8_t ECpwrPin = A4; // Power pin (-1 if continuously powered) @@ -1806,15 +1811,15 @@ const char* analogSpCondUUID = "12345678-abcd-1234-ef00-1234567890ab"; Variable* analogEc_spcond = new Variable( calculateAnalogSpCond, analogSpCondResolution, analogSpCondName, analogSpCondUnit, analogSpCondCode, analogSpCondUUID); -/** End [analog_cond] */ +/** End [analog_elec_conductivity] */ #endif -#if defined BUILD_SENSOR_Y504 +#if defined BUILD_SENSOR_YOSEMITECH_Y504 // ========================================================================== // Yosemitech Y504 Dissolved Oxygen Sensor // ========================================================================== -/** Start [y504] */ +/** Start [yosemitech_y504] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1841,15 +1846,15 @@ Variable* y504DOmgL = new YosemitechY504_DOmgL(&y504, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y504Temp = new YosemitechY504_Temp(&y504, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y504] */ +/** End [yosemitech_y504] */ #endif -#if defined BUILD_SENSOR_Y510 +#if defined BUILD_SENSOR_YOSEMITECH_Y510 // ========================================================================== // Yosemitech Y510 Turbidity Sensor // ========================================================================== -/** Start [y510] */ +/** Start [yosemitech_y510] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1873,15 +1878,15 @@ Variable* y510Turb = new YosemitechY510_Turbidity(&y510, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y510Temp = new YosemitechY510_Temp(&y510, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y510] */ +/** End [yosemitech_y510] */ #endif -#if defined BUILD_SENSOR_Y511 +#if defined BUILD_SENSOR_YOSEMITECH_Y511 // ========================================================================== // Yosemitech Y511 Turbidity Sensor with Wiper // ========================================================================== -/** Start [y511] */ +/** Start [yosemitech_y511] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1905,15 +1910,15 @@ Variable* y511Turb = new YosemitechY511_Turbidity(&y511, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y511Temp = new YosemitechY511_Temp(&y511, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y511] */ +/** End [yosemitech_y511] */ #endif -#if defined BUILD_SENSOR_Y514 +#if defined BUILD_SENSOR_YOSEMITECH_Y514 // ========================================================================== // Yosemitech Y514 Chlorophyll Sensor // ========================================================================== -/** Start [y514] */ +/** Start [yosemitech_y514] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1938,15 +1943,15 @@ Variable* y514Chloro = new YosemitechY514_Chlorophyll( &y514, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y514Temp = new YosemitechY514_Temp(&y514, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y514] */ +/** End [yosemitech_y514] */ #endif -#if defined BUILD_SENSOR_Y520 +#if defined BUILD_SENSOR_YOSEMITECH_Y520 // ========================================================================== // Yosemitech Y520 Conductivity Sensor // ========================================================================== -/** Start [y520] */ +/** Start [yosemitech_y520] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -1970,15 +1975,15 @@ Variable* y520Cond = new YosemitechY520_Cond(&y520, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y520Temp = new YosemitechY520_Temp(&y520, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y520] */ +/** End [yosemitech_y520] */ #endif -#if defined BUILD_SENSOR_Y532 +#if defined BUILD_SENSOR_YOSEMITECH_Y532 // ========================================================================== // Yosemitech Y532 pH // ========================================================================== -/** Start [y532] */ +/** Start [yosemitech_y532] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -2004,15 +2009,15 @@ Variable* y532pH = new YosemitechY532_pH(&y532, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y532Temp = new YosemitechY532_Temp(&y532, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y532] */ +/** End [yosemitech_y532] */ #endif -#if defined BUILD_SENSOR_Y533 +#if defined BUILD_SENSOR_YOSEMITECH_Y533 // ========================================================================== // Yosemitech Y533 Oxidation Reduction Potential (ORP) // ========================================================================== -/** Start [y533] */ +/** Start [yosemitech_y533] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -2035,15 +2040,15 @@ Variable* y533ORP = new YosemitechY533_ORP(&y533, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y533Temp = new YosemitechY533_Temp(&y533, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y533] */ +/** End [yosemitech_y533] */ #endif -#if defined BUILD_SENSOR_Y551 +#if defined BUILD_SENSOR_YOSEMITECH_Y551 // ========================================================================== // Yosemitech Y551 COD Sensor with Wiper // ========================================================================== -/** Start [y551] */ +/** Start [yosemitech_y551] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -2069,15 +2074,15 @@ Variable* y551Turbid = new YosemitechY551_Turbidity(&y551, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y551Temp = new YosemitechY551_Temp(&y551, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y551] */ +/** End [yosemitech_y551] */ #endif -#if defined BUILD_SENSOR_Y560 +#if defined BUILD_SENSOR_YOSEMITECH_Y560 // ========================================================================== // Yosemitech Y560 Ammonium Probe with Wiper // ========================================================================== -/** Start [y560] */ +/** Start [yosemitech_y560] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -2105,16 +2110,16 @@ Variable* y560pH = new YosemitechY560_pH(&y560, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y560Temp = new YosemitechY560_Temp(&y560, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y560] */ +/** End [yosemitech_y560] */ #endif -#if defined BUILD_SENSOR_Y4000 +#if defined BUILD_SENSOR_YOSEMITECH_Y4000 // ========================================================================== // Yosemitech Y4000 Multiparameter Sonde (DOmgL, Turbidity, Cond, pH, Temp, // ORP, Chlorophyll, BGA) // ========================================================================== -/** Start [y4000] */ +/** Start [yosemitech_y4000] */ #include // NOTE: Extra hardware and software serial ports are created in the "Settings @@ -2150,15 +2155,15 @@ Variable* y4000Chloro = new YosemitechY4000_Chlorophyll( &y4000, "12345678-abcd-1234-ef00-1234567890ab"); Variable* y4000BGA = new YosemitechY4000_BGA(&y4000, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [y4000] */ +/** End [yosemitech_y4000] */ #endif -#if defined BUILD_SENSOR_DOPTO +#if defined BUILD_SENSOR_ZEBRA_TECH_D_OPTO // ========================================================================== // Zebra Tech D-Opto Dissolved Oxygen Sensor // ========================================================================== -/** Start [dopto] */ +/** Start [zebra_tech_d_opto] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -2177,7 +2182,7 @@ Variable* dOptoDOmgL = new ZebraTechDOpto_DOmgL(&dopto, "12345678-abcd-1234-ef00-1234567890ab"); Variable* dOptoTemp = new ZebraTechDOpto_Temp(&dopto, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [dopto] */ +/** End [zebra_tech_d_opto] */ #endif @@ -2296,133 +2301,139 @@ Variable* variableList[] = { #if defined ARDUINO_ARCH_AVR || defined MS_SAMD_DS3231 ds3231Temp, #endif -#if defined BUILD_SENSOR_AM2315 +#if defined BUILD_SENSOR_AO_SONG_AM2315 am2315Humid, am2315Temp, #endif -#if defined BUILD_SENSOR_DHT +#if defined BUILD_SENSOR_AO_SONG_DHT dhtHumid, dhtTemp, dhtHI, #endif -#if defined BUILD_SENSOR_SQ212 +#if defined BUILD_SENSOR_APOGEE_SQ212 sq212PAR, sq212voltage, #endif -#if defined BUILD_SENSOR_ATLASCO2 +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2 atlasCO2CO2, atlasCO2Temp, #endif -#if defined BUILD_SENSOR_ATLASDO +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_DO atlasDOconc, atlasDOpct, #endif -#if defined BUILD_SENSOR_ATLASORP +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP atlasORPot, #endif -#if defined BUILD_SENSOR_ATLASPH +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_PH atlaspHpH, #endif -#if defined BUILD_SENSOR_ATLASRTD +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_RTD atlasTemp, #endif -#if defined BUILD_SENSOR_ATLASEC +#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_EC atlasCond, atlasTDS, atlasSal, atlasGrav, atlasSpCond, #endif -#if defined BUILD_SENSOR_BME280 +#if defined BUILD_SENSOR_BOSCH_BME280 bme280Temp, bme280Humid, bme280Press, bme280Alt, #endif -#if defined BUILD_SENSOR_OBS3 - obs3TurbLow, +#if defined BUILD_SENSOR_CAMPBELL_CLARI_VUE10 + clarivueTurbidity, + clarivueTemp, + clarivueError +#endif +#if defined BUILD_SENSOR_CAMPBELL_OBS3 + obs3TurbLow, obs3VoltLow, obs3TurbHigh, obs3VoltHigh, #endif -#if defined BUILD_SENSOR_CTD +#if defined BUILD_SENSOR_DECAGON_CTD ctdCond, ctdTemp, ctdDepth, #endif -#if defined BUILD_SENSOR_ES2 +#if defined BUILD_SENSOR_DECAGON_ES2 es2Cond, es2Temp, #endif -#if defined BUILD_SENSOR_VOLTAGE +#if defined BUILD_SENSOR_EXTERNAL_VOLTAGE extvoltV, #endif #if defined BUILD_SENSOR_MPL115A2 mplTemp, mplPress, #endif -#if defined BUILD_SENSOR_INSITURDO +#if defined BUILD_SENSOR_IN_SITU_RDO rdoTemp, rdoDOpct, rdoDOmgL, rdoO2pp, #endif -#if defined BUILD_SENSOR_INSITUTROOLSDI12A +#if defined BUILD_SENSOR_INSITU_TROLL_SDI12A trollPressure, trollTemp, trollDepth, #endif -#if defined BUILD_SENSOR_ACCULEVEL +#if defined BUILD_SENSOR_KELLER_ACCULEVEL acculevPress, acculevTemp, acculevHeight, #endif -#if defined BUILD_SENSOR_NANOLEVEL +#if defined BUILD_SENSOR_KELLER_NANOLEVEL nanolevPress, nanolevTemp, nanolevHeight, #endif -#if defined BUILD_SENSOR_MAXBOTIX +#if defined BUILD_SENSOR_MAX_BOTIX_SONAR sonar1Range, #endif -#if defined BUILD_SENSOR_DS18 +#if defined BUILD_SENSOR_MAXIM_DS18 ds18Temp, #endif -#if defined BUILD_SENSOR_MS5803 +#if defined BUILD_SENSOR_MEA_SPEC_MS5803 ms5803Temp, ms5803Press, #endif -#if defined BUILD_SENSOR_5TM +#if defined BUILD_SENSOR_DECAGON_5TM fivetmEa, fivetmVWC, fivetmTemp, #endif -#if defined BUILD_SENSOR_HYDROS21 +#if defined BUILD_SENSOR_METER_HYDROS21 hydros21Cond, hydros21Temp, hydros21Depth, #endif -#if defined BUILD_SENSOR_TEROS11 +#if defined BUILD_SENSOR_METER_TEROS11 teros11Ea, teros11Temp, teros11VWC, + teros11Count, #endif -#if defined BUILD_SENSOR_PALEOTERRA +#if defined BUILD_SENSOR_PALEO_TERRA_REDOX ptVolt, #endif -#if defined BUILD_SENSOR_RAINI2C +#if defined BUILD_SENSOR_RAIN_COUNTER_I2C tbi2cTips, tbi2cDepth, #endif -#if defined BUILD_SENSOR_TALLY +#if defined BUILD_SENSOR_TALLY_COUNTER_I2C tallyEvents, #endif -#if defined BUILD_SENSOR_INA219 +#if defined BUILD_SENSOR_TI_INA219 inaVolt, inaCurrent, inaPower, #endif -#if defined BUILD_SENSOR_CYCLOPS +#if defined BUILD_SENSOR_TURNER_CYCLOPS cyclopsVoltage, cyclopsChloro, cyclopsRWT, @@ -2438,51 +2449,51 @@ Variable* variableList[] = { cyclopsTryptophan, cyclopsRedChloro, #endif -#if defined BUILD_SENSOR_ANALOGEC +#if defined BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY analogEc_cond, analogEc_spcond, #endif -#if defined BUILD_SENSOR_Y504 +#if defined BUILD_SENSOR_YOSEMITECH_Y504 y504DOpct, y504DOmgL, y504Temp, #endif -#if defined BUILD_SENSOR_Y510 +#if defined BUILD_SENSOR_YOSEMITECH_Y510 y510Turb, y510Temp, #endif -#if defined BUILD_SENSOR_Y511 +#if defined BUILD_SENSOR_YOSEMITECH_Y511 y511Turb, y511Temp, #endif -#if defined BUILD_SENSOR_Y514 +#if defined BUILD_SENSOR_YOSEMITECH_Y514 y514Chloro, y514Temp, #endif -#if defined BUILD_SENSOR_Y520 +#if defined BUILD_SENSOR_YOSEMITECH_Y520 y520Cond, y520Temp, #endif -#if defined BUILD_SENSOR_Y532 +#if defined BUILD_SENSOR_YOSEMITECH_Y532 y532Voltage, y532pH, y532Temp, #endif -#if defined BUILD_SENSOR_Y533 +#if defined BUILD_SENSOR_YOSEMITECH_Y533 y533ORP, y533Temp, #endif -#if defined BUILD_SENSOR_Y551 +#if defined BUILD_SENSOR_YOSEMITECH_Y551 y551COD, y551Turbid, y551Temp, #endif -#if defined BUILD_SENSOR_Y560 +#if defined BUILD_SENSOR_YOSEMITECH_Y560 y560NH4_N, y560pH, y560Temp, #endif -#if defined BUILD_SENSOR_Y4000 +#if defined BUILD_SENSOR_YOSEMITECH_Y4000 y4000DO, y4000Turb, y4000Cond, @@ -2492,7 +2503,7 @@ Variable* variableList[] = { y4000Chloro, y4000BGA, #endif -#if defined BUILD_SENSOR_DOPTO +#if defined BUILD_SENSOR_ZEBRA_TECH_D_OPTO dOptoDOpct, dOptoDOmgL, dOptoTemp, @@ -2525,11 +2536,11 @@ Logger dataLogger(LoggerID, loggingInterval, &varArray); /** End [loggers] */ -#if defined BUILD_PUB_MMW +#if defined BUILD_PUB_ENVIRO_DIY_PUBLISHER // ========================================================================== // A Publisher to Monitor My Watershed / EnviroDIY Data Sharing Portal // ========================================================================== -/** Start [monitormw] */ +/** Start [enviro_diy_publisher] */ // Device registration and sampling feature information can be obtained after // registration at https://monitormywatershed.org or https://data.envirodiy.org const char* registrationToken = @@ -2541,15 +2552,15 @@ const char* samplingFeature = #include EnviroDIYPublisher EnviroDIYPOST(dataLogger, &modem.gsmClient, registrationToken, samplingFeature); -/** End [monitormw] */ +/** End [enviro_diy_publisher] */ #endif -#if defined BUILD_PUB_DREAMHOST +#if defined BUILD_PUB_DREAM_HOST_PUBLISHER // ========================================================================== // A Publisher to DreamHost // ========================================================================== -/** Start [dreamhost] */ +/** Start [dream_host_publisher] */ // NOTE: This is an outdated data collection tool used by the Stroud Center. // It very, very unlikely that you will use this. @@ -2559,15 +2570,15 @@ const char* DreamHostPortalRX = "xxxx"; #include DreamHostPublisher DreamHostGET(dataLogger, &modem.gsmClient, DreamHostPortalRX); -/** End [dreamhost] */ +/** End [dream_host_publisher] */ #endif -#if defined BUILD_PUB_THINGSPEAK +#if defined BUILD_PUB_THING_SPEAK_PUBLISHER // ========================================================================== // ThingSpeak Data Publisher // ========================================================================== -/** Start [thingspeak] */ +/** Start [thing_speak_publisher] */ // Create a channel with fields on ThingSpeak in advance. // The fields will be sent in exactly the order they are in the variable array. // Any custom name or identifier given to the field on ThingSpeak is irrelevant. @@ -2584,7 +2595,7 @@ const char* thingSpeakChannelKey = #include ThingSpeakPublisher TsMqtt(dataLogger, &modem.gsmClient, thingSpeakMQTTKey, thingSpeakChannelID, thingSpeakChannelKey); -/** End [thingspeak] */ +/** End [thing_speak_publisher] */ #endif @@ -2664,7 +2675,7 @@ void setup() { // all currently supported modbus sensors use 9600 baud modbusSerial.begin(9600); -#if defined BUILD_SENSOR_MAXBOTIX +#if defined BUILD_SENSOR_MAX_BOTIX_SONAR // Start the SoftwareSerial stream for the sonar; it will always be at 9600 // baud sonarSerial.begin(9600); @@ -2713,16 +2724,17 @@ void setup() { dataLogger.begin(); /** End [setup_logger] */ - /** Start [setup_sesors] */ + /** Start [setup_sensors] */ // 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(); } - /** End [setup_sesors] */ + /** End [setup_sensors] */ -#if (defined BUILD_MODEM_ESP8266 || defined BUILD_MODEM_ESP32) && \ +#if (defined BUILD_MODEM_ESPRESSIF_ESP8266 || \ + defined BUILD_MODEM_ESPRESSIF_ESP32) && \ F_CPU == 8000000L /** Start [setup_esp] */ if (modemBaud > 57600) { @@ -2744,7 +2756,7 @@ void setup() { /** End [setup_skywire] */ #endif -#if defined BUILD_MODEM_SIM7080 +#if defined BUILD_MODEM_SIM_COM_SIM7080 /** Start [setup_sim7080] */ modem.setModemWakeLevel(HIGH); // ModuleFun Bee inverts the signal modem.setModemResetLevel(HIGH); // ModuleFun Bee inverts the signal @@ -2763,7 +2775,7 @@ void setup() { /** End [setup_sim7080] */ #endif -#if defined BUILD_MODEM_XBEE_CELLULAR +#if defined BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT /** Start [setup_xbeec_carrier] */ // Extra modem set-up Serial.println(F("Waking modem and setting Cellular Carrier Options...")); @@ -2800,7 +2812,7 @@ void setup() { #endif -#if defined BUILD_MODEM_XBEE_LTE_B +#if defined BUILD_MODEM_DIGI_XBEE_LTE_BYPASS /** Start [setup_r4_carrrier] */ // Extra modem set-up Serial.println(F("Waking modem and setting Cellular Carrier Options...")); diff --git a/examples/menu_a_la_carte/platformio.ini b/examples/menu_a_la_carte/platformio.ini index 00cda6618..b2888d268 100644 --- a/examples/menu_a_la_carte/platformio.ini +++ b/examples/menu_a_la_carte/platformio.ini @@ -34,7 +34,7 @@ build_flags = -DTINY_GSM_YIELD_MS=2 -DENABLE_SERIAL2 -DENABLE_SERIAL3 - ; -D BUILD_MODEM_XBEE_CELLULAR ; Turn on first time w/ a Digi LTE-M module + ; -D BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT ; Turn on first time w/ a Digi LTE-M module ; -D MS_LOGGERBASE_DEBUG ; -D MS_DATAPUBLISHERBASE_DEBUG ; -D MS_ENVIRODIYPUBLISHER_DEBUG diff --git a/examples/simple_logging/ReadMe.md b/examples/simple_logging/ReadMe.md index 9adc28011..5ec863e75 100644 --- a/examples/simple_logging/ReadMe.md +++ b/examples/simple_logging/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_simple_logging Simple Logging Example ) -# Using ModularSensors to save data to an SD card +# Simple Logging This shows the simplest use of a "logger" object. That is, creating an array of variable objects and then creating a logger object that utilizes those variables to update all of the variable results together and save the data to a SD card. @@ -12,26 +11,23 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to save data to an SD card](#using-modularsensors-to-save-data-to-an-sd-card) +- [Simple Logging](#simple-logging) - [Unique Features of the Simple Logging Example](#unique-features-of-the-simple-logging-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Upload!](#upload) [//]: # ( End GitHub Only ) -_______ -[//]: # ( @section example_simple_logging_unique Unique Features of the Simple Logging Example ) -# Unique Features of the Simple Logging Example + +# Unique Features of the Simple Logging Example - Only logs data to an SD card. -[//]: # ( @section example_simple_logging_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_simple_logging_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging/platformio.ini) file in the examples/simple_logging folder on GitHub. - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. @@ -39,8 +35,7 @@ _______ - Open [simple_logging.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging/simple_logging.ino) and save it to your computer. Put it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_simple_logging_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -48,8 +43,7 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_simple_logging_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -60,3 +54,5 @@ _______ [//]: # ( @include{lineno} simple_logging/platformio.ini ) [//]: # ( @section example_simple_logging_code The Complete Code ) + +[//]: # ( @include{lineno} simple_logging/simple_logging.ino ) diff --git a/examples/simple_logging/simple_logging.ino b/examples/simple_logging/simple_logging.ino index 595a08eb8..c71faf87a 100644 --- a/examples/simple_logging/simple_logging.ino +++ b/examples/simple_logging/simple_logging.ino @@ -3,7 +3,7 @@ * @brief A simple data logging example. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * diff --git a/examples/simple_logging_LearnEnviroDIY/ReadMe.md b/examples/simple_logging_LearnEnviroDIY/ReadMe.md index d98588f96..d32d9ce25 100644 --- a/examples/simple_logging_LearnEnviroDIY/ReadMe.md +++ b/examples/simple_logging_LearnEnviroDIY/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_learn_envirodiy Learn EnviroDIY Example ) -# Using ModularSensors to save data to an SD card +# Learn EnviroDIY Course This shows the simplest use of a "logger" object. That is, creating an array of variable objects and then creating a logger object that utilizes those variables to update all of the variable results together and save the data to a SD card. @@ -14,7 +13,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to save data to an SD card](#using-modularsensors-to-save-data-to-an-sd-card) +- [Learn EnviroDIY Course](#learn-envirodiy-course) - [Unique Features of the Learn EnviroDIY Example](#unique-features-of-the-learn-envirodiy-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -25,16 +24,13 @@ _______ _______ -[//]: # ( @section example_learn_envirodiy_unique Unique Features of the Learn EnviroDIY Example ) -# Unique Features of the Learn EnviroDIY Example +# Unique Features of the Learn EnviroDIY Example - Only logs data to an SD card. - Uses a few more sensors than the other simple logging example -[//]: # ( @section example_learn_envirodiy_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_learn_envirodiy_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/platformio.ini) file in the examples/simple_logging_LearnEnviroDIY folder on GitHub. - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. @@ -42,8 +38,7 @@ _______ - Open [simple_logging_LearnEnviroDIY.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino) and save it to your computer. Put it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_learn_envirodiy_logger_id Set the logger ID ) -## Set the logger ID +## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -51,8 +46,7 @@ _______ const char *LoggerID = "XXXX"; ``` -[//]: # ( @subsection example_learn_envirodiy_upload Upload! ) -## Upload! +## Upload! - Test everything at home **before** deploying out in the wild! _______ @@ -64,3 +58,5 @@ _______ [//]: # ( @include{lineno} simple_logging_LearnEnviroDIY/platformio.ini ) [//]: # ( @section example_learn_envirodiy_code The Complete Code ) + +[//]: # ( @include{lineno} simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino ) diff --git a/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino b/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino index 997bf568e..97323f45a 100644 --- a/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino +++ b/examples/simple_logging_LearnEnviroDIY/simple_logging_LearnEnviroDIY.ino @@ -3,7 +3,7 @@ * @brief A data logging example for the Learn EnviroDIY tutorial. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * diff --git a/examples/single_sensor/ReadMe.md b/examples/single_sensor/ReadMe.md index 8f237acaa..8192503a0 100644 --- a/examples/single_sensor/ReadMe.md +++ b/examples/single_sensor/ReadMe.md @@ -1,5 +1,4 @@ -[//]: # ( @page example_single_sensor Single Sensor Example ) -# Using ModularSensors to Communicate with a Single Sensor +# Using a Single Sensor This somewhat trivial example show making use of the unified set of commands to print data from a MaxBotix ultrasonic range finder to the serial port. It also shows creating a calculated variable which is the water depth. @@ -9,7 +8,7 @@ _______ [//]: # ( @tableofcontents ) [//]: # ( Start GitHub Only ) -- [Using ModularSensors to Communicate with a Single Sensor](#using-modularsensors-to-communicate-with-a-single-sensor) +- [Using a Single Sensor](#using-a-single-sensor) - [Unique Features of the Single Sensor Example](#unique-features-of-the-single-sensor-example) - [To Use this Example:](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) @@ -19,16 +18,13 @@ _______ _______ -[//]: # ( @section example_single_sensor_unique Unique Features of the Single Sensor Example ) -# Unique Features of the Single Sensor Example +# Unique Features of the Single Sensor Example - Only communicates with and collects data from a single sensor. - Does not make use of any VariableArray or logging features. -[//]: # ( @section example_single_sensor_using To Use this Example: ) -# To Use this Example: +# To Use this Example -[//]: # ( @subsection example_single_sensor_pio Prepare and set up PlatformIO ) -## Prepare and set up PlatformIO +## Prepare and set up PlatformIO - Create a new PlatformIO project - Replace the contents of the platformio.ini for your new project with the [platformio.ini](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/single_sensor/platformio.ini) file in the examples/single_sensor folder on GitHub. - It is important that your PlatformIO configuration has the lib_ldf_mode and build flags set as they are in the example. @@ -36,8 +32,7 @@ _______ - Open [single_sensor.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/single_sensor/single_sensor.ino) and save it to your computer. Put it into the src directory of your project. - Delete main.cpp in that folder. -[//]: # ( @subsection example_single_sensor_upload Upload! ) -## Upload! +## Upload! - Upload and see what happens _______ @@ -48,3 +43,5 @@ _______ [//]: # ( @include{lineno} single_sensor/platformio.ini ) [//]: # ( @section example_single_sensor_code The Complete Code ) + +[//]: # ( @include{lineno} single_sensor/single_sensor.ino ) diff --git a/examples/single_sensor/single_sensor.ino b/examples/single_sensor/single_sensor.ino index 72d732b9a..b0b7bdf6c 100644 --- a/examples/single_sensor/single_sensor.ino +++ b/examples/single_sensor/single_sensor.ino @@ -3,7 +3,7 @@ * @brief An example using only sensor functions and no logging. * * @author Sara Geleskie Damiano - * @copyright (c) 2017-2021 Stroud Water Research Center (SWRC) + * @copyright (c) 2017-2022 Stroud Water Research Center (SWRC) * and the EnviroDIY Development Team * This example is published under the BSD-3 license. * diff --git a/src/LoggerBase.h b/src/LoggerBase.h index f1cc33720..275e3713a 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -466,8 +466,7 @@ class Logger { /** * @brief Attach a loggerModem to the logger to provide internet access. * - * See [Modem and Internet - * Functions](https://envirodiy.github.io/ModularSensors/group__the__modems.html) + * See [Modem and Internet Functions](@ref the_modems) * for more information on how the modem must be set up before it is * attached to the logger. You must include an ampersand to tie in the * already created modem! If you do not attach a modem, no action will be diff --git a/src/modems/DigiXBee.h b/src/modems/DigiXBee.h index f419e21d2..29fa28250 100644 --- a/src/modems/DigiXBee.h +++ b/src/modems/DigiXBee.h @@ -31,7 +31,7 @@ * * @section modem_digi_mayfly-and-digi-xbee-connections Mayfly and Digi XBee Connections * - * @subsection modem_digi_raw_pins Pin Numbers for connecting Digi XBee's Directly to a Mayfly + * @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. * @code{cpp} @@ -53,7 +53,7 @@ * - XBee pin 9 is SLEEP_RQ which is connected to Mayfly pin 23. * - I like to use the red LED to show the bee wake/sleep since the Digi XBee's have no LEDs of their own. * - * @subsection modem_digi_adapter_pins Pin Numbers for connecting Digi LTE XBee3's to a Mayfly via the LTE adapter board + * @subsection modem_digi_adapter_pins Pin Numbers for connecting Digi LTE XBee3's to a Mayfly v0.3-v0.5c via the LTE adapter board * * @code{cpp} * const int8_t modemVccPin = -1; // MCU pin controlling modem power diff --git a/src/modems/DigiXBee3GBypass.h b/src/modems/DigiXBee3GBypass.h index 76bbbad74..113443b66 100644 --- a/src/modems/DigiXBee3GBypass.h +++ b/src/modems/DigiXBee3GBypass.h @@ -39,9 +39,9 @@ * * ___ * @section modem_digi_3g_bypass_examples Example Code - * The digi_cellular is used in the @menulink{digi_3gby} example. + * The digi_cellular is used in the @menulink{digi_xbee_3g_bypass} example. * - * @menusnip{xbee_3g_bypass} + * @menusnip{digi_xbee_3g_bypass} */ /* clang-format on */ diff --git a/src/modems/DigiXBeeCellularTransparent.h b/src/modems/DigiXBeeCellularTransparent.h index 430e698ff..6698e20b1 100644 --- a/src/modems/DigiXBeeCellularTransparent.h +++ b/src/modems/DigiXBeeCellularTransparent.h @@ -53,9 +53,9 @@ * @subsection modem_digi_cellular_modem_obj Creating the Modem Object * * A transparent-mode Digi cellular module is used in the - * @menulink{xbee_cell_trans} example. + * @menulink{digi_xbee_cellular_transparent} example. * - * @menusnip{xbee_cell_transparent} + * @menusnip{digi_xbee_cellular_transparent} * * @subsection modem_digi_cellular_network LTE Network Selection * diff --git a/src/modems/DigiXBeeLTEBypass.h b/src/modems/DigiXBeeLTEBypass.h index f51aa25e2..8496e8239 100644 --- a/src/modems/DigiXBeeLTEBypass.h +++ b/src/modems/DigiXBeeLTEBypass.h @@ -42,9 +42,9 @@ * @section modem_digi_lte_bypass_examples Example Code * @subsection modem_digi_lte_bypass_modem_obj Creating the Modem Object * - * The digi_cellular is used in the @menulink{xbee_ltem_by} example. + * The digi_cellular is used in the @menulink{digi_xbee_lte_bypass} example. * - * @menusnip{xbee3_ltem_bypass} + * @menusnip{digi_xbee_lte_bypass} * * @section modem_digi_lte_bypass_network LTE Network Selection * diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index 83b31a823..4a11fa4d3 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -32,9 +32,9 @@ * * ___ * @section modem_digi_wifi_examples Example Code - * The digi_cellular is used in the @menulink{xbee_ltem_by} example. + * The digi_cellular is used in the @menulink{digi_xbee_lte_bypass} example. * - * @menusnip{xbee3_ltem_bypass} + * @menusnip{digi_xbee_lte_bypass} */ /* clang-format on */ diff --git a/src/modems/EspressifESP8266.h b/src/modems/EspressifESP8266.h index 4daf59d3f..9b4c8c67c 100644 --- a/src/modems/EspressifESP8266.h +++ b/src/modems/EspressifESP8266.h @@ -57,10 +57,10 @@ * * ___ * @section modem_esp8266_examples Example Code - * The ESP8266 is used in the @menulink{esp} example and the + * The ESP8266 is used in the @menulink{espressif_esp8266} example and the * [logging to ThingSpeak](@ref logging_to_ThingSpeak.ino) example. * - * @menusnip{esp8266} + * @menusnip{espressif_esp8266} */ /* clang-format on */ diff --git a/src/modems/QuectelBG96.h b/src/modems/QuectelBG96.h index 3a6c76690..776c658ac 100644 --- a/src/modems/QuectelBG96.h +++ b/src/modems/QuectelBG96.h @@ -51,9 +51,9 @@ * * ___ * @section modem_bg96_examples Example Code - * The Quectel BG96 is used in the @menulink{bg96}. + * The Quectel BG96 is used in the @menulink{quectel_bg96}. * - * @menusnip{bg96} + * @menusnip{quectel_bg96} */ /* clang-format on */ diff --git a/src/modems/SIMComSIM7000.h b/src/modems/SIMComSIM7000.h index c1c052e55..a4182c622 100644 --- a/src/modems/SIMComSIM7000.h +++ b/src/modems/SIMComSIM7000.h @@ -40,9 +40,9 @@ * * ___ * @section modem_sim7000_examples Example Code - * The SIM7000 is used in the @menulink{sim7000} example. + * The SIM7000 is used in the @menulink{sim_com_sim7000} example. * - * @menusnip{sim7000} + * @menusnip{sim_com_sim7000} */ /* clang-format on */ diff --git a/src/modems/SIMComSIM7080.h b/src/modems/SIMComSIM7080.h index e2e602bfb..c57106c4d 100644 --- a/src/modems/SIMComSIM7080.h +++ b/src/modems/SIMComSIM7080.h @@ -32,9 +32,9 @@ * * ___ * @section modem_sim7080_examples Example Code - * The SIM7080 is used in the @menulink{sim7080} example. + * The SIM7080 is used in the @menulink{sim_com_sim7080} example. * - * @menusnip{sim7080} + * @menusnip{sim_com_sim7080} */ /* clang-format on */ diff --git a/src/modems/SIMComSIM800.h b/src/modems/SIMComSIM800.h index 8f36aeed8..9df08710e 100644 --- a/src/modems/SIMComSIM800.h +++ b/src/modems/SIMComSIM800.h @@ -44,9 +44,9 @@ * * ___ * @section modem_sim800_examples Example Code - * The SIM800 is used in the @menulink{sim800} example. + * The SIM800 is used in the @menulink{sim_com_sim800} example. * - * @menusnip{sim800} + * @menusnip{sim_com_sim800} */ /* clang-format on */ diff --git a/src/modems/SequansMonarch.h b/src/modems/SequansMonarch.h index a65447ec3..76d661c25 100644 --- a/src/modems/SequansMonarch.h +++ b/src/modems/SequansMonarch.h @@ -45,9 +45,9 @@ * * ___ * @section modem_monarch_examples Example Code - * The monarch is used in the @menulink{monarch} example. + * The monarch is used in the @menulink{sequans_monarch} example. * - * @menusnip{monarch} + * @menusnip{sequans_monarch} */ /* clang-format on */ diff --git a/src/modems/Sodaq2GBeeR6.h b/src/modems/Sodaq2GBeeR6.h index 0f78bdefc..881d6b4ff 100644 --- a/src/modems/Sodaq2GBeeR6.h +++ b/src/modems/Sodaq2GBeeR6.h @@ -23,7 +23,7 @@ * This board is based on the [SIMCom SIM800H](https://simcom.ee/modules/gsm-gprs/sim800/), * but adds an extra transistor to the `PWR_KEY` so it is turned on and off in a different way. * For earlier Sodaq GPRSBee's, use the standard SIM800 - * [constructor](https://envirodiy.github.io/ModularSensors/group__modem__sim800.html). + * [constructor](#modem_sim800). * * The modem constructor follows the typical modem pattern, except that the * Sodaq GPRSBee's do not expose the SIM800's reset pin or its sleep request @@ -50,9 +50,9 @@ * * ___ * @section modem_gprsbee_examples Example Code - * The GPRSBee is used in the @menulink{gprsbee} example. + * The GPRSBee is used in the @menulink{sodaq_2g_bee_r6} example. * - * @menusnip{gprsbee} + * @menusnip{sodaq_2g_bee_r6} */ /* clang-format on */ diff --git a/src/modems/SodaqUBeeR410M.h b/src/modems/SodaqUBeeR410M.h index 6c4d529fe..20a820720 100644 --- a/src/modems/SodaqUBeeR410M.h +++ b/src/modems/SodaqUBeeR410M.h @@ -88,9 +88,9 @@ * @section modem_ubee_ltem_examples Example Code * @subsection modem_ubee_ltem_modem_obj Creating the Modem Object * - * The SARA R410M based UBee is used in the @menulink{ubeer410} example. + * The SARA R410M based UBee is used in the @menulink{sodaq_ubee_r410m} example. * - * @menusnip{sara_r410m} + * @menusnip{sodaq_ubee_r410m} * * @section modem_ubee_ltem_network LTE Network Selection * diff --git a/src/modems/SodaqUBeeU201.h b/src/modems/SodaqUBeeU201.h index 6eea950fe..1f9df1296 100644 --- a/src/modems/SodaqUBeeU201.h +++ b/src/modems/SodaqUBeeU201.h @@ -41,9 +41,9 @@ * ___ * @section modem_ubee_3g_examples Example Code * - * The SARA U201 based UBee is used in the @menulink{ubeeu201} example. + * The SARA U201 based UBee is used in the @menulink{sodaq_ubee_u201} example. * - * @menusnip{sara_u201} + * @menusnip{sodaq_ubee_u201} */ /* clang-format on */ diff --git a/src/sensors/AOSongAM2315.h b/src/sensors/AOSongAM2315.h index aa26d908b..c520cb6ef 100644 --- a/src/sensors/AOSongAM2315.h +++ b/src/sensors/AOSongAM2315.h @@ -45,9 +45,9 @@ * @section sensor_am2315_examples Example Code * * The AM2315 is used in the [double logger](@ref double_logger.ino) - * and @menulink{am2315} example + * and @menulink{ao_song_am2315} example * - * @menusnip{am2315} + * @menusnip{ao_song_am2315} */ /* clang-format on */ diff --git a/src/sensors/AOSongDHT.h b/src/sensors/AOSongDHT.h index 89a6ee215..6e04005ff 100644 --- a/src/sensors/AOSongDHT.h +++ b/src/sensors/AOSongDHT.h @@ -49,9 +49,9 @@ * * ___ * @section sensor_dht_examples Example Code - * The DHT is used in the @menulink{dht} example. + * The DHT is used in the @menulink{ao_song_dht} example. * - * @menusnip{dht} + * @menusnip{ao_song_dht} */ /* clang-format on */ diff --git a/src/sensors/AnalogElecConductivity.h b/src/sensors/AnalogElecConductivity.h index 786d34716..f00be8cf7 100644 --- a/src/sensors/AnalogElecConductivity.h +++ b/src/sensors/AnalogElecConductivity.h @@ -123,9 +123,9 @@ * ___ * @section sensor_analog_cond_examples Example Code * The analog electrical conductivity sensor is used in the - * @menulink{analog_cond} example. + * @menulink{analog_elec_conductivity} example. * - * @menusnip{analog_cond} + * @menusnip{analog_elec_conductivity} * */ /* clang-format on */ @@ -152,9 +152,12 @@ /** @ingroup sensor_analog_cond */ /**@{*/ -/// @brief Sensor::_numReturnedValues; we only get one value from the analog conductivity sensor. +/// @brief Sensor::_numReturnedValues; we only get one value from the analog +/// conductivity sensor. #define ANALOGELECCONDUCTIVITY_NUM_VARIABLES 1 -/// @brief Sensor::_incCalcValues; we don't calculate any additional values - though we recommend users include a temperature sensor and calculate specific conductance in their own program. +/// @brief Sensor::_incCalcValues; we don't calculate any additional values - +/// though we recommend users include a temperature sensor and calculate +/// specific conductance in their own program. #define ANALOGELECCONDUCTIVITY_INC_CALC_VARIABLES 0 /** diff --git a/src/sensors/ApogeeSQ212.h b/src/sensors/ApogeeSQ212.h index 4406df0dd..e313f453b 100644 --- a/src/sensors/ApogeeSQ212.h +++ b/src/sensors/ApogeeSQ212.h @@ -65,9 +65,9 @@ * * ___ * @section sensor_sq212_examples Example Code - * The SQ-212 is used in the @menulink{sq212} example. + * The SQ-212 is used in the @menulink{apogee_sq212} example. * - * @menusnip{sq212} + * @menusnip{apogee_sq212} */ /* clang-format on */ @@ -142,11 +142,13 @@ /**@{*/ /// Variable number; PAR is stored in sensorValues[0]. #define SQ212_PAR_VAR_NUM 0 -/// @brief Variable name in [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); "radiationIncomingPAR" +/// @brief Variable name in [ODM2 controlled +/// vocabulary](http://vocabulary.odm2.org/variablename/); +/// "radiationIncomingPAR" #define SQ212_PAR_VAR_NAME "radiationIncomingPAR" /// @brief Variable unit name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "microeinsteinPerSquareMeterPerSecond" (µE m-2 -/// s-1 or µmol * m-2 s-1) +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "microeinsteinPerSquareMeterPerSecond" (µE m-2 s-1 or µmol * m-2 s-1) #define SQ212_PAR_UNIT_NAME "microeinsteinPerSquareMeterPerSecond" /// @brief Default variable short code; "photosyntheticallyActiveRadiation" #define SQ212_PAR_DEFAULT_CODE "photosyntheticallyActiveRadiation" @@ -181,7 +183,8 @@ /**@{*/ /// Variable number; voltage is stored in sensorValues[1]. #define SQ212_VOLTAGE_VAR_NUM 1 -/// @brief Variable name in [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); "voltage" +/// @brief Variable name in [ODM2 controlled +/// vocabulary](http://vocabulary.odm2.org/variablename/); "voltage" #define SQ212_VOLTAGE_VAR_NAME "voltage" /// @brief Variable unit name in /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "volt" (V) diff --git a/src/sensors/AtlasScientificCO2.h b/src/sensors/AtlasScientificCO2.h index 2604917bf..3c85081df 100644 --- a/src/sensors/AtlasScientificCO2.h +++ b/src/sensors/AtlasScientificCO2.h @@ -39,9 +39,9 @@ * * ___ * @section sensor_atlas_co2_examples Example Code - * The Atlas CO2 sensor is used in the @menulink{atlas_co2} example. + * The Atlas CO2 sensor is used in the @menulink{atlas_scientific_co2} example. * - * @menusnip{atlas_co2} + * @menusnip{atlas_scientific_co2} */ /* clang-format on */ diff --git a/src/sensors/AtlasScientificDO.h b/src/sensors/AtlasScientificDO.h index 110a9f319..310a7409e 100644 --- a/src/sensors/AtlasScientificDO.h +++ b/src/sensors/AtlasScientificDO.h @@ -38,9 +38,9 @@ * * ___ * @section sensor_atlas_do_examples Example Code - * The Atlas DO sensor is used in the @menulink{atlas_do} example. + * The Atlas DO sensor is used in the @menulink{atlas_scientific_do} example. * - * @menusnip{atlas_do} + * @menusnip{atlas_scientific_do} */ /* clang-format on */ diff --git a/src/sensors/AtlasScientificEC.h b/src/sensors/AtlasScientificEC.h index 816034f00..5e2aec8f1 100644 --- a/src/sensors/AtlasScientificEC.h +++ b/src/sensors/AtlasScientificEC.h @@ -46,9 +46,9 @@ * * ___ * @section sensor_atlas_cond_examples Example Code - * The Atlas conductivity sensor is used in the @menulink{atlas_ec} example. + * The Atlas conductivity sensor is used in the @menulink{atlas_scientific_ec} example. * - * @menusnip{atlas_ec} + * @menusnip{atlas_scientific_ec} */ /* clang-format on */ diff --git a/src/sensors/AtlasScientificORP.h b/src/sensors/AtlasScientificORP.h index 63c865ced..6874bbb65 100644 --- a/src/sensors/AtlasScientificORP.h +++ b/src/sensors/AtlasScientificORP.h @@ -32,9 +32,9 @@ * * ___ * @section sensor_atlas_orp_examples Example Code - * The Atlas ORP sensor is used in the @menulink{atlas_orp} example. + * The Atlas ORP sensor is used in the @menulink{atlas_scientific_orp} example. * - * @menusnip{atlas_orp} + * @menusnip{atlas_scientific_orp} */ /* clang-format on */ diff --git a/src/sensors/AtlasScientificRTD.h b/src/sensors/AtlasScientificRTD.h index 4255ec67b..6f6c1c422 100644 --- a/src/sensors/AtlasScientificRTD.h +++ b/src/sensors/AtlasScientificRTD.h @@ -37,9 +37,9 @@ * * ___ * @section sensor_atlas_rtd_examples Example Code - * The Atlas RTD sensor is used in the @menulink{atlas_rtd} example. + * The Atlas RTD sensor is used in the @menulink{atlas_scientific_rtd} example. * - * @menusnip{atlas_rtd} + * @menusnip{atlas_scientific_rtd} */ /* clang-format on */ diff --git a/src/sensors/AtlasScientificpH.h b/src/sensors/AtlasScientificpH.h index dfd3088b2..dc5979cb4 100644 --- a/src/sensors/AtlasScientificpH.h +++ b/src/sensors/AtlasScientificpH.h @@ -34,9 +34,9 @@ * * ___ * @section sensor_atlas_ph_examples Example Code - * The Atlas pH sensor is used in the @menulink{atlas_ph} example. + * The Atlas pH sensor is used in the @menulink{atlas_scientific_ph} example. * - * @menusnip{atlas_ph} + * @menusnip{atlas_scientific_ph} */ /* clang-format on */ diff --git a/src/sensors/BoschBME280.cpp b/src/sensors/BoschBME280.cpp index b3a1660d4..130e5af55 100644 --- a/src/sensors/BoschBME280.cpp +++ b/src/sensors/BoschBME280.cpp @@ -43,7 +43,7 @@ bool BoschBME280::setup(void) { Sensor::setup(); // this will set pin modes and the setup status bit // This sensor needs power for setup! - // The bme280's begin() reads required calibration data from the sensor. + // The BME280's begin() reads required calibration data from the sensor. bool wasOn = checkPowerOn(); if (!wasOn) { powerUp(); } waitForWarmUp(); diff --git a/src/sensors/BoschBME280.h b/src/sensors/BoschBME280.h index 47d238a3f..858a113a4 100644 --- a/src/sensors/BoschBME280.h +++ b/src/sensors/BoschBME280.h @@ -70,9 +70,9 @@ * * ___ * @section sensor_bme280_examples Example Code - * The BME280 is used in the @menulink{bme280} example. + * The BME280 is used in the @menulink{bosch_bme280} example. * - * @menusnip{bme280} + * @menusnip{bosch_bme280} */ /* clang-format on */ @@ -100,7 +100,8 @@ /// @brief Sensor::_numReturnedValues; the BME280 can report 4 values. #define BME280_NUM_VARIABLES 4 -/// @brief Sensor::_incCalcValues; altitude is calculted within the Adafruit library. +/// @brief Sensor::_incCalcValues; altitude is calculted within the Adafruit +/// library. #define BME280_INC_CALC_VARIABLES 1 /** diff --git a/src/sensors/CampbellClariVUE10.h b/src/sensors/CampbellClariVUE10.h index 6ac740929..e41d539f2 100644 --- a/src/sensors/CampbellClariVUE10.h +++ b/src/sensors/CampbellClariVUE10.h @@ -52,9 +52,9 @@ * * ___ * @section sensor_clarivue_examples Example Code - * The Campbell ClariVUE10 is used in the @menulink{clarivue} example. + * The Campbell ClariVUE10 is used in the @menulink{campbell_clari_vue10} example. * - * @menusnip{clarivue} + * @menusnip{campbell_clari_vue10} */ /* clang-format on */ diff --git a/src/sensors/CampbellOBS3.h b/src/sensors/CampbellOBS3.h index db1775f1d..5067f7c47 100644 --- a/src/sensors/CampbellOBS3.h +++ b/src/sensors/CampbellOBS3.h @@ -58,9 +58,9 @@ * * ___ * @section sensor_obs3_examples Example Code - * The Campbell OBS3+ is used in the @menulink{obs3} example. + * The Campbell OBS3+ is used in the @menulink{campbell_obs3} example. * - * @menusnip{obs3} + * @menusnip{campbell_obs3} */ /* clang-format on */ @@ -93,7 +93,8 @@ * two sensor objects! */ #define OBS3_NUM_VARIABLES 2 -/// @brief Sensor::_incCalcValues; turbidity is calculated from raw voltage using the input calibration equation. +/// @brief Sensor::_incCalcValues; turbidity is calculated from raw voltage +/// using the input calibration equation. #define OBS3_INC_CALC_VARIABLES 1 /** diff --git a/src/sensors/Decagon5TM.h b/src/sensors/Decagon5TM.h index 1b136bbaa..f1b3c87fa 100644 --- a/src/sensors/Decagon5TM.h +++ b/src/sensors/Decagon5TM.h @@ -52,9 +52,9 @@ * * ___ * @section sensor_fivetm_examples Example Code - * The Meter ECH2O (5TM) is used in the @menulink{fivetm} example. + * The Meter ECH2O (5TM) is used in the @menulink{decagon_5tm} example. * - * @menusnip{fivetm} + * @menusnip{decagon_5tm} */ /* clang-format on */ diff --git a/src/sensors/DecagonCTD.h b/src/sensors/DecagonCTD.h index 30aba3751..3898240b5 100644 --- a/src/sensors/DecagonCTD.h +++ b/src/sensors/DecagonCTD.h @@ -52,9 +52,9 @@ * * ___ * @section sensor_decagon_ctd_examples Example Code - * The Decagon CTD-10 is used in the @menulink{decagonCTD} example. + * The Decagon CTD-10 is used in the @menulink{decagon_ctd} example. * - * @menusnip{decagonCTD} + * @menusnip{decagon_ctd} */ /* clang-format on */ diff --git a/src/sensors/DecagonES2.h b/src/sensors/DecagonES2.h index e7ce7abf4..c7f71c3be 100644 --- a/src/sensors/DecagonES2.h +++ b/src/sensors/DecagonES2.h @@ -47,9 +47,9 @@ * * ___ * @section sensor_es2_examples Example Code - * The Decagon ES-2 is used in the @menulink{es2} example. + * The Decagon ES-2 is used in the @menulink{decagon_es2} example. * - * @menusnip{es2} + * @menusnip{decagon_es2} */ /* clang-format on */ diff --git a/src/sensors/ExternalVoltage.h b/src/sensors/ExternalVoltage.h index d0881e4cf..02ce28050 100644 --- a/src/sensors/ExternalVoltage.h +++ b/src/sensors/ExternalVoltage.h @@ -128,10 +128,10 @@ * * ___ * @section sensor_ads1x15_examples Example Code - * The TI ADS1X15 external voltage sensor is used in the @menulink{ext_volt} + * The TI ADS1X15 external voltage sensor is used in the @menulink{external_voltage} * example. * - * @menusnip{ext_volt} + * @menusnip{external_voltage} */ /* clang-format on */ diff --git a/src/sensors/InsituTrollSdi12a.h b/src/sensors/InsituTrollSdi12a.h index 54866ed5a..0f82e4468 100644 --- a/src/sensors/InsituTrollSdi12a.h +++ b/src/sensors/InsituTrollSdi12a.h @@ -96,6 +96,7 @@ /// @brief Sensor::_measurementTime_ms; maximum measurement duration: 500ms. #define ITROLLA_MEASUREMENT_TIME_MS 500 +/**@}*/ /** * @anchor sensor_insitutroll_pressure diff --git a/src/sensors/KellerAcculevel.h b/src/sensors/KellerAcculevel.h index 13898b660..fdbf8cd0c 100644 --- a/src/sensors/KellerAcculevel.h +++ b/src/sensors/KellerAcculevel.h @@ -40,9 +40,9 @@ * * ___ * @section sensor_acculevel_examples Example Code - * The Keller Acculevel is used in the @menulink{acculevel} example. + * The Keller Acculevel is used in the @menulink{keller_acculevel} example. * - * @menusnip{acculevel} + * @menusnip{keller_acculevel} */ /* clang-format on */ diff --git a/src/sensors/KellerNanolevel.h b/src/sensors/KellerNanolevel.h index 60e330749..d8f74bc50 100644 --- a/src/sensors/KellerNanolevel.h +++ b/src/sensors/KellerNanolevel.h @@ -32,9 +32,9 @@ * * ___ * @section sensor_nanolevel_examples Example Code - * The Keller Nanolevel is used in the @menulink{nanolevel} example. + * The Keller Nanolevel is used in the @menulink{keller_nanolevel} example. * - * @menusnip{nanolevel} + * @menusnip{keller_nanolevel} */ /* clang-format on */ diff --git a/src/sensors/KellerParent.h b/src/sensors/KellerParent.h index b0391fff9..e2cb8b778 100644 --- a/src/sensors/KellerParent.h +++ b/src/sensors/KellerParent.h @@ -55,7 +55,7 @@ * 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](https://envirodiy.github.io/ModularSensors/page_arduino_streams.html)" + * "[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 diff --git a/src/sensors/MaxBotixSonar.h b/src/sensors/MaxBotixSonar.h index 0e66a0596..d40d9fcc4 100644 --- a/src/sensors/MaxBotixSonar.h +++ b/src/sensors/MaxBotixSonar.h @@ -56,7 +56,7 @@ * setting up a trigger pin and manually trigger individual readings. * * Please see the section - * "[Notes on Arduino Streams and Software Serial](https://envirodiy.github.io/ModularSensors/page_arduino_streams.html)" + * "[Notes on Arduino Streams and Software Serial](@ref page_arduino_streams)" * for more information about what streams can be used along with this library. * * This library supports using multiple MaxBotix sensors on the same logger, @@ -89,9 +89,9 @@ * * ___ * @section sensor_maxbotix_examples Example Code - * The MaxBotix MaxSonar is used in the @menulink{maxbotics} example. + * The MaxBotix MaxSonar is used in the @menulink{max_botix_sonar} example. * - * @menusnip{maxbotics} + * @menusnip{max_botix_sonar} */ /* clang-format on */ diff --git a/src/sensors/MaximDS18.h b/src/sensors/MaximDS18.h index acd55612b..33ea6952d 100644 --- a/src/sensors/MaximDS18.h +++ b/src/sensors/MaximDS18.h @@ -70,9 +70,9 @@ * * ___ * @section sensor_ds18_examples Example Code - * The Maxim DS18 is used in the @menulink{ds18} example. + * The Maxim DS18 is used in the @menulink{maxim_ds18} example. * - * @menusnip{ds18} + * @menusnip{maxim_ds18} */ /* clang-format on */ diff --git a/src/sensors/MaximDS3231.h b/src/sensors/MaximDS3231.h index dc183cdd5..124f620d8 100644 --- a/src/sensors/MaximDS3231.h +++ b/src/sensors/MaximDS3231.h @@ -48,9 +48,9 @@ * ___ * @section sensor_ds3231_examples Example Code * The Maxim DS3231 RTC is used in nearly all of the examples, including the - * @menulink{ds3231} example. + * @menulink{maxim_ds3231} example. * - * @menusnip{ds3231} + * @menusnip{maxim_ds3231} */ /* clang-format on */ diff --git a/src/sensors/MeaSpecMS5803.h b/src/sensors/MeaSpecMS5803.h index 1647057a2..951898994 100644 --- a/src/sensors/MeaSpecMS5803.h +++ b/src/sensors/MeaSpecMS5803.h @@ -67,9 +67,9 @@ * * ___ * @section sensor_ms5803_examples Example Code - * The Measurement Specialties MS5803 is used in the @menulink{ms5803} example. + * The Measurement Specialties MS5803 is used in the @menulink{mea_spec_ms5803} example. * - * @menusnip{ms5803} + * @menusnip{mea_spec_ms5803} */ /* clang-format on */ diff --git a/src/sensors/MeterHydros21.h b/src/sensors/MeterHydros21.h index 4681af441..73adfdf36 100644 --- a/src/sensors/MeterHydros21.h +++ b/src/sensors/MeterHydros21.h @@ -59,9 +59,9 @@ * * ___ * @section sensor_hydros21_examples Example Code - * The Meter Hydros21 is used in the @menulink{hydros21} example. + * The Meter Hydros21 is used in the @menulink{meter_hydros21} example. * - * @menusnip{hydros21} + * @menusnip{meter_hydros21} */ /* clang-format on */ diff --git a/src/sensors/MeterTeros11.h b/src/sensors/MeterTeros11.h index 7dc6c3fac..0f3a7957c 100644 --- a/src/sensors/MeterTeros11.h +++ b/src/sensors/MeterTeros11.h @@ -62,9 +62,9 @@ * * ___ * @section sensor_teros11_examples Example Code - * The Meter Teros is used in the @menulink{teros} example. + * The Meter Teros is used in the @menulink{meter_teros11} example. * - * @menusnip{teros} + * @menusnip{meter_teros11} */ /* clang-format on */ diff --git a/src/sensors/PaleoTerraRedox.h b/src/sensors/PaleoTerraRedox.h index a9ae32712..2277e397b 100644 --- a/src/sensors/PaleoTerraRedox.h +++ b/src/sensors/PaleoTerraRedox.h @@ -50,9 +50,9 @@ * * ___ * @section sensor_pt_redox_examples Example Code - * The PaleoTerra Redox is used in the @menulink{pt_redox} example. + * The PaleoTerra Redox is used in the @menulink{paleo_terra_redox} example. * - * @menusnip{pt_redox} + * @menusnip{paleo_terra_redox} */ /* clang-format on */ diff --git a/src/sensors/ProcessorStats.h b/src/sensors/ProcessorStats.h index 337eff7f1..2006dc095 100644 --- a/src/sensors/ProcessorStats.h +++ b/src/sensors/ProcessorStats.h @@ -45,9 +45,9 @@ * ___ * @section sensor_processor_sensor_examples Example Code * The processor is used as a sensor in all of the examples, including the - * @menulink{processor_sensor} example. + * @menulink{processor_stats} example. * - * @menusnip{processor_sensor} + * @menusnip{processor_stats} */ /* clang-format on */ diff --git a/src/sensors/RainCounterI2C.h b/src/sensors/RainCounterI2C.h index 7fe9cc572..d3c0681f1 100644 --- a/src/sensors/RainCounterI2C.h +++ b/src/sensors/RainCounterI2C.h @@ -60,9 +60,9 @@ * ___ * @section sensor_i2c_rain_examples Example Code * The Arduino-based I2C tipping bucket rain counter is used in the - * @menulink{i2c_rain} example. + * @menulink{rain_counter_i2c} example. * - * @menusnip{i2c_rain} + * @menusnip{rain_counter_i2c} */ /* clang-format on */ @@ -95,7 +95,8 @@ /// @brief Sensor::_numReturnedValues; the tipping bucket counter can report 2 /// values. #define BUCKET_NUM_VARIABLES 2 -/// @brief Sensor::_incCalcValues; we calculate rain depth from the number of tips, assuming either English or metric calibration. +/// @brief Sensor::_incCalcValues; we calculate rain depth from the number of +/// tips, assuming either English or metric calibration. #define BUCKET_INC_CALC_VARIABLES 1 /** diff --git a/src/sensors/TIINA219.h b/src/sensors/TIINA219.h index bb9b1b951..2eea235e8 100644 --- a/src/sensors/TIINA219.h +++ b/src/sensors/TIINA219.h @@ -51,9 +51,9 @@ * * ___ * @section sensor_ina219_examples Example Code - * The TI INA219 is used in the @menulink{ina219} example. + * The TI INA219 is used in the @menulink{ti_ina219} example. * - * @menusnip{ina219} + * @menusnip{ti_ina219} */ /* clang-format on */ diff --git a/src/sensors/TurnerCyclops.h b/src/sensors/TurnerCyclops.h index 209ae7ca4..e1fe3ba09 100644 --- a/src/sensors/TurnerCyclops.h +++ b/src/sensors/TurnerCyclops.h @@ -118,9 +118,9 @@ * * ___ * @section sensor_cyclops_examples Example Code - * The Turner Cyclops-7F is used in the @menulink{cyclops} example. + * The Turner Cyclops-7F is used in the @menulink{turner_cyclops} example. * - * @menusnip{cyclops} + * @menusnip{turner_cyclops} */ /* clang-format on */ @@ -155,7 +155,8 @@ * the Cyclops. */ #define CYCLOPS_NUM_VARIABLES 2 -/// @brief Sensor::_incCalcValues; the raw voltage is reported, the other parameter is calculated using the input calibration equation. +/// @brief Sensor::_incCalcValues; the raw voltage is reported, the other +/// parameter is calculated using the input calibration equation. #define CYCLOPS_INC_CALC_VARIABLES 1 /** diff --git a/src/sensors/YosemitechParent.h b/src/sensors/YosemitechParent.h index 215a31c46..565fc99ae 100644 --- a/src/sensors/YosemitechParent.h +++ b/src/sensors/YosemitechParent.h @@ -88,7 +88,7 @@ * 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.) * For all of these sensors except pH, Yosemitech strongly recommends averaging 10 readings for each measurement. - * Please see the section "[Notes on Arduino Streams and Software Serial](https://envirodiy.github.io/ModularSensors/page_arduino_streams.html)" + * 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. @@ -182,7 +182,8 @@ class YosemitechParent : public Sensor { const char* sensName = "Yosemitech-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 1500, uint32_t stabilizationTime_ms = 20000, - uint32_t measurementTime_ms = 2000, uint8_t incCalcValues = 0); + uint32_t measurementTime_ms = 2000, + uint8_t incCalcValues = 0); /** * @copydoc YosemitechParent::YosemitechParent */ @@ -193,7 +194,8 @@ class YosemitechParent : public Sensor { const char* sensName = "Yosemitech-Sensor", uint8_t numVariables = 2, uint32_t warmUpTime_ms = 1500, uint32_t stabilizationTime_ms = 20000, - uint32_t measurementTime_ms = 2000, uint8_t incCalcValues = 0); + uint32_t measurementTime_ms = 2000, + uint8_t incCalcValues = 0); /** * @brief Destroy the Yosemitech Parent object - no action taken */ diff --git a/src/sensors/YosemitechY4000.h b/src/sensors/YosemitechY4000.h index 1c184984f..48b38302d 100644 --- a/src/sensors/YosemitechY4000.h +++ b/src/sensors/YosemitechY4000.h @@ -45,9 +45,9 @@ * * ___ * @section sensor_y4000_examples Example Code - * The Y4000 Sonde is used in the @menulink{y4000} example. + * The Y4000 Sonde is used in the @menulink{yosemitech_y4000} example. * - * @menusnip{y4000} + * @menusnip{yosemitech_y4000} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY504.h b/src/sensors/YosemitechY504.h index bf2d3aff2..d3c5fb588 100644 --- a/src/sensors/YosemitechY504.h +++ b/src/sensors/YosemitechY504.h @@ -43,9 +43,9 @@ * * ___ * @section sensor_y504_examples Example Code - * The Yosemitech Y504 Dissolved Oxygen is used in the @menulink{y504} example. + * The Yosemitech Y504 Dissolved Oxygen is used in the @menulink{yosemitech_y504} example. * - * @menusnip{y504} + * @menusnip{yosemitech_y504} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY510.h b/src/sensors/YosemitechY510.h index 298662160..4cfbac2b0 100644 --- a/src/sensors/YosemitechY510.h +++ b/src/sensors/YosemitechY510.h @@ -39,9 +39,9 @@ * * ___ * @section sensor_y510_examples Example Code - * The Yosemitech Y510 Turbidity is used in the @menulink{y510} example. + * The Yosemitech Y510 Turbidity is used in the @menulink{yosemitech_y510} example. * - * @menusnip{y510} + * @menusnip{yosemitech_y510} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY511.h b/src/sensors/YosemitechY511.h index dffe252ef..2dafa2518 100644 --- a/src/sensors/YosemitechY511.h +++ b/src/sensors/YosemitechY511.h @@ -39,10 +39,10 @@ * * ___ * @section sensor_y511_examples Example Code - * The Yosemitech Y511 wipered turbidity sensor is used in the @menulink{y511} + * The Yosemitech Y511 wipered turbidity sensor is used in the @menulink{yosemitech_y511} * example. * - * @menusnip{y511} + * @menusnip{yosemitech_y511} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY514.h b/src/sensors/YosemitechY514.h index 4b67bf50b..2ba44a2b8 100644 --- a/src/sensors/YosemitechY514.h +++ b/src/sensors/YosemitechY514.h @@ -40,10 +40,10 @@ * * ___ * @section sensor_y514_examples Example Code - * The Yosemitech Y514 chlorophyll sensor is used in the @menulink{y514} + * The Yosemitech Y514 chlorophyll sensor is used in the @menulink{yosemitech_y514} * example. * - * @menusnip{y514} + * @menusnip{yosemitech_y514} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY520.h b/src/sensors/YosemitechY520.h index ef9830634..fa7b8dc2b 100644 --- a/src/sensors/YosemitechY520.h +++ b/src/sensors/YosemitechY520.h @@ -39,10 +39,10 @@ * * ___ * @section sensor_y520_examples Example Code - * The Yosemitech Y520 conductivity sensor is used in the @menulink{y520} + * The Yosemitech Y520 conductivity sensor is used in the @menulink{yosemitech_y520} * example. * - * @menusnip{y520} + * @menusnip{yosemitech_y520} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY532.h b/src/sensors/YosemitechY532.h index 9df49d2f6..f5e8f78a0 100644 --- a/src/sensors/YosemitechY532.h +++ b/src/sensors/YosemitechY532.h @@ -40,9 +40,9 @@ * * ___ * @section sensor_y532_examples Example Code - * The Yosemitech Y532 pH sensor is used in the @menulink{y532} example. + * The Yosemitech Y532 pH sensor is used in the @menulink{yosemitech_y532} example. * - * @menusnip{y532} + * @menusnip{yosemitech_y532} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY533.h b/src/sensors/YosemitechY533.h index f1cf5230c..4e8ad82ff 100644 --- a/src/sensors/YosemitechY533.h +++ b/src/sensors/YosemitechY533.h @@ -39,9 +39,9 @@ * * ___ * @section sensor_y533_examples Example Code - * The Yosemitech Y533 ORP sensor is used in the @menulink{y533} example. + * The Yosemitech Y533 ORP sensor is used in the @menulink{yosemitech_y533} example. * - * @menusnip{y533} + * @menusnip{yosemitech_y533} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index 0a3a2e938..654a61eb5 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -39,9 +39,9 @@ * * ___ * @section sensor_y551_examples Example Code - * The Yosemitech Y551 UV245/COD sensor is used in the @menulink{y551} example. + * The Yosemitech Y551 UV245/COD sensor is used in the @menulink{yosemitech_y551} example. * - * @menusnip{y551} + * @menusnip{yosemitech_y551} */ /* clang-format on */ diff --git a/src/sensors/YosemitechY560.h b/src/sensors/YosemitechY560.h index d03ccffc6..22e3a6cb0 100644 --- a/src/sensors/YosemitechY560.h +++ b/src/sensors/YosemitechY560.h @@ -40,9 +40,9 @@ * * ___ * @section sensor_y560_examples Example Code - * The Yosemitech Y560 Ammonium sensor is used in the @menulink{y560} example. + * The Yosemitech Y560 Ammonium sensor is used in the @menulink{yosemitech_y560} example. * - * @menusnip{y560} + * @menusnip{yosemitech_y560} */ /* clang-format on */ @@ -240,12 +240,11 @@ class YosemitechY560_NH4_N : public Variable { * optional with a default value of "Y560NH4_N". */ explicit YosemitechY560_NH4_N(YosemitechY560* parentSense, - const char* uuid = "", - const char* varCode =Y560_NH4_N_DEFAULT_CODE) + const char* uuid = "", + const char* varCode = Y560_NH4_N_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)Y560_NH4_N_VAR_NUM, - (const uint8_t)Y560_NH4_N_RESOLUTION, - Y560_NH4_N_VAR_NAME, Y560_NH4_N_UNIT_NAME, - varCode, uuid) {} + (const uint8_t)Y560_NH4_N_RESOLUTION, Y560_NH4_N_VAR_NAME, + Y560_NH4_N_UNIT_NAME, varCode, uuid) {} /** * @brief Construct a new YosemitechY560_NH4_N object. * @@ -254,9 +253,8 @@ class YosemitechY560_NH4_N : public Variable { */ YosemitechY560_NH4_N() : Variable((const uint8_t)Y560_NH4_N_VAR_NUM, - (const uint8_t)Y560_NH4_N_RESOLUTION, - Y560_NH4_N_VAR_NAME, Y560_NH4_N_UNIT_NAME, - Y560_NH4_N_DEFAULT_CODE) {} + (const uint8_t)Y560_NH4_N_RESOLUTION, Y560_NH4_N_VAR_NAME, + Y560_NH4_N_UNIT_NAME, Y560_NH4_N_DEFAULT_CODE) {} /** * @brief Destroy the YosemitechY560_NH4_N object - no action needed. */ @@ -318,36 +316,36 @@ class YosemitechY560_Temp : public Variable { */ /* clang-format on */ class YosemitechY560_pH : public Variable { -public: - /** - * @brief Construct a new YosemitechY560_pH object. - * - * @param parentSense The parent YosemitechY560 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 "Y560pH". - */ - explicit YosemitechY560_pH(YosemitechY560* parentSense, - const char* uuid = "", - const char* varCode = Y560_PH_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)Y560_PH_VAR_NUM, - (uint8_t)Y560_PH_RESOLUTION, Y560_PH_VAR_NAME, - Y560_PH_UNIT_NAME, varCode, uuid) {} - /** - * @brief Construct a new YosemitechY560_pH object. - * - * @note This must be tied with a parent YosemitechY560 before it can be - * used. - */ - YosemitechY560_pH() - : Variable((const uint8_t)Y560_PH_VAR_NUM, (uint8_t)Y560_PH_RESOLUTION, - Y560_PH_VAR_NAME, Y560_PH_UNIT_NAME, Y560_PH_DEFAULT_CODE) {} - /** - * @brief Destroy the YosemitechY560_pH object - no action needed. - */ - ~YosemitechY560_pH() {} + public: + /** + * @brief Construct a new YosemitechY560_pH object. + * + * @param parentSense The parent YosemitechY560 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 "Y560pH". + */ + explicit YosemitechY560_pH(YosemitechY560* parentSense, + const char* uuid = "", + const char* varCode = Y560_PH_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)Y560_PH_VAR_NUM, + (uint8_t)Y560_PH_RESOLUTION, Y560_PH_VAR_NAME, + Y560_PH_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new YosemitechY560_pH object. + * + * @note This must be tied with a parent YosemitechY560 before it can be + * used. + */ + YosemitechY560_pH() + : Variable((const uint8_t)Y560_PH_VAR_NUM, (uint8_t)Y560_PH_RESOLUTION, + Y560_PH_VAR_NAME, Y560_PH_UNIT_NAME, Y560_PH_DEFAULT_CODE) {} + /** + * @brief Destroy the YosemitechY560_pH object - no action needed. + */ + ~YosemitechY560_pH() {} }; /**@}*/ #endif // SRC_SENSORS_YOSEMITECHY560_H_ diff --git a/src/sensors/ZebraTechDOpto.h b/src/sensors/ZebraTechDOpto.h index 5e5e2e4f0..8a77c1266 100644 --- a/src/sensors/ZebraTechDOpto.h +++ b/src/sensors/ZebraTechDOpto.h @@ -42,9 +42,9 @@ * * ___ * @section sensor_dopto_examples Example Code - * The Zebra-Tech D-Opto is used in the @menulink{dopto} example. + * The Zebra-Tech D-Opto is used in the @menulink{zebra_tech_d_opto} example. * - * @menusnip{dopto} + * @menusnip{zebra_tech_d_opto} */ /* clang-format on */ From 3b40ed772ad0f2156707dd8991b944d5685b92f8 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 10 Mar 2022 15:57:49 -0500 Subject: [PATCH 32/94] Fix wire reference for AM2315 Signed-off-by: Sara Damiano --- src/sensors/AOSongAM2315.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sensors/AOSongAM2315.cpp b/src/sensors/AOSongAM2315.cpp index 0314233df..1b7e1eda7 100644 --- a/src/sensors/AOSongAM2315.cpp +++ b/src/sensors/AOSongAM2315.cpp @@ -34,7 +34,7 @@ String AOSongAM2315::getSensorLocation(void) { bool AOSongAM2315::setup(void) { - Wire.begin(); // Start the wire library (sensor power not required) + _i2c->begin(); // Start the wire library (sensor power not required) // Eliminate any potential extra waits in the wire library // These waits would be caused by a readBytes or parseX being called // on wire after the Wire buffer has emptied. The default stream @@ -42,7 +42,7 @@ bool AOSongAM2315::setup(void) { // end of the buffer to see if an interrupt puts something into the // buffer. In the case of the Wire library, that will never happen and // the timeout period is a useless delay. - Wire.setTimeout(0); + _i2c->setTimeout(0); return Sensor::setup(); // this will set pin modes and the setup status bit } From f96d21cb395e64ea9255a0904c301ca671fdfa72 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 10 Mar 2022 15:58:49 -0500 Subject: [PATCH 33/94] Change case of In-Situ to match what company uses Signed-off-by: Sara Damiano --- src/sensors/InSituRDO.h | 36 ++++----- src/sensors/InsituTrollSdi12a.h | 137 +++++++++++++++++--------------- 2 files changed, 89 insertions(+), 84 deletions(-) diff --git a/src/sensors/InSituRDO.h b/src/sensors/InSituRDO.h index 8bc41b767..aca249122 100644 --- a/src/sensors/InSituRDO.h +++ b/src/sensors/InSituRDO.h @@ -7,13 +7,13 @@ * @brief Contains the InSituRDO sensor subclass and the variable subclasses * InSituRDO_Temp, InSituRDO_DOpct, and InSituRDO_DOmgL. * - * These are for the InSitu RDO PRO-X digital dissolved oxygen sensor. + * These are for the In-Situ RDO PRO-X digital dissolved oxygen sensor. * * This depends on the SDI12Sensors parent class. */ /* clang-format off */ /** - * @defgroup sensor_insitu_rdo InSitu RDO PRO-X + * @defgroup sensor_insitu_rdo In-Situ RDO PRO-X * Classes for the InSitue Optical RDO PRO-X process optical dissolved oxygen probe * * @ingroup sdi12_group @@ -32,7 +32,7 @@ * The maximum power consumption is 50 mA at 12 VDC. * Measurement current is 6 mA typical at 24 VDC and idle current is 160 µA typical at 24 VDC. * - * The [InSitu RDO PRO-X](https://in-situ.com/us/rdo-pro-x-dissolved-oxygen-probe) + * The [In-Situ RDO PRO-X](https://in-situ.com/us/rdo-pro-x-dissolved-oxygen-probe) * sensor is implemented as a sub-classes of the SDI12Sensors class. * While the sensor can also communicate over Modbus/RS485 or a 4-20 mA loop, * in this case I've chosen to use SDI-12 to minimize the number of pins @@ -145,9 +145,9 @@ * * ___ * @section sensor_insitu_rdo_examples Example Code - * The InSitu RDO PRO-X is used in the @menulink{insitu_rdo} example. + * The In-Situ RDO PRO-X is used in the @menulink{in_situ_rdo} example. * - * @menusnip{insitu_rdo} + * @menusnip{in_situ_rdo} */ /* clang-format on */ @@ -176,7 +176,7 @@ /** * @anchor sensor_insitu_rdo_timing * @name Sensor Timing - * The sensor timing for an InSitu RDO PRO-X. + * The sensor timing for an In-Situ RDO PRO-X. * * None of these values are specified in the documentation for the sensor; this * is all based on SRGD's testing. @@ -204,7 +204,7 @@ /** * @anchor sensor_insitu_rdo_domgl * @name Dissolved Oxygen Concentration - * The DO concentration variable from an InSitu RDO PRO-X + * The DO concentration variable from an In-Situ RDO PRO-X * - Range is 0 to 50 mg/L concentration * - Accuracy: * - ± 0.1 mg/L from 0 to 8 mg/L @@ -244,7 +244,7 @@ /** * @anchor sensor_insitu_rdo_dopercent * @name Dissolved Oxygen Percent Saturation - * The percent saturation variable from an InSitu RDO PRO-X + * The percent saturation variable from an In-Situ RDO PRO-X * - Range is 0 to 50 mg/L concentration * - Accuracy: * - ± 0.1 mg/L from 0 to 8 mg/L @@ -283,7 +283,7 @@ /** * @anchor sensor_insitu_rdo_temp * @name Temperature - * The temperature variable from an InSitu RDO PRO-X + * The temperature variable from an In-Situ RDO PRO-X * - Range is 0° to 50°C (32° to 122°F) * - Accuracy is ± 0.1°C typical * @@ -317,7 +317,7 @@ /** * @anchor sensor_insitu_rdo_pressure * @name Oxygen Partial Pressure - * The oxygen partial pressure variable from an InSitu RDO PRO-X + * The oxygen partial pressure variable from an In-Situ RDO PRO-X * * @note The oxygen partial pressure output must be manually enabled in SDI-12 * mode using the Win-Situ software. @@ -344,7 +344,7 @@ /* clang-format off */ /** * @brief The Sensor sub-class for the - * [InSitu RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). + * [In-Situ RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). * * @ingroup sensor_insitu_rdo */ @@ -377,7 +377,7 @@ class InSituRDO : public SDI12Sensors { uint8_t measurementsToAverage = 1) : SDI12Sensors( SDI12address, powerPin, dataPin, measurementsToAverage, - "InSitu RDO PRO-X", INSITU_RDO_NUM_VARIABLES, + "In-Situ RDO PRO-X", INSITU_RDO_NUM_VARIABLES, INSITU_RDO_WARM_UP_TIME_MS, INSITU_RDO_STABILIZATION_TIME_MS, INSITU_RDO_MEASUREMENT_TIME_MS, INSITU_RDO_EXTRA_WAKE_TIME_MS, INSITU_RDO_INC_CALC_VARIABLES) {} @@ -388,7 +388,7 @@ class InSituRDO : public SDI12Sensors { uint8_t measurementsToAverage = 1) : SDI12Sensors( SDI12address, powerPin, dataPin, measurementsToAverage, - "InSitu RDO PRO-X", INSITU_RDO_NUM_VARIABLES, + "In-Situ RDO PRO-X", INSITU_RDO_NUM_VARIABLES, INSITU_RDO_WARM_UP_TIME_MS, INSITU_RDO_STABILIZATION_TIME_MS, INSITU_RDO_MEASUREMENT_TIME_MS, INSITU_RDO_EXTRA_WAKE_TIME_MS, INSITU_RDO_INC_CALC_VARIABLES) {} @@ -399,7 +399,7 @@ class InSituRDO : public SDI12Sensors { uint8_t measurementsToAverage = 1) : SDI12Sensors( SDI12address, powerPin, dataPin, measurementsToAverage, - "InSitu RDO PRO-X", INSITU_RDO_NUM_VARIABLES, + "In-Situ RDO PRO-X", INSITU_RDO_NUM_VARIABLES, INSITU_RDO_WARM_UP_TIME_MS, INSITU_RDO_STABILIZATION_TIME_MS, INSITU_RDO_MEASUREMENT_TIME_MS, INSITU_RDO_EXTRA_WAKE_TIME_MS, INSITU_RDO_INC_CALC_VARIABLES) {} @@ -414,7 +414,7 @@ class InSituRDO : public SDI12Sensors { /** * @brief The Variable sub-class used for the * [dissolved oxygen concentration output](@ref sensor_insitu_rdo_domgl) from a - * [InSitu RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). + * [In-Situ RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). * * @ingroup sensor_insitu_rdo */ @@ -460,7 +460,7 @@ class InSituRDO_DOmgL : public Variable { /** * @brief The Variable sub-class used for the * [dissolved oxygen percent saturation output](@ref sensor_insitu_rdo_dopercent) - * from a [InSitu RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). + * from a [In-Situ RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). * * @ingroup sensor_insitu_rdo */ @@ -506,7 +506,7 @@ class InSituRDO_DOpct : public Variable { /** * @brief The Variable sub-class used for the * [temperature output](@ref sensor_insitu_rdo_temp) from a - * [InSitu RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). + * [In-Situ RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). * * @ingroup sensor_insitu_rdo */ @@ -551,7 +551,7 @@ class InSituRDO_Temp : public Variable { /** * @brief The Variable sub-class used for the * [oxygen partial pressure output](@ref sensor_insitu_rdo_pressure) from a - * [InSitu RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). + * [In-Situ RDO PRO-X dissolved oxygen sensor](@ref sensor_insitu_rdo). * * @ingroup sensor_insitu_rdo */ diff --git a/src/sensors/InsituTrollSdi12a.h b/src/sensors/InsituTrollSdi12a.h index 0f82e4468..e3985e300 100644 --- a/src/sensors/InsituTrollSdi12a.h +++ b/src/sensors/InsituTrollSdi12a.h @@ -1,13 +1,13 @@ /* - * @file InsituTrollSdi12a.h + * @file InSituTrollSdi12a.h * @copyright 2020 Stroud Water Research Center * Part of the EnviroDIY modular sensors * @author Neil Hancock https://github.com/neilh10/ModularSensors/ * @author Sara Geleskie Damiano * - * @brief Contains the InsituTrollSdi12a subclass of the SDI12Sensors class - * along with the variable subclasses InsituTrollSdi12a_Pressure, - * InsituTrollSdi12a_Temp, and InsituTrollSdi12a_Depth + * @brief Contains the InSituTrollSdi12a subclass of the SDI12Sensors class + * along with the variable subclasses InSituTrollSdi12a_Pressure, + * InSituTrollSdi12a_Temp, and InSituTrollSdi12a_Depth * * These are used for the In-Situ Level TROLL® 400, 500 & 700 Data Loggers. * The order and units are the default settings for the ITROLL @@ -18,7 +18,7 @@ */ /* clang-format off */ /** - * @defgroup sensor_instutroll In-Situ LevelTROLL 400, 500, and 700 Data Loggers + * @defgroup sensor_insitu_troll In-Situ LevelTROLL 400, 500, and 700 Data Loggers * Classes for the In-Situ LevelTROLL feature sensors pressure, temperature, and depth. * * @ingroup sdi12_group @@ -26,7 +26,7 @@ * @tableofcontents * @m_footernavigation * - * @section sensor_instutroll_intro Introduction + * @section sensor_insitu_troll_intro Introduction * * > A slim 1.8 cm diameter sensor, * > depth measuremente temperature compensated to 0.1% (0.05%) across Full Scale depth range and across temperature range. @@ -34,10 +34,8 @@ * > Has an internal logger for reliable data collection. * > * > Reports sensor serial number and model in uSD .csv file - * - * The In-Situ Aqua/Level TROLL require 8-36VDC - * This can be achieved a Polo #boost device, instructions are at the end + * The In-Situ Aqua/Level TROLL requires 8-36V DC input. * * @warning Coming from the factory, TROLL sensors are set at SDI-12 address '0'. * @@ -52,7 +50,7 @@ * * Tested with Level TROLL 500. * - * @section sensor_instutroll_datasheet Sensor Datasheet + * @section sensor_insitu_troll_datasheet Sensor Datasheet * Documentation for the SDI-12 Protocol commands and responses * The In-Situ Level/Aqua TROLL can be found at: * @@ -60,10 +58,17 @@ * * https://in-situ.com/us/support/documents/sdi-12-commands-and-level-troll-400500700-responses * - * @section sensor_instutroll_flags Build flags + * @section sensor_insitu_troll_flags Build flags * @see @ref sdi12_group_flags * - * @menusnip{instutroll} + * @section sensor_insitu_troll_ctor Sensor Constructor + * {{ @ref InSituTrollSdi12a::InSituTrollSdi12a }} + * + * ___ + * @section sensor_insitu_troll_examples Example Code + * The In-Situ TROLL is used in the @menulink{insitu_troll_sdi12a} example. + * + * @menusnip{insitu_troll_sdi12a} */ /* clang-format on */ @@ -75,13 +80,13 @@ #include "sensors/SDI12Sensors.h" // Sensor Specific Defines -/** @ingroup sensor_insitutroll */ +/** @ingroup sensor_insitu_troll */ /**@{*/ /// @brief Sensor::_numReturnedValues; the TROLL 500 can report 3 values. #define ITROLLA_NUM_VARIABLES 3 /** - * @anchor sensor_insitutroll_timing + * @anchor sensor_insitu_troll_timing * @name Sensor Timing * The sensor timing for a In-Situ TROLL */ @@ -99,13 +104,13 @@ /**@}*/ /** - * @anchor sensor_insitutroll_pressure + * @anchor sensor_insitu_troll_pressure * @name Pressure * The pressue variable from a In-Situ TROLL * - Range is 0 – x (depends on range eg 5psig) * - * {{ @ref InsituTrollSdi12a_Pressure::InsituTrollSdi12a_Pressure }} + * {{ @ref InSituTrollSdi12a_Pressure::InSituTrollSdi12a_Pressure }} */ /**@{*/ /** @@ -130,13 +135,13 @@ /**@}*/ /** - * @anchor sensor_insitutroll_temp + * @anchor sensor_insitu_troll_temp * @name Temperature * The temperature variable from a In-Situ TROLL * - Range is -11°C to +49°C * - Accuracy is ±1°C * - * {{ @ref InsituTrollSdi12a_Temp::InsituTrollSdi12a_Temp }} + * {{ @ref InSituTrollSdi12a_Temp::InSituTrollSdi12a_Temp }} */ /**@{*/ /** @@ -161,13 +166,13 @@ /**@}*/ /** - * @anchor sensor_insitutroll_depth + * @anchor sensor_insitu_troll_depth * @name Water Depth * The water depth variable from a In-Situ TROLL * - Range is 0 to 3.5m to 350m depending on model * - Accuracy is ±0.05% of full scale * - * {{ @ref InsituTrollSdi12a_Depth::InsituTrollSdi12a_Depth }} + * {{ @ref InSituTrollSdi12a_Depth::InSituTrollSdi12a_Depth }} */ /**@{*/ /** @@ -195,13 +200,13 @@ /* clang-format off */ /** * @brief The Sensor sub-class for the - * [Insitu Level/Aqua TROLL pressure, temperature, and depth sensor](@ref sensor_insitutroll) + * [Insitu Level/Aqua TROLL pressure, temperature, and depth sensor](@ref sensor_insitu_troll) * - * @ingroup sensor_insitutroll + * @ingroup sensor_insitu_troll */ /* clang-format on */ -class InsituTrollSdi12a : public SDI12Sensors { +class InSituTrollSdi12a : public SDI12Sensors { public: // Constructors with overloads /** @@ -228,52 +233,52 @@ class InsituTrollSdi12a : public SDI12Sensors { * average before giving a "final" result from the sensor; optional with a * default value of 1. */ - InsituTrollSdi12a(char SDI12address, int8_t powerPin, int8_t dataPin, + InSituTrollSdi12a(char SDI12address, int8_t powerPin, int8_t dataPin, uint8_t measurementsToAverage = 1) : SDI12Sensors(SDI12address, powerPin, dataPin, measurementsToAverage, - "InsituTrollSdi12a", ITROLLA_NUM_VARIABLES, + "InSituTrollSdi12a", ITROLLA_NUM_VARIABLES, ITROLLA_WARM_UP_TIME_MS, ITROLLA_STABILIZATION_TIME_MS, ITROLLA_MEASUREMENT_TIME_MS) {} - InsituTrollSdi12a(char* SDI12address, int8_t powerPin, int8_t dataPin, + InSituTrollSdi12a(char* SDI12address, int8_t powerPin, int8_t dataPin, uint8_t measurementsToAverage = 1) : SDI12Sensors(SDI12address, powerPin, dataPin, measurementsToAverage, - "InsituTrollSdi12a", ITROLLA_NUM_VARIABLES, + "InSituTrollSdi12a", ITROLLA_NUM_VARIABLES, ITROLLA_WARM_UP_TIME_MS, ITROLLA_STABILIZATION_TIME_MS, ITROLLA_MEASUREMENT_TIME_MS) {} - InsituTrollSdi12a(int SDI12address, int8_t powerPin, int8_t dataPin, + InSituTrollSdi12a(int SDI12address, int8_t powerPin, int8_t dataPin, uint8_t measurementsToAverage = 1) : SDI12Sensors(SDI12address, powerPin, dataPin, measurementsToAverage, - "InsituTrollSdi12a", ITROLLA_NUM_VARIABLES, + "InSituTrollSdi12a", ITROLLA_NUM_VARIABLES, ITROLLA_WARM_UP_TIME_MS, ITROLLA_STABILIZATION_TIME_MS, ITROLLA_MEASUREMENT_TIME_MS) {} /** * @brief Destroy the ITROL object */ - ~InsituTrollSdi12a() {} + ~InSituTrollSdi12a() {} }; /* clang-format off */ /** * @brief The Variable sub-class used for the - * [pressure output](@ref sensor_insitutroll_pressure) from a - * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitutroll) + * [pressure output](@ref sensor_insitu_troll_pressure) from a + * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitu_troll) * - * @ingroup sensor_insitutroll + * @ingroup sensor_insitu_troll */ /* clang-format on */ -class InsituTrollSdi12a_Pressure : public Variable { +class InSituTrollSdi12a_Pressure : public Variable { public: /** - * @brief Construct a new InsituTrollSdi12a_Pressure object. + * @brief Construct a new InSituTrollSdi12a_Pressure object. * - * @param parentSense The parent InsituTrollSdi12a providing values. + * @param parentSense The parent InSituTrollSdi12a providing 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 "ITROLLPressure". */ - InsituTrollSdi12a_Pressure( + InSituTrollSdi12a_Pressure( Sensor* parentSense, const char* uuid = "", const char* varCode = ITROLLA_PRESSURE_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)ITROLLA_PRESSURE_VAR_NUM, @@ -281,105 +286,105 @@ class InsituTrollSdi12a_Pressure : public Variable { ITROLLA_PRESSURE_VAR_NAME, ITROLLA_PRESSURE_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new InsituTrollSdi12a_Pressure object. + * @brief Construct a new InSituTrollSdi12a_Pressure object. * - * @note This must be tied with a parent InsituTrollSdi12a before it can be + * @note This must be tied with a parent InSituTrollSdi12a before it can be * used. */ - InsituTrollSdi12a_Pressure() + InSituTrollSdi12a_Pressure() : Variable((const uint8_t)ITROLLA_PRESSURE_VAR_NUM, (uint8_t)ITROLLA_PRESSURE_RESOLUTION, ITROLLA_PRESSURE_VAR_NAME, ITROLLA_PRESSURE_UNIT_NAME, ITROLLA_PRESSURE_DEFAULT_CODE) {} /** - * @brief Destroy the InsituTrollSdi12a_Pressure object - no action needed. + * @brief Destroy the InSituTrollSdi12a_Pressure object - no action needed. */ - ~InsituTrollSdi12a_Pressure() {} + ~InSituTrollSdi12a_Pressure() {} }; /* clang-format off */ /** * @brief The Variable sub-class used for the - * [temperature Output](@ref sensor_insitutroll_temp) from a - * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitutroll) + * [temperature Output](@ref sensor_insitu_troll_temp) from a + * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitu_troll) * - * @ingroup sensor_insitutroll + * @ingroup sensor_insitu_troll */ /* clang-format on */ -class InsituTrollSdi12a_Temp : public Variable { +class InSituTrollSdi12a_Temp : public Variable { public: /** - * @brief Construct a new InsituTrollSdi12a_Temp object. + * @brief Construct a new InSituTrollSdi12a_Temp object. * - * @param parentSense The parent InsituTrollSdi12a providing the values. + * @param parentSense The parent InSituTrollSdi12a providing the 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 "ITROLLtemp". */ - InsituTrollSdi12a_Temp(Sensor* parentSense, const char* uuid = "", + InSituTrollSdi12a_Temp(Sensor* parentSense, const char* uuid = "", const char* varCode = ITROLLA_TEMP_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)ITROLLA_TEMP_VAR_NUM, (uint8_t)ITROLLA_TEMP_RESOLUTION, ITROLLA_TEMP_TEMP_VAR_NAME, ITROLLA_TEMP_TEMP_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new InsituTrollSdi12a_Temp object. + * @brief Construct a new InSituTrollSdi12a_Temp object. * - * @note This must be tied with a parent InsituTrollSdi12a before it can be + * @note This must be tied with a parent InSituTrollSdi12a before it can be * used. */ - InsituTrollSdi12a_Temp() + InSituTrollSdi12a_Temp() : Variable((const uint8_t)ITROLLA_TEMP_VAR_NUM, (uint8_t)ITROLLA_TEMP_RESOLUTION, ITROLLA_TEMP_TEMP_VAR_NAME, ITROLLA_TEMP_TEMP_UNIT_NAME, ITROLLA_TEMP_DEFAULT_CODE) {} /** - * @brief Destroy the InsituTrollSdi12a_Temp object - no action needed. + * @brief Destroy the InSituTrollSdi12a_Temp object - no action needed. */ - ~InsituTrollSdi12a_Temp() {} + ~InSituTrollSdi12a_Temp() {} }; /* clang-format off */ /** * @brief The Variable sub-class used for the - * [depth output](@ref sensor_insitutroll_depth) from a - * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitutroll) + * [depth output](@ref sensor_insitu_troll_depth) from a + * [Insitu TROLL 3-in-1 water level sensor.](@ref sensor_insitu_troll) * - * @ingroup sensor_insitutroll + * @ingroup sensor_insitu_troll */ /* clang-format on */ -class InsituTrollSdi12a_Depth : public Variable { +class InSituTrollSdi12a_Depth : public Variable { public: /** - * @brief Construct a new InsituTrollSdi12a_Depth object. + * @brief Construct a new InSituTrollSdi12a_Depth object. * - * @param parentSense The parent InsituTrollSdi12a providing the values. + * @param parentSense The parent InSituTrollSdi12a providing the 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 "ITROLLdepth". */ - InsituTrollSdi12a_Depth(Sensor* parentSense, const char* uuid = "", + InSituTrollSdi12a_Depth(Sensor* parentSense, const char* uuid = "", const char* varCode = ITROLLA_DEPTH_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)ITROLLA_DEPTH_VAR_NUM, (uint8_t)ITROLLA_DEPTH_RESOLUTION, ITROLLA_DEPTH_VAR_NAME, ITROLLA_DEPTH_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new InsituTrollSdi12a_Depth object. + * @brief Construct a new InSituTrollSdi12a_Depth object. * - * @note This must be tied with a parent InsituTrollSdi12a before it can be + * @note This must be tied with a parent InSituTrollSdi12a before it can be * used. */ - InsituTrollSdi12a_Depth() + InSituTrollSdi12a_Depth() : Variable((const uint8_t)ITROLLA_DEPTH_VAR_NUM, (uint8_t)ITROLLA_DEPTH_RESOLUTION, ITROLLA_DEPTH_VAR_NAME, ITROLLA_DEPTH_UNIT_NAME, ITROLLA_DEPTH_DEFAULT_CODE) {} /** - * @brief Destroy the InsituTrollSdi12a_Depth object - no action needed. + * @brief Destroy the InSituTrollSdi12a_Depth object - no action needed. */ - ~InsituTrollSdi12a_Depth() {} + ~InSituTrollSdi12a_Depth() {} }; /**@}*/ #endif // SRC_SENSORS_INSITUTROLLSDI12_H_ From e711f644bf808a2ede5f1d763ed75c2623654890 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 10 Mar 2022 15:59:42 -0500 Subject: [PATCH 34/94] Missed case change 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 5b694d1f7..9754d66d5 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1306,7 +1306,7 @@ Variable* rdoO2pp = // In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor // ========================================================================== /** Start [insitu_troll_sdi12a] */ -#include +#include // NOTE: Use -1 for any pins that don't apply or aren't being used. const char* TROLLSDI12address = From 01af535559d608b655755302292146ab7c314d2b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 10 Mar 2022 16:00:41 -0500 Subject: [PATCH 35/94] Rename InsituTrollSdi12a.h to InSituTrollSdi12a.h Case changes are touchy when pushing; do it online instead. --- src/sensors/{InsituTrollSdi12a.h => InSituTrollSdi12a.h} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/sensors/{InsituTrollSdi12a.h => InSituTrollSdi12a.h} (100%) diff --git a/src/sensors/InsituTrollSdi12a.h b/src/sensors/InSituTrollSdi12a.h similarity index 100% rename from src/sensors/InsituTrollSdi12a.h rename to src/sensors/InSituTrollSdi12a.h From d05d37076bdd20bd69fd6cfbf2ff9482c19a022e Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 14:34:28 -0400 Subject: [PATCH 36/94] Rename tools to extras to align with Arduino libs Signed-off-by: Sara Damiano --- .../LTExBee_FirstConnection/LTExBee_FirstConnection.ino | 0 .../LTExBee_FirstConnectionBypass.ino | 0 {tools => extras}/Stream_Debug/Stream_Debug.ino | 0 {tools => extras}/i2c_scanner/i2c_scanner.ino | 0 {tools => extras}/i2c_warmUp/i2c_warmUp.ino | 0 {tools => extras}/interrupt_counter/interrupt_counter.ino | 0 {tools => extras}/mega_serial_spy/mega_serial_spy.ino | 0 {tools => extras}/oneWireSearch/oneWireSearch.ino | 0 {tools => extras}/powerOn/powerOn.ino | 0 {tools => extras}/resetBee/resetBee.ino | 0 {tools => extras}/sdi12_address_change/platformio.ini | 2 +- {tools => extras}/sdi12_address_change/sdi12_address_change.ino | 0 12 files changed, 1 insertion(+), 1 deletion(-) rename {tools => extras}/LTExBee_FirstConnection/LTExBee_FirstConnection.ino (100%) rename {tools => extras}/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino (100%) rename {tools => extras}/Stream_Debug/Stream_Debug.ino (100%) rename {tools => extras}/i2c_scanner/i2c_scanner.ino (100%) rename {tools => extras}/i2c_warmUp/i2c_warmUp.ino (100%) rename {tools => extras}/interrupt_counter/interrupt_counter.ino (100%) rename {tools => extras}/mega_serial_spy/mega_serial_spy.ino (100%) rename {tools => extras}/oneWireSearch/oneWireSearch.ino (100%) rename {tools => extras}/powerOn/powerOn.ino (100%) rename {tools => extras}/resetBee/resetBee.ino (100%) rename {tools => extras}/sdi12_address_change/platformio.ini (94%) rename {tools => extras}/sdi12_address_change/sdi12_address_change.ino (100%) diff --git a/tools/LTExBee_FirstConnection/LTExBee_FirstConnection.ino b/extras/LTExBee_FirstConnection/LTExBee_FirstConnection.ino similarity index 100% rename from tools/LTExBee_FirstConnection/LTExBee_FirstConnection.ino rename to extras/LTExBee_FirstConnection/LTExBee_FirstConnection.ino diff --git a/tools/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino b/extras/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino similarity index 100% rename from tools/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino rename to extras/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino diff --git a/tools/Stream_Debug/Stream_Debug.ino b/extras/Stream_Debug/Stream_Debug.ino similarity index 100% rename from tools/Stream_Debug/Stream_Debug.ino rename to extras/Stream_Debug/Stream_Debug.ino diff --git a/tools/i2c_scanner/i2c_scanner.ino b/extras/i2c_scanner/i2c_scanner.ino similarity index 100% rename from tools/i2c_scanner/i2c_scanner.ino rename to extras/i2c_scanner/i2c_scanner.ino diff --git a/tools/i2c_warmUp/i2c_warmUp.ino b/extras/i2c_warmUp/i2c_warmUp.ino similarity index 100% rename from tools/i2c_warmUp/i2c_warmUp.ino rename to extras/i2c_warmUp/i2c_warmUp.ino diff --git a/tools/interrupt_counter/interrupt_counter.ino b/extras/interrupt_counter/interrupt_counter.ino similarity index 100% rename from tools/interrupt_counter/interrupt_counter.ino rename to extras/interrupt_counter/interrupt_counter.ino diff --git a/tools/mega_serial_spy/mega_serial_spy.ino b/extras/mega_serial_spy/mega_serial_spy.ino similarity index 100% rename from tools/mega_serial_spy/mega_serial_spy.ino rename to extras/mega_serial_spy/mega_serial_spy.ino diff --git a/tools/oneWireSearch/oneWireSearch.ino b/extras/oneWireSearch/oneWireSearch.ino similarity index 100% rename from tools/oneWireSearch/oneWireSearch.ino rename to extras/oneWireSearch/oneWireSearch.ino diff --git a/tools/powerOn/powerOn.ino b/extras/powerOn/powerOn.ino similarity index 100% rename from tools/powerOn/powerOn.ino rename to extras/powerOn/powerOn.ino diff --git a/tools/resetBee/resetBee.ino b/extras/resetBee/resetBee.ino similarity index 100% rename from tools/resetBee/resetBee.ino rename to extras/resetBee/resetBee.ino diff --git a/tools/sdi12_address_change/platformio.ini b/extras/sdi12_address_change/platformio.ini similarity index 94% rename from tools/sdi12_address_change/platformio.ini rename to extras/sdi12_address_change/platformio.ini index 6fa4dc7cf..3c0cc96a2 100644 --- a/tools/sdi12_address_change/platformio.ini +++ b/extras/sdi12_address_change/platformio.ini @@ -10,7 +10,7 @@ [platformio] description = ModularSensors compatible SDI-12 adrress changer -src_dir = .piolibdeps/EnviroDIY_ModularSensors_ID1648/tools/sdi12_address_change +src_dir = .piolibdeps/EnviroDIY_ModularSensors_ID1648/extras/sdi12_address_change [env:mayfly] monitor_speed = 115200 diff --git a/tools/sdi12_address_change/sdi12_address_change.ino b/extras/sdi12_address_change/sdi12_address_change.ino similarity index 100% rename from tools/sdi12_address_change/sdi12_address_change.ino rename to extras/sdi12_address_change/sdi12_address_change.ino From b3be9e9e37e91be3da7d214b3398af992712a482 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 14:37:08 -0400 Subject: [PATCH 37/94] Correct some links Signed-off-by: Sara Damiano --- ChangeLog.md | 2 +- README.md | 8 ++--- docs/Doxyfile | 4 +-- docs/FAQ/Arduino-Streams.md | 2 +- docs/FAQ/Developer-Setup.md | 4 +-- docs/markdown_prefilter.py | 7 +++-- examples/menu_a_la_carte/ReadMe.md | 32 ++++++++++---------- examples/menu_a_la_carte/menu_a_la_carte.ino | 4 +-- src/sensors/DecagonCTD.h | 20 ++++++------ src/sensors/SDI12Sensors.h | 4 +-- 10 files changed, 45 insertions(+), 42 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 50f18fa89..11ee7e98d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -414,7 +414,7 @@ Deep debug error Minor Bugs and Simplified Debugging ### Added - - Gave every header file a unique debugging define statement so each file can be debugged individually by building with the build flag -DMS_xxx_DEBUG where xxx is the file name in upper case. +- Gave every header file a unique debugging define statement so each file can be debugged individually by building with the build flag -DMS_xxx_DEBUG where xxx is the file name in upper case. - Some files also have a "deep" debugging option with -DMS_xxx_DEBUG_DEEP - Created examples for LearnEnviroDIYCode diff --git a/README.md b/README.md index 7ea88dd7b..d70d6b7f9 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,12 @@ For some generalized information about attaching sensors to an Arduino style boa - [Bosch BME280: barometric pressure, humidity & temperature](https://envirodiy.github.io/ModularSensors/group__sensor__bme280.html) - [Campbell Scientific OBS-3+: turbidity, via TI ADS1115](https://envirodiy.github.io/ModularSensors/group__sensor__obs3.html) - [Campbell Scientific ClariVUE10: turbidity](https://envirodiy.github.io/ModularSensors/group__sensor__clarivue.html) -- [Decagon Devices ES-2: conductivity ](https://envirodiy.github.io/ModularSensors/group__sensor__decagon__ctd.html) -- [Decagon Devices CTD-10: conductivity, temperature & depth ](https://envirodiy.github.io/ModularSensors/group__sensor__es2.html) +- [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) - [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) -- [In-Situ RDO PRO-X: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__insitu__rdo.html.html) -- [In-Situ SDI-12 TROLLs: pressure, temperature, and depth](https://envirodiy.github.io/ModularSensors/group__sensor__instutroll.html.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) - [Acculevel](https://envirodiy.github.io/ModularSensors/group__sensor__acculevel.html) - [Nanolevel](https://envirodiy.github.io/ModularSensors/group__sensor__nanolevel.html) diff --git a/docs/Doxyfile b/docs/Doxyfile index fab21680c..ec46340dc 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -280,7 +280,7 @@ ALIASES = "license=@par License:\n" \ "menusnip{1}=@snippet{lineno} menu_a_la_carte.ino \1 ^^ ^^ " \ "m_innerpage{1}=@xmlonly @endxmlonly" - # "menulink{1}=[menu a la carte](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_\1)" \ + # "menulink{1}=[menu a la carte](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_\1)" \ # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -996,7 +996,7 @@ EXCLUDE_SYMBOLS = # command). EXAMPLE_PATH = ../examples \ - ../tools + ../extras # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and diff --git a/docs/FAQ/Arduino-Streams.md b/docs/FAQ/Arduino-Streams.md index 2bef4f8bd..93dc1b253 100644 --- a/docs/FAQ/Arduino-Streams.md +++ b/docs/FAQ/Arduino-Streams.md @@ -137,7 +137,7 @@ enableInterrupt(rx_pin, SoftwareSerial_ExtInts::handle_interrupt, CHANGE); ## SAMD SERCOMs -Example code for creating more serial ports on an Adafruit feather M0 using the SERCOMs is available [in the menu a la carte example](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_samd_serial_ports). +Example code for creating more serial ports on an Adafruit feather M0 using the SERCOMs is available [in the menu a la carte example](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_samd_serial_ports). Here are some helpful links for more information about the number of serial ports available on some of the different Arduino-style boards: diff --git a/docs/FAQ/Developer-Setup.md b/docs/FAQ/Developer-Setup.md index 3d9d25e00..3afdd7a5d 100644 --- a/docs/FAQ/Developer-Setup.md +++ b/docs/FAQ/Developer-Setup.md @@ -34,7 +34,7 @@ framework = arduino check_tool = cppcheck, clangtidy check_patterns = src - tools + extras examples check_flags = cppcheck: --enable=all, --inline-suppr @@ -51,7 +51,7 @@ lib_ignore = doc examples sensor_tests - tools + extras Adafruit NeoPixel Adafruit GFX Library Adafruit SSD1306 diff --git a/docs/markdown_prefilter.py b/docs/markdown_prefilter.py index 2c26f7b30..549e70f65 100644 --- a/docs/markdown_prefilter.py +++ b/docs/markdown_prefilter.py @@ -94,6 +94,9 @@ def github_slugify(name): massaged_line = line # Convert markdown comment tags to c++/dox style comment tags massaged_line = re.sub(r"\[//\]: # \( @(\w+?.*) \)", r"@\1", massaged_line) + # allow thank you tags + massaged_line = massaged_line.replace("thanks to @", "thanks to \@") + # Convert GitHub pages url's to refs # I'm putting the long URL in the markdown because I want the links there to # work and go to the pages. But when feeding it to Doxygen, I want them to be @@ -103,8 +106,8 @@ def github_slugify(name): # For links to sections, doxygen cuts off the first letter of the section name # in the examples (UGH), so some acrobatics to find them massaged_line = re.sub( - r"https://envirodiy.github.io/ModularSensors/[\w/-]+\.html#enu_(?P[\w/-]+)", - r"@ref menu_\g", + r"https://envirodiy.github.io/ModularSensors/[\w/-]+\.html#enu_walk_(?P[\w/-]+)", + r"@ref menu_walk_\g", massaged_line, ) # for classes, we need to switch camel and snake cases diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 9ee0f73e1..5dbfbcf79 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -207,7 +207,7 @@ Not all AVR boards are supported by NeoSWSerial. [//]: # ( @menusnip{neoswserial} ) -When using NeoSWSerial we will also have to actually set the data receiving (Rx) pin modes for interrupt in the [setup function](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_serial_interrupts). +When using NeoSWSerial we will also have to actually set the data receiving (Rx) pin modes for interrupt in the [setup function](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_serial_interrupts). ##### SoftwareSerial with External Interrupts @@ -223,7 +223,7 @@ If you only want to use the serial line for incoming or outgoing data, set the o [//]: # ( @menusnip{softwareserial} ) -When using SoftwareSerial with External Interrupts we will also have to actually set the data receiving (Rx) pin modes for interrupt in the [setup function](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_serial_interrupts). +When using SoftwareSerial with External Interrupts we will also have to actually set the data receiving (Rx) pin modes for interrupt in the [setup function](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_serial_interrupts). ##### Software I2C/Wire @@ -246,7 +246,7 @@ These pin selections are based on the Adafruit Feather M0. [//]: # ( @menusnip{serial_ports_SAMD} ) In addition to creating the extra SERCOM ports here, the pins must be set up as the proper pin peripherals after the serial ports are begun. -This is shown in the [SAMD Pin Peripherals section](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_pin_periph) of the setup function. +This is shown in the [SAMD Pin Peripherals section](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_pin_periph) of the setup function. NOTE: The SAMD51 board has an amazing _8_ available SERCOM's, but I do not have any exmple code for using them. @@ -255,7 +255,7 @@ NOTE: The SAMD51 board has an amazing _8_ available SERCOM's, but I do not have ### Assigning Serial Port Functionality -This section just assigns all the serial ports from the @ref menu_serial_ports section above to specific functionality. +This section just assigns all the serial ports from the @ref menu_walk_serial_ports section above to specific functionality. For a board with the option of up to 4 hardware serial ports, like the SAMD21 or Arduino Mega, we use the Serial1 to talk to the modem, Serial2 for modbus, and Serial3 for the Maxbotix. For an AVR board where we're relying on a mix of hardware and software ports, we use hardware Serial 1 for the modem, AltSoftSerial for modbus, and NeoSWSerial for the Maxbotix. Depending on how you rank the importance of each component, you can adjust these to your liking. @@ -314,7 +314,7 @@ The Telit based Digi XBees (LTE Cat1 both Verizon and AT&T) can only use this mo [//]: # ( @menusnip{digi_xbee_cellular_transparent} ) Depending on your cellular carrier, it is best to select the proper carrier profile and network. Setting these helps the modem to connect to network faster. -This is shows in the [XBee Cellular Carrier](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_xbeec_carrier) chunk of the setup function. +This is shows in the [XBee Cellular Carrier](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_xbeec_carrier) chunk of the setup function. ### Digi XBee3 LTE-M - Bypass Mode @@ -388,7 +388,7 @@ Pins that do not apply should be set as -1. [//]: # ( @menusnip{espressif_esp8266} ) Because the ESP8266's default baud rate is too fast for an 8MHz board like the Mayfly, to use it you need to drop the baud rate down for sucessful communication. -You can set the slower baud rate using some external method, or useing the code from the ESP8266 Baud Rate(https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_esp) part of the setup function below. +You can set the slower baud rate using some external method, or useing the code from the ESP8266 Baud Rate(https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_esp) part of the setup function below. ### Quectel BG96 @@ -406,7 +406,7 @@ Pins that do not apply should be set as -1. [//]: # ( @menusnip{quectel_bg96} ) If you are interfacing with a Nimbelink Skywire board via the Skywire development board, you also need to handle the fact that the development board reverses the levels of the status, wake, and reset pins. -Code to invert the pin levels is in the [Skywire Pin Inversions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_skywire) part of the setup function below. +Code to invert the pin levels is in the [Skywire Pin Inversions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_skywire) part of the setup function below. ### Sequans Monarch @@ -425,7 +425,7 @@ Pins that do not apply should be set as -1. [//]: # ( @menusnip{sequans_monarch} ) If you are interfacing with a Nimbelink Skywire board via the Skywire development board, you also need to handle the fact that the development board reverses the levels of the status, wake, and reset pins. -Code to invert the pin levels is in the [Skywire Pin Inversions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_setup_skywire) part of the setup function below. +Code to invert the pin levels is in the [Skywire Pin Inversions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_skywire) part of the setup function below. The default baud rate of the SVZM20 is much too fast for almost all Arduino boards. _Before_ attampting to connect a SVZM20 to an Arduino you should connect it to your computer and use AT commands to decrease the baud rate. @@ -751,7 +751,7 @@ The Arduino pin controlling the receive and data enable on your RS485-to-TTL ada 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. -The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to modbus functionality in the @ref menu_assign_ports_sw section. +The serial ports for this example are created in the @ref menu_walk_serial_ports section and then assigned to modbus functionality in the @ref menu_walk_assign_ports_sw section. 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. @@ -786,7 +786,7 @@ The Arduino pin controlling power on/off, a stream instance for received data (i (Use -1 for the trigger pin if you do not have it connected.) Please see the section "[Notes on Arduino Streams and Software Serial](https://envirodiy.github.io/ModularSensors/page_arduino_streams.html)" for more information about what streams can be used along with this library. -The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to the sonar functionality in the @ref menu_assign_ports_sw section. +The serial ports for this example are created in the @ref menu_walk_serial_ports section and then assigned to the sonar functionality in the @ref menu_walk_assign_ports_sw section. @see @ref sensor_maxbotix @@ -861,7 +861,7 @@ ___ Because older versions of these sensors all ship with the same I2C address, and more than one is frequently used at different soil depths in the same profile, this module has an optional dependence on Testato's [SoftwareWire](https://github.com/Testato/SoftwareWire) library for software I2C. To use software I2C, compile with the build flag `-D MS_PALEOTERRA_SOFTWAREWIRE`. -See the [software wire](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_softwarewire) section for an example of creating a software I2C instance to share between sensors. +See the [software wire](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_softwarewire) section for an example of creating a software I2C instance to share between sensors. The constructors for the software I2C implementation requires either the SCL and SDA pin numbers or a reference to the I2C object as arguments. All variants of the constructor require the Arduino power pin. @@ -971,7 +971,7 @@ In tests on these sensors, SoftwareSerial_ExtInts _did not work_ to communicate AltSoftSerial and HardwareSerial work fine. NeoSWSerial is a bit hit or miss, but can be used in a pinch. -The serial ports for this example are created in the @ref menu_serial_ports section and then assigned to modbus functionality in the @ref menu_assign_ports_sw section. +The serial ports for this example are created in the @ref menu_walk_serial_ports section and then assigned to modbus functionality in the @ref menu_walk_assign_ports_sw section. @see @ref yosemitech_group @@ -1210,7 +1210,7 @@ This is also just for debugging - it's very helpful when connected to the logger If we're using either NeoSWSerial or SoftwareSerial_ExtInts we need to assign the data receiver pins to interrupt functionality here in the setup. -The [NeoSWSerial](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_neoswserial) and [SoftwareSerial_ExtInts](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_softwareserial) objects were created way up in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_serial_ports) section. +The [NeoSWSerial](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_neoswserial) and [SoftwareSerial_ExtInts](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_softwareserial) objects were created way up in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_serial_ports) section. **NOTE:** If you create more than one NeoSWSerial or Software serial object, you need to call the enableInterrupt function for each Rx pin! @@ -1228,14 +1228,14 @@ For SoftwareSerial with External interrupts we use: ### Serial Begin Every serial port setup and used in the program must be "begun" in the setup function. -This section calls the begin functions for all of the various ports defined in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_serial_ports) section +This section calls the begin functions for all of the various ports defined in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_serial_ports) section [//]: # ( @menusnip{setup_serial_begins} ) ### SAMD Pin Peripherals After beginning all of the serial ports, we need to set the pin peripheral settings for any SERCOM's we assigned to serial functionality on the SAMD boards. -These were created in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_samd_serial_ports) section above. +These were created in the [Extra Serial Ports](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_samd_serial_ports) section above. This does not need to be done for an AVR board (like the Mayfly). [//]: # ( @menusnip{setup_samd_pins} ) @@ -1243,7 +1243,7 @@ This does not need to be done for an AVR board (like the Mayfly). ### Flash the LEDs Like printing debugging information to the serial port, flashing the board LED's is a very helpful indication that the board just restarted. -Here we set the pin modes for the LED pins and flash them back and forth using the greenredflash() function we created back in the [working functions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_working) section. +Here we set the pin modes for the LED pins and flash them back and forth using the greenredflash() function we created back in the [working functions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_working) section. [//]: # ( @menusnip{setup_flashing_led} ) 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 9754d66d5..7702a70a9 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -2347,10 +2347,10 @@ Variable* variableList[] = { #if defined BUILD_SENSOR_CAMPBELL_CLARI_VUE10 clarivueTurbidity, clarivueTemp, - clarivueError + clarivueError, #endif #if defined BUILD_SENSOR_CAMPBELL_OBS3 - obs3TurbLow, + obs3TurbLow, obs3VoltLow, obs3TurbHigh, obs3VoltHigh, diff --git a/src/sensors/DecagonCTD.h b/src/sensors/DecagonCTD.h index 3898240b5..7c5a18af6 100644 --- a/src/sensors/DecagonCTD.h +++ b/src/sensors/DecagonCTD.h @@ -17,7 +17,7 @@ */ /* clang-format off */ /** - * @defgroup sensor_decagonCTD Decagon CTD-10 + * @defgroup sensor_decagon_ctd Decagon CTD-10 * Classes for the Decagon CTD-10 conductivity, temperature, and depth sensor. * * @ingroup sdi12_group @@ -66,7 +66,7 @@ #include "sensors/SDI12Sensors.h" // Sensor Specific Defines -/** @ingroup sensor_decagonCTD */ +/** @ingroup sensor_decagon_ctd */ /**@{*/ /// @brief Sensor::_numReturnedValues; the CTD can report 3 values. @@ -189,9 +189,9 @@ /* clang-format off */ /** * @brief The Sensor sub-class for the - * [Decagon CTD-10 conductivity, temperature, and depth sensor](@ref sensor_decagonCTD) + * [Decagon CTD-10 conductivity, temperature, and depth sensor](@ref sensor_decagon_ctd) * - * @ingroup sensor_decagonCTD + * @ingroup sensor_decagon_ctd */ /* clang-format on */ class DecagonCTD : public SDI12Sensors { @@ -257,9 +257,9 @@ class DecagonCTD : public SDI12Sensors { /** * @brief The Variable sub-class used for the * [conductivity output](@ref sensor_decagon_ctd_cond) from a - * [Decagon CTD-10 3-in-1 water level sensor.](@ref sensor_decagonCTD) + * [Decagon CTD-10 3-in-1 water level sensor.](@ref sensor_decagon_ctd) * - * @ingroup sensor_decagonCTD + * @ingroup sensor_decagon_ctd */ /* clang-format on */ class DecagonCTD_Cond : public Variable { @@ -298,9 +298,9 @@ class DecagonCTD_Cond : public Variable { /** * @brief The Variable sub-class used for the * [temperature output](@ref sensor_decagon_ctd_temp) from a - * [Decagon CTD-10 3-in-1 water level sensor.](@ref sensor_decagonCTD) + * [Decagon CTD-10 3-in-1 water level sensor.](@ref sensor_decagon_ctd) * - * @ingroup sensor_decagonCTD + * @ingroup sensor_decagon_ctd */ /* clang-format on */ class DecagonCTD_Temp : public Variable { @@ -339,9 +339,9 @@ class DecagonCTD_Temp : public Variable { /** * @brief The Variable sub-class used for the * [depth output](@ref sensor_decagon_ctd_depth) from a - * [Decagon CTD-10 3-in-1 water level sensor.](@ref sensor_decagonCTD) + * [Decagon CTD-10 3-in-1 water level sensor.](@ref sensor_decagon_ctd) * - * @ingroup sensor_decagonCTD + * @ingroup sensor_decagon_ctd */ /* clang-format on */ class DecagonCTD_Depth : public Variable { diff --git a/src/sensors/SDI12Sensors.h b/src/sensors/SDI12Sensors.h index 197b12a2b..3a5c9eaec 100644 --- a/src/sensors/SDI12Sensors.h +++ b/src/sensors/SDI12Sensors.h @@ -35,9 +35,9 @@ * sensor. If you want to use more than one SDI-12 sensor, you must ensure that * each sensor has a different address. To find or change the SDI-12 address of * your sensor, load and run the - * [sdi12_address_change](https://github.com/EnviroDIY/ModularSensors/blob/master/tools/sdi12_address_change/sdi12_address_change.ino) + * [sdi12_address_change](https://github.com/EnviroDIY/ModularSensors/blob/master/extras/sdi12_address_change/sdi12_address_change.ino) * program from the - * [tools](https://github.com/EnviroDIY/ModularSensors/tree/master/tools) + * [extras](https://github.com/EnviroDIY/ModularSensors/tree/master/extras) * directory or the * [b_address_change](https://github.com/EnviroDIY/Arduino-SDI-12/tree/master/examples/b_address_change) * example within the SDI-12 library. From a2c587a30d70bd5e278e99b80f3dbe1cb26affb9 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 14:41:43 -0400 Subject: [PATCH 38/94] bump some dependencies Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 98 ++++++------------------ library.json | 6 +- library.properties | 2 +- 3 files changed, 28 insertions(+), 78 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 2fd7d82fb..1666954a6 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -8,10 +8,7 @@ "url": "https://github.com/EnviroDIY/Sodaq_DS3231.git", "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.git", "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.git", "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.git", "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,20 +61,16 @@ "url": "https://github.com/knolleary/pubsubclient.git", "version": "~2.8", "note": "A client library for MQTT messaging.", - "authors": [ - "Nick O'Leary" - ] + "authors": ["Nick O'Leary"] }, { "name": "Adafruit BusIO", "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.11.1", + "version": "~1.11.2", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -95,11 +79,9 @@ "owner": "adafruit", "library id": "31", "url": "https://github.com/adafruit/Adafruit_Sensor.git", - "version": "~1.1.4", + "version": "~1.1.5", "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.git", "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.git", "version": "~2.2.2", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -148,9 +124,7 @@ "url": "https://github.com/adafruit/DHT-sensor-library.git", "version": "~1.4.3", "note": "AOSong DHT Sensor Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -159,11 +133,9 @@ "owner": "adafruit", "library id": "160", "url": "https://github.com/adafruit/Adafruit_INA219.git", - "version": "~1.1.1", + "version": "~1.2.0", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -174,9 +146,7 @@ "url": "https://github.com/adafruit/Adafruit_MPL115A2.git", "version": "~2.0.0", "note": "MPL115A2 Barometer Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino" }, { @@ -210,12 +180,7 @@ "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library.git", "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" }, @@ -242,22 +207,14 @@ "url": "https://github.com/NorthernWidget/MS5803.git", "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" }, @@ -268,9 +225,7 @@ "url": "https://github.com/EnviroDIY/SensorModbusMaster.git", "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" }, @@ -281,9 +236,7 @@ "url": "https://github.com/EnviroDIY/KellerModbus.git", "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", @@ -292,12 +245,9 @@ "url": "https://github.com/EnviroDIY/YosemitechModbus.git", "version": "~0.3.2", "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" } ] -} \ No newline at end of file +} diff --git a/library.json b/library.json index 9b3707fbc..cd3c32440 100644 --- a/library.json +++ b/library.json @@ -129,7 +129,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.11.1", + "version": "~1.11.2", "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.git", - "version": "~1.1.4", + "version": "~1.1.5", "note": "Adafruit's unified sensor library is used by their other libraries", "authors": ["Adafruit"], "frameworks": "arduino", @@ -194,7 +194,7 @@ "owner": "adafruit", "library id": "160", "url": "https://github.com/adafruit/Adafruit_INA219.git", - "version": "~1.1.1", + "version": "~1.2.0", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", "authors": ["Adafruit"], "frameworks": "arduino", diff --git a/library.properties b/library.properties index 1062dea7a..a0cb3cb62 100644 --- a/library.properties +++ b/library.properties @@ -1,4 +1,4 @@ -name=EnviroDIY_ModularSensors +name=ModularSensors version=0.33.0 author=Sara Damiano , Shannon Hicks maintainer=Sara Damiano From 58e70d87b53d2242f75eb83e9102d72287e0dbda Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 15:59:40 -0400 Subject: [PATCH 39/94] update modem notes Signed-off-by: Sara Damiano --- docs/Modem-Notes.md | 79 +++++++++++++++++++++++++++++++++------------ 1 file changed, 59 insertions(+), 20 deletions(-) diff --git a/docs/Modem-Notes.md b/docs/Modem-Notes.md index 67c843cca..457e65de3 100644 --- a/docs/Modem-Notes.md +++ b/docs/Modem-Notes.md @@ -8,7 +8,8 @@ - [Default baud rates of supported modules](#default-baud-rates-of-supported-modules) - [Power Requirements of Supported Modems](#power-requirements-of-supported-modems) - [Sleep and Reset Pin Labels](#sleep-and-reset-pin-labels) - - [Pin Numbers to Use when Connecting to the Mayfly](#pin-numbers-to-use-when-connecting-to-the-mayfly) + - [Pin Numbers to Use when Connecting to a Mayfly 0.x](#pin-numbers-to-use-when-connecting-to-a-mayfly-0x) + - [Pin Numbers to Use when Connecting to a Mayfly 1.x](#pin-numbers-to-use-when-connecting-to-a-mayfly-1x) [//]: # ( End GitHub Only ) @@ -51,6 +52,7 @@ If you are having trouble, please see the pages for the specific modems and the ² The NB IOT UBee based on the SARA N211 is _not_ supported. +*** ## Default baud rates of supported modules @@ -65,6 +67,7 @@ If you are having trouble, please see the pages for the specific modems and the | u-blox SARA R4 or N4 series | 115200; _reverts to this speed after every power loss_ | | u-blox 2G, 3G, and 4G modules | varies by module, most auto-baud or use 9600 | +*** ## Power Requirements of Supported Modems @@ -98,6 +101,8 @@ Most modules are capable of serial communication and some level of functionality ¹ This is a firm minimum; the SIM7000 _will not connect to the internet_ if only powered at 500mA. +*** + ## Sleep and Reset Pin Labels | Module | Status Pin Label | Reset Label | Wake / Sleep Request | @@ -121,24 +126,24 @@ Most modules are capable of serial communication and some level of functionality | u-blox 2G, 3G, and 4G modules | `V_INT` | `RESET_N` | `PWR_ON` | | Sodaq UBee 3G | `STATUS` also mislabeled as `CTS` | `RESET` | `PWR_ON` | +*** +## Pin Numbers to Use when Connecting to a Mayfly 0.x -## Pin Numbers to Use when Connecting to the Mayfly - -Here are the pin numbers to use for modules that can be attached directly to an EnviroDIY Mayfly v0.x using its Bee socket. +Here are the pin numbers to use for modules that can be attached directly to an EnviroDIY Mayfly v0.3, 0.4, 0.5, 0.5b, or 0.5c using its Bee socket. -| Module | Power | Status | Reset | Sleep Request | -| :------------------------------------------------: | :------------: | :------------: | :------------: | :------------: | -| Digi XBee/XBee3, all variants (direct connection)¹ | -1 | 19² | -1 | 23 | -| Digi XBee/XBee3, all variants (with LTE adapter) | -13 | 194 | 20 | 23 | -| Itead Wee (ESP8266)8 | -1 | -1 | -15 | -1 | -| DFRobot WiFi Bee (ESP8266) | -1 | -1 | -1 | 196 | -| Dragino NB IOT Bee (BG96) | -1 | -1 | -17 | -17 | -| Sodaq GPRSBee R4 (SIM900) | -1 | 19 | -1 | 23 | -| Sodaq GPRSBee R6 or R7 (SIM800H) | 23 | 19 | -1 | -1 | -| Sodaq UBee LTE-M (u-blox SARA R410M) | 23 | 19 | -1 | 20 | -| Sodaq UBee 3G (u-blox SARA U201) | 23 | 19 | -1 | 20 | -| EnviroDIY LTE Bee (SIM7080G) | -1 | 19 | 239 | 239 | +| Module | Power | Status | Reset | Sleep Request | +| :----------------------------------------------------------: | :------------: | :------------: | :------------: | :------------: | +| Digi XBee/XBee3, all variants (direct connection)¹ | -1 | 19² | -1 | 23 | +| Digi XBee/XBee3, all variants (with LTE adapter8) | -13 | 194 | 20 | 23 | +| Itead Wee (ESP8266)8 | -1 | -1 | -15 | -1 | +| DFRobot WiFi Bee (ESP8266) | -1 | -1 | -1 | 196 | +| Dragino NB IOT Bee (BG96) | -1 | -1 | -17 | -17 | +| Sodaq GPRSBee R4 (SIM900) | -1 | 19 | -1 | 23 | +| Sodaq GPRSBee R6 or R7 (SIM800H) | 23 | 19 | N/A | N/A | +| Sodaq UBee LTE-M (u-blox SARA R410M) | 23 | 19 | -1 | 20 | +| Sodaq UBee 3G (u-blox SARA U201) | 23 | 19 | -1 | 20 | +| EnviroDIY LTE Bee (SIM7080G) | -1 | 19 | N/A | 239 | ¹ To use the cellular Digi XBee's without the LTE adapter, your Mayfly must be at least v0.5b, you must use SJ13 to connect the Bee directly to the LiPo, and you must always have a battery connected to provide enough power for the XBee to make a cellular connection. @@ -146,18 +151,19 @@ If you turn off the Mayfly via its switch but leave the XBee connected as above, Disconnect the battery if you turn off the Mayfly. ² The Digi XBee reports ON/SLEEP_N on pin 13, but this is not connected to a Mayfly pin. -Instead, you must use the XBee's `CTS` pin (pin 12) which is connected to Mayfly pin 19. +Instead, you must use the XBee's `CTS` pin (pin 12) which is connected to Mayfly pin 19 and set the argument `useCTSforStatus` to `true` in the bee constructor. -3 If you close solder jumper 1 (SJ1) on the LTE adapter and use connect solder jumper 7 (SJ7) on the Mayfly to te A5 to ASSOC, you can use A5 as the power pin for the XBee. +3 If you close solder jumper 1 (SJ1) on the LTE adapter and use connect solder jumper 7 (SJ7) on the Mayfly to connect A5 to ASSOC, you can use A5 as the power pin for the XBee. -4 The LTE adapter switches pins 12 and 13 so that the true `STATUS` pn of the XBee is connected to Mayfly pin 19. +4 The LTE adapter switches pins 12 and 13 so that the true `STATUS` pin of the XBee is connected to Mayfly pin 19. +You should set the argument `useCTSforStatus` to `false` in the bee constructor 5 I *strongly* recommend running a new wire along the back of the Mayfly to connect pin 5 of the XBee socket to pin A4. This will enable you to use A4 as the reset pin which allows you to use deep sleep. 6 Use 13 as the `espSleepRqPin` for light sleep. -7 I *strongly* recommend running two new wires along the back of the Mayfly to connect pin 5 of the XBee socket to pin A4 and pin of the XBee socket to A3. +7 I *strongly* recommend running two new wires along the back of the Mayfly to connect pin 5 of the XBee socket to pin A4 and pin 18 of the XBee socket to A3. This will enable you to use A4 as the reset pin and A3 as the sleep request pin. With those connections made, the Dragino BG96 becomes the _**only**_ LTE module that can be run using only the 500mA regulator on the Mayfly (ie, without a separate battery connection for the modem). @@ -169,3 +175,36 @@ To use it, you must add these commands to your setup: modem.setModemWakeLevel(HIGH); modem.setModemResetLevel(HIGH); ``` + +*** + +## Pin Numbers to Use when Connecting to a Mayfly 1.x + +Here are the pin numbers to use for modules that can be attached directly to an EnviroDIY Mayfly v1.0 or 1.1 using its Bee socket. + +| Module | Power | Status | Reset | Sleep Request | +| :-----------------------------------------------: | :---: | :----: | :------------: | :------------: | +| Digi XBee/XBee3, all variants (direct connection) | 18¹ | 19² | A53 | 23 | +| DFRobot WiFi Bee (ESP8266) | 18¹ | -1 | -1 | -1 | +| Dragino NB IOT Bee (BG96) | 18¹ | -1 | A53 | -1 | +| Sodaq GPRSBee R4 (SIM900) | 18¹ | 19 | -1 | 23 | +| Sodaq GPRSBee R6 or R7 (SIM800H) | 23 | 19 | N/A | N/A | +| Sodaq UBee LTE-M (u-blox SARA R410M) | 23 | 19 | A53 | 20 | +| Sodaq UBee 3G (u-blox SARA U201) | 23 | 19 | A53 | 20 | +| EnviroDIY LTE Bee (SIM7080G) | 18¹ | 19 | N/A | 234 | + + +¹ This assumes you have not changed solder jumper 18. If you have switched SJ18 to connect bee pin one directly to 3.3V, use -1. + +² The Digi XBee reports ON/SLEEP_N on pin 13, but this is not connected to a Mayfly pin by default. +You can use the XBee's `CTS` pin (pin 12) which is connected to Mayfly pin 19 by default and set the argument `useCTSforStatus` to `true` in the bee constructor. +Alternately (and preferably) you can change solder jumper 19 (SJ19) to connect bee pin 13 to D19 and set the argument `useCTSforStatus` to `false`. + +3 Solder jumper 20 should be left in the default position, connecting pin A5 to bee pin 5. + +4 The EnviroDIY LTE Bee inverts the signal to the sleep request pin (`PWRKEY`) - which is also used for reset. +To use it, you must add these commands to your setup: +```cpp +modem.setModemWakeLevel(HIGH); +modem.setModemResetLevel(HIGH); +``` From a0312c3259e84ee5dfad7cb251a69c68cab64378 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 16:01:04 -0400 Subject: [PATCH 40/94] Add missing chunks to walk-through Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/ReadMe.md | 102 +++++++++++++++++-- examples/menu_a_la_carte/menu_a_la_carte.ino | 2 +- src/sensors/InSituRDO.h | 4 +- 3 files changed, 95 insertions(+), 13 deletions(-) diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 5dbfbcf79..a4ccf439a 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -47,6 +47,7 @@ ___ - [Sequans Monarch](#sequans-monarch) - [SIMCom SIM800](#simcom-sim800) - [SIMCom SIM7000](#simcom-sim7000) + - [SIMCom SIM7080G (EnviroDIY LTE Bee])](#simcom-sim7080g-envirodiy-lte-bee) - [Sodaq GPRSBee](#sodaq-gprsbee) - [u-blox SARA R410M](#u-blox-sara-r410m) - [u-blox SARA U201](#u-blox-sara-u201) @@ -65,13 +66,17 @@ ___ - [Atlas Scientific EZO-RTD Temperature Sensor](#atlas-scientific-ezo-rtd-temperature-sensor) - [Atlas Scientific EZO-EC Conductivity Sensor](#atlas-scientific-ezo-ec-conductivity-sensor) - [Bosch BME280 Environmental Sensor](#bosch-bme280-environmental-sensor) + - [Campbell ClariVUE SDI-12 Turbidity Sensor](#campbell-clarivue-sdi-12-turbidity-sensor) - [Campbell OBS3+ Analog Turbidity Sensor](#campbell-obs3-analog-turbidity-sensor) + - [Decagon CTD-10 Conductivity, Temperature, and Depth Sensor](#decagon-ctd-10-conductivity-temperature-and-depth-sensor) - [Decagon ES2 Conductivity and Temperature Sensor](#decagon-es2-conductivity-and-temperature-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) + - [In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe](#in-situ-rdo-pro-x-rugged-dissolved-oxygen-probe) + - [In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor](#in-situ-aqualevel-troll-pressure-temperature-and-depth-sensor) - [Keller RS485/Modbus Water Level Sensors](#keller-rs485modbus-water-level-sensors) - - [Keller Nanolevel Level Transmitter](#keller-nanolevel-level-transmitter) - [Keller Acculevel High Accuracy Submersible Level Transmitter](#keller-acculevel-high-accuracy-submersible-level-transmitter) + - [Keller Nanolevel Level Transmitter](#keller-nanolevel-level-transmitter) - [Maxbotix HRXL Ultrasonic Range Finder](#maxbotix-hrxl-ultrasonic-range-finder) - [Maxim DS18 One Wire Temperature Sensor](#maxim-ds18-one-wire-temperature-sensor) - [Measurement Specialties MS5803-14BA Pressure Sensor](#measurement-specialties-ms5803-14ba-pressure-sensor) @@ -122,6 +127,7 @@ ___ - [Custom Modem Setup](#custom-modem-setup) - [ESP8266 Baud Rate](#esp8266-baud-rate) - [Skywire Pin Inversions](#skywire-pin-inversions) + - [SimCom SIM7080G Network Mode](#simcom-sim7080g-network-mode) - [XBee Cellular Carrier](#xbee-cellular-carrier) - [SARA R4 Cellular Carrier](#sara-r4-cellular-carrier) - [Sync the Real Time Clock](#sync-the-real-time-clock) @@ -257,6 +263,9 @@ NOTE: The SAMD51 board has an amazing _8_ available SERCOM's, but I do not have This section just assigns all the serial ports from the @ref menu_walk_serial_ports section above to specific functionality. For a board with the option of up to 4 hardware serial ports, like the SAMD21 or Arduino Mega, we use the Serial1 to talk to the modem, Serial2 for modbus, and Serial3 for the Maxbotix. + +[//]: # ( @menusnip{assign_ports_hw} ) + For an AVR board where we're relying on a mix of hardware and software ports, we use hardware Serial 1 for the modem, AltSoftSerial for modbus, and NeoSWSerial for the Maxbotix. Depending on how you rank the importance of each component, you can adjust these to your liking. @@ -288,7 +297,7 @@ The baud rate of any of the modules can be changed using AT commands or the `mod Next, we'll assign all the pin numbers for all the other pins connected between the modem and the MCU. Pins that do not apply should be set as -1. -There is a table of general @ref modem_notes_sleep and @ref modem_notes_mayfly_pins on the @ref page_modem_notes page. +There is a table of general @ref modem_notes_sleep and @ref modem_notes_mayfly_0_pins on the @ref page_modem_notes page. All the modems also need some sort of network credentials for internet access. For WiFi modems, you need the network name and password (assuming WPA2). @@ -308,10 +317,14 @@ To create a DigiXBeeCellularTransparent object we need to know - the `DTR_N/SLEEP_RQ/DIO8` pin, - and the SIM card's cellular access point name (APN). +Pins that do not apply should be set as -1. +A helpful table detailing the pins to use with the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. + @note The u-blox based Digi XBee's (3G global and LTE-M global) may be more stable used in bypass mode (below). The Telit based Digi XBees (LTE Cat1 both Verizon and AT&T) can only use this mode. [//]: # ( @menusnip{digi_xbee_cellular_transparent} ) + Depending on your cellular carrier, it is best to select the proper carrier profile and network. Setting these helps the modem to connect to network faster. This is shows in the [XBee Cellular Carrier](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_xbeec_carrier) chunk of the setup function. @@ -330,8 +343,10 @@ To create a DigiXBeeLTEBypass object we need to know - and the SIM card's cellular access point name (APN). Pins that do not apply should be set as -1. +A helpful table detailing the pins to use with the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. [//]: # ( @menusnip{digi_xbee_lte_bypass} ) + Depending on your cellular carrier, it is best to select the proper carrier profile and network. Setting these helps the modem to connect to network faster. This is shows in the [SARA R4 Cellular Carrier](@ref setup_r4_carrrier) chunk of the setup function. @@ -350,6 +365,7 @@ To create a DigiXBee3GBypass object we need to know - and the SIM card's cellular access point name (APN). Pins that do not apply should be set as -1. +A helpful table detailing the pins to use with the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. [//]: # ( @menusnip{digi_xbee_3g_bypass} ) @@ -367,6 +383,7 @@ To create a DigiXBeeWifi object we need to know - and the wifi WPA2 password. Pins that do not apply should be set as -1. +A helpful table detailing the pins to use with the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. [//]: # ( @menusnip{digi_xbee_wifi} ) @@ -405,6 +422,7 @@ To create a QuectelBG96 object we need to know Pins that do not apply should be set as -1. [//]: # ( @menusnip{quectel_bg96} ) + If you are interfacing with a Nimbelink Skywire board via the Skywire development board, you also need to handle the fact that the development board reverses the levels of the status, wake, and reset pins. Code to invert the pin levels is in the [Skywire Pin Inversions](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8ino-example.html#enu_walk_setup_skywire) part of the setup function below. @@ -467,6 +485,23 @@ Pins that do not apply should be set as -1. [//]: # ( @menusnip{sim_com_sim7000} ) +### SIMCom SIM7080G (EnviroDIY LTE Bee]) + +This code is for a SIMCom SIM7080G or one of its variants, including the [EnviroDIY LTE Bee](https://www.envirodiy.org/product/envirodiy-lte-bee-pack-of-5/). + +To create a SIMComSIM7080 object we need to know +- the serial object name, +- the MCU pin controlling modem power, +- the MCU pin connected to the `STATUS` pin, +- the MCU pin connected to the `PWRKEY` pin (for sleep request), +- and the SIM card's cellular access point name (APN). + +Pins that do not apply should be set as -1. +A helpful table detailing the pins to use with the EnviroDIY LTE Bee and the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. + +[//]: # ( @menusnip{sim_com_sim7080} ) + + ### Sodaq GPRSBee This code is for the Sodaq 2GBee R6 and R7 based on the SIMCom SIM800. @@ -479,6 +514,7 @@ You should enter this pin as the power pin.) Pins that do not apply should be set as -1. The GPRSBee R6/R7 does not expose the `RESET` pin of the SIM800. The `PWRKEY` is held `LOW` as long as the SIM800 is powered (as mentioned above). +A helpful table detailing the pins to use with the Sodaq GPRSBee and the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. [//]: # ( @menusnip{sodaq_2g_bee_r6} ) @@ -494,8 +530,10 @@ To create a SodaqUBeeR410M object we need to know - and the SIM card's cellular access point name (APN). Pins that do not apply should be set as -1. +A helpful table detailing the pins to use with the UBee R410M and the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. [//]: # ( @menusnip{sodaq_ubee_r410m} ) + Depending on your cellular carrier, it is best to select the proper carrier profile and network. Setting these helps the modem to connect to network faster. This is shows in the [SARA R4 Cellular Carrier](@ref setup_r4_carrrier) chunk of the setup function. @@ -512,6 +550,7 @@ To create a SodaqUBeeU201 object we need to know - and the SIM card's cellular access point name (APN). Pins that do not apply should be set as -1. +A helpful table detailing the pins to use with the Sodaq UBee U201 and the EnviroDIY Mayfly is available on the [Modem Notes](@ref page_modem_notes) page. [//]: # ( @menusnip{sodaq_ubee_u201} ) @@ -685,6 +724,15 @@ Keep in mind that the possible I2C addresses of the BME280 match those of the MS ___ +#### Campbell ClariVUE SDI-12 Turbidity Sensor + +@see @ref sensor_clarivue + +[//]: # ( @menusnip{campbell_clari_vue10} ) + +___ + + ### Campbell OBS3+ Analog Turbidity Sensor This is the code for the Campbell OBS3+. @@ -702,6 +750,15 @@ Note that to access both the high and low range returns, two instances must be c ___ +#### Decagon CTD-10 Conductivity, Temperature, and Depth Sensor + +@see @ref sensor_decagon_ctd + +[//]: # ( @menusnip{decagon_ctd} ) + +___ + + ### Decagon ES2 Conductivity and Temperature Sensor 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. @@ -741,6 +798,24 @@ Because this sensor can have only one I2C address (0x60), it is only possible to ___ +#### In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe + +@see @ref sensor_insitu_rdo + +[//]: # ( @menusnip{in_situ_rdo} ) + +___ + + +#### In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor + +@see @ref sensor_insitu_troll + +[//]: # ( @menusnip{insitu_troll_sdi12a} ) + +___ + + ### Keller RS485/Modbus Water Level Sensors The next two sections are for Keller RS485/Modbus water level sensors. @@ -762,20 +837,20 @@ Both pins _cannot_ be shared pins. @see @ref keller_group -#### Keller Nanolevel Level Transmitter +#### Keller Acculevel High Accuracy Submersible Level Transmitter -@see @ref sensor_nanolevel +@see @ref sensor_acculevel -[//]: # ( @menusnip{keller_nanolevel} ) +[//]: # ( @menusnip{keller_acculevel} ) ___ -#### Keller Acculevel High Accuracy Submersible Level Transmitter +#### Keller Nanolevel Level Transmitter -@see @ref sensor_acculevel +@see @ref sensor_nanolevel -[//]: # ( @menusnip{keller_acculevel} ) +[//]: # ( @menusnip{keller_nanolevel} ) ___ @@ -1225,6 +1300,8 @@ For SoftwareSerial with External interrupts we use: CHANGE); ``` +[//]: # ( @menusnip{setup_softserial} ) + ### Serial Begin Every serial port setup and used in the program must be "begun" in the setup function. @@ -1287,6 +1364,12 @@ This is necessary for the Skywire development board and some other breakouts. [//]: # ( @menusnip{setup_skywire} ) +#### SimCom SIM7080G Network Mode + +This chunk of code sets the network mode and preferred mode for the SIM7080G. + +[//]: # ( @menusnip{setup_sim7080} ) + #### XBee Cellular Carrier This chunk of code sets the carrier profile and network technology for a Digi XBee or XBee3. @@ -1312,6 +1395,7 @@ To be considered "sane" the clock has to set somewhere between 2020 and 2025. It's a broad range, but it will automatically flag values like Jan 1, 2000 - which are the default start value of the clock on power up. [//]: # ( @menusnip{setup_clock} ) + ### Setup File on the SD card We're getting close to the end of the setup function! @@ -1382,8 +1466,6 @@ All together, this gives: [//]: # ( @menusnip{complex_loop} ) -[//]: # ( @todo fix links ) - If you need more help in writing a complex loop, the [double_logger example program](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/double_logger) demonstrates using a custom loop function in order to log two different groups of sensors at different logging intervals. The [data_saving example program](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/data_saving) shows using a custom loop in order to save cellular data by saving data from many variables on the SD card, but only sending a portion of the data to the EnviroDIY data portal. 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 7702a70a9..deaed5248 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1273,7 +1273,7 @@ Variable* mplTemp = new MPL115A2_Temp(&mpl115a2, #if defined BUILD_SENSOR_IN_SITU_RDO // ========================================================================== -// InSitu RDO PRO-X Rugged Dissolved Oxygen Probe +// In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe // ========================================================================== /** Start [in_situ_rdo] */ #include diff --git a/src/sensors/InSituRDO.h b/src/sensors/InSituRDO.h index aca249122..def4f04bf 100644 --- a/src/sensors/InSituRDO.h +++ b/src/sensors/InSituRDO.h @@ -353,7 +353,7 @@ class InSituRDO : public SDI12Sensors { public: // Constructors with overloads /** - * @brief Construct a new InSitu RDO object. + * @brief Construct a new In-Situ RDO 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 @@ -404,7 +404,7 @@ class InSituRDO : public SDI12Sensors { INSITU_RDO_MEASUREMENT_TIME_MS, INSITU_RDO_EXTRA_WAKE_TIME_MS, INSITU_RDO_INC_CALC_VARIABLES) {} /** - * @brief Destroy the InSitu RDO object + * @brief Destroy the In-Situ RDO object */ ~InSituRDO() {} }; From b14ee87eb19656d829079872fada1dd3bda0cf7b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 16:02:11 -0400 Subject: [PATCH 41/94] Case change Signed-off-by: Sara Damiano --- src/sensors/InSituRDO.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sensors/InSituRDO.h b/src/sensors/InSituRDO.h index def4f04bf..628ea0ef3 100644 --- a/src/sensors/InSituRDO.h +++ b/src/sensors/InSituRDO.h @@ -152,8 +152,8 @@ /* clang-format on */ // Header Guards -#ifndef SRC_SENSORS_InSituRDO_H_ -#define SRC_SENSORS_InSituRDO_H_ +#ifndef SRC_SENSORS_INSITURDO_H_ +#define SRC_SENSORS_INSITURDO_H_ // Included Dependencies #include "sensors/SDI12Sensors.h" @@ -592,4 +592,4 @@ class InSituRDO_Pressure : public Variable { ~InSituRDO_Pressure() {} }; /**@}*/ -#endif // SRC_SENSORS_InSituRDO_H_ +#endif // SRC_SENSORS_INSITURDO_H_ From 0fd02e4839b0b708ed2357e978f9112bf32fe6c3 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 16:14:48 -0400 Subject: [PATCH 42/94] Add missing ubidots Signed-off-by: Sara Damiano --- .github/workflows/build_menu.yaml | 5 ++- build-menu-configurations.ps1 | 2 +- examples/menu_a_la_carte/ReadMe.md | 13 ++++++-- examples/menu_a_la_carte/menu_a_la_carte.ino | 35 ++++++++++++++++---- src/sensors/InSituTrollSdi12a.h | 4 +-- 5 files changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 72ef85943..eb4e9a7c6 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -104,7 +104,7 @@ jobs: sensorFlag: BUILD_SENSOR_IN_SITU_RDO publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 - sensorFlag: BUILD_SENSOR_INSITU_TROLL_SDI12A + sensorFlag: BUILD_SENSOR_IN_SITU_TROLL_SDI12A publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_KELLER_ACCULEVEL @@ -187,6 +187,9 @@ jobs: - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: NO_SENSORS publisherFlag: BUILD_PUB_THING_SPEAK_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: NO_SENSORS + publisherFlag: BUILD_PUB_UBIDOTS_PUBLISHER steps: - uses: actions/checkout@v2.4.0 diff --git a/build-menu-configurations.ps1 b/build-menu-configurations.ps1 index eb5e9d0f4..e6a384fcf 100644 --- a/build-menu-configurations.ps1 +++ b/build-menu-configurations.ps1 @@ -87,7 +87,7 @@ $sensorFlags = @(` 'BUILD_SENSOR_EXTERNAL_VOLTAGE', ` 'BUILD_SENSOR_MPL115A2', ` 'BUILD_SENSOR_IN_SITU_RDO', ` - 'BUILD_SENSOR_INSITU_TROLL_SDI12A', ` + 'BUILD_SENSOR_IN_SITU_TROLL_SDI12A', ` 'BUILD_SENSOR_KELLER_ACCULEVEL', ` 'BUILD_SENSOR_KELLER_NANOLEVEL', ` 'BUILD_SENSOR_MAX_BOTIX_SONAR', ` diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index a4ccf439a..87da385c9 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -113,6 +113,7 @@ ___ - [Monitor My Watershed](#monitor-my-watershed) - [DreamHost](#dreamhost) - [ThingSpeak](#thingspeak) + - [Ubidots](#ubidots) - [Extra Working Functions](#extra-working-functions) - [Arduino Setup Function](#arduino-setup-function) - [Starting the Function](#starting-the-function) @@ -807,11 +808,11 @@ ___ ___ -#### In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor +#### In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor @see @ref sensor_insitu_troll -[//]: # ( @menusnip{insitu_troll_sdi12a} ) +[//]: # ( @menusnip{in_situ_troll_sdi12a} ) ___ @@ -1237,6 +1238,14 @@ Keep in mind that the order of variables in the VariableArray is **crucial** whe ___ +#### Ubidots + +Use this to publish data to Ubidots. + +[//]: # ( @menusnip{ubidots_publisher} ) + +___ + ## Extra Working Functions Here we're creating a few extra functions on the global scope. 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 deaed5248..f9f01c784 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1301,11 +1301,11 @@ Variable* rdoO2pp = #endif -#if defined BUILD_SENSOR_INSITU_TROLL_SDI12A +#if defined BUILD_SENSOR_IN_SITU_TROLL_SDI12A // ========================================================================== // In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor // ========================================================================== -/** Start [insitu_troll_sdi12a] */ +/** Start [in_situ_troll_sdi12a] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1321,13 +1321,13 @@ InsituTrollSdi12a insutuTROLL(*TROLLSDI12address, TROLLPower, TROLLData, TROLLNumberReadings); // Create pressure, temperature, and depth variable pointers for the TROLL -Variable* trollPressure = new InsituTrollSdi12a_Pressure( +Variable* trollPressure = new InSituTrollSdi12a_Pressure( &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* trollTemp = new InsituTrollSdi12a_Temp( +Variable* trollTemp = new InSituTrollSdi12a_Temp( &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* trollDepth = new InsituTrollSdi12a_Depth( +Variable* trollDepth = new InSituTrollSdi12a_Depth( &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [insitu_troll_sdi12a] */ +/** End [in_situ_troll_sdi12a] */ #endif @@ -2377,7 +2377,7 @@ Variable* variableList[] = { rdoDOmgL, rdoO2pp, #endif -#if defined BUILD_SENSOR_INSITU_TROLL_SDI12A +#if defined BUILD_SENSOR_IN_SITU_TROLL_SDI12A trollPressure, trollTemp, trollDepth, @@ -2599,6 +2599,27 @@ ThingSpeakPublisher TsMqtt(dataLogger, &modem.gsmClient, thingSpeakMQTTKey, #endif +#if defined BUILD_PUB_UBIDOTS_PUBLISHER +// ========================================================================== +// Ubidots Data Publisher +// ========================================================================== +/** Start [ubidots_publisher] */ +// The authentication token from Ubdots, either the Organization's Integration +// Token (under Users > Organization menu,visible by Admin only) OR the STEM +// User's Device Token (under the specific evice's setup panel). +const char* ubidotsToken = "XXXXXXXXXXXXXXXX"; +// The device API Label from Ubidots, derived from the user-specified device +// name. +const char* ubidotsDeviceID = "######"; + +// Create a data publisher for ThingSpeak +#include +UbidotsPublisher ubidots(dataLogger, &modem.gsmClient, ubidotsToken, + ubidotsDeviceID); +/** End [ubidots_publisher] */ +#endif + + // ========================================================================== // Working Functions // ========================================================================== diff --git a/src/sensors/InSituTrollSdi12a.h b/src/sensors/InSituTrollSdi12a.h index e3985e300..549a7e0a3 100644 --- a/src/sensors/InSituTrollSdi12a.h +++ b/src/sensors/InSituTrollSdi12a.h @@ -66,9 +66,9 @@ * * ___ * @section sensor_insitu_troll_examples Example Code - * The In-Situ TROLL is used in the @menulink{insitu_troll_sdi12a} example. + * The In-Situ TROLL is used in the @menulink{in_situ_troll_sdi12a} example. * - * @menusnip{insitu_troll_sdi12a} + * @menusnip{in_situ_troll_sdi12a} */ /* clang-format on */ From 9e0dddae5b2b4d4d7adf3e699db2968a44361d99 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 16:22:57 -0400 Subject: [PATCH 43/94] Added ci check for docs Signed-off-by: Sara Damiano --- .github/workflows/check_menu_inclusion.yaml | 84 ++++++++ .../check_component_inclusion.py | 189 ++++++++++++++++++ docs/Doxyfile | 2 +- examples/menu_a_la_carte/ReadMe.md | 2 +- 4 files changed, 275 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/check_menu_inclusion.yaml create mode 100644 continuous_integration/check_component_inclusion.py diff --git a/.github/workflows/check_menu_inclusion.yaml b/.github/workflows/check_menu_inclusion.yaml new file mode 100644 index 000000000..f7e54d53d --- /dev/null +++ b/.github/workflows/check_menu_inclusion.yaml @@ -0,0 +1,84 @@ +name: Verify Documentation + +# Triggers the workflow on push or pull request events +on: [push, pull_request] + +env: + DOXYGEN_VERSION: Release_1_9_3 + +jobs: + menu_inclusion: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + + steps: + - uses: actions/checkout@v2.4.0 + + - name: Set up Python + uses: actions/setup-python@v3 + + - name: check for classes in the menu example + run: | + cd $GITHUB_WORKSPACE/continuous_integration + python check_component_inclusion.py + + doc_build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + + steps: + # check out the ModularSensors repo + - uses: actions/checkout@v2.4.0 + with: + path: code_docs/ModularSensors + + - name: Set up Python + uses: actions/setup-python@v3 + + - name: Restore Python Dependencies + uses: actions/cache@v2.1.7 + id: cache_python + with: + path: ~/.cache/pip + key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }} + + - name: Install Pygments and other m.css Python Requirements + if: steps.cache_python.outputs.cache-hit != 'true' + run: | + python -m pip install --upgrade pip + pip3 install --upgrade --upgrade-strategy jinja2 Pygments beautifulsoup4 + + - name: Install GraphViz (dot) + run: sudo apt-get -y install graphviz + + - name: Restore Doxygen + id: cache_doxygen + uses: actions/cache@v2.1.7 + with: + path: doxygen-src + key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }} + + - name: Clone and build doxygen + if: steps.cache_doxygen.outputs.cache-hit != 'true' + env: + TRAVIS_BUILD_DIR: ${{ github.workspace }} + run: | + cd ${{ github.workspace }}/code_docs/ModularSensors/ + chmod +x continuous_integration/build-install-doxygen.sh + sh continuous_integration/build-install-doxygen.sh + + # check out my fork of m.css, for processing Doxygen output + - name: Checkout m.css + uses: actions/checkout@v2.4.0 + with: + # Repository name with owner. For example, actions/checkout + repository: SRGDamia1/m.css + path: code_docs/m.css + + - name: Generate all the documentation + env: + TRAVIS_BUILD_DIR: ${{ github.workspace }} + run: | + cd ${{ github.workspace }}/code_docs/ModularSensors/ + chmod +x continuous_integration/generate-documentation.sh + sh continuous_integration/generate-documentation.sh diff --git a/continuous_integration/check_component_inclusion.py b/continuous_integration/check_component_inclusion.py new file mode 100644 index 000000000..27180b17c --- /dev/null +++ b/continuous_integration/check_component_inclusion.py @@ -0,0 +1,189 @@ +import glob +import re +import sys + +modemHeaderFiles = glob.glob("../src/modems/*.h") +sensorHeaderFiles = glob.glob("../src/sensors/*.h") +publisherHeaderFiles = glob.glob("../src/publishers/*.h") + +header_files = modemHeaderFiles + sensorHeaderFiles + publisherHeaderFiles + +#%% function to find the lowest level class +def find_subclasses(class_name): + subclass_pattern = r"class[\s\n]+(\w+)[\s\n]+:[\s\n]+public[\s\n]+" + re.escape( + class_name + ) + + subclass_list = [] + num_subclasses = 0 + for sensor_header in header_files: + textfile = open(sensor_header, mode="r", encoding="utf-8") + filetext = textfile.read() + textfile.close() + matches = re.findall(subclass_pattern, filetext) + if matches != []: + for subclass in matches: + num_subclasses += 1 + # print(sensor_header, class_name, subclass, num_subclasses) + sub_subs = find_subclasses(subclass) + for sub in sub_subs: + subclass_list.append(sub) + if num_subclasses == 0 and class_name not in subclass_list: + subclass_list.append(class_name) + return subclass_list + + +def camel_to_snake(name, lower_case=True): + name1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", name) + name_lower = ( + re.sub("([a-z0-9])([A-Z])", r"\1_\2", name1) + .lower() + .replace("5_tm", "_5tm") + .replace("tiina", "ti_ina") + .replace("p_h", "_ph") + .replace("mpl115_a2", "mpl115a2") + .replace("i2_c", "i2c") + .replace("2_g_", "_2g_") + .replace("x_bee", "_xbee") + .replace("u_bee", "_ubee") + .replace("3_g_", "_3g_") + .replace("r410_m", "r410m") + .replace("__", "_") + ) + if lower_case: + return name_lower + else: + return name_lower.upper() + + +must_doc_classes = [] + +modem_sub_classes = find_subclasses("loggerModem") +modem_sub_classes.append("SIMComSIM800") +modem_sub_classes.sort() +for modem_sub_class in modem_sub_classes: + must_doc_classes.append( + { + "super_class": "loggerModem", + "class_name": modem_sub_class, + "build_flag": "BUILD_MODEM_{}".format( + camel_to_snake(modem_sub_class, False) + ), + "menu_snip": camel_to_snake(modem_sub_class), + } + ) + +sensor_sub_classes = find_subclasses("Sensor") +sensor_sub_classes.sort() +for sensor_sub_class in sensor_sub_classes: + must_doc_classes.append( + { + "super_class": "Sensor", + "class_name": sensor_sub_class, + "build_flag": "BUILD_SENSOR_{}".format( + camel_to_snake(sensor_sub_class, False) + ), + "menu_snip": camel_to_snake(sensor_sub_class), + } + ) +var_sub_classes = find_subclasses("Variable") +var_sub_classes.sort() +for var_sub_class in var_sub_classes: + must_doc_classes.append( + {"super_class": "Variable", "class_name": var_sub_class,} + ) + +publisher_sub_classes = find_subclasses("dataPublisher") +publisher_sub_classes.sort() +for publisher_sub_class in publisher_sub_classes: + must_doc_classes.append( + { + "super_class": "dataPublisher", + "class_name": publisher_sub_class, + "build_flag": "BUILD_PUB_{}".format( + camel_to_snake(publisher_sub_class, False) + ), + "menu_snip": camel_to_snake(publisher_sub_class), + } + ) + +# print(must_doc_classes) +#%% +menu_example_file = open( + "../examples/menu_a_la_carte\\menu_a_la_carte.ino", mode="r", encoding="utf-8" +) +menu_example_code = menu_example_file.read() +menu_example_file.close() +menu_walk_file = open( + "../examples/menu_a_la_carte\\ReadMe.md", mode="r", encoding="utf-8" +) +menu_example_walk = menu_walk_file.read() +menu_walk_file.close() + +missing_classes = [] +missing_build_flags = [] +missing_snips = [] +missing_walks = [] +for must_doc_class in must_doc_classes: + # print(must_doc_class["class_name"]) + matches = re.findall(must_doc_class["class_name"], menu_example_code) + if len(matches) == 0: + print("\t{} MISSING".format(must_doc_class["class_name"])) + missing_classes.append(must_doc_class["class_name"]) + if "build_flag" in must_doc_class.keys(): + matches = re.findall(must_doc_class["build_flag"], menu_example_code) + if ( + len(matches) == 0 + or (must_doc_class["super_class"] == "Sensor" and len(matches) < 2) + ) and (must_doc_class["class_name"] not in ["MaximDS3231", "ProcessorStats"]): + print("\t{}".format(must_doc_class["build_flag"])) + missing_build_flags.append(must_doc_class["class_name"]) + if "menu_snip" in must_doc_class.keys(): + start_pattern = ( + r"((?:Start)|(?:End))\s+\[(" + + re.escape(must_doc_class["menu_snip"]) + + r")\]" + ) + matches = re.findall(start_pattern, menu_example_code) + if len(matches) < 2: + print("\t{}".format(must_doc_class["menu_snip"])) + missing_snips.append(must_doc_class["class_name"]) + + snip_pattern = r"@menusnip\{(" + re.escape(must_doc_class["menu_snip"]) + r")\}" + matches = re.findall(snip_pattern, menu_example_walk) + if len(matches) == 0: + print("\t@menusnip{{{}}}".format(must_doc_class["menu_snip"])) + missing_walks.append(must_doc_class["class_name"]) + +print("The following classes are not included at all in the menu example:") +print(missing_classes) +print("The following expected build flags are missing from the menu example:") +print(missing_build_flags) +print("The following expected snipped flags are missing from the menu example:") +print(missing_snips) +print( + "The following expected snipped flags are missing from the menu walkthrough/ReadMe:" +) +print(missing_walks) + +menu_declared_snips = list( + dict.fromkeys(re.findall(r"(?:(?:Start)|(?:End)) \[(\w+)\]", menu_example_code)) +) + +missing_walks = [] +for snip in menu_declared_snips: + snip_pattern = r"@menusnip\{(" + re.escape(snip) + r")\}" + expl_snip = re.findall(snip_pattern, menu_example_walk) + if len(expl_snip) == 0: + print(snip_pattern) + missing_walks.append(snip) +print( + "The following expected snipped flags are missing from the menu walkthrough/ReadMe:" +) +print(missing_walks) + +# %% +if len(missing_classes + missing_walks) > 0: + sys.exit( + "Some classes are not properly documented in the Menu-a-la-carte example and its walkthrough." + ) diff --git a/docs/Doxyfile b/docs/Doxyfile index ec46340dc..c44202eb6 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -861,7 +861,7 @@ WARN_NO_PARAMDOC = YES # Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. -WARN_AS_ERROR = NO +WARN_AS_ERROR = FAIL_ON_WARNINGS # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 87da385c9..ee1897533 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -486,7 +486,7 @@ Pins that do not apply should be set as -1. [//]: # ( @menusnip{sim_com_sim7000} ) -### SIMCom SIM7080G (EnviroDIY LTE Bee]) +### SIMCom SIM7080G (EnviroDIY LTE Bee]) This code is for a SIMCom SIM7080G or one of its variants, including the [EnviroDIY LTE Bee](https://www.envirodiy.org/product/envirodiy-lte-bee-pack-of-5/). From edf6bc3ae51f8b0be5250a35770022ddd2f44f19 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 16:45:57 -0400 Subject: [PATCH 44/94] Path error Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 2 +- .../{check_menu_inclusion.yaml => check_documentation.yaml} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{check_menu_inclusion.yaml => check_documentation.yaml} (96%) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index e720f4e70..337f43d68 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -36,7 +36,7 @@ jobs: if: steps.cache_python.outputs.cache-hit != 'true' run: | python -m pip install --upgrade pip - pip3 install --upgrade --upgrade-strategy jinja2 Pygments beautifulsoup4 + pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 - name: Install GraphViz (dot) run: sudo apt-get -y install graphviz diff --git a/.github/workflows/check_menu_inclusion.yaml b/.github/workflows/check_documentation.yaml similarity index 96% rename from .github/workflows/check_menu_inclusion.yaml rename to .github/workflows/check_documentation.yaml index f7e54d53d..ce1f04e9c 100644 --- a/.github/workflows/check_menu_inclusion.yaml +++ b/.github/workflows/check_documentation.yaml @@ -46,7 +46,7 @@ jobs: if: steps.cache_python.outputs.cache-hit != 'true' run: | python -m pip install --upgrade pip - pip3 install --upgrade --upgrade-strategy jinja2 Pygments beautifulsoup4 + pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 - name: Install GraphViz (dot) run: sudo apt-get -y install graphviz From 6ba44e9386916410b0f0bd6c961fcdbf0033ec0b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 16:46:46 -0400 Subject: [PATCH 45/94] path error Signed-off-by: Sara Damiano --- continuous_integration/check_component_inclusion.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/continuous_integration/check_component_inclusion.py b/continuous_integration/check_component_inclusion.py index 27180b17c..541ab71f4 100644 --- a/continuous_integration/check_component_inclusion.py +++ b/continuous_integration/check_component_inclusion.py @@ -110,12 +110,12 @@ def camel_to_snake(name, lower_case=True): # print(must_doc_classes) #%% menu_example_file = open( - "../examples/menu_a_la_carte\\menu_a_la_carte.ino", mode="r", encoding="utf-8" + "..\\examples\\menu_a_la_carte\\menu_a_la_carte.ino", mode="r", encoding="utf-8" ) menu_example_code = menu_example_file.read() menu_example_file.close() menu_walk_file = open( - "../examples/menu_a_la_carte\\ReadMe.md", mode="r", encoding="utf-8" + "..\\examples\\menu_a_la_carte\\ReadMe.md", mode="r", encoding="utf-8" ) menu_example_walk = menu_walk_file.read() menu_walk_file.close() From b9c21fc2dd22f2c9588688ac59dcde79ec893915 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 17:58:32 -0400 Subject: [PATCH 46/94] Fix TROLL case again Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/menu_a_la_carte.ino | 8 ++++---- 1 file changed, 4 insertions(+), 4 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 f9f01c784..74e38d905 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1317,16 +1317,16 @@ const int8_t TROLLData = 7; // The SDI-12 data pin const uint8_t TROLLNumberReadings = 2; // The number of readings to average // Create an In-Situ TROLL sensor object -InsituTrollSdi12a insutuTROLL(*TROLLSDI12address, TROLLPower, TROLLData, +InSituTrollSdi12a insituTROLL(*TROLLSDI12address, TROLLPower, TROLLData, TROLLNumberReadings); // Create pressure, temperature, and depth variable pointers for the TROLL Variable* trollPressure = new InSituTrollSdi12a_Pressure( - &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); + &insituTROLL, "12345678-abcd-1234-ef00-1234567890ab"); Variable* trollTemp = new InSituTrollSdi12a_Temp( - &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); + &insituTROLL, "12345678-abcd-1234-ef00-1234567890ab"); Variable* trollDepth = new InSituTrollSdi12a_Depth( - &insutuTROLL, "12345678-abcd-1234-ef00-1234567890ab"); + &insituTROLL, "12345678-abcd-1234-ef00-1234567890ab"); /** End [in_situ_troll_sdi12a] */ #endif From 8ec7d5a199825730dd04881c69a53bd6afd01bcc Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 17:58:46 -0400 Subject: [PATCH 47/94] another path fix Signed-off-by: Sara Damiano --- .../workflows/verify_library_structure.yaml | 2 +- .../check_component_inclusion.py | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/verify_library_structure.yaml b/.github/workflows/verify_library_structure.yaml index 2b0b6cbf2..edae3e2a2 100644 --- a/.github/workflows/verify_library_structure.yaml +++ b/.github/workflows/verify_library_structure.yaml @@ -28,6 +28,6 @@ jobs: uses: arduino/arduino-lint-action@v1 with: project-type: library - library-manager: update + library-manager: submit compliance: strict verbose: true diff --git a/continuous_integration/check_component_inclusion.py b/continuous_integration/check_component_inclusion.py index 541ab71f4..e8b9abe09 100644 --- a/continuous_integration/check_component_inclusion.py +++ b/continuous_integration/check_component_inclusion.py @@ -1,12 +1,17 @@ +#%% import glob import re import sys +import os + +script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in -modemHeaderFiles = glob.glob("../src/modems/*.h") -sensorHeaderFiles = glob.glob("../src/sensors/*.h") -publisherHeaderFiles = glob.glob("../src/publishers/*.h") +modemHeaderFiles = glob.glob(os.path.join(script_dir, "../src/modems/*.h")) +sensorHeaderFiles = glob.glob(os.path.join(script_dir, "../src/sensors/*.h")) +publisherHeaderFiles = glob.glob(os.path.join(script_dir, "../src/publishers/*.h")) header_files = modemHeaderFiles + sensorHeaderFiles + publisherHeaderFiles +print(header_files) #%% function to find the lowest level class def find_subclasses(class_name): @@ -110,12 +115,16 @@ def camel_to_snake(name, lower_case=True): # print(must_doc_classes) #%% menu_example_file = open( - "..\\examples\\menu_a_la_carte\\menu_a_la_carte.ino", mode="r", encoding="utf-8" + os.path.join(script_dir, "..\\examples\\menu_a_la_carte\\menu_a_la_carte.ino"), + mode="r", + encoding="utf-8", ) menu_example_code = menu_example_file.read() menu_example_file.close() menu_walk_file = open( - "..\\examples\\menu_a_la_carte\\ReadMe.md", mode="r", encoding="utf-8" + os.path.join(script_dir, "..\\examples\\menu_a_la_carte\\ReadMe.md"), + mode="r", + encoding="utf-8", ) menu_example_walk = menu_walk_file.read() menu_walk_file.close() From 1e0229bcf593133c605989e0deb71bc7f9970d7b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 17 Mar 2022 18:01:17 -0400 Subject: [PATCH 48/94] fix working directory Signed-off-by: Sara Damiano --- continuous_integration/generate-documentation.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/continuous_integration/generate-documentation.sh b/continuous_integration/generate-documentation.sh index 6a6b2d995..38c3b6a99 100644 --- a/continuous_integration/generate-documentation.sh +++ b/continuous_integration/generate-documentation.sh @@ -16,8 +16,9 @@ python $TRAVIS_BUILD_DIR/code_docs/m.css/css/postprocess.py "m-EnviroDIY.css" "m python $TRAVIS_BUILD_DIR/code_docs/m.css/css/postprocess.py "m-EnviroDIY.css" "m-theme-EnviroDIY.css" "m-documentation.css" --no-import -o "m-EnviroDIY.documentation.compiled.css" cp $TRAVIS_BUILD_DIR/code_docs/m.css/css/EnviroDIY/m-EnviroDIY+documentation.compiled.css $TRAVIS_BUILD_DIR/code_docs/ModularSensors/docs/css +cd $TRAVIS_BUILD_DIR/code_docs/ModularSensors/docs + # echo "\n\e[32mCreating dox files from example read-me files\e[0m" -# cd $TRAVIS_BUILD_DIR/code_docs/ModularSensors/docs # python documentExamples.py echo "\n\e[32mCurrent Doxygen version...\e[0m" From 5c771d0539abb730398f83e609a36786c2333bd6 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 18 Mar 2022 12:03:12 -0400 Subject: [PATCH 49/94] Add vars to example Signed-off-by: Sara Damiano --- examples/menu_a_la_carte/menu_a_la_carte.ino | 4 ++++ src/sensors/SensirionSHT4x.h | 4 ++-- 2 files changed, 6 insertions(+), 2 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 79330ea30..18f8b103a 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -2448,6 +2448,10 @@ Variable* variableList[] = { tbi2cTips, tbi2cDepth, #endif +#if defined BUILD_SENSOR_SENSIRION_SHT4X + sht4xHumid, + sht4xTemp, +#endif #if defined BUILD_SENSOR_TALLY_COUNTER_I2C tallyEvents, #endif diff --git a/src/sensors/SensirionSHT4x.h b/src/sensors/SensirionSHT4x.h index 201439e98..eb63ec358 100644 --- a/src/sensors/SensirionSHT4x.h +++ b/src/sensors/SensirionSHT4x.h @@ -65,9 +65,9 @@ #define SRC_SENSORS_SENSIRIONSHT4X_H_ // Debugging Statement -// #define MS_SENSIRIONSHT4X_DEBUG +// #define MS_SENSIRION_SHT4X_DEBUG -#ifdef MS_SENSIRIONSHT4X_DEBUG +#ifdef MS_SENSIRION_SHT4X_DEBUG #define MS_DEBUGGING_STD "SensirionSHT4x" #endif From 6687b69c2a80c5e0c0328808ee796c1d1078464c Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 18 Mar 2022 12:08:22 -0400 Subject: [PATCH 50/94] Rename MPL115A2 to FreescaleMPL115A2 Signed-off-by: Sara Damiano --- ChangeLog.md | 3 + .../check_component_inclusion.py | 36 ++++++- examples/menu_a_la_carte/menu_a_la_carte.ino | 12 +-- src/sensors/FreescaleMPL115A2.cpp | 31 +++--- src/sensors/FreescaleMPL115A2.h | 95 +++++++++++-------- 5 files changed, 111 insertions(+), 66 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index 11ee7e98d..f1de0cde4 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -33,6 +33,9 @@ We recommend a logger's real time clock always be set in UTC and then localized - Added a longer warm up time and removed some of the set-up to work with the ESP-IDF AT firmware versions >2.0 - Made sure that all example clock synchronization happens at noon instead of midnight. - **Documentation:** Migrated to latest version of Doxygen (1.9.3). +- Renamed class "MPL115A2" to "FreescaleMPL115A2" and all related variable classes. +This is for consistency with the file name and other classes with manufacturer in the name. +This is *not* a breaking change at this time; the old class names are still usable. ### Added - **Sensor** Added support for the [YosemiTech Y551 COD Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/94.html), which makes a UV254 light absorption and translates it to estimates of Chemical Oxygen Demand (COD) (or Total Organic Carbon (TOC)) and Turbidity. diff --git a/continuous_integration/check_component_inclusion.py b/continuous_integration/check_component_inclusion.py index e8b9abe09..394c88658 100644 --- a/continuous_integration/check_component_inclusion.py +++ b/continuous_integration/check_component_inclusion.py @@ -3,6 +3,7 @@ import re import sys import os +from pathlib import Path script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in @@ -11,7 +12,7 @@ publisherHeaderFiles = glob.glob(os.path.join(script_dir, "../src/publishers/*.h")) header_files = modemHeaderFiles + sensorHeaderFiles + publisherHeaderFiles -print(header_files) +# print(header_files) #%% function to find the lowest level class def find_subclasses(class_name): @@ -21,8 +22,8 @@ def find_subclasses(class_name): subclass_list = [] num_subclasses = 0 - for sensor_header in header_files: - textfile = open(sensor_header, mode="r", encoding="utf-8") + for header_file in header_files: + textfile = open(header_file, mode="r", encoding="utf-8") filetext = textfile.read() textfile.close() matches = re.findall(subclass_pattern, filetext) @@ -61,6 +62,31 @@ def camel_to_snake(name, lower_case=True): return name_lower.upper() +#%% +# make sure class names match file names +class_pattern = re.compile("^\s*class[\s\n]+(\w+)[\s\n]", re.MULTILINE) + +for header_file in header_files: + textfile = open(header_file, mode="r", encoding="utf-8") + filetext = textfile.read() + textfile.close() + file_name = Path(os.path.basename(header_file)).stem + class_matches = re.findall(class_pattern, filetext) + for class_match in class_matches: + if not class_match.startswith(file_name): + print( + "Class {} is defined in file {}. Class names should match their file names".format( + class_match, file_name + ) + ) + # sys.exit( + # "Class {} is defined in file {}. Class names should match their file names".format( + # class_match, file_name + # ) + # ) + +#%% +# make sure there are examples of all classes in the menu example must_doc_classes = [] modem_sub_classes = find_subclasses("loggerModem") @@ -115,14 +141,14 @@ def camel_to_snake(name, lower_case=True): # print(must_doc_classes) #%% menu_example_file = open( - os.path.join(script_dir, "..\\examples\\menu_a_la_carte\\menu_a_la_carte.ino"), + os.path.join(script_dir, "../examples/menu_a_la_carte/menu_a_la_carte.ino"), mode="r", encoding="utf-8", ) menu_example_code = menu_example_file.read() menu_example_file.close() menu_walk_file = open( - os.path.join(script_dir, "..\\examples\\menu_a_la_carte\\ReadMe.md"), + os.path.join(script_dir, "../examples/menu_a_la_carte/ReadMe.md"), mode="r", encoding="utf-8", ) 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 74e38d905..4436dfcf6 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1259,14 +1259,14 @@ Variable* extvoltV = const int8_t MPLPower = sensorPowerPin; // Power pin const uint8_t MPL115A2ReadingsToAvg = 1; -// Create an MPL115A2 barometer sensor object -MPL115A2 mpl115a2(MPLPower, MPL115A2ReadingsToAvg); +// Create a FreescaleMPL115A2 barometer sensor object +FreescaleMPL115A2 mpl115a2(MPLPower, MPL115A2ReadingsToAvg); // Create pressure and temperature variable pointers for the MPL -Variable* mplPress = - new MPL115A2_Pressure(&mpl115a2, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* mplTemp = new MPL115A2_Temp(&mpl115a2, - "12345678-abcd-1234-ef00-1234567890ab"); +Variable* mplPress = new FreescaleMPL115A2_Pressure( + &mpl115a2, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* mplTemp = new FreescaleMPL115A2_Temp( + &mpl115a2, "12345678-abcd-1234-ef00-1234567890ab"); /** End [mpl115a2] */ #endif diff --git a/src/sensors/FreescaleMPL115A2.cpp b/src/sensors/FreescaleMPL115A2.cpp index 5d251e9d2..21a31a8e4 100644 --- a/src/sensors/FreescaleMPL115A2.cpp +++ b/src/sensors/FreescaleMPL115A2.cpp @@ -5,7 +5,7 @@ * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * - * @brief Implements the MPL115A2 class. + * @brief Implements the FreescaleMPL115A2 class. */ #include "FreescaleMPL115A2.h" @@ -13,29 +13,32 @@ // The constructor - because this is I2C, only need the power pin // This sensor has a set I2C address of 0x60. -MPL115A2::MPL115A2(TwoWire* theI2C, int8_t powerPin, - uint8_t measurementsToAverage) - : Sensor("MPL115A2", MPL115A2_NUM_VARIABLES, MPL115A2_WARM_UP_TIME_MS, - MPL115A2_STABILIZATION_TIME_MS, MPL115A2_MEASUREMENT_TIME_MS, - powerPin, -1, measurementsToAverage) { +FreescaleMPL115A2::FreescaleMPL115A2(TwoWire* theI2C, int8_t powerPin, + uint8_t measurementsToAverage) + : Sensor("FreescaleMPL115A2", MPL115A2_NUM_VARIABLES, + MPL115A2_WARM_UP_TIME_MS, MPL115A2_STABILIZATION_TIME_MS, + MPL115A2_MEASUREMENT_TIME_MS, powerPin, -1, + measurementsToAverage) { _i2c = theI2C; } -MPL115A2::MPL115A2(int8_t powerPin, uint8_t measurementsToAverage) - : Sensor("MPL115A2", MPL115A2_NUM_VARIABLES, MPL115A2_WARM_UP_TIME_MS, - MPL115A2_STABILIZATION_TIME_MS, MPL115A2_MEASUREMENT_TIME_MS, - powerPin, -1, measurementsToAverage, MPL115A2_INC_CALC_VARIABLES) { +FreescaleMPL115A2::FreescaleMPL115A2(int8_t powerPin, + uint8_t measurementsToAverage) + : Sensor("FreescaleMPL115A2", MPL115A2_NUM_VARIABLES, + MPL115A2_WARM_UP_TIME_MS, MPL115A2_STABILIZATION_TIME_MS, + MPL115A2_MEASUREMENT_TIME_MS, powerPin, -1, measurementsToAverage, + MPL115A2_INC_CALC_VARIABLES) { _i2c = &Wire; } // Destructor -MPL115A2::~MPL115A2() {} +FreescaleMPL115A2::~FreescaleMPL115A2() {} -String MPL115A2::getSensorLocation(void) { +String FreescaleMPL115A2::getSensorLocation(void) { return F("I2C_0x60"); } -bool MPL115A2::setup(void) { +bool FreescaleMPL115A2::setup(void) { bool retVal = Sensor::setup(); // this will set pin modes and the setup status bit @@ -57,7 +60,7 @@ bool MPL115A2::setup(void) { } -bool MPL115A2::addSingleMeasurementResult(void) { +bool FreescaleMPL115A2::addSingleMeasurementResult(void) { // Initialize float variables float temp = -9999; float press = -9999; diff --git a/src/sensors/FreescaleMPL115A2.h b/src/sensors/FreescaleMPL115A2.h index 6471a931b..14fa80115 100644 --- a/src/sensors/FreescaleMPL115A2.h +++ b/src/sensors/FreescaleMPL115A2.h @@ -5,8 +5,8 @@ * @author Written By: Bobby Schulz * Edited by Sara Geleskie Damiano * - * @brief Contains the MPL115A2 sensor subclass and the variable subclasses - * MPL115A2_Temp and MPL115A2_Pressure. + * @brief Contains the FreescaleMPL115A2 sensor subclass and the variable + * subclasses FreescaleMPL115A2_Temp and FreescaleMPL115A2_Pressure. * * These are used for the Freescale Semiconductor MPL115A2 Miniature I2C Digital * Barometer. @@ -46,8 +46,8 @@ * https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Freescale-Semiconductor-MPL115A2.pdf) * * @section sensor_mpl115a2_ctor Sensor Constructors - * {{ @ref MPL115A2::MPL115A2(int8_t, uint8_t) }} - * {{ @ref MPL115A2::MPL115A2(TwoWire*, int8_t, uint8_t) }} + * {{ @ref FreescaleMPL115A2::FreescaleMPL115A2(int8_t, uint8_t) }} + * {{ @ref FreescaleMPL115A2::FreescaleMPL115A2(TwoWire*, int8_t, uint8_t) }} * * ___ * @section sensor_mpl115a2_examples Example Code @@ -108,7 +108,7 @@ * - Range is -20°C to 85°C * - Accuracy is not specified on the sensor datasheet * - * {{ @ref MPL115A2_Temp::MPL115A2_Temp }} + * {{ @ref FreescaleMPL115A2_Temp::FreescaleMPL115A2_Temp }} */ /**@{*/ /// @brief Decimals places in string representation; temperature should have 2 - @@ -124,8 +124,8 @@ /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); /// "degreeCelsius" (°C) #define MPL115A2_TEMP_UNIT_NAME "degreeCelsius" -/// @brief Default variable short code; "MPL115A2_Temp" -#define MPL115A2_TEMP_DEFAULT_CODE "MPL115A2_Temp" +/// @brief Default variable short code; "FreescaleMPL115A2_Temp" +#define MPL115A2_TEMP_DEFAULT_CODE "FreescaleMPL115A2_Temp" /**@}*/ /** @@ -135,7 +135,7 @@ * - Range is 500-1150 hPa * - Accuracy ±10 hPa * - * {{ @ref MPL115A2_Pressure::MPL115A2_Pressure }} + * {{ @ref FreescaleMPL115A2_Pressure::FreescaleMPL115A2_Pressure }} */ /**@{*/ /// @brief Decimals places in string representation; pressure should have 2 - @@ -151,8 +151,8 @@ /// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); /// "kilopascal" (kPa) #define MPL115A2_PRESSURE_UNIT_NAME "kilopascal" -/// @brief Default variable short code; "MPL115A2_Pressure" -#define MPL115A2_PRESSURE_DEFAULT_CODE "MPL115A2_Pressure" +/// @brief Default variable short code; "FreescaleMPL115A2_Pressure" +#define MPL115A2_PRESSURE_DEFAULT_CODE "FreescaleMPL115A2_Pressure" /**@}*/ @@ -164,10 +164,10 @@ * @ingroup sensor_mpl115a2 */ /* clang-format on */ -class MPL115A2 : public Sensor { +class FreescaleMPL115A2 : public Sensor { public: /** - * @brief Construct a new MPL115A2 using a secondary *hardware* I2C + * @brief Construct a new FreescaleMPL115A2 using a secondary *hardware* I2C * instance. * * @note It is only possible to connect *one* MPL115A2 at a time on a single @@ -185,10 +185,11 @@ class MPL115A2 : public Sensor { * average before giving a "final" result from the sensor; optional with a * default value of 1. */ - MPL115A2(TwoWire* theI2C, int8_t powerPin, - uint8_t measurementsToAverage = 1); + FreescaleMPL115A2(TwoWire* theI2C, int8_t powerPin, + uint8_t measurementsToAverage = 1); /** - * @brief Construct a new MPL115A2 using the primary hardware I2C instance. + * @brief Construct a new FreescaleMPL115A2 using the primary hardware I2C + * instance. * * @note It is only possible to connect *one* MPL115A2 at a time on a single * I2C bus. Software I2C is also not supported. @@ -200,11 +201,12 @@ class MPL115A2 : public Sensor { * average before giving a "final" result from the sensor; optional with a * default value of 1. */ - explicit MPL115A2(int8_t powerPin, uint8_t measurementsToAverage = 1); + explicit FreescaleMPL115A2(int8_t powerPin, + uint8_t measurementsToAverage = 1); /** - * @brief Destroy the MPL115A2 object + * @brief Destroy the FreescaleMPL115A2 object */ - ~MPL115A2(); + ~FreescaleMPL115A2(); /** * @brief Do any one-time preparations needed before the sensor will be able @@ -230,7 +232,7 @@ class MPL115A2 : public Sensor { private: /** - * @brief Private reference to the internal MPL115A2 object. + * @brief Private reference to the internal Adafruit_MPL115A2 object. */ Adafruit_MPL115A2 mpl115a2_internal; /** @@ -249,35 +251,38 @@ class MPL115A2 : public Sensor { * @ingroup sensor_mpl115a2 */ /* clang-format on */ -class MPL115A2_Temp : public Variable { +class FreescaleMPL115A2_Temp : public Variable { public: /** - * @brief Construct a new MPL115A2_Temp object. + * @brief Construct a new FreescaleMPL115A2_Temp object. * - * @param parentSense The parent MPL115A2 providing the result values. + * @param parentSense The parent FreescaleMPL115A2 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 "MPL115A2_Temp". + * optional with a default value of "FreescaleMPL115A2_Temp". */ - explicit MPL115A2_Temp(MPL115A2* parentSense, const char* uuid = "", - const char* varCode = MPL115A2_TEMP_DEFAULT_CODE) + explicit FreescaleMPL115A2_Temp( + FreescaleMPL115A2* parentSense, const char* uuid = "", + const char* varCode = MPL115A2_TEMP_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)MPL115A2_TEMP_VAR_NUM, (uint8_t)MPL115A2_TEMP_RESOLUTION, MPL115A2_TEMP_VAR_NAME, MPL115A2_TEMP_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new MPL115A2_Temp object. + * @brief Construct a new FreescaleMPL115A2_Temp object. * - * @note This must be tied with a parent MPL115A2 before it can be used. + * @note This must be tied with a parent FreescaleMPL115A2 before it can be + * used. */ - MPL115A2_Temp() + FreescaleMPL115A2_Temp() : Variable((const uint8_t)MPL115A2_TEMP_VAR_NUM, (uint8_t)MPL115A2_TEMP_RESOLUTION, MPL115A2_TEMP_VAR_NAME, MPL115A2_TEMP_UNIT_NAME, MPL115A2_TEMP_DEFAULT_CODE) {} /** - * @brief Destroy the MPL115A2_Temp object - no action needed. + * @brief Destroy the FreescaleMPL115A2_Temp object - no action needed. */ - ~MPL115A2_Temp() {} + ~FreescaleMPL115A2_Temp() {} }; @@ -290,38 +295,46 @@ class MPL115A2_Temp : public Variable { * @ingroup sensor_mpl115a2 */ /* clang-format on */ -class MPL115A2_Pressure : public Variable { +class FreescaleMPL115A2_Pressure : public Variable { public: /** - * @brief Construct a new MPL115A2_Pressure object. + * @brief Construct a new FreescaleMPL115A2_Pressure object. * - * @param parentSense The parent MPL115A2 providing the result values. + * @param parentSense The parent FreescaleMPL115A2 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 "MPL115A2_Pressure". + * optional with a default value of "FreescaleMPL115A2_Pressure". */ - explicit MPL115A2_Pressure( - MPL115A2* parentSense, const char* uuid = "", + explicit FreescaleMPL115A2_Pressure( + FreescaleMPL115A2* parentSense, const char* uuid = "", const char* varCode = MPL115A2_PRESSURE_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)MPL115A2_PRESSURE_VAR_NUM, (uint8_t)MPL115A2_PRESSURE_RESOLUTION, MPL115A2_PRESSURE_VAR_NAME, MPL115A2_PRESSURE_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new MPL115A2_Pressure object. + * @brief Construct a new FreescaleMPL115A2_Pressure object. * - * @note This must be tied with a parent MPL115A2 before it can be used. + * @note This must be tied with a parent FreescaleMPL115A2 before it can be + * used. */ - MPL115A2_Pressure() + FreescaleMPL115A2_Pressure() : Variable((const uint8_t)MPL115A2_PRESSURE_VAR_NUM, (uint8_t)MPL115A2_PRESSURE_RESOLUTION, MPL115A2_PRESSURE_VAR_NAME, MPL115A2_PRESSURE_UNIT_NAME, MPL115A2_PRESSURE_DEFAULT_CODE) {} /** - * @brief Destroy the MPL115A2_Pressure object - no action needed. + * @brief Destroy the FreescaleMPL115A2_Pressure object - no action needed. */ - ~MPL115A2_Pressure() {} + ~FreescaleMPL115A2_Pressure() {} }; /**@}*/ + +// typedefs for backwards compatibility +typedef FreescaleMPL115A2 MPL115A2; +typedef FreescaleMPL115A2_Pressure MPL115A2_Pressure; +typedef FreescaleMPL115A2_Temp MPL115A2_Temp; + #endif // SRC_SENSORS_FREESCALEMPL115A2_H_ From b099a44f49643f706db95772f81b916f8272cd4b Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 18 Mar 2022 12:20:23 -0400 Subject: [PATCH 51/94] Rename associated fixes Signed-off-by: Sara Damiano --- .github/workflows/build_menu.yaml | 2 +- build-menu-configurations.ps1 | 2 +- .../check_component_inclusion.py | 57 +++++++------------ examples/menu_a_la_carte/ReadMe.md | 2 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 8 +-- src/sensors/FreescaleMPL115A2.h | 2 +- 6 files changed, 30 insertions(+), 43 deletions(-) diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index eb4e9a7c6..7fd288cca 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -98,7 +98,7 @@ jobs: sensorFlag: BUILD_SENSOR_EXTERNAL_VOLTAGE publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 - sensorFlag: BUILD_SENSOR_MPL115A2 + sensorFlag: BUILD_SENSOR_FREESCALE_MPL115A2 publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_IN_SITU_RDO diff --git a/build-menu-configurations.ps1 b/build-menu-configurations.ps1 index e6a384fcf..a6497cffa 100644 --- a/build-menu-configurations.ps1 +++ b/build-menu-configurations.ps1 @@ -85,7 +85,7 @@ $sensorFlags = @(` 'BUILD_SENSOR_CAMPBELL_OBS3', ` 'BUILD_SENSOR_DECAGON_ES2', ` 'BUILD_SENSOR_EXTERNAL_VOLTAGE', ` - 'BUILD_SENSOR_MPL115A2', ` + 'BUILD_SENSOR_FREESCALE_MPL115A2', ` 'BUILD_SENSOR_IN_SITU_RDO', ` 'BUILD_SENSOR_IN_SITU_TROLL_SDI12A', ` 'BUILD_SENSOR_KELLER_ACCULEVEL', ` diff --git a/continuous_integration/check_component_inclusion.py b/continuous_integration/check_component_inclusion.py index 394c88658..b026ee407 100644 --- a/continuous_integration/check_component_inclusion.py +++ b/continuous_integration/check_component_inclusion.py @@ -74,16 +74,16 @@ def camel_to_snake(name, lower_case=True): class_matches = re.findall(class_pattern, filetext) for class_match in class_matches: if not class_match.startswith(file_name): - print( - "Class {} is defined in file {}. Class names should match their file names".format( - class_match, file_name - ) - ) - # sys.exit( + # print( # "Class {} is defined in file {}. Class names should match their file names".format( # class_match, file_name # ) # ) + sys.exit( + "Class {} is defined in file {}. Class names should match their file names".format( + class_match, file_name + ) + ) #%% # make sure there are examples of all classes in the menu example @@ -185,39 +185,26 @@ def camel_to_snake(name, lower_case=True): missing_snips.append(must_doc_class["class_name"]) snip_pattern = r"@menusnip\{(" + re.escape(must_doc_class["menu_snip"]) + r")\}" - matches = re.findall(snip_pattern, menu_example_walk) - if len(matches) == 0: + expl_snip = re.findall(snip_pattern, menu_example_walk) + if len(expl_snip) == 0: print("\t@menusnip{{{}}}".format(must_doc_class["menu_snip"])) missing_walks.append(must_doc_class["class_name"]) -print("The following classes are not included at all in the menu example:") -print(missing_classes) -print("The following expected build flags are missing from the menu example:") -print(missing_build_flags) -print("The following expected snipped flags are missing from the menu example:") -print(missing_snips) -print( - "The following expected snipped flags are missing from the menu walkthrough/ReadMe:" -) -print(missing_walks) - -menu_declared_snips = list( - dict.fromkeys(re.findall(r"(?:(?:Start)|(?:End)) \[(\w+)\]", menu_example_code)) -) - -missing_walks = [] -for snip in menu_declared_snips: - snip_pattern = r"@menusnip\{(" + re.escape(snip) + r")\}" - expl_snip = re.findall(snip_pattern, menu_example_walk) - if len(expl_snip) == 0: - print(snip_pattern) - missing_walks.append(snip) -print( - "The following expected snipped flags are missing from the menu walkthrough/ReadMe:" -) -print(missing_walks) +if len(missing_classes) > 0: + print("The following classes are not included at all in the menu example:") + print(missing_classes) +if len(missing_build_flags) > 0: + print("The following expected build flags are missing from the menu example:") + print(missing_build_flags) +if len(missing_snips) > 0: + print("The following expected snippet markers are missing from the menu example:") + print(missing_snips) +if len(missing_walks) > 0: + print( + "The following expected snippet inclusions are missing from the menu walkthrough/ReadMe:" + ) + print(missing_walks) -# %% if len(missing_classes + missing_walks) > 0: sys.exit( "Some classes are not properly documented in the Menu-a-la-carte example and its walkthrough." diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index ee1897533..069d51472 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -794,7 +794,7 @@ Because this sensor can have only one I2C address (0x60), it is only possible to @see @ref sensor_mpl115a2 -[//]: # ( @menusnip{mpl115a2} ) +[//]: # ( @menusnip{freescale_mpl115a2} ) ___ 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 4436dfcf6..4b81f6652 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1248,11 +1248,11 @@ Variable* extvoltV = #endif -#if defined BUILD_SENSOR_MPL115A2 +#if defined BUILD_SENSOR_FREESCALE_MPL115A2 // ========================================================================== // Freescale Semiconductor MPL115A2 Barometer // ========================================================================== -/** Start [mpl115a2] */ +/** Start [freescale_mpl115a2] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1267,7 +1267,7 @@ Variable* mplPress = new FreescaleMPL115A2_Pressure( &mpl115a2, "12345678-abcd-1234-ef00-1234567890ab"); Variable* mplTemp = new FreescaleMPL115A2_Temp( &mpl115a2, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [mpl115a2] */ +/** End [freescale_mpl115a2] */ #endif @@ -2367,7 +2367,7 @@ Variable* variableList[] = { #if defined BUILD_SENSOR_EXTERNAL_VOLTAGE extvoltV, #endif -#if defined BUILD_SENSOR_MPL115A2 +#if defined BUILD_SENSOR_FREESCALE_MPL115A2 mplTemp, mplPress, #endif diff --git a/src/sensors/FreescaleMPL115A2.h b/src/sensors/FreescaleMPL115A2.h index 14fa80115..db117e1a9 100644 --- a/src/sensors/FreescaleMPL115A2.h +++ b/src/sensors/FreescaleMPL115A2.h @@ -54,7 +54,7 @@ * The Freescale Semiconductor MPL115A2 is used in the @menulink{mpl115a2} * example. * - * @menusnip{mpl115a2} + * @menusnip{freescale_mpl115a2} */ /* clang-format on */ From 43e27eb9ec75aaae2670822a658ad254d3329131 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 18 Mar 2022 15:06:00 -0400 Subject: [PATCH 52/94] minor doc fixes Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 3 ++- .github/workflows/build_menu.yaml | 3 +++ .github/workflows/check_documentation.yaml | 3 ++- continuous_integration/dependencies.json | 6 ++---- src/sensors/AOSongAM2315.h | 10 +++++----- src/sensors/AOSongDHT.h | 2 +- src/sensors/AnalogElecConductivity.h | 2 +- src/sensors/ApogeeSQ212.h | 2 +- src/sensors/AtlasScientificDO.h | 2 +- src/sensors/BoschBME280.h | 2 +- src/sensors/CampbellClariVUE10.h | 2 +- src/sensors/Decagon5TM.h | 2 +- src/sensors/DecagonCTD.h | 2 +- src/sensors/DecagonES2.h | 2 +- src/sensors/ExternalVoltage.h | 2 +- src/sensors/FreescaleMPL115A2.h | 2 +- src/sensors/KellerParent.h | 2 +- src/sensors/MaxBotixSonar.h | 2 +- src/sensors/MaximDS18.h | 2 +- src/sensors/MaximDS3231.h | 2 +- src/sensors/MeaSpecMS5803.h | 2 +- src/sensors/MeterHydros21.h | 2 +- src/sensors/MeterTeros11.h | 2 +- src/sensors/PaleoTerraRedox.h | 2 +- src/sensors/ProcessorStats.cpp | 10 ++++++++-- src/sensors/ProcessorStats.h | 2 +- src/sensors/RainCounterI2C.h | 2 +- src/sensors/SensirionSHT4x.h | 2 +- src/sensors/TIINA219.h | 2 +- src/sensors/TallyCounterI2C.h | 2 +- src/sensors/YosemitechY4000.h | 2 +- src/sensors/YosemitechY504.h | 2 +- src/sensors/YosemitechY510.h | 2 +- src/sensors/YosemitechY511.h | 2 +- src/sensors/YosemitechY514.h | 2 +- src/sensors/YosemitechY520.h | 2 +- src/sensors/YosemitechY532.h | 2 +- src/sensors/YosemitechY533.h | 2 +- src/sensors/YosemitechY551.h | 2 +- src/sensors/YosemitechY560.h | 2 +- src/sensors/ZebraTechDOpto.h | 2 +- 41 files changed, 57 insertions(+), 48 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index 337f43d68..8bef5a1ba 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -10,6 +10,7 @@ on: env: DOXYGEN_VERSION: Release_1_9_3 + PYTHON_DEPS_ARCHIVE_NUM: 1 jobs: build: @@ -30,7 +31,7 @@ jobs: id: cache_python with: path: ~/.cache/pip - key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }} + key: ${{ runner.os }}-python-${{ env.PYTHON_DEPS_ARCHIVE_NUM }} - name: Install Pygments and other m.css Python Requirements if: steps.cache_python.outputs.cache-hit != 'true' diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 4c7f3697a..bf041f896 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -94,6 +94,9 @@ jobs: - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_DECAGON_ES2 publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_EVERLIGHT_ALSPT19 + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_EXTERNAL_VOLTAGE publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER diff --git a/.github/workflows/check_documentation.yaml b/.github/workflows/check_documentation.yaml index ce1f04e9c..86f2b3db1 100644 --- a/.github/workflows/check_documentation.yaml +++ b/.github/workflows/check_documentation.yaml @@ -5,6 +5,7 @@ on: [push, pull_request] env: DOXYGEN_VERSION: Release_1_9_3 + PYTHON_DEPS_ARCHIVE_NUM: 1 jobs: menu_inclusion: @@ -40,7 +41,7 @@ jobs: id: cache_python with: path: ~/.cache/pip - key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }} + key: ${{ runner.os }}-python-${{ env.PYTHON_DEPS_ARCHIVE_NUM }} - name: Install Pygments and other m.css Python Requirements if: steps.cache_python.outputs.cache-hit != 'true' diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 2bf48679c..113ea2894 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -68,7 +68,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.11.2", + "version": "~1.11.3", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": ["Adafruit"], "frameworks": "arduino", @@ -156,9 +156,7 @@ "url": "https://github.com/adafruit/Adafruit_SHT4X", "version": "~1.0.0", "note": "Sensirion SHT4x Library by Adafruit", - "authors": [ - "Adafruit" - ], + "authors": ["Adafruit"], "frameworks": "arduino" }, { diff --git a/src/sensors/AOSongAM2315.h b/src/sensors/AOSongAM2315.h index c520cb6ef..f9035bd48 100644 --- a/src/sensors/AOSongAM2315.h +++ b/src/sensors/AOSongAM2315.h @@ -69,10 +69,10 @@ #include "SensorBase.h" #include -// Sensor Specific Defines /** @ingroup sensor_am2315 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the AM2315 can report 2 values. #define AM2315_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. @@ -84,13 +84,13 @@ * The sensor timing for an AOSong AM2315 */ /**@{*/ -/// @brief Sensor::_warmUpTime_ms; AM2315 warms up in 500ms (estimated). +/// @brief Sensor::_warmUpTime_ms; the AM2315 warms up in 500ms (estimated). #define AM2315_WARM_UP_TIME_MS 500 -/// @brief Sensor::_stabilizationTime_ms; AM2315 is stable after 500ms +/// @brief Sensor::_stabilizationTime_ms; the AM2315 is stable after 500ms /// (estimated). #define AM2315_STABILIZATION_TIME_MS 500 -/// @brief Sensor::_measurementTime_ms; AM2315 takes 2000ms (2s) to complete a -/// measurement. +/// @brief Sensor::_measurementTime_ms; the AM2315 takes 2000ms (2s) to complete +/// a measurement. #define AM2315_MEASUREMENT_TIME_MS 2000 /**@}*/ diff --git a/src/sensors/AOSongDHT.h b/src/sensors/AOSongDHT.h index 6e04005ff..1cdd5dc84 100644 --- a/src/sensors/AOSongDHT.h +++ b/src/sensors/AOSongDHT.h @@ -91,10 +91,10 @@ static const uint8_t DHT22{22}; /**< DHT TYPE 22 */ static const uint8_t AM2301{21}; /**< AM2301 */ #endif -// Sensor Specific Defines /** @ingroup sensor_dht */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the DHT can report 3 values. #define DHT_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/AnalogElecConductivity.h b/src/sensors/AnalogElecConductivity.h index f00be8cf7..975bc8546 100644 --- a/src/sensors/AnalogElecConductivity.h +++ b/src/sensors/AnalogElecConductivity.h @@ -148,10 +148,10 @@ #include "VariableBase.h" #include "math.h" -// Sensor Specific Defines /** @ingroup sensor_analog_cond */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; we only get one value from the analog /// conductivity sensor. #define ANALOGELECCONDUCTIVITY_NUM_VARIABLES 1 diff --git a/src/sensors/ApogeeSQ212.h b/src/sensors/ApogeeSQ212.h index e313f453b..9acda0fdf 100644 --- a/src/sensors/ApogeeSQ212.h +++ b/src/sensors/ApogeeSQ212.h @@ -88,10 +88,10 @@ #include "VariableBase.h" #include "SensorBase.h" -// Sensor Specific Defines /** @ingroup sensor_sq212 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the SQ212 can report 2 values, raw /// voltage and calculated PAR. #define SQ212_NUM_VARIABLES 2 diff --git a/src/sensors/AtlasScientificDO.h b/src/sensors/AtlasScientificDO.h index 310a7409e..992b19eba 100644 --- a/src/sensors/AtlasScientificDO.h +++ b/src/sensors/AtlasScientificDO.h @@ -66,10 +66,10 @@ */ #define ATLAS_DO_I2C_ADDR 0x61 -// Sensor Specific Defines /** @ingroup sensor_atlas_do */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Atlas DO sensor can report 2 values. #define ATLAS_DO_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/BoschBME280.h b/src/sensors/BoschBME280.h index 858a113a4..9585cfc35 100644 --- a/src/sensors/BoschBME280.h +++ b/src/sensors/BoschBME280.h @@ -94,10 +94,10 @@ #include "SensorBase.h" #include -// Sensor Specific Defines /** @ingroup sensor_bme280 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the BME280 can report 4 values. #define BME280_NUM_VARIABLES 4 /// @brief Sensor::_incCalcValues; altitude is calculted within the Adafruit diff --git a/src/sensors/CampbellClariVUE10.h b/src/sensors/CampbellClariVUE10.h index e41d539f2..f14e6e3f5 100644 --- a/src/sensors/CampbellClariVUE10.h +++ b/src/sensors/CampbellClariVUE10.h @@ -65,10 +65,10 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_clarivue */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the ClariVUE10 can report 7 values /// (although we only keep 3). #define CLARIVUE10_NUM_VARIABLES 7 diff --git a/src/sensors/Decagon5TM.h b/src/sensors/Decagon5TM.h index f1b3c87fa..63920f16c 100644 --- a/src/sensors/Decagon5TM.h +++ b/src/sensors/Decagon5TM.h @@ -80,10 +80,10 @@ #include "VariableBase.h" #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_fivetm */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the 5TM can report 3 values. #define TM_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; volumetric water content is calculated from diff --git a/src/sensors/DecagonCTD.h b/src/sensors/DecagonCTD.h index 7c5a18af6..e8368a186 100644 --- a/src/sensors/DecagonCTD.h +++ b/src/sensors/DecagonCTD.h @@ -65,10 +65,10 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_decagon_ctd */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the CTD can report 3 values. #define CTD_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/DecagonES2.h b/src/sensors/DecagonES2.h index c7f71c3be..b07c9c324 100644 --- a/src/sensors/DecagonES2.h +++ b/src/sensors/DecagonES2.h @@ -60,10 +60,10 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_es2 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the ES2 can report 2 values. #define ES2_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/ExternalVoltage.h b/src/sensors/ExternalVoltage.h index 02ce28050..8c52a4e62 100644 --- a/src/sensors/ExternalVoltage.h +++ b/src/sensors/ExternalVoltage.h @@ -152,10 +152,10 @@ #include "VariableBase.h" #include "SensorBase.h" -// Sensor Specific Defines /** @ingroup sensor_ads1x15 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the ADS1115 can report 1 value. #define EXT_VOLTAGE_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/FreescaleMPL115A2.h b/src/sensors/FreescaleMPL115A2.h index db117e1a9..47cad7824 100644 --- a/src/sensors/FreescaleMPL115A2.h +++ b/src/sensors/FreescaleMPL115A2.h @@ -76,10 +76,10 @@ #include "SensorBase.h" #include -// Sensor Specific Defines /** @ingroup sensor_mpl115a2 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the MPL115A2 can report 2 values. #define MPL115A2_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/KellerParent.h b/src/sensors/KellerParent.h index e2cb8b778..464f274ec 100644 --- a/src/sensors/KellerParent.h +++ b/src/sensors/KellerParent.h @@ -98,10 +98,10 @@ #include "SensorBase.h" #include -// Sensor Specific Defines /** @ingroup keller_group */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Keller level sensors can report 3 /// values. #define KELLER_NUM_VARIABLES 3 diff --git a/src/sensors/MaxBotixSonar.h b/src/sensors/MaxBotixSonar.h index d40d9fcc4..49a587ed9 100644 --- a/src/sensors/MaxBotixSonar.h +++ b/src/sensors/MaxBotixSonar.h @@ -112,10 +112,10 @@ #include "VariableBase.h" #include "SensorBase.h" -// Sensor Specific Defines /** @ingroup sensor_maxbotix */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the HRXL can report 1 value. #define HRXL_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/MaximDS18.h b/src/sensors/MaximDS18.h index 33ea6952d..b5ecef170 100644 --- a/src/sensors/MaximDS18.h +++ b/src/sensors/MaximDS18.h @@ -95,10 +95,10 @@ #include #include -// Sensor Specific Defines /** @ingroup sensor_ds18 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the DS18 can report 1 value. #define DS18_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/MaximDS3231.h b/src/sensors/MaximDS3231.h index 124f620d8..fb7b29cfb 100644 --- a/src/sensors/MaximDS3231.h +++ b/src/sensors/MaximDS3231.h @@ -71,10 +71,10 @@ #include "VariableBase.h" #include "SensorBase.h" -// Sensor Specific Defines /** @ingroup sensor_ds3231 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the DS3231 can report 1 value. #define DS3231_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/MeaSpecMS5803.h b/src/sensors/MeaSpecMS5803.h index 951898994..f1a2bd0af 100644 --- a/src/sensors/MeaSpecMS5803.h +++ b/src/sensors/MeaSpecMS5803.h @@ -91,10 +91,10 @@ #include "SensorBase.h" #include -// Sensor Specific Defines /** @ingroup sensor_ms5803 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the MS5803 can report 2 values. #define MS5803_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/MeterHydros21.h b/src/sensors/MeterHydros21.h index 73adfdf36..35940657c 100644 --- a/src/sensors/MeterHydros21.h +++ b/src/sensors/MeterHydros21.h @@ -72,10 +72,10 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_hydros21 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Hydros 21 can report 3 values. #define HYDROS21_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/MeterTeros11.h b/src/sensors/MeterTeros11.h index 0f3a7957c..76421fd14 100644 --- a/src/sensors/MeterTeros11.h +++ b/src/sensors/MeterTeros11.h @@ -90,10 +90,10 @@ #include "VariableBase.h" #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_teros11 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Teros 11 can report 2 raw values - /// counts and temperature. #define TEROS11_NUM_VARIABLES 4 diff --git a/src/sensors/PaleoTerraRedox.h b/src/sensors/PaleoTerraRedox.h index 2277e397b..d419879da 100644 --- a/src/sensors/PaleoTerraRedox.h +++ b/src/sensors/PaleoTerraRedox.h @@ -78,10 +78,10 @@ #include // Testato's SoftwareWire #endif -// Sensor Specific Defines /** @ingroup sensor_pt_redox */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the PaleoTerra redox sensor can report 1 /// value. #define PTR_NUM_VARIABLES 1 diff --git a/src/sensors/ProcessorStats.cpp b/src/sensors/ProcessorStats.cpp index e0c641d15..5f7891fa9 100644 --- a/src/sensors/ProcessorStats.cpp +++ b/src/sensors/ProcessorStats.cpp @@ -145,13 +145,19 @@ bool ProcessorStats::addSingleMeasurementResult(void) { #if defined(ARDUINO_AVR_ENVIRODIY_MAYFLY) if (strcmp(_version, "v0.3") == 0 || strcmp(_version, "v0.4") == 0) { // Get the battery voltage - float rawBattery = analogRead(_batteryPin); + // The return value from analogRead() is IN BITS NOT IN VOLTS!! + analogRead(_batteryPin); // priming reading + float rawBattery = analogRead(_batteryPin); + // convert bits to volts sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery; } if (strcmp(_version, "v0.5") == 0 || strcmp(_version, "v0.5b") || strcmp(_version, "v1.0") || strcmp(_version, "v1.1") == 0) { // Get the battery voltage - float rawBattery = analogRead(_batteryPin); + // The return value from analogRead() is IN BITS NOT IN VOLTS!! + analogRead(_batteryPin); // priming reading + float rawBattery = analogRead(_batteryPin); + // convert bits to volts sensorValue_battery = (3.3 / 1023.) * 4.7 * rawBattery; } diff --git a/src/sensors/ProcessorStats.h b/src/sensors/ProcessorStats.h index 2006dc095..676bcfaac 100644 --- a/src/sensors/ProcessorStats.h +++ b/src/sensors/ProcessorStats.h @@ -68,10 +68,10 @@ #include "VariableBase.h" #include "SensorBase.h" -// Sensor Specific Defines /** @ingroup sensor_processor */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the processor can report 3 values. #define PROCESSOR_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; sample number is (sort-of) calculated. diff --git a/src/sensors/RainCounterI2C.h b/src/sensors/RainCounterI2C.h index d3c0681f1..3ab80fb23 100644 --- a/src/sensors/RainCounterI2C.h +++ b/src/sensors/RainCounterI2C.h @@ -88,10 +88,10 @@ #include // Testato's SoftwareWire #endif -// Sensor Specific Defines /** @ingroup sensor_i2c_rain */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the tipping bucket counter can report 2 /// values. #define BUCKET_NUM_VARIABLES 2 diff --git a/src/sensors/SensirionSHT4x.h b/src/sensors/SensirionSHT4x.h index eb63ec358..5db497336 100644 --- a/src/sensors/SensirionSHT4x.h +++ b/src/sensors/SensirionSHT4x.h @@ -78,10 +78,10 @@ #include "SensorBase.h" #include -// Sensor Specific Defines /** @ingroup sensor_sht4x */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the SHT4x can report 2 values. #define SHT4X_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/TIINA219.h b/src/sensors/TIINA219.h index 2eea235e8..1ebdb6928 100644 --- a/src/sensors/TIINA219.h +++ b/src/sensors/TIINA219.h @@ -75,10 +75,10 @@ #include "SensorBase.h" #include -// Sensor Specific Defines /** @ingroup sensor_ina219 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the INA219 can report 3 values. #define INA219_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/TallyCounterI2C.h b/src/sensors/TallyCounterI2C.h index 34a3ba501..078dc32c1 100644 --- a/src/sensors/TallyCounterI2C.h +++ b/src/sensors/TallyCounterI2C.h @@ -85,10 +85,10 @@ #include -// Sensor Specific Defines /** @ingroup sensor_tally */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Tally can report 1 value. #define TALLY_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY4000.h b/src/sensors/YosemitechY4000.h index 48b38302d..b73604b40 100644 --- a/src/sensors/YosemitechY4000.h +++ b/src/sensors/YosemitechY4000.h @@ -58,10 +58,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y4000 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y4000 can report 8 values. #define Y4000_NUM_VARIABLES 8 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY504.h b/src/sensors/YosemitechY504.h index d3c5fb588..060d53cfb 100644 --- a/src/sensors/YosemitechY504.h +++ b/src/sensors/YosemitechY504.h @@ -56,10 +56,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y504 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y504 can report 3 values. #define Y504_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we calculated DO concentration from the diff --git a/src/sensors/YosemitechY510.h b/src/sensors/YosemitechY510.h index 4cfbac2b0..5e9e5fb18 100644 --- a/src/sensors/YosemitechY510.h +++ b/src/sensors/YosemitechY510.h @@ -52,10 +52,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y510 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y510 can report 2 values. #define Y510_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY511.h b/src/sensors/YosemitechY511.h index 2dafa2518..5b4af4d84 100644 --- a/src/sensors/YosemitechY511.h +++ b/src/sensors/YosemitechY511.h @@ -53,10 +53,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y511 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y511 can report 2 values. #define Y511_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY514.h b/src/sensors/YosemitechY514.h index 2ba44a2b8..6b8ff6af8 100644 --- a/src/sensors/YosemitechY514.h +++ b/src/sensors/YosemitechY514.h @@ -54,10 +54,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y514 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y514 can report 2 values. #define Y514_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY520.h b/src/sensors/YosemitechY520.h index fa7b8dc2b..6fee2984f 100644 --- a/src/sensors/YosemitechY520.h +++ b/src/sensors/YosemitechY520.h @@ -53,10 +53,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y520 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y520 can report 2 values. #define Y520_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY532.h b/src/sensors/YosemitechY532.h index f5e8f78a0..1c2fde719 100644 --- a/src/sensors/YosemitechY532.h +++ b/src/sensors/YosemitechY532.h @@ -53,10 +53,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y532 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y532 can report 3 values. #define Y532_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY533.h b/src/sensors/YosemitechY533.h index 4e8ad82ff..a498afdac 100644 --- a/src/sensors/YosemitechY533.h +++ b/src/sensors/YosemitechY533.h @@ -52,10 +52,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y533 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y533 can report 2 values. #define Y533_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index 654a61eb5..b96415c1a 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -52,10 +52,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y551 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y551 can report 2 values. #define Y551_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/YosemitechY560.h b/src/sensors/YosemitechY560.h index 22e3a6cb0..895895216 100644 --- a/src/sensors/YosemitechY560.h +++ b/src/sensors/YosemitechY560.h @@ -53,10 +53,10 @@ // Included Dependencies #include "sensors/YosemitechParent.h" -// Sensor Specific Defines /** @ingroup sensor_y560 */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the Y560 can report 3 values. #define Y560_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. diff --git a/src/sensors/ZebraTechDOpto.h b/src/sensors/ZebraTechDOpto.h index 8a77c1266..ff8efcbc8 100644 --- a/src/sensors/ZebraTechDOpto.h +++ b/src/sensors/ZebraTechDOpto.h @@ -55,10 +55,10 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_dopto */ /**@{*/ +// Sensor Specific Defines /// @brief Sensor::_numReturnedValues; the D-Opto can report 3 values. #define DOPTO_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. From 3dc48e503890192885c89d9e00688551270935df Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 18 Mar 2022 16:46:09 -0400 Subject: [PATCH 53/94] First crack at ALS Signed-off-by: Sara Damiano --- ChangeLog.md | 2 + .../install-deps-arduino-cli.sh | 3 + examples/menu_a_la_carte/menu_a_la_carte.ino | 50 +- library.json | 2 +- library.properties | 2 +- src/sensors/AnalogElecConductivity.h | 2 +- src/sensors/EverlightALSPT19.cpp | 93 ++++ src/sensors/EverlightALSPT19.h | 452 ++++++++++++++++++ 8 files changed, 597 insertions(+), 9 deletions(-) create mode 100644 src/sensors/EverlightALSPT19.cpp create mode 100644 src/sensors/EverlightALSPT19.h diff --git a/ChangeLog.md b/ChangeLog.md index 6115392de..bb7f1c5d1 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -43,6 +43,8 @@ This is *not* a breaking change at this time; the old class names are still usab - **Sensor** Added support for the [YosemiTech Y560 Ammonium Probe](http://en.yosemitech.com/aspcms/product/2020-4-23/61.html), which is a mini sonde for three Ion Selective Electrode (ISE) sensors (pH, NH4+, K+) that together are used to provide a corrected estimate of total ammonium nitrogen (NH4_N) in mg/L. - NOTE that this release only includes outputs for NH4_N, pH, and temperature. A future release will also include estimates of potassium (K) and raw potential values from each of the electrodes. - **Sensor** Added support for the SDI-12 In-Situ [Level TROLL 400, 500 & 700 Data Loggers](https://in-situ.com/pub/media/support/documents/LevelTROLL_SS.pdf) +- **Sensor** Added support for the Sensirion SHT40 relative humidity and temperature sensor +- **Sensor** Added support for the Everlight ALS-PT19 ambient light sensor ### Removed diff --git a/continuous_integration/install-deps-arduino-cli.sh b/continuous_integration/install-deps-arduino-cli.sh index e467404e9..18b16617d 100644 --- a/continuous_integration/install-deps-arduino-cli.sh +++ b/continuous_integration/install-deps-arduino-cli.sh @@ -84,6 +84,9 @@ arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "A echo "\n\e[32mInstalling Adafruit MPL115A2 library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "Adafruit MPL115A2" +echo "\n\e[32mInstalling Adafruit SHT4x Library library from Arduino library index\e[0m" +arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "Adafruit SHT4x Library" + 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/examples/menu_a_la_carte/menu_a_la_carte.ino b/examples/menu_a_la_carte/menu_a_la_carte.ino index 8fb19083e..837aaa373 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -298,8 +298,8 @@ const int8_t modemStatusPin = 19; // MCU pin used to read modem status const bool useCTSforStatus = false; // Flag to use the 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 +const int8_t modemLEDPin = + redLED; // MCU pin connected an LED to show modem status // Network connection information const char* apn = "xxxxx"; // APN for GPRS connection @@ -440,8 +440,9 @@ const int32_t modemBaud = 115200; // Communication speed of the modem // 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 DFRobot ESP8266 Bee with Mayfly -const int8_t modemVccPin = -2; // MCU pin controlling modem power +// Example pins here are for a EnviroDIY ESP32 Bluetooth/Wifi Bee with +// Mayfly 1.1 +const int8_t modemVccPin = A5; // MCU pin controlling modem power const int8_t modemStatusPin = -1; // MCU pin used to read modem status const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin const int8_t modemSleepRqPin = 19; // MCU pin for wake from light sleep @@ -1223,6 +1224,38 @@ Variable* es2Temp = new DecagonES2_Temp(&es2, #endif +#if defined BUILD_SENSOR_EVERLIGHT_ALSPT19 +// ========================================================================== +// Everlight ALS-PT19 Ambient Light Sensor +// ========================================================================== +/** Start [everlight_alspt19] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const int8_t alsPower = sensorPowerPin; // Power pin +const int8_t alsData = 7; // The ALS PT-19 data pin +const int8_t alsSupply = 3.3; // The ALS PT-19 supply power voltage +const int8_t alsResistance = 10; // The ALS PT-19 loading resistance (in kΩ) +const uint8_t alsNumberReadings = 10; + +// Create a Everlight ALS-PT19 sensor object +EverlightALSPT19 alsPt19(alsPower, alsData, alsSupply, alsResistance, + alsNumberReadings); + +// For an EnviroDIY Mayfly, you can use the abbreviated version +// EverlightALSPT19 alsPt19(alsNumberReadings); + +// Create voltage, current, and illuminance variable pointers for the ALS-PT19 +Variable* alsPt19Volt = new EverlightALSPT19_Voltage( + &alsPt19, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* alsPt19Current = new EverlightALSPT19_Current( + &alsPt19, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* alsPt19Lux = new EverlightALSPT19_Illuminance( + &alsPt19, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [everlight_alspt19] */ +#endif + + #if defined BUILD_SENSOR_EXTERNAL_VOLTAGE // ========================================================================== // External Voltage via TI ADS1115 @@ -1415,7 +1448,7 @@ Variable* nanolevHeight = new KellerNanolevel_Height( // NOTE: Use -1 for any pins that don't apply or aren't being used. const int8_t SonarPower = sensorPowerPin; // Excite (power) pin const int8_t Sonar1Trigger = -1; // Trigger pin - // (a *unique* negative number if unconnected) +// Trigger should be a *unique* negative number if unconnected const uint8_t sonar1NumberReadings = 3; // The number of readings to average // Create a MaxBotix Sonar sensor object @@ -2082,7 +2115,7 @@ byte y551ModbusAddress = 0x50; // The modbus address of the Y551 const int8_t y551AdapterPower = sensorPowerPin; // RS485 adapter power pin const int8_t y551SensorPower = A3; // Sensor power pin const int8_t y551EnablePin = -1; // Adapter RE/DE pin -const uint8_t y551NumberReadings = 3; +const uint8_t y551NumberReadings = 5; // The manufacturer recommends averaging 10 readings, but we take 5 to minimize // power consumption @@ -2387,6 +2420,11 @@ Variable* variableList[] = { es2Cond, es2Temp, #endif +#if defined BUILD_SENSOR_EVERLIGHT_ALSPT19 + alsPt19Volt, + alsPt19Current, + alsPt19Lux, +#endif #if defined BUILD_SENSOR_EXTERNAL_VOLTAGE extvoltV, #endif diff --git a/library.json b/library.json index e7d13135d..17b21b820 100644 --- a/library.json +++ b/library.json @@ -129,7 +129,7 @@ "owner": "adafruit", "library id": "6214", "url": "https://github.com/adafruit/Adafruit_BusIO.git", - "version": "~1.11.2", + "version": "~1.11.3", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": ["Adafruit"], "frameworks": "arduino", diff --git a/library.properties b/library.properties index a0cb3cb62..2b695eea4 100644 --- a/library.properties +++ b/library.properties @@ -8,4 +8,4 @@ category=Sensors url=https://github.com/EnviroDIY/ModularSensors architectures=avr,samd includes=LoggerBase.h -depends=EnviroDIY_DS3231, RTCZero, EnableInterrupt, SdFat, TinyGSM, PubSubClient, Adafruit BusIO, Adafruit Unified Sensor, Adafruit ADS1X15, Adafruit AM2315, Adafruit BME280 Library, DHT sensor library, Adafruit INA219, Adafruit MPL115A2, OneWire, DallasTemperature, SDI-12, MS5803, SensorModbusMaster, KellerModbus, YosemitechModbus +depends=EnviroDIY_DS3231, RTCZero, EnableInterrupt, SdFat, TinyGSM, PubSubClient, Adafruit BusIO, Adafruit Unified Sensor, Adafruit ADS1X15, Adafruit AM2315, Adafruit BME280 Library, DHT sensor library, Adafruit INA219, Adafruit MPL115A2, Adafruit SHT4x Library, OneWire, DallasTemperature, SDI-12, MS5803, SensorModbusMaster, KellerModbus, YosemitechModbus diff --git a/src/sensors/AnalogElecConductivity.h b/src/sensors/AnalogElecConductivity.h index 975bc8546..1d47fa1b3 100644 --- a/src/sensors/AnalogElecConductivity.h +++ b/src/sensors/AnalogElecConductivity.h @@ -280,7 +280,7 @@ #if !defined ANALOG_EC_ADC_REFERENCE_MODE #error The processor ADC reference type must be defined! #endif // ANALOG_EC_ADC_REFERENCE_MODE -#endif // ANALOG_EC_ADC_REFERENCE_MODE +#endif // ARDUINO_ARCH_SAMD /* clang-format on */ #if !defined RSERIES_OHMS_DEF diff --git a/src/sensors/EverlightALSPT19.cpp b/src/sensors/EverlightALSPT19.cpp new file mode 100644 index 000000000..15221dfee --- /dev/null +++ b/src/sensors/EverlightALSPT19.cpp @@ -0,0 +1,93 @@ +/** + * @file EverlightALSPT19.cpp + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Sara Geleskie Damiano + * + * @brief Implements the EverlightALSPT19 class. + */ + +#include "EverlightALSPT19.h" + + +// The constructor - because this is I2C, only need the power pin +// This sensor has a set I2C address of 0XB8 +EverlightALSPT19::EverlightALSPT19(int8_t powerPin, int8_t dataPin, + float supplyVoltage, float loadResistor, + uint8_t measurementsToAverage) + : Sensor("Everlight ALS-PT19", ALSPT19_NUM_VARIABLES, + ALSPT19_WARM_UP_TIME_MS, ALSPT19_STABILIZATION_TIME_MS, + ALSPT19_MEASUREMENT_TIME_MS, powerPin, dataPin, + measurementsToAverage), + _supplyVoltage(supplyVoltage), _loadResistor(loadResistor) {} +EverlightALSPT19::EverlightALSPT19(uint8_t measurementsToAverage) + : Sensor("Everlight ALS-PT19", ALSPT19_NUM_VARIABLES, + ALSPT19_WARM_UP_TIME_MS, ALSPT19_STABILIZATION_TIME_MS, + ALSPT19_MEASUREMENT_TIME_MS, MAYFLY_ALS_POWER_PIN, + MAYFLY_ALS_DATA_PIN, measurementsToAverage, + ALSPT19_INC_CALC_VARIABLES), + _supplyVoltage(MAYFLY_ALS_SUPPLY_VOLTAGE), + _loadResistor(MAYFLY_ALS_LOADING_RESISTANCE) {} +EverlightALSPT19::~EverlightALSPT19() {} + + +bool EverlightALSPT19::addSingleMeasurementResult(void) { + // Initialize float variables + float volt_val = -9999; + float current_val = -9999; + float lux_val = -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)) { + // Set the resolution for the processor ADC, only applies to SAMD + // boards. +#if !defined ARDUINO_ARCH_AVR + analogReadResolution(ALSPT19_ADC_RESOLUTION); +#endif // ARDUINO_ARCH_AVR + // Set the analog reference mode for the voltage measurement. + // If possible, to get the best results, an external reference should be + // used. + analogReference(ALSPT19_ADC_REFERENCE_MODE); + MS_DBG(getSensorNameAndLocation(), F("is reporting:")); + + // First measure the analog voltage. + // The return value from analogRead() is IN BITS NOT IN VOLTS!! + // Take a priming reading. + // First reading will be low - discard + analogRead(_dataPin); + // Take the reading we'll keep + uint32_t sensor_adc = analogRead(_dataPin); + MS_DEEP_DBG(" ADC Bits:", sensor_adc); + + if (0 == sensor_adc) { + // Prevent underflow, can never be ALSPT19_ADC_RANGE + sensor_adc = 1; + } + // convert bits to volts + volt_val = (_supplyVoltage / ALSPT19_ADC_MAX) * sensor_adc; + // convert volts to current + current_val = volt_val / _loadResistor; + // convert current to illuminance + // from sensor datasheet, typical 200µA current for1000 Lux + lux_val = current_val * (1000. / 200.); + + + MS_DBG(F(" Voltage:"), volt_val, F("V")); + MS_DBG(F(" Current:"), current_val, F("µA")); + MS_DBG(F(" Illuminance:"), lux_val, F("lux")); + } else { + MS_DBG(getSensorNameAndLocation(), F("is not currently measuring!")); + } + + verifyAndAddMeasurementResult(ALSPT19_VOLTAGE_VAR_NUM, volt_val); + verifyAndAddMeasurementResult(ALSPT19_CURRENT_VAR_NUM, current_val); + verifyAndAddMeasurementResult(ALSPT19_ILLUMINANCE_VAR_NUM, lux_val); + + // 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; +} diff --git a/src/sensors/EverlightALSPT19.h b/src/sensors/EverlightALSPT19.h new file mode 100644 index 000000000..90a69af7f --- /dev/null +++ b/src/sensors/EverlightALSPT19.h @@ -0,0 +1,452 @@ +/** + * @file EverlightALSPT19.h + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Sara Geleskie Damiano + * + * @brief Contains the EverlightALSPT19 sensor subclass and the variable + * subclasses EverlightALSPT19_Current and EverlightALSPT19_Illuminance. + * + * These are used for the Everlight ALS-PT19 ambient light sensor. + */ +/* clang-format off */ +/** + * @defgroup sensor_alspt19 Everlight ALS-PT19 + * Classes for the Everlight ALS-PT19 ambient light sensor. + * + * @ingroup the_sensors + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_alspt19_notes Quick Notes + * - A simple analog current sensor + * - Requires a 2.5 - 5.5V power source + * + * @section sensor_alspt19_datasheet Sensor Datasheet + * [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Everlight-ALS-PT19.pdf) + * + * @section sensor_alspt19_ctor Sensor Constructors + * {{ @ref EverlightALSPT19::EverlightALSPT19(int8_t, uint8_t) }} + * {{ @ref EverlightALSPT19::EverlightALSPT19(TwoWire*, int8_t, uint8_t) }} + * + * @section sensor_alspt19_examples Example Code + * + * The ALS-PT19 is used in the @menulink{ao_song_alspt19} example + * + * @menusnip{ao_song_alspt19} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_EVERLIGHTALSPT19_H_ +#define SRC_SENSORS_EVERLIGHTALSPT19_H_ + +// Debugging Statement +// #define MS_EVERLIGHTALSPT19_DEBUG + +#ifdef MS_EVERLIGHTALSPT19_DEBUG +#define MS_DEBUGGING_STD "EverlightALSPT19" +#endif +#ifdef MS_EVERLIGHTALSPT19_DEBUG_DEEP +#define MS_DEBUGGING_DEEP "EverlightALSPT19" +#endif + +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "VariableBase.h" +#include "SensorBase.h" + +/** @ingroup sensor_alspt19 */ +/**@{*/ + +// Sensor Specific Defines +/// @brief Sensor::_numReturnedValues; the ALS-PT19 can report 1 value +/// (voltage). +#define ALSPT19_NUM_VARIABLES 1 +/// @brief Sensor::_incCalcValues; we calculate photocurrent from the supply +/// voltage and loading resistance and illuminance from the photocurrent. +#define ALSPT19_INC_CALC_VARIABLES 1 +/// @brief The power pin for the ALS on the EnviroDIY Mayfly v1.x +#define MAYFLY_ALS_POWER_PIN -1 +/// @brief The data pin for the ALS on the EnviroDIY Mayfly v1.x +#define MAYFLY_ALS_DATA_PIN A4 +/// @brief The supply voltage for the ALS on the EnviroDIY Mayfly v1.x +#define MAYFLY_ALS_SUPPLY_VOLTAGE 3.3 +/// @brief The loading resistance for the ALS on the EnviroDIY Mayfly v1.x +#define MAYFLY_ALS_LOADING_RESISTANCE 10 + +#if !defined ALSPT19_ADC_RESOLUTION +/** + * @brief Default resolution (in bits) of the voltage measurement + * + * The default for all boards is 10, use a build flag to change this, if + * necessary. + */ +#define ALSPT19_ADC_RESOLUTION 10 +#endif // ALSPT19_ADC_RESOLUTION +/// @brief The maximum possible value of the ADC - one less than the resolution +/// shifted up one bit. +#define ALSPT19_ADC_MAX ((1 << ALSPT19_ADC_RESOLUTION) - 1) +/// @brief The maximum possible range of the ADC - the resolution shifted up one +/// bit. +#define ALSPT19_ADC_RANGE (1 << ALSPT19_ADC_RESOLUTION) + +/* clang-format off */ +#if !defined ALSPT19_ADC_REFERENCE_MODE +#if defined ARDUINO_ARCH_AVR | defined DOXYGEN +/** + * @brief The voltage reference mode for the processor's ADC. + * + * For an AVR board, this must be one of: + * - `DEFAULT`: the default built-in analog reference of 5 volts (on 5V Arduino + * boards) or 3.3 volts (on 3.3V Arduino boards) + * - `INTERNAL`: a built-in reference, equal to 1.1 volts on the ATmega168 or + * ATmega328P and 2.56 volts on the ATmega32U4 and ATmega8 (not available on the + * Arduino Mega) + * - `INTERNAL1V1`: a built-in 1.1V reference (Arduino Mega only) + * - `INTERNAL2V56`: a built-in 2.56V reference (Arduino Mega only) + * - `EXTERNAL`: the voltage applied to the AREF pin (0 to 5V only) is used as the + * reference. + * + * If not set on an AVR board `DEFAULT` is used. + * + * For the best accuracy, use an `EXTERNAL` reference with the AREF pin + * connected to the power supply for the EC sensor. + */ +#define ALSPT19_ADC_REFERENCE_MODE DEFAULT +#endif +#if defined ARDUINO_ARCH_SAMD | defined DOXYGEN +/** + * @brief The voltage reference mode for the processor's ADC. + * + * For a SAMD board, this must be one of: + * - `AR_DEFAULT`: the default built-in analog reference of 3.3V + * - `AR_INTERNAL`: a built-in 2.23V reference + * - `AR_INTERNAL1V0`: a built-in 1.0V reference + * - `AR_INTERNAL1V65`: a built-in 1.65V reference + * - `AR_INTERNAL2V23`: a built-in 2.23V reference + * - `AR_EXTERNAL`: the voltage applied to the AREF pin is used as the reference + * + * If not set on an SAMD board `AR_DEFAULT` is used. + * + * For the best accuracy, use an `EXTERNAL` reference with the AREF pin + * connected to the power supply for the EC sensor. + * + * @see https://www.arduino.cc/reference/en/language/functions/analog-io/analogreference/ + */ +#define ALSPT19_ADC_REFERENCE_MODE AR_DEFAULT +#endif +#if !defined ALSPT19_ADC_REFERENCE_MODE +#error The processor ADC reference type must be defined! +#endif // ALSPT19_ADC_REFERENCE_MODE +#endif // ARDUINO_ARCH_SAMD +/* clang-format on */ + +/** + * @anchor sensor_alspt19_timing + * @name Sensor Timing + * The sensor timing for an Everlight ALS-PT19 + */ +/**@{*/ +/// @brief Sensor::_warmUpTime_ms; the ALS-PT19 should not need to warm up. +#define ALSPT19_WARM_UP_TIME_MS 2 +/// @brief Sensor::_stabilizationTime_ms; the ALS-PT19 rise time is 0.11 ms +/// (typical). +#define ALSPT19_STABILIZATION_TIME_MS 1 +/// @brief Sensor::_measurementTime_ms; essentially 0 time is taken in a +/// reading, just the analog read time, but we want to give more than the rise +/// (0.11 ms) or fall (0.22 ms) time between readings. +#define ALSPT19_MEASUREMENT_TIME_MS 1 +/**@}*/ + +/** + * @anchor sensor_alspt19_voltage + * @name Voltage + * The voltage variable from an Everlight ALS-PT19 + * - Range is dependent on supply voltage and loading resistor + * - 0 to 4.6 V with a 5V power supply and 75K resistor + * + * {{ @ref EverlightALSPT19_Voltage::EverlightALSPT19_Voltage }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; voltage should have 0 + * + * The true resolution depends on the ADC, the supply voltage, and the loading + * resistor, but for simplicity we will use 3, which is an appropriate value for + * the Mayfly. + */ +#define ALSPT19_VOLTAGE_RESOLUTION 3 +/// @brief Sensor variable number; current is stored in sensorValues[0]. +#define ALSPT19_VOLTAGE_VAR_NUM 0 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "electricCurrent" +#define ALSPT19_VOLTAGE_VAR_NAME "voltage" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "microampere" +#define ALSPT19_VOLTAGE_UNIT_NAME "volt" +/// @brief Default variable short code; "ALSPT19Voltage" +#define ALSPT19_VOLTAGE_DEFAULT_CODE "ALSPT19Voltage" +/**@}*/ + +/** + * @anchor sensor_alspt19_current + * @name Current + * The current variable from an Everlight ALS-PT19 + * - Range is 5 to 520 µA + * + * {{ @ref EverlightALSPT19_Current::EverlightALSPT19_Current }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; voltage should have 0 + * + * The true resolution depends on the ADC, the supply voltage, and the loading + * resistor, but for simplicity we will use 0 as this is not a high precision + * sensor. + */ +#define ALSPT19_CURRENT_RESOLUTION 0 +/// @brief Sensor variable number; current is stored in sensorValues[0]. +#define ALSPT19_CURRENT_VAR_NUM 1 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "electricCurrent" +#define ALSPT19_CURRENT_VAR_NAME "electricCurrent" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "microampere" +#define ALSPT19_CURRENT_UNIT_NAME "microampere" +/// @brief Default variable short code; "ALSPT19Current" +#define ALSPT19_CURRENT_DEFAULT_CODE "ALSPT19Current" +/**@}*/ + +/** + * @anchor sensor_alspt19_illuminance + * @name Illuminance + * The illuminance variable from an Everlight ALS-PT19 + * - Range is 0 to 10000 lux + * + * {{ @ref EverlightALSPT19_Illuminance::EverlightALSPT19_Illuminance }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; illuminance should have 0 + * + * The true resolution depends on the ADC, the supply voltage, the loading + * resistor, and the light source, but for simplicity we will use 0 as this is + * not a high precision sensor. + */ +#define ALSPT19_ILLUMINANCE_RESOLUTION 1 +/// @brief Sensor variable number; illuminance is stored in sensorValues[1]. +#define ALSPT19_ILLUMINANCE_VAR_NUM 2 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "illuminance" +#define ALSPT19_ILLUMINANCE_VAR_NAME "illuminance" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "lux" +#define ALSPT19_ILLUMINANCE_UNIT_NAME "lux" +/// @brief Default variable short code; "ALSPT19Lux" +#define ALSPT19_ILLUMINANCE_DEFAULT_CODE "ALSPT19Lux" +/**@}*/ + + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the [Everlight ALS-PT19](@ref sensor_alspt19). + */ +/* clang-format on */ +class EverlightALSPT19 : public Sensor { + public: + /** + * @brief Construct a new EverlightALSPT19 object with custom supply voltage + * and loading resistor values. + * + * @param powerPin The pin on the mcu controlling power to the AOSong + * ALS-PT19. Use -1 if it is continuously powered. + * - The ALS-PT19 requires a 2.5 - 5.5V power source + * @param dataPin The processor ADC port pin to read the voltage from the EC + * probe. Not all processor pins can be used as analog pins. Those usable + * as analog pins generally are numbered with an "A" in front of the number + * - ie, A1. + * @param supplyVoltage The power supply voltage (in volts) of the ALS-PT19. + * @param loadResistor The size of the loading resistor, in kilaohms (kΩ). + * @param measurementsToAverage The number of measurements to take and + * average before giving a "final" result from the sensor; optional with a + * default value of 10. + */ + EverlightALSPT19(int8_t powerPin, int8_t dataPin, float supplyVoltage, + float loadResistor, uint8_t measurementsToAverage = 10); + /** + * @brief Construct a new EverlightALSPT19 object with pins and resistors + * for the EnviroDIY Mayfly 1.x. + * + * This is a short-cut constructor to help users of our own board so they + * can change the number of readings without changing other arguments or + * enter no arguments at all. + * + * @param measurementsToAverage The number of measurements to take and + * average before giving a "final" result from the sensor; optional with a + * default value of 10. + */ + explicit EverlightALSPT19(uint8_t measurementsToAverage = 10); + /** + * @brief Destroy the EverlightALSPT19 object - no action needed. + */ + ~EverlightALSPT19(); + + /** + * @copydoc Sensor::addSingleMeasurementResult() + */ + bool addSingleMeasurementResult(void) override; + + private: + /** + * @brief The power supply voltage + */ + float _supplyVoltage; + /** + * @brief The loading resistance + */ + float _loadResistor; +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [relative current output](@ref sensor_alspt19_voltage) from an + * [Everlight ALS-PT19](@ref sensor_alspt19). + */ +/* clang-format on */ +class EverlightALSPT19_Voltage : public Variable { + public: + /** + * @brief Construct a new EverlightALSPT19_Voltage object. + * + * @param parentSense The parent EverlightALSPT19 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 "ALSPT19Current". + */ + explicit EverlightALSPT19_Voltage( + EverlightALSPT19* parentSense, const char* uuid = "", + const char* varCode = ALSPT19_VOLTAGE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)ALSPT19_VOLTAGE_VAR_NUM, + (uint8_t)ALSPT19_VOLTAGE_RESOLUTION, + ALSPT19_VOLTAGE_VAR_NAME, ALSPT19_VOLTAGE_UNIT_NAME, varCode, + uuid) {} + /** + * @brief Construct a new EverlightALSPT19_Voltage object. + * + * @note This must be tied with a parent EverlightALSPT19 before it can be + * used. + */ + EverlightALSPT19_Voltage() + : Variable((const uint8_t)ALSPT19_VOLTAGE_VAR_NUM, + (uint8_t)ALSPT19_VOLTAGE_RESOLUTION, + ALSPT19_VOLTAGE_VAR_NAME, ALSPT19_VOLTAGE_UNIT_NAME, + ALSPT19_VOLTAGE_DEFAULT_CODE) {} + /** + * @brief Destroy the EverlightALSPT19_Voltage object - no action needed. + */ + ~EverlightALSPT19_Voltage() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [relative current output](@ref sensor_alspt19_current) from an + * [Everlight ALS-PT19](@ref sensor_alspt19). + */ +/* clang-format on */ +class EverlightALSPT19_Current : public Variable { + public: + /** + * @brief Construct a new EverlightALSPT19_Current object. + * + * @param parentSense The parent EverlightALSPT19 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 "ALSPT19Current". + */ + explicit EverlightALSPT19_Current( + EverlightALSPT19* parentSense, const char* uuid = "", + const char* varCode = ALSPT19_CURRENT_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)ALSPT19_CURRENT_VAR_NUM, + (uint8_t)ALSPT19_CURRENT_RESOLUTION, + ALSPT19_CURRENT_VAR_NAME, ALSPT19_CURRENT_UNIT_NAME, varCode, + uuid) {} + /** + * @brief Construct a new EverlightALSPT19_Current object. + * + * @note This must be tied with a parent EverlightALSPT19 before it can be + * used. + */ + EverlightALSPT19_Current() + : Variable((const uint8_t)ALSPT19_CURRENT_VAR_NUM, + (uint8_t)ALSPT19_CURRENT_RESOLUTION, + ALSPT19_CURRENT_VAR_NAME, ALSPT19_CURRENT_UNIT_NAME, + ALSPT19_CURRENT_DEFAULT_CODE) {} + /** + * @brief Destroy the EverlightALSPT19_Current object - no action needed. + */ + ~EverlightALSPT19_Current() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [calculated illuminance output](@ref sensor_alspt19_illuminance) from an + * [Everlight ALS-PT19](@ref sensor_alspt19). + */ +/* clang-format on */ +class EverlightALSPT19_Illuminance : public Variable { + public: + /** + * @brief Construct a new EverlightALSPT19_Illuminance object. + * + * @param parentSense The parent EverlightALSPT19 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 "ALSPT19Lux". + */ + explicit EverlightALSPT19_Illuminance( + EverlightALSPT19* parentSense, const char* uuid = "", + const char* varCode = ALSPT19_ILLUMINANCE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)ALSPT19_ILLUMINANCE_VAR_NUM, + (uint8_t)ALSPT19_ILLUMINANCE_RESOLUTION, + ALSPT19_ILLUMINANCE_VAR_NAME, ALSPT19_ILLUMINANCE_UNIT_NAME, + varCode, uuid) {} + /** + * @brief Construct a new EverlightALSPT19_Illuminance object. + * + * @note This must be tied with a parent EverlightALSPT19 before it can be + * used. + */ + EverlightALSPT19_Illuminance() + : Variable((const uint8_t)ALSPT19_ILLUMINANCE_VAR_NUM, + (uint8_t)ALSPT19_ILLUMINANCE_RESOLUTION, + ALSPT19_ILLUMINANCE_VAR_NAME, ALSPT19_ILLUMINANCE_UNIT_NAME, + ALSPT19_ILLUMINANCE_DEFAULT_CODE) {} + /** + * @brief Destroy the EverlightALSPT19_Illuminance object - no action + * needed. + */ + ~EverlightALSPT19_Illuminance() {} +}; +/**@}*/ +#endif // SRC_SENSORS_EVERLIGHTALSPT19_H_ From 754af9f156a460d7a960b927d9143ea65a714cc3 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 18 Mar 2022 18:07:51 -0400 Subject: [PATCH 54/94] Fix illuminance unit mangnitude Signed-off-by: Sara Damiano --- docs/Modem-Notes.md | 3 +- examples/menu_a_la_carte/ReadMe.md | 21 ++++++++++ examples/menu_a_la_carte/menu_a_la_carte.ino | 42 ++++++++++---------- src/sensors/EverlightALSPT19.cpp | 3 +- 4 files changed, 46 insertions(+), 23 deletions(-) diff --git a/docs/Modem-Notes.md b/docs/Modem-Notes.md index 457e65de3..d39db54d7 100644 --- a/docs/Modem-Notes.md +++ b/docs/Modem-Notes.md @@ -184,6 +184,8 @@ Here are the pin numbers to use for modules that can be attached directly to an | Module | Power | Status | Reset | Sleep Request | | :-----------------------------------------------: | :---: | :----: | :------------: | :------------: | +| EnviroDIY WiFi Bee (ESP32) | 18¹ | -1 | A53 | -1 | +| EnviroDIY LTE Bee (SIM7080G) | 18¹ | 19 | N/A | 234 | | Digi XBee/XBee3, all variants (direct connection) | 18¹ | 19² | A53 | 23 | | DFRobot WiFi Bee (ESP8266) | 18¹ | -1 | -1 | -1 | | Dragino NB IOT Bee (BG96) | 18¹ | -1 | A53 | -1 | @@ -191,7 +193,6 @@ Here are the pin numbers to use for modules that can be attached directly to an | Sodaq GPRSBee R6 or R7 (SIM800H) | 23 | 19 | N/A | N/A | | Sodaq UBee LTE-M (u-blox SARA R410M) | 23 | 19 | A53 | 20 | | Sodaq UBee 3G (u-blox SARA U201) | 23 | 19 | A53 | 20 | -| EnviroDIY LTE Bee (SIM7080G) | 18¹ | 19 | N/A | 234 | ¹ This assumes you have not changed solder jumper 18. If you have switched SJ18 to connect bee pin one directly to 3.3V, use -1. diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 069d51472..6e2674a8d 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -70,6 +70,7 @@ ___ - [Campbell OBS3+ Analog Turbidity Sensor](#campbell-obs3-analog-turbidity-sensor) - [Decagon CTD-10 Conductivity, Temperature, and Depth Sensor](#decagon-ctd-10-conductivity-temperature-and-depth-sensor) - [Decagon ES2 Conductivity and Temperature Sensor](#decagon-es2-conductivity-and-temperature-sensor) + - [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) - [In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe](#in-situ-rdo-pro-x-rugged-dissolved-oxygen-probe) @@ -86,6 +87,7 @@ ___ - [Meter Teros 11 Soil Moisture Sensor](#meter-teros-11-soil-moisture-sensor) - [PaleoTerra Redox Sensors](#paleoterra-redox-sensors) - [Trinket-Based Tipping Bucket Rain Gauge](#trinket-based-tipping-bucket-rain-gauge) + - [Sensirion SHT4X Digital Humidity and Temperature Sensor](#sensirion-sht4x-digital-humidity-and-temperature-sensor) - [Northern Widget Tally Event Counter](#northern-widget-tally-event-counter) - [TI INA219 High Side Current Sensor](#ti-ina219-high-side-current-sensor) - [Turner Cyclops-7F Submersible Fluorometer](#turner-cyclops-7f-submersible-fluorometer) @@ -773,6 +775,16 @@ The data pin must be a pin that supports pin-change interrupts. ___ +#### Everlight ALS-PT19 Ambient Light Sensor + +@see @ref sensor_alspt19 + +[//]: # ( @menusnip{everlight_alspt19} ) + +___ + + + ### External Voltage via TI ADS1x15 The Arduino pin controlling power on/off and the analog data channel _on the TI ADS1115_ are required for the sensor constructor. @@ -969,6 +981,15 @@ Note that you cannot input a number of measurements to average because averaging ___ +#### Sensirion SHT4X Digital Humidity and Temperature Sensor + +@see @ref sensor_sht4x + +[//]: # ( @menusnip{sensirion_sht4x} ) + +___ + + ### Northern Widget Tally Event Counter This is for use with Northern Widget's Tally event counter 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 837aaa373..56a8fefbb 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -287,7 +287,7 @@ 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 -// The pin numbers here are for a Digi XBee with a Mayfly and LTE adapter +// The pin numbers here are for a Digi XBee with a Mayfly 0.x and LTE adapter // For options https://github.com/EnviroDIY/LTEbee-Adapter/edit/master/README.md const int8_t modemVccPin = -1; // MCU pin controlling modem power // Option: modemVccPin = A5, if Mayfly SJ7 is @@ -327,7 +327,7 @@ 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 -// The pin numbers here are for a Digi XBee with a Mayfly and LTE adapter +// The pin numbers here are for a Digi XBee with a Mayfly 0.x and LTE adapter const int8_t modemVccPin = A5; // MCU pin controlling modem power const int8_t modemStatusPin = 19; // MCU pin used to read modem status // NOTE: If possible, use the `STATUS/SLEEP_not` (XBee pin 13) for status, but @@ -399,13 +399,13 @@ 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 -// The pin numbers here are for a Digi XBee direcly connected to a Mayfly -const int8_t modemVccPin = -1; // MCU pin controlling modem power +// The pin numbers here are for a Digi XBee direcly connected to a Mayfly 1.x +const int8_t modemVccPin = 18; // MCU pin controlling modem power const int8_t modemStatusPin = 19; // MCU pin used to read modem status // NOTE: If possible, use the `STATUS/SLEEP_not` (XBee pin 13) for status, but // the CTS pin can also be used if necessary const bool useCTSforStatus = true; // Flag to use the CTS pin for status -const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin +const int8_t modemResetPin = A5; // 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 @@ -442,9 +442,9 @@ const int32_t modemBaud = 115200; // Communication speed of the modem // 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 = A5; // MCU pin controlling modem power +const int8_t modemVccPin = 18; // MCU pin controlling modem power const int8_t modemStatusPin = -1; // MCU pin used to read modem status -const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin +const int8_t modemResetPin = A5; // MCU pin connected to modem reset pin const int8_t modemSleepRqPin = 19; // MCU pin for wake from light sleep const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem // status @@ -485,11 +485,11 @@ const int32_t modemBaud = 115200; // Communication speed of the modem // 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 modified Mayfly and a Dragino IoT Bee -const int8_t modemVccPin = -1; // MCU pin controlling modem power +// Example pins here are for a Mayfly 1.x and a Dragino IoT Bee +const int8_t modemVccPin = 18; // MCU pin controlling modem power const int8_t modemStatusPin = -1; // MCU pin used to read modem status -const int8_t modemResetPin = A4; // MCU pin connected to modem reset pin -const int8_t modemSleepRqPin = A3; // MCU pin for modem sleep/wake request +const int8_t modemResetPin = A5; // MCU pin connected to modem reset pin +const int8_t modemSleepRqPin = -1; // MCU pin for modem sleep/wake request const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem // status @@ -521,7 +521,7 @@ const int32_t modemBaud = 921600; // Default baud rate of SVZM20 is 921600 // Modem Pins - Describe the physical pin connection of your modem to your board // NOTE: Use -1 for pins that do not apply // Nimbelink Skywire (NOT directly connectable to a Mayfly!) -const int8_t modemVccPin = -1; // MCU pin controlling modem power +const int8_t modemVccPin = 18; // MCU pin controlling modem power const int8_t modemStatusPin = 19; // MCU pin used to read modem 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 @@ -552,7 +552,7 @@ const int32_t modemBaud = 9600; // SIM800 does auto-bauding by default // Modem Pins - Describe the physical pin connection of your modem to your board // NOTE: Use -1 for pins that do not apply -// Example pins are for a Sodaq GPRSBee R4 with a Mayfly +// Example pins are for a Sodaq GPRSBee R4 with a Mayfly 0.x const int8_t modemVccPin = -1; // MCU pin controlling modem power const int8_t modemStatusPin = 19; // MCU pin used to read modem status const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin @@ -583,9 +583,9 @@ const int32_t modemBaud = 9600; // SIM7000 does auto-bauding 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 = -1; // MCU pin controlling modem power -const int8_t modemStatusPin = -1; // MCU pin used to read modem status -const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin +const int8_t modemVccPin = 18; // MCU pin controlling modem power +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 for modem sleep/wake request const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem // status @@ -615,7 +615,7 @@ const int32_t modemBaud = // Modem Pins - Describe the physical pin connection of your modem to your board // NOTE: Use -1 for pins that do not apply // and-global breakout bk-7080a -const int8_t modemVccPin = -1; // MCU pin controlling modem power +const int8_t modemVccPin = 18; // MCU pin controlling modem power 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 @@ -645,7 +645,7 @@ const int32_t modemBaud = 9600; // SIM800 does auto-bauding by default // Modem Pins - Describe the physical pin connection of your modem to your board // NOTE: Use -1 for pins that do not apply -// Example pins are for a Sodaq GPRSBee R6 or R7 with a Mayfly +// Example pins are for a Sodaq GPRSBee R6 or R7 with a Mayfly 0.x const int8_t modemVccPin = 23; // MCU pin controlling modem power const int8_t modemStatusPin = 19; // MCU pin used to read modem status const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin @@ -682,7 +682,7 @@ const int32_t modemBaud = // Modem Pins - Describe the physical pin connection of your modem to your board // NOTE: Use -1 for pins that do not apply -// Example pins are for a Sodaq uBee R410M with a Mayfly +// Example pins are for a Sodaq uBee R410M with a Mayfly 0.x const int8_t modemVccPin = 23; // MCU pin controlling modem power const int8_t modemStatusPin = 19; // MCU pin used to read modem status const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin @@ -714,7 +714,7 @@ const int32_t modemBaud = // Modem Pins - Describe the physical pin connection of your modem to your board // NOTE: Use -1 for pins that do not apply -// Example pins are for a Sodaq uBee U201 with a Mayfly +// Example pins are for a Sodaq uBee U201 with a Mayfly 0.x const int8_t modemVccPin = 23; // MCU pin controlling modem power const int8_t modemStatusPin = 19; // MCU pin used to read modem status const int8_t modemResetPin = -1; // MCU pin connected to modem reset pin @@ -1233,7 +1233,7 @@ Variable* es2Temp = new DecagonES2_Temp(&es2, // NOTE: Use -1 for any pins that don't apply or aren't being used. const int8_t alsPower = sensorPowerPin; // Power pin -const int8_t alsData = 7; // The ALS PT-19 data pin +const int8_t alsData = A4; // The ALS PT-19 data pin const int8_t alsSupply = 3.3; // The ALS PT-19 supply power voltage const int8_t alsResistance = 10; // The ALS PT-19 loading resistance (in kΩ) const uint8_t alsNumberReadings = 10; diff --git a/src/sensors/EverlightALSPT19.cpp b/src/sensors/EverlightALSPT19.cpp index 15221dfee..4532e5674 100644 --- a/src/sensors/EverlightALSPT19.cpp +++ b/src/sensors/EverlightALSPT19.cpp @@ -67,7 +67,8 @@ bool EverlightALSPT19::addSingleMeasurementResult(void) { // convert bits to volts volt_val = (_supplyVoltage / ALSPT19_ADC_MAX) * sensor_adc; // convert volts to current - current_val = volt_val / _loadResistor; + // resistance is entered in kΩ and we want µA + current_val = (volt_val / (_loadResistor * 1000)) * 1e6; // convert current to illuminance // from sensor datasheet, typical 200µA current for1000 Lux lux_val = current_val * (1000. / 200.); From 7998a9d994fe74f3994b24017195d2867e7ee318 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 21 Mar 2022 17:08:18 +0000 Subject: [PATCH 55/94] ci: bump actions/cache from 2.1.7 to 3 Bumps [actions/cache](https://github.com/actions/cache) from 2.1.7 to 3. - [Release notes](https://github.com/actions/cache/releases) - [Commits](https://github.com/actions/cache/compare/v2.1.7...v3) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build_documentation.yaml | 4 ++-- .github/workflows/build_examples_arduino_cli.yaml | 2 +- .github/workflows/build_examples_platformio.yaml | 2 +- .github/workflows/build_menu.yaml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index fa002d219..f066adcd6 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -26,7 +26,7 @@ jobs: uses: actions/setup-python@v3 - name: Restore Python Dependencies - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 id: cache_python with: path: ~/.cache/pip @@ -43,7 +43,7 @@ jobs: - name: Restore Doxygen id: cache_doxygen - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 with: path: doxygen-src key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }} diff --git a/.github/workflows/build_examples_arduino_cli.yaml b/.github/workflows/build_examples_arduino_cli.yaml index e70b46a7b..9e92b9885 100644 --- a/.github/workflows/build_examples_arduino_cli.yaml +++ b/.github/workflows/build_examples_arduino_cli.yaml @@ -54,7 +54,7 @@ jobs: uses: arduino/setup-arduino-cli@v1.1.1 - name: Restore Arduino Platforms and Libraries - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 id: cache_arduino with: path: home/arduino diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml index fa8a625db..1c1d65790 100644 --- a/.github/workflows/build_examples_platformio.yaml +++ b/.github/workflows/build_examples_platformio.yaml @@ -49,7 +49,7 @@ jobs: pip install --upgrade platformio - name: Restore PlatformIO Platforms and Libraries - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 id: cache_libraries with: path: ~/.platformio diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index a8777da81..aa2e0e072 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -215,7 +215,7 @@ jobs: uses: arduino/setup-arduino-cli@v1.1.1 - name: Restore PlatformIO and Arduino platforms and libraries - uses: actions/cache@v2.1.7 + uses: actions/cache@v3 id: cache_libraries with: path: | From 73430e5eacd5de9506ad668333c5e66bdc3b665e Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 21 Mar 2022 13:43:30 -0400 Subject: [PATCH 56/94] Corrected variable counts Signed-off-by: Sara Damiano --- src/sensors/EverlightALSPT19.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/sensors/EverlightALSPT19.h b/src/sensors/EverlightALSPT19.h index 90a69af7f..15234a4cf 100644 --- a/src/sensors/EverlightALSPT19.h +++ b/src/sensors/EverlightALSPT19.h @@ -55,6 +55,7 @@ // Included Dependencies #include "ModSensorDebugger.h" #undef MS_DEBUGGING_STD +#undef MS_DEBUGGING_DEEP #include "VariableBase.h" #include "SensorBase.h" @@ -62,12 +63,12 @@ /**@{*/ // Sensor Specific Defines -/// @brief Sensor::_numReturnedValues; the ALS-PT19 can report 1 value -/// (voltage). -#define ALSPT19_NUM_VARIABLES 1 +/// @brief Sensor::_numReturnedValues; the ALS-PT19 can report 1 "raw" value +/// (voltage) and we calculate current and illuminance from it. +#define ALSPT19_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we calculate photocurrent from the supply /// voltage and loading resistance and illuminance from the photocurrent. -#define ALSPT19_INC_CALC_VARIABLES 1 +#define ALSPT19_INC_CALC_VARIABLES 2 /// @brief The power pin for the ALS on the EnviroDIY Mayfly v1.x #define MAYFLY_ALS_POWER_PIN -1 /// @brief The data pin for the ALS on the EnviroDIY Mayfly v1.x From d56ae9c68ff3311005027732573bdf1aec306ffd Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Mon, 21 Mar 2022 14:55:44 -0400 Subject: [PATCH 57/94] Allow pin mode to be selected and changed default for button Signed-off-by: Sara Damiano --- ChangeLog.md | 13 ++- .../interrupt_counter/interrupt_counter.ino | 49 ++++++++--- src/LoggerBase.cpp | 88 +++++++++---------- src/LoggerBase.h | 64 +++++++++++--- src/LoggerModem.h | 2 +- 5 files changed, 142 insertions(+), 74 deletions(-) diff --git a/ChangeLog.md b/ChangeLog.md index bb7f1c5d1..308813016 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -30,12 +30,21 @@ We recommend a logger's real time clock always be set in UTC and then localized - **Breaking:** Renamed the function `setNowEpoch(uint32_t)` to `setNowUTCEpoch(uint32_t)`. - Although public, this was never intended to be used externally. - **Breaking:** Renamed the YosemiTech Y550 COD sensor as Y551. See below. -- Added a longer warm up time and removed some of the set-up to work with the ESP-IDF AT firmware versions >2.0 +- **Potentially Breaking:** Changed the default "button" interrupt pin mode from `INPUT_PULLUP` to `INPUT` and created optional arguments to the `setTestingModePin` and `setLoggerPins` functions to specify the pin mode and pull-up resistor state. + - `INPUT` is the proper mode for the Mayfly. +The Mayfly has an external pull *down* on the button pin with the button being active high. +This means having the pull-up resistors on negates the button signal. +The pin mode had been set incorrectly as `INPUT_PULLUP` for the button since way back in [July of 2017](https://github.com/EnviroDIY/ModularSensors/commit/6bafb0fd149589f71ca6f46b761fe72b1f9523a6). +By some electrical luck, with the 0.x versions of the Mayfly, the external pull-down on the button pin was strong enough to out-weigh the incorretly activated pull-up resistors and an interrupt was still registered when the button was pressed. +Despite the identical processor and pull-up resistors on the Mayfly 1.x, the button no longer registers with the pull-up resistors active. +So, for most of our users with Mayflies, this will be a _**fix**_. +But for anyone using a different board/processor/button configuration that depended on the processor pull-up resistors, this will be a breaking change and they will need to specify the button mode in the `setTestingModePin` or `setLoggerPins` function to return to the previous behavior. +- Added a longer warm up time and removed some of the modem set-up to work with the ESP-IDF AT firmware versions >2.0 - Made sure that all example clock synchronization happens at noon instead of midnight. -- **Documentation:** Migrated to latest version of Doxygen (1.9.3). - Renamed class "MPL115A2" to "FreescaleMPL115A2" and all related variable classes. This is for consistency with the file name and other classes with manufacturer in the name. This is *not* a breaking change at this time; the old class names are still usable. +- **Documentation:** Migrated to latest version of Doxygen (1.9.3). ### Added - **Sensor** Added support for the [YosemiTech Y551 COD Sensor](http://en.yosemitech.com/aspcms/product/2020-5-8/94.html), which makes a UV254 light absorption and translates it to estimates of Chemical Oxygen Demand (COD) (or Total Organic Carbon (TOC)) and Turbidity. diff --git a/extras/interrupt_counter/interrupt_counter.ino b/extras/interrupt_counter/interrupt_counter.ino index 19b342d78..5dec9af2b 100644 --- a/extras/interrupt_counter/interrupt_counter.ino +++ b/extras/interrupt_counter/interrupt_counter.ino @@ -1,27 +1,52 @@ #include -#include -int8_t interruptPin = 10; -uint32_t numberInterrupts = 0; +#define EI_ARDUINO_INTERRUPTED_PIN +#include +const uint8_t firstInterruptPin = 2; +const uint8_t lastInterruptPin = 31; +int interrupCounts[lastInterruptPin - firstInterruptPin + 1]; +char buffer[12]; void pinInterrupt() { - numberInterrupts++; + interrupCounts[arduinoInterruptedPin - firstInterruptPin] = + interrupCounts[arduinoInterruptedPin - firstInterruptPin] + 1; + Serial.print(arduinoInterruptedPin); + Serial.print("-->"); + Serial.println(arduinoPinState); } void setup() { Serial.begin(115200); - pinMode(interruptPin, INPUT_PULLUP); - enableInterrupt(interruptPin, pinInterrupt, CHANGE); + Serial.print("Time, "); + for (int i = 0; i < lastInterruptPin - firstInterruptPin; i++) { + sprintf(buffer, "%3d", i + firstInterruptPin); + Serial.print(buffer); + Serial.print(","); + } + sprintf(buffer, "%3d", lastInterruptPin); + Serial.println(buffer); + for (int i = 0; i <= lastInterruptPin - firstInterruptPin; i++) { + pinMode(i + firstInterruptPin, INPUT); + enableInterrupt(i + firstInterruptPin, pinInterrupt, CHANGE); + interrupCounts[i] = 0; + } } void loop() { - Serial.print("By "); - Serial.print(millis()); - Serial.print(" total changes on pin "); - Serial.print(interruptPin); - Serial.print(" is "); - Serial.println(numberInterrupts); + sprintf(buffer, "%8u", millis()); + Serial.print(buffer); + Serial.print(","); + for (int i = 0; i < lastInterruptPin - firstInterruptPin; i++) { + sprintf(buffer, "%3d", interrupCounts[i]); + Serial.print(buffer); + Serial.print(","); + } + sprintf(buffer, "%3d", + interrupCounts[lastInterruptPin - firstInterruptPin]); + Serial.println(buffer); + Serial.print("Pin 21 is "); + Serial.println(digitalRead(21)); delay(1000); } diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 17dc66135..cc320eb3b 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -55,11 +55,13 @@ Logger::Logger(const char* loggerID, uint16_t loggingIntervalMinutes, startTesting = false; // Set the initial pin values + // NOTE: Only setting values here, not the pin mode. + // The pin mode can only be set at run time, not here at compile time. _SDCardPowerPin = -1; - setSDCardSS(SDCardSSPin); - setRTCWakePin(mcuWakePin); - _ledPin = -1; - _buttonPin = -1; + _SDCardSSPin = SDCardSSPin; + _mcuWakePin = mcuWakePin; + _ledPin = -1; + _buttonPin = -1; // Initialize with no file name _fileName = ""; @@ -171,6 +173,7 @@ void Logger::setSDCardPwr(int8_t SDCardPowerPin) { if (_SDCardPowerPin >= 0) { pinMode(_SDCardPowerPin, OUTPUT); digitalWrite(_SDCardPowerPin, LOW); + MS_DBG(F("Pin"), _SDCardPowerPin, F("set as SD Card Power Pin")); } } // NOTE: Structure of power switching on SD card taken from: @@ -185,7 +188,7 @@ void Logger::turnOnSDcard(bool waitToSettle) { void Logger::turnOffSDcard(bool waitForHousekeeping) { if (_SDCardPowerPin >= 0) { // TODO(SRGDamia1): set All SPI pins to INPUT? - // TODO(SRGDamia1): set ALL SPI pins HIGH (~30k pullup) + // TODO(SRGDamia1): set ALL SPI pins HIGH (~30k pull-up) pinMode(_SDCardPowerPin, OUTPUT); digitalWrite(_SDCardPowerPin, LOW); // TODO(SRGDamia1): wait in lower power mode @@ -200,7 +203,10 @@ void Logger::turnOffSDcard(bool waitForHousekeeping) { // Sets up a pin for the slave select (chip select) of the SD card void Logger::setSDCardSS(int8_t SDCardSSPin) { _SDCardSSPin = SDCardSSPin; - if (_SDCardSSPin >= 0) { pinMode(_SDCardSSPin, OUTPUT); } + if (_SDCardSSPin >= 0) { + pinMode(_SDCardSSPin, OUTPUT); + MS_DBG(F("Pin"), _SDCardSSPin, F("set as SD Card Slave/Chip Select")); + } } @@ -212,16 +218,25 @@ void Logger::setSDCardPins(int8_t SDCardSSPin, int8_t SDCardPowerPin) { // Sets up the wake up pin for an RTC interrupt -void Logger::setRTCWakePin(int8_t mcuWakePin) { +// NOTE: This sets the pin mode but does NOT enable the interrupt! +void Logger::setRTCWakePin(int8_t mcuWakePin, uint8_t wakePinMode) { _mcuWakePin = mcuWakePin; - if (_mcuWakePin >= 0) { pinMode(_mcuWakePin, INPUT_PULLUP); } + if (_mcuWakePin >= 0) { + pinMode(_mcuWakePin, wakePinMode); + MS_DBG(F("Pin"), _mcuWakePin, F("set as RTC wake up pin")); + } else { + MS_DBG(F("Logger mcu will not sleep between readings!")); + } } // Sets up a pin for an LED or other way of alerting that data is being logged void Logger::setAlertPin(int8_t ledPin) { _ledPin = ledPin; - if (_ledPin >= 0) { pinMode(_ledPin, OUTPUT); } + if (_ledPin >= 0) { + pinMode(_ledPin, OUTPUT); + MS_DBG(F("Pin"), _ledPin, F("set as LED alert pin")); + } } void Logger::alertOn() { if (_ledPin >= 0) { digitalWrite(_ledPin, HIGH); } @@ -232,15 +247,17 @@ void Logger::alertOff() { // Sets up a pin for an interrupt to enter testing mode -void Logger::setTestingModePin(int8_t buttonPin) { +void Logger::setTestingModePin(int8_t buttonPin, uint8_t buttonPinMode) { _buttonPin = buttonPin; // Set up the interrupt to be able to enter sensor testing mode // NOTE: Entering testing mode before the sensors have been set-up may // give unexpected results. if (_buttonPin >= 0) { - pinMode(_buttonPin, INPUT_PULLUP); + pinMode(_buttonPin, buttonPinMode); enableInterrupt(_buttonPin, Logger::testingISR, CHANGE); + MS_DBG(F("Button on pin"), _buttonPin, + F("can be used to enter sensor testing mode.")); } } @@ -248,11 +265,12 @@ void Logger::setTestingModePin(int8_t buttonPin) { // Sets up the five pins of interest for the logger void Logger::setLoggerPins(int8_t mcuWakePin, int8_t SDCardSSPin, int8_t SDCardPowerPin, int8_t buttonPin, - int8_t ledPin) { - setRTCWakePin(mcuWakePin); + int8_t ledPin, uint8_t wakePinMode, + uint8_t buttonPinMode) { + setRTCWakePin(mcuWakePin, wakePinMode); setSDCardSS(SDCardSSPin); setSDCardPwr(SDCardPowerPin); - setTestingModePin(buttonPin); + setTestingModePin(buttonPin, buttonPinMode); setAlertPin(ledPin); } @@ -715,7 +733,7 @@ bool Logger::checkMarkedInterval(void) { // This must be a static function (which means it can only call other static // funcions.) void Logger::wakeISR(void) { - // MS_DBG(F("\nClock interrupt!")); + MS_DEEP_DBG(F("\nClock interrupt!")); } @@ -1279,10 +1297,10 @@ void Logger::checkForTestingMode(int8_t buttonPin) // A static function if you'd prefer to enter testing based on an interrupt void Logger::testingISR() { - // MS_DBG(F("Testing interrupt!")); + MS_DEEP_DBG(F("Testing interrupt!")); if (!Logger::isTestingNow && !Logger::isLoggingNow) { Logger::startTesting = true; - // MS_DBG(F("Testing flag has been set.")); + MS_DEEP_DBG(F("Testing flag has been set.")); } } @@ -1326,7 +1344,7 @@ void Logger::testingMode() { // 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 straigh pass-through to + // getModemSignalQuality() is just a straight pass-through to // getSignalQuality(). _logModem->updateModemMetadata(); @@ -1401,29 +1419,6 @@ void Logger::begin() { // Enable the watchdog watchDogTimer.enableWatchDog(); - // Set pin modes for sd card power - if (_SDCardPowerPin >= 0) { - pinMode(_SDCardPowerPin, OUTPUT); - digitalWrite(_SDCardPowerPin, LOW); - MS_DBG(F("Pin"), _SDCardPowerPin, F("set as SD Card Power Pin")); - } - // Set pin modes for sd card slave select (aka chip select) - if (_SDCardSSPin >= 0) { - pinMode(_SDCardSSPin, OUTPUT); - MS_DBG(F("Pin"), _SDCardSSPin, F("set as SD Card Slave/Chip Select")); - } - // Set pin mode for LED pin - if (_ledPin >= 0) { - pinMode(_ledPin, OUTPUT); - MS_DBG(F("Pin"), _ledPin, F("set as LED alert pin")); - } - if (_buttonPin >= 0) { - pinMode(_buttonPin, INPUT_PULLUP); - enableInterrupt(_buttonPin, Logger::testingISR, CHANGE); - MS_DBG(F("Button on pin"), _buttonPin, - F("can be used to enter sensor testing mode.")); - } - #if defined ARDUINO_ARCH_SAMD MS_DBG(F("Beginning internal real time clock")); zero_sleep_rtc.begin(); @@ -1451,13 +1446,12 @@ void Logger::begin() { // the timeout period is a useless delay. Wire.setTimeout(0); + // Set all of the pin modes + // NOTE: This must be done here at run time not at compile time + setLoggerPins(_mcuWakePin, _SDCardSSPin, _SDCardPowerPin, _buttonPin, + _ledPin); + #if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD - if (_mcuWakePin < 0) { - MS_DBG(F("Logger mcu will not sleep between readings!")); - } else { - pinMode(_mcuWakePin, INPUT_PULLUP); - MS_DBG(F("Pin"), _mcuWakePin, F("set as RTC wake up pin")); - } MS_DBG(F("Beginning DS3231 real time clock")); rtc.begin(); #endif diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 275e3713a..bcb7ccc91 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -21,9 +21,14 @@ #define MS_DEBUGGING_STD "LoggerBase" #endif +#ifdef MS_LOGGERBASE_DEBUG_DEEP +#define MS_DEBUGGING_DEEP "LoggerBase" +#endif + // Included Dependencies #include "ModSensorDebugger.h" #undef MS_DEBUGGING_STD +#undef MS_DEBUGGING_DEEP #include "VariableArray.h" #include "LoggerModem.h" @@ -224,7 +229,8 @@ class Logger { /** * @brief Set a pin for the slave select (chip select) of the SD card. * - * This over-writes the value (if any) given in the constructor. + * This over-writes the value (if any) given in the constructor. The pin + * mode of this pin will be set as `OUTPUT`. * * @param SDCardSSPin The pin on the mcu connected to the slave select of * the SD card. @@ -234,7 +240,8 @@ class Logger { /** * @brief Set both pins related to the SD card. * - * These over-write the values (if any) given in the constructor. + * These over-write the values (if any) given in the constructor. The pin + * mode of this pin will be set as `OUTPUT`. * * @param SDCardSSPin The pin on the mcu connected to the slave select of * the SD card. @@ -252,16 +259,23 @@ class Logger { * SAMD board with the internal RTC, the value of the pin is irrelevant as * long as it is positive. * + * @note This sets the pin mode but does NOT enable the interrupt! + * * @param mcuWakePin The pin on the mcu to be used to wake the mcu from deep * sleep. + * @param wakePinMode The pin mode to be used for wake up on the clock alert + * pin. Must be either `INPUT` OR `INPUT_PULLUP`. Optional with a default + * value of `INPUT_PULLUP`. The DS3231 has an active low interrupt, so the + * pull-up resistors should be enabled. */ - void setRTCWakePin(int8_t mcuWakePin); + void setRTCWakePin(int8_t mcuWakePin, uint8_t wakePinMode = INPUT_PULLUP); /** * @brief Set a pin to put out an alert that a measurement is being logged. * - * This is intended to be a pin with a LED on it so you can see the light - * come on when a measurement is being taken. + * The pin mode of this pin will be set as `OUTPUT`. This is intended to be + * a pin with a LED on it so you can see the light come on when a + * measurement is being taken. * * @param ledPin The pin on the mcu to be held `HIGH` while sensor data is * being collected and logged. @@ -277,7 +291,8 @@ class Logger { void alertOff(); /** - * @brief Set up a pin for an interrupt to enter testing mode. + * @brief Set up a pin for an interrupt to enter testing mode **and** attach + * the testing interrupt to it. * * Intended to be attached to a button or other manual interrupt source. * @@ -289,25 +304,50 @@ class Logger { * * @param buttonPin The pin on the mcu to listen to for a value-change * interrupt. + * @param buttonPinMode The pin mode to be used for the button pin. Must be + * either `INPUT` OR `INPUT_PULLUP`. Optional with a default value of + * `INPUT`. Using `INPUT_PULLUP` will enable processor input resistors, + * while using `INPUT` will explicitly disable them. If your pin is + * externally pulled down or the button is a normally open (NO) switch with + * common (COM) connected to Vcc, like the EnviroDIY Mayfly), you should use + * the `INPUT` pin mode. Coversely, if your button connect to ground when + * activated, you should enable the processor pull-up resistors using + * `INPUT_PULLUP`. */ - void setTestingModePin(int8_t buttonPin); + void setTestingModePin(int8_t buttonPin, uint8_t buttonPinMode = INPUT); /** * @brief Set the five pins of interest for the logger * * @param mcuWakePin The pin on the mcu to listen to for a value-change - * interrupt to wake from deep sleep. + * interrupt to wake from deep sleep. This pin will be set to * @param SDCardSSPin The pin on the mcu connected to the slave select of - * the SD card. + * the SD card. The pin mode of this pin will be set as `OUTPUT`. * @param SDCardPowerPin A digital pin number on the mcu controlling power - * to the SD card. + * to the SD card. The pin mode of this pin will be set as `OUTPUT`. * @param buttonPin The pin on the mcu to listen to for a value-change * interrupt to enter testing mode. * @param ledPin The pin on the mcu to be held `HIGH` while sensor data is - * being collected and logged. + * being collected and logged. The pin mode of this pin will be set as + * `OUTPUT`. + * @param wakePinMode The pin mode to be used for wake up on the clock alert + * pin. Must be either `INPUT` OR `INPUT_PULLUP`. Optional with a default + * value of `INPUT_PULLUP`. The DS3231 has an active low interrupt, so the + * pull-up resistors should be enabled. + * @param buttonPinMode The pin mode to be used for the button pin. Must be + * either `INPUT` OR `INPUT_PULLUP`. Optional with a default value of + * `INPUT`. Using `INPUT_PULLUP` will enable processor input resistors, + * while using `INPUT` will explicitly disable them. If your pin is + * externally pulled down or the button is a normally open (NO) switch with + * common (COM) connected to Vcc, like the EnviroDIY Mayfly), you should use + * the `INPUT` pin mode. Coversely, if your button is active when connected + * to ground, you should enable the processor pull-up resistors using + * `INPUT_PULLUP`. */ void setLoggerPins(int8_t mcuWakePin, int8_t SDCardSSPin, - int8_t SDCardPowerPin, int8_t buttonPin, int8_t ledPin); + int8_t SDCardPowerPin, int8_t buttonPin, int8_t ledPin, + uint8_t wakePinMode = INPUT_PULLUP, + uint8_t buttonPinMode = INPUT); protected: // Initialization variables diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 4f8749133..2519f0aa7 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -700,7 +700,7 @@ class loggerModem { void modemLEDOff(void); /** * @brief Set the processor pin modes (input vs output, with and without - * pullup) for all pins connected between the modem module and the mcu. + * pull-up) for all pins connected between the modem module and the mcu. */ virtual void setModemPinModes(void); /**@}*/ From 11865f2b1041438eda162939c4f8d19e78dc6466 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Fri, 25 Mar 2022 16:49:49 -0700 Subject: [PATCH 58/94] Use a standard sensorEC_Konst 1.0 --- src/sensors/AnalogElecConductivity.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sensors/AnalogElecConductivity.h b/src/sensors/AnalogElecConductivity.h index f00be8cf7..f45272dc2 100644 --- a/src/sensors/AnalogElecConductivity.h +++ b/src/sensors/AnalogElecConductivity.h @@ -301,8 +301,9 @@ * Mine was around 2.9 with plugs being a standard size they should all be * around the same. If you get bad readings you can use the calibration script * and fluid to get a better estimate for K. + * Default to 1.0, and can be set at startup. */ -#define SENSOREC_KONST_DEF 2.88 +#define SENSOREC_KONST_DEF 1.0 #endif // SENSOREC_KONST_DEF /** From baf72532558484162ff75040800e237dda30849e Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 29 Mar 2022 17:31:13 -0400 Subject: [PATCH 59/94] working bmp390 Signed-off-by: Sara Damiano --- .github/workflows/build_menu.yaml | 3 + ChangeLog.md | 5 +- continuous_integration/dependencies.json | 148 ++-- .../install-deps-arduino-cli.sh | 3 + .../install-deps-platformio.sh | 3 + examples/menu_a_la_carte/ReadMe.md | 24 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 38 + library.json | 48 +- src/sensors/BoschBME280.h | 13 +- src/sensors/BoschBMP3xx.cpp | 316 ++++++++ src/sensors/BoschBMP3xx.h | 690 ++++++++++++++++++ src/sensors/EverlightALSPT19.h | 8 +- src/sensors/InSituTrollSdi12a.h | 7 + src/sensors/MeaSpecMS5803.h | 2 +- src/sensors/SensirionSHT4x.h | 6 +- 15 files changed, 1234 insertions(+), 80 deletions(-) create mode 100644 src/sensors/BoschBMP3xx.cpp create mode 100644 src/sensors/BoschBMP3xx.h diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index bf041f896..0416c0da7 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -82,6 +82,9 @@ jobs: - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_BOSCH_BME280 publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER + - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 + sensorFlag: BUILD_SENSOR_BOSCH_BMP3XX + publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_CAMPBELL_CLARI_VUE10 publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER diff --git a/ChangeLog.md b/ChangeLog.md index 308813016..725bbfea7 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -34,9 +34,9 @@ We recommend a logger's real time clock always be set in UTC and then localized - `INPUT` is the proper mode for the Mayfly. The Mayfly has an external pull *down* on the button pin with the button being active high. This means having the pull-up resistors on negates the button signal. -The pin mode had been set incorrectly as `INPUT_PULLUP` for the button since way back in [July of 2017](https://github.com/EnviroDIY/ModularSensors/commit/6bafb0fd149589f71ca6f46b761fe72b1f9523a6). +The pin mode had been set as `INPUT_PULLUP` for the button, backwards for the Mayfly, since [July of 2017](https://github.com/EnviroDIY/ModularSensors/commit/6bafb0fd149589f71ca6f46b761fe72b1f9523a6). By some electrical luck, with the 0.x versions of the Mayfly, the external pull-down on the button pin was strong enough to out-weigh the incorretly activated pull-up resistors and an interrupt was still registered when the button was pressed. -Despite the identical processor and pull-up resistors on the Mayfly 1.x, the button no longer registers with the pull-up resistors active. +With a different pull-down resistor on the Mayfly 1.x, the button no longer registers with the pull-up resistors active. So, for most of our users with Mayflies, this will be a _**fix**_. But for anyone using a different board/processor/button configuration that depended on the processor pull-up resistors, this will be a breaking change and they will need to specify the button mode in the `setTestingModePin` or `setLoggerPins` function to return to the previous behavior. - Added a longer warm up time and removed some of the modem set-up to work with the ESP-IDF AT firmware versions >2.0 @@ -54,6 +54,7 @@ This is *not* a breaking change at this time; the old class names are still usab - **Sensor** Added support for the SDI-12 In-Situ [Level TROLL 400, 500 & 700 Data Loggers](https://in-situ.com/pub/media/support/documents/LevelTROLL_SS.pdf) - **Sensor** Added support for the Sensirion SHT40 relative humidity and temperature sensor - **Sensor** Added support for the Everlight ALS-PT19 ambient light sensor +- **Sensor** Added support for the Bosch SensorTec BMP388 and BMP390 pressure sensors ### Removed diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 113ea2894..fb5ba9e34 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,14 +1,17 @@ { - "action_cache_version": 9, + "action_cache_version": 10, "dependencies": [ { "name": "EnviroDIY_DS3231", "owner": "envirodiy", "library id": "2079", - "url": "https://github.com/EnviroDIY/Sodaq_DS3231.git", + "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" }, @@ -16,10 +19,12 @@ "name": "RTCZero", "owner": "arduino-libraries", "library id": "873", - "url": "https://github.com/arduino-libraries/RTCZero.git", + "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" }, @@ -27,10 +32,12 @@ "name": "EnableInterrupt", "owner": "greygnome", "library id": "311", - "url": "https://github.com/GreyGnome/EnableInterrupt.git", + "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" }, @@ -38,10 +45,12 @@ "name": "SdFat", "owner": "greiman", "library id": "322", - "url": "https://github.com/greiman/SdFat.git", + "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" }, @@ -58,19 +70,23 @@ "name": "PubSubClient", "owner": "knolleary", "library id": "89", - "url": "https://github.com/knolleary/pubsubclient.git", + "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", "owner": "adafruit", "library id": "6214", - "url": "https://github.com/adafruit/Adafruit_BusIO.git", + "url": "https://github.com/adafruit/Adafruit_BusIO", "version": "~1.11.3", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -78,10 +94,12 @@ "name": "Adafruit Unified Sensor", "owner": "adafruit", "library id": "31", - "url": "https://github.com/adafruit/Adafruit_Sensor.git", + "url": "https://github.com/adafruit/Adafruit_Sensor", "version": "~1.1.5", "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": "*" }, @@ -99,10 +119,12 @@ "name": "Adafruit AM2315", "owner": "adafruit", "library id": "773", - "url": "https://github.com/adafruit/Adafruit_AM2315.git", + "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" }, @@ -110,10 +132,24 @@ "name": "Adafruit BME280 Library", "owner": "adafruit", "library id": "166", - "url": "https://github.com/adafruit/Adafruit_BME280_Library.git", + "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" + }, + { + "name": "BMP388_DEV", + "owner": "MartinL1", + "version": "https://github.com/MartinL1/BMP388_DEV.git", + "version_note": "~1.0.7", + "note": "An Arduino compatible, non-blocking, I2C/SPI library for the Bosch BMP388 barometer.", + "authors": [ + "Martin Lindupp" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -121,10 +157,12 @@ "name": "DHT sensor library", "owner": "adafruit", "library id": "19", - "url": "https://github.com/adafruit/DHT-sensor-library.git", + "url": "https://github.com/adafruit/DHT-sensor-library", "version": "~1.4.3", "note": "AOSong DHT Sensor Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -132,10 +170,12 @@ "name": "Adafruit INA219", "owner": "adafruit", "library id": "160", - "url": "https://github.com/adafruit/Adafruit_INA219.git", + "url": "https://github.com/adafruit/Adafruit_INA219", "version": "~1.2.0", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, @@ -143,10 +183,12 @@ "name": "Adafruit MPL115A2", "owner": "adafruit", "library id": "406", - "url": "https://github.com/adafruit/Adafruit_MPL115A2.git", + "url": "https://github.com/adafruit/Adafruit_MPL115A2", "version": "~2.0.0", "note": "MPL115A2 Barometer Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino" }, { @@ -156,14 +198,16 @@ "url": "https://github.com/adafruit/Adafruit_SHT4X", "version": "~1.0.0", "note": "Sensirion SHT4x Library by Adafruit", - "authors": ["Adafruit"], + "authors": [ + "Adafruit" + ], "frameworks": "arduino" }, { "name": "OneWire", "owner": "paulstoffregen", "library id": "1", - "url": "https://github.com/PaulStoffregen/OneWire.git", + "url": "https://github.com/PaulStoffregen/OneWire", "version": "~2.3.6", "note": "OneWire - Control 1-Wire protocol (DS18S20, DS18B20, DS2408 and etc)", "authors": [ @@ -187,10 +231,15 @@ "name": "DallasTemperature", "owner": "milesburton", "library id": "54", - "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library.git", + "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" }, @@ -199,7 +248,7 @@ "owner": "envirodiy", "library id": "1486", "version": "~2.1.4", - "url": "https://github.com/EnviroDIY/Arduino-SDI-12.git", + "url": "https://github.com/EnviroDIY/Arduino-SDI-12", "note": "EnviroDIY SDI-12 Library for Arduino", "author_notes": [ "Kevin M. Smith", @@ -214,17 +263,25 @@ "name": "MS5803", "owner": "northernwidget", "library id": "5431", - "url": "https://github.com/NorthernWidget/MS5803.git", + "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" }, @@ -232,10 +289,12 @@ "name": "SensorModbusMaster", "owner": "envirodiy", "library id": "1824", - "url": "https://github.com/EnviroDIY/SensorModbusMaster.git", + "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" }, @@ -243,21 +302,26 @@ "name": "KellerModbus", "owner": "envirodiy", "library id": "5439", - "url": "https://github.com/EnviroDIY/KellerModbus.git", + "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.git", + "url": "https://github.com/EnviroDIY/YosemitechModbus", "version": "~0.3.2", "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" } ] -} +} \ 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 18b16617d..0c59b9b32 100644 --- a/continuous_integration/install-deps-arduino-cli.sh +++ b/continuous_integration/install-deps-arduino-cli.sh @@ -75,6 +75,9 @@ arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "A echo "\n\e[32mInstalling Adafruit BME280 Library library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "Adafruit BME280 Library" +echo "\n\e[32mInstalling Adafruit BMP3XX Library library from Arduino library index\e[0m" +arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "Adafruit BMP3XX Library" + echo "\n\e[32mInstalling DHT sensor library library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "DHT sensor library" diff --git a/continuous_integration/install-deps-platformio.sh b/continuous_integration/install-deps-platformio.sh index 0710817b2..ff8fe4558 100644 --- a/continuous_integration/install-deps-platformio.sh +++ b/continuous_integration/install-deps-platformio.sh @@ -36,6 +36,9 @@ pio lib -g install adafruit/'Adafruit AM2315' echo "\e[32mInstalling adafruit/'Adafruit BME280 Library'\e[0m" pio lib -g install adafruit/'Adafruit BME280 Library' +echo "\e[32mInstalling adafruit/'Adafruit BMP3XX Library'\e[0m" +pio lib -g install adafruit/'Adafruit BMP3XX Library' + echo "\e[32mInstalling adafruit/'DHT sensor library'\e[0m" pio lib -g install adafruit/'DHT sensor library' diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index 6e2674a8d..fd3126f44 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -66,6 +66,7 @@ ___ - [Atlas Scientific EZO-RTD Temperature Sensor](#atlas-scientific-ezo-rtd-temperature-sensor) - [Atlas Scientific EZO-EC Conductivity Sensor](#atlas-scientific-ezo-ec-conductivity-sensor) - [Bosch BME280 Environmental Sensor](#bosch-bme280-environmental-sensor) + - [Bosch BMP388 and BMP398 Pressure Sensors](#bosch-bmp388-and-bmp398-pressure-sensors) - [Campbell ClariVUE SDI-12 Turbidity Sensor](#campbell-clarivue-sdi-12-turbidity-sensor) - [Campbell OBS3+ Analog Turbidity Sensor](#campbell-obs3-analog-turbidity-sensor) - [Decagon CTD-10 Conductivity, Temperature, and Depth Sensor](#decagon-ctd-10-conductivity-temperature-and-depth-sensor) @@ -73,8 +74,8 @@ ___ - [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) - - [In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe](#in-situ-rdo-pro-x-rugged-dissolved-oxygen-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) - [Keller Acculevel High Accuracy Submersible Level Transmitter](#keller-acculevel-high-accuracy-submersible-level-transmitter) - [Keller Nanolevel Level Transmitter](#keller-nanolevel-level-transmitter) @@ -727,6 +728,15 @@ Keep in mind that the possible I2C addresses of the BME280 match those of the MS ___ +### Bosch BMP388 and BMP398 Pressure Sensors + +@see @ref sensor_bmp3xx + +[//]: # ( @menusnip{bosch_bmp3xx} ) + +___ + + #### Campbell ClariVUE SDI-12 Turbidity Sensor @see @ref sensor_clarivue @@ -811,20 +821,20 @@ Because this sensor can have only one I2C address (0x60), it is only possible to ___ -#### In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe +#### In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor -@see @ref sensor_insitu_rdo +@see @ref sensor_insitu_troll -[//]: # ( @menusnip{in_situ_rdo} ) +[//]: # ( @menusnip{in_situ_troll_sdi12a} ) ___ -#### In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor +#### In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe -@see @ref sensor_insitu_troll +@see @ref sensor_insitu_rdo -[//]: # ( @menusnip{in_situ_troll_sdi12a} ) +[//]: # ( @menusnip{in_situ_rdo} ) ___ 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 56a8fefbb..5d6d59d01 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1094,6 +1094,39 @@ Variable* bme280Alt = #endif +#if defined BUILD_SENSOR_BOSCH_BMP3XX +// ========================================================================== +// Bosch BMP 3xx Barometric Pressure Sensor +// ========================================================================== +/** Start [bosch_bmp3xx] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const int8_t bmp3xxPower = -1; // Power pin +Mode bmpMode = FORCED_MODE; // The operating mode of the BMP; normal or forced +Oversampling bmpPressureOversample = OVERSAMPLING_X32; +Oversampling bmpTempOversample = OVERSAMPLING_X2; +IIRFilter bmpFilterCoeff = IIR_FILTER_OFF; +TimeStandby bmpTimeStandby = TIME_STANDBY_5MS; +uint8_t bmpI2C_addr = 0x77; +// The BMP3xx can be addressed either as 0x77 or 0x76 + +// Create a Bosch BMP3xx sensor object +BoschBMP3xx bmp3xx(bmp3xxPower, bmpMode, bmpPressureOversample, + bmpTempOversample, bmpFilterCoeff, bmpTimeStandby, + bmpI2C_addr); + +// Create the variable pointers for the BMP3xx +Variable* bmp3xxTemp = + new BoschBMP3xx_Temp(&bmp3xx, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* bmp3xxPress = + new BoschBMP3xx_Pressure(&bmp3xx, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* bmp3xxAlt = + new BoschBMP3xx_Altitude(&bmp3xx, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [bosch_bmp3xx] */ +#endif + + #if defined BUILD_SENSOR_CAMPBELL_CLARI_VUE10 // ========================================================================== // Campbell ClariVUE Turbidity Sensor @@ -2400,6 +2433,11 @@ Variable* variableList[] = { bme280Press, bme280Alt, #endif +#if defined BUILD_SENSOR_BOSCH_BMP3XX + bmp3xxTemp, + bmp3xxPress, + bmp3xxAlt, +#endif #if defined BUILD_SENSOR_CAMPBELL_CLARI_VUE10 clarivueTurbidity, clarivueTemp, diff --git a/library.json b/library.json index 17b21b820..b5d6f3e70 100644 --- a/library.json +++ b/library.json @@ -66,7 +66,7 @@ "name": "EnviroDIY_DS3231", "owner": "envirodiy", "library id": "2079", - "url": "https://github.com/EnviroDIY/Sodaq_DS3231.git", + "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"], @@ -77,7 +77,7 @@ "name": "RTCZero", "owner": "arduino-libraries", "library id": "873", - "url": "https://github.com/arduino-libraries/RTCZero.git", + "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"], @@ -88,7 +88,7 @@ "name": "EnableInterrupt", "owner": "greygnome", "library id": "311", - "url": "https://github.com/GreyGnome/EnableInterrupt.git", + "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"], @@ -99,7 +99,7 @@ "name": "SdFat", "owner": "greiman", "library id": "322", - "url": "https://github.com/greiman/SdFat.git", + "url": "https://github.com/greiman/SdFat", "version": "~2.1.2", "note": "SdFat - FAT16/FAT32 file system for SD cards.", "authors": ["Bill Greiman"], @@ -119,7 +119,7 @@ "name": "PubSubClient", "owner": "knolleary", "library id": "89", - "url": "https://github.com/knolleary/pubsubclient.git", + "url": "https://github.com/knolleary/pubsubclient", "version": "~2.8", "note": "A client library for MQTT messaging.", "authors": ["Nick O'Leary"] @@ -128,7 +128,7 @@ "name": "Adafruit BusIO", "owner": "adafruit", "library id": "6214", - "url": "https://github.com/adafruit/Adafruit_BusIO.git", + "url": "https://github.com/adafruit/Adafruit_BusIO", "version": "~1.11.3", "note": "Adafruit BusIO, a dependency of other Adafruit libraries", "authors": ["Adafruit"], @@ -139,7 +139,7 @@ "name": "Adafruit Unified Sensor", "owner": "adafruit", "library id": "31", - "url": "https://github.com/adafruit/Adafruit_Sensor.git", + "url": "https://github.com/adafruit/Adafruit_Sensor", "version": "~1.1.5", "note": "Adafruit's unified sensor library is used by their other libraries", "authors": ["Adafruit"], @@ -160,7 +160,7 @@ "name": "Adafruit AM2315", "owner": "adafruit", "library id": "773", - "url": "https://github.com/adafruit/Adafruit_AM2315.git", + "url": "https://github.com/adafruit/Adafruit_AM2315", "version": "~2.2.1", "note": "AOSong AM2315 I2C Temp/Humidity Sensor Library by Adafruit", "authors": ["Adafruit"], @@ -171,18 +171,28 @@ "name": "Adafruit BME280 Library", "owner": "adafruit", "library id": "166", - "url": "https://github.com/adafruit/Adafruit_BME280_Library.git", + "url": "https://github.com/adafruit/Adafruit_BME280_Library", "version": "~2.2.2", "note": "Bosch BME280 Temp/Humidity/Pressure Sensor Library by Adafruit", "authors": ["Adafruit"], "frameworks": "arduino", "platforms": "atmelavr, atmelsam" }, + { + "name": "BMP388_DEV", + "owner": "MartinL1", + "version": "https://github.com/MartinL1/BMP388_DEV.git", + "version_note": "~1.0.7", + "note": "An Arduino compatible, non-blocking, I2C/SPI library for the Bosch BMP388 barometer.", + "authors": ["Martin Lindupp"], + "frameworks": "arduino", + "platforms": "atmelavr, atmelsam" + }, { "name": "DHT sensor library", "owner": "adafruit", "library id": "19", - "url": "https://github.com/adafruit/DHT-sensor-library.git", + "url": "https://github.com/adafruit/DHT-sensor-library", "version": "~1.4.3", "note": "AOSong DHT Sensor Library by Adafruit", "authors": ["Adafruit"], @@ -193,7 +203,7 @@ "name": "Adafruit INA219", "owner": "adafruit", "library id": "160", - "url": "https://github.com/adafruit/Adafruit_INA219.git", + "url": "https://github.com/adafruit/Adafruit_INA219", "version": "~1.2.0", "note": "This is a library for the Adafruit INA219 high side DC current sensor boards", "authors": ["Adafruit"], @@ -204,7 +214,7 @@ "name": "Adafruit MPL115A2", "owner": "adafruit", "library id": "406", - "url": "https://github.com/adafruit/Adafruit_MPL115A2.git", + "url": "https://github.com/adafruit/Adafruit_MPL115A2", "version": "~2.0.0", "note": "MPL115A2 Barometer Library by Adafruit", "authors": ["Adafruit"], @@ -224,7 +234,7 @@ "name": "OneWire", "owner": "paulstoffregen", "library id": "1", - "url": "https://github.com/PaulStoffregen/OneWire.git", + "url": "https://github.com/PaulStoffregen/OneWire", "version": "~2.3.6", "note": "OneWire - Control 1-Wire protocol (DS18S20, DS18B20, DS2408 and etc)", "authors": [ @@ -248,7 +258,7 @@ "name": "DallasTemperature", "owner": "milesburton", "library id": "54", - "url": "https://github.com/milesburton/Arduino-Temperature-Control-Library.git", + "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"], @@ -260,7 +270,7 @@ "owner": "envirodiy", "library id": "1486", "version": "~2.1.4", - "url": "https://github.com/EnviroDIY/Arduino-SDI-12.git", + "url": "https://github.com/EnviroDIY/Arduino-SDI-12", "note": "EnviroDIY SDI-12 Library for Arduino", "author_notes": [ "Kevin M. Smith", @@ -275,7 +285,7 @@ "name": "MS5803", "owner": "northernwidget", "library id": "5431", - "url": "https://github.com/NorthernWidget/MS5803.git", + "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"] @@ -293,7 +303,7 @@ "name": "SensorModbusMaster", "owner": "envirodiy", "library id": "1824", - "url": "https://github.com/EnviroDIY/SensorModbusMaster.git", + "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"], @@ -304,7 +314,7 @@ "name": "KellerModbus", "owner": "envirodiy", "library id": "5439", - "url": "https://github.com/EnviroDIY/KellerModbus.git", + "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"] @@ -313,7 +323,7 @@ "name": "YosemitechModbus", "owner": "envirodiy", "library id": "2078", - "url": "https://github.com/EnviroDIY/YosemitechModbus.git", + "url": "https://github.com/EnviroDIY/YosemitechModbus", "version": "~0.3.2", "note": "Arduino library for communication with Yosemitech sensors via Modbus.", "authors": ["Sara Damiano", "Anthony Aufdenkampe"], diff --git a/src/sensors/BoschBME280.h b/src/sensors/BoschBME280.h index 9585cfc35..f9c1bbaaa 100644 --- a/src/sensors/BoschBME280.h +++ b/src/sensors/BoschBME280.h @@ -51,8 +51,8 @@ * The [Adafruit BME280 library](https://github.com/adafruit/Adafruit_BME280_Library) * is used internally for communication with the BME280. * - * @warning The I2C addresses used by the BME280 are the same as those of the - * MS5803! If you are also using one of those sensors, make sure that the + * @warning The I2C addresses used by the BME280 are the same as those of the BMP388, + * BMP390, and MS5803! If you are also using one of those sensors, make sure that the * address for that sensor does not conflict with the address of this sensor. * * @note Software I2C is *not* supported for the BME280. @@ -64,6 +64,13 @@ * * [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BME280-Datasheet.pdf) * + * @section sensor_bme280_flags Build flags + * - ```-D SEALEVELPRESSURE_HPA``` + * - use to adjust the sea level pressure used to calculate altitude from measured barometric pressure + * - if not defined, 1013.25 is used + * - The same sea level pressure flag is used for both the BMP3xx and the BME280. + * Whatever you select will be used for both sensors. + * * @section sensor_bme280_ctor Sensor Constructors * {{ @ref BoschBME280::BoschBME280(int8_t, uint8_t, uint8_t) }} * {{ @ref BoschBME280::BoschBME280(TwoWire*, int8_t, uint8_t, uint8_t) }} @@ -236,7 +243,9 @@ /**@}*/ /// The atmospheric pressure at sea level +#ifndef SEALEVELPRESSURE_HPA #define SEALEVELPRESSURE_HPA (1013.25) +#endif /* clang-format off */ /** diff --git a/src/sensors/BoschBMP3xx.cpp b/src/sensors/BoschBMP3xx.cpp new file mode 100644 index 000000000..572b1140f --- /dev/null +++ b/src/sensors/BoschBMP3xx.cpp @@ -0,0 +1,316 @@ +/** + * @file BoschBMP3xx.cpp + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Sara Geleskie Damiano + * + * @brief Implements the BoschBMP3xx class. + */ + +#include "BoschBMP3xx.h" + + +// The constructor +BoschBMP3xx::BoschBMP3xx(int8_t powerPin, Mode mode, + Oversampling pressureOversample, + Oversampling tempOversample, IIRFilter filterCoeff, + TimeStandby timeStandby, uint8_t i2cAddressHex) + : Sensor("BoschBMP3xx", BMP3XX_NUM_VARIABLES, BMP3XX_WARM_UP_TIME_MS, + BMP3XX_STABILIZATION_TIME_MS, BMP3XX_MEASUREMENT_TIME_MS, powerPin, + -1, 1, BMP3XX_INC_CALC_VARIABLES) { + _mode = mode; + _pressureOversampleEnum = pressureOversample; + _tempOversampleEnum = tempOversample; + _filterCoeffEnum = filterCoeff; + _standbyEnum = timeStandby; + _i2cAddressHex = i2cAddressHex; +} +// Destructor +BoschBMP3xx::~BoschBMP3xx() {} + + +String BoschBMP3xx::getSensorLocation(void) { + String address = F("I2C_0x"); + address += String(_i2cAddressHex, HEX); + return address; +} + + +bool BoschBMP3xx::setup(void) { + bool retVal = + Sensor::setup(); // this will set pin modes and the setup status bit + + // This sensor needs power for setup! + // The BMP3XX's begin() reads required calibration data from the sensor. + bool wasOn = checkPowerOn(); + if (!wasOn) { powerUp(); } + waitForWarmUp(); + + // Set the measurement time based on the oversampling settings and the + // filtering From 3.9.2 of the datasheet + // In both forced mode and normal mode the pressure and temperature + // measurement duration follow the equation: + // *Tconv* = 234μs + *pres_en* x (392μs + 2osr_p x + // 2020μs) + *temp_en* x (163μs + 2osr_t x 2020μs) + // With: + // - *Tconv* = total conversion time in μs + // - *pres_en* = "0" or "1", depending of the status of the press_en bit (we + // will always operate with pressure measurement enabled) + // - *temp_en* = "0" or "1", depending of the status of the temp_en bit (we + // will always operate with temperature measurement enabled) + // - 2osr_p = amount of pressure oversampling repetitions + // - 2osr_t = amount of temperature oversampling repetitions + + // For safety, we will add an 18% buffer to the time, which is the largest + // difference between "typical" and "maximum" measurement times given in + // table 23 of the datasheet + // The enum values for oversampling match with the values of osr_p and osr_t + uint32_t typ_measurementTime_us = + (234 + 1 * (392 + (pow(2, _pressureOversampleEnum)) * 2020) + + 1 * (163 + (pow(2, _tempOversampleEnum)) * 2020)); + float max_measurementTime_us = static_cast(typ_measurementTime_us) * + 1.18; + // Set the sensor measurement time to the safety-factored max time + _measurementTime_ms = + static_cast(ceil(max_measurementTime_us / 1000)); + MS_DBG(F("Expected BMP390 typical measurement time is"), + typ_measurementTime_us, F("µs with possible max of"), + max_measurementTime_us, F("µs ="), _measurementTime_ms, F("ms")); + + // Check for some invalid, un-supported, or not-recommended settings + // NOTE: Technically, of course, it is possible to use the normal sampling + // mode and the IIR filter without continuous power, but we would have to + // re-adjust our measurement procedure and times to give enough samples for + // the filter to be initialized and I'm not going to support that. It's + // just not sensible to work that way. + if (_powerPin >= 0 && _mode == NORMAL_MODE) { + MS_DBG(F("WARNING: BMP388/BMP390 will be used in forced mode! To use " + "in 'normal' (continuous sampling) mode the power must be " + "continuously on.")); + _mode = FORCED_MODE; + } + if ((_powerPin >= 0 /*|| _mode == FORCED_MODE*/) && + _filterCoeffEnum != IIR_FILTER_OFF) { + MS_DBG(F("WARNING: BMP388/390's IIR filter is only supported with " + "continuous power! The filter will not be used!")); + _filterCoeffEnum = IIR_FILTER_OFF; + } + + // Bosch doesn't recommend high temperature sampling + if (_tempOversampleEnum != OVERSAMPLING_SKIP && + _tempOversampleEnum != OVERSAMPLING_X2) { + MS_DBG(F("BMP388/390 temperature oversampling higher than 2x is not " + "recommended")); + } + + + // convert the standby time enum value into the time between readouts from + // the BMP's + // ADC NOTE: The ADC will return repeated values if the ADC's ODR (output + // data rate) is set faster than the actual measurement time, given + // oversampling. + float _timeStandby_ms = 5 * pow(2, _standbyEnum); + // warn if an impossible sampling rate is selected + if ((_timeStandby_ms < max_measurementTime_us / 1000) && + _mode == NORMAL_MODE) { + MS_DBG(F("The selected standby time of"), _timeStandby_ms, + F("between ADC samples is less than the expected max of"), + _measurementTime_ms, + F("ms needed for temperature and pressure oversampling.")); + // bump up the standby time to a possible value + while (5 * pow(2, _standbyEnum) < max_measurementTime_us / 1000) { + _standbyEnum = + static_cast(static_cast(_standbyEnum) + 1); + _timeStandby_ms = 5 * pow(2, _standbyEnum); + MS_DBG(_standbyEnum, _timeStandby_ms, + static_cast(max_measurementTime_us / 1000)); + } + MS_DBG(F("A standby time of"), _timeStandby_ms, + F("ms between reading will be used.")); + } + + // print some notes about the filter initialization time + // the value of the enum is the power of the number of samples + if (_filterCoeffEnum != IIR_FILTER_OFF && _mode == NORMAL_MODE) { + // float time_to_initialize_filter = + // ((pow(2,_filterCoeff)) * (5 * pow(2,_timeStandby))) / 1E6; + MS_DBG(F("BMP388/390's IIR filter will only be fully initialized"), + pow(2, _filterCoeffEnum) * _timeStandby_ms, + F("ms after power on")); + } + if (_filterCoeffEnum != IIR_FILTER_OFF && _mode == FORCED_MODE) { + MS_DBG( + F("BMP388/390's IIR filter will only be fully initialized after"), + pow(2, _filterCoeffEnum), F("samples")); + } + + if (_mode == FORCED_MODE) { + MS_DBG( + F("BMP388/390's standby time setting is ignored in forced mode.")); + } + + // Run begin fxn because it returns true or false for success in contact + // Make 5 attempts + uint8_t ntries = 0; + bool success = false; + while (!success && ntries < 5) { + // This will read coefficients and set the sensor up with default values + // in sleep mode. + MS_DBG(F("Attempting to connect to BMP3xx to get the floating point " + "trim parameters")); + success = bmp_internal.begin(_i2cAddressHex); + + // Set up oversampling and filter initialization + // Using the filter selection recommended for "Weather monitoring + // (lowest power)" in table 10 of the sensor datasheet + + // Oversampling setting + MS_DBG(F("Sending BMP3xx oversampling settings")); + bmp_internal.setTempOversampling(_tempOversampleEnum); + bmp_internal.setPresOversampling(_pressureOversampleEnum); + + // Coefficient of the filter (in samples) + MS_DBG(F("Sending BMP3xx IIR Filter settings")); + bmp_internal.setIIRFilter(_filterCoeffEnum); + + MS_DBG(F("Setting sea level atmospheric pressure to"), + SEALEVELPRESSURE_HPA); + bmp_internal.setSeaLevelPressure(SEALEVELPRESSURE_HPA); + + // if we plan to operate in normal mode, set that up and begin sampling + // at the specified intervals + // if we're going to operate in forced mode, this isn't needed + if (_mode == NORMAL_MODE) { + // Standby time between samples in normal sampling mode - doesn't + // apply in forced mode + MS_DBG(F( + "Sending BMP3xx stand-by time and starting normal conversion")); + bmp_internal.setTimeStandby(_standbyEnum); + bmp_internal.startNormalConversion(); + } + ntries++; + } + if (!success) { + // Set the status error bit (bit 7) + _sensorStatus |= 0b10000000; + // UN-set the set-up bit (bit 0) since setup failed! + _sensorStatus &= 0b11111110; + } + retVal &= success; + + // Turn the power back off it it had been turned on + if (!wasOn) { powerDown(); } + + return retVal; +} + + +bool BoschBMP3xx::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; + + // if the power has gone off, we need to re-read the coefficients, + // we don't need to do anything if always powered. + // NOTE: only forced sampling is supported with switched power + if (_powerPin >= 0) { // Run begin fxn because it returns true or false + // for success in contact + // Make 5 attempts + uint8_t ntries = 0; + bool success = false; + while (!success && ntries < 5) { + MS_DBG( + F("Attempting to connect to BMP3xx to get the floating point " + "trim parameters")); + success = bmp_internal.begin(_i2cAddressHex); + + // Set up oversampling and filter initialization + // Using the filter selection recommended for "Weather monitoring + // (lowest power)" in table 10 of the sensor datasheet + + // Oversampling setting + MS_DBG(F("Sending BMP3xx oversampling settings")); + bmp_internal.setTempOversampling(_tempOversampleEnum); + bmp_internal.setPresOversampling(_pressureOversampleEnum); + + ntries++; + } + if (!success) { + // Set the status error bit (bit 7) + _sensorStatus |= 0b10000000; + // UN-set the set-up bit (bit 0) since setup failed! + _sensorStatus &= 0b11111110; + } + return success; + } + + return true; +} + + +// To start a measurement we write the command "R" to the sensor +// NOTE: documentation says to use a capital "R" but the examples provided +// by Atlas use a lower case "r". +bool BoschBMP3xx::startSingleMeasurement(void) { + // Sensor::startSingleMeasurement() checks that if it's awake/active and + // sets the timestamp and status bits. If it returns false, there's no + // reason to go on. + if (!Sensor::startSingleMeasurement()) return false; + + // we only need to start a measurement in forced mode + // in "normal" mode, the sensor to automatically alternates between + // measuring and sleeping at the prescribed intervals + if (_mode == FORCED_MODE) { + MS_DBG(F("Starting forced measurement on"), getSensorNameAndLocation()); + // unfortunately, there's no return value here + bmp_internal.startForcedConversion(); + // Update the time that a measurement was requested + _millisMeasurementRequested = millis(); + } + + return true; +} + + +bool BoschBMP3xx::addSingleMeasurementResult(void) { + bool success = false; + + // Initialize float variables + float temp = -9999; + float press = -9999; + float alt = -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)) { + MS_DBG(getSensorNameAndLocation(), F("is reporting:")); + + // Read values + success = bmp_internal.getMeasurements(temp, press, alt); + + // Assume that if all three are 0, really a failed response + // May also return a very negative temp when receiving a bad response + if (!success) { + temp = -9999; + press = -9999; + alt = -9999; + } + + MS_DBG(F(" Temperature:"), temp, F("°C")); + MS_DBG(F(" Barometric Pressure:"), press, F("Pa")); + MS_DBG(F(" Calculated Altitude:"), alt, F("m ASL")); + } else { + MS_DBG(getSensorNameAndLocation(), F("is not currently measuring!")); + } + + verifyAndAddMeasurementResult(BMP3XX_TEMP_VAR_NUM, temp); + verifyAndAddMeasurementResult(BMP3XX_PRESSURE_VAR_NUM, press); + verifyAndAddMeasurementResult(BMP3XX_ALTITUDE_VAR_NUM, alt); + + // 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 success; +} diff --git a/src/sensors/BoschBMP3xx.h b/src/sensors/BoschBMP3xx.h new file mode 100644 index 000000000..0d5fc3b1c --- /dev/null +++ b/src/sensors/BoschBMP3xx.h @@ -0,0 +1,690 @@ +/** + * @file BoschBMP3xx.h + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Sara Geleskie Damiano + * + * @brief Contains the BoschBMP3xx sensor subclass and the variable subclasses + * BoschBMP3xx_Temp, BoschBMP3xx_Humidity, BoschBMP3xx_Pressure, and + * BoschBMP3xx_Altitude. + * + * These are used for the Bosch BMP3xx digital pressure and humidity sensor. + * + * This depends on the [MartinL1's BMP388 + * library](https://github.com/MartinL1/BMP388_DEV). + * + * @copydetails BoschBMP3xx + */ +/* clang-format off */ +/** + * @defgroup sensor_bmp3xx Bosch BMP3xx + * Classes for the Bosch BMP388 and BMP390 pressure sensors. + * + * @ingroup the_sensors + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_bmp3xx_intro Introduction + * > The BMP390 is a digital sensor with pressure and temperature measurement + * > based on proven sensing principles. The sensor module is housed in an + * > extremely compact 10-pin metal-lid LGA package with a footprint of only 2.0 + * > × 2.0 mm² and max 0.8 mm package height. Its small dimensions and its low + * > power consumption of 3.2 μA @1Hz allow the implementation in battery driven + * > devices such as mobile phones, GPS modules or watches. + * + * The BMP390 replaces the BMP388 and is nearly identical in specs and communication. + * + * Although this sensor has the option of either I2C or SPI communication, this + * library only supports I2C. The I2C address is either 0x77 or 0x76. To + * connect two of these sensors to your system, you must ensure they are + * soldered so as to have different I2C addresses. No more than two can be + * attached. These sensors should be attached to a 1.7-3.6V power source and + * the power supply to the sensor can be stopped between measurements. + * + * [MartinL1's BMP388 library](https://github.com/MartinL1/BMP388_DEV) is used + * internally for communication with the BMP3xx. MartinL1's library was selected + * over the [Adafruit library](https://github.com/adafruit/Adafruit_BMP3XX) + * because it allows non-blocking operation in both normal and forced modes. + * It also provides many enums to help ensure correct value inputs + * + * @warning The I2C addresses used by the BMP3xx are the same as those of the BME280 + * and the MS5803! If you are also using one of those sensors, make sure that the + * address for that sensor does not conflict with the address of this sensor. + * + * @note Neither secondary hardware nor software I2C is supported for the BMP3xx. + * Only the primary hardware I2C defined in the Arduino core can be used. + * + * @section sensor_bmp3xx_filters Bosch Recommended Oversample and Filter Settings + * + * @subsection sensor_bmp3xx_pressure_osr Recommended Pressure Oversampling + * + * Recommended settings pressure oversampling (adapted from table 6 of the [datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf)) + * + * | Oversampling setting | Pressure oversampling | Typical pressure resolution | Recommended temperature oversampling | + * | :-------------------: | :-------------------: | :-------------------------: | :----------------------------------: | + * | Ultra low power | ×1 | 16 bit / 2.64 Pa | ×1 | + * | Low power | ×2 | 17 bit / 1.32 Pa | ×1 | + * | Standard resolution | ×4 | 18 bit / 0.66 Pa | ×1 | + * | High resolution | ×8 | 19 bit / 0.33 Pa | ×1 | + * | Ultra high resolution | ×16 | 20 bit / 0.17 Pa | ×2 | + * | Highest resolution | ×32 | 21 bit / 0.085 Pa | ×2 | + * + * @subsection sensor_bmp3xx_temp_osr Recommended Temperature Oversampling + * + * From section 3.4.2 of the [datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf): + * + * > It is recommended to base the value of *osr_t* [temperature oversampling] + * > on the selected value of *osrs_p* [pressure oversampling] as per Table 6. + * > Temperature oversampling above x2 is possible, but will not significantly + * > improve the accuracy of the pressure output any further. The reason for + * > this is that the noise of the compensated pressure value depends more on + * > the raw pressure than on the raw temperature noise. Following the + * > recommended setting will result in an optimal noise to power ratio. + * + * @subsection sensor_bmp3xx_filts_uses Settings by Use Case + * + * This is a copy of Bosch's recommendations for pressure and temperature oversampling, + * IIR filter coeficients, and output data rates for various applications. + * This appears as table 10 in the + * [datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf). + * + * Table 10: Recommended filter settings based on use cases + * + * | Use case | Mode | Over-sampling setting | Pressure over-sampling | Temperature over-sampling | IIR filter coefficient | Current Consumption (IDD) [μA] | Standby Time (ms) | Output Data Rate (ODR) [Hz] | RMS Noise [cm] | + * | :--------------------------------------: | :----: | :-------------------: | :--------------------: | :-----------------------: | :--------------------: | :---------------------------------------: | :---------------: | :-------------------------: | :------------: | + * | handheld device low-power (e.g. Android) | Normal | High resolution | x8 | x1 | 2 | 145 | 80 | 12.5 | 11 | + * | handheld device dynamic (e.g. Android) | Normal | Standard resolution | x4 | x1 | 4 | 310 | 20 | 50 | 10 | + * | Weather monitoring (lowest power) | Forced | Ultra low power | x1 | x1 | Off | 4 | N/A¹ | 1/60 | 55 | + * | Drop detection | Normal | Low power | x2 | x1 | Off | 358 | 10 | 100 | 36 | + * | Indoor navigation | Normal | Ultra high resolution | x16 | x2 | 4 | 560 | 40 | 25 | 5 | + * | Drone | Normal | Standard resolution | x8 | x1 | 2 | 570 | 20 | 50 | 11 | + * | Indoor localization | Normal | Ultra low power | x1 | x1 | 4 | - | 640 | 1 | - | + * ¹ Standby time does not apply in forced mode + * + * @section sensor_bmp3xx_datasheet Sensor Datasheet + * Documentation for the BMP390 sensor can be found at: + * https://www.bosch-sensortec.com/products/environmental-sensors/pressure-sensors/bmp390/ + * + * - [BMP390 Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf) + * - [BMP388 Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP388-Datasheet.pdf) + * + * @section sensor_bmp3xx_flags Build flags + * - ```-D SEALEVELPRESSURE_HPA``` + * - use to adjust the sea level pressure used to calculate altitude from measured barometric pressure + * - if not defined, 1013.25 is used + * - The same sea level pressure flag is used for both the BMP3xx and the BME280. + * Whatever you select will be used for both sensors. + * + * @section sensor_bmp3xx_ctor Sensor Constructors + * {{ @ref BoschBMP3xx::BoschBMP3xx(int8_t, Mode, Oversampling, Oversampling, IIRFilter, TimeStandby, uint8_t) }} + * + * ___ + * @section sensor_bmp3xx_examples Example Code + * The BMP3xx is used in the @menulink{bosch_bmp3xx} example. + * + * @menusnip{bosch_bmp3xx} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_BOSCHBMP3XX_H_ +#define SRC_SENSORS_BOSCHBMP3XX_H_ + +// Debugging Statement +// #define MS_BOSCHBMP3XX_DEBUG + +#ifdef MS_BOSCHBMP3XX_DEBUG +#define MS_DEBUGGING_STD "BoschBMP3xx" +#endif + +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "VariableBase.h" +#include "SensorBase.h" +#include + +/** @ingroup sensor_bmp3xx */ +/**@{*/ + +// Sensor Specific Defines +/// @brief Sensor::_numReturnedValues; the BMP3xx can report 3 values. +#define BMP3XX_NUM_VARIABLES 3 +/// @brief Sensor::_incCalcValues; altitude is calculted within the Adafruit +/// library. +#define BMP3XX_INC_CALC_VARIABLES 1 + +/** + * @anchor sensor_bmp3xx_timing + * @name Sensor Timing + * The sensor timing for a Bosch BMP3xx + */ +/**@{*/ +/** + * @brief Sensor::_warmUpTime_ms; BMP3xx should be ready to communicate within + * 3ms. + * + * Time to first communication after both VDD > 1.8 V and + * VDDIO > 1.8 V is 2ms (max) for the BMP390. Power-on time from + * stand-by mode is 3 ms (max) for the BMP390. I don't understand why it takes + * longer to be ready from stand-by than from power off, but we'll use the + * larger number. + */ +#define BMP3XX_WARM_UP_TIME_MS 3 +/** + * @brief Sensor::_stabilizationTime_ms; BMP3xx is stable after 4000ms. + * + * 0.5 s for good numbers, but optimal at 4 s based on tests using + * bmp3xxtimingTest.ino + */ +#define BMP3XX_STABILIZATION_TIME_MS 4000 +/** + * @brief Sensor::_measurementTime_ms; BMP390 takes 135-138 ms 78.09ms (max) to + * complete a measurement at 32x pressure oversampling and 2x temperature + * oversampling. A measurement may take up to 138ms at 32x pressure and + * temperature oversampling, but oversampling rates above 2x for temperature are + * not recommended. + * + * The number given in this define will be recalculated and over-written in the + * set-up. + * + * Following 3.9.2 of the datasheet: + * + * > In both forced mode and normal mode the pressure and temperature + * > measurement duration follow the equation: + * > + * > Tconv = 234μs + *pres_en* x (392μs + 2osr_p + * > * 2020 μs) + *temp_en* x (163 μs + 2osr_t * 2020μs) + * > + * > With: + * > - Tconv = total conversion time in μs + * > - *pres_en* = "0" or "1", depending of the status of the press_en bit + * > - *temp_en* = "0" or "1", depending of the status of the temp_en bit + * > - osr_p = amount of pressure oversampling repetitions + * > - osr_t = amount of temperature oversampling repetitions + * + * Further, based on table 23 in the datasheet, there is up to a 18% difference + * between the "typical" measurement time (as given by the equation) and the + * maximum measurement time. + * + * ModularSensors will always enable both pressure and temperature measurement. + */ +#define BMP3XX_MEASUREMENT_TIME_MS 80 +/**@}*/ + +/** + * @anchor sensor_bmp3xx_temp + * @name Temperature + * The temperature variable from a Bosch BMP388 or BMP390 + * - Range is -40°C to +85°C + * - Full accuracy between 0°C and +65°C + * - Absolute accuracy is typ. ± 0.5°C at 25°C + * - ± 1.5°C over 0°C to +65°C range + * + * {{ @ref BoschBMP3xx_Temp::BoschBMP3xx_Temp }} + */ +/**@{*/ +/// @brief Decimals places in string representation; temperature should have 5 - +/// resolution is 0.0.00015°C at the hightest oversampling. See table 7 in the +/// [sensor +/// datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf) +/// for resolution at all bandwidths. +#define BMP3XX_TEMP_RESOLUTION 2 +/// @brief Sensor variable number; temperature is stored in sensorValues[0]. +#define BMP3XX_TEMP_VAR_NUM 0 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "temperature" +#define BMP3XX_TEMP_VAR_NAME "temperature" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "degreeCelsius" (°C) +#define BMP3XX_TEMP_UNIT_NAME "degreeCelsius" +/// @brief Default variable short code; "BoschBMP3xxTemp" +#define BMP3XX_TEMP_DEFAULT_CODE "BoschBMP3xxTemp" +/**@}*/ + +/** + * @anchor sensor_bmp3xx_pressure + * @name Barometric Pressure + * The barometric pressure variable from a Bosch BMP388 or BMP390 + * - Range for both the BMP388 and BMP390 is 300‒1250 hPa + * - Absolute accuracy is typ. ± 50 Pa (±0.50 hPa) + * - Relative accuracy is typ. ± 3 Pa (±0.03 hPa), equiv. to ± 0.25 m + * + * {{ @ref BoschBMP3xx_Pressure::BoschBMP3xx_Pressure }} + */ +/**@{*/ +/// @brief Decimals places in string representation; barometric pressure should +/// have 3. Resolution of output data in highest resolution mode at lowest +/// bandwidth is 0.016 Pa. See table 6 in the [sensor +/// datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf) +/// for resolution at all bandwidths. +#define BMP3XX_PRESSURE_RESOLUTION 3 +/// @brief Sensor variable number; pressure is stored in sensorValues[2]. +#define BMP3XX_PRESSURE_VAR_NUM 1 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "barometricPressure" +#define BMP3XX_PRESSURE_VAR_NAME "barometricPressure" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "pascal" +/// (Pa) +#define BMP3XX_PRESSURE_UNIT_NAME "pascal" +/// @brief Default variable short code; "BoschBMP3xxPressure" +#define BMP3XX_PRESSURE_DEFAULT_CODE "BoschBMP3xxPressure" +/**@}*/ + +/** + * @anchor sensor_bmp3xx_altitude + * @name Altitude + * The altitude variable from a Bosch BMP388 or BMP390 + * + * {{ @ref BoschBMP3xx_Altitude::BoschBMP3xx_Altitude }} + */ +/**@{*/ +/// @brief Decimals places in string representation; altitude should have 0 - +/// resolution is 1m. +#define BMP3XX_ALTITUDE_RESOLUTION 0 +/// @brief Sensor variable number; altitude is stored in sensorValues[3]. +#define BMP3XX_ALTITUDE_VAR_NUM 2 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "heightAboveSeaFloor" +#define BMP3XX_ALTITUDE_VAR_NAME "heightAboveSeaFloor" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "meter" +#define BMP3XX_ALTITUDE_UNIT_NAME "meter" +/// @brief Default variable short code; "BoschBMP3xxAltitude" +#define BMP3XX_ALTITUDE_DEFAULT_CODE "BoschBMP3xxAltitude" +/**@}*/ + +/// The atmospheric pressure at sea level +#ifndef SEALEVELPRESSURE_HPA +#define SEALEVELPRESSURE_HPA (1013.25) +#endif + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the [Bosch BMP3xx](@ref sensor_bmp3xx). + * + * @ingroup sensor_bmp3xx + */ +/* clang-format on */ +class BoschBMP3xx : public Sensor { + public: + /** + * @brief Construct a new Bosch BMP3xx object using the primary hardware I2C + * instance. + * + * @note Neither secondary hardware nor software I2C is supported for the + * BMP3xx. Only the primary hardware I2C defined in the Arduino core can be + * used. + * + * @param powerPin The pin on the mcu controlling power to the BMP3XX + * Use -1 if it is continuously powered. + * - The BMP3xx requires a 1.7 - 3.6V power source + * @param mode Data sampling mode + *
Possible values are: + * - `FORCED_MODE` - a single measurement is made upon request and the + * sensor immediately returns to sleep. This mode should be used if you are + * stopping power to the sensor between readings. You should not use this + * mode if you wish to use the sensor's on-board IIR filter. + * - `NORMAL_MODE` - the sensor alteranates between sampling and sleeping at + * intervals set by the sensor output data rate, results can be read + * whenever needed. This mode should *not* be used if you will stop power + * to the sensor between readings. If you wish to use the sensor's on-board + * filtering, you should use normal mode. + * + * @param pressureOversample Pressure oversampling setting + *
Possible values are: + * - `OVERSAMPLING_SKIP` + * - `OVERSAMPLING_X2` + * - `OVERSAMPLING_X4`, + * - `OVERSAMPLING_X8` + * - `OVERSAMPLING_X16`, + * - `OVERSAMPLING_X32` + * + * @param tempOversample Temperature oversampling setting + *
Possible values are the same as those for pressureOversample. + * + * @param filterCoeff Coefficient of the infinite impulse response (IIR) + * filter (in samples). + *
This is number of past samples considered in calculating the current + * filtered value. This only should be used when the sensor is in normal + * sampling mode and continuously powered. + *
Possible values are: + * - `IIR_FILTER_OFF` (no filtering) + * - `IIR_FILTER_1`, + * - `IIR_FILTER_3` + * - `IIR_FILTER_7`, + * - `IIR_FILTER_15` + * - `IIR_FILTER_31`, + * - `IIR_FILTER_63` + * - `IIR_FILTER_127` + * + * @param timeStandby Standby time between measurements when continuously + * powered and operating in normal mode. + *
This is the inverse of the output data rate (ODR). + *
This setting is **ignored** when operating in forced mode. + *
Possible values are: + * - `TIME_STANDBY_5MS` (ODR = 200 Hz) + * - `TIME_STANDBY_10MS` (ODR = 100 Hz) + * - `TIME_STANDBY_20MS` (ODR = 50 Hz) + * - `TIME_STANDBY_40MS` (ODR = 25 Hz) + * - `TIME_STANDBY_80MS` (ODR = 12.5 Hz) + * - `TIME_STANDBY_160MS` (ODR = 6.25 Hz) + * - `TIME_STANDBY_320MS` (ODR = 3.125 Hz) + * - `TIME_STANDBY_640MS` (ODR = 1.5 Hz) + * - `TIME_STANDBY_1280MS` (~1.2 seconds, ODR = 0.78 Hz) + * - `TIME_STANDBY_2560MS` (~2.5 seconds, ODR = 0.39 Hz) + * - `TIME_STANDBY_5120MS` (~5 seconds, ODR = 0.2 Hz) + * - `TIME_STANDBY_10240MS` (~10 seconds, ODR = 0.1 Hz) + * - `TIME_STANDBY_20480MS` (~20 seconds, ODR = 0.05 Hz) + * - `TIME_STANDBY_40960MS` (~41 seconds, ODR = 0.025 Hz) + * - `TIME_STANDBY_81920MS` (~82 seconds or 1.4 minutes, ODR = 0.0125 Hz) + * - `TIME_STANDBY_163840MS` (~164 seconds or 2.7 minutes, ODR = 0.006 Hz) + * - `TIME_STANDBY_327680MS` (~5.5 minutes, ODR = 0.003 Hz) + * - `TIME_STANDBY_655360MS` (~11 minutes, ODR = 0.0015 Hz) + * + * @note If you are logging data, make sure that your logging interval is + * **greater than** the length of the IIR filter multiplied by the standby + * time! + * + * @param i2cAddressHex The I2C address of the BMP3xx; must be either 0x76 + * or 0x77. The default value is 0x76. + * + * @note For the BoschBMP3xx we do _**NOT**_ provide a + * `measurementsToAverage` option. The sensor already provides on-board + * averaging by way of oversampling and the IIR filter, so there is no + * reason to average again on our part. + * + * @see @ref sensor_bmp3xx_pressure_osr, @ref sensor_bmp3xx_temp_osr, and + * @ref sensor_bmp3xx_filts_uses for recommended settings + */ + explicit BoschBMP3xx(int8_t powerPin, Mode mode = FORCED_MODE, + Oversampling pressureOversample = OVERSAMPLING_X16, + Oversampling tempOversample = OVERSAMPLING_X2, + IIRFilter filterCoeff = IIR_FILTER_OFF, + TimeStandby timeStandby = TIME_STANDBY_10MS, + uint8_t i2cAddressHex = 0x76); + /** + * @brief Destroy the Bosch BMP3xx object + */ + ~BoschBMP3xx(); + + /** + * @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 Do any one-time preparations needed before the sensor will be able + * to take readings. + * + * This begins the Wire library (sets pin modes for I2C), reads + * calibration coefficients from the BMP3xx, and updates the #_sensorStatus. + * The BMP3xx must be powered for setup. + * + * @return **bool** True if the setup was successful. + */ + bool setup(void) override; + /** + * @copydoc Sensor::getSensorLocation() + */ + String getSensorLocation(void) override; + + /** + * @copydoc Sensor::startSingleMeasurement() + */ + bool startSingleMeasurement(void) override; + /** + * @copydoc Sensor::addSingleMeasurementResult() + */ + bool addSingleMeasurementResult(void) override; + + private: + /** + * @brief Internal reference the the BMP388_DEV object + */ + BMP388_DEV bmp_internal; + + /** + * @brief Data sampling mode + * + * Possible values are: + * - `FORCED_MODE` - a single measurement is made upon request and the + * sensor immediately returns to sleep. This mode should be used if you are + * stopping power to the sensor between readings. You should not use this + * mode if you wish to use the sensor's on-board IIR filter. + * - `NORMAL_MODE` - the sensor alteranates between sampling and sleeping at + * intervals set by the sensor output data rate, results can be read + * whenever needed. This mode should *not* be used if you will stop power + * to the sensor between readings. If you wish to use the sensor's on-board + * filtering, you should use normal mode. + * + * @see @ref sensor_bmp3xx_filts_uses + */ + Mode _mode; + + /** + * @brief Pressure oversampling setting + * + * Possible values are: + * - `OVERSAMPLING_SKIP` + * - `OVERSAMPLING_X2` + * - `OVERSAMPLING_X4`, + * - `OVERSAMPLING_X8` + * - `OVERSAMPLING_X16`, + * - `OVERSAMPLING_X32` + * + * @see @ref sensor_bmp3xx_pressure_osr and @ref sensor_bmp3xx_filts_uses + * for recommended settings + */ + Oversampling _pressureOversampleEnum; + + /** + * @brief Temperature oversampling setting + * + * Possible values are the same as those for pressureOversample. + * + * @see @ref sensor_bmp3xx_temp_osr and @ref sensor_bmp3xx_filts_uses + */ + Oversampling _tempOversampleEnum; + + /** + * @brief Coefficient of the infinite impulse response (IIR) + * filter (in samples). + * + * The number of past samples considered in calculating the current filtered + * value. This only should be used when the sensor is in normal sampling + * mode and continuously powered. + * + * Possible values are: + * - `IIR_FILTER_OFF` (no filtering) + * - `IIR_FILTER_1`, + * - `IIR_FILTER_3` + * - `IIR_FILTER_7`, + * - `IIR_FILTER_15` + * - `IIR_FILTER_31`, + * - `IIR_FILTER_63` + * - `IIR_FILTER_127` + * + * @see @ref sensor_bmp3xx_filts_uses for recommended settings + */ + IIRFilter _filterCoeffEnum; + + /** + * @brief Standby time between measurements when continuously + * powered and operating in normal mode. + * + * This is the inverse of the output data rate (ODR). + * + * This setting is **ignored** when operating in forced mode. + * + * @note If you are logging data, make sure that your logging interval is + * **greater than** the length of the IIR filter multiplied by the standby + * time! + * + * Possible values are: + * - `TIME_STANDBY_5MS` (ODR = 200 Hz) + * - `TIME_STANDBY_10MS` (ODR = 100 Hz) + * - `TIME_STANDBY_20MS` (ODR = 50 Hz) + * - `TIME_STANDBY_40MS` (ODR = 25 Hz) + * - `TIME_STANDBY_80MS` (ODR = 12.5 Hz) + * - `TIME_STANDBY_160MS` (ODR = 6.25 Hz) + * - `TIME_STANDBY_320MS` (ODR = 3.125 Hz) + * - `TIME_STANDBY_640MS` (ODR = 1.5 Hz) + * - `TIME_STANDBY_1280MS` (~1.2 seconds, ODR = 0.78 Hz) + * - `TIME_STANDBY_2560MS` (~2.5 seconds, ODR = 0.39 Hz) + * - `TIME_STANDBY_5120MS` (~5 seconds, ODR = 0.2 Hz) + * - `TIME_STANDBY_10240MS` (~10 seconds, ODR = 0.1 Hz) + * - `TIME_STANDBY_20480MS` (~20 seconds, ODR = 0.05 Hz) + * - `TIME_STANDBY_40960MS` (~41 seconds, ODR = 0.025 Hz) + * - `TIME_STANDBY_81920MS` (~82 seconds or 1.4 minutes, ODR = 0.0125 Hz) + * - `TIME_STANDBY_163840MS` (~164 seconds or 2.7 minutes, ODR = 0.006 Hz) + * - `TIME_STANDBY_327680MS` (~5.5 minutes, ODR = 0.003 Hz) + * - `TIME_STANDBY_655360MS` (~10 minutes, ODR = 0.0015 Hz) + * + * @see @ref sensor_bmp3xx_filts_uses for recommended settings + */ + TimeStandby _standbyEnum; + /** + * @brief The I2C address of the BMP3xx + */ + uint8_t _i2cAddressHex; +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [temperature output](@ref sensor_bmp3xx_temp) + * from a [Bosch BMP3xx](@ref sensor_bmp3xx). + * + * @ingroup sensor_bmp3xx + */ +/* clang-format on */ +class BoschBMP3xx_Temp : public Variable { + public: + /** + * @brief Construct a new BoschBMP3xx_Temp object. + * + * @param parentSense The parent BoschBMP3xx 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 "BoschBMP3xxTemp". + */ + explicit BoschBMP3xx_Temp(BoschBMP3xx* parentSense, const char* uuid = "", + const char* varCode = BMP3XX_TEMP_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)BMP3XX_TEMP_VAR_NUM, + (uint8_t)BMP3XX_TEMP_RESOLUTION, BMP3XX_TEMP_VAR_NAME, + BMP3XX_TEMP_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new BoschBMP3xx_Temp object. + * + * @note This must be tied with a parent BoschBMP3xx before it can be used. + */ + BoschBMP3xx_Temp() + : Variable((const uint8_t)BMP3XX_TEMP_VAR_NUM, + (uint8_t)BMP3XX_TEMP_RESOLUTION, BMP3XX_TEMP_VAR_NAME, + BMP3XX_TEMP_UNIT_NAME, BMP3XX_TEMP_DEFAULT_CODE) {} + /** + * @brief Destroy the BoschBMP3xx_Temp object - no action needed. + */ + ~BoschBMP3xx_Temp() {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [atmospheric pressure output](@ref sensor_bmp3xx_pressure) from a + * [Bosch BMP3xx](@ref sensor_bmp3xx). + * + * @ingroup sensor_bmp3xx + */ +/* clang-format on */ +class BoschBMP3xx_Pressure : public Variable { + public: + /** + * @brief Construct a new BoschBMP3xx_Pressure object. + * + * @param parentSense The parent BoschBMP3xx 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 "BoschBMP3xxPressure". + */ + explicit BoschBMP3xx_Pressure( + BoschBMP3xx* parentSense, const char* uuid = "", + const char* varCode = BMP3XX_PRESSURE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)BMP3XX_PRESSURE_VAR_NUM, + (uint8_t)BMP3XX_PRESSURE_RESOLUTION, + BMP3XX_PRESSURE_VAR_NAME, BMP3XX_PRESSURE_UNIT_NAME, varCode, + uuid) {} + /** + * @brief Construct a new BoschBMP3xx_Pressure object. + * + * @note This must be tied with a parent BoschBMP3xx before it can be used. + */ + BoschBMP3xx_Pressure() + : Variable((const uint8_t)BMP3XX_PRESSURE_VAR_NUM, + (uint8_t)BMP3XX_PRESSURE_RESOLUTION, + BMP3XX_PRESSURE_VAR_NAME, BMP3XX_PRESSURE_UNIT_NAME, + BMP3XX_PRESSURE_DEFAULT_CODE) {} +}; + + +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [altitude](@ref sensor_bmp3xx_altitude) calculated from the measurements + * made by a [Bosch BMP3xx](@ref sensor_bmp3xx). + * + * @ingroup sensor_bmp3xx + */ +/* clang-format on */ +class BoschBMP3xx_Altitude : public Variable { + public: + /** + * @brief Construct a new BoschBMP3xx_Altitude object. + * + * @param parentSense The parent BoschBMP3xx 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 "BoschBMP3xxAltitude". + */ + explicit BoschBMP3xx_Altitude( + BoschBMP3xx* parentSense, const char* uuid = "", + const char* varCode = BMP3XX_ALTITUDE_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)BMP3XX_ALTITUDE_VAR_NUM, + (uint8_t)BMP3XX_ALTITUDE_RESOLUTION, + BMP3XX_ALTITUDE_VAR_NAME, BMP3XX_ALTITUDE_UNIT_NAME, varCode, + uuid) {} + /** + * @brief Construct a new BoschBMP3xx_Altitude object. + * + * @note This must be tied with a parent BoschBMP3xx before it can be used. + */ + BoschBMP3xx_Altitude() + : Variable((const uint8_t)BMP3XX_ALTITUDE_VAR_NUM, + (uint8_t)BMP3XX_ALTITUDE_RESOLUTION, + BMP3XX_ALTITUDE_VAR_NAME, BMP3XX_ALTITUDE_UNIT_NAME, + BMP3XX_ALTITUDE_DEFAULT_CODE) {} +}; +/**@}*/ +#endif // SRC_SENSORS_BOSCHBMP3XX_H_ diff --git a/src/sensors/EverlightALSPT19.h b/src/sensors/EverlightALSPT19.h index 15234a4cf..7bdbfff6b 100644 --- a/src/sensors/EverlightALSPT19.h +++ b/src/sensors/EverlightALSPT19.h @@ -27,14 +27,14 @@ * [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Everlight-ALS-PT19.pdf) * * @section sensor_alspt19_ctor Sensor Constructors - * {{ @ref EverlightALSPT19::EverlightALSPT19(int8_t, uint8_t) }} - * {{ @ref EverlightALSPT19::EverlightALSPT19(TwoWire*, int8_t, uint8_t) }} + * {{ @ref EverlightALSPT19::EverlightALSPT19(uint8_t) }} + * {{ @ref EverlightALSPT19::EverlightALSPT19(int8_t, int8_t, float, float, uint8_t) }} * * @section sensor_alspt19_examples Example Code * - * The ALS-PT19 is used in the @menulink{ao_song_alspt19} example + * The ALS-PT19 is used in the @menulink{everlight_alspt19} example * - * @menusnip{ao_song_alspt19} + * @menusnip{everlight_alspt19} */ /* clang-format on */ diff --git a/src/sensors/InSituTrollSdi12a.h b/src/sensors/InSituTrollSdi12a.h index 549a7e0a3..029deba8a 100644 --- a/src/sensors/InSituTrollSdi12a.h +++ b/src/sensors/InSituTrollSdi12a.h @@ -387,4 +387,11 @@ class InSituTrollSdi12a_Depth : public Variable { ~InSituTrollSdi12a_Depth() {} }; /**@}*/ + +// typedefs for compatibility with Neil's original case +typedef InSituTrollSdi12a InsituTrollSdi12a; +typedef InSituTrollSdi12a_Pressure InsituTrollSdi12a_Pressure; +typedef InSituTrollSdi12a_Temp InsituTrollSdi12a_Temp; +typedef InSituTrollSdi12a_Depth InsituTrollSdi12a_Depth; + #endif // SRC_SENSORS_INSITUTROLLSDI12_H_ diff --git a/src/sensors/MeaSpecMS5803.h b/src/sensors/MeaSpecMS5803.h index f1a2bd0af..cfbae2418 100644 --- a/src/sensors/MeaSpecMS5803.h +++ b/src/sensors/MeaSpecMS5803.h @@ -43,7 +43,7 @@ * the sensor can be stopped between measurements. * * @warning These I2C addresses are the same as those available for the Bosch - * BME280 Barometric Pressure Sensor! If you are also using one of those + * BME280, BMP388, and BMP390 sensors! If you are also using one of those * sensors, make sure that the address for that sensor does not conflict with * the address of this sensor. * diff --git a/src/sensors/SensirionSHT4x.h b/src/sensors/SensirionSHT4x.h index 5db497336..fe5658728 100644 --- a/src/sensors/SensirionSHT4x.h +++ b/src/sensors/SensirionSHT4x.h @@ -49,12 +49,12 @@ * [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Sensirion_Humidity_Sensors_SHT4x_Datasheet.pdf) * * @section sensor_sht4x_ctor Sensor Constructors - * {{ @ref SensirionSHT4x::SensirionSHT4x(int8_t, uint8_t) }} - * {{ @ref SensirionSHT4x::SensirionSHT4x(TwoWire*, int8_t, uint8_t) }} + * {{ @ref SensirionSHT4x::SensirionSHT4x(int8_t, bool, uint8_t) }} + * {{ @ref SensirionSHT4x::SensirionSHT4x(TwoWire*, int8_t, bool, uint8_t) }} * * @section sensor_sht4x_examples Example Code * - * The SHT40 is used in the @menulink{sht4x} example + * The SHT40 is used in the @menulink{sensirion_sht4x} example * * @menusnip{sensirion_sht4x} */ From 2019acf30634feb35867d17b3f50378c271b4233 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 30 Mar 2022 11:11:02 -0400 Subject: [PATCH 60/94] New example Signed-off-by: Sara Damiano --- examples/DRWI_DigiLTE/DRWI_DigiLTE.ino | 38 +- examples/DRWI_Mayfly1/DRWI_Mayfly1.ino | 421 +++++++++++++++++++ examples/DRWI_Mayfly1/ReadMe.md | 41 ++ examples/DRWI_Mayfly1/platformio.ini | 35 ++ examples/DRWI_NoCellular/DRWI_NoCellular.ino | 2 - examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino | 42 +- 6 files changed, 526 insertions(+), 53 deletions(-) create mode 100644 examples/DRWI_Mayfly1/DRWI_Mayfly1.ino create mode 100644 examples/DRWI_Mayfly1/ReadMe.md create mode 100644 examples/DRWI_Mayfly1/platformio.ini diff --git a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino index a94453221..19e9e7ba6 100644 --- a/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino +++ b/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino @@ -212,37 +212,27 @@ Variable* variableList[] = { // Replace all of the text in the following section with the UUID array from // MonitorMyWatershed -// --------------------- Beginning of Token UUID List -// --------------------------------------- +/* clang-format off */ +// --------------------- Beginning of Token UUID List --------------------- const char* UUIDs[] = // UUID array for device sensors { - "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) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature - // (Maxim_DS3231_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Percent full scale - // (Digi_Cellular_SignalPercent) + "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) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab", // Percent full scale (Digi_Cellular_SignalPercent) }; -const char* registrationToken = - "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token -const char* samplingFeature = - "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token +const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID -// ----------------------- End of Token UUID List -// ------------------------------------------ +// ----------------------- End of Token UUID List ----------------------- +/* clang-format on */ // Count up the number of pointers in the array int variableCount = sizeof(variableList) / sizeof(variableList[0]); diff --git a/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino new file mode 100644 index 000000000..9a6b2af95 --- /dev/null +++ b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino @@ -0,0 +1,421 @@ +/** ========================================================================= + * @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 + * + * @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 +// ========================================================================== +/** Start [logging_options] */ +// The name of this program file +const char* sketchName = "DRWI_Mayfly1.ino"; +// 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 = 5; +// 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 = 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, 1.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 +// ========================================================================== +/** Start [sim_com_sim7080] */ +// For almost anything based on the SIMCom SIM7080G +#include + +// Create a reference to the serial port for the modem +HardwareSerial& modemSerial = Serial1; // Use hardware serial if possible +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(&modemSerial, modemVccPin, modemStatusPin, + modemSleepRqPin, apn); +// Create an extra reference to the modem by a generic name +SIMComSIM7080 modem = modem7080; +/** End [sim_com_sim7080] */ + + +// ========================================================================== +// 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) +// Built in on all versions of the Mayfly +// ========================================================================== +/** Start [ds3231] */ +#include + +// Create a DS3231 sensor object +MaximDS3231 ds3231(1); +/** End [ds3231] */ + + +// ========================================================================== +// Everlight ALS-PT19 Ambient Light Sensor +// Built in on Mayfly 1.x +// ========================================================================== +/** Start [everlight_alspt19] */ +#include + +// Create a Everlight ALS-PT19 sensor object +// For an EnviroDIY Mayfly, you can use the abbreviated version +const uint8_t alsNumberReadings = 10; +EverlightALSPT19 alsPt19(alsNumberReadings); +/** End [everlight_alspt19] */ + + +// ========================================================================== +// Sensirion SHT4X Digital Humidity and Temperature Sensor +// Built in on Mayfly 1.x +// ========================================================================== +/** Start [sensirion_sht4x] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const int8_t SHT4xPower = sensorPowerPin; // Power pin +const bool SHT4xUseHeater = true; + +// Create an Sensirion SHT4X sensor object +SensirionSHT4x sht4x(SHT4xPower, SHT4xUseHeater); +/** End [sensirion_sht4x] */ + + +// ========================================================================== +// 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] */ + + +/* clang-format off */ +// ========================================================================== +// Creating the Variable Array[s] and Filling with Variable Objects +// ========================================================================== +/** Start [variable_arrays] */ +Variable* variableList[] = { + new MeterHydros21_Cond(&hydros), // Specific conductance (Meter_Hydros21_Cond) + new MeterHydros21_Depth(&hydros), // Water depth (Meter_Hydros21_Depth) + new MeterHydros21_Temp(&hydros), // Temperature (Meter_Hydros21_Temp) + new SensirionSHT4x_Humidity(&sht4x), // Relative humidity (Sensirion_SHT40_Humidity) + new SensirionSHT4x_Temp(&sht4x), // Temperature (Sensirion_SHT40_Temperature) + new EverlightALSPT19_Illuminance(&alsPt19), // Illuminance (Everlight_AnalogALS_Illuminance) + new MaximDS3231_Temp(&ds3231), // Temperature (Maxim_DS3231_Temp) + new ProcessorStats_Battery(&mcuBoard), // Battery voltage (EnviroDIY_Mayfly_Batt) + new Modem_SignalPercent(&modem), // Percent full scale (EnviroDIY_LTEB_SignalPercent) +}; + +// 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 +// --------------------- Beginning of Token UUID List --------------------- + + +const char* UUIDs[] = // UUID array for device sensors + { + "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", // Relative humidity (Sensirion_SHT40_Humidity) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Sensirion_SHT40_Temperature) + "12345678-abcd-1234-ef00-1234567890ab", // Illuminance (Everlight_AnalogALS_Illuminance) + "12345678-abcd-1234-ef00-1234567890ab", // Temperature (Maxim_DS3231_Temp) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab", // Percent full scale (EnviroDIY_LTEB_SignalPercent) +}; +const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token +const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // 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, &modem.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); + + // Print a start-up note to the first serial port + Serial.print(F("Now 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(modem); + modem.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(); + } + + /** 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] */ + + + // 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/examples/DRWI_Mayfly1/ReadMe.md b/examples/DRWI_Mayfly1/ReadMe.md new file mode 100644 index 000000000..1de2eb21b --- /dev/null +++ b/examples/DRWI_Mayfly1/ReadMe.md @@ -0,0 +1,41 @@ +# DRWI Sites with a Mayfly 1.x and EnviroDIY LTE Bees +Example sketch for using the EnviroDIY SIM7080G LTE cellular module with an EnviroDIY Mayfly Data Logger. + +The exact hardware configuration used in this example: + * Mayfly v1.1 board + * EnviroDIY SIM7080 LTE module (with Hologram SIM card) + * Hydros21 CTD sensor + +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.x 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 ) + +[//]: # ( Start GitHub Only ) +- [DRWI Sites with a Mayfly 1.x and EnviroDIY LTE Bees](#drwi-sites-with-a-mayfly-1x-and-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/examples/DRWI_Mayfly1/platformio.ini b/examples/DRWI_Mayfly1/platformio.ini new file mode 100644 index 000000000..8881915dc --- /dev/null +++ b/examples/DRWI_Mayfly1/platformio.ini @@ -0,0 +1,35 @@ +; 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 + +[platformio] +description = ModularSensors example intended for DRWI users with CTD and a EnviroDIY SIM7080G LTE modem + +[env:mayfly] +monitor_speed = 57600 +board = mayfly +platform = atmelavr +framework = arduino +lib_ldf_mode = deep+ +lib_ignore = + RTCZero + Adafruit NeoPixel + Adafruit GFX Library + Adafruit SSD1306 + Adafruit ADXL343 + Adafruit STMPE610 + Adafruit TouchScreen + Adafruit ILI9341 +build_flags = + -DSDI12_EXTERNAL_PCINT +lib_deps = + envirodiy/EnviroDIY_ModularSensors +; ^^ Use this when working from an official release of the library +; https://github.com/EnviroDIY/ModularSensors.git#develop +; ^^ Use this when if you want to pull from the develop branch diff --git a/examples/DRWI_NoCellular/DRWI_NoCellular.ino b/examples/DRWI_NoCellular/DRWI_NoCellular.ino index f4afe8bde..0f86e9973 100644 --- a/examples/DRWI_NoCellular/DRWI_NoCellular.ino +++ b/examples/DRWI_NoCellular/DRWI_NoCellular.ino @@ -52,8 +52,6 @@ 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 -// 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 const int8_t sdCardSSPin = 12; // SD card chip select/slave select pin const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power diff --git a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino index ef55c40e6..05748d18c 100644 --- a/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino +++ b/examples/DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino @@ -74,8 +74,6 @@ 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 -// 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 const int8_t sdCardSSPin = 12; // SD card chip select/slave select pin const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power @@ -102,7 +100,7 @@ const int8_t modemVccPin = // 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 Mayfly1.0 to 3.3v) + // 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 @@ -223,37 +221,27 @@ Variable* variableList[] = { // Replace all of the text in the following section with the UUID array from // MonitorMyWatershed -// --------------------- Beginning of Token UUID List -// --------------------------------------- +/* clang-format off */ +// --------------------- Beginning of Token UUID List --------------------- const char* UUIDs[] = // UUID array for device sensors { - "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) - "12345678-abcd-1234-ef00-1234567890ab", // Temperature - // (Maxim_DS3231_Temp) - "12345678-abcd-1234-ef00-1234567890ab", // Percent full scale - // (EnviroDIY_LTEB_SignalPercent) + "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) + "12345678-abcd-1234-ef00-1234567890ab", // Battery voltage (EnviroDIY_Mayfly_Batt) + "12345678-abcd-1234-ef00-1234567890ab", // Percent full scale (EnviroDIY_LTEB_SignalPercent) }; -const char* registrationToken = - "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token -const char* samplingFeature = - "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID +const char* registrationToken = "12345678-abcd-1234-ef00-1234567890ab"; // Device registration token +const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampling feature UUID -// ----------------------- End of Token UUID List -// ------------------------------------------ +// ----------------------- End of Token UUID List ----------------------- +/* clang-format on */ // Count up the number of pointers in the array int variableCount = sizeof(variableList) / sizeof(variableList[0]); From 5eb3e68a2c8e334b4eeb5dab7edde8ea7823bc31 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 30 Mar 2022 11:12:04 -0400 Subject: [PATCH 61/94] CI Update Signed-off-by: Sara Damiano --- .github/workflows/build_examples_arduino_cli.yaml | 1 + .github/workflows/build_examples_platformio.yaml | 1 + continuous_integration/install-deps-arduino-cli.sh | 12 +++++++++--- continuous_integration/install-deps-platformio.sh | 6 +++--- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_examples_arduino_cli.yaml b/.github/workflows/build_examples_arduino_cli.yaml index e70b46a7b..8dab3aaf5 100644 --- a/.github/workflows/build_examples_arduino_cli.yaml +++ b/.github/workflows/build_examples_arduino_cli.yaml @@ -19,6 +19,7 @@ jobs: examples/DRWI_2G/, examples/DRWI_DigiLTE/, examples/DRWI_SIM7080LTE/, + examples/DRWI_Mayfly1/, examples/double_logger/, examples/baro_rho_correction/, examples/data_saving/, diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml index fa8a625db..8d9c38fc2 100644 --- a/.github/workflows/build_examples_platformio.yaml +++ b/.github/workflows/build_examples_platformio.yaml @@ -19,6 +19,7 @@ jobs: examples/DRWI_2G/, examples/DRWI_DigiLTE/, examples/DRWI_SIM7080LTE/, + examples/DRWI_Mayfly1/, examples/double_logger/, examples/baro_rho_correction/, examples/data_saving/, diff --git a/continuous_integration/install-deps-arduino-cli.sh b/continuous_integration/install-deps-arduino-cli.sh index 0c59b9b32..5580f9cec 100644 --- a/continuous_integration/install-deps-arduino-cli.sh +++ b/continuous_integration/install-deps-arduino-cli.sh @@ -75,9 +75,6 @@ arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "A echo "\n\e[32mInstalling Adafruit BME280 Library library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "Adafruit BME280 Library" -echo "\n\e[32mInstalling Adafruit BMP3XX Library library from Arduino library index\e[0m" -arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "Adafruit BMP3XX Library" - echo "\n\e[32mInstalling DHT sensor library library from Arduino library index\e[0m" arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "DHT sensor library" @@ -90,6 +87,15 @@ arduino-cli --config-file continuous_integration/arduino_cli.yaml lib install "A echo "\n\e[32mInstalling Adafruit SHT4x Library 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 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 ff8fe4558..0f30a9251 100644 --- a/continuous_integration/install-deps-platformio.sh +++ b/continuous_integration/install-deps-platformio.sh @@ -36,9 +36,6 @@ pio lib -g install adafruit/'Adafruit AM2315' echo "\e[32mInstalling adafruit/'Adafruit BME280 Library'\e[0m" pio lib -g install adafruit/'Adafruit BME280 Library' -echo "\e[32mInstalling adafruit/'Adafruit BMP3XX Library'\e[0m" -pio lib -g install adafruit/'Adafruit BMP3XX Library' - echo "\e[32mInstalling adafruit/'DHT sensor library'\e[0m" pio lib -g install adafruit/'DHT sensor library' @@ -48,6 +45,9 @@ pio lib -g install adafruit/'Adafruit INA219' echo "\e[32mInstalling adafruit/'Adafruit MPL115A2'\e[0m" pio lib -g install adafruit/'Adafruit MPL115A2' +echo "\e[32mInstalling Martin Lindupp's BMP388 Library\e[0m" +pio lib -g install https://github.com/MartinL1/BMP388_DEV.git + echo "\e[32mInstalling paulstoffregen/OneWire\e[0m" pio lib -g install paulstoffregen/OneWire From b8913341784cec93171a4e08bd7c5f5bd699812c Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 30 Mar 2022 11:25:15 -0400 Subject: [PATCH 62/94] more explicit casts needed for samd Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 102 ++++++----------------- src/sensors/BoschBMP3xx.cpp | 18 ++-- 2 files changed, 35 insertions(+), 85 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index fb5ba9e34..6d6daaf9e 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 10, + "action_cache_version": 11, "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.3", "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.5", "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.7", "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.3", "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.0", "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.0", "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,12 +265,9 @@ "url": "https://github.com/EnviroDIY/YosemitechModbus", "version": "~0.3.2", "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" } ] -} \ No newline at end of file +} diff --git a/src/sensors/BoschBMP3xx.cpp b/src/sensors/BoschBMP3xx.cpp index 572b1140f..b63db2e56 100644 --- a/src/sensors/BoschBMP3xx.cpp +++ b/src/sensors/BoschBMP3xx.cpp @@ -66,8 +66,11 @@ bool BoschBMP3xx::setup(void) { // table 23 of the datasheet // The enum values for oversampling match with the values of osr_p and osr_t uint32_t typ_measurementTime_us = - (234 + 1 * (392 + (pow(2, _pressureOversampleEnum)) * 2020) + - 1 * (163 + (pow(2, _tempOversampleEnum)) * 2020)); + (234 + + 1 * + (392 + + (pow(2, static_cast(_pressureOversampleEnum))) * 2020) + + 1 * (163 + (pow(2, static_cast(_tempOversampleEnum))) * 2020)); float max_measurementTime_us = static_cast(typ_measurementTime_us) * 1.18; // Set the sensor measurement time to the safety-factored max time @@ -109,7 +112,7 @@ bool BoschBMP3xx::setup(void) { // ADC NOTE: The ADC will return repeated values if the ADC's ODR (output // data rate) is set faster than the actual measurement time, given // oversampling. - float _timeStandby_ms = 5 * pow(2, _standbyEnum); + float _timeStandby_ms = 5.0f * pow(2, static_cast(_standbyEnum)); // warn if an impossible sampling rate is selected if ((_timeStandby_ms < max_measurementTime_us / 1000) && _mode == NORMAL_MODE) { @@ -118,10 +121,11 @@ bool BoschBMP3xx::setup(void) { _measurementTime_ms, F("ms needed for temperature and pressure oversampling.")); // bump up the standby time to a possible value - while (5 * pow(2, _standbyEnum) < max_measurementTime_us / 1000) { + while (5.0f * pow(2, static_cast(_standbyEnum)) < + max_measurementTime_us / 1000) { _standbyEnum = static_cast(static_cast(_standbyEnum) + 1); - _timeStandby_ms = 5 * pow(2, _standbyEnum); + _timeStandby_ms = 5.0f * pow(2, static_cast(_standbyEnum)); MS_DBG(_standbyEnum, _timeStandby_ms, static_cast(max_measurementTime_us / 1000)); } @@ -135,13 +139,13 @@ bool BoschBMP3xx::setup(void) { // float time_to_initialize_filter = // ((pow(2,_filterCoeff)) * (5 * pow(2,_timeStandby))) / 1E6; MS_DBG(F("BMP388/390's IIR filter will only be fully initialized"), - pow(2, _filterCoeffEnum) * _timeStandby_ms, + pow(2, static_cast(_filterCoeffEnum)) * _timeStandby_ms, F("ms after power on")); } if (_filterCoeffEnum != IIR_FILTER_OFF && _mode == FORCED_MODE) { MS_DBG( F("BMP388/390's IIR filter will only be fully initialized after"), - pow(2, _filterCoeffEnum), F("samples")); + pow(2, static_cast(_filterCoeffEnum)), F("samples")); } if (_mode == FORCED_MODE) { From f692e70aa2174cb6f0f11653d684a163327af7fe Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 30 Mar 2022 11:38:33 -0400 Subject: [PATCH 63/94] Fix case error Signed-off-by: Sara Damiano --- examples/DRWI_Mayfly1/DRWI_Mayfly1.ino | 2 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino index 9a6b2af95..7770628b7 100644 --- a/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino +++ b/examples/DRWI_Mayfly1/DRWI_Mayfly1.ino @@ -161,7 +161,7 @@ EverlightALSPT19 alsPt19(alsNumberReadings); // Built in on Mayfly 1.x // ========================================================================== /** Start [sensirion_sht4x] */ -#include +#include // NOTE: Use -1 for any pins that don't apply or aren't being used. const int8_t SHT4xPower = sensorPowerPin; // Power pin 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 5d6d59d01..9cf3029bd 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1702,7 +1702,7 @@ Variable* tbi2cDepth = // Sensirion SHT4X Digital Humidity and Temperature Sensor // ========================================================================== /** Start [sensirion_sht4x] */ -#include +#include // NOTE: Use -1 for any pins that don't apply or aren't being used. const int8_t SHT4xPower = sensorPowerPin; // Power pin From b02637788dfd2e3ab6e28ccc88feb327b340c989 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 12:28:51 -0400 Subject: [PATCH 64/94] Some doc fixes Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 16 ++++- .github/workflows/check_documentation.yaml | 16 ++++- README.md | 2 + .../build-install-doxygen.sh | 10 --- docs/Doxyfile | 10 +-- examples/DRWI_Mayfly1/ReadMe.md | 10 +-- src/sensors/BoschBMP3xx.h | 62 ++++++++++--------- 7 files changed, 71 insertions(+), 55 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index 8bef5a1ba..cdbd0a28e 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -10,7 +10,7 @@ on: env: DOXYGEN_VERSION: Release_1_9_3 - PYTHON_DEPS_ARCHIVE_NUM: 1 + PYTHON_DEPS_ARCHIVE_NUM: 2 jobs: build: @@ -39,8 +39,18 @@ jobs: python -m pip install --upgrade pip pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 - - name: Install GraphViz (dot) - run: sudo apt-get -y install graphviz + - name: Install all the dependencies needed to build and run Doxygen and m.css + run: | + sudo apt-get update + sudo apt-get -y install graphviz + sudo apt-get -y install build-essential + sudo apt-get -y install flex + sudo apt-get -y install bison + sudo apt-get -y install graphviz + sudo apt-get -y install texlive-base + sudo apt-get -y install texlive-latex-extra + sudo apt-get -y install texlive-fonts-extra + sudo apt-get -y install texlive-fonts-recommended - name: Restore Doxygen id: cache_doxygen diff --git a/.github/workflows/check_documentation.yaml b/.github/workflows/check_documentation.yaml index 86f2b3db1..f4a9ca75e 100644 --- a/.github/workflows/check_documentation.yaml +++ b/.github/workflows/check_documentation.yaml @@ -5,7 +5,7 @@ on: [push, pull_request] env: DOXYGEN_VERSION: Release_1_9_3 - PYTHON_DEPS_ARCHIVE_NUM: 1 + PYTHON_DEPS_ARCHIVE_NUM: 2 jobs: menu_inclusion: @@ -49,8 +49,18 @@ jobs: python -m pip install --upgrade pip pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 - - name: Install GraphViz (dot) - run: sudo apt-get -y install graphviz + - name: Install all the dependencies needed to build and run Doxygen and m.css + run: | + sudo apt-get update + sudo apt-get -y install graphviz + sudo apt-get -y install build-essential + sudo apt-get -y install flex + sudo apt-get -y install bison + sudo apt-get -y install graphviz + sudo apt-get -y install texlive-base + sudo apt-get -y install texlive-latex-extra + sudo apt-get -y install texlive-fonts-extra + sudo apt-get -y install texlive-fonts-recommended - name: Restore Doxygen id: cache_doxygen diff --git a/README.md b/README.md index f97f9706f..d26b53d40 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,12 @@ For some generalized information about attaching sensors to an Arduino style boa - [EZO-pH: pH](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__ph.html) - [EZO-RTD: Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__rtd.html) - [Bosch BME280: barometric pressure, humidity & temperature](https://envirodiy.github.io/ModularSensors/group__sensor__bme280.html) +- [Bosch BMP388 and BMP390: barometric pressure & temperature](https://envirodiy.github.io/ModularSensors/group__sensor__bmp3xx.html) - [Campbell Scientific OBS-3+: turbidity, via TI ADS1115](https://envirodiy.github.io/ModularSensors/group__sensor__obs3.html) - [Campbell Scientific ClariVUE10: turbidity](https://envirodiy.github.io/ModularSensors/group__sensor__clarivue.html) - [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) - [In-Situ RDO PRO-X: dissolved oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__insitu__rdo.html) diff --git a/continuous_integration/build-install-doxygen.sh b/continuous_integration/build-install-doxygen.sh index 2e9d698a9..36d7dda24 100644 --- a/continuous_integration/build-install-doxygen.sh +++ b/continuous_integration/build-install-doxygen.sh @@ -3,16 +3,6 @@ # Exit with nonzero exit code if anything fails set -e -# install all the dependencies for make for Doxygen -sudo apt-get update -sudo apt-get -y install build-essential -sudo apt-get -y install flex -sudo apt-get -y install bison -sudo apt-get -y install texlive-base -sudo apt-get -y install texlive-latex-extra -sudo apt-get -y install texlive-fonts-extra -sudo apt-get -y install texlive-fonts-recommended - cd $TRAVIS_BUILD_DIR if [ ! -f $TRAVIS_BUILD_DIR/doxygen-src/build/bin/doxygen ]; then diff --git a/docs/Doxyfile b/docs/Doxyfile index c44202eb6..4f0d38e05 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -1175,7 +1175,7 @@ VERBATIM_HEADERS = YES # generated with the -Duse_libclang=ON option for CMake. # The default value is: NO. -CLANG_ASSISTED_PARSING = NO +# CLANG_ASSISTED_PARSING = NO # If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS # tag is set to YES then doxygen will add the directory of each input to the @@ -1183,7 +1183,7 @@ CLANG_ASSISTED_PARSING = NO # The default value is: YES. # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. -CLANG_ADD_INC_PATHS = YES +# CLANG_ADD_INC_PATHS = YES # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that @@ -1191,7 +1191,7 @@ CLANG_ADD_INC_PATHS = YES # specified with INPUT and INCLUDE_PATH. # This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. -CLANG_OPTIONS = +# CLANG_OPTIONS = # If clang assisted parsing is enabled you can provide the clang parser with the # path to the directory containing a file called compile_commands.json. This @@ -1204,7 +1204,7 @@ CLANG_OPTIONS = # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. -CLANG_DATABASE_PATH = +# CLANG_DATABASE_PATH = #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index @@ -2289,7 +2289,7 @@ INCLUDE_PATH = ../src \ ../src/modems \ ../src/publishers \ ../src/sensors \ - ../src/watchdogs + ../src/WatchDogs # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the diff --git a/examples/DRWI_Mayfly1/ReadMe.md b/examples/DRWI_Mayfly1/ReadMe.md index 1de2eb21b..f0c48c7ac 100644 --- a/examples/DRWI_Mayfly1/ReadMe.md +++ b/examples/DRWI_Mayfly1/ReadMe.md @@ -27,15 +27,15 @@ _______ _______ -# Unique Features of the DRWI EnviroDIY LTE Example +# 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 ) +[//]: # ( @section example_drwi_mayfly1_pio_config PlatformIO Configuration ) -[//]: # ( @include{lineno} DRWI_SIM7080LTE/platformio.ini ) +[//]: # ( @include{lineno} DRWI_Mayfly1/platformio.ini ) -[//]: # ( @section example_drwi_ediylte_code The Complete Code ) +[//]: # ( @section example_drwi_mayfly1_code The Complete Code ) -[//]: # ( @include{lineno} DRWI_SIM7080LTE/DRWI_SIM7080LTE.ino ) +[//]: # ( @include{lineno} DRWI_Mayfly1/DRWI_Mayfly1.ino ) diff --git a/src/sensors/BoschBMP3xx.h b/src/sensors/BoschBMP3xx.h index 0d5fc3b1c..0444a2815 100644 --- a/src/sensors/BoschBMP3xx.h +++ b/src/sensors/BoschBMP3xx.h @@ -61,14 +61,14 @@ * * Recommended settings pressure oversampling (adapted from table 6 of the [datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf)) * - * | Oversampling setting | Pressure oversampling | Typical pressure resolution | Recommended temperature oversampling | - * | :-------------------: | :-------------------: | :-------------------------: | :----------------------------------: | - * | Ultra low power | ×1 | 16 bit / 2.64 Pa | ×1 | - * | Low power | ×2 | 17 bit / 1.32 Pa | ×1 | - * | Standard resolution | ×4 | 18 bit / 0.66 Pa | ×1 | - * | High resolution | ×8 | 19 bit / 0.33 Pa | ×1 | - * | Ultra high resolution | ×16 | 20 bit / 0.17 Pa | ×2 | - * | Highest resolution | ×32 | 21 bit / 0.085 Pa | ×2 | + * | Oversampling setting | Pressure oversampling | Typical pressure resolution | Recommended temperature oversampling | Measurement Time (typ., µsec) | + * | :-------------------: | :-------------------: | :-------------------------: | :----------------------------------: | :---------------------------: | + * | Ultra low power | ×1 | 16 bit / 2.64 Pa | ×1 | 6849 | + * | Low power | ×2 | 17 bit / 1.32 Pa | ×1 | 8869 | + * | Standard resolution | ×4 | 18 bit / 0.66 Pa | ×1 | 12909 | + * | High resolution | ×8 | 19 bit / 0.33 Pa | ×1 | 20989 | + * | Ultra high resolution | ×16 | 20 bit / 0.17 Pa | ×2 | 41189 | + * | Highest resolution | ×32 | 21 bit / 0.085 Pa | ×2 | 73509 | * * @subsection sensor_bmp3xx_temp_osr Recommended Temperature Oversampling * @@ -84,22 +84,22 @@ * * @subsection sensor_bmp3xx_filts_uses Settings by Use Case * - * This is a copy of Bosch's recommendations for pressure and temperature oversampling, + * This is a modified version of Bosch's recommendations for pressure and temperature oversampling, * IIR filter coeficients, and output data rates for various applications. * This appears as table 10 in the * [datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/Bosch-BMP390-Datasheet.pdf). * * Table 10: Recommended filter settings based on use cases * - * | Use case | Mode | Over-sampling setting | Pressure over-sampling | Temperature over-sampling | IIR filter coefficient | Current Consumption (IDD) [μA] | Standby Time (ms) | Output Data Rate (ODR) [Hz] | RMS Noise [cm] | - * | :--------------------------------------: | :----: | :-------------------: | :--------------------: | :-----------------------: | :--------------------: | :---------------------------------------: | :---------------: | :-------------------------: | :------------: | - * | handheld device low-power (e.g. Android) | Normal | High resolution | x8 | x1 | 2 | 145 | 80 | 12.5 | 11 | - * | handheld device dynamic (e.g. Android) | Normal | Standard resolution | x4 | x1 | 4 | 310 | 20 | 50 | 10 | - * | Weather monitoring (lowest power) | Forced | Ultra low power | x1 | x1 | Off | 4 | N/A¹ | 1/60 | 55 | - * | Drop detection | Normal | Low power | x2 | x1 | Off | 358 | 10 | 100 | 36 | - * | Indoor navigation | Normal | Ultra high resolution | x16 | x2 | 4 | 560 | 40 | 25 | 5 | - * | Drone | Normal | Standard resolution | x8 | x1 | 2 | 570 | 20 | 50 | 11 | - * | Indoor localization | Normal | Ultra low power | x1 | x1 | 4 | - | 640 | 1 | - | + * | Use case | Mode | Over-sampling setting | Pressure over-sampling | Temperature over-sampling | IIR filter coefficient | Standby Time (ms) | Output Data Rate (ODR) [Hz] | Current Consumption (IDD) [μA] | RMS Noise [cm] | + * | :--------------------------------------: | :----: | :-------------------: | :--------------------: | :-----------------------: | :--------------------: | :---------------: | :-------------------------: | :---------------------------------------: | :------------: | + * | handheld device low-power (e.g. Android) | Normal | High resolution | x8 | x1 | 2 | 80 | 12.5 | 145 | 11 | + * | handheld device dynamic (e.g. Android) | Normal | Standard resolution | x4 | x1 | 4 | 20 | 50 | 310 | 10 | + * | Weather monitoring (lowest power) | Forced | Ultra low power | x1 | x1 | Off | N/A¹ | 1/60 | 4 | 55 | + * | Drop detection | Normal | Low power | x2 | x1 | Off | 10 | 100 | 358 | 36 | + * | Indoor navigation | Normal | Ultra high resolution | x16 | x2 | 4 | 40 | 25 | 560 | 5 | + * | Drone | Normal | Standard resolution | x8 | x1 | 2 | 20 | 50 | 570 | 11 | + * | Indoor localization | Normal | Ultra low power | x1 | x1 | 4 | 640 | 1 | - | - | * ¹ Standby time does not apply in forced mode * * @section sensor_bmp3xx_datasheet Sensor Datasheet @@ -194,21 +194,22 @@ * > In both forced mode and normal mode the pressure and temperature * > measurement duration follow the equation: * > - * > Tconv = 234μs + *pres_en* x (392μs + 2osr_p - * > * 2020 μs) + *temp_en* x (163 μs + 2osr_t * 2020μs) + * > \f[T_{conv} = 234 \mu s + pres\_en \times (392 \mu s + 2^{osr\_p} \times + * 2020 \mu s) + temp\_en \times (163 \mu s + 2^{osr\_t} \times 2020 \mu s)\f] * > * > With: - * > - Tconv = total conversion time in μs - * > - *pres_en* = "0" or "1", depending of the status of the press_en bit - * > - *temp_en* = "0" or "1", depending of the status of the temp_en bit - * > - osr_p = amount of pressure oversampling repetitions - * > - osr_t = amount of temperature oversampling repetitions + * > - \f$T_{conv}\f$ = total conversion time in μs + * > - \f$pres\_en\f$ = "0" or "1", depending of the status of the press_en bit + * > - \f$temp\_en\f$ = "0" or "1", depending of the status of the temp_en bit + * > - \f$osr\_p\f$ = amount of pressure oversampling repetitions + * > - \f$osr\_t\f$ = amount of temperature oversampling repetitions * * Further, based on table 23 in the datasheet, there is up to a 18% difference * between the "typical" measurement time (as given by the equation) and the * maximum measurement time. * - * ModularSensors will always enable both pressure and temperature measurement. + * ModularSensors will always enable both pressure and temperature measurement + * and add an extra 18% wait to the calculated measurement time. */ #define BMP3XX_MEASUREMENT_TIME_MS 80 /**@}*/ @@ -347,13 +348,16 @@ class BoschBMP3xx : public Sensor { * - `OVERSAMPLING_X32` * * @param tempOversample Temperature oversampling setting - *
Possible values are the same as those for pressureOversample. + *
Possible values are the same as those for pressureOversample. Using + * temperature oversampling above X2 is not recommended as it does not + * further improve pressure data quality. * * @param filterCoeff Coefficient of the infinite impulse response (IIR) * filter (in samples). *
This is number of past samples considered in calculating the current - * filtered value. This only should be used when the sensor is in normal - * sampling mode and continuously powered. + * filtered value. This setting is **ignored** if the sensor will not be + * continuously powered. This only recommended when operating in "normal" + * sampling mode. *
Possible values are: * - `IIR_FILTER_OFF` (no filtering) * - `IIR_FILTER_1`, From 62f21bd0f5de8f9583c1ac6d8d6f704e0b841a7f Mon Sep 17 00:00:00 2001 From: neilh20 Date: Sun, 6 Feb 2022 15:49:30 -0800 Subject: [PATCH 65/94] #102 AOSongAM2315.cpp memory leak fix --- src/sensors/AOSongAM2315.cpp | 5 +++-- src/sensors/AOSongAM2315.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sensors/AOSongAM2315.cpp b/src/sensors/AOSongAM2315.cpp index 1b7e1eda7..54b9ec934 100644 --- a/src/sensors/AOSongAM2315.cpp +++ b/src/sensors/AOSongAM2315.cpp @@ -18,12 +18,14 @@ AOSongAM2315::AOSongAM2315(TwoWire* theI2C, int8_t powerPin, AM2315_STABILIZATION_TIME_MS, AM2315_MEASUREMENT_TIME_MS, powerPin, -1, measurementsToAverage) { _i2c = theI2C; + am2315ptr = new Adafruit_AM2315(_i2c); } AOSongAM2315::AOSongAM2315(int8_t powerPin, uint8_t measurementsToAverage) : Sensor("AOSongAM2315", AM2315_NUM_VARIABLES, AM2315_WARM_UP_TIME_MS, AM2315_STABILIZATION_TIME_MS, AM2315_MEASUREMENT_TIME_MS, powerPin, -1, measurementsToAverage, AM2315_INC_CALC_VARIABLES) { _i2c = &Wire; + am2315ptr = new Adafruit_AM2315(_i2c); } AOSongAM2315::~AOSongAM2315() {} @@ -58,8 +60,7 @@ bool AOSongAM2315::addSingleMeasurementResult(void) { if (bitRead(_sensorStatus, 6)) { MS_DBG(getSensorNameAndLocation(), F("is reporting:")); - Adafruit_AM2315 am2315(_i2c); // create a sensor object - ret_val = am2315.readTemperatureAndHumidity(&temp_val, &humid_val); + ret_val = am2315ptr->readTemperatureAndHumidity(&temp_val, &humid_val); if (!ret_val || isnan(temp_val)) temp_val = -9999; if (!ret_val || isnan(humid_val)) humid_val = -9999; diff --git a/src/sensors/AOSongAM2315.h b/src/sensors/AOSongAM2315.h index f9035bd48..ab711e909 100644 --- a/src/sensors/AOSongAM2315.h +++ b/src/sensors/AOSongAM2315.h @@ -233,6 +233,7 @@ class AOSongAM2315 : public Sensor { * @brief An internal reference to the hardware Wire instance. */ TwoWire* _i2c; + Adafruit_AM2315 *am2315ptr; // create a sensor object }; From d988dfac1a6edce9d83ae18fc7f1fd9847338955 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 13:04:30 -0400 Subject: [PATCH 66/94] Clarify some logger pin docs Signed-off-by: Sara Damiano --- src/LoggerBase.h | 64 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/src/LoggerBase.h b/src/LoggerBase.h index bcb7ccc91..88fb39778 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -196,9 +196,13 @@ class Logger { } /** - * @brief Set the pin (on the mcu) to use to control power to the SD card. + * @brief Set a digital pin number (on the mcu) to use to control power to + * the SD card and activate it as an output pin. * - * @note This functionality is not tested! + * Because this sets the pin mode, this function should only be called + * during the `setup()` or `loop()` portion of an Arduino program. + * + * @warning This functionality is not tested! * * @param SDCardPowerPin A digital pin number on the mcu controlling power * to the SD card. @@ -227,21 +231,29 @@ class Logger { void turnOffSDcard(bool waitForHousekeeping = true); /** - * @brief Set a pin for the slave select (chip select) of the SD card. + * @brief Set a digital pin number for the slave select (chip select) of the + * SD card and activate it as an output pin. * * This over-writes the value (if any) given in the constructor. The pin * mode of this pin will be set as `OUTPUT`. * + * Because this sets the pin mode, this function should only be called + * during the `setup()` or `loop()` portion of an Arduino program. + * * @param SDCardSSPin The pin on the mcu connected to the slave select of * the SD card. */ void setSDCardSS(int8_t SDCardSSPin); /** - * @brief Set both pins related to the SD card. + * @brief Set both pin numbers related to the SD card and activate them as + * output pins. * * These over-write the values (if any) given in the constructor. The pin - * mode of this pin will be set as `OUTPUT`. + * mode of these pins will be set as `OUTPUT`. + * + * Because this sets the pin mode, this function should only be called + * during the `setup()` or `loop()` portion of an Arduino program. * * @param SDCardSSPin The pin on the mcu connected to the slave select of * the SD card. @@ -252,13 +264,17 @@ class Logger { // /** - * @brief Set up the wake up pin for an RTC interrupt. + * @brief Set digital pin number for the wake up pin used as an RTC + * interrupt and activate it in the given pin mode. * * This over-writes the value (if any) given in the constructor. Use a * value of -1 to prevent the board from attempting to sleep. If using a * SAMD board with the internal RTC, the value of the pin is irrelevant as * long as it is positive. * + * Because this sets the pin mode, this function should only be called + * during the `setup()` or `loop()` portion of an Arduino program. + * * @note This sets the pin mode but does NOT enable the interrupt! * * @param mcuWakePin The pin on the mcu to be used to wake the mcu from deep @@ -271,12 +287,16 @@ class Logger { void setRTCWakePin(int8_t mcuWakePin, uint8_t wakePinMode = INPUT_PULLUP); /** - * @brief Set a pin to put out an alert that a measurement is being logged. + * @brief Set the digital pin number to put out an alert that a measurement + * is being logged and activate it as an output pin. * * The pin mode of this pin will be set as `OUTPUT`. This is intended to be * a pin with a LED on it so you can see the light come on when a * measurement is being taken. * + * Because this sets the pin mode, this function should only be called + * during the `setup()` or `loop()` portion of an Arduino program. + * * @param ledPin The pin on the mcu to be held `HIGH` while sensor data is * being collected and logged. */ @@ -291,10 +311,15 @@ class Logger { void alertOff(); /** - * @brief Set up a pin for an interrupt to enter testing mode **and** attach + * @brief Set the digital pin number for an interrupt pin used to enter + * testing mode, activate that pin as the given input type, **and** attach * the testing interrupt to it. * - * Intended to be attached to a button or other manual interrupt source. + * Intended to be used for a pin attached to a button or other manual + * interrupt source. + * + * Because this sets the pin mode, this function should only be called + * during the `setup()` or `loop()` portion of an Arduino program. * * Once in testing mode, the logger will attempt to connect the the internet * and take 25 measurements spaced at 5 second intervals writing the results @@ -317,23 +342,30 @@ class Logger { void setTestingModePin(int8_t buttonPin, uint8_t buttonPinMode = INPUT); /** - * @brief Set the five pins of interest for the logger + * @brief Set the digital pin numbers and activate pin modes for the five + * pins of interest for the logger + * + * Because this sets the pin mode, this function should only be called + * during the `setup()` or `loop()` portion of an Arduino program. * * @param mcuWakePin The pin on the mcu to listen to for a value-change - * interrupt to wake from deep sleep. This pin will be set to + * interrupt to wake from deep sleep. The mode of this pin will be set to + * `wakePinMode`. * @param SDCardSSPin The pin on the mcu connected to the slave select of * the SD card. The pin mode of this pin will be set as `OUTPUT`. * @param SDCardPowerPin A digital pin number on the mcu controlling power * to the SD card. The pin mode of this pin will be set as `OUTPUT`. * @param buttonPin The pin on the mcu to listen to for a value-change - * interrupt to enter testing mode. + * interrupt to enter testing mode. The mode of this pin will be set to + * `buttonPinMode`. * @param ledPin The pin on the mcu to be held `HIGH` while sensor data is * being collected and logged. The pin mode of this pin will be set as * `OUTPUT`. - * @param wakePinMode The pin mode to be used for wake up on the clock alert - * pin. Must be either `INPUT` OR `INPUT_PULLUP`. Optional with a default - * value of `INPUT_PULLUP`. The DS3231 has an active low interrupt, so the - * pull-up resistors should be enabled. + * @param wakePinMode The pin mode to be used for wake up on the + * `mcuWakePin` (clock alert) pin. Must be either `INPUT` OR + * `INPUT_PULLUP`. Optional with a default value of `INPUT_PULLUP`. The + * DS3231 has an active low interrupt, so the pull-up resistors should be + * enabled. * @param buttonPinMode The pin mode to be used for the button pin. Must be * either `INPUT` OR `INPUT_PULLUP`. Optional with a default value of * `INPUT`. Using `INPUT_PULLUP` will enable processor input resistors, From 734dadb3a4bb6f36942801bc59ed05540ab57ecc Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 13:14:07 -0400 Subject: [PATCH 67/94] Add aosong to changelog [ci skip] Signed-off-by: Sara Damiano --- ChangeLog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/ChangeLog.md b/ChangeLog.md index 725bbfea7..1cd51c063 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -59,6 +59,7 @@ This is *not* a breaking change at this time; the old class names are still usab ### Removed ### Fixed +- Fixed memory leak for AOSong AM2315 thanks to @neilh10 *** From 04498ac9672d069f15b83293fa0ba69985256181 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 13:16:37 -0400 Subject: [PATCH 68/94] update change log links [ci skip] Signed-off-by: Sara Damiano --- ChangeLog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 1cd51c063..90fceaa68 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -711,7 +711,9 @@ Our first release of the modular sensors library to support easily logging data *** -[Unreleased]: https://github.com/EnviroDIY/ModularSensors/compare/v0.31.2...HEAD +[Unreleased]: https://github.com/EnviroDIY/ModularSensors/compare/v0.32.2...HEAD +[0.32.2]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.32.2 +[0.32.0]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.32.0 [0.31.2]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.31.2 [0.31.0]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.31.0 [0.30.0]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.30.0 From c48437b6c495a833aaa62bff524aa4d7827e8636 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 13:41:50 -0400 Subject: [PATCH 69/94] Add example to docs, install sht lib There are too many DRWI examples! Signed-off-by: Sara Damiano --- continuous_integration/dependencies.json | 2 +- continuous_integration/install-deps-platformio.sh | 3 +++ docs/mcss-conf.py | 1 + examples/DRWI_Mayfly1/ReadMe.md | 4 ++-- examples/ReadMe.md | 15 +++++++++++++-- examples/examples.dox | 8 +++++++- 6 files changed, 27 insertions(+), 6 deletions(-) diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index 6d6daaf9e..513970db3 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -1,5 +1,5 @@ { - "action_cache_version": 11, + "action_cache_version": 12, "dependencies": [ { "name": "EnviroDIY_DS3231", diff --git a/continuous_integration/install-deps-platformio.sh b/continuous_integration/install-deps-platformio.sh index 0f30a9251..0d87046d6 100644 --- a/continuous_integration/install-deps-platformio.sh +++ b/continuous_integration/install-deps-platformio.sh @@ -45,6 +45,9 @@ pio lib -g install adafruit/'Adafruit INA219' echo "\e[32mInstalling adafruit/'Adafruit MPL115A2'\e[0m" pio lib -g install adafruit/'Adafruit MPL115A2' +echo "\e[32mInstalling adafruit/'Adafruit SHT'\e[0m" +pio lib -g install adafruit/'Adafruit SHT4x Library' + echo "\e[32mInstalling Martin Lindupp's BMP388 Library\e[0m" pio lib -g install https://github.com/MartinL1/BMP388_DEV.git diff --git a/docs/mcss-conf.py b/docs/mcss-conf.py index fe3e32edb..6ce174b44 100644 --- a/docs/mcss-conf.py +++ b/docs/mcss-conf.py @@ -101,6 +101,7 @@ # "DRWI Citizen Science", # "examples_drwi", # [ + # ("DRWI Mayfly 1.x", "example_drwi_mayfly1"), # ("DRWI EnviroDIY LTE", "example_drwi_ediylte"), # ("DRWI Digi LTE", "example_drwi_digilte"), # ("DRWI CitSci (2G", "example_drwi_2g"), diff --git a/examples/DRWI_Mayfly1/ReadMe.md b/examples/DRWI_Mayfly1/ReadMe.md index f0c48c7ac..730776edb 100644 --- a/examples/DRWI_Mayfly1/ReadMe.md +++ b/examples/DRWI_Mayfly1/ReadMe.md @@ -21,13 +21,13 @@ _______ [//]: # ( Start GitHub Only ) - [DRWI Sites with a Mayfly 1.x and EnviroDIY LTE Bees](#drwi-sites-with-a-mayfly-1x-and-envirodiy-lte-bees) -- [Unique Features of the DRWI EnviroDIY LTE Example](#unique-features-of-the-drwi-envirodiy-lte-example) +- [Unique Features of the DRWI Mayfly 1.x LTE Example](#unique-features-of-the-drwi-mayfly-1x-lte-example) [//]: # ( End GitHub Only ) _______ -# Unique Features of the DRWI EnviroDIY LTE Example +# Unique Features of the DRWI Mayfly 1.x LTE Example - Specifically for sites within the Delaware River Watershed Initiative. - Uses a EnviroDIY LTE Bee based on the SIMCom SIM7080G diff --git a/examples/ReadMe.md b/examples/ReadMe.md index 494ec7333..f9853de16 100644 --- a/examples/ReadMe.md +++ b/examples/ReadMe.md @@ -19,6 +19,7 @@ ___ - [Multiple Logging Intervals](#multiple-logging-intervals) - [Minimizing Cell Data Usage](#minimizing-cell-data-usage) - [DRWI Citizen Science](#drwi-citizen-science) + - [DRWI Mayfly 1.x LTE](#drwi-mayfly-1x-lte) - [DRWI EnviroDIY Bee LTE](#drwi-envirodiy-bee-lte) - [DRWI Digi LTE](#drwi-digi-lte) - [DRWI CitSci (2G)](#drwi-citsci-2g) @@ -115,6 +116,16 @@ ___ ## DRWI Citizen Science +### DRWI Mayfly 1.x LTE + +The DRWI Mayfly 1.x LTE example uses the sensors and equipment standard groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. +It includes a Meter Hydros 21 and a SIM7080G-based EnviroDIY Bee for communication. +This examples also makes use of the on-board light, temperature, and humidity sensors on the Mayfly 1.x. +The results are saved to the SD card and posted to the Monitor My Watershed data portal. + +- [Instructions for the Mayfly 1.x LTE DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_mayfly1.html) +- [The LTEG DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_Mayfly1) + ### DRWI EnviroDIY Bee LTE The DRWI EnviroDIY Bee LTE example uses the sensors and equipment standard groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. @@ -123,7 +134,7 @@ The results are saved to the SD card and posted to the Monitor My Watershed data The only difference between this and the other cellular DRWI examples is the type of modem used. - [Instructions for the EnviroDIY LTE DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_ediylte.html) -- [The LTEG DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) +- [The EnviroDIY LTE DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) ### DRWI Digi LTE @@ -133,7 +144,7 @@ The results are saved to the SD card and posted to the Monitor My Watershed data The only difference between this and the other cellular DRWI examples is the type of modem used. - [Instructions for the Digi LTE DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_digilte.html) -- [The LTEG DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) +- [The Digi LTE DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) ### DRWI CitSci (2G) diff --git a/examples/examples.dox b/examples/examples.dox index 786e2f156..864fcf6be 100644 --- a/examples/examples.dox +++ b/examples/examples.dox @@ -75,11 +75,17 @@ * @m_innerpage{page_examples_drwi} * @page page_examples_drwi DRWI Citizen Science * [DRWI Citizen Science](@ref examples_drwi) + * @m_innerpage{example_drwi_mayfly1} * @m_innerpage{example_drwi_ediylte} * @m_innerpage{example_drwi_digilte} * @m_innerpage{example_drwi_2g} * @m_innerpage{example_drwi_no_cell} */ +/** + * @example{lineno} DRWI_Mayfly1.ino @m_examplenavigation{example_drwi_mayfly1,} @m_footernavigation + * @brief Example for DRWI CitSci LTE sites with a Mayfly 1.x utilizing on-board sensors. + * See [the walkthrough page](@ref example_drwi_mayfly1) for detailed instructions. + */ /** * @example{lineno} DRWI_SIM7080LTE.ino @m_examplenavigation{example_drwi_ediylte,} @m_footernavigation * @brief Example for DRWI CitSci LTE sites. @@ -113,4 +119,4 @@ * @example{lineno} menu_a_la_carte.ino @m_examplenavigation{example_menu,} @m_footernavigation * @brief Example with all possible functionality. * See [the walkthrough page](@ref example_menu) for detailed instructions. - */ \ No newline at end of file + */ From 980c3a6b9eed0942d36946f54303318fdd993e72 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 15:19:51 -0400 Subject: [PATCH 70/94] Add footer navigation Signed-off-by: Sara Damiano --- README.md | 2 ++ docs/FAQ/Arduino-Streams.md | 2 ++ docs/FAQ/Processor-Compatibility.md | 2 ++ docs/Getting-Started/Getting-Started.md | 2 ++ docs/Getting-Started/Terminology.md | 2 ++ docs/Modem-Notes.md | 4 +++- examples/DRWI_2G/ReadMe.md | 4 +++- examples/DRWI_DigiLTE/ReadMe.md | 4 +++- examples/DRWI_Mayfly1/ReadMe.md | 2 ++ examples/DRWI_NoCellular/ReadMe.md | 4 +++- examples/DRWI_SIM7080LTE/ReadMe.md | 2 ++ examples/ReadMe.md | 2 ++ examples/baro_rho_correction/ReadMe.md | 4 +++- examples/data_saving/ReadMe.md | 4 +++- examples/double_logger/ReadMe.md | 4 +++- examples/logging_to_MMW/ReadMe.md | 4 +++- examples/logging_to_ThingSpeak/ReadMe.md | 4 +++- examples/menu_a_la_carte/ReadMe.md | 2 ++ examples/simple_logging/ReadMe.md | 2 ++ examples/simple_logging_LearnEnviroDIY/ReadMe.md | 4 +++- examples/single_sensor/ReadMe.md | 4 +++- 21 files changed, 53 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index d26b53d40..0fb4846f3 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,8 @@ There is extensive documentation available in the [ModularSensors github pages]( [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [ModularSensors](#modularsensors) - [The EnviroDIY ModularSensors Library](#the-envirodiy-modularsensors-library) diff --git a/docs/FAQ/Arduino-Streams.md b/docs/FAQ/Arduino-Streams.md index 93dc1b253..51b067d0e 100644 --- a/docs/FAQ/Arduino-Streams.md +++ b/docs/FAQ/Arduino-Streams.md @@ -2,6 +2,8 @@ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Notes on Arduino Streams and Software Serial](#notes-on-arduino-streams-and-software-serial) - [Hardware Serial](#hardware-serial) diff --git a/docs/FAQ/Processor-Compatibility.md b/docs/FAQ/Processor-Compatibility.md index fba44fccb..0bfde1557 100644 --- a/docs/FAQ/Processor-Compatibility.md +++ b/docs/FAQ/Processor-Compatibility.md @@ -2,6 +2,8 @@ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Processor Compatibility](#processor-compatibility) - [AtMega1284p (EnviroDIY Mayfly, Sodaq Mbili, Mighty 1284)](#atmega1284p-envirodiy-mayfly-sodaq-mbili-mighty-1284) diff --git a/docs/Getting-Started/Getting-Started.md b/docs/Getting-Started/Getting-Started.md index 1b8107ef6..e133a3e1f 100644 --- a/docs/Getting-Started/Getting-Started.md +++ b/docs/Getting-Started/Getting-Started.md @@ -2,6 +2,8 @@ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Getting Started](#getting-started) - [IDE and Driver Installation](#ide-and-driver-installation) diff --git a/docs/Getting-Started/Terminology.md b/docs/Getting-Started/Terminology.md index 467522375..603d8afff 100644 --- a/docs/Getting-Started/Terminology.md +++ b/docs/Getting-Started/Terminology.md @@ -6,6 +6,8 @@ Within this library, a Sensor, a Variable, and a Logger mean very specific thing [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Library Terminology](#library-terminology) - [Terms](#terms) diff --git a/docs/Modem-Notes.md b/docs/Modem-Notes.md index d39db54d7..ba97e55c0 100644 --- a/docs/Modem-Notes.md +++ b/docs/Modem-Notes.md @@ -2,6 +2,8 @@ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Notes about Modems](#notes-about-modems) - [Summary of Classes to use for Various Manufactured Modules](#summary-of-classes-to-use-for-various-manufactured-modules) @@ -184,7 +186,7 @@ Here are the pin numbers to use for modules that can be attached directly to an | Module | Power | Status | Reset | Sleep Request | | :-----------------------------------------------: | :---: | :----: | :------------: | :------------: | -| EnviroDIY WiFi Bee (ESP32) | 18¹ | -1 | A53 | -1 | +| EnviroDIY WiFi Bee (ESP32) | 18¹ | -1 | A53 | -1 | | EnviroDIY LTE Bee (SIM7080G) | 18¹ | 19 | N/A | 234 | | Digi XBee/XBee3, all variants (direct connection) | 18¹ | 19² | A53 | 23 | | DFRobot WiFi Bee (ESP8266) | 18¹ | -1 | -1 | -1 | diff --git a/examples/DRWI_2G/ReadMe.md b/examples/DRWI_2G/ReadMe.md index b39aad7db..80beb5146 100644 --- a/examples/DRWI_2G/ReadMe.md +++ b/examples/DRWI_2G/ReadMe.md @@ -10,10 +10,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [DRWI 2G Sites](#drwi-2g-sites) - [Unique Features of the DRWI 2G Example](#unique-features-of-the-drwi-2g-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Set the calibration coefficients for the Campbell OBS3+](#set-the-calibration-coefficients-for-the-campbell-obs3) diff --git a/examples/DRWI_DigiLTE/ReadMe.md b/examples/DRWI_DigiLTE/ReadMe.md index 0678e1d11..50cae9dfa 100644 --- a/examples/DRWI_DigiLTE/ReadMe.md +++ b/examples/DRWI_DigiLTE/ReadMe.md @@ -10,10 +10,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [DRWI Digi LTE Sites](#drwi-digi-lte-sites) - [Unique Features of the DRWI Digi LTE Example](#unique-features-of-the-drwi-digi-lte-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Set the calibration coefficients for the Campbell OBS3+](#set-the-calibration-coefficients-for-the-campbell-obs3) diff --git a/examples/DRWI_Mayfly1/ReadMe.md b/examples/DRWI_Mayfly1/ReadMe.md index 730776edb..3dc22cae4 100644 --- a/examples/DRWI_Mayfly1/ReadMe.md +++ b/examples/DRWI_Mayfly1/ReadMe.md @@ -19,6 +19,8 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [DRWI Sites with a Mayfly 1.x and EnviroDIY LTE Bees](#drwi-sites-with-a-mayfly-1x-and-envirodiy-lte-bees) - [Unique Features of the DRWI Mayfly 1.x LTE Example](#unique-features-of-the-drwi-mayfly-1x-lte-example) diff --git a/examples/DRWI_NoCellular/ReadMe.md b/examples/DRWI_NoCellular/ReadMe.md index 982a481dd..5905fbbcd 100644 --- a/examples/DRWI_NoCellular/ReadMe.md +++ b/examples/DRWI_NoCellular/ReadMe.md @@ -12,10 +12,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [DRWI sites with no Cellular Service](#drwi-sites-with-no-cellular-service) - [Unique Features of the DRWI LTE Example](#unique-features-of-the-drwi-lte-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Set the calibration coefficients for the Campbell OBS3+](#set-the-calibration-coefficients-for-the-campbell-obs3) diff --git a/examples/DRWI_SIM7080LTE/ReadMe.md b/examples/DRWI_SIM7080LTE/ReadMe.md index ac22bf359..0f9e164c2 100644 --- a/examples/DRWI_SIM7080LTE/ReadMe.md +++ b/examples/DRWI_SIM7080LTE/ReadMe.md @@ -20,6 +20,8 @@ _______ [//]: # ( @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) diff --git a/examples/ReadMe.md b/examples/ReadMe.md index f9853de16..40f283178 100644 --- a/examples/ReadMe.md +++ b/examples/ReadMe.md @@ -31,6 +31,8 @@ ___ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + ## Basic Functionality ### Single Sensor diff --git a/examples/baro_rho_correction/ReadMe.md b/examples/baro_rho_correction/ReadMe.md index e50395b0d..1914527d0 100644 --- a/examples/baro_rho_correction/ReadMe.md +++ b/examples/baro_rho_correction/ReadMe.md @@ -10,10 +10,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Calculating Results based on Measured Values](#calculating-results-based-on-measured-values) - [Unique Features of the Barometric Correction Example](#unique-features-of-the-barometric-correction-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) diff --git a/examples/data_saving/ReadMe.md b/examples/data_saving/ReadMe.md index 48c002046..4df834614 100644 --- a/examples/data_saving/ReadMe.md +++ b/examples/data_saving/ReadMe.md @@ -12,10 +12,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Minimizing Cellular Data Use](#minimizing-cellular-data-use) - [Unique Features of the Data Saving Example](#unique-features-of-the-data-saving-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) diff --git a/examples/double_logger/ReadMe.md b/examples/double_logger/ReadMe.md index c34f66cc6..5752c99d4 100644 --- a/examples/double_logger/ReadMe.md +++ b/examples/double_logger/ReadMe.md @@ -7,10 +7,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Multiple Time Intervals](#multiple-time-intervals) - [Unique Features of the Double Logger Example](#unique-features-of-the-double-logger-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Upload!](#upload) diff --git a/examples/logging_to_MMW/ReadMe.md b/examples/logging_to_MMW/ReadMe.md index c58f6e4cb..2663f8cc8 100644 --- a/examples/logging_to_MMW/ReadMe.md +++ b/examples/logging_to_MMW/ReadMe.md @@ -12,10 +12,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Sending Data to Monitor My Watershed/EnviroDIY](#sending-data-to-monitor-my-watershedenvirodiy) - [Unique Features of the Monitor My Watershed Example](#unique-features-of-the-monitor-my-watershed-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) diff --git a/examples/logging_to_ThingSpeak/ReadMe.md b/examples/logging_to_ThingSpeak/ReadMe.md index 5e7560e44..bc8ee3cb0 100644 --- a/examples/logging_to_ThingSpeak/ReadMe.md +++ b/examples/logging_to_ThingSpeak/ReadMe.md @@ -7,10 +7,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Sending data to ThingSpeak](#sending-data-to-thingspeak) - [Unique Features of the ThingSpeak Example](#unique-features-of-the-thingspeak-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Modify the Example](#modify-the-example) - [Upload!](#upload) diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index fd3126f44..db45aed19 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -21,6 +21,8 @@ ___ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Example showing all possible functionality](#example-showing-all-possible-functionality) - [Walking Through the Code](#walking-through-the-code) diff --git a/examples/simple_logging/ReadMe.md b/examples/simple_logging/ReadMe.md index 5ec863e75..372e082a7 100644 --- a/examples/simple_logging/ReadMe.md +++ b/examples/simple_logging/ReadMe.md @@ -10,6 +10,8 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Simple Logging](#simple-logging) - [Unique Features of the Simple Logging Example](#unique-features-of-the-simple-logging-example) diff --git a/examples/simple_logging_LearnEnviroDIY/ReadMe.md b/examples/simple_logging_LearnEnviroDIY/ReadMe.md index d32d9ce25..abc46699d 100644 --- a/examples/simple_logging_LearnEnviroDIY/ReadMe.md +++ b/examples/simple_logging_LearnEnviroDIY/ReadMe.md @@ -12,10 +12,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Learn EnviroDIY Course](#learn-envirodiy-course) - [Unique Features of the Learn EnviroDIY Example](#unique-features-of-the-learn-envirodiy-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Set the logger ID](#set-the-logger-id) - [Upload!](#upload) diff --git a/examples/single_sensor/ReadMe.md b/examples/single_sensor/ReadMe.md index 8192503a0..a68d12824 100644 --- a/examples/single_sensor/ReadMe.md +++ b/examples/single_sensor/ReadMe.md @@ -7,10 +7,12 @@ _______ [//]: # ( @tableofcontents ) +[//]: # ( @m_footernavigation ) + [//]: # ( Start GitHub Only ) - [Using a Single Sensor](#using-a-single-sensor) - [Unique Features of the Single Sensor Example](#unique-features-of-the-single-sensor-example) -- [To Use this Example:](#to-use-this-example) +- [To Use this Example](#to-use-this-example) - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - [Upload!](#upload) From cbf69de6f7848335283179d1b596a76f01655842 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 16:19:56 -0400 Subject: [PATCH 71/94] Rename voltages, ad deprecated notes Signed-off-by: Sara Damiano --- ChangeLog.md | 14 +- docs/Doxyfile | 2 +- docs/mcss-Doxyfile | 2 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 20 +- src/LoggerBase.h | 17 +- src/LoggerModem.h | 9 +- src/dataPublisherBase.h | 10 +- src/sensors/BoschBMP3xx.h | 19 +- src/sensors/ExternalVoltage.h | 325 +--------------- src/sensors/FreescaleMPL115A2.h | 27 +- src/sensors/PaleoTerraRedox.h | 29 +- .../{ExternalVoltage.cpp => TIADS1x15.cpp} | 27 +- src/sensors/TIADS1x15.h | 355 ++++++++++++++++++ src/sensors/TIINA219.h | 26 +- src/sensors/YosemitechY514.h | 2 +- 15 files changed, 486 insertions(+), 398 deletions(-) rename src/sensors/{ExternalVoltage.cpp => TIADS1x15.cpp} (80%) create mode 100644 src/sensors/TIADS1x15.h diff --git a/ChangeLog.md b/ChangeLog.md index 90fceaa68..2048dcf3f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -41,9 +41,15 @@ So, for most of our users with Mayflies, this will be a _**fix**_. But for anyone using a different board/processor/button configuration that depended on the processor pull-up resistors, this will be a breaking change and they will need to specify the button mode in the `setTestingModePin` or `setLoggerPins` function to return to the previous behavior. - Added a longer warm up time and removed some of the modem set-up to work with the ESP-IDF AT firmware versions >2.0 - Made sure that all example clock synchronization happens at noon instead of midnight. -- Renamed class "MPL115A2" to "FreescaleMPL115A2" and all related variable classes. -This is for consistency with the file name and other classes with manufacturer in the name. -This is *not* a breaking change at this time; the old class names are still usable. +- **Renamed Classes:** Renamed several classes for internal consistency. +These are *not* breaking changes at this time; the old class names are still usable. + - Rename class `MPL115A2` to `FreescaleMPL115A2` + - Rename class `MPL115A2_Pressure` to `FreescaleMPL115A2_Pressure` + - Rename class `MPL115A2_Temp` to `FreescaleMPL115A2_Temp` + - Rename class `TIINA219_Volt` to `TIINA219_Voltage` + - Rename class `PaleoTerraRedox_Volt` to `PaleoTerraRedox_Voltage` + - Rename class `ExternalVoltage` to `TIADS1x15` + - Rename class `ExternalVoltage_Volt` to `TIADS1x15_Voltage` - **Documentation:** Migrated to latest version of Doxygen (1.9.3). ### Added @@ -754,3 +760,5 @@ Our first release of the modular sensors library to support easily logging data [0.2.2-beta]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.2.2-beta [//]: # ( @tableofcontents{XML:1} ) + +[//]: # ( @m_footernavigation ) diff --git a/docs/Doxyfile b/docs/Doxyfile index 4f0d38e05..a2c957e8f 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -275,7 +275,7 @@ ALIASES = "license=@par License:\n" \ "m_keyword{3}=@xmlonly@endxmlonly" \ "m_enum_values_as_keywords=@xmlonly@endxmlonly" \ "m_since{2}=@since @m_class{m-label m-success m-flat} @ref changelog-\1-\2 \"since v\1.\2\"" \ - "m_deprecated_since{2}=@since deprecated in v\1.\2 @deprecated" \ + "m_deprecated_since{3}=@since deprecated in v\1.\2.\3 @deprecated" \ "menulink{1}=[menu a la carte](@ref menu_walk_\1)" \ "menusnip{1}=@snippet{lineno} menu_a_la_carte.ino \1 ^^ ^^ " \ "m_innerpage{1}=@xmlonly @endxmlonly" diff --git a/docs/mcss-Doxyfile b/docs/mcss-Doxyfile index 1035423e3..a260c6f97 100644 --- a/docs/mcss-Doxyfile +++ b/docs/mcss-Doxyfile @@ -18,4 +18,4 @@ ALIASES += \ "m_keyword{3}=@xmlonly@endxmlonly" \ "m_enum_values_as_keywords=@xmlonly@endxmlonly" \ "m_since{2}=@since @m_class{m-label m-success m-flat} @ref changelog-\1-\2 \"since v\1.\2\"" \ - "m_deprecated_since{2}=@since deprecated in v\1.\2 @deprecated" \ No newline at end of file + "m_deprecated_since{3}=@since deprecated in v\1.\2.\3 @deprecated" \ 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 9cf3029bd..63af648fd 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1294,7 +1294,7 @@ Variable* alsPt19Lux = new EverlightALSPT19_Illuminance( // External Voltage via TI ADS1115 // ========================================================================== /** Start [external_voltage] */ -#include +#include // NOTE: Use -1 for any pins that don't apply or aren't being used. const int8_t ADSPower = sensorPowerPin; // Power pin @@ -1304,12 +1304,12 @@ const uint8_t evADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC const uint8_t VoltReadsToAvg = 1; // Only read one sample // Create an External Voltage sensor object -ExternalVoltage extvolt(ADSPower, ADSChannel, dividerGain, evADSi2c_addr, - VoltReadsToAvg); +TIADS1x15 ads1x15(ADSPower, ADSChannel, dividerGain, evADSi2c_addr, + VoltReadsToAvg); // Create a voltage variable pointer -Variable* extvoltV = - new ExternalVoltage_Volt(&extvolt, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* ads1x15Volt = + new TIADS1x15_Voltage(&ads1x15, "12345678-abcd-1234-ef00-1234567890ab"); /** End [external_voltage] */ #endif @@ -1662,8 +1662,8 @@ PaleoTerraRedox ptRedox(paleoTerraPower, paleoI2CAddress); #endif // Create the voltage variable for the redox sensor -Variable* ptVolt = - new PaleoTerraRedox_Volt(&ptRedox, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* ptVolt = new PaleoTerraRedox_Voltage( + &ptRedox, "12345678-abcd-1234-ef00-1234567890ab"); /** End [paleo_terra_redox] */ #endif @@ -1773,8 +1773,8 @@ TIINA219 ina219(INA219Power, INA219i2c_addr, INA219ReadingsToAvg); // Create current, voltage, and power variable pointers for the INA219 Variable* inaCurrent = new TIINA219_Current(&ina219, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* inaVolt = new TIINA219_Volt(&ina219, - "12345678-abcd-1234-ef00-1234567890ab"); +Variable* inaVolt = + new TIINA219_Voltage(&ina219, "12345678-abcd-1234-ef00-1234567890ab"); Variable* inaPower = new TIINA219_Power(&ina219, "12345678-abcd-1234-ef00-1234567890ab"); /** End [ti_ina219] */ @@ -2464,7 +2464,7 @@ Variable* variableList[] = { alsPt19Lux, #endif #if defined BUILD_SENSOR_EXTERNAL_VOLTAGE - extvoltV, + ads1x15Volt, #endif #if defined BUILD_SENSOR_FREESCALE_MPL115A2 mplTemp, diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 88fb39778..7f4c6e8aa 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -566,9 +566,10 @@ class Logger { */ void publishDataToRemotes(void); /** - * @brief Retained for backwards compatibility. + * @brief Retained for backwards compatibility, use publishDataToRemotes() + * in new code. * - * @deprecated use publishDataToRemotes() + * @m_deprecated_since{0,22,5} */ void sendDataToRemotes(void); @@ -616,18 +617,20 @@ class Logger { */ static int8_t getLoggerTimeZone(void); /** - * @brief Retained for backwards compatibility. + * @brief Retained for backwards compatibility; use setLoggerTimeZone(int8_t + * timeZone) in new code. * - * @deprecated use setLoggerTimeZone(int8_t timeZone) + * @m_deprecated_since{0,22,4} * * @param timeZone The timezone data shold be saved to the SD card in. This * need not be the same as the timezone of the real time clock. */ static void setTimeZone(int8_t timeZone); /** - * @brief Retained for backwards compatibility. + * @brief Retained for backwards compatibility; use getLoggerTimeZone() in + * new code. * - * @deprecated use getLoggerTimeZone() + * @m_deprecated_since{0,22,4} * * @return **int8_t** The timezone data is be saved to the SD card in. This * is not be the same as the timezone of the real time clock. @@ -691,7 +694,7 @@ class Logger { * @return **uint32_t** The number of seconds from January 1, 1970 in the * logging time zone. * - * @m_deprecated_since{0,33} + * @m_deprecated_since{0,33,0} */ static uint32_t getNowEpoch(void); diff --git a/src/LoggerModem.h b/src/LoggerModem.h index 2519f0aa7..5440f8ef5 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -350,9 +350,10 @@ class loggerModem { */ virtual bool modemSetup(void); /** - * @brief Retained for backwards compatibility. + * @brief Retained for backwards compatibility; use modemSetup() in new + * code. * - * @deprecated use modemSetup() + * @m_deprecated_since{0,24,1} * * @return **bool** True if setup was successful */ @@ -381,9 +382,9 @@ class loggerModem { */ virtual bool modemWake(void) = 0; /** - * @brief Retained for backwards compatibility. + * @brief Retained for backwards compatibility; use modemWake() in new code. * - * @deprecated use modemWake() + * @m_deprecated_since{0,24,1} * * @return **bool** True if wake was sucessful, modem should be ready to * communicate diff --git a/src/dataPublisherBase.h b/src/dataPublisherBase.h index 2b3e34a11..f00921f2e 100644 --- a/src/dataPublisherBase.h +++ b/src/dataPublisherBase.h @@ -236,9 +236,10 @@ class dataPublisher { virtual int16_t publishData(); /** - * @brief Retained for backwards compatibility. + * @brief Retained for backwards compatibility; use publishData(Client* + * outClient) in new code. * - * @deprecated use publishData(Client* outClient) + * @m_deprecated_since{0,22,5} * * @param outClient An Arduino client instance to use to print data to. * Allows the use of any type of client and multiple clients tied to a @@ -248,9 +249,10 @@ class dataPublisher { */ virtual int16_t sendData(Client* outClient); /** - * @brief Retained for backwards compatibility. + * @brief Retained for backwards compatibility; use publishData() in new + * code. * - * @deprecated use publishData() + * @m_deprecated_since{0,22,5} * * @return **int16_t** The result of publishing data. May be an http * response code or a result code from PubSubClient. diff --git a/src/sensors/BoschBMP3xx.h b/src/sensors/BoschBMP3xx.h index 0444a2815..8e7fdf8a4 100644 --- a/src/sensors/BoschBMP3xx.h +++ b/src/sensors/BoschBMP3xx.h @@ -179,23 +179,22 @@ * bmp3xxtimingTest.ino */ #define BMP3XX_STABILIZATION_TIME_MS 4000 +/* clang-format off */ /** - * @brief Sensor::_measurementTime_ms; BMP390 takes 135-138 ms 78.09ms (max) to - * complete a measurement at 32x pressure oversampling and 2x temperature - * oversampling. A measurement may take up to 138ms at 32x pressure and - * temperature oversampling, but oversampling rates above 2x for temperature are - * not recommended. + * @brief Sensor::_measurementTime_ms; The number given in this define will be + * recalculated and over-written in the set-up. * - * The number given in this define will be recalculated and over-written in the - * set-up. + * The BMP390 takes 78.09ms (max) to complete a measurement at 32x pressure + * oversampling and 2x temperature oversampling. A measurement may take up to + * 138ms at 32x pressure and temperature oversampling, but oversampling rates + * above 2x for temperature are not recommended. * * Following 3.9.2 of the datasheet: * * > In both forced mode and normal mode the pressure and temperature * > measurement duration follow the equation: * > - * > \f[T_{conv} = 234 \mu s + pres\_en \times (392 \mu s + 2^{osr\_p} \times - * 2020 \mu s) + temp\_en \times (163 \mu s + 2^{osr\_t} \times 2020 \mu s)\f] + * > \f[T_{conv} = 234 \mu s + pres\_en \times (392 \mu s + 2^{osr\_p} \times 2020 \mu s) + temp\_en \times (163 \mu s + 2^{osr\_t} \times 2020 \mu s)\f] * > * > With: * > - \f$T_{conv}\f$ = total conversion time in μs @@ -204,6 +203,7 @@ * > - \f$osr\_p\f$ = amount of pressure oversampling repetitions * > - \f$osr\_t\f$ = amount of temperature oversampling repetitions * + * * Further, based on table 23 in the datasheet, there is up to a 18% difference * between the "typical" measurement time (as given by the equation) and the * maximum measurement time. @@ -212,6 +212,7 @@ * and add an extra 18% wait to the calculated measurement time. */ #define BMP3XX_MEASUREMENT_TIME_MS 80 +/* clang-format on */ /**@}*/ /** diff --git a/src/sensors/ExternalVoltage.h b/src/sensors/ExternalVoltage.h index 8c52a4e62..63b3dc109 100644 --- a/src/sensors/ExternalVoltage.h +++ b/src/sensors/ExternalVoltage.h @@ -7,333 +7,16 @@ * Adapted from CampbellOBS3.h by Sara Geleskie Damiano * * - * @brief This file contains the ExternalVoltage sensor subclass and the - * ExternalVoltage_Volt variable subclass. - * - * These are used for any voltage measureable on a TI ADS1115 or ADS1015. There - * is a multiplier allowed for a voltage divider between the raw voltage and the - * ADS. - * - * This depends on the soligen2010 fork of the Adafruit ADS1015 library. + * @brief This file only serves to support backwards compatibility for the + * renamed TIADS1x15. */ /* clang-format off */ -/** - * @defgroup analog_group Analog Sensors via TI ADS1x15 - * The Sensor and Variable objects for all analog sensors requiring - * analog-to-digital conversion by TI ADS1x15. - * - * @ingroup the_sensors - * - * @tableofcontents - * @m_footernavigation - * - * @section analog_intro Introduction - * - * Many sensors output simple analog voltages and leave the conversion to a digital - * signal and final result up to the user. These types of sensors are supported in - * Modular sensors by way of a Texas Instruments ADS1115 or ADS1015. The TI ADS1115 ADD - * is a precision, low-power, 16-bit, I2C-compatible, analog-to-digitalconverter (ADC). - * It is built into the EnviroDIY Mayfly. The ADS1015 is a very similar ADC with 12-bit - * resolution and a slightly lower price point. Both chips are widely available in - * Arduino-ready breakouts. - * - * ModularSensors always uses the TI ADS1115 (also ADS1113 or ADS1114) by default, but - * if you wish to use a 12 bit TI ADS1015 (also ADS1013 or ADS1014) you can compile with - * the build flag ```-DMS_USE_ADS1015```. - * - * In the majority of break-out boards, and on the Mayfly, the I2C address of the - * ADS1x15 is set as 0x48 by tying the address pin to ground. Up to four of these ADD's - * be used by changing the address value by changing the connection of the address pin - * on the ADS1x15. The ADS1x15 requires an input voltage of 2.0-5.5V, but *this library - * always assumes the ADS is powered with 3.3V*. - * - * @note ModularSensors only supports connecting the ADS1x15 to primary hardware I2C instance. - * Connecting the ADS to a secondary hardware or software I2C instance is *not* supported! - * - * Communication with the ADS1x15 depends on the - * [soligen2010 fork of the Adafruit ADS1015 library](https://github.com/soligen2010/Adafruit_ADS1X15). - * - * @note We do *not* use the Adafruit library! The soligen2010 fork corrects some errors - * in the Adafruit library. Until those corrections are pulled into the main library, we - * use the fork instead. - * - * @section analog_ads1x15_specs Specifications - * @note *In all cases, we assume that the ADS1x15 is powered at 3.3V and set the ADC's internal gain to 1x. - * - * This divides the bit resolution over the range of 0-4.096V. - * - Response time: < 1ms - * - Resample time: 860 samples per second (~1.2ms) - * - Range: - * - Range is determined by supply voltage - No more than VDD + 0.3 V r 5.5 V - * (whichever is smaller) must be applied to this device. - * - 0 - 3.6V [when ADC is powered at 3.3V] - * - Accuracy: - * - 16-bit ADC (ADS1115): < 0.25% (gain error), <0.25 LSB (offset errror) - * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): < 0.15% (gain error), <3 LSB (offset errror) - * - Resolution: - * - 16-bit ADC (ADS1115): - * - without voltage divider: 0.125 mV - * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): - * - without voltage divider: 2 mV - * - * @note 1 bit of resolution is lost in single-ended reading. The maximum possible - * resolution is over the differential range from negative to positive full scale, a - * single ended reading is only over the range from 0 to positive full scale). - * - * @section analog_ads1x15_datasheet Sensor Datasheet - * Technical specifications for the TI ADS1115 can be found at: http://www.ti.com/product/ADS1115 - * For the ADS1015, see: https://www.ti.com/product/ADS1015 - * - [ADS1115 Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/TI-ADS101x-Analog-to-Digital-Converter.pdf) - * - [ADS1015 Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/TI-ADS111x-Analog-to-Digital-Converter.pdf) - */ -/* clang-format on */ -/* clang-format off */ -/** - * @defgroup sensor_ads1x15 TI ADS1x15 External Voltage Sensor - * Classes for simple external analog voltage measurements. - * - * @ingroup analog_group - * - * @tableofcontents - * @m_footernavigation - * - * @section sensor_ads1x15_intro Introduction - * - * Analog data output is supported in ModularSensors by way of the - * Texas Instruments ADS1115. - * - * The External Voltage module is used for any case where the voltage itself is - * the desired value (as for an external battery). It can also be used in - * combination with a calculated variable to support any other analog sensor not - * explicity supported by ModularSensors. To increase the range available for - * voltage measurements, this module supports the use of a voltage divider. - * - * If you are working with an EnviroDIY Mayfly, the easiest voltage divider to - * connect is the Grove voltage divider sold by seeed studio. The grove voltage - * divider is a simple voltage divider designed to measure high external - * voltages on a low voltage ADC. This module employs a variable gain via two - * pairs of voltage dividers, and a unity gain amplification to reduce output - * impedance of the module. - * - * @section sensor_ads1x15_datasheet Sensor Datasheet - * Technical specifications for the Grove Voltage Divider can be found at: - * http://wiki.seeedstudio.com/Grove-Voltage_Divider - * - * @section sensor_ads1x15_flags Build flags - * - ```-D MS_USE_ADS1015``` - * - switches from the 16-bit ADS1115 to the 12 bit ADS1015 - * - * @section sensor_ads1x15_ctor Sensor Constructor - * {{ @ref ExternalVoltage::ExternalVoltage }} - * - * ___ - * @section sensor_ads1x15_examples Example Code - * The TI ADS1X15 external voltage sensor is used in the @menulink{external_voltage} - * example. - * - * @menusnip{external_voltage} - */ -/* clang-format on */ // Header Guards #ifndef SRC_SENSORS_EXTERNALVOLTAGE_H_ #define SRC_SENSORS_EXTERNALVOLTAGE_H_ -// Debugging Statement -// #define MS_EXTERNALVOLTAGE_DEBUG +// Included the new file name +#include "TIADS1x15.h" -#ifdef MS_EXTERNALVOLTAGE_DEBUG -#define MS_DEBUGGING_STD "ExternalVoltage" -#endif - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "VariableBase.h" -#include "SensorBase.h" - -/** @ingroup sensor_ads1x15 */ -/**@{*/ - -// Sensor Specific Defines -/// @brief Sensor::_numReturnedValues; the ADS1115 can report 1 value. -#define EXT_VOLTAGE_NUM_VARIABLES 1 -/// @brief Sensor::_incCalcValues; we don't calculate any additional values. -#define EXT_VOLTAGE_INC_CALC_VARIABLES 0 - -/** - * @anchor sensor_ads1x15_timing - * @name Sensor Timing - * The sensor timing for a TI ADS1x15 analog-to-digital converter (ADC) - * The timing used for simple external voltage measurements is that of the - * ADS1x15. - */ -/**@{*/ -/// @brief Sensor::_warmUpTime_ms; the ADS1115 warms up in 2ms. -#define EXT_VOLTAGE_WARM_UP_TIME_MS 2 -/** - * @brief Sensor::_stabilizationTime_ms; the ADS1115 is stable 0ms after warm-up - * - * We assume a voltage is instantly ready. - */ -#define EXT_VOLTAGE_STABILIZATION_TIME_MS 0 -/** - * @brief Sensor::_measurementTime_ms; the ADS1115 completes 860 conversions per - * second, but the wait for the conversion to complete is built into the - * underlying library, so we do not need to wait further here. - */ -#define EXT_VOLTAGE_MEASUREMENT_TIME_MS 0 -/**@}*/ - -/** - * @anchor sensor_ads1x15_volt - * @name Voltage - * The volt variable from a TI ADS1x15 analog-to-digital converter (ADC) - * - Range: - * - without voltage divider: 0 - 3.6V [when ADC is powered at 3.3V] - * - 1/gain = 3x: 0.3 ~ 12.9V - * - 1/gain = 10x: 1 ~ 43V - * - Accuracy: - * - 16-bit ADC (ADS1115): < 0.25% (gain error), <0.25 LSB (offset errror) - * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): < 0.15% - * (gain error), <3 LSB (offset errror) - * - Resolution: - * - 16-bit ADC (ADS1115): - * - @m_span{m-dim}@ref #EXT_VOLTAGE_RESOLUTION = 4@m_endspan - * - without voltage divider: 0.125 mV - * - 1/gain = 3x: 0.375 mV - * - 1/gain = 10x: 1.25 mV - * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): - * - @m_span{m-dim}@ref #EXT_VOLTAGE_RESOLUTION = 1@m_endspan - * - without voltage divider: 2 mV - * - 1/gain = 3x: 6 mV - * - 1/gain = 10x: 20 mV * - * - * {{ @ref ExternalVoltage_Volt::ExternalVoltage_Volt }} - */ -/**@{*/ -/// Variable number; voltage is stored in sensorValues[0]. -#define EXT_VOLTAGE_VAR_NUM 0 -/// @brief Variable name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); -/// "voltage" -#define EXT_VOLTAGE_VAR_NAME "voltage" -/// @brief Variable unit name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "volt" -#define EXT_VOLTAGE_UNIT_NAME "volt" -/// @brief Default variable short code; "extVoltage" -#define EXT_VOLTAGE_DEFAULT_CODE "extVoltage" - -#ifdef MS_USE_ADS1015 -/// @brief Decimals places in string representation; voltage should have 1. -#define EXT_VOLTAGE_RESOLUTION 1 -#else -/// @brief Decimals places in string representation; voltage should have 4. -#define EXT_VOLTAGE_RESOLUTION 4 -#endif -/**@}*/ - -/// @brief The assumed address of the ADS1115, 1001 000 (ADDR = GND) -#define ADS1115_ADDRESS 0x48 - -/* clang-format off */ -/** - * @brief The Sensor sub-class for the - * [external votlage as measured by TI ADS1115 or ADS1015](@ref sensor_ads1x15). - * - * @ingroup sensor_ads1x15 - */ -/* clang-format on */ -class ExternalVoltage : public Sensor { - public: - /** - * @brief Construct a new External Voltage object - need the power pin and - * the data channel on the ADS1x15. - * - * The gain value, I2C address, and number of measurements to average are - * optional. If nothing is given a 1x gain is used. - * - * @note ModularSensors only supports connecting the ADS1x15 to the primary - * hardware I2C instance defined in the Arduino core. Connecting the ADS to - * a secondary hardware or software I2C instance is *not* supported! - * - * @param powerPin The pin on the mcu controlling power to the sensor - * Use -1 if it is continuously powered. - * @param adsChannel The ADS channel of interest (0-3). - * @param gain The gain multiplier, if a voltage divider is used. - * @param i2cAddress The I2C address of the ADS 1x15, default is 0x48 (ADDR - * = GND) - * @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. - */ - ExternalVoltage(int8_t powerPin, uint8_t adsChannel, float gain = 1, - uint8_t i2cAddress = ADS1115_ADDRESS, - uint8_t measurementsToAverage = 1); - /** - * @brief Destroy the External Voltage object - */ - ~ExternalVoltage(); - - /** - * @copydoc Sensor::getSensorLocation() - */ - String getSensorLocation(void) override; - - /** - * @copydoc Sensor::addSingleMeasurementResult() - */ - bool addSingleMeasurementResult(void) override; - - private: - uint8_t _adsChannel; - float _gain; - uint8_t _i2cAddress; -}; - - -// The single available variable is voltage -/* clang-format off */ -/** - * @brief The Variable sub-class used for the - * [voltage output](@ref sensor_ads1x15_volt) from a - * [TI ADS1115 or ADS1015](@ref sensor_ads1x15). - * - * @ingroup sensor_ads1x15 - */ -/* clang-format on */ -class ExternalVoltage_Volt : public Variable { - public: - /** - * @brief Construct a new ExternalVoltage_Volt object. - * - * @param parentSense The parent ExternalVoltage 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 "extVoltage". - */ - explicit ExternalVoltage_Volt( - ExternalVoltage* parentSense, const char* uuid = "", - const char* varCode = EXT_VOLTAGE_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)EXT_VOLTAGE_VAR_NUM, - (uint8_t)EXT_VOLTAGE_RESOLUTION, EXT_VOLTAGE_VAR_NAME, - EXT_VOLTAGE_UNIT_NAME, varCode, uuid) {} - /** - * @brief Construct a new ExternalVoltage_Volt object. - * - * @note This must be tied with a parent ExternalVoltage before it can be - * used. - */ - ExternalVoltage_Volt() - : Variable((const uint8_t)EXT_VOLTAGE_VAR_NUM, - (uint8_t)EXT_VOLTAGE_RESOLUTION, EXT_VOLTAGE_VAR_NAME, - EXT_VOLTAGE_UNIT_NAME, EXT_VOLTAGE_DEFAULT_CODE) {} - /** - * @brief Destroy the ExternalVoltage_Volt object - no action needed. - */ - ~ExternalVoltage_Volt() {} -}; -/**@}*/ #endif // SRC_SENSORS_EXTERNALVOLTAGE_H_ diff --git a/src/sensors/FreescaleMPL115A2.h b/src/sensors/FreescaleMPL115A2.h index 47cad7824..06f32a3a0 100644 --- a/src/sensors/FreescaleMPL115A2.h +++ b/src/sensors/FreescaleMPL115A2.h @@ -241,6 +241,14 @@ class FreescaleMPL115A2 : public Sensor { TwoWire* _i2c; }; +/** + * @brief typedef for backwards compatibility; use the FreescaleMPL115A2 class + * in new code + * + * @m_deprecated_since{0,33,0} + */ +typedef FreescaleMPL115A2 MPL115A2; + /* clang-format off */ /** @@ -285,6 +293,14 @@ class FreescaleMPL115A2_Temp : public Variable { ~FreescaleMPL115A2_Temp() {} }; +/** + * @brief typedef for backwards compatibility; use the FreescaleMPL115A2_Temp + * class in new code + * + * @m_deprecated_since{0,33,0} + */ +typedef FreescaleMPL115A2_Temp MPL115A2_Temp; + /* clang-format off */ /** @@ -330,11 +346,14 @@ class FreescaleMPL115A2_Pressure : public Variable { */ ~FreescaleMPL115A2_Pressure() {} }; -/**@}*/ -// typedefs for backwards compatibility -typedef FreescaleMPL115A2 MPL115A2; +/** + * @brief typedef for backwards compatibility; use the + * FreescaleMPL115A2_Pressure class in new code + * + * @m_deprecated_since{0,33,0} + */ typedef FreescaleMPL115A2_Pressure MPL115A2_Pressure; -typedef FreescaleMPL115A2_Temp MPL115A2_Temp; +/**@}*/ #endif // SRC_SENSORS_FREESCALEMPL115A2_H_ diff --git a/src/sensors/PaleoTerraRedox.h b/src/sensors/PaleoTerraRedox.h index d419879da..54cb609b3 100644 --- a/src/sensors/PaleoTerraRedox.h +++ b/src/sensors/PaleoTerraRedox.h @@ -7,7 +7,7 @@ * Heavliy edited by Sara Geleskie Damiano * * @brief Contains the PaleoTerraRedox semsor subclass and the variable subclass - * PaleoTerraRedox_Volt. + * PaleoTerraRedox_Voltage. * * These are for the PaleoTerra redox sensors. * @@ -111,7 +111,7 @@ * The voltage variable from a PaleoTerra redox probe * - Accuracy is ±5mV * - * {{ @ref PaleoTerraRedox_Volt::PaleoTerraRedox_Volt }} + * {{ @ref PaleoTerraRedox_Voltage::PaleoTerraRedox_Voltage }} */ /**@{*/ /** @brief Decimals places in string representation; voltage should have 2. @@ -285,10 +285,10 @@ class PaleoTerraRedox : public Sensor { * * @ingroup sensor_pt_redox */ -class PaleoTerraRedox_Volt : public Variable { +class PaleoTerraRedox_Voltage : public Variable { public: /** - * @brief Construct a new PaleoTerraRedox_Volt object. + * @brief Construct a new PaleoTerraRedox_Voltage object. * * @param parentSense The parent PaleoTerraRedox providing the result * values. @@ -297,26 +297,35 @@ class PaleoTerraRedox_Volt : public Variable { * @param varCode A short code to help identify the variable in files; * optional with a default value of "PTRVoltage". */ - explicit PaleoTerraRedox_Volt( + explicit PaleoTerraRedox_Voltage( Sensor* parentSense, const char* uuid = "", const char* varCode = PTR_VOLTAGE_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)PTR_VOLTAGE_VAR_NUM, (uint8_t)PTR_VOLTAGE_RESOLUTION, PTR_VOLTAGE_VAR_NAME, PTR_VOLTAGE_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new PaleoTerraRedox_Volt object. + * @brief Construct a new PaleoTerraRedox_Voltage object. * * @note This must be tied with a parent PaleoTerraRedox before it can be * used. */ - PaleoTerraRedox_Volt() + PaleoTerraRedox_Voltage() : Variable((const uint8_t)PTR_VOLTAGE_VAR_NUM, (uint8_t)PTR_VOLTAGE_RESOLUTION, PTR_VOLTAGE_VAR_NAME, PTR_VOLTAGE_UNIT_NAME, PTR_VOLTAGE_DEFAULT_CODE) {} /** - * @brief Destroy the PaleoTerraRedox_Volt object - no action needed. + * @brief Destroy the PaleoTerraRedox_Voltage object - no action needed. */ - ~PaleoTerraRedox_Volt() {} + ~PaleoTerraRedox_Voltage() {} }; + +/** + * @brief typedef for backwards compatibility; use the PaleoTerraRedox_Voltage + * class in new code + * + * @m_deprecated_since{0,33,0} + */ +typedef PaleoTerraRedox_Voltage PaleoTerraRedox_Volt; + /**@}*/ -#endif // SRC_SENSORS__PALEOTERRAREDOX_H_ +#endif // SRC_SENSORS_PALEOTERRAREDOX_H_ diff --git a/src/sensors/ExternalVoltage.cpp b/src/sensors/TIADS1x15.cpp similarity index 80% rename from src/sensors/ExternalVoltage.cpp rename to src/sensors/TIADS1x15.cpp index 7f4b7fcb2..e96ce9b99 100644 --- a/src/sensors/ExternalVoltage.cpp +++ b/src/sensors/TIADS1x15.cpp @@ -1,5 +1,5 @@ /** - * @file ExternalVoltage.cpp * + * @file TIADS1x15.cpp * * @copyright 2020 Stroud Water Research Center * Part of the EnviroDIY ModularSensors library for Arduino * @author Written By: Bobby Schulz @@ -7,31 +7,30 @@ * Adapted from CampbellOBS3.h by Sara Geleskie Damiano * * - * @brief Implements the ExternalVoltage class. + * @brief Implements the TIADS1x15 class. */ -#include "ExternalVoltage.h" +#include "TIADS1x15.h" #include // The constructor - need the power pin the data pin, and gain if non standard -ExternalVoltage::ExternalVoltage(int8_t powerPin, uint8_t adsChannel, - float gain, uint8_t i2cAddress, - uint8_t measurementsToAverage) - : Sensor("ExternalVoltage", EXT_VOLTAGE_NUM_VARIABLES, - EXT_VOLTAGE_WARM_UP_TIME_MS, EXT_VOLTAGE_STABILIZATION_TIME_MS, - EXT_VOLTAGE_MEASUREMENT_TIME_MS, powerPin, -1, - measurementsToAverage, EXT_VOLTAGE_INC_CALC_VARIABLES) { +TIADS1x15::TIADS1x15(int8_t powerPin, uint8_t adsChannel, float gain, + uint8_t i2cAddress, uint8_t measurementsToAverage) + : Sensor("TIADS1x15", TIADS1X15_NUM_VARIABLES, TIADS1X15_WARM_UP_TIME_MS, + TIADS1X15_STABILIZATION_TIME_MS, TIADS1X15_MEASUREMENT_TIME_MS, + powerPin, -1, measurementsToAverage, + TIADS1X15_INC_CALC_VARIABLES) { _adsChannel = adsChannel; _gain = gain; _i2cAddress = i2cAddress; } // Destructor -ExternalVoltage::~ExternalVoltage() {} +TIADS1x15::~TIADS1x15() {} -String ExternalVoltage::getSensorLocation(void) { +String TIADS1x15::getSensorLocation(void) { #ifndef MS_USE_ADS1015 String sensorLocation = F("ADS1115_0x"); #else @@ -44,7 +43,7 @@ String ExternalVoltage::getSensorLocation(void) { } -bool ExternalVoltage::addSingleMeasurementResult(void) { +bool TIADS1x15::addSingleMeasurementResult(void) { // Variables to store the results in float adcVoltage = -9999; float calibResult = -9999; @@ -98,7 +97,7 @@ bool ExternalVoltage::addSingleMeasurementResult(void) { MS_DBG(getSensorNameAndLocation(), F("is not currently measuring!")); } - verifyAndAddMeasurementResult(EXT_VOLTAGE_VAR_NUM, calibResult); + verifyAndAddMeasurementResult(TIADS1X15_VAR_NUM, calibResult); // Unset the time stamp for the beginning of this measurement _millisMeasurementRequested = 0; diff --git a/src/sensors/TIADS1x15.h b/src/sensors/TIADS1x15.h new file mode 100644 index 000000000..a4997381e --- /dev/null +++ b/src/sensors/TIADS1x15.h @@ -0,0 +1,355 @@ +/** + * @file TIADS1x15.h * + * @copyright 2020 Stroud Water Research Center + * Part of the EnviroDIY ModularSensors library for Arduino + * @author Written By: Bobby Schulz + * Edited by Sara Geleskie Damiano + * Adapted from CampbellOBS3.h by Sara Geleskie Damiano + * + * + * @brief This file contains the TIADS1x15 sensor subclass and the + * TIADS1x15_Voltage variable subclass. + * + * These are used for any voltage measureable on a TI ADS1115 or ADS1015. There + * is a multiplier allowed for a voltage divider between the raw voltage and the + * ADS. + * + * This depends on the soligen2010 fork of the Adafruit ADS1015 library. + */ +/* clang-format off */ +/** + * @defgroup analog_group Analog Sensors via TI ADS1x15 + * The Sensor and Variable objects for all analog sensors requiring + * analog-to-digital conversion by TI ADS1x15. + * + * @ingroup the_sensors + * + * @tableofcontents + * @m_footernavigation + * + * @section analog_intro Introduction + * + * Many sensors output simple analog voltages and leave the conversion to a digital + * signal and final result up to the user. These types of sensors are supported in + * Modular sensors by way of a Texas Instruments ADS1115 or ADS1015. The TI ADS1115 ADD + * is a precision, low-power, 16-bit, I2C-compatible, analog-to-digitalconverter (ADC). + * It is built into the EnviroDIY Mayfly. The ADS1015 is a very similar ADC with 12-bit + * resolution and a slightly lower price point. Both chips are widely available in + * Arduino-ready breakouts. + * + * ModularSensors always uses the TI ADS1115 (also ADS1113 or ADS1114) by default, but + * if you wish to use a 12 bit TI ADS1015 (also ADS1013 or ADS1014) you can compile with + * the build flag ```-DMS_USE_ADS1015```. + * + * In the majority of break-out boards, and on the Mayfly, the I2C address of the + * ADS1x15 is set as 0x48 by tying the address pin to ground. Up to four of these ADD's + * be used by changing the address value by changing the connection of the address pin + * on the ADS1x15. The ADS1x15 requires an input voltage of 2.0-5.5V, but *this library + * always assumes the ADS is powered with 3.3V*. + * + * @note ModularSensors only supports connecting the ADS1x15 to primary hardware I2C instance. + * Connecting the ADS to a secondary hardware or software I2C instance is *not* supported! + * + * Communication with the ADS1x15 depends on the + * [soligen2010 fork of the Adafruit ADS1015 library](https://github.com/soligen2010/Adafruit_ADS1X15). + * + * @note We do *not* use the Adafruit library! The soligen2010 fork corrects some errors + * in the Adafruit library. Until those corrections are pulled into the main library, we + * use the fork instead. + * + * @section analog_ads1x15_specs Specifications + * @note *In all cases, we assume that the ADS1x15 is powered at 3.3V and set the ADC's internal gain to 1x. + * + * This divides the bit resolution over the range of 0-4.096V. + * - Response time: < 1ms + * - Resample time: 860 samples per second (~1.2ms) + * - Range: + * - Range is determined by supply voltage - No more than VDD + 0.3 V r 5.5 V + * (whichever is smaller) must be applied to this device. + * - 0 - 3.6V [when ADC is powered at 3.3V] + * - Accuracy: + * - 16-bit ADC (ADS1115): < 0.25% (gain error), <0.25 LSB (offset errror) + * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): < 0.15% (gain error), <3 LSB (offset errror) + * - Resolution: + * - 16-bit ADC (ADS1115): + * - without voltage divider: 0.125 mV + * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): + * - without voltage divider: 2 mV + * + * @note 1 bit of resolution is lost in single-ended reading. The maximum possible + * resolution is over the differential range from negative to positive full scale, a + * single ended reading is only over the range from 0 to positive full scale). + * + * @section analog_ads1x15_datasheet Sensor Datasheet + * Technical specifications for the TI ADS1115 can be found at: http://www.ti.com/product/ADS1115 + * For the ADS1015, see: https://www.ti.com/product/ADS1015 + * - [ADS1115 Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/TI-ADS101x-Analog-to-Digital-Converter.pdf) + * - [ADS1015 Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/TI-ADS111x-Analog-to-Digital-Converter.pdf) + */ +/* clang-format on */ +/* clang-format off */ +/** + * @defgroup sensor_ads1x15 TI ADS1x15 External Voltage Sensor + * Classes for simple external analog voltage measurements. + * + * @ingroup analog_group + * + * @tableofcontents + * @m_footernavigation + * + * @section sensor_ads1x15_intro Introduction + * + * Analog data output is supported in ModularSensors by way of the + * Texas Instruments ADS1115. + * + * The External Voltage module is used for any case where the voltage itself is + * the desired value (as for an external battery). It can also be used in + * combination with a calculated variable to support any other analog sensor not + * explicity supported by ModularSensors. To increase the range available for + * voltage measurements, this module supports the use of a voltage divider. + * + * If you are working with an EnviroDIY Mayfly, the easiest voltage divider to + * connect is the Grove voltage divider sold by seeed studio. The grove voltage + * divider is a simple voltage divider designed to measure high external + * voltages on a low voltage ADC. This module employs a variable gain via two + * pairs of voltage dividers, and a unity gain amplification to reduce output + * impedance of the module. + * + * @section sensor_ads1x15_datasheet Sensor Datasheet + * Technical specifications for the Grove Voltage Divider can be found at: + * http://wiki.seeedstudio.com/Grove-Voltage_Divider + * + * @section sensor_ads1x15_flags Build flags + * - ```-D MS_USE_ADS1015``` + * - switches from the 16-bit ADS1115 to the 12 bit ADS1015 + * + * @section sensor_ads1x15_ctor Sensor Constructor + * {{ @ref TIADS1x15::TIADS1x15 }} + * + * ___ + * @section sensor_ads1x15_examples Example Code + * The TI ADS1X15 external voltage sensor is used in the @menulink{external_voltage} + * example. + * + * @menusnip{external_voltage} + */ +/* clang-format on */ + +// Header Guards +#ifndef SRC_SENSORS_TIADS1X15_H_ +#define SRC_SENSORS_TIADS1X15_H_ + +// Debugging Statement +// #define MS_TIADS1X15_DEBUG + +#ifdef MS_TIADS1X15_DEBUG +#define MS_DEBUGGING_STD "TIADS1x15" +#endif + +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "VariableBase.h" +#include "SensorBase.h" + +/** @ingroup sensor_ads1x15 */ +/**@{*/ + +// Sensor Specific Defines +/// @brief Sensor::_numReturnedValues; the ADS1115 can report 1 value. +#define TIADS1X15_NUM_VARIABLES 1 +/// @brief Sensor::_incCalcValues; we don't calculate any additional values. +#define TIADS1X15_INC_CALC_VARIABLES 0 + +/** + * @anchor sensor_ads1x15_timing + * @name Sensor Timing + * The sensor timing for a TI ADS1x15 analog-to-digital converter (ADC) + * The timing used for simple external voltage measurements is that of the + * ADS1x15. + */ +/**@{*/ +/// @brief Sensor::_warmUpTime_ms; the ADS1115 warms up in 2ms. +#define TIADS1X15_WARM_UP_TIME_MS 2 +/** + * @brief Sensor::_stabilizationTime_ms; the ADS1115 is stable 0ms after warm-up + * + * We assume a voltage is instantly ready. + */ +#define TIADS1X15_STABILIZATION_TIME_MS 0 +/** + * @brief Sensor::_measurementTime_ms; the ADS1115 completes 860 conversions per + * second, but the wait for the conversion to complete is built into the + * underlying library, so we do not need to wait further here. + */ +#define TIADS1X15_MEASUREMENT_TIME_MS 0 +/**@}*/ + +/** + * @anchor sensor_ads1x15_volt + * @name Voltage + * The volt variable from a TI ADS1x15 analog-to-digital converter (ADC) + * - Range: + * - without voltage divider: 0 - 3.6V [when ADC is powered at 3.3V] + * - 1/gain = 3x: 0.3 ~ 12.9V + * - 1/gain = 10x: 1 ~ 43V + * - Accuracy: + * - 16-bit ADC (ADS1115): < 0.25% (gain error), <0.25 LSB (offset errror) + * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): < 0.15% + * (gain error), <3 LSB (offset errror) + * - Resolution: + * - 16-bit ADC (ADS1115): + * - @m_span{m-dim}@ref #TIADS1X15_RESOLUTION = 4@m_endspan + * - without voltage divider: 0.125 mV + * - 1/gain = 3x: 0.375 mV + * - 1/gain = 10x: 1.25 mV + * - 12-bit ADC (ADS1015, using build flag ```MS_USE_ADS1015```): + * - @m_span{m-dim}@ref #TIADS1X15_RESOLUTION = 1@m_endspan + * - without voltage divider: 2 mV + * - 1/gain = 3x: 6 mV + * - 1/gain = 10x: 20 mV * + * + * {{ @ref TIADS1x15_Voltage::TIADS1x15_Voltage }} + */ +/**@{*/ +/// Variable number; voltage is stored in sensorValues[0]. +#define TIADS1X15_VAR_NUM 0 +/// @brief Variable name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); +/// "voltage" +#define TIADS1X15_VAR_NAME "voltage" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "volt" +#define TIADS1X15_UNIT_NAME "volt" +/// @brief Default variable short code; "extVoltage" +#define TIADS1X15_DEFAULT_CODE "extVoltage" + +#ifdef MS_USE_ADS1015 +/// @brief Decimals places in string representation; voltage should have 1. +#define TIADS1X15_RESOLUTION 1 +#else +/// @brief Decimals places in string representation; voltage should have 4. +#define TIADS1X15_RESOLUTION 4 +#endif +/**@}*/ + +/// @brief The assumed address of the ADS1115, 1001 000 (ADDR = GND) +#define ADS1115_ADDRESS 0x48 + +/* clang-format off */ +/** + * @brief The Sensor sub-class for the + * [external votlage as measured by TI ADS1115 or ADS1015](@ref sensor_ads1x15). + * + * @ingroup sensor_ads1x15 + */ +/* clang-format on */ +class TIADS1x15 : public Sensor { + public: + /** + * @brief Construct a new External Voltage object - need the power pin and + * the data channel on the ADS1x15. + * + * The gain value, I2C address, and number of measurements to average are + * optional. If nothing is given a 1x gain is used. + * + * @note ModularSensors only supports connecting the ADS1x15 to the primary + * hardware I2C instance defined in the Arduino core. Connecting the ADS to + * a secondary hardware or software I2C instance is *not* supported! + * + * @param powerPin The pin on the mcu controlling power to the sensor + * Use -1 if it is continuously powered. + * @param adsChannel The ADS channel of interest (0-3). + * @param gain The gain multiplier, if a voltage divider is used. + * @param i2cAddress The I2C address of the ADS 1x15, default is 0x48 (ADDR + * = GND) + * @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. + */ + TIADS1x15(int8_t powerPin, uint8_t adsChannel, float gain = 1, + uint8_t i2cAddress = ADS1115_ADDRESS, + uint8_t measurementsToAverage = 1); + /** + * @brief Destroy the External Voltage object + */ + ~TIADS1x15(); + + /** + * @copydoc Sensor::getSensorLocation() + */ + String getSensorLocation(void) override; + + /** + * @copydoc Sensor::addSingleMeasurementResult() + */ + bool addSingleMeasurementResult(void) override; + + private: + uint8_t _adsChannel; + float _gain; + uint8_t _i2cAddress; +}; + +/** + * @brief typedef for backwards compatibility; use the TIADS1x15 class in new + * code + * + * @m_deprecated_since{0,33,0} + */ +typedef TIADS1x15 ExternalVoltage; + + +// The single available variable is voltage +/* clang-format off */ +/** + * @brief The Variable sub-class used for the + * [voltage output](@ref sensor_ads1x15_volt) from a + * [TI ADS1115 or ADS1015](@ref sensor_ads1x15). + * + * @ingroup sensor_ads1x15 + */ +/* clang-format on */ +class TIADS1x15_Voltage : public Variable { + public: + /** + * @brief Construct a new TIADS1x15_Voltage object. + * + * @param parentSense The parent TIADS1x15 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 "extVoltage". + */ + explicit TIADS1x15_Voltage(TIADS1x15* parentSense, const char* uuid = "", + const char* varCode = TIADS1X15_DEFAULT_CODE) + : Variable(parentSense, (const uint8_t)TIADS1X15_VAR_NUM, + (uint8_t)TIADS1X15_RESOLUTION, TIADS1X15_VAR_NAME, + TIADS1X15_UNIT_NAME, varCode, uuid) {} + /** + * @brief Construct a new TIADS1x15_Voltage object. + * + * @note This must be tied with a parent TIADS1x15 before it can be + * used. + */ + TIADS1x15_Voltage() + : Variable((const uint8_t)TIADS1X15_VAR_NUM, + (uint8_t)TIADS1X15_RESOLUTION, TIADS1X15_VAR_NAME, + TIADS1X15_UNIT_NAME, TIADS1X15_DEFAULT_CODE) {} + /** + * @brief Destroy the TIADS1x15_Voltage object - no action needed. + */ + ~TIADS1x15_Voltage() {} +}; + +/** + * @brief typedef for backwards compatibility; use the TIADS1x15_Voltage class + * in new code + * + * @m_deprecated_since{0,33,0} + */ +typedef TIADS1x15_Voltage ExternalVoltage_Volt; + +/**@}*/ +#endif // SRC_SENSORS_TIADS1X15_H_ diff --git a/src/sensors/TIINA219.h b/src/sensors/TIINA219.h index 1ebdb6928..53e82583a 100644 --- a/src/sensors/TIINA219.h +++ b/src/sensors/TIINA219.h @@ -6,7 +6,7 @@ * Edited by Sara Geleskie Damiano * * @brief Contains the TIINA219 sensor subclass and the variale subclasses - * TIINA219_Current, TIINA219_Volt, and TIINA219_Power. + * TIINA219_Current, TIINA219_Voltage, and TIINA219_Power. * * These are for the Texas Instruments INA219 current/voltage sensor. * @@ -148,7 +148,7 @@ * - Range is 0 to 26V * - Accuracy is ±4mV (1 LSB step size) * - * {{ @ref TIINA219_Volt::TIINA219_Volt }} + * {{ @ref TIINA219_Voltage::TIINA219_Voltage }} */ /**@{*/ /// @brief Decimals places in string representation; bus voltage should have 4 - @@ -347,10 +347,10 @@ class TIINA219_Current : public Variable { * @ingroup sensor_ina219 */ /* clang-format on */ -class TIINA219_Volt : public Variable { +class TIINA219_Voltage : public Variable { public: /** - * @brief Construct a new TIINA219_Volt object. + * @brief Construct a new TIINA219_Voltage object. * * @param parentSense The parent TIINA219 providing the result values. * @param uuid A universally unique identifier (UUID or GUID) for the @@ -358,7 +358,7 @@ class TIINA219_Volt : public Variable { * @param varCode A short code to help identify the variable in files; * optional with a default value of "TIINA219Volt". */ - explicit TIINA219_Volt( + explicit TIINA219_Voltage( TIINA219* parentSense, const char* uuid = "", const char* varCode = INA219_BUS_VOLTAGE_DEFAULT_CODE) : Variable(parentSense, (const uint8_t)INA219_BUS_VOLTAGE_VAR_NUM, @@ -366,21 +366,29 @@ class TIINA219_Volt : public Variable { INA219_BUS_VOLTAGE_VAR_NAME, INA219_BUS_VOLTAGE_UNIT_NAME, varCode, uuid) {} /** - * @brief Construct a new TIINA219_Volt object. + * @brief Construct a new TIINA219_Voltage object. * * @note This must be tied with a parent TIINA219 before it can be used. */ - TIINA219_Volt() + TIINA219_Voltage() : Variable((const uint8_t)INA219_BUS_VOLTAGE_VAR_NUM, (uint8_t)INA219_BUS_VOLTAGE_RESOLUTION, INA219_BUS_VOLTAGE_VAR_NAME, INA219_BUS_VOLTAGE_UNIT_NAME, INA219_BUS_VOLTAGE_DEFAULT_CODE) {} /** - * @brief Destroy the TIINA219_Volt object - no action needed. + * @brief Destroy the TIINA219_Voltage object - no action needed. */ - ~TIINA219_Volt() {} + ~TIINA219_Voltage() {} }; +/** + * @brief typedef for backwards compatibility; use the TIINA219_Voltage class in + * new code + * + * @m_deprecated_since{0,33,0} + */ +typedef TIINA219_Voltage TIINA219_Volt; + /* clang-format off */ /** diff --git a/src/sensors/YosemitechY514.h b/src/sensors/YosemitechY514.h index 6b8ff6af8..8bb3e62e8 100644 --- a/src/sensors/YosemitechY514.h +++ b/src/sensors/YosemitechY514.h @@ -281,4 +281,4 @@ class YosemitechY514_Temp : public Variable { ~YosemitechY514_Temp() {} }; /**@}*/ -#endif // SRC_SENSORS__YOSEMITECHY514_H_ +#endif // SRC_SENSORS_YOSEMITECHY514_H_ From aa034242c904d8dc8844fac3347f721f8f2dc177 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 16:28:14 -0400 Subject: [PATCH 72/94] Properly rename flags Signed-off-by: Sara Damiano --- .github/workflows/build_menu.yaml | 2 +- build-menu-configurations.ps1 | 2 +- examples/menu_a_la_carte/ReadMe.md | 2 +- examples/menu_a_la_carte/menu_a_la_carte.ino | 8 ++++---- src/sensors/TIADS1x15.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 0416c0da7..659524395 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -101,7 +101,7 @@ jobs: sensorFlag: BUILD_SENSOR_EVERLIGHT_ALSPT19 publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 - sensorFlag: BUILD_SENSOR_EXTERNAL_VOLTAGE + sensorFlag: BUILD_SENSOR_TIADS1X15 publisherFlag: BUILD_PUB_ENVIRO_DIY_PUBLISHER - modemFlag: BUILD_MODEM_SIM_COM_SIM7080 sensorFlag: BUILD_SENSOR_FREESCALE_MPL115A2 diff --git a/build-menu-configurations.ps1 b/build-menu-configurations.ps1 index a6497cffa..cf1c43612 100644 --- a/build-menu-configurations.ps1 +++ b/build-menu-configurations.ps1 @@ -84,7 +84,7 @@ $sensorFlags = @(` 'BUILD_SENSOR_BOSCH_BME280', ` 'BUILD_SENSOR_CAMPBELL_OBS3', ` 'BUILD_SENSOR_DECAGON_ES2', ` - 'BUILD_SENSOR_EXTERNAL_VOLTAGE', ` + 'BUILD_SENSOR_TIADS1X15', ` 'BUILD_SENSOR_FREESCALE_MPL115A2', ` 'BUILD_SENSOR_IN_SITU_RDO', ` 'BUILD_SENSOR_IN_SITU_TROLL_SDI12A', ` diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index db45aed19..ec0f1f8fd 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -806,7 +806,7 @@ The number of measurements to average, if more than one is desired, goes as the @see @ref sensor_ads1x15 -[//]: # ( @menusnip{external_voltage} ) +[//]: # ( @menusnip{tiads1x15} ) ___ 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 63af648fd..87cbdd9ff 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -1289,11 +1289,11 @@ Variable* alsPt19Lux = new EverlightALSPT19_Illuminance( #endif -#if defined BUILD_SENSOR_EXTERNAL_VOLTAGE +#if defined BUILD_SENSOR_TIADS1X15 // ========================================================================== // External Voltage via TI ADS1115 // ========================================================================== -/** Start [external_voltage] */ +/** Start [tiads1x15] */ #include // NOTE: Use -1 for any pins that don't apply or aren't being used. @@ -1310,7 +1310,7 @@ TIADS1x15 ads1x15(ADSPower, ADSChannel, dividerGain, evADSi2c_addr, // Create a voltage variable pointer Variable* ads1x15Volt = new TIADS1x15_Voltage(&ads1x15, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [external_voltage] */ +/** End [tiads1x15] */ #endif @@ -2463,7 +2463,7 @@ Variable* variableList[] = { alsPt19Current, alsPt19Lux, #endif -#if defined BUILD_SENSOR_EXTERNAL_VOLTAGE +#if defined BUILD_SENSOR_TIADS1X15 ads1x15Volt, #endif #if defined BUILD_SENSOR_FREESCALE_MPL115A2 diff --git a/src/sensors/TIADS1x15.h b/src/sensors/TIADS1x15.h index a4997381e..df0ead40c 100644 --- a/src/sensors/TIADS1x15.h +++ b/src/sensors/TIADS1x15.h @@ -128,10 +128,10 @@ * * ___ * @section sensor_ads1x15_examples Example Code - * The TI ADS1X15 external voltage sensor is used in the @menulink{external_voltage} + * The TI ADS1X15 external voltage sensor is used in the @menulink{tiads1x15} * example. * - * @menusnip{external_voltage} + * @menusnip{tiads1x15} */ /* clang-format on */ From 7566292a6729fc5ee74e035e223d801d61d555d4 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Thu, 31 Mar 2022 16:46:41 -0400 Subject: [PATCH 73/94] Don't lose jinja Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 1 - .github/workflows/check_documentation.yaml | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index cdbd0a28e..af8f71faa 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -34,7 +34,6 @@ jobs: key: ${{ runner.os }}-python-${{ env.PYTHON_DEPS_ARCHIVE_NUM }} - name: Install Pygments and other m.css Python Requirements - if: steps.cache_python.outputs.cache-hit != 'true' run: | python -m pip install --upgrade pip pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 diff --git a/.github/workflows/check_documentation.yaml b/.github/workflows/check_documentation.yaml index f4a9ca75e..06a3b4e2e 100644 --- a/.github/workflows/check_documentation.yaml +++ b/.github/workflows/check_documentation.yaml @@ -44,7 +44,6 @@ jobs: key: ${{ runner.os }}-python-${{ env.PYTHON_DEPS_ARCHIVE_NUM }} - name: Install Pygments and other m.css Python Requirements - if: steps.cache_python.outputs.cache-hit != 'true' run: | python -m pip install --upgrade pip pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 From 314750c5ac204683a29475981f2fae827bd9106f Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 1 Apr 2022 12:10:07 -0400 Subject: [PATCH 74/94] better action caching, auto-cancel Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 61 ++++++++---- .../workflows/build_examples_arduino_cli.yaml | 3 + .../workflows/build_examples_platformio.yaml | 3 + .github/workflows/build_menu.yaml | 3 + .github/workflows/check_documentation.yaml | 94 ------------------- .../workflows/verify_library_structure.yaml | 5 +- .../build-install-doxygen.sh | 21 +++++ 7 files changed, 76 insertions(+), 114 deletions(-) delete mode 100644 .github/workflows/check_documentation.yaml diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index af8f71faa..d5fe21642 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -1,21 +1,53 @@ -name: Build and Publish Documentation +name: Check and Publish Documentation on: + # Triggers the workflow on push or pull request events + push: + pull_request: # Trigger when a release is created release: types: - published # Also give a manual trigger workflow_dispatch: + inputs: + publish: + description: 'Publish Documentation to GitHub Pages' + required: false + type: boolean + default: false env: DOXYGEN_VERSION: Release_1_9_3 PYTHON_DEPS_ARCHIVE_NUM: 2 + TEX_VERSION: 2021 + GRAPHVIZ_VERSION: 2.38.0 jobs: - build: + check_menu_inclusion: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + + steps: + - uses: actions/checkout@v2.4.0 + + - name: Set up Python + uses: actions/setup-python@v3 + + - name: check for classes in the menu example + run: | + cd $GITHUB_WORKSPACE/continuous_integration + python check_component_inclusion.py + + doc_build: + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'ci skip')" + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true steps: # check out the ModularSensors repo @@ -38,27 +70,17 @@ jobs: python -m pip install --upgrade pip pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 - - name: Install all the dependencies needed to build and run Doxygen and m.css - run: | - sudo apt-get update - sudo apt-get -y install graphviz - sudo apt-get -y install build-essential - sudo apt-get -y install flex - sudo apt-get -y install bison - sudo apt-get -y install graphviz - sudo apt-get -y install texlive-base - sudo apt-get -y install texlive-latex-extra - sudo apt-get -y install texlive-fonts-extra - sudo apt-get -y install texlive-fonts-recommended - - - name: Restore Doxygen + - name: Restore Doxygen, Graphviz, and TeX Live id: cache_doxygen uses: actions/cache@v2.1.7 with: - path: doxygen-src - key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }} + path: | + /usr/local/texlive + /usr/local/bin/dot + doxygen-src + key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }}-${{ env.TEX_VERSION }}-${{ env.GRAPHVIZ_VERSION }} - - name: Clone and build doxygen + - name: Build and install doxygen and its dependencies if: steps.cache_doxygen.outputs.cache-hit != 'true' env: TRAVIS_BUILD_DIR: ${{ github.workspace }} @@ -84,6 +106,7 @@ jobs: sh continuous_integration/generate-documentation.sh - name: Deploy to github pages + if: "(github.event_name == 'release' && github.event.action == 'published') || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')" uses: peaceiris/actions-gh-pages@v3.8.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/build_examples_arduino_cli.yaml b/.github/workflows/build_examples_arduino_cli.yaml index 8dab3aaf5..0b388650a 100644 --- a/.github/workflows/build_examples_arduino_cli.yaml +++ b/.github/workflows/build_examples_arduino_cli.yaml @@ -7,6 +7,9 @@ jobs: build: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true strategy: matrix: diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml index 8d9c38fc2..8ea635e8a 100644 --- a/.github/workflows/build_examples_platformio.yaml +++ b/.github/workflows/build_examples_platformio.yaml @@ -7,6 +7,9 @@ jobs: build: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true strategy: matrix: diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 659524395..3cbebcddc 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -9,6 +9,9 @@ jobs: env: PLATFORMIO_SRC_DIR: temp/menu_a_la_carte if: "!contains(github.event.head_commit.message, 'ci skip')" + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true strategy: matrix: diff --git a/.github/workflows/check_documentation.yaml b/.github/workflows/check_documentation.yaml deleted file mode 100644 index 06a3b4e2e..000000000 --- a/.github/workflows/check_documentation.yaml +++ /dev/null @@ -1,94 +0,0 @@ -name: Verify Documentation - -# Triggers the workflow on push or pull request events -on: [push, pull_request] - -env: - DOXYGEN_VERSION: Release_1_9_3 - PYTHON_DEPS_ARCHIVE_NUM: 2 - -jobs: - menu_inclusion: - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'ci skip')" - - steps: - - uses: actions/checkout@v2.4.0 - - - name: Set up Python - uses: actions/setup-python@v3 - - - name: check for classes in the menu example - run: | - cd $GITHUB_WORKSPACE/continuous_integration - python check_component_inclusion.py - - doc_build: - runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, 'ci skip')" - - steps: - # check out the ModularSensors repo - - uses: actions/checkout@v2.4.0 - with: - path: code_docs/ModularSensors - - - name: Set up Python - uses: actions/setup-python@v3 - - - name: Restore Python Dependencies - uses: actions/cache@v2.1.7 - id: cache_python - with: - path: ~/.cache/pip - key: ${{ runner.os }}-python-${{ env.PYTHON_DEPS_ARCHIVE_NUM }} - - - name: Install Pygments and other m.css Python Requirements - run: | - python -m pip install --upgrade pip - pip3 install --upgrade --upgrade-strategy only-if-needed jinja2 Pygments beautifulsoup4 - - - name: Install all the dependencies needed to build and run Doxygen and m.css - run: | - sudo apt-get update - sudo apt-get -y install graphviz - sudo apt-get -y install build-essential - sudo apt-get -y install flex - sudo apt-get -y install bison - sudo apt-get -y install graphviz - sudo apt-get -y install texlive-base - sudo apt-get -y install texlive-latex-extra - sudo apt-get -y install texlive-fonts-extra - sudo apt-get -y install texlive-fonts-recommended - - - name: Restore Doxygen - id: cache_doxygen - uses: actions/cache@v2.1.7 - with: - path: doxygen-src - key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }} - - - name: Clone and build doxygen - if: steps.cache_doxygen.outputs.cache-hit != 'true' - env: - TRAVIS_BUILD_DIR: ${{ github.workspace }} - run: | - cd ${{ github.workspace }}/code_docs/ModularSensors/ - chmod +x continuous_integration/build-install-doxygen.sh - sh continuous_integration/build-install-doxygen.sh - - # check out my fork of m.css, for processing Doxygen output - - name: Checkout m.css - uses: actions/checkout@v2.4.0 - with: - # Repository name with owner. For example, actions/checkout - repository: SRGDamia1/m.css - path: code_docs/m.css - - - name: Generate all the documentation - env: - TRAVIS_BUILD_DIR: ${{ github.workspace }} - run: | - cd ${{ github.workspace }}/code_docs/ModularSensors/ - chmod +x continuous_integration/generate-documentation.sh - sh continuous_integration/generate-documentation.sh diff --git a/.github/workflows/verify_library_structure.yaml b/.github/workflows/verify_library_structure.yaml index edae3e2a2..4d1ba3243 100644 --- a/.github/workflows/verify_library_structure.yaml +++ b/.github/workflows/verify_library_structure.yaml @@ -1,4 +1,4 @@ -name: Verify JSON structure for library manifest +name: Verify library manifest and structure # Triggers the workflow on push or pull request events on: [push, pull_request] @@ -7,6 +7,9 @@ jobs: lint: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true steps: - uses: actions/checkout@v2.4.0 diff --git a/continuous_integration/build-install-doxygen.sh b/continuous_integration/build-install-doxygen.sh index 36d7dda24..324123257 100644 --- a/continuous_integration/build-install-doxygen.sh +++ b/continuous_integration/build-install-doxygen.sh @@ -3,6 +3,27 @@ # Exit with nonzero exit code if anything fails set -e +# install all the dependencies for make for Doxygen and m.css +sudo apt-get update +sudo apt-get -y install build-essential +sudo apt-get -y install flex +sudo apt-get -y install bison + +# install TeX Live for LaTeX formula rendering +sudo apt-get -y install texlive-base +sudo apt-get -y install texlive-latex-extra +sudo apt-get -y install texlive-fonts-extra +sudo apt-get -y install texlive-fonts-recommended + +echo "Current TeX version..." +tex --version + +# install Graphviz for DOT class diagrams +sudo apt-get -y install graphviz + +echo "Current graphviz version..." +dot -v + cd $TRAVIS_BUILD_DIR if [ ! -f $TRAVIS_BUILD_DIR/doxygen-src/build/bin/doxygen ]; then From dbfeb75fc0ec08fc9beea55959a921c92beef694 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Fri, 1 Apr 2022 12:48:47 -0400 Subject: [PATCH 75/94] Move concurrency to workflow level Signed-off-by: Sara Damiano --- .github/workflows/build_documentation.yaml | 26 +++++++++---------- .../workflows/build_examples_arduino_cli.yaml | 7 ++--- .../workflows/build_examples_platformio.yaml | 6 ++--- .github/workflows/build_menu.yaml | 7 ++--- .../workflows/verify_library_structure.yaml | 7 ++--- .../build-install-doxygen.sh | 21 ++++++++------- 6 files changed, 40 insertions(+), 34 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index d5fe21642..5cf5e66ae 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -17,19 +17,22 @@ on: type: boolean default: false +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: - DOXYGEN_VERSION: Release_1_9_3 + REBUILD_CACHE_NUMBER: 2 PYTHON_DEPS_ARCHIVE_NUM: 2 - TEX_VERSION: 2021 - GRAPHVIZ_VERSION: 2.38.0 + DOXYGEN_VERSION: Release_1_9_3 + TEX_VERSION: 2019 + # ^^ 2019 is the latest TeX live available on apt-get and that's good enough + GRAPHVIZ_VERSION: 2.43.0 jobs: check_menu_inclusion: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true steps: - uses: actions/checkout@v2.4.0 @@ -45,9 +48,6 @@ jobs: doc_build: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true steps: # check out the ModularSensors repo @@ -63,7 +63,7 @@ jobs: id: cache_python with: path: ~/.cache/pip - key: ${{ runner.os }}-python-${{ env.PYTHON_DEPS_ARCHIVE_NUM }} + key: ${{ runner.os }}-python-${{ env.REBUILD_CACHE_NUMBER }}-${{ env.PYTHON_DEPS_ARCHIVE_NUM }} - name: Install Pygments and other m.css Python Requirements run: | @@ -75,10 +75,10 @@ jobs: uses: actions/cache@v2.1.7 with: path: | - /usr/local/texlive - /usr/local/bin/dot + /usr/lib/x86_64-linux-gnu/texlive + /usr/lib/x86_64-linux-gnu/graphviz doxygen-src - key: ${{ runner.os }}-doxygen-${{ env.DOXYGEN_VERSION }}-${{ env.TEX_VERSION }}-${{ env.GRAPHVIZ_VERSION }} + key: ${{ runner.os }}-doxygen-${{ env.REBUILD_CACHE_NUMBER }}-${{ env.DOXYGEN_VERSION }}-${{ env.TEX_VERSION }}-${{ env.GRAPHVIZ_VERSION }} - name: Build and install doxygen and its dependencies if: steps.cache_doxygen.outputs.cache-hit != 'true' diff --git a/.github/workflows/build_examples_arduino_cli.yaml b/.github/workflows/build_examples_arduino_cli.yaml index 0b388650a..97b1f48e4 100644 --- a/.github/workflows/build_examples_arduino_cli.yaml +++ b/.github/workflows/build_examples_arduino_cli.yaml @@ -3,13 +3,14 @@ name: Build Examples with Arduino CLI # Triggers the workflow on push or pull request events on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true strategy: matrix: diff --git a/.github/workflows/build_examples_platformio.yaml b/.github/workflows/build_examples_platformio.yaml index 8ea635e8a..068ddd9ea 100644 --- a/.github/workflows/build_examples_platformio.yaml +++ b/.github/workflows/build_examples_platformio.yaml @@ -2,14 +2,14 @@ name: Build Examples with PlatformIO # Triggers the workflow on push or pull request events on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true jobs: build: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true strategy: matrix: diff --git a/.github/workflows/build_menu.yaml b/.github/workflows/build_menu.yaml index 3cbebcddc..ae2900806 100644 --- a/.github/workflows/build_menu.yaml +++ b/.github/workflows/build_menu.yaml @@ -3,15 +3,16 @@ name: Build All Menu Configurations # Triggers the workflow on push or pull request events on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: build: runs-on: ubuntu-latest env: PLATFORMIO_SRC_DIR: temp/menu_a_la_carte if: "!contains(github.event.head_commit.message, 'ci skip')" - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true strategy: matrix: diff --git a/.github/workflows/verify_library_structure.yaml b/.github/workflows/verify_library_structure.yaml index 4d1ba3243..d7d9afa85 100644 --- a/.github/workflows/verify_library_structure.yaml +++ b/.github/workflows/verify_library_structure.yaml @@ -3,13 +3,14 @@ name: Verify library manifest and structure # Triggers the workflow on push or pull request events on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: lint: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'ci skip')" - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true steps: - uses: actions/checkout@v2.4.0 diff --git a/continuous_integration/build-install-doxygen.sh b/continuous_integration/build-install-doxygen.sh index 324123257..878791a4a 100644 --- a/continuous_integration/build-install-doxygen.sh +++ b/continuous_integration/build-install-doxygen.sh @@ -15,40 +15,43 @@ sudo apt-get -y install texlive-latex-extra sudo apt-get -y install texlive-fonts-extra sudo apt-get -y install texlive-fonts-recommended -echo "Current TeX version..." +echo "\e[32m\n\n\nCurrent TeX version...\e[0m" tex --version +echo "\n\n\n" # install Graphviz for DOT class diagrams sudo apt-get -y install graphviz -echo "Current graphviz version..." +echo "\e[32m\n\n\nCurrent graphviz version...\e[0m" dot -v +echo "\n\n\n" cd $TRAVIS_BUILD_DIR if [ ! -f $TRAVIS_BUILD_DIR/doxygen-src/build/bin/doxygen ]; then # Build instructions from: https://www.stack.nl/~dimitri/doxygen/download.html - echo "Cloning doxygen repository..." + echo "\e[32mCloning doxygen repository...\e[0m" git clone https://github.com/doxygen/doxygen.git doxygen-src --branch $DOXYGEN_VERSION --depth 1 cd doxygen-src - echo "Create build folder..." + echo "\e[32mCreate build folder...\e[0m" mkdir build cd build - echo "Make..." + echo "\e[32mMake...\e[0m" cmake -G "Unix Makefiles" .. make - echo "Done building doxygen." - echo "doxygen path: " $(pwd) + echo "\e[32mDone building doxygen.\e[0m" + echo "\e[32mdoxygen path: \e[0m" $(pwd) fi -echo "Current Doxygen version..." +echo "\e[32m\n\n\nCurrent Doxygen version...\e[0m" $TRAVIS_BUILD_DIR/doxygen-src/build/bin/doxygen -v +echo "\n\n\n" -# echo "Move Doxygen to working directory" +# echo "\e[32mMove Doxygen to working directory" # cp $TRAVIS_BUILD_DIR/doxygen-src/build/bin/* $TRAVIS_BUILD_DIR/code_docs/ModularSensors # #make install From 26429d8f789674041f05e4846201465dbce16943 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Apr 2022 17:07:48 +0000 Subject: [PATCH 76/94] ci: bump actions/checkout from 2.4.0 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2.4.0 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2.4.0...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build_documentation.yaml | 2 +- .github/workflows/verify_library_structure.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index 265294336..f9af8c668 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -35,7 +35,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'ci skip')" steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v3 diff --git a/.github/workflows/verify_library_structure.yaml b/.github/workflows/verify_library_structure.yaml index d7d9afa85..225f2af29 100644 --- a/.github/workflows/verify_library_structure.yaml +++ b/.github/workflows/verify_library_structure.yaml @@ -13,7 +13,7 @@ jobs: if: "!contains(github.event.head_commit.message, 'ci skip')" steps: - - uses: actions/checkout@v2.4.0 + - uses: actions/checkout@v3 - name: Set up Python uses: actions/setup-python@v3 From f1fb6e0605f55adfbce4ab381b90d63169376b02 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Thu, 7 Apr 2022 17:49:39 -0700 Subject: [PATCH 77/94] renamed time variables to LocalEpoch and UTCEpoch following 0.33.0 --- examples/tu_xx01/src/ms_cfg.h | 52 +++++------ src/LoggerBase.cpp | 116 +++++++++++++++---------- src/LoggerBase.h | 43 +++++++-- src/LoggerBaseExtCpp.h | 10 +-- src/publishers/DreamHostPublisher.cpp | 5 +- src/publishers/EnviroDIYPublisher.cpp | 5 +- src/publishers/ThingSpeakPublisher.cpp | 2 +- src/publishers/UbidotsPublisher.cpp | 4 +- 8 files changed, 143 insertions(+), 94 deletions(-) diff --git a/examples/tu_xx01/src/ms_cfg.h b/examples/tu_xx01/src/ms_cfg.h index 28a91d19e..57b9bcb91 100644 --- a/examples/tu_xx01/src/ms_cfg.h +++ b/examples/tu_xx01/src/ms_cfg.h @@ -1,7 +1,6 @@ /***************************************************************************** -ms_cfg.h_ub_test - ModularSensors Configuration - testing to UBIDOTS/WiFi -- Temperature/Humidity -210326 STATUS 0.28.3 updated cc, not tested +ms_cfg.h_EC - ModularSensors Configuration - tgt relative _EC +Status: 220219: updated to use comms but not tested Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO @@ -24,7 +23,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //************************************************************************** // This configuration is for a standard Mayfly0.5b // Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 +#define AnalogProcEC_ACT 1 // Power Availability monitoring decisions use LiIon Voltge, // Battery Voltage measurements can be derived from a number of sources // MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated @@ -52,7 +51,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // KellerAcculevel units can be 1 (meter) 2 (feet) //#define KellerAcculevel_DepthUnits 2 -//#define KellerNanolevel_ACT 1 +#define KellerNanolevel_ACT 1 #endif //WINGBOARD_KNH002 //Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis @@ -61,20 +60,22 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 // FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI -#define ASONG_AM23XX_UUID 1 +//#define ASONG_AM23XX_UUID 1 + +// sensors with low power useage - +#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_MEDIUM_REQ +// with Modem use above ^^ else use below \|/ +//#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ -// sensors with low power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ // Mayfly configuration // Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery // Digi WiFi S6 plugged in directly // For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "tu_test basic WiFi" +//Assume Mayfly, and version determined on boot See mcuBoardVersion_ +//#define MFName_DEF "Mayfly" +//#define HwName_DEF MFName_DEF +#define CONFIGURATION_DESCRIPTION_STR "Electrical Conductivity MMW Digi WiFi S6/LTE XB3-C-A2" #define USE_MS_SD_INI 1 #define USE_PS_EEPROM 1 @@ -116,28 +117,19 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define loggingInterval_MAX_CDEF_MIN 6 * 60 -// Instructions: define only one _Module -#define DigiXBeeWifi_Module 1 -//#warning infoMayflyWithDigiXBeeWiFi -//#define DigiXBeeCellularTransparent_Module 1 -//#warning infoMayflyWithDigiXBeeCellTransparent -// #define DigiXBeeLTE_Module 1 - unstable -// #define TINY_GSM_MODEM_SIM800 // Select for a SIM800, SIM900, or variant -// thereof #define TINY_GSM_MODEM_UBLOX // Select for most u-blox cellular -// modems #define TINY_GSM_MODEM_ESP8266 // Select for an ESP8266 using the -// DEFAULT AT COMMAND FIRMWARE End TinyGsmClient.h options -#if defined(DigiXBeeWifi_Module) || defined(DigiXBeeCellularTransparent_Module) +// Supports DigiXBeeCellularTransparent & DigiXBeeWifi +#define UseModem_Module 1 +#if UseModem_Module // The Modem is used to push data and also sync Time // In standalong logger, no internet, Modem can be required at factor to do a // sync Time Normally enable both of the following. In standalone, disable // UseModem_PushData. -#define UseModem_Module 1 #define UseModem_PushData 1 -//Select buildtime Publishers supported. Not all publishers can be supported +//Select buildtime Publishers supported. // The persisten resources (EEPROM) are allocated as a baselevel no matter what options -//#define USE_PUB_MMW 1 +#define USE_PUB_MMW 1 //#define USE_PUB_TSMQTT 1 -#define USE_PUB_UBIDOTS 1 +//#define USE_PUB_UBIDOTS 1 // Required for TinyGsmClient.h #define TINY_GSM_MODEM_XBEE @@ -157,9 +149,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //Manage Internet - common for all providers #define MNGI_COLLECT_READINGS_DEF 1 #define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // Modules - -// end of _Module +#endif // UseModem_Module // This might need revisiting #define ARD_ANLAOG_MULTIPLEX_PIN A6 diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index d3b001c61..6addb2787 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -48,9 +48,13 @@ int8_t Logger::_loggerTimeZone = 0; // Initialize the static time adjustment int8_t Logger::_loggerRTCOffset = 0; // Initialize the static timestamps -#define markedEpochTimeTz markedEpochTime -uint32_t Logger::markedEpochTimeTz = 0; -uint32_t Logger::markedEpochTimeUTC = 0; +uint32_t Logger::markedLocalEpochTime = 0; +uint32_t Logger::markedUTCEpochTime = 0; +//#define markedEpochTime markedLocalEpochTime +//#define markedLocalEpochTime markedEpochTime +//#define markedEpochTimeTz markedEpochTime +//uint32_t Logger::markedEpochTimeTz = 0; +//uint32_t Logger::markedEpochTimeUTC = 0; // Initialize the testing/logging flags volatile bool Logger::isLoggingNow = false; volatile bool Logger::isTestingNow = false; @@ -390,7 +394,7 @@ bool Logger::syncRTC() { // 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 - if (Logger::getNowEpochUTC() % (_loggingIntervalMinutes * 60) > 15) { + if (Logger::getNowLocalEpoch() % (_loggingIntervalMinutes * 60) > 15) { Serial.println(F("Putting modem to sleep")); _logModem->disconnectInternet(); _logModem->modemSleepPowerDown(); @@ -515,13 +519,27 @@ int8_t Logger::getTZOffset(void) { // This gets the current epoch time (unix time, ie, the number of seconds // from January 1, 1970 00:00:00 UTC) and corrects it to the specified time zone -#if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD -#ifdef GETNOWEPOCH_FN uint32_t Logger::getNowEpoch(void) { - return getNowEpochUTC(); + // Depreciated in 0.33.0, left in for compatiblity + return getNowLocalEpoch(); +} +uint32_t Logger::getNowLocalEpoch(void) { + uint32_t currentEpochTime = getNowUTCEpoch(); + // Do NOT apply an offset if the timestamp is obviously bad + if (isRTCSane(currentEpochTime)) + currentEpochTime += ((uint32_t)_loggerRTCOffset) * 3600; + return currentEpochTime; +} + +#if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD + +uint32_t Logger::getNowUTCEpoch(void) { + return rtc.now().getEpoch(); +} +void Logger::setNowUTCEpoch(uint32_t ts) { + rtc.setEpoch(ts); } -#endif // GETNOWEPOCH_FN uint32_t Logger::getNowEpochUTC(void) { uint32_t currentEpochTime = rtc.now().getEpoch(); @@ -543,22 +561,26 @@ uint32_t Logger::getNowEpochTz(void) { return (uint32_t)currentEpochTime; } -#if defined SETNOWEPOCH_FN void Logger::setNowEpoch(uint32_t ts) { rtc.setEpoch(ts); } -#endif // SETNOWEPOCH_FN void Logger::setNowEpochUTC(uint32_t ts) { rtc.setEpoch(ts); } #elif defined ARDUINO_ARCH_SAMD - #if defined GETNOWEPOCH_FN + +uint32_t Logger::getNowUTCEpoch(void) { + return zero_sleep_rtc.getEpoch(); +} +void Logger::setNowUTCEpoch(uint32_t ts) { + zero_sleep_rtc.setEpoch(ts); +} + uint32_t Logger::getNowEpoch(void) { // Depreciated in 0.27.4, left in for compatiblity return getNowEpochUTC(); } -#endif // GETNOWEPOCH_FN uint32_t Logger::getNowEpochUTC(void) { uint32_t currentEpochTime = zero_sleep_rtc.getEpoch(); @@ -591,8 +613,10 @@ void Logger::setNowEpochUTC(uint32_t ts) { // The DateTime object constructor requires the number of seconds from // January 1, 2000 (NOT 1970) as input, so we need to subtract. DateTime Logger::dtFromEpoch(uint32_t epochTime) { - return dtFromEpochTz(epochTime); + DateTime dt(epochTime - EPOCH_TIME_OFF); + return dt; } + DateTime Logger::dtFromEpochUTC(uint32_t epochTimeUTC) { // DateTime dt(epochTimeUTC-EPOCH_TIME_OFF); DateTimeClass(dt, epochTimeUTC) return dt; @@ -651,12 +675,12 @@ bool Logger::setRTClock(uint32_t UTCEpochSeconds) { return false; } - // The "UTCEpochSeconds" is the number of seconds since Jan 1, 1970 in - // UTC We're interested in the UTCEpochSeconds in the logger's and RTC's - // timezone The RTC's timezone is a label and isn't used in - // calculations, only the offset is used to make it more readable - // between the logger and the RTC. Only works for ARM CC if long, AVR - // was uint32_t + + // The "setTime" is the number of seconds since Jan 1, 1970 in UTC + // We're interested in the setTime in the logger's and RTC's timezone + // The RTC's timezone is equal to the logger's timezone minus the offset + // between the logger and the RTC. + // Only works for ARM CC if long, AVR was uint32_t uint32_t nistTz_sec = UTCEpochSeconds + ((int32_t)getTZOffset()) * HOURS_TO_SECS; MS_DBG(F(" NIST UTC:"), UTCEpochSeconds, F("(local time)->"), @@ -705,7 +729,7 @@ bool Logger::setRTClock(uint32_t UTCEpochSeconds) { // This checks that the logger time is within a "sane" range bool Logger::isRTCSane(void) { - uint32_t curRTC = getNowEpochUTC(); + uint32_t curRTC = getNowLocalEpoch(); return isRTCSane(curRTC); } bool Logger::isRTCSane(uint32_t epochTime) { @@ -727,10 +751,11 @@ bool Logger::isRTCSane(uint32_t epochTime) { // sensor was updated, just a single marked time. By custom, this should be // called before updating the sensors, not after. void Logger::markTime(void) { - Logger::markedEpochTimeTz = getNowEpochTz(); - Logger::markedEpochTimeUTC = getNowEpochUTC(); + Logger::markedUTCEpochTime = getNowUTCEpoch(); + Logger::markedLocalEpochTime = markedUTCEpochTime + + ((uint32_t)_loggerRTCOffset) * 3600; - MS_DEEP_DBG(F("markTime"),getNowEpochUTC(), markedEpochTimeUTC,markedEpochTimeTz ); + MS_DEEP_DBG(F("markTime"),getNowEpochUTC(), markedUTCEpochTime,markedEpochTimeTz ); } @@ -761,7 +786,7 @@ uint8_t Logger::checkInterval(void) { if (checkTime % (_loggingIntervalMinutes * 60) == 0) { // Update the time variables with the current time markTime(); - MS_DBG(F("Take Sensor readings. Epoch:"), Logger::markedEpochTimeTz); + MS_DBG(F("Take Sensor readings. Epoch:"), Logger::markedLocalEpochTime); // Check what actions for this time period retval |= CIA_NEW_READING; @@ -849,8 +874,8 @@ uint8_t Logger::checkInterval(void) { // rtcExtNowDt.toString((char *)DateFmt) const char *DateFmt = // "YY-MM-DD:hhmmss"; uint32_t rtcExtNowTzSec = rtcExtNowDt.unixtime()+ // ((int32_t)getTZOffset()*HOURS_TO_SECS); - MS_DBG(F("Logging epoch time marked:"), Logger::markedEpochTimeTz, " ", - Logger::formatDateTime_ISO8601(Logger::markedEpochTimeTz), "extRtc", + MS_DBG(F("Logging epoch time marked:"), Logger::markedLocalEpochTime, " ", + Logger::formatDateTime_ISO8601(Logger::markedLocalEpochTime), "extRtc", rtcExtNowDt.timestamp(DateTime::TIMESTAMP_FULL)); // - caused reboot retval = true; @@ -862,13 +887,13 @@ uint8_t Logger::checkInterval(void) { // This checks to see if the MARKED time is an even interval of the logging rate bool Logger::checkMarkedInterval(void) { bool retval; - MS_DBG(F("Marked Time:"), Logger::markedEpochTimeTz, + MS_DBG(F("Marked Time:"), Logger::markedLocalEpochTime, F("Logging interval in seconds:"), (_loggingIntervalMinutes * 60), F("Mod of Logging Interval:"), - Logger::markedEpochTimeTz % (_loggingIntervalMinutes * 60)); + Logger::markedLocalEpochTime % (_loggingIntervalMinutes * 60)); - if (Logger::markedEpochTimeTz != 0 && - (Logger::markedEpochTimeTz % (_loggingIntervalMinutes * 60) == 0)) { + if (Logger::markedLocalEpochTime != 0 && + (Logger::markedLocalEpochTime % (_loggingIntervalMinutes * 60) == 0)) { MS_DBG(F("Time to log!")); retval = true; } else { @@ -1291,7 +1316,7 @@ void Logger::systemSleep(uint8_t sleep_min) { #endif // Wake-up message - wakeUpTime_secs = getNowEpochTz(); + wakeUpTime_secs = getNowLocalEpoch(); PRINTOUT(F("\n... zzzZZ Awake @"), formatDateTime_ISO8601(wakeUpTime_secs)); // The logger will now start the next function after the systemSleep @@ -1321,7 +1346,7 @@ void Logger::generateAutoFileName(void) { // Generate the file name from logger ID and date String fileName = String(_loggerID); fileName += "_"; - fileName += formatDateTime_ISO8601(getNowEpochTz()).substring(0, 10); + fileName += formatDateTime_ISO8601(getNowLocalEpoch()).substring(0, 10); fileName += ".csv"; setFileName(fileName); _fileName = fileName; @@ -1392,7 +1417,7 @@ void Logger::printFileHeader(Stream* stream) { // time - out over an Arduino stream void Logger::printSensorDataCSV(Stream* stream) { String csvString = ""; - dtFromEpochTz(Logger::markedEpochTimeTz).addToString(csvString); + dtFromEpochTz(Logger::markedLocalEpochTime).addToString(csvString); csvString += ','; stream->print(csvString); for (uint8_t i = 0; i < getArrayVarCount(); i++) { @@ -1446,11 +1471,12 @@ void Logger::setFileTimestampTz(File fileToStamp, uint8_t stampFlag) { // Protected helper function - This sets a timestamp on a file void Logger::setFileTimestamp(File fileToStamp, uint8_t stampFlag) { - fileToStamp.timestamp( - stampFlag, dtFromEpoch(getNowEpochTz()).year(), - dtFromEpoch(getNowEpochTz()).month(), dtFromEpoch(getNowEpochTz()).date(), - dtFromEpoch(getNowEpochTz()).hour(), dtFromEpoch(getNowEpochTz()).minute(), - dtFromEpoch(getNowEpochTz()).second()); + fileToStamp.timestamp(stampFlag, dtFromEpoch(getNowLocalEpoch()).year(), + dtFromEpoch(getNowLocalEpoch()).month(), + dtFromEpoch(getNowLocalEpoch()).date(), + dtFromEpoch(getNowLocalEpoch()).hour(), + dtFromEpoch(getNowLocalEpoch()).minute(), + dtFromEpoch(getNowLocalEpoch()).second()); } @@ -1695,7 +1721,7 @@ void Logger::testingMode() { // 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 straigh pass-through to + // getModemSignalQuality() is just a straight pass-through to // getSignalQuality(). _logModem->updateModemMetadata(); @@ -1706,7 +1732,7 @@ void Logger::testingMode() { _internalArray->updateAllSensors(); // Print out the current logger time PRINTOUT(F("Current logger time is"), - formatDateTime_ISO8601(getNowEpochTz())); + formatDateTime_ISO8601(getNowLocalEpoch())); PRINTOUT(F("-----------------------")); // Print out the sensor data #if defined(STANDARD_SERIAL_OUTPUT) @@ -1931,7 +1957,9 @@ void Logger::begin() { // Print out the current time PRINTOUT(F("Current RTC time is:"), - formatDateTime_ISO8601(getNowEpochTz())); + formatDateTime_ISO8601(getNowUTCEpoch())); + PRINTOUT(F("Current localized logger time is:"), + formatDateTime_ISO8601(getNowLocalEpoch())); // Reset the watchdog watchDogTimer.resetWatchDog(); @@ -2048,9 +2076,9 @@ void Logger::logDataAndPublish(void) { publishDataToRemotes(); watchDogTimer.resetWatchDog(); - if ((Logger::markedEpochTime != 0 && - Logger::markedEpochTime % 86400 == 43200) || - !isRTCSane(Logger::markedEpochTime)) { + if ((Logger::markedLocalEpochTime != 0 && + Logger::markedLocalEpochTime % 86400 == 43200) || + !isRTCSane(Logger::markedLocalEpochTime)) { // Sync the clock at noon MS_DBG(F("Running a daily clock sync...")); setRTClock(_logModem->getNISTTime()); diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 3ca727857..ef1fc4ba9 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -24,6 +24,7 @@ #ifdef MS_LOGGERBASE_DEBUG_DEEP #define MS_DEBUGGING_DEEP "LoggerBase" #endif + // Included Dependencies #include "ModSensorDebugger.h" #undef MS_DEBUGGING_STD @@ -653,15 +654,43 @@ class Logger { * @brief Get the current epoch time from the RTC (unix time, ie, the * number of seconds from January 1, 1970 00:00:00) and correct it to the * logging time zone. - * Depreciated in 0.27.5, use getNowEpochUTC + * * @return **uint32_t** The number of seconds from January 1, 1970 in the * logging time zone. + * + * @m_deprecated_since{0,33,0} */ - #define GETNOWEPOCH_FN //Supersedded - #if defined GETNOWEPOCH_FN static uint32_t getNowEpoch(void); - #endif //GETNOWEPOCH_FN + /** + * @brief Get the current epoch time from the RTC (unix time, ie, the + * number of seconds from January 1, 1970 00:00:00) and correct it to the + * logging time zone. + * + * @return **uint32_t** The number of seconds from January 1, 1970 in the + * logging time zone. + */ + static uint32_t getNowLocalEpoch(void); + + /** + * @brief Get the current Universal Coordinated Time (UTC) epoch time from + * the RTC (unix time, ie, the number of seconds from January 1, 1970 + * 00:00:00 UTC) + * + * @return **uint32_t** The number of seconds from 1970-01-01T00:00:00Z0000 + */ + static uint32_t getNowUTCEpoch(void); + /** + * @brief Set the real time clock to the given number of seconds from + * January 1, 1970. + * + * The validity of the timestamp is not checked in any way! In practice, + * setRTClock(ts) should be used to avoid setting the clock to an obviously + * invalid value. The input value should be *in the timezone of the RTC.* + * + * @param ts The number of seconds since 1970. + */ + static void setNowUTCEpoch(uint32_t ts); /** * @brief Get Epoch Time with no offsets */ @@ -790,7 +819,7 @@ class Logger { /** * @brief Check if the MARKED time is an even interval of the logging rate - - * That is the value saved in the static variable markedEpochTime. + * That is the value saved in the static variable markedLocalEpochTime. * * This should be used in conjunction with markTime() to ensure that all * data outputs from a single data update session (SD, EnviroDIY, serial @@ -1157,12 +1186,12 @@ class Logger { /** * @brief The static "marked" epoch time for the local timezone. */ - static uint32_t markedEpochTime; + static uint32_t markedLocalEpochTime; /** * @brief The static "marked" epoch time for UTC. */ - static uint32_t markedEpochTimeUTC; + static uint32_t markedUTCEpochTime; // These are flag fariables noting the current state (logging/testing) // NOTE: if the logger isn't currently logging or testing or in the middle diff --git a/src/LoggerBaseExtCpp.h b/src/LoggerBaseExtCpp.h index 6afbedb66..483b248a7 100644 --- a/src/LoggerBaseExtCpp.h +++ b/src/LoggerBaseExtCpp.h @@ -851,9 +851,9 @@ void Logger::logDataAndPubReliably(uint8_t cia_val_override) { #define NIST_SYNC_RATE NIST_SYNC_DAY #endif //NIST_SYNC_HOURLY uint32_t logIntvl_sec = _loggingIntervalMinutes * 60; - uint32_t timeToday_sec = markedEpochTime % NIST_SYNC_RATE; + uint32_t timeToday_sec = markedUTCEpochTime % NIST_SYNC_RATE; bool doSyncTimeCheck = (timeToday_sec< logIntvl_sec); - /*MS_DBG*/PRINTOUT(F("SyncTimeCheck "),doSyncTimeCheck," modulo_sec",timeToday_sec," Time",Logger::markedEpochTime); + /*MS_DBG*/PRINTOUT(F("SyncTimeCheck "),doSyncTimeCheck," modulo_sec",timeToday_sec," Time",Logger::markedUTCEpochTime); if (doSyncTimeCheck) { MS_DBG(F("Running an NIST clock sync...")); if(setRTClock(_logModem->getNISTTime())) { @@ -1306,9 +1306,9 @@ status, n*[<,values>] bool Logger::serzRdel_Line() { if (serzRdelFile.open(serzRdelFn_str, RDEL_OFLAG)) { uint16_t outputSz; - // String csvString(Logger::markedEpochTime); + // String csvString(Logger::markedUTCEpochTime); outputSz = serzRdelFile.print("0,"); // Start READINGS_STATUS - outputSz += serzRdelFile.print(Logger::markedEpochTime); + outputSz += serzRdelFile.print(Logger::markedUTCEpochTime); for (uint8_t i = 0; i < getArrayVarCount(); i++) { // csvString += ','; outputSz += serzRdelFile.print(',' + getValueStringAtI(i)); @@ -1317,7 +1317,7 @@ bool Logger::serzRdel_Line() { // setFileAccessTime(serzRdelFile); serzRdelFile.close(); MS_DEEP_DBG(F("serzRdel_Line on"), serzRdelFn_str, F(" at "), - markedEpochTime, F(" size="), outputSz); + markedUTCEpochTime, F(" size="), outputSz); } else { PRINTOUT(F("serzRdel_Line; No file"), serzRdelFn_str); return false; diff --git a/src/publishers/DreamHostPublisher.cpp b/src/publishers/DreamHostPublisher.cpp index f4996cb18..4a7945cf1 100644 --- a/src/publishers/DreamHostPublisher.cpp +++ b/src/publishers/DreamHostPublisher.cpp @@ -66,7 +66,7 @@ void DreamHostPublisher::printSensorDataDreamHost(Stream* stream) { stream->print(loggerTag); stream->print(_baseLogger->getLoggerID()); stream->print(timestampTagDH); - stream->print(String(Logger::markedEpochTime - + stream->print(String(Logger::markedLocalEpochTime - 946684800)); // Correct time from epoch to y2k for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { @@ -133,7 +133,8 @@ int16_t DreamHostPublisher::publishData(Client* outClient) { if (bufferFree() < 22) printTxBuffer(outClient); strcat(txBuffer, timestampTagDH); - ltoa((Logger::markedEpochTime - 946684800), tempBuffer, 10); // BASE 10 + ltoa((Logger::markedLocalEpochTime - 946684800), tempBuffer, + 10); // BASE 10 strcat(txBuffer, tempBuffer); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index 2fd93d0f8..b74e73291 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -135,7 +135,8 @@ void EnviroDIYPublisher::printSensorDataJSON(Stream* stream) { stream->print(samplingFeatureTag); stream->print(_baseLogger->getSamplingFeatureUUID()); stream->print(timestampTag); - stream->print(_baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime)); + stream->print( + _baseLogger->formatDateTime_ISO8601(Logger::markedLocalEpochTime)); stream->print(F("\",")); for (uint8_t i = 0; i < _baseLogger->getArrayVarCount(); i++) { @@ -341,7 +342,7 @@ void EnviroDIYPublisher::mmwPostDataArray(char* tempBuffer) { // Fill the body MS_DBG(F("Filling from Array")); strcat(txBuffer, timestampTag); - _baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime) + _baseLogger->formatDateTime_ISO8601(Logger::markedLocalEpochTime) .toCharArray(tempBuffer, TEMP_BUFFER_SZ); strcat(txBuffer, tempBuffer); txBuffer[strlen(txBuffer)] = '"'; diff --git a/src/publishers/ThingSpeakPublisher.cpp b/src/publishers/ThingSpeakPublisher.cpp index 1c0bac04b..d1503c6b2 100644 --- a/src/publishers/ThingSpeakPublisher.cpp +++ b/src/publishers/ThingSpeakPublisher.cpp @@ -146,7 +146,7 @@ int16_t ThingSpeakPublisher::publishData(Client* outClient) { emptyTxBuffer(); - _baseLogger->formatDateTime_ISO8601(Logger::markedEpochTime) + _baseLogger->formatDateTime_ISO8601(Logger::markedLocalEpochTime) .toCharArray(tempBuffer, 26); strcat(txBuffer, "created_at="); strcat(txBuffer, tempBuffer); diff --git a/src/publishers/UbidotsPublisher.cpp b/src/publishers/UbidotsPublisher.cpp index 1aa01bfc6..9143dd06e 100644 --- a/src/publishers/UbidotsPublisher.cpp +++ b/src/publishers/UbidotsPublisher.cpp @@ -111,7 +111,7 @@ void UbidotsPublisher::printSensorDataJSON(Stream* stream) { stream->print(F("\":{'value':")); stream->print(_baseLogger->getValueStringAtI(i)); stream->print(",'timestamp':"); - stream->print(Logger::markedEpochTimeUTC); + stream->print(Logger::markedUTCEpochTime); stream->print( F("000}")); // Convert microseconds to milliseconds for ubidots if (i + 1 != _baseLogger->getArrayVarCount()) { stream->print(','); } @@ -229,7 +229,7 @@ int16_t UbidotsPublisher::publishData(Client* outClient) { strcat(txBuffer, "timestamp"); txBuffer[strlen(txBuffer)] = '"'; txBuffer[strlen(txBuffer)] = ':'; - ltoa((Logger::markedEpochTimeUTC), tempBuffer, 10); // BASE 10 + ltoa((Logger::markedUTCEpochTime), tempBuffer, 10); // BASE 10 strcat(txBuffer, tempBuffer); strcat(txBuffer, "000"); if (i + 1 != _baseLogger->getArrayVarCount()) { From 3625b2b87d88c77eec92b2f214a2962db9eb12fb Mon Sep 17 00:00:00 2001 From: neilh20 Date: Fri, 8 Apr 2022 15:04:49 -0700 Subject: [PATCH 78/94] ignore the old SensorModbusMaster --- a/tu_xx01/platformio.ini | 1 + 1 file changed, 1 insertion(+) diff --git a/a/tu_xx01/platformio.ini b/a/tu_xx01/platformio.ini index 6c7559808..f19411f92 100644 --- a/a/tu_xx01/platformio.ini +++ b/a/tu_xx01/platformio.ini @@ -76,6 +76,7 @@ lib_cmn_deps = ; Development: ModularSensors Release1: src ? ; ?? .pioenvs, .piolibdeps, .vscode, include, doc, examples, sensor_tests, compile_tests, pioScripts lib_ignore = .git, doc, examples, arduino_update, sensor_tests, + SensorModbusMaster ModularSensors EnviroDIY_DS3231 ;Arduino-SDI-12 From 51138cd0396f593757fc439b97dc37c1dbc98cb4 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Sun, 10 Apr 2022 08:33:50 -0700 Subject: [PATCH 79/94] Cleanup of using LocalEpoch time #108 --- a/tu_xx01/platformio.ini | 7 ++--- a/tu_xx01/src/tu_xx01.cpp | 8 +++--- src/LoggerBase.cpp | 56 +++++++++++---------------------------- src/LoggerBase.h | 30 --------------------- src/LoggerBaseExtCpp.h | 18 ++++++------- src/ModularSensors.h | 2 +- 6 files changed, 33 insertions(+), 88 deletions(-) diff --git a/a/tu_xx01/platformio.ini b/a/tu_xx01/platformio.ini index f19411f92..aa62f361b 100644 --- a/a/tu_xx01/platformio.ini +++ b/a/tu_xx01/platformio.ini @@ -76,11 +76,12 @@ lib_cmn_deps = ; Development: ModularSensors Release1: src ? ; ?? .pioenvs, .piolibdeps, .vscode, include, doc, examples, sensor_tests, compile_tests, pioScripts lib_ignore = .git, doc, examples, arduino_update, sensor_tests, + EnviroDIY_DS3231 SensorModbusMaster ModularSensors - EnviroDIY_DS3231 - ;Arduino-SDI-12 - TinyGSM ;see below + Arduino-SDI-12 + TinyGSM + Adafruit_INA21 lib_avr_deps = ;Specific Mayfly board goes in [Mayfly] diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index 2a6cf9b27..6de03ff5d 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -1129,7 +1129,7 @@ void managementSensorsPoll() { //Create a time traceability header String csvString = ""; csvString.reserve(24); - dataLogger.dtFromEpochTz(dataLogger.getNowEpochTz()).addToString(csvString); + dataLogger.dtFromEpochTz(dataLogger.getNowLocalEpoch()).addToString(csvString); csvString += ", "; Serial.print(csvString); //Serial.print(dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); @@ -1511,9 +1511,9 @@ void setup() { #endif // UseModem_Module // List start time, if RTC invalid will also be initialized PRINTOUT(F("Local Time "), - dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); - PRINTOUT(F("Time epoch Tz "),dataLogger.getNowEpochTz()); - PRINTOUT(F("Time epoch UTC "),dataLogger.getNowEpochUTC()); + dataLogger.formatDateTime_ISO8601(dataLogger.getNowLocalEpoch())); + PRINTOUT(F("Time local epoch "),dataLogger.getNowLocalEpoch()); + PRINTOUT(F("Time UTC epoch "),dataLogger.getNowUTCEpoch()); //Setup sensors, including reading sensor data sheet that can be recorded on SD card PRINTOUT(F("Setting up sensors...")); diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 94033e6f2..3beb7389c 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -556,13 +556,6 @@ uint32_t Logger::getNowLocalEpoch(void) { #if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD uint32_t Logger::getNowUTCEpoch(void) { - return rtc.now().getEpoch(); -} -void Logger::setNowUTCEpoch(uint32_t ts) { - rtc.setEpoch(ts); -} - -uint32_t Logger::getNowEpochUTC(void) { uint32_t currentEpochTime = rtc.now().getEpoch(); if (!isRTCSane(currentEpochTime)) { PRINTOUT(F("Bad time "), currentEpochTime, " ", @@ -570,22 +563,12 @@ uint32_t Logger::getNowEpochUTC(void) { " Setting to ", formatDateTime_ISO8601(EPOCH_TIME_LOWER_SANITY_SECS)); currentEpochTime = EPOCH_TIME_LOWER_SANITY_SECS; - setNowEpochUTC(currentEpochTime); + setNowUTCEpoch(currentEpochTime); } return currentEpochTime; } - -uint32_t Logger::getNowEpochTz(void) { - int64_t currentEpochTime = (int64_t)((uint64_t)rtc.now().getEpoch()); - currentEpochTime += (_loggerRTCOffset * HOURS_TO_SECS); - return (uint32_t)currentEpochTime; -} - -void Logger::setNowEpoch(uint32_t ts) { - rtc.setEpoch(ts); -} -void Logger::setNowEpochUTC(uint32_t ts) { +void Logger::setNowUTCEpoch(uint32_t ts) { rtc.setEpoch(ts); } @@ -600,33 +583,24 @@ void Logger::setNowUTCEpoch(uint32_t ts) { uint32_t Logger::getNowEpoch(void) { // Depreciated in 0.27.4, left in for compatiblity - return getNowEpochUTC(); + return getNowUTCEpoch(); } -uint32_t Logger::getNowEpochUTC(void) { +uint32_t Logger::getNowUTCEpoch(void) { uint32_t currentEpochTime = zero_sleep_rtc.getEpoch(); if (!isRTCSane(currentEpochTime)) { PRINTOUT(F("Bad time, resetting clock."), currentEpochTime, " ", formatDateTime_ISO8601(currentEpochTime), " Setting to ", formatDateTime_ISO8601(EPOCH_TIME_LOWER_SANITY_SECS)); currentEpochTime = EPOCH_TIME_LOWER_SANITY_SECS; - setNowEpochUTC(currentEpochTime); + setNowUTCEpoch(currentEpochTime); } return currentEpochTime; } -uint32_t Logger::getNowEpochTz(void) { - return (uint32_t)(getNowEpochUTC() + (_loggerRTCOffset * HOURS_TO_SECS)); -} -#if defined SETNOWEPOCH_FN -void Logger::setNowEpoch(uint32_t ts) { - zero_sleep_rtc.setEpoch(ts); -} -#endif // SETNOWEPOCH_FN -void Logger::setNowEpochUTC(uint32_t ts) { - zero_sleep_rtc.setEpoch(ts); +uint32_t Logger::getNowLocalEpoch(void) { + return (uint32_t)(getNowUTCEpoch() + (_loggerRTCOffset * HOURS_TO_SECS)); } - #endif // This converts the current UNIX timestamp (ie, the number of seconds @@ -701,7 +675,7 @@ bool Logger::setRTClock(uint32_t UTCEpochSeconds) { // The RTC's timezone is equal to the logger's timezone minus the offset // between the logger and the RTC. // Only works for ARM CC if long, AVR was uint32_t - uint32_t set_rtcTZ = UTCEpochSeconds; + long set_rtcTZ = UTCEpochSeconds; // NOTE: We're only looking at local time here in order to print it out for // the user uint32_t set_logTZ = UTCEpochSeconds + @@ -781,7 +755,7 @@ void Logger::markTime(void) { Logger::markedLocalEpochTime = markedUTCEpochTime + ((uint32_t)_loggerRTCOffset) * 3600; - MS_DEEP_DBG(F("markTime"),getNowEpochUTC(), markedUTCEpochTime,markedEpochTimeTz ); + MS_DEEP_DBG(F("markTime UTC"), markedUTCEpochTime,F("local"),formatDateTime_ISO8601(markedLocalEpochTime),markedLocalEpochTime ); } @@ -790,8 +764,8 @@ void Logger::markTime(void) { uint8_t Logger::checkInterval(void) { uint8_t retval = CIA_NOACTION; #if defined(ARDUINO_AVR_ENVIRODIY_MAYFLY) - uint32_t checkTime = getNowEpochUTC(); - MS_DBG(F("Current Unix Timestamp:"), checkTime, F("->"), + uint32_t checkTime = getNowLocalEpoch(); + MS_DBG(F("Current Epoch local Timestamp:"), checkTime, F("->"), formatDateTime_ISO8601(checkTime)); MS_DBG(F("Logging interval in seconds:"), (_loggingIntervalMinutes * 60)); MS_DBG(F("Mod of Logging Interval:"), @@ -812,7 +786,7 @@ uint8_t Logger::checkInterval(void) { if (checkTime % (_loggingIntervalMinutes * 60) == 0) { // Update the time variables with the current time markTime(); - MS_DBG(F("Take Sensor readings. Epoch:"), Logger::markedEpochTimeTz); + MS_DBG(F("Take Sensor readings. Epoch:"), Logger::markedLocalEpochTime); // Check what actions for this time period retval |= CIA_NEW_READING; @@ -866,7 +840,7 @@ uint8_t Logger::checkInterval(void) { alertOff(); delay(25); PRINTOUT(F("The current clock timestamp is not valid!"), - formatDateTime_ISO8601(getNowEpochUTC()).substring(0, 10)); + formatDateTime_ISO8601(getNowUTCEpoch()).substring(0, 10)); alertOn(); delay(25); alertOff(); @@ -1117,7 +1091,7 @@ void Logger::systemSleep(uint8_t sleep_min) { local_secs = (sleep_min * 60); } // zero_sleep_rtc.setAlarmSeconds(local_secs); - timeNow_secs = getNowEpochUTC(); + timeNow_secs = getNowUTCEpoch(); targetWakeup_secs = timeNow_secs + local_secs; adjust_secs = targetWakeup_secs % 60; targetWakeup_secs -= adjust_secs; @@ -1481,7 +1455,7 @@ bool Logger::initializeSDCard(void) { void Logger::setFileTimestampTz(File fileToStamp, uint8_t stampFlag) { //DateTime markedDt(Logger::markedEpochTime - EPOCH_TIME_OFF); - DateTime markedDtTz(getNowEpochTz()- EPOCH_TIME_OFF ); + DateTime markedDtTz(getNowLocalEpoch()- EPOCH_TIME_OFF ); MS_DEEP_DBG(F("setFTTz"),markedDtTz.year(),markedDtTz.month(), markedDtTz.date(), markedDtTz.hour(), markedDtTz.minute(), markedDtTz.second()); diff --git a/src/LoggerBase.h b/src/LoggerBase.h index cb3968592..76bf01c68 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -761,36 +761,6 @@ class Logger { */ static void setNowUTCEpoch(uint32_t ts); - /** - * @brief Get Epoch Time with no offsets - */ - static uint32_t getNowEpochUTC(void); - /** - * @brief Get Epoch time with zone offset - */ - static uint32_t getNowEpochTz(void); - - /** - * @brief Set the real time clock to the given number of seconds from - * January 1, 1970. - * Superseded 0.27.5 use setNowEpochUTC() - * - * The validity of the timestamp is not checked in any way! In practice, - * setRTClock(ts) should be used to avoid setting the clock to an obviously - * invalid value. The input value should be *in the timezone of the RTC.* - * - * @param ts The number of seconds since 1970. - */ - #define SETNOWEPOCH_FN - #if defined SETNOWEPOCH_FN - static void setNowEpoch(uint32_t ts); - #endif // SETNOWEPOCH_FN - - /** - * @brief Set Epoch time with no offsets - */ - static void setNowEpochUTC(uint32_t ts); - /** * @brief Convert the number of seconds from January 1, 1970 to a DateTime * object instance. diff --git a/src/LoggerBaseExtCpp.h b/src/LoggerBaseExtCpp.h index 483b248a7..ea51a25d7 100644 --- a/src/LoggerBaseExtCpp.h +++ b/src/LoggerBaseExtCpp.h @@ -764,7 +764,7 @@ void Logger::logDataAndPubReliably(uint8_t cia_val_override) { uint8_t cia_val = checkInterval(); if (cia_val_override) { cia_val = cia_val_override; - wakeUpTime_secs = getNowEpochTz();//Set reference time + wakeUpTime_secs = getNowLocalEpoch();//Set reference time markTime(); PRINTOUT(F("logDataAndPubReliably - overide with "),cia_val); } @@ -851,9 +851,9 @@ void Logger::logDataAndPubReliably(uint8_t cia_val_override) { #define NIST_SYNC_RATE NIST_SYNC_DAY #endif //NIST_SYNC_HOURLY uint32_t logIntvl_sec = _loggingIntervalMinutes * 60; - uint32_t timeToday_sec = markedUTCEpochTime % NIST_SYNC_RATE; + uint32_t timeToday_sec = markedLocalEpochTime % NIST_SYNC_RATE; bool doSyncTimeCheck = (timeToday_sec< logIntvl_sec); - /*MS_DBG*/PRINTOUT(F("SyncTimeCheck "),doSyncTimeCheck," modulo_sec",timeToday_sec," Time",Logger::markedUTCEpochTime); + /*MS_DBG*/PRINTOUT(F("SyncTimeCheck "),doSyncTimeCheck," modulo_sec",timeToday_sec," Time",Logger::markedLocalEpochTime); if (doSyncTimeCheck) { MS_DBG(F("Running an NIST clock sync...")); if(setRTClock(_logModem->getNISTTime())) { @@ -1306,9 +1306,9 @@ status, n*[<,values>] bool Logger::serzRdel_Line() { if (serzRdelFile.open(serzRdelFn_str, RDEL_OFLAG)) { uint16_t outputSz; - // String csvString(Logger::markedUTCEpochTime); + // String csvString(Logger::markedLocalEpochTime); outputSz = serzRdelFile.print("0,"); // Start READINGS_STATUS - outputSz += serzRdelFile.print(Logger::markedUTCEpochTime); + outputSz += serzRdelFile.print(Logger::markedLocalEpochTime); for (uint8_t i = 0; i < getArrayVarCount(); i++) { // csvString += ','; outputSz += serzRdelFile.print(',' + getValueStringAtI(i)); @@ -1317,7 +1317,7 @@ bool Logger::serzRdel_Line() { // setFileAccessTime(serzRdelFile); serzRdelFile.close(); MS_DEEP_DBG(F("serzRdel_Line on"), serzRdelFn_str, F(" at "), - markedUTCEpochTime, F(" size="), outputSz); + markedLocalEpochTime, F(" size="), outputSz); } else { PRINTOUT(F("serzRdel_Line; No file"), serzRdelFn_str); return false; @@ -1551,7 +1551,7 @@ bool Logger::postLogOpen(const char* postLogNam_str) { #if defined MS_LOGGERBASE_POSTS // Generate the file name from logger ID and date // Create rotating log of 4 chars YYMM - formatDateTime is YYYY MM DD - String nameTemp = formatDateTime_str(getNowEpochTz()); + String nameTemp = formatDateTime_str(getNowLocalEpoch()); // Drop middle _ and get YYMM String fileName = String(postLogNam_str + nameTemp.substring(2, 4) + nameTemp.substring(5, 7) + ".log"); @@ -1606,7 +1606,7 @@ void Logger::postLogLine(uint32_t tmr_ms, int16_t rspParam) { char tempBuffer[TEMP_BUFFER_SZ]; //Print internal time - formatDateTime_str(getNowEpochTz()) + formatDateTime_str(getNowLocalEpoch()) .toCharArray(tempBuffer, TEMP_BUFFER_SZ); postsLogHndl.print(tempBuffer); #endif @@ -1634,7 +1634,7 @@ void Logger::postLogLine(const char *logMsg,bool addCRNL) { } char tempBuffer[TEMP_BUFFER_SZ]; //Print internal time - formatDateTime_str(getNowEpochTz()) + formatDateTime_str(getNowLocalEpoch()) .toCharArray(tempBuffer, TEMP_BUFFER_SZ); postsLogHndl.print(tempBuffer); postsLogHndl.print(F(",MSG,")); diff --git a/src/ModularSensors.h b/src/ModularSensors.h index dd1153756..95e05eab9 100644 --- a/src/ModularSensors.h +++ b/src/ModularSensors.h @@ -14,7 +14,7 @@ /** * @brief The current library version number */ -#define MODULAR_SENSORS_VERSION "0.33.0" +#define MODULAR_SENSORS_VERSION "0.33.1.aaa" // To get all of the base classes for ModularSensors, include LoggerBase. // NOTE: Individual sensor definitions must be included separately. From 6efbe1a1a39cd8a3fe470d2459c6f45356aeebde Mon Sep 17 00:00:00 2001 From: neilh20 Date: Sun, 10 Apr 2022 09:31:05 -0700 Subject: [PATCH 80/94] time updates for a/wio01 - still not cc --- a/wio01/platformio.ini | 25 +++++++++++++++++++------ src/LoggerBase.cpp | 21 ++++++--------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/a/wio01/platformio.ini b/a/wio01/platformio.ini index fecc07fb3..394146df4 100644 --- a/a/wio01/platformio.ini +++ b/a/wio01/platformio.ini @@ -29,7 +29,12 @@ description = neilh10/ModularSensors sending data to Monitor My Watershed ; Ignore these folders or PlatformIO will double count all the dependencies ; Development: ModularSensors Release1: src ? ; ?? .pioenvs, .piolibdeps, .vscode, include, doc, examples, sensor_tests, compile_tests, pioScripts -lib_ignore = .git, doc, examples, arduino_update, ModularSensors, Adafruit Circuit Playground +lib_ignore = .git, doc, examples, arduino_update, Adafruit Circuit Playground + SensorModbusMaster + ModularSensors + Arduino-SDI-12 + TinyGSM + Adafruit_INA21 #Would be nice for the following to work #git_rev = !python -c "import subprocess; print '%s' % subprocess.check_output(['git', 'rev-parse','--abbrev-ref', 'HEAD']).strip()" @@ -42,11 +47,19 @@ lib_cmn_deps = ;https://github.com/arduino-libraries/NTPClient - repalced ;; see lib_samd_deps for Adafruit_SPIFlash & Adafruit_TinyUSB_Arduino & Adafruit-GFX-Library Adafruit_NeoPixel ; - ; For development, disable ModularSensors and enable cmn_src_filter - ; Need extra libs, so eable STD_LIBS or 1st pass enable ModularSensors then build pulling in ref libs, - ;EnviroDIY_ModularSensors -; ^^ Use this when working from an official release of the library - ;https://github.com/neilh10/ModularSensors#release1 + ; There are 3 levels of code production + ; The stream ( rel1_dvlp1m) is used in alpha coding and development + ; alpha - this platformio.ini - which enables (rel1_dvlp1m) editing in ModularSensors\src & a\ex + ; development see (rel1_dvlp1m) examples\tu_ec + ; production see (release1) examples\tu_ex + ; + ; For alpha coding, + ; and periodically when need to update all libs including ModularSensors #rel1_dvlp1m + ; for clean lib - delete .pio, + ; then uncomment below + ; pio lib install - execute + ; then recomment below + ; then delete .pio/libdeps/xxx/EnviroDIY_modularSensors to not have conflicts with ../../src ;https://github.com/neilh10/ModularSensors#rel1_dvlp1m ; ^^ Use this when you want to pull from a specific branch ; STD_LIBS pulled in by ModularSensors, needed if not enabling ModularSensors to Historical Ref diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 3beb7389c..991544316 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -540,6 +540,7 @@ int8_t Logger::getTZOffset(void) { // This gets the current epoch time (unix time, ie, the number of seconds // from January 1, 1970 00:00:00 UTC) and corrects it to the specified time zone +#if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD uint32_t Logger::getNowEpoch(void) { // Depreciated in 0.33.0, left in for compatiblity @@ -553,7 +554,6 @@ uint32_t Logger::getNowLocalEpoch(void) { return currentEpochTime; } -#if defined MS_SAMD_DS3231 || not defined ARDUINO_ARCH_SAMD uint32_t Logger::getNowUTCEpoch(void) { uint32_t currentEpochTime = rtc.now().getEpoch(); @@ -574,18 +574,6 @@ void Logger::setNowUTCEpoch(uint32_t ts) { #elif defined ARDUINO_ARCH_SAMD -uint32_t Logger::getNowUTCEpoch(void) { - return zero_sleep_rtc.getEpoch(); -} -void Logger::setNowUTCEpoch(uint32_t ts) { - zero_sleep_rtc.setEpoch(ts); -} - -uint32_t Logger::getNowEpoch(void) { - // Depreciated in 0.27.4, left in for compatiblity - return getNowUTCEpoch(); -} - uint32_t Logger::getNowUTCEpoch(void) { uint32_t currentEpochTime = zero_sleep_rtc.getEpoch(); if (!isRTCSane(currentEpochTime)) { @@ -597,10 +585,13 @@ uint32_t Logger::getNowUTCEpoch(void) { } return currentEpochTime; } - +void Logger::setNowUTCEpoch(uint32_t ts) { + zero_sleep_rtc.setEpoch(ts); +} uint32_t Logger::getNowLocalEpoch(void) { return (uint32_t)(getNowUTCEpoch() + (_loggerRTCOffset * HOURS_TO_SECS)); } + #endif // This converts the current UNIX timestamp (ie, the number of seconds @@ -713,7 +704,7 @@ bool Logger::setRTClock(uint32_t UTCEpochSeconds) { MS_DBG(" Time Returned by rtcExt:", nowExtUTCEpoch_sec, "->(T=", getTimeZone(), ")", formatDateTime_ISO8601(nowExtUTCEpoch_sec)); - time_diff_sec = abs((long)((uint64_t)nowExtUTCEpoch_sec) - + uint32_t time_diff_sec = abs((long)((uint64_t)nowExtUTCEpoch_sec) - (long)((uint64_t)UTCEpochSeconds)); if (time_diff_sec > NIST_TIME_DIFF_SEC) { rtcExtPhy.adjust(UTCEpochSeconds); // const DateTime& dt); From 6718ad59f0e4f1b5301daf76d85ee7ed6954dbe9 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Mon, 11 Apr 2022 17:38:12 -0700 Subject: [PATCH 81/94] Add Mayfly1.x onboard SENSIRION_SHT4X sensor --- a/tu_xx01/src/ms_cfg.h | 12 ++++++--- a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless | 12 ++++++--- a/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless | 10 ++++++-- a/tu_xx01/src/tu_xx01.cpp | 30 ++++++++++++++++++++++- 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/a/tu_xx01/src/ms_cfg.h b/a/tu_xx01/src/ms_cfg.h index 2c4d36332..25f45c777 100644 --- a/a/tu_xx01/src/ms_cfg.h +++ b/a/tu_xx01/src/ms_cfg.h @@ -1,6 +1,6 @@ /***************************************************************************** -ms_cfg.h_LT5_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220320: 0.32.2rs485 +ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi +Status 220410: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -60,6 +60,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 // FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI +//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x +#define SENSIRION_SHT4X_UUID //#define ASONG_AM23XX_UUID 1 //Two heavy sensors with power useage @@ -234,7 +236,11 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define INA219M_VOLT_UUID "INA219_VOLT_UUID" #endif // INA219_PHY_ACT -#if defined ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" +#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" +#elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" #define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" diff --git a/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless index 2c4d36332..25f45c777 100644 --- a/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless +++ b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless @@ -1,6 +1,6 @@ /***************************************************************************** -ms_cfg.h_LT5_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220320: 0.32.2rs485 +ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi +Status 220410: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -60,6 +60,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 // FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI +//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x +#define SENSIRION_SHT4X_UUID //#define ASONG_AM23XX_UUID 1 //Two heavy sensors with power useage @@ -234,7 +236,11 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define INA219M_VOLT_UUID "INA219_VOLT_UUID" #endif // INA219_PHY_ACT -#if defined ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" +#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" +#elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" #define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" diff --git a/a/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless b/a/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless index c655117a4..f4986063c 100644 --- a/a/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless +++ b/a/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless @@ -1,6 +1,6 @@ /***************************************************************************** ms_cfg.h_LT5_SDI12_wireless - ModularSensors Config - MMW _LT5/SDI12 +LTE/WiFi -Status 220320: 0.32.2 +Status 220410: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -60,6 +60,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 // FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI +//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x +//#define SENSIRION_SHT4X_UUID //#define ASONG_AM23XX_UUID 1 //Two heavy sensors with power useage @@ -234,7 +236,11 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define INA219M_VOLT_UUID "INA219_VOLT_UUID" #endif // INA219_PHY_ACT -#if defined ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" +#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" +#elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" #define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index 6de03ff5d..02975c1dd 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -463,6 +463,7 @@ KellerNanolevel nanolevel_snsr(nanolevelModbusAddress, modbusSerial, // AOSong AM2315 Digital Humidity and Temperature Sensor // ========================================================================== //use updated solving https://github.com/neilh10/ModularSensors/issues/102 +/** Start [ao_song_am2315] */ #include // const int8_t I2CPower = 1;//sensorPowerPin; // Pin to switch power on and @@ -477,8 +478,30 @@ AOSongAM2315a am23xx(I2CPower); // Variable *am2315Humid = new AOSongAM2315a_Humidity(&am23xx, // "12345678-abcd-1234-ef00-1234567890ab"); Variable *am2315Temp = new // AOSongAM2315a_Temp(&am23xx, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [ao_song_am2315] */ #endif // ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +// ========================================================================== +// Sensirion SHT4X Digital Humidity and Temperature Sensor +// ========================================================================== +/** Start [sensirion_sht4x] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const int8_t SHT4xPower = sensorPowerPin; // Power pin +const bool SHT4xUseHeater = true; + +// Create an Sensirion SHT4X sensor object +SensirionSHT4x sht4x(SHT4xPower, SHT4xUseHeater); + +// Create humidity and temperature variable pointers for the SHT4X +/*Variable* sht4xHumid = + new SensirionSHT4x_Humidity(&sht4x, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* sht4xTemp = + new SensirionSHT4x_Temp(&sht4x, "12345678-abcd-1234-ef00-1234567890ab");*/ +/** End [sensirion_sht4x] */ +#endif //SENSIRION_SHT4X_UUID // ========================================================================== // Maxim DS3231 RTC (Real Time Clock) @@ -845,7 +868,12 @@ Variable* variableList[] = { // new BoschBME280_Pressure(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), // new BoschBME280_Altitude(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), // new MaximDS18_Temp(&ds18, "12345678-abcd-1234-ef00-1234567890ab"), -#if defined ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID + new SensirionSHT4x_Humidity(&sht4x, SENSIRION_SHT4X_Air_Humidity_UUID), + new SensirionSHT4x_Temp(&sht4x, SENSIRION_SHT4X_Air_Temperature_UUID), +// ASONG_AM23_Air_TemperatureF_UUID + +#elif defined ASONG_AM23XX_UUID new AOSongAM2315a_Humidity(&am23xx, ASONG_AM23_Air_Humidity_UUID), new AOSongAM2315a_Temp(&am23xx, ASONG_AM23_Air_Temperature_UUID), // ASONG_AM23_Air_TemperatureF_UUID From 511b31f4829958d989fc8855d8ef40fc2ceb3dcc Mon Sep 17 00:00:00 2001 From: neilh20 Date: Thu, 14 Apr 2022 18:07:57 -0700 Subject: [PATCH 82/94] Wio term idea, but failing, not ccing --- a/wio01/src/RTC_SAMD51_EXT.h_fut | 122 +++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 a/wio01/src/RTC_SAMD51_EXT.h_fut diff --git a/a/wio01/src/RTC_SAMD51_EXT.h_fut b/a/wio01/src/RTC_SAMD51_EXT.h_fut new file mode 100644 index 000000000..f404c6a6e --- /dev/null +++ b/a/wio01/src/RTC_SAMD51_EXT.h_fut @@ -0,0 +1,122 @@ +/* + RTC library for Arduino Zero. + Copyright (c) 2015 Arduino LLC. All right reserved. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef LIB_RTC_SAMD51_EXT +#define LIB_RTC_SAMD51_EXT + +#include "Arduino.h" +#include "RTC_SAMD51.h" + +typedef void(*voidFuncPtr)(void); + +class RTC_SAMD51_EXT : public RTC_SAMD51 { +public: + + enum Alarm_Match: uint8_t // Should we have this enum or just use the identifiers from /component/rtc.h ? + { + MATCH_OFF = RTC_MODE2_MASK_SEL_OFF_Val, // Never + MATCH_SS = RTC_MODE2_MASK_SEL_SS_Val, // Every Minute + MATCH_MMSS = RTC_MODE2_MASK_SEL_MMSS_Val, // Every Hour + MATCH_HHMMSS = RTC_MODE2_MASK_SEL_HHMMSS_Val, // Every Day + MATCH_DHHMMSS = RTC_MODE2_MASK_SEL_DDHHMMSS_Val, // Every Month + MATCH_MMDDHHMMSS = RTC_MODE2_MASK_SEL_MMDDHHMMSS_Val, // Every Year + MATCH_YYMMDDHHMMSS = RTC_MODE2_MASK_SEL_YYMMDDHHMMSS_Val // Once, on a specific date and a specific time + }; + + RTC_SAMD51_EXT(); + //RTCSAMD51 void begin(bool resetTime = false); + //need + void adjust(const DateTime &dt); + DateTime now(); + void setAlarm(uint8_t id, const DateTime &dt); + DateTime alarm(uint8_t id); + //RTC_SAMD51 void enableAlarm(Alarm_Match match); + //RTC_SAMD51 void disableAlarm(); + + //RTC_SAMD51 void attachInterrupt(voidFuncPtr callback); + //RTC_SAMD51 void detachInterrupt(); + + //RTC_SAMD51 void standbyMode(); + + /* Get Functions */ + + uint8_t getSeconds(); + uint8_t getMinutes(); + uint8_t getHours(); + + uint8_t getDay(); + uint8_t getMonth(); + uint8_t getYear(); + + uint8_t getAlarmSeconds(); + uint8_t getAlarmMinutes(); + uint8_t getAlarmHours(); + + uint8_t getAlarmDay(); + uint8_t getAlarmMonth(); + uint8_t getAlarmYear(); + + /* Set Functions */ + + void setSeconds(uint8_t seconds); + void setMinutes(uint8_t minutes); + void setHours(uint8_t hours); + void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds); + + void setDay(uint8_t day); + void setMonth(uint8_t month); + void setYear(uint8_t year); + void setDate(uint8_t day, uint8_t month, uint8_t year); + + void setAlarmSeconds(uint8_t seconds); + void setAlarmMinutes(uint8_t minutes); + void setAlarmHours(uint8_t hours); + void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds); + + void setAlarmDay(uint8_t day); + void setAlarmMonth(uint8_t month); + void setAlarmYear(uint8_t year); + void setAlarmDate(uint8_t day, uint8_t month, uint8_t year); + + /* Epoch Functions */ + + uint32_t getEpoch(); + uint32_t getY2kEpoch(); + void setEpoch(uint32_t ts); + void setY2kEpoch(uint32_t ts); + void setAlarmEpoch(uint32_t ts); + + bool isConfigured() { + return _configured; + } + +private: + bool _configured; + + //RTC_SAMD51 void config32kOSC(void); + //RTC_SAMD51 void configureClock(void); + //RTC_SAMD51 void RTCreadRequest(); + //RTC_SAMD51 bool RTCisSyncing(void); + //RTC_SAMD51 void RTCdisable(); + //RTC_SAMD51 void RTCenable(); + //RTC_SAMD51 void RTCreset(); + //RTC_SAMD51 void RTCresetRemove();*/ +}; + +#endif // LIB_RTC_SAMD51_EXT From 82dd7377599db25ce62c74edd70e698e8fd40b14 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Thu, 14 Apr 2022 18:32:17 -0700 Subject: [PATCH 83/94] Wio term idea, but failing, not ccing --- a/tu_xx01/lib/RTClibnh | 1 - a/wio01/src/{RTC_SAMD51_EXT.h_fut => RTC_SAMD51_EXT.h} | 0 2 files changed, 1 deletion(-) delete mode 160000 a/tu_xx01/lib/RTClibnh rename a/wio01/src/{RTC_SAMD51_EXT.h_fut => RTC_SAMD51_EXT.h} (100%) diff --git a/a/tu_xx01/lib/RTClibnh b/a/tu_xx01/lib/RTClibnh deleted file mode 160000 index 6f7371431..000000000 --- a/a/tu_xx01/lib/RTClibnh +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6f73714314ae4df31b73873a98b37c7fc85e67d0 diff --git a/a/wio01/src/RTC_SAMD51_EXT.h_fut b/a/wio01/src/RTC_SAMD51_EXT.h similarity index 100% rename from a/wio01/src/RTC_SAMD51_EXT.h_fut rename to a/wio01/src/RTC_SAMD51_EXT.h From 3217f6bfec18397a57cf5f7e4f3de8b9aa9d8185 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Fri, 15 Apr 2022 12:37:53 -0700 Subject: [PATCH 84/94] Add readSensorVbat() and use it for instaneous update --- a/tu_xx01/src/tu_xx01.cpp | 15 ++++- src/sensors/ProcessorStats.cpp | 115 ++++++++++++++++++--------------- src/sensors/ProcessorStats.h | 7 ++ 3 files changed, 81 insertions(+), 56 deletions(-) diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index 02975c1dd..c91859cde 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -582,7 +582,7 @@ float wLionBatStc3100_worker(void) { // get the Battery Reading flLionBatStc3100_V = MS_LION_ERR_VOLT; } // MS_DBG(F("wLionBatStc3100_worker"), flLionBatStc3100_V); -#if defined MS_TU_XX_DEBUG +#if defined MS_TU_XX_DEBUG_DEEP DEBUGGING_SERIAL_OUTPUT.print(F(" wLionBatStc3100_worker ")); DEBUGGING_SERIAL_OUTPUT.print(flLionBatStc3100_V, 4); DEBUGGING_SERIAL_OUTPUT.println(); @@ -696,9 +696,18 @@ Variable* pLionBatExt_var = // Read's the battery voltage // NOTE: This will actually return the battery level from the previous update! float getBatteryVoltageProc() { + float bat_lowest_v, + bat_latest_v; #define BATTERY_VOLTAGE_OPT PROCESSOR_VBATLOW_VAR_NUM - if (mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT] == PS_SENSOR_INVALID) mcuBoardPhy.update(); - return mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT]; + if (mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT] == PS_SENSOR_INVALID) {mcuBoardPhy.update();} + //Loook for lowest battery voltage + bat_lowest_v = mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT]; + bat_latest_v = mcuBoardPhy.readSensorVbat(); + if (bat_lowest_v > bat_latest_v) { + bat_lowest_v = bat_latest_v; + } + MS_DBG("Vbat_low",bat_lowest_v); + return bat_lowest_v; } #define bms_SetBattery() bms.setBatteryV(getBatteryVoltageProc()); #endif //MAYFLY_BAT_A6 diff --git a/src/sensors/ProcessorStats.cpp b/src/sensors/ProcessorStats.cpp index a6539b544..9ed1d8a3e 100644 --- a/src/sensors/ProcessorStats.cpp +++ b/src/sensors/ProcessorStats.cpp @@ -160,60 +160,9 @@ bool ProcessorStats::addSingleMeasurementResult(void) { #endif // PROC_ADC_DEFAULT_RESOLUTION analogReadResolution(PROC_ADC_DEFAULT_RESOLUTION); analogReference(AR_DEFAULT); -#endif // ARDUINO_ARCH_AVR - -#if defined(ARDUINO_AVR_ENVIRODIY_MAYFLY) - uint16_t adc_temp=0; - uint8_t adc_lp; - //Setup for 1.1,1.0, 0.5,0.5b - float adc_correction=4.7; - if (strcmp(_version, "v0.3") == 0 || strcmp(_version, "v0.4") == 0) { - adc_correction = 1.47 ; - } - - // Get the battery voltage 2^^2 times for noise reduction - for (adc_lp=0;adc_lp<4;adc_lp++) { - adc_temp += analogRead(_batteryPin); - } - float rawBattery = adc_temp>>2; - sensorValue_battery = (3.3 / 1023.) * adc_correction * rawBattery; +#endif // ARDUINO_ARCH_AVR -#elif defined(ARDUINO_AVR_FEATHER32U4) || defined(ARDUINO_SAMD_FEATHER_M0) || \ - defined(ARDUINO_SAMD_FEATHER_M0_EXPRESS) || \ - defined(ADAFRUIT_FEATHER_M4_EXPRESS) - float measuredvbat = analogRead(_batteryPin); - measuredvbat *= 2; // we divided by 2, so multiply back - measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage - measuredvbat /= 1024; // convert to voltage - sensorValue_battery = measuredvbat; - -#elif defined(ARDUINO_SODAQ_ONE) || defined(ARDUINO_SODAQ_ONE_BETA) - if (strcmp(_version, "v0.1") == 0) { - // Get the battery voltage - float rawBattery = analogRead(_batteryPin); - sensorValue_battery = (3.3 / 1023.) * 2 * rawBattery; - } - if (strcmp(_version, "v0.2") == 0) { - // Get the battery voltage - float rawBattery = analogRead(_batteryPin); - sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery; - } - -#elif defined(ARDUINO_AVR_SODAQ_NDOGO) || defined(ARDUINO_SODAQ_AUTONOMO) || \ - defined(ARDUINO_AVR_SODAQ_MBILI) - // Get the battery voltage -#if defined ProcessorStatsDef_Resolution - analogReadResolution(ProcessorStatsDef_Resolution); -#endif - float rawBattery = analogRead(_batteryPin); - sensorValue_battery = (3.3 / ProcAdc_Max) * 1.47 * rawBattery; - MS_DBG(F(" Battery_V("), _batteryPin, F("/"), ProcessorStatsDef_Resolution, - F("):"), sensorValue_battery); - -#else - sensorValue_battery = -9999; - -#endif + sensorValue_battery = readSensorVbat(); MS_DBG(F("Vbat"), sensorValue_battery); verifyAndAddMeasurementResult(PROCESSOR_BATTERY_VAR_NUM, @@ -280,3 +229,63 @@ bool ProcessorStats::addSingleMeasurementResult(void) { // Return true when finished return true; } + +float ProcessorStats::readSensorVbat(void) { + float sensorValue_battery_V; + #if defined(ARDUINO_AVR_ENVIRODIY_MAYFLY) + uint16_t adc_temp=0; + uint8_t adc_lp; + //Setup for 1.1,1.0, 0.5,0.5b + #define MAYFLY_BAT_A6_MULT_A 1.47 + #define MAYFLY_BAT_A6_MULT_B 4.7 + float adc_correction=MAYFLY_BAT_A6_MULT_B; + if (strcmp(_version, "v0.3") == 0 || strcmp(_version, "v0.4") == 0) { + adc_correction = MAYFLY_BAT_A6_MULT_A ; + } + + // Get the battery voltage 2^^2 times for noise reduction + for (adc_lp=0;adc_lp<4;adc_lp++) { + adc_temp += analogRead(_batteryPin); + } + float rawBattery = adc_temp>>2; + sensorValue_battery_V = (3.3 / 1023.) * adc_correction * rawBattery; + +#elif defined(ARDUINO_AVR_FEATHER32U4) || defined(ARDUINO_SAMD_FEATHER_M0) || \ + defined(ARDUINO_SAMD_FEATHER_M0_EXPRESS) || \ + defined(ADAFRUIT_FEATHER_M4_EXPRESS) + float measuredvbat = analogRead(_batteryPin); + measuredvbat *= 2; // we divided by 2, so multiply back + measuredvbat *= 3.3; // Multiply by 3.3V, our reference voltage + measuredvbat /= 1024; // convert to voltage + sensorValue_battery_V = measuredvbat; + +#elif defined(ARDUINO_SODAQ_ONE) || defined(ARDUINO_SODAQ_ONE_BETA) + if (strcmp(_version, "v0.1") == 0) { + // Get the battery voltage + float rawBattery = analogRead(_batteryPin); + sensorValue_battery_V = (3.3 / 1023.) * 2 * rawBattery; + } + if (strcmp(_version, "v0.2") == 0) { + // Get the battery voltage + float rawBattery = analogRead(_batteryPin); + sensorValue_battery_V = (3.3 / 1023.) * 1.47 * rawBattery; + } + +#elif defined(ARDUINO_AVR_SODAQ_NDOGO) || defined(ARDUINO_SODAQ_AUTONOMO) || \ + defined(ARDUINO_AVR_SODAQ_MBILI) + // Get the battery voltage +#if defined ProcessorStatsDef_Resolution + analogReadResolution(ProcessorStatsDef_Resolution); +#endif + float rawBattery = analogRead(_batteryPin); + sensorValue_battery_V = (3.3 / ProcAdc_Max) * 1.47 * rawBattery; + MS_DBG(F(" Battery_V("), _batteryPin, F("/"), ProcessorStatsDef_Resolution, + F("):"), sensorValue_battery_V); + +#else + sensorValue_battery_V = -9999; + +#endif +return sensorValue_battery_V; + +} \ No newline at end of file diff --git a/src/sensors/ProcessorStats.h b/src/sensors/ProcessorStats.h index 0c577132a..e5f728e52 100644 --- a/src/sensors/ProcessorStats.h +++ b/src/sensors/ProcessorStats.h @@ -290,6 +290,13 @@ class ProcessorStats : public Sensor { */ bool addSingleMeasurementResult(void) override; + /** + * @copydoc ProcessorStats::readSensorVbat() + * + * @return battery Voltage (volts) + */ + float readSensorVbat(void); + private: const char* _version; int8_t _batteryPin; From d263353589d3f3b65f395a586c20c513300b9c6b Mon Sep 17 00:00:00 2001 From: neilh20 Date: Fri, 15 Apr 2022 15:39:48 -0700 Subject: [PATCH 85/94] SAMD updates --- a/pwr_mon/platformio.ini | 45 +++++++++++++++++++++++----------------- src/LoggerBase.h | 3 ++- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/a/pwr_mon/platformio.ini b/a/pwr_mon/platformio.ini index c53e08c69..bc57ed7d1 100644 --- a/a/pwr_mon/platformio.ini +++ b/a/pwr_mon/platformio.ini @@ -18,20 +18,14 @@ default_envs = sodaq_autonomo ; actually ^^^ is adafruit_feather_m0_express [common] -; We have to ignore these folders or PlatformIO will double count all the dependencies -lib_ignore = .git, doc, examples -#Would be nice for the following to work -#git_rev = !python -c "import subprocess; print '%s' % subprocess.check_output(['git', 'rev-parse','--abbrev-ref', 'HEAD']).strip()" - -; .pioenvs, .piolibdeps, .vscode, include, doc, examples, sensor_tests, compile_tests, pioScripts -lib_deps = +lib_cmn_deps = ;EnviroDIY_ModularSensors ; ^^ Use this when working from an official release of the library ;https://github.com/neilh10/ModularSensors#release1 ;https://github.com/neilh10/ModularSensors#rel1_dvlp1m ; ^^ Use this when you want to pull from a specific branch - ;https://github.com/neilh10/TinyGSM.git - https://github.com/EnviroDIY/TinyGSM.git + https://github.com/neilh10/TinyGSM.git + ;https://github.com/EnviroDIY/TinyGSM.git https://github.com/vshymanskyy/StreamDebugger ;https://github.com/arduino-libraries/NTPClient - repalced ;if pio broke, not using library.json @@ -55,13 +49,26 @@ lib_deps = ;https://github.com/EnviroDIY/YosemitechModbus ;https://github.com/NorthernWidget/MS5803 +; We have to ignore these folders or PlatformIO will double count all the dependencies +lib_cmn_ignore = .git, doc, examples, arduino_update, sensor_tests, + EnviroDIY_DS3231 + SensorModbusMaster + ModularSensors + Arduino-SDI-12 + TinyGSM + Adafruit_INA21 + +#Would be nice for the following to work +#git_rev = !python -c "import subprocess; print '%s' % subprocess.check_output(['git', 'rev-parse','--abbrev-ref', 'HEAD']).strip()" + +; .pioenvs, .piolibdeps, .vscode, include, doc, examples, sensor_tests, compile_tests, pioScripts lib_avr_deps = https://github.com/EnviroDIY/Sodaq_DS3231.git lib_samd_deps = ;v1.3.2? release1 set as default - see lib\RTCsamdLooUQ https://github.com/neilh10/RTCZero - https://github.com/neilh10/RTClib + ;https://github.com/neilh10/RTClib ;Conflict with DateTime & Sodaq_DSxxxx:DateTime lib_featherExpress_deps = https://github.com/adafruit/Adafruit_NeoPixel @@ -120,9 +127,9 @@ lib_ldf_mode = deep+ # SensorModbusMaster_ID1824\SensorModbusMaster.cpp.o - M4 Register errors, error: 'REG_GCLK_GENDIV' # Arduino-SDI-12_ID1486, Arduino-SDI-12\src\SDI12_boards.cpp:171:9: error: 'REG_GCLK_GENDIV' # -lib_ignore = ${common.lib_ignore}, SoftwareSerial_ExtInts, AltSoftSerial, SensorModbusMaster_ID1824, NeoSWSerial +lib_ignore = ${common.lib_cmn_ignore}, SoftwareSerial_ExtInts, AltSoftSerial, SensorModbusMaster_ID1824, NeoSWSerial src_filter = ${common.cmn_src_filter} -lib_deps = ${common.lib_deps} +lib_deps = ${common.lib_cmn_deps} ${common.lib_featherExpress_deps} ${common.lib_samd51_deps} @@ -149,7 +156,7 @@ platform = atmelavr framework = arduino lib_ldf_mode = deep+ ; AVR boards need to ignore RTCZero, it's for SAMD only and will not compile for AVR -lib_ignore = ${common.lib_ignore}, RTCZero +lib_ignore = ${common.lib_cmn_ignore}, RTCZero src_filter = ${common.cmn_src_filter} ;****build_flags options @@ -161,7 +168,7 @@ build_flags = -DNEOSWSERIAL_EXTERNAL_PCINT ;-DTINY_GSM_DEBUG=Serial -lib_deps = ${common.lib_deps} ${common.lib_avr_deps} +lib_deps = ${common.lib_cmn_deps} ${common.lib_avr_deps} https://github.com/PaulStoffregen/AltSoftSerial.git https://github.com/EnviroDIY/SoftwaterSerial_ExternalInts.git https://github.com/SRGDamia1/NeoSWSerial.git @@ -190,7 +197,7 @@ lib_ldf_mode = deep+ ;upload_protocol = sam-ba ; SWD interface ;upload_protocol = blackmagic -lib_ignore = ${common.lib_ignore}, SoftwareSerial_ExtInts, AltSoftSerial +lib_ignore = ${common.lib_cmn_ignore}, SoftwareSerial_ExtInts, AltSoftSerial src_filter = ${common.cmn_src_filter} ;-DLoggerBase_DBG -DLoggerModem_DBG -DProcessorStats_DBG -DDEBUGGING_SERIAL_OUTPUT=Serial @@ -205,9 +212,9 @@ build_flags = -DSTANDARD_SERIAL_OUTPUT=Serial -DDEBUGGING_SERIAL_OUTPUT=Serial -DDEEP_DEBUGGING_SERIAL_OUTPUT=Serial - -DUSE_RTCLIB=RTC_DS3231 + ;-DUSE_RTCLIB=RTC_DS3231 ;Not on Sodaq SAMD21 board -lib_deps = ${common.lib_deps} ${common.lib_samd_deps} ${common.lib_samd21_deps} +lib_deps = ${common.lib_cmn_deps} ${common.lib_samd_deps} ${common.lib_samd21_deps} ;; EnviroDIY_ModularSensors ;; ^^ Use this when working from an official release of the library ;https://github.com/neilh10/ModularSensors#rel1_dvlp1m @@ -224,10 +231,10 @@ framework = arduino lib_ldf_mode = deep++ ; NeoSWSerial ; SAMD boards need RTCZero for the real time clock and sleeping -lib_deps = ${common.lib_deps} ${common.lib_samd21_deps} +lib_deps = ${common.lib_cmn_deps} ${common.lib_samd21_deps} ; Most of the software serial libraries won't compile. Use the SERCOM's; they're better anyway -lib_ignore = ${common.lib_ignore} +lib_ignore = ${common.lib_cmn_ignore} SoftwareSerial_ExtInts AltSoftSerial NeoSWSerial diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 76bf01c68..82aed1865 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -48,7 +48,8 @@ // Bring in the library to communicate with an external high-precision real time // clock This also implements a needed date/time class #if defined(ARDUINO_ARCH_SAMD) -#include //was +// intRtcPhy ?? and fut extRtcPhy RTClib? +//#include //conflict DateTime was #elif defined(ARDUINO_ARCH_AVR) || defined(__AVR__) #include #endif From 05ff90dbe51de0874e022b47d3bbbd4c1a4628e7 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Mon, 18 Apr 2022 09:44:11 -0700 Subject: [PATCH 86/94] Change MS_DBG for getBatteryVoltageProc() --- a/tu_xx01/src/tu_xx01.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index c91859cde..3fa8bf4aa 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -696,17 +696,19 @@ Variable* pLionBatExt_var = // Read's the battery voltage // NOTE: This will actually return the battery level from the previous update! float getBatteryVoltageProc() { - float bat_lowest_v, - bat_latest_v; + float bat_lowest_v, bat_now_v; + bat_now_v = mcuBoardPhy.readSensorVbat(); #define BATTERY_VOLTAGE_OPT PROCESSOR_VBATLOW_VAR_NUM if (mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT] == PS_SENSOR_INVALID) {mcuBoardPhy.update();} //Loook for lowest battery voltage bat_lowest_v = mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT]; - bat_latest_v = mcuBoardPhy.readSensorVbat(); - if (bat_lowest_v > bat_latest_v) { - bat_lowest_v = bat_latest_v; + + if (bat_lowest_v > bat_now_v) { + MS_DBG("Vbat_low now/prev",bat_now_v,bat_lowest_v); + bat_lowest_v = bat_now_v; + } else { + MS_DBG("Vbat_low prev/new",bat_lowest_v,bat_now_v); } - MS_DBG("Vbat_low",bat_lowest_v); return bat_lowest_v; } #define bms_SetBattery() bms.setBatteryV(getBatteryVoltageProc()); From bbae5a962fe442cf8abfeb0037ce1cd3df67cee3 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Wed, 27 Apr 2022 19:18:56 -0700 Subject: [PATCH 87/94] Mayfly1.1 text --- a/tu_xx01/src/tu_xx01.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index 3fa8bf4aa..c56ed8477 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -1341,7 +1341,7 @@ void setup() { Serial.println(F(" Board: Found Mayfly 0.5b")); mcuBoardPhy.setVersion(mcuBoardVersion_0_5); } else { - PRINTOUT( F(" Board: Assume Mayfly 1.0A3 ") ); + PRINTOUT( F(" Board: Assume Mayfly 1.1A ") ); } // set up for escape out of battery check if too low. From 701e05a29e825d29b92fc4ef6398117e048c4520 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Thu, 28 Apr 2022 08:45:30 -0700 Subject: [PATCH 88/94] revert to updated AOSongAM2315.xx --- a/tu_xx01/src/tu_xx01.cpp | 12 +- src/sensors/AOSongAM2315a.cpp | 83 --------- src/sensors/AOSongAM2315a.h | 322 ---------------------------------- 3 files changed, 6 insertions(+), 411 deletions(-) delete mode 100644 src/sensors/AOSongAM2315a.cpp delete mode 100644 src/sensors/AOSongAM2315a.h diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index c56ed8477..e419e7e93 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -464,7 +464,7 @@ KellerNanolevel nanolevel_snsr(nanolevelModbusAddress, modbusSerial, // ========================================================================== //use updated solving https://github.com/neilh10/ModularSensors/issues/102 /** Start [ao_song_am2315] */ -#include +#include // const int8_t I2CPower = 1;//sensorPowerPin; // Pin to switch power on and // off (-1 if unconnected) @@ -472,12 +472,12 @@ KellerNanolevel nanolevel_snsr(nanolevelModbusAddress, modbusSerial, // Create an AOSong AM2315 sensor object // Data sheets says AM2315 and AM2320 have same address 0xB8 (8bit addr) of 1011 // 1000 or 7bit 0x5c=0101 1100 AM2320 AM2315 address 0x5C -AOSongAM2315a am23xx(I2CPower); +AOSongAM2315 am23xx(I2CPower); // Create humidity and temperature variable pointers for the AM2315 -// Variable *am2315Humid = new AOSongAM2315a_Humidity(&am23xx, +// Variable *am2315Humid = new AOSongAM2315_Humidity(&am23xx, // "12345678-abcd-1234-ef00-1234567890ab"); Variable *am2315Temp = new -// AOSongAM2315a_Temp(&am23xx, "12345678-abcd-1234-ef00-1234567890ab"); +// AOSongAM2315_Temp(&am23xx, "12345678-abcd-1234-ef00-1234567890ab"); /** End [ao_song_am2315] */ #endif // ASONG_AM23XX_UUID @@ -885,8 +885,8 @@ Variable* variableList[] = { // ASONG_AM23_Air_TemperatureF_UUID #elif defined ASONG_AM23XX_UUID - new AOSongAM2315a_Humidity(&am23xx, ASONG_AM23_Air_Humidity_UUID), - new AOSongAM2315a_Temp(&am23xx, ASONG_AM23_Air_Temperature_UUID), + new AOSongAM2315_Humidity(&am23xx, ASONG_AM23_Air_Humidity_UUID), + new AOSongAM2315_Temp(&am23xx, ASONG_AM23_Air_Temperature_UUID), // ASONG_AM23_Air_TemperatureF_UUID // calcAM2315_TempF #endif // ASONG_AM23XX_UUID diff --git a/src/sensors/AOSongAM2315a.cpp b/src/sensors/AOSongAM2315a.cpp deleted file mode 100644 index e9aeed79e..000000000 --- a/src/sensors/AOSongAM2315a.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/** - * @file AOSongAM2315a.cpp - * @copyright 2020 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino - * @author Sara Geleskie Damiano - * - * @brief Implements the AOSongAM2315a class. - */ - -#include "AOSongAM2315a.h" - - -// The constructor - because this is I2C, only need the power pin -// This sensor has a set I2C address of 0XB8 -AOSongAM2315a::AOSongAM2315a(TwoWire* theI2C, int8_t powerPin, - uint8_t measurementsToAverage) - : Sensor("AOSongAM2315a", AM2315_NUM_VARIABLES, AM2315_WARM_UP_TIME_MS, - AM2315_STABILIZATION_TIME_MS, AM2315_MEASUREMENT_TIME_MS, powerPin, - -1, measurementsToAverage) { - _i2c = theI2C; - am2315ptr = new Adafruit_AM2315(_i2c); -} -AOSongAM2315a::AOSongAM2315a(int8_t powerPin, uint8_t measurementsToAverage) - : Sensor("AOSongAM2315a", AM2315_NUM_VARIABLES, AM2315_WARM_UP_TIME_MS, - AM2315_STABILIZATION_TIME_MS, AM2315_MEASUREMENT_TIME_MS, powerPin, - -1, measurementsToAverage, AM2315_INC_CALC_VARIABLES) { - _i2c = &Wire; - am2315ptr = new Adafruit_AM2315(_i2c); -} -AOSongAM2315a::~AOSongAM2315a() {} - - -String AOSongAM2315a::getSensorLocation(void) { - return F("I2C_0xB8"); -} - - -bool AOSongAM2315a::setup(void) { - Wire.begin(); // Start the wire library (sensor power not required) - // Eliminate any potential extra waits in the wire library - // These waits would be caused by a readBytes or parseX being called - // on wire after the Wire buffer has emptied. The default stream - // functions - used by wire - wait a timeout period after reading the - // end of the buffer to see if an interrupt puts something into the - // buffer. In the case of the Wire library, that will never happen and - // the timeout period is a useless delay. - Wire.setTimeout(0); - return Sensor::setup(); // this will set pin modes and the setup status bit -} - - -bool AOSongAM2315a::addSingleMeasurementResult(void) { - // Initialize float variables - float temp_val = -9999; - float humid_val = -9999; - bool ret_val = 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)) { - MS_DBG(getSensorNameAndLocation(), F("is reporting:")); - - ret_val = am2315ptr->readTemperatureAndHumidity(&temp_val, &humid_val); - - if (!ret_val || isnan(temp_val)) temp_val = -9999; - if (!ret_val || isnan(humid_val)) humid_val = -9999; - - MS_DBG(F(" Temp:"), temp_val, F("°C")); - MS_DBG(F(" Humidity:"), humid_val, '%'); - } else { - MS_DBG(getSensorNameAndLocation(), F("is not currently measuring!")); - } - - verifyAndAddMeasurementResult(AM2315_TEMP_VAR_NUM, temp_val); - verifyAndAddMeasurementResult(AM2315_HUMIDITY_VAR_NUM, humid_val); - - // 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 ret_val; -} diff --git a/src/sensors/AOSongAM2315a.h b/src/sensors/AOSongAM2315a.h deleted file mode 100644 index 7902a4cff..000000000 --- a/src/sensors/AOSongAM2315a.h +++ /dev/null @@ -1,322 +0,0 @@ -/** - * @file AOSongAM2315a.h - * @copyright 2020 Stroud Water Research Center - * Part of the EnviroDIY ModularSensors library for Arduino - * @author Sara Geleskie Damiano - * - * @brief Contains the AOSongAM2315 sensor subclass and the variable subclasses - * AOSongAM2315_Humidity and AOSongAM2315_Temp. - * - * These are used for the AOSong AM2315 capacitive humidity and temperature - * sensor. - * - * This file is dependent on the Adafruit AM2315 Library. - */ -/* clang-format off */ -/** - * @defgroup sensor_am2315 AOSong AM2315 - * Classes for the AOSong AM2315 encased I2C capacitive humidity and - * temperature sensor. - * - * @ingroup the_sensors - * - * @tableofcontents - * @m_footernavigation - * - * @section sensor_am2315_notes Quick Notes - * - Applies to both the AOSong AM2315 and CM2311 capacitive relative humidity - * and temperature sensors - * - Depends on the [Adafruit AM2315 Library](https://github.com/adafruit/Adafruit_AM2315). - * - Communicates via I2C - * - only one address possible, 0xB8 - * - **Only 1 can be connected to a single I2C bus at a time** - * - Requires a 3.3 - 5.5V power source - * - * @note Software I2C is *not* supported for the AM2315. - * A secondary hardware I2C on a SAMD board is supported. - * - * @section sensor_am2315_datasheet Sensor Datasheet - * [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Sensor-Datasheets/AOSong-AM2315-Product-Manual.pdf) - * - * @section sensor_am2315_ctor Sensor Constructors - * {{ @ref AOSongAM2315::AOSongAM2315(int8_t, uint8_t) }} - * {{ @ref AOSongAM2315::AOSongAM2315(TwoWire*, int8_t, uint8_t) }} - * - * @section sensor_am2315_examples Example Code - * - * The AM2315 is used in the [double logger](@ref double_logger.ino) - * and @menulink{am2315} example - * - * @menusnip{am2315} - */ -/* clang-format on */ - -// Header Guards -#ifndef SRC_SENSORS_AOSONGAM2315A_H_ -#define SRC_SENSORS_AOSONGAM2315A_H_ - -// Debugging Statement -// #define MS_AOSONGAM2315A_DEBUG - -#ifdef MS_AOSONGAM2315A_DEBUG -#define MS_DEBUGGING_STD "AOSongAM2315a" -#endif - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "VariableBase.h" -#include "SensorBase.h" -#include - -// Sensor Specific Defines -/** @ingroup sensor_am2315 */ -/**@{*/ - -/// @brief Sensor::_numReturnedValues; the AM2315 can report 2 values. -#define AM2315_NUM_VARIABLES 2 -/// @brief Sensor::_incCalcValues; we don't calculate any additional values. -#define AM2315_INC_CALC_VARIABLES 0 - -/** - * @anchor sensor_am2315_timing - * @name Sensor Timing - * The sensor timing for an AOSong AM2315 - */ -/**@{*/ -/// @brief Sensor::_warmUpTime_ms; AM2315 warms up in 500ms (estimated). -#define AM2315_WARM_UP_TIME_MS 500 -/// @brief Sensor::_stabilizationTime_ms; AM2315 is stable after 500ms -/// (estimated). -#define AM2315_STABILIZATION_TIME_MS 500 -/// @brief Sensor::_measurementTime_ms; AM2315 takes 2000ms (2s) to complete a -/// measurement. -#define AM2315_MEASUREMENT_TIME_MS 2000 -/**@}*/ - -/** - * @anchor sensor_am2315_humidity - * @name Humidity - * The humidity variable from an AOSong AM2315 - * - Range is 0 to 100% RH - * - Accuracy is ± 2 % RH at 25°C - * - * {{ @ref AOSongAM2315a_Humidity::AOSongAM2315a_Humidity }} - */ -/**@{*/ -/// @brief Decimals places in string representation; humidity should have 1 (0.1 -/// % RH for the 16 bit sensor). -#define AM2315_HUMIDITY_RESOLUTION 1 -/// @brief Sensor variable number; humidity is stored in sensorValues[0]. -#define AM2315_HUMIDITY_VAR_NUM 0 -/// @brief Variable name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); -/// "relativeHumidity" -#define AM2315_HUMIDITY_VAR_NAME "relativeHumidity" -/// @brief Variable unit name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); "percent" -/// (percent relative humidity) -#define AM2315_HUMIDITY_UNIT_NAME "percent" -/// @brief Default variable short code; "AM2315Humidity" -#define AM2315_HUMIDITY_DEFAULT_CODE "AM2315Humidity" -/**@}*/ - -/** - * @anchor sensor_am2315_temperature - * @name Temperature - * The temperature variable from an AOSong AM2315 - * - Range is -40°C to +125°C - * - Accuracy is ±0.1°C - * - * {{ @ref AOSongAM2315a_Temp::AOSongAM2315a_Temp }} - */ -/**@{*/ -/// @brief Decimals places in string representation; temperature should have 1. -/// (0.1°C for the 16 bit sensor) -#define AM2315_TEMP_RESOLUTION 1 -/// @brief Sensor variable number; temperature is stored in sensorValues[1]. -#define AM2315_TEMP_VAR_NUM 1 -/// @brief Variable name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); -/// "temperature" -#define AM2315_TEMP_VAR_NAME "temperature" -/// @brief Variable unit name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); -/// "degreeCelsius" (°C) -#define AM2315_TEMP_UNIT_NAME "degreeCelsius" -/// @brief Default variable short code; "AM2315Temp" -#define AM2315_TEMP_DEFAULT_CODE "AM2315Temp" -/**@}*/ - - -/* clang-format off */ -/** - * @brief The Sensor sub-class for the [AOSong AM2315](@ref sensor_am2315). - */ -/* clang-format on */ -class AOSongAM2315a : public Sensor { - public: - /** - * @brief Construct a new AOSongAM2315a object using a secondary *hardware* - * I2C instance. - * - * This is only applicable to SAMD boards that are able to have multiple - * hardware I2C ports in use via SERCOMs. - * - * @note It is only possible to connect *one* AM2315 at a time on a single - * I2C bus. - * - * @param theI2C A TwoWire instance for I2C communication. Due to the - * limitations of the Arduino core, only a hardware I2C instance can be - * used. For an AVR board, there is only one I2C instance possible and this - * form of the constructor should not be used. For a SAMD board, this can - * be used if a secondary I2C port is created on one of the extra SERCOMs. - * @param powerPin The pin on the mcu controlling power to the AOSong - * AM2315. Use -1 if it is continuously powered. - * - The AM2315 requires a 3.3 - 5.5V power source - * @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. - */ - AOSongAM2315a(TwoWire* theI2C, int8_t powerPin, - uint8_t measurementsToAverage = 1); - /** - * @brief Construct a new AOSongAM2315a object using the primary hardware I2C - * instance. - * - * Because this is I2C and has only 1 possible address (0xB8), we only need - * the power pin. - * - * @note It is only possible to connect *one* AM2315 at a time on a single - * I2C bus. - * - * @param powerPin The pin on the mcu controlling power to the AOSong - * AM2315. Use -1 if it is continuously powered. - * - The AM2315 requires a 3.3 - 5.5V power source - * @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. - */ - explicit AOSongAM2315a(int8_t powerPin, uint8_t measurementsToAverage = 1); - /** - * @brief Destroy the AOSongAM2315a object - no action needed. - */ - ~AOSongAM2315a(); - - /** - * @brief Report the I2C address of the AM2315 - which is always 0xB8. - * - * @return **String** Text describing how the sensor is attached to the mcu. - */ - String getSensorLocation(void) override; - - /** - * @brief Do any one-time preparations needed before the sensor will be able - * to take readings. - * - * This sets the #_powerPin mode, begins the Wire library (sets pin levels - * and modes for I2C), and updates the #_sensorStatus. No sensor power is - * required. - * - * @return **bool** True if the setup was successful. For the AOSong AM2315 - * the result will always be true. - */ - bool setup(void) override; - - /** - * @copydoc Sensor::addSingleMeasurementResult() - */ - bool addSingleMeasurementResult(void) override; - - private: - /** - * @brief An internal reference to the hardware Wire instance. - */ - TwoWire* _i2c; - Adafruit_AM2315 *am2315ptr; // create a sensor object -}; - - -/* clang-format off */ -/** - * @brief The Variable sub-class used for the - * [relative humidity output](@ref sensor_am2315_humidity) from an - * [AOSong AM2315](@ref sensor_am2315). - */ -/* clang-format on */ -class AOSongAM2315a_Humidity : public Variable { - public: - /** - * @brief Construct a new AOSongAM2315a_Humidity object. - * - * @param parentSense The parent AOSongAM2315a 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 "AM2315Humidity". - */ - explicit AOSongAM2315a_Humidity( - AOSongAM2315a* parentSense, const char* uuid = "", - const char* varCode = AM2315_HUMIDITY_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)AM2315_HUMIDITY_VAR_NUM, - (uint8_t)AM2315_HUMIDITY_RESOLUTION, - AM2315_HUMIDITY_VAR_NAME, AM2315_HUMIDITY_UNIT_NAME, varCode, - uuid) {} - /** - * @brief Construct a new AOSongAM2315a_Humidity object. - * - * @note This must be tied with a parent AOSongAM2315a before it can be used. - */ - AOSongAM2315a_Humidity() - : Variable((const uint8_t)AM2315_HUMIDITY_VAR_NUM, - (uint8_t)AM2315_HUMIDITY_RESOLUTION, - AM2315_HUMIDITY_VAR_NAME, AM2315_HUMIDITY_UNIT_NAME, - AM2315_HUMIDITY_DEFAULT_CODE) {} - /** - * @brief Destroy the AOSongAM2315a_Humidity object - no action needed. - */ - ~AOSongAM2315a_Humidity() {} -}; - - -/* clang-format off */ -/** - * @brief The Variable sub-class used for the - * [temperature output](@ref sensor_am2315_temperature) from an - * [AOSong AM2315](@ref sensor_am2315). - */ -/* clang-format on */ -class AOSongAM2315a_Temp : public Variable { - public: - /** - * @brief Construct a new AOSongAM2315a_Temp object. - * - * @param parentSense The parent AOSongAM2315a 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 "AM2315Temp". - */ - explicit AOSongAM2315a_Temp(AOSongAM2315a* parentSense, const char* uuid = "", - const char* varCode = AM2315_TEMP_DEFAULT_CODE) - : Variable(parentSense, (const uint8_t)AM2315_TEMP_VAR_NUM, - (uint8_t)AM2315_TEMP_RESOLUTION, AM2315_TEMP_VAR_NAME, - AM2315_TEMP_UNIT_NAME, varCode, uuid) {} - /** - * @brief Construct a new AOSongAM2315a_Temp object. - * - * @note This must be tied with a parent AOSongAM2315a before it can be used. - */ - AOSongAM2315a_Temp() - : Variable((const uint8_t)AM2315_TEMP_VAR_NUM, - (uint8_t)AM2315_TEMP_RESOLUTION, AM2315_TEMP_VAR_NAME, - AM2315_TEMP_UNIT_NAME, AM2315_TEMP_DEFAULT_CODE) {} - /** - * @brief Destroy the AOSongAM2315a_Temp object - no action needed. - */ - ~AOSongAM2315a_Temp() {} -}; -/**@}*/ -#endif // SRC_SENSORS_AOSONGAM2315A_H_ From 67b4ffb0b0ef2c0460f604dc43c434000f5d9eb9 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Thu, 28 Apr 2022 16:29:51 -0700 Subject: [PATCH 89/94] 110 - make battery voltage filtereing local --- a/tu_xx01/src/tu_xx01.cpp | 62 +++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index e419e7e93..cf2d2167a 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -685,6 +685,21 @@ Variable* pLionBatExt_var = ExternalVoltage_Volt0_UUID); #endif // ExternalVoltage_Volt0_UUID +// Measuring the battery voltage can be from a number of sources +// Battery Filtering measurement in V +// Vbat from A6 noise filtering ~ bfv +// Mayfly 0.5-1.1 has a noisy battery measurement that uses +// a sliding window filtering technique to measure the lowest +// battery voltage over a number of samples. + +float bat_filtered_v; +/// @brief Variable for software noise filtering window size +#define BFV_VBATLOW_WINDOW_SZ 6 +float bfv_sliding[BFV_VBATLOW_WINDOW_SZ ]; + +bool bfv_Init=false; //Has it been initialized +uint8_t bfv_idx=0; + #if defined MAYFLY_BAT_CHOICE #if MAYFLY_BAT_CHOICE == MAYFLY_BAT_STC3100 #define bms_SetBattery() bms.setBatteryV(wLionBatStc3100_worker()); @@ -696,20 +711,43 @@ Variable* pLionBatExt_var = // Read's the battery voltage // NOTE: This will actually return the battery level from the previous update! float getBatteryVoltageProc() { - float bat_lowest_v, bat_now_v; + float bat_now_v, bfv_lowest; + uint8_t bfv_lp; bat_now_v = mcuBoardPhy.readSensorVbat(); - #define BATTERY_VOLTAGE_OPT PROCESSOR_VBATLOW_VAR_NUM - if (mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT] == PS_SENSOR_INVALID) {mcuBoardPhy.update();} - //Loook for lowest battery voltage - bat_lowest_v = mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT]; - - if (bat_lowest_v > bat_now_v) { - MS_DBG("Vbat_low now/prev",bat_now_v,bat_lowest_v); - bat_lowest_v = bat_now_v; + bfv_lowest= bat_now_v; + + if (bfv_Init) { + //Insert the latest reading into the next slot + bfv_sliding[bfv_idx]=bat_now_v; + MS_DBG(F("Vbatlow update:"),bfv_idx, bfv_lowest); + if (++bfv_idx >= BFV_VBATLOW_WINDOW_SZ) { + //MS_DEEP_DBG(F("Vbatlow idx rst"),bfv_idx); + bfv_idx=0; + } + //Check all slots and find the lowest reading + for (bfv_lp=0;bfv_lpbfv_sliding[bfv_lp]) { + bfv_lowest=bfv_sliding[bfv_lp]; + MS_DBG(F("Vbatlow i:"),bfv_lp, bfv_lowest); + } else { + //MS_DBG(F("Vbatlow i="),bfv_lp); + } + } + } else { + for (bfv_lp=0;bfv_lp bat_now_v) { + MS_DBG("Vbat_low now/prev",bat_now_v,bat_filtered_v); + bat_filtered_v = bat_now_v; } else { - MS_DBG("Vbat_low prev/new",bat_lowest_v,bat_now_v); + MS_DBG("Vbat_low prev/new",bat_filtered_v,bat_now_v); } - return bat_lowest_v; + return bat_filtered_v; } #define bms_SetBattery() bms.setBatteryV(getBatteryVoltageProc()); #endif //MAYFLY_BAT_A6 @@ -1219,7 +1257,7 @@ bool batteryCheck(bm_pwr_req_t useable_req, bool waitForGoodBattery,uint8_t dbg_ #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_AA0 PRINTOUT(F("Bat_V(Ext) tbd")); #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_A6 - PRINTOUT(F("Bat_V(low)"),mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT]); + PRINTOUT(F("Bat_V(low)"),bat_filtered_v); #else //alt Read the V - FUT make compatible adcRead() PRINTOUT(F("Bat_V(undef)")); #endif // From 2b7c414e0f2dc9294908bff6aca436b9c4747f39 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Thu, 28 Apr 2022 17:10:44 -0700 Subject: [PATCH 90/94] 110 - back out ProcessorStats Vbat filter sensor_processor_vbatlow --- src/sensors/ProcessorStats.cpp | 31 +------------ src/sensors/ProcessorStats.h | 85 +--------------------------------- 2 files changed, 2 insertions(+), 114 deletions(-) diff --git a/src/sensors/ProcessorStats.cpp b/src/sensors/ProcessorStats.cpp index 9ed1d8a3e..cf389b8c1 100644 --- a/src/sensors/ProcessorStats.cpp +++ b/src/sensors/ProcessorStats.cpp @@ -106,7 +106,6 @@ ProcessorStats::ProcessorStats(const char* version) _version = version; sampNum = 0; - #if defined(ARDUINO_AVR_ENVIRODIY_MAYFLY) || defined(ARDUINO_AVR_SODAQ_MBILI) _batteryPin = A6; #elif defined(ARDUINO_AVR_FEATHER32U4) || defined(ARDUINO_SAMD_FEATHER_M0) || \ @@ -193,34 +192,6 @@ bool ProcessorStats::addSingleMeasurementResult(void) { verifyAndAddMeasurementResult(PROCESSOR_SAMPNUM_VAR_NUM, sampNum); - // Create a sliding window of sensorValue_battery samples - //and use the lowest value. - uint8_t svb_lp=0; - float svb_lowest=sensorValue_battery; - if (svbInit) { - //Insert the latest reading into the next slot - svb_sliding[svb_idx]=sensorValue_battery; - if (++svb_idx >= PROCESSOR_VBATLOW_WINDOW_SZ) { - //MS_DEEP_DBG(F("Vbatlow idx rst"),svb_idx); - svb_idx=0; - } - //Check all slots and find the lowest reading - for (svb_lp=0;svb_lpsvb_sliding[svb_lp]) { - svb_lowest=svb_sliding[svb_lp]; - MS_DEEP_DBG(F("Vbatlow i:"),svb_lp, svb_lowest); - } - } - } else { - for (svb_lp=0;svb_lp Date: Wed, 4 May 2022 17:12:12 -0700 Subject: [PATCH 91/94] Making work with Mayfly1.1 LTE and using onboard Vbat - https://github.com/neilh10/ModularSensors/issues/112 https://github.com/neilh10/ModularSensors/issues/110 --- a/tu_xx01/platformio.ini | 2 +- a/tu_xx01/src/ms_cfg.h | 10 +- a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless | 10 +- a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless_M05 | 291 ++++++++++++++++++ a/tu_xx01/src/tu_xx01.cpp | 38 ++- 5 files changed, 332 insertions(+), 19 deletions(-) create mode 100644 a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless_M05 diff --git a/a/tu_xx01/platformio.ini b/a/tu_xx01/platformio.ini index aa62f361b..2e7d89041 100644 --- a/a/tu_xx01/platformio.ini +++ b/a/tu_xx01/platformio.ini @@ -161,7 +161,7 @@ cmn_build_flags = -DMS_WATCHDOGAVR_DEBUG_DEEP [env:mayfly] -upload_port = COM11 +;upload_port = COM11 monitor_speed = 115200 board = mayfly platform = atmelavr diff --git a/a/tu_xx01/src/ms_cfg.h b/a/tu_xx01/src/ms_cfg.h index 25f45c777..46b40308f 100644 --- a/a/tu_xx01/src/ms_cfg.h +++ b/a/tu_xx01/src/ms_cfg.h @@ -71,7 +71,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery // Digi WiFi S6 plugged in directly // For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" +//#define MFVersion_DEF "v0.5b" #define MFName_DEF "Mayfly" #define HwVersion_DEF MFVersion_DEF #define HwName_DEF MFName_DEF @@ -238,7 +238,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined SENSIRION_SHT4X_UUID #define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" -#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +//#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" #elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" @@ -254,7 +254,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined UseModem_Module // This seems to be de-stabilizing Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" //#define Modem_SignalPercent_UUID "SignalPercent_UUID" #endif // UseModem_Module @@ -268,8 +268,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined MAYFLY_BAT_STC3100 #define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" +//#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" +//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" #endif // MAYFLY_BAT_STC3100 #ifdef MAYFLY_BAT_AA0 diff --git a/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless index 25f45c777..46b40308f 100644 --- a/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless +++ b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless @@ -71,7 +71,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery // Digi WiFi S6 plugged in directly // For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" +//#define MFVersion_DEF "v0.5b" #define MFName_DEF "Mayfly" #define HwVersion_DEF MFVersion_DEF #define HwName_DEF MFName_DEF @@ -238,7 +238,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined SENSIRION_SHT4X_UUID #define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" -#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +//#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" #elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" @@ -254,7 +254,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined UseModem_Module // This seems to be de-stabilizing Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" //#define Modem_SignalPercent_UUID "SignalPercent_UUID" #endif // UseModem_Module @@ -268,8 +268,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined MAYFLY_BAT_STC3100 #define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" +//#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" +//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" #endif // MAYFLY_BAT_STC3100 #ifdef MAYFLY_BAT_AA0 diff --git a/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless_M05 b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless_M05 new file mode 100644 index 000000000..25f45c777 --- /dev/null +++ b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless_M05 @@ -0,0 +1,291 @@ +/***************************************************************************** +ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi +Status 220410: 0.33.1.aaa +Written By: Neil Hancock www.envirodiy.org/members/neilh20/ +Development Environment: PlatformIO +Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard + +Software License: BSD-3. + Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water +Research Center (SWRC) and they may change this title to Stroud Water Research +Center as required and the EnviroDIY Development Team + + +DISCLAIMER: +THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. +*****************************************************************************/ +#ifndef ms_cfg_h +#define ms_cfg_h +#include // The base Arduino library +// Local default defitions here + +//************************************************************************** +// This configuration is for a standard Mayfly0.5b +// Sensors Used - two std to begin then +//#define AnalogProcEC_ACT 1 +// Power Availability monitoring decisions use LiIon Voltge, +// Battery Voltage measurements can be derived from a number of sources +// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated +// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 +// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 +// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement +// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 +#define MAYFLY_BAT_A6 4 +//#define MAYFLY_BAT_AA0 2 +//FUT #define MAYFLY_BAT_DIGI 3 + + +//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 +//#define Decagon_CTD_UUID 1 +//For Insitu_Troll specify one or none +//#define Insitu_TrollSdi12_UUID 1 +#define Insitu_TrollModbus_UUID 1 + +#define WINGBOARD_KNH002 1 +#if defined WINGBOARD_KNH002 +//This supports RS485 1.9W and STC3100 +//#define USE_STC3100_DD 1 +#define MAYFLY_BAT_STC3100 1 +// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR +//#define KellerAcculevel_ACT 1 +// KellerAcculevel units can be 1 (meter) 2 (feet) +//#define KellerAcculevel_DepthUnits 2 + +//#define KellerNanolevel_ACT 1 +#endif //WINGBOARD_KNH002 + +//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis +#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 +//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 +//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 +// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI + +//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x +#define SENSIRION_SHT4X_UUID +//#define ASONG_AM23XX_UUID 1 + +//Two heavy sensors with power useage +#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ + +// Mayfly configuration +// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery +// Digi WiFi S6 plugged in directly +// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, +#define MFVersion_DEF "v0.5b" +#define MFName_DEF "Mayfly" +#define HwVersion_DEF MFVersion_DEF +#define HwName_DEF MFName_DEF +#define CONFIGURATION_DESCRIPTION_STR "LT500/Modbus Digi WiFi S6/LTE XB3-C-A2 MMW" + +#define USE_MS_SD_INI 1 +#define USE_PS_EEPROM 1 +#define USE_PS_HW_BOOT 1 + +//#define USE_PS_modularSensorsCommon 1 + +#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) +#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) + +#define sensorPowerPin_DEF 22 +#define modemSleepRqPin_DEF 23 +#define modemStatusPin_DEF \ + 19 // MCU pin used to read modem status (-1 if not applicable) +#define modemResetPin_DEF \ + 20 // MCU pin connected to modem reset pin (-1 if unconnected) + +#define LOGGERID_DEF_STR "msLog01" +#define NEW_LOGGERID_MAX_SIZE 40 +#define configIniID_DEF_STR "ms_cfg.ini" +#define CONFIG_TIME_ZONE_DEF -8 + +// ** How frequently (in minutes) to log data ** +// For two Loggers defined logger2Mult with the faster loggers timeout and the +// multiplier to the slower loggger +// #define loggingInterval_Fast_MIN (1) +// #define logger2Mult 5 ~Not working for mayfly + +// How frequently (in minutes) to log data +#if defined logger2Mult +#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) +#else +#define loggingInterval_CDEF_MIN 15 +#endif // logger2Mult +// Maximum logging setting allowed +#define loggingInterval_MAX_CDEF_MIN 6 * 60 + +// Maximum logging setting allowed +#define loggingInterval_MAX_CDEF_MIN 6 * 60 + + +// Supports DigiXBeeCellularTransparent & DigiXBeeWifi +#define UseModem_Module 1 +#if UseModem_Module +// The Modem is used to push data and also sync Time +// In standalong logger, no internet, Modem can be required at factor to do a +// sync Time Normally enable both of the following. In standalone, disable +// UseModem_PushData. +#define UseModem_PushData 1 +//Select buildtime Publishers supported. +// The persisten resources (EEPROM) are allocated as a baselevel no matter what options +#define USE_PUB_MMW 1 +//#define USE_PUB_TSMQTT 1 +//#define USE_PUB_UBIDOTS 1 + +// Required for TinyGsmClient.h +#define TINY_GSM_MODEM_XBEE + +// The APN for the gprs connection, unnecessary for WiFi +#define APN_CDEF "VZWINTERNET" + +// The WiFi access point never set to real, as should be set by config. +#define WIFIID_CDEF "WiFiIdDef" +// NULL for none, or password for connecting to WiFi, +#define WIFIPWD_CDEF "WiFiPwdDef" +#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L +//POST PACING ms 0-15000 +#define MMW_TIMER_POST_PACING_MS_DEF 100L +//Post MAX Num - is num of MAX num at one go. 0 no limit +//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h +//Manage Internet - common for all providers +#define MNGI_COLLECT_READINGS_DEF 1 +#define MNGI_SEND_OFFSET_MIN_DEF 0 +#endif // UseModem_Module + +// This might need revisiting +#define ARD_ANLAOG_MULTIPLEX_PIN A6 + +//#define SENSOR_CONFIG_GENERAL 1 +//#define KellerAcculevel_ACT 1 +// Defaults for data.envirodiy.org +#define registrationToken_UUID "registrationToken_UUID" +#define samplingFeature_UUID "samplingFeature_UUID" + + +#ifdef Decagon_CTD_UUID +// Mayfly definitions +#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" +#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" +#define CTD10_COND_UUID "CTD10_COND_UUID" +#endif // Decagon_CTD_UUID + + +#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID +// Mayfly definitions +#ifdef Insitu_TrollModbus_UUID +#define InsituLTrs485_ACT 1 +#ifdef InsituLTrs485_ACT +#define CONFIG_SENSOR_RS485_PHY 1 +#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" +#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" +#define InsituLTrs485ModbusAddress_DEF 0x01 +// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop +//#define MODBUS_BAUD_RATE 9600 +#define MODBUS_BAUD_RATE 19200 +//Default for AltsoftSerial is SERIAL_8N1 +//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 +#define MODBUS_SERIAL_CONFIG SERIAL_8E1 +#endif // InsituLTrs485_ACT +#elif defined Insitu_TrollSdi12_UUID +#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" +#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" +//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" +#endif // Insitu_TrollSdi12_UUID +#endif // Insitu_Trollxxx + + + +#ifdef KellerAcculevel_ACT +#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" +#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" +#define CONFIG_SENSOR_RS485_PHY 1 +#define KellerAcculevelModbusAddress_DEF 0x01 +#endif // KellerAcculevel_ACT + +#ifdef KellerNanolevel_ACT +#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" +#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" +#define CONFIG_SENSOR_RS485_PHY 1 +#define KellerNanolevelModbusAddress_DEF 0x01 +#endif // KellerNanolevel_ACT + +#ifdef CONFIG_SENSOR_RS485_PHY +// Mayfly definitions +#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin +#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin +#define CONFIG_HW_RS485PHY_DIR_PIN -1 +#define max485EnablePin_DEF -1 +#define rs485AdapterPower_DEF \ + 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) +#define modbusSensorPower_DEF \ + 22; // Pin to switch power on and off (-1 if unconnected) +#ifndef MODBUS_BAUD_RATE +#define MODBUS_BAUD_RATE 9600 +#endif // MODBUS_BAUD_RATE +#endif // CONFIG_SENSOR_RS485_PHY + + +#ifdef AnalogProcEC_ACT +#define EC1_UUID "EC1_UUID" +#define ECpwrPin_DEF A4 +#define ECdataPin1_DEF A0 +#endif // AnalogProcEC_ACT + +//#define INA219M_PHY_ACT 1 +#ifdef INA219M_PHY_ACT +#define INA219M_MA_UUID "INA219_MA_UUID" +#define INA219M_VOLT_UUID "INA219_VOLT_UUID" +#endif // INA219_PHY_ACT + +#if defined SENSIRION_SHT4X_UUID +#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" +#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" +#elif defined ASONG_AM23XX_UUID +#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" +#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" +#endif // ASONG_AM23XX_UUID + + +#ifdef ENVIRODIY_MAYFLY_TEMPERATURE +#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" +//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" +#endif // ENVIRODIY_MAYFLY_TEMPERATURE + +#if defined UseModem_Module +// This seems to be de-stabilizing Digi S6B +#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +//#define Modem_SignalPercent_UUID "SignalPercent_UUID" +#endif // UseModem_Module + +#define ProcessorStats_ACT 1 +#if defined ProcessorStats_ACT +#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" +#endif // ProcessorStats_ACT +#if defined MAYFLY_BAT_A6 +#define ProcessorStats_Batt_UUID "Batt_UUID" +#endif // MAYFLY_BAT_A6 + +#if defined MAYFLY_BAT_STC3100 +#define STC3100_Volt_UUID "STC3100Volt_UUID" +#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" +#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" +#endif // MAYFLY_BAT_STC3100 + +#ifdef MAYFLY_BAT_AA0 +// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 +//#define ExternalVoltage_Volt0_UUID "Batt_UUID" +#define ExternalVoltage_Volt0_UUID "Volt0_UUID" +//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" +//#else // MAYFLY_BAT_AA0 +#endif // MAYFLY_BAT_AA0 +#if 0// defined MAYFLY_BAT_A6 +#define ProcVolt_ACT 1 +#if defined ProcVolt_ACT +#define ProcVolt0_UUID "Batt_UUID" +//#define ProcVolt0_UUID "Volt0_UUID" +//#define ProcVolt1_UUID "Volt1_UUID" +#endif // ProcVolt_ACT +#endif // MAYFLY_BAT_A6 + +#endif // ms_cfg_h diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index cf2d2167a..21e12e476 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -196,7 +196,9 @@ StreamDebugger modemDebugger(modemSerial, STANDARD_SERIAL_OUTPUT); #endif // STREAMDEBUGGER_DBG // Modem Pins - Describe the physical pin connection of your modem to your board -const int8_t modemVccPin_mayfly_1_x = 18; //Pin18 on Xbee Mayfly v1.0, +#define MODEM_VCC_CE_PIN 18 +// Set the default for startup +const int8_t modemVccPin_mayfly_1_x = -2; //Pin18 on Xbee Mayfly v1.x, const int8_t modemVccPin_mayfly_0_5 = -2; //No power control rev 0.5b #define modemVccPin modemVccPin_mayfly_1_x @@ -738,14 +740,20 @@ float getBatteryVoltageProc() { bfv_sliding[bfv_lp]=bfv_lowest; } bfv_Init=true; - MS_DBG("Vbat_low init",BFV_VBATLOW_WINDOW_SZ, bat_now_v); + MS_DBG(F("Vbat_low init"),BFV_VBATLOW_WINDOW_SZ, bat_now_v); } bat_filtered_v = bfv_lowest; if (bat_filtered_v > bat_now_v) { - MS_DBG("Vbat_low now/prev",bat_now_v,bat_filtered_v); + Serial.print(F("Vbat_low now/prev ")); + Serial.print(bat_now_v,3); + Serial.print("/"); + Serial.println(bat_filtered_v,3); bat_filtered_v = bat_now_v; } else { - MS_DBG("Vbat_low prev/new",bat_filtered_v,bat_now_v); + Serial.print(F("Vbat_low prev/new ")); + Serial.print(bat_filtered_v,3); + Serial.print("/"); + Serial.println(bat_now_v,3); } return bat_filtered_v; } @@ -871,8 +879,7 @@ Variable* variableList[] = { pLionBatExt_var, #endif #if defined MAYFLY_BAT_A6 - //new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), - new ProcessorStats_Vbatlow(&mcuBoardPhy, ProcessorStats_Batt_UUID), + new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), #endif // MAYFLY_BAT_A6 #if defined AnalogProcEC_ACT // Do Analog processing measurements. @@ -1105,6 +1112,10 @@ void modbusPinPowerMng(bool status) { pinMode(pinNum, INPUT); \ digitalWrite(pinNum, HIGH); +#define PORT_LOW(pinNum) \ + pinMode(pinNum, OUTPUT); \ + digitalWrite(pinNum, LOW); + void unusedBitsMakeSafe() { // Set all unused Pins to a safe no current mode for sleeping // Mayfly variant.h: D0->23 (Analog0-7) or D24-31 @@ -1134,7 +1145,7 @@ void unusedBitsMakeSafe() { PORT_SAFE(21); // PORT_SAFE(22); //Pwr Sw #if defined UseModem_Module - PORT_HIGH(23); // Xbee DTR modemSleepRqPin HIGH for LTE SLEEP_REQ + PORT_LOW(23); // Xbee DTR modemSleepRqPin LOW until Modem takes over #else PORT_SAFE(23); #endif //UseModem_Module @@ -1379,7 +1390,18 @@ void setup() { Serial.println(F(" Board: Found Mayfly 0.5b")); mcuBoardPhy.setVersion(mcuBoardVersion_0_5); } else { - PRINTOUT( F(" Board: Assume Mayfly 1.1A ") ); + PRINTOUT( F(" Board: Assume Mayfly 1.1A ") ); + + #ifdef UseModem_Module + // For Mayfly1.x needs the Modem Turned on + // as of 0.33.1 LTE power up not handled well so do manual + if (0 > modemVccPin_mayfly_1_x) { + // Set up pins for the BEE_VCC_EN pwr ON HIGH- default LOW, R pulled LOW + // Must be turned on before any other pins connected to modem are taken high + pinMode(MODEM_VCC_CE_PIN , OUTPUT); + digitalWrite(MODEM_VCC_CE_PIN, HIGH); + } + #endif //seModem_Module } // set up for escape out of battery check if too low. From be2115642c5bba6dfc6523bef4c3b6896c3f312c Mon Sep 17 00:00:00 2001 From: neilh20 Date: Wed, 4 May 2022 17:28:36 -0700 Subject: [PATCH 92/94] Promote from a/tu_xx01 to examples/tu_xx01 --- a/tu_xx01/src/tu_xx01.cpp | 3 +- .../tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless | 20 ++- .../tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless | 10 +- examples/tu_xx01/src/tu_xx01.cpp | 138 +++++++++++++++--- 4 files changed, 142 insertions(+), 29 deletions(-) diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index 21e12e476..d3cbf0e42 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -711,7 +711,7 @@ uint8_t bfv_idx=0; #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_A6 #warning need to test mcuBoardPhy, interface // Read's the battery voltage -// NOTE: This will actually return the battery level from the previous update! +// NOTE: This returns the lowest battery level from previous running updates! float getBatteryVoltageProc() { float bat_now_v, bfv_lowest; uint8_t bfv_lp; @@ -879,6 +879,7 @@ Variable* variableList[] = { pLionBatExt_var, #endif #if defined MAYFLY_BAT_A6 + //FUT return the filtered vbat_low new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), #endif // MAYFLY_BAT_A6 #if defined AnalogProcEC_ACT diff --git a/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless b/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless index 2c4d36332..46b40308f 100644 --- a/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless +++ b/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless @@ -1,6 +1,6 @@ /***************************************************************************** -ms_cfg.h_LT5_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220320: 0.32.2rs485 +ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi +Status 220410: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -60,6 +60,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 // FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI +//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x +#define SENSIRION_SHT4X_UUID //#define ASONG_AM23XX_UUID 1 //Two heavy sensors with power useage @@ -69,7 +71,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery // Digi WiFi S6 plugged in directly // For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" +//#define MFVersion_DEF "v0.5b" #define MFName_DEF "Mayfly" #define HwVersion_DEF MFVersion_DEF #define HwName_DEF MFName_DEF @@ -234,7 +236,11 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define INA219M_VOLT_UUID "INA219_VOLT_UUID" #endif // INA219_PHY_ACT -#if defined ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" +//#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" +#elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" #define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" @@ -248,7 +254,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined UseModem_Module // This seems to be de-stabilizing Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" //#define Modem_SignalPercent_UUID "SignalPercent_UUID" #endif // UseModem_Module @@ -262,8 +268,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined MAYFLY_BAT_STC3100 #define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" +//#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" +//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" #endif // MAYFLY_BAT_STC3100 #ifdef MAYFLY_BAT_AA0 diff --git a/examples/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless b/examples/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless index c655117a4..f4986063c 100644 --- a/examples/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless +++ b/examples/tu_xx01/src/ms_cfg.h_LT5_SDI12_wireless @@ -1,6 +1,6 @@ /***************************************************************************** ms_cfg.h_LT5_SDI12_wireless - ModularSensors Config - MMW _LT5/SDI12 +LTE/WiFi -Status 220320: 0.32.2 +Status 220410: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -60,6 +60,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 // FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI +//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x +//#define SENSIRION_SHT4X_UUID //#define ASONG_AM23XX_UUID 1 //Two heavy sensors with power useage @@ -234,7 +236,11 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define INA219M_VOLT_UUID "INA219_VOLT_UUID" #endif // INA219_PHY_ACT -#if defined ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" +#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" +#elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" #define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" diff --git a/examples/tu_xx01/src/tu_xx01.cpp b/examples/tu_xx01/src/tu_xx01.cpp index 26a0ab161..50a12200c 100644 --- a/examples/tu_xx01/src/tu_xx01.cpp +++ b/examples/tu_xx01/src/tu_xx01.cpp @@ -196,7 +196,9 @@ StreamDebugger modemDebugger(modemSerial, STANDARD_SERIAL_OUTPUT); #endif // STREAMDEBUGGER_DBG // Modem Pins - Describe the physical pin connection of your modem to your board -const int8_t modemVccPin_mayfly_1_x = 18; //Pin18 on Xbee Mayfly v1.0, +#define MODEM_VCC_CE_PIN 18 +// Set the default for startup +const int8_t modemVccPin_mayfly_1_x = -2; //Pin18 on Xbee Mayfly v1.x, const int8_t modemVccPin_mayfly_0_5 = -2; //No power control rev 0.5b #define modemVccPin modemVccPin_mayfly_1_x @@ -463,7 +465,8 @@ KellerNanolevel nanolevel_snsr(nanolevelModbusAddress, modbusSerial, // AOSong AM2315 Digital Humidity and Temperature Sensor // ========================================================================== //use updated solving https://github.com/neilh10/ModularSensors/issues/102 -#include +/** Start [ao_song_am2315] */ +#include // const int8_t I2CPower = 1;//sensorPowerPin; // Pin to switch power on and // off (-1 if unconnected) @@ -471,14 +474,36 @@ KellerNanolevel nanolevel_snsr(nanolevelModbusAddress, modbusSerial, // Create an AOSong AM2315 sensor object // Data sheets says AM2315 and AM2320 have same address 0xB8 (8bit addr) of 1011 // 1000 or 7bit 0x5c=0101 1100 AM2320 AM2315 address 0x5C -AOSongAM2315a am23xx(I2CPower); +AOSongAM2315 am23xx(I2CPower); // Create humidity and temperature variable pointers for the AM2315 -// Variable *am2315Humid = new AOSongAM2315a_Humidity(&am23xx, +// Variable *am2315Humid = new AOSongAM2315_Humidity(&am23xx, // "12345678-abcd-1234-ef00-1234567890ab"); Variable *am2315Temp = new -// AOSongAM2315a_Temp(&am23xx, "12345678-abcd-1234-ef00-1234567890ab"); +// AOSongAM2315_Temp(&am23xx, "12345678-abcd-1234-ef00-1234567890ab"); +/** End [ao_song_am2315] */ #endif // ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +// ========================================================================== +// Sensirion SHT4X Digital Humidity and Temperature Sensor +// ========================================================================== +/** Start [sensirion_sht4x] */ +#include + +// NOTE: Use -1 for any pins that don't apply or aren't being used. +const int8_t SHT4xPower = sensorPowerPin; // Power pin +const bool SHT4xUseHeater = true; + +// Create an Sensirion SHT4X sensor object +SensirionSHT4x sht4x(SHT4xPower, SHT4xUseHeater); + +// Create humidity and temperature variable pointers for the SHT4X +/*Variable* sht4xHumid = + new SensirionSHT4x_Humidity(&sht4x, "12345678-abcd-1234-ef00-1234567890ab"); +Variable* sht4xTemp = + new SensirionSHT4x_Temp(&sht4x, "12345678-abcd-1234-ef00-1234567890ab");*/ +/** End [sensirion_sht4x] */ +#endif //SENSIRION_SHT4X_UUID // ========================================================================== // Maxim DS3231 RTC (Real Time Clock) @@ -559,7 +584,7 @@ float wLionBatStc3100_worker(void) { // get the Battery Reading flLionBatStc3100_V = MS_LION_ERR_VOLT; } // MS_DBG(F("wLionBatStc3100_worker"), flLionBatStc3100_V); -#if defined MS_TU_XX_DEBUG +#if defined MS_TU_XX_DEBUG_DEEP DEBUGGING_SERIAL_OUTPUT.print(F(" wLionBatStc3100_worker ")); DEBUGGING_SERIAL_OUTPUT.print(flLionBatStc3100_V, 4); DEBUGGING_SERIAL_OUTPUT.println(); @@ -662,6 +687,21 @@ Variable* pLionBatExt_var = ExternalVoltage_Volt0_UUID); #endif // ExternalVoltage_Volt0_UUID +// Measuring the battery voltage can be from a number of sources +// Battery Filtering measurement in V +// Vbat from A6 noise filtering ~ bfv +// Mayfly 0.5-1.1 has a noisy battery measurement that uses +// a sliding window filtering technique to measure the lowest +// battery voltage over a number of samples. + +float bat_filtered_v; +/// @brief Variable for software noise filtering window size +#define BFV_VBATLOW_WINDOW_SZ 6 +float bfv_sliding[BFV_VBATLOW_WINDOW_SZ ]; + +bool bfv_Init=false; //Has it been initialized +uint8_t bfv_idx=0; + #if defined MAYFLY_BAT_CHOICE #if MAYFLY_BAT_CHOICE == MAYFLY_BAT_STC3100 #define bms_SetBattery() bms.setBatteryV(wLionBatStc3100_worker()); @@ -671,11 +711,51 @@ Variable* pLionBatExt_var = #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_A6 #warning need to test mcuBoardPhy, interface // Read's the battery voltage -// NOTE: This will actually return the battery level from the previous update! +// NOTE: This returns the lowest battery level from previous running updates! float getBatteryVoltageProc() { - #define BATTERY_VOLTAGE_OPT PROCESSOR_VBATLOW_VAR_NUM - if (mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT] == PS_SENSOR_INVALID) mcuBoardPhy.update(); - return mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT]; + float bat_now_v, bfv_lowest; + uint8_t bfv_lp; + bat_now_v = mcuBoardPhy.readSensorVbat(); + bfv_lowest= bat_now_v; + + if (bfv_Init) { + //Insert the latest reading into the next slot + bfv_sliding[bfv_idx]=bat_now_v; + MS_DBG(F("Vbatlow update:"),bfv_idx, bfv_lowest); + if (++bfv_idx >= BFV_VBATLOW_WINDOW_SZ) { + //MS_DEEP_DBG(F("Vbatlow idx rst"),bfv_idx); + bfv_idx=0; + } + //Check all slots and find the lowest reading + for (bfv_lp=0;bfv_lpbfv_sliding[bfv_lp]) { + bfv_lowest=bfv_sliding[bfv_lp]; + MS_DBG(F("Vbatlow i:"),bfv_lp, bfv_lowest); + } else { + //MS_DBG(F("Vbatlow i="),bfv_lp); + } + } + } else { + for (bfv_lp=0;bfv_lp bat_now_v) { + Serial.print(F("Vbat_low now/prev ")); + Serial.print(bat_now_v,3); + Serial.print("/"); + Serial.println(bat_filtered_v,3); + bat_filtered_v = bat_now_v; + } else { + Serial.print(F("Vbat_low prev/new ")); + Serial.print(bat_filtered_v,3); + Serial.print("/"); + Serial.println(bat_now_v,3); + } + return bat_filtered_v; } #define bms_SetBattery() bms.setBatteryV(getBatteryVoltageProc()); #endif //MAYFLY_BAT_A6 @@ -799,8 +879,8 @@ Variable* variableList[] = { pLionBatExt_var, #endif #if defined MAYFLY_BAT_A6 - //new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), - new ProcessorStats_Vbatlow(&mcuBoardPhy, ProcessorStats_Batt_UUID), + //FUT return the filtered vbat_low + new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), #endif // MAYFLY_BAT_A6 #if defined AnalogProcEC_ACT // Do Analog processing measurements. @@ -845,9 +925,14 @@ Variable* variableList[] = { // new BoschBME280_Pressure(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), // new BoschBME280_Altitude(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), // new MaximDS18_Temp(&ds18, "12345678-abcd-1234-ef00-1234567890ab"), -#if defined ASONG_AM23XX_UUID - new AOSongAM2315a_Humidity(&am23xx, ASONG_AM23_Air_Humidity_UUID), - new AOSongAM2315a_Temp(&am23xx, ASONG_AM23_Air_Temperature_UUID), +#if defined SENSIRION_SHT4X_UUID + new SensirionSHT4x_Humidity(&sht4x, SENSIRION_SHT4X_Air_Humidity_UUID), + new SensirionSHT4x_Temp(&sht4x, SENSIRION_SHT4X_Air_Temperature_UUID), +// ASONG_AM23_Air_TemperatureF_UUID + +#elif defined ASONG_AM23XX_UUID + new AOSongAM2315_Humidity(&am23xx, ASONG_AM23_Air_Humidity_UUID), + new AOSongAM2315_Temp(&am23xx, ASONG_AM23_Air_Temperature_UUID), // ASONG_AM23_Air_TemperatureF_UUID // calcAM2315_TempF #endif // ASONG_AM23XX_UUID @@ -1028,6 +1113,10 @@ void modbusPinPowerMng(bool status) { pinMode(pinNum, INPUT); \ digitalWrite(pinNum, HIGH); +#define PORT_LOW(pinNum) \ + pinMode(pinNum, OUTPUT); \ + digitalWrite(pinNum, LOW); + void unusedBitsMakeSafe() { // Set all unused Pins to a safe no current mode for sleeping // Mayfly variant.h: D0->23 (Analog0-7) or D24-31 @@ -1057,7 +1146,7 @@ void unusedBitsMakeSafe() { PORT_SAFE(21); // PORT_SAFE(22); //Pwr Sw #if defined UseModem_Module - PORT_HIGH(23); // Xbee DTR modemSleepRqPin HIGH for LTE SLEEP_REQ + PORT_LOW(23); // Xbee DTR modemSleepRqPin LOW until Modem takes over #else PORT_SAFE(23); #endif //UseModem_Module @@ -1129,7 +1218,7 @@ void managementSensorsPoll() { //Create a time traceability header String csvString = ""; csvString.reserve(24); - dataLogger.dtFromEpochTz(dataLogger.getNowEpochTz()).addToString(csvString); + dataLogger.dtFromEpochTz(dataLogger.getNowLocalEpoch()).addToString(csvString); csvString += ", "; Serial.print(csvString); //Serial.print(dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); @@ -1180,7 +1269,7 @@ bool batteryCheck(bm_pwr_req_t useable_req, bool waitForGoodBattery,uint8_t dbg_ #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_AA0 PRINTOUT(F("Bat_V(Ext) tbd")); #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_A6 - PRINTOUT(F("Bat_V(low)"),mcuBoardPhy.sensorValues[BATTERY_VOLTAGE_OPT]); + PRINTOUT(F("Bat_V(low)"),bat_filtered_v); #else //alt Read the V - FUT make compatible adcRead() PRINTOUT(F("Bat_V(undef)")); #endif // @@ -1298,7 +1387,18 @@ void setup() { Serial.println(F(" Board: Found Mayfly 0.5b")); mcuBoardPhy.setVersion(mcuBoardVersion_0_5); } else { - PRINTOUT( F(" Board: Assume Mayfly 1.0A3 ") ); + PRINTOUT( F(" Board: Assume Mayfly 1.1A ") ); + + #ifdef UseModem_Module + // For Mayfly1.x needs the Modem Turned on + // as of 0.33.1 LTE power up not handled well so do manual + if (0 > modemVccPin_mayfly_1_x) { + // Set up pins for the BEE_VCC_EN pwr ON HIGH- default LOW, R pulled LOW + // Must be turned on before any other pins connected to modem are taken high + pinMode(MODEM_VCC_CE_PIN , OUTPUT); + digitalWrite(MODEM_VCC_CE_PIN, HIGH); + } + #endif //seModem_Module } // set up for escape out of battery check if too low. From 8b9a6cf7d6613f243df5b0d8afb00ac85c21d304 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Wed, 4 May 2022 17:54:14 -0700 Subject: [PATCH 93/94] Call the right time --- examples/tu_xx01/src/tu_xx01.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/tu_xx01/src/tu_xx01.cpp b/examples/tu_xx01/src/tu_xx01.cpp index 50a12200c..5d047a8e1 100644 --- a/examples/tu_xx01/src/tu_xx01.cpp +++ b/examples/tu_xx01/src/tu_xx01.cpp @@ -1607,7 +1607,7 @@ void setup() { #endif // UseModem_Module // List start time, if RTC invalid will also be initialized PRINTOUT(F("Local Time "), - dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); + dataLogger.formatDateTime_ISO8601(dataLogger.getNowLocalEpoch())); //Setup sensors, including reading sensor data sheet that can be recorded on SD card PRINTOUT(F("Setting up sensors...")); From 5234fc789e6cbc1a1ea0a342a05bd4bd96cbd244 Mon Sep 17 00:00:00 2001 From: neilh20 Date: Tue, 17 May 2022 17:06:40 -0700 Subject: [PATCH 94/94] create a variable BatFiltered_calc to report A6, and also RSSI --- a/tu_xx01/src/ms_cfg.h | 8 +- a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless | 8 +- a/tu_xx01/src/tu_xx01.cpp | 55 ++++++++++-- examples/tu_xx01/src/ms_cfg.h | 83 +++++++++++-------- .../tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless | 8 +- examples/tu_xx01/src/tu_xx01.cpp | 55 ++++++++++-- 6 files changed, 161 insertions(+), 56 deletions(-) diff --git a/a/tu_xx01/src/ms_cfg.h b/a/tu_xx01/src/ms_cfg.h index 46b40308f..3516e5134 100644 --- a/a/tu_xx01/src/ms_cfg.h +++ b/a/tu_xx01/src/ms_cfg.h @@ -1,6 +1,6 @@ /***************************************************************************** ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220410: 0.33.1.aaa +Status 220517: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -31,6 +31,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement // Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 #define MAYFLY_BAT_A6 4 +#define REPORT_FILTERED_BAT_A6_V //#define MAYFLY_BAT_AA0 2 //FUT #define MAYFLY_BAT_DIGI 3 @@ -253,8 +254,9 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #endif // ENVIRODIY_MAYFLY_TEMPERATURE #if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +// not tested Digi LTE +// tested Digi S6B +#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" //#define Modem_SignalPercent_UUID "SignalPercent_UUID" #endif // UseModem_Module diff --git a/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless index 46b40308f..3516e5134 100644 --- a/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless +++ b/a/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless @@ -1,6 +1,6 @@ /***************************************************************************** ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220410: 0.33.1.aaa +Status 220517: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -31,6 +31,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement // Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 #define MAYFLY_BAT_A6 4 +#define REPORT_FILTERED_BAT_A6_V //#define MAYFLY_BAT_AA0 2 //FUT #define MAYFLY_BAT_DIGI 3 @@ -253,8 +254,9 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #endif // ENVIRODIY_MAYFLY_TEMPERATURE #if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +// not tested Digi LTE +// tested Digi S6B +#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" //#define Modem_SignalPercent_UUID "SignalPercent_UUID" #endif // UseModem_Module diff --git a/a/tu_xx01/src/tu_xx01.cpp b/a/tu_xx01/src/tu_xx01.cpp index d3cbf0e42..dea74d2e9 100644 --- a/a/tu_xx01/src/tu_xx01.cpp +++ b/a/tu_xx01/src/tu_xx01.cpp @@ -228,7 +228,28 @@ const bool useCTSforStatus = loggerModem* loggerModemPhyInst=NULL ;//was modemPhy #define loggerModemPhyDigiWifi ((DigiXBeeWifi *) loggerModemPhyInst) #define loggerModemPhyDigiCell ((DigiXBeeCellularTransparent *) loggerModemPhyInst) -#endif // UseModem_Module + +#if defined DIGI_RSSI_UUID +//The loggerModemPhyInst is created at run time +Variable* modemPhyRssi_var = new Modem_RSSI(loggerModemPhyInst); +float modemPhyRssiGetValue(void) { // Can't get value till instatiated + if (NULL==loggerModemPhyInst) return 0; + + return modemPhyRssi_var->getValue(true); +} +// Create the calculated RSSI Variable object +Variable* modemPhyRssi_calc = + new Variable(modemPhyRssiGetValue, // function that does the calculation + MODEM_RSSI_RESOLUTION, // resolution + MODEM_RSSI_UNIT_NAME, // var name. + //from http://vocabulary.odm2.org/variablename/ + "dBm", // var unit. + //from http://vocabulary.odm2.org/units/ + MODEM_RSSI_DEFAULT_CODE, // var code MODEM_RSSI_DEFAULT_CODE + DIGI_RSSI_UUID); +#endif //DIGI_RSSI_UUID + +#endif // UseModem_Module // ========================================================================== // Create a reference to the serial port for modbus @@ -758,6 +779,24 @@ float getBatteryVoltageProc() { return bat_filtered_v; } #define bms_SetBattery() bms.setBatteryV(getBatteryVoltageProc()); + +#if defined REPORT_FILTERED_BAT_A6_V +float BatFilteredGetValue_V(void) { + return bat_filtered_v; +} +// Create the calculated Battery Filtered V object +Variable* BatFiltered_calc = + new Variable(BatFilteredGetValue_V, // function that does the calculation + PROCESSOR_BATTERY_RESOLUTION, // resolution + PROCESSOR_BATTERY_VAR_NAME, // var name. + //from http://vocabulary.odm2.org/variablename/ + PROCESSOR_BATTERY_UNIT_NAME, // var unit. + // from http://vocabulary.odm2.org/units/ + PROCESSOR_BATTERY_DEFAULT_CODE, // var code + ProcessorStats_Batt_UUID); + +#endif //REPORT_FILTERED_BAT_A6_V + #endif //MAYFLY_BAT_A6 #else #warning MAYFLY_BAT_CHOICE not defined @@ -879,9 +918,12 @@ Variable* variableList[] = { pLionBatExt_var, #endif #if defined MAYFLY_BAT_A6 - //FUT return the filtered vbat_low + #if defined REPORT_FILTERED_BAT_A6_V + BatFiltered_calc, + #else new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), -#endif // MAYFLY_BAT_A6 + #endif // REPORT_FILTERED_BAT_A6_V +#endif // MAYFLY_BAT_A6 #if defined AnalogProcEC_ACT // Do Analog processing measurements. new AnalogElecConductivityM_EC(&analogEC_phy, EC1_UUID), @@ -943,9 +985,10 @@ Variable* variableList[] = { #if defined MaximDS3231_TEMPF_UUID ds3231TempFcalc, #endif // MaximDS3231_TempF_UUID -#if 0 //modemPhy not setup, belay defined DIGI_RSSI_UUID - new Modem_RSSI(&modemPhy, DIGI_RSSI_UUID), -// new Modem_RSSI(&modemPhy, "12345678-abcd-1234-ef00-1234567890ab"), +#if defined DIGI_RSSI_UUID + //loggerModemPhyInst not setup + //new Modem_RSSI(&loggerModemPhyInst, DIGI_RSSI_UUID), + modemPhyRssi_calc, #endif // DIGI_RSSI_UUID diff --git a/examples/tu_xx01/src/ms_cfg.h b/examples/tu_xx01/src/ms_cfg.h index 57b9bcb91..3516e5134 100644 --- a/examples/tu_xx01/src/ms_cfg.h +++ b/examples/tu_xx01/src/ms_cfg.h @@ -1,7 +1,6 @@ /***************************************************************************** -ms_cfg.h_EC - ModularSensors Configuration - tgt relative _EC -Status: 220219: updated to use comms but not tested - +ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi +Status 220517: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -23,7 +22,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //************************************************************************** // This configuration is for a standard Mayfly0.5b // Sensors Used - two std to begin then -#define AnalogProcEC_ACT 1 +//#define AnalogProcEC_ACT 1 // Power Availability monitoring decisions use LiIon Voltge, // Battery Voltage measurements can be derived from a number of sources // MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated @@ -31,17 +30,19 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 // MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement // Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 - #define MAYFLY_BAT_A6 4 +#define REPORT_FILTERED_BAT_A6_V //#define MAYFLY_BAT_AA0 2 //FUT #define MAYFLY_BAT_DIGI 3 //#define ENVIRODIY_MAYFLY_TEMPERATURE 1 //#define Decagon_CTD_UUID 1 +//For Insitu_Troll specify one or none //#define Insitu_TrollSdi12_UUID 1 +#define Insitu_TrollModbus_UUID 1 -//#define WINGBOARD_KNH002 1 +#define WINGBOARD_KNH002 1 #if defined WINGBOARD_KNH002 //This supports RS485 1.9W and STC3100 //#define USE_STC3100_DD 1 @@ -51,7 +52,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // KellerAcculevel units can be 1 (meter) 2 (feet) //#define KellerAcculevel_DepthUnits 2 -#define KellerNanolevel_ACT 1 +//#define KellerNanolevel_ACT 1 #endif //WINGBOARD_KNH002 //Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis @@ -60,22 +61,22 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. //#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 // FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI +//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x +#define SENSIRION_SHT4X_UUID //#define ASONG_AM23XX_UUID 1 -// sensors with low power useage - -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_MEDIUM_REQ -// with Modem use above ^^ else use below \|/ -//#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - +//Two heavy sensors with power useage +#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ // Mayfly configuration // Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery // Digi WiFi S6 plugged in directly // For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -//Assume Mayfly, and version determined on boot See mcuBoardVersion_ -//#define MFName_DEF "Mayfly" -//#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "Electrical Conductivity MMW Digi WiFi S6/LTE XB3-C-A2" +//#define MFVersion_DEF "v0.5b" +#define MFName_DEF "Mayfly" +#define HwVersion_DEF MFVersion_DEF +#define HwName_DEF MFName_DEF +#define CONFIGURATION_DESCRIPTION_STR "LT500/Modbus Digi WiFi S6/LTE XB3-C-A2 MMW" #define USE_MS_SD_INI 1 #define USE_PS_EEPROM 1 @@ -169,12 +170,29 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #endif // Decagon_CTD_UUID -#ifdef Insitu_TrollSdi12_UUID +#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID // Mayfly definitions -#define ITROLL_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLL_TEMP_UUID "ITROLL_TEMP_UUID" +#ifdef Insitu_TrollModbus_UUID +#define InsituLTrs485_ACT 1 +#ifdef InsituLTrs485_ACT +#define CONFIG_SENSOR_RS485_PHY 1 +#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" +#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" +#define InsituLTrs485ModbusAddress_DEF 0x01 +// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop +//#define MODBUS_BAUD_RATE 9600 +#define MODBUS_BAUD_RATE 19200 +//Default for AltsoftSerial is SERIAL_8N1 +//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 +#define MODBUS_SERIAL_CONFIG SERIAL_8E1 +#endif // InsituLTrs485_ACT +#elif defined Insitu_TrollSdi12_UUID +#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" +#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" //#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_Troll_UUID +#endif // Insitu_TrollSdi12_UUID +#endif // Insitu_Trollxxx + #ifdef KellerAcculevel_ACT @@ -191,16 +209,6 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define KellerNanolevelModbusAddress_DEF 0x01 #endif // KellerNanolevel_ACT -//#define InsituLTrs485_ACT 1 -not working -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Height_UUID "KellerNanolevel_Height_UUID" -#define InsituLTrs485_Temp_UUID "KellerNanolevel_Temp_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Default is 19200 lets hope serial works with it. -#define MODBUS_BAUD_RATE 19200 -#endif // InsituLTrs485_ACT - #ifdef CONFIG_SENSOR_RS485_PHY // Mayfly definitions #define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin @@ -229,7 +237,11 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #define INA219M_VOLT_UUID "INA219_VOLT_UUID" #endif // INA219_PHY_ACT -#if defined ASONG_AM23XX_UUID +#if defined SENSIRION_SHT4X_UUID +#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" +//#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" +#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" +#elif defined ASONG_AM23XX_UUID #define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" #define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" #define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" @@ -242,8 +254,9 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #endif // ENVIRODIY_MAYFLY_TEMPERATURE #if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +// not tested Digi LTE +// tested Digi S6B +#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" //#define Modem_SignalPercent_UUID "SignalPercent_UUID" #endif // UseModem_Module @@ -257,8 +270,8 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #if defined MAYFLY_BAT_STC3100 #define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" +//#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" +//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" #endif // MAYFLY_BAT_STC3100 #ifdef MAYFLY_BAT_AA0 diff --git a/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless b/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless index 46b40308f..3516e5134 100644 --- a/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless +++ b/examples/tu_xx01/src/ms_cfg.h_LT5_Mdbus_wireless @@ -1,6 +1,6 @@ /***************************************************************************** ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220410: 0.33.1.aaa +Status 220517: 0.33.1.aaa Written By: Neil Hancock www.envirodiy.org/members/neilh20/ Development Environment: PlatformIO Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard @@ -31,6 +31,7 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. // MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement // Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 #define MAYFLY_BAT_A6 4 +#define REPORT_FILTERED_BAT_A6_V //#define MAYFLY_BAT_AA0 2 //FUT #define MAYFLY_BAT_DIGI 3 @@ -253,8 +254,9 @@ THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. #endif // ENVIRODIY_MAYFLY_TEMPERATURE #if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" +// not tested Digi LTE +// tested Digi S6B +#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" //#define Modem_SignalPercent_UUID "SignalPercent_UUID" #endif // UseModem_Module diff --git a/examples/tu_xx01/src/tu_xx01.cpp b/examples/tu_xx01/src/tu_xx01.cpp index 5d047a8e1..cfbdddc05 100644 --- a/examples/tu_xx01/src/tu_xx01.cpp +++ b/examples/tu_xx01/src/tu_xx01.cpp @@ -228,7 +228,28 @@ const bool useCTSforStatus = loggerModem* loggerModemPhyInst=NULL ;//was modemPhy #define loggerModemPhyDigiWifi ((DigiXBeeWifi *) loggerModemPhyInst) #define loggerModemPhyDigiCell ((DigiXBeeCellularTransparent *) loggerModemPhyInst) -#endif // UseModem_Module + +#if defined DIGI_RSSI_UUID +//The loggerModemPhyInst is created at run time +Variable* modemPhyRssi_var = new Modem_RSSI(loggerModemPhyInst); +float modemPhyRssiGetValue(void) { // Can't get value till instatiated + if (NULL==loggerModemPhyInst) return 0; + + return modemPhyRssi_var->getValue(true); +} +// Create the calculated RSSI Variable object +Variable* modemPhyRssi_calc = + new Variable(modemPhyRssiGetValue, // function that does the calculation + MODEM_RSSI_RESOLUTION, // resolution + MODEM_RSSI_UNIT_NAME, // var name. + //from http://vocabulary.odm2.org/variablename/ + "dBm", // var unit. + //from http://vocabulary.odm2.org/units/ + MODEM_RSSI_DEFAULT_CODE, // var code MODEM_RSSI_DEFAULT_CODE + DIGI_RSSI_UUID); +#endif //DIGI_RSSI_UUID + +#endif // UseModem_Module // ========================================================================== // Create a reference to the serial port for modbus @@ -758,6 +779,24 @@ float getBatteryVoltageProc() { return bat_filtered_v; } #define bms_SetBattery() bms.setBatteryV(getBatteryVoltageProc()); + +#if defined REPORT_FILTERED_BAT_A6_V +float BatFilteredGetValue_V(void) { + return bat_filtered_v; +} +// Create the calculated Battery Filtered V object +Variable* BatFiltered_calc = + new Variable(BatFilteredGetValue_V, // function that does the calculation + PROCESSOR_BATTERY_RESOLUTION, // resolution + PROCESSOR_BATTERY_VAR_NAME, // var name. + //from http://vocabulary.odm2.org/variablename/ + PROCESSOR_BATTERY_UNIT_NAME, // var unit. + // from http://vocabulary.odm2.org/units/ + PROCESSOR_BATTERY_DEFAULT_CODE, // var code + ProcessorStats_Batt_UUID); + +#endif //REPORT_FILTERED_BAT_A6_V + #endif //MAYFLY_BAT_A6 #else #warning MAYFLY_BAT_CHOICE not defined @@ -879,9 +918,12 @@ Variable* variableList[] = { pLionBatExt_var, #endif #if defined MAYFLY_BAT_A6 - //FUT return the filtered vbat_low + #if defined REPORT_FILTERED_BAT_A6_V + BatFiltered_calc, + #else new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), -#endif // MAYFLY_BAT_A6 + #endif // REPORT_FILTERED_BAT_A6_V +#endif // MAYFLY_BAT_A6 #if defined AnalogProcEC_ACT // Do Analog processing measurements. new AnalogElecConductivityM_EC(&analogEC_phy, EC1_UUID), @@ -943,9 +985,10 @@ Variable* variableList[] = { #if defined MaximDS3231_TEMPF_UUID ds3231TempFcalc, #endif // MaximDS3231_TempF_UUID -#if 0 //modemPhy not setup, belay defined DIGI_RSSI_UUID - new Modem_RSSI(&modemPhy, DIGI_RSSI_UUID), -// new Modem_RSSI(&modemPhy, "12345678-abcd-1234-ef00-1234567890ab"), +#if defined DIGI_RSSI_UUID + //loggerModemPhyInst not setup + //new Modem_RSSI(&loggerModemPhyInst, DIGI_RSSI_UUID), + modemPhyRssi_calc, #endif // DIGI_RSSI_UUID