From 0b588e82edfa9d47afcd6bee2763221eded068ef Mon Sep 17 00:00:00 2001 From: Benjamin Faershtein <119711889+RCGV1@users.noreply.github.com> Date: Thu, 17 Jul 2025 13:16:02 -0700 Subject: [PATCH] fix ambient light --- .../Settings/Config/Module/AmbientLightingConfig.swift | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift b/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift index ad3e5e3c..a02dd0ad 100644 --- a/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift +++ b/Meshtastic/Views/Settings/Config/Module/AmbientLightingConfig.swift @@ -19,10 +19,7 @@ struct AmbientLightingConfig: View { @State private var isPresentingSaveConfirm: Bool = false @State var hasChanges = false @State var ledState: Bool = false - @State var current = 10 - @State var red = 0 - @State var green = 0 - @State var blue = 0 + @State var current = 0 @State private var color = Color(red: 51, green: 199, blue: 88) // Color(.sRGB, red: 0.98, green: 0.9, blue: 0.2) @State private var components: Color.Resolved? var body: some View { @@ -60,6 +57,7 @@ struct AmbientLightingConfig: View { var al = ModuleConfig.AmbientLightingConfig() al.ledState = ledState al.current = UInt32(current) + components = color.resolve(in: environment) if let components { al.red = UInt32(components.red * 255) al.green = UInt32(components.green * 255) @@ -119,7 +117,7 @@ struct AmbientLightingConfig: View { } func setAmbientLightingConfigValue() { self.ledState = node?.ambientLightingConfig?.ledState ?? false - self.current = Int(node?.ambientLightingConfig?.current ?? 10) + self.current = Int(node?.ambientLightingConfig?.current ?? 0) let red = Double(node?.ambientLightingConfig?.red ?? 255) let green = Double(node?.ambientLightingConfig?.green ?? 255) let blue = Double(node?.ambientLightingConfig?.blue ?? 255)