OutputStream (file M0 -> M4 radio) now works

Disabled numbers station for now (too buggy, low priority)
This commit is contained in:
furrtek 2017-06-23 08:40:22 +01:00
parent c922a56b6d
commit 33a2df9d2a
15 changed files with 48 additions and 30 deletions

View File

@ -182,7 +182,7 @@ set(CPPSRC
ui_menu.cpp
ui_morse.cpp
ui_navigation.cpp
ui_numbers.cpp
# ui_numbers.cpp
ui_nuoptix.cpp
ui_playdead.cpp
ui_pocsag_tx.cpp

View File

@ -241,7 +241,7 @@ std::filesystem::path next_filename_stem_matching_pattern(std::filesystem::path
static_assert(sizeof(FIL::err) == 1, "FatFs FIL::err size not expected.");
/* Dangerous to expose these, as FatFs native error values are byte-sized. However,
* my filesystem_error implemetation is fine with it. */
* my filesystem_error implementation is fine with it. */
#define FR_DISK_FULL (0x100)
#define FR_EOF (0x101)
#define FR_BAD_SEEK (0x102)

View File

@ -37,6 +37,10 @@ public:
FileReader(FileReader&& file) = delete;
FileReader& operator=(FileReader&&) = delete;
Optional<File::Error> open(const std::filesystem::path& filename) {
return file.open(filename);
}
File::Result<File::Size> read(void* const buffer, const File::Size bytes) override;
protected:

View File

@ -23,20 +23,23 @@
// Color bitmaps generated with:
// Gimp image > indexed colors (16), then "xxd -i *.bmp"
//TEST: Mic tx
//TEST: Menuview refresh, seems to blink a lot
//TEST: Check AFSK transmit end, skips last bits ?
//TEST: Imperial in whipcalc
//BUG: SCANNER Lock on frequency, if frequency jump, still locked on first one
//BUG: SCANNER Multiple slices
//BUG: REPLAY freezes when SD card not present
//BUG: RDS doesn't stop baseband when stopping tx ?
//TODO: Make freqman refresh simpler (use previous black rectangle method)
//TODO: Merge AFSK and TONES procs ?
//TODO: NFM Squelch level setting
//TODO: NFM RX nav.pop on squelch
//TODO: NFM RX mode: nav.pop on squelch
//TODO: MORSE use prosigns
//TODO: MORSE live keying mode
//TODO: Use to_string_short_freq wherever possible
//TODO: SCANNER Waveform widget as FFT view ?
//TEST: Check AFSK transmit end, skips last bits ?
//TEST: Imperial in whipcalc
//TODO: Optimize (and group ?) CTCSS tone gen code
/*
Continuous (Fox-oring)
@ -46,9 +49,7 @@ Continuous (Fox-oring)
*/
//TODO: Use transmittermodel bw setting
//TODO: Use TransmitterView in TEDI/LCR, Numbers, ...
//TODO: FreqMan: Add and rename categories
//TODO: FreqMan: Sort by category in edit screen
//TODO: FreqMan: Cap entry count per category (only done for total entries right now)
//TODO: FreqMan: Remove and rename categories
//TODO: Wav visualizer
//TODO: File browser view ?
//TODO: Mousejack ?

View File

@ -24,12 +24,11 @@
#include "string_format.hpp"
#include "baseband_api.hpp"
#include "portapack.hpp"
using namespace portapack;
#include "portapack_persistent_memory.hpp"
using namespace portapack;
namespace ui {
ReplayAppView::ReplayAppView(
@ -38,7 +37,7 @@ ReplayAppView::ReplayAppView(
{
std::vector<std::filesystem::path> file_list;
// Search for files
// Search for files with the right extension
file_list = scan_root_files(u"/", u"*.C16");
if (!file_list.size()) {
file_error = true;

View File

@ -54,7 +54,7 @@ private:
static constexpr ui::Dim header_height = 2 * 16;
static constexpr uint32_t sampling_rate = 4000000;
static constexpr uint32_t sampling_rate = 500000;
static constexpr uint32_t baseband_bandwidth = 2500000;
void on_target_frequency_changed(rf::Frequency f);

View File

@ -83,13 +83,17 @@ Optional<File::Error> ReplayThread::run() {
while( !chThdShouldTerminate() ) {
auto buffer = buffers.get();
/*auto read_result = reader->read(buffer->data(), buffer->size());
auto read_result = reader->read(buffer->data(), buffer->capacity());
buffer->set_size(buffer->capacity());
if( read_result.is_error() ) {
return read_result.error();
}
buffers.put(buffer);*/
chThdSleep(50); // DEBUG
//led_tx.toggle();
if (!buffers.put(buffer))
for(;;){}; // DEBUG
led_tx.toggle(); // DEBUG
}
return { };

View File

@ -43,7 +43,7 @@
#include "ui_lcr.hpp"
#include "ui_mictx.hpp"
#include "ui_morse.hpp"
#include "ui_numbers.hpp"
//#include "ui_numbers.hpp"
#include "ui_nuoptix.hpp"
#include "ui_playdead.hpp"
#include "ui_pocsag_tx.hpp"
@ -306,7 +306,7 @@ TransmittersMenuView::TransmittersMenuView(NavigationView& nav) {
{ "Microphone", ui::Color::green(), &bitmap_icon_microphone, [&nav](){ nav.push<MicTXView>(); } },
{ "Morse code", ui::Color::green(), &bitmap_icon_morse, [&nav](){ nav.push<MorseView>(); } },
{ "NTTWorks burger pager", ui::Color::yellow(), &bitmap_icon_burger, [&nav](){ nav.push<CoasterPagerView>(); } },
{ "Numbers station", ui::Color::orange(), &bitmap_icon_numbers, [&nav](){ nav.push<NumbersStationView>(); } },
{ "Numbers station", ui::Color::grey(), &bitmap_icon_numbers, [&nav](){ nav.push<NotImplementedView>(); } }, // NumbersStationView
{ "Nuoptix DTMF timecode", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push<NuoptixView>(); } },
{ "OOK remote encoders", ui::Color::yellow(), &bitmap_icon_remote, [&nav](){ nav.push<EncodersView>(); } },
{ "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push<POCSAGTXView>(); } },
@ -350,7 +350,7 @@ SystemMenuView::SystemMenuView(NavigationView& nav) {
{ "Receivers", ui::Color::cyan(), &bitmap_icon_receivers, [&nav](){ nav.push<ReceiversMenuView>(); } },
{ "Transmitters", ui::Color::green(), nullptr, [&nav](){ nav.push<TransmittersMenuView>(); } },
{ "Capture", ui::Color::blue(), &bitmap_icon_capture, [&nav](){ nav.push<CaptureAppView>(); } },
{ "Replay", ui::Color::grey(), &bitmap_icon_replay, [&nav](){ nav.push<NotImplementedView>(); } }, // ReplayAppView
{ "Replay", ui::Color::grey(), &bitmap_icon_replay, [&nav](){ nav.push<ReplayAppView>(); } },
{ "Scanner/search", ui::Color::orange(), &bitmap_icon_closecall, [&nav](){ nav.push<ScannerView>(); } },
{ "Utilities", ui::Color::purple(), &bitmap_icon_utilities, [&nav](){ nav.push<UtilitiesMenuView>(); } },
{ "Setup", ui::Color::white(), &bitmap_icon_setup, [&nav](){ nav.push<SetupMenuView>(); } },

View File

@ -114,7 +114,15 @@ void ReplayView::toggle() {
void ReplayView::start() {
stop();
auto reader = std::make_unique<FileReader>();
std::unique_ptr<stream::Reader> reader;
auto p = std::make_unique<FileReader>();
auto create_error = p->open(file_options[options_files.selected_index()].first + ".C16");
if( create_error.is_valid() ) {
handle_error(create_error.value());
} else {
reader = std::move(p);
}
if( reader ) {
button_play.set_bitmap(&bitmap_stop);
@ -135,7 +143,7 @@ void ReplayView::start() {
update_status_display();
radio::enable({
434000000, //target_frequency(),
receiver_model.tuning_frequency(),
sampling_rate,
2500000, //baseband_bandwidth,
rf::Direction::Transmit,

View File

@ -59,7 +59,7 @@ private:
using option_t = std::pair<std::string, int32_t>;
using options_t = std::vector<option_t>;
static constexpr uint32_t sampling_rate = 500000;
static constexpr uint32_t sampling_rate = 1000000;
void toggle();
@ -74,6 +74,7 @@ private:
const size_t buffer_count;
//SignalToken signal_token_tick_second { };
options_t file_options { };
//std::filesystem:path file_path { };
Rectangle rect_background {
Color::black()

View File

@ -63,7 +63,7 @@ void ReplayProcessor::on_message(const Message* const message) {
channel_spectrum.on_message(message);
break;*/
case Message::ID::CaptureConfig:
case Message::ID::ReplayConfig:
replay_config(*reinterpret_cast<const ReplayConfigMessage*>(message));
break;

View File

@ -41,7 +41,7 @@ public:
private:
// TODO: Repeated value needs to be transmitted from application side.
static constexpr size_t baseband_fs = 500000;
static constexpr size_t baseband_fs = 1000000;
//static constexpr auto spectrum_rate_hz = 50.0f;
BasebandThread baseband_thread { baseband_fs, this, NORMALPRIO + 20, baseband::Direction::Transmit };

View File

@ -55,7 +55,6 @@ size_t StreamOutput::read(void* const data, const size_t length) {
const auto remaining = length - read;
read += active_buffer->read(&p[read], remaining);
//buffer->empty();
if( active_buffer->is_empty() ) {
if( !fifo_buffers_empty.in(active_buffer) ) {

View File

@ -56,9 +56,7 @@ BufferExchange::~BufferExchange() {
StreamBuffer* BufferExchange::get(FIFO<StreamBuffer*>* fifo) {
while(true) {
StreamBuffer* p { nullptr };
fifo->out(p); // This crashes replay
//led_tx.on(); // DEBUG
fifo->out(p);
if( p ) {
return p;

View File

@ -484,6 +484,10 @@ public:
size_t size() const {
return used_;
}
size_t capacity() const {
return capacity_;
}
void set_size(const size_t value) {
used_ = value;