Explorar o código

Squashed 'geiger/' changes from 5fc7f1b3c..adc91ec3c

adc91ec3c fix catalog versions
d13f491fd update apps
641794d93 Update app and fix GPIO deinit
80eaf25a8 categories part 1
a75f155a1 more manifestos, xbox controller and videopoker ufbt fixes
279fcf5e0 Add Screenshots
68ea00368 API 31 / unzip sources
REVERT: 5fc7f1b3c Code optimization
REVERT: 944e308e2 add data recording function
REVERT: b4525b717 zoom levels
REVERT: 690c16db0 bug fixing
REVERT: a7b33f7be code refactoring (mutex)
REVERT: a174cdc38 rad unit has been added
REVERT: bf48dca6c more measurement units
REVERT: 7925a42ff code optimization & more events can be handled now
REVERT: c7a8eff6b code fix
REVERT: 5219452d2 add files

git-subtree-dir: geiger
git-subtree-split: adc91ec3ca198cd794a88afaef4f7cd7917f9f42
Willy-JL %!s(int64=2) %!d(string=hai) anos
pai
achega
778fdcab28
Modificáronse 14 ficheiros con 81 adicións e 3 borrados
  1. 64 0
      README.md
  2. 5 1
      application.fam
  3. 12 2
      flipper_geiger.c
  4. BIN=BIN
      img/1.png
  5. BIN=BIN
      img/2.png
  6. BIN=BIN
      img/3.png
  7. BIN=BIN
      img/flipper1.png
  8. BIN=BIN
      img/flipper2.png
  9. BIN=BIN
      img/flipper3.png
  10. BIN=BIN
      img/flipper4.png
  11. BIN=BIN
      img/flipper5.png
  12. BIN=BIN
      img/flipper6.png
  13. BIN=BIN
      img/logo.jpg
  14. BIN=BIN
      img/schematic.jpg

+ 64 - 0
README.md

@@ -0,0 +1,64 @@
+# flipperzero-geigercounter
+A geiger counter application for the Flipper Zero
+
+![banner](https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/logo.jpg)
+
+You need a **geiger counter** board to run this application. This board can be used : https://aliexpress.com/item/1005004074447209.html
+
+The geiger counter board can be powered with +5V power pin of the **Flipper Zero** 
+
+Output pin for measure on arduino cannot be used on the **Flipper Zero** because output voltage is too low. You can use jack out port instead. This port must be connected on **A7** GPIO :
+
+<p align="center"><img src="https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/schematic.jpg" width=75% height=75%></p>
+
+## Build the program
+
+Assuming the toolchain is already installed, copy **flipper_geiger** directory to **applications_user**
+
+Plug your **Flipper Zero** and build the geiger counter :
+```
+./fbt launch_app APPSRC=applications_user/flipper_geiger
+```
+
+The program will automatically be launched after compilation
+
+<img src="https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/flipper1.png" width=25% height=25%>
+
+**A4** GPIO can be connected on **A7** GPIO to test this application without using a geiger tube. **A4** GPIO is generating a signal whose frequency changes every second.
+
+Press Ok button to clear the graph, press back button to quit
+
+If you don't want to build this application, just simply copy **flipper_geiger.fap** on your **Flipper Zero**
+
+## Use cases
+
+Ambient radioactivity :
+
+<img src="https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/flipper2.png" width=25% height=25%>
+
+Measure of uranium ore piece inside a lead container :
+
+<img src="https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/flipper3.png" width=25% height=25%>
+
+Measure of uranium ore piece in contact with the geiger tube :
+
+<img src="https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/flipper4.png" width=25% height=25%>
+
+All previous measures in a row (the scale of the graph is automatically adjusted) :
+
+<img src="https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/flipper5.png" width=25% height=25%>
+
+**A4** GPIO on **A7** GPIO :
+
+<img src="https://github.com/nmrr/flipperzero-geigercounter/blob/main/img/flipper6.png" width=25% height=25%>
+
+## Changelog
+
+* 2023-01-15
+  * Code fix & a lot of optimizations. Now a lot of events can be handled without any issue
+
+* 2023-01-09
+  * Schematic was added & code fix
+
+* 2023-01-08
+  * Initial release

+ 5 - 1
application.fam

@@ -9,5 +9,9 @@ App(
     ],
     stack_size=2 * 1024,
     fap_icon="geiger.png",
-    fap_category="Tools",
+    fap_category="GPIO",
+    fap_author="@nmrr",
+    fap_weburl="https://github.com/nmrr/flipperzero-geigercounter",
+    fap_version="1.1",
+    fap_description="Works with J305 Geiger tube on external board",
 )

+ 12 - 2
flipper_geiger.c

@@ -191,7 +191,13 @@ int32_t flipper_geiger_app()
     furi_timer_start(timer, 1000);
 
     // ENABLE 5V pin
-    furi_hal_power_enable_otg();
+
+    // Enable 5v power, multiple attempts to avoid issues with power chip protection false triggering
+    uint8_t attempts = 0;
+    while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
+        furi_hal_power_enable_otg();
+        furi_delay_ms(10);
+    }
 
     Storage* storage = furi_record_open(RECORD_STORAGE);
     Stream* file_stream = buffered_file_stream_alloc(storage);
@@ -356,11 +362,15 @@ int32_t flipper_geiger_app()
     stream_free(file_stream);
     furi_record_close(RECORD_STORAGE);
 
-    furi_hal_power_disable_otg();
+    // Disable 5v power
+    if(furi_hal_power_is_otg_enabled()) {
+        furi_hal_power_disable_otg();
+    }
 
     furi_hal_gpio_disable_int_callback(&gpio_ext_pa7);
     furi_hal_gpio_remove_int_callback(&gpio_ext_pa7);
     furi_hal_pwm_stop(FuriHalPwmOutputIdLptim2PA4);
+    furi_hal_gpio_init(&gpio_ext_pa7, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
 
     furi_message_queue_free(event_queue);
     furi_mutex_free(mutexVal.mutex);

BIN=BIN
img/1.png


BIN=BIN
img/2.png


BIN=BIN
img/3.png


BIN=BIN
img/flipper1.png


BIN=BIN
img/flipper2.png


BIN=BIN
img/flipper3.png


BIN=BIN
img/flipper4.png


BIN=BIN
img/flipper5.png


BIN=BIN
img/flipper6.png


BIN=BIN
img/logo.jpg


BIN=BIN
img/schematic.jpg