Skip to content

Commit

Permalink
feat: adapted for allowing first tests on an MK3 device
Browse files Browse the repository at this point in the history
  • Loading branch information
tillt committed Dec 27, 2023
1 parent 2824665 commit 8f5da04
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,6 @@
type = "1"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "7B6D27F3-A364-4022-A126-8772DD0743E1"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "KompleteSynthesia/USBController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "255"
endingLineNumber = "255"
landmarkName = "-bulkWriteData:error:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
uuid = "E07BADFC-B987-42D3-ADB1-C6DE62C7ED25"
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "KompleteSynthesia/USBController.m"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "256"
endingLineNumber = "256"
landmarkName = "-bulkWriteData:error:"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
Expand Down
13 changes: 8 additions & 5 deletions KompleteSynthesia/HIDController.m
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ + (int)vendorIDWithDevice:(IOHIDDeviceRef)device
// TODO: Make this MK1 compatible
- (unsigned char)keyColor:(int)note
{
assert(_mk == 2);
assert(_mk != 1);
assert(note < kKompleteKontrolLightGuideKeyMapSize);
return _keys[note];
}
Expand Down Expand Up @@ -413,7 +413,7 @@ - (IOHIDDeviceRef)detectKeyboardController:(NSError**)error

#ifdef DEBUG_FAKE_CONTROLLER
_keyCount = 88;
_mk2Controller = YES;
_mk = 2;
_keyOffset = -21;
lightGuideUpdateMessage[0] = kCommandLightGuideUpdateMK2;
// FIXME: This is likely wrong for MK1 devices!
Expand Down Expand Up @@ -445,7 +445,10 @@ - (IOHIDDeviceRef)detectKeyboardController:(NSError**)error
lightGuideUpdateMessage[0] = _mk == 2 ? kCommandLightGuideUpdateMK2 : kCommandLightGuideUpdateMK1;
// FIXME: This is likely wrong for MK1 devices!
buttonLightingUpdateMessage[0] = kCommandButtonLightsUpdate;
_deviceName = [NSString stringWithFormat:@"Komplete Kontrol S%d MK%d", _keyCount, _mk];
_deviceName = [NSString stringWithFormat:@"%@Kontrol S%d MK%d",
_mk != 3 ? @"Komplete " : @"",
_keyCount,
_mk];
return devices[i];
}
}
Expand Down Expand Up @@ -555,7 +558,7 @@ - (BOOL)updateLightGuideMap:(NSError**)error

- (void)lightKey:(int)key color:(unsigned char)color
{
if (_mk == 2) {
if (_mk != 1) {
_keys[key] = color;
} else {
setMk1ColorWithMk2ColorCode(color, &_keys[key*3]);
Expand All @@ -568,7 +571,7 @@ - (void)lightKeysWithColor:(unsigned char)color
if (_keys == NULL) {
return;
}
if (_mk == 2) {
if (_mk != 1) {
memset(_keys, color, kKompleteKontrolLightGuideKeyMapSize);
} else {
for (unsigned int i = 0; i < kKompleteKontrolLightGuideKeyMapSize; i += 3) {
Expand Down

0 comments on commit 8f5da04

Please sign in to comment.