Skip to content

Commit

Permalink
Fix wdt reset in ESP8266 Core v3.1.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Jan 20, 2023
1 parent 9243df7 commit 4a431af
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 15 deletions.
24 changes: 18 additions & 6 deletions examples/http_upgrade/http_upgrade.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* This example shows how to upgrade from http connection to https connection.
*
*
* This example works on the Arduino-Pico SDK from Earle F. Philhower.
* https://github.com/earlephilhower/arduino-pico
*
Expand Down Expand Up @@ -29,22 +29,34 @@ ESP_SSLClient ssl_client;
// GSMClient basic_client;
WiFiClient basic_client;

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
WiFiMulti multi;
#endif

void setup()
{
Serial.begin(115200);

// Reset the network connection
WiFi.disconnect();

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
multi.addAP(WIFI_SSID, WIFI_PASSWORD);
multi.run();
#else
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
#endif

Serial.print("Connecting to Wi-Fi");
unsigned long ms = millis();
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
if (millis() - ms > 10000)
break;
#endif
}
Serial.println();
Serial.println("Connected with IP: ");
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();

Expand Down Expand Up @@ -102,7 +114,7 @@ void loop()
Serial.println(" failed\n");

ssl_client.stop();

Serial.println();

delay(5000);
Expand Down
20 changes: 16 additions & 4 deletions examples/https/https.ino
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,34 @@ ESP_SSLClient ssl_client;
// GSMClient basic_client;
WiFiClient basic_client;

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
WiFiMulti multi;
#endif

void setup()
{
Serial.begin(115200);

// Reset the network connection
WiFi.disconnect();

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
multi.addAP(WIFI_SSID, WIFI_PASSWORD);
multi.run();
#else
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
#endif

Serial.print("Connecting to Wi-Fi");
unsigned long ms = millis();
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
if (millis() - ms > 10000)
break;
#endif
}
Serial.println();
Serial.println("Connected with IP: ");
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();

Expand Down
18 changes: 16 additions & 2 deletions examples/mqtt/mqtt.ino
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* This example shows how to connect to MQTT server via secure port using the SSL client.
*
*
* This example works on the Arduino-Pico SDK from Earle F. Philhower.
* https://github.com/earlephilhower/arduino-pico
*
Expand Down Expand Up @@ -46,18 +46,32 @@ const long interval = 3000;
unsigned long previousMillis = 0;
bool mqttReady = false;

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
WiFiMulti multi;
#endif

void setup()
{

Serial.begin(115200);
Serial.println();

#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
multi.addAP(WIFI_SSID, WIFI_PASSWORD);
multi.run();
#else
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
#endif

Serial.print("Connecting to Wi-Fi");
unsigned long ms = millis();
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
#if defined(ARDUINO_RASPBERRY_PI_PICO_W)
if (millis() - ms > 10000)
break;
#endif
}
Serial.println();
Serial.print("Connected with IP: ");
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ESP_SSLClient",
"version": "1.1.1",
"version": "1.1.2",
"keywords": "communication, REST, esp32, esp8266, arduino",
"description": "The upgradable SSL Client for ESP8266, ESP32 and Raspberry Pi Pico W that supports external network interfaces e.g., WiFiClient, EthernetClient and GSMClient.",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name=ESP_SSLClient

version=1.1.1
version=1.1.2

author=Mobizt

Expand Down
5 changes: 4 additions & 1 deletion src/esp8266/MB_BSSL_SSL_Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
#include "lwip/inet.h"
#include "lwip/netif.h"


// #include "c_types.h"
// #include <mmu_iram.h>
// #include <umm_malloc/umm_malloc.h>
Expand Down Expand Up @@ -735,7 +734,11 @@ namespace BearSSL
rlen = base_client->read(buf + read, toRead);
read += rlen;
toRead = len - read;
#if defined(ARDUINO_ESP8266_MAJOR) && defined(ARDUINO_ESP8266_MINOR) && defined(ARDUINO_ESP8266_REVISION) && ((ARDUINO_ESP8266_MAJOR == 3 && ARDUINO_ESP8266_MINOR >= 1) || ARDUINO_ESP8266_MAJOR > 3)
esp_yield();
#else
delay(0);
#endif
#if defined(ESP8266)
if (loopTimeout)
{
Expand Down
5 changes: 5 additions & 0 deletions src/esp8266/MB_BSSL_SSL_Client.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@
#if defined(ESP8266_CORE_SDK_V3_X_X)
#include <umm_malloc/umm_heap_select.h>
#endif

#if __has_include(<core_esp8266_version.h>)
#include <core_esp8266_version.h>
#endif

#endif

namespace BearSSL
Expand Down

0 comments on commit 4a431af

Please sign in to comment.