You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#defineSerialAT Serial2 // Define Serial for AT commands
35
+
#defineSerialMon Serial // Define Serial monitor
36
+
#defineSerialAT Serial2 // Define Serial for AT commands
37
37
// #define DUMP_AT_COMMANDS // Dump AT commands to Serial for debugging.
38
-
#defineTINY_GSM_DEBUG SerialMon // Debug stream
39
-
#defineGSM_PIN "" // SIM card PIN (leave empty if not defined)
40
-
#defineTINY_GSM_USE_GPRS true // Use GPRS for internet connection
41
-
#defineMAX_GSM_CONNECTION_REATTEMPTS 3 // Maximum number of reattempts to connect to GSM network. then will send another sms saying the system is down.
38
+
#defineTINY_GSM_DEBUG SerialMon // Debug stream
39
+
#defineGSM_PIN "" // SIM card PIN (leave empty if not defined)
40
+
#defineTINY_GSM_USE_GPRS true // Use GPRS for internet connection
41
+
#defineMAX_GSM_CONNECTION_REATTEMPTS 3 // Maximum number of reattempts to connect to GSM network. then will send another sms saying the system is down.
42
42
#defineMAX_MQTT_CONNECTION_REATTEMPTS 3 // Maximum number of reattempts to connect to MQTT server. then will send another sms saying the system is down.
Copy file name to clipboardExpand all lines: src/utlis.cpp
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -2,8 +2,7 @@
2
2
#include<constants.h>
3
3
#include<LoRa.h>
4
4
#include<Preferences.h>
5
-
#include<nvs_flash.h>// Include the NVS flash library for manual NVS initialization
6
-
5
+
#include<nvs_flash.h>// Include the NVS flash library for manual NVS initialization
7
6
8
7
voidsetupSerial()
9
8
{ // Function to setup serial communication
@@ -34,13 +33,14 @@ void initLora()
34
33
// Function to check Preferences for deviceID and generate if not found
35
34
String getDeviceID()
36
35
{
37
-
// Initialize the NVS (Non-Volatile Storage) system (Usually this should be handled by the preferences.h, but there was a error and hence done manually.)
38
-
if (nvs_flash_init() == ESP_ERR_NVS_NO_FREE_PAGES || nvs_flash_init() == ESP_ERR_NVS_NEW_VERSION_FOUND) {
36
+
// Initialize the NVS (Non-Volatile Storage) system (Usually this should be handled by the preferences.h, but there was a error and hence done manually.)
37
+
if (nvs_flash_init() == ESP_ERR_NVS_NO_FREE_PAGES || nvs_flash_init() == ESP_ERR_NVS_NEW_VERSION_FOUND)
38
+
{
39
39
// If NVS partition was truncated or a new version was found, erase it and try again
40
40
nvs_flash_erase();
41
41
nvs_flash_init();
42
42
}
43
-
Preferences preferences; // Create a Preferences object
43
+
Preferences preferences; // Create a Preferences object
44
44
preferences.begin("device_info", false); // Start preferences in read-write mode
0 commit comments