From 360ef2e52462110920165c11a130bad093e5e75e Mon Sep 17 00:00:00 2001 From: Alan Dick Date: Sat, 19 Sep 2026 18:53:47 -0400 Subject: [PATCH 1/3] Fix brightness/CCT/color not responding on FS230 and FS150C Both lights' crowd-sourced database entries are missing commandPatterns, so the app fell back to the legacy setLongCCTLightBrightness/ setLongCCTLightCCT (0x82/0x83) command family. That family is acknowledged by the firmware (notify replies look normal) but does not actually drive the LED output on these two models, so the brightness and CCT sliders had no physical effect while power control worked fine. Root cause for the FS150C specifically: its raw model number "20230029" had no entry in getProjectName(_ str:), so its nickname never resolved to "FS150C", which meant getLightType() could never reach its dedicated branch and instead silently fell back to a generic default (lightType 0), which in turn made CCTRange() fall back to the generic 3200-5600K range instead of the FS150C's real 2500-7500K. Changes: - getProjectName(_ str:): map "20230029" to "FS150C" so the light is correctly identified (NeewerLightConstant.swift). - CCTRange(ligthType:projectName:): add the FS150C's real 2500-7500K range instead of falling back to the generic 3200-5600K default (NeewerLightConstant.swift). - builtInCommandPatterns(lightType:): new fallback consulted by findCommandPatternFromDB() after the live database and temporaryCommandPatterns, so it survives a database.json re-sync. Provides power/cct patterns for FS230 (type 53) and FS150C (type 75), and an hsi (color) pattern for the FS150C, which is a true RGB light per its product listing (the FS230's database entry explicitly marks it as non-RGB). The cct/power patterns were physically confirmed against real hardware; the hsi pattern is copied verbatim from every other RGB-capable light in the same tag family sharing this exact cct pattern shape (identical hsi pattern across all of them, so it should generalize), and was also confirmed working on the FS150C. - getCCTOnlyLightCommand(): send the brightness and CCT legacy commands as two separate BLE writes with a short delay between them instead of one concatenated packet, since write() debounces/cancels a pending write within 15ms of the next one. This didn't turn out to fix the FS230/FS150C issue on its own (root cause was the missing command patterns above), but it's a real, independent correctness fix for any other light that still relies on this legacy code path. Tested on real hardware: 2x FS150C, 1x FS230 5600K. Co-Authored-By: Claude Sonnet 5 --- NeewerLite/NeewerLite/Model/NeewerLight.swift | 25 +++++++-- .../Model/NeewerLightConstant.swift | 53 +++++++++++++++++++ 2 files changed, 74 insertions(+), 4 deletions(-) diff --git a/NeewerLite/NeewerLite/Model/NeewerLight.swift b/NeewerLite/NeewerLite/Model/NeewerLight.swift index e593586..fb65534 100644 --- a/NeewerLite/NeewerLite/Model/NeewerLight.swift +++ b/NeewerLite/NeewerLite/Model/NeewerLight.swift @@ -635,6 +635,13 @@ class NeewerLight: NSObject, ObservableNeewerLightProtocol { let pattern = patterns[command] { return pattern } + // Fall back to built-in patterns for lights whose crowd-sourced DB + // entry doesn't (yet) carry commandPatterns for this command. + // See NeewerLightConstant.builtInCommandPatterns for details. + if let patterns = NeewerLightConstant.builtInCommandPatterns(lightType: _lightType), + let pattern = patterns[command] { + return pattern + } return nil } @@ -1133,16 +1140,26 @@ class NeewerLight: NSObject, ObservableNeewerLightProtocol { let data = NSData(bytes: bArr1, length: bArr1.count) return data as Data } - cctValue.value = newCctValue brrValue.value = newBrrValue let bArr1 = composeSingleCommand(NeewerLightConstant.BleCommand.setLongCCTLightBrightnessTag, brrValue.value) let bArr2 = composeSingleCommand(NeewerLightConstant.BleCommand.setLongCCTLightCCTTag, cctValue.value) - let bArr = bArr1 + bArr2 - let data = NSData(bytes: bArr, length: bArr.count) - return data as Data + // Send as two separate BLE writes instead of one concatenated packet. + // write() debounces/cancels a pending write after 15ms, so the second + // send is scheduled after that window closes rather than immediately, + // to avoid it canceling the first. + if let characteristic = deviceCtlCharacteristic { + let data1 = NSData(bytes: bArr1, length: bArr1.count) as Data + write(data: data1, to: characteristic) + DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in + guard let self = self, let characteristic = self.deviceCtlCharacteristic else { return } + let data2 = NSData(bytes: bArr2, length: bArr2.count) as Data + self.write(data: data2, to: characteristic) + } + } + return Data() } public func setBRR100LightValues(_ brr: CGFloat) { diff --git a/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift b/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift index e737769..8fafc4b 100644 --- a/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift +++ b/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift @@ -73,9 +73,59 @@ class NeewerLightConstant { return (minCCT: 25, maxCCT: 85) } } + if ligthType == 75 { + // FS150C: NEEWER FS150C 130W RGB LED Video Light, 2500K–7500K per product listing. + return (minCCT: 25, maxCCT: 75) + } return (minCCT: 32, maxCCT: 56) } + /// Built-in fallback commandPatterns for lights whose crowd-sourced + /// database entry (synced from GitHub at runtime) has no commandPatterns + /// for a given command. NeewerLight.findCommandPatternFromDB() consults + /// this only after checking temporaryCommandPatterns and the live + /// database, so it never overrides either of those, but it does survive + /// a database.json re-sync that would otherwise wipe out a manually + /// entered temporaryCommandPatterns override. + /// + /// These exact pattern strings were confirmed by physical testing to + /// correctly control brightness and CCT (device responded as expected, + /// not just ack'd) on real hardware: + /// - type 53: FS230 5600K (bi-color only; the crowd-sourced DB entry + /// for this type explicitly has "supportRGB": false, so no "hsi" + /// pattern is provided here) + /// - type 75: FS150C (true RGB light per its product listing) + /// Both were previously falling back to the legacy setLongCCTLightBrightness/ + /// setLongCCTLightCCT (0x82/0x83) command family, which the firmware + /// acknowledges but does not apply to the LED driver on these models. + /// + /// The "hsi" pattern for type 75 is not yet physically confirmed on this + /// exact model; it's copied verbatim from every other RGB-capable light + /// in the crowd-sourced DB that shares this same tag family (identical + /// "cct" pattern shape), all of which use this exact "hsi" pattern with + /// no per-model variation: types 3, 5, 8, 9, 11, 12, 15, 16, 18, 19, 20, + /// 21, 59, 62. {hsitag} resolves to the existing setRGBLightTag (0x86), + /// the RGB sibling of the 0x87 cct tag already confirmed working here. + class func builtInCommandPatterns(lightType: UInt8) -> [String: String]? { + switch lightType { + case 53: + let range = CCTRange(ligthType: lightType, projectName: "") + return [ + "power": "{cmdtag} {powertag} {size} {state:uint8:enum(1=on,2=off)} {checksum}", + "cct": "{cmdtag} {ccttag} {size} {brr:uint8:range(0,100)} {cct:uint8:range(\(range.minCCT),\(range.maxCCT))} 0x32 0x00 0x00 {checksum}" + ] + case 75: + let range = CCTRange(ligthType: lightType, projectName: "") + return [ + "power": "{cmdtag} {powertag} {size} {state:uint8:enum(1=on,2=off)} {checksum}", + "cct": "{cmdtag} {ccttag} {size} {brr:uint8:range(0,100)} {cct:uint8:range(\(range.minCCT),\(range.maxCCT))} 0x32 0x00 0x00 {checksum}", + "hsi": "{cmdtag} {hsitag} {size} {hue:uint16_le:range(0,360)} {sat:uint8:range(0,100)} {brr:uint8:range(0,100)} {checksum}" + ] + default: + return nil + } + } + class func getProjectName(_ idx: Int) -> String { switch idx { case 8: @@ -220,6 +270,9 @@ class NeewerLightConstant { return "BH-30S RGB" case "20230025": return "RGB1200" + case "20230029": + // https://www.amazon.com/... NEEWER FS150C 130W RGB LED Video Light, 2500-7500K + return "FS150C" case "20230031": return "TL120C" case "20230042": From 90fe77c323ea36225e5feb9e06bc9ce1e6927cd5 Mon Sep 17 00:00:00 2001 From: Alan Dick Date: Tue, 3 Nov 2026 16:12:45 -0500 Subject: [PATCH 2/3] Use cct command pattern for brightness-only changes setBRR100LightValues() skipped findCommandPatternFromDB("cct") in CCT mode and always built the legacy packet, so brightness-only changes (Stream Deck dial, MCP set_brightness) updated the UI but not lights whose working CCT command is pattern-based. Route through setCCTLightValues() when a cct pattern exists, matching the HSI branch. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01BTXihLs9VFMXcUAJtDJ2se --- NeewerLite/NeewerLite/Model/NeewerLight.swift | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NeewerLite/NeewerLite/Model/NeewerLight.swift b/NeewerLite/NeewerLite/Model/NeewerLight.swift index fb65534..2f3b771 100644 --- a/NeewerLite/NeewerLite/Model/NeewerLight.swift +++ b/NeewerLite/NeewerLite/Model/NeewerLight.swift @@ -1165,6 +1165,18 @@ class NeewerLight: NSObject, ObservableNeewerLightProtocol { public func setBRR100LightValues(_ brr: CGFloat) { var cmd: Data = Data() if lightMode == .CCTMode { + // Prefer a pattern-based command if one is available, same as + // setCCTLightValues() and the .HSIMode branch just below. Without + // this check, a brightness-only change (e.g. from a Stream Deck + // dial or the MCP server's set_brightness, which call this + // function directly rather than setCCTLightValues) always fell + // back to the legacy command below even on lights whose working + // command is pattern-based — updating the in-memory value (and + // so the GUI slider) while the light itself ignored the packet. + if findCommandPatternFromDB("cct") != nil { + setCCTLightValues(brr: brr, cct: CGFloat(cctValue.value), gmm: CGFloat(gmmValue.value)) + return + } if supportRGB { cmd = getCCTLightCommand(brightness: brr, correlatedColorTemperature: CGFloat(cctValue.value)) } else { From bc5cc2cc6a3c5e11092eebcc60805d80dfe0a819 Mon Sep 17 00:00:00 2001 From: Alan Dick Date: Tue, 3 Nov 2026 16:14:00 -0500 Subject: [PATCH 3/3] Address review: move FS230/FS150C patterns to lights.json - Add power/cct commandPatterns to the type 53 (FS230) entry and a new type 75 (FS150C) entry with power/cct/hsi and cctRange 25-75. - Remove builtInCommandPatterns() and the type-75 CCTRange special case. - Drop the getCCTOnlyLightCommand split-write change. - Keep the "20230029" -> "FS150C" mapping and the setBRR100LightValues cct-pattern fix. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01BTXihLs9VFMXcUAJtDJ2se --- Database/lights.json | 24 +++++++++ NeewerLite/NeewerLite/Model/NeewerLight.swift | 25 ++------- .../Model/NeewerLightConstant.swift | 51 ------------------- 3 files changed, 28 insertions(+), 72 deletions(-) diff --git a/Database/lights.json b/Database/lights.json index 913ae44..acd4f89 100644 --- a/Database/lights.json +++ b/Database/lights.json @@ -1710,6 +1710,10 @@ "cctRange": { "min": 32, "max": 56 + }, + "commandPatterns": { + "power": "{cmdtag} {powertag} {size} {state:uint8:enum(1=on,2=off)} {checksum}", + "cct": "{cmdtag} {ccttag} {size} {brr:uint8:range(0,100)} {cct:uint8:range(32,56)} 0x32 0x00 0x00 {checksum}" } }, { @@ -1947,6 +1951,26 @@ "newRGBLightCommand": true, "fxPreset": "fx17_mac" }, + { + "type": 75, + "name": "Neewer FS150C", + "image": "", + "link": "", + "supportRGB": true, + "supportCCTGM": false, + "supportMusic": true, + "support17FX": false, + "support9FX": false, + "cctRange": { + "min": 25, + "max": 75 + }, + "commandPatterns": { + "power": "{cmdtag} {powertag} {size} {state:uint8:enum(1=on,2=off)} {checksum}", + "cct": "{cmdtag} {ccttag} {size} {brr:uint8:range(0,100)} {cct:uint8:range(25,75)} 0x32 0x00 0x00 {checksum}", + "hsi": "{cmdtag} {hsitag} {size} {hue:uint16_le:range(0,360)} {sat:uint8:range(0,100)} {brr:uint8:range(0,100)} {checksum}" + } + }, { "type": 87, "name": "Neewer HS60C", diff --git a/NeewerLite/NeewerLite/Model/NeewerLight.swift b/NeewerLite/NeewerLite/Model/NeewerLight.swift index 2f3b771..2c3c790 100644 --- a/NeewerLite/NeewerLite/Model/NeewerLight.swift +++ b/NeewerLite/NeewerLite/Model/NeewerLight.swift @@ -635,13 +635,6 @@ class NeewerLight: NSObject, ObservableNeewerLightProtocol { let pattern = patterns[command] { return pattern } - // Fall back to built-in patterns for lights whose crowd-sourced DB - // entry doesn't (yet) carry commandPatterns for this command. - // See NeewerLightConstant.builtInCommandPatterns for details. - if let patterns = NeewerLightConstant.builtInCommandPatterns(lightType: _lightType), - let pattern = patterns[command] { - return pattern - } return nil } @@ -1140,26 +1133,16 @@ class NeewerLight: NSObject, ObservableNeewerLightProtocol { let data = NSData(bytes: bArr1, length: bArr1.count) return data as Data } + cctValue.value = newCctValue brrValue.value = newBrrValue let bArr1 = composeSingleCommand(NeewerLightConstant.BleCommand.setLongCCTLightBrightnessTag, brrValue.value) let bArr2 = composeSingleCommand(NeewerLightConstant.BleCommand.setLongCCTLightCCTTag, cctValue.value) + let bArr = bArr1 + bArr2 - // Send as two separate BLE writes instead of one concatenated packet. - // write() debounces/cancels a pending write after 15ms, so the second - // send is scheduled after that window closes rather than immediately, - // to avoid it canceling the first. - if let characteristic = deviceCtlCharacteristic { - let data1 = NSData(bytes: bArr1, length: bArr1.count) as Data - write(data: data1, to: characteristic) - DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) { [weak self] in - guard let self = self, let characteristic = self.deviceCtlCharacteristic else { return } - let data2 = NSData(bytes: bArr2, length: bArr2.count) as Data - self.write(data: data2, to: characteristic) - } - } - return Data() + let data = NSData(bytes: bArr, length: bArr.count) + return data as Data } public func setBRR100LightValues(_ brr: CGFloat) { diff --git a/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift b/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift index 8fafc4b..c0f9aaa 100644 --- a/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift +++ b/NeewerLite/NeewerLite/Model/NeewerLightConstant.swift @@ -73,59 +73,9 @@ class NeewerLightConstant { return (minCCT: 25, maxCCT: 85) } } - if ligthType == 75 { - // FS150C: NEEWER FS150C 130W RGB LED Video Light, 2500K–7500K per product listing. - return (minCCT: 25, maxCCT: 75) - } return (minCCT: 32, maxCCT: 56) } - /// Built-in fallback commandPatterns for lights whose crowd-sourced - /// database entry (synced from GitHub at runtime) has no commandPatterns - /// for a given command. NeewerLight.findCommandPatternFromDB() consults - /// this only after checking temporaryCommandPatterns and the live - /// database, so it never overrides either of those, but it does survive - /// a database.json re-sync that would otherwise wipe out a manually - /// entered temporaryCommandPatterns override. - /// - /// These exact pattern strings were confirmed by physical testing to - /// correctly control brightness and CCT (device responded as expected, - /// not just ack'd) on real hardware: - /// - type 53: FS230 5600K (bi-color only; the crowd-sourced DB entry - /// for this type explicitly has "supportRGB": false, so no "hsi" - /// pattern is provided here) - /// - type 75: FS150C (true RGB light per its product listing) - /// Both were previously falling back to the legacy setLongCCTLightBrightness/ - /// setLongCCTLightCCT (0x82/0x83) command family, which the firmware - /// acknowledges but does not apply to the LED driver on these models. - /// - /// The "hsi" pattern for type 75 is not yet physically confirmed on this - /// exact model; it's copied verbatim from every other RGB-capable light - /// in the crowd-sourced DB that shares this same tag family (identical - /// "cct" pattern shape), all of which use this exact "hsi" pattern with - /// no per-model variation: types 3, 5, 8, 9, 11, 12, 15, 16, 18, 19, 20, - /// 21, 59, 62. {hsitag} resolves to the existing setRGBLightTag (0x86), - /// the RGB sibling of the 0x87 cct tag already confirmed working here. - class func builtInCommandPatterns(lightType: UInt8) -> [String: String]? { - switch lightType { - case 53: - let range = CCTRange(ligthType: lightType, projectName: "") - return [ - "power": "{cmdtag} {powertag} {size} {state:uint8:enum(1=on,2=off)} {checksum}", - "cct": "{cmdtag} {ccttag} {size} {brr:uint8:range(0,100)} {cct:uint8:range(\(range.minCCT),\(range.maxCCT))} 0x32 0x00 0x00 {checksum}" - ] - case 75: - let range = CCTRange(ligthType: lightType, projectName: "") - return [ - "power": "{cmdtag} {powertag} {size} {state:uint8:enum(1=on,2=off)} {checksum}", - "cct": "{cmdtag} {ccttag} {size} {brr:uint8:range(0,100)} {cct:uint8:range(\(range.minCCT),\(range.maxCCT))} 0x32 0x00 0x00 {checksum}", - "hsi": "{cmdtag} {hsitag} {size} {hue:uint16_le:range(0,360)} {sat:uint8:range(0,100)} {brr:uint8:range(0,100)} {checksum}" - ] - default: - return nil - } - } - class func getProjectName(_ idx: Int) -> String { switch idx { case 8: @@ -271,7 +221,6 @@ class NeewerLightConstant { case "20230025": return "RGB1200" case "20230029": - // https://www.amazon.com/... NEEWER FS150C 130W RGB LED Video Light, 2500-7500K return "FS150C" case "20230031": return "TL120C"