|
|
@@ -245,12 +245,18 @@ void nbus_slave_unicastToSensorSet(nBus_TypeDef *nbus)
|
|
|
break;
|
|
|
|
|
|
case CMD_INFO: {
|
|
|
- nBus_sensorFormat_t format = nbus->interface->getFormat(nbus->sensorInfo.address);
|
|
|
- // const uint8_t *data = (const uint8_t*)&format; doesnt work, missaligned data
|
|
|
- uint16_t data = format.sign << 15 | format.variable_length << 14 | format.q_m << 7 | format.q_n;
|
|
|
- nbus->tx_buffer[4] = data >> 8;
|
|
|
- nbus->tx_buffer[5] = data & 0xFF;
|
|
|
- nbus->tx_length += 2;
|
|
|
+ switch (nbus->rx_buffer[3])
|
|
|
+ {
|
|
|
+ case SENSOR_FORMAT: {
|
|
|
+ nBus_sensorFormat_t format = nbus->interface->getSensorFormat(nbus->sensorInfo.address);
|
|
|
+ nbus->tx_buffer[4] = nbus->sensorInfo.address;
|
|
|
+ nbus->tx_buffer[5] = (format.sign << 7) | format.unit_multiplier;
|
|
|
+ nbus->tx_buffer[6] = format.value_multiplier;
|
|
|
+ nbus->tx_buffer[7] = (format.byte_length << 4) | format.samples;
|
|
|
+ }
|
|
|
+
|
|
|
+ nbus->tx_length += 4;
|
|
|
+ }
|
|
|
}
|
|
|
break;
|
|
|
|