figuring a way of having a clean internal interface for the data and other stuff I reckon. I forgot

This commit is contained in:
2026-03-09 18:03:36 +00:00
parent ac76d482d0
commit ef8f4603d6
11 changed files with 196 additions and 126 deletions
+15
View File
@@ -94,6 +94,7 @@ const (
Gear
MaxFields
)
const FirstField = Speed
var FieldNames = [MaxFields]string{
Speed: "Speed",
@@ -109,6 +110,20 @@ func GetFieldName(id FieldID) string {
return FieldNames[id]
}
var fieldNameToID map[string]FieldID
func initFieldNamesMap() {
fieldNameToID = make(map[string]FieldID, MaxFields)
for id, name := range FieldNames {
fieldNameToID[name] = FieldID(id)
}
}
func GetFieldID(name string) (FieldID, bool) {
id, ok := fieldNameToID[name]
return id, ok
}
// NOTE: Replace values with a more appropriate custom field approach where
// every custom field only takes as many bytes as required
// NOTE: Add the timing fields here to count frames of data gathering and whatnot