Skip to content

Commit b6dbe14

Browse files
committed
Fix up how serial ports are detected
1 parent dc6f427 commit b6dbe14

File tree

3 files changed

+16
-11
lines changed

3 files changed

+16
-11
lines changed

plugin/vim-arduino

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ done
5353

5454
# try an find a serial port automatically if one is not passsed in.
5555
if [ -z "$port" ]
56-
echo "Auto detecting serial port"
5756
then port=$(ls /dev/tty.* | grep usb)
57+
echo "Auto detecting serial port"
5858
fi
5959
if [ -z "$port" ]
60-
echo "No usb serial port found. Faking one so we can still compile."
6160
then port="/dev/tty."
61+
echo "No usb serial port found. Faking one so we can still compile."
6262
fi
6363

6464
# bail out if no serial port found.
@@ -75,10 +75,12 @@ fi
7575

7676
# echo "Compiling '$pde_file' for board $board on serial port $port"
7777

78+
sketchbook=$(echo $HOME/Documents/Arduino)
79+
7880
DIR="$( cd "$( dirname "$0" )" && pwd )"
7981
java \
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"

plugin/vim-arduino-cli.jar

-2.18 MB
Binary file not shown.

plugin/vim-arduino.vim

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ function! s:CheckFile()
7575
endif
7676
endfunction
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

109112
endfunction

0 commit comments

Comments
 (0)