2017-03-22 14:21:31 -04:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
|
|
* Copyright (C) 2016 Furrtek
|
|
|
|
*
|
|
|
|
* This file is part of PortaPack.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __UI_SSTVTX_H__
|
|
|
|
#define __UI_SSTVTX_H__
|
|
|
|
|
|
|
|
#include "ui.hpp"
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
#include "ui_receiver.hpp"
|
|
|
|
#include "ui_navigation.hpp"
|
|
|
|
#include "ui_font_fixed_8x16.hpp"
|
|
|
|
#include "baseband_api.hpp"
|
|
|
|
#include "ui_transmitter.hpp"
|
|
|
|
#include "message.hpp"
|
|
|
|
#include "sstv.hpp"
|
|
|
|
#include "file.hpp"
|
|
|
|
#include "bmp.hpp"
|
2022-05-13 08:38:04 -04:00
|
|
|
#include "app_settings.hpp"
|
2017-03-22 14:21:31 -04:00
|
|
|
|
|
|
|
using namespace sstv;
|
|
|
|
|
|
|
|
namespace ui {
|
|
|
|
|
|
|
|
class SSTVTXView : public View {
|
|
|
|
public:
|
|
|
|
SSTVTXView(NavigationView& nav);
|
|
|
|
~SSTVTXView();
|
2017-03-23 17:28:21 -04:00
|
|
|
|
|
|
|
SSTVTXView(const SSTVTXView&) = delete;
|
|
|
|
SSTVTXView(SSTVTXView&&) = delete;
|
|
|
|
SSTVTXView& operator=(const SSTVTXView&) = delete;
|
|
|
|
SSTVTXView& operator=(SSTVTXView&&) = delete;
|
2017-03-22 14:21:31 -04:00
|
|
|
|
|
|
|
void focus() override;
|
|
|
|
void paint(Painter&) override;
|
|
|
|
|
2023-03-22 03:46:58 -04:00
|
|
|
std::string title() const override { return "SSTV TX"; };
|
2017-03-22 14:21:31 -04:00
|
|
|
|
|
|
|
private:
|
|
|
|
NavigationView& nav_;
|
|
|
|
|
2017-03-23 00:29:58 -04:00
|
|
|
sstv_scanline scanline_buffer { };
|
2022-05-13 08:38:04 -04:00
|
|
|
// app save settings
|
|
|
|
std::app_settings settings { };
|
|
|
|
std::app_settings::AppSettings app_settings { };
|
|
|
|
|
2017-03-23 17:28:21 -04:00
|
|
|
bool file_error { false };
|
2017-03-22 14:21:31 -04:00
|
|
|
File bmp_file { };
|
|
|
|
bmp_header_t bmp_header { };
|
|
|
|
std::vector<std::filesystem::path> bitmaps { };
|
2017-03-23 00:29:58 -04:00
|
|
|
uint32_t scanline_counter { 0 };
|
|
|
|
uint8_t pixels_buffer[320 * 3]; // 320 pixels @ 24bpp
|
2017-03-23 17:28:21 -04:00
|
|
|
const sstv_mode * tx_sstv_mode { };
|
|
|
|
|
|
|
|
uint8_t component_map[3] { };
|
2017-03-22 14:21:31 -04:00
|
|
|
|
|
|
|
void read_boundary(uint8_t * buffer, uint32_t position, uint32_t length);
|
2017-03-23 17:28:21 -04:00
|
|
|
void on_bitmap_changed(const size_t index);
|
|
|
|
void on_mode_changed(const size_t index);
|
2017-03-22 14:21:31 -04:00
|
|
|
void on_tuning_frequency_changed(rf::Frequency f);
|
|
|
|
void start_tx();
|
2017-03-23 00:29:58 -04:00
|
|
|
void prepare_scanline();
|
2017-03-22 14:21:31 -04:00
|
|
|
|
|
|
|
Labels labels {
|
2017-03-23 17:28:21 -04:00
|
|
|
{ { 1 * 8, 1 * 8 }, "File:", Color::light_grey() },
|
|
|
|
{ { 1 * 8, 3 * 8 }, "Mode:", Color::light_grey() }
|
2017-03-22 14:21:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
OptionsField options_bitmaps {
|
|
|
|
{ 6 * 8, 1 * 8 },
|
|
|
|
16,
|
|
|
|
{ }
|
|
|
|
};
|
2017-03-23 17:28:21 -04:00
|
|
|
OptionsField options_modes {
|
|
|
|
{ 6 * 8, 3 * 8 },
|
|
|
|
16,
|
|
|
|
{ }
|
2017-03-22 14:21:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
ProgressBar progressbar {
|
|
|
|
{ 16, 25 * 8, 208, 16 }
|
|
|
|
};
|
|
|
|
|
|
|
|
TransmitterView tx_view {
|
|
|
|
16 * 16,
|
|
|
|
10000,
|
|
|
|
12
|
|
|
|
};
|
|
|
|
|
2017-03-23 00:29:58 -04:00
|
|
|
MessageHandlerRegistration message_handler_fifo_signal {
|
2017-03-22 14:21:31 -04:00
|
|
|
Message::ID::RequestSignal,
|
|
|
|
[this](const Message* const p) {
|
|
|
|
const auto message = static_cast<const RequestSignalMessage*>(p);
|
|
|
|
if (message->signal == RequestSignalMessage::Signal::FillRequest) {
|
2017-03-23 00:29:58 -04:00
|
|
|
this->prepare_scanline();
|
2017-03-22 14:21:31 -04:00
|
|
|
}
|
|
|
|
}
|
2017-03-23 00:29:58 -04:00
|
|
|
};
|
2017-03-22 14:21:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
} /* namespace ui */
|
|
|
|
|
|
|
|
#endif/*__UI_SSTVTX_H__*/
|