Squashed commit of the following:
Mockband / build (push) Failing after 10s Details

commit 13825855d3
Author: Neale Pickett <neale@woozle.org>
Date:   Sat Jan 6 15:08:12 2024 -0700

    twiddling things trying to get drums working on CH

commit e54595e630
Merge: 63bd067 703b070
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 18:18:18 2024 -0700

    Merge branch 'main' into builder

commit 63bd067250
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 09:29:16 2024 -0700

    More idiomatic (to me) Makefile

commit 9f0c0711a8
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 09:10:28 2024 -0700

    fancypants flash target

commit efc67e9fe5
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 09:06:59 2024 -0700

    Also publish zip file

commit ce7d6107cf
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 09:04:51 2024 -0700

    stop using removed `make publish`

commit 48d2450514
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 09:02:53 2024 -0700

    make dist

commit 5f44832151
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 08:50:10 2024 -0700

    move to Makefile

commit da45584955
Author: Neale Pickett <neale@woozle.org>
Date:   Fri Jan 5 08:37:03 2024 -0700

    Makefile

commit 50ce7c245a
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 23:16:08 2024 -0700

    Fix quoting

commit f767eb6e23
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 23:15:05 2024 -0700

    Build log formatting

commit 7495bfd20f
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 23:12:51 2024 -0700

    Try preserving package versions

commit 5fa607d6b0
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 22:59:14 2024 -0700

    build and code cleanup

commit 855ad3ba60
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 22:48:20 2024 -0700

    fix: change quoting?

commit 25a917dc81
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 22:42:11 2024 -0700

    directly specify gcc flags

commit a8d4918e05
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 22:23:03 2024 -0700

    variables expand again

commit 544ffa8ced
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 22:21:25 2024 -0700

    quote stuff

commit a3d8262e01
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 22:19:58 2024 -0700

    fix build on non-default branch

commit 0ba9c0957a
Author: Neale Pickett <neale@woozle.org>
Date:   Thu Jan 4 22:16:36 2024 -0700

    Clever vid/pid settings?
This commit is contained in:
Neale Pickett 2024-01-06 15:13:19 -07:00
parent 703b070844
commit c6cf7b91b4
7 changed files with 78 additions and 57 deletions

View File

@ -1,46 +0,0 @@
#! /bin/sh
set -e
log () {
echo "=== $*"
}
# Make sure we're in the project directory
cd $(dirname $0)/..
mkdir -p out/
while read variant vid pid flags; do
log
log "Building $variant ($vid:$pid)"
log
# We can overload build.extra_flags from boards.txt,
# so just specify the -D flags to gcc
flags="$flags -DUSB_VID=$vid -DUSB_PID=$pid"
flags="$flags -DUSB_MANUFACTURER=\"woozle.org\""
flags="$flags \"-DUSB_PRODUCT=\"Mockband $variant\"\"" # wtf quoting
flags="$flags -DCDC_DISABLED"
# Arduino gets cranky when it tries to use its own cache
rm -rf build/
mkdir -p build/cache/
arduino-builder \
-build-path $(pwd)/build/ \
-build-cache $(pwd)/build/cache/ \
-fqbn arduino:avr:leonardo \
-hardware /usr/share/arduino/hardware \
-tools /usr/share/arduino/tools \
-prefs="build.extra_flags=$flags" \
-compile MockBand.ino
mv build/MockBand.ino.hex out/MockBand.$variant.hex
done << EOD
guitar 0x1bad 0x0004
guitar-wammy 0x1bad 0x0004 -DWAMMY
drums 0x1bad 0x3110
EOD
ls -l out/

View File

@ -7,9 +7,15 @@ VERSION=$GITHUB_REF_NAME
BASE=$GITHUB_SERVER_URL/api/packages/$GITHUB_ACTOR/generic/$PACKAGE/$VERSION
curl \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \
$BASE
for path in "$@"; do
fn=$(basename "$path")
echo "=== Upload $VERSION/$fn"
curl \
--user "$GITHUB_ACTOR:$PACKAGE_API_TOKEN" \
--request DELETE \

View File

@ -9,9 +9,11 @@ jobs:
steps:
- name: check out repository
run: git clone -b $GITHUB_REF_NAME $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
- name: build
run: .gitea/build.sh
- name: build firmwares
run: make
- name: build zip file
run: make dist
- name: publish
env:
PACKAGE_API_TOKEN: ${{ secrets.PACKAGE_API_TOKEN }}
run: .gitea/publish.sh out/*
run: .gitea/publish.sh build/*.zip build/*.hex

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.zip
*.hex
build/

49
Makefile Normal file
View File

@ -0,0 +1,49 @@
DEVICE=/dev/ttyACM0
all: firmwares
firmwares: build/MockBand.guitar-wammy.hex
build/MockBand.guitar-wammy.hex: VID=0x1bad
build/MockBand.guitar-wammy.hex: PID=0x0004
build/MockBand.guitar-wammy.hex: FLAGS=-DWAMMY
firmwares: build/MockBand.guitar.hex
build/MockBand.guitar.hex: VID=0x1bad
build/MockBand.guitar.hex: PID=0x0004
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
arduino-builder \
-build-path $(abspath build/) \
-build-cache $(abspath build/cache/) \
-fqbn arduino:avr:leonardo \
-hardware /usr/share/arduino/hardware/ \
-tools /usr/share/arduino/tools/ \
-prefs="build.extra_flags=-DUSB_VID=$(VID) -DUSB_PID=$(PID) '-DUSB_PRODUCT=\"Mockband $*\"' -DUSB_MANUFACTURER=\"woozle.org\" -DCDC_DISABLED $(FLAGS)" \
-compile $<
mv build/MockBand.ino.hex $@
flash-%: build/MockBand.%.hex
echo -n "Waiting for $(DEVICE)..."; while [ ! -e $(DEVICE) ]; do echo -n .; sleep 1; done
avrdude -v -patmega32u4 -cavr109 -P$(DEVICE) -b57600 -D -Uflash:w:$<:i
dist: build/MockBand.zip
build/MockBand.zip: firmwares
rm -f $@
zip -r $@ README.md build/*.hex docs/
clean:
rm -rf build

View File

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

View File

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