From d31857c21e64aebd1f2050bbd6b31755b2689ff9 Mon Sep 17 00:00:00 2001 From: gullradriel <3157857+gullradriel@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:51:49 +0100 Subject: [PATCH] Ook remote adjustements (#2365) * moved to ook_remote dir * moved to new filenames / dir * adjusted build files to new dir/filenames * changed name of var / dirname * deleted wrongly included swap files * Added 'Set' 'Open File' * Use language API, make it so TX can be started and also stopped * added send, recv * fixed the name which was too long * renamed some fields, moved the ui, added some text informations, renames some variables * changed to FrequencyField, allow on change, on edit, commented out button_save for a next pass * added OOK files examples * added button_save feature --- firmware/application/external/external.cmake | 8 +- firmware/application/external/external.ld | 10 +- .../external/{rook => ook_remote}/main.cpp | 16 +- .../ui_ook_remote.cpp} | 228 +++++++++++++----- .../ui_ook_remote.hpp} | 77 +++--- firmware/application/file_path.cpp | 2 +- firmware/application/file_path.hpp | 2 +- firmware/common/ui_language.cpp | 2 +- firmware/common/ui_language.hpp | 9 +- sdcard/OOKFILES/OOK_EXAMPLE.OOK | 1 + sdcard/OOKFILES/Tesla_EU_CN.OOK | 1 + sdcard/OOKFILES/Tesla_US.OOK | 1 + 12 files changed, 238 insertions(+), 119 deletions(-) rename firmware/application/external/{rook => ook_remote}/main.cpp (81%) rename firmware/application/external/{rook/ui_rook.cpp => ook_remote/ui_ook_remote.cpp} (50%) rename firmware/application/external/{rook/ui_rook.hpp => ook_remote/ui_ook_remote.hpp} (51%) create mode 100644 sdcard/OOKFILES/OOK_EXAMPLE.OOK create mode 100644 sdcard/OOKFILES/Tesla_EU_CN.OOK create mode 100644 sdcard/OOKFILES/Tesla_US.OOK diff --git a/firmware/application/external/external.cmake b/firmware/application/external/external.cmake index c9a6107f..f5e2ccdf 100644 --- a/firmware/application/external/external.cmake +++ b/firmware/application/external/external.cmake @@ -115,9 +115,9 @@ set(EXTCPPSRC external/ookbrute/main.cpp external/ookbrute/ui_ookbrute.cpp - #rook - external/rook/main.cpp - external/rook/ui_rook.cpp + #ook_remote + external/ook_remote/main.cpp + external/ook_remote/ui_ook_remote.cpp #cvs_spam external/cvs_spam/main.cpp @@ -157,7 +157,7 @@ set(EXTAPPLIST random_password #acars_rx ookbrute - rook + ook_remote shoppingcart_lock flippertx ) diff --git a/firmware/application/external/external.ld b/firmware/application/external/external.ld index 38996717..7eb8f85f 100644 --- a/firmware/application/external/external.ld +++ b/firmware/application/external/external.ld @@ -52,7 +52,7 @@ MEMORY ram_external_app_cvs_spam(rwx) : org = 0xADCB0000, len = 32k ram_external_app_ookbrute(rwx) : org = 0xADCC0000, len = 32k ram_external_app_flippertx(rwx) : org = 0xADCD0000, len = 32k - ram_external_app_rook(rwx) : org = 0xADCE0000, len = 32k + ram_external_app_ook_remote(rwx) : org = 0xADCE0000, len = 32k } SECTIONS @@ -226,11 +226,11 @@ SECTIONS *(*ui*external_app*ookbrute*); } > ram_external_app_ookbrute - .external_app_rook : ALIGN(4) SUBALIGN(4) + .external_app_ook_remote : ALIGN(4) SUBALIGN(4) { - KEEP(*(.external_app.app_rook.application_information)); - *(*ui*external_app*rook*); - } > ram_external_app_rook + KEEP(*(.external_app.app_ook_remote.application_information)); + *(*ui*external_app*ook_remote*); + } > ram_external_app_ook_remote .external_app_flippertx : ALIGN(4) SUBALIGN(4) { diff --git a/firmware/application/external/rook/main.cpp b/firmware/application/external/ook_remote/main.cpp similarity index 81% rename from firmware/application/external/rook/main.cpp rename to firmware/application/external/ook_remote/main.cpp index 0f36f4b7..8534a677 100644 --- a/firmware/application/external/rook/main.cpp +++ b/firmware/application/external/ook_remote/main.cpp @@ -20,25 +20,25 @@ */ #include "ui.hpp" -#include "ui_rook.hpp" +#include "ui_ook_remote.hpp" #include "ui_navigation.hpp" #include "external_app.hpp" -namespace ui::external_app::rook { +namespace ui::external_app::ook_remote { void initialize_app(ui::NavigationView& nav) { - nav.push(); + nav.push(); } -} // namespace ui::external_app::rook +} // namespace ui::external_app::ook_remote extern "C" { -__attribute__((section(".external_app.app_rook.application_information"), used)) application_information_t _application_information_rook = { +__attribute__((section(".external_app.app_ook_remote.application_information"), used)) application_information_t _application_information_ook_remote = { /*.memory_location = */ (uint8_t*)0x00000000, - /*.externalAppEntry = */ ui::external_app::rook::initialize_app, + /*.externalAppEntry = */ ui::external_app::ook_remote::initialize_app, /*.header_version = */ CURRENT_HEADER_VERSION, /*.app_version = */ VERSION_MD5, - /*.app_name = */ "ROOK", + /*.app_name = */ "OOKRemote", /*.bitmap_data = */ { 0x20, 0x00, @@ -79,4 +79,4 @@ __attribute__((section(".external_app.app_rook.application_information"), used)) /*.m4_app_tag = portapack::spi_flash::image_tag_ook */ {'P', 'O', 'O', 'K'}, /*.m4_app_offset = */ 0x00000000, // will be filled at compile time }; -} \ No newline at end of file +} diff --git a/firmware/application/external/rook/ui_rook.cpp b/firmware/application/external/ook_remote/ui_ook_remote.cpp similarity index 50% rename from firmware/application/external/rook/ui_rook.cpp rename to firmware/application/external/ook_remote/ui_ook_remote.cpp index e08bb99c..f4df4550 100644 --- a/firmware/application/external/rook/ui_rook.cpp +++ b/firmware/application/external/ook_remote/ui_ook_remote.cpp @@ -19,7 +19,7 @@ * Boston, MA 02110-1301, USA. */ -#include "ui_rook.hpp" +#include "ui_ook_remote.hpp" #include "portapack.hpp" #include "io_file.hpp" #include "ui_fileman.hpp" @@ -38,20 +38,20 @@ using namespace portapack; using namespace ui; namespace fs = std::filesystem; -namespace ui::external_app::rook { +namespace ui::external_app::ook_remote { -void ROOKAppView::focus() { +void OOKRemoteAppView::focus() { button_set.focus(); } // `start_tx` method: Configures and begins OOK data transmission with a specific message. -void ROOKAppView::start_tx(const std::string& message) { +void OOKRemoteAppView::start_tx(const std::string& message) { size_t bitstream_length = encoders::make_bitstream(const_cast(message)); // Convert the message into a bitstream // Retrieve selected sample rate using selected_index_value() int32_t SAMPLE_RATE_VALUE = field_sample_rate.selected_index_value(); - int32_t SYMBOL_RATE_VALUE = cant_symbol_rate.value(); - int32_t REPEAT = cant_repeat.value(); - int32_t PAUSE_SYMBOL = cant_pause_symbol.value(); + int32_t SYMBOL_DURATION_VALUE = field_bit_duration.value(); + int32_t REPEAT = field_repeat.value(); + int32_t PAUSE_SYMBOL = field_pause_symbol.value(); transmitter_model.set_sampling_rate(SAMPLE_RATE_VALUE); // Set the OOK sampling rate transmitter_model.set_baseband_bandwidth(1750000); // Set the baseband bandwidth @@ -59,23 +59,28 @@ void ROOKAppView::start_tx(const std::string& message) { // Configure OOK data and transmission characteristics baseband::set_ook_data( - bitstream_length, // Length of the bitstream to transmit - SAMPLE_RATE_VALUE / SYMBOL_RATE_VALUE, // Calculate symbol period based on repetition rate - REPEAT, // Set the number of repetitions per symbol - PAUSE_SYMBOL // Set the pause between symbols + bitstream_length, // Length of the bitstream to transmit + SAMPLE_RATE_VALUE / SYMBOL_DURATION_VALUE, // Calculate symbol period based on repetition rate + REPEAT, // Set the number of times the whole bitstream is repeated + PAUSE_SYMBOL // Set the pause between symbols ); + progressbar.set_max(REPEAT); // Size the progress bar accordingly to the number of repeat + is_transmitting = true; // set transmitting flag + button_send_stop.set_text(LanguageHelper::currentMessages[LANG_STOP]); // set button back to initial "start" state } // `stop_tx` method: Stops the transmission and resets the progress bar. -void ROOKAppView::stop_tx() { - transmitter_model.disable(); // Disable the transmitter - progressBar_progress.set_value(0); // Reset progress bar to 0 +void OOKRemoteAppView::stop_tx() { + is_transmitting = false; + transmitter_model.disable(); // Disable the transmitter + progressbar.set_value(0); // Reset progress bar to 0 + button_send_stop.set_text(LanguageHelper::currentMessages[LANG_START]); // set button back to initial "start" state } // `on_file_changed` method: Called when a new file is loaded; parses file data into variables - -void ROOKAppView::on_file_changed(const fs::path& new_file_path) { - payload.clear(); // Clear previous payload content +void OOKRemoteAppView::on_file_changed(const fs::path& new_file_path) { + payload.clear(); // Clear previous payload content + text_loaded_file.set(""); // Clear loaded file text field File data_file; auto open_result = data_file.open(new_file_path); @@ -102,24 +107,24 @@ void ROOKAppView::on_file_changed(const fs::path& new_file_path) { std::string payload_data = line.substr(fifth_space + 1); // Extract binary payload as final value // Convert and assign frequency - unsigned long long frequency = std::stoull(frequency_str); + rf::Frequency frequency = std::stoull(frequency_str); field_frequency.set_value(frequency); transmitter_model.set_target_frequency(frequency); // Convert and assign symbols rate - unsigned int symbols_rate = static_cast(atoi(symbols_rate_str.c_str())); + unsigned int bit_duration_value = static_cast(atoi(symbols_rate_str.c_str())); - cant_symbol_rate.set_value(symbols_rate); + field_bit_duration.set_value(bit_duration_value); // Convert and assign repeat count unsigned int repeat = static_cast(atoi(repeat_str.c_str())); - cant_repeat.set_value(repeat); + field_repeat.set_value(repeat); // Convert and assign pause per symbol unsigned int pause_symbol = static_cast(atoi(pause_symbol_str.c_str())); - cant_pause_symbol.set_value(pause_symbol); + field_pause_symbol.set_value(pause_symbol); // Select sample rate based on value read from file if (sample_rate_str == "250k") { @@ -149,22 +154,23 @@ void ROOKAppView::on_file_changed(const fs::path& new_file_path) { // Ensure UI elements are initialized before use if (parent()) { text_payload.set(payload); - button_start.focus(); + button_send_stop.focus(); } else { text_payload.set("parent not available"); } + text_loaded_file.set("Loaded: " + new_file_path.filename().string()); } // `on_tx_progress` method: Updates the progress bar based on transmission progress. -void ROOKAppView::on_tx_progress(const uint32_t progress, const bool done) { - progressBar_progress.set_value(progress); // Update progress bar value +void OOKRemoteAppView::on_tx_progress(const uint32_t progress, const bool done) { + progressbar.set_value(progress); // Update progress bar value if (done) { stop_tx(); // Stop transmission when progress reaches maximum } } // `draw_waveform` method: Draws the waveform on the UI based on the payload data -void ROOKAppView::draw_waveform() { +void OOKRemoteAppView::draw_waveform() { // Padding reason: // In real-world scenarios, the signal would always start low and return low after turning off the radio. // `waveform_buffer` only controls drawing; the actual send logic is handled by frame_fragments. @@ -194,66 +200,149 @@ void ROOKAppView::draw_waveform() { waveform.set_dirty(); } -// Destructor for `ROOKAppView`: Disables the transmitter and shuts down the baseband -ROOKAppView::~ROOKAppView() { +void OOKRemoteAppView::on_save_file(const std::string value) { + // check if there is a payload, else Error + if (payload.length() < 1) { + text_loaded_file.set("Error: no payload !!"); + return; + } + + ensure_directory(ook_remote_dir); + auto new_path = ook_remote_dir / value + ".OOK"; + if (save_ook_to_file(new_path)) { + text_loaded_file.set("Saved to " + new_path.string()); + } else { + text_loaded_file.set("Error saving " + new_path.string()); + } +} + +bool OOKRemoteAppView::save_ook_to_file(const std::filesystem::path& path) { + // delete file if it exists + delete_file(path); + + // Attempt to open, if it can't be opened. Create new. + auto src = std::make_unique(); + auto error = src->open(path, false, true); + if (error) { + return false; + } + + // write informations + src->write_line(to_string_dec_uint(field_frequency.value()) + " " + + field_sample_rate.selected_index_name() + " " + + to_string_dec_uint(field_bit_duration.value()) + " " + + to_string_dec_uint(field_repeat.value()) + " " + + to_string_dec_uint(field_pause_symbol.value()) + " " + + payload); + + // Close files + src.reset(); + + return true; +} + +// Destructor for `OOKRemoteAppView`: Disables the transmitter and shuts down the baseband +OOKRemoteAppView::~OOKRemoteAppView() { transmitter_model.disable(); baseband::shutdown(); } -// Constructor for `ROOKAppView`: Sets up the app view and initializes UI elements -ROOKAppView::ROOKAppView(NavigationView& nav) +// Constructor for `OOKRemoteAppView`: Sets up the app view and initializes UI elements +OOKRemoteAppView::OOKRemoteAppView(NavigationView& nav) : nav_{nav} { baseband::run_image(portapack::spi_flash::image_tag_ook); - add_children({ - &field_frequency, - &tx_view, - &button_start, - &sample_rate, - &step_symbol_rate, - &cant_step_symbol_rate, - &field_sample_rate, - &field_symbol_rate, - &field_symbol_us_rate, - &cant_symbol_rate, - &text_payload, - &button_set, - &progressBar_progress, - &repeat, - &cant_repeat, - &field_pause_symbol, - &cant_pause_symbol, - &label_waveform, - &waveform, - &button_open, - }); + add_children({&field_frequency, + &tx_view, + &button_send_stop, + &label_bit_duration_step, + &field_bit_duration_step, + &label_sample_rate, + &field_sample_rate, + &label_bit_duration, + &field_bit_duration, + &label_bit_duration_unit, + &text_payload, + &button_set, + &progressbar, + &label_repeat, + &field_repeat, + &label_pause_symbol, + &field_pause_symbol, + &label_payload, + &text_loaded_file, + &label_waveform, + &waveform, + &button_open, + &button_save}); // Initialize default values for controls - cant_pause_symbol.set_value(100); - cant_repeat.set_value(4); + field_pause_symbol.set_value(100); + field_repeat.set_value(4); button_open.on_select = [this](Button&) { - auto open_view = nav_.push(".ROOK"); - ensure_directory(rook_dir); - open_view->push_dir(rook_dir); + auto open_view = nav_.push(".OOK"); + ensure_directory(ook_remote_dir); + open_view->push_dir(ook_remote_dir); open_view->on_changed = [this](std::filesystem::path new_file_path) { // Postpone `on_file_changed` call until `FileLoadView` is closed nav_.set_on_pop([this, new_file_path]() { on_file_changed(new_file_path); - button_start.focus(); + button_send_stop.focus(); draw_waveform(); }); }; }; - // Set up changes for symbol rate and step - cant_symbol_rate.on_change = [this](int32_t value) { - if (value != cant_symbol_rate.value()) - cant_symbol_rate.set_value(value); + button_save.on_select = [this, &nav](const ui::Button&) { + outputFileBuffer = ""; + text_prompt( + nav, + outputFileBuffer, + 64, + [this](std::string& buffer) { + on_save_file(buffer); + }); }; - cant_step_symbol_rate.on_change = [this](size_t, int32_t value) { - cant_symbol_rate.set_step(value); + // clean out loaded file name if field is changed + field_bit_duration.on_change = [this](int32_t) { + text_loaded_file.set(""); // Clear loaded file text field + }; + // clean out loaded file name if field is changed + field_repeat.on_change = [this](int32_t) { + text_loaded_file.set(""); // Clear loaded file text field + }; + // clean out loaded file name if field is changed + field_pause_symbol.on_change = [this](int32_t) { + text_loaded_file.set(""); // Clear loaded file text field + }; + // clean out loaded file name if field is changed + field_sample_rate.on_change = [this](size_t, int32_t) { + text_loaded_file.set(""); // Clear loaded file text field + }; + + // setting up FrequencyField + field_frequency.set_value(ook_remote_tx_freq); + + // clean out loaded file name if field is changed, save ook_remote_tx_freq + field_frequency.on_change = [this](rf::Frequency f) { + ook_remote_tx_freq = f; + text_loaded_file.set(""); // Clear loaded file text field + }; + + // allow typing frequency number + field_frequency.on_edit = [this]() { + auto freq_view = nav_.push(field_frequency.value()); + freq_view->on_changed = [this](rf::Frequency f) { + field_frequency.set_value(f); + text_loaded_file.set(""); // Clear loaded file text field + }; + }; + + field_bit_duration_step.on_change = [this](size_t, int32_t value) { + text_loaded_file.set(""); // Clear loaded file text field + field_bit_duration.set_step(value); }; // Configure button to manually set payload through text input @@ -265,11 +354,16 @@ ROOKAppView::ROOKAppView(NavigationView& nav) [this](std::string& s) { text_payload.set(s); draw_waveform(); + text_loaded_file.set(""); // Clear loaded file text field }); }; draw_waveform(); - button_start.on_select = [this](Button&) { - start_tx(payload); // Begin transmission + button_send_stop.on_select = [this](Button&) { + if (!is_transmitting) { + start_tx(payload); // Begin transmission + } else { + stop_tx(); + } }; } -} // namespace ui::external_app::rook \ No newline at end of file +} // namespace ui::external_app::ook_remote diff --git a/firmware/application/external/rook/ui_rook.hpp b/firmware/application/external/ook_remote/ui_ook_remote.hpp similarity index 51% rename from firmware/application/external/rook/ui_rook.hpp rename to firmware/application/external/ook_remote/ui_ook_remote.hpp index 5429dc8a..3cd4ecf6 100644 --- a/firmware/application/external/rook/ui_rook.hpp +++ b/firmware/application/external/ook_remote/ui_ook_remote.hpp @@ -5,10 +5,11 @@ * */ -#ifndef __UI_ROOK_H__ -#define __UI_ROOK_H__ +#ifndef __UI_OOK_REMOTE_H__ +#define __UI_OOK_REMOTE_H__ #include "ui.hpp" +#include "ui_language.hpp" #include "ui_widget.hpp" #include "ui_navigation.hpp" #include "string_format.hpp" @@ -21,22 +22,22 @@ using namespace ui; -namespace ui::external_app::rook { +namespace ui::external_app::ook_remote { #define PROGRESS_MAX 100 #define OOK_SAMPLERATE_DEFAULT 2280000U // Set the default Sample Rate #define TRANSMISSION_FREQUENCY_DEFAULT 433920000U // Sets the default transmission frequency (27 MHz). #define WAVEFORM_BUFFER_SIZE 550 -class ROOKAppView : public View { +class OOKRemoteAppView : public View { public: void focus() override; - ROOKAppView(NavigationView& nav); + OOKRemoteAppView(NavigationView& nav); - ~ROOKAppView(); + ~OOKRemoteAppView(); std::string title() const override { - return "RemoteOOK"; + return "OOKRemote"; }; private: @@ -44,6 +45,9 @@ class ROOKAppView : public View { std::string payload{""}; // Holds the data payload as a string. uint32_t progress = 0; // Stores the current transmission progress. int16_t waveform_buffer[WAVEFORM_BUFFER_SIZE]; // Buffer for waveform data. + bool is_transmitting = false; // State of transmission. + rf::Frequency ook_remote_tx_freq{24000000}; // last used transmit frequency + std::string outputFileBuffer{}; // buffer for output file void update(); void draw_waveform(); @@ -60,6 +64,12 @@ class ROOKAppView : public View { // Updates data when a new file is loaded. void on_file_changed(const std::filesystem::path& new_file_path); + // Prepare a new std::filesystem::path from string value and call saveFile + void on_save_file(const std::string value); + + // Called by on_save_file to save the current OOK parameters to the file + bool save_ook_to_file(const std::filesystem::path& path); + // Registers a message handler for transmission progress updates. MessageHandlerRegistration message_handler_tx_progress{ Message::ID::TXProgress, // Transmission progress message ID. @@ -72,48 +82,55 @@ class ROOKAppView : public View { TxRadioState radio_state_{TRANSMISSION_FREQUENCY_DEFAULT, 1750000, OOK_SAMPLERATE_DEFAULT}; // Settings manager for app configuration. - app_settings::SettingsManager settings_{"tx_rook", app_settings::Mode::TX}; + app_settings::SettingsManager settings_{ + "ook_remote", + app_settings::Mode::TX, + {{"ook_remote_tx_freq"sv, &ook_remote_tx_freq}}}; // UI components for frequency and transmitter view. - TxFrequencyField field_frequency{{0 * 8, 0 * 16}, nav_}; + FrequencyField field_frequency{{0 * 8, 0 * 16}}; TransmitterView2 tx_view{{20 * 7, 0 * 16}, true}; // Labels for various fields such as sample rate and repeat count. - Labels sample_rate{{{0, 40}, "S/Rate: ", Theme::getInstance()->fg_light->foreground}}; - // Labels step_symbol_rate {{{160, 0}, "Step/Sym: ",Theme::getInstance()->fg_light->foreground}}; - Labels step_symbol_rate{{{0, 18}, "Step/Symbols: ", Theme::getInstance()->fg_light->foreground}}; - Labels repeat{{{0, 60}, "Repeat: ", Theme::getInstance()->fg_light->foreground}}; - Labels field_symbol_rate{{{111, 40}, "Symbols: ", Theme::getInstance()->fg_light->foreground}}; - Labels field_pause_symbol{{{111, 60}, "Pause/Sym: ", Theme::getInstance()->fg_light->foreground}}; - Labels field_symbol_us_rate{{{210, 40}, "us ", Theme::getInstance()->fg_light->foreground}}; - Labels label_waveform{{{0, 140}, "Waveform:", Theme::getInstance()->fg_light->foreground}}; + Labels label_bit_duration_step{{{111, 18}, "BitTimeStep:", Theme::getInstance()->fg_light->foreground}}; + Labels label_sample_rate{{{0, 18}, "S/Rate:", Theme::getInstance()->fg_light->foreground}}; + Labels label_bit_duration{{{111, 40}, "BitTime:", Theme::getInstance()->fg_light->foreground}}; + Labels label_bit_duration_unit{{{210, 40}, "us", Theme::getInstance()->fg_light->foreground}}; + Labels label_repeat{{{0, 40}, "Repeat:", Theme::getInstance()->fg_light->foreground}}; + Labels label_pause_symbol{{{0, 60}, "Pause/Sym:", Theme::getInstance()->fg_light->foreground}}; + Labels label_payload{{{0, 76}, "Payload:", Theme::getInstance()->fg_light->foreground}}; + Labels label_waveform{{{0, 188}, "Waveform:", Theme::getInstance()->fg_light->foreground}}; + + // Text field to display the loaded file if any + Text text_loaded_file{{0, 140, 30 * 8, 16}, ""}; // OptionsField for selectable sample rates. - OptionsField field_sample_rate{{55, 40}, 7, {{"250k", 250000U}, {"1M", 1000000U}, {"2M", 2000000U}, {"5M", 5000000U}, {"10M", 10000000U}, {"20M", 20000000U}}}; + OptionsField field_sample_rate{{55, 18}, 7, {{"250k", 250000U}, {"1M", 1000000U}, {"2M", 2000000U}, {"5M", 5000000U}, {"10M", 10000000U}, {"20M", 20000000U}}}; // OptionsField for step symbol rates. - OptionsField cant_step_symbol_rate{{105, 18}, 7, {{"1", 1}, {"10", 10}, {"100", 100}}}; + OptionsField field_bit_duration_step{{210, 18}, 7, {{"1", 1}, {"10", 10}, {"100", 100}}}; // Number fields for symbols, pause between symbols, and repeat count. - NumberField cant_symbol_rate{{176, 40}, 4, {0, 9999}, 1, '0', false}; - NumberField cant_pause_symbol{{200, 60}, 4, {0, 200}, 1, '0', false}; - NumberField cant_repeat{{55, 60}, 3, {0, 100}, 1, '0', false}; + NumberField field_bit_duration{{176, 40}, 4, {0, 9999}, 1, '0', false}; + NumberField field_pause_symbol{{78, 60}, 4, {0, 200}, 1, '0', false}; + NumberField field_repeat{{55, 40}, 3, {0, 100}, 1, '0', false}; // Text field to display the payload data. - Text text_payload{{0 * 8, 90, 30 * 8, 16}, "Payload:"}; + Text text_payload{{0 * 8, 90, 30 * 8, 16}, ""}; // Buttons for setting configurations, opening files, and starting transmission. - Button button_set{{0, 110, 60, 28}, "Set"}; - Button button_open{{100, 110, 80, 28}, "Open file"}; - Button button_start{{80, 273, 80, 32}, "Start"}; + Button button_set{{0, 110, 60, 28}, LanguageHelper::currentMessages[LANG_SET]}; + Button button_open{{68, 110, 80, 28}, LanguageHelper::currentMessages[LANG_OPEN_FILE]}; + Button button_save{{154, 110, 80, 28}, LanguageHelper::currentMessages[LANG_SAVE_FILE]}; + Button button_send_stop{{80, 273, 80, 32}, LanguageHelper::currentMessages[LANG_SEND]}; // Progress bar to display transmission progress. - ProgressBar progressBar_progress{{2 * 8, 250, 208, 16}}; + ProgressBar progressbar{{2 * 8, 250, 208, 16}}; // Waveform display using waveform buffer and yellow theme color. - Waveform waveform{{0, 165, 240, 32}, waveform_buffer, 0, 0, true, Theme::getInstance()->fg_yellow->foreground}; + Waveform waveform{{0, 208, 240, 32}, waveform_buffer, 0, 0, true, Theme::getInstance()->fg_yellow->foreground}; }; -}; // namespace ui::external_app::rook +}; // namespace ui::external_app::ook_remote -#endif /*__UI_ROOK_H__*/ \ No newline at end of file +#endif /*__UI_OOK_REMOTE_H__*/ diff --git a/firmware/application/file_path.cpp b/firmware/application/file_path.cpp index 4eb5f671..8de4d964 100644 --- a/firmware/application/file_path.cpp +++ b/firmware/application/file_path.cpp @@ -48,4 +48,4 @@ const std::filesystem::path splash_dir = u"SPLASH"; const std::filesystem::path sstv_dir = u"SSTV"; const std::filesystem::path wav_dir = u"WAV"; const std::filesystem::path whipcalc_dir = u"WHIPCALC"; -const std::filesystem::path rook_dir = u"ROOK"; +const std::filesystem::path ook_remote_dir = u"OOKFILES"; diff --git a/firmware/application/file_path.hpp b/firmware/application/file_path.hpp index 308eabae..47ae2d22 100644 --- a/firmware/application/file_path.hpp +++ b/firmware/application/file_path.hpp @@ -50,6 +50,6 @@ extern const std::filesystem::path splash_dir; extern const std::filesystem::path sstv_dir; extern const std::filesystem::path wav_dir; extern const std::filesystem::path whipcalc_dir; -extern const std::filesystem::path rook_dir; +extern const std::filesystem::path ook_remote_dir; #endif /* __FILE_PATH_H__ */ diff --git a/firmware/common/ui_language.cpp b/firmware/common/ui_language.cpp index 19225dc5..be287ade 100644 --- a/firmware/common/ui_language.cpp +++ b/firmware/common/ui_language.cpp @@ -1,7 +1,7 @@ #include "ui_language.hpp" // use the exact position in this array! the enum's value is the identifier. Best to add to the end -const char* LanguageHelper::englishMessages[] = {"OK", "Cancel", "Error", "Modem setup", "Debug", "Log", "Done", "Start", "Stop", "Scan", "Clear", "Ready", "Data:", "Loop", "Reset", "Pause", "Resume", "Flood", "Show QR", "Save", "Lock", "Unlock", "Browse"}; +const char* LanguageHelper::englishMessages[] = {"OK", "Cancel", "Error", "Modem setup", "Debug", "Log", "Done", "Start", "Stop", "Scan", "Clear", "Ready", "Data:", "Loop", "Reset", "Pause", "Resume", "Flood", "Show QR", "Save", "Lock", "Unlock", "Browse", "Set", "Open File", "Save File", "Send", "Receive"}; // multi language support will changes (not in use for now) const char** LanguageHelper::currentMessages = englishMessages; diff --git a/firmware/common/ui_language.hpp b/firmware/common/ui_language.hpp index 6c550208..9c6c6411 100644 --- a/firmware/common/ui_language.hpp +++ b/firmware/common/ui_language.hpp @@ -61,7 +61,12 @@ enum LangConsts { LANG_SAVE, LANG_LOCK, LANG_UNLOCK, - LANG_BROWSE + LANG_BROWSE, + LANG_SET, + LANG_OPEN_FILE, + LANG_SAVE_FILE, + LANG_SEND, + LANG_RECV }; class LanguageHelper { @@ -74,4 +79,4 @@ class LanguageHelper { static const char* englishMessages[]; }; -#endif \ No newline at end of file +#endif diff --git a/sdcard/OOKFILES/OOK_EXAMPLE.OOK b/sdcard/OOKFILES/OOK_EXAMPLE.OOK new file mode 100644 index 00000000..a667d1b4 --- /dev/null +++ b/sdcard/OOKFILES/OOK_EXAMPLE.OOK @@ -0,0 +1 @@ +27000000 1M 1076 4 100 01110111011101110101010101010101010101110111011101110101 diff --git a/sdcard/OOKFILES/Tesla_EU_CN.OOK b/sdcard/OOKFILES/Tesla_EU_CN.OOK new file mode 100644 index 00000000..2ddf781a --- /dev/null +++ b/sdcard/OOKFILES/Tesla_EU_CN.OOK @@ -0,0 +1 @@ +433920000 250k 2300 5 100 101010101010101010101010100010101100101100110010110011001100110011001011010011010010110101001010110100110100110010101011010010110001010110010110011001011001100110011001100101101001101001011010100101011010011010011001010101101001011000101011001011001100101100110011001100110010110100110100101101010010101101001101001100101010110100101 diff --git a/sdcard/OOKFILES/Tesla_US.OOK b/sdcard/OOKFILES/Tesla_US.OOK new file mode 100644 index 00000000..b4b81498 --- /dev/null +++ b/sdcard/OOKFILES/Tesla_US.OOK @@ -0,0 +1 @@ +315000000 250k 2300 5 100 101010101010101010101010100010101100101100110010110011001100110011001011010011010010110101001010110100110100110010101011010010110001010110010110011001011001100110011001100101101001101001011010100101011010011010011001010101101001011000101011001011001100101100110011001100110010110100110100101101010010101101001101001100101010110100101