From e8ce7eb98c7f4a2e749dbbf4c680f49d49b7775b Mon Sep 17 00:00:00 2001 From: jess Date: Thu, 2 Apr 2026 18:29:29 -0700 Subject: [PATCH] add cl_factor protocol support to iOS cue --- cue-ios/CueIOS/Models/Protocol.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cue-ios/CueIOS/Models/Protocol.swift b/cue-ios/CueIOS/Models/Protocol.swift index a0702f3..61f9958 100644 --- a/cue-ios/CueIOS/Models/Protocol.swift +++ b/cue-ios/CueIOS/Models/Protocol.swift @@ -29,6 +29,7 @@ let RSP_REF_FRAME: UInt8 = 0x20 let RSP_REF_LP_RANGE: UInt8 = 0x21 let RSP_REFS_DONE: UInt8 = 0x22 let RSP_REF_STATUS: UInt8 = 0x23 +let RSP_CL_FACTOR: UInt8 = 0x24 // Cue -> ESP32 let CMD_SET_SWEEP: UInt8 = 0x10 @@ -46,6 +47,8 @@ let CMD_START_PH: UInt8 = 0x24 let CMD_START_CLEAN: UInt8 = 0x25 let CMD_SET_CELL_K: UInt8 = 0x28 let CMD_GET_CELL_K: UInt8 = 0x29 +let CMD_SET_CL_FACTOR: UInt8 = 0x33 +let CMD_GET_CL_FACTOR: UInt8 = 0x34 let CMD_START_REFS: UInt8 = 0x30 let CMD_GET_REFS: UInt8 = 0x31 let CMD_CLEAR_REFS: UInt8 = 0x32 @@ -123,6 +126,7 @@ enum EisMessage { case refsDone case refStatus(hasRefs: Bool) case cellK(Float) + case clFactor(Float) } // MARK: - Response parser @@ -254,6 +258,9 @@ func parseSysex(_ data: [UInt8]) -> EisMessage? { case RSP_CELL_K where p.count >= 5: return .cellK(decodeFloat(p, at: 0)) + case RSP_CL_FACTOR where p.count >= 5: + return .clFactor(decodeFloat(p, at: 0)) + default: return nil } @@ -371,3 +378,14 @@ func buildSysexSetCellK(_ k: Float) -> [UInt8] { func buildSysexGetCellK() -> [UInt8] { [0xF0, sysexMfr, CMD_GET_CELL_K, 0xF7] } + +func buildSysexSetClFactor(_ f: Float) -> [UInt8] { + var sx: [UInt8] = [0xF0, sysexMfr, CMD_SET_CL_FACTOR] + sx.append(contentsOf: encodeFloat(f)) + sx.append(0xF7) + return sx +} + +func buildSysexGetClFactor() -> [UInt8] { + [0xF0, sysexMfr, CMD_GET_CL_FACTOR, 0xF7] +}