-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
BLHeliSuite32 holds 4wayif code in indefinite loop waiting for ESC so remove timeout #13287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Do you want to test this code? You can flash it directly from Betaflight Configurator:
WARNING: It may be unstable. Use only for testing! |
It does not work |
What FC and ESC have you tested with? I've tested with a MATEKF405TE + HolyBro TEKKO32 F3 Metal and GEPRCF722BT + TMOTOR F55A G0 using BLHeliSuite32xm 64 1.0.4.4 and a BETAFPV F4 1S 12A AIO Brushless Flight Controller V3 using BLHeliSuite 16.7.14.9.0.3. |
#13287 Worked for me too. 4.5.0-RC2 could not load the ESC config but this PR does. Hardware is SPEEDYBEEF405V3 + Skystars KM45A Butter 128 and BLHeliSuite32 32.10.0.0.6. Thanks SteveCEvans! EDIT: Flashing firmware through BF works as well. |
AUTOMERGE: (FAIL)
|
src/main/io/serial_4way.c
Outdated
|
||
RX_LED_ON; | ||
|
||
Dummy.word = 0; | ||
O_PARAM = &Dummy.bytes[0]; | ||
O_PARAM_LEN = 1; | ||
|
||
timedOut = ReadByteCrc(&CMD, CMD_TIMEOUT_US); | ||
timedOut |= ReadByteCrc(&ioMem.D_FLASH_ADDR_H, ARG_TIMEOUT_US); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
timedOut = timedOut || ReadByteCrc(&ioMem.D_FLASH_ADDR_H, ARG_TIMEOUT_US);
will short-circuit on first timeout. And possibly make code a bit simpler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've implemented a change inspired by this.
timedOut |= ReadByteCrc(&ioMem.D_FLASH_ADDR_H, ARG_TIMEOUT_US); | ||
timedOut |= ReadByteCrc(&ioMem.D_FLASH_ADDR_L, ARG_TIMEOUT_US); | ||
timedOut |= ReadByteCrc(&I_PARAM_LEN, ARG_TIMEOUT_US); | ||
|
||
if (!timedOut) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; !timeout && i < I_PARAM_LEN; i++)
timedOut |= ReadByteCrc(ParamBuff + i, DAT_TIMEOUT_US);
for (int i = 1; !timeout && i >= 0; i--)
timedOut |= ReadByte(&CRC_check.bytes[i], CRC_TIMEOUT_US);
updated i--
in second for
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I've implemented a change inspired by this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer at the end. Where in our coding guidelines does it suggest otherwise?
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Working now for me |
54de32c
to
84b8ba9
Compare
Retested with both Bluejay and BLHeli32 |
f1339b3
to
84b8ba9
Compare
BLHeliSuite32 enters 4wayif interface code on connection which then waits indefinitely for ESC, so remove timeout from that loop.
Fixes #13285