Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/Channels/channels.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "channels.h"

uint16_t GetFrequency(uint8_t index)
{
if (index >= 0 && index < 48)
return frequencyTable[index];
else
return 0;
}

uint8_t GetBand(uint8_t index)
{
return index / 8 + 1;
}

uint8_t GetChannel(uint8_t index)
{
return (index % 8) + 1;
}
16 changes: 16 additions & 0 deletions lib/Channels/channels.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include <Arduino.h>

const uint16_t frequencyTable[48] = {
5865, 5845, 5825, 5805, 5785, 5765, 5745, 5725, // A
5733, 5752, 5771, 5790, 5809, 5828, 5847, 5866, // B
5705, 5685, 5665, 5645, 5885, 5905, 5925, 5945, // E
5740, 5760, 5780, 5800, 5820, 5840, 5860, 5880, // F
5658, 5695, 5732, 5769, 5806, 5843, 5880, 5917, // R
5333, 5373, 5413, 5453, 5493, 5533, 5573, 5613 // L
};

uint16_t GetFrequency(uint8_t index);
uint8_t GetBand(uint8_t index);
uint8_t GetChannel(uint8_t index);
3 changes: 2 additions & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ extra_configs =
targets/dupletx_tx.ini
targets/radiomaster_tx.ini
targets/hdzero.ini
targets/skyzone.ini
targets/skyzone.ini
targets/orqa.ini
6 changes: 5 additions & 1 deletion src/Vrx_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "hdzero.h"
#elif defined(SKYZONE_MSP_BACKPACK)
#include "skyzone_msp.h"
#elif defined(ORQA_BACKPACK)
#include "orqa.h"
#endif

/////////// DEFINES ///////////
Expand Down Expand Up @@ -102,6 +104,8 @@ VrxBackpackConfig config;
HDZero vrxModule(&Serial);
#elif defined(SKYZONE_MSP_BACKPACK)
SkyzoneMSP vrxModule(&Serial);
#elif defined(ORQA_BACKPACK)
Orqa vrxModule;
#endif

/////////// FUNCTION DEFS ///////////
Expand Down Expand Up @@ -432,7 +436,7 @@ void loop()
sendChangesToVrx = false;
vrxModule.SendIndexCmd(cachedIndex);
}

Comment thread
jonas-koeritz marked this conversation as resolved.
// spam out a bunch of requests for the desired band/channel for the first 5s
if (!gotInitialPacket && now - VRX_BOOT_DELAY < 5000 && now - lastSentRequest > 1000 && connectionState != binding)
{
Expand Down
62 changes: 62 additions & 0 deletions src/orqa.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#include "orqa.h"

GENERIC_CRC8 ghst_crc(GHST_CRC_POLY);

void Orqa::SendIndexCmd(uint8_t index)
{
uint8_t band = GetBand(index);
uint8_t channel = GetChannel(index);
uint8_t currentGHSTChannel = GHSTChannel(band, channel);
uint16_t currentFrequency = GetFrequency(index);
SendGHSTUpdate(currentFrequency, currentGHSTChannel);
}


void Orqa::SendGHSTUpdate(uint16_t freq, uint8_t ghstChannel)
{
uint8_t packet[] = {
0x82, 0x0C, 0x20, // Header

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only comment is to make some of these header bytes defines. But Im not fussed until we start to have multiple packets e.g. DVR start/stop.

0x00, (uint8_t)(freq & 0xFF), (uint8_t)(freq >> 8), // Frequency
0x01, 0x00, ghstChannel, // Band & Channel
0x00, 0x00, 0x00, 0x00, // Power Level?
0x00 }; // CRC
uint8_t crc = ghst_crc.calc(&packet[2], 11);
packet[13] = crc;

for(uint8_t i = 0; i < 14; i++)
{
Serial.write(packet[i]);
}
}

uint8_t Orqa::GHSTChannel(uint8_t band, uint8_t channel)
{
// ELRS Bands: A, B, E, I/F, R, L
// Orqa/Rapidfire Bands: I/F, R, E, B, A, L, X
uint8_t ghstChannel = 0x00;

switch(band)
{
case 0x01:
ghstChannel |= 0x50;
break;
case 0x02:
ghstChannel |= 0x40;
break;
case 0x03:
ghstChannel |= 0x30;
break;
case 0x04:
ghstChannel |= 0x10;
break;
case 0x05:
ghstChannel |= 0x20;
break;
case 0x06:
ghstChannel |= 0x60;
break;
}
ghstChannel |= channel;

return ghstChannel;
}
18 changes: 18 additions & 0 deletions src/orqa.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include "module_base.h"
#include <channels.h>
#include <crc.h>

#define VRX_UART_BAUD 100000
#define VRX_BOOT_DELAY 7000
#define GHST_CRC_POLY 0xD5

class Orqa : public ModuleBase
{
public:
void SendIndexCmd(uint8_t index);
private:
uint8_t GHSTChannel(uint8_t band, uint8_t channel);
void SendGHSTUpdate(uint16_t freq, uint8_t ghstChannel);
};
22 changes: 15 additions & 7 deletions targets/common.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,52 +50,60 @@ build_flags =
build_flags =
${common_env_data.build_flags}
-D TARGET_TX_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Vrx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*>
build_src_filter = ${common_env_data.build_src_filter} -<Vrx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*> -<orqa.*>

# ------------------------- COMMON RAPIDFIRE-BACKPACK DEFINITIONS -----------------
[rapidfire_vrx_backpack_common]
build_flags =
${common_env_data.build_flags}
-D TARGET_VRX_BACKPACK
-D RAPIDFIRE_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rx5808.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*>
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rx5808.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*> -<orqa.*>

# ------------------------- COMMON RX5808-BACKPACK DEFINITIONS -----------------
[rx5808_vrx_backpack_common]
build_flags =
${common_env_data.build_flags}
-D TARGET_VRX_BACKPACK
-D RX5808_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*>
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*> -<orqa.*>

# ------------------------- COMMON STEADYVIEW-BACKPACK DEFINITIONS -----------------
[steadyview_vrx_backpack_common]
build_flags =
${common_env_data.build_flags}
-D TARGET_VRX_BACKPACK
-D STEADYVIEW_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*>
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<fusion.*> -<hdzero.*> -<skyzone_msp.*> -<orqa.*>

# ------------------------- COMMON FUSION-BACKPACK DEFINITIONS -----------------
[fusion_vrx_backpack_common]
build_flags =
${common_env_data.build_flags}
-D TARGET_VRX_BACKPACK
-D FUSION_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<hdzero.*> -<skyzone_msp.*>
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<hdzero.*> -<skyzone_msp.*> -<orqa.*>

# ------------------------- COMMON HDZERO-BACKPACK DEFINITIONS -----------------
[hdzero_vrx_backpack_common]
build_flags =
${common_env_data.build_flags}
-D TARGET_VRX_BACKPACK
-D HDZERO_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<fusion.*> -<stmUpdateClass.*> -<skyzone_msp.*>
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<fusion.*> -<stmUpdateClass.*> -<skyzone_msp.*> -<orqa.*>

# ------------------------- COMMON SKYZONE-MSP-BACKPACK DEFINITIONS -----------------
[skyzone_msp_vrx_backpack_common]
build_flags =
${common_env_data.build_flags}
-D TARGET_VRX_BACKPACK
-D SKYZONE_MSP_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<stmUpdateClass.*>
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<fusion.*> -<hdzero.*> -<stmUpdateClass.*> -<orqa.*>

# ------------------------- COMMON ORQA-BACKPACK DEFINITIONS -------------------
[orqa_backpack_common]
build_flags =
${common_env_data.build_flags}
-D TARGET_VRX_BACKPACK
-D ORQA_BACKPACK
build_src_filter = ${common_env_data.build_src_filter} -<Tx_main.cpp> -<rapidfire.*> -<rx5808.*> -<steadyview.*> -<fusion.*> -<stmUpdateClass.*> -<hdzero.*> -<skyzone_msp.*>
9 changes: 9 additions & 0 deletions targets/orqa.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[env:Orqa_ESP_RX_Backpack_via_UART]
extends = env_common_esp8285, orqa_backpack_common
build_flags =
${env_common_esp8285.build_flags}
${orqa_backpack_common.build_flags}
-D PIN_LED=16

[env:Orqa_ESP_RX_Backpack_via_WIFI]
extends = env:Orqa_ESP_RX_Backpack_via_UART