Add auto 5V on NRF24 apps --nobuild

This commit is contained in:
Sil333033
2023-08-24 16:13:09 +02:00
parent c326c894df
commit 2fe739a98a
3 changed files with 32 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
#include <stdio.h>
#include <furi.h>
#include <furi_hal_power.h>
#include <gui/gui.h>
#include <input/input.h>
#include <gui/elements.h>
@@ -168,6 +169,12 @@ int32_t nrf24channelscanner_main(void* p) {
Event event;
FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(Event));
uint8_t attempts = 0;
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
furi_delay_ms(10);
}
nrf24_init();
ViewPort* view_port = view_port_alloc();
@@ -247,5 +254,10 @@ int32_t nrf24channelscanner_main(void* p) {
gui_remove_view_port(gui, view_port);
view_port_free(view_port);
furi_record_close(RECORD_GUI);
if(furi_hal_power_is_otg_enabled()) {
furi_hal_power_disable_otg();
}
return 0;
}

View File

@@ -289,6 +289,12 @@ int32_t mousejacker_app(void* p) {
return 255;
}
uint8_t attempts = 0;
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
furi_delay_ms(10);
}
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
// Set system callbacks
@@ -392,5 +398,9 @@ int32_t mousejacker_app(void* p) {
furi_mutex_free(plugin_state->mutex);
free(plugin_state);
if(furi_hal_power_is_otg_enabled()) {
furi_hal_power_disable_otg();
}
return 0;
}

View File

@@ -327,6 +327,12 @@ int32_t nrfsniff_app(void* p) {
return 255;
}
uint8_t attempts = 0;
while(!furi_hal_power_is_otg_enabled() && attempts++ < 5) {
furi_hal_power_enable_otg();
furi_delay_ms(10);
}
nrf24_init();
// Set system callbacks
@@ -464,5 +470,9 @@ int32_t nrfsniff_app(void* p) {
furi_mutex_free(plugin_state->mutex);
free(plugin_state);
if(furi_hal_power_is_otg_enabled()) {
furi_hal_power_disable_otg();
}
return 0;
}