Skip to content
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

Make serial connection timeout dynamic #2838

Merged
merged 1 commit into from Mar 2, 2022

Conversation

haslinghuis
Copy link
Member

@haslinghuis haslinghuis commented Feb 28, 2022

As a long time request this PR makes the serial reconnection timeout dynamic with a timeout of 10 seconds.
The PR makes sure we have a new connection on reinitialization and waits for the connection to be ready and fixes the bug connecting to soon with a predetermined timeout now verified by timestamp.

image

@github-actions

This comment has been minimized.

@haslinghuis haslinghuis added this to For discussion in Finalizing Firmware 4.3 Release via automation Feb 28, 2022
@haslinghuis haslinghuis added this to the 10.8.0 milestone Feb 28, 2022
@haslinghuis haslinghuis changed the title Make connection timeout dynamic Make serial connection timeout dynamic Feb 28, 2022
@github-actions

This comment was marked as outdated.

@github-actions

This comment has been minimized.

@ctzsnooze
Copy link
Member

The commit does several things...

  • removes the fixed 'settling time' of 0.1s that previously applied when auto-reconnecting (plugging in a board with auto-connect switch enabled)
  • when a re-connect is required, eg after changing ports when a reboot is needed, the re-connection is now dynamic, taking only as long as is needed
  • this removes the need for a manual re-connection time delay (which used to be set under 'Options' tab)

Here is a console log after clicking 'Save' in Ports, where it took 3.1s to reconnect

Settings Saved in EEPROM
serial_backend.js:832 Reintialising Connection
MSPHelper.js:1687 Arming disable
serial.js:249 serial: closed connection with ID: 2, Sent: 36597 bytes, Received: 463632 bytes
port_handler.js:129 PortHandler - Removed: [{"path":"/dev/cu.usbmodem0x80000001","displayName":"Betaflight STM32F411","vendorId":1155,"productId":22336},{"path":"/dev/tty.usbmodem0x80000001","displayName":"Betaflight STM32F411","vendorId":1155,"productId":22336}]
port_handler.js:169 PortHandler - Found: [{"path":"/dev/cu.usbmodem0x80000001","displayName":"Betaflight STM32F411","vendorId":1155,"productId":22336},{"path":"/dev/tty.usbmodem0x80000001","displayName":"Betaflight STM32F411","vendorId":1155,"productId":22336}]
port_handler.js:276 Porthandler detected device Betaflight STM32F411 on port: /dev/tty.usbmodem0x80000001
serial_backend.js:67 Connecting to: /dev/tty.usbmodem0x80000001
serial.js:119 serial: connection opened with ID: 3 , Baud: 115200
serial_backend.js:246 Requesting configuration data
serial_backend.js:849 Serial connection available after 3.1 seconds

Tested, works well.

ctzsnooze
ctzsnooze previously approved these changes Feb 28, 2022
@asizon
Copy link
Member

asizon commented Feb 28, 2022

Seems a new improvement not a bug fix, weneed to release 10.8.0 this year

@sonarcloud
Copy link

sonarcloud bot commented Feb 28, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link
Contributor

Do you want to test this code? Here you have an automated build:
Betaflight-Configurator-Debug-Android
Betaflight-Configurator-Debug-Linux
Betaflight-Configurator-Debug-macOS
Betaflight-Configurator-Debug-Windows
WARNING: It may be unstable and result in corrupted configurations or data loss. Use only for testing!

@haslinghuis haslinghuis moved this from For discussion to Configurator in Finalizing Firmware 4.3 Release Feb 28, 2022
@blckmn
Copy link
Member

blckmn commented Mar 1, 2022

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

Finalizing Firmware 4.3 Release automation moved this from Configurator to Firmware Mar 2, 2022
@asizon asizon merged commit 5b1845f into betaflight:master Mar 2, 2022
Finalizing Firmware 4.3 Release automation moved this from Firmware to Finished (Merged) Mar 2, 2022
@haslinghuis haslinghuis deleted the dynamic_timeout branch March 2, 2022 09:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants