Fix for #12: Transition from "Configuring" to "Ready" due to "Configured" event not possible #13

Merged
Joe merged 1 commit from fix_issue_12 into main 2026-02-28 02:51:00 +00:00
Owner

This pull request fixes #12.

The root cause was BLE_HandleCommonEvents() was causing BLE events to be marked as "not new" by BLE_IsPacketNew(), even though these packets were left unhandled by the common event handler.

The solution is to separate the querying of whether a packet is new from the marking it as already seen, since we don't want to mark a packet as seen until it has been properly handled. I added the function BLE_RememberPacket() for the latter purpose.

I also cleaned up some of the logging code, now that logging is configurable (on ESP32 platform, anyway).

This pull request fixes https://git.ktag.clubk.club/Software/SystemK/issues/12. The root cause was [`BLE_HandleCommonEvents()`](https://git.ktag.clubk.club/Software/SystemK/src/tag/SystemK_v01.01/BLE/BLE_Utils.c#L57) was causing BLE events to be marked as "not new" by [`BLE_IsPacketNew()`](https://git.ktag.clubk.club/Software/SystemK/src/tag/SystemK_v01.01/BLE/BLE_Packet_Tracker.c#L53), even though these packets were left unhandled by the common event handler. The solution is to separate the querying of whether a packet is new from the marking it as already seen, since we don't want to mark a packet as seen until it has been properly _handled_. I added the function `BLE_RememberPacket()` for the latter purpose. I also cleaned up some of the logging code, now that logging is configurable (on ESP32 platform, anyway).
Joe added 1 commit 2026-02-21 18:59:03 +00:00
Joe self-assigned this 2026-02-21 18:59:09 +00:00
Joe reviewed 2026-02-21 19:08:26 +00:00
@ -54,9 +54,6 @@ bool BLE_IsPacketNew(const uint8_t *sender_BD_ADDR,
BLE_PacketType_T packet_type,
uint8_t event_number)
{
//esp_log_level_set("BLE", ESP_LOG_DEBUG);
Author
Owner

This can now be done from the serial console for ESP32: see Software/2024A-SW#11.

This can now be done from the serial console for ESP32: see https://git.ktag.clubk.club/Software/2024A-SW/pulls/11.
@ -121,0 +121,4 @@
if (result != SYSTEMK_RESULT_EVENT_NOT_HANDLED)
{
BLE_RememberPacket(event_packet->BD_ADDR, BLE_PACKET_TYPE_EVENT, event_packet->event_number);
Author
Owner

🔑 This is the key: only remember packets that have been handled, so state-specific handlers can still call BLE_IsPacketNew() and get the correct answer.

:key: This is the key: only remember packets that have been _handled_, so state-specific handlers can still call `BLE_IsPacketNew()` and get the correct answer.
@ -206,6 +206,8 @@ void HandleBLETagPacket(const BLE_TagPacket_T *const packet)
{
if (BLE_IsPacketNew(packet->BD_ADDR, BLE_PACKET_TYPE_TAG, packet->event_number))
{
BLE_RememberPacket(packet->BD_ADDR, BLE_PACKET_TYPE_TAG, packet->event_number);
Author
Owner

Since we split out the functionality of BLE_RememberPacket() from BLE_IsPacketNew(), we need to add it back in again everywhere it is needed.

Since we split out the functionality of `BLE_RememberPacket()` from `BLE_IsPacketNew()`, we need to add it back in again everywhere it is needed.
johnny.haggs was assigned by Joe 2026-02-21 19:09:58 +00:00
jack was assigned by Joe 2026-02-21 19:09:59 +00:00
Member

And all this time I thought my Konfigurator was broken.

And all this time I thought my Konfigurator was broken.
Joe merged commit daa1a2a1ec into main 2026-02-28 02:51:00 +00:00
Joe deleted branch fix_issue_12 2026-02-28 02:51:00 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Software/SystemK#13
No description provided.