mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-16 04:24:45 -07:00
BLE Spam Bruteforce model codes functionality
This commit is contained in:
@@ -106,6 +106,13 @@ void make_packet(uint8_t* out_size, uint8_t** out_packet, ProtocolCfg* _cfg) {
|
||||
case ProtocolModeValue:
|
||||
model = cfg->data.buds.model;
|
||||
break;
|
||||
case ProtocolModeBruteforce:
|
||||
if(_cfg->bruteforce.counter++ >= 10) {
|
||||
_cfg->bruteforce.counter = 0;
|
||||
if(_cfg->bruteforce.current++ >= 0xFFFFFF) _cfg->bruteforce.current = 0x000000;
|
||||
}
|
||||
model = cfg->data.buds.model = _cfg->bruteforce.current;
|
||||
break;
|
||||
}
|
||||
|
||||
packet[i++] = 27; // Size
|
||||
@@ -153,6 +160,13 @@ void make_packet(uint8_t* out_size, uint8_t** out_packet, ProtocolCfg* _cfg) {
|
||||
case ProtocolModeValue:
|
||||
model = cfg->data.watch.model;
|
||||
break;
|
||||
case ProtocolModeBruteforce:
|
||||
if(_cfg->bruteforce.counter++ >= 10) {
|
||||
_cfg->bruteforce.counter = 0;
|
||||
if(_cfg->bruteforce.current++ >= 0xFF) _cfg->bruteforce.current = 0x00;
|
||||
}
|
||||
model = cfg->data.watch.model = _cfg->bruteforce.current;
|
||||
break;
|
||||
}
|
||||
|
||||
packet[i++] = 14; // Size
|
||||
@@ -287,6 +301,10 @@ static void extra_config(Ctx* ctx) {
|
||||
value_index = buds_models_count + 1;
|
||||
}
|
||||
break;
|
||||
case ProtocolModeBruteforce:
|
||||
model_name = "Bruteforce";
|
||||
value_index = buds_models_count + 1;
|
||||
break;
|
||||
}
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, model_name);
|
||||
@@ -319,6 +337,10 @@ static void extra_config(Ctx* ctx) {
|
||||
value_index = watch_models_count + 1;
|
||||
}
|
||||
break;
|
||||
case ProtocolModeBruteforce:
|
||||
model_name = "Bruteforce";
|
||||
value_index = watch_models_count + 1;
|
||||
break;
|
||||
}
|
||||
variable_item_set_current_value_index(item, value_index);
|
||||
variable_item_set_current_value_text(item, model_name);
|
||||
@@ -360,6 +382,13 @@ static void buds_model_callback(void* _ctx, uint32_t index) {
|
||||
case buds_models_count + 1:
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupBudsModelCustom);
|
||||
break;
|
||||
case buds_models_count + 2:
|
||||
_cfg->mode = ProtocolModeBruteforce;
|
||||
_cfg->bruteforce.counter = 0;
|
||||
_cfg->bruteforce.current = cfg->data.buds.model;
|
||||
_cfg->bruteforce.size = 3;
|
||||
scene_manager_previous_scene(ctx->scene_manager);
|
||||
break;
|
||||
default:
|
||||
_cfg->mode = ProtocolModeValue;
|
||||
cfg->data.buds.model = buds_models[index - 1].value;
|
||||
@@ -394,6 +423,11 @@ void scene_easysetup_buds_model_on_enter(void* _ctx) {
|
||||
selected = buds_models_count + 1;
|
||||
}
|
||||
|
||||
submenu_add_item(submenu, "Bruteforce", buds_models_count + 2, buds_model_callback, ctx);
|
||||
if(_cfg->mode == ProtocolModeBruteforce) {
|
||||
selected = buds_models_count + 2;
|
||||
}
|
||||
|
||||
submenu_set_selected_item(submenu, selected);
|
||||
|
||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
|
||||
@@ -455,6 +489,13 @@ static void watch_model_callback(void* _ctx, uint32_t index) {
|
||||
case watch_models_count + 1:
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupWatchModelCustom);
|
||||
break;
|
||||
case watch_models_count + 2:
|
||||
_cfg->mode = ProtocolModeBruteforce;
|
||||
_cfg->bruteforce.counter = 0;
|
||||
_cfg->bruteforce.current = cfg->data.watch.model;
|
||||
_cfg->bruteforce.size = 1;
|
||||
scene_manager_previous_scene(ctx->scene_manager);
|
||||
break;
|
||||
default:
|
||||
_cfg->mode = ProtocolModeValue;
|
||||
cfg->data.watch.model = watch_models[index - 1].value;
|
||||
@@ -489,6 +530,11 @@ void scene_easysetup_watch_model_on_enter(void* _ctx) {
|
||||
selected = watch_models_count + 1;
|
||||
}
|
||||
|
||||
submenu_add_item(submenu, "Bruteforce", watch_models_count + 2, watch_model_callback, ctx);
|
||||
if(_cfg->mode == ProtocolModeBruteforce) {
|
||||
selected = watch_models_count + 2;
|
||||
}
|
||||
|
||||
submenu_set_selected_item(submenu, selected);
|
||||
|
||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
|
||||
|
||||
Reference in New Issue
Block a user