mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-08-20 08:57:46 +00:00
Stable merge v2.2.0 (#2736)
* Update README.md
Actually valid complete ali h4m link
* Fake brightness reimplementation (#2444)
* Fake brightness reimplementation
* indentation
* added call to the function which is caching the display settings values
* use cached values instead of pmem
* app manager (#2442)
* fix unset autostart
* clean up - add comments to prevent misleading
* move the app to external and with necessary changes
* replace autostart app
* Add + - buttons in Encoder dial settings (#2447)
* M10 additional parser (#2448)
* Remember previous capture settings (#2450)
* Renamed parameters in rx_capture.ini file (#2452)
* Rename settings in file to match screen
* Renamed variables for hopefully better clarity
* Navigation buttons (#2458)
* regenerate bitmap data
* pagination in submenu
* using little font so we are not eating menu buttons
* docker improvements (#2455)
* Update README.md
New metal case link
* The gerber files of the portapack H4 (#2463)
* Create README.txt
* Update README.txt
* Add files via upload
The gerber files of the portapack h4.
* delete
* Upload the gerber files for H4
* Update README.md (#2456)
Added a link to Lab401.com as a purchase option for EU customers.
(Lab401 was added as the EU exclusive distributor for the H4M - https://opensourcesdrlab.com/pages/distributors)
* Update README.md
* rename bitmaps into bmp
* disabling button on main menu, change labels and add 'icons' (#2466)
* disabling button on main menu, change labels and add 'icons'
* fix reverse order of buttons
---------
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* fix for empty text prompt crash (#2468)
* added discord server information (#2471)
* Add the feature to decide rotate direction of encoder (#2472)
* Update README.md
Lab401 link with our redirection
* Fix encoder setting p.mem issue (#2475)
* Update README.md
Discord badge was broken, switching to shields.io
* Add fast flash script for sdcard switch hardware (#2480)
* fix cmake_minimum_required to 3.16 (#2499)
* fix fallthrough warning (#2497)
* Flipper tx: use file_path, example file (#2496)
* added subghz_dir
* use subghz_dir from file_path
* example file
* Externalize antenna calc and wav view (#2498)
* externalize antenna calc and wav view
* Added a tool to check if all the pictures in graphics are used in internal apps
* APRS: add frequency settings for Brazil (#2494)
* Add frequency settings for Brazil, named 'BR' that tunes to 145.570 MHz.
* Also added: Japan: 144.640 MHz (JAP), Thailand: 144.900 MHz (THA), Philippines: 144.740 MHz (PHI)
* Reordered list by increasing frequency
Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com>
* Added different modulations in signal generator (#2492)
* Added DSB, AM 100% mod index and AM 50% mod index. Changed UI.
* put back app in 'Utilities' (#2500)
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* fix baseband (#2501)
* externalize wipe sdcard (#2502)
* Removing vim swap files (#2503)
* Removing vim swap files
* Added vim swap file to .gitignore
* Add modal to turn off screen when charging is detected (#2514)
* Moved country-specific FREQMAN files to the separate repository set up for it. (#2517)
* fix docker build warnings in dockerfile-nogit (#2518)
* Add new app "hopper" app. (#2482)
* make both jammer and hopper exist
* add example hopper payload
* example files
* swap scanner and recon app location
* Add widget preview tool (#2520)
* PoC
* opt
* opt
* Playlist editor (#2506)
* make both exist
* format
* fix focusing issue
* add example hopper payload
* fix compiler err
* clean up
* correct linker script addr
* lint
* PoC
* unknown: write_line issue
* clean up
* merge
* fix read line
* remove debug code
* fix english
* support new file
* support enter delay
* fix crash
* remove debug code
* some final tune
* Support Bug Key AKA Auto Key for OOK Editor app (#2523)
* _
* some final tune
* textual
* rename following gull's suggestion
* add cursor to font viewer app (#2528)
* Allow disable/enable waveform in Audio app to remove decoding problem on some frequencies
* Added different modulations in signal generator
* Added DSB, AM 100% mod index and AM 50% mod index.
* Changed UI.
* Added pulsed CW
* Adding Wefax demodulation mode inside Audio App (#2539)
* Adding_new_WFAX_GUI_mode_Audio_App
* Wefax_APT_demodulation_structure
* Solving REC Apt signal.wav from WFAX
* clang format issues
* correcting comments
* Breakout - The Portapack remake game rises from the pirate's lair (#2541)
* Breakout - The Portapack remake game rises from the pirate's lair
* Fixes
* Added a signature
* Trivial textual change about missing SD content (#2542)
* _
* _
* waveform fix 3 and trivial change (#2540)
* Moved games to new game menu (#2544)
* Moved games to new game menu
* There's enough games to have a menu now and I plan to make more. Having them in "Utilities" made no sense.
* Wefax warning fix modulation fix (#2543)
* changed order of modulations, changed case to avoid capture
* added missing AMAudioFMApt mode to dump pmem
* reorder demod, adding missing ones, fix warnings
* removed uneeded 'previous_modulation', renamed WFAX to AMFM to match other places
* removing uneeded 'previous_modulation' uneeded check in change_modulation
* move capture at the end so AMAUdioFMApt is matching the other arrays for position 4
* added AMFM to Recon Level and Scanner
* clang + more details in some comments
---------
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* Snake (#2549)
* Create the Shopping Cart Lock app
Will demonstrate tomorrow. Don't merge until I do 😁
* Fixes for HTotoo's comments 😎
* Improved audio the best I can.
If nobody has any ideas to further improve high frequencies of the audio, the hardware may not be capable. I still need to check with line-out to better speaker to make sure it's not just the speaker, but it shouldn't be.
* Compared against baseband_api.cpp - matched some things better but still playback seems to be missing higher fq sounds
* renamed wav files to a more specific / less generic name
* indentation + using variables instead of litteral names for wav files to use
* indentation
* Made a Snake game - enjoy
* Code formatting. I always forget.
* move to keep sort order
* Update external.ld
Sorry I should have also asked if there was any reason that address ranges 0xADDA0000--0xADDD0000 were skipped in external.ld. I assumed there wasn't so I changed it to be consecutive using the same 0x10000 step as the other modules. If there is any reason to skip them then we should add a comment to note it. Of course these are all just temporary address values used for linking and get overwritten by a kludgy "search & replace" during the build process.
Resolves enhancement request #764
---------
Co-authored-by: gullradriel <gullradriel@no-mail.com>
Co-authored-by: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com>
* Nested Debug menu into Utilities menu to tidy Home screen (#2551)
* rename rand pwd app (#2552)
* _
* remove wip code that forgot to add in old branch
* Moved speaker 1px to the right to match muted icon variant. (#2554)
* Stopwatch external app (#2553)
* updated bitmaps for speaker icon (#2555)
* updated bitmaps for speaker icon
* removed opera cake icon that was added by mistake
* adding missing Game menu source png
* cyan for Game menu
* regenerated icons
* Breakout icon change (#2556)
- Changed Breakout icon
- Changed Tetris icon color to green
* Snake icon change (#2557)
* Remove deprecated QR Code code (#2558)
* Setting for faster Button Repeat delays (#2559)
* Setting for faster Button Repeat delays
* Tweak fast delay times
* Tweak delay times
* Added description line and tweaked delay again
* OokBrute app opt (#2561)
* zooming_spectrum_AMFM_mode (#2565)
* Update README.md
Fixing opesourcesdrlab link
* Update README.md
Other link broken
* WeFax rx ext app (#2566)
* wf3
* Ookbrute (#2354)
* Revert "Ookbrute (#2354)"
This reverts commit abb8143eec
.
* fix
* test edition
* re enable ble
* re enable ert
* steal amfm stuff
* something happens
* save bmp on start btn
* kinda works
* exit crash fixed
* redline, remove some hardcoded
* removed cpu killer red line, and some fixes
* simplify #1
* seems ok. time to improve
* added hidden freq offset to receiver model, so wefax can be set to the "correct" freq without users needs to substract 300 hz
* badly implemented sync detection, and disabled it.
* fix for fix
* fixes
* fix offset to real life off
* no line on freq enter
* fixes
* Doom - Mayhem Edition (#2570)
* Doom - Mini Mayhem version
* Update ui_doom.cpp
* Update ui_doom.cpp
* Update ui_doom.cpp
* Update ui_doom.cpp
* Update ui_doom.cpp
* Update ui_doom.cpp
* Update ui_doom.cpp
* Update ui_doom.cpp
* Doom - Mayhem Edition
Made the Doom - Mayhem Edition game. Some little bugs but good enough for nightly.
* Code formatting. Forgot like always.
* give more initial ammo until i put ammo around the maze to collect
* Update Doom main.cpp for better icon (#2575)
* fix external app address list (#2573)
* Add WEFAX freqman file (#2567)
* Add WEFAX freqman file
* fix bad escaped spaces and unicode characters
* Add icon for the doom game (#2574)
* Add icon for the doom game
* Add b/w .png to convert as doom icon
* Added wefax offset to audio app too. (#2572)
* added wefax offset to audio app too.
* moved from head to cpp
* Put ticker class and pp_colors in hpp file in namespace and remove helper files (#2577)
* stopwatch opt (#2578)
* stopwatch opt
* comments
* format
* fxi ms display when user tune display level
* issue template fine tune (#2579)
* Combined cpp files, stuffed helper files in hpp, updates start and game over screens (#2583)
* Combine cpp, move helpers to hpp (#2584)
* naming space (#2585)
* Tetris: Combined cpp files. Helper files into hpp. Dark mode. Encoder on. (#2587)
* Adding_Waterfall_ZOOM_x2_in_AM_modes_Audio_App (#2586)
* adding zoom_factor to app settings
* separated zoom_factor settings for AM and AMFM
* fix order so zoom factor is also applied correctly on modulation change
* fix zoom not applied when changing bandwidth
* temporary disable the Scanner so we are not breaking the nightly. Until we are choosing to finally remove it or find a better solution
---------
Co-authored-by: gullradriel <3157857+gullradriel@users.noreply.github.com>
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* Fixed the I Tetromino rotation using SRS (Super Rotation System) (#2588)
* Externalize dump pmem (#2590)
* initial commit
* clang
* memory icon
* text output and exit button, FOCUS OVERRIDE TO AVOID COMPILATION ERROR
* modem and data_structure_version accessor
---------
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* remove dead code (#2593)
* remove not yet enabled screening app (#2594)
* move default splash into sdcard (#2595)
* move bmps to sdcard
* remove unrelated files
* gitignore
* credit
* format
* Externalize scanner (#2589)
* externalize scanner
* NFM as main baseband as it's the biggest used one
* fix modulation bug introduced with AMFM
* Externalize level (#2596)
* removing ability to focus on RSSI bars and to launch level app, until a solution to launch external apps from internal ones is given
* externalize Level app
* Remove unneeded AMFM support in those apps (#2597)
* Create CODE_OF_CONDUCT.md
* Create pull_request_template.md
* Create SECURITY.md
* Create CONTRIBUTING.md (#2598)
* Force 433.92 and remove metadata check (#2599)
* Force 433.92 and remove metadata check: we already know the frequency for all files so don't need a million metadata files to match.
* Variable fixes and move to header
* Added more Wefax stations (#2600)
* Delete sdcard/FREQMAN/WEFAX.TXT
Replace with 2 files
* Add more WeFax frequencies
* Update comments
* Oops wrong folder
* Oops wrong folder
* Change comments
* Remove RF TX and use PATX baseband for audio --> speaker out only (#2601)
* Force 433.92 and remove metadata check
We already know the frequency for all files so don't need a million metadata files to match.
* Remove RF TX. Improve PATX baseband.
* code formatting of course
* Issue template again (#2602)
* test1
* test2
* add tap tempo to metronomic app (#2605)
* _
* format
* fix new tree in Arch
* solving_Audio_App_AM_GUI_Problem_issue_2604 (#2609)
* make the ptext_prompt func can define which keyboard to enter (#2608)
* _
* format
* use define
* prevent long life var for audio app - AM (#2610)
* static vars so no external linkage is possible
* persistent settings and no more global living variables
---------
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* theme fix again (#2611)
* theme fix again
* _
* user can disable battery change hint (#2612)
* theme fix again
* _
* _
* GFX EQ App (#2607)
* Make the beginnings of rf3d
* Name change...
* Add mood button
* Remove forced amp settings and add persistent user settings
* Fix options bar layout and SettingsManager
* Make the background paint to black again after opening fq modal
* fix audio/mod/settings and cleaned unneeded parts
* Mapped bars to audio spectrum
* Improved frequency response... still needs work i think
* add on_freqchg to be able to answer to serial frequency change command
* Made calculations for 14 bars to fit screen and little adjustments
* Visual improvements
Co-authored-by: gullradriel
* Improved make_bitmap tool (#2615)
* Enhance Graphic Equalizer Visualization with Improved Frequency Bands and Response (#2614)
* Custom waterfall colors (#2617)
* Custom waterfall gradient
* Installing a custom waterfall gradient via fileman
* default file for user friendly swap
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* Delete dead code in ble_rx_app.cpp (#2620)
Duplicate include on line 24 removed.
* Fix default waterfall file (#2621)
* correct default settings from file
* correct colors names
* fix comments (#2622)
* Touch on waterfall to set cursor pos (#2624)
* init
* fix typo that found by Copilot
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Adding 8.33KHz spacing (#2628)
* Adding 8.33KHz spacing
* remove extern options_db_t freqman_steps which is now brought by ui_receiver.hpp
* use freqman db steps instead of static array
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* Added menu group for transceivers (#2623)
* Added menu group for transceivers
* Reorder apps icons
* Support IPS screen & brightness set for IPS screen (#2629)
* _
* format
* format
* format
* Fix bug that created by PR "Added menu group for transceivers" (#2630)
* spectrum cursor opt again (#2634)
* spectrum cursor opt
* fmt
* remove blink
* remove End event
* cleanup
* Update README.md
Links were dead for opensourcesdrlab
* Fix for #2538 (#2635)
* Fix for #2538
Fix for #2538
Added on_bandwidth_changed Callback to ui_transmitter.hpp
Modified the field_bw.on_change lambda in the TransmitterView constructor to trigger the on_bandwidth_changed callback
Connected the Callback in ui_siggen.cpp
I am not a C++ programmer so this change was proposed by Gemini AI.
I have built and tested the App and it works as expected and I don't think the change will have any unexpected side effects.
* Fix clang issues
Fix clang issues
* Update ui_transmitter.cpp
typo
* Revised change
The proposed change mirrors the way a change to the frequency (on_edit_frequency) is triggered in ui_siggen by the tx_view.
The bw parameter is not passed because it is stored in _setting in the tx_view and will be read by update_config.
A change to the bw is not checked against auto_update to keep its behaviour consistent with a change to the gain, amplitude or frequency.
* Make changes to the channel_bandwidth dynamic whist playing
Behaviour of channel bandwidth is now consistent with frequency, amp and gain.
* comment edit
* revert hackrf submodule checkpoint to the repo
* comment
---------
Co-authored-by: zxkmm <zxkmm@hotmail.com>
* Adding_WFM_AM_mode_to_Audio_App (#2644)
* Adding_WFM_AM_mode_to_Audio_App
* more precise values for cos and sin theta, fix sen_theta to sin_theta
* fix sen_theta to sin_theta
* going back to WFM as main baseband in main.cpp as NFM is now making the apps crashing. Looks like last additions to WFM made it bigger. (#2646)
* remove dead code (#2647)
* Update ui_tetris.cpp (#2650)
Start "I" tetromino a bit higher and block rotate if it will cause out of bounds collision.
* Noaa apt decoder (#2648)
* Explicit_naming_wefax_NOAA_and_small_addition (#2651)
* slightly improved ads-b receiver module (#2649)
* slightly improved ads-b receiver module:
* fix Heading, Speed and Vrate decoders
* decode more ModeS messages
* log all ModeS messages (except DF11)
* fix formatting (clang-style); advice on data alignment taken into account
* ADS-B module: convert Indicated AirSpeed to True AirSpeed if altitute is known
* ADS-B rx module: replacing floating point with integer arithmetic
* adding 10Hz and 50Hz to freqman_steps (#2652)
* Improve_RF_sensitivity_NOAA_signal (#2654)
* Upload the PCB file of PortaPack H4 and update the schematic file (#2657)
* Create README.txt
* Update README.txt
* Add files via upload
The gerber files of the portapack h4.
* delete
* Upload the gerber files for H4
* Create README.txt
This is the V1.0 version PCB file of PortaPack H4.
* Upload the pcb file for H4
* Update README.txt
* Update LCD_TF_Schematic.pdf
* Jammer app add modes (#2659)
* Add new jammer modes
Overview
This PR enhances the PortaPack Jammer app by introducing eight new signal types, ported from my Flipper Zero RF Jammer app (https://github.com/RocketGod-git/flipper-zero-rf-jammer). These modes expand the app's capability to disrupt a wide range of RF communication protocols, from analog radios to modern digital systems. The implementation preserves the original app structure, resolves namespace conflicts, and ensures compatibility with the Mayhem firmware.
New Modes
The following modes have been added to the options_type in ui_jammer.hpp, with corresponding signal generation in proc_jammer.cpp:
Noise: Generates broadband white noise to interfere with analog and digital signals (e.g., Wi-Fi, Bluetooth, key fobs). Highly effective for overwhelming receivers across a frequency range.
Sine: Produces a continuous, unmodulated sine wave to jam narrowband receivers, ideal for analog FM/AM radios or telemetry systems.
Square: Emits a harmonic-rich square wave, disrupting digital protocols (e.g., OOK, ASK) and systems sensitive to sharp transitions, such as remote keyless entry.
Sawtooth (Experimental): Generates a sawtooth wave with a unique harmonic profile, useful for testing interference against PWM-based or niche analog systems.
Triangle (Experimental): Creates a triangle wave with minimal harmonics, suitable for exploratory jamming of narrowband systems or receiver linearity testing.
Chirp: Outputs a rapid frequency-sweeping chirp signal, effective against frequency-hopping and spread-spectrum systems (e.g., some Wi-Fi, Bluetooth, or military radios).
Gauss: Generates Gaussian noise to mimic natural interference, targeting digital systems like GPS or data links by degrading signal-to-noise ratios.
Brute (Experimental): Transmits a constant maximum-amplitude signal to saturate simple receiver front-ends, useful for brute-force jamming of basic analog devices.
* Add new jammer modes
Overview
This PR enhances the PortaPack Jammer app by introducing eight new signal types, ported from my Flipper Zero RF Jammer app (https://github.com/RocketGod-git/flipper-zero-rf-jammer). These modes expand the app's capability to disrupt a wide range of RF communication protocols, from analog radios to modern digital systems. The implementation preserves the original app structure, resolves namespace conflicts, and ensures compatibility with the Mayhem firmware.
New Modes
The following modes have been added to the options_type in ui_jammer.hpp, with corresponding signal generation in proc_jammer.cpp:
Noise: Generates broadband white noise to interfere with analog and digital signals (e.g., Wi-Fi, Bluetooth, key fobs). Highly effective for overwhelming receivers across a frequency range.
Sine: Produces a continuous, unmodulated sine wave to jam narrowband receivers, ideal for analog FM/AM radios or telemetry systems.
Square: Emits a harmonic-rich square wave, disrupting digital protocols (e.g., OOK, ASK) and systems sensitive to sharp transitions, such as remote keyless entry.
Sawtooth (Experimental): Generates a sawtooth wave with a unique harmonic profile, useful for testing interference against PWM-based or niche analog systems.
Triangle (Experimental): Creates a triangle wave with minimal harmonics, suitable for exploratory jamming of narrowband systems or receiver linearity testing.
Chirp: Outputs a rapid frequency-sweeping chirp signal, effective against frequency-hopping and spread-spectrum systems (e.g., some Wi-Fi, Bluetooth, or military radios).
Gauss: Generates Gaussian noise to mimic natural interference, targeting digital systems like GPS or data links by degrading signal-to-noise ratios.
Brute (Experimental): Transmits a constant maximum-amplitude signal to saturate simple receiver front-ends, useful for brute-force jamming of basic analog devices.
* refactor the serial log logic of BLE Rx (#2660)
* Prepare for display orientation part 1 (#2661)
* fix png part
* screen max width fixes (#2663)
* max width fixes
* format
* Audio to right (#2664)
* r.align
* Storing_selected_NOAA_filter_in_settings_file (#2665)
* Storing_selected_NOAA_filter_in_settings_file
* format_issues
* wfm_filters_GUI_name_std (#2668)
* getres cmd (#2671)
* ui new coord system examples and macros (#2672)
* Detector RX ext app (#2673)
* Jammer improvements (#2674)
* Add new jammer modes
Overview:
This PR enhances the PortaPack Jammer app by introducing eight new signal types, ported from my Flipper Zero RF Jammer app (https://github.com/RocketGod-git/flipper-zero-rf-jammer). These modes expand the app's capability to disrupt a wide range of RF communication protocols, from analog radios to modern digital systems. The implementation preserves the original app structure, resolves namespace conflicts, and ensures compatibility with the Mayhem firmware.
New Modes
The following modes have been added to the options_type in ui_jammer.hpp, with corresponding signal generation in proc_jammer.cpp:
Noise: Generates broadband white noise to interfere with analog and digital signals (e.g., Wi-Fi, Bluetooth, key fobs). Highly effective for overwhelming receivers across a frequency range.
Sine: Produces a continuous, unmodulated sine wave to jam narrowband receivers, ideal for analog FM/AM radios or telemetry systems.
Square: Emits a harmonic-rich square wave, disrupting digital protocols (e.g., OOK, ASK) and systems sensitive to sharp transitions, such as remote keyless entry.
Sawtooth (Experimental): Generates a sawtooth wave with a unique harmonic profile, useful for testing interference against PWM-based or niche analog systems.
Triangle (Experimental): Creates a triangle wave with minimal harmonics, suitable for exploratory jamming of narrowband systems or receiver linearity testing.
Chirp: Outputs a rapid frequency-sweeping chirp signal, effective against frequency-hopping and spread-spectrum systems (e.g., some Wi-Fi, Bluetooth, or military radios).
Gauss: Generates Gaussian noise to mimic natural interference, targeting digital systems like GPS or data links by degrading signal-to-noise ratios.
Brute (Experimental): Transmits a constant maximum-amplitude signal to saturate simple receiver front-ends, useful for brute-force jamming of basic analog devices.
* Fixed and made brutal.
This PR introduces user-focused improvements to the Jammer App in the HackRF PortaPack Mayhem Firmware, enhancing usability and flexibility. The changes address specific user requirements for a more intuitive default configuration, continuous waveform support, and dynamic setting adjustments during transmission.
* jammer fix (#2676)
* jammer fix
* Adding_BPF_selection_to_the_NOAA_APT_signal (#2675)
* Adding_BPF_selection_to_the_NOAA_APT_signal
* comments, spell mistake .
* trivial apps folder movement (#2677)
* Clean_LCD_beat_in_NOAA_Rx_App (#2678)
* Added ability to enter custom tone values in Morse app (#2679)
* Added ability to enter custom tone values in Morse app
Added the ability to type in a custom tone value in the morse TX app (issue#2582)
*Click on the tone field to open a keyboard for entering in a desired value between 100hz - 9999hz.
*Maintains original step value of 20 when scrolling the rotary wheel.
* Update ui_morse.cpp
Replaced std::to_string with to_string_dec_uint
* Moved tone_input_buffer init to in-class
* removed some std stuff only used here (#2681)
* 80mhz jammer range (#2682)
Looks great 😎🤘🚀
* Radio app improvements (#2680)
* Rename looking glass preset for clarity and consistency (#2686)
* Gfx widget and Radio (#2685)
* widgetize
* gfx and Radio improvement
* format + handle not wfm visual states
* wf or gf
* Externalize widget (#2688)
* Add all jammer modes in hopper app (#2691)
Added all modes that jammer app supports in hopper app.
* Super secret dont look (#2690)
* Add new jammer modes
Overview
This PR enhances the PortaPack Jammer app by introducing eight new signal types, ported from my Flipper Zero RF Jammer app (https://github.com/RocketGod-git/flipper-zero-rf-jammer). These modes expand the app's capability to disrupt a wide range of RF communication protocols, from analog radios to modern digital systems. The implementation preserves the original app structure, resolves namespace conflicts, and ensures compatibility with the Mayhem firmware.
New Modes
The following modes have been added to the options_type in ui_jammer.hpp, with corresponding signal generation in proc_jammer.cpp:
Noise: Generates broadband white noise to interfere with analog and digital signals (e.g., Wi-Fi, Bluetooth, key fobs). Highly effective for overwhelming receivers across a frequency range.
Sine: Produces a continuous, unmodulated sine wave to jam narrowband receivers, ideal for analog FM/AM radios or telemetry systems.
Square: Emits a harmonic-rich square wave, disrupting digital protocols (e.g., OOK, ASK) and systems sensitive to sharp transitions, such as remote keyless entry.
Sawtooth (Experimental): Generates a sawtooth wave with a unique harmonic profile, useful for testing interference against PWM-based or niche analog systems.
Triangle (Experimental): Creates a triangle wave with minimal harmonics, suitable for exploratory jamming of narrowband systems or receiver linearity testing.
Chirp: Outputs a rapid frequency-sweeping chirp signal, effective against frequency-hopping and spread-spectrum systems (e.g., some Wi-Fi, Bluetooth, or military radios).
Gauss: Generates Gaussian noise to mimic natural interference, targeting digital systems like GPS or data links by degrading signal-to-noise ratios.
Brute (Experimental): Transmits a constant maximum-amplitude signal to saturate simple receiver front-ends, useful for brute-force jamming of basic analog devices.
* Super secret
* You gotta get (Get) that (That) dirt off your shoulder
* Add 1ms hop option to hopper app + 0ms (freeze UI) (#2692)
* add dark theme (#2695)
* Made the Dino Game (#2697)
* Add vendor name in bluetooth rx app (#2696)
* add macaddress db, add vendor name in bluetooth rx app
* show "missing macaddress.db" instead of unknown if db not found
* bluetooth rx list with colors based on mac vendor
* bug fix
* Modified Text Editor to handle long presses. (#2698)
* Improved FPV_ANALOG.txt FREQMAN file (#2700)
* Improved FPV_ANALOG.txt FREQMAN file
Removed unused or super rare analog fpv bands: U, O, H, D
Added 1.2GHz -1.3GHz channels sometimes used for long range analog fpv
* Corrected and updated the labels to be more consistent.
Corrected the labels to be more consistent.
I also somehow messed up the correct channels because 1.3GHz FPV is not fully standardized, but these channels seem to be the most common.
It should be all correct now.
Example transmitters using those channels:
https://greenchip.com.ua/0-0-1615-2.html
https://flymod.net/en/item/walksnail_vtx_9ch
https://pl.aliexpress.com/item/1005006505365351.html
* Filemanager: go to parent directory keep track of the right selected … (#2702)
* Filemanager: go to parent directory keep track of the right selected item and page number
* review: avoid unnecessary copies in get_extension
* ADSB database update (tools, db) (#2701)
* enhance make_airlines_db tool
* enhance make_icao24_db tool
* update airlinescode (.txt, .db), aircraftdatabase/icao24 (.csv, .db)
* Made the Space Invaders game. Argh matey! (#2709)
* Made the Space Invaders game. Argh matey!
* Format code, sigh.
* Made the Blackjack game (#2712)
* Made the Blackjack game
* Format Blackjack main.cpp
* Changed spade to diamond for dark mode visibility
* Format code
* Update app icons for Space Invaders and Dino Game (#2713)
* BLE Rx Improvements (#2710)
* Work to allow for unique beacon parsing functions.
* Fix Copyright
* Update firmware/application/apps/ble_rx_app.cpp
* Update firmware/baseband/proc_btlerx.cpp
* PR suggestions.
* Fix String.
* Refactor
* Added 3d printed cases for the H4M (#2715)
* Battleship (#2720)
* Made the Battleship 2P 2PP game - FSK is wip
* Using POCSAG
* Adding simple FSK Rx Processor. Can be used with New Apps. (#2716)
* Work to allow for unique beacon parsing functions.
* Fixing pull.
* Changes.
* Formatting.
* Fix Copyright
* Update firmware/application/apps/ble_rx_app.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Update firmware/baseband/proc_btlerx.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* PR suggestions.
* Fix String.
* FSK Rx Improvements. Works for my custom protocol.
* Fix buffer size.
* Refactor
* Formatting.
* Formatting.
* Fixing compiling, and BLE Rx UI/Performance.
* More improvements.
* Fixing stuck state.
* More stuck parsing fix.
* Combining PR changes.
* Improvements from previous PR.
* Fix dbM calculation relative to device RSSI.
* Formatting.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: TJ <tj.baginski@cognosos.com>
* Add blue bar to subghzd+weather (#2724)
* AIS map improv (#2725)
* AIS map improv
* format code mismatch with vc
* Add radio settings, new app icon, and other UI improvements (#2732)
* update submodule (#2734)
Co-authored-by: gullradriel <gullradriel@no-mail.com>
* update version (#2735)
Co-authored-by: gullradriel <gullradriel@no-mail.com>
---------
Co-authored-by: Erwin Ried <1091420+eried@users.noreply.github.com>
Co-authored-by: hackrfstuff <leszczyleszczy@icloud.com>
Co-authored-by: sommermorgentraum <24917424+zxkmm@users.noreply.github.com>
Co-authored-by: Totoo <ttotoo@gmail.com>
Co-authored-by: Mark Thompson <129641948+NotherNgineer@users.noreply.github.com>
Co-authored-by: E.T. <tamas@eisenberger.hu>
Co-authored-by: OpenSourceSDRLab <opensourcesdr@outlook.com>
Co-authored-by: quantum-x <simon.yorkston@gmail.com>
Co-authored-by: gullradriel <gullradriel@no-mail.com>
Co-authored-by: Lucas C. Villa Real <lucasvr@users.noreply.github.com>
Co-authored-by: Davide Rovelli <103165301+daviderud@users.noreply.github.com>
Co-authored-by: Gaurav Chaturvedi <oddtazz@users.noreply.github.com>
Co-authored-by: RocketGod <57732082+RocketGod-git@users.noreply.github.com>
Co-authored-by: Lerold <github@lerold.slmail.me>
Co-authored-by: Brumi-2021 <86470699+Brumi-2021@users.noreply.github.com>
Co-authored-by: dark-juju <2839275+dark-juju@users.noreply.github.com>
Co-authored-by: Benjamin Møller <37707273+LupusE@users.noreply.github.com>
Co-authored-by: Oleg Belousov <belousov.oleg@gmail.com>
Co-authored-by: haruk <104354987+exe-noisy@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Luca <61653175+iu2frl@users.noreply.github.com>
Co-authored-by: Richard <richard.toy@gmail.com>
Co-authored-by: zxkmm <zxkmm@hotmail.com>
Co-authored-by: horrordash <45861453+horrordash@users.noreply.github.com>
Co-authored-by: Alien <2142224+mythic-alien@users.noreply.github.com>
Co-authored-by: Petro Danylevskyi <petro@danylevskyi.com>
Co-authored-by: Tommaso Ventafridda <33782489+tomventa@users.noreply.github.com>
Co-authored-by: Netro <146584182+iNetro@users.noreply.github.com>
Co-authored-by: plomek <86431917+plomek@users.noreply.github.com>
Co-authored-by: TJ <tj.baginski@cognosos.com>
This commit is contained in:
43
firmware/application/ui/external/readme.md
vendored
Normal file
43
firmware/application/ui/external/readme.md
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
|
||||
Copyright (C) 2025 HTotoo
|
||||
|
||||
|
||||
# External UI elements
|
||||
|
||||
|
||||
## Read carefully
|
||||
|
||||
|
||||
These widgets are only used in external apps!
|
||||
The concept is, we move these widgets out of FW space, and compile them with external apps. To all separately. This is multiple include, but since we compile the widget under different namespaces (and those namespaces will be under the external_app namespace) these all will be removed from the base firmware.
|
||||
|
||||
This way we can free up some spaces, and still reuse the same widgets in different apps easily.
|
||||
|
||||
## How to create external widget
|
||||
|
||||
You create a **hpp** file indet the ui/external folder, and include everything you need for your widget as you normally wanted to do.
|
||||
**Don't forget the ifdef guards!**
|
||||
**Never use any namespace for your class there!** The namespace of the actual ext app will be used where you include this.
|
||||
|
||||
Then create a **cpi** file, where you include your hpp file, and create the implementation of your widget class. Still, don't use namespace.
|
||||
|
||||
You won't need to include these files in any cmake file! (see usage, why)
|
||||
|
||||
## How to use these widgets
|
||||
|
||||
This is important, so follow the rules carefully. If it works, doesn't mean, you did it good!
|
||||
In your external app's hpp file, you need to include the widget's hpp file.
|
||||
**But be careful**, you must include it under the ext app's namespace, before your first class. For examlpe:
|
||||
|
||||
namespace ui::external_app::gfxeq {
|
||||
#include "external/ui_grapheq.hpp"
|
||||
class gfxEQView : public View {
|
||||
Then you must include the cpi file in the external app's cpp file. Again, it must be under the ext app's namespace!
|
||||
|
||||
using namespace portapack;
|
||||
namespace ui::external_app::gfxeq {
|
||||
#include "external/ui_grapheq.cpi"
|
||||
gfxEQView::gfxEQView(NavigationView& nav)
|
||||
|
||||
This must be done under each ext app that uses the same widget.
|
||||
This way, the widget will be compiled multiple times under the external_app namespace, but those will be removed from the base. Each app will be able to use it, easy to handle, easy to create.
|
221
firmware/application/ui/external/ui_grapheq.cpi
vendored
Normal file
221
firmware/application/ui/external/ui_grapheq.cpi
vendored
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright (C) 2025 RocketGod
|
||||
* Copyright (C) 2025 HTotoo
|
||||
*
|
||||
* 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_grapheq.hpp"
|
||||
|
||||
/* GraphEq *************************************************************/
|
||||
|
||||
GraphEq::GraphEq(
|
||||
Rect parent_rect,
|
||||
bool clickable)
|
||||
: Widget{parent_rect},
|
||||
clickable_{clickable},
|
||||
bar_heights(NUM_BARS, 0),
|
||||
prev_bar_heights(NUM_BARS, 0) {
|
||||
if (clickable) {
|
||||
set_focusable(true);
|
||||
// previous_data.resize(length_, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEq::set_parent_rect(const Rect new_parent_rect) {
|
||||
Widget::set_parent_rect(new_parent_rect);
|
||||
calculate_params();
|
||||
}
|
||||
|
||||
void GraphEq::calculate_params() {
|
||||
y_top = screen_rect().top();
|
||||
RENDER_HEIGHT = parent_rect().height();
|
||||
BAR_WIDTH = (parent_rect().width() - (BAR_SPACING * (NUM_BARS - 1))) / NUM_BARS;
|
||||
HORIZONTAL_OFFSET = screen_rect().left();
|
||||
}
|
||||
|
||||
bool GraphEq::is_paused() const {
|
||||
return paused_;
|
||||
}
|
||||
|
||||
void GraphEq::set_paused(bool paused) {
|
||||
paused_ = paused;
|
||||
needs_background_redraw = true;
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
bool GraphEq::is_clickable() const {
|
||||
return clickable_;
|
||||
}
|
||||
|
||||
void GraphEq::getAccessibilityText(std::string& result) {
|
||||
result = paused_ ? "paused GraphEq" : "GraphEq";
|
||||
}
|
||||
|
||||
void GraphEq::getWidgetName(std::string& result) {
|
||||
result = "GraphEq";
|
||||
}
|
||||
|
||||
bool GraphEq::on_key(const KeyEvent key) {
|
||||
if (!clickable_) return false;
|
||||
|
||||
if (key == KeyEvent::Select) {
|
||||
set_paused(!paused_);
|
||||
if (on_select) {
|
||||
on_select(*this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GraphEq::on_keyboard(const KeyboardEvent key) {
|
||||
if (!clickable_) return false;
|
||||
|
||||
if (key == 32 || key == 10) {
|
||||
set_paused(!paused_);
|
||||
if (on_select) {
|
||||
on_select(*this);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GraphEq::on_touch(const TouchEvent event) {
|
||||
if (!clickable_) return false;
|
||||
|
||||
switch (event.type) {
|
||||
case TouchEvent::Type::Start:
|
||||
focus();
|
||||
return true;
|
||||
|
||||
case TouchEvent::Type::End:
|
||||
set_paused(!paused_);
|
||||
if (on_select) {
|
||||
on_select(*this);
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void GraphEq::set_theme(Color base_color_, Color peak_color_) {
|
||||
base_color = base_color_;
|
||||
peak_color = peak_color_;
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void GraphEq::update_audio_spectrum(const AudioSpectrum& spectrum) {
|
||||
const float bin_frequency_size = 48000.0f / 128;
|
||||
|
||||
for (int bar = 0; bar < NUM_BARS; bar++) {
|
||||
float start_freq = FREQUENCY_BANDS[bar];
|
||||
float end_freq = FREQUENCY_BANDS[bar + 1];
|
||||
|
||||
int start_bin = std::max(1, (int)(start_freq / bin_frequency_size));
|
||||
int end_bin = std::min(127, (int)(end_freq / bin_frequency_size));
|
||||
|
||||
if (start_bin >= end_bin) {
|
||||
end_bin = start_bin + 1;
|
||||
}
|
||||
|
||||
float total_energy = 0;
|
||||
int bin_count = 0;
|
||||
|
||||
for (int bin = start_bin; bin <= end_bin; bin++) {
|
||||
total_energy += spectrum.db[bin];
|
||||
bin_count++;
|
||||
}
|
||||
|
||||
float avg_db = bin_count > 0 ? (total_energy / bin_count) : 0;
|
||||
|
||||
// Manually boost highs for better visual balance
|
||||
float treble_boost = 1.0f;
|
||||
if (bar == 10)
|
||||
treble_boost = 1.7f;
|
||||
else if (bar >= 9)
|
||||
treble_boost = 1.3f;
|
||||
else if (bar >= 7)
|
||||
treble_boost = 1.3f;
|
||||
|
||||
// Mid emphasis for a V-shape effect
|
||||
float mid_boost = 1.0f;
|
||||
if (bar == 4 || bar == 5 || bar == 6) mid_boost = 1.2f;
|
||||
|
||||
float amplified_db = avg_db * treble_boost * mid_boost;
|
||||
|
||||
if (amplified_db > 255) amplified_db = 255;
|
||||
|
||||
float band_scale = 1.0f;
|
||||
int target_height = (amplified_db * RENDER_HEIGHT * band_scale) / 255;
|
||||
|
||||
if (target_height > RENDER_HEIGHT) {
|
||||
target_height = RENDER_HEIGHT;
|
||||
}
|
||||
|
||||
// Adjusted to look nice to my eyes
|
||||
float rise_speed = 0.8f;
|
||||
float fall_speed = 1.0f;
|
||||
|
||||
if (target_height > bar_heights[bar]) {
|
||||
bar_heights[bar] = bar_heights[bar] * (1.0f - rise_speed) + target_height * rise_speed;
|
||||
} else {
|
||||
bar_heights[bar] = bar_heights[bar] * (1.0f - fall_speed) + target_height * fall_speed;
|
||||
}
|
||||
}
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void GraphEq::paint(Painter& painter) {
|
||||
if (!visible()) return;
|
||||
if (!is_calculated) { // calc positions first
|
||||
calculate_params();
|
||||
is_calculated = true;
|
||||
}
|
||||
if (needs_background_redraw) {
|
||||
painter.fill_rectangle(screen_rect(), Theme::getInstance()->bg_darkest->background);
|
||||
needs_background_redraw = false;
|
||||
}
|
||||
if (paused_) {
|
||||
return;
|
||||
}
|
||||
const int num_segments = RENDER_HEIGHT / SEGMENT_HEIGHT;
|
||||
uint16_t bottom = screen_rect().bottom();
|
||||
for (int bar = 0; bar < NUM_BARS; bar++) {
|
||||
int x = HORIZONTAL_OFFSET + bar * (BAR_WIDTH + BAR_SPACING);
|
||||
int active_segments = (bar_heights[bar] * num_segments) / RENDER_HEIGHT;
|
||||
|
||||
if (prev_bar_heights[bar] > active_segments) {
|
||||
int clear_height = (prev_bar_heights[bar] - active_segments) * SEGMENT_HEIGHT;
|
||||
int clear_y = bottom - prev_bar_heights[bar] * SEGMENT_HEIGHT;
|
||||
painter.fill_rectangle({x, clear_y, BAR_WIDTH, clear_height}, Theme::getInstance()->bg_darkest->background);
|
||||
}
|
||||
|
||||
for (int seg = 0; seg < active_segments; seg++) {
|
||||
int y = bottom - (seg + 1) * SEGMENT_HEIGHT;
|
||||
if (y < y_top) break;
|
||||
|
||||
Color segment_color = (seg >= active_segments - 2 && seg < active_segments) ? peak_color : base_color;
|
||||
painter.fill_rectangle({x, y, BAR_WIDTH, SEGMENT_HEIGHT - 1}, segment_color);
|
||||
}
|
||||
prev_bar_heights[bar] = active_segments;
|
||||
}
|
||||
}
|
88
firmware/application/ui/external/ui_grapheq.hpp
vendored
Normal file
88
firmware/application/ui/external/ui_grapheq.hpp
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2025 RocketGod
|
||||
* Copyright (C) 2025 HTotoo
|
||||
*
|
||||
* 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_GRAPHEQ_H__
|
||||
#define __UI_GRAPHEQ_H__
|
||||
|
||||
#include "ui_widget.hpp"
|
||||
|
||||
class GraphEq : public Widget {
|
||||
public:
|
||||
std::function<void(GraphEq&)> on_select{};
|
||||
|
||||
GraphEq(Rect parent_rect, bool clickable = false);
|
||||
GraphEq(const GraphEq&) = delete;
|
||||
GraphEq(GraphEq&&) = delete;
|
||||
GraphEq& operator=(const GraphEq&) = delete;
|
||||
GraphEq& operator=(GraphEq&&) = delete;
|
||||
|
||||
bool is_paused() const;
|
||||
void set_paused(bool paused);
|
||||
bool is_clickable() const;
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
bool on_key(const KeyEvent key) override;
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
bool on_keyboard(const KeyboardEvent event) override;
|
||||
void set_parent_rect(const Rect new_parent_rect) override;
|
||||
|
||||
void getAccessibilityText(std::string& result) override;
|
||||
void getWidgetName(std::string& result) override;
|
||||
void update_audio_spectrum(const AudioSpectrum& spectrum);
|
||||
void set_theme(Color base_color, Color peak_color);
|
||||
|
||||
private:
|
||||
bool is_calculated{false};
|
||||
bool paused_{false};
|
||||
bool clickable_{false};
|
||||
bool needs_background_redraw{true}; // Redraw background only when needed.
|
||||
Color base_color = Color(255, 0, 255);
|
||||
Color peak_color = Color(255, 255, 255);
|
||||
std::vector<ui::Dim> bar_heights;
|
||||
std::vector<ui::Dim> prev_bar_heights;
|
||||
|
||||
ui::Dim y_top = 2 * 16;
|
||||
ui::Dim RENDER_HEIGHT = 288;
|
||||
ui::Dim BAR_WIDTH = 20;
|
||||
ui::Dim HORIZONTAL_OFFSET = 2;
|
||||
static const int NUM_BARS = 11;
|
||||
static const int BAR_SPACING = 2;
|
||||
static const int SEGMENT_HEIGHT = 10;
|
||||
static constexpr std::array<int16_t, NUM_BARS + 1> FREQUENCY_BANDS = {
|
||||
375, // Bass warmth and low rumble (e.g., deep basslines, kick drum body)
|
||||
750, // Upper bass punch (e.g., bass guitar punch, kick drum attack)
|
||||
1500, // Lower midrange fullness (e.g., warmth in vocals, guitar body)
|
||||
2250, // Midrange clarity (e.g., vocal presence, snare crack)
|
||||
3375, // Upper midrange bite (e.g., instrument definition, vocal articulation)
|
||||
4875, // Presence and edge (e.g., guitar bite, vocal sibilance start)
|
||||
6750, // Lower brilliance (e.g., cymbal shimmer, vocal clarity)
|
||||
9375, // Brilliance and air (e.g., hi-hat crispness, breathy vocals)
|
||||
13125, // High treble sparkle (e.g., subtle overtones, synth shimmer)
|
||||
16875, // Upper treble airiness (e.g., faint harmonics, room ambiance)
|
||||
20625, // Top-end sheen (e.g., ultra-high harmonics, noise floor)
|
||||
24375 // Extreme treble limit (e.g., inaudible overtones, signal cutoff, static)
|
||||
};
|
||||
|
||||
void calculate_params(); // re calculate some parameters based on parent_rect()
|
||||
};
|
||||
|
||||
#endif /*__UI_GRAPHEQ_H__*/
|
@@ -32,7 +32,8 @@ namespace ui {
|
||||
AlphanumView::AlphanumView(
|
||||
NavigationView& nav,
|
||||
std::string& str,
|
||||
size_t max_length)
|
||||
size_t max_length,
|
||||
uint8_t enter_mode)
|
||||
: TextEntryView(nav, str, max_length) {
|
||||
size_t n;
|
||||
|
||||
@@ -76,7 +77,7 @@ AlphanumView::AlphanumView(
|
||||
n++;
|
||||
}
|
||||
|
||||
set_mode(mode);
|
||||
set_mode(enter_mode);
|
||||
|
||||
button_mode.on_select = [this](Button&) {
|
||||
set_mode(mode + 1);
|
||||
|
@@ -37,7 +37,7 @@ namespace ui {
|
||||
|
||||
class AlphanumView : public TextEntryView {
|
||||
public:
|
||||
AlphanumView(NavigationView& nav, std::string& str, size_t max_length);
|
||||
AlphanumView(NavigationView& nav, std::string& str, size_t max_length, uint8_t enter_mode);
|
||||
|
||||
AlphanumView(const AlphanumView&) = delete;
|
||||
AlphanumView(AlphanumView&&) = delete;
|
||||
|
@@ -38,17 +38,31 @@ BtnGridView::BtnGridView(
|
||||
set_parent_rect(new_parent_rect);
|
||||
set_focusable(true);
|
||||
|
||||
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
|
||||
this->on_tick_second();
|
||||
button_pgup.set_focusable(false);
|
||||
button_pgup.on_select = [this](Button&) {
|
||||
if (arrow_up_enabled) {
|
||||
if (((int64_t)highlighted_item - displayed_max) > 0)
|
||||
set_highlighted(highlighted_item - displayed_max);
|
||||
else
|
||||
set_highlighted(0);
|
||||
}
|
||||
};
|
||||
|
||||
add_child(&arrow_more);
|
||||
arrow_more.set_focusable(false);
|
||||
arrow_more.set_foreground(Theme::getInstance()->bg_darkest->background);
|
||||
button_pgdown.set_focusable(false);
|
||||
button_pgdown.on_select = [this](Button&) {
|
||||
if (arrow_down_enabled) {
|
||||
set_highlighted(highlighted_item + displayed_max);
|
||||
}
|
||||
};
|
||||
|
||||
button_pgup.set_style(Theme::getInstance()->bg_darkest_small);
|
||||
button_pgdown.set_style(Theme::getInstance()->bg_darkest_small);
|
||||
|
||||
add_child(&button_pgup);
|
||||
add_child(&button_pgdown);
|
||||
}
|
||||
|
||||
BtnGridView::~BtnGridView() {
|
||||
rtc_time::signal_tick_second -= signal_token_tick_second;
|
||||
}
|
||||
|
||||
void BtnGridView::set_max_rows(int rows) {
|
||||
@@ -62,8 +76,31 @@ int BtnGridView::rows() {
|
||||
void BtnGridView::set_parent_rect(const Rect new_parent_rect) {
|
||||
View::set_parent_rect(new_parent_rect);
|
||||
|
||||
button_h = 48; // btn_h_min;
|
||||
/*
|
||||
// DISABLED FOR NOW. TODO fix next, prev button pos
|
||||
int min_remainder = parent_rect().size().height();
|
||||
uint8_t max_button_count = 0;
|
||||
|
||||
for (int h = btn_h_min; h <= btn_h_max; ++h) {
|
||||
int count = parent_rect().size().height() / h;
|
||||
int remainder = parent_rect().size().height() % h;
|
||||
|
||||
// Prefer smaller remainder, then more buttons, then larger height
|
||||
if (remainder < min_remainder ||
|
||||
(remainder == min_remainder && count > max_button_count) ||
|
||||
(remainder == min_remainder && count == max_button_count && h > button_h)) {
|
||||
button_h = h;
|
||||
min_remainder = remainder;
|
||||
max_button_count = count;
|
||||
}
|
||||
}
|
||||
*/
|
||||
displayed_max = (parent_rect().size().height() / button_h);
|
||||
arrow_more.set_parent_rect({228, (Coord)(displayed_max * button_h), 8, 8});
|
||||
|
||||
button_pgup.set_parent_rect({0, (Coord)(displayed_max * button_h), screen_width / 2, 16});
|
||||
button_pgdown.set_parent_rect({screen_width / 2, (Coord)(displayed_max * button_h), screen_width / 2, 16});
|
||||
|
||||
displayed_max *= rows_;
|
||||
|
||||
// Delete any existing buttons.
|
||||
@@ -84,28 +121,40 @@ void BtnGridView::set_parent_rect(const Rect new_parent_rect) {
|
||||
|
||||
menu_item_views.push_back(std::move(item));
|
||||
}
|
||||
|
||||
update_items();
|
||||
}
|
||||
|
||||
void BtnGridView::set_arrow_enabled(bool enabled) {
|
||||
void BtnGridView::set_arrow_up_enabled(bool enabled) {
|
||||
if (!show_arrows)
|
||||
return;
|
||||
if (enabled) {
|
||||
add_child(&arrow_more);
|
||||
} else {
|
||||
remove_child(&arrow_more);
|
||||
if (!arrow_up_enabled) {
|
||||
arrow_up_enabled = true;
|
||||
button_pgup.set_text("< PREV");
|
||||
}
|
||||
} else if (!enabled) {
|
||||
if (arrow_up_enabled) {
|
||||
arrow_up_enabled = false;
|
||||
button_pgup.set_text(" ");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void BtnGridView::on_tick_second() {
|
||||
if (more && blink)
|
||||
arrow_more.set_foreground(Theme::getInstance()->bg_darkest->foreground);
|
||||
else
|
||||
arrow_more.set_foreground(Theme::getInstance()->bg_darkest->background);
|
||||
|
||||
blink = !blink;
|
||||
|
||||
arrow_more.set_dirty();
|
||||
}
|
||||
void BtnGridView::set_arrow_down_enabled(bool enabled) {
|
||||
if (!show_arrows)
|
||||
return;
|
||||
if (enabled) {
|
||||
if (!arrow_down_enabled) {
|
||||
arrow_down_enabled = true;
|
||||
button_pgdown.set_text("NEXT >");
|
||||
}
|
||||
} else if (!enabled) {
|
||||
if (arrow_down_enabled) {
|
||||
arrow_down_enabled = false;
|
||||
button_pgdown.set_text(" ");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void BtnGridView::clear() {
|
||||
// clear vector and release memory, not using swap since it's causing capture to glitch/fault
|
||||
@@ -153,15 +202,23 @@ void BtnGridView::insert_item(const GridItem& new_item, size_t position, bool in
|
||||
}
|
||||
}
|
||||
|
||||
void BtnGridView::show_hide_arrows() {
|
||||
if (highlighted_item == 0) {
|
||||
set_arrow_up_enabled(false);
|
||||
} else {
|
||||
set_arrow_up_enabled(true);
|
||||
}
|
||||
if (highlighted_item == (menu_items.size() - 1)) {
|
||||
set_arrow_down_enabled(false);
|
||||
} else {
|
||||
set_arrow_down_enabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void BtnGridView::update_items() {
|
||||
size_t i = 0;
|
||||
Color bg_color = portapack::persistent_memory::menu_color();
|
||||
|
||||
if ((menu_items.size()) > (displayed_max + offset)) {
|
||||
more = true;
|
||||
blink = true;
|
||||
} else
|
||||
more = false;
|
||||
Color bg_color = portapack::persistent_memory::menu_color();
|
||||
|
||||
for (auto& item : menu_item_views) {
|
||||
if ((i + offset) >= menu_items.size()) {
|
||||
@@ -189,14 +246,23 @@ NewButton* BtnGridView::item_view(size_t index) const {
|
||||
return menu_item_views[index].get();
|
||||
}
|
||||
|
||||
void BtnGridView::show_arrows_enabled(bool enabled) {
|
||||
show_arrows = enabled;
|
||||
if (!enabled) {
|
||||
remove_child(&button_pgup);
|
||||
remove_child(&button_pgdown);
|
||||
}
|
||||
}
|
||||
|
||||
bool BtnGridView::set_highlighted(int32_t new_value) {
|
||||
int32_t item_count = (int32_t)menu_items.size();
|
||||
|
||||
if (new_value < 0)
|
||||
return false;
|
||||
|
||||
if (new_value >= item_count)
|
||||
if (new_value >= item_count) {
|
||||
new_value = item_count - 1;
|
||||
}
|
||||
|
||||
if (((uint32_t)new_value > offset) && ((new_value - offset) >= displayed_max)) {
|
||||
// Shift BtnGridView up
|
||||
@@ -222,6 +288,8 @@ bool BtnGridView::set_highlighted(int32_t new_value) {
|
||||
if (visible())
|
||||
item_view(highlighted_item - offset)->focus();
|
||||
|
||||
show_hide_arrows();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -235,21 +303,22 @@ void BtnGridView::on_focus() {
|
||||
|
||||
void BtnGridView::on_blur() {
|
||||
#if 0
|
||||
if (!keep_highlight)
|
||||
item_view(highlighted_item - offset)->unhighlight();
|
||||
if (!keep_highlight)
|
||||
item_view(highlighted_item - offset)->unhighlight();
|
||||
#endif
|
||||
}
|
||||
|
||||
void BtnGridView::on_show() {
|
||||
on_populate();
|
||||
|
||||
View::on_show();
|
||||
set_highlighted(highlighted_item);
|
||||
}
|
||||
|
||||
void BtnGridView::on_hide() {
|
||||
View::on_hide();
|
||||
|
||||
clear();
|
||||
set_arrow_up_enabled(false);
|
||||
set_arrow_down_enabled(false);
|
||||
}
|
||||
|
||||
bool BtnGridView::on_key(const KeyEvent key) {
|
||||
|
@@ -55,7 +55,7 @@ void load_blacklist();
|
||||
|
||||
class BtnGridView : public View {
|
||||
public:
|
||||
BtnGridView(Rect new_parent_rect = {0, 0, 240, 304}, bool keep_highlight = false);
|
||||
BtnGridView(Rect new_parent_rect = {0, 0, screen_width, screen_height - 16}, bool keep_highlight = false);
|
||||
|
||||
~BtnGridView();
|
||||
|
||||
@@ -68,11 +68,18 @@ class BtnGridView : public View {
|
||||
|
||||
NewButton* item_view(size_t index) const;
|
||||
|
||||
bool show_arrows{true}; // flag used to hide arrows in main menu
|
||||
void show_arrows_enabled(bool enabled);
|
||||
|
||||
bool set_highlighted(int32_t new_value);
|
||||
uint32_t highlighted_index();
|
||||
|
||||
void set_parent_rect(const Rect new_parent_rect) override;
|
||||
void set_arrow_enabled(bool enabled);
|
||||
bool arrow_up_enabled{false};
|
||||
bool arrow_down_enabled{false};
|
||||
void set_arrow_up_enabled(bool enabled);
|
||||
void set_arrow_down_enabled(bool enabled);
|
||||
void show_hide_arrows();
|
||||
void on_focus() override;
|
||||
void on_blur() override;
|
||||
void on_show() override;
|
||||
@@ -82,30 +89,33 @@ class BtnGridView : public View {
|
||||
bool blacklisted_app(GridItem new_item);
|
||||
|
||||
void update_items();
|
||||
void set_btn_min_max_height(uint8_t min, uint8_t max) {
|
||||
btn_h_min = min;
|
||||
btn_h_max = max;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void on_populate() = 0;
|
||||
|
||||
private:
|
||||
int rows_{3};
|
||||
void on_tick_second();
|
||||
|
||||
uint8_t btn_h_min{40};
|
||||
uint8_t btn_h_max{60};
|
||||
bool keep_highlight{false};
|
||||
|
||||
SignalToken signal_token_tick_second{};
|
||||
std::vector<GridItem> menu_items{};
|
||||
std::vector<std::unique_ptr<NewButton>> menu_item_views{};
|
||||
|
||||
Image arrow_more{
|
||||
{228, 320 - 8, 8, 8},
|
||||
&bitmap_more,
|
||||
Theme::getInstance()->bg_darkest->foreground,
|
||||
Theme::getInstance()->bg_darkest->background};
|
||||
Button button_pgup{
|
||||
{0, 1324, 120, 16},
|
||||
" "};
|
||||
|
||||
int button_w = 240 / rows_;
|
||||
static constexpr int button_h = 48;
|
||||
bool blink = false;
|
||||
bool more = false;
|
||||
Button button_pgdown{
|
||||
{121, 1324, 119, 16},
|
||||
" "};
|
||||
|
||||
int button_w = screen_width / rows_;
|
||||
int button_h = 48;
|
||||
size_t displayed_max{0};
|
||||
size_t highlighted_item{0};
|
||||
size_t offset{0};
|
||||
|
@@ -53,13 +53,21 @@ class BoundFrequencyField : public FrequencyField {
|
||||
};
|
||||
|
||||
on_edit = [this, &nav]() {
|
||||
if (on_edit_shown)
|
||||
on_edit_shown();
|
||||
auto freq_view = nav.push<FrequencyKeypadView>(model->target_frequency());
|
||||
freq_view->on_changed = [this](rf::Frequency f) {
|
||||
set_value(f);
|
||||
};
|
||||
nav.set_on_pop([this]() {
|
||||
if (on_edit_hidden)
|
||||
on_edit_hidden();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
std::function<void(void)> on_edit_shown{}; // fired, when the FrequencyKeypadView pops up
|
||||
std::function<void(void)> on_edit_hidden{}; // fired, when the FrequencyKeypadView ended
|
||||
// TODO: override set_step and update the rx model then call base.
|
||||
};
|
||||
|
||||
|
@@ -42,7 +42,7 @@ GeoPos::GeoPos(
|
||||
const alt_unit altitude_unit,
|
||||
const spd_unit speed_unit)
|
||||
: altitude_unit_(altitude_unit), speed_unit_(speed_unit) {
|
||||
set_parent_rect({pos, {30 * 8, 3 * 16}});
|
||||
set_parent_rect({pos, {screen_width, 3 * 16}});
|
||||
|
||||
add_children({&labels_position,
|
||||
&label_spd_position,
|
||||
@@ -110,6 +110,7 @@ GeoPos::GeoPos(
|
||||
text_alt_unit.set(altitude_unit_ ? "m" : "ft");
|
||||
if (speed_unit_ == KMPH) text_speed_unit.set("kmph");
|
||||
if (speed_unit_ == MPH) text_speed_unit.set("mph");
|
||||
if (speed_unit_ == KNOTS) text_speed_unit.set("knots");
|
||||
if (speed_unit_ == HIDDEN) {
|
||||
text_speed_unit.hidden(true);
|
||||
label_spd_position.hidden(true);
|
||||
|
@@ -81,6 +81,7 @@ class GeoPos : public View {
|
||||
NONE = 0,
|
||||
MPH,
|
||||
KMPH,
|
||||
KNOTS,
|
||||
HIDDEN = 255
|
||||
};
|
||||
|
||||
@@ -134,7 +135,7 @@ class GeoPos : public View {
|
||||
{12 * 8, 0 * 16, 2 * 8, 16},
|
||||
""};
|
||||
Text text_speed_unit{
|
||||
{25 * 8, 0 * 16, 4 * 8, 16},
|
||||
{25 * 8, 0 * 16, 5 * 8, 16},
|
||||
""};
|
||||
|
||||
NumberField field_lat_degrees{
|
||||
|
@@ -29,6 +29,7 @@
|
||||
|
||||
#include "irq_controls.hpp"
|
||||
#include "rf_path.hpp"
|
||||
#include "freqman_db.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -37,6 +38,10 @@
|
||||
|
||||
#define MAX_UFREQ 7200000000 // maximum usable frequency
|
||||
|
||||
using option_db_t = std::pair<std::string_view, int32_t>;
|
||||
using options_db_t = std::vector<option_db_t>;
|
||||
extern options_db_t freqman_steps;
|
||||
|
||||
namespace ui {
|
||||
|
||||
class FrequencyField : public Widget {
|
||||
@@ -221,7 +226,7 @@ class FrequencyKeypadView : public View {
|
||||
static constexpr int text_digits = mhz_digits + 1 + submhz_digits;
|
||||
|
||||
Text text_value{
|
||||
{0, 4, 240, 16}};
|
||||
{0, 4, screen_width, 16}};
|
||||
|
||||
std::array<Button, 12> buttons{};
|
||||
|
||||
@@ -263,22 +268,12 @@ class FrequencyStepView : public OptionsField {
|
||||
: OptionsField{
|
||||
parent_pos,
|
||||
5,
|
||||
{
|
||||
{" 10", 10}, /* Fine tuning SSB voice pitch,in HF and QO-100 sat #669 */
|
||||
{" 50", 50}, /* added 50Hz/10Hz,but we do not increase GUI digit decimal */
|
||||
{" 100", 100},
|
||||
{" 1k ", 1000},
|
||||
{" 3k ", 3000}, /* Approximate SSB bandwidth */
|
||||
{" 5k ", 5000},
|
||||
{" 6k3", 6250},
|
||||
{" 9k ", 9000}, /* channel spacing for LF, MF in some regions */
|
||||
{" 10k ", 10000},
|
||||
{" 12k5", 12500},
|
||||
{" 25k ", 25000},
|
||||
{"100k ", 100000},
|
||||
{" 1M ", 1000000},
|
||||
{" 10M ", 10000000},
|
||||
}} {
|
||||
{}} {
|
||||
options_t options;
|
||||
for (const auto& step : freqman_steps) {
|
||||
options.emplace_back(step.first, step.second);
|
||||
}
|
||||
set_options(options);
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyleft Mr. Robot 2025
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
@@ -21,8 +22,6 @@
|
||||
|
||||
#include "ui_spectrum.hpp"
|
||||
|
||||
#include "spectrum_color_lut.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
using namespace portapack;
|
||||
|
||||
@@ -102,6 +101,15 @@ void FrequencyScale::set_channel_filter(
|
||||
}
|
||||
}
|
||||
|
||||
void FrequencyScale::set_cursor_position(const int32_t position) {
|
||||
cursor_position = position;
|
||||
|
||||
cursor_position = std::min<int32_t>(cursor_position, 119);
|
||||
cursor_position = std::max<int32_t>(cursor_position, -120);
|
||||
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void FrequencyScale::paint(Painter& painter) {
|
||||
const auto r = screen_rect();
|
||||
|
||||
@@ -115,14 +123,12 @@ void FrequencyScale::paint(Painter& painter) {
|
||||
draw_filter_ranges(painter, r);
|
||||
draw_frequency_ticks(painter, r);
|
||||
|
||||
if (_blink) {
|
||||
const Rect r_cursor{
|
||||
118 + cursor_position, r.bottom() - filter_band_height,
|
||||
5, filter_band_height};
|
||||
painter.fill_rectangle(
|
||||
r_cursor,
|
||||
Color::red());
|
||||
}
|
||||
const Rect r_cursor{
|
||||
118 + cursor_position, r.bottom() - filter_band_height,
|
||||
5, filter_band_height};
|
||||
painter.fill_rectangle(
|
||||
r_cursor,
|
||||
Color::red());
|
||||
}
|
||||
|
||||
void FrequencyScale::clear() {
|
||||
@@ -206,16 +212,10 @@ void FrequencyScale::draw_filter_ranges(Painter& painter, const Rect r) {
|
||||
}
|
||||
|
||||
void FrequencyScale::on_focus() {
|
||||
_blink = true;
|
||||
on_tick_second();
|
||||
signal_token_tick_second = rtc_time::signal_tick_second += [this]() {
|
||||
this->on_tick_second();
|
||||
};
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
void FrequencyScale::on_blur() {
|
||||
rtc_time::signal_tick_second -= signal_token_tick_second;
|
||||
_blink = false;
|
||||
set_dirty();
|
||||
}
|
||||
|
||||
@@ -235,6 +235,7 @@ bool FrequencyScale::on_key(const KeyEvent key) {
|
||||
if (on_select) {
|
||||
on_select((cursor_position * spectrum_sampling_rate) / 240);
|
||||
cursor_position = 0;
|
||||
set_dirty();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -242,9 +243,13 @@ bool FrequencyScale::on_key(const KeyEvent key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void FrequencyScale::on_tick_second() {
|
||||
set_dirty();
|
||||
_blink = !_blink;
|
||||
bool FrequencyScale::on_touch(const TouchEvent touch) {
|
||||
if (touch.type == TouchEvent::Type::Start) {
|
||||
if (on_select) {
|
||||
on_select((touch.point.x() * spectrum_sampling_rate) / 240);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* WaterfallWidget *********************************************************/
|
||||
@@ -271,12 +276,12 @@ void WaterfallWidget::on_channel_spectrum(
|
||||
|
||||
std::array<Color, 240> pixel_row;
|
||||
for (size_t i = 0; i < 120; i++) {
|
||||
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[256 - 120 + i]];
|
||||
const auto pixel_color = gradient.lut[spectrum.db[256 - 120 + i]];
|
||||
pixel_row[i] = pixel_color;
|
||||
}
|
||||
|
||||
for (size_t i = 120; i < 240; i++) {
|
||||
const auto pixel_color = spectrum_rgb3_lut[spectrum.db[i - 120]];
|
||||
const auto pixel_color = gradient.lut[spectrum.db[i - 120]];
|
||||
pixel_row[i] = pixel_color;
|
||||
}
|
||||
|
||||
@@ -287,6 +292,15 @@ void WaterfallWidget::on_channel_spectrum(
|
||||
pixel_row);
|
||||
}
|
||||
|
||||
bool WaterfallWidget::on_touch(const TouchEvent event) {
|
||||
if (event.type == TouchEvent::Type::Start) {
|
||||
if (on_touch_select) {
|
||||
on_touch_select(event.point.x(), event.point.y());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void WaterfallWidget::clear() {
|
||||
display.fill_rectangle(
|
||||
screen_rect(),
|
||||
@@ -305,6 +319,22 @@ WaterfallView::WaterfallView(const bool cursor) {
|
||||
frequency_scale.on_select = [this](int32_t offset) {
|
||||
if (on_select) on_select(offset);
|
||||
};
|
||||
|
||||
waterfall_widget.on_touch_select = [this](int32_t x, int32_t y) {
|
||||
if (y > screen_height - screen_height * 0.1) return; // prevent ghost touch
|
||||
|
||||
frequency_scale.focus(); // focus on frequency scale to show cursor
|
||||
|
||||
if (sampling_rate) {
|
||||
// screen x to frequency scale x, NB we need two widgets align
|
||||
int32_t cursor_position = x - (screen_width / 2);
|
||||
frequency_scale.set_cursor_position(cursor_position);
|
||||
}
|
||||
};
|
||||
|
||||
if (!waterfall_widget.gradient.load_file(default_gradient_file)) {
|
||||
waterfall_widget.gradient.set_default();
|
||||
}
|
||||
}
|
||||
|
||||
void WaterfallView::on_show() {
|
||||
|
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyleft Mr. Robot 2025
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
@@ -24,6 +25,7 @@
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "ui_widget.hpp"
|
||||
#include "gradient.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
@@ -59,12 +61,13 @@ class AudioSpectrumView : public View {
|
||||
' '};
|
||||
|
||||
Waveform waveform{
|
||||
{0, 1 * 16 + cursor_band_height, 30 * 8, 2 * 16},
|
||||
{0, 1 * 16 + cursor_band_height, screen_width, 2 * 16},
|
||||
audio_spectrum,
|
||||
128,
|
||||
0,
|
||||
false,
|
||||
Theme::getInstance()->bg_darkest->foreground};
|
||||
Theme::getInstance()->bg_darkest->foreground,
|
||||
true};
|
||||
};
|
||||
|
||||
class FrequencyScale : public Widget {
|
||||
@@ -77,20 +80,18 @@ class FrequencyScale : public Widget {
|
||||
|
||||
bool on_encoder(const EncoderEvent delta) override;
|
||||
bool on_key(const KeyEvent key) override;
|
||||
bool on_touch(const TouchEvent touch) override;
|
||||
|
||||
void set_spectrum_sampling_rate(const int new_sampling_rate);
|
||||
void set_channel_filter(const int low_frequency, const int high_frequency, const int transition);
|
||||
void set_cursor_position(const int32_t position);
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
private:
|
||||
static constexpr int filter_band_height = 4;
|
||||
|
||||
void on_tick_second();
|
||||
|
||||
bool _blink{false};
|
||||
int32_t cursor_position{0};
|
||||
SignalToken signal_token_tick_second{};
|
||||
int spectrum_sampling_rate{0};
|
||||
const int spectrum_bins = std::tuple_size<decltype(ChannelSpectrum::db)>::value;
|
||||
int channel_filter_low_frequency{0};
|
||||
@@ -110,9 +111,14 @@ class FrequencyScale : public Widget {
|
||||
|
||||
class WaterfallWidget : public Widget {
|
||||
public:
|
||||
std::function<void(int32_t offset, int32_t y)> on_touch_select{};
|
||||
|
||||
Gradient gradient{};
|
||||
|
||||
void on_show() override;
|
||||
void on_hide() override;
|
||||
void paint(Painter&) override {}
|
||||
bool on_touch(const TouchEvent event) override;
|
||||
|
||||
void on_channel_spectrum(const ChannelSpectrum& spectrum);
|
||||
|
||||
@@ -144,7 +150,7 @@ class WaterfallView : public View {
|
||||
private:
|
||||
void update_widgets_rect();
|
||||
|
||||
const Rect audio_spectrum_view_rect{0 * 8, 0 * 16, 30 * 8, 2 * 16 + 20};
|
||||
const Rect audio_spectrum_view_rect{0 * 8, 0 * 16, screen_width, 2 * 16 + 20};
|
||||
static constexpr Dim audio_spectrum_height = 16 * 2 + 20;
|
||||
static constexpr Dim scale_height = 20;
|
||||
|
||||
|
@@ -135,9 +135,9 @@ TabView::TabView(std::initializer_list<TabDef> tab_definitions) {
|
||||
if (n_tabs > MAX_TABS)
|
||||
n_tabs = MAX_TABS;
|
||||
|
||||
size_t tab_width = 240 / n_tabs;
|
||||
size_t tab_width = screen_width / n_tabs;
|
||||
|
||||
set_parent_rect({0, 0, 30 * 8, 3 * 8});
|
||||
set_parent_rect({0, 0, screen_width, 3 * 8});
|
||||
|
||||
for (auto& tab_definition : tab_definitions) {
|
||||
tabs[i].set(i, tab_width, tab_definition.text, tab_definition.color);
|
||||
|
@@ -31,8 +31,9 @@ void text_prompt(
|
||||
NavigationView& nav,
|
||||
std::string& str,
|
||||
size_t max_length,
|
||||
uint8_t mode,
|
||||
std::function<void(std::string&)> on_done) {
|
||||
text_prompt(nav, str, str.length(), max_length, on_done);
|
||||
text_prompt(nav, str, str.length(), max_length, mode, on_done);
|
||||
}
|
||||
|
||||
void text_prompt(
|
||||
@@ -40,8 +41,9 @@ void text_prompt(
|
||||
std::string& str,
|
||||
uint32_t cursor_pos,
|
||||
size_t max_length,
|
||||
uint8_t mode,
|
||||
std::function<void(std::string&)> on_done) {
|
||||
auto te_view = nav.push<AlphanumView>(str, max_length);
|
||||
auto te_view = nav.push<AlphanumView>(str, max_length, mode);
|
||||
te_view->set_cursor(cursor_pos);
|
||||
te_view->on_changed = [on_done](std::string& value) {
|
||||
if (on_done)
|
||||
|
@@ -26,6 +26,11 @@
|
||||
#include "ui.hpp"
|
||||
#include "ui_navigation.hpp"
|
||||
|
||||
#define ENTER_KEYBOARD_MODE_ALPHA 0
|
||||
#define ENTER_KEYBOARD_MODE_DIGITS 1
|
||||
#define ENTER_KEYBOARD_MODE_SYMBOLS 2
|
||||
#define ENTER_KEYBOARD_MODE_HEX 3
|
||||
|
||||
namespace ui {
|
||||
|
||||
class TextEntryView : public View {
|
||||
@@ -62,6 +67,7 @@ void text_prompt(
|
||||
NavigationView& nav,
|
||||
std::string& str,
|
||||
size_t max_length,
|
||||
uint8_t mode,
|
||||
std::function<void(std::string&)> on_done = nullptr);
|
||||
|
||||
void text_prompt(
|
||||
@@ -69,6 +75,7 @@ void text_prompt(
|
||||
std::string& str,
|
||||
uint32_t cursor_pos,
|
||||
size_t max_length,
|
||||
uint8_t mode, // enter mode: 123 abc etc
|
||||
std::function<void(std::string&)> on_done = nullptr);
|
||||
|
||||
} /* namespace ui */
|
||||
|
@@ -130,7 +130,7 @@ TransmitterView::TransmitterView(
|
||||
const uint32_t channel_bandwidth,
|
||||
const bool lock)
|
||||
: lock_{lock} {
|
||||
set_parent_rect({0, y, 30 * 8, 6 * 8});
|
||||
set_parent_rect({0, y, screen_width, 6 * 8});
|
||||
|
||||
add_children({
|
||||
&field_frequency,
|
||||
@@ -155,6 +155,9 @@ TransmitterView::TransmitterView(
|
||||
|
||||
field_bw.on_change = [this](int32_t v) {
|
||||
on_channel_bandwidth_changed(v * 1000);
|
||||
if (on_bandwidth_changed) {
|
||||
on_bandwidth_changed();
|
||||
}
|
||||
};
|
||||
field_bw.set_value(channel_bandwidth);
|
||||
}
|
||||
@@ -257,4 +260,4 @@ void TransmitterView2::update_gainlevel_styles() {
|
||||
field_amp.set_style(style);
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
||||
} /* namespace ui */
|
@@ -50,6 +50,10 @@ class TransmitterView : public View {
|
||||
std::function<void(void)> on_edit_frequency{};
|
||||
std::function<void(void)> on_start{};
|
||||
std::function<void(void)> on_stop{};
|
||||
std::function<void(void)> on_bandwidth_changed{};
|
||||
// TODO: this is a workaround because in the message system,
|
||||
// we change bw by different message for different m4 bb, so have to callback
|
||||
// and change in the instance(for instance SigGen app) with calling the instance's bb opration func
|
||||
|
||||
TransmitterView(const Coord y, const uint64_t frequency_step, const uint32_t channel_bandwidth, const bool lock);
|
||||
TransmitterView(
|
||||
@@ -156,4 +160,4 @@ class TransmitterView2 : public View {
|
||||
|
||||
} /* namespace ui */
|
||||
|
||||
#endif /*__UI_TRANSMITTER_H__*/
|
||||
#endif /*__UI_TRANSMITTER_H__*/
|
@@ -62,12 +62,13 @@ class TimeScopeView : public View {
|
||||
};*/
|
||||
|
||||
Waveform waveform{
|
||||
{0, 1 * 16 + cursor_band_height, 30 * 8, 2 * 16},
|
||||
{0, 1 * 16 + cursor_band_height, screen_width, 2 * 16},
|
||||
audio_spectrum,
|
||||
128,
|
||||
0,
|
||||
false,
|
||||
Theme::getInstance()->bg_darkest->foreground};
|
||||
Theme::getInstance()->bg_darkest->foreground,
|
||||
true};
|
||||
};
|
||||
|
||||
class TVView : public Widget {
|
||||
@@ -116,7 +117,7 @@ class TVWidget : public View {
|
||||
private:
|
||||
void update_widgets_rect();
|
||||
|
||||
const Rect audio_spectrum_view_rect{0 * 8, 0 * 16, 30 * 8, 2 * 16 + 20};
|
||||
const Rect audio_spectrum_view_rect{0 * 8, 0 * 16, screen_width, 2 * 16 + 20};
|
||||
static constexpr Dim audio_spectrum_height = 16 * 2 + 20;
|
||||
static constexpr Dim scale_height = 20;
|
||||
|
||||
|
Reference in New Issue
Block a user