Commit 6eca1ec
Fix infinite loops and timeout handling in SPI and CAN
- SPI _wait_for_ack: default timeout=0 to 500ms, clamp to 100-500ms range
- SPI _transfer: default timeout=0 to 500ms, add MAX_TIMEOUT_RETRIES (5) limit
- SPI _transfer: add NACK backoff like C++ implementation
- SPI _transfer: run recovery logic for ALL exception types (fixes onroad test)
- CAN can_recv: max 3 retries instead of infinite loop, return [] on failure
- CAN can_send_many: detect no-progress and drop after 3 retries
- CAN_SEND_TIMEOUT_MS: changed from 10ms to 5ms to match C++
These changes align Python behavior with the C++ pandad implementation.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent 3dd38b7 commit 6eca1ec
2 files changed
Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
695 | | - | |
| 695 | + | |
| 696 | + | |
696 | 697 | | |
697 | 698 | | |
698 | 699 | | |
| |||
701 | 702 | | |
702 | 703 | | |
703 | 704 | | |
| 705 | + | |
704 | 706 | | |
705 | 707 | | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
706 | 715 | | |
707 | 716 | | |
708 | 717 | | |
| |||
711 | 720 | | |
712 | 721 | | |
713 | 722 | | |
714 | | - | |
| 723 | + | |
715 | 724 | | |
716 | 725 | | |
717 | 726 | | |
718 | 727 | | |
719 | 728 | | |
720 | | - | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
721 | 733 | | |
722 | 734 | | |
723 | 735 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
28 | 30 | | |
| 31 | + | |
29 | 32 | | |
30 | 33 | | |
31 | 34 | | |
| |||
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
130 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
131 | 138 | | |
132 | 139 | | |
133 | | - | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| |||
182 | 189 | | |
183 | 190 | | |
184 | 191 | | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
185 | 196 | | |
186 | 197 | | |
187 | 198 | | |
188 | | - | |
| 199 | + | |
| 200 | + | |
189 | 201 | | |
190 | 202 | | |
191 | 203 | | |
| |||
209 | 221 | | |
210 | 222 | | |
211 | 223 | | |
| 224 | + | |
212 | 225 | | |
213 | 226 | | |
214 | 227 | | |
| |||
0 commit comments