diff --git a/pipelines.json b/pipelines.json index 5a4e19f6c..e8c7facc9 100644 --- a/pipelines.json +++ b/pipelines.json @@ -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, diff --git a/src-core/modules/spacex/module_spacex_decoder.cpp b/src-core/modules/spacex/module_spacex_decoder.cpp index 598e98951..5b0f8d004 100644 --- a/src-core/modules/spacex/module_spacex_decoder.cpp +++ b/src-core/modules/spacex/module_spacex_decoder.cpp @@ -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 parameters) : ProcessingModule(input_file, output_file_hint, parameters) + SpaceXDecoderModule::SpaceXDecoderModule(std::string input_file, std::string output_file_hint, std::map 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> frameBuffer = deframer.work(finalBuffer, (BUFFER_SIZE / 8)); @@ -189,7 +222,7 @@ namespace spacex std::vector SpaceXDecoderModule::getParameters() { - return {}; + return {"qpsk"}; } std::shared_ptr SpaceXDecoderModule::getInstance(std::string input_file, std::string output_file_hint, std::map parameters) diff --git a/src-core/modules/spacex/module_spacex_decoder.h b/src-core/modules/spacex/module_spacex_decoder.h index 910fe2a65..78035f80e 100644 --- a/src-core/modules/spacex/module_spacex_decoder.h +++ b/src-core/modules/spacex/module_spacex_decoder.h @@ -24,6 +24,8 @@ namespace spacex std::atomic filesize; std::atomic progress; + bool qpsk; + // UI Stuff libdsp::Random rng;