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

Add layout 4+2B right side 3QRT+1QRT #3315

Merged
merged 3 commits into from
Apr 10, 2023
Merged

Conversation

daniel-snowsurf
Copy link
Contributor

Add a new layout 4+2 where the right side of the screen has two areas with 3 quarters and 1 quarter in height.
Changes apply to radio firmware and Simulator.

@pfeerick pfeerick added enhancement ✨ New feature or request color Related generally to color LCD radios widget labels Mar 7, 2023
@pfeerick pfeerick added this to the 2.9 milestone Mar 7, 2023
@daniel-snowsurf
Copy link
Contributor Author

There is a problem in simulator (not tested on the radio). I can set and configure this layout, and it gets saved to model2.yml file. But when starting simulator again this layout (and the following layouts) doesn't show up (see last picture).
Model YML file: model2.yml.txt

Image1
Image2
Image3
Image4
Image5 - Error missing views

@philmoz
Copy link
Collaborator

philmoz commented Mar 8, 2023

There is a problem in simulator (not tested on the radio). I can set and configure this layout, and it gets saved to model2.yml file. But when starting simulator again this layout (and the following layouts) doesn't show up (see last picture).

Was this using the standalone simulator or did you run the simulator from Companion?

If you start the simulator from Companion then changes made in the simulator are not saved on exit.

@pfeerick
Copy link
Member

pfeerick commented Mar 8, 2023

Good point. If you run Simulator via Companion, it is simulating just the .etx file you have created in Companion.

However, if you start the Firmware Simulator directly, any of the modes you run it in there (file, folder or sdcard) will write settings and thus persist across sessions.

image

@daniel-snowsurf
Copy link
Contributor Author

daniel-snowsurf commented Mar 8, 2023

Just fixing it right now, it seems to be related to layout name length
datastructs_private.h
#define LAYOUT_ID_LEN 11 // Add 1 char more for Layout4P2B
and tweek the checksizes
datastructs.h
CHKSIZE(CustomScreenData, 851); // Add 1 byte for CustomScreenData
CHKSIZE(ModelData, 11133); // Add 5 bytes for all CustomScreenData
I'll confirm later.

@daniel-snowsurf
Copy link
Contributor Author

I'm testing with Simulator directly, not using Companion.

@philmoz
Copy link
Collaborator

philmoz commented Mar 8, 2023

Just fixing it right now, it seems to be related to layout name length
#define LAYOUT_ID_LEN 11 // Add 1 char more for Layout4P2B
and tweek the checksizes
CHKSIZE(CustomScreenData, 851); // Add 1 byte for CustomScreenData
CHKSIZE(ModelData, 11133); // Add 5 bytes for allCustomScreenData
I'll confirm later.

Might be better to set LAYOUT_ID_LEN to 12 to avoid potential data alignment issues in CustomScreenData.

@pfeerick
Copy link
Member

pfeerick commented Mar 8, 2023

Just a FYI, any changes to datastructs_private.h will require generate_yaml.h to be re-run, as well as of the relevant datastructs.h tweaked - in this case it should only be the ones for the colorlcd radios, so the PCBHORUS and PCBNV14 groups.

@daniel-snowsurf
Copy link
Contributor Author

I couldn't get the LayoutId "Layout4P2B" with 10 chars working, so I shortened the Id to "Layout4PB" with 9 chars. Now it works properly.

@daniel-snowsurf
Copy link
Contributor Author

daniel-snowsurf commented Mar 9, 2023

@pfeerick can you approve the workflows so I can get built the windows version of Companion & Simulator (too lazy to set up the Windows toolchain). So far I've only tested the Linux version. Thanks.

@elecpower
Copy link
Collaborator

@daniel-snowsurf changing the radio data struct will also require a matching change in Companion or the field will be truncated on writing the yml files. For this PR you need to change this line

constexpr int LAYOUT_ID_LEN {10};

@daniel-snowsurf
Copy link
Contributor Author

Thanks @elecpower, already found it, but changing LayoutId length is not working, The whole layout is not properly saved into the YAML file. The custom screen data is generated properly, but the YAML writer is not getting it right. Any clue?

@elecpower
Copy link
Collaborator

@daniel-snowsurf which yaml writer? Radio, Companion or both?

@philmoz
Copy link
Collaborator

philmoz commented Mar 10, 2023

AFAIK the LayoutID is only used when saving/loading from the yaml file - it is not shown to the user, so it can be anything we want it to be.

There is no reason for all the layout ID names to start with 'Layout' - shorten this to 'Lyt' and you have plenty of room for other stuff.

@pfeerick
Copy link
Member

Good point... probably something for a future PR though, as it would need a custom reader added to convert Layout to Lyt on load on the radio, aide, as well as changes for Companion.

@philmoz
Copy link
Collaborator

philmoz commented Mar 10, 2023

Good point... probably something for a future PR though, as it would need a custom reader added to convert Layout to Lyt on load on the radio, aide, as well as changes for Companion.

I wasn't suggesting changing the existing ones - just that any new layouts, like the one, can be more flexible with their naming.

@daniel-snowsurf
Copy link
Contributor Author

Thanks @pfeerick for your work. The simulator works nicely with the T18 radio in Windows. With that I can update my models and widgets to EdgeTX. Waiting for the merge.
I've spend many hours trying to do it myself, but couldn't get the screenData size right.

@pfeerick
Copy link
Member

pfeerick commented Mar 14, 2023

Thanks for the confirmation. While I agree with Phil that the internal use layout names could be shorter, I think they should all be uniformly named so they are easily managed and no mistakes made later if they do get changed. i.e. it's the incremental changes that have a habit of shooting us in the foot, three or four changes later.

@daniel-snowsurf
Copy link
Contributor Author

Tested on Radioking TX18S, the new layout works fine.

@pfeerick pfeerick self-assigned this Apr 7, 2023
@pfeerick pfeerick merged commit f935ce8 into EdgeTX:main Apr 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
color Related generally to color LCD radios enhancement ✨ New feature or request widget
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants