and yet again some more fields

This commit is contained in:
2026-03-15 22:55:11 +00:00
parent e5bd5b8983
commit c512d79d98
5 changed files with 216 additions and 129 deletions
+173 -125
View File
@@ -1,29 +1,5 @@
Windows: Windows:
1: 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: uiwindow:
Dims: Dims:
X0: 331 X0: 331
@@ -45,81 +21,9 @@ Windows:
PreviewValue: "234" PreviewValue: "234"
Title: SPEEDO Title: SPEEDO
uidata: uidata:
WID: 2 WID: 1
TelemetryField: Speed TelemetryField: Speed
3: 2:
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:
uiwindow: uiwindow:
Dims: Dims:
X0: 140 X0: 140
@@ -141,33 +45,9 @@ Windows:
PreviewValue: "6" PreviewValue: "6"
Title: Thr Title: Thr
uidata: uidata:
WID: 6 WID: 2
TelemetryField: Throttle Control TelemetryField: Throttle Control
7: 3:
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:
uiwindow: uiwindow:
Dims: Dims:
X0: 207 X0: 207
@@ -189,5 +69,173 @@ Windows:
PreviewValue: "61.4" PreviewValue: "61.4"
Title: BBias Title: BBias
uidata: uidata:
WID: 8 WID: 3
TelemetryField: BrakeBias 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
+29
View File
@@ -3,8 +3,32 @@ package iracing
import ( import (
telem "esdi/telemetry" telem "esdi/telemetry"
"strconv" "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) { func PitSpeedLimiterTransform(v any, out *telem.TelemetryField) {
out.Type = telem.DataTypeSTRING out.Type = telem.DataTypeSTRING
if v.(bool) { 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) { func FloatToStringTransform(v any, out *telem.TelemetryField) {
out.Type = telem.DataTypeSTRING out.Type = telem.DataTypeSTRING
out.Str = strconv.FormatFloat(float64(v.(float32)), 'f', 1, 32) out.Str = strconv.FormatFloat(float64(v.(float32)), 'f', 1, 32)
+3
View File
@@ -17,6 +17,9 @@ var internalToSDKFieldNames = map[telemetry.FieldID]string{
telemetry.ABSSetting: "dcABS", telemetry.ABSSetting: "dcABS",
telemetry.TCSetting: "dcTractionControl", telemetry.TCSetting: "dcTractionControl",
telemetry.ThrottleSetting: "dcThrottleShape", telemetry.ThrottleSetting: "dcThrottleShape",
// Lap Data
telemetry.LapLastLapTime: "LapLastLapTime",
telemetry.LapNumber: "Lap",
// Tire data // Tire data
telemetry.LFtempL: "LFtempCL", telemetry.LFtempL: "LFtempCL",
telemetry.LFtempM: "LFtempCM", telemetry.LFtempM: "LFtempCM",
+5 -4
View File
@@ -216,10 +216,11 @@ func (i *IRacing) Subscribe(requestFields map[int16]telem.FieldID) {
out.Str = strconv.FormatFloat(v.(float64), 'f', 1, 32) out.Str = strconv.FormatFloat(v.(float64), 'f', 1, 32)
} }
case telem.Empty: case telem.Empty:
binding.Transform = func(v any, out *telem.TelemetryField) { binding.Transform = EmptyTransform
out.Type = telem.DataTypeCHAR case telem.LapLastLapTime:
out.Raw = uint64('-') binding.Transform = LapTimeTransform
} case telem.LapNumber:
binding.Transform = UInt8Transform
} }
i.data.ActiveBinds = append(i.data.ActiveBinds, binding) i.data.ActiveBinds = append(i.data.ActiveBinds, binding)
+6
View File
@@ -135,6 +135,9 @@ const (
ABSSetting ABSSetting
TCSetting TCSetting
ThrottleSetting ThrottleSetting
// Lap Data
LapLastLapTime
LapNumber
// Tire Data // Tire Data
LFtempL LFtempL
LFtempM LFtempM
@@ -167,6 +170,9 @@ var FieldNames = [MaxFields]string{
ABSSetting: "ABS Control", ABSSetting: "ABS Control",
TCSetting: "TC Control", TCSetting: "TC Control",
ThrottleSetting: "Throttle Control", ThrottleSetting: "Throttle Control",
// Lap Data
LapLastLapTime: "Last Lap Time",
LapNumber: "Lap Number",
// Tire Data // Tire Data
LFtempL: "LF Surface Temp Left", LFtempL: "LF Surface Temp Left",
LFtempM: "LF Surface Temp Mid", LFtempM: "LF Surface Temp Mid",