Skip to content

Commit

Permalink
Add volume up / down reset on usb report complete (this should be a b…
Browse files Browse the repository at this point in the history
…uilt-in in input drivers). Also fixed a silly web config thing
  • Loading branch information
arntsonl committed Jan 24, 2025
1 parent 37027f7 commit d4056be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/drivers/keyboard/KeyboardDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,8 @@ void KeyboardDriver::process(Gamepad * gamepad) {

if( volumeChange > 0 ) {
pressKey(KEYBOARD_MULTIMEDIA_VOLUME_UP);
volumeChange--;
} else if ( volumeChange < 0 ) {
pressKey(KEYBOARD_MULTIMEDIA_VOLUME_DOWN);
volumeChange++;
}

// Wake up TinyUSB device
Expand All @@ -123,6 +121,13 @@ void KeyboardDriver::process(Gamepad * gamepad) {
if ( tud_hid_report(keyboardReport.reportId, keyboard_report_payload, keyboard_report_size) ) {
memcpy(last_report, keyboard_report_payload, keyboard_report_size);
last_report_size = keyboard_report_size;

// Adjust volume on success
if( volumeChange > 0 ) {
volumeChange--;
} else if ( volumeChange < 0 ) {
volumeChange++;
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions www/src/Addons/Rotary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const rotaryScheme = {
.number()
.required()
.label('Rotary Encoder Add-On Enabled'),
encoderOneEnabled: yup.number().required().label('Encoder One Enabled'),
encoderOneEnabled: yup.boolean().required().label('Encoder One Enabled'),
encoderOnePinA: yup
.number()
.label('Encoder One Pin A')
Expand All @@ -66,7 +66,7 @@ export const rotaryScheme = {
.required()
.label('Encoder One Allow Wrap Around'),
encoderOneMultiplier: yup.number().label('Encoder One Multiplier').required(),
encoderTwoEnabled: yup.number().required().label('Encoder Two Enabled'),
encoderTwoEnabled: yup.boolean().required().label('Encoder Two Enabled'),
encoderTwoPinA: yup
.number()
.label('Encoder Two Pin A')
Expand Down

0 comments on commit d4056be

Please sign in to comment.