mirror of
https://github.com/opentx/opentx.git
synced 2025-07-16 21:05:26 +03:00
parent
4de7630286
commit
4c96dbad4e
27 changed files with 374 additions and 2 deletions
|
@ -74,6 +74,7 @@ void menuRadioTools(event_t event);
|
||||||
void menuRadioSpectrumAnalyser(event_t event);
|
void menuRadioSpectrumAnalyser(event_t event);
|
||||||
void menuRadioPowerMeter(event_t event);
|
void menuRadioPowerMeter(event_t event);
|
||||||
void menuRadioCalibration(event_t event);
|
void menuRadioCalibration(event_t event);
|
||||||
|
void menuGhostModuleConfig(event_t event);
|
||||||
|
|
||||||
static const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT] = {
|
static const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT] = {
|
||||||
#if defined(RADIO_TOOLS)
|
#if defined(RADIO_TOOLS)
|
||||||
|
|
|
@ -76,6 +76,7 @@ void menuRadioTools(event_t event);
|
||||||
void menuRadioCalibration(event_t event);
|
void menuRadioCalibration(event_t event);
|
||||||
void menuRadioSpectrumAnalyser(event_t event);
|
void menuRadioSpectrumAnalyser(event_t event);
|
||||||
void menuRadioPowerMeter(event_t event);
|
void menuRadioPowerMeter(event_t event);
|
||||||
|
void menuGhostModuleConfig(event_t event);
|
||||||
|
|
||||||
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
|
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
|
||||||
|
|
||||||
|
|
|
@ -224,6 +224,7 @@ bool menuRadioHardware(event_t event);
|
||||||
bool menuRadioCalibration(event_t event);
|
bool menuRadioCalibration(event_t event);
|
||||||
bool menuRadioSpectrumAnalyser(event_t event);
|
bool menuRadioSpectrumAnalyser(event_t event);
|
||||||
bool menuRadioPowerMeter(event_t event);
|
bool menuRadioPowerMeter(event_t event);
|
||||||
|
bool menuGhostModuleConfig(event_t event);
|
||||||
|
|
||||||
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
|
extern const MenuHandlerFunc menuTabGeneral[MENU_RADIO_PAGES_COUNT];
|
||||||
|
|
||||||
|
|
102
radio/src/gui/480x272/radio_ghost_menu.cpp
Normal file
102
radio/src/gui/480x272/radio_ghost_menu.cpp
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) OpenTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "opentx.h"
|
||||||
|
|
||||||
|
bool menuGhostModuleConfig(event_t event)
|
||||||
|
{
|
||||||
|
switch (event) {
|
||||||
|
case EVT_ENTRY:
|
||||||
|
memclear(&reusableBuffer.ghostMenu, sizeof(reusableBuffer.ghostMenu));
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_NONE;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_OPEN;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_ROTARY_LEFT:
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYUP;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_ROTARY_RIGHT:
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYDOWN;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_FIRST(KEY_ENTER):
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYPRESS;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYLEFT;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_LONG(KEY_EXIT):
|
||||||
|
menuVerticalOffset = 0;
|
||||||
|
memclear(&reusableBuffer.ghostMenu, sizeof(reusableBuffer.ghostMenu));
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_NONE;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_CLOSE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
RTOS_WAIT_MS(10);
|
||||||
|
popMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reusableBuffer.ghostMenu.menuAction == GHST_MENU_CTRL_CLOSE) {
|
||||||
|
popMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
drawMenuTemplate(STR_GHOST_MENU_LABEL, ICON_OPENTX, nullptr, OPTION_MENU_NO_SCROLLBAR);
|
||||||
|
|
||||||
|
constexpr coord_t xOffset = 140;
|
||||||
|
constexpr coord_t xOffset2 = 260;
|
||||||
|
constexpr coord_t yOffset = 55;
|
||||||
|
constexpr coord_t lineSpacing = 25;
|
||||||
|
LcdFlags flags = 0;
|
||||||
|
|
||||||
|
for (uint8_t line = 0; line < GHST_MENU_LINES; line++) {
|
||||||
|
flags = 0;
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].splitLine) {
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT)
|
||||||
|
flags = INVERS;
|
||||||
|
lcdDrawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, flags);
|
||||||
|
|
||||||
|
flags = 0;
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_SELECT)
|
||||||
|
flags |= INVERS;
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_EDIT)
|
||||||
|
flags |= BLINK;
|
||||||
|
lcdDrawText(xOffset2, yOffset + line * lineSpacing, &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], flags);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT)
|
||||||
|
flags = INVERS;
|
||||||
|
lcdDrawText(xOffset, yOffset + line * lineSpacing, reusableBuffer.ghostMenu.line[line].menuText, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -132,6 +132,11 @@ bool menuRadioTools(event_t event)
|
||||||
addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(GHOST)
|
||||||
|
if (isModuleGhost(EXTERNAL_MODULE))
|
||||||
|
addRadioModuleTool(index++, "Ghost Menu", menuGhostModuleConfig, EXTERNAL_MODULE);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
lcdDrawCenteredText(LCD_H/2, STR_NO_TOOLS);
|
lcdDrawCenteredText(LCD_H/2, STR_NO_TOOLS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,13 @@ if(PXX2)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(GHOST)
|
||||||
|
set(GUI_SRC
|
||||||
|
${GUI_SRC}
|
||||||
|
../common/stdlcd/radio_ghost_menu.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(PXX2 OR MULTIMODULE)
|
if(PXX2 OR MULTIMODULE)
|
||||||
set(GUI_SRC
|
set(GUI_SRC
|
||||||
${GUI_SRC}
|
${GUI_SRC}
|
||||||
|
|
110
radio/src/gui/common/stdlcd/radio_ghost_menu.cpp
Normal file
110
radio/src/gui/common/stdlcd/radio_ghost_menu.cpp
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) OpenTX
|
||||||
|
*
|
||||||
|
* Based on code named
|
||||||
|
* th9x - http://code.google.com/p/th9x
|
||||||
|
* er9x - http://code.google.com/p/er9x
|
||||||
|
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||||
|
*
|
||||||
|
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License version 2 as
|
||||||
|
* published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "opentx.h"
|
||||||
|
|
||||||
|
void menuGhostModuleConfig(event_t event)
|
||||||
|
{
|
||||||
|
switch (event) {
|
||||||
|
case EVT_ENTRY:
|
||||||
|
memclear(&reusableBuffer.ghostMenu, sizeof(reusableBuffer.ghostMenu));
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_NONE;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_OPEN;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
case EVT_ROTARY_LEFT:
|
||||||
|
#elif defined(KEYS_GPIO_REG_UP)
|
||||||
|
case EVT_KEY_BREAK(KEY_UP):
|
||||||
|
#elif defined(KEYS_GPIO_REG_PLUS)
|
||||||
|
case EVT_KEY_BREAK(KEY_PLUS):
|
||||||
|
#endif
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYUP;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
case EVT_ROTARY_RIGHT:
|
||||||
|
#elif defined(KEYS_GPIO_REG_DOWN)
|
||||||
|
case EVT_KEY_BREAK(KEY_DOWN):
|
||||||
|
#elif defined(KEYS_GPIO_REG_MINUS)
|
||||||
|
case EVT_KEY_BREAK(KEY_MINUS):
|
||||||
|
#endif
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYDOWN;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
case EVT_KEY_FIRST(KEY_ENTER):
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYPRESS;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_BREAK(KEY_EXIT):
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_JOYLEFT;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_NONE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EVT_KEY_LONG(KEY_EXIT):
|
||||||
|
menuVerticalOffset = 0;
|
||||||
|
memclear(&reusableBuffer.ghostMenu, sizeof(reusableBuffer.ghostMenu));
|
||||||
|
reusableBuffer.ghostMenu.buttonAction = GHST_BTN_NONE;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = GHST_MENU_CTRL_CLOSE;
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_MENU_CONTROL;
|
||||||
|
RTOS_WAIT_MS(10);
|
||||||
|
popMenu();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reusableBuffer.ghostMenu.menuAction == GHST_MENU_CTRL_CLOSE) {
|
||||||
|
popMenu();
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr coord_t xOffset = LCD_W / 3 - 15;
|
||||||
|
constexpr coord_t xOffset2 = LCD_W / 3 + LCD_W / 4;
|
||||||
|
constexpr coord_t yOffset = 6;
|
||||||
|
LcdFlags flags = 0;
|
||||||
|
|
||||||
|
for (uint8_t line = 0; line < GHST_MENU_LINES; line++) {
|
||||||
|
flags = 0;
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].splitLine) {
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT)
|
||||||
|
flags = INVERS;
|
||||||
|
lcdDrawText(xOffset, yOffset + line * FH, reusableBuffer.ghostMenu.line[line].menuText, flags);
|
||||||
|
|
||||||
|
flags = 0;
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_SELECT)
|
||||||
|
flags |= INVERS;
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_VALUE_EDIT)
|
||||||
|
flags |= BLINK;
|
||||||
|
lcdDrawText(xOffset2, yOffset + line * FH, &reusableBuffer.ghostMenu.line[line].menuText[reusableBuffer.ghostMenu.line[line].splitLine], flags);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (reusableBuffer.ghostMenu.line[line].lineFlags & GHST_LINE_FLAGS_LABEL_SELECT)
|
||||||
|
flags = INVERS;
|
||||||
|
lcdDrawText(xOffset, yOffset + line * FH, reusableBuffer.ghostMenu.line[line].menuText, flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -129,6 +129,11 @@ void menuRadioTools(event_t event)
|
||||||
addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
addRadioModuleTool(index++, STR_POWER_METER_EXT, menuRadioPowerMeter, EXTERNAL_MODULE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(GHOST)
|
||||||
|
if (isModuleGhost(EXTERNAL_MODULE))
|
||||||
|
addRadioModuleTool(index++, "Ghost Menu", menuGhostModuleConfig, EXTERNAL_MODULE);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
lcdDrawCenteredText(LCD_H/2, STR_NO_TOOLS);
|
lcdDrawCenteredText(LCD_H/2, STR_NO_TOOLS);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1128,6 +1128,14 @@ union ReusableBuffer
|
||||||
uint8_t moduleOFF;
|
uint8_t moduleOFF;
|
||||||
} spectrumAnalyser;
|
} spectrumAnalyser;
|
||||||
|
|
||||||
|
#if defined(GHOST)
|
||||||
|
struct {
|
||||||
|
GhostMenuData line[GHST_MENU_LINES + 1];
|
||||||
|
uint8_t menuAction;
|
||||||
|
uint8_t buttonAction;
|
||||||
|
} ghostMenu;
|
||||||
|
#endif
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint32_t freq;
|
uint32_t freq;
|
||||||
int16_t power;
|
int16_t power;
|
||||||
|
|
|
@ -20,6 +20,31 @@
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
|
uint8_t createGhostMenuControlFrame(uint8_t * frame, int16_t * pulses)
|
||||||
|
{
|
||||||
|
moduleState[EXTERNAL_MODULE].counter = GHST_FRAME_CHANNEL;
|
||||||
|
|
||||||
|
uint8_t * buf = frame;
|
||||||
|
#if SPORT_MAX_BAUDRATE < 400000
|
||||||
|
*buf++ = g_eeGeneral.telemetryBaudrate == GHST_TELEMETRY_RATE_400K ? GHST_ADDR_MODULE_SYM : GHST_ADDR_MODULE_ASYM;
|
||||||
|
#else
|
||||||
|
*buf++ = GHST_ADDR_MODULE_SYM;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
*buf++ = GHST_UL_RC_CHANS_SIZE;
|
||||||
|
uint8_t * crc_start = buf;
|
||||||
|
*buf++ = GHST_UL_MENU_CTRL;
|
||||||
|
*buf++ = reusableBuffer.ghostMenu.buttonAction; // Joystick states, Up, Down, Left, Right, Press
|
||||||
|
*buf++ = reusableBuffer.ghostMenu.menuAction; // menu control, open, close, etc.
|
||||||
|
|
||||||
|
for (uint8_t i = 0; i < 8; i++)
|
||||||
|
*buf++ = 0; // padding to make this the same size as the pulses packet
|
||||||
|
|
||||||
|
*buf++ = crc8(crc_start, GHST_UL_RC_CHANS_SIZE - 1);
|
||||||
|
|
||||||
|
return buf - frame;
|
||||||
|
}
|
||||||
|
|
||||||
// Range for pulses (channels output) is [-1024:+1024]
|
// Range for pulses (channels output) is [-1024:+1024]
|
||||||
uint8_t createGhostChannelsFrame(uint8_t * frame, int16_t * pulses)
|
uint8_t createGhostChannelsFrame(uint8_t * frame, int16_t * pulses)
|
||||||
{
|
{
|
||||||
|
@ -89,6 +114,9 @@ void setupPulsesGhost()
|
||||||
{
|
{
|
||||||
if (telemetryProtocol == PROTOCOL_TELEMETRY_GHOST) {
|
if (telemetryProtocol == PROTOCOL_TELEMETRY_GHOST) {
|
||||||
uint8_t * pulses = extmodulePulsesData.ghost.pulses;
|
uint8_t * pulses = extmodulePulsesData.ghost.pulses;
|
||||||
extmodulePulsesData.ghost.length = createGhostChannelsFrame(pulses, &channelOutputs[g_model.moduleData[EXTERNAL_MODULE].channelsStart]);
|
if (moduleState[EXTERNAL_MODULE].counter == GHST_MENU_CONTROL)
|
||||||
|
extmodulePulsesData.ghost.length = createGhostMenuControlFrame(pulses, &channelOutputs[g_model.moduleData[EXTERNAL_MODULE].channelsStart]);
|
||||||
|
else
|
||||||
|
extmodulePulsesData.ghost.length = createGhostChannelsFrame(pulses, &channelOutputs[g_model.moduleData[EXTERNAL_MODULE].channelsStart]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,6 +211,10 @@ if(PXX2)
|
||||||
set(GUI_SRC ${GUI_SRC} radio_power_meter.cpp)
|
set(GUI_SRC ${GUI_SRC} radio_power_meter.cpp)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(GHOST)
|
||||||
|
set(GUI_SRC ${GUI_SRC} radio_ghost_menu.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(DISK_CACHE)
|
if(DISK_CACHE)
|
||||||
set(SRC ${SRC} disk_cache.cpp)
|
set(SRC ${SRC} disk_cache.cpp)
|
||||||
add_definitions(-DDISK_CACHE)
|
add_definitions(-DDISK_CACHE)
|
||||||
|
|
|
@ -635,7 +635,11 @@ void sportUpdatePowerInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Aux serial port driver
|
// Aux serial port driver
|
||||||
#define DEBUG_BAUDRATE 115200
|
#if defined(RADIO_TX16S)
|
||||||
|
#define DEBUG_BAUDRATE 250000
|
||||||
|
#else
|
||||||
|
#define DEBUG_BAUDRATE 115200
|
||||||
|
#endif
|
||||||
#if defined(AUX_SERIAL_GPIO)
|
#if defined(AUX_SERIAL_GPIO)
|
||||||
extern uint8_t auxSerialMode;
|
extern uint8_t auxSerialMode;
|
||||||
void auxSerialInit(unsigned int mode, unsigned int protocol);
|
void auxSerialInit(unsigned int mode, unsigned int protocol);
|
||||||
|
|
|
@ -175,6 +175,29 @@ void processGhostTelemetryFrame()
|
||||||
processGhostTelemetryValueString(sensor, vtxBandString);
|
processGhostTelemetryValueString(sensor, vtxBandString);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case GHST_DL_MENU_DESC:
|
||||||
|
{
|
||||||
|
GhostMenuFrame * packet;
|
||||||
|
GhostMenuData * lineData;
|
||||||
|
|
||||||
|
packet = (GhostMenuFrame * ) telemetryRxBuffer;
|
||||||
|
lineData = (GhostMenuData *) &reusableBuffer.ghostMenu.line[packet->lineIndex];
|
||||||
|
lineData->splitLine = 0;
|
||||||
|
reusableBuffer.ghostMenu.menuAction = packet->menuFlags;
|
||||||
|
lineData->lineFlags = packet->lineFlags;
|
||||||
|
for (uint8_t i = 0; i < GHST_MENU_CHARS; i++) {
|
||||||
|
if (packet->menuText[i] == 0x7C) {
|
||||||
|
lineData->menuText[i] = '\0';
|
||||||
|
lineData->splitLine = i + 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
lineData->menuText[i] = packet->menuText[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lineData->menuText[GHST_MENU_CHARS] = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,10 +38,12 @@
|
||||||
#define GHST_UL_RC_CHANS_HS4_9TO12 0x11 // High Speed 4 channel (12 bits), plus CH9-12 (8 bits)
|
#define GHST_UL_RC_CHANS_HS4_9TO12 0x11 // High Speed 4 channel (12 bits), plus CH9-12 (8 bits)
|
||||||
#define GHST_UL_RC_CHANS_HS4_13TO16 0x12 // High Speed 4 channel (12 bits), plus CH13-16 (8 bits)
|
#define GHST_UL_RC_CHANS_HS4_13TO16 0x12 // High Speed 4 channel (12 bits), plus CH13-16 (8 bits)
|
||||||
#define GHST_UL_RC_CHANS_SIZE 12 // 1 (type) + 10 (data) + 1 (crc)
|
#define GHST_UL_RC_CHANS_SIZE 12 // 1 (type) + 10 (data) + 1 (crc)
|
||||||
|
#define GHST_UL_MENU_CTRL 0x13
|
||||||
|
|
||||||
#define GHST_DL_OPENTX_SYNC 0x20
|
#define GHST_DL_OPENTX_SYNC 0x20
|
||||||
#define GHST_DL_LINK_STAT 0x21
|
#define GHST_DL_LINK_STAT 0x21
|
||||||
#define GHST_DL_VTX_STAT 0x22
|
#define GHST_DL_VTX_STAT 0x22
|
||||||
|
#define GHST_DL_MENU_DESC 0x24
|
||||||
|
|
||||||
#define GHST_RC_CTR_VAL_12BIT 0x7C0 // 0x3e0 << 1
|
#define GHST_RC_CTR_VAL_12BIT 0x7C0 // 0x3e0 << 1
|
||||||
#define GHST_RC_CTR_VAL_8BIT 0x7C
|
#define GHST_RC_CTR_VAL_8BIT 0x7C
|
||||||
|
@ -113,4 +115,62 @@ enum GhostTelemetryBaudrates
|
||||||
#define GHOST_BAUDRATE 400000
|
#define GHOST_BAUDRATE 400000
|
||||||
#define GHOST_PERIOD 4
|
#define GHOST_PERIOD 4
|
||||||
|
|
||||||
|
enum GhostLineFlags
|
||||||
|
{
|
||||||
|
GHST_LINE_FLAGS_NONE = 0x00,
|
||||||
|
GHST_LINE_FLAGS_LABEL_SELECT = 0x01,
|
||||||
|
GHST_LINE_FLAGS_VALUE_SELECT = 0x02,
|
||||||
|
GHST_LINE_FLAGS_VALUE_EDIT = 0x04,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum GhostButtons
|
||||||
|
{
|
||||||
|
GHST_BTN_NONE = 0x00,
|
||||||
|
GHST_BTN_JOYPRESS = 0X01,
|
||||||
|
GHST_BTN_JOYUP = 0X02,
|
||||||
|
GHST_BTN_JOYDOWN = 0X04,
|
||||||
|
GHST_BTN_JOYLEFT = 0X08,
|
||||||
|
GHST_BTN_JOYRIGHT = 0X10,
|
||||||
|
GHST_BTN_BIND = 0X20 // future, for no-UI Ghost
|
||||||
|
};
|
||||||
|
|
||||||
|
enum GhostMenuControl
|
||||||
|
{
|
||||||
|
GHST_MENU_CTRL_NONE = 0X00,
|
||||||
|
GHST_MENU_CTRL_OPEN = 0X01,
|
||||||
|
GHST_MENU_CTRL_CLOSE = 0X02,
|
||||||
|
GHST_MENU_CTRL_REDRAW = 0X04,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum GhostFrames
|
||||||
|
{
|
||||||
|
GHST_FRAME_CHANNEL,
|
||||||
|
GHST_MENU_CONTROL
|
||||||
|
};
|
||||||
|
|
||||||
|
constexpr uint8_t GHST_MENU_LINES = 6;
|
||||||
|
constexpr uint8_t GHST_MENU_CHARS = 20;
|
||||||
|
|
||||||
|
// GHST_DL_MENU_DESC (27 bytes)
|
||||||
|
struct GhostMenuFrame
|
||||||
|
{
|
||||||
|
uint8_t address;
|
||||||
|
uint8_t length ;
|
||||||
|
uint8_t packetId;
|
||||||
|
uint8_t menuFlags; // GHST_MENU_CTRL
|
||||||
|
uint8_t lineFlags; // Carat states, Inverse, Bold for each of Menu Label, and Value
|
||||||
|
uint8_t lineIndex; // 0 = first line
|
||||||
|
unsigned char menuText[GHST_MENU_CHARS];
|
||||||
|
uint8_t crc;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct GhostMenuData
|
||||||
|
{
|
||||||
|
uint8_t menuFlags; // Update Line, Clear Menu, etc.
|
||||||
|
uint8_t lineFlags; // Carat states, Inverse, Bold for each of Menu Label, and Value
|
||||||
|
uint8_t splitLine; // Store beginning of Value substring
|
||||||
|
char menuText[GHST_MENU_CHARS + 1];
|
||||||
|
};
|
||||||
|
|
||||||
#endif // _GHOST_H_
|
#endif // _GHOST_H_
|
||||||
|
|
|
@ -183,6 +183,7 @@ const char STR_MINUTEBEEP[] = TR_MINUTEBEEP;
|
||||||
const char STR_BEEPCOUNTDOWN[] = TR_BEEPCOUNTDOWN;
|
const char STR_BEEPCOUNTDOWN[] = TR_BEEPCOUNTDOWN;
|
||||||
const char STR_PERSISTENT[] = TR_PERSISTENT;
|
const char STR_PERSISTENT[] = TR_PERSISTENT;
|
||||||
const char STR_BACKLIGHT_LABEL[] = TR_BACKLIGHT_LABEL;
|
const char STR_BACKLIGHT_LABEL[] = TR_BACKLIGHT_LABEL;
|
||||||
|
const char STR_GHOST_MENU_LABEL[] = TR_GHOST_MENU_LABEL;
|
||||||
const char STR_BLDELAY[] = TR_BLDELAY;
|
const char STR_BLDELAY[] = TR_BLDELAY;
|
||||||
const char STR_RXCHANNELORD[] = TR_RXCHANNELORD;
|
const char STR_RXCHANNELORD[] = TR_RXCHANNELORD;
|
||||||
const char STR_STICKS[] = TR_STICKS;
|
const char STR_STICKS[] = TR_STICKS;
|
||||||
|
|
|
@ -300,6 +300,7 @@ extern const char STR_MINUTEBEEP[];
|
||||||
extern const char STR_BEEPCOUNTDOWN[];
|
extern const char STR_BEEPCOUNTDOWN[];
|
||||||
extern const char STR_PERSISTENT[];
|
extern const char STR_PERSISTENT[];
|
||||||
extern const char STR_BACKLIGHT_LABEL[];
|
extern const char STR_BACKLIGHT_LABEL[];
|
||||||
|
extern const char STR_GHOST_MENU_LABEL[];
|
||||||
extern const char STR_BLDELAY[];
|
extern const char STR_BLDELAY[];
|
||||||
|
|
||||||
#if defined(PWM_BACKLIGHT) || defined(COLORLCD)
|
#if defined(PWM_BACKLIGHT) || defined(COLORLCD)
|
||||||
|
|
|
@ -524,6 +524,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT"Odpočet"
|
#define TR_BEEPCOUNTDOWN INDENT"Odpočet"
|
||||||
#define TR_PERSISTENT INDENT"Trvalé"
|
#define TR_PERSISTENT INDENT"Trvalé"
|
||||||
#define TR_BACKLIGHT_LABEL "Podsvětlení"
|
#define TR_BACKLIGHT_LABEL "Podsvětlení"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT"Zhasnout po"
|
#define TR_BLDELAY INDENT"Zhasnout po"
|
||||||
#define TR_BLONBRIGHTNESS TR3(INDENT"Jas Zap.", INDENT"Jas Zap.", INDENT"Jas zapnutého LCD")
|
#define TR_BLONBRIGHTNESS TR3(INDENT"Jas Zap.", INDENT"Jas Zap.", INDENT"Jas zapnutého LCD")
|
||||||
#define TR_BLOFFBRIGHTNESS TR3(INDENT"Jas Vyp.", INDENT"Jas Vyp.", INDENT"Jas vypnutého LCD")
|
#define TR_BLOFFBRIGHTNESS TR3(INDENT"Jas Vyp.", INDENT"Jas Vyp.", INDENT"Jas vypnutého LCD")
|
||||||
|
|
|
@ -526,6 +526,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT "Countdown"
|
#define TR_BEEPCOUNTDOWN INDENT "Countdown"
|
||||||
#define TR_PERSISTENT TR(INDENT "Permanent", INDENT "Permanent")
|
#define TR_PERSISTENT TR(INDENT "Permanent", INDENT "Permanent")
|
||||||
#define TR_BACKLIGHT_LABEL "LCD-Beleuchtung"
|
#define TR_BACKLIGHT_LABEL "LCD-Beleuchtung"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT "Dauer"
|
#define TR_BLDELAY INDENT "Dauer"
|
||||||
#define TR_BLONBRIGHTNESS INDENT "An-Helligkeit"
|
#define TR_BLONBRIGHTNESS INDENT "An-Helligkeit"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT "Aus-Helligkeit"
|
#define TR_BLOFFBRIGHTNESS INDENT "Aus-Helligkeit"
|
||||||
|
|
|
@ -525,6 +525,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT "Countdown"
|
#define TR_BEEPCOUNTDOWN INDENT "Countdown"
|
||||||
#define TR_PERSISTENT TR(INDENT "Persist.", INDENT "Persistent")
|
#define TR_PERSISTENT TR(INDENT "Persist.", INDENT "Persistent")
|
||||||
#define TR_BACKLIGHT_LABEL "Backlight"
|
#define TR_BACKLIGHT_LABEL "Backlight"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT "Duration"
|
#define TR_BLDELAY INDENT "Duration"
|
||||||
#define TR_BLONBRIGHTNESS INDENT "ON brightness"
|
#define TR_BLONBRIGHTNESS INDENT "ON brightness"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT "OFF brightness"
|
#define TR_BLOFFBRIGHTNESS INDENT "OFF brightness"
|
||||||
|
|
|
@ -524,6 +524,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN TR(INDENT"Cta. atrás", INDENT"Cuenta atrás")
|
#define TR_BEEPCOUNTDOWN TR(INDENT"Cta. atrás", INDENT"Cuenta atrás")
|
||||||
#define TR_PERSISTENT TR(INDENT"Persisten.", INDENT"Persistente")
|
#define TR_PERSISTENT TR(INDENT"Persisten.", INDENT"Persistente")
|
||||||
#define TR_BACKLIGHT_LABEL "Luz fondo"
|
#define TR_BACKLIGHT_LABEL "Luz fondo"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT"Duración"
|
#define TR_BLDELAY INDENT"Duración"
|
||||||
#define TR_BLONBRIGHTNESS INDENT"MAS brillo"
|
#define TR_BLONBRIGHTNESS INDENT"MAS brillo"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT"MENOS brillo"
|
#define TR_BLOFFBRIGHTNESS INDENT"MENOS brillo"
|
||||||
|
|
|
@ -538,6 +538,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT"Countdown"
|
#define TR_BEEPCOUNTDOWN INDENT"Countdown"
|
||||||
#define TR_PERSISTENT TR(INDENT"Persist.", INDENT"Persistent")
|
#define TR_PERSISTENT TR(INDENT"Persist.", INDENT"Persistent")
|
||||||
#define TR_BACKLIGHT_LABEL "Backlight"
|
#define TR_BACKLIGHT_LABEL "Backlight"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT"Duration"
|
#define TR_BLDELAY INDENT"Duration"
|
||||||
#define TR_BLONBRIGHTNESS INDENT"ON Brightness"
|
#define TR_BLONBRIGHTNESS INDENT"ON Brightness"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT"OFF Brightness"
|
#define TR_BLOFFBRIGHTNESS INDENT"OFF Brightness"
|
||||||
|
|
|
@ -544,6 +544,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN TR(INDENT "Bip fin", INDENT "Compte à rebours")
|
#define TR_BEEPCOUNTDOWN TR(INDENT "Bip fin", INDENT "Compte à rebours")
|
||||||
#define TR_PERSISTENT TR(INDENT "Persist.", INDENT "Persistant")
|
#define TR_PERSISTENT TR(INDENT "Persist.", INDENT "Persistant")
|
||||||
#define TR_BACKLIGHT_LABEL "Rétroéclairage"
|
#define TR_BACKLIGHT_LABEL "Rétroéclairage"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT "Durée"
|
#define TR_BLDELAY INDENT "Durée"
|
||||||
#define TR_BLONBRIGHTNESS INDENT "Luminosité ON"
|
#define TR_BLONBRIGHTNESS INDENT "Luminosité ON"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT "Luminosité OFF"
|
#define TR_BLOFFBRIGHTNESS INDENT "Luminosité OFF"
|
||||||
|
|
|
@ -546,6 +546,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN TR(INDENT "Conto rov", INDENT "Conto rovescia")
|
#define TR_BEEPCOUNTDOWN TR(INDENT "Conto rov", INDENT "Conto rovescia")
|
||||||
#define TR_PERSISTENT TR(INDENT "Persist.", INDENT "Persistente")
|
#define TR_PERSISTENT TR(INDENT "Persist.", INDENT "Persistente")
|
||||||
#define TR_BACKLIGHT_LABEL TR("Retroillu.", "Retroilluminazione")
|
#define TR_BACKLIGHT_LABEL TR("Retroillu.", "Retroilluminazione")
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT "Durata"
|
#define TR_BLDELAY INDENT "Durata"
|
||||||
#define TR_BLONBRIGHTNESS TR(INDENT "Lumin. ON", INDENT "Luminosità ON")
|
#define TR_BLONBRIGHTNESS TR(INDENT "Lumin. ON", INDENT "Luminosità ON")
|
||||||
#define TR_BLOFFBRIGHTNESS TR(INDENT "Lumin. OFF", INDENT "Luminosità OFF")
|
#define TR_BLOFFBRIGHTNESS TR(INDENT "Lumin. OFF", INDENT "Luminosità OFF")
|
||||||
|
|
|
@ -527,6 +527,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT "Countdown"
|
#define TR_BEEPCOUNTDOWN INDENT "Countdown"
|
||||||
#define TR_PERSISTENT TR(INDENT "Vasth.", INDENT "Vasthouden")
|
#define TR_PERSISTENT TR(INDENT "Vasth.", INDENT "Vasthouden")
|
||||||
#define TR_BACKLIGHT_LABEL "LCD-Verlichting"
|
#define TR_BACKLIGHT_LABEL "LCD-Verlichting"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT "Duur"
|
#define TR_BLDELAY INDENT "Duur"
|
||||||
#define TR_BLONBRIGHTNESS INDENT "Aan-Helderheid"
|
#define TR_BLONBRIGHTNESS INDENT "Aan-Helderheid"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT "Uit-Helderheid"
|
#define TR_BLOFFBRIGHTNESS INDENT "Uit-Helderheid"
|
||||||
|
|
|
@ -545,6 +545,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT "Odliczanie"
|
#define TR_BEEPCOUNTDOWN INDENT "Odliczanie"
|
||||||
#define TR_PERSISTENT TR(INDENT "Dokł.", INDENT "Dokładny")
|
#define TR_PERSISTENT TR(INDENT "Dokł.", INDENT "Dokładny")
|
||||||
#define TR_BACKLIGHT_LABEL "Podświetl"
|
#define TR_BACKLIGHT_LABEL "Podświetl"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT"Czas trwania"
|
#define TR_BLDELAY INDENT"Czas trwania"
|
||||||
#define TR_BLONBRIGHTNESS INDENT"Jasnośc wł."
|
#define TR_BLONBRIGHTNESS INDENT"Jasnośc wł."
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT"Jasność wył."
|
#define TR_BLOFFBRIGHTNESS INDENT"Jasność wył."
|
||||||
|
|
|
@ -542,6 +542,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT "Beep Regressivo"
|
#define TR_BEEPCOUNTDOWN INDENT "Beep Regressivo"
|
||||||
#define TR_PERSISTENT INDENT "Persist."
|
#define TR_PERSISTENT INDENT "Persist."
|
||||||
#define TR_BACKLIGHT_LABEL "Backlight"
|
#define TR_BACKLIGHT_LABEL "Backlight"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT "Tempo Backlight"
|
#define TR_BLDELAY INDENT "Tempo Backlight"
|
||||||
#define TR_BLONBRIGHTNESS INDENT "ON Brightness"
|
#define TR_BLONBRIGHTNESS INDENT "ON Brightness"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT "OFF Brightness"
|
#define TR_BLOFFBRIGHTNESS INDENT "OFF Brightness"
|
||||||
|
|
|
@ -544,6 +544,7 @@
|
||||||
#define TR_BEEPCOUNTDOWN INDENT "Nedräkning"
|
#define TR_BEEPCOUNTDOWN INDENT "Nedräkning"
|
||||||
#define TR_PERSISTENT TR("Jämt på ", INDENT"Alltid På")
|
#define TR_PERSISTENT TR("Jämt på ", INDENT"Alltid På")
|
||||||
#define TR_BACKLIGHT_LABEL "Belysning"
|
#define TR_BACKLIGHT_LABEL "Belysning"
|
||||||
|
#define TR_GHOST_MENU_LABEL "GHOST MENU"
|
||||||
#define TR_BLDELAY INDENT "Av efter"
|
#define TR_BLDELAY INDENT "Av efter"
|
||||||
#define TR_BLONBRIGHTNESS INDENT "På Ljusstyrka"
|
#define TR_BLONBRIGHTNESS INDENT "På Ljusstyrka"
|
||||||
#define TR_BLOFFBRIGHTNESS INDENT "Av Ljusstyrka"
|
#define TR_BLOFFBRIGHTNESS INDENT "Av Ljusstyrka"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue