diff --git a/.gitignore b/.gitignore index 126fc83fa4e6c16c24e50bddb945d2b9a20a1dce..918d2c77f9dab9df203a4f5fb4c3f3fdc2405fd7 100755 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,7 @@ *~ *.tmp *.part +.pioenvs +.piolibdeps +.clang_complete +.gcc-flags.json diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000000000000000000000000000000000..2c4ff5c9885cd682b31b389d63a97cf8cee91f55 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,65 @@ +# Continuous Integration (CI) is the practice, in software +# engineering, of merging all developer working copies with a shared mainline +# several times a day < http://docs.platformio.org/page/ci/index.html > +# +# Documentation: +# +# * Travis CI Embedded Builds with PlatformIO +# < https://docs.travis-ci.com/user/integration/platformio/ > +# +# * PlatformIO integration with Travis CI +# < http://docs.platformio.org/page/ci/travis.html > +# +# * User Guide for `platformio ci` command +# < http://docs.platformio.org/page/userguide/cmd_ci.html > +# +# +# Please choice one of the following templates (proposed below) and uncomment +# it (remove "# " before each line) or use own configuration according to the +# Travis CI documentation (see above). +# + + +# +# Template #1: General project. Test it using existing `platformio.ini`. +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# install: +# - pip install -U platformio +# +# script: +# - platformio run + + +# +# Template #2: The project is intended to by used as a library with examples +# + +# language: python +# python: +# - "2.7" +# +# sudo: false +# cache: +# directories: +# - "~/.platformio" +# +# env: +# - PLATFORMIO_CI_SRC=path/to/test/file.c +# - PLATFORMIO_CI_SRC=examples/file.ino +# - PLATFORMIO_CI_SRC=path/to/test/directory +# +# install: +# - pip install -U platformio +# +# script: +# - platformio ci --lib="." --board=ID_1 --board=ID_2 --board=ID_N diff --git a/NodeManager.cpp b/NodeManager.cpp index 72ec15954d19710a9433b914916ccded0ce721f3..113d07769eb7bfacac61ba9a2aae451415b478d1 100644 --- a/NodeManager.cpp +++ b/NodeManager.cpp @@ -4116,3 +4116,4 @@ void NodeManager::_saveConfig() { saveState(EEPROM_SLEEP_2,bit_2); saveState(EEPROM_SLEEP_3,bit_3); } + diff --git a/NodeManager.h b/NodeManager.h index c3bbee9fe09febd99892b57e677b52fd1b27eff7..21a12f3bec0bdae42dcbd3ce10f4d4af1575ca5e 100644 --- a/NodeManager.h +++ b/NodeManager.h @@ -1634,3 +1634,4 @@ class NodeManager { }; #endif + diff --git a/NodeManager.ino b/NodeManager_BME280_EasyPCB.ino old mode 100755 new mode 100644 similarity index 82% rename from NodeManager.ino rename to NodeManager_BME280_EasyPCB.ino index 38bf742c576cb56f705c964c73c6234e66430adb..129b0a75ee78a71aaaa68fe701257a52690eac69 --- a/NodeManager.ino +++ b/NodeManager_BME280_EasyPCB.ino @@ -1,4 +1,3 @@ - /* NodeManager is intended to take care on your behalf of all those common tasks a MySensors node has to accomplish, speeding up the development cycle of your projects. NodeManager includes the following main components: @@ -6,11 +5,11 @@ NodeManager includes the following main components: - Power manager: allows powering on your sensors only while the node is awake - Battery manager: provides common functionalities to read and report the battery level - Remote configuration: allows configuring remotely the node without the need to have physical access to it -- Built-in personalities: for the most common sensors, provide embedded code so to allow their configuration with a single line +- Built-in personalities: for the most common sensors, provide embedded code so to allow their configuration with a single line Documentation available on: https://github.com/mysensors/NodeManager */ - + // load user settings #include "config.h" // include supporting libraries @@ -28,15 +27,20 @@ NodeManager nodeManager; // before void before() { // setup the serial port baud rate - Serial.begin(MY_BAUD_RATE); + Serial.begin(MY_BAUD_RATE); /* * Register below your sensors */ - - + nodeManager.setBatteryMin(1.8); + nodeManager.setBatteryMax(3.3); + nodeManager.setSleepMinutes(10); + nodeManager.setReportIntervalMinutes(10); - + nodeManager.setBatteryReportMinutes(60); +// nodeManager.setSignalReportMinutes(60); + + nodeManager.registerSensor(SENSOR_BME280); /* * Register above your sensors */ @@ -72,3 +76,4 @@ void receiveTime(unsigned long ts) { // call NodeManager receiveTime routine nodeManager.receiveTime(ts); } + diff --git a/config.h b/config.h old mode 100755 new mode 100644 index d93ab3f9292125085d627453d501ad829ae49478..b45535c8cb2e99c6d18a7c9c81f5f437cf60d5a1 --- a/config.h +++ b/config.h @@ -5,7 +5,7 @@ * Sketch configuration */ -#define SKETCH_NAME "NodeManager" +#define SKETCH_NAME "NodeManager BME280" #define SKETCH_VERSION "1.0" /********************************** @@ -23,6 +23,7 @@ //#define MY_RF24_ENABLE_ENCRYPTION //#define MY_RF24_CHANNEL 76 //#define MY_RF24_PA_LEVEL RF24_PA_HIGH +#define MY_RF24_PA_LEVEL RF24_PA_LOW //#define MY_DEBUG_VERBOSE_RF24 //#define MY_RF24_DATARATE RF24_250KBPS @@ -119,20 +120,20 @@ // if enabled, allow modifying the configuration remotely by interacting with the configuration child id #define REMOTE_CONFIGURATION 1 // if enabled, persist the remote configuration settings on EEPROM -#define PERSIST 0 +#define PERSIST 1 // if enabled, a battery sensor will be created at BATTERY_CHILD_ID (201 by default) and will report vcc voltage together with the battery level percentage #define BATTERY_SENSOR 1 // if enabled, a signal sensor will be created at RSSI_CHILD_ID (202 by default) and will report the signal quality of the transport layer -#define SIGNAL_SENSOR 0 +#define SIGNAL_SENSOR 1 // if enabled, send a SLEEPING and AWAKE service messages just before entering and just after leaving a sleep cycle and STARTED when starting/rebooting #define SERVICE_MESSAGES 0 // Enable this module to use one of the following sensors: SENSOR_ANALOG_INPUT, SENSOR_LDR, SENSOR_THERMISTOR, SENSOR_ML8511, SENSOR_ACS712, SENSOR_RAIN, SENSOR_SOIL_MOISTURE -#define MODULE_ANALOG_INPUT 1 +#define MODULE_ANALOG_INPUT 0 // Enable this module to use one of the following sensors: SENSOR_DIGITAL_INPUT -#define MODULE_DIGITAL_INPUT 1 +#define MODULE_DIGITAL_INPUT 0 // Enable this module to use one of the following sensors: SENSOR_DIGITAL_OUTPUT, SENSOR_RELAY, SENSOR_LATCHING_RELAY -#define MODULE_DIGITAL_OUTPUT 1 +#define MODULE_DIGITAL_OUTPUT 0 // Enable this module to use one of the following sensors: SENSOR_DHT11, SENSOR_DHT22 #define MODULE_DHT 0 // Enable this module to use one of the following sensors: SENSOR_SHT21, SENSOR_HTU21D @@ -146,7 +147,7 @@ // Enable this module to use one of the following sensors: SENSOR_MLX90614 #define MODULE_MLX90614 0 // Enable this module to use one of the following sensors: SENSOR_BME280 -#define MODULE_BME280 0 +#define MODULE_BME280 1 // Enable this module to use one of the following sensors: SENSOR_SONOFF #define MODULE_SONOFF 0 // Enable this module to use one of the following sensors: SENSOR_BMP085 @@ -159,9 +160,9 @@ #define MODULE_MQ 0 // Enable this module to use one of the following sensors: SENSOR_MHZ19 #define MODULE_MHZ19 0 -// Enable this module to use one of the following sensors: SENSOR_AM2320 +// Enable this module to use one of the following sensors: SENSOR_AM2320 #define MODULE_AM2320 0 -// Enable this module to use one of the following sensors: SENSOR_TSL2561 +// Enable this module to use one of the following sensors: SENSOR_TSL2561 #define MODULE_TSL2561 0 // Enable this module to use one of the following sensors: SENSOR_PT100 #define MODULE_PT100 0 diff --git a/lib/readme.txt b/lib/readme.txt new file mode 100644 index 0000000000000000000000000000000000000000..dbadc3d6300dc26014ef1a9704190db470289c3d --- /dev/null +++ b/lib/readme.txt @@ -0,0 +1,36 @@ + +This directory is intended for the project specific (private) libraries. +PlatformIO will compile them to static libraries and link to executable file. + +The source code of each library should be placed in separate directory, like +"lib/private_lib/[here are source files]". + +For example, see how can be organized `Foo` and `Bar` libraries: + +|--lib +| |--Bar +| | |--docs +| | |--examples +| | |--src +| | |- Bar.c +| | |- Bar.h +| |--Foo +| | |- Foo.c +| | |- Foo.h +| |- readme.txt --> THIS FILE +|- platformio.ini +|--src + |- main.c + +Then in `src/main.c` you should use: + +#include <Foo.h> +#include <Bar.h> + +// rest H/C/CPP code + +PlatformIO will find your libraries automatically, configure preprocessor's +include paths and build them. + +More information about PlatformIO Library Dependency Finder +- http://docs.platformio.org/page/librarymanager/ldf.html diff --git a/platformio.ini b/platformio.ini new file mode 100644 index 0000000000000000000000000000000000000000..15fcc08bcd9cc0f205df432856c304c530df440d --- /dev/null +++ b/platformio.ini @@ -0,0 +1,19 @@ +; 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] +src_dir = . + +[env:pro8MHzatmega328] +platform = atmelavr +board = pro8MHzatmega328 +framework = arduino +lib_deps = MySensors +upload_port = /dev/ttyUSB0