diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index bddc38dbc..0fd0b3df8 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -161,6 +161,7 @@ set(CPPSRC ui_bht_tx.cpp ui_channel.cpp ui_closecall.cpp + ui_coasterp.cpp ui_cw.cpp ui_debug.cpp ui_encoders.cpp diff --git a/firmware/application/bht.cpp b/firmware/application/bht.cpp index e6beefc46..3b6ca7fef 100644 --- a/firmware/application/bht.cpp +++ b/firmware/application/bht.cpp @@ -131,7 +131,7 @@ std::string gen_message_xy(size_t header_code_a, size_t header_code_b, size_t ci // Copy for baseband memcpy(shared_memory.bb_data.tones_data.message, ccir_message, 20); - // Return as text + // Return as text for display return ccir_to_ascii(ccir_message); } diff --git a/firmware/application/bht.hpp b/firmware/application/bht.hpp index 561590a0f..e0d2be771 100644 --- a/firmware/application/bht.hpp +++ b/firmware/application/bht.hpp @@ -39,7 +39,7 @@ struct bht_city { bool recent; }; -const rf::Frequency bht_freqs[7] = { 31325000, 31387500, 31437500, 31475000, 31687500, 31975000, 88000000 }; +//const rf::Frequency bht_freqs[7] = { 31325000, 31387500, 31437500, 31475000, 31687500, 31975000, 88000000 }; std::string gen_message_ep(uint8_t city_code, size_t family_code_ep, uint32_t relay_state_A, uint32_t relay_state_B); std::string gen_message_xy(size_t header_code_a, size_t header_code_b, size_t city_code, size_t family_code, diff --git a/firmware/application/bitmap.hpp b/firmware/application/bitmap.hpp index 35951eff9..559b6138f 100644 --- a/firmware/application/bitmap.hpp +++ b/firmware/application/bitmap.hpp @@ -475,6 +475,28 @@ static constexpr Bitmap bitmap_more { { 8, 8 }, bitmap_more_data }; +static constexpr uint8_t bitmap_icon_freqman_data[] = { + 0x00, 0x00, + 0x0E, 0x00, + 0x02, 0x00, + 0xE6, 0x7F, + 0x02, 0x00, + 0x00, 0x00, + 0x0E, 0x00, + 0x02, 0x00, + 0xE6, 0x7B, + 0x02, 0x00, + 0x00, 0x00, + 0x0E, 0x00, + 0x02, 0x00, + 0x66, 0x7F, + 0x02, 0x00, + 0x00, 0x00, +}; +static constexpr Bitmap bitmap_icon_freqman { + { 16, 16 }, bitmap_icon_freqman_data +}; + static constexpr uint8_t bitmap_icon_whistle_data[] = { 0x00, 0x00, 0x60, 0x00, @@ -563,6 +585,28 @@ static constexpr Bitmap bitmap_icon_numbers { { 16, 16 }, bitmap_icon_numbers_data }; +static constexpr uint8_t bitmap_icon_notepad_data[] = { + 0x0C, 0x00, + 0x1E, 0x00, + 0x2F, 0x00, + 0x47, 0x00, + 0xE2, 0x00, + 0xD4, 0x01, + 0xB8, 0x03, + 0x70, 0x07, + 0xE0, 0x0E, + 0xC0, 0x1D, + 0x80, 0x3B, + 0x00, 0x4F, + 0x00, 0x46, + 0x00, 0x84, + 0x00, 0xD8, + 0x00, 0xE0, +}; +static constexpr Bitmap bitmap_icon_notepad { + { 16, 16 }, bitmap_icon_notepad_data +}; + static constexpr uint8_t bitmap_icon_setup_data[] = { 0x00, 0x00, 0x18, 0x18, @@ -655,16 +699,16 @@ static constexpr uint8_t bitmap_icon_cwgen_data[] = { 0x00, 0x00, 0x00, 0x00, 0xC0, 0xC0, - 0x20, 0x21, + 0xE0, 0xE1, 0x20, 0x21, 0x21, 0x21, 0x21, 0x21, - 0x21, 0x21, - 0x12, 0x12, - 0x12, 0x12, + 0x33, 0x33, + 0x33, 0x33, 0x12, 0x12, 0x12, 0x12, 0x12, 0x12, + 0x1E, 0x1E, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00, @@ -1123,19 +1167,41 @@ static constexpr Bitmap bitmap_icon_sstv { { 16, 16 }, bitmap_icon_sstv_data }; +static constexpr uint8_t bitmap_icon_burger_data[] = { + 0xE0, 0x07, + 0x58, 0x18, + 0x04, 0x25, + 0x12, 0x40, + 0x85, 0x90, + 0x21, 0x84, + 0x01, 0x80, + 0x06, 0x60, + 0xFE, 0x7F, + 0x0E, 0x78, + 0x1F, 0xFC, + 0x39, 0x9F, + 0xC3, 0xC0, + 0x0E, 0x70, + 0xF8, 0x1F, + 0x00, 0x00, +}; +static constexpr Bitmap bitmap_icon_burger { + { 16, 16 }, bitmap_icon_burger_data +}; + static constexpr uint8_t bitmap_icon_jammer_data[] = { - 0xA6, 0x2C, + 0xA6, 0xAC, 0x73, 0x47, - 0x2E, 0xB9, + 0xAE, 0xB9, 0x55, 0xD7, 0x7E, 0xAE, 0xD3, 0x45, 0xCA, 0xBA, 0x71, 0x15, - 0xDA, 0xBE, + 0xDA, 0xFE, 0xF5, 0xAB, - 0xAD, 0x98, - 0x48, 0x77, + 0xAF, 0x98, + 0x4A, 0x77, 0xAD, 0xCA, 0x58, 0x7D, 0xBF, 0xAF, diff --git a/firmware/application/main.cpp b/firmware/application/main.cpp index 09ca84cc2..5e4d5592c 100755 --- a/firmware/application/main.cpp +++ b/firmware/application/main.cpp @@ -34,7 +34,6 @@ //TODO: Morse use prosigns //TODO: Morse live keying mode ? /* -Keying speed: 60 or 75 PARIS Continuous (Fox-oring) 12s transmit, 48s space (Sprint 1/5th) 60s transmit, 240s space (Classic 1/5 min) @@ -48,7 +47,6 @@ Continuous (Fox-oring) //TODO: FreqMan: Cap entry count per category (only done for total entries right now) //TODO: Script engine ? //TODO: Close Call multiple slices (buggy) -//TODO: Finish EPAR tx //TODO: Wav visualizer //TODO: File browser view ? @@ -56,7 +54,7 @@ Continuous (Fox-oring) //TODO: Move frequencykeypad from ui_receiver to ui_widget (used everywhere) //TODO: ADS-B draw trajectory + GPS coordinates + scale, and playback //TODO: Analog TV tx with camcorder font character generator -//TODO: Make Morse coder and Whistle use proc_tones +//TODO: Make Whistle use proc_tones //TODO: RDS multiple groups (sequence) //TODO: Use ModalMessageView confirmation for TX ? //TODO: Show address/data bit fields in OOK TX @@ -68,23 +66,17 @@ Continuous (Fox-oring) //TODO: AFSK receiver //TODO: CTCSS detector //TODO: DMR detector - //TODO: GSM channel detector //TODO: SIGFOX RX/TX //TODO: Bodet :) - //TODO: LCR full message former (see norm) //TODO: AFSK NRZI - //TODO: Playdead amnesia and login //TODO: Setup: Play dead by default ? Enable/disable ? - //BUG (fixed ?): No audio in about when shown second time - //TODO: Show MD5 mismatches for modules not found, etc... //TODO: Module name/filename in modules.hpp to indicate requirement in case it's not found ui_loadmodule //BUG: Description doesn't show up first time going to system>module info (UI drawn on top) -//TODO: Draw on touchscreen and transmit as spectrum paint //TODO: Two players tic-tac-toe //TODO: Analog TV pong game diff --git a/firmware/application/ui_bht_tx.cpp b/firmware/application/ui_bht_tx.cpp index e96e1ee0e..e967090ae 100644 --- a/firmware/application/ui_bht_tx.cpp +++ b/firmware/application/ui_bht_tx.cpp @@ -45,43 +45,41 @@ void BHTView::generate_message() { uint8_t ccir_message[20]; uint32_t c; - if (!_mode) { - if (tx_mode == SINGLE) { + if (tx_mode == SINGLE) { text_message.set( gen_message_xy(header_code_a.value(), header_code_b.value(), city_code_xy.value(), family_code_xy.value(), checkbox_wcsubfamily.value(), subfamily_code.value(), checkbox_wcid.value(), receiver_code.value(), relay_states[0].selected_index(), relay_states[1].selected_index(), relay_states[2].selected_index(), relay_states[3].selected_index()) ); - }/* else if (tx_mode == SEQUENCE) { - // sequence_lille_matin - for (c = 0; c < 20; c++) { - if (sequence_lille_matin[seq_index].code[c] <= 9) - ccir_message[c] = sequence_lille_matin[seq_index].code[c] - '0'; - else - ccir_message[c] = sequence_lille_matin[seq_index].code[c] - 'A' + 10; - } - - // Copy for baseband - memcpy(shared_memory.bb_data.tones_data.message, ccir_message, 20); - - text_message.set(sequence_lille_matin[seq_index].code); - text_message.set_dirty(); - }*/ + } else if (tx_mode == SEQUENCE) { + for (c = 0; c < 20; c++) { + if (sequence_matin[seq_index].code[c] <= '9') + ccir_message[c] = sequence_matin[seq_index].code[c] - '0'; + else + ccir_message[c] = sequence_matin[seq_index].code[c] - 'A' + 10; + } - } else { + // Replace repeats with E code + for (c = 1; c < 20; c++) + if (ccir_message[c] == ccir_message[c - 1]) ccir_message[c] = 14; + + // Copy for baseband + memcpy(shared_memory.bb_data.tones_data.message, ccir_message, 20); + + text_message.set(sequence_matin[seq_index].code); + //text_message.set_dirty(); + } /*else { - text_message.set( - gen_message_ep(city_code_ep.value(), family_code_ep.selected_index_value(), - relay_states[0].selected_index(), relay_states[1].selected_index()) - );*/ - } + text_message.set( + gen_message_ep(city_code_ep.value(), family_code_ep.selected_index_value(), + relay_states[0].selected_index(), relay_states[1].selected_index()) + );*/ } void BHTView::start_tx() { - if (speaker_enabled && !_mode) - audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max); + uint8_t c; generate_message(); @@ -92,24 +90,21 @@ void BHTView::start_tx() { transmitter_model.set_baseband_bandwidth(1750000); transmitter_model.enable(); - // Setup for Xy - for (uint8_t c = 0; c < 16; c++) { + // Setup tones for Xy + for (c = 0; c < 16; c++) { shared_memory.bb_data.tones_data.tone_defs[c].delta = ccir_deltas[c]; shared_memory.bb_data.tones_data.tone_defs[c].duration = XY_TONE_LENGTH; } - audio::set_rate(audio::Rate::Hz_24000); - baseband::set_tones_data(transmitter_model.bandwidth(), XY_SILENCE, 20, false, checkbox_speaker.value()); + baseband::set_tones_data(transmitter_model.bandwidth(), XY_SILENCE, 20, false, false); } void BHTView::on_tx_progress(const int progress, const bool done) { - size_t c; - uint8_t sr; + uint32_t c; + uint8_t rs; if (tx_mode == SINGLE) { if (done) { - audio::headphone::set_volume(volume_t::decibel(0 - 99) + audio::headphone::volume_range().max); - transmitter_model.disable(); progressbar.set_value(0); @@ -119,11 +114,9 @@ void BHTView::on_tx_progress(const int progress, const bool done) { } else { chThdSleepMilliseconds(tempo_cligno.value() * 1000); // Dirty :( - // Invert all relay states - for (c = 0; c < 1; c++) { - sr = relay_states[c].selected_index(); - if (sr > 0) relay_states[c].set_selected_index(sr ^ 3); - } + // Invert first relay's state + rs = relay_states[0].selected_index(); + if (rs > 0) relay_states[0].set_selected_index(rs ^ 3); generate_message(); start_tx(); @@ -131,15 +124,27 @@ void BHTView::on_tx_progress(const int progress, const bool done) { } else { progressbar.set_value(progress); } - }/* else if (tx_mode == SEQUENCE) { + } else if (tx_mode == SEQUENCE) { if (done) { transmitter_model.disable(); - chThdSleepMilliseconds(sequence_lille_matin[seq_index].delay * 1000); - seq_index++; - generate_message(); - start_tx(); + progressbar.set_value(0); + + if (seq_index < 13) { + for (c = 0; c < sequence_matin[seq_index].delay; c++) + chThdSleepMilliseconds(1000); + + seq_index++; + + generate_message(); + start_tx(); + } else { + tx_mode = IDLE; + tx_view.set_transmitting(false); + } + } else { + progressbar.set_value(progress); } - }*/ + } } BHTView::BHTView(NavigationView& nav) { @@ -153,8 +158,6 @@ BHTView::BHTView(NavigationView& nav) { &options_mode, &header_code_a, &header_code_b, - &checkbox_speaker, - &bmp_speaker, &city_code_xy, &family_code_xy, &subfamily_code, @@ -173,16 +176,15 @@ BHTView::BHTView(NavigationView& nav) { header_code_a.set_value(0); header_code_b.set_value(0); city_code_xy.set_value(10); - city_code_ep.set_value(220); + //city_code_ep.set_value(220); family_code_xy.set_value(1); - family_code_ep.set_selected_index(2); + //family_code_ep.set_selected_index(2); subfamily_code.set_value(1); receiver_code.set_value(1); - tempo_cligno.set_value(1); + tempo_cligno.set_value(0); progressbar.set_max(20); - relay_states[0].set_selected_index(1); // R1 OFF - options_mode.on_change = [this](size_t mode, OptionsField::value_t) { +/* options_mode.on_change = [this](size_t mode, OptionsField::value_t) { _mode = mode; if (_mode) { @@ -229,46 +231,28 @@ BHTView::BHTView(NavigationView& nav) { set_dirty(); }; generate_message(); - }; + };*/ - checkbox_speaker.on_select = [this](Checkbox&, bool v) { - speaker_enabled = v; - }; - - header_code_a.on_change = [this](int32_t) { - generate_message(); - }; - header_code_b.on_change = [this](int32_t) { - generate_message(); - }; - city_code_xy.on_change = [this](int32_t) { - generate_message(); - }; - family_code_xy.on_change = [this](int32_t) { - generate_message(); - }; - subfamily_code.on_change = [this](int32_t) { - generate_message(); - }; - receiver_code.on_change = [this](int32_t) { - generate_message(); - }; + header_code_a.on_change = [this](int32_t) { generate_message(); }; + header_code_b.on_change = [this](int32_t) { generate_message(); }; + city_code_xy.on_change = [this](int32_t) { generate_message(); }; + family_code_xy.on_change = [this](int32_t) { generate_message(); }; + subfamily_code.on_change = [this](int32_t) { generate_message(); }; + receiver_code.on_change = [this](int32_t) { generate_message(); }; checkbox_wcsubfamily.on_select = [this](Checkbox&, bool v) { - if (v) { + if (v) subfamily_code.set_focusable(false); - } else { + else subfamily_code.set_focusable(true); - } generate_message(); }; checkbox_wcid.on_select = [this](Checkbox&, bool v) { - if (v) { + if (v) receiver_code.set_focusable(false); - } else { + else receiver_code.set_focusable(true); - } generate_message(); }; @@ -284,7 +268,7 @@ BHTView::BHTView(NavigationView& nav) { relay_state.on_change = relay_state_fn; relay_state.set_parent_rect({ static_cast(4 + (n * 36)), - 158, + 150, 24, 24 }); relay_state.set_options(relay_options); @@ -302,7 +286,7 @@ BHTView::BHTView(NavigationView& nav) { }; button_seq.on_select = [this, &nav](Button&) { - if ((tx_mode == IDLE) && (!_mode)) { + if (tx_mode == IDLE) { seq_index = 0; tx_mode = SEQUENCE; tx_view.set_transmitting(true); @@ -311,9 +295,7 @@ BHTView::BHTView(NavigationView& nav) { }; tx_view.on_start = [this]() { - if ((tx_mode == IDLE) && (!_mode)) { - if (speaker_enabled && _mode) - audio::headphone::set_volume(volume_t::decibel(90 - 99) + audio::headphone::volume_range().max); + if (tx_mode == IDLE) { tx_mode = SINGLE; tx_view.set_transmitting(true); start_tx(); diff --git a/firmware/application/ui_bht_tx.hpp b/firmware/application/ui_bht_tx.hpp index 63649f9ca..ed72eb9ce 100644 --- a/firmware/application/ui_bht_tx.hpp +++ b/firmware/application/ui_bht_tx.hpp @@ -32,8 +32,6 @@ #include "bht.hpp" #include "message.hpp" -#include "volume.hpp" -#include "audio.hpp" #include "transmitter_model.hpp" #include "encoders.hpp" #include "portapack.hpp" @@ -72,7 +70,7 @@ private: 2017-03-03 07:15:05 0001181AAAB1000B0000 18:1:A:AA 2017-03-03 07:15:22 0001189400B0100B0000 18:9:4:00 R2=OFF (8) */ - const sequence_t sequence_lille_matin[14] = { + const sequence_t sequence_matin[14] = { { "0000189000B1002B0000", 19 }, // 18:9:0:00 R1=OFF (1) { "0000189200B2110B0000", 16 }, // 18:9:2:00 R1=ON (4) { "0000189200B1110B0000", 52 }, // 18:9:2:00 R1=OFF (4) @@ -97,9 +95,6 @@ private: tx_modes tx_mode = IDLE; - bool speaker_enabled = false; - size_t _mode = 0; - void start_tx(); void generate_message(); void on_tx_progress(const int progress, const bool done); @@ -126,8 +121,8 @@ private: { { 7 * 8, 7 * 8 }, "Famille:", Color::light_grey() }, { { 2 * 8, 9 * 8 + 2 }, "Sous-famille:", Color::light_grey() }, { { 2 * 8, 13 * 8 }, "ID recepteur:", Color::light_grey() }, - { { 1 * 8, 17 * 8 }, "Relais:", Color::light_grey() }, - { { 27 * 8 + 4, 20 * 8 + 4 }, "s.", Color::light_grey() } + { { 1 * 8, 16 * 8 }, "Relais:", Color::light_grey() }, + { { 27 * 8 + 4, 19 * 8 + 4 }, "s.", Color::light_grey() } }; OptionsField options_mode { @@ -139,18 +134,6 @@ private: } }; - Checkbox checkbox_speaker { - { 22 * 8, 4 }, - 0, - "" - }; - Image bmp_speaker { - { 204, 8, 16, 16 }, - &bitmap_icon_speaker, - ui::Color::white(), - ui::Color::black() - }; - NumberField header_code_a { { 16 * 8, 3 * 8 }, 2, @@ -173,13 +156,13 @@ private: 1, ' ' }; - NumberField city_code_ep { + /*NumberField city_code_ep { { 16 * 8, 5 * 8 }, 3, { 0, 255 }, 1, ' ' - }; + };*/ NumberField family_code_xy { { 16 * 8, 7 * 8 }, @@ -188,7 +171,7 @@ private: 1, ' ' }; - OptionsField family_code_ep { + /*OptionsField family_code_ep { { 16 * 8, 7 * 8 }, 2, { @@ -197,7 +180,7 @@ private: { "C ", 0 }, { "TP", 3 } } - }; + };*/ NumberField subfamily_code { { 16 * 8, 9 * 8 + 2 }, @@ -234,20 +217,20 @@ private: }; ProgressBar progressbar { - { 5 * 8, 13 * 16, 20 * 8, 16 }, + { 5 * 8, 12 * 16, 20 * 8, 16 }, }; Text text_message { - { 5 * 8, 14 * 16, 20 * 8, 16 }, + { 5 * 8, 13 * 16, 20 * 8, 16 }, "" }; Checkbox checkbox_cligno { - { 18 * 8 + 4, 10 * 16}, + { 18 * 8 + 4, 19 * 8 }, 3, - "J/N" + "Alt" }; NumberField tempo_cligno { - { 25 * 8 + 4, 10 * 16 + 4}, + { 25 * 8 + 4, 19 * 8 + 4 }, 2, { 1, 99 }, 1, @@ -255,7 +238,7 @@ private: }; Button button_seq { - { 210, 210, 30, 30 }, + { 210, 13 * 16, 32, 32 }, "SQ" }; diff --git a/firmware/application/ui_coasterp.cpp b/firmware/application/ui_coasterp.cpp new file mode 100644 index 000000000..c964660ea --- /dev/null +++ b/firmware/application/ui_coasterp.cpp @@ -0,0 +1,135 @@ +/* + * 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. + */ + +#include "ui_coasterp.hpp" + +#include "baseband_api.hpp" +#include "portapack_persistent_memory.hpp" + +#include +#include + +using namespace portapack; + +namespace ui { + +void CoasterPagerView::focus() { + sym_data.focus(); +} + +CoasterPagerView::~CoasterPagerView() { + transmitter_model.disable(); + baseband::shutdown(); +} + +void CoasterPagerView::generate_frame() { + uint8_t frame[19]; + uint32_t c; + + // Preamble (8 bytes) + for (c = 0; c < 8; c++) + frame[c] = 0x55; // Isn't this 0xAA ? + + // Sync word + frame[8] = 0x2D; + frame[9] = 0xD4; + + // Data length + frame[10] = 8; + + // Data + for (c = 0; c < 8; c++) + frame[c + 11] = (sym_data.get_sym(c << 1) << 4) | sym_data.get_sym((c << 1) + 1); + + // Copy for baseband + memcpy(shared_memory.bb_data.data, frame, 19); +} + +void CoasterPagerView::start_tx() { + generate_frame(); + + transmitter_model.set_sampling_rate(2280000); + transmitter_model.set_rf_amp(true); + transmitter_model.set_baseband_bandwidth(1750000); + transmitter_model.enable(); + + baseband::set_fsk_data(19 * 8, 2280000 / 1000, 5000, 32); +} + +void CoasterPagerView::on_tx_progress(const int progress, const bool done) { + (void)progress; + + if (tx_mode == SINGLE) { + if (done) { + transmitter_model.disable(); + tx_mode = IDLE; + tx_view.set_transmitting(false); + } + } +} + +CoasterPagerView::CoasterPagerView(NavigationView& nav) { + const uint8_t data_init[8] = { 0x44, 0x01, 0x3B, 0x30, 0x30, 0x30, 0x34, 0xBC }; + uint32_t c; + + baseband::run_image(portapack::spi_flash::image_tag_fsktx); + + add_children({ + &labels, + &sym_data, + &checkbox_scan, + &text_message, + &tx_view + }); + + for (c = 0; c < 16; c++) + sym_data.set_sym(c, (data_init[c >> 1] >> ((c & 1) ? 0 : 4)) & 0x0F); + + /*checkbox_scan.on_select = [this](Checkbox&, bool v) { + };*/ + + checkbox_scan.set_value(false); + + generate_frame(); + + tx_view.on_edit_frequency = [this, &nav]() { + auto new_view = nav.push(receiver_model.tuning_frequency()); + new_view->on_changed = [this](rf::Frequency f) { + receiver_model.set_tuning_frequency(f); + }; + }; + + tx_view.on_start = [this]() { + if (tx_mode == IDLE) { + tx_mode = SINGLE; + tx_view.set_transmitting(true); + start_tx(); + } + }; + + tx_view.on_stop = [this]() { + tx_view.set_transmitting(false); + tx_mode = IDLE; + }; +} + +} /* namespace ui */ diff --git a/firmware/application/ui_coasterp.hpp b/firmware/application/ui_coasterp.hpp new file mode 100644 index 000000000..10db00ac0 --- /dev/null +++ b/firmware/application/ui_coasterp.hpp @@ -0,0 +1,95 @@ +/* + * 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. + */ + +#include "ui.hpp" +#include "ui_widget.hpp" +#include "ui_navigation.hpp" +#include "ui_transmitter.hpp" +#include "ui_font_fixed_8x16.hpp" + +#include "message.hpp" +#include "transmitter_model.hpp" +#include "portapack.hpp" + +namespace ui { + +class CoasterPagerView : public View { +public: + CoasterPagerView(NavigationView& nav); + ~CoasterPagerView(); + + void focus() override; + + std::string title() const override { return "Si44xx transmit"; }; + +private: + enum tx_modes { + IDLE = 0, + SINGLE + }; + + tx_modes tx_mode = IDLE; + + void start_tx(); + void generate_frame(); + void on_tx_progress(const int progress, const bool done); + + Labels labels { + { { 1 * 8, 3 * 8 }, "Data:", Color::light_grey() } + }; + + SymField sym_data { + { 6 * 8, 3 * 8 }, + 16, // 14 ? 12 ? + SymField::SYMFIELD_HEX + }; + + Checkbox checkbox_scan { + { 10 * 8, 8 * 8 }, + 4, + "Scan" + }; + + /*ProgressBar progressbar { + { 5 * 8, 12 * 16, 20 * 8, 16 }, + };*/ + Text text_message { + { 5 * 8, 13 * 16, 20 * 8, 16 }, + "" + }; + + TransmitterView tx_view { + 16 * 16, + 10000, + 12 + }; + + MessageHandlerRegistration message_handler_tx_done { + Message::ID::TXDone, + [this](const Message* const p) { + const auto message = *reinterpret_cast(p); + this->on_tx_progress(message.progress, message.done); + } + }; +}; + +} /* namespace ui */ diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index 56e3b84ab..afb904192 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -33,6 +33,7 @@ #include "ui_adsbtx.hpp" #include "ui_bht_tx.hpp" #include "ui_closecall.hpp" +#include "ui_coasterp.hpp" #include "ui_cw.hpp" #include "ui_debug.hpp" #include "ui_encoders.hpp" @@ -304,11 +305,12 @@ ReceiverMenuView::ReceiverMenuView(NavigationView& nav) { /* TransmitterCodedMenuView ******************************************************/ TransmitterCodedMenuView::TransmitterCodedMenuView(NavigationView& nav) { - add_items<8>({ { + add_items<9>({ { { "ADS-B Mode S", ui::Color::orange(),&bitmap_icon_adsb, [&nav](){ nav.push(); } }, { "BHT Xy/EP", ui::Color::yellow(),&bitmap_icon_bht, [&nav](){ nav.push(); } }, { "Morse code", ui::Color::green(), &bitmap_icon_morse, [&nav](){ nav.push(); } }, { "Nuoptix DTMF timecode", ui::Color::green(), &bitmap_icon_nuoptix, [&nav](){ nav.push(); } }, + { "NTTWorks burger pager", ui::Color::orange(), &bitmap_icon_burger, [&nav](){ nav.push(); } }, { "OOK remote encoders", ui::Color::green(), &bitmap_icon_remote, [&nav](){ nav.push(); } }, { "POCSAG", ui::Color::green(), &bitmap_icon_pocsag, [&nav](){ nav.push(); } }, { "RDS", ui::Color::green(), &bitmap_icon_rds, [&nav](){ nav.push(); } }, @@ -333,11 +335,11 @@ TransmitterAudioMenuView::TransmitterAudioMenuView(NavigationView& nav) { UtilitiesView::UtilitiesView(NavigationView& nav) { add_items<5>({ { - { "Frequency manager", ui::Color::green(), nullptr, [&nav](){ nav.push(); } }, - { "CW generator", ui::Color::green(), &bitmap_icon_cwgen, [&nav](){ nav.push(); } }, - { "Whip antenna length", ui::Color::yellow(),nullptr, [&nav](){ nav.push(); } }, - { "Notepad", ui::Color::grey(), nullptr, [&nav](){ nav.push(); } }, - { "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push(); } }, + { "Frequency manager", ui::Color::green(), &bitmap_icon_freqman, [&nav](){ nav.push(); } }, + { "CW generator", ui::Color::green(), &bitmap_icon_cwgen, [&nav](){ nav.push(); } }, + { "Whip antenna length", ui::Color::yellow(),nullptr, [&nav](){ nav.push(); } }, + { "Notepad", ui::Color::grey(), &bitmap_icon_notepad, [&nav](){ nav.push(); } }, + { "Wipe SD card", ui::Color::red(), nullptr, [&nav](){ nav.push(); } }, } }); on_left = [&nav](){ nav.pop(); }; } diff --git a/firmware/application/ui_transmitter.cpp b/firmware/application/ui_transmitter.cpp index d50d45ddf..205ef19f0 100644 --- a/firmware/application/ui_transmitter.cpp +++ b/firmware/application/ui_transmitter.cpp @@ -22,6 +22,8 @@ #include "ui_transmitter.hpp" +#include "audio.hpp" +#include "baseband_api.hpp" #include "portapack.hpp" using namespace portapack; @@ -117,8 +119,8 @@ TransmitterView::TransmitterView( field_frequency.set_style(&style_locked); } else { add_children({ - &field_bw, - &text_kHz + &text_bw, + &field_bw }); field_bw.on_change = [this](int32_t bandwidth) { @@ -152,11 +154,9 @@ TransmitterView::TransmitterView( } TransmitterView::~TransmitterView() { - /*audio::output::stop(); - + audio::output::stop(); transmitter_model.disable(); - - baseband::shutdown();*/ + baseband::shutdown(); } } /* namespace ui */ diff --git a/firmware/application/ui_transmitter.hpp b/firmware/application/ui_transmitter.hpp index 9879f7250..7090f7cc1 100644 --- a/firmware/application/ui_transmitter.hpp +++ b/firmware/application/ui_transmitter.hpp @@ -88,31 +88,31 @@ private: bool transmitting_ { false }; FrequencyField field_frequency { - { 4, 1 * 8 } + { 0, 1 * 8 } }; Text text_gain { - { 0 * 8, 3 * 8, 5 * 8, 1 * 16 }, + { 0, 3 * 8, 5 * 8, 1 * 16 }, "Gain:" }; TXGainField field_gain { { 5 * 8, 3 * 8 } }; + Text text_bw { + { 11 * 8, 1 * 8, 9 * 8, 1 * 16 }, + "BW: kHz" + }; NumberField field_bw { - { 13 * 8, 1 * 8 }, + { 14 * 8, 1 * 8 }, 3, { 1, 150 }, 1, ' ' }; - Text text_kHz { - { 16 * 8, 1 * 8, 3 * 8, 1 * 16 }, - "kHz" - }; Button button_start { - { 20 * 8, 1 * 8, 9 * 8, 32 }, + { 21 * 8, 1 * 8, 9 * 8, 32 }, "START" }; diff --git a/firmware/baseband/CMakeLists.txt b/firmware/baseband/CMakeLists.txt index 68462a100..0ce912df1 100644 --- a/firmware/baseband/CMakeLists.txt +++ b/firmware/baseband/CMakeLists.txt @@ -432,7 +432,7 @@ add_custom_command( VERBATIM ) -#set(BASEBAND_IMAGES ${BASEBAND_IMAGES} hackrf.img) +set(BASEBAND_IMAGES ${BASEBAND_IMAGES} hackrf.img) ### Terminator image @@ -443,7 +443,7 @@ add_custom_command( VERBATIM ) -#set(BASEBAND_IMAGES ${BASEBAND_IMAGES} terminator.img) +set(BASEBAND_IMAGES ${BASEBAND_IMAGES} terminator.img) ####################################################################### diff --git a/firmware/graphics/icon_burger.png b/firmware/graphics/icon_burger.png new file mode 100644 index 000000000..df179d019 Binary files /dev/null and b/firmware/graphics/icon_burger.png differ diff --git a/firmware/graphics/icon_cwgen.png b/firmware/graphics/icon_cwgen.png index 85cfc5b7e..9cbaa8d02 100644 Binary files a/firmware/graphics/icon_cwgen.png and b/firmware/graphics/icon_cwgen.png differ diff --git a/firmware/graphics/icon_freqman.png b/firmware/graphics/icon_freqman.png new file mode 100644 index 000000000..3718377e1 Binary files /dev/null and b/firmware/graphics/icon_freqman.png differ diff --git a/firmware/graphics/icon_jammer.png b/firmware/graphics/icon_jammer.png index 99c42627a..bcee5ed7b 100644 Binary files a/firmware/graphics/icon_jammer.png and b/firmware/graphics/icon_jammer.png differ diff --git a/firmware/graphics/icon_notepad.png b/firmware/graphics/icon_notepad.png new file mode 100644 index 000000000..b61f7aec0 Binary files /dev/null and b/firmware/graphics/icon_notepad.png differ diff --git a/firmware/portapack-h1-havoc.bin b/firmware/portapack-h1-havoc.bin index dea89fee3..d3be8fec8 100644 Binary files a/firmware/portapack-h1-havoc.bin and b/firmware/portapack-h1-havoc.bin differ