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

Companion firmware simulator crashes on loading or switching to model with internal MPM selected #3423

Closed
1 task done
mha1 opened this issue Apr 1, 2023 · 7 comments · Fixed by #3426
Closed
1 task done
Labels
bug/regression ↩️ A new version of EdgeTX broke something simulator

Comments

@mha1
Copy link
Contributor

mha1 commented Apr 1, 2023

Is there an existing issue for this problem?

  • I have searched the existing issues

What part of EdgeTX is the focus of this bug?

Companion

Current Behavior

Windows64 standalone firmware simulator crashes on starting up or switching to a model with internal MPM selected. This is the last Debug Output messages:
image

Expected Behavior

Don't crash

Steps To Reproduce

install Companion W64 version
run Firmware Simulator 2.8
select model with internal model MPM enabled

Version

2.8.2

Transmitter

Radiomaster TX16S / TX16SMK2

Anything else?

No response

@mha1 mha1 added bug 🪲 Something isn't working triage Bug report awaiting review / sorting labels Apr 1, 2023
@mha1
Copy link
Contributor Author

mha1 commented Apr 1, 2023

2.9 crashes also. Building Companion without #3369 resolves the problem (but of course unfixes the original problem it was fixing)

@pfeerick
Copy link
Member

pfeerick commented Apr 2, 2023

Hm, maybe we forgot to update something in companion as part of that pr. It'll probably be a few hours before I'll be in any fit state to look at this, but I'll try to look at it soon. Thanks for narrowing it down.

@pfeerick
Copy link
Member

pfeerick commented Apr 2, 2023

Hm... this gets weirder and weirder... it breaks on windows simulator, but not on Linux builds...

image

@pfeerick pfeerick added simulator bug/regression ↩️ A new version of EdgeTX broke something and removed triage Bug report awaiting review / sorting bug 🪲 Something isn't working labels Apr 2, 2023
@mha1
Copy link
Contributor Author

mha1 commented Apr 2, 2023

Don't know why Linux cpn is not crashing but anyhow it should produce questionable results. I think cpn is pretty outdated in this area as some cpn data structures need to reflect radio structures. The major pain point is the fact data structures are defined in both radio and cpn and even worse the data definitions are not identical. check out cpn's const Multiprotocols multiProtocols vs it's radio gui_common.cpp counterpart. Not even string definitions are shared, see QString Multiprotocols::protocolToString. And there is code in cpn's yaml de/encode to adjust for the FrSky mess. This is probably also outdated depending on how far radio code got cleaned up, see cpn's static void convertMultiProtocolToEtx and void convertEtxProtocolToMulti in yaml_moduledata.cpp. And maybe if (pdef.hasFailsafe || (module.multi.rfProtocol == MODULE_SUBTYPE_MULTI_FRSKY && (module.subType == 0 || module.subType == 2 || module.subType > 3 ))) in companion\src\modeledit\setup.cpp is dodgy too.

@pfeerick
Copy link
Member

pfeerick commented Apr 2, 2023 via email

@philmoz
Copy link
Collaborator

philmoz commented Apr 2, 2023

My guess would be it's the change to line 1259 in radio/src/gui/gui_common.cpp
{MODULE_SUBTYPE_MULTI_FRSKY_R9, 7, true, false, STR_SUBTYPE_FRSKYR9, nullptr},

The second value was 6; but was changed to 7. The value should be 6 (maxSubType, not subType count).
The code in fillSubProtoList is falling off the end of the array.

@mha1
Copy link
Contributor Author

mha1 commented Apr 2, 2023

You are absolutely right. Those values are not the number of entries but the max index (entries-1). It works. Nevertheless for Companion (not the simulator) to show the correct protocol and subtype entries it is required to use the same protocol and subtype definitions and strings.

mha1 added a commit to mha1/edgetx that referenced this issue Apr 2, 2023
@pfeerick pfeerick closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/regression ↩️ A new version of EdgeTX broke something simulator
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants