MX 2 anni fa
commit
4a6751c34e

+ 83 - 0
Distr/nrf24batch/CO2_mini.txt

@@ -0,0 +1,83 @@
+Info: CO2 sensor mini
+Address: C8C8CF
+Rate: 1
+Ch: 122
+CRC: 2
+DPL: 0
+RETR: 0x0F
+Resend: 3
+Delay_ms: 30
+ReadCmd repeat: 3
+
+Payload struct: 2,1,1
+ROM=0x41;ROM2=0x42;WROM=0x81;WROM2=0x82;RAM=0x51;RAM2=0x52;WRAM=0x91;WRAM2=0x92;PGM=0x61;SET=0xC0
+
+R default: ,,ROM
+W default: n,,WROM
+Write start: 0,0,0x2F
+
+Listen: C8C8C1=CO2,Alarm,-
+
+R: ID*=,0,0x65
+
+R: _CO2*2=0x6C,,RAM2
+R: _PORTA=0x39,,RAM
+W: _PORTA=,0x3B,WRAM
+R: _PORTB=0x36,,RAM
+W: _PORTB=,0x38,WRAM
+R: _OSCCAL=0x51,,RAM
+W: _OSCCAL=,0x51,WRAM
+R: OSCCAL_EMEM=0
+
+R: RxAddr=1#
+W: RxAddr=,1
+
+R: Ch=2
+W: Ch=,2
+
+R: nRF RETR=3#
+W: nRF RETR=,3
+
+R: Send period=4
+W: Send period=,4
+
+R: CO2 threshold*2=5,,ROM2
+W: CO2 threshold=,5,WROM2
+
+R: CO2 correct*2=7,,ROM2
+W: CO2 correct*2=,7,WROM2
+
+R: FanLSB[10]=i:9#
+W: FanLSB=,i:9
+
+R: Transmit pause=19
+W: Transmit pause=,19
+
+R: Flags=20#
+W: Flags=,20
+
+W: Reset=0xEEEE,14,SET
+
+R: _LED Warning=0x74,,RAM
+W: _LED Warning=,0x74,WRAM
+
+S: LED=,0,SET
+
+SBatch: LED On: LED=1
+SBatch: LED Off: LED=0
+
+RBatch: Settings: ID;RxAddr;Ch;Send period;CO2 threshold;CO2 correct;FanLSB;nRF RETR;Transmit pause;Flags
+
+WBatch: Default: RxAddr=0xCF;Ch=122;Send period=30;CO2 threshold=1000;CO2 correct=0;FanLSB={0xC1,0,0,0,0,0,0,0};nRF RETR=0x3;Transmit pause=1;Flags=0;Reset
+WBatch: CO2: Send period=60;CO2 threshold=1000;CO2 correct=0
+WBatch: Fan: FanLSB={0xC1,0,0,0,0,0,0,0,0,0};Reset
+WBatch: RETR: nRF RETR=0x2F;Reset
+WBatch: Transmit pause: Transmit pause=30
+WBatch: Flags: Flags=0x00
+
+WBatch: LED Warning: _LED Warning=0x30
+WBatch: PORTA: _PORTA=0x0C
+WBatch: PORTB: _PORTB=0xC
+WBatch: OSCCAL: _OSCCAL=128
+
+WBatch: Reset: Reset

+ 83 - 0
Distr/nrf24batch/CO2_mini_old.txt

@@ -0,0 +1,83 @@
+Info: CO2 sensor mini
+Address: C8C8CF
+Rate: 1
+Ch: 122
+CRC: 2
+DPL: 0
+RETR: 0x0F
+Resend: 3
+Delay_ms: 30
+ReadCmd repeat: 3
+
+Payload struct: 2,1,1
+EEPROM=0; RAM=1; PROGMEM=2; ID=3; RESET=4; WRAM=0x89
+
+R default: ,EEPROM,0xC1
+W default: n,,0x81
+Write start: 0,0,0x8F
+
+Listen: C8C8C1=CO2,Alarm,-
+
+R: ID*=,ID
+
+R: _CO2*2=0x6C,RAM,0xC2
+R: _PORTA=0x39,RAM
+W: _PORTA=,0x3B,WRAM
+R: _PORTB=0x36,RAM
+W: _PORTB=,0x38,WRAM
+R: _OSCCAL=0x51,RAM
+W: _OSCCAL=,0x51,WRAM
+R: OSCCAL_EMEM=0
+
+R: RxAddr=1#
+W: RxAddr=,1
+
+R: Ch=2
+W: Ch=,2
+
+R: nRF RETR=3#
+W: nRF RETR=,3
+
+R: Send period=4
+W: Send period=,4
+
+R: CO2 threshold*2=5,,0xC2
+W: CO2 threshold=,5,0x82
+
+R: CO2 correct*2=7,,0xC2
+W: CO2 correct*2=,7,0x82
+
+R: FanLSB[10]=i:9#
+W: FanLSB=,i:9
+
+R: Transmit pause=19
+W: Transmit pause=,19
+
+R: Flags=20#
+W: Flags=,20
+
+W: Reset=,RESET,0xC1
+
+R: _LED Warning=0x74,RAM
+W: _LED Warning=,0x74,WRAM
+
+S: LED=,0,0x40
+
+SBatch: LED On: LED=1
+SBatch: LED Off: LED=0
+
+RBatch: Settings: ID;RxAddr;Ch;Send period;CO2 threshold;CO2 correct;FanLSB;nRF RETR;Transmit pause;Flags
+
+WBatch: Default: RxAddr=0xCF;Ch=122;Send period=30;CO2 threshold=1000;CO2 correct=0;FanLSB={0xC1,0,0,0,0,0,0,0};nRF RETR=0x3;Transmit pause=1;Flags=0;Reset
+WBatch: CO2: CO2 threshold=1000;CO2 correct=0
+WBatch: Fan: FanLSB={0xC1,0,0,0,0,0,0,0,0,0};Reset
+WBatch: RETR: nRF RETR=0x2F;Reset
+WBatch: Transmit pause: Transmit pause=30
+WBatch: Flags: Flags=0x00
+
+WBatch: LED Warning: _LED Warning=0x30
+WBatch: PORTA: _PORTA=0x0C
+WBatch: PORTB: _PORTB=0xC
+WBatch: OSCCAL: _OSCCAL=128
+
+WBatch: Reset: Reset

+ 164 - 0
Distr/nrf24batch/Kitchen Vent Dimmer.txt

@@ -0,0 +1,164 @@
+Info: Kitchen Vent Dimmer
+Address: C8C8C1
+Rate: 1
+Ch: 122
+CRC: 2
+DPL: 0
+RETR: 0x0F
+Resend: 3
+Delay_ms: 30
+
+Payload struct: 2,1,1
+ROM=0x41;ROM2=0x42;WROM=0x81;WROM2=0x82;RAM=0x51;RAM2=0x52;WRAM=0x91;WRAM2=0x92;PGM=0x61;SET=0xC0
+
+R default: ,,ROM
+W default: n,,WROM
+Write start: 0,0,0x2F
+
+R: ID*=,0,0x65
+
+R: CO2 level*2[3]=i:4,,ROM2
+W: CO2 level*2=,i:4,WROM2
+
+R: Fan speeds=25
+W: Fan speeds=,25
+R: FanSpeed[3]=i:19
+W: FanSpeed=,i:19
+R: FanCook speeds=26
+W: FanCook speeds=,26
+R: FanCookSpeed[3]=i:22
+W: FanCookSpeed=,i:22
+
+R: FanOnTime=10
+W: FanOnTime=,10
+
+R: FanOffTime=11
+W: FanOffTime=,11
+
+R: FanCookOnTime=12
+W: FanCookOnTime=,12
+
+R: FanCookOffTime=13
+W: FanCookOffTime=,13
+
+R: FanSleep=14
+W: FanSleep=,14
+
+R: FanCookSleep=15
+W: FanCookSleep=,15
+
+R: SpeedInitIdx=16
+W: SpeedInitIdx=,16
+
+R: SpeedKeyIdx=17
+W: SpeedKeyIdx=,17
+
+R: OutSpeedMax=18
+W: OutSpeedMax=,18
+
+R: PauseSetByCO2,min=27
+W: PauseSetByCO2,min=,27
+
+R: SSR_PulseWidth,us*2=28,,ROM2
+W: SSR_PulseWidth,us*2=,28,WROM2
+
+R: SSR_PulseSafeTime,us*2=30,,ROM2
+W: SSR_PulseSafeTime,us*2=,30,WROM2
+
+R: SSR2_PulseWidth,us*2=32,,ROM2
+W: SSR2_PulseWidth,us*2=,32,WROM2
+
+R: DamperOpenTime=34
+W: DamperOpenTime=,34
+
+!R: FanCookSpIdxDnKey=35
+!W: FanCookSpIdxDnKey=,35
+!R: FanCookSpIdxUpKey=36
+!W: FanCookSpIdxUpKey=,36
+
+R: IRRemotes=35
+W: IRRemotes=,35
+
+R: IRRemotesHash*2[70]=i:36,,ROM2#
+W: IRRemotesHash*2=,i:36,WROM2
+
+R: Flags=1#
+W: Flags=,1
+
+R: RxAddr=2#
+W: RxAddr=,2
+
+R: Ch=3
+W: Ch=,3
+
+R: OSCCAL_EMEM=0
+R: _OSCCAL=0x51,,RAM
+W: _OSCCAL=,0x51,,WRAM
+R: _PORTA=0x39,,RAM
+W: _PORTA=,0x3B,,WRAM
+R: _PORTB=0x36,,RAM
+W: _PORTB=,0x38,WRAM
+
+R: _LED_Warning=0x71,,RAM
+W: _LED_Warning=,0x71,WRAM
+R: _IRHashLast*2=0x89,,RAM2#
+R: _IRCntLast=0x87,,RAM
+R: _IRHash*2=0x8B,,RAM2#
+R: _SleepTimer=0x8E,,RAM
+R: _FanOn=0x7F,,RAM
+R: _FanOnNext=0x7D,,RAM
+R: _FanOnNextCnt=0x7B,,RAM
+R: _FanOnLast=0x7C,,RAM
+
+R: _OutSpeedMax=0x90,,RAM
+W: _OutSpeedMax=,0x90,WRAM
+
+R: _Fanspeed=0x7E,,RAM
+R: _SSR_full_period*2=0x64,,RAM2
+
+R: _PulseDelayAfterZero*2=0x9F,,RAM2
+W: _PulseDelayAfterZero*2=,0x9F,WRAM2
+R: _PulseWidth*2=0x92,,RAM2
+W: _PulseWidth*2=,0x92,WRAM2
+R: _PulseWidth2=0xA3,,RAM
+W: _PulseWidth2=,0xA3,WRAM
+
+W: Reset=0xEEEE,14,SET
+
+S: Lamp=,0,SET
+S: Fan=,1,SET
+S: FanAdd=,2,SET
+S: FanSpdUp=,3,SET
+S: FanSpdDn=,4,SET
+S: FanSpdSave=,5,SET
+S: SetupIR=,6,SET
+
+SBatch: Fan Cooker Max: Fan=6
+SBatch: Fan Cooker Min: Fan=4
+SBatch: Fan Max: Fan=3
+SBatch: Fan Min: Fan=1
+SBatch: Fan Off: Fan=0
+SBatch: Fan +: FanAdd=1
+SBatch: Fan -: FanAdd=-1
+SBatch: Lamp On: Lamp=1
+SBatch: Lamp Off: Lamp=0
+SBatch: Fan Up: FanSpdUp=0
+SBatch: Fan Down: FanSpdDn=0
+SBatch: Fan SAVE: FanSpdSave=0;
+SBatch: Add new IR: SetupIR=1
+
+RBatch: Work: ID;CO2 level;FanCookSpeed;FanCookOnTime;FanCookOffTime;FanCookSleep;FanSpeed;FanOnTime;FanOffTime;FanSleep;DamperOpenTime
+RBatch: Hardware: ID;RxAddr;Ch;SpeedInitIdx;Flags;OutSpeedMax;IRRemotes;SSR_PulseWidth,us;OSCCAL_EMEM
+RBatch: All: ID;CO2 level;FanCookSpeed;FanCookOnTime;FanCookOffTime;FanCookSleep;FanSpeed;FanOnTime;FanOffTime;FanSleep;DamperOpenTime;RxAddr;Ch;SpeedInitIdx;Flags;OutSpeedMax;IRRemotes;IRRemotesHash
+
+WBatch: Init(Cook2spd,Lamp-F2.2): RxAddr=0xC1;Ch=122;CO2 level={870,930,1000};Fan speeds=3;FanSpeed={10,12,16};FanCook speeds=3;FanCookSpeed={12,16,32};FanSleep=20;FanCookSleep=6;FanOnTime=1;FanCookOnTime=3;FanOffTime=100;FanCookOffTime=0;DamperOpenTime=60;SpeedInitIdx=0;SpeedKeyIdx=6;Flags=0x0D;OutSpeedMax=16;SSR_PulseWidth,us=9990
+WBatch: IRRemotes clear: IRRemotes=0
+WBatch: IRRemotes 1 kitchen: IRRemotes=1;IRRemotesHash={0x6DA5,0xFCA5,0x7CA5,0xB425,0x3425,0x1625,0x8525}
+WBatch: Fans Speeds: Fan speeds=3;FanSpeed={10,12,16};FanCook speeds=3;FanCookSpeed={12,16,32}
+WBatch: FanCooker Down/Up key idx: FanCookSpIdxDnKey=2;FanCookSpIdxUpKey=3
+WBatch: LED Warning: _LED Warning=0x10
+WBatch: OSCCAL: _OSCCAL=146
+WBatch: CO2 Level: CO2 level={750,850,1000}
+WBatch: Zero cross EEPROM: SSR_PulseWidth,us=200;SSR2_PulseWidth,us=200;SSR_PulseSafeTime,us=100;Reset
+WBatch: Zero cross RAM: _PulseDelayAfterZero=0001;_PulseWidth=200;_PulseWidth2=200
+WBatch: Reset: Reset

+ 127 - 0
Distr/nrf24batch/Kitchen Vent.txt

@@ -0,0 +1,127 @@
+Info: Kitchen Vent (FanControl)
+Address: C8C8C1
+Rate: 1
+Ch: 122
+CRC: 2
+DPL: 0
+RETR: 0x0F
+Resend: 3
+Delay_ms: 30
+
+Payload struct: 2,1,1
+ROM=0x41;ROM2=0x42;WROM=0x81;WROM2=0x82;RAM=0x51;RAM2=0x52;WRAM=0x91;WRAM2=0x92;PGM=0x61;SET=0xC0
+
+R default: ,,ROM
+W default: n,,WROM
+Write start: 0,0,0x2F
+
+R: ID*=,0,0x65
+
+R: CO2 level*2[3]=i:4,,ROM2
+W: CO2 level*2=,i:4,WROM2
+
+R: Fan speeds=25
+W: Fan speeds=,25
+R: FanSpeed[3]=i:19
+W: FanSpeed=,i:19
+R: FanCook speeds=26
+W: FanCook speeds=,26
+R: FanCookSpeed[3]=i:22
+W: FanCookSpeed=,i:22
+
+R: FanOnTime=10
+W: FanOnTime=,10
+
+R: FanOffTime=11
+W: FanOffTime=,11
+
+R: FanCookOnTime=12
+W: FanCookOnTime=,12
+
+R: FanCookOffTime=13
+W: FanCookOffTime=,13
+
+R: FanSleep=14
+W: FanSleep=,14
+
+R: FanCookSleep=15
+W: FanCookSleep=,15
+
+R: SpeedInitIdx=16
+W: SpeedInitIdx=,16
+
+R: SpeedKeyIdx=17
+W: SpeedKeyIdx=,17
+
+R: IRRemotes=32
+W: IRRemotes=,32
+
+R: IRRemotesHash*2[70]=i:33,,ROM2#
+W: IRRemotesHash*2=,i:33,WROM2
+
+R: OutPeriod=18
+W: OutPeriod=,18
+
+R: Flags=1#
+W: Flags=,1
+
+R: RxAddr=2#
+W: RxAddr=,2
+
+R: Ch=3
+W: Ch=,3
+
+R: OSCCAL_EMEM=0
+R: _OSCCAL=0x51,,RAM
+W: _OSCCAL=,0x51,WRAM
+
+R: _PORTA=0x39,,RAM
+W: _PORTA=,0x3B,WRAM
+R: _PORTB=0x36,,RAM
+W: _PORTB=,0x38,WRAM
+
+R: _OutPeriod=0x8B,,RAM
+W: _OutPeriod=,0x8B,WRAM
+
+R: _Fanspeed=0x74,,RAM
+R: _FanOn=0x75,,RAM
+R: _FanOnNext=0x73,,RAM
+R: _FanOnNextCnt=0x71,,RAM
+R: _FanOnLast=0x72,,RAM
+R: _IRHashLast*2=0x79,,RAM2#
+
+R: _LED Warning=0x6B,,RAM
+W: _LED Warning=,0x6B,WRAM
+
+W: Reset=0xEEEE,14,SET
+
+S: Lamp=,0,SET
+S: Fan=,1,SET
+S: FanSpdUp=,2,SET
+S: FanSpdDn=,3,SET
+S: FanSpdSave=,4,SET
+S: SetupIR=,5,SET
+
+SBatch: Fan Cooker On: Fan=6
+SBatch: Fan On: Fan=3
+SBatch: Fan Off: Fan=0
+SBatch: Lamp On: Lamp=1
+SBatch: Lamp Off: Lamp=0
+SBatch: Fan Up: FanSpdUp=0
+SBatch: Fan Down: FanSpdDn=0
+SBatch: Fan SAVE: FanSpdSave=0;
+SBatch: Add new IR: SetupIR=1
+
+RBatch: Work: ID;CO2 level;FanCookSpeed;FanCookOnTime;FanCookOffTime;FanCookSleep;FanSpeed;FanOnTime;FanOffTime;FanSleep
+RBatch: Hardware: ID;RxAddr;Ch;SpeedInitIdx;Flags;OutPeriod;IRRemotes;OSCCAL_EMEM
+RBatch: All: ID;CO2 level;FanCookSpeed;FanCookOnTime;FanCookOffTime;FanCookSleep;FanSpeed;FanOnTime;FanOffTime;FanSleep;RxAddr;Ch;SpeedInitIdx;Flags;OutPeriod;IRRemotes;IRRemotesHash
+
+WBatch: Init(Cook2spd,Lamp-F2.2): RxAddr=0xC1;Ch=122;CO2 level={950,1050,1200};Fan speeds=1;FanSpeed={1,1,1};FanCook speeds=2;FanCookSpeed={1,2,2};FanSleep=20;FanCookSleep=6;FanOnTime=150;FanCookOnTime=0;FanOffTime=100;FanCookOffTime=0;SpeedInitIdx=0;SpeedKeyIdx=6;Flags=0x0D;OutPeriod=1
+WBatch: IRRemotes clear: IRRemotes=0
+WBatch: IRRemotes 1 kitchen: IRRemotes=1;IRRemotesHash={0x6DA5,0xFCA5,0x7CA5,0xB425,0x3425,0x1625,0x8525}
+WBatch: Fans Speeds: Fan speeds=1;FanSpeed={1,1,1};FanCook speeds=2;FanCookSpeed={1,2,2}
+WBatch: LED Warning: _LED Warning=0x10
+WBatch: OutPeriod: _OutPeriod=1
+WBatch: OSCCAL: _OSCCAL=146
+WBatch: CO2 Level: CO2 level={750,850,1000}
+WBatch: Reset: Reset

+ 674 - 0
LICENSE

@@ -0,0 +1,674 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+  If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+    <program>  Copyright (C) <year>  <name of author>
+    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+  You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<https://www.gnu.org/licenses/>.
+
+  The GNU General Public License does not permit incorporating your program
+into proprietary programs.  If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.  But first, please read
+<https://www.gnu.org/licenses/why-not-lgpl.html>.

BIN
Pics/NRF24_mini_3D.png


BIN
Pics/Screenshot-1.png


BIN
Pics/Screenshot-2.png


BIN
Pics/Screenshot-3.png


BIN
Pics/Screenshot-4.png


BIN
Pics/Screenshot-5.png


BIN
Pics/descript.png


+ 59 - 0
README.md

@@ -0,0 +1,59 @@
+# nRF24-Batch
+Flipper Zero application for nRF24L01 external board. Sends batch commands.
+
+<b>Приложение для Flipper Zero, предназначено для отправки пакетных команд на удаленные устройства, использующие радио nRF24L01.</b><br><br>
+Можно использовать для настройки или чтения данных с удаленного устройства. На удаленной стороне требуется поддержка, ссылка на код для микроконтроллера AVR ниже.<br>
+<br>
+Сначала выбирается файл настройки с описанием команд.  
+Можно отредактировать адрес и номер канала.  
+Затем стрелками влево или вправо выбирается нужный режим:  
+- Пакетное чтение (Read Batch),  
+- Чтение по одной команде (Read cmd),  
+- Пакетная запись (Write Batch),  
+- Пакетная отправка (Set),  
+- Режим прослушивания адреса (Listen).  
+<br>
+Чтение по одной команде - отправка пакета, переключение на прием и отображение на экране, что получили. Длительное нажатие кнопки Ok включает режим автоматического повторного запроса через заданный интервал в секундах (настройка "ReadCmd repeat:").<br><br>
+Пакетное чтение - выполнение подряд нескольких команд чтения.<br><br>
+Пакетная запись - фактически отправка пакетов подряд с нужными данными. Предварительно отправляется пакет "Write start", если эта строка присутствует в файле настроек.<br><br>
+Пакетная отправка - режим пульта, отправка пакетов сразу из списка без вопросов и без преварительного пакета "Write start".<br><br>
+Режим прослушивания - если в файле присутствует строка "Listen: <адрес>=<поле 1>,<поле 2>,...", где "поле.." название поля. Адрес можно менять - долго нажать кнопку Ok.<br><br>
+<br>
+Формат пакета для отправки (payload) задается в виде размера полей структуры в байтах, например, так "Payload struct: 2,1,1", что означает структуру из 3 полей: 2 байта, 1 байт, 1 байт.<br>
+Полученный в ответ пакет (такой же длины как и отправленный) состоит из одного значения (остаток пакета не используется), размерность по умолчанию 1 байт (int8), при необходимости, она задается числом после '*' после имени команды.<br><br>
+Перед отправкой пакета, он заполняется сначала по шаблону по умолчанию "R default" для запроса чтения, "W default" - для записи.<br>
+Поля разделены - ','. Для "W default" есть специальный маркер 'n', говорящий какое поле будет заполняться значением после '=' из команды "WBatch".<br>
+Можно использовать константы по их имени, они задаются в файле в формате "имя=число", число либо десятичное или шестнадцатеричное с префиксом 0x.<br>
+Затем берутся заполненные значения полей из самой команды ("R:" или "W:").<br>
+Если в конце строки с командой чтения символ '#', то считанное значение будет показано в шестнадцатеричном виде.<br><br>
+Пакеты чтения "RBatch:", записи "WBatch:", отправки "SBatch:" состоят из списка имен команд "R:" или "W:"("S:"), соответственно, перечисленных через ";".<br>
+"S:" то же самое, что и "W:", только пакет "Write start" отправлен не будет<br><br>
+Отправка пакета для записи - длительно нажать Ok в списке и подтвердить.<br>
+Перед пакетом команд для записи отправляется пакет "Write start", если эта строка присутствует в файле настроек.<br><br>
+Значение команды для записи можно редактировать - Ok на списке команд, стрелки - +/- и переход по цифрам, завершить - Назад, вставка цифры - Ok, удаление цифры - длительный Ok.<br>
+Из списка команд в пакетах чтения и записи команды можно убирать - для этого нужно долго нажать на кнопку влево и подтвердить.<br>
+Это нужно, например, чтобы убирать те команды в сохраненном пакете для чтения, для которых нет команды записи.<br>
+<br>
+Пример файл [CO2_mini](https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Distr/nrf24batch/CO2_mini.txt)<br>
+Для устройства на Attiny44A, которое отправляет данные с датчика CO2 на контроллеры, управляющие вентиляцией или проветриватели: https://github.com/vad7/CO2-mini<br>
+Управляет вентиляцией на кухне: https://github.com/vad7/Kitchen_Vent<br>
+<br><br>
+Структура [файла настроек](https://raw.githubusercontent.com/vad7/nRF24-Batch/main/descript.txt):  
+
+<img src="https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Pics/descript.png">
+<br>
+<br>
+<img src="https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Pics/Screenshot-1.png">
+<img src="https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Pics/Screenshot-2.png">
+<img src="https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Pics/Screenshot-3.png">
+<img src="https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Pics/Screenshot-4.png">
+<img src="https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Pics/Screenshot-5.png">
+<br>
+<br>
+Mini board for Flipper Zero to connect nRF24l01:<br><br>
+<img src="https://raw.githubusercontent.com/vad7/nRF24-Batch/main/Pics/NRF24_mini_3D.png">
+<br>
+<img src="https://raw.githubusercontent.com/vad7/nrf24scan/master/scheme2.png">
+<br>
+<a href="https://raw.githubusercontent.com/vad7/nrf24scan/master/Gerber_PCB_Flipper%20Zero%20nRF24%20board%20mini_v1_0.zip">Gerber</a> for mini board with 5V - 3.3V converter LM1117-3.3<br>
+<a href="https://oshwlab.com/vad7/flipper-zero-nrf24-board_copy">Easyeda source</a>

+ 20 - 0
application.fam

@@ -0,0 +1,20 @@
+App(
+    appid="nrf24_batch",
+    name="[NRF24] Batch",
+    apptype=FlipperAppType.EXTERNAL,
+    entry_point="nrf24batch_app",
+    cdefines=["APP_NRF24BATCH"],
+    requires=["gui"],
+    stack_size=2 * 1024,
+    order=60,
+    fap_icon="nrf24batch_10px.png",
+    fap_category="GPIO",
+    fap_private_libs=[
+        Lib(
+            name="nrf24",
+            sources=[
+                "nrf24.c",
+            ],
+        ),
+    ],
+)

+ 41 - 0
descript.txt

@@ -0,0 +1,41 @@
+Info: CO2 sensor mini
+Address: C8C8CF   <- nRF24 address (3..5 bytes)
+Rate: 1	          <- nRF24 data rate (0 - 250Kbps, 1 - 1Mbps, 2 - 2Mbps)
+Ch: 121           <- nRF24 channel (0..125)
+CRC: 2            <- nRF24 CRC size
+DPL: 0            <- nRF24 dynamic payload en/dis
+RETR: 0x0F        <- nRF24 SETUP_RETR register (address 04)
+Resend: 3         <- resend attempts on error
+Delay_ms: 30      <- delay between cmd and resend
+ReadCmd repeat: 3 <- seconds (long press "Ok" in ReadCmd mode turn on repeating)
+
+Payload struct: 2,1,1   <- field sizes of send packet in bytes, received packet consists of 1 field with default size 1 byte (int8)
+EEPROM=0; RAM=1; PROGMEM=2; ID=3; RESET=4   <- Constants
+
+R default: ,EEPROM,0xC1     <- default for read
+W default: n,,0x81          <- default for write, 'n' - means field value position
+Write start: 0,0,0x8F       <- if exist in the file - packet before write a batch
+
+R: ID*=,ID                  <- Read cmd, '*' - means string like device ID, payload result in bytes = { 0, 0, 3, 0xC1 }
+R: OSCCAL=0x51,RAM          <- Read cmd, result in bytes = { 0x51, 0, 1, 0xC1 }
+R: OSCCAL_EMEM=0#           <- Read cmd, result in bytes = { 0, 0, 0, 0xC1 }, in the end of line '#' - returned value in hexadecimal format
+R: CO2=0x67,RAM,0xC2        <- Read cmd, result in bytes = { 0x67, 0, 1, 0xC2 }
+
+R: CO2 threshold*2=5,,0xC2  <- Read cmd, '*2' - means received field with 2 bytes size (int16), result in bytes = { 5, 0, 0, 0xC2 }
+W: CO2 threshold=,5,0x82    <- Write cmd, send pkt = { <from WBatch first byte of value>, <from WBatch second byte of value>, 5, 0x82 }
+
+R: FanLSB[10]=i:9           <- Read cmd, '[10]' - means array with 10 elements, 'i:9' - means array index field (9) that will be incemented after each send
+                               result in bytes = 1 pkt: { 9, 0, 0, 0xC1 }, 2 pkt: { 10, 0, 0, 0xC1 }, 3 pkt: { 10, 0, 0, 0xC1 },... total 10 packets
+W: FanLSB=,i:9              <- Write cmd, 'i' - index field. Send packets: { n & 0xFF, n >> 8, 9, 0x81 }, { n & 0xFF, n >> 8, 10, 0x81 },...  
+R: Int16Array*2[10]=i:21    <- Read cmd, array with 10 elements of int16 (2 bytes)
+W: RxAddr=,1                <- Write cmd, payload = { n, 0, 1, 0x81 }
+W: Reset=,RESET,0xC1        <- Send payload = { 0, 0, 4, 0xC1 }
+
+RBatch: Settings: ID;OSCCAL;RxAddr;Ch;nRF RETR;CO2 threshold;CO2 correct;FanLSB   <- Read Batch, 8 packets will be sent and received
+
+WBatch: Default: RxAddr=0xCF;CO2 threshold=1000;Reset  <- Write Batch, Send: { 0,0,0,0x8F }, { 0xCF, 0, 1, 0x81 }, { 0xE8, 0x03, 5, 0x82 }, { 0, 0, 4, 0xC1 }
+WBatch: Fans: FanLSB={0xC2,0xC3,0}                     <- Write Batch, Send: { 0,0,0,0x8F }, { 0xC2, 0, 9, 0x81 }, { 0xC3, 0, 10, 0x81 }
+
+S: Lamp=,0,0x40             <- Set cmd
+SBatch: Lamp On: Lamp=1     <- Set batch
+SBatch: Lamp Off: Lamp=0    <- Set batch

+ 365 - 0
lib/nrf24/nrf24.c

@@ -0,0 +1,365 @@
+// Modified by vad7, 24.02.2023
+//
+#include "nrf24.h"
+#include <furi.h>
+#include <furi_hal.h>
+#include <furi_hal_resources.h>
+#include <assert.h>
+#include <string.h>
+
+void nrf24_init() {
+    furi_hal_spi_bus_handle_init(nrf24_HANDLE);
+    furi_hal_spi_acquire(nrf24_HANDLE);
+    furi_hal_gpio_init(nrf24_CE_PIN, GpioModeOutputPushPull, GpioPullUp, GpioSpeedVeryHigh);
+    furi_hal_gpio_write(nrf24_CE_PIN, false);
+}
+
+void nrf24_deinit() {
+    furi_hal_spi_release(nrf24_HANDLE);
+    furi_hal_spi_bus_handle_deinit(nrf24_HANDLE);
+    furi_hal_gpio_write(nrf24_CE_PIN, false);
+    furi_hal_gpio_init(nrf24_CE_PIN, GpioModeAnalog, GpioPullNo, GpioSpeedLow);
+}
+
+void nrf24_spi_trx(
+    FuriHalSpiBusHandle* handle,
+    uint8_t* tx,
+    uint8_t* rx,
+    uint8_t size) {
+    furi_hal_gpio_write(handle->cs, false);
+    furi_hal_spi_bus_trx(handle, tx, rx, size, nrf24_TIMEOUT);
+    furi_hal_gpio_write(handle->cs, true);
+}
+
+uint8_t nrf24_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data) {
+    uint8_t buf[] = {W_REGISTER | (REGISTER_MASK & reg), data};
+    nrf24_spi_trx(handle, buf, buf, 2);
+    //FURI_LOG_D("NRF_WR", " #%02X=%02X", reg, data);
+    return buf[0];
+}
+
+uint8_t nrf24_write_buf_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data, uint8_t size) {
+    uint8_t buf[size + 1];
+    buf[0] = W_REGISTER | (REGISTER_MASK & reg);
+    memcpy(&buf[1], data, size);
+    nrf24_spi_trx(handle, buf, buf, size + 1);
+    //FURI_LOG_D("NRF_WR", " #%02X(%02X)=0x%02X%02X%02X%02X%02X", reg, size, data[0], data[1], data[2], data[3], data[4] );
+    return buf[0];
+}
+
+uint8_t nrf24_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data, uint8_t size) {
+    uint8_t buf[size + 1];
+    memset(buf, 0, size + 1);
+    buf[0] = R_REGISTER | (REGISTER_MASK & reg);
+    nrf24_spi_trx(handle, buf, buf, size + 1);
+    memcpy(data, &buf[1], size);
+    return buf[0];
+}
+
+uint8_t nrf24_read_register(FuriHalSpiBusHandle* handle, uint8_t reg) {
+    uint8_t buf[] = { R_REGISTER | (REGISTER_MASK & reg), 0 };
+    nrf24_spi_trx(handle, buf, buf, 2);
+    return buf[1];
+}
+
+uint8_t nrf24_flush_rx(FuriHalSpiBusHandle* handle) {
+    uint8_t tx[] = {FLUSH_RX};
+    uint8_t rx[] = {0};
+    nrf24_spi_trx(handle, tx, rx, 1);
+    return rx[0];
+}
+
+uint8_t nrf24_flush_tx(FuriHalSpiBusHandle* handle) {
+    uint8_t tx[] = {FLUSH_TX};
+    uint8_t rx[] = {0};
+    nrf24_spi_trx(handle, tx, rx, 1);
+    return rx[0];
+}
+
+uint8_t nrf24_get_maclen(FuriHalSpiBusHandle* handle) {
+    uint8_t maclen;
+    nrf24_read_reg(handle, REG_SETUP_AW, &maclen, 1);
+    maclen &= 3;
+    return maclen + 2;
+}
+
+uint8_t nrf24_set_maclen(FuriHalSpiBusHandle* handle, uint8_t maclen) {
+    assert(maclen > 1 && maclen < 6);
+    uint8_t status = 0;
+    status = nrf24_write_reg(handle, REG_SETUP_AW, maclen - 2);
+    return status;
+}
+
+uint8_t nrf24_status(FuriHalSpiBusHandle* handle) {
+    uint8_t tx = RF24_NOP;
+    nrf24_spi_trx(handle, &tx, &tx, 1);
+    return tx;
+}
+
+uint32_t nrf24_get_rate(FuriHalSpiBusHandle* handle) {
+    uint8_t setup = 0;
+    uint32_t rate = 0;
+    nrf24_read_reg(handle, REG_RF_SETUP, &setup, 1);
+    setup &= 0x28;
+    if(setup == 0x20)
+        rate = 250000; // 250kbps
+    else if(setup == 0x08)
+        rate = 2000000; // 2Mbps
+    else if(setup == 0x00)
+        rate = 1000000; // 1Mbps
+
+    return rate;
+}
+
+uint8_t nrf24_set_rate(FuriHalSpiBusHandle* handle, uint32_t rate) {
+    uint8_t r6 = 0;
+    uint8_t status = 0;
+    if(!rate) rate = 2000000;
+
+    nrf24_read_reg(handle, REG_RF_SETUP, &r6, 1); // RF_SETUP register
+    r6 = r6 & (~0x28); // Clear rate fields.
+    if(rate == 2000000)
+        r6 = r6 | 0x08;
+    else if(rate == 1000000)
+        r6 = r6;
+    else if(rate == 250000)
+        r6 = r6 | 0x20;
+
+    status = nrf24_write_reg(handle, REG_RF_SETUP, r6); // Write new rate.
+    return status;
+}
+
+uint8_t nrf24_get_chan(FuriHalSpiBusHandle* handle) {
+    uint8_t channel = 0;
+    nrf24_read_reg(handle, REG_RF_CH, &channel, 1);
+    return channel;
+}
+
+uint8_t nrf24_set_chan(FuriHalSpiBusHandle* handle, uint8_t chan) {
+    uint8_t status;
+    status = nrf24_write_reg(handle, REG_RF_CH, chan);
+    return status;
+}
+
+uint8_t nrf24_get_src_mac(FuriHalSpiBusHandle* handle, uint8_t* mac) {
+    uint8_t size = 0;
+    uint8_t status = 0;
+    size = nrf24_get_maclen(handle);
+    status = nrf24_read_reg(handle, REG_RX_ADDR_P0, mac, size);
+    return status;
+}
+
+uint8_t nrf24_set_src_mac(FuriHalSpiBusHandle* handle, uint8_t* mac, uint8_t size) {
+    uint8_t status = 0;
+    uint8_t clearmac[] = {0, 0, 0, 0, 0};
+    nrf24_set_maclen(handle, size);
+    nrf24_write_buf_reg(handle, REG_RX_ADDR_P0, clearmac, 5);
+    status = nrf24_write_buf_reg(handle, REG_RX_ADDR_P0, mac, size);
+    return status;
+}
+
+uint8_t nrf24_get_dst_mac(FuriHalSpiBusHandle* handle, uint8_t* mac) {
+    uint8_t size = 0;
+    uint8_t status = 0;
+    size = nrf24_get_maclen(handle);
+    status = nrf24_read_reg(handle, REG_TX_ADDR, mac, size);
+    return status;
+}
+
+uint8_t nrf24_set_dst_mac(FuriHalSpiBusHandle* handle, uint8_t* mac, uint8_t size) {
+    uint8_t status = 0;
+    uint8_t clearmac[] = {0, 0, 0, 0, 0};
+    nrf24_set_maclen(handle, size);
+    nrf24_write_buf_reg(handle, REG_TX_ADDR, clearmac, 5);
+    status = nrf24_write_buf_reg(handle, REG_TX_ADDR, mac, size);
+    return status;
+}
+
+uint8_t nrf24_get_packetlen(FuriHalSpiBusHandle* handle, uint8_t pipe) {
+    uint8_t len = 0;
+    if(pipe > 5) pipe = 0;
+    nrf24_read_reg(handle, RX_PW_P0 + pipe, &len, 1);
+    return len;
+}
+
+uint8_t nrf24_set_packetlen(FuriHalSpiBusHandle* handle, uint8_t len) {
+    uint8_t status = 0;
+    status = nrf24_write_reg(handle, RX_PW_P0, len);
+    return status;
+}
+
+// packet_size: 0 - dyn payload (read from PL_WID), 1 - read from pipe size, >1 - override
+// Return STATUS reg + additional: RX_DR - new data available, 0x80 - NRF24 hardware error
+uint8_t nrf24_rxpacket(FuriHalSpiBusHandle* handle, uint8_t* packet, uint8_t* ret_packetsize, uint8_t packet_size) {
+    uint8_t status = 0;
+    uint8_t buf[33]; // 32 max payload size + 1 for command
+
+    status = nrf24_status(handle);
+    if(!(status & RX_DR)) {
+        uint8_t st = nrf24_read_register(handle, REG_FIFO_STATUS);
+        if(st == 0xFF || st == 0) return 0x80; // hardware error
+        if((st & 1) == 0) {
+            FURI_LOG_D("NRF", "FIFO PKT");
+            status |= RX_DR; // packet in FIFO buffer
+        }
+    }
+    if(status & RX_DR) {
+        if(status & 0x80) return 0x80; // hardware error
+        if(packet_size == 1)
+            packet_size = nrf24_get_packetlen(handle, (status >> 1) & 7);
+        else if(packet_size == 0){
+            buf[0] = R_RX_PL_WID; buf[1] = 0xFF;
+            nrf24_spi_trx(handle, buf, buf, 2);
+            packet_size = buf[1];
+        }
+        if(packet_size > 32 || packet_size == 0) packet_size = 32;
+        memset(buf, 0, packet_size + 1);
+        buf[0] = R_RX_PAYLOAD;
+        nrf24_spi_trx(handle, buf, buf, packet_size + 1);
+        memcpy(packet, &buf[1], packet_size);
+        nrf24_write_reg(handle, REG_STATUS, RX_DR); // clear RX_DR
+    }
+    if(status & (MAX_RT)) { // MAX_RT
+        nrf24_write_reg(handle, REG_STATUS, (MAX_RT)); // clear MAX_RT.
+    }
+
+    *ret_packetsize = packet_size;
+    return status;
+}
+
+// Return 0 when error
+uint8_t nrf24_txpacket(FuriHalSpiBusHandle* handle, uint8_t* payload, uint8_t size, bool ack) {
+    uint8_t status = 0;
+    uint8_t buf[size + 1];
+    buf[0] = ack ? W_TX_PAYLOAD : W_TX_PAYLOAD_NOACK;
+    memcpy(&buf[1], payload, size);
+    nrf24_set_tx_mode(handle);
+    nrf24_spi_trx(handle, buf, buf, size + 1);
+    uint32_t start_time = furi_get_tick();
+    do {
+        furi_delay_us(100);
+        status = nrf24_status(handle);
+    } while(!(status & (TX_DS | MAX_RT)) && furi_get_tick() - start_time < 100UL);
+    if(status & MAX_RT) {
+        if(furi_log_get_level() == FuriLogLevelDebug) FURI_LOG_D("NRF", "MAX RT: %X (%X)", nrf24_read_register(handle, REG_OBSERVE_TX), status);
+        nrf24_flush_tx(handle);
+    }
+    furi_hal_gpio_write(nrf24_CE_PIN, false);
+    //nrf24_set_idle(handle);
+    if(status & (TX_DS | MAX_RT)) nrf24_write_reg(handle, REG_STATUS, TX_DS | MAX_RT);
+    return status & TX_DS;
+}
+
+uint8_t nrf24_power_up(FuriHalSpiBusHandle* handle) {
+    uint8_t status = 0;
+    uint8_t cfg = 0;
+    nrf24_read_reg(handle, REG_CONFIG, &cfg, 1);
+    cfg = cfg | 2;
+    status = nrf24_write_reg(handle, REG_CONFIG, cfg);
+    //furi_delay_ms(1000);
+    return status;
+}
+
+uint8_t nrf24_set_idle(FuriHalSpiBusHandle* handle) {
+    uint8_t status = 0;
+    uint8_t cfg = 0;
+    nrf24_read_reg(handle, REG_CONFIG, &cfg, 1);
+    cfg &= 0xfc; // clear bottom two bits to power down the radio
+    status = nrf24_write_reg(handle, REG_CONFIG, cfg);
+    furi_hal_gpio_write(nrf24_CE_PIN, false);
+    return status;
+}
+
+uint8_t nrf24_set_rx_mode(FuriHalSpiBusHandle* handle) {
+    uint8_t cfg = 0;
+    cfg = nrf24_read_register(handle, REG_CONFIG);
+    cfg |= 0x03; // PWR_UP, and PRIM_RX
+    cfg = nrf24_write_reg(handle, REG_CONFIG, cfg);
+    furi_hal_gpio_write(nrf24_CE_PIN, true);
+    return cfg;
+}
+
+uint8_t nrf24_set_tx_mode(FuriHalSpiBusHandle* handle) {
+    uint8_t reg;
+    furi_hal_gpio_write(nrf24_CE_PIN, false);
+    //nrf24_write_reg(handle, REG_STATUS, TX_DS | MAX_RT);
+    reg = nrf24_read_register(handle, REG_CONFIG);
+    reg &= ~0x01; // disable PRIM_RX
+    reg |= 0x02; // PWR_UP
+    reg = nrf24_write_reg(handle, REG_CONFIG, reg);
+    furi_hal_gpio_write(nrf24_CE_PIN, true);
+    return reg;
+}
+
+void hexlify(uint8_t* in, uint8_t size, char* out) {
+    memset(out, 0, size * 2);
+    for(int i = 0; i < size; i++)
+        snprintf(out + strlen(out), sizeof(out + strlen(out)), "%02X", in[i]);
+}
+
+uint64_t bytes_to_int64(uint8_t* bytes, uint8_t size, bool bigendian) {
+    uint64_t ret = 0;
+    for(int i = 0; i < size; i++)
+        if(bigendian)
+            ret |= bytes[i] << ((size - 1 - i) * 8);
+        else
+            ret |= bytes[i] << (i * 8);
+
+    return ret;
+}
+
+void int64_to_bytes(uint64_t val, uint8_t* out, bool bigendian) {
+    for(int i = 0; i < 8; i++) {
+        if(bigendian)
+            out[i] = (val >> ((7 - i) * 8)) & 0xff;
+        else
+            out[i] = (val >> (i * 8)) & 0xff;
+    }
+}
+
+uint32_t bytes_to_int32(uint8_t* bytes, bool bigendian) {
+    uint32_t ret = 0;
+    for(int i = 0; i < 4; i++)
+        if(bigendian)
+            ret |= bytes[i] << ((3 - i) * 8);
+        else
+            ret |= bytes[i] << (i * 8);
+
+    return ret;
+}
+
+void int32_to_bytes(uint32_t val, uint8_t* out, bool bigendian) {
+    for(int i = 0; i < 4; i++) {
+        if(bigendian)
+            out[i] = (val >> ((3 - i) * 8)) & 0xff;
+        else
+            out[i] = (val >> (i * 8)) & 0xff;
+    }
+}
+
+uint64_t bytes_to_int16(uint8_t* bytes, bool bigendian) {
+    uint16_t ret = 0;
+    for(int i = 0; i < 2; i++)
+        if(bigendian)
+            ret |= bytes[i] << ((1 - i) * 8);
+        else
+            ret |= bytes[i] << (i * 8);
+
+    return ret;
+}
+
+void int16_to_bytes(uint16_t val, uint8_t* out, bool bigendian) {
+    for(int i = 0; i < 2; i++) {
+        if(bigendian)
+            out[i] = (val >> ((1 - i) * 8)) & 0xff;
+        else
+            out[i] = (val >> (i * 8)) & 0xff;
+    }
+}
+
+uint8_t nrf24_set_mac(uint8_t mac_addr, uint8_t *mac, uint8_t mlen)
+{
+    uint8_t addr[5];
+	for(int i = 0; i < mlen; i++) addr[i] = mac[mlen - i - 1];
+	return nrf24_write_buf_reg(nrf24_HANDLE, mac_addr, addr, mlen);
+}

+ 386 - 0
lib/nrf24/nrf24.h

@@ -0,0 +1,386 @@
+#pragma once
+#include <stdbool.h>
+#include <stdint.h>
+#include <furi_hal_spi.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define R_REGISTER 0x00
+#define W_REGISTER 0x20
+#define REGISTER_MASK 0x1F
+#define ACTIVATE 0x50
+#define R_RX_PL_WID 0x60
+#define R_RX_PAYLOAD 0x61
+#define W_TX_PAYLOAD 0xA0
+#define W_TX_PAYLOAD_NOACK 0xB0
+#define W_ACK_PAYLOAD 0xA8
+#define FLUSH_TX 0xE1
+#define FLUSH_RX 0xE2
+#define REUSE_TX_PL 0xE3
+#define RF24_NOP 0xFF
+
+#define REG_CONFIG 0x00
+#define REG_EN_AA 0x01
+#define REG_EN_RXADDR 0x02
+#define REG_SETUP_AW 0x03
+#define REG_SETUP_RETR 0x04
+#define REG_DYNPD 0x1C
+#define REG_FEATURE 0x1D
+#define REG_RF_SETUP 0x06
+#define REG_STATUS 0x07
+#define REG_RX_ADDR_P0 0x0A
+#define REG_RX_ADDR_P1 0x0B
+#define REG_RX_ADDR_P2 0x0C
+#define REG_RX_ADDR_P3 0x0D
+#define REG_RX_ADDR_P4 0x0E
+#define REG_RX_ADDR_P5 0x0F
+#define REG_RF_CH 0x05
+#define REG_TX_ADDR 0x10
+#define REG_FIFO_STATUS 0x17
+#define REG_OBSERVE_TX 0x08
+
+#define RX_PW_P0 0x11
+#define RX_PW_P1 0x12
+#define RX_PW_P2 0x13
+#define RX_PW_P3 0x14
+#define RX_PW_P4 0x15
+#define RX_PW_P5 0x16
+#define RX_DR    0x40
+#define TX_DS    0x20
+#define MAX_RT   0x10
+#define NRF24_EN_DYN_ACK 0x01
+
+#define nrf24_TIMEOUT 500
+#define nrf24_CE_PIN &gpio_ext_pb2
+#define nrf24_HANDLE &furi_hal_spi_bus_handle_external
+
+/* Low level API */
+
+/** Write device register
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      reg     - register
+ * @param      data    - data to write
+ *
+ * @return     device status
+ */
+uint8_t nrf24_write_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t data);
+
+/** Write buffer to device register
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      reg     - register
+ * @param      data    - data to write
+ * @param      size    - size of data to write
+ *
+ * @return     device status
+ */
+uint8_t nrf24_write_buf_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data, uint8_t size);
+
+/** Read device register
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      reg     - register
+ * @param[out] data    - pointer to data
+ *
+ * @return     device status
+ */
+uint8_t nrf24_read_reg(FuriHalSpiBusHandle* handle, uint8_t reg, uint8_t* data, uint8_t size);
+
+// Read single register (1 byte)
+uint8_t nrf24_read_register(FuriHalSpiBusHandle* handle, uint8_t reg);
+
+/** Power up the radio for operation
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_power_up(FuriHalSpiBusHandle* handle);
+
+/** Power down the radio
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_idle(FuriHalSpiBusHandle* handle);
+
+/** Sets the radio to RX mode
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_rx_mode(FuriHalSpiBusHandle* handle);
+
+/** Sets the radio to TX mode
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_tx_mode(FuriHalSpiBusHandle* handle);
+
+/*=============================================================================================================*/
+
+/* High level API */
+
+/** Must call this before using any other nrf24 API
+ * 
+ */
+void nrf24_init();
+
+/** Must call this when we end using nrf24 device
+ * 
+ */
+void nrf24_deinit();
+
+/** Send flush rx command
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ *
+ * @return     device status
+ */
+uint8_t nrf24_flush_rx(FuriHalSpiBusHandle* handle);
+
+/** Send flush tx command
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ *
+ * @return     device status
+ */
+uint8_t nrf24_flush_tx(FuriHalSpiBusHandle* handle);
+
+/** Gets the RX packet length in data pipe 0
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ *             pipe - pipe index (0..5)
+ * @return     packet length in data pipe 0
+ */
+uint8_t nrf24_get_packetlen(FuriHalSpiBusHandle* handle, uint8_t pipe);
+
+/** Sets the RX packet length in data pipe 0
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      len - length to set
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_packetlen(FuriHalSpiBusHandle* handle, uint8_t len);
+
+/** Gets configured length of MAC address
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     MAC address length
+ */
+uint8_t nrf24_get_maclen(FuriHalSpiBusHandle* handle);
+
+/** Sets configured length of MAC address
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      maclen - length to set MAC address to, must be greater than 1 and less than 6
+ * 
+ * @return     MAC address length
+ */
+uint8_t nrf24_set_maclen(FuriHalSpiBusHandle* handle, uint8_t maclen);
+
+/** Gets the current status flags from the STATUS register
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     status flags
+ */
+uint8_t nrf24_status(FuriHalSpiBusHandle* handle);
+
+/** Gets the current transfer rate
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     transfer rate in bps
+ */
+uint32_t nrf24_get_rate(FuriHalSpiBusHandle* handle);
+
+/** Sets the transfer rate
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      rate - the transfer rate in bps
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_rate(FuriHalSpiBusHandle* handle, uint32_t rate);
+
+/** Gets the current channel
+ * In nrf24, the channel number is multiplied times 1MHz and added to 2400MHz to get the frequency
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * 
+ * @return     channel
+ */
+uint8_t nrf24_get_chan(FuriHalSpiBusHandle* handle);
+
+/** Sets the channel
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      frequency - the frequency in hertz
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_chan(FuriHalSpiBusHandle* handle, uint8_t chan);
+
+/** Gets the source mac address
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param[out] mac - the source mac address
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_get_src_mac(FuriHalSpiBusHandle* handle, uint8_t* mac);
+
+/** Sets the source mac address
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      mac - the mac address to set
+ * @param      size - the size of the mac address (2 to 5)
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_src_mac(FuriHalSpiBusHandle* handle, uint8_t* mac, uint8_t size);
+
+/** Gets the dest mac address
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param[out] mac - the source mac address
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_get_dst_mac(FuriHalSpiBusHandle* handle, uint8_t* mac);
+
+/** Sets the dest mac address
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      mac - the mac address to set
+ * @param      size - the size of the mac address (2 to 5)
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_set_dst_mac(FuriHalSpiBusHandle* handle, uint8_t* mac, uint8_t size);
+
+/** Reads RX packet
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param[out] packet - the packet contents
+ * @param[out] ret_packetsize - size of the received packet
+ * @param      packet_size: >1 - size, 1 - packet length is determined by RX_PW_P0 register, 0 - it is determined by dynamic payload length command
+ * 
+ * @return     device status
+ */
+uint8_t
+    nrf24_rxpacket(FuriHalSpiBusHandle* handle, uint8_t* packet, uint8_t* ret_packetsize, uint8_t packet_size_flag);
+
+/** Sends TX packet
+ *
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      packet - the packet contents
+ * @param      size - packet size
+ * @param      ack - boolean to determine whether an ACK is required for the packet or not
+ * 
+ * @return     device status
+ */
+uint8_t nrf24_txpacket(FuriHalSpiBusHandle* handle, uint8_t* payload, uint8_t size, bool ack);
+
+/** Configure the radio
+ * This is not comprehensive, but covers a lot of the common configuration options that may be changed
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      rate - transfer rate in Mbps (1 or 2)
+ * @param      srcmac - source mac address
+ * @param      dstmac - destination mac address
+ * @param      maclen - length of mac address
+ * @param      channel - channel to tune to
+ * @param      noack - if true, disable auto-acknowledge
+ * @param      disable_aa - if true, disable ShockBurst
+ * 
+ */
+void nrf24_configure(
+    FuriHalSpiBusHandle* handle,
+    uint8_t rate,
+    uint8_t* srcmac,
+    uint8_t* dstmac,
+    uint8_t maclen,
+    uint8_t channel,
+    bool noack,
+    bool disable_aa);
+
+// Set mac address (MSB first), Return: Status
+uint8_t  nrf24_set_mac(uint8_t mac_addr, uint8_t *mac, uint8_t mlen);
+
+/** Configures the radio for "promiscuous mode" and primes it for rx
+ * This is not an actual mode of the nrf24, but this function exploits a few bugs in the chip that allows it to act as if it were.
+ * See http://travisgoodspeed.blogspot.com/2011/02/promiscuity-is-nrf24l01s-duty.html for details.
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      channel - channel to tune to
+ * @param      rate - transfer rate in Mbps (1 or 2) 
+ */
+void nrf24_init_promisc_mode(FuriHalSpiBusHandle* handle, uint8_t channel, uint8_t rate);
+
+/** Listens for a packet and returns first possible address sniffed
+ * Call this only after calling nrf24_init_promisc_mode
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      maclen - length of target mac address
+ * @param[out] addresses - sniffed address
+ * 
+ * @return     success
+ */
+bool nrf24_sniff_address(FuriHalSpiBusHandle* handle, uint8_t maclen, uint8_t* address);
+
+/** Sends ping packet on each channel for designated tx mac looking for ack
+ * 
+ * @param      handle  - pointer to FuriHalSpiHandle
+ * @param      srcmac - source address
+ * @param      dstmac - destination address
+ * @param      maclen - length of address
+ * @param      rate - transfer rate in Mbps (1 or 2) 
+ * @param      min_channel - channel to start with
+ * @param      max_channel - channel to end at
+ * @param      autoinit - if true, automatically configure radio for this channel
+ * 
+ * @return     channel that the address is listening on, if this value is above the max_channel param, it failed
+ */
+uint8_t nrf24_find_channel(
+    FuriHalSpiBusHandle* handle,
+    uint8_t* srcmac,
+    uint8_t* dstmac,
+    uint8_t maclen,
+    uint8_t rate,
+    uint8_t min_channel,
+    uint8_t max_channel,
+    bool autoinit);
+
+/** Converts 64 bit value into uint8_t array
+ * @param      val  - 64-bit integer
+ * @param[out] out - bytes out
+ * @param      bigendian - if true, convert as big endian, otherwise little endian
+ */
+void int64_to_bytes(uint64_t val, uint8_t* out, bool bigendian);
+
+/** Converts 32 bit value into uint8_t array
+ * @param      val  - 32-bit integer
+ * @param[out] out - bytes out
+ * @param      bigendian - if true, convert as big endian, otherwise little endian
+ */
+void int32_to_bytes(uint32_t val, uint8_t* out, bool bigendian);
+
+/** Converts uint8_t array into 32 bit value
+ * @param      bytes  - uint8_t array
+ * @param      bigendian - if true, convert as big endian, otherwise little endian
+ * 
+ * @return     32-bit value
+ */
+uint32_t bytes_to_int32(uint8_t* bytes, bool bigendian);
+
+#ifdef __cplusplus
+}
+#endif

+ 1972 - 0
nrf24batch.c

@@ -0,0 +1,1972 @@
+//
+// Written by vad7, 10.01.2023. vad7@yahoo.com
+//
+#include "nrf24batch.h"
+
+#include <furi.h>
+#include <furi_hal.h>
+#include <gui/gui.h>
+#include <dialogs/dialogs.h>
+#include <input/input.h>
+#include <stdlib.h>
+#include <dolphin/dolphin.h>
+#include <nrf24.h>
+#include <u8g2.h>
+
+#define TAG "nrf24batch"
+#define VERSION "1.9"
+
+#define SCAN_APP_PATH_FOLDER "/ext/nrf24batch"
+#define LOG_FILEEXT ".txt"
+#define NRF_READ_TIMEOUT 300UL // ms
+#define WORK_PERIOD 2 // ms, Timer period
+#define MAX_CHANNEL 125
+#define FONT_5x7_SCREEN_WIDTH 25
+#define NRF_EN_DYN_ACK 0 // does not work on some nrf24l01+ chips, (0/1)
+
+const char SettingsFld_Info[] = "Info:";
+const char SettingsFld_Ch[] = "Ch:";
+const char SettingsFld_Rate[] = "Rate:";
+const char SettingsFld_DPL[] = "DPL:";
+const char SettingsFld_CRC[] = "CRC:";
+const char SettingsFld_RETR[] = "RETR:";
+const char SettingsFld_Address[] = "Address:";
+const char SettingsFld_Resend[] = "Resend:";
+const char SettingsFld_Delay[] = "Delay_ms:";
+const char SettingsFld_WriteStart[] = "Write start:";
+const char SettingsFld_Payload[] = "Payload struct:";
+const char SettingsFld_ReadDefault[] = "R default:";
+const char SettingsFld_WriteDefault[] = "W default:";
+const char SettingsFld_Read[] = "R:"; // Read cmd
+const char SettingsFld_Write[] = "W:"; // Write cmd
+const char SettingsFld_Set[] = "S:"; // Set cmd (like Write but without "Write start" packet)
+const char SettingsFld_ReadBatch[] = "RBatch:";
+const char SettingsFld_WriteBatch[] = "WBatch:";
+const char SettingsFld_SetBatch[] = "SBatch:";
+const char SettingsFld_Listen[] = "Listen:";
+const char SettingsFld_ReadCmdRepeatPeriod[] = "ReadCmd repeat:";
+const char AskQuestion_Save[] = "SAVE BATCH?";
+#define Settings_i 'i'
+#define Settings_n 'n'
+#define VAR_EMPTY ((int32_t)0x80000000)
+
+nRF24Batch* APP;
+uint8_t what_doing = 0; // 0 - setup, 1 - cmd list, 2 - read/write/listen cmd
+enum {
+    rwt_set_batch = 0, // fast send packet without question
+    rwt_read_batch, // Send read cmd and wait for answer in batch
+    rwt_read_cmd, // Send read cmd and wait for answer
+    rwt_write_batch, // Send write cmd (with Write start pkt if available) with a question before it
+    rwt_listen, // Listen mode (wait incoming pkts)
+    rwt_max
+};
+uint8_t rw_type = rwt_read_batch; // What to do: rwt_*
+enum { sst_none = 0, sst_sending, sst_receiving, sst_ok, sst_error, sst_timeout };
+uint8_t send_status = sst_none; // sst_*
+bool cmd_array = false;
+uint8_t cmd_array_idx;
+uint8_t cmd_array_cnt = 0;
+bool cmd_array_hex;
+uint8_t save_settings = 0;
+uint16_t view_cmd[rwt_max - 1] = {0}; // SetBatch, ReadBatch, Read, WriteBatch
+uint8_t view_x = 0;
+char screen_buf[64];
+char Info[35] = "";
+char file_name[FONT_5x7_SCREEN_WIDTH];
+char ERR_STR[FONT_5x7_SCREEN_WIDTH];
+uint8_t ERR = 0;
+uint8_t NRF_rate; // 0 - 250Kbps, 1 - 1Mbps, 2 - 2Mbps
+uint8_t NRF_channel; // 0..125
+uint8_t NRF_DPL; // 1 - Dynamic Payload Length
+uint8_t NRF_CRC; // 1 - No, 1 - CRC 1byte, 2 - CRC 2byte
+uint8_t NRF_RETR = ((0b0011 << 4) | 0b1111); // Automatic Retransmission, ARD, ARC
+uint8_t NRF_Payload; // Payload len in bytes, 0..32
+bool NRF_ERROR = 0;
+uint8_t NRF_INITED = 0; // 0 - not, 1 - rw, rwt_listen - listen
+bool NRF_BOARD_POWER_5V = false;
+uint8_t NRF_last_packet_send_st = 0;
+uint8_t NRF_resend = 1; // number of transaction attempts
+int8_t NRF_repeat = 0; // count number of repeated requests (until < NRF_resend)
+uint32_t NRF_time;
+uint16_t ReadCmdRepeatPeriod = 10; // s
+bool ReadRepeat = false;
+uint32_t delay_between_pkt = 10; // ms
+
+uint8_t addr[5]; // nRF24 address, MSB first
+uint8_t addr_len = 0; // 2..5
+uint8_t payload[32];
+uint8_t payload_receive[32];
+uint8_t payload_struct[32]; // sizeof(1..4) in bytes of each field, example: 2,1,1
+uint8_t payload_fields = 0;
+uint8_t payload_size = 0; // bytes
+uint16_t view_Batch = 0; // view pos in Batch or inside WriteBatch (Log[view_Batch])
+uint16_t view_WriteBatch = 0; // view pos of WriteBatch list
+uint8_t setup_cursor = 0; // cursor position on Setup scr
+uint8_t Edit = 0;
+char* Edit_pos;
+char* Edit_start;
+bool Edit_hex; // 0 - decimal, 1 - hex
+bool Edited = false; // list of cmds edited
+
+Stream* file_stream = NULL;
+FuriString* ReadDefault = NULL;
+FuriString* WriteDefault = NULL;
+FuriString* WriteStart = NULL;
+FuriString* Constants = NULL; // text of STR=x
+uint8_t listen_addr[5];
+uint8_t listen_addr_len = 0;
+char* ListenFields = NULL; // ptr to string: field1,field2,... max 5 field now
+bool ListenNew;
+FuriHalRtcDateTime ListenLastTime = {0};
+uint32_t ListenPrev = 0;
+uint32_t ListenLast = 0;
+FuriString** Read_cmd = NULL; // Names of read cmd
+uint16_t Read_cmd_Total = 0;
+FuriString** Log = NULL; // Strings: var=n
+uint16_t Log_Total = 0;
+FuriString** ReadBatch_cmd = NULL; // Names of read batch cmd
+uint16_t ReadBatch_cmd_Total = 0;
+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
+FuriString** SetBatch_cmd = NULL; // Names of set batch cmd
+uint16_t SetBatch_cmd_Total = 0;
+uint16_t SetBatch_cmd_curr = 0; // == _Total - finish
+
+#define POWER_READ_PERIOD 501 // ms
+uint16_t pwr_read_timer = 0;
+int Current = 0;
+int CurrentStart = 0;
+
+enum { ask_write_batch = 1, ask_save_batch, ask_skip_cmd, ask_return, ask_exit };
+uint8_t ask_question = 0; // 1 - Ask now - ask_*
+uint8_t ask_question_answer = 0; // 0 - no, 1 - yes
+
+static bool ask_fill_screen_buf(void) {
+    if(ask_question == ask_write_batch)
+        strcpy(screen_buf, "RUN WRITE BATCH?");
+    else if(ask_question == ask_save_batch)
+        strcpy(screen_buf, "SAVE AS WRITE BATCH?");
+    else if(ask_question == ask_skip_cmd)
+        strcpy(screen_buf, "SKIP CMD?");
+    else if(ask_question == ask_return)
+        strcpy(screen_buf, "RETURN?");
+    else if(ask_question == ask_exit)
+        strcpy(screen_buf, "EXIT?");
+    else
+        return false;
+    strcat(screen_buf, ask_question_answer ? " YES" : " NO");
+    return true;
+}
+
+//#define MIN(a, b)  ((a<b)?a:b)
+
+static uint8_t GetHexVal(char hex) {
+    return hex == 0 ? 0 :
+                      ((uint8_t)hex - ((uint8_t)hex < 58 ? 48 : ((uint8_t)hex < 97 ? 55 : 87)));
+}
+
+static bool is_digit(char* ptr, bool hex) {
+    char c = *ptr;
+    if(c >= '0' && c <= '9') return true;
+    if(hex) {
+        c &= ~0x20;
+        if(c >= 'A' && c <= 'F') return true;
+    } else if(c == '-')
+        return true;
+    return false;
+}
+
+// Return num bytes in array
+static uint8_t ConvertHexToArray(char* hex, uint8_t* array, uint8_t maxlen) {
+    uint8_t len = 0;
+    while(maxlen) {
+        uint8_t ch = *hex++;
+        if(ch < ' ') break;
+        if(ch < '0') continue;
+        *array++ = (GetHexVal(ch) << 4) + GetHexVal(*hex++);
+        len++;
+        maxlen--;
+    }
+    return len;
+}
+
+int32_t str_to_int(char* p) {
+    if(*(p + 1) == 'x') { // hex
+        return strtol(p + 2, NULL, 16);
+    } else
+        return strtol(p, NULL, 10);
+}
+
+void str_rtrim(char* p) {
+    char* delim_col = strchr(p, '\r');
+    if(delim_col)
+        *delim_col = '\0';
+    else {
+        delim_col = strchr(p, '\n');
+        if(delim_col) *delim_col = '\0';
+    }
+}
+
+static void add_to_str_hex_bytes(char* out, uint8_t* arr, int bytes) {
+    if(bytes <= 0) return;
+    out += strlen(out);
+    do {
+        snprintf(out, 3, "%02X", *arr++);
+        out += 2;
+    } while(--bytes);
+}
+
+// skip leading zeros
+static void add_to_str_hex_variable(char* out, uint8_t* arr, int size) {
+    if(size <= 0) return;
+    out += strlen(out);
+    arr += size - 1;
+    while(*arr == 0 && size > 1) {
+        arr--;
+        size--;
+    }
+    do {
+        snprintf(out, 3, "%02X", *arr--);
+        out += 2;
+    } while(--size);
+}
+
+void Edit_insert_digit(char new) {
+    if(*Edit_pos == '-') return;
+    if(what_doing <= 1) {
+        if(strlen(Edit_start) < (what_doing == 0 && setup_cursor == 2 ? 3 : 5 * 2)) {
+            memmove(Edit_pos + 1, Edit_pos, strlen(Edit_pos) + 1);
+            *Edit_pos = new;
+        }
+    } else {
+        FuriString* fs = Log[view_Batch];
+        FuriString* ns = furi_string_alloc();
+        if(ns) {
+            uint16_t len = Edit_pos - (char*)furi_string_get_cstr(fs);
+            furi_string_set_n(ns, fs, 0, len);
+            furi_string_cat_printf(ns, "%c", new);
+            furi_string_cat_str(ns, Edit_pos);
+            Log[view_Batch] = ns;
+            Edit_pos = (char*)furi_string_get_cstr(ns);
+            Edit_start = Edit_pos + (Edit_start - (char*)furi_string_get_cstr(fs));
+            Edit_pos += len;
+            furi_string_free(fs);
+        }
+    }
+}
+
+int32_t get_payload_receive_field(uint8_t* var, uint8_t size) {
+    if(size <= 1)
+        return *var;
+    else if(size == 2)
+        return *(int16_t*)var;
+    else if(size == 3)
+        return (*(uint32_t*)var) & 0xFFFFFF;
+    else
+        return *(int32_t*)var;
+}
+
+void free_Log() {
+    if(Log_Total) {
+        for(uint16_t i = 0; i < Log_Total; i++)
+            if(Log[i]) furi_string_free(Log[i]);
+        Log_Total = 0;
+    }
+    if(Log) {
+        free(Log);
+        Log = NULL;
+    }
+}
+
+void free_store(void) {
+    if(Constants) {
+        furi_string_free(Constants);
+        Constants = NULL;
+    }
+    if(ReadDefault) {
+        furi_string_free(ReadDefault);
+        ReadDefault = NULL;
+    }
+    if(WriteDefault) {
+        furi_string_free(WriteDefault);
+        WriteDefault = NULL;
+    }
+    if(WriteStart) {
+        furi_string_free(WriteStart);
+        WriteDefault = NULL;
+    }
+    if(ListenFields) {
+        free(ListenFields);
+        ListenFields = NULL;
+    }
+    if(Read_cmd_Total) {
+        for(uint16_t i = 0; i < Read_cmd_Total; i++) furi_string_free(Read_cmd[i]);
+        Read_cmd_Total = 0;
+    }
+    if(Read_cmd) {
+        free(Read_cmd);
+        Read_cmd = NULL;
+    }
+    if(ReadBatch_cmd_Total) {
+        for(uint16_t i = 0; i < ReadBatch_cmd_Total; i++) furi_string_free(ReadBatch_cmd[i]);
+        ReadBatch_cmd_Total = 0;
+    }
+    if(ReadBatch_cmd) {
+        free(ReadBatch_cmd);
+        ReadBatch_cmd = NULL;
+    }
+    if(WriteBatch_cmd_Total) {
+        for(uint16_t i = 0; i < WriteBatch_cmd_Total; i++) furi_string_free(WriteBatch_cmd[i]);
+        WriteBatch_cmd_Total = 0;
+    }
+    if(WriteBatch_cmd) {
+        free(WriteBatch_cmd);
+        WriteBatch_cmd = NULL;
+    }
+    if(SetBatch_cmd_Total) {
+        for(uint16_t i = 0; i < SetBatch_cmd_Total; i++) furi_string_free(SetBatch_cmd[i]);
+        SetBatch_cmd_Total = 0;
+    }
+    if(SetBatch_cmd) {
+        free(SetBatch_cmd);
+        SetBatch_cmd = NULL;
+    }
+    free_Log();
+}
+
+void update_power(void) {
+    Current = furi_hal_power_get_battery_current(FuriHalPowerICFuelGauge) * 1000;
+}
+
+void check_en_power_5V(void) {
+    if(!furi_hal_power_is_otg_enabled() && !furi_hal_power_is_charging()) {
+        FURI_LOG_D("PWR", "NO 5V, TURN ON");
+        notification_message(APP->notification, &sequence_blink_yellow_100);
+        furi_delay_ms(10);
+        update_power();
+        CurrentStart = Current;
+        furi_hal_power_enable_otg();
+        NRF_BOARD_POWER_5V = true;
+        furi_delay_ms(100);
+        NRF_INITED = 0;
+    }
+}
+
+static bool select_settings_file() {
+    DialogsApp* dialogs = furi_record_open("dialogs");
+    bool result = false;
+    FuriString* path;
+    path = furi_string_alloc();
+    furi_string_set(path, SCAN_APP_PATH_FOLDER);
+    DialogsFileBrowserOptions browser_options;
+    dialog_file_browser_set_basic_options(&browser_options, ".txt", NULL);
+    browser_options.hide_ext = false;
+    bool ret = dialog_file_browser_show(dialogs, path, path, &browser_options);
+    furi_record_close("dialogs");
+    if(ret) {
+        if(!file_stream_open(
+               file_stream, furi_string_get_cstr(path), FSAM_READ_WRITE, FSOM_OPEN_EXISTING)) {
+            FURI_LOG_D(TAG, "Cannot open file \"%s\"", furi_string_get_cstr(path));
+            file_stream_close(file_stream);
+        } else {
+            FURI_LOG_D(TAG, "Open file \"%s\"", furi_string_get_cstr(path));
+            strncpy(
+                file_name,
+                furi_string_get_cstr(path) + sizeof(SCAN_APP_PATH_FOLDER),
+                sizeof(file_name));
+            result = true;
+        }
+    }
+    furi_string_free(path);
+    return result;
+}
+
+static void prepare_nrf24(void) {
+    check_en_power_5V();
+    if(!NRF_INITED || rw_type == rwt_listen || NRF_INITED == rwt_listen) {
+        FURI_LOG_D("NRF", "Prepare");
+        uint8_t adrlen, *adr;
+        if(rw_type == rwt_listen) {
+            adrlen = listen_addr_len;
+            adr = listen_addr;
+            NRF_INITED = rwt_listen;
+        } else {
+            adrlen = addr_len;
+            adr = addr;
+            NRF_INITED = 1;
+        }
+        furi_hal_gpio_write(nrf24_CE_PIN, false);
+        nrf24_set_mac(REG_RX_ADDR_P0, adr, adrlen);
+        uint8_t tmp[5] = {0};
+        nrf24_read_reg(nrf24_HANDLE, REG_RX_ADDR_P0, tmp, adrlen);
+        for(uint8_t i = 0; i < adrlen / 2; i++) {
+            uint8_t tb = tmp[i];
+            tmp[i] = tmp[adrlen - i - 1];
+            tmp[adrlen - i - 1] = tb;
+        }
+        NRF_ERROR = memcmp(adr, tmp, adrlen) != 0;
+        if(NRF_ERROR) {
+            NRF_INITED = 0;
+            return;
+        }
+        // EN_DYN_ACK(0x01) option for W_TX_PAYLOAD_NOACK cmd broke AA on some fake nRF24l01+, i.e. set it to 0
+        nrf24_write_reg(
+            nrf24_HANDLE,
+            REG_FEATURE,
+            NRF_EN_DYN_ACK +
+                (NRF_DPL ? 4 :
+                           0)); // Dynamic Payload, Payload with ACK, W_TX_PAYLOAD_NOACK command
+        nrf24_write_reg(nrf24_HANDLE, REG_RF_CH, NRF_channel);
+        nrf24_write_reg(
+            nrf24_HANDLE,
+            REG_RF_SETUP,
+            (NRF_rate == 0 ? 0b00100000 :
+             NRF_rate == 1 ? 0 :
+                             0b00001000) |
+                0b111); // +TX high power
+        nrf24_write_reg(
+            nrf24_HANDLE,
+            REG_CONFIG,
+            0x70 | ((NRF_CRC == 1 ? 0b1000 :
+                     NRF_CRC == 2 ? 0b1100 :
+                                    0))); // Mask all interrupts
+        nrf24_write_reg(
+            nrf24_HANDLE, REG_SETUP_RETR, NRF_RETR); // Automatic Retransmission, ARD<<4 + ARC
+        nrf24_write_reg(nrf24_HANDLE, REG_EN_AA, 0x01); // Auto acknowledgement
+        nrf24_write_reg(nrf24_HANDLE, REG_DYNPD, NRF_DPL ? 0x3F : 0); // Enable dynamic payload reg
+        nrf24_write_reg(nrf24_HANDLE, RX_PW_P0, payload_size);
+        nrf24_set_maclen(nrf24_HANDLE, adrlen);
+        nrf24_set_mac(REG_TX_ADDR, adr, adrlen);
+        nrf24_write_reg(nrf24_HANDLE, REG_EN_RXADDR, 1);
+        //nrf24_set_idle(nrf24_HANDLE);
+    }
+    nrf24_flush_tx(nrf24_HANDLE);
+    nrf24_flush_rx(nrf24_HANDLE);
+    nrf24_write_reg(nrf24_HANDLE, REG_STATUS, MAX_RT | RX_DR | TX_DS);
+}
+
+// true - ok
+uint8_t nrf24_send_packet() {
+    if(furi_log_get_level() == FuriLogLevelDebug) {
+        char buf[65];
+        buf[0] = 0;
+        add_to_str_hex_bytes(buf, payload, payload_size);
+        FURI_LOG_D(TAG, "SEND: %s", buf);
+    }
+    //nrf24_flush_tx(nrf24_HANDLE);
+    //nrf24_write_reg(nrf24_HANDLE, REG_STATUS, RX_DR | TX_DS | MAX_RT);
+    NRF_last_packet_send_st = nrf24_txpacket(nrf24_HANDLE, payload, payload_size, true); // ACK
+    if(NRF_last_packet_send_st) {
+        if((rw_type == rwt_read_cmd || rw_type == rwt_read_batch) &&
+           send_status == sst_sending) { // Read
+            nrf24_set_rx_mode(nrf24_HANDLE);
+            send_status = sst_receiving; // receiving
+        }
+    } else
+        notification_message(APP->notification, &sequence_blink_red_100);
+    NRF_time = furi_get_tick();
+    FURI_LOG_D(
+        TAG,
+        "Send packet: %d%s",
+        NRF_last_packet_send_st,
+        send_status == sst_receiving ? ", Receiving" : "");
+    return NRF_last_packet_send_st;
+}
+
+uint8_t nrf24_resend_read_packet() {
+    if(Log_Total && !cmd_array) {
+        FuriString* str = Log[Log_Total - 1];
+        char* p = strstr(furi_string_get_cstr(str), ": ");
+        if(p) {
+            if(strncmp(p + 2, "0x", 2) == 0) p += 2;
+            furi_string_left(str, p - furi_string_get_cstr(str) + 2);
+        }
+    }
+    return nrf24_send_packet();
+}
+
+// true - new packet
+bool nrf24_read_newpacket() {
+    bool found = false;
+    uint8_t packetsize;
+    uint8_t st =
+        nrf24_rxpacket(nrf24_HANDLE, payload_receive, &packetsize, NRF_DPL ? 0 : payload_size);
+    if(st & RX_DR) {
+        NRF_time = furi_get_tick();
+        if(furi_log_get_level() == FuriLogLevelDebug) {
+            char buf[65];
+            buf[0] = 0;
+            add_to_str_hex_bytes(buf, payload_receive, packetsize);
+            FURI_LOG_D(TAG, "READ(%X): %s", st, buf);
+        }
+        if(Log_Total) {
+            FuriString* str = Log[Log_Total - 1];
+            uint8_t size = 1;
+            char* p = strchr((char*)furi_string_get_cstr(str), '*');
+            if(p) {
+                p++;
+                if(*p == '=')
+                    size = 0; // string
+                else {
+                    size = *p - '0';
+                    if(size > 4) size = 0;
+                }
+            }
+            int32_t var = get_payload_receive_field(payload_receive, size);
+            //FURI_LOG_D(TAG, "VAR(%d): %ld", size, var);
+            if(size == 0)
+                furi_string_cat_printf(str, "%c", (char)var);
+            else {
+                char hex[9];
+                hex[0] = '\0';
+                add_to_str_hex_variable(hex, (uint8_t*)&var, size);
+                if((cmd_array && cmd_array_hex) || furi_string_end_with_str(str, "0x"))
+                    furi_string_cat_str(str, hex);
+                else {
+                    if(var >= 0 && var <= 9)
+                        furi_string_cat_printf(str, "%ld", var);
+                    else
+                        furi_string_cat_printf(str, "%ld (%s)", var, hex);
+                }
+            }
+            if(cmd_array) {
+                if(--cmd_array_cnt) {
+                    furi_string_cat_str(str, ",");
+                    if(cmd_array_hex) furi_string_cat_str(str, "0x");
+                    payload[cmd_array_idx] += size; // next array element
+                    NRF_repeat = -1;
+                    send_status = sst_sending; // Will be send after delay_between_pkt
+                } else
+                    send_status = sst_ok;
+            } else {
+                if(size == 0) { // string, until '\0'
+                    if(var == 0) send_status = sst_ok;
+                } else
+                    send_status = sst_ok;
+            }
+        }
+        //notification_message(APP->notification, &sequence_blink_white_100);
+        found = true;
+    } else if(st & 0x80) { // NRF24 hardware error
+        NRF_ERROR = 1;
+        NRF_INITED = 0;
+    }
+    return found;
+}
+
+// Search in constatnt pull (Const1=n; Const2=n;...)
+// VAR_EMPTY - not found
+int32_t subs_constant(char* p, uint8_t len) {
+    char* c = (char*)furi_string_get_cstr(Constants);
+    while((c = strchr(c, *p))) {
+        if(strncmp(c, p, len) != 0) {
+            c++;
+            continue;
+        }
+        if(c == (char*)furi_string_get_cstr(Constants) || *(c - 1) == ';' || *(c - 1) <= ' ') {
+            c += len;
+            if(*c == '=') {
+                c++;
+                return str_to_int(c);
+            }
+        } else
+            c += len;
+    }
+    return VAR_EMPTY;
+}
+
+// fill payload with default = p
+// if var_n = VAR_EMPTY - skip filling var_*
+bool fill_payload(char* p, uint8_t* idx_i, int32_t var_n) {
+    if(idx_i) *idx_i = 255;
+    uint8_t fld = 0; // field #
+    uint8_t idx = 0; // byte index
+    do {
+        int32_t b = 0;
+        char* end = strchr(p, ',');
+        if(*p >= '0' && *p <= '9') { // Number found
+            b = str_to_int(p);
+        } else if(*p == 'i' && *(p + 1) == ':') { // 'i:' array index
+            b = str_to_int(p + 2);
+            if(idx_i) *idx_i = idx;
+        } else if(*p == 'n' && *(p + 1) < '0') { // var_n
+            if(var_n != VAR_EMPTY) b = var_n;
+        } else if(*p >= 'A') { // constant found
+            uint8_t len;
+            if(end)
+                len = end - p;
+            else {
+                len = strlen(p);
+                if(*(p + len - 1) == '#') len--;
+            }
+            b = subs_constant(p, len);
+            if(b == VAR_EMPTY) {
+                ERR = 1;
+                memset(ERR_STR, 0, sizeof(ERR_STR));
+                strcpy(ERR_STR, "No ");
+                strncpy(ERR_STR + strlen(ERR_STR), p, sizeof(ERR_STR) - 4);
+                FURI_LOG_D(TAG, "Constant not found: %s", p);
+                return false;
+            }
+        } else if(end == p) {
+            idx += payload_struct[fld];
+        } else if(*p == '#') { // value in Hexadecimal, end string
+            break;
+        } else {
+            ERR = 2;
+            strcpy(ERR_STR, "char: ");
+            uint8_t l = strlen(ERR_STR);
+            ERR_STR[l] = *p;
+            ERR_STR[l + 1] = '\0';
+            FURI_LOG_D(TAG, "Wrong format char(%c)", *p);
+            return false;
+        }
+        if(end != p) {
+            payload[idx++] = b;
+            if(payload_struct[fld] > 1) payload[idx++] = b >> 8;
+            if(payload_struct[fld] > 2) payload[idx++] = b >> 16;
+            if(payload_struct[fld] > 3) payload[idx++] = b >> 24;
+        }
+        if(++fld == payload_fields || idx >= sizeof(payload) || end == NULL) break;
+        p = end + 1;
+    } while(1);
+    return true;
+}
+
+// Cmd: "name=payload"
+bool Run_Read_cmd(FuriString* cmd) {
+    char* p = (char*)furi_string_get_cstr(cmd);
+    p = strchr(p, '=');
+    if(p == NULL) return false;
+    if(Log == NULL)
+        Log = malloc(sizeof(Log));
+    else
+        Log = realloc(Log, sizeof(Log) * (Log_Total + 1));
+    if(Log == NULL) {
+        ERR = 3;
+        strcpy(ERR_STR, "Memory low");
+        FURI_LOG_D(TAG, ERR_STR);
+        return false;
+    }
+    FuriString* fs = furi_string_alloc();
+    furi_string_set_strn(
+        fs, (char*)furi_string_get_cstr(cmd), p - (char*)furi_string_get_cstr(cmd));
+    furi_string_cat_str(fs, ": ");
+    bool hexval;
+    if((hexval = *(p + strlen(p) - 1) == '#'))
+        furi_string_cat_str(fs, "0x"); // value in Hex format
+    Log[Log_Total++] = fs;
+    p++;
+    memset(payload, 0, sizeof(payload));
+    if(ReadDefault && !fill_payload((char*)furi_string_get_cstr(ReadDefault), NULL, VAR_EMPTY))
+        return false;
+    if(!fill_payload(p, &cmd_array_idx, VAR_EMPTY)) return false;
+    memset(payload_receive, 0, sizeof(payload_receive));
+    cmd_array = false;
+    if(*(p - 2) == ']' && cmd_array_idx != 255) { // array
+        p = strchr(furi_string_get_cstr(cmd), '[');
+        if(p) {
+            cmd_array_cnt = str_to_int(p + 1);
+            if(cmd_array_cnt > 1) {
+                cmd_array_hex = hexval;
+                cmd_array = true; // array
+            }
+        }
+    }
+    prepare_nrf24();
+    if(NRF_ERROR) return false;
+    what_doing = 2;
+    NRF_repeat = 0;
+    send_status = sst_sending; // Read - sending
+    nrf24_send_packet();
+    return true;
+}
+
+// run commands one by one, true - command running
+bool Run_ReadBatch_cmd(FuriString* cmd) {
+    char* p;
+    if(cmd) {
+        p = strchr((char*)furi_string_get_cstr(cmd), ':');
+        if(p == NULL) {
+            ERR = 5;
+            strcpy(ERR_STR, "WRONG FORMAT");
+            return false;
+        }
+        p += 2;
+        ReadBatch_cmd_curr = NULL;
+        free_Log();
+    } else {
+        if(ReadBatch_cmd_curr)
+            p = ReadBatch_cmd_curr;
+        else
+            return false;
+    }
+    char* end = strchr(p, ';');
+    uint8_t len;
+    if(end)
+        len = end - p;
+    else {
+        str_rtrim(p);
+        len = strlen(p);
+    }
+    for(uint16_t i = 0; i < Read_cmd_Total; i++) {
+        FuriString* fs = Read_cmd[i];
+        if(strncmp((char*)furi_string_get_cstr(fs), p, len) == 0) {
+            char c = *((char*)furi_string_get_cstr(fs) + len);
+            if(c != '=' && c != '*' && c != '[') continue;
+            if(end)
+                ReadBatch_cmd_curr = end + 1;
+            else
+                ReadBatch_cmd_curr = (char*)0xFFFFFFFF;
+            if(!Run_Read_cmd(fs)) break;
+            return true;
+        }
+    }
+    if(NRF_ERROR) return false;
+    if(ERR == 0) {
+        ERR = 4;
+        strcpy(ERR_STR, "NOT FOUND");
+        FuriString* fs = furi_string_alloc();
+        furi_string_set_strn(fs, p, len);
+        Log[Log_Total++] = fs;
+        FURI_LOG_D(TAG, "CMD %s: %s", ERR_STR, p);
+    }
+    view_Batch = Log_Total ? Log_Total - 1 : 0;
+    return false;
+}
+
+void Prepare_Write_cmd(FuriString* cmd) {
+    free_Log();
+    if(cmd == NULL) return;
+    char *end, *p = strchr((char*)furi_string_get_cstr(cmd), ':');
+    if(p == NULL) {
+        ERR = 8;
+        strcpy(ERR_STR, "Wrong batch");
+        FURI_LOG_D(TAG, ERR_STR);
+        return;
+    }
+    p += 2;
+    Log = malloc(sizeof(Log));
+    do {
+        end = strchr(p, ';');
+        uint8_t len;
+        if(end) {
+            len = end - p;
+            end++;
+        } else {
+            str_rtrim(p);
+            len = strlen(p);
+        }
+        FuriString* fs = furi_string_alloc();
+        if(Log_Total) Log = realloc(Log, sizeof(Log) * (Log_Total + 1));
+        if(Log == NULL) {
+            ERR = 3;
+            strcpy(ERR_STR, "Memory low");
+            FURI_LOG_D(TAG, ERR_STR);
+            return;
+        }
+        furi_string_set_strn(fs, p, len);
+        Log[Log_Total++] = fs;
+    } while((p = end));
+}
+
+// Write / Set batch
+bool Run_WriteBatch_cmd() {
+    if(Log_Total == 0) return false;
+    uint16_t cmd_curr = rw_type == rwt_write_batch ? WriteBatch_cmd_curr : SetBatch_cmd_curr;
+    if(cmd_curr == 0) { // first
+        prepare_nrf24();
+        if(NRF_ERROR) return false;
+        if(rw_type == rwt_write_batch && WriteStart) {
+            if(!fill_payload((char*)furi_string_get_cstr(WriteStart), NULL, VAR_EMPTY))
+                return false;
+            send_status = sst_sending;
+            if(!nrf24_send_packet()) return false;
+        }
+    }
+    char* p = (char*)furi_string_get_cstr(Log[cmd_curr]);
+    uint16_t len = furi_string_size(Log[cmd_curr]);
+    char* arr = NULL;
+    cmd_array = false;
+    int32_t new = 0;
+    for(uint16_t i = 0; i < len; i++) {
+        if(p[i] == '=') {
+            len = i;
+            char* p2 = p + i + 1;
+            if(*p2 == '{') {
+                arr = ++p2; // array
+                cmd_array = true;
+            }
+            new = str_to_int(p2);
+            break;
+        }
+    }
+    FURI_LOG_D(
+        TAG, "%cBatch: =%d, (%d)%s", rw_type == rwt_write_batch ? 'W' : 'S', (int)new, len, p);
+    char *w, *delim_col, i, size;
+    FuriString* str = furi_string_alloc();
+    stream_rewind(file_stream);
+    while(stream_read_line(file_stream, str)) {
+        w = (char*)furi_string_get_cstr(str);
+        if(strncmp(w, SettingsFld_Write, sizeof(SettingsFld_Write) - 1) == 0)
+            w += sizeof(SettingsFld_Write);
+        else if(strncmp(w, SettingsFld_Set, sizeof(SettingsFld_Set) - 1) == 0)
+            w += sizeof(SettingsFld_Set);
+        else
+            continue;
+        delim_col = strchr(w, '=');
+        if(delim_col == NULL) continue;
+        size = 1;
+        if(*(delim_col - 2) == '*') {
+            if(len != delim_col - w - 2) continue;
+            size = *(delim_col - 1) - '0';
+            new = new&(size == 1 ? 0xFF : size == 2 ? 0xFFFF : size == 3 ? 0xFFFFFF : 0xFFFFFFFF);
+        } else if(len != delim_col - w)
+            continue;
+        if(strncmp(p, w, len) != 0) continue;
+        delim_col++;
+        str_rtrim(delim_col);
+        cmd_array_cnt = 255;
+        do {
+            memset(payload, 0, sizeof(payload));
+            if(WriteDefault &&
+               !fill_payload((char*)furi_string_get_cstr(WriteDefault), NULL, new)) {
+                view_Batch = cmd_curr;
+                return false;
+            }
+            if(!fill_payload(delim_col, &cmd_array_idx, VAR_EMPTY)) {
+                view_Batch = cmd_curr;
+                return false;
+            }
+            if(cmd_array && cmd_array_idx != 255) {
+                if(cmd_array_cnt != 255) payload[cmd_array_idx] = cmd_array_cnt;
+            } else
+                cmd_array = false;
+            send_status = sst_sending;
+            NRF_repeat = 0;
+            i = 0;
+            do {
+                if(nrf24_send_packet()) break;
+                furi_delay_ms(delay_between_pkt);
+            } while(i++ < NRF_resend);
+            if(i < NRF_resend || i == 0) { // ok
+                if(cmd_array) { // array
+                    for(; arr != NULL;) {
+                        if(*arr == ',') break;
+                        if(*arr == '}' || *arr < ' ')
+                            arr = NULL;
+                        else
+                            arr++;
+                    }
+                    if(arr == NULL) {
+                        send_status = sst_ok;
+                        break;
+                    }
+                    arr++;
+                    new = str_to_int(arr);
+                    cmd_array_cnt = payload[cmd_array_idx] + size;
+                    //furi_delay_ms(delay_between_pkt); // do it fast
+                    continue; // send next array element
+                } else
+                    send_status = sst_ok;
+            }
+            break;
+        } while(1);
+        if(send_status != sst_ok) {
+            send_status = sst_error;
+            view_Batch = cmd_curr;
+            return false;
+        }
+        return true;
+    }
+    ERR = 7;
+    strcpy(ERR_STR, "NOT FOUND!");
+    send_status = sst_error;
+    view_Batch = cmd_curr;
+    return false;
+}
+
+// Return 0 - success, otherwise an error
+static uint8_t load_settings_file() {
+    uint8_t err = 0;
+    FURI_LOG_D(TAG, "Loading settings file");
+    FuriString* str = furi_string_alloc();
+    free_store();
+    Info[0] = '\0';
+    NRF_INITED = false;
+    while(stream_read_line(file_stream, str)) {
+        char* p = (char*)furi_string_get_cstr(str);
+        if(*p <= '!' || *p == ';') continue;
+        //char* delim_eq = strchr(p, '=');
+        char* delim_col = strchr(p, ':');
+        if(delim_col == NULL) { // Constant found - no ':'
+            if(Constants == NULL) {
+                Constants = furi_string_alloc_set(str);
+            } else
+                furi_string_cat(Constants, str);
+        } else {
+            str_rtrim(p);
+            if(strncmp(p, SettingsFld_Rate, sizeof(SettingsFld_Rate) - 1) == 0) {
+                NRF_rate = str_to_int(p + sizeof(SettingsFld_Rate));
+            } else if(strncmp(p, SettingsFld_Info, sizeof(SettingsFld_Info) - 1) == 0) {
+                strncpy(Info, p + sizeof(SettingsFld_Info), sizeof(Info) - 1);
+            } else if(strncmp(p, SettingsFld_Ch, sizeof(SettingsFld_Ch) - 1) == 0) {
+                NRF_channel = str_to_int(p + sizeof(SettingsFld_Ch));
+            } else if(strncmp(p, SettingsFld_Address, sizeof(SettingsFld_Address) - 1) == 0) {
+                p += sizeof(SettingsFld_Address);
+                addr_len = ConvertHexToArray(p, addr, 5);
+            } else if(strncmp(p, SettingsFld_CRC, sizeof(SettingsFld_CRC) - 1) == 0) {
+                NRF_CRC = str_to_int(p + sizeof(SettingsFld_CRC));
+            } else if(strncmp(p, SettingsFld_DPL, sizeof(SettingsFld_DPL) - 1) == 0) {
+                NRF_DPL = str_to_int(p + sizeof(SettingsFld_DPL));
+            } else if(strncmp(p, SettingsFld_RETR, sizeof(SettingsFld_RETR) - 1) == 0) {
+                NRF_RETR = str_to_int(p + sizeof(SettingsFld_RETR));
+            } else if(strncmp(p, SettingsFld_Resend, sizeof(SettingsFld_Resend) - 1) == 0) {
+                NRF_resend = str_to_int(p + sizeof(SettingsFld_Resend));
+            } else if(strncmp(p, SettingsFld_Delay, sizeof(SettingsFld_Delay) - 1) == 0) {
+                delay_between_pkt = str_to_int(p + sizeof(SettingsFld_Delay));
+            } else if(
+                strncmp(
+                    p,
+                    SettingsFld_ReadCmdRepeatPeriod,
+                    sizeof(SettingsFld_ReadCmdRepeatPeriod) - 1) == 0) {
+                ReadCmdRepeatPeriod = str_to_int(p + sizeof(SettingsFld_ReadCmdRepeatPeriod));
+            } else if(strncmp(p, SettingsFld_Payload, sizeof(SettingsFld_Payload) - 1) == 0) {
+                p += sizeof(SettingsFld_Payload);
+                payload_fields = 0;
+                payload_size = 0;
+                do {
+                    uint8_t b = str_to_int(p);
+                    if(b < 1 || b > 4) {
+                        FURI_LOG_D(TAG, "Wrong payload format (%d)", b);
+                        err = 3;
+                        break;
+                    }
+                    payload_struct[payload_fields++] = b;
+                    payload_size += b;
+                    if(payload_fields == sizeof(payload_struct) - 1) break;
+                    if((p = strchr(p, ',')) == NULL) break;
+                    p++;
+                } while(1);
+                FURI_LOG_D(
+                    TAG,
+                    "Payload fields %d: %d,%d,%d",
+                    payload_fields,
+                    payload_struct[0],
+                    payload_struct[1],
+                    payload_struct[2]);
+            } else if(strncmp(p, SettingsFld_ReadDefault, sizeof(SettingsFld_ReadDefault) - 1) == 0) {
+                ReadDefault = furi_string_alloc_set_str(p + sizeof(SettingsFld_ReadDefault));
+            } else if(strncmp(p, SettingsFld_WriteStart, sizeof(SettingsFld_WriteStart) - 1) == 0) {
+                WriteStart = furi_string_alloc_set_str(p + sizeof(SettingsFld_WriteStart));
+            } else if(strncmp(p, SettingsFld_WriteDefault, sizeof(SettingsFld_WriteDefault) - 1) == 0) {
+                WriteDefault = furi_string_alloc_set_str(p + sizeof(SettingsFld_WriteDefault));
+            } else if(strncmp(p, SettingsFld_Read, sizeof(SettingsFld_Read) - 1) == 0) {
+                p += sizeof(SettingsFld_Read);
+                if(Read_cmd == NULL)
+                    Read_cmd = malloc(sizeof(Read_cmd));
+                else {
+                    Read_cmd = realloc(Read_cmd, sizeof(Read_cmd) * (Read_cmd_Total + 1));
+                }
+                if(Read_cmd == NULL) {
+                    FURI_LOG_D(TAG, "Memory low, err 4");
+                    err = 4;
+                    break;
+                }
+                Read_cmd[Read_cmd_Total++] = furi_string_alloc_set_str(p);
+            } else if(strncmp(p, SettingsFld_ReadBatch, sizeof(SettingsFld_ReadBatch) - 1) == 0) {
+                p += sizeof(SettingsFld_ReadBatch);
+                if(ReadBatch_cmd == NULL)
+                    ReadBatch_cmd = malloc(sizeof(ReadBatch_cmd));
+                else {
+                    ReadBatch_cmd =
+                        realloc(ReadBatch_cmd, sizeof(ReadBatch_cmd) * (ReadBatch_cmd_Total + 1));
+                }
+                if(ReadBatch_cmd == NULL) {
+                    FURI_LOG_D(TAG, "Memory low, err 5");
+                    err = 5;
+                    break;
+                }
+                ReadBatch_cmd[ReadBatch_cmd_Total++] = furi_string_alloc_set_str(p);
+            } else if(strncmp(p, SettingsFld_WriteBatch, sizeof(SettingsFld_WriteBatch) - 1) == 0) {
+                p += sizeof(SettingsFld_WriteBatch);
+                if(WriteBatch_cmd == NULL)
+                    WriteBatch_cmd = malloc(sizeof(WriteBatch_cmd));
+                else {
+                    WriteBatch_cmd = realloc(
+                        WriteBatch_cmd, sizeof(WriteBatch_cmd) * (WriteBatch_cmd_Total + 1));
+                }
+                if(WriteBatch_cmd == NULL) {
+                    FURI_LOG_D(TAG, "Memory low, err 6");
+                    err = 6;
+                    break;
+                }
+                WriteBatch_cmd[WriteBatch_cmd_Total++] = furi_string_alloc_set_str(p);
+            } else if(strncmp(p, SettingsFld_SetBatch, sizeof(SettingsFld_SetBatch) - 1) == 0) {
+                p += sizeof(SettingsFld_SetBatch);
+                if(SetBatch_cmd == NULL)
+                    SetBatch_cmd = malloc(sizeof(SetBatch_cmd));
+                else {
+                    SetBatch_cmd =
+                        realloc(SetBatch_cmd, sizeof(SetBatch_cmd) * (SetBatch_cmd_Total + 1));
+                }
+                if(SetBatch_cmd == NULL) {
+                    FURI_LOG_D(TAG, "Memory low, err 7");
+                    err = 7;
+                    break;
+                }
+                SetBatch_cmd[SetBatch_cmd_Total++] = furi_string_alloc_set_str(p);
+            } else if(strncmp(p, SettingsFld_Listen, sizeof(SettingsFld_Listen) - 1) == 0) {
+                p += sizeof(SettingsFld_Listen);
+                char* p2 = strchr(p, '=');
+                if(p2) {
+                    listen_addr_len = ConvertHexToArray(p, listen_addr, (p2 - p) / 2);
+                    p2++;
+                    uint8_t len = strlen(p2);
+                    ListenFields = malloc(len + 1);
+                    if(ListenFields) memcpy(ListenFields, p2, len);
+                }
+            }
+        }
+    }
+    furi_string_free(str);
+    return err;
+}
+
+static void save_batch(void) {
+    FURI_LOG_D(TAG, "Save Batch");
+    char *p, *p2;
+    stream_seek(file_stream, 0, StreamOffsetFromEnd);
+    FuriHalRtcDateTime dt;
+    furi_hal_rtc_get_datetime(&dt);
+    stream_write_format(file_stream, "\n%s ", SettingsFld_WriteBatch);
+    p = (char*)furi_string_get_cstr(ReadBatch_cmd[view_cmd[rwt_read_batch]]);
+    p2 = strchr(p, ':');
+    if(p2 == NULL) p2 = p + strlen(p);
+    stream_write(file_stream, (uint8_t*)p, p2 - p);
+    stream_write_format(
+        file_stream,
+        " %02d.%02d.%02d %02d.%02d: ",
+        dt.day,
+        dt.month,
+        dt.year % 100,
+        dt.hour,
+        dt.minute);
+    for(uint16_t i = 0; i < Log_Total; i++) {
+        p = (char*)furi_string_get_cstr(Log[i]);
+        p2 = strchr(p, ':');
+        if(p2 && *(p2 - 1) != '*') { // skip string
+            if(*(p2 - 1) == ']') { // array
+                char* p3 = strchr(p, '[');
+                if(p3) {
+                    stream_write(file_stream, (uint8_t*)p, p3 - p - (*(p3 - 2) == '*' ? 2 : 0));
+                    stream_write_cstring(file_stream, "={");
+                    p = (p2 += 2);
+                    do {
+                        while(is_digit(p2, true) || *p2 == 'x') p2++;
+                        stream_write(file_stream, (uint8_t*)p, p2 - p);
+                        char c = *p2;
+                        if(c == '\0') break;
+                        if(c != ',') {
+                            p2 = strchr(p2, ',');
+                            if(p2 == NULL) break;
+                        }
+                        stream_write_char(file_stream, ',');
+                        p = ++p2;
+                    } while(1);
+                    stream_write_char(file_stream, '}');
+                }
+            } else {
+                stream_write(file_stream, (uint8_t*)p, p2 - p - (*(p2 - 2) == '*' ? 2 : 0));
+                stream_write_char(file_stream, '=');
+                p2 += 2;
+                p = strchr(p2, ' ');
+                if(p == NULL) p = p2 + strlen(p2);
+                stream_write(file_stream, (uint8_t*)p2, p - p2);
+            }
+            if(i < Log_Total - 1) stream_write_char(file_stream, ';');
+        }
+    }
+}
+
+static void input_callback(InputEvent* input_event, FuriMessageQueue* event_queue) {
+    furi_assert(event_queue);
+    PluginEvent event = {.type = EventTypeKey, .input = *input_event};
+    furi_message_queue_put(event_queue, &event, FuriWaitForever);
+}
+
+void display_remove_asterisk(char* fsp, uint8_t vx) {
+    char* p2 = strchr(fsp, '*');
+    if(p2) { // remove '*' or '*n'
+        int pos = p2 - fsp;
+        if((pos -= vx) < 0) pos = 0;
+        char c = *(p2 + 1);
+        if(*(screen_buf + pos))
+            memmove(
+                screen_buf + pos,
+                screen_buf + pos + (c == ':' || c == '=' ? 1 : 2),
+                FONT_5x7_SCREEN_WIDTH + 1 + 2 - pos);
+    }
+}
+
+void render_display_list(
+    Canvas* const canvas,
+    FuriString*** fsa,
+    char delim,
+    uint16_t view_pos,
+    uint16_t max_i) {
+    uint16_t page = view_pos & ~7;
+    char *p, *end;
+    uint16_t y, len;
+    for(uint8_t i = 0; i < 8 && page + i < max_i; i++) {
+        y = 14 + i * 7;
+        p = (char*)furi_string_get_cstr((*fsa)[page + i]);
+        end = strchr(p, delim);
+        if(end) {
+            len = MIN(end - p, view_x);
+            len = MIN(end - p - len, FONT_5x7_SCREEN_WIDTH);
+            strncpy(screen_buf, p + view_x, len);
+            screen_buf[len] = '\0';
+            display_remove_asterisk(p, MIN(end - p, view_x));
+            canvas_draw_str(canvas, 5, y, screen_buf);
+        }
+        if((view_pos & 7) == i) {
+            canvas_draw_str(canvas, 0, y, ">");
+            canvas_draw_str(canvas, -1, y, ">");
+        }
+    }
+}
+
+void display_edit_ttf_font(Canvas* const canvas, uint8_t start_x, uint8_t start_y) {
+    screen_buf[0] = *Edit_pos;
+    screen_buf[1] = '\0';
+    int n = canvas_string_width(canvas, screen_buf);
+    int len = Edit_pos - Edit_start;
+    memcpy(screen_buf, Edit_start, len);
+    screen_buf[len] = '\0';
+    int x = start_x + canvas_string_width(canvas, screen_buf);
+    int len2 = strlen(Edit_pos);
+    memcpy(screen_buf + len, Edit_pos, len2);
+    screen_buf[len + len2] = '\0';
+    canvas_draw_str(canvas, start_x, start_y, screen_buf);
+    start_y += 1;
+    canvas_draw_line(
+        canvas, x + (len ? 1 : 0), start_y, x + n + (*Edit_pos == '1' && len ? 1 : 0), start_y);
+}
+
+void display_add_status(void) {
+    if(NRF_ERROR)
+        strcat(screen_buf, "nRF24 ERROR!");
+    else if(ERR)
+        snprintf(screen_buf, sizeof(screen_buf), "ERROR %s", ERR_STR);
+    else if(send_status == sst_error)
+        strcat(screen_buf, "NO ACK!");
+    else if(send_status == sst_timeout)
+        strcat(screen_buf, "TIMEOUT!");
+    else if(send_status == sst_none)
+        ;
+    else if(send_status == sst_sending)
+        strcat(screen_buf, "sending");
+    else if(send_status == sst_receiving)
+        strcat(screen_buf, "receiving");
+    else if(
+        send_status == sst_ok &&
+        (rw_type == rwt_read_cmd ||
+         (rw_type == rwt_read_batch && (uint32_t)ReadBatch_cmd_curr == 0xFFFFFFFF) ||
+         (rw_type == rwt_set_batch && SetBatch_cmd_curr == Log_Total) ||
+         (rw_type == rwt_write_batch && WriteBatch_cmd_curr == Log_Total)))
+        strcat(screen_buf, "OK");
+    else
+        strcat(screen_buf, "working");
+}
+
+static void render_callback(Canvas* const canvas, void* ctx) {
+    if(ctx == NULL) return;
+    const PluginState* plugin_state = ctx;
+    if(furi_mutex_acquire(plugin_state->mutex, 5) != FuriStatusOk) return;
+
+    //canvas_draw_frame(canvas, 0, 0, 128, 64); // border around the edge of the screen
+    if(what_doing == 0) {
+        canvas_set_font(canvas, FontSecondary); // 8x10 font, 6 lines
+        snprintf(screen_buf, sizeof(screen_buf), "%s: %s", addr_len ? "File" : "Open", file_name);
+        canvas_draw_str(canvas, 8, 10, screen_buf);
+        if(addr_len) {
+            if(Edit) {
+                if(setup_cursor == 1)
+                    display_edit_ttf_font(canvas, 45, 20);
+                else if(setup_cursor == 2)
+                    display_edit_ttf_font(canvas, 55, 30);
+            }
+            if(!Edit || setup_cursor != 1) {
+                screen_buf[0] = '\0';
+                add_to_str_hex_bytes(screen_buf, addr, addr_len);
+                canvas_draw_str(canvas, 45, 20, screen_buf);
+            }
+            if(!Edit || setup_cursor != 2) {
+                snprintf(screen_buf, sizeof(screen_buf), "%d", NRF_channel);
+                canvas_draw_str(canvas, 55, 30, screen_buf);
+            }
+            canvas_draw_str(canvas, 8, 20, "Address:");
+            snprintf(screen_buf, sizeof(screen_buf), "Rate: %d, Ch:", NRF_rate);
+            canvas_draw_str(canvas, 8, 30, screen_buf);
+            snprintf(
+                screen_buf,
+                sizeof(screen_buf),
+                "RB: %d, R: %d, WB: %d",
+                ReadBatch_cmd_Total,
+                Read_cmd_Total,
+                WriteBatch_cmd_Total);
+            canvas_draw_str(canvas, 8, 40, screen_buf);
+            canvas_draw_str(canvas, 0, 64, Info);
+            canvas_draw_str(canvas, 0, 10 + setup_cursor * 10, ">");
+        } else {
+            snprintf(screen_buf, sizeof(screen_buf), "Ver. %s,  vad7", VERSION);
+            canvas_draw_str(canvas, 10, 60, screen_buf);
+            canvas_draw_str(canvas, 0, 10, ">");
+        }
+    } else if(what_doing == 1) {
+        if(rw_type == rwt_listen) {
+            canvas_set_font(canvas, FontSecondary); // 8x10 font, 6 lines
+            canvas_draw_str(canvas, 0, 10, "Listen mode");
+            canvas_draw_str(canvas, 0, 25, "Address:");
+            if(Edit)
+                display_edit_ttf_font(canvas, 40, 25);
+            else if(listen_addr_len) {
+                screen_buf[0] = '\0';
+                add_to_str_hex_bytes(screen_buf, listen_addr, listen_addr_len);
+                canvas_draw_str(canvas, 40, 25, screen_buf);
+            }
+            snprintf(
+                screen_buf,
+                sizeof(screen_buf),
+                "I: %d +(%d) mA",
+                Current - CurrentStart,
+                CurrentStart);
+            canvas_draw_str(canvas, 0, 60, screen_buf);
+        } else {
+            canvas_set_font(canvas, FontBatteryPercent); // 5x7 font, 9 lines, 25 cols
+            if(rw_type == rwt_read_batch) {
+                canvas_draw_str(canvas, 0, 7, "Read Batch:");
+                render_display_list(
+                    canvas, &ReadBatch_cmd, ':', view_cmd[rw_type], ReadBatch_cmd_Total);
+            } else if(rw_type == rwt_read_cmd) {
+                canvas_draw_str(canvas, 0, 7, "Read Command:");
+                render_display_list(canvas, &Read_cmd, '=', view_cmd[rw_type], Read_cmd_Total);
+            } else if(rw_type == rwt_write_batch) {
+                if(!ask_fill_screen_buf()) strcpy(screen_buf, "Write Batch:");
+                canvas_draw_str(canvas, 0, 7, screen_buf);
+                render_display_list(
+                    canvas, &WriteBatch_cmd, ':', view_cmd[rw_type], WriteBatch_cmd_Total);
+            } else if(rw_type == rwt_set_batch) {
+                strcpy(screen_buf, "Set: ");
+                display_add_status();
+                canvas_draw_str(canvas, 0, 7, screen_buf);
+                render_display_list(
+                    canvas, &SetBatch_cmd, ':', view_cmd[rw_type], SetBatch_cmd_Total);
+            }
+        }
+    } else { // what_doing == 2
+        if(rw_type == rwt_listen) {
+            canvas_set_font(canvas, FontSecondary); // 8x10 font, 6 lines
+            strcpy(screen_buf, "Listen: ");
+            if(NRF_ERROR)
+                strcat(screen_buf, "nRF24 ERROR!");
+            else if(ListenNew) {
+                snprintf(
+                    screen_buf + strlen(screen_buf),
+                    16,
+                    "%02d:%02d:%02d",
+                    ListenLastTime.hour,
+                    ListenLastTime.minute,
+                    ListenLastTime.second);
+                if(ListenPrev)
+                    snprintf(
+                        screen_buf + strlen(screen_buf), 16, " (%lu)", ListenLast - ListenPrev);
+            } else
+                strcat(screen_buf, "receiving");
+            snprintf(screen_buf + strlen(screen_buf), 16, " %dmA", Current - CurrentStart);
+            canvas_draw_str(canvas, 0, 10, screen_buf);
+            if(ListenFields) {
+                char *p2, *p = ListenFields;
+                uint8_t hex, len, *pld = payload_receive;
+                for(uint8_t i = 0; i < 5 && *p; i++) {
+                    hex = false;
+                    p2 = strchr(p, ',');
+                    if(p2 == NULL) p2 = p + strlen(p);
+                    if(*(p2 - 1) == '#') hex = true;
+                    memcpy(screen_buf, p, len = p2 - p);
+                    strcpy(screen_buf + len, ": ");
+                    if(ListenNew) {
+                        len = payload_struct[i];
+                        int32_t n = get_payload_receive_field(pld, len);
+                        if(hex) {
+                            strcat(screen_buf, "0x");
+                            add_to_str_hex_variable(screen_buf, pld, len);
+                        } else {
+                            snprintf(screen_buf + strlen(screen_buf), 20, "%ld", n);
+                            if(n > 9) {
+                                strcat(screen_buf, " (");
+                                add_to_str_hex_variable(screen_buf, pld, len);
+                                strcat(screen_buf, ")");
+                            }
+                        }
+                        pld += len;
+                    }
+                    canvas_draw_str(canvas, 0, 20 + i * 10, screen_buf);
+                    if(*p2 == '\0') break;
+                    p = p2 + 1;
+                }
+            }
+        } else if(rw_type == rwt_read_cmd) { // Read command
+            canvas_set_font(canvas, FontSecondary); // 8x10 font, 6 lines
+            if(!ask_fill_screen_buf()) {
+                strcpy(screen_buf, "Read ");
+                strcat(screen_buf, ReadRepeat ? "rep: " : "cmd: ");
+            }
+            display_add_status();
+            canvas_draw_str(canvas, 0, 10, screen_buf);
+            if(Log_Total) {
+                char* p = (char*)furi_string_get_cstr(Log[Log_Total - 1]);
+                uint8_t vx = MIN(view_x, strlen(p));
+                strncpy(screen_buf, p + vx, 30);
+                display_remove_asterisk(p, vx);
+                canvas_draw_str(canvas, 0, 15 + 10, screen_buf);
+            }
+        } else if(rw_type == rwt_set_batch) {
+            canvas_set_font(canvas, FontBatteryPercent); // 5x7 font, 9 lines, 25 cols
+            strcpy(screen_buf, "Set: ");
+            display_add_status();
+            canvas_draw_str(canvas, 0, 7, screen_buf);
+            render_display_list(canvas, &SetBatch_cmd, ':', view_cmd[rw_type], SetBatch_cmd_Total);
+        } else { // rwt_read_batch, rwt_write_batch
+            canvas_set_font(canvas, FontBatteryPercent); // 5x7 font, 9 lines, 25 cols
+            if(!ask_fill_screen_buf()) {
+                strcpy(screen_buf, rw_type == rwt_read_batch ? "Read Batch: " : "Write: ");
+                if(rw_type == rwt_read_batch || send_status != sst_none) {
+                    display_add_status();
+                } else if(rw_type == rwt_write_batch) {
+                    char* p =
+                        (char*)furi_string_get_cstr(WriteBatch_cmd[view_cmd[rwt_write_batch]]);
+                    char* end = strchr(p, ':');
+                    if(end) {
+                        uint8_t len = end - p;
+                        uint8_t lenb = strlen(screen_buf);
+                        end = screen_buf + lenb;
+                        lenb = FONT_5x7_SCREEN_WIDTH - lenb;
+                        if(len > lenb) {
+                            if(view_x < len) {
+                                strncpy(end, p + view_x, len = MIN(lenb, len - view_x));
+                                end[len] = '\0';
+                            }
+                        } else {
+                            strncpy(end, p, len);
+                            end[len] = '\0';
+                        }
+                    }
+                }
+            }
+            canvas_draw_str(canvas, 0, 7, screen_buf);
+            if(Log_Total) {
+                char* p;
+                uint16_t y, page = view_Batch & ~7;
+                uint8_t vx;
+                for(uint8_t i = 0; i < 8 && page + i < Log_Total; i++) {
+                    p = (char*)furi_string_get_cstr(Log[page + i]);
+                    y = 14 + i * 7;
+                    vx = MIN(view_x, strlen(p));
+                    if((view_Batch & 7) == i) {
+                        canvas_draw_str(canvas, 0, y, ">");
+                        canvas_draw_str(canvas, -1, y, ">");
+                        if(Edit) {
+                            int n = Edit_pos - p - vx - (FONT_5x7_SCREEN_WIDTH - 4);
+                            if(n > 0) vx += n; // fix out of screen
+                            int x = 6 + (Edit_pos - p - vx) * 5;
+                            canvas_draw_line(canvas, x - 1, y, x - 1, y - 1);
+                            canvas_draw_line(canvas, x - 1, y, n = x + 1 * 5, y);
+                            canvas_draw_line(canvas, n, y, n, y - 1);
+                        }
+                    }
+                    strncpy(screen_buf, p + vx, FONT_5x7_SCREEN_WIDTH + 2);
+                    screen_buf[FONT_5x7_SCREEN_WIDTH + 2] = '\0';
+                    display_remove_asterisk(p, vx);
+                    canvas_draw_str(canvas, 6, y, screen_buf);
+                }
+            }
+        }
+    }
+    furi_mutex_release(plugin_state->mutex);
+}
+
+void work_timer_callback(void* ctx) {
+    if(ctx == NULL) return;
+    if(rw_type == rwt_listen && (pwr_read_timer += WORK_PERIOD) >= POWER_READ_PERIOD) {
+        pwr_read_timer = 0;
+        update_power();
+    }
+    if(what_doing == 2) {
+        const PluginState* plugin_state = ctx;
+        if(furi_mutex_acquire(plugin_state->mutex, 0) != FuriStatusOk) return;
+        if(rw_type == rwt_write_batch || rw_type == rwt_set_batch) {
+            uint16_t* cmd_curr = rw_type == rwt_set_batch ? &SetBatch_cmd_curr :
+                                                            &WriteBatch_cmd_curr;
+            if(ERR == 0 && furi_get_tick() - NRF_time >= delay_between_pkt) {
+                if(send_status == sst_ok) {
+                    if(ERR == 0 && *cmd_curr < Log_Total) {
+                        if(++(*cmd_curr) < Log_Total)
+                            Run_WriteBatch_cmd();
+                        else { // finished ok
+                            if(rw_type == rwt_set_batch) what_doing = 1;
+                            Edited = false;
+                        }
+                    }
+                } else if(send_status == sst_sending) {
+                    if(NRF_repeat++ < NRF_resend)
+                        nrf24_send_packet();
+                    else {
+                        view_Batch = *cmd_curr;
+                        send_status = sst_error; // error NO_ACK
+                    }
+                }
+            }
+            if((ERR || send_status == sst_error) && rw_type == rwt_set_batch) {
+                what_doing = 1;
+            }
+            // ReadBatch or ReadCmd
+        } else if(send_status == sst_sending) { // sending
+            if(furi_get_tick() - NRF_time > delay_between_pkt) {
+                if(NRF_repeat++ < NRF_resend) {
+                    nrf24_resend_read_packet();
+                } else
+                    send_status = sst_error; // error NO_ACK
+            }
+        } else if(send_status == sst_receiving) { // receiving
+            for(uint8_t i = 0; i < 3; i++) {
+                if(nrf24_read_newpacket()) {
+                    if(rw_type == rwt_listen) {
+                        ListenPrev = ListenLast;
+                        furi_hal_rtc_get_datetime(&ListenLastTime);
+                        ListenLast = furi_hal_rtc_datetime_to_timestamp(&ListenLastTime);
+                        ListenNew = true;
+                    } else if(send_status != sst_receiving)
+                        break;
+                } else {
+                    if(rw_type != rwt_listen && furi_get_tick() - NRF_time > NRF_READ_TIMEOUT) {
+                        if(NRF_repeat++ < NRF_resend) {
+                            send_status = sst_sending;
+                            nrf24_resend_read_packet();
+                        } else {
+                            FURI_LOG_D(TAG, "TIMEOUT: %lu", furi_get_tick() - NRF_time);
+                            send_status = sst_timeout;
+                        }
+                    }
+                    break;
+                }
+            }
+        } else if(send_status == sst_ok) {
+            if(rw_type == rwt_read_batch) {
+                if((uint32_t)ReadBatch_cmd_curr != 0xFFFFFFFF && ERR == 0 &&
+                   furi_get_tick() - NRF_time >= delay_between_pkt) {
+                    Run_ReadBatch_cmd(NULL);
+                }
+            }
+        }
+        furi_mutex_release(plugin_state->mutex);
+    }
+}
+
+void next_rw_type(int8_t add) {
+    do {
+        rw_type += add;
+        if(rw_type >= rwt_max) {
+            if(add > 0)
+                rw_type = 0;
+            else
+                rw_type = rwt_max - 1;
+        }
+        if(rw_type == rwt_set_batch && SetBatch_cmd_Total) break;
+        if(rw_type == rwt_read_batch && ReadBatch_cmd_Total) break;
+        if(rw_type == rwt_read_cmd && Read_cmd_Total) break;
+        if(rw_type == rwt_write_batch && WriteBatch_cmd_Total) break;
+    } while(rw_type != rwt_listen);
+    send_status = sst_none;
+}
+
+void next_view_cmd(int8_t add) {
+    if(rw_type == rwt_listen) return;
+    uint16_t max =
+        (rw_type == rwt_read_batch ? ReadBatch_cmd_Total :
+         rw_type == rwt_read_cmd   ? Read_cmd_Total :
+         rw_type == rwt_set_batch  ? SetBatch_cmd_Total :
+                                     WriteBatch_cmd_Total);
+    if((view_cmd[rw_type] += add) >= max) view_cmd[rw_type] = add > 0 ? 0 : max - 1;
+}
+
+int32_t nrf24batch_app(void* p) {
+    UNUSED(p);
+    APP = malloc(sizeof(nRF24Batch));
+    FuriMessageQueue* event_queue = furi_message_queue_alloc(8, sizeof(PluginEvent));
+    APP->plugin_state = malloc(sizeof(PluginState));
+    APP->plugin_state->mutex = furi_mutex_alloc(FuriMutexTypeNormal);
+    if(!APP->plugin_state->mutex) {
+        furi_message_queue_free(event_queue);
+        FURI_LOG_E(TAG, "cannot create mutex");
+        free(APP->plugin_state);
+        return 255;
+    }
+    // Set system callbacks
+    ViewPort* view_port = view_port_alloc();
+    view_port_draw_callback_set(view_port, render_callback, APP->plugin_state);
+    view_port_input_callback_set(view_port, input_callback, event_queue);
+
+    // Open GUI and register view_port
+    APP->gui = furi_record_open(RECORD_GUI);
+    gui_add_view_port(APP->gui, view_port, GuiLayerFullscreen);
+    APP->notification = furi_record_open(RECORD_NOTIFICATION);
+    APP->storage = furi_record_open(RECORD_STORAGE);
+    storage_common_mkdir(APP->storage, SCAN_APP_PATH_FOLDER);
+    file_stream = file_stream_alloc(APP->storage);
+    FuriTimer* work_timer =
+        furi_timer_alloc(work_timer_callback, FuriTimerTypePeriodic, APP->plugin_state);
+    furi_timer_start(work_timer, WORK_PERIOD);
+    nrf24_init();
+    check_en_power_5V();
+
+    PluginEvent event;
+    for(bool processing = true; processing;) {
+        FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100);
+        furi_mutex_acquire(APP->plugin_state->mutex, FuriWaitForever);
+
+        static FuriLogLevel FuriLogLevel = FuriLogLevelDefault;
+        if(furi_log_get_level() != FuriLogLevel) {
+            FuriLogLevel = furi_log_get_level();
+            if(FuriLogLevel == FuriLogLevelDebug)
+                furi_hal_uart_set_br(FuriHalUartIdUSART1, 1843200);
+        }
+        if(what_doing == 2 && rw_type == rwt_read_cmd && ReadRepeat &&
+           furi_get_tick() - NRF_time > (uint32_t)(ReadCmdRepeatPeriod * 1000)) {
+            ERR = 0;
+            free_Log();
+            Run_Read_cmd(Read_cmd[view_cmd[rwt_read_cmd]]);
+            notification_message(APP->notification, &sequence_blink_blue_100);
+        }
+
+        if(event_status == FuriStatusOk) {
+            // press events
+            if(event.type == EventTypeKey) {
+                switch(event.input.key) {
+                case InputKeyUp:
+                    if(event.input.type == InputTypeShort || event.input.type == InputTypeRepeat) {
+                        if(!ask_question) {
+                            if(Edit) {
+                                char c = *Edit_pos;
+                                if(Edit_hex) {
+                                    if(c == '9')
+                                        *Edit_pos = 'A';
+                                    else if(c < 'F' || c < '9')
+                                        *Edit_pos = c + 1;
+                                } else {
+                                    if(c == '-')
+                                        *Edit_pos = '0';
+                                    else if(c < '9')
+                                        *Edit_pos = c + 1;
+                                    else {
+                                        c = *(Edit_pos - 1);
+                                        if(Edit_pos > Edit_start && c < '9' && c >= '0') {
+                                            *Edit_pos = '0';
+                                            (*(Edit_pos - 1)) = c + 1;
+                                        }
+                                    }
+                                }
+                            } else if(what_doing == 0) {
+                                if(addr_len) {
+                                    if(setup_cursor > 0)
+                                        setup_cursor--;
+                                    else
+                                        setup_cursor = 2;
+                                }
+                            } else if(what_doing == 1)
+                                next_view_cmd(-1);
+                            else if(what_doing == 2)
+                                if(view_Batch) view_Batch--;
+                        }
+                    }
+                    break;
+                case InputKeyDown:
+                    if(event.input.type == InputTypeShort || event.input.type == InputTypeRepeat) {
+                        if(!ask_question) {
+                            if(Edit) {
+                                if(*Edit_pos != '-') {
+                                    if(Edit_hex && *Edit_pos == 'A')
+                                        (*Edit_pos) = '9';
+                                    else if(*Edit_pos > '0')
+                                        (*Edit_pos)--;
+                                    else if(!Edit_hex) {
+                                        if(Edit_pos > Edit_start) {
+                                            if(*(Edit_pos - 1) > '0' && *(Edit_pos - 1) <= '9') {
+                                                *Edit_pos = '9';
+                                                (*(Edit_pos - 1))--;
+                                            }
+                                        } else
+                                            Edit_insert_digit('-'); // negative
+                                    }
+                                }
+                            } else if(what_doing == 0) {
+                                if(addr_len) {
+                                    if(setup_cursor < 2)
+                                        setup_cursor++;
+                                    else
+                                        setup_cursor = 0;
+                                }
+                            } else if(what_doing == 1)
+                                next_view_cmd(+1);
+                            else if(what_doing == 2)
+                                if(view_Batch < Log_Total - 1) view_Batch++;
+                        }
+                    }
+                    break;
+                case InputKeyLeft:
+                    if(event.input.type == InputTypeShort || event.input.type == InputTypeRepeat) {
+                        if(ask_question) {
+                            if(event.input.type == InputTypeShort) ask_question_answer ^= 1;
+                        } else if(Edit) {
+                            if(Edit_pos > Edit_start) {
+                                if(is_digit(Edit_pos - 1, Edit_hex))
+                                    Edit_pos--;
+                                else if(*(Edit_pos - 1) == 'x' && *(Edit_pos - 3) == ',')
+                                    Edit_pos -= 4;
+                                else if(*(Edit_pos - 1) == ',')
+                                    Edit_pos -= 2;
+                            }
+                        } else if(what_doing == 0) {
+                            if(addr_len) {
+                                rw_type = rwt_listen;
+                                what_doing = 1;
+                            }
+                        } else if(what_doing == 1) {
+                            if(event.input.type == InputTypeShort)
+                                next_rw_type(-1);
+                            else if(view_x)
+                                view_x--;
+                        } else if(what_doing == 2)
+                            if(view_x) view_x--;
+                    } else if(event.input.type == InputTypeLong) {
+                        if(!ask_question && view_x == 0 && what_doing == 2 &&
+                           (rw_type == rwt_write_batch || rw_type == rwt_read_batch) &&
+                           Log_Total && Log[view_Batch] != NULL) {
+                            ask_question = ask_skip_cmd;
+                            ask_question_answer = 1;
+                        }
+                    }
+                    break;
+                case InputKeyRight:
+                    if(event.input.type == InputTypeShort || event.input.type == InputTypeRepeat) {
+                        if(ask_question) {
+                            ask_question_answer ^= 1;
+                        } else if(Edit) {
+                            if(is_digit(Edit_pos + 1, Edit_hex))
+                                Edit_pos++;
+                            else if(*(Edit_pos + 1) == ',') {
+                                Edit_pos += 2;
+                                if(*(Edit_pos + 1) == 'x') Edit_pos += 2;
+                            }
+                        } else if(what_doing == 0) {
+                            if(addr_len) {
+                                rw_type = rwt_set_batch;
+                                what_doing = 1;
+                            }
+                        } else if(what_doing == 1) {
+                            if(event.input.type == InputTypeShort)
+                                next_rw_type(+1);
+                            else
+                                view_x++;
+                        } else if(what_doing == 2)
+                            view_x++;
+                    }
+                    break;
+                case InputKeyOk:
+                    if(event.input.type == InputTypeShort) {
+                        if(ask_question) {
+                            if(ask_question_answer) {
+                                if(ask_question == ask_save_batch) {
+                                    save_batch();
+                                } else if(ask_question == ask_write_batch) {
+                                    if(WriteBatch_cmd_Total) {
+                                        if(what_doing == 1) {
+                                            Prepare_Write_cmd(
+                                                WriteBatch_cmd[view_cmd[rwt_write_batch]]);
+                                            send_status = sst_none;
+                                            Edited = false;
+                                            view_x = 0;
+                                            view_Batch = 0;
+                                        }
+                                        if(Log_Total) {
+                                            ERR = 0;
+                                            WriteBatch_cmd_curr = 0;
+                                            Run_WriteBatch_cmd();
+                                            what_doing = 2;
+                                        }
+                                    }
+                                } else if(ask_question == ask_skip_cmd) {
+                                    if(rw_type == rwt_write_batch || rw_type == rwt_read_batch) {
+                                        furi_string_free(Log[view_Batch]);
+                                        if(view_Batch < Log_Total - 1)
+                                            memmove(
+                                                &Log[view_Batch],
+                                                &Log[view_Batch + 1],
+                                                sizeof(Log) * (Log_Total - view_Batch - 1));
+                                        else
+                                            view_Batch--;
+                                        Log_Total--;
+                                    }
+                                } else if(ask_question == ask_exit) {
+                                    processing = false;
+                                } else if(ask_question == ask_return) {
+                                    if(what_doing == 2) {
+                                        ERR = 0;
+                                        send_status = sst_none;
+                                        Edited = false;
+                                        what_doing--;
+                                    }
+                                }
+                            }
+                            ask_question = 0;
+                        } else if(Edit) { // insert digit
+                            Edit_insert_digit('0');
+                        } else if(what_doing == 0) {
+                            if(setup_cursor == 0) { // open file
+                                file_stream_close(file_stream);
+                                if(select_settings_file()) {
+                                    uint8_t err = load_settings_file();
+                                    if(err)
+                                        snprintf(
+                                            file_name, sizeof(file_name), "LOAD ERROR #%d", err);
+                                }
+                            } else if(setup_cursor == 1) { // change address
+                                char* ebuf = (char*)payload;
+                                ebuf[0] = '\0';
+                                add_to_str_hex_bytes(ebuf, addr, addr_len);
+                                Edit_hex = true;
+                                Edit_pos = ebuf + strlen(ebuf) - 1;
+                                Edit_start = ebuf;
+                                Edit = 1;
+                                NRF_INITED = 0;
+                            } else if(setup_cursor == 2) { // change channel
+                                char* ebuf = (char*)payload;
+                                snprintf(ebuf, sizeof(payload), "%d", NRF_channel);
+                                Edit_hex = false;
+                                Edit_pos = ebuf + strlen(ebuf) - 1;
+                                Edit_start = ebuf;
+                                Edit = 1;
+                                NRF_INITED = 0;
+                            }
+                        } else if(what_doing == 1) {
+                            if(rw_type == rwt_set_batch) {
+                                if(SetBatch_cmd_Total) {
+                                    ERR = 0;
+                                    send_status = sst_none;
+                                    Prepare_Write_cmd(SetBatch_cmd[view_cmd[rwt_set_batch]]);
+                                    if(!ERR) {
+                                        SetBatch_cmd_curr = 0;
+                                        Run_WriteBatch_cmd();
+                                        what_doing = 2;
+                                    }
+                                    Edited = false;
+                                }
+                            } else if(rw_type == rwt_read_batch) {
+                                if(ReadBatch_cmd_Total) {
+                                    ERR = 0;
+                                    Run_ReadBatch_cmd(ReadBatch_cmd[view_cmd[rwt_read_batch]]);
+                                    view_x = 0;
+                                    view_Batch = 0;
+                                    what_doing = 2;
+                                }
+                            } else if(rw_type == rwt_read_cmd) {
+                                if(Read_cmd_Total) {
+                                    ERR = 0;
+                                    free_Log();
+                                    Run_Read_cmd(Read_cmd[view_cmd[rwt_read_cmd]]);
+                                    view_x = 0;
+                                    what_doing = 2;
+                                }
+                            } else if(rw_type == rwt_write_batch) {
+                                if(WriteBatch_cmd_Total) {
+                                    ERR = 0;
+                                    Prepare_Write_cmd(WriteBatch_cmd[view_cmd[rwt_write_batch]]);
+                                    send_status = sst_none;
+                                    Edited = false;
+                                    view_x = 0;
+                                    view_Batch = 0;
+                                    what_doing = 2;
+                                }
+                            } else if(rw_type == rwt_listen) {
+                                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;
+                                }
+                            }
+                        } else if(what_doing == 2) {
+                            if(rw_type == rwt_read_cmd) {
+                                ERR = 0;
+                                free_Log();
+                                Run_Read_cmd(Read_cmd[view_cmd[rwt_read_cmd]]);
+                            } else if(Log_Total) {
+                                if(rw_type == rwt_read_batch) {
+                                    ask_question = ask_save_batch;
+                                    ask_question_answer = 0;
+                                } else if(rw_type == rwt_write_batch) {
+                                    ask_question = ask_write_batch;
+                                    ask_question_answer = 0;
+                                }
+                            }
+                        }
+                    } else if(event.input.type == InputTypeLong) {
+                        if(Edit) { // delete
+                            if(what_doing <= 1) {
+                                if(strlen(Edit_start) > 1) {
+                                    memmove(Edit_pos, Edit_pos + 1, strlen(Edit_pos));
+                                    if(*Edit_pos == '\0') Edit_pos--;
+                                }
+                            } else {
+                                FuriString* fs = Log[view_Batch];
+                                if(is_digit(Edit_pos + 1, Edit_hex) ||
+                                   (Edit_pos > Edit_start && is_digit(Edit_pos - 1, Edit_hex))) {
+                                    memmove(Edit_pos, Edit_pos + 1, strlen(Edit_pos));
+                                    if(*Edit_pos == '\0') Edit_pos--;
+                                    furi_string_left(fs, furi_string_size(fs) - 1);
+                                }
+                            }
+                        } else if(what_doing == 1) {
+                            if(rw_type == rwt_listen) {
+                                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(rw_type == rwt_read_batch) {
+                                if(ReadBatch_cmd_Total) {
+                                    ERR = 0;
+                                    Run_ReadBatch_cmd(ReadBatch_cmd[view_cmd[rwt_read_batch]]);
+                                    view_x = 0;
+                                    view_Batch = 0;
+                                    what_doing = 2;
+                                }
+                            } else if(rw_type == rwt_write_batch) {
+                                ask_question = ask_write_batch;
+                                ask_question_answer = 0;
+                            }
+                        } else if(what_doing == 2) {
+                            if(rw_type == rwt_read_cmd) {
+                                ReadRepeat = !ReadRepeat;
+                            } else if(Log_Total) {
+                                if(rw_type == rwt_write_batch) {
+                                    if(!Edit) {
+                                        Edit = 0;
+                                        Edit_hex = 0;
+                                        char* s = (char*)furi_string_get_cstr(Log[view_Batch]);
+                                        char* p = strchr(s, '=');
+                                        if(p) {
+                                            p++;
+                                            if(*p == '{') p++; // array
+                                            if(*(p + 1) == 'x') {
+                                                p += 2;
+                                                Edit_hex = 1; // hex
+                                            }
+                                            if(is_digit(p, Edit_hex)) {
+                                                Edit_start = p;
+                                                while(is_digit(p, Edit_hex)) p++;
+                                                Edit_pos = p - 1;
+                                                Edited = true;
+                                                Edit = 1;
+                                            }
+                                        }
+                                    }
+                                } else if(rw_type == rwt_read_batch) {
+                                    ask_question = ask_save_batch;
+                                    ask_question_answer = 0;
+                                }
+                            }
+                        }
+                    }
+                    break;
+                case InputKeyBack:
+                    if(event.input.type == InputTypeLong) {
+                        if(what_doing == 2 && Edited) {
+                            if(!ask_question) ask_question_answer = 1;
+                            ask_question = ask_exit;
+                        } else
+                            processing = false;
+                    } else if(event.input.type == InputTypeShort) {
+                        if(ask_question)
+                            ask_question = 0;
+                        else if(Edit) {
+                            if(what_doing == 0) {
+                                if(setup_cursor == 1) {
+                                    addr_len = ConvertHexToArray((char*)payload, addr, 5);
+                                } else if(setup_cursor == 2) {
+                                    NRF_channel = str_to_int((char*)payload);
+                                    if(NRF_channel > MAX_CHANNEL) NRF_channel = MAX_CHANNEL;
+                                }
+                            } else if(what_doing == 1 && rw_type == rwt_listen) {
+                                listen_addr_len =
+                                    ConvertHexToArray((char*)payload, listen_addr, 5);
+                            }
+                            Edit = 0;
+                        } else {
+                            if(what_doing == 2 && Edited) {
+                                ask_question = ask_return;
+                                ask_question_answer = 1;
+                            } else if(what_doing != 0) {
+                                if(what_doing) what_doing--;
+                                if(what_doing == 0) rw_type = rwt_read_batch;
+                                if(what_doing <= 1) view_x = 0;
+                                ERR = 0;
+                                send_status = sst_none;
+                            }
+                        }
+                    }
+                    break;
+                default:
+                    break;
+                }
+            }
+        }
+
+        view_port_update(view_port);
+        furi_mutex_release(APP->plugin_state->mutex);
+    }
+    nrf24_set_idle(nrf24_HANDLE);
+    nrf24_deinit();
+    if(NRF_BOARD_POWER_5V) furi_hal_power_disable_otg();
+
+    view_port_enabled_set(view_port, false);
+    gui_remove_view_port(APP->gui, view_port);
+    furi_record_close(RECORD_GUI);
+    furi_record_close(RECORD_NOTIFICATION);
+    furi_record_close(RECORD_STORAGE);
+    if(file_stream) {
+        file_stream_close(file_stream);
+        stream_free(file_stream);
+    }
+    view_port_free(view_port);
+    furi_message_queue_free(event_queue);
+    free_store();
+    furi_timer_stop(work_timer);
+    furi_timer_free(work_timer);
+    furi_mutex_free(APP->plugin_state->mutex);
+    free(APP->plugin_state);
+    free(APP);
+    return 0;
+}

+ 32 - 0
nrf24batch.h

@@ -0,0 +1,32 @@
+#pragma once
+
+#include <gui/gui.h>
+#include <gui/view.h>
+#include <gui/view_dispatcher.h>
+#include <gui/modules/submenu.h>
+#include <gui/modules/dialog_ex.h>
+#include <toolbox/stream/file_stream.h>
+#include <notification/notification_messages.h>
+#include <power/power_service/power.h>
+#include <power/power_service/power_i.h>
+
+typedef enum {
+    EventTypeTick,
+    EventTypeKey,
+} EventType;
+
+typedef struct {
+    EventType type;
+    InputEvent input;
+} PluginEvent;
+
+typedef struct {
+    FuriMutex* mutex;
+} PluginState;
+
+typedef struct {
+    Gui* gui;
+    Storage* storage;
+    NotificationApp* notification;
+    PluginState* plugin_state;
+} nRF24Batch;

BIN
nrf24batch_10px.png