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

chore(cpn): generic simulator #5692

Merged
merged 44 commits into from
Jan 1, 2025
Merged

Conversation

elecpower
Copy link
Collaborator

@elecpower elecpower commented Dec 1, 2024

Summary of changes:

  • convert all radios to use the generic simulator ui ie no custom graphics
  • option for buttons to be split left and right (default), all left or all right of lcd
  • user selectable radio 'case' colour per profile (default: black)
  • optional radio buttons for scroll up and down for those with mouse without scroll wheel. Keyboard shortcuts still available.
  • Surface radios move all trims from around sticks to centre

Benefits:

  • faster support for new radios in Companion
  • less dev effort
  • reduced the executable file size and compilation time of companion and simulator

Radio profile new Radio Case Colour setting
Screenshot from 2024-12-19 16-02-05

Simulator new settings
Screenshot from 2024-12-19 16-03-06

Surface radio with trims in centre, keys default positions and scroll keys
Screenshot from 2024-12-17 17-30-39

TX16S with keys RHS and no scroll keys and change of case colour
Screenshot from 2024-12-17 17-32-33

TX16S with keys LHS, scroll keys and change of case colour
Screenshot from 2024-12-17 17-33-58

GX12
Screenshot from 2024-12-17 17-51-35

@elecpower elecpower marked this pull request as draft December 1, 2024 23:23
@elecpower elecpower added companion Related to the companion software simulator labels Dec 1, 2024
@philmoz
Copy link
Collaborator

philmoz commented Dec 1, 2024

Should we consider adding buttons for the left/right roller movements to the generic UI?

There are keyboard mappings; but these aren't obvious, so navigation can be challenging if your mouse does not have a scroll wheel.

@elecpower
Copy link
Collaborator Author

Should we consider adding buttons for the left/right roller movements to the generic UI?

There are keyboard mappings; but these aren't obvious, so navigation can be challenging if your mouse does not have a scroll wheel.

I do not see why not and there could even be a Simulator setting option as to whether they display or not.

@elecpower
Copy link
Collaborator Author

Also planning to move trims from around joysticks for surface radios to centre where extra trims now go

@EdgeTX EdgeTX locked and limited conversation to collaborators Dec 4, 2024
@EdgeTX EdgeTX unlocked this conversation Dec 4, 2024
@philmoz
Copy link
Collaborator

philmoz commented Dec 5, 2024

Currently the simulator UI for B&W radios with OLED screens switches the LCD colors so the simulator is white text on a black background (to match the physical display).

The generic UI should probably have some method to handle this as well.

@pfeerick pfeerick changed the title chore(cpn) generic simulator chore(cpn): generic simulator Dec 6, 2024
@elecpower elecpower force-pushed the elecpower/cpn-generic-simulator branch 2 times, most recently from 1af28aa to 3858b30 Compare December 13, 2024 05:32
@elecpower elecpower marked this pull request as ready for review December 15, 2024 20:44
@elecpower elecpower force-pushed the elecpower/cpn-generic-simulator branch from 0ace67e to 99b157d Compare December 16, 2024 19:36
@elecpower
Copy link
Collaborator Author

fyi I've updated the sample images in the description.

Radio 'case' colour should I make it per radio profile rather than same for all? I'm leaning towards per radio profile as not much more effort.

@pfeerick
Copy link
Member

pfeerick commented Dec 19, 2024

This is looking great! :)

Radio 'case' colour should I make it per radio profile rather than same for all? I'm leaning towards per radio profile as not much more effort.

Per profile would be nice, as if you have more than one radio and they are different colours you have the option of making the background colour match...

@elecpower
Copy link
Collaborator Author

Radio case colour changed to per radio profile

@elecpower elecpower force-pushed the elecpower/cpn-generic-simulator branch from 1f1ad84 to 1e627d0 Compare December 19, 2024 05:17
@pfeerick pfeerick added this to the 2.11 milestone Dec 20, 2024
@elecpower
Copy link
Collaborator Author

elecpower commented Dec 20, 2024

I have tried to make them intuitive but there are a couple of odd ones. Mac users please advise if not on standard keyboard especially Macbook.

Latest mappings
KEY_SYS S
KEY_MODEL M
KEY_PAGEUP PageUp
KEY_PAGEDN PageDown
KEY_UP Up arrow
KEY_DOWN Down arrow
KEY_LEFT Left arrow
KEY_RIGHT Right arrow
KEY_MINUS - (Minus)
KEY_PLUS + (Plus)
KEY_TELE T
KEY_MENU = (Equal)
KEY_SHIFT Insert
KEY_EXIT Esc or Backspace
KEY_ENTER Enter or Return
KEY_SCROLL_UP , (comma)
KEY_SCROLL_DOWN . (period)

@pfeerick
Copy link
Member

pfeerick commented Dec 22, 2024

Just FYI, on Windows and Linux:

KEY_SCROLL_UP < (Less than)
KEY_SCROLL_DOWN > (Greater than)

really is < and > so you need to use shift key. ;)

Any chance of getting Backspace back as another shortcut for KEY_EXIT... saves reaching all the way over for ESC 🤣

Cursor keys on windows (left/right/up/down) appear to run afoul of UI element focus... i.e. with T-Lite I need to click the LCD display, and then the right arrow only works once... it seems like up only works every second press, and down only the first time. Clicking on the LCD between each key press works perfectly though 🤔

Other than that, and some work being needed for the NV14/EL18/PL18 (the "switchable hats" thing) which IMO can be resurrected in a separate PR so this can go in sooner than later, this is looking great. Switching to Linux to continue there. Ok, Linux is working fine/just the same... buttons and profile settings seem good, and just the input focus being lost when using the shortcuts.

@elecpower
Copy link
Collaborator Author

elecpower commented Dec 22, 2024

really is < and > so you need to use shift key

@philmoz has asked for unshifted to ',' and '.'

Any chance of getting Backspace back as another shortcut for KEY_EXIT... saves reaching all the way over for ESC

Yes

Cursor keys on windows (left/right/up/down) appear to run afoul of UI element focus

I don't think it is focus but they need another mouse or key event. But this is not required for other keys. Pressing a button with arrows assigned doesn't suffer from the same issue as far as I've found. The two methods do not follow the exact code path so its running in debug mode time.

Thanks for testing.

@pfeerick
Copy link
Member

unshifted to ',' and '.'

Excellent... To be honest, it was annoying, but consistent. The unshifted minus and shifted plus is more annoying. 🤪

re: focus... I am seeing the focus rectangle on the button when the shortcut is pressed, hence why I think the keyboard focus is being lost, but yeah, debug should reveal all.

@elecpower
Copy link
Collaborator Author

The unshifted minus and shifted plus is more annoying

Not if you use the keypad

@philmoz
Copy link
Collaborator

philmoz commented Dec 22, 2024

MacOS:

  • TX16S - all keyboard shortcuts working
  • T15 - missing rotary encoder buttons and keyboard shortcuts
  • TLITE - arrows keys starting to work

On the TLITE the Up arrow works on every second press. The Down arrow works if I click on the LCD display; but only once. I have to keep clicking on the LCD display section between each press of the down arrow.

@elecpower
Copy link
Collaborator Author

elecpower commented Dec 22, 2024

The keypress is being lost/consumed by another object but strangely the keyrelease is being received. So that object is likely only intercepting keypress and not putting back on the event stack if it doesn't use it.

The mouse click resets the arrow keys or as @pfeerick and yourself state is refocuses the key events back to the radio widget.

So far all the other special keys don't suffer from this issue.

@philmoz
Copy link
Collaborator

philmoz commented Dec 22, 2024

GX12 also needs rotary encoder buttons and shortcuts.

@elecpower
Copy link
Collaborator Author

elecpower commented Dec 23, 2024

@pfeerick @philmoz you are on the right track as this post indicates
https://forum.qt.io/topic/153217/key-press-arrow-keys-cause-loss-of-focus

So now to find the focus stealer.

@pfeerick
Copy link
Member

pfeerick commented Dec 23, 2024 via email

@elecpower elecpower force-pushed the elecpower/cpn-generic-simulator branch from 76e0a63 to 267baca Compare December 23, 2024 03:14
@elecpower elecpower force-pushed the elecpower/cpn-generic-simulator branch from 0a24ff4 to 6d1f4c9 Compare December 31, 2024 22:13
@elecpower
Copy link
Collaborator Author

Much appreciated, and welcome to 2025! :) So where are we at with this... do I just need to poke it a little more and then merge if nothing breaks (i.e. today), or is there more stuff to be done?

Happy New Year to you too. Merge if you cannot break. I believe there are still some focus issues to resolve/reduce however let's not hold the change up for that.

@pfeerick
Copy link
Member

pfeerick commented Jan 1, 2025

Nothing is jumping out at me... and I didn't need to click the LCD once when trying with T-Lite/TX16S/X9D+2019 etc... was able to use keyboard shortcuts in all cases, so looks like you beat the majority if not all of the focus issues into submission ;)

Is something to resurrect the switchable hats (NV14/EL18/PL18) simulator functionally on the agenda soon? Before I ask about the customisable switches... and... just kidding!

@pfeerick pfeerick merged commit 7b1ae24 into main Jan 1, 2025
3 checks passed
@pfeerick pfeerick deleted the elecpower/cpn-generic-simulator branch January 1, 2025 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
companion Related to the companion software simulator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants