Skip to content

Commit c85d09a

Browse files
committed
Reduce maximum packet size.
1 parent dcd8a27 commit c85d09a

7 files changed

Lines changed: 160 additions & 47 deletions

File tree

device/prj.conf.overlays/nrf_shared.conf

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,31 @@ CONFIG_BT_FILTER_ACCEPT_LIST=y
3737
CONFIG_BT_CTLR_SDC_MAX_CONN_EVENT_LEN_DEFAULT=2500
3838
CONFIG_BT_CTLR_SDC_CENTRAL_ACL_EVENT_SPACING_DEFAULT=2500
3939

40-
# increase these to make multiple connections more reliable
41-
# this is a generic ai advice.
42-
CONFIG_BT_ATT_TX_COUNT=10
43-
CONFIG_BT_CONN_TX_MAX=6
44-
CONFIG_BT_L2CAP_TX_BUF_COUNT=12
45-
46-
# negotiate larger MTU for NUS
40+
# BLE buffer counts, sized for ~2 active links (L=2) with double buffering
41+
# (D=2), no HCI fragmentation (LL unit == L2CAP MTU, so frags/PDU F=1). Each
42+
# line notes the constraint it must satisfy. BT_BUF_ACL_TX_COUNT (the HCI TX
43+
# credit window) is left at its default 3: it is capped by the controller's
44+
# BT_CTLR_SDC_TX_PACKET_COUNT and 3 credits already cover 2 links.
45+
# ATT TX PDUs in flight: >= L*D (freed on HCI handoff, not air-ack)
46+
CONFIG_BT_ATT_TX_COUNT=5
47+
# L2CAP signalling/SMP only (no CoC): a handful
48+
CONFIG_BT_L2CAP_TX_BUF_COUNT=4
49+
# HCI event RX: > BT_BUF_ACL_TX_COUNT (build assert)
50+
CONFIG_BT_BUF_EVT_RX_COUNT=6
51+
# ACL RX reassembly: 1+EXTRA >= L+1 (one/link + driver spare)
52+
CONFIG_BT_BUF_ACL_RX_COUNT_EXTRA=2
53+
54+
# NUS packet sizing. We cap the link packet at MAX_LINK_PACKET_LENGTH=128
55+
# (link_protocol.h) rather than the DLE maximum, to save RAM and cut BLE latency.
56+
# ACL buffer = MAX_LINK_PACKET_LENGTH + L2CAP(4) + ATT(3) = 135
57+
# L2CAP MTU = MAX_LINK_PACKET_LENGTH + ATT(3) = 131
58+
# bt_conn.c caps the negotiated DLE tx length to CONFIG_BT_BUF_ACL_TX_SIZE.
4759
CONFIG_BT_USER_DATA_LEN_UPDATE=y
48-
CONFIG_BT_BUF_ACL_RX_SIZE=251
49-
CONFIG_BT_BUF_ACL_TX_SIZE=251
50-
CONFIG_BT_L2CAP_TX_MTU=247
60+
CONFIG_BT_BUF_ACL_RX_SIZE=135
61+
CONFIG_BT_BUF_ACL_TX_SIZE=135
62+
CONFIG_BT_L2CAP_TX_MTU=131
5163

52-
# allow BLE buffering
64+
# inbound long-write (config transfer) queue depth
5365
CONFIG_BT_ATT_PREPARE_COUNT=4
5466

5567
# store BLE link keys in flash

device/src/bt_conn.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,13 @@ static void enableDataLengthExtension(struct bt_conn *conn) {
291291
data_len = BT_LE_DATA_LEN_PARAM_MAX;
292292

293293
/**
294-
* This configures actual transmission length.
294+
* Configures actual transmission length. Cap the payload to our reduced ACL
295+
* buffer (CONFIG_BT_BUF_ACL_TX_SIZE) rather than the DLE max of 251: we never
296+
* send larger packets and shorter PDUs mean lower latency.
295297
*
296-
* We don't want it too high in order to prevent scheduling conflicts between multiple links.
298+
* tx_max_time kept low to avoid scheduling conflicts between multiple links.
297299
* */
300+
data_len->tx_max_len = CONFIG_BT_BUF_ACL_TX_SIZE;
298301
data_len->tx_max_time = 2500;
299302

300303
int err = bt_conn_le_data_len_update(conn, data_len);

device/src/link_protocol.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@
88

99
// Macros:
1010

11-
// 251 = maximum BLE packet length with data length extension
11+
// Maximum deserialized message length (header + payload) that fits in a single
12+
// BLE notification / UART bridge frame. We deliberately keep this well below the
13+
// DLE maximum (244 with a 251-byte ACL buffer) to save RAM (messenger-queue
14+
// regions, nus/uart buffers) and to shorten BLE packets for lower latency.
1215
// 4 bytes reserved for L2CAP header
1316
// 3 bytes reserved for ATT header
1417
// https://devzone.nordicsemi.com/f/nordic-q-a/111900/maximum-nus-packet-payload-with-ble-data-length-extensio
15-
// Should equal `CONFIG_BT_BUF_ACL_RX_SIZE - L2CAP_HEADER_SIZE - ATT_HEADER_SIZE`, otherwise something is wrong
16-
#define MAX_LINK_PACKET_LENGTH 244
18+
// Should equal `CONFIG_BT_BUF_ACL_RX_SIZE - L2CAP_HEADER_SIZE - ATT_HEADER_SIZE`
19+
// (i.e. 135 - 4 - 3), otherwise something is wrong.
20+
#define MAX_LINK_PACKET_LENGTH 128
1721

1822
// Typedefs:
1923

device/src/state_sync.c

Lines changed: 100 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#include "state_sync.h"
22
#include "bt_conn.h"
3+
#include "link_protocol.h"
34
#include "connections.h"
45
#include "device.h"
56
#include "device_state.h"
@@ -160,8 +161,27 @@ static state_sync_prop_t stateSyncProps[StateSyncPropertyId_Count] = {
160161
CUSTOM(KeyStatesDummy, SyncDirection_LeftToRight, DirtyState_Clean),
161162
CUSTOM(DongleProtocolVersion, SyncDirection_DongleToRight, DirtyState_Clean),
162163
SIMPLE(BatteryStationaryMode, SyncDirection_RightToLeft, DirtyState_Clean, &Cfg.BatteryStationaryMode),
164+
// Emitted alongside ModuleState*; never independently dirtied.
165+
CUSTOM(ModuleGitRepo, SyncDirection_LeftToRight, DirtyState_Clean),
166+
CUSTOM(ModuleGitTag, SyncDirection_LeftToRight, DirtyState_Clean),
163167
};
164168

169+
// Bytes a state-sync message occupies on top of its payload struct: the 3-byte
170+
// link header (src, dst, watermark - MessageOffset_Payload) plus the two message
171+
// id bytes (MessageId_StateSync and the property id).
172+
#define STATE_SYNC_MESSAGE_HEADER_LENGTH (MessageOffset_Payload + 2)
173+
// Largest payload struct that still fits in a single link packet.
174+
#define STATE_SYNC_MAX_PAYLOAD_LENGTH (MAX_LINK_PACKET_LENGTH - STATE_SYNC_MESSAGE_HEADER_LENGTH)
175+
176+
_Static_assert(sizeof(sync_command_layer_t) <= STATE_SYNC_MAX_PAYLOAD_LENGTH,
177+
"sync_command_layer_t does not fit in a link packet; reduce KEY_COUNT_PER_UPDATE");
178+
_Static_assert(sizeof(sync_command_module_state_t) <= STATE_SYNC_MAX_PAYLOAD_LENGTH,
179+
"sync_command_module_state_t does not fit in a link packet");
180+
_Static_assert(sizeof(sync_command_module_git_repo_t) <= STATE_SYNC_MAX_PAYLOAD_LENGTH,
181+
"sync_command_module_git_repo_t does not fit in a link packet");
182+
_Static_assert(sizeof(sync_command_module_git_tag_t) <= STATE_SYNC_MAX_PAYLOAD_LENGTH,
183+
"sync_command_module_git_tag_t does not fit in a link packet");
184+
165185
static void invalidateProperty(state_sync_prop_id_t propId) {
166186
STATE_SYNC_LOG("<<< Invalidating property %s\n", stateSyncProps[propId].name);
167187
if (StateSyncPropertyId_LayerActionFirst <= propId &&
@@ -339,8 +359,6 @@ static void receiveModuleStateData(sync_command_module_state_t *buffer) {
339359
moduleState->firmwareVersion = buffer->firmwareVersion;
340360
moduleState->keyCount = buffer->keyCount;
341361
moduleState->pointerCount = buffer->pointerCount;
342-
Utils_SafeStrCopy(moduleState->gitRepo, buffer->gitRepo, MAX_STRING_PROPERTY_LENGTH);
343-
Utils_SafeStrCopy(moduleState->gitTag, buffer->gitTag, MAX_STRING_PROPERTY_LENGTH);
344362
memcpy(moduleState->firmwareChecksum, buffer->firmwareChecksum, MD5_CHECKSUM_LENGTH);
345363

346364
if (DEVICE_IS_UHK80_RIGHT && leftModuleChanged) {
@@ -446,6 +464,20 @@ static void receiveProperty(device_id_t src, state_sync_prop_id_t propId, const
446464
receiveModuleStateData((sync_command_module_state_t *)data);
447465
}
448466
break;
467+
case StateSyncPropertyId_ModuleGitRepo:
468+
if (!isLocalUpdate) {
469+
sync_command_module_git_repo_t *buffer = (sync_command_module_git_repo_t *)data;
470+
uint8_t driverId = UhkModuleSlaveDriver_SlotIdToDriverId(buffer->slotId);
471+
Utils_SafeStrCopy(UhkModuleStates[driverId].gitRepo, buffer->gitRepo, MAX_STRING_PROPERTY_LENGTH);
472+
}
473+
break;
474+
case StateSyncPropertyId_ModuleGitTag:
475+
if (!isLocalUpdate) {
476+
sync_command_module_git_tag_t *buffer = (sync_command_module_git_tag_t *)data;
477+
uint8_t driverId = UhkModuleSlaveDriver_SlotIdToDriverId(buffer->slotId);
478+
Utils_SafeStrCopy(UhkModuleStates[driverId].gitTag, buffer->gitTag, MAX_STRING_PROPERTY_LENGTH);
479+
}
480+
break;
449481
case StateSyncPropertyId_FunctionalColors:
450482
if (!isLocalUpdate) {
451483
EventVector_Set(EventVector_LedMapUpdateNeeded);
@@ -565,27 +597,37 @@ static void prepareLayerActions(layer_id_t layerId, uint8_t slotId, uint8_t buff
565597

566598
static void prepareAndSubmitLayer(device_id_t dst, state_sync_prop_id_t propId, layer_id_t layerId) {
567599
sync_command_layer_t buffer;
600+
buffer.layerId = layerId;
568601

569-
const uint8_t firstPacketLeftHalfActionCount = KEY_COUNT_PER_UPDATE;
570-
const uint8_t secondPacketLeftHalfActionCount = MAX_KEY_COUNT_PER_MODULE - KEY_COUNT_PER_UPDATE;
571-
const uint8_t secondPacketLeftModuleActionCount = MAX_BACKLIT_KEY_COUNT_PER_LEFT_MODULE;
602+
// Chunk the half-keyboard actions into KEY_COUNT_PER_UPDATE-sized packets. The
603+
// module actions ride in the last chunk if they fit, else in a trailing packet.
604+
bool moduleActionsSent = false;
572605

573-
buffer.layerId = layerId;
574-
buffer.startOffset = 0;
575-
buffer.actionCount = firstPacketLeftHalfActionCount;
576-
buffer.moduleActionCount = 0;
606+
for (uint8_t halfOffset = 0; halfOffset < MAX_KEY_COUNT_PER_MODULE; halfOffset += KEY_COUNT_PER_UPDATE) {
607+
uint8_t halfCount = MIN(KEY_COUNT_PER_UPDATE, MAX_KEY_COUNT_PER_MODULE - halfOffset);
608+
bool isLastHalfChunk = halfOffset + halfCount >= MAX_KEY_COUNT_PER_MODULE;
577609

578-
prepareLayerActions(layerId, SlotId_LeftKeyboardHalf, 0, 0, firstPacketLeftHalfActionCount, &buffer);
579-
submitPreparedData(dst, propId, (const uint8_t *)&buffer, sizeof(buffer));
610+
buffer.startOffset = halfOffset;
611+
buffer.actionCount = halfCount;
612+
buffer.moduleActionCount = 0;
613+
prepareLayerActions(layerId, SlotId_LeftKeyboardHalf, 0, halfOffset, halfCount, &buffer);
580614

581-
buffer.layerId = layerId;
582-
buffer.startOffset = firstPacketLeftHalfActionCount;
583-
buffer.actionCount = secondPacketLeftHalfActionCount;
584-
buffer.moduleActionCount = secondPacketLeftModuleActionCount;
615+
if (isLastHalfChunk && halfCount + MAX_BACKLIT_KEY_COUNT_PER_LEFT_MODULE <= KEY_COUNT_PER_UPDATE) {
616+
buffer.moduleActionCount = MAX_BACKLIT_KEY_COUNT_PER_LEFT_MODULE;
617+
prepareLayerActions(layerId, SlotId_LeftModule, halfCount, 0, MAX_BACKLIT_KEY_COUNT_PER_LEFT_MODULE, &buffer);
618+
moduleActionsSent = true;
619+
}
620+
621+
submitPreparedData(dst, propId, (const uint8_t *)&buffer, sizeof(buffer));
622+
}
585623

586-
prepareLayerActions(layerId, SlotId_LeftKeyboardHalf, 0, firstPacketLeftHalfActionCount, secondPacketLeftHalfActionCount, &buffer);
587-
prepareLayerActions(layerId, SlotId_LeftModule, secondPacketLeftHalfActionCount, 0, secondPacketLeftModuleActionCount, &buffer);
588-
submitPreparedData(dst, propId, (const uint8_t *)&buffer, sizeof(buffer));
624+
if (!moduleActionsSent) {
625+
buffer.startOffset = 0;
626+
buffer.actionCount = 0;
627+
buffer.moduleActionCount = MAX_BACKLIT_KEY_COUNT_PER_LEFT_MODULE;
628+
prepareLayerActions(layerId, SlotId_LeftModule, 0, 0, MAX_BACKLIT_KEY_COUNT_PER_LEFT_MODULE, &buffer);
629+
submitPreparedData(dst, propId, (const uint8_t *)&buffer, sizeof(buffer));
630+
}
589631
}
590632

591633
static void prepareBacklight(sync_command_backlight_t *buffer) {
@@ -604,8 +646,6 @@ static void prepareLeftHalfStateData(sync_command_module_state_t *buffer) {
604646
buffer->firmwareVersion = firmwareVersion;
605647
buffer->keyCount = MODULE_KEY_COUNT;
606648
buffer->pointerCount = MODULE_POINTER_COUNT;
607-
Utils_SafeStrCopy(buffer->gitRepo, gitRepo, MAX_STRING_PROPERTY_LENGTH);
608-
Utils_SafeStrCopy(buffer->gitTag, gitTag, MAX_STRING_PROPERTY_LENGTH);
609649
memcpy(buffer->firmwareChecksum, DeviceMD5Checksums[DEVICE_ID], MD5_CHECKSUM_LENGTH);
610650
#endif
611651
}
@@ -619,11 +659,35 @@ static void prepareLeftModuleStateData(sync_command_module_state_t *buffer) {
619659
buffer->firmwareVersion = moduleState->firmwareVersion;
620660
buffer->keyCount = moduleState->keyCount;
621661
buffer->pointerCount = moduleState->pointerCount;
622-
memcpy(buffer->gitRepo, moduleState->gitRepo, MAX_STRING_PROPERTY_LENGTH);
623-
memcpy(buffer->gitTag, moduleState->gitTag, MAX_STRING_PROPERTY_LENGTH);
624662
memcpy(buffer->firmwareChecksum, moduleState->firmwareChecksum, MD5_CHECKSUM_LENGTH);
625663
}
626664

665+
static void prepareModuleGitRepo(device_id_t dst) {
666+
sync_command_module_git_repo_t buffer = {};
667+
668+
buffer.slotId = SlotId_LeftKeyboardHalf;
669+
Utils_SafeStrCopy(buffer.gitRepo, gitRepo, MAX_STRING_PROPERTY_LENGTH);
670+
submitPreparedData(dst, StateSyncPropertyId_ModuleGitRepo, (const uint8_t *)&buffer, sizeof(buffer));
671+
672+
uhk_module_state_t *moduleState = UhkModuleStates + UhkModuleSlaveDriver_SlotIdToDriverId(SlotId_LeftModule);
673+
buffer.slotId = SlotId_LeftModule;
674+
Utils_SafeStrCopy(buffer.gitRepo, moduleState->gitRepo, MAX_STRING_PROPERTY_LENGTH);
675+
submitPreparedData(dst, StateSyncPropertyId_ModuleGitRepo, (const uint8_t *)&buffer, sizeof(buffer));
676+
}
677+
678+
static void prepareModuleGitTag(device_id_t dst) {
679+
sync_command_module_git_tag_t buffer = {};
680+
681+
buffer.slotId = SlotId_LeftKeyboardHalf;
682+
Utils_SafeStrCopy(buffer.gitTag, gitTag, MAX_STRING_PROPERTY_LENGTH);
683+
submitPreparedData(dst, StateSyncPropertyId_ModuleGitTag, (const uint8_t *)&buffer, sizeof(buffer));
684+
685+
uhk_module_state_t *moduleState = UhkModuleStates + UhkModuleSlaveDriver_SlotIdToDriverId(SlotId_LeftModule);
686+
buffer.slotId = SlotId_LeftModule;
687+
Utils_SafeStrCopy(buffer.gitTag, moduleState->gitTag, MAX_STRING_PROPERTY_LENGTH);
688+
submitPreparedData(dst, StateSyncPropertyId_ModuleGitTag, (const uint8_t *)&buffer, sizeof(buffer));
689+
}
690+
627691
static void prepareData(device_id_t dst, const uint8_t *propDataPtr, state_sync_prop_id_t propId) {
628692
state_sync_prop_t *prop = &stateSyncProps[propId];
629693
const uint8_t *data = propDataPtr;
@@ -636,13 +700,13 @@ static void prepareData(device_id_t dst, const uint8_t *propDataPtr, state_sync_
636700

637701
switch (propId) {
638702
case StateSyncPropertyId_LayerActionFirst ... StateSyncPropertyId_LayerActionLast: {
639-
layer_id_t layerId = propId - StateSyncPropertyId_LayerActionFirst + LayerId_First;
703+
uint8_t layerId = propId - StateSyncPropertyId_LayerActionFirst + LayerId_First;
640704

641705
if (prop->dirtyState == DirtyState_NeedsClearing) {
642706
submitPreparedData(dst, StateSyncPropertyId_LayerActionsClear, &layerId, sizeof(layerId));
643707
return;
644708
} else {
645-
// 2 packets!
709+
// split across multiple packets
646710
prepareAndSubmitLayer(dst, propId, layerId);
647711
return;
648712
}
@@ -659,6 +723,14 @@ static void prepareData(device_id_t dst, const uint8_t *propDataPtr, state_sync_
659723
submitPreparedData(dst, propId, (const uint8_t *)&buffer, sizeof(buffer));
660724
return;
661725
} break;
726+
case StateSyncPropertyId_ModuleGitRepo: {
727+
prepareModuleGitRepo(dst);
728+
return;
729+
} break;
730+
case StateSyncPropertyId_ModuleGitTag: {
731+
prepareModuleGitTag(dst);
732+
return;
733+
} break;
662734
case StateSyncPropertyId_Backlight: {
663735
sync_command_backlight_t buffer;
664736
prepareBacklight(&buffer);
@@ -772,6 +844,8 @@ static bool handlePropertyUpdateLeftToRight() {
772844

773845
UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_ModuleStateLeftHalf, UpdateResult_UpdatedHighPrio);
774846
UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_ModuleStateLeftModule, UpdateResult_UpdatedHighPrio);
847+
UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_ModuleGitRepo, UpdateResult_UpdatedLowPrio);
848+
UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_ModuleGitTag, UpdateResult_UpdatedLowPrio);
775849
UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_KeyStatesDummy, UpdateResult_UpdatedHighPrio);
776850
UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_LeftModuleDisconnected, UpdateResult_UpdatedHighPrio);
777851
UPDATE_AND_RETURN_IF_DIRTY(StateSyncPropertyId_MergeSensor, UpdateResult_UpdatedHighPrio);
@@ -915,6 +989,8 @@ void StateSync_ResetRightLeftLink(bool bidirectional) {
915989
invalidateProperty(StateSyncPropertyId_Battery);
916990
invalidateProperty(StateSyncPropertyId_ModuleStateLeftHalf);
917991
invalidateProperty(StateSyncPropertyId_ModuleStateLeftModule);
992+
invalidateProperty(StateSyncPropertyId_ModuleGitRepo);
993+
invalidateProperty(StateSyncPropertyId_ModuleGitTag);
918994
invalidateProperty(StateSyncPropertyId_KeyStatesDummy);
919995
invalidateProperty(StateSyncPropertyId_MergeSensor);
920996
}

device/src/state_sync.h

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
// Macros:
1717

18-
#define KEY_COUNT_PER_UPDATE ((MAX_KEY_COUNT_PER_MODULE+MAX_BACKLIT_KEY_COUNT_PER_LEFT_MODULE)/2+1)
18+
// Max key actions per layer-sync packet; sized so sync_command_layer_t fits a
19+
// link packet (see static assert in state_sync.c). Split into 3 packets.
20+
#define KEY_COUNT_PER_UPDATE 23
1921

2022
// Typedefs:
2123

@@ -32,12 +34,12 @@
3234
} ATTR_PACKED sync_command_action_t;
3335

3436
typedef struct {
35-
layer_id_t layerId;
37+
uint8_t layerId;
3638
uint8_t startOffset;
3739
uint8_t actionCount;
3840
uint8_t moduleActionCount;
3941
sync_command_action_t actions[KEY_COUNT_PER_UPDATE];
40-
} sync_command_layer_t;
42+
} ATTR_PACKED sync_command_layer_t;
4143

4244
typedef struct {
4345
uint16_t vertical;
@@ -59,11 +61,20 @@
5961
version_t firmwareVersion;
6062
uint8_t keyCount;
6163
uint8_t pointerCount;
62-
char gitRepo[MAX_STRING_PROPERTY_LENGTH];
63-
char gitTag[MAX_STRING_PROPERTY_LENGTH];
6464
char firmwareChecksum[MD5_CHECKSUM_LENGTH];
6565
} ATTR_PACKED sync_command_module_state_t;
6666

67+
// gitRepo/gitTag are synced separately: together they exceed one link packet.
68+
typedef struct {
69+
uint8_t slotId;
70+
char gitRepo[MAX_STRING_PROPERTY_LENGTH];
71+
} ATTR_PACKED sync_command_module_git_repo_t;
72+
73+
typedef struct {
74+
uint8_t slotId;
75+
char gitTag[MAX_STRING_PROPERTY_LENGTH];
76+
} ATTR_PACKED sync_command_module_git_tag_t;
77+
6778
typedef struct {
6879
version_t dataModelVersion;
6980
} sync_command_config_t;
@@ -106,6 +117,8 @@
106117
StateSyncPropertyId_KeyStatesDummy = 31,
107118
StateSyncPropertyId_DongleProtocolVersion = 32,
108119
StateSyncPropertyId_BatteryStationaryMode = 33,
120+
StateSyncPropertyId_ModuleGitRepo = 34,
121+
StateSyncPropertyId_ModuleGitTag = 35,
109122
StateSyncPropertyId_Count,
110123
} state_sync_prop_id_t;
111124

right/src/slave_drivers/uhk_module_driver.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,8 @@ slave_result_t UhkModuleSlaveDriver_Update(uint8_t uhkModuleDriverId)
458458
#ifdef __ZEPHYR__
459459
if (DEVICE_ID == DeviceId_Uhk80_Left && uhkModuleDriverId == UhkModuleDriverId_LeftModule) {
460460
StateSync_UpdateProperty(StateSyncPropertyId_ModuleStateLeftModule, NULL);
461+
StateSync_UpdateProperty(StateSyncPropertyId_ModuleGitRepo, NULL);
462+
StateSync_UpdateProperty(StateSyncPropertyId_ModuleGitTag, NULL);
461463
}
462464
#endif
463465
LogU("Module %d initialized: protocol version %d.%d.%d, firmware version %d.%d.%d, git tag %s, git repo %s, firmware checksum %s\n",

shared/uart_defs.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313

1414
// modules have very limited RAM, so keep low; Also, keep it
1515
#define UART_MAX_MODULE_PAYLOAD_LENGTH SLAVE_PROTOCOL_MAX_PAYLOAD_LENGTH
16-
// 244 = max BLE payload length
17-
#define UART_MAX_BRIDGE_PAYLOAD_LENGTH 244
16+
// Max deserialized bridge message length. Must equal MAX_LINK_PACKET_LENGTH
17+
// (link_protocol.h) - the bridge rx buffer is a messenger-queue region of
18+
// that size, and messages travel interchangeably over UART and BLE. Kept
19+
// small (rather than the BLE-max 244) to save RAM and cut BLE latency.
20+
#define UART_MAX_BRIDGE_PAYLOAD_LENGTH 128
1821

1922
#define UART_CRC_LEN 2
2023

0 commit comments

Comments
 (0)