serial hack/fix

This commit is contained in:
Skot 2024-02-13 23:12:45 -05:00 committed by Georges Palauqui
parent 06e05b5623
commit 8d4d66f608
No known key found for this signature in database
GPG Key ID: 1E45F544CE4D04A5
2 changed files with 6 additions and 5 deletions

View File

@ -649,7 +649,7 @@ void BM1366_send_work(void * pvParameters, bm_job * next_bm_job)
asic_result * BM1366_receive_work(void)
{
// wait for a response, wait time is pretty arbitrary
int received = SERIAL_rx(asic_response_buffer, 11, 60000);
int received = SERIAL_rx(asic_response_buffer, 11, 20);
if (received < 0) {
ESP_LOGI(TAG, "Error in serial RX");

View File

@ -60,10 +60,11 @@ int SERIAL_send(uint8_t *data, int len, bool debug)
return uart_write_bytes(UART_NUM_1, (const char *)data, len);
}
/// @brief waits for a serial response from the device
/// @param buf buffer to read data into
/// @param buf number of ms to wait before timing out
/// @return number of bytes read, or -1 on error
/// @brief reads serial bytes into a buffer
/// @param buf
/// @param size
/// @param timeout_ms
/// @return
int16_t SERIAL_rx(uint8_t *buf, uint16_t size, uint16_t timeout_ms)
{
int16_t bytes_read = uart_read_bytes(UART_NUM_1, buf, size, timeout_ms / portTICK_PERIOD_MS);