inav-configurator icon indicating copy to clipboard operation
inav-configurator copied to clipboard

fix serial port open

Open error414 opened this issue 2 weeks ago • 2 comments

This PR needs review by someone who knows JS well.

I noticed that opening serial port is slow. The reasson is that serial port is not opened and configurator tries to write data serial port. It causes restart MSP quering and delay for opening configurator.

The flow is:

Connecting to: COM5
connection.js:88  Connection opened with ID: 1, Baud: 115200

connectionSerial.js:121  Serial write error: Invalid serial port or port closed <-- IT'S NOT CORRECT
serial_queue.js:285      Force free hard lock
serial_queue.js:146      MSP data request timed-out: 1

intervals.js:114  Killing all intervals except:
  - global_data_refresh
  - msp-load-update
  - ltm-connection-check

fc.js:205  Generating AUX_CONFIG

I would say it's caused by calling resolve before port is fully opened, right aproach call resolve when port is fully opened. See pull request code.

After my patch is connection to FC much faster and log look more clean

Connecting to: COM5
connection.js:88  Connection opened with ID: 1, Baud: 115200

intervals.js:114  Killing all intervals except:
 - global_data_refresh
 - msp-load-update
 - ltm-connection-check

fc.js:205  Generating AUX_CONFIG

intervals.js:114  Killing all intervals except:
 - global_data_refresh
 - msp-load-update
 - ltm-connection-check

error414 avatar Dec 14 '25 10:12 error414