From c512d79d988ce6ae93fe7944c6dc018678601d43 Mon Sep 17 00:00:00 2001 From: Eduardo Silva Date: Sun, 15 Mar 2026 22:55:11 +0000 Subject: [PATCH] and yet again some more fields --- layouts/layout.yaml | 298 +++++++++++++++----------- providers/iracing/commonTransforms.go | 29 +++ providers/iracing/fieldMapping.go | 3 + providers/iracing/iracing.go | 9 +- telemetry/data.go | 6 + 5 files changed, 216 insertions(+), 129 deletions(-) diff --git a/layouts/layout.yaml b/layouts/layout.yaml index e06d812..fe608cc 100755 --- a/layouts/layout.yaml +++ b/layouts/layout.yaml @@ -1,29 +1,5 @@ Windows: 1: - uiwindow: - Dims: - X0: 710 - Y0: 8 - Width: 84 - Height: 57 - Decor: - BGColour: 4161 - FGColour: 65535 - TitleColour: 65535 - BorderColour: 63488 - TitleSize: 2 - TextSize: 4 - HasBorder: 1 - Padding: 0 - Opts: - ShowID: 0 - WinType: 2 - PreviewValue: PIT - Title: Pit Sp - uidata: - WID: 1 - TelemetryField: Pit Speed Limiter - 2: uiwindow: Dims: X0: 331 @@ -45,81 +21,9 @@ Windows: PreviewValue: "234" Title: SPEEDO uidata: - WID: 2 + WID: 1 TelemetryField: Speed - 3: - uiwindow: - Dims: - X0: 354 - Y0: 71 - Width: 74 - Height: 111 - Decor: - BGColour: 4161 - FGColour: 65535 - TitleColour: 65535 - BorderColour: 63488 - TitleSize: 2 - TextSize: 12 - HasBorder: 1 - Padding: 0 - Opts: - ShowID: 0 - WinType: 2 - PreviewValue: R - Title: Box - uidata: - WID: 3 - TelemetryField: Gear - 4: - uiwindow: - Dims: - X0: 9 - Y0: 413 - Width: 57 - Height: 57 - Decor: - BGColour: 4161 - FGColour: 65535 - TitleColour: 65535 - BorderColour: 63488 - TitleSize: 2 - TextSize: 4 - HasBorder: 1 - Padding: 0 - Opts: - ShowID: 0 - WinType: 2 - PreviewValue: "12" - Title: ABS - uidata: - WID: 4 - TelemetryField: ABS Control - 5: - uiwindow: - Dims: - X0: 74 - Y0: 413 - Width: 57 - Height: 57 - Decor: - BGColour: 4161 - FGColour: 65535 - TitleColour: 65535 - BorderColour: 63488 - TitleSize: 2 - TextSize: 4 - HasBorder: 1 - Padding: 0 - Opts: - ShowID: 0 - WinType: 2 - PreviewValue: "12" - Title: TC - uidata: - WID: 5 - TelemetryField: TC Control - 6: + 2: uiwindow: Dims: X0: 140 @@ -141,33 +45,9 @@ Windows: PreviewValue: "6" Title: Thr uidata: - WID: 6 + WID: 2 TelemetryField: Throttle Control - 7: - uiwindow: - Dims: - X0: 142 - Y0: 19 - Width: 500 - Height: 20 - Decor: - BGColour: 4161 - FGColour: 65535 - TitleColour: 65535 - BorderColour: 63488 - TitleSize: 1 - TextSize: 2 - HasBorder: 1 - Padding: 0 - Opts: - ShowID: 0 - WinType: 1 - PreviewValue: "5678" - Title: TACHO - uidata: - WID: 7 - TelemetryField: RPM - 8: + 3: uiwindow: Dims: X0: 207 @@ -189,5 +69,173 @@ Windows: PreviewValue: "61.4" Title: BBias uidata: - WID: 8 + WID: 3 TelemetryField: BrakeBias + 4: + uiwindow: + Dims: + X0: 354 + Y0: 71 + Width: 74 + Height: 111 + Decor: + BGColour: 4161 + FGColour: 65535 + TitleColour: 65535 + BorderColour: 63488 + TitleSize: 2 + TextSize: 12 + HasBorder: 1 + Padding: 0 + Opts: + ShowID: 0 + WinType: 2 + PreviewValue: R + Title: Box + uidata: + WID: 4 + TelemetryField: Gear + 5: + uiwindow: + Dims: + X0: 142 + Y0: 19 + Width: 500 + Height: 20 + Decor: + BGColour: 4161 + FGColour: 65535 + TitleColour: 65535 + BorderColour: 63488 + TitleSize: 1 + TextSize: 2 + HasBorder: 1 + Padding: 0 + Opts: + ShowID: 0 + WinType: 1 + PreviewValue: "5678" + Title: TACHO + uidata: + WID: 5 + TelemetryField: RPM + 6: + uiwindow: + Dims: + X0: 60 + Y0: 91 + Width: 85 + Height: 57 + Decor: + BGColour: 4161 + FGColour: 65535 + TitleColour: 65535 + BorderColour: 63488 + TitleSize: 2 + TextSize: 4 + HasBorder: 1 + Padding: 0 + Opts: + ShowID: 0 + WinType: 2 + PreviewValue: "123" + Title: Lap + uidata: + WID: 6 + TelemetryField: Lap Number + 7: + uiwindow: + Dims: + X0: 74 + Y0: 413 + Width: 57 + Height: 57 + Decor: + BGColour: 4161 + FGColour: 65535 + TitleColour: 65535 + BorderColour: 63488 + TitleSize: 2 + TextSize: 4 + HasBorder: 1 + Padding: 0 + Opts: + ShowID: 0 + WinType: 2 + PreviewValue: "12" + Title: TC + uidata: + WID: 7 + TelemetryField: TC Control + 8: + uiwindow: + Dims: + X0: 60 + Y0: 155 + Width: 226 + Height: 57 + Decor: + BGColour: 4161 + FGColour: 65535 + TitleColour: 65535 + BorderColour: 63488 + TitleSize: 2 + TextSize: 4 + HasBorder: 1 + Padding: 0 + Opts: + ShowID: 0 + WinType: 2 + PreviewValue: "06:45.123" + Title: Last Lap + uidata: + WID: 8 + TelemetryField: Last Lap Time + 9: + uiwindow: + Dims: + X0: 9 + Y0: 413 + Width: 57 + Height: 57 + Decor: + BGColour: 4161 + FGColour: 65535 + TitleColour: 65535 + BorderColour: 63488 + TitleSize: 2 + TextSize: 4 + HasBorder: 1 + Padding: 0 + Opts: + ShowID: 0 + WinType: 2 + PreviewValue: "12" + Title: ABS + uidata: + WID: 9 + TelemetryField: ABS Control + 10: + uiwindow: + Dims: + X0: 710 + Y0: 8 + Width: 84 + Height: 57 + Decor: + BGColour: 4161 + FGColour: 65535 + TitleColour: 65535 + BorderColour: 63488 + TitleSize: 2 + TextSize: 4 + HasBorder: 1 + Padding: 0 + Opts: + ShowID: 0 + WinType: 2 + PreviewValue: PIT + Title: Pit Sp + uidata: + WID: 10 + TelemetryField: Pit Speed Limiter diff --git a/providers/iracing/commonTransforms.go b/providers/iracing/commonTransforms.go index 098dcdf..eb1cf32 100644 --- a/providers/iracing/commonTransforms.go +++ b/providers/iracing/commonTransforms.go @@ -3,8 +3,32 @@ package iracing import ( telem "esdi/telemetry" "strconv" + "time" ) +const ( + LapTimeFormatStr = "04:05.000" +) + +func LapTimeTransform(v any, out *telem.TelemetryField) { + lapTimeInSeconds := v.(float32) + + if lapTimeInSeconds < 0 { + lapTimeInSeconds = 0 + } + + wholeSeconds := int64(lapTimeInSeconds) + lapTime := time.Unix(wholeSeconds, int64((lapTimeInSeconds-float32(wholeSeconds))*1e9)) + + out.Type = telem.DataTypeSTRING + out.Str = lapTime.Format(LapTimeFormatStr) +} + +func EmptyTransform(v any, out *telem.TelemetryField) { + out.Type = telem.DataTypeCHAR + out.Raw = uint64('-') +} + func PitSpeedLimiterTransform(v any, out *telem.TelemetryField) { out.Type = telem.DataTypeSTRING if v.(bool) { @@ -14,6 +38,11 @@ func PitSpeedLimiterTransform(v any, out *telem.TelemetryField) { } } +func UInt8Transform(v any, out *telem.TelemetryField) { + out.Type = telem.DataTypeUINT8 + out.Raw = uint64(v.(int)) +} + func FloatToStringTransform(v any, out *telem.TelemetryField) { out.Type = telem.DataTypeSTRING out.Str = strconv.FormatFloat(float64(v.(float32)), 'f', 1, 32) diff --git a/providers/iracing/fieldMapping.go b/providers/iracing/fieldMapping.go index e1eb44e..48414b5 100644 --- a/providers/iracing/fieldMapping.go +++ b/providers/iracing/fieldMapping.go @@ -17,6 +17,9 @@ var internalToSDKFieldNames = map[telemetry.FieldID]string{ telemetry.ABSSetting: "dcABS", telemetry.TCSetting: "dcTractionControl", telemetry.ThrottleSetting: "dcThrottleShape", + // Lap Data + telemetry.LapLastLapTime: "LapLastLapTime", + telemetry.LapNumber: "Lap", // Tire data telemetry.LFtempL: "LFtempCL", telemetry.LFtempM: "LFtempCM", diff --git a/providers/iracing/iracing.go b/providers/iracing/iracing.go index 7cec7d5..8103db0 100644 --- a/providers/iracing/iracing.go +++ b/providers/iracing/iracing.go @@ -216,10 +216,11 @@ func (i *IRacing) Subscribe(requestFields map[int16]telem.FieldID) { out.Str = strconv.FormatFloat(v.(float64), 'f', 1, 32) } case telem.Empty: - binding.Transform = func(v any, out *telem.TelemetryField) { - out.Type = telem.DataTypeCHAR - out.Raw = uint64('-') - } + binding.Transform = EmptyTransform + case telem.LapLastLapTime: + binding.Transform = LapTimeTransform + case telem.LapNumber: + binding.Transform = UInt8Transform } i.data.ActiveBinds = append(i.data.ActiveBinds, binding) diff --git a/telemetry/data.go b/telemetry/data.go index 9c5a321..4c74c91 100644 --- a/telemetry/data.go +++ b/telemetry/data.go @@ -135,6 +135,9 @@ const ( ABSSetting TCSetting ThrottleSetting + // Lap Data + LapLastLapTime + LapNumber // Tire Data LFtempL LFtempM @@ -167,6 +170,9 @@ var FieldNames = [MaxFields]string{ ABSSetting: "ABS Control", TCSetting: "TC Control", ThrottleSetting: "Throttle Control", + // Lap Data + LapLastLapTime: "Last Lap Time", + LapNumber: "Lap Number", // Tire Data LFtempL: "LF Surface Temp Left", LFtempM: "LF Surface Temp Mid",