Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rtl872x] disable periodic backup ram sync, reset wifi stack on no scan results #2766

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
}