automatic setup for devices

Its not close to being done and still need to work out the flows due to
who arrives first: telemetry or the peripheral?
This commit is contained in:
2026-09-21 15:27:42 +01:00
parent 6ff4cc3014
commit b364931c80
8 changed files with 134 additions and 15 deletions
+22 -1
View File
@@ -11,6 +11,7 @@ import (
"sync"
"time"
"esdi/constants"
helper "esdi/helpers"
"esdi/peripheral"
"esdi/peripheral/communication"
@@ -438,7 +439,7 @@ func (d *CDashDisplay) SendData(data *telemetry.TelemetryData) error {
return nil
}
func (cds *CDashDisplay) Setup() error {
func (cds *CDashDisplay) setupForIracing() error {
err := cds.LoadLayout("layout.yaml")
if err != nil {
return err
@@ -446,3 +447,23 @@ func (cds *CDashDisplay) Setup() error {
return nil
}
func (cds *CDashDisplay) setupForBeamNG() error {
err := cds.LoadLayout("beamng.yaml")
if err != nil {
return err
}
return nil
}
func (cds *CDashDisplay) Setup(provider string) error {
switch provider {
case constants.IRacingProviderName:
return cds.setupForIracing()
case constants.BeamNGProviderName:
return cds.setupForBeamNG()
default:
return fmt.Errorf("unknown provider: %s", provider)
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ func (uid *UIDevice) Close() error {
return nil
}
func (uid *UIDevice) Setup() error {
func (uid *UIDevice) Setup(provider string) error {
return nil
}