diff --git a/a/tu_xx02/.gitignore b/a/tu_xx02/.gitignore deleted file mode 100644 index 120f3cd7d..000000000 --- a/a/tu_xx02/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -.pio -.pioenvs -.piolibdeps -.vscode/.browse.c_cpp.db* -.vscode/c_cpp_properties.json -.vscode/launch.json -.vscode/ipch -.piolibdeps.lock -*.cpp.o -*.log diff --git a/a/tu_xx02/git_rev_macro.py b/a/tu_xx02/git_rev_macro.py deleted file mode 100644 index aa4fb114b..000000000 --- a/a/tu_xx02/git_rev_macro.py +++ /dev/null @@ -1,7 +0,0 @@ -import subprocess - -git_rev = str(subprocess.check_output(["git", "rev-parse","--abbrev-ref", "HEAD"]).strip()) -git_usr = str(subprocess.check_output(["git", "config","user.name"]).strip()) - -print('-DPIO_SRC_REV={'+(''.join('0x%02x,' % ord(c) for c in git_rev) ) +'0x0}') -print('-DPIO_SRC_USR={'+(''.join('0x%02x,' % ord(c) for c in git_usr) ) +'0x0}') \ No newline at end of file diff --git a/a/tu_xx02/platformio.ini b/a/tu_xx02/platformio.ini deleted file mode 100644 index 8729135ee..000000000 --- a/a/tu_xx02/platformio.ini +++ /dev/null @@ -1,208 +0,0 @@ -; PlatformIO Project Configuration File -; -; Build options: build flags, source filter -; Upload options: custom upload port, speed and extra flags -; Library options: dependencies, extra library storages -; Advanced options: extra scripting -; -; Please visit documentation for the other options and examples -; http://docs.platformio.org/page/projectconf.html - -[platformio] -description = neilh10/ModularSensors tu_xx logging to Monitor My Watershed -;src_dir =. -default_envs = mayfly - -[common] -cmn_lib_deps= - ; There are 3 levels of code production - ; The stream ( rel1_dvlp1m) is used in alpha coding and development - ; alpha - this platformio.ini - which enables (rel1_dvlp1m) editing in ModularSensors\src & a\ex - ; development see (rel1_dvlp1m) examples\tu_ec - ; production see (release1) examples\tu_ex - ; - ; For alpha coding, - ; (2023-Jan-02 : this worked, however PIO can change, and now seems to be doing realtime analysis of dependencies) - ; and periodically when need to update all libs including ModularSensors #rel1_dvlp1m - ; for clean lib - delete .pio, - ; pio pkg install - execute - ; leave .pio/libdeps/xxx/EnviroDIY_modularSensors as doing realtime dependencie checks - https://github.com/neilh10/ModularSensors#rel1_dvlp1m -; ^^ Use this when you want to pull from a specific branch - ; These are latest beyond EnviroDIY releases - https://github.com/vshymanskyy/StreamDebugger ;Debug when needed - ; StreamDebugger ; Same as above - https://github.com/neilh10/SensorModbusMaster ; default release1 - ;use above https://github.com/enviroDIY/SensorModbusMaster - https://github.com/neilh10/Adafruit_INA219.git - ; del https://github.com/adafruit/SdFat ;- need adafruit/SdFat for multiple SDx - ;https://github.com/greiman/SdFat.git ;- - ;https://github.com/neilh10/EnableInterrupt - old v1.0.0 need v1.1 - ;https://github.com/GreyGnome/EnableInterrupt - ; del https://github.com/arduino-libraries/NTPClient - repalced - ;; see lib_samd_deps for Adafruit_SPIFlash & Adafruit_TinyUSB_Arduino & Adafruit-GFX-Library Adafruit_NeoPixel - ; Need extra libs, so enable STD_LIBS on 1st pass enable ModularSensors then build pulling in ref libs, - ; -; STD_LIBS pulled in by ModularSensors, needed if not enabling ModularSensors to Historical Ref - ;https://github.com/soligen2010/Adafruit_ADS1X15 - ;https://github.com/adafruit/Adafruit_AM2315 - ;https://github.com/adafruit/Adafruit_AM2320 - ;https://github.com/adafruit/Adafruit_BME280_Library - ;https://github.com/adafruit/Adafruit_MPL115A2 - ;https://github.com/adafruit/DHT-sensor-library - ;https://github.com/adafruit/Adafruit_Sensor - ;https://github.com/milesburton/Arduino-Temperature-Control-Library ;Pulls in DallasTemperature - ;https://github.com/neilh10/KellerModbus - ;https://github.com/EnviroDIY/KellerModbus - ;https://github.com/NorthernWidget/MS5803 - ;https://github.com/PaulStoffregen/OneWire - ;https://github.com/knolleary/pubsubclient.git - ;bug https://github.com/EnviroDIY/TinyGSM.git ; bug EnviroDIY/ModularSensors/issues 311 - https://github.com/neilh10/TinyGSM.git#rel1 ;Bug fixes over Envirodiy - ;https://github.com/vshymanskyy/TinyGSM - ;https://github.com/EnviroDIY/YosemitechModbus#develop ;https://github.com/EnviroDIY/YosemitechModbus/issues/32 - https://github.com/neilh10/Arduino-SDI-12#release1 - ;https://github.com/EnviroDIY/Arduino-SDI-12.git bug with extraWakeTime=10 - ;https://github.com/EnviroDIY/Tally_Library.git#Dev_I2C - ; - ;Historical reference - ;https://github.com/greiman/SdFat.git ;- need adafruit/SdFat for multiple SDx - https://github.com/neilh10/STC3100arduino.git ;#v0.3.0 # For Mayfly board Knh002rev7 - https://github.com/neilh10/Arduino-SerialCommand - https://github.com/neilh10/InsituModbus - ;https://github.com/neilh10/KellerModbus - -; Ignore these folders or PlatformIO will double count all the dependencies -; Development: ModularSensors Release1: src ? -; ?? .pioenvs, .piolibdeps, .vscode, include, doc, examples, sensor_tests, compile_tests, pioScripts -cmn_lib_ignore = .git, doc, examples, arduino_update, sensor_tests, - EnviroDIY_DS3231 - SensorModbusMaster - Arduino-SDI-12 - TinyGSM - Adafruit_INA21 - EnviroDIY_ModularSensors - ModularSensors - -lib_avr_deps = ;Specific Mayfly board goes in [Mayfly] - -; for development, can edit directly in these directories ... relative to src_dir -; Use the src filter to ensure subfolders are built -; If enabled, disable in cmn_lib_deps=[]ModularSensors, and may need to delete duplicate directory .libdeps/ModularSensors -cmn_src_filter = +<*> +<../../../src> +<../../../src/sensors> +<../../../src/publishers> +<../../../src/modems> - +<../lib/*> - -#build_flags -v for detailed cc verbose, single threaded takes a long time -cmn_build_flags = - -Isrc - -I../../src ; .h For easy debug - -I../../src/sensors ; .h For easy debug - !python git_rev_macro.py ;returns -DPIO_SRC_REV= - ;-DMQTT_MAX_PACKET_SIZE=240 - -DTINY_GSM_YIELD_MS=2 - ;-DTINY_GSM_RX_BUFFER=64 ;is this needed? - ;-DNO_FIRST_SYNC_WITH_NIST - -DNIST_SYNC_HOURLY - ;-DMS_DISCARD_HTTP_500 - ;-DUSE_RTCLIB=RTC_DS3231 ;not compiling - ;-DMS_TU_XX_DEBUG - ;-DMS_TU_XX_DEBUG_DEEP - ;-DSTREAMDEBUGGER_DBG - ;-DMS_DUMP_FREE_RAM - ;-DMS_TTY_USER_INPUT - ;-DSerialCommand_inFlash ;requires MS_TTY_USER_INPUT - ;-DMS_TTY_INPUT_COUNT ;only if no MS_TTY_USER_INPUT - ;-DSERIALCOMMAND_DEBUG - -DMS_LOGGERBASE_POSTS - ;-DMS_LOGGERBASE_SLEEP_DEBUG ;Need or below - ;-DMS_LOGGERBASE_DEBUG - ;-DMS_LOGGERBASE_DEEP_DEBUG - ;-DMS_LOGGERMODEM_DEBUG - ;-DMS_LOGGERMODEM_DEBUG_DEEP - ;-DMS_SENSORBASE_DEBUG - ;-DMS_VARIABLEARRAY_DEBUG - ;-DMS_VARIABLEARRAY_DEBUG_DEEP - ;-DMS_VARIABLEBASE_DEBUG - ;-DMS_VARIABLEBASE_DEBUG_DEEP - ;-DMS_DATAPUBLISHERBASE_DEBUG - ;-DMS_ENVIRODIYPUBLISHER_DEBUG - ;-DMS_THINGSPEAKPUBLISHER_DEBUG - ;-DMS_UBIDOTSPUBLISHER_DEBUG - ;-DMS_SIMCOMSIM7080_DEBUG - ;-DMS_SIMCOMSIM7080_DEBUG_DEEP - ;-DMS_WIOTERMINAL_RPCWIFI_DEBUG - ;-DMS_ESPRESSIFESP8266_DEBUG - ;-DMS_ESPRESSIFESP8266_DEBUG_DEEP - ;-DMS_DIGIXBEEWIFI_DEBUG - ;-DMS_DIGIXBEEWIFI_DEBUG_DEEP - ;-DMS_DIGIXBEECELLULARTRANSPARENT_DEBUG - ;-DMS_DIGIXBEECELLULARTRANSPARENT_DEBUG_DEEP - ;-DMS_DIGIXBEE_DEBUG - ;-DTINY_GSM_DEBUG=Serial - ;-DTinyGsmClientXbee_DBG=Serial - ;-DMS_STSTC3100SENSOR_DEBUG - ;-DSTC3100DM_DEBUG ; device manager - ;-DSTC3100DD_DEBUG ;device driver - ;-DMS_BATTERYMANAGEMENT_DEBUG - ;-DMS_PROCESSORSTATS_DEBUG - ;-DMS_PROCESSORADC_DEBUG - ;-DMS_TIINA219M_DEBUG - ;-DMS_AOSONGAM2315_DEBUG - ;-DMS_EXTERNALVOLTAGE_DEBUG - ;-DMS_EXTERNALVOLTAGE_DEBUG_DEEP - ;-DMS_KELLERPARENT_DEBUG - ;-DMS_KELLERPARENT_DEBUG_DEEP has problem - ;-DMS_MODBUS_DEBUG - -DSENSORMODBUSMASTER_NO_DBG - ;-DMS_ANALOGELECCONDUCTIVITY_DEBUG - ;-DMS_ANALOGELECCONDUCTIVITY_DEBUG_DEEP - ;-DMS_SDI12SENSORS_DEBUG ;LT500 sometimes responding - ;-DMS_SDI12SENSORS_DEBUG_DEEP - ;For -DMS_SDI12 options: NONE or MS_SDI12_SINGLE_LINE_RESPONSE OR MS_SDI12_NON_CONCURRENT not BOTH - ;-DMS_SDI12_SINGLE_LINE_RESPONSE - ;-DMS_SDI12_NON_CONCURRENT - ;-DENVIRODIY_SDI12_USE_CRC - ;-DMS_ENVIRODIYPUBLISHER_DEBUG - ;-DMS_ENVIRODIYPUBLISHER_DEBUG_DEEP - ;-DSodaq_DS3231_DEBUG - -DMS_WATCHDOGAVR_DEBUG - -DMS_WATCHDOGAVR_DEBUG_DEEP - -[env:mayfly] -;upload_port = COM11 -monitor_speed = 115200 -board = mayfly -platform = atmelavr -framework = arduino -;debug_tool = blackmagic -;debug_port = test01u:4242 - -lib_compat_mode = strict -lib_ldf_mode = deep+ -lib_ignore = ${common.cmn_lib_ignore}, RTCZero -build_src_filter = ${common.cmn_src_filter} -;build_unflags = -Os -build_flags = - ${common.cmn_build_flags} - -DSDI12_EXTERNAL_PCINT - -DNEOSWSERIAL_EXTERNAL_PCINT - -fmax-errors=5 - -Wl,-Map,.pio/build/mayfly/firmware.map - -lib_deps =${common.cmn_lib_deps} ${common.lib_avr_deps} - https://github.com/neilh10/AltSoftSerial ; Need this for managing pwr - data pin off as well. - ;https://github.com/PaulStoffregen/AltSoftSerial.git - ; - ;https://github.com/EnviroDIY/SoftwaterSerial_ExternalInts.git - ;https://github.com/SRGDamia1/NeoSWSerial.git - https://github.com/neilh10/Sodaq_DS3231#release1 ; Bug fix #34 - change to RTClibnh with DS3231 - -monitor_filters = log2file, default, time -; -; The following monitor_flags setting is needed becasue in transparent mode the XBee3 -; uses CR line endings instead of the more typical CR+LF. This setting enables you -; to see all back and forth communication. -; (https://www.envirodiy.org/topic/connecting-xbee3-lte-to-the-internet/#post-13312) -monitor_flags = - --eol - CR diff --git a/a/tu_xx02/src/ini_opts/ms_cfg.ini_EC b/a/tu_xx02/src/ini_opts/ms_cfg.ini_EC deleted file mode 100644 index fd575f391..000000000 --- a/a/tu_xx02/src/ini_opts/ms_cfg.ini_EC +++ /dev/null @@ -1,43 +0,0 @@ -[COMMON] -;This section required. Max 80 active chars, not including after any ; -LOGGER_ID =TU_RC_ECtst02 ;Auto Site Reference -LOGGING_INTERVAL_MINUTES=15 -LIION_TYPE = 3 ;0=Any 1=LiIon0.5A 2=1AH 3=LiSOCL2 4=3Leclanche -TIME_ZONE=-8 ; -12 to +12 -GEOGRAPHICAL_ID="220221 EC DemoCreek#02 Monitor" - -[NETWORK] -;max32 3456789012345678901 -apn=VZWINTERNET ;revX -;WiFiId=Ssid -;WiFiPwd=pwd -;Generic -;SEND_QUE_SZ_NUM=10 ;SIZE of QUE to be stored. Def 700 -COLLECT_READINGS=1 ; Number of readings to collect before send 0to30 -;SEND_OFFSET_MIN=1 ;minutes to wait after collection complete 0-30 -POST_MAX_NUM =200 ;Upload on access - -[PROVIDER_MMW] -CLOUD_ID=monitormywatershed.org -REGISTRATION_TOKEN= 0cf7c40a-232e-457d-87d6-cea5c0757fec ; registration token -SAMPLING_FEATURE= 236c674b-69b9-43af-b0d6-33d67b870ecc ; Sampling feature - -TIMER_POST_TOUT_MS=15000; Gateway Timeout (ms) -TIMER_POST_PACE_MS=1000; Pacing between POSTs - -;Not more than 12 -Batt_UUID= 3bebd4a3-8b54-4f92-ba55-5fd2fd021358 ;Battery EnviroDIY_Mayfly_Batt -SampleNumber_UUID= 8c57835f-a32f-4d62-82dc-0ba09f04cf52 ;Sequence EnviroDIY_Mayfly_SampleNum -EC1_UUID= 7182846e-46e0-4a10-b110-9bc32de4aca9 ;use above - -;[BOOT] -;BOARD_NAME=mayfly -;BOARD_SN=MAYFLY180369 -;BOARD_REV=1.0 -;EEPROM_WRITE=YES ;Last operation - -[USER] -;ACTION=WRITE ; Last Operation - - - diff --git a/a/tu_xx02/src/ini_opts/ms_cfg_LT5.ini b/a/tu_xx02/src/ini_opts/ms_cfg_LT5.ini deleted file mode 100644 index 42f5b0ca7..000000000 --- a/a/tu_xx02/src/ini_opts/ms_cfg_LT5.ini +++ /dev/null @@ -1,48 +0,0 @@ -[COMMON] -;This section required. Max 80 active chars, not including after any ; -LOGGER_ID =TUCA_PO03 ;Auto Site Reference Po03. -LOGGING_INTERVAL_MINUTES=15 -LIION_TYPE = 2 ;0=Any 1=LiIon0.5A 2=1AH 3=LiSOCL2 4=3Leclanche -BATTERY_mAhr =4400 ;to 65500 -TIME_ZONE=-8 ; -12 to +12 -GEOGRAPHICAL_ID="Test Porter Crk at Weir " - -[NETWORK] -;apn only one depending on cell plan -apn=VZWINTERNET -COLLECT_READINGS=8 ; Number of readings to collect before send 0to30 -SEND_OFFSET_MIN=1 ;minutes to wait after collection complete 0-30 -POST_MAX_NUM =200 ;On POSTing MAX NUM after which defered next connection - -[PROVIDER_MMW] -CLOUD_ID= monitormywatershed.org -REGISTRATION_TOKEN= 97752ec3-7683-48e6-a4a0-ddf62e17b56a -SAMPLING_FEATURE= 7b4cd732-07c7-497e-b2c2-017728ed9413 -TIMER_POST_TOUT_MS=5000; Gateway Timeout (ms) -TIMER_POST_PACE_MS=1000 - -ITROLL_DEPTH_UUID= 9332fe85-d591-454b-92ce-a2ede24a0be7 ;Gage depth ft LT500 -ITROLL_TEMP_UUID= bdd24b9c-79e8-44df-b961-2ce899166090 ;Temperature C LT500 - -Batt_UUID= 499a5f0c-b96b-4a76-98c7-2b233082ec25 ;Solar EnviroDIY_Mayfly_Batt -STC3100Volt_UUID= 40ef5535-9c65-4453-9168-c46635c92886 ;LiIon All_ExternalVoltage_Battery (V) -STC3100used1_mAhr_UUID= 6f049b47-65ef-4221-97a3-b400c958dec3 ;mAh All EM-mAhr -STC3100avlbl_mAhr_UUID= d3505636-e94c-4b03-bb2f-a7da448f19bd ;mAh All EM-mAhr -SampleNumber_UUID= 73120cff-213e-45bd-8bc3-397a715958be ;Sequence number EnviroDIY_Mayfly_SampleNum -DIGI_RSSI_UUID= 90cf55f7-1bf2-45d6-ada8-4ef19bb734e0 ;Received signal strength indication (Digi_Cellular_RSSI) - -;[BOOT] -; For configuring a Mayfly with unique info from [BOOT] -;BOARD_NAME=mayfly -;BOARD_SN=MAYFLY20107 -;BOARD_REV=1.0 -;EEPROM_WRITE=YES ;Last operation -;EEPROM_WRITE=DEFAULT_APP_EEPROM ; Initialize the non-boot data then write, dangerous - - -[USER] -; For configuring project specific [COMMON] -;ACTION=WRITE ; Last Operation - - - diff --git a/a/tu_xx02/src/ini_opts/ms_cfg_LT5KA_test06.ini b/a/tu_xx02/src/ini_opts/ms_cfg_LT5KA_test06.ini deleted file mode 100644 index 2a4cfb081..000000000 --- a/a/tu_xx02/src/ini_opts/ms_cfg_LT5KA_test06.ini +++ /dev/null @@ -1,57 +0,0 @@ -[COMMON] -;This section required. Max 80 active chars, not including after any ; -LOGGER_ID =TU_RC_test06a ;Auto Site Reference -LOGGING_INTERVAL_MINUTES=15 ;15 -LIION_TYPE=2 ;0=Any 1=LiIon0.5A 2=1AH 3=LiSOCL2 4=3Leclanche -BATTERY_mAhr =4400 ;to 65500 -TIME_ZONE=-8 ; -12 to +12 -GEOGRAPHICAL_ID="beta test06 Monitor" - -[NETWORK] -;apn only one depending on cell plan -apn=VZWINTERNET -;apn=hologram -;WiFiId= -;WiFiPwd= -;SEND_QUE_SZ_NUM=1000 ; SIZE of QUE to be stored. Def off -COLLECT_READINGS=8 ;8Number of readings to collect before send 0to30 -SEND_OFFSET_MIN=7 ;7minutes to wait after collection complete 0-30 -POST_MAX_NUM=100 ;96 is one day@15mind - -[PROVIDER_MMW] -; monitormywatershed.org/sites/tu_rc_test06 -CLOUD_ID=monitormywatershed.org -REGISTRATION_TOKEN=e89538ae-7ff0-4897-a396-9b10c0fadfc3 ; registration token Test06 -SAMPLING_FEATURE= 31461753-cd5d-4ed0-99f7-17713c5e1e0e ; Sampling feature -TIMER_POST_TOUT_MS=5000; Gateway Timeout (ms) -TIMER_POST_PACE_MS=1000; - -ITROLL_DEPTH_UUID= a4361b13-a4b4-4d53-b1c8-1398d73ceeec ;Gage height ft LT500 CTD-10_Depth -ITROLL_TEMP_UUID= b40cdca7-22c5-4d6e-91db-4eb77ebf2179 ;Temperature C LT500 Temp CTD-10_Temp -KellerXxlevel_Height_UUID=e5a6b171-ae06-4fc0-bc3f-68820f9e448c ;Gage height m Keller_Acculevel_gageHeight -KellerXxlevel_Temp_UUID= 9a848614-1dc2-4372-890b-68d2b48d9407 ;Temperature C Keller_Acculevel_Temp -Batt_UUID= be84dc61-86dd-4ff9-9c44-f1d25bd78f6b ;EnviroDIY_Mayfly_Batt -SampleNumber_UUID= b404d204-f127-44d4-869c-50c058412999 ;EnviroDIY_Mayfly_SampleNum -DIGI_RSSI_UUID= 83fb7c9a-9af5-4bff-874a-d780045c19f0 ;RSSI -;Volt0_UUID= a6e185cb-32a4-4c05-bc7d-c14e87bc9701 ;AA0 ExtV of LiIon -Volt0_UUID= 2b6fb1f-4688-4fb0-ada7-323753536c08 -;STC3100Volt_UUID= 32b6fb1f-4688-4fb0-ada7-323753536c08 ; Extv All_External) -;STC3100used1_mAhr_UUID= 013225a5-b2ba-4f0d-ba99-3f38599e0672 ;mAh DVV5minMaxWindSpd -;STC3100avlbl_mAhr_UUID= d395b5f7-c9c4-4c99-a919-4c4869cbc288 ;mAh DVV5minAvgWindSpd -;8 "93e8bb31-6102-45f0-85c1-c83057999192", // Temperature (Digi_Cellular_Temp) -;9 "0ac7e1ad-2baf-4a54-b753-1a19fc4c8a17", // Time, elapsed (Digi_Cellular_PriorActiveTime) - -;[BOOT] -; For configuring a Mayfly with unique info from [BOOT] -;BOARD_NAME=mayfly -;BOARD_SN=MAYFLY160141 -;BOARD_REV=0.5bR04 -;EEPROM_WRITE=YES ;Last operation -;EEPROM_WRITE=DEFAULT_APP_EEPROM ; Initialize app then write, dangerous - -;[USER] -; For configuring project specific [COMMON] -;ACTION=WRITE ; Last Operation - - - diff --git a/a/tu_xx02/src/ini_opts/ms_cfg_Nano.ini b/a/tu_xx02/src/ini_opts/ms_cfg_Nano.ini deleted file mode 100644 index ee9e538d1..000000000 --- a/a/tu_xx02/src/ini_opts/ms_cfg_Nano.ini +++ /dev/null @@ -1,52 +0,0 @@ -[COMMON] -;This section required. Max 80 active chars, not including after any ; -LOGGER_ID =TUCA_PO03 ;Auto Site Reference Po03. -LOGGING_INTERVAL_MINUTES=15 -LIION_TYPE = 2 ;0=Any 1=LiIon0.5A 2=1AH 3=LiSOCL2 4=3Leclanche -BATTERY_mAhr =4400 ;to 65500 -TIME_ZONE=-8 ; -12 to +12 -GEOGRAPHICAL_ID="Test Porter Crk at Weir " - -[NETWORK] -;apn only one depending on cell plan -apn=VZWINTERNET -;SEND_QUE_SZ_NUM=1000 ; SIZE of QUE to be stored. Def off -COLLECT_READINGS=8 ; Number of readings to collect before send 0to30 -SEND_OFFSET_MIN=7 ;minutes to wait after collection complete 0-30 -POST_MAX_NUM=100 ;96 is one day@15mind - -[PROVIDER_MMW] -;https://monitormywatershed.org/sites/TURC_PC01/ -CLOUD_ID=monitormywatershed.org -REGISTRATION_TOKEN= 97752ec3-7683-48e6-a4a0-ddf62e17b56a -SAMPLING_FEATURE= 7b4cd732-07c7-497e-b2c2-017728ed9413 -TIMER_POST_TOUT_MS=5000; Gateway Timeout (ms) -TIMER_POST_PACE_MS=1000 - -;ITROLL_DEPTH_UUID= 9332fe85-d591-454b-92ce-a2ede24a0be7 ;Gage depth ft LT500 -;ITROLL_TEMP_UUID= bdd24b9c-79e8-44df-b961-2ce899166090 ;Temperature C LT500 -KellerXxlevel_Height_UUID=9332fe85-d591-454b-92ce-a2ede24a0be7 ;Gage height m Keller_Acculevel_gageHeight -KellerXxlevel_Temp_UUID= bdd24b9c-79e8-44df-b961-2ce899166090 ;Temperature C Keller_Acculevel_Temp - -Batt_UUID= 499a5f0c-b96b-4a76-98c7-2b233082ec25 ;Solar EnviroDIY_Mayfly_Batt -STC3100Volt_UUID= 40ef5535-9c65-4453-9168-c46635c92886 ;LiIon All_ExternalVoltage_Battery (V) -STC3100used1_mAhr_UUID= 6f049b47-65ef-4221-97a3-b400c958dec3 ;mAh All EM-mAhr -STC3100avlbl_mAhr_UUID= d3505636-e94c-4b03-bb2f-a7da448f19bd ;mAh All EM-mAhr -SampleNumber_UUID= 73120cff-213e-45bd-8bc3-397a715958be ;Sequence number EnviroDIY_Mayfly_SampleNum -DIGI_RSSI_UUID= 90cf55f7-1bf2-45d6-ada8-4ef19bb734e0 ;Received signal strength indication (Digi_Cellular_RSSI) - -;[BOOT] -; For configuring a Mayfly with unique info from [BOOT] -;BOARD_NAME=mayfly -;BOARD_SN=MAYFLY20107 -;BOARD_REV=1.0 -;EEPROM_WRITE=YES ;Last operation -;EEPROM_WRITE=DEFAULT_APP_EEPROM ; Initialize the non-boot data then write, dangerous - - -[USER] -; For configuring project specific [COMMON] -;ACTION=WRITE ; Last Operation - - - diff --git a/a/tu_xx02/src/ini_opts/ms_cfg_test04.ini b/a/tu_xx02/src/ini_opts/ms_cfg_test04.ini deleted file mode 100644 index eb8c53fbb..000000000 --- a/a/tu_xx02/src/ini_opts/ms_cfg_test04.ini +++ /dev/null @@ -1,88 +0,0 @@ -[COMMON] -;This section required. Max 80 active chars, not including after any ; -LOGGER_ID =TU_RC_test04b ;emulation NA-13 -LOGGING_INTERVAL_MINUTES=2 ;15 -BATTERY_TYPE = 2 ;0=Any 1=LiIon0.5A 2=2AH 3=LiSOCL2 4=3Leclanche -BATTERY_mAhr = 2000 ;4400to 65500 -TIME_ZONE=-8 ; -12 to +12 -GEOGRAPHICAL_ID="At TU-RCtest04 simRiverX Monitor" - -[NETWORK] -;apn only one depending on cell plan -;max32 3456789012345678901 -;apn=nimblink.gw12.vzwentp -;apn=VZWINTERNET ;revX -;apn=hologram -WiFiId= -WiFiPwd= -;Generic -;SEND_QUE_SZ_NUM=1000 ; SIZE of QUE to be stored. Def off -COLLECT_READINGS=2 ; Number of readings to collect before send 0to30 -SEND_OFFSET_MIN=0 ;minutes to wait after collection complete 0-30 -POST_MAX_NUM=100 ;96 is one day@15mind - -[PROVIDER_MMW] -CLOUD_ID=monitormywatershed.org -REGISTRATION_TOKEN=db5b129d-e465-482e-a3ed-03c37f871541 ; registration token -SAMPLING_FEATURE= 2c7bd08e-355c-4ba5-80a3-f61745ff2e0c ; Sampling feature -TIMER_POST_TOUT_MS=5000; Gateway Timeout (ms) -TIMER_POST_PACE_MS=500; Pacing between POSTs - -;Not more than 12 -;DIGI_RSSI_UUID= dce56bd5-8fd5-4435-b0aa-be687673221d ;Digi_Cellular_RSSI -;Air_Humidity_UUID= 4e7fc7d9-f777-4a1c-945e-568288bc6623 ;AOSong_AM2315_Humidity -;ITROLL_DEPTH_UUID= 4e7fc7d9-f777-4a1c-945e-568288bc6623 ;AOSong_AM2315_Humidity -;Air_Temperature_UUID= ef9d0d14-c52c-411a-b7f9-cafbc1e24a14 ;AOSong_AM2315_Temp -;ITROLL_TEMP_UUID= ef9d0d14-c52c-411a-b7f9-cafbc1e24a14 ;AOSong_AM2315_Temp -KellerXxlevel_Height_UUID=c673e643-7d8b-4a7c-9bf5-eabcdcedea17 ;Gage height Keller_Acculevel_gageHeight -KellerXxlevel_Temp_UUID= b188e862-2e0a-4381-8918-be777ac48735 ;Temperature Keller_Acculevel_Temp -;MaximDS3231_TEMP_UUID = 35f90c42-3982-4d35-9979-cb77343ad6d8 ;EnviroDIY_Mayfly_Temp -Batt_UUID= 78e07e3b-5660-4118-930a-e91b489f5142 ;A6 Battery EnviroDIY_Mayfly_Batt -Volt0_UUID= f2cfcaf6-7dcc-48fc-9075-af12ea092379 ;AA0 ExtV of LiIon -;STC3100Volt_UUID= 563f2971-ebe4-4a74-9ed7-f8cd2907215a ;Update for STC3100 EnviroDIY_Mayfly_Batt -SampleNumber_UUID= c49c2646-57a5-4706-982e-234c5e68d878 ;Sequence EnviroDIY_Mayfly_SampleNum -;STC3100used1_mAhr_UUID= 9614a087-744b-4dc1-a657-5e6b234212d0 ;mAh MaxWindSpd -;STC3100avlbl_mAhr_UUID= 5aa7c45b-aa60-41c9-ba0f-2449583a8080 ;mAh AvgWindSpd - - -[PROVIDER_TS] -;thingspeak.com/channels/5940 max key sz=16+\0 -CLOUD_ID=mqtt.thingspeak.com -; 1234567890123456 -TS_MQTT_KEY=Z0G6QS4IXEHKG0PK -TS_CHANNEL_ID=5940 -TS_CHANNELWR_KEY=DHCKWX0HZQLHGIAX -TIMER_POST_TOUT_MS=5000; Gateway Timeout (ms) -TIMER_POST_PACE_MS=500; Pacing between POSTs - - -[PROVIDER_UBIDOTS] -; Supported: ubidots.com -CLOUD_ID=data.ubidots.com -UB_AUTH_TOKEN=BBFF-kHUEZap6mQO3AobFRedwkpHGX0lzin -UB_DEVICE_ID=5fd802481d84720b3b0907a1 -TIMER_POST_TOUT_MS=5000; Gateway Timeout (ms) -TIMER_POST_PACE_MS=500; Pacing between POSTs - - -Batt_UUID= vbat ;Battery EnviroDIY_Mayfly_Batt -Air_Humidity_UUID=humd -Air_Temperature_UUID=airt -SampleNumber_UUID=seqn - -;[BOOT] -; For configuring a Mayfly with unique info from [BOOT] -;BOARD_NAME=mayfly -;BOARD_SN=MAYFLY20395 -;BOARD_REV=1.0 -;EEPROM_WRITE=DEFAULT_APP_EEPROM ; Initialize app then write, dangerous -;EEPROM_WRITE=YES ;Last operation - -;[USER] -; For configuring project specific [COMMON] -;ACTION= -;ACTION=WRITE ; Last Operation - - - - diff --git a/a/tu_xx02/src/ms_cfg.h b/a/tu_xx02/src/ms_cfg.h deleted file mode 100644 index e7d6ad5ab..000000000 --- a/a/tu_xx02/src/ms_cfg.h +++ /dev/null @@ -1,325 +0,0 @@ -/***************************************************************************** -ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 2201004: 0.33.1.aac -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b or 1.x -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 -#define MAYFLY_BAT_A6 4 -#define REPORT_FILTERED_BAT_A6_V -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//For Insitu_Troll specify one or none -//#define Insitu_TrollSdi12_UUID 1 -#define Insitu_TrollModbus_UUID 1 - -#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -//#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x -#define SENSIRION_SHT4X_UUID -//#define ASONG_AM23XX_UUID 1 - -//Two heavy sensors with power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -//#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF - -// Definitions of Modems -#define BUILD_MODEM_DIGI_XBEE_WIFI 1 -#define BUILD_MODEM_ESPRESSIF_ESP32 2 -#define BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT 3 -#define BUILD_MODEM_SIM_COM_SIM7080 4 -#define BUILD_MODEM_FACTORY 5 -//Actual Modem to build for -//#define BUILD_MODEM_TYPE BUILD_MODEM_DIGI_XBEE_WIFI -//cc #define BUILD_MODEM_TYPE BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT -//cc #define BUILD_MODEM_TYPE BUILD_MODEM_ESPRESSIF_ESP32 -// cc -#define BUILD_MODEM_TYPE BUILD_MODEM_SIM_COM_SIM7080 -//cc #define BUILD_MODEM_TYPE BUILD_MODEM_FACTORY - -#if BUILD_MODEM_TYPE == BUILD_MODEM_FACTORY -#define CONFIG_EXT "Digi WiFi S6/LTE XB3-C-A2" -#elif BUILD_MODEM_TYPE == BUILD_MODEM_DIGI_XBEE_WIFI -#define CONFIG_EXT "Digi WIFI" -#elif BUILD_MODEM_TYPE == BUILD_MODEM_ESPRESSIF_ESP32 -#define CONFIG_EXT "ESP32-wroom" -#elif BUILD_MODEM_TYPE == BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT -#define CONFIG_EXT "LTE Digi XBC3" -#elif BUILD_MODEM_TYPE == BUILD_MODEM_SIM_COM_SIM7080 -#define CONFIG_EXT "LTE SIM7080" -#else -#define CONFIG_EXT "No Modem" -#endif -#define CONFIGURATION_DESCRIPTION_STR "LT500/Modbus TO MMW " CONFIG_EXT - - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -//#define UseModem_Module 1 -#if defined BUILD_MODEM_TYPE -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#if BUILD_MODEM_TYPE != BUILD_MODEM_SIM_COM_SIM7080 -//Unusually #undef BUILD_MODEM_SIM_COM_SIM7080 -#define TINY_GSM_MODEM_XBEE -#endif - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // defined BUILD_MODEM_TYPE - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID -// Mayfly definitions -#ifdef Insitu_TrollModbus_UUID -#define InsituLTrs485_ACT 1 -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" -#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop -//#define MODBUS_BAUD_RATE 9600 -#define MODBUS_BAUD_RATE 19200 -//Default for AltsoftSerial is SERIAL_8N1 -//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#define MODBUS_SERIAL_CONFIG SERIAL_8E1 -#endif // InsituLTrs485_ACT -#elif defined Insitu_TrollSdi12_UUID -#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_TrollSdi12_UUID -#endif // Insitu_Trollxxx - - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 10 //Knh2rev8b1 ~ use D10 -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined SENSIRION_SHT4X_UUID -#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" -//#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" -#elif defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined BUILD_MODEM_TYPE -// tested Digi LTE -// tested Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // BUILD_MODEM_TYPE - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_EC b/a/tu_xx02/src/ms_cfg.h_EC deleted file mode 100644 index 57b9bcb91..000000000 --- a/a/tu_xx02/src/ms_cfg.h_EC +++ /dev/null @@ -1,280 +0,0 @@ -/***************************************************************************** -ms_cfg.h_EC - ModularSensors Configuration - tgt relative _EC -Status: 220219: updated to use comms but not tested - -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 - -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//#define Insitu_TrollSdi12_UUID 1 - -//#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -//#define ASONG_AM23XX_UUID 1 - -// sensors with low power useage - -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_MEDIUM_REQ -// with Modem use above ^^ else use below \|/ -//#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -//Assume Mayfly, and version determined on boot See mcuBoardVersion_ -//#define MFName_DEF "Mayfly" -//#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "Electrical Conductivity MMW Digi WiFi S6/LTE XB3-C-A2" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -#define UseModem_Module 1 -#if UseModem_Module -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // UseModem_Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#ifdef Insitu_TrollSdi12_UUID -// Mayfly definitions -#define ITROLL_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLL_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_Troll_UUID - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -//#define InsituLTrs485_ACT 1 -not working -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Height_UUID "KellerNanolevel_Height_UUID" -#define InsituLTrs485_Temp_UUID "KellerNanolevel_Temp_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Default is 19200 lets hope serial works with it. -#define MODBUS_BAUD_RATE 19200 -#endif // InsituLTrs485_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_LT5KA_wireless b/a/tu_xx02/src/ms_cfg.h_LT5KA_wireless deleted file mode 100644 index f64834ed4..000000000 --- a/a/tu_xx02/src/ms_cfg.h_LT5KA_wireless +++ /dev/null @@ -1,274 +0,0 @@ -/***************************************************************************** -ms_cfg.h_LT5KA_wireless - ModularSensors Config - MMW _LT5 Acculevel/modbus +LTE/WiFi -Status 220330: 0.32.2 -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -#define Insitu_TrollSdi12_UUID 1 - -#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -//#define ASONG_AM23XX_UUID 1 - -//Two heavy sensors with power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_MEDIUM_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "LT500/SDI12+Acculevel/Modbus Digi WiFi S6/LTE XB3-C-A2 MMW" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -#define UseModem_Module 1 -#if UseModem_Module -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // UseModem_Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#ifdef Insitu_TrollSdi12_UUID -// Mayfly definitions -#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_Troll_UUID - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -// Setup for Keller Acculevel is 900 1Start 8Data, Parity None 1Stop -#define MODBUS_BAUD_RATE 9600 -#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -// Setup for Keller Nanolevel is 900 1Start 8Data, Parity None 1Stop -#define MODBUS_BAUD_RATE 9600 -#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#endif // KellerNanolevel_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -//Test configuration for NA13 -#define STC3100_Volt_UUID "Volt0_UUID" -//#define STC3100_Volt_UUID "STC3100Volt_UUID" -//#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_LT5_Mdbus_wireless b/a/tu_xx02/src/ms_cfg.h_LT5_Mdbus_wireless deleted file mode 100644 index 59081ed31..000000000 --- a/a/tu_xx02/src/ms_cfg.h_LT5_Mdbus_wireless +++ /dev/null @@ -1,293 +0,0 @@ -/***************************************************************************** -ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 2201004: 0.33.1.aac -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 -#define MAYFLY_BAT_A6 4 -#define REPORT_FILTERED_BAT_A6_V -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//For Insitu_Troll specify one or none -//#define Insitu_TrollSdi12_UUID 1 -#define Insitu_TrollModbus_UUID 1 - -#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -//#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x -#define SENSIRION_SHT4X_UUID -//#define ASONG_AM23XX_UUID 1 - -//Two heavy sensors with power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -//#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "LT500/Modbus Digi WiFi S6/LTE XB3-C-A2 MMW" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -#define UseModem_Module 1 -#if UseModem_Module -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // UseModem_Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID -// Mayfly definitions -#ifdef Insitu_TrollModbus_UUID -#define InsituLTrs485_ACT 1 -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" -#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop -//#define MODBUS_BAUD_RATE 9600 -#define MODBUS_BAUD_RATE 19200 -//Default for AltsoftSerial is SERIAL_8N1 -//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#define MODBUS_SERIAL_CONFIG SERIAL_8E1 -#endif // InsituLTrs485_ACT -#elif defined Insitu_TrollSdi12_UUID -#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_TrollSdi12_UUID -#endif // Insitu_Trollxxx - - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 10 //Knh2rev8b1 ~ use D10 -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined SENSIRION_SHT4X_UUID -#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" -//#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" -#elif defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// tested Digi LTE -// tested Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -//#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_LT5_Mdbus_wireless_M05 b/a/tu_xx02/src/ms_cfg.h_LT5_Mdbus_wireless_M05 deleted file mode 100644 index 25f45c777..000000000 --- a/a/tu_xx02/src/ms_cfg.h_LT5_Mdbus_wireless_M05 +++ /dev/null @@ -1,291 +0,0 @@ -/***************************************************************************** -ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220410: 0.33.1.aaa -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//For Insitu_Troll specify one or none -//#define Insitu_TrollSdi12_UUID 1 -#define Insitu_TrollModbus_UUID 1 - -#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x -#define SENSIRION_SHT4X_UUID -//#define ASONG_AM23XX_UUID 1 - -//Two heavy sensors with power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "LT500/Modbus Digi WiFi S6/LTE XB3-C-A2 MMW" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -#define UseModem_Module 1 -#if UseModem_Module -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // UseModem_Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID -// Mayfly definitions -#ifdef Insitu_TrollModbus_UUID -#define InsituLTrs485_ACT 1 -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" -#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop -//#define MODBUS_BAUD_RATE 9600 -#define MODBUS_BAUD_RATE 19200 -//Default for AltsoftSerial is SERIAL_8N1 -//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#define MODBUS_SERIAL_CONFIG SERIAL_8E1 -#endif // InsituLTrs485_ACT -#elif defined Insitu_TrollSdi12_UUID -#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_TrollSdi12_UUID -#endif // Insitu_Trollxxx - - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined SENSIRION_SHT4X_UUID -#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" -#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" -#elif defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_LT5_SDI12_wireless b/a/tu_xx02/src/ms_cfg.h_LT5_SDI12_wireless deleted file mode 100644 index f4986063c..000000000 --- a/a/tu_xx02/src/ms_cfg.h_LT5_SDI12_wireless +++ /dev/null @@ -1,291 +0,0 @@ -/***************************************************************************** -ms_cfg.h_LT5_SDI12_wireless - ModularSensors Config - MMW _LT5/SDI12 +LTE/WiFi -Status 220410: 0.33.1.aaa -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//For Insitu_Troll specify one or none -#define Insitu_TrollSdi12_UUID 1 -//#define Insitu_TrollModbus_UUID 1 - -#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x -//#define SENSIRION_SHT4X_UUID -//#define ASONG_AM23XX_UUID 1 - -//Two heavy sensors with power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "LT500/SDI12 Digi WiFi S6/LTE XB3-C-A2 MMW" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -#define UseModem_Module 1 -#if UseModem_Module -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // UseModem_Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID -// Mayfly definitions -#ifdef Insitu_TrollModbus_UUID -#define InsituLTrs485_ACT 1 -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" -#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop -//#define MODBUS_BAUD_RATE 9600 -#define MODBUS_BAUD_RATE 19200 -//Default for AltsoftSerial is SERIAL_8N1 -//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#define MODBUS_SERIAL_CONFIG SERIAL_8E1 -#endif // InsituLTrs485_ACT -#elif defined Insitu_TrollSdi12_UUID -#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_TrollSdi12_UUID -#endif // Insitu_Trollxxx - - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined SENSIRION_SHT4X_UUID -#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" -#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" -#elif defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_db_test b/a/tu_xx02/src/ms_cfg.h_db_test deleted file mode 100644 index a18331402..000000000 --- a/a/tu_xx02/src/ms_cfg.h_db_test +++ /dev/null @@ -1,294 +0,0 @@ -/***************************************************************************** -ms_cfg.h_LT5_Mdbus_wireless - ModularSensors Config - MMW _LT5/Modbus +LTE/WiFi -Status 220927: 0.33.1.aab test for wirelss dBm readings -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 -#define MAYFLY_BAT_A6 4 -#define REPORT_FILTERED_BAT_A6_V -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//For Insitu_Troll specify one or none -//#define Insitu_TrollSdi12_UUID 1 -//#define Insitu_TrollModbus_UUID 1 - -#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -//#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -//Only define 1 below . SENSIRION_SHT4X is on Mayfly 1.x -//#define SENSIRION_SHT4X_UUID -//#define ASONG_AM23XX_UUID 1 - -//Two heavy sensors with power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -//#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "LT500/Modbus Digi WiFi S6/LTE XB3-C-A2 MMW" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -#define UseModem_Module 1 -#if UseModem_Module -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // UseModem_Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID -// Mayfly definitions -#ifdef Insitu_TrollModbus_UUID -#define InsituLTrs485_ACT 1 -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" -#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop -//#define MODBUS_BAUD_RATE 9600 -#define MODBUS_BAUD_RATE 19200 -//Default for AltsoftSerial is SERIAL_8N1 -//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#define MODBUS_SERIAL_CONFIG SERIAL_8E1 -#endif // InsituLTrs485_ACT -#elif defined Insitu_TrollSdi12_UUID -#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_TrollSdi12_UUID -#endif // Insitu_Trollxxx - - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 11 //Knh2rev8b1 -// 22 // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined SENSIRION_SHT4X_UUID -#define SENSIRION_SHT4X_Air_Temperature_UUID "Air_Temperature_UUID" -//#define SENSIRION_SHT4X_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define SENSIRION_SHT4X_Air_Humidity_UUID "Air_Humidity_UUID" -#elif defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// tested Digi LTE -// tested Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -//#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_mmw_test b/a/tu_xx02/src/ms_cfg.h_mmw_test deleted file mode 100644 index d1eec6acb..000000000 --- a/a/tu_xx02/src/ms_cfg.h_mmw_test +++ /dev/null @@ -1,290 +0,0 @@ -/***************************************************************************** -ms_cfg.h_mmw_test - ModularSensors Configuration - testing to MMW/WiFi -- Temperature/Humidity -210326 STATUS 0.28.3 updated cc, not tested - -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 - -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//#define Insitu_TrollSdi12_UUID 1 - -//#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -#define ASONG_AM23XX_UUID 1 - -// sensors with low power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "tu_test basic WiFi" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Instructions: define only one _Module -#define DigiXBeeWifi_Module 1 -//#warning infoMayflyWithDigiXBeeWiFi -//#define DigiXBeeCellularTransparent_Module 1 -//#warning infoMayflyWithDigiXBeeCellTransparent -// #define DigiXBeeLTE_Module 1 - unstable -// #define TINY_GSM_MODEM_SIM800 // Select for a SIM800, SIM900, or variant -// thereof #define TINY_GSM_MODEM_UBLOX // Select for most u-blox cellular -// modems #define TINY_GSM_MODEM_ESP8266 // Select for an ESP8266 using the -// DEFAULT AT COMMAND FIRMWARE End TinyGsmClient.h options -#if defined(DigiXBeeWifi_Module) || defined(DigiXBeeCellularTransparent_Module) -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_Module 1 -#define UseModem_PushData 1 -//Select buildtime Publishers supported. Not all publishers can be supported -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // Modules - -// end of _Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#ifdef Insitu_TrollSdi12_UUID -// Mayfly definitions -#define ITROLL_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLL_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_Troll_UUID - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -//#define InsituLTrs485_ACT 1 -not working -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Height_UUID "KellerNanolevel_Height_UUID" -#define InsituLTrs485_Temp_UUID "KellerNanolevel_Temp_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Default is 19200 lets hope serial works with it. -#define MODBUS_BAUD_RATE 19200 -#endif // InsituLTrs485_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_nano b/a/tu_xx02/src/ms_cfg.h_nano deleted file mode 100644 index 2ac0f3553..000000000 --- a/a/tu_xx02/src/ms_cfg.h_nano +++ /dev/null @@ -1,290 +0,0 @@ -/***************************************************************************** -ms_cfg.h_nano - ModularSensors cfg - KellerNano/Modbus + MMW/WiFi - -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 - -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//#define Insitu_TrollSdi12_UUID 1 - -#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -#define ASONG_AM23XX_UUID 1 - -//One light sensors RS485 with power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "Nano/Modbus Digi WiFi S6/LTE XB3-C-A2 MMW" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Supports DigiXBeeCellularTransparent & DigiXBeeWifi -#define UseModem_Module 1 -#if defined UseModem_Module -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_PushData 1 -//Select buildtime Publishers supported. -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // UseModem_Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#if defined Insitu_TrollSdi12_UUID || defined Insitu_TrollModbus_UUID -// Mayfly definitions -#ifdef Insitu_TrollModbus_UUID -#define InsituLTrs485_ACT 1 -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Depth_UUID "ITROLL_DEPTH_UUID" -#define InsituLTrs485_Temp_UUID "ITROLL_TEMP_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Setup for LT500 is 19200 1Start 8Data, 1Parity Even 1Stop -//#define MODBUS_BAUD_RATE 9600 -#define MODBUS_BAUD_RATE 19200 -//Default for AltsoftSerial is SERIAL_8N1 -//#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#define MODBUS_SERIAL_CONFIG SERIAL_8E1 -#endif // InsituLTrs485_ACT -#elif defined Insitu_TrollSdi12_UUID -#define ITROLLS_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLLS_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_TrollSdi12_UUID -#endif // Insitu_Trollxxx - - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -// Setup for Keller Acculevel is 900 1Start 8Data, Parity None 1Stop -#define MODBUS_BAUD_RATE 9600 -#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -// Setup for Keller Nanolevel is 900 1Start 8Data, Parity None 1Stop -#define MODBUS_BAUD_RATE 9600 -#define MODBUS_SERIAL_CONFIG SERIAL_8N1 -#endif // KellerNanolevel_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -//#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_ts_test b/a/tu_xx02/src/ms_cfg.h_ts_test deleted file mode 100644 index 5c53b4468..000000000 --- a/a/tu_xx02/src/ms_cfg.h_ts_test +++ /dev/null @@ -1,290 +0,0 @@ -/***************************************************************************** -ms_cfg.h_ts_test - ModularSensors Configuration - testing to thingSpeak/WiFi -- Temperature/Humidity -210326 STATUS 0.28.3 updated cc, not tested - -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 - -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//#define Insitu_TrollSdi12_UUID 1 - -//#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -#define ASONG_AM23XX_UUID 1 - -// sensors with low power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "tu_test basic WiFi" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Instructions: define only one _Module -#define DigiXBeeWifi_Module 1 -//#warning infoMayflyWithDigiXBeeWiFi -//#define DigiXBeeCellularTransparent_Module 1 -//#warning infoMayflyWithDigiXBeeCellTransparent -// #define DigiXBeeLTE_Module 1 - unstable -// #define TINY_GSM_MODEM_SIM800 // Select for a SIM800, SIM900, or variant -// thereof #define TINY_GSM_MODEM_UBLOX // Select for most u-blox cellular -// modems #define TINY_GSM_MODEM_ESP8266 // Select for an ESP8266 using the -// DEFAULT AT COMMAND FIRMWARE End TinyGsmClient.h options -#if defined(DigiXBeeWifi_Module) || defined(DigiXBeeCellularTransparent_Module) -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_Module 1 -#define UseModem_PushData 1 -//Select buildtime Publishers supported. Not all publishers can be supported -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -//#define USE_PUB_MMW 1 -#define USE_PUB_TSMQTT 1 -//#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // Modules - -// end of _Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#ifdef Insitu_TrollSdi12_UUID -// Mayfly definitions -#define ITROLL_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLL_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_Troll_UUID - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -//#define InsituLTrs485_ACT 1 -not working -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Height_UUID "KellerNanolevel_Height_UUID" -#define InsituLTrs485_Temp_UUID "KellerNanolevel_Temp_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Default is 19200 lets hope serial works with it. -#define MODBUS_BAUD_RATE 19200 -#endif // InsituLTrs485_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/ms_cfg.h_ub_test b/a/tu_xx02/src/ms_cfg.h_ub_test deleted file mode 100644 index 28a91d19e..000000000 --- a/a/tu_xx02/src/ms_cfg.h_ub_test +++ /dev/null @@ -1,290 +0,0 @@ -/***************************************************************************** -ms_cfg.h_ub_test - ModularSensors Configuration - testing to UBIDOTS/WiFi -- Temperature/Humidity -210326 STATUS 0.28.3 updated cc, not tested - -Written By: Neil Hancock www.envirodiy.org/members/neilh20/ -Development Environment: PlatformIO -Hardware Platform(s): EnviroDIY Mayfly Arduino Datalogger+RS485 Wingboard - -Software License: BSD-3. - Copyright (c) 2018, Neil Hancock - all rights assigned to Stroud Water -Research Center (SWRC) and they may change this title to Stroud Water Research -Center as required and the EnviroDIY Development Team - - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ -#ifndef ms_cfg_h -#define ms_cfg_h -#include // The base Arduino library -// Local default defitions here - -//************************************************************************** -// This configuration is for a standard Mayfly0.5b -// Sensors Used - two std to begin then -//#define AnalogProcEC_ACT 1 -// Power Availability monitoring decisions use LiIon Voltge, -// Battery Voltage measurements can be derived from a number of sources -// MAYFLY_BAT_A6 - standard measures Solar Charging or LiIon battry V which ever is greated -// MAYFLY_BAT_AA0 - ExternalVolt/ADS1115 requires external R - ECO4 -// MAYFLY_BAT_STC3100 sensor IC on RS485 WINGBOARD_KNH002 -// MAYFLY_BAT_DIGI Digi Modem LTE with onboard battery measurement -// Choices applied to define MAYFLY_BAT_xx 1) Stc3100 2) ExternVolage_ACT 3) Digi Mode 4) MAYFLY_BAT_A6 - -#define MAYFLY_BAT_A6 4 -//#define MAYFLY_BAT_AA0 2 -//FUT #define MAYFLY_BAT_DIGI 3 - - -//#define ENVIRODIY_MAYFLY_TEMPERATURE 1 -//#define Decagon_CTD_UUID 1 -//#define Insitu_TrollSdi12_UUID 1 - -//#define WINGBOARD_KNH002 1 -#if defined WINGBOARD_KNH002 -//This supports RS485 1.9W and STC3100 -//#define USE_STC3100_DD 1 -#define MAYFLY_BAT_STC3100 1 -// Only one of NOT both KellerAcculevel and KellerNanolevel as share same ADDR -//#define KellerAcculevel_ACT 1 -// KellerAcculevel units can be 1 (meter) 2 (feet) -//#define KellerAcculevel_DepthUnits 2 - -//#define KellerNanolevel_ACT 1 -#endif //WINGBOARD_KNH002 - -//Select one of following MAYFLY_BAT_xx as the source for BatterManagement Analysis -#define MAYFLY_BAT_CHOICE MAYFLY_BAT_A6 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_AA0 -//#define MAYFLY_BAT_CHOICE MAYFLY_BAT_STC3100 -// FUT #define MAYFLY_BAT_CHOICE MAYFLY_BAT_DIGI - -#define ASONG_AM23XX_UUID 1 - -// sensors with low power useage -#define BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC BM_PWR_LOW_REQ - -// Mayfly configuration -// Carrier board for Digi XBEE LTE CAT-M1 and jumper from battery -// Digi WiFi S6 plugged in directly -// For debug: C4 removed, strap for AA2/Vbat AA3/SolarV, -#define MFVersion_DEF "v0.5b" -#define MFName_DEF "Mayfly" -#define HwVersion_DEF MFVersion_DEF -#define HwName_DEF MFName_DEF -#define CONFIGURATION_DESCRIPTION_STR "tu_test basic WiFi" - -#define USE_MS_SD_INI 1 -#define USE_PS_EEPROM 1 -#define USE_PS_HW_BOOT 1 - -//#define USE_PS_modularSensorsCommon 1 - -#define greenLEDPin 8 // MCU pin for the green LED (-1 if not applicable) -#define redLEDPin 9 // MCU pin for the red LED (-1 if not applicable) - -#define sensorPowerPin_DEF 22 -#define modemSleepRqPin_DEF 23 -#define modemStatusPin_DEF \ - 19 // MCU pin used to read modem status (-1 if not applicable) -#define modemResetPin_DEF \ - 20 // MCU pin connected to modem reset pin (-1 if unconnected) - -#define LOGGERID_DEF_STR "msLog01" -#define NEW_LOGGERID_MAX_SIZE 40 -#define configIniID_DEF_STR "ms_cfg.ini" -#define CONFIG_TIME_ZONE_DEF -8 - -// ** How frequently (in minutes) to log data ** -// For two Loggers defined logger2Mult with the faster loggers timeout and the -// multiplier to the slower loggger -// #define loggingInterval_Fast_MIN (1) -// #define logger2Mult 5 ~Not working for mayfly - -// How frequently (in minutes) to log data -#if defined logger2Mult -#define loggingInterval_CDEF_MIN (loggingInterval_Fast_MIN * logger2Mult) -#else -#define loggingInterval_CDEF_MIN 15 -#endif // logger2Mult -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - -// Maximum logging setting allowed -#define loggingInterval_MAX_CDEF_MIN 6 * 60 - - -// Instructions: define only one _Module -#define DigiXBeeWifi_Module 1 -//#warning infoMayflyWithDigiXBeeWiFi -//#define DigiXBeeCellularTransparent_Module 1 -//#warning infoMayflyWithDigiXBeeCellTransparent -// #define DigiXBeeLTE_Module 1 - unstable -// #define TINY_GSM_MODEM_SIM800 // Select for a SIM800, SIM900, or variant -// thereof #define TINY_GSM_MODEM_UBLOX // Select for most u-blox cellular -// modems #define TINY_GSM_MODEM_ESP8266 // Select for an ESP8266 using the -// DEFAULT AT COMMAND FIRMWARE End TinyGsmClient.h options -#if defined(DigiXBeeWifi_Module) || defined(DigiXBeeCellularTransparent_Module) -// The Modem is used to push data and also sync Time -// In standalong logger, no internet, Modem can be required at factor to do a -// sync Time Normally enable both of the following. In standalone, disable -// UseModem_PushData. -#define UseModem_Module 1 -#define UseModem_PushData 1 -//Select buildtime Publishers supported. Not all publishers can be supported -// The persisten resources (EEPROM) are allocated as a baselevel no matter what options -//#define USE_PUB_MMW 1 -//#define USE_PUB_TSMQTT 1 -#define USE_PUB_UBIDOTS 1 - -// Required for TinyGsmClient.h -#define TINY_GSM_MODEM_XBEE - -// The APN for the gprs connection, unnecessary for WiFi -#define APN_CDEF "VZWINTERNET" - -// The WiFi access point never set to real, as should be set by config. -#define WIFIID_CDEF "WiFiIdDef" -// NULL for none, or password for connecting to WiFi, -#define WIFIPWD_CDEF "WiFiPwdDef" -#define MMW_TIMER_POST_TIMEOUT_MS_DEF 5000L -//POST PACING ms 0-15000 -#define MMW_TIMER_POST_PACING_MS_DEF 100L -//Post MAX Num - is num of MAX num at one go. 0 no limit -//#define MMWGI_POST_MAX_RECS_MUM_DEF 100 //ms_common.h -//Manage Internet - common for all providers -#define MNGI_COLLECT_READINGS_DEF 1 -#define MNGI_SEND_OFFSET_MIN_DEF 0 -#endif // Modules - -// end of _Module - -// This might need revisiting -#define ARD_ANLAOG_MULTIPLEX_PIN A6 - -//#define SENSOR_CONFIG_GENERAL 1 -//#define KellerAcculevel_ACT 1 -// Defaults for data.envirodiy.org -#define registrationToken_UUID "registrationToken_UUID" -#define samplingFeature_UUID "samplingFeature_UUID" - - -#ifdef Decagon_CTD_UUID -// Mayfly definitions -#define CTD10_DEPTH_UUID "CTD10_DEPTH_UUID" -#define CTD10_TEMP_UUID "CTD10_TEMP_UUID" -#define CTD10_COND_UUID "CTD10_COND_UUID" -#endif // Decagon_CTD_UUID - - -#ifdef Insitu_TrollSdi12_UUID -// Mayfly definitions -#define ITROLL_DEPTH_UUID "ITROLL_DEPTH_UUID" -#define ITROLL_TEMP_UUID "ITROLL_TEMP_UUID" -//#define ITROLL_PRESSURE_UUID "ITROLL_PRESSURE_UUID" -#endif // Insitu_Troll_UUID - - -#ifdef KellerAcculevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerAcculevelModbusAddress_DEF 0x01 -#endif // KellerAcculevel_ACT - -#ifdef KellerNanolevel_ACT -#define KellerXxlevel_Height_UUID "KellerXxlevel_Height_UUID" -#define KellerXxlevel_Temp_UUID "KellerXxlevel_Temp_UUID" -#define CONFIG_SENSOR_RS485_PHY 1 -#define KellerNanolevelModbusAddress_DEF 0x01 -#endif // KellerNanolevel_ACT - -//#define InsituLTrs485_ACT 1 -not working -#ifdef InsituLTrs485_ACT -#define CONFIG_SENSOR_RS485_PHY 1 -#define InsituLTrs485_Height_UUID "KellerNanolevel_Height_UUID" -#define InsituLTrs485_Temp_UUID "KellerNanolevel_Temp_UUID" -#define InsituLTrs485ModbusAddress_DEF 0x01 -// Default is 19200 lets hope serial works with it. -#define MODBUS_BAUD_RATE 19200 -#endif // InsituLTrs485_ACT - -#ifdef CONFIG_SENSOR_RS485_PHY -// Mayfly definitions -#define CONFIG_HW_RS485PHY_TX_PIN 5 // Mayfly OCRA1 map AltSoftSerial Tx pin -#define CONFIG_HW_RS485PHY_RX_PIN 6 // Mayfly ICES1 map AltSoftSerial Rx pin -#define CONFIG_HW_RS485PHY_DIR_PIN -1 -#define max485EnablePin_DEF -1 -#define rs485AdapterPower_DEF \ - 22 // Pin to switch RS485 adapter power on and off (-1 if unconnected) -#define modbusSensorPower_DEF \ - 22; // Pin to switch power on and off (-1 if unconnected) -#ifndef MODBUS_BAUD_RATE -#define MODBUS_BAUD_RATE 9600 -#endif // MODBUS_BAUD_RATE -#endif // CONFIG_SENSOR_RS485_PHY - - -#ifdef AnalogProcEC_ACT -#define EC1_UUID "EC1_UUID" -#define ECpwrPin_DEF A4 -#define ECdataPin1_DEF A0 -#endif // AnalogProcEC_ACT - -//#define INA219M_PHY_ACT 1 -#ifdef INA219M_PHY_ACT -#define INA219M_MA_UUID "INA219_MA_UUID" -#define INA219M_VOLT_UUID "INA219_VOLT_UUID" -#endif // INA219_PHY_ACT - -#if defined ASONG_AM23XX_UUID -#define ASONG_AM23_Air_Temperature_UUID "Air_Temperature_UUID" -#define ASONG_AM23_Air_TemperatureF_UUID "Air_TemperatureF_UUID" -#define ASONG_AM23_Air_Humidity_UUID "Air_Humidity_UUID" -#endif // ASONG_AM23XX_UUID - - -#ifdef ENVIRODIY_MAYFLY_TEMPERATURE -#define MaximDS3231_TEMP_UUID "MaximDS3231_TEMP_UUID" -//#define MaximDS3231_TEMPF_UUID "MaximDS3231_TEMPF_UUID" -#endif // ENVIRODIY_MAYFLY_TEMPERATURE - -#if defined UseModem_Module -// This seems to be de-stabilizing Digi S6B -//#define DIGI_RSSI_UUID "DIGI_RSSI_UUID" -//#define Modem_SignalPercent_UUID "SignalPercent_UUID" -#endif // UseModem_Module - -#define ProcessorStats_ACT 1 -#if defined ProcessorStats_ACT -#define ProcessorStats_SampleNumber_UUID "SampleNumber_UUID" -#endif // ProcessorStats_ACT -#if defined MAYFLY_BAT_A6 -#define ProcessorStats_Batt_UUID "Batt_UUID" -#endif // MAYFLY_BAT_A6 - -#if defined MAYFLY_BAT_STC3100 -#define STC3100_Volt_UUID "STC3100Volt_UUID" -#define STC3100_USED1_mAhr_UUID "STC3100used1_mAhr_UUID" -#define STC3100_AVLBL_mAhr_UUID "STC3100avlbl_mAhr_UUID" -#endif // MAYFLY_BAT_STC3100 - -#ifdef MAYFLY_BAT_AA0 -// AA0(AIN0) is 1/10 of Vbat using R+R divider. Requires Mayfly ECO 04 -//#define ExternalVoltage_Volt0_UUID "Batt_UUID" -#define ExternalVoltage_Volt0_UUID "Volt0_UUID" -//#define ExternalVoltage_Volt1_UUID "Volt1_UUID" -//#else // MAYFLY_BAT_AA0 -#endif // MAYFLY_BAT_AA0 -#if 0// defined MAYFLY_BAT_A6 -#define ProcVolt_ACT 1 -#if defined ProcVolt_ACT -#define ProcVolt0_UUID "Batt_UUID" -//#define ProcVolt0_UUID "Volt0_UUID" -//#define ProcVolt1_UUID "Volt1_UUID" -#endif // ProcVolt_ACT -#endif // MAYFLY_BAT_A6 - -#endif // ms_cfg_h diff --git a/a/tu_xx02/src/tu_serialCmd.h b/a/tu_xx02/src/tu_serialCmd.h deleted file mode 100644 index 0fd7cb047..000000000 --- a/a/tu_xx02/src/tu_serialCmd.h +++ /dev/null @@ -1,166 +0,0 @@ -// ========================================================================== -// tu_serialCmd.h -// -// Utilites for processing user input. -// This is initailly from Serial Uart, -// future could be from other serial sources, including BT - -// This file has its commands defined per specific application requirements. -// Some functions, like listing mircoSD and Date function are likely to be commmon. -// It is included in the top level file -// i.e. tu_xx01.cpp -// and two functions called -// tu2setup() -// tu2SerialInputPoll() -// ========================================================================== -#ifndef SRC_TU_SERIALCMD_H_ -#define SRC_TU_SERIALCMD_H_ - -#include - -SerialCommand tu2sc; - -#define USERHELP "\n\ -LR - list the readings\n\ -L? - list the directory\n\ -D,yymmdd,hhmm to set date/time\n\ -D? to print current date/time\n\ -? for this help\n" - -void tu2Help() { - PRINTOUT(F(USERHELP)); -} - -void tu2cmdListDir() { - dataLogger.SD1_ListDir(); -} -void tu2cmdListReadings() { - dataLogger.SD1_ListReadings(); -} -void tu2Unknown(const char *command) { - PRINTOUT(F("Unknown input ")); - tu2Help(); -} - -void tu2cmdDateNow (){ - // date - PRINTOUT(F("Local Time "),dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); -} - -// ========================================================================== -// parseTwoDigits -// Simple helper function -uint8_t parseTwoDigitsError =0; -uint16_t parseTwoDigits(const char *digits) { - uint16_t num=0; - if ( !isdigit(digits[0]) || !isdigit(digits[1]) ) { - MS_DBG(F("parseTwoDigits error with "),digits[0],digits[1] ); - parseTwoDigitsError =1; - } else { - num = (digits[0]-'0')*10 + - (digits[1]-'0'); - } - return num; -} // parseTwoDigits - -void tu2cmdDate (){ - // date - PRINTOUT(F("Local Time "),dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); - char *argcin; - - argcin = tu2sc.next(); - if (NULL != argcin) { - #ifdef SERIALCOMMAND_DEBUG - Serial.print("parsing: '"); - Serial.println(argcin); - #endif - parseTwoDigitsError =0; - uint16_t year = parseTwoDigits(&argcin[1]); - uint8_t month = parseTwoDigits(&argcin[3]); - uint8_t day = parseTwoDigits(&argcin[5]); - uint8_t hour = parseTwoDigits(&argcin[8]); - uint8_t minute= parseTwoDigits(&argcin[10]); - if (0==parseTwoDigitsError) { - DateTime dt(year,month,day,hour,minute,0,0); - dataLogger.setRTClock(dt.getEpoch()-dataLogger.getTZOffset()*HOURS_TO_SECS); - PRINTOUT(F("Time set to "),dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); - // DateTime (uint16_t year, uint8_t month, uint8_t date, - //uint8_t hour, uint8_t min, uint8_t sec, uint8_t wday); - } //else err - } -} - -#define SC_COMMAND_NUMBER 5 -const static PROGMEM SerialCommand::SerialCommandCallback sc_commandList[SC_COMMAND_NUMBER ] = -{ - //List in search order, 1st match is used - {"D",tu2cmdDate}, - {"D?",tu2cmdDateNow}, - {"LR",tu2cmdListReadings}, - {"L?",tu2cmdListDir}, - {"?",tu2Help}, -}; - - -void tu2setup() { - tu2sc.setCommandList(sc_commandList,SC_COMMAND_NUMBER); - tu2sc.setDefaultHandler(tu2Unknown); -} - - - -// ========================================================================== - -bool userInputCollection=false; - - -// ========================================================================== -// Serial Input Driver -// serial Input & FUT: eRPC (eRPC needs to enable UART interrupt) -// -// Serial buffer max SERIAL_RX_BUFFER_SIZE 64 chars -// -// The serial input is very error pront -// - -void tu2SerialInputPoll() -{ - //char incoming_ch; - long timer_start_ms, timer_activity_ms,timer_now_ms; - timer_start_ms=timer_activity_ms=millis(); - //20 seconds between key strokes -#define TIMER_TIMEOUT_NOACTIVITY_MS 20000 - // 180sec total timer -#define TIMER_TIMEOUT_LIMIT_MS 180000 - - PRINTOUT(F("\n\n"), (char*)epc.app.msc.s.logger_id,configDescription); - PRINTOUT(MODULAR_SENSORS_VERSION,F("@"), epc.app.msc.s.logging_interval_min, - F("min,"),dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); - PRINTOUT(F(" Enter cmd: ? for help.(need a key to be typed every "), TIMER_TIMEOUT_NOACTIVITY_MS/1000,F("secs)")); - while (userInputCollection ) { - if(Serial.available() != 0) { - dataLogger.watchDogTimer.resetWatchDog(); - timer_activity_ms = millis(); - tu2sc.readSerial(); // When a user tuple has been detected, parse it, - } - //delay(1); // limit polling ~ the single character input is error prone ?? - - //If it takes too long, break out of collecting input - timer_now_ms = millis(); - if (TIMER_TIMEOUT_NOACTIVITY_MS < (timer_now_ms - timer_activity_ms) ) { - PRINTOUT(F(" No keyboard activity for"), TIMER_TIMEOUT_NOACTIVITY_MS/1000,F("secs. Returning to normal logging.")); - tu2sc.clearBuffer(); - break; - } - if (TIMER_TIMEOUT_LIMIT_MS < (timer_now_ms - timer_start_ms) ) { - PRINTOUT(F(" Took too long, need to complete within "), TIMER_TIMEOUT_LIMIT_MS/1000,F("secs. Returning to normal logging.")); - tu2sc.clearBuffer(); - break; - } - - } //while - - dataLogger.watchDogTimer.resetWatchDog(); -}//serialInputCheck - -#endif //SRC_TU_SERIALCMD_H_ \ No newline at end of file diff --git a/a/tu_xx02/src/tu_xx02.cpp b/a/tu_xx02/src/tu_xx02.cpp deleted file mode 100644 index 8c7719051..000000000 --- a/a/tu_xx02/src/tu_xx02.cpp +++ /dev/null @@ -1,2048 +0,0 @@ -/***************************************************************************** -tu_xx02.cpp -Based on examples/logging_to_MMW.ino -Adapted by Neil Hancock from Matt Barney - -Orginially Written By: Sara Damiano (sdamiano@stroudcenter.org) -Development Environment: PlatformIO -Hardware Platform: EnviroDIY Mayfly Arduino Datalogger -Software License: BSD-3. - Copyright (c) 2022, Neil Hancock - Copyright (c) 2020, Trout Unlimited, Stroud Water Research Center (SWRC) - and the EnviroDIY Development Team - -This implements a reliable interface to a specific set of sensors and some -paramters are configured in a file on the uSD ms_cfg.ini - -DISCLAIMER: -THIS CODE IS PROVIDED "AS IS" - NO WARRANTY IS GIVEN. -*****************************************************************************/ - -// ========================================================================== -// Defines for the Arduino IDE -// In PlatformIO, set these build flags in your platformio.ini -// ========================================================================== -#ifndef TINY_GSM_RX_BUFFER -#define TINY_GSM_RX_BUFFER 64 -#endif -#ifndef TINY_GSM_YIELD_MS -#define TINY_GSM_YIELD_MS 2 -#endif -#ifndef MQTT_MAX_PACKET_SIZE -#define MQTT_MAX_PACKET_SIZE 240 -#endif - -// ========================================================================== -// Include the base required libraries -// ========================================================================== -#include "ms_cfg.h" //must be before ms_common.h & Arduino.h -#if defined TINY_GSM_MODEM_XBEE -#error for SIM7080G dont define TINY_GSM_MODEM_XBEE -#endif -// Use MS_DBG() -#ifdef MS_TU_XX_DEBUG -#undef MS_DEBUGGING_STD -#define MS_DEBUGGING_STD "tu_ctd" -#define MS_DEBUG_THIS_MODULE 1 -#endif // MS_TU_XX_DEBUG - -#ifdef MS_TU_XX_DEBUG_DEEP -#undef MS_DEBUGGING_DEEP -#define MS_DEBUGGING_DEEP "tu_ctdD" -#undef MS_DEBUG_THIS_MODULE -#define MS_DEBUG_THIS_MODULE 2 -#endif // MS_TU_XX_DEBUG_DEEP -#include "ModSensorDebugger.h" -#undef MS_DEBUGGING_STD -#undef MS_DEBUGGING_DEEP -#include // The base Arduino library -#include // for external and pin change interrupts -#include // Include the main header for ModularSensors -#if defined USE_PS_EEPROM -#include "EEPROM.h" -#endif // USE_PS_EEPROM -#include "ms_common.h" - -// ========================================================================== -// Data Logger Settings -// ========================================================================== -// The name of this file -extern const String build_ref = "a\\" __FILE__ " " __DATE__ " " __TIME__ " "; -#ifdef PIO_SRC_REV -const char git_branch[] = PIO_SRC_REV; -#else -const char git_branch[] = "brnch"; -#endif -#ifdef PIO_SRC_USR -const char git_usr[] = PIO_SRC_USR; -#else -const char git_usr[] = "usr"; -#endif -// Logger ID, also becomes the prefix for the name of the data file on SD card -const char* LoggerID = LOGGERID_DEF_STR; -const char* configIniID_def = configIniID_DEF_STR; -const char* configDescription = CONFIGURATION_DESCRIPTION_STR; - -// How frequently (in minutes) to log data -const uint8_t loggingIntervaldef = loggingInterval_CDEF_MIN; - -// ========================================================================== -// Local storage - evolving -// ========================================================================== -#ifdef USE_MS_SD_INI -persistent_store_t ps_ram; -#define epc ps_ram -#endif //#define USE_MS_SD_INI - -// ========================================================================== -// Primary Arduino-Based Board and Processor -// ========================================================================== -#include -BatteryManagement bms; - -#include - -const long serialBaud = - 115200; // Baud rate for the primary serial port for debugging -const int8_t greenLED = 8; // MCU pin for the green LED (-1 if not applicable) -const int8_t redLED = 9; // MCU pin for the red LED (-1 if not applicable) -const int8_t buttonPin = 21; // MCU pin for a button to use to enter debugging - // mode (-1 if not applicable) -const int8_t wakePin = A7; // MCU interrupt/alarm pin to wake from sleep -// Set the wake pin to -1 if you do not want the main processor to sleep. -// In a SAMD system where you are using the built-in rtc, set wakePin to 1 -const int8_t sdCardPwrPin = -1; // MCU SD card power pin (-1 if not applicable) -const int8_t sdCardSSPin = - 12; // MCU SD card chip select/slave select pin (must be given!) -const int8_t sensorPowerPin = - 22; // MCU pin controlling main sensor power (-1 if not applicable) - -// Create the main processor chip "sensor" - for general metadata -typedef enum {BT_MAYFLY_0_5, BT_MAYFLY_1_0, BT_last} bt_BoardType_t; -const char* mcuBoardVersion_1_x = "v1.0"; -const char* mcuBoardVersion_0_5 = "v0.5b"; -ProcessorStats mcuBoardPhy(mcuBoardVersion_1_x); //Define board default - -// ========================================================================== -// Settings for Additional Serial Ports -// ========================================================================== - -// The modem and a number of sensors communicate over UART/TTL - often called -// "serial". "Hardware" serial ports (automatically controlled by the MCU) are -// generally the most accurate and should be configured and used for as many -// peripherals as possible. In some cases (ie, modbus communication) many -// sensors can share the same serial port. - -#if defined(ARDUINO_ARCH_AVR) || defined(__AVR__) // 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 - -// AltSoftSerial by Paul Stoffregen -// (https://github.com/PaulStoffregen/AltSoftSerial) is the most accurate -// software serial port for AVR boards. AltSoftSerial can only be used on one -// set of pins on each board so only one AltSoftSerial port can be used. Not all -// AVR boards are supported by AltSoftSerial. AltSoftSerial is capable of -// running up to 31250 baud on 16 MHz AVR. Slower baud rates are recommended -// when other code may delay AltSoftSerial's interrupt response. -// Pins In/Rx 6 Out/Tx=5 -#include -AltSoftSerial altSoftSerialPhy; - -// 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. -// Not all AVR boards are supported by NeoSWSerial. -#if 0 -#include // for the stream communication -const int8_t neoSSerial1Rx = 11; // data in pin -const int8_t neoSSerial1Tx = -1; // data out pin -NeoSWSerial neoSSerial1(neoSSerial1Rx, neoSSerial1Tx); -// To use NeoSWSerial in this library, we define a function to receive data -// This is just a short-cut for later -void neoSSerial1ISR() -{ - NeoSWSerial::rxISR(*portInputRegister(digitalPinToPort(neoSSerial1Rx))); -} -#endif -#if 0 // Not used -// The "standard" software serial library uses interrupts that conflict -// with several other libraries used within this program, we must use a -// version of software serial that has been stripped of interrupts. -// NOTE: Only use if necessary. This is not a very accurate serial port! -const int8_t softSerialRx = A3; // data in pin -const int8_t softSerialTx = A4; // data out pin - -#include // for the stream communication -SoftwareSerial_ExtInts softSerial1(softSerialRx, softSerialTx); -#endif -#endif // End software serial for avr boards -// ========================================================================== -// Wifi/Cellular Modem Settings -// ========================================================================== - -// Create a reference to the serial port for the modem -// Extra hardware and software serial ports are created in the "Settings for -// Additional Serial Ports" section -HardwareSerial& modemSerial = Serial1; // Use hardware serial if possible -#define modemSerHw modemSerial - -// Modem Pins - Describe the physical pin connection of your modem to your board -#define MODEM_VCC_CE_PIN 18 -// Set the default for startup -const int8_t modemVccPin_mayfly_1_x = MODEM_VCC_CE_PIN; //Pin18 on Xbee Mayfly v1.x, -const int8_t modemVccPin_mayfly_0_5 = -2; //No power control rev 0.5b -#define modemVccPin modemVccPin_mayfly_1_x - -const int8_t modemStatusPin = - 19; // MCU pin used to read modem status (-1 if not applicable) -const int8_t modemResetPin = -1;//20? MCU modem reset pin (-1 if unconnected) -const int8_t modemSleepRqPin = - 23; // MCU pin used for modem sleep/wake request (-1 if not applicable) -const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status (-1 if unconnected) -const int8_t I2CPower = -1; // sensorPowerPin; Needs to remain on if any IC powered like STC3100/KNH002 - // off (-1 if unconnected) - -#if defined BUILD_MODEM_TYPE - -#if BUILD_MODEM_TYPE == BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT -/** Start [digi_xbee_cellular_transparent] */ -// For any Digi Cellular XBee's -// NOTE: The u-blox based Digi XBee's (3G global and LTE-M global) can be used -// in either bypass or transparent mode, each with pros and cons -// The Telit based Digi XBees (LTE Cat1) can only use this mode. -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section -const int32_t modemBaud = 9600; // All XBee's use 9600 by default - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply -// The pin numbers here are for a Digi XBee with a Mayfly 0.x and LTE adapter -// For options https://github.com/EnviroDIY/LTEbee-Adapter/edit/master/README.md -//const int8_t modemVccPin = -1; // MCU pin controlling modem power - // Option: modemVccPin = A5, if Mayfly SJ7 is - // connected to the ASSOC pin -//const int8_t modemStatusPin = 19; // MCU pin used to read modem status -// NOTE: If possible, use the `STATUS/SLEEP_not` (XBee pin 13) for status, but -// the CTS pin can also be used if necessary -const bool useCTSforStatus = false; // Flag to use the CTS pin for status -//const int8_t modemResetPin = 20; // MCU pin connected to modem reset pin -//const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request -//const int8_t modemLEDPin = redLED; // MCU pin connected an LED - -// Network connection information -const char* apn = "xxxxx"; // APN for GPRS connection - -// Create the modem object -DigiXBeeCellularTransparent modemXBCT(&modemSerial, modemVccPin, modemStatusPin, - useCTSforStatus, modemResetPin, - modemSleepRqPin, apn); -// Create an extra reference to the modem by a generic name -DigiXBeeCellularTransparent modemPhy = modemXBCT; -/** End [digi_xbee_cellular_transparent] */ -// ========================================================================== - -#elif BUILD_MODEM_TYPE == BUILD_MODEM_DIGI_XBEE_WIFI -/** Start [digi_xbee_wifi] */ -// For the Digi Wifi XBee (S6B) -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section -const int32_t modemBaud = 9600; // All XBee's use 9600 by default - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply -// The pin numbers here are for a Digi XBee direcly connected to a Mayfly 1.x -//const int8_t modemVccPin = 18; // MCU pin controlling modem power -//const int8_t modemStatusPin = 19; // MCU pin used to read modem status -// NOTE: If possible, use the `STATUS/SLEEP_not` (XBee pin 13) for status, but -// the CTS pin can also be used if necessary -const bool useCTSforStatus = true; // Flag to use the CTS pin for status -//const int8_t modemResetPin = A5; // MCU pin connected to modem reset pin -//const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request -//const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status - -// Network connection information -const char* wifiId = "xxxxx"; // WiFi access point name -const char* wifiPwd = "xxxxx"; // WiFi password (WPA2) - -// Create the modem object -DigiXBeeWifi modemXBWF(&modemSerial, modemVccPin, modemStatusPin, - useCTSforStatus, modemResetPin, modemSleepRqPin, wifiId, - wifiPwd); -// Create an extra reference to the modem by a generic name -DigiXBeeWifi modemPhy = modemXBWF; -/** End [digi_xbee_wifi] */ -// ========================================================================== - -#elif (BUILD_MODEM_TYPE == BUILD_MODEM_ESPRESSIF_ESP8266) || \ - (BUILD_MODEM_TYPE == BUILD_MODEM_ESPRESSIF_ESP32) -/** Start [espressif_esp8266] */ -// For almost anything based on the Espressif ESP8266 using the -// AT command firmware -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section -#define ESP32_MODEM_115K_BAUD 115200 -#define ESP32_MODEM_57K_BAUD 57600 -#define ESP32_MODEM_9K6_BAUD 9600 -#define ESP32_MODEM_DEF_BAUD ESP32_MODEM_57K_BAUD -const int32_t modemBaud = ESP32_MODEM_DEF_BAUD; // Communication speed of the modem -// NOTE: This baud rate too fast for an 8MHz board, like the Mayfly! The -// module should be programmed to a slower baud rate or set to auto-baud using -// the AT+UART_CUR or AT+UART_DEF command. - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply -// Example pins here are for a EnviroDIY ESP32 Bluetooth/Wifi Bee with -// Mayfly 1.1 -//const int8_t modemVccPin = 18; // MCU pin controlling modem power -//const int8_t modemResetPin = A5; // MCU pin connected to modem reset pin -//const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status - -// Network connection information -const char* wifiId = "xxxxx"; // WiFi access point name -const char* wifiPwd = "xxxxx"; // WiFi password (WPA2) - -// Create the modem object -EspressifESP8266 modemESP(&modemSerial, modemVccPin, modemResetPin, wifiId, - wifiPwd); -// Create an extra reference to the modem by a generic name -EspressifESP8266 modemPhy = modemESP; -/** End [espressif_esp8266] */ -// ========================================================================== -#elif BUILD_MODEM_TYPE == BUILD_MODEM_SIM_COM_SIM7080 -/** Start [sim_com_sim7080] */ -// For almost anything based on the SIMCom SIM7080G -#include - -// NOTE: Extra hardware and software serial ports are created in the "Settings -// for Additional Serial Ports" section -const int32_t modemBaud = - 9600; // SIM7080 does auto-bauding by default, but I set mine to 9600 - -// Modem Pins - Describe the physical pin connection of your modem to your board -// NOTE: Use -1 for pins that do not apply -// and-global breakout bk-7080a -//const int8_t modemVccPin = 18; // MCU pin controlling modem power -//const int8_t modemStatusPin = 19; // MCU pin used to read modem status -//const int8_t modemSleepRqPin = 23; // MCU pin for modem sleep/wake request -//const int8_t modemLEDPin = redLED; // MCU pin connected an LED to show modem - // status - -// Network connection information -const char* apn = APN_CDEF; // APN for GPRS connection - -// Create the modem object -SIMComSIM7080 modem7080(&modemSerial, modemVccPin, modemStatusPin, - modemSleepRqPin, apn); -// Create an extra reference to the modem by a generic name -SIMComSIM7080 modemPhy = modem7080; -/** End [sim_com_sim7080] */ -// ========================================================================== -#elif BUILD_MODEM_TYPE == BUILD_MODEM_FACTORY - -#include -// Network connection information -const char* apn_def = - APN_CDEF; // The APN for the gprs connection, unnecessary for WiFi -const char* wifiId_def = - WIFIID_CDEF; // The WiFi access point, unnecessary for gprs -const char* wifiPwd_def = - WIFIPWD_CDEF; // The password for connecting to WiFi, unnecessary for gprs -const long modemBaud = 9600; // All XBee's use 9600 by default -const bool useCTSforStatus = - false; // true? Flag to use the XBee CTS pin for status - - loggerModem* loggerModemPhyInst=NULL ;//was modemPhy -#define loggerModemPhyDigiWifi ((DigiXBeeWifi *) loggerModemPhyInst) -#define loggerModemPhyDigiCell ((DigiXBeeCellularTransparent *) loggerModemPhyInst) - -#if defined DIGI_RSSI_UUID -//The loggerModemPhyInst is created at run time -Variable* modemPhyRssi_var = new Modem_RSSI(loggerModemPhyInst); -float modemPhyRssiGetValue(void) { // Can't get value till instatiated - if (NULL==loggerModemPhyInst) return 0; - - return modemPhyRssi_var->getValue(true); -} -// Create the calculated RSSI Variable object -Variable* modemPhyRssi_calc = - new Variable(modemPhyRssiGetValue, // function that does the calculation - MODEM_RSSI_RESOLUTION, // resolution - MODEM_RSSI_UNIT_NAME, // var name. - //from http://vocabulary.odm2.org/variablename/ - "dBm", // var unit. - //from http://vocabulary.odm2.org/units/ - MODEM_RSSI_DEFAULT_CODE, // var code MODEM_RSSI_DEFAULT_CODE - DIGI_RSSI_UUID); -#endif //DIGI_RSSI_UUID -#else //no others BUILD_MODEM -#error NEED TO DEFINE A BUILD_MODEM -#endif //BUID_MODEM -#endif // BUILD_MODEM_TYPE - -// ========================================================================== -// Create a reference to the serial port for modbus -// Extra hardware and software serial ports are created in the "Settings for -// Additional Serial Ports" section -#if defined(KellerAcculevel_ACT) || defined(KellerNanolevel_ACT) || defined InsituLTrs485_ACT -#if defined SerialModbus && (defined ARDUINO_ARCH_SAMD || defined ATMEGA2560) -HardwareSerial& modbusSerial = SerialModbus; // Use hardware serial if possible -#else -AltSoftSerial& modbusSerial = - altSoftSerialPhy; // For software serial if needed -// NeoSWSerial &modbusSerial = neoSSerial1; // For software serial if needed -#endif //SerialModbus -// byte acculevelModbusAddress = KellerAcculevelModbusAddress; // The modbus -// address of KellerAcculevel -const int8_t rs485AdapterPower = - rs485AdapterPower_DEF; // Pin to switch RS485 adapter power on and off (-1 - // if unconnected) -const int8_t modbusSensorPower = - modbusSensorPower_DEF; // Pin to switch sensor power on and off (-1 if - // unconnected) -const int8_t max485EnablePin = - max485EnablePin_DEF; // Pin connected to the RE/DE on the 485 chip (-1 if - // unconnected) - -const int8_t RS485PHY_TX_PIN = CONFIG_HW_RS485PHY_TX_PIN; -const int8_t RS485PHY_RX_PIN = CONFIG_HW_RS485PHY_RX_PIN; -const int8_t RS485PHY_DIR_PIN = CONFIG_HW_RS485PHY_DIR_PIN; - -#endif // KellerXx Insitu - -// ========================================================================== -// Units conversion functions -// ========================================================================== -#define SENSOR_T_DEFAULT_F -0.009999 -float convertDegCtoF(float tempInput) { // Simple deg C to deg F conversion - if (-9999 == tempInput) return SENSOR_T_DEFAULT_F; - if (SENSOR_T_DEFAULT_F == tempInput) return SENSOR_T_DEFAULT_F; - return tempInput * 1.8 + 32; -} - -float convertMmtoIn(float mmInput) { // Simple millimeters to inches conversion - if (-9999 == mmInput) return SENSOR_T_DEFAULT_F; - if (SENSOR_T_DEFAULT_F == mmInput) return SENSOR_T_DEFAULT_F; - return mmInput / 25.4; -} -float convert_mtoFt(float mInput) { // meters to feet conversion - if (-9999 == mInput) return SENSOR_T_DEFAULT_F; - if (SENSOR_T_DEFAULT_F == mInput) return SENSOR_T_DEFAULT_F; - -#define meter_to_feet 3.28084 - // (1000 * mInput) / (25.4 * 12); - return (meter_to_feet * mInput); -} - -#if 0 -// ========================================================================== -// Campbell OBS 3 / OBS 3+ Analog Turbidity Sensor -// ========================================================================== -#include - -const int8_t OBS3Power = sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) -const uint8_t OBS3NumberReadings = 10; -const uint8_t ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC -#endif // 0 -#if defined Decagon_CTD_UUID -// ========================================================================== -// Decagon CTD Conductivity, Temperature, and Depth Sensor -// ========================================================================== -#include - -const char* CTDSDI12address = "1"; // The SDI-12 Address of the CTD -const uint8_t CTDNumberReadings = 6; // The number of readings to average -const int8_t SDI12Power = - sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) -const int8_t SDI12Data = 7; // The SDI12 data pin - -// Create a Decagon CTD sensor object -DecagonCTD ctdPhy(*CTDSDI12address, SDI12Power, SDI12Data, CTDNumberReadings); -#endif // Decagon_CTD_UUID - -// ========================================================================== -// Insitu Level/Aqua Troll High Accuracy Submersible Level Transmitter -// wip Tested for Level Troll 500 -// ========================================================================== -#ifdef InsituLTrs485_ACT //Insitu_TrollModbus_UUID -#include - -const byte ltModbusAddress = - InsituLTrs485ModbusAddress_DEF; // The modbus address of InsituLTrs485 -// const int8_t rs485AdapterPower = sensorPowerPin; // Pin to switch RS485 -// adapter power on and off (-1 if unconnected) const int8_t modbusSensorPower = -// A3; // Pin to switch sensor power on and off (-1 if unconnected) const -// int8_t max485EnablePin = -1; // Pin connected to the RE/DE on the 485 chip -// (-1 if unconnected) -const uint8_t ltNumberReadings = - 3; // The manufacturer recommends taking and averaging a few readings - -// Create a Insitu LT sensor object - -InsituLevelTroll InsituLT_snsr(ltModbusAddress, modbusSerial, rs485AdapterPower, - modbusSensorPower, max485EnablePin, - ltNumberReadings); - -// Create pressure, temperature, and height variable pointers for the Nanolevel -// Variable *nanolevPress = new InsituLTrs485_Pressure(&InsituLT_snsr, -// "12345678-abcd-1234-efgh-1234567890ab"); Variable *nanolevTemp = new -// InsituLTrs485_Temp(&InsituLT_snsr, "12345678-abcd-1234-efgh-1234567890ab"); -// Variable *nanolevHeight = new InsituLTrs485_Height(&InsituLT_snsr, -// "12345678-abcd-1234-efgh-1234567890ab"); - -#endif // InsituLTrs485_ACT -#if defined Insitu_TrollSdi12_UUID //|| defined Insitu_TrollModbus_UUID - -// ========================================================================== -// Insitu Aqua/Level Troll Pressure, Temperature, and Depth Sensor -// ========================================================================== -#include - -const char* ITROLLSDI12address = "1"; // SDI12 Address ITROLL -const uint8_t ITROLLNumberReadings = 2; // The number of readings to average -const int8_t IT_SDI12Power = - sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) -const int8_t IT_SDI12Data = 7; // The SDI12 data pin - -// Create a ITROLL sensor object -InsituTrollSdi12a itrollPhy(*ITROLLSDI12address, IT_SDI12Power, IT_SDI12Data, - ITROLLNumberReadings); -#endif // Insitu_TrollXxx - -// ========================================================================== -// Analog Electrical Conductivity using the processors analog pins -// ========================================================================== -#ifdef AnalogProcEC_ACT -/** Start [AnalogElecConductivity] */ -#include -const int8_t ECpwrPin = ECpwrPin_DEF; -const int8_t ECdataPin1 = ECdataPin1_DEF; - -#define EC_RELATIVE_OHMS 100000 -AnalogElecConductivityM analogEC_phy(ECpwrPin, ECdataPin1, EC_RELATIVE_OHMS); -/** End [AnalogElecConductivity] */ -#endif // AnalogProcEC_ACT - -// ========================================================================== -// Keller Acculevel High Accuracy Submersible Level Transmitter -// ========================================================================== -#if defined(KellerAcculevel_ACT) || defined(KellerNanolevel_ACT) -#define KellerXxxLevel_ACT 1 -//#include - -#endif // defined KellerAcculevel_ACT || defined KellerNanolevel_ACT - -#if defined KellerAcculevel_ACT -#include - -byte acculevelModbusAddress = - KellerAcculevelModbusAddress_DEF; // The modbus address of KellerAcculevel -const uint8_t acculevelNumberReadings = - 3; // The manufacturer recommends taking and averaging a few readings - -// Create a Keller Acculevel sensor object -KellerAcculevel acculevel_snsr(acculevelModbusAddress, modbusSerial, - rs485AdapterPower, modbusSensorPower, - max485EnablePin, acculevelNumberReadings); - -// Create pressure, temperature, and height variable pointers for the Acculevel -// Variable *acculevPress = new KellerAcculevel_Pressure(&acculevel, -// "12345678-abcd-1234-efgh-1234567890ab"); Variable *acculevTemp = new -// KellerAcculevel_Temp(&acculevel, "12345678-abcd-1234-efgh-1234567890ab"); -// Variable *acculevHeight = new KellerAcculevel_Height(&acculevel, -// "12345678-abcd-1234-efgh-1234567890ab"); - -#if KellerAcculevel_DepthUnits > 1 -// Create a depth variable pointer for the KellerAcculevel -Variable* kAcculevelDepth_m = new KellerAcculevel_Height(&acculevel_snsr, - "NotUsed"); - -float kAcculevelDepth_worker(void) { // Convert depth KA - // Get new reading - float depth_m = kAcculevelDepth_m->getValue(false); - float depth_ft = convert_mtoFt(depth_m); - MS_DEEP_DBG(F("Acculevel ft"), depth_ft, F("from m"), depth_m); - return depth_ft; -} - -// Setup the object that does the operation -Variable* KAcculevelHeightFt_var = - new Variable(kAcculevelDepth_worker, // function that does the calculation - 3, // resolution - "waterDepth", // var name. This must be a value from - // http://vocabulary.odm2.org/variablename/ - "feet", // var unit. This must be a value from This must be a - // value from http://vocabulary.odm2.org/units/ - "kellerAccuDepth", // var code - KellerXxlevel_Height_UUID); -#endif // KellerAcculevel_DepthUnits -#endif // KellerAcculevel_ACT - - -// ========================================================================== -// Keller Nanolevel High Accuracy Submersible Level Transmitter -// ========================================================================== -#ifdef KellerNanolevel_ACT -#include - -byte nanolevelModbusAddress = - KellerNanolevelModbusAddress_DEF; // The modbus address of KellerNanolevel -// const int8_t rs485AdapterPower = sensorPowerPin; // Pin to switch RS485 -// adapter power on and off (-1 if unconnected) const int8_t modbusSensorPower = -// A3; // Pin to switch sensor power on and off (-1 if unconnected) const -// int8_t max485EnablePin = -1; // Pin connected to the RE/DE on the 485 chip -// (-1 if unconnected) -const uint8_t nanolevelNumberReadings = - 3; // The manufacturer recommends taking and averaging a few readings - -// Create a Keller Nanolevel sensor object - -KellerNanolevel nanolevel_snsr(nanolevelModbusAddress, modbusSerial, - rs485AdapterPower, modbusSensorPower, - max485EnablePin, nanolevelNumberReadings); - -// Create pressure, temperature, and height variable pointers for the Nanolevel -// Variable *nanolevPress = new KellerNanolevel_Pressure(&nanolevel, -// "12345678-abcd-1234-efgh-1234567890ab"); Variable *nanolevTemp = new -// KellerNanolevel_Temp(&nanolevel, "12345678-abcd-1234-efgh-1234567890ab"); -// Variable *nanolevHeight = new KellerNanolevel_Height(&nanolevel, -// "12345678-abcd-1234-efgh-1234567890ab"); - -#endif // KellerNanolevel_ACT - -#if defined(ASONG_AM23XX_UUID) -// ========================================================================== -// AOSong AM2315 Digital Humidity and Temperature Sensor -// ========================================================================== -//use updated solving https://github.com/neilh10/ModularSensors/issues/102 -/** Start [ao_song_am2315] */ -#include - -// const int8_t I2CPower = 1;//sensorPowerPin; // Pin to switch power on and -// off (-1 if unconnected) - -// Create an AOSong AM2315 sensor object -// Data sheets says AM2315 and AM2320 have same address 0xB8 (8bit addr) of 1011 -// 1000 or 7bit 0x5c=0101 1100 AM2320 AM2315 address 0x5C -AOSongAM2315 am23xx(I2CPower); - -// Create humidity and temperature variable pointers for the AM2315 -// Variable *am2315Humid = new AOSongAM2315_Humidity(&am23xx, -// "12345678-abcd-1234-ef00-1234567890ab"); Variable *am2315Temp = new -// AOSongAM2315_Temp(&am23xx, "12345678-abcd-1234-ef00-1234567890ab"); -/** End [ao_song_am2315] */ -#endif // ASONG_AM23XX_UUID - -#if defined SENSIRION_SHT4X_UUID -// ========================================================================== -// Sensirion SHT4X Digital Humidity and Temperature Sensor -// ========================================================================== -/** Start [sensirion_sht4x] */ -#include - -// NOTE: Use -1 for any pins that don't apply or aren't being used. -const int8_t SHT4xPower = sensorPowerPin; // Power pin -const bool SHT4xUseHeater = true; - -// Create an Sensirion SHT4X sensor object -SensirionSHT4x sht4x(SHT4xPower, SHT4xUseHeater); - -// Create humidity and temperature variable pointers for the SHT4X -/*Variable* sht4xHumid = - new SensirionSHT4x_Humidity(&sht4x, "12345678-abcd-1234-ef00-1234567890ab"); -Variable* sht4xTemp = - new SensirionSHT4x_Temp(&sht4x, "12345678-abcd-1234-ef00-1234567890ab");*/ -/** End [sensirion_sht4x] */ -#endif //SENSIRION_SHT4X_UUID - -// ========================================================================== -// Maxim DS3231 RTC (Real Time Clock) -// ========================================================================== -#include - -// Create a DS3231 sensor object -MaximDS3231 ds3231(1); - - -// ========================================================================== -// Bosch BME280 Environmental Sensor (Temperature, Humidity, Pressure) -// ========================================================================== -#if 0 -#include - -const int8_t I2CPower = sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) -uint8_t BMEi2c_addr = 0x76; -// The BME280 can be addressed either as 0x77 (Adafruit default) or 0x76 (Grove default) -// Either can be physically mofidied for the other address - -// Create a Bosch BME280 sensor object -BoschBME280 bme280(I2CPower, BMEi2c_addr); - - -// ========================================================================== -// Maxim DS18 One Wire Temperature Sensor -// ========================================================================== -#include - -// OneWire Address [array of 8 hex characters] -// If only using a single sensor on the OneWire bus, you may omit the address -// DeviceAddress OneWireAddress1 = {0x28, 0xFF, 0xBD, 0xBA, 0x81, 0x16, 0x03, 0x0C}; -const int8_t OneWirePower = sensorPowerPin; // Pin to switch power on and off (-1 if unconnected) -const int8_t OneWireBus = 6; // Pin attached to the OneWire Bus (-1 if unconnected) (D24 = A0) - -// Create a Maxim DS18 sensor objects (use this form for a known address) -// MaximDS18 ds18(OneWireAddress1, OneWirePower, OneWireBus); - -// Create a Maxim DS18 sensor object (use this form for a single sensor on bus with an unknown address) -MaximDS18 ds18(OneWirePower, OneWireBus); -#endif // 0 - -#if defined MAYFLY_BAT_STC3100 -#include - -// The STC3100 only has one address - -STSTC3100_Sensor stc3100_phy(STC3100_NUM_MEASUREMENTS); - -//Its on a wingboard and may not be plugged in -bool batteryFuelGauge_present = false; - -//#define PRINT_STC3100_SNSR_VAR 1 -#if defined PRINT_STC3100_SNSR_VAR -bool userPrintStc3100BatV_avlb=false; -#endif // PRINT_STC3100_SNSR_VAR -// Read the battery Voltage asynchronously, with getLionBatStc3100_V() -// and have that voltage used on logging event - -Variable* kBatteryVoltage_V = new STSTC3100_Volt(&stc3100_phy,"nu"); - -#if !defined MS_LION_MAX_VOLT -#define MS_LION_MAX_VOLT 4.9 -#endif -#if !defined MS_LION_ERR_VOLT -#define MS_LION_ERR_VOLT 0.1234 -#endif - -float wLionBatStc3100_worker(void) { // get the Battery Reading - // Get reading - Assumes updated before calling - float flLionBatStc3100_V = stc3100_phy.stc3100_device.v.voltage_V; - if (MS_LION_MAX_VOLT < flLionBatStc3100_V) { - Serial.print(F("\n wLionBatStc3100 err meas LiIon V")); - Serial.print(flLionBatStc3100_V, 4); - Serial.println(); - - flLionBatStc3100_V = MS_LION_ERR_VOLT; - } - // MS_DBG(F("wLionBatStc3100_worker"), flLionBatStc3100_V); -#if defined MS_TU_XX_DEBUG_DEEP - DEBUGGING_SERIAL_OUTPUT.print(F(" wLionBatStc3100_worker ")); - DEBUGGING_SERIAL_OUTPUT.print(flLionBatStc3100_V, 4); - DEBUGGING_SERIAL_OUTPUT.println(); -#endif // MS_TU_XX_DEBUG -#if defined PRINT_STC3100_SNSR_VAR - if (userPrintStc3100BatV_avlb) { - userPrintStc3100BatV_avlb = false; - STANDARD_SERIAL_OUTPUT.print(F(" BatteryVoltage(V) ")); - STANDARD_SERIAL_OUTPUT.print(flLionBatStc3100_V, 4); - STANDARD_SERIAL_OUTPUT.println(); - } -#endif // PRINT_STC3100_SNSR_VAR - return flLionBatStc3100_V; -} -float getLionBatStc3100_V(void) { - return kBatteryVoltage_V->getValue(false); -} -// Setup the object that does the operation -Variable* pLionBatStc3100_var = - new Variable(wLionBatStc3100_worker, // function that does the calculation - 4, // resolution - "batteryVoltage", // var name. This must be a value from - // http://vocabulary.odm2.org/variablename/ - "volts", // var unit. This must be a value from This must be a - // value from http://vocabulary.odm2.org/units/ - "Stc3100_V", // var code - STC3100_Volt_UUID); -#endif //MAYFLY_BAT_STC3100 - - -#if defined ExternalVoltage_Volt0_UUID -// ========================================================================== -// External Voltage via TI ADS1115 -// ========================================================================== -#include - -const int8_t ADSPower = 1; // sensorPowerPin; // Pin to switch power on and - // off (-1 if unconnected) -const int8_t ADSChannel0 = 0; // The ADS channel of interest -const int8_t ADSChannel1 = 1; // The ADS channel of interest -const int8_t ADSChannel2 = 2; // The ADS channel of interest -const int8_t ADSChannel3 = 3; // The ADS channel of interest -const float dividerGain = 11; // Gain RevR02 1/Gain 1M+100K -// The Mayfly is modified for ECN R04 or divide by 11 -// Vbat is expected to be 3.2-4.2, so max V to ads is 0.38V, -// Practically the defaule GAIN_ONE for ADS1115 provide the best performance. -// 2020Nov13 Characterizing the ADS1115 for different gains seems to fall far -// short of the datasheet. Very frustrating. - -const uint8_t ADSi2c_addr = 0x48; // The I2C address of the ADS1115 ADC -const uint8_t VoltReadsToAvg = 1; // Only read one sample stable input - -// Create an External Voltage sensor object -ExternalVoltage extvolt_AA0(ADSPower, ADSChannel0, dividerGain, ADSi2c_addr, - VoltReadsToAvg); -// ExternalVoltage extvolt1(ADSPower, ADSChannel1, dividerGain, ADSi2c_addr, -// VoltReadsToAvg); special Vcc 3.3V - -//#define PRINT_EXTADC_BATV_VAR -#if defined PRINT_EXTADC_BATV_VAR -bool userPrintExtBatV_avlb=false; -#endif // PRINT_EXTADC_BATV_VAR -// Create a capability to read the battery Voltage asynchronously, -// and have that voltage used on logging event -Variable* varExternalVoltage_Volt = new ExternalVoltage_Volt(&extvolt_AA0, "NotUsed"); - - -float wLionBatExt_worker(void) { // get the Battery Reading - // Get new reading - float flLionBatExt_V = varExternalVoltage_Volt->getValue(true); - // float depth_ft = convert_mtoFt(depth_m); - // MS_DBG(F("wLionBatExt_worker"), flLionBatExt_V); -#if defined MS_TU_XX_DEBUG - DEBUGGING_SERIAL_OUTPUT.print(F(" wLionBatExt_worker ")); - DEBUGGING_SERIAL_OUTPUT.print(flLionBatExt_V, 4); - DEBUGGING_SERIAL_OUTPUT.println(); -#endif // MS_TU_XX_DEBUG -#if defined PRINT_EXTADC_BATV_VAR - if (userPrintExtBatV_avlb) { - userPrintExtBatV_avlb = false; - STANDARD_SERIAL_OUTPUT.print(F(" LiionBatExt(V) ")); - STANDARD_SERIAL_OUTPUT.print(flLionBatExt_V, 4); - STANDARD_SERIAL_OUTPUT.println(); - } -#endif // PRINT_EXTADC_BATV_VAR - return flLionBatExt_V; -} -float getLionBatExt_V(void) { - return varExternalVoltage_Volt->getValue(false); -} -// Setup the object that does the operation -Variable* pLionBatExt_var = - new Variable(wLionBatExt_worker, // function that does the calculation - 4, // resolution - "batteryVoltage", // var name. This must be a value from - // http://vocabulary.odm2.org/variablename/ - "volts", // var unit. This must be a value from This must be a - // value from http://vocabulary.odm2.org/units/ - "extVolt0", // var code - ExternalVoltage_Volt0_UUID); -#endif // ExternalVoltage_Volt0_UUID - -// Measuring the battery voltage can be from a number of sources -// Battery Filtering measurement in V -// Vbat from A6 noise filtering ~ bfv -// Mayfly 0.5-1.1 has a noisy battery measurement that uses -// a sliding window filtering technique to measure the lowest -// battery voltage over a number of samples. - -float bat_filtered_v; -/// @brief Variable for software noise filtering window size -#define BFV_VBATLOW_WINDOW_SZ 6 -float bfv_sliding[BFV_VBATLOW_WINDOW_SZ ]; - -bool bfv_Init=false; //Has it been initialized -uint8_t bfv_idx=0; - -#if defined MAYFLY_BAT_CHOICE -#if MAYFLY_BAT_CHOICE == MAYFLY_BAT_STC3100 -#define bms_SetBattery() bms.setBatteryV(wLionBatStc3100_worker()); -#elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_AA0 -// Need for internal battery -#define bms_SetBattery() bms.setBatteryV(wLionBatExt_worker()); -#elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_A6 -#warning need to test mcuBoardPhy, interface -// Read's the battery voltage -// NOTE: This returns the lowest battery level from previous running updates! -float getBatteryVoltageProc() { - float bat_now_v, bfv_lowest; - uint8_t bfv_lp; - bat_now_v = mcuBoardPhy.readSensorVbat(); - bfv_lowest= bat_now_v; - - if (bfv_Init) { - //Insert the latest reading into the next slot - bfv_sliding[bfv_idx]=bat_now_v; - MS_DBG(F("Vbatlow update:"),bfv_idx, bfv_lowest); - if (++bfv_idx >= BFV_VBATLOW_WINDOW_SZ) { - //MS_DEEP_DBG(F("Vbatlow idx rst"),bfv_idx); - bfv_idx=0; - } - //Check all slots and find the lowest reading - for (bfv_lp=0;bfv_lpbfv_sliding[bfv_lp]) { - bfv_lowest=bfv_sliding[bfv_lp]; - MS_DBG(F("Vbatlow i:"),bfv_lp, bfv_lowest); - } else { - //MS_DBG(F("Vbatlow i="),bfv_lp); - } - } - } else { - //Initialize with the highest voltage read. - bfv_lowest = bat_now_v = mcuBoardPhy.readSensorVbat(); - - //Look for highest voltage and init with that voltage - // bfv_lowest is a temporary variable with highest found Vbat - #define BFV_FILTER_INITIALIZE_LOOP 5 - for (bfv_lp=0;bfv_lp bfv_lowest) { - bfv_lowest =bat_now_v ; - PRINTOUT(F("Vbat slow rise detect :"), bfv_lowest); - } - } - - for (bfv_lp=0;bfv_lp -const int8_t procVoltPower = -1; -const uint8_t procVoltReadsToAvg = 1; // Only read one sample - -#if defined ARDUINO_AVR_ENVIRODIY_MAYFLY -// Only support Mayfly rev5 10M/2.7M & 10bit ADC (3.3Vcc / 1023) -const int8_t sensor_Vbatt_PIN = A6; -const float procVoltDividerGain = 4.7; -#else -#error define other processors ADC pins here -#endif // -processorAdc sensor_batt_V(procVoltPower, sensor_Vbatt_PIN, procVoltDividerGain, - procVoltReadsToAvg); -// processorAdc sensor_V3v6_V(procVoltPower, sensor_V3V6_PIN, -// procVoltDividerGain, procVoltReadsToAvg); - -#endif // ProcVolt_ACT - -// ========================================================================== -// Creating Variable objects for those values for which we're reporting in -// converted units, via calculated variables Based on baro_rho_correction.ino -// and VariableBase.h from enviroDIY. -// ========================================================================== -#if defined Decagon_CTD_UUID -// Create a temperature variable pointer for the Decagon CTD -Variable* CTDTempC = new DecagonCTD_Temp(&ctdPhy, "NotUsed"); -float CTDTempFgetValue(void) { // Convert temp for the CTD - return convertDegCtoF(CTDTempC->getValue()); -} -// Create the calculated water temperature Variable object and return a pointer -// to it -Variable* CTDTempFcalc = new Variable( - CTDTempFgetValue, // function that does the calculation - 1, // resolution - "temperatureSensor", // var name. This must be a value from - // http://vocabulary.odm2.org/variablename/ - "degreeFahrenheit", // var unit. This must be a value from This must be a - // value from http://vocabulary.odm2.org/units/ - "TempInF", // var code - CTD10_TEMP_UUID); - -// Create a depth variable pointer for the Decagon CTD -Variable* CTDDepthMm = new DecagonCTD_Depth(&ctdPhy, "NotUsed"); -float CTDDepthInGetValue(void) { // Convert depth for the CTD - // Pass true to getValue() for the Variables for which we're only sending a - // calculated version of the sensor reading; this forces the sensor to take - // a reading when getValue is called. - return convertMmtoIn(CTDDepthMm->getValue(true)); -} -// Create the calculated depth Variable object and return a pointer to it -Variable* CTDDepthInCalc = - new Variable(CTDDepthInGetValue, // function that does the calculation - 1, // resolution - "CTDdepth", // var name. This must be a value from - // http://vocabulary.odm2.org/variablename/ - "Inch", // var unit. This must be a value from This must be a - // value from http://vocabulary.odm2.org/units/ - "waterDepth", // var code - CTD10_DEPTH_UUID); -#endif // Decagon_CTD_UUID - -#if defined MaximDS3231_TEMP_UUID || defined MaximDS3231_TEMPF_UUID -// Create a temperature variable pointer for the DS3231 -#if defined MaximDS3231_TEMP_UUID -Variable* ds3231TempC = new MaximDS3231_Temp(&ds3231, MaximDS3231_TEMP_UUID); -#else -Variable* ds3231TempC = new MaximDS3231_Temp(&ds3231); -#endif -float ds3231TempFgetValue(void) { // Convert temp for the DS3231 - // Pass true to getValue() for the Variables for which we're only sending a - // calculated version of the sensor reading; this forces the sensor to take - // a reading when getValue is called. - return convertDegCtoF(ds3231TempC->getValue(true)); -} -#endif // MaximDS3231_TEMP_UUID -// Create the calculated Mayfly temperature Variable object and return a pointer -// to it -#if defined MaximDS3231_TEMPF_UUID -Variable* ds3231TempFcalc = new Variable( - ds3231TempFgetValue, // function that does the calculation - 1, // resolution - "temperatureDatalogger", // var name. This must be a value from - // http://vocabulary.odm2.org/variablename/ - "degreeFahrenheit", // var unit. This must be a value from - // http://vocabulary.odm2.org/units/ - "TempInF", // var code - MaximDS3231_TEMPF_UUID); -#endif // MaximDS3231_TEMPF_UUID - - -// ========================================================================== -// Creating the Variable Array[s] and Filling with Variable Objects -// ========================================================================== - -Variable* variableList[] = { - new ProcessorStats_SampleNumber(&mcuBoardPhy, - ProcessorStats_SampleNumber_UUID), -#if defined STC3100_AVLBL_mAhr_UUID - new STC3100_AVLBL_MAH(&stc3100_phy,STC3100_AVLBL_mAhr_UUID), -#endif //STC3100_AVLBL_mAhr_UUID -#if defined STC3100_USED1_mAhr_UUID - new STC3100_USED1_MAH(&stc3100_phy,STC3100_USED1_mAhr_UUID), -#endif //STC3100_USED1_mAhr_UUID -#if defined STC3100_Volt_UUID - pLionBatStc3100_var, -#endif //STC3100_Volt_UUID - -#if defined ExternalVoltage_Volt0_UUID - pLionBatExt_var, -#endif -#if defined MAYFLY_BAT_A6 - #if defined REPORT_FILTERED_BAT_A6_V - BatFiltered_calc, - #else - new ProcessorStats_Battery(&mcuBoardPhy, ProcessorStats_Batt_UUID), - #endif // REPORT_FILTERED_BAT_A6_V -#endif // MAYFLY_BAT_A6 -#if defined AnalogProcEC_ACT - // Do Analog processing measurements. - new AnalogElecConductivityM_EC(&analogEC_phy, EC1_UUID), -#endif // AnalogProcEC_ACT - -#if defined(ExternalVoltage_Volt1_UUID) - new ExternalVoltage_Volt(&extvolt1, ExternalVoltage_Volt1_UUID), -#endif -#if defined Decagon_CTD_UUID - // new DecagonCTD_Depth(&ctdPhy,CTD10_DEPTH_UUID), - CTDDepthInCalc, - // new DecagonCTD_Temp(&ctdPhy, CTD10_TEMP_UUID), - CTDTempFcalc, -#endif // Decagon_CTD_UUID -#if defined Insitu_TrollModbus_UUID -//#if defined InsituLTrs485_ACT - // new insituLevelTroll_Pressure(&InsituLT_snsr, "UUID"), - new InsituLevelTroll_Temp(&InsituLT_snsr, InsituLTrs485_Temp_UUID), - new InsituLevelTroll_Height(&InsituLT_snsr, InsituLTrs485_Depth_UUID), -//#endif // InsituLTrs485_ACT -#elif defined Insitu_TrollSdi12_UUID - new InsituTrollSdi12a_Depth(&itrollPhy, ITROLLS_DEPTH_UUID), - new InsituTrollSdi12a_Temp(&itrollPhy, ITROLLS_TEMP_UUID), -#endif // Insitu_TrollXx -#if defined KellerAcculevel_ACT -// new KellerAcculevel_Pressure(&acculevel, "UUID"), -#if KellerAcculevel_DepthUnits > 1 - KAcculevelHeightFt_var, -#else - new KellerAcculevel_Height(&acculevel_snsr, KellerXxlevel_Height_UUID), -#endif // KellerAcculevel_DepthUnits - new KellerAcculevel_Temp(&acculevel_snsr, KellerXxlevel_Temp_UUID), -#endif // KellerAcculevel_ACT -#if defined KellerNanolevel_ACT - // new KellerNanolevel_Pressure(&nanolevel_snsr, "UUID"), - new KellerNanolevel_Temp(&nanolevel_snsr, KellerXxlevel_Temp_UUID), - new KellerNanolevel_Height(&nanolevel_snsr, KellerXxlevel_Height_UUID), -#endif // SENSOR_CONFIG_KELLER_NANOLEVEL -// new BoschBME280_Temp(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), -// new BoschBME280_Humidity(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), -// new BoschBME280_Pressure(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), -// new BoschBME280_Altitude(&bme280, "12345678-abcd-1234-ef00-1234567890ab"), -// new MaximDS18_Temp(&ds18, "12345678-abcd-1234-ef00-1234567890ab"), -#if defined SENSIRION_SHT4X_UUID - new SensirionSHT4x_Humidity(&sht4x, SENSIRION_SHT4X_Air_Humidity_UUID), - new SensirionSHT4x_Temp(&sht4x, SENSIRION_SHT4X_Air_Temperature_UUID), -// ASONG_AM23_Air_TemperatureF_UUID - -#elif defined ASONG_AM23XX_UUID - new AOSongAM2315_Humidity(&am23xx, ASONG_AM23_Air_Humidity_UUID), - new AOSongAM2315_Temp(&am23xx, ASONG_AM23_Air_Temperature_UUID), -// ASONG_AM23_Air_TemperatureF_UUID -// calcAM2315_TempF -#endif // ASONG_AM23XX_UUID -#if defined MaximDS3231_TEMP_UUID - // new MaximDS3231_Temp(&ds3231, MaximDS3231_Temp_UUID), - ds3231TempC, -#endif // MaximDS3231_TEMP_UUID -#if defined MaximDS3231_TEMPF_UUID - ds3231TempFcalc, -#endif // MaximDS3231_TempF_UUID -#if defined DIGI_RSSI_UUID - #if BUILD_MODEM_TYPE == BUILD_MODEM_FACTORY - //loggerModemPhyInst not setup - also not working - new Modem_RSSI(&loggerModemPhyInst, DIGI_RSSI_UUID), - #else - new Modem_RSSI(&modemPhy, DIGI_RSSI_UUID), - #endif //BUILD_MODEM_TYPE - - - //modemPhyRssi_calc, -#endif // DIGI_RSSI_UUID - - -}; - - -// Count up the number of pointers in the array -int variableCount = sizeof(variableList) / sizeof(variableList[0]); - -// Create the VariableArray object -VariableArray varArray(variableCount, variableList); - -// ========================================================================== -// The Logger Object[s] -// ========================================================================== - -// Create a new logger instance -Logger dataLogger(LoggerID, loggingIntervaldef, &varArray); - - -// ========================================================================== -// A Publisher to Monitor My Watershed / EnviroDIY Data Sharing Portal -// ========================================================================== -// Device registration and sampling feature information can be obtained after -// registration at https://monitormywatershed.org or https://data.envirodiy.org -const char* registrationToken = - registrationToken_UUID; // Device registration token -const char* samplingFeature = samplingFeature_UUID; // Sampling feature UUID - -#if defined UseModem_PushData -#if defined USE_PUB_MMW -// Create a data publisher for the EnviroDIY/WikiWatershed POST endpoint -#include -// EnviroDIYPublisher EnviroDIYPOST(dataLogger, &modemPhy.gsmClient, -// registrationToken, samplingFeature); -EnviroDIYPublisher EnviroDIYPOST(dataLogger, 15, 0); -#endif //USE_PUB_MMW -#if defined USE_PUB_TSMQTT -// Create a data publisher for ThingSpeak -// Create a channel with fields on ThingSpeak.com -// The fields will be sent in exactly the order they are in the variable array. -// Any custom name or identifier given to the field on ThingSpeak is irrelevant. -// No more than 8 fields of data can go to any one channel. Any fields beyond -// the eighth in the array will be ignored. -//example https://www.mathworks.com/help/thingspeak/mqtt-publish-and-subscribe-with-esp8266.html -#include -ThingSpeakPublisher TsMqttPub; -#endif //USE_PUB_TSMQTT -#if defined USE_PUB_UBIDOTS -#include -UbidotsPublisher UbidotsPub; -#endif // USE_PUB_UBIDOTS -#endif // UseModem_PushData - -// ========================================================================== -// Working Functions -// ========================================================================== -#define SerialStd Serial -#include "iniHandler.h" - -// Flashes the Green/Read LED's LED1 & LED2 -void greenredflash(uint8_t numFlash = 4, uint8_t rate = 75) { - for (uint8_t i = 0; i < numFlash; i++) { - digitalWrite(greenLED, HIGH); - digitalWrite(redLED, LOW); - delay(rate); - digitalWrite(greenLED, LOW); - digitalWrite(redLED, HIGH); - delay(rate); - } - digitalWrite(redLED, LOW); -} - -// Flashes the Green LED -void greenflash(uint8_t numFlash = 4, uint8_t rate = 75) { - for (uint8_t i = 0; i < numFlash; i++) { - digitalWrite(greenLED, HIGH); - //digitalWrite(redLED, LOW); - delay(rate); - digitalWrite(greenLED, LOW); - //digitalWrite(redLED, HIGH); - delay(rate); - } - digitalWrite(redLED, LOW); -} -/** - * @brief Check if battery can provide power for action to be performed. - * - * @param reqBatState On of bm_Lbatt_status_t - * LB_PWR_USEABLE_REQ forces a battery voltage reading - * all other requests use this reading - * - * Customized per type of sensor configuration - * - * @return **bool *** True if power available, else false - */ -bm_Lbatt_status_t Lbatt_status = BM_LBATT_UNUSEABLE_STATUS; - -bool isBatteryChargeGoodEnough(lb_pwr_req_t reqBatState) { - bool retResult = true; - - bms_SetBattery(); // Read battery votlage - switch (reqBatState) { - case LB_PWR_USEABLE_REQ: - default: - // Check battery status - Lbatt_status = bms.isBatteryStatusAbove(true, BM_PWR_USEABLE_REQ); - if (BM_LBATT_UNUSEABLE_STATUS == Lbatt_status) { - retResult = false; - PRINTOUT(F("---LB_PWR_USEABLE_REQ CANCELLED--Lbatt="),Lbatt_status); - } - MS_DBG(F(" isBatteryChargeGoodEnoughU "), retResult, - bms.getBatteryVm1(), F("V status"), Lbatt_status, - reqBatState); - break; - - case LB_PWR_SENSOR_USE_REQ: - -// heavy power sensors ~ use BM_PWR_LOWSTATUS -#if 1 - if (BM_LBATT_LOW_STATUS >= Lbatt_status) { - retResult = false; - PRINTOUT(F("---LB_PWR_SENSOR_USE_REQ CANCELLED--Lbatt="),Lbatt_status); - } -#endif - - MS_DBG(F(" isBatteryChargeGoodEnouSnsr"), retResult); - break; - - case LB_PWR_MODEM_USE_REQ: - // WiFi BM_LBATT_MEDIUM_STATUS - // Cell (BM_LBATT_HEAVY_STATUS - if (BM_LBATT_HEAVY_STATUS > Lbatt_status) { - retResult = false; - PRINTOUT(F("---LB_PWR_MODEM_USE_REQ CANCELLED--Lbatt="),Lbatt_status); - } - MS_DBG(F(" isBatteryChargeGoodEnoughTx"), retResult); - // modem sensors BM_PWR_LOW_REQ - break; - } - return retResult; -} - -// ========================================================================== -// Manages the Modbus Physical Pins. -// Pins pulled high when powered off will cause a ghost power leakage. -#if defined KellerXxxLevel_ACT || defined InsituLTrs485_ACT -void modbusPinPowerMng(bool status) { - MS_DBG(F(" **** modbusPinPower"), status); -#if 1 - if (status) { - modbusSerial.setupPhyPins(); - } else { - modbusSerial.disablePhyPins(); - } -#endif -} -#endif // KellerXxxLevel_ACT InsituLTrs485_ACT - -#define PORT_SAFE(pinNum) \ - pinMode(pinNum, INPUT); \ - digitalWrite(pinNum, LOW); - -#define PORT_HIGH(pinNum) \ - pinMode(pinNum, INPUT); \ - digitalWrite(pinNum, HIGH); - -#define PORT_LOW(pinNum) \ - pinMode(pinNum, OUTPUT); \ - digitalWrite(pinNum, LOW); - -void unusedBitsMakeSafe() { - // Set all unused Pins to a safe no current mode for sleeping - // Mayfly variant.h: D0->23 (Analog0-7) or D24-31 - // PORT_SAFE( 0); Rx0 Tty - // PORT_SAFE( 1); Tx0 TTy - // PORT_SAFE( 2); Rx1 Xb? - // PORT_SAFE( 3); Tx1 Xb? -#if !defined KellerXxxLevel_ACT && !defined InsituLTrs485_ACT - //PORT_SAFE(04); - //PORT_SAFE(05); -#endif // KellerXxxLevel_ACT - PORT_SAFE(06); - // PORT_SAFE(07); SDI12 - // PORT_SAFE(08); Grn Led - // PORT_SAFE(09); Red LED - PORT_SAFE(10); // Assumes hw default SJ1 goes to A7 RTC Int Pullup - PORT_SAFE(11); - PORT_SAFE(12); - // mosi LED PORT_SAFE(13); - // miso PORT_SAFE(14); - // sck PORT_SAFE(15); - // scl PORT_SAFE(16); - // sda PORT_SAFE(17); - PORT_SAFE(18); - PORT_SAFE(19); // Xbee CTS - PORT_SAFE(20); // Xbee RTS - PORT_SAFE(21); - // All Rs485 and Modbus Insitu_TrollModbus_UUID - #if defined KellerXxxLevel_ACT || defined InsituLTrs485_ACT - PORT_LOW(22); //Pwr Sw rs485AdapterPower - #else - PORT_SAFE(22); - #endif -#if defined BUILD_MODEM_TYPE - PORT_HIGH(23); // Xbee DTR modemSleepRqPin LOW until Modem takes over - #else - PORT_SAFE(23); - #endif //BUILD_MODEM_TYPE - // Analog from here on - // PORT_SAFE(24);//A0 ECData1 - PORT_SAFE(25); // A1 - PORT_SAFE(26); // A2 - PORT_SAFE(27); // A3 - // PORT_SAFE(28); //A4 ECpwrPin - PORT_SAFE(29); // A5 - PORT_SAFE(30); // A6 - // PORT_SAFE(31); //A7 Timer Int -}; - - -#if defined MS_TTY_USER_INPUT -// ========================================================================== -bool userButton1Act = false; -void userButtonISR() { - //Need setting up to actiavted by appropiate buttonPin - MS_DBG(F("ISR userButton!")); - if (digitalRead(buttonPin)) { - userButton1Act =true; - } - -} //userButtonISR - -// ========================================================================== - void setupUserButton () { - if (buttonPin >= 0) { - pinMode(buttonPin, INPUT_PULLUP); - enableInterrupt(buttonPin, userButtonISR, CHANGE); - MS_DBG(F("Button on pin"), buttonPin, - F("user input.")); - } -} // setupUserButton -#include "tu_serialCmd.h" -#else -#define setupUserButton() - -#if defined MS_TTY_SERIAL_COUNT - -long ch_count_tot=0; -uint8_t serialInputCount() -{ - //char incoming_ch; - uint8_t ch_count_now=0; - - //Read any input queue - while (Serial.available()) { - //incoming_ch = - Serial.read(); - if (++ch_count_now > 250) break; - } - ch_count_tot+=ch_count_now; - - return ch_count_now; -} -#endif // MS_TTY_SERIAL_COUNT -#endif //MS_TTY_USER_INPUT -// ========================================================================== -// Poll management sensors- eg FuelGauges status -// -void managementSensorsPoll() { -#if defined MAYFLY_BAT_STC3100 - if (batteryFuelGauge_present) { - stc3100_phy.stc3100_device.readValues(); - Serial.print("BtMonStc31, "); - //Create a time traceability header - String csvString = ""; - csvString.reserve(24); - dataLogger.dtFromEpochTz(dataLogger.getNowLocalEpoch()).addToString(csvString); - csvString += ", "; - Serial.print(csvString); - //Serial.print(dataLogger.formatDateTime_ISO8601(dataLogger.getNowEpochTz())); - - //Output readings - Serial.print(F(" V=,")); - Serial.print(stc3100_phy.stc3100_device.v.voltage_V, 3); - Serial.print(F(", mA=,")); - Serial.print(stc3100_phy.stc3100_device.v.current_mA, 1); - Serial.print(F(", C mAh=,")); - Serial.print(stc3100_phy.stc3100_device.v.charge_mAhr, 3); - Serial.print(F(", EU mAh=")); - Serial.print(stc3100_phy.stc3100_device._energyUsed_mAhr, 3); - Serial.print(F(", EA mAh=")); - Serial.print(stc3100_phy.stc3100_device.getEnergyAvlbl_mAhr(), 3); - Serial.print(F(",0x")); - Serial.print((uint16_t)stc3100_phy.stc3100_device._batCharge1_raw,HEX); - Serial.print(", CntsAdc=,"); - Serial.println(stc3100_phy.stc3100_device.v.counter); - - // Serial.print(" & IC Temp(C), "); - // Serial.println(lc.getCellTemperature(), 1); - - //Ensure no matter how many readings are averaged, some values are only read once. - stc3100_phy.stc3100_device.setHandshake1(); - } -#endif // MAYFLY_BAT_STC3100 -} //managementSensorsPoll - -// ========================================================================== -// Checks available power on battery. -void checkModemBaud () { -#if BUILD_MODEM_TYPE == BUILD_MODEM_ESPRESSIF_ESP32 - /** Start [setup_esp] */ - // Modem wroom default baud is 115200 - // Mayfly TinyGSM read() processing doesn't work at 115200. - // It needs to be slowed down. - // On a newly installed modem, it will be at 115200, - // however previously programmed modems could be 57600 or 9600 - uint32_t cfgMdmBaud = modemBaud; - SerialStd.print(F("ModemESP32 init default ")); - SerialStd.println(cfgMdmBaud ); - //modemSerial.end(); - modemSerial.begin(cfgMdmBaud ); - - for (uint8_t ntries = 0; ntries<5; ntries++) { - // This will also verify communication and set up the modem - if (modemPhy.modemWake()) break; - - // if that didn't work, try changing baud rate - cfgMdmBaud= ESP32_MODEM_115K_BAUD; - SerialStd.print(ntries); - SerialStd.print(F("] ModemESP32 init ")); - SerialStd.println(cfgMdmBaud); - modemPhy.gsmModem.sendAT(GF("+UART_DEF=115200,8,1,0,0")); - modemPhy.gsmModem.waitResponse(); - modemSerial.end(); - modemSerial.begin(cfgMdmBaud); - if (modemPhy.modemWake()) break; - - // if that didn't work, try changing baud rate - cfgMdmBaud= ESP32_MODEM_57K_BAUD; - SerialStd.print(ntries); - SerialStd.print(F("] ModemESP32 init ")); - SerialStd.println(cfgMdmBaud); - modemPhy.gsmModem.sendAT(GF("+UART_DEF=57600,8,1,0,0")); - modemPhy.gsmModem.waitResponse(); - modemSerial.end(); - modemSerial.begin(cfgMdmBaud); - if (modemPhy.modemWake()) break; - - - cfgMdmBaud=ESP32_MODEM_9K6_BAUD; - SerialStd.print(ntries); - SerialStd.print(F("] ModemESP32 init ")); - SerialStd.println(cfgMdmBaud ); - modemPhy.gsmModem.sendAT(GF("+UART_DEF=9600,8,1,0,0")); - modemPhy.gsmModem.waitResponse(); - modemSerial.end(); - modemSerial.begin(cfgMdmBaud); - } - // set BAUD if not expected value - if (ESP32_MODEM_DEF_BAUD== cfgMdmBaud ) { - cfgMdmBaud= ESP32_MODEM_57K_BAUD; - modemPhy.gsmModem.sendAT(GF("+UART_DEF=57600,8,1,0,0")); - modemPhy.gsmModem.waitResponse(); - modemSerial.end(); - modemSerial.begin(cfgMdmBaud); - } - SerialStd.print(F("ModemESP32 connected at baud ")); - SerialStd.println(cfgMdmBaud); - - modemPhy.gsmModem.sendAT(GF("+GMR")); - //String MdmRsp; - modemPhy.gsmModem.waitResponse(); - modemPhy.gsmModem.sendAT(GF("+UART_DEF?")); - modemPhy.gsmModem.waitResponse(); - //modemPhy.gsmModem.sendAT(GF("+UART_DEF=115200,8,1,0,0")); - //modemPhy.gsmModem.waitResponse(); - modemPhy.gsmModem.sendAT(GF("+UART_CUR?")); - modemPhy.gsmModem.waitResponse(); - /** End [setup_esp] */ -#endif // BUILD_MODEM_TYPE - - } // checkModemBaud - -// ========================================================================== -// Checks available power on battery. -// -bool batteryCheck(bm_pwr_req_t useable_req, bool waitForGoodBattery,uint8_t dbg_src) -{ - bool LiBattPower_Unseable=false; - bool UserButtonAct = false; - uint16_t lp_wait = 1; - - PRINTOUT(F("batteryCheck req/wait/src"),useable_req, waitForGoodBattery,dbg_src); - bms_SetBattery(); - do { - #if MAYFLY_BAT_CHOICE == MAYFLY_BAT_STC3100 - //Read the V - FUT make compatible adcRead() - stc3100_phy.stc3100_device.readValues(); - bms.setBatteryV(stc3100_phy.stc3100_device.v.voltage_V); - PRINTOUT(F("Bat_V(stc3100)"),bms.getBatteryVm1()); - #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_AA0 - PRINTOUT(F("Bat_V(Ext) tbd")); - #elif MAYFLY_BAT_CHOICE == MAYFLY_BAT_A6 - PRINTOUT(F("Bat_V(low)"),bat_filtered_v); - #else //alt Read the V - FUT make compatible adcRead() - PRINTOUT(F("Bat_V(undef)")); - #endif // - LiBattPower_Unseable = - ((BM_LBATT_UNUSEABLE_STATUS == - bms.isBatteryStatusAbove(true, useable_req)) - ? true - : false); - if (LiBattPower_Unseable && waitForGoodBattery) - { - /* Sleep - * If can't collect data wait for more power to accumulate. - * This sleep appears to taking 5mA, where as later sleep takes 3.7mA - * Under no other load conditions the mega1284 takes about 35mA - * Another issue is that onstartup currently requires turning on comms device to - * set it up. On an XbeeS6 WiFi this can take 20seconds for some reason. - */ - PRINTOUT(lp_wait++,F(": BatV Low ="), bms.getBatteryVm1()),F(" Sleep60sec"); - dataLogger.systemSleep(1); //This is not sleeping - delay(1000); // need - PRINTOUT(F("---tu_xx01:Wakeup check power. Press user button to bypass")); - } - if (buttonPin >= 0) { UserButtonAct = digitalRead(buttonPin); } - dataLogger.resetWatchdog(); - } while (LiBattPower_Unseable && !UserButtonAct && waitForGoodBattery); - return !LiBattPower_Unseable; -} - -// ========================================================================== -// Activate the logger -// ========================================================================== -inline void dataLogger_do (uint8_t cia_val_override){ - #if defined USE_PUB_MMW - dataLogger.logDataAndPubReliably(cia_val_override); - #else - //FUT use reliable - dataLogger.logDataAndPublish(); - #endif -} -#if defined(__AVR__) -#if !defined FREE_RAM_SEED -#define FREE_RAM_SEED 0 -#endif -#if defined MS_DUMP_FREE_RAM -inline void initFreeRam() { - extern int16_t __heap_start, *__brkval; - uint8_t * p; -#define START_FREE_RAM ((uint8_t*)(__brkval == 0 ? (int)&__heap_start : (int)__brkval) ) -#define END_FREE_RAM (uint16_t)&p - for (p = START_FREE_RAM; (uint16_t)p < END_FREE_RAM; p++) { - *p =FREE_RAM_SEED ; - } -} -#else -inline void initFreeRam() {return;} -#endif //MS_DUMP_FREE_RAM -#else -inline void initFreeRam() {} -#endif // defined(__AVR__) - -// ========================================================================== -// Main setup function -// ========================================================================== -void setup() { - // uint8_t resetCause = REG_RSTC_RCAUSE; AVR ?//Reads from hw - // uint8_t resetBackupExit = REG_RSTC_BKUPEXIT; AVR ?//Reads from hw - uint8_t mcu_status = MCUSR; //is this already cleared by Arduino startup??? - //MCUSR = 0; //reset for unique read - noInterrupts(); //should be off - initFreeRam(); -// Wait for USB connection to be established by PC -// NOTE: Only use this when debugging - if not connected to a PC, this -// could prevent the script from starting -#if defined SERIAL_PORT_USBVIRTUAL - while (!SERIAL_PORT_USBVIRTUAL && (millis() < 10000)) {} -#endif - - // Start the primary serial connection - Serial.begin(serialBaud); - Serial.print(F("\n---Boot(")); - Serial.print(mcu_status,HEX); - Serial.print(F(") Sw Build: ")); - Serial.print(build_ref); - Serial.print(" "); - Serial.println(git_usr); - Serial.print(" "); - Serial.println(git_branch); - - Serial.print(F("Sw Name: ")); - Serial.println(configDescription); - - Serial.print(F("ModularSensors version ")); - Serial.println(MODULAR_SENSORS_VERSION); - -#if defined BUILD_MODEM_TYPE - Serial.print(F("TinyGSM Library version ")); - Serial.println(TINYGSM_VERSION); -#else - Serial.println(F("TinyGSM - none")); -#endif //BUILD_MODEM_TYPE - - unusedBitsMakeSafe(); - dataLogger.startFixedWatchdog(); - readAvrEeprom(); -#if defined USE_PS_HW_BOOT - //Print sames as .csv header, used in LoggerBaseExtCpp.h - Serial.print(F("Board: ")); - Serial.print((char*)epc.hw_boot.board_name); - Serial.print(F(" rev:'")); - Serial.print((char*)epc.hw_boot.rev); - Serial.print(F("' sn:'")); - Serial.print((char*)epc.hw_boot.serial_num); - Serial.println(F("'")); -#endif // USE_PS_HW_BOOT - - bt_BoardType_t boardType=BT_MAYFLY_1_0; - if (0==strncmp((char*)epc.hw_boot.rev, "0.5",3)){ - boardType=BT_MAYFLY_0_5; - Serial.println(F(" Board: Found Mayfly 0.5b")); - mcuBoardPhy.setVersion(mcuBoardVersion_0_5); - } else { - PRINTOUT( F(" Board: Assume Mayfly 1.1A ") ); - - } - - // set up for escape out of battery check if too low. - // If buttonPress then exit. - // Button is read inactive as low - if (buttonPin >= 0) { pinMode(buttonPin, INPUT_PULLUP); } - - #if defined MAYFLY_BAT_STC3100 - //Setsup Sensor for battery read. FUT local V ADC - // Could be warm boot in which case the STC3100 is alreading running - if(!stc3100_phy.setup()){ - Serial.println(F("STC3100 Not detected!")); - } else { - batteryFuelGauge_present = true; - Serial.print(F("STC3100 detected sn ")); - for (int snlp=1;snlp<(STC3100_ID_LEN-1);snlp++) { - Serial.print(stc3100_phy.stc3100_device.serial_number[snlp],HEX); - } - Serial.println(); - String sn(stc3100_phy.stc3100_device.getSn()); - PRINTOUT(F("STC3100 sn:"),sn); - - const char STC3100SN_100mohms_pm[] EDIY_PROGMEM = "013717d61100"; - if (sn.equals(STC3100SN_100mohms_pm)) { - #define STC3100_R_SERIES_100mOhms 100 - PRINTOUT(F("STC3100 diagnostic set R to mOhms "),STC3100_R_SERIES_100mOhms); - stc3100_phy.stc3100_device.setCurrentResistor(STC3100_R_SERIES_100mOhms); - } - } -#endif //MAYFLY_BAT_STC3100 - // A vital check on power availability - batteryCheck(BM_PWR_USEABLE_REQ, true,1); - - -// Allow interrupts for software serial -#if defined SoftwareSerial_ExtInts_h - enableInterrupt(softSerialRx, SoftwareSerial_ExtInts::handle_interrupt, - CHANGE); -#endif -#if defined NeoSWSerial_h - enableInterrupt(neoSSerial1Rx, neoSSerial1ISR, CHANGE); -#endif - -// Start the serial connection with the modem -#if defined BUILD_MODEM_TYPE - MS_DEEP_DBG("***modemSerial.begin"); - modemSerial.begin(modemBaud); -#endif // BUILD_MODEM_TYPE - -#if defined(CONFIG_SENSOR_RS485_PHY) - // Start the stream for the modbus sensors; all currently supported modbus - // sensors use 9600 baud - MS_DEEP_DBG("***modbusSerial.begin"); - delay(10); - PRINTOUT(F("modbus Baudrate:"),MODBUS_BAUD_RATE,F(" (8bits Even 1stop bit)config:"),MODBUS_SERIAL_CONFIG); - modbusSerial.begin(MODBUS_BAUD_RATE, MODBUS_SERIAL_CONFIG); - modbusPinPowerMng(false); // Turn off pins -#endif - - // Set up pins for the LED's - pinMode(greenLED, OUTPUT); - digitalWrite(greenLED, LOW); - pinMode(redLED, OUTPUT); - digitalWrite(redLED, LOW); - // Blink the LEDs to show the board is on and starting up - greenredflash(); - // not in this scope Wire.begin(); - - dataLogger.setLoggerPins(wakePin, sdCardSSPin, sdCardPwrPin, -1, greenLED); - setupUserButton(); //used for serialInput - -#ifdef USE_MS_SD_INI - // Set up SD card access - PRINTOUT(F("---parseIni Start")); - dataLogger.setPs_cache(&ps_ram); - dataLogger.parseIniSd(configIniID_def, inihUnhandledFn); - epcParser(); //use ps_ram to update classes - PRINTOUT(F("---parseIni complete\n")); -#endif // USE_MS_SD_INI - - // set the RTC to be in UTC TZ=0 - Logger::setRTCTimeZone(0); - - bms.printBatteryThresholds(); - -#ifdef BUILD_MODEM_TYPE - #if BUILD_MODEM_TYPE == BUILD_MODEM_FACTORY - //Instaniate modem - LoggerModemFactory mdmFactory; - uint8_t mdmType = epc_network; - loggerModemPhyInst = mdmFactory.createInstance((modemTypesCurrent_t)mdmType, - &modemSerHw, modemVccPin, - modemStatusPin, useCTSforStatus, - modemResetPin, modemSleepRqPin); /**/ - Client* inGsmClient; - // Further runtime configuration of the Modem - switch (mdmType) { - case MODEMT_WIFI_DIGI_S6: - loggerModemPhyDigiWifi->setWiFiId(epc_WiFiId, false); - loggerModemPhyDigiWifi->setWiFiPwd(epc_WiFiPwd,false); - inGsmClient = &(loggerModemPhyDigiWifi->gsmClient); - PRINTOUT(F("Modem config set as WIFI_DIGI_S6")); - break; - case MODEMT_LTE_DIGI_CATM1: - loggerModemPhyDigiCell->setApn(epc_apn, false); - inGsmClient = &(loggerModemPhyDigiCell->gsmClient); - PRINTOUT(F("Modem config set as LTE_DIGI_CATM1")); - break; - default: break; - PRINTOUT(F("Modem config ERR** "),mdmType); - }; - - if (BT_MAYFLY_0_5==boardType) { - loggerModemPhyInst->setPowerPin(modemVccPin_mayfly_0_5 ); - } - -#if !defined UseModem_PushData - const char None_STR[] = "None"; - dataLogger.setSamplingFeatureUUID(None_STR); -#endif // UseModem_PushData - - // Attach the modem and information pins to the logger - if ( loggerModemPhyInst->getPowerPin() > -1) { - //For Mayfly1.0 turn on power - pinMode(loggerModemPhyInst->getPowerPin() , OUTPUT); - digitalWrite(loggerModemPhyInst->getPowerPin() , LOW); //Off - PRINTOUT(F("---pwr Xbee OFF on pin "),loggerModemPhyInst->getPowerPin()); - } - - dataLogger.attachModem(loggerModemPhyInst); - loggerModemPhyInst->modemHardReset(); //Ensure in known state ~ 5mS - - // loggerModemPhyInst->setModemLED(modemLEDPin); //Used in UI_status subsystem - #else // not !BUILD_MODEM_FACTORY - #if (BUILD_MODEM_TYPE == BUILD_MODEM_DIGI_XBEE_CELLULAR_TRANSPARENT) - modemPhy.setApn(epc_apn, false); - dataLogger.attachModem(modemPhy); - #elif (BUILD_MODEM_TYPE == BUILD_MODEM_SIM_COM_SIM7080) - - modemPhy.setApn(epc_apn, false); - dataLogger.attachModem(modemPhy); - /** Start [setup_sim7080] */ - modemPhy.setModemWakeLevel(HIGH); // ModuleFun Bee inverts the signal - modemPhy.setModemResetLevel(HIGH); // ModuleFun Bee inverts the signal - Serial.println(F("Waking modem and setting Cellular Carrier Options...")); - modemPhy.modemWake(); // NOTE: This will also set up the modem - modemPhy.gsmModem.setBaud(modemBaud); // Make sure we're *NOT* auto-bauding! - modemPhy.gsmModem.setNetworkMode(38); // set to LTE only - // 2 Automatic - // 13 GSM only - // 38 LTE only - // 51 GSM and LTE only - modemPhy.gsmModem.setPreferredMode(1); // set to CAT-M - // 1 CAT-M - // 2 NB-IoT - // 3 CAT-M and NB-IoT - Serial.println(F("SIM7080 left on for NIST time sync")); - - /** End [setup_sim7080] */ - #elif (BUILD_MODEM_TYPE == BUILD_MODEM_DIGI_XBEE_WIFI) || \ - (BUILD_MODEM_TYPE == BUILD_MODEM_ESPRESSIF_ESP32) - - modemPhy.setWiFiId(epc_WiFiId,false); - modemPhy.setWiFiPwd(epc_WiFiPwd,false); - dataLogger.attachModem(modemPhy); - //modemPhy.setModemLED(modemLEDPin); - - void checkModemBaud(); - #endif //// not !BUILD_MODEM_FACTORY - if (BT_MAYFLY_0_5==boardType) { - modemPhy.setPowerPin(modemVccPin_mayfly_0_5 ); - } - #endif // BUILD_MODEM_TYPE== - -#endif // defined BUILD_MODEM_TYPE - - // Begin the logger - MS_DBG(F("---dataLogger.begin ")); - dataLogger.begin(); -#if defined UseModem_PushData -#if defined USE_PUB_MMW -#if (BUILD_MODEM_TYPE == BUILD_MODEM_FACTORY) - EnviroDIYPOST.begin(dataLogger, inGsmClient, - ps_ram.app.provider.s.ed.registration_token, - ps_ram.app.provider.s.ed.sampling_feature); -#else // ! BUILD_MODEM_FACTORY - EnviroDIYPOST.begin(dataLogger, &modemPhy.gsmClient, - ps_ram.app.provider.s.ed.registration_token, - ps_ram.app.provider.s.ed.sampling_feature); - -#endif //BUILD_MODEM_TYPE == - - EnviroDIYPOST.setDIYHost(ps_ram.app.provider.s.ed.cloudId); - EnviroDIYPOST.setQuedState(true); - EnviroDIYPOST.setTimerPostTimeout_mS(ps_ram.app.provider.s.ed.timerPostTout_ms); - EnviroDIYPOST.setTimerPostPacing_mS(ps_ram.app.provider.s.ed.timerPostPace_ms); -#endif //USE_PUB_MMW -#if defined USE_PUB_TSMQTT - TsMqttPub.begin(dataLogger, inGsmClient , - ps_ram.app.provider.s.ts.thingSpeakMQTTKey, - ps_ram.app.provider.s.ts.thingSpeakChannelID, - ps_ram.app.provider.s.ts.thingSpeakChannelKey); - //FUT: njh tbd extensions for Reliable delivery - //TsMqttPub.setQuedState(true); - //TsMqttPub.setTimerPostTimeout_mS(ps_ram.app.provider.s.ts.timerPostTout_ms); - //TsMqttPub.setTimerPostPacing_mS(ps_ram.app.provider.s.ts.timerPostPace_ms); -#endif// USE_PUB_TSMQTT -#if defined USE_PUB_UBIDOTS - UbidotsPub.begin(dataLogger, inGsmClient , - ps_ram.app.provider.s.ub.authentificationToken, - ps_ram.app.provider.s.ub.deviceID); - //FUT: njh tbd extensions for Reliable delivery - //UbidotsPub.setQuedState(true); - //UbidotsPub.setTimerPostTimeout_mS(ps_ram.app.provider.s.ts.timerPostTout_ms); - //UbidotsPub.setTimerPostPacing_mS(ps_ram.app.provider.s.ts.timerPostPace_ms); -#endif // USE_PUB_UBIDOTS - - dataLogger.setSendQueSz_num(ps_ram.app.msn.s.sendQueSz_num); - dataLogger.setSendEveryX(ps_ram.app.msn.s.collectReadings_num); - dataLogger.setSendOffset(ps_ram.app.msn.s.sendOffset_min); // delay Minutes - dataLogger.setPostMax_num(ps_ram.app.msn.s.postMax_num); - -#endif // UseModem_PushData - -// Sync the clock if we have good battery else assume set -#define LiIon_BAT_REQ BM_PWR_HEAVY_REQ -#if defined BUILD_MODEM_TYPE && !defined NO_FIRST_SYNC_WITH_NIST - - // The comms module is supported and its expected to be configured. - // ToDo Test - there may be a runtime use case where it exists but shouldn't be used? - if (batteryCheck(LiIon_BAT_REQ, false,2)) - { - MS_DBG(F("Sync with NIST "), bms.getBatteryVm1(), - F("Req"), LiIon_BAT_REQ, F("Got"), - bms.isBatteryStatusAbove(true, LiIon_BAT_REQ)); - - bool syncResult = dataLogger.syncRTC(); // Will also set up the modemPhy - PRINTOUT(F("Sync="),syncResult ,F("with NIST over "), - #if BUILD_MODEM_TYPE == BUILD_MODEM_FACTORY - loggerModemPhyInst->getModemName() - #else - modemPhy.getModemName() - #endif - ); - } else { - MS_DBG(F("Skipped sync with NIST as not enough power "), bms.getBatteryVm1(), - F("Req"), LiIon_BAT_REQ ); - } -#endif // BUILD_MODEM_TYPE - // List start time, if RTC invalid will also be initialized - PRINTOUT(F("Local Time "), - dataLogger.formatDateTime_ISO8601(dataLogger.getNowLocalEpoch())); - PRINTOUT(F("Time local epoch "),dataLogger.getNowLocalEpoch()); - PRINTOUT(F("Time UTC epoch "),dataLogger.getNowUTCEpoch()); - - //Setup sensors, including reading sensor data sheet that can be recorded on SD card - PRINTOUT(F("Setting up sensors...")); - batteryCheck(BM_PWR_SENSOR_CONFIG_BUILD_SPECIFIC, true,3); - varArray.setupSensors(); -// Create the log file, adding the default header to it -// Do this last so we have the best chance of getting the time correct and -// all sensor names correct -// Writing to the SD card can be power intensive, so if we're skipping -// the sensor setup we'll skip this too. - -#if defined MAYFLY_BAT_STC3100 - //Setsup - Sensor not initialized yet. Reads unique serial number - //stc3100_phy.stc3100_device.begin(); assumes done - uint8_t dm_lp=0; - while (!(batteryFuelGauge_present = stc3100_phy.stc3100_device.start())) { - PRINTOUT(F("STC3100 Not detected!")); - if (dm_lp++ > 5) break; - delay(100); - } - String sn(stc3100_phy.stc3100_device.getSn()); - PRINTOUT(F("STC3100 sn:"),sn); - //sn updated (12chars) so maybe be different than 13717d611 - //if sn special, change series resistor range 13717D6110 - // 013717d61100 - // 123456789012 - stc3100_phy.stc3100_device.setBatteryCapacity_mAh(epc_battery_mAhr); - stc3100_phy.stc3100_device.dmBegin(); //begin the Device Manager - //managementSensorsPoll(); stc3100_phy.stc3100_device.v.voltage_V - #define STCDM_POLL 20 - #define STCDM_MIN_V 2.5 - - for (dm_lp=0;dm_lp