mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-07 05:29:09 -07:00
Add auto 5V on NRF24 apps --nobuild
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
10
applications/external/nrf24sniff/nrfsniff.c
vendored
10
applications/external/nrf24sniff/nrfsniff.c
vendored
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user