Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add random ext app #2273

Merged
merged 33 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
e73c227
copy paste from afsk
zxkmm Sep 28, 2024
c06f171
add generate thing
zxkmm Sep 28, 2024
42138b4
todo: remove uneeded code
zxkmm Sep 28, 2024
73765ba
todo: remove uneeded code
zxkmm Sep 28, 2024
7f7e3cf
todo: asycnmsg detect indicate, check way to not use global password
zxkmm Sep 28, 2024
a422378
removed audio
zxkmm Sep 28, 2024
fd93767
add log warn modal
zxkmm Sep 28, 2024
a480b13
small tune
zxkmm Sep 28, 2024
bfcf68d
remove drunk code
zxkmm Sep 29, 2024
d5f60cc
password var global
zxkmm Sep 29, 2024
f7bb842
seed as text instead of console
zxkmm Sep 29, 2024
6ed071b
remove console
zxkmm Sep 29, 2024
8f67ae8
should be almost done
zxkmm Sep 29, 2024
3e3f8a4
naming fix
zxkmm Sep 29, 2024
ff03208
bitmap now moved to seperate folder, that header i deleted isn't rela…
zxkmm Sep 29, 2024
921f177
get cmake format back
zxkmm Sep 29, 2024
d5c2ef7
get cmake format back - try2
zxkmm Sep 29, 2024
fd3b053
try to revert cmake file
zxkmm Sep 29, 2024
60b2f26
get cmake format back - try3
zxkmm Sep 29, 2024
51c455a
get cmake format back - try4
zxkmm Sep 29, 2024
87383ea
move to util
zxkmm Sep 29, 2024
423bb9e
disable amp when launch
zxkmm Sep 29, 2024
35edb7f
refactor name
zxkmm Sep 29, 2024
c4cbc91
cmake fix
zxkmm Sep 29, 2024
548e37c
try to revert cmake file
zxkmm Sep 29, 2024
44c49b9
merge asyncmsg new changes
zxkmm Sep 29, 2024
14ef133
init in methods local var
zxkmm Sep 29, 2024
193545b
user another methods to generate
zxkmm Sep 29, 2024
6b5f83d
change pause to flood
zxkmm Sep 30, 2024
d90c68f
fix log
zxkmm Sep 30, 2024
6c7a656
fine tune
zxkmm Sep 30, 2024
18c45ad
clang format
zxkmm Sep 30, 2024
10ae0b7
fix name
zxkmm Sep 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
change pause to flood
  • Loading branch information
zxkmm committed Sep 30, 2024
commit 6b5f83d7e96903220442d8f16e63bff195853c64
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ RandomPasswordView::RandomPasswordView(NavigationView& nav)
&check_auto_send,
&button_refresh,
&button_show_qr,
&button_pause,
&button_flood,
&button_send,
&field_digits,
&check_allow_confusable_chars,
Expand Down Expand Up @@ -148,13 +148,13 @@ RandomPasswordView::RandomPasswordView(NavigationView& nav)
nav.push<QRCodeView>(password.data());
};

button_pause.on_select = [this](Button&) {
if (paused) {
paused = false;
button_pause.set_text("pause");
button_flood.on_select = [this](Button&) {
if (flooding) {
flooding = false;
button_flood.set_text("flood");
} else {
paused = true;
button_pause.set_text("resume");
flooding = true;
button_flood.set_text("stop");
}
};
button_send.on_select = [this, &nav](Button&) {
Expand Down Expand Up @@ -191,8 +191,6 @@ RandomPasswordView::RandomPasswordView(NavigationView& nav)
}

void RandomPasswordView::on_data(uint32_t value, bool is_data) {
if (paused)
return;
if (is_data) {
seed = static_cast<unsigned int>(value);
text_seed.set(to_string_dec_uint(check_show_seeds.value() ? seed : 0));
Expand All @@ -202,18 +200,23 @@ void RandomPasswordView::on_data(uint32_t value, bool is_data) {
if (seeds_deque.size() > MAX_DIGITS) {
seeds_deque.pop_front();
}

///^ feed deque

progressbar.set_value(seeds_deque.size());

if (flooding && seeds_deque.size() >= MAX_DIGITS) {
new_password();
}

} else {
text_generated_passwd.set("Baudrate estimation: ~");
text_char_type_hints.set(to_string_dec_uint(value));
}
}

void RandomPasswordView::clean_buffer() {
seeds_deque = {0};
seeds_deque = {};
char_deque = {""};
}

Expand All @@ -231,6 +234,12 @@ void RandomPasswordView::set_random_freq() {
}

void RandomPasswordView::new_password() {
if (seeds_deque.size() < MAX_DIGITS) {
seeds_buffer_not_full = true;
text_generated_passwd.set("wait seeds buffer full");
text_char_type_hints.set("then press generate");
return;
}
password = "";
std::string charset = "";
std::string char_type_hints = "";
Expand All @@ -256,13 +265,6 @@ void RandomPasswordView::new_password() {
return;
}

if (seeds_deque.size() < MAX_DIGITS) {
seeds_buffer_not_full = true;
text_generated_passwd.set("wait seeds buffer full");
text_char_type_hints.set("then press generate");
return;
}

int password_length = field_digits.value();

/*the seeds_buffer were feed streaming by AFSK,
Expand Down Expand Up @@ -301,11 +303,17 @@ void RandomPasswordView::new_password() {
str_log = "";
}

if (check_auto_send.value()) {
if (check_auto_send.value() || flooding) {
portapack::async_tx_enabled = true;
// printing out seeds buufer
// for (auto seed : seeds_deque) {
// UsbSerialAsyncmsg::asyncmsg(std::to_string(seed));
// }
UsbSerialAsyncmsg::asyncmsg(password);
portapack::async_tx_enabled = false;
}

clean_buffer();
}

// TODO: why flash and disappeared
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ class RandomPasswordView : public View {
std::deque<unsigned int> seeds_deque = {0};
std::deque<std::string> char_deque = {""};
bool seeds_buffer_not_full = true;
bool in_benchmark = false;
bool flooding = false;
bool logging = false;
std::string str_log{""};

void on_data(uint32_t value, bool is_data);
void clean_buffer();
Expand All @@ -84,10 +88,6 @@ class RandomPasswordView : public View {
app_settings::SettingsManager settings_{
"rx_afsk", app_settings::Mode::RX};

std::string str_log{""};
bool logging{false};
bool paused{false};

Labels labels{
{{0 * 8, 0 * 16}, "------------seeds-------------", Theme::getInstance()->fg_light->foreground},
{{0 * 8, 3 * 16}, "-----------password-----------", Theme::getInstance()->fg_light->foreground},
Expand Down Expand Up @@ -167,12 +167,11 @@ class RandomPasswordView : public View {
Checkbox check_log{
{17 * 8, 10 * 16},
3,
"savin",
false};
"savin"};

Button button_pause{
Button button_flood{
{0 * 8, 15 * 16 + 20, screen_width / 2, 24},
"pause"};
"flood"};

Button button_send{
{screen_width / 2, 15 * 16 + 20, screen_width / 2, 24},
Expand Down