Create comparator using macro
Hello,
I am getting an error EXC_BAD_ACCESS (code=2, address=0x65f6b65320) on closure of the following line:
let source: TaskCompletionSource<OpaquePointer> = bridgeTransfer(ptr: context!)
within the tasky interface to mbl_mw_dataprocessor_multi_comparator_create when I run the following code:
func macroSet() {
mbl_mw_macro_record(self.device.board, 0)
mbl_mw_switch_get_state_data_signal(self.device.board).counterCreateCount().continueOnSuccessWith { count in
count.comparatorCreate(op: MBL_MW_COMPARATOR_OP_EQ, mode: MBL_MW_COMPARATOR_MODE_ABSOLUTE, references: [Float(2)]).continueOnSuccessWith { comp in
mbl_mw_event_record_commands(comp)
self.device.flashLED(color: .red, intensity: 1.0, _repeat: 1)
comp.eventEndRecord()
}
count.comparatorCreate(op: MBL_MW_COMPARATOR_OP_EQ, mode: MBL_MW_COMPARATOR_MODE_ABSOLUTE, references: [Float(4)]).continueOnSuccessWith { comp in
mbl_mw_event_record_commands(comp)
self.device.flashLED(color: .blue, intensity: 1.0, _repeat: 1)
mbl_mw_dataprocessor_counter_set_state(count, 0)
comp.eventEndRecord()
}
}
self.device.macroEndRecord().continueOnSuccessWith { id in
mbl_mw_macro_execute(self.device.board, UInt8(id))
}
}
Comments
Here is the task (bolts swift) interface:
Thanks Laura! Really appreciate your time here. I noticed that you never called mbl_mw_macro_record - is this call necessary to record a macro?
aw crap, it just didn't copy paste. Let me fix that.