diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index f754a6f4b..7fbabb12e 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -162,7 +162,7 @@ set(CPPSRC ui_spectrum.cpp ui_about.cpp ui_nuoptix.cpp - # ui_jammer.cpp + ui_adsbtx.cpp ui_handwrite.cpp ui_afsksetup.cpp # ui_closecall.cpp @@ -170,8 +170,9 @@ set(CPPSRC ui_rds.cpp ui_lcr.cpp ui_xylos.cpp - ui_freqman.cpp + # ui_freqman.cpp ui_encoders.cpp + ui_jammer.cpp # ui_loadmodule.cpp recent_entries.cpp receiver_model.cpp diff --git a/firmware/application/Makefile b/firmware/application/Makefile index 7ad789f1a..5e619c849 100644 --- a/firmware/application/Makefile +++ b/firmware/application/Makefile @@ -3582,6 +3582,30 @@ ui_about.cpp.s: cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_about.cpp.s .PHONY : ui_about.cpp.s +ui_adsbtx.obj: ui_adsbtx.cpp.obj +.PHONY : ui_adsbtx.obj + +# target to build an object file +ui_adsbtx.cpp.obj: + cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_adsbtx.cpp.obj +.PHONY : ui_adsbtx.cpp.obj + +ui_adsbtx.i: ui_adsbtx.cpp.i +.PHONY : ui_adsbtx.i + +# target to preprocess a source file +ui_adsbtx.cpp.i: + cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_adsbtx.cpp.i +.PHONY : ui_adsbtx.cpp.i + +ui_adsbtx.s: ui_adsbtx.cpp.s +.PHONY : ui_adsbtx.s + +# target to generate assembly for a file +ui_adsbtx.cpp.s: + cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_adsbtx.cpp.s +.PHONY : ui_adsbtx.cpp.s + ui_afsksetup.obj: ui_afsksetup.cpp.obj .PHONY : ui_afsksetup.obj @@ -3774,30 +3798,6 @@ ui_font_fixed_8x16.cpp.s: cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_font_fixed_8x16.cpp.s .PHONY : ui_font_fixed_8x16.cpp.s -ui_freqman.obj: ui_freqman.cpp.obj -.PHONY : ui_freqman.obj - -# target to build an object file -ui_freqman.cpp.obj: - cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_freqman.cpp.obj -.PHONY : ui_freqman.cpp.obj - -ui_freqman.i: ui_freqman.cpp.i -.PHONY : ui_freqman.i - -# target to preprocess a source file -ui_freqman.cpp.i: - cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_freqman.cpp.i -.PHONY : ui_freqman.cpp.i - -ui_freqman.s: ui_freqman.cpp.s -.PHONY : ui_freqman.s - -# target to generate assembly for a file -ui_freqman.cpp.s: - cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_freqman.cpp.s -.PHONY : ui_freqman.cpp.s - ui_handwrite.obj: ui_handwrite.cpp.obj .PHONY : ui_handwrite.obj @@ -3822,6 +3822,30 @@ ui_handwrite.cpp.s: cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_handwrite.cpp.s .PHONY : ui_handwrite.cpp.s +ui_jammer.obj: ui_jammer.cpp.obj +.PHONY : ui_jammer.obj + +# target to build an object file +ui_jammer.cpp.obj: + cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_jammer.cpp.obj +.PHONY : ui_jammer.cpp.obj + +ui_jammer.i: ui_jammer.cpp.i +.PHONY : ui_jammer.i + +# target to preprocess a source file +ui_jammer.cpp.i: + cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_jammer.cpp.i +.PHONY : ui_jammer.cpp.i + +ui_jammer.s: ui_jammer.cpp.s +.PHONY : ui_jammer.s + +# target to generate assembly for a file +ui_jammer.cpp.s: + cd /home/furrtek/portapack-hackrf && $(MAKE) -f firmware/application/CMakeFiles/application.elf.dir/build.make firmware/application/CMakeFiles/application.elf.dir/ui_jammer.cpp.s +.PHONY : ui_jammer.cpp.s + ui_lcr.obj: ui_lcr.cpp.obj .PHONY : ui_lcr.obj @@ -4648,6 +4672,9 @@ help: @echo "... ui_about.obj" @echo "... ui_about.i" @echo "... ui_about.s" + @echo "... ui_adsbtx.obj" + @echo "... ui_adsbtx.i" + @echo "... ui_adsbtx.s" @echo "... ui_afsksetup.obj" @echo "... ui_afsksetup.i" @echo "... ui_afsksetup.s" @@ -4672,12 +4699,12 @@ help: @echo "... ui_font_fixed_8x16.obj" @echo "... ui_font_fixed_8x16.i" @echo "... ui_font_fixed_8x16.s" - @echo "... ui_freqman.obj" - @echo "... ui_freqman.i" - @echo "... ui_freqman.s" @echo "... ui_handwrite.obj" @echo "... ui_handwrite.i" @echo "... ui_handwrite.s" + @echo "... ui_jammer.obj" + @echo "... ui_jammer.i" + @echo "... ui_jammer.s" @echo "... ui_lcr.obj" @echo "... ui_lcr.i" @echo "... ui_lcr.s" diff --git a/firmware/application/main.cpp b/firmware/application/main.cpp index 1654795d3..68d21301e 100755 --- a/firmware/application/main.cpp +++ b/firmware/application/main.cpp @@ -23,9 +23,14 @@ // Bitmaps generated with: // Gimp image > indexed colors (16), then "xxd -i *.bmp" +//BUG: Unistroke text entry screen doesn't care about string max length parameter //BUG (fixed ?): No audio in about when shown second time //BUG: POCSAG RX sometimes misses the first codeword after SYNC +//TODO: Use ModalMessageView with yes/no for TX +//TODO: Show address/data bit fields in OOK TX +//TODO: Scan for OOK TX +//TODO: Check more OOK encoders //TODO: POCSAG 512 and 2400 (all 3 at the same time, or parameter ?) //TODO: Check AFSK transmit end, skips last bits ? //TODO: Check jammer bandwidths @@ -36,7 +41,8 @@ //Multimon-style stuff: //TODO: AFSK receiver -//TODO: Xylos (CCIR) receiver +//TODO: CTCSS detector +//TODO: DMR detector //TODO: Closecall wide range fix //TODO: SD card wiper @@ -54,6 +60,7 @@ //TODO: Hide statusview when playing dead //TODO: Persistent playdead ! +//In case of disaster: //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) diff --git a/firmware/application/string_format.cpp b/firmware/application/string_format.cpp index ff4959fb1..0a3a94000 100644 --- a/firmware/application/string_format.cpp +++ b/firmware/application/string_format.cpp @@ -97,7 +97,7 @@ std::string to_string_dec_int( return q; } -static void to_string_hex_internal(char* p, const uint32_t n, const int32_t l) { +static void to_string_hex_internal(char* p, const uint64_t n, const int32_t l) { const uint32_t d = n & 0xf; p[l] = (d > 9) ? (d + 55) : (d + 48); if( l > 0 ) { @@ -105,8 +105,8 @@ static void to_string_hex_internal(char* p, const uint32_t n, const int32_t l) { } } -std::string to_string_hex(const uint32_t n, const int32_t l) { - char p[16]; +std::string to_string_hex(const uint64_t n, const int32_t l) { + char p[32]; to_string_hex_internal(p, n, l - 1); p[l] = 0; return p; diff --git a/firmware/application/string_format.hpp b/firmware/application/string_format.hpp index 011a2f9a6..75f5457cc 100644 --- a/firmware/application/string_format.hpp +++ b/firmware/application/string_format.hpp @@ -32,7 +32,7 @@ using namespace lpc43xx; // TODO: Allow l=0 to not fill/justify? Already using this way in ui_spectrum.hpp... std::string to_string_dec_uint(const uint32_t n, const int32_t l = 0, const char fill = 0); std::string to_string_dec_int(const int32_t n, const int32_t l = 0, const char fill = 0); -std::string to_string_hex(const uint32_t n, const int32_t l = 0); +std::string to_string_hex(const uint64_t n, const int32_t l = 0); std::string to_string_datetime(const rtc::RTC& value); std::string to_string_time(const rtc::RTC& value); diff --git a/firmware/application/ui_adsbtx.cpp b/firmware/application/ui_adsbtx.cpp new file mode 100644 index 000000000..1651219b0 --- /dev/null +++ b/firmware/application/ui_adsbtx.cpp @@ -0,0 +1,209 @@ +/* + * 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_adsbtx.hpp" +#include "ui_alphanum.hpp" + +#include "string_format.hpp" +#include "portapack.hpp" +#include "baseband_api.hpp" +#include "portapack_persistent_memory.hpp" + +#include +#include + +using namespace portapack; + +namespace ui { + +void ADSBTxView::focus() { + button_transmit.focus(); +} + +ADSBTxView::~ADSBTxView() { + transmitter_model.disable(); + baseband::shutdown(); +} + +void ADSBTxView::paint(Painter& painter) { + button_callsign.set_text(callsign); +} + +void ADSBTxView::generate_frame() { + uint8_t b, c, s, bitn; + char ch; + std::string callsign_formatted(8, '_'); + uint64_t callsign_coded = 0; + uint8_t adsb_crc[14]; // Temp buffer + // 1 00100000 01011111 11111111 + uint32_t crc_poly = 0x1205FFF; + + // Init frame + //memset(adsb_frame, 0, 120); + + adsb_frame[0] = (options_format.selected_index_value() << 3) | 5; // DF and CA + adsb_frame[1] = 0x48; // ICAO24 + adsb_frame[2] = 0x40; + adsb_frame[3] = 0xD6; + adsb_frame[4] = 0x20; // TC + + adsb_frame[11] = 0x00; // Clear CRC + adsb_frame[12] = 0x00; + adsb_frame[13] = 0x00; + + // Translate and code callsign + for (c = 0; c < 8; c++) { + ch = callsign[c]; + for (s = 0; s < 64; s++) { + if (ch == icao_id_lut[s]) break; + } + if (s < 64) { + ch = icao_id_lut[s]; + } else { + ch = ' '; + s = 32; + } + callsign_coded |= ((uint64_t)s << ((7 - c) * 6)); + callsign_formatted[c] = ch; + } + + // Insert callsign in frame + for (c = 0; c < 6; c++) + adsb_frame[c + 5] = (callsign_coded >> ((5 - c) * 8)) & 0xFF; + + // Compute CRC + memcpy(adsb_crc, adsb_frames, 14); + for (c = 0; c < 11; c++) { + for (b = 0; b < 8; b++) { + if ((adsb_crc[c] << b) & 0x80) { + for (s = 0; s < 25; s++) { + bitn = (c * 8) + b + s; + if ((crc_poly >> s) & 1) adsb_crc[bitn >> 3] ^= (0x80 >> (bitn & 7)); + } + } + } + } + // Insert CRC in frame + for (c = 0; c < 3; c++) + adsb_frame[c + 11] = adsb_crc[c + 11]; + + // Display as text + text_message.set(to_string_hex((adsb_frame[11] << 16) + (adsb_frame[12] << 8) + adsb_frame[13], 6)); + //text_message.set(callsign_formatted); + + //ascii_to_ccir(ccir_message); +} + +void ADSBTxView::start_tx() { + transmitter_model.set_tuning_frequency(450000000); // FOR TESTING - DEBUG + transmitter_model.set_baseband_configuration({ + .mode = 0, + .sampling_rate = 1536000U, // CHANGE ! + .decimation_factor = 1, + }); + transmitter_model.set_rf_amp(true); + transmitter_model.set_lna(40); + transmitter_model.set_vga(40); + transmitter_model.set_baseband_bandwidth(1750000); + transmitter_model.enable(); + + //memcpy(shared_memory.tx_data, adsb_frame, 112); + //baseband::set_adsb_data(1); +} + + // ASCII to frequency LUT index +void ADSBTxView::ascii_to_ccir(char *ascii) { + uint8_t c; + + for (c = 0; c < 20; c++) { + if (ascii[c] > '9') + ascii[c] -= 0x37; + else + ascii[c] -= 0x30; + } + + // EOM code for baseband + ascii[20] = 0xFF; +} + +void ADSBTxView::on_txdone(const int n) { + size_t sr; + + if (n == 200) { + transmitter_model.disable(); + progress.set_value(0); + + tx_mode = IDLE; + button_transmit.set_style(&style_val); + button_transmit.set_text("START"); + } else { + progress.set_value(n); + } +} + +ADSBTxView::ADSBTxView(NavigationView& nav) { + (void)nav; + + baseband::run_image(portapack::spi_flash::image_tag_xylos); + + add_children({ { + &text_format, + &options_format, + &text_icaolabel, + &button_icao, + &text_callsign, + &button_callsign, + &progress, + &text_message, + &button_transmit + } }); + + options_format.set_by_value(17); // Mode S + + progress.set_max(122); + + options_format.on_change = [this](size_t i, int32_t v) { + (void)i; + (void)v; + generate_frame(); + }; + button_callsign.on_select = [this, &nav](Button&) { + textentry(nav, callsign, 9); + }; + + button_transmit.set_style(&style_val); + + generate_frame(); + + // Single transmit + button_transmit.on_select = [this,&nav](Button&) { + if (tx_mode == IDLE) { + tx_mode = SINGLE; + button_transmit.set_style(&style_cancel); + button_transmit.set_text("Wait"); + generate_frame(); + start_tx(); + } + }; +} + +} /* namespace ui */ diff --git a/firmware/application/ui_adsbtx.hpp b/firmware/application/ui_adsbtx.hpp new file mode 100644 index 000000000..ad18fff69 --- /dev/null +++ b/firmware/application/ui_adsbtx.hpp @@ -0,0 +1,136 @@ +/* + * 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_textentry.hpp" +#include "ui_widget.hpp" +#include "ui_navigation.hpp" +#include "ui_font_fixed_8x16.hpp" + +#include "message.hpp" +#include "transmitter_model.hpp" +#include "portapack.hpp" + +namespace ui { + +class ADSBTxView : public View { +public: + ADSBTxView(NavigationView& nav); + ~ADSBTxView(); + + void paint(Painter& painter) override; + + void focus() override; + + std::string title() const override { return "ADS-B transmit"; }; + +private: + enum tx_modes { + IDLE = 0, + SINGLE, + SEQUENCE + }; + + tx_modes tx_mode = IDLE; + + char callsign[9] = "KLM1023 "; + + uint8_t adsb_frame[14]; // 112 bit data block as 14 bytes + + const char icao_id_lut[65] = "#ABCDEFGHIJKLMNOPQRSTUVWXYZ##### ###############0123456789######"; + + void ascii_to_ccir(char *ascii); + void start_tx(); + void generate_frame(); + void on_txdone(const int n); + + const Style style_val { + .font = font::fixed_8x16, + .background = Color::green(), + .foreground = Color::black(), + }; + const Style style_cancel { + .font = font::fixed_8x16, + .background = Color::red(), + .foreground = Color::black(), + }; + const Style style_grey { + .font = font::fixed_8x16, + .background = Color::black(), + .foreground = Color::grey(), + }; + + Text text_format { + { 4 * 8, 1 * 16, 7 * 8, 16 }, + "Format:" + }; + OptionsField options_format { + { 12 * 8, 1 * 16 }, + 10, + { + { "17: ADS-B", 17 }, + { "18: TIS-B", 18 }, + { "19: Don't.", 19 }, + } + }; + + Text text_icaolabel { + { 4 * 8, 3 * 16, 7 * 8, 16 }, + "ICAO24:" + }; + Button button_icao { + { 12 * 8, 2 * 16 + 12, 8 * 8, 24 }, + "012345" // 7277A9 + }; + + Text text_callsign { + { 4 * 8, 4 * 16 + 8, 3 * 8, 16 }, + "ID:" + }; + Button button_callsign { + { 8 * 8, 4 * 16 + 4, 10 * 8, 24 }, + "" // "KOR151 " + }; + + ProgressBar progress { + { 5 * 8, 13 * 16, 20 * 8, 16 }, + }; + Text text_message { + { 5 * 8, 14 * 16, 20 * 8, 16 }, + "--------------------" + }; + + Button button_transmit { + { 2 * 8, 16 * 16, 64, 32 }, + "START" + }; + + MessageHandlerRegistration message_handler_tx_done { + Message::ID::TXDone, + [this](const Message* const p) { + const auto message = *reinterpret_cast(p); + this->on_txdone(message.n); + } + }; +}; + +} /* namespace ui */ diff --git a/firmware/application/ui_encoders.hpp b/firmware/application/ui_encoders.hpp index abcfce115..60c88ff5e 100644 --- a/firmware/application/ui_encoders.hpp +++ b/firmware/application/ui_encoders.hpp @@ -22,7 +22,8 @@ #include "ui.hpp" #include "ui_widget.hpp" -#include "ui_textentry.hpp" +#include "ui_navigation.hpp" +#include "ui_font_fixed_8x16.hpp" #include "message.hpp" #include "transmitter_model.hpp" @@ -199,7 +200,7 @@ private: 9, "SAAAAADDDD", "000000000000000000", 455000, 2, - 10 // ? + 2 }, // HT6*** TODO: Add individual variations @@ -210,7 +211,7 @@ private: { "011011", "001001", "001011" }, 18, "SAAAAAAAAAAAADDDDDD", "0000000000000000000000000000000000001011001011001", - 100000, 3, + 80000, 3, 10 // ? }, diff --git a/firmware/application/ui_navigation.cpp b/firmware/application/ui_navigation.cpp index b394fa05b..045a4307a 100644 --- a/firmware/application/ui_navigation.cpp +++ b/firmware/application/ui_navigation.cpp @@ -35,7 +35,7 @@ #include "ui_setup.hpp" #include "ui_debug.hpp" -//#include "ui_closecall.hpp" // DEBUG +//#include "ui_closecall.hpp" // DEBUG //#include "ui_freqman.hpp" // DEBUG #include "ui_nuoptix.hpp" #include "ui_soundboard.hpp" @@ -48,7 +48,8 @@ #include "ui_lcr.hpp" #include "analog_audio_app.hpp" //#include "ui_audiotx.hpp" // DEBUG -//#include "ui_jammer.hpp" // DEBUG +#include "ui_adsbtx.hpp" +#include "ui_jammer.hpp" #include "analog_audio_app.hpp" #include "ais_app.hpp" @@ -220,10 +221,11 @@ void NavigationView::focus() { /* TranspondersMenuView **************************************************/ TranspondersMenuView::TranspondersMenuView(NavigationView& nav) { - add_items<3>({ { - { "AIS: Boats", ui::Color::white(), [&nav](){ nav.push(); } }, - { "ERT: Utility Meters", ui::Color::white(), [&nav](){ nav.push(); } }, - { "TPMS: Cars", ui::Color::white(), [&nav](){ nav.push(); } }, + add_items<4>({ { + { "ADS-B: Planes", ui::Color::grey(), [&nav](){ nav.push(); } }, + { "AIS: Boats", ui::Color::white(), [&nav](){ nav.push(); } }, + { "ERT: Utility Meters", ui::Color::white(), [&nav](){ nav.push(); } }, + { "TPMS: Cars", ui::Color::white(), [&nav](){ nav.push(); } }, } }); on_left = [&nav](){ nav.pop(); }; } @@ -231,10 +233,41 @@ TranspondersMenuView::TranspondersMenuView(NavigationView& nav) { /* ReceiverMenuView ******************************************************/ ReceiverMenuView::ReceiverMenuView(NavigationView& nav) { - add_items<3>({ { - { "Audio", ui::Color::white(), [&nav](){ nav.push(); } }, - { "Transponders", ui::Color::white(), [&nav](){ nav.push(); } }, - { "POCSAG", ui::Color::cyan(), [&nav](){ nav.push(); } }, + add_items<7>({ { + { "Audio", ui::Color::green(), [&nav](){ nav.push(); } }, + { "Transponders", ui::Color::green(), [&nav](){ nav.push(); } }, + { "POCSAG 1200", ui::Color::cyan(), [&nav](){ nav.push(); } }, + { "Nordic/BTLE", ui::Color::grey(), [&nav](){ nav.push(); } }, + { "SIGFOX", ui::Color::grey(), [&nav](){ nav.push(); } }, // SIGFRXView + { "CCIR", ui::Color::grey(), [&nav](){ nav.push(); } }, // XylosRXView + { "AFSK", ui::Color::grey(), [&nav](){ nav.push(); } }, // AFSKRXView + } }); + on_left = [&nav](){ nav.pop(); }; +} + +/* TransmitterCodedMenuView ******************************************************/ + +TransmitterCodedMenuView::TransmitterCodedMenuView(NavigationView& nav) { + add_items<7>({ { + { "ADS-B Mode S", ui::Color::yellow(), [&nav](){ nav.push(); } }, + { "BHT Epar", ui::Color::grey(), [&nav](){ nav.push(); } }, + { "BHT Xylos", ui::Color::yellow(), [&nav](){ nav.push(); } }, + { "Nuoptix DTMF timecode", ui::Color::green(), [&nav](){ nav.push(); } }, + { "OOK remote encoders", ui::Color::green(), [&nav](){ nav.push(); } }, + { "RDS", ui::Color::orange(), [&nav](){ nav.push(); } }, + { "TEDI/LCR AFSK", ui::Color::green(), [&nav](){ nav.push(); } }, + } }); + on_left = [&nav](){ nav.pop(); }; +} + +/* TransmitterAudioMenuView ******************************************************/ + +TransmitterAudioMenuView::TransmitterAudioMenuView(NavigationView& nav) { + add_items<4>({ { + { "Soundboard", ui::Color::yellow(), [&nav](){ nav.push(); } }, + { "Numbers station", ui::Color::grey(), [&nav](){ nav.push(); } }, //nav.push(); + { "Microphone", ui::Color::grey(), [&nav](){ nav.push(); } }, + { "Whistle", ui::Color::grey(), [&nav](){ nav.push(); } }, } }); on_left = [&nav](){ nav.pop(); }; } @@ -242,37 +275,22 @@ ReceiverMenuView::ReceiverMenuView(NavigationView& nav) { /* SystemMenuView ********************************************************/ SystemMenuView::SystemMenuView(NavigationView& nav) { - add_items<13>({ { - { "Play dead", ui::Color::red(), [&nav](){ nav.push(false); } }, - { "Receiver RX", ui::Color::cyan(), [&nav](){ nav.push(); } }, - { "Capture RX", ui::Color::cyan(), [&nav](){ nav.push(); } }, + add_items<10>({ { + { "Play dead", ui::Color::red(), [&nav](){ nav.push(false); } }, + { "Receivers", ui::Color::cyan(), [&nav](){ nav.push(); } }, + { "Capture", ui::Color::cyan(), [&nav](){ nav.push(); } }, + { "Code transmitters", ui::Color::purple(), [&nav](){ nav.push(); } }, + { "Audio transmitters", ui::Color::purple(), [&nav](){ nav.push(); } }, //{ "Close Call RX", ui::Color::cyan(), [&nav](){ nav.push(); } }, - //{ "Numbers station TX", ui::Color::purple(), [&nav](){ nav.push(); } }, //nav.push(); - //{ "Pokemon GO Away TX", ui::Color::blue(), [&nav](){ nav.push(); } }, - { "Soundboard TX", ui::Color::yellow(), [&nav](){ nav.push(); } }, - //{ "Audio TX", ui::Color::yellow(), [&nav](){ nav.push(md5_baseband_tx, AudioTX); } }, + { "Jammer", ui::Color::orange(), [&nav](){ nav.push(); } }, //{ "Frequency manager", ui::Color::white(), [&nav](){ nav.push(); } }, //{ "EPAR TX", ui::Color::green(), [&nav](){ nav.push(md5_baseband_tx, EPAR); } }, - { "Xylos TX", ui::Color::green(), [&nav](){ nav.push(); } }, - { "TEDI/LCR TX", ui::Color::yellow(), [&nav](){ nav.push(); } }, - { "OOK encoders TX", ui::Color::orange(), [&nav](){ nav.push(); } }, - { "Nuoptix DTMF sync TX", ui::Color::purple(), [&nav](){ nav.push(); } }, - { "RDS TX", ui::Color::red(), [&nav](){ nav.push(); } }, //{ "Analyze", ui::Color::white(), [&nav](){ nav.push(); } }, - { "Setup", ui::Color::white(), [&nav](){ nav.push(); } }, - { "Debug", ui::Color::white(), [&nav](){ nav.push(); } }, - { "HackRF", ui::Color::white(), [&nav](){ nav.push(); } }, - { "About", ui::Color::white(), [&nav](){ nav.push(); } } + { "Setup", ui::Color::white(), [&nav](){ nav.push(); } }, + { "Debug", ui::Color::white(), [&nav](){ nav.push(); } }, + { "HackRF", ui::Color::white(), [&nav](){ nav.push(); } }, + { "About", ui::Color::white(), [&nav](){ nav.push(); } } } }); - - //{ "Nordic/BTLE RX", ui::Color::cyan(), [&nav](){ nav.push(new NotImplementedView { nav }); } }, - //{ "Jammer", ui::Color::white(), [&nav](){ nav.push(md5_baseband, new JammerView(nav)); } }, - //{ "Audio file TX", ui::Color::white(), [&nav](){ nav.push(new NotImplementedView { nav }); } }, - //{ "Whistle", ui::Color::purple(), [&nav](){ nav.push(new LoadModuleView { nav, md5_baseband, new WhistleView { nav, transmitter_model }}); } }, - //{ "SIGFOX RX", ui::Color::orange(), [&nav](){ nav.push(new LoadModuleView { nav, md5_baseband, new SIGFRXView { nav, receiver_model }}); } }, - //{ "Xylos RX", ui::Color::green(), [&nav](){ nav.push(new LoadModuleView { nav, md5_baseband_tx, new XylosRXView { nav, receiver_model }}); } }, - //{ "AFSK RX", ui::Color::cyan(), [&nav](){ nav.push(new LoadModuleView { nav, md5_baseband, new AFSKRXView { nav, receiver_model }}); } }, - } /* SystemView ************************************************************/ @@ -290,8 +308,6 @@ SystemView::SystemView( context_(context) { set_style(&style_default); - - //char debugtxt[21]; // DEBUG constexpr ui::Dim status_view_height = 16; diff --git a/firmware/application/ui_navigation.hpp b/firmware/application/ui_navigation.hpp index 9ec130a1d..181161c6f 100644 --- a/firmware/application/ui_navigation.hpp +++ b/firmware/application/ui_navigation.hpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc. + * Copyright (C) 2016 Furrtek * * This file is part of PortaPack. * @@ -176,6 +177,19 @@ private: class ReceiverMenuView : public MenuView { public: ReceiverMenuView(NavigationView& nav); + std::string title() const override { return "Receivers"; }; +}; + +class TransmitterCodedMenuView : public MenuView { +public: + TransmitterCodedMenuView(NavigationView& nav); + std::string title() const override { return "Coded TX"; }; +}; + +class TransmitterAudioMenuView : public MenuView { +public: + TransmitterAudioMenuView(NavigationView& nav); + std::string title() const override { return "Audio TX"; }; }; class SystemMenuView : public MenuView { diff --git a/firmware/baseband/proc_dtmf_tx.cpp b/firmware/baseband/proc_dtmf_tx.cpp index e84778752..0a320e2be 100644 --- a/firmware/baseband/proc_dtmf_tx.cpp +++ b/firmware/baseband/proc_dtmf_tx.cpp @@ -28,7 +28,7 @@ #include -void DTMFTXProcessor::execute(const buffer_c8_t& buffer){ +void DTMFTXProcessor::execute(const buffer_c8_t& buffer) { // This is called at 1536000/2048 = 750Hz // DTMF samplerate = 153600Hz diff --git a/firmware/common/message.hpp b/firmware/common/message.hpp index 379f0965d..a67415978 100644 --- a/firmware/common/message.hpp +++ b/firmware/common/message.hpp @@ -550,13 +550,11 @@ public: class RetuneMessage : public Message { public: constexpr RetuneMessage( - const int64_t freq - ) : Message { ID::Retune }, - freq(freq) + ) : Message { ID::Retune } { } - const int64_t freq = 0; + int64_t freq = 0; }; class AudioTXConfigMessage : public Message { diff --git a/firmware/portapack-h1-havoc.bin b/firmware/portapack-h1-havoc.bin index 1a9e73aa0..27eec70ec 100644 Binary files a/firmware/portapack-h1-havoc.bin and b/firmware/portapack-h1-havoc.bin differ