Cleanup and fix LRPT sat detection in edge case

This commit is contained in:
Jamie Vital 2025-01-11 09:26:57 -05:00
parent e6661066a2
commit 5e01df112a
4 changed files with 33 additions and 33 deletions

View file

@ -6,8 +6,6 @@ namespace meteor
{
namespace lrpt
{
const int blockSize = 64; // A DCT block is 8x8.
const int w1 = 2841; // 2048*sqrt(2)*cos(1*pi/16)
const int w2 = 2676; // 2048*sqrt(2)*cos(2*pi/16)
const int w3 = 2408; // 2048*sqrt(2)*cos(3*pi/16)

View file

@ -19,8 +19,7 @@ namespace meteor
// day_time == 0 && us_time == 0;
}
Segment::Segment(uint8_t* data, int length, bool partial, bool meteorm2x_mode) : meteorm2x_mode(meteorm2x_mode),
partial(partial)
Segment::Segment(uint8_t* data, int length, bool partial, bool meteorm2x_mode) : partial(partial)
{
if (length - 14 <= 0)
{
@ -51,10 +50,9 @@ namespace meteor
}
}
Segment::Segment() : meteorm2x_mode(false), // We don't care if invalid
partial(true)
Segment::Segment() : partial(true),
valid(false)
{
valid = false;
}
Segment::~Segment()

View file

@ -12,9 +12,6 @@ namespace meteor
{
class Segment
{
private:
bool meteorm2x_mode;
public:
uint16_t day_time;
uint32_t ms_time;

View file

@ -146,33 +146,40 @@ namespace meteor
{
msureader.work(pkt);
if (pkt.header.apid == 70 && pkt.payload.size() >= 62)
if (pkt.header.apid == 70)
{
// Telemetry Timestamp
if (meteorm2x_mode)
telemetry_timestamps[ccsds::parseCCSDSTimeFullRaw(&pkt.payload.data()[0], 11322)] = msumr_ids.size();
else
telemetry_timestamps[ccsds::parseCCSDSTimeFullRaw(&pkt.payload.data()[0], 0)] = msumr_ids.size();
// ID parsing
uint8_t msumr_id = pkt.payload[8 + 12] >> 4;
msumr_ids.push_back(msumr_id);
parseMSUMRTelemetry(msu_mr_telemetry, msu_mr_telemetry_calib, msumr_ids.size() - 1, &pkt.payload[8]);
// Convert calibration data
uint16_t words10_bits[12];
for (int n = 0; n < 3; n++)
if (pkt.payload.size() >= 16)
{
int bitpos = 43 + n * 5;
// Convert 5 bytes to 4 10-bits values
words10_bits[n * 4 + 0] = ((pkt.payload[bitpos] << 2) | (pkt.payload[bitpos + 1] >> 6));
words10_bits[n * 4 + 1] = (((pkt.payload[bitpos + 1] % 64) << 4) | (pkt.payload[bitpos + 2] >> 4));
words10_bits[n * 4 + 2] = (((pkt.payload[bitpos + 2] % 16) << 6) | (pkt.payload[bitpos + 3] >> 2));
words10_bits[n * 4 + 3] = (((pkt.payload[bitpos + 3] % 4) << 8) | pkt.payload[bitpos + 4]);
// Telemetry Timestamp
if (meteorm2x_mode)
telemetry_timestamps[ccsds::parseCCSDSTimeFullRaw(&pkt.payload.data()[0], 11322)] = msumr_ids.size();
else
telemetry_timestamps[ccsds::parseCCSDSTimeFullRaw(&pkt.payload.data()[0], 0)] = msumr_ids.size();
// ID parsing
uint8_t msumr_id = pkt.payload[8 + 12] >> 4;
msumr_ids.push_back(msumr_id);
}
for (int channel = 0; channel < 6; channel++)
calibration_info[channel].push_back({words10_bits[channel * 2], words10_bits[channel * 2 + 1]});
if (pkt.payload.size() >= 62)
{
parseMSUMRTelemetry(msu_mr_telemetry, msu_mr_telemetry_calib, msumr_ids.size() - 1, &pkt.payload[8]);
// Convert calibration data
uint16_t words10_bits[12];
for (int n = 0; n < 3; n++)
{
int bitpos = 43 + n * 5;
// Convert 5 bytes to 4 10-bits values
words10_bits[n * 4 + 0] = ((pkt.payload[bitpos] << 2) | (pkt.payload[bitpos + 1] >> 6));
words10_bits[n * 4 + 1] = (((pkt.payload[bitpos + 1] % 64) << 4) | (pkt.payload[bitpos + 2] >> 4));
words10_bits[n * 4 + 2] = (((pkt.payload[bitpos + 2] % 16) << 6) | (pkt.payload[bitpos + 3] >> 2));
words10_bits[n * 4 + 3] = (((pkt.payload[bitpos + 3] % 4) << 8) | pkt.payload[bitpos + 4]);
}
for (int channel = 0; channel < 6; channel++)
calibration_info[channel].push_back({ words10_bits[channel * 2], words10_bits[channel * 2 + 1] });
}
}
}
}