Skip to content

Commit

Permalink
Merge pull request #2363 from proddy/dev
Browse files Browse the repository at this point in the history
fix memory type for S3 so PSRAM is used, fix WebUI upload restarting
  • Loading branch information
proddy authored Jan 20, 2025
2 parents 8b0e5ba + 6516882 commit becdc8c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 4 additions & 0 deletions boards/s3_16M_P.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
{
"build": {
"arduino": {
"ldscript": "esp32s3_out.ld",
"memory_type": "qio_opi"
},
"core": "esp32",
"extra_flags": [
"-DBOARD_HAS_PSRAM",
Expand Down
12 changes: 4 additions & 8 deletions src/core/emsesp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1736,7 +1736,6 @@ void EMSESP::loop() {

// run the loop, unless we're in the middle of an OTA upload
if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_NORMAL) {
// service loops
webLogService.loop(); // log in Web UI
rxservice_.loop(); // process any incoming Rx telegrams
shower_.loop(); // check for shower on/off
Expand All @@ -1752,13 +1751,10 @@ void EMSESP::loop() {
}

if (EMSESP::system_.systemStatus() == SYSTEM_STATUS::SYSTEM_STATUS_PENDING_UPLOAD) {
// start an upload from a URL, assuming if the URL exists from a previous pass.
// Note this function is synchronous and blocking.
if (system_.uploadFirmwareURL()) {
// firmware has been uploaded, set status to uploading
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_UPLOADING);
} else {
// if it fails to pass, reset
// start an upload from a URL, assuming the URL exists and set from a previous pass
// Note this next call is synchronous and blocking.
if (!system_.uploadFirmwareURL()) {
// upload failed, send a "reset" to return back to normal
Shell::loop_all(); // flush log buffers so latest error message are shown in console
system_.uploadFirmwareURL("reset");
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_ERROR_UPLOAD);
Expand Down
11 changes: 5 additions & 6 deletions src/core/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2010,29 +2010,27 @@ bool System::uploadFirmwareURL(const char * url) {

static String saved_url;

// if the URL is not empty, store the URL for the 2nd pass and exit
if (url && strlen(url) > 0) {
// if the passed URL is "reset" abort the current upload. This is called when an error happens during OTA
if (strncmp(url, "reset", 5) == 0) {
LOG_DEBUG("Firmware upload - resetting");
saved_url.clear();
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_NORMAL);
return true;
}

// given a URL to download from, save it
// given a URL to download from, save it ready for the 2nd pass
saved_url = url;
LOG_INFO("Firmware location: %s", saved_url.c_str());
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_PENDING_UPLOAD); // we're ready to start the upload
return true;
}

// assumed we have a valid URL from the 1st pass
// check we have a valid URL from the 1st pass
if (saved_url.isEmpty()) {
LOG_ERROR("Firmware upload failed - invalid URL");
return false; // error
}

LOG_INFO("Firmware downloading from %s", saved_url.c_str());
Shell::loop_all(); // flush log buffers so latest messages are shown in console

// Configure temporary client
Expand All @@ -2059,9 +2057,10 @@ bool System::uploadFirmwareURL(const char * url) {
return false; // error
}


Shell::loop_all(); // flush log buffers so latest messages are shown in console

// we're about to start the upload, set the status so the Web System Monitor spots it
EMSESP::system_.systemStatus(SYSTEM_STATUS::SYSTEM_STATUS_UPLOADING);
// TODO do we need to stop the UART with EMSuart::stop() ?

// get tcp stream and send it to Updater
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#define EMSESP_APP_VERSION "3.7.2-dev.12"
#define EMSESP_APP_VERSION "3.7.2-dev.13"

0 comments on commit becdc8c

Please sign in to comment.