You are welcome...
Back to Fish...
Fish (Admin) wrote:
Robot Dude wrote:
By removing the firmware version request it works.
Sort of. It runs into problems when trying to leave the GP mode. Since the BAP doesn't get any feedback that the sequence is done, the bot can't be stopped because certain controls are enabled during GP play.
I would have brought that up before, but I kind of... forgot.

I have not used this code much as I am not very good at creating these sequences
It looks to me that once you start a sequence, the code does not return to the main loop, until the sequence is completed. I will try to summarize this. If you look in phoenix_v20.bas a little after the label main: you will see the code:
Code:
;GP Player
IF GPEnable THEN
GOSUB GPPlayer
ENDIF
If you look at GPPlayer
Code:
;--------------------------------------------------------------------
;[GP PLAYER]
GPStatSeq var byte
GPStatFromStep var byte
GPStatToStep var byte
GPStatTime var byte
GPPlayer:
;Start sequence
IF (GPStart=1) THEN
serout cSSC_OUT, cSSC_BAUD, ["PL0SQ", dec GPSeq, "ONCE", 13] ;Start sequence
;Wait for GPPlayer to complete sequence
GPWait:
serout cSSC_OUT, cSSC_BAUD, ["QPL0", 13]
serin cSSC_IN, cSSC_BAUD, [GPStatSeq, GPStatFromStep, GPStatToStep, GPStatTime]
IF (GPStatSeq<>255 | GPStatFromStep<>0 | GPStatToStep<>0 | GPStatTime<>0) THEN
GOTO GPWait ;Continue waiting
ENDIF
GPStart=0
ENDIF
return
To me it looks like it will hang up in this loop until it completes. So you won't have any more input possible from the PS2 or DIY remote... until it completes. To me it looks like it would be easy to change this to allow input to be processed. For example could change the code to look more like:
Code:
;--------------------------------------------------------------------
GPStart var byte; was bit
;[GP PLAYER]
GPStatSeq var byte
GPStatFromStep var byte
GPStatToStep var byte
GPStatTime var byte
GPPlayer:
;Start sequence
IF (GPStart=1) THEN
serout cSSC_OUT, cSSC_BAUD, ["PL0SQ", dec GPSeq, "ONCE", 13] ;Start sequence
GPStart=2 ; set the state to do query...
ELSEIF (GPStart=2)
;See if GPPlayer has completed sequence
serout cSSC_OUT, cSSC_BAUD, ["QPL0", 13]
serin cSSC_IN, cSSC_BAUD, [GPStatSeq, GPStatFromStep, GPStatToStep, GPStatTime]
IF (GPStatSeq=255) and (GPStatFromStep=0) and (GPStatToStep=0) and (GPStatTime=0) THEN
GPStart=0
ENDIF
ELSEIF GPStart=0xff
; user requested us to abort the sequence.
serout cSSC_OUT, cSSC_BAUD, ["PL0", 13] ;Stop the sequence now
GPStart = 0
ENDIF
return
Now in the main code might change it like:
Code:
;GP Player
IF GPEnable THEN
GOSUB GPPlayer
IF GPStart <> 0 THEN Main
ENDIF
I would also probably change the PS2 code that processed the button to start the sequence to maybe something like:
Code:
IF (DualShock(2).bit1 = 0) and LastButton(1).bit1 THEN ;R2 Button test
IF GPStart = 0 THEN ; See if we are running a sequence
GPStart=1 ; Nope then try to start it.
ELSE
GPStart = 0xff ; Yes - cancel it.
ENDIF
ENDIF
Now I did this on the fly here so there are probably some major problems here. Probably should run it by Xan and move to different thread...
Kurt