diff --git a/compiled/due/upload.bat b/compiled/due/upload.bat index affc186..e55fb85 100644 --- a/compiled/due/upload.bat +++ b/compiled/due/upload.bat @@ -1,3 +1,90 @@ -mode com3:1200,n,8,1 -pause -C:\Users\Akmal\.platformio\packages\tool-bossac\bossac.exe -i --port=com3 -U false -e -w -v -b C:\Users\Akmal\ownCloud\compiled\due\Wiz5500\firmware.bin -R \ No newline at end of file +@ECHO off + +REM Wait X second for memory on Arduino Due is erased. +SET WAIT_ERASED=4 + +ECHO ------ External tool BossacArduinoDue started ------ + +REM number of command line arguments ok? +REM IF [%1]==[] GOTO error_args +REM IF [%2]==[] GOTO error_args + +REM set command line arguments +SET BOSSACPATH=..\tools\win\tool-bossac\bossac.exe +SET BINFILE=firmware.bin + +REM parse command line arguments +SET BOSSACPATH=%BOSSACPATH:"=% +SET BINFILE=%BINFILE:"=% + +REM workeround for bug in Atmel Studio 6.0.1996 Service Pack 2 +SET BINFILE=%BINFILE:\\=\% +SET BINFILE=%BINFILE:.cproj=% + +REM bossac path exist? +IF NOT EXIST "%BOSSACPATH%" GOTO error_arg1 + +REM bin file exist? +IF NOT EXIST "%BINFILE%" GOTO error_binfile + +REM fetch DeviceID of Arduino Due Programming Port from WMI Service +FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%USB%%'" get DeviceID') DO ( + SET COMX=%%a + GOTO exit1 +) + +REM Arduino Due Programming Port not exist +GOTO error_comport + +:exit1 + +REM remove blank +SET COMPORT=%COMX: =% + +REM report in Atmel Studio 6.0 IDE output window +ECHO BossacPath=%BOSSACPATH% +ECHO BinFile=%BINFILE% +ECHO Arduino Due Programming Port is detected as %COMPORT%. + +REM The bossac bootloader only runs if the memory on Arduino Due is erased. +REM The Arduino IDE does this by opening and closing the COM port at 1200 baud. +REM This causes the Due to execute a soft erase command. +ECHO Forcing reset using 1200bps open/close on port +ECHO MODE %COMPORT%:1200,N,8,1 +MODE %COMPORT%:1200,N,8,1 + +REM Wait X second for memory on Arduino Due is erased. +ECHO Wait for memory on Arduino Due is erased... +PING -n %WAIT_ERASED% 127.0.0.1>NUL + +REM Execute bossac.exe +ECHO Execute bossac with command line: +ECHO "%BOSSACPATH%" -i -d --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R +START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R + +GOTO end + +:error_args +ECHO Error: wrong number of command line arguments passed! +GOTO end + +:error_arg1 +ECHO Error: command line argument 1 - path to bossac.exe not exist! - "C:\Program Files (x86)\arduino-1.5.2\hardware\tools\bossac.exe" +ECHO Error: command line argument 1 - argument passed = %1 +GOTO end + +:error_arg2 +ECHO Error: command line argument 2 - path to bin file not exist! - use $(OutputDirectory)\$(OutputFileName).bin +ECHO Error: command line argument 2 - argument passed = %1 +GOTO end + +:error_binfile +ECHO Error: bin file "%BINFILE%" not exist! +GOTO end + +:error_comport +ECHO Error: Arduino Due Programming Port not found! + +:end + +ECHO ======================== Done ======================== \ No newline at end of file diff --git a/compiled/due/upload999.bat b/compiled/due/upload999.bat deleted file mode 100644 index 6f35168..0000000 --- a/compiled/due/upload999.bat +++ /dev/null @@ -1,3 +0,0 @@ -mode com3:1200,n,8,1 -pause -C:\Users\Akmal\.platformio\packages\tool-bossac\bossac.exe -i --port=com3 -U false -e -w -v -b C:\Users\Akmal\ownCloud\compiled\due\Wiz5500\firmware999.bin -R \ No newline at end of file diff --git a/compiled/lighthub21/upload.bat b/compiled/lighthub21/upload.bat index 29a5af9..e55fb85 100644 --- a/compiled/lighthub21/upload.bat +++ b/compiled/lighthub21/upload.bat @@ -1,3 +1,90 @@ -mode com3:1200,n,8,1 -pause -..\tools\win\tool-bossac\bossac.exe -i --port=com3 -U false -e -w -v -b firmware.bin -R \ No newline at end of file +@ECHO off + +REM Wait X second for memory on Arduino Due is erased. +SET WAIT_ERASED=4 + +ECHO ------ External tool BossacArduinoDue started ------ + +REM number of command line arguments ok? +REM IF [%1]==[] GOTO error_args +REM IF [%2]==[] GOTO error_args + +REM set command line arguments +SET BOSSACPATH=..\tools\win\tool-bossac\bossac.exe +SET BINFILE=firmware.bin + +REM parse command line arguments +SET BOSSACPATH=%BOSSACPATH:"=% +SET BINFILE=%BINFILE:"=% + +REM workeround for bug in Atmel Studio 6.0.1996 Service Pack 2 +SET BINFILE=%BINFILE:\\=\% +SET BINFILE=%BINFILE:.cproj=% + +REM bossac path exist? +IF NOT EXIST "%BOSSACPATH%" GOTO error_arg1 + +REM bin file exist? +IF NOT EXIST "%BINFILE%" GOTO error_binfile + +REM fetch DeviceID of Arduino Due Programming Port from WMI Service +FOR /f "tokens=* skip=1" %%a IN ('wmic PATH Win32_SerialPort Where "Caption LIKE '%%USB%%'" get DeviceID') DO ( + SET COMX=%%a + GOTO exit1 +) + +REM Arduino Due Programming Port not exist +GOTO error_comport + +:exit1 + +REM remove blank +SET COMPORT=%COMX: =% + +REM report in Atmel Studio 6.0 IDE output window +ECHO BossacPath=%BOSSACPATH% +ECHO BinFile=%BINFILE% +ECHO Arduino Due Programming Port is detected as %COMPORT%. + +REM The bossac bootloader only runs if the memory on Arduino Due is erased. +REM The Arduino IDE does this by opening and closing the COM port at 1200 baud. +REM This causes the Due to execute a soft erase command. +ECHO Forcing reset using 1200bps open/close on port +ECHO MODE %COMPORT%:1200,N,8,1 +MODE %COMPORT%:1200,N,8,1 + +REM Wait X second for memory on Arduino Due is erased. +ECHO Wait for memory on Arduino Due is erased... +PING -n %WAIT_ERASED% 127.0.0.1>NUL + +REM Execute bossac.exe +ECHO Execute bossac with command line: +ECHO "%BOSSACPATH%" -i -d --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R +START /WAIT "" "%BOSSACPATH%" -i --port=%COMPORT% -U false -e -w -v -b "%BINFILE%" -R + +GOTO end + +:error_args +ECHO Error: wrong number of command line arguments passed! +GOTO end + +:error_arg1 +ECHO Error: command line argument 1 - path to bossac.exe not exist! - "C:\Program Files (x86)\arduino-1.5.2\hardware\tools\bossac.exe" +ECHO Error: command line argument 1 - argument passed = %1 +GOTO end + +:error_arg2 +ECHO Error: command line argument 2 - path to bin file not exist! - use $(OutputDirectory)\$(OutputFileName).bin +ECHO Error: command line argument 2 - argument passed = %1 +GOTO end + +:error_binfile +ECHO Error: bin file "%BINFILE%" not exist! +GOTO end + +:error_comport +ECHO Error: Arduino Due Programming Port not found! + +:end + +ECHO ======================== Done ======================== \ No newline at end of file diff --git a/lighthub/utils.cpp b/lighthub/utils.cpp index 43f61d1..4285c5d 100644 --- a/lighthub/utils.cpp +++ b/lighthub/utils.cpp @@ -422,9 +422,9 @@ String toString(const IPAddress& address){ void printIPAddress(IPAddress ipAddress) { for (byte i = 0; i < 4; i++) #ifdef WITH_PRINTEX_LIB - (i < 3) ? debugSerial << (ipAddress[i]) << F(".") : infoSerial << (ipAddress[i])<