Skip to content

Commit 41fbbbf

Browse files
committed
fix
1 parent 0e4bb3d commit 41fbbbf

File tree

2 files changed

+53
-48
lines changed

2 files changed

+53
-48
lines changed

Distr/nrf24batch/Kitchen Vent.txt

+44-44
Original file line numberDiff line numberDiff line change
@@ -9,46 +9,30 @@ Resend: 3
99
Delay_ms: 30
1010

1111
Payload struct: 2,1,1
12-
EEPROM=0; RAM=1; PROGMEM=2; ID=3; RESET=4
12+
EEPROM=0; RAM=1; PROGMEM=2; ID=3; RESET=4, WRAM=0x89
1313

1414
R default: ,EEPROM,0xC1
1515
W default: n,,0x81
1616
Write start: 0,0,0x8F
1717

1818
R: ID*=,ID
19-
R: FanOn=0x77,RAM,0xC1
20-
S: FanSet=,,0x40
21-
S: Lamp=,,0x20
22-
R: FanSpeed=0x76,RAM,0xC1
23-
24-
R: CO2 level 1*2=4,,0xC2
25-
W: CO2 level 1=,4,0x82
26-
R: CO2 level 2*2=6,,0xC2
27-
W: CO2 level 2=,6,0x82
28-
R: CO2 level 3*2=8,,0xC2
29-
W: CO2 level 3=,8,0x82
30-
31-
R: FanSpeed_1=19
32-
W: FanSpeed_1=,19
33-
R: FanSpeed_2=20
34-
W: FanSpeed_2=,20
35-
R: FanSpeed_3=21
36-
W: FanSpeed_3=,21
37-
R: FanCookSpeed_1=22
38-
W: FanCookSpeed_1=,22
39-
R: FanCookSpeed_2=23
40-
W: FanCookSpeed_2=,23
41-
R: FanCookSpeed_3=24
42-
W: FanCookSpeed_3=,24
43-
44-
R: FanStartupTime=10
45-
W: FanStartupTime=,10
19+
20+
R: CO2 level*2[3]=i:4,,0xC2
21+
W: CO2 level*2=,i:4,0x82
22+
23+
R: FanSpeed[3]=i:19
24+
W: FanSpeed=,i:19
25+
R: FanCookSpeed[3]=i:22
26+
W: FanCookSpeed=,i:22
27+
28+
R: FanOnTime=10
29+
W: FanOnTime=,10
4630

4731
R: FanOffTime=11
4832
W: FanOffTime=,11
4933

50-
R: FanCookStartupTime=12
51-
W: FanCookStartupTime=,12
34+
R: FanCookOnTime=12
35+
W: FanCookOnTime=,12
5236

5337
R: FanCookOffTime=13
5438
W: FanCookOffTime=,13
@@ -59,17 +43,17 @@ W: FanSleep=,14
5943
R: FanCookSleep=15
6044
W: FanCookSleep=,15
6145

62-
R: FanSpeedInitIdx=16
63-
W: FanSpeedInitIdx=,16
46+
R: SpeedInitIdx=16
47+
W: SpeedInitIdx=,16
6448

65-
R: FanSpeedKey=17
66-
W: FanSpeedKey=,17
49+
R: SpeedKeyIdx=17
50+
W: SpeedKeyIdx=,17
6751

6852
R: IRRemotes=32
6953
W: IRRemotes=,32
7054

7155
R: IRRemotesHash*2[80]=i:32#
72-
W: IRRemotesHash=,i:32
56+
W: IRRemotesHash*2=,i:32
7357

7458
R: OutPeriod=18
7559
W: OutPeriod=,18
@@ -83,9 +67,24 @@ W: RxAddr=,2
8367
R: Ch=3
8468
W: Ch=,3
8569

86-
R: OSCCAL=0x51,RAM
70+
R: OSCCAL#=0x51,RAM
71+
W: OSCCAL#=,0x51,WRAM
8772
R: OSCCAL_EMEM=0
8873

74+
R: PORTA#=0x39,RAM
75+
W: PORTA#=,0x3B,WRAM
76+
R: PORTB#=0x36,RAM
77+
W: PORTB#=,0x38,WRAM
78+
79+
R: LED Warning#=0x6C,RAM
80+
W: LED Warning#=,0x6C,WRAM
81+
82+
R: FanOn=0x76,RAM
83+
R: FanOnNext=0x74,RAM
84+
R: FanOnNextCnt=0x72,RAM
85+
R: FanOnLast=0x73,RAM
86+
R: Fanspeed=0x75,RAM
87+
8988
W: Reset=,RESET,0xC1
9089

9190
S: Lamp=,0,0x40
@@ -102,13 +101,14 @@ SBatch: Fan Down: FanSpdDn=0
102101
SBatch: Lamp On: Lamp=1
103102
SBatch: Lamp Off: Lamp=0
104103

105-
RBatch: Work: ID;CO2 level 1;CO2 level 2;CO2 level 3;FanCookSpeed_1;FanCookSpeed_2;FanCookSpeed_3;FanCookStartupTime;FanCookOffTime;FanCookSleep;FanSpeed_1;FanSpeed_2;FanSpeed_3;FanStartupTime;FanOffTime;FanSleep
106-
RBatch: Hardware: ID;RxAddr;Ch;FanSpeedInitIdx;Flags;OutPeriod;IRRemotes;OSCCAL_EMEM
107-
RBatch: All: ID;CO2 level 1;CO2 level 2;CO2 level 3;FanCookSpeed_1;FanCookSpeed_2;FanCookSpeed_3;FanCookStartupTime;FanCookOffTime;FanCookSleep;FanSpeed_1;FanSpeed_2;FanSpeed_3;FanStartupTime;FanOffTime;FanSleep;RxAddr;Ch;FanSpeedInitIdx;Flags;OutPeriod;IRRemotes;IRRemotesHash
104+
RBatch: Work: ID;CO2 level;FanCookSpeed;FanCookOnTime;FanCookOffTime;FanCookSleep;FanSpeed;FanOnTime;FanOffTime;FanSleep
105+
RBatch: Hardware: ID;RxAddr;Ch;SpeedInitIdx;Flags;OutPeriod;IRRemotes;OSCCAL_EMEM
106+
RBatch: All: ID;CO2 level;FanCookSpeed;FanCookOnTime;FanCookOffTime;FanCookSleep;FanSpeed;FanOnTime;FanOffTime;FanSleep;RxAddr;Ch;SpeedInitIdx;Flags;OutPeriod;IRRemotes;IRRemotesHash
108107

108+
WBatch: Init(Cook2spd,Lamp-F2.2): RxAddr=0xC1;Ch=122;CO2 level={700,850,1000};FanSpeed={3,5,6};FanCookSpeed={3,6,12};FanSleep=20;FanCookSleep=6;FanOnTime=150;FanCookOnTime=2;FanOffTime=100;FanCookOffTime=0;SpeedInitIdx=0;SpeedKeyIdx=6;Flags=0x49;OutPeriod=6;IRRemotes=0
109+
WBatch: LED Warning: LED Warning#=0x10
110+
WBatch: PORTA: PORTA#=0x0C
111+
WBatch: PORTB: PORTB#=0xC
112+
WBatch: OSCCAL: OSCCAL#=128
113+
WBatch: CO2 Level+Fan speed: CO2 level={700,850,1000};FanSpeed={3,5,6}
109114
WBatch: Reset: Reset
110-
111-
SBatch: SetSpeed: FanSet=1
112-
SBatch: Fan OFF: FanSet=0
113-
SBatch: Lamp ON: Lamp=1
114-
SBatch: Lamp OFF: Lamp=0

nrf24batch.c

+9-4
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ bool nrf24_read_newpacket() {
492492
if(--cmd_array_cnt) {
493493
furi_string_cat_str(str, ",");
494494
if(cmd_array_hex) furi_string_cat_str(str, "0x");
495-
payload[cmd_array_idx]++; // next array element
495+
payload[cmd_array_idx] += size; // next array element
496496
NRF_repeat = -1;
497497
send_status = sst_sending; // Will be send after delay_between_pkt
498498
} else send_status = sst_ok;
@@ -744,7 +744,7 @@ bool Run_WriteBatch_cmd()
744744
}
745745
}
746746
FURI_LOG_D(TAG, "%cBatch: =%d, (%d)%s", rw_type == rwt_write_batch ? 'W' : 'S', (int)new, len, p);
747-
char *w, *delim_col, i;
747+
char *w, *delim_col, i, size;
748748
FuriString* str = furi_string_alloc();
749749
stream_rewind(file_stream);
750750
while(stream_read_line(file_stream, str)) {
@@ -753,7 +753,12 @@ bool Run_WriteBatch_cmd()
753753
else if(strncmp(w, SettingsFld_Set, sizeof(SettingsFld_Set)-1) == 0) w += sizeof(SettingsFld_Set);
754754
else continue;
755755
delim_col = strchr(w, '=');
756-
if(delim_col == NULL || len != delim_col - w) continue;
756+
if(delim_col == NULL) continue;
757+
size = 1;
758+
if(*(delim_col - 2) == '*') {
759+
if(len != delim_col - w - 2) continue;
760+
size = *(delim_col - 1) - '0';
761+
} else if(len != delim_col - w) continue;
757762
if(strncmp(p, w, len) != 0) continue;
758763
delim_col++;
759764
str_rtrim(delim_col);
@@ -790,7 +795,7 @@ bool Run_WriteBatch_cmd()
790795
}
791796
arr++;
792797
new = str_to_int(arr);
793-
cmd_array_cnt = payload[cmd_array_idx] + 1;
798+
cmd_array_cnt = payload[cmd_array_idx] + size;
794799
//furi_delay_ms(delay_between_pkt); // do it fast
795800
continue; // send next array element
796801
} else send_status = sst_ok;

0 commit comments

Comments
 (0)