refactor: harden diagnostics and consolidate runtime code

This commit is contained in:
Mikhail Chusavitin
2026-09-01 13:01:28 +03:00
parent ac4bc0b2b7
commit 0a6ca8ba0f
49 changed files with 1441 additions and 837 deletions
+5 -1
View File
@@ -293,6 +293,10 @@ func sampleLiveTempsViaIPMI() []TempReading {
}
func firstTempInputValue(feature map[string]any) (float64, bool) {
return firstSensorInputValue(feature, "temp")
}
func firstSensorInputValue(feature map[string]any, kind string) (float64, bool) {
keys := make([]string, 0, len(feature))
for key := range feature {
keys = append(keys, key)
@@ -300,7 +304,7 @@ func firstTempInputValue(feature map[string]any) (float64, bool) {
sort.Strings(keys)
for _, key := range keys {
lower := strings.ToLower(key)
if !strings.Contains(lower, "temp") || !strings.HasSuffix(lower, "_input") {
if !strings.Contains(lower, kind) || !strings.HasSuffix(lower, "_input") {
continue
}
switch value := feature[key].(type) {