-
Notifications
You must be signed in to change notification settings - Fork 138
Orqa FPV.Connect support #70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
11eef5f
Channel and frequency definitions, along with helper functions.
jonas-koeritz d17121c
Rebased on upstream/master
jonas-koeritz 43035ea
Fix duplicate identifier
jonas-koeritz 54dddcf
Move packet interval handling into Orqa class
jonas-koeritz a3071bb
Remove unneccessary pin definitions
jonas-koeritz 9ea4b53
Implement GHST VTX control
jonas-koeritz e7e9836
No need to loop and resend, the Goggles don't care
jonas-koeritz bef4aba
Fixed target definition and made Orqa inherit ModuleBase
jonas-koeritz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.