NRF24 plugins updates

Updates by Sil333033 with some changes, furi_hal speaker direct calls was removed and replaced with notification service to avoid bypassing of user set silent mode
This commit is contained in:
MX
2023-07-18 02:53:30 +03:00
parent e2028eb731
commit bb6d3cb796
7 changed files with 85 additions and 45 deletions

View File

@@ -517,4 +517,14 @@ uint8_t nrf24_find_channel(
}
return ch;
}
bool nrf24_check_connected(FuriHalSpiBusHandle* handle) {
uint8_t status = nrf24_status(handle);
if(status != 0x00) {
return true;
} else {
return false;
}
}

View File

@@ -361,6 +361,13 @@ void int32_to_bytes(uint32_t val, uint8_t* out, bool bigendian);
*/
uint32_t bytes_to_int32(uint8_t* bytes, bool bigendian);
/** Check if the nrf24 is connected
* @param handle - pointer to FuriHalSpiHandle
*
* @return true if connected, otherwise false
*/
bool nrf24_check_connected(FuriHalSpiBusHandle* handle);
#ifdef __cplusplus
}
#endif

View File

@@ -10,11 +10,11 @@
#define LOGITECH_MAX_CHANNEL 85
#define COUNT_THRESHOLD 2
#define DEFAULT_SAMPLE_TIME 8000
#define DEFAULT_SAMPLE_TIME 4000
#define MAX_ADDRS 100
#define MAX_CONFIRMED 32
#define NRFSNIFF_APP_PATH_FOLDER "/ext/nrfsniff"
#define NRFSNIFF_APP_PATH_FOLDER STORAGE_APP_DATA_PATH_PREFIX
#define NRFSNIFF_APP_FILENAME "addresses.txt"
#define TAG "nrfsniff"
@@ -341,6 +341,7 @@ int32_t nrfsniff_app(void* p) {
NotificationApp* notification = furi_record_open(RECORD_NOTIFICATION);
Storage* storage = furi_record_open(RECORD_STORAGE);
storage_common_migrate(storage, EXT_PATH("nrfsniff"), NRFSNIFF_APP_PATH_FOLDER);
storage_common_mkdir(storage, NRFSNIFF_APP_PATH_FOLDER);
PluginEvent event;
@@ -387,13 +388,19 @@ int32_t nrfsniff_app(void* p) {
break;
case InputKeyOk:
// toggle sniffing
sniffing_state = !sniffing_state;
if(sniffing_state) {
clear_cache();
start_sniffing();
start = furi_get_tick();
} else
wrap_up(storage, notification);
if(nrf24_check_connected(nrf24_HANDLE)) {
sniffing_state = !sniffing_state;
if(sniffing_state) {
clear_cache();
start_sniffing();
start = furi_get_tick();
} else {
wrap_up(storage, notification);
}
} else {
notification_message(notification, &sequence_error);
}
break;
case InputKeyBack:
if(event.input.type == InputTypeLong) processing = false;