Skip to content

Commit

Permalink
fixes for #94
Browse files Browse the repository at this point in the history
  • Loading branch information
bwhitman committed Jun 9, 2023
1 parent cc716e7 commit 81dee00
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
5 changes: 4 additions & 1 deletion ports/esp32s3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,13 @@ void app_main(void) {
idle_0_handle = xTaskGetIdleTaskHandleForCPU(0);
idle_1_handle = xTaskGetIdleTaskHandleForCPU(1);


fprintf(stderr,"Starting MIDI on core %d\n", MIDI_TASK_COREID);
xTaskCreatePinnedToCore(run_midi, MIDI_TASK_NAME, MIDI_TASK_STACK_SIZE / sizeof(StackType_t), NULL, MIDI_TASK_PRIORITY, &midi_handle, MIDI_TASK_COREID);
fflush(stderr);
delay_ms(10);

fprintf(stderr,"Starting USB host on core %d\n", USB_TASK_COREID);
usbh_setup(show_config_desc_full);
xTaskCreatePinnedToCore(run_usb, USB_TASK_NAME, (USB_TASK_STACK_SIZE) / sizeof(StackType_t), NULL, USB_TASK_PRIORITY, &usb_handle, USB_TASK_COREID);
fflush(stderr);
delay_ms(10);
Expand All @@ -381,10 +381,13 @@ void app_main(void) {
fflush(stderr);
delay_ms(10);


fprintf(stderr,"Starting joystick\n");
init_esp_joy();
fflush(stderr);
delay_ms(10);


}

void nlr_jump_fail(void *val) {
Expand Down
18 changes: 10 additions & 8 deletions ports/esp32s3/usb_keyboard.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,22 @@ uint16_t current_held = 0;
int64_t current_held_ms = 0;
int64_t last_inter_trigger_ms = 0;



void decode_report(uint8_t *p) {
// First byte, modifier mask
uint8_t modifier = p[0];
uint8_t new_key = 0;
// Second byte, reserved
// next 6 bytes, scan codes (for rollover)
//fprintf(stderr,"decode report %d %d %d %d %d %d\n", p[2],p[3],p[4],p[5],p[6],p[7]);
uint8_t skip = 0;
for(uint8_t i=2;i<8;i++) {
if(p[i]!=0) {
uint8_t skip = 0;
for(uint8_t j=2;j<8;j++) {
if(last_scan[j] == p[i]) skip = 1;
}
if(!skip) { // only process new keys
if(p[i]!=0) {
for(uint8_t j=2;j<8;j++) {
if(last_scan[j] == p[i]) skip = 1;
}
if(!skip) { // only process new keys
uint16_t c = scan_ascii(p[i], modifier);
if(c) {
new_key = 1;
Expand All @@ -156,9 +158,9 @@ void decode_report(uint8_t *p) {
send_key_to_micropython(c);
}
}
}
}
}
if(!new_key) {
if(!new_key && !skip) {
// we got a message but no new keys. so is a release
//fprintf(stderr, "turning off key\n");
current_held_ms = 0;
Expand Down

0 comments on commit 81dee00

Please sign in to comment.