Asym ghost support (#7910)

This commit is contained in:
3djc
2020-09-05 08:24:07 +02:00
committed by GitHub
parent 7f5dc552ef
commit 159a891ab4
10 changed files with 64 additions and 16 deletions
+22
View File
@@ -125,6 +125,11 @@ void processGhostTelemetryFrame()
switch(id) {
case GHST_DL_LINK_STAT:
{
#if defined(BLUETOOTH)
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY && bluetooth.state == BLUETOOTH_STATE_CONNECTED) {
bluetooth.write(telemetryRxBuffer, telemetryRxBufferCount);
}
#endif
uint8_t rssiVal = min<uint8_t>(telemetryRxBuffer[3], 100);
uint8_t lqVal = min<uint8_t>(telemetryRxBuffer[4], 100);
uint8_t snrVal = min<uint8_t>(telemetryRxBuffer[5], 100);
@@ -157,6 +162,11 @@ void processGhostTelemetryFrame()
case GHST_DL_VTX_STAT:
{
#if defined(BLUETOOTH)
if (g_eeGeneral.bluetoothMode == BLUETOOTH_TELEMETRY && bluetooth.state == BLUETOOTH_STATE_CONNECTED) {
bluetooth.write(telemetryRxBuffer, telemetryRxBufferCount);
}
#endif
uint8_t vtxBandEnum = min<uint8_t>(telemetryRxBuffer[8], GHST_VTX_BAND_MAX);
const GhostSensor * sensor = getGhostSensor(GHOST_ID_VTX_BAND);
@@ -173,6 +183,18 @@ void processGhostTelemetryFrame()
void processGhostTelemetryData(uint8_t data)
{
#if defined(AUX_SERIAL)
if (g_eeGeneral.auxSerialMode == UART_MODE_TELEMETRY_MIRROR) {
auxSerialPutc(data);
}
#endif
#if defined(AUX2_SERIAL)
if (g_eeGeneral.aux2SerialMode == UART_MODE_TELEMETRY_MIRROR) {
aux2SerialPutc(data);
}
#endif
if (telemetryRxBufferCount == 0 && data != GHST_ADDR_RADIO) {
TRACE("[GH] address 0x%02X error", data);
return;
+11 -12
View File
@@ -26,7 +26,8 @@
// Device (destination) address
#define GHST_ADDR_RADIO 0x80 // phase 1
#define GHST_ADDR_MODULE 0x81
#define GHST_ADDR_MODULE_SYM 0x81 // symmetrical, 400k pulses, 400k telemetry
#define GHST_ADDR_MODULE_ASYM 0x88 // asymmetrical, 400k pulses, 115k telemetry
#define GHST_ADDR_FC 0x82
#define GHST_ADDR_GOGGLES 0x83 // phase 2
#define GHST_ADDR_5G_TXCTRL 0x84 // phase 3
@@ -96,19 +97,17 @@ void ghostSetDefault(int index, uint8_t id, uint8_t subId);
#if SPORT_MAX_BAUDRATE < 400000
// For radios which can't support telemetry at high rates, offer baud rate choices
// (modified vs. unmodified radios)
const uint32_t GHOST_BAUDRATES[] = {
400000,
115200,
constexpr uint16_t BRR_400K = PERI1_FREQUENCY / 400000;
constexpr uint16_t BRR_115K = PERI1_FREQUENCY / 115200;
enum GhostTelemetryBaudrates
{
GHST_TELEMETRY_RATE_400K,
GHST_TELEMETRY_RATE_115K
};
const uint8_t GHOST_PERIODS[] = {
4,
16,
};
#define GHOST_BAUDRATE GHOST_BAUDRATES[g_eeGeneral.telemetryBaudrate]
#define GHOST_PERIOD GHOST_PERIODS[g_eeGeneral.telemetryBaudrate]
#else
#endif
#define GHOST_BAUDRATE 400000
#define GHOST_PERIOD 4
#endif
#endif // _GHOST_H_
+3 -2
View File
@@ -23,10 +23,11 @@
#include "frsky.h"
#include "crossfire.h"
#include "ghost.h"
#include "myeeprom.h"
#include "io/frsky_sport.h"
#if defined(GHOST)
#include "ghost.h"
#endif
#if defined(MULTIMODULE)
#include "spektrum.h"
#include "hitec.h"