remove all logic but detecting end race, adjust tolerance, increase timmings to be on safe side, uncomment debug tooltips

This commit is contained in:
Bartek Dobrowolski-Nowakowski
2022-05-06 09:50:39 +02:00
parent 74581278bd
commit 00a09da3c3
5 changed files with 15 additions and 147 deletions

View File

@@ -36,27 +36,28 @@ race_start_delay := 0
MenuDirect := "Right"
Menu_loops := 6
menu_s := 1
Global color_check1 := 0xBBE044
color_check2 := 0xBBE044
Global color_check1 := 0x3A1651
color_check2 := 0x3A1651
color_2_delay := 400
Global box_size := 2
Global tolerance := 20
Global tolerance := 4 ; was 20
; resolution parameters and pixel search locations
ps_win_width := 640
ps_win_height := 360
Global pix1x := 458
Global pix1y := 114
Global pix1x := 410
; just for reference: remote_play_offsetY := 71
Global pix1y := 351
Global pix2x := 607
Global pix2y := 319
bm_delay := 100
box_size := 2
Global ps_load_time1 := 12000
Global ps_load_time2 := 8000
Global ps_load_time3 := 8400
Global ps_load_time1 := 14000
Global ps_load_time2 := 10000
Global ps_load_time3 := 10400
Global SysCheck := 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -404,9 +405,9 @@ return
PSystem:
Gui, Submit, NoHide
if (SysCheck = 1){
ps_load_time1 := 12000
ps_load_time2 := 8000
ps_load_time3 := 8400
ps_load_time1 := 14000
ps_load_time2 := 10000
ps_load_time3 := 10400
}
if (SysCheck = 2){
ps_load_time1 := 44000

View File

@@ -43,7 +43,7 @@ ChampionshipMenu:
CheckForOilChange := Mod(A_Index, 87)
CheckForMaintenance := Mod(A_Index, 257)
;ToolTipper("CheckForOilChange " CheckForOilChange "`nCheckForMaintenance " CheckForMaintenance, 300, 100)
ToolTipper("CheckForOilChange " CheckForOilChange "`nCheckForMaintenance " CheckForMaintenance, 300, 100)
ifEqual, CheckForOilChange, 0
{

View File

@@ -22,7 +22,7 @@ NormalMenu:
sleep, %bm_delay%
}
;ToolTip, Found color 2, 100, 100, Screen
ToolTip, Found color 2, 100, 100, Screen
Sleep, 200
controller.Dpad.SetState("Right")
Sleep, 100

View File

@@ -50,139 +50,6 @@ Race_PANAM()
Sleep (race_start_delay)
controller.Axes.LX.SetState(62) /* before turn 1, to avoid queue of cars */
Loop {
; Turn 1
; Tooltip
turn_one_end_found := false
if (CheckTurn(turn1.startX, turn1.startY, 3100))
{
turn_one_end_found := true
ToolTipper("Turn 1 start found")
/*
if( A_Index != 1){
Nitrous_Off()
Accel_On(75)
}
*/
controller.Axes.LX.SetState(18-3*%A_Index%)
}
;Sleep(500)
Accel_On(100)
turn_one_end_found := false
; turn_one_end_found := true ; debug TODO check if wheels are curved
if (CheckTurn(turn1.endX, turn1.endY, 2300))
{
turn_one_end_found := true
ToolTipper("Turn 1 end found")
Nitrous_On()
controller.Axes.LX.SetState(75)
}
sleep(2000)
if (turn_one_end_found)
{
controller.Axes.LX.SetState(65)
}
sleep(2500)
if (turn_one_end_found)
{
controller.Axes.LX.SetState(62)
}
sleep(2000)
turn_two_start_found := false
; Turn 2
if( A_Index = 1 || A_Index = 6){
if (CheckTurn(turn2.startX, turn2.startY, 3900))
{
turn_two_start_found := true
}
}
else{
if (CheckTurn(545, turn2.startY)) {
turn_two_start_found := true
}
}
if (turn_two_start_found)
{
ToolTipper("Turn 2 start found")
controller.Axes.LX.SetState(18.3)
}
turn_two_end_found := false
; turn_two_end_found := true ; debug TODO check if wheels are curved
if (CheckTurn(turn2.endX, turn2.endY, 2500))
{
turn_two_end_found := true
ToolTipper("Turn 2 end found")
controller.Axes.LX.SetState(50)
}
if( A_Index = 1 || A_Index = 6){
if (turn_two_end_found)
{
controller.Axes.LX.SetState(75)
}
sleep(2000)
if (turn_two_end_found)
{
controller.Axes.LX.SetState(65)
}
sleep(500)
}
else{
if (turn_two_end_found)
{
Turn_Left(500, 28)
}
}
; Turn 3
if (CheckTurn(turn3.startX, turn3.startY))
{
Nitrous_Off()
ToolTipper("Turn 3 start found")
controller.Axes.LX.SetState(12)
}
turn_three_end_found := false
; turn_three_end_found := true ; debug TODO check if wheels are curved
if (CheckTurn(turn3.endX, turn3.endY))
{
turn_three_end_found := true
Nitrous_On()
ToolTipper("Turn 3 end found")
controller.Axes.LX.SetState(42)
}
sleep(500)
if (turn_three_end_found)
{
controller.Axes.LX.SetState(58)
}
sleep(2000)
if (turn_three_end_found)
{
controller.Axes.LX.SetState(62)
}
sleep(2000)
CheckTurn(lap_marker.startX, lap_marker.startY)
ToolTipper("Lap Complete")
sleep(4000)
} until A_TickCount > t_racefinishtime
controller.Axes.LX.SetState(50)
; ToolTip, Out of Loop, 100, 100, screen
loop {
;ToolTip, Racing, 100, 100, Screen
break_point := false
@@ -190,7 +57,7 @@ Race_PANAM()
for i, c in c1
{
d1 := Distance(c, color_check1)
;ToolTipper( d1 " " pix1y+remote_play_offsetY " " pix1x " " c)
ToolTipper( d1 " " pix1y+remote_play_offsetY " " pix1x " " c)
if (d1 < tolerance ){
break_point := true
break