mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-09 23:22:33 -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>
770 lines
30 KiB
C++
770 lines
30 KiB
C++
/*
|
|
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
|
* Copyright (C) 2018 Furrtek
|
|
* Copyright (C) 2023 Mark Thompson
|
|
*
|
|
* 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_scanner.hpp"
|
|
|
|
#include "optional.hpp"
|
|
#include "ui_fileman.hpp"
|
|
#include "ui_freqman.hpp"
|
|
#include "file_path.hpp"
|
|
|
|
using namespace ui;
|
|
using namespace portapack;
|
|
namespace fs = std::filesystem;
|
|
|
|
namespace ui::external_app::scanner {
|
|
|
|
ScannerThread::ScannerThread(std::vector<rf::Frequency> frequency_list)
|
|
: frequency_list_{std::move(frequency_list)} {
|
|
_manual_search = false;
|
|
create_thread();
|
|
}
|
|
|
|
ScannerThread::ScannerThread(const scanner_range_t& frequency_range, size_t def_step_hz)
|
|
: frequency_range_(frequency_range), def_step_hz_(def_step_hz) {
|
|
_manual_search = true;
|
|
create_thread();
|
|
}
|
|
|
|
ScannerThread::~ScannerThread() {
|
|
stop();
|
|
}
|
|
|
|
void ScannerThread::create_thread() {
|
|
thread = chThdCreateFromHeap(NULL, 1024, NORMALPRIO + 10, ScannerThread::static_fn, this);
|
|
}
|
|
|
|
void ScannerThread::stop() {
|
|
if (thread) {
|
|
chThdTerminate(thread);
|
|
chThdWait(thread);
|
|
thread = nullptr;
|
|
}
|
|
}
|
|
|
|
// Set by "userpause"
|
|
void ScannerThread::set_scanning(const bool v) {
|
|
_scanning = v;
|
|
}
|
|
|
|
bool ScannerThread::is_scanning() {
|
|
return _scanning;
|
|
}
|
|
|
|
void ScannerThread::set_freq_lock(const uint32_t v) {
|
|
_freq_lock = v;
|
|
}
|
|
|
|
uint32_t ScannerThread::is_freq_lock() {
|
|
return _freq_lock;
|
|
}
|
|
|
|
// Delete an entry from frequency list
|
|
// Caller must pause scan_thread AND can't delete a second one until this field is cleared
|
|
void ScannerThread::set_freq_del(const rf::Frequency v) {
|
|
_freq_del = v;
|
|
}
|
|
|
|
// Force a one-time forward or reverse frequency index change; OK to do this without pausing scan thread
|
|
// (used when rotary encoder is turned)
|
|
void ScannerThread::set_index_stepper(const int32_t v) {
|
|
_index_stepper = v;
|
|
}
|
|
|
|
// Set scanning direction; OK to do this without pausing scan_thread
|
|
void ScannerThread::set_scanning_direction(bool fwd) {
|
|
int32_t new_stepper = fwd ? 1 : -1;
|
|
|
|
if (_stepper != new_stepper) {
|
|
_stepper = new_stepper;
|
|
chThdSleepMilliseconds(300); // Give some pause after reversing scanning direction
|
|
}
|
|
}
|
|
|
|
msg_t ScannerThread::static_fn(void* arg) {
|
|
auto obj = static_cast<ScannerThread*>(arg);
|
|
obj->run();
|
|
return 0;
|
|
}
|
|
|
|
void ScannerThread::run() {
|
|
RetuneMessage message{};
|
|
|
|
if (!_manual_search && frequency_list_.size()) { // IF NOT MANUAL MODE AND THERE IS A FREQUENCY LIST ...
|
|
int32_t size = frequency_list_.size();
|
|
int32_t frequency_index = (_stepper > 0) ? size : 0; // Forcing wraparound to starting frequency on 1st pass
|
|
|
|
while (!chThdShouldTerminate()) {
|
|
bool force_one_step = (_index_stepper != 0);
|
|
int32_t step = force_one_step ? _index_stepper : _stepper; //_index_stepper direction takes priority
|
|
|
|
if (_scanning || force_one_step) { // Scanning, or paused and using rotary encoder
|
|
if ((_freq_lock == 0) || force_one_step) { // normal scanning (not performing freq_lock)
|
|
frequency_index += step;
|
|
if (frequency_index >= size) // Wrap
|
|
frequency_index = 0;
|
|
else if (frequency_index < 0)
|
|
frequency_index = size - 1;
|
|
|
|
if (force_one_step)
|
|
_index_stepper = 0;
|
|
|
|
receiver_model.set_target_frequency(frequency_list_[frequency_index]); // Retune
|
|
}
|
|
message.freq = frequency_list_[frequency_index];
|
|
message.range = frequency_index; // Inform freq (for coloring purposes also!)
|
|
EventDispatcher::send_message(message);
|
|
} else if (_freq_del != 0) { // There is a frequency to delete
|
|
for (int32_t i = 0; i < size; i++) { // Search for the freq to delete
|
|
if (frequency_list_[i] == _freq_del) { // found: Erase it
|
|
frequency_list_.erase(frequency_list_.begin() + i);
|
|
size = frequency_list_.size();
|
|
break;
|
|
}
|
|
}
|
|
_freq_del = 0; // deleted.
|
|
}
|
|
|
|
chThdSleepMilliseconds(SCANNER_SLEEP_MS); // Needed to (eventually) stabilize the receiver into new freq
|
|
}
|
|
} else if (_manual_search && (def_step_hz_ > 0)) // manual search range mode
|
|
{
|
|
int64_t size = (frequency_range_.max - frequency_range_.min) / def_step_hz_;
|
|
int64_t frequency_index = (_stepper > 0) ? size : 0; // Forcing wraparound to starting frequency on 1st pass
|
|
|
|
while (!chThdShouldTerminate()) {
|
|
bool force_one_step = (_index_stepper != 0);
|
|
int32_t step = force_one_step ? _index_stepper : _stepper; //_index_stepper direction takes priority
|
|
|
|
if (_scanning || force_one_step) { // Scanning, or paused and using rotary encoder
|
|
if ((_freq_lock == 0) || force_one_step) { // normal scanning (not performing freq_lock)
|
|
frequency_index += step;
|
|
if (frequency_index >= size) // Wrap
|
|
frequency_index = 0;
|
|
else if (frequency_index < 0)
|
|
frequency_index = size - 1;
|
|
|
|
if (force_one_step)
|
|
_index_stepper = 0;
|
|
|
|
receiver_model.set_target_frequency(frequency_range_.min + frequency_index * def_step_hz_); // Retune
|
|
}
|
|
message.freq = frequency_range_.min + frequency_index * def_step_hz_;
|
|
message.range = 0; // Inform freq (for coloring purposes also!)
|
|
EventDispatcher::send_message(message);
|
|
}
|
|
|
|
chThdSleepMilliseconds(SCANNER_SLEEP_MS); // Needed to (eventually) stabilize the receiver into new freq
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScannerView::bigdisplay_update(int32_t v) {
|
|
if (v != bigdisplay_current_color) {
|
|
if (v != -1)
|
|
bigdisplay_current_color = v; // -1 means refresh display but keep current color
|
|
|
|
switch (bigdisplay_current_color) {
|
|
case BDC_GREY:
|
|
big_display.set_style(Theme::getInstance()->fg_medium);
|
|
break;
|
|
case BDC_YELLOW:
|
|
big_display.set_style(Theme::getInstance()->fg_yellow);
|
|
break;
|
|
case BDC_GREEN:
|
|
big_display.set_style(Theme::getInstance()->fg_green);
|
|
break;
|
|
case BDC_RED:
|
|
big_display.set_style(Theme::getInstance()->fg_red);
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
// update frequency display
|
|
bigdisplay_current_frequency = current_frequency;
|
|
big_display.set(bigdisplay_current_frequency);
|
|
} else {
|
|
// no style change, but update frequency display if it's changed
|
|
if (current_frequency != bigdisplay_current_frequency) {
|
|
bigdisplay_current_frequency = current_frequency;
|
|
big_display.set(bigdisplay_current_frequency);
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScannerView::handle_retune(int64_t freq, uint32_t freq_idx) {
|
|
current_index = freq_idx; // since it is an ongoing scan, this is a new index
|
|
current_frequency = freq;
|
|
|
|
if (scan_thread) {
|
|
switch (scan_thread->is_freq_lock()) {
|
|
case 0: // NO FREQ LOCK, ONGOING STANDARD SCANNING
|
|
bigdisplay_update(BDC_GREY);
|
|
break;
|
|
case 1: // STARTING LOCK FREQ
|
|
bigdisplay_update(BDC_YELLOW);
|
|
break;
|
|
case MAX_FREQ_LOCK: // FREQ IS STRONG: GREEN and scanner will pause when on_statistics_update()
|
|
bigdisplay_update(BDC_GREEN);
|
|
break;
|
|
default: // freq lock is checking the signal, do not update display
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!manual_search) {
|
|
if (entries.size() > 0)
|
|
field_current_index.set_text(to_string_dec_uint(freq_idx + 1, 3));
|
|
|
|
if (freq_idx < entries.size() && entries[freq_idx].description.size() > 1)
|
|
text_current_desc.set(entries[freq_idx].description); // Show description from file
|
|
else
|
|
text_current_desc.set(loaded_filename()); // Show Scan file name (no description in file)
|
|
}
|
|
}
|
|
|
|
void ScannerView::handle_encoder(EncoderEvent delta) {
|
|
auto index_step = delta > 0 ? 1 : -1;
|
|
|
|
if (scan_thread)
|
|
scan_thread->set_index_stepper(index_step);
|
|
|
|
// Restart browse timer when frequency changes.
|
|
if (browse_timer != 0)
|
|
browse_timer = 1;
|
|
}
|
|
|
|
std::string ScannerView::loaded_filename() const {
|
|
auto filename = freqman_file;
|
|
if (filename.length() > 23) { // Truncate long file name.
|
|
filename.resize(22);
|
|
filename = filename + "+";
|
|
}
|
|
|
|
return filename;
|
|
}
|
|
|
|
void ScannerView::focus() {
|
|
button_load.focus();
|
|
}
|
|
|
|
ScannerView::~ScannerView() {
|
|
// make sure to stop the thread before shutting down the receiver
|
|
scan_thread.reset();
|
|
audio::output::stop();
|
|
receiver_model.disable();
|
|
baseband::shutdown();
|
|
}
|
|
|
|
void ScannerView::show_max_index() { // show total number of freqs to scan
|
|
field_current_index.set_text("<->");
|
|
|
|
if (entries.size() == FREQMAN_MAX_PER_FILE) {
|
|
text_max_index.set_style(Theme::getInstance()->fg_red);
|
|
text_max_index.set("/ " + to_string_dec_uint(FREQMAN_MAX_PER_FILE) + " (DB MAX!)");
|
|
} else {
|
|
text_max_index.set_style(Theme::getInstance()->fg_medium);
|
|
text_max_index.set("/ " + to_string_dec_uint(entries.size()));
|
|
}
|
|
}
|
|
|
|
ScannerView::ScannerView(
|
|
NavigationView& nav)
|
|
: nav_{nav} {
|
|
add_children({
|
|
&labels,
|
|
&field_lna,
|
|
&field_vga,
|
|
&field_rf_amp,
|
|
&field_volume,
|
|
&field_bw,
|
|
&field_squelch,
|
|
&field_browse_wait,
|
|
&field_lock_wait,
|
|
&button_load,
|
|
&button_clear,
|
|
&rssi,
|
|
&field_current_index,
|
|
&text_max_index,
|
|
&text_current_desc,
|
|
&big_display,
|
|
&button_manual_start,
|
|
&button_manual_end,
|
|
&field_mode,
|
|
&field_step,
|
|
&button_manual_search,
|
|
&button_pause,
|
|
&button_dir,
|
|
&button_audio_app,
|
|
&button_mic_app,
|
|
&button_add,
|
|
&button_remove,
|
|
});
|
|
|
|
// Populate option text for these fields
|
|
freqman_set_modulation_option(field_mode);
|
|
freqman_set_step_option(field_step);
|
|
|
|
// Default starting modulation (from saved App Settings if enabled, and may be overridden in SCANNER.TXT)
|
|
field_mode.set_by_value((OptionsField::value_t)receiver_model.modulation()); // Reflect the mode into the manual selector
|
|
field_step.set_by_value(receiver_model.frequency_step()); // Default step interval (Hz)
|
|
change_mode((freqman_index_t)field_mode.selected_index_value());
|
|
|
|
button_manual_start.set_text(to_string_short_freq(frequency_range.min));
|
|
button_manual_end.set_text(to_string_short_freq(frequency_range.max));
|
|
|
|
// Button to load a Freqman file.
|
|
button_load.on_select = [this, &nav](Button&) {
|
|
auto open_view = nav.push<FileLoadView>(".TXT");
|
|
open_view->push_dir(freqman_dir);
|
|
open_view->on_changed = [this, &nav](std::filesystem::path new_file_path) {
|
|
if (new_file_path.native().find((u"/" / freqman_dir).native()) == 0) {
|
|
scan_pause();
|
|
frequency_file_load(new_file_path);
|
|
} else {
|
|
nav.display_modal("LOAD ERROR", "A valid file from\nFREQMAN directory is\nrequired.");
|
|
}
|
|
};
|
|
};
|
|
|
|
// Button to clear in-memory frequency list.
|
|
button_clear.on_select = [this, &nav](Button&) {
|
|
if (scan_thread && entries.size()) {
|
|
scan_thread->stop(); // STOP SCANNER THREAD
|
|
entries.clear();
|
|
|
|
show_max_index(); // UPDATE new list size on screen
|
|
field_current_index.set_text("");
|
|
text_current_desc.set(loaded_filename());
|
|
scan_thread->set_freq_lock(0); // Reset the scanner lock
|
|
|
|
// FUTURE: Consider switching to manual search mode automatically after clear (but would need to validate freq range)
|
|
}
|
|
};
|
|
|
|
// Button to configure starting frequency for a manual range search.
|
|
button_manual_start.on_select = [this, &nav](Button& button) {
|
|
auto new_view = nav_.push<FrequencyKeypadView>(frequency_range.min);
|
|
new_view->on_changed = [this, &button](rf::Frequency f) {
|
|
frequency_range.min = f;
|
|
button_manual_start.set_text(to_string_short_freq(f));
|
|
};
|
|
};
|
|
|
|
// Button to configure ending frequency for a manual range search.
|
|
button_manual_end.on_select = [this, &nav](Button& button) {
|
|
auto new_view = nav.push<FrequencyKeypadView>(frequency_range.max);
|
|
new_view->on_changed = [this, &button](rf::Frequency f) {
|
|
frequency_range.max = f;
|
|
button_manual_end.set_text(to_string_short_freq(f));
|
|
};
|
|
};
|
|
|
|
// Button to pause/resume scan (note that some other buttons will trigger resume also).
|
|
button_pause.on_select = [this](ButtonWithEncoder&) {
|
|
if (userpause)
|
|
user_resume();
|
|
else {
|
|
scan_pause();
|
|
button_pause.set_text("<RESUME>"); // PAUSED, show resume
|
|
userpause = true;
|
|
}
|
|
};
|
|
|
|
// Encoder dial causes frequency change when focus is on pause button or current index.
|
|
button_pause.on_change = [this]() {
|
|
handle_encoder(button_pause.get_encoder_delta());
|
|
button_pause.set_encoder_delta(0);
|
|
};
|
|
field_current_index.on_encoder_change = [this](TextField&, EncoderEvent delta) {
|
|
handle_encoder(delta);
|
|
};
|
|
|
|
// Button to switch to Audio app
|
|
button_audio_app.on_select = [this](Button&) {
|
|
if (scan_thread)
|
|
scan_thread->stop();
|
|
auto settings = receiver_model.settings();
|
|
settings.frequency_step = field_step.selected_index_value();
|
|
nav_.replace<AnalogAudioView>(settings);
|
|
};
|
|
|
|
// Button to switch to Mic app
|
|
button_mic_app.on_select = [this](Button&) {
|
|
if (scan_thread)
|
|
scan_thread->stop();
|
|
// MicTX wants Frequency, Modulation and Bandwidth overrides, but that's only stored on the RX model.
|
|
nav_.replace<MicTXView>(receiver_model.settings());
|
|
};
|
|
|
|
// Button to delete current frequency from scan Freq List
|
|
button_remove.on_select = [this](Button&) {
|
|
if (scan_thread && (entries.size() > current_index)) {
|
|
scan_thread->set_scanning(false); // PAUSE Scanning if necessary
|
|
|
|
// Remove frequency from the Freq List in memory (it is not removed from the file).
|
|
scan_thread->set_freq_del(entries[current_index].freq);
|
|
entries.erase(entries.begin() + current_index);
|
|
|
|
show_max_index(); // UPDATE new list size on screen
|
|
text_current_desc.set(""); // Clean up description (cosmetic detail)
|
|
scan_thread->set_freq_lock(0); // Reset the scanner lock
|
|
}
|
|
};
|
|
|
|
// Button to toggle between Manual Search and Freq List Scan modes
|
|
button_manual_search.on_select = [this](Button&) {
|
|
if (!manual_search) {
|
|
if (!frequency_range.min || !frequency_range.max) {
|
|
nav_.display_modal("Error", "Both START and END freqs\nneed a value");
|
|
} else if (frequency_range.min > frequency_range.max) {
|
|
nav_.display_modal("Error", "END freq\nis lower than START");
|
|
} else {
|
|
manual_search = true; // Switch to Manual Search mode
|
|
}
|
|
} else {
|
|
manual_search = false; // Switch to List Scan mode
|
|
}
|
|
|
|
restart_scan();
|
|
};
|
|
|
|
// Mode field was changed (AM/NFM/WFM)
|
|
field_mode.on_change = [this](size_t, OptionsField::value_t v) {
|
|
// initialize to a value under SPEC
|
|
static freqman_index_t last_mode = WFM_MODULATION;
|
|
// unsupported SPEC mode fix
|
|
if (v >= SPEC_MODULATION) {
|
|
if (last_mode == WFM_MODULATION)
|
|
v = AM_MODULATION;
|
|
else
|
|
v = WFM_MODULATION;
|
|
field_mode.set_selected_index(v);
|
|
}
|
|
last_mode = v;
|
|
receiver_model.disable();
|
|
baseband::shutdown();
|
|
change_mode((freqman_index_t)v);
|
|
if (scan_thread && !scan_thread->is_scanning()) // for some motive, audio output gets stopped.
|
|
audio::output::start(); // So if scan was stopped we resume audio
|
|
receiver_model.enable();
|
|
};
|
|
|
|
// Step field was changed (Hz) -- only affects manual Search mode
|
|
field_step.on_change = [this](size_t, OptionsField::value_t v) {
|
|
receiver_model.set_frequency_step(v);
|
|
|
|
if (manual_search && scan_thread)
|
|
restart_scan();
|
|
};
|
|
|
|
// Button to toggle Forward/Reverse
|
|
button_dir.on_select = [this](Button&) {
|
|
fwd = !fwd;
|
|
if (scan_thread)
|
|
scan_thread->set_scanning_direction(fwd);
|
|
if (userpause) // If user-paused, resume
|
|
user_resume();
|
|
button_dir.set_text(fwd ? "REVERSE" : "FORWARD");
|
|
bigdisplay_update(BDC_GREY); // Back to grey color
|
|
};
|
|
|
|
// Button to add current frequency (found during Search) to the Scan Frequency List
|
|
button_add.on_select = [this](Button&) {
|
|
FreqmanDB db;
|
|
if (db.open(get_freqman_path(freqman_file), /*create*/ true)) {
|
|
freqman_entry entry{
|
|
.frequency_a = current_frequency,
|
|
.type = freqman_type::Single,
|
|
};
|
|
|
|
// Look for existing entry with same frequency.
|
|
auto it = db.find_entry([&entry](const auto& e) {
|
|
return e.frequency_a == entry.frequency_a;
|
|
});
|
|
auto found = (it != db.end());
|
|
|
|
if (found) {
|
|
nav_.display_modal("Error", "Frequency already exists");
|
|
bigdisplay_update(-1); // Need to poke this control after displaying modal?
|
|
} else {
|
|
db.append_entry(entry);
|
|
// Add to frequency_list in memory too, since we can now switch back from manual mode
|
|
// Note that we are allowing freqs to be added to file (code above) that exceed the
|
|
// max count we can load into memory.
|
|
if (entries.size() < FREQMAN_MAX_PER_FILE) {
|
|
entries.push_back({current_frequency, ""});
|
|
show_max_index(); // Display updated frequency list size
|
|
}
|
|
}
|
|
} else {
|
|
nav_.display_modal("Error", "Cannot open " + freqman_file + ".TXT\nfor appending freq.");
|
|
bigdisplay_update(-1); // Need to poke this control after displaying modal?
|
|
}
|
|
};
|
|
|
|
// PRE-CONFIGURATION:
|
|
field_browse_wait.on_change = [this](int32_t v) { browse_wait = v; };
|
|
field_browse_wait.set_value(browse_wait);
|
|
|
|
field_lock_wait.on_change = [this](int32_t v) { lock_wait = v; };
|
|
field_lock_wait.set_value(lock_wait);
|
|
|
|
field_squelch.on_change = [this](int32_t v) { squelch = v; };
|
|
field_squelch.set_value(squelch);
|
|
|
|
// Disable squelch on the model because RSSI handler is where the
|
|
// actual squelching is applied for this app.
|
|
receiver_model.set_squelch_level(0);
|
|
|
|
// LOAD FREQUENCIES
|
|
frequency_file_load(get_freqman_path(freqman_file));
|
|
}
|
|
|
|
void ScannerView::frequency_file_load(const fs::path& path) {
|
|
freqman_index_t def_mod_index{freqman_invalid_index};
|
|
freqman_index_t def_bw_index{freqman_invalid_index};
|
|
freqman_index_t def_step_index{freqman_invalid_index};
|
|
|
|
FreqmanDB db;
|
|
if (!db.open(path)) {
|
|
text_current_desc.set("NO " + path.filename().string());
|
|
return;
|
|
}
|
|
|
|
entries.clear();
|
|
freqman_file = path.stem().string();
|
|
Optional<scanner_range_t> range;
|
|
|
|
for (auto entry : db) {
|
|
if (is_invalid(def_mod_index))
|
|
def_mod_index = entry.modulation;
|
|
|
|
if (is_invalid(def_bw_index))
|
|
def_bw_index = entry.bandwidth;
|
|
|
|
if (is_invalid(def_step_index))
|
|
def_step_index = entry.step;
|
|
|
|
switch (entry.type) {
|
|
case freqman_type::Repeater:
|
|
case freqman_type::Single:
|
|
entries.push_back({entry.frequency_a, entry.description});
|
|
break;
|
|
case freqman_type::HamRadio:
|
|
entries.push_back({entry.frequency_a, "R: " + entry.description});
|
|
entries.push_back({entry.frequency_b, "T: " + entry.description});
|
|
break;
|
|
case freqman_type::Range:
|
|
// NB: Only the first range will be loaded.
|
|
if (!range)
|
|
range = {entry.frequency_a, entry.frequency_b};
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
if (entries.size() >= FREQMAN_MAX_PER_FILE)
|
|
break;
|
|
}
|
|
|
|
if (is_valid(def_mod_index) && def_mod_index != (freqman_index_t)field_mode.selected_index_value())
|
|
field_mode.set_by_value(def_mod_index);
|
|
|
|
if (is_valid(def_bw_index))
|
|
field_bw.set_selected_index(def_bw_index);
|
|
|
|
if (is_valid(def_step_index))
|
|
field_step.set_selected_index(def_step_index);
|
|
|
|
// Found range, set it and update UI.
|
|
if (range) {
|
|
frequency_range = *range;
|
|
button_manual_start.set_text(to_string_short_freq(frequency_range.min));
|
|
button_manual_end.set_text(to_string_short_freq(frequency_range.max));
|
|
}
|
|
|
|
// Scan entries if any, otherwise do manual range search.
|
|
manual_search = entries.empty();
|
|
restart_scan();
|
|
}
|
|
|
|
void ScannerView::update_squelch_while_paused(int32_t max_db) {
|
|
// Update audio & color based on signal level even if paused
|
|
if (++color_timer > 2) { // Counter to reduce color toggling when weak signal
|
|
if (max_db > squelch) {
|
|
audio::output::start(); // Re-enable audio when signal goes above squelch
|
|
receiver_model.set_headphone_volume(receiver_model.headphone_volume()); // quick fix to make sure WM8731S chips don't stay silent after pause
|
|
bigdisplay_update(BDC_GREEN);
|
|
} else {
|
|
audio::output::stop(); // Silence audio when signal drops below squelch
|
|
bigdisplay_update(BDC_GREY); // Back to grey color
|
|
}
|
|
|
|
color_timer = 0;
|
|
}
|
|
}
|
|
|
|
void ScannerView::on_statistics_update(const ChannelStatistics& statistics) {
|
|
if (userpause) {
|
|
update_squelch_while_paused(statistics.max_db);
|
|
} else if (scan_thread) // Scanning not user-paused
|
|
{
|
|
// Resume regardless of signal strength if browse time reached
|
|
if ((browse_wait != 0) && (browse_timer >= (browse_wait * STATISTICS_UPDATES_PER_SEC))) {
|
|
browse_timer = 0;
|
|
scan_resume(); // Resume scanning
|
|
} else {
|
|
if (statistics.max_db > squelch) { // There is something on the air...(statistics.max_db > -squelch)
|
|
if (scan_thread->is_freq_lock() >= MAX_FREQ_LOCK) { // Pause scanning when signal checking time reached
|
|
if (!browse_timer) // Don't bother pausing if already paused
|
|
scan_pause();
|
|
browse_timer++; // browse_timer!=0 is also an indication that we've paused the scan
|
|
update_squelch_while_paused(statistics.max_db);
|
|
} else {
|
|
scan_thread->set_freq_lock(scan_thread->is_freq_lock() + 1); // in lock period, still analyzing the signal
|
|
if (browse_timer) // Continue incrementing browse timer while paused
|
|
browse_timer++;
|
|
}
|
|
lock_timer = 0; // Keep resetting lock timer while signal remains
|
|
} else { // There is NOTHING on the air
|
|
if (!browse_timer) {
|
|
// Signal lost and scan was never paused
|
|
if (scan_thread->is_freq_lock() > 0) { // But are we already in freq_lock ?
|
|
bigdisplay_update(BDC_GREY); // Back to grey color
|
|
scan_thread->set_freq_lock(0); // Reset the scanner lock, since there is no sig
|
|
}
|
|
} else {
|
|
// Signal lost and scan is still paused
|
|
lock_timer++; // Bump paused time
|
|
if (lock_timer >= (lock_wait * STATISTICS_UPDATES_PER_SEC)) { // Stay on freq until lock_wait time elapses
|
|
browse_timer = 0;
|
|
scan_resume();
|
|
} else {
|
|
browse_timer++; // Bump browse time too (may hit that limit before lock_timer reached)
|
|
update_squelch_while_paused(statistics.max_db);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void ScannerView::scan_pause() {
|
|
if (scan_thread && scan_thread->is_scanning()) {
|
|
scan_thread->set_freq_lock(0); // Reset the scanner lock (because user paused, or MAX_FREQ_LOCK reached) for next freq scan
|
|
scan_thread->set_scanning(false); // WE STOP SCANNING
|
|
}
|
|
audio::output::start();
|
|
receiver_model.set_headphone_volume(receiver_model.headphone_volume()); // quick fix to make sure WM8731S chips don't stay silent after pause
|
|
}
|
|
|
|
void ScannerView::scan_resume() {
|
|
audio::output::stop();
|
|
bigdisplay_update(BDC_GREY); // Back to grey color
|
|
|
|
if (scan_thread) {
|
|
scan_thread->set_index_stepper(fwd ? 1 : -1);
|
|
scan_thread->set_scanning(true); // RESUME!
|
|
}
|
|
}
|
|
|
|
void ScannerView::user_resume() {
|
|
browse_timer = browse_wait * STATISTICS_UPDATES_PER_SEC + 1; // Will trigger a scan_resume() on_statistics_update, also advancing to next freq.
|
|
button_pause.set_text("<PAUSE>"); // Show button for pause, arrows indicate rotary encoder enabled for freq change
|
|
userpause = false; // Resume scanning
|
|
}
|
|
|
|
// Before this, do a scan_thread->stop(); After this do a start_scan_thread()
|
|
void ScannerView::change_mode(freqman_index_t new_mod) {
|
|
using option_t = std::pair<std::string, int32_t>;
|
|
using options_t = std::vector<option_t>;
|
|
options_t bw;
|
|
field_bw.on_change = [this](size_t n, OptionsField::value_t) {
|
|
(void)n; // avoid unused warning
|
|
};
|
|
|
|
switch (new_mod) {
|
|
case AM_MODULATION:
|
|
freqman_set_bandwidth_option(new_mod, field_bw);
|
|
baseband::run_image(portapack::spi_flash::image_tag_am_audio);
|
|
receiver_model.set_modulation(ReceiverModel::Mode::AMAudio);
|
|
field_bw.set_by_value(receiver_model.am_configuration());
|
|
field_bw.on_change = [this](size_t, OptionsField::value_t n) { receiver_model.set_am_configuration(n); };
|
|
break;
|
|
case NFM_MODULATION:
|
|
freqman_set_bandwidth_option(new_mod, field_bw);
|
|
baseband::run_image(portapack::spi_flash::image_tag_nfm_audio);
|
|
receiver_model.set_modulation(ReceiverModel::Mode::NarrowbandFMAudio);
|
|
field_bw.set_by_value(receiver_model.nbfm_configuration());
|
|
field_bw.on_change = [this](size_t, OptionsField::value_t n) { receiver_model.set_nbfm_configuration(n); };
|
|
break;
|
|
case WFM_MODULATION:
|
|
freqman_set_bandwidth_option(new_mod, field_bw);
|
|
baseband::run_image(portapack::spi_flash::image_tag_wfm_audio);
|
|
receiver_model.set_modulation(ReceiverModel::Mode::WidebandFMAudio);
|
|
field_bw.set_by_value(receiver_model.wfm_configuration());
|
|
field_bw.on_change = [this](size_t, OptionsField::value_t n) { receiver_model.set_wfm_configuration(n); };
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
void ScannerView::start_scan_thread() {
|
|
receiver_model.enable();
|
|
show_max_index();
|
|
|
|
// Start Scanner Thread
|
|
if (manual_search) {
|
|
button_manual_search.set_text("SCAN"); // Update meaning of Manual Scan button
|
|
text_current_desc.set("SEARCHING...");
|
|
scan_thread = std::make_unique<ScannerThread>(frequency_range, field_step.selected_index_value());
|
|
} else {
|
|
button_manual_search.set_text("SRCH"); // Update meaning of Manual Scan button
|
|
text_current_desc.set(loaded_filename());
|
|
|
|
// TODO: just pass ref to the thread?
|
|
std::vector<rf::Frequency> frequency_list;
|
|
frequency_list.reserve(entries.size());
|
|
for (const auto& entry : entries)
|
|
frequency_list.push_back(entry.freq);
|
|
|
|
scan_thread = std::make_unique<ScannerThread>(std::move(frequency_list));
|
|
}
|
|
|
|
scan_thread->set_scanning_direction(fwd);
|
|
}
|
|
|
|
void ScannerView::restart_scan() {
|
|
audio::output::stop();
|
|
if (scan_thread) // STOP SCANNER THREAD
|
|
scan_thread->stop();
|
|
|
|
if (userpause) // If user-paused, resume
|
|
user_resume();
|
|
|
|
start_scan_thread(); // RESTART SCANNER THREAD in selected mode
|
|
}
|
|
} // namespace ui::external_app::scanner
|