Purpose:
Using a PIC to read my encoded steering wheel buttons and output results through a serial port. AutoIT script reads serial port and performs RR commands.
Problem:
It works great as long as I don't use hibernate. When it comes out from hibernate the AutoIT script cannot communicate with RR. I tried exiting the AutoIT script and re-running the script the same problem exists. The only way to communicate with RR again is to exit RR and reload RR, or perform a cold boot.
Question:
Is there anything missing from the AutoIT script so it can communicate with RR after hibernation? Or would it be better to convert this to visual basic 6 extension to avoid the hibernation bug?
PHP Code:
; serial port setup
$MsComm1 = ObjCreate("MSCOMMLib.MsComm.1")
$MsComm1.CommPort = 4
$MsComm1.Settings = "9600,N,8,1"
$MsComm1.Handshaking = 0
$MsComm1.InBufferSize = 1024
$MsComm1.InputLen = 1
$MsComm1.PortOpen = 1
$rr = ObjCreate("RoadRunner.sdk") ; Open COM with RR
_SerialOut("z") ; initialize serial port and wake up PIC
While 1
$message = _SerialIn()
$result=StringStripWS($message,8) ; removes white space CR LF
If StringCompare($result,"MUTE") == 0 Then
$rr.Execute("PLAY")
ElseIf StringCompare($result,"FM/AM") == 0 Then
$rr.Execute("PREV2")
ElseIf StringCompare($result,"VOL-") == 0 Then
$rr.Execute("VOL-")
ElseIf StringCompare($result,"VOL+") == 0 Then
$rr.Execute("VOL+")
ElseIf StringCompare($result,"AUTOM") == 0 Then
$rr.Execute("NEXT")
ElseIf StringCompare($result,"MCAL") == 0 Then
$rr.Execute("PREV")
EndIf
WEnd
Func _SerialOut($str) ; Write to serial port function
$MsComm1.OutBufferCount = 0
$MsComm1.InBufferCount = 0
If $MsComm1.PortOpen = True Then
$MsComm1.Output = $str
EndIf
$MsComm1.InputLen = 0
EndFunc
Func _SerialIn() ; Read from serial port function
If $MsComm1.InBufferSize > 1 Then
Return $MsComm1.Input
Endif
EndFunc
Bookmarks