1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-26 01:35:21 +03:00

Merge branch '2.3.0' into 2.3

This commit is contained in:
Kilrah 2019-09-24 09:39:33 +02:00
commit 20f87078aa
34 changed files with 135 additions and 87 deletions

View file

@ -1935,16 +1935,25 @@ class SensorField: public TransformedField {
void afterImport() override void afterImport() override
{ {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) { if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) {
sensor.id = _id; if (strlen(sensor.label) == 0) {
sensor.subid = _subid; sensor.clear();
if (model.moduleData[0].isPxx1Module() || model.moduleData[1].isPxx1Module()) }
sensor.instance = (_instance & 0x1F) + (version <= 218 ? -1 : 0); // 5 bits instance else {
else sensor.id = _id;
sensor.instance = _instance & 0x1F; sensor.subid = _subid;
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx if (model.moduleData[0].isPxx1Module() || model.moduleData[1].isPxx1Module()) {
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx sensor.instance = (_instance & 0x1F) + (version <= 218 ? -1 : 0); // 5 bits instance
sensor.ratio = _ratio; sensor.rxIdx = 0x03; // 2 bits Rx idx
sensor.offset = _offset; sensor.moduleIdx = 0x01; // 1 bit module idx
}
else {
sensor.instance = _instance & 0x1F;
sensor.rxIdx = (_instance >> 5) & 0x03; // 2 bits Rx idx
sensor.moduleIdx = (_instance >> 7) & 0x1; // 1 bit module idx
}
sensor.ratio = _ratio;
sensor.offset = _offset;
}
} }
else { else {
sensor.persistentValue = _id; sensor.persistentValue = _id;

View file

@ -92,24 +92,16 @@ QString SensorData::nameToString(int index) const
return RadioData::getElementName(tr("TELE"), index + 1, label); return RadioData::getElementName(tr("TELE"), index + 1, label);
} }
QString SensorData::getRxOrModName(const ModelData* model) const QString SensorData::getOrigin(const ModelData * model) const
{ {
if ((type != TELEM_TYPE_CUSTOM) || (!id && !instance)) if (type != TELEM_TYPE_CUSTOM || !id)
return QString(); return QString();
const ModuleData& module = model->moduleData[moduleIdx]; const ModuleData & module = model->moduleData[moduleIdx];
if (module.isPxx2Module() && rxIdx <= 2 && module.access.receivers & (1 << rxIdx)) {
if (module.isPxx2Module()) { return QString(module.access.receiverName[rxIdx]);
if (module.access.receivers & (1 << rxIdx)) { }
return QString(module.access.receiverName[rxIdx]); else {
}
// receiver does not seem to be active
return QString(); return QString();
} }
if (moduleIdx)
return tr("Internal");
return tr("External");
} }

View file

@ -148,7 +148,7 @@ class SensorData {
void updateUnit(); void updateUnit();
QString unitString() const; QString unitString() const;
QString nameToString(int index) const; QString nameToString(int index) const;
QString getRxOrModName(const ModelData* model) const; QString getOrigin(const ModelData* model) const;
void clear() { memset(this, 0, sizeof(SensorData)); } void clear() { memset(this, 0, sizeof(SensorData)); }
}; };

View file

@ -653,9 +653,8 @@ void TelemetrySensorPanel::update()
ui->id->hide(); ui->id->hide();
ui->instanceLabel->hide(); ui->instanceLabel->hide();
ui->instance->hide(); ui->instance->hide();
ui->rxLabel->hide(); ui->originLabel->hide();
ui->moduleLabel->hide(); ui->origin->hide();
ui->rxOrMod->hide();
ui->formula->show(); ui->formula->show();
ui->formula->setCurrentIndex(sensor.formula); ui->formula->setCurrentIndex(sensor.formula);
isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL); isConfigurable = (sensor.formula < SensorData::TELEM_FORMULA_CELL);
@ -679,13 +678,10 @@ void TelemetrySensorPanel::update()
ui->id->show(); ui->id->show();
ui->instanceLabel->show(); ui->instanceLabel->show();
ui->instance->show(); ui->instance->show();
QString origin = sensor.getOrigin(model);
bool is_pxx2 = model->moduleData[sensor.moduleIdx].isPxx2Module(); ui->originLabel->setVisible(!origin.isEmpty());
ui->rxLabel->setVisible(is_pxx2); ui->origin->setVisible(!origin.isEmpty());
ui->moduleLabel->setVisible(!is_pxx2); ui->origin->setText(origin);
ui->rxOrMod->setText(sensor.getRxOrModName(model));
ui->rxOrMod->show();
ui->formula->hide(); ui->formula->hide();
isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL; isConfigurable = sensor.unit < SensorData::UNIT_FIRST_VIRTUAL;
@ -755,7 +751,7 @@ void populateTelemetrySourcesComboBox(AutoComboBox * cb, const ModelData * model
const SensorData& sensor = model->sensorData[-i-1]; const SensorData& sensor = model->sensorData[-i-1];
if (sensor.isAvailable()) { if (sensor.isAvailable()) {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) if (sensor.type == SensorData::TELEM_TYPE_CUSTOM)
cb->addItem(QString("-%1 (%2)").arg(sensor.label, sensor.getRxOrModName(model)), i); cb->addItem(QString("-%1 (%2)").arg(sensor.label, sensor.getOrigin(model)), i);
else else
cb->addItem(QString("-%1").arg(sensor.label), i); cb->addItem(QString("-%1").arg(sensor.label), i);
} }
@ -766,7 +762,7 @@ void populateTelemetrySourcesComboBox(AutoComboBox * cb, const ModelData * model
const SensorData& sensor = model->sensorData[i-1]; const SensorData& sensor = model->sensorData[i-1];
if (sensor.isAvailable()) { if (sensor.isAvailable()) {
if (sensor.type == SensorData::TELEM_TYPE_CUSTOM) if (sensor.type == SensorData::TELEM_TYPE_CUSTOM)
cb->addItem(QString("%1 (%2)").arg(sensor.label, sensor.getRxOrModName(model)), i); cb->addItem(QString("%1 (%2)").arg(sensor.label, sensor.getOrigin(model)), i);
else else
cb->addItem(QString("%1").arg(sensor.label), i); cb->addItem(QString("%1").arg(sensor.label), i);
} }

View file

@ -13,7 +13,7 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,1,0,0,0,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,1,0,0,1,1,1,0,0,1,0,1,0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,0,0">
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -121,21 +121,14 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="rxLabel"> <widget class="QLabel" name="originLabel">
<property name="text"> <property name="text">
<string>Rx</string> <string>Rx</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="moduleLabel"> <widget class="QLineEdit" name="origin">
<property name="text">
<string>Mod.</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="rxOrMod">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>

View file

@ -727,7 +727,7 @@ void TreeModel::refresh()
protocol = moduleData.protocol; protocol = moduleData.protocol;
// These are the only RXs that allow nominating RX # but changing RX or copying models can leave residual configuration which can cause issues // These are the only RXs that allow nominating RX # but changing RX or copying models can leave residual configuration which can cause issues
// if (protocol == PULSES_PXX_XJT_X16 || protocol == PULSES_PXX_XJT_LR12 || protocol == PULSES_PXX_R9M || protocol == PULSES_DSMX || protocol == PULSES_MULTIMODULE) { // if (protocol == PULSES_PXX_XJT_X16 || protocol == PULSES_PXX_XJT_LR12 || protocol == PULSES_PXX_R9M || protocol == PULSES_DSMX || protocol == PULSES_MULTIMODULE) {
if (protocol != PULSES_OFF && moduleData.modelId > 0) { if ((protocol != PULSES_OFF && protocol != PULSES_PXX_XJT_D8 ) && moduleData.modelId > 0) {
if (!rxs.isEmpty()) { if (!rxs.isEmpty()) {
rxs.append(", "); rxs.append(", ");
} }
@ -751,6 +751,9 @@ void TreeModel::refresh()
bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned module, unsigned protocol) bool TreeModel::isModelIdUnique(unsigned modelIdx, unsigned module, unsigned protocol)
{ {
int cnt = 0; int cnt = 0;
if (protocol== PULSES_PXX_XJT_D8)
return true;
for (auto const& model: radioData->models) { for (auto const& model: radioData->models) {
if (!model.isEmpty()) { if (!model.isEmpty()) {
const ModuleData& moduleData = model.moduleData[module]; const ModuleData& moduleData = model.moduleData[module];

View file

@ -1427,6 +1427,9 @@ void menuModelSetup(event_t event)
} }
else { else {
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127); CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127);
lcdDrawText(MODEL_SETUP_2ND_COLUMN+23, y, "RSSI(", LEFT);
lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT);
lcdDrawText(lcdLastRightPos, y, ")", LEFT);
} }
} }
} }

View file

@ -1253,6 +1253,9 @@ void menuModelSetup(event_t event)
} }
else { else {
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127); CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127);
lcdDrawText(MODEL_SETUP_3RD_COLUMN+22, y, "RSSI(", LEFT);
lcdDrawNumber(lcdLastRightPos, y, TELEMETRY_RSSI(), LEFT);
lcdDrawText(lcdLastRightPos, y, ")", LEFT);
} }
} }
} }

View file

@ -1562,6 +1562,7 @@ bool menuModelSetup(event_t event)
} }
else { else {
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127); CHECK_INCDEC_MODELVAR(event, g_model.moduleData[moduleIdx].multi.optionValue, -128, 127);
lcdDrawNumber(LCD_W-10, y, TELEMETRY_RSSI(), RIGHT, 0, "RSSI(", ")");
} }
} }
} }

View file

@ -49,7 +49,7 @@ void addRadioModuleTool(uint8_t index, const char * label, bool (* tool)(event_t
#if defined(LUA) #if defined(LUA)
void addRadioScriptTool(uint8_t index, const char * path) void addRadioScriptTool(uint8_t index, const char * path)
{ {
char toolName[TOOL_NAME_MAXLEN + 1]; char toolName[RADIO_TOOL_NAME_MAXLEN + 1];
const char * label; const char * label;
char * ext = (char *)getFileExtension(path); char * ext = (char *)getFileExtension(path);
if (readToolName(toolName, path)) { if (readToolName(toolName, path)) {

View file

@ -46,15 +46,13 @@ void addRadioModuleTool(uint8_t index, const char * label, void (* tool)(event_t
} }
} }
#define TOOL_NAME_MAXLEN 16
#if defined(LUA) #if defined(LUA)
void addRadioScriptTool(uint8_t index, const char * path) void addRadioScriptTool(uint8_t index, const char * path)
{ {
char toolName[TOOL_NAME_MAXLEN + 1]; char toolName[RADIO_TOOL_NAME_MAXLEN + 1];
if (!readToolName(toolName, path)) { if (!readToolName(toolName, path)) {
strAppendFilename(toolName, getBasename(path), TOOL_NAME_MAXLEN); strAppendFilename(toolName, getBasename(path), RADIO_TOOL_NAME_MAXLEN);
} }
if (addRadioTool(index, toolName)) { if (addRadioTool(index, toolName)) {

View file

@ -1150,11 +1150,11 @@ bool readToolName(char * toolName, const char * filename)
return false; return false;
uint8_t len = end - start; uint8_t len = end - start;
if (len > TOOL_NAME_MAXLEN) if (len > RADIO_TOOL_NAME_MAXLEN)
return false; return false;
strncpy(toolName, start, len); strncpy(toolName, start, len);
memclear(toolName + len, TOOL_NAME_MAXLEN + 1 - len); memclear(toolName + len, RADIO_TOOL_NAME_MAXLEN + 1 - len);
return true; return true;
} }

View file

@ -171,7 +171,12 @@ void registerBitmapClass(lua_State * L);
void luaSetInstructionsLimit(lua_State* L, int count); void luaSetInstructionsLimit(lua_State* L, int count);
int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode); int luaLoadScriptFileToState(lua_State * L, const char * filename, const char * mode);
#define TOOL_NAME_MAXLEN 16 #if LCD_W > 350
#define RADIO_TOOL_NAME_MAXLEN 40
#else
#define RADIO_TOOL_NAME_MAXLEN 16
#endif
bool readToolName(char * toolName, const char * filename); bool readToolName(char * toolName, const char * filename);
bool isRadioScriptTool(const char * filename); bool isRadioScriptTool(const char * filename);

View file

@ -341,8 +341,8 @@ getvalue_t getValue(mixsrc_t i)
} }
#if defined(PCBTARANIS) || defined(PCBHORUS) #if defined(PCBTARANIS) || defined(PCBHORUS)
else if ((i >= MIXSRC_FIRST_SWITCH) && (i <= MIXSRC_LAST_SWITCH)) { else if (i >= MIXSRC_FIRST_SWITCH && i <= MIXSRC_LAST_SWITCH) {
mixsrc_t sw = i-MIXSRC_FIRST_SWITCH; mixsrc_t sw = i - MIXSRC_FIRST_SWITCH;
if (SWITCH_EXISTS(sw)) { if (SWITCH_EXISTS(sw)) {
return (switchState(3*sw) ? -1024 : (IS_CONFIG_3POS(sw) && switchState(3*sw+1) ? 0 : 1024)); return (switchState(3*sw) ? -1024 : (IS_CONFIG_3POS(sw) && switchState(3*sw+1) ? 0 : 1024));
} }

View file

@ -838,6 +838,21 @@ void checkSDVersion()
} }
#endif #endif
#if defined(MULTIMODULE)
void checkMultiLowPower()
{
if (isModuleMultimodule(EXTERNAL_MODULE) && g_model.moduleData[EXTERNAL_MODULE].multi.lowPowerMode) {
ALERT("MULTI", STR_WARN_MULTI_LOWPOWER, AU_ERROR);
return;
}
#if defined(INTERNAL_MODULE_MULTI)
if (isModuleMultimodule(INTERNAL_MODULE) && g_model.moduleData[INTERNAL_MODULE].multi.lowPowerMode) {
ALERT("MULTI", STR_WARN_MULTI_LOWPOWER, AU_ERROR);
}
#endif
}
#endif
#if defined(STM32) #if defined(STM32)
static void checkRTCBattery() static void checkRTCBattery()
{ {
@ -901,6 +916,10 @@ void checkAll()
readModelNotes(); readModelNotes();
} }
#if defined(MULTIMODULE)
checkMultiLowPower();
#endif
if (!waitKeysReleased()) { if (!waitKeysReleased()) {
showMessageBox(STR_KEYSTUCK); showMessageBox(STR_KEYSTUCK);
tmr10ms_t tgtime = get_tmr10ms() + 500; tmr10ms_t tgtime = get_tmr10ms() + 500;

View file

@ -59,18 +59,13 @@ static void sendFailsafeChannels(uint8_t port)
for (int i = 0; i < MULTI_CHANS; i++) { for (int i = 0; i < MULTI_CHANS; i++) {
int16_t failsafeValue = g_model.failsafeChannels[i]; int16_t failsafeValue = g_model.failsafeChannels[i];
int pulseValue; int pulseValue;
if (g_model.moduleData[port].failsafeMode == FAILSAFE_HOLD)
failsafeValue = FAILSAFE_CHANNEL_HOLD;
if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) if (g_model.moduleData[port].failsafeMode == FAILSAFE_HOLD) {
failsafeValue = FAILSAFE_CHANNEL_NOPULSE;
if (failsafeValue == FAILSAFE_CHANNEL_HOLD) {
pulseValue = 0;
}
else if (failsafeValue == FAILSAFE_CHANNEL_NOPULSE) {
pulseValue = 2047; pulseValue = 2047;
} }
else if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) {
pulseValue = 0;
}
else { else {
failsafeValue += 2 * PPM_CH_CENTER(g_model.moduleData[port].channelsStart + i) - 2 * PPM_CENTER; failsafeValue += 2 * PPM_CH_CENTER(g_model.moduleData[port].channelsStart + i) - 2 * PPM_CENTER;
pulseValue = limit(1, (failsafeValue * 800 / 1000) + 1024, 2047); pulseValue = limit(1, (failsafeValue * 800 / 1000) + 1024, 2047);

View file

@ -290,7 +290,7 @@ void convertModelData_218_to_219(ModelData &model)
for (uint8_t i=0; i<MAX_TELEMETRY_SENSORS_218; i++) { for (uint8_t i=0; i<MAX_TELEMETRY_SENSORS_218; i++) {
newModel.telemetrySensors[i].id = oldModel.telemetrySensors[i].id; newModel.telemetrySensors[i].id = oldModel.telemetrySensors[i].id;
if (oldModel.telemetrySensors[i].type == 0 && (oldModel.moduleData[0].type == MODULE_TYPE_XJT_PXX1 || oldModel.moduleData[1].type == MODULE_TYPE_XJT_PXX1)) if (oldModel.telemetrySensors[i].type == 0 && ZLEN(oldModel.telemetrySensors[i].label) > 0 && (isModuleTypePXX1(oldModel.moduleData[0].type) || isModuleTypePXX1(oldModel.moduleData[1].type)))
newModel.telemetrySensors[i].instance = 0xE0 + (oldModel.telemetrySensors[i].instance & 0x1F) - 1; newModel.telemetrySensors[i].instance = 0xE0 + (oldModel.telemetrySensors[i].instance & 0x1F) - 1;
else else
newModel.telemetrySensors[i].instance = oldModel.telemetrySensors[i].instance; newModel.telemetrySensors[i].instance = oldModel.telemetrySensors[i].instance;

View file

@ -154,6 +154,15 @@ void getSwitchesPosition(bool startup)
CHECK_2POS(SW_SH); CHECK_2POS(SW_SH);
#endif #endif
#if defined(PCBX9DP) && PCBREV >= 2019
CHECK_2POS(SW_SI);
#endif
#if defined(PCBHORUS) || defined(PCBX7)
CHECK_2POS(SW_SI);
CHECK_2POS(SW_SJ);
#endif
#if defined(PCBX9E) #if defined(PCBX9E)
CHECK_3POS(6, SW_SI); CHECK_3POS(6, SW_SI);
CHECK_3POS(7, SW_SJ); CHECK_3POS(7, SW_SJ);

View file

@ -195,23 +195,22 @@
// Index of all keys // Index of all keys
#if defined(PCBX12S) #if defined(PCBX12S)
#define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_C_L | TRIMS_GPIO_PIN_LSD | TRIMS_GPIO_PIN_LSU) #define KEYS_GPIOB_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15)
#define KEYS_GPIOC_PINS (KEYS_GPIO_PIN_PGUP | KEYS_GPIO_PIN_ENTER | KEYS_GPIO_PIN_RIGHT | TRIMS_GPIO_PIN_RHL) #define KEYS_GPIOC_PINS (GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_4 | GPIO_Pin_13)
#define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR | TRIMS_GPIO_PIN_RSU) #define KEYS_GPIOD_PINS (GPIO_Pin_3 | GPIO_Pin_7 | GPIO_Pin_11 | GPIO_Pin_13)
#define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L) #define KEYS_GPIOE_PINS (GPIO_Pin_3)
#define KEYS_GPIOG_PINS (KEYS_GPIO_PIN_UP | SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_RVD) #define KEYS_GPIOG_PINS (KEYS_GPIO_PIN_UP | SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_RVD)
#define KEYS_GPIOH_PINS (SWITCHES_GPIO_PIN_A_H | SWITCHES_GPIO_PIN_B_H | SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_F | ROTARY_ENCODER_GPIO_PIN_A | ROTARY_ENCODER_GPIO_PIN_B) #define KEYS_GPIOH_PINS (GPIO_Pin_9 | GPIO_Pin_12 | SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_F | ROTARY_ENCODER_GPIO_PIN_A | ROTARY_ENCODER_GPIO_PIN_B)
#define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_PGDN | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_L | TRIMS_GPIO_PIN_RHR) #define KEYS_GPIOI_PINS (KEYS_GPIO_PIN_PGDN | KEYS_GPIO_PIN_LEFT | KEYS_GPIO_PIN_DOWN | SWITCHES_GPIO_PIN_A_L | GPIO_Pin_4)
#define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LVD | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RSD) #define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LVD | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RSD)
#elif defined(PCBX10) #elif defined(PCBX10)
#define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_C_L | TRIMS_GPIO_PIN_RSU | TRIMS_GPIO_PIN_RSD | TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR) #define KEYS_GPIOB_PINS (GPIO_Pin_12 | GPIO_Pin_15 | GPIO_Pin_14 | GPIO_Pin_13 | GPIO_Pin_8 | GPIO_Pin_9)
#define KEYS_GPIOC_PINS (TRIMS_GPIO_PIN_LHL) #define KEYS_GPIOD_PINS (GPIO_Pin_11 | GPIO_Pin_3 | GPIO_Pin_7 | GPIO_Pin_13)
#define KEYS_GPIOD_PINS (SWITCHES_GPIO_PIN_C_H | TRIMS_GPIO_PIN_RHL | TRIMS_GPIO_PIN_RHR | TRIMS_GPIO_PIN_LSD) #define KEYS_GPIOE_PINS (GPIO_Pin_3)
#define KEYS_GPIOE_PINS (SWITCHES_GPIO_PIN_E_L)
#define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD) #define KEYS_GPIOG_PINS (SWITCHES_GPIO_PIN_D_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | TRIMS_GPIO_PIN_LVD)
#define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15) #define KEYS_GPIOH_PINS (GPIO_Pin_3 | GPIO_Pin_4 | GPIO_Pin_9 | GPIO_Pin_10 | GPIO_Pin_11 | GPIO_Pin_12 | GPIO_Pin_14 | GPIO_Pin_15)
#define KEYS_GPIOI_PINS (GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_15) #define KEYS_GPIOI_PINS (GPIO_Pin_4 | GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_11 | GPIO_Pin_15)
#define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_LSU) #define KEYS_GPIOJ_PINS (SWITCHES_GPIO_PIN_D_H | TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | GPIO_Pin_8)
#endif #endif
// ADC // ADC

View file

@ -207,8 +207,10 @@ void keysInit()
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOB_PINS; GPIO_InitStructure.GPIO_Pin = KEYS_GPIOB_PINS;
GPIO_Init(GPIOB, &GPIO_InitStructure); GPIO_Init(GPIOB, &GPIO_InitStructure);
#if defined(KEYS_GPIOC_PINS)
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOC_PINS; GPIO_InitStructure.GPIO_Pin = KEYS_GPIOC_PINS;
GPIO_Init(GPIOC, &GPIO_InitStructure); GPIO_Init(GPIOC, &GPIO_InitStructure);
#endif
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOD_PINS; GPIO_InitStructure.GPIO_Pin = KEYS_GPIOD_PINS;
GPIO_Init(GPIOD, &GPIO_InitStructure); GPIO_Init(GPIOD, &GPIO_InitStructure);

View file

@ -45,9 +45,10 @@ struct FlySkySensor {
#define TX_RSSI_ID 300 // Pseudo id outside 1 byte range of FlySky sensors #define TX_RSSI_ID 300 // Pseudo id outside 1 byte range of FlySky sensors
#define FS_ID_TEMP 0x01 #define FS_ID_TEMP 0x01
#define FS_ID_SNR 0xfa #define FS_ID_SNR 0xFA
#define FS_ID_NOISE 0xfb #define FS_ID_NOISE 0xFB
#define FS_ID_RSSI 0xfc #define FS_ID_RSSI 0xFC
#define FS_ID_ERR 0xFE
const FlySkySensor flySkySensors[] = { const FlySkySensor flySkySensors[] = {
@ -66,7 +67,7 @@ const FlySkySensor flySkySensors[] = {
// RX RSSI (0xfc) // RX RSSI (0xfc)
{FS_ID_RSSI, ZSTR_RSSI, UNIT_DB, 0}, {FS_ID_RSSI, ZSTR_RSSI, UNIT_DB, 0},
// RX error rate // RX error rate
{0xfe, ZSTR_RX_QUALITY, UNIT_RAW, 0}, {FS_ID_ERR, ZSTR_RX_QUALITY, UNIT_RAW, 0},
// 0xff is an unused sensor slot // 0xff is an unused sensor slot
// Pseudo sensor for TRSSI // Pseudo sensor for TRSSI
{TX_RSSI_ID, ZSTR_TX_RSSI, UNIT_RAW, 0}, {TX_RSSI_ID, ZSTR_TX_RSSI, UNIT_RAW, 0},
@ -90,8 +91,11 @@ static void processFlySkySensor(const uint8_t *packet)
id = 0x100; id = 0x100;
} }
if (id == FS_ID_SNR) { if (id == FS_ID_ERR) { // ERR RATE, displayed RQLy and used as RSSI
value = 100 - value;
telemetryData.rssi.set(value); telemetryData.rssi.set(value);
if (value > 0)
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
} }
for (const FlySkySensor * sensor = flySkySensors; sensor->id; sensor++) { for (const FlySkySensor * sensor = flySkySensors; sensor->id; sensor++) {
@ -99,7 +103,12 @@ static void processFlySkySensor(const uint8_t *packet)
if (sensor->id == id) { if (sensor->id == id) {
// The Noise and Signal sensors that are specified in dB send the absolute value // The Noise and Signal sensors that are specified in dB send the absolute value
if (id == FS_ID_NOISE || id == FS_ID_RSSI) if (id == FS_ID_NOISE || id == FS_ID_RSSI)
value = -value; value = 135 - value;
else if (id == FS_ID_SNR) {
if (value > 0) {
value += 20;
}
}
else if (id == FS_ID_TEMP) else if (id == FS_ID_TEMP)
// Temperature sensors have 40 degree offset // Temperature sensors have 40 degree offset
value -= 400; value -= 400;
@ -122,7 +131,6 @@ void processFlySkyPacket(const uint8_t *packet)
int index = 1 + (4 * sensor); int index = 1 + (4 * sensor);
processFlySkySensor(packet+index); processFlySkySensor(packet+index);
} }
telemetryStreaming = TELEMETRY_TIMEOUT10ms;
} }
void processFlySkyTelemetryData(uint8_t data) void processFlySkyTelemetryData(uint8_t data)

View file

@ -354,6 +354,7 @@ const char STR_SWITCHWARN[] = TR_SWITCHWARN;
const char STR_FAILSAFEWARN[] = TR_FAILSAFEWARN; const char STR_FAILSAFEWARN[] = TR_FAILSAFEWARN;
const char STR_WRONG_SDCARDVERSION[] = TR_WRONG_SDCARDVERSION; const char STR_WRONG_SDCARDVERSION[] = TR_WRONG_SDCARDVERSION;
const char STR_WARN_RTC_BATTERY_LOW[] = TR_WARN_RTC_BATTERY_LOW; const char STR_WARN_RTC_BATTERY_LOW[] = TR_WARN_RTC_BATTERY_LOW;
const char STR_WARN_MULTI_LOWPOWER[] = TR_WARN_MULTI_LOWPOWER;
const char STR_BATTERY[] = TR_BATTERY; const char STR_BATTERY[] = TR_BATTERY;
const char STR_WRONG_PCBREV[] = TR_WRONG_PCBREV; const char STR_WRONG_PCBREV[] = TR_WRONG_PCBREV;
const char STR_EMERGENCY_MODE[] = TR_EMERGENCY_MODE; const char STR_EMERGENCY_MODE[] = TR_EMERGENCY_MODE;

View file

@ -549,6 +549,7 @@ extern const char STR_NIGHTLY_WARNING[];
extern const char STR_NIGHTLY_NOTSAFE[]; extern const char STR_NIGHTLY_NOTSAFE[];
extern const char STR_WRONG_SDCARDVERSION[]; extern const char STR_WRONG_SDCARDVERSION[];
extern const char STR_WARN_RTC_BATTERY_LOW[]; extern const char STR_WARN_RTC_BATTERY_LOW[];
extern const char STR_WARN_MULTI_LOWPOWER[];
extern const char STR_BATTERY[]; extern const char STR_BATTERY[];
extern const char STR_WRONG_PCBREV[]; extern const char STR_WRONG_PCBREV[];
extern const char STR_EMERGENCY_MODE[]; extern const char STR_EMERGENCY_MODE[];

View file

@ -734,6 +734,7 @@
#define TR_NIGHTLY_NOTSAFE "Verze není bezpečná k létání" #define TR_NIGHTLY_NOTSAFE "Verze není bezpečná k létání"
#define TR_WRONG_SDCARDVERSION "Očekávaná ver.: " #define TR_WRONG_SDCARDVERSION "Očekávaná ver.: "
#define TR_WARN_RTC_BATTERY_LOW "Slabá RTC baterie" #define TR_WARN_RTC_BATTERY_LOW "Slabá RTC baterie"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATERIE" #define TR_BATTERY "BATERIE"
#define TR_WRONG_PCBREV "Jiná verze PCB/firmware" #define TR_WRONG_PCBREV "Jiná verze PCB/firmware"
#define TR_EMERGENCY_MODE "NOUZOVÝ REŽIM" #define TR_EMERGENCY_MODE "NOUZOVÝ REŽIM"

View file

@ -736,6 +736,7 @@
#define TR_NIGHTLY_NOTSAFE "Nicht für Flug geeignet" #define TR_NIGHTLY_NOTSAFE "Nicht für Flug geeignet"
#define TR_WRONG_SDCARDVERSION TR("Erw. Version: ","Erwartete Version: ") #define TR_WRONG_SDCARDVERSION TR("Erw. Version: ","Erwartete Version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Falsche PCB erkannt" #define TR_WRONG_PCBREV "Falsche PCB erkannt"
#define TR_EMERGENCY_MODE "NOTFALL MODUS" #define TR_EMERGENCY_MODE "NOTFALL MODUS"

View file

@ -736,6 +736,7 @@
#define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_NIGHTLY_NOTSAFE "Version not safe to fly"
#define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_WRONG_PCBREV "Wrong PCB detected"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"

View file

@ -759,6 +759,7 @@
#define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_NIGHTLY_NOTSAFE "Version not safe to fly"
#define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_WRONG_PCBREV "Wrong PCB detected"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"

View file

@ -753,6 +753,7 @@
#define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_NIGHTLY_NOTSAFE "Version not safe to fly"
#define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_WRONG_PCBREV "Wrong PCB detected"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"

View file

@ -756,6 +756,7 @@
#define TR_NIGHTLY_NOTSAFE "Version de test uniq." #define TR_NIGHTLY_NOTSAFE "Version de test uniq."
#define TR_WRONG_SDCARDVERSION "Version requise: " #define TR_WRONG_SDCARDVERSION "Version requise: "
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "PCB incorrect détecté" #define TR_WRONG_PCBREV "PCB incorrect détecté"
#define TR_EMERGENCY_MODE "MODE SECOURS" #define TR_EMERGENCY_MODE "MODE SECOURS"

View file

@ -754,6 +754,7 @@
#define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_NIGHTLY_NOTSAFE "Version not safe to fly"
#define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_WRONG_PCBREV "Wrong PCB detected"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"

View file

@ -742,6 +742,7 @@ TR_GYR_VSRCRAW
#define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_NIGHTLY_NOTSAFE "Version not safe to fly"
#define TR_WRONG_SDCARDVERSION TR("Verwachte ver: ","Verwachte versie: ") #define TR_WRONG_SDCARDVERSION TR("Verwachte ver: ","Verwachte versie: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Verkeerde PCB gedetecteerd" #define TR_WRONG_PCBREV "Verkeerde PCB gedetecteerd"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"

View file

@ -754,6 +754,7 @@
#define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_NIGHTLY_NOTSAFE "Version not safe to fly"
#define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_WRONG_PCBREV "Wrong PCB detected"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"

View file

@ -744,6 +744,7 @@
#define TR_NIGHTLY_NOTSAFE "Version not safe to fly" #define TR_NIGHTLY_NOTSAFE "Version not safe to fly"
#define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_WRONG_PCBREV "Wrong PCB detected"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"

View file

@ -754,6 +754,7 @@
#define TR_SDCARDVERSIONWARN "SD Card Check" #define TR_SDCARDVERSIONWARN "SD Card Check"
#define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ") #define TR_WRONG_SDCARDVERSION TR("Expected ver: ","Expected version: ")
#define TR_WARN_RTC_BATTERY_LOW "RTC Battery low" #define TR_WARN_RTC_BATTERY_LOW "RTC Battery low"
#define TR_WARN_MULTI_LOWPOWER "Low power mode"
#define TR_BATTERY "BATTERY" #define TR_BATTERY "BATTERY"
#define TR_WRONG_PCBREV "Wrong PCB detected" #define TR_WRONG_PCBREV "Wrong PCB detected"
#define TR_EMERGENCY_MODE "EMERGENCY MODE" #define TR_EMERGENCY_MODE "EMERGENCY MODE"