HaoboGu / rmk

Rust keyboard firmware library with layers, macros, real-time keymap editing, and wireless(BLE) support
https://haobogu.github.io/rmk/
Apache License 2.0
381 stars 28 forks source link

Esp32c6 #59

Closed davidqge closed 1 month ago

davidqge commented 1 month ago

Fixed several crashes on esp32c6. Typing is working now, except Vial.

HaoboGu commented 1 month ago

I checked the BLE report writing, it seems current implementation has a bug when serializing the report:

https://github.com/HaoboGu/rmk/blob/main/rmk/src/ble/esp/server.rs#L31-L38

async fn write_serialize<IR: AsInputReport>(&mut self, r: &IR) -> Result<(), HidError> {
        use ssmarshal::serialize;
        let mut buf: [u8; 32] = [0; 32];
-       match serialize(&mut buf, &r) {
+       match serialize(&mut buf, r) {
            Ok(n) => self.write(&buf[0..n]).await,
            Err(_) => Err(HidError::ReportSerializeError),
        }
    }

Could you please try this fix?

HaoboGu commented 1 month ago

Please also add ci for esp32c6 to .github/workflows/build esp.yml

davidqge commented 1 month ago

Yes, that fixed the crash too. Added ci, and changed readme.

HaoboGu commented 1 month ago

LGTM, thanks a lot!