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

Fix #287: wifi_manager_stop causes panic handler when it is called before wifi_manager_start #288

Merged
merged 2 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions src/wifi_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ wifi_manager_disable_wps(void)
void
wifi_manager_stop(void)
{
if (!wifi_manager_is_initialized())
{
return;
}
if (!wifiman_msg_send_cmd_stop_and_destroy())
{
LOG_ERR("%s failed", "wifiman_msg_send_cmd_stop_and_destroy");
Expand Down
10 changes: 10 additions & 0 deletions src/wifi_manager_internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ static os_sema_static_t g_scan_sync_sema_mem;
static os_mutex_recursive_t g_p_wifi_mutex;
static os_mutex_recursive_static_t g_wifi_manager_mutex_mem;

bool
wifi_manager_is_initialized(void)
{
if (NULL == g_p_wifi_mutex)
{
return false;
}
return true;
}

void
wifi_manager_init_mutex(void)
{
Expand Down
3 changes: 3 additions & 0 deletions src/wifi_manager_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ extern EventGroupHandle_t g_p_wifi_manager_event_group;
extern esp_wps_config_t g_wps_config;
extern bool g_wifi_wps_enabled;

bool
wifi_manager_is_initialized(void);

void
wifi_manager_init_mutex(void);

Expand Down
Loading