Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Mapping doesn't seem to update while building #41

Closed
SpaceDriedVest opened this issue May 28, 2024 · 14 comments
Closed

Key Mapping doesn't seem to update while building #41

SpaceDriedVest opened this issue May 28, 2024 · 14 comments
Labels
bug Something isn't working

Comments

@SpaceDriedVest
Copy link

So glad I came across this project and I even hope to start contributing to it too!

I've tried taking an rp2040 example and updated the size of the matrix and the keymapping.

The changes were made in keymap.rs, keyboard.toml, and vial.json. I see additional defmt log statements I added being printed but the key is still responding with the original keymap from the example.

I'm loading via cargo run using an RPi Pico Probe to a RPi Pico. Am I missing some step in getting the new config to be recognized and built?

Thanks!

@HaoboGu
Copy link
Owner

HaoboGu commented May 28, 2024

Could you post your keymap.rs, keyboard.toml, vial.json and main.rs here?

@SpaceDriedVest
Copy link
Author

Sure thing, here they are:

keymap.rs

use crate::{COL, NUM_LAYER, ROW};
use rmk::action::KeyAction;
use rmk::{k, layer};

#[rustfmt::skip]
pub static KEYMAP: [[[KeyAction; COL]; ROW]; NUM_LAYER] = [
    layer!([
        [k!(Kc1)]
    ])
];

keyboard.toml

[keyboard]
product_name = "RMK Keyboard"
vendor_id = 0x4c4b
product_id = 0x4643
manufacturer = "haobo"
chip = "rp2040"


[matrix]
rows = 1
cols = 1
layers = 1
# TODO: Update input/output gpio name
# Input and output pins are mandatory
input_pins = ["PIN_10"]
output_pins = ["PIN_6"]
# WARNING: Currently row2col/col2row is set in RMK's feature gate, configs here do nothing actually
# row2col = true

[layout]

[light]
# All light pins are high-active by default, uncomment if you want it to be low-active
# capslock.pin = "PB2"
# capslock.low_active = true
# scrolllock.pin = "PA3"
# scrolllock.low_active = true
# Just ignore if no light pin is used for it
# numslock.pin = "PA5"
# numslock.low_active = true

[storage]
# Storage feature is enabled by default
# enabled = false

vial.json

{
    "name": "HID Keyboard",
    "vendorId": "0x4C4B",
    "productId": "0x4643",
    "lighting": "none",
    "matrix": {
        "rows": 1,
        "cols": 1
    },
    "layouts": {
        "labels": [
            [
                "label"
            ]
        ],
        "keymap": [
            [
                "0,0"
            ]
        ]
    }
}

main.rs

#![no_std]
#![no_main]


mod keymap;
mod vial;

use crate::keymap::KEYMAP;
use rmk::macros::rmk_keyboard;
use vial::{VIAL_KEYBOARD_DEF, VIAL_KEYBOARD_ID};

#[rmk_keyboard]
mod keyboard {}

@HaoboGu
Copy link
Owner

HaoboGu commented May 29, 2024

I tried your configs on my rp2040 board, it works correctly. Which folder do you run your cargo run command? Make sure running cargo run in examples/use_config/rp2040.

You can use cargo size to check the binary size before and after changing the config. Your new config should have smaller binary size generated.

@HaoboGu
Copy link
Owner

HaoboGu commented Jun 5, 2024

@SpaceDriedVest Do you still have the problem? I cannot repro your case.

@flamestro
Copy link

I had a similar issue, for me it was resolved by running cargo clean followed by cargo run --release instead of cargo run.

Hope it helps others

@HaoboGu
Copy link
Owner

HaoboGu commented Jul 17, 2024

I had a similar issue, for me it was resolved by running cargo clean followed by cargo run --release instead of cargo run.

Thanks for the feedback, I would try to fix it.

@HaoboGu HaoboGu added the bug Something isn't working label Jul 17, 2024
HaoboGu added a commit that referenced this issue Jul 17, 2024
Signed-off-by: Haobo Gu <haobogu@outlook.com>
@flamestro
Copy link

Hey, thanks for checking this. i did not use a keyboard.toml but only a .rs

@HaoboGu
Copy link
Owner

HaoboGu commented Jul 17, 2024

Got it. It's so weird, I cannot repro this on my mac. Could you provide a little bit more info? such as your OS, Rust version, RMK version, etc.

@flamestro
Copy link

flamestro commented Jul 17, 2024

I used a macOS Intel device with a recent version of rust (I can check later).

I used the examples/use_rust/rp2040 config and flashed it by changing the pins only. (I have 3x3 but the config is 4x3) This worked without issues. Then i changed the rows and cols in the vial.json because it was not update by cargo build. I also changed the rows and cols in the keymap.rs to 3x3 and adjusted the keys to others.

I ran cargo build and then cargo run as specified in the Readme.

It did not work until I tried a cargo clean and cargo run --release. It did also not work without the release.

Oh and I flashed using usb without a debug probe.

Somewhere in between all this I also adjusted the build.rs to always run and not only if the memory.x is changed. Not sure when tho, I just not it did not work before and after this change, but I removed the line until the end.

@HaoboGu
Copy link
Owner

HaoboGu commented Jul 17, 2024

Thanks for the info! I will dig into it soon

@HaoboGu
Copy link
Owner

HaoboGu commented Jul 19, 2024

@flamestro The latest commit should fix the issue, could you please test it again? Thanks!

@HaoboGu HaoboGu reopened this Jul 19, 2024
@flamestro
Copy link

Sure, I will check it until tomorrow. I anyways had to flash a new keyboard so I can try it on a fresh rp2040 :)

@flamestro
Copy link

I can't reproduce the issue anymore

@HaoboGu
Copy link
Owner

HaoboGu commented Jul 23, 2024

Thanks! I'm closing this issue

@HaoboGu HaoboGu closed this as completed Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants