reconnects are slightly improved
I don't really like the reset thing with the delay. I need to implement something better later on
This commit is contained in:
@@ -34,6 +34,7 @@ const (
|
||||
sendDataCMDID types.Command = 7
|
||||
newLayoutCMDID types.Command = 8
|
||||
healthCheckCMDID types.Command = 9
|
||||
resetCMDID types.Command = 10
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -404,6 +405,17 @@ func (d *CDashDisplay) UnloadLayout() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (cds *CDashDisplay) reset() error {
|
||||
err := cds.WT.SendCommand(resetCMDID, []byte{0x01, 0x02, 0x03, 0x04}, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
time.Sleep(3000 * time.Millisecond)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (d *CDashDisplay) SendData(data *telemetry.TelemetryData) error {
|
||||
packet := d.encodePacket(data)
|
||||
|
||||
|
||||
@@ -25,6 +25,14 @@ func (cds *CDashDisplay) setupForBeamNG() error {
|
||||
}
|
||||
|
||||
func (cds *CDashDisplay) Setup(provider string) error {
|
||||
// Doesn't matter which one we are picking, we need to reset the CDashDisplay
|
||||
// first - we will improve this setup behaviour later on with an Update to
|
||||
// change it without dropping connection or some shit
|
||||
err := cds.reset()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch provider {
|
||||
case constants.IRacingProviderName:
|
||||
return cds.setupForIracing()
|
||||
|
||||
Reference in New Issue
Block a user