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] Radio conversion improvements #5534

Merged
merged 9 commits into from Dec 18, 2017

Conversation

Projects
None yet
3 participants
@mpaperno
Copy link
Member

mpaperno commented Dec 18, 2017

The goal here is twofold: 1) Provide better conversion and validation of new settings, and 2) inform the user what exactly was done and (especially) what couldn't be converted properly. Related: #4264

I added a rudimentary conversion state tracker/logger class which accumulates conversion details throughout the process and afterwards can return a full log of events. This state is passed around between the conversion functions of the various modules.

After conversion, if any messages are generated then the log data is presented in a table view dialog which I enhanced to provide text and HTML export functions (clipboard copy or save to file). The dialog is modeless so you can keep it open while looking at the converted models. Errors (e.g. missing hardware controls) are highlighted in red, conversions (e.g. SE->SG) in orange, and "adjustments" (e.g. X9 SF -> X7 SF) in black. Suggestions to improve the wording or presentation here are welcome.

Since the state tracker keeps a copy of the old radio data, we could theoretically launch model compare after conversion, or other ideas. That will need some UI work since obviously we don't want to launch a bunch of compare windows at the same time or if user isn't interested. Thoughts for later.

I also spent some time making sure conversions can't happen by accident on an unsaved file (if switching radio type user is prompted to save or cancel), and letting the user opt-out of conversion altogether. The system will detect if you're changing radio type via either a profile switch or when editing profile settings. It also will not let you delete the active profile if you have unsaved file changes.

And finally the conversion process itself got some additions and fixes:

  • Make sure all switches/pots/knobs have default configs for destination board type;
  • Try to move more custom control names, intelligently;
  • Convert model timers and throttle source;
  • Adjust for Horus 6P switch in place of Taranis S2 knob;
  • Adjust for extra sliders on X12 and X9E to move LS and RS to proper slots as needed;
  • Make sure ALL controls are validated, eg. to always account for extra trims/analogs/switches/etc which don't exist on destination;
  • Properly indicate invalid RawSource::toString() items with "???".

Diffs should be easier to absorb per-commit vs. all at once... I tried to break them up logically.

This will conflict a little with my other open PR #5437, so I will need to rebase after that is merged (already tested), or vice versa.

"Extreme" example converting a couple X12 radio files to X7:

image

image

image

mpaperno added some commits Dec 11, 2017

Add RawSource::isAvailable() and RawSwitch::isAvailable(); Add board …
…type param to various RawSource lookup functions.
Add CustomFunctionData::toString(), FlightModeData::toString(), Facto…
…ryInstalledPots board capability, MAX_SWITCH_TYPE, & break out GeneralSettings source/switch defaults to own function.
Implement RadioDataConversionState handler, add conversion process re…
…port, and improve/fix conversion issues:

    * Make sure all switches/pots/knobs have default configs for destination board type;
    * Try to move more custom control names, intelligently;
    * Convert model timers and throttle source;
    * Adjust for Horus 6P switch in place of Taranis S2 knob;
    * Adjust for extra sliders on X12 and X9E to move LS and RS to proper slots as needed;
    * Make sure ALL controls are validated, eg. to always account for extra trims/analogs/switches/etc which don't exist on destination;
    * Properly indicate invalid RawSource::toString() items with "???".
Allow user to cancel out of file conversions & provide ample warnings…
… if switching radio type/profile with unsaved file(s) still open;

Also: Fix bug with some orphaned MdiChild windows never being deleted; Create static bool Storage::isBoardCompatible(b1, b2).
@mpaperno

This comment has been minimized.

Copy link
Member Author

mpaperno commented Dec 18, 2017

This is the prompt that happens if you try to change radio type in profile with open modified file(s):

image

And if you try to switch to an incompatible radio via the profiles menu:

image

@kilrah

This comment has been minimized.

Copy link
Member

kilrah commented Dec 18, 2017

Wow that's awesome again!

@@ -98,9 +98,14 @@ class StorageFormat
return getFourCC(board);
}

virtual bool isBoardCompatible(Board::Type board)
static bool isBoardCompatible(Board::Type board1, Board::Type board2)

This comment has been minimized.

@mpaperno

mpaperno Dec 18, 2017

Author Member

@bsongis Should we move this to Boards class? With the getFourCC()? Boards already manages getEEPromSize() and getFlashSize(). If anything, seems like all those go together.

This comment has been minimized.

@bsongis

bsongis Dec 18, 2017

Member

yes it makes sense

@mpaperno mpaperno force-pushed the mpaperno/cpn_conversions branch from f9b3922 to 3a5719f Dec 18, 2017

@bsongis bsongis merged commit 0dbad18 into 2.2 Dec 18, 2017

0 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
continuous-integration/travis-ci/push The Travis CI build is in progress
Details

@bsongis bsongis deleted the mpaperno/cpn_conversions branch Dec 18, 2017

@bsongis

This comment has been minimized.

Copy link
Member

bsongis commented Dec 18, 2017

Thanks for this one!

mr-pokryshkin added a commit to mr-pokryshkin/opentx that referenced this pull request Dec 19, 2017

[Companion] Radio conversion improvements (opentx#5534)
* Move MultiposPots & MultiposPotsPositions capability lookups and getAnalogInputName() to Boards class.

* Add RawSource::isAvailable() and RawSwitch::isAvailable(); Add board type param to various RawSource lookup functions.

* Add CustomFunctionData::toString(), FlightModeData::toString(), FactoryInstalledPots board capability, MAX_SWITCH_TYPE, & break out GeneralSettings source/switch defaults to own function.

* Add RadioDataConversionState class for tracking conversion actions.

* Implement RadioDataConversionState handler, add conversion process report, and improve/fix conversion issues:
    * Make sure all switches/pots/knobs have default configs for destination board type;
    * Try to move more custom control names, intelligently;
    * Convert model timers and throttle source;
    * Adjust for Horus 6P switch in place of Taranis S2 knob;
    * Adjust for extra sliders on X12 and X9E to move LS and RS to proper slots as needed;
    * Make sure ALL controls are validated, eg. to always account for extra trims/analogs/switches/etc which don't exist on destination;
    * Properly indicate invalid RawSource::toString() items with "???".

* Allow user to cancel out of file conversions & provide ample warnings if switching radio type/profile with unsaved file(s) still open;
Also: Fix bug with some orphaned MdiChild windows never being deleted; Create static bool Storage::isBoardCompatible(b1, b2).

* Add maxLibQt "stub" (will not compile).

* Add ExportableTableView for better presentation of conversion results table.

* Move getFourCC() and isBoardCompatible() to Boards class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment