Merge branch '2.3' of https://github.com/opentx/opentx into 2.3
This commit is contained in:
@@ -600,11 +600,8 @@ enum {
|
||||
CMD_RET_SUCCESS = 0x40,
|
||||
};
|
||||
|
||||
constexpr uint32_t CC26XX_FLASH_SIZE = 0x00020000;
|
||||
constexpr uint32_t CC26XX_BOOTLOADER_SIZE = 0x00001000;
|
||||
constexpr uint32_t CC26XX_DATA_SIZE = 0x00001000;
|
||||
constexpr uint32_t CC26XX_FIRMWARE_BASE = CC26XX_BOOTLOADER_SIZE;
|
||||
constexpr uint32_t CC26XX_FIRMWARE_SIZE = CC26XX_FLASH_SIZE - CC26XX_DATA_SIZE - CC26XX_BOOTLOADER_SIZE;
|
||||
|
||||
constexpr uint32_t CC26XX_PAGE_ERASE_SIZE = 0x1000;
|
||||
constexpr uint32_t CC26XX_MAX_BYTES_PER_TRANSFER = 252;
|
||||
|
||||
@@ -828,9 +828,7 @@ enum Functions {
|
||||
FUNC_HAPTIC,
|
||||
FUNC_LOGS,
|
||||
FUNC_BACKLIGHT,
|
||||
#if defined(PCBTARANIS)
|
||||
FUNC_SCREENSHOT,
|
||||
#endif
|
||||
#if defined(DEBUG)
|
||||
FUNC_TEST, // should remain the last before MAX as not added in Companion
|
||||
#endif
|
||||
@@ -861,9 +859,7 @@ enum ResetFunctionParam {
|
||||
FUNC_RESET_TIMER2,
|
||||
FUNC_RESET_TIMER3,
|
||||
FUNC_RESET_FLIGHT,
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
FUNC_RESET_TELEMETRY,
|
||||
#endif
|
||||
FUNC_RESET_PARAM_FIRST_TELEM,
|
||||
FUNC_RESET_PARAM_LAST_TELEM = FUNC_RESET_PARAM_FIRST_TELEM + MAX_TELEMETRY_SENSORS,
|
||||
FUNC_RESET_PARAMS_COUNT,
|
||||
|
||||
@@ -194,11 +194,9 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
mainRequestFlags |= (1 << REQUEST_FLIGHT_RESET); // on systems with threads flightReset() must not be called from the mixers thread!
|
||||
}
|
||||
break;
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
case FUNC_RESET_TELEMETRY:
|
||||
telemetryReset();
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
if (CFN_PARAM(cfn)>=FUNC_RESET_PARAM_FIRST_TELEM) {
|
||||
uint8_t item = CFN_PARAM(cfn)-FUNC_RESET_PARAM_FIRST_TELEM;
|
||||
@@ -338,7 +336,7 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(VARIO)
|
||||
#if defined(VARIO)
|
||||
case FUNC_VARIO:
|
||||
newActiveFunctions |= (1 << FUNCTION_VARIO);
|
||||
break;
|
||||
@@ -358,13 +356,11 @@ void evalFunctions(const CustomFunctionData * functions, CustomFunctionsContext
|
||||
newActiveFunctions |= (1 << FUNCTION_BACKLIGHT);
|
||||
break;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
case FUNC_SCREENSHOT:
|
||||
if (!(functionsContext.activeSwitches & switch_mask)) {
|
||||
mainRequestFlags |= (1 << REQUEST_SCREENSHOT);
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(DEBUG)
|
||||
case FUNC_TEST:
|
||||
|
||||
@@ -309,11 +309,7 @@ void showAlertBox(const char * title, const char * text, const char * action , u
|
||||
#define LOAD_MODEL_BITMAP()
|
||||
|
||||
#define IS_MAIN_VIEW_DISPLAYED() menuHandlers[0] == menuMainView
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
#define IS_TELEMETRY_VIEW_DISPLAYED() menuHandlers[0] == menuViewTelemetryFrsky
|
||||
#else
|
||||
#define IS_TELEMETRY_VIEW_DISPLAYED() false
|
||||
#endif
|
||||
#define IS_OTHER_VIEW_DISPLAYED() false
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags flags);
|
||||
|
||||
@@ -197,8 +197,6 @@ inline display_t getPixel(uint8_t x, uint8_t y)
|
||||
return ((pixel & mask) ? 0xf : 0);
|
||||
}
|
||||
|
||||
const char * writeScreenshot();
|
||||
|
||||
uint8_t getTextWidth(const char * s, uint8_t len=0, LcdFlags flags=0);
|
||||
|
||||
#endif // _LCD_H_
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
|
||||
uint8_t editDelay(coord_t y, event_t event, uint8_t attr, const char * str, uint8_t delay)
|
||||
{
|
||||
lcdDrawTextAlignedLeft(y, str);
|
||||
|
||||
@@ -101,7 +101,7 @@ enum MenuModelIndexes {
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
MENU_MODEL_CUSTOM_SCRIPTS,
|
||||
#endif
|
||||
CASE_FRSKY(MENU_MODEL_TELEMETRY_FRSKY)
|
||||
MENU_MODEL_TELEMETRY,
|
||||
MENU_MODEL_DISPLAY,
|
||||
MENU_MODEL_PAGES_COUNT
|
||||
};
|
||||
@@ -124,7 +124,7 @@ void menuModelGVars(event_t event);
|
||||
void menuModelLogicalSwitches(event_t event);
|
||||
void menuModelSpecialFunctions(event_t event);
|
||||
void menuModelCustomScripts(event_t event);
|
||||
void menuModelTelemetryFrsky(event_t event);
|
||||
void menuModelTelemetry(event_t event);
|
||||
void menuModelSensor(event_t event);
|
||||
void menuModelDisplay(event_t event);
|
||||
void menuModelTemplates(event_t event);
|
||||
@@ -144,7 +144,7 @@ static const MenuHandlerFunc menuTabModel[] = {
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
menuModelCustomScripts,
|
||||
#endif
|
||||
CASE_FRSKY(menuModelTelemetryFrsky)
|
||||
menuModelTelemetry,
|
||||
menuModelDisplay,
|
||||
};
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
|
||||
@@ -154,7 +154,6 @@ void menuModelLogicalSwitchOne(event_t event)
|
||||
INCDEC_ENABLE_CHECK(isSourceAvailable);
|
||||
}
|
||||
else {
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
if (v1_val >= MIXSRC_FIRST_TELEM) {
|
||||
drawSourceCustomValue(CSWONE_2ND_COLUMN, y, v1_val, convertLswTelemValue(cs), attr|LEFT);
|
||||
v2_max = maxTelemValue(v1_val - MIXSRC_FIRST_TELEM + 1);
|
||||
@@ -171,7 +170,6 @@ void menuModelLogicalSwitchOne(event_t event)
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif // TELEMETRY_FRSKY
|
||||
{
|
||||
LcdFlags lf = attr | LEFT;
|
||||
getMixSrcRange(v1_val, v2_min, v2_max, &lf);
|
||||
|
||||
@@ -192,7 +192,19 @@ enum MenuModelSetupItems {
|
||||
#endif
|
||||
|
||||
#define PORT_CHANNELS_ROWS(x) (x==EXTERNAL_MODULE ? EXTERNAL_MODULE_CHANNELS_ROWS : 0)
|
||||
#define EXTERNAL_MODULE_TYPE_ROWS (isModulePXX1(EXTERNAL_MODULE) || isModulePXX2(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE) || isModuleMultimodule(EXTERNAL_MODULE)) ? (uint8_t)1 : (uint8_t)0
|
||||
|
||||
inline uint8_t EXTERNAL_MODULE_TYPE_ROW()
|
||||
{
|
||||
if (isModuleXJT(EXTERNAL_MODULE) || isModuleR9MNonAccess(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE))
|
||||
return 1;
|
||||
#if defined(MULTIMODULE)
|
||||
else if (isModuleMultimodule(EXTERNAL_MODULE)) {
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define POT_WARN_ROWS ((g_model.potsWarnMode) ? (uint8_t)(NUM_POTS+NUM_SLIDERS) : (uint8_t)0)
|
||||
#define TIMER_ROWS 2, 0, 0, 0, 0
|
||||
@@ -315,7 +327,7 @@ void menuModelSetup(event_t event)
|
||||
INTERNAL_MODULE_ROWS
|
||||
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_TYPE_ROWS,
|
||||
EXTERNAL_MODULE_TYPE_ROW(),
|
||||
MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE)
|
||||
EXTERNAL_MODULE_POWER_ROW,
|
||||
MULTIMODULE_STATUS_ROWS
|
||||
@@ -336,7 +348,7 @@ void menuModelSetup(event_t event)
|
||||
#else
|
||||
MENU_TAB({ HEADER_LINE_COLUMNS 0, TIMER_ROWS, TIMER_ROWS, TIMER_ROWS, 0, 1, 0, 0, 0, 0, 0, LABEL(PreflightCheck), 0, 0, NUM_SWITCHES-1, NUM_STICKS+NUM_POTS+NUM_SLIDERS-1, 0,
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_TYPE_ROWS,
|
||||
EXTERNAL_MODULE_TYPE_ROW(),
|
||||
MULTIMODULE_SUBTYPE_ROWS(EXTERNAL_MODULE)
|
||||
MULTIMODULE_STATUS_ROWS
|
||||
EXTERNAL_MODULE_CHANNELS_ROWS,
|
||||
@@ -764,10 +776,7 @@ void menuModelSetup(event_t event)
|
||||
if (menuHorizontalPosition == 0) {
|
||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isInternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
// TODO this code should be common, in module.h (X10_new_UI branch)
|
||||
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
|
||||
g_model.moduleData[INTERNAL_MODULE].type = moduleType;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
|
||||
setModuleType(INTERNAL_MODULE, moduleType);
|
||||
}
|
||||
}
|
||||
else if (isModuleXJT(INTERNAL_MODULE)) {
|
||||
@@ -837,22 +846,9 @@ void menuModelSetup(event_t event)
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
{
|
||||
uint8_t moduleType = checkIncDec(event,
|
||||
g_model.moduleData[EXTERNAL_MODULE].type,
|
||||
MODULE_TYPE_NONE,
|
||||
IS_TRAINER_EXTERNAL_MODULE() ? MODULE_TYPE_NONE :
|
||||
MODULE_TYPE_COUNT - 1,
|
||||
EE_MODEL,
|
||||
isExternalModuleAvailable);
|
||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isExternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
// TODO this code should be common, in module.h (X10_new_UI branch)
|
||||
memclear(&g_model.moduleData[EXTERNAL_MODULE], sizeof(ModuleData));
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = moduleType;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(EXTERNAL_MODULE);
|
||||
if (isModuleSBUS(EXTERNAL_MODULE))
|
||||
g_model.moduleData[EXTERNAL_MODULE].sbus.refreshRate = -31;
|
||||
if (isModulePPM(EXTERNAL_MODULE))
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(EXTERNAL_MODULE);
|
||||
setModuleType(EXTERNAL_MODULE, moduleType);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1078,7 +1074,7 @@ void menuModelSetup(event_t event)
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, moduleData.channelsCount, -4, min<int8_t>(maxModuleChannels_M8(moduleIdx), 32-8-moduleData.channelsStart), moduleData.type == MODULE_TYPE_ISRM_PXX2 ? isPxx2IsrmChannelsCountAllowed : nullptr);
|
||||
if (checkIncDec_Ret && moduleData.type == MODULE_TYPE_PPM) {
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
|
||||
setDefaultPpmFrameLength(moduleIdx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1538,7 +1534,6 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
case ITEM_MODEL_SETUP_PPM2_PROTOCOL:
|
||||
lcdDrawTextAlignedLeft(y, "Port2");
|
||||
@@ -1551,11 +1546,11 @@ void menuModelSetup(event_t event)
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[1].channelsStart, 32-8-g_model.moduleData[1].channelsCount);
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(1);
|
||||
setDefaultPpmFrameLength(1);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[1].channelsCount, -4, min<int8_t>(8, 32-8-g_model.moduleData[1].channelsStart));
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(1);
|
||||
setDefaultPpmFrameLength(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1588,7 +1583,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
|
||||
#if defined(PXX)
|
||||
if (IS_RANGECHECK_ENABLE()) {
|
||||
if (isModuleInRangeCheckMode()) {
|
||||
showMessageBox("RSSI: ");
|
||||
lcdDrawNumber(WARNING_LINE_X, 5*FH, TELEMETRY_RSSI(), BOLD);
|
||||
}
|
||||
|
||||
@@ -54,28 +54,25 @@ enum MenuModelTelemetryFrskyItems {
|
||||
|
||||
#define TELEM_COL3 (17 * FW)
|
||||
|
||||
#define CHANNELS_ROWS
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), SENSOR_ROWS(32), SENSOR_ROWS(33), SENSOR_ROWS(34), SENSOR_ROWS(35), SENSOR_ROWS(36), SENSOR_ROWS(37), SENSOR_ROWS(38), SENSOR_ROWS(39), 0, 0, 0, 0,
|
||||
|
||||
#define USRDATA_ROWS
|
||||
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0, 1,
|
||||
|
||||
#define SCREEN_TYPE_ROWS 0
|
||||
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
|
||||
|
||||
#if defined (PCBTARANIS)
|
||||
#define TELEMETRY_TYPE_SHOW_TELEMETRY (! IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0, 0,
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), SENSOR_ROWS(32), SENSOR_ROWS(33), SENSOR_ROWS(34), SENSOR_ROWS(35), SENSOR_ROWS(36), SENSOR_ROWS(37), SENSOR_ROWS(38), SENSOR_ROWS(39), 0, 0, 0, 0,
|
||||
#if defined(VARIO)
|
||||
#define VARIO_ROWS LABEL(Vario), 0, 1, 2,
|
||||
#else
|
||||
#define TELEMETRY_TYPE_SHOW_TELEMETRY (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#define VARIO_ROWS
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#define TELEMETRY_TYPE_ROW (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#else
|
||||
#define TELEMETRY_TYPE_ROW (g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW
|
||||
#endif
|
||||
|
||||
#if defined(REVX)
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_SHOW_TELEMETRY, TELEMETRY_TYPE_SHOW_TELEMETRY,
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_ROW, TELEMETRY_TYPE_ROW,
|
||||
#else
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_SHOW_TELEMETRY,
|
||||
#define TELEMETRY_TYPE_ROWS TELEMETRY_TYPE_ROW,
|
||||
#endif
|
||||
|
||||
void onSensorMenu(const char * result)
|
||||
@@ -121,13 +118,13 @@ void onDeleteAllSensorsConfirm(const char * result)
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelTelemetryFrsky(event_t event)
|
||||
void menuModelTelemetry(event_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_TYPE_ROWS CHANNELS_ROWS RSSI_ROWS SENSORS_ROWS USRDATA_ROWS VARIO_ROWS});
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
|
||||
|
||||
uint8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
for (uint8_t i=0; i<LCD_LINES-1; i++) {
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
@@ -200,7 +197,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_DISCOVER_SENSORS:
|
||||
lcdDrawText(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||
lcdDrawText(INDENT_WIDTH, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
allowNewSensors = !allowNewSensors;
|
||||
@@ -223,7 +220,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
|
||||
lcdDrawText(0, y, STR_DELETE_ALL_SENSORS, attr);
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_DELETE_ALL_SENSORS, attr);
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
@@ -237,7 +234,6 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
ON_OFF_MENU_ITEM(g_model.ignoreSensorIds, TELEM_COL2, y, STR_IGNORE_INSTANCE, attr, event);
|
||||
break;
|
||||
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
#if defined(MULTIMODULE)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MODULE_SUBTYPE_MULTI_FS_AFHDS2A)
|
||||
|
||||
@@ -529,7 +529,7 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(GPS)
|
||||
#if defined(GPS)
|
||||
case ITEM_RADIO_SETUP_TIMEZONE:
|
||||
lcdDrawTextAlignedLeft(y, STR_TIMEZONE);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.timezone, attr|LEFT);
|
||||
|
||||
@@ -47,15 +47,12 @@
|
||||
#define TRIM_LH_POS (TRIM_LH_X-4*FW)
|
||||
#define TRIM_RH_NEG (TRIM_RH_X+1*FW)
|
||||
#define TRIM_RH_POS (TRIM_RH_X-4*FW)
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
#define RSSSI_X (30)
|
||||
#define RSSSI_Y (31)
|
||||
#define RSSI_MAX 105
|
||||
#endif
|
||||
|
||||
#define TRIM_LEN 23
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
void drawRSSIGauge()
|
||||
{
|
||||
uint8_t bar = (RSSI_MAX - g_model.rssiAlarms.getWarningRssi()) / 4;
|
||||
@@ -66,7 +63,6 @@ void drawRSSIGauge()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void drawPotsBars()
|
||||
{
|
||||
@@ -276,15 +272,11 @@ void onMainViewMenu(const char *result)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER1);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER2);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TIMER3);
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET_TELEMETRY);
|
||||
#endif
|
||||
}
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
else if (result == STR_RESET_TELEMETRY) {
|
||||
telemetryReset();
|
||||
}
|
||||
#endif
|
||||
else if (result == STR_RESET_FLIGHT) {
|
||||
flightReset();
|
||||
}
|
||||
@@ -385,11 +377,7 @@ void menuMainView(event_t event)
|
||||
#endif
|
||||
|
||||
case EVT_KEY_TELEMETRY:
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
chainMenu(menuViewTelemetryFrsky);
|
||||
#else
|
||||
chainMenu(menuStatisticsDebug);
|
||||
#endif
|
||||
killEvents(event);
|
||||
break;
|
||||
|
||||
@@ -419,12 +407,10 @@ void menuMainView(event_t event)
|
||||
// Trims sliders
|
||||
displayTrims(mode);
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
// RSSI gauge
|
||||
if (TELEMETRY_RSSI() > 0) {
|
||||
drawRSSIGauge();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (view_base < VIEW_INPUTS) {
|
||||
|
||||
@@ -184,18 +184,18 @@ void menuStatisticsDebug(event_t event)
|
||||
|
||||
#if defined(COPROCESSOR)
|
||||
lcdDrawTextAlignedLeft(y, STR_COPROC_TEMP);
|
||||
if (Coproc_read==0) {
|
||||
if (coprocData.read==0) {
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS, y, "Co Proc NACK",INVERS);
|
||||
}
|
||||
else if (Coproc_read==0x81) {
|
||||
else if (coprocData.read==0x81) {
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS, y, "Inst.TinyApp",INVERS);
|
||||
}
|
||||
else if (Coproc_read<3) {
|
||||
else if (coprocData.read<3) {
|
||||
lcdDrawText(MENU_DEBUG_COL1_OFS, y, "Upgr.TinyApp",INVERS);
|
||||
}
|
||||
else {
|
||||
drawValueWithUnit(MENU_DEBUG_COL1_OFS, y, Coproc_temp, UNIT_TEMPERATURE, LEFT);
|
||||
drawValueWithUnit(MENU_DEBUG_COL2_OFS, y, Coproc_maxtemp, UNIT_TEMPERATURE, LEFT);
|
||||
drawValueWithUnit(MENU_DEBUG_COL1_OFS, y, coprocData.temp, UNIT_TEMPERATURE, LEFT);
|
||||
drawValueWithUnit(MENU_DEBUG_COL2_OFS, y, coprocData.maxtemp, UNIT_TEMPERATURE, LEFT);
|
||||
}
|
||||
y += FH;
|
||||
#endif
|
||||
|
||||
@@ -170,7 +170,6 @@ void lcdDrawBitmap(coord_t x, coord_t y, const uint8_t * img, coord_t offset=0,
|
||||
void lcdClear();
|
||||
|
||||
uint8_t * lcdLoadBitmap(uint8_t * dest, const char * filename, uint16_t width, uint16_t height);
|
||||
const char * writeScreenshot();
|
||||
|
||||
#if defined(BOOT)
|
||||
#define BLINK_ON_PHASE (0)
|
||||
|
||||
@@ -37,7 +37,7 @@ const MenuHandlerFunc menuTabModel[] = {
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
menuModelCustomScripts,
|
||||
#endif
|
||||
CASE_FRSKY(menuModelTelemetryFrsky)
|
||||
menuModelTelemetry,
|
||||
menuModelDisplay
|
||||
};
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ enum MenuModelIndexes {
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
MENU_MODEL_CUSTOM_SCRIPTS,
|
||||
#endif
|
||||
MENU_MODEL_TELEMETRY_FRSKY,
|
||||
MENU_MODEL_TELEMETRY,
|
||||
MENU_MODEL_DISPLAY,
|
||||
MENU_MODEL_PAGES_COUNT
|
||||
};
|
||||
@@ -117,7 +117,7 @@ void menuModelGVars(event_t event);
|
||||
void menuModelLogicalSwitches(event_t event);
|
||||
void menuModelSpecialFunctions(event_t event);
|
||||
void menuModelCustomScripts(event_t event);
|
||||
void menuModelTelemetryFrsky(event_t event);
|
||||
void menuModelTelemetry(event_t event);
|
||||
void menuModelSensor(event_t event);
|
||||
void menuModelDisplay(event_t event);
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
|
||||
@@ -246,7 +246,7 @@ void editTimerCountdown(int timerIdx, coord_t y, LcdFlags attr, event_t event)
|
||||
|
||||
#define TIMER_ROWS(x) 2|NAVIGATION_LINE_BY_LINE, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t) 1 : (uint8_t)0
|
||||
|
||||
inline uint8_t EXTERNAL_MODULE_MODE_ROW()
|
||||
inline uint8_t EXTERNAL_MODULE_TYPE_ROW()
|
||||
{
|
||||
if (isModuleXJT(EXTERNAL_MODULE) || isModuleR9MNonAccess(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE))
|
||||
return 1;
|
||||
@@ -363,7 +363,7 @@ void menuModelSetup(event_t event)
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), // Receiver 3
|
||||
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_MODE_ROW(),
|
||||
EXTERNAL_MODULE_TYPE_ROW(),
|
||||
MULTIMODULE_STATUS_ROWS
|
||||
EXTERNAL_MODULE_CHANNELS_ROWS,
|
||||
IF_NOT_ACCESS_MODULE_RF(EXTERNAL_MODULE, EXTERNAL_MODULE_BIND_ROWS),
|
||||
@@ -763,10 +763,7 @@ void menuModelSetup(event_t event)
|
||||
if (menuHorizontalPosition == 0) {
|
||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isInternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
// TODO this code should be common, in module.h (X10_new_UI branch)
|
||||
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
|
||||
g_model.moduleData[INTERNAL_MODULE].type = moduleType;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
|
||||
setModuleType(INTERNAL_MODULE, moduleType);
|
||||
}
|
||||
}
|
||||
else if (isModuleXJT(INTERNAL_MODULE)) {
|
||||
@@ -821,15 +818,15 @@ void menuModelSetup(event_t event)
|
||||
|
||||
// Do not use MODEL_SETUP_3RD_COLUMN here since some the protocol string are so long that we cannot afford the 2 spaces (+6) here
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].multi.customProto) {
|
||||
lcdDrawText(lcdNextPos + FW, y, STR_MULTI_CUSTOM, menuHorizontalPosition == 1 ? attr : 0);
|
||||
lcdDrawNumber(lcdNextPos + FW, y, g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false), menuHorizontalPosition == 2 ? attr : 0, 2);
|
||||
lcdDrawNumber(lcdNextPos + FW, y, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition == 3 ? attr : 0, 2);
|
||||
lcdDrawText(lcdNextPos + 3, y, STR_MULTI_CUSTOM, menuHorizontalPosition == 1 ? attr : 0);
|
||||
lcdDrawNumber(lcdNextPos + 3, y, g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false), menuHorizontalPosition == 2 ? attr : 0, 2);
|
||||
lcdDrawNumber(lcdNextPos + 3, y, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition == 3 ? attr : 0, 2);
|
||||
}
|
||||
else {
|
||||
lcdDrawTextAtIndex(lcdNextPos + FW, y, STR_MULTI_PROTOCOLS, multi_rfProto, menuHorizontalPosition==1 ? attr : 0);
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, STR_MULTI_PROTOCOLS, multi_rfProto, menuHorizontalPosition==1 ? attr : 0);
|
||||
const mm_protocol_definition * pdef = getMultiProtocolDefinition(multi_rfProto);
|
||||
if (pdef->subTypeString) {
|
||||
lcdDrawTextAtIndex(lcdNextPos + FW, y, pdef->subTypeString, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
|
||||
lcdDrawTextAtIndex(lcdNextPos + 3, y, pdef->subTypeString, g_model.moduleData[EXTERNAL_MODULE].subType, menuHorizontalPosition==2 ? attr : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -838,19 +835,14 @@ void menuModelSetup(event_t event)
|
||||
if (s_editMode > 0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE,
|
||||
IS_TRAINER_EXTERNAL_MODULE() ? MODULE_TYPE_NONE : MODULE_TYPE_COUNT - 1, EE_MODEL,
|
||||
isExternalModuleAvailable);
|
||||
{
|
||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isExternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(EXTERNAL_MODULE);
|
||||
if (isModuleSBUS(EXTERNAL_MODULE))
|
||||
g_model.moduleData[EXTERNAL_MODULE].sbus.refreshRate = -31;
|
||||
if (isModulePPM(EXTERNAL_MODULE))
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(EXTERNAL_MODULE);
|
||||
setModuleType(EXTERNAL_MODULE, moduleType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
if (isModuleDSM2(EXTERNAL_MODULE))
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, DSM2_PROTO_LP45, DSM2_PROTO_DSMX);
|
||||
@@ -1041,7 +1033,7 @@ void menuModelSetup(event_t event)
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, moduleData.channelsCount, -4, min<int8_t>(maxModuleChannels_M8(moduleIdx), 32-8-moduleData.channelsStart), moduleData.type == MODULE_TYPE_ISRM_PXX2 ? isPxx2IsrmChannelsCountAllowed : nullptr);
|
||||
if (checkIncDec_Ret && moduleData.type == MODULE_TYPE_PPM) {
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
|
||||
setDefaultPpmFrameLength(moduleIdx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1409,7 +1401,7 @@ void menuModelSetup(event_t event)
|
||||
}
|
||||
|
||||
#if defined(PXX)
|
||||
if (IS_RANGECHECK_ENABLE()) {
|
||||
if (isModuleInRangeCheckMode()) {
|
||||
showMessageBox("RSSI: ");
|
||||
lcdDrawNumber(WARNING_LINE_X, 5*FH, TELEMETRY_RSSI(), BOLD | LEFT);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
enum MenuModelTelemetryFrskyItems {
|
||||
ITEM_TELEMETRY_PROTOCOL_TYPE,
|
||||
ITEM_TELEMETRY_RSSI_LABEL,
|
||||
ITEM_TELEMETRY_RSSI_SOURCE,
|
||||
ITEM_TELEMETRY_RSSI_ALARM1,
|
||||
ITEM_TELEMETRY_RSSI_ALARM2,
|
||||
ITEM_TELEMETRY_DISABLE_ALARMS,
|
||||
@@ -45,6 +46,7 @@ enum MenuModelTelemetryFrskyItems {
|
||||
#define TELEM_COL2 (16*FW)
|
||||
#define TELEM_COL3 (30*FW+2)
|
||||
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0, 0,
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), SENSOR_ROWS(31), SENSOR_ROWS(32), SENSOR_ROWS(33), SENSOR_ROWS(34), SENSOR_ROWS(35), SENSOR_ROWS(36), SENSOR_ROWS(37), SENSOR_ROWS(38), SENSOR_ROWS(39), SENSOR_ROWS(40), SENSOR_ROWS(41), SENSOR_ROWS(42), SENSOR_ROWS(43), SENSOR_ROWS(44), SENSOR_ROWS(45), SENSOR_ROWS(46), SENSOR_ROWS(47), SENSOR_ROWS(48), SENSOR_ROWS(49), SENSOR_ROWS(50), SENSOR_ROWS(51), SENSOR_ROWS(52), SENSOR_ROWS(53), SENSOR_ROWS(54), SENSOR_ROWS(55), SENSOR_ROWS(56), SENSOR_ROWS(57), SENSOR_ROWS(58), SENSOR_ROWS(59), 0, 0, 0, 0,
|
||||
#if defined(VARIO)
|
||||
@@ -52,12 +54,11 @@ enum MenuModelTelemetryFrskyItems {
|
||||
#else
|
||||
#define VARIO_ROWS
|
||||
#endif
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0,
|
||||
#define TELEMETRY_TYPE_ROWS (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
|
||||
void onSensorMenu(const char * result)
|
||||
{
|
||||
uint8_t index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR_FIRST;
|
||||
uint8_t index = menuVerticalPosition - HEADER_LINE - ITEM_TELEMETRY_SENSOR_FIRST;
|
||||
|
||||
if (index < MAX_TELEMETRY_SENSORS) {
|
||||
if (result == STR_EDIT) {
|
||||
@@ -69,11 +70,10 @@ void onSensorMenu(const char * result)
|
||||
if (index<MAX_TELEMETRY_SENSORS && isTelemetryFieldAvailable(index))
|
||||
menuVerticalPosition += 1;
|
||||
else
|
||||
menuVerticalPosition = ITEM_TELEMETRY_NEW_SENSOR;
|
||||
menuVerticalPosition = HEADER_LINE + ITEM_TELEMETRY_NEW_SENSOR;
|
||||
}
|
||||
else if (result == STR_COPY) {
|
||||
int newIndex = availableTelemetryIndex();
|
||||
|
||||
if (newIndex >= 0) {
|
||||
TelemetrySensor & sourceSensor = g_model.telemetrySensors[index];
|
||||
TelemetrySensor & newSensor = g_model.telemetrySensors[newIndex];
|
||||
@@ -90,27 +90,35 @@ void onSensorMenu(const char * result)
|
||||
}
|
||||
}
|
||||
|
||||
void menuModelTelemetryFrsky(event_t event)
|
||||
void onDeleteAllSensorsConfirm(const char * result)
|
||||
{
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
if (result == STR_OK) {
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
|
||||
void menuModelTelemetry(event_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, menuTabModel, MENU_MODEL_TELEMETRY, HEADER_LINE+ITEM_TELEMETRY_MAX, { HEADER_LINE_COLUMNS TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
|
||||
|
||||
uint8_t sub = menuVerticalPosition - HEADER_LINE;
|
||||
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_HEADER_HEIGHT + 1 + i*FH;
|
||||
int k = i + menuVerticalOffset;
|
||||
uint8_t k = i + menuVerticalOffset;
|
||||
for (int j=0; j<=k; j++) {
|
||||
if (mstate_tab[j] == HIDDEN_ROW)
|
||||
k++;
|
||||
if (mstate_tab[j+HEADER_LINE] == HIDDEN_ROW) {
|
||||
if (++k >= (int)DIM(mstate_tab)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (menuVerticalPosition == k ? blink : 0);
|
||||
LcdFlags attr = (sub == k ? blink : 0);
|
||||
|
||||
|
||||
if (k >= ITEM_TELEMETRY_SENSOR_FIRST && k <= ITEM_TELEMETRY_SENSOR_LAST) {
|
||||
int index = k - ITEM_TELEMETRY_SENSOR_FIRST;
|
||||
@@ -124,9 +132,11 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
if (telemetryItem.isAvailable()) {
|
||||
bool isOld = telemetryItem.isOld();
|
||||
lcdNextPos = TELEM_COL2;
|
||||
if (isOld) lcdDrawChar(lcdNextPos, y, '[');
|
||||
if (isOld)
|
||||
lcdDrawChar(lcdNextPos, y, '[');
|
||||
drawSensorCustomValue(lcdNextPos, y, index, getValue(MIXSRC_FIRST_TELEM+3*index), LEFT);
|
||||
if (isOld) lcdDrawChar(lcdLastRightPos, y, ']');
|
||||
if (isOld)
|
||||
lcdDrawChar(lcdLastRightPos, y, ']');
|
||||
}
|
||||
else {
|
||||
lcdDrawText(TELEM_COL2, y, "---", 0); // TODO shortcut
|
||||
@@ -164,7 +174,9 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
case ITEM_TELEMETRY_PROTOCOL_TYPE:
|
||||
lcdDrawTextAlignedLeft(y, STR_TELEMETRY_TYPE);
|
||||
lcdDrawTextAtIndex(TELEM_COL2, y, STR_TELEMETRY_PROTOCOLS, g_model.telemetryProtocol, attr);
|
||||
g_model.telemetryProtocol = checkIncDec(event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable);
|
||||
if (attr) {
|
||||
g_model.telemetryProtocol = checkIncDec(event, g_model.telemetryProtocol, PROTOCOL_TELEMETRY_FIRST, PROTOCOL_TELEMETRY_LAST, EE_MODEL, isTelemetryProtocolAvailable);
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_SENSORS_LABEL:
|
||||
@@ -176,7 +188,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_DISCOVER_SENSORS:
|
||||
lcdDrawText(0, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||
lcdDrawText(INDENT_WIDTH, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
allowNewSensors = !allowNewSensors;
|
||||
@@ -199,12 +211,13 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
|
||||
lcdDrawText(0, y, STR_DELETE_ALL_SENSORS, attr);
|
||||
if (attr)
|
||||
lcdDrawText(INDENT_WIDTH, y, STR_DELETE_ALL_SENSORS, attr);
|
||||
if (attr) {
|
||||
s_editMode = 0;
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE, nullptr);
|
||||
if (event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE, onDeleteAllSensorsConfirm);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -214,17 +227,32 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_LABEL:
|
||||
#if defined(MULTIMODULE)
|
||||
if (g_model.moduleData[INTERNAL_MODULE].type != MODULE_TYPE_XJT_PXX1 &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_MULTIMODULE &&
|
||||
g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MODULE_SUBTYPE_MULTI_FS_AFHDS2A)
|
||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_MULTIMODULE && g_model.moduleData[EXTERNAL_MODULE].getMultiProtocol(false) == MODULE_SUBTYPE_MULTI_FS_AFHDS2A)
|
||||
lcdDrawTextAlignedLeft(y, "RSNR");
|
||||
else
|
||||
#endif
|
||||
lcdDrawTextAlignedLeft(y, "RSSI");
|
||||
#else
|
||||
lcdDrawTextAlignedLeft(y, "RSSI");
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_SOURCE: {
|
||||
lcdDrawTextAlignedLeft(y, INDENT TR_SOURCE);
|
||||
drawSource(TELEM_COL2, y, g_model.rssiSource ? MIXSRC_FIRST_TELEM + 3 * (g_model.rssiSource - 1) : 0, attr);
|
||||
if (g_model.rssiSource) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[g_model.rssiSource - 1];
|
||||
lcdDrawText(lcdNextPos, y, " ", attr);
|
||||
drawReceiverName(lcdNextPos, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, attr);
|
||||
}
|
||||
if (attr) {
|
||||
g_model.rssiSource = checkIncDec(event, g_model.rssiSource, 0, MAX_TELEMETRY_SENSORS, EE_MODEL | NO_INCDEC_MARKS, isRssiSensorAvailable);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2:
|
||||
{
|
||||
bool warning = (k==ITEM_TELEMETRY_RSSI_ALARM1);
|
||||
lcdDrawTextAlignedLeft(y, (warning ? STR_LOWALARM : STR_CRITICALALARM));
|
||||
lcdDrawNumber(TELEM_COL2, y, warning? g_model.rssiAlarms.getWarningRssi() : g_model.rssiAlarms.getCriticalRssi(), LEFT|attr, 3);
|
||||
@@ -236,6 +264,7 @@ void menuModelTelemetryFrsky(event_t event)
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_TELEMETRY_DISABLE_ALARMS:
|
||||
g_model.rssiAlarms.disabled = editCheckBox(g_model.rssiAlarms.disabled, TELEM_COL3, y, STR_DISABLE_ALARM, attr, event);
|
||||
break;
|
||||
|
||||
@@ -159,13 +159,13 @@ void menuRadioSetup(event_t event)
|
||||
CASE_SPLASH_PARAM(0) // disable splash
|
||||
CASE_PWR_BUTTON_PRESS(0) // pwr on speed
|
||||
CASE_PWR_BUTTON_PRESS(0) // pwr off speed
|
||||
CASE_PXX2(0)
|
||||
CASE_PXX2(0) // owner registration ID
|
||||
CASE_GPS(LABEL(GPS))
|
||||
CASE_GPS(0) // timezone
|
||||
CASE_GPS(0) // adjust RTC
|
||||
CASE_GPS(0) // GPS format
|
||||
CASE_PXX1(0) // country code
|
||||
0, // language
|
||||
CASE_PXX1(0) // country code
|
||||
0, // voice language
|
||||
0, // imperial
|
||||
IF_FAI_CHOICE(0)
|
||||
0, // switches delay
|
||||
@@ -484,7 +484,7 @@ void menuRadioSetup(event_t event)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(GPS)
|
||||
#if defined(GPS)
|
||||
case ITEM_RADIO_SETUP_LABEL_GPS:
|
||||
lcdDrawTextAlignedLeft(y, STR_GPS);
|
||||
break;
|
||||
|
||||
@@ -36,7 +36,7 @@ const MenuHandlerFunc menuTabModel[] = {
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
menuModelCustomScripts,
|
||||
#endif
|
||||
CASE_FRSKY(menuModelTelemetryFrsky)
|
||||
menuModelTelemetry
|
||||
};
|
||||
|
||||
void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlags attr);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#define _MENUS_H_
|
||||
|
||||
#include "keys.h"
|
||||
#include "audio.h"
|
||||
|
||||
#define MENU_COLUMN2_X 280
|
||||
#define MIXES_2ND_COLUMN 140
|
||||
@@ -106,6 +107,7 @@ enum MenuIcons {
|
||||
ICON_MONITOR_CHANNELS3,
|
||||
ICON_MONITOR_CHANNELS4,
|
||||
ICON_MONITOR_LOGICAL_SWITCHES,
|
||||
ICON_RADIO_SPECTRUM_ANALYSER,
|
||||
MENUS_ICONS_COUNT
|
||||
};
|
||||
|
||||
@@ -123,7 +125,7 @@ enum EnumTabModel {
|
||||
#if defined(LUA_MODEL_SCRIPTS)
|
||||
MENU_MODEL_CUSTOM_SCRIPTS,
|
||||
#endif
|
||||
CASE_FRSKY(MENU_MODEL_TELEMETRY_FRSKY)
|
||||
MENU_MODEL_TELEMETRY,
|
||||
MENU_MODEL_PAGES_COUNT
|
||||
};
|
||||
|
||||
@@ -177,7 +179,7 @@ bool menuModelGVars(event_t event);
|
||||
bool menuModelLogicalSwitches(event_t event);
|
||||
bool menuModelSpecialFunctions(event_t event);
|
||||
bool menuModelCustomScripts(event_t event);
|
||||
bool menuModelTelemetryFrsky(event_t event);
|
||||
bool menuModelTelemetry(event_t event);
|
||||
bool menuModelSensor(event_t event);
|
||||
bool menuModelExpoOne(event_t event);
|
||||
bool menuModelModuleOptions(event_t event);
|
||||
@@ -330,7 +332,7 @@ extern const CheckIncDecStops &stopsSwitch;
|
||||
(val), (val+1)
|
||||
|
||||
int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_flags=0, IsValueAvailable isValueAvailable=NULL, const CheckIncDecStops &stops=stops100);
|
||||
swsrc_t checkIncDecMovedSwitch(swsrc_t val);
|
||||
|
||||
#define checkIncDecModel(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_MODEL)
|
||||
#define checkIncDecModelZero(event, i_val, i_max) checkIncDec(event, i_val, 0, i_max, EE_MODEL)
|
||||
#define checkIncDecGen(event, i_val, i_min, i_max) checkIncDec(event, i_val, i_min, i_max, EE_GENERAL)
|
||||
@@ -438,11 +440,15 @@ void editCurveRef(coord_t x, coord_t y, CurveRef & curve, event_t event, LcdFlag
|
||||
|
||||
extern uint8_t s_curveChan;
|
||||
|
||||
#define WARNING_TYPE_ALERT 0
|
||||
#define WARNING_TYPE_ASTERISK 1
|
||||
#define WARNING_TYPE_CONFIRM 2
|
||||
#define WARNING_TYPE_INPUT 3
|
||||
#define WARNING_TYPE_INFO 4
|
||||
enum
|
||||
{
|
||||
WARNING_TYPE_WAIT,
|
||||
WARNING_TYPE_INFO,
|
||||
WARNING_TYPE_ASTERISK,
|
||||
WARNING_TYPE_CONFIRM,
|
||||
WARNING_TYPE_INPUT,
|
||||
WARNING_TYPE_ALERT
|
||||
};
|
||||
|
||||
extern const char * warningText;
|
||||
extern const char * warningInfoText;
|
||||
@@ -480,23 +486,20 @@ void insertMix(uint8_t idx);
|
||||
#define WARNING_INFOLINE_Y (WARNING_LINE_Y+68)
|
||||
|
||||
void copySelection(char * dst, const char * src, uint8_t size);
|
||||
|
||||
void drawPopupBackgroundAndBorder(coord_t x, coord_t y, coord_t w, coord_t h);
|
||||
void showMessageBox(const char * title);
|
||||
void runPopupWarning(event_t event);
|
||||
|
||||
extern void (* popupFunc)(event_t event);
|
||||
typedef void (* PopupFunc)(event_t event);
|
||||
extern PopupFunc popupFunc;
|
||||
|
||||
extern uint8_t warningInfoFlags;
|
||||
|
||||
#define DISPLAY_WARNING(evt) (*popupFunc)(evt)
|
||||
#define POPUP_INFORMATION(s) (warningText = s, warningType = WARNING_TYPE_INFO, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_WARNING(s) (warningType = WARNING_TYPE_ASTERISK, warningText = s, warningInfoText = 0, popupFunc = runPopupWarning)
|
||||
#define POPUP_INPUT(s, func) (warningText = s, popupFunc = func)
|
||||
#define SET_WARNING_INFO(info, len, flags) (warningInfoText = info, warningInfoLength = len, warningInfoFlags = flags)
|
||||
inline void DISPLAY_WARNING(event_t event)
|
||||
{
|
||||
(*popupFunc)(event);
|
||||
}
|
||||
|
||||
#define POPUP_MENU_ADD_ITEM(s) do { popupMenuOffsetType = MENU_OFFSET_INTERNAL; if (popupMenuItemsCount < POPUP_MENU_MAX_LINES) popupMenuItems[popupMenuItemsCount++] = s; } while (0)
|
||||
#define POPUP_MENU_SELECT_ITEM(s) popupMenuSelectedItem = (s > 0 ? (s < popupMenuItemsCount ? s : popupMenuItemsCount - 1) : 0)
|
||||
#define POPUP_MENU_START(func) do { popupMenuHandler = (func); AUDIO_KEY_PRESS(); } while(0)
|
||||
#define POPUP_MENU_MAX_LINES 12
|
||||
#define MENU_MAX_DISPLAY_LINES 9
|
||||
#define MENU_LINE_LENGTH (LEN_MODEL_NAME+12)
|
||||
@@ -511,7 +514,71 @@ enum {
|
||||
extern uint8_t popupMenuOffsetType;
|
||||
extern uint8_t popupMenuSelectedItem;
|
||||
const char * runPopupMenu(event_t event);
|
||||
extern void (*popupMenuHandler)(const char * result);
|
||||
|
||||
typedef void (* PopupMenuHandler)(const char * result);
|
||||
extern PopupMenuHandler popupMenuHandler;
|
||||
|
||||
inline void POPUP_INPUT(const char * s, PopupFunc func)
|
||||
{
|
||||
warningText = s;
|
||||
warningInfoText = nullptr;
|
||||
warningType = WARNING_TYPE_INPUT;
|
||||
popupFunc = func;
|
||||
}
|
||||
|
||||
inline void SET_WARNING_INFO(const char * info, uint8_t length, uint8_t flags)
|
||||
{
|
||||
warningInfoText = info;
|
||||
warningInfoLength = length;
|
||||
warningInfoFlags = flags;
|
||||
}
|
||||
|
||||
inline void POPUP_MENU_ADD_ITEM(const char * s)
|
||||
{
|
||||
popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
if (popupMenuItemsCount < POPUP_MENU_MAX_LINES)
|
||||
popupMenuItems[popupMenuItemsCount++] = s;
|
||||
}
|
||||
|
||||
inline void POPUP_MENU_SELECT_ITEM(uint8_t index)
|
||||
{
|
||||
popupMenuSelectedItem = (index > 0 ? (index < popupMenuItemsCount ? index : popupMenuItemsCount - 1) : 0);
|
||||
}
|
||||
|
||||
inline void POPUP_MENU_START(PopupMenuHandler handler)
|
||||
{
|
||||
popupMenuHandler = handler;
|
||||
AUDIO_KEY_PRESS();
|
||||
}
|
||||
|
||||
inline void CLEAR_POPUP()
|
||||
{
|
||||
warningText = nullptr;
|
||||
}
|
||||
|
||||
inline void POPUP_WAIT(const char * s)
|
||||
{
|
||||
warningText = s;
|
||||
warningInfoText = nullptr;
|
||||
warningType = WARNING_TYPE_WAIT;
|
||||
popupFunc = runPopupWarning;
|
||||
}
|
||||
|
||||
inline void POPUP_INFORMATION(const char * s)
|
||||
{
|
||||
warningText = s;
|
||||
warningInfoText = nullptr;
|
||||
warningType = WARNING_TYPE_INFO;
|
||||
popupFunc = runPopupWarning;
|
||||
}
|
||||
|
||||
inline void POPUP_WARNING(const char * s)
|
||||
{
|
||||
warningText = s;
|
||||
warningInfoText = nullptr;
|
||||
warningType = WARNING_TYPE_ASTERISK;
|
||||
popupFunc = runPopupWarning;
|
||||
}
|
||||
|
||||
inline void POPUP_CONFIRMATION(const char *s, void (* confirmHandler)(const char *) = nullptr)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
|
||||
@@ -178,7 +178,6 @@ bool menuModelExpoOne(event_t event)
|
||||
|
||||
SUBMENU_WITH_OPTIONS(STR_MENUINPUTS, ICON_MODEL_INPUTS, EXPO_FIELD_MAX, OPTION_MENU_NO_FOOTER|OPTION_MENU_NO_SCROLLBAR, { 0, 0, 0, (ed->srcRaw >= MIXSRC_FIRST_TELEM ? (uint8_t)0 : (uint8_t)HIDDEN_ROW), 0, 0, CURVE_ROWS, CASE_FLIGHT_MODES((MAX_FLIGHT_MODES-1) | NAVIGATION_LINE_BY_LINE) 0 /*, ...*/});
|
||||
lcdDrawSizedText(50, 3+FH, g_model.inputNames[ed->chn], LEN_INPUT_NAME, ZCHAR|MENU_TITLE_COLOR);
|
||||
lcdDrawSolidFilledRect(0, MENU_FOOTER_TOP, 230, MENU_FOOTER_HEIGHT, HEADER_BGCOLOR);
|
||||
|
||||
int sub = menuVerticalPosition;
|
||||
|
||||
@@ -241,7 +240,8 @@ bool menuModelExpoOne(event_t event)
|
||||
case EXPO_FIELD_SOURCE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_SOURCE);
|
||||
drawSource(EXPO_ONE_2ND_COLUMN, y, ed->srcRaw, menuHorizontalPosition==0 ? attr : 0);
|
||||
if (attr && menuHorizontalPosition==0) ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isInputSourceAvailable);
|
||||
if (attr && menuHorizontalPosition==0)
|
||||
ed->srcRaw = checkIncDec(event, ed->srcRaw, INPUTSRC_FIRST, INPUTSRC_LAST, EE_MODEL|INCDEC_SOURCE|NO_INCDEC_MARKS, isInputSourceAvailable);
|
||||
if (ed->srcRaw >= MIXSRC_FIRST_TELEM) {
|
||||
drawSensorCustomValue(EXPO_ONE_2ND_COLUMN+75, y, (ed->srcRaw - MIXSRC_FIRST_TELEM)/3, convertTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1, ed->scale), LEFT|(menuHorizontalPosition==1?attr:0));
|
||||
if (attr && menuHorizontalPosition == 1) ed->scale = checkIncDec(event, ed->scale, 0, maxTelemValue(ed->srcRaw - MIXSRC_FIRST_TELEM + 1), EE_MODEL);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
#include <math.h>
|
||||
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN 200
|
||||
|
||||
@@ -122,47 +122,22 @@ enum MenuModelSetupItems {
|
||||
#define MODEL_SETUP_SLIDPOT_SPACING 45
|
||||
|
||||
#define CURRENT_MODULE_EDITED(k) (k >= ITEM_MODEL_SETUP_EXTERNAL_MODULE_LABEL ? EXTERNAL_MODULE : INTERNAL_MODULE)
|
||||
#define CURRENT_RECEIVER_EDITED(k) (k - (k >= ITEM_MODEL_SETUP_EXTERNAL_MODULE_LABEL ? k : ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_1))
|
||||
#define CURRENT_RECEIVER_EDITED(k) (k - (k >= ITEM_MODEL_SETUP_EXTERNAL_MODULE_LABEL ? ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_1 : ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_1))
|
||||
|
||||
#include "common/stdlcd/model_setup_pxx1.cpp"
|
||||
|
||||
bool isPXX2ReceiverEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
return is_memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
}
|
||||
|
||||
void removePXX2Receiver(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
g_model.moduleData[moduleIdx].pxx2.receivers &= ~(1 << receiverIdx);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void removePXX2ReceiverIfEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
if (isPXX2ReceiverEmpty(moduleIdx, receiverIdx)) {
|
||||
removePXX2Receiver(moduleIdx, receiverIdx);
|
||||
}
|
||||
}
|
||||
|
||||
const char * STR_BIND_8CH_WITH_TELEM = TR("8CH with telem.", "8CH with telemetry");
|
||||
const char * STR_BIND_16CH_WITH_TELEM = TR("16CH with telem.", "16CH with telemetry");
|
||||
const char * STR_BIND_16CH_WITHOUT_TELEM = TR("16CH without telem.", "16CH without telemetry");
|
||||
const char * STR_BIND_FLEX_868 = "Flex 868MHz";
|
||||
const char * STR_BIND_FLEX_915 = "Flex 915MHz";
|
||||
|
||||
void onPXX2R9MBindModeMenu(const char * result)
|
||||
{
|
||||
if (result == STR_BIND_16CH_WITH_TELEM) {
|
||||
if (result == STR_16CH_WITH_TELEMETRY) {
|
||||
reusableBuffer.moduleSetup.bindInformation.lbtMode = 1;
|
||||
}
|
||||
else if (result == STR_BIND_16CH_WITHOUT_TELEM) {
|
||||
else if (result == STR_16CH_WITHOUT_TELEMETRY) {
|
||||
reusableBuffer.moduleSetup.bindInformation.lbtMode = 2;
|
||||
}
|
||||
else if (result == STR_BIND_FLEX_868) {
|
||||
else if (result == STR_FLEX_915) {
|
||||
reusableBuffer.moduleSetup.bindInformation.flexMode = 0;
|
||||
}
|
||||
else if (result == STR_BIND_FLEX_915) {
|
||||
else if (result == STR_FLEX_868) {
|
||||
reusableBuffer.moduleSetup.bindInformation.flexMode = 1;
|
||||
}
|
||||
else {
|
||||
@@ -170,6 +145,7 @@ void onPXX2R9MBindModeMenu(const char * result)
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition);
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
reusableBuffer.moduleSetup.bindInformation.step = 0;
|
||||
removePXX2ReceiverIfEmpty(moduleIdx, receiverIdx);
|
||||
return;
|
||||
}
|
||||
@@ -498,7 +474,7 @@ int getSwitchWarningsCount()
|
||||
|
||||
#define TIMER_ROWS(x) NAVIGATION_LINE_BY_LINE|1, 0, 0, 0, g_model.timers[x].countdownBeep != COUNTDOWN_SILENT ? (uint8_t)1 : (uint8_t)0
|
||||
|
||||
inline uint8_t EXTERNAL_MODULE_MODE_ROW()
|
||||
inline uint8_t EXTERNAL_MODULE_TYPE_ROW()
|
||||
{
|
||||
if (isModuleXJT(EXTERNAL_MODULE) || isModuleR9MNonAccess(EXTERNAL_MODULE) || isModuleDSM2(EXTERNAL_MODULE))
|
||||
return 1;
|
||||
@@ -533,24 +509,6 @@ inline uint8_t EXTERNAL_MODULE_MODE_ROW()
|
||||
#define REGISTRATION_ID_ROWS
|
||||
#endif
|
||||
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags)
|
||||
{
|
||||
if (isModulePXX2(moduleIdx)) {
|
||||
if (g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx][0] != '\0')
|
||||
lcdDrawSizedText(x, y, g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], effectiveLen(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME), flags);
|
||||
else
|
||||
lcdDrawText(x, y, "---", flags);
|
||||
}
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
else if (moduleIdx == INTERNAL_MODULE) {
|
||||
lcdDrawText(x, y, "Internal", flags);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
lcdDrawText(x, y, "External", flags);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(EXTERNAL_ANTENNA)
|
||||
#define ANTENNA_ROW IF_NOT_PXX2_MODULE(INTERNAL_MODULE, IF_INTERNAL_MODULE_ON(0)), // Antenna
|
||||
void onAntennaSwitchConfirm(const char * result)
|
||||
@@ -610,7 +568,7 @@ bool menuModelSetup(event_t event)
|
||||
IF_ACCESS_MODULE_RF(INTERNAL_MODULE, 0), /* Receiver 3 */
|
||||
|
||||
LABEL(ExternalModule),
|
||||
EXTERNAL_MODULE_MODE_ROW(),
|
||||
EXTERNAL_MODULE_TYPE_ROW(),
|
||||
MULTIMODULE_STATUS_ROWS
|
||||
EXTERNAL_MODULE_CHANNELS_ROWS,
|
||||
IF_NOT_ACCESS_MODULE_RF(EXTERNAL_MODULE, EXTERNAL_MODULE_BIND_ROWS),
|
||||
@@ -790,7 +748,8 @@ bool menuModelSetup(event_t event)
|
||||
case ITEM_MODEL_SETUP_THROTTLE_TRACE:
|
||||
{
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_TTRACE);
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO(event, g_model.thrTraceSrc, NUM_POTS+NUM_SLIDERS+MAX_OUTPUT_CHANNELS);
|
||||
// check if source is available (EXT1 & EXT2 on X10)
|
||||
if (attr) CHECK_INCDEC_MODELVAR_ZERO_CHECK(event, g_model.thrTraceSrc, NUM_POTS+NUM_SLIDERS+MAX_OUTPUT_CHANNELS, isThrottleSourceAvailable);
|
||||
uint8_t idx = g_model.thrTraceSrc + MIXSRC_Thr;
|
||||
if (idx > MIXSRC_Thr)
|
||||
idx += 1;
|
||||
@@ -992,10 +951,7 @@ bool menuModelSetup(event_t event)
|
||||
if (menuHorizontalPosition == 0) {
|
||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[INTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isInternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
// TODO this code should be common, in module.h (X10_new_UI branch)
|
||||
memclear(&g_model.moduleData[INTERNAL_MODULE], sizeof(ModuleData));
|
||||
g_model.moduleData[INTERNAL_MODULE].type = moduleType;
|
||||
g_model.moduleData[INTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(INTERNAL_MODULE);
|
||||
setModuleType(INTERNAL_MODULE, moduleType);
|
||||
}
|
||||
}
|
||||
else if (isModuleXJT(INTERNAL_MODULE)) {
|
||||
@@ -1062,19 +1018,14 @@ bool menuModelSetup(event_t event)
|
||||
if (s_editMode > 0) {
|
||||
switch (menuHorizontalPosition) {
|
||||
case 0:
|
||||
g_model.moduleData[EXTERNAL_MODULE].type = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type,
|
||||
MODULE_TYPE_NONE, MODULE_TYPE_COUNT - 1, EE_MODEL,
|
||||
isExternalModuleAvailable);
|
||||
{
|
||||
uint8_t moduleType = checkIncDec(event, g_model.moduleData[EXTERNAL_MODULE].type, MODULE_TYPE_NONE, MODULE_TYPE_MAX, EE_MODEL, isExternalModuleAvailable);
|
||||
if (checkIncDec_Ret) {
|
||||
g_model.moduleData[EXTERNAL_MODULE].rfProtocol = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsStart = 0;
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(EXTERNAL_MODULE);
|
||||
if (isModuleSBUS(EXTERNAL_MODULE))
|
||||
g_model.moduleData[EXTERNAL_MODULE].sbus.refreshRate = -31;
|
||||
if (isModulePPM(EXTERNAL_MODULE))
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(EXTERNAL_MODULE);
|
||||
setModuleType(EXTERNAL_MODULE, moduleType);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
if (isModuleDSM2(EXTERNAL_MODULE))
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[EXTERNAL_MODULE].rfProtocol, DSM2_PROTO_LP45, DSM2_PROTO_DSMX);
|
||||
@@ -1110,6 +1061,7 @@ bool menuModelSetup(event_t event)
|
||||
g_model.moduleData[EXTERNAL_MODULE].channelsCount = defaultModuleChannels_M8(EXTERNAL_MODULE);
|
||||
}
|
||||
break;
|
||||
|
||||
#if defined(MULTIMODULE)
|
||||
case 2:
|
||||
if (g_model.moduleData[EXTERNAL_MODULE].multi.customProto) {
|
||||
@@ -1172,7 +1124,7 @@ bool menuModelSetup(event_t event)
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR_CHECK(event, moduleData.channelsCount, -4, min<int8_t>(maxModuleChannels_M8(moduleIdx), 32-8-moduleData.channelsStart), moduleData.type == MODULE_TYPE_ISRM_PXX2 ? isPxx2IsrmChannelsCountAllowed : nullptr);
|
||||
if (checkIncDec_Ret && moduleData.type == MODULE_TYPE_PPM) {
|
||||
SET_DEFAULT_PPM_FRAME_LENGTH(moduleIdx);
|
||||
setDefaultPpmFrameLength(moduleIdx);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1282,6 +1234,7 @@ bool menuModelSetup(event_t event)
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_MODEL_NUM:
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_MODEL_NUM:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, STR_RECEIVER_NUM);
|
||||
@@ -1301,6 +1254,7 @@ bool menuModelSetup(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_REGISTER_RANGE:
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_REGISTER_RANGE:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, STR_MODULE);
|
||||
@@ -1339,6 +1293,9 @@ bool menuModelSetup(event_t event)
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_1:
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_2:
|
||||
case ITEM_MODEL_SETUP_INTERNAL_MODULE_PXX2_RECEIVER_3:
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_1:
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_2:
|
||||
case ITEM_MODEL_SETUP_EXTERNAL_MODULE_PXX2_RECEIVER_3:
|
||||
{
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(k);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(k);
|
||||
@@ -1346,60 +1303,72 @@ bool menuModelSetup(event_t event)
|
||||
|
||||
drawStringWithIndex(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, STR_RECEIVER, receiverIdx + 1);
|
||||
|
||||
if (!(g_model.moduleData[moduleIdx].pxx2.receivers & (1 << receiverIdx))) {
|
||||
if (!isPXX2ReceiverUsed(moduleIdx, receiverIdx)) {
|
||||
drawButton(MODEL_SETUP_2ND_COLUMN, y, STR_MODULE_BIND, attr);
|
||||
if (attr && s_editMode > 0) {
|
||||
s_editMode = 0;
|
||||
killEvents(event);
|
||||
g_model.moduleData[moduleIdx].pxx2.receivers |= (1 << receiverIdx);
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
setPXX2ReceiverUsed(moduleIdx, receiverIdx);
|
||||
memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
onPXX2ReceiverMenu(STR_BIND);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
drawReceiverName(MODEL_SETUP_2ND_COLUMN, y, moduleIdx, receiverIdx, attr);
|
||||
|
||||
if (s_editMode && isModuleR9MAccess(moduleIdx) && moduleState[moduleIdx].mode == MODULE_MODE_NORMAL && moduleInformation.information.modelID) {
|
||||
moduleInformation.information.modelID = 0;
|
||||
moduleState[moduleIdx].startBind(&reusableBuffer.moduleSetup.bindInformation);
|
||||
if (s_editMode && isModuleR9MAccess(moduleIdx) && moduleState[moduleIdx].mode == MODULE_MODE_NORMAL && reusableBuffer.moduleSetup.bindInformation.step < 0) {
|
||||
if (reusableBuffer.moduleSetup.bindInformation.step == BIND_MODULE_TX_INFORMATION_REQUEST && moduleInformation.information.modelID) {
|
||||
// For R9M ACCESS the module information has been requested to know if we are in EU mode. We just receive it here and continue
|
||||
if (moduleInformation.information.variant == PXX2_VARIANT_EU) {
|
||||
// In EU mode we will need the power of the module to know if telemetry can be proposed
|
||||
reusableBuffer.moduleSetup.bindInformation.step = BIND_MODULE_TX_SETTINGS_REQUEST;
|
||||
#if defined(SIMU)
|
||||
reusableBuffer.moduleSetup.pxx2.moduleSettings.txPower = 14;
|
||||
break;
|
||||
#else
|
||||
moduleState[moduleIdx].readModuleSettings(&reusableBuffer.moduleSetup.pxx2.moduleSettings);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
reusableBuffer.moduleSetup.bindInformation.step = 0;
|
||||
moduleState[moduleIdx].startBind(&reusableBuffer.moduleSetup.bindInformation);
|
||||
}
|
||||
}
|
||||
else if (reusableBuffer.moduleSetup.bindInformation.step == BIND_MODULE_TX_SETTINGS_REQUEST && reusableBuffer.moduleSetup.pxx2.moduleSettings.txPower > 0) {
|
||||
// We just receive the module settings (for TX power)
|
||||
reusableBuffer.moduleSetup.bindInformation.step = 0;
|
||||
moduleState[moduleIdx].startBind(&reusableBuffer.moduleSetup.bindInformation);
|
||||
}
|
||||
}
|
||||
|
||||
if (attr && (moduleState[moduleIdx].mode == 0 || s_editMode == 0)) {
|
||||
else if (attr && (moduleState[moduleIdx].mode == MODULE_MODE_NORMAL || s_editMode == 0)) {
|
||||
if (moduleState[moduleIdx].mode) {
|
||||
moduleState[moduleIdx].mode = 0;
|
||||
removePXX2ReceiverIfEmpty(moduleIdx, receiverIdx);
|
||||
killEvents(event); // we stopped BIND / SHARE, we don't want to re-open the menu
|
||||
event = 0;
|
||||
CLEAR_POPUP();
|
||||
}
|
||||
s_editMode = 0;
|
||||
}
|
||||
|
||||
if (moduleState[moduleIdx].mode == MODULE_MODE_BIND) {
|
||||
if (reusableBuffer.moduleSetup.bindInformation.step == BIND_INIT && reusableBuffer.moduleSetup.bindInformation.candidateReceiversCount > 0) {
|
||||
popupMenuItemsCount = min<uint8_t>(reusableBuffer.moduleSetup.bindInformation.candidateReceiversCount, PXX2_MAX_RECEIVERS_PER_MODULE);
|
||||
for (uint8_t i=0; i<popupMenuItemsCount; i++) {
|
||||
popupMenuItems[i] = reusableBuffer.moduleSetup.bindInformation.candidateReceiversNames[i];
|
||||
if (reusableBuffer.moduleSetup.bindInformation.step == BIND_INIT) {
|
||||
if (reusableBuffer.moduleSetup.bindInformation.candidateReceiversCount > 0) {
|
||||
popupMenuItemsCount = min<uint8_t>(reusableBuffer.moduleSetup.bindInformation.candidateReceiversCount, PXX2_MAX_RECEIVERS_PER_MODULE);
|
||||
for (auto rx = 0; rx < popupMenuItemsCount; rx++) {
|
||||
popupMenuItems[rx] = reusableBuffer.moduleSetup.bindInformation.candidateReceiversNames[rx];
|
||||
}
|
||||
// popupMenuTitle = STR_PXX2_SELECT_RX;
|
||||
POPUP_MENU_START(onPXX2BindMenu);
|
||||
}
|
||||
//popupMenuTitle = STR_PXX2_SELECT_RX; // TODO : fix
|
||||
POPUP_MENU_START(onPXX2BindMenu);
|
||||
}
|
||||
}
|
||||
|
||||
if (attr && EVT_KEY_MASK(event) == KEY_ENTER) {
|
||||
killEvents(event);
|
||||
if (isPXX2ReceiverEmpty(moduleIdx, receiverIdx)) {
|
||||
onPXX2ReceiverMenu(STR_BIND);
|
||||
}
|
||||
else {
|
||||
POPUP_MENU_ADD_ITEM(STR_BIND);
|
||||
POPUP_MENU_ADD_ITEM(STR_OPTIONS);
|
||||
POPUP_MENU_ADD_ITEM(STR_SHARE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET);
|
||||
}
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
POPUP_MENU_ADD_ITEM(STR_BIND);
|
||||
POPUP_MENU_ADD_ITEM(STR_OPTIONS);
|
||||
POPUP_MENU_ADD_ITEM(STR_SHARE);
|
||||
POPUP_MENU_ADD_ITEM(STR_DELETE);
|
||||
POPUP_MENU_ADD_ITEM(STR_RESET);
|
||||
POPUP_MENU_START(onPXX2ReceiverMenu);
|
||||
}
|
||||
}
|
||||
@@ -1664,7 +1633,7 @@ bool menuModelSetup(event_t event)
|
||||
}
|
||||
}
|
||||
|
||||
if (IS_RANGECHECK_ENABLE()) {
|
||||
if (isModuleInRangeCheckMode()) {
|
||||
theme->drawMessageBox("RSSI :", NULL, NULL, WARNING_TYPE_INFO);
|
||||
lcdDrawNumber(WARNING_LINE_X, WARNING_INFOLINE_Y, TELEMETRY_RSSI(), DBLSIZE|LEFT);
|
||||
}
|
||||
@@ -1698,4 +1667,4 @@ bool menuModelSetup(event_t event)
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,70 +23,13 @@
|
||||
enum MenuModelTelemetryFrskyItems {
|
||||
ITEM_TELEMETRY_PROTOCOL_TYPE,
|
||||
ITEM_TELEMETRY_RSSI_LABEL,
|
||||
ITEM_TELEMETRY_RSSI_SOURCE,
|
||||
ITEM_TELEMETRY_RSSI_ALARM1,
|
||||
ITEM_TELEMETRY_RSSI_ALARM2,
|
||||
ITEM_TELEMETRY_DISABLE_ALARMS,
|
||||
ITEM_TELEMETRY_SENSORS_LABEL,
|
||||
ITEM_TELEMETRY_SENSOR1,
|
||||
ITEM_TELEMETRY_SENSOR2,
|
||||
ITEM_TELEMETRY_SENSOR3,
|
||||
ITEM_TELEMETRY_SENSOR4,
|
||||
ITEM_TELEMETRY_SENSOR5,
|
||||
ITEM_TELEMETRY_SENSOR6,
|
||||
ITEM_TELEMETRY_SENSOR7,
|
||||
ITEM_TELEMETRY_SENSOR8,
|
||||
ITEM_TELEMETRY_SENSOR9,
|
||||
ITEM_TELEMETRY_SENSOR10,
|
||||
ITEM_TELEMETRY_SENSOR11,
|
||||
ITEM_TELEMETRY_SENSOR12,
|
||||
ITEM_TELEMETRY_SENSOR13,
|
||||
ITEM_TELEMETRY_SENSOR14,
|
||||
ITEM_TELEMETRY_SENSOR15,
|
||||
ITEM_TELEMETRY_SENSOR16,
|
||||
ITEM_TELEMETRY_SENSOR17,
|
||||
ITEM_TELEMETRY_SENSOR18,
|
||||
ITEM_TELEMETRY_SENSOR19,
|
||||
ITEM_TELEMETRY_SENSOR20,
|
||||
ITEM_TELEMETRY_SENSOR21,
|
||||
ITEM_TELEMETRY_SENSOR22,
|
||||
ITEM_TELEMETRY_SENSOR23,
|
||||
ITEM_TELEMETRY_SENSOR24,
|
||||
ITEM_TELEMETRY_SENSOR25,
|
||||
ITEM_TELEMETRY_SENSOR26,
|
||||
ITEM_TELEMETRY_SENSOR27,
|
||||
ITEM_TELEMETRY_SENSOR28,
|
||||
ITEM_TELEMETRY_SENSOR29,
|
||||
ITEM_TELEMETRY_SENSOR30,
|
||||
ITEM_TELEMETRY_SENSOR31,
|
||||
ITEM_TELEMETRY_SENSOR32,
|
||||
ITEM_TELEMETRY_SENSOR33,
|
||||
ITEM_TELEMETRY_SENSOR34,
|
||||
ITEM_TELEMETRY_SENSOR35,
|
||||
ITEM_TELEMETRY_SENSOR36,
|
||||
ITEM_TELEMETRY_SENSOR37,
|
||||
ITEM_TELEMETRY_SENSOR38,
|
||||
ITEM_TELEMETRY_SENSOR39,
|
||||
ITEM_TELEMETRY_SENSOR40,
|
||||
ITEM_TELEMETRY_SENSOR41,
|
||||
ITEM_TELEMETRY_SENSOR42,
|
||||
ITEM_TELEMETRY_SENSOR43,
|
||||
ITEM_TELEMETRY_SENSOR44,
|
||||
ITEM_TELEMETRY_SENSOR45,
|
||||
ITEM_TELEMETRY_SENSOR46,
|
||||
ITEM_TELEMETRY_SENSOR47,
|
||||
ITEM_TELEMETRY_SENSOR48,
|
||||
ITEM_TELEMETRY_SENSOR49,
|
||||
ITEM_TELEMETRY_SENSOR50,
|
||||
ITEM_TELEMETRY_SENSOR51,
|
||||
ITEM_TELEMETRY_SENSOR52,
|
||||
ITEM_TELEMETRY_SENSOR53,
|
||||
ITEM_TELEMETRY_SENSOR54,
|
||||
ITEM_TELEMETRY_SENSOR55,
|
||||
ITEM_TELEMETRY_SENSOR56,
|
||||
ITEM_TELEMETRY_SENSOR57,
|
||||
ITEM_TELEMETRY_SENSOR58,
|
||||
ITEM_TELEMETRY_SENSOR59,
|
||||
ITEM_TELEMETRY_SENSOR60,
|
||||
ITEM_TELEMETRY_SENSOR_FIRST,
|
||||
ITEM_TELEMETRY_SENSOR_LAST = ITEM_TELEMETRY_SENSOR_FIRST + MAX_TELEMETRY_SENSORS - 1,
|
||||
ITEM_TELEMETRY_DISCOVER_SENSORS,
|
||||
ITEM_TELEMETRY_NEW_SENSOR,
|
||||
ITEM_TELEMETRY_DELETE_ALL_SENSORS,
|
||||
@@ -105,6 +48,7 @@ enum MenuModelTelemetryFrskyItems {
|
||||
#define TELEM_COL4 350
|
||||
#define TELEM_COL5 425
|
||||
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0, 0,
|
||||
#define SENSOR_ROWS(x) (isTelemetryFieldAvailable(x) ? (uint8_t)0 : HIDDEN_ROW)
|
||||
#define SENSORS_ROWS LABEL(Sensors), SENSOR_ROWS(0), SENSOR_ROWS(1), SENSOR_ROWS(2), SENSOR_ROWS(3), SENSOR_ROWS(4), SENSOR_ROWS(5), SENSOR_ROWS(6), SENSOR_ROWS(7), SENSOR_ROWS(8), SENSOR_ROWS(9), SENSOR_ROWS(10), SENSOR_ROWS(11), SENSOR_ROWS(12), SENSOR_ROWS(13), SENSOR_ROWS(14), SENSOR_ROWS(15), SENSOR_ROWS(16), SENSOR_ROWS(17), SENSOR_ROWS(18), SENSOR_ROWS(19), SENSOR_ROWS(20), SENSOR_ROWS(21), SENSOR_ROWS(22), SENSOR_ROWS(23), SENSOR_ROWS(24), SENSOR_ROWS(25), SENSOR_ROWS(26), SENSOR_ROWS(27), SENSOR_ROWS(28), SENSOR_ROWS(29), SENSOR_ROWS(30), \
|
||||
SENSOR_ROWS(31), SENSOR_ROWS(32), SENSOR_ROWS(33), SENSOR_ROWS(34), SENSOR_ROWS(35), SENSOR_ROWS(36), SENSOR_ROWS(37), SENSOR_ROWS(38), SENSOR_ROWS(39), SENSOR_ROWS(40),SENSOR_ROWS(41), SENSOR_ROWS(42), SENSOR_ROWS(43), SENSOR_ROWS(44), SENSOR_ROWS(45), SENSOR_ROWS(46), SENSOR_ROWS(47), SENSOR_ROWS(48), SENSOR_ROWS(49), SENSOR_ROWS(50),SENSOR_ROWS(51), SENSOR_ROWS(52), SENSOR_ROWS(53), SENSOR_ROWS(54), SENSOR_ROWS(55), SENSOR_ROWS(56), SENSOR_ROWS(57), SENSOR_ROWS(58), SENSOR_ROWS(59), 0, 0, 0, 0,
|
||||
@@ -113,12 +57,11 @@ enum MenuModelTelemetryFrskyItems {
|
||||
#else
|
||||
#define VARIO_ROWS
|
||||
#endif
|
||||
#define RSSI_ROWS LABEL(RSSI), 0, 0, 0,
|
||||
#define TELEMETRY_TYPE_ROWS (g_model.moduleData[INTERNAL_MODULE].rfProtocol == MODULE_SUBTYPE_PXX1_OFF && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
#define TELEMETRY_TYPE_ROWS (!IS_INTERNAL_MODULE_ENABLED() && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM) ? (uint8_t)0 : HIDDEN_ROW,
|
||||
|
||||
void onSensorMenu(const char * result)
|
||||
{
|
||||
uint8_t index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR1;
|
||||
uint8_t index = menuVerticalPosition - ITEM_TELEMETRY_SENSOR_FIRST;
|
||||
|
||||
if (index < MAX_TELEMETRY_SENSORS) {
|
||||
if (result == STR_EDIT) {
|
||||
@@ -151,16 +94,18 @@ void onSensorMenu(const char * result)
|
||||
}
|
||||
}
|
||||
|
||||
bool menuModelTelemetryFrsky(event_t event)
|
||||
void onDeleteAllSensorsConfirm(const char * result)
|
||||
{
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
if (result == STR_OK) {
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
delTelemetryIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MENU(STR_MENUTELEMETRY, MODEL_ICONS, menuTabModel, MENU_MODEL_TELEMETRY_FRSKY, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
|
||||
bool menuModelTelemetry(event_t event)
|
||||
{
|
||||
MENU(STR_MENUTELEMETRY, MODEL_ICONS, menuTabModel, MENU_MODEL_TELEMETRY, ITEM_TELEMETRY_MAX, { TELEMETRY_TYPE_ROWS RSSI_ROWS SENSORS_ROWS VARIO_ROWS });
|
||||
|
||||
for (uint8_t i=0; i<NUM_BODY_LINES; i++) {
|
||||
coord_t y = MENU_CONTENT_TOP + i*FH;
|
||||
@@ -173,8 +118,8 @@ bool menuModelTelemetryFrsky(event_t event)
|
||||
LcdFlags blink = ((s_editMode>0) ? BLINK|INVERS : INVERS);
|
||||
LcdFlags attr = (menuVerticalPosition == k ? blink : 0);
|
||||
|
||||
if (k>=ITEM_TELEMETRY_SENSOR1 && k<ITEM_TELEMETRY_SENSOR1+MAX_TELEMETRY_SENSORS) {
|
||||
int index = k-ITEM_TELEMETRY_SENSOR1;
|
||||
if (k >= ITEM_TELEMETRY_SENSOR_FIRST && k <= ITEM_TELEMETRY_SENSOR_LAST) {
|
||||
int index = k - ITEM_TELEMETRY_SENSOR_FIRST;
|
||||
lcdDrawNumber(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, index+1, LEFT|attr, 0, NULL, ":");
|
||||
lcdDrawSizedText(60, y, g_model.telemetrySensors[index].label, TELEM_LABEL_LEN, ZCHAR);
|
||||
TelemetryItem & telemetryItem = telemetryItems[index];
|
||||
@@ -233,7 +178,7 @@ bool menuModelTelemetryFrsky(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_DISCOVER_SENSORS:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, allowNewSensors ? NO_INDENT(STR_STOP_DISCOVER_SENSORS) : NO_INDENT(STR_DISCOVER_SENSORS), attr);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, allowNewSensors ? STR_STOP_DISCOVER_SENSORS : STR_DISCOVER_SENSORS, attr);
|
||||
if (attr && event==EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
allowNewSensors = !allowNewSensors;
|
||||
@@ -256,12 +201,12 @@ bool menuModelTelemetryFrsky(event_t event)
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_DELETE_ALL_SENSORS:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, NO_INDENT(STR_DELETE_ALL_SENSORS), attr);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT+INDENT_WIDTH, y, STR_DELETE_ALL_SENSORS, attr);
|
||||
if (attr)
|
||||
s_editMode = 0;
|
||||
if (attr && event==EVT_KEY_LONG(KEY_ENTER)) {
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
killEvents(KEY_ENTER);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE);
|
||||
POPUP_CONFIRMATION(STR_CONFIRMDELETE, onDeleteAllSensorsConfirm);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -281,6 +226,20 @@ bool menuModelTelemetryFrsky(event_t event)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "RSSI");
|
||||
break;
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_SOURCE: {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, STR_SOURCE);
|
||||
drawSource(TELEM_COL2, y, g_model.rssiSource ? MIXSRC_FIRST_TELEM + 3 * (g_model.rssiSource - 1) : 0, attr);
|
||||
if (g_model.rssiSource) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[g_model.rssiSource - 1];
|
||||
lcdDrawText(lcdNextPos, y, " ", attr);
|
||||
drawReceiverName(lcdNextPos, y, sensor->frskyInstance.rxIndex >> 2, sensor->frskyInstance.rxIndex & 0x03, attr);
|
||||
}
|
||||
if (attr) {
|
||||
g_model.rssiSource = checkIncDec(event, g_model.rssiSource, 0, MAX_TELEMETRY_SENSORS, EE_MODEL | NO_INCDEC_MARKS, isRssiSensorAvailable);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_TELEMETRY_RSSI_ALARM1:
|
||||
case ITEM_TELEMETRY_RSSI_ALARM2: {
|
||||
bool warning = (k==ITEM_TELEMETRY_RSSI_ALARM1);
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
const char *warningText = NULL;
|
||||
const char *warningText = nullptr;
|
||||
const char *warningInfoText;
|
||||
uint8_t warningInfoLength;
|
||||
uint8_t warningType;
|
||||
uint8_t warningResult = 0;
|
||||
uint8_t warningInfoFlags = ZCHAR;
|
||||
void (*popupFunc)(event_t event) = NULL;
|
||||
PopupFunc popupFunc = nullptr;
|
||||
const char *popupMenuItems[POPUP_MENU_MAX_LINES];
|
||||
uint8_t popupMenuSelectedItem = 0;
|
||||
uint16_t popupMenuItemsCount = 0;
|
||||
@@ -34,22 +34,6 @@ uint16_t popupMenuOffset = 0;
|
||||
uint8_t popupMenuOffsetType = MENU_OFFSET_INTERNAL;
|
||||
void (*popupMenuHandler)(const char * result);
|
||||
|
||||
void runPopupWarningBox()
|
||||
{
|
||||
// theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_WARNING);
|
||||
// lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
|
||||
// lcdDrawSolidRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, 2, ALARM_COLOR);
|
||||
// lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_WARNING);
|
||||
}
|
||||
|
||||
void drawMessageBox()
|
||||
{
|
||||
// theme->drawMessageBox("", "", "", MESSAGEBOX_TYPE_INFO);
|
||||
// lcdDrawSolidFilledRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, TEXT_BGCOLOR);
|
||||
// lcdDrawSolidRect(POPUP_X, POPUP_Y, POPUP_W, POPUP_H, 2, WARNING_COLOR);
|
||||
// lcdDrawBitmap(POPUP_X+15, POPUP_Y+20, LBM_MESSAGE);
|
||||
}
|
||||
|
||||
void drawAlertBox(const char * title, const char * text, const char * action)
|
||||
{
|
||||
theme->drawMessageBox(title, text, action, WARNING_TYPE_ALERT);
|
||||
@@ -83,7 +67,21 @@ void runPopupWarning(event_t event)
|
||||
{
|
||||
warningResult = false;
|
||||
|
||||
theme->drawMessageBox(warningText, warningInfoText, warningType == WARNING_TYPE_INFO ? STR_OK : (warningType == WARNING_TYPE_ASTERISK ? STR_EXIT : STR_POPUPS_ENTER_EXIT), warningType);
|
||||
const char * action;
|
||||
switch (warningType) {
|
||||
case WARNING_TYPE_INFO:
|
||||
action = STR_OK;
|
||||
break;
|
||||
case WARNING_TYPE_ASTERISK:
|
||||
case WARNING_TYPE_WAIT:
|
||||
action = STR_EXIT;
|
||||
break;
|
||||
default:
|
||||
action = STR_POPUPS_ENTER_EXIT;
|
||||
break;
|
||||
}
|
||||
|
||||
theme->drawMessageBox(warningText, warningInfoText, action, warningType);
|
||||
|
||||
switch (event) {
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
@@ -115,7 +113,7 @@ void runPopupWarning(event_t event)
|
||||
|
||||
const char * runPopupMenu(event_t event)
|
||||
{
|
||||
const char * result = NULL;
|
||||
const char * result = nullptr;
|
||||
|
||||
uint8_t display_count = min<unsigned int>(popupMenuItemsCount, MENU_MAX_DISPLAY_LINES);
|
||||
|
||||
|
||||
@@ -52,6 +52,8 @@ enum MenuRadioHardwareItems {
|
||||
ITEM_RADIO_HARDWARE_SH,
|
||||
ITEM_RADIO_HARDWARE_SI, // Gimbal switch left
|
||||
ITEM_RADIO_HARDWARE_SJ, // Gimbal switch right
|
||||
ITEM_RADIO_HARDWARE_BATTERY_CALIB,
|
||||
ITEM_RADIO_HARDWARE_RTC_BATTERY,
|
||||
ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE,
|
||||
ITEM_RADIO_HARDWARE_BLUETOOTH_MODE,
|
||||
ITEM_RADIO_HARDWARE_BLUETOOTH_PAIRING_CODE,
|
||||
@@ -60,7 +62,6 @@ enum MenuRadioHardwareItems {
|
||||
ITEM_RADIO_HARDWARE_AUX_SERIAL_MODE,
|
||||
#endif
|
||||
ITEM_RADIO_HARDWARE_JITTER_FILTER,
|
||||
ITEM_RADIO_HARDWARE_BAT_CAL,
|
||||
ITEM_RADIO_HARDWARE_MAX
|
||||
};
|
||||
|
||||
@@ -77,7 +78,31 @@ enum MenuRadioHardwareItems {
|
||||
|
||||
bool menuRadioHardware(event_t event)
|
||||
{
|
||||
MENU(STR_HARDWARE, RADIO_ICONS, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, { 0, LABEL(Sticks), 0, 0, 0, 0, LABEL(Pots), POTS_ROWS, LABEL(Switches), SWITCHES_ROWS, 0, BLUETOOTH_ROWS, 0, 0, 0 });
|
||||
MENU(STR_HARDWARE, RADIO_ICONS, menuTabGeneral, MENU_RADIO_HARDWARE, ITEM_RADIO_HARDWARE_MAX, {
|
||||
0 /* calibration button */,
|
||||
|
||||
LABEL(Sticks),
|
||||
0 /* stick 1 */,
|
||||
0 /* stick 2 */,
|
||||
0 /* stick 3 */,
|
||||
0 /* stick 4 */,
|
||||
|
||||
LABEL(Pots),
|
||||
POTS_ROWS,
|
||||
|
||||
LABEL(Switches),
|
||||
SWITCHES_ROWS,
|
||||
|
||||
0, /* battery */
|
||||
READONLY_ROW, /* RTC */
|
||||
|
||||
0, /* max baudrate */
|
||||
|
||||
BLUETOOTH_ROWS,
|
||||
|
||||
0, /* aux serial mode */
|
||||
0, /* ADC filter */
|
||||
});
|
||||
|
||||
uint8_t sub = menuVerticalPosition;
|
||||
|
||||
@@ -177,11 +202,22 @@ bool menuRadioHardware(event_t event)
|
||||
lcdDrawMMM(HW_SETTINGS_COLUMN, y, 0);
|
||||
config = editChoice(HW_SETTINGS_COLUMN+50, y, STR_SWTYPES, config, SWITCH_NONE, SWITCH_TYPE_MAX(index), menuHorizontalPosition == 1 ? attr : 0, event);
|
||||
if (attr && checkIncDec_Ret) {
|
||||
g_eeGeneral.switchConfig = bfSet<uint32_t>(g_eeGeneral.switchConfig, config, 2*index, 2);
|
||||
g_eeGeneral.switchConfig = bfSet<swconfig_t>(g_eeGeneral.switchConfig, config, 2*index, 2);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_RADIO_HARDWARE_BATTERY_CALIB:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BATT_CALIB);
|
||||
lcdDrawNumber(HW_SETTINGS_COLUMN+50, y, getBatteryVoltage(), attr|PREC2, 0, NULL, "V");
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_HARDWARE_RTC_BATTERY:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_RTC_BATT);
|
||||
lcdDrawNumber(HW_SETTINGS_COLUMN+50, y, getRTCBatteryVoltage(), attr|PREC2, 0, NULL, "V");
|
||||
break;
|
||||
|
||||
case ITEM_RADIO_HARDWARE_SERIAL_BAUDRATE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MAXBAUDRATE);
|
||||
lcdDrawNumber(HW_SETTINGS_COLUMN+50, y, CROSSFIRE_BAUDRATES[g_eeGeneral.telemetryBaudrate], attr|LEFT);
|
||||
@@ -232,12 +268,6 @@ bool menuRadioHardware(event_t event)
|
||||
g_eeGeneral.jitterFilter = 1 - editCheckBox(b, HW_SETTINGS_COLUMN+50, y, attr, event);
|
||||
break;
|
||||
}
|
||||
|
||||
case ITEM_RADIO_HARDWARE_BAT_CAL:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BATT_CALIB);
|
||||
lcdDrawNumber(HW_SETTINGS_COLUMN+50, y, getBatteryVoltage(), attr|LEFT|PREC2, 0, NULL, "V");
|
||||
if (attr) CHECK_INCDEC_GENVAR(event, g_eeGeneral.txVoltageCalibration, -127, 127);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
@@ -32,11 +31,11 @@ enum PowerMeterFields {
|
||||
POWER_METER_FIELDS_MAX
|
||||
};
|
||||
|
||||
#define POWER_METER_MARGIN_2ND_COLUMN 180
|
||||
constexpr coord_t POWER_METER_2ND_COLUMN = 100;
|
||||
|
||||
bool menuRadioPowerMeter(event_t event)
|
||||
{
|
||||
SIMPLE_SUBMENU(STR_MENU_POWER_METER, ICON_RADIO, POWER_METER_FIELDS_MAX-1);
|
||||
SUBMENU(STR_MENU_POWER_METER, ICON_RADIO_SPECTRUM_ANALYSER, POWER_METER_FIELDS_MAX-1, {0, 0, READONLY_ROW, READONLY_ROW, READONLY_ROW});
|
||||
|
||||
if (TELEMETRY_STREAMING()) {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_TURN_OFF_RECEIVER);
|
||||
@@ -44,51 +43,54 @@ bool menuRadioPowerMeter(event_t event)
|
||||
killEvents(event);
|
||||
popMenu();
|
||||
}
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (menuEvent) {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_STOPPING);
|
||||
lcdRefresh();
|
||||
moduleState[g_moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
moduleState[g_moduleIdx].readModuleInformation(&reusableBuffer.moduleSetup.pxx2.moduleInformation, PXX2_HW_INFO_TX_ID, PXX2_HW_INFO_TX_ID);
|
||||
/* wait 1s to resume normal operation before leaving */
|
||||
watchdogSuspend(1000);
|
||||
RTOS_WAIT_MS(1000);
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (moduleState[g_moduleIdx].mode != MODULE_MODE_POWER_METER) {
|
||||
memclear(&reusableBuffer.powerMeter, sizeof(reusableBuffer.powerMeter));
|
||||
reusableBuffer.powerMeter.freq = 2400000000;
|
||||
reusableBuffer.powerMeter.attn = 4;
|
||||
reusableBuffer.powerMeter.dirty = true;
|
||||
moduleState[g_moduleIdx].mode = MODULE_MODE_POWER_METER;
|
||||
}
|
||||
|
||||
// The warning
|
||||
if (reusableBuffer.powerMeter.attn != 0)
|
||||
lcdDrawCenteredText(MENU_CONTENT_TOP, STR_POWERMETER_ATTN_NEEDED, BOLD);
|
||||
if (reusableBuffer.powerMeter.attn != 0) {
|
||||
lcdDrawCenteredText(MENU_BODY_TOP, STR_POWERMETER_ATTN_NEEDED, BOLD | INVERS);
|
||||
}
|
||||
|
||||
for (uint8_t i=0; i<POWER_METER_FIELDS_MAX; i++) {
|
||||
LcdFlags attr = (menuVerticalPosition == i ? (s_editMode > 0 ? INVERS | BLINK : INVERS) : 0);
|
||||
coord_t y = MENU_CONTENT_TOP + 30 + i * FH;
|
||||
coord_t y = MENU_BODY_TOP + 2 * FH + i * FH;
|
||||
|
||||
switch (i) {
|
||||
case POWER_METER_FREQ_RANGE:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_POWERMETER_FREQ);
|
||||
lcdDrawNumber(POWER_METER_MARGIN_2ND_COLUMN, y, reusableBuffer.powerMeter.freq / 1000000, LEFT | attr);
|
||||
lcdDrawNumber(POWER_METER_2ND_COLUMN, y, reusableBuffer.powerMeter.freq / 1000000, LEFT | attr);
|
||||
lcdDrawText(lcdNextPos, y, " MHz band");
|
||||
if (attr) {
|
||||
reusableBuffer.powerMeter.freq = checkIncDec(event, reusableBuffer.powerMeter.freq == 900000000, 0, 1) ? 900000000 : 2400000000;
|
||||
if (checkIncDec_Ret) {
|
||||
reusableBuffer.powerMeter.power = 0;
|
||||
reusableBuffer.powerMeter.peak = 0;
|
||||
reusableBuffer.powerMeter.dirty = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case POWER_METER_ATTENUATOR:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_POWERMETER_ATTN);
|
||||
lcdDrawNumber(POWER_METER_MARGIN_2ND_COLUMN, y, -10 * reusableBuffer.powerMeter.attn, LEFT | attr);
|
||||
lcdDrawNumber(POWER_METER_2ND_COLUMN, y, -10 * reusableBuffer.powerMeter.attn, LEFT | attr);
|
||||
lcdDrawText(lcdNextPos, y, " dB");
|
||||
if (attr) {
|
||||
reusableBuffer.powerMeter.attn = checkIncDec(event, reusableBuffer.powerMeter.attn, 0, 5, 0);
|
||||
@@ -97,9 +99,9 @@ bool menuRadioPowerMeter(event_t event)
|
||||
|
||||
case POWER_METER_MAX:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_MAX);
|
||||
lcdDrawNumber(POWER_METER_MARGIN_2ND_COLUMN, y, -10 + 10 * reusableBuffer.powerMeter.attn);
|
||||
lcdDrawText(lcdNextPos, y, "dBm/ ");
|
||||
drawPower(lcdNextPos, y, -10 + 10 * reusableBuffer.powerMeter.attn, 0);
|
||||
lcdDrawNumber(POWER_METER_2ND_COLUMN, y, -10 + 10 * reusableBuffer.powerMeter.attn);
|
||||
lcdDrawText(lcdNextPos + 3, y, "dBm/ ");
|
||||
drawPower(lcdNextPos + 3, y, -10 + 10 * reusableBuffer.powerMeter.attn, 0);
|
||||
if (attr) {
|
||||
reusableBuffer.powerMeter.attn = checkIncDec(event, reusableBuffer.powerMeter.attn, 0, 5, 0);
|
||||
}
|
||||
@@ -108,7 +110,7 @@ bool menuRadioPowerMeter(event_t event)
|
||||
case POWER_METER_POWER:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_POWERMETER_POWER);
|
||||
if (reusableBuffer.powerMeter.power) {
|
||||
lcdDrawNumber(POWER_METER_MARGIN_2ND_COLUMN, y, reusableBuffer.powerMeter.power + reusableBuffer.powerMeter.attn * 1000, LEFT | PREC2);
|
||||
lcdDrawNumber(POWER_METER_2ND_COLUMN, y, reusableBuffer.powerMeter.power + reusableBuffer.powerMeter.attn * 1000, LEFT | PREC2);
|
||||
lcdDrawText(lcdNextPos, y, "dBm");
|
||||
}
|
||||
break;
|
||||
@@ -116,11 +118,12 @@ bool menuRadioPowerMeter(event_t event)
|
||||
case POWER_METER_PEAK:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_POWERMETER_PEAK);
|
||||
if (reusableBuffer.powerMeter.peak) {
|
||||
lcdDrawNumber(POWER_METER_MARGIN_2ND_COLUMN, y, reusableBuffer.powerMeter.peak + reusableBuffer.powerMeter.attn * 1000, LEFT | PREC2);
|
||||
lcdDrawNumber(POWER_METER_2ND_COLUMN, y, reusableBuffer.powerMeter.peak + reusableBuffer.powerMeter.attn * 1000, LEFT | PREC2);
|
||||
lcdDrawText(lcdNextPos, y, "dBm");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -248,6 +248,29 @@ bool menuRadioSdManager(event_t _event)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||
}
|
||||
else if (!READ_ONLY() && !strcasecmp(ext, UPDATE_FIRMWARE_EXT)) {
|
||||
FrSkyFirmwareInformation information;
|
||||
if (readFirmwareInformation(line, information) == nullptr) {
|
||||
if (information.productFamily == FIRMWARE_FAMILY_INTERNAL_MODULE)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_INTERNAL_MODULE);
|
||||
if (information.productFamily == FIRMWARE_FAMILY_EXTERNAL_MODULE)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_MODULE);
|
||||
if (HAS_SPORT_UPDATE_CONNECTOR() && (information.productFamily == FIRMWARE_FAMILY_RECEIVER || information.productFamily == FIRMWARE_FAMILY_SENSOR))
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_EXTERNAL_DEVICE);
|
||||
#if defined(PXX2)
|
||||
if (information.productFamily == FIRMWARE_FAMILY_RECEIVER)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_RECEIVER_OTA);
|
||||
#endif
|
||||
#if defined(BLUETOOTH)
|
||||
if (information.productFamily == FIRMWARE_FAMILY_BLUETOOTH_CHIP)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_BLUETOOTH_MODULE);
|
||||
#endif
|
||||
#if defined(HARDWARE_POWER_MANAGEMENT_UNIT)
|
||||
if (information.productFamily == FIRMWARE_FAMILY_POWER_MANAGEMENT_UNIT)
|
||||
POPUP_MENU_ADD_ITEM(STR_FLASH_POWER_MANAGEMENT_UNIT);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else if (isExtensionMatching(ext, SCRIPTS_EXT)) {
|
||||
POPUP_MENU_ADD_ITEM(STR_EXECUTE_FILE);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,9 @@ enum menuRadioSetupItems {
|
||||
ITEM_SETUP_DIM_LEVEL,
|
||||
ITEM_SETUP_FLASH_BEEP,
|
||||
CASE_PWR_BUTTON_PRESS(ITEM_SETUP_PWR_OFF_SPEED)
|
||||
#if defined(PXX2)
|
||||
ITEM_RADIO_SETUP_OWNER_ID,
|
||||
#endif
|
||||
CASE_GPS(ITEM_SETUP_LABEL_GPS)
|
||||
CASE_GPS(ITEM_SETUP_TIMEZONE)
|
||||
CASE_GPS(ITEM_SETUP_ADJUST_RTC)
|
||||
@@ -116,8 +119,21 @@ bool menuRadioSetup(event_t event)
|
||||
LABEL(ALARMS), 0, 0, 0, 0,
|
||||
LABEL(BACKLIGHT), 0, 0, 0, 0, 0,
|
||||
CASE_PWR_BUTTON_PRESS(0)
|
||||
CASE_GPS(LABEL(GPS)) CASE_GPS(0) CASE_GPS(0) CASE_GPS(0)
|
||||
CASE_PXX1(0) 0, 0, FAI_CHOICE_ROW 0, 0, 0, 0, 1/*to force edit mode*/ }); // Country code - Voice Language - Units - Fai choice - Play delay - USB mode - Chan order - Mode (1 to 4)
|
||||
CASE_PXX2(0) // owner registration ID
|
||||
CASE_GPS(LABEL(GPS))
|
||||
CASE_GPS(0) // timezone
|
||||
CASE_GPS(0) // adjust RTC
|
||||
CASE_GPS(0) // GPS format
|
||||
CASE_PXX1(0) // country code
|
||||
0, // voice language
|
||||
0, // imperial
|
||||
FAI_CHOICE_ROW
|
||||
0, // switches delay
|
||||
0, // USB mode
|
||||
0, // RX channels order
|
||||
0, // sticks mode
|
||||
1 /*to force edit mode*/
|
||||
}); // Units - Fai choice - Play delay - USB mode - Chan order - Mode (1 to 4)
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
reusableBuffer.generalSettings.stickMode = g_eeGeneral.stickMode;
|
||||
@@ -366,6 +382,13 @@ bool menuRadioSetup(event_t event)
|
||||
g_eeGeneral.alarmsFlash = editCheckBox(g_eeGeneral.alarmsFlash, RADIO_SETUP_2ND_COLUMN, y, attr, event ) ;
|
||||
break;
|
||||
|
||||
#if defined(PXX2)
|
||||
case ITEM_RADIO_SETUP_OWNER_ID:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_OWNER_ID);
|
||||
editName(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.ownerRegistrationID, PXX2_LEN_REGISTRATION_ID, event, attr);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_SETUP_BACKLIGHT_DELAY:
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_BLDELAY);
|
||||
lcdDrawNumber(RADIO_SETUP_2ND_COLUMN, y, g_eeGeneral.lightAutoOff*5, attr|LEFT, 0, NULL, "s");
|
||||
|
||||
@@ -30,7 +30,7 @@ enum SpectrumFields {
|
||||
|
||||
bool menuRadioSpectrumAnalyser(event_t event)
|
||||
{
|
||||
SUBMENU(STR_MENU_SPECTRUM_ANALYSER, ICON_RADIO, 1, {1});
|
||||
SUBMENU(STR_MENU_SPECTRUM_ANALYSER, ICON_RADIO_SPECTRUM_ANALYSER, 1, {1});
|
||||
|
||||
if (menuEvent) {
|
||||
lcdDrawCenteredText(LCD_H/2, STR_STOPPING);
|
||||
|
||||
@@ -89,14 +89,14 @@ bool menuRadioTools(event_t event)
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER))
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_INT, menuRadioSpectrumAnalyser, INTERNAL_MODULE);
|
||||
|
||||
// if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
// addRadioModuleTool(index++, STR_POWER_METER_INT, menuRadioPowerMeter, INTERNAL_MODULE);
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
addRadioModuleTool(index++, STR_POWER_METER_INT, menuRadioPowerMeter, INTERNAL_MODULE);
|
||||
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_SPECTRUM_ANALYSER))
|
||||
addRadioModuleTool(index++, STR_SPECTRUM_ANALYSER_EXT, menuRadioSpectrumAnalyser, EXTERNAL_MODULE);
|
||||
|
||||
// if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
// addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
||||
if (isPXX2ModuleOptionAvailable(reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE].information.modelID, MODULE_OPTION_POWER_METER))
|
||||
addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
||||
#endif
|
||||
|
||||
#if defined(LUA)
|
||||
|
||||
@@ -21,22 +21,171 @@
|
||||
#include "opentx.h"
|
||||
#include "options.h"
|
||||
|
||||
#if defined(PXX2)
|
||||
constexpr coord_t COLUMN2_X = 200;
|
||||
|
||||
void drawPXX2Version(coord_t x, coord_t y, PXX2Version version)
|
||||
{
|
||||
if (version.major == 0xFF && version.minor == 0x0F && version.revision == 0x0F) {
|
||||
lcdDrawText(x, y, "---");
|
||||
}
|
||||
else {
|
||||
lcdDrawNumber(x, y, 1 + version.major, LEFT);
|
||||
lcdDrawChar(lcdNextPos, y, '.');
|
||||
lcdDrawNumber(lcdNextPos, y, version.minor, LEFT);
|
||||
lcdDrawChar(lcdNextPos, y, '.');
|
||||
lcdDrawNumber(lcdNextPos, y, version.revision, LEFT);
|
||||
}
|
||||
}
|
||||
|
||||
void drawPXX2FullVersion(coord_t x, coord_t y, PXX2Version hwVersion, PXX2Version swVersion)
|
||||
{
|
||||
drawPXX2Version(x, y, hwVersion);
|
||||
lcdDrawText(lcdNextPos, y, "/");
|
||||
drawPXX2Version(lcdNextPos, y, swVersion);
|
||||
}
|
||||
|
||||
bool menuRadioModulesVersion(event_t event)
|
||||
{
|
||||
if (menuEvent) {
|
||||
moduleState[INTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
|
||||
moduleState[EXTERNAL_MODULE].mode = MODULE_MODE_NORMAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
drawMenuTemplate(STR_MENU_MODULES_RX_VERSION, 0, RADIO_ICONS, OPTION_MENU_TITLE_BAR);
|
||||
|
||||
if (event == EVT_ENTRY) {
|
||||
memclear(&reusableBuffer.hardwareAndSettings.modules, sizeof(reusableBuffer.hardwareAndSettings.modules));
|
||||
}
|
||||
|
||||
if (event == EVT_ENTRY || get_tmr10ms() >= reusableBuffer.hardwareAndSettings.updateTime) {
|
||||
if (isModulePXX2(INTERNAL_MODULE) && IS_INTERNAL_MODULE_ON()) {
|
||||
moduleState[INTERNAL_MODULE].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[INTERNAL_MODULE], PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
|
||||
}
|
||||
|
||||
if (isModulePXX2(EXTERNAL_MODULE) && IS_EXTERNAL_MODULE_ON()) {
|
||||
moduleState[EXTERNAL_MODULE].readModuleInformation(&reusableBuffer.hardwareAndSettings.modules[EXTERNAL_MODULE], PXX2_HW_INFO_TX_ID, PXX2_MAX_RECEIVERS_PER_MODULE - 1);
|
||||
}
|
||||
|
||||
reusableBuffer.hardwareAndSettings.updateTime = get_tmr10ms() + 1000 /* 10s*/;
|
||||
}
|
||||
|
||||
coord_t y = MENU_BODY_TOP - menuVerticalOffset * FH;
|
||||
|
||||
for (uint8_t module=0; module<NUM_MODULES; module++) {
|
||||
// Label
|
||||
if (y >= MENU_BODY_TOP && y < MENU_FOOTER_TOP) {
|
||||
if (module == INTERNAL_MODULE)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_INTERNAL_MODULE);
|
||||
else if (module == EXTERNAL_MODULE)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_EXTERNAL_MODULE);
|
||||
}
|
||||
y += FH;
|
||||
|
||||
// Module model
|
||||
if (y >= MENU_BODY_TOP && y < MENU_FOOTER_TOP) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, STR_MODULE);
|
||||
if (module == INTERNAL_MODULE) {
|
||||
if (!IS_INTERNAL_MODULE_ON()) {
|
||||
lcdDrawText(COLUMN2_X, y, STR_OFF);
|
||||
y += FH;
|
||||
continue;
|
||||
}
|
||||
if (!isModulePXX2(INTERNAL_MODULE)) {
|
||||
lcdDrawText(COLUMN2_X, y, STR_NO_INFORMATION);
|
||||
y += FH;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (module == EXTERNAL_MODULE) {
|
||||
if (!IS_EXTERNAL_MODULE_ON()) {
|
||||
lcdDrawText(COLUMN2_X, y, STR_OFF);
|
||||
y += FH;
|
||||
continue;
|
||||
}
|
||||
if (!isModulePXX2(EXTERNAL_MODULE)) {
|
||||
lcdDrawText(COLUMN2_X, y, STR_NO_INFORMATION);
|
||||
y += FH;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].information.modelID;
|
||||
lcdDrawText(COLUMN2_X, y, getPXX2ModuleName(modelId));
|
||||
}
|
||||
y += FH;
|
||||
|
||||
// Module version
|
||||
if (y >= MENU_BODY_TOP && y < MENU_FOOTER_TOP) {
|
||||
if (reusableBuffer.hardwareAndSettings.modules[module].information.modelID) {
|
||||
drawPXX2FullVersion(COLUMN2_X, y, reusableBuffer.hardwareAndSettings.modules[module].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].information.swVersion);
|
||||
static const char * variants[] = {"FCC", "EU", "FLEX"};
|
||||
uint8_t variant = reusableBuffer.hardwareAndSettings.modules[module].information.variant - 1;
|
||||
if (variant < DIM(variants)) {
|
||||
lcdDrawText(lcdNextPos + 1, y, variants[variant]);
|
||||
}
|
||||
}
|
||||
}
|
||||
y += FH;
|
||||
|
||||
for (uint8_t receiver=0; receiver<PXX2_MAX_RECEIVERS_PER_MODULE; receiver++) {
|
||||
if (reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID && reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].timestamp < get_tmr10ms() + 2000) {
|
||||
// Receiver model
|
||||
if (y >= MENU_BODY_TOP && y < MENU_FOOTER_TOP) {
|
||||
lcdDrawText(MENUS_MARGIN_LEFT + INDENT_WIDTH, y, STR_RECEIVER);
|
||||
lcdDrawNumber(lcdNextPos + 2, y, receiver + 1);
|
||||
uint8_t modelId = reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.modelID;
|
||||
lcdDrawText(COLUMN2_X, y, getPXX2ReceiverName(modelId));
|
||||
}
|
||||
y += FH;
|
||||
|
||||
// Receiver version
|
||||
if (y >= MENU_BODY_TOP && y < MENU_FOOTER_TOP) {
|
||||
drawPXX2FullVersion(COLUMN2_X, y, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.hwVersion, reusableBuffer.hardwareAndSettings.modules[module].receivers[receiver].information.swVersion);
|
||||
}
|
||||
y += FH;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t lines = (y - (FH + 1)) / FH + menuVerticalOffset;
|
||||
if (lines > NUM_BODY_LINES) {
|
||||
drawVerticalScrollbar(LCD_W-1, FH, LCD_H-FH, menuVerticalOffset, lines, NUM_BODY_LINES);
|
||||
}
|
||||
|
||||
switch(event) {
|
||||
case EVT_ROTARY_LEFT:
|
||||
if (lines > NUM_BODY_LINES) {
|
||||
if (menuVerticalOffset-- == 0)
|
||||
menuVerticalOffset = lines - 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_RIGHT:
|
||||
if (lines > NUM_BODY_LINES) {
|
||||
if (++menuVerticalOffset + NUM_BODY_LINES > lines)
|
||||
menuVerticalOffset = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_EXIT):
|
||||
if (menuVerticalOffset != 0)
|
||||
menuVerticalOffset = 0;
|
||||
else
|
||||
popMenu();
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool menuRadioVersion(event_t event)
|
||||
{
|
||||
char id[27];
|
||||
|
||||
#if 0
|
||||
if (warningResult) {
|
||||
warningResult = 0;
|
||||
showMessageBox(STR_STORAGE_FORMAT);
|
||||
storageEraseAll(false);
|
||||
NVIC_SystemReset();
|
||||
}
|
||||
#endif
|
||||
|
||||
getCPUUniqueID(id);
|
||||
|
||||
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, MENU_RADIO_VERSION, 0);
|
||||
SIMPLE_MENU(STR_MENUVERSION, RADIO_ICONS, menuTabGeneral, MENU_RADIO_VERSION, 1);
|
||||
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP, vers_stamp);
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + FH, date_stamp);
|
||||
@@ -45,15 +194,6 @@ bool menuRadioVersion(event_t event)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, MENU_CONTENT_TOP + 4*FH, "UID:");
|
||||
lcdDrawText(MENUS_MARGIN_LEFT + 64, MENU_CONTENT_TOP + 4*FH, id);
|
||||
|
||||
#if 0
|
||||
if (event == EVT_KEY_LONG(KEY_ENTER)) {
|
||||
killEvents(event);
|
||||
// POPUP_MENU_ADD_ITEM(STR_EEBACKUP);
|
||||
POPUP_MENU_ADD_ITEM(STR_FACTORYRESET);
|
||||
POPUP_MENU_START(onVersionMenu);
|
||||
}
|
||||
#endif
|
||||
|
||||
coord_t y = MENU_CONTENT_TOP + 5*FH;
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "OPTS:");
|
||||
lcdNextPos = MENUS_MARGIN_LEFT + 64;
|
||||
@@ -62,15 +202,27 @@ bool menuRadioVersion(event_t event)
|
||||
const char * option = options[i];
|
||||
coord_t width = getTextWidth(option);
|
||||
|
||||
if((lcdNextPos + 5 + width) > LCD_W) {
|
||||
if ((lcdNextPos + 5 + width) > LCD_W) {
|
||||
lcdDrawText(lcdNextPos, y, ",");
|
||||
lcdNextPos = MENUS_MARGIN_LEFT;
|
||||
y += FH;
|
||||
}
|
||||
if (i > 0 && lcdNextPos !=MENUS_MARGIN_LEFT)
|
||||
if (i > 0 && lcdNextPos !=MENUS_MARGIN_LEFT) {
|
||||
lcdDrawText(lcdNextPos, y, ", ");
|
||||
}
|
||||
lcdDrawText(lcdNextPos, y, option);
|
||||
}
|
||||
|
||||
#if defined(PXX2)
|
||||
y += FH + FH / 2;
|
||||
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, BUTTON(TR_MODULES_RX_VERSION), menuVerticalPosition == 0 ? INVERS : 0);
|
||||
y += FH;
|
||||
if (menuVerticalPosition == 0 && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
pushMenu(menuRadioModulesVersion);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -90,10 +90,10 @@ void Theme::drawBackground() const
|
||||
|
||||
void Theme::drawMessageBox(const char * title, const char * text, const char * action, uint32_t type) const
|
||||
{
|
||||
//if (flags & MESSAGEBOX_TYPE_ALERT) {
|
||||
// if (type == WARNING_TYPE_ALERT) {
|
||||
drawBackground();
|
||||
lcdDrawFilledRect(0, POPUP_Y, LCD_W, POPUP_H, SOLID, TEXT_INVERTED_COLOR | OPACITY(8));
|
||||
//}
|
||||
// }
|
||||
|
||||
if (type == WARNING_TYPE_ALERT || type == WARNING_TYPE_ASTERISK)
|
||||
lcd->drawBitmap(POPUP_X-80, POPUP_Y+12, asterisk);
|
||||
|
||||
@@ -85,6 +85,7 @@ class DarkblueTheme: public Theme
|
||||
loadMenuIcon(ICON_RADIO_SETUP, "mask_radio_setup.png");
|
||||
loadMenuIcon(ICON_RADIO_SD_MANAGER, "mask_radio_sd_browser.png");
|
||||
loadMenuIcon(ICON_RADIO_TOOLS, "mask_radio_tools.png");
|
||||
loadMenuIcon(ICON_RADIO_SPECTRUM_ANALYSER, "/mask_radio_spectrum_analyser.png");
|
||||
loadMenuIcon(ICON_RADIO_GLOBAL_FUNCTIONS, "mask_radio_global_functions.png");
|
||||
loadMenuIcon(ICON_RADIO_TRAINER, "mask_radio_trainer.png");
|
||||
loadMenuIcon(ICON_RADIO_HARDWARE, "mask_radio_hardware.png");
|
||||
|
||||
@@ -100,6 +100,7 @@ class DefaultTheme: public Theme
|
||||
loadMenuIcon(ICON_RADIO_SETUP, "mask_radio_setup.png");
|
||||
loadMenuIcon(ICON_RADIO_SD_MANAGER, "mask_radio_sd_browser.png");
|
||||
loadMenuIcon(ICON_RADIO_TOOLS, "mask_radio_tools.png");
|
||||
loadMenuIcon(ICON_RADIO_SPECTRUM_ANALYSER, "/mask_radio_spectrum_analyser.png");
|
||||
loadMenuIcon(ICON_RADIO_GLOBAL_FUNCTIONS, "mask_radio_global_functions.png");
|
||||
loadMenuIcon(ICON_RADIO_TRAINER, "mask_radio_trainer.png");
|
||||
loadMenuIcon(ICON_RADIO_HARDWARE, "mask_radio_hardware.png");
|
||||
|
||||
@@ -154,12 +154,6 @@ bool menuStatsDebug(event_t event)
|
||||
lcdDrawNumber(lcdNextPos+5, y, audioStack.available(), LEFT);
|
||||
y += FH;
|
||||
|
||||
#if defined(STM32)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, STR_RTC_BATT);
|
||||
drawValueWithUnit(MENU_STATS_COLUMN1, y, getRTCBatteryVoltage(), UNIT_VOLTS, PREC2|LEFT);
|
||||
y += FH;
|
||||
#endif
|
||||
|
||||
#if defined(DISK_CACHE) && defined(DEBUG)
|
||||
lcdDrawText(MENUS_MARGIN_LEFT, y, "SD cache hits");
|
||||
lcdDrawNumber(MENU_STATS_COLUMN1, y, diskCache.getHitRate(), PREC1|LEFT, 0, NULL, "%");
|
||||
|
||||
@@ -427,3 +427,21 @@ void drawShutdownAnimation(uint32_t duration, uint32_t totalDuration, const char
|
||||
lcdRefresh();
|
||||
lastDuration = duration;
|
||||
}
|
||||
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags)
|
||||
{
|
||||
if (isModulePXX2(moduleIdx)) {
|
||||
if (g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx][0] != '\0')
|
||||
lcdDrawSizedText(x, y, g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], effectiveLen(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME), flags);
|
||||
else
|
||||
lcdDrawText(x, y, "---", flags);
|
||||
}
|
||||
#if defined(HARDWARE_INTERNAL_MODULE)
|
||||
else if (moduleIdx == INTERNAL_MODULE) {
|
||||
lcdDrawText(x, y, "Internal", flags);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
lcdDrawText(x, y, "External", flags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,4 +76,6 @@ void drawTopBar();
|
||||
void drawMainPots();
|
||||
void drawTrims(uint8_t flightMode);
|
||||
|
||||
void drawReceiverName(coord_t x, coord_t y, uint8_t moduleIdx, uint8_t receiverIdx, LcdFlags flags);
|
||||
|
||||
#endif // _WIDGETS_H_
|
||||
|
||||
@@ -5,6 +5,7 @@ set(SRC
|
||||
${SRC}
|
||||
gui/navigation/common.cpp
|
||||
gui/navigation/navigation_${NAVIGATION_TYPE}.cpp
|
||||
gui/screenshot.cpp
|
||||
)
|
||||
|
||||
string(TOUPPER ${NAVIGATION_TYPE} NAVIGATION_TYPE)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
#include <math.h>
|
||||
|
||||
#define RECEIVER_OPTIONS_2ND_COLUMN (11*FW)
|
||||
|
||||
@@ -75,7 +75,6 @@ void startBindMenu(uint8_t moduleIdx)
|
||||
if (isTelemAllowedOnBind(moduleIdx) && g_model.moduleData[moduleIdx].pxx.receiver_telem_off)
|
||||
selection += 1;
|
||||
|
||||
|
||||
POPUP_MENU_SELECT_ITEM(selection);
|
||||
POPUP_MENU_START(onBindMenu);
|
||||
}
|
||||
|
||||
@@ -20,35 +20,6 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
bool isPXX2ReceiverUsed(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
return g_model.moduleData[moduleIdx].pxx2.receivers & (1 << receiverIdx);
|
||||
}
|
||||
|
||||
void setPXX2ReceiverUsed(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
g_model.moduleData[moduleIdx].pxx2.receivers |= (1 << receiverIdx);
|
||||
}
|
||||
|
||||
bool isPXX2ReceiverEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
return is_memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
}
|
||||
|
||||
void removePXX2Receiver(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
g_model.moduleData[moduleIdx].pxx2.receivers &= ~(1 << receiverIdx);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
void removePXX2ReceiverIfEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
if (isPXX2ReceiverEmpty(moduleIdx, receiverIdx)) {
|
||||
removePXX2Receiver(moduleIdx, receiverIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void onPXX2R9MBindModeMenu(const char * result)
|
||||
{
|
||||
if (result == STR_16CH_WITH_TELEMETRY) {
|
||||
@@ -68,6 +39,7 @@ void onPXX2R9MBindModeMenu(const char * result)
|
||||
uint8_t moduleIdx = CURRENT_MODULE_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
uint8_t receiverIdx = CURRENT_RECEIVER_EDITED(menuVerticalPosition - HEADER_LINE);
|
||||
moduleState[moduleIdx].mode = MODULE_MODE_NORMAL;
|
||||
reusableBuffer.moduleSetup.bindInformation.step = 0;
|
||||
removePXX2ReceiverIfEmpty(moduleIdx, receiverIdx);
|
||||
return;
|
||||
}
|
||||
@@ -279,8 +251,7 @@ void modelSetupModulePxx2ReceiverLine(uint8_t moduleIdx, uint8_t receiverIdx, co
|
||||
|
||||
if (!isPXX2ReceiverUsed(moduleIdx, receiverIdx)) {
|
||||
lcdDrawText(MODEL_SETUP_2ND_COLUMN, y, STR_MODULE_BIND, attr);
|
||||
if (attr && s_editMode > 0) {
|
||||
killEvents(event);
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
setPXX2ReceiverUsed(moduleIdx, receiverIdx);
|
||||
memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
onPXX2ReceiverMenu(STR_BIND);
|
||||
@@ -341,8 +312,7 @@ void modelSetupModulePxx2ReceiverLine(uint8_t moduleIdx, uint8_t receiverIdx, co
|
||||
}
|
||||
}
|
||||
|
||||
if (attr && EVT_KEY_MASK(event) == KEY_ENTER) {
|
||||
killEvents(event);
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
POPUP_MENU_ADD_ITEM(STR_BIND);
|
||||
POPUP_MENU_ADD_ITEM(STR_OPTIONS);
|
||||
POPUP_MENU_ADD_ITEM(STR_SHARE);
|
||||
|
||||
@@ -581,7 +581,7 @@ void menuRadioHardware(event_t event)
|
||||
lcdDrawTextAlignedLeft(y, STR_DEBUG);
|
||||
lcdDrawText(HW_SETTINGS_COLUMN2, y, STR_ANALOGS_BTN, menuHorizontalPosition == 0 ? attr : 0);
|
||||
lcdDrawText(lcdLastRightPos + 2, y, STR_KEYS_BTN, menuHorizontalPosition == 1 ? attr : 0);
|
||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
if (menuHorizontalPosition == 0)
|
||||
pushMenu(menuRadioDiagAnalogs);
|
||||
else
|
||||
@@ -591,7 +591,7 @@ void menuRadioHardware(event_t event)
|
||||
|
||||
case ITEM_RADIO_BACKUP_EEPROM:
|
||||
lcdDrawText(LCD_W / 2, y, BUTTON(STR_EEBACKUP), attr | CENTERED);
|
||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
eepromBackup();
|
||||
}
|
||||
@@ -599,7 +599,7 @@ void menuRadioHardware(event_t event)
|
||||
|
||||
case ITEM_RADIO_FACTORY_RESET:
|
||||
lcdDrawText(LCD_W / 2, y, BUTTON(STR_FACTORYRESET), attr | CENTERED);
|
||||
if (attr && event == EVT_KEY_FIRST(KEY_ENTER)) {
|
||||
if (attr && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = EDIT_SELECT_FIELD;
|
||||
POPUP_CONFIRMATION(STR_CONFIRMRESET, onFactoryResetConfirm);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <opentx.h>
|
||||
#include "opentx.h"
|
||||
|
||||
extern uint8_t g_moduleIdx;
|
||||
|
||||
@@ -33,8 +33,9 @@
|
||||
#define MENU_BODY_TOP (FH + 1)
|
||||
#define MENU_BODY_BOTTOM (LCD_H)
|
||||
|
||||
#if defined(PXX2)
|
||||
constexpr uint8_t COLUMN2_X = 10 * FW;
|
||||
|
||||
#endif
|
||||
|
||||
void menuRadioFirmwareOptions(event_t event)
|
||||
{
|
||||
@@ -240,13 +241,15 @@ void menuRadioVersion(event_t event)
|
||||
|
||||
#if defined(COPROCESSOR)
|
||||
lcdDrawText(FW, y, "COPR\037\033: ", SMLSIZE);
|
||||
if (Coproc_valid == 1)
|
||||
lcdDrawNumber(lcdNextPos, y, Coproc_read, SMLSIZE);
|
||||
if (coprocData.valid == 1)
|
||||
lcdDrawNumber(lcdNextPos, y, coprocData.read, SMLSIZE);
|
||||
else
|
||||
lcdDrawText(lcdNextPos, y, "---", SMLSIZE);
|
||||
y += FH - 1;
|
||||
#endif
|
||||
|
||||
y += 2;
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
lcdDrawText(INDENT_WIDTH, y, BUTTON(TR_FIRMWARE_OPTIONS), menuVerticalPosition == ITEM_RADIO_FIRMWARE_OPTIONS ? INVERS : 0);
|
||||
y += FH;
|
||||
@@ -255,6 +258,7 @@ void menuRadioVersion(event_t event)
|
||||
pushMenu(menuRadioFirmwareOptions);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
lcdDrawText(INDENT_WIDTH, y, BUTTON(TR_MODULES_RX_VERSION), menuVerticalPosition == ITEM_RADIO_MODULES_VERSION ? INVERS : 0);
|
||||
y += FH;
|
||||
|
||||
@@ -233,12 +233,10 @@ bool isSourceAvailableInCustomSwitches(int source)
|
||||
{
|
||||
bool result = isSourceAvailable(source);
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
if (result && source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source - MIXSRC_FIRST_TELEM, 3);
|
||||
result = isTelemetryFieldComparisonAvailable(qr.quot);
|
||||
}
|
||||
#endif
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -617,7 +615,7 @@ bool isExternalModuleAvailable(int moduleType)
|
||||
if (moduleType == MODULE_TYPE_ISRM_PXX2)
|
||||
return false; // doesn't exist for now
|
||||
|
||||
#if !defined(PXX2)
|
||||
#if !defined(PXX2) || !defined(EXTMODULE_USART)
|
||||
if (moduleType == MODULE_TYPE_XJT_LITE_PXX2 || moduleType == MODULE_TYPE_R9M_PXX2 || moduleType == MODULE_TYPE_R9M_LITE_PXX2 || moduleType == MODULE_TYPE_R9M_LITE_PRO_PXX2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
typedef bool (*IsValueAvailable)(int);
|
||||
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=NULL);
|
||||
int circularIncDec(int current, int inc, int min, int max, IsValueAvailable isValueAvailable=nullptr);
|
||||
int getFirstAvailable(int min, int max, IsValueAvailable isValueAvailable);
|
||||
|
||||
bool isTrimModeAvailable(int mode);
|
||||
@@ -108,7 +108,7 @@ void drawSourceValue(coord_t x, coord_t y, source_t channel, LcdFlags flags=0);
|
||||
void drawCurve(coord_t offset=0);
|
||||
|
||||
#if defined(COLORLCD)
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags=0, const char * prefix=NULL, const char * suffix=NULL);
|
||||
void drawStringWithIndex(coord_t x, coord_t y, const char * str, int idx, LcdFlags flags=0, const char * prefix=nullptr, const char * suffix=nullptr);
|
||||
int editChoice(coord_t x, coord_t y, const char * values, int value, int min, int max, LcdFlags flags, event_t event);
|
||||
uint8_t editCheckBox(uint8_t value, coord_t x, coord_t y, LcdFlags flags, event_t event);
|
||||
swsrc_t editSwitch(coord_t x, coord_t y, swsrc_t value, LcdFlags flags, event_t event);
|
||||
@@ -163,4 +163,6 @@ inline uint8_t MULTIMODULE_RFPROTO_COLUMNS(uint8_t moduleIdx)
|
||||
|
||||
void editStickHardwareSettings(coord_t x, coord_t y, int idx, event_t event, LcdFlags flags);
|
||||
|
||||
const char * writeScreenshot();
|
||||
|
||||
#endif // _GUI_COMMON_H_
|
||||
|
||||
@@ -242,8 +242,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
menuEntryTime = get_tmr10ms();
|
||||
l_posVert = 0;
|
||||
@@ -271,7 +270,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
case EVT_KEY_FIRST(KEY_ENTER):
|
||||
if (!menuTab || l_posVert>0) {
|
||||
if (READ_ONLY_UNLOCKED()) {
|
||||
s_editMode = (s_editMode<=0);
|
||||
s_editMode = (s_editMode <= 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -287,6 +286,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
}
|
||||
// no break
|
||||
#endif
|
||||
|
||||
case EVT_KEY_LONG(KEY_EXIT):
|
||||
s_editMode = 0; // TODO needed? we call ENTRY_UP after which does the same
|
||||
popMenu();
|
||||
|
||||
@@ -262,7 +262,8 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc * menuTab, uint8_t
|
||||
break;
|
||||
|
||||
case EVT_ROTARY_BREAK:
|
||||
if (s_editMode > 1) break;
|
||||
if (s_editMode > 1)
|
||||
break;
|
||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
l_posHorz = 0;
|
||||
AUDIO_KEY_PRESS();
|
||||
|
||||
@@ -373,7 +373,8 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
break;
|
||||
|
||||
case EVT_KEY_BREAK(KEY_ENTER):
|
||||
if (s_editMode > 1) break;
|
||||
if (s_editMode > 1)
|
||||
break;
|
||||
if (menuHorizontalPosition < 0 && maxcol > 0 && READ_ONLY_UNLOCKED()) {
|
||||
l_posHorz = 0;
|
||||
AUDIO_KEY_PRESS();
|
||||
|
||||
@@ -145,7 +145,7 @@ int checkIncDec(event_t event, int val, int i_min, int i_max, unsigned int i_fla
|
||||
}
|
||||
}
|
||||
|
||||
if (!READ_ONLY() && i_min==0 && i_max==1 && (event==EVT_KEY_BREAK(KEY_ENTER))) {
|
||||
if (!READ_ONLY() && i_min == 0 && i_max == 1 && event == EVT_KEY_BREAK(KEY_ENTER)) {
|
||||
s_editMode = 0;
|
||||
newval = !val;
|
||||
}
|
||||
@@ -318,8 +318,7 @@ void check(event_t event, uint8_t curr, const MenuHandlerFunc *menuTab, uint8_t
|
||||
drawScreenIndex(curr, menuTabSize, attr);
|
||||
}
|
||||
|
||||
switch (event)
|
||||
{
|
||||
switch (event) {
|
||||
case EVT_ENTRY:
|
||||
menuEntryTime = get_tmr10ms();
|
||||
l_posVert = 0;
|
||||
|
||||
@@ -20,9 +20,27 @@
|
||||
|
||||
#include "opentx.h"
|
||||
|
||||
constexpr uint16_t BMP_HEADERSIZE = 0x76;
|
||||
|
||||
#if defined(COLORLCD)
|
||||
constexpr uint8_t BMP_BITS_PER_PIXEL = 32;
|
||||
#else
|
||||
constexpr uint8_t BMP_BITS_PER_PIXEL = 4;
|
||||
#endif
|
||||
|
||||
constexpr uint32_t BMP_FILESIZE = uint32_t(BMP_HEADERSIZE + (LCD_W * LCD_H) * BMP_BITS_PER_PIXEL / 8);
|
||||
|
||||
const uint8_t BMP_HEADER[] = {
|
||||
0x42, 0x4d, 0xF8, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x00, 0x28, 0x00,
|
||||
0x00, 0x00, LCD_W, 0x00, 0x00, 0x00, LCD_H, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
|
||||
'B', 'M',
|
||||
/* file size */ BMP_FILESIZE & 0xFF, (BMP_FILESIZE >> 8) & 0xFF, (BMP_FILESIZE >> 16) & 0xFF, (BMP_FILESIZE >> 24) & 0xFF,
|
||||
0x00, 0x00, 0x00, 0x00,
|
||||
/* header size */ BMP_HEADERSIZE, 0x00, 0x00, 0x00,
|
||||
/* extra header size */ 0x28, 0x00, 0x00, 0x00,
|
||||
/* width */ LCD_W & 0xFF, LCD_W >> 8, 0x00, 0x00,
|
||||
/* height */ LCD_H & 0xFF, LCD_H >> 8, 0x00, 0x00,
|
||||
/* planes */ 0x01, 0x00,
|
||||
/* depth */ BMP_BITS_PER_PIXEL, 0x00,
|
||||
0x00, 0x00,
|
||||
0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0xbc, 0x38, 0x00, 0x00, 0xbc, 0x38, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xee, 0xee, 0xee, 0x00, 0xdd, 0xdd,
|
||||
0xdd, 0x00, 0xcc, 0xcc, 0xcc, 0x00, 0xbb, 0xbb, 0xbb, 0x00, 0xaa, 0xaa, 0xaa, 0x00, 0x99, 0x99,
|
||||
@@ -59,18 +77,30 @@ const char * writeScreenshot()
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
|
||||
for (int y=LCD_H-1; y>=0; y-=1) {
|
||||
for (int x=0; x<8*((LCD_W+7)/8); x+=2) {
|
||||
uint8_t byte = getPixel(x+1, y) + (getPixel(x, y) << 4);
|
||||
f_write(&bmpFile, &byte, 1, &written);
|
||||
if (result != FR_OK || written != 1) {
|
||||
#if defined(COLORLCD)
|
||||
for (int y = LCD_H - 1; y >= 0; y--) {
|
||||
for (int x = 0; x < LCD_W; x++) {
|
||||
display_t pixel = *lcd->getPixelPtr(x, y);
|
||||
uint32_t dst = (0xFF << 24) + (GET_RED(pixel) << 16) + (GET_GREEN(pixel) << 8) + (GET_BLUE(pixel) << 0);
|
||||
if (f_write(&bmpFile, &dst, sizeof(dst), &written) != FR_OK || written != sizeof(dst)) {
|
||||
f_close(&bmpFile);
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
for (int y=LCD_H-1; y>=0; y-=1) {
|
||||
for (int x=0; x<8*((LCD_W+7)/8); x+=2) {
|
||||
display_t byte = getPixel(x+1, y) + (getPixel(x, y) << 4);
|
||||
if (f_write(&bmpFile, &byte, 1, &written) != FR_OK || written != 1) {
|
||||
f_close(&bmpFile);
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
f_close(&bmpFile);
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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 _HELPERS_H_
|
||||
#define _HELPERS_H_
|
||||
|
||||
template<class t> inline t min(t a, t b) { return a<b?a:b; }
|
||||
template<class t> inline t max(t a, t b) { return a>b?a:b; }
|
||||
template<class t> inline t sgn(t a) { return a>0 ? 1 : (a < 0 ? -1 : 0); }
|
||||
template<class t> inline t limit(t mi, t x, t ma) { return min(max(mi,x),ma); }
|
||||
template<class t> inline void SWAP(t & a, t & b) { t tmp = b; b = a; a = tmp; }
|
||||
|
||||
#endif // _HELPERS_H_
|
||||
@@ -96,28 +96,6 @@ void FrskyDeviceFirmwareUpdate::processFrame(const uint8_t * frame)
|
||||
}
|
||||
}
|
||||
|
||||
void FrskyDeviceFirmwareUpdate::startup()
|
||||
{
|
||||
switch(module) {
|
||||
#if defined(INTMODULE_USART)
|
||||
case INTERNAL_MODULE:
|
||||
intmoduleSerialStart(INTMODULE_FLASH_BAUDRATE, true);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
telemetryInit(PROTOCOL_TELEMETRY_FRSKY_SPORT);
|
||||
break;
|
||||
}
|
||||
|
||||
if (module == INTERNAL_MODULE)
|
||||
INTERNAL_MODULE_ON();
|
||||
else if (module == EXTERNAL_MODULE)
|
||||
EXTERNAL_MODULE_ON();
|
||||
else
|
||||
SPORT_UPDATE_POWER_ON();
|
||||
}
|
||||
|
||||
bool FrskyDeviceFirmwareUpdate::readBuffer(uint8_t * buffer, uint8_t count, uint32_t timeout)
|
||||
{
|
||||
watchdogSuspend(timeout);
|
||||
@@ -310,10 +288,11 @@ const char * FrskyDeviceFirmwareUpdate::sendReqVersion()
|
||||
return "Version request failed";
|
||||
}
|
||||
|
||||
const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename)
|
||||
{
|
||||
FIL file;
|
||||
uint32_t buffer[1024 / sizeof(uint32_t)];
|
||||
const char * result;
|
||||
FrSkyFirmwareInformation information;
|
||||
UINT count;
|
||||
|
||||
if (f_open(&file, filename, FA_READ) != FR_OK) {
|
||||
@@ -322,14 +301,57 @@ const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
|
||||
const char * ext = getFileExtension(filename);
|
||||
if (ext && !strcasecmp(ext, UPDATE_FIRMWARE_EXT)) {
|
||||
// FrSkyFirmwareInformation * information = (FrSkyFirmwareInformation *) buffer;
|
||||
if (f_read(&file, buffer, sizeof(FrSkyFirmwareInformation), &count) != FR_OK || count != sizeof(FrSkyFirmwareInformation)) {
|
||||
if (f_read(&file, &information, sizeof(FrSkyFirmwareInformation), &count) != FR_OK || count != sizeof(FrSkyFirmwareInformation)) {
|
||||
f_close(&file);
|
||||
return "Format error";
|
||||
}
|
||||
} else {
|
||||
#if defined(PCBHORUS)
|
||||
information.productId = FIRMWARE_ID_XJT;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
if (module == INTERNAL_MODULE && information.productId == FIRMWARE_ID_XJT) {
|
||||
INTERNAL_MODULE_ON();
|
||||
intmoduleSerialStart(38400, true);
|
||||
GPIO_SetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
|
||||
result = uploadFileToHorusXJT(filename, &file);
|
||||
GPIO_ResetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
|
||||
f_close(&file);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (module) {
|
||||
#if defined(INTMODULE_USART)
|
||||
case INTERNAL_MODULE:
|
||||
intmoduleSerialStart(57600, true);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
telemetryInit(PROTOCOL_TELEMETRY_FRSKY_SPORT);
|
||||
break;
|
||||
}
|
||||
|
||||
if (module == INTERNAL_MODULE)
|
||||
INTERNAL_MODULE_ON();
|
||||
else if (module == EXTERNAL_MODULE)
|
||||
EXTERNAL_MODULE_ON();
|
||||
else
|
||||
SPORT_UPDATE_POWER_ON();
|
||||
|
||||
result = uploadFileNormal(filename, &file);
|
||||
f_close(&file);
|
||||
return result;
|
||||
}
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
const char * FrskyDeviceFirmwareUpdate::uploadFileToHorusXJT(const char * filename, FIL * file)
|
||||
{
|
||||
uint32_t buffer[1024 / sizeof(uint32_t)];
|
||||
UINT count;
|
||||
uint8_t frame[8];
|
||||
|
||||
if (!readBuffer(frame, 8, 100) || frame[0] != 0x01) {
|
||||
@@ -347,11 +369,10 @@ const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
readBuffer(frame, 1, 100);
|
||||
|
||||
uint8_t index = 0;
|
||||
while (1) {
|
||||
drawProgressScreen(getBasename(filename), STR_WRITING, file.fptr, file.obj.objsize);
|
||||
while (true) {
|
||||
drawProgressScreen(getBasename(filename), STR_WRITING, file->fptr, file->obj.objsize);
|
||||
|
||||
if (f_read(&file, buffer, 1024, &count) != FR_OK) {
|
||||
f_close(&file);
|
||||
if (f_read(file, buffer, 1024, &count) != FR_OK) {
|
||||
return "Error reading file";
|
||||
}
|
||||
|
||||
@@ -362,7 +383,6 @@ const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
return "Wrong request";
|
||||
|
||||
if (count == 0) {
|
||||
f_close(&file);
|
||||
intmoduleSendByte(0xA1);
|
||||
RTOS_WAIT_MS(50);
|
||||
return nullptr;
|
||||
@@ -375,7 +395,7 @@ const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
intmoduleSendByte(frame[1]);
|
||||
|
||||
uint16_t crc_16 = crc16(CRC_1189, (uint8_t *)buffer, 1024, crc16(CRC_1189, &frame[1], 1));
|
||||
for (unsigned i = 0; i < sizeof(buffer); i++) {
|
||||
for (size_t i = 0; i < sizeof(buffer); i++) {
|
||||
intmoduleSendByte(((uint8_t *)buffer)[i]);
|
||||
}
|
||||
intmoduleSendByte(crc_16 >> 8);
|
||||
@@ -383,7 +403,22 @@ const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
|
||||
index++;
|
||||
}
|
||||
#else
|
||||
}
|
||||
#endif
|
||||
|
||||
const char * FrskyDeviceFirmwareUpdate::uploadFileNormal(const char * filename, FIL * file)
|
||||
{
|
||||
uint32_t buffer[1024 / sizeof(uint32_t)];
|
||||
UINT count;
|
||||
|
||||
const char * result = sendPowerOn();
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
result = sendReqVersion();
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
RTOS_WAIT_MS(200);
|
||||
telemetryClearFifo();
|
||||
|
||||
@@ -391,9 +426,8 @@ const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
startFrame(PRIM_CMD_DOWNLOAD);
|
||||
sendFrame();
|
||||
|
||||
while (1) {
|
||||
if (f_read(&file, buffer, 1024, &count) != FR_OK) {
|
||||
f_close(&file);
|
||||
while (true) {
|
||||
if (f_read(file, buffer, 1024, &count) != FR_OK) {
|
||||
return "Error reading file";
|
||||
}
|
||||
|
||||
@@ -410,16 +444,16 @@ const char * FrskyDeviceFirmwareUpdate::uploadFile(const char * filename)
|
||||
state = SPORT_DATA_TRANSFER,
|
||||
sendFrame();
|
||||
if (i == 0) {
|
||||
drawProgressScreen(getBasename(filename), STR_WRITING, file.fptr, file.obj.objsize);
|
||||
drawProgressScreen(getBasename(filename), STR_WRITING, file->fptr, file->obj.objsize);
|
||||
}
|
||||
}
|
||||
|
||||
if (count < 256) {
|
||||
f_close(&file);
|
||||
return nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return endTransfer();
|
||||
}
|
||||
|
||||
const char * FrskyDeviceFirmwareUpdate::endTransfer()
|
||||
@@ -434,28 +468,6 @@ const char * FrskyDeviceFirmwareUpdate::endTransfer()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char * FrskyDeviceFirmwareUpdate::doFlashFirmware(const char * filename)
|
||||
{
|
||||
const char * result;
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
if (module == INTERNAL_MODULE) {
|
||||
intmoduleSerialStart(38400, true);
|
||||
GPIO_SetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
|
||||
result = uploadFile(filename);
|
||||
GPIO_ResetBits(INTMODULE_BOOTCMD_GPIO, INTMODULE_BOOTCMD_GPIO_PIN);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
result = sendPowerOn();
|
||||
if (!result) result = sendReqVersion();
|
||||
if (!result) result = uploadFile(filename);
|
||||
if (!result) result = endTransfer();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
const char * FrskyDeviceFirmwareUpdate::flashFirmware(const char * filename)
|
||||
{
|
||||
pausePulses();
|
||||
@@ -476,8 +488,6 @@ const char * FrskyDeviceFirmwareUpdate::flashFirmware(const char * filename)
|
||||
watchdogSuspend(2000);
|
||||
RTOS_WAIT_MS(2000);
|
||||
|
||||
startup();
|
||||
|
||||
const char * result = doFlashFirmware(filename);
|
||||
|
||||
AUDIO_PLAY(AU_SPECIAL_SOUND_BEEP1 );
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "dataconstants.h"
|
||||
#include "definitions.h"
|
||||
#include "frsky_pxx2.h"
|
||||
#include "ff.h"
|
||||
|
||||
enum FrskyFirmwareProductFamily {
|
||||
FIRMWARE_FAMILY_INTERNAL_MODULE,
|
||||
@@ -34,6 +35,12 @@ enum FrskyFirmwareProductFamily {
|
||||
FIRMWARE_FAMILY_POWER_MANAGEMENT_UNIT,
|
||||
};
|
||||
|
||||
enum FrskyFirmwareProductId {
|
||||
FIRMWARE_ID_NONE,
|
||||
FIRMWARE_ID_XJT = 0x01,
|
||||
FIRMWARE_ID_ISRM = 0x02,
|
||||
};
|
||||
|
||||
PACK(struct FrSkyFirmwareInformation {
|
||||
uint32_t fourcc;
|
||||
uint8_t headerVersion;
|
||||
@@ -74,8 +81,6 @@ class FrskyDeviceFirmwareUpdate {
|
||||
ModuleIndex module;
|
||||
uint8_t frame[12];
|
||||
|
||||
void startup();
|
||||
|
||||
void startFrame(uint8_t command);
|
||||
void sendFrame();
|
||||
|
||||
@@ -89,7 +94,8 @@ class FrskyDeviceFirmwareUpdate {
|
||||
const char * doFlashFirmware(const char * filename);
|
||||
const char * sendPowerOn();
|
||||
const char * sendReqVersion();
|
||||
const char * uploadFile(const char * filename);
|
||||
const char * uploadFileNormal(const char * filename, FIL * file);
|
||||
const char * uploadFileToHorusXJT(const char * filename, FIL * file);
|
||||
const char * endTransfer();
|
||||
};
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
|
||||
#include "dataconstants.h"
|
||||
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
PACK(union SportTelemetryPacket
|
||||
{
|
||||
struct {
|
||||
@@ -34,7 +33,6 @@ PACK(union SportTelemetryPacket
|
||||
};
|
||||
uint8_t raw[8];
|
||||
});
|
||||
#endif
|
||||
|
||||
#if defined(STM32)
|
||||
bool isBootloader(const char * filename);
|
||||
|
||||
@@ -134,7 +134,6 @@ void writeHeader()
|
||||
f_puts("Time,", &g_oLogFile);
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
|
||||
char label[TELEM_LABEL_LEN+7];
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
@@ -155,7 +154,6 @@ void writeHeader()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS) || defined(PCBHORUS)
|
||||
for (uint8_t i=1; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS+1; i++) {
|
||||
@@ -229,7 +227,6 @@ void logsWrite()
|
||||
f_printf(&g_oLogFile, "%d,", tmr10ms);
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
for (int i=0; i<MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor & sensor = g_model.telemetrySensors[i];
|
||||
@@ -267,7 +264,6 @@ void logsWrite()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (uint8_t i=0; i<NUM_STICKS+NUM_POTS+NUM_SLIDERS; i++) {
|
||||
f_printf(&g_oLogFile, "%d,", calibratedAnalogs[i]);
|
||||
|
||||
+2
-3
@@ -312,7 +312,8 @@ void guiMain(event_t evt)
|
||||
}
|
||||
if (menu) {
|
||||
const char * result = runPopupMenu(evt);
|
||||
if (popupMenuItemsCount == 0) {
|
||||
if (result) {
|
||||
TRACE("popupMenuHandler(%s)", result);
|
||||
popupMenuHandler(result);
|
||||
if (menuEvent == 0) {
|
||||
evt = EVT_REFRESH;
|
||||
@@ -528,12 +529,10 @@ void perMain()
|
||||
DEBUG_TIMER_STOP(debugTimerGuiMain);
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (mainRequestFlags & (1 << REQUEST_SCREENSHOT)) {
|
||||
writeScreenshot();
|
||||
mainRequestFlags &= ~(1 << REQUEST_SCREENSHOT);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9E) && !defined(SIMU)
|
||||
toplcdRefreshStart();
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#define GET_SBUS_POLARITY(idx) g_model.moduleData[idx].sbus.noninverted
|
||||
#define GET_MODULE_PPM_DELAY(idx) (g_model.moduleData[idx].ppm.delay * 50 + 300)
|
||||
#define GET_TRAINER_PPM_DELAY() (g_model.trainerData.delay * 50 + 300)
|
||||
#define SET_DEFAULT_PPM_FRAME_LENGTH(idx) g_model.moduleData[idx].ppm.frameLength = 4 * max((int8_t)0, g_model.moduleData[idx].channelsCount)
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define IS_TRAINER_EXTERNAL_MODULE() false
|
||||
|
||||
@@ -196,11 +196,9 @@ void per10ms()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) || defined(TELEMETRY_JETI)
|
||||
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol[0])) {
|
||||
telemetryInterrupt10ms();
|
||||
}
|
||||
#endif
|
||||
|
||||
// These moved here from evalFlightModeMixes() to improve beep trigger reliability.
|
||||
#if defined(PWM_BACKLIGHT)
|
||||
@@ -674,7 +672,6 @@ getvalue_t convert16bitsTelemValue(source_t channel, ls_telemetry_value_t value)
|
||||
return value;
|
||||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
ls_telemetry_value_t minTelemValue(source_t channel)
|
||||
{
|
||||
return 0;
|
||||
@@ -684,7 +681,6 @@ ls_telemetry_value_t maxTelemValue(source_t channel)
|
||||
{
|
||||
return 30000;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define INAC_STICKS_SHIFT 6
|
||||
#define INAC_SWITCHES_SHIFT 8
|
||||
@@ -1330,9 +1326,7 @@ void flightReset(uint8_t check)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
telemetryReset();
|
||||
#endif
|
||||
|
||||
s_mixer_first_run_done = false;
|
||||
|
||||
@@ -1580,9 +1574,7 @@ void opentxClose(uint8_t shutdown)
|
||||
watchdogSuspend(2000/*20s*/);
|
||||
pausePulses(); // stop mixer task to disable trims processing while in shutdown
|
||||
AUDIO_BYE();
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
// TODO needed? telemetryEnd();
|
||||
#endif
|
||||
#if defined(LUA)
|
||||
luaClose(&lsScripts);
|
||||
#if defined(COLORLCD)
|
||||
@@ -1733,6 +1725,9 @@ void copyTrimsToOffset(uint8_t ch)
|
||||
|
||||
inline uint32_t PWR_PRESS_DURATION_MIN()
|
||||
{
|
||||
if (g_eeGeneral.version != EEPROM_VER)
|
||||
return 200;
|
||||
|
||||
return (2 - g_eeGeneral.pwrOnSpeed) * 100;
|
||||
}
|
||||
|
||||
@@ -1822,7 +1817,8 @@ void opentxInit()
|
||||
#endif
|
||||
|
||||
#if defined(EEPROM)
|
||||
storageReadRadioSettings();
|
||||
storageClearRadioSetting();
|
||||
storageReadRadioSettings(false);
|
||||
#endif
|
||||
|
||||
BACKLIGHT_ENABLE(); // we start the backlight during the startup animation
|
||||
@@ -1881,6 +1877,7 @@ void opentxInit()
|
||||
#endif
|
||||
|
||||
#if defined(EEPROM)
|
||||
storageReadRadioSettings(true);
|
||||
storageReadCurrentModel();
|
||||
#endif
|
||||
|
||||
|
||||
+10
-31
@@ -103,7 +103,7 @@
|
||||
#define CASE_PWM_BACKLIGHT(x)
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && defined(GPS)
|
||||
#if defined(GPS)
|
||||
#define CASE_GPS(x) x,
|
||||
#else
|
||||
#define CASE_GPS(x)
|
||||
@@ -133,12 +133,6 @@
|
||||
#define CASE_PWR_BUTTON_PRESS(x)
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
#define CASE_FRSKY(x) x,
|
||||
#else
|
||||
#define CASE_FRSKY(x)
|
||||
#endif
|
||||
|
||||
#if defined(PXX1)
|
||||
#define CASE_PXX1(x) x,
|
||||
#else
|
||||
@@ -372,20 +366,21 @@ extern uint8_t channelOrder(uint8_t x);
|
||||
|
||||
#define THRCHK_DEADBAND 16
|
||||
|
||||
inline bool SPLASH_NEEDED()
|
||||
{
|
||||
#if defined(COLORLCD)
|
||||
#define SPLASH_NEEDED() (false)
|
||||
#elif defined(PCBTARANIS)
|
||||
#define SPLASH_NEEDED() (g_eeGeneral.splashMode != 3)
|
||||
return false;
|
||||
#else
|
||||
#define SPLASH_NEEDED() (g_model.moduleData[EXTERNAL_MODULE].type != MODULE_TYPE_DSM2 && !g_eeGeneral.splashMode)
|
||||
return g_eeGeneral.splashMode != 3;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define SPLASH_TIMEOUT 0 /* we use the splash duration to load stuff from the SD */
|
||||
#elif defined(PCBTARANIS)
|
||||
#define SPLASH_TIMEOUT (g_eeGeneral.splashMode==-4 ? 1500 : (g_eeGeneral.splashMode<=0 ? (400-g_eeGeneral.splashMode*200) : (400-g_eeGeneral.splashMode*100)))
|
||||
#define SPLASH_TIMEOUT (g_eeGeneral.splashMode == -4 ? 1500 : (g_eeGeneral.splashMode <= 0 ? (400-g_eeGeneral.splashMode * 200) : (400 - g_eeGeneral.splashMode * 100)))
|
||||
#else
|
||||
#define SPLASH_TIMEOUT (4*100) // 4 seconds
|
||||
#define SPLASH_TIMEOUT (4 * 100) // 4 seconds
|
||||
#endif
|
||||
|
||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||
@@ -630,12 +625,9 @@ void checkAll();
|
||||
void getADC();
|
||||
static inline void GET_ADC_IF_MIXER_NOT_RUNNING()
|
||||
{
|
||||
do {
|
||||
if (s_pulses_paused) {
|
||||
getADC();
|
||||
}
|
||||
if (s_pulses_paused) {
|
||||
getADC();
|
||||
}
|
||||
while(0);
|
||||
}
|
||||
|
||||
#include "sbus.h"
|
||||
@@ -646,12 +638,6 @@ void doLoopCommonActions();
|
||||
|
||||
#define BITMASK(bit) (1<<(bit))
|
||||
|
||||
template<class t> inline t min(t a, t b) { return a<b?a:b; }
|
||||
template<class t> inline t max(t a, t b) { return a>b?a:b; }
|
||||
template<class t> inline t sgn(t a) { return a>0 ? 1 : (a < 0 ? -1 : 0); }
|
||||
template<class t> inline t limit(t mi, t x, t ma) { return min(max(mi,x),ma); }
|
||||
template<class t> inline void SWAP(t & a, t & b) { t tmp = b; b = a; a = tmp; }
|
||||
|
||||
uint16_t isqrt32(uint32_t n);
|
||||
|
||||
#if defined(BOOT)
|
||||
@@ -1238,13 +1224,8 @@ char * strcat_zchar(char *dest, const char *name, uint8_t size, const char *defa
|
||||
// Stick tolerance varies between transmitters, Higher is better
|
||||
#define STICK_TOLERANCE 64
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
ls_telemetry_value_t minTelemValue(source_t channel);
|
||||
ls_telemetry_value_t maxTelemValue(source_t channel);
|
||||
#else
|
||||
#define minTelemValue(channel) 255
|
||||
#define maxTelemValue(channel) 255
|
||||
#endif
|
||||
|
||||
getvalue_t convert16bitsTelemValue(source_t channel, ls_telemetry_value_t value);
|
||||
getvalue_t convertLswTelemValue(LogicalSwitchData * cs);
|
||||
@@ -1277,7 +1258,6 @@ inline bool IS_TXBATT_WARNING()
|
||||
return g_vbat100mV <= g_eeGeneral.vBatWarn;
|
||||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
enum TelemetryViews {
|
||||
TELEMETRY_CUSTOM_SCREEN_1,
|
||||
TELEMETRY_CUSTOM_SCREEN_2,
|
||||
@@ -1287,7 +1267,6 @@ enum TelemetryViews {
|
||||
};
|
||||
|
||||
extern uint8_t s_frsky_view;
|
||||
#endif
|
||||
|
||||
constexpr uint32_t EARTH_RADIUS = 6371009;
|
||||
|
||||
|
||||
@@ -18,11 +18,12 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef _MODULES_H_
|
||||
#define _MODULES_H_
|
||||
#ifndef _MODULES_HELPERS_H_
|
||||
#define _MODULES_HELPERS_H_
|
||||
|
||||
#include "bitfield.h"
|
||||
#include "definitions.h"
|
||||
#include "helpers.h"
|
||||
#include "telemetry/telemetry.h"
|
||||
#if defined(MULTIMODULE)
|
||||
#include "telemetry/multi.h"
|
||||
@@ -121,19 +122,15 @@ inline bool isExtraModule(uint8_t)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(INTERNAL_MODULE_PPM)
|
||||
inline bool isModuleTypePPM(uint8_t type)
|
||||
{
|
||||
return type == MODULE_TYPE_PPM;
|
||||
}
|
||||
|
||||
inline bool isModulePPM(uint8_t idx)
|
||||
{
|
||||
return (idx == INTERNAL_MODULE && g_model.moduleData[INTERNAL_MODULE].type == MODULE_TYPE_PPM) ||
|
||||
(idx == EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM);
|
||||
return isModuleTypePPM(g_model.moduleData[idx].type);
|
||||
}
|
||||
#else
|
||||
inline bool isModulePPM(uint8_t idx)
|
||||
{
|
||||
return isExtraModule(idx) ||
|
||||
(idx == EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_PPM);
|
||||
}
|
||||
#endif
|
||||
|
||||
inline bool isModuleTypeR9MNonAccess(uint8_t type)
|
||||
{
|
||||
@@ -248,29 +245,15 @@ inline bool isModuleRFAccess(uint8_t idx)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(DSM2)
|
||||
inline bool isModuleDSM2(uint8_t idx)
|
||||
inline bool isModuleDSM2(uint8_t moduleIdx)
|
||||
{
|
||||
return idx == EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_DSM2;
|
||||
return g_model.moduleData[moduleIdx].type == MODULE_TYPE_DSM2;
|
||||
}
|
||||
#else
|
||||
inline bool isModuleDSM2(uint8_t idx)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(SBUS)
|
||||
inline bool isModuleSBUS(uint8_t idx)
|
||||
inline bool isModuleSBUS(uint8_t moduleIdx)
|
||||
{
|
||||
return idx == EXTERNAL_MODULE && g_model.moduleData[EXTERNAL_MODULE].type == MODULE_TYPE_SBUS;
|
||||
return g_model.moduleData[moduleIdx].type == MODULE_TYPE_SBUS;
|
||||
}
|
||||
#else
|
||||
inline bool isModuleSBUS(uint8_t idx)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// order is the same as in enum Protocols in myeeprom.h (none, ppm, pxx, pxx2, dsm, crossfire, multi, r9m, r9m2, sbus)
|
||||
static const int8_t maxChannelsModules[] = { 0, 8, 8, 16, -2, 8, 4, 8, 16, 8}; // relative to 8!
|
||||
@@ -449,4 +432,51 @@ inline bool isTelemAllowedOnBind(uint8_t moduleIndex)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif // _MODULES_H_
|
||||
|
||||
inline bool isPXX2ReceiverUsed(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
return g_model.moduleData[moduleIdx].pxx2.receivers & (1 << receiverIdx);
|
||||
}
|
||||
|
||||
inline void setPXX2ReceiverUsed(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
g_model.moduleData[moduleIdx].pxx2.receivers |= (1 << receiverIdx);
|
||||
}
|
||||
|
||||
inline bool isPXX2ReceiverEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
return is_memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
}
|
||||
|
||||
inline void removePXX2Receiver(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
memclear(g_model.moduleData[moduleIdx].pxx2.receiverName[receiverIdx], PXX2_LEN_RX_NAME);
|
||||
g_model.moduleData[moduleIdx].pxx2.receivers &= ~(1 << receiverIdx);
|
||||
storageDirty(EE_MODEL);
|
||||
}
|
||||
|
||||
inline void removePXX2ReceiverIfEmpty(uint8_t moduleIdx, uint8_t receiverIdx)
|
||||
{
|
||||
if (isPXX2ReceiverEmpty(moduleIdx, receiverIdx)) {
|
||||
removePXX2Receiver(moduleIdx, receiverIdx);
|
||||
}
|
||||
}
|
||||
|
||||
inline void setDefaultPpmFrameLength(uint8_t moduleIdx)
|
||||
{
|
||||
g_model.moduleData[moduleIdx].ppm.frameLength = 4 * max<int>(0, g_model.moduleData[moduleIdx].channelsCount);
|
||||
}
|
||||
|
||||
inline void setModuleType(uint8_t moduleIdx, uint8_t moduleType)
|
||||
{
|
||||
ModuleData & moduleData = g_model.moduleData[moduleIdx];
|
||||
memclear(&moduleData, sizeof(ModuleData));
|
||||
moduleData.type = moduleType;
|
||||
moduleData.channelsCount = defaultModuleChannels_M8(moduleIdx);
|
||||
if (moduleData.type == MODULE_TYPE_SBUS)
|
||||
moduleData.sbus.refreshRate = -31;
|
||||
else if (moduleData.type == MODULE_TYPE_PPM)
|
||||
setDefaultPpmFrameLength(moduleIdx);
|
||||
}
|
||||
|
||||
#endif // _MODULES_HELPERS_H_
|
||||
|
||||
@@ -28,6 +28,18 @@ InternalModulePulsesData intmodulePulsesData __DMA;
|
||||
ExternalModulePulsesData extmodulePulsesData __DMA;
|
||||
TrainerPulsesData trainerPulsesData __DMA;
|
||||
|
||||
void ModuleState::startBind(BindInformation * destination, ModuleCallback bindCallback)
|
||||
{
|
||||
bindInformation = destination;
|
||||
callback = bindCallback;
|
||||
mode = MODULE_MODE_BIND;
|
||||
#if defined(SIMU)
|
||||
bindInformation->candidateReceiversCount = 2;
|
||||
strcpy(bindInformation->candidateReceiversNames[0], "SimuRX1");
|
||||
strcpy(bindInformation->candidateReceiversNames[1], "SimuRX2");
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t getModuleType(uint8_t module)
|
||||
{
|
||||
uint8_t type = g_model.moduleData[module].type;
|
||||
@@ -174,7 +186,7 @@ void enablePulsesExternalModule(uint8_t protocol)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
#if defined(PXX2) && defined(EXTMODULE_USART)
|
||||
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
||||
extmoduleInvertedSerialStart(PXX2_HIGHSPEED_BAUDRATE);
|
||||
break;
|
||||
@@ -338,7 +350,7 @@ void setupPulsesInternalModule(uint8_t protocol)
|
||||
|
||||
#if defined(PCBTARANIS) && defined(INTERNAL_MODULE_PPM)
|
||||
case PROTOCOL_CHANNELS_PPM:
|
||||
setupPulsesPPM(&extmodulePulsesData.ppm, g_model.moduleData[INTERNAL_MODULE].channelsStart, g_model.moduleData[INTERNAL_MODULE].channelsCount, g_model.moduleData[INTERNAL_MODULE].ppm.frameLength);
|
||||
setupPulsesPPMInternalModule();
|
||||
scheduleNextMixerCalculation(INTERNAL_MODULE, PPM_PERIOD(INTERNAL_MODULE));
|
||||
break;
|
||||
#endif
|
||||
|
||||
+27
-22
@@ -29,12 +29,6 @@
|
||||
#include "modules_helpers.h"
|
||||
#include "ff.h"
|
||||
|
||||
#if NUM_MODULES > 1
|
||||
#define IS_RANGECHECK_ENABLE() (moduleState[0].mode == MODULE_MODE_RANGECHECK || moduleState[1].mode == MODULE_MODE_RANGECHECK)
|
||||
#else
|
||||
#define IS_RANGECHECK_ENABLE() (moduleState[0].mode == MODULE_MODE_RANGECHECK)
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && defined(DSM2)
|
||||
#define DSM2_BIND_TIMEOUT 255 // 255*11ms
|
||||
extern uint8_t dsm2BindTimer;
|
||||
@@ -152,15 +146,6 @@ class OtaUpdateInformation: public BindInformation {
|
||||
|
||||
typedef void (* ModuleCallback)();
|
||||
|
||||
#if defined(SIMU)
|
||||
#define BIND_INFO \
|
||||
bindInformation->candidateReceiversCount = 2; \
|
||||
strcpy(bindInformation->candidateReceiversNames[0], "SimuRX1"); \
|
||||
strcpy(bindInformation->candidateReceiversNames[1], "SimuRX2");
|
||||
#else
|
||||
#define BIND_INFO
|
||||
#endif
|
||||
|
||||
PACK(struct ModuleState {
|
||||
uint8_t protocol:4;
|
||||
uint8_t mode:4;
|
||||
@@ -176,13 +161,8 @@ PACK(struct ModuleState {
|
||||
};
|
||||
ModuleCallback callback;
|
||||
|
||||
void startBind(BindInformation * destination, ModuleCallback bindCallback = nullptr)
|
||||
{
|
||||
bindInformation = destination;
|
||||
callback = bindCallback;
|
||||
mode = MODULE_MODE_BIND;
|
||||
BIND_INFO;
|
||||
}
|
||||
void startBind(BindInformation * destination, ModuleCallback bindCallback = nullptr);
|
||||
|
||||
void readModuleInformation(ModuleInformation * destination, int8_t first, int8_t last)
|
||||
{
|
||||
moduleInformation = destination;
|
||||
@@ -409,5 +389,30 @@ inline void SEND_FAILSAFE_1S()
|
||||
// for channels not set previously to HOLD or NOPULSE
|
||||
void setCustomFailsafe(uint8_t moduleIndex);
|
||||
|
||||
inline bool isModuleInRangeCheckMode()
|
||||
{
|
||||
if (moduleState[0].mode == MODULE_MODE_RANGECHECK)
|
||||
return true;
|
||||
|
||||
#if NUM_MODULES > 1
|
||||
if (moduleState[1].mode == MODULE_MODE_RANGECHECK)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool isModuleInBeepMode()
|
||||
{
|
||||
if (moduleState[0].mode >= MODULE_MODE_BEEP_FIRST)
|
||||
return true;
|
||||
|
||||
#if NUM_MODULES > 1
|
||||
if (moduleState[1].mode >= MODULE_MODE_BEEP_FIRST)
|
||||
return true;
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // _PULSES_H_
|
||||
|
||||
+10
-10
@@ -119,16 +119,16 @@ static const uint8_t PXX2ModuleOptions[] = {
|
||||
#else
|
||||
0b00000000, // None = no option available on unknown modules
|
||||
#endif
|
||||
0b11110001, // XJT
|
||||
0b11110001, // ISRM
|
||||
0b11111101, // ISRM-PRO
|
||||
0b11110101, // ISRM-S
|
||||
0b11110010, // R9M
|
||||
0b11110010, // R9MLite
|
||||
0b11110110, // R9MLite-PRO
|
||||
0b11110100, // ISRM-N
|
||||
0b11110100, // ISRM-S-X9
|
||||
0b11110100, // ISRM-S-X10
|
||||
0b00000001, // XJT
|
||||
0b00000001, // ISRM
|
||||
0b00001101, // ISRM-PRO
|
||||
0b00000101, // ISRM-S
|
||||
0b00000010, // R9M
|
||||
0b00000010, // R9MLite
|
||||
0b00000110, // R9MLite-PRO
|
||||
0b00000100, // ISRM-N
|
||||
0b00000100, // ISRM-S-X9
|
||||
0b00000101, // ISRM-S-X10
|
||||
};
|
||||
|
||||
inline uint8_t getPXX2ModuleOptions(uint8_t modelId)
|
||||
|
||||
+2
-5
@@ -120,7 +120,7 @@ inline const char * SDCARD_ERROR(FRESULT result)
|
||||
#endif
|
||||
|
||||
// NOTE: 'size' must = 0 or be a valid character position within 'filename' array -- it is NOT validated
|
||||
const char * getFileExtension(const char * filename, uint8_t size=0, uint8_t extMaxLen=0, uint8_t *fnlen=NULL, uint8_t *extlen=NULL);
|
||||
const char * getFileExtension(const char * filename, uint8_t size=0, uint8_t extMaxLen=0, uint8_t * fnlen=nullptr, uint8_t * extlen=nullptr);
|
||||
const char * getBasename(const char * path);
|
||||
|
||||
#if defined(PCBX12S)
|
||||
@@ -133,7 +133,6 @@ const char * getBasename(const char * path);
|
||||
#define OTX_FOURCC 0x3B78746F // otx for Taranis X-Lite S
|
||||
#elif defined(PCBXLITE)
|
||||
#define OTX_FOURCC 0x3978746F // otx for Taranis X-Lite
|
||||
#define O9X_FOURCC 0x3978396F // o9x for Taranis X-Lite
|
||||
#elif defined(RADIO_X7)
|
||||
#define OTX_FOURCC 0x3678746F // otx for Taranis X7
|
||||
#elif defined(PCBX9LITE)
|
||||
@@ -142,15 +141,13 @@ const char * getBasename(const char * path);
|
||||
#define OTX_FOURCC 0x3378746F // otx for Taranis X9D
|
||||
#elif defined(PCBSKY9X)
|
||||
#define OTX_FOURCC 0x3278746F // otx for sky9x
|
||||
#define O9X_FOURCC 0x3278396F // o9x for sky9x
|
||||
#elif defined(RADIO_T12)
|
||||
#define OTX_FOURCC 0x3D78746F // otx for Jumper T12
|
||||
#define O9X_FOURCC 0x3D78396F // o9x for Jumper T12
|
||||
#endif
|
||||
|
||||
bool isFileAvailable(const char * filename, bool exclDir = false);
|
||||
int findNextFileIndex(char * filename, uint8_t size, const char * directory);
|
||||
bool isExtensionMatching(const char * extension, const char * pattern, char * match = NULL);
|
||||
bool isExtensionMatching(const char * extension, const char * pattern, char * match = nullptr);
|
||||
|
||||
const char * sdCopyFile(const char * src, const char * dest);
|
||||
const char * sdCopyFile(const char * srcFilename, const char * srcDir, const char * destFilename, const char * destDir);
|
||||
|
||||
+2
-5
@@ -360,8 +360,8 @@ long OpenTxSim::onTimeout(FXObject*, FXSelector, void*)
|
||||
{
|
||||
if (hasFocus()) {
|
||||
#if defined(COPROCESSOR)
|
||||
Coproc_temp = 23;
|
||||
Coproc_maxtemp = 28;
|
||||
coprocData.temp = 23;
|
||||
coprocData.maxtemp = 28;
|
||||
#endif
|
||||
|
||||
updateKeysAndSwitches();
|
||||
@@ -505,9 +505,6 @@ int main(int argc, char ** argv)
|
||||
opentxSim->show(); // Otherwise the main window gets centred across my two monitors, split down the middle.
|
||||
#endif
|
||||
|
||||
#if defined(TELEMETRY_FRSKY) && !defined(TELEMETRY_FRSKY_SPORT)
|
||||
telemetryStreaming = 1;
|
||||
#endif
|
||||
|
||||
printf("Model size = %d\n", (int)sizeof(g_model));
|
||||
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@
|
||||
* Retrieves the version of the bootloader or firmware
|
||||
* @return
|
||||
*/
|
||||
#if defined(STM32)
|
||||
#if defined(STM32) && !defined(SIMU)
|
||||
|
||||
__SECTION_USED(".fwversiondata") const char firmware_version[] = "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
|
||||
__SECTION_USED(".bootversiondata") const char boot_version[] = "opentx-" FLAVOUR "-" VERSION " (" GIT_STR ")";
|
||||
|
||||
@@ -21,8 +21,36 @@
|
||||
#include "opentx.h"
|
||||
#include "conversions.h"
|
||||
|
||||
void convertRadioData(int version)
|
||||
{
|
||||
TRACE("convertRadioData(%d)", version);
|
||||
|
||||
#if EEPROM_CONVERSIONS < 217
|
||||
if (version == 216) {
|
||||
version = 217;
|
||||
convertRadioData_216_to_217(g_eeGeneral);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EEPROM_CONVERSIONS < 218
|
||||
if (version == 217) {
|
||||
version = 218;
|
||||
convertRadioData_217_to_218(g_eeGeneral);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if EEPROM_CONVERSIONS < 219
|
||||
if (version == 218) {
|
||||
version = 219;
|
||||
convertRadioData_218_to_219(g_eeGeneral);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void convertModelData(int version)
|
||||
{
|
||||
TRACE("convertModelData(%d)", version);
|
||||
|
||||
#if EEPROM_CONVERSIONS < 217
|
||||
if (version == 216) {
|
||||
version = 217;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
void convertRadioData(int version);
|
||||
void convertModelData(int version);
|
||||
|
||||
bool eeConvert();
|
||||
|
||||
@@ -58,6 +58,11 @@ int convertSource_218_to_219(int source)
|
||||
source += 2;
|
||||
#endif
|
||||
|
||||
#if defined(PCBX10)
|
||||
if ((source == MIXSRC_EXT1) || (source == MIXSRC_EXT2))
|
||||
source += 2;
|
||||
#endif
|
||||
|
||||
return source;
|
||||
}
|
||||
|
||||
@@ -111,6 +116,12 @@ void convertModelData_218_to_219(ModelData &model)
|
||||
memcpy(&oldModel, &model, sizeof(ModelData_v218));
|
||||
ModelData_v219 & newModel = (ModelData_v219 &) model;
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
// 4 bytes more for the ModelHeader::bitmap
|
||||
memclear(&newModel.header.bitmap[10], 4);
|
||||
memcpy(newModel.timers, oldModel.timers, offsetof(ModelData_v218, mixData) - offsetof(ModelData_v218, timers));
|
||||
#endif
|
||||
|
||||
memclear(newModel.mixData, sizeof(ModelData_v219) - offsetof(ModelData_v219, mixData));
|
||||
|
||||
char name[LEN_MODEL_NAME+1];
|
||||
@@ -147,9 +158,9 @@ void convertModelData_218_to_219(ModelData &model)
|
||||
uint8_t cstate = lswFamily(sw.func);
|
||||
if (cstate == LS_FAMILY_OFS || cstate == LS_FAMILY_COMP || cstate == LS_FAMILY_DIFF) {
|
||||
LogicalSwitchData & sw = newModel.logicalSw[i];
|
||||
sw.v1 = convertSource_218_to_219((uint8_t)sw.v1);
|
||||
sw.v1 = convertSource_218_to_219(sw.v1);
|
||||
if (cstate == LS_FAMILY_COMP) {
|
||||
sw.v2 = convertSource_218_to_219((uint8_t)sw.v2);
|
||||
sw.v2 = convertSource_218_to_219(sw.v2);
|
||||
}
|
||||
}
|
||||
else if (cstate == LS_FAMILY_BOOL || cstate == LS_FAMILY_STICKY) {
|
||||
@@ -159,6 +170,7 @@ void convertModelData_218_to_219(ModelData &model)
|
||||
else if (cstate == LS_FAMILY_EDGE) {
|
||||
sw.v1 = convertSwitch_218_to_219(sw.v1);
|
||||
}
|
||||
sw.andsw = convertSwitch_218_to_219(sw.andsw);
|
||||
}
|
||||
|
||||
for (uint8_t i=0; i<MAX_SPECIAL_FUNCTIONS_218; i++) {
|
||||
@@ -179,6 +191,10 @@ void convertModelData_218_to_219(ModelData &model)
|
||||
}
|
||||
|
||||
newModel.thrTraceSrc = oldModel.thrTraceSrc;
|
||||
#if defined(PCBX10)
|
||||
if (newModel.thrTraceSrc > 3) // 0=Thr, 1/2/3=Old 3 Pots, then Sliders
|
||||
newModel.thrTraceSrc += 2;
|
||||
#endif
|
||||
newModel.switchWarningState = oldModel.switchWarningState;
|
||||
#if !defined(COLORLCD)
|
||||
newModel.switchWarningEnable = oldModel.switchWarningEnable;
|
||||
@@ -279,9 +295,33 @@ void convertModelData_218_to_219(ModelData &model)
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
// memcpy(newModel.screenData, oldModel.screenData,
|
||||
// sizeof(newModel.screenData) +
|
||||
// sizeof(newModel.topbarData))
|
||||
memcpy(newModel.screenData, oldModel.screenData,
|
||||
sizeof(newModel.screenData) +
|
||||
sizeof(newModel.topbarData));
|
||||
|
||||
for (int screen=0; screen<MAX_CUSTOM_SCREENS; screen++) {
|
||||
CustomScreenData& screenData = g_model.screenData[screen];
|
||||
if (screenData.layoutName[0] == '\0')
|
||||
continue;
|
||||
for (int zone=0; zone<MAX_LAYOUT_ZONES; zone++) {
|
||||
Layout::ZonePersistentData * zoneData = &screenData.layoutData.zones[zone];
|
||||
if (strcmp("Value", zoneData->widgetName))
|
||||
continue;
|
||||
|
||||
ZoneOptionValue& option = zoneData->widgetData.options[0];
|
||||
option.unsignedValue = convertSource_218_to_219(option.unsignedValue);
|
||||
}
|
||||
}
|
||||
|
||||
for (int zone=0; zone<MAX_LAYOUT_ZONES; zone++) {
|
||||
Topbar::ZonePersistentData * zoneData = &g_model.topbarData.zones[zone];
|
||||
if (strcmp("Value", zoneData->widgetName))
|
||||
continue;
|
||||
|
||||
ZoneOptionValue & option = zoneData->widgetData.options[0];
|
||||
option.unsignedValue = convertSource_218_to_219(option.unsignedValue);
|
||||
}
|
||||
|
||||
#else
|
||||
newModel.screensType = oldModel.frsky.screensType;
|
||||
memmove(&newModel.screens, &oldModel.frsky.screens, sizeof(newModel.screens));
|
||||
@@ -309,6 +349,8 @@ void convertModelData_218_to_219(ModelData &model)
|
||||
|
||||
void convertRadioData_218_to_219(RadioData & settings)
|
||||
{
|
||||
TRACE("Radio conversion from v218 to v219");
|
||||
|
||||
settings.version = 219;
|
||||
settings.variant = EEPROM_VARIANT;
|
||||
|
||||
@@ -318,13 +360,6 @@ void convertRadioData_218_to_219(RadioData & settings)
|
||||
memcpy(&oldSettings, &settings, sizeof(RadioData_v218));
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX7) || defined(PCBXLITE)
|
||||
for (uint8_t i=0; i<MAX_SPECIAL_FUNCTIONS_218; i++) {
|
||||
CustomFunctionData & cf = settings.customFn[i];
|
||||
cf.swtch = convertSwitch_218_to_219(cf.swtch);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBX9DP)
|
||||
// no bluetooth before PCBREV 2019
|
||||
settings.auxSerialMode = oldSettings.auxSerialMode;
|
||||
@@ -374,12 +409,25 @@ void convertRadioData_218_to_219(RadioData & settings)
|
||||
g_eeGeneral.potsConfig = bfSet<uint32_t>(g_eeGeneral.potsConfig, POT_WITHOUT_DETENT, 2, 2); // T12 comes with wrongly defined pot2
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9D) || defined(PCBX9DP) || defined(PCBX7) || defined(PCBXLITE) || defined(PCBHORUS)
|
||||
for (uint8_t i=0; i<MAX_SPECIAL_FUNCTIONS_218; i++) {
|
||||
CustomFunctionData & cf = settings.customFn[i];
|
||||
cf.swtch = convertSwitch_218_to_219(cf.swtch);
|
||||
if (cf.func == FUNC_PLAY_VALUE || cf.func == FUNC_VOLUME || (IS_ADJUST_GV_FUNC(cf.func) && cf.all.mode == FUNC_ADJUST_GVAR_SOURCE)) {
|
||||
cf.all.val = convertSource_218_to_219(cf.all.val);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBX9DP) && PCBREV >= 2019
|
||||
// force re-calibration
|
||||
settings.chkSum = 0xFFFF;
|
||||
setDefaultOwnerId();
|
||||
#endif
|
||||
|
||||
settings.pwrOnSpeed = 0;
|
||||
settings.pwrOffSpeed = 0;
|
||||
|
||||
#if defined(STM32)
|
||||
free(oldSettingsAllocated);
|
||||
#endif
|
||||
|
||||
@@ -532,10 +532,16 @@ PACK(struct ModelData_v218 {
|
||||
#define THEME_DATA
|
||||
#endif
|
||||
|
||||
#if defined(PCBHORUS)
|
||||
#define NUM_CALIBRATION_INPUTS 13
|
||||
#else
|
||||
#define NUM_CALIBRATION_INPUTS (NUM_STICKS+STORAGE_NUM_POTS+STORAGE_NUM_SLIDERS)
|
||||
#endif
|
||||
|
||||
PACK(struct RadioData_v218 {
|
||||
uint8_t version;
|
||||
uint16_t variant;
|
||||
CalibData calib[NUM_STICKS+STORAGE_NUM_POTS+STORAGE_NUM_SLIDERS+STORAGE_NUM_MOUSE_ANALOGS];
|
||||
CalibData calib[NUM_CALIBRATION_INPUTS];
|
||||
uint16_t chkSum;
|
||||
N_HORUS_FIELD(int8_t currModel);
|
||||
N_HORUS_FIELD(uint8_t contrast);
|
||||
@@ -554,9 +560,9 @@ PACK(struct RadioData_v218 {
|
||||
int8_t timezone:5;
|
||||
uint8_t adjustRTC:1;
|
||||
uint8_t inactivityTimer;
|
||||
uint8_t telemetryBaudrate:3;
|
||||
int8_t splashMode:3;
|
||||
int8_t hapticMode:2;
|
||||
int8_t spare2:3;
|
||||
int8_t switchesDelay;
|
||||
uint8_t lightAutoOff;
|
||||
uint8_t templateSetup; // RETA order for receiver channels
|
||||
|
||||
@@ -86,16 +86,24 @@ void eeLoadModelHeaders()
|
||||
}
|
||||
}
|
||||
|
||||
void storageReadRadioSettings()
|
||||
void storageClearRadioSetting()
|
||||
{
|
||||
if (!eepromOpen() || !eeLoadGeneral()) {
|
||||
memclear(&g_eeGeneral, sizeof(RadioData));
|
||||
}
|
||||
|
||||
void storageReadRadioSettings(bool allowConversion)
|
||||
{
|
||||
if (g_eeGeneral.version != 0)
|
||||
return;
|
||||
|
||||
if (!eepromOpen() || !eeLoadGeneral(allowConversion)) {
|
||||
storageEraseAll(true);
|
||||
}
|
||||
else {
|
||||
eeLoadModelHeaders();
|
||||
}
|
||||
|
||||
for (uint8_t i=0; languagePacks[i]!=NULL; i++) {
|
||||
for (uint8_t i=0; languagePacks[i]; i++) {
|
||||
if (!strncmp(g_eeGeneral.ttsLanguage, languagePacks[i]->id, 2)) {
|
||||
currentLanguagePackIdx = i;
|
||||
currentLanguagePack = languagePacks[i];
|
||||
@@ -110,7 +118,7 @@ void storageReadCurrentModel()
|
||||
|
||||
void storageReadAll()
|
||||
{
|
||||
storageReadRadioSettings();
|
||||
storageReadRadioSettings(true);
|
||||
storageReadCurrentModel();
|
||||
}
|
||||
|
||||
@@ -125,7 +133,7 @@ void storageEraseAll(bool warn)
|
||||
ALERT(STR_STORAGE_WARNING, STR_BAD_RADIO_DATA, AU_BAD_RADIODATA);
|
||||
}
|
||||
|
||||
RAISE_ALERT(STR_STORAGE_WARNING, STR_STORAGE_FORMAT, NULL, AU_NONE);
|
||||
RAISE_ALERT(STR_STORAGE_WARNING, STR_STORAGE_FORMAT, nullptr, AU_NONE);
|
||||
|
||||
storageFormat();
|
||||
storageDirty(EE_GENERAL|EE_MODEL);
|
||||
|
||||
@@ -32,6 +32,7 @@ void selectModel(uint8_t sub);
|
||||
void eeLoadModelHeader(uint8_t id, ModelHeader *header);
|
||||
void eeLoadModelHeaders();
|
||||
|
||||
void storageReadRadioSettings();
|
||||
void storageClearRadioSetting();
|
||||
void storageReadRadioSettings(bool allowConversion);
|
||||
void storageReadCurrentModel();
|
||||
|
||||
|
||||
@@ -256,13 +256,18 @@ void writeModel(int index)
|
||||
writeFile(index+1, (uint8_t *)&g_model, sizeof(g_model));
|
||||
}
|
||||
|
||||
bool eeLoadGeneral()
|
||||
bool eeLoadGeneral(bool allowConversion)
|
||||
{
|
||||
eeLoadGeneralSettingsData();
|
||||
|
||||
if (g_eeGeneral.version != EEPROM_VER) {
|
||||
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
|
||||
#if defined(PCBSKY9X)
|
||||
if (!allowConversion) {
|
||||
storageClearRadioSetting();
|
||||
return true; // prevent eeprom from being wiped
|
||||
}
|
||||
|
||||
if (!eeConvert()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdint.h>
|
||||
|
||||
bool eeLoadGeneral( void ) ;
|
||||
void eeDeleteModel( uint8_t id ) ;
|
||||
bool eeLoadGeneral(bool allowConversion);
|
||||
void eeDeleteModel( uint8_t id );
|
||||
bool eeCopyModel(uint8_t dst, uint8_t src);
|
||||
void eeSwapModels(uint8_t id1, uint8_t id2);
|
||||
|
||||
|
||||
@@ -757,7 +757,7 @@ uint16_t eeLoadModelData(uint8_t index)
|
||||
return theFile.readRlc((uint8_t*)&g_model, sizeof(g_model));
|
||||
}
|
||||
|
||||
bool eeLoadGeneral()
|
||||
bool eeLoadGeneral(bool allowConversion)
|
||||
{
|
||||
theFile.openRlc(FILE_GENERAL);
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 3) == 3 && g_eeGeneral.version == EEPROM_VER) {
|
||||
@@ -796,6 +796,10 @@ bool eeLoadGeneral()
|
||||
#endif
|
||||
#if defined(EEPROM_CONVERSIONS)
|
||||
if (g_eeGeneral.version != EEPROM_VER) {
|
||||
if (!allowConversion) {
|
||||
storageClearRadioSetting();
|
||||
return true; // prevent eeprom from being wiped
|
||||
}
|
||||
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
|
||||
if (!eeConvert()) {
|
||||
return false;
|
||||
|
||||
@@ -179,8 +179,8 @@ void loadRadioSettings();
|
||||
void loadModel(int index, bool alarms=true);
|
||||
|
||||
bool eepromOpen();
|
||||
void eeLoadModelName(uint8_t id, char *name);
|
||||
bool eeLoadGeneral();
|
||||
void eeLoadModelName(uint8_t id, char * name);
|
||||
bool eeLoadGeneral(bool allowConversion);
|
||||
|
||||
// For EEPROM backup/restore
|
||||
inline bool isEepromStart(const void * buffer)
|
||||
|
||||
@@ -72,24 +72,33 @@ const BitmapBuffer * ModelCell::getBuffer()
|
||||
|
||||
void ModelCell::loadBitmap()
|
||||
{
|
||||
uint8_t version;
|
||||
|
||||
PACK(struct {
|
||||
ModelHeader header;
|
||||
TimerData timers[MAX_TIMERS];
|
||||
}) partialmodel;
|
||||
const char * error = NULL;
|
||||
|
||||
buffer = new BitmapBuffer(BMP_RGB565, MODELCELL_WIDTH, MODELCELL_HEIGHT);
|
||||
if (buffer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (strncmp(modelFilename, g_eeGeneral.currModelFilename, LEN_MODEL_FILENAME) == 0) {
|
||||
memcpy(&partialmodel.header, &g_model.header, sizeof(partialmodel));
|
||||
}
|
||||
else {
|
||||
error = readModel(modelFilename, (uint8_t *)&partialmodel.header, sizeof(partialmodel));
|
||||
error = readModel(modelFilename, (uint8_t *)&partialmodel.header, sizeof(partialmodel), &version);
|
||||
// LEN_BITMAP_NAME has now 4 bytes more
|
||||
if (version <= 218) {
|
||||
memmove(partialmodel.timers, &(partialmodel.header.bitmap[10]), sizeof(TimerData)*MAX_TIMERS);
|
||||
memclear(&(partialmodel.header.bitmap[10]), 4);
|
||||
}
|
||||
}
|
||||
|
||||
if ((modelName[0] == 0) && ! error)
|
||||
setModelName(partialmodel.header.name); // resets buffer!!!
|
||||
|
||||
buffer = new BitmapBuffer(BMP_RGB565, MODELCELL_WIDTH, MODELCELL_HEIGHT);
|
||||
if (buffer == NULL) {
|
||||
return;
|
||||
}
|
||||
buffer->clear(TEXT_BGCOLOR);
|
||||
|
||||
if (error) {
|
||||
@@ -97,9 +106,6 @@ void ModelCell::loadBitmap()
|
||||
buffer->drawBitmapPattern(5, 23, LBM_LIBRARY_SLOT, TEXT_COLOR);
|
||||
}
|
||||
else {
|
||||
if (modelName[0] == 0)
|
||||
setModelName(partialmodel.header.name);
|
||||
|
||||
char timer[LEN_TIMER_STRING];
|
||||
buffer->drawSizedText(5, 2, modelName, LEN_MODEL_NAME, SMLSIZE|TEXT_COLOR);
|
||||
getTimerString(timer, 0);
|
||||
|
||||
@@ -101,16 +101,15 @@ const char * openFile(const char * fullpath, FIL * file, uint16_t * size, uint8_
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char * loadFile(const char * fullpath, uint8_t * data, uint16_t maxsize)
|
||||
const char * loadFile(const char * fullpath, uint8_t * data, uint16_t maxsize, uint8_t * version)
|
||||
{
|
||||
FIL file;
|
||||
UINT read;
|
||||
uint16_t size;
|
||||
uint8_t version;
|
||||
|
||||
TRACE("loadFile(%s)", fullpath);
|
||||
|
||||
const char * err = openFile(fullpath, &file, &size, &version);
|
||||
const char * err = openFile(fullpath, &file, &size, version);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@@ -121,26 +120,24 @@ const char * loadFile(const char * fullpath, uint8_t * data, uint16_t maxsize)
|
||||
return SDCARD_ERROR(result);
|
||||
}
|
||||
|
||||
if (version < EEPROM_VER) {
|
||||
convertModelData(version);
|
||||
}
|
||||
|
||||
f_close(&file);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char * readModel(const char * filename, uint8_t * buffer, uint32_t size)
|
||||
const char * readModel(const char * filename, uint8_t * buffer, uint32_t size, uint8_t * version)
|
||||
{
|
||||
char path[256];
|
||||
getModelPath(path, filename);
|
||||
return loadFile(path, buffer, size);
|
||||
return loadFile(path, buffer, size, version);
|
||||
}
|
||||
|
||||
const char * loadModel(const char * filename, bool alarms)
|
||||
{
|
||||
uint8_t version;
|
||||
|
||||
preModelLoad();
|
||||
|
||||
const char * error = readModel(filename, (uint8_t *)&g_model, sizeof(g_model));
|
||||
const char * error = readModel(filename, (uint8_t *)&g_model, sizeof(g_model), &version);
|
||||
if (error) {
|
||||
TRACE("loadModel error=%s", error);
|
||||
}
|
||||
@@ -150,20 +147,34 @@ const char * loadModel(const char * filename, bool alarms)
|
||||
storageCheck(true);
|
||||
alarms = false;
|
||||
}
|
||||
else if (version < EEPROM_VER) {
|
||||
convertModelData(version);
|
||||
}
|
||||
|
||||
postModelLoad(alarms);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
const char * loadRadioSettings()
|
||||
const char * loadRadioSettings(const char * path)
|
||||
{
|
||||
const char * error = loadFile(RADIO_SETTINGS_PATH, (uint8_t *)&g_eeGeneral, sizeof(g_eeGeneral));
|
||||
uint8_t version;
|
||||
const char * error = loadFile(path, (uint8_t *)&g_eeGeneral, sizeof(g_eeGeneral), &version);
|
||||
if (error) {
|
||||
TRACE("loadRadioSettings error=%s", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
return error;
|
||||
if (version < EEPROM_VER) {
|
||||
convertRadioData(version);
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char * loadRadioSettings()
|
||||
{
|
||||
return loadRadioSettings(RADIO_SETTINGS_PATH);
|
||||
}
|
||||
|
||||
const char * writeGeneralSettings()
|
||||
@@ -174,7 +185,7 @@ const char * writeGeneralSettings()
|
||||
void storageCheck(bool immediately)
|
||||
{
|
||||
if (storageDirtyMsk & EE_GENERAL) {
|
||||
TRACE("eeprom write general");
|
||||
TRACE("Storage write general");
|
||||
storageDirtyMsk -= EE_GENERAL;
|
||||
const char * error = writeGeneralSettings();
|
||||
if (error) {
|
||||
@@ -183,7 +194,7 @@ void storageCheck(bool immediately)
|
||||
}
|
||||
|
||||
if (storageDirtyMsk & EE_MODEL) {
|
||||
TRACE("eeprom write model");
|
||||
TRACE("Storage write current model");
|
||||
storageDirtyMsk -= EE_MODEL;
|
||||
const char * error = writeModel();
|
||||
if (error) {
|
||||
|
||||
@@ -31,10 +31,13 @@ const char * openFile(const char * fullpath, FIL * file, uint16_t * size, uint8_
|
||||
|
||||
void getModelPath(char * path, const char * filename);
|
||||
|
||||
const char * readModel(const char * filename, uint8_t * buffer, uint32_t size);
|
||||
const char * readModel(const char * filename, uint8_t * buffer, uint32_t size, uint8_t * version);
|
||||
const char * loadModel(const char * filename, bool alarms=true);
|
||||
const char * createModel();
|
||||
|
||||
const char * loadRadioSettings(const char * path);
|
||||
const char * loadRadioSettings();
|
||||
|
||||
PACK(struct RamBackup {
|
||||
uint16_t size;
|
||||
uint8_t data[4094];
|
||||
|
||||
@@ -285,7 +285,6 @@ bool getLogicalSwitch(uint8_t idx)
|
||||
}
|
||||
else {
|
||||
mixsrc_t v1 = ls->v1;
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
// Telemetry
|
||||
if (v1 >= MIXSRC_FIRST_TELEM) {
|
||||
if (!TELEMETRY_STREAMING() || IS_FAI_FORBIDDEN(v1-1)) {
|
||||
@@ -303,17 +302,6 @@ bool getLogicalSwitch(uint8_t idx)
|
||||
else {
|
||||
y = calc100toRESX(ls->v2);
|
||||
}
|
||||
#else
|
||||
if (v1 >= MIXSRC_FIRST_TELEM) {
|
||||
y = (int16_t)3 * (128+ls->v2); // it's a Timer
|
||||
}
|
||||
else if (v1 >= MIXSRC_GVAR1) {
|
||||
y = ls->v2; // it's a GVAR
|
||||
}
|
||||
else {
|
||||
y = calc100toRESX(ls->v2);
|
||||
}
|
||||
#endif
|
||||
|
||||
switch (ls->func) {
|
||||
case LS_FUNC_VEQUAL:
|
||||
@@ -370,9 +358,7 @@ bool getLogicalSwitch(uint8_t idx)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(TELEMETRY_FRSKY)
|
||||
DurationAndDelayProcessing:
|
||||
#endif
|
||||
|
||||
if (ls->delay || ls->duration) {
|
||||
LogicalSwitchContext &context = lswFm[mixerCurrentFlightMode].lsw[idx];
|
||||
|
||||
@@ -12,8 +12,8 @@ option(MODULE_SIZE_STD "Standard size TX Module" ON)
|
||||
option(PPM "PPM TX Module" ON)
|
||||
option(DSM2 "DSM2 TX Module" ON)
|
||||
option(SBUS "SBUS TX Module" ON)
|
||||
option(CROSSFIRE "Crossfire TX Module" OFF)
|
||||
option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" OFF)
|
||||
option(CROSSFIRE "Crossfire TX Module" ON)
|
||||
option(MULTIMODULE "DIY Multiprotocol TX Module (https://github.com/pascallanger/DIY-Multiprotocol-TX-Module)" ON)
|
||||
option(MULTI_SPORT "SPORT telemetry support" OFF)
|
||||
option(SUPPORT_D16_EU_ONLY "XJT module only supports D16-EU and LR12-EU" OFF) # TODO rename to XJT_EU_ONLY
|
||||
option(DEBUG_INTERRUPTS "Count interrupts" OFF)
|
||||
@@ -169,10 +169,10 @@ if(CROSSFIRE)
|
||||
endif()
|
||||
|
||||
add_definitions(-DCPUARM)
|
||||
add_definitions(-DTELEMETRY_FRSKY -DTELEMETRY_FRSKY_SPORT -DGPS)
|
||||
|
||||
add_definitions(-DGPS)
|
||||
add_definitions(-DBOLD_FONT -DBATTGRAPH -DTHRTRACE)
|
||||
add_definitions(-DREQUIRED_SDCARD_VERSION="${SDCARD_VERSION}")
|
||||
|
||||
include_directories(${COOS_DIR} ${COOS_DIR}/kernel ${COOS_DIR}/portable)
|
||||
foreach(LANGUAGE ${TTS_LANGUAGES})
|
||||
string(TOLOWER ${LANGUAGE} lang_lower)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
set(LUA "NO" CACHE STRING "Lua scripts (YES/NO/NO_MODEL_SCRIPTS)")
|
||||
set_property(CACHE LUA PROPERTY STRINGS YES NO NO_MODEL_SCRIPTS)
|
||||
set(LUA_SCRIPT_LOAD_MODE "" CACHE STRING "Script loading mode and compilation flags [btTxcd] (see loadScript() API docs). Blank for default ('bt' on radio, 'T' on SIMU/DEBUG builds)")
|
||||
option(LUA_COMPILER "Pre-compile and save Lua scripts" OFF)
|
||||
option(LUA_COMPILER "Pre-compile and save Lua scripts" ON)
|
||||
option(LUA_ALLOCATOR_TRACER "Trace Lua memory (de)allocations to debug port (also needs DEBUG=YES NANO=NO)" OFF)
|
||||
|
||||
option(USB_SERIAL "Enable USB serial (CDC)" OFF)
|
||||
@@ -18,6 +18,7 @@ include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/hid/inc)
|
||||
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Class/cdc/inc)
|
||||
include_directories(${STM32USB_DIR}/STM32_USB_Device_Library/Core/inc/)
|
||||
include_directories(${STM32USB_DIR}/STM32_USB_OTG_Driver/inc)
|
||||
|
||||
set(STM32USB_SRC
|
||||
STM32_USB_OTG_Driver/src/usb_core.c
|
||||
STM32_USB_OTG_Driver/src/usb_dcd.c
|
||||
@@ -26,20 +27,19 @@ set(STM32USB_SRC
|
||||
STM32_USB_Device_Library/Core/src/usbd_ioreq.c
|
||||
STM32_USB_Device_Library/Core/src/usbd_req.c
|
||||
)
|
||||
set(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
../common/arm/stm32/rtc_driver.cpp
|
||||
../common/arm/stm32/cpu_id.cpp
|
||||
${AUX_SERIAL_DRIVER}
|
||||
)
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/rtc_driver.cpp
|
||||
${AUX_SERIAL_DRIVER}
|
||||
../common/arm/stm32/delays.cpp
|
||||
../common/arm/stm32/usb_bsp.c
|
||||
../common/arm/stm32/usbd_desc.c
|
||||
../common/arm/stm32/usbd_usr.cpp
|
||||
../common/arm/stm32/usb_driver.cpp
|
||||
../common/arm/stm32/flash_driver.cpp
|
||||
../common/arm/stm32/usbd_storage_msd.cpp
|
||||
../common/arm/stm32/usbd_hid_joystick.c
|
||||
)
|
||||
|
||||
if(DEBUG OR CLI OR USB_SERIAL)
|
||||
@@ -62,16 +62,6 @@ set(STM32USB_SRC
|
||||
STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
|
||||
)
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/usbd_storage_msd.cpp
|
||||
)
|
||||
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
../common/arm/stm32/usbd_hid_joystick.c
|
||||
)
|
||||
|
||||
if(GVARS)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
@@ -99,6 +89,11 @@ foreach(FILE ${STM32USB_SRC})
|
||||
)
|
||||
endforeach()
|
||||
|
||||
set(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
../common/arm/stm32/cpu_id.cpp
|
||||
)
|
||||
|
||||
set(SRC
|
||||
${SRC}
|
||||
io/bootloader_flash.cpp
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#if defined(SIMU)
|
||||
// not needed
|
||||
#elif defined(PCBX10)
|
||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, 1,-1, 1, 1};
|
||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, 1,1, 1, -1};
|
||||
#elif defined(PCBX9E)
|
||||
#if defined(HORUS_STICKS)
|
||||
const int8_t adcDirection[NUM_ANALOGS] = {1,-1,1,-1, -1,-1,-1,1, -1,1,-1, -1,-1,-1};
|
||||
@@ -98,11 +98,11 @@ void adcInit()
|
||||
|
||||
#if defined(PCBX10)
|
||||
if (STICKS_PWM_ENABLED()) {
|
||||
ADC_MAIN->SQR2 = (ADC_CHANNEL_EXT1 << 0) + (ADC_CHANNEL_EXT2 << 5);
|
||||
ADC_MAIN->SQR3 = (ADC_CHANNEL_POT1 << 0) + (ADC_CHANNEL_POT2 << 5) + (ADC_CHANNEL_POT3 << 10) + (ADC_CHANNEL_SLIDER1 << 15) + (ADC_CHANNEL_SLIDER2 << 20) + (ADC_CHANNEL_BATT << 25);
|
||||
ADC_MAIN->SQR2 = (ADC_CHANNEL_SLIDER2 << 0) + (ADC_CHANNEL_BATT << 5);
|
||||
ADC_MAIN->SQR3 = (ADC_CHANNEL_POT1 << 0) + (ADC_CHANNEL_POT2 << 5) + (ADC_CHANNEL_POT3 << 10) + (ADC_CHANNEL_EXT1 << 15) + (ADC_CHANNEL_EXT2 << 20) + (ADC_CHANNEL_SLIDER1 << 25);
|
||||
}
|
||||
else {
|
||||
ADC_MAIN->SQR2 = (ADC_CHANNEL_POT3 << 0) + (ADC_CHANNEL_SLIDER1 << 5) + (ADC_CHANNEL_SLIDER2 << 10) + (ADC_CHANNEL_BATT << 15) + (ADC_CHANNEL_EXT1 << 20) + (ADC_CHANNEL_EXT2 << 25);
|
||||
ADC_MAIN->SQR2 = (ADC_CHANNEL_POT3 << 0) + (ADC_CHANNEL_EXT1 << 5) + (ADC_CHANNEL_EXT2 << 10) + (ADC_CHANNEL_SLIDER1 << 15) + (ADC_CHANNEL_SLIDER2 << 20) + (ADC_CHANNEL_BATT << 25);
|
||||
ADC_MAIN->SQR3 = (ADC_CHANNEL_STICK_LH << 0) + (ADC_CHANNEL_STICK_LV << 5) + (ADC_CHANNEL_STICK_RV << 10) + (ADC_CHANNEL_STICK_RH << 15) + (ADC_CHANNEL_POT1 << 20) + (ADC_CHANNEL_POT2 << 25);
|
||||
}
|
||||
#elif defined(PCBX9E)
|
||||
@@ -248,7 +248,7 @@ void adcRead()
|
||||
#if defined(PCBX10)
|
||||
uint16_t getRTCBatteryVoltage()
|
||||
{
|
||||
return (rtcBatteryVoltage * ADC_VREF_PREC2) / 2048;
|
||||
return (rtcBatteryVoltage * 2 * ADC_VREF_PREC2) / 2048;
|
||||
}
|
||||
#else
|
||||
uint16_t getRTCBatteryVoltage()
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
uint8_t auxSerialMode = 0;
|
||||
Fifo<uint8_t, 512> auxSerialTxFifo;
|
||||
DMAFifo<32> auxSerialRxFifo __DMA (AUX_SERIAL_DMA_Stream_RX);
|
||||
AuxSerialRxFifo auxSerialRxFifo __DMA (AUX_SERIAL_DMA_Stream_RX);
|
||||
|
||||
void auxSerialSetup(unsigned int baudrate, bool dma)
|
||||
{
|
||||
|
||||
@@ -244,6 +244,7 @@ int main()
|
||||
|
||||
lcdInit();
|
||||
backlightInit();
|
||||
backlightEnable();
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
i2cInit();
|
||||
|
||||
@@ -27,7 +27,6 @@ if(SPLASH STREQUAL OFF)
|
||||
endif()
|
||||
|
||||
if (PCB STREQUAL X10)
|
||||
set(FLAVOUR x10)
|
||||
set(PCBREV "STD" CACHE STRING "PCB Revision")
|
||||
add_definitions(-DPCBX10)
|
||||
add_definitions(-DSOFTWARE_VOLUME)
|
||||
@@ -42,13 +41,17 @@ if (PCB STREQUAL X10)
|
||||
set(LCD_DRIVER lcd_driver.cpp)
|
||||
set(LUA_EXPORT lua_export_x10)
|
||||
if (PCBREV STREQUAL EXPRESS)
|
||||
set(FLAVOUR x10express)
|
||||
option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" OFF)
|
||||
option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" ON)
|
||||
else()
|
||||
set(FLAVOUR x10)
|
||||
option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" ON)
|
||||
option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" OFF)
|
||||
endif()
|
||||
elseif (PCB STREQUAL X12S)
|
||||
option(INTERNAL_MODULE_PXX1 "Support for PXX1 internal module" ON)
|
||||
option(INTERNAL_MODULE_PXX2 "Support for PXX2 internal module" OFF)
|
||||
set(FLAVOUR x12s)
|
||||
set(PCBREV "13" CACHE STRING "PCB Revision")
|
||||
if(${PCBREV} GREATER 10)
|
||||
@@ -64,7 +67,7 @@ elseif (PCB STREQUAL X12S)
|
||||
set(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
audio_spi_driver.cpp
|
||||
adc_driver.cpp
|
||||
x12s_adc_driver.cpp
|
||||
gps_driver.cpp
|
||||
)
|
||||
set(AUX_SERIAL_DRIVER ../common/arm/stm32/aux_serial_driver.cpp)
|
||||
@@ -136,7 +139,7 @@ if(PXX2)
|
||||
set(GUI_SRC
|
||||
${GUI_SRC}
|
||||
radio_spectrum_analyser.cpp
|
||||
# radio_power_meter.cpp
|
||||
radio_power_meter.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -200,3 +203,4 @@ if(PYTHONINTERP_FOUND)
|
||||
DEPENDS ${RADIO_DIRECTORY}/src/datastructs.h ${RADIO_DIRECTORY}/util/generate_datacopy.py
|
||||
)
|
||||
endif()
|
||||
|
||||
|
||||
@@ -181,6 +181,10 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
ledBlue();
|
||||
|
||||
#if defined(RTCLOCK) && !defined(COPROCESSOR)
|
||||
rtcInit(); // RTC must be initialized before rambackupRestore() is called
|
||||
#endif
|
||||
}
|
||||
|
||||
void boardOff()
|
||||
|
||||
@@ -103,15 +103,15 @@ enum {
|
||||
// SD driver
|
||||
#define BLOCK_SIZE 512 /* Block Size in Bytes */
|
||||
#if !defined(SIMU) || defined(SIMU_DISKIO)
|
||||
uint32_t sdIsHC(void);
|
||||
uint32_t sdGetSpeed(void);
|
||||
uint32_t sdIsHC();
|
||||
uint32_t sdGetSpeed();
|
||||
#define SD_IS_HC() (sdIsHC())
|
||||
#define SD_GET_SPEED() (sdGetSpeed())
|
||||
#define SD_GET_FREE_BLOCKNR() (sdGetFreeSectors())
|
||||
#define SD_CARD_PRESENT() (~SD_PRESENT_GPIO->IDR & SD_PRESENT_GPIO_PIN)
|
||||
void sdInit(void);
|
||||
void sdMount(void);
|
||||
void sdDone(void);
|
||||
void sdInit();
|
||||
void sdMount();
|
||||
void sdDone();
|
||||
#define sdPoll10ms()
|
||||
uint32_t sdMounted();
|
||||
#else
|
||||
@@ -134,14 +134,14 @@ DRESULT __disk_write(BYTE drv, const BYTE * buff, DWORD sector, UINT count);
|
||||
|
||||
// Flash Write driver
|
||||
#define FLASH_PAGESIZE 256
|
||||
void unlockFlash(void);
|
||||
void lockFlash(void);
|
||||
void unlockFlash();
|
||||
void lockFlash();
|
||||
void flashWrite(uint32_t * address, uint32_t * buffer);
|
||||
uint32_t isFirmwareStart(const uint8_t * buffer);
|
||||
uint32_t isBootloaderStart(const uint8_t * buffer);
|
||||
|
||||
// SDRAM driver
|
||||
void SDRAM_Init(void);
|
||||
void SDRAM_Init();
|
||||
|
||||
// Pulses driver
|
||||
#define INTERNAL_MODULE_ON() GPIO_SetBits(INTMODULE_PWR_GPIO, INTMODULE_PWR_GPIO_PIN)
|
||||
@@ -184,10 +184,10 @@ void extmoduleSendBuffer(const uint8_t * data, uint8_t size);
|
||||
void extmoduleSendNextFrame();
|
||||
|
||||
// Trainer driver
|
||||
void init_trainer_ppm(void);
|
||||
void stop_trainer_ppm(void);
|
||||
void init_trainer_capture(void);
|
||||
void stop_trainer_capture(void);
|
||||
void init_trainer_ppm();
|
||||
void stop_trainer_ppm();
|
||||
void init_trainer_capture();
|
||||
void stop_trainer_capture();
|
||||
|
||||
// Keys driver
|
||||
enum EnumKeys
|
||||
@@ -280,9 +280,9 @@ enum EnumSwitchesPositions
|
||||
|
||||
#define STORAGE_NUM_SWITCHES_POSITIONS (STORAGE_NUM_SWITCHES * 3)
|
||||
|
||||
void keysInit(void);
|
||||
void keysInit();
|
||||
uint32_t switchState(uint8_t index);
|
||||
uint32_t readKeys(void);
|
||||
uint32_t readKeys();
|
||||
#define KEYS_PRESSED() (readKeys())
|
||||
#define DBLKEYS_PRESSED_RGT_LFT(in) ((in & ((1<<KEY_RIGHT) + (1<<KEY_LEFT))) == ((1<<KEY_RIGHT) + (1<<KEY_LEFT)))
|
||||
#define DBLKEYS_PRESSED_UP_DWN(in) ((in & ((1<<KEY_UP) + (1<<KEY_DOWN))) == ((1<<KEY_UP) + (1<<KEY_DOWN)))
|
||||
@@ -292,13 +292,13 @@ uint32_t readKeys(void);
|
||||
// Trims driver
|
||||
#define NUM_TRIMS 6
|
||||
#define NUM_TRIMS_KEYS (NUM_TRIMS * 2)
|
||||
uint32_t readTrims(void);
|
||||
uint32_t readTrims();
|
||||
#define TRIMS_PRESSED() (readTrims())
|
||||
|
||||
// Rotary encoder driver
|
||||
#define ROTARY_ENCODER_NAVIGATION
|
||||
void rotaryEncoderInit(void);
|
||||
void rotaryEncoderCheck(void);
|
||||
void rotaryEncoderInit();
|
||||
void rotaryEncoderCheck();
|
||||
|
||||
// WDT driver
|
||||
#define WDTO_500MS 500
|
||||
@@ -498,11 +498,11 @@ void lcdSetContrast();
|
||||
#define lcdRefreshWait(...)
|
||||
|
||||
// Backlight driver
|
||||
void backlightInit(void);
|
||||
#if defined(SIMU)
|
||||
void backlightInit();
|
||||
#if defined(SIMU) || !defined(__cplusplus)
|
||||
#define backlightEnable(...)
|
||||
#else
|
||||
void backlightEnable(uint8_t dutyCycle);
|
||||
void backlightEnable(uint8_t dutyCycle = 0);
|
||||
#endif
|
||||
#define BACKLIGHT_LEVEL_MAX 100
|
||||
#if defined(PCBX12S)
|
||||
@@ -532,8 +532,8 @@ void usbJoystickUpdate();
|
||||
#endif
|
||||
|
||||
// Audio driver
|
||||
void audioInit(void);
|
||||
void audioConsumeCurrentBuffer(void);
|
||||
void audioInit();
|
||||
void audioConsumeCurrentBuffer();
|
||||
#define audioDisableIrq() // interrupts must stay enabled on Horus
|
||||
#define audioEnableIrq() // interrupts must stay enabled on Horus
|
||||
#if defined(PCBX12S)
|
||||
@@ -543,15 +543,15 @@ void setSampleRate(uint32_t frequency);
|
||||
#endif
|
||||
void setScaledVolume(uint8_t volume);
|
||||
void setVolume(uint8_t volume);
|
||||
int32_t getVolume(void);
|
||||
int32_t getVolume();
|
||||
#define VOLUME_LEVEL_MAX 23
|
||||
#define VOLUME_LEVEL_DEF 12
|
||||
|
||||
// Telemetry driver
|
||||
#define TELEMETRY_FIFO_SIZE 512
|
||||
void telemetryPortInit(uint32_t baudrate, uint8_t mode);
|
||||
void telemetryPortSetDirectionInput(void);
|
||||
void telemetryPortSetDirectionOutput(void);
|
||||
void telemetryPortSetDirectionInput();
|
||||
void telemetryPortSetDirectionOutput();
|
||||
void sportSendByte(uint8_t byte);
|
||||
void sportSendBuffer(const uint8_t * buffer, uint32_t count);
|
||||
uint8_t telemetryGetByte(uint8_t * byte);
|
||||
@@ -560,8 +560,8 @@ extern uint32_t telemetryErrors;
|
||||
|
||||
// Sport update driver
|
||||
#if defined(PCBX10)
|
||||
void sportUpdatePowerOn(void);
|
||||
void sportUpdatePowerOff(void);
|
||||
void sportUpdatePowerOn();
|
||||
void sportUpdatePowerOff();
|
||||
#define SPORT_UPDATE_POWER_ON() sportUpdatePowerOn()
|
||||
#define SPORT_UPDATE_POWER_OFF() sportUpdatePowerOff()
|
||||
#else
|
||||
@@ -570,9 +570,9 @@ void sportUpdatePowerOff(void);
|
||||
#endif
|
||||
|
||||
// Haptic driver
|
||||
void hapticInit(void);
|
||||
void hapticDone(void);
|
||||
void hapticOff(void);
|
||||
void hapticInit();
|
||||
void hapticDone();
|
||||
void hapticOff();
|
||||
void hapticOn(uint32_t pwmPercent);
|
||||
|
||||
// GPS driver
|
||||
@@ -594,8 +594,8 @@ extern uint8_t auxSerialMode;
|
||||
void auxSerialInit(unsigned int mode, unsigned int protocol);
|
||||
void auxSerialPutc(char c);
|
||||
#define auxSerialTelemetryInit(protocol) auxSerialInit(UART_MODE_TELEMETRY, protocol)
|
||||
void auxSerialSbusInit(void);
|
||||
void auxSerialStop(void);
|
||||
void auxSerialSbusInit();
|
||||
void auxSerialStop();
|
||||
#endif
|
||||
#define USART_FLAG_ERRORS (USART_FLAG_ORE | USART_FLAG_NE | USART_FLAG_FE | USART_FLAG_PE)
|
||||
|
||||
@@ -606,15 +606,16 @@ void auxSerialStop(void);
|
||||
#define BLUETOOTH_FACTORY_BAUDRATE 57600
|
||||
#define BLUETOOTH_DEFAULT_BAUDRATE 115200
|
||||
void bluetoothInit(uint32_t baudrate, bool enable);
|
||||
void bluetoothWriteWakeup(void);
|
||||
uint8_t bluetoothIsWriting(void);
|
||||
void bluetoothDisable(void);
|
||||
void bluetoothWriteWakeup();
|
||||
uint8_t bluetoothIsWriting();
|
||||
void bluetoothDisable();
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#include "fifo.h"
|
||||
#include "dmafifo.h"
|
||||
extern DMAFifo<512> telemetryFifo;
|
||||
extern DMAFifo<32> auxSerialRxFifo;
|
||||
typedef DMAFifo<32> AuxSerialRxFifo;
|
||||
extern AuxSerialRxFifo auxSerialRxFifo;
|
||||
#endif
|
||||
|
||||
#endif // _BOARD_H_
|
||||
|
||||
@@ -309,7 +309,7 @@ void extmoduleSendNextFrame()
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(PXX2)
|
||||
#if defined(PXX2) && defined(EXTMODULE_USART)
|
||||
case PROTOCOL_CHANNELS_PXX2_HIGHSPEED:
|
||||
case PROTOCOL_CHANNELS_PXX2_LOWSPEED:
|
||||
extmoduleSendBuffer(extmodulePulsesData.pxx2.getData(), extmodulePulsesData.pxx2.getSize());
|
||||
|
||||
@@ -590,7 +590,6 @@
|
||||
#define INTMODULE_BOOTCMD_GPIO GPIOI
|
||||
#define INTMODULE_BOOTCMD_GPIO_PIN GPIO_Pin_9 // PI.09
|
||||
#endif
|
||||
#define INTMODULE_FLASH_BAUDRATE 38400
|
||||
#if defined(PCBX10) || PCBREV >= 13
|
||||
#define INTMODULE_RCC_APB1Periph RCC_APB1Periph_TIM2
|
||||
#define INTMODULE_RCC_APB2Periph RCC_APB2Periph_USART1
|
||||
|
||||
@@ -316,17 +316,12 @@ void OpenTxSimulator::setTrainerTimeout(uint16_t ms)
|
||||
|
||||
void OpenTxSimulator::sendTelemetry(const QByteArray data)
|
||||
{
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
//OTXS_DBG << data;
|
||||
sportProcessTelemetryPacket((uint8_t *)data.constData());
|
||||
#else
|
||||
Q_UNUSED(data)
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t OpenTxSimulator::getSensorInstance(uint16_t id, uint8_t defaultValue)
|
||||
{
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
for (int i = 0; i < MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
@@ -335,15 +330,11 @@ uint8_t OpenTxSimulator::getSensorInstance(uint16_t id, uint8_t defaultValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(id)
|
||||
#endif
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
uint16_t OpenTxSimulator::getSensorRatio(uint16_t id)
|
||||
{
|
||||
#if defined(TELEMETRY_FRSKY_SPORT)
|
||||
for (int i = 0; i < MAX_TELEMETRY_SENSORS; i++) {
|
||||
if (isTelemetryFieldAvailable(i)) {
|
||||
TelemetrySensor * sensor = &g_model.telemetrySensors[i];
|
||||
@@ -352,9 +343,6 @@ uint16_t OpenTxSimulator::getSensorRatio(uint16_t id)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(id)
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -378,9 +366,7 @@ const int OpenTxSimulator::getCapability(Capability cap)
|
||||
break;
|
||||
|
||||
case CAP_TELEM_FRSKY_SPORT :
|
||||
#ifdef TELEMETRY_FRSKY_SPORT
|
||||
ret = 1;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -741,3 +741,43 @@ void disableSpeaker()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(COPROCESSOR)
|
||||
CoprocData coprocData;
|
||||
|
||||
void coprocReadData(bool)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void rtcInit()
|
||||
{
|
||||
}
|
||||
|
||||
void rtcGetTime(struct gtm * t)
|
||||
{
|
||||
}
|
||||
|
||||
void rtcSetTime(const struct gtm * t)
|
||||
{
|
||||
}
|
||||
|
||||
#if defined(AUX_SERIAL)
|
||||
AuxSerialRxFifo auxSerialRxFifo(nullptr);
|
||||
uint8_t auxSerialMode;
|
||||
void auxSerialInit(unsigned int mode, unsigned int protocol)
|
||||
{
|
||||
}
|
||||
|
||||
void auxSerialPutc(char c)
|
||||
{
|
||||
}
|
||||
|
||||
void auxSerialSbusInit()
|
||||
{
|
||||
}
|
||||
|
||||
void auxSerialStop()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -15,8 +15,8 @@ if(PCB STREQUAL 9XRPRO)
|
||||
add_definitions(-Dat91sam3s8 -DREVX)
|
||||
set(FLAVOUR 9xrpro)
|
||||
set(LINKER_SCRIPT targets/sky9x/sam3s8c_flash.ld)
|
||||
set(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
rtc_driver.cpp
|
||||
)
|
||||
set(OPENRC_BOOTLOADER bootflash8.lbm)
|
||||
@@ -25,9 +25,9 @@ elseif(PCB STREQUAL AR9X)
|
||||
add_definitions(-Dat91sam3s8 -DPCBAR9X -DSOFTWARE_VOLUME)
|
||||
set(FLAVOUR ar9x)
|
||||
include_directories(${THIRDPARTY_DIR}/xdk-asf-3.31.0/sam/drivers/twi)
|
||||
set(SRC ${SRC} ${THIRDPARTY_DIR}/xdk-asf-3.31.0/sam/drivers/twi/twi.c)
|
||||
set(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
../../${THIRDPARTY_DIR}/xdk-asf-3.31.0/sam/drivers/twi/twi.c
|
||||
i2c_driver.cpp
|
||||
rtc_ds3231_driver.cpp
|
||||
)
|
||||
@@ -38,8 +38,8 @@ else()
|
||||
set(FLAVOUR sky9x)
|
||||
set(PCBREV "REVC" CACHE STRING "PCB Revision (REVB/REVC)")
|
||||
set_property(CACHE PCBREV PROPERTY STRINGS "REVB" "REVC")
|
||||
set(TARGET_SRC
|
||||
${TARGET_SRC}
|
||||
set(FIRMWARE_TARGET_SRC
|
||||
${FIRMWARE_TARGET_SRC}
|
||||
coproc_driver.cpp
|
||||
rotary_encoder_driver.cpp
|
||||
rtc_driver.cpp
|
||||
@@ -90,14 +90,20 @@ set(FIRMWARE_TARGET_SRC
|
||||
eeprom_driver.cpp
|
||||
lcd_driver.cpp
|
||||
pwr_driver.cpp
|
||||
joystick.cpp
|
||||
massstorage.cpp
|
||||
keys_driver.cpp
|
||||
usb/device/core/USBD_UDP.c
|
||||
usb/device/core/USBDDriver.c
|
||||
usb_driver.cpp
|
||||
usb/device/massstorage/MSDDriver.c
|
||||
usb/device/massstorage/MSDDStateMachine.c
|
||||
usb/device/massstorage/MSDLun.c
|
||||
usb/device/massstorage/MSDDriverDescriptors.c
|
||||
usb/device/massstorage/SBCMethods.c
|
||||
usb/device/hid-joystick/HIDDJoystickDriver.c
|
||||
usb/device/hid-joystick/HIDDJoystickDriverDescriptors.c
|
||||
usb/device/hid-joystick/HIDDJoystickInputReport.c
|
||||
usb/common/core/USBEndpointDescriptor.c
|
||||
usb/common/core/USBGenericRequest.c
|
||||
usb/common/core/USBFeatureRequest.c
|
||||
@@ -107,6 +113,8 @@ set(FIRMWARE_TARGET_SRC
|
||||
usb/common/core/USBSetConfigurationRequest.c
|
||||
usb/common/core/USBConfigurationDescriptor.c
|
||||
usb/common/core/USBGenericDescriptor.c
|
||||
usb/common/hid/HIDIdleRequest.c
|
||||
usb/common/hid/HIDReportRequest.c
|
||||
MEDSdcard.c
|
||||
)
|
||||
|
||||
@@ -119,7 +127,6 @@ set(TARGET_SRC
|
||||
buzzer_driver.cpp
|
||||
haptic_driver.cpp
|
||||
sdcard_driver.cpp
|
||||
massstorage.cpp
|
||||
aux_serial_driver.cpp
|
||||
audio_driver.cpp
|
||||
trainer_driver.cpp
|
||||
@@ -129,3 +136,4 @@ set(SRC
|
||||
${SRC}
|
||||
debug.cpp
|
||||
)
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user