Skip to content

Allow configurable reconnection delay for WiFiConnectionHandler #139

Open
@ClaudioTZ

Description

@ClaudioTZ

Feature request

I'd like to be able to configure the retry delay for WiFi reconnections in WiFiConnectionHandler.

Currently, the value is hardcoded in CHECK_INTERVAL_TABLE as 500ms:

static unsigned int const CHECK_INTERVAL_TABLE[] =
{
/* INIT */ 100,
#if defined(BOARD_HAS_NOTECARD) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_ESP32)
/* CONNECTING */ 4000,
#else
/* CONNECTING */ 500,
#endif
/* CONNECTED */ 10000,
/* DISCONNECTING */ 100,
/* DISCONNECTED */ 1000,
/* CLOSED */ 1000,
/* ERROR */ 1000
};

This causes excessive retry attempts and floods the serial output when the WiFi is unavailable.

Proposed solution

It would be great to:

  • Allow user override of CHECK_INTERVAL_TABLE, or
  • Provide a setter method like setReconnectInterval(NetworkConnectionState state, uint32_t delay_ms).

Context

I'm working on an Arduino IoT Cloud project using Opta and want to increase the reconnection interval to 10 seconds to avoid WiFi flooding.

Thanks for your work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: enhancementProposed improvement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions