mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-09 21:17:06 +03:00
Merge branch 'jomjol:rolling' into rolling
This commit is contained in:
@@ -99,6 +99,11 @@ static bool ota_update_task(std::string fn)
|
||||
int data_read;
|
||||
|
||||
FILE* f = OpenFileAndWait(fn.c_str(), "rb"); // vorher nur "r"
|
||||
|
||||
if (f == NULL) { // File does not exist
|
||||
return false;
|
||||
}
|
||||
|
||||
data_read = fread(ota_write_data, 1, BUFFSIZE, f);
|
||||
|
||||
while (data_read > 0) {
|
||||
@@ -435,7 +440,7 @@ esp_err_t handler_ota_update(httpd_req_t *req)
|
||||
int _result = stat(fn.c_str(), &file_stat);
|
||||
printf("Ergebnis %d\n", _result);
|
||||
if (_result == 0) {
|
||||
printf("Deleting file : %s", fn.c_str());
|
||||
printf("Deleting file : %s\n", fn.c_str());
|
||||
/* Delete file */
|
||||
unlink(fn.c_str());
|
||||
}
|
||||
@@ -457,11 +462,11 @@ esp_err_t handler_ota_update(httpd_req_t *req)
|
||||
gpio_handler_deinit();
|
||||
if (ota_update_task(fn))
|
||||
{
|
||||
resp_str = "Firmware Update Successfull!<br><br>You can restart now.";
|
||||
resp_str = "Firmware Update Successfull! You can restart now.";
|
||||
}
|
||||
else
|
||||
{
|
||||
resp_str = "Error during Firmware Update!!!<br><br>Please check console output.";
|
||||
resp_str = "Error during Firmware Update!!! Please check console output.";
|
||||
}
|
||||
|
||||
httpd_resp_send(req, resp_str, strlen(resp_str));
|
||||
|
||||
@@ -88,8 +88,17 @@ void memCopyGen(uint8_t* _source, uint8_t* _target, int _size)
|
||||
|
||||
FILE* OpenFileAndWait(const char* nm, const char* _mode, int _waitsec)
|
||||
{
|
||||
FILE *pfile;
|
||||
|
||||
printf("open file %s in mode %s\n", nm, _mode);
|
||||
FILE *pfile = fopen(nm, _mode);
|
||||
|
||||
if ((pfile = fopen(nm, _mode)) != NULL) {
|
||||
printf("File %s successfully opened\n", nm);
|
||||
}
|
||||
else {
|
||||
printf("Error: file %s does not exist!\n", nm);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
if (pfile == NULL)
|
||||
|
||||
@@ -160,7 +160,7 @@ function upload() {
|
||||
|
||||
|
||||
/* Max size of an individual file. Make sure this
|
||||
* value is same as that set in file_server.c */
|
||||
* value is same as that set in server_file.c */
|
||||
var MAX_FILE_SIZE = 8000*1024;
|
||||
var MAX_FILE_SIZE_STR = "8MB";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user