Skip to content

Commit

Permalink
Merge pull request #1354 from spark/fix/wlan-scan-hardfault
Browse files Browse the repository at this point in the history
[Photon] Fixes WiFi.scan() hardfault
  • Loading branch information
technobly authored Jul 10, 2017
2 parents 0a5b4a4 + 3571b3c commit 51400d4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions hal/src/photon/wlan_hal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,10 @@ wiced_result_t sniffer( wiced_scan_handler_result_t* malloced_scan_result )

wiced_result_t sniff_security(SnifferInfo* info)
{
if (!wiced_wlan_connectivity_initialized())
{
return WICED_ERROR;
}

wiced_result_t result = wiced_rtos_init_semaphore(&info->complete);
if (result != WICED_SUCCESS)
Expand Down
21 changes: 21 additions & 0 deletions user/tests/wiring/no_fixture/wifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,4 +196,25 @@ test(WIFI_10_restore_default_hostname)

#endif // PLATFORM_ID == 6 || PLATFORM_ID == 8

test(WIFI_11_scan_returns_zero_result_or_error_when_wifi_is_off)
{
WiFiAccessPoint results[5];
WiFi.off();
uint32_t ms = millis();
while (WiFi.ready()) {
if (millis() - ms >= 10000) {
assertTrue(false);
}
}
assertLessOrEqual(WiFi.scan(results, 5), 0);
}

test(WIFI_12_restore_connection)
{
if (!Particle.connected())
{
Particle.connect();
}
}

#endif

0 comments on commit 51400d4

Please sign in to comment.