mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-06 21:54:27 -04:00

* 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>
1121 lines
No EOL
32 KiB
C++
1121 lines
No EOL
32 KiB
C++
/*
|
|
* Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc.
|
|
* Copyright (C) 2016 Furrtek
|
|
* 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_WIDGET_H__
|
|
#define __UI_WIDGET_H__
|
|
|
|
#include "ui.hpp"
|
|
#include "ui_text.hpp"
|
|
#include "ui_painter.hpp"
|
|
#include "ui_focus.hpp"
|
|
#include "rtc_time.hpp"
|
|
#include "radio.hpp"
|
|
|
|
#include "portapack.hpp"
|
|
#include "utility.hpp"
|
|
|
|
#include "ui/ui_font_fixed_5x8.hpp"
|
|
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace ui {
|
|
|
|
void dirty_set();
|
|
void dirty_clear();
|
|
bool is_dirty();
|
|
|
|
class Context {
|
|
public:
|
|
FocusManager& focus_manager() {
|
|
return focus_manager_;
|
|
}
|
|
|
|
private:
|
|
FocusManager focus_manager_{};
|
|
};
|
|
|
|
class Widget {
|
|
public:
|
|
Widget()
|
|
: _parent_rect{} {
|
|
}
|
|
|
|
Widget(
|
|
Rect parent_rect)
|
|
: _parent_rect{parent_rect} {
|
|
}
|
|
|
|
Widget(const Widget&) = delete;
|
|
Widget(Widget&&) = delete;
|
|
Widget& operator=(const Widget&) = delete;
|
|
Widget& operator=(Widget&&) = delete;
|
|
|
|
virtual ~Widget() = default;
|
|
|
|
Point screen_pos();
|
|
Size size() const;
|
|
Rect screen_rect() const;
|
|
Rect parent_rect() const;
|
|
virtual void set_parent_rect(const Rect new_parent_rect);
|
|
|
|
Widget* parent() const;
|
|
void set_parent(Widget* const widget);
|
|
|
|
virtual void on_after_attach() { return; };
|
|
virtual void on_before_detach() { return; };
|
|
|
|
bool hidden() const { return flags.hidden; }
|
|
void hidden(bool hide);
|
|
|
|
virtual void focus();
|
|
virtual void on_focus();
|
|
virtual void blur();
|
|
virtual void on_blur();
|
|
bool focusable() const;
|
|
void set_focusable(const bool value);
|
|
bool has_focus();
|
|
|
|
virtual void paint(Painter& painter) = 0;
|
|
|
|
virtual void on_show() { return; };
|
|
virtual void on_hide() { return; };
|
|
|
|
virtual bool on_key(const KeyEvent event);
|
|
virtual bool on_encoder(const EncoderEvent event);
|
|
virtual bool on_touch(const TouchEvent event);
|
|
virtual bool on_keyboard(const KeyboardEvent event);
|
|
virtual const std::vector<Widget*>& children() const;
|
|
|
|
virtual Context& context() const;
|
|
|
|
virtual void getAccessibilityText(std::string& result);
|
|
virtual void getWidgetName(std::string& result);
|
|
|
|
void set_style(const Style* new_style);
|
|
|
|
const Style& style() const;
|
|
int16_t id = 0;
|
|
|
|
// State management methods.
|
|
void set_dirty();
|
|
bool dirty() const;
|
|
void set_clean();
|
|
|
|
void visible(bool v);
|
|
bool visible() { return flags.visible; };
|
|
|
|
bool highlighted() const;
|
|
void set_highlighted(const bool value);
|
|
|
|
protected:
|
|
void dirty_overlapping_children_in_rect(const Rect& child_rect);
|
|
|
|
private:
|
|
/* Widget rectangle relative to parent pos(). */
|
|
Rect _parent_rect;
|
|
const Style* style_{nullptr};
|
|
Widget* parent_{nullptr};
|
|
|
|
struct flags_t {
|
|
bool dirty : 1; // Widget content has changed.
|
|
bool hidden : 1; // Hide widget and children.
|
|
bool focusable : 1; // Widget can receive focus.
|
|
bool highlighted : 1; // Show in a highlighted style.
|
|
bool visible : 1; // Object was visible during last paint.
|
|
};
|
|
|
|
flags_t flags{
|
|
.dirty = true,
|
|
.hidden = false,
|
|
.focusable = false,
|
|
.highlighted = false,
|
|
.visible = false,
|
|
};
|
|
|
|
static const std::vector<Widget*> no_children;
|
|
};
|
|
|
|
class View : public Widget {
|
|
// unlike Paint class, our Y ignored the top bar;
|
|
// so when you draw some of us as Y = 0, it would be exact below the top bar, instead of overlapped with top bar
|
|
public:
|
|
View() {
|
|
}
|
|
|
|
View(Rect parent_rect) {
|
|
set_parent_rect(parent_rect);
|
|
}
|
|
|
|
// TODO: ~View() should on_hide() all children?
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
void add_child(Widget* const widget);
|
|
void add_children(const std::initializer_list<Widget*> children);
|
|
void remove_child(Widget* const widget);
|
|
void remove_children(const std::vector<Widget*>& children);
|
|
const std::vector<Widget*>& children() const override;
|
|
|
|
virtual std::string title() const;
|
|
|
|
protected:
|
|
std::vector<Widget*> children_{};
|
|
|
|
void invalidate_child(Widget* const widget);
|
|
};
|
|
|
|
class Rectangle : public Widget {
|
|
public:
|
|
Rectangle(Color c);
|
|
Rectangle(Rect parent_rect, Color c);
|
|
Rectangle()
|
|
: Rectangle{{}, {}} {
|
|
}
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
void set_color(const Color c);
|
|
void set_outline(const bool outline);
|
|
|
|
private:
|
|
Color color;
|
|
bool _outline = false;
|
|
};
|
|
|
|
class Text : public Widget {
|
|
public:
|
|
Text()
|
|
: text{""} {
|
|
}
|
|
|
|
Text(Rect parent_rect, std::string text);
|
|
Text(Rect parent_rect);
|
|
|
|
void set(std::string_view value);
|
|
|
|
void paint(Painter& painter) override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
protected:
|
|
// NB: Don't truncate this string. The UI will only render
|
|
// as many characters as will fit in its rectange.
|
|
// Apps expect to be able to retrieve this string to avoid
|
|
// needing to hold additional copies in memory.
|
|
std::string text;
|
|
};
|
|
|
|
class Labels : public Widget {
|
|
public:
|
|
struct Label {
|
|
Point pos;
|
|
std::string text;
|
|
ui::Color color;
|
|
};
|
|
|
|
Labels(const Labels&) = delete;
|
|
Labels(Labels&&) = delete;
|
|
Labels& operator=(const Labels&) = delete;
|
|
Labels& operator=(Labels&&) = delete;
|
|
|
|
Labels(std::initializer_list<Label> labels);
|
|
|
|
void set_labels(std::initializer_list<Label> labels);
|
|
|
|
void paint(Painter& painter) override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
std::vector<Label> labels_;
|
|
};
|
|
|
|
class LiveDateTime : public Widget {
|
|
public:
|
|
LiveDateTime(Rect parent_rect);
|
|
~LiveDateTime();
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
void set_hide_clock(bool new_value);
|
|
void set_seconds_enabled(bool new_value);
|
|
void set_date_enabled(bool new_value);
|
|
|
|
std::string& string() {
|
|
return text;
|
|
}
|
|
|
|
private:
|
|
void on_tick_second();
|
|
|
|
uint16_t init_delay = 4;
|
|
bool hide_clock = false;
|
|
bool date_enabled = true;
|
|
bool seconds_enabled = false;
|
|
|
|
rtc::RTC datetime{};
|
|
SignalToken signal_token_tick_second{};
|
|
std::string text{};
|
|
};
|
|
|
|
class BigFrequency : public Widget {
|
|
public:
|
|
BigFrequency(Rect parent_rect, rf::Frequency frequency);
|
|
|
|
void set(const rf::Frequency frequency);
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
private:
|
|
rf::Frequency _frequency;
|
|
rf::Frequency _previous_frequency{~0LL};
|
|
|
|
static constexpr Dim digit_width = 32;
|
|
|
|
const uint8_t segment_font[11] = {
|
|
0b00111111, // 0: ABCDEF
|
|
0b00000110, // 1: AB
|
|
0b01011011, // 2: ABDEG
|
|
0b01001111, // 3: ABCDG
|
|
0b01100110, // 4: BCFG
|
|
0b01101101, // 5: ACDFG
|
|
0b01111101, // 6: ACDEFG
|
|
0b00000111, // 7: ABC
|
|
0b01111111, // 8: ABCDEFG
|
|
0b01101111, // 9: ABCDFG
|
|
0b01000000 // -: G
|
|
};
|
|
|
|
const Rect segments[7] = {
|
|
{{4, 0}, {20, 4}},
|
|
{{24, 4}, {4, 20}},
|
|
{{24, 28}, {4, 20}},
|
|
{{4, 48}, {20, 4}},
|
|
{{0, 28}, {4, 20}},
|
|
{{0, 4}, {4, 20}},
|
|
{{4, 24}, {20, 4}}};
|
|
};
|
|
|
|
class ProgressBar : public Widget {
|
|
public:
|
|
ProgressBar(Rect parent_rect);
|
|
|
|
void set_max(const uint32_t max);
|
|
void set_value(const uint32_t value);
|
|
|
|
void paint(Painter& painter) override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
uint32_t _value = 0;
|
|
uint32_t _max = 100;
|
|
};
|
|
|
|
/* A simple status indicator that can be used to indicate activity. */
|
|
class ActivityDot : public Widget {
|
|
public:
|
|
ActivityDot(Rect parent_rect, Color color);
|
|
|
|
void paint(Painter& painter) override;
|
|
void toggle();
|
|
void reset();
|
|
|
|
private:
|
|
bool _on{false};
|
|
Color _color;
|
|
};
|
|
|
|
class Console : public Widget {
|
|
public:
|
|
Console(Rect parent_rect);
|
|
|
|
void clear(bool clear_buffer);
|
|
void write(std::string message);
|
|
void writeln(std::string message);
|
|
|
|
void paint(Painter&) override;
|
|
|
|
void enable_scrolling(bool enable);
|
|
void on_show() override;
|
|
void on_hide() override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
Point pos{0, 0};
|
|
Dim scroll_height = 0;
|
|
std::string buffer{};
|
|
static bool scrolling_enabled;
|
|
|
|
void crlf();
|
|
};
|
|
|
|
class Checkbox : public Widget {
|
|
public:
|
|
std::function<void(Checkbox&, bool)> on_select{};
|
|
|
|
Checkbox(Point parent_pos, size_t length, std::string text, bool small);
|
|
Checkbox(
|
|
Point parent_pos,
|
|
size_t length,
|
|
std::string text)
|
|
: Checkbox{parent_pos, length, text, false} {
|
|
}
|
|
|
|
Checkbox()
|
|
: Checkbox{{}, {}, {}} {
|
|
}
|
|
|
|
Checkbox(const Checkbox&) = delete;
|
|
Checkbox(Checkbox&&) = delete;
|
|
Checkbox& operator=(const Checkbox&) = delete;
|
|
Checkbox& operator=(Checkbox&&) = delete;
|
|
|
|
void set_text(const std::string value);
|
|
bool set_value(const bool value);
|
|
bool value() const;
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_keyboard(const KeyboardEvent key) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
std::string text_;
|
|
bool small_{false};
|
|
bool value_{false};
|
|
const Style* style_{nullptr};
|
|
};
|
|
|
|
class Button : public Widget {
|
|
public:
|
|
std::function<void(Button&)> on_select{};
|
|
std::function<void(Button&)> on_touch_release{}; // Executed when releasing touch, after on_select.
|
|
std::function<void(Button&)> on_touch_press{}; // Executed when touching, before on_select.
|
|
std::function<bool(Button&, KeyEvent)> on_dir{};
|
|
std::function<void(Button&)> on_highlight{};
|
|
|
|
Button(Rect parent_rect, std::string text, bool instant_exec); // instant_exec: Execute on_select when you touching instead of releasing
|
|
Button(
|
|
Rect parent_rect,
|
|
std::string text)
|
|
: Button{parent_rect, text, false} {
|
|
}
|
|
|
|
Button()
|
|
: Button{{}, {}} {
|
|
}
|
|
|
|
void set_text(const std::string value);
|
|
std::string text() const;
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
void on_focus() override;
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
std::string text_;
|
|
bool instant_exec_{false};
|
|
};
|
|
|
|
class ButtonWithEncoder : public Widget {
|
|
public:
|
|
std::function<void(ButtonWithEncoder&)> on_select{};
|
|
std::function<void(ButtonWithEncoder&)> on_touch_release{}; // Executed when releasing touch, after on_select.
|
|
std::function<void(ButtonWithEncoder&)> on_touch_press{}; // Executed when touching, before on_select.
|
|
std::function<bool(ButtonWithEncoder&, KeyEvent)> on_dir{};
|
|
std::function<void(ButtonWithEncoder&)> on_highlight{};
|
|
|
|
ButtonWithEncoder(Rect parent_rect, std::string text, bool instant_exec); // instant_exec: Execute on_select when you touching instead of releasing
|
|
ButtonWithEncoder(
|
|
Rect parent_rect,
|
|
std::string text)
|
|
: ButtonWithEncoder{parent_rect, text, false} {
|
|
}
|
|
|
|
ButtonWithEncoder()
|
|
: ButtonWithEncoder{{}, {}} {
|
|
}
|
|
|
|
std::function<void()> on_change{};
|
|
|
|
void set_text(const std::string value);
|
|
int32_t get_encoder_delta();
|
|
void set_encoder_delta(const int32_t delta);
|
|
std::string text() const;
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
void on_focus() override;
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
std::string text_;
|
|
int32_t encoder_delta = 0;
|
|
bool delta_change = 0;
|
|
bool instant_exec_{false};
|
|
};
|
|
|
|
class NewButton : public Widget {
|
|
public:
|
|
std::function<void(void)> on_select{};
|
|
// std::function<void(NewButton&)> on_select{};
|
|
std::function<bool(NewButton&, KeyEvent)> on_dir{};
|
|
std::function<void(NewButton&)> on_highlight{};
|
|
|
|
NewButton(const NewButton&) = delete;
|
|
NewButton& operator=(const NewButton&) = delete;
|
|
NewButton(Rect parent_rect, std::string text, const Bitmap* bitmap);
|
|
NewButton(Rect parent_rect, std::string text, const Bitmap* bitmap, Color color, bool vertical_center = false);
|
|
NewButton()
|
|
: NewButton{{}, {}, {}} {
|
|
}
|
|
|
|
void set_bitmap(const Bitmap* bitmap);
|
|
void set_text(const std::string value);
|
|
void set_color(Color value);
|
|
void set_bg_color(Color value);
|
|
void set_vertical_center(bool value);
|
|
std::string text() const;
|
|
const Bitmap* bitmap();
|
|
ui::Color color();
|
|
|
|
void on_focus() override;
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
protected:
|
|
virtual Style paint_style();
|
|
Color color_;
|
|
Color bg_color_{Theme::getInstance()->bg_medium->background};
|
|
|
|
private:
|
|
std::string text_;
|
|
const Bitmap* bitmap_;
|
|
bool vertical_center_{false};
|
|
};
|
|
|
|
class Image : public Widget {
|
|
public:
|
|
Image();
|
|
Image(
|
|
const Rect parent_rect,
|
|
const Bitmap* bitmap,
|
|
const Color foreground,
|
|
const Color background);
|
|
|
|
Image(const Image&) = delete;
|
|
Image(Image&&) = delete;
|
|
Image& operator=(const Image&) = delete;
|
|
Image& operator=(Image&&) = delete;
|
|
|
|
void set_bitmap(const Bitmap* bitmap);
|
|
void set_foreground(const Color color);
|
|
void set_background(const Color color);
|
|
void invert_colors();
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
const Bitmap& bitmap() & { return *bitmap_; }
|
|
|
|
private:
|
|
const Bitmap* bitmap_;
|
|
Color foreground_;
|
|
Color background_;
|
|
};
|
|
|
|
class ImageButton : public Image {
|
|
public:
|
|
std::function<void(ImageButton&)> on_select{};
|
|
|
|
ImageButton(
|
|
const Rect parent_rect,
|
|
const Bitmap* bitmap,
|
|
const Color foreground,
|
|
const Color background);
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
};
|
|
|
|
/* A button that toggles between two images when set. */
|
|
class ImageToggle : public ImageButton {
|
|
public:
|
|
std::function<void(bool value)> on_change{};
|
|
|
|
ImageToggle(
|
|
Rect parent_rect,
|
|
const Bitmap* bitmap_);
|
|
|
|
ImageToggle(
|
|
Rect parent_rect,
|
|
const Bitmap* bitmap_,
|
|
Color foreground_true,
|
|
Color foreground_false,
|
|
Color background_);
|
|
|
|
ImageToggle(
|
|
Rect parent_rect,
|
|
const Bitmap* bitmap_true,
|
|
const Bitmap* bitmap_false,
|
|
Color foreground_true,
|
|
Color background_true,
|
|
Color foreground_false,
|
|
Color background_false);
|
|
|
|
ImageToggle(const ImageToggle&) = delete;
|
|
ImageToggle& operator=(const ImageToggle&) = delete;
|
|
|
|
bool value() const;
|
|
void set_value(bool b);
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
// Hide this field.
|
|
using ImageButton::on_select;
|
|
const Bitmap* bitmap_true_;
|
|
const Bitmap* bitmap_false_;
|
|
const Color foreground_true_;
|
|
const Color background_true_;
|
|
const Color foreground_false_;
|
|
const Color background_false_;
|
|
bool value_;
|
|
};
|
|
|
|
class ImageOptionsField : public Widget {
|
|
public:
|
|
using value_t = int32_t;
|
|
using option_t = std::pair<const Bitmap*, value_t>;
|
|
using options_t = std::vector<option_t>;
|
|
|
|
std::function<void(size_t, value_t)> on_change{};
|
|
std::function<void(void)> on_show_options{};
|
|
|
|
ImageOptionsField(
|
|
Rect parent_rect,
|
|
Color foreground,
|
|
Color background,
|
|
options_t options);
|
|
|
|
ImageOptionsField()
|
|
: ImageOptionsField{{}, Theme::getInstance()->bg_darkest->foreground, Theme::getInstance()->bg_darkest->background, {}} {
|
|
}
|
|
|
|
void set_options(options_t new_options);
|
|
|
|
size_t selected_index() const;
|
|
size_t selected_index_value() const;
|
|
void set_selected_index(const size_t new_index);
|
|
|
|
void set_by_value(value_t v);
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
void on_focus() override;
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
options_t options;
|
|
size_t selected_index_{0};
|
|
Color foreground_;
|
|
Color background_;
|
|
};
|
|
|
|
class OptionsField : public Widget {
|
|
public:
|
|
using name_t = std::string;
|
|
using value_t = int32_t;
|
|
using option_t = std::pair<name_t, value_t>;
|
|
using options_t = std::vector<option_t>;
|
|
|
|
std::function<void(size_t, value_t)> on_change{};
|
|
std::function<void(void)> on_show_options{};
|
|
|
|
OptionsField(Point parent_pos, size_t length, options_t options, bool centered = false);
|
|
|
|
options_t& options() { return options_; }
|
|
const options_t& options() const { return options_; }
|
|
void set_options(options_t new_options);
|
|
|
|
size_t selected_index() const;
|
|
const name_t& selected_index_name() const;
|
|
const value_t& selected_index_value() const;
|
|
void set_selected_index(const size_t new_index, bool trigger_change = true);
|
|
|
|
void set_by_value(value_t v);
|
|
void set_by_nearest_value(value_t v);
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
void on_focus() override;
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
const size_t length_;
|
|
options_t options_;
|
|
size_t selected_index_{0};
|
|
bool centered_{false}; // e.g.: length as screen_width/8, x position as 0, it will be centered in x axis
|
|
};
|
|
|
|
// A TextEdit is bound to a string reference and allows the string
|
|
// to be manipulated. The field itself does not provide the UI for
|
|
// setting the value. It provides the UI of rendering the text,
|
|
// a cursor, and an API to edit the string content.
|
|
class TextEdit : public Widget {
|
|
public:
|
|
TextEdit(std::string& str, Point position, uint32_t length = 30)
|
|
: TextEdit{str, 64, position, length} {}
|
|
|
|
// Str: the string containing the content to edit.
|
|
// Max_length: max length the string is allowed to use.
|
|
// Position: the top-left corner of the control.
|
|
// Length: the number of characters to display.
|
|
// - Characters are 8 pixels wide.
|
|
// - The screen can show 30 characters max.
|
|
// - The control is 16 pixels tall.
|
|
TextEdit(std::string& str, size_t max_length, Point position, uint32_t length = 30);
|
|
|
|
TextEdit(const TextEdit&) = delete;
|
|
TextEdit(TextEdit&&) = delete;
|
|
TextEdit& operator=(const TextEdit&) = delete;
|
|
TextEdit& operator=(TextEdit&&) = delete;
|
|
|
|
const std::string& value() const;
|
|
|
|
void set_cursor(uint32_t pos);
|
|
void set_insert_mode();
|
|
void set_overwrite_mode();
|
|
|
|
void char_add(char c);
|
|
void char_delete();
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
void on_focus() override;
|
|
void on_blur() override;
|
|
|
|
protected:
|
|
std::string& text_;
|
|
size_t max_length_;
|
|
uint32_t char_count_;
|
|
uint32_t cursor_pos_;
|
|
bool insert_mode_;
|
|
};
|
|
|
|
class TextField : public Text {
|
|
public:
|
|
std::function<void(TextField&)> on_select{};
|
|
std::function<void(TextField&)> on_change{};
|
|
std::function<void(TextField&, EncoderEvent)> on_encoder_change{};
|
|
|
|
TextField(Rect parent_rect, std::string text);
|
|
|
|
const std::string& get_text() const;
|
|
void set_text(std::string_view value);
|
|
|
|
bool on_key(KeyEvent key) override;
|
|
bool on_encoder(EncoderEvent delta) override;
|
|
bool on_touch(TouchEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
using Text::set;
|
|
};
|
|
|
|
class BatteryTextField : public Widget {
|
|
public:
|
|
std::function<void()> on_select{};
|
|
|
|
BatteryTextField(Rect parent_rect, uint8_t percent);
|
|
void paint(Painter& painter) override;
|
|
|
|
void set_battery(uint8_t valid_mask, uint8_t percentage, bool charge);
|
|
void set_text(std::string_view value);
|
|
|
|
bool on_key(KeyEvent key) override;
|
|
bool on_touch(TouchEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
uint8_t percent_{102};
|
|
uint8_t valid_{0};
|
|
bool charge_{false};
|
|
|
|
Style style{
|
|
.font = font::fixed_5x8,
|
|
.background = Theme::getInstance()->bg_dark->background,
|
|
.foreground = Theme::getInstance()->bg_dark->foreground,
|
|
};
|
|
};
|
|
|
|
class BatteryIcon : public Widget {
|
|
public:
|
|
std::function<void()> on_select{};
|
|
|
|
BatteryIcon(Rect parent_rect, uint8_t percent);
|
|
void paint(Painter& painter) override;
|
|
void set_battery(uint8_t valid_mask, uint8_t percentage, bool charge);
|
|
|
|
bool on_key(KeyEvent key) override;
|
|
bool on_touch(TouchEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
uint8_t percent_{102};
|
|
uint8_t valid_{0};
|
|
bool charge_{false};
|
|
};
|
|
|
|
class NumberField : public Widget {
|
|
public:
|
|
std::function<void(NumberField&)> on_select{};
|
|
std::function<void(int32_t)> on_change{};
|
|
std::function<void(int32_t)> on_wrap{};
|
|
|
|
using range_t = std::pair<int32_t, int32_t>;
|
|
|
|
NumberField(Point parent_pos, int length, range_t range, int32_t step, char fill_char, bool can_loop);
|
|
|
|
NumberField(Point parent_pos, int length, range_t range, int32_t step, char fill_char)
|
|
: NumberField{parent_pos, length, range, step, fill_char, false} {
|
|
}
|
|
|
|
NumberField()
|
|
: NumberField{{0, 0}, 1, {0, 1}, 1, ' ', false} {
|
|
}
|
|
|
|
NumberField(const NumberField&) = delete;
|
|
NumberField(NumberField&&) = delete;
|
|
|
|
int32_t value() const;
|
|
void set_value(int32_t new_value, bool trigger_change = true);
|
|
void set_range(const int32_t min, const int32_t max);
|
|
void set_step(const int32_t new_step);
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_encoder(const EncoderEvent delta) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
range_t range;
|
|
int32_t step;
|
|
const int length_;
|
|
const char fill_char;
|
|
int32_t value_{0};
|
|
bool can_loop{};
|
|
};
|
|
|
|
/* A widget that allows for character-by-character editing of its value. */
|
|
class SymField : public Widget {
|
|
public:
|
|
std::function<void(SymField&)> on_change{};
|
|
|
|
enum class Type {
|
|
Custom,
|
|
Oct,
|
|
Dec,
|
|
Hex,
|
|
Alpha,
|
|
};
|
|
|
|
/* When "explicit_edits" is true, the field must be selected before it can
|
|
* be modified. This means that "slots" are not individually highlighted.
|
|
* This makes navigation on Views with SymFields easier because the
|
|
* whole control can be skipped over instead of one "slot" at a time. */
|
|
|
|
SymField(
|
|
Point parent_pos,
|
|
size_t length,
|
|
Type type = Type::Dec,
|
|
bool explicit_edits = false);
|
|
|
|
SymField(
|
|
Point parent_pos,
|
|
size_t length,
|
|
std::string symbol_list,
|
|
bool explicit_edits = false);
|
|
|
|
SymField(const SymField&) = delete;
|
|
SymField(SymField&&) = delete;
|
|
|
|
/* Gets the symbol (character) at the specified index. */
|
|
char get_symbol(size_t index) const;
|
|
|
|
/* Sets the symbol (character) at the specified index. */
|
|
void set_symbol(size_t index, char symbol);
|
|
|
|
/* Gets the symbol's offset in the symbol list at the specified index. */
|
|
size_t get_offset(size_t index) const;
|
|
|
|
/* Sets the symbol's offset in the symbol list at the specified index. */
|
|
void set_offset(size_t index, size_t offset);
|
|
|
|
/* Sets the list of allowable symbols for the field. */
|
|
void set_symbol_list(std::string symbol_list);
|
|
|
|
/* Sets the integer value of the field. Only works for OCT/DEC/HEX. */
|
|
void set_value(uint64_t value);
|
|
|
|
/* Sets the string value of the field. Characters that are not in
|
|
* the symbol list will be set to the first symbol in the symbol list. */
|
|
void set_value(std::string_view value);
|
|
|
|
/* Gets the integer value of the field for OCT/DEC/HEX. */
|
|
uint64_t to_integer() const;
|
|
|
|
/* Gets the string value of the field. */
|
|
const std::string& to_string() const;
|
|
|
|
void paint(Painter& painter) override;
|
|
bool on_key(KeyEvent key) override;
|
|
bool on_encoder(EncoderEvent delta) override;
|
|
bool on_touch(TouchEvent event) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
/* Ensure the specified symbol is in the symbol list. */
|
|
char ensure_valid(char symbol) const;
|
|
|
|
/* Ensures all the symbols are valid. */
|
|
void ensure_all_symbols();
|
|
|
|
/* Sets without validation and fires on_change if necessary. */
|
|
void set_symbol_internal(size_t index, char symbol);
|
|
|
|
/* Gets the radix for the current Type. */
|
|
uint8_t get_radix() const;
|
|
|
|
std::string symbols_{};
|
|
std::string value_{};
|
|
Type type_ = Type::Custom;
|
|
size_t selected_ = 0;
|
|
bool editing_ = false;
|
|
bool explicit_edits_ = true;
|
|
};
|
|
|
|
class Waveform : public Widget {
|
|
public:
|
|
std::function<void(Waveform&)> on_select{};
|
|
|
|
Waveform(Rect parent_rect, int16_t* data, uint32_t length, uint32_t offset, bool digital, Color color, bool clickable = false);
|
|
|
|
Waveform(const Waveform&) = delete;
|
|
Waveform(Waveform&&) = delete;
|
|
Waveform& operator=(const Waveform&) = delete;
|
|
Waveform& operator=(Waveform&&) = delete;
|
|
|
|
void set_offset(const uint32_t new_offset);
|
|
void set_length(const uint32_t new_length);
|
|
void set_cursor(const uint32_t i, const int16_t position);
|
|
|
|
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 getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
|
|
private:
|
|
const Color cursor_colors[2] = {Theme::getInstance()->fg_cyan->foreground, Theme::getInstance()->fg_magenta->foreground};
|
|
|
|
int16_t* data_;
|
|
uint32_t length_;
|
|
uint32_t offset_;
|
|
bool digital_{false};
|
|
Color color_;
|
|
int16_t cursors[2]{};
|
|
bool show_cursors{false};
|
|
bool paused_{false};
|
|
bool clickable_{false};
|
|
bool if_ever_painted_pause{false}; // for prevent the "hidden" label keeps painting and being expensive
|
|
};
|
|
|
|
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()
|
|
};
|
|
|
|
class VuMeter : public Widget {
|
|
public:
|
|
VuMeter(Rect parent_rect, uint32_t LEDs, bool show_max);
|
|
|
|
void set_value(const uint32_t new_value);
|
|
void set_mark(const uint32_t new_mark);
|
|
|
|
void paint(Painter& painter) override;
|
|
|
|
private:
|
|
uint32_t LEDs_, LED_height{0};
|
|
uint32_t value_{0}, prev_value{255}; // Forces painting on first display
|
|
uint32_t split{0};
|
|
uint16_t max{0}, prev_max{0}, hold_timer{0}, mark{0}, prev_mark{0};
|
|
bool show_max_;
|
|
};
|
|
|
|
class OptionTabView : public View {
|
|
public:
|
|
OptionTabView(Rect parent_rect);
|
|
|
|
void focus() override;
|
|
|
|
bool is_enabled();
|
|
void set_type(std::string type);
|
|
|
|
protected:
|
|
bool enabled{false};
|
|
|
|
void set_enabled(bool value);
|
|
|
|
private:
|
|
Checkbox check_enable{
|
|
{2 * 8, 0 * 16},
|
|
20,
|
|
"",
|
|
false};
|
|
};
|
|
|
|
} /* namespace ui */
|
|
|
|
#endif /*__UI_WIDGET_H__*/ |