mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-26 20:32:09 +08:00
@@ -35,7 +35,7 @@ struct __attribute__((packed)) spi_header {
|
||||
uint16_t max_rx_len;
|
||||
};
|
||||
|
||||
const int SPI_ACK_TIMEOUT = 500; // milliseconds
|
||||
const unsigned int SPI_ACK_TIMEOUT = 500; // milliseconds
|
||||
const std::string SPI_DEVICE = "/dev/spidev0.0";
|
||||
|
||||
class LockEx {
|
||||
@@ -238,9 +238,10 @@ int PandaSpiHandle::spi_transfer_retry(uint8_t endpoint, uint8_t *tx_data, uint1
|
||||
|
||||
int PandaSpiHandle::wait_for_ack(uint8_t ack, uint8_t tx, unsigned int timeout) {
|
||||
double start_millis = millis_since_boot();
|
||||
if (timeout <= 0) {
|
||||
if (timeout == 0) {
|
||||
timeout = SPI_ACK_TIMEOUT;
|
||||
}
|
||||
timeout = std::clamp(timeout, 100U, SPI_ACK_TIMEOUT);
|
||||
|
||||
spi_ioc_transfer transfer = {
|
||||
.tx_buf = (uint64_t)tx_buf,
|
||||
|
||||
Reference in New Issue
Block a user