Skip to content

Commit

Permalink
[NXP] fix issue when joining predefined wifi AP (#35091)
Browse files Browse the repository at this point in the history
  • Loading branch information
jby-nxp authored and pull[bot] committed Jan 23, 2025
1 parent 0daea1e commit 10b4b32
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/platform/nxp/common/CHIPDeviceNXPPlatformDefaultConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@
#ifndef CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM
#define CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM 1
#endif // CHIP_DEVICE_CONFIG_INIT_OT_PLAT_ALARM

#ifndef CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL
#define CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL 300
#endif // CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL in Milliseconds
1 change: 1 addition & 0 deletions src/platform/nxp/common/CHIPDevicePlatformEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum InternalPlatformSpecificEventTypes
kPlatformNxpIpChangeEvent,
kPlatformNxpStartWlanConnectEvent,
kPlatformNxpScanWiFiNetworkDoneEvent,
kPlatformNxpStartWlanInitWaitTimerEvent,
};

} // namespace DeviceEventType
Expand Down
13 changes: 9 additions & 4 deletions src/platform/nxp/common/ConnectivityManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ void ConnectivityManagerImpl::_OnPlatformEvent(const ChipDeviceEvent * event)
NetworkCommissioning::NXPWiFiDriver::GetInstance().ScanWiFINetworkDoneFromMatterTaskContext(
event->Platform.ScanWiFiNetworkCount);
}
else if (event->Type == kPlatformNxpStartWlanInitWaitTimerEvent)
{
DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(kWlanInitWaitMs), ConnectNetworkTimerHandler,
(void *) event->Platform.pNetworkDataEvent);
}
#endif
}

Expand Down Expand Up @@ -662,10 +667,10 @@ void ConnectivityManagerImpl::ConnectNetworkTimerHandler(::chip::System::Layer *
}
else
{
PlatformMgr().LockChipStack();
DeviceLayer::SystemLayer().StartTimer(System::Clock::Milliseconds32(CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL),
ConnectNetworkTimerHandler, context);
PlatformMgr().UnlockChipStack();
/* Post an event to start a delay timer asynchronously in the Matter task context */
event.Type = DeviceEventType::kPlatformNxpStartWlanInitWaitTimerEvent;
event.Platform.pNetworkDataEvent = (struct wlan_network *) context;
(void) PlatformMgr().PostEvent(&event);
}
}

Expand Down
1 change: 1 addition & 0 deletions src/platform/nxp/common/ConnectivityManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ class ConnectivityManagerImpl final : public ConnectivityManager,

BitFlags<GenericConnectivityManagerImpl_WiFi::ConnectivityFlags> mFlags;
static netif_ext_callback_t sNetifCallback;
static constexpr uint32_t kWlanInitWaitMs = CHIP_DEVICE_CONFIG_WIFI_STATION_RECONNECT_INTERVAL;

#if CHIP_ENABLE_OPENTHREAD
static constexpr uint8_t kMaxIp6Addr = 3;
Expand Down

0 comments on commit 10b4b32

Please sign in to comment.