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

One layer only does not compile #41

Open
nebularnoise opened this issue Aug 26, 2018 · 0 comments
Open

One layer only does not compile #41

nebularnoise opened this issue Aug 26, 2018 · 0 comments

Comments

@nebularnoise
Copy link

I tried to compile a file where I removed all layers except layer 0, and nothing happened.
I thought the UI froze, because the Download buttons were deactivated, but I then realised this was intentional.

However, I saw an error message in the console: key[0].keycodes[layer] is undefined

I think the culprate is src/files/generators/keymap.c.js:

for (let layer = 0; layer < C.KEYMAP_MAX_LAYERS; layer ++) {
	let layerMap = '\tKEYMAP(\n\t\t';
	for (let row = 0; row < keyboard.rows; row ++) {
		for (let col = 0; col < keyboard.cols; col ++) {
			const key = keyboard.wiring[row + ',' + col];
			if (!key || !key.length) continue;
				layerMap += key[0].keycodes[layer].getCode() + ', ';
		}
		layerMap += '\n\t\t';
	}
	layerMap = layerMap.substring(0, layerMap.length - 5) + '),\n\n';
	keymaps += layerMap;
}

For some reason, that for loop looks a bit dodgy. It seems to assume that there will always be the max amount of layers.

I don't know if that is supposed to be the case.

I did modify my layout file by hand, and in order to get a clean, human-readable JSON, I removed the unused layers. If that's not supported, that should either fail gracefully or maybe add KC_TRNS keycodes by default ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant