11// ----------------------------------------
22
3- #ifdef COMPILE_CELLULAR
3+ #ifdef COMPILE_CELLULAR
44
55// The following define is used to avoid confusion between the cellular
66// code and the GNSS code where PPP has a completely different meaning.
77// The remaining references to PPP in this code are present due to values
88// from the PPP (Point-to-Point Protocol) driver and ARDUINO_EVENT_PPP_*
99// events.
10- #define CELLULAR PPP
10+ #define CELLULAR PPP
1111
1212// ----------------------------------------
1313// Cellular interface definitions
1414
15- #define CELLULAR_MODEM_MODEL PPP_MODEM_GENERIC
15+ #define CELLULAR_MODEM_MODEL PPP_MODEM_GENERIC
1616
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
1919
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
2121
22- #define CELLULAR_ATTACH_POLL_INTERVAL 100 // Milliseconds
22+ #define CELLULAR_ATTACH_POLL_INTERVAL 100 // Milliseconds
2323
2424// ----------------------------------------
2525
@@ -44,7 +44,7 @@ void cellularAttached(NetIndex_t index, uintptr_t parameter, bool debug)
4444 cellularIsAttached = CELLULAR.attached ();
4545 if (cellularIsAttached)
4646 {
47- // Attached to a mobile network, continue
47+ // Attached to a mobile network, continue
4848 // Display the network information
4949 systemPrintf (" Cellular attached to %s\r\n " , CELLULAR.operatorName ().c_str ());
5050
@@ -69,7 +69,7 @@ void cellularAttached(NetIndex_t index, uintptr_t parameter, bool debug)
6969 // Switch into a state where data may be sent and received
7070 if (debug)
7171 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
7373
7474 // Get the next sequence entry
7575 networkSequenceNextEntry (index, debug);
@@ -86,10 +86,8 @@ void cellularEvent(arduino_event_id_t event)
8686 String module ;
8787
8888 // 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))
9391 {
9492 networkMarkOffline (NETWORK_CELLULAR);
9593 }
@@ -200,7 +198,8 @@ void cellularStart(NetIndex_t index, uintptr_t parameter, bool debug)
200198 // Configure the cellular modem
201199 CELLULAR.setApn (CELLULAR_MODEM_APN);
202200 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
204203 CELLULAR.setPins (pin_Cellular_TX, pin_Cellular_RX, pin_Cellular_RTS, pin_Cellular_CTS, CELLULAR_MODEM_FC);
205204
206205 // 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)
234233 networkSequenceNextEntry (index, debug);
235234}
236235
237- #endif // COMPILE_CELLULAR
236+ #endif // COMPILE_CELLULAR
0 commit comments