Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add improved connect-serial-port.cmd script (ask for COM port, add de…
…lay before sending data) The new version of the connect-serial-port.cmd script brings two changes: 1) By default, it will ask for a COM port number to connect to 2) It will wait a few seconds between configuring the port and starting socat to avoid an issue where some Mega 2560 boards would get stuck in the bootloader and never start the main program
- Loading branch information
Showing
3 changed files
with
45 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,30 @@ | ||
REM Specify the number of the COM port your Arduino is connected to: | ||
@echo off | ||
REM Specify the COM port number to connect to in the following line. | ||
REM If set to the default value of ASK, the script will ask you to type it in each time. | ||
set COMPORT=ASK | ||
|
||
set COMPORT=5 | ||
REM Set PROTOCOL to "TCP" if UDP does not work for you. When using TCP, | ||
REM you have to start the script after you have started the mission and the simulation | ||
REM has been unpaused, otherwise the connection will fail ("Connection refused"). | ||
set PROTOCOL=UDP | ||
|
||
set VERBOSE=-v | ||
set MODE_OUTPUT_REDIR=CON | ||
if "%1" == "/Q" ( | ||
set VERBOSE= | ||
set MODE_OUTPUT_REDIR=NUL | ||
shift | ||
) | ||
|
||
if not "%1" == "" set COMPORT=%1 | ||
if "%COMPORT%" == "ASK" set /p COMPORT=Enter a COM Port Number: | ||
|
||
set /A TTYNUM=%COMPORT%-1 | ||
mode COM%COMPORT% BAUD=250000 PARITY=N DATA=8 STOP=1 TO=off DTR=on | ||
socat\socat -v UDP4-RECV:5010,ip-add-membership=239.255.50.10:127.0.0.1,reuseaddr!!udp-sendto:localhost:7778 /dev/ttyS%TTYNUM% | ||
if "%MODE_OUTPUT_REDIR%" == "NUL" echo Connecting to COM port %COMPORT% | ||
mode COM%COMPORT% BAUD=250000 PARITY=N DATA=8 STOP=1 TO=off DTR=off > %MODE_OUTPUT_REDIR% | ||
timeout 2 | ||
if "%PROTOCOL%" == "UDP" socat\socat %VERBOSE% UDP4-RECV:5010,ip-add-membership=239.255.50.10:0.0.0.0,reuseaddr!!udp-sendto:localhost:7778 /dev/ttyS%TTYNUM% | ||
if "%PROTOCOL%" == "TCP" socat\socat %VERBOSE% TCP4-CONNECT:127.0.0.1:7778 /dev/ttyS%TTYNUM% | ||
|
||
|
||
pause |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@echo off | ||
REM The COMPORTS variable should be set to a space-separated list of COM port numbers: | ||
set COMPORTS=4 3 | ||
|
||
for %%i in (%COMPORTS%) do start /b cmd /c connect-serial-port.cmd /Q %%i |