|
6 | 6 | Information on serial monitor. |
7 | 7 | Radio beacon implemented. |
8 | 8 | Motion detection interrupt implemented. |
9 | | - v1.5.3 |
| 9 | + v1.5.4 |
10 | 10 | */ |
11 | 11 |
|
12 | 12 | #include <skylabLR.h> |
@@ -34,7 +34,7 @@ bool alcSyncEnable = 0; //enable alc sync service on port 202 to sync time. not |
34 | 34 |
|
35 | 35 | /*Interval options*/ |
36 | 36 | uint16_t intervalTime = 15; //default interval, in minutes |
37 | | -uint16_t controlTime = 1415; // default control interval, in minutes, control message in a bit less than every 24h |
| 37 | +uint16_t controlTime = 1415; //default control interval, in minutes, control message in a bit less than every 24h |
38 | 38 | uint16_t motionIntervalTime = 1; //interval when motion detected and motionActivation is on. |
39 | 39 | uint16_t timeInMotionInterval = 5; //time to use motion interval since last motion detection, after this amount of minutes the system goes back to the normal intervalTime |
40 | 40 |
|
@@ -153,6 +153,8 @@ void setup() { |
153 | 153 | delay(10); |
154 | 154 | /*Init EEPROM values*/ |
155 | 155 | read_config_flashEEPROM(); |
| 156 | + intervalCurrent = intervalTime; //set current interval to interval from EEPROM |
| 157 | + counter = intervalTime; //set counter to intervalTime to send first message within minute after startup |
156 | 158 | /*Join network*/ |
157 | 159 | LR1110_join(); |
158 | 160 | if (ledActivation == 1) { |
@@ -194,7 +196,7 @@ void beacon_function() { //function that activates beacon |
194 | 196 | Serial.println(modem_response_code); //print command response from last packet |
195 | 197 | counter3++; //add 1 to counter 3 |
196 | 198 | Serial.print("Beacon timer: "); |
197 | | - Serial.print(counter3); // print counter 3 |
| 199 | + Serial.print(counter3); //print counter 3 |
198 | 200 | Serial.println(" secondes"); |
199 | 201 | rtc.setSeconds(5); //set time to 5 second so that interrupt occurs again next second |
200 | 202 | digitalWrite(LEDG, HIGH); //turn the led off |
@@ -675,7 +677,7 @@ void LR1110_event_flush() { //function flushes the open events in the LR1110 and |
675 | 677 | void LR1110_WiFi_scan() { //function to do a Wi-Fi scan |
676 | 678 | lr1110_modem_response_code_t modem_response_code; |
677 | 679 | wifi.settings.enabled = true; |
678 | | - wifi.settings.channels = 0x3FFF; // by default enable all channels |
| 680 | + wifi.settings.channels = 0x3FFF; //by default enable all channels |
679 | 681 | wifi.settings.types = LR1110_MODEM_WIFI_TYPE_SCAN_B_G_N; |
680 | 682 | wifi.settings.scan_mode = LR1110_MODEM_WIFI_SCAN_MODE_BEACON_AND_PACKET; |
681 | 683 | wifi.settings.nbr_retrials = 5; |
@@ -998,9 +1000,9 @@ void BME280_init() { //start BME280 sensor |
998 | 1000 | Wire.begin(); //start i2c |
999 | 1001 | status = bme.begin(0x77); //adress BME280 onboard |
1000 | 1002 | bme.setSampling(Adafruit_BME280::MODE_FORCED, //forced mode |
1001 | | - Adafruit_BME280::SAMPLING_X1, // temperature sampling |
1002 | | - Adafruit_BME280::SAMPLING_X1, // pressure sampling |
1003 | | - Adafruit_BME280::SAMPLING_X1, // humidity sampling |
| 1003 | + Adafruit_BME280::SAMPLING_X1, //temperature sampling |
| 1004 | + Adafruit_BME280::SAMPLING_X1, //pressure sampling |
| 1005 | + Adafruit_BME280::SAMPLING_X1, //humidity sampling |
1004 | 1006 | Adafruit_BME280::FILTER_OFF ); //no filter |
1005 | 1007 | Wire.end(); //stop i2c |
1006 | 1008 | } |
|
0 commit comments