-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into skyzone-custom-osd
# Conflicts: # platformio.ini # src/Vrx_main.cpp # src/module_base.cpp # src/module_base.h # src/skyzone_msp.cpp # src/skyzone_msp.h # targets/common.ini # targets/skyzone.ini
- Loading branch information
Showing
14 changed files
with
166 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters