Skip to content

fix(sensor): swap Fast Cadence Period Divisor and Status Trigger Type - #176

Open
stevebutler11 wants to merge 1 commit into
nordicsemi:mainfrom
stevebutler11:fix/sensor-cadence-enc-dec
Open

stevebutler11 wants to merge 1 commit into
nordicsemi:mainfrom
stevebutler11:fix/sensor-cadence-enc-dec

Conversation

@stevebutler11

Copy link
Copy Markdown

Mesh Model v1.1 Section 4.1.3 packs the first byte of the Sensor Cadence state as the Fast Cadence Period Divisor in bits 0-6 and the Status Trigger Type in bit 7.

image

SensorCadence in SensorMessage.kt encodes & decodes them the other way round.

This fixes sensor cadence encoding/decoding in accordance with Mesh Model v1.1 by putting Status Trigger Type as the MSB and the Fast Cadence Period Divisor as the LSBs

NCS firmare (v3.1.1, subsys/bluetooth/mesh/sensor.c) confirms, as it encodes & decodes correctly:

// in sensor_cadence_encode function
net_buf_simple_add_u8(buf, (delta_type << 7) | (BIT_MASK(7) & fast_period_div));

// in sensor_cadence_decode function
div_and_type = net_buf_simple_pull_u8(buf);
delta_type = div_and_type >> 7;
// ...
*fast_period_div = div_and_type & BIT_MASK(7);

Mesh Model v1.1 Section 4.1.3 packs the first byte of the Sensor Cadence state as the Fast Cadence Period Divisor in bits 0-6 and the Status Trigger Type in bit 7.
SensorCadence in SensorMessage.kt encodes & decodes them the other way round.

This fixes sensor cadence encoding/decoding in accordance with Mesh Model v1.1 by putting triggerType as the MSB and the divisor as the LSBs
@CLAassistant

CLAassistant commented Sep 4, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants