Commit cccba366 authored by user2684's avatar user2684 Committed by GitHub
Browse files

Add debug message with encryption status #116

Add debug message with encryption status
parent b23a1131
...@@ -2176,10 +2176,28 @@ bool NodeManager::renameSensor(int old_child_id, int new_child_id) { ...@@ -2176,10 +2176,28 @@ bool NodeManager::renameSensor(int old_child_id, int new_child_id) {
// setup NodeManager // setup NodeManager
void NodeManager::before() { void NodeManager::before() {
// print out the version
#if DEBUG == 1 #if DEBUG == 1
Serial.print(F("NodeManager v")); Serial.print(F("NodeManager v"));
Serial.println(VERSION); Serial.println(VERSION);
#endif #endif
// print out MySensors' library capabilities
#if DEBUG == 1
Serial.print(F("LIB R="));
Serial.print(MY_CAP_RADIO);
#ifdef MY_CAP_ENCR
Serial.print(F(" E="));
Serial.print(MY_CAP_ENCR);
#endif
Serial.print(F(" T="));
Serial.print(MY_CAP_TYPE);
Serial.print(F(" A="));
Serial.print(MY_CAP_ARCH);
Serial.print(F(" S="));
Serial.print(MY_CAP_SIGN);
Serial.print(F(" B="));
Serial.println(MY_CAP_RXBUF);
#endif
// setup the sleep interrupt pin // setup the sleep interrupt pin
if (_sleep_interrupt_pin > -1) { if (_sleep_interrupt_pin > -1) {
// set the interrupt when the pin is connected to ground // set the interrupt when the pin is connected to ground
......
...@@ -257,6 +257,7 @@ enum supported_sensors { ...@@ -257,6 +257,7 @@ enum supported_sensors {
// include MySensors libraries // include MySensors libraries
#include <core/MySensorsCore.h> #include <core/MySensorsCore.h>
#include <core/MyCapabilities.h>
// include third party libraries // include third party libraries
#if MODULE_DHT == 1 #if MODULE_DHT == 1
......
...@@ -45,7 +45,7 @@ Since NodeManager has to communicate with the MySensors gateway on your behalf, ...@@ -45,7 +45,7 @@ Since NodeManager has to communicate with the MySensors gateway on your behalf,
* Sketch configuration * Sketch configuration
*/ */
#define SKETCH_NAME "NodeManagerTemplate" #define SKETCH_NAME "NodeManager"
#define SKETCH_VERSION "1.0" #define SKETCH_VERSION "1.0"
/********************************** /**********************************
...@@ -397,7 +397,7 @@ The following methods are available for all the sensors: ...@@ -397,7 +397,7 @@ The following methods are available for all the sensors:
Each sensor class can expose additional methods. Each sensor class can expose additional methods.
* SensorAnalogInput / SensorLDR / SensorRain / SensorSoilMoisture * * SensorAnalogInput / SensorLDR / SensorRain / SensorSoilMoisture
~~~c ~~~c
// the analog reference to use (default: not set, can be either INTERNAL or DEFAULT) // the analog reference to use (default: not set, can be either INTERNAL or DEFAULT)
void setReference(int value); void setReference(int value);
...@@ -411,7 +411,7 @@ Each sensor class can expose additional methods. ...@@ -411,7 +411,7 @@ Each sensor class can expose additional methods.
void setRangeMax(int value); void setRangeMax(int value);
~~~ ~~~
* SensorThermistor * * SensorThermistor
~~~c ~~~c
// resistance at 25 degrees C (default: 10000) // resistance at 25 degrees C (default: 10000)
void setNominalResistor(long value); void setNominalResistor(long value);
...@@ -425,7 +425,7 @@ Each sensor class can expose additional methods. ...@@ -425,7 +425,7 @@ Each sensor class can expose additional methods.
void setOffset(float value); void setOffset(float value);
~~~ ~~~
* SensorMQ * * SensorMQ
~~~c ~~~c
// define the target gas whose ppm has to be returned. 0: LPG, 1: CO, 2: Smoke (default: 1); // define the target gas whose ppm has to be returned. 0: LPG, 1: CO, 2: Smoke (default: 1);
void setTargetGas(int value); void setTargetGas(int value);
...@@ -451,7 +451,7 @@ Each sensor class can expose additional methods. ...@@ -451,7 +451,7 @@ Each sensor class can expose additional methods.
void setSmokeCurve(float *value); void setSmokeCurve(float *value);
~~~ ~~~
* SensorDigitalOutput / SensorRelay / SensorLatchingRelay * * SensorDigitalOutput / SensorRelay / SensorLatchingRelay
~~~c ~~~c
// set how to initialize the output (default: LOW) // set how to initialize the output (default: LOW)
void setInitialValue(int value); void setInitialValue(int value);
...@@ -463,7 +463,7 @@ Each sensor class can expose additional methods. ...@@ -463,7 +463,7 @@ Each sensor class can expose additional methods.
void setLegacyMode(bool value); void setLegacyMode(bool value);
~~~ ~~~
* SensorSwitch / SensorDoor / SensorMotion * * SensorSwitch / SensorDoor / SensorMotion
~~~c ~~~c
// set the interrupt mode. Can be CHANGE, RISING, FALLING (default: CHANGE) // set the interrupt mode. Can be CHANGE, RISING, FALLING (default: CHANGE)
void setMode(int value); void setMode(int value);
...@@ -487,13 +487,13 @@ Each sensor class can expose additional methods. ...@@ -487,13 +487,13 @@ Each sensor class can expose additional methods.
void setSleepDuringConversion(bool value); void setSleepDuringConversion(bool value);
~~~ ~~~
* SensorBME280 * * SensorBME280
~~~c ~~~c
// define how many pressure samples to keep track of for calculating the forecast (default: 5) // define how many pressure samples to keep track of for calculating the forecast (default: 5)
void setForecastSamplesCount(int value); void setForecastSamplesCount(int value);
~~~ ~~~
* SensorSonoff * * SensorSonoff
~~~c ~~~c
// set the button's pin (default: 0) // set the button's pin (default: 0)
void setButtonPin(int value); void setButtonPin(int value);
...@@ -503,13 +503,13 @@ Each sensor class can expose additional methods. ...@@ -503,13 +503,13 @@ Each sensor class can expose additional methods.
void setLedPin(int value); void setLedPin(int value);
~~~ ~~~
* SensorBMP085 * * SensorBMP085
~~~c ~~~c
// define how many pressure samples to keep track of for calculating the forecast (default: 5) // define how many pressure samples to keep track of for calculating the forecast (default: 5)
void setForecastSamplesCount(int value); void setForecastSamplesCount(int value);
~~~ ~~~
* SensorHCSR04 * * SensorHCSR04
~~~c ~~~c
// Arduino pin tied to trigger pin on the ultrasonic sensor (default: the pin set while registering the sensor) // Arduino pin tied to trigger pin on the ultrasonic sensor (default: the pin set while registering the sensor)
void setTriggerPin(int value); void setTriggerPin(int value);
...@@ -519,7 +519,7 @@ Each sensor class can expose additional methods. ...@@ -519,7 +519,7 @@ Each sensor class can expose additional methods.
void setMaxDistance(int value); void setMaxDistance(int value);
~~~ ~~~
* SensorACS712 * * SensorACS712
~~~c ~~~c
// set how many mV are equivalent to 1 Amp. The value depends on the module (100 for 20A Module, 66 for 30A Module) (default: 185); // set how many mV are equivalent to 1 Amp. The value depends on the module (100 for 20A Module, 66 for 30A Module) (default: 185);
void setmVPerAmp(int value); void setmVPerAmp(int value);
...@@ -527,7 +527,7 @@ Each sensor class can expose additional methods. ...@@ -527,7 +527,7 @@ Each sensor class can expose additional methods.
void setOffset(int value); void setOffset(int value);
~~~ ~~~
* SensorRainGauge * * SensorRainGauge
~~~c ~~~c
// set how frequently to report back to the controller in minutes. After reporting the measure is resetted (default: 60); // set how frequently to report back to the controller in minutes. After reporting the measure is resetted (default: 60);
void setReportInterval(int value); void setReportInterval(int value);
...@@ -594,38 +594,38 @@ If `PERSIST` is enabled, the settings provided with `INTVLnnnX` and `MODEx` are ...@@ -594,38 +594,38 @@ If `PERSIST` is enabled, the settings provided with `INTVLnnnX` and `MODEx` are
A NodeManager object must be created and called from within your sketch during `before()`, `presentation()`, `loop()` and `receive()` to work properly. NodeManager will do the following during each phase: A NodeManager object must be created and called from within your sketch during `before()`, `presentation()`, `loop()` and `receive()` to work properly. NodeManager will do the following during each phase:
* NodeManager::before() * NodeManager::before():
* Setup the interrupt pins to wake up the board based on the configured interrupts (e.g. stop sleeping when the pin is connected to ground or wake up and notify when a motion sensor has trigger) * Setup the interrupt pins to wake up the board based on the configured interrupts (e.g. stop sleeping when the pin is connected to ground or wake up and notify when a motion sensor has trigger)
* If persistance is enabled, restore from the EEPROM the latest sleeping settings * If persistance is enabled, restore from the EEPROM the latest sleeping settings
* Call `before()` of each registered sensor * Call `before()` of each registered sensor
* Sensor::before() * Sensor::before():
* Call sensor-specific implementation of before by invoking `onBefore()` to initialize the sensor * Call sensor-specific implementation of before by invoking `onBefore()` to initialize the sensor
* NodeManager::setup() * NodeManager::setup():
* Send a custom message with a STARTED payload to the controller * Send a custom message with a STARTED payload to the controller
* Call `setup()` of each registered sensor * Call `setup()` of each registered sensor
* Sensor::setup() * Sensor::setup():
* Call sensor-specific implementation of setup by invoking `onSetup()` to initialize the sensor * Call sensor-specific implementation of setup by invoking `onSetup()` to initialize the sensor
* NodeManager::loop() * NodeManager::loop():
* If all the sensors are powered by an arduino pin, this is set to HIGH * If all the sensors are powered by an arduino pin, this is set to HIGH
* Call `loop()` of each registered sensor * Call `loop()` of each registered sensor
* If all the sensors are powered by an arduino pin, this is set to LOW * If all the sensors are powered by an arduino pin, this is set to LOW
* Sensor::loop() * Sensor::loop():
* If the sensor is powered by an arduino pin, this is set to HIGH * If the sensor is powered by an arduino pin, this is set to HIGH
* For each registered sensor, the sensor-specific `onLoop()` is called. If multiple samples are requested, this is run multiple times. * For each registered sensor, the sensor-specific `onLoop()` is called. If multiple samples are requested, this is run multiple times.
* In case multiple samples have been collected, the average is calculated * In case multiple samples have been collected, the average is calculated
* A message is sent to the gateway with the calculated value. Depending on the configuration, this is not sent if it is the same as the previous value or sent anyway after a given number of cycles. These functionalies are not sensor-specific and common to all the sensors inheriting from the `Sensor` class. * A message is sent to the gateway with the calculated value. Depending on the configuration, this is not sent if it is the same as the previous value or sent anyway after a given number of cycles. These functionalies are not sensor-specific and common to all the sensors inheriting from the `Sensor` class.
* If the sensor is powered by an arduino pin, this is set to LOW * If the sensor is powered by an arduino pin, this is set to LOW
* NodeManager::receive() * NodeManager::receive():
* Receive a message from the radio network * Receive a message from the radio network
* If the destination child id is the configuration node, it will handle the incoming message, otherwise will dispatch the message to the recipient sensor * If the destination child id is the configuration node, it will handle the incoming message, otherwise will dispatch the message to the recipient sensor
* Sensor::receive() * Sensor::receive():
* Invoke `Sensor::loop()` which will execute the sensor main taks and eventually call `Sensor::onReceive()` * Invoke `Sensor::loop()` which will execute the sensor main taks and eventually call `Sensor::onReceive()`
## Examples ## Examples
...@@ -698,7 +698,7 @@ Register a latching relay connecting to pin 6 (set) and pin 7 (unset): ...@@ -698,7 +698,7 @@ Register a latching relay connecting to pin 6 (set) and pin 7 (unset):
## Example Sketches ## Example Sketches
* Analog Light and Temperature Sensor * * Analog Light and Temperature Sensor
The following sketch can be used to report the temperature and the light level based on a thermistor and LDR sensors attached to two analog pins of the arduino board (A1 and A2). Both the thermistor and the LDR are connected to ground on one side and to vcc via a resistor on the other so to measure the voltage drop across each of them through the analog pins. The following sketch can be used to report the temperature and the light level based on a thermistor and LDR sensors attached to two analog pins of the arduino board (A1 and A2). Both the thermistor and the LDR are connected to ground on one side and to vcc via a resistor on the other so to measure the voltage drop across each of them through the analog pins.
...@@ -780,7 +780,7 @@ void receiveTime(unsigned long ts) { ...@@ -780,7 +780,7 @@ void receiveTime(unsigned long ts) {
} }
~~~ ~~~
* Motion Sensor * * Motion Sensor
The following sketch can be used to report back to the controller when a motion sensor attached to the board's pin 3 triggers. In this example, the board will be put to sleep just after startup and will report a heartbeat every hour. NodeManager will take care of configuring an interrupt associated to the provided pin so automatically wake up when a motion is detected and report a V_TRIPPED message back. This sketch requires MODULE_SWITCH to be enabled in the global config.h file. The following sketch can be used to report back to the controller when a motion sensor attached to the board's pin 3 triggers. In this example, the board will be put to sleep just after startup and will report a heartbeat every hour. NodeManager will take care of configuring an interrupt associated to the provided pin so automatically wake up when a motion is detected and report a V_TRIPPED message back. This sketch requires MODULE_SWITCH to be enabled in the global config.h file.
...@@ -862,7 +862,7 @@ void receiveTime(unsigned long ts) { ...@@ -862,7 +862,7 @@ void receiveTime(unsigned long ts) {
} }
~~~ ~~~
* Boiler Sensor * * Boiler Sensor
The following sketch controls a latching relay connected to a boiler. A latching relay (requiring only a pulse to switch) has been chosen to minimize the power consumption required by a traditional relay to stay on. This relay has normally two pins, one for closing and the other for opening the controlled circuit, connected to pin 6 and 7 of the arduino board. This is why we have to register two sensors against NodeManager so to control the two funtions indipendently. Since using a SENSOR_LATCHING_RELAY type of sensor, NodeManager will take care of just sending out a single pulse only when a REQ command of type V_STATUS is sent to one or the other child id. The following sketch controls a latching relay connected to a boiler. A latching relay (requiring only a pulse to switch) has been chosen to minimize the power consumption required by a traditional relay to stay on. This relay has normally two pins, one for closing and the other for opening the controlled circuit, connected to pin 6 and 7 of the arduino board. This is why we have to register two sensors against NodeManager so to control the two funtions indipendently. Since using a SENSOR_LATCHING_RELAY type of sensor, NodeManager will take care of just sending out a single pulse only when a REQ command of type V_STATUS is sent to one or the other child id.
...@@ -952,7 +952,7 @@ void receiveTime(unsigned long ts) { ...@@ -952,7 +952,7 @@ void receiveTime(unsigned long ts) {
~~~ ~~~
* Rain and Soil Moisture Sensor * * Rain and Soil Moisture Sensor
The following sketch can be used to report the rain level and the soil moisture based on two sensors connected to the board's analog pins (A1 and A2). In this case we are customizing the out-of-the-box SENSOR_ANALOG_INPUT sensor type since we just need to measure an analog input but we also want to provide the correct type and presentation for each sensor. The following sketch can be used to report the rain level and the soil moisture based on two sensors connected to the board's analog pins (A1 and A2). In this case we are customizing the out-of-the-box SENSOR_ANALOG_INPUT sensor type since we just need to measure an analog input but we also want to provide the correct type and presentation for each sensor.
...@@ -1076,8 +1076,8 @@ For reporting an issue, requesting support for a new sensor or any other kind of ...@@ -1076,8 +1076,8 @@ For reporting an issue, requesting support for a new sensor or any other kind of
If you want to contribute to the code, a pull request on Github is the way to go. First of all setup your development environment: If you want to contribute to the code, a pull request on Github is the way to go. First of all setup your development environment:
* Create a copy of the project in your Github account by clicking on the "Fork" button on https://github.com/mysensors/NodeManager. * Create a copy of the project in your Github account by clicking on the "Fork" button on `https://github.com/mysensors/NodeManager`
* Check the copy actually exists on https://github.com/<username>/NodeManager * Check the copy actually exists on `https://github.com/<username>/NodeManager`
* Clone your repository on your computer: `git clone https://github.com/<username>/NodeManager.git` * Clone your repository on your computer: `git clone https://github.com/<username>/NodeManager.git`
* Configure the main project's repository as an upstream: `git remote add upstream https://github.com/mysensors/NodeManager.git` * Configure the main project's repository as an upstream: `git remote add upstream https://github.com/mysensors/NodeManager.git`
* Create and switch to a local development branch: `git checkout -b development origin/development` * Create and switch to a local development branch: `git checkout -b development origin/development`
...@@ -1086,18 +1086,21 @@ Before applying any change, ensure you have the latest development version avail ...@@ -1086,18 +1086,21 @@ Before applying any change, ensure you have the latest development version avail
* Switch to your local development branch: `git checkout development` * Switch to your local development branch: `git checkout development`
* Fetch the latest version from the main project's repository: `git fetch upstream` * Fetch the latest version from the main project's repository: `git fetch upstream`
* Merge into your development copy all the changes from the main repository: `git merge development upstream/development` * Merge into your development copy all the changes from the main repository: `git merge development upstream/development`
* Update the development branch of your repository: `git push origin development`
Create a branch for the fix/feature you want to work on and apply changes to the code: Create a branch for the fix/feature you want to work on and apply changes to the code:
* Create and switch to a new branch (give it a significant name, e.g. fix/enum-sensors): `git checkout -b <yourbranch>` * Create and switch to a new branch (give it a significant name, e.g. fix/enum-sensors): `git checkout -b <yourbranch>`
* Do any required change to the code * Do any required change to the code
* Include all the files changed for your commit: `git add .` * Include all the files changed for your commit: `git add .`
* Commit the changes: `git commit -m"Use enum instead of define for defining each sensor #121"` * Commit the changes: `git commit -m"Use enum instead of define for defining each sensor #121"`
* Ensure both the main sketch and the config.h file do not present any change
* Push the branch with the changes to your repository: `git push origin <yourbranch>` * Push the branch with the changes to your repository: `git push origin <yourbranch>`
* Visit https://github.com/<username>/NodeManager/branches and click the "New pull request" button just aside your newly created branch * Visit `https://github.com/<username>/NodeManager/branches` and click the "New pull request" button just aside your newly created branch
* Fill in the request with a significant title and description and select the "development" branch from the main repository to be compared against your branch * Fill in the request with a significant title and description and select the "development" branch from the main repository to be compared against your branch
* Submit the request and start the discussion * Submit the request and start the discussion
* Any additional commits to your branch which will be presented within the same pull request * Any additional commits to your branch which will be presented within the same pull request
* When the pull request is merged, delete your working branch: `git branch -d <yourbranch>` * When the pull request is merged, delete your working branch: `git branch -D <yourbranch>`
* Update your local and remote development branch as per the instructions above
If there are changes introduced to the development branch that conflicts with an open pull request, you will have to resolve the conflicts and update the PR: If there are changes introduced to the development branch that conflicts with an open pull request, you will have to resolve the conflicts and update the PR:
* Fetch and merge into development any change from upstream/development as detailed above * Fetch and merge into development any change from upstream/development as detailed above
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment