mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 19:54:39 +00:00
Fixed freeze in TouchTunes scan
Made adsb_map.py compatible with Python 3
This commit is contained in:
parent
d517bc31ec
commit
196518457f
@ -27,6 +27,7 @@
|
||||
//TEST: Check AFSK transmit end, skips last bits ?
|
||||
//TEST: Imperial in whipcalc
|
||||
|
||||
//BUG: Auto backlight off doesn't work anymore
|
||||
//BUG: CPLD-related rx ok, tx bad, see portapack.cpp lines 214+ to disable CPLD overlay
|
||||
//BUG: REPLAY See what's wrong with quality (format, or need for interpolation filter ?)
|
||||
//BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one
|
||||
@ -59,24 +60,7 @@ Continuous (Fox-oring)
|
||||
60s transmit, 240s space (Classic 1/5 min)
|
||||
60s transmit, 360s space (Classic 1/7 min)
|
||||
*/
|
||||
<<<<<<< ./firmware/application/main_LOCAL_5232.cpp
|
||||
||||||| ./firmware/application/main_BASE_5232.cpp
|
||||
//TODO: Use TransmitterView in TEDI/LCR, Numbers, ...
|
||||
=======
|
||||
//TODO: Use TransmitterView in TEDI/LCR, Numbers, ...
|
||||
//TODO: Use TransmitterView in TEDI/LCR, Numbers, ...
|
||||
>>>>>>> ./firmware/application/main_REMOTE_5232.cpp
|
||||
//TODO: FreqMan: Remove and rename categories
|
||||
<<<<<<< ./firmware/application/main_LOCAL_5232.cpp
|
||||
||||||| ./firmware/application/main_BASE_5232.cpp
|
||||
//TODO: Wav visualizer
|
||||
//TODO: File browser view ?
|
||||
=======
|
||||
//TODO: Wav visualizer
|
||||
//TODO: File browser view ?
|
||||
//TODO: Wav visualizer
|
||||
//TODO: File browser view ?
|
||||
>>>>>>> ./firmware/application/main_REMOTE_5232.cpp
|
||||
//TODO: Mousejack ?
|
||||
//TODO: Move frequencykeypad from ui_receiver to ui_widget (used everywhere)
|
||||
//TODO: ADS-B draw trajectory + GPS coordinates + scale, and playback
|
||||
|
@ -204,10 +204,10 @@ SoundBoardView::SoundBoardView(
|
||||
sounds[c].size = reader->data_size();
|
||||
sounds[c].sample_duration = reader->data_size(); // / (reader->bits_per_sample() / 8);
|
||||
sounds[c].sample_rate = reader->sample_rate();
|
||||
/*if (reader->bits_per_sample() > 8)
|
||||
sounds[c].sixteenbit = true;
|
||||
else
|
||||
sounds[c].sixteenbit = false;*/
|
||||
//if (reader->bits_per_sample() > 8)
|
||||
// sounds[c].sixteenbit = true;
|
||||
//else
|
||||
// sounds[c].sixteenbit = false;
|
||||
sounds[c].ms_duration = reader->ms_duration();
|
||||
sounds[c].path = u"WAV/" + path.native();
|
||||
title = reader->title().substr(0, 20);
|
||||
|
@ -28,6 +28,16 @@ using namespace portapack;
|
||||
|
||||
#include "string_format.hpp"
|
||||
|
||||
void TestLogger::log_raw_data(const testapp::Packet& packet, const int32_t alt) {
|
||||
std::string entry = to_string_dec_uint(packet.value()) + " " + to_string_dec_int(alt);
|
||||
|
||||
// Raw hex dump
|
||||
//for (size_t c = 0; c < 10; c++)
|
||||
// entry += to_string_hex(packet[c], 8) + " ";
|
||||
|
||||
log_file.write_entry(packet.received_at(), entry);
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
|
||||
TestView::TestView(NavigationView& nav) {
|
||||
@ -41,7 +51,9 @@ TestView::TestView(NavigationView& nav) {
|
||||
&field_vga,
|
||||
&rssi,
|
||||
&text_debug_a,
|
||||
&text_debug_b
|
||||
&text_debug_b,
|
||||
&button_cal,
|
||||
&check_log
|
||||
});
|
||||
|
||||
field_frequency.set_value(target_frequency_);
|
||||
@ -59,6 +71,19 @@ TestView::TestView(NavigationView& nav) {
|
||||
};
|
||||
};
|
||||
|
||||
check_log.on_select = [this](Checkbox&, bool v) {
|
||||
logging = v;
|
||||
};
|
||||
|
||||
button_cal.on_select = [this](Button&) {
|
||||
cal_value = raw_alt - 0x80;
|
||||
};
|
||||
|
||||
|
||||
logger = std::make_unique<TestLogger>();
|
||||
if (logger)
|
||||
logger->append("saucepan.txt");
|
||||
|
||||
radio::enable({
|
||||
tuning_frequency(),
|
||||
sampling_rate,
|
||||
@ -85,7 +110,7 @@ void TestView::on_packet(const testapp::Packet& packet) {
|
||||
|
||||
packet_count++;
|
||||
uint32_t diff = ((v - 1) - prev_v);
|
||||
if (diff < 20)
|
||||
if (diff < 50)
|
||||
packets_lost += diff;
|
||||
prev_v = v;
|
||||
|
||||
@ -93,14 +118,18 @@ void TestView::on_packet(const testapp::Packet& packet) {
|
||||
|
||||
text_debug_b.set(to_string_dec_uint((packets_lost * 1000) / packet_count) + " per 1000");
|
||||
|
||||
display.draw_pixel(Point(cur_x, 4 * 16 + (256 - packet.alt())), Color::white());
|
||||
raw_alt = packet.alt();
|
||||
display.draw_pixel(Point(cur_x, 4 * 16 + (256 - ((raw_alt - cal_value) / 4))), Color::white());
|
||||
|
||||
cur_x++;
|
||||
if (cur_x >= 240) {
|
||||
display.fill_rectangle(Rect(0, 4 * 16, 240, 256), Color::black());
|
||||
display.fill_rectangle(Rect(0, 5 * 16, 240, 256), Color::black());
|
||||
cur_x = 0;
|
||||
}
|
||||
|
||||
if (logger && logging)
|
||||
logger->log_raw_data(packet, raw_alt - cal_value);
|
||||
|
||||
//radio::disable();
|
||||
|
||||
/*text_serial.set(packet.serial_number());
|
||||
|
@ -30,15 +30,28 @@
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "test_packet.hpp"
|
||||
#include "log_file.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
|
||||
class TestLogger {
|
||||
public:
|
||||
Optional<File::Error> append(const std::string& filename) {
|
||||
return log_file.append(filename);
|
||||
}
|
||||
|
||||
void log_raw_data(const testapp::Packet& packet, const int32_t alt);
|
||||
|
||||
private:
|
||||
LogFile log_file { };
|
||||
};
|
||||
|
||||
namespace ui {
|
||||
|
||||
class TestView : public View {
|
||||
public:
|
||||
static constexpr uint32_t sampling_rate = 2457600;
|
||||
static constexpr uint32_t sampling_rate = 2457600*2;
|
||||
static constexpr uint32_t baseband_bandwidth = 1750000;
|
||||
|
||||
TestView(NavigationView& nav);
|
||||
@ -49,11 +62,14 @@ public:
|
||||
std::string title() const override { return "Test app"; };
|
||||
|
||||
private:
|
||||
uint32_t target_frequency_ { 439255000 };
|
||||
uint32_t target_frequency_ { 439206000 };
|
||||
Coord cur_x { 0 };
|
||||
uint32_t packet_count { 0 };
|
||||
uint32_t packets_lost { 0 };
|
||||
uint32_t prev_v { 0 };
|
||||
uint32_t raw_alt { 0 };
|
||||
uint32_t cal_value { 0 };
|
||||
bool logging { false };
|
||||
|
||||
Labels labels {
|
||||
{ { 0 * 8, 1 * 16 }, "Data:", Color::light_grey() }
|
||||
@ -79,14 +95,26 @@ private:
|
||||
};
|
||||
|
||||
Text text_debug_a {
|
||||
{ 0 * 8, 2 * 16, 30 * 8, 16 },
|
||||
{ 0 * 8, 4 * 16, 30 * 8, 16 },
|
||||
"..."
|
||||
};
|
||||
Text text_debug_b {
|
||||
{ 0 * 8, 3 * 16, 30 * 8, 16 },
|
||||
{ 0 * 8, 5 * 16, 30 * 8, 16 },
|
||||
"..."
|
||||
};
|
||||
|
||||
Button button_cal {
|
||||
{ 17 * 8, 2 * 16, 5 * 8, 2 * 16 },
|
||||
"CAL"
|
||||
};
|
||||
Checkbox check_log {
|
||||
{ 23 * 8, 2 * 16 },
|
||||
3,
|
||||
"LOG"
|
||||
};
|
||||
|
||||
std::unique_ptr<TestLogger> logger { };
|
||||
|
||||
MessageHandlerRegistration message_handler_packet {
|
||||
Message::ID::TestAppPacket,
|
||||
[this](Message* const p) {
|
||||
|
@ -62,6 +62,7 @@ void TouchTunesView::on_tx_progress(const uint32_t progress, const bool done) {
|
||||
if (pin == TOUCHTUNES_MAX_PIN) {
|
||||
stop_tx();
|
||||
} else {
|
||||
transmitter_model.disable();
|
||||
pin++;
|
||||
field_pin.set_value(pin);
|
||||
start_tx(scan_button_index);
|
||||
@ -71,9 +72,9 @@ void TouchTunesView::on_tx_progress(const uint32_t progress, const bool done) {
|
||||
}
|
||||
|
||||
void TouchTunesView::start_tx(const uint32_t button_index) {
|
||||
std::string fragments;
|
||||
std::string fragments = { "" };
|
||||
size_t bit;
|
||||
uint64_t frame_data { 0 };
|
||||
uint64_t frame_data;
|
||||
|
||||
if (check_scan.value()) {
|
||||
scan_button_index = button_index;
|
||||
|
@ -50,7 +50,7 @@ public:
|
||||
void execute(const buffer_c8_t& buffer) override;
|
||||
|
||||
private:
|
||||
static constexpr size_t baseband_fs = 2457600;
|
||||
static constexpr size_t baseband_fs = 2457600*2;
|
||||
|
||||
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Receive };
|
||||
RSSIThread rssi_thread { NORMALPRIO + 10 };
|
||||
@ -66,7 +66,7 @@ private:
|
||||
dsp::matched_filter::MatchedFilter mf { baseband::ais::square_taps_38k4_1t_p, 2 };
|
||||
|
||||
clock_recovery::ClockRecovery<clock_recovery::FixedErrorFilter> clock_recovery_fsk_9600 {
|
||||
19200, 9600, { 0.00555f },
|
||||
38400, 19192, { 0.00555f },
|
||||
[this](const float raw_symbol) {
|
||||
const uint_fast8_t sliced_symbol = (raw_symbol >= 0.0f) ? 1 : 0;
|
||||
this->packet_builder_fsk_9600_CC1101.execute(sliced_symbol);
|
||||
@ -75,7 +75,7 @@ private:
|
||||
PacketBuilder<BitPattern, NeverMatch, FixedLength> packet_builder_fsk_9600_CC1101 {
|
||||
{ 0b01010110010110100101101001101010, 32, 1 }, // Manchester 0x1337
|
||||
{ },
|
||||
{ 10 * 8 },
|
||||
{ 22 * 8 },
|
||||
[this](const baseband::Packet& packet) {
|
||||
const TestAppPacketMessage message { packet };
|
||||
shared_memory.application_queue.push(message);
|
||||
|
@ -42,11 +42,11 @@ FormattedSymbols Packet::symbols_formatted() const {
|
||||
}
|
||||
|
||||
uint32_t Packet::value() const {
|
||||
return reader_.read(3 * 8, 8);
|
||||
return (reader_.read(10 * 8, 6) << 8) | reader_.read(9 * 8, 8);
|
||||
}
|
||||
|
||||
uint32_t Packet::alt() const {
|
||||
return reader_.read(1 * 8, 12) - 0xC00;
|
||||
return reader_.read(1 * 8, 12);
|
||||
}
|
||||
|
||||
} /* namespace testapp */
|
||||
|
@ -18,6 +18,7 @@
|
||||
# Boston, MA 02110-1301, USA.
|
||||
#
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import struct
|
||||
from PIL import Image
|
||||
@ -38,4 +39,4 @@ for y in range (0, im.size[1]):
|
||||
pixel_lcd |= (pix[x, y][2] >> 3)
|
||||
line += struct.pack('H', pixel_lcd)
|
||||
outfile.write(line)
|
||||
print str(y) + '/' + str(im.size[1]) + '\r',
|
||||
print(str(y) + '/' + str(im.size[1]) + '\r', end="")
|
||||
|
Loading…
Reference in New Issue
Block a user