Skip to content

Commit

Permalink
Upload progress fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DmytroKorniienko committed Nov 5, 2020
1 parent 7e83cfc commit be4bcb6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
4 changes: 2 additions & 2 deletions EmbUI/EmbUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ void EmbUI::begin(){
Update.printError(Serial);
}
}
embui.uploadProgress(index + len, request->contentLength());
uploadProgress(index + len, request->contentLength());
});

//First request will return 0 results unless you start scan from somewhere else (loop/setup)
Expand Down Expand Up @@ -445,7 +445,7 @@ void EmbUI::set_callback(CallBack set, CallBack action, callback_function_t call
/*
* OTA update progress
*/
uint8_t EmbUI::uploadProgress(size_t len, size_t total){
uint8_t uploadProgress(size_t len, size_t total){

This comment has been minimized.

Copy link
@vortigont

vortigont Nov 8, 2020

Contributor

@DmytroKorniienko
вообще этот метод должен бы быть частью фреймворка, т.к. сама процедура обновления находится там же.
Тащить в каждый проект свою реализацию прогресс-бара как-то не практично

static int prev = 0;
float part = total / 25.0; // logger chunks
int curr = len / part;
Expand Down
7 changes: 1 addition & 6 deletions EmbUI/EmbUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class Interface;
void __attribute__((weak)) section_main_frame(Interface *interf, JsonObject *data);
void __attribute__((weak)) pubCallback(Interface *interf);
String __attribute__((weak)) httpCallback(const String &param, const String &value, bool isset);
void __attribute__((weak)) uploadProgress(size_t len, size_t total);
uint8_t __attribute__((weak)) uploadProgress(size_t len, size_t total);
void __attribute__((weak)) create_parameters();

//----------------------
Expand Down Expand Up @@ -309,11 +309,6 @@ class EmbUI
callback_function_t _cb_STADisconnected = nullptr;
callback_function_t _cb_STAGotIP = nullptr;

/*
* OTA update progress, return upload %
*/
uint8_t uploadProgress(size_t len, size_t total);

#ifdef USE_SSDP
void ssdp_begin() {
String hn = param(FPSTR(P_hostname));
Expand Down
2 changes: 1 addition & 1 deletion examples/ex_generic/src/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ void set_language(Interface *interf, JsonObject *data);

//void remote_action(RA action, ...);

//void uploadProgress(size_t len, size_t total);
//uint8_t uploadProgress(size_t len, size_t total);

0 comments on commit be4bcb6

Please sign in to comment.