diff --git a/.actrc b/.actrc new file mode 100644 index 000000000..0f8448872 --- /dev/null +++ b/.actrc @@ -0,0 +1,5 @@ +--platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:full-latest +--pull=false +--detect-event +--env RUNNER_DEBUG=1 # Enable debug logging +# --env NODE_DEBUG= # Might be useful in few cases diff --git a/.github/workflows/build_documentation.yaml b/.github/workflows/build_documentation.yaml index c834db08f..77d5d1de5 100644 --- a/.github/workflows/build_documentation.yaml +++ b/.github/workflows/build_documentation.yaml @@ -28,6 +28,53 @@ concurrency: cancel-in-progress: true jobs: + check_menu_inclusion: + runs-on: ubuntu-latest + if: ${{ ! contains(github.event.head_commit.message, 'ci skip') }} + name: Check that all classes are documented in the menu-a-la-carte example + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + # Using answer from here to get the exit code and pass the output: https://stackoverflow.com/questions/59191913/how-do-i-get-the-output-of-a-specific-step-in-github-actions + - name: check for classes in the menu example + id: check_component + continue-on-error: true + run: | + cd $GITHUB_WORKSPACE/continuous_integration + python check_component_inclusion.py 2>&1 | tee check_component.log + result_code=${PIPESTATUS[0]} + missing_menu_docs=$(cat check_component.log) + missing_menu_docs="${missing_menu_docs//'%'/'%25'}" + missing_menu_docs="${missing_menu_docs//$'\n'/'%0A'}" + missing_menu_docs="${missing_menu_docs//$'\r'/'%0D'}" + echo "missing_menu_docs=missing_menu_docs" >> $GITHUB_OUTPUT + if [[ $result_code ]]; then + echo "$(cat check_component.log)" >> $GITHUB_STEP_SUMMARY + else + echo "Valid library.json =)" >> $GITHUB_STEP_SUMMARY + fi + echo "Finished menu inclusion verification" + exit $result_code + + - name: Create commit comment + uses: peter-evans/commit-comment@v3 + if: steps.check_component.outcome=='failure' + with: + body: | + All sensor and variable subclasses must be included in the Menu a la Carte example + ${{ steps.check_component.outputs.missing_menu_docs }} + + - name: Fail if cannot find all menu flags + id: verification_failure + if: steps.check_component.outcome=='failure' + run: exit 1 + doc_build: if: ${{ (! contains(github.event.head_commit.message, 'ci skip')) && (github.event_name != 'workflow_run' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success')) }} name: Build documentation diff --git a/.github/workflows/changelog_reminder.yaml b/.github/workflows/changelog_reminder.yaml index 90115a0cb..cf35380bb 100644 --- a/.github/workflows/changelog_reminder.yaml +++ b/.github/workflows/changelog_reminder.yaml @@ -12,7 +12,7 @@ jobs: - name: Changelog Reminder uses: peterjgrainger/action-changelog-reminder@v1.3.0 with: - changelog_regex: '/CHANGELOG\/.*\/*.md' + changelog_regex: '/CHANGELOG\/.*\/*.md/i' customPrMessage: 'Please add your changes to the change log!' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index ec6909142..5531ca7b1 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,9 @@ runDoxygen_archive.bat generateKeywords.bat update_path.bat pio_common_libdeps.ini +ex_one_offs/* +output_deep.txt +output_deep+.txt +envDump.txt +-Q +act.log diff --git a/ChangeLog.md b/ChangeLog.md index f28d4a38e..a59a506cc 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,4 +1,5 @@ # 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/) and its stricter, better defined, brother [Common Changelog](https://common-changelog.org/). @@ -7,11 +8,14 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm *** - ## [Unreleased] ### Changed +- Applied markdown lint to markdown files +- Bumped TinyGSM dependency + - Changed datatypes for modem voltage outputs. + ### Added ### Removed @@ -39,6 +43,7 @@ Fixed clock configuration for SAMD21 ## [0.35.0] ### Changed + - **BREAKING** Refactored how the publisher transmit buffer works. This will require adjustment to custom data publishers. - Update GitHub actions - Remove date from copyright for easier tracking @@ -53,39 +58,47 @@ If you are not using the GroPoint sensors which require many variables, I recomm - Add further debug printouts to the processor stats ### Added + - Support [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](https://www.gropoint.com/products/soil-sensors/gropoint-profile) - Support [Vega Puls 21 Radar](https://www.vega.com/en-us/products/product-catalog/level/radar/vegapuls-21) - Functions to enable and disable modem metadata polling by bitmask ### Removed + - Removed the (unused) sendOffset parameter from dataPublisherBase. ### Fixed + - Minor bug fixes for XBee Wifi - Handle no SIM card response from SIM7080G (EnviroDIY LTE Bee) - Fixed Keller debugging output. - Fixed file reference for SDFat 2.2.3 ### Known Issues + - The modem hardware, firmware, and serial number is only implemented for the Digi XBee WiFi. ## [0.34.1] ### Changed + - Incorporated improvements to the XBee Wifi - from [neilh10](https://github.com/EnviroDIY/ModularSensors/commits?author=neilh10) - #347 -WiFi S6B stability - tears dwon TCP/IP before going to sleep, doesn't automatically poll for meta data ### Added + - Added the ability to enable or disable polling of modem attached variables. By default, all polling is off, but polling is enabled for a modem sensor when a sensor is created and attached to a modem. This functionailty is inspired from [neilh10](https://github.com/EnviroDIY/ModularSensors/commits?author=neilh10). ### Fixed + - Fixed GitHub actions for pull requests from forks. ## [0.34.0] ### Changed + - **BREAKING** - Removed support for light sleep on Espressif modules. **This changes the order of the constructor for the ESP32 and ESP8266!** - The light sleep mode is non-functional anyway, and confusion over the sleep request pin was putting the board in a position not to sleep at all. @@ -96,12 +109,14 @@ This functionailty is inspired from [neilh10](https://github.com/EnviroDIY/Modul - Specify python version 3.x for actions (used by PlatformIO) ### Added + - Support Campbell RainVUE10 SDI-12 Precipitation Sensor [#416](https://github.com/EnviroDIY/ModularSensors/issues/416) - Support YosemiTech Y700 Pressor Sensor ([#421](https://github.com/EnviroDIY/ModularSensors/issues/421)) ### Removed ### Fixed + - Fixed bug in YosemiTech Y4000 Sonde ([#420](https://github.com/EnviroDIY/ModularSensors/issues/420)) - Fixed non-concurrent data fetch for SDI-12 when *NOT* using debugging. - Fixed internet connection when in "testing mode" @@ -110,33 +125,36 @@ This functionailty is inspired from [neilh10](https://github.com/EnviroDIY/Modul *** - ## [0.33.4] ### Fixed + - Increased warm-up and measurement time for Campbell ClariVUE-10 to work with the latest version of the sensor. -*** +*** ## [0.33.3] ### Fixed + - Increased measurement time for Hydros21 to work with the latest version of the sensor. -*** +*** ## [0.33.2] ### Fixed + - Fixed script to install and zip libraries for a release -*** +*** ## [0.33.1] - 2022-04-11 ### Changed ### Added + - Added a typedef and header for the ESP32 - This is just another name to the ESP8266 class to help any who don't know they're identical for our purposes. - **Example:** Created a new DRWI wifi example for workshop. @@ -150,6 +168,7 @@ This functionailty is inspired from [neilh10](https://github.com/EnviroDIY/Modul ## [0.33.0] - 2022-04-01 ### Changed + - **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. @@ -164,7 +183,7 @@ This means having the pull-up resistors on negates the button signal. 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. 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**_. +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. @@ -180,6 +199,7 @@ These are *not* breaking changes at this time; the old class names are still usa - **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. - 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. - **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. @@ -192,6 +212,7 @@ These are *not* breaking changes at this time; the old class names are still usa ### Removed ### Fixed + - Fixed memory leak for AOSong AM2315 thanks to @neilh10 *** @@ -199,6 +220,7 @@ These are *not* breaking changes at this time; the old class names are still usa ## [0.32.2] - 2021-11-23 ### Changed + - Restructured SDI-12 slightly to break out the start measurement functionality into a new function. - Modified Decagon 5-TM and Meter Teros 11 to use the SDI-12 get results function rather than addSingleMeasurmentResult. This will allow both sensors to honor the 'non-concurrent' flag, if that is set. @@ -207,6 +229,7 @@ Previously, they would not have. This required some changes with m.css to properly ignore the doxyfile.xml the current version generates. ### Added + - **Board:** Adds 1.0 and 1.1 as valid version numbers for the Mayfly. Does not yet support any new features of those boards. - Add a new parameter (internal variable) to the sensor base class for the number of internally calculated variables. These are used for values that we would always calculate for a sensor and depend only on the raw results of that single sensor. @@ -214,7 +237,7 @@ This is separate from any calculated variables that are created on-the-fly and d In many cases, this is 0 and in most of the other cases the value is informational only. For the SDI-12 sensors, I'm actually using this to make sure I'm getting the number of values expected. - **Sensor:** 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 + - For details, see: *** @@ -223,11 +246,13 @@ For the SDI-12 sensors, I'm actually using this to make sure I'm getting the num Reinstate support for AOSong DHT ### Changed + - **Documentation:** Restructured the changelog - **Documentation:** Restyled and corrected documentation links for new and renamed DRWI examples - **Continuous Integration:** Updated changelog reader and automated releaser ### Added + - Restored support for AOSong DHT sensor. *** @@ -237,6 +262,7 @@ Reinstate support for AOSong DHT Fix build without AOSong DHT ### Fixed + - Fixed build matrix to remove DHT *** @@ -246,10 +272,12 @@ Fix build without AOSong DHT Remove support for AOSong DHT ### Added + - **Examples:** Added a new example for the DRWI site using the new EnviroDIY bee based on the SIMCOM SIM7080G ### Removed -- **Breaking:** Temporarily **_REMOVED_** support for AOSong DHT sensor. + +- **Breaking:** Temporarily ***REMOVED*** support for AOSong DHT sensor. - Intend to restore this after updating to support newest Adafruit DHT library *** @@ -259,18 +287,22 @@ Remove support for AOSong DHT Remove support for SoftwareWire for Atlas sensors ### Changed + - Changed build flags and created a pre-commit hook for myself to update the menu build matrix ### Added + - **Sensor:** Added support for [Campbell ClariVUE10](https://www.campbellsci.com/clarivue10) turbidity sensor ### Removed + - **Breaking:** Removed support for SoftwareWire for Atlas sensors. - The only supported version of a bit-banged (software) version of I2C removed inheritance from the core Wire library. Without inheritance, the parseFloat functions used by the Atlas sensors will not work. As I think this feature was completely unused for the Atlas sensors and I see no reason to use it with sensors that have completely flexible addressing, I removed it. ### Fixed + - Fixed GitHub actions for pull requests *** @@ -280,7 +312,8 @@ As I think this feature was completely unused for the Atlas sensors and I see no Fix YosemiTech Y533 ORP sensor outputs ### Fixed -- Modified `YosemitechY533.h` and examples to work with updated ORP `getValues()` function in https://github.com/EnviroDIY/YosemitechModbus released with v0.2.5. + +- Modified `YosemitechY533.h` and examples to work with updated ORP `getValues()` function in released with v0.2.5. *** @@ -289,9 +322,11 @@ Fix YosemiTech Y533 ORP sensor outputs Create a ModularSensors.h ### Changed + - Modified examples to use Hydros 21 ### Added + - Created a ModularSensors.h file to include. This makes it much easiler to install and use the library from the Arduino CLI. - Modified examples to include the ModularSensors.h file @@ -304,6 +339,7 @@ This makes it much easiler to install and use the library from the Arduino CLI. Duplicate and Rename Hydros 21 ### Added + - **Sensor:** Created a new module for the Meter Hydros 21. This is exactly identical to the Decagon CTD in everything but the name. The Decagon CTD module still exists and can be used. @@ -318,6 +354,7 @@ The addition was only made to stop complaints about typing in an older name. SDI-12 Timing Sensor Customization ### Changed + - Allow each SDI-12 sensor to set the necessary command delay for that sensor. - Per protocol, sensors are allowed to take up to 100ms after receiving a break before being ready to receive a command. This allows each sensor to specify what delay it needs. @@ -331,6 +368,7 @@ This was added to support conflicting delay needs; the RDO needed a short delay, Valid version number ### Fixed + - Use a valid semantic version number *** @@ -340,7 +378,8 @@ Valid version number Gigantic SDI-12 bug ### Fixed -- Fixes an **_EGREGIOUS_** error in the SDI-12 code causing the code to lock up if debugging was off (but always work with it on) + +- Fixes an ***EGREGIOUS*** error in the SDI-12 code causing the code to lock up if debugging was off (but always work with it on) - [Issue #346](https://github.com/EnviroDIY/ModularSensors/issues/346) - This was first introduced in [0.27.5](https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.27.5) - Fix GitHub action for pull requests. @@ -352,9 +391,11 @@ Gigantic SDI-12 bug Add Support for Turner Cyclops ### Added + - **Sensor:** Add support for all standard configurations of the [Turner Cyclops-7F submersible fluorometer](https://www.turnerdesigns.com/cyclops-7f-submersible-fluorometer) ### Fixed + - **Documentation:** Fix some minor Doxygen warnings - **Documentation:** Small grammar fixes - **Documentation:** Fixes in the EnviroDIY fork of m.css: @@ -368,6 +409,7 @@ Add Support for Turner Cyclops Fix GitHub Action ### Fixed + - Just fixed an error in the github action to post a release *** @@ -377,6 +419,7 @@ Fix GitHub Action SDI-12 Bug Fix ### Fixed + - Fixed a compiler error for non-concurrent SDI-12 sensors. *** @@ -386,6 +429,7 @@ SDI-12 Bug Fix Update Documentation ### Changed + - Update instructions for examples - Update developer instructions @@ -396,6 +440,7 @@ Update Documentation Multiple new Sensors and Workflows ### Changed + - Complete re-styling of the Doxygen output to be similar to envirodiy.org - Add enourmous amounts of documentation - Improved explanations and added walkthrough of menu a la carte example @@ -405,6 +450,7 @@ Multiple new Sensors and Workflows - NOTE: Setting the build flag disables concurrent measurements for *ALL* SDI-12 sensors! ### Added + - **Sensor:** PaleoTerra Redox sensors - **Sensor:** Northern Widget Tally Counters - **Sensor:** simple analog electrical conductance sensors @@ -417,6 +463,7 @@ Multiple new Sensors and Workflows - Support software I2C or secondary hardware I2C for all sensors possible ### Known Issues + - The instructions for using most of the examples are out of date. *** @@ -428,22 +475,24 @@ Styling & Doxygen Code Documentation [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3908530.svg)](https://doi.org/10.5281/zenodo.3908530) ### Changed + - Improved C++ code styling elements in every file in the library, to: - Better take advantage of the [Clang](https://clang.llvm.org) compiler and code error [linter](https://en.wikipedia.org/wiki/Lint_(software)) tool; - Generally follow [Clang Format](https://clang.llvm.org/docs/ClangFormat.html) and [Google's coding style guides](https://google.github.io/styleguide/cppguide.html) used with [cpplint](https://en.wikipedia.org/wiki/Cpplint) [linter](https://en.wikipedia.org/wiki/Lint_(software)), which: - includes massive white space changes to improve readability while not changing how the code is executed - Support Doxygen documentation. - Encapsulated modem wake check logic into a function and checking for status using a quick AT ping if no other option is available. - - This will only affect modems/breakouts that depend on a pulse on their wake pin to turn on or off but for whatever reason don't have a separate status pin connected to the mcu. I *do not* recommend this configuration. + - This will only affect modems/breakouts that depend on a pulse on their wake pin to turn on or off but for whatever reason don't have a separate status pin connected to the mcu. I *do not* recommend this configuration. - Always re-set the pin mode of a sensor power pin before attempting to turn it on. - - This could come into play when first attempting to power on a sensor before the initial setup if the pin mode on the sensor power pin was set to input by whatever program the mcu had run prior to running ModularSensors code. + - This could come into play when first attempting to power on a sensor before the initial setup if the pin mode on the sensor power pin was set to input by whatever program the mcu had run prior to running ModularSensors code. ### Added -- **Documentation:** Automated code documentation using [Doxygen](https://www.doxygen.nl/index.html), now available at https://envirodiy.github.io/ModularSensors/ +- **Documentation:** Automated code documentation using [Doxygen](https://www.doxygen.nl/index.html), now available at ### Fixed -- Fixed issue where the Digi XBee LTE-M modem did not wake during normal logging mode to transmit data to the publisher. See https://github.com/EnviroDIY/ModularSensors/pull/309#commitcomment-39786167 + +- Fixed issue where the Digi XBee LTE-M modem did not wake during normal logging mode to transmit data to the publisher. See For more details, see [Pull Request #309: The style sheet](https://github.com/EnviroDIY/ModularSensors/pull/309) @@ -456,6 +505,7 @@ Modem Restructuring [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3693784.svg)](https://doi.org/10.5281/zenodo.3693784) ### Changed + - Restructured modem so that it no longer operates as a sensor. Variables tied to the modem are now effectively calculated variables and all values from the modem will be offset by 1 sending cycle (ie, the signal strength posted will always be the strength from the prior send, not the current one). @@ -468,12 +518,13 @@ More agressive attempts to set clock [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3451413.svg)](https://doi.org/10.5281/zenodo.3451413) ### Changed + - Much more aggressive attempts to set the clock if the time is not reasonable - before 01Sep2019 or after 01Jan2025. - - The LED will flicker and warnings will be sent over the serial port for invalid times at every check. - - The logDataAndPublish function will attempt to synchronize the clock at every measurement until a valid time is received. - - The NIST sync will attempt to open the socket to the daytime server up to 12 times trying to get a valid response. + - The LED will flicker and warnings will be sent over the serial port for invalid times at every check. + - The logDataAndPublish function will attempt to synchronize the clock at every measurement until a valid time is received. + - The NIST sync will attempt to open the socket to the daytime server up to 12 times trying to get a valid response. - Now using automatic network technology and carrier profile for Digi LTE-M XBee3's - - with the current firmware there is not a significant time savings in manually selecting the carrier and manually selecting the carrier gives no options when the relative signal strength of the carriers changes. + - with the current firmware there is not a significant time savings in manually selecting the carrier and manually selecting the carrier gives no options when the relative signal strength of the carriers changes. *** @@ -484,23 +535,27 @@ Watchdogs and More [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3405562.svg)](https://doi.org/10.5281/zenodo.3405562) ### Changed + - Added extra compile tests in the menu a la carte example. - Improvements made to nearly all modem modules - Restore XBee access to resets by TinyGSM ### Added + - A watch-dog timer has been implemented for both the AVR and SAMD21 (and 51) boards to restart the boards in case of failure during logging - - The watch-dog is turned off during sleep to save power, so recovery is only possible if the failure is while the processor is awake. + - The watch-dog is turned off during sleep to save power, so recovery is only possible if the failure is while the processor is awake. - Added support for Meter Terros 11 soil moisture and temperature sensor - Implemented a function to verify that UUID's are at least correctly formed and unique - though it does not verify that they are valid. - Pushing to the master branch of this repo will now also cause a re-run of the travis script that updates the EnviroDIY "Libraries" repository. - Added debugging variables to modems to track how long they are powered/active. ### Fixed + - Fixed all compiler warnings seen with the -Wextra flag (mostly by adding technically-unnecessary-but-visually-helpful braces) - Fixed issue with creating a calculated variable without a UUID ### Known Issues + - polling the AM2315 more frequently than every 2 seconds will now return a bad value (-9999) rather than returning the same value multiple times. This is a reflection of a change in the Adafruit library. The measurement time set for the sensor has always been this long so this issue should never be seen unless you attempt to call get measurement results from the AM2315 without first waiting for the measurement completion. The update function and all variable array functions should behave properly. *** @@ -512,39 +567,44 @@ Modem Simplification [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3255084.svg)](https://doi.org/10.5281/zenodo.3255084) **NOTE: This release is NOT backwards compatible with previous releases.** -- All code must be updated to the current format for modems and time zones to work with this version of the library. + +- All code must be updated to the current format for modems and time zones to work with this version of the library. ### Changed + - Daily clock synchronization has been moved from midnight to noon. For loggers with solar charging, this should place the extra draw of the modem to do the synchronization to a time of peak charging. - All "send" data functions have been renamed to "publish" to line up with module names. - Updated AM2315 to use most current Adafruit library (2.0.0) ### Added + - **Breaking:** LoggerModem has become a parent class. All modems now exist as separate subclass objects. - - This should greatly simplify creating a modem object in code. - - Currently supported modems: - - Digi XBee and XBee3 cellular modems of all types running in transparent mode - - Digi XBee3 cellular LTE-M modems in bypass mode (this is *in addition* to transparent mode) - - Digi XBee cellular 3G global modems in bypass mode (this is *in addition* to transparent mode) - - Digi XBee Wifi S6B modules - - Sodaq UBee LTE-M (SARA R410M) - - Sodaq UBee 3G (SARA U201) - - Sodaq 2GBee R6/R7 - - Sodaq 2GBee R4, Adafruit Fona, and other SIMComm SIM800 modules - - Botletics and other SIMCom SIM7000 modules - - Dragino, Nimbelink, and other Quectel BG96 modules - - Nimbelink LTE-M Verizon - - Espressif ESP8266 based modules - - The older way of creating a modem object and feeding it wake/sleep functions is no longer supported. + - This should greatly simplify creating a modem object in code. + - Currently supported modems: + - Digi XBee and XBee3 cellular modems of all types running in transparent mode + - Digi XBee3 cellular LTE-M modems in bypass mode (this is *in addition* to transparent mode) + - Digi XBee cellular 3G global modems in bypass mode (this is *in addition* to transparent mode) + - Digi XBee Wifi S6B modules + - Sodaq UBee LTE-M (SARA R410M) + - Sodaq UBee 3G (SARA U201) + - Sodaq 2GBee R6/R7 + - Sodaq 2GBee R4, Adafruit Fona, and other SIMComm SIM800 modules + - Botletics and other SIMCom SIM7000 modules + - Dragino, Nimbelink, and other Quectel BG96 modules + - Nimbelink LTE-M Verizon + - Espressif ESP8266 based modules + - The older way of creating a modem object and feeding it wake/sleep functions is no longer supported. - The real time clock's timezone can now be explicit set (as opposed to setting the logger timezone and the offset between the RTC and the logger) - - The function to set the logger timezone has been renamed from setTimeZone to setLoggerTimeZone. + - The function to set the logger timezone has been renamed from setTimeZone to setLoggerTimeZone. ### Fixed + - Fixed #259 where time zones offset by more than 9 hours from UTC would not work correctly. - Fixed #183 where enabling debugging would cause non AVR boards to crash. - Adjusted some timing parameters for the SIM800 based on testing. ### Known Issues + - polling the AM2315 more frequently than every 2 seconds will now return a bad value (-9999) rather than returning the same value multiple times. This is a reflection of a change in the Adafruit library. The measurement time set for the sensor has always been this long so this issue should never be seen unless you attempt to call get measurement results from the AM2315 without first waiting for the measurement completion. The update function and all variable array functions should behave properly. *** @@ -554,6 +614,7 @@ Modem Simplification Deep debug error ### Fixed + - Fixed minor bug in debugging created in previous release *** @@ -563,11 +624,13 @@ 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. - - Some files also have a "deep" debugging option with -DMS_xxx_DEBUG_DEEP + - Some files also have a "deep" debugging option with -DMS_xxx_DEBUG_DEEP - Created examples for LearnEnviroDIYCode ### Fixed + - Fixed a bug causing modem to not be turned because the processor thought it was on already - Corrected warm-up timing for Yosemitech Sonde - Typo fixes in comments @@ -579,6 +642,7 @@ Minor Bugs and Simplified Debugging Fix write to SD card ### Fixed + - Fixed bug intoduced in 0.21.0 preventing writing to SD card - file must be closed (not sync'ed) *** @@ -590,36 +654,41 @@ 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) ### Changed + - Eliminated any time-out waits on libraries using the Wire class - Simplified the logger begin function - the removed functionality should be called in individual program setup functions - - Removed clock sync - - Removed logger file creation - - Removed sensor setup + - Removed clock sync + - Removed logger file creation + - Removed sensor setup - Moved the check for setup from the wake function to the startSingleMeasurement function for all sensors - - Previously, the first time the wake was called for a function, the status bit for setup was checked and if the sensor had not been setup, the setup function was called. This will no longer happen the first time the wake function is called, but instead the first time the startSingleMeasurement function is called. The main motivator for the change was the modem which could end up behaving strangely because the setup function actually called the wake function internally. + - Previously, the first time the wake was called for a function, the status bit for setup was checked and if the sensor had not been setup, the setup function was called. This will no longer happen the first time the wake function is called, but instead the first time the startSingleMeasurement function is called. The main motivator for the change was the modem which could end up behaving strangely because the setup function actually called the wake function internally. - Improved example coding for SARA R410 cellular modules ### Added + - **Sensor:** Added full support for all Atlas Scientific EZO curcuits and sensors that support I2C - - CO2 - - DO (dissolved oxygen) - - EC (conductivity) - - ORP (oxidation/reduction potential) - - pH - - RTD (temperature + - CO2 + - DO (dissolved oxygen) + - EC (conductivity) + - ORP (oxidation/reduction potential) + - pH + - RTD (temperature - Created empty constructors for the logger, publisher, variable array, and variable classes and all of their subclasses. For all classes created a corresponding "begin" function to set internal class object values. - - See note for more details: https://github.com/EnviroDIY/ModularSensors/commit/b1a619ed74bc790743bce35b3a4e78a2d2237b22 - - The order of input arguments for all variable objects has changed. For variable subclasses (ie, variables from sensors), there is no change to the user. __**For calculated variable objects, all code must be updated!**__ Please check the structure in the examples! Older code will compile without error but the variable metadata fields will be incorrectly populated. + - See note for more details: + - The order of input arguments for all variable objects has changed. For variable subclasses (ie, variables from sensors), there is no change to the user. ****For calculated variable objects, all code must be updated!**** Please check the structure in the examples! Older code will compile without error but the variable metadata fields will be incorrectly populated. - Very preliminary support for SD cards with switchable power ### Removed + - Removed "default" wake/sleep functions from modem. These were non-working skeleton functions. ### Fixed + - Fixed call to a null pointer causing the array's completeUpdate to crash with calculated variables - Fixed source of ADS1x15 dependency ### Known Issues + - Running some I2C sensors on switched power will cause unrecoverable hangs at the first call to any other I2C peripheral (ie, the DS3231 RTC) after sensor power is turned off. This is a hardware problem and is un-fixable within this library. - The sensor class and all of its subclasses still require input arguments in the constructor. @@ -632,14 +701,17 @@ Modem Improvements & ADS1X15 Generalization [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2579301.svg)](https://doi.org/10.5281/zenodo.2579301) ### Changed + - Modem waits for signal strength return before sending data - Other modem tweaks - Restructuring of data publishers ### Added + - Added ADS1015 as an optional analog to digital converter (ADC) for boards other than the Mayfly ### Fixed + - Fixed bug with ADS1115 for M0/SAM21 *** @@ -649,9 +721,11 @@ Modem Improvements & ADS1X15 Generalization Bug fix and example re-working ### Changed + - Re-works the examples to remove duplication between them. ### Fixed + - Fixes bug in sending data to the WikiWatershed / [Monitor My Watershed](https://monitormywatershed.org/) data sharing portal. *** @@ -661,11 +735,13 @@ Bug fix and example re-working Decreased Data Consumption ### Changed + - Reduced telemetry data consumption (by half in one test) and therefore overall power use, by creating an outgoing text buffer. - Note : the default buffer size is quite large, decrease it to decrease program memory size. - Refactored data publishers as a new class rather than subclasses of loggers ### Added + - Added ThingSpeak support via MQTT (PubSubClient is now a required dependency) - Added support for TI INA219 thanks to @neilh21 (Adafruit INA219 library is now a required dependency) @@ -676,13 +752,15 @@ Decreased Data Consumption Major Update! **NOTE: THIS RELEASE DESTROYS BACKWARDS COMPATIBILITY!!** + - All `.ino` sketch files will need to be updated to follow the updated [examples](https://github.com/EnviroDIY/ModularSensors/tree/master/examples). - All library dependencies will need to be updated to match versions in the [library.json](https://github.com/EnviroDIY/ModularSensors/blob/master/library.json) file. ### Changed + - Improved power management. - Improved stability. -- A huge number of other changes, with most of them are documented here: https://github.com/EnviroDIY/ModularSensors/pull/173 +- A huge number of other changes, with most of them are documented here: *** @@ -693,10 +771,12 @@ 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. ### Added + - Implemented real calculated variables, from PR #153, closing issue #127 (Create generic calculated variables). ### Fixed -- Fixes issue with MaxSonar giving weird readings, due to buffer not being cleared between readings, as described in https://www.envirodiy.org/topic/minor-glitch-reading-maxbotix-mb7389-with-mayfly/ + +- Fixes issue with MaxSonar giving weird readings, due to buffer not being cleared between readings, as described in See PR #160 for a full list of improvements and fixes. @@ -707,11 +787,13 @@ See PR #160 for a full list of improvements and fixes. Fixed Longer Logger Intervals and Improved Documentation ### Changed + - **Documentation:** Improved documentation for examples - Applying "sensor testing mode" more consistently in examples - Made variables necessary for sensor testing mode with custom loops public ### Fixed + - Fixed variable type for logging interval from uint8_t to uint16_t allowing consistent logging at intervals greater than 5 minutes *** @@ -721,9 +803,11 @@ Fixed Longer Logger Intervals and Improved Documentation Added sensors and fixed timing bugs ### Changed + - Tweeked code generating csv's and json outputs to allow a modified csv or json to be written to the SD card or posted to data.EnviroDIY.org ### Added + - **Sensor:** Added support for Freescale MPL115A2 pressure sensor - **Sensor:** Added support for Keller Acculevel - **Sensor:** Added support for Yosemitech Y4000 multi-parameter sonde @@ -735,11 +819,13 @@ Added sensors and fixed timing bugs - **Documentation:** Minor corrections to Yosemitech sensor resolution and accuracy. ### Removed + - Removed the "checkForUpdate()" function. When asking for a value from a variable, you now must explicitly state whether you want the variable to ask its parent sensor for an updated value or not. - By default, it will _not_ ask the parent sensor to update, but only return the last value received or -9999 if a value has never been received. + By default, it will *not* ask the parent sensor to update, but only return the last value received or -9999 if a value has never been received. ### Fixed + - Fixed major bug causing sensors with long stabilization times to not be updated *** @@ -749,13 +835,16 @@ Added sensors and fixed timing bugs Timing Improvements ### Changed + - Major restructuring of sensor status and internal sensor time stamps to improve efficiency when using variables/sensors in arrays - this makes sensor/variable order much less important - Restructured Zebra Tech D-Opto ### Added + - Added MS5803, external voltage, and external tip counter ### Fixed + - Fixed bugs with modem and 5TM *** @@ -765,6 +854,7 @@ Timing Improvements Fixes bugs in description and examples ### Fixed + - Small bug-fixing release *** @@ -774,6 +864,7 @@ Fixes bugs in description and examples Uniformity of missing values, averaging for all sensors ### Changed + - Allows all sensors to be averaged - More uniform return of -9999 for missing/bad values - Better time synching @@ -782,15 +873,18 @@ Uniformity of missing values, averaging for all sensors ## [0.5.4-beta] - 2018-01-18 ### Changed + - Improvements to modem support and debugging - Improved examples - Renaming of a large number of internal variables - Inching closer to full support for SAMD21 (M0/Zero) processors, though still some bugs present. ### Added + - **Sensor:** Added Yosemitech brand sensors which communicate via RS485 ### Fixed + - Clock synchronization fixes - Library metadata and dependency fixes @@ -801,9 +895,11 @@ Uniformity of missing values, averaging for all sensors Beta Release ### Changed + - Changed the interrupt library to EnableInterrupt, which now controls all interrupts. ### Added + - **Sensor:** Added the Apogee SQ-212 PAR sensor. - Added the modem as a "sensor" which can return it's signal strength as a variable. - Added a "debugging" mode, accessible by pushing a button while the checkForDebugMode function is running. @@ -815,6 +911,7 @@ Beta Release Impoved setup functions ### Changed + - Slight rearrangement of setup functions to improve efficiency. *** @@ -824,14 +921,17 @@ Impoved setup functions Another beta release ### Changed + - Shorted time allowed to attempt to turn Bee on/off - Shorted wait for network time to 55 sec (from 60) - Put disconnect step within if block so it only tries to disconnect if it was connected in the first place ### Added + - Added a check that Bee is on before trying to connect to network ### Fixed + - Fixed extra spaces in CSV *** @@ -863,7 +963,6 @@ Our first release of the modular sensors library to support easily logging data [0.28.5]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.28.5 [0.28.4]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.28.4 [0.28.3]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.28.3 -[0.28.1]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.28.1 [0.28.0]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.28.0 [0.27.8]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.27.8 [0.27.7]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.27.7 @@ -889,10 +988,6 @@ Our first release of the modular sensors library to support easily logging data [0.6.10]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.6.10 [0.6.9]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.6.9 [0.5.4-beta]: https://github.com/EnviroDIY/ModularSensors/releases/tag/0.5.4-beta -[0.3.0-beta]: https://github.com/EnviroDIY/ModularSensors/releases/tag/v0.3.0-beta -[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/README.md b/README.md index 557731c0f..da9a9c120 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,14 @@ -# ModularSensors +# ModularSensors ___ -## 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 @@ -26,18 +27,19 @@ There is extensive documentation available in the [ModularSensors github pages]( [//]: # ( @m_footernavigation ) [//]: # ( Start GitHub Only ) -- [ModularSensors ](#modularsensors-) - - [The EnviroDIY ModularSensors Library ](#the-envirodiy-modularsensors-library-) - - [Supported Sensors ](#supported-sensors-) - - [Data Endpoints ](#data-endpoints-) - - [Supported Cellular/Wifi Modules: ](#supported-cellularwifi-modules-) - - [Contributing ](#contributing-) - - [License ](#license-) - - [Acknowledgments ](#acknowledgments-) + +- [ModularSensors](#modularsensors) + - [The EnviroDIY ModularSensors Library](#the-envirodiy-modularsensors-library) + - [Supported Sensors](#supported-sensors) + - [Data Endpoints](#data-endpoints) + - [Supported Cellular/Wifi Modules:](#supported-cellularwifi-modules) + - [Contributing](#contributing) + - [License](#license) + - [Acknowledgments](#acknowledgments) [//]: # ( End GitHub Only ) -## 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). @@ -48,19 +50,19 @@ For some generalized information about attaching sensors to an Arduino style boa - [AOSong DHT: humidity & temperature](https://envirodiy.github.io/ModularSensors/group__sensor__dht.html) - [Apogee SQ-212: quantum light sensor, via TI ADS1115](https://envirodiy.github.io/ModularSensors/group__sensor__sq212.html) - [Atlas Scientific EZO Sensors](https://envirodiy.github.io/ModularSensors/group__atlas__group.html) - - [EZO-CO2: Carbon Dioxide and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__co2.html) - - [EZO-DO: Dissolved Oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__do.html) - - [EZO-EC: Conductivity, Total Dissolved Solids, Salinity, and Specific Gravity](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__cond.html) - - [EZO-ORP: Oxidation/Reduction Potential](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__orp.html) - - [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) + - [EZO-CO2: Carbon Dioxide and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__co2.html) + - [EZO-DO: Dissolved Oxygen](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__do.html) + - [EZO-EC: Conductivity, Total Dissolved Solids, Salinity, and Specific Gravity](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__cond.html) + - [EZO-ORP: Oxidation/Reduction Potential](https://envirodiy.github.io/ModularSensors/group__sensor__atlas__orp.html) + - [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) - [Campbell Scientific RainVUE10: precipitation](https://envirodiy.github.io/ModularSensors/group__sensor__rainvue.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) +- [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) - [External Arduino I2C Rain Tipping Bucket Counter: rainfall totals](https://envirodiy.github.io/ModularSensors/group__sensor__i2c__rain.html) - [Freescale Semiconductor MPL115A2: barometric pressure and temperature](https://envirodiy.github.io/ModularSensors/group__sensor__mpl115a2.html) @@ -68,14 +70,14 @@ For some generalized information about attaching sensors to an Arduino style boa - [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) + - [Acculevel](https://envirodiy.github.io/ModularSensors/group__sensor__acculevel.html) + - [Nanolevel](https://envirodiy.github.io/ModularSensors/group__sensor__nanolevel.html) - [MaxBotix MaxSonar: water level](https://envirodiy.github.io/ModularSensors/group__sensor__maxbotix.html) - [Maxim DS18: temperature](https://envirodiy.github.io/ModularSensors/group__sensor__ds18.html) - [Measurement Specialties MS5803: pressure and temperature](https://envirodiy.github.io/ModularSensors/group__sensor__ms5803.html) - Meter Environmental Soil Moisture Probes: soil Ea and volumetric water content - - [Meter ECH2O 5TM](https://envirodiy.github.io/ModularSensors/group__sensor__fivetm.html) - - [Meter Teros 11](https://envirodiy.github.io/ModularSensors/group__sensor__teros11.html) + - [Meter ECH2O 5TM](https://envirodiy.github.io/ModularSensors/group__sensor__fivetm.html) + - [Meter Teros 11](https://envirodiy.github.io/ModularSensors/group__sensor__teros11.html) - [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) @@ -85,21 +87,20 @@ For some generalized information about attaching sensors to an Arduino style boa - [Turner Cyclops-7F: various parameters](https://envirodiy.github.io/ModularSensors/group__sensor__cyclops.html) - [Vega Puls 21: radar distance](https://envirodiy.github.io/ModularSensors/group__sensor__vega__puls21.html) - [Yosemitech: water quality sensors](https://envirodiy.github.io/ModularSensors/group__yosemitech__group.html) - - [Y502-A or Y504-A: Optical DO and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y504.html) - - [Y510-B: Optical Turbidity and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y510.html) - - [Y511-A: Optical Turbidity and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y511.html) - - [Y514-A: Optical Chlorophyll and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y514.html) - - [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: 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) - - [Y700: Pressure and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y700.html) - - [Y4000 Multiparameter Sonde](https://envirodiy.github.io/ModularSensors/group__sensor__y4000.html) + - [Y502-A or Y504-A: Optical DO and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y504.html) + - [Y510-B: Optical Turbidity and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y510.html) + - [Y511-A: Optical Turbidity and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y511.html) + - [Y514-A: Optical Chlorophyll and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y514.html) + - [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: 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) + - [Y700: Pressure and Temperature](https://envirodiy.github.io/ModularSensors/group__sensor__y700.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) - -## 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). @@ -110,17 +111,16 @@ The currently supported services are the [Monitor My Watershed data portal](http [//]: # ( @todo Page on Data Endpoints ) - -## 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). - [Digi XBee](https://envirodiy.github.io/ModularSensors/group__modem__digi.html) - - Digi XBee® 3 Cellular LTE-M/NB-IoT - - Digi XBee® 3 Cellular LTE Cat 1 (AT&T or Verizon) - - Digi XBee® Cellular 3G - - Digi XBee® Cellular LTE Cat 1 (Verizon) - - Digi XBee® Wi-Fi (S6B) + - Digi XBee® 3 Cellular LTE-M/NB-IoT + - Digi XBee® 3 Cellular LTE Cat 1 (AT&T or Verizon) + - Digi XBee® Cellular 3G + - Digi XBee® Cellular LTE Cat 1 (Verizon) + - Digi XBee® Wi-Fi (S6B) - [ESP8266](https://envirodiy.github.io/ModularSensors/group__modem__esp8266.html) - [QuectelBG96](https://envirodiy.github.io/ModularSensors/group__modem__bg96.html) - [Sequans Monarch](https://envirodiy.github.io/ModularSensors/group__modem__monarch.html) @@ -130,8 +130,8 @@ For information common to all modems and for tables of the proper class, baud ra - u-blox LTE-M R4 and N4 series, including the [Sodaq uBee](https://envirodiy.github.io/ModularSensors/group__modem__ubee__ltem.html) - u-blox 2G, 3G, and 4G, including the [Sodaq 3GBee](https://envirodiy.github.io/ModularSensors/group__modem__ubee__3g.html) +## 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. @@ -140,26 +140,26 @@ Please _take time to familiarize yourself with the [terminology, classes and dat This library is built to fully take advantage of Objecting Oriented Programing (OOP) approaches and is larger and more complicated than many Arduino libraries. 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. +## 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). -## 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). This project has benefited from the support from the following funders: -* William Penn Foundation -* 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 - +- William Penn Foundation +- 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} ) diff --git a/continuous_integration/ReadMe.md b/continuous_integration/ReadMe.md new file mode 100644 index 000000000..700c66d49 --- /dev/null +++ b/continuous_integration/ReadMe.md @@ -0,0 +1,27 @@ +# Extra scripts for Continuous Integration Using GitHub Actions + +- check_component_inclusion.py + - A python script to check that all sensor, modem, and publisher classes are included in the massive menu a la carte example. + +- dependencies.json + - A copy of the library dependencies in library.json to diff against for dependency changes. + - The dependencies.json is automatically generated by a git pre-commit hook. + +- pre-commit-check-deps.py + - A python script to copy from the library.json to dependencies.json for rebuilding dependency archives on the GitHub actions runner. + - This is run as a pre-commit hook + +- generate_job_matrix.py + - A python script to generate a series of shell scripts to splice apart the menu a la carte example and run each sensor, modem, and publisher as indivudual testing jobs on a number of different processors. + +- install-deps-arsuino-cli.sh + - A shell script to install all Arduino library dependencies on the GitHub actions runner used for CI testing. + +- install-deps-platformio.sh + - A shell script to install all PlatformIO library dependencies on the GitHub actions runner used for CI testing. + +- continuous_integration/platformio.ini + - PlatformIO environments for CI testing + +- continuous_integration/platformio_extra_flags.ini + - Even more PlatformIO environments for CI testing diff --git a/continuous_integration/arduino_cli.yaml b/continuous_integration/arduino_cli.yaml deleted file mode 100644 index 38376cf0d..000000000 --- a/continuous_integration/arduino_cli.yaml +++ /dev/null @@ -1,22 +0,0 @@ -board_manager: - additional_urls: - - https://raw.githubusercontent.com/EnviroDIY/Arduino_boards/master/package_EnviroDIY_index.json - - https://adafruit.github.io/arduino-board-index/package_adafruit_index.json - - http://downloads.sodaq.net/package_sodaq_samd_index.json -daemon: - port: '50051' -directories: - data: home/arduino/data - downloads: home/arduino/downloads - user: home/arduino/user -library: - enable_unsafe_install: true -logging: - file: arduino_cli.log - format: text - level: debug -metrics: - addr: :9090 - enabled: true -sketch: - always_export_binaries: false diff --git a/continuous_integration/check_component_inclusion.py b/continuous_integration/check_component_inclusion.py index 485926cf5..ef4a243a4 100644 --- a/continuous_integration/check_component_inclusion.py +++ b/continuous_integration/check_component_inclusion.py @@ -1,4 +1,4 @@ -#%% +# %% import glob import re import sys @@ -15,7 +15,7 @@ header_files = modemHeaderFiles + sensorHeaderFiles + publisherHeaderFiles # print(header_files) -#%% function to find the lowest level class +# %% 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 @@ -63,7 +63,7 @@ def camel_to_snake(name, lower_case=True): return name_lower.upper() -#%% +# %% # make sure class names match file names class_pattern = re.compile(r"^\s*class[\s\n]+(\w+)[\s\n]", re.MULTILINE) @@ -86,7 +86,7 @@ def camel_to_snake(name, lower_case=True): ) ) -#%% +# %% # make sure there are examples of all classes in the menu example must_doc_classes = [] @@ -140,7 +140,7 @@ 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"), mode="r", @@ -222,3 +222,5 @@ def print_missing(missing_things): }, } sys.exit(1) +else: + print("All classes, flags, snippets, and walkthroughs seem to be documented") diff --git a/continuous_integration/copy-doc-sources.sh b/continuous_integration/copy-doc-sources.sh deleted file mode 100644 index 67acbc003..000000000 --- a/continuous_integration/copy-doc-sources.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# Makes the bash script print out every command before it is executed, except echo -trap '[[ $BASH_COMMAND != echo* ]] && echo $BASH_COMMAND' DEBUG - -# Script modified from scripts by Jeroen de Bruijn, thephez, and Adafruit -# https://gist.github.com/vidavidorra/548ffbcdae99d752da02 -# https://github.com/thephez/doxygen-travis-build -# https://learn.adafruit.com/the-well-automated-arduino-library/travis-ci - -# Exit with nonzero exit code if anything fails -set -e - -# Create a clean working directory for this script. -mkdir $GITHUB_WORKSPACE/code_docs -cd $GITHUB_WORKSPACE/code_docs - -# Re-clone the main repo, not sparsely -git clone -b master --depth 1 https://github.com/EnviroDIY/ModularSensors ModularSensors - -# Clone the wiki, because we'll be using it in the docs -git clone --depth 1 https://github.com/EnviroDIY/ModularSensors.wiki - -# Clone m.css for its theming -git clone --depth 1 https://github.com/SRGDamia1/m.css m.css - -# Get the current gh-pages branch -# git clone -b gh-pages https://git@$GH_REPO_REF -# cd $GH_REPO_NAME -git clone -b gh-pages --depth 1 https://github.com/EnviroDIY/ModularSensors ModularSensorsDoxygen -cd ModularSensorsDoxygen -echo "Documentation path: " $(pwd) - -# Remove everything currently in the gh-pages branch. -# GitHub is smart enough to know which files have changed and which files have -# stayed the same and will only update the changed files. So the gh-pages branch -# can be safely cleaned, and it is sure that everything pushed later is the new -# documentation. -rm -rf * - -# Need to create a .nojekyll file to allow filenames starting with an underscore -# to be seen on the gh-pages site. Therefore creating an empty .nojekyll file. -# Presumably this is only needed when the SHORT_NAMES option in Doxygen is set -# to NO, which it is by default. So creating the file just in case. -echo "" > .nojekyll -ls diff --git a/continuous_integration/dependencies.json b/continuous_integration/dependencies.json index a59eeceec..dd3becbe9 100644 --- a/continuous_integration/dependencies.json +++ b/continuous_integration/dependencies.json @@ -57,7 +57,7 @@ { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.7", + "version": "~0.12.0", "note": "A small Arduino library for GPRS modules.", "authors": [ "Volodymyr Shymanskyy", @@ -246,7 +246,7 @@ "name": "SDI-12", "owner": "envirodiy", "library id": "1486", - "version": "~2.1.4", + "version": "~2.2.0", "url": "https://github.com/EnviroDIY/Arduino-SDI-12", "note": "EnviroDIY SDI-12 Library for Arduino", "author_notes": [ @@ -289,7 +289,7 @@ "owner": "envirodiy", "library id": "1824", "url": "https://github.com/EnviroDIY/SensorModbusMaster", - "version": "~0.6.8", + "version": "~0.7.0", "note": "EnviroDIY SensorModbusMaster - Arduino library for communicating via modbus with the Arduino acting as the modbus master.", "authors": [ "Sara Damiano" @@ -335,4 +335,4 @@ "platforms": "atmelavr, atmelsam" } ] -} \ No newline at end of file +} diff --git a/continuous_integration/generate_job_matrix.py b/continuous_integration/generate_job_matrix.py index f2cd322d6..19504b06c 100644 --- a/continuous_integration/generate_job_matrix.py +++ b/continuous_integration/generate_job_matrix.py @@ -266,14 +266,18 @@ def snake_to_camel(snake_str): for compiler, command_list in zip( compilers, [arduino_ex_commands, pio_ex_commands] ): - command_list.extend( - create_logged_command( - compiler=compiler, - group_title=example, - code_subfolder=example, - pio_env=pio_env, + if compiler == "Arduino CLI" and example == "data_saving": + # skip this one, it's too big + pass + else: + command_list.extend( + create_logged_command( + compiler=compiler, + group_title=example, + code_subfolder=example, + pio_env=pio_env, + ) ) - ) arduino_job_matrix.append( { diff --git a/continuous_integration/platformio.ini b/continuous_integration/platformio.ini index 6b56d0d53..c6ca1e02e 100644 --- a/continuous_integration/platformio.ini +++ b/continuous_integration/platformio.ini @@ -22,13 +22,15 @@ lib_ignore = Adafruit TouchScreen Adafruit ILI9341 build_flags = + -Wall -Wextra -D SDI12_EXTERNAL_PCINT -D NEOSWSERIAL_EXTERNAL_PCINT [env:mayfly] -board = mayfly +framework = arduino platform = atmelavr +board = mayfly lib_ignore = ${env.lib_ignore} RTCZero @@ -37,6 +39,7 @@ build_flags = ${env.build_flags} [env:mega] +framework = arduino platform = atmelavr board = megaatmega2560 lib_ignore = @@ -47,6 +50,7 @@ build_flags = ${env.build_flags} [env:zero] +framework = arduino platform = atmelsam board = zeroUSB lib_ignore = @@ -59,6 +63,7 @@ build_flags = ${env.build_flags} [env:feather_m0] +framework = arduino platform = atmelsam board = adafruit_feather_m0 lib_ignore = @@ -72,6 +77,7 @@ build_flags = build_unflags = -D USE_TINYUSB ; [env:feather_m4] +; framework = arduino ; platform = atmelsam ; board = adafruit_feather_m4 ; lib_ignore = @@ -87,6 +93,7 @@ build_unflags = -D USE_TINYUSB ; build_unflags = -D USE_TINYUSB ; [env:grandcentral_m4] +; framework = arduino ; platform = atmelsam ; board = adafruit_grandcentral_m4 ; lib_ignore = diff --git a/continuous_integration/requirements.txt b/continuous_integration/requirements.txt deleted file mode 100644 index 31e6105b7..000000000 --- a/continuous_integration/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -# Wheel for installs -wheel - -# use platformio for all of the compiler testing -platformio diff --git a/continuous_integration/validate_manifest.py b/continuous_integration/validate_manifest.py deleted file mode 100644 index 124a4875d..000000000 --- a/continuous_integration/validate_manifest.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2014-present PlatformIO -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from platformio.package.manifest.parser import ManifestParserFactory -from platformio.package.manifest.schema import ManifestSchema - -mp = ManifestParserFactory.new_from_file("library.json") -parsed = ManifestSchema().load_manifest(mp.as_dict()) diff --git a/docs/Doxyfile b/docs/Doxyfile index 2a6aa481d..c939101b4 100644 --- a/docs/Doxyfile +++ b/docs/Doxyfile @@ -547,13 +547,13 @@ EXTRACT_ALL = NO # be included in the documentation. # The default value is: NO. -EXTRACT_PRIVATE = NO +EXTRACT_PRIVATE = YES # If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual # methods of a class will be included in the documentation. # The default value is: NO. -EXTRACT_PRIV_VIRTUAL = NO +EXTRACT_PRIV_VIRTUAL = YES # If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal # scope will be included in the documentation. @@ -1843,7 +1843,7 @@ HTML_FORMULA_FORMAT = png # Minimum value: 8, maximum value: 50, default value: 10. # This tag requires that the tag GENERATE_HTML is set to YES. -FORMULA_FONTSIZE = 10 +FORMULA_FONTSIZE = 14 # The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands # to create new LaTeX commands to be used in formulas as building blocks. See @@ -2457,7 +2457,7 @@ MACRO_EXPANSION = YES # The default value is: NO. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_ONLY_PREDEF = YES +EXPAND_ONLY_PREDEF = NO # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. diff --git a/docs/DoxygenLayout.xml b/docs/DoxygenLayout.xml index 05380cd27..ebb4e1f32 100644 --- a/docs/DoxygenLayout.xml +++ b/docs/DoxygenLayout.xml @@ -1,328 +1,262 @@ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/FAQ/Arduino-Streams.md b/docs/FAQ/Arduino-Streams.md index 51b067d0e..e58a54e34 100644 --- a/docs/FAQ/Arduino-Streams.md +++ b/docs/FAQ/Arduino-Streams.md @@ -1,10 +1,11 @@ -# Notes on Arduino Streams and Software Serial +# Notes on Arduino Streams and Software Serial [//]: # ( @tableofcontents ) [//]: # ( @m_footernavigation ) [//]: # ( Start GitHub Only ) + - [Notes on Arduino Streams and Software Serial](#notes-on-arduino-streams-and-software-serial) - [Hardware Serial](#hardware-serial) - [AltSoftSerial](#altsoftserial) @@ -16,6 +17,7 @@ In this library, the Arduino communicates with the computer for debugging, the modem for sending data, and some sensors (like the [MaxBotix MaxSonar](https://github.com/EnviroDIY/ModularSensors/wiki/MaxBotix-MaxSonar)) via instances of Arduino TTL [streams](https://www.arduino.cc/en/Reference/Stream). The streams can either be an instance of + - [serial (hardware serial)](https://www.arduino.cc/en/Reference/Serial), - [AltSoftSerial](https://github.com/PaulStoffregen/AltSoftSerial), - [NeoSWSerial](https://github.com/SRGDamia1/NeoSWSerial), @@ -34,7 +36,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. -## 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. @@ -50,8 +52,7 @@ If you would like to give your hardware serial port an easy-to-remember alias, y HardwareSerial* streamName = &Serial; ``` - -## 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. @@ -68,8 +69,7 @@ AltSoftSerial streamName. // Create an instance of AltSoftSerial ``` - -## 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. @@ -109,8 +109,7 @@ Additionally, for the EnviroDIY modified version of SoftwareSerial, (or NeoSWSer enableInterrupt(rx_pin, neoSSerial1ISR, CHANGE); ``` - -## 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). @@ -136,8 +135,7 @@ Additionally, for the EnviroDIY modified version of SoftwareSerial, you must ena enableInterrupt(rx_pin, SoftwareSerial_ExtInts::handle_interrupt, CHANGE); ``` - -## 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_walk_samd_serial_ports). diff --git a/docs/FAQ/Code-Debugging.md b/docs/FAQ/Code-Debugging.md index 7fd708768..f4a117638 100644 --- a/docs/FAQ/Code-Debugging.md +++ b/docs/FAQ/Code-Debugging.md @@ -1,4 +1,4 @@ -# 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 65d4f18a6..cf5999590 100644 --- a/docs/FAQ/Deceasing-Memory-Use.md +++ b/docs/FAQ/Deceasing-Memory-Use.md @@ -1,4 +1,4 @@ -# 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 19db0b93c..67f1ec915 100644 --- a/docs/FAQ/Developer-Setup.md +++ b/docs/FAQ/Developer-Setup.md @@ -1,4 +1,4 @@ -# 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. @@ -41,7 +41,7 @@ check_flags = clangtidy: --checks=-* ; deep search for dependencies, evalulating preprocessor conditionals lib_ldf_mode = deep+ -; look for the library director +; look for the library directory lib_extra_dirs = . ; We have to ignore these folders or PlatformIO will double count all the dependencies lib_ignore = @@ -161,6 +161,6 @@ build_flags = build_unflags = -D USE_TINYUSB ``` -While you're working on development, there is *extensive* debugging text built into this library. +While you're working on development, there is _extensive_ debugging text built into this library. More on that is in the [Code Debugging](https://github.com/EnviroDIY/ModularSensors/wiki/Code-Debugging) page. In fact, there is _so much_ debugging that turning it on universally through a build flag will cause the program to be too big to fit on a Mayfly and will likely crash a SAMD board's on-board USB drivers. diff --git a/docs/FAQ/Power-Parasites.md b/docs/FAQ/Power-Parasites.md index 5d7c907c5..79cd4cfe8 100644 --- a/docs/FAQ/Power-Parasites.md +++ b/docs/FAQ/Power-Parasites.md @@ -1,4 +1,4 @@ -# 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. @@ -9,17 +9,17 @@ For most sensors, this library attempts to set all data pins low when sending th If you are still seeing "parasitic" power draw, here are some work-arounds you can try: - For sensors (and adapters) drawing power over a serial line: - - Write-out your entire loop function. + - Write-out your entire loop function. (Don't just use `logData()`.) - - Add a `SerialPortName.begin(BAUD);` statement to the beginning of your loop, before `sensorsPowerUp()`. - - After `sensorsPowerDown()` add `SerialPortName.end(BAUD);`. - - After "ending" the serial communication, explicitly set your Rx and Tx pins low using `digitalWrite(#, LOW);`. + - Add a `SerialPortName.begin(BAUD);` statement to the beginning of your loop, before `sensorsPowerUp()`. + - After `sensorsPowerDown()` add `SerialPortName.end(BAUD);`. + - After "ending" the serial communication, explicitly set your Rx and Tx pins low using `digitalWrite(#, LOW);`. - For sensors drawing power over I2C: - - Many (most?) boards have external pull-up resistors on the hardware I2C/Wire pins which cannot be disconnected from the main power supply. + - Many (most?) boards have external pull-up resistors on the hardware I2C/Wire pins which cannot be disconnected from the main power supply. This means I2C parasitic power draw is best solved via hardware, not software. - - Use a specially designed I2C isolator - - Use a generic opto-isolator or other type of isolator on both the SCL and SDA lines - - In this future, this library _may_ offer the option of using software I2C, which would allow you to use the same technique as is currently usable to stop serial parasitic draw. + - Use a specially designed I2C isolator + - Use a generic opto-isolator or other type of isolator on both the SCL and SDA lines + - In this future, this library _may_ offer the option of using software I2C, which would allow you to use the same technique as is currently usable to stop serial parasitic draw. Until such an update happens, however, hardware solutions are required. The ["data_saving"](@todo add link to loop of datasaving example) example shows setting ending a serial stream and seeting pins low to prevent an RS485 adapter from drawing power during sleep. diff --git a/docs/FAQ/Processor-Compatibility.md b/docs/FAQ/Processor-Compatibility.md index 73c153218..ae8a36c87 100644 --- a/docs/FAQ/Processor-Compatibility.md +++ b/docs/FAQ/Processor-Compatibility.md @@ -1,22 +1,23 @@ -# Processor Compatibility +# Processor Compatibility [//]: # ( @tableofcontents ) [//]: # ( @m_footernavigation ) [//]: # ( 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-) + +- [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, Sodaq Mbili, Mighty 1284) +## AtMega1284p (EnviroDIY 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. @@ -32,17 +33,19 @@ Chip select/slave select is pin 12 on a Mayfly and card detect can be set to pin CS/SS and CD pins may vary for other boards. - There is a single I2C (Wire) interface on pins 17 (SDA) and 16 (SCL). - This processor has two built-in hardware TTL serial ports, Serial and Serial1 - - On most boards, Serial is connected to the FDTI chip for USB communication with the computer. + - On most boards, Serial is connected to the FDTI chip for USB communication with the computer. On both the Mayfly and the Mbili Serial1 is wired to the "Bee" sockets for communication with the modem. - AltSoftSerial can be used on pins 5 (Tx) and 6 (Rx) on the Mayfly or Mbili. Pin 4 should not be used while using AltSoftSerial on the Mayfly or Mbili. - - Unfortunately, the Rx and Tx pins are on different Grove plugs on both the Mayfly and the Mbili making AltSoftSerial somewhat inconvenient to use. + - Unfortunately, the Rx and Tx pins are on different Grove plugs on both the Mayfly and the Mbili making AltSoftSerial somewhat inconvenient to use. - AltSoftSerial can be used on pins 13 (Tx) and 14 (Rx) on the Mighty 1284 and other 1284p boards. 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. + ___ -## 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) @@ -57,15 +60,15 @@ At this time, the AtSAMD21 is only supported using the internal clock, but suppo Most boards connect the USB pins to a mini or microUSB connector for the computer connection. Depending on the software core of the board, you send data to the USB port as either "USBSerial" or simply "Serial". - Most variants have 2 hardware TTL serial ports ("Serial" on pins 30 (TX) and 31 (RX) and "Serial1" on pins 0 (TX) and 1 (RX)) configured by default. - - On an Arduino Zero "Serial" goes to the EDBG programming port. - - On a Sodaq Autonomo "Serial1" goes to the "Bee" port. - - On an Adafruit Feather M0 only "Serial1" is configured, "Serial" will go to the native USB port. + - On an Arduino Zero "Serial" goes to the EDBG programming port. + - On a Sodaq Autonomo "Serial1" goes to the "Bee" port. + - On an Adafruit Feather M0 only "Serial1" is configured, "Serial" will go to the native USB port. - Most variants have one SPI port configured by default (likely pins 22 (MISO), 23 (MOSI), and 24 (SCK)). Chip select/slave select and card detect pins vary by board. - Most variants have one I2C (Wire) interface configured by default (likely pins 20 (SDA) and 21 (SCL)). - There are up to _6_ total "sercom" ports hard which can be configured for either hardware serial, SPI, or I2C (wire) communication on this processor. -See https://learn.adafruit.com/using-atsamd21-sercom-to-add-more-spi-i2c-serial-ports/overview for more instructions on how to configure these ports, if you need them. -There are also examples for an Adafruit feather found in the menu a la carte example: https://github.com/EnviroDIY/ModularSensors/tree/master/examples/menu_a_la_carte +See for more instructions on how to configure these ports, if you need them. +There are also examples for an Adafruit feather found in the menu a la carte example: - AltSoftSerial is not supported on the AtSAMD21. - SoftwareSerial_ExtInts is not supported on the AtSAMD21. - NeoSWSerial is not supported at all on the AtSAMD21. @@ -75,9 +78,11 @@ If you need to debug, I recommend using a serial port monitor like [Tera Term](h Otherwise, you will have to rely on lights on your alert pin or your modem to verify the processor is waking/sleeping properly. - There are also some oddities with debugging on the SAMD21 where turning on some of the debugging code will cause the native USB to fail (and the board appear to be bricked). Turn off the debugging and double-tap to reset and reprogram if this happens. + ___ -## AtMega2560 (Arduino Mega) +## AtMega2560 (Arduino Mega) + Should be fully functional, but untested. - An external DS3231 or DS3232 RTC is required. @@ -88,9 +93,10 @@ Chip select/slave select is on pin 53. - If you still need more serial ports, AltSoftSerial can be used on pins 46 (Tx) and 48 (Rx). 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. + ___ -## AtMega644p (Sanguino) +## AtMega644p (Sanguino) Should be fully functional, but untested. @@ -103,9 +109,10 @@ Chip select/slave select and card detect pins vary by board. - AltSoftSerial can be used on pins 13 (Tx) and 14 (Rx). Pin 12 cannot be used while using AltSoftSerial on the AtMega644p. - Any digital pin can be used with NeoSWSerial, SoftwareSerial_ExtInts, or SDI-12. + ___ -## 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. @@ -119,9 +126,11 @@ SS/CS and CD pins may vary for other boards. - AltSoftSerial can be used on pins 9 (Tx) and 8 (Rx). Pin 10 cannot be used while using AltSoftSerial on the AtMega328p. - Any digital pin can be used with NeoSWSerial, SoftwareSerial_ExtInts, or SDI-12. + ___ -## 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. @@ -141,26 +150,27 @@ Chip select/slave select and card detect pins vary by board. - Because the USB controller is built into the processor, your USB serial connection will close as soon as the processor goes to sleep. If you need to debug, I recommend using a serial port monitor like Tera Term which will automatically renew its connection with the serial port when it connects and disconnects. Otherwise, you will have to rely on lights on your alert pin or your modem to verify the processor is waking/sleeping properly. + ___ -## 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. - - There is one SPI port on pins 74 (MISO), 76 (MOSI), and 75 (SCK). + - There is one SPI port on pins 74 (MISO), 76 (MOSI), and 75 (SCK). Pins 4, 10 and pin 52 can be used for CS/SS. - - There are I2C (Wire) interfaces on pins 20 (SDA) and 21 (SCL) and 70 (SDA1) and 71 (SCL1). - - This processor has one hardware serial port, USBSerial, which can _only_ be used for USB communication with a computer - - There are three additional 3.3V TTL serial ports: Serial1 on pins 19 (RX) and 18 (TX); Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX). + - There are I2C (Wire) interfaces on pins 20 (SDA) and 21 (SCL) and 70 (SDA1) and 71 (SCL1). + - This processor has one hardware serial port, USBSerial, which can _only_ be used for USB communication with a computer + - There are three additional 3.3V TTL serial ports: Serial1 on pins 19 (RX) and 18 (TX); Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX). Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip, which is connected to the USB debug port. - - AltSoftSerial is not directly supported on the AtSAM3X. - - SoftwareSerial_ExtInts is not supported on the AtSAM3X. - - SDI-12 is not supported on the AtSAM3X - - Any digital pin can be used with SDI-12. - - [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Processor-Datasheets/Atmel-AM3X-SAM3A-Datasheet.pdf) + - AltSoftSerial is not directly supported on the AtSAM3X. + - SoftwareSerial_ExtInts is not supported on the AtSAM3X. + - SDI-12 is not supported on the AtSAM3X + - Any digital pin can be used with SDI-12. + - [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Processor-Datasheets/Atmel-AM3X-SAM3A-Datasheet.pdf) - **ATtiny** - Unsupported. This chip has too little processing power and far too few pins and communication ports to ever use this library. - - [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Processor-Datasheets/Atmel-ATtiny25-45-85-Datasheet.pdf) + - [Datasheet](https://github.com/EnviroDIY/ModularSensors/wiki/Processor-Datasheets/Atmel-ATtiny25-45-85-Datasheet.pdf) - **Teensy 2.x/3.x** - Unsupported - **STM32** - Unsupported - **Nordic nRF52840** - Unsupported diff --git a/docs/General-Sensor-Notes.md b/docs/General-Sensor-Notes.md index b7dac75da..5fc5bfef0 100644 --- a/docs/General-Sensor-Notes.md +++ b/docs/General-Sensor-Notes.md @@ -1,4 +1,4 @@ -# 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. diff --git a/docs/Getting-Started/Getting-Started.md b/docs/Getting-Started/Getting-Started.md index e133a3e1f..14c54baae 100644 --- a/docs/Getting-Started/Getting-Started.md +++ b/docs/Getting-Started/Getting-Started.md @@ -1,10 +1,11 @@ -# Getting Started +# Getting Started [//]: # ( @tableofcontents ) [//]: # ( @m_footernavigation ) [//]: # ( Start GitHub Only ) + - [Getting Started](#getting-started) - [IDE and Driver Installation](#ide-and-driver-installation) - [Library Installation](#library-installation) @@ -18,20 +19,20 @@ 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. -## 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. Many Arduino style boards, including the EnviroDIY Mayfly, interface with the computer using an FTDI chip as a virtual com port. -The drivers and installation instructions for them are available on the FTDI website: https://www.ftdichip.com/Drivers/VCP.htm. +The drivers and installation instructions for them are available on the FTDI website: . **You must be an administrator on your computer to install drivers!** If you've used an Arduino before or installed the Arduino IDE, it's likely that these drivers are already on your computer. -Adafruit has a nice grouping of drivers for other boards and installation instructions here: https://learn.adafruit.com/adafruit-arduino-ide-setup/windows-driver-installation. +Adafruit has a nice grouping of drivers for other boards and installation instructions here: . After the drivers, you should install the IDE. Even if you've used the official Arduino IDE before, I _very, **very** strongly_ suggest installing and using [PlatformIO](https://platformio.org/) on either [Visual Studio Code](https://code.visualstudio.com/) or [Atom](https://atom.io/) -Visual Studio code can be downloaded from https://code.visualstudio.com/ and installed following the directions on that website. +Visual Studio code can be downloaded from and installed following the directions on that website. You do not need to be an administrator to install it. Once VSCode has been installed, open it. On the picture menu on the left click the extensions button. @@ -44,22 +45,21 @@ 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. -## 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/). If you use PlatformIO, the library will automatically be installed when you list it in your dependencies in your project's platformio.ini file. 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). - -## 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. When I first started with an Arduino, the step of setting the clock took me _**three days**_ to figure out. (Yes, three days. Yes, I was that lost! -My background is *not* in programming or engineering.) +My background is _not_ in programming or engineering.) After that experience, nearly the first program I decided was needed was an easier way to synchronize the clock. In fact, almost all of the example programs in this library that use a modern to connect to the internet will attempt to check the clock at start up. But, for safety, I suggest you set the clock separately. @@ -77,15 +77,14 @@ Pick whatever board you'll be working with from the drop down. For a new project, it's easiest to let PlatformIO set everything up in a new folder. - Once PlatformIO sets up the new project, find and open the newly created platformio.ini file. It should be a short file with one `[platformio]` section and one `[env]` section for the board you selected earlier. - - In the `[platformio]` section add this line: `src_dir = .pio/libdeps/mayfly/EnviroDIY_DS3231/examples/PCsync` - - In the `[env]` section add this line: `lib_deps = EnviroDIY_DS3231` + - In the `[platformio]` section add this line: `src_dir = .pio/libdeps/mayfly/EnviroDIY_DS3231/examples/PCsync` + - In the `[env]` section add this line: `lib_deps = EnviroDIY_DS3231` - Upload to your board. You shouldn't have to open or modify the program at all. -- Download and run this tiny clock-sync program: https://github.com/EnviroDIY/Sodaq_DS3231/blob/master/examples/PCsync/PCsync.exe?raw=true +- Download and run this tiny clock-sync program: - Your clock should be set! - -## Writing Your Logger Program +## Writing Your Logger Program The set-up in for your logger program PlatformIO is pretty simple: @@ -94,7 +93,7 @@ Pick whatever board you'll be working with. Again, it's easiest to let PlatformIO set everything up in a new folder. - Find and open the newly created platformio.ini file in your directory. In the `[env]` section add these lines: - - It is important that your configuration has the lib_ldf_mode and build flags set as show below. + - It is important that your configuration has the lib_ldf_mode and build flags set as show below. Without this, the library won't compile. ```ini @@ -110,14 +109,13 @@ build_flags = - Download the "ino" file for whatever example you think will be most similar to what you'll be doing. Put the ino into the src directory of your project. - - Delete main.cpp in that folder. + - Delete main.cpp in that folder. - Do a test build before changing the example just to make sure it compiles. Note: before compiling the first time, PlatformIO has to download the library and is dependencies so be patient. The download only happens once. - If the build succeeds, you're ready to move on. - -## 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. @@ -127,40 +125,39 @@ There's no reason you need to use the same pin assignments. Do make sure you create or reference all of the variables for your sensors in your variable array. The examples currently available are: + - [menu_a_la_carte](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/menu_a_la_carte) - - This shows most of the functions of the library at once. + - This shows most of the functions of the library at once. It has code in it for every possible sensor and modem and for both AVR and SAMD boards. It is also over 1500 lines long. - [single_sensor](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/single_sensor) - - This shows making use of the unified set of commands to print data from a MaxBotix ultrasonic range finder to the serial port. + - This 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. - [DRWI_CitSci](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/) - - This example uses the sensors and equipment standard groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. + - This 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. - [DRWI_NoCellular](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_NoCellular) - - This also uses the sensors and equipment standard to the DRWI Citizen Science grant but omits the modem for circumstances where there is no cellular signal. + - This also uses the sensors and equipment standard to the DRWI Citizen Science grant but omits the modem for circumstances where there is no cellular signal. - [logging_to_ThingSpeak](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/logging_to_ThingSpeak) - - This uses an ESP8266 to send data to ThingSpeak. + - This 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+. - [baro_rho_correction](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/baro_rho_correction) - - This example demonstrates how to work with calculated variables and calculates water depth by correcting the total pressure measured by a Measurement Specialties MS5803 with the atmospheric pressure measured by a Bosch BME280 environmental sensor and the temperature measured by a Maxim DS18 temperature probe. + - This example demonstrates how to work with calculated variables and calculates water depth by correcting the total pressure measured by a Measurement Specialties MS5803 with the atmospheric pressure measured by a Bosch BME280 environmental sensor and the temperature measured by a Maxim DS18 temperature probe. - [double_logger](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/double_logger) - - 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 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. - [data_saving](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/) - - 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. + - 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. 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. - -## 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. - [//]: # ( @section page_getting_started_other Other Helpful Pages to Get Started ) [//]: # ( @subpage page_library_dependencies ) diff --git a/docs/Getting-Started/Library-Dependencies.md b/docs/Getting-Started/Library-Dependencies.md index e182a4cc6..24b82c061 100644 --- a/docs/Getting-Started/Library-Dependencies.md +++ b/docs/Getting-Started/Library-Dependencies.md @@ -1,4 +1,4 @@ -# 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 3adc2bfe4..68be03dd6 100644 --- a/docs/Getting-Started/Physical-Dependencies.md +++ b/docs/Getting-Started/Physical-Dependencies.md @@ -1,17 +1,17 @@ -# 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: - A sufficiently powerful AVR or SAMD processor mounted on some sort of circuit board. (See [Processor/Board Compatibility](https://envirodiy.github.io/ModularSensors/page_processor_compatibility.html) for more details on specific processors and boards that are supported.) - - For all AVR processors, you must also have a [Maxim DS3231](https://www.maximintegrated.com/en/products/digital/real-time-clocks/DS3231.html) high precision I2C real-time clock with the SQE/INT pin connected to a pin on your processor which supports either external or pin-change interrupts. - - For SAMD boards, this library makes use of their on-board (though less accurate) real-time clock. + - For all AVR processors, you must also have a [Maxim DS3231](https://www.maximintegrated.com/en/products/digital/real-time-clocks/DS3231.html) high precision I2C real-time clock with the SQE/INT pin connected to a pin on your processor which supports either external or pin-change interrupts. + - For SAMD boards, this library makes use of their on-board (though less accurate) real-time clock. - A SD card reader attached to the processor via SPI. - Environmental sensors - A battery to power the system - A solar charging circuit - A modem-type unit to communicate remote data (Optional for logging data, but required for sending data directly to the internet. - - The list of supported modems is available here: https://envirodiy.github.io/ModularSensors/index.html#mainpage_modems + - The list of supported modems is available here: - Protected water-proof enclosures and mountings for all of the above - An OTG cable to connect serial output from the board to a cell phone (Optional, but very helpful for debugging.) diff --git a/docs/Getting-Started/Terminology.md b/docs/Getting-Started/Terminology.md index 603d8afff..41c001321 100644 --- a/docs/Getting-Started/Terminology.md +++ b/docs/Getting-Started/Terminology.md @@ -1,6 +1,6 @@ -# Library Terminology +# Library Terminology -## Terms +## Terms Within this library, a Sensor, a Variable, and a Logger mean very specific things: @@ -9,6 +9,7 @@ Within this library, a Sensor, a Variable, and a Logger mean very specific thing [//]: # ( @m_footernavigation ) [//]: # ( Start GitHub Only ) + - [Library Terminology](#library-terminology) - [Terms](#terms) - [Sensor](#sensor) @@ -20,7 +21,7 @@ Within this library, a Sensor, a Variable, and a Logger mean very specific thing [//]: # ( End GitHub Only ) -### 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. @@ -29,14 +30,14 @@ They may be awoken or activated and then returned to a sleeping/low power use st The may need to be asked to begin a single reading or they may continuously return data. They _**must**_ be capable of returning the value of their readings to a logger of some type. -The detailed Sensor class documentation is here: https://envirodiy.github.io/ModularSensors/class_sensor.html +The detailed Sensor class documentation is here: -### 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. The [names](http://vocabulary.odm2.org/variablename/) and [units](http://vocabulary.odm2.org/units/) of measurements for all variables come from the controlled vocabularies developed for the ODM2 data system. -(http://vocabulary.odm2.org/) The resolution is determined by the method used to take the measurement by the sensor. +() The resolution is determined by the method used to take the measurement by the sensor. A variable may also be assigned a universally unique identifier (UUID) and a unique variable code. Many sensors are capable of measuring multiple variables at a single time. For example, a Meter Hydros 21 is a _sensor_. @@ -45,21 +46,21 @@ The variable named "specificConductance" has _units_ of microsiemens per centime Each measured variable is explicitly tied to the "parent" sensor that "notifies" the variable when a new value has been measured. Each calculated variable has a parent function returning a float which is the value for that variable. -The Variable class documentation is here: https://envirodiy.github.io/ModularSensors/class_variable.html +The Variable class documentation is here: Variables are grouped together into VariableArrays. -The VariableArray class documentation is here: https://envirodiy.github.io/ModularSensors/class_variable_array.html +The VariableArray class documentation is here: -### 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 +The Logger class documentation is here: -### Modem +### Modem -![](https://en.wikipedia.org/wiki/Modem#/media/File:Analogue_modem_-_acoustic_coupler.jpg) +[![Old School Modem](https://upload.wikimedia.org/wikipedia/commons/e/e5/Analogue_modem_-_acoustic_coupler.jpg)](https://en.wikipedia.org/wiki/Modem) A modem is a [system on a chip](https://en.wikipedia.org/wiki/System_on_a_chip) or [system on a module](https://en.wikipedia.org/wiki/System_on_module) a that can communicate with the logger's MCU and with the world wide web. This doesn't mean something that makes [beeps and bloops](https://en.wikipedia.org/wiki/Modem#/media/File:Analogue_modem_-_acoustic_coupler.jpg) on the phone line. @@ -69,19 +70,17 @@ The two communcicate via serial lines. Within this library, the modem is represented as a loggerModem object. All loggerModem functions are heavily dependent on the [TinyGSM](https://github.com/EnviroDIY/TinyGSM) library. -The loggerModem class documentation is available here: https://envirodiy.github.io/ModularSensors/classlogger_modem.html - +The loggerModem class documentation is available here: -### 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. Within the functioning of the library, the dataPublisher "watches" the logger for new data and correctly formats and sends that data to some online web service. -The dataPublisher class documentation is available here: https://envirodiy.github.io/ModularSensors/classdata_publisher.html - +The dataPublisher class documentation is available here: -## 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 4a5c841cb..f128d023b 100644 --- a/docs/Modem-Notes.md +++ b/docs/Modem-Notes.md @@ -1,10 +1,11 @@ -# Notes about Modems +# Notes about Modems [//]: # ( @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) - [Default baud rates of supported modules](#default-baud-rates-of-supported-modules) @@ -17,8 +18,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. - -## Summary of Classes to use for Various Manufactured Modules +## Summary of Classes to use for Various Manufactured Modules | Module | Class | | :-------------------------------------------: | :----------------------------------------------: | @@ -56,7 +56,7 @@ If you are having trouble, please see the pages for the specific modems and the *** -## Default baud rates of supported modules +## Default baud rates of supported modules | Module | Default Baud Rate | | :--------------------------------: | :------------------------------------------------------: | @@ -71,14 +71,14 @@ If you are having trouble, please see the pages for the specific modems and the *** -## 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. **The most common symptom of insufficient power is that the module will not connect to the internet.** Most modules are capable of serial communication and some level of functionality at current levels much below ideal, but will silently refuse to make a network connection. -@see https://github.com/vshymanskyy/TinyGSM/wiki/Powering-GSM-module +@see | Module | Operating Voltage | Minimum Current Required | Power Pin Label | | :----------------------------------: | :---------------: | :-------------------------------: | :-------------: | @@ -105,7 +105,7 @@ Most modules are capable of serial communication and some level of functionality *** -## Sleep and Reset Pin Labels +## Sleep and Reset Pin Labels | Module | Status Pin Label | Reset Label | Wake / Sleep Request | | :---------------------------: | :-----------------------------------------: | :---------: | :-----------------------------------------: | @@ -130,7 +130,7 @@ Most modules are capable of serial communication and some level of functionality *** -## Pin Numbers to Use when Connecting to a Mayfly 0.x +## Pin Numbers to Use when Connecting to a Mayfly 0.x 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. @@ -147,7 +147,6 @@ Here are the pin numbers to use for modules that can be attached directly to an | 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. If you turn off the Mayfly via its switch but leave the XBee connected as above, it will drain your battery very quickly. Disconnect the battery if you turn off the Mayfly. @@ -160,10 +159,10 @@ Instead, you must use the XBee's `CTS` pin (pin 12) which is connected to Mayfly 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. +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. -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. +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). @@ -171,6 +170,7 @@ With those connections made, the Dragino BG96 becomes the _**only**_ LTE module 9 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); @@ -178,7 +178,7 @@ modem.setModemResetLevel(HIGH); *** -## Pin Numbers to Use when Connecting to a Mayfly 1.x +## 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. @@ -194,7 +194,6 @@ Here are the pin numbers to use for modules that can be attached directly to an | Sodaq UBee LTE-M (u-blox SARA R410M) | 23 | 19 | A53 | 20 | | Sodaq UBee 3G (u-blox SARA U201) | 23 | 19 | A53 | 20 | - ¹ 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. @@ -205,6 +204,7 @@ Alternately (and preferably) you can change solder jumper 19 (SJ19) to connect b 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); diff --git a/docs/directories.dox b/docs/directories.dox new file mode 100644 index 000000000..b5051b336 --- /dev/null +++ b/docs/directories.dox @@ -0,0 +1,15 @@ +/** + * @dir docs + * + * @brief Contains extra documentation and files to help build the documentation + */ +/** + * @dir docs/FAQ + * + * @brief Contains documentation on frequently asked questions + */ +/** + * @dir docs/Getting-Started + * + * @brief Contains documentation for new users + */ diff --git a/docs/doxygen_extra_pages.dox b/docs/doxygen_extra_pages.dox index 22c3817dd..e51526828 100644 --- a/docs/doxygen_extra_pages.dox +++ b/docs/doxygen_extra_pages.dox @@ -26,4 +26,4 @@ Here are links to detailed information about the various supported sensors and m @subpage page_sensor_notes @subpage page_modem_notes -*/ \ No newline at end of file +*/ diff --git a/docs/fixFunctionsInGroups.py b/docs/fixFunctionsInGroups.py deleted file mode 100644 index 31297c63f..000000000 --- a/docs/fixFunctionsInGroups.py +++ /dev/null @@ -1,98 +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_group_files = [ - f - for f in os.listdir(abs_file_path) - if os.path.isfile(os.path.join(abs_file_path, f)) - and f.startswith("group") - and not f.endswith("fixed") -] - -for filename in all_group_files: - abs_in = os.path.join(abs_file_path, filename) - abs_out = os.path.join(abs_file_path, filename + "_fixed") - print("{}".format(abs_in)) - # print("out: {}".format(abs_out)) - # with open(output_file, 'w+') as out_file: - with open(abs_out, "w+") as out_file: - with open(abs_in, "r") as in_file: # open in readonly mode - lines = in_file.readlines() - for line in lines: - new_line = line - new_line = new_line.replace("<mcss:", "") - new_line = new_line.replace("</span>", "") - new_line = new_line.replace( - "mcss:class="m-dim">", 'mcss:class="m-dim">' - ) - new_line = new_line.replace( - "class="m-dim">", 'class="m-dim">' - ) - new_line = new_line.replace( - "mcss:class="m-param">", 'mcss:class="m-param">' - ) - new_line = new_line.replace( - "class="m-param">", 'class="m-param">' - ) - new_line = new_line.replace( - "mcss:class="m-doc-wrap">", 'mcss:class="m-doc-wrap">' - ) - new_line = new_line.replace( - "class="m-doc-wrap">", 'class="m-doc-wrap">' - ) - new_line = new_line.replace("<span", "', - '\nParameters', - ) - new_line = new_line.replace("", "
") - - new_line = new_line.replace("", "") - new_line = new_line.replace("", "") - - new_line = new_line.replace("\n", "") - new_line = new_line.replace("\n", "") - - new_line = new_line.replace( - "", - '', - ) - new_line = new_line.replace("", "") - - new_line = new_line.replace( - "", '' - ) - new_line = new_line.replace("", "") - - out_file.write(new_line) - - 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), - ) diff --git a/docs/fixSectionsInXml.py b/docs/fixSectionsInXml.py deleted file mode 100644 index 682c64b89..000000000 --- a/docs/fixSectionsInXml.py +++ /dev/null @@ -1,137 +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") -] - -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/mcss-conf.py b/docs/mcss-conf.py index 6ce174b44..0a9c1c85a 100644 --- a/docs/mcss-conf.py +++ b/docs/mcss-conf.py @@ -45,31 +45,67 @@ # ), # ], ), - ("Library Dependencies", "page_library_dependencies",), - ("Physical Dependencies", "page_physical_dependencies",), - ("Terminology", "page_library_terminology",), - ("Other Sensor and Modem Notes", "page_other_notes",), + ( + "Library Dependencies", + "page_library_dependencies", + ), + ( + "Physical Dependencies", + "page_physical_dependencies", + ), + ( + "Terminology", + "page_library_terminology", + ), + ( + "Other Sensor and Modem Notes", + "page_other_notes", + ), ], ), ( "FAQs", "page_faq", [ - ("Processor Compatibility", "page_processor_compatibility",), - ("Arduino Streams and Software Serial", "page_arduino_streams",), - ("Power Draw over Data Lines", "page_power_parasites",), + ( + "Processor Compatibility", + "page_processor_compatibility", + ), + ( + "Arduino Streams and Software Serial", + "page_arduino_streams", + ), + ( + "Power Draw over Data Lines", + "page_power_parasites", + ), ("Decreasing Memory Footprint", "page_memory_use"), - ("In-Library Debugging", "page_code_debugging",), - ("For Developers", "page_for_developers",), + ( + "In-Library Debugging", + "page_code_debugging", + ), + ( + "For Developers", + "page_for_developers", + ), ], ), - ("Modules", "modules", []), - ("Classes", "annotated", [],), - ("Source Files", "files", [],), + ("Topics", "topics", []), + ( + "Classes", + "annotated", + [], + ), + ( + "Source Files", + "files", + [], + ), ( "Examples", "page_the_examples", [], + # [("Other Helper Sketches", "page_extra_helper_sketches")], # [ # ( # "Basic Functionality", @@ -115,7 +151,11 @@ # ), # ], ), - ("More", "pages", [],), + ( + "More", + "pages", + [], + ), ] LINKS_NAVBAR2 = [] VERSION_LABELS = True @@ -124,3 +164,15 @@ STYLESHEETS = [ "css/m-EnviroDIY+documentation.compiled.css", ] + +EXTRA_FILES = [ + "gp-desktop-logo.png", + "gp-mobile-logo.png", + "gp-scrolling-logo.png", + "clipboard.js", +] +DESKTOP_LOGO = "gp-desktop-logo.png" +MOBILE_LOGO = "gp-mobile-logo.png" +SCROLLING_LOGO = "gp-scrolling-logo.png" +M_MATH_RENDER_AS_CODE = False +M_MATH_CACHE_FILE = "m.math.cache" diff --git a/examples/DRWI_2G/ReadMe.md b/examples/DRWI_2G/ReadMe.md index 38ad72709..19dbcc60d 100644 --- a/examples/DRWI_2G/ReadMe.md +++ b/examples/DRWI_2G/ReadMe.md @@ -1,13 +1,13 @@ -# DRWI 2G Sites +# DRWI 2G Sites This code was used for DRWI monitoring stations in 2016-2022. The 2G GPRSbee cellular boards no longer function in the USA, so this code should not be used and is only provided to archival and reference purposes. The exact hardware configuration used in this example: - * Mayfly v0.5b board - * SODAQ GPRSbee 2G cell module (with Hologram SIM card) - * Hydros21 CTD sensor - * Campbell OBS3+ turbidity sensor +- Mayfly v0.5b board +- SODAQ GPRSbee 2G cell module (with Hologram SIM card) +- Hydros21 CTD sensor +- Campbell OBS3+ turbidity sensor _______ @@ -16,37 +16,41 @@ _______ [//]: # ( @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) - - [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) - - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) - - [Upload!](#upload) + - [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) + - [Set the logger ID](#set-the-logger-id) + - [Set the calibration coefficients for the Campbell OBS3+](#set-the-calibration-coefficients-for-the-campbell-obs3) + - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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. -# To Use this Example +## To Use this Example -## Prepare and set up PlatformIO -- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) +### Prepare and set up PlatformIO + +- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal () - 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. - - 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. + - 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 [DRWI_CitSci.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/DRWI_CitSci/DRWI_CitSci.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -54,12 +58,13 @@ _______ const char *LoggerID = "XXXX"; ``` -## 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**_. - - The sketch will not compile if these values are not entered properly. - - Do not change any values except those that are `0.000E+00` and `1.000E+00`! + - The sketch will not compile if these values are not entered properly. + - Do not change any values except those that are `0.000E+00` and `1.000E+00`! ```cpp // ========================================================================== @@ -83,8 +88,9 @@ const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, OBSHigh_C, ADSi2c_addr, OBS3numberReadings); ``` -## 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/) +### 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 () - 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: @@ -122,12 +128,12 @@ const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampli ``` -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ - [//]: # ( @section example_drwi_2g_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} DRWI_2G/platformio.ini ) diff --git a/examples/DRWI_DigiLTE/ReadMe.md b/examples/DRWI_DigiLTE/ReadMe.md index f7393cd92..52ea73215 100644 --- a/examples/DRWI_DigiLTE/ReadMe.md +++ b/examples/DRWI_DigiLTE/ReadMe.md @@ -1,13 +1,13 @@ -# DRWI Digi LTE Sites +# DRWI Digi LTE Sites This example uses the sensors and equipment common to older stations (2016-2020) deployed by groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros21 CTD (formerly know as a Decagon), a Campbell OBS3+ (Turbidity), and a Digi XBee3 LTE-M cellular board for communication. The Digi LTE module also required the use of a EnviroDIY LTEbee Adapter board (discontinued in 2021). The Digi LTE modules are no longer recommended for use and have been replace by the EnviroDIY LTEbee in all DRWI-SWRC-managed stations. The exact hardware configuration used in this example: - * Mayfly v0.5b board - * Digi Xbee LTE module (with Hologram SIM card and EnviroDIY bee adapter) - * Hydros21 CTD sensor - * Campbell OBS3+ turbidity sensor +- Mayfly v0.5b board +- Digi XBee LTE module (with Hologram SIM card and EnviroDIY bee adapter) +- Hydros21 CTD sensor +- Campbell OBS3+ turbidity sensor _______ @@ -16,37 +16,43 @@ _______ [//]: # ( @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) - - [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) - - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) - - [Upload!](#upload) + - [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) + - [Set the logger ID](#set-the-logger-id) + - [Set the calibration coefficients for the Campbell OBS3+](#set-the-calibration-coefficients-for-the-campbell-obs3) + - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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. -# To Use this Example +## To Use this Example + +### Prepare and set up PlatformIO + +- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal () -## 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. - - 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. + - 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 [DRWI_DigiLTE.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/DRWI_DigiLTE/DRWI_DigiLTE.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -54,12 +60,14 @@ _______ const char *LoggerID = "XXXX"; ``` -## 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**_. - - The sketch will not compile if these values are not entered properly. - - Do not change any values except those that are `0.000E+00` and `1.000E+00`! + - The sketch will not compile if these values are not entered properly. + - Do not change any values except those that are `0.000E+00` and `1.000E+00`! ```cpp // ========================================================================== @@ -83,8 +91,10 @@ const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, OBSHigh_C, ADSi2c_addr, OBS3numberReadings); ``` -## 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/) +### 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 () + - 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: @@ -122,12 +132,12 @@ const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampli ``` -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ - [//]: # ( @section example_drwi_digilte_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} DRWI_DigiLTE/platformio.ini ) diff --git a/examples/DRWI_Mayfly1/ReadMe.md b/examples/DRWI_Mayfly1/ReadMe.md index 6afa25eed..b026248df 100644 --- a/examples/DRWI_Mayfly1/ReadMe.md +++ b/examples/DRWI_Mayfly1/ReadMe.md @@ -1,12 +1,14 @@ -# DRWI Sites with a Mayfly 1.x and EnviroDIY LTE Bees +# DRWI Sites with a Mayfly 1.x and EnviroDIY LTE Bee + Example sketch for using the EnviroDIY SIM7080G LTE cellular module with an EnviroDIY Mayfly Data Logger. This example uses the sensors and equipment used by most groups participating in the DRWI (Delaware River Watershed Initiative) Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros 21 (CTD) and a SIM7080G-based EnviroDIY LTEbee 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. Only to be used with newer Mayfly v1.0 and v1.1 boards. The exact hardware configuration used in this example: - * Mayfly v1.x board - * EnviroDIY SIM7080 LTE module (with Hologram SIM card) - * Hydros21 CTD sensor + +- Mayfly v1.x 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. @@ -17,7 +19,7 @@ The EnviroDIY LTE SIM7080 module includes 2 antennas in the package. The small 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) -Users purchasing a new Hydros21 CTD sensor will need to change the SDI-12 address of the sensor in order to use this sketch. Full instructions for using this sketch as part of a monitoring station can be found in the EnviroDIY Monitoring Station Manual. +Users purchasing a new Hydros21 CTD sensor will need to change the SDI-12 address of the sensor in order to use this sketch. Full instructions for using this sketch as part of a monitoring station can be found in the EnviroDIY Monitoring Station Manual. _______ [//]: # ( @tableofcontents ) @@ -25,18 +27,19 @@ _______ [//]: # ( @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) + +- [DRWI Sites with a Mayfly 1.x and EnviroDIY LTE Bee](#drwi-sites-with-a-mayfly-1x-and-envirodiy-lte-bee) + - [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 Mayfly 1.x 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 - [//]: # ( @section example_drwi_mayfly1_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} DRWI_Mayfly1/platformio.ini ) diff --git a/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino b/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino index 022cc0638..ee68b1d41 100644 --- a/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino +++ b/examples/DRWI_Mayfly1_WiFi/DRWI_Mayfly1_WiFi.ino @@ -11,6 +11,8 @@ * Mayfly v1.x board * EnviroDIY ESP32 Wifi Bee module * Hydros21 CTD sensor + * + * @m_examplenavigation{example_drwi_mayfly1_wifi,} * ======================================================================= */ // ========================================================================== @@ -306,6 +308,8 @@ void setup() { // Begin the logger dataLogger.begin(); + EnviroDIYPOST.begin(dataLogger, &modem.gsmClient, registrationToken, + samplingFeature); // Note: Please change these battery voltages to match your battery // Set up the sensors, except at lowest battery level diff --git a/examples/DRWI_Mayfly1_WiFi/ReadMe.md b/examples/DRWI_Mayfly1_WiFi/ReadMe.md index 511a36e48..4ed62c5a6 100644 --- a/examples/DRWI_Mayfly1_WiFi/ReadMe.md +++ b/examples/DRWI_Mayfly1_WiFi/ReadMe.md @@ -1,10 +1,12 @@ -# DRWI Sites with a Mayfly 1.x and EnviroDIY ESP32 WiFi Bees +# DRWI Sites with a Mayfly 1.x and EnviroDIY ESP32 WiFi Bee + Example sketch for using the EnviroDIY ESP32 WiFi cellular module with an EnviroDIY Mayfly Data Logger. The exact hardware configuration used in this example: - * Mayfly v1.1 board - * EnviroDIY ESP32 WiFi module - * Hydros21 CTD sensor + +- Mayfly v1.1 board +- EnviroDIY ESP32 WiFi module +- Hydros21 CTD sensor An EnviroDIY ESP32 WiFi module can also be used with the older Mayfly v0.5b boards if you change line 95 (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. @@ -12,7 +14,7 @@ Mayfly v0.5b has the Bee socket constantly powered, therefore using "-1" is the The WiFi antenna is built into the ESP32 Bee - no external antenna is needed -Be sure to edit lines 101 and 102 to enter your Wifi access point name and password, and edit the UUID section beginning at line 200 with the correct UUIDs from your specific site on MonitorMyWatershed. +Be sure to edit lines 101 and 102 to enter your Wifi access point name and password, and edit the UUID section beginning at line 200 with the correct UUIDs from your specific site on MonitorMyWatershed. _______ @@ -21,18 +23,19 @@ _______ [//]: # ( @m_footernavigation ) [//]: # ( Start GitHub Only ) -- [DRWI Sites with a Mayfly 1.x and EnviroDIY ESP32 WiFi Bees ](#drwi-sites-with-a-mayfly-1x-and-envirodiy-esp32-wifi-bees-) -- [Unique Features of the DRWI Mayfly 1.x WiFi Example ](#unique-features-of-the-drwi-mayfly-1x-wifi-example-) + +- [DRWI Sites with a Mayfly 1.x and EnviroDIY ESP32 WiFi Bee](#drwi-sites-with-a-mayfly-1x-and-envirodiy-esp32-wifi-bee) + - [Unique Features of the DRWI Mayfly 1.x WiFi Example](#unique-features-of-the-drwi-mayfly-1x-wifi-example) [//]: # ( End GitHub Only ) _______ -# Unique Features of the DRWI Mayfly 1.x WiFi Example +## Unique Features of the DRWI Mayfly 1.x WiFi Example + - Specifically for sites within the Delaware River Watershed Initiative. - Uses a EnviroDIY WiFi Bee based on the Espressif ESP32-WROOM-32 - [//]: # ( @section example_drwi_mayfly1_wifi_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} DRWI_Mayfly1_WiFi/platformio.ini ) diff --git a/examples/DRWI_NoCellular/ReadMe.md b/examples/DRWI_NoCellular/ReadMe.md index 1ebd61948..5f627ecf7 100644 --- a/examples/DRWI_NoCellular/ReadMe.md +++ b/examples/DRWI_NoCellular/ReadMe.md @@ -1,15 +1,15 @@ -# 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. The exact hardware configuration used in this example: - * Mayfly v1.x board - * Hydros21 CTD sensor - * Campbell OBS3+ turbidity sensor +- Mayfly v1.x board +- Hydros21 CTD sensor +- Campbell OBS3+ turbidity sensor -Before using this example, you must register a site and sensors at the data portal (http://data.envirodiy.org/). +Before using this example, you must register a site and sensors at the data portal (). After you have registered the site and sensors, the portal will generate a registration token and universally unique identifier (UUID) for each site and further UUID's for each variable. You will need to copy all of those UUID values into your sketch to replace the `12345678-abcd-1234-ef00-1234567890ab` place holders in this example. __You should register even if your logger will not be sending live data.__ This ensures that the data file your logger writes will be ready to immediately upload to the portal. @@ -21,37 +21,41 @@ _______ [//]: # ( @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) - - [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) - - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) - - [Upload!](#upload) + - [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) + - [Set the logger ID](#set-the-logger-id) + - [Set the calibration coefficients for the Campbell OBS3+](#set-the-calibration-coefficients-for-the-campbell-obs3) + - [Set the universally universal identifiers (UUID) for each variable](#set-the-universally-universal-identifiers-uuid-for-each-variable) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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. -# To Use this Example +## To Use this Example -## Prepare and set up PlatformIO -- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) +### Prepare and set up PlatformIO + +- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal () - 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. - - 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. + - 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 [DRWI_NoCellular.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/DRWI_NoCellular/DRWI_NoCellular.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -59,12 +63,13 @@ _______ const char *LoggerID = "XXXX"; ``` -## 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**_. - - The sketch will not compile if these values are not entered properly. - - Do not change any values except those that are `0.000E+00` and `1.000E+00`! +- 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__*. + - The sketch will not compile if these values are not entered properly. + - Do not change any values except those that are `0.000E+00` and `1.000E+00`! ```cpp // ========================================================================== @@ -88,10 +93,11 @@ const float OBSHigh_C = 0.000E+00; // "C" value [*high* range] CampbellOBS3 osb3high(OBS3Power, OBSHighADSChannel, OBSHigh_A, OBSHigh_B, OBSHigh_C, ADSi2c_addr, OBS3numberReadings); ``` -## 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/) +### 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 () - 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: +- __VERY CAREFULLY__ check that the variables are in exactly the same order as in the variable array: ```cpp Variable* variableList[] = { @@ -99,7 +105,7 @@ Variable* variableList[] = { } ``` -- If any of the variables are in a different order on the web page than in your code **reorder the variables in your code to match the website**. +- If any of the variables are in a different order on the web page than in your code __reorder the variables in your code to match the website__. - After you are completely certain that you have the order right in the variable section of your code use the teal "Copy" button on the website to copy the section of code containing all of the UUID's. - Paste the code from the website into your program in this section below the variable array @@ -125,11 +131,11 @@ const char* samplingFeature = "12345678-abcd-1234-ef00-1234567890ab"; // Sampli ``` -## Upload! -- Test everything at home **before** deploying out in the wild! +### Upload! -_______ +- Test everything at home __before__ deploying out in the wild! +_______ [//]: # ( @section example_drwi_no_cell_pio_config PlatformIO Configuration ) diff --git a/examples/DRWI_SIM7080LTE/ReadMe.md b/examples/DRWI_SIM7080LTE/ReadMe.md index 2b3e0237f..f2192d9ce 100644 --- a/examples/DRWI_SIM7080LTE/ReadMe.md +++ b/examples/DRWI_SIM7080LTE/ReadMe.md @@ -1,12 +1,13 @@ -# DRWI Sites with EnviroDIY LTE Bees +# DRWI Sites with EnviroDIY LTE Bees The DRWI EnviroDIY LTEbee example uses the sensors and equipment common to older stations (2016-2020) deployed by groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros 21 (CTD), a Campbell OBS3+, (Turbidity) and a SIM7080G-based EnviroDIY LTEbee for communication. The exact hardware configuration used in this example: - * Mayfly v1.x board - * EnviroDIY SIM7080 LTE module (with Hologram SIM card) - * Hydros21 CTD sensor - * Campbell Scientific OBS3+ Turbidity sensor + +- Mayfly v1.x board +- EnviroDIY SIM7080 LTE module (with Hologram SIM card) +- Hydros21 CTD sensor +- Campbell Scientific OBS3+ Turbidity 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.0 board has a separate 3.3v regulator to power the Bee socket and is controlled by turning pin 18 on or off. @@ -24,18 +25,19 @@ _______ [//]: # ( @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) + - [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 +## 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 ) diff --git a/examples/ReadMe.md b/examples/ReadMe.md index 59808ebe4..f12f86840 100644 --- a/examples/ReadMe.md +++ b/examples/ReadMe.md @@ -1,4 +1,4 @@ -# Examples Using ModularSensors +# Examples Using ModularSensors These example programs demonstrate how to use the modular sensors library. Each example has slightly different functionality. @@ -6,6 +6,7 @@ Each example has slightly different functionality. ___ [//]: # ( Start GitHub Only ) + - [Examples Using ModularSensors](#examples-using-modularsensors) - [Basic Functionality](#basic-functionality) - [Single Sensor](#single-sensor) @@ -20,7 +21,7 @@ ___ - [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 EnviroDIY LTEbee](#drwi-envirodiy-ltebee) - [DRWI Digi LTE](#drwi-digi-lte) - [DRWI CitSci (2G)](#drwi-citsci-2g) - [DRWI CitSci No Cellular](#drwi-citsci-no-cellular) @@ -33,9 +34,9 @@ ___ [//]: # ( @m_footernavigation ) -## Basic Functionality +## Basic Functionality -### 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. @@ -43,16 +44,14 @@ It also shows creating a calculated variable which is the water depth. - [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) - -### 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/example_simple_logging.html) - [The simple logging example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/simple_logging) - -### 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. @@ -60,20 +59,18 @@ It is very similar to the other simple logging example, with just a few extra se - [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) - ___ -## Publishing Data +## Publishing Data -### 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/example_mmw.html) - [The logging to Monitor My Watershed example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/logging_to_MMW) - -### 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+. @@ -81,20 +78,18 @@ It also includes a Meter Hydros 21 (formerly know as a Decagon CTD) and a Campbe - [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) - ___ -## Calculations and Complex Logging +## Calculations and Complex Logging -### 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/example_baro_rho.html) - [The barometric pressure correction example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/baro_rho_correction) - -### 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. @@ -102,8 +97,7 @@ This showcases both how to use two different logging instances and how to use so - [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) - -### 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. @@ -113,12 +107,11 @@ This example also shows how to stop power draw from an RS485 adapter with automa - [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) - ___ -## DRWI Citizen Science +## DRWI Citizen Science -### DRWI Mayfly 1.x LTE +### DRWI Mayfly 1.x LTE The DRWI Mayfly 1.x LTE example uses the sensors and equipment used by most groups participating in the DRWI (Delaware River Watershed Initiative) Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros 21 (CTD) and a SIM7080G-based EnviroDIY LTEbee for communication. @@ -128,7 +121,7 @@ The results are saved to the SD card and posted to the Monitor My Watershed data - [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 LTEbee +### DRWI EnviroDIY LTEbee The DRWI EnviroDIY LTEbee example uses the sensors and equipment common to older stations (2016-2020) deployed by groups participating in the DRWI Citizen Science project with the Stroud Water Research Center. It includes a Meter Hydros 21 (CTD), a Campbell OBS3+, (Turbidity) and a SIM7080G-based EnviroDIY LTEbee for communication. @@ -138,18 +131,17 @@ The only difference between this and the other cellular DRWI examples below is t - [Instructions for the EnviroDIY LTEbee DRWI Citizen Science example](https://envirodiy.github.io/ModularSensors/example_drwi_ediylte.html) - [The EnviroDIY LTE DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) -### DRWI Digi LTE +### DRWI Digi LTE The DRWI Digi LTE example uses the sensors and equipment common to older stations (2016-2020) deployed by 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. +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 Digi LTE DRWI Citizen Science example on GitHub](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/DRWI_DigiLTE) - -### DRWI CitSci (2G) +### DRWI CitSci (2G) The 2G DRWI Citizen Science example uses the sensors and equipment found on older stations used in the DRWI Citizen Science project prior to 2020. The 2G GPRSbee boards no longer function in the USA, so this code should not be used and is only provided to archival and reference purposes. It includes a Meter Hydros 21 (formerly know as a Decagon CTD), a Campbell OBS3+, and a Sodaq GPRSBee for communication. @@ -159,8 +151,7 @@ The only difference between this and the other cellular DRWI examples is the typ - [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) - -### DRWI CitSci No Cellular +### DRWI CitSci No Cellular The DRWI no cellular example uses the sensors and equipment standard to the DRWI Citizen Science project but omits the data publisher for circumstances where there is no cellular signal. It includes a Meter Hydros 21 (CTD) and a Campbell OBS3+ (Turbidity). @@ -169,12 +160,11 @@ The exclusion of the modem and publisher simplifies the code from the other DRWI - [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) - ___ -## Everything at Once - a la carte +## Everything at Once - 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. diff --git a/examples/baro_rho_correction/ReadMe.md b/examples/baro_rho_correction/ReadMe.md index 1914527d0..828857f82 100644 --- a/examples/baro_rho_correction/ReadMe.md +++ b/examples/baro_rho_correction/ReadMe.md @@ -1,4 +1,4 @@ -# Calculating 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. @@ -13,36 +13,40 @@ _______ [//]: # ( @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) - - [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) - - [Upload!](#upload) + - [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) + - [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) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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. -# To Use this Example +## To Use this Example + +### 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/) +- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal () - 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. - - 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. + - 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 [baro_rho_correction.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/baro_rho_correction/baro_rho_correction.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -50,11 +54,13 @@ _______ const char *LoggerID = "XXXX"; ``` -## 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/) +### 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 () - For each variable, find the dummy UUID (`"12345678-abcd-1234-ef00-1234567890ab"`) and replace it with the real UUID for the variable. -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ diff --git a/examples/data_saving/ReadMe.md b/examples/data_saving/ReadMe.md index 4df834614..86abbdeaa 100644 --- a/examples/data_saving/ReadMe.md +++ b/examples/data_saving/ReadMe.md @@ -1,4 +1,4 @@ -# Minimizing Cellular Data Use +# 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. @@ -15,19 +15,21 @@ _______ [//]: # ( @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) - - [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) - - [Upload!](#upload) + - [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) + - [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) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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,20 +39,22 @@ _______ - 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. -# To Use this Example +## To Use this Example -## Prepare and set up PlatformIO -- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal (http://monitormywatershed.org/) +### Prepare and set up PlatformIO + +- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal () - 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. - - 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. + - 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 [data_saving.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/data_saving/data_saving.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -58,16 +62,17 @@ _______ const char *LoggerID = "XXXX"; ``` -## 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/) +### 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 () - For each variable, find the dummy UUID (`"12345678-abcd-1234-ef00-1234567890ab"`) and replace it with the real UUID for the variable. -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ - [//]: # ( @section example_data_saving_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} data_saving/platformio.ini ) diff --git a/examples/data_saving/data_saving.ino b/examples/data_saving/data_saving.ino index e6f445415..a540cd5e3 100644 --- a/examples/data_saving/data_saving.ino +++ b/examples/data_saving/data_saving.ino @@ -47,7 +47,7 @@ // peripherals as possible. In some cases (ie, modbus communication) many // sensors can share the same serial port. -#if not defined ARDUINO_ARCH_SAMD && not defined ATMEGA2560 // For AVR boards +#if !defined(ARDUINO_ARCH_SAMD) && !defined(ATMEGA2560) // For AVR boards // 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 @@ -61,7 +61,7 @@ AltSoftSerial altSoftSerial; #endif // End software serial for avr boards -#if defined ARDUINO_ARCH_SAMD +#if defined(ARDUINO_ARCH_SAMD) #include // Needed for SAMD pinPeripheral() function #ifndef ENABLE_SERIAL2 @@ -395,7 +395,7 @@ void setup() { // Wait for USB connection to be established by PC // NOTE: Only use this when debugging - if not connected to a PC, this // could prevent the script from starting -#if defined SERIAL_PORT_USBVIRTUAL +#if defined(SERIAL_PORT_USBVIRTUAL) while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000)) { // wait } @@ -423,7 +423,7 @@ void setup() { // Assign pins SERCOM functionality for SAMD boards // NOTE: This must happen *after* the various serial.begin statements -#if defined ARDUINO_ARCH_SAMD +#if defined(ARDUINO_ARCH_SAMD) #ifndef ENABLE_SERIAL2 pinPeripheral(10, PIO_SERCOM); // Serial2 Tx/Dout = SERCOM1 Pad #2 pinPeripheral(11, PIO_SERCOM); // Serial2 Rx/Din = SERCOM1 Pad #0 @@ -544,7 +544,7 @@ void loop() { // we will explicitly start and end the serial connection in the loop. modbusSerial.end(); -#if defined AltSoftSerial_h +#if defined(AltSoftSerial_h) // Explicitly set the pin modes for the AltSoftSerial pins to make sure // they're low pinMode(5, OUTPUT); // On a Mayfly, pin D5 is the AltSoftSerial Tx pin @@ -553,7 +553,7 @@ void loop() { digitalWrite(6, LOW); #endif -#if defined ARDUINO_SAMD_ZERO +#if defined(ARDUINO_SAMD_ZERO) digitalWrite(10, LOW); digitalWrite(11, LOW); #endif diff --git a/examples/double_logger/ReadMe.md b/examples/double_logger/ReadMe.md index 5752c99d4..8f839cee4 100644 --- a/examples/double_logger/ReadMe.md +++ b/examples/double_logger/ReadMe.md @@ -1,4 +1,4 @@ -# Multiple 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. @@ -10,18 +10,20 @@ _______ [//]: # ( @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) - - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - - [Set the logger ID](#set-the-logger-id) - - [Upload!](#upload) + - [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) + - [Set the logger ID](#set-the-logger-id) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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,19 +31,21 @@ _______ - 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. -# To Use this Example +## To Use this Example + +### 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. - - Without this, the program won't compile. + - 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 [double_logger.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/double_logger/double_logger.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -49,12 +53,12 @@ _______ const char *LoggerID = "XXXX"; ``` -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ - [//]: # ( @section example_double_log_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} double_logger/platformio.ini ) diff --git a/examples/examples.dox b/examples/examples.dox index a7397cfa4..b91340c88 100644 --- a/examples/examples.dox +++ b/examples/examples.dox @@ -1,3 +1,8 @@ +/** + * @dir examples + * + * @brief Contains all of the example sketches. There is only one example in each subfolder - a standard for Arduino coding. + */ /** * @page page_the_examples * @m_innerpage{page_examples_basic} @@ -33,6 +38,7 @@ * @page page_examples_drwi DRWI Citizen Science * [DRWI Citizen Science](@ref examples_drwi) * @m_innerpage{example_drwi_mayfly1} + * @m_innerpage{example_drwi_mayfly1_wifi} * @m_innerpage{example_drwi_ediylte} * @m_innerpage{example_drwi_digilte} * @m_innerpage{example_drwi_2g} diff --git a/examples/logging_to_MMW/ReadMe.md b/examples/logging_to_MMW/ReadMe.md index 2663f8cc8..daad6686c 100644 --- a/examples/logging_to_MMW/ReadMe.md +++ b/examples/logging_to_MMW/ReadMe.md @@ -1,6 +1,6 @@ -# Sending 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. +This sketch reduces menu_a_la_carte.ino to provide an example of how to log to 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. The settings for other data portals were removed from the example. @@ -15,36 +15,40 @@ _______ [//]: # ( @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) - - [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) - - [Upload!](#upload) + - [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) + - [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) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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 -# To Use this Example +## To Use this Example + +### 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/) +- Register a site and sensors at the Monitor My Watershed/EnviroDIY data portal () - 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. - - 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. + - 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 [logging_to_MMW.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/logging_to_MMW/logging_to_MMW.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -52,11 +56,13 @@ _______ const char *LoggerID = "XXXX"; ``` -## 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/) +### 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 () - For each variable, find the dummy UUID (`"12345678-abcd-1234-ef00-1234567890ab"`) and replace it with the real UUID for the variable. -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ diff --git a/examples/logging_to_MMW/logging_to_MMW.ino b/examples/logging_to_MMW/logging_to_MMW.ino index eece23667..b4791b41f 100644 --- a/examples/logging_to_MMW/logging_to_MMW.ino +++ b/examples/logging_to_MMW/logging_to_MMW.ino @@ -253,7 +253,7 @@ void setup() { // Wait for USB connection to be established by PC // NOTE: Only use this when debugging - if not connected to a PC, this // could prevent the script from starting -#if defined SERIAL_PORT_USBVIRTUAL +#if defined(SERIAL_PORT_USBVIRTUAL) while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000)) { // wait } @@ -276,11 +276,11 @@ void setup() { Serial.println(); // Allow interrupts for software serial -#if defined SoftwareSerial_ExtInts_h +#if defined(SoftwareSerial_ExtInts_h) enableInterrupt(softSerialRx, SoftwareSerial_ExtInts::handle_interrupt, CHANGE); #endif -#if defined NeoSWSerial_h +#if defined(NeoSWSerial_h) enableInterrupt(neoSSerial1Rx, neoSSerial1ISR, CHANGE); #endif diff --git a/examples/logging_to_ThingSpeak/ReadMe.md b/examples/logging_to_ThingSpeak/ReadMe.md index bc8ee3cb0..1ae9105e9 100644 --- a/examples/logging_to_ThingSpeak/ReadMe.md +++ b/examples/logging_to_ThingSpeak/ReadMe.md @@ -1,4 +1,4 @@ -# Sending 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. @@ -10,50 +10,54 @@ _______ [//]: # ( @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) - - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - - [Modify the Example](#modify-the-example) - - [Upload!](#upload) + - [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) + - [Modify the Example](#modify-the-example) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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. -# To Use this Example +## To Use this Example + +### 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. - - 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. + - 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 [logging_to_ThingSpeak.ino](https://raw.githubusercontent.com/EnviroDIY/ModularSensors/master/examples/logging_to_ThingSpeak/logging_to_ThingSpeak.ino) and save it to your computer. - - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". - - Move it into the src directory of your project. - - Delete main.cpp in that folder. + - After opening the link, you should be able to right click anywhere on the page and select "Save Page As". + - Move it into the src directory of your project. + - Delete main.cpp in that folder. + +### 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. + - This example is written for an _ESP8266 (wifi)_ modem. Change this to whatever modem you are using. Pastable chunks of code for each modem are available in the individual sensor documentation or in the menu a la carte example. - - Don't forget to put in your wifi username/password or cellular APN! - - This example is written for a Campbell OBS3+ and a Meter Hydros 21. + - Don't forget to put in your wifi username/password or cellular APN! + - This example is written for a Campbell OBS3+ and a Meter Hydros 21. Remove those sensors if you are not using them and add code for all of your sensors. See the pages for the individual sensors in the [documentation](https://envirodiy.github.io/ModularSensors/index.html) for code snippets/examples. - - Remember, no more than **8** variables/fields can be sent to a single ThingSpeak channel. + - Remember, no more than **8** variables/fields can be sent to a single ThingSpeak channel. If you want to send data to multiple channels, you must create individual logger objects with unique publishers attached for each channel you want to send to. - **Make sure the pin numbers and serial ports selected in your code match with how things are physically attached to your board!** - Order the variables in your variable array in the same order as your fields are on ThingSpeak. - - This order is __crucial__. + - This order is **crucial**. The results from the variables in the VariableArray will be sent to ThingSpeak in the order they are in the array; that is, the first variable in the array will be sent as Field1, the second as Field2, etc. - - Any UUID's or custom variable codes are ignored for ThingSpeak. + - Any UUID's or custom variable codes are ignored for ThingSpeak. They will only appear in the header of your file on the SD card. - Find this information for your ThingSpeak account and channel and put it into logging_to_ThingSpeak.ino: @@ -63,12 +67,12 @@ const char *thingSpeakChannelID = "######"; // The numeric channel id for your const char *thingSpeakChannelKey = "XXXXXXXXXXXXXXXX"; // The Write API Key for your channel ``` -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ - [//]: # ( @section example_thingspeak_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} logging_to_ThingSpeak/platformio.ini ) diff --git a/examples/menu_a_la_carte/ReadMe.md b/examples/menu_a_la_carte/ReadMe.md index a67c77ae7..b8e1cb3fd 100644 --- a/examples/menu_a_la_carte/ReadMe.md +++ b/examples/menu_a_la_carte/ReadMe.md @@ -1,4 +1,4 @@ -# 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. @@ -6,12 +6,12 @@ This example should *never* be used directly; it is intended to document all pos To create your own code, I recommend starting from a much simpler targeted example, like the [Logging to MMW](https://github.com/EnviroDIY/ModularSensors/tree/master/examples/logging_to_MMW) example, and then adding to it based on only the parts of this menu example that apply to you. -_______ +___ -# Walking Through the Code +# Walking Through the Code [//]: # ( @note ) -*NOTE: This walkthrough is intended to be viewed on GitHub pages at https://envirodiy.github.io/ModularSensors/example_menu.html* +*NOTE: This walkthrough is intended to be viewed on GitHub pages at * [//]: # ( @warning ) WARNING: This example is long. @@ -24,139 +24,140 @@ ___ [//]: # ( @m_footernavigation ) [//]: # ( Start GitHub Only ) -- [Example showing all possible functionality ](#example-showing-all-possible-functionality-) -- [Walking Through the Code ](#walking-through-the-code-) - - [Defines and Includes ](#defines-and-includes-) - - [Defines for the Arduino IDE ](#defines-for-the-arduino-ide-) - - [Library Includes ](#library-includes-) - - [Logger Settings ](#logger-settings-) - - [Creating Extra Serial Ports ](#creating-extra-serial-ports-) - - [AVR Boards ](#avr-boards-) - - [AltSoftSerial ](#altsoftserial-) - - [NeoSWSerial ](#neoswserial-) - - [SoftwareSerial with External Interrupts ](#softwareserial-with-external-interrupts-) - - [Software I2C/Wire ](#software-i2cwire-) - - [SAMD Boards ](#samd-boards-) - - [Assigning Serial Port Functionality ](#assigning-serial-port-functionality-) - - [Logging Options ](#logging-options-) - - [Wifi/Cellular Modem Options ](#wificellular-modem-options-) - - [Digi XBee Cellular - Transparent Mode ](#digi-xbee-cellular---transparent-mode-) - - [Digi XBee3 LTE-M - Bypass Mode ](#digi-xbee3-lte-m---bypass-mode-) - - [Digi XBee 3G - Bypass Mode ](#digi-xbee-3g---bypass-mode-) - - [Digi XBee S6B Wifi ](#digi-xbee-s6b-wifi-) - - [Espressif ESP8266 ](#espressif-esp8266-) - - [Quectel BG96 ](#quectel-bg96-) - - [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-) - - [Modem Measured Variables ](#modem-measured-variables-) - - [Sensors and Measured Variables ](#sensors-and-measured-variables-) - - [The processor as a sensor ](#the-processor-as-a-sensor-) - - [Maxim DS3231 RTC as a sensor ](#maxim-ds3231-rtc-as-a-sensor-) - - [AOSong AM2315 ](#aosong-am2315-) - - [AOSong DHT ](#aosong-dht-) - - [Apogee SQ-212 Quantum Light Sensor ](#apogee-sq-212-quantum-light-sensor-) - - [Atlas Scientific EZO Circuits ](#atlas-scientific-ezo-circuits-) - - [Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor ](#atlas-scientific-ezo-co2-embedded-ndir-carbon-dioxide-sensor-) - - [Atlas Scientific EZO-DO Dissolved Oxygen Sensor ](#atlas-scientific-ezo-do-dissolved-oxygen-sensor-) - - [Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor ](#atlas-scientific-ezo-orp-oxidationreduction-potential-sensor-) - - [Atlas Scientific EZO-pH Sensor ](#atlas-scientific-ezo-ph-sensor-) - - [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-) - - [Campbell RainVUE SDI-12 Precipitation Sensor ](#campbell-rainvue-sdi-12-precipitation-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-) - - [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe ](#gropoint-profile-gplp-8-eight-segment-soil-moisture-and-temperature-profiling-probe-) - - [In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor ](#in-situ-aqualevel-troll-pressure-temperature-and-depth-sensor-) - - [In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe ](#in-situ-rdo-pro-x-rugged-dissolved-oxygen-probe-) - - [Keller RS485/Modbus Water Level Sensors ](#keller-rs485modbus-water-level-sensors-) - - [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-) - - [Meter SDI-12 Sensors ](#meter-sdi-12-sensors-) - - [Meter ECH2O Soil Moisture Sensor ](#meter-ech2o-soil-moisture-sensor-) - - [Meter Hydros 21 Conductivity, Temperature, and Depth Sensor ](#meter-hydros-21-conductivity-temperature-and-depth-sensor-) - - [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-) - - [Analog Electrical Conductivity using the Processor's Analog Pins ](#analog-electrical-conductivity-using-the-processors-analog-pins-) - - [VEGA VEGA PULS 21 ](#vega-vega-puls-21-) - - [Yosemitech RS485/Modbus Environmental Sensors ](#yosemitech-rs485modbus-environmental-sensors-) - - [Yosemitech Y504 Dissolved Oxygen Sensor ](#yosemitech-y504-dissolved-oxygen-sensor-) - - [Yosemitech Y510 Turbidity Sensor ](#yosemitech-y510-turbidity-sensor-) - - [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 Y700 Pressure Sensor ](#yosemitech-y700-pressure-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-) - - [The variable array ](#the-variable-array-) - - [Creating Variables within an Array ](#creating-variables-within-an-array-) - - [Creating Variables and Pasting UUIDs from MonitorMyWatershed ](#creating-variables-and-pasting-uuids-from-monitormywatershed-) - - [Creating Variables within an Array ](#creating-variables-within-an-array--1) - - [The Logger Object ](#the-logger-object-) - - [Data Publishers ](#data-publishers-) - - [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-) - - [Wait for USB ](#wait-for-usb-) - - [Printing a Hello ](#printing-a-hello-) - - [Serial Interrupts ](#serial-interrupts-) - - [Serial Begin ](#serial-begin-) - - [SAMD Pin Peripherals ](#samd-pin-peripherals-) - - [Flash the LEDs ](#flash-the-leds-) - - [Begin the Logger ](#begin-the-logger-) - - [Setup the Sensors ](#setup-the-sensors-) - - [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-) - - [Setup File on the SD card ](#setup-file-on-the-sd-card-) - - [Sleep until the First Data Collection Time ](#sleep-until-the-first-data-collection-time-) - - [Setup Complete ](#setup-complete-) - - [Arduino Loop Function ](#arduino-loop-function-) - - [A Typical Loop ](#a-typical-loop-) - - [A Complex Loop ](#a-complex-loop-) + +- [Example showing all possible functionality](#example-showing-all-possible-functionality) +- [Walking Through the Code](#walking-through-the-code) + - [Defines and Includes](#defines-and-includes) + - [Defines for the Arduino IDE](#defines-for-the-arduino-ide) + - [Library Includes](#library-includes) + - [Logger Settings](#logger-settings) + - [Creating Extra Serial Ports](#creating-extra-serial-ports) + - [AVR Boards](#avr-boards) + - [AltSoftSerial](#altsoftserial) + - [NeoSWSerial](#neoswserial) + - [SoftwareSerial with External Interrupts](#softwareserial-with-external-interrupts) + - [Software I2C/Wire](#software-i2cwire) + - [SAMD Boards](#samd-boards) + - [Assigning Serial Port Functionality](#assigning-serial-port-functionality) + - [Logging Options](#logging-options) + - [Wifi/Cellular Modem Options](#wificellular-modem-options) + - [Digi XBee Cellular - Transparent Mode](#digi-xbee-cellular---transparent-mode) + - [Digi XBee3 LTE-M - Bypass Mode](#digi-xbee3-lte-m---bypass-mode) + - [Digi XBee 3G - Bypass Mode](#digi-xbee-3g---bypass-mode) + - [Digi XBee S6B Wifi](#digi-xbee-s6b-wifi) + - [Espressif ESP8266](#espressif-esp8266) + - [Quectel BG96](#quectel-bg96) + - [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) + - [Modem Measured Variables](#modem-measured-variables) + - [Sensors and Measured Variables](#sensors-and-measured-variables) + - [The processor as a sensor](#the-processor-as-a-sensor) + - [Maxim DS3231 RTC as a sensor](#maxim-ds3231-rtc-as-a-sensor) + - [AOSong AM2315](#aosong-am2315) + - [AOSong DHT](#aosong-dht) + - [Apogee SQ-212 Quantum Light Sensor](#apogee-sq-212-quantum-light-sensor) + - [Atlas Scientific EZO Circuits](#atlas-scientific-ezo-circuits) + - [Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor](#atlas-scientific-ezo-co2-embedded-ndir-carbon-dioxide-sensor) + - [Atlas Scientific EZO-DO Dissolved Oxygen Sensor](#atlas-scientific-ezo-do-dissolved-oxygen-sensor) + - [Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor](#atlas-scientific-ezo-orp-oxidationreduction-potential-sensor) + - [Atlas Scientific EZO-pH Sensor](#atlas-scientific-ezo-ph-sensor) + - [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) + - [Campbell RainVUE SDI-12 Precipitation Sensor](#campbell-rainvue-sdi-12-precipitation-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) + - [GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe](#gropoint-profile-gplp-8-eight-segment-soil-moisture-and-temperature-profiling-probe) + - [In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor](#in-situ-aqualevel-troll-pressure-temperature-and-depth-sensor) + - [In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe](#in-situ-rdo-pro-x-rugged-dissolved-oxygen-probe) + - [Keller RS485/Modbus Water Level Sensors](#keller-rs485modbus-water-level-sensors) + - [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) + - [Meter SDI-12 Sensors](#meter-sdi-12-sensors) + - [Meter ECH2O Soil Moisture Sensor](#meter-ech2o-soil-moisture-sensor) + - [Meter Hydros 21 Conductivity, Temperature, and Depth Sensor](#meter-hydros-21-conductivity-temperature-and-depth-sensor) + - [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) + - [Analog Electrical Conductivity using the Processor's Analog Pins](#analog-electrical-conductivity-using-the-processors-analog-pins) + - [VEGA VEGA PULS 21](#vega-vega-puls-21) + - [Yosemitech RS485/Modbus Environmental Sensors](#yosemitech-rs485modbus-environmental-sensors) + - [Yosemitech Y504 Dissolved Oxygen Sensor](#yosemitech-y504-dissolved-oxygen-sensor) + - [Yosemitech Y510 Turbidity Sensor](#yosemitech-y510-turbidity-sensor) + - [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 Y700 Pressure Sensor](#yosemitech-y700-pressure-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) + - [The variable array](#the-variable-array) + - [Creating Variables within an Array](#creating-variables-within-an-array) + - [Creating Variables and Pasting UUIDs from MonitorMyWatershed](#creating-variables-and-pasting-uuids-from-monitormywatershed) + - [Creating Variables within an Array](#creating-variables-within-an-array-1) + - [The Logger Object](#the-logger-object) + - [Data Publishers](#data-publishers) + - [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) + - [Wait for USB](#wait-for-usb) + - [Printing a Hello](#printing-a-hello) + - [Serial Interrupts](#serial-interrupts) + - [Serial Begin](#serial-begin) + - [SAMD Pin Peripherals](#samd-pin-peripherals) + - [Flash the LEDs](#flash-the-leds) + - [Begin the Logger](#begin-the-logger) + - [Setup the Sensors](#setup-the-sensors) + - [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) + - [Setup File on the SD card](#setup-file-on-the-sd-card) + - [Sleep until the First Data Collection Time](#sleep-until-the-first-data-collection-time) + - [Setup Complete](#setup-complete) + - [Arduino Loop Function](#arduino-loop-function) + - [A Typical Loop](#a-typical-loop) + - [A Complex Loop](#a-complex-loop) [//]: # ( End GitHub Only ) +## Defines and Includes -## Defines and Includes +### 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. +This is *not* standard behavior for C++ (which is what Arduino code really is) - this is a unique aspect of the Arduino IDE. [//]: # ( @menusnip{defines} ) @@ -171,9 +172,10 @@ build_flags = -DTINY_GSM_RX_BUFFER=64 -DTINY_GSM_YIELD_MS=2 ``` + ___ -### Library Includes +### Library Includes Next, include the libraries needed for every program using ModularSensors. @@ -181,9 +183,9 @@ Next, include the libraries needed for every program using ModularSensors. ___ -## Logger Settings +## Logger Settings -### 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. @@ -194,16 +196,15 @@ Among these are any sensors using RS232, RS485, RS422. Generally each serial variant (or sometimes each sensor) needs a dedicated serial "port" - its own connection to the processor. Most processors have built in dedicated wires for serial communication - "Hardware" serial. See the page on [Arduino streams](@ref page_arduino_streams) for much more detail about serial connections with Arduino processors. -_______ +___ -#### 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. +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. - -##### 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. @@ -212,8 +213,7 @@ See the [processor compatibility](@ref page_processor_compatibility) page for mo [//]: # ( @menusnip{altsoftserial} ) - -##### 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. @@ -225,8 +225,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_walk_setup_serial_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. @@ -241,19 +240,18 @@ 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_walk_setup_serial_interrupts). - -##### 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. [//]: # ( @menusnip{softwarewire} ) ---- +___ -#### SAMD Boards +#### SAMD Boards -The SAMD21 supports up to 6 _hardware_ serial ports, which is _awesome_. +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. This section of code assigns SERCOM's 1 and 2 to act as Serial2 and Serial3 on pins 10/11 and 5/2 respectively. @@ -264,12 +262,11 @@ These pin selections are based on the Adafruit Feather M0. 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_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. -NOTE: The SAMD51 board has an amazing _8_ available SERCOM's, but I do not have any exmple code for using them. - ---- +___ -### Assigning Serial Port Functionality +### Assigning Serial Port 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. @@ -281,9 +278,9 @@ Depending on how you rank the importance of each component, you can adjust these [//]: # ( @menusnip{assign_ports_sw} ) ---- +___ -### 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. @@ -292,11 +289,10 @@ This includes setting the time zone (daylight savings time is **NOT** applied) a ___ - -## 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. +Do *NOT* try to use more than one modem at a time - it will *NOT* work. To create any of the modems, we follow a similar pattern: @@ -313,12 +309,12 @@ 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). For cellular models, you will need the APN assigned to you by the carrier you bought your SIM card from. +### 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. +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. To create a DigiXBeeCellularTransparent object we need to know + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the status pin, @@ -339,11 +335,11 @@ Depending on your cellular carrier, it is best to select the proper carrier prof 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. - -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the status pin, @@ -361,11 +357,11 @@ Depending on your cellular carrier, it is best to select the proper carrier prof 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. - -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the status pin, @@ -379,10 +375,11 @@ A helpful table detailing the pins to use with the EnviroDIY Mayfly is available [//]: # ( @menusnip{digi_xbee_3g_bypass} ) -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the status pin, @@ -397,11 +394,11 @@ A helpful table detailing the pins to use with the EnviroDIY Mayfly is available [//]: # ( @menusnip{digi_xbee_wifi} ) - -### 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 + - the serial object name, - the MCU pin controlling modem power, - the reset pin (MCU pin connected to the ESP's `RSTB/DIO16`), @@ -413,13 +410,13 @@ 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_walk_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() part of the setup function below. -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the `STATUS` pin, @@ -434,11 +431,11 @@ Pins that do not apply should be set as -1. 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. - -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to either the `GPIO3/STATUS_LED` or `POWER_MON` pin, @@ -454,14 +451,14 @@ If you are interfacing with a Nimbelink Skywire board via the Skywire developmen 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. +*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. The proper command to decrease the baud rate to 9600 (8N1) is: `AT+IPR=9600`. - -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the `STATUS` pin, @@ -471,16 +468,16 @@ To create a SIMComSIM800 object we need to know Pins that do not apply should be set as -1. -_NOTE:_ This is NOT the correct form for a Sodaq 2GBee R6 or R7. +*NOTE:* This is NOT the correct form for a Sodaq 2GBee R6 or R7. See the section for a 2GBee R6. [//]: # ( @menusnip{sim_com_sim800} ) - -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the `STATUS` pin, @@ -492,12 +489,12 @@ 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/). 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, @@ -509,13 +506,13 @@ A helpful table detailing the pins to use with the EnviroDIY LTE Bee and the Env [//]: # ( @menusnip{sim_com_sim7080} ) - -### 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 + - the serial object name, -- the MCU pin controlling modem power, (**NOTE:** On the GPRSBee R6 and R7 the pin labeled as ON/OFF in Sodaq's diagrams is tied to _both_ the SIM800 power supply and the (inverted) SIM800 `PWRKEY`. +- the MCU pin controlling modem power, (**NOTE:** On the GPRSBee R6 and R7 the pin labeled as ON/OFF in Sodaq's diagrams is tied to *both* the SIM800 power supply and the (inverted) SIM800 `PWRKEY`. You should enter this pin as the power pin.) - and the SIM card's cellular access point name (APN). @@ -526,10 +523,11 @@ A helpful table detailing the pins to use with the Sodaq GPRSBee and the EnviroD [//]: # ( @menusnip{sodaq_2g_bee_r6} ) -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the `V_INT` pin (for status), @@ -546,10 +544,11 @@ Depending on your cellular carrier, it is best to select the proper carrier prof 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. -### 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 + - the serial object name, - the MCU pin controlling modem power, - the MCU pin connected to the `V_INT` pin (for status), @@ -562,21 +561,21 @@ A helpful table detailing the pins to use with the Sodaq UBee U201 and the Envir [//]: # ( @menusnip{sodaq_ubee_u201} ) -### 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. The second and third arguments (the UUID and the variable code) included here are optional. -Note that here we create the variables for anything measured by _any_ of the modems, but most modems are not capable of measuring all of the values. +Note that here we create the variables for anything measured by *any* of the modems, but most modems are not capable of measuring all of the values. Some modem-measured values may be meaningless depending on the board configuration - often the battery parameters returned by a cellular component have little meaning because the module is downstream of a voltage regulator. [//]: # ( @menusnip{modem_variables} ) ___ -## Sensors and Measured Variables +## Sensors and Measured Variables -### 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. @@ -592,10 +591,10 @@ The number of "samples" taken will increase by one for each time another process ___ -### 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. +This temperature is *not* equivalent to an environmental temperature measurement and should only be used to as a diagnostic. As above, we create both the sensor and the variables measured by it. @see @ref sensor_ds3231 @@ -604,7 +603,7 @@ As above, we create both the sensor and the variables measured by it. ___ -### 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). @@ -616,7 +615,7 @@ The number of readings to average from the sensor is optional, but can be suppli ___ -### 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. @@ -628,11 +627,11 @@ The number of readings to average from the sensor is optional, but can be suppli ___ -### 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. -The Arduino pin controlling power on/off and the analog data channel _on the TI ADS1115_ are required for the sensor constructor. +The Arduino pin controlling power on/off and the analog data channel *on the TI ADS1115* are required for the sensor constructor. If your ADD converter is not at the standard address of 0x48, you can enter its actual address as the third argument. The number of readings to average from the sensor is optional, but can be supplied as the fourth argument for the constructor if desired. @@ -642,8 +641,7 @@ The number of readings to average from the sensor is optional, but can be suppli ___ - -### 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. @@ -653,6 +651,7 @@ In the most common setup, with hardware I2C, the only required argument for the If you do not isolate them from your main I2C bus and you turn off power to the circuits between measurements the I2C lines will be pulled down to ground causing the I2C bus (and thus your logger) to crash. The default I2C addresses for the circuits are: + - CO2: 0x69 (105) - DO: 0x61 (97) - EC (conductivity): 0x64 (100) @@ -664,8 +663,7 @@ To use multiple circuits of the same type, re-address them. @see @ref atlas_group - -#### Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor +#### Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor @see @ref sensor_atlas_co2 @@ -673,8 +671,7 @@ To use multiple circuits of the same type, re-address them. ___ - -#### Atlas Scientific EZO-DO Dissolved Oxygen Sensor +#### Atlas Scientific EZO-DO Dissolved Oxygen Sensor @see @ref sensor_atlas_do @@ -682,8 +679,7 @@ ___ ___ - -#### Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor +#### Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor @see @ref sensor_atlas_orp @@ -691,8 +687,7 @@ ___ ___ - -#### Atlas Scientific EZO-pH Sensor +#### Atlas Scientific EZO-pH Sensor @see @ref sensor_atlas_ph @@ -700,8 +695,7 @@ ___ ___ - -#### Atlas Scientific EZO-RTD Temperature Sensor +#### Atlas Scientific EZO-RTD Temperature Sensor @see @ref sensor_atlas_rtd @@ -709,8 +703,7 @@ ___ ___ - -#### Atlas Scientific EZO-EC Conductivity Sensor +#### Atlas Scientific EZO-EC Conductivity Sensor @see @ref sensor_atlas_cond @@ -718,8 +711,7 @@ ___ ___ - -### 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. @@ -731,8 +723,7 @@ Keep in mind that the possible I2C addresses of the BME280 match those of the MS ___ - -### Bosch BMP388 and BMP398 Pressure Sensors +### Bosch BMP388 and BMP398 Pressure Sensors @see @ref sensor_bmp3xx @@ -740,8 +731,7 @@ ___ ___ - -#### Campbell ClariVUE SDI-12 Turbidity Sensor +#### Campbell ClariVUE SDI-12 Turbidity Sensor @see @ref sensor_clarivue @@ -749,14 +739,13 @@ ___ ___ - -### 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. +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. A custom variable code can be entered as a second argument in the variable constructors, and it is very strongly recommended that you use this otherwise it will be very difficult to determine which return is high and which is low range on the sensor. If your ADD converter is not at the standard address of 0x48, you can enter its actual address as the third argument. -Do NOT forget that if you want to give a number of measurements to average, that comes _after_ the i2c address in the constructor! +Do NOT forget that if you want to give a number of measurements to average, that comes *after* the i2c address in the constructor! Note that to access both the high and low range returns, two instances must be created, one at the low range return pin and one at the high pin. @@ -766,8 +755,7 @@ Note that to access both the high and low range returns, two instances must be c ___ - -#### Campbell RainVUE SDI-12 Precipitation Sensor +#### Campbell RainVUE SDI-12 Precipitation Sensor @see @ref sensor_rainvue @@ -775,8 +763,7 @@ ___ ___ - -#### Decagon CTD-10 Conductivity, Temperature, and Depth Sensor +#### Decagon CTD-10 Conductivity, Temperature, and Depth Sensor @see @ref sensor_decagon_ctd @@ -784,8 +771,7 @@ ___ ___ - -### 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. @@ -797,8 +783,7 @@ The data pin must be a pin that supports pin-change interrupts. ___ - -#### Everlight ALS-PT19 Ambient Light Sensor +#### Everlight ALS-PT19 Ambient Light Sensor @see @ref sensor_alspt19 @@ -806,11 +791,9 @@ ___ ___ +### 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. +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. If your ADD converter is not at the standard address of 0x48, you can enter its actual address as the fourth argument. The number of measurements to average, if more than one is desired, goes as the fifth argument. @@ -821,8 +804,7 @@ The number of measurements to average, if more than one is desired, goes as the ___ - -### 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. @@ -833,8 +815,7 @@ Because this sensor can have only one I2C address (0x60), it is only possible to ___ - -### GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe +### GroPoint Profile GPLP-8 Eight-Segment Soil Moisture and Temperature Profiling Probe @see @ref sensor_gplp8 @@ -842,8 +823,7 @@ ___ ___ - -#### 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 @@ -851,8 +831,7 @@ ___ ___ - -#### In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe +#### In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe @see @ref sensor_insitu_rdo @@ -860,29 +839,27 @@ ___ ___ - -### 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. The sensor constructors require as input: the sensor modbus address, a stream instance for data (ie, `Serial`), and one or two power pins. The Arduino pin controlling the receive and data enable on your RS485-to-TTL adapter and the number of readings to average are optional. (Use -1 for the second power pin and -1 for the enable pin if these don't apply and you want to average more than one reading.) Please see the section "[Notes on Arduino Streams and Software Serial](https://envirodiy.github.io/ModularSensors/page_arduino_streams.html)" 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. +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_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. -If they are controlled by different pins _and no other sensors are dependent on power from either pin_ then the order of the pins doesn't matter. -If the RS485 adapter, sensor, or relay are controlled by different pins _and any other sensors are controlled by the same pins_ you should put the shared pin first and the un-shared pin second. -Both pins _cannot_ be shared pins. +If they are controlled by different pins *and no other sensors are dependent on power from either pin* then the order of the pins doesn't matter. +If the RS485 adapter, sensor, or relay are controlled by different pins *and any other sensors are controlled by the same pins* you should put the shared pin first and the un-shared pin second. +Both pins *cannot* be shared pins. @see @ref keller_group - -#### Keller Acculevel High Accuracy Submersible Level Transmitter +#### Keller Acculevel High Accuracy Submersible Level Transmitter @see @ref sensor_acculevel @@ -890,8 +867,7 @@ Both pins _cannot_ be shared pins. ___ - -#### Keller Nanolevel Level Transmitter +#### Keller Nanolevel Level Transmitter @see @ref sensor_nanolevel @@ -899,8 +875,7 @@ ___ ___ - -### 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.) @@ -914,8 +889,7 @@ The serial ports for this example are created in the @ref menu_walk_serial_ports ___ - -### 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}. @@ -928,8 +902,7 @@ The sensor address is programmed at the factory and cannot be changed. ___ - -### 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. @@ -940,16 +913,14 @@ Keep in mind that the possible I2C addresses of the MS5803 match those of the BM ___ - -### 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. Optionally, you can include a number of distinct readings to average. The data pin must be a pin that supports pin-change interrupts. - -#### Meter ECH2O Soil Moisture Sensor +#### Meter ECH2O Soil Moisture Sensor @see @ref sensor_fivetm @@ -957,8 +928,7 @@ The data pin must be a pin that supports pin-change interrupts. ___ - -#### Meter Hydros 21 Conductivity, Temperature, and Depth Sensor +#### Meter Hydros 21 Conductivity, Temperature, and Depth Sensor @see @ref sensor_hydros21 @@ -966,8 +936,7 @@ ___ ___ - -#### Meter Teros 11 Soil Moisture Sensor +#### Meter Teros 11 Soil Moisture Sensor @see @ref sensor_teros11 @@ -975,8 +944,7 @@ ___ ___ - -### 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. @@ -987,7 +955,9 @@ The constructors for the software I2C implementation requires either the SCL and All variants of the constructor require the Arduino power pin. The I2C address can be given if it the sensor is not set to the default of 0x68. A number of readings to average can also be given. -**** + +___ + @warning Either all or none of your attached redox probes may use software I2C. Using some with software I2C and others with hardware I2C is not supported. @@ -997,8 +967,7 @@ Using some with software I2C and others with hardware I2C is not supported. ___ - -### 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). @@ -1012,8 +981,7 @@ Note that you cannot input a number of measurements to average because averaging ___ - -#### Sensirion SHT4X Digital Humidity and Temperature Sensor +#### Sensirion SHT4X Digital Humidity and Temperature Sensor @see @ref sensor_sht4x @@ -1021,8 +989,7 @@ ___ ___ - -### Northern Widget Tally Event Counter +### Northern Widget Tally Event Counter This is for use with Northern Widget's Tally event counter @@ -1039,8 +1006,7 @@ The counter should be continuously powered. ___ - -### 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. @@ -1053,8 +1019,7 @@ The number of measurements to average, if more than one is desired, goes as the ___ - -### 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. @@ -1069,9 +1034,7 @@ The Cyclops sensors are *NOT* pre-calibrated and must be calibrated prior to dep ___ - - -### 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. @@ -1086,8 +1049,7 @@ For best results, you should also connect the AREF pin of your processors ADC to ___ - -#### VEGA VEGA PULS 21 +#### VEGA VEGA PULS 21 @see @ref sensor_vega_puls21 @@ -1095,8 +1057,7 @@ ___ ___ - -### 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. @@ -1105,7 +1066,7 @@ The Arduino pin controlling the receive and data enable on your RS485-to-TTL ada (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 most of the sensors, Yosemitech strongly recommends averaging multiple (in most cases 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)" 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. +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. NeoSWSerial is a bit hit or miss, but can be used in a pinch. @@ -1113,8 +1074,7 @@ The serial ports for this example are created in the @ref menu_walk_serial_ports @see @ref yosemitech_group - -#### Yosemitech Y504 Dissolved Oxygen Sensor +#### Yosemitech Y504 Dissolved Oxygen Sensor @see @ref sensor_y504 @@ -1122,8 +1082,7 @@ The serial ports for this example are created in the @ref menu_walk_serial_ports ___ - -#### Yosemitech Y510 Turbidity Sensor +#### Yosemitech Y510 Turbidity Sensor @see @ref sensor_y510 @@ -1131,8 +1090,7 @@ ___ ___ - -#### Yosemitech Y511 Turbidity Sensor with Wiper +#### Yosemitech Y511 Turbidity Sensor with Wiper @see @ref sensor_y511 @@ -1140,8 +1098,7 @@ ___ ___ - -#### Yosemitech Y514 Chlorophyll Sensor +#### Yosemitech Y514 Chlorophyll Sensor @see @ref sensor_y514 @@ -1149,8 +1106,7 @@ ___ ___ - -#### Yosemitech Y520 Conductivity Sensor +#### Yosemitech Y520 Conductivity Sensor @see @ref sensor_y520 @@ -1158,8 +1114,7 @@ ___ ___ - -#### Yosemitech Y532 pH Sensor +#### Yosemitech Y532 pH Sensor @see @ref sensor_y532 @@ -1167,8 +1122,7 @@ ___ ___ - -#### Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor +#### Yosemitech Y533 Oxidation Reduction Potential (ORP) Sensor @see @ref sensor_y533 @@ -1176,8 +1130,7 @@ ___ ___ - -#### Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper +#### Yosemitech Y551 Carbon Oxygen Demand (COD) Sensor with Wiper @see @ref sensor_y551 @@ -1185,8 +1138,7 @@ ___ ___ - -#### Yosemitech Y560 Ammonium Sensor +#### Yosemitech Y560 Ammonium Sensor @see @ref sensor_y551 @@ -1194,8 +1146,7 @@ ___ ___ - -#### Yosemitech Y700 Pressure Sensor +#### Yosemitech Y700 Pressure Sensor @see @ref sensor_y700 @@ -1203,8 +1154,7 @@ ___ ___ - -#### Yosemitech Y4000 Multi-Parameter Sonde +#### Yosemitech Y4000 Multi-Parameter Sonde @see @ref sensor_y4000 @@ -1212,8 +1162,7 @@ ___ ___ - -### 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. @@ -1225,8 +1174,7 @@ The data pin must be a pin that supports pin-change interrupts. ___ - -## 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. @@ -1235,31 +1183,29 @@ For these calculate variables, we must not only supply a function for the calcul ___ -## Creating the array, logger, publishers +## Creating the array, logger, publishers -### 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 -#### 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} ) - -#### 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. [//]: # ( @menusnip{variables_separate_uuids} ) - -#### 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: @@ -1267,8 +1213,7 @@ You can also create and name variable pointer objects outside of the array (as i ___ - -### The Logger Object +### The Logger Object Now that we've created the array, we can actually create the #Logger object. @@ -1276,13 +1221,13 @@ Now that we've created the array, we can actually create the #Logger object. ___ -### Data Publishers +### Data Publishers Here we set up all three possible data publisers and link all of them to the same Logger object. -#### 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. +To publish data to the Monitor My Watershed / EnviroDIY Data Sharing Portal first you must register yourself as a user at or . 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. @@ -1290,7 +1235,7 @@ After registering your site, a sampling feature and registration token for that ___ -#### DreamHost +#### DreamHost It is extrmemly unlikely you will use this. You should ignore this section. @@ -1299,7 +1244,7 @@ You should ignore this section. ___ -#### ThingSpeak +#### ThingSpeak After you have set up channels on ThingSpeak, you can use this code to publish your data to it. @@ -1309,7 +1254,7 @@ Keep in mind that the order of variables in the VariableArray is **crucial** whe ___ -#### Ubidots +#### Ubidots Use this to publish data to Ubidots. @@ -1317,7 +1262,7 @@ Use this to publish data to Ubidots. ___ -## 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. @@ -1327,18 +1272,18 @@ The battery function calls the #ProcessorStats sensor to check the battery level ___ -## 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(). The setup() function runs once when the board boots or restarts. It usually contains many functions that set the mode of input and output pins and prints out some debugging information to the serial port. These functions are frequently named "begin". -Because we have a _lot_ of parts to set up, there's a lot going on in this function! +Because we have a *lot* of parts to set up, there's a lot going on in this function! Let's break it down. -### Starting the Function +### Starting the Function First we just open the function definitions: @@ -1346,7 +1291,7 @@ First we just open the function definitions: void setup() { ``` -### 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. @@ -1354,14 +1299,14 @@ This code should not be used for deployed loggers; it's only for using a USB for [//]: # ( @menusnip{setup_wait} ) -### 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} ) -### 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. @@ -1370,11 +1315,13 @@ The [NeoSWSerial](https://envirodiy.github.io/ModularSensors/menu_a_la_carte_8in **NOTE:** If you create more than one NeoSWSerial or Software serial object, you need to call the enableInterrupt function for each Rx pin! For NeoSWSerial we use: + ```cpp enableInterrupt(neoSSerial1Rx, neoSSerial1ISR, CHANGE); ``` For SoftwareSerial with External interrupts we use: + ```cpp enableInterrupt(softSerialRx, SoftwareSerial_ExtInts::handle_interrupt, CHANGE); @@ -1382,14 +1329,14 @@ For SoftwareSerial with External interrupts we use: [//]: # ( @menusnip{setup_softserial} ) -### 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_walk_serial_ports) section [//]: # ( @menusnip{setup_serial_begins} ) -### 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_walk_samd_serial_ports) section above. @@ -1397,14 +1344,14 @@ This does not need to be done for an AVR board (like the Mayfly). [//]: # ( @menusnip{setup_samd_pins} ) -### 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_walk_working) section. [//]: # ( @menusnip{setup_flashing_led} ) -### Begin the Logger +### Begin the Logger Next get ready and begin the logger. We set the logger time zone and the clock time zone. @@ -1415,7 +1362,7 @@ Then we finally run the logger's begin function. [//]: # ( @menusnip{setup_logger} ) -### 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. @@ -1425,46 +1372,46 @@ Without the condition the board would boot with power, try to power hungry senso [//]: # ( @menusnip{setup_sensors} ) -### 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. -#### 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} ) -#### 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} ) -#### SimCom SIM7080G Network Mode +#### SimCom SIM7080G Network Mode This chunk of code sets the network mode and preferred mode for the SIM7080G. [//]: # ( @menusnip{setup_sim7080} ) -#### 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} ) -#### 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} ) -### 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. @@ -1476,7 +1423,7 @@ It's a broad range, but it will automatically flag values like Jan 1, 2000 - whi [//]: # ( @menusnip{setup_clock} ) -### 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. @@ -1484,14 +1431,14 @@ Like with the sensors and the modem, we check for battery level before attemptin [//]: # ( @menusnip{setup_file} ) -### 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} ) -### Setup Complete +### Setup Complete Set up is done! This setup function is *really* long. @@ -1503,25 +1450,27 @@ But don't forget you need to close it with a final curly brace. ___ -## 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. +You should only pick *one* loop function and delete the other. -### 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: + 1. If the battery is very low, go immediately back to sleep and hope the sun comes back out 2. If the battery is at a moderate level, attempt to collect data from sensors, but do not attempt to publish data. The modem the biggest power user of the whole system. 3. + At full power, do everything. [//]: # ( @menusnip{simple_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. 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 b991ea2d0..50d99c088 100644 --- a/examples/menu_a_la_carte/menu_a_la_carte.ino +++ b/examples/menu_a_la_carte/menu_a_la_carte.ino @@ -115,11 +115,11 @@ const int8_t softwareSDA = 5; const int8_t softwareSCL = 4; SoftwareWire softI2C(softwareSDA, softwareSCL); /** End [softwarewire] */ -#endif // #if defined MS_PALEOTERRA_SOFTWAREWIRE ... +#endif // #if defined(MS_PALEOTERRA_SOFTWAREWIRE) ... #endif // End software serial for avr boards -#if defined ARDUINO_ARCH_SAMD +#if defined(ARDUINO_ARCH_SAMD) /** Start [serial_ports_SAMD] */ // The SAMD21 has 6 "SERCOM" ports, any of which can be used for UART // communication. The "core" code for most boards defines one or more UART @@ -213,9 +213,9 @@ void SERCOM2_Handler() { // SoftwareSerial **WILL NOT** work for modbus! #ifdef BUILD_TEST_ALTSOFTSERIAL #define modbusSerial altSoftSerial // For AltSoftSerial -#elif defined BUILD_TEST_NEOSWSERIAL +#elif defined(BUILD_TEST_NEOSWSERIAL) #define modbusSerial neoSSerial1 // For Neo software serial -#elif defined BUILD_TEST_SOFTSERIAL +#elif defined(BUILD_TEST_SOFTSERIAL) #define modbusSerial softSerial1 // For software serial #else #define modbusSerial Serial1 // Hardware serial @@ -227,9 +227,9 @@ void SERCOM2_Handler() { // string repeatedly, almost any software serial port will do for it. #ifdef BUILD_TEST_ALTSOFTSERIAL #define sonarSerial altSoftSerial // For AltSoftSerial -#elif defined BUILD_TEST_NEOSWSERIAL +#elif defined(BUILD_TEST_NEOSWSERIAL) #define sonarSerial neoSSerial1 // For Neo software serial -#elif defined BUILD_TEST_SOFTSERIAL +#elif defined(BUILD_TEST_SOFTSERIAL) #define sonarSerial softSerial1 // For software serial #else #define sonarSerial Serial1 // Hardware serial @@ -275,7 +275,7 @@ const int8_t sensorPowerPin = 22; // MCU pin controlling main sensor power // Delete the sections you are not using! // ========================================================================== -#if defined BUILD_MODEM_DIGI_XBEE_CELLULAR_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 @@ -316,7 +316,7 @@ DigiXBeeCellularTransparent modem = modemXBCT; // ========================================================================== -#elif defined BUILD_MODEM_DIGI_XBEE_LTE_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 @@ -353,7 +353,7 @@ DigiXBeeLTEBypass modem = modemXBLTEB; // ========================================================================== -#elif defined BUILD_MODEM_DIGI_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 @@ -390,7 +390,7 @@ DigiXBee3GBypass modem = modemXB3GB; // ========================================================================== -#elif defined BUILD_MODEM_DIGI_XBEE_WIFI +#elif defined(BUILD_MODEM_DIGI_XBEE_WIFI) /** Start [digi_xbee_wifi] */ // For the Digi Wifi XBee (S6B) #include @@ -426,7 +426,7 @@ DigiXBeeWifi modem = modemXBWF; // ========================================================================== -#elif defined BUILD_MODEM_ESPRESSIF_ESP8266 +#elif defined(BUILD_MODEM_ESPRESSIF_ESP8266) /** Start [espressif_esp8266] */ // For almost anything based on the Espressif ESP8266 using the // AT command firmware @@ -461,7 +461,7 @@ EspressifESP8266 modem = modemESP; // ========================================================================== -#elif defined BUILD_MODEM_ESPRESSIF_ESP32 +#elif defined(BUILD_MODEM_ESPRESSIF_ESP32) /** Start [espressif_esp32] */ // For almost anything based on the Espressif ESP8266 using the // AT command firmware @@ -496,7 +496,7 @@ EspressifESP32 modem = modemESP; // ========================================================================== -#elif defined BUILD_MODEM_QUECTEL_BG96 +#elif defined(BUILD_MODEM_QUECTEL_BG96) /** Start [quectel_bg96] */ // For the Dragino, Nimbelink or other boards based on the Quectel BG96 #include @@ -530,7 +530,7 @@ QuectelBG96 modem = modemBG96; // ========================================================================== -#elif defined BUILD_MODEM_SEQUANS_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 @@ -565,7 +565,7 @@ SequansMonarch modem = modemSVZM; // ========================================================================== -#elif defined BUILD_MODEM_SIM_COM_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 @@ -597,7 +597,7 @@ SIMComSIM800 modem = modemS800; // ========================================================================== -#elif defined BUILD_MODEM_SIM_COM_SIM7000 +#elif defined(BUILD_MODEM_SIM_COM_SIM7000) /** Start [sim_com_sim7000] */ // For almost anything based on the SIMCom SIM7000 #include @@ -627,7 +627,7 @@ SIMComSIM7000 modem = modem7000; // ========================================================================== -#elif defined BUILD_MODEM_SIM_COM_SIM7080 +#elif defined(BUILD_MODEM_SIM_COM_SIM7080) /** Start [sim_com_sim7080] */ // For almost anything based on the SIMCom SIM7080G #include @@ -658,7 +658,7 @@ SIMComSIM7080 modem = modem7080; // ========================================================================== -#elif defined BUILD_MODEM_SODAQ_2G_BEE_R6 +#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 @@ -689,7 +689,7 @@ Sodaq2GBeeR6 modem = modem2GB; // ========================================================================== -#elif defined BUILD_MODEM_SODAQ_UBEE_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 @@ -727,7 +727,7 @@ SodaqUBeeR410M modem = modemR410; // ========================================================================== -#elif defined BUILD_MODEM_SODAQ_UBEE_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 @@ -815,7 +815,7 @@ Variable* ds3231Temp = #endif -#if defined BUILD_SENSOR_AO_SONG_AM2315 +#if defined(BUILD_SENSOR_AO_SONG_AM2315) // ========================================================================== // AOSong AM2315 Digital Humidity and Temperature Sensor // ========================================================================== @@ -837,7 +837,7 @@ Variable* am2315Temp = #endif -#if defined BUILD_SENSOR_AO_SONG_DHT +#if defined(BUILD_SENSOR_AO_SONG_DHT) // ========================================================================== // AOSong DHT 11/21 (AM2301)/22 (AM2302) Digital Humidity and Temperature // ========================================================================== @@ -864,7 +864,7 @@ Variable* dhtHI = new AOSongDHT_HI(&dht, #endif -#if defined BUILD_SENSOR_APOGEE_SQ212 +#if defined(BUILD_SENSOR_APOGEE_SQ212) // ========================================================================== // Apogee SQ-212 Photosynthetically Active Radiation (PAR) Sensor // ========================================================================== @@ -888,7 +888,7 @@ Variable* sq212voltage = #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2 +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2) // ========================================================================== // Atlas Scientific EZO-CO2 Embedded NDIR Carbon Dioxide Sensor // ========================================================================== @@ -915,7 +915,7 @@ Variable* atlasCO2Temp = new AtlasScientificCO2_Temp( #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_DO +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_DO) // ========================================================================== // Atlas Scientific EZO-DO Dissolved Oxygen Sensor // ========================================================================== @@ -942,7 +942,7 @@ Variable* atlasDOpct = new AtlasScientificDO_DOpct( #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP) // ========================================================================== // Atlas Scientific EZO-ORP Oxidation/Reduction Potential Sensor // ========================================================================== @@ -967,7 +967,7 @@ Variable* atlasORPot = new AtlasScientificORP_Potential( #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_PH +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_PH) // ========================================================================== // Atlas Scientific EZO-pH Sensor // ========================================================================== @@ -1018,7 +1018,7 @@ Variable* atlasTemp = new AtlasScientificRTD_Temp( #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_EC +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_EC) // ========================================================================== // Atlas Scientific EZO-EC Conductivity Sensor // ========================================================================== @@ -1090,7 +1090,7 @@ Variable* atlasSpCond = #endif -#if defined BUILD_SENSOR_BOSCH_BME280 +#if defined(BUILD_SENSOR_BOSCH_BME280) // ========================================================================== // Bosch BME280 Environmental Sensor // ========================================================================== @@ -1119,7 +1119,7 @@ Variable* bme280Alt = #endif -#if defined BUILD_SENSOR_BOSCH_BMP3XX +#if defined(BUILD_SENSOR_BOSCH_BMP3XX) // ========================================================================== // Bosch BMP 3xx Barometric Pressure Sensor // ========================================================================== @@ -1152,7 +1152,7 @@ Variable* bmp3xxAlt = #endif -#if defined BUILD_SENSOR_CAMPBELL_CLARI_VUE10 +#if defined(BUILD_SENSOR_CAMPBELL_CLARI_VUE10) // ========================================================================== // Campbell ClariVUE Turbidity Sensor // ========================================================================== @@ -1180,7 +1180,7 @@ Variable* clarivueError = new CampbellClariVUE10_ErrorCode( #endif -#if defined BUILD_SENSOR_CAMPBELL_OBS3 +#if defined(BUILD_SENSOR_CAMPBELL_OBS3) // ========================================================================== // Campbell OBS 3 / OBS 3+ Analog Turbidity Sensor // ========================================================================== @@ -1229,7 +1229,7 @@ Variable* obs3VoltHigh = new CampbellOBS3_Voltage( /** End [campbell_obs3] */ #endif -#if defined BUILD_SENSOR_CAMPBELL_RAIN_VUE10 +#if defined(BUILD_SENSOR_CAMPBELL_RAIN_VUE10) // ========================================================================== // Campbell RainVUE Precipitation Sensor // ========================================================================== @@ -1259,7 +1259,7 @@ Variable* rainvueRainRateMax = new CampbellRainVUE10_RainRateMax( #endif -#if defined BUILD_SENSOR_DECAGON_CTD +#if defined(BUILD_SENSOR_DECAGON_CTD) // ========================================================================== // Decagon CTD-10 Conductivity, Temperature, and Depth Sensor // ========================================================================== @@ -1286,7 +1286,7 @@ Variable* ctdDepth = #endif -#if defined BUILD_SENSOR_DECAGON_ES2 +#if defined(BUILD_SENSOR_DECAGON_ES2) // ========================================================================== // Decagon ES2 Conductivity and Temperature Sensor // ========================================================================== @@ -1311,7 +1311,7 @@ Variable* es2Temp = new DecagonES2_Temp(&es2, #endif -#if defined BUILD_SENSOR_EVERLIGHT_ALSPT19 +#if defined(BUILD_SENSOR_EVERLIGHT_ALSPT19) // ========================================================================== // Everlight ALS-PT19 Ambient Light Sensor // ========================================================================== @@ -1343,7 +1343,7 @@ Variable* alsPt19Lux = new EverlightALSPT19_Illuminance( #endif -#if defined BUILD_SENSOR_TIADS1X15 +#if defined(BUILD_SENSOR_TIADS1X15) // ========================================================================== // External Voltage via TI ADS1115 // ========================================================================== @@ -1368,7 +1368,7 @@ Variable* ads1x15Volt = #endif -#if defined BUILD_SENSOR_FREESCALE_MPL115A2 +#if defined(BUILD_SENSOR_FREESCALE_MPL115A2) // ========================================================================== // Freescale Semiconductor MPL115A2 Barometer // ========================================================================== @@ -1390,7 +1390,7 @@ Variable* mplTemp = new FreescaleMPL115A2_Temp( /** End [freescale_mpl115a2] */ #endif -#if defined BUILD_SENSOR_GRO_POINT_GPLP8 +#if defined(BUILD_SENSOR_GRO_POINT_GPLP8) // ========================================================================== // GroPoint Profile GPLP-8 Soil Moisture and Temperature Sensor // ========================================================================== @@ -1463,7 +1463,7 @@ Variable* gplp8Temp13 = new GroPointGPLP8_Temp( #endif -#if defined BUILD_SENSOR_IN_SITU_RDO +#if defined(BUILD_SENSOR_IN_SITU_RDO) // ========================================================================== // In-Situ RDO PRO-X Rugged Dissolved Oxygen Probe // ========================================================================== @@ -1493,7 +1493,7 @@ Variable* rdoO2pp = #endif -#if defined BUILD_SENSOR_IN_SITU_TROLL_SDI12A +#if defined(BUILD_SENSOR_IN_SITU_TROLL_SDI12A) // ========================================================================== // In-Situ Aqua/Level TROLL Pressure, Temperature, and Depth Sensor // ========================================================================== @@ -1523,7 +1523,7 @@ Variable* trollDepth = new InSituTrollSdi12a_Depth( #endif -#if defined BUILD_SENSOR_KELLER_ACCULEVEL +#if defined(BUILD_SENSOR_KELLER_ACCULEVEL) // ========================================================================== // Keller Acculevel High Accuracy Submersible Level Transmitter // ========================================================================== @@ -1557,7 +1557,7 @@ Variable* acculevHeight = new KellerAcculevel_Height( #endif -#if defined BUILD_SENSOR_KELLER_NANOLEVEL +#if defined(BUILD_SENSOR_KELLER_NANOLEVEL) // ========================================================================== // Keller Nanolevel High Accuracy Submersible Level Transmitter // ========================================================================== @@ -1591,7 +1591,7 @@ Variable* nanolevHeight = new KellerNanolevel_Height( #endif -#if defined BUILD_SENSOR_MAX_BOTIX_SONAR +#if defined(BUILD_SENSOR_MAX_BOTIX_SONAR) // ========================================================================== // Maxbotix HRXL Ultrasonic Range Finder // ========================================================================== @@ -1608,10 +1608,11 @@ Variable* nanolevHeight = new KellerNanolevel_Height( const int8_t SonarPower = sensorPowerPin; // Excite (power) pin const int8_t Sonar1Trigger = -1; // Trigger pin // Trigger should be a *unique* negative number if unconnected -const uint8_t sonar1NumberReadings = 3; // The number of readings to average +const int16_t Sonar1MaxRange = 9999; // Maximum range of sonar +const uint8_t sonar1NumberReadings = 3; // The number of readings to average // Create a MaxBotix Sonar sensor object -MaxBotixSonar sonar1(sonarSerial, SonarPower, Sonar1Trigger, +MaxBotixSonar sonar1(sonarSerial, SonarPower, Sonar1Trigger, Sonar1MaxRange, sonar1NumberReadings); // Create an ultrasonic range variable pointer @@ -1652,7 +1653,7 @@ Variable* ds18Temp = new MaximDS18_Temp(&ds18, #endif -#if defined BUILD_SENSOR_MEA_SPEC_MS5803 +#if defined(BUILD_SENSOR_MEA_SPEC_MS5803) // ========================================================================== // Measurement Specialties MS5803-14BA pressure sensor // ========================================================================== @@ -1680,7 +1681,7 @@ Variable* ms5803Temp = #endif -#if defined BUILD_SENSOR_DECAGON_5TM +#if defined(BUILD_SENSOR_DECAGON_5TM) // ========================================================================== // Meter ECH2O Soil Moisture Sensor // ========================================================================== @@ -1707,7 +1708,7 @@ Variable* fivetmTemp = #endif -#if defined BUILD_SENSOR_METER_HYDROS21 +#if defined(BUILD_SENSOR_METER_HYDROS21) // ========================================================================== // Meter Hydros 21 Conductivity, Temperature, and Depth Sensor // ========================================================================== @@ -1736,7 +1737,7 @@ Variable* hydros21Depth = #endif -#if defined BUILD_SENSOR_METER_TEROS11 +#if defined(BUILD_SENSOR_METER_TEROS11) // ========================================================================== // Meter Teros 11 Soil Moisture Sensor // ========================================================================== @@ -1767,7 +1768,7 @@ Variable* teros11Count = #endif -#if defined BUILD_SENSOR_PALEO_TERRA_REDOX +#if defined(BUILD_SENSOR_PALEO_TERRA_REDOX) // ========================================================================== // PaleoTerra Redox Sensors // ========================================================================== @@ -1794,7 +1795,7 @@ Variable* ptVolt = new PaleoTerraRedox_Voltage( #endif -#if defined BUILD_SENSOR_RAIN_COUNTER_I2C +#if defined(BUILD_SENSOR_RAIN_COUNTER_I2C) // ========================================================================== // External I2C Rain Tipping Bucket Counter // ========================================================================== @@ -1823,7 +1824,7 @@ Variable* tbi2cDepth = #endif -#if defined BUILD_SENSOR_SENSIRION_SHT4X +#if defined(BUILD_SENSOR_SENSIRION_SHT4X) // ========================================================================== // Sensirion SHT4X Digital Humidity and Temperature Sensor // ========================================================================== @@ -1846,7 +1847,7 @@ Variable* sht4xTemp = #endif -#if defined BUILD_SENSOR_TALLY_COUNTER_I2C +#if defined(BUILD_SENSOR_TALLY_COUNTER_I2C) // ========================================================================== // Tally I2C Event Counter for rain or wind reed-switch sensors // ========================================================================== @@ -1879,7 +1880,7 @@ Variable* tallyEvents = new TallyCounterI2C_Events( #endif -#if defined BUILD_SENSOR_TI_INA219 +#if defined(BUILD_SENSOR_TI_INA219) // ========================================================================== // TI INA219 High Side Current/Voltage Sensor (Current mA, Voltage, Power) // ========================================================================== @@ -1907,7 +1908,7 @@ Variable* inaPower = new TIINA219_Power(&ina219, #endif -#if defined BUILD_SENSOR_TURNER_CYCLOPS +#if defined(BUILD_SENSOR_TURNER_CYCLOPS) // ========================================================================== // Turner Cyclops-7F Submersible Fluorometer // ========================================================================== @@ -1969,7 +1970,7 @@ Variable* cyclopsRedChloro = new TurnerCyclops_RedChlorophyll( #endif -#if defined BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY +#if defined(BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY) // ========================================================================== // Analog Electrical Conductivity using the Processor's Analog Pins // ========================================================================== @@ -2030,7 +2031,7 @@ Variable* analogEc_spcond = new Variable( #endif -#if defined BUILD_SENSOR_VEGA_PULS21 +#if defined(BUILD_SENSOR_VEGA_PULS21) // ========================================================================== // VEGA PULS 21 Radar Sensor // ========================================================================== @@ -2063,7 +2064,7 @@ Variable* VegaPulsError = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y504 +#if defined(BUILD_SENSOR_YOSEMITECH_Y504) // ========================================================================== // Yosemitech Y504 Dissolved Oxygen Sensor // ========================================================================== @@ -2098,7 +2099,7 @@ Variable* y504Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y510 +#if defined(BUILD_SENSOR_YOSEMITECH_Y510) // ========================================================================== // Yosemitech Y510 Turbidity Sensor // ========================================================================== @@ -2130,7 +2131,7 @@ Variable* y510Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y511 +#if defined(BUILD_SENSOR_YOSEMITECH_Y511) // ========================================================================== // Yosemitech Y511 Turbidity Sensor with Wiper // ========================================================================== @@ -2162,7 +2163,7 @@ Variable* y511Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y514 +#if defined(BUILD_SENSOR_YOSEMITECH_Y514) // ========================================================================== // Yosemitech Y514 Chlorophyll Sensor // ========================================================================== @@ -2195,7 +2196,7 @@ Variable* y514Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y520 +#if defined(BUILD_SENSOR_YOSEMITECH_Y520) // ========================================================================== // Yosemitech Y520 Conductivity Sensor // ========================================================================== @@ -2227,7 +2228,7 @@ Variable* y520Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y532 +#if defined(BUILD_SENSOR_YOSEMITECH_Y532) // ========================================================================== // Yosemitech Y532 pH // ========================================================================== @@ -2261,7 +2262,7 @@ Variable* y532Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y533 +#if defined(BUILD_SENSOR_YOSEMITECH_Y533) // ========================================================================== // Yosemitech Y533 Oxidation Reduction Potential (ORP) // ========================================================================== @@ -2292,7 +2293,7 @@ Variable* y533Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y551 +#if defined(BUILD_SENSOR_YOSEMITECH_Y551) // ========================================================================== // Yosemitech Y551 COD Sensor with Wiper // ========================================================================== @@ -2326,7 +2327,7 @@ Variable* y551Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y560 +#if defined(BUILD_SENSOR_YOSEMITECH_Y560) // ========================================================================== // Yosemitech Y560 Ammonium Probe with Wiper // ========================================================================== @@ -2362,7 +2363,7 @@ Variable* y560Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y700 +#if defined(BUILD_SENSOR_YOSEMITECH_Y700) // ========================================================================== // Yosemitech Y700 Pressure Sensor // ========================================================================== @@ -2394,7 +2395,7 @@ Variable* y700Temp = #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y4000 +#if defined(BUILD_SENSOR_YOSEMITECH_Y4000) // ========================================================================== // Yosemitech Y4000 Multiparameter Sonde (DOmgL, Turbidity, Cond, pH, Temp, // ORP, Chlorophyll, BGA) @@ -2439,7 +2440,7 @@ Variable* y4000BGA = #endif -#if defined BUILD_SENSOR_ZEBRA_TECH_D_OPTO +#if defined(BUILD_SENSOR_ZEBRA_TECH_D_OPTO) // ========================================================================== // Zebra Tech D-Opto Dissolved Oxygen Sensor // ========================================================================== @@ -2505,7 +2506,7 @@ Variable* calculatedVar = new Variable( /** End [calculated_variables] */ -#if defined BUILD_TEST_CREATE_IN_ARRAY +#if defined(BUILD_TEST_CREATE_IN_ARRAY) // ========================================================================== // Creating the Variable Array[s] and Filling with Variable Objects // NOTE: This shows three different ways of creating the same variable array @@ -2538,7 +2539,7 @@ VariableArray varArray(variableCount, variableList); // ========================================================================== -#elif defined BUILD_TEST_SEPARATE_UUIDS +#elif defined(BUILD_TEST_SEPARATE_UUIDS) /** Start [variables_separate_uuids] */ // Version 2: Create two separate arrays, on for the variables and a separate // one for the UUID's, then give both as input to the variable array @@ -2585,93 +2586,93 @@ Variable* variableList[] = { #if defined(ARDUINO_ARCH_AVR) || defined(MS_SAMD_DS3231) ds3231Temp, #endif -#if defined BUILD_SENSOR_AO_SONG_AM2315 +#if defined(BUILD_SENSOR_AO_SONG_AM2315) am2315Humid, am2315Temp, #endif -#if defined BUILD_SENSOR_AO_SONG_DHT +#if defined(BUILD_SENSOR_AO_SONG_DHT) dhtHumid, dhtTemp, dhtHI, #endif -#if defined BUILD_SENSOR_APOGEE_SQ212 +#if defined(BUILD_SENSOR_APOGEE_SQ212) sq212PAR, sq212voltage, #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2 +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_CO2) atlasCO2CO2, atlasCO2Temp, #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_DO +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_DO) atlasDOconc, atlasDOpct, #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_ORP) atlasORPot, #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_PH +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_PH) atlaspHpH, #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_RTD +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_RTD) atlasTemp, #endif -#if defined BUILD_SENSOR_ATLAS_SCIENTIFIC_EC +#if defined(BUILD_SENSOR_ATLAS_SCIENTIFIC_EC) atlasCond, atlasTDS, atlasSal, atlasGrav, atlasSpCond, #endif -#if defined BUILD_SENSOR_BOSCH_BME280 +#if defined(BUILD_SENSOR_BOSCH_BME280) bme280Temp, bme280Humid, bme280Press, bme280Alt, #endif -#if defined BUILD_SENSOR_BOSCH_BMP3XX +#if defined(BUILD_SENSOR_BOSCH_BMP3XX) bmp3xxTemp, bmp3xxPress, bmp3xxAlt, #endif -#if defined BUILD_SENSOR_CAMPBELL_CLARI_VUE10 +#if defined(BUILD_SENSOR_CAMPBELL_CLARI_VUE10) clarivueTurbidity, clarivueTemp, clarivueError, #endif -#if defined BUILD_SENSOR_CAMPBELL_OBS3 +#if defined(BUILD_SENSOR_CAMPBELL_OBS3) obs3TurbLow, obs3VoltLow, obs3TurbHigh, obs3VoltHigh, #endif -#if defined BUILD_SENSOR_CAMPBELL_RAIN_VUE10 +#if defined(BUILD_SENSOR_CAMPBELL_RAIN_VUE10) rainvuePrecipitation, rainvueTips, rainvueRainRateAve, rainvueRainRateMax, #endif -#if defined BUILD_SENSOR_DECAGON_CTD +#if defined(BUILD_SENSOR_DECAGON_CTD) ctdCond, ctdTemp, ctdDepth, #endif -#if defined BUILD_SENSOR_DECAGON_ES2 +#if defined(BUILD_SENSOR_DECAGON_ES2) es2Cond, es2Temp, #endif -#if defined BUILD_SENSOR_EVERLIGHT_ALSPT19 +#if defined(BUILD_SENSOR_EVERLIGHT_ALSPT19) alsPt19Volt, alsPt19Current, alsPt19Lux, #endif -#if defined BUILD_SENSOR_TIADS1X15 +#if defined(BUILD_SENSOR_TIADS1X15) ads1x15Volt, #endif -#if defined BUILD_SENSOR_FREESCALE_MPL115A2 +#if defined(BUILD_SENSOR_FREESCALE_MPL115A2) mplTemp, mplPress, #endif -#if defined BUILD_SENSOR_GRO_POINT_GPLP8 +#if defined(BUILD_SENSOR_GRO_POINT_GPLP8) gplp8Moist1, gplp8Moist2, gplp8Moist3, @@ -2694,73 +2695,73 @@ Variable* variableList[] = { gplp8Temp12, gplp8Temp13, #endif -#if defined BUILD_SENSOR_IN_SITU_RDO +#if defined(BUILD_SENSOR_IN_SITU_RDO) rdoTemp, rdoDOpct, rdoDOmgL, rdoO2pp, #endif -#if defined BUILD_SENSOR_IN_SITU_TROLL_SDI12A +#if defined(BUILD_SENSOR_IN_SITU_TROLL_SDI12A) trollPressure, trollTemp, trollDepth, #endif -#if defined BUILD_SENSOR_KELLER_ACCULEVEL +#if defined(BUILD_SENSOR_KELLER_ACCULEVEL) acculevPress, acculevTemp, acculevHeight, #endif -#if defined BUILD_SENSOR_KELLER_NANOLEVEL +#if defined(BUILD_SENSOR_KELLER_NANOLEVEL) nanolevPress, nanolevTemp, nanolevHeight, #endif -#if defined BUILD_SENSOR_MAX_BOTIX_SONAR +#if defined(BUILD_SENSOR_MAX_BOTIX_SONAR) sonar1Range, #endif -#if defined BUILD_SENSOR_MAXIM_DS18 +#if defined(BUILD_SENSOR_MAXIM_DS18) ds18Temp, #endif -#if defined BUILD_SENSOR_MEA_SPEC_MS5803 +#if defined(BUILD_SENSOR_MEA_SPEC_MS5803) ms5803Temp, ms5803Press, #endif -#if defined BUILD_SENSOR_DECAGON_5TM +#if defined(BUILD_SENSOR_DECAGON_5TM) fivetmEa, fivetmVWC, fivetmTemp, #endif -#if defined BUILD_SENSOR_METER_HYDROS21 +#if defined(BUILD_SENSOR_METER_HYDROS21) hydros21Cond, hydros21Temp, hydros21Depth, #endif -#if defined BUILD_SENSOR_METER_TEROS11 +#if defined(BUILD_SENSOR_METER_TEROS11) teros11Ea, teros11Temp, teros11VWC, teros11Count, #endif -#if defined BUILD_SENSOR_PALEO_TERRA_REDOX +#if defined(BUILD_SENSOR_PALEO_TERRA_REDOX) ptVolt, #endif -#if defined BUILD_SENSOR_RAIN_COUNTER_I2C +#if defined(BUILD_SENSOR_RAIN_COUNTER_I2C) tbi2cTips, tbi2cDepth, #endif -#if defined BUILD_SENSOR_SENSIRION_SHT4X +#if defined(BUILD_SENSOR_SENSIRION_SHT4X) sht4xHumid, sht4xTemp, #endif -#if defined BUILD_SENSOR_TALLY_COUNTER_I2C +#if defined(BUILD_SENSOR_TALLY_COUNTER_I2C) tallyEvents, #endif -#if defined BUILD_SENSOR_TI_INA219 +#if defined(BUILD_SENSOR_TI_INA219) inaVolt, inaCurrent, inaPower, #endif -#if defined BUILD_SENSOR_TURNER_CYCLOPS +#if defined(BUILD_SENSOR_TURNER_CYCLOPS) cyclopsVoltage, cyclopsChloro, cyclopsRWT, @@ -2776,62 +2777,62 @@ Variable* variableList[] = { cyclopsTryptophan, cyclopsRedChloro, #endif -#if defined BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY +#if defined(BUILD_SENSOR_ANALOG_ELEC_CONDUCTIVITY) analogEc_cond, analogEc_spcond, #endif -#if defined BUILD_SENSOR_VEGA_PULS21 +#if defined(BUILD_SENSOR_VEGA_PULS21) VegaPulsStage, VegaPulsDistance, VegaPulsTemp, VegaPulsRelia, VegaPulsError, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y504 +#if defined(BUILD_SENSOR_YOSEMITECH_Y504) y504DOpct, y504DOmgL, y504Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y510 +#if defined(BUILD_SENSOR_YOSEMITECH_Y510) y510Turb, y510Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y511 +#if defined(BUILD_SENSOR_YOSEMITECH_Y511) y511Turb, y511Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y514 +#if defined(BUILD_SENSOR_YOSEMITECH_Y514) y514Chloro, y514Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y520 +#if defined(BUILD_SENSOR_YOSEMITECH_Y520) y520Cond, y520Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y532 +#if defined(BUILD_SENSOR_YOSEMITECH_Y532) y532Voltage, y532pH, y532Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y533 +#if defined(BUILD_SENSOR_YOSEMITECH_Y533) y533ORP, y533Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y551 +#if defined(BUILD_SENSOR_YOSEMITECH_Y551) y551COD, y551Turbid, y551Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y560 +#if defined(BUILD_SENSOR_YOSEMITECH_Y560) y560NH4_N, y560pH, y560Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y700 +#if defined(BUILD_SENSOR_YOSEMITECH_Y700) y700Pres, y700Temp, #endif -#if defined BUILD_SENSOR_YOSEMITECH_Y4000 +#if defined(BUILD_SENSOR_YOSEMITECH_Y4000) y4000DO, y4000Turb, y4000Cond, @@ -2841,7 +2842,7 @@ Variable* variableList[] = { y4000Chloro, y4000BGA, #endif -#if defined BUILD_SENSOR_ZEBRA_TECH_D_OPTO +#if defined(BUILD_SENSOR_ZEBRA_TECH_D_OPTO) dOptoDOpct, dOptoDOmgL, dOptoTemp, @@ -2874,7 +2875,7 @@ Logger dataLogger(LoggerID, loggingInterval, &varArray); /** End [loggers] */ -#if defined BUILD_PUB_ENVIRO_DIY_PUBLISHER +#if defined(BUILD_PUB_ENVIRO_DIY_PUBLISHER) // ========================================================================== // A Publisher to Monitor My Watershed / EnviroDIY Data Sharing Portal // ========================================================================== @@ -2894,7 +2895,7 @@ EnviroDIYPublisher EnviroDIYPOST(dataLogger, &modem.gsmClient, #endif -#if defined BUILD_PUB_DREAM_HOST_PUBLISHER +#if defined(BUILD_PUB_DREAM_HOST_PUBLISHER) // ========================================================================== // A Publisher to DreamHost // ========================================================================== @@ -2912,7 +2913,7 @@ DreamHostPublisher DreamHostGET(dataLogger, &modem.gsmClient, #endif -#if defined BUILD_PUB_THING_SPEAK_PUBLISHER +#if defined(BUILD_PUB_THING_SPEAK_PUBLISHER) // ========================================================================== // ThingSpeak Data Publisher // ========================================================================== @@ -2937,7 +2938,7 @@ ThingSpeakPublisher TsMqtt(dataLogger, &modem.gsmClient, thingSpeakMQTTKey, #endif -#if defined BUILD_PUB_UBIDOTS_PUBLISHER +#if defined(BUILD_PUB_UBIDOTS_PUBLISHER) // ========================================================================== // Ubidots Data Publisher // ========================================================================== @@ -2978,7 +2979,10 @@ void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { // Uses the processor sensor object to read the battery voltage // NOTE: This will actually return the battery level from the previous update! float getBatteryVoltage() { - if (mcuBoard.sensorValues[PROCESSOR_BATTERY_VAR_NUM] == -9999) mcuBoard.update(); + if (mcuBoard.sensorValues[PROCESSOR_BATTERY_VAR_NUM] == -9999 || + mcuBoard.sensorValues[PROCESSOR_BATTERY_VAR_NUM] == 0) { + mcuBoard.update(); + } return mcuBoard.sensorValues[PROCESSOR_BATTERY_VAR_NUM]; } /** End [working_functions] */ @@ -2992,7 +2996,7 @@ void setup() { // Wait for USB connection to be established by PC // NOTE: Only use this when debugging - if not connected to a PC, this // could prevent the script from starting -#if defined SERIAL_PORT_USBVIRTUAL +#if defined(SERIAL_PORT_USBVIRTUAL) while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000L)) { // wait } @@ -3019,11 +3023,11 @@ void setup() { /** Start [setup_softserial] */ // Allow interrupts for software serial -#if defined BUILD_TEST_SOFTSERIAL +#if defined(BUILD_TEST_SOFTSERIAL) enableInterrupt(softSerialRx, SoftwareSerial_ExtInts::handle_interrupt, CHANGE); #endif -#if defined BUILD_TEST_NEOSWSERIAL +#if defined(BUILD_TEST_NEOSWSERIAL) enableInterrupt(neoSSerial1Rx, neoSSerial1ISR, CHANGE); #endif /** End [setup_softserial] */ @@ -3036,7 +3040,7 @@ void setup() { // all currently supported modbus sensors use 9600 baud modbusSerial.begin(9600); -#if defined BUILD_SENSOR_MAX_BOTIX_SONAR +#if defined(BUILD_SENSOR_MAX_BOTIX_SONAR) // Start the SoftwareSerial stream for the sonar; it will always be at 9600 // baud sonarSerial.begin(9600); @@ -3046,7 +3050,7 @@ void setup() { // Assign pins SERCOM functionality for SAMD boards // NOTE: This must happen *after* the various serial.begin statements /** Start [setup_samd_pins] */ -#if defined ARDUINO_ARCH_SAMD +#if defined(ARDUINO_ARCH_SAMD) #ifndef ENABLE_SERIAL2 pinPeripheral(10, PIO_SERCOM); // Serial2 Tx/Dout = SERCOM1 Pad #2 pinPeripheral(11, PIO_SERCOM); // Serial2 Rx/Din = SERCOM1 Pad #0 @@ -3112,7 +3116,7 @@ void setup() { /** End [setup_esp] */ #endif -#if defined BUILD_TEST_SKYWIRE +#if defined(BUILD_TEST_SKYWIRE) /** Start [setup_skywire] */ modem.setModemStatusLevel(LOW); // If using CTS, LOW modem.setModemWakeLevel(HIGH); // Skywire dev board inverts the signal @@ -3120,7 +3124,7 @@ void setup() { /** End [setup_skywire] */ #endif -#if defined BUILD_MODEM_SIM_COM_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 @@ -3139,7 +3143,7 @@ void setup() { /** End [setup_sim7080] */ #endif -#if defined BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT +#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...")); @@ -3176,7 +3180,7 @@ void setup() { #endif -#if defined BUILD_MODEM_DIGI_XBEE_LTE_BYPASS +#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/simple_logging/ReadMe.md b/examples/simple_logging/ReadMe.md index 372e082a7..a5c8cbd16 100644 --- a/examples/simple_logging/ReadMe.md +++ b/examples/simple_logging/ReadMe.md @@ -13,31 +13,33 @@ _______ [//]: # ( @m_footernavigation ) [//]: # ( Start GitHub Only ) + - [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) - - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - - [Set the logger ID](#set-the-logger-id) - - [Upload!](#upload) + - [Unique Features of the Simple Logging Example](#unique-features-of-the-simple-logging-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 ) +## Unique Features of the Simple Logging Example - -# Unique Features of the Simple Logging Example - Only logs data to an SD card. -# To Use this Example +## To Use this Example + +### 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. - - Without this, the program won't compile. + - 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.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. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -45,12 +47,12 @@ _______ const char *LoggerID = "XXXX"; ``` -## Upload! +### Upload! + - Test everything at home **before** deploying out in the wild! _______ - [//]: # ( @section example_simple_logging_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} simple_logging/platformio.ini ) diff --git a/examples/simple_logging_LearnEnviroDIY/ReadMe.md b/examples/simple_logging_LearnEnviroDIY/ReadMe.md index abc46699d..3b5635525 100644 --- a/examples/simple_logging_LearnEnviroDIY/ReadMe.md +++ b/examples/simple_logging_LearnEnviroDIY/ReadMe.md @@ -1,4 +1,4 @@ -# Learn EnviroDIY Course +# 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. @@ -15,32 +15,36 @@ _______ [//]: # ( @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) - - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - - [Set the logger ID](#set-the-logger-id) - - [Upload!](#upload) + - [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 ) _______ -# 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 -# To Use this Example +## To Use this Example + +### 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. + - 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. + - Delete main.cpp in that folder. + +### Set the logger ID -## Set the logger ID - Change the "XXXX" in this section of code to the loggerID assigned by Stroud: ```cpp @@ -48,13 +52,12 @@ _______ const char *LoggerID = "XXXX"; ``` -## 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 ) diff --git a/examples/single_sensor/ReadMe.md b/examples/single_sensor/ReadMe.md index a68d12824..858a2b775 100644 --- a/examples/single_sensor/ReadMe.md +++ b/examples/single_sensor/ReadMe.md @@ -1,4 +1,4 @@ -# Using 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. @@ -10,36 +10,39 @@ _______ [//]: # ( @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) - - [Prepare and set up PlatformIO](#prepare-and-set-up-platformio) - - [Upload!](#upload) + - [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) + - [Upload!](#upload) [//]: # ( End GitHub Only ) _______ -# 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. -# To Use this Example +## To Use this Example + +### 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. - - Without this, the program won't compile. + - 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 [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. + - Delete main.cpp in that folder. + +### Upload! -## Upload! - Upload and see what happens _______ - [//]: # ( @section example_single_sensor_pio_config PlatformIO Configuration ) [//]: # ( @include{lineno} single_sensor/platformio.ini ) diff --git a/extras/LTExBee_FirstConnection/LTExBee_FirstConnection.ino b/extras/LTExBee_FirstConnection/LTExBee_FirstConnection.ino index 53c5ccefc..fbd762fe3 100644 --- a/extras/LTExBee_FirstConnection/LTExBee_FirstConnection.ino +++ b/extras/LTExBee_FirstConnection/LTExBee_FirstConnection.ino @@ -1,3 +1,11 @@ +/** ========================================================================= + * @example{lineno} LTExBee_FirstConnection.ino + * @brief Testing sketch to set up a never-previously-connected LTE XBee running + * in standard (transparent) mode. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #define TINY_GSM_MODEM_XBEE #define TINY_GSM_RX_BUFFER 64 #define TINY_GSM_YIELD_MS 2 diff --git a/extras/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino b/extras/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino index 3a53f8de3..ec82a57a1 100644 --- a/extras/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino +++ b/extras/LTExBee_FirstConnectionBypass/LTExBee_FirstConnectionBypass.ino @@ -1,3 +1,11 @@ +/** ========================================================================= + * @example{lineno} LTExBee_FirstConnectionBypass.ino + * @brief Testing sketch to set up a never-previously-connected LTE XBee running + * in bypass mode. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #define TINY_GSM_MODEM_SARAR4 #define TINY_GSM_RX_BUFFER 64 #define TINY_GSM_YIELD_MS 2 diff --git a/extras/ReadMe.md b/extras/ReadMe.md new file mode 100644 index 000000000..c2c2edf53 --- /dev/null +++ b/extras/ReadMe.md @@ -0,0 +1,26 @@ +# Extra Helper Sketches + +A collection of helper sketches to test individual sensor timing and configurations. + +- powerOn.ino + - Testing sketch that simply turns on power to the sensors on the Mayfly. +- oneWireSearch.ino + - Testing sketch to scan for 1-Wire devices + code snippet generator +- i2c_scanner.ino + - Testing sketch to scan for attached I2C devices +- i2c_warmUp.ino + - Testing sketch to see how long an attached I2C device takes to begin to respond to commands. +- interrupt_counter.ino + - Testing sketch counting pin change interrupts. +- resetBee.ino + - Testing sketch to fully reset an XBee +- LTExBee_FirstConnection.ino + - Testing sketch to set up a never-previously-connected LTE XBee running in standard (transparent) mode. +- LTExBee_FirstConnectionBypass.ino + - Testing sketch to set up a never-previously-connected LTE XBee running in bypass mode. +- mega_serial_spy.ino + - Testing sketch to run on an Arduino Mega to print all output from connected serial ports to the terminal. +- sdi12_address_change.ino + - Copy of SDI-12 Example B: Changing the Address of your SDI-12 sensor +- Stream_Debug.ino + - Testing sketch to run StreamDebugger to copy text from one serial output to another. diff --git a/extras/Stream_Debug/Stream_Debug.ino b/extras/Stream_Debug/Stream_Debug.ino index af86151e1..3efff6a6e 100644 --- a/extras/Stream_Debug/Stream_Debug.ino +++ b/extras/Stream_Debug/Stream_Debug.ino @@ -1,3 +1,11 @@ +/** ========================================================================= + * @example{lineno} Stream_Debug.ino + * @brief Testing sketch to run StreamDebugger to copy text from one serial + * output to another. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #include #include StreamDebugger StreamDbg(Serial1, Serial); diff --git a/extras/extras.dox b/extras/extras.dox new file mode 100644 index 000000000..6585d0cde --- /dev/null +++ b/extras/extras.dox @@ -0,0 +1,5 @@ +/** + * @dir extras + * + * @brief Contains extra sketches for testing and configuring new sensors. + */ diff --git a/extras/i2c_scanner/i2c_scanner.ino b/extras/i2c_scanner/i2c_scanner.ino index 83ccfa699..1b4e98101 100644 --- a/extras/i2c_scanner/i2c_scanner.ino +++ b/extras/i2c_scanner/i2c_scanner.ino @@ -1,31 +1,34 @@ -// -------------------------------------- -// i2c_scanner -// -// Version 1 -// This program (or code that looks like it) -// can be found in many places. -// For example on the Arduino.cc forum. -// The original author is not know. -// Version 2, Juni 2012, Using Arduino 1.0.1 -// Adapted to be as simple as possible by Arduino.cc user Krodal -// Version 3, Feb 26 2013 -// V3 by louarnold -// Version 4, March 3, 2013, Using Arduino 1.0.3 -// by Arduino.cc user Krodal. -// Changes by louarnold removed. -// Scanning addresses changed from 0...127 to 1...119, -// according to the i2c scanner by Nick Gammon -// http://www.gammon.com.au/forum/?id=10896 -// Version 5, March 28, 2013 -// As version 4, but address scans now to 127. -// A sensor seems to use address 120. -// Version 6, November 27, 2015. -// Added waiting for the Leonardo serial communication. -// -// -// This sketch tests the standard 7-bit addresses -// Devices with higher bit address might not be seen properly. -// +/** ========================================================================= + * @example{lineno} i2c_scanner.ino + * @brief Testing sketch to scan for attached I2C devices + * + * Version 1 + * This program (or code that looks like it) + * can be found in many places. + * For example on the Arduino.cc forum. + * The original author is not know. + * Version 2, Juni 2012, Using Arduino 1.0.1 + * Adapted to be as simple as possible by Arduino.cc user Krodal + * Version 3, Feb 26 2013 + * V3 by louarnold + * Version 4, March 3, 2013, Using Arduino 1.0.3 + * by Arduino.cc user Krodal. + * Changes by louarnold removed. + * Scanning addresses changed from 0...127 to 1...119, + * according to the i2c scanner by Nick Gammon + * http://www.gammon.com.au/forum/?id=10896 + * Version 5, March 28, 2013 + * As version 4, but address scans now to 127. + * A sensor seems to use address 120. + * Version 6, November 27, 2015. + * Added waiting for the Leonardo serial communication. + * + * + * This sketch tests the standard 7-bit addresses. + * Devices with higher bit address might not be seen properly. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ #include #include diff --git a/extras/i2c_warmUp/i2c_warmUp.ino b/extras/i2c_warmUp/i2c_warmUp.ino index 998e74860..b9772c437 100644 --- a/extras/i2c_warmUp/i2c_warmUp.ino +++ b/extras/i2c_warmUp/i2c_warmUp.ino @@ -1,3 +1,11 @@ +/** ========================================================================= + * @example{lineno} i2c_warmUp.ino + * @brief Testing sketch to see how long an attached I2C device takes to + * begin to respond to commands. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #include #include diff --git a/extras/interrupt_counter/interrupt_counter.ino b/extras/interrupt_counter/interrupt_counter.ino index 5dec9af2b..8f590f06c 100644 --- a/extras/interrupt_counter/interrupt_counter.ino +++ b/extras/interrupt_counter/interrupt_counter.ino @@ -1,3 +1,10 @@ +/** ========================================================================= + * @example{lineno} interrupt_counter.ino + * @brief Testing sketch counting pin change interrupts. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #include #define EI_ARDUINO_INTERRUPTED_PIN diff --git a/extras/mega_serial_spy/mega_serial_spy.ino b/extras/mega_serial_spy/mega_serial_spy.ino index 7d9316369..cbadac2c6 100644 --- a/extras/mega_serial_spy/mega_serial_spy.ino +++ b/extras/mega_serial_spy/mega_serial_spy.ino @@ -1,3 +1,11 @@ +/** ========================================================================= + * @example{lineno} mega_serial_spy.ino + * @brief Testing sketch to run on an Arduino Mega to print all output from + * connected serial ports to the terminal. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #include void changeBauds(void) { diff --git a/extras/oneWireSearch/oneWireSearch.ino b/extras/oneWireSearch/oneWireSearch.ino index 8a7872d2e..1c7b363d5 100644 --- a/extras/oneWireSearch/oneWireSearch.ino +++ b/extras/oneWireSearch/oneWireSearch.ino @@ -1,19 +1,22 @@ -// -// FILE: oneWireSearch.ino -// AUTHOR: Rob Tillaart -// VERSION: 0.1.02 -// PURPOSE: scan for 1-Wire devices + code snippet generator -// DATE: 2015-june-30 -// URL: http://forum.arduino.cc/index.php?topic=333923 -// -// inspired by -// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html -// -// Released to the public domain -// -// 0.1.00 initial version -// 0.1.01 first published version -// 0.1.02 small output changes +/** ========================================================================= + * @example{lineno} oneWireSearch.ino + * @author Rob Tillaart + * VERSION: 0.1.02 + * @brief scan for 1-Wire devices + code snippet generator + * DATE: 2015-june-30 + * URL: http://forum.arduino.cc/index.php?topic=333923 + * + * inspired by + * http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html + * + * Released to the public domain + * + * 0.1.00 initial version + * 0.1.01 first published version + * 0.1.02 small output changes + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ #include #include diff --git a/extras/powerOn/powerOn.ino b/extras/powerOn/powerOn.ino index ae244aeaf..253f70691 100644 --- a/extras/powerOn/powerOn.ino +++ b/extras/powerOn/powerOn.ino @@ -1,3 +1,11 @@ +/** ========================================================================= + * @example{lineno} powerOn.ino + * @brief Testing sketch that simply turns on power to the sensors on the + * Mayfly. + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #include int8_t powerPin = 22; diff --git a/extras/resetBee/resetBee.ino b/extras/resetBee/resetBee.ino index f08874ec5..78da1ac53 100644 --- a/extras/resetBee/resetBee.ino +++ b/extras/resetBee/resetBee.ino @@ -1,3 +1,10 @@ +/** ========================================================================= + * @example{lineno} resetBee.ino + * @brief Testing sketch to fully reset an XBee + * + * @m_examplenavigation{page_extra_helper_sketches,} + * ======================================================================= */ + #include void setup() { diff --git a/extras/sdi12_address_change/sdi12_address_change.ino b/extras/sdi12_address_change/sdi12_address_change.ino index 4b5a44690..7ca735831 100644 --- a/extras/sdi12_address_change/sdi12_address_change.ino +++ b/extras/sdi12_address_change/sdi12_address_change.ino @@ -1,52 +1,17 @@ -/* -######################## -# OVERVIEW # -######################## - - Example B: Changing the address of a sensor. - - This is a simple demonstration of the SDI-12 library for arduino. - It discovers the address of the attached sensor and allows you to change it. - -######################### -# THE CIRCUIT # -######################### - - The circuit: You should not have more than one SDI-12 device attached for this -example. - - See: - https://raw.github.com/Kevin-M-Smith/SDI-12-Circuit-Diagrams/master/basic_setup_no_usb.png - or - https://raw.github.com/Kevin-M-Smith/SDI-12-Circuit-Diagrams/master/compat_setup_usb.png - -########################### -# COMPATIBILITY # -########################### - - This library requires the use of pin change interrupts (PCINT). - Not all Arduino boards have the same pin capabilities. - The known compatibile pins for common variants are shown below. - - Arduino Uno: All pins. - - Arduino Mega or Mega 2560: - 10, 11, 12, 13, 14, 15, 50, 51, 52, 53, A8 (62), - A9 (63), A10 (64), A11 (65), A12 (66), A13 (67), A14 (68), A15 (69). - - Arduino Leonardo: - 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI) - -######################### -# RESOURCES # -######################### - - Written by Kevin M. Smith in 2013. - Contact: SDI12@ethosengineering.org - - The SDI-12 specification is available at: http://www.sdi-12.org/ - The library is available at: https://github.com/EnviroDIY/Arduino-SDI-12 -*/ +/** + * @example{lineno} sdi12_address_change.ino + * @copyright Stroud Water Research Center + * This example is published under the BSD-3 license. + * @author Kevin M.Smith + * @date August 2013 + * + * @brief Copy of SDI-12 Example B: Changing the Address of your SDI-12 Sensor + * + * The SDI-12 specification is available at: http://www.sdi-12.org/ + * The library is available at: https://github.com/EnviroDIY/Arduino-SDI-12 + * + * @m_examplenavigation{page_extra_helper_sketches,} + */ #include diff --git a/library.json b/library.json index a8518e866..14714c136 100644 --- a/library.json +++ b/library.json @@ -109,7 +109,7 @@ { "name": "TinyGSM", "owner": "vshymanskyy", - "version": "~0.11.7", + "version": "~0.12.0", "note": "A small Arduino library for GPRS modules.", "authors": ["Volodymyr Shymanskyy", "Sara Damiano"], "frameworks": "arduino", @@ -268,7 +268,7 @@ "name": "SDI-12", "owner": "envirodiy", "library id": "1486", - "version": "~2.1.4", + "version": "~2.2.0", "url": "https://github.com/EnviroDIY/Arduino-SDI-12", "note": "EnviroDIY SDI-12 Library for Arduino", "author_notes": [ @@ -303,7 +303,7 @@ "owner": "envirodiy", "library id": "1824", "url": "https://github.com/EnviroDIY/SensorModbusMaster", - "version": "~0.6.8", + "version": "~0.7.0", "note": "EnviroDIY SensorModbusMaster - Arduino library for communicating via modbus with the Arduino acting as the modbus master.", "authors": ["Sara Damiano"], "frameworks": "arduino", diff --git a/pioScripts/generate_compile_commands.py b/pioScripts/generate_compile_commands.py deleted file mode 100644 index f3e9ccaa8..000000000 --- a/pioScripts/generate_compile_commands.py +++ /dev/null @@ -1,13 +0,0 @@ -import os - -Import("env") - -print("Generating compile commands!") - -# include toolchain paths -env.Replace(COMPILATIONDB_INCLUDE_TOOLCHAIN=True) - -# override compilation DB path -env.Replace( - COMPILATIONDB_PATH=os.path.join("$PROJECT_DIR/.vscode", "compile_commands.json") -) diff --git a/pioScripts/pio_set_global_flags.py b/pioScripts/pio_set_global_flags.py deleted file mode 100644 index 95343342f..000000000 --- a/pioScripts/pio_set_global_flags.py +++ /dev/null @@ -1,24 +0,0 @@ -Import('env') -from os.path import join, realpath - -# append flags to local build environment (for just this library) -env.Append( - CPPDEFINES=[ - ("NEOSWSERIAL_EXTERNAL_PCINT",), - ("SDI12_EXTERNAL_PCINT",) - ] -) -# print ">>>>>LOCAL ENV<<<<<" -# print env.Dump() - -# append the same flags to the global build environment (for all libraries, etc) -global_env = DefaultEnvironment() -global_env.Append( - CPPDEFINES=[ - ("NEOSWSERIAL_EXTERNAL_PCINT",), - ("SDI12_EXTERNAL_PCINT",) - ("MQTT_MAX_PACKET_SIZE",240) - ] -) -# print "<<<<>>>>" -# print global_env.Dump() diff --git a/src/LoggerBase.cpp b/src/LoggerBase.cpp index 07078d116..cb94e5e33 100644 --- a/src/LoggerBase.cpp +++ b/src/LoggerBase.cpp @@ -37,7 +37,7 @@ volatile bool Logger::startTesting = false; // Initialize the RTC for the SAMD boards using build in RTC // Needed for static instances -#if not defined(MS_SAMD_DS3231) && defined(ARDUINO_ARCH_SAMD) +#if !defined(MS_SAMD_DS3231) && defined(ARDUINO_ARCH_SAMD) RTCZero Logger::zero_sleep_rtc; #endif @@ -277,7 +277,7 @@ String Logger::getValueStringAtI(uint8_t position_i) { // ===================================================================== // // Set up communications -// Adds a loggerModem objct to the logger +// Adds a loggerModem object to the logger // loggerModem = TinyGSM modem + TinyGSM client + Modem On Off void Logger::attachModem(loggerModem& modem) { _logModem = &modem; @@ -438,7 +438,7 @@ uint32_t Logger::getNowLocalEpoch(void) { return currentEpochTime; } -#if defined(MS_SAMD_DS3231) || not defined(ARDUINO_ARCH_SAMD) +#if defined(MS_SAMD_DS3231) || !defined(ARDUINO_ARCH_SAMD) uint32_t Logger::getNowUTCEpoch(void) { return rtc.now().getEpoch(); @@ -447,7 +447,7 @@ void Logger::setNowUTCEpoch(uint32_t ts) { rtc.setEpoch(ts); } -#elif defined ARDUINO_ARCH_SAMD +#elif defined(ARDUINO_ARCH_SAMD) uint32_t Logger::getNowUTCEpoch(void) { return zero_sleep_rtc.getEpoch(); @@ -579,13 +579,21 @@ void Logger::markTime(void) { bool Logger::checkInterval(void) { bool retval; uint32_t checkTime = getNowLocalEpoch(); + uint16_t interval = _loggingIntervalMinutes; + if (_initialShortIntervals > 0) { + // log the first few samples at an interval of 1 minute so that + // operation can be quickly verified in the field + _initialShortIntervals -= 1; + interval = 1; + } + MS_DBG(F("Current Unix Timestamp:"), checkTime, F("->"), formatDateTime_ISO8601(checkTime)); - MS_DBG(F("Logging interval in seconds:"), (_loggingIntervalMinutes * 60)); + MS_DBG(F("Logging interval in seconds:"), (interval * 60)); MS_DBG(F("Mod of Logging Interval:"), - checkTime % (_loggingIntervalMinutes * 60)); + checkTime % (interval * 60)); - if (checkTime % (_loggingIntervalMinutes * 60) == 0) { + if (checkTime % (interval * 60) == 0) { // Update the time variables with the current time markTime(); MS_DBG(F("Time marked at (unix):"), Logger::markedLocalEpochTime); @@ -673,7 +681,7 @@ bool Logger::checkMarkedInterval(void) { // Set up the Interrupt Service Request for waking // In this case, we're doing nothing, we just want the processor to wake // This must be a static function (which means it can only call other static -// funcions.) +// functions.) void Logger::wakeISR(void) { MS_DEEP_DBG(F("\nClock interrupt!")); } @@ -691,7 +699,7 @@ void Logger::systemSleep(void) { // Send a message that we're getting ready MS_DBG(F("Preparing processor for sleep. ZZzzz...")); -#if defined(MS_SAMD_DS3231) || not defined(ARDUINO_ARCH_SAMD) +#if defined(MS_SAMD_DS3231) || !defined(ARDUINO_ARCH_SAMD) // Unfortunately, because of the way the alarm on the DS3231 is set up, it // cannot interrupt on any frequencies other than every second, minute, @@ -713,7 +721,7 @@ void Logger::systemSleep(void) { // attach the interrupt enableInterrupt(_mcuWakePin, wakeISR, CHANGE); -#if defined ARDUINO_ARCH_SAMD && not defined(__SAMD51__) +#if defined(ARDUINO_ARCH_SAMD) && !defined(__SAMD51__) // Reconfigure the clock after attaching the interrupt // This is needed because the attachInterrupt function will reconfigure the // clock source for the EIC to GCLK0 every time a new interrupt is attached @@ -731,9 +739,9 @@ void Logger::systemSleep(void) { EExt_Interrupts in = g_APinDescription[_mcuWakePin].ulExtInt; // Enable wakeup capability on pin in case being used during sleep EIC->WAKEUP.reg |= (1 << in); -#endif // defined ARDUINO_ARCH_SAMD && not defined(__SAMD51__) +#endif // #if defined(ARDUINO_ARCH_SAMD) && ! defined(__SAMD51__) -#elif defined ARDUINO_ARCH_SAMD +#elif defined(ARDUINO_ARCH_SAMD) // Make sure interrupts are enabled for the clock NVIC_EnableIRQ(RTC_IRQn); // enable RTC interrupt @@ -749,7 +757,7 @@ void Logger::systemSleep(void) { zero_sleep_rtc.setAlarmSeconds(59); zero_sleep_rtc.enableAlarm(zero_sleep_rtc.MATCH_SS); -#endif // defined(MS_SAMD_DS3231) || not defined(ARDUINO_ARCH_SAMD) +#endif // defined(MS_SAMD_DS3231) || ! defined(ARDUINO_ARCH_SAMD) // Stop any I2C connections @@ -779,13 +787,13 @@ void Logger::systemSleep(void) { #if defined(STANDARD_SERIAL_OUTPUT) STANDARD_SERIAL_OUTPUT.flush(); // for debugging #endif -#if defined DEBUGGING_SERIAL_OUTPUT +#if defined(DEBUGGING_SERIAL_OUTPUT) DEBUGGING_SERIAL_OUTPUT.flush(); // for debugging #endif -#if defined ARDUINO_ARCH_SAMD +#if defined(ARDUINO_ARCH_SAMD) -#if not defined(USE_TINYUSB) && defined(USBCON) +#if !defined(USE_TINYUSB) && defined(USBCON) // Detach the USB, iff not using TinyUSB MS_DEEP_DBG(F("Detaching USB")); Serial.flush(); // wait for any outgoing messages on Serial = USB @@ -831,7 +839,7 @@ void Logger::systemSleep(void) { __DSB(); // Data sync to ensure outgoing memory accesses complete __WFI(); // Wait for interrupt (places device in sleep mode) -#elif defined ARDUINO_ARCH_AVR +#elif defined(ARDUINO_ARCH_AVR) // Disable USB if it exists #ifdef USBCON @@ -890,19 +898,19 @@ void Logger::systemSleep(void) { // --------------------------------------------------------------------- // -- The portion below this happens on wake up, after any wake ISR's -- -#if defined ARDUINO_ARCH_SAMD -#if not defined(__SAMD51__) +#if defined(ARDUINO_ARCH_SAMD) +#if !defined(__SAMD51__) // Enable systick interrupt SysTick->CTRL |= SysTick_CTRL_TICKINT_Msk; #endif // Reattach the USB -#if not defined(USE_TINYUSB) && defined(USBCON) +#if !defined(USE_TINYUSB) && defined(USBCON) USBDevice.init(); USBDevice.attach(); #endif #endif -#if defined ARDUINO_ARCH_AVR +#if defined(ARDUINO_ARCH_AVR) // Temporarily disables interrupts, so no mistakes are made when writing // to the processor registers @@ -949,7 +957,7 @@ void Logger::systemSleep(void) { // the timeout period is a useless delay. Wire.setTimeout(0); -#if defined(MS_SAMD_DS3231) || not defined(ARDUINO_ARCH_SAMD) +#if defined(MS_SAMD_DS3231) || !defined(ARDUINO_ARCH_SAMD) // Stop the clock from sending out any interrupts while we're awake. // There's no reason to waste thought on the clock interrupt if it // happens while the processor is awake and doing other things. @@ -958,7 +966,7 @@ void Logger::systemSleep(void) { // Detach the from the pin disableInterrupt(_mcuWakePin); -#elif defined ARDUINO_ARCH_SAMD +#elif defined(ARDUINO_ARCH_SAMD) MS_DEEP_DBG(F("Unsetting the alarm on the built in RTC")); zero_sleep_rtc.disableAlarm(); #endif @@ -1272,7 +1280,7 @@ void Logger::testingISR() { // This defines what to do in the testing mode -void Logger::testingMode() { +void Logger::testingMode(bool sleepBeforeReturning) { // Flag to notify that we're in testing mode Logger::isTestingNow = true; // Unset the startTesting flag @@ -1349,8 +1357,10 @@ void Logger::testingMode() { // Unset testing mode flag Logger::isTestingNow = false; - // Sleep - systemSleep(); + if (sleepBeforeReturning) { + // Sleep + systemSleep(); + } } @@ -1393,7 +1403,7 @@ void Logger::begin() { // Enable the watchdog watchDogTimer.enableWatchDog(); -#if not defined(MS_SAMD_DS3231) && defined(ARDUINO_ARCH_SAMD) +#if !defined(MS_SAMD_DS3231) && defined(ARDUINO_ARCH_SAMD) MS_DBG(F("Beginning internal real time clock")); zero_sleep_rtc.begin(); #endif @@ -1425,7 +1435,7 @@ void Logger::begin() { setLoggerPins(_mcuWakePin, _SDCardSSPin, _SDCardPowerPin, _buttonPin, _ledPin); -#if defined(MS_SAMD_DS3231) || not defined(ARDUINO_ARCH_SAMD) +#if defined(MS_SAMD_DS3231) || !defined(ARDUINO_ARCH_SAMD) MS_DBG(F("Beginning DS3231 real time clock")); rtc.begin(); #endif @@ -1453,12 +1463,20 @@ void Logger::begin() { PRINTOUT(F("Sampling feature UUID is:"), _samplingFeatureUUID); } + + for (uint8_t i = 0; i < MAX_NUMBER_SENDERS; i++) { + if (dataPublishers[i] != nullptr) { + PRINTOUT(F("Data will be published to ["), i, F("]"), + dataPublishers[i]->getEndpoint()); + } + } + PRINTOUT(F("Logger portion of setup finished.\n")); } // This is a one-and-done to log data -void Logger::logData(void) { +void Logger::logData(bool sleepBeforeReturning) { // Reset the watchdog watchDogTimer.resetWatchDog(); @@ -1502,11 +1520,13 @@ void Logger::logData(void) { // Check if it was instead the testing interrupt that woke us up if (Logger::startTesting) testingMode(); - // Sleep - systemSleep(); + if (sleepBeforeReturning) { + // Sleep + systemSleep(); + } } // This is a one-and-done to log data -void Logger::logDataAndPublish(void) { +void Logger::logDataAndPublish(bool sleepBeforeReturning) { // Reset the watchdog watchDogTimer.resetWatchDog(); @@ -1553,7 +1573,7 @@ void Logger::logDataAndPublish(void) { // Connect to the network watchDogTimer.resetWatchDog(); MS_DBG(F("Connecting to the Internet...")); - if (_logModem->connectInternet()) { + if (_logModem->connectInternet(240000L)) { // Publish data to remotes watchDogTimer.resetWatchDog(); publishDataToRemotes(); @@ -1602,8 +1622,10 @@ void Logger::logDataAndPublish(void) { } // Check if it was instead the testing interrupt that woke us up - if (Logger::startTesting) testingMode(); + if (Logger::startTesting) testingMode(sleepBeforeReturning); - // Call the processor sleep - systemSleep(); + if (sleepBeforeReturning) { + // Sleep + systemSleep(); + } } diff --git a/src/LoggerBase.h b/src/LoggerBase.h index 179baee2f..5183aa623 100644 --- a/src/LoggerBase.h +++ b/src/LoggerBase.h @@ -18,7 +18,9 @@ // Debugging Statement // #define MS_LOGGERBASE_DEBUG -// Set default clock for SAMD21 as DS3231 instead of built-in RTC +/** + * @brief Set default clock for SAMD21 as DS3231 instead of built-in RTC + */ #define MS_SAMD_DS3231 #ifdef MS_LOGGERBASE_DEBUG @@ -39,7 +41,7 @@ // Bring in the libraries to handle the processor sleep/standby modes // The SAMD library can also the built-in clock on those modules #if defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAMD_ZERO) -#if not defined(MS_SAMD_DS3231) +#if !defined(MS_SAMD_DS3231) #include #endif #include "WatchDogs/WatchDogSAMD.h" @@ -113,9 +115,9 @@ class Logger { * @param mcuWakePin The pin used to wake the logger from deep sleep - * expected to be attached to an alarm pin of the real-time clock. Use a * value of -1 to prevent the board from sleeping. - * @param inputArray A variableArray object instance providing data to be - * logged. This is NOT an array of variables, but an object of the variable - * array class. + * @param inputArray A pointer to a variableArray object instance providing + * data to be logged. This is NOT an array of variables, but an object of + * the variable array class. */ Logger(const char* loggerID, uint16_t loggingIntervalMinutes, int8_t SDCardSSPin, int8_t mcuWakePin, VariableArray* inputArray); @@ -165,7 +167,7 @@ class Logger { /** * @brief Get the Logger ID. * - * @return **const char\*** A pointer to the logger ID + * @return A pointer to the logger ID */ const char* getLoggerID() { return _loggerID; @@ -181,7 +183,7 @@ class Logger { /** * @brief Get the Logging Interval. * - * @return **uint16_t** The logging interval in minutes + * @return The logging interval in minutes */ uint16_t getLoggingInterval() { return _loggingIntervalMinutes; @@ -197,7 +199,7 @@ class Logger { /** * @brief Get the Sampling Feature UUID. * - * @return **const char\*** The sampling feature UUID + * @return The sampling feature UUID */ const char* getSamplingFeatureUUID() { return _samplingFeatureUUID; @@ -399,6 +401,11 @@ class Logger { * @brief The logging interval in minutes */ uint16_t _loggingIntervalMinutes = 5; + /** + * @brief The initial number of samples to log at an interval of 1 minute + * for fast field verification + */ + uint8_t _initialShortIntervals = 5; /** * @brief Digital pin number on the mcu controlling the SD card slave * select. @@ -457,15 +464,15 @@ class Logger { /** * @brief Set the variable array object. * - * @param inputArray A variable array object instance. This is NOT an array - * of variables, but an object of the variable array class. + * @param inputArray A pointer to a variable array object instance. This is + * NOT an array of variables, but an object of the variable array class. */ void setVariableArray(VariableArray* inputArray); /** * @brief Get the number of variables in the internal variable array object. * - * @return **uint8_t** The number of variables in the internal variable + * @return The number of variables in the internal variable * array object */ uint8_t getArrayVarCount(); @@ -475,7 +482,7 @@ class Logger { * position in the internal variable array object. * * @param position_i The position of the variable in the array. - * @return **String** The name of the parent sensor of that variable, if + * @return The name of the parent sensor of that variable, if * applicable. */ String getParentSensorNameAtI(uint8_t position_i); @@ -484,7 +491,7 @@ class Logger { * at the given position in the internal variable array object. * * @param position_i The position of the variable in the array. - * @return **String** The concatenated name and pin location of the parent + * @return The concatenated name and pin location of the parent * sensor of that variable, if applicable. */ String getParentSensorNameAndLocationAtI(uint8_t position_i); @@ -496,7 +503,7 @@ class Logger { * http://vocabulary.odm2.org/variablename/ * * @param position_i The position of the variable in the array. - * @return **String** The variable name + * @return The variable name */ String getVarNameAtI(uint8_t position_i); /** @@ -507,7 +514,7 @@ class Logger { * http://vocabulary.odm2.org/units/ * * @param position_i The position of the variable in the array. - * @return **String** The variable unit + * @return The variable unit */ String getVarUnitAtI(uint8_t position_i); /** @@ -515,7 +522,7 @@ class Logger { * the internal variable array object. * * @param position_i The position of the variable in the array. - * @return **String** The variable code + * @return The variable code */ String getVarCodeAtI(uint8_t position_i); /** @@ -523,7 +530,7 @@ class Logger { * variable array object. * * @param position_i The position of the variable in the array. - * @return **String** The variable UUID + * @return The variable UUID */ String getVarUUIDAtI(uint8_t position_i); /** @@ -531,10 +538,28 @@ class Logger { * the internal variable array object. * * @param position_i The position of the variable in the array. - * @return **String** The value of the variable as a string with the correct + * @return The value of the variable as a float. + */ + float getValueAtI(uint8_t position_i); + /** + * @brief Get the most recent value of the variable at the given position in + * the internal variable array object. + * + * @param position_i The position of the variable in the array. + * @return The value of the variable as a string with the correct * number of significant figures. */ String getValueStringAtI(uint8_t position_i); + /** + * @brief Get the string representing a particular value of the variable at + * the given position in the internal variable array object. + * + * @param position_i The position of the variable in the array. + * @param value The value to format. + * @return The given value as a string with the correct number of + * significant figures. + */ + String formatValueStringAtI(uint8_t position_i, float value); protected: /** @@ -569,7 +594,7 @@ class Logger { * @brief Use the attahed loggerModem to synchronize the real-time clock * with NIST time servers. * - * @return **bool** True if clock synchronization was successful + * @return True if clock synchronization was successful */ bool syncRTC(); @@ -630,7 +655,7 @@ class Logger { /** * @brief Get the Logger Time Zone. * - * @return **int8_t** The timezone data is be saved to the SD card in. This + * @return 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. */ static int8_t getLoggerTimeZone(void); @@ -650,7 +675,7 @@ class Logger { * * @m_deprecated_since{0,22,4} * - * @return **int8_t** The timezone data is be saved to the SD card in. This + * @return 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. */ static int8_t getTimeZone(void); @@ -666,7 +691,7 @@ class Logger { /** * @brief Get the timezone of the real-time clock (RTC). * - * @return **int8_t** The timezone of the real-time clock (RTC) + * @return The timezone of the real-time clock (RTC) */ static int8_t getRTCTimeZone(void); @@ -686,13 +711,13 @@ class Logger { * @brief Get the offset between the built-in clock and the time zone * where the data is being recorded. * - * @return **int8_t** The offset between the built-in clock and the time + * @return The offset between the built-in clock and the time * zone where the data is being recorded. */ static int8_t getTZOffset(void); #if (defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_SAMD_ZERO)) && \ - not defined(MS_SAMD_DS3231) + !defined(MS_SAMD_DS3231) /** * @brief The RTC object. * @@ -707,7 +732,7 @@ class Logger { * 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 + * @return The number of seconds from January 1, 1970 in the * logging time zone. * * @m_deprecated_since{0,33,0} @@ -719,7 +744,7 @@ class Logger { * 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 + * @return The number of seconds from January 1, 1970 in the * logging time zone. */ static uint32_t getNowLocalEpoch(void); @@ -729,7 +754,7 @@ class Logger { * 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 + * @return The number of seconds from 1970-01-01T00:00:00Z0000 */ static uint32_t getNowUTCEpoch(void); /** @@ -749,7 +774,7 @@ class Logger { * object instance. * * @param epochTime The number of seconds since 1970. - * @return **DateTime** The equivalent DateTime + * @return The equivalent DateTime */ static DateTime dtFromEpoch(uint32_t epochTime); @@ -760,7 +785,7 @@ class Logger { * the LOGGER's offset as the time zone offset in the string. * * @param dt A DateTime object to convert - * @return **String** An ISO8601 formatted String. + * @return An ISO8601 formatted String. */ static String formatDateTime_ISO8601(DateTime& dt); @@ -771,7 +796,7 @@ class Logger { * the LOGGER's offset as the time zone offset in the string. * * @param epochTime The number of seconds since 1970. - * @return **String** An ISO8601 formatted String. + * @return An ISO8601 formatted String. */ static String formatDateTime_ISO8601(uint32_t epochTime); @@ -780,7 +805,7 @@ class Logger { * clock to the given time. * * @param UTCEpochSeconds The number of seconds since 1970 in UTC. - * @return **bool** True if the input timestamp passes sanity checks **and** + * @return True if the input timestamp passes sanity checks **and** * the clock has been successfully set. */ bool setRTClock(uint32_t UTCEpochSeconds); @@ -790,7 +815,7 @@ class Logger { * * To be sane the clock must be between 2020 and 2030. * - * @return **bool** True if the current time on the RTC passes sanity range + * @return True if the current time on the RTC passes sanity range * checking */ static bool isRTCSane(void); @@ -801,7 +826,7 @@ class Logger { * To be sane the clock must be between 2020 and 2025. * * @param epochTime The epoch time to be checked. - * @return **bool** True if the given time passes sanity range checking. + * @return True if the given time passes sanity range checking. */ static bool isRTCSane(uint32_t epochTime); @@ -820,7 +845,7 @@ class Logger { /** * @brief Check if the CURRENT time is an even interval of the logging rate * - * @return **bool** True if the current time on the RTC is an even interval + * @return True if the current time on the RTC is an even interval * of the logging rate. */ bool checkInterval(void); @@ -834,7 +859,7 @@ class Logger { * printing, etc) have the same timestamp even though the update routine may * take several (or many) seconds. * - * @return **bool** True if the marked time is an even interval of the + * @return True if the marked time is an even interval of the * logging rate. */ bool checkMarkedInterval(void); @@ -941,7 +966,7 @@ class Logger { * * In this case, we're doing nothing, we just want the processor to wake. * This must be a static function (which means it can only call other static - * funcions.) + * functions.) */ static void wakeISR(void); @@ -1004,7 +1029,7 @@ class Logger { * an auto-generated filename which is a concatenation of the logger id and * the date when the file was started. * - * @return **String** The name of the file data is currently being saved to. + * @return The name of the file data is currently being saved to. */ String getFileName(void) { return _fileName; @@ -1042,7 +1067,7 @@ class Logger { * @param filename The name of the file to create * @param writeDefaultHeader True to write a header to the file, default is * false - * @return **bool** True if the file was successfully created. + * @return True if the file was successfully created. */ bool createLogFile(String& filename, bool writeDefaultHeader = false); /** @@ -1056,7 +1081,7 @@ class Logger { * * @param writeDefaultHeader True to write a header to the file, default is * false - * @return **bool** True if the file was successfully created. + * @return True if the file was successfully created. */ bool createLogFile(bool writeDefaultHeader = false); @@ -1070,7 +1095,7 @@ class Logger { * * @param filename The name of the file to write to * @param rec The line to be written to the file - * @return **bool** True if the file was successfully accessed or created + * @return True if the file was successfully accessed or created * _and_ data appended to it. */ bool logToSD(String& filename, String& rec); @@ -1083,7 +1108,7 @@ class Logger { * modified and accessed timestamps of the file to the current time. * * @param rec The line to be written to the file - * @return **bool** True if the file was successfully accessed or created + * @return True if the file was successfully accessed or created * _and_ data appended to it. */ bool logToSD(String& rec); @@ -1096,7 +1121,7 @@ class Logger { * attempt to create the file and add a header to it. Set the modified and * accessed timestamps of the file to the current time. * - * @return **bool** True if the file was successfully accessed or created + * @return True if the file was successfully accessed or created * _and_ data appended to it. */ bool logToSD(void); @@ -1123,7 +1148,7 @@ class Logger { * We run this check before every communication with the SD card to prevent * hanging. * - * @return **bool** True if the SD card is ready + * @return True if the SD card is ready */ bool initializeSDCard(void); @@ -1151,7 +1176,7 @@ class Logger { * @param createFile True to create the file if it did not already exist * @param writeDefaultHeader True to add a header to the file if it is * created - * @return **bool** True if a file was successfully opened or created. + * @return True if a file was successfully opened or created. */ bool openFile(String& filename, bool createFile, bool writeDefaultHeader); /**@}*/ @@ -1186,8 +1211,11 @@ class Logger { * to the "main" output - ie Serial - and NOT to the SD card. After 25 * measurements, the sensors are put to sleep, the modem is disconnected * from the internet, and the logger goes back to sleep. + * + * @param sleepBeforeReturning True to put the logger to sleep before + * returning from the function; optional with a default value of true. */ - virtual void testingMode(); + virtual void testingMode(bool sleepBeforeReturning = true); /**@}*/ // ===================================================================== // @@ -1243,14 +1271,24 @@ class Logger { /** * @brief This is a one-and-done to log data + * + * @param sleepBeforeReturning True to put the logger to sleep before + * returning from the function; optional with a default value of true. + * @note If sleepBeforeReturning is set to false, the logger WILL NOT sleep + * between readings. */ - virtual void logData(void); + virtual void logData(bool sleepBeforeReturning = true); /** * @brief This is a one-and-done to log data and publish the results to any * associated publishers. + * + * @param sleepBeforeReturning True to put the logger to sleep before + * returning from the function; optional with a default value of true. + * @note If sleepBeforeReturning is set to false, the logger WILL NOT sleep + * between readings. */ - void logDataAndPublish(void); + void logDataAndPublish(bool sleepBeforeReturning = true); /** * @brief The static "marked" epoch time for the local timezone. diff --git a/src/LoggerModem.cpp b/src/LoggerModem.cpp index 3b3be5cd7..4a215c7a2 100644 --- a/src/LoggerModem.cpp +++ b/src/LoggerModem.cpp @@ -335,11 +335,11 @@ bool loggerModem::updateModemMetadata(void) { loggerModem::_priorModemTemp = -9999; // Initialize variable - int16_t rssi = -9999; - int16_t percent = -9999; - uint8_t state = 99; - int8_t bpercent = -99; - uint16_t volt = 9999; + int16_t rssi = -9999; + int16_t percent = -9999; + int8_t state = 99; + int8_t bpercent = -99; + int16_t volt = 9999; MS_DBG(F("Modem polling settings:"), String(_pollModemMetaData, BIN)); diff --git a/src/LoggerModem.h b/src/LoggerModem.h index a55736dcc..ccd456af6 100644 --- a/src/LoggerModem.h +++ b/src/LoggerModem.h @@ -361,7 +361,7 @@ class loggerModem { /** * @brief Get the modem name. * - * @return **String** The modem name + * @return The modem name */ String getModemName(void); @@ -370,7 +370,7 @@ class loggerModem { * * @note These values are polled for and cached in memory till needed * - * @return **String** The concatenated name, hardware version, firmware + * @return The concatenated name, hardware version, firmware * version, and serial number of the modem. * * @todo Implement this for modems other than the XBee WiFi @@ -383,7 +383,7 @@ class loggerModem { * This is used for operations that cannot happen in the modem constructor - * they must happen at run time, not at compile time. * - * @return **bool** True if setup was successful + * @return True if setup was successful */ virtual bool modemSetup(void); /** @@ -392,7 +392,7 @@ class loggerModem { * * @m_deprecated_since{0,24,1} * - * @return **bool** True if setup was successful + * @return True if setup was successful */ bool setup(void) { return modemSetup(); @@ -415,7 +415,7 @@ class loggerModem { * * For most modules, this function is created by the #MS_MODEM_WAKE macro. * - * @return **bool** True if the modem is responsive and ready for action. + * @return True if the modem is responsive and ready for action. */ virtual bool modemWake(void) = 0; /** @@ -423,7 +423,7 @@ class loggerModem { * * @m_deprecated_since{0,24,1} * - * @return **bool** True if wake was sucessful, modem should be ready to + * @return True if wake was sucessful, modem should be ready to * communicate */ bool wake(void) { @@ -445,7 +445,7 @@ class loggerModem { /** * @brief Request that the modem enter its lowest possible power state. * - * @return **bool** True if the modem has sucessfully entered low power + * @return True if the modem has sucessfully entered low power * state */ virtual bool modemSleep(void); @@ -457,7 +457,7 @@ class loggerModem { * This allows the modem to shut down all connections cleanly and do any * necessary internal housekeeping before stopping power. * - * @return **bool** True if the modem has sucessfully entered low power + * @return True if the modem has sucessfully entered low power * state _and_ then powered off */ virtual bool modemSleepPowerDown(void); @@ -469,7 +469,7 @@ class loggerModem { * * This should only be used if the modem is clearly non-responsive. * - * @return **bool** True if the reset succeeded and the modem should now be + * @return True if the reset succeeded and the modem should now be * responsive. False if the modem remains non-responsive either because the * reset failed to fix the communication issue or because a reset is not * possible with the current pin/modem configuration. @@ -534,7 +534,7 @@ class loggerModem { * @param maxConnectionTime The maximum length of time in milliseconds to * wait for network registration and data sconnection. Defaults to 50,000ms * (50s). - * @return **bool** True if EPS or GPRS data connection has been + * @return True if EPS or GPRS data connection has been * established. False if the modem wasunresponsive, unable to register with * the cellular network, or unable to establish a EPS or GPRS connection. */ @@ -554,7 +554,7 @@ class loggerModem { * * @note The return is the number of seconds since Jan 1, 1970 IN UTC * - * @return **uint32_t** The number of seconds since Jan 1, 1970 IN UTC + * @return The number of seconds since Jan 1, 1970 IN UTC */ virtual uint32_t getNISTTime(void) = 0; /**@}*/ @@ -581,7 +581,7 @@ class loggerModem { * signal strength indicator * @param percent A reference to an int16_t which will be set with the * "percent" signal strength - * @return **bool** True indicates that the communication with the modem was + * @return True indicates that the communication with the modem was * successful and the values referenced by the pointers should be valid. */ virtual bool getModemSignalQuality(int16_t& rssi, int16_t& percent) = 0; @@ -598,15 +598,15 @@ class loggerModem { * @param milliVolts A reference to an uint16_t which will be set with the * current battery voltage in mV - this may or may not be a valid value * depending on the module and breakout. - * @return **bool** True indicates that the communication with the modem was + * @return True indicates that the communication with the modem was * successful and the values referenced by the pointers should be valid. */ - virtual bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) = 0; + virtual bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) = 0; /** * @brief Get the current temperature provided by the modem module. * - * @return **float** The temperature in degrees Celsius + * @return The temperature in degrees Celsius */ virtual float getModemChipTemperature(void) = 0; @@ -616,6 +616,10 @@ class loggerModem { * variables. Setting this to 0b11111111 will enable polling for all modem * measured variables. * + * @param pollingBitmask The bitmask indicating which paramters to poll. + * + * @see loggerModem::_pollModemMetaData + * * @note This will **not** disable polling for any unset bits in the * provided bitmask. It will only enable those bits that are set. */ @@ -626,6 +630,10 @@ class loggerModem { * variables. Setting this to 0b11111111 will disable polling for all modem * measured variables. * + * @param pollingBitmask The bitmask indicating which paramters to poll. + * + * @see loggerModem::_pollModemMetaData + * * @note This will **not** enable polling for any unset bits in the * provided bitmask. It will only disable polling for those bits that are * set. @@ -639,6 +647,10 @@ class loggerModem { * Setting this to 0 (0b00000000) will disable polling for all metadata * parameters. Setting it to 256 (0b11111111) will enable polling for all * parameters. + * + * @param pollingBitmask The bitmask indicating which paramters to poll. + * + * @see loggerModem::_pollModemMetaData */ void setMetadataPolling(uint8_t pollingBitmask); @@ -646,7 +658,7 @@ class loggerModem { * @brief Query the modem for signal quality, battery, and temperature * information and store the values to the static internal variables. * - * @return **bool** True indicates that the communication with the modem + * @return True indicates that the communication with the modem * was successful and the values of the internal static variables should * be valid. */ @@ -669,7 +681,7 @@ class loggerModem { * * @note Does NOT query the modem for a new value. * - * @return **float** The stored RSSI + * @return The stored RSSI */ static float getModemRSSI(); @@ -678,7 +690,7 @@ class loggerModem { * * @note Does NOT query the modem for a new value. * - * @return **float** The stored signal strength + * @return The stored signal strength */ static float getModemSignalPercent(); @@ -687,7 +699,7 @@ class loggerModem { * * @note Does NOT query the modem for a new value. * - * @return **float** The stored signal percent + * @return The stored signal percent */ static float getModemBatteryChargeState(); @@ -696,7 +708,7 @@ class loggerModem { * * @note Does NOT query the modem for a new value. * - * @return **float** The stored battery charge percent + * @return The stored battery charge percent */ static float getModemBatteryChargePercent(); @@ -705,7 +717,7 @@ class loggerModem { * * @note Does NOT query the modem for a new value. * - * @return **float** The stored battery voltage in mV + * @return The stored battery voltage in mV */ static float getModemBatteryVoltage(); @@ -714,7 +726,7 @@ class loggerModem { * * @note Does NOT query the modem for a new value. * - * @return **float** The stored temperature in degrees Celsius + * @return The stored temperature in degrees Celsius */ static float getModemTemperature(); /**@}*/ @@ -731,7 +743,7 @@ class loggerModem { * The RSSI is estimated from a look-up assuming no noise. * * @param csq A "CSQ" (0-31) signal qualilty - * @return **int16_t** An RSSI in dBm, making assumptions about the + * @return An RSSI in dBm, making assumptions about the * conversion */ static int16_t getRSSIFromCSQ(int16_t csq); @@ -741,14 +753,14 @@ class loggerModem { * The percent is grabbed from a look-up. * * @param csq A "CSQ" (0-31) signal qualilty - * @return **int16_t** The percent of maximum signal strength. + * @return The percent of maximum signal strength. */ static int16_t getPctFromCSQ(int16_t csq); /** * @brief Get signal percent from CSQ. * * @param rssi The RSSI in dBm. - * @return **int16_t** The estimated percent of maximum signal strength. + * @return The estimated percent of maximum signal strength. */ static int16_t getPctFromRSSI(int16_t rssi); /**@}*/ @@ -781,7 +793,7 @@ class loggerModem { /** * @brief Check whether there is an active internet connection available. * - * @return **bool** True if there is an active data connection to the + * @return True if there is an active data connection to the * internet. */ virtual bool isInternetAvailable(void) = 0; @@ -790,7 +802,7 @@ class loggerModem { * specific module, as opposed to the parts of setup that are common to all * modem modules. * - * @return **bool** True if the unique part of the sleep function ran + * @return True if the unique part of the sleep function ran * sucessfully. */ virtual bool modemSleepFxn(void) = 0; @@ -799,7 +811,7 @@ class loggerModem { * a specific module, as opposed to the parts of setup that are common to * all modem modules. * - * @return **bool** True if the unique part of the wake function ran + * @return True if the unique part of the wake function ran * sucessfully - does _NOT_ indicate that the modem is now responsive. */ virtual bool modemWakeFxn(void) = 0; @@ -811,7 +823,7 @@ class loggerModem { * For most modules, this function is created by the #MS_MODEM_EXTRA_SETUP * macro which runs the TinyGSM modem init() and client init() functions. * - * @return **bool** True if the extra setup succeeded. + * @return True if the extra setup succeeded. */ virtual bool extraModemSetup(void) = 0; /** @@ -833,7 +845,7 @@ class loggerModem { * and am using AT commands to sleep. This *should* keep everything lined * up. * - * @return **bool** True if the modem is already awake. + * @return True if the modem is already awake. */ virtual bool isModemAwake(void) = 0; /**@}*/ @@ -848,7 +860,7 @@ class loggerModem { * so there is no need to close it * * @param nistBytes 4 bytes from NIST - * @return **uint32_t** the number of seconds since January 1, 1970 00:00:00 + * @return the number of seconds since January 1, 1970 00:00:00 * UTC */ static uint32_t parseNISTBytes(byte nistBytes[4]); diff --git a/src/ModSensorDebugger.h b/src/ModSensorDebugger.h index 7561c33ff..219255c92 100644 --- a/src/ModSensorDebugger.h +++ b/src/ModSensorDebugger.h @@ -25,7 +25,7 @@ #if defined(SERIAL_PORT_USBVIRTUAL) // #define Serial SERIAL_PORT_USBVIRTUAL #define STANDARD_SERIAL_OUTPUT SERIAL_PORT_USBVIRTUAL -#elif defined __AVR__ || defined ARDUINO_ARCH_AVR +#elif defined(__AVR__) || defined(ARDUINO_ARCH_AVR) #define STANDARD_SERIAL_OUTPUT Serial #endif #endif // ifndef STANDARD_SERIAL_OUTPUT @@ -68,7 +68,7 @@ static void PRINTOUT(T head, Args... tail) { #if defined(SERIAL_PORT_USBVIRTUAL) // #define Serial SERIAL_PORT_USBVIRTUAL #define DEBUGGING_SERIAL_OUTPUT SERIAL_PORT_USBVIRTUAL -#elif defined __AVR__ || defined ARDUINO_ARCH_AVR +#elif defined(__AVR__) || defined(ARDUINO_ARCH_AVR) #define DEBUGGING_SERIAL_OUTPUT Serial #endif #endif // ifndef DEBUGGING_SERIAL_OUTPUT @@ -166,7 +166,7 @@ static void MS_DBG(T head, Args... tail) { #if defined(SERIAL_PORT_USBVIRTUAL) // #define Serial SERIAL_PORT_USBVIRTUAL #define DEEP_DEBUGGING_SERIAL_OUTPUT SERIAL_PORT_USBVIRTUAL -#elif defined __AVR__ || defined ARDUINO_ARCH_AVR +#elif defined(__AVR__) || defined(ARDUINO_ARCH_AVR) #define DEEP_DEBUGGING_SERIAL_OUTPUT Serial #endif #endif // ifndef DEEP_DEBUGGING_SERIAL_OUTPUT @@ -221,7 +221,7 @@ static void MS_DEEP_DBG(T head, Args... tail) { /*** -#if defined (__AVR__) || defined (ARDUINO_ARCH_AVR) +#if defined(__AVR__) || defined (ARDUINO_ARCH_AVR) typedef const __FlashStringHelper* GsmConstStr; #define GFP(x) (reinterpret_cast(x)) #define GF(x) F(x) diff --git a/src/ModSensorInterrupts.h b/src/ModSensorInterrupts.h index 0fe9a3746..a467bb4b8 100644 --- a/src/ModSensorInterrupts.h +++ b/src/ModSensorInterrupts.h @@ -20,8 +20,16 @@ // #define LIBCALL_ENABLEINTERRUPT // To prevent compiler/linker crashes #include // To handle external and pin change interrupts #else +/** + * @brief This define renames attachInterrupt as enableInterrupt to simplify + * switching between AVR and non-AVR processors. + */ #define enableInterrupt(pin, userFunc, mode) \ attachInterrupt(pin, userFunc, mode) +/** + * @brief This define renames detachInterrupt as disableInterrupt to simplify + * switching between AVR and non-AVR processors. + */ #define disableInterrupt(pin) detachInterrupt(pin) #endif diff --git a/src/SensorBase.h b/src/SensorBase.h index 44a1d68a3..3a7503db0 100644 --- a/src/SensorBase.h +++ b/src/SensorBase.h @@ -126,26 +126,26 @@ class Sensor { * @note This is NOT the position of the sensor in the environment, merely * how it is attached to the mcu. * - * @return **String** Text describing how the sensor is attached to the mcu. + * @return Text describing how the sensor is attached to the mcu. */ virtual String getSensorLocation(void); /** * @brief Get the name of the sensor. * - * @return **String** The sensor name as given in the constructor. + * @return The sensor name as given in the constructor. */ virtual String getSensorName(void); /** * @brief Concatentate and returns the name and location of the sensor. * - * @return **String** A concatenation of the sensor name and its "location" + * @return A concatenation of the sensor name and its "location" * - how it is connected to the mcu. */ String getSensorNameAndLocation(void); /** * @brief Get the pin number controlling sensor power. * - * @return **int8_t** The pin on the mcu controlling power to the sensor. + * @return The pin on the mcu controlling power to the sensor. */ virtual int8_t getPowerPin(void); @@ -161,7 +161,7 @@ class Sensor { /** * @brief Get the number of measurements to average. * - * @return **uint8_t** The number of readings to take and average to create + * @return The number of readings to take and average to create * a result from the sensor. * * @copydetails _measurementsToAverage @@ -226,7 +226,7 @@ class Sensor { * This sets the pin modes of the _powerPin and _dataPin, updates * #_sensorStatus, and returns true. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ virtual bool setup(void); @@ -247,7 +247,7 @@ class Sensor { * used. To work with many sensors together, use the VariableArray class * which optimizes the timing and waits for many sensors working together. * - * @return **bool** True if all steps of the sensor update completed + * @return True if all steps of the sensor update completed * successfully. */ virtual bool update(void); @@ -277,7 +277,7 @@ class Sensor { * * @note This does NOT include any wait for sensor readiness. * - * @return **bool** True if the wake function completed successfully. + * @return True if the wake function completed successfully. */ virtual bool wake(void); /** @@ -287,7 +287,7 @@ class Sensor { * * @note This does NOT power down the sensor! * - * @return **bool** True if the sleep function completed successfully. + * @return True if the sleep function completed successfully. */ virtual bool sleep(void); @@ -300,7 +300,7 @@ class Sensor { * @note This function does NOT include any waiting for the sensor to be * warmed up or stable! * - * @return **bool** True if the start measurement function completed + * @return True if the start measurement function completed * successfully. */ virtual bool startSingleMeasurement(void); @@ -317,7 +317,7 @@ class Sensor { * @note This function does NOT include any waiting for the sensor complete * a measurement. * - * @return **bool** True if the function completed successfully. + * @return True if the function completed successfully. */ virtual bool addSingleMeasurementResult(void) = 0; @@ -350,6 +350,9 @@ class Sensor { /** * @brief Average the results of all measurements by dividing the sum of * all measurements by the number of measurements taken. + * + * @param resultNumber The position of the result within the result array. + * @param resultValue The value of the result. */ void verifyAndAddMeasurementResult(uint8_t resultNumber, int32_t resultValue); @@ -379,7 +382,7 @@ class Sensor { * @brief Check if the #_powerPin is currently high. * * @param debug True to output the result to the debugging Serial - * @return **bool** True indicates the #_powerPin is currently `HIGH`. + * @return True indicates the #_powerPin is currently `HIGH`. */ bool checkPowerOn(bool debug = false); /** @@ -387,7 +390,7 @@ class Sensor { * receiving power and being ready to respond to logger commands. * * @param debug True to output the result to the debugging Serial - * @return **bool** True indicates that enough time has passed that the + * @return True indicates that enough time has passed that the * sensor should be ready to respond to commands. * * @note A true response does _NOT_ indicate that the sensor will respond to @@ -405,7 +408,7 @@ class Sensor { * being awoken/activated and being ready to output stable values. * * @param debug True to output the result to the debugging Serial - * @return **bool** True indicates that enough time has passed that the + * @return True indicates that enough time has passed that the * sensor should have stabilized. * * @note A true response does _NOT_ indicate that the sensor is now giving @@ -425,7 +428,7 @@ class Sensor { * is expected to be complete. * * @param debug True to output the result to the debugging Serial - * @return **bool** True indicates that enough time has passed the + * @return True indicates that enough time has passed the * measurement should have completed * * @note A true response does _NOT_ indicate that the sensor will now @@ -541,10 +544,10 @@ class Sensor { uint8_t _sensorStatus = 0; /** - * @brief An array for each sensor containing the variable objects tied to - * that sensor. The #MAX_NUMBER_VARS cannot be determined on a per-sensor - * basis, because of the way memory is used on an Arduino. It must be - * defined once for the whole class. + * @brief An array for each sensor containing pointers to the variable + * objects tied to that sensor. The #MAX_NUMBER_VARS cannot be determined + * on a per-sensor basis, because of the way memory is used on an Arduino. + * It must be defined once for the whole class. */ Variable* variables[MAX_NUMBER_VARS]; }; diff --git a/src/VariableArray.h b/src/VariableArray.h index 8e768aaa8..54b14a9e5 100644 --- a/src/VariableArray.h +++ b/src/VariableArray.h @@ -148,7 +148,7 @@ class VariableArray { /** * @brief Get the count of variables in the variable array * - * @return **uint8_t** the number of variables + * @return The number of variables */ uint8_t getVariableCount(void) { return _variableCount; @@ -157,7 +157,7 @@ class VariableArray { /** * @brief Get the number of calculated variables * - * @return **uint8_t** The number of calculated (ie, not measured by a + * @return The number of calculated (ie, not measured by a * sensor) variables */ uint8_t getCalculatedVariableCount(void); @@ -170,7 +170,7 @@ class VariableArray { * This will often be different from the number of variables because many * sensors can return multiple variables. * - * @return **uint8_t** The number of sensors + * @return The number of sensors */ uint8_t getSensorCount(void); @@ -194,7 +194,7 @@ class VariableArray { * respond to its setup command, the command is called 5 times in attempt to * make a connection. If all sensors are set up successfully, returns true. * - * @return **bool** True indicates all sensors have been set up + * @return True indicates all sensors have been set up * successfully. */ bool setupSensors(void); @@ -212,7 +212,7 @@ class VariableArray { * Runs the wake sensor function for each unique sensor. Repeatedly checks * each sensor's readiness state to optimize timing. * - * @return **bool** True if all wake functions were run successfully. + * @return True if all wake functions were run successfully. */ bool sensorsWake(void); @@ -221,7 +221,7 @@ class VariableArray { * * Runs the sleep sensor function for each unique sensor. * - * @return **bool** True if all sleep functions were run successfully. + * @return True if all sleep functions were run successfully. */ bool sensorsSleep(void); @@ -238,7 +238,7 @@ class VariableArray { * overall success. Does NOT return any values. Repeatedly checks each * sensor's readiness state to optimize timing. * - * @return **bool** True if all steps of the update succeeded. + * @return True if all steps of the update succeeded. */ bool updateAllSensors(void); @@ -252,7 +252,7 @@ class VariableArray { * values. Repeatedly checks each sensor's readiness state to optimize * timing. * - * @return **bool** True if all steps of the update succeeded. + * @return True if all steps of the update succeeded. */ bool completeUpdate(void); @@ -284,9 +284,33 @@ class VariableArray { uint8_t _maxSamplestoAverage; private: - bool isLastVarFromSensor(int arrayIndex); + /** + * @brief Check if the current variable is the last variable that the sensor + * will return. + * + * This is used for formating output where the format is slightly different + * for the last value. (ie, no comma after the last value) + * + * @param arrayIndex The index of the variable in the sensor variable array + * @return True if the variable is the last in the array. + */ + bool isLastVarFromSensor(int arrayIndex); + /** + * @brief Count the maximum number of measurements needed from a single + * sensor for the requested averaging + * + * @return The number of measurements needed. + */ uint8_t countMaxToAverage(void); - bool checkVariableUUIDs(void); + /** + * @brief Check that all variable have valid UUID's, if they are assigned + * + * @return True if all variables have valid UUID's. + * + * @warning This does not check that the UUID's are the true UUID's for the + * variables, just that the text is a validly formed UUID. + */ + bool checkVariableUUIDs(void); #ifdef MS_VARIABLEARRAY_DEBUG_DEEP /** diff --git a/src/VariableBase.h b/src/VariableBase.h index 35c413acd..6bf16e698 100644 --- a/src/VariableBase.h +++ b/src/VariableBase.h @@ -150,7 +150,7 @@ class Variable { * Supercedes any value supplied in the constructor. * @param customVarCode A custom code for the variable. Supercedes * any value supplied in the constructor. - * @return Variable A pointer to the variable object + * @return A pointer to the variable object */ Variable* begin(Sensor* parentSense, const char* uuid, const char* customVarCode); @@ -161,7 +161,7 @@ class Variable { * Sensor supplied in the constructor. * @param uuid A universally unique identifier for the variable. * Supercedes any value supplied in the constructor. - * @return Variable A pointer to the variable object + * @return A pointer to the variable object */ Variable* begin(Sensor* parentSense, const char* uuid); /** @@ -169,7 +169,7 @@ class Variable { * * @param parentSense The Sensor object supplying values. Supercedes any * Sensor supplied in the constructor. - * @return Variable A pointer to the variable object + * @return A pointer to the variable object */ Variable* begin(Sensor* parentSense); @@ -188,7 +188,7 @@ class Variable { * supplied in the constructor. * @param uuid A universally unique identifier for the variable. * Supercedes any value supplied in the constructor. - * @return Variable A pointer to the variable object + * @return A pointer to the variable object */ Variable* begin(float (*calcFxn)(), uint8_t decimalResolution, const char* varName, const char* varUnit, @@ -206,7 +206,7 @@ class Variable { * vocabulary. Supercedes any value supplied in the constructor. * @param varCode A custom code for the variable. Supercedes any value * supplied in the constructor. - * @return Variable A pointer to the variable object + * @return A pointer to the variable object */ Variable* begin(float (*calcFxn)(), uint8_t decimalResolution, const char* varName, const char* varUnit, @@ -239,7 +239,7 @@ class Variable { * * This is a helper needed for dealing with variables in arrays * - * @return **String** The parent sensor name + * @return The parent sensor name */ String getParentSensorName(void); /** @@ -247,7 +247,7 @@ class Variable { * * This is a helper needed for dealing with variables in arrays * - * @return **String** The parent sensor's concatentated name and location. + * @return The parent sensor's concatentated name and location. */ String getParentSensorNameAndLocation(void); @@ -262,7 +262,7 @@ class Variable { /** * @brief Get the variable's resolution - in decimal places * - * @return **uint8_t** the variable resolution + * @return the variable resolution */ uint8_t getResolution(void); /** @@ -274,7 +274,7 @@ class Variable { /** * @brief Get the variable name * - * @return **String** The variable name + * @return The variable name */ String getVarName(void); /** @@ -290,7 +290,7 @@ class Variable { /** * @brief Get the variable unit * - * @return **String** The variable unit + * @return The variable unit */ String getVarUnit(void); /** @@ -306,7 +306,7 @@ class Variable { /** * @brief Get the customized code for the variable * - * @return **String** The customized code for the variable + * @return The customized code for the variable */ String getVarCode(void); /** @@ -320,7 +320,7 @@ class Variable { /** * @brief Get the customized code for the variable * - * @return **String** The customized code for the variable + * @return The customized code for the variable */ String getVarUUID(void); /** @@ -332,7 +332,7 @@ class Variable { /** * @brief Verify the the UUID is correctly formatted * - * @return **bool** True if the UUID is correctly formatted. + * @return True if the UUID is correctly formatted. * * @note This only checks the _format_ of the UUID. It does not in any way * indicate that the value of the UUID is correct. @@ -344,7 +344,7 @@ class Variable { * * @param updateValue True to ask the parent sensor to measure and return a * new value. Default is false. - * @return **float** The current value of the variable + * @return The current value of the variable */ float getValue(bool updateValue = false); /** @@ -353,9 +353,17 @@ class Variable { * * @param updateValue True to ask the parent sensor to measure and return a * new value. Default is false. - * @return **String** The current value of the variable + * @return The current value of the variable */ String getValueString(bool updateValue = false); + /** + * @brief Get a particular value of the variable as a string with the + * correct decimal resolution + * + * @param value value to format + * @return The formatted value of the variable + */ + String formatValueString(float value); /** * @brief Pointer to the parent sensor @@ -377,15 +385,41 @@ class Variable { private: + /** + * @brief Private reference to function used to calculate the variables + * value. + */ float (*_calcFxn)(void) = nullptr; - const uint8_t _sensorVarNum = 0; - uint8_t _decimalResolution = 0; + /** + * @brief The position in the sensor's value array of this variable's value. + */ + const uint8_t _sensorVarNum = 0; + /** + * @brief The resolution (in decimal places) of the value. + */ + uint8_t _decimalResolution = 0; + + /** + * @brief The name of the variable per the [ODM2 variable name controlled + * vocabulary](http://vocabulary.odm2.org/variablename/) + */ const char* _varName = nullptr; + /** + * @brief The unit of the variable per the [ODM2 unit controlled + * vocabulary](http://vocabulary.odm2.org/units/) + */ const char* _varUnit = nullptr; + /** + * @brief A custom code for the variable. This can be any short text + * helping to identify the variable in files. + */ const char* _varCode = nullptr; - const char* _uuid = nullptr; + /** + * @brief A universally unique identifier for the variable. + */ + const char* _uuid = nullptr; }; #endif // SRC_VARIABLEBASE_H_ diff --git a/src/WatchDogs/WatchDogAVR.h b/src/WatchDogs/WatchDogAVR.h index 30b48454f..c6d417a24 100644 --- a/src/WatchDogs/WatchDogAVR.h +++ b/src/WatchDogs/WatchDogAVR.h @@ -79,6 +79,10 @@ class extendedWatchDogAVR { static volatile uint32_t _barksUntilReset; private: + /** + * @brief Internal reference to the number of seconds of silence before the + * module is reset. + */ uint32_t _resetTime_s; }; diff --git a/src/WatchDogs/WatchDogSAMD.cpp b/src/WatchDogs/WatchDogSAMD.cpp index 4c176ad8f..5f49ecfe8 100644 --- a/src/WatchDogs/WatchDogSAMD.cpp +++ b/src/WatchDogs/WatchDogSAMD.cpp @@ -33,7 +33,7 @@ void extendedWatchDogSAMD::setupWatchDog(uint32_t resetTime_s) { extendedWatchDogSAMD::_barksUntilReset, F("times before the reset.")); -// Disable watchdog for config + // Disable watchdog for config MS_DEEP_DBG(F("Disabling the watchdog for configuration.")); #if defined(__SAMD51__) WDT->CTRLA.reg = 0; diff --git a/src/WatchDogs/WatchDogSAMD.h b/src/WatchDogs/WatchDogSAMD.h index 9b3fe1681..d1ce73cd7 100644 --- a/src/WatchDogs/WatchDogSAMD.h +++ b/src/WatchDogs/WatchDogSAMD.h @@ -83,7 +83,14 @@ class extendedWatchDogSAMD { static volatile uint32_t _barksUntilReset; private: + /** + * @brief Wait for the SAMD processor bit sync to finish.+ + */ void inline waitForWDTBitSync(); + /** + * @brief Internal reference to the number of seconds of silence before the + * module is reset. + */ uint32_t _resetTime_s; }; diff --git a/src/dataPublisherBase.h b/src/dataPublisherBase.h index 6ccefa91d..9096666c0 100644 --- a/src/dataPublisherBase.h +++ b/src/dataPublisherBase.h @@ -29,8 +29,8 @@ #endif +#ifndef MS_SEND_BUFFER_SIZE /** - * @def MS_SEND_BUFFER_SIZE * @brief Send Buffer * * This determines how many characters to set out at once over the TCP @@ -40,10 +40,7 @@ * * This can be changed by setting the build flag MS_SEND_BUFFER_SIZE when * compiling. - * - * @ingroup the_publishers */ -#ifndef MS_SEND_BUFFER_SIZE #define MS_SEND_BUFFER_SIZE 750 #endif @@ -166,7 +163,7 @@ class dataPublisher { * @brief Get the destination for published data - generally the host name * of the data receiver. * - * @return **String** The URL or HOST to receive published data + * @return The URL or HOST to receive published data */ virtual String getEndpoint(void) = 0; @@ -181,7 +178,7 @@ class dataPublisher { * @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 * single TinyGSM modem instance - * @return **int16_t** The result of publishing data. May be an http + * @return The result of publishing data. May be an http * response code or a result code from PubSubClient. */ virtual int16_t publishData(Client* outClient) = 0; @@ -193,7 +190,7 @@ class dataPublisher { * either a client having been linked to the publisher or a logger modem * having been linked to the logger linked to the publisher. * - * @return **int16_t** The result of publishing data. May be an http + * @return The result of publishing data. May be an http * response code or a result code from PubSubClient. */ virtual int16_t publishData(); @@ -207,7 +204,7 @@ class dataPublisher { * @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 * single TinyGSM modem instance - * @return **int16_t** The result of publishing data. May be an http + * @return The result of publishing data. May be an http * response code or a result code from PubSubClient. */ virtual int16_t sendData(Client* outClient); @@ -217,7 +214,7 @@ class dataPublisher { * * @m_deprecated_since{0,22,5} * - * @return **int16_t** The result of publishing data. May be an http + * @return The result of publishing data. May be an http * response code or a result code from PubSubClient. */ virtual int16_t sendData(); @@ -227,7 +224,7 @@ class dataPublisher { * explanation. * * @param state A result code returned by a PubSubClient action - * @return **String** The meaning of the code + * @return The meaning of the code */ String parseMQTTState(int state); diff --git a/src/modems/DigiXBee.h b/src/modems/DigiXBee.h index 22ed69fdb..4edf2c956 100644 --- a/src/modems/DigiXBee.h +++ b/src/modems/DigiXBee.h @@ -35,6 +35,7 @@ * @subsection modem_digi_raw_pins_1x Pin Numbers for connecting Digi XBee's Directly to a Mayfly v1.x * * This applies to _all_ Digi XBees and XBee3's when attached directly to the Mayfly's bee slot. + * * @code{cpp} * const int8_t modemVccPin = 18; // MCU pin controlling modem power * const bool useCTSforStatus = true; // Flag to use the XBee `CTS` pin for status @@ -47,6 +48,7 @@ * @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} * const int8_t modemVccPin = -1; // MCU pin controlling modem power * const bool useCTSforStatus = true; // Flag to use the XBee `CTS` pin for status @@ -97,9 +99,20 @@ #define MS_DEBUGGING_STD "DigiXBee" #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "LoggerModem.h" + /** @ingroup modem_digi */ /**@{*/ +/** + * @anchor modem_digi_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a Digi XBee + */ +/**@{*/ /** * @brief The loggerModem::_statusTime_ms. * @@ -164,12 +177,7 @@ * R4 on the LTE-M model takes nearly that long to shut down. */ #define XBEE_DISCONNECT_TIME_MS 15000L - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "LoggerModem.h" - +/**@}*/ /** * @brief The parent class for all [Digi XBee and XBee3](@ref modem_digi) wifi diff --git a/src/modems/DigiXBee3GBypass.h b/src/modems/DigiXBee3GBypass.h index c9767e34b..36cfb65da 100644 --- a/src/modems/DigiXBee3GBypass.h +++ b/src/modems/DigiXBee3GBypass.h @@ -58,9 +58,6 @@ #define MS_DEBUGGING_STD "DigiXBee3GBypass" #endif -/** @ingroup modem_digi_3g_bypass */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -83,6 +80,8 @@ #include #endif +/** @ingroup modem_digi_3g_bypass */ +/**@{*/ /** * @brief The loggerModem subclass for [Digi Cellular XBee's](@ref modem_digi) @@ -135,8 +134,8 @@ class DigiXBee3GBypass : public DigiXBee { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; bool modemHardReset(void) override; @@ -163,13 +162,13 @@ class DigiXBee3GBypass : public DigiXBee { * bypass), enables pin sleep, sets the DIO pins to the expected functions, * and reboots the modem to ensure all settings are applied. * - * @return **bool** True if the extra setup succeeded. + * @return True if the extra setup succeeded. */ bool extraModemSetup(void) override; bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_DIGIXBEE3GBYPASS_H_ diff --git a/src/modems/DigiXBeeCellularTransparent.h b/src/modems/DigiXBeeCellularTransparent.h index 602e2f3a3..1b626bff4 100644 --- a/src/modems/DigiXBeeCellularTransparent.h +++ b/src/modems/DigiXBeeCellularTransparent.h @@ -81,9 +81,6 @@ #define MS_DEBUGGING_STD "DigiXBeeCellularTransparent" #endif -/** @ingroup modem_digi_cellular */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -106,6 +103,9 @@ #include #endif +/** @ingroup modem_digi_cellular */ +/**@{*/ + /** * @brief The class for any of * [Digi Cellular XBee or XBee3](@ref modem_digi) modules operating in Digi's @@ -168,8 +168,8 @@ class DigiXBeeCellularTransparent : public DigiXBee { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; bool updateModemMetadata(void) override; @@ -198,15 +198,15 @@ class DigiXBeeCellularTransparent : public DigiXBee { * bypass), enables pin sleep, sets the DIO pins to the expected functions, * and reboots the modem to ensure all settings are applied. * - * @return **bool** True if the extra setup succeeded. + * @return True if the extra setup succeeded. */ bool extraModemSetup(void) override; bool isModemAwake(void) override; private: - const char* _apn; - const char* _user; - const char* _pwd; + const char* _apn; ///< Internal reference to the cellular APN + const char* _user; ///< Internal reference to the APN's user name + const char* _pwd; ///< Internal reference to the APN's password }; /**@}*/ #endif // SRC_MODEMS_DIGIXBEECELLULARTRANSPARENT_H_ diff --git a/src/modems/DigiXBeeLTEBypass.h b/src/modems/DigiXBeeLTEBypass.h index 0f473dce7..a019ddb51 100644 --- a/src/modems/DigiXBeeLTEBypass.h +++ b/src/modems/DigiXBeeLTEBypass.h @@ -74,9 +74,6 @@ #define MS_DEBUGGING_STD "DigiXBeeLTEBypass" #endif -/** @ingroup modem_digi_lte_bypass */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -99,6 +96,9 @@ #include #endif +/** @ingroup modem_digi_lte_bypass */ +/**@{*/ + /** * @brief The class for any of Digi's cellular LTE-M [XBee3](@ref modem_digi) * modules operating in [Digi's "bypass" mode](@ref modem_digi_lte_bypass). @@ -149,8 +149,8 @@ class DigiXBeeLTEBypass : public DigiXBee { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; bool modemHardReset(void) override; @@ -177,13 +177,13 @@ class DigiXBeeLTEBypass : public DigiXBee { * bypass), enables pin sleep, sets the DIO pins to the expected functions, * and reboots the modem to ensure all settings are applied. * - * @return **bool** True if the extra setup succeeded. + * @return True if the extra setup succeeded. */ bool extraModemSetup(void) override; bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_DIGIXBEELTEBYPASS_H_ diff --git a/src/modems/DigiXBeeWifi.cpp b/src/modems/DigiXBeeWifi.cpp index a874915ab..47a7b4896 100644 --- a/src/modems/DigiXBeeWifi.cpp +++ b/src/modems/DigiXBeeWifi.cpp @@ -368,11 +368,6 @@ uint32_t DigiXBeeWifi::getNISTTime(void) { gsmClient.stop(); - // Try up to 4 NIST IP addresses attempting to get a timestamp from NIST -#if !defined NIST_SERVER_RETRYS -#define NIST_SERVER_RETRYS 4 -#endif // NIST_SERVER_RETRYS - for (uint8_t i = 0; i < NIST_SERVER_RETRYS; i++) { // Must ensure that we do not ping the daylight servers more than once // every 4 seconds. NIST clearly specifies here that this is a @@ -394,36 +389,31 @@ uint32_t DigiXBeeWifi::getNISTTime(void) { // These are is the IP address of time-[a,b,c,d]-wwv.nist.gov // XBee's address lookup falters on time.nist.gov -#define TIME_PROTOCOL_PORT 37 -#define IP_STR_LEN 18 - const char ipAddr[NIST_SERVER_RETRYS][IP_STR_LEN] = { - {"132, 163, 97, 1"}, - {"132, 163, 97, 2"}, - {"132, 163, 97, 3"}, - {"132, 163, 97, 4"}}; - IPAddress ip1(132, 163, 97, 1); // Initialize - ip1.fromString(ipAddr[i]); - MS_DBG(F("NIST lookup mdmIP["), i, "/", NIST_SERVER_RETRYS, - F("] with "), ip1); + IPAddress nistIPs[] = { + IPAddress(132, 163, 97, 1), IPAddress(132, 163, 97, 2), + IPAddress(132, 163, 97, 3), IPAddress(132, 163, 97, 4), + IPAddress(132, 163, 97, 6), IPAddress(132, 163, 97, 8)}; + MS_DBG(F("\nConnecting to NIST daytime Server at ip"), nistIPs[i], + F("attempt"), i, F("of"), NIST_SERVER_RETRYS); // NOTE: This "connect" only sets up the connection parameters, the TCP // socket isn't actually opened until we first send data (the '!' below) - connectionMade = gsmClient.connect(ip1, TIME_PROTOCOL_PORT); + connectionMade = gsmClient.connect(nistIPs[i], TIME_PROTOCOL_PORT); // Need to send something before connection is made gsmClient.println('!'); // Wait up to 5 seconds for a response if (connectionMade) { uint32_t start = millis(); - while (gsmClient && gsmClient.available() < 4 && + while (gsmClient && gsmClient.available() < NIST_RESPONSE_BYTES && millis() - start < 5000L) { // wait } if (gsmClient.available() >= 4) { MS_DBG(F("NIST responded after"), millis() - start, F("ms")); - byte response[4] = {0}; - gsmClient.read(response, 4); + byte response[NIST_RESPONSE_BYTES] = {0}; + gsmClient.read(response, NIST_RESPONSE_BYTES); gsmClient.stop(); return parseNISTBytes(response); } else { @@ -586,78 +576,3 @@ bool DigiXBeeWifi::updateModemMetadata(void) { return success; } - - -// Az extensions -void DigiXBeeWifi::setWiFiId(const char* newSsid, bool copyId) { - uint8_t newSsid_sz = strlen(newSsid); - _ssid = newSsid; - if (copyId) { -/* Do size checks, allocate memory for the LoggerID, copy it there - * then set assignment. - */ -#define WIFI_SSID_MAX_sz 32 - if (newSsid_sz > WIFI_SSID_MAX_sz) { - char* WiFiId2 = (char*)newSsid; - PRINTOUT(F("\n\r LoggerModem:setWiFiId too long: Trimmed to "), - newSsid_sz); - WiFiId2[newSsid_sz] = 0; // Trim max size - newSsid_sz = WIFI_SSID_MAX_sz; - } - if (NULL == _ssid_buf) { - _ssid_buf = new char[newSsid_sz + 2]; // Allow for trailing 0 - } else { - PRINTOUT(F("\nLoggerModem::setWiFiId error - expected NULL ptr")); - } - if (NULL == _ssid_buf) { - // Major problem - PRINTOUT(F("\nLoggerModem::setWiFiId error -no buffer "), - _ssid_buf); - } else { - strcpy(_ssid_buf, newSsid); - _ssid = _ssid_buf; - //_ssid2 = _ssid_buf; - } - MS_DBG(F("\nsetWiFiId cp "), _ssid, " sz: ", newSsid_sz); - } -} - -void DigiXBeeWifi::setWiFiPwd(const char* newPwd, bool copyId) { - uint8_t newPwd_sz = strlen(newPwd); - _pwd = newPwd; - - if (copyId) { -/* Do size checks, allocate memory for the LoggerID, copy it there - * then set assignment. - */ -#define WIFI_PWD_MAX_sz 63 // Len 63 printable chars + 0 - if (newPwd_sz > WIFI_PWD_MAX_sz) { - char* pwd2 = (char*)newPwd; - PRINTOUT(F("\n\r LoggerModem:setWiFiPwd too long: Trimmed to "), - newPwd_sz); - pwd2[newPwd_sz] = 0; // Trim max size - newPwd_sz = WIFI_PWD_MAX_sz; - } - if (NULL == _pwd_buf) { - _pwd_buf = new char[newPwd_sz + 2]; // Allow for trailing 0 - } else { - PRINTOUT(F("\nLoggerModem::setWiFiPwd error - expected NULL ptr")); - } - if (NULL == _pwd_buf) { - // Major problem - PRINTOUT(F("\nLoggerModem::setWiFiPwd error -no buffer "), - _pwd_buf); - } else { - strcpy(_pwd_buf, newPwd); - _pwd = _pwd_buf; - } - MS_DEEP_DBG(F("\nsetWiFiPwd cp "), _ssid, " sz: ", newPwd_sz); - } -} - -String DigiXBeeWifi::getWiFiId(void) { - return _ssid; -} -String DigiXBeeWifi::getWiFiPwd(void) { - return _pwd; -} diff --git a/src/modems/DigiXBeeWifi.h b/src/modems/DigiXBeeWifi.h index 9be12dc88..f1abd75d7 100644 --- a/src/modems/DigiXBeeWifi.h +++ b/src/modems/DigiXBeeWifi.h @@ -55,9 +55,6 @@ #define MS_DEBUGGING_DEEP "DigiXBeeWifi" #endif -/** @ingroup modem_digi_wifi */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -80,11 +77,21 @@ #include #endif +/** @ingroup modem_digi_wifi */ +/**@{*/ + +/** + * @anchor modem_digi_wifi_config + * @name Configuration Defines + * Defines to configure if and when to reset the WiFi XBee + */ +/**@{*/ /** - * @brief This causes the Xbee to reset after this number of transmission + * @brief This causes the WiFi XBee to reset after this number of transmission * attempts */ #define XBEE_RESET_THRESHOLD 4 +/**@}*/ /** * @brief The class for the [Digi XBee](@ref modem_digi) @@ -138,18 +145,12 @@ class DigiXBeeWifi : public DigiXBee { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; bool updateModemMetadata(void) override; - // Access Management - void setWiFiId(const char* WiFiId, bool copyId = false); - void setWiFiPwd(const char* WiFiPwd, bool copyId = false); - String getWiFiId(void); - String getWiFiPwd(void); - #ifdef MS_DIGIXBEEWIFI_DEBUG_DEEP StreamDebugger _modemATDebugger; #endif @@ -172,20 +173,26 @@ class DigiXBeeWifi : public DigiXBee { * bypass), enables pin sleep, sets the DIO pins to the expected functions, * and reboots the modem to ensure all settings are applied. * - * @return **bool** True if the extra setup succeeded. + * @return True if the extra setup succeeded. */ bool extraModemSetup(void) override; bool isModemAwake(void) override; private: - const char* _ssid; - const char* _pwd; - bool _maintainAssociation; - // Access Management - char* _ssid_buf = NULL; - char* _pwd_buf = NULL; + const char* _ssid; ///< Internal reference to the WiFi SSID + const char* _pwd; ///< Internal reference to the WiFi password + /** + * @brief True to maintain association with the WiFi network while in sleep + * mode. + */ + bool _maintainAssociation; + /** + * @brief The number of times the XBee has failed to update metadata. + * + * If this is larger than #XBEE_RESET_THRESHOLD the XBee will be reset. + */ uint16_t metadata_failure_count = 0; }; /**@}*/ diff --git a/src/modems/EspressifESP8266.h b/src/modems/EspressifESP8266.h index 30775c230..c3494dfb0 100644 --- a/src/modems/EspressifESP8266.h +++ b/src/modems/EspressifESP8266.h @@ -78,9 +78,6 @@ #define MS_DEBUGGING_STD "EspressifESP8266" #endif -/** @ingroup modem_esp8266 */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -92,7 +89,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" +#ifdef MS_ESPRESSIFESP8266_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_esp8266 */ +/**@{*/ + +/** + * @anchor modem_esp8266_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for an ESP8266 (or ESP32) + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -179,16 +194,7 @@ * credentials. */ #define ESP8266_RECONNECT_TIME_MS 2500 - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_ESPRESSIFESP8266_DEBUG_DEEP -#include -#endif +/**@}*/ /** * @brief The loggerModem subclass for any breakout of the @@ -233,8 +239,8 @@ class EspressifESP8266 : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; #ifdef MS_ESPRESSIFESP8266_DEBUG_DEEP @@ -266,15 +272,23 @@ class EspressifESP8266 : public loggerModem { bool isModemAwake(void) override; private: + /** + * @brief Waits for the Espressif module to reboot and print out it's boot + * up string. Because the boot up string is at a different baud rate (74880 + * baud), it usually comes out as junk. + * + * @return True if text (assumed to be the start message) was received; + * false if text was received after boot. + */ bool ESPwaitForBoot(void); - const char* _ssid; - const char* _pwd; + const char* _ssid; ///< Internal reference to the WiFi SSID + const char* _pwd; ///< Internal reference to the WiFi password }; +/**@}*/ /** - * @brief typedef to avoid confusion for users + * @brief Assign EspressifESP32 as type EspressifESP8266 to avoid user confusion */ typedef EspressifESP8266 EspressifESP32; -/**@}*/ #endif // SRC_MODEMS_ESPRESSIFESP8266_H_ diff --git a/src/modems/LoggerModemMacros.h b/src/modems/LoggerModemMacros.h index 2611ffc08..9123468e8 100644 --- a/src/modems/LoggerModemMacros.h +++ b/src/modems/LoggerModemMacros.h @@ -179,7 +179,7 @@ return success; \ } -#if defined TINY_GSM_MODEM_HAS_GPRS +#if defined(TINY_GSM_MODEM_HAS_GPRS) /** * @brief Creates an isInternetAvailable() function for a specific modem * subclass. @@ -321,7 +321,7 @@ MS_PRINT_DEBUG_TIMER, F("milliseconds.")); \ } -#else // from #if defined TINY_GSM_MODEM_HAS_GPRS (ie, this is wifi) +#else // from #if defined(TINY_GSM_MODEM_HAS_GPRS) (ie, this is wifi) /** * @brief Creates an isInternetAvailable() function for a specific @@ -365,6 +365,8 @@ * connection to be made, if possible. * * @param specificModem The modem subclass + * @param auto_reconnect_time The amount of time, in milliseconds, to allow the + * modem to attempt to connect automatically from saved credentials. * * @return The text of a connectInternet(uint32_t maxConnectionTime) function * specific to a single modem subclass. @@ -450,8 +452,23 @@ MS_DBG(F("Disconnected from WiFi network after"), \ MS_PRINT_DEBUG_TIMER, F("milliseconds.")); \ } -#endif // #if defined TINY_GSM_MODEM_HAS_GPRS +#endif // #if defined(TINY_GSM_MODEM_HAS_GPRS) +/** + * @brief The port hosting the NIST "time" protocol (37) + */ +#define TIME_PROTOCOL_PORT 37 +/** + * @brief The size of the NIST response from the "time" protocol, in bytes. + */ +#define NIST_RESPONSE_BYTES 4 + +#if !defined(NIST_SERVER_RETRYS) || defined(DOXYGEN) +/** + * @brief The number of retry attempts when connecting to the NIST server. + */ +#define NIST_SERVER_RETRYS 12 +#endif // NIST_SERVER_RETRYS /** * @brief Creates a getNISTTime() function for a specific modem subclass. @@ -487,21 +504,24 @@ \ /** Make TCP connection. */ \ MS_DBG(F("\nConnecting to NIST daytime Server")); \ - bool connectionMade = gsmClient.connect("time.nist.gov", 37, 15); \ + bool connectionMade = gsmClient.connect("time.nist.gov", \ + TIME_PROTOCOL_PORT, 15); \ \ /** Wait up to 5 seconds for a response. */ \ if (connectionMade) { \ uint32_t start = millis(); \ - while (gsmClient && gsmClient.available() < 4 && \ + while (gsmClient && \ + gsmClient.available() < NIST_SERVER_RETRYS && \ millis() - start < 5000L) {} \ \ - if (gsmClient.available() >= 4) { \ + if (gsmClient.available() >= NIST_RESPONSE_BYTES) { \ MS_DBG(F("NIST responded after"), millis() - start, \ F("ms")); \ - byte response[4] = {0}; \ - gsmClient.read(response, 4); \ + byte response[NIST_RESPONSE_BYTES] = {0}; \ + gsmClient.read(response, NIST_RESPONSE_BYTES); \ if (gsmClient.connected()) gsmClient.stop(); \ - return parseNISTBytes(response); \ + uint32_t nistParsed = parseNISTBytes(response); \ + if (nistParsed != 0) { return parseNISTBytes(response); } \ } else { \ MS_DBG(F("NIST Time server did not respond!")); \ if (gsmClient.connected()) gsmClient.stop(); \ @@ -589,11 +609,11 @@ #ifdef TINY_GSM_MODEM_HAS_BATTERY /** - * @brief Creates a getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - * uint16_t& milliVolts) function for a specific modem subclass. + * @brief Creates a getModemBatteryStats(int8_t& chargeState, int8_t& percent, + * int16_t& milliVolts) function for a specific modem subclass. * * This is a passthrough to the specific modem's getBattStats(uint8_t& - * chargeState, int8_t& percent, uint16_t& milliVolts) for modems where such + * chargeState, int8_t& percent, int16_t& milliVolts) for modems where such * data is available. * * This populates the entered references with -9999s for modems where such data @@ -601,24 +621,24 @@ * * @param specificModem The modem subclass * - * @return The text of a getModemBatteryStats(uint8_t& chargeState, int8_t& - * percent, uint16_t& milliVolts) function specific to a single modem subclass. + * @return The text of a getModemBatteryStats(int8_t& chargeState, int8_t& + * percent, int16_t& milliVolts) function specific to a single modem subclass. * */ #define MS_MODEM_GET_MODEM_BATTERY_DATA(specificModem) \ bool specificModem::getModemBatteryStats( \ - uint8_t& chargeState, int8_t& percent, uint16_t& milliVolts) { \ + int8_t& chargeState, int8_t& percent, int16_t& milliVolts) { \ MS_DBG(F("Getting modem battery data:")); \ return gsmModem.getBattStats(chargeState, percent, milliVolts); \ } #else /** - * @brief Creates a getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - * uint16_t& milliVolts) function for a specific modem subclass. + * @brief Creates a getModemBatteryStats(int8_t& chargeState, int8_t& percent, + * int16_t& milliVolts) function for a specific modem subclass. * * This is a passthrough to the specific modem's getBattStats(uint8_t& - * chargeState, int8_t& percent, uint16_t& milliVolts) for modems where such + * chargeState, int8_t& percent, int16_t& milliVolts) for modems where such * data is available. * * This populates the entered references with -9999s for modems where such data @@ -626,18 +646,18 @@ * * @param specificModem The modem subclass * - * @return The text of a getModemBatteryStats(uint8_t& chargeState, int8_t& - * percent, uint16_t& milliVolts) function specific to a single modem subclass. + * @return The text of a getModemBatteryStats(int8_t& chargeState, int8_t& + * percent, int16_t& milliVolts) function specific to a single modem subclass. * */ -#define MS_MODEM_GET_MODEM_BATTERY_DATA(specificModem) \ - bool specificModem::getModemBatteryStats( \ - uint8_t& chargeState, int8_t& percent, uint16_t& milliVolts) { \ - MS_DBG(F("This modem doesn't return battery information!")); \ - chargeState = 99; \ - percent = -99; \ - milliVolts = 9999; \ - return false; \ +#define MS_MODEM_GET_MODEM_BATTERY_DATA(specificModem) \ + bool specificModem::getModemBatteryStats( \ + int8_t& chargeState, int8_t& percent, int16_t& milliVolts) { \ + MS_DBG(F("This modem doesn't return battery information!")); \ + chargeState = 99; \ + percent = -99; \ + milliVolts = 9999; \ + return false; \ } #endif diff --git a/src/modems/QuectelBG96.h b/src/modems/QuectelBG96.h index 94185ecd4..69994d983 100644 --- a/src/modems/QuectelBG96.h +++ b/src/modems/QuectelBG96.h @@ -70,9 +70,6 @@ #define MS_DEBUGGING_STD "QuectelBG96" #endif -/** @ingroup modem_bg96 */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -84,7 +81,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" + +#ifdef MS_QUECTELBG96_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_bg96 */ +/**@{*/ +/** + * @anchor modem_bg96_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a Quectel BG96 + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -148,17 +163,7 @@ * Documentation for the BG96 says to allow >2s for clean shutdown. */ #define BG96_DISCONNECT_TIME_MS 5000L - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_QUECTELBG96_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for Dragino, Nimbelink, or any other module @@ -201,8 +206,8 @@ class QuectelBG96 : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; bool modemHardReset(void) override; @@ -228,7 +233,7 @@ class QuectelBG96 : public loggerModem { bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_QUECTELBG96_H_ diff --git a/src/modems/SIMComSIM7000.h b/src/modems/SIMComSIM7000.h index ad23daa76..7e5680e37 100644 --- a/src/modems/SIMComSIM7000.h +++ b/src/modems/SIMComSIM7000.h @@ -59,9 +59,6 @@ #define MS_DEBUGGING_STD "SIMComSIM7000" #endif -/** @ingroup modem_sim7000 */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -73,7 +70,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" + +#ifdef MS_SIMCOMSIM7000_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_sim7000 */ +/**@{*/ +/** + * @anchor modem_sim7000_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a SIMCom SIM7000 + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -139,17 +154,7 @@ * SIM7000 power down (gracefully) takes 1.8-6.9 sec. */ #define SIM7000_DISCONNECT_TIME_MS 7000L - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_SIMCOMSIM7000_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for Botletics, And1, and other modules based @@ -192,8 +197,8 @@ class SIMComSIM7000 : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; #ifdef MS_SIMCOMSIM7000_DEBUG_DEEP @@ -217,7 +222,7 @@ class SIMComSIM7000 : public loggerModem { bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_SIMCOMSIM7000_H_ diff --git a/src/modems/SIMComSIM7080.cpp b/src/modems/SIMComSIM7080.cpp index 834712154..a85d712a1 100644 --- a/src/modems/SIMComSIM7080.cpp +++ b/src/modems/SIMComSIM7080.cpp @@ -34,7 +34,35 @@ SIMComSIM7080::SIMComSIM7080(Stream* modemStream, int8_t powerPin, // Destructor SIMComSIM7080::~SIMComSIM7080() {} -MS_MODEM_EXTRA_SETUP(SIMComSIM7080); +bool SIMComSIM7080::extraModemSetup(void) { + bool success = gsmModem.init(); + gsmClient.init(&gsmModem); + _modemName = gsmModem.getModemName(); + + // The modem is liable to crash if the send buffer overflows and TinyGSM + // offers no way to know when that might happen. Reduce the chance of + // problems by maxing out the send buffer size. This size should accommodate + // a completely full 8K LogBuffer and a crappy connection. + gsmModem.sendAT(F("+CACFG=\"SNDBUF\",29200")); + gsmModem.waitResponse(); + + // Enable the netlight indicator + gsmModem.sendAT(F("+CNETLIGHT=1")); + gsmModem.waitResponse(); + // Enable netlight indication of GPRS status + // Enable, the netlight will be forced to enter into 64ms on/300ms off + // blinking state in GPRS data transmission service.Otherwise, the netlight + // state is not restricted. + gsmModem.sendAT(F("+CNETLIGHT=1")); + gsmModem.waitResponse(); + + // Enable the battery check functionality + gsmModem.sendAT(F("+CBATCHK=1")); + gsmModem.waitResponse(); + + return success; +} + MS_IS_MODEM_AWAKE(SIMComSIM7080); MS_MODEM_WAKE(SIMComSIM7080); diff --git a/src/modems/SIMComSIM7080.h b/src/modems/SIMComSIM7080.h index ef0f10e2e..d1bb5cb81 100644 --- a/src/modems/SIMComSIM7080.h +++ b/src/modems/SIMComSIM7080.h @@ -51,9 +51,6 @@ #define MS_DEBUGGING_STD "SIMComSIM7080" #endif -/** @ingroup modem_sim7080 */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -65,7 +62,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" + +#ifdef MS_SIMCOMSIM7080_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_sim7080 */ +/**@{*/ +/** + * @anchor modem_sim7080_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a SIMCom SIM7080 + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -134,17 +149,7 @@ * SIM7080 power down (gracefully) takes 1.8-2 sec. */ #define SIM7080_DISCONNECT_TIME_MS 2000L - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_SIMCOMSIM7080_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for modules based on the [SIMCOM @@ -187,8 +192,8 @@ class SIMComSIM7080 : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; #ifdef MS_SIMCOMSIM7080_DEBUG_DEEP @@ -212,7 +217,7 @@ class SIMComSIM7080 : public loggerModem { bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_SIMCOMSIM7080_H_ diff --git a/src/modems/SIMComSIM800.h b/src/modems/SIMComSIM800.h index 51ebeb421..5553a3ba1 100644 --- a/src/modems/SIMComSIM800.h +++ b/src/modems/SIMComSIM800.h @@ -63,9 +63,6 @@ #define MS_DEBUGGING_STD "SIMComSIM800" #endif -/** @ingroup modem_sim800 */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -77,7 +74,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" + +#ifdef MS_SIMCOMSIM800_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_sim800 */ +/**@{*/ +/** + * @anchor modem_sim800_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a SIMCom SIM800 + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -141,17 +156,7 @@ * shutdown in case it is not monitored. */ #define SIM800_DISCONNECT_TIME_MS 15000L - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_SIMCOMSIM800_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for the Adafruit Fona 2G, the Sodaq GPRSBeeR4 @@ -194,8 +199,8 @@ class SIMComSIM800 : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; #ifdef MS_SIMCOMSIM800_DEBUG_DEEP @@ -219,7 +224,7 @@ class SIMComSIM800 : public loggerModem { bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_SIMCOMSIM800_H_ diff --git a/src/modems/SequansMonarch.h b/src/modems/SequansMonarch.h index a1262ef90..afcc48456 100644 --- a/src/modems/SequansMonarch.h +++ b/src/modems/SequansMonarch.h @@ -64,9 +64,6 @@ #define MS_DEBUGGING_STD "SequansMonarch" #endif -/** @ingroup modem_monarch */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -78,7 +75,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" + +#ifdef MS_SEQUANSMONARCH_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_monarch */ +/**@{*/ +/** + * @anchor modem_monarch_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a Sequans Monarch + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -168,17 +183,7 @@ * monitored. */ #define VZM20Q_DISCONNECT_TIME_MS 15000L - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_SEQUANSMONARCH_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for Nimbelink or other modules based on the @@ -225,8 +230,8 @@ class SequansMonarch : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; #ifdef MS_SEQUANSMONARCH_DEBUG_DEEP @@ -250,7 +255,7 @@ class SequansMonarch : public loggerModem { bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_SEQUANSMONARCH_H_ diff --git a/src/modems/Sodaq2GBeeR6.h b/src/modems/Sodaq2GBeeR6.h index 07302642b..07fd95bc1 100644 --- a/src/modems/Sodaq2GBeeR6.h +++ b/src/modems/Sodaq2GBeeR6.h @@ -69,9 +69,24 @@ #define MS_DEBUGGING_STD "Sodaq2GBeeR6" #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "SIMComSIM800.h" + +#ifdef MS_SODAQ2GBEER6_DEBUG_DEEP +#include +#endif + /** @ingroup modem_gprsbee */ /**@{*/ +/** + * @anchor modem_gprsbee_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a GPRSBee + */ +/**@{*/ /** * @brief The loggerModem::_wakeDelayTime_ms. * @@ -79,16 +94,7 @@ * warm-up time needed */ #define S2GBR6_WAKE_DELAY_MS 0 - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "SIMComSIM800.h" - -#ifdef MS_SODAQ2GBEER6_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for the [Sodaq 2GBee](@ref modem_gprsbee) @@ -166,6 +172,10 @@ class Sodaq2GBeeR6 : public SIMComSIM800 { bool extraModemSetup(void) override; private: + /** + * @brief The digital pin number of a pin on the mcu controlling the voltage + * reference (pin 1) for the GPRSBee. + */ int8_t _vRefPin; }; /**@}*/ diff --git a/src/modems/SodaqUBeeR410M.h b/src/modems/SodaqUBeeR410M.h index 103b52747..905d3555e 100644 --- a/src/modems/SodaqUBeeR410M.h +++ b/src/modems/SodaqUBeeR410M.h @@ -120,9 +120,6 @@ #define MS_DEBUGGING_STD "SodaqUBeeR410M" #endif -/** @ingroup modem_ubee_ltem */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -134,7 +131,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" + +#ifdef MS_SODAQUBEER410M_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_ubee_ltem */ +/**@{*/ +/** + * @anchor modem_ubee_ltem_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a Sodaq UBee R410M + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -197,17 +212,7 @@ * low. We allow up to 15 seconds for shutdown in case it is not monitored. */ #define R410M_DISCONNECT_TIME_MS 15000L - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_SODAQUBEER410M_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for the @@ -303,8 +308,8 @@ class SodaqUBeeR410M : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; bool modemHardReset(void) override; @@ -338,7 +343,7 @@ class SodaqUBeeR410M : public loggerModem { bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_SODAQUBEER410M_H_ diff --git a/src/modems/SodaqUBeeU201.h b/src/modems/SodaqUBeeU201.h index e71e7eb85..00d0e7002 100644 --- a/src/modems/SodaqUBeeU201.h +++ b/src/modems/SodaqUBeeU201.h @@ -60,9 +60,6 @@ #define MS_DEBUGGING_STD "SodaqUBeeU201" #endif -/** @ingroup modem_ubee_3g */ -/**@{*/ - /** * @brief The modem type for the underlying TinyGSM library. */ @@ -74,6 +71,25 @@ #define TINY_GSM_RX_BUFFER 64 #endif +// Included Dependencies +#include "ModSensorDebugger.h" +#undef MS_DEBUGGING_STD +#include "TinyGsmClient.h" +#include "LoggerModem.h" + +#ifdef MS_SODAQUBEEU201_DEBUG_DEEP +#include +#endif + +/** @ingroup modem_ubee_3g */ +/**@{*/ + +/** + * @anchor modem_ubee_3g_pins_timing + * @name Modem Pin Settings and Timing + * The timing and pin level settings for a Sodaq UBee U201 + */ +/**@{*/ /** * @brief The loggerModem::_statusLevel. * @@ -137,18 +153,7 @@ * low. We allow up to 15 seconds for shutdown in case it is not monitored. */ #define U201_DISCONNECT_TIME_MS 15000L - - -// Included Dependencies -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#include "TinyGsmClient.h" -#include "LoggerModem.h" - -#ifdef MS_SODAQUBEEU201_DEBUG_DEEP -#include -#endif - +/**@}*/ /** * @brief The loggerModem subclass for the [2G/3G](@ref modem_ubee_3g) @@ -200,8 +205,8 @@ class SodaqUBeeU201 : public loggerModem { uint32_t getNISTTime(void) override; bool getModemSignalQuality(int16_t& rssi, int16_t& percent) override; - bool getModemBatteryStats(uint8_t& chargeState, int8_t& percent, - uint16_t& milliVolts) override; + bool getModemBatteryStats(int8_t& chargeState, int8_t& percent, + int16_t& milliVolts) override; float getModemChipTemperature(void) override; #ifdef MS_SODAQUBEEU201_DEBUG_DEEP @@ -225,7 +230,7 @@ class SodaqUBeeU201 : public loggerModem { bool isModemAwake(void) override; private: - const char* _apn; + const char* _apn; ///< Internal reference to the cellular APN }; /**@}*/ #endif // SRC_MODEMS_SODAQUBEEU201_H_ diff --git a/src/publishers/DreamHostPublisher.h b/src/publishers/DreamHostPublisher.h index ba88e4d11..04a1edbba 100644 --- a/src/publishers/DreamHostPublisher.h +++ b/src/publishers/DreamHostPublisher.h @@ -132,7 +132,7 @@ class DreamHostPublisher : public dataPublisher { * Allows the use of any type of client and multiple clients tied to a * single TinyGSM modem instance * - * @return **int16_t** The http status code of the response. + * @return The http status code of the response. */ int16_t publishData(Client* outClient) override; @@ -152,8 +152,10 @@ class DreamHostPublisher : public dataPublisher { private: + /** + * @brief A pointer to the base URL for the dreamhost portal. + */ const char* _DreamHostPortalRX = nullptr; - bool _dualPost = true; }; #endif // SRC_PUBLISHERS_DREAMHOSTPUBLISHER_H_ diff --git a/src/publishers/EnviroDIYPublisher.cpp b/src/publishers/EnviroDIYPublisher.cpp index 5a6a043d8..9eacef971 100644 --- a/src/publishers/EnviroDIYPublisher.cpp +++ b/src/publishers/EnviroDIYPublisher.cpp @@ -18,9 +18,6 @@ // Constant values for post requests // I want to refer to these more than once while ensuring there is only one copy // in memory -const char* EnviroDIYPublisher::postEndpoint = "/api/data-stream/"; -const char* EnviroDIYPublisher::enviroDIYHost = "data.envirodiy.org"; -const int EnviroDIYPublisher::enviroDIYPort = 80; const char* EnviroDIYPublisher::tokenHeader = "\r\nTOKEN: "; const char* EnviroDIYPublisher::contentLengthHeader = "\r\nContent-Length: "; const char* EnviroDIYPublisher::contentTypeHeader = @@ -31,12 +28,24 @@ const char* EnviroDIYPublisher::timestampTag = "\",\"timestamp\":\""; // Constructors -EnviroDIYPublisher::EnviroDIYPublisher() : dataPublisher() {} +EnviroDIYPublisher::EnviroDIYPublisher() : dataPublisher() { + setHost("monitormywatershed.org"); + setPath("/api/data-stream/"); + setPort(80); +} EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, int sendEveryX) - : dataPublisher(baseLogger, sendEveryX) {} + : dataPublisher(baseLogger, sendEveryX) { + setHost("monitormywatershed.org"); + setPath("/api/data-stream/"); + setPort(80); +} EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client* inClient, int sendEveryX) - : dataPublisher(baseLogger, inClient, sendEveryX) {} + : dataPublisher(baseLogger, inClient, sendEveryX) { + setHost("monitormywatershed.org"); + setPath("/api/data-stream/"); + setPort(80); +} EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, const char* registrationToken, const char* samplingFeatureUUID, @@ -44,6 +53,9 @@ EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, : dataPublisher(baseLogger, sendEveryX) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); + setHost("monitormywatershed.org"); + setPath("/api/data-stream/"); + setPort(80); } EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client* inClient, const char* registrationToken, @@ -52,11 +64,45 @@ EnviroDIYPublisher::EnviroDIYPublisher(Logger& baseLogger, Client* inClient, : dataPublisher(baseLogger, inClient, sendEveryX) { setToken(registrationToken); _baseLogger->setSamplingFeatureUUID(samplingFeatureUUID); + setHost("monitormywatershed.org"); + setPath("/api/data-stream/"); + setPort(80); } // Destructor EnviroDIYPublisher::~EnviroDIYPublisher() {} +// Returns the data destination +String EnviroDIYPublisher::getHost(void) { + return String(enviroDIYHost); +} + +// Returns the data destination +void EnviroDIYPublisher::setHost(const char* host) { + enviroDIYHost = host; +} + +// Returns the data destination +String EnviroDIYPublisher::getPath(void) { + return String(enviroDIYPath); +} + +// Returns the data destination +void EnviroDIYPublisher::setPath(const char* endpoint) { + enviroDIYPath = endpoint; +} + +// Returns the data destination +int EnviroDIYPublisher::getPort(void) { + return enviroDIYPort; +} + +// Returns the data destination +void EnviroDIYPublisher::setPort(int port) { + enviroDIYPort = port; +} + + void EnviroDIYPublisher::setToken(const char* registrationToken) { _registrationToken = registrationToken; } @@ -79,6 +125,7 @@ uint16_t EnviroDIYPublisher::calculateJsonSize() { } } jsonLength += 1; // } + MS_DBG(F("Outgoing JSON size:"), jsonLength); return jsonLength; } @@ -110,8 +157,6 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { char tempBuffer[37] = ""; uint16_t did_respond = 0; - MS_DBG(F("Outgoing JSON size:"), calculateJsonSize()); - // Open a TCP/IP connection to the Enviro DIY Data Portal (WebSDL) MS_DBG(F("Connecting client")); MS_START_DEBUG_TIMER; @@ -121,7 +166,7 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { // copy the initial post header into the tx buffer txBufferAppend(postHeader); - txBufferAppend(postEndpoint); + txBufferAppend(enviroDIYPath); txBufferAppend(HTTPtag); // add the rest of the HTTP POST headers to the outgoing buffer @@ -163,9 +208,9 @@ int16_t EnviroDIYPublisher::publishData(Client* outClient) { // Write out the complete request txBufferFlush(); - // Wait 10 seconds for a response from the server + // Wait 30 seconds for a response from the server uint32_t start = millis(); - while ((millis() - start) < 10000L && outClient->available() < 12) { + while ((millis() - start) < 30000L && outClient->available() < 12) { delay(10); } diff --git a/src/publishers/EnviroDIYPublisher.h b/src/publishers/EnviroDIYPublisher.h index 025ece3df..97b71a08e 100644 --- a/src/publishers/EnviroDIYPublisher.h +++ b/src/publishers/EnviroDIYPublisher.h @@ -105,9 +105,49 @@ class EnviroDIYPublisher : public dataPublisher { // Returns the data destination String getEndpoint(void) override { - return String(enviroDIYHost); + return String(enviroDIYHost) + String(enviroDIYPath); } + /** + * @brief Get the EnviroDIY/Monitor My Watershed web host + * + * @return The EnviroDIY/Monitor My Watershed web host + */ + String getHost(void); + + /** + * @brief Set the EnviroDIY/Monitor My Watershed web host + * + * @param host The EnviroDIY/Monitor My Watershed web host + */ + void setHost(const char* host); + + /** + * @brief Get the EnviroDIY/Monitor My Watershed API path + * + * @return The EnviroDIY/Monitor My Watershed API path + */ + String getPath(void); + /** + * @brief Set the EnviroDIY/Monitor My Watershed API path + * + * @param endpoint The EnviroDIY/Monitor My Watershed API path + */ + void setPath(const char* endpoint); + + /** + * @brief Get the EnviroDIY/Monitor My Watershed API port + * + * @return The EnviroDIY/Monitor My Watershed API port + */ + int getPort(void); + /** + * @brief Set the EnviroDIY/Monitor My Watershed API port + * + * @param port The EnviroDIY/Monitor My Watershed API port + */ + void setPort(int port); + // Adds the site registration token /** * @brief Set the site registration token @@ -120,7 +160,7 @@ class EnviroDIYPublisher : public dataPublisher { /** * @brief Calculates how long the outgoing JSON will be * - * @return uint16_t The number of characters in the JSON object. + * @return The number of characters in the JSON object. */ uint16_t calculateJsonSize(); @@ -156,7 +196,7 @@ class EnviroDIYPublisher : public dataPublisher { * @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 * single TinyGSM modem instance - * @return **int16_t** The http status code of the response. + * @return The http status code of the response. */ int16_t publishData(Client* outClient) override; @@ -167,9 +207,9 @@ class EnviroDIYPublisher : public dataPublisher { * * @{ */ - static const char* postEndpoint; ///< The endpoint - static const char* enviroDIYHost; ///< The host name - static const int enviroDIYPort; ///< The host port + const char* enviroDIYPath; ///< The api path + const char* enviroDIYHost; ///< The host name + int enviroDIYPort; ///< The host port static const char* tokenHeader; ///< The token header text static const char* contentLengthHeader; ///< The content length header text static const char* contentTypeHeader; ///< The content type header text @@ -183,10 +223,14 @@ class EnviroDIYPublisher : public dataPublisher { */ static const char* samplingFeatureTag; ///< The JSON feature UUID tag static const char* timestampTag; ///< The JSON feature timestamp tag - /**@}*/ + + /**@}*/ private: - // Tokens and UUID's for EnviroDIY + /** + * @brief Internal reference to the EnviroDIY/Monitor My Watershed + * registration token. + */ const char* _registrationToken = nullptr; }; diff --git a/src/publishers/ThingSpeakPublisher.h b/src/publishers/ThingSpeakPublisher.h index 1a924b500..32af2c4b9 100644 --- a/src/publishers/ThingSpeakPublisher.h +++ b/src/publishers/ThingSpeakPublisher.h @@ -203,9 +203,22 @@ class ThingSpeakPublisher : public dataPublisher { private: // Keys for ThingSpeak - const char* _thingSpeakMQTTKey = nullptr; - const char* _thingSpeakChannelID = nullptr; - const char* _thingSpeakChannelKey = nullptr; + /** + * @brief The MQTT key for ThingSpeak + */ + const char* _thingSpeakMQTTKey = nullptr; + /** + * @brief The channel ID for ThingSpeak + */ + const char* _thingSpeakChannelID = nullptr; + /** + * @brief The channel key for ThingSpeak + */ + const char* _thingSpeakChannelKey = nullptr; + /** + * @brief Internal reference ot the PubSubClient instance for MQTT + * communication. + */ PubSubClient _mqttClient; }; diff --git a/src/publishers/UbidotsPublisher.h b/src/publishers/UbidotsPublisher.h index c8926eb2e..4f63156f8 100644 --- a/src/publishers/UbidotsPublisher.h +++ b/src/publishers/UbidotsPublisher.h @@ -106,6 +106,12 @@ class UbidotsPublisher : public dataPublisher { virtual ~UbidotsPublisher(); // Returns the data destination + /** + * @brief Get the destination for published data - generally the host name + * of the data receiver. + * + * @return The URL or HOST to receive published data + */ String getEndpoint(void) override { return String(ubidotsHost); } @@ -124,7 +130,7 @@ class UbidotsPublisher : public dataPublisher { /** * @brief Calculates how long the outgoing JSON will be * - * @return uint16_t The number of characters in the JSON object. + * @return The number of characters in the JSON object. */ uint16_t calculateJsonSize(); @@ -164,7 +170,7 @@ class UbidotsPublisher : public dataPublisher { * @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 * single TinyGSM modem instance - * @return **int16_t** The http status code of the response. + * @return The http status code of the response. */ int16_t publishData(Client* outClient) override; @@ -194,6 +200,12 @@ class UbidotsPublisher : public dataPublisher { private: // Tokens for Ubidots + /** + * @brief 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 device's setup + * panel). + */ const char* _authentificationToken = nullptr; }; diff --git a/src/sensors/AOSongAM2315.h b/src/sensors/AOSongAM2315.h index 2788b5842..c3a7c7414 100644 --- a/src/sensors/AOSongAM2315.h +++ b/src/sensors/AOSongAM2315.h @@ -73,11 +73,17 @@ /** @ingroup sensor_am2315 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_am2315_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by an AOSong 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 @@ -207,7 +213,7 @@ class AOSongAM2315 : public Sensor { /** * @brief Report the I2C address of the AM2315 - which is always 0xB8. * - * @return **String** Text describing how the sensor is attached to the mcu. + * @return Text describing how the sensor is attached to the mcu. */ String getSensorLocation(void) override; @@ -219,7 +225,7 @@ class AOSongAM2315 : public Sensor { * 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 + * @return True if the setup was successful. For the AOSong AM2315 * the result will always be true. */ bool setup(void) override; @@ -233,8 +239,11 @@ class AOSongAM2315 : public Sensor { /** * @brief An internal reference to the hardware Wire instance. */ - TwoWire* _i2c; - Adafruit_AM2315* am2315ptr; // create a sensor object + TwoWire* _i2c; + /** + * @brief Internal reference to the Adafruit sensor class + */ + Adafruit_AM2315* am2315ptr; }; diff --git a/src/sensors/AOSongDHT.h b/src/sensors/AOSongDHT.h index 45e99f55e..7daabf22d 100644 --- a/src/sensors/AOSongDHT.h +++ b/src/sensors/AOSongDHT.h @@ -95,11 +95,17 @@ static const uint8_t AM2301{21}; /**< AM2301 */ /** @ingroup sensor_dht */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_dht_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by an AOSong DHT + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the DHT can report 3 values. #define DHT_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define DHT_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_dht_timing @@ -247,8 +253,8 @@ class AOSongDHT : public Sensor { bool addSingleMeasurementResult(void) override; private: - DHT dht_internal; - uint8_t _dhtType; + DHT dht_internal; ///< Internal reference to the Adafruit DHT object + uint8_t _dhtType; ///< Internal reference to the DHT type }; diff --git a/src/sensors/AnalogElecConductivity.cpp b/src/sensors/AnalogElecConductivity.cpp index e1b49b01e..2e2e3f25e 100644 --- a/src/sensors/AnalogElecConductivity.cpp +++ b/src/sensors/AnalogElecConductivity.cpp @@ -22,8 +22,6 @@ AnalogElecConductivity::AnalogElecConductivity(int8_t powerPin, int8_t dataPin, ANALOGELECCONDUCTIVITY_STABILIZATION_TIME_MS, ANALOGELECCONDUCTIVITY_MEASUREMENT_TIME_MS, powerPin, dataPin, measurementsToAverage, ANALOGELECCONDUCTIVITY_INC_CALC_VARIABLES), - _EcPowerPin(powerPin), - _EcAdcPin(dataPin), _Rseries_ohms(Rseries_ohms), _sensorEC_Konst(sensorEC_Konst) {} // Destructor @@ -31,13 +29,13 @@ AnalogElecConductivity::~AnalogElecConductivity() {} String AnalogElecConductivity::getSensorLocation(void) { String sensorLocation = F("anlgEc Proc Data/Pwr"); - sensorLocation += String(_EcAdcPin) + "/" + String(_EcPowerPin); + sensorLocation += String(_dataPin) + "/" + String(_powerPin); return sensorLocation; } float AnalogElecConductivity::readEC() { - return readEC(_EcAdcPin); + return readEC(_dataPin); } @@ -47,7 +45,7 @@ float AnalogElecConductivity::readEC(uint8_t analogPinNum) { float EC_uScm = -9999; // units are uS per cm // Set the resolution for the processor ADC, only applies to SAMD boards. -#if !defined ARDUINO_ARCH_AVR +#if !defined(ARDUINO_ARCH_AVR) analogReadResolution(ANALOG_EC_ADC_RESOLUTION); #endif // ARDUINO_ARCH_AVR // Set the analog reference mode for the voltage measurement. @@ -92,7 +90,7 @@ bool AnalogElecConductivity::addSingleMeasurementResult(void) { if (bitRead(_sensorStatus, 6)) { MS_DBG(getSensorNameAndLocation(), F("is reporting:")); - sensorEC_uScm = readEC(_EcAdcPin); + sensorEC_uScm = readEC(_dataPin); MS_DBG(F("Water EC (uSm/cm)"), sensorEC_uScm); } else { MS_DBG(getSensorNameAndLocation(), F("is not currently measuring!")); diff --git a/src/sensors/AnalogElecConductivity.h b/src/sensors/AnalogElecConductivity.h index 57351fe86..c5497819e 100644 --- a/src/sensors/AnalogElecConductivity.h +++ b/src/sensors/AnalogElecConductivity.h @@ -43,6 +43,7 @@ * of known resistance (R1) and then to an analog pin to measure the voltage. * * So the circuit is: + * * @code{.unparsed} * Vin (sensor power) --- R1 --- power cord --- Vout * | @@ -60,13 +61,13 @@ * First, we need to convert the bit reading of the ADC into volts based on the * range of the ADC (1 bit more than the resolution): * - * `meas_voltage = (analog_ref_voltage * raw_adc_bits) / ANALOG_EC_ADC_RANGE` + * \f[meas\_voltage = \frac{analog\_ref\_voltage * raw\_adc\_bits}{ANALOG\_EC\_ADC\_RANGE}\f] * * Assuming the voltage of the ADC reference is the same as that used to power * the EC resistor circuit we can replace the reference voltage with the sensor * power voltage: * - * `meas_voltage = (sensor_power_voltage * raw_adc_bits) / ANALOG_EC_ADC_RANGE` + * \f[meas\_voltage = \frac{sensor\_power\_voltage * raw\_adc\_bits}{ANALOG\_EC\_ADC\_RANGE}\f] * * @note The Vcc going to the circuit (~3.3V) can and will vary, as battery * level gets low. If possible, you should use setup the processor to use an @@ -80,16 +81,16 @@ * Now we can calculate the resistance of the water, knowing the resistance of * the resistor we put in the circuit and the voltage drop: * - * `Rwater_ohms = (meas_voltage * Rseries_ohms) / (sensor_power_voltage - meas_voltage)` + * \f[R_{water\_ohms} = \frac{meas\_voltage * R_{series\_ohms}}{sensor\_power\_voltage - meas\_voltage}\f] * * Combining the above equations and doing some rearranging, we get: * - * `Rwater_ohms = Rseries_ohms / ((ANALOG_EC_ADC_RANGE / raw_adc_bits) - 1)` + * \f[R_{water\_ohms} = \frac{R_{series\_ohms}}{\frac{ANALOG\_EC\_ADC\_RANGE}{raw\_adc\_bits} - 1}\f] * * The conductivity is then the inverse of the resistance - multiplied by a * measured cell constant and a 10^6 conversion to µS/cm. * - * `water_conductivity = 1000000 / (Rwater_ohms * sensorEC_Konst)` + * \f[water\_conductivity = \frac{1000000}{R_{water\_ohms} * sensor_{EC\_Konst}}\f] * * The real cell constant will vary based on the size of the "cell" - that is, * the size of the plug on the power cord. You can calculate the cell constant @@ -133,89 +134,52 @@ #ifndef SRC_SENSORS_ANALOGELECCONDUCTIVITY_H_ #define SRC_SENSORS_ANALOGELECCONDUCTIVITY_H_ +// Debugging Statement +// #define MS_ANALOGELECCONDUCTIVITY_DEBUG +// #define MS_ANALOGELECCONDUCTIVITY_DEBUG_DEEP + #ifdef MS_ANALOGELECCONDUCTIVITY_DEBUG #define MS_DEBUGGING_STD "AnalogElecConductivity" #endif #ifdef MS_ANALOGELECCONDUCTIVITY_DEBUG_DEEP #define MS_DEBUGGING_DEEP "AnalogElecConductivity" #endif + // Included Dependencies #include "ModSensorDebugger.h" #undef MS_DEBUGGING_STD #undef MS_DEBUGGING_DEEP -#include "SensorBase.h" #include "VariableBase.h" +#include "SensorBase.h" #include "math.h" /** @ingroup sensor_analog_cond */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_analog_cond_parts_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by 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 - +/// @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 - -/** - * @anchor sensor_analog_cond_parts_timing - * @name Sensor Timing - * The timing for analog conductivity via resistance. - */ -/**@{*/ -/// @brief Sensor::_warmUpTime_ms; giving 2ms for warm-up. -#define ANALOGELECCONDUCTIVITY_WARM_UP_TIME_MS 2 -/// @brief Sensor::_stabilizationTime_ms; we give just a tiny delay for -/// stabilization. -#define ANALOGELECCONDUCTIVITY_STABILIZATION_TIME_MS 1 -/** - * @brief Sensor::_measurementTime_ms; we assume the analog voltage is measured - * instantly. - * - * It's not really *quite* instantly, but it is very fast and the time to - * measure is included in the read function. - * On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 - * microseconds (0.0001 s) to read an analog input, so the maximum reading rate - * is about 10,000 times a second. - */ -#define ANALOGELECCONDUCTIVITY_MEASUREMENT_TIME_MS 0 /**@}*/ - /** - * @anchor sensor_analog_cond_parts_ec - * @name Electrical Conductance - * The humidity variable from an AOSong DHT - * - Range: low 100's when open air, for short circuit: a high number - * - Accuracy: needs determining for each combination of ADC. ADC_REF, and - * series R. its designed as a very simple relative EC measurement - * - * {{ @ref AnalogElecConductivity_EC::AnalogElecConductivity_EC }} + * @anchor sensor_analog_cond_parts_config + * @name Configuration Defines + * Defines to help configure the range and resolution of the home-made + * conductivity sensor depending on the processor and ADC in use. */ /**@{*/ -/** - * @brief Decimals places in string representation; EC should have 1 - * - * Range of 0-3V3 with 10bit ADC - resolution of 0.003 = 3 µS/cm. - */ -#define ANALOGELECCONDUCTIVITY_EC_RESOLUTION 1 -/// @brief Sensor vensor variable number; EC is stored in sensorValues[0]. -#define ANALOGELECCONDUCTIVITY_EC_VAR_NUM 0 -/// @brief Variable name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/variablename/); -/// "electricalConductivity" -#define ANALOGELECCONDUCTIVITY_EC_VAR_NAME "electricalConductivity" -/// @brief Variable unit name in -/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); -/// "microsiemenPerCentimeter" (µS/cm) -#define ANALOGELECCONDUCTIVITY_EC_UNIT_NAME "microsiemenPerCentimeter" -/// @brief Default variable short code; "anlgEc" -#define ANALOGELECCONDUCTIVITY_EC_DEFAULT_CODE "anlgEc" -/**@}*/ - -#if !defined ANALOG_EC_ADC_RESOLUTION +#if !defined(ANALOG_EC_ADC_RESOLUTION) || defined(DOXYGEN) /** * @brief Default resolution (in bits) of the voltage measurement * @@ -232,8 +196,8 @@ #define ANALOG_EC_ADC_RANGE (1 << ANALOG_EC_ADC_RESOLUTION) /* clang-format off */ -#if !defined ANALOG_EC_ADC_REFERENCE_MODE -#if defined (ARDUINO_ARCH_AVR) || defined (DOXYGEN) +#if ! defined (ANALOG_EC_ADC_REFERENCE_MODE) || defined (DOXYGEN) +#if defined(ARDUINO_ARCH_AVR) || defined (DOXYGEN) /** * @brief The voltage reference mode for the processor's ADC. * @@ -255,7 +219,7 @@ */ #define ANALOG_EC_ADC_REFERENCE_MODE DEFAULT #endif -#if defined (ARDUINO_ARCH_SAMD) || defined (DOXYGEN) +#if defined(ARDUINO_ARCH_SAMD) || defined (DOXYGEN) /** * @brief The voltage reference mode for the processor's ADC. * @@ -276,13 +240,13 @@ */ #define ANALOG_EC_ADC_REFERENCE_MODE AR_DEFAULT #endif -#if !defined ANALOG_EC_ADC_REFERENCE_MODE +#if ! defined (ANALOG_EC_ADC_REFERENCE_MODE) #error The processor ADC reference type must be defined! #endif // ANALOG_EC_ADC_REFERENCE_MODE #endif // ARDUINO_ARCH_SAMD /* clang-format on */ -#if !defined RSERIES_OHMS_DEF +#if !defined(RSERIES_OHMS_DEF) || defined(DOXYGEN) /** * @brief The default resistance (in ohms) of the measuring resistor. * This should not be less than 300 ohms when measuring EC in water. @@ -290,7 +254,7 @@ #define RSERIES_OHMS_DEF 499 #endif // RSERIES_OHMS_DEF -#if !defined SENSOREC_KONST_DEF +#if !defined(SENSOREC_KONST_DEF) || defined(DOXYGEN) /** * @brief Cell Constant For EC Measurements. * @@ -304,9 +268,62 @@ */ #define SENSOREC_KONST_DEF 1.0 #endif // SENSOREC_KONST_DEF +/**@}*/ + +/** + * @anchor sensor_analog_cond_parts_timing + * @name Sensor Timing + * The timing for analog conductivity via resistance. + */ +/**@{*/ +/// @brief Sensor::_warmUpTime_ms; giving 2ms for warm-up. +#define ANALOGELECCONDUCTIVITY_WARM_UP_TIME_MS 2 +/// @brief Sensor::_stabilizationTime_ms; we give just a tiny delay for +/// stabilization. +#define ANALOGELECCONDUCTIVITY_STABILIZATION_TIME_MS 1 +/** + * @brief Sensor::_measurementTime_ms; we assume the analog voltage is measured + * instantly. + * + * It's not really *quite* instantly, but it is very fast and the time to + * measure is included in the read function. + * On ATmega based boards (UNO, Nano, Mini, Mega), it takes about 100 + * microseconds (0.0001 s) to read an analog input, so the maximum reading rate + * is about 10,000 times a second. + */ +#define ANALOGELECCONDUCTIVITY_MEASUREMENT_TIME_MS 0 +/**@}*/ +/** + * @anchor sensor_analog_cond_parts_ec + * @name Electrical Conductance + * The electrical conductance variable from a home-made analog sensor. + * + * {{ @ref AnalogElecConductivity_EC::AnalogElecConductivity_EC }} + */ +/**@{*/ +/** + * @brief Decimals places in string representation; EC should have 1 + * + * Range of 0-3V3 with 10bit ADC - resolution of 0.003 = 3 µS/cm. + */ +#define ANALOGELECCONDUCTIVITY_EC_RESOLUTION 1 +/// @brief Sensor variable number; EC is stored in sensorValues[0]. +#define ANALOGELECCONDUCTIVITY_EC_VAR_NUM 0 +/// @brief Variable name in [ODM2 controlled +/// vocabulary](http://vocabulary.odm2.org/variablename/); +/// "electricalConductivity" +#define ANALOGELECCONDUCTIVITY_EC_VAR_NAME "electricalConductivity" +/// @brief Variable unit name in +/// [ODM2 controlled vocabulary](http://vocabulary.odm2.org/units/); +/// "microsiemenPerCentimeter" (µS/cm) +#define ANALOGELECCONDUCTIVITY_EC_UNIT_NAME "microsiemenPerCentimeter" +/// @brief Default variable short code; "anlgEc" +#define ANALOGELECCONDUCTIVITY_EC_DEFAULT_CODE "anlgEc" +/**@}*/ /** - * @brief Class for the analog Electrical Conductivity monitor + * @brief Class for the analog [Electrical Conductivity monitor](@ref + * sensor_analog_cond) * * @ingroup sensor_analog_cond */ @@ -342,7 +359,7 @@ class AnalogElecConductivity : public Sensor { /** * @brief Report the sensor info. * - * @return **String** Text describing how the sensor is attached to the mcu. + * @return Text describing how the sensor is attached to the mcu. */ String getSensorLocation(void) override; @@ -381,11 +398,6 @@ class AnalogElecConductivity : public Sensor { float readEC(uint8_t analogPinNum); private: - int8_t _EcPowerPin; - int8_t _EcAdcPin; - - float* _ptrWaterTemperature_C; - /// @brief The resistance of the circiut resistor plus any series port /// resistance float _Rseries_ohms = RSERIES_OHMS_DEF; @@ -395,11 +407,10 @@ class AnalogElecConductivity : public Sensor { }; /** - * @brief The variable class used for electricalConductivity measured using an - * analog pin connected to electrodes submerged in the medium + * @brief The Variable sub-class used for electrical conductivity measured using + * an analog pin connected to electrodes submerged in the medium * * @ingroup sensor_analog_cond - * */ class AnalogElecConductivity_EC : public Variable { public: diff --git a/src/sensors/ApogeeSQ212.h b/src/sensors/ApogeeSQ212.h index c2b4d3c24..f657013fd 100644 --- a/src/sensors/ApogeeSQ212.h +++ b/src/sensors/ApogeeSQ212.h @@ -92,12 +92,37 @@ /** @ingroup sensor_sq212 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_sq212_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Apogee SQ-212 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the SQ212 can report 2 values, raw /// voltage and calculated PAR. #define SQ212_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; PAR is calculated from the raw voltage. #define SQ212_INC_CALC_VARIABLES 1 +/**@}*/ + +/** + * @anchor sensor_sq212_config + * @name Configuration Defines + * Defines to set the calibration of the SQ-212 and the address of the ADD. + */ +/**@{*/ +#if !defined(SQ212_CALIBRATION_FACTOR) || defined(DOXYGEN) +/** + * @brief The calibration factor between output in volts and PAR + * (microeinsteinPerSquareMeterPerSecond) 1 µmol mˉ² sˉ¹ per mV (reciprocal of + * sensitivity) + */ +#define SQ212_CALIBRATION_FACTOR 1 +#endif + +/// The assumed address of the ADS1115, 1001 000 (ADDR = GND) +#define ADS1115_ADDRESS 0x48 +/**@}*/ /** * @anchor sensor_sq212_timing @@ -141,6 +166,15 @@ * {{ @ref ApogeeSQ212_PAR }} */ /**@{*/ +#ifdef MS_USE_ADS1015 +/// @brief Decimals places in string representation; PAR should have 0 when +/// using an ADS1015. +#define SQ212_PAR_RESOLUTION 0 +#else +/// @brief Decimals places in string representation; PAR should have 4 when +/// using an ADS1115. +#define SQ212_PAR_RESOLUTION 4 +#endif /// Variable number; PAR is stored in sensorValues[0]. #define SQ212_PAR_VAR_NUM 0 /// @brief Variable name in [ODM2 controlled @@ -153,15 +187,6 @@ #define SQ212_PAR_UNIT_NAME "microeinsteinPerSquareMeterPerSecond" /// @brief Default variable short code; "photosyntheticallyActiveRadiation" #define SQ212_PAR_DEFAULT_CODE "photosyntheticallyActiveRadiation" -#ifdef MS_USE_ADS1015 -/// @brief Decimals places in string representation; PAR should have 0 when -/// using an ADS1015. -#define SQ212_PAR_RESOLUTION 0 -#else -/// @brief Decimals places in string representation; PAR should have 4 when -/// using an ADS1115. -#define SQ212_PAR_RESOLUTION 4 -#endif /**@}*/ /** @@ -203,18 +228,6 @@ #endif /**@}*/ -/** - * @brief The calibration factor between output in volts and PAR - * (microeinsteinPerSquareMeterPerSecond) 1 µmol mˉ² sˉ¹ per mV (reciprocal of - * sensitivity) - */ -#ifndef SQ212_CALIBRATION_FACTOR -#define SQ212_CALIBRATION_FACTOR 1 -#endif - -/// The assumed address of the ADS1115, 1001 000 (ADDR = GND) -#define ADS1115_ADDRESS 0x48 - /** * @brief The Sensor sub-class for the [Apogee SQ-212](@ref sensor_sq212) sensor * @@ -257,7 +270,7 @@ class ApogeeSQ212 : public Sensor { * @brief Report the I1C address of the ADS and the channel that the SQ-212 * is attached to. * - * @return **String** Text describing how the sensor is attached to the mcu. + * @return Text describing how the sensor is attached to the mcu. */ String getSensorLocation(void) override; @@ -267,7 +280,13 @@ class ApogeeSQ212 : public Sensor { bool addSingleMeasurementResult(void) override; private: + /** + * @brief Internal reference to the ADS channel number of the Apogee SQ-212 + */ uint8_t _adsChannel; + /** + * @brief Internal reference to the I2C address of the TI-ADS1x15 + */ uint8_t _i2cAddress; }; diff --git a/src/sensors/AtlasParent.h b/src/sensors/AtlasParent.h index e872f3204..1c3a8e129 100644 --- a/src/sensors/AtlasParent.h +++ b/src/sensors/AtlasParent.h @@ -172,7 +172,7 @@ class AtlasParent : public Sensor { /** * @brief Return the I2C address of the EZO circuit. * - * @return **String** Text describing how the sensor is attached to the mcu. + * @return Text describing how the sensor is attached to the mcu. */ String getSensorLocation(void) override; @@ -184,7 +184,7 @@ class AtlasParent : public Sensor { * and modes for I2C), and updates the #_sensorStatus. No sensor power is * required. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; @@ -199,7 +199,7 @@ class AtlasParent : public Sensor { * This also un-sets the #_millisSensorActivated timestamp (sets it to 0). * This does NOT power down the sensor! * - * @return **bool** True if the sleep function completed successfully. + * @return True if the sleep function completed successfully. */ bool sleep(void) override; @@ -211,7 +211,7 @@ class AtlasParent : public Sensor { * @note This function does NOT include any waiting for the sensor to be * warmed up or stable! * - * @return **bool** True if the start measurement function completed + * @return True if the start measurement function completed * successfully. */ bool startSingleMeasurement(void) override; @@ -243,7 +243,7 @@ class AtlasParent : public Sensor { * unavailable. * * @param timeout The maximum amout of time to wait in ms. - * @return **bool** True processing completed and a status code was returned + * @return True processing completed and a status code was returned * within the wait period. */ bool waitForProcessing(uint32_t timeout = 1000L); diff --git a/src/sensors/AtlasScientificCO2.h b/src/sensors/AtlasScientificCO2.h index fdaa99cea..4241cc6a6 100644 --- a/src/sensors/AtlasScientificCO2.h +++ b/src/sensors/AtlasScientificCO2.h @@ -63,17 +63,30 @@ #include "VariableBase.h" #include "sensors/AtlasParent.h" -// Sensor Specific Defines /** @ingroup sensor_atlas_co2 */ /**@{*/ -/// Default I2C address is 0x69 (105) -#define ATLAS_CO2_I2C_ADDR 0x69 // 105 - +/** + * @anchor sensor_atlas_co2_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Atlas CO2 sensor + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Atlas CO2 sensor can report 2 values. #define ATLAS_CO2_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define ATLAS_CO2_INC_CALC_VARIABLES 0 +/**@}*/ + +/** + * @anchor sensor_atlas_co2_config + * @name Configuration Defines + * Defines to configure and set the address of the Atlas CO2 sensor + */ +/**@{*/ +/// @brief The default I2C address of the Atlas CO2 sensor is 0x69 (105) +#define ATLAS_CO2_I2C_ADDR 0x69 +/**@}*/ /** * @anchor sensor_atlas_co2_timing @@ -221,7 +234,7 @@ class AtlasScientificCO2 : public AtlasParent { * circuit to report all possible measurement parameters, and sets the * status bit if successful. The circuit must be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; }; diff --git a/src/sensors/AtlasScientificDO.h b/src/sensors/AtlasScientificDO.h index 3cafe86c9..0c037a3ae 100644 --- a/src/sensors/AtlasScientificDO.h +++ b/src/sensors/AtlasScientificDO.h @@ -62,20 +62,31 @@ #include "VariableBase.h" #include "sensors/AtlasParent.h" -/** - * @brief Default I2C address is 0x61 (97) - */ -#define ATLAS_DO_I2C_ADDR 0x61 - /** @ingroup sensor_atlas_do */ /**@{*/ -// Sensor Specific Defines -/// @brief Sensor::_numReturnedValues; the Atlas DO sensor can report 2 values. +/** + * @anchor sensor_atlas_do_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Atlas DO sensor + */ +/**@{*/ +/// @brief Sensor::_numReturnedValues; the Atlas EZO DO circuit can report 2 +/// values. #define ATLAS_DO_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define ATLAS_DO_INC_CALC_VARIABLES 0 +/**@}*/ +/** + * @anchor sensor_atlas_do_config + * @name Configuration Defines + * Defines to configure and set the address of the Atlas DO sensor + */ +/**@{*/ +/// @brief The default I2C address of the Atlas DO sensor is 0x61 (97) +#define ATLAS_DO_I2C_ADDR 0x61 +/**@}*/ /** * @anchor sensor_atlas_do_timing @@ -231,7 +242,7 @@ class AtlasScientificDO : public AtlasParent { * circuit to report all possible measurement parameters, and sets the * status bit if successful. The circuit must be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; }; diff --git a/src/sensors/AtlasScientificEC.h b/src/sensors/AtlasScientificEC.h index 9908c810f..67203c2da 100644 --- a/src/sensors/AtlasScientificEC.h +++ b/src/sensors/AtlasScientificEC.h @@ -70,13 +70,15 @@ #include "VariableBase.h" #include "sensors/AtlasParent.h" - -// Sensor Specific Defines /** @ingroup sensor_atlas_cond */ /**@{*/ -/// @brief Default I2C address is 0x64 (100) -#define ATLAS_COND_I2C_ADDR 0x64 +/** + * @anchor sensor_atlas_cond_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Atlas conductivity sensor + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; Atlas EZO conductivity circuit can report /// 4 values. #define ATLAS_COND_NUM_VARIABLES 4 @@ -84,7 +86,19 @@ /// though we recommend users include a temperature sensor and calculate /// specific conductance in their own program. #define ATLAS_COND_INC_CALC_VARIABLES 0 +/**@}*/ +/** + * @anchor sensor_atlas_cond_config + * @name Configuration Defines + * Defines to configure and set the address of the Atlas conductivity + * sensor + */ +/**@{*/ +/// @brief The default I2C address of the Atlas conductivity sensor is 0x64 +/// (100) +#define ATLAS_COND_I2C_ADDR 0x64 +/**@}*/ /** * @anchor sensor_atlas_cond_timing @@ -291,7 +305,7 @@ class AtlasScientificEC : public AtlasParent { * circuit to report all possible measurement parameters, and sets the * status bit if successful. The circuit must be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; }; diff --git a/src/sensors/AtlasScientificORP.h b/src/sensors/AtlasScientificORP.h index e722dfc38..260eed1ce 100644 --- a/src/sensors/AtlasScientificORP.h +++ b/src/sensors/AtlasScientificORP.h @@ -46,19 +46,31 @@ // Included Dependencies #include "sensors/AtlasParent.h" - -// Sensor Specific Defines /** @ingroup sensor_atlas_orp */ /**@{*/ -/// @brief Default I2C address is 0x62 (98) -#define ATLAS_ORP_I2C_ADDR 0x62 - +/** + * @anchor sensor_atlas_orp_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Atlas ORP sensor + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Atlas EZO ORP circuit can report 1 /// value. #define ATLAS_ORP_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define ATLAS_ORP_INC_CALC_VARIABLES 0 +/**@}*/ + +/** + * @anchor sensor_atlas_orp_config + * @name Configuration Defines + * Defines to configure and set the address of the Atlas ORP sensor + */ +/**@{*/ +/// @brief The default I2C address of the Atlas ORP sensor is 0x62 (98) +#define ATLAS_ORP_I2C_ADDR 0x62 +/**@}*/ /** * @anchor sensor_atlas_orp_timing diff --git a/src/sensors/AtlasScientificRTD.h b/src/sensors/AtlasScientificRTD.h index b9b20b066..c2793f0ca 100644 --- a/src/sensors/AtlasScientificRTD.h +++ b/src/sensors/AtlasScientificRTD.h @@ -51,23 +51,33 @@ // Included Dependencies #include "sensors/AtlasParent.h" - -/** - * @brief Default I2C address is 0x66 (102) - */ -#define ATLAS_RTD_I2C_ADDR 0x66 - -// Sensor Specific Defines /** @ingroup sensor_atlas_rtd */ /**@{*/ + /** - * @brief Sensor::_numReturnedValues; the Atlas EZO temperature circuit can - * report 1 value. + * @anchor sensor_atlas_rtd_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Atlas RTD (temperature) + * sensor */ +/**@{*/ +/// @brief Sensor::_numReturnedValues; the Atlas EZO temperature circuit can +/// report 1 value. #define ATLAS_RTD_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define ATLAS_RTD_INC_CALC_VARIABLES 0 +/**@}*/ +/** + * @anchor sensor_atlas_rtd_config + * @name Configuration Defines + * Defines to configure and set the address of the Atlas RTD (temperature) + * sensor + */ +/**@{*/ +/// @brief The default I2C address of the Atlas RTD sensor is 0x66 (102) +#define ATLAS_RTD_I2C_ADDR 0x66 +/**@}*/ /** * @anchor sensor_atlas_rtd_timing diff --git a/src/sensors/AtlasScientificpH.h b/src/sensors/AtlasScientificpH.h index c2d198445..017a4a7e7 100644 --- a/src/sensors/AtlasScientificpH.h +++ b/src/sensors/AtlasScientificpH.h @@ -48,18 +48,31 @@ // Included Dependencies #include "sensors/AtlasParent.h" - -// Sensor Specific Defines /** @ingroup sensor_atlas_ph */ /**@{*/ -/// @brief Default I2C address is 0x63 (99) -#define ATLAS_PH_I2C_ADDR 0x63 +/** + * @anchor sensor_atlas_ph_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Atlas pH sensor + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Atlas EZO pH circuit can report 1 /// value. #define ATLAS_PH_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define ATLAS_PH_INC_CALC_VARIABLES 0 +/**@}*/ + +/** + * @anchor sensor_atlas_ph_config + * @name Configuration Defines + * Defines to configure and set the address of the Atlas pH sensor + */ +/**@{*/ +/// @brief The default I2C address of the Atlas pH sensor is 0x63 (99) +#define ATLAS_PH_I2C_ADDR 0x63 +/**@}*/ /** * @anchor sensor_atlas_ph_timing diff --git a/src/sensors/BoschBME280.h b/src/sensors/BoschBME280.h index 6edd6ac26..5da283c12 100644 --- a/src/sensors/BoschBME280.h +++ b/src/sensors/BoschBME280.h @@ -105,12 +105,31 @@ /** @ingroup sensor_bme280 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_bme280_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the BME280 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the BME280 can report 4 values. #define BME280_NUM_VARIABLES 4 /// @brief Sensor::_incCalcValues; altitude is calculted within the Adafruit /// library. #define BME280_INC_CALC_VARIABLES 1 +/**@}*/ + +/** + * @anchor sensor_bme280_config + * @name Configuration Defines + * Defines to set the calibration of the calculated base pressure used to + * calculate altitude by the BME280. + */ +/**@{*/ +#if !defined(SEALEVELPRESSURE_HPA) || defined(DOXYGEN) +/// The atmospheric pressure at sea level +#define SEALEVELPRESSURE_HPA (1013.25) +#endif +/**@}*/ /** * @anchor sensor_bme280_timing @@ -243,11 +262,6 @@ #define BME280_ALTITUDE_DEFAULT_CODE "BoschBME280Altitude" /**@}*/ -/// 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 BME280](@ref sensor_bme280). @@ -308,7 +322,7 @@ class BoschBME280 : public Sensor { * * @note This does NOT include any wait for sensor readiness. * - * @return **bool** True if the wake function completed successfully. + * @return True if the wake function completed successfully. */ bool wake(void) override; /** @@ -319,7 +333,7 @@ class BoschBME280 : public Sensor { * calibration coefficients from the BME280, and updates the #_sensorStatus. * The BME280 must be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** diff --git a/src/sensors/BoschBMP3xx.h b/src/sensors/BoschBMP3xx.h index 9f7899d61..6ab004346 100644 --- a/src/sensors/BoschBMP3xx.h +++ b/src/sensors/BoschBMP3xx.h @@ -149,12 +149,31 @@ /** @ingroup sensor_bmp3xx */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_bmp3xx_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by Bosch BMP3xx + */ +/**@{*/ /// @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_bme3xx_config + * @name Configuration Defines + * Defines to set the calibration of the calculated base pressure used to + * calculate altitude by the BME3xx. + */ +/**@{*/ +#if !defined(SEALEVELPRESSURE_HPA) || defined(DOXYGEN) +/// The atmospheric pressure at sea level +#define SEALEVELPRESSURE_HPA (1013.25) +#endif +/**@}*/ /** * @anchor sensor_bmp3xx_timing @@ -303,11 +322,6 @@ #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). @@ -429,7 +443,7 @@ class BoschBMP3xx : public Sensor { * * @note This does NOT include any wait for sensor readiness. * - * @return **bool** True if the wake function completed successfully. + * @return True if the wake function completed successfully. */ bool wake(void) override; /** @@ -440,7 +454,7 @@ class BoschBMP3xx : public Sensor { * calibration coefficients from the BMP3xx, and updates the #_sensorStatus. * The BMP3xx must be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** diff --git a/src/sensors/CampbellClariVUE10.h b/src/sensors/CampbellClariVUE10.h index 3b6012221..ee9b8b865 100644 --- a/src/sensors/CampbellClariVUE10.h +++ b/src/sensors/CampbellClariVUE10.h @@ -67,13 +67,19 @@ /** @ingroup sensor_clarivue */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_clarivue_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the ClariVUE10 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the ClariVUE10 can report 7 values /// (although we only keep 3). #define CLARIVUE10_NUM_VARIABLES 7 /// @brief Sensor::_incCalcValues; The ClariVUE calculates averages and other /// stats on board, but we don't calculate any additional values. #define CLARIVUE10_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_clarivue_timing diff --git a/src/sensors/CampbellOBS3.h b/src/sensors/CampbellOBS3.h index bfe92c782..d93af4c8d 100644 --- a/src/sensors/CampbellOBS3.h +++ b/src/sensors/CampbellOBS3.h @@ -82,9 +82,15 @@ #include "VariableBase.h" #include "SensorBase.h" -// Sensor Specific Defines /** @ingroup sensor_obs3 */ /**@{*/ + +/** + * @anchor sensor_obs3_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by OBS3 + */ +/**@{*/ /** * @brief Sensor::_numReturnedValues; the OBS3 can report 2 values. * @@ -97,6 +103,17 @@ /// @brief Sensor::_incCalcValues; turbidity is calculated from raw voltage /// using the input calibration equation. #define OBS3_INC_CALC_VARIABLES 1 +/**@}*/ + +/** + * @anchor sensor_obs3_config + * @name Configuration Defines + * Defines to help configure the address of the ADD used by the Campbell OBS3+ + */ +/**@{*/ +/// @brief The assumed address of the ADS1115, 1001 000 (ADDR = GND) +#define ADS1115_ADDRESS 0x48 +/**@}*/ /** * @anchor sensor_obs3_timing @@ -205,9 +222,6 @@ #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 @@ -270,8 +284,17 @@ class CampbellOBS3 : public Sensor { bool addSingleMeasurementResult(void) override; private: + /** + * @brief Internal reference to the ADS channel number of the Campbell OBS + * 3+ + */ uint8_t _adsChannel; - float _x2_coeff_A, _x1_coeff_B, _x0_coeff_C; + float _x2_coeff_A; ///< Internal reference to the x^2 coefficient + float _x1_coeff_B; ///< Internal reference to the x coefficient + float _x0_coeff_C; ///< Internal reference to the x^0 coefficient + /** + * @brief Internal reference to the I2C address of the TI-ADS1x15 + */ uint8_t _i2cAddress; }; @@ -315,6 +338,9 @@ class CampbellOBS3_Turbidity : public Variable { : Variable((const uint8_t)OBS3_TURB_VAR_NUM, (uint8_t)OBS3_RESOLUTION, OBS3_TURB_VAR_NAME, OBS3_TURB_UNIT_NAME, OBS3_TURB_DEFAULT_CODE) {} + /** + * @brief Destroy the Campbell OBS3 Turbidity object + */ ~CampbellOBS3_Turbidity() {} }; diff --git a/src/sensors/CampbellRainVUE10.h b/src/sensors/CampbellRainVUE10.h index bbf8b938c..cbe552880 100644 --- a/src/sensors/CampbellRainVUE10.h +++ b/src/sensors/CampbellRainVUE10.h @@ -67,13 +67,19 @@ /** @ingroup sensor_rainvue */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_rainvue_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by RainVUE10 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the RainVUE10 can report 5 values /// (although we only keep 4). #define RAINVUE10_NUM_VARIABLES 5 /// @brief Sensor::_incCalcValues; The RainVUE calculates averages and other /// stats on board, but we don't calculate any additional values. #define RAINVUE10_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_rainvue_timing diff --git a/src/sensors/Decagon5TM.h b/src/sensors/Decagon5TM.h index fcee6d289..026345b6b 100644 --- a/src/sensors/Decagon5TM.h +++ b/src/sensors/Decagon5TM.h @@ -84,12 +84,18 @@ /** @ingroup sensor_fivetm */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_fivetm_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Decagon 5TM + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the 5TM can report 3 values. #define TM_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; volumetric water content is calculated from /// the permittivity and the temperature. #define TM_INC_CALC_VARIABLES 1 +/**@}*/ /** * @anchor sensor_fivetm_timing diff --git a/src/sensors/DecagonCTD.h b/src/sensors/DecagonCTD.h index 59efae7d3..fd5a05623 100644 --- a/src/sensors/DecagonCTD.h +++ b/src/sensors/DecagonCTD.h @@ -69,11 +69,17 @@ /** @ingroup sensor_decagon_ctd */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_decagon_ctd_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by Decagon CTD + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the CTD can report 3 values. #define CTD_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define CTD_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_decagon_ctd_timing diff --git a/src/sensors/DecagonES2.h b/src/sensors/DecagonES2.h index 956847ebd..fb038d0d0 100644 --- a/src/sensors/DecagonES2.h +++ b/src/sensors/DecagonES2.h @@ -64,11 +64,17 @@ /** @ingroup sensor_es2 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_es2_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by Decagon ES2 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the ES2 can report 2 values. #define ES2_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define ES2_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_es2_timing diff --git a/src/sensors/EverlightALSPT19.cpp b/src/sensors/EverlightALSPT19.cpp index 9f885f87f..3b3f43653 100644 --- a/src/sensors/EverlightALSPT19.cpp +++ b/src/sensors/EverlightALSPT19.cpp @@ -44,7 +44,7 @@ bool EverlightALSPT19::addSingleMeasurementResult(void) { if (bitRead(_sensorStatus, 6)) { // Set the resolution for the processor ADC, only applies to SAMD // boards. -#if !defined ARDUINO_ARCH_AVR +#if !defined(ARDUINO_ARCH_AVR) analogReadResolution(ALSPT19_ADC_RESOLUTION); #endif // ARDUINO_ARCH_AVR // Set the analog reference mode for the voltage measurement. @@ -73,7 +73,7 @@ bool EverlightALSPT19::addSingleMeasurementResult(void) { // 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 + // from sensor datasheet, typical 200µA current for 1000 Lux lux_val = current_val * (1000. / 200.); diff --git a/src/sensors/EverlightALSPT19.h b/src/sensors/EverlightALSPT19.h index 53508dd45..db59fa0e4 100644 --- a/src/sensors/EverlightALSPT19.h +++ b/src/sensors/EverlightALSPT19.h @@ -63,13 +63,27 @@ /** @ingroup sensor_alspt19 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_alspt19_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by an ALS-PT19 + */ +/**@{*/ /// @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 2 +/**@}*/ + +/** + * @anchor sensor_alspt19_mayfly + * @name Pin Definitions for the Mayfly + * Specific pin definitions for the ALS-PT19 built in to the EnviroDIY Mayfly + * v1.x + */ +/**@{*/ /// @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 @@ -78,8 +92,16 @@ #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 +/** + * @anchor sensor_alspt19_config + * @name Configuration Defines + * Defines to help configure the range and resolution of the ALS-PT119 depending + * on the processor and ADC in use. + */ +/**@{*/ +#if !defined(ALSPT19_ADC_RESOLUTION) || defined(DOXYGEN) /** * @brief Default resolution (in bits) of the voltage measurement * @@ -96,8 +118,8 @@ #define ALSPT19_ADC_RANGE (1 << ALSPT19_ADC_RESOLUTION) /* clang-format off */ -#if !defined ALSPT19_ADC_REFERENCE_MODE -#if defined (ARDUINO_ARCH_AVR) || defined (DOXYGEN) +#if ! defined (ALSPT19_ADC_REFERENCE_MODE) || defined (DOXYGEN) +#if defined(ARDUINO_ARCH_AVR) || defined (DOXYGEN) /** * @brief The voltage reference mode for the processor's ADC. * @@ -119,7 +141,7 @@ */ #define ALSPT19_ADC_REFERENCE_MODE DEFAULT #endif -#if defined (ARDUINO_ARCH_SAMD) || defined (DOXYGEN) +#if defined(ARDUINO_ARCH_SAMD) || defined (DOXYGEN) /** * @brief The voltage reference mode for the processor's ADC. * @@ -140,10 +162,11 @@ */ #define ALSPT19_ADC_REFERENCE_MODE AR_DEFAULT #endif -#if !defined ALSPT19_ADC_REFERENCE_MODE +#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 */ /** diff --git a/src/sensors/FreescaleMPL115A2.h b/src/sensors/FreescaleMPL115A2.h index 1a27efdfc..77ff5865b 100644 --- a/src/sensors/FreescaleMPL115A2.h +++ b/src/sensors/FreescaleMPL115A2.h @@ -80,11 +80,17 @@ /** @ingroup sensor_mpl115a2 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_mpl115a2_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the MPL115A2 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the MPL115A2 can report 2 values. #define MPL115A2_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define MPL115A2_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_mpl115a2_timing @@ -218,7 +224,7 @@ class FreescaleMPL115A2 : public Sensor { * powered for setup. This doesn't return anything to indicate failure or * success, we just have to hope it worked. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** diff --git a/src/sensors/GroPointGPLP8.h b/src/sensors/GroPointGPLP8.h index c73a34244..de925812e 100644 --- a/src/sensors/GroPointGPLP8.h +++ b/src/sensors/GroPointGPLP8.h @@ -56,11 +56,17 @@ /** @ingroup sensor_gplp8 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_gplp8_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by GPLP8 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the GPLP8 can report 8 values. #define GPLP8_NUM_VARIABLES 21 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define GPLP8_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_gplp8_timing diff --git a/src/sensors/GroPointParent.h b/src/sensors/GroPointParent.h index 8a27f0b59..235d432e7 100644 --- a/src/sensors/GroPointParent.h +++ b/src/sensors/GroPointParent.h @@ -165,7 +165,7 @@ class GroPointParent : public Sensor { * updates the #_sensorStatus. No sensor power is required. This will * always return true. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** @@ -177,7 +177,7 @@ class GroPointParent : public Sensor { * * @note This does NOT include any wait for sensor readiness. * - * @return **bool** True if the wake function completed successfully. + * @return True if the wake function completed successfully. */ bool wake(void) override; /** @@ -186,7 +186,7 @@ class GroPointParent : public Sensor { * This also un-sets the #_millisSensorActivated timestamp (sets it to 0). * This does NOT power down the sensor! * - * @return **bool** True if the sleep function completed successfully. + * @return True if the sleep function completed successfully. */ bool sleep(void) override; @@ -200,12 +200,33 @@ class GroPointParent : public Sensor { bool addSingleMeasurementResult(void) override; private: - gropoint _gsensor; + /** + * @brief Private reference to the gropoint class for communication with the + * GroPoint sensor. + */ + gropoint _gsensor; + /** + * @brief Private reference to the model of GroPoint sensor + */ gropointModel _model; - byte _modbusAddress; - Stream* _stream; - int8_t _RS485EnablePin; - int8_t _powerPin2; + /** + * @brief Private reference to the GroPoint sensor's modbus address + */ + byte _modbusAddress; + /** + * @brief Private reference to the stream for communciation with the + * GroPoint sensor. + */ + Stream* _stream; + /** + * @brief Private reference to the RS-485 adapter's flow direction control + * pin. + */ + int8_t _RS485EnablePin; + /** + * @brief Private reference to the power pin fro the RS-485 adapter. + */ + int8_t _powerPin2; }; #endif // SRC_SENSORS_GROPOINTPARENT_H_ diff --git a/src/sensors/InSituRDO.h b/src/sensors/InSituRDO.h index 09e43ba9e..227b596f8 100644 --- a/src/sensors/InSituRDO.h +++ b/src/sensors/InSituRDO.h @@ -159,10 +159,15 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_insitu_rdo */ /**@{*/ +/** + * @anchor sensor_insitu_rdo_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the RDO PRO-X + */ +/**@{*/ /** * @brief Sensor::_numReturnedValues; the RDO PRO-X can report 4 values. * @@ -173,6 +178,7 @@ #define INSITU_RDO_NUM_VARIABLES 4 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define INSITU_RDO_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_insitu_rdo_timing diff --git a/src/sensors/InSituTrollSdi12a.h b/src/sensors/InSituTrollSdi12a.h index b8031cd84..df585bd14 100644 --- a/src/sensors/InSituTrollSdi12a.h +++ b/src/sensors/InSituTrollSdi12a.h @@ -80,11 +80,20 @@ // Included Dependencies #include "sensors/SDI12Sensors.h" -// Sensor Specific Defines /** @ingroup sensor_insitu_troll */ /**@{*/ + +/** + * @anchor sensor_insitu_troll_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the TROLL 500 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the TROLL 500 can report 3 values. #define ITROLLA_NUM_VARIABLES 3 +/// @brief Sensor::_incCalcValues; we don't calculate any additional values. +#define ITROLLA_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_insitu_troll_timing @@ -240,12 +249,18 @@ class InSituTrollSdi12a : public SDI12Sensors { "InSituTrollSdi12a", ITROLLA_NUM_VARIABLES, ITROLLA_WARM_UP_TIME_MS, ITROLLA_STABILIZATION_TIME_MS, ITROLLA_MEASUREMENT_TIME_MS) {} + /** + * @copydoc InSituTrollSdi12a::InSituTrollSdi12a + */ 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) {} + /** + * @copydoc InSituTrollSdi12a::InSituTrollSdi12a + */ InSituTrollSdi12a(int SDI12address, int8_t powerPin, int8_t dataPin, uint8_t measurementsToAverage = 1) : SDI12Sensors(SDI12address, powerPin, dataPin, measurementsToAverage, diff --git a/src/sensors/KellerAcculevel.h b/src/sensors/KellerAcculevel.h index 45e81a439..080e7736a 100644 --- a/src/sensors/KellerAcculevel.h +++ b/src/sensors/KellerAcculevel.h @@ -54,7 +54,6 @@ // Included Dependencies #include "sensors/KellerParent.h" -// Sensor Specific Defines /** @ingroup sensor_acculevel */ /**@{*/ @@ -177,7 +176,9 @@ class KellerAcculevel : public KellerParent { measurementsToAverage, Acculevel_kellerModel, "KellerAcculevel", KELLER_NUM_VARIABLES, ACCULEVEL_WARM_UP_TIME_MS, ACCULEVEL_STABILIZATION_TIME_MS, ACCULEVEL_MEASUREMENT_TIME_MS) {} - // Destructor + /** + * @brief Destroy the Keller Acculevel object + */ ~KellerAcculevel() {} }; diff --git a/src/sensors/KellerNanolevel.h b/src/sensors/KellerNanolevel.h index bcffae086..9f7356e77 100644 --- a/src/sensors/KellerNanolevel.h +++ b/src/sensors/KellerNanolevel.h @@ -46,7 +46,6 @@ // Included Dependencies #include "sensors/KellerParent.h" -// Sensor Specific Defines /** @ingroup sensor_nanolevel */ /**@{*/ @@ -169,7 +168,9 @@ class KellerNanolevel : public KellerParent { measurementsToAverage, Nanolevel_kellerModel, "KellerNanolevel", KELLER_NUM_VARIABLES, NANOLEVEL_WARM_UP_TIME_MS, NANOLEVEL_STABILIZATION_TIME_MS, NANOLEVEL_MEASUREMENT_TIME_MS) {} - // Destructor + /** + * @brief Destroy the Keller Nanolevel object + */ ~KellerNanolevel() {} }; diff --git a/src/sensors/KellerParent.h b/src/sensors/KellerParent.h index 98e7c70b1..e6d924615 100644 --- a/src/sensors/KellerParent.h +++ b/src/sensors/KellerParent.h @@ -102,12 +102,18 @@ /** @ingroup keller_group */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor keller_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the RDO PRO-X + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Keller level sensors can report 3 /// values. #define KELLER_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define KELLER_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor keller_pressure @@ -236,7 +242,7 @@ class KellerParent : public Sensor { * updates the #_sensorStatus. No sensor power is required. This will * always return true. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; @@ -250,12 +256,33 @@ class KellerParent : public Sensor { bool addSingleMeasurementResult(void) override; private: - keller _ksensor; + /** + * @brief Private reference to the keller class for communication with the + * Keller sensor. + */ + keller _ksensor; + /** + * @brief Private reference to the model of Keller sensor + */ kellerModel _model; - byte _modbusAddress; - Stream* _stream; - int8_t _RS485EnablePin; - int8_t _powerPin2; + /** + * @brief Private reference to the Keller sensor's modbus address + */ + byte _modbusAddress; + /** + * @brief Private reference to the stream for communciation with the + * Keller sensor. + */ + Stream* _stream; + /** + * @brief Private reference to the RS-485 adapter's flow direction control + * pin. + */ + int8_t _RS485EnablePin; + /** + * @brief Private reference to the power pin fro the RS-485 adapter. + */ + int8_t _powerPin2; }; /**@}*/ #endif // SRC_SENSORS_KELLERPARENT_H_ diff --git a/src/sensors/MaxBotixSonar.cpp b/src/sensors/MaxBotixSonar.cpp index 84dfac7b8..477654714 100644 --- a/src/sensors/MaxBotixSonar.cpp +++ b/src/sensors/MaxBotixSonar.cpp @@ -12,19 +12,28 @@ MaxBotixSonar::MaxBotixSonar(Stream* stream, int8_t powerPin, int8_t triggerPin, - uint8_t measurementsToAverage) + int16_t maxRange, uint8_t measurementsToAverage, + bool convertCm) : Sensor("MaxBotixMaxSonar", HRXL_NUM_VARIABLES, HRXL_WARM_UP_TIME_MS, HRXL_STABILIZATION_TIME_MS, HRXL_MEASUREMENT_TIME_MS, powerPin, -1, measurementsToAverage), + _maxRange(maxRange), _triggerPin(triggerPin), + _convertCm(convertCm), _stream(stream) {} + + MaxBotixSonar::MaxBotixSonar(Stream& stream, int8_t powerPin, int8_t triggerPin, - uint8_t measurementsToAverage) + int16_t maxRange, uint8_t measurementsToAverage, + bool convertCm) : Sensor("MaxBotixMaxSonar", HRXL_NUM_VARIABLES, HRXL_WARM_UP_TIME_MS, HRXL_STABILIZATION_TIME_MS, HRXL_MEASUREMENT_TIME_MS, powerPin, -1, measurementsToAverage, HRXL_INC_CALC_VARIABLES), + _maxRange(maxRange), _triggerPin(triggerPin), + _convertCm(convertCm), _stream(&stream) {} + // Destructor MaxBotixSonar::~MaxBotixSonar() {} @@ -45,8 +54,8 @@ bool MaxBotixSonar::setup(void) { } // Set the stream timeout - // Even the slowest sensors should respond at a rate of 6Hz (166ms). - _stream->setTimeout(180); + // Even the slowest sensors should respond at a rate of 4Hz (250ms). + _stream->setTimeout(250); return Sensor::setup(); // this will set pin modes and the setup status bit } @@ -63,8 +72,12 @@ bool MaxBotixSonar::wake(void) { // ~160ms. Although we are waiting for them to complete in the // "waitForWarmUp" function, the values will still be in the serial buffer // and need to be read to be cleared out For an HRXL without temperature - // compensation, the headers are: HRXL-MaxSonar-WRL PN:MB7386 Copyright - // 2011-2013 MaxBotix Inc. RoHS 1.8b090 0713 TempI + // compensation, the headers are: + // HRXL-MaxSonar-WRL + // PN:MB7386 + // Copyright 2011-2013 MaxBotix Inc. + // RoHS 1.8b090 + // 0713 TempI // NOTE ALSO: Depending on what type of serial stream you are using, there // may also be a bunch of junk in the buffer that this will clear out. @@ -143,21 +156,19 @@ bool MaxBotixSonar::addSingleMeasurementResult(void) { MS_DBG(F(" Sonar Range:"), result); rangeAttempts++; - // If it cannot obtain a result , the sonar is supposed to send a - // value just above it's max range. For 10m models, this is 9999, - // for 5m models it's 4999. The sonar might also send readings of - // 300 or 500 (the blanking distance) if there are too many acoustic - // echos. If the result becomes garbled or the sonar is - // disconnected, the parseInt function returns 0. Luckily, these - // sensors are not capable of reading 0, so we also know the 0 value - // is bad. - if (result <= 300 || result == 500 || result == 4999 || - result == 9999 || result == 0) { + // If it cannot obtain a result, the sonar is supposed to send a + // value just above its max range. If the result becomes garbled or + // the sonar is disconnected, the parseInt function returns 0. + // Luckily, these sensors are not capable of reading 0, so we also + // know the 0 value is bad. + if (result <= 0 || result >= _maxRange) { MS_DBG(F(" Bad or Suspicious Result, Retry Attempt #"), rangeAttempts); result = -9999; } else { MS_DBG(F(" Good result found")); + // convert result from cm to mm if convertCm is set to true + if (_convertCm == true) { result *= 10; } success = true; } } diff --git a/src/sensors/MaxBotixSonar.h b/src/sensors/MaxBotixSonar.h index 8c0a43b06..84163d44f 100644 --- a/src/sensors/MaxBotixSonar.h +++ b/src/sensors/MaxBotixSonar.h @@ -116,11 +116,17 @@ /** @ingroup sensor_maxbotix */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_maxbotix_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by Maxbotix sonar + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the HRXL can report 1 value. #define HRXL_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define HRXL_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_maxbotix_timing @@ -129,27 +135,27 @@ */ /**@{*/ /// @brief Sensor::_warmUpTime_ms; warm up time to completion of header: 160ms. -#define HRXL_WARM_UP_TIME_MS 160 +#define HRXL_WARM_UP_TIME_MS 250 /// @brief Sensor::_stabilizationTime_ms; the HRXL is stable as soon as it warms /// up (0ms stabilization). #define HRXL_STABILIZATION_TIME_MS 0 /// @brief Sensor::_measurementTime_ms; the HRXL takes 166ms to complete a /// measurement. -#define HRXL_MEASUREMENT_TIME_MS 166 +#define HRXL_MEASUREMENT_TIME_MS 250 /**@}*/ /** * @anchor sensor_maxbotix_range * @name Range * The range variable from a Maxbotix HRXL ultrasonic range finder - * - Range is 300 to 5000mm or 500 to 9999mm, depending on model + * - Range depends on the exact model * - Accuracy is ±1% * * {{ @ref MaxBotixSonar_Range::MaxBotixSonar_Range }} */ /**@{*/ /// @brief Decimals places in string representation; range should have 0 - -/// resolution is 1mm. +/// resolution is 1mm (except for models which have range 10mm). #define HRXL_RESOLUTION 0 /// @brief Sensor variable number; range is stored in sensorValues[0]. #define HRXL_VAR_NUM 0 @@ -187,17 +193,23 @@ class MaxBotixSonar : public Sensor { * - The MaxSonar requires a 2.7V - 5.5V power supply. * @param triggerPin The pin on the mcu controlling the "trigger" for the * MaxSonar. Use -1 or omit for continuous ranging. + * @param maxRange Maximum valid measurement reported by the specific sensor + * model (e.g. 5000 or 9999 or 765). * @param measurementsToAverage The number of measurements to take and * average before giving a "final" result from the sensor; optional with a * default value of 1. + * @param convertCm Convert centimeter range data from certain models to + * millimeters. Default false. */ MaxBotixSonar(Stream* stream, int8_t powerPin, int8_t triggerPin = -1, - uint8_t measurementsToAverage = 1); + int16_t maxRange = 9999, uint8_t measurementsToAverage = 1, + bool convertCm = false); /** * @copydoc MaxBotixSonar::MaxBotixSonar */ MaxBotixSonar(Stream& stream, int8_t powerPin, int8_t triggerPin = -1, - uint8_t measurementsToAverage = 1); + int16_t maxRange = 9999, uint8_t measurementsToAverage = 1, + bool convertCm = false); /** * @brief Destroy the MaxBotix Sonar object */ @@ -216,7 +228,7 @@ class MaxBotixSonar : public Sensor { * timeout for modbus and updates the #_sensorStatus. No sensor power is * required. This will always return true. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** @@ -231,7 +243,7 @@ class MaxBotixSonar : public Sensor { * * @note This does NOT include any wait for sensor readiness. * - * @return **bool** True if the wake function completed successfully. + * @return True if the wake function completed successfully. */ bool wake(void) override; @@ -241,7 +253,17 @@ class MaxBotixSonar : public Sensor { bool addSingleMeasurementResult(void) override; private: - int8_t _triggerPin; + int16_t _maxRange; ///< The maximum range of the Maxbotix sonar + int8_t _triggerPin; ///< The pin to trigger the Maxbotix sonar + /** + * @brief True to convert the output from the Maxbotix from centimeters to + * millimeters. + */ + bool _convertCm; + /** + * @brief Private reference to the stream for communciation with the + * Maxbotix sensor. + */ Stream* _stream; }; diff --git a/src/sensors/MaximDS18.h b/src/sensors/MaximDS18.h index 09562d726..d3a6830b9 100644 --- a/src/sensors/MaximDS18.h +++ b/src/sensors/MaximDS18.h @@ -99,11 +99,17 @@ /** @ingroup sensor_ds18 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_ds18_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the DS18 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the DS18 can report 1 value. #define DS18_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define DS18_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_ds18_timing @@ -223,7 +229,7 @@ class MaximDS18 : public Sensor { * operating in ASYNC mode and updates the #_sensorStatus. The sensor must * be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** @@ -239,7 +245,7 @@ class MaximDS18 : public Sensor { * @note This function does NOT include any waiting for the sensor to be * warmed up or stable! * - * @return **bool** True if the start measurement function completed + * @return True if the start measurement function completed * successfully. successfully. */ bool startSingleMeasurement(void) override; @@ -249,15 +255,32 @@ class MaximDS18 : public Sensor { bool addSingleMeasurementResult(void) override; private: + /** + * @brief Internal reference to the OneWire device address. + * + */ DeviceAddress _OneWireAddress; - bool _addressKnown; - // Setup an internal OneWire instance to communicate with any OneWire - // devices (not just Maxim/Dallas temperature ICs) + /** + * @brief True to indicate that the address of the OneWire device was + * specified. If false, the first device to respond will be the one used. + */ + bool _addressKnown; + /** + * @brief An internal OneWire instance to communicate with any OneWire + * devices (not just Maxim/Dallas temperature ICs) + */ OneWire _internalOneWire; - // Set up the internal a "Dallas Temperature" instance for communication - // specifically with the temperature sensors. + /** + * @brief The internal "Dallas Temperature" instance for communication + * specifically with the temperature sensors. + */ DallasTemperature _internalDallasTemp; - // Turns the address into a printable string + /** + * @brief Turns the address into a printable string + * + * @param OneWireAddress The one wire address as a DeviceAddress object + * @return A pretty string version of the OneWire device address. + */ String makeAddressString(DeviceAddress OneWireAddress); }; diff --git a/src/sensors/MaximDS3231.h b/src/sensors/MaximDS3231.h index 42f0f9b98..bce87d6b5 100644 --- a/src/sensors/MaximDS3231.h +++ b/src/sensors/MaximDS3231.h @@ -75,11 +75,17 @@ /** @ingroup sensor_ds3231 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_ds3231_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the DS3231 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the DS3231 can report 1 value. #define DS3231_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define DS3231_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_ds3231_timing @@ -169,7 +175,7 @@ class MaximDS3231 : public Sensor { * the RTC. The clock should be continuously powered, so we never need to * worry about power up. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; @@ -181,7 +187,7 @@ class MaximDS3231 : public Sensor { * @note This function does NOT include any waiting for the sensor to be * warmed up or stable! * - * @return **bool** True if the start measurement function completed + * @return True if the start measurement function completed * successfully. successfully. */ bool startSingleMeasurement(void) override; diff --git a/src/sensors/MeaSpecMS5803.h b/src/sensors/MeaSpecMS5803.h index f8c764685..b2ddb35a4 100644 --- a/src/sensors/MeaSpecMS5803.h +++ b/src/sensors/MeaSpecMS5803.h @@ -95,11 +95,17 @@ /** @ingroup sensor_ms5803 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_ms5803_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the MS5803 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the MS5803 can report 2 values. #define MS5803_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define MS5803_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_ms5803_timing @@ -234,7 +240,7 @@ class MeaSpecMS5803 : public Sensor { * return anything to indicate failure or success, we just have to hope it * succeeded. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** diff --git a/src/sensors/MeterHydros21.h b/src/sensors/MeterHydros21.h index f66b8f926..709da4833 100644 --- a/src/sensors/MeterHydros21.h +++ b/src/sensors/MeterHydros21.h @@ -76,11 +76,17 @@ /** @ingroup sensor_hydros21 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_hydros21_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Meter Hydros 21 + */ +/**@{*/ /// @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. #define HYDROS21_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_hydros21_timing diff --git a/src/sensors/MeterTeros11.h b/src/sensors/MeterTeros11.h index 6f8b92361..6d38253df 100644 --- a/src/sensors/MeterTeros11.h +++ b/src/sensors/MeterTeros11.h @@ -94,13 +94,19 @@ /** @ingroup sensor_teros11 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_teros11_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by Meter Teros 11 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Teros 11 can report 2 raw values - /// counts and temperature. #define TEROS11_NUM_VARIABLES 4 /// @brief Sensor::_incCalcValues; We calculate permittivity and water content /// from the raw counts and temperature reported by the Teros 11. #define TEROS11_INC_CALC_VARIABLES 2 +/**@}*/ /** * @anchor sensor_teros11_timing diff --git a/src/sensors/PaleoTerraRedox.cpp b/src/sensors/PaleoTerraRedox.cpp index 12ea8cb07..922f68250 100644 --- a/src/sensors/PaleoTerraRedox.cpp +++ b/src/sensors/PaleoTerraRedox.cpp @@ -16,7 +16,7 @@ // Constructors -#if defined MS_PALEOTERRA_SOFTWAREWIRE +#if defined(MS_PALEOTERRA_SOFTWAREWIRE) PaleoTerraRedox::PaleoTerraRedox(SoftwareWire* theI2C, int8_t powerPin, uint8_t i2cAddressHex, uint8_t measurementsToAverage) @@ -57,7 +57,7 @@ PaleoTerraRedox::PaleoTerraRedox(int8_t powerPin, uint8_t i2cAddressHex, // Destructors -#if defined MS_PALEOTERRA_SOFTWAREWIRE +#if defined(MS_PALEOTERRA_SOFTWAREWIRE) // If we created a new SoftwareWire instance, we need to destroy it or // there will be a memory leak PaleoTerraRedox::~PaleoTerraRedox() { @@ -68,8 +68,8 @@ PaleoTerraRedox::~PaleoTerraRedox() {} #endif -String PaleoTerraRedox::getSensorLocation(void) { -#if defined MS_PALEOTERRA_SOFTWAREWIRE +String PaleoTerraRedox::getSensorLocation(void) { +#if defined(MS_PALEOTERRA_SOFTWAREWIRE) String address = F("SoftwareWire"); if (_dataPin >= 0) address += _dataPin; address += F("_0x"); diff --git a/src/sensors/PaleoTerraRedox.h b/src/sensors/PaleoTerraRedox.h index 6419bf0cc..43e3743b7 100644 --- a/src/sensors/PaleoTerraRedox.h +++ b/src/sensors/PaleoTerraRedox.h @@ -75,19 +75,35 @@ #include "SensorBase.h" #include -#if defined MS_PALEOTERRA_SOFTWAREWIRE +#if defined(MS_PALEOTERRA_SOFTWAREWIRE) #include // Testato's SoftwareWire #endif /** @ingroup sensor_pt_redox */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_pt_redox_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by PaleoTerra redox sensor + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the PaleoTerra redox sensor can report 1 /// value. #define PTR_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define PTR_INC_CALC_VARIABLES 0 +/**@}*/ + +/** + * @anchor sensor_pt_redox_config + * @name Configuration Defines + * Defines to set the address of the PaleoTerra redox sensor. + */ +/**@{*/ +/// @brief The default I2C address of the PaleoTerra redox sensor +#define MCP3421_ADR 0x68 +/**@}*/ /** * @anchor sensor_pt_redox_timing @@ -135,9 +151,6 @@ #define PTR_VOLTAGE_DEFAULT_CODE "PTRVoltage" /**@}*/ -/// @brief The default I2C address of the PaleoTerra redox sensor -#define MCP3421_ADR 0x68 - // The main class for the PaleoTerra Redox Sensor /* clang-format off */ /** @@ -241,7 +254,7 @@ class PaleoTerraRedox : public Sensor { * This 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. + * @return True if the setup was successful. */ bool setup(void) override; /** @@ -259,7 +272,7 @@ class PaleoTerraRedox : public Sensor { * @brief The I2C address of the redox sensor. */ uint8_t _i2cAddressHex; -#if defined MS_PALEOTERRA_SOFTWAREWIRE +#if defined(MS_PALEOTERRA_SOFTWAREWIRE) /** * @brief An internal reference to the SoftwareWire instance. */ diff --git a/src/sensors/ProcessorStats.cpp b/src/sensors/ProcessorStats.cpp index eb149027d..f649ebc92 100644 --- a/src/sensors/ProcessorStats.cpp +++ b/src/sensors/ProcessorStats.cpp @@ -21,7 +21,7 @@ ProcessorStats::ProcessorStats(const char* version) #elif defined(ARDUINO_AVR_FEATHER32U4) || defined(ARDUINO_SAMD_FEATHER_M0) || \ defined(SAMD_FEATHER_M0) || defined(ARDUINO_SAMD_FEATHER_M0_EXPRESS) || \ defined(SAMD_FEATHER_M0_EXPRESS) - _batteryPin = 9; + _batteryPin = 9; #elif defined(ARDUINO_SODAQ_ONE) || defined(ARDUINO_SODAQ_ONE_BETA) || \ defined(ARDUINO_AVR_SODAQ_NDOGO) _batteryPin = 10; @@ -108,7 +108,7 @@ bool ProcessorStats::addSingleMeasurementResult(void) { MS_DBG(F("Raw battery pin reading in bits:"), rawBattery); sensorValue_battery = (3.3 / 1023.) * 1.47 * rawBattery; MS_DBG(F("Battery in Volts:"), sensorValue_battery); - } +} #elif defined(ARDUINO_AVR_SODAQ_NDOGO) || defined(ARDUINO_SODAQ_AUTONOMO) || \ defined(ARDUINO_AVR_SODAQ_MBILI) @@ -140,7 +140,7 @@ bool ProcessorStats::addSingleMeasurementResult(void) { float sensorValue_freeRam = FreeRam(); #else - float sensorValue_freeRam = -9999; +float sensorValue_freeRam = -9999; #endif verifyAndAddMeasurementResult(PROCESSOR_RAM_VAR_NUM, sensorValue_freeRam); diff --git a/src/sensors/ProcessorStats.h b/src/sensors/ProcessorStats.h index ec9eb68d0..0271ac5cc 100644 --- a/src/sensors/ProcessorStats.h +++ b/src/sensors/ProcessorStats.h @@ -72,12 +72,17 @@ /** @ingroup sensor_processor */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_processor_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the main processor + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the processor can report 3 values. #define PROCESSOR_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; sample number is (sort-of) calculated. #define PROCESSOR_INC_CALC_VARIABLES 1 - +/**@}*/ /** * @anchor sensor_processor_sensor_timing @@ -319,9 +324,9 @@ class ProcessorStats : public Sensor { bool addSingleMeasurementResult(void) override; private: - const char* _version; - int8_t _batteryPin; - int16_t sampNum = 0; + const char* _version; ///< Internal reference to the board version + int8_t _batteryPin; ///< Internal reference to the battery pin + int16_t sampNum = 0; ///< The current sample number }; diff --git a/src/sensors/RainCounterI2C.cpp b/src/sensors/RainCounterI2C.cpp index b2777f1cf..0f62dc25c 100644 --- a/src/sensors/RainCounterI2C.cpp +++ b/src/sensors/RainCounterI2C.cpp @@ -13,7 +13,7 @@ // The constructors -#if defined MS_RAIN_SOFTWAREWIRE +#if defined(MS_RAIN_SOFTWAREWIRE) RainCounterI2C::RainCounterI2C(SoftwareWire* theI2C, uint8_t i2cAddressHex, float rainPerTip) : Sensor("RainCounterI2C", BUCKET_NUM_VARIABLES, BUCKET_WARM_UP_TIME_MS, @@ -52,7 +52,7 @@ RainCounterI2C::RainCounterI2C(uint8_t i2cAddressHex, float rainPerTip) // Destructors -#if defined MS_RAIN_SOFTWAREWIRE +#if defined(MS_RAIN_SOFTWAREWIRE) // If we created a new SoftwareWire instance, we need to destroy it or // there will be a memory leak RainCounterI2C::~RainCounterI2C() { @@ -63,8 +63,8 @@ RainCounterI2C::~RainCounterI2C() {} #endif -String RainCounterI2C::getSensorLocation(void) { -#if defined MS_RAIN_SOFTWAREWIRE +String RainCounterI2C::getSensorLocation(void) { +#if defined(MS_RAIN_SOFTWAREWIRE) String address = F("SoftwareWire"); if (_dataPin >= 0) address += _dataPin; address += F("_0x"); diff --git a/src/sensors/RainCounterI2C.h b/src/sensors/RainCounterI2C.h index 69034d88c..1114a12d8 100644 --- a/src/sensors/RainCounterI2C.h +++ b/src/sensors/RainCounterI2C.h @@ -85,20 +85,26 @@ #include "SensorBase.h" #include -#if defined MS_RAIN_SOFTWAREWIRE +#if defined(MS_RAIN_SOFTWAREWIRE) #include // Testato's SoftwareWire #endif /** @ingroup sensor_i2c_rain */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_i2c_rain_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the tipping bucket counter + */ +/**@{*/ /// @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. #define BUCKET_INC_CALC_VARIABLES 1 +/**@}*/ /** * @anchor sensor_i2c_rain_timing @@ -267,7 +273,7 @@ class RainCounterI2C : public Sensor { * This 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. + * @return True if the setup was successful. */ bool setup(void) override; /** diff --git a/src/sensors/SDI12Sensors.h b/src/sensors/SDI12Sensors.h index d779a8591..fbf17d09b 100644 --- a/src/sensors/SDI12Sensors.h +++ b/src/sensors/SDI12Sensors.h @@ -211,7 +211,7 @@ class SDI12Sensors : public Sensor { * sensor and calls the getSensorInfo() function. Sensor power **is** * required. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; @@ -226,7 +226,7 @@ class SDI12Sensors : public Sensor { * @note This function does NOT include any waiting for the sensor to be * warmed up or stable! * - * @return **bool** True if the start measurement function completed + * @return True if the start measurement function completed * successfully. */ bool startSingleMeasurement(void) override; @@ -241,7 +241,7 @@ class SDI12Sensors : public Sensor { * @brief Send the SDI-12 'acknowledge active' command [address][!] to a * sensor and confirm that the correct sensor responded. * - * @return **bool** True if the correct SDI-12 sensor replied to the + * @return True if the correct SDI-12 sensor replied to the * command. */ bool requestSensorAcknowledgement(void); @@ -249,7 +249,7 @@ class SDI12Sensors : public Sensor { * @brief Send the SDI-12 'info' command [address][I][!] to a sensor and * parse the result into the vendor, model, version, and serial number. * - * @return **bool** True if all expected information fields returned by the + * @return True if all expected information fields returned by the * sensor. */ bool getSensorInfo(void); @@ -264,14 +264,14 @@ class SDI12Sensors : public Sensor { * @param isConcurrent Whether to start a concurrent or standard * measurement. Defaults to 'true' for a concurrent measurement. * - * @return **int8_t** The length of time the measurement is expected to + * @return The length of time the measurement is expected to * take. */ int8_t startSDI12Measurement(bool isConcurrent = true); /** * @brief Gets the results of either a standard or a concurrent measurement * - * @return **bool** True if the full number of expected results was + * @return True if the full number of expected results was * returned. */ virtual bool getResults(void); @@ -290,10 +290,10 @@ class SDI12Sensors : public Sensor { int8_t _extraWakeTime; private: - String _sensorVendor; - String _sensorModel; - String _sensorVersion; - String _sensorSerialNumber; + String _sensorVendor; ///< The vendor (manufacturer) of the SDI-12 sensor + String _sensorModel; ///< The model of the SDI-12 sensor + String _sensorVersion; ///< The version of the SDI-12 sensor + String _sensorSerialNumber; ///< The serial number of the SDI-12 sensor }; #endif // SRC_SENSORS_SDI12SENSORS_H_ diff --git a/src/sensors/SensirionSHT4x.h b/src/sensors/SensirionSHT4x.h index 39e0e1e60..016a1acf9 100644 --- a/src/sensors/SensirionSHT4x.h +++ b/src/sensors/SensirionSHT4x.h @@ -82,11 +82,17 @@ /** @ingroup sensor_sht4x */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_sht4x_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the 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 @@ -245,7 +251,7 @@ class SensirionSHT4x : public Sensor { /** * @brief Report the I2C address of the SHT4x - which is always 0x44. * - * @return **String** Text describing how the sensor is attached to the mcu. + * @return Text describing how the sensor is attached to the mcu. */ String getSensorLocation(void) override; @@ -257,7 +263,7 @@ class SensirionSHT4x : public Sensor { * and modes for I2C), and updates the #_sensorStatus. No sensor power is * required. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; diff --git a/src/sensors/TIADS1x15.h b/src/sensors/TIADS1x15.h index cc13be6f7..44a3ade94 100644 --- a/src/sensors/TIADS1x15.h +++ b/src/sensors/TIADS1x15.h @@ -156,11 +156,27 @@ /** @ingroup sensor_ads1x15 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_ads1x15_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by ADS1x15 + */ +/**@{*/ /// @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_config + * @name Configuration Defines + * Defines to help configure the address of the ADD + */ +/**@{*/ +/// @brief The assumed address of the ADS1115, 1001 000 (ADDR = GND) +#define ADS1115_ADDRESS 0x48 +/**@}*/ /** * @anchor sensor_ads1x15_timing @@ -234,9 +250,6 @@ #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 @@ -287,8 +300,18 @@ class TIADS1x15 : public Sensor { bool addSingleMeasurementResult(void) override; private: + /** + * @brief Internal reference to the ADS channel number of the device + * attached to the TI-ADS1x15 + */ uint8_t _adsChannel; - float _gain; + /** + * @brief Internal reference to the gain setting for the TI-ADS1x15 + */ + float _gain; + /** + * @brief Internal reference to the I2C address of the TI-ADS1x15 + */ uint8_t _i2cAddress; }; diff --git a/src/sensors/TIINA219.h b/src/sensors/TIINA219.h index 0f0995030..60141e3ef 100644 --- a/src/sensors/TIINA219.h +++ b/src/sensors/TIINA219.h @@ -79,11 +79,27 @@ /** @ingroup sensor_ina219 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_ina219_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the INA219 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the INA219 can report 3 values. #define INA219_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define INA219_INC_CALC_VARIABLES 0 +/**@}*/ + +/** + * @anchor sensor_ina219_config + * @name Configuration Defines + * Defines to set the address of the INA219. + */ +/**@{*/ +/// @brief The default address of the INA219 +#define INA219_ADDRESS_BASE 0x40 +/**@}*/ /** * @anchor sensor_ina219_timing @@ -192,9 +208,6 @@ #define INA219_POWER_MW_DEFAULT_CODE "TIINA219Power" /**@}*/ -/// @brief The default address of the INA219 -#define INA219_ADDRESS_BASE 0x40 - /* clang-format off */ /** * @brief The Sensor sub-class for the @@ -257,7 +270,7 @@ class TIINA219 : public Sensor { * * @note This does NOT include any wait for sensor readiness. * - * @return **bool** True if the wake function completed successfully. + * @return True if the wake function completed successfully. */ bool wake(void) override; /** @@ -268,7 +281,7 @@ class TIINA219 : public Sensor { * and modes for I2C). This also sets the calibration range of the INA219, * and updates the #_sensorStatus. The INA219 must be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** diff --git a/src/sensors/TallyCounterI2C.h b/src/sensors/TallyCounterI2C.h index a42fd13f9..29e68001e 100644 --- a/src/sensors/TallyCounterI2C.h +++ b/src/sensors/TallyCounterI2C.h @@ -89,11 +89,27 @@ /** @ingroup sensor_tally */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_tally_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the Tally event counter + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Tally can report 1 value. #define TALLY_NUM_VARIABLES 1 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define TALLY_INC_CALC_VARIABLES 0 +/**@}*/ + +/** + * @anchor sensor_tally_config + * @name Configuration Defines + * Defines to set the address of the Tally event counter. + */ +/**@{*/ +/// @brief The default address of the Tally +#define TALLY_ADDRESS_BASE 0x33 +/**@}*/ /** * @anchor sensor_tally_timing @@ -140,9 +156,6 @@ #define TALLY_EVENTS_DEFAULT_CODE "TallyCounterI2CEvents" /**@}*/ -/// @brief The default address of the Tally -#define TALLY_ADDRESS_BASE 0x33 - /* clang-format off */ /** * @brief The Sensor sub-class for the @@ -193,7 +206,7 @@ class TallyCounterI2C : public Sensor { * #_sensorStatus. It also engages sleep mode on the Tally counter and * clears the counter memory. The Tally must be powered for setup. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** diff --git a/src/sensors/TurnerCyclops.h b/src/sensors/TurnerCyclops.h index 753e61433..b1396d3af 100644 --- a/src/sensors/TurnerCyclops.h +++ b/src/sensors/TurnerCyclops.h @@ -145,6 +145,13 @@ // Sensor Specific Defines /** @ingroup sensor_cyclops */ /**@{*/ + +/** + * @anchor sensor_cyclops_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by Cyclops + */ +/**@{*/ /** * @brief Sensor::_numReturnedValues; the Cyclops can report 2 values. * @@ -159,6 +166,17 @@ /// @brief Sensor::_incCalcValues; the raw voltage is reported, the other /// parameter is calculated using the input calibration equation. #define CYCLOPS_INC_CALC_VARIABLES 1 +/**@}*/ + +/** + * @anchor sensor_cyclops_config + * @name Configuration Defines + * Defines to help configure the address of the ADD used by the Cyclops + */ +/**@{*/ +/// @brief The assumed address of the ADS1115, 1001 000 (ADDR = GND) +#define ADS1115_ADDRESS 0x48 +/**@}*/ /** * @anchor sensor_cyclops_timing @@ -246,9 +264,6 @@ #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 @@ -329,8 +344,31 @@ class TurnerCyclops : public Sensor { bool addSingleMeasurementResult(void) override; private: + /** + * @brief Internal reference to the ADS channel number of the Turner Cyclops + */ uint8_t _adsChannel; - float _conc_std, _volt_std, _volt_blank; + /** + * @brief The concentration of the standard used for a 1-point sensor + * calibration. The concentration units should be the same as the final + * measuring units. + */ + float _conc_std; + /** + * @brief The voltage (in volts) measured for the conc_std. This voltage + * should be the final voltage *after* accounting for any voltage dividers + * or gain settings. + */ + float _volt_std; + /** + * @brief The voltage (in volts) measured for a blank. This voltage should + * be the final voltage *after* accounting for any voltage dividers or gain + * settings. + */ + float _volt_blank; + /** + * @brief Internal reference to the I2C address of the TI-ADS1x15 + */ uint8_t _i2cAddress; }; @@ -379,7 +417,7 @@ class TurnerCyclops_Voltage : public Variable { CYCLOPS_VOLTAGE_VAR_NAME, CYCLOPS_VOLTAGE_UNIT_NAME, CYCLOPS_VOLTAGE_DEFAULT_CODE) {} /** - * @brief Destroy the TurnerCyclops_Voltage object - no action needed. + * @brief Destroy the Turner Cyclops Voltage object - no action needed. */ ~TurnerCyclops_Voltage() {} }; @@ -435,6 +473,10 @@ class TurnerCyclops_Chlorophyll : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "chlorophyllFluorescence", "microgramPerLiter", "CyclopsChlorophyll") {} + /** + * @brief Destroy the Turner Cyclops Chlorophyll variable object - no action + * needed. + */ ~TurnerCyclops_Chlorophyll() {} }; @@ -488,6 +530,10 @@ class TurnerCyclops_Rhodamine : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "RhodamineFluorescence", "partPerBillion", "CyclopsRhodamine") {} + /** + * @brief Destroy the Turner Cyclops Rhodamine variable object - no action + * needed. + */ ~TurnerCyclops_Rhodamine() {} }; @@ -540,6 +586,10 @@ class TurnerCyclops_Fluorescein : public Variable { TurnerCyclops_Fluorescein() : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "fluorescein", "partPerBillion", "CyclopsFluorescein") {} + /** + * @brief Destroy the Turner Cyclops Fluorescein variable object - no action + * needed. + */ ~TurnerCyclops_Fluorescein() {} }; @@ -595,6 +645,10 @@ class TurnerCyclops_Phycocyanin : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "blue_GreenAlgae_Cyanobacteria_Phycocyanin", "partPerBillion", "CyclopsPhycocyanin") {} + /** + * @brief Destroy the Turner Cyclops Phycocyanin variable object - no action + * needed. + */ ~TurnerCyclops_Phycocyanin() {} }; @@ -648,6 +702,10 @@ class TurnerCyclops_Phycoerythrin : public Variable { TurnerCyclops_Phycoerythrin() : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "phycoerythrin", "partPerBillion", "CyclopsPhycoerythrin") {} + /** + * @brief Destroy the Turner Cyclops Phycoerythrin variable object - no + * action needed. + */ ~TurnerCyclops_Phycoerythrin() {} }; @@ -706,6 +764,10 @@ class TurnerCyclops_CDOM : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "fluorescenceDissolvedOrganicMatter", "partPerBillion", "CyclopsCDOM") {} + /** + * @brief Destroy the Turner Cyclops CDOM variable object - no action + * needed. + */ ~TurnerCyclops_CDOM() {} }; @@ -761,6 +823,10 @@ class TurnerCyclops_CrudeOil : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "petroleumHydrocarbonTotal", "partPerBillion", "CyclopsCrudeOil") {} + /** + * @brief Destroy the Turner Cyclops CrudeOil variable object - no action + * needed. + */ ~TurnerCyclops_CrudeOil() {} }; @@ -817,6 +883,9 @@ class TurnerCyclops_Brighteners : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "opticalBrighteners", "partPerBillion", "CyclopsOpticalBrighteners") {} + /** + * @brief Destroy the Turner Cyclops Brighteners object - no action needed. + */ ~TurnerCyclops_Brighteners() {} }; @@ -870,6 +939,10 @@ class TurnerCyclops_Turbidity : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "Turbidity", "nephelometricTurbidityUnit", "CyclopsTurbidity") {} + /** + * @brief Destroy the Turner Cyclops Turbidity variable object - no action + * needed. + */ ~TurnerCyclops_Turbidity() {} }; @@ -923,6 +996,10 @@ class TurnerCyclops_PTSA : public Variable { TurnerCyclops_PTSA() : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "ptsa", "partPerBillion", "CyclopsPTSA") {} + /** + * @brief Destroy the Turner Cyclops PTSA variable object - no action + * needed. + */ ~TurnerCyclops_PTSA() {} }; @@ -976,6 +1053,10 @@ class TurnerCyclops_BTEX : public Variable { TurnerCyclops_BTEX() : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "btex", "partPerMillion", "CyclopsBTEX") {} + /** + * @brief Destroy the Turner Cyclops BTEX variable object - no action + * needed. + */ ~TurnerCyclops_BTEX() {} }; @@ -1028,6 +1109,10 @@ class TurnerCyclops_Tryptophan : public Variable { TurnerCyclops_Tryptophan() : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "tryptophan", "partPerBillion", "CyclopsTryptophan") {} + /** + * @brief Destroy the Turner Cyclops Tryptophan variable object - no action + * needed. + */ ~TurnerCyclops_Tryptophan() {} }; @@ -1082,6 +1167,10 @@ class TurnerCyclops_RedChlorophyll : public Variable { : Variable((const uint8_t)CYCLOPS_VAR_NUM, (uint8_t)CYCLOPS_RESOLUTION, "chlorophyllFluorescence", "microgramPerLiter", "CyclopsRedChlorophyll") {} + /** + * @brief Destroy the Turner Cyclops Red Chlorophyll variable object - no + * action needed. + */ ~TurnerCyclops_RedChlorophyll() {} }; /**@}*/ diff --git a/src/sensors/VegaPuls21.h b/src/sensors/VegaPuls21.h index 815739b1b..9ea9ec732 100644 --- a/src/sensors/VegaPuls21.h +++ b/src/sensors/VegaPuls21.h @@ -61,11 +61,17 @@ /** @ingroup sensor_vega_puls21 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_vega_puls21_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by the VEGA PULS 21 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the VEGA PULS 21 can report 5 values #define VEGAPULS21_NUM_VARIABLES 5 /// @brief Sensor::_incCalcValues; #define VEGAPULS21_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_vega_puls21_timing diff --git a/src/sensors/YosemitechParent.h b/src/sensors/YosemitechParent.h index b034177b1..13b4efe30 100644 --- a/src/sensors/YosemitechParent.h +++ b/src/sensors/YosemitechParent.h @@ -218,7 +218,7 @@ class YosemitechParent : public Sensor { * updates the #_sensorStatus. No sensor power is required. This will * always return true. * - * @return **bool** True if the setup was successful. + * @return True if the setup was successful. */ bool setup(void) override; /** @@ -230,7 +230,7 @@ class YosemitechParent : public Sensor { * * @note This does NOT include any wait for sensor readiness. * - * @return **bool** True if the wake function completed successfully. + * @return True if the wake function completed successfully. */ bool wake(void) override; /** @@ -239,7 +239,7 @@ class YosemitechParent : public Sensor { * This also un-sets the #_millisSensorActivated timestamp (sets it to 0). * This does NOT power down the sensor! * - * @return **bool** True if the sleep function completed successfully. + * @return True if the sleep function completed successfully. */ bool sleep(void) override; @@ -253,12 +253,33 @@ class YosemitechParent : public Sensor { bool addSingleMeasurementResult(void) override; private: - yosemitech _ysensor; + /** + * @brief Private reference to the yosemitech class for communication with + * the Yosemitech sensor. + */ + yosemitech _ysensor; + /** + * @brief Private reference to the model of Yosemitech Sensor + */ yosemitechModel _model; - byte _modbusAddress; - Stream* _stream; - int8_t _RS485EnablePin; - int8_t _powerPin2; + /** + * @brief Private reference to the Yosemitech sensor's modbus address + */ + byte _modbusAddress; + /** + * @brief Private reference to the stream for communciation with the + * Yosemitech sensor. + */ + Stream* _stream; + /** + * @brief Private reference to the RS-485 adapter's flow direction control + * pin. + */ + int8_t _RS485EnablePin; + /** + * @brief Private reference to the power pin fro the RS-485 adapter. + */ + int8_t _powerPin2; }; #endif // SRC_SENSORS_YOSEMITECHPARENT_H_ diff --git a/src/sensors/YosemitechY4000.h b/src/sensors/YosemitechY4000.h index 400d61ddc..60a88c290 100644 --- a/src/sensors/YosemitechY4000.h +++ b/src/sensors/YosemitechY4000.h @@ -62,11 +62,17 @@ /** @ingroup sensor_y4000 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y4000_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y4000 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y4000 can report 8 values. #define Y4000_NUM_VARIABLES 8 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y4000_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y4000_timing diff --git a/src/sensors/YosemitechY504.h b/src/sensors/YosemitechY504.h index 2f5ff2019..f8d497c76 100644 --- a/src/sensors/YosemitechY504.h +++ b/src/sensors/YosemitechY504.h @@ -60,12 +60,18 @@ /** @ingroup sensor_y504 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y504_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitech Y504 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y504 can report 3 values. #define Y504_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we calculated DO concentration from the /// percent saturation and the temperature. #define Y504_INC_CALC_VARIABLES 1 +/**@}*/ /** * @anchor sensor_y504_timing diff --git a/src/sensors/YosemitechY510.h b/src/sensors/YosemitechY510.h index c726f67d3..b876bfc23 100644 --- a/src/sensors/YosemitechY510.h +++ b/src/sensors/YosemitechY510.h @@ -56,11 +56,17 @@ /** @ingroup sensor_y510 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y510_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y510 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y510 can report 2 values. #define Y510_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y510_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y510_timing diff --git a/src/sensors/YosemitechY511.h b/src/sensors/YosemitechY511.h index e49ee49ae..9bfa4c89b 100644 --- a/src/sensors/YosemitechY511.h +++ b/src/sensors/YosemitechY511.h @@ -57,11 +57,17 @@ /** @ingroup sensor_y511 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y511_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y511 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y511 can report 2 values. #define Y511_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y511_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y511_timing diff --git a/src/sensors/YosemitechY514.h b/src/sensors/YosemitechY514.h index 138f44cea..5f8ec785d 100644 --- a/src/sensors/YosemitechY514.h +++ b/src/sensors/YosemitechY514.h @@ -58,11 +58,17 @@ /** @ingroup sensor_y514 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y514_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y514 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y514 can report 2 values. #define Y514_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y514_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y514_timing diff --git a/src/sensors/YosemitechY520.h b/src/sensors/YosemitechY520.h index 755db66e6..c1825f346 100644 --- a/src/sensors/YosemitechY520.h +++ b/src/sensors/YosemitechY520.h @@ -57,11 +57,17 @@ /** @ingroup sensor_y520 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y520_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y520 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y520 can report 2 values. #define Y520_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y520_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y520_timing diff --git a/src/sensors/YosemitechY532.h b/src/sensors/YosemitechY532.h index 3ca91bdec..d2ab9f406 100644 --- a/src/sensors/YosemitechY532.h +++ b/src/sensors/YosemitechY532.h @@ -57,11 +57,17 @@ /** @ingroup sensor_y532 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y532_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y532 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y532 can report 3 values. #define Y532_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y532_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y532_timing diff --git a/src/sensors/YosemitechY533.h b/src/sensors/YosemitechY533.h index 8e5e81627..661b6e2d2 100644 --- a/src/sensors/YosemitechY533.h +++ b/src/sensors/YosemitechY533.h @@ -56,11 +56,17 @@ /** @ingroup sensor_y533 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y533_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y533 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y533 can report 2 values. #define Y533_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y533_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y533_timing diff --git a/src/sensors/YosemitechY551.h b/src/sensors/YosemitechY551.h index 8cc2fbb13..dd2cc01b9 100644 --- a/src/sensors/YosemitechY551.h +++ b/src/sensors/YosemitechY551.h @@ -56,11 +56,17 @@ /** @ingroup sensor_y551 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y551_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y551 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y551 can report 2 values. #define Y551_NUM_VARIABLES 3 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y551_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y551_timing diff --git a/src/sensors/YosemitechY560.h b/src/sensors/YosemitechY560.h index 31bb9227c..58067a951 100644 --- a/src/sensors/YosemitechY560.h +++ b/src/sensors/YosemitechY560.h @@ -57,11 +57,17 @@ /** @ingroup sensor_y560 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y560_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch 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 diff --git a/src/sensors/YosemitechY700.h b/src/sensors/YosemitechY700.h index f4923a472..82f722fe7 100644 --- a/src/sensors/YosemitechY700.h +++ b/src/sensors/YosemitechY700.h @@ -55,11 +55,17 @@ /** @ingroup sensor_y700 */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_y700_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a Yosemitch Y700 + */ +/**@{*/ /// @brief Sensor::_numReturnedValues; the Y700 can report 2 values. #define Y700_NUM_VARIABLES 2 /// @brief Sensor::_incCalcValues; we don't calculate any additional values. #define Y700_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_y700_timing diff --git a/src/sensors/ZebraTechDOpto.h b/src/sensors/ZebraTechDOpto.h index 26c4780d1..96e53dd44 100644 --- a/src/sensors/ZebraTechDOpto.h +++ b/src/sensors/ZebraTechDOpto.h @@ -59,16 +59,22 @@ /** @ingroup sensor_dopto */ /**@{*/ -// Sensor Specific Defines +/** + * @anchor sensor_dopto_var_counts + * @name Sensor Variable Counts + * The number of variables that can be returned by a ZebraTech D-Opto + */ +/**@{*/ /// @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. #define DOPTO_INC_CALC_VARIABLES 0 +/**@}*/ /** * @anchor sensor_dopto_timing * @name Sensor Timing - * The sensor timing for an ZebraTech D-Opto + * The sensor timing for a ZebraTech D-Opto */ /**@{*/ /// @brief Sensor::_warmUpTime_ms; the D-Opto warms up in 275ms. Maximum @@ -100,7 +106,7 @@ /** * @anchor sensor_dopto_temp * @name Temperature - * The temperature variable from an ZebraTech D-Opto + * The temperature variable from a ZebraTech D-Opto * - Range is not specified in sensor datasheet * - Accuracy is ± 0.1°C * @@ -127,7 +133,7 @@ /** * @anchor sensor_dopto_dopercent * @name Dissolved Oxygen Percent Saturation - * The percent saturation variable from an ZebraTech D-Opto + * The percent saturation variable from a ZebraTech D-Opto * - Range is not specified in sensor datasheet * - Accuracy is 1 % of reading or 0.02PPM, whichever is greater * @@ -155,7 +161,7 @@ /** * @anchor sensor_dopto_domgl * @name Dissolved Oxygen Concentration - * The DO concentration variable from an ZebraTech D-Opto + * The DO concentration variable from a ZebraTech D-Opto * - Range is not specified in sensor datasheet * - Accuracy is 1 % of reading or 0.02PPM, whichever is greater *