Skip to content

[Proposal] Remove undesirable dependency '#define LMIC_ENABLE_onEvent 0' for LMIC_registerEventCb() #433

Open
@lnlp

Description

@lnlp

Remove undesirable dependency '#define LMIC_ENABLE_onEvent 0' for LMIC_registerEventCb()

Documentation for

2.3.4 void **onEvent(ev_t ev)

Advises ('in any case is better') not to use the legacy onEvent() event callback and dynamically register an event callback with LMIC_registerEventCb() instead.

But this always requires the following definition:

    #define LMIC_ENABLE_onEvent 0

Having to '#define LMIC_ENABLE_onEvent 0' as requirement before LMIC_registerEventCb() can be used is not logical and not evident (therefore error prone). In fact current documentation for LMIC_registerEventCb() does not even mention it.
This undesirable dependency can be removed by the following:

  • Make '#define LMIC_ENABLE_onEvent 0' the default behavior WITHOUT requiring any macro/symbol to be defined for that.

  • Only automatically register 'legacy' onEvent() as event callback when the following is explicitly defined: '#define LMIC_ENABLE_onEvent' (without a value).

  • Add to file project_config/lmic_project_config.h the following:

    // #define LMIC_ENABLE_onEvent  /* Uncomment to use legacy onEvent() */

And add to the documentation that above line shall be uncommented for existing ('legacy') applications (migrating from LMIC-Arduino).

Most people already need to adjust their region when switching from LMIC-Arduino so uncommenting this setting for existing applications will not be a big issue.

This solution removes an undesirable dependency and will free any future applications using the MCCI LoRaWAN LMIC library from being required to add
'#define LMIC_ENABLE_onEvent 0' before LMIC_registerEventCb() can be used.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions