1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 12:25:12 +03:00

[Companion] Old EEPROM support removed

This commit is contained in:
Bertrand Songis 2016-11-23 16:23:05 +01:00
parent 9590b5f00e
commit 5f9737fc70
73 changed files with 1309 additions and 9277 deletions

View file

@ -88,18 +88,11 @@ add_subdirectory(thirdparty/qxtcommandoptions)
set(common_SRCS
eeprominterface.cpp
firmwares/th9x/th9xeeprom.cpp # TODO not needed
firmwares/th9x/th9xinterface.cpp
firmwares/er9x/er9xeeprom.cpp
firmwares/er9x/er9xinterface.cpp
firmwares/gruvin9x/gruvin9xeeprom.cpp
firmwares/gruvin9x/gruvin9xinterface.cpp
firmwares/ersky9x/ersky9xeeprom.cpp
firmwares/ersky9x/ersky9xinterface.cpp
firmwares/opentx/opentxeeprom.cpp
firmwares/opentx/open9xStockeeprom.cpp
firmwares/opentx/open9xGruvin9xeeprom.cpp
firmwares/opentx/open9xSky9xeeprom.cpp
firmwares/opentx/opentxinterface.cpp
)

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QApplication>
#include <QTranslator>
#include <QLocale>

View file

@ -17,7 +17,7 @@ class DragDropHeader {
}
bool general_settings;
uint8_t models_count;
uint8_t models[C9X_MAX_MODELS];
uint8_t models[CPN_MAX_MODELS];
};
CompareDialog::CompareDialog(QWidget * parent, Firmware * firmware):

View file

@ -17,28 +17,26 @@ enum BoardEnum {
BOARD_HORUS
};
#define C9X_MAX_MODELS 60
#define C9X_MAX_TIMERS 3
#define C9X_MAX_FLIGHT_MODES 9
#define C9X_MAX_MIXERS 64
#define C9X_MAX_INPUTS 32
#define C9X_MAX_EXPOS 64
#define C9X_MAX_CURVES 32
#define C9X_MAX_POINTS 17
#define C9X_MAX_GVARS 9
#define C9X_MAX_ENCODERS 2
#define C9X_NUM_CHNOUT 32 // number of real output channels
#define C9X_NUM_CSW 64 // number of custom switches
#define C9X_MAX_CUSTOM_FUNCTIONS 64 // number of functions assigned to switches
#define C9X_NUM_MODULES 2
#define NUM_STICKS 4
#define NUM_AUX_TRIMS 2
#define BOARD_9X_NUM_POTS 3
#define C9X_NUM_POTS 8
#define NUM_CAL_PPM 4
#define NUM_CYC 3
#define C9X_NUM_SWITCHES 32
#define C9X_NUM_KEYS 32
#define CPN_MAX_MODELS 60
#define CPN_MAX_TIMERS 3
#define CPN_MAX_FLIGHT_MODES 9
#define CPN_MAX_MIXERS 64
#define CPN_MAX_INPUTS 32
#define CPN_MAX_EXPOS 64
#define CPN_MAX_CURVES 32
#define CPN_MAX_POINTS 17
#define CPN_MAX_GVARS 9
#define CPN_MAX_ENCODERS 2
#define CPN_MAX_CHNOUT 32 // number of real output channels
#define CPN_MAX_CSW 64 // number of custom switches
#define CPN_MAX_CUSTOM_FUNCTIONS 64 // number of functions assigned to switches
#define CPN_MAX_MODULES 2
#define CPN_MAX_STICKS 4
#define CPN_MAX_AUX_TRIMS 2
#define CPN_MAX_POTS 8
#define CPN_MAX_CYC 3
#define CPN_MAX_SWITCHES 32
#define CPN_MAX_KEYS 32
const char * const ARROW_LEFT = "\xE2\x86\x90";
const char * const ARROW_UP = "\xE2\x86\x91";

View file

@ -1,19 +1,3 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef eeprom_importexport_h
#define eeprom_importexport_h

View file

@ -5,11 +5,9 @@
#include <stdlib.h>
#include "eeprominterface.h"
#include "firmwares/er9x/er9xinterface.h"
#include "firmwares/th9x/th9xinterface.h"
#include "firmwares/gruvin9x/gruvin9xinterface.h"
#include "firmwares/ersky9x/ersky9xinterface.h"
#include "firmwares/opentx/opentxinterface.h"
#include "firmwares/opentx/opentxeeprom.h"
#include "firmwares/ersky9x/ersky9xinterface.h"
#include "appdata.h"
#include "helpers.h"
#include "wizarddata.h"
@ -24,6 +22,8 @@ const uint8_t chout_ar[] = { // First number is 0..23 -> template setup, Second
4,1,2,3 , 4,1,3,2 , 4,2,1,3 , 4,2,3,1 , 4,3,1,2 , 4,3,2,1
};
static const char specialCharsTab[] = "_-.,";
void setEEPROMString(char *dst, const char *src, int size)
{
memcpy(dst, src, size);
@ -47,6 +47,52 @@ void getEEPROMString(char *dst, const char *src, int size)
}
}
int8_t char2idx(char c)
{
if (c==' ') return 0;
if (c>='A' && c<='Z') return 1+c-'A';
if (c>='a' && c<='z') return -1-c+'a';
if (c>='0' && c<='9') return 27+c-'0';
for (int8_t i=0;;i++) {
char cc = specialCharsTab[i];
if (cc==0) return 0;
if (cc==c) return 37+i;
}
}
#define ZCHAR_MAX 40
char idx2char(int8_t idx)
{
if (idx == 0) return ' ';
if (idx < 0) {
if (idx > -27) return 'a' - idx - 1;
idx = -idx;
}
if (idx < 27) return 'A' + idx - 1;
if (idx < 37) return '0' + idx - 27;
if (idx <= ZCHAR_MAX) return specialCharsTab[idx-37];
return ' ';
}
void setEEPROMZString(char *dst, const char *src, int size)
{
for (int i=size-1; i>=0; i--)
dst[i] = char2idx(src[i]);
}
void getEEPROMZString(char *dst, const char *src, int size)
{
for (int i=size-1; i>=0; i--)
dst[i] = idx2char(src[i]);
dst[size] = '\0';
for (int i=size-1; i>=0; i--) {
if (dst[i] == ' ')
dst[i] = '\0';
else
break;
}
}
float ValToTim(int value)
{
return ((value < -109 ? 129+value : (value < 7 ? (113+value)*5 : (53+value)*10))/10.0);
@ -525,15 +571,15 @@ QString RawSource::toString(const ModelData * model) const
bool RawSource::isPot() const
{
return (type == SOURCE_TYPE_STICK &&
index >= NUM_STICKS &&
index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots));
index >= CPN_MAX_STICKS &&
index < CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots));
}
bool RawSource::isSlider() const
{
return (type == SOURCE_TYPE_STICK &&
index >= NUM_STICKS+GetCurrentFirmware()->getCapability(Pots) &&
index < NUM_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders));
index >= CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots) &&
index < CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders));
}
QString RawSwitch::toString() const
@ -804,7 +850,7 @@ void CustomFunctionData::populateResetParams(const ModelData * model, QComboBox
b->setCurrentIndex(value);
}
if (model && IS_ARM(board)) {
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
if (model->sensorData[i].isAvailable()) {
RawSource item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i);
b->addItem(item.toString(model), val+i);
@ -1005,7 +1051,7 @@ GeneralSettings::GeneralSettings()
contrast = 25;
vBatWarn = 90;
for (int i=0; i<NUM_STICKS+C9X_NUM_POTS; ++i) {
for (int i=0; i<CPN_MAX_STICKS+CPN_MAX_POTS; ++i) {
calibMid[i] = 0x200;
calibSpanNeg[i] = 0x180;
calibSpanPos[i] = 0x180;
@ -1057,11 +1103,11 @@ GeneralSettings::GeneralSettings()
QString t_SpeakerSet=g.profile[g.id()].speaker();
QString t_CountrySet=g.profile[g.id()].countryCode();
if ((t_calib.length()==(NUM_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
if ((t_calib.length()==(CPN_MAX_STICKS+potsnum)*12) && (t_trainercalib.length()==16)) {
QString Byte;
int16_t byte16;
bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
for (int i=0; i<(CPN_MAX_STICKS+potsnum); i++) {
Byte=t_calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)
@ -1141,7 +1187,7 @@ GeneralSettings::GeneralSettings()
int GeneralSettings::getDefaultStick(unsigned int channel) const
{
if (channel >= NUM_STICKS)
if (channel >= CPN_MAX_STICKS)
return -1;
else
return chout_ar[4*templateSetup + channel] - 1;
@ -1235,14 +1281,14 @@ ModelData & ModelData::operator = (const ModelData & src)
ExpoData * ModelData::insertInput(const int idx)
{
memmove(&expoData[idx+1], &expoData[idx], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
memmove(&expoData[idx+1], &expoData[idx], (CPN_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
expoData[idx].clear();
return &expoData[idx];
}
bool ModelData::isInputValid(const unsigned int idx) const
{
for (int i=0; i<C9X_MAX_EXPOS; i++) {
for (int i=0; i<CPN_MAX_EXPOS; i++) {
const ExpoData * expo = &expoData[i];
if (expo->mode == 0) break;
if (expo->chn == idx)
@ -1253,7 +1299,7 @@ bool ModelData::isInputValid(const unsigned int idx) const
bool ModelData::hasExpos(uint8_t inputIdx) const
{
for (int i=0; i<C9X_MAX_EXPOS; i++) {
for (int i=0; i<CPN_MAX_EXPOS; i++) {
const ExpoData & expo = expoData[i];
if (expo.chn==inputIdx && expo.mode!=0) {
return true;
@ -1265,7 +1311,7 @@ bool ModelData::hasExpos(uint8_t inputIdx) const
bool ModelData::hasMixes(uint8_t channelIdx) const
{
channelIdx += 1;
for (int i=0; i<C9X_MAX_MIXERS; i++) {
for (int i=0; i<CPN_MAX_MIXERS; i++) {
if (mixData[i].destCh == channelIdx) {
return true;
}
@ -1276,7 +1322,7 @@ bool ModelData::hasMixes(uint8_t channelIdx) const
QVector<const ExpoData *> ModelData::expos(int input) const
{
QVector<const ExpoData *> result;
for (int i=0; i<C9X_MAX_EXPOS; i++) {
for (int i=0; i<CPN_MAX_EXPOS; i++) {
const ExpoData * ed = &expoData[i];
if ((int)ed->chn==input && ed->mode!=0) {
result << ed;
@ -1288,7 +1334,7 @@ QVector<const ExpoData *> ModelData::expos(int input) const
QVector<const MixData *> ModelData::mixes(int channel) const
{
QVector<const MixData *> result;
for (int i=0; i<C9X_MAX_MIXERS; i++) {
for (int i=0; i<CPN_MAX_MIXERS; i++) {
const MixData * md = &mixData[i];
if ((int)md->destCh == channel+1) {
result << md;
@ -1301,12 +1347,12 @@ void ModelData::removeInput(const int idx)
{
unsigned int chn = expoData[idx].chn;
memmove(&expoData[idx], &expoData[idx+1], (C9X_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
expoData[C9X_MAX_EXPOS-1].clear();
memmove(&expoData[idx], &expoData[idx+1], (CPN_MAX_EXPOS-(idx+1))*sizeof(ExpoData));
expoData[CPN_MAX_EXPOS-1].clear();
//also remove input name if removing last line for this input
bool found = false;
for (int i=0; i<C9X_MAX_EXPOS; i++) {
for (int i=0; i<CPN_MAX_EXPOS; i++) {
if (expoData[i].mode==0) continue;
if (expoData[i].chn==chn) {
found = true;
@ -1318,12 +1364,12 @@ void ModelData::removeInput(const int idx)
void ModelData::clearInputs()
{
for (int i=0; i<C9X_MAX_EXPOS; i++)
for (int i=0; i<CPN_MAX_EXPOS; i++)
expoData[i].clear();
//clear all input names
if (GetCurrentFirmware()->getCapability(VirtualInputs)) {
for (int i=0; i<C9X_MAX_INPUTS; i++) {
for (int i=0; i<CPN_MAX_INPUTS; i++) {
inputNames[i][0] = 0;
}
}
@ -1331,7 +1377,7 @@ void ModelData::clearInputs()
void ModelData::clearMixes()
{
for (int i=0; i<C9X_MAX_MIXERS; i++)
for (int i=0; i<CPN_MAX_MIXERS; i++)
mixData[i].clear();
}
@ -1357,26 +1403,26 @@ void ModelData::clear()
moduleData[0].protocol = PULSES_PPM;
moduleData[1].protocol = PULSES_OFF;
}
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
flightModeData[i].clear(i);
}
clearInputs();
clearMixes();
for (int i=0; i<C9X_NUM_CHNOUT; i++)
for (int i=0; i<CPN_MAX_CHNOUT; i++)
limitData[i].clear();
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
expoData[i].clear();
for (int i=0; i<C9X_NUM_CSW; i++)
for (int i=0; i<CPN_MAX_CSW; i++)
logicalSw[i].clear();
for (int i=0; i<C9X_MAX_CUSTOM_FUNCTIONS; i++)
for (int i=0; i<CPN_MAX_CUSTOM_FUNCTIONS; i++)
customFn[i].clear();
for (int i=0; i<C9X_MAX_CURVES; i++)
for (int i=0; i<CPN_MAX_CURVES; i++)
curves[i].clear(5);
for (int i=0; i<C9X_MAX_TIMERS; i++)
for (int i=0; i<CPN_MAX_TIMERS; i++)
timers[i].clear();
swashRingData.clear();
frsky.clear();
for (int i=0; i<C9X_MAX_SENSORS; i++)
for (int i=0; i<CPN_MAX_SENSORS; i++)
sensorData[i].clear();
}
@ -1416,7 +1462,7 @@ QString removeAccents(const QString & str)
void ModelData::setDefaultInputs(const GeneralSettings & settings)
{
if (IS_TARANIS(GetEepromInterface()->getBoard())) {
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
ExpoData * expo = &expoData[i];
expo->chn = i;
expo->mode = INPUT_MODE_BOTH;
@ -1433,7 +1479,7 @@ void ModelData::setDefaultMixes(const GeneralSettings & settings)
setDefaultInputs(settings);
}
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
MixData * mix = &mixData[i];
mix->destCh = i+1;
mix->weight = 100;
@ -1451,7 +1497,7 @@ void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settin
clear();
used = true;
sprintf(name, "MODEL%02d", id+1);
for (int i=0; i<C9X_NUM_MODULES; i++) {
for (int i=0; i<CPN_MAX_MODULES; i++) {
moduleData[i].modelId = id+1;
}
setDefaultMixes(settings);
@ -1460,7 +1506,7 @@ void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settin
int ModelData::getTrimValue(int phaseIdx, int trimIdx)
{
int result = 0;
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
FlightModeData & phase = flightModeData[phaseIdx];
if (phase.trimMode[trimIdx] < 0) {
return result;
@ -1487,7 +1533,7 @@ bool ModelData::isGVarLinked(int phaseIdx, int gvarIdx)
int ModelData::getGVarFieldValue(int phaseIdx, int gvarIdx)
{
int idx = flightModeData[phaseIdx].gvars[gvarIdx];
for (int i=0; idx>1024 && i<C9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; idx>1024 && i<CPN_MAX_FLIGHT_MODES; i++) {
int nextPhase = idx - 1025;
if (nextPhase >= phaseIdx) nextPhase += 1;
phaseIdx = nextPhase;
@ -1498,7 +1544,7 @@ int ModelData::getGVarFieldValue(int phaseIdx, int gvarIdx)
void ModelData::setTrimValue(int phaseIdx, int trimIdx, int value)
{
for (uint8_t i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
for (uint8_t i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
FlightModeData & phase = flightModeData[phaseIdx];
int mode = phase.trimMode[trimIdx];
int p = phase.trimRef[trimIdx];
@ -1535,13 +1581,13 @@ ModelData ModelData::removeGlobalVars()
{
ModelData result = *this;
for (int i=0; i<C9X_MAX_MIXERS; i++) {
for (int i=0; i<CPN_MAX_MIXERS; i++) {
removeGlobalVar(mixData[i].weight);
removeGlobalVar(mixData[i].curve.value);
removeGlobalVar(mixData[i].sOffset);
}
for (int i=0; i<C9X_MAX_EXPOS; i++) {
for (int i=0; i<CPN_MAX_EXPOS; i++) {
removeGlobalVar(expoData[i].weight);
removeGlobalVar(expoData[i].curve.value);
}
@ -1568,10 +1614,7 @@ void registerEEpromInterfaces()
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_X9D));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_X9DP));
eepromInterfaces.push_back(new OpenTxEepromInterface(BOARD_TARANIS_X9E));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_STOCK));
eepromInterfaces.push_back(new Gruvin9xInterface(BOARD_GRUVIN9X));
eepromInterfaces.push_back(new Ersky9xInterface());
eepromInterfaces.push_back(new Th9xInterface());
eepromInterfaces.push_back(new Er9xInterface());
}
@ -1795,10 +1838,10 @@ void FlightModeData::clear(const int phase)
{
memset(this, 0, sizeof(FlightModeData));
if (phase != 0) {
for (int idx=0; idx<C9X_MAX_GVARS; idx++) {
for (int idx=0; idx<CPN_MAX_GVARS; idx++) {
gvars[idx] = 1025;
}
for (int idx=0; idx<C9X_MAX_ENCODERS; idx++) {
for (int idx=0; idx<CPN_MAX_ENCODERS; idx++) {
rotaryEncoders[idx] = 1025;
}
}

View file

@ -1,19 +1,3 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef eeprom_interface_h
#define eeprom_interface_h
@ -434,7 +418,7 @@ class CurveData {
CurveType type;
bool smooth;
int count;
CurvePoint points[C9X_MAX_POINTS];
CurvePoint points[CPN_MAX_POINTS];
char name[6+1];
};
@ -467,7 +451,7 @@ enum MltpxValue {
class MixData {
public:
MixData() { clear(); }
unsigned int destCh; // 1..C9X_NUM_CHNOUT
unsigned int destCh; // 1..CPN_MAX_CHNOUT
RawSource srcRaw;
int weight;
RawSwitch swtch;
@ -544,7 +528,7 @@ class LogicalSwitchData { // Logical Switches data
enum AssignFunc {
FuncOverrideCH1 = 0,
FuncOverrideCH32 = FuncOverrideCH1+C9X_NUM_CHNOUT-1,
FuncOverrideCH32 = FuncOverrideCH1+CPN_MAX_CHNOUT-1,
FuncTrainer,
FuncTrainerRUD,
FuncTrainerELE,
@ -569,7 +553,7 @@ enum AssignFunc {
FuncBackgroundMusic,
FuncBackgroundMusicPause,
FuncAdjustGV1,
FuncAdjustGVLast = FuncAdjustGV1+C9X_MAX_GVARS-1,
FuncAdjustGVLast = FuncAdjustGV1+CPN_MAX_GVARS-1,
FuncSetFailsafeInternalModule,
FuncSetFailsafeExternalModule,
FuncRangeCheckInternalModule,
@ -613,15 +597,15 @@ class CustomFunctionData { // Function Switches data
class FlightModeData {
public:
FlightModeData() { clear(0); }
int trimMode[NUM_STICKS+NUM_AUX_TRIMS];
int trimRef[NUM_STICKS+NUM_AUX_TRIMS];
int trim[NUM_STICKS+NUM_AUX_TRIMS];
int trimMode[CPN_MAX_STICKS+CPN_MAX_AUX_TRIMS];
int trimRef[CPN_MAX_STICKS+CPN_MAX_AUX_TRIMS];
int trim[CPN_MAX_STICKS+CPN_MAX_AUX_TRIMS];
RawSwitch swtch;
char name[10+1];
unsigned int fadeIn;
unsigned int fadeOut;
int rotaryEncoders[C9X_MAX_ENCODERS];
int gvars[C9X_MAX_GVARS];
int rotaryEncoders[CPN_MAX_ENCODERS];
int gvars[CPN_MAX_GVARS];
void clear(const int phase);
};
@ -877,7 +861,7 @@ class ModuleData {
unsigned int channelsStart;
int channelsCount; // 0=8 channels
unsigned int failsafeMode;
int failsafeChannels[C9X_NUM_CHNOUT];
int failsafeChannels[CPN_MAX_CHNOUT];
struct {
@ -901,18 +885,18 @@ class ModuleData {
QString polarityToString() const { return ppm.pulsePol ? QObject::tr("Positive") : QObject::tr("Negative"); } // TODO ModelPrinter
};
#define C9X_MAX_SCRIPTS 7
#define C9X_MAX_SCRIPT_INPUTS 10
#define CPN_MAX_SCRIPTS 7
#define CPN_MAX_SCRIPT_INPUTS 10
class ScriptData {
public:
ScriptData() { clear(); }
char filename[10+1];
char name[10+1];
int inputs[C9X_MAX_SCRIPT_INPUTS];
int inputs[CPN_MAX_SCRIPT_INPUTS];
void clear() { memset(this, 0, sizeof(ScriptData)); }
};
#define C9X_MAX_SENSORS 32
#define CPN_MAX_SENSORS 32
class SensorData {
public:
@ -1049,7 +1033,7 @@ class ModelData {
bool used;
char name[15+1];
TimerData timers[C9X_MAX_TIMERS];
TimerData timers[CPN_MAX_TIMERS];
bool noGlobalFunctions;
bool thrTrim; // Enable Throttle Trim
int trimInc; // Trim Increments
@ -1061,27 +1045,27 @@ class ModelData {
bool extendedLimits; // TODO xml
bool extendedTrims;
bool throttleReversed;
FlightModeData flightModeData[C9X_MAX_FLIGHT_MODES];
MixData mixData[C9X_MAX_MIXERS];
LimitData limitData[C9X_NUM_CHNOUT];
FlightModeData flightModeData[CPN_MAX_FLIGHT_MODES];
MixData mixData[CPN_MAX_MIXERS];
LimitData limitData[CPN_MAX_CHNOUT];
char inputNames[C9X_MAX_INPUTS][4+1];
ExpoData expoData[C9X_MAX_EXPOS];
char inputNames[CPN_MAX_INPUTS][4+1];
ExpoData expoData[CPN_MAX_EXPOS];
CurveData curves[C9X_MAX_CURVES];
LogicalSwitchData logicalSw[C9X_NUM_CSW];
CustomFunctionData customFn[C9X_MAX_CUSTOM_FUNCTIONS];
CurveData curves[CPN_MAX_CURVES];
LogicalSwitchData logicalSw[CPN_MAX_CSW];
CustomFunctionData customFn[CPN_MAX_CUSTOM_FUNCTIONS];
SwashRingData swashRingData;
unsigned int thrTraceSrc;
uint64_t switchWarningStates;
unsigned int switchWarningEnable;
unsigned int potsWarningMode;
bool potsWarningEnabled[C9X_NUM_POTS];
int potPosition[C9X_NUM_POTS];
bool potsWarningEnabled[CPN_MAX_POTS];
int potPosition[CPN_MAX_POTS];
bool displayChecklist;
// TODO structure
char gvars_names[C9X_MAX_GVARS][6+1];
bool gvars_popups[C9X_MAX_GVARS];
char gvars_names[CPN_MAX_GVARS][6+1];
bool gvars_popups[CPN_MAX_GVARS];
MavlinkData mavlink;
unsigned int telemetryProtocol;
FrSkyData frsky;
@ -1090,11 +1074,11 @@ class ModelData {
unsigned int trainerMode;
ModuleData moduleData[C9X_NUM_MODULES+1/*trainer*/];
ModuleData moduleData[CPN_MAX_MODULES+1/*trainer*/];
ScriptData scriptData[C9X_MAX_SCRIPTS];
ScriptData scriptData[CPN_MAX_SCRIPTS];
SensorData sensorData[C9X_MAX_SENSORS];
SensorData sensorData[CPN_MAX_SENSORS];
unsigned int toplcdTimer;
@ -1170,9 +1154,9 @@ class GeneralSettings {
unsigned int version;
unsigned int variant;
int calibMid[NUM_STICKS+C9X_NUM_POTS];
int calibSpanNeg[NUM_STICKS+C9X_NUM_POTS];
int calibSpanPos[NUM_STICKS+C9X_NUM_POTS];
int calibMid[CPN_MAX_STICKS+CPN_MAX_POTS];
int calibSpanNeg[CPN_MAX_STICKS+CPN_MAX_POTS];
int calibSpanPos[CPN_MAX_STICKS+CPN_MAX_POTS];
unsigned int currModel; // 0..15
unsigned int contrast;
unsigned int vBatWarn;
@ -1250,7 +1234,7 @@ class GeneralSettings {
unsigned int switchUnlockStates;
unsigned int hw_uartMode;
unsigned int backlightColor;
CustomFunctionData customFn[C9X_MAX_CUSTOM_FUNCTIONS];
CustomFunctionData customFn[CPN_MAX_CUSTOM_FUNCTIONS];
char switchName[18][3+1];
unsigned int switchConfig[18];
char stickName[4][3+1];
@ -1279,7 +1263,7 @@ class GeneralSettings {
class RadioData {
public:
GeneralSettings generalSettings;
ModelData models[C9X_MAX_MODELS];
ModelData models[CPN_MAX_MODELS];
};
enum Capability {
@ -1471,8 +1455,8 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
ModelData model_copy = model;
// trims
for (int p=0; p<C9X_MAX_FLIGHT_MODES; p++) {
for (int i=0; i<NUM_STICKS/2; i++) {
for (int p=0; p<CPN_MAX_FLIGHT_MODES; p++) {
for (int i=0; i<CPN_MAX_STICKS/2; i++) {
int converted_stick = applyStickMode(i+1, mode) - 1;
int tmp = model.flightModeData[p].trim[i];
model.flightModeData[p].trim[i] = model.flightModeData[p].trim[converted_stick];
@ -1489,7 +1473,7 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
model_copy.expoData[i].chn = applyStickMode(model.expoData[i].chn+1, mode) - 1;
}
int index=0;
for (unsigned int i=0; i<NUM_STICKS; i++) {
for (unsigned int i=0; i<CPN_MAX_STICKS; i++) {
for (unsigned int e=0; e<sizeof(model.expoData) / sizeof(model.expoData[1]); e++) {
if (model_copy.expoData[e].mode && model_copy.expoData[e].chn == i)
model.expoData[index++] = model_copy.expoData[e];
@ -1497,14 +1481,14 @@ inline void applyStickModeToModel(ModelData &model, unsigned int mode)
}
// mixers
for (int i=0; i<C9X_MAX_MIXERS; i++) {
for (int i=0; i<CPN_MAX_MIXERS; i++) {
if (model.mixData[i].srcRaw.type == SOURCE_TYPE_STICK) {
model.mixData[i].srcRaw.index = applyStickMode(model.mixData[i].srcRaw.index + 1, mode) - 1;
}
}
// virtual switches
for (int i=0; i<C9X_NUM_CSW; i++) {
for (int i=0; i<CPN_MAX_CSW; i++) {
RawSource source;
switch (model.logicalSw[i].getFunctionFamily()) {
case LS_FAMILY_VCOMP:

View file

@ -45,7 +45,7 @@ t_Er9xTrainerData::t_Er9xTrainerData()
t_Er9xTrainerData::operator TrainerData ()
{
TrainerData c9x;
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
c9x.calib[i] = calib[i];
c9x.mix[i] = mix[i];
}
@ -61,7 +61,7 @@ Er9xGeneral::operator GeneralSettings ()
{
GeneralSettings result;
result.version = myVers;
for (int i=0; i<NUM_STICKSnPOTS; i++) {
for (int i=0; i<CPN_MAX_STICKSnPOTS; i++) {
result.calibMid[i] = calibMid[i];
result.calibSpanNeg[i] = calibSpanNeg[i];
result.calibSpanPos[i] = calibSpanPos[i];
@ -402,8 +402,8 @@ t_Er9xModelData::operator ModelData ()
// expoData
int e = 0;
for (int ch = 0; ch < 4 && e < C9X_MAX_EXPOS; ch++) {
for (int dr = 0, pos = 0; dr < 3 && e < C9X_MAX_EXPOS; dr++, pos++) {
for (int ch = 0; ch < 4 && e < CPN_MAX_EXPOS; ch++) {
for (int dr = 0, pos = 0; dr < 3 && e < CPN_MAX_EXPOS; dr++, pos++) {
if ((dr == 0 && !expoData[ch].drSw1) || (dr == 1 && !expoData[ch].drSw2))
dr = 2;
if (dr == 2 && !expoData[ch].expo[0][0][0] && !expoData[ch].expo[0][0][1] && !expoData[ch].expo[0][1][0] && !expoData[ch].expo[0][1][1])
@ -426,7 +426,7 @@ t_Er9xModelData::operator ModelData ()
}
else {
c9x.expoData[e].mode = 2;
if (e < C9X_MAX_EXPOS - 1) {
if (e < CPN_MAX_EXPOS - 1) {
c9x.expoData[e + 1].swtch = c9x.expoData[e].swtch;
c9x.expoData[++e].chn = ch;
c9x.expoData[e].mode = 1;
@ -440,7 +440,7 @@ t_Er9xModelData::operator ModelData ()
}
}
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
c9x.flightModeData[0].trim[i] = trim[i];
for (int i=0; i<ER9X_MAX_CURVE5; i++) {

View file

@ -29,7 +29,7 @@
#define ER9X_NUM_CHNOUT 16 //number of real outputchannels CH1-CH8
#define ER9X_NUM_CSW 12 //number of custom switches
#define NUM_STICKSnPOTS 7 //number of sticks and pots
#define CPN_MAX_STICKSnPOTS 7 //number of sticks and pots
#define ER9X_MAX_GVARS 7
#define ER9X_MAX_MODES 4
@ -54,9 +54,9 @@ PACK(typedef struct t_Er9xTrainerData {
PACK(typedef struct t_Er9xGeneral {
uint8_t myVers;
int16_t calibMid[NUM_STICKSnPOTS];
int16_t calibSpanNeg[NUM_STICKSnPOTS];
int16_t calibSpanPos[NUM_STICKSnPOTS];
int16_t calibMid[CPN_MAX_STICKSnPOTS];
int16_t calibSpanNeg[CPN_MAX_STICKSnPOTS];
int16_t calibSpanPos[CPN_MAX_STICKSnPOTS];
uint16_t chkSum;
uint8_t currModel; //0..15
uint8_t contrast;
@ -131,7 +131,7 @@ PACK(typedef struct t_Er9xLimitData {
#define MLTPX_REP 2
PACK(typedef struct t_Er9xMixData {
uint8_t destCh; // 1..C9X_NUM_CHNOUT
uint8_t destCh; // 1..CPN_MAX_CHNOUT
uint8_t srcRaw; //
int8_t weight;
int8_t swtch;

View file

@ -55,7 +55,7 @@ t_Ersky9xTrainerData::t_Ersky9xTrainerData()
t_Ersky9xTrainerData::operator TrainerData ()
{
TrainerData c9x;
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
c9x.calib[i] = calib[i];
c9x.mix[i] = mix[i];
}
@ -73,7 +73,7 @@ Ersky9xGeneral::operator GeneralSettings ()
result.version = myVers;
for (int i=0; i<NUM_STICKSnPOTS; i++) {
for (int i=0; i<CPN_MAX_STICKSnPOTS; i++) {
result.calibMid[i] = calibMid[i];
result.calibSpanNeg[i] = calibSpanNeg[i];
result.calibSpanPos[i] = calibSpanPos[i];
@ -530,8 +530,8 @@ t_Ersky9xModelData_v10::operator ModelData ()
// expoData
int e = 0;
for (int ch = 0; ch < 4 && e < C9X_MAX_EXPOS; ch++) {
for (int dr = 0, pos = 0; dr < 3 && e < C9X_MAX_EXPOS; dr++, pos++) {
for (int ch = 0; ch < 4 && e < CPN_MAX_EXPOS; ch++) {
for (int dr = 0, pos = 0; dr < 3 && e < CPN_MAX_EXPOS; dr++, pos++) {
if ((dr == 0 && !expoData[ch].drSw1) || (dr == 1 && !expoData[ch].drSw2))
dr = 2;
if (dr == 2 && !expoData[ch].expo[0][0][0] && !expoData[ch].expo[0][0][1] && !expoData[ch].expo[0][1][0] && !expoData[ch].expo[0][1][1])
@ -554,7 +554,7 @@ t_Ersky9xModelData_v10::operator ModelData ()
}
else {
c9x.expoData[e].mode = 2;
if (e < C9X_MAX_EXPOS - 1) {
if (e < CPN_MAX_EXPOS - 1) {
c9x.expoData[e + 1].swtch = c9x.expoData[e].swtch;
c9x.expoData[++e].chn = ch;
c9x.expoData[e].mode = 1;
@ -568,7 +568,7 @@ t_Ersky9xModelData_v10::operator ModelData ()
}
}
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
c9x.flightModeData[0].trim[i] = trim[i];
for (int i=0; i<ERSKY9X_MAX_CURVE5; i++) {
@ -645,8 +645,8 @@ t_Ersky9xModelData_v11::operator ModelData ()
// expoData
int e = 0;
for (int ch = 0; ch < 4 && e < C9X_MAX_EXPOS; ch++) {
for (int dr = 0, pos = 0; dr < 3 && e < C9X_MAX_EXPOS; dr++, pos++) {
for (int ch = 0; ch < 4 && e < CPN_MAX_EXPOS; ch++) {
for (int dr = 0, pos = 0; dr < 3 && e < CPN_MAX_EXPOS; dr++, pos++) {
if ((dr == 0 && !expoData[ch].drSw1) || (dr == 1 && !expoData[ch].drSw2))
dr = 2;
if (dr == 2 && !expoData[ch].expo[0][0][0] && !expoData[ch].expo[0][0][1] && !expoData[ch].expo[0][1][0] && !expoData[ch].expo[0][1][1])
@ -669,7 +669,7 @@ t_Ersky9xModelData_v11::operator ModelData ()
}
else {
c9x.expoData[e].mode = 2;
if (e < C9X_MAX_EXPOS - 1) {
if (e < CPN_MAX_EXPOS - 1) {
c9x.expoData[e + 1].swtch = c9x.expoData[e].swtch;
c9x.expoData[++e].chn = ch;
c9x.expoData[e].mode = 1;
@ -683,7 +683,7 @@ t_Ersky9xModelData_v11::operator ModelData ()
}
}
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
c9x.flightModeData[0].trim[i] = trim[i];
for (int i=0; i<ERSKY9X_MAX_CURVE5; i++) {

View file

@ -40,7 +40,7 @@ extern RawSwitch getEr9xTimerMode(int mode);
#define ERSKY9X_NUM_VOICE 8
#define ERSKY9X_MAX_GVARS 7
#define NUM_STICKSnPOTS 7 //number of sticks and pots
#define CPN_MAX_STICKSnPOTS 7 //number of sticks and pots
PACK(typedef struct t_Ersky9xTrainerMix {
uint8_t srcChn:3; //0-7 = ch1-8
@ -62,9 +62,9 @@ PACK(typedef struct t_Ersky9xTrainerData {
PACK(typedef struct t_Ersky9xGeneral {
uint8_t myVers;
int16_t calibMid[NUM_STICKSnPOTS];
int16_t calibSpanNeg[NUM_STICKSnPOTS];
int16_t calibSpanPos[NUM_STICKSnPOTS];
int16_t calibMid[CPN_MAX_STICKSnPOTS];
int16_t calibSpanNeg[CPN_MAX_STICKSnPOTS];
int16_t calibSpanPos[CPN_MAX_STICKSnPOTS];
uint16_t chkSum;
uint8_t currModel; //0..15
uint8_t contrast;
@ -143,7 +143,7 @@ PACK(typedef struct t_Ersky9xLimitData {
#define MLTPX_REP 2
PACK(typedef struct t_Ersky9xMixData_v10 {
uint8_t destCh; // 1..C9X_NUM_CHNOUT
uint8_t destCh; // 1..CPN_MAX_CHNOUT
uint8_t srcRaw; //
int8_t weight;
int8_t swtch;
@ -165,7 +165,7 @@ PACK(typedef struct t_Ersky9xMixData_v10 {
}) Ersky9xMixData_v10;
PACK(typedef struct t_Ersky9xMixData_v11 {
uint8_t destCh; // 1..C9X_NUM_CHNOUT
uint8_t destCh; // 1..CPN_MAX_CHNOUT
uint8_t srcRaw; //
int8_t weight;
int8_t swtch;

View file

@ -1,729 +0,0 @@
#include <stdlib.h>
#include <algorithm>
#include "helpers.h"
#include "gruvin9xeeprom.h"
#include <QObject>
#define EEPROM_VER 106
extern void getEEPROMZString(char *dst, const char *src, int size);
RawSwitch gruvin9xToSwitch(int8_t sw)
{
if (sw == 0)
return RawSwitch(SWITCH_TYPE_NONE);
else if (sw <= 9)
return RawSwitch(SWITCH_TYPE_SWITCH, sw);
else
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-9 : sw+9);
}
t_Gruvin9xTrainerMix_v103::operator TrainerMix()
{
TrainerMix c9x;
c9x.src = srcChn;
c9x.swtch = gruvin9xToSwitch(swtch);
c9x.weight = (25 * studWeight) / 8;
c9x.mode = mode;
return c9x;
}
t_Gruvin9xTrainerMix_v104::operator TrainerMix()
{
TrainerMix c9x;
c9x.src = srcChn;
c9x.weight = studWeight;
c9x.mode = mode;
return c9x;
}
t_Gruvin9xTrainerData_v103::operator TrainerData ()
{
TrainerData c9x;
for (int i=0; i<NUM_STICKS; i++) {
c9x.calib[i] = calib[i];
c9x.mix[i] = mix[i];
}
return c9x;
}
t_Gruvin9xTrainerData_v104::operator TrainerData ()
{
TrainerData c9x;
for (int i=0; i<NUM_STICKS; i++) {
c9x.calib[i] = calib[i];
c9x.mix[i] = mix[i];
}
return c9x;
}
Gruvin9xGeneral_v103::operator GeneralSettings ()
{
GeneralSettings result;
for (int i=0; i<NUM_STICKS+BOARD_9X_NUM_POTS; i++) {
result.calibMid[i] = calibMid[i];
result.calibSpanNeg[i] = calibSpanNeg[i];
result.calibSpanPos[i] = calibSpanPos[i];
}
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
result.backlightMode = 4;
}
else if (lightAutoOff) {
result.backlightMode |= 1;
result.backlightDelay = lightAutoOff;
}
result.trainer = trainer;
result.view = view;
result.disableThrottleWarning = disableThrottleWarning;
result.switchWarning = switchWarning;
switch (beeperVal) {
case 0:
result.beeperMode = GeneralSettings::BEEPER_QUIET;
break;
case 1:
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
break;
default:
result.beeperMode = GeneralSettings::BEEPER_ALL;
result.beeperLength = beeperVal - 4;
break;
}
result.disableMemoryWarning = disableMemoryWarning;
result.disableAlarmWarning = disableAlarmWarning;
result.stickMode = stickMode;
result.inactivityTimer = inactivityTimer;
result.minuteBeep = minuteBeep;
result.preBeep = preBeep;
result.flashBeep = flashBeep;
result.splashMode = disableSplashScreen;
result.enableTelemetryAlarm = enableTelemetryAlarm;
result.templateSetup = templateSetup;
result.PPM_Multiplier = PPM_Multiplier;
// TODO frskyRssiAlarms[2];
return result;
}
Gruvin9xGeneral_v104::operator GeneralSettings ()
{
GeneralSettings result;
for (int i=0; i<NUM_STICKS+BOARD_9X_NUM_POTS; i++) {
result.calibMid[i] = calibMid[i];
result.calibSpanNeg[i] = calibSpanNeg[i];
result.calibSpanPos[i] = calibSpanPos[i];
}
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.txVoltageCalibration = txVoltageCalibration;
result.backlightMode = 0;
if (lightSw == 22) {
result.backlightMode = 4;
}
else if (lightAutoOff) {
result.backlightMode |= 1;
result.backlightDelay = lightAutoOff;
}
result.trainer = trainer;
result.view = view;
result.disableThrottleWarning = disableThrottleWarning;
result.switchWarning = switchWarning;
result.beeperMode = (GeneralSettings::BeeperMode)beeperVal;
result.disableMemoryWarning = disableMemoryWarning;
result.disableAlarmWarning = disableAlarmWarning;
result.stickMode = stickMode;
result.inactivityTimer = inactivityTimer;
result.minuteBeep = minuteBeep;
result.preBeep = preBeep;
result.flashBeep = flashBeep;
result.splashMode = disableSplashScreen;
result.enableTelemetryAlarm = enableTelemetryAlarm;
result.templateSetup = templateSetup;
result.PPM_Multiplier = PPM_Multiplier;
// TODO frskyRssiAlarms[2];
return result;
}
t_Gruvin9xExpoData::t_Gruvin9xExpoData()
{
memset(this, 0, sizeof(t_Gruvin9xExpoData));
}
t_Gruvin9xExpoData::operator ExpoData ()
{
ExpoData c9x;
c9x.mode = mode;
c9x.chn = chn;
c9x.swtch = gruvin9xToSwitch(swtch);
if (negPhase) {
c9x.flightModes= 1 << (phase -1);
} else if (phase==0) {
c9x.flightModes=0;
} else {
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.weight = weight;
if (expo) {
c9x.curve.type = CurveReference::CURVE_REF_EXPO;
c9x.curve.value = expo;
}
else if (curve > 6) {
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
c9x.curve.value = curve - 6;
}
else if (curve > 0) {
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
c9x.curve.value = curve;
}
return c9x;
}
t_Gruvin9xLimitData::t_Gruvin9xLimitData()
{
memset(this, 0, sizeof(t_Gruvin9xLimitData));
}
t_Gruvin9xLimitData::operator LimitData ()
{
LimitData c9x;
c9x.min = 10*(min-100);
c9x.max = 10*(max+100);
c9x.revert = revert;
c9x.offset = offset;
return c9x;
}
t_Gruvin9xMixData::t_Gruvin9xMixData()
{
memset(this, 0, sizeof(t_Gruvin9xMixData));
}
t_Gruvin9xMixData::operator MixData ()
{
MixData c9x;
c9x.destCh = destCh;
c9x.weight = weight;
c9x.swtch = gruvin9xToSwitch(swtch);
if (srcRaw == 0) {
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
}
else if (srcRaw <= 7) {
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
}
else if (srcRaw == 8) {
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
}
else if (srcRaw == 9) {
if (swtch < 0) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, -swtch - 1);
c9x.weight = -weight;
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, swtch - 1);
}
if (mltpx != MLTPX_REP)
c9x.swtch = RawSwitch(SWITCH_TYPE_NONE);
}
else if (srcRaw <= 12) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-10);
}
else if (srcRaw <= 20) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-13);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-21);
}
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
c9x.speedDown = speedDown;
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
c9x.sOffset = sOffset;
if (curve > 6) {
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
c9x.curve.value = curve - 6;
}
else if (curve > 0) {
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
c9x.curve.value = curve;
}
return c9x;
}
RawSource gruvin9xToSource(int8_t value)
{
if (value == 0) {
return RawSource(SOURCE_TYPE_NONE);
}
else if (value <= 7) {
return RawSource(SOURCE_TYPE_STICK, value - 1);
}
else if (value == 8) {
return RawSource(SOURCE_TYPE_MAX);
}
else if (value == 9) {
return RawSource(SOURCE_TYPE_MAX);
}
else if (value <= 12) {
return RawSource(SOURCE_TYPE_CYC, value-10);
}
else if (value <= 20) {
return RawSource(SOURCE_TYPE_PPM, value-13);
}
else if (value <= 36) {
return RawSource(SOURCE_TYPE_CH, value-21);
}
else {
return RawSource(SOURCE_TYPE_TELEMETRY, value-36);
}
}
Gruvin9xLogicalSwitchData::operator LogicalSwitchData ()
{
LogicalSwitchData c9x;
c9x.func = func;
c9x.val1 = v1;
c9x.val2 = v2;
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
c9x.val1 = gruvin9xToSource(v1).toValue();
}
if (c9x.func >= LS_FN_EQUAL) {
c9x.val2 = gruvin9xToSource(v2).toValue();
}
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
c9x.val1 = gruvin9xToSwitch(v1).toValue();
c9x.val2 = gruvin9xToSwitch(v2).toValue();
}
return c9x;
}
Gruvin9xCustomFunctionData::operator CustomFunctionData ()
{
CustomFunctionData c9x;
c9x.swtch = gruvin9xToSwitch(swtch);
c9x.func = (AssignFunc)(func + G9X_NUM_CHNOUT);
return c9x;
}
t_Gruvin9xSwashRingData::t_Gruvin9xSwashRingData()
{
memset(this, 0, sizeof(t_Gruvin9xSwashRingData));
}
t_Gruvin9xSwashRingData::operator SwashRingData ()
{
SwashRingData c9x;
c9x.elevatorWeight = invertELE ? -100 : 100;
c9x.aileronWeight = invertAIL ? -100 : 100;
c9x.collectiveWeight = invertCOL ? -100 : 100;
c9x.type = type;
c9x.collectiveSource = gruvin9xToSource(collectiveSource);
c9x.value = value;
return c9x;
}
t_Gruvin9xFlightModeData_v102::operator FlightModeData ()
{
FlightModeData c9x;
for (int i=0; i<NUM_STICKS; i++)
c9x.trim[i] = trim[i];
c9x.swtch = gruvin9xToSwitch(swtch);
getEEPROMZString(c9x.name, name, sizeof(name));
c9x.fadeIn = fadeIn;
c9x.fadeOut = fadeOut;
return c9x;
}
t_Gruvin9xFlightModeData_v106::operator FlightModeData ()
{
FlightModeData c9x;
for (int i=0; i<NUM_STICKS; i++)
c9x.trim[i] = (((int16_t)trim[i]) << 2) + ((trim_ext >> (2*i)) & 0x03);
c9x.swtch = gruvin9xToSwitch(swtch);
getEEPROMZString(c9x.name, name, sizeof(name));
c9x.fadeIn = fadeIn;
c9x.fadeOut = fadeOut;
return c9x;
}
extern RawSwitch getEr9xTimerMode(int mode);
t_Gruvin9xTimerData::operator TimerData ()
{
TimerData c9x;
c9x.mode = getEr9xTimerMode(mode);
c9x.val = val;
return c9x;
}
t_Gruvin9xFrSkyChannelData::t_Gruvin9xFrSkyChannelData()
{
memset(this, 0, sizeof(t_Gruvin9xFrSkyChannelData));
}
t_Gruvin9xFrSkyChannelData::operator FrSkyChannelData ()
{
FrSkyChannelData c9x;
c9x.ratio = ratio;
c9x.alarms[0].value = alarms_value[0];
c9x.alarms[0].level = alarms_level & 3;
c9x.alarms[0].greater = alarms_greater & 1;
c9x.alarms[1].value = alarms_value[1];
c9x.alarms[1].level = (alarms_level >> 2) & 3;
c9x.alarms[1].greater = (alarms_greater >> 1) & 1;
c9x.type = type;
return c9x;
}
t_Gruvin9xFrSkyData::t_Gruvin9xFrSkyData()
{
memset(this, 0, sizeof(t_Gruvin9xFrSkyData));
}
t_Gruvin9xFrSkyData::operator FrSkyData ()
{
FrSkyData c9x;
c9x.channels[0] = channels[0];
c9x.channels[1] = channels[1];
return c9x;
}
t_Gruvin9xModelData_v102::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMString(c9x.name, name, sizeof(name));
c9x.timers[0] = timer1;
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
c9x.flightModeData[i] = flightModeData[i];
for (int i=0; i<G9X_MAX_MIXERS; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<G9X_NUM_CHNOUT; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<G9X_MAX_EXPOS; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<G9X_MAX_CURVE5; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<G9X_MAX_CURVE9; i++) {
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<G9X_NUM_CSW; i++)
c9x.logicalSw[i] = logicalSw[i];
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
// c9x.safetySw[i] = safetySw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
return c9x;
}
t_Gruvin9xModelData_v103::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
c9x.timers[0] = timer1;
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++)
c9x.flightModeData[i] = flightModeData[i];
for (int i=0; i<G9X_MAX_MIXERS; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<G9X_NUM_CHNOUT; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<G9X_MAX_EXPOS; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<G9X_MAX_CURVE5; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<G9X_MAX_CURVE9; i++) {
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<G9X_NUM_CSW; i++)
c9x.logicalSw[i] = logicalSw[i];
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
// c9x.safetySw[i] = safetySw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
return c9x;
}
t_Gruvin9xModelData_v105::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
c9x.timers[0] = timer1;
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (flightModeData[i].trim[j] > 125) {
c9x.flightModeData[i].trimRef[j] = 0;
c9x.flightModeData[i].trim[j] = 0;
}
else if (flightModeData[i].trim[j] < -125) {
c9x.flightModeData[i].trimRef[j] = 129 + flightModeData[i].trim[j];
if (c9x.flightModeData[i].trimRef[j] >= i)
c9x.flightModeData[i].trimRef[j] += 1;
c9x.flightModeData[i].trim[j] = 0;
}
else {
c9x.flightModeData[i].trim[j] += subtrim[j];
}
}
}
for (int i=0; i<G9X_MAX_MIXERS; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<G9X_NUM_CHNOUT; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<G9X_MAX_EXPOS; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<G9X_MAX_CURVE5; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<G9X_MAX_CURVE9; i++) {
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<G9X_NUM_CSW; i++)
c9x.logicalSw[i] = logicalSw[i];
for (int i=0; i<G9X_NUM_FSW; i++)
c9x.customFn[i] = customFn[i];
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
// c9x.safetySw[i] = safetySw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
return c9x;
}
t_Gruvin9xModelData_v106::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
c9x.timers[0] = timer1;
c9x.timers[1] = timer2;
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_SILV_A;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_SILV_B;
break;
case 5:
c9x.moduleData[0].protocol = PULSES_SILV_C;
break;
case 6:
c9x.moduleData[0].protocol = PULSES_CTP1009;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc-2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<G9X_MAX_FLIGHT_MODES; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
if (c9x.flightModeData[i].trimRef[j] >= i)
c9x.flightModeData[i].trimRef[j] += 1;
c9x.flightModeData[i].trim[j] = 0;
}
}
}
for (int i=0; i<G9X_MAX_MIXERS; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<G9X_NUM_CHNOUT; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<G9X_MAX_EXPOS; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<G9X_MAX_CURVE5; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<G9X_MAX_CURVE9; i++) {
c9x.curves[G9X_MAX_CURVE5 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[G9X_MAX_CURVE5 + i].points[j].x = -100 + 25 * i;
c9x.curves[G9X_MAX_CURVE5 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<G9X_NUM_CSW; i++)
c9x.logicalSw[i] = logicalSw[i];
for (int i=0; i<G9X_NUM_FSW; i++)
c9x.customFn[i] = customFn[i];
// for (int i=0; i<G9X_NUM_CHNOUT; i++)
// c9x.safetySw[i] = safetySw[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
return c9x;
}

View file

@ -1,421 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef gruvin9xeeprom_h
#define gruvin9xeeprom_h
#include <inttypes.h>
#include "eeprominterface.h"
#define GR9X_MAX_CSFUNC 13
PACK(typedef struct t_Gruvin9xTrainerMix_v103 {
uint8_t srcChn:3; //0-7 = ch1-8
int8_t swtch:5;
int8_t studWeight:6;
uint8_t mode:2; //off,add-mode,subst-mode
operator TrainerMix();
t_Gruvin9xTrainerMix_v103() { memset(this, 0, sizeof(t_Gruvin9xTrainerMix_v103)); }
}) Gruvin9xTrainerMix_v103; //
PACK(typedef struct t_Gruvin9xTrainerMix_v104 {
uint8_t srcChn:6; // 0-7 = ch1-8
uint8_t mode:2; // off,add-mode,subst-mode
int8_t studWeight;
operator TrainerMix();
t_Gruvin9xTrainerMix_v104() { memset(this, 0, sizeof(t_Gruvin9xTrainerMix_v104)); }
}) Gruvin9xTrainerMix_v104; //
PACK(typedef struct t_Gruvin9xTrainerData_v103 {
int16_t calib[4];
Gruvin9xTrainerMix_v103 mix[4];
operator TrainerData();
}) Gruvin9xTrainerData_v103;
PACK(typedef struct t_Gruvin9xTrainerData_v104 {
int16_t calib[4];
Gruvin9xTrainerMix_v104 mix[4];
operator TrainerData();
t_Gruvin9xTrainerData_v104() { memset(this, 0, sizeof(t_Gruvin9xTrainerData_v104)); }
}) Gruvin9xTrainerData_v104;
PACK(typedef struct t_Gruvin9xFrSkyRSSIAlarm {
uint8_t level:2;
int8_t value:6;
}) Gruvin9xFrSkyRSSIAlarm;
PACK(typedef struct t_Gruvin9xGeneral_v103 {
uint8_t myVers;
int16_t calibMid[7];
int16_t calibSpanNeg[7];
int16_t calibSpanPos[7];
uint16_t chkSum;
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t txVoltageCalibration;
int8_t lightSw;
Gruvin9xTrainerData_v103 trainer;
uint8_t view; //index of subview in main scrren
uint8_t disableThrottleWarning:1;
int8_t switchWarning:2; // -1=down, 0=off, 1=up
uint8_t beeperVal:3;
uint8_t disableMemoryWarning:1;
uint8_t disableAlarmWarning:1;
uint8_t stickMode;
uint8_t inactivityTimer;
uint8_t throttleReversed:1;
uint8_t minuteBeep:1;
uint8_t preBeep:1;
uint8_t flashBeep:1;
uint8_t disableSplashScreen:1;
uint8_t enableTelemetryAlarm:1; // 0=no, 1=yes (Sound alarm when there's no telem. data coming in)
uint8_t spare:2;
uint8_t filterInput;
uint8_t lightAutoOff;
uint8_t templateSetup; //RETA order according to chout_ar array
int8_t PPM_Multiplier;
Gruvin9xFrSkyRSSIAlarm frskyRssiAlarms[2];
operator GeneralSettings();
t_Gruvin9xGeneral_v103() { memset(this, 0, sizeof(t_Gruvin9xGeneral_v103)); }
}) Gruvin9xGeneral_v103;
PACK(typedef struct t_Gruvin9xGeneral_v104 {
uint8_t myVers;
int16_t calibMid[7];
int16_t calibSpanNeg[7];
int16_t calibSpanPos[7];
uint16_t chkSum;
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t txVoltageCalibration;
int8_t lightSw;
Gruvin9xTrainerData_v104 trainer;
uint8_t view; //index of subview in main scrren
uint8_t disableThrottleWarning:1;
int8_t switchWarning:2; // -1=down, 0=off, 1=up
uint8_t beeperVal:3;
uint8_t disableMemoryWarning:1;
uint8_t disableAlarmWarning:1;
uint8_t stickMode;
uint8_t inactivityTimer;
uint8_t throttleReversed:1;
uint8_t minuteBeep:1;
uint8_t preBeep:1;
uint8_t flashBeep:1;
uint8_t disableSplashScreen:1;
uint8_t enableTelemetryAlarm:1; // 0=no, 1=yes (Sound alarm when there's no telem. data coming in)
uint8_t spare:2;
uint8_t filterInput;
uint8_t lightAutoOff;
uint8_t templateSetup; //RETA order according to chout_ar array
int8_t PPM_Multiplier;
Gruvin9xFrSkyRSSIAlarm frskyRssiAlarms[2];
operator GeneralSettings();
t_Gruvin9xGeneral_v104() { memset(this, 0, sizeof(t_Gruvin9xGeneral_v104)); }
}) Gruvin9xGeneral_v104;
typedef Gruvin9xGeneral_v104 Gruvin9xGeneral;
// eeprom modelspec
PACK(typedef struct t_Gruvin9xExpoData {
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
uint8_t chn:2;
uint8_t curve:4; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
int8_t swtch:5;
uint8_t phase:3; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
uint8_t negPhase:1;
uint8_t weight:7;
int8_t expo;
operator ExpoData();
t_Gruvin9xExpoData();
}) Gruvin9xExpoData;
PACK(typedef struct t_Gruvin9xLimitData {
int8_t min;
int8_t max;
bool revert;
int16_t offset;
operator LimitData();
t_Gruvin9xLimitData();
}) Gruvin9xLimitData;
#define MLTPX_ADD 0
#define MLTPX_MUL 1
#define MLTPX_REP 2
PACK(typedef struct t_Gruvin9xMixData {
uint8_t destCh:5; // 0, 1..C9X_NUM_CHNOUT
uint8_t mixWarn:3; // mixer warning
uint8_t srcRaw; //
int8_t weight;
int8_t swtch;
uint8_t curve; // 0=symmetrisch, 1=no neg, 2=no pos
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
uint8_t carryTrim:1;
uint8_t mltpx:3; // multiplex method 0=+ 1=* 2=replace
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
int8_t sOffset;
operator MixData();
t_Gruvin9xMixData();
}) Gruvin9xMixData;
PACK(typedef struct t_Gruvin9xLogicalSwitchData { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
operator LogicalSwitchData();
t_Gruvin9xLogicalSwitchData() { memset(this, 0, sizeof(t_Gruvin9xLogicalSwitchData)); }
}) Gruvin9xLogicalSwitchData;
PACK(typedef struct t_Gruvin9xSafetySwData { // Safety Switches data
int8_t swtch;
int8_t val;
t_Gruvin9xSafetySwData() { memset(this, 0, sizeof(t_Gruvin9xSafetySwData)); }
}) Gruvin9xSafetySwData;
PACK(typedef struct t_Gruvin9xCustomFunctionData { // Function Switches data
int8_t swtch; // input
uint8_t func;
operator CustomFunctionData();
t_Gruvin9xCustomFunctionData() { memset(this, 0, sizeof(t_Gruvin9xCustomFunctionData)); }
}) Gruvin9xCustomFunctionData;
PACK(typedef struct t_Gruvin9xFrSkyChannelData {
uint16_t ratio:12; // (Maximum resistor divider input volts +/- calibration. 0 means channel not used.
// 0.01v steps from 0 to 40.95V. Ex. 6.60 Volts = 660. 40.95V = 4095
uint16_t type:4; // channel display unit (0=volts, 1=raw, 2-15=reserverd.)
uint8_t alarms_value[2]; // raw sample values 0..255
uint8_t alarms_level:4; // two pairs of 2bits. none=0, yel=1, org=2, red=3
uint8_t alarms_greater:2; // two alarms, 1 bit each. 0=LT(<), 1=GT(>)
uint8_t spare:2;
uint8_t barMin; // minimum for bar display (raw ADC value)
uint8_t barMax; // ditto for max display (would G:NOT usually = ratio)
operator FrSkyChannelData();
t_Gruvin9xFrSkyChannelData();
}) Gruvin9xFrSkyChannelData;
PACK(typedef struct t_Gruvin9xFrSkyData {
Gruvin9xFrSkyChannelData channels[2];
operator FrSkyData();
t_Gruvin9xFrSkyData();
}) Gruvin9xFrSkyData;
PACK(typedef struct t_Gruvin9xSwashRingData { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Gruvin9xSwashRingData();
}) Gruvin9xSwashRingData;
PACK(typedef struct t_Gruvin9xFlightModeData_v102 {
int8_t trim[4]; // -125..125 => trim value, 127 => use trim of phase 0, -128, -127, -126 => use trim of phases 1|2|3|4 instead
int8_t swtch; // swtch of phase[0] is not used
char name[6];
uint8_t fadeIn:4;
uint8_t fadeOut:4;
operator FlightModeData();
t_Gruvin9xFlightModeData_v102() { memset(this, 0, sizeof(t_Gruvin9xFlightModeData_v102)); }
}) Gruvin9xFlightModeData_v102;
PACK(typedef struct t_Gruvin9xFlightModeData_v106 {
int8_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
int8_t trim_ext:8; // 2 less significant extra bits per trim (10bits trims)
int8_t swtch; // swtch of phase[0] is not used
char name[6];
uint8_t fadeIn:4;
uint8_t fadeOut:4;
operator FlightModeData();
t_Gruvin9xFlightModeData_v106() { memset(this, 0, sizeof(t_Gruvin9xFlightModeData_v106)); }
}) Gruvin9xFlightModeData_v106;
PACK(typedef struct t_Gruvin9xTimerData {
int8_t mode:7; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint8_t dir:1; // 0=>Count Down, 1=>Count Up
uint16_t val;
operator TimerData();
t_Gruvin9xTimerData() { memset(this, 0, sizeof(t_Gruvin9xTimerData)); }
}) Gruvin9xTimerData;
#define G9X_MAX_FLIGHT_MODES 5
#define G9X_MAX_MIXERS 32
#define G9X_MAX_EXPOS 14
#define G9X_MAX_CURVE5 8
#define G9X_MAX_CURVE9 8
#define G9X_NUM_CHNOUT 16 // number of real output channels CH1-CH16
#define G9X_NUM_CSW 12 // number of custom switches
#define G9X_NUM_FSW 12 // number of functions assigned to switches
// TODO
PACK(typedef struct t_Gruvin9xModelData_v102 {
char name[10]; // 10 must be first for eeLoadModelName
Gruvin9xTimerData timer1;
uint8_t protocol:3;
int8_t ppmNCH:3;
uint8_t thrTrim:1; // Enable Throttle Trim
uint8_t thrExpo:1; // Enable Throttle Expo
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Gruvin9xTimerData timer2;
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
int8_t curves5[G9X_MAX_CURVE5][5];
int8_t curves9[G9X_MAX_CURVE9][9];
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xSwashRingData swashR;
Gruvin9xFlightModeData_v102 flightModeData[G9X_MAX_FLIGHT_MODES];
Gruvin9xFrSkyData frsky;
operator ModelData();
t_Gruvin9xModelData_v102() { memset(this, 0, sizeof(t_Gruvin9xModelData_v102)); }
}) Gruvin9xModelData_v102;
PACK(typedef struct t_Gruvin9xModelData_v103 {
char name[10]; // 10 must be first for eeLoadModelName
Gruvin9xTimerData timer1;
uint8_t protocol:3;
int8_t ppmNCH:3;
uint8_t thrTrim:1; // Enable Throttle Trim
uint8_t thrExpo:1; // Enable Throttle Expo
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Gruvin9xTimerData timer2;
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
int8_t curves5[G9X_MAX_CURVE5][5];
int8_t curves9[G9X_MAX_CURVE9][9];
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xSwashRingData swashR;
Gruvin9xFlightModeData_v102 flightModeData[G9X_MAX_FLIGHT_MODES];
Gruvin9xFrSkyData frsky;
operator ModelData();
t_Gruvin9xModelData_v103() { memset(this, 0, sizeof(t_Gruvin9xModelData_v103)); }
}) Gruvin9xModelData_v103;
PACK(typedef struct t_Gruvin9xModelData_v105 {
char name[10]; // 10 must be first for eeLoadModelName
Gruvin9xTimerData timer1;
uint8_t protocol:3;
int8_t ppmNCH:3;
uint8_t thrTrim:1; // Enable Throttle Trim
uint8_t thrExpo:1; // Enable Throttle Expo
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Gruvin9xTimerData timer2;
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
int8_t curves5[G9X_MAX_CURVE5][5];
int8_t curves9[G9X_MAX_CURVE9][9];
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xCustomFunctionData customFn[G9X_NUM_FSW];
Gruvin9xSwashRingData swashR;
Gruvin9xFlightModeData_v102 flightModeData[G9X_MAX_FLIGHT_MODES];
int16_t subtrim[NUM_STICKS];
Gruvin9xFrSkyData frsky;
operator ModelData();
t_Gruvin9xModelData_v105() { memset(this, 0, sizeof(t_Gruvin9xModelData_v105)); }
}) Gruvin9xModelData_v105;
PACK(typedef struct t_Gruvin9xModelData_v106 {
char name[10]; // 10 must be first for eeLoadModelName
Gruvin9xTimerData timer1;
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t thrExpo:1; // Enable Throttle Expo
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Gruvin9xTimerData timer2;
Gruvin9xMixData mixData[G9X_MAX_MIXERS];
Gruvin9xLimitData limitData[G9X_NUM_CHNOUT];
Gruvin9xExpoData expoData[G9X_MAX_EXPOS];
int8_t curves5[G9X_MAX_CURVE5][5];
int8_t curves9[G9X_MAX_CURVE9][9];
Gruvin9xLogicalSwitchData logicalSw[G9X_NUM_CSW];
Gruvin9xSafetySwData safetySw[G9X_NUM_CHNOUT];
Gruvin9xCustomFunctionData customFn[G9X_NUM_FSW];
Gruvin9xSwashRingData swashR;
Gruvin9xFlightModeData_v106 flightModeData[G9X_MAX_FLIGHT_MODES];
Gruvin9xFrSkyData frsky;
operator ModelData();
t_Gruvin9xModelData_v106() { memset(this, 0, sizeof(t_Gruvin9xModelData_v106)); }
}) Gruvin9xModelData_v106;
typedef Gruvin9xModelData_v106 Gruvin9xModelData;
#endif

View file

@ -1,252 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <iostream>
#include "gruvin9xinterface.h"
#include "gruvin9xeeprom.h"
#include "rlefile.h"
#include "appdata.h"
#define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2
#define FILE_GENERAL 0
#define FILE_MODEL(n) (1+n)
Gruvin9xInterface::Gruvin9xInterface(BoardEnum board):
EEPROMInterface(board),
efile(new RleFile())
{
}
Gruvin9xInterface::~Gruvin9xInterface()
{
delete efile;
}
const char * Gruvin9xInterface::getName()
{
if (board == BOARD_STOCK)
return "Gruvin9x";
else
return "Gruvin9x v4";
}
const int Gruvin9xInterface::getEEpromSize()
{
if (board == BOARD_STOCK) {
QString avrMCU = g.mcu();
if (avrMCU==QString("m128")) {
return EESIZE_STOCK*2;
}
return EESIZE_STOCK;
} else {
return EESIZE_GRUVIN9X;
}
}
const int Gruvin9xInterface::getMaxModels()
{
return 16;
}
template <class T>
void Gruvin9xInterface::loadModel(ModelData &model, unsigned int stickMode, int version)
{
T _model;
if ((version == 2 && efile->readRlc2((uint8_t*)&_model, sizeof(T))) ||
(version == 1 && efile->readRlc1((uint8_t*)&_model, sizeof(T)))) {
model = _model;
if (stickMode) {
applyStickModeToModel(model, stickMode);
}
}
else {
model.clear();
}
}
template <class T>
bool Gruvin9xInterface::loadGeneral(GeneralSettings &settings, int version)
{
T _settings;
if ((version == 2 && efile->readRlc2((uint8_t*)&_settings, sizeof(T))) ||
(version == 1 && efile->readRlc1((uint8_t*)&_settings, sizeof(T)))) {
settings = _settings;
return true;
}
std::cerr << "error when loading general settings";
return false;
}
unsigned long Gruvin9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{
std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
unsigned long Gruvin9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{
std::cout << "trying " << getName() << " import... ";
std::bitset<NUM_ERRORS> errors;
if (size != this->getEEpromSize()) {
std::cout << "wrong size\n";
errors.set(WRONG_SIZE);
return errors.to_ulong();
}
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
std::cout << "wrong file system\n";
errors.set(WRONG_FILE_SYSTEM);
return errors.to_ulong();
}
efile->openRd(FILE_GENERAL);
uint8_t version;
if (efile->readRlc2(&version, 1) != 1) {
std::cout << "no\n";
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
if (version == 0) {
efile->openRd(FILE_GENERAL);
if (efile->readRlc1(&version, 1) != 1) {
std::cout << "no\n";
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
}
std::cout << "version " << (unsigned int)version << " ";
switch(version) {
case 5:
case 100:
case 101:
case 102:
case 103:
case 104:
case 105:
// subtrims(16bits) + function switches added
case 106:
// trims(10bits), no subtrims
break;
default:
std::cout << "not gruvin9x\n";
errors.set(NOT_GRUVIN9X);
return errors.to_ulong();
}
efile->openRd(FILE_GENERAL);
if (version == 5) {
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings, 1)) {
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
}
else if (version < 104) {
if (!loadGeneral<Gruvin9xGeneral_v103>(radioData.generalSettings)) {
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
}
else if (version <= 106) {
if (!loadGeneral<Gruvin9xGeneral_v104>(radioData.generalSettings)) {
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
}
else {
std::cout << "ko\n";
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
for (int i=0; i<getMaxModels(); i++) {
efile->openRd(FILE_MODEL(i));
if (version == 5) {
loadModel<Gruvin9xModelData_v102>(radioData.models[i], radioData.generalSettings.stickMode+1, 1);
}
else if (version < 103) {
loadModel<Gruvin9xModelData_v102>(radioData.models[i], radioData.generalSettings.stickMode+1);
}
else if (version == 103) {
loadModel<Gruvin9xModelData_v103>(radioData.models[i], radioData.generalSettings.stickMode+1);
}
else if (version == 105) {
loadModel<Gruvin9xModelData_v105>(radioData.models[i], radioData.generalSettings.stickMode+1);
}
else if (version == 106) {
loadModel<Gruvin9xModelData_v106>(radioData.models[i], radioData.generalSettings.stickMode+1);
}
else {
std::cout << "ko\n";
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
}
std::cout << "ok\n";
errors.set(ALL_OK);
return errors.to_ulong();
}
unsigned long Gruvin9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{
std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
int Gruvin9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
{
std::cout << "NO!\n";
// TODO an error
return 0;
}
int Gruvin9xInterface::getSize(const ModelData & model)
{
return 0;
}
int Gruvin9xInterface::getSize(const GeneralSettings & settings)
{
return 0;
}
int Gruvin9xInterface::isAvailable(PulsesProtocol proto, int port)
{
switch (proto) {
case PULSES_PPM:
case PULSES_SILV_A:
case PULSES_SILV_B:
case PULSES_SILV_C:
case PULSES_CTP1009:
case PULSES_DSM2:
return 1;
default:
return 0;
}
}

View file

@ -1,65 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef gruvin9x_interface_h
#define gruvin9x_interface_h
#include "eeprominterface.h"
class RleFile;
class Gruvin9xInterface : public EEPROMInterface
{
public:
Gruvin9xInterface(BoardEnum board);
virtual ~Gruvin9xInterface();
virtual const char * getName();
virtual const int getEEpromSize();
virtual const int getMaxModels();
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom,int esize, int index);
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(const ModelData &);
virtual int getSize(const GeneralSettings & settings);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:
template <class T>
void loadModel(ModelData &model, unsigned int stickMode=0, int version=2);
template <class T>
bool loadGeneral(GeneralSettings &settings, int version=2);
RleFile *efile;
};
#endif

View file

@ -1,838 +0,0 @@
#include <stdlib.h>
#include <algorithm>
#include "helpers.h"
#include "open9xGruvin9xeeprom.h"
#include <QObject>
#include <QMessageBox>
extern void getEEPROMZString(char *dst, const char *src, int size);
extern RawSwitch open9xStockToSwitch(int8_t sw);
t_Open9xGruvin9xFlightModeData_v207::operator FlightModeData ()
{
FlightModeData c9x;
for (int i=0; i<NUM_STICKS; i++)
c9x.trim[i] = (((int16_t)trim[i]) << 2) + ((trim_ext >> (2*i)) & 0x03);
c9x.swtch = open9xStockToSwitch(swtch);
getEEPROMZString(c9x.name, name, sizeof(name));
c9x.fadeIn = fadeIn;
c9x.fadeOut = fadeOut;
for (int i=0; i<2; i++)
c9x.rotaryEncoders[i] = rotaryEncoders[i];
return c9x;
}
t_Open9xGruvin9xFlightModeData_v208::operator FlightModeData ()
{
FlightModeData c9x;
for (int i=0; i<NUM_STICKS; i++)
c9x.trim[i] = trim[i];
c9x.swtch = open9xStockToSwitch(swtch);
getEEPROMZString(c9x.name, name, sizeof(name));
c9x.fadeIn = fadeIn;
c9x.fadeOut = fadeOut;
for (int i=0; i<2; i++)
c9x.rotaryEncoders[i] = rotaryEncoders[i];
return c9x;
}
t_Open9xGruvin9xMixData_v207::operator MixData ()
{
MixData c9x;
if (srcRaw) {
c9x.destCh = destCh+1;
if (srcRaw == 0) {
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
}
else if (srcRaw <= 7) {
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
}
else if (srcRaw <= 9) {
c9x.srcRaw = RawSource(SOURCE_TYPE_ROTARY_ENCODER, srcRaw-8);
}
else if (srcRaw == 10) {
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
}
/* else if (srcRaw == 11) {
c9x.srcRaw = RawSource(SOURCE_TYPE_3POS);
} */
else if (srcRaw <= 32) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-11);
}
else if (srcRaw <= 35) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-33);
}
else if (srcRaw <= 43) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-36);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-44);
}
c9x.weight = weight;
if (differential) {
c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
}
else {
// TODO c9x.curve = curve;
}
c9x.swtch = open9xStockToSwitch(swtch);
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
c9x.speedDown = speedDown;
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.flightModes=0;
}
else {
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
}
return c9x;
}
t_Open9xGruvin9xMixData_v209::operator MixData ()
{
MixData c9x;
if (srcRaw) {
c9x.destCh = destCh+1;
if (srcRaw == 0) {
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
}
else if (srcRaw <= 7) {
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
}
else if (srcRaw <= 9) {
c9x.srcRaw = RawSource(SOURCE_TYPE_ROTARY_ENCODER, srcRaw-8);
}
else if (srcRaw <= 13) {
c9x.srcRaw = RawSource(SOURCE_TYPE_TRIM, srcRaw-10);
}
else if (srcRaw == 14) {
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
}
else if (srcRaw == 15) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
}
else if (srcRaw <= 36) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-15);
}
else if (srcRaw <= 39) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-37);
}
else if (srcRaw <= 47) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-40);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-48);
}
c9x.weight = weight;
if (differential) {
c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, differential*2);
}
else {
// TODO c9x.curve = curve;
}
c9x.swtch = open9xStockToSwitch(swtch);
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
c9x.speedDown = speedDown;
c9x.carryTrim = carryTrim;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
if (phase<0) {
c9x.flightModes= 1 << (-phase -1);
}
else if (phase==0) {
c9x.flightModes=0;
}
else {
c9x.flightModes=63;
c9x.flightModes &= ~(1 << (phase -1));
}
c9x.sOffset = sOffset;
}
return c9x;
}
t_Open9xGruvin9xMixData_v211::operator MixData ()
{
MixData c9x;
if (srcRaw) {
c9x.destCh = destCh+1;
if (srcRaw == 0) {
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE);
}
else if (srcRaw <= 7) {
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw-1);
}
else if (srcRaw <= 9) {
c9x.srcRaw = RawSource(SOURCE_TYPE_ROTARY_ENCODER, srcRaw-8);
}
else if (srcRaw <= 13) {
c9x.srcRaw = RawSource(SOURCE_TYPE_TRIM, srcRaw-10);
}
else if (srcRaw == 14) {
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
}
else if (srcRaw == 15) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, 0);
}
else if (srcRaw <= 36) {
c9x.srcRaw = RawSource(SOURCE_TYPE_SWITCH, srcRaw-15);
}
else if (srcRaw <= 39) {
c9x.srcRaw = RawSource(SOURCE_TYPE_CYC, srcRaw-37);
}
else if (srcRaw <= 47) {
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-40);
}
else {
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-48);
}
c9x.weight = weight;
c9x.swtch = open9xStockToSwitch(swtch);
if (curveMode==0) {
c9x.curve = CurveReference(CurveReference::CURVE_REF_DIFF, curveParam);
}
else {
// TODO c9x.curve = curve;
}
c9x.delayUp = delayUp;
c9x.delayDown = delayDown;
c9x.speedUp = speedUp;
c9x.speedDown = speedDown;
c9x.carryTrim = carryTrim;
c9x.noExpo = noExpo;
c9x.mltpx = (MltpxValue)mltpx;
c9x.mixWarn = mixWarn;
c9x.flightModes = phases;
c9x.sOffset = sOffset;
}
return c9x;
}
RawSource open9xV4207ToSource(int8_t value)
{
if (value == 0) {
return RawSource(SOURCE_TYPE_NONE);
}
else if (value <= 7) {
return RawSource(SOURCE_TYPE_STICK, value - 1);
}
else if (value <= 9) {
return RawSource(SOURCE_TYPE_ROTARY_ENCODER, value - 8);
}
else if (value == 10) {
return RawSource(SOURCE_TYPE_MAX);
}
/* else if (value == 11) {
return RawSource(SOURCE_TYPE_3POS);
} */
else if (value <= 14) {
return RawSource(SOURCE_TYPE_CYC, value-12);
}
else if (value <= 22) {
return RawSource(SOURCE_TYPE_PPM, value-15);
}
else if (value <= 38) {
return RawSource(SOURCE_TYPE_CH, value-23);
}
else {
return RawSource(SOURCE_TYPE_TELEMETRY, value-38);
}
}
RawSource open9xV4209ToSource(int8_t value)
{
if (value == 0) {
return RawSource(SOURCE_TYPE_NONE);
}
else if (value <= 7) {
return RawSource(SOURCE_TYPE_STICK, value - 1);
}
else if (value <= 9) {
return RawSource(SOURCE_TYPE_ROTARY_ENCODER, value - 8);
}
else if (value <= 13) {
return RawSource(SOURCE_TYPE_STICK, value - 10);
}
else if (value == 14) {
return RawSource(SOURCE_TYPE_MAX);
}
/* else if (value == 15) {
return RawSource(SOURCE_TYPE_3POS);
} */
else if (value <= 18) {
return RawSource(SOURCE_TYPE_CYC, value-16);
}
else if (value <= 26) {
return RawSource(SOURCE_TYPE_PPM, value-19);
}
else if (value <= 42) {
return RawSource(SOURCE_TYPE_CH, value-27);
}
else {
return RawSource(SOURCE_TYPE_TELEMETRY, value-42);
}
}
Open9xGruvin9xLogicalSwitchData_v207::operator LogicalSwitchData ()
{
LogicalSwitchData c9x;
c9x.func = func;
c9x.val1 = v1;
c9x.val2 = v2;
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
c9x.val1 = open9xV4207ToSource(v1).toValue();
}
if (c9x.func >= LS_FN_EQUAL) {
c9x.val2 = open9xV4207ToSource(v2).toValue();
}
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
c9x.val1 = open9xStockToSwitch(v1).toValue();
c9x.val2 = open9xStockToSwitch(v2).toValue();
}
return c9x;
}
Open9xGruvin9xLogicalSwitchData_v209::operator LogicalSwitchData ()
{
LogicalSwitchData c9x;
c9x.func = func;
c9x.val1 = v1;
c9x.val2 = v2;
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
c9x.val1 = open9xV4209ToSource(v1).toValue();
}
if (c9x.func >= LS_FN_EQUAL && c9x.func <= LS_FN_ELESS) {
c9x.val2 = open9xV4209ToSource(v2).toValue();
}
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
c9x.val1 = open9xStockToSwitch(v1).toValue();
c9x.val2 = open9xStockToSwitch(v2).toValue();
}
return c9x;
}
t_Open9xGruvin9xCustomFunctionData_v203::operator CustomFunctionData ()
{
CustomFunctionData c9x;
c9x.swtch = open9xStockToSwitch(swtch);
if (func < 16) {
c9x.func = (AssignFunc)(func);
c9x.enabled=param & 0x01;
c9x.param = (param>>1)<<1;
}
else {
c9x.param = param;
if (func <= 20)
c9x.func = (AssignFunc)(func);
else if (func == 21)
c9x.func = FuncInstantTrim;
else if (func == 22)
c9x.func = FuncPlaySound;
else if (func == 23)
c9x.func = FuncPlayHaptic;
else if (func == 24)
c9x.func = FuncReset;
else if (func == 25)
c9x.func = FuncVario;
else if (func == 26)
c9x.func = FuncPlayPrompt;
else if (func == 27)
c9x.func = FuncPlayValue;
else if (func == 28)
c9x.func = FuncLogs;
else if (func == 29)
c9x.func = FuncBacklight;
else if (func >= 30 && func <= 34)
c9x.func = AssignFunc(FuncAdjustGV1 + func - 30);
else
c9x.clear();
}
return c9x;
}
t_Open9xGruvin9xCustomFunctionData_v210::operator CustomFunctionData ()
{
CustomFunctionData c9x;
c9x.swtch = open9xStockToSwitch(swtch);
c9x.param = param;
if (func < 22) {
c9x.func = (AssignFunc)(func);
c9x.enabled = delay;
} else {
if (func == 22)
c9x.func = FuncPlaySound;
else if (func == 23)
c9x.func = FuncPlayHaptic;
else if (func == 24)
c9x.func = FuncReset;
else if (func == 25)
c9x.func = FuncVario;
else if (func == 26)
c9x.func = FuncPlayPrompt;
else if (func == 27)
c9x.func = FuncPlayValue;
else if (func == 28)
c9x.func = FuncLogs;
else
c9x.clear();
}
return c9x;
}
t_Open9xGruvin9xSwashRingData_v208::operator SwashRingData ()
{
SwashRingData c9x;
c9x.elevatorWeight = invertELE ? -100 : 100;
c9x.aileronWeight = invertAIL ? -100 : 100;
c9x.collectiveWeight = invertCOL ? -100 : 100;
c9x.type = type;
c9x.collectiveSource = open9xV4207ToSource(collectiveSource);
c9x.value = value;
return c9x;
}
t_Open9xGruvin9xSwashRingData_v209::operator SwashRingData ()
{
SwashRingData c9x;
c9x.elevatorWeight = invertELE ? -100 : 100;
c9x.aileronWeight = invertAIL ? -100 : 100;
c9x.collectiveWeight = invertCOL ? -100 : 100;
c9x.type = type;
c9x.collectiveSource = open9xV4209ToSource(collectiveSource);
c9x.value = value;
return c9x;
}
t_Open9xGruvin9xModelData_v207::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
if (c9x.flightModeData[i].trimRef[j] >= i)
c9x.flightModeData[i].trimRef[j] += 1;
c9x.flightModeData[i].trim[j] = 0;
}
}
}
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<12; i++)
c9x.logicalSw[i] = logicalSw[i];
for (int i=0; i<16; i++)
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
}
t_Open9xGruvin9xModelData_v208::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
if (c9x.flightModeData[i].trimRef[j] >= i)
c9x.flightModeData[i].trimRef[j] += 1;
c9x.flightModeData[i].trim[j] = 0;
}
}
}
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<12; i++)
c9x.logicalSw[i] = logicalSw[i];
for (int i=0; i<16; i++)
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.frsky.varioSource = varioSource;
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
return c9x;
}
t_Open9xGruvin9xModelData_v209::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
if (c9x.flightModeData[i].trimRef[j] >= i)
c9x.flightModeData[i].trimRef[j] += 1;
c9x.flightModeData[i].trim[j] = 0;
}
}
}
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<8; i++) {
c9x.curves[i].count = 5;
for (int j = 0; j < 5; j++) {
c9x.curves[i].points[j].x = -100 + 50 * i;
c9x.curves[i].points[j].y = curves5[i][j];
}
}
for (int i=0; i<8; i++) {
c9x.curves[8 + i].count = 9;
for (int j = 0; j < 9; j++) {
c9x.curves[8 + i].points[j].x = -100 + 25 * i;
c9x.curves[8 + i].points[j].y = curves9[i][j];
}
}
for (int i=0; i<12; i++)
c9x.logicalSw[i] = logicalSw[i];
for (int i=0; i<16; i++)
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.frsky.varioSource = varioSource;
c9x.frsky.varioCenterMax = varioSpeedUpMin;
c9x.frsky.varioCenterMin = varioSpeedDownMin;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
return c9x;
}
t_Open9xGruvin9xModelData_v210::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<2; i++)
c9x.timers[i] = timers[i];
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
if (c9x.flightModeData[i].trimRef[j] >= i)
c9x.flightModeData[i].trimRef[j] += 1;
c9x.flightModeData[i].trim[j] = 0;
}
}
}
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<8; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
for (int j=0; j<crvinfo.points; j++)
c9x.curves[i].points[j].y = crvinfo.crv[j];
if (crvinfo.custom) {
c9x.curves[i].points[0].x = -100;
for (int j=1; j<crvinfo.points-1; j++)
c9x.curves[i].points[j].x = crvinfo.crv[crvinfo.points+j-1];
c9x.curves[i].points[crvinfo.points-1].x = +100;
}
else {
for (int j=0; j<crvinfo.points; j++)
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
}
}
for (int i=0; i<12; i++)
c9x.logicalSw[i] = logicalSw[i];
for (int i=0; i<16; i++)
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
for (int i=0; i<16; i++) {
c9x.limitData[i].ppmCenter = servoCenter[i];
}
return c9x;
}
t_Open9xGruvin9xModelData_v211::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMZString(c9x.name, name, sizeof(name));
for (int i=0; i<2; i++) {
c9x.timers[i] = timers[i];
c9x.timers[i].persistent = timersXtra[i].remanent;
c9x.timers[i].val = timersXtra[i].value;
}
switch(protocol) {
case 1:
c9x.moduleData[0].protocol = PULSES_PPM16;
break;
case 2:
c9x.moduleData[0].protocol = PULSES_PPMSIM;
break;
case 3:
c9x.moduleData[0].protocol = PULSES_PXX_DJT;
break;
case 4:
c9x.moduleData[0].protocol = PULSES_DSM2;
break;
default:
c9x.moduleData[0].protocol = PULSES_PPM;
break;
}
c9x.moduleData[0].channelsCount = 8 + (2 * ppmNCH);
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc - 2;
c9x.disableThrottleWarning=disableThrottleWarning;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.beepANACenter = beepANACenter;
c9x.moduleData[0].ppm.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.extendedTrims = extendedTrims;
for (int i=0; i<5; i++) {
c9x.flightModeData[i] = flightModeData[i];
for (int j=0; j<NUM_STICKS; j++) {
if (c9x.flightModeData[i].trim[j] > 500) {
c9x.flightModeData[i].trimRef[j] = c9x.flightModeData[i].trim[j] - 501;
if (c9x.flightModeData[i].trimRef[j] >= i)
c9x.flightModeData[i].trimRef[j] += 1;
c9x.flightModeData[i].trim[j] = 0;
}
}
}
for (int i=0; i<32; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<16; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<14; i++)
c9x.expoData[i] = expoData[i];
for (int i=0; i<8; i++) {
CurveInfo crvinfo = curveinfo(this, i);
c9x.curves[i].type = (crvinfo.custom ? CurveData::CURVE_TYPE_CUSTOM : CurveData::CURVE_TYPE_STANDARD);
c9x.curves[i].count = crvinfo.points;
for (int j=0; j<crvinfo.points; j++)
c9x.curves[i].points[j].y = crvinfo.crv[j];
if (crvinfo.custom) {
c9x.curves[i].points[0].x = -100;
for (int j=1; j<crvinfo.points-1; j++)
c9x.curves[i].points[j].x = crvinfo.crv[crvinfo.points+j-1];
c9x.curves[i].points[crvinfo.points-1].x = +100;
}
else {
for (int j=0; j<crvinfo.points; j++)
c9x.curves[i].points[j].x = -100 + (200*i) / (crvinfo.points-1);
}
}
for (int i=0; i<12; i++)
c9x.logicalSw[i] = logicalSw[i];
for (int i=0; i<16; i++)
c9x.customFn[i] = customFn[i];
c9x.swashRingData = swashR;
c9x.frsky = frsky;
c9x.switchWarningStates = switchWarningStates;
c9x.moduleData[0].ppm.frameLength = ppmFrameLength;
c9x.thrTraceSrc = thrTraceSrc;
c9x.moduleData[0].modelId = modelId;
return c9x;
}

View file

@ -1,365 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef open9xGruvin9xeeprom_h
#define open9xGruvin9xeeprom_h
#define O9X_V4_MAX_CSFUNCOLD 13
#define O9X_V4_MAX_CSFUNC 15
#include "open9xStockeeprom.h"
PACK(typedef struct t_Open9xGruvin9xFlightModeData_v207 {
int8_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
int8_t trim_ext:8; // 2 less significant extra bits per trim (10bits trims)
int8_t swtch; // swtch of phase[0] is not used
char name[6];
uint8_t fadeIn:4;
uint8_t fadeOut:4;
int16_t rotaryEncoders[2];
operator FlightModeData();
t_Open9xGruvin9xFlightModeData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xFlightModeData_v207)); }
}) Open9xGruvin9xFlightModeData_v207;
PACK(typedef struct t_Open9xGruvin9xFlightModeData_v208 {
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
int8_t swtch; // swtch of phase[0] is not used
char name[6];
uint8_t fadeIn:4;
uint8_t fadeOut:4;
int16_t rotaryEncoders[2];
operator FlightModeData();
t_Open9xGruvin9xFlightModeData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xFlightModeData_v208)); }
}) Open9xGruvin9xFlightModeData_v208;
PACK(typedef struct t_Open9xGruvin9xMixData_v207 {
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
int8_t weight;
int8_t swtch:6;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t curve:6;
uint8_t mixWarn:2; // mixer warning
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
uint16_t srcRaw:7; //
uint16_t differential:7;
uint16_t carryTrim:2;
int8_t sOffset;
operator MixData();
t_Open9xGruvin9xMixData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v207)); }
}) Open9xGruvin9xMixData_v207;
PACK(typedef struct t_Open9xGruvin9xMixData_v209 {
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
int8_t weight;
int8_t swtch:6;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t curve:6;
uint8_t mixWarn:2; // mixer warning
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
uint16_t srcRaw:6; //
int16_t differential:7;
int16_t carryTrim:3;
int8_t sOffset;
operator MixData();
t_Open9xGruvin9xMixData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v209)); }
}) Open9xGruvin9xMixData_v209;
PACK(typedef struct t_Open9xGruvin9xMixData_v211 {
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
uint8_t curveMode:1; // O=curve, 1=differential
uint8_t noExpo:1;
uint8_t spare:2;
int8_t weight;
int8_t swtch:6;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
uint8_t phases:5;
int8_t carryTrim:3;
uint8_t srcRaw:6;
uint8_t mixWarn:2; // mixer warning
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4;
uint8_t speedDown:4;
int8_t curveParam;
int8_t sOffset;
operator MixData();
t_Open9xGruvin9xMixData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xMixData_v211)); }
}) Open9xGruvin9xMixData_v211;
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v207 { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
operator LogicalSwitchData();
t_Open9xGruvin9xLogicalSwitchData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v207)); }
int8_t fromSource(RawSource source);
RawSource toSource(int8_t value);
}) Open9xGruvin9xLogicalSwitchData_v207;
PACK(typedef struct t_Open9xGruvin9xLogicalSwitchData_v209 { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
operator LogicalSwitchData();
t_Open9xGruvin9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xLogicalSwitchData_v209)); }
int8_t fromSource(RawSource source);
RawSource toSource(int8_t value);
}) Open9xGruvin9xLogicalSwitchData_v209;
PACK(typedef struct t_Open9xGruvin9xCustomFunctionData_v203 { // Function Switches data
int8_t swtch; // input
uint8_t func;
uint8_t param;
operator CustomFunctionData();
t_Open9xGruvin9xCustomFunctionData_v203() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomFunctionData_v203)); }
}) Open9xGruvin9xCustomFunctionData_v203;
PACK(typedef struct t_Open9xGruvin9xCustomFunctionData_v210 { // Function Switches data
int8_t swtch; // input
uint8_t func:5;
uint8_t delay:3;
uint8_t param;
operator CustomFunctionData();
t_Open9xGruvin9xCustomFunctionData_v210() { memset(this, 0, sizeof(t_Open9xGruvin9xCustomFunctionData_v210)); }
}) Open9xGruvin9xCustomFunctionData_v210;
PACK(typedef struct t_Open9xGruvin9xSwashRingData_v208 { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Open9xGruvin9xSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xSwashRingData_v208)); }
}) Open9xGruvin9xSwashRingData_v208;
PACK(typedef struct t_Open9xGruvin9xSwashRingData_v209 { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Open9xGruvin9xSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xSwashRingData_v209)); }
}) Open9xGruvin9xSwashRingData_v209;
PACK(typedef struct t_Open9xGruvin9xModelData_v207 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v207 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xGruvin9xLogicalSwitchData_v207 logicalSw[12];
Open9xCustomFunctionData_v203 customFn[16];
Open9xGruvin9xSwashRingData_v208 swashR;
Open9xGruvin9xFlightModeData_v207 flightModeData[5];
Open9xFrSkyData_v205 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
operator ModelData();
t_Open9xGruvin9xModelData_v207() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v207)); }
}) Open9xGruvin9xModelData_v207;
PACK(typedef struct t_Open9xGruvin9xModelData_v208 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v207 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xGruvin9xLogicalSwitchData_v207 logicalSw[12];
Open9xGruvin9xCustomFunctionData_v203 customFn[16];
Open9xGruvin9xSwashRingData_v208 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
operator ModelData();
t_Open9xGruvin9xModelData_v208() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v208)); }
}) Open9xGruvin9xModelData_v208;
PACK(typedef struct t_Open9xGruvin9xModelData_v209 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xGruvin9xLogicalSwitchData_v209 logicalSw[12];
Open9xGruvin9xCustomFunctionData_v203 customFn[16];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
uint8_t switchWarningStates;
operator ModelData();
t_Open9xGruvin9xModelData_v209() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v209)); }
}) Open9xGruvin9xModelData_v209;
PACK(typedef struct t_Open9xGruvin9xModelData_v210 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xGruvin9xLogicalSwitchData_v209 logicalSw[12];
Open9xGruvin9xCustomFunctionData_v210 customFn[16];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[16];
uint8_t switchWarningStates;
Open9xFrSkyData_v210 frsky;
operator ModelData();
t_Open9xGruvin9xModelData_v210() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v210)); }
}) Open9xGruvin9xModelData_v210;
PACK(typedef struct t_Open9xGruvin9xModelData_v211 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare1:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xGruvin9xMixData_v211 mixData[32];
Open9xLimitData_v211 limitData[16];
Open9xExpoData_v211 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xGruvin9xLogicalSwitchData_v209 logicalSw[12];
Open9xGruvin9xCustomFunctionData_v210 customFn[16];
Open9xGruvin9xSwashRingData_v209 swashR;
Open9xGruvin9xFlightModeData_v208 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t switchWarningStates;
Open9xFrSkyData_v210 frsky;
Open9xTimerDataExtra timersXtra[2];
operator ModelData();
t_Open9xGruvin9xModelData_v211() { memset(this, 0, sizeof(t_Open9xGruvin9xModelData_v211)); }
}) Open9xGruvin9xModelData_v211;
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,508 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef open9xSky9xeeprom_h
#define open9xSky9xeeprom_h
#include "open9xStockeeprom.h"
PACK(typedef struct t_Open9xArmTimerData_v202 {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint16_t val;
operator TimerData();
t_Open9xArmTimerData_v202() { memset(this, 0, sizeof(t_Open9xArmTimerData_v202)); }
}) Open9xArmTimerData_v202;
PACK(typedef struct t_Open9xArmExpoData_v208 {
uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both
uint8_t chn;
int8_t curve; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
int8_t swtch;
int8_t phase; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
uint8_t weight;
int8_t expo;
operator ExpoData();
t_Open9xArmExpoData_v208() { memset(this, 0, sizeof(t_Open9xArmExpoData_v208)); }
}) Open9xArmExpoData_v208;
PACK(typedef struct t_Open9xArmExpoData_v210 {
uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both
uint8_t chn;
int8_t curve; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
int8_t swtch;
int8_t phase; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
uint8_t weight;
int8_t expo;
char name[6];
uint8_t spare[4];
operator ExpoData();
t_Open9xArmExpoData_v210() { memset(this, 0, sizeof(t_Open9xArmExpoData_v210)); }
}) Open9xArmExpoData_v210;
PACK(typedef struct t_Open9xArmExpoData_v212 {
uint8_t mode; // 0=end, 1=pos, 2=neg, 3=both
uint8_t chn;
int8_t swtch;
uint16_t phases;
int8_t weight;
uint8_t curveMode;
char name[6];
int8_t curveParam;
operator ExpoData();
t_Open9xArmExpoData_v212() { memset(this, 0, sizeof(t_Open9xArmExpoData_v212)); }
}) Open9xArmExpoData_v212;
PACK(typedef struct t_Open9xArmMixData_v208 {
uint8_t destCh; // 0, 1..C9X_NUM_CHNOUT
int8_t phase; // -5=!FP4, 0=normal, 5=FP4
int8_t weight;
int8_t swtch;
uint8_t mltpx; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t curve;
uint8_t mixWarn; // mixer warning
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown; // 0 nichts
uint8_t srcRaw; //
int8_t differential;
uint8_t carryTrim;
int8_t sOffset;
operator MixData();
t_Open9xArmMixData_v208() { memset(this, 0, sizeof(t_Open9xArmMixData_v208)); }
}) Open9xArmMixData_v208;
PACK(typedef struct t_Open9xArmMixData_v209 {
uint8_t destCh; // 0, 1..C9X_NUM_CHNOUT
int8_t phase; // -5=!FP4, 0=normal, 5=FP4
int8_t weight;
int8_t swtch;
uint8_t mltpx; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t curve;
uint8_t mixWarn; // mixer warning
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown; // 0 nichts
uint8_t srcRaw; //
int8_t differential;
int8_t carryTrim;
int8_t sOffset;
operator MixData();
t_Open9xArmMixData_v209() { memset(this, 0, sizeof(t_Open9xArmMixData_v209)); }
}) Open9xArmMixData_v209;
PACK(typedef struct t_Open9xArmMixData_v210 {
uint8_t destCh; // 0, 1..C9X_NUM_CHNOUT
int8_t phase; // -5=!FP4, 0=normal, 5=FP4
int8_t weight;
int8_t swtch;
uint8_t mltpx; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t curve;
uint8_t mixWarn; // mixer warning
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown; // 0 nichts
uint8_t srcRaw; //
int8_t differential;
int8_t carryTrim;
int8_t sOffset;
char name[6];
uint8_t spare[4];
operator MixData();
t_Open9xArmMixData_v210() { memset(this, 0, sizeof(t_Open9xArmMixData_v210)); }
}) Open9xArmMixData_v210;
PACK(typedef struct t_Open9xArmMixData_v212 {
uint8_t destCh;
uint16_t phases;
uint8_t curveMode:1; // O=curve, 1=differential
uint8_t noExpo:1;
int8_t carryTrim:3;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
uint8_t spare:1;
int8_t weight;
int8_t swtch;
int8_t curveParam;
uint8_t mixWarn; // mixer warning
uint8_t delayUp;
uint8_t delayDown;
uint8_t speedUp;
uint8_t speedDown;
uint8_t srcRaw;
int8_t sOffset;
char name[6];
operator MixData();
t_Open9xArmMixData_v212() { memset(this, 0, sizeof(t_Open9xArmMixData_v212)); }
}) Open9xArmMixData_v212;
PACK(typedef struct t_Open9xArmFlightModeData_v208 {
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
int8_t swtch; // swtch of phase[0] is not used
char name[6];
uint8_t fadeIn:4;
uint8_t fadeOut:4;
operator FlightModeData();
t_Open9xArmFlightModeData_v208() { memset(this, 0, sizeof(t_Open9xArmFlightModeData_v208)); }
}) Open9xArmFlightModeData_v208;
PACK(typedef struct t_Open9xArmFlightModeData_v212 {
int16_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
int8_t swtch; // swtch of phase[0] is not used
char name[6];
uint8_t fadeIn:4;
uint8_t fadeOut:4;
int16_t rotaryEncoders[1];
operator FlightModeData();
t_Open9xArmFlightModeData_v212() { memset(this, 0, sizeof(t_Open9xArmFlightModeData_v212)); }
}) Open9xArmFlightModeData_v212;
PACK(typedef struct t_Open9xArmLogicalSwitchData_v208 { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
operator LogicalSwitchData();
t_Open9xArmLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v208)); }
}) Open9xArmLogicalSwitchData_v208;
PACK(typedef struct t_Open9xArmLogicalSwitchData_v209 { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
operator LogicalSwitchData();
t_Open9xArmLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v209)); }
}) Open9xArmLogicalSwitchData_v209;
PACK(typedef struct t_Open9xArmLogicalSwitchData_v210 { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
uint8_t delay;
uint8_t duration;
operator LogicalSwitchData();
t_Open9xArmLogicalSwitchData_v210() { memset(this, 0, sizeof(t_Open9xArmLogicalSwitchData_v210)); }
}) Open9xArmLogicalSwitchData_v210;
PACK(typedef struct t_Open9xArmCustomFunctionData_v208 { // Function Switches data
int8_t swtch; // input
uint8_t func;
uint8_t param;
operator CustomFunctionData();
t_Open9xArmCustomFunctionData_v208() { memset(this, 0, sizeof(t_Open9xArmCustomFunctionData_v208)); }
}) Open9xArmCustomFunctionData_v208;
PACK(typedef struct t_Open9xArmCustomFunctionData_v210 { // Function Switches data
int8_t swtch; // input
uint8_t func;
char param[6];
operator CustomFunctionData();
t_Open9xArmCustomFunctionData_v210() { memset(this, 0, sizeof(t_Open9xArmCustomFunctionData_v210)); }
}) Open9xArmCustomFunctionData_v210;
PACK(typedef struct t_Open9xArmCustomFunctionData_v211 { // Function Switches data
int8_t swtch; // input
uint8_t func;
char param[6];
uint8_t delay;
uint8_t spare;
operator CustomFunctionData();
t_Open9xArmCustomFunctionData_v211() { memset(this, 0, sizeof(t_Open9xArmCustomFunctionData_v211)); }
}) Open9xArmCustomFunctionData_v211;
PACK(typedef struct t_Open9xArmSwashRingData_v208 { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Open9xArmSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v208)); }
}) Open9xArmSwashRingData_v208;
PACK(typedef struct t_Open9xArmSwashRingData_v209 { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Open9xArmSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v209)); }
}) Open9xArmSwashRingData_v209;
PACK(typedef struct t_Open9xArmSwashRingData_v210 { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Open9xArmSwashRingData_v210() { memset(this, 0, sizeof(t_Open9xArmSwashRingData_v210)); }
}) Open9xArmSwashRingData_v210;
PACK(typedef struct t_Open9xArmFrSkyBarData_v210 {
uint8_t source;
uint8_t barMin; // minimum for bar display
uint8_t barMax; // ditto for max display (would usually = ratio)
}) Open9xArmFrSkyBarData_v210;
PACK(typedef struct t_Open9xArmFrSkyData_v210 {
Open9xFrSkyChannelData_v208 channels[2];
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t voltsSource:2;
uint8_t blades:2;
uint8_t currentSource:2;
Open9xArmFrSkyBarData_v210 bars[4];
Open9xFrSkyRSSIAlarm rssiAlarms[2];
uint8_t lines[4*2*2];
uint8_t spare[4];
operator FrSkyData();
t_Open9xArmFrSkyData_v210() { memset(this, 0, sizeof(t_Open9xArmFrSkyData_v210)); }
}) Open9xArmFrSkyData_v210;
PACK(typedef struct t_Open9xArmFrSkyData_v211 {
Open9xFrSkyChannelData_v208 channels[2];
Open9xFrSkyRSSIAlarm rssiAlarms[2];
uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t voltsSource;
uint8_t blades; // How many blades for RPMs, 0=2 blades, 1=3 blades
uint8_t currentSource;
Open9xArmFrSkyBarData_v210 bars[4];
uint8_t lines[4*2*2];
uint8_t varioSource;
uint8_t varioSpeedUpMin; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
uint8_t spare[4];
operator FrSkyData();
t_Open9xArmFrSkyData_v211() { memset(this, 0, sizeof(t_Open9xArmFrSkyData_v211)); }
}) Open9xArmFrSkyData_v211;
PACK(typedef struct t_Open9xArmModelData_v208 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v208 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v208 expoData[32];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xArmLogicalSwitchData_v208 logicalSw[32];
Open9xArmCustomFunctionData_v208 customFn[32];
Open9xArmSwashRingData_v208 swashR;
Open9xArmFlightModeData_v208 flightModeData[9];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[32];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
operator ModelData();
t_Open9xArmModelData_v208() { memset(this, 0, sizeof(t_Open9xArmModelData_v208)); }
}) Open9xArmModelData_v208;
PACK(typedef struct t_Open9xArmModelData_v209 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v209 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v208 expoData[32];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xArmLogicalSwitchData_v209 logicalSw[32];
Open9xArmCustomFunctionData_v208 customFn[32];
Open9xArmSwashRingData_v209 swashR;
Open9xArmFlightModeData_v208 flightModeData[9];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[32];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
uint8_t switchWarningStates;
operator ModelData();
t_Open9xArmModelData_v209() { memset(this, 0, sizeof(t_Open9xArmModelData_v209)); }
}) Open9xArmModelData_v209;
PACK(typedef struct t_Open9xArmModelData_v210 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v210 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v210 expoData[32];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xArmLogicalSwitchData_v210 logicalSw[32];
Open9xArmCustomFunctionData_v210 customFn[32];
Open9xArmSwashRingData_v209 swashR;
Open9xArmFlightModeData_v208 flightModeData[9];
Open9xArmFrSkyData_v210 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[32];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
uint8_t switchWarningStates;
operator ModelData();
t_Open9xArmModelData_v210() { memset(this, 0, sizeof(t_Open9xArmModelData_v210)); }
}) Open9xArmModelData_v210;
PACK(typedef struct t_Open9xArmModelData_v211 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v210 mixData[64];
Open9xLimitData_v201 limitData[32];
Open9xArmExpoData_v210 expoData[32];
int16_t curves[16];
int8_t points[512];
Open9xArmLogicalSwitchData_v210 logicalSw[32];
Open9xArmCustomFunctionData_v211 customFn[32];
Open9xArmSwashRingData_v209 swashR;
Open9xArmFlightModeData_v208 flightModeData[9];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[32];
uint8_t switchWarningStates;
Open9xArmFrSkyData_v211 frsky;
operator ModelData();
t_Open9xArmModelData_v211() { memset(this, 0, sizeof(t_Open9xArmModelData_v211)); }
}) Open9xArmModelData_v211;
PACK(typedef struct t_Open9xArmModelData_v212 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xArmTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare1:1;
int8_t ppmDelay;
uint16_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xArmMixData_v212 mixData[64];
Open9xLimitData_v211 limitData[32];
Open9xArmExpoData_v212 expoData[32];
int16_t curves[16];
int8_t points[512];
Open9xArmLogicalSwitchData_v210 logicalSw[32];
Open9xArmCustomFunctionData_v211 customFn[32];
Open9xArmSwashRingData_v210 swashR;
Open9xArmFlightModeData_v212 flightModeData[9];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t switchWarningStates;
Open9xArmFrSkyData_v211 frsky;
Open9xTimerDataExtra timersXtra[2];
operator ModelData();
t_Open9xArmModelData_v212() { memset(this, 0, sizeof(t_Open9xArmModelData_v212)); }
}) Open9xArmModelData_v212;
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,805 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef open9xstockeeprom_h
#define open9xstockeeprom_h
#define O9X_MAX_CSFUNCOLD 13
#define O9X_MAX_CSFUNC 15
#include <inttypes.h>
#include "eeprominterface.h"
#include <qbytearray.h>
int8_t open9xV4209FromSource(RawSource source);
int8_t open9xStock209FromSource(RawSource source);
RawSource open9xV4209ToSource(int8_t value);
RawSource open9xStock209ToSource(int8_t value);
int8_t open9xStockFromSwitch(const RawSwitch & sw);
RawSwitch open9xStockToSwitch(int8_t sw);
struct CurveInfo {
int8_t *crv;
uint8_t points;
bool custom;
};
template <class T>
int8_t *curveaddress(T * model, uint8_t idx)
{
return &model->points[idx==0 ? 0 : 5*idx+model->curves[idx-1]];
}
template <class T>
extern CurveInfo curveinfo(T * model, uint8_t idx)
{
CurveInfo result;
result.crv = curveaddress(model, idx);
int8_t *next = curveaddress(model, idx+1);
uint8_t size = next - result.crv;
if (size % 2 == 0) {
result.points = (size / 2) + 1;
result.custom = true;
}
else {
result.points = size;
result.custom = false;
}
return result;
}
PACK(typedef struct t_Open9xFrSkyRSSIAlarm {
uint8_t level:2;
int8_t value:6;
FrSkyRSSIAlarm get(int index);
t_Open9xFrSkyRSSIAlarm() { memset(this, 0, sizeof(t_Open9xFrSkyRSSIAlarm)); }
}) Open9xFrSkyRSSIAlarm;
PACK(typedef struct t_Open9xExpoData_v201 {
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
uint8_t chn:2;
uint8_t curve:4; // 0=no curve, 1-6=std curves, 7-10=CV1-CV4, 11-15=CV9-CV13
int8_t swtch:5;
uint8_t phase:3; // if negPhase is 0: 0=normal, 5=FP4 if negPhase is 1: 5=!FP4
uint8_t negPhase:1;
uint8_t weight:7;
int8_t expo;
operator ExpoData();
t_Open9xExpoData_v201() { memset(this, 0, sizeof(t_Open9xExpoData_v201)); }
}) Open9xExpoData_v201;
PACK(typedef struct t_Open9xExpoData_v211 {
uint8_t mode:2; // 0=end, 1=pos, 2=neg, 3=both
int8_t swtch:6;
uint8_t chn:2;
uint8_t phases:5;
uint8_t curveMode:1;
uint8_t weight; // we have one bit spare here :)
int8_t curveParam;
operator ExpoData();
t_Open9xExpoData_v211() { memset(this, 0, sizeof(t_Open9xExpoData_v211)); }
}) Open9xExpoData_v211;
PACK(typedef struct t_Open9xLimitData_v201 {
int8_t min;
int8_t max;
bool revert;
int16_t offset;
operator LimitData();
t_Open9xLimitData_v201() { memset(this, 0, sizeof(t_Open9xLimitData_v201)); }
}) Open9xLimitData_v201;
PACK(typedef struct t_Open9xLimitData_v211 {
int8_t min;
int8_t max;
int8_t ppmCenter;
int16_t offset:14;
uint16_t symetrical:1;
uint16_t revert:1;
operator LimitData();
t_Open9xLimitData_v211() { memset(this, 0, sizeof(t_Open9xLimitData_v211)); }
}) Open9xLimitData_v211;
PACK(typedef struct t_Open9xMixData_v201 {
uint8_t destCh:5; // 0, 1..C9X_NUM_CHNOUT
uint8_t mixWarn:3; // mixer warning
uint8_t srcRaw; //
int8_t weight;
int8_t swtch;
uint8_t curve; // 0=symmetrisch, 1=no neg, 2=no pos
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
uint8_t carryTrim:1;
uint8_t mltpx:3; // multiplex method 0=+ 1=* 2=replace
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
int8_t sOffset;
operator MixData();
t_Open9xMixData_v201() { memset(this, 0, sizeof(t_Open9xMixData_v201)); }
}) Open9xMixData_v201;
PACK(typedef struct t_Open9xMixData_v203 {
uint8_t destCh:5; // 0, 1..C9X_NUM_CHNOUT
uint8_t mixWarn:3; // mixer warning
uint8_t srcRaw; //
int8_t weight;
int8_t swtch;
uint8_t curve;
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
uint8_t carryTrim:2;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
int8_t sOffset;
operator MixData();
t_Open9xMixData_v203() { memset(this, 0, sizeof(t_Open9xMixData_v203)); }
}) Open9xMixData_v203;
PACK(typedef struct t_Open9xMixData_v205 {
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
int8_t weight;
int8_t swtch:6;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t curve:6;
uint8_t mixWarn:2; // mixer warning
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
uint16_t srcRaw:7; //
int16_t differential:7;
uint16_t carryTrim:2;
int8_t sOffset;
operator MixData();
t_Open9xMixData_v205() { memset(this, 0, sizeof(t_Open9xMixData_v205)); }
}) Open9xMixData_v205;
PACK(typedef struct t_Open9xMixData_v209 {
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
int8_t phase:4; // -5=!FP4, 0=normal, 5=FP4
int8_t weight;
int8_t swtch:6;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
int8_t curve:6;
uint8_t mixWarn:2; // mixer warning
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
uint16_t srcRaw:6;
int16_t differential:7;
int16_t carryTrim:3;
int8_t sOffset;
operator MixData();
t_Open9xMixData_v209() { memset(this, 0, sizeof(t_Open9xMixData_v209)); }
}) Open9xMixData_v209;
PACK(typedef struct t_Open9xMixData_v211 {
uint8_t destCh:4; // 0, 1..C9X_NUM_CHNOUT
uint8_t curveMode:1; // O=curve, 1=differential
uint8_t noExpo:1;
uint8_t spare:2;
int8_t weight;
int8_t swtch:6;
uint8_t mltpx:2; // multiplex method: 0 means +=, 1 means *=, 2 means :=
uint8_t phases:5;
int8_t carryTrim:3;
uint8_t srcRaw:6;
uint8_t mixWarn:2; // mixer warning
uint8_t delayUp:4;
uint8_t delayDown:4;
uint8_t speedUp:4;
uint8_t speedDown:4;
int8_t curveParam;
int8_t sOffset;
operator MixData();
t_Open9xMixData_v211() { memset(this, 0, sizeof(t_Open9xMixData_v211)); }
}) Open9xMixData_v211;
PACK(typedef struct t_Open9xLogicalSwitchData_v208 { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
operator LogicalSwitchData();
t_Open9xLogicalSwitchData_v208() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v208)); }
t_Open9xLogicalSwitchData_v208(LogicalSwitchData&);
}) Open9xLogicalSwitchData_v208;
PACK(typedef struct t_Open9xLogicalSwitchData_v209 { // Custom Switches data
int8_t v1; //input
int8_t v2; //offset
uint8_t func;
operator LogicalSwitchData();
t_Open9xLogicalSwitchData_v209() { memset(this, 0, sizeof(t_Open9xLogicalSwitchData_v209)); }
}) Open9xLogicalSwitchData_v209;
PACK(typedef struct t_Open9xSafetySwData { // Safety Switches data
int8_t swtch;
int8_t val;
t_Open9xSafetySwData() { memset(this, 0, sizeof(t_Open9xSafetySwData)); }
}) Open9xSafetySwData;
PACK(typedef struct t_Open9xCustomFunctionData_v201 { // Function Switches data
int8_t swtch; // input
uint8_t func;
operator CustomFunctionData();
t_Open9xCustomFunctionData_v201() { memset(this, 0, sizeof(t_Open9xCustomFunctionData_v201)); }
}) Open9xCustomFunctionData_v201;
PACK(typedef struct t_Open9xCustomFunctionData_v203 { // Function Switches data
int8_t swtch; // input
uint8_t func;
uint8_t param;
operator CustomFunctionData();
t_Open9xCustomFunctionData_v203() { memset(this, 0, sizeof(t_Open9xCustomFunctionData_v203)); }
}) Open9xCustomFunctionData_v203;
PACK(typedef struct t_Open9xCustomFunctionData_v210 { // Function Switches data
int8_t swtch; // input
uint8_t func:5;
uint8_t delay:3;
uint8_t param;
operator CustomFunctionData();
t_Open9xCustomFunctionData_v210() { memset(this, 0, sizeof(t_Open9xCustomFunctionData_v210)); }
}) Open9xCustomFunctionData_v210;
PACK(typedef struct t_Open9xFrSkyChannelData_v201 {
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t type:4; // channel unit (0=volts, ...)
int8_t offset:4; // calibration offset. Signed 0.1V steps. EG. -4 to substract 0.4V
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t alarms_level:4;
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
uint8_t spare:2;
uint8_t barMin; // minimum for bar display
uint8_t barMax; // ditto for max display (would usually = ratio)
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v201() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v201)); }
}) Open9xFrSkyChannelData_v201;
PACK(typedef struct t_Open9xFrSkyChannelData_v203 {
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t type; // channel unit (0=volts, ...)
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t alarms_level:4;
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
uint8_t spare:2;
uint8_t barMin:4; // minimum for bar display
uint8_t barMax:4; // ditto for max display (would usually = ratio)
int8_t offset; // calibration offset. Signed 0.1V steps. EG. -4 to substract 0.4V
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v203() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v203)); }
}) Open9xFrSkyChannelData_v203;
PACK(typedef struct t_Open9xFrSkyChannelData_v204 {
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t type; // channel unit (0=volts, ...)
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t alarms_level:4;
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
uint8_t multiplier:2;
int8_t offset; // calibration offset. Signed 0.1V steps. EG. -4 to substract 0.4V
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v204)); }
}) Open9xFrSkyChannelData_v204;
PACK(typedef struct t_Open9xFrSkyChannelData_v208 {
uint8_t ratio; // 0.0 means not used, 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
int16_t offset:12;
uint16_t type:4; // channel unit (0=volts, ...)
uint8_t alarms_value[2]; // 0.1V steps EG. 6.6 Volts = 66. 25.1V = 251, etc.
uint8_t alarms_level:4;
uint8_t alarms_greater:2; // 0=LT(<), 1=GT(>)
uint8_t multiplier:2;
operator FrSkyChannelData();
t_Open9xFrSkyChannelData_v208() { memset(this, 0, sizeof(t_Open9xFrSkyChannelData_v208)); }
}) Open9xFrSkyChannelData_v208;
PACK(typedef struct t_Open9xFrSkyData_v201 {
Open9xFrSkyChannelData_v201 channels[2];
operator FrSkyData();
t_Open9xFrSkyData_v201() { memset(this, 0, sizeof(t_Open9xFrSkyData_v201)); }
}) Open9xFrSkyData_v201;
PACK(typedef struct t_Open9xFrSkyData_v202 {
Open9xFrSkyChannelData_v201 channels[2];
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t spare:6;
operator FrSkyData();
t_Open9xFrSkyData_v202() { memset(this, 0, sizeof(t_Open9xFrSkyData_v202)); }
}) Open9xFrSkyData_v202;
PACK(typedef struct t_Open9xFrSkyData_v203 {
Open9xFrSkyChannelData_v203 channels[2];
uint8_t usrProto; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
operator FrSkyData();
t_Open9xFrSkyData_v203() { memset(this, 0, sizeof(t_Open9xFrSkyData_v203)); }
}) Open9xFrSkyData_v203;
PACK(typedef struct t_Open9xFrSkyBarData_v204 {
uint16_t source:4;
uint16_t barMin:6; // minimum for bar display
uint16_t barMax:6; // ditto for max display (would usually = ratio)
operator FrSkyBarData();
t_Open9xFrSkyBarData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyBarData_v204)); }
}) Open9xFrSkyBarData_v204;
PACK(typedef struct t_Open9xFrSkyData_v204 {
Open9xFrSkyChannelData_v204 channels[2];
uint8_t usrProto:3; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t imperial:1;
uint8_t blades:2;
uint8_t spare:2;
Open9xFrSkyBarData_v204 bars[4];
operator FrSkyData();
t_Open9xFrSkyData_v204() { memset(this, 0, sizeof(t_Open9xFrSkyData_v204)); }
}) Open9xFrSkyData_v204;
PACK(typedef struct t_Open9xFrSkyData_v205 {
Open9xFrSkyChannelData_v204 channels[2];
uint8_t usrProto:3; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t imperial:1;
uint8_t blades:2;
uint8_t spare:2;
Open9xFrSkyBarData_v204 bars[4];
Open9xFrSkyRSSIAlarm rssiAlarms[2];
operator FrSkyData();
t_Open9xFrSkyData_v205() { memset(this, 0, sizeof(t_Open9xFrSkyData_v205)); }
}) Open9xFrSkyData_v205;
PACK(typedef struct t_Open9xFrSkyData_v208 {
Open9xFrSkyChannelData_v208 channels[2];
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t voltsSource:2;
uint8_t blades:2;
uint8_t currentSource:2;
Open9xFrSkyBarData_v204 bars[4];
Open9xFrSkyRSSIAlarm rssiAlarms[2];
operator FrSkyData();
t_Open9xFrSkyData_v208() { memset(this, 0, sizeof(t_Open9xFrSkyData_v208)); }
}) Open9xFrSkyData_v208;
PACK(typedef struct t_Open9xFrSkyData_v210 {
Open9xFrSkyChannelData_v208 channels[2];
uint8_t usrProto:2; // Protocol in FrSky user data, 0=None, 1=FrSky hub, 2=WS HowHigh
uint8_t blades:2; // How many blades for RPMs, 0=2 blades, 1=3 blades
uint8_t spare1:4;
uint8_t voltsSource:3;
uint8_t currentSource:3;
uint8_t spare2:2;
Open9xFrSkyBarData_v204 bars[4];
Open9xFrSkyRSSIAlarm rssiAlarms[2];
uint8_t lines[4];
uint16_t linesXtra;
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
operator FrSkyData();
t_Open9xFrSkyData_v210() { memset(this, 0, sizeof(t_Open9xFrSkyData_v210)); }
}) Open9xFrSkyData_v210;
PACK(typedef struct t_Open9xSwashRingData_v208 { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Open9xSwashRingData_v208() { memset(this, 0, sizeof(t_Open9xSwashRingData_v208)); }
}) Open9xSwashRingData_v208;
PACK(typedef struct t_Open9xSwashRingData_v209 { // Swash Ring data
uint8_t invertELE:1;
uint8_t invertAIL:1;
uint8_t invertCOL:1;
uint8_t type:5;
uint8_t collectiveSource;
uint8_t value;
operator SwashRingData();
t_Open9xSwashRingData_v209() { memset(this, 0, sizeof(t_Open9xSwashRingData_v209)); }
}) Open9xSwashRingData_v209;
PACK(typedef struct t_Open9xFlightModeData_v201 {
int8_t trim[4]; // -500..500 => trim value, 501 => use trim of phase 0, 502, 503, 504 => use trim of phases 1|2|3|4 instead
int8_t trim_ext:8; // 2 less significant extra bits per trim (10bits trims)
int8_t swtch; // swtch of phase[0] is not used
char name[6];
uint8_t fadeIn:4;
uint8_t fadeOut:4;
operator FlightModeData();
t_Open9xFlightModeData_v201() { memset(this, 0, sizeof(t_Open9xFlightModeData_v201)); }
}) Open9xFlightModeData_v201;
PACK(typedef struct t_Open9xTimerData_v201 {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint16_t val:14;
uint16_t persistent:1;
uint16_t dir:1; // 0=>Count Down, 1=>Count Up
operator TimerData();
t_Open9xTimerData_v201() { memset(this, 0, sizeof(t_Open9xTimerData_v201)); }
}) Open9xTimerData_v201;
PACK(typedef struct t_Open9xTimerData_v202 {
int8_t mode; // timer trigger source -> off, abs, stk, stk%, sw/!sw, !m_sw/!m_sw
uint16_t val;
operator TimerData();
t_Open9xTimerData_v202() { memset(this, 0, sizeof(t_Open9xTimerData_v202)); }
}) Open9xTimerData_v202;
PACK(typedef struct t_Open9xTimerDataExtra {
uint16_t remanent:1;
uint16_t value:15;
t_Open9xTimerDataExtra() { memset(this, 0, sizeof(t_Open9xTimerDataExtra)); }
}) Open9xTimerDataExtra;
PACK(typedef struct t_Open9xModelData_v201 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v201 timer1;
uint8_t protocol:3;
int8_t ppmNCH:3;
uint8_t thrTrim:1; // Enable Throttle Trim
uint8_t thrExpo:1; // Enable Throttle Expo
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v201 timer2;
Open9xMixData_v201 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 logicalSw[12];
Open9xSafetySwData safetySw[16];
Open9xCustomFunctionData_v201 customFn[12];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v201 frsky;
operator ModelData();
t_Open9xModelData_v201() { memset(this, 0, sizeof(t_Open9xModelData_v201)); }
}) Open9xModelData_v201;
PACK(typedef struct t_Open9xModelData_v202 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timer1;
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v202 timer2;
Open9xMixData_v201 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 logicalSw[12];
Open9xSafetySwData safetySw[16];
Open9xCustomFunctionData_v201 customFn[12];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v202 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
operator ModelData();
t_Open9xModelData_v202() { memset(this, 0, sizeof(t_Open9xModelData_v202)); }
}) Open9xModelData_v202;
PACK(typedef struct t_Open9xModelData_v203 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timer1;
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v202 timer2;
Open9xMixData_v203 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 logicalSw[12];
Open9xCustomFunctionData_v203 customFn[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v202 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
operator ModelData();
t_Open9xModelData_v203() { memset(this, 0, sizeof(t_Open9xModelData_v203)); }
}) Open9xModelData_v203;
PACK(typedef struct t_Open9xModelData_v204 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timer1;
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xTimerData_v202 timer2;
Open9xMixData_v203 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 logicalSw[12];
Open9xCustomFunctionData_v203 customFn[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v204 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
Open9xFrSkyRSSIAlarm frskyRssiAlarms[2];
operator ModelData();
t_Open9xModelData_v204() { memset(this, 0, sizeof(t_Open9xModelData_v204)); }
}) Open9xModelData_v204;
PACK(typedef struct t_Open9xModelData_v205 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t spare1:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v205 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 logicalSw[12];
Open9xCustomFunctionData_v203 customFn[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v205 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[16];
operator ModelData();
t_Open9xModelData_v205() { memset(this, 0, sizeof(t_Open9xModelData_v205)); }
}) Open9xModelData_v205;
PACK(typedef struct t_Open9xModelData_v208 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v205 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v208 logicalSw[12];
Open9xCustomFunctionData_v203 customFn[16];
Open9xSwashRingData_v208 swashR;
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
operator ModelData();
t_Open9xModelData_v208() { memset(this, 0, sizeof(t_Open9xModelData_v208)); }
}) Open9xModelData_v208;
PACK(typedef struct t_Open9xModelData_v209 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves5[8][5];
int8_t curves9[8][9];
Open9xLogicalSwitchData_v209 logicalSw[12];
Open9xCustomFunctionData_v203 customFn[16];
Open9xSwashRingData_v209 swashR;
Open9xFlightModeData_v201 flightModeData[5];
Open9xFrSkyData_v208 frsky;
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t frskyLines[4];
uint16_t frskyLinesXtra;
int8_t servoCenter[16];
uint8_t varioSource:3;
uint8_t varioSpeedUpMin:5; // if increment in 0.2m/s = 3.0m/s max
uint8_t varioSpeedDownMin;
uint8_t switchWarningStates;
operator ModelData();
t_Open9xModelData_v209() { memset(this, 0, sizeof(t_Open9xModelData_v209)); }
}) Open9xModelData_v209;
PACK(typedef struct t_Open9xModelData_v210 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare2:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v209 mixData[32];
Open9xLimitData_v201 limitData[16];
Open9xExpoData_v201 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xLogicalSwitchData_v209 logicalSw[12];
Open9xCustomFunctionData_v210 customFn[16];
Open9xSwashRingData_v209 swashR;
Open9xFlightModeData_v201 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
int8_t servoCenter[16];
uint8_t switchWarningStates;
Open9xFrSkyData_v210 frsky;
operator ModelData();
t_Open9xModelData_v210() { memset(this, 0, sizeof(t_Open9xModelData_v210)); }
}) Open9xModelData_v210;
PACK(typedef struct t_Open9xModelData_v211 {
char name[10]; // 10 must be first for eeLoadModelName
Open9xTimerData_v202 timers[2];
uint8_t protocol:3;
uint8_t thrTrim:1; // Enable Throttle Trim
int8_t ppmNCH:4;
uint8_t trimInc:3; // Trim Increments
uint8_t disableThrottleWarning:1;
uint8_t pulsePol:1;
uint8_t extendedLimits:1;
uint8_t extendedTrims:1;
uint8_t spare1:1;
int8_t ppmDelay;
uint8_t beepANACenter; // 1<<0->A1.. 1<<6->A7
Open9xMixData_v211 mixData[32];
Open9xLimitData_v211 limitData[16];
Open9xExpoData_v211 expoData[14];
int8_t curves[8];
int8_t points[112-8];
Open9xLogicalSwitchData_v209 logicalSw[12];
Open9xCustomFunctionData_v210 customFn[16];
Open9xSwashRingData_v209 swashR;
Open9xFlightModeData_v201 flightModeData[5];
int8_t ppmFrameLength; // 0=22.5ms (10ms-30ms) 0.5msec increments
uint8_t thrTraceSrc;
uint8_t modelId;
uint8_t switchWarningStates;
Open9xFrSkyData_v210 frsky;
operator ModelData();
t_Open9xModelData_v211() { memset(this, 0, sizeof(t_Open9xModelData_v211)); }
}) Open9xModelData_v211;
#endif

View file

@ -224,7 +224,7 @@ class SourcesConversionTable: public ConversionTable {
}
}
for (int i=0; i<NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
for (int i=0; i<CPN_MAX_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board); i++) {
addConversion(RawSource(SOURCE_TYPE_STICK, i), val++);
}
@ -233,7 +233,7 @@ class SourcesConversionTable: public ConversionTable {
}
if (!afterrelease21March2013) {
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++);
}
}
@ -246,7 +246,7 @@ class SourcesConversionTable: public ConversionTable {
}
if (afterrelease21March2013) {
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
addConversion(RawSource(SOURCE_TYPE_TRIM, i), val++);
}
@ -294,7 +294,7 @@ class SourcesConversionTable: public ConversionTable {
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 2), val++); // Timer1
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 3), val++); // Timer2
addConversion(RawSource(SOURCE_TYPE_SPECIAL, 4), val++); // Timer3
for (int i=0; i<C9X_MAX_SENSORS*3; ++i) {
for (int i=0; i<CPN_MAX_SENSORS*3; ++i) {
addConversion(RawSource(SOURCE_TYPE_TELEMETRY, i), val++);
}
}
@ -790,25 +790,25 @@ class FlightModeField: public TransformedField {
{
if (board == BOARD_STOCK || (board==BOARD_M128 && version>=215)) {
// On stock we use 10bits per trim
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
internalField.Append(new SignedField<8>(trimBase[i]));
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
internalField.Append(new SignedField<2>(trimExt[i]));
}
else if (IS_ARM(board) && version >= 218) {
for (int i=0; i<NUM_STICKS+MAX_AUX_TRIMS(board); i++) {
for (int i=0; i<CPN_MAX_STICKS+MAX_AUX_TRIMS(board); i++) {
internalField.Append(new SignedField<11>(phase.trim[i]));
internalField.Append(new UnsignedField<5>(trimMode[i]));
}
}
else if (IS_TARANIS(board) && version >= 216) {
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
internalField.Append(new SignedField<11>(phase.trim[i]));
internalField.Append(new UnsignedField<5>(trimMode[i]));
}
}
else {
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
internalField.Append(new SignedField<16>(trimBase[i]));
}
}
@ -849,7 +849,7 @@ class FlightModeField: public TransformedField {
virtual void beforeExport()
{
for (int i=0; i<NUM_STICKS+MAX_AUX_TRIMS(board); i++) {
for (int i=0; i<CPN_MAX_STICKS+MAX_AUX_TRIMS(board); i++) {
if (IS_TARANIS(board) && version >= 216) {
if (phase.trimMode[i] < 0)
trimMode[i] = TRIM_MODE_NONE;
@ -877,7 +877,7 @@ class FlightModeField: public TransformedField {
virtual void afterImport()
{
for (int i=0; i<NUM_STICKS+MAX_AUX_TRIMS(board); i++) {
for (int i=0; i<CPN_MAX_STICKS+MAX_AUX_TRIMS(board); i++) {
if (IS_TARANIS(board) && version >= 216) {
if (trimMode[i] == TRIM_MODE_NONE) {
phase.trimMode[i] = -1;
@ -924,9 +924,9 @@ class FlightModeField: public TransformedField {
BoardEnum board;
unsigned int version;
int rotencCount;
int trimBase[NUM_STICKS+NUM_AUX_TRIMS];
int trimExt[NUM_STICKS+NUM_AUX_TRIMS];
unsigned int trimMode[NUM_STICKS+NUM_AUX_TRIMS];
int trimBase[CPN_MAX_STICKS+CPN_MAX_AUX_TRIMS];
int trimExt[CPN_MAX_STICKS+CPN_MAX_AUX_TRIMS];
unsigned int trimMode[CPN_MAX_STICKS+CPN_MAX_AUX_TRIMS];
};
class MixField: public TransformedField {
@ -1164,7 +1164,7 @@ class MixField: public TransformedField {
virtual void afterImport()
{
if (IS_TARANIS(board) && version < 216) {
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < NUM_STICKS) {
if (mix.srcRaw.type == SOURCE_TYPE_STICK && mix.srcRaw.index < CPN_MAX_STICKS) {
if (!mix.noExpo) {
mix.srcRaw = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, mix.srcRaw.index);
}
@ -1615,8 +1615,8 @@ class CurvesField: public TransformedField {
unsigned int version;
int maxCurves;
int maxPoints;
int _curves[C9X_MAX_CURVES];
int _points[C9X_MAX_CURVES*C9X_MAX_POINTS*2];
int _curves[CPN_MAX_CURVES];
int _points[CPN_MAX_CURVES*CPN_MAX_POINTS*2];
};
class LogicalSwitchesFunctionsTable: public ConversionTable {
@ -1865,11 +1865,11 @@ class LogicalSwitchField: public TransformedField {
}
if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
if (val1.type == SOURCE_TYPE_STICK && val1.index < CPN_MAX_STICKS) {
csw.val1 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val1.index).toValue();
}
RawSource val2(csw.val2);
if (val2.type == SOURCE_TYPE_STICK && val2.index < NUM_STICKS) {
if (val2.type == SOURCE_TYPE_STICK && val2.index < CPN_MAX_STICKS) {
csw.val2 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val2.index).toValue();
}
}
@ -1883,7 +1883,7 @@ class LogicalSwitchField: public TransformedField {
}
if (IS_TARANIS(board) && version < 216) {
RawSource val1(csw.val1);
if (val1.type == SOURCE_TYPE_STICK && val1.index < NUM_STICKS) {
if (val1.type == SOURCE_TYPE_STICK && val1.index < CPN_MAX_STICKS) {
csw.val1 = RawSource(SOURCE_TYPE_VIRTUAL_INPUT, val1.index).toValue();
}
}
@ -3384,7 +3384,7 @@ void OpenTxModelData::afterImport()
eepromImportDebug() << QString("OpenTxModelData::afterImport()") << modelData.name;
if (IS_TARANIS(board) && version < 216) {
for (unsigned int i=0; i<NUM_STICKS; i++) {
for (unsigned int i=0; i<CPN_MAX_STICKS; i++) {
for (int j=0; j<64; j++) {
ExpoData * expo = &modelData.expoData[j];
if (expo->mode == INPUT_MODE_BOTH && expo->chn == i && expo->flightModes == 0 && expo->swtch.type == SWITCH_TYPE_NONE)
@ -3431,7 +3431,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
generalData(generalData),
board(board),
version(version),
inputsCount(NUM_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board))
inputsCount(CPN_MAX_STICKS+MAX_POTS(board, version)+MAX_SLIDERS(board))
{
eepromImportDebug() << QString("OpenTxGeneralData::OpenTxGeneralData(board: %1, version:%2, variant:%3)").arg(board).arg(version).arg(variant);
@ -3471,10 +3471,10 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
internalField.Append(new SignedField<8>(generalData.txVoltageCalibration));
internalField.Append(new SignedField<8>(generalData.backlightMode));
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
internalField.Append(new SignedField<16>(generalData.trainer.calib[i]));
}
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
internalField.Append(new UnsignedField<6>(generalData.trainer.mix[i].src));
internalField.Append(new UnsignedField<2>(generalData.trainer.mix[i].mode));
internalField.Append(new SignedField<8>(generalData.trainer.mix[i].weight));
@ -3642,7 +3642,7 @@ OpenTxGeneralData::OpenTxGeneralData(GeneralSettings & generalData, BoardEnum bo
for (int i=0; i<MAX_SWITCHES(board, version); ++i) {
internalField.Append(new ZCharField<3>(generalData.switchName[i]));
}
for (int i=0; i<NUM_STICKS; ++i) {
for (int i=0; i<CPN_MAX_STICKS; ++i) {
internalField.Append(new ZCharField<3>(generalData.stickName[i]));
}
for (int i=0; i<MAX_POTS(board, version); ++i) {

View file

@ -117,7 +117,7 @@ class OpenTxModelData: public TransformedField {
private:
char name[256];
int subprotocols[C9X_NUM_MODULES+1/*trainer*/];
int subprotocols[CPN_MAX_MODULES+1/*trainer*/];
ProtocolsConversionTable protocolsConversionTable;
ChannelsConversionTable channelsConversionTable;
};

View file

@ -18,8 +18,6 @@
#include <QMessageBox>
#include "opentxinterface.h"
#include "opentxeeprom.h"
#include "open9xGruvin9xeeprom.h"
#include "open9xSky9xeeprom.h"
#include "rlefile.h"
#include "appdata.h"
@ -125,39 +123,6 @@ const int OpenTxEepromInterface::getMaxModels()
return 16;
}
template <class T>
bool OpenTxEepromInterface::loadModel(ModelData &model, uint8_t *data, int index, unsigned int stickMode)
{
T _model;
if (!data) {
// load from EEPROM
efile->openRd(FILE_MODEL(index));
int sz = efile->readRlc2((uint8_t*)&_model, sizeof(T));
if (sz) {
model = _model;
if (sz < (int)sizeof(T)) {
std::cout << " size(" << model.name << ") " << sz << " < " << (int)sizeof(T) << " ";
}
if (stickMode) {
applyStickModeToModel(model, stickMode);
}
}
else {
model.clear();
}
}
else {
// load from SD Backup, size is stored in index
if ((unsigned int)index < sizeof(T))
return false;
memcpy((uint8_t*)&_model, data, sizeof(T));
model = _model;
}
return true;
}
template <class T>
bool OpenTxEepromInterface::loadModelVariant(unsigned int index, ModelData & model, uint8_t *data, unsigned int version, unsigned int variant)
{
@ -211,82 +176,7 @@ bool OpenTxEepromInterface::loadModelFromByteArray(ModelData & model, const QByt
bool OpenTxEepromInterface::loadModel(uint8_t version, ModelData &model, uint8_t *data, int index, unsigned int variant, unsigned int stickMode)
{
if (version == 201) {
return loadModel<Open9xModelData_v201>(model, data, index, stickMode);
}
else if (version == 202) {
return loadModel<Open9xModelData_v202>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (version == 203) {
return loadModel<Open9xModelData_v203>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (version == 204) {
return loadModel<Open9xModelData_v204>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (version == 205) {
return loadModel<Open9xModelData_v205>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (board == BOARD_GRUVIN9X && version == 207) {
return loadModel<Open9xGruvin9xModelData_v207>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (version == 208) {
if (board == BOARD_GRUVIN9X) {
return loadModel<Open9xGruvin9xModelData_v208>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (IS_SKY9X(board)) {
return loadModel<Open9xArmModelData_v208>(model, data, index, 0 /*no more stick mode messed*/);
}
else {
return loadModel<Open9xModelData_v208>(model, data, index, 0 /*no more stick mode messed*/);
}
}
else if (version == 209) {
if (board == BOARD_GRUVIN9X) {
return loadModel<Open9xGruvin9xModelData_v209>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (IS_SKY9X(board)) {
return loadModel<Open9xArmModelData_v209>(model, data, index, 0 /*no more stick mode messed*/);
}
else {
return loadModel<Open9xModelData_v209>(model, data, index, 0 /*no more stick mode messed*/);
}
}
else if (version == 210) {
if (board == BOARD_GRUVIN9X) {
return loadModel<Open9xGruvin9xModelData_v210>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (IS_SKY9X(board)) {
return loadModel<Open9xArmModelData_v210>(model, data, index, 0 /*no more stick mode messed*/);
}
else {
return loadModel<Open9xModelData_v210>(model, data, index, 0 /*no more stick mode messed*/);
}
}
else if (version == 211) {
if (board == BOARD_GRUVIN9X) {
return loadModel<Open9xGruvin9xModelData_v211>(model, data, index, 0 /*no more stick mode messed*/);
}
else if (IS_SKY9X(board)) {
return loadModel<Open9xArmModelData_v211>(model, data, index, 0 /*no more stick mode messed*/);
}
else {
return loadModel<Open9xModelData_v211>(model, data, index, 0 /*no more stick mode messed*/);
}
}
else if (version == 212) {
if (IS_SKY9X(board)) {
return loadModel<Open9xArmModelData_v212>(model, data, index);
}
else {
return loadModelVariant<OpenTxModelData>(index, model, data, version, variant);
}
}
else if (version >= 213) {
return loadModelVariant<OpenTxModelData>(index, model, data, version, variant);
}
std::cout << " ko\n";
return false;
}
template <class T>
@ -607,14 +497,18 @@ int OpenTxFirmware::getCapability(Capability capability)
case Timers:
return (IS_ARM(board) ? 3 : 2);
case TimersName:
return (HAS_LARGE_LCD(board) ? 8 : (IS_ARM(board) ? 3 : 0));
case PermTimers:
if (IS_2560(board) || IS_ARM(board))
return 1;
if (HAS_LARGE_LCD(board))
return 8;
else if (IS_ARM(board))
return 3;
else
return 0;
case PermTimers:
return (IS_2560(board) || IS_ARM(board));
case Pots:
if (board == BOARD_X7D)
if (IS_HORUS(board))
return 3;
else if (board == BOARD_X7D)
return 2;
else if (IS_TARANIS_X9E(board))
return 4;
@ -623,7 +517,9 @@ int OpenTxFirmware::getCapability(Capability capability)
else
return 3;
case Sliders:
if (board == BOARD_X7D)
if (IS_HORUS(board))
return 4;
else if (board == BOARD_X7D)
return 0;
else if (IS_TARANIS_X9E(board))
return 4;

View file

@ -1,322 +0,0 @@
#include <algorithm>
#include "helpers.h"
#include "th9xeeprom.h"
RawSwitch th9xToSwitch(int8_t sw)
{
if (sw == 0)
return RawSwitch(SWITCH_TYPE_NONE);
else if (sw <= 9)
return RawSwitch(SWITCH_TYPE_SWITCH, sw);
else
return RawSwitch(SWITCH_TYPE_VIRTUAL, sw > 0 ? sw-9 : sw+9);
}
t_Th9xTrainerMix::t_Th9xTrainerMix()
{
memset(this, 0, sizeof(t_Th9xTrainerMix));
}
t_Th9xTrainerMix::operator TrainerMix()
{
TrainerMix c9x;
c9x.src = srcChn;
c9x.swtch = th9xToSwitch(swtch);
c9x.weight = (25 * studWeight) / 8;
c9x.mode = mode;
return c9x;
}
t_Th9xTrainerData::t_Th9xTrainerData()
{
memset(this, 0, sizeof(t_Th9xTrainerData));
}
t_Th9xTrainerData::operator TrainerData ()
{
TrainerData c9x;
for (int i=0; i<NUM_STICKS; i++) {
c9x.calib[i] = calib[i];
c9x.mix[i] = mix[i];
}
return c9x;
}
t_Th9xGeneral::t_Th9xGeneral()
{
memset(this, 0, sizeof(t_Th9xGeneral));
}
Th9xGeneral::operator GeneralSettings ()
{
GeneralSettings result;
result.version = myVers;
for (int i=0; i<NUM_STICKSnPOTS; i++) {
result.calibMid[i] = calibMid[i];
result.calibSpanNeg[i] = calibSpanNeg[i];
result.calibSpanPos[i] = calibSpanPos[i];
}
result.currModel = currModel;
result.contrast = contrast;
result.vBatWarn = vBatWarn;
result.txVoltageCalibration = txVoltageCalibration;
// result.lightSw = th9xToSwitch(lightSw);
result.trainer = trainer;
result.view = view;
result.disableThrottleWarning = disableThrottleWarning;
result.switchWarning = disableSwitchWarning ? 0 : -1;
result.disableMemoryWarning = disableMemoryWarning;
switch (beeperVal) {
case 0:
result.beeperMode = GeneralSettings::BEEPER_QUIET;
break;
case 1:
result.beeperMode = GeneralSettings::BEEPER_NOKEYS;
break;
case 2:
result.beeperMode = GeneralSettings::BEEPER_ALL;
break;
case 3:
result.beeperMode = GeneralSettings::BEEPER_ALL;
result.beeperLength = 2;
}
result.stickMode = stickMode;
result.inactivityTimer = inactivityMin;
return result;
}
t_Th9xExpoData::t_Th9xExpoData()
{
memset(this, 0, sizeof(t_Th9xExpoData));
}
t_Th9xExpoData::operator ExpoData ()
{
ExpoData c9x;
if (exp5) {
c9x.curve.type = CurveReference::CURVE_REF_EXPO;
c9x.curve.value = exp5;
}
else if (curve > 6) {
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
c9x.curve.value = curve - 6;
}
else if (curve > 0) {
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
c9x.curve.value = curve;
}
c9x.mode = mode3;
c9x.weight = weight6;
c9x.chn = chn;
c9x.swtch = th9xToSwitch(drSw);
return c9x;
}
t_Th9xLimitData::t_Th9xLimitData()
{
memset(this, 0, sizeof(t_Th9xLimitData));
}
t_Th9xLimitData::operator LimitData ()
{
LimitData c9x;
c9x.min = 10*(min-100);
c9x.max = 10*(max+100);
c9x.revert = revert;
c9x.offset = offset;
return c9x;
}
t_Th9xMixData::t_Th9xMixData()
{
memset(this, 0, sizeof(t_Th9xMixData));
}
t_Th9xMixData::operator MixData ()
{
MixData c9x;
c9x.destCh = destCh;
if (srcRaw < 7)
c9x.srcRaw = RawSource(SOURCE_TYPE_STICK, srcRaw);
else if (srcRaw < 10)
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE); // TODO
else if (srcRaw == 10)
c9x.srcRaw = RawSource(SOURCE_TYPE_MAX);
else if (srcRaw == 11)
c9x.srcRaw = RawSource(SOURCE_TYPE_NONE); // TODO CUR
else if (srcRaw < 24)
c9x.srcRaw = RawSource(SOURCE_TYPE_CH, srcRaw-12);
else /* always true if (srcRaw < 32) */
c9x.srcRaw = RawSource(SOURCE_TYPE_PPM, srcRaw-24);
c9x.weight = weight;
c9x.swtch = th9xToSwitch(swtch);
if (curve > 6) {
c9x.curve.type = CurveReference::CURVE_REF_CUSTOM;
c9x.curve.value = curve - 6;
}
else if (curve > 0) {
c9x.curve.type = CurveReference::CURVE_REF_FUNC;
c9x.curve.value = curve;
}
c9x.speedUp = speedUp;
c9x.speedDown = speedDown;
c9x.mltpx = (MltpxValue)mixMode;
return c9x;
}
t_Th9xLogicalSwitchData::operator LogicalSwitchData ()
{
LogicalSwitchData c9x;
c9x.func = opCmp;
c9x.val1 = val1;
c9x.val2 = val2;
if ((c9x.func >= LS_FN_VPOS && c9x.func <= LS_FN_ANEG) || c9x.func >= LS_FN_EQUAL) {
c9x.val1 = toSource(val1).toValue();
}
if (c9x.func >= LS_FN_EQUAL) {
c9x.val2 = toSource(val2).toValue();
}
if (c9x.func >= LS_FN_AND && c9x.func <= LS_FN_XOR) {
c9x.val1 = th9xToSwitch(val1).toValue();
c9x.val2 = th9xToSwitch(val2).toValue();
}
return c9x;
}
int8_t t_Th9xLogicalSwitchData::fromSource(RawSource source)
{
int v1 = 0;
if (source.type == SOURCE_TYPE_STICK)
v1 = 1+source.index;
else if (source.type == SOURCE_TYPE_ROTARY_ENCODER) {
EEPROMWarnings.push_back(::QObject::tr("th9x on this board doesn't have Rotary Encoders"));
v1 = 5+source.index;
}
else if (source.type == SOURCE_TYPE_MAX)
v1 = 8;
/* else if (source.type == SOURCE_TYPE_3POS)
v1 = 9; */
else if (source.type == SOURCE_TYPE_CYC)
v1 = 10+source.index;
else if (source.type == SOURCE_TYPE_PPM)
v1 = 13+source.index;
else if (source.type == SOURCE_TYPE_CH)
v1 = 21+source.index;
else if (source.type == SOURCE_TYPE_TELEMETRY)
v1 = 36+source.index;
return v1;
}
RawSource t_Th9xLogicalSwitchData::toSource(int8_t value)
{
if (value == 0) {
return RawSource(SOURCE_TYPE_NONE);
}
else if (value <= 7) {
return RawSource(SOURCE_TYPE_STICK, value - 1);
}
else if (value == 8) {
return RawSource(SOURCE_TYPE_MAX);
}
/* else if (value == 9) {
return RawSource(SOURCE_TYPE_3POS);
} */
else if (value <= 12) {
return RawSource(SOURCE_TYPE_CYC, value-10);
}
else if (value <= 20) {
return RawSource(SOURCE_TYPE_PPM, value-13);
}
else if (value <= 36) {
return RawSource(SOURCE_TYPE_CH, value-21);
}
else {
return RawSource(SOURCE_TYPE_TELEMETRY, value-36);
}
}
t_Th9xModelData::t_Th9xModelData()
{
memset(this, 0, sizeof(t_Th9xModelData));
}
t_Th9xModelData::operator ModelData ()
{
ModelData c9x;
c9x.used = true;
getEEPROMString(c9x.name, name, sizeof(name));
/*switch(tmrMode) {
case 1:
c9x.timers[0].mode = TMRMODE_ABS;
break;
case 2:
c9x.timers[0].mode = TMRMODE_THs;
break;
case 3:
c9x.timers[0].mode = TMRMODE_THp;
break;
default:
c9x.timers[0].mode = TMRMODE_OFF;
break;
}*/
// c9x.timers[0].dir = tmrDir;
c9x.timers[0].val = tmrVal;
/*c9x.protocol = (Protocol)protocol;
c9x.moduleData[0].channelsCount = 8 + 2 * ppmNCH;
c9x.thrTrim = thrTrim;
c9x.trimInc = trimInc;
c9x.moduleData[0].ppm.delay = 300 + 50 * ppmDelay;
c9x.customFn[0].func = FuncTrims2Offsets;
if (trimSw) {
c9x.customFn[0].swtch = trimSw;
}
c9x.beepANACenter = beepANACenter;
c9x.pulsePol = pulsePol;
c9x.extendedLimits = extendedLimits;
c9x.swashRingData.invertELE = swashInvertELE;
c9x.swashRingData.invertAIL = swashInvertAIL;
c9x.swashRingData.invertCOL = swashInvertCOL;
c9x.swashRingData.type = swashType;
c9x.swashRingData.collectiveSource = swashCollectiveSource;
c9x.swashRingData.value = swashRingValue;*/
for (int i=0; i<TH9X_NUM_CHNOUT; i++)
c9x.limitData[i] = limitData[i];
for (int i=0; i<TH9X_MAX_EXPOS; i++)
c9x.expoData[i] = expoTab[i];
for (int i=0; i<TH9X_MAX_MIXERS; i++)
c9x.mixData[i] = mixData[i];
for (int i=0; i<NUM_STICKS; i++)
c9x.flightModeData[0].trim[i] = trimData[i].itrim;
for (int i=0; i<TH9X_MAX_CURVES3; i++) {
c9x.curves[i].count = 3;
for (int j=0; j<3; j++) {
c9x.curves[i].points[j].x = -100 + 100*i;
c9x.curves[i].points[j].y = curves3[i][j];
}
}
for (int i=0; i<TH9X_MAX_CURVES5; i++) {
c9x.curves[i+TH9X_MAX_CURVES3].count = 5;
for (int j=0; j<5; j++) {
c9x.curves[i+TH9X_MAX_CURVES3].points[j].x = -100 + 50*i;
c9x.curves[i+TH9X_MAX_CURVES3].points[j].y = curves5[i][j];
}
}
for (int i=0; i<TH9X_MAX_CURVES9; i++) {
c9x.curves[i+TH9X_MAX_CURVES3+TH9X_MAX_CURVES5].count = 5;
for (int j=0; j<9; j++) {
c9x.curves[i+TH9X_MAX_CURVES3+TH9X_MAX_CURVES5].points[j].x = -100 + 50*i;
c9x.curves[i+TH9X_MAX_CURVES3+TH9X_MAX_CURVES5].points[j].y = curves9[i][j];
}
}
return c9x;
}

View file

@ -1,182 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef th9xeeprom_h
#define th9xeeprom_h
#include <inttypes.h>
#include "eeprominterface.h"
//eeprom data
#define TH9X_NUM_CHNOUT 8
#define TH9X_MAX_EXPOS 15
#define TH9X_MAX_MIXERS 25
#define TH9X_MAX_SWITCHES 16
#define TH9X_MAX_CURVES3 3
#define TH9X_MAX_CURVES5 2
#define TH9X_MAX_CURVES9 2
#define TH9X_MAX_CSFUNC 13
#define MDVERS 6
#define TH9X_NUM_CSW 12 //number of custom switches
#define NUM_STICKSnPOTS 7 //number of sticks and pots
PACK(typedef struct t_Th9xTrainerMix {
uint8_t srcChn:3; //0-7 = ch1-8
int8_t swtch:5;
int8_t studWeight:6;
uint8_t mode:2; // off, add-mode, subst-mode
operator TrainerMix();
t_Th9xTrainerMix();
}) Th9xTrainerMix; //
PACK(typedef struct t_Th9xTrainerData {
int16_t calib[8];
Th9xTrainerMix mix[4];
operator TrainerData();
t_Th9xTrainerData();
}) Th9xTrainerData;
PACK(typedef struct t_Th9xGeneral {
uint8_t myVers;
int16_t calibMid[NUM_STICKSnPOTS];
int16_t calibSpanNeg[NUM_STICKSnPOTS];
int16_t calibSpanPos[NUM_STICKSnPOTS];
uint8_t inactivityMin; //ge150
uint8_t iTrimSwitch:4; //ge192
uint8_t iTrimTme1:2;
uint8_t iTrimTme2:2;
uint8_t currModel; //0..15
uint8_t contrast;
uint8_t vBatWarn;
int8_t txVoltageCalibration;
int8_t lightSw;
Th9xTrainerData trainer;
uint8_t adcFilt:2;
uint8_t keySpeed:2;
uint8_t thr0pos:4;
uint8_t disableThrottleWarning:1;
uint8_t disableSwitchWarning:1;
uint8_t disableMemoryWarning:1;
uint8_t beeperVal:2;
uint8_t view:3;
uint8_t stickMode:2;
uint8_t naviMode:2;
operator GeneralSettings();
t_Th9xGeneral();
}) Th9xGeneral;
/*
* ModelData
*/
PACK(typedef struct t_Th9xExpoData {
int8_t exp5:5;
uint8_t mode3:3; //0=end 1=pos 2=neg 3=both 4=trimNeg
int8_t weight6:6;
uint8_t chn:2; //
int8_t drSw:5;
uint8_t curve:3; //
operator ExpoData();
t_Th9xExpoData();
}) Th9xExpoData;
PACK(typedef struct t_Th9xLimitData {
int8_t min:7;
bool scale:1;
int8_t max:7;
bool resv:1;
bool revert:1;
int8_t offset:7;
operator LimitData();
t_Th9xLimitData();
}) Th9xLimitData;
#define MLTPX_ADD 0
#define MLTPX_MUL 1
#define MLTPX_REP 2
PACK(typedef struct t_Th9xMixData {
uint8_t destCh:4; // 1..C9X_NUM_CHNOUT,X1-X4
uint8_t mixMode:2; // + * =
uint8_t dmy1:2; //
uint8_t srcRaw:5; // S1-4,P1-3,max,cur,X1-X4,p1-3,T1-8 24
uint8_t switchMode:2; // switchMode oOff\tiNeg\tiNul\tiPos
uint8_t curveNeg:1; // Cv cV
int8_t weight;
int8_t swtch:5;
uint8_t curve:3; // 0=off 1..7=cv1..7
uint8_t speedUp:4; // Servogeschwindigkeit aus Tabelle (10ms Cycle)
uint8_t speedDown:4; // 0 nichts
operator MixData();
t_Th9xMixData();
}) Th9xMixData;
PACK(typedef struct t_Th9xLogicalSwitchData {
uint8_t sw:3; // 0..7
uint8_t opCmp:2; // < & | ^
uint8_t opRes:3; // 0 => 1=> 0=> !=> & | ^
int8_t val1;
int8_t val2;
operator LogicalSwitchData();
t_Th9xLogicalSwitchData() { memset(this, 0, sizeof(t_Th9xLogicalSwitchData)); }
int8_t fromSource(RawSource source);
RawSource toSource(int8_t value);
}) Th9xLogicalSwitchData;
PACK(typedef struct t_Th9xTrimData {
int8_t itrim:6; //trim index
uint8_t tmode:2;
t_Th9xTrimData() { }
}) Th9xTrimData;
PACK(typedef struct t_Th9xModelData {
char name[10]; // 10 must be first for eeLoadModelName
uint8_t mdVers; // 1
uint8_t tmrMode:3; // 1
int8_t tmrSw:5; //
uint16_t tmrVal; // 2
uint8_t protocol:5; // 1
uint8_t protocolPar:3; //
char res[3]; // 3
Th9xLimitData limitData[TH9X_NUM_CHNOUT];// 3*8
Th9xExpoData expoTab[TH9X_MAX_EXPOS]; // 5*4 -> 3*15
Th9xMixData mixData[TH9X_MAX_MIXERS]; //0 5*25
int8_t curves3[TH9X_MAX_CURVES3][3]; // 9 new143
int8_t curves5[TH9X_MAX_CURVES5][5]; // 10
int8_t curves9[TH9X_MAX_CURVES9][9]; // 18
Th9xLogicalSwitchData switchTab[TH9X_MAX_SWITCHES];//
Th9xTrimData trimData[NUM_STICKS]; // 3*4 -> 1*4
operator ModelData();
t_Th9xModelData();
}) Th9xModelData;
#endif

View file

@ -1,166 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <iostream>
#include "th9xinterface.h"
#include "th9xeeprom.h"
#include "rlefile.h"
#include "appdata.h"
#define FILE_TYP_GENERAL 1
#define FILE_TYP_MODEL 2
#define FILE_GENERAL 0
#define FILE_MODEL(n) (1+n)
Th9xInterface::Th9xInterface():
EEPROMInterface(BOARD_STOCK),
efile(new RleFile())
{
}
Th9xInterface::~Th9xInterface()
{
delete efile;
}
const char * Th9xInterface::getName()
{
return "Th9x";
}
const int Th9xInterface::getEEpromSize()
{
QString avrMCU = g.mcu();
if (avrMCU==QString("m128")) {
return 2*EESIZE_STOCK;
}
return EESIZE_STOCK;
}
const int Th9xInterface::getMaxModels()
{
return 16;
}
unsigned long Th9xInterface::loadxml(RadioData &radioData, QDomDocument &doc)
{
std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
unsigned long Th9xInterface::load(RadioData &radioData, const uint8_t *eeprom, int size)
{
std::cout << "trying th9x import... ";
std::bitset<NUM_ERRORS> errors;
if (size != getEEpromSize()) {
std::cout << "wrong size\n";
errors.set(WRONG_SIZE);
return errors.to_ulong();
}
if (!efile->EeFsOpen((uint8_t *)eeprom, size, BOARD_STOCK)) {
std::cout << "wrong file system\n";
errors.set(WRONG_FILE_SYSTEM);
return errors.to_ulong();
}
efile->openRd(FILE_GENERAL);
Th9xGeneral th9xGeneral;
if (efile->readRlc2((uint8_t*)&th9xGeneral, 1) != 1) {
std::cout << "no\n";
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
std::cout << "version " << (unsigned int)th9xGeneral.myVers << " ";
switch(th9xGeneral.myVers) {
case 6:
break;
default:
std::cout << "not th9x\n";
errors.set(NOT_TH9X);
return errors.to_ulong();
}
efile->openRd(FILE_GENERAL);
int len = efile->readRlc2((uint8_t*)&th9xGeneral, sizeof(Th9xGeneral));
if (len != sizeof(Th9xGeneral)) {
std::cout << "not th9x\n";
errors.set(NOT_TH9X);
return errors.to_ulong();
}
radioData.generalSettings = th9xGeneral;
for (int i=0; i<getMaxModels(); i++) {
Th9xModelData th9xModel;
efile->openRd(FILE_MODEL(i));
if (!efile->readRlc2((uint8_t*)&th9xModel, sizeof(Th9xModelData))) {
radioData.models[i].clear();
}
else {
radioData.models[i] = th9xModel;
}
}
std::cout << "ok\n";
errors.set(ALL_OK);
return errors.to_ulong();
}
unsigned long Th9xInterface::loadBackup(RadioData &radioData, uint8_t *eeprom, int esize, int index)
{
std::bitset<NUM_ERRORS> errors;
errors.set(UNKNOWN_ERROR);
return errors.to_ulong();
}
int Th9xInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t variant, uint8_t version)
{
std::cout << "NO!\n";
// TODO a warning
return 0;
}
int Th9xInterface::getSize(const ModelData & model)
{
return 0;
}
int Th9xInterface::getSize(const GeneralSettings & settings)
{
return 0;
}
int Th9xInterface::isAvailable(PulsesProtocol proto, int port)
{
switch (proto) {
case PULSES_PPM:
case PULSES_SILV_A:
case PULSES_SILV_B:
case PULSES_SILV_C:
case PULSES_CTP1009:
return 1;
default:
return 0;
}
}

View file

@ -1,57 +0,0 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef th9x_interface_h
#define th9x_interface_h
#include "eeprominterface.h"
class RleFile;
class Th9xInterface : public EEPROMInterface
{
public:
Th9xInterface();
virtual ~Th9xInterface();
virtual const char * getName();
virtual const int getEEpromSize();
virtual const int getMaxModels();
virtual unsigned long load(RadioData &, const uint8_t *eeprom, int size);
virtual unsigned long loadBackup(RadioData &, uint8_t *eeprom, int esize, int index);
virtual unsigned long loadxml(RadioData &radioData, QDomDocument &doc);
virtual int save(uint8_t *eeprom, RadioData &radioData, uint32_t variant=0, uint8_t version=0);
virtual int getSize(const ModelData &);
virtual int getSize(const GeneralSettings &);
virtual int isAvailable(PulsesProtocol proto, int port=0);
protected:
RleFile *efile;
};
#endif

View file

@ -58,7 +58,7 @@ void FlashEEpromDialog::updateUI()
ui->patchCalibration->show();
ui->patchHardwareSettings->show();
// TODO I hardcode the number of pots here, should be dependant on the board?
if (!((calib.length()==(NUM_STICKS+3)*12) && (trainercalib.length()==16))) {
if (!((calib.length()==(CPN_MAX_STICKS+3)*12) && (trainercalib.length()==16))) {
ui->patchCalibration->setDisabled(true);
}
if (!((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6))) {
@ -181,11 +181,11 @@ bool FlashEEpromDialog::patchCalibration()
int8_t txCurrentCalibration=(int8_t) g.profile[g.id()].txCurrentCalibration();
int8_t PPM_Multiplier=(int8_t) g.profile[g.id()].ppmMultiplier();
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
if ((calib.length()==(CPN_MAX_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
QString Byte;
int16_t byte16;
bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
for (int i=0; i<(CPN_MAX_STICKS+potsnum); i++) {
Byte=calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok)

View file

@ -24,7 +24,7 @@ CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSe
headerLabels << QObject::tr("Negative span") << QObject::tr("Mid value") << QObject::tr("Positive span");
tableWidget->setHorizontalHeaderLabels(headerLabels);
int rows = NUM_STICKS + GetCurrentFirmware()->getCapability(Pots) + GetCurrentFirmware()->getCapability(Sliders);
int rows = CPN_MAX_STICKS + GetCurrentFirmware()->getCapability(Pots) + GetCurrentFirmware()->getCapability(Sliders);
tableWidget->setRowCount(rows);
for(int i = 0; i < rows; ++i) {

View file

@ -101,11 +101,11 @@ void GeneralEdit::on_calretrieve_PB_clicked()
QString SpeakerSet = g.profile[profile_id].speaker();
QString CountrySet = g.profile[profile_id].countryCode();
if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
if ((calib.length()==(CPN_MAX_STICKS+potsnum)*12) && (trainercalib.length()==16)) {
QString Byte;
int16_t byte16;
bool ok;
for (int i=0; i<(NUM_STICKS+potsnum); i++) {
for (int i=0; i<(CPN_MAX_STICKS+potsnum); i++) {
Byte=calib.mid(i*12,4);
byte16=(int16_t)Byte.toInt(&ok,16);
if (ok) generalSettings.calibMid[i]=byte16;
@ -138,14 +138,14 @@ void GeneralEdit::on_calretrieve_PB_clicked()
QByteArray qba;
int16_t offset;
bool ok;
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
qba = controlNames.mid(3*i,3).toLatin1();
strcpy(generalSettings.stickName[i], qba.data());
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) {
Byte=hwtypes.mid(i,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS),3).toLatin1();
qba=controlNames.mid(3*(i+CPN_MAX_STICKS),3).toLatin1();
if (ok) {
generalSettings.switchConfig[i]=byte16;
strcpy(generalSettings.switchName[i], qba.data());
@ -155,7 +155,7 @@ void GeneralEdit::on_calretrieve_PB_clicked()
for (int i=0; i<(GetCurrentFirmware()->getCapability(Pots)); i++) {
Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toLatin1();
qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1();
if (ok) {
generalSettings.potConfig[i]=byte16;
strcpy(generalSettings.potName[i], qba.data());
@ -165,7 +165,7 @@ void GeneralEdit::on_calretrieve_PB_clicked()
for (int i=0; i<(GetCurrentFirmware()->getCapability(Sliders)); i++) {
Byte=hwtypes.mid(i+offset,1);
byte16=(int16_t)Byte.toInt(&ok,16);
qba=controlNames.mid(3*(i+NUM_STICKS+offset),3).toLatin1();
qba=controlNames.mid(3*(i+CPN_MAX_STICKS+offset),3).toLatin1();
if (ok) {
generalSettings.sliderConfig[i]=byte16;
strcpy(generalSettings.sliderName[i], qba.data());
@ -243,7 +243,7 @@ void GeneralEdit::on_calstore_PB_clicked()
}
}
calib.clear();
for (int i=0; i< (NUM_STICKS+potsnum); i++) {
for (int i=0; i< (CPN_MAX_STICKS+potsnum); i++) {
calib.append(QString("%1").arg((uint16_t)generalSettings.calibMid[i], 4, 16, QChar('0')));
calib.append(QString("%1").arg((uint16_t)generalSettings.calibSpanNeg[i], 4, 16, QChar('0')));
calib.append(QString("%1").arg((uint16_t)generalSettings.calibSpanPos[i], 4, 16, QChar('0')));
@ -256,7 +256,7 @@ void GeneralEdit::on_calstore_PB_clicked()
g.profile[profile_id].trainerCalib( calib );
hwtypes.clear();
controlNames.clear();
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
controlNames.append(QString("%1").arg(generalSettings.stickName[i], -3));
}
for (int i=0; i<(GetCurrentFirmware()->getCapability(Switches)); i++) {

View file

@ -34,7 +34,7 @@ void HardwarePanel::setupPotConfig(int index, QLabel *label, AutoLineEdit *name,
bool enabled = false;
if (IS_TARANIS_X9E(firmware->getBoard()) && index < 4) {
label->setText(RawSource(SOURCE_TYPE_STICK, index+NUM_STICKS).toString());
label->setText(RawSource(SOURCE_TYPE_STICK, index+CPN_MAX_STICKS).toString());
enabled = true;
}
else if (IS_TARANIS_PLUS(firmware->getBoard()) && index < 3) {
@ -72,7 +72,7 @@ void HardwarePanel::setupSliderConfig(int index, QLabel *label, AutoLineEdit *na
}
if (IS_TARANIS_X9E(firmware->getBoard())) {
label->setText(RawSource(SOURCE_TYPE_STICK, index+NUM_STICKS+4).toString());
label->setText(RawSource(SOURCE_TYPE_STICK, index+CPN_MAX_STICKS+4).toString());
}
if (enabled) {

View file

@ -14,7 +14,7 @@
Stopwatch gStopwatch("global");
const QColor colors[C9X_MAX_CURVES] = {
const QColor colors[CPN_MAX_CURVES] = {
QColor(0,0,127),
QColor(0,127,0),
QColor(127,0,0),
@ -551,11 +551,11 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
}
if (flags & POPULATE_SOURCES) {
for (int i=0; i<NUM_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders); i++) {
for (int i=0; i<CPN_MAX_STICKS+GetCurrentFirmware()->getCapability(Pots)+GetCurrentFirmware()->getCapability(Sliders); i++) {
item = RawSource(SOURCE_TYPE_STICK, i);
// skip unavailable pots and sliders
if (item.isPot() && !generalSettings.isPotAvailable(i-NUM_STICKS)) continue;
if (item.isSlider() && !generalSettings.isSliderAvailable(i-NUM_STICKS-GetCurrentFirmware()->getCapability(Pots))) continue;
if (item.isPot() && !generalSettings.isPotAvailable(i-CPN_MAX_STICKS)) continue;
if (item.isSlider() && !generalSettings.isSliderAvailable(i-CPN_MAX_STICKS-GetCurrentFirmware()->getCapability(Pots))) continue;
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
@ -600,7 +600,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
}
if (flags & POPULATE_SOURCES) {
for (int i=0; i<NUM_CYC; i++) {
for (int i=0; i<CPN_MAX_CYC; i++) {
item = RawSource(SOURCE_TYPE_CYC, i);
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
@ -626,7 +626,7 @@ void populateSourceCB(QComboBox *b, const RawSource & source, const GeneralSetti
b->addItem(item.toString(model), item.toValue());
if (item == source) b->setCurrentIndex(b->count()-1);
}
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
if (model && model->sensorData[i].isAvailable()) { //this conditon must be false if we populate Global Functions where model = 0
for (int j=0; j<3; ++j) {
item = RawSource(SOURCE_TYPE_TELEMETRY, 3*i+j);

View file

@ -8,7 +8,7 @@
#include <QDebug>
#include "eeprominterface.h"
extern const QColor colors[C9X_MAX_CURVES];
extern const QColor colors[CPN_MAX_CURVES];
#define TMR_NUM_OPTION (TMRMODE_COUNT+2*9+2*GetCurrentFirmware()->getCapability(LogicalSwitches)-1)

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui>
#include <QNetworkProxyFactory>
#include <QFileInfo>

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "mdichild.h"
#include "ui_mdichild.h"
#include "xmlinterface.h"

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef MDICHILD_H
#define MDICHILD_H

View file

@ -156,7 +156,7 @@ Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSet
ui->curvesLayout2->addItem(item2,limit+1,1,1,1,0);
}
for (int i=0; i<C9X_MAX_POINTS; i++) {
for (int i=0; i<CPN_MAX_POINTS; i++) {
spnx[i] = new QSpinBox(this);
spnx[i]->setProperty("index", i);
spnx[i]->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);
@ -360,7 +360,7 @@ void Curves::updateCurvePoints()
spnx[i]->hide();
}
}
for (int i=count; i<C9X_MAX_POINTS; i++) {
for (int i=count; i<CPN_MAX_POINTS; i++) {
spny[i]->hide();
spnx[i]->hide();
}
@ -440,7 +440,7 @@ void Curves::on_curvePoints_currentIndexChanged(int index)
model->curves[currentCurve].count = numpoints;
// TODO something better + reuse!
for (int i=0; i<C9X_MAX_POINTS; i++) {
for (int i=0; i<CPN_MAX_POINTS; i++) {
model->curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model->curves[currentCurve].points[i].y = 0;
}
@ -463,7 +463,7 @@ void Curves::on_curveCustom_currentIndexChanged(int index)
model->curves[currentCurve].type = type;
// TODO something better + reuse!
for (int i=0; i<C9X_MAX_POINTS; i++) {
for (int i=0; i<CPN_MAX_POINTS; i++) {
model->curves[currentCurve].points[i].x = (i >= numpoints-1 ? +100 : -100 + (200*i)/(numpoints-1));
model->curves[currentCurve].points[i].y = 0;
}

View file

@ -55,9 +55,9 @@ class Curves : public ModelPanel
private:
Ui::Curves *ui;
int currentCurve;
bool visibleCurves[C9X_MAX_CURVES];
QSpinBox * spnx[C9X_MAX_POINTS];
QSpinBox * spny[C9X_MAX_POINTS];
bool visibleCurves[CPN_MAX_CURVES];
QSpinBox * spnx[CPN_MAX_POINTS];
QSpinBox * spny[CPN_MAX_POINTS];
QVector<CurveCreatorTemplate> templates;
void setCurrentCurve(int index);
void updateCurve();

View file

@ -58,18 +58,18 @@ class CustomFunctionsPanel : public GenericPanel
QSet<QString> tracksSet;
QSet<QString> scriptsSet;
int mediaPlayerCurrent;
QComboBox * fswtchSwtch[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[C9X_MAX_CUSTOM_FUNCTIONS];
QDoubleSpinBox * fswtchParam[C9X_MAX_CUSTOM_FUNCTIONS];
QTimeEdit * fswtchParamTime[C9X_MAX_CUSTOM_FUNCTIONS];
QPushButton * playBT[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamT[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamArmT[C9X_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchEnable[C9X_MAX_CUSTOM_FUNCTIONS];
RepeatComboBox * fswtchRepeat[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[C9X_MAX_CUSTOM_FUNCTIONS];
QSlider * fswtchBLcolor[C9X_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchSwtch[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchFunc[CPN_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchParamGV[CPN_MAX_CUSTOM_FUNCTIONS];
QDoubleSpinBox * fswtchParam[CPN_MAX_CUSTOM_FUNCTIONS];
QTimeEdit * fswtchParamTime[CPN_MAX_CUSTOM_FUNCTIONS];
QPushButton * playBT[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamT[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchParamArmT[CPN_MAX_CUSTOM_FUNCTIONS];
QCheckBox * fswtchEnable[CPN_MAX_CUSTOM_FUNCTIONS];
RepeatComboBox * fswtchRepeat[CPN_MAX_CUSTOM_FUNCTIONS];
QComboBox * fswtchGVmode[CPN_MAX_CUSTOM_FUNCTIONS];
QSlider * fswtchBLcolor[CPN_MAX_CUSTOM_FUNCTIONS];
QMediaPlayer * mediaPlayer;
int selectedFunction;

View file

@ -78,7 +78,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, G
ui->trimCB->hide();
}
for(int i=0; i < NUM_STICKS; i++) {
for(int i=0; i < CPN_MAX_STICKS; i++) {
ui->trimCB->addItem(AnalogString(i), i+1);
}
ui->trimCB->setCurrentIndex(1 - ed->carryTrim);

View file

@ -56,8 +56,8 @@ FlightModePanel::FlightModePanel(QWidget * parent, ModelData & model, int phaseI
}
// The trims
QString labels[NUM_STICKS];
for(int i=0; i < NUM_STICKS; i++) {
QString labels[CPN_MAX_STICKS];
for(int i=0; i < CPN_MAX_STICKS; i++) {
labels[i] = AnalogString(i);
}

View file

@ -45,12 +45,12 @@ class FlightModePanel : public ModelPanel
int reCount;
int gvCount;
QVector<QLabel *> trimsLabel;
QLineEdit * gvNames[C9X_MAX_GVARS];
QSpinBox * gvValues[C9X_MAX_GVARS];
QCheckBox * gvPopups[C9X_MAX_GVARS];
QComboBox * gvUse[C9X_MAX_GVARS];
QSpinBox * reValues[C9X_MAX_ENCODERS];
QComboBox * reUse[C9X_MAX_ENCODERS];
QLineEdit * gvNames[CPN_MAX_GVARS];
QSpinBox * gvValues[CPN_MAX_GVARS];
QCheckBox * gvPopups[CPN_MAX_GVARS];
QComboBox * gvUse[CPN_MAX_GVARS];
QSpinBox * reValues[CPN_MAX_ENCODERS];
QComboBox * reUse[CPN_MAX_ENCODERS];
QVector<QComboBox *> trimsUse;
QVector<QSpinBox *> trimsValue;
QVector<QSlider *> trimsSlider;

View file

@ -9,7 +9,7 @@ InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & g
{
inputsCount = firmware->getCapability(VirtualInputs);
if (inputsCount == 0)
inputsCount = NUM_STICKS;
inputsCount = CPN_MAX_STICKS;
QGridLayout * exposLayout = new QGridLayout(this);
@ -58,7 +58,7 @@ void InputsPanel::update()
firstLine = true;
int curDest = -1;
for (int i=0; i<C9X_MAX_EXPOS; i++) {
for (int i=0; i<CPN_MAX_EXPOS; i++) {
ExpoData *md = &model->expoData[i];
if (md->mode==0) break;
@ -162,7 +162,7 @@ QString InputsPanel::getInputText(int dest, bool * new_ch)
bool InputsPanel::gm_insertExpo(int idx)
{
if (idx<0 || idx>=C9X_MAX_EXPOS || model->expoData[C9X_MAX_EXPOS-1].mode > 0) {
if (idx<0 || idx>=CPN_MAX_EXPOS || model->expoData[CPN_MAX_EXPOS-1].mode > 0) {
QMessageBox::information(this, "Companion", tr("Not enough available inputs!"));
return false;
}
@ -184,7 +184,7 @@ void InputsPanel::gm_deleteExpo(int index)
void InputsPanel::gm_openExpo(int index)
{
if(index<0 || index>=C9X_MAX_EXPOS) return;
if(index<0 || index>=CPN_MAX_EXPOS) return;
ExpoData mixd(model->expoData[index]);
emit modified();
@ -215,8 +215,8 @@ void InputsPanel::gm_openExpo(int index)
int InputsPanel::getExpoIndex(unsigned int dch)
{
unsigned int i = 0;
while (model->expoData[i].chn<=dch && model->expoData[i].mode && i<C9X_MAX_EXPOS) i++;
if(i==C9X_MAX_EXPOS) return -1;
while (model->expoData[i].chn<=dch && model->expoData[i].mode && i<CPN_MAX_EXPOS) i++;
if(i==CPN_MAX_EXPOS) return -1;
return i;
}
@ -226,7 +226,7 @@ QList<int> InputsPanel::createExpoListFromSelected()
QList<int> list;
foreach(QListWidgetItem *item, ExposlistWidget->selectedItems()) {
int idx= item->data(Qt::UserRole).toByteArray().at(0);
if(idx>=0 && idx<C9X_MAX_EXPOS) list << idx;
if(idx>=0 && idx<CPN_MAX_EXPOS) list << idx;
}
return list;
}
@ -424,7 +424,7 @@ void InputsPanel::expolistWidget_KeyPress(QKeyEvent *event)
int InputsPanel::gm_moveExpo(int idx, bool dir) //true=inc=down false=dec=up
{
if(idx>C9X_MAX_EXPOS || (idx==C9X_MAX_EXPOS && dir)) return idx;
if(idx>CPN_MAX_EXPOS || (idx==CPN_MAX_EXPOS && dir)) return idx;
int tdx = dir ? idx+1 : idx-1;
ExpoData temp;

View file

@ -28,16 +28,16 @@ class LogicalSwitchesPanel : public ModelPanel
void cswCut();
private:
QComboBox * csw[C9X_NUM_CSW];
QDoubleSpinBox * cswitchValue[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset[C9X_NUM_CSW];
QDoubleSpinBox * cswitchOffset2[C9X_NUM_CSW];
QTimeEdit * cswitchTOffset[C9X_NUM_CSW];
QComboBox * cswitchAnd[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDuration[C9X_NUM_CSW];
QDoubleSpinBox * cswitchDelay[C9X_NUM_CSW];
QComboBox * cswitchSource1[C9X_NUM_CSW];
QComboBox * cswitchSource2[C9X_NUM_CSW];
QComboBox * csw[CPN_MAX_CSW];
QDoubleSpinBox * cswitchValue[CPN_MAX_CSW];
QDoubleSpinBox * cswitchOffset[CPN_MAX_CSW];
QDoubleSpinBox * cswitchOffset2[CPN_MAX_CSW];
QTimeEdit * cswitchTOffset[CPN_MAX_CSW];
QComboBox * cswitchAnd[CPN_MAX_CSW];
QDoubleSpinBox * cswitchDuration[CPN_MAX_CSW];
QDoubleSpinBox * cswitchDelay[CPN_MAX_CSW];
QComboBox * cswitchSource1[CPN_MAX_CSW];
QComboBox * cswitchSource2[CPN_MAX_CSW];
void setSwitchWidgetVisibility(int i);
int selectedSwitch;

View file

@ -38,7 +38,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, G
}
if (!firmware->getCapability(VirtualInputs)) {
for(int i=0; i < NUM_STICKS; i++) {
for(int i=0; i < CPN_MAX_STICKS; i++) {
ui->trimCB->addItem(AnalogString(i));
}
}
@ -145,7 +145,7 @@ void MixerDialog::valuesChanged()
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
md->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
if (firmware->getCapability(HasNoExpo)) {
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < NUM_STICKS);
bool drVisible = (md->srcRaw.type == SOURCE_TYPE_STICK && md->srcRaw.index < CPN_MAX_STICKS);
ui->MixDR_CB->setEnabled(drVisible);
ui->label_MixDR->setEnabled(drVisible);
}

View file

@ -594,7 +594,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
}
QWidget * prevFocus = ui->image;
for (int i=0; i<C9X_MAX_TIMERS; i++) {
for (int i=0; i<CPN_MAX_TIMERS; i++) {
if (i<firmware->getCapability(Timers)) {
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware, prevFocus);
ui->gridLayout->addWidget(timers[i], 1+i, 1);
@ -610,7 +610,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
if (firmware->getCapability(HasTopLcd)) {
ui->toplcdTimer->setField(model.toplcdTimer, this);
for (int i=0; i<C9X_MAX_TIMERS; i++) {
for (int i=0; i<CPN_MAX_TIMERS; i++) {
if (i<firmware->getCapability(Timers)) {
ui->toplcdTimer->addItem(tr("Timer %1").arg(i+1), i);
}
@ -631,7 +631,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
// Beep Center checkboxes
prevFocus = ui->trimsDisplay;
int analogs = NUM_STICKS + firmware->getCapability(Pots) + firmware->getCapability(Sliders);
int analogs = CPN_MAX_STICKS + firmware->getCapability(Pots) + firmware->getCapability(Sliders);
for (int i=0; i<analogs+firmware->getCapability(RotaryEncoders); i++) {
QCheckBox * checkbox = new QCheckBox(this);
checkbox->setProperty("index", i);
@ -641,10 +641,10 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
centerBeepCheckboxes << checkbox;
if (IS_TARANIS(board)) {
RawSource src(SOURCE_TYPE_STICK, i);
if (src.isPot() && !generalSettings.isPotAvailable(i-NUM_STICKS)) {
if (src.isPot() && !generalSettings.isPotAvailable(i-CPN_MAX_STICKS)) {
checkbox->hide();
}
else if (src.isSlider() && !generalSettings.isSliderAvailable(i-NUM_STICKS-firmware->getCapability(Pots))) {
else if (src.isSlider() && !generalSettings.isSliderAvailable(i-CPN_MAX_STICKS-firmware->getCapability(Pots))) {
checkbox->hide();
}
}
@ -702,7 +702,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
ui->potWarningLayout->addWidget(cb, 0, i+1);
connect(cb, SIGNAL(toggled(bool)), this, SLOT(potWarningToggled(bool)));
potWarningCheckboxes << cb;
if (RawSource(SOURCE_TYPE_STICK, NUM_STICKS+i).isPot()) {
if (RawSource(SOURCE_TYPE_STICK, CPN_MAX_STICKS+i).isPot()) {
if (!generalSettings.isPotAvailable(i)) {
cb->hide();
}
@ -736,9 +736,9 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
}
if (firmware->getCapability(ModelTrainerEnable)) {
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, firmware, -1);
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
connect(modules[C9X_NUM_MODULES], SIGNAL(modified()), this, SLOT(onChildModified()));
modules[CPN_MAX_MODULES] = new ModulePanel(this, model, model.moduleData[CPN_MAX_MODULES], generalSettings, firmware, -1);
ui->modulesLayout->addWidget(modules[CPN_MAX_MODULES]);
connect(modules[CPN_MAX_MODULES], SIGNAL(modified()), this, SLOT(onChildModified()));
}
disableMouseScrolling();
@ -894,7 +894,7 @@ void SetupPanel::update()
for (int i=0; i<firmware->getCapability(Timers); i++)
timers[i]->update();
for (int i=0; i<C9X_NUM_MODULES+1; i++)
for (int i=0; i<CPN_MAX_MODULES+1; i++)
if (modules[i])
modules[i]->update();
}

View file

@ -115,8 +115,8 @@ class SetupPanel : public ModelPanel
QVector<QCheckBox *> startupSwitchesCheckboxes;
QVector<QCheckBox *> potWarningCheckboxes;
QVector<QCheckBox *> centerBeepCheckboxes;
ModulePanel * modules[C9X_NUM_MODULES+1];
TimerPanel * timers[C9X_MAX_TIMERS];
ModulePanel * modules[CPN_MAX_MODULES+1];
TimerPanel * timers[CPN_MAX_TIMERS];
void updateStartupSwitches();
void updatePotWarnings();
void updateBeepCenter();

View file

@ -628,13 +628,13 @@ void populateTelemetrySourcesComboBox(AutoComboBox * cb, const ModelData * model
{
cb->clear();
if (negative) {
for (int i=-C9X_MAX_SENSORS; i<0; ++i) {
for (int i=-CPN_MAX_SENSORS; i<0; ++i) {
if (model->sensorData[-i-1].isAvailable())
cb->addItem(QObject::tr("-%1").arg(model->sensorData[-i-1].label), i);
}
}
cb->addItem("---", 0);
for (int i=1; i<=C9X_MAX_SENSORS; ++i) {
for (int i=1; i<=CPN_MAX_SENSORS; ++i) {
if (model->sensorData[i-1].isAvailable())
cb->addItem(model->sensorData[i-1].label, i);
}
@ -720,7 +720,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettin
if (IS_ARM(firmware->getBoard())) {
ui->A1GB->hide();
ui->A2GB->hide();
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
TelemetrySensorPanel * panel = new TelemetrySensorPanel(this, model.sensorData[i], model, generalSettings, firmware);
ui->sensorsLayout->addWidget(panel);
sensorPanels[i] = panel;
@ -782,7 +782,7 @@ void TelemetryPanel::update()
}
if (IS_ARM(firmware->getBoard())) {
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
sensorPanels[i]->update();
}
for (int i=0; i<firmware->getCapability(TelemetryCustomScreens); i++) {
@ -827,7 +827,7 @@ void TelemetryPanel::setup()
}
/*if (IS_ARM(firmware->getBoard())) {
for (int i=0; i<C9X_MAX_SENSORS; ++i) {
for (int i=0; i<CPN_MAX_SENSORS; ++i) {
TelemetrySensorPanel * panel = new TelemetrySensorPanel(this, model->, model, generalSettings, firmware);
ui->sensorsLayout->addWidget(panel);
sensorPanels[i] = panel;

View file

@ -134,7 +134,7 @@ class TelemetryPanel : public ModelPanel
Ui::Telemetry *ui;
TelemetryAnalog * analogs[4];
TelemetryCustomScreen * telemetryCustomScreens[4];
TelemetrySensorPanel * sensorPanels[C9X_MAX_SENSORS];
TelemetrySensorPanel * sensorPanels[CPN_MAX_SENSORS];
void setup();
void telBarUpdate();

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "modelslist.h"
#include "mdichild.h"
#include "helpers.h"
@ -52,7 +11,7 @@ class DragDropHeader {
}
bool general_settings;
uint8_t models_count;
uint8_t models[C9X_MAX_MODELS];
uint8_t models[CPN_MAX_MODELS];
};
ModelsListWidget::ModelsListWidget(QWidget *parent):

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef MODELSLIST_H
#define MODELSLIST_H
@ -48,7 +7,7 @@
struct CurrentSelection
{
QListWidgetItem *current_item;
bool selected[C9X_MAX_MODELS+1];
bool selected[CPN_MAX_MODELS+1];
};
class ModelsListWidget : public QListWidget

View file

@ -247,7 +247,7 @@ QString MultiModelPrinter::printFlightModes()
columns.append("<td><b>" + tr("Switch") + "</b></td>");
columns.append("<td><b>" + tr("Fade IN") + "</b></td>");
columns.append("<td><b>" + tr("Fade OUT") + "</b></td>");
for (int i=0; i<NUM_STICKS; i++) {
for (int i=0; i<CPN_MAX_STICKS; i++) {
columns.append("<td><b>" + AnalogString(i) + " trim</b></td>");
}
columns.append("</tr>");
@ -262,7 +262,7 @@ QString MultiModelPrinter::printFlightModes()
columns.append("</td><td>");
COMPARE(model->flightModeData[i].fadeOut);
columns.append("</td>");
for (int k=0; k<NUM_STICKS; k++) {
for (int k=0; k<CPN_MAX_STICKS; k++) {
columns.append("<td>");
COMPARE(modelPrinter->printTrim(i, k));
columns.append("</td>");

View file

@ -29,15 +29,15 @@ telemetryStreaming = 20;
#ifdef SETVALUES_IMPORT
#undef SETVALUES_IMPORT
for (int i=0; i<NUM_STICKS; i++)
for (int i=0; i<CPN_MAX_STICKS; i++)
g_anas[i] = inputs.sticks[i];
for (int i=0; i<NUM_POTS+NUM_SLIDERS; i++)
g_anas[NUM_STICKS+i] = inputs.pots[i];
for (int i=0; i<C9X_NUM_SWITCHES; i++)
g_anas[CPN_MAX_STICKS+i] = inputs.pots[i];
for (int i=0; i<CPN_MAX_SWITCHES; i++)
simuSetSwitch(i, inputs.switches[i]);
for (int i=0; i<C9X_NUM_KEYS; i++)
for (int i=0; i<CPN_MAX_KEYS; i++)
simuSetKey(i, inputs.keys[i]);
for (int i=0; i<(NUM_STICKS+NUM_AUX_TRIMS)*2; i++)
for (int i=0; i<(CPN_MAX_STICKS+NUM_AUX_TRIMS)*2; i++)
simuSetTrim(i, inputs.trims[i]);
#ifdef PCBGRUVIN9X

View file

@ -29,10 +29,10 @@ template<class t> t LIMIT(t mi, t x, t ma) { return std::min(std::max(mi, x), ma
struct TxInputs
{
int sticks[NUM_STICKS]; /* lh lv rv rh */
int pots[C9X_NUM_POTS];
int switches[C9X_NUM_SWITCHES];
bool keys[C9X_NUM_KEYS];
int sticks[CPN_MAX_STICKS]; /* lh lv rv rh */
int pots[CPN_MAX_POTS];
int switches[CPN_MAX_SWITCHES];
bool keys[CPN_MAX_KEYS];
bool rotenc;
bool trims[12];
};
@ -41,16 +41,16 @@ class TxOutputs
{
public:
TxOutputs() { memset(this, 0, sizeof(TxOutputs)); }
int chans[C9X_NUM_CHNOUT];
bool vsw[C9X_NUM_CSW];
int gvars[C9X_MAX_FLIGHT_MODES][C9X_MAX_GVARS];
int chans[CPN_MAX_CHNOUT];
bool vsw[CPN_MAX_CSW];
int gvars[CPN_MAX_FLIGHT_MODES][CPN_MAX_GVARS];
unsigned int beep;
// uint8_t phase;
};
struct Trims
{
int values[NUM_STICKS]; /* lh lv rv rh */
int values[CPN_MAX_STICKS]; /* lh lv rv rh */
bool extended;
};

View file

@ -1,44 +1,3 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QApplication>
#include <QTranslator>
#include <QLocale>

View file

@ -1,18 +1,3 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on th9x -> http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef SPLASHLABEL_H
#define SPLASHLABEL_H

View file

@ -152,7 +152,7 @@ void saveModel(ModelData & m, model & xm)
phases xphases;
phases::phase_sequence & phases_sequence (xphases.phase());
for (int i=0; i<C9X_MAX_FLIGHT_MODES; i++) {
for (int i=0; i<CPN_MAX_FLIGHT_MODES; i++) {
FlightModeData & p = m.flightModeData[i];
if (i == 0 || p.swtch.type!=SWITCH_TYPE_NONE) {
TrimType xtrim[4];
@ -192,7 +192,7 @@ bool XmlInterface::save(RadioData &radioData)
// the models
models xml_models;
models::model_sequence & model_sequence (xml_models.model());
for (int i=0; i<C9X_MAX_MODELS; i++) {
for (int i=0; i<CPN_MAX_MODELS; i++) {
ModelData & m = radioData.models[i];
if (m.used) {
model xm(m.name);

View file

@ -1,16 +1,3 @@
/*
* Author - Kjell Kernen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <string.h>
#include "eeprominterface.h"
#include "wizarddata.h"

View file

@ -1,17 +1,3 @@
/*
* Author - Kjell Kernen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef WIZARDDATA_H
#define WIZARDDATA_H

View file

@ -1,17 +1,3 @@
/*
* Author - Kjell Kernen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include "wizarddialog.h"
#include "wizarddata.h"
#include "helpers.h"

View file

@ -1,17 +1,3 @@
/*
* Author - Kjell Kernen
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef WIZARDDIALOG_H
#define WIZARDDIALOG_H