diff --git a/Cargo.lock b/Cargo.lock index b1492b0..47167af 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -772,7 +772,7 @@ dependencies = [ [[package]] name = "geode_piano" -version = "0.2.0" +version = "0.2.1" dependencies = [ "byte-slice-cast 1.2.2", "cortex-m", diff --git a/Cargo.toml b/Cargo.toml index 261e44f..cfefc0b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "geode_piano" -version = "0.2.0" +version = "0.2.1" edition = "2021" license = "GPL-3.0-only" diff --git a/src/matrix.rs b/src/matrix.rs index 4226dd9..8cfaf25 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -115,10 +115,10 @@ impl KeyMatrix { // millisecond duration of keypress let dur = note_first[note as usize].unwrap().elapsed().as_millis(); - let velocity: u8 = if dur <= 80 { - (127 - dur) as u8 + let velocity: u8 = if dur <= 60 { + (127 - dur * 6 / 5) as u8 } else { - (127 - min(dur, 250) / 5 - 70) as u8 + (127 - min(dur, 240) / 4 - 60) as u8 }; defmt::debug!("{} velocity {} from dur {}ms", note, velocity, dur); note_on[note as usize] = true; diff --git a/src/usb.rs b/src/usb.rs index 273c0ec..4a0f43d 100644 --- a/src/usb.rs +++ b/src/usb.rs @@ -50,7 +50,7 @@ pub async fn usb_task( let mut config = Config::new(0xdead, 0xbeef); config.manufacturer = Some("dogeystamp"); config.product = Some("Geode-Piano MIDI keyboard"); - config.serial_number = Some("0.2.0"); + config.serial_number = Some("0.2.1"); config.max_power = 100; config.max_packet_size_0 = 64;