Formatting of the previous commit
This commit is contained in:
@@ -57,25 +57,25 @@ func msToKph(v float32) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Open the data source file
|
// Open the data source file
|
||||||
file, err := os.Open("/path/to/ibtFile")
|
file, err := os.Open("/path/to/ibtFile")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to open IBT file: %v", err)
|
log.Fatalf("Failed to open IBT file: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate our iRacing SDK instance
|
// Instantiate our iRacing SDK instance
|
||||||
irsdk, err := goirsdk.Init(file, "", "")
|
irsdk, err := goirsdk.Init(file, "", "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to create iRacing interface: %v", err)
|
log.Fatalf("Failed to create iRacing interface: %v", err)
|
||||||
}
|
}
|
||||||
defer irsdk.Close()
|
defer irsdk.Close()
|
||||||
|
|
||||||
// Set up a loop to iterate our data
|
// Set up a loop to iterate our data
|
||||||
mainLoopTicker := time.NewTicker(time.Second / 60)
|
mainLoopTicker := time.NewTicker(time.Second / 60)
|
||||||
defer mainLoopTicker.Stop()
|
defer mainLoopTicker.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
// Update the data that the SDK is holding with the next tick
|
// Update the data that the SDK is holding with the next tick
|
||||||
_, err := irsdk.Update(100 * time.Millisecond)
|
_, err := irsdk.Update(100 * time.Millisecond)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("could not update data: %v", err)
|
log.Printf("could not update data: %v", err)
|
||||||
@@ -83,8 +83,8 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Vehicle Movement data gathered from the names we can find on the
|
// Vehicle Movement data gathered from the names we can find on the
|
||||||
// telemetry_docs.pdf file
|
// telemetry_docs.pdf file
|
||||||
// - I wish to make this less verbose if possible
|
// - I wish to make this less verbose if possible
|
||||||
if _, ok := irsdk.Vars.Vars["Gear"]; !ok {
|
if _, ok := irsdk.Vars.Vars["Gear"]; !ok {
|
||||||
log.Fatal("Field `Gear` doesn't exist")
|
log.Fatal("Field `Gear` doesn't exist")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,4 +64,3 @@ func main() {
|
|||||||
<-mainLoopTicker.C
|
<-mainLoopTicker.C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user