Move wait-for-reconnection logic inside ard-reset-arduino

When a Leonardo based board is reset, the port disappears and we need to
wait till it comes back.

Earlier this logic was handled by a separate shell script. Now the logic
is moved inside the ard-reset-arduino perl script. This is done to
reduce the number of binaries that are needed by the makefile.

Fix #95
This commit is contained in:
Sudar 2013-07-02 08:41:19 +05:30
parent 8a2e251e95
commit 5abf12bdb2
4 changed files with 13 additions and 26 deletions

View file

@ -12,6 +12,7 @@ The following is the rough list of changes that went into different versions. I
- Remove redundant checks for ARDUINO_DIR - Remove redundant checks for ARDUINO_DIR
- Improve avrdude and avrdude.conf path auto detection. Fix issue #48 - Improve avrdude and avrdude.conf path auto detection. Fix issue #48
- Move binary sketch size verification logic inside makefile. Fix issue #54 - Move binary sketch size verification logic inside makefile. Fix issue #54
- Remove dependency on wait-connection-leonardo shell script. Fix issue #95
### 0.12.0 (2013-06-20) ### 0.12.0 (2013-06-20)
- Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman) - Fix "generated_assembly" target, which got broken earlier. Fix issue #76 (https://github.com/matthijskooijman)

View file

@ -468,15 +468,6 @@ ifndef RESET_CMD
endif endif
endif endif
ifndef WAIT_CONNECTION_CMD
ifdef LEO_RESET
WAIT_CONNECTION_CMD = \
$(ARDMK_PATH)/wait-connection-leonardo $(call get_arduino_port)
else
WAIT_CONNECTION_CMD =
endif
endif
ifeq ($(BOARD_TAG),leonardo) ifeq ($(BOARD_TAG),leonardo)
ERROR_ON_LEONARDO = $(error On leonardo, raw_xxx operation is not supported) ERROR_ON_LEONARDO = $(error On leonardo, raw_xxx operation is not supported)
else else
@ -1024,7 +1015,6 @@ raw_eeprom: $(TARGET_HEX) verify_size
reset: reset:
$(call arduino_output,Resetting Arduino...) $(call arduino_output,Resetting Arduino...)
$(RESET_CMD) $(RESET_CMD)
$(WAIT_CONNECTION_CMD)
# stty on MacOS likes -F, but on Debian it likes -f redirecting # stty on MacOS likes -F, but on Debian it likes -f redirecting
# stdin/out appears to work but generates a spurious error on MacOS at # stdin/out appears to work but generates a spurious error on MacOS at

View file

@ -39,7 +39,18 @@ foreach my $dev (@ARGV)
$p->write_settings; $p->write_settings;
$p->close; $p->close;
print STDERR "Switching to 1200 baud on $dev\n" print STDERR "Forcing reset using 1200bps open/close on port $dev\n"
if $Opt{verbose};
# wait for it to come back
sleep 1;
while( ! -e $dev ) {
print STDERR "Waiting for $dev to come back\n"
if $Opt{verbose};
sleep 1;
}
print STDERR "$dev has come back after reset\n"
if $Opt{verbose}; if $Opt{verbose};
} }
else else

View file

@ -1,15 +0,0 @@
#!/bin/bash
while [ ! -e $1 ]
do
echo Waiting connection at $1
sleep 0.2
done
sleep 1
# necessary for me...
# /dev/ttyACM0 used to disappear after the reset
# but no longer now. How can I tell whether the
# connection is ready?
echo Connection Established