Skip to content

Commit

Permalink
Fix upload/download progress elapsed time.
Browse files Browse the repository at this point in the history
  • Loading branch information
mobizt committed Nov 7, 2022
1 parent 48c8ea2 commit 5d4f73d
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Firebase Arduino Client Library for ESP8266 and ESP32",
"version": "4.2.2",
"version": "4.2.3",
"keywords": "communication, REST, esp32, esp8266, arduino",
"description": "The library supports Firebase products e.g. Realtime database, Cloud Firestore database, Firebase Storage and Google Cloud Storage, Cloud Functions for Firebase and Cloud Messaging. The library also supported other Arduino devices using Clients 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=Firebase Arduino Client Library for ESP8266 and ESP32

version=4.2.2
version=4.2.3

author=Mobizt

Expand Down
6 changes: 3 additions & 3 deletions src/Firebase_ESP_Client.h
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#ifndef FIREBASE_CLIENT_VERSION
#define FIREBASE_CLIENT_VERSION "4.2.2"
#define FIREBASE_CLIENT_VERSION "4.2.3"
#endif

/**
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h v4.2.2
* Google's Firebase ESP Client Main class, Firebase_ESP_Client.h v4.2.3
*
* This library supports Espressif ESP8266 and ESP32 MCUs
*
* Created November 7, 2022
*
* Updates:
* - Fix FirebaseData object issue that refused to connect in FCS and GCS classes.
* - Fix upload/download progress elapsed time.
*
*
* This work is a part of Firebase ESP Client library
Expand Down
8 changes: 7 additions & 1 deletion src/gcs/GCS.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Google's Cloud Storage class, GCS.cpp version 1.1.21
* Google's Cloud Storage class, GCS.cpp version 1.1.22
*
* This library supports Espressif ESP8266 and ESP32
*
Expand Down Expand Up @@ -285,6 +285,9 @@ void GG_CloudStorage::reportUploadProgress(FirebaseData *fbdo, struct fb_esp_gcs

int p = (float)readBytes / req->fileSize * 100;

if (readBytes == 0)
fbdo->tcpClient.dataStart = millis();

if (req->progress != p && (p == 0 || p == 100 || req->progress + ESP_REPORT_PROGRESS_INTERVAL <= p))
{
req->progress = p;
Expand All @@ -309,6 +312,9 @@ void GG_CloudStorage::reportDownloadProgress(FirebaseData *fbdo, struct fb_esp_g

int p = (float)readBytes / req->fileSize * 100;

if (readBytes == 0)
fbdo->tcpClient.dataStart = millis();

if (req->progress != p && (p == 0 || p == 100 || req->progress + ESP_REPORT_PROGRESS_INTERVAL <= p))
{
req->progress = p;
Expand Down
2 changes: 1 addition & 1 deletion src/gcs/GCS.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Google's Cloud Storage class, GCS.h version 1.1.21
* Google's Cloud Storage class, GCS.h version 1.1.22
*
* This library supports Espressif ESP8266 and ESP32
*
Expand Down
10 changes: 8 additions & 2 deletions src/rtdb/FB_RTDB.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Firebase Realtime Database class, FB_RTDB.cpp version 2.0.5
* Google's Firebase Realtime Database class, FB_RTDB.cpp version 2.0.6
*
* This library supports Espressif ESP8266 and ESP32
*
* Created November 1, 2022
* Created November 7, 2022
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down Expand Up @@ -1899,6 +1899,9 @@ void FB_RTDB::reportUploadProgress(FirebaseData *fbdo, struct fb_esp_rtdb_reques

int p = (float)readBytes / req->fileSize * 100;

if (readBytes == 0)
fbdo->tcpClient.dataStart = millis();

if (req->progress != p && (p == 0 || p == 100 || req->progress + ESP_REPORT_PROGRESS_INTERVAL <= p))
{
fbdo->tcpClient.dataTime = millis() - fbdo->tcpClient.dataStart;
Expand Down Expand Up @@ -1926,6 +1929,9 @@ void FB_RTDB::reportDownloadProgress(FirebaseData *fbdo, struct fb_esp_rtdb_requ

int p = (float)readBytes / req->fileSize * 100;

if (readBytes == 0)
fbdo->tcpClient.dataStart = millis();

if (req->progress != p && (p == 0 || p == 100 || req->progress + ESP_REPORT_PROGRESS_INTERVAL <= p))
{
req->progress = p;
Expand Down
4 changes: 2 additions & 2 deletions src/rtdb/FB_RTDB.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/**
* Google's Firebase Realtime Database class, FB_RTDB.h version 2.0.5
* Google's Firebase Realtime Database class, FB_RTDB.h version 2.0.6
*
* This library supports Espressif ESP8266 and ESP32
*
* Created November 1, 2022
* Created November 7, 2022
*
* This work is a part of Firebase ESP Client library
* Copyright (c) 2022 K. Suwatchai (Mobizt)
Expand Down
5 changes: 4 additions & 1 deletion src/storage/FCS.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Google's Firebase Storage class, FCS.cpp version 1.1.24
* Google's Firebase Storage class, FCS.cpp version 1.1.25
*
* This library supports Espressif ESP8266 and ESP32
*
Expand Down Expand Up @@ -345,6 +345,9 @@ void FB_Storage::reportDownloadProgress(FirebaseData *fbdo, struct fb_esp_fcs_re

int p = (float)readBytes / req->fileSize * 100;

if (readBytes == 0)
fbdo->tcpClient.dataStart = millis();

if (req->progress != p && (p == 0 || p == 100 || req->progress + ESP_REPORT_PROGRESS_INTERVAL <= p))
{
req->progress = p;
Expand Down
2 changes: 1 addition & 1 deletion src/storage/FCS.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Google's Firebase Storage class, FCS.h version 1.1.24
* Google's Firebase Storage class, FCS.h version 1.1.25
*
* This library supports Espressif ESP8266 and ESP32
*
Expand Down

0 comments on commit 5d4f73d

Please sign in to comment.