parse_packet refactoring
This commit is contained in:
parent
93d8c837d2
commit
58639579ed
|
|
@ -33,3 +33,5 @@ BreakBeforeBraces: Allman
|
|||
IndentAccessModifiers: true
|
||||
|
||||
IndentPPDirectives: AfterHash
|
||||
|
||||
IndentCaseLabels: true
|
||||
|
|
|
|||
|
|
@ -1243,25 +1243,31 @@ uint16_t BNO08x::parse_packet(bno08x_rx_packet_t* packet)
|
|||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
ESP_LOGW(TAG, "SHTP Header RX'd: 0x%X 0x%X 0x%X 0x%X", packet->header[0], packet->header[1], packet->header[2], packet->header[3]);
|
||||
#endif
|
||||
|
||||
// clang-format on
|
||||
|
||||
if (packet->body[0] == SHTP_REPORT_PRODUCT_ID_RESPONSE) // check to see that product ID matches what it should
|
||||
switch (packet->body[0])
|
||||
{
|
||||
case SHTP_REPORT_PRODUCT_ID_RESPONSE:
|
||||
return parse_product_id_report(packet);
|
||||
}
|
||||
break;
|
||||
|
||||
/*if(packet->body[0] == SHTP_REPORT_GET_FEATURE_RESPONSE)
|
||||
{
|
||||
case SHTP_REPORT_GET_FEATURE_RESPONSE:
|
||||
|
||||
}*/
|
||||
break;
|
||||
|
||||
if (packet->body[0] == SHTP_REPORT_FRS_READ_RESPONSE)
|
||||
{
|
||||
case SHTP_REPORT_FRS_READ_RESPONSE:
|
||||
return parse_frs_read_response_report(packet);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Check to see if this packet is a sensor reporting its data to us
|
||||
if (packet->header[2] == CHANNEL_REPORTS && packet->body[0] == SHTP_REPORT_BASE_TIMESTAMP)
|
||||
switch (packet->header[2])
|
||||
{
|
||||
case CHANNEL_REPORTS:
|
||||
if (packet->body[0] == SHTP_REPORT_BASE_TIMESTAMP)
|
||||
{
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
|
|
@ -1269,31 +1275,38 @@ uint16_t BNO08x::parse_packet(bno08x_rx_packet_t* packet)
|
|||
#endif
|
||||
// clang-format on
|
||||
|
||||
return parse_input_report(packet); // This will update the rawAccelX, etc variables depending on which feature
|
||||
// report is found
|
||||
// this will update the rawAccelX, etc variables depending on which feature report is found
|
||||
return parse_input_report(packet);
|
||||
}
|
||||
break;
|
||||
|
||||
if (packet->header[2] == CHANNEL_CONTROL)
|
||||
{
|
||||
case CHANNEL_CONTROL:
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
ESP_LOGI(TAG, "RX'd packet, channel control");
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
return parse_command_report(packet); // This will update responses to commands, calibrationStatus, etc.
|
||||
}
|
||||
// this will update responses to commands, calibrationStatus, etc.
|
||||
return parse_command_report(packet);
|
||||
|
||||
if (packet->header[2] == CHANNEL_GYRO)
|
||||
{
|
||||
break;
|
||||
|
||||
case CHANNEL_GYRO:
|
||||
// clang-format off
|
||||
#ifdef CONFIG_ESP32_BNO08x_DEBUG_STATEMENTS
|
||||
ESP_LOGI(TAG, "Rx packet, channel gyro");
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
return parse_input_report(packet); // This will update the rawAccelX, etc variables depending on which feature
|
||||
// report is found
|
||||
// this will update the rawAccelX, etc variables depending on which feature report is found
|
||||
return parse_input_report(packet);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue