Merge against latest 2.3
This commit is contained in:
@@ -1,3 +1,26 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* 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 _MODULES_CONSTANTS_H_
|
||||
#define _MODULES_CONSTANTS_H_
|
||||
|
||||
enum ModuleType {
|
||||
MODULE_TYPE_NONE = 0,
|
||||
MODULE_TYPE_PPM,
|
||||
@@ -165,3 +188,14 @@ enum FailsafeModes {
|
||||
FAILSAFE_RECEIVER,
|
||||
FAILSAFE_LAST = FAILSAFE_RECEIVER
|
||||
};
|
||||
|
||||
enum AntennaModes {
|
||||
ANTENNA_MODE_INTERNAL = -2,
|
||||
ANTENNA_MODE_ASK = -1,
|
||||
ANTENNA_MODE_PER_MODEL = 0,
|
||||
ANTENNA_MODE_EXTERNAL = 1,
|
||||
ANTENNA_MODE_FIRST = ANTENNA_MODE_INTERNAL,
|
||||
ANTENNA_MODE_LAST = ANTENNA_MODE_EXTERNAL
|
||||
};
|
||||
|
||||
#endif // _MODULES_CONSTANTS_H_
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* 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 "opentx.h"
|
||||
|
||||
#if defined(EXTERNAL_ANTENNA)
|
||||
bool isExternalAntennaEnabled()
|
||||
{
|
||||
switch (g_eeGeneral.antennaMode) {
|
||||
case ANTENNA_MODE_INTERNAL:
|
||||
return false;
|
||||
case ANTENNA_MODE_EXTERNAL:
|
||||
return true;
|
||||
case ANTENNA_MODE_PER_MODEL:
|
||||
switch (g_model.moduleData[INTERNAL_MODULE].pxx.antennaMode) {
|
||||
case ANTENNA_MODE_EXTERNAL:
|
||||
case ANTENNA_MODE_ASK:
|
||||
return globalData.externalAntennaEnabled;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
return globalData.externalAntennaEnabled;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -529,4 +529,6 @@ inline void setModuleType(uint8_t moduleIdx, uint8_t moduleType)
|
||||
setDefaultPpmFrameLength(moduleIdx);
|
||||
}
|
||||
|
||||
extern bool isExternalAntennaEnabled();
|
||||
|
||||
#endif // _MODULES_HELPERS_H_
|
||||
|
||||
@@ -46,12 +46,6 @@
|
||||
#define IS_DSM2_PROTOCOL(protocol) (0)
|
||||
#endif
|
||||
|
||||
#if defined(DSM2_SERIAL)
|
||||
#define IS_DSM2_SERIAL_PROTOCOL(protocol) (IS_DSM2_PROTOCOL(protocol))
|
||||
#else
|
||||
#define IS_DSM2_SERIAL_PROTOCOL(protocol) (0)
|
||||
#endif
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
#define IS_MULTIMODULE_PROTOCOL(protocol) (protocol==PROTOCOL_CHANNELS_MULTIMODULE)
|
||||
#if !defined(DSM2)
|
||||
@@ -146,7 +140,7 @@ class BindInformation {
|
||||
|
||||
class OtaUpdateInformation: public BindInformation {
|
||||
public:
|
||||
char filename[_MAX_LFN+1];
|
||||
char filename[32+1];
|
||||
uint32_t address;
|
||||
};
|
||||
|
||||
|
||||
+10
-10
@@ -52,27 +52,27 @@ template <class PxxTransport>
|
||||
void Pxx1Pulses<PxxTransport>::addExtraFlags(uint8_t module)
|
||||
{
|
||||
// Ext. flag (holds antenna selection on Horus internal module, 0x00 otherwise)
|
||||
uint8_t extra_flags = 0;
|
||||
uint8_t extraFlags = 0;
|
||||
|
||||
#if defined(PCBHORUS) || defined(PCBXLITE)
|
||||
if (module == INTERNAL_MODULE) {
|
||||
extra_flags |= (g_model.moduleData[module].pxx.external_antenna << 0);
|
||||
#if defined(EXTERNAL_ANTENNA)
|
||||
if (module == INTERNAL_MODULE && isExternalAntennaEnabled()) {
|
||||
extraFlags |= (1 << 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
extra_flags |= (g_model.moduleData[module].pxx.receiver_telem_off << 1);
|
||||
extra_flags |= (g_model.moduleData[module].pxx.receiver_channel_9_16 << 2);
|
||||
extraFlags |= (g_model.moduleData[module].pxx.receiverTelemetryOff << 1);
|
||||
extraFlags |= (g_model.moduleData[module].pxx.receiverHigherChannels << 2);
|
||||
if (isModuleR9MNonAccess(module)) {
|
||||
extra_flags |= (min<uint8_t>(g_model.moduleData[module].pxx.power, isModuleR9M_FCC_VARIANT(module) ? (uint8_t)R9M_FCC_POWER_MAX : (uint8_t)R9M_LBT_POWER_MAX) << 3);
|
||||
extraFlags |= (min<uint8_t>(g_model.moduleData[module].pxx.power, isModuleR9M_FCC_VARIANT(module) ? (uint8_t)R9M_FCC_POWER_MAX : (uint8_t)R9M_LBT_POWER_MAX) << 3);
|
||||
if (isModuleR9M_EUPLUS(module))
|
||||
extra_flags |= (1 << 6);
|
||||
extraFlags |= (1 << 6);
|
||||
}
|
||||
|
||||
// Disable S.PORT if internal module is active
|
||||
if (module == EXTERNAL_MODULE && isSportLineUsedByInternalModule()) {
|
||||
extra_flags |= (1 << 5);
|
||||
extraFlags |= (1 << 5);
|
||||
}
|
||||
PxxTransport::addByte(extra_flags);
|
||||
PxxTransport::addByte(extraFlags);
|
||||
}
|
||||
|
||||
template <class PxxTransport>
|
||||
|
||||
@@ -243,7 +243,7 @@ void Pxx2Pulses::setupAccstBindFrame(uint8_t module)
|
||||
for (uint8_t i=0; i<PXX2_LEN_RX_NAME; i++) {
|
||||
Pxx2Transport::addByte(0x00);
|
||||
}
|
||||
Pxx2Transport::addByte((g_model.moduleData[module].pxx.receiver_channel_9_16 << 7) + (g_model.moduleData[module].pxx.receiver_telem_off << 6));
|
||||
Pxx2Transport::addByte((g_model.moduleData[module].pxx.receiverHigherChannels << 7) + (g_model.moduleData[module].pxx.receiverTelemetryOff << 6));
|
||||
Pxx2Transport::addByte(g_model.header.modelId[module]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user