[Flashforth-devel] TeraTerm Macro for Upload to FF
Brought to you by:
oh2aun
|
From: om1zz <om...@vo...> - 2015-05-18 18:52:20
|
This is a quick hack for TerTerm - Upload to FF, while waiting on OK (sync) and interrupting the upload when FF sends ?? (currently only ?). The serial settings comes from the active TT session.
Tried at 921k, it works, but not fully tested, as I do not have OK at end of each line from FF, so it waits 500ms and continues.
With OK it will immediately follow with the next line.
The FF decides when it sends the OK upon receive of the line - that establishes the syncing with Terminal.
During a normal TT session click on Control>Macro, select this Macro (save below source to ie. file "FFupload.ttl"), select file to upload and select if you want to skip empty lines.
; TeraTerm Macro Script for FlashForth Upload
; Serial is set within the active TT session
; Opens a file, reads each line, and sends the line to FF
; while waiting on "OK" or "??" after the \r\n sent
; IgorM 5/2015
:Main
Yes = 1 ; for YesNoBox result
No = 0 ; for YesNoBox result
BlankLine = 0
call OpenFile
call ReadFile
call CloseFile
END
:OpenFile
FileNameBox 'Choose the file to upload'
FileChosen = result
if FileChosen = Yes then
FileOpen fhandle inputstr 0
else
end
endif
RETURN
:ReadFile
YesNoBox 'Do you want to skip blank lines?' 'Skip blanks?'
SkipBlanks = result
while 1
; Read a line from the file..
filereadln fhandle line
EndOfFile = result
if EndOfFile = Yes then
break
endif
StrLen line
LineLen = result
if SkipBlanks = Yes then
if LineLen = BlankLine then
continue
endif
endif
sendln line
timeout = 0 ; 0 secs
mtimeout = 300 ; 300msecs
wait "OK" "??" ; wait on OK or error
;if result = 0 break ; timeout, currently it simply timeouts
;if result = 1 goto ok ; OK detected - sync
if result = 2 break ; exit if ?? from FF
; Repeat until the end of the file.
endwhile
RETURN
:CloseFile
FileClose fhandle
RETURN
;-----------------------------------------------------------
I.
|