added an empty telemetry field, will be usefull for developemnt
This commit is contained in:
@@ -8,4 +8,5 @@ var internalToSDKFieldNames = map[telemetry.FieldID]string{
|
|||||||
telemetry.Speed: "Speed",
|
telemetry.Speed: "Speed",
|
||||||
telemetry.Gear: "Gear",
|
telemetry.Gear: "Gear",
|
||||||
telemetry.RPM: "RPM",
|
telemetry.RPM: "RPM",
|
||||||
|
telemetry.Empty: "empty",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ func (i *IRacing) readData() {
|
|||||||
// Read binded data
|
// Read binded data
|
||||||
for _, b := range i.data.ActiveBinds {
|
for _, b := range i.data.ActiveBinds {
|
||||||
v := i.SDK.Vars.Vars[b.Key].Value
|
v := i.SDK.Vars.Vars[b.Key].Value
|
||||||
// NOTE: for the love of god, find a way of avoiding this shit
|
|
||||||
b.Transform(v, &i.data.Values[b.ID])
|
b.Transform(v, &i.data.Values[b.ID])
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,6 +176,11 @@ func (i *IRacing) Subscribe(requestFields map[int16]telem.FieldID) {
|
|||||||
out.Type = telem.DataTypeUINT16
|
out.Type = telem.DataTypeUINT16
|
||||||
out.Raw = uint64(uint16(v.(float32)))
|
out.Raw = uint64(uint16(v.(float32)))
|
||||||
}
|
}
|
||||||
|
case telem.Empty:
|
||||||
|
binding.Transform = func(v any, out *telem.TelemetryField) {
|
||||||
|
out.Type = telem.DataTypeCHAR
|
||||||
|
out.Raw = uint64('-')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
i.data.Values[id].ID = winID
|
i.data.Values[id].ID = winID
|
||||||
|
|||||||
+3
-1
@@ -120,6 +120,7 @@ const (
|
|||||||
Speed FieldID = iota
|
Speed FieldID = iota
|
||||||
RPM
|
RPM
|
||||||
Gear
|
Gear
|
||||||
|
Empty
|
||||||
MaxFields
|
MaxFields
|
||||||
)
|
)
|
||||||
const FirstField = Speed
|
const FirstField = Speed
|
||||||
@@ -128,11 +129,12 @@ var FieldNames = [MaxFields]string{
|
|||||||
Speed: "Speed",
|
Speed: "Speed",
|
||||||
RPM: "RPM",
|
RPM: "RPM",
|
||||||
Gear: "Gear",
|
Gear: "Gear",
|
||||||
|
Empty: "Emtpy",
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFieldName(id FieldID) string {
|
func GetFieldName(id FieldID) string {
|
||||||
if id >= MaxFields {
|
if id >= MaxFields {
|
||||||
return "Uknown"
|
return "Unknown"
|
||||||
}
|
}
|
||||||
|
|
||||||
return FieldNames[id]
|
return FieldNames[id]
|
||||||
|
|||||||
Reference in New Issue
Block a user