Skip to content

Commit

Permalink
Merge pull request #2766 from particle-iot/fix/decouple-backup-ram-sy…
Browse files Browse the repository at this point in the history
…nc-stack-reset

[rtl872x] disable periodic backup ram sync, reset wifi stack on no scan results
  • Loading branch information
scott-brust authored Apr 23, 2024
2 parents e565422 + cf7b840 commit d419a93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion hal/network/ncp_client/realtek/rtl_ncp_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ int RealtekNcpClient::scan(WifiScanCallback callback, void* data, bool forConnec
}

// XXX:
if ((forConnect && ctx.results.size() == 0) || rtlError == RTW_TIMEOUT) {
if ((/* ignoring for now: forConnect && */ ctx.results.size() == 0) || rtlError == RTW_TIMEOUT) {
// Workaround for a weird state we might enter where the wifi driver
// is not returning any results
needsReset_ = true;
Expand Down
14 changes: 8 additions & 6 deletions hal/src/rtl872x/backup_ram_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ extern SessionPersistDataOpaque session;

namespace {

system_tick_t lastSyncTimeMs = 0;
//system_tick_t lastSyncTimeMs = 0;
constexpr system_tick_t syncIntervalMs = 10000;

StaticRecursiveMutex backupMutex;
Expand Down Expand Up @@ -155,10 +155,12 @@ int hal_backup_ram_sync(void* reserved) {
}

int hal_backup_ram_routine(void) {
auto now = hal_timer_millis(nullptr);
if (now - lastSyncTimeMs >= syncIntervalMs) {
lastSyncTimeMs = now;
return hal_backup_ram_sync(nullptr);
}
// Only explicit System.backupRamSync() or entry into hibernate trigger sync into flash

// auto now = hal_timer_millis(nullptr);
// if (now - lastSyncTimeMs >= syncIntervalMs) {
// lastSyncTimeMs = now;
// return hal_backup_ram_sync(nullptr);
// }
return SYSTEM_ERROR_NONE;
}

0 comments on commit d419a93

Please sign in to comment.