Improve settings migration and management (#5107)
[opentx.git] / companion / src / wizarddata.h
blob76b8a3db25515c58753947943fb1660eba5f9fdd
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _WIZARDDATA_H_
22 #define _WIZARDDATA_H_
24 #include "eeprominterface.h"
26 #define WIZ_MAX_CHANNELS 8
27 // TODO use a constant common to the whole companion
28 // TODO when in the wizard use the getCapacity(...) to know how long the name can be
29 #define WIZ_MODEL_NAME_LENGTH 12
31 enum Input {
32 NO_INPUT,
33 RUDDER_INPUT,
34 ELEVATOR_INPUT,
35 THROTTLE_INPUT,
36 AILERONS_INPUT,
37 FLAPS_INPUT,
38 AIRBRAKES_INPUT
41 enum Vehicle {
42 NOVEHICLE,
43 PLANE,
44 MULTICOPTER,
45 HELICOPTER
48 #define WIZ_MAX_OPTIONS 3
49 enum Options {
50 FLIGHT_TIMER_OPTION,
51 THROTTLE_CUT_OPTION,
52 THROTTLE_TIMER_OPTION
55 enum WizardPage {
56 Page_None = -1,
57 Page_Models,
58 Page_Throttle,
59 Page_Wingtypes,
60 Page_Ailerons,
61 Page_Flaps,
62 Page_Airbrakes,
63 Page_Elevons,
64 Page_Rudder,
65 Page_Tails,
66 Page_Tail,
67 Page_Vtail,
68 Page_Simpletail,
69 Page_Cyclic,
70 Page_Gyro,
71 Page_Flybar,
72 Page_Fblheli,
73 Page_Helictrl,
74 Page_Multirotor,
75 Page_Options,
76 Page_Conclusion
79 class Channel
81 public:
82 WizardPage page; // Originating dialog, only of interest for producer
83 bool prebooked; // Temporary lock variable
84 Input input1;
85 Input input2;
86 int weight1;
87 int weight2;
89 Channel();
90 void clear();
93 class WizMix
95 public:
96 bool complete;
97 char name[WIZ_MODEL_NAME_LENGTH + 1];
98 unsigned int modelId;
99 const GeneralSettings & settings;
100 const ModelData & originalModelData;
101 Vehicle vehicle;
102 Channel channel[WIZ_MAX_CHANNELS];
103 bool options[WIZ_MAX_OPTIONS];
105 WizMix(const GeneralSettings & settings, unsigned int modelId, const ModelData & modelData);
106 operator ModelData();
108 private:
109 WizMix();
110 void addMix(ModelData & model, Input input, int weight, int channel, int & mixerIndex);
111 void maxMixSwitch(char *name, MixData &mix, int destCh, int sw, int weight);
115 #endif // _WIZARDDATA_H_