Merge pull request #5 from speedypotato/bugfix/reactive_fallback

Bugfix for reactive timeout
This commit is contained in:
Nick G
2021-07-20 10:30:54 -04:00
committed by GitHub
3 changed files with 7 additions and 3 deletions
+3 -2
View File
@@ -6,17 +6,18 @@ Currently working/fixed:
- Gamepad mode - untested on EAC - default boot mode
- Keyboard & Mouse Mode - limited to 6KRO - hold btn-a to enter kb mode
- HID LEDs with Reactive LED fallback - untested
- HID LEDs with Reactive LED fallback
- sdvx/iidx spoof - untested on EAC
- 1000hz polling
- Fix 0-~71% encoder rollover in gamepad mode, uint32 max val isn't divisible evenly by ppr\*4 for joystick - thanks friends
- Switch and LED pins are now staggered for easier wiring
- Fix 0-~71% encoder rollover in gamepad mode, uint32 max val isn't divisible evenly by ppr\*4 for joystick - thanks friends
TODO:
- Store last mode in flash memory https://www.raspberrypi.org/forums/viewtopic.php?t=305570
- nkro
- debounce
- ws2812b rgb on second core?
- split input updating into pi pico's second core?
How to Use:
Binary file not shown.
+4 -1
View File
@@ -24,7 +24,7 @@
#define ENC_PPR 600 // Encoder PPR
#define ENC_PULSE (ENC_PPR * 4) // 4 pulses per PPR
#define ENC_ROLLOVER (ENC_PULSE * 2) // Delta Rollover threshold
#define REACTIVE_TIMEOUT_MAX 1000 // Cycles before HID falls back to reactive
#define REACTIVE_TIMEOUT_MAX 100000 // Cycles before HID falls back to reactive
// MODIFY KEYBINDS HERE, MAKE SURE LENGTHS MATCH SW_GPIO_SIZE
const uint8_t SW_KEYCODE[] = {HID_KEY_D, HID_KEY_F, HID_KEY_J, HID_KEY_K,
@@ -61,6 +61,9 @@ struct lights_report {
* HID/Reactive Lights
**/
void update_lights() {
if (reactive_timeout_count < REACTIVE_TIMEOUT_MAX) {
reactive_timeout_count++;
}
if (leds_changed) {
for (int i = 0; i < SW_GPIO_SIZE; i++) {
if (reactive_timeout_count >= REACTIVE_TIMEOUT_MAX) {