mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2026-09-10 16:49:36 +00:00
Free up some fw space (#2844)
This commit is contained in:
+238
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2020 Shao
|
||||
*
|
||||
* 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_tv.hpp"
|
||||
|
||||
#include "spectrum_color_lut.hpp"
|
||||
|
||||
#include "portapack.hpp"
|
||||
using namespace portapack;
|
||||
|
||||
#include "baseband_api.hpp"
|
||||
|
||||
#include "string_format.hpp"
|
||||
|
||||
#include <cmath>
|
||||
#include <array>
|
||||
|
||||
namespace ui::external_app::analogtv {
|
||||
namespace tv {
|
||||
|
||||
/* TimeScopeView******************************************************/
|
||||
|
||||
TimeScopeView::TimeScopeView(
|
||||
const Rect parent_rect)
|
||||
: View{parent_rect} {
|
||||
set_focusable(true);
|
||||
|
||||
add_children({//&labels,
|
||||
//&field_frequency,
|
||||
&waveform});
|
||||
|
||||
/*field_frequency.on_change = [this](int32_t) {
|
||||
set_dirty();
|
||||
};
|
||||
field_frequency.set_value(10);*/
|
||||
}
|
||||
|
||||
void TimeScopeView::paint(Painter& painter) {
|
||||
const auto r = screen_rect();
|
||||
|
||||
painter.fill_rectangle(r, Color::black());
|
||||
|
||||
// Cursor
|
||||
/*
|
||||
const Rect r_cursor {
|
||||
field_frequency.value() / (48000 / 240), r.bottom() - 32 - cursor_band_height,
|
||||
1, cursor_band_height
|
||||
};
|
||||
painter.fill_rectangle(
|
||||
r_cursor,
|
||||
Color::red()
|
||||
);*/
|
||||
}
|
||||
|
||||
void TimeScopeView::on_audio_spectrum(const AudioSpectrum* spectrum) {
|
||||
for (size_t i = 0; i < spectrum->db.size(); i++)
|
||||
audio_spectrum[i] = ((int16_t)spectrum->db[i] - 127) * 256;
|
||||
waveform.set_dirty();
|
||||
}
|
||||
|
||||
/* TVView *********************************************************/
|
||||
|
||||
void TVView::on_show() {
|
||||
clear();
|
||||
|
||||
const auto screen_r = screen_rect();
|
||||
display.scroll_set_area(screen_r.top(), screen_r.bottom());
|
||||
}
|
||||
|
||||
void TVView::on_hide() {
|
||||
/* TODO: Clear region to eliminate brief flash of content at un-shifted
|
||||
* position?
|
||||
*/
|
||||
display.scroll_disable();
|
||||
}
|
||||
|
||||
void TVView::paint(Painter& painter) {
|
||||
// Do nothing.
|
||||
(void)painter;
|
||||
}
|
||||
|
||||
void TVView::on_adjust_xcorr(uint8_t xcorr) {
|
||||
x_correction = xcorr;
|
||||
}
|
||||
|
||||
void TVView::on_channel_spectrum(
|
||||
const ChannelSpectrum& spectrum) {
|
||||
// portapack has limitations
|
||||
// 1.screen resolution (less than 240x320) 2.samples each call back (128 or 256)
|
||||
// 3.memory size (for ui::Color, the buffer size
|
||||
// spectrum.db[i] is 256 long
|
||||
// 768x625 ->128x625 ->128x312 -> 128x104
|
||||
// originally @6MHz sample rate, the PAL should be 768x625
|
||||
// I reduced sample rate to 2MHz(3 times less samples), then calculate mag (effectively decimate by 2)
|
||||
// the resolution is now changed to 128x625. The total decimation factor is 6, which changes how many samples in a line
|
||||
// However 625 is too large for the screen, also interlaced scanning is harder to realize in portapack than normal computer.
|
||||
// So I decided to simply drop half of the lines, once y is larger than 625/2=312.5 or 312, I recognize it as a new frame.
|
||||
// then the resolution is changed to 128x312
|
||||
// 128x312 is now able to put into a 240x320 screen, but the buffer for a whole frame is 128x312=39936, which is too large
|
||||
// according to my test, I can only make a buffer with a length of 13312 of type ui::Color. which is 1/3 of what I wanted.
|
||||
// So now the resolution is changed to 128x104, the height is shrinked to 1/3 of the original height.
|
||||
// I was expecting to see 1/3 height of original video.
|
||||
|
||||
// Look how nice is that! I am now able to meet the requirements of 1 and 3 for portapack. Also the length of a line is 128
|
||||
// Each call back gives me 256 samples which is exactly 2 lines. What a coincidence!
|
||||
|
||||
// After some experiment, I did some improvements.
|
||||
// 1.I found that instead of 1/3 of the frame is shown, I got 3 whole frames shrinked into one window.
|
||||
// So I made the height twice simply by painting 2 identical lines in the place of original lines
|
||||
// 2.I found sometimes there is an horizontal offset, so I added x_correction to move the frame back to center manually
|
||||
// 3.I changed video_buffer's type, from ui::Color to uint_8, since I don't need 3 digit to represent a grey scale value.
|
||||
// I was hoping that by doing this, I can have a longer buffer like 39936, then the frame will looks better vertically
|
||||
// however this is useless until now.
|
||||
|
||||
for (size_t i = 0; i < 256; i++) {
|
||||
// video_buffer[i+count*256] = spectrum_rgb4_lut[spectrum.db[i]];
|
||||
video_buffer_int[i + count * 256] = 255 - spectrum.db[i];
|
||||
}
|
||||
count = count + 1;
|
||||
if (count == 52 - 1) {
|
||||
ui::Color line_buffer[128];
|
||||
Coord line;
|
||||
uint32_t bmp_px;
|
||||
|
||||
/*for (line = 0; line < 104; line++)
|
||||
{
|
||||
for (bmp_px = 0; bmp_px < 128; bmp_px++)
|
||||
{
|
||||
//line_buffer[bmp_px] = video_buffer[bmp_px+line*128];
|
||||
line_buffer[bmp_px] = spectrum_rgb4_lut[video_buffer_int[bmp_px+line*128 + x_correction]];
|
||||
}
|
||||
|
||||
display.render_line({ 0, line + 100 }, 128, line_buffer);
|
||||
}*/
|
||||
for (line = 0; line < 208; line = line + 2) {
|
||||
for (bmp_px = 0; bmp_px < 128; bmp_px++) {
|
||||
// line_buffer[bmp_px] = video_buffer[bmp_px+line*128];
|
||||
line_buffer[bmp_px] = spectrum_rgb4_lut[video_buffer_int[bmp_px + line / 2 * 128 + x_correction]];
|
||||
}
|
||||
|
||||
display.render_line({0, line + 100}, 128, line_buffer);
|
||||
display.render_line({0, line + 101}, 128, line_buffer);
|
||||
}
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void TVView::clear() {
|
||||
display.fill_rectangle(
|
||||
screen_rect(),
|
||||
Color::black());
|
||||
}
|
||||
|
||||
/* TVWidget *******************************************************/
|
||||
|
||||
TVWidget::TVWidget() {
|
||||
add_children({&tv_view,
|
||||
&field_xcorr});
|
||||
field_xcorr.set_value(10);
|
||||
}
|
||||
|
||||
void TVWidget::on_show() {
|
||||
baseband::spectrum_streaming_start();
|
||||
}
|
||||
|
||||
void TVWidget::on_hide() {
|
||||
baseband::spectrum_streaming_stop();
|
||||
}
|
||||
|
||||
void TVWidget::show_audio_spectrum_view(const bool show) {
|
||||
if ((audio_spectrum_view && show) || (!audio_spectrum_view && !show)) return;
|
||||
|
||||
if (show) {
|
||||
audio_spectrum_view = std::make_unique<TimeScopeView>(audio_spectrum_view_rect);
|
||||
add_child(audio_spectrum_view.get());
|
||||
update_widgets_rect();
|
||||
} else {
|
||||
audio_spectrum_update = false;
|
||||
remove_child(audio_spectrum_view.get());
|
||||
audio_spectrum_view.reset();
|
||||
update_widgets_rect();
|
||||
}
|
||||
}
|
||||
|
||||
void TVWidget::update_widgets_rect() {
|
||||
if (audio_spectrum_view) {
|
||||
tv_view.set_parent_rect(tv_reduced_rect);
|
||||
} else {
|
||||
tv_view.set_parent_rect(tv_normal_rect);
|
||||
}
|
||||
tv_view.on_show();
|
||||
}
|
||||
|
||||
void TVWidget::set_parent_rect(const Rect new_parent_rect) {
|
||||
View::set_parent_rect(new_parent_rect);
|
||||
|
||||
tv_normal_rect = {0, scale_height, new_parent_rect.width(), new_parent_rect.height() - scale_height};
|
||||
tv_reduced_rect = {0, audio_spectrum_height + scale_height, new_parent_rect.width(), new_parent_rect.height() - scale_height - audio_spectrum_height};
|
||||
|
||||
update_widgets_rect();
|
||||
}
|
||||
|
||||
void TVWidget::paint(Painter& painter) {
|
||||
// TODO:
|
||||
(void)painter;
|
||||
}
|
||||
|
||||
void TVWidget::on_channel_spectrum(const ChannelSpectrum& spectrum) {
|
||||
tv_view.on_channel_spectrum(spectrum);
|
||||
tv_view.on_adjust_xcorr(field_xcorr.value());
|
||||
sampling_rate = spectrum.sampling_rate;
|
||||
}
|
||||
|
||||
void TVWidget::on_audio_spectrum() {
|
||||
audio_spectrum_view->on_audio_spectrum(audio_spectrum_data);
|
||||
}
|
||||
|
||||
} /* namespace tv */
|
||||
} // namespace ui::external_app::analogtv
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2020 Shao
|
||||
*
|
||||
* 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_TV_H__
|
||||
#define __UI_TV_H__
|
||||
|
||||
#include "ui.hpp"
|
||||
#include "ui_widget.hpp"
|
||||
|
||||
#include "event_m0.hpp"
|
||||
|
||||
#include "message.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
namespace ui::external_app::analogtv {
|
||||
namespace tv {
|
||||
|
||||
class TimeScopeView : public View {
|
||||
public:
|
||||
TimeScopeView(const Rect parent_rect);
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
|
||||
void on_audio_spectrum(const AudioSpectrum* spectrum);
|
||||
|
||||
private:
|
||||
static constexpr int cursor_band_height = 4;
|
||||
|
||||
int16_t audio_spectrum[128]{0};
|
||||
|
||||
/*Labels labels {
|
||||
{ { 6 * 8,UI_POS_Y(0) }, "Hz", Theme::getInstance()->fg_light->foreground }
|
||||
};*/
|
||||
/*
|
||||
NumberField field_frequency {
|
||||
{ 0 * 8,UI_POS_Y(0) },
|
||||
5,
|
||||
{ 0, 48000 },
|
||||
48000 / 240,
|
||||
' '
|
||||
};*/
|
||||
|
||||
Waveform waveform{
|
||||
{0, 1 * 16 + cursor_band_height, screen_width, 2 * 16},
|
||||
audio_spectrum,
|
||||
128,
|
||||
0,
|
||||
false,
|
||||
Theme::getInstance()->bg_darkest->foreground,
|
||||
true};
|
||||
};
|
||||
|
||||
class TVView : public Widget {
|
||||
public:
|
||||
void on_show() override;
|
||||
void on_hide() override;
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
void on_channel_spectrum(const ChannelSpectrum& spectrum);
|
||||
void on_adjust_xcorr(uint8_t xcorr);
|
||||
// ui::Color video_buffer[13312];
|
||||
uint8_t video_buffer_int[13312 + 128]{0}; // 128 is for the over length caused by x_correction
|
||||
uint32_t count = 0;
|
||||
uint8_t x_correction = 0;
|
||||
|
||||
private:
|
||||
void clear();
|
||||
};
|
||||
|
||||
class TVWidget : public View {
|
||||
public:
|
||||
std::function<void(int32_t offset)> on_select{};
|
||||
|
||||
TVWidget();
|
||||
|
||||
TVWidget(const TVWidget&) = delete;
|
||||
TVWidget(TVWidget&&) = delete;
|
||||
TVWidget& operator=(const TVWidget&) = delete;
|
||||
TVWidget& operator=(TVWidget&&) = delete;
|
||||
|
||||
void on_show() override;
|
||||
void on_hide() override;
|
||||
|
||||
void set_parent_rect(const Rect new_parent_rect) override;
|
||||
|
||||
void show_audio_spectrum_view(const bool show);
|
||||
|
||||
void paint(Painter& painter) override;
|
||||
NumberField field_xcorr{
|
||||
{UI_POS_X(0), UI_POS_Y(0)},
|
||||
5,
|
||||
{0, 128},
|
||||
1,
|
||||
' '};
|
||||
|
||||
private:
|
||||
void update_widgets_rect();
|
||||
|
||||
const Rect audio_spectrum_view_rect{UI_POS_X(0), UI_POS_Y(0), screen_width, 2 * 16 + 20};
|
||||
static constexpr Dim audio_spectrum_height = 16 * 2 + 20;
|
||||
static constexpr Dim scale_height = 20;
|
||||
|
||||
TVView tv_view{};
|
||||
|
||||
ChannelSpectrumFIFO* channel_fifo{nullptr};
|
||||
AudioSpectrum* audio_spectrum_data{nullptr};
|
||||
bool audio_spectrum_update{false};
|
||||
|
||||
std::unique_ptr<TimeScopeView> audio_spectrum_view{};
|
||||
|
||||
int sampling_rate{0};
|
||||
int32_t cursor_position{0};
|
||||
ui::Rect tv_normal_rect{};
|
||||
ui::Rect tv_reduced_rect{};
|
||||
|
||||
MessageHandlerRegistration message_handler_channel_spectrum_config{
|
||||
Message::ID::ChannelSpectrumConfig,
|
||||
[this](const Message* const p) {
|
||||
const auto message = *reinterpret_cast<const ChannelSpectrumConfigMessage*>(p);
|
||||
this->channel_fifo = message.fifo;
|
||||
}};
|
||||
MessageHandlerRegistration message_handler_audio_spectrum{
|
||||
Message::ID::AudioSpectrum,
|
||||
[this](const Message* const p) {
|
||||
const auto message = *reinterpret_cast<const AudioSpectrumMessage*>(p);
|
||||
this->audio_spectrum_data = message.data;
|
||||
this->audio_spectrum_update = true;
|
||||
}};
|
||||
MessageHandlerRegistration message_handler_frame_sync{
|
||||
Message::ID::DisplayFrameSync,
|
||||
[this](const Message* const) {
|
||||
if (this->channel_fifo) {
|
||||
ChannelSpectrum channel_spectrum;
|
||||
while (channel_fifo->out(channel_spectrum)) {
|
||||
this->on_channel_spectrum(channel_spectrum);
|
||||
}
|
||||
}
|
||||
if (this->audio_spectrum_update) {
|
||||
this->audio_spectrum_update = false;
|
||||
this->on_audio_spectrum();
|
||||
}
|
||||
}};
|
||||
|
||||
void on_channel_spectrum(const ChannelSpectrum& spectrum);
|
||||
void on_audio_spectrum();
|
||||
};
|
||||
|
||||
} /* namespace tv */
|
||||
} // namespace ui::external_app::analogtv
|
||||
|
||||
#endif /*__UI_TV_H__*/
|
||||
@@ -21,7 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "bht.hpp"
|
||||
#include "portapack_persistent_memory.hpp"
|
||||
|
||||
namespace ui::external_app::bht_tx {
|
||||
|
||||
|
||||
+1
-1
@@ -207,7 +207,7 @@ class BHTView : public View {
|
||||
"Scan"};
|
||||
|
||||
Checkbox checkbox_flashing{
|
||||
{16 * 8, 25 * 8},
|
||||
{UI_POS_X(16), 25 * 8},
|
||||
8,
|
||||
"Flashing"};
|
||||
NumberField field_speed{
|
||||
|
||||
+75
-73
@@ -1,265 +1,267 @@
|
||||
set(EXTCPPSRC
|
||||
|
||||
#afsk_rx
|
||||
#afsk_rx 16 byte
|
||||
external/afsk_rx/main.cpp
|
||||
external/afsk_rx/ui_afsk_rx.cpp
|
||||
|
||||
#calculator
|
||||
#calculator 632 bytes
|
||||
external/calculator/main.cpp
|
||||
external/calculator/ui_calculator.cpp
|
||||
|
||||
#font_viewer
|
||||
#font_viewer 8 byte?!
|
||||
external/font_viewer/main.cpp
|
||||
external/font_viewer/ui_font_viewer.cpp
|
||||
|
||||
#blespam
|
||||
#blespam 336 bytes - array initializers?
|
||||
external/blespam/main.cpp
|
||||
external/blespam/ui_blespam.cpp
|
||||
|
||||
#analogtv
|
||||
#analogtv 552 bytes
|
||||
external/analogtv/main.cpp
|
||||
external/analogtv/analog_tv_app.cpp
|
||||
external/analogtv/ui_tv.cpp
|
||||
|
||||
#nrf_rx
|
||||
#nrf_rx 40 byte
|
||||
external/nrf_rx/main.cpp
|
||||
external/nrf_rx/ui_nrf_rx.cpp
|
||||
|
||||
#coasterp
|
||||
#coasterp 0 byte
|
||||
external/coasterp/main.cpp
|
||||
external/coasterp/ui_coasterp.cpp
|
||||
|
||||
#lge
|
||||
#lge 120 byte
|
||||
external/lge/main.cpp
|
||||
external/lge/lge_app.cpp
|
||||
external/lge/rfm69.cpp
|
||||
|
||||
#lcr
|
||||
#lcr - 460 byte flash
|
||||
external/lcr/main.cpp
|
||||
external/lcr/ui_lcr.cpp
|
||||
|
||||
#jammer
|
||||
#jammer 144 byte
|
||||
external/jammer/main.cpp
|
||||
external/jammer/ui_jammer.cpp
|
||||
|
||||
#gpssim
|
||||
#gpssim 160 byte
|
||||
external/gpssim/main.cpp
|
||||
external/gpssim/gps_sim_app.cpp
|
||||
|
||||
#spainter
|
||||
#spainter 464 byte
|
||||
external/spainter/main.cpp
|
||||
external/spainter/ui_spectrum_painter.cpp
|
||||
external/spainter/ui_spectrum_painter_text.cpp
|
||||
external/spainter/ui_spectrum_painter_image.cpp
|
||||
|
||||
#keyfob
|
||||
#keyfob 216 byte
|
||||
external/keyfob/main.cpp
|
||||
external/keyfob/ui_keyfob.cpp
|
||||
external/keyfob/ui_keyfob.hpp
|
||||
|
||||
#tetris
|
||||
#tetris 88 byte
|
||||
external/tetris/main.cpp
|
||||
external/tetris/ui_tetris.cpp
|
||||
|
||||
#extsensors
|
||||
|
||||
#extsensors 192 byte
|
||||
external/extsensors/main.cpp
|
||||
external/extsensors/ui_extsensors.cpp
|
||||
external/extsensors/ui_extsensors.hpp
|
||||
|
||||
#foxhunt
|
||||
#foxhunt 0
|
||||
external/foxhunt/main.cpp
|
||||
external/foxhunt/ui_foxhunt_rx.cpp
|
||||
external/foxhunt/ui_foxhunt_rx.hpp
|
||||
|
||||
#audio_test
|
||||
#audio_test 192 byte
|
||||
external/audio_test/main.cpp
|
||||
external/audio_test/ui_audio_test.cpp
|
||||
|
||||
#wardrivemap
|
||||
#wardrivemap 64 byte
|
||||
external/wardrivemap/main.cpp
|
||||
external/wardrivemap/ui_wardrivemap.cpp
|
||||
|
||||
#tpmsrx
|
||||
#tpmsrx 920 byte- possible shared part with baseband
|
||||
external/tpmsrx/main.cpp
|
||||
external/tpmsrx/tpms_app.cpp
|
||||
|
||||
#protoview
|
||||
#protoview 8 byte
|
||||
external/protoview/main.cpp
|
||||
external/protoview/ui_protoview.cpp
|
||||
|
||||
#adsbtx
|
||||
#adsbtx 3544 byte - adsb shared part
|
||||
external/adsbtx/main.cpp
|
||||
external/adsbtx/ui_adsb_tx.cpp
|
||||
|
||||
#morse_tx
|
||||
#morse_tx 768 bytes
|
||||
external/morse_tx/main.cpp
|
||||
external/morse_tx/ui_morse.cpp
|
||||
|
||||
#sstvtx
|
||||
#sstvtx 456 bytes
|
||||
external/sstvtx/main.cpp
|
||||
external/sstvtx/ui_sstvtx.cpp
|
||||
|
||||
#random
|
||||
#random 464 bytes.
|
||||
external/random_password/main.cpp
|
||||
external/random_password/ui_random_password.cpp
|
||||
external/random_password/sha512.cpp
|
||||
external/random_password/sha512.h
|
||||
|
||||
#acars
|
||||
external/acars_rx/main.cpp
|
||||
external/acars_rx/acars_app.cpp
|
||||
#external/acars_rx/main.cpp
|
||||
#external/acars_rx/acars_app.cpp
|
||||
|
||||
#wefax_rx
|
||||
#wefax_rx 192 bytes
|
||||
external/wefax_rx/main.cpp
|
||||
external/wefax_rx/ui_wefax_rx.cpp
|
||||
|
||||
|
||||
#noaaapt_rx
|
||||
#noaaapt_rx 72 bytes
|
||||
external/noaaapt_rx/main.cpp
|
||||
external/noaaapt_rx/ui_noaaapt_rx.cpp
|
||||
|
||||
|
||||
|
||||
#shoppingcart_lock
|
||||
#shoppingcart_lock 272 bytes
|
||||
external/shoppingcart_lock/main.cpp
|
||||
external/shoppingcart_lock/shoppingcart_lock.cpp
|
||||
|
||||
#ookbrute
|
||||
|
||||
#ookbrute 80 byte
|
||||
external/ookbrute/main.cpp
|
||||
external/ookbrute/ui_ookbrute.cpp
|
||||
|
||||
#ook_editor
|
||||
#ook_editor 1808 bytes
|
||||
external/ook_editor/main.cpp
|
||||
external/ook_editor/ui_ook_editor.cpp
|
||||
|
||||
#cvs_spam
|
||||
#cvs_spam 24 byte
|
||||
external/cvs_spam/main.cpp
|
||||
external/cvs_spam/cvs_spam.cpp
|
||||
|
||||
#flippertx
|
||||
#flippertx 712 bytes
|
||||
external/flippertx/main.cpp
|
||||
external/flippertx/ui_flippertx.cpp
|
||||
|
||||
#remote
|
||||
#remote 1664 bytes
|
||||
external/remote/main.cpp
|
||||
external/remote/ui_remote.cpp
|
||||
|
||||
#mcu_temperature
|
||||
#mcu_temperature 112
|
||||
external/mcu_temperature/main.cpp
|
||||
external/mcu_temperature/mcu_temperature.cpp
|
||||
|
||||
#fmradio
|
||||
#fmradio 640
|
||||
external/fmradio/main.cpp
|
||||
external/fmradio/ui_fmradio.cpp
|
||||
|
||||
#tuner
|
||||
#tuner 384
|
||||
external/tuner/main.cpp
|
||||
external/tuner/ui_tuner.cpp
|
||||
|
||||
#metronome
|
||||
#metronome 696 bytes
|
||||
external/metronome/main.cpp
|
||||
external/metronome/ui_metronome.cpp
|
||||
|
||||
#app_manager
|
||||
#app_manager 40 bytes
|
||||
external/app_manager/main.cpp
|
||||
external/app_manager/ui_app_manager.cpp
|
||||
|
||||
#hopper
|
||||
#hopper 472 bytes
|
||||
external/hopper/main.cpp
|
||||
external/hopper/ui_hopper.cpp
|
||||
|
||||
# whip calculator
|
||||
# whip calculator 48 bytes
|
||||
external/antenna_length/main.cpp
|
||||
external/antenna_length/ui_whipcalc.cpp
|
||||
|
||||
# wav viewer
|
||||
# wav viewer 1232 bytes
|
||||
external/wav_view/main.cpp
|
||||
external/wav_view/ui_view_wav.cpp
|
||||
|
||||
# wipe sdcard
|
||||
|
||||
# wipe sdcard 16 byte
|
||||
external/sd_wipe/main.cpp
|
||||
external/sd_wipe/ui_sd_wipe.cpp
|
||||
|
||||
# playlist editor
|
||||
# playlist editor 232 bytes
|
||||
external/playlist_editor/main.cpp
|
||||
external/playlist_editor/ui_playlist_editor.cpp
|
||||
|
||||
#snake
|
||||
#snake 240 bytes
|
||||
external/snake/main.cpp
|
||||
external/snake/ui_snake.cpp
|
||||
|
||||
#stopwatch
|
||||
|
||||
#stopwatch 0
|
||||
external/stopwatch/main.cpp
|
||||
external/stopwatch/ui_stopwatch.cpp
|
||||
|
||||
#breakout
|
||||
#breakout 1144 bytes
|
||||
external/breakout/main.cpp
|
||||
external/breakout/ui_breakout.cpp
|
||||
|
||||
#dinogame
|
||||
#dinogame 0
|
||||
external/dinogame/main.cpp
|
||||
external/dinogame/ui_dinogame.cpp
|
||||
|
||||
#doom
|
||||
#doom 224
|
||||
external/doom/main.cpp
|
||||
external/doom/ui_doom.cpp
|
||||
|
||||
#debug_pmem
|
||||
#debug_pmem 944 byte
|
||||
external/debug_pmem/main.cpp
|
||||
external/debug_pmem/ui_debug_pmem.cpp
|
||||
|
||||
#scanner
|
||||
#scanner 520 byte
|
||||
external/scanner/main.cpp
|
||||
external/scanner/ui_scanner.cpp
|
||||
|
||||
#level
|
||||
#level 24 byte
|
||||
external/level/main.cpp
|
||||
external/level/ui_level.cpp
|
||||
|
||||
#gfxEQ
|
||||
#gfxEQ 80 byte
|
||||
external/gfxeq/main.cpp
|
||||
external/gfxeq/ui_gfxeq.cpp
|
||||
|
||||
#detector_rx
|
||||
#detector_rx 168 byte
|
||||
external/detector_rx/main.cpp
|
||||
external/detector_rx/ui_detector_rx.cpp
|
||||
|
||||
#space_invaders
|
||||
#space_invaders 0 byte
|
||||
external/spaceinv/main.cpp
|
||||
external/spaceinv/ui_spaceinv.cpp
|
||||
|
||||
#blackjack
|
||||
#blackjack 24 byte
|
||||
external/blackjack/main.cpp
|
||||
external/blackjack/ui_blackjack.cpp
|
||||
|
||||
#battleship
|
||||
#battleship 256 byte
|
||||
external/battleship/main.cpp
|
||||
external/battleship/ui_battleship.cpp
|
||||
|
||||
#ert
|
||||
#ert 3040 bytes - has common with baseband, could be renamed the namespace, so both could have it, but not kept in fw.
|
||||
external/ert/main.cpp
|
||||
external/ert/ert_app.cpp
|
||||
|
||||
#epirb_rx
|
||||
#epirb_rx 168 byte flash
|
||||
external/epirb_rx/main.cpp
|
||||
external/epirb_rx/ui_epirb_rx.cpp
|
||||
|
||||
#soundboard
|
||||
#soundboard 272byte - 1236 bytes
|
||||
external/soundboard/main.cpp
|
||||
external/soundboard/soundboard_app.cpp
|
||||
|
||||
#game2048
|
||||
#game2048 - 168 byte flash
|
||||
external/game2048/main.cpp
|
||||
external/game2048/ui_game2048.cpp
|
||||
|
||||
#bht_tx
|
||||
#bht_tx - 3920 byte flash, unknown
|
||||
external/bht_tx/main.cpp
|
||||
external/bht_tx/ui_bht_tx.cpp
|
||||
external/bht_tx/bht.cpp
|
||||
|
||||
#morse_practice
|
||||
#morse_practice - 80 byte flash - bc of array initializers
|
||||
external/morse_practice/main.cpp
|
||||
external/morse_practice/ui_morse_practice.cpp
|
||||
|
||||
#adult_toys_controller
|
||||
#adult_toys_controller 144 bytes
|
||||
external/adult_toys_controller/main.cpp
|
||||
external/adult_toys_controller/ui_adult_toys_controller.cpp
|
||||
)
|
||||
@@ -269,8 +271,8 @@ set(EXTAPPLIST
|
||||
calculator
|
||||
font_viewer
|
||||
blespam
|
||||
nrf_rx
|
||||
analogtv
|
||||
nrf_rx
|
||||
coasterp
|
||||
lge
|
||||
lcr
|
||||
@@ -283,19 +285,19 @@ set(EXTAPPLIST
|
||||
foxhunt_rx
|
||||
audio_test
|
||||
wardrivemap
|
||||
cvs_spam
|
||||
tpmsrx
|
||||
protoview
|
||||
adsbtx
|
||||
morse_tx
|
||||
sstvtx
|
||||
random_password
|
||||
# acars_rx
|
||||
ookbrute
|
||||
ook_editor
|
||||
# acars_rx --not working
|
||||
wefax_rx
|
||||
noaaapt_rx
|
||||
shoppingcart_lock
|
||||
ookbrute
|
||||
ook_editor
|
||||
cvs_spam
|
||||
flippertx
|
||||
remote
|
||||
mcu_temperature
|
||||
|
||||
@@ -79,7 +79,7 @@ class FlipperTxView : public View {
|
||||
void on_tx_progress(const bool done);
|
||||
bool on_file_changed(std::filesystem::path new_file_path);
|
||||
|
||||
std::filesystem::path filename = {};
|
||||
std::filesystem::path filename = "";
|
||||
FlipperProto proto = FLIPPER_PROTO_UNSUPPORTED;
|
||||
FlipperPreset preset = FLIPPER_PRESET_UNK;
|
||||
uint16_t te = 0; // for binraw
|
||||
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2019 Furrtek
|
||||
*
|
||||
* 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 "rfm69.hpp"
|
||||
#include "crc.hpp"
|
||||
#include "portapack_shared_memory.hpp"
|
||||
|
||||
namespace ui::external_app::lge {
|
||||
|
||||
uint32_t RFM69::gen_frame(std::vector<uint8_t>& payload) {
|
||||
CRC<16> crc{0x1021, 0x1D0F, 0xFFFF};
|
||||
std::vector<uint8_t> frame{};
|
||||
uint8_t byte_out = 0;
|
||||
|
||||
// Preamble
|
||||
// Really is 0xAA but the RFM69 skips the very last bit (bug ?)
|
||||
// so the whole preamble is shifted right to simulate that
|
||||
frame.insert(frame.begin(), num_preamble_, 0x55);
|
||||
|
||||
// Sync word
|
||||
frame.push_back(sync_word_ >> 8);
|
||||
frame.push_back(sync_word_ & 0xFF);
|
||||
|
||||
// Payload length
|
||||
payload.insert(payload.begin(), payload.size());
|
||||
|
||||
crc.process_bytes(payload.data(), payload.size());
|
||||
|
||||
if (CRC_) {
|
||||
payload.push_back(crc.checksum() >> 8);
|
||||
payload.push_back(crc.checksum() & 0xFF);
|
||||
}
|
||||
|
||||
// Manchester-encode payload
|
||||
if (manchester_) {
|
||||
for (auto byte : payload) {
|
||||
for (uint32_t b = 0; b < 8; b++) {
|
||||
byte_out <<= 2;
|
||||
|
||||
if (byte & 0x80)
|
||||
byte_out |= 0b10;
|
||||
else
|
||||
byte_out |= 0b01;
|
||||
|
||||
if ((b & 3) == 3)
|
||||
frame.push_back(byte_out);
|
||||
|
||||
byte <<= 1;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
frame.insert(frame.end(), payload.begin(), payload.end());
|
||||
}
|
||||
|
||||
memcpy(shared_memory.bb_data.data, frame.data(), frame.size());
|
||||
|
||||
// Copy for baseband
|
||||
return frame.size();
|
||||
}
|
||||
|
||||
} /* namespace ui::external_app::lge */
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2019 Furrtek
|
||||
*
|
||||
* 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 __RFM69_H__
|
||||
#define __RFM69_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
#include "utility.hpp"
|
||||
|
||||
namespace ui::external_app::lge {
|
||||
|
||||
class RFM69 {
|
||||
public:
|
||||
RFM69(const uint8_t num_preamble, const uint16_t sync_word, const bool CRC, const bool manchester)
|
||||
: num_preamble_(num_preamble), sync_word_(sync_word), CRC_(CRC), manchester_(manchester) {}
|
||||
//~RFM69();
|
||||
|
||||
void set_sync_word(const uint16_t sync_word) {
|
||||
sync_word_ = sync_word;
|
||||
};
|
||||
void set_data_config(const bool CRC, const bool manchester) {
|
||||
CRC_ = CRC;
|
||||
manchester_ = manchester;
|
||||
};
|
||||
void set_num_preamble(const uint8_t num_preamble) {
|
||||
num_preamble_ = num_preamble;
|
||||
};
|
||||
|
||||
uint32_t gen_frame(std::vector<uint8_t>& payload);
|
||||
|
||||
private:
|
||||
uint8_t num_preamble_{5};
|
||||
uint16_t sync_word_{0x2DD4};
|
||||
bool CRC_{true};
|
||||
bool manchester_{false};
|
||||
};
|
||||
|
||||
} /* namespace ui::external_app::lge */
|
||||
|
||||
#endif /*__RFM69_H__*/
|
||||
@@ -231,7 +231,7 @@ void RandomPasswordView::on_data(uint32_t value, bool is_data) {
|
||||
}
|
||||
|
||||
void RandomPasswordView::clean_buffer() {
|
||||
seeds_deque = {};
|
||||
seeds_deque.clear();
|
||||
}
|
||||
|
||||
void RandomPasswordView::on_freqchg(int64_t freq) {
|
||||
@@ -247,6 +247,18 @@ void RandomPasswordView::set_random_freq() {
|
||||
field_frequency.set_value(random_freq);
|
||||
}
|
||||
|
||||
bool RandomPasswordView::islower(char c) {
|
||||
return (c >= 'a' && c <= 'z');
|
||||
}
|
||||
|
||||
bool RandomPasswordView::isupper(char c) {
|
||||
return (c >= 'A' && c <= 'Z');
|
||||
}
|
||||
|
||||
bool RandomPasswordView::isdigit(char c) {
|
||||
return (c >= '0' && c <= '9');
|
||||
}
|
||||
|
||||
void RandomPasswordView::new_password() {
|
||||
if (seeds_deque.size() < MAX_DIGITS * 2) {
|
||||
seeds_buffer_not_full = true;
|
||||
@@ -261,21 +273,21 @@ void RandomPasswordView::new_password() {
|
||||
int password_length = field_digits.value();
|
||||
|
||||
/// charset worker
|
||||
if (check_digits.value())
|
||||
charset += "0123456789";
|
||||
if (check_latin_lower.value())
|
||||
charset += "abcdefghijklmnopqrstuvwxyz";
|
||||
if (check_latin_upper.value())
|
||||
charset += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
if (check_digits.value()) {
|
||||
charset += "23456789";
|
||||
if (check_allow_confusable_chars.value()) charset += "01";
|
||||
}
|
||||
if (check_latin_lower.value()) {
|
||||
charset += "abcdefghijkmnpqrstuvwxyz";
|
||||
if (check_allow_confusable_chars.value()) charset += "ol";
|
||||
}
|
||||
if (check_latin_upper.value()) {
|
||||
charset += "ABCDEFGHIJKLMNPQRSTUVWXYZ";
|
||||
if (check_allow_confusable_chars.value()) charset += "O";
|
||||
}
|
||||
if (check_punctuation.value())
|
||||
charset += ".,-!?";
|
||||
|
||||
if (!check_allow_confusable_chars.value()) {
|
||||
charset.erase(std::remove_if(charset.begin(), charset.end(),
|
||||
[](char c) { return c == '0' || c == 'O' || c == 'o' || c == '1' || c == 'l'; }),
|
||||
charset.end());
|
||||
}
|
||||
|
||||
if (charset.empty()) {
|
||||
text_generated_passwd.set("generate failed,");
|
||||
text_char_type_hints.set("select at least 1 type");
|
||||
@@ -306,11 +318,11 @@ void RandomPasswordView::new_password() {
|
||||
/// hint text worker
|
||||
for (char c : password_chars) {
|
||||
password += c;
|
||||
if (std::isdigit(c)) {
|
||||
if (isdigit(c)) {
|
||||
char_type_hints += "1";
|
||||
} else if (std::islower(c)) {
|
||||
} else if (islower(c)) {
|
||||
char_type_hints += "a";
|
||||
} else if (std::isupper(c)) {
|
||||
} else if (isupper(c)) {
|
||||
char_type_hints += "A";
|
||||
} else {
|
||||
char_type_hints += ",";
|
||||
@@ -360,11 +372,11 @@ void RandomPasswordView::paint_password_hints() {
|
||||
for (size_t i = 0; i < password.length(); i++) {
|
||||
char c = password[i];
|
||||
Color color;
|
||||
if (std::isdigit(c)) {
|
||||
if (isdigit(c)) {
|
||||
color = Color::red();
|
||||
} else if (std::islower(c)) {
|
||||
} else if (islower(c)) {
|
||||
color = Color::green();
|
||||
} else if (std::isupper(c)) {
|
||||
} else if (isupper(c)) {
|
||||
color = Color::blue();
|
||||
} else {
|
||||
color = Color::white();
|
||||
@@ -379,8 +391,8 @@ void RandomPasswordView::paint_password_hints() {
|
||||
|
||||
std::string RandomPasswordView::generate_log_line() {
|
||||
std::string seeds_set = "";
|
||||
for (auto seed : seeds_deque) {
|
||||
seeds_set += std::to_string(seed);
|
||||
for (unsigned int seed : seeds_deque) {
|
||||
seeds_set += to_string_dec_uint(seed);
|
||||
seeds_set += " ";
|
||||
}
|
||||
std::string line = "\npassword=" + password +
|
||||
|
||||
@@ -92,6 +92,10 @@ class RandomPasswordView : public View {
|
||||
std::string generate_log_line();
|
||||
void paint_password_hints();
|
||||
|
||||
bool islower(char c);
|
||||
bool isupper(char c);
|
||||
bool isdigit(char c);
|
||||
|
||||
NavigationView& nav_;
|
||||
RxRadioState radio_state_{};
|
||||
app_settings::SettingsManager settings_{
|
||||
|
||||
Reference in New Issue
Block a user