Просмотр исходного кода

BLE Spam: Fix LED indicator bugs

Willy-JL 1 год назад
Родитель
Сommit
cca865dc03
1 измененных файлов с 4 добавлено и 2 удалено
  1. 4 2
      ble_spam/ble_spam.c

+ 4 - 2
ble_spam/ble_spam.c

@@ -186,12 +186,14 @@ const NotificationSequence blink_sequence = {
     NULL,
     NULL,
 };
 };
 static void start_blink(State* state) {
 static void start_blink(State* state) {
+    if(!state->ctx.led_indicator) return;
     uint16_t period = delays[state->delay];
     uint16_t period = delays[state->delay];
     if(period <= 100) period += 30;
     if(period <= 100) period += 30;
     blink_message.data.led_blink.period = period;
     blink_message.data.led_blink.period = period;
     notification_message_block(state->ctx.notification, &blink_sequence);
     notification_message_block(state->ctx.notification, &blink_sequence);
 }
 }
 static void stop_blink(State* state) {
 static void stop_blink(State* state) {
+    if(!state->ctx.led_indicator) return;
     notification_message_block(state->ctx.notification, &sequence_blink_stop);
     notification_message_block(state->ctx.notification, &sequence_blink_stop);
 }
 }
 
 
@@ -228,7 +230,7 @@ static int32_t adv_thread(void* _ctx) {
     Payload* payload = &attacks[state->index].payload;
     Payload* payload = &attacks[state->index].payload;
     const Protocol* protocol = attacks[state->index].protocol;
     const Protocol* protocol = attacks[state->index].protocol;
     if(!payload->random_mac) randomize_mac(state);
     if(!payload->random_mac) randomize_mac(state);
-    if(state->ctx.led_indicator) start_blink(state);
+    start_blink(state);
     if(furi_hal_bt_extra_beacon_is_active()) {
     if(furi_hal_bt_extra_beacon_is_active()) {
         furi_check(furi_hal_bt_extra_beacon_stop());
         furi_check(furi_hal_bt_extra_beacon_stop());
     }
     }
@@ -247,7 +249,7 @@ static int32_t adv_thread(void* _ctx) {
         furi_check(furi_hal_bt_extra_beacon_stop());
         furi_check(furi_hal_bt_extra_beacon_stop());
     }
     }
 
 
-    if(state->ctx.led_indicator) stop_blink(state);
+    stop_blink(state);
     return 0;
     return 0;
 }
 }