Skip to content

Commit e06719a

Browse files
ci(pre-commit): Apply automatic fixes
1 parent 26e54eb commit e06719a

File tree

6 files changed

+849
-865
lines changed

6 files changed

+849
-865
lines changed

cores/esp32/esp32-hal-periman.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ extern "C" {
104104
ESP32_BUS_TYPE_ETHERNET_PWR, // IO is used as ETHERNET PWR pin
105105
#endif
106106
#if CONFIG_LWIP_PPP_SUPPORT
107-
ESP32_BUS_TYPE_PPP_TX, // IO is used as PPP Modem TX pin
108-
ESP32_BUS_TYPE_PPP_RX, // IO is used as PPP Modem RX pin
109-
ESP32_BUS_TYPE_PPP_RTS, // IO is used as PPP Modem RTS pin
110-
ESP32_BUS_TYPE_PPP_CTS, // IO is used as PPP Modem CTS pin
107+
ESP32_BUS_TYPE_PPP_TX, // IO is used as PPP Modem TX pin
108+
ESP32_BUS_TYPE_PPP_RX, // IO is used as PPP Modem RX pin
109+
ESP32_BUS_TYPE_PPP_RTS, // IO is used as PPP Modem RTS pin
110+
ESP32_BUS_TYPE_PPP_CTS, // IO is used as PPP Modem CTS pin
111111
#endif
112112
ESP32_BUS_TYPE_MAX
113113
} peripheral_bus_type_t;

libraries/Network/src/NetworkInterface.cpp

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,11 @@ void NetworkInterface::_onIpEvent(int32_t event_id, void* event_data) {
7171
arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_GOT_IP;
7272
} else
7373
#endif
74-
if(_interface_id == ESP_NETIF_ID_PPP){
75-
arduino_event.event_id = ARDUINO_EVENT_PPP_GOT_IP;
76-
} else
77-
if (_interface_id >= ESP_NETIF_ID_ETH && _interface_id < ESP_NETIF_ID_MAX) {
78-
arduino_event.event_id = ARDUINO_EVENT_ETH_GOT_IP;
79-
}
74+
if (_interface_id == ESP_NETIF_ID_PPP) {
75+
arduino_event.event_id = ARDUINO_EVENT_PPP_GOT_IP;
76+
} else if (_interface_id >= ESP_NETIF_ID_ETH && _interface_id < ESP_NETIF_ID_MAX) {
77+
arduino_event.event_id = ARDUINO_EVENT_ETH_GOT_IP;
78+
}
8079
} else if (event_id == _lost_ip_event_id) {
8180
clearStatusBits(ESP_NETIF_HAS_IP_BIT);
8281
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_VERBOSE
@@ -87,12 +86,11 @@ void NetworkInterface::_onIpEvent(int32_t event_id, void* event_data) {
8786
arduino_event.event_id = ARDUINO_EVENT_WIFI_STA_LOST_IP;
8887
} else
8988
#endif
90-
if(_interface_id == ESP_NETIF_ID_PPP){
91-
arduino_event.event_id = ARDUINO_EVENT_PPP_LOST_IP;
92-
} else
93-
if (_interface_id >= ESP_NETIF_ID_ETH && _interface_id < ESP_NETIF_ID_MAX) {
94-
arduino_event.event_id = ARDUINO_EVENT_ETH_LOST_IP;
95-
}
89+
if (_interface_id == ESP_NETIF_ID_PPP) {
90+
arduino_event.event_id = ARDUINO_EVENT_PPP_LOST_IP;
91+
} else if (_interface_id >= ESP_NETIF_ID_ETH && _interface_id < ESP_NETIF_ID_MAX) {
92+
arduino_event.event_id = ARDUINO_EVENT_ETH_LOST_IP;
93+
}
9694
} else if (event_id == IP_EVENT_GOT_IP6) {
9795
ip_event_got_ip6_t* event = (ip_event_got_ip6_t*)event_data;
9896
esp_ip6_addr_type_t addr_type = esp_netif_ip6_get_addr_type(&event->ip6_info.ip);
@@ -117,12 +115,11 @@ void NetworkInterface::_onIpEvent(int32_t event_id, void* event_data) {
117115
arduino_event.event_id = ARDUINO_EVENT_WIFI_AP_GOT_IP6;
118116
} else
119117
#endif
120-
if(_interface_id == ESP_NETIF_ID_PPP){
121-
arduino_event.event_id = ARDUINO_EVENT_PPP_GOT_IP6;
122-
} else
123-
if (_interface_id >= ESP_NETIF_ID_ETH && _interface_id < ESP_NETIF_ID_MAX) {
124-
arduino_event.event_id = ARDUINO_EVENT_ETH_GOT_IP6;
125-
}
118+
if (_interface_id == ESP_NETIF_ID_PPP) {
119+
arduino_event.event_id = ARDUINO_EVENT_PPP_GOT_IP6;
120+
} else if (_interface_id >= ESP_NETIF_ID_ETH && _interface_id < ESP_NETIF_ID_MAX) {
121+
arduino_event.event_id = ARDUINO_EVENT_ETH_GOT_IP6;
122+
}
126123
#if SOC_WIFI_SUPPORTED
127124
} else if (event_id == IP_EVENT_AP_STAIPASSIGNED && _interface_id == ESP_NETIF_ID_AP) {
128125
setStatusBits(ESP_NETIF_HAS_IP_BIT);

libraries/PPP/examples/PPP_Basic/PPP_Basic.ino

Lines changed: 46 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#include <PPP.h>
22

3-
#define PPP_MODEM_APN "internet"
4-
#define PPP_MODEM_PIN "0000" // or NULL
3+
#define PPP_MODEM_APN "internet"
4+
#define PPP_MODEM_PIN "0000" // or NULL
55

66
// WaveShare SIM7600 HW Flow Control
7-
#define PPP_MODEM_RST 25
8-
#define PPP_MODEM_RST_LOW false //active HIGH
9-
#define PPP_MODEM_TX 21
10-
#define PPP_MODEM_RX 22
11-
#define PPP_MODEM_RTS 26
12-
#define PPP_MODEM_CTS 27
13-
#define PPP_MODEM_FC ESP_MODEM_FLOW_CONTROL_HW
14-
#define PPP_MODEM_MODEL PPP_MODEM_SIM7600
7+
#define PPP_MODEM_RST 25
8+
#define PPP_MODEM_RST_LOW false //active HIGH
9+
#define PPP_MODEM_TX 21
10+
#define PPP_MODEM_RX 22
11+
#define PPP_MODEM_RTS 26
12+
#define PPP_MODEM_CTS 27
13+
#define PPP_MODEM_FC ESP_MODEM_FLOW_CONTROL_HW
14+
#define PPP_MODEM_MODEL PPP_MODEM_SIM7600
1515

1616
// SIM800 basic module with just TX,RX and RST
1717
// #define PPP_MODEM_RST 0
@@ -23,8 +23,7 @@
2323
// #define PPP_MODEM_FC ESP_MODEM_FLOW_CONTROL_NONE
2424
// #define PPP_MODEM_MODEL PPP_MODEM_SIM800
2525

26-
void onEvent(arduino_event_id_t event, arduino_event_info_t info)
27-
{
26+
void onEvent(arduino_event_id_t event, arduino_event_info_t info) {
2827
switch (event) {
2928
case ARDUINO_EVENT_PPP_START:
3029
Serial.println("PPP Started");
@@ -49,16 +48,17 @@ void onEvent(arduino_event_id_t event, arduino_event_info_t info)
4948
}
5049
}
5150

52-
void testClient(const char * host, uint16_t port) {
51+
void testClient(const char* host, uint16_t port) {
5352
NetworkClient client;
5453
if (!client.connect(host, port)) {
5554
Serial.println("Connection Failed");
5655
return;
5756
}
5857
client.printf("GET / HTTP/1.1\r\nHost: %s\r\n\r\n", host);
59-
while (client.connected() && !client.available());
58+
while (client.connected() && !client.available())
59+
;
6060
while (client.available()) {
61-
client.read();//Serial.write(client.read());
61+
client.read(); //Serial.write(client.read());
6262
}
6363

6464
Serial.println("Connection Success");
@@ -70,7 +70,7 @@ void setup() {
7070

7171
// Listen for modem events
7272
Network.onEvent(onEvent);
73-
73+
7474
// Configure the modem
7575
PPP.setApn(PPP_MODEM_APN);
7676
PPP.setPin(PPP_MODEM_PIN);
@@ -80,16 +80,19 @@ void setup() {
8080
Serial.println("Starting the modem. It might take a while!");
8181
PPP.begin(PPP_MODEM_MODEL);
8282

83-
Serial.print("Manufacturer: "); Serial.println(PPP.cmd("AT+CGMI", 10000));
84-
Serial.print("Model: "); Serial.println(PPP.moduleName());
85-
Serial.print("IMEI: "); Serial.println(PPP.IMEI());
86-
83+
Serial.print("Manufacturer: ");
84+
Serial.println(PPP.cmd("AT+CGMI", 10000));
85+
Serial.print("Model: ");
86+
Serial.println(PPP.moduleName());
87+
Serial.print("IMEI: ");
88+
Serial.println(PPP.IMEI());
89+
8790
bool attached = PPP.attached();
88-
if(!attached){
89-
int i=0;
91+
if (!attached) {
92+
int i = 0;
9093
unsigned int s = millis();
9194
Serial.print("Waiting to connect to network");
92-
while(!attached && ((++i) < 600)){
95+
while (!attached && ((++i) < 600)) {
9396
Serial.print(".");
9497
delay(100);
9598
attached = PPP.attached();
@@ -98,22 +101,29 @@ void setup() {
98101
Serial.println("s");
99102
attached = PPP.attached();
100103
}
101-
102-
Serial.print("Attached: "); Serial.println(attached);
103-
Serial.print("State: "); Serial.println(PPP.radioState());
104-
if(attached){
105-
Serial.print("Operator: "); Serial.println(PPP.operatorName());
106-
Serial.print("IMSI: "); Serial.println(PPP.IMSI());
107-
Serial.print("RSSI: "); Serial.println(PPP.RSSI());
104+
105+
Serial.print("Attached: ");
106+
Serial.println(attached);
107+
Serial.print("State: ");
108+
Serial.println(PPP.radioState());
109+
if (attached) {
110+
Serial.print("Operator: ");
111+
Serial.println(PPP.operatorName());
112+
Serial.print("IMSI: ");
113+
Serial.println(PPP.IMSI());
114+
Serial.print("RSSI: ");
115+
Serial.println(PPP.RSSI());
108116
int ber = PPP.BER();
109-
if(ber > 0){
110-
Serial.print("BER: "); Serial.println(ber);
111-
Serial.print("NetMode: "); Serial.println(PPP.networkMode());
117+
if (ber > 0) {
118+
Serial.print("BER: ");
119+
Serial.println(ber);
120+
Serial.print("NetMode: ");
121+
Serial.println(PPP.networkMode());
112122
}
113-
123+
114124
Serial.println("Switching to data mode...");
115-
PPP.mode(ESP_MODEM_MODE_CMUX); // Data and Command mixed mode
116-
if(!PPP.waitStatusBits(ESP_NETIF_CONNECTED_BIT, 1000)){
125+
PPP.mode(ESP_MODEM_MODE_CMUX); // Data and Command mixed mode
126+
if (!PPP.waitStatusBits(ESP_NETIF_CONNECTED_BIT, 1000)) {
117127
Serial.println("Failed to connect to internet!");
118128
} else {
119129
Serial.println("Connected to internet!");

0 commit comments

Comments
 (0)