From 9e69335060c330453e9425f9b18529fbb7a9ae20 Mon Sep 17 00:00:00 2001 From: vad7 Date: Sat, 11 Mar 2023 07:45:05 +0300 Subject: [PATCH] auto turn on 5V --- Pics/Screenshot-5.png | Bin 0 -> 2153 bytes README.md | 1 + nrf24batch.c | 43 +++++++++++++++++++++++------------------- 3 files changed, 25 insertions(+), 19 deletions(-) create mode 100644 Pics/Screenshot-5.png diff --git a/Pics/Screenshot-5.png b/Pics/Screenshot-5.png new file mode 100644 index 0000000000000000000000000000000000000000..5640d47c2b308528d4cc82dce5058792018d091d GIT binary patch literal 2153 zcmeHIZ%h+s7=O#ZqDE$P$pm#Jam)O$KgnFx+0}w!0wIDrl-W|iFBIFjs<4){^pD#Y zO;p@WOy=ZILI{&v=_b@F*guIgEE*|ag^uzHr@>&7lQspJZ)va}5WZf5AcE6rIz9SS} z9?mtJLuW$WIbsq2M3erP2_bhwf%86^^&p$K-S4ZbrLwIDG3hB>-+7xl4B_a+jTdtb+(9`%xN0oAP*RR9 z!NKHEr&;4|A8^zt^gSWvaUs=2+n##nARjj98JP~~rKfC=#a(0YK{z=SA2X{{K3p)Z z=d-fWENwGR@xS#^jUtC8Ro4^i5IW$HDcE`xT{2PP1EV3G$VMPU8-Lo~i`9oa(FJU~ z{g!7CAFNT(8eEOVOys;pBhr4%VX#aWxDkND@u)v@T+lTU)xeb6Z0)t!k(k8hs~f=` zRvJN-Sep!$RZMGYBsTjo8uHIAM4<@`V#he62K`g~4!P=5Bev8N(_)y*M+c)2^7QD* zkn~hyxiVzHVvq-Ks$`D5vdVCan%hvVT;EIGo0c}`cT}N_Zx|NW^Y?biB>o5qsm$mE zN)IK*d|ikNl|5P@JIOYs0d68-HsTnz{9z&wI9)gDHkn@4L?lfQ3(d1!V?_)day=uR zciEvLc}1ovOWYkF@EOd$K@IL9EXePmK9=GQ0}Di zoUr_2AN;w3I9#KpO&Emt!3Kq}-RHOllbND9R`1+b12O*|!vA%O{{ZGcgdSUGhZ3I* z>tL@xl62K6A4Q@@11p{Ja5ynLxy>lPs>nB$-;TTAEe#J8Uv?K&N$7w^tRZ+vSE+X(VL zQ(!&6r8rBX)ec-CDx!a*NZE16eN#cWU65}W546I8HknAoXo%BV$pWTDtJN`L1E5vU z`v2;{WF5gUo!fHPpFM+nGo5=_Y3-#L(I;_typ-A6$-=yQRt;31MTvjY48zABW^|OT zMja26I}>@%g#v9T&lzxW3cq1tA&sax)u!uq0RX38Qe}E40)SKaQWjd!@5VE#< +

Mini board for Flipper Zero to connect nRF24l01:

diff --git a/nrf24batch.c b/nrf24batch.c index 258f6e8dbd3..c6e399715e3 100644 --- a/nrf24batch.c +++ b/nrf24batch.c @@ -14,7 +14,7 @@ #include #define TAG "nrf24batch" -#define VERSION "1.5" +#define VERSION "1.6" #define SCAN_APP_PATH_FOLDER "/ext/nrf24batch" #define LOG_FILEEXT ".txt" @@ -133,7 +133,7 @@ char *ReadBatch_cmd_curr = NULL; // =0xFFFFFFFF - finish FuriString **WriteBatch_cmd = NULL; // Names of write batch cmd uint16_t WriteBatch_cmd_Total = 0; uint16_t WriteBatch_cmd_curr = 0; // == _Total - finish -#define POWER_READ_PERIOD 10 // ms +#define POWER_READ_PERIOD 501 // ms uint16_t pwr_read_timer = 0; int Current = 0; int CurrentStart = 0; @@ -294,9 +294,10 @@ void update_power(void) void check_en_power_5V(void) { - if(!furi_hal_power_is_otg_enabled()) { + if(!furi_hal_power_is_otg_enabled() && !furi_hal_power_is_charging()) { FURI_LOG_D("PWR", "NO 5V, TURN ON"); - furi_delay_ms(11); + notification_message(APP->notification, &sequence_blink_yellow_100); + furi_delay_ms(10); update_power(); CurrentStart = Current; furi_hal_power_enable_otg(); @@ -1484,14 +1485,16 @@ int32_t nrf24batch_app(void* p) { what_doing = 2; } } else if(rw_type == rwt_listen) { - free_Log(); - prepare_nrf24(); - if(!NRF_ERROR) { - nrf24_set_rx_mode(nrf24_HANDLE); - ListenNew = false; - send_status = sst_receiving; // receiving + if(listen_addr_len) { + free_Log(); + prepare_nrf24(); + if(!NRF_ERROR) { + nrf24_set_rx_mode(nrf24_HANDLE); + ListenNew = false; + send_status = sst_receiving; // receiving + } + what_doing = 2; } - what_doing = 2; } } else if(what_doing == 2) { if(rw_type == rwt_read_cmd) { @@ -1524,14 +1527,16 @@ int32_t nrf24batch_app(void* p) { } } else if(what_doing == 1) { if(rw_type == rwt_listen) { - char *ebuf = (char*)payload; - ebuf[0] = '\0'; - add_to_str_hex_bytes(ebuf, listen_addr, listen_addr_len); - Edit_hex = true; - Edit_pos = ebuf + strlen(ebuf) - 1; - Edit_start = ebuf; - Edit = 1; - NRF_INITED = 0; + if(listen_addr_len) { + char *ebuf = (char*)payload; + ebuf[0] = '\0'; + add_to_str_hex_bytes(ebuf, listen_addr, listen_addr_len); + Edit_hex = true; + Edit_pos = ebuf + strlen(ebuf) - 1; + Edit_start = ebuf; + Edit = 1; + NRF_INITED = 0; + } } } else if(what_doing == 2) { if(rw_type == rwt_read_cmd) {