Sfoglia il codice sorgente

BLE Spam: Fix LED indicator bugs

Willy-JL 1 anno fa
parent
commit
cca865dc03
1 ha cambiato i file con 4 aggiunte e 2 eliminazioni
  1. 4 2
      ble_spam/ble_spam.c

+ 4 - 2
ble_spam/ble_spam.c

@@ -186,12 +186,14 @@ const NotificationSequence blink_sequence = {
     NULL,
 };
 static void start_blink(State* state) {
+    if(!state->ctx.led_indicator) return;
     uint16_t period = delays[state->delay];
     if(period <= 100) period += 30;
     blink_message.data.led_blink.period = period;
     notification_message_block(state->ctx.notification, &blink_sequence);
 }
 static void stop_blink(State* state) {
+    if(!state->ctx.led_indicator) return;
     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;
     const Protocol* protocol = attacks[state->index].protocol;
     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()) {
         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());
     }
 
-    if(state->ctx.led_indicator) stop_blink(state);
+    stop_blink(state);
     return 0;
 }