@@ -416,9 +416,9 @@ ! Turn on CTS handshaking. HSReset 0 1 0 0 0 0 ! -ifANSWER 71 -pause 30 -@LABEL 71 +!ifANSWER 71 -- There is no reason for this three second pause. +!pause 30 -- It is (literally) a waste of time +!@LABEL 71 exit 0 ! ! @@ -446,8 +446,20 @@ ! Escape from data to command mode matchclr matchstr 1 96 "OK\13\10" +! As per Hayes AT command specifications, there must be at least a +! one second pause before and after the +++ sequence for it to be +! recognised as a valid attention sequence (otherwise an accidental +! run of three plus signs in normal data could make the modem hang up). +! Hence we have an explicit 1.2 second pause before sending '+++'. +! There is no need for an explicit pause after the '+++', because we +! simply go into the matchread call and wait (without sending any more +! characters) until the modem generates an "OK" response. +note "Disconnecting..." 3 +pause 12 write "+++" matchread 20 +! If we get to here, it is because the modem did not respond to our '+++'. +! We'll still try the ATH command, because it might work anyway. ! @LABEL 94 ! Force a hangup @@ -459,26 +471,28 @@ write "ATH\13" matchread 30 ! +! Try the hangup sequence three times otherwise declare and error +inctries +iftries 3 101 +! ! Try to get control of the modem by toggling DTR DTRClear pause 5 DTRSet flush -! -! Try the hangup sequence three times otherwise declare and error -inctries -iftries 3 101 +note "Disconnect failed. Trying again..." 3 jump 92 ! @LABEL 96 ! Pause between data and command mode -pause 50 +!pause 50 -- There is no reason for this five second pause. It is (literally) a waste of time jump 94 ! ! @LABEL 98 ! Recall the factory settings -pause 15 +!pause 15 -- The radio is already in command mode. It is ready and waiting forthe +! next command. This pause is superfluous and (literally) just a waste of time. matchclr matchstr 1 99 "OK\13\10" write "AT&F\13"