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

[Silabs] Cleanup of logs and checks for WiFi products #34430

Merged
Merged
Show file tree
Hide file tree
Changes from 8 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
44 changes: 22 additions & 22 deletions examples/platform/silabs/BaseApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,15 @@ CHIP_ERROR BaseApplication::StartAppTask(osThreadFunc_t taskFunction)
sAppEventQueue = osMessageQueueNew(APP_EVENT_QUEUE_SIZE, sizeof(AppEvent), &appEventQueueAttr);
if (sAppEventQueue == NULL)
{
SILABS_LOG("Failed to allocate app event queue");
ChipLogError(AppServer, "Failed to allocate app event queue");
appError(APP_ERROR_EVENT_QUEUE_FAILED);
}

// Start App task.
sAppTaskHandle = osThreadNew(taskFunction, &sAppEventQueue, &appTaskAttr);
if (sAppTaskHandle == nullptr)
{
SILABS_LOG("Failed to create app task");
ChipLogError(AppServer, "Failed to create app task");
appError(APP_ERROR_CREATE_TASK_FAILED);
}
return CHIP_NO_ERROR;
Expand All @@ -254,12 +254,12 @@ CHIP_ERROR BaseApplication::Init()
/*
* Wait for the WiFi to be initialized
*/
SILABS_LOG("APP: Wait WiFi Init");
ChipLogDetail(AppServer, "APP: Wait WiFi Init");
while (!wfx_hw_ready())
{
vTaskDelay(pdMS_TO_TICKS(10));
}
SILABS_LOG("APP: Done WiFi Init");
ChipLogDetail(AppServer, "APP: Done WiFi Init");
/* We will init server when we get IP */

chip::DeviceLayer::PlatformMgr().LockChipStack();
Expand All @@ -276,7 +276,7 @@ CHIP_ERROR BaseApplication::Init()
);
if (sFunctionTimer == NULL)
{
SILABS_LOG("funct timer create failed");
ChipLogError(AppServer, "funct timer create failed");
appError(APP_ERROR_CREATE_TIMER_FAILED);
}

Expand All @@ -288,12 +288,12 @@ CHIP_ERROR BaseApplication::Init()
);
if (sLightTimer == NULL)
{
SILABS_LOG("Light Timer create failed");
ChipLogError(AppServer, "Light Timer create failed");
appError(APP_ERROR_CREATE_TIMER_FAILED);
}

SILABS_LOG("Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
SILABS_LOG("Current Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);
ChipLogDetail(AppServer, "Current Software Version String: %s", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING);
ChipLogDetail(AppServer, "Current Software Version: %d", CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION);

ConfigurationMgr().LogDeviceConfig();

Expand Down Expand Up @@ -543,12 +543,12 @@ void BaseApplication::ButtonHandler(AppEvent * aEvent)
chip::DeviceLayer::PlatformMgr().UnlockChipStack();
if (err != CHIP_NO_ERROR)
{
SILABS_LOG("Failed to open the Basic Commissioning Window");
ChipLogError(AppServer, "Failed to open the Basic Commissioning Window");
}
}
else
{
SILABS_LOG("Network is already provisioned, Ble advertisement not enabled");
ChipLogDetail(AppServer, "Network is already provisioned, Ble advertisement not enabled");
#if CHIP_CONFIG_ENABLE_ICD_SERVER
// Temporarily claim network activity, until we implement a "user trigger" reason for ICD wakeups.
PlatformMgr().ScheduleWork([](intptr_t) { ICDNotifier::GetInstance().NotifyNetworkActivityNotification(); });
Expand All @@ -571,7 +571,7 @@ void BaseApplication::CancelFunctionTimer()
{
if (osTimerStop(sFunctionTimer) == osError)
{
SILABS_LOG("app timer stop() failed");
ChipLogError(AppServer, "app timer stop() failed");
appError(APP_ERROR_STOP_TIMER_FAILED);
}
}
Expand All @@ -581,15 +581,15 @@ void BaseApplication::StartFunctionTimer(uint32_t aTimeoutInMs)
// Starts or restarts the function timer
if (osTimerStart(sFunctionTimer, pdMS_TO_TICKS(aTimeoutInMs)) != osOK)
{
SILABS_LOG("app timer start() failed");
ChipLogError(AppServer, "app timer start() failed");
appError(APP_ERROR_START_TIMER_FAILED);
}
}

void BaseApplication::StartFactoryResetSequence()
{
// Initiate the factory reset sequence
SILABS_LOG("Factory Reset Triggered. Release button within %ums to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);
ChipLogDetail(AppServer, "Factory Reset Triggered. Release button within %ums to cancel.", FACTORY_RESET_CANCEL_WINDOW_TIMEOUT);

// Start timer for FACTORY_RESET_CANCEL_WINDOW_TIMEOUT to allow user to
// cancel, if required.
Expand Down Expand Up @@ -618,15 +618,15 @@ void BaseApplication::CancelFactoryResetSequence()
if (sIsFactoryResetTriggered)
{
sIsFactoryResetTriggered = false;
SILABS_LOG("Factory Reset has been Canceled");
ChipLogDetail(AppServer, "Factory Reset has been Canceled");
}
}

void BaseApplication::StartStatusLEDTimer()
{
if (osTimerStart(sLightTimer, kLightTimerPeriod) != osOK)
{
SILABS_LOG("Light Time start failed");
ChipLogError(AppServer, "Light Time start failed");
appError(APP_ERROR_START_TIMER_FAILED);
}
}
Expand All @@ -639,7 +639,7 @@ void BaseApplication::StopStatusLEDTimer()

if (osTimerStop(sLightTimer) == osError)
{
SILABS_LOG("Light Time start failed");
ChipLogError(AppServer, "Light Time start failed");
appError(APP_ERROR_STOP_TIMER_FAILED);
}
}
Expand Down Expand Up @@ -770,12 +770,12 @@ void BaseApplication::PostEvent(const AppEvent * aEvent)
{
if (osMessageQueuePut(sAppEventQueue, aEvent, osPriorityNormal, 0) != osOK)
{
SILABS_LOG("Failed to post event to app task event queue");
ChipLogError(AppServer, "Failed to post event to app task event queue");
}
}
else
{
SILABS_LOG("App Event Queue is uninitialized");
ChipLogDetail(AppServer, "App Event Queue is uninitialized");
}
}

Expand All @@ -787,7 +787,7 @@ void BaseApplication::DispatchEvent(AppEvent * aEvent)
}
else
{
SILABS_LOG("Event received with no handler. Dropping event.");
ChipLogDetail(AppServer, "Event received with no handler. Dropping event.");
}
}

Expand Down Expand Up @@ -823,7 +823,7 @@ void BaseApplication::DoProvisioningReset()
CHIP_ERROR err = Server::GetInstance().GetCommissioningWindowManager().OpenBasicCommissioningWindow();
if (err != CHIP_NO_ERROR)
{
SILABS_LOG("Failed to open the Basic Commissioning Window");
ChipLogError(AppServer, "Failed to open the Basic Commissioning Window");
}
});
}
Expand All @@ -841,7 +841,7 @@ void BaseApplication::OnPlatformEvent(const ChipDeviceEvent * event, intptr_t)
VerifyOrReturn(event->InternetConnectivityChange.IPv4 == kConnectivity_Established);
if (DIC_OK != dic_init(dic::control::subscribeCB))
{
SILABS_LOG("Failed to initialize DIC module\n");
ChipLogError(AppServer, "dic_init failed");
}
#endif // DIC_ENABLE
break;
Expand Down Expand Up @@ -884,7 +884,7 @@ void BaseApplication::OutputQrCode(bool refreshLCD)
}
else
{
SILABS_LOG("Getting QR code failed!");
ChipLogError(AppServer, "Getting QR code failed!");
}
}

Expand Down
17 changes: 8 additions & 9 deletions examples/platform/silabs/SiWx917/SiWx917/sl_wifi_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,10 @@ sl_status_t join_callback_handler(sl_wifi_event_t event, char * result, uint32_t
*/
ChipLogDetail(DeviceLayer, "join_callback_handler: success");
memset(&temp_reset, 0, sizeof(temp_reset));

WfxEvent.eventType = WFX_EVT_STA_CONN;
WfxPostEvent(&WfxEvent);
wfx_rsi.join_retries = 0;
callback_status = SL_STATUS_OK;
WfxEvent.eventType = WFX_EVT_STA_CONN;
WfxPostEvent(&WfxEvent);
return SL_STATUS_OK;
}

Expand Down Expand Up @@ -338,7 +337,7 @@ int32_t wfx_rsi_power_save(rsi_power_save_profile_mode_t sl_si91x_ble_state, sl_
*****************************************************************************************/
int32_t wfx_wifi_rsi_init(void)
{
ChipLogDetail(DeviceLayer, "wfx_wifi_rsi_init started");
ChipLogDetail(DeviceLayer, "wfx_wifi_rsi_init: started");
sl_status_t status;
status = sl_wifi_init(&config, NULL, sl_wifi_default_event_handler);
VerifyOrReturnError(status == SL_STATUS_OK, status);
Expand Down Expand Up @@ -695,11 +694,9 @@ static sl_status_t wfx_rsi_do_join(void)
/// Helper function for HandleDHCPPolling.
void NotifyConnectivity()
{
if (!hasNotifiedWifiConnectivity)
{
wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac);
hasNotifiedWifiConnectivity = true;
}
VerifyOrReturn(!hasNotifiedWifiConnectivity);
wfx_connected_notify(CONNECTION_STATUS_SUCCESS, &wfx_rsi.ap_mac);
hasNotifiedWifiConnectivity = true;
}

void HandleDHCPPolling()
Expand All @@ -720,6 +717,8 @@ void HandleDHCPPolling()
{
wfx_dhcp_got_ipv4((uint32_t) sta_netif->ip_addr.u_addr.ip4.addr);
hasNotifiedIPV4 = true;
event.eventType = WFX_EVT_STA_DHCP_DONE;
WfxPostEvent(&event);
NotifyConnectivity();
}
else if (dhcp_state == DHCP_OFF)
Expand Down
Loading
Loading