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

[SL-TEMP] Changes 917 SoC/NCP sleep config to connected sleep #339

Open
wants to merge 13 commits into
base: release_2.5-1.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
31 changes: 21 additions & 10 deletions examples/platform/silabs/wifi/icd/ApplicationSleepManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ CHIP_ERROR ApplicationSleepManager::Init()
void ApplicationSleepManager::OnCommissioningWindowOpened()
{
mIsCommissionningWindowOpen = true;
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
#if (defined(SLI_SI917) && SLI_SI917 == 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "SLI_SI917" need to be replaced with "SLI_SI91X_MCU_INTERFACE" in other places also?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"SLI_SI917" : this macro is enabled for 917 NCP and SoC boards.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any other places where we need to replace this macro (common code for NCP and SoC)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
}

void ApplicationSleepManager::OnCommissioningWindowClosed()
{
mIsCommissionningWindowOpen = false;
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
#if (defined(SLI_SI917) && SLI_SI917 == 1)
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
}

void ApplicationSleepManager::OnSubscriptionEstablished(chip::app::ReadHandler & aReadHandler)
Expand Down Expand Up @@ -93,6 +93,17 @@ void ApplicationSleepManager::OnFabricCommitted(const chip::FabricTable & fabric
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
}

bool ApplicationSleepManager::CanGoToDeepSleep()
{
bool canGoToDeepSleep = true;
if (mIsCommissionningWindowOpen)
{
ChipLogProgress(AppServer, "Commissioning Window is Open - Cannot go to Deep sleep");
canGoToDeepSleep = false;
}
return canGoToDeepSleep;
}

bool ApplicationSleepManager::CanGoToLIBasedSleep()
{
bool canGoToLIBasedSleep = true;
Expand Down Expand Up @@ -170,19 +181,19 @@ bool ApplicationSleepManager::ProcessKeychainEdgeCase()
void ApplicationSleepManager::OnEnterActiveMode()
{
mIsInActiveMode = true;
// TEMP-fix: Added SLI_SI91X_MCU_INTERFACE to delay 917 NCP sleep till wifi-connection
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
// TEMP-fix: Added SLI_SI917 to delay 9116 NCP sleep till wifi-connection
#if (defined(SLI_SI917) && SLI_SI917 == 1)
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
}

void ApplicationSleepManager::OnEnterIdleMode()
{
mIsInActiveMode = false;
// TEMP-fix: Added SLI_SI91X_MCU_INTERFACE to delay 917 NCP sleep till wifi-connection
#if (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
// TEMP-fix: Added SLI_SI917 to delay 9116 NCP sleep till wifi-connection
#if (defined(SLI_SI917) && SLI_SI917 == 1)
mWifiSleepManager->VerifyAndTransitionToLowPowerMode();
#endif // (defined(SLI_SI91X_MCU_INTERFACE) && SLI_SI91X_MCU_INTERFACE == 1)
#endif // (defined(SLI_SI917) && SLI_SI917 == 1)
}

void ApplicationSleepManager::OnTransitionToIdle()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class ApplicationSleepManager : public chip::app::ReadHandler::ApplicationCallba
* false if the device cannot go to LI sleep
*/
bool CanGoToLIBasedSleep() override;
bool CanGoToDeepSleep() override;

// FabricTable::Delegate implementation

Expand Down
10 changes: 5 additions & 5 deletions src/platform/silabs/wifi/WifiInterfaceAbstraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ typedef enum

typedef struct
{
char ssid[WFX_MAX_SSID_LENGTH + 1];
size_t ssid_length;
char passkey[WFX_MAX_PASSKEY_LENGTH + 1];
size_t passkey_length;
wfx_sec_t security;
char ssid[WFX_MAX_SSID_LENGTH + 1] = { 0 };
size_t ssid_length = 0;
char passkey[WFX_MAX_PASSKEY_LENGTH + 1] = { 0 };
size_t passkey_length = 0;
wfx_sec_t security = WFX_SEC_UNSPECIFIED;
} wfx_wifi_provision_t;

typedef enum
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/wifi/icd/WifiSleepManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ CHIP_ERROR WifiSleepManager::VerifyAndTransitionToLowPowerMode(PowerEvent event)
wfx_wifi_provision_t wifiConfig;
wfx_get_wifi_provision(&wifiConfig);

if (!(wifiConfig.ssid[0] != 0))
if ((wifiConfig.ssid[0] == 0) && (mCallback && mCallback->CanGoToDeepSleep()))
{
return ConfigureDeepSleep();
}
Expand Down
1 change: 1 addition & 0 deletions src/platform/silabs/wifi/icd/WifiSleepManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class WifiSleepManager
* @return false The Wi-Fi Sleep Manager cannot go to LI based sleep or an error occured in the processing.
*/
virtual bool CanGoToLIBasedSleep() = 0;
virtual bool CanGoToDeepSleep() = 0;
};

/**
Expand Down
Loading