1
1
// ----------------------------------------
2
2
3
- #ifdef COMPILE_CELLULAR
3
+ #ifdef COMPILE_CELLULAR
4
4
5
5
// The following define is used to avoid confusion between the cellular
6
6
// code and the GNSS code where PPP has a completely different meaning.
7
7
// The remaining references to PPP in this code are present due to values
8
8
// from the PPP (Point-to-Point Protocol) driver and ARDUINO_EVENT_PPP_*
9
9
// events.
10
- #define CELLULAR PPP
10
+ #define CELLULAR PPP
11
11
12
12
// ----------------------------------------
13
13
// Cellular interface definitions
14
14
15
- #define CELLULAR_MODEM_MODEL PPP_MODEM_GENERIC
15
+ #define CELLULAR_MODEM_MODEL PPP_MODEM_GENERIC
16
16
17
- #define CELLULAR_MODEM_APN " internet"
18
- #define CELLULAR_MODEM_PIN NULL // Personal Identification Number: String in double quotes
17
+ #define CELLULAR_MODEM_APN " internet"
18
+ #define CELLULAR_MODEM_PIN NULL // Personal Identification Number: String in double quotes
19
19
20
- #define CELLULAR_BOOT_DELAY DELAY_SEC (15 ) // Delay after boot before starting cellular
20
+ #define CELLULAR_BOOT_DELAY DELAY_SEC (15 ) // Delay after boot before starting cellular
21
21
22
- #define CELLULAR_ATTACH_POLL_INTERVAL 100 // Milliseconds
22
+ #define CELLULAR_ATTACH_POLL_INTERVAL 100 // Milliseconds
23
23
24
24
// ----------------------------------------
25
25
@@ -44,7 +44,7 @@ void cellularAttached(NetIndex_t index, uintptr_t parameter, bool debug)
44
44
cellularIsAttached = CELLULAR.attached ();
45
45
if (cellularIsAttached)
46
46
{
47
- // Attached to a mobile network, continue
47
+ // Attached to a mobile network, continue
48
48
// Display the network information
49
49
systemPrintf (" Cellular attached to %s\r\n " , CELLULAR.operatorName ().c_str ());
50
50
@@ -69,7 +69,7 @@ void cellularAttached(NetIndex_t index, uintptr_t parameter, bool debug)
69
69
// Switch into a state where data may be sent and received
70
70
if (debug)
71
71
systemPrintln (" Switching to data mode..." );
72
- CELLULAR.mode (ESP_MODEM_MODE_CMUX); // Data and Command mixed mode
72
+ CELLULAR.mode (ESP_MODEM_MODE_CMUX); // Data and Command mixed mode
73
73
74
74
// Get the next sequence entry
75
75
networkSequenceNextEntry (index, debug);
@@ -86,10 +86,8 @@ void cellularEvent(arduino_event_id_t event)
86
86
String module ;
87
87
88
88
// Take the network offline if necessary
89
- if (networkIsInterfaceOnline (NETWORK_CELLULAR)
90
- && (event != ARDUINO_EVENT_ETH_GOT_IP)
91
- && (event != ARDUINO_EVENT_ETH_GOT_IP6)
92
- && (event != ARDUINO_EVENT_PPP_CONNECTED))
89
+ if (networkIsInterfaceOnline (NETWORK_CELLULAR) && (event != ARDUINO_EVENT_ETH_GOT_IP) &&
90
+ (event != ARDUINO_EVENT_ETH_GOT_IP6) && (event != ARDUINO_EVENT_PPP_CONNECTED))
93
91
{
94
92
networkMarkOffline (NETWORK_CELLULAR);
95
93
}
@@ -200,7 +198,8 @@ void cellularStart(NetIndex_t index, uintptr_t parameter, bool debug)
200
198
// Configure the cellular modem
201
199
CELLULAR.setApn (CELLULAR_MODEM_APN);
202
200
CELLULAR.setPin (CELLULAR_MODEM_PIN);
203
- CELLULAR.setResetPin (pin_Cellular_Reset, cellularModemResetLow); // v3.0.2 allows you to set the reset delay, but we don't need it
201
+ CELLULAR.setResetPin (pin_Cellular_Reset,
202
+ cellularModemResetLow); // v3.0.2 allows you to set the reset delay, but we don't need it
204
203
CELLULAR.setPins (pin_Cellular_TX, pin_Cellular_RX, pin_Cellular_RTS, pin_Cellular_CTS, CELLULAR_MODEM_FC);
205
204
206
205
// Now let the PPP turn the modem back on again if needed - with a 200ms reset
@@ -234,4 +233,4 @@ void cellularStop(NetIndex_t index, uintptr_t parameter, bool debug)
234
233
networkSequenceNextEntry (index, debug);
235
234
}
236
235
237
- #endif // COMPILE_CELLULAR
236
+ #endif // COMPILE_CELLULAR
0 commit comments