From f7028aaba2dfe7f20f05a9c7e4794c8a3b3cd13c Mon Sep 17 00:00:00 2001 From: NotFastEnuf Date: Mon, 24 Aug 2020 10:09:01 -0400 Subject: [PATCH] added 0x00 byte to end of smard audio frame --- .settings/language.settings.xml | 66 ++++++++++++++-------------- src/drivers/drv_serial_smart_audio.c | 9 ++-- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index a206abf04..a4c8f902f 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -698,16 +698,16 @@ - + - + - + @@ -747,16 +747,16 @@ - + - + - + @@ -796,16 +796,16 @@ - + - + - + @@ -845,16 +845,16 @@ - + - + - + @@ -894,16 +894,16 @@ - + - + - + @@ -943,16 +943,16 @@ - + - + - + @@ -992,16 +992,16 @@ - + - + - + @@ -1041,16 +1041,16 @@ - + - + - + @@ -1090,16 +1090,16 @@ - + - + - + @@ -1139,16 +1139,16 @@ - + - + - + @@ -1305,16 +1305,16 @@ - + - + - + diff --git a/src/drivers/drv_serial_smart_audio.c b/src/drivers/drv_serial_smart_audio.c index 1dfaedc0d..c28a2adce 100644 --- a/src/drivers/drv_serial_smart_audio.c +++ b/src/drivers/drv_serial_smart_audio.c @@ -382,7 +382,7 @@ smart_audio_update_result_t serial_smart_audio_update() { } void serial_smart_audio_send_payload(uint8_t cmd, const uint8_t *payload, const uint32_t size) { - frame_length = size + 1 + SA_HEADER_SIZE; + frame_length = size + 2 + SA_HEADER_SIZE; frame[0] = 0x00; frame[1] = 0xAA; @@ -392,15 +392,14 @@ void serial_smart_audio_send_payload(uint8_t cmd, const uint8_t *payload, const for (uint8_t i = 0; i < size; i++) { frame[i + SA_HEADER_SIZE] = payload[i]; } - frame[size + SA_HEADER_SIZE] = crc8_data(frame + 1, frame_length - 2); - + frame[size + SA_HEADER_SIZE] = crc8_data(frame + 1, frame_length - 3); + frame[size + 1 + SA_HEADER_SIZE] = 0x00; circular_buffer_clear(&smart_audio_rx_buffer); smart_audio_auto_baud(); quic_debugf("SMART_AUDIO: send cmd %d (%d)", cmd, size); serial_smart_audio_send_data(frame, frame_length); - parser_state = PARSER_INIT; last_valid_read = timer_millis(); } -#endif \ No newline at end of file +#endif