Skip to content

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

Merged
merged 1 commit into from
Jan 13, 2024

Conversation

SteveCEvans
Copy link
Member

BLHeliSuite32 enters 4wayif interface code on connection which then waits indefinitely for ESC, so remove timeout from that loop.

Fixes #13285

@SteveCEvans SteveCEvans added this to the 4.5 milestone Jan 10, 2024
@SteveCEvans SteveCEvans self-assigned this Jan 10, 2024
Copy link

Do you want to test this code? You can flash it directly from Betaflight Configurator:

  • Simply put #13287 (this pull request number) in the Select commit field of the Configurator firmware flasher tab (you need to Enable expert mode, Show release candidates and Development).

WARNING: It may be unstable. Use only for testing!

@Rockj71
Copy link

Rockj71 commented Jan 10, 2024

Vuoi testare questo codice? Puoi installarlo direttamente dal Configuratore Betaflight:

  • Basta inserire #13287(questo numero di richiesta pull) nel Select commitcampo della scheda flasher del firmware del Configuratore (è necessario Enable expert mode, Show release candidatese Development).

ATTENZIONE: potrebbe essere instabile. Utilizzare solo per i test!

It does not work

@SteveCEvans
Copy link
Member Author

Vuoi testare questo codice? Puoi installarlo direttamente dal Configuratore Betaflight:

  • Basta inserire #13287(questo numero di richiesta pull) nel Select commitcampo della scheda flasher del firmware del Configuratore (è necessario Enable expert mode, Show release candidatese Development).

ATTENZIONE: potrebbe essere instabile. Utilizzare solo per i test!

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.

@CapnBry
Copy link
Contributor

CapnBry commented Jan 10, 2024

#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.

image

@nerdCopter
Copy link
Member

nerdCopter commented Jan 10, 2024

It does not work

just in case of confusion -- must press [enter] after typing #13287
image

@blckmn
Copy link
Member

blckmn commented Jan 10, 2024

AUTOMERGE: (FAIL)

  • github identifies PR as mergeable -> FAIL
  • assigned to a milestone -> PASS
  • cooling off period lapsed -> PASS
  • commit count less or equal to three -> PASS
  • Don't merge label NOT found -> PASS
  • at least one RN: label found -> PASS
  • Tested label found -> PASS
  • assigned to an approver -> PASS
  • approver count at least three -> FAIL


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);
Copy link
Contributor

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

Copy link
Member Author

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) {
Copy link
Contributor

@ledvinap ledvinap Jan 11, 2024

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

Copy link
Member Author

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.

Copy link
Member Author

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.

@ojwright845
Copy link

Working now for me

@SteveCEvans
Copy link
Member Author

Retested with both Bluejay and BLHeli32

@haslinghuis haslinghuis merged commit d039124 into betaflight:master Jan 13, 2024
freasy pushed a commit to freasy/betaflight that referenced this pull request Jan 22, 2024
davidbitton pushed a commit to davidbitton/betaflight that referenced this pull request Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: COMPLETED
Development

Successfully merging this pull request may close these issues.

BLHeli32 Passthrough broken in 4.5 RC 2