From f45dd7713ac886e0051b6a248c7706f9b6e56a58 Mon Sep 17 00:00:00 2001 From: Skot Date: Wed, 14 Feb 2024 23:46:53 -0500 Subject: [PATCH] serial sync for 1397 too. --- components/bm1397/bm1397.c | 45 +++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/components/bm1397/bm1397.c b/components/bm1397/bm1397.c index 49b58c620..f1b1bd36f 100644 --- a/components/bm1397/bm1397.c +++ b/components/bm1397/bm1397.c @@ -379,28 +379,29 @@ void BM1397_send_work(void *pvParameters, bm_job *next_bm_job) asic_result *BM1397_receive_work(void) { - // wait for a response, wait time is pretty arbitrary - int received = SERIAL_rx(asic_response_buffer, 9, 60000); - - if (received < 0) - { - ESP_LOGI(TAG, "Error in serial RX"); - return NULL; - } - else if (received == 0) - { - // Didn't find a solution, restart and try again - return NULL; - } - - if (received != 9 || asic_response_buffer[0] != 0xAA || asic_response_buffer[1] != 0x55) - { - ESP_LOGI(TAG, "Serial RX invalid %i", received); - ESP_LOG_BUFFER_HEX(TAG, asic_response_buffer, received); - return NULL; - } - - return (asic_result *)asic_response_buffer; + // // wait for a response, wait time is pretty arbitrary + // int received = SERIAL_rx(asic_response_buffer, 9, 60000); + + // if (received < 0) + // { + // ESP_LOGI(TAG, "Error in serial RX"); + // return NULL; + // } + // else if (received == 0) + // { + // // Didn't find a solution, restart and try again + // return NULL; + // } + + // if (received != 9 || asic_response_buffer[0] != 0xAA || asic_response_buffer[1] != 0x55) + // { + // ESP_LOGI(TAG, "Serial RX invalid %i", received); + // ESP_LOG_BUFFER_HEX(TAG, asic_response_buffer, received); + // return NULL; + // } + + // return (asic_result *)asic_response_buffer; + return SERIAL_rx_aa55(asic_response_buffer, 9); } task_result *BM1397_proccess_work(void *pvParameters)