Skip to content

Commit 27c981a

Browse files
author
Hrvoje Cavrak
committed
Various bugfixes and improvements
- Firmware version and checksum were incorrectly parsed. Welp, this is embarassing - struct defined u32, but struct.pack in Python helper packed it as 16-bit. ->> Might require manual fw upgrade <<- - Fixed threshold issue setting for jumping between outputs (#192) - Fixed hotkey configuration clowntown (#197)
1 parent 41a54e4 commit 27c981a

File tree

9 files changed

+29
-28
lines changed

9 files changed

+29
-28
lines changed

disk/disk.img

0 Bytes
Binary file not shown.

misc/crc32.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111

1212
with open(elf_filename, 'r+b') as f:
1313
data = f.read()
14-
14+
1515
data = data[:-FLASH_SECTOR_SIZE]
1616
crc32_value = binascii.crc32(data) & 0xFFFFFFFF
1717

1818
with open(output_filename, 'wb') as f:
19-
f.write(struct.pack('<HHI', MAGIC_VALUE, int(version), crc32_value))
20-
19+
f.write(struct.pack('<IHI', MAGIC_VALUE, int(version), crc32_value))

src/defaults.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const config_t default_config = {
5858
.force_kbd_boot_protocol = ENFORCE_KEYBOARD_BOOT_PROTOCOL,
5959
.force_mouse_boot_mode = false,
6060
.enable_acceleration = ENABLE_ACCELERATION,
61-
.hotkey_toggle = HID_KEY_F24,
61+
.hotkey_toggle = HOTKEY_TOGGLE,
6262
.kbd_led_as_indicator = KBD_LED_AS_INDICATOR,
63-
.jump_threshold = 0,
63+
.jump_threshold = JUMP_THRESHOLD,
6464
};

src/include/user_config.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,20 +33,22 @@
3333
*
3434
* defined as HID_KEY_<something>
3535
*
36-
* In addition, keyboard.c defines right ctrl as a modifier key required to
37-
* activate this. So, the current shortcut is RIGHT CTRL + whatever is defined
38-
* here.
36+
* In addition, there is an optional modifier you can use for the hotkey
37+
* switching. Currently, it's set to LEFT CTRL, you can change it by
38+
* redefining HOTKEY_MODIFIER here from KEYBOARD_MODIFIER_LEFTCTRL to something
39+
* else (check file referenced below) or HID_KEY_NONE.
3940
*
4041
* If you do not want to use a key for switching outputs, you may be tempted
41-
* to select HID_KEY_NONE here; don't do that! That code appears in many HID
42-
* messages and the result will be a non-functional keyboard. Instead, choose
42+
* to select HID_KEY_NONE here as well; don't do that! That code appears in many
43+
* HID messages and the result will be a non-functional keyboard. Instead, choose
4344
* a key that is unlikely to ever appear on a keyboard that you will use.
4445
* HID_KEY_F24 is probably a good choice as keyboards with 24 function keys
4546
* are rare.
4647
*
4748
* */
4849

49-
#define HOTKEY_TOGGLE HID_KEY_CAPS_LOCK
50+
#define HOTKEY_MODIFIER KEYBOARD_MODIFIER_LEFTCTRL
51+
#define HOTKEY_TOGGLE HID_KEY_CAPS_LOCK
5052

5153
/**================================================== *
5254
* ============== Mouse Speed Factor ============== *

src/keyboard.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
hotkey_combo_t hotkeys[] = {
1919
/* Main keyboard switching hotkey */
20-
{.modifier = KEYBOARD_MODIFIER_LEFTCTRL,
20+
{.modifier = HOTKEY_MODIFIER,
2121
.keys = {HOTKEY_TOGGLE},
2222
.key_count = 1,
2323
.pass_to_os = false,

webconfig/config-unpacked.htm

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ <h3>Output A</h3>
798798
<input class="range api" type="range" name="aRange12" data-type="int32" data-key="12"
799799
onchange="valueChangedHandler(this)"
800800

801-
min="" max="" oninput="this.form.aInput12.value=this.value" />
801+
min="1" max="100" oninput="this.form.aInput12.value=this.value" />
802802
</form>
803803

804804
</div>
@@ -832,7 +832,7 @@ <h3>Output A</h3>
832832
<input class="range api" type="range" name="aRange13" data-type="int32" data-key="13"
833833
onchange="valueChangedHandler(this)"
834834

835-
min="" max="" oninput="this.form.aInput13.value=this.value" />
835+
min="1" max="100" oninput="this.form.aInput13.value=this.value" />
836836
</form>
837837

838838
</div>
@@ -1146,7 +1146,7 @@ <h3>Output B</h3>
11461146
<input class="range api" type="range" name="aRange42" data-type="int32" data-key="42"
11471147
onchange="valueChangedHandler(this)"
11481148

1149-
min="" max="" oninput="this.form.aInput42.value=this.value" />
1149+
min="1" max="100" oninput="this.form.aInput42.value=this.value" />
11501150
</form>
11511151

11521152
</div>
@@ -1180,7 +1180,7 @@ <h3>Output B</h3>
11801180
<input class="range api" type="range" name="aRange43" data-type="int32" data-key="43"
11811181
onchange="valueChangedHandler(this)"
11821182

1183-
min="" max="" oninput="this.form.aInput43.value=this.value" />
1183+
min="1" max="100" oninput="this.form.aInput43.value=this.value" />
11841184
</form>
11851185

11861186
</div>
@@ -1522,7 +1522,7 @@ <h3>Common Config</h3>
15221522
<div class="clearfix">
15231523
<form>
15241524

1525-
<label class="label-inline"> Jump Treshold=</label>
1525+
<label class="label-inline"> Jump Threshold=</label>
15261526

15271527

15281528

@@ -1535,7 +1535,7 @@ <h3>Common Config</h3>
15351535
<input class="range api" type="range" name="aRange77" data-type="uint16" data-key="77"
15361536
onchange="valueChangedHandler(this)"
15371537

1538-
min="" max="" oninput="this.form.aInput77.value=this.value" />
1538+
min="0" max="3000" oninput="this.form.aInput77.value=this.value" />
15391539
</form>
15401540

15411541
</div>
@@ -1650,13 +1650,13 @@ <h3>Device Status</h3>
16501650

16511651

16521652

1653-
1654-
<label class="label-inline"> Running FW version:</label>
1653+
1654+
<label class=""> Running FW version</label>
16551655

1656-
1657-
<input class="content api" type="text" name="name78" data-type="uint16" data-key="78"
1656+
1657+
<input class="api" type="text" name="name78" data-type="uint16" data-key="78"
16581658
onchange="valueChangedHandler(this)"
1659-
data-hex readonly />
1659+
/>
16601660

16611661

16621662

webconfig/config.htm

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

webconfig/form.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ class FormField:
2222
}
2323

2424
STATUS_ = [
25-
FormField(78, "Running FW version", None, {}, "uint16", elem="hex_info"),
25+
FormField(78, "Running FW version", None, {}, "uint16", elem="uint16"),
2626
FormField(79, "Running FW checksum", None, {}, "uint32", elem="hex_info"),
2727
]
2828

2929
CONFIG_ = [
3030
FormField(1001, "Mouse", elem="label"),
3131
FormField(71, "Force Mouse Boot Mode", None, {}, "uint8", "checkbox"),
3232
FormField(75, "Enable Acceleration", None, {}, "uint8", "checkbox"),
33-
FormField(77, "Jump Treshold", 0, {"min": 0, "max": 1024}, "uint16", "range"),
33+
FormField(77, "Jump Threshold", 0, {"min": 0, "max": 3000}, "uint16", "range"),
3434

3535
FormField(1002, "Keyboard", elem="label"),
3636
FormField(72, "Force KBD Boot Protocol", None, {}, "uint8", "checkbox"),

webconfig/templates/form.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
readonly oninput="this.form.aRange{{ key }}.value=this.value" />
2929

3030
{{ input(item, class='range api', type='range', name='aRange') }}
31-
min="{{ item.values.min }}" max="{{ item.values.max }}" oninput="this.form.aInput{{key}}.value=this.value" />
31+
min="{{ item['values'].min }}" max="{{ item['values'].max }}" oninput="this.form.aInput{{key}}.value=this.value" />
3232
</form>
3333

3434
</div>
@@ -55,4 +55,4 @@
5555
{{ input(item) }} />
5656

5757
{% endif %}
58-
{% endblock %}
58+
{% endblock %}

0 commit comments

Comments
 (0)