From 13825855d3baeb456fa9577b224625d0c0e2f3b3 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sat, 6 Jan 2024 15:08:12 -0700 Subject: [PATCH] twiddling things trying to get drums working on CH --- Makefile | 5 +++++ MockBand.ino | 7 +++++-- docs/tech-notes.md | 18 ++++++++++++------ 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 9839b7a..6129671 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,11 @@ firmwares: build/MockBand.drums.hex build/MockBand.drums.hex: VID=0x1bad build/MockBand.drums.hex: PID=0x3110 +firmwares: build/MockBand.drums1.hex +build/MockBand.drums1.hex: VID=0x1bad +build/MockBand.drums1.hex: PID=00005 + + build/MockBand.%.hex: MockBand.ino mkdir -p build/cache rm -f build/build.options.json diff --git a/MockBand.ino b/MockBand.ino index 8373f36..8794bd6 100644 --- a/MockBand.ino +++ b/MockBand.ino @@ -142,8 +142,8 @@ void loop() { } #else // DRUMS buttonState.buttons |= (buttons >> 10) & 0b01011; // Cymbals - bitWrite(buttonState.buttons, 10, buttons & (0b01111 << 0)); // Drum pad modifier - bitWrite(buttonState.buttons, 11, buttons & (0b01011 << 10)); // Cymbals modifier + bitWrite(buttonState.buttons, 10, (buttons >> 0) & 0b01111); // Drum pad modifier + bitWrite(buttonState.buttons, 11, (buttons >> 10) & 0b01011); // Cymbals modifier buttonState.axis[3] = bitRead(buttons, 12)?255:0; // High hat // rbdrum2midi wants these set @@ -151,6 +151,9 @@ void loop() { buttonState.velocity[1] = bitRead(buttonState.buttons, 2)?127:0; // R buttonState.velocity[2] = bitRead(buttonState.buttons, 1)?127:0; // G buttonState.velocity[3] = bitRead(buttonState.buttons, 0)?127:0; // B + + // Say the D-pad is centered + buttonState.hatAndConstant = 8; #endif #ifdef DPAD diff --git a/docs/tech-notes.md b/docs/tech-notes.md index fb48ec5..27a7d43 100644 --- a/docs/tech-notes.md +++ b/docs/tech-notes.md @@ -70,13 +70,19 @@ Here's what each bit means: hatAndConstant -------------- -Here's what the values mean: +The HAT switch reports its position like a clock. -* 2: right -* 6: left -* 0: up -* 4: down -* 8: nothing + 7 0 1 + + 6 8 2 + + 5 4 3 + +0 is up, +2 is right, +4 is down, +6 is left, +and 8 is centered. velocity