mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-08 06:32:35 -04:00
Formatted code (#1007)
* Updated style * Updated files * fixed new line * Updated spacing * File fix WIP * Updated to clang 13 * updated comment style * Removed old comment code
This commit is contained in:
parent
7aca7ce74d
commit
033c4e9a5b
599 changed files with 70746 additions and 66896 deletions
|
@ -28,46 +28,45 @@
|
|||
#include <cstdint>
|
||||
|
||||
void ADSBTXProcessor::execute(const buffer_c8_t& buffer) {
|
||||
|
||||
// This is called at 4M/2048 = 1953Hz
|
||||
// One pulse = 500ns = 2 samples
|
||||
// One bit = 2 pulses = 1us = 4 samples
|
||||
// Test this with ./dump1090 --freq 434000000 --gain 20
|
||||
// Or ./dump1090 --freq 434000000 --gain 20 --interactive --net --net-http-port 8080 --net-beast
|
||||
|
||||
if (!configured) return;
|
||||
// This is called at 4M/2048 = 1953Hz
|
||||
// One pulse = 500ns = 2 samples
|
||||
// One bit = 2 pulses = 1us = 4 samples
|
||||
// Test this with ./dump1090 --freq 434000000 --gain 20
|
||||
// Or ./dump1090 --freq 434000000 --gain 20 --interactive --net --net-http-port 8080 --net-beast
|
||||
|
||||
for (size_t i = 0; i < buffer.count; i++) {
|
||||
if (bit_pos >= (240 << 1)) {
|
||||
configured = false;
|
||||
cur_bit = 0;
|
||||
} else {
|
||||
cur_bit = shared_memory.bb_data.data[bit_pos >> 1];
|
||||
bit_pos++;
|
||||
}
|
||||
|
||||
if (cur_bit) {
|
||||
// Crude AM
|
||||
buffer.p[i] = am_lut[phase & 3];
|
||||
phase++;
|
||||
} else {
|
||||
buffer.p[i] = { 0, 0 };
|
||||
}
|
||||
}
|
||||
if (!configured) return;
|
||||
|
||||
for (size_t i = 0; i < buffer.count; i++) {
|
||||
if (bit_pos >= (240 << 1)) {
|
||||
configured = false;
|
||||
cur_bit = 0;
|
||||
} else {
|
||||
cur_bit = shared_memory.bb_data.data[bit_pos >> 1];
|
||||
bit_pos++;
|
||||
}
|
||||
|
||||
if (cur_bit) {
|
||||
// Crude AM
|
||||
buffer.p[i] = am_lut[phase & 3];
|
||||
phase++;
|
||||
} else {
|
||||
buffer.p[i] = {0, 0};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ADSBTXProcessor::on_message(const Message* const p) {
|
||||
const auto message = *reinterpret_cast<const ADSBConfigureMessage*>(p);
|
||||
|
||||
if (message.id == Message::ID::ADSBConfigure) {
|
||||
bit_pos = 0;
|
||||
phase = 0;
|
||||
configured = true;
|
||||
}
|
||||
const auto message = *reinterpret_cast<const ADSBConfigureMessage*>(p);
|
||||
|
||||
if (message.id == Message::ID::ADSBConfigure) {
|
||||
bit_pos = 0;
|
||||
phase = 0;
|
||||
configured = true;
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
EventDispatcher event_dispatcher { std::make_unique<ADSBTXProcessor>() };
|
||||
event_dispatcher.run();
|
||||
return 0;
|
||||
EventDispatcher event_dispatcher{std::make_unique<ADSBTXProcessor>()};
|
||||
event_dispatcher.run();
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue