add cl_factor protocol support to iOS cue

This commit is contained in:
jess 2026-04-02 18:29:29 -07:00
parent d84ed33c14
commit e8ce7eb98c
1 changed files with 18 additions and 0 deletions

View File

@ -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]
}