Skip to content

Commit

Permalink
Fix truncated data for large file (SPIFFS and SD) get, add support lo…
Browse files Browse the repository at this point in the history
…w memory BearSSL enable/disable
  • Loading branch information
mobizt committed Nov 3, 2019
1 parent c5b1b40 commit decb3cd
Show file tree
Hide file tree
Showing 11 changed files with 122 additions and 102 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Firebase Realtime Database Arduino Library for ESP8266


Google's Firebase Realtime Database Arduino Library for ESP8266 v 2.6.4
Google's Firebase Realtime Database Arduino Library for ESP8266 v 2.6.5


This library supports ESP8266 MCU from Espressif. The following are platforms which library are also available.
Expand Down Expand Up @@ -48,7 +48,7 @@ This library supports ESP8266 MCU from Espressif. The following are platforms wh

## Changes from earlier version

For library v 2.6.4 (comes with FirebaseJson v 2.2.4) or later, FirebaseJson object will be used to handle JSON data instead of JSON string which, the following functions are affected:
For library v 2.6.5 (comes with FirebaseJson v 2.2.4) or later, FirebaseJson object will be used to handle JSON data instead of JSON string which, the following functions are affected:

getJson, setJson, pushJson, updateNode and updateNodeSilent.

Expand Down
2 changes: 2 additions & 0 deletions examples/Blob/Blob.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* Github: https://github.com/mobizt
*
* Copyright (c) 2019 mobizt
*
*
*/

Expand Down Expand Up @@ -59,6 +60,7 @@ void setup()
for (int i = 0; i < 256; i++)
data[i] = i;


//Set binary data to database (also can use Firebase.set)
if (Firebase.setBlob(firebaseData, path + "/Binary/Blob/data", data, sizeof(data)))
{
Expand Down
19 changes: 15 additions & 4 deletions examples/File/File.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Github: https://github.com/mobizt
*
* Copyright (c) 2019 mobizt
*
* This example is for FirebaseESP8266 Arduino library v 2.6.5 and later
*
*/

Expand Down Expand Up @@ -73,11 +75,18 @@ void setup()

//Write demo data to file
file = SD.open("/file1.txt", FILE_WRITE);
for (int i = 0; i < 256; i++)
file.write((uint8_t)i);
uint8_t v = 0;
for (int i = 0; i < 200000; i++)
{
file.write(v);
v++;
}

file.close();

//In case of Root CA was set, set this option to false to disable low memory for secured mode BearSSL to support large file data
//Firebase.lowMemBSSL(false);

//Set file (read file from SD card and set to database)
//File name must be in 8.3 DOS format (max. 8 bytes file name and 3 bytes file extension)
if (Firebase.setFile(firebaseData, StorageType::SD, path + "/Binary/File/data", "/file1.txt"))
Expand Down Expand Up @@ -114,10 +123,12 @@ void setup()
if (i > 0 && i % 16 == 0)
Serial.println();

if (i < 16)
v = file.read();

if (v < 16)
Serial.print("0");

Serial.print(file.read(), HEX);
Serial.print(v, HEX);
Serial.print(" ");
i++;
}
Expand Down
22 changes: 16 additions & 6 deletions examples/File_SPIFFS/File_SPIFFS.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Github: https://github.com/mobizt
*
* Copyright (c) 2019 mobizt
*
* This example is for FirebaseESP8266 Arduino library v 2.6.5 and later
*
*/

Expand Down Expand Up @@ -72,13 +74,19 @@ void setup()
Serial.println("------------------------------------");
Serial.println("Set file data test...");

//Write demo data to file
//Write demo data to file
file = SPIFFS.open("/file1.txt", "w");
for (int i = 0; i < 256; i++)
file.write((uint8_t)i);
uint8_t v = 0;
for (int i = 0; i < 200000; i++)
{
file.write(v);
v++;
}

file.close();


//In case of Root CA was set, set this option to false to disable low memory for secured mode BearSSL to support large file data
//Firebase.lowMemBSSL(false);

//Set file (read file from Flash memory and set to database)
if (Firebase.setFile(firebaseData, StorageType::SPIFFS, path + "/Binary/File/data", "/file1.txt"))
Expand Down Expand Up @@ -114,10 +122,12 @@ void setup()
if (i > 0 && i % 16 == 0)
Serial.println();

if (i < 16)
v = file.read();

if (v < 16)
Serial.print("0");

Serial.print(file.read(), HEX);
Serial.print(v, HEX);
Serial.print(" ");
i++;
}
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ FirebaseJsonData KEYWORD1

begin KEYWORD2
reconnectWiFi KEYWORD2
lowMemBSSL KEYWORD2
setReadTimeout KEYWORD2
setwriteSizeLimit KEYWORD2
getShallowData KEYWORD2
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=Firebase ESP8266 Client

version=2.6.4
version=2.6.5

author=Mobizt

Expand Down
Loading

0 comments on commit decb3cd

Please sign in to comment.