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

Merge laser_tag from https://github.com/RocketGod-git/Flipper-Zero-Laser-Tag

Willy-JL 1 год назад
Родитель
Сommit
27cb2f9866
3 измененных файлов с 19 добавлено и 3 удалено
  1. 1 1
      laser_tag/application.fam
  2. 6 1
      laser_tag/docs/CHANGELOG.md
  3. 12 1
      laser_tag/infrared_controller.c

+ 1 - 1
laser_tag/application.fam

@@ -6,7 +6,7 @@ App(
     cdefines=["APP_LASER_TAG"],
     fap_category="Games",
     fap_author="@RocketGod-git & @jamisonderek",
-    fap_version="2.1",
+    fap_version="2.2",
     fap_description="Laser Tag game for Flipper Zero",
     fap_icon="icons/laser_tag_10px.png",
     fap_libs=["assets"],

+ 6 - 1
laser_tag/docs/CHANGELOG.md

@@ -1,3 +1,8 @@
+## v2.2
+
+- Bug fix to avoid hit queueing by CodeAllNight (@jamisonderek)
+
+
 ## v2.1
 
 - Updates to Flipper App Catalog layout by RocketGod (@RocketGod-git)
@@ -5,7 +10,7 @@
 
 ## v2.0
 
-- Add RFID support for ammo reload by codeallnight (@jamisonderek)
+- Add RFID support for ammo reload by CodeAllNight (@jamisonderek)
 - Add external infrared board support by RocketGod (@RocketGod-git)
 
 

+ 12 - 1
laser_tag/infrared_controller.c

@@ -59,6 +59,16 @@ void update_infrared_board_status(InfraredController* controller) {
     }
 }
 
+static int32_t infrared_reset(void* context) {
+    InfraredController* controller = (InfraredController*)context;
+    // furi_stream_buffer_reset(instance->stream) not exposed to the API.
+    // infrared_worker_rx_stop calls it internally.
+    infrared_worker_rx_stop(controller->worker);
+    infrared_worker_rx_start(controller->worker);
+    controller->processing_signal = false;
+    return 0;
+}
+
 static void infrared_rx_callback(void* context, InfraredWorkerSignal* received_signal) {
     FURI_LOG_I(TAG, "RX callback triggered");
 
@@ -99,7 +109,8 @@ static void infrared_rx_callback(void* context, InfraredWorkerSignal* received_s
     }
 
     FURI_LOG_I(TAG, "RX callback completed");
-    controller->processing_signal = false;
+    FuriThread* thread = furi_thread_alloc_ex("InfraredReset", 512, infrared_reset, controller);
+    furi_thread_start(thread);
 }
 
 InfraredController* infrared_controller_alloc() {