You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func main() {
sc, err := simconnect.NewEasySimConnect()
if err != nil {
panic(err)
}
go connectToSimVars(sc)
time.Sleep(3 * time.Second)
event := sc.NewSimEvent(simconnect.KeyAutopilotOff)
event.Run()
for {
fmt.Println(sc.IsAlive())
time.Sleep(time.Second * 3)
}
}
func connectToSimVars(sc *simconnect.EasySimConnect) <-chan []simconnect.SimVar {
cSimVar, err := sc.ConnectToSimVar(
simconnect.SimVarPlaneAltitude(),
simconnect.SimVarAutopilotMaster(),
)
if err != nil {
panic(err)
}
for {
result := <-cSimVar
fmt.Println(result)
}
}
after i run this program i get updated sim data few time every second. After i send event to sc loop in connectToSimVars() stops. But i still get info that sc is alive (last loop)
The text was updated successfully, but these errors were encountered:
Not sure if this is related but event.Run() returns a <-chan int32 that triggers when the event finishes. You are not reading from that channel so maybe the code is getting stuck somewhere? Have you tried to run <-event.Run() ? Its working fine for me.
Is someone is able to help me?
after i run this program i get updated sim data few time every second. After i send event to sc loop in connectToSimVars() stops. But i still get info that sc is alive (last loop)
The text was updated successfully, but these errors were encountered: