owlcms4 icon indicating copy to clipboard operation
owlcms4 copied to clipboard

FLIC2: Problem with Announcer screen programmable shortcuts

Open JDFS404 opened this issue 1 year ago • 26 comments

Is it possible to give the same shortcuts (unless . and , have different functions) to start or stop the clock? We run the clock from the Announcer screen 9/10 times and it would be great if we could program buttons for the Announcer as well to start or stop the clock without looking at the screen. Reason being is that sometimes we're short of referees and the Announcer is the third referee as well (I've been in that situation a couple of times).

JDFS404 avatar May 01 '23 19:05 JDFS404

Actually the announcer normally never enters decimals, so that might work. Looking into it.

jflamy avatar May 02 '23 16:05 jflamy

Well guess what. The code was already there. , starts the clock, . stops it.

jflamy avatar May 02 '23 16:05 jflamy

Great! Would it also be in line of expectations to have something similar for the 1 and 2-minute buttons? Perhaps [ and ]? In that way, we could map them to a USB-controller as well :)

JDFS404 avatar May 03 '23 11:05 JDFS404

Yes, https://www.w3.org/TR/uievents-code/#key-alphanumeric-writing-system indicates that the brackets can be used without ambiguity. Added to the announcer and timekeeper screen. Will show up in next release.

jflamy avatar May 03 '23 14:05 jflamy

Would it also be possible to map a keyboard shortcut as a toggle, so I can map one Flic button as a push device to basically toggle the clock? Perhaps \ or another button which is not in use?

JDFS404 avatar May 11 '23 08:05 JDFS404

To add to that, unfortunately for Flic Buttons only certain characters can be mapped: ./*-+= - could you find it in your heart to add these shortcuts for the stop/start, 1 min and 2 min shortcuts? In anticipation of the actual USB devices I would like use Flic buttons for the Announcer / Timekeeper for now.

JDFS404 avatar May 11 '23 08:05 JDFS404

Urk. . is already used, so I would suggest /. I will see what I can do for toggling. Due to current behavior, the toggle would probably be yet another key, maybe = (assuming there is a simple way to implement, what should be simple sometimes isn't.

jflamy-dev avatar May 11 '23 16:05 jflamy-dev

Thanks a lot Monsieur Lamy, perhaps a moment to remap [ and ] to - and + as well so we can map it?

JDFS404 avatar May 11 '23 18:05 JDFS404

Can't use - because it is actually used by the announcer to cancel a lift (-90 is no lift 90)

jflamy avatar May 11 '23 19:05 jflamy

Perhaps + for 2 minutes and * for 1 minute, and = for Toggle? It doesn't really matter to me which one is which, as long as I can map it 😄

JDFS404 avatar May 11 '23 19:05 JDFS404

Flic is a pain. For the program, I need to use what's on the keycap (the bottom symbol) and then tell it the key modifier (if I need Shift for example). So so far I avoided modifiers, will test to see if they work appropriately.,

. for stop / and , for start - for 1 minute = for 2 minutes

* would be toggle

jflamy avatar May 12 '23 16:05 jflamy

As it turns out, * as sent by Flic is the numeric keypad *. I have added both SHIFT+DIGIT_8 and the numeric multiply as shortcuts for toggling.

jflamy avatar May 12 '23 18:05 jflamy

I'm SO looking forward to test this! 🥇

JDFS404 avatar May 12 '23 19:05 JDFS404

Available in 38.5.3-rc00

jflamy avatar May 12 '23 20:05 jflamy

As it turns out - cannot be used. The only key left to use is + which the Flic sends as NumPad Add. So I added Shift= and numpad_add as shortcuts to reset to 1 min. Fixing the documentation and adding to the release notes.

jflamy avatar Jun 01 '23 01:06 jflamy

Hi @jflamy I recently purchases some new Flic buttons to have the announcer mapped as well.

Unfortunately, the shortcuts for ., , and = (start, stop and 2 min) don't seem to be working with Flic Universal Mode. Do you have any idea why? Because + is working (1 min), perhaps we should remap it or am I doing anything wrong?

JDFS404 avatar Feb 21 '24 08:02 JDFS404

I'm certain this works -- I will need to dig up a Flic2 button and app to check, but nothing has changed for years in that area.

These are the start shortcuts defined, directly from the code. I believe I had to add / because , would not work on a Flic. Note that the key is where the character is located on a US keyboard.

addShortcutListener(() -> doStartTime(), Key.COMMA);
addShortcutListener(() -> doStartTime(), Key.SLASH);
addShortcutListener(() -> doToggleTime(), Key.NUMPAD_MULTIPLY);
addShortcutListener(() -> doToggleTime(), Key.DIGIT_8, KeyModifier.SHIFT);

There is only one stop shortcut

addShortcutListener(() -> doStopTime(), Key.PERIOD);

These are the ones for one minute

addShortcutListener(() -> do1Minute(), Key.NUMPAD_ADD);
addShortcutListener(() -> do1Minute(), Key.EQUAL, KeyModifier.SHIFT);

and for 2 minutes

addShortcutListener(() -> do2Minutes(), Key.EQUAL);

jflamy avatar Feb 21 '24 23:02 jflamy

I tried it - with my keyboard from my Windows machine I'm able to use the shortcuts, however not with the Flic button. Only for the 1 min clock via +

JDFS404 avatar Feb 22 '24 15:02 JDFS404

I finally found a Flic2, managed to reset it, and managed to pair it with one of my laptops (my main laptop refuses to see it).

Well, never be certain of anything. It appears that the Flic2 sends the Numeric Keypad variations of the characters. On my North American laptop, Flic2 "." is seen as NUMERIC_DECIMAL (code 110) and Flic2 "/" is seen as NUMERIC_DIVIDE (code 111).

Please go to the site "https://toptal.com/developers/keycode" and confirm these values.

I will create a 46.0.0-beta06 in https://github.com/owlcms/owlcms4-prerelease/releases in a few minutes with the additional shortcuts. So you should use "." on the Flic2 to stop the clock and "/" to start it.

The updated list of shortcuts is as follows -- it appears you want the NUMPAD ones.

UI.getCurrent().addShortcutListener(() -> doStartTime(), Key.COMMA);
UI.getCurrent().addShortcutListener(() -> doStartTime(), Key.SLASH);
UI.getCurrent().addShortcutListener(() -> doStartTime(), Key.NUMPAD_DIVIDE);

UI.getCurrent().addShortcutListener(() -> doStopTime(), Key.PERIOD);
UI.getCurrent().addShortcutListener(() -> doStopTime(), Key.NUMPAD_DECIMAL);

UI.getCurrent().addShortcutListener(() -> doToggleTime(), Key.DIGIT_8, KeyModifier.SHIFT);
UI.getCurrent().addShortcutListener(() -> doToggleTime(), Key.NUMPAD_MULTIPLY);

UI.getCurrent().addShortcutListener(() -> do1Minute(), Key.EQUAL, KeyModifier.SHIFT);
UI.getCurrent().addShortcutListener(() -> do1Minute(), Key.NUMPAD_ADD);

UI.getCurrent().addShortcutListener(() -> do2Minutes(), Key.EQUAL);
UI.getCurrent().addShortcutListener(() -> do2Minutes(), Key.NUMPAD_EQUAL);

jflamy avatar Feb 22 '24 15:02 jflamy

I finally found a Flic2, managed to reset it, and managed to pair it with one of my laptops (my main laptop refuses to see it).

Well, never be certain of anything. It appears that the Flic2 sends the Numeric Keypad variations of the characters. On my North American laptop, Flic2 "." is seen as NUMERIC_DECIMAL (code 110) and Flic2 "/" is seen as NUMERIC_DIVIDE (code 111).

Please go to the site "https://toptal.com/developers/keycode" and confirm these values.

I will create a 46.0.0-beta06 in https://github.com/owlcms/owlcms4-prerelease/releases in a few minutes with the additional shortcuts. So you should use "." on the Flic2 to stop the clock and "/" to start it.

The updated list of shortcuts is as follows -- it appears you want the NUMPAD ones.

UI.getCurrent().addShortcutListener(() -> doStartTime(), Key.COMMA);
UI.getCurrent().addShortcutListener(() -> doStartTime(), Key.SLASH);
UI.getCurrent().addShortcutListener(() -> doStartTime(), Key.NUMPAD_DIVIDE);

UI.getCurrent().addShortcutListener(() -> doStopTime(), Key.PERIOD);
UI.getCurrent().addShortcutListener(() -> doStopTime(), Key.NUMPAD_DECIMAL);

UI.getCurrent().addShortcutListener(() -> doToggleTime(), Key.DIGIT_8, KeyModifier.SHIFT);
UI.getCurrent().addShortcutListener(() -> doToggleTime(), Key.NUMPAD_MULTIPLY);

UI.getCurrent().addShortcutListener(() -> do1Minute(), Key.EQUAL, KeyModifier.SHIFT);
UI.getCurrent().addShortcutListener(() -> do1Minute(), Key.NUMPAD_ADD);

UI.getCurrent().addShortcutListener(() -> do2Minutes(), Key.EQUAL);
UI.getCurrent().addShortcutListener(() -> do2Minutes(), Key.NUMPAD_EQUAL);

I just tested the beta - it works for start stop! It's not yet working for = aka 2 min clock. On JS this gives me 187 (but with or without modifier it's the same). perhaps we can also do another shortcut for the 2 min clock? This will complete our announcer buttons as well: image

JDFS404 avatar Feb 22 '24 16:02 JDFS404

Hi @jflamy any luck for the 2 min clock?

JDFS404 avatar Feb 28 '24 09:02 JDFS404

There is a shortcut for = and it does work with a regular keyboard. However Firefox and the other browsers don't send the same code. My battery in my Flic2 is dead -- I have others in a box somewhere that I need to find and investigate.

jflamy avatar Feb 28 '24 16:02 jflamy

Woops, I have my Flic tomorrow and will confirm the key code for = in the browser!

JDFS404 avatar Feb 28 '24 16:02 JDFS404

Got new batteries. The Flic2 sends the code for NUMPAD_EQUALS when the = shortcut is used. Also added ; as a shortcut. Please test 47.0.0-alpha03 (you can ignore the dire warnings at the top -- there are no crazy changes in this release)

Updated the documentation

Shortcuts

For shortcuts, the keys given are the key locations for a US keyboard. You will need to press the key at the location shown on this diagram, no matter what is actually printed on your keyboard.

The clock can be started by using the , (comma) or / keys on the keyboard. The / key on the numeric keypad also works. On the Flic2 buttons, this is the / shortcut.

The clock can be stopped by using the . (period) key on the keyboard. The decimal fraction character on the numeric keypad should also work (in many countries, the numeric keypad shows a , instead of a . to match the local usage for decimal fraction). For the Flic2 buttons, this is the . shortcut.

The clock can be reset to 1:00 by using the + key on the keyboard (more precisely, the key combination that corresponds to + on a US keyboard, that is, Shift=). Using the + key on the numeric keypad will also work. On the Flic2 buttons, this is the = shortcut.

The clock can be reset to 2:00 by using the = or ;key on the keyboard ). Using the + key on the numeric keypad will also work. On the Flic2 buttons, this is the = or ; shortcut.

jflamy avatar Feb 28 '24 22:02 jflamy

Just tested - it works perfectly :) Thank you for doing this for us, now we have a full announcer setup as well next to the referee buttons. This makes the comp for the announcer also easier to focus; no need to have to look at the screen every time to pause the clock! I think it's perfect to migrate to the production version!

JDFS404 avatar Feb 29 '24 21:02 JDFS404

I will add it to 46 that is on the doorstep. No plan to move it back to 45.

jflamy avatar Feb 29 '24 21:02 jflamy