Refactor setup hardware, trainer and calibration
This commit is contained in:
@@ -18,13 +18,19 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _BOARDS_H_
|
||||
#define _BOARDS_H_
|
||||
#pragma once
|
||||
|
||||
#include <QtCore>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
|
||||
class AbstractStaticItemModel;
|
||||
|
||||
// identiying names of static abstract item models
|
||||
constexpr char AIM_BOARDS_POT_TYPE[] {"boards.pottype"};
|
||||
constexpr char AIM_BOARDS_SLIDER_TYPE[] {"boards.slidertype"};
|
||||
constexpr char AIM_BOARDS_SWITCH_TYPE[] {"boards.switchtype"};
|
||||
|
||||
// TODO create a Board class with all these functions
|
||||
|
||||
namespace Board {
|
||||
@@ -64,13 +70,15 @@ namespace Board {
|
||||
POT_NONE,
|
||||
POT_WITH_DETENT,
|
||||
POT_MULTIPOS_SWITCH,
|
||||
POT_WITHOUT_DETENT
|
||||
POT_WITHOUT_DETENT,
|
||||
POT_TYPE_COUNT
|
||||
};
|
||||
|
||||
enum SliderType
|
||||
{
|
||||
SLIDER_NONE,
|
||||
SLIDER_WITH_DETENT
|
||||
SLIDER_WITH_DETENT,
|
||||
SLIDER_TYPE_COUNT
|
||||
};
|
||||
|
||||
enum SwitchType
|
||||
@@ -78,7 +86,8 @@ namespace Board {
|
||||
SWITCH_NOT_AVAILABLE,
|
||||
SWITCH_TOGGLE,
|
||||
SWITCH_2POS,
|
||||
SWITCH_3POS
|
||||
SWITCH_3POS,
|
||||
SWITCH_TYPE_COUNT
|
||||
};
|
||||
|
||||
enum StickAxes {
|
||||
@@ -130,7 +139,8 @@ namespace Board {
|
||||
SwitchPositions,
|
||||
FactoryInstalledSwitches,
|
||||
NumTrims,
|
||||
NumTrimSwitches
|
||||
NumTrimSwitches,
|
||||
HasRTC
|
||||
};
|
||||
|
||||
struct SwitchInfo
|
||||
@@ -149,6 +159,13 @@ namespace Board {
|
||||
unsigned int position;
|
||||
};
|
||||
|
||||
enum SwitchTypeMasks {
|
||||
SwitchTypeFlag2Pos = 0x01,
|
||||
SwitchTypeFlag3Pos = 0x02,
|
||||
SwitchTypeContext2Pos = SwitchTypeFlag2Pos,
|
||||
SwitchTypeContext3Pos = SwitchTypeFlag2Pos | SwitchTypeFlag3Pos
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
class Boards
|
||||
@@ -182,6 +199,12 @@ class Boards
|
||||
static QString getAnalogInputName(Board::Type board, int index);
|
||||
static bool isBoardCompatible(Board::Type board1, Board::Type board2);
|
||||
static QString getBoardName(Board::Type board);
|
||||
static QString potTypeToString(int value);
|
||||
static QString sliderTypeToString(int value);
|
||||
static QString switchTypeToString(int value);
|
||||
static AbstractStaticItemModel * potTypeItemModel();
|
||||
static AbstractStaticItemModel * sliderTypeItemModel();
|
||||
static AbstractStaticItemModel * switchTypeItemModel();
|
||||
|
||||
protected:
|
||||
|
||||
@@ -361,5 +384,3 @@ inline bool IS_ACCESS_RADIO(Board::Type board, const QString & id)
|
||||
return (IS_TARANIS_XLITES(board) || IS_TARANIS_X9LITE(board) || board == Board::BOARD_TARANIS_X9DP_2019 || board == Board::BOARD_X10_EXPRESS || IS_TARANIS_X7_ACCESS(board) ||
|
||||
(IS_FAMILY_HORUS_OR_T16(board) && id.contains("internalaccess")));
|
||||
}
|
||||
|
||||
#endif // _BOARDS_H_
|
||||
|
||||
Reference in New Issue
Block a user