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

WiFiGeneric CrashFix v2.x #8043

Merged

Conversation

mrengineer7777
Copy link
Collaborator

@mrengineer7777 mrengineer7777 commented Apr 6, 2023

Description of Change

This PR resolves crashes in WiFiGeneric.cpp. The crashes can occur with CORE_DEBUG_LEVEL >= 2.
Targeting branch v2.x

Observed:

  • Crash due to bad index into system_event_reasons[].

Potential:

  • Crash on bad index into arduino_event_names[]. e.g. New entry added but string array not updated.
  • Crash if event is null.

Changelog:

  • Replaced arduino_event_names[] with WiFi.eventName().
  • Replaced system_event_reasons[] and reason2str() with WiFi.disconnectReasonName().
  • Return if event is null.

Advantages:

  • Easier to maintain string conversions when types are updated.
  • Users can call WiFi.eventName() and WiFi.disconnectReasonName() for their own use.
  • Codespace is only used if the function is called.
  • Functions return blank strings rather than crashing when an unknown type is encountered.
  • disconnectReasonName() can be modified to work with multiple Arduino versions by using conditional compiles.

Observations:

  • Several additions on wifi_err_reason_t.
  • No changes on arduino_event_id_t.

Tests scenarios

Tested on custom hardware (ESP32-WROOM-32UE module) with arduino-esp32 v2.0.7. Works on both WiFi and Ethernet events. Functions are being used in our latest production firmware.

Related links

Closes #7959

@me-no-dev me-no-dev merged commit 2d7218b into espressif:release/v2.x Apr 10, 2023
29 checks passed
@mrengineer7777 mrengineer7777 deleted the WFG_cb_CrashFix_v2.x branch April 28, 2023 13:33
me-no-dev pushed a commit that referenced this pull request Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants