From fb36c60738ebe3407a6bbc071a7f46b31b09adbb Mon Sep 17 00:00:00 2001 From: shufps Date: Sat, 14 Sep 2024 07:26:07 +0200 Subject: [PATCH] fixes chip id response of bm1397 --- src/drivers/nerd-nos/bm1397.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/drivers/nerd-nos/bm1397.cpp b/src/drivers/nerd-nos/bm1397.cpp index 5c2c45a..0eeade9 100644 --- a/src/drivers/nerd-nos/bm1397.cpp +++ b/src/drivers/nerd-nos/bm1397.cpp @@ -48,6 +48,8 @@ typedef struct __attribute__((__packed__)) static const char *TAG = "bm1397Module"; +static const uint8_t chip_id[] = {0xAA, 0x55, 0x13, 0x97, 0x18, 0x00}; + uint32_t increment_bitmask(const uint32_t value, const uint32_t mask); /// @brief @@ -204,9 +206,8 @@ static uint8_t _send_init(uint64_t frequency, uint16_t asic_count) int chip_counter = 0; while (true) { - int received = SERIAL_rx(buf, 11, 1000); - if (received > 0) { - //ESP_LOG_BUFFER_HEX(TAG, asic_response_buffer, received); + int received = SERIAL_rx(buf, 9, 1000); + if (received > 0 && !memcmp(chip_id, buf, sizeof(chip_id))) { chip_counter++; } else { break;