beegee-tokyo / SX126x-Arduino

Arduino library to use Semtech SX126x LoRa chips and modules to communicate
MIT License
236 stars 64 forks source link

Confirmed TX callback fails to fire if status equals LORAMAC_EVENT_INFO_STATUS_ERROR #91

Closed avillacis closed 1 year ago

avillacis commented 1 year ago

This is a continuation of bug https://github.com/beegee-tokyo/SX126x-Arduino/issues/86 .

As before, the library checks the operation status, and fails to fire the confirmed-transmission callback because in mac/LoRaMacHelper.cpp method McpsConfirm, the Status field is LORAMAC_EVENT_INFO_STATUS_ERROR, which was not one of the expected LORAMAC_EVENT_INFO_STATUS_OK, LORAMAC_EVENT_INFO_STATUS_RX1_TIMEOUT, LORAMAC_EVENT_INFO_STATUS_RX2_TIMEOUT or LORAMAC_EVENT_INFO_STATUS_TX_DR_PAYLOAD_SIZE_ERROR.

Given this, and the observation that the branch for LORAMAC_EVENT_INFO_STATUS_OK and the other cases are nearly identical, I think the best course of action would be to get rid of the Status field check, and just note whether it was LORAMAC_EVENT_INFO_STATUS_OK for debugging messages.

beegee-tokyo commented 1 year ago

Merged with #93

Thank @avillacis for finding this.