Skip to content

Commit

Permalink
removing the condition for wf200 and keeping it only for rs9116
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-silabs committed Apr 26, 2023
1 parent 23b23ec commit ac8e90d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 27 deletions.
21 changes: 9 additions & 12 deletions examples/platform/silabs/efr32/wf200/host_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,15 @@ static void wfx_events_task(void * p_arg)
retryJoin = 0;
retryInterval = WLAN_MIN_RETRY_TIMER_MS;
wfx_lwip_set_sta_link_up();
#ifdef SLEEP_ENABLED
if (!(wfx_get_wifi_state() & SL_WFX_AP_INTERFACE_UP))
{
// Enable the power save
SILABS_LOG("WF200 going to DTIM based sleep");
sl_wfx_set_power_mode(WFM_PM_MODE_DTIM, WFM_PM_POLL_FAST_PS, BEACON_1);
sl_wfx_enable_device_power_save();
}
#endif // SLEEP_ENABLED
}

if (flags & SL_WFX_DISCONNECT)
Expand Down Expand Up @@ -887,18 +896,6 @@ int32_t wfx_reset_counts()
return -1;
}

/************************************************************************
* @brief
* reset the count
* @return returns -1
**************************************************************************/
void wfx_power_save() {
// Enable the power save
SILABS_LOG("WF200 going to DTIM based sleep");
sl_wfx_set_power_mode(WFM_PM_MODE_DTIM, WFM_PM_POLL_FAST_PS, BEACON_1);
sl_wfx_enable_device_power_save();
}

/*************************************************************************
* @brief
* I think that this is getting called before FreeRTOS threads are ready
Expand Down
3 changes: 2 additions & 1 deletion src/platform/silabs/ConnectivityManagerImpl_WIFI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,8 @@ void ConnectivityManagerImpl::OnStationConnected()
event.WiFiConnectivityChange.Result = kConnectivity_Established;
(void) PlatformMgr().PostEvent(&event);
// Setting the rs911x in the power save mode
#if CHIP_DEVICE_CONFIG_ENABLE_SED
#if (CHIP_DEVICE_CONFIG_ENABLE_SED && RS911X_WIFI)
// TODO : Remove stop advertising after BLEManagerImpl is fixed
chip::DeviceLayer::Internal::BLEManagerImpl().StopAdvertising();
wfx_power_save();
#endif /* CHIP_DEVICE_CONFIG_ENABLE_SED */
Expand Down
20 changes: 9 additions & 11 deletions src/platform/silabs/efr32/rs911x/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,19 +665,17 @@ CHIP_ERROR BLEManagerImpl::StopAdvertising(void)
{
CHIP_ERROR err = CHIP_NO_ERROR;
int32_t status = 0;
// TODO: change this condition
if (1)
// TODO: add the below code in a condition if (mFlags.Has(Flags::kAdvertising))
// Since DriveBLEState is not called the device is still advertising advertising
mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising);
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
status = rsi_ble_stop_advertising();
if (status != RSI_SUCCESS)
{
mFlags.Clear(Flags::kAdvertising).Clear(Flags::kRestartAdvertising);
mFlags.Set(Flags::kFastAdvertisingEnabled, true);
status = rsi_ble_stop_advertising();
if (status != RSI_SUCCESS)
{
ChipLogProgress(DeviceLayer, "advertising failed to stop, with status = 0x%lx", status);
}
advertising_set_handle = 0xff;
CancelBleAdvTimeoutTimer();
ChipLogProgress(DeviceLayer, "advertising failed to stop, with status = 0x%lx", status);
}
advertising_set_handle = 0xff;
CancelBleAdvTimeoutTimer();

// exit:
return err;
Expand Down
3 changes: 2 additions & 1 deletion src/platform/silabs/efr32/wifi/wfx_host_events.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,6 @@ bool wfx_is_sta_mode_enabled(void);
int32_t wfx_get_ap_info(wfx_wifi_scan_result_t * ap);
int32_t wfx_get_ap_ext(wfx_wifi_scan_ext_t * extra_info);
int32_t wfx_reset_counts();
void wfx_power_save();

void wfx_clear_wifi_provision(void);
sl_status_t wfx_connect_to_ap(void);
Expand Down Expand Up @@ -353,6 +352,8 @@ void wfx_ip_changed_notify(int got_ip);
void wfx_ipv6_notify(int got_ip);

#ifdef RS911X_WIFI
/* RSI Power Save */
void wfx_power_save();
/* RSI for LWIP */
void * wfx_rsi_alloc_pkt(void);
void wfx_rsi_pkt_add_data(void * p, uint8_t * buf, uint16_t len, uint16_t off);
Expand Down
8 changes: 6 additions & 2 deletions third_party/silabs/efr32_sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,14 @@ template("efr32_sdk") {
"SL_CATALOG_POWER_MANAGER_PRESENT",
"SL_CATALOG_SLEEPTIMER_PRESENT",
"SL_SLEEP_TIME_MS=${sleep_time_ms}",
]

if(defined(invoker.chip_enable_wifi) && invoker.chip_enable_wifi){
defines += [
# Used for wifi devices to get packet details
"WIFI_DEBUG_ENABLED=1",
]
"WIFI_DEBUG_ENABLED=1",
]
}
}

if (chip_build_libshell) { # matter shell
Expand Down

0 comments on commit ac8e90d

Please sign in to comment.