mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-08-01 19:16:29 -04:00

* 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
88 lines
No EOL
3.5 KiB
C++
88 lines
No EOL
3.5 KiB
C++
/*
|
|
* Copyright (C) 2025 RocketGod
|
|
* Copyright (C) 2025 HTotoo
|
|
*
|
|
* This file is part of PortaPack.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2, or (at your option)
|
|
* any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; see the file COPYING. If not, write to
|
|
* the Free Software Foundation, Inc., 51 Franklin Street,
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
#ifndef __UI_GRAPHEQ_H__
|
|
#define __UI_GRAPHEQ_H__
|
|
|
|
#include "ui_widget.hpp"
|
|
|
|
class GraphEq : public Widget {
|
|
public:
|
|
std::function<void(GraphEq&)> on_select{};
|
|
|
|
GraphEq(Rect parent_rect, bool clickable = false);
|
|
GraphEq(const GraphEq&) = delete;
|
|
GraphEq(GraphEq&&) = delete;
|
|
GraphEq& operator=(const GraphEq&) = delete;
|
|
GraphEq& operator=(GraphEq&&) = delete;
|
|
|
|
bool is_paused() const;
|
|
void set_paused(bool paused);
|
|
bool is_clickable() const;
|
|
|
|
void paint(Painter& painter) override;
|
|
bool on_key(const KeyEvent key) override;
|
|
bool on_touch(const TouchEvent event) override;
|
|
bool on_keyboard(const KeyboardEvent event) override;
|
|
void set_parent_rect(const Rect new_parent_rect) override;
|
|
|
|
void getAccessibilityText(std::string& result) override;
|
|
void getWidgetName(std::string& result) override;
|
|
void update_audio_spectrum(const AudioSpectrum& spectrum);
|
|
void set_theme(Color base_color, Color peak_color);
|
|
|
|
private:
|
|
bool is_calculated{false};
|
|
bool paused_{false};
|
|
bool clickable_{false};
|
|
bool needs_background_redraw{true}; // Redraw background only when needed.
|
|
Color base_color = Color(255, 0, 255);
|
|
Color peak_color = Color(255, 255, 255);
|
|
std::vector<ui::Dim> bar_heights;
|
|
std::vector<ui::Dim> prev_bar_heights;
|
|
|
|
ui::Dim y_top = 2 * 16;
|
|
ui::Dim RENDER_HEIGHT = 288;
|
|
ui::Dim BAR_WIDTH = 20;
|
|
ui::Dim HORIZONTAL_OFFSET = 2;
|
|
static const int NUM_BARS = 11;
|
|
static const int BAR_SPACING = 2;
|
|
static const int SEGMENT_HEIGHT = 10;
|
|
static constexpr std::array<int16_t, NUM_BARS + 1> FREQUENCY_BANDS = {
|
|
375, // Bass warmth and low rumble (e.g., deep basslines, kick drum body)
|
|
750, // Upper bass punch (e.g., bass guitar punch, kick drum attack)
|
|
1500, // Lower midrange fullness (e.g., warmth in vocals, guitar body)
|
|
2250, // Midrange clarity (e.g., vocal presence, snare crack)
|
|
3375, // Upper midrange bite (e.g., instrument definition, vocal articulation)
|
|
4875, // Presence and edge (e.g., guitar bite, vocal sibilance start)
|
|
6750, // Lower brilliance (e.g., cymbal shimmer, vocal clarity)
|
|
9375, // Brilliance and air (e.g., hi-hat crispness, breathy vocals)
|
|
13125, // High treble sparkle (e.g., subtle overtones, synth shimmer)
|
|
16875, // Upper treble airiness (e.g., faint harmonics, room ambiance)
|
|
20625, // Top-end sheen (e.g., ultra-high harmonics, noise floor)
|
|
24375 // Extreme treble limit (e.g., inaudible overtones, signal cutoff, static)
|
|
};
|
|
|
|
void calculate_params(); // re calculate some parameters based on parent_rect()
|
|
};
|
|
|
|
#endif /*__UI_GRAPHEQ_H__*/ |