File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed
Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 5353
5454# try an find a serial port automatically if one is not passsed in.
5555if [ -z " $port " ]
56- echo " Auto detecting serial port"
5756then port=$( ls /dev/tty.* | grep usb)
57+ echo " Auto detecting serial port"
5858fi
5959if [ -z " $port " ]
60- echo " No usb serial port found. Faking one so we can still compile."
6160then port=" /dev/tty."
61+ echo " No usb serial port found. Faking one so we can still compile."
6262fi
6363
6464# bail out if no serial port found.
7575
7676# echo "Compiling '$pde_file' for board $board on serial port $port"
7777
78+ sketchbook=$( echo $HOME /Documents/Arduino)
79+
7880DIR=" $( cd " $( dirname " $0 " ) " && pwd ) "
7981java \
8082 -Djava.library.path=/Applications/Arduino.app/Contents/Resources/Java \
8183 -d32 \
82- -Dfile.encoding=MacRoman \
84+ -Darduino.sketchbook= " $sketchbook " \
8385 -Djava.awt.headless=true \
8486 -jar " $DIR /vim-arduino-cli.jar" " $switch " " $pde_file " " $port " " $board "
Original file line number Diff line number Diff line change @@ -75,6 +75,14 @@ function! s:CheckFile()
7575 endif
7676endfunction
7777
78+ function ! s: PrintStatus (result)
79+ if a: result == 0
80+ echohl Statement | echomsg " Succeeded." | echohl None
81+ else
82+ echohl WarningMsg | echomsg " Failed." | echohl None
83+ endif
84+ endfunction
85+
7886" Private: Compile or deploy code
7987"
8088" Returns nothing.
@@ -96,14 +104,9 @@ function! s:InvokeArduinoCli(deploy)
96104 \ shellescape (l: f_name )
97105 " echo l:command
98106 let l: result = system (l: command )
99- if v: shell_error == 0
100- echomsg " Done"
101- else
102- echohl WarningMsg
103- echomsg " Compilation Failed"
104- echohl None
105- echo l: result
106- endif
107+ call s: PrintStatus (v: shell_error )
108+ echo l: result
109+ call s: PrintStatus (v: shell_error )
107110 endif
108111
109112endfunction
You can’t perform that action at this time.
0 commit comments