From 96f069fc659a2ed2bb4a28bee94e154a8c23c09c Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 7 Feb 2023 14:37:00 +0700 Subject: [PATCH] Fix tokens generation and WiFi reconnection issues. --- .../SendMessageEthernet/ESP8266/ESP8266.ino | 20 ++++++++++++++----- .../RTDB/BasicEthernet/ESP8266/ESP8266.ino | 10 ++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/examples/Messaging/Send/LegacyAPI/SendMessageEthernet/ESP8266/ESP8266.ino b/examples/Messaging/Send/LegacyAPI/SendMessageEthernet/ESP8266/ESP8266.ino index 0885cf1d2..2048d9acb 100644 --- a/examples/Messaging/Send/LegacyAPI/SendMessageEthernet/ESP8266/ESP8266.ino +++ b/examples/Messaging/Send/LegacyAPI/SendMessageEthernet/ESP8266/ESP8266.ino @@ -50,8 +50,12 @@ #include #include -//#include -//#include +// #include +// #include + +/** Don't gorget to define this in FirebaseFS.h + #define ENABLE_ESP8266_ENC28J60_ETH +*/ /** 1 Define the Firebase project Server Key which must be taken from * https://console.firebase.google.com/u/0/project/_/settings/cloudmessaging @@ -112,10 +116,16 @@ void setup() Serial.printf("Firebase Client v%s\n\n", FIREBASE_CLIENT_VERSION); - // required for legacy HTTP API +// required for legacy HTTP API +#if defined(ENABLE_ESP8266_ENC28J60_ETH) spi_ethernet_module.enc28j60 = ð - // spi_ethernet_module.w5100 = ð - // spi_ethernet_module.w5500 = ð +#endif +#if defined(ENABLE_ESP8266_W5100_ETH) + spi_ethernet_module.w5100 = ð +#endif +#if defined(ENABLE_ESP8266_W5500_ETH) + spi_ethernet_module.w5500 = ð +#endif Firebase.FCM.setServerKey(FIREBASE_FCM_SERVER_KEY, &spi_ethernet_module); sendMessage(); diff --git a/examples/RTDB/BasicEthernet/ESP8266/ESP8266.ino b/examples/RTDB/BasicEthernet/ESP8266/ESP8266.ino index 7311048e7..6e606d719 100644 --- a/examples/RTDB/BasicEthernet/ESP8266/ESP8266.ino +++ b/examples/RTDB/BasicEthernet/ESP8266/ESP8266.ino @@ -100,9 +100,15 @@ void setupFirebase() config.token_status_callback = tokenStatusCallback; // see addons/TokenHelper.h /* Assign the pointer to Ethernet module lwip interface */ +#if defined(ENABLE_ESP8266_ENC28J60_ETH) config.spi_ethernet_module.enc28j60 = ð - // config.spi_ethernet_module.w5100 = ð - // config.spi_ethernet_module.w5500 = ð +#endif +#if defined(ENABLE_ESP8266_W5100_ETH) + config.spi_ethernet_module.w5100 = ð +#endif +#if defined(ENABLE_ESP8266_W5500_ETH) + config.spi_ethernet_module.w5500 = ð +#endif // Or use legacy authenticate method // config.database_url = DATABASE_URL;