Add Starship OPQSK support down to CADU

This commit is contained in:
Aang23 2021-03-22 19:22:09 +01:00
parent d279b480c8
commit 6c8f5ac3e4
3 changed files with 71 additions and 3 deletions

View file

@ -532,13 +532,46 @@
}
},
"cadu": {
"spacex_tlm_decoder": {}
"spacex_tlm_decoder": {
"qpsk": "0"
}
},
"products": {
"falcon_decoder": {}
}
}
},
"starship_tlm": {
"name": "Starship S-Band TLM",
"live": false,
"frequencies": [],
"samplerate": 6e6,
"baseband_type": "i16",
"work": {
"baseband": {},
"soft": {
"oqpsk_demod": {
"symbolrate": "3125000",
"agc_rate": "0.00001",
"rrc_alpha": "0.6",
"rrc_taps": "31",
"costas_bw": "0.004",
"clock_gain_omega": "2.5e-7",
"clock_mu": "0.5",
"clock_gain_mu": "0.001",
"clock_omega_relative_limit": "0.005",
"dc_block": "0",
"constellation_scale": "100",
"buffer_size": "8192"
}
},
"cadu": {
"spacex_tlm_decoder": {
"qpsk": "1"
}
}
}
},
"smap_s_link": {
"name": "SMAP S-Band Link",
"live": false,

View file

@ -1,6 +1,7 @@
#include "module_spacex_decoder.h"
#include "logger.h"
#include "modules/common/sathelper/derandomizer.h"
#include "modules/common/sathelper/packetfixer.h"
#include "modules/common/sathelper/reedsolomon_239.h"
#include "imgui/imgui.h"
@ -18,7 +19,8 @@ size_t getFilesize(std::string filepath);
namespace spacex
{
SpaceXDecoderModule::SpaceXDecoderModule(std::string input_file, std::string output_file_hint, std::map<std::string, std::string> parameters) : ProcessingModule(input_file, output_file_hint, parameters)
SpaceXDecoderModule::SpaceXDecoderModule(std::string input_file, std::string output_file_hint, std::map<std::string, std::string> parameters) : ProcessingModule(input_file, output_file_hint, parameters),
qpsk(std::stoi(parameters["qpsk"]))
{
buffer = new int8_t[BUFFER_SIZE];
}
@ -51,11 +53,20 @@ namespace spacex
int inByteShifter = 0;
int byteShifted = 0;
// PacketFixer
sathelper::PacketFixer fixer;
int unsynced_run = 0;
int ph = sathelper::DEG_0;
bool swap = false;
while (!data_in.eof())
{
// Read buffer
data_in.read((char *)buffer, BUFFER_SIZE);
if (qpsk)
fixer.fixPacket((uint8_t *)buffer, BUFFER_SIZE, (sathelper::PhaseShift)ph, swap);
// Group symbols into bytes now, I channel
inByteShifter = 0;
byteShifted = 0;
@ -72,6 +83,28 @@ namespace spacex
}
}
if (qpsk)
{
if (deframer.getState() == 0)
{
unsynced_run++;
if (unsynced_run == 10)
{
ph++;
if (ph == 4)
{
ph = 0;
swap = !swap;
}
unsynced_run = 0;
}
}
else
{
unsynced_run = 0;
}
}
// Deframe that! (Integrated derand)
std::vector<std::array<uint8_t, ccsds::ccsds_1_0_proba::CADU_SIZE>> frameBuffer = deframer.work(finalBuffer, (BUFFER_SIZE / 8));
@ -189,7 +222,7 @@ namespace spacex
std::vector<std::string> SpaceXDecoderModule::getParameters()
{
return {};
return {"qpsk"};
}
std::shared_ptr<ProcessingModule> SpaceXDecoderModule::getInstance(std::string input_file, std::string output_file_hint, std::map<std::string, std::string> parameters)

View file

@ -24,6 +24,8 @@ namespace spacex
std::atomic<size_t> filesize;
std::atomic<size_t> progress;
bool qpsk;
// UI Stuff
libdsp::Random rng;