ESP32-DevKitCVIE
Moderators: grovkillen, Stuntteam, TD-er
ESP32-DevKitCVIE
Hello
that firmware is best for this board ESP32-DevKitCVIE https://www.espressif.com/en/products/d ... 32-devkitc
it has ESP32-WROVER-IE and 8 MB Flash + 8 MB PSRAM
Thanks
that firmware is best for this board ESP32-DevKitCVIE https://www.espressif.com/en/products/d ... 32-devkitc
it has ESP32-WROVER-IE and 8 MB Flash + 8 MB PSRAM
Thanks
Re: ESP32-DevKitCVIE
Right now we don't really use the PSRAM (yet)
So there you don't need to look for a special build for the WROVER.
Just any ESP32 (not the ESP32-S2) build for 4M would do.
I don't think we have special 8M builds.
Keep in mind you need to flash the bin file with "factory" in the name via serial.
Later OTA updates should not have "factory" in the file name.
So there you don't need to look for a special build for the WROVER.
Just any ESP32 (not the ESP32-S2) build for 4M would do.
I don't think we have special 8M builds.
Keep in mind you need to flash the bin file with "factory" in the name via serial.
Later OTA updates should not have "factory" in the file name.
Re: ESP32-DevKitCVIE
It can be created with Platformio custom buidl? I cant find where can change flash size
Re: ESP32-DevKitCVIE
That is more than a simple flash-size change, also need to adjust a partition table and some other parameters (didn't have a close look yet, but will later today, I've done this for the 16MB MAX builds in the past
)

/Ton (PayPal.me)
Re: ESP32-DevKitCVIE
I have not yet tested the 8M board definition, so no idea if it will work.
But you could add this to the platformio_esp32_envs.ini file:
But why do you really need the 8M?
Any build made for smaller flash size will work, only you won't be using the full amount of available flash.
But you could add this to the platformio_esp32_envs.ini file:
Code: Select all
[env:custom_ESP32_8M2M]
extends = esp32_custom_base
board = esp32_8M
Any build made for smaller flash size will work, only you won't be using the full amount of available flash.
Re: ESP32-DevKitCVIE
maybe i realy dont need it, but have to try it/
I want to create access system with local copy of user data base/ now i use remote user base and some times have problems with WIFI ( and cant open doors
) i need 150+ users
I want to create access system with local copy of user data base/ now i use remote user base and some times have problems with WIFI ( and cant open doors

Re: ESP32-DevKitCVIE
OK, then I can imagine you may want a larger file system to have all users mentioned in the rules file.
Re: ESP32-DevKitCVIE
to store user keys i use system variables and then compare it with tag
then key are from 1-20 it is fast camparision but then key are from 100+ it take long time to compare
maybe there is more fast way to compare key variables?
Code: Select all
on Turnstile_out#Tag do
Let,0,[Turnstile_out#Tag]
event,readet
endon
on Turnstile_in#Tag do
Let,0,[Turnstile_in#Tag]
event,readet
endon
on readet do
if %v0%=%v1%
event,OkTag
endif
if %v0%=%v2%
event,OkTag
endif
.............
if %v0%=%v299%
event,OkTag
endif
if %v0%=%v300%
event,OkTag
endif
endon
on OkTag do
LongPulse,25,0,2
Let,0,0
endon
maybe there is more fast way to compare key variables?
Re: ESP32-DevKitCVIE
There is no FOR loop in rules, but we can sort of simulate that using the LoopTimerSet/LoopTimerSet_ms commands.
Some remarks:
- Set serial logging to ERROR level, to avoid memory issues, as there will be a lot of logging in quick succession. Below script will log a few messages at ERROR level, though they are not errors!
- The LoopTimerSet_ms command will currently loop 10 times, that's what I used for testing, change that to the number of tags in use!
- Place this script, in this order, as the top lines in Rules1 file for smoothest/fastest processing
- The interval between events is now 20 msec, that may need adjustment (up or down) for optimal performance
Some remarks:
- Set serial logging to ERROR level, to avoid memory issues, as there will be a lot of logging in quick succession. Below script will log a few messages at ERROR level, though they are not errors!
- The LoopTimerSet_ms command will currently loop 10 times, that's what I used for testing, change that to the number of tags in use!
- Place this script, in this order, as the top lines in Rules1 file for smoothest/fastest processing
- The interval between events is now 20 msec, that may need adjustment (up or down) for optimal performance
Code: Select all
On Rules#Timer=1 Do
If %v0%>0 And %v0%=[var#%eventvalue2%] // eventvalue1 = timernumber, eventvalue2 = loop counter 1..x
LogEntry,'Found it %v0%',1 // ERROR log, as that should better be the default instead of INFO
LoopTimerSet_ms,1,0 // Stop looptimer
Event,OkTag=%v0% // Open door
Endif
Endon
On Turnstile_out#Tag Do
Let,0,[Turnstile_out#Tag]
If %v0%>0
Event,readet
Endif
Endon
On Turnstile_in#Tag Do
Let,0,[Turnstile_in#Tag]
If %v0%>0
Event,readet
Endif
Endon
On readet Do // Set serial loglevel to ERROR to avoid logging 'overflow'
LoopTimerSet_ms,1,20,10 // Assume 20 msec spacing is enough, 10 loops = 10 tags
Endon
On OkTag Do
LogEntry,'Tag %eventvalue1% OK',1 // ERROR log
LongPulse,25,0,2
Let,0,0
Endon
/Ton (PayPal.me)
Re: ESP32-DevKitCVIE
300 checks at 20msec loop is still 6 seconds delay.
I think for this we need a lookup table option.
For example to test if something occurs in a file.
Another approach may be to sort the list and perform a binary search, or check using the 1st decimal. This way you already cut the search time by a factor 10.
A binary search will be O(log(N)), thus with 300 nrs you only need to check upto 10 values.
I think for this we need a lookup table option.
For example to test if something occurs in a file.
Another approach may be to sort the list and perform a binary search, or check using the 1st decimal. This way you already cut the search time by a factor 10.
A binary search will be O(log(N)), thus with 300 nrs you only need to check upto 10 values.
Re: ESP32-DevKitCVIE
ThanksAth wrote: ↑24 Oct 2022, 20:34 There is no FOR loop in rules, but we can sort of simulate that using the LoopTimerSet/LoopTimerSet_ms commands.
Some remarks:
- Set serial logging to ERROR level, to avoid memory issues, as there will be a lot of logging in quick succession. Below script will log a few messages at ERROR level, though they are not errors!
- The LoopTimerSet_ms command will currently loop 10 times, that's what I used for testing, change that to the number of tags in use!
- Place this script, in this order, as the top lines in Rules1 file for smoothest/fastest processing
- The interval between events is now 20 msec, that may need adjustment (up or down) for optimal performance
Code: Select all
On Rules#Timer=1 Do If %v0%>0 And %v0%=[var#%eventvalue2%] // eventvalue1 = timernumber, eventvalue2 = loop counter 1..x LogEntry,'Found it %v0%',1 // ERROR log, as that should better be the default instead of INFO LoopTimerSet_ms,1,0 // Stop looptimer Event,OkTag=%v0% // Open door Endif Endon On Turnstile_out#Tag Do Let,0,[Turnstile_out#Tag] If %v0%>0 Event,readet Endif Endon On Turnstile_in#Tag Do Let,0,[Turnstile_in#Tag] If %v0%>0 Event,readet Endif Endon On readet Do // Set serial loglevel to ERROR to avoid logging 'overflow' LoopTimerSet_ms,1,20,10 // Assume 20 msec spacing is enough, 10 loops = 10 tags Endon On OkTag Do LogEntry,'Tag %eventvalue1% OK',1 // ERROR log LongPulse,25,0,2 Let,0,0 Endon
I test that code and for 300 tags it take 9 seconds to open door with 20ms
with 15ms the same 9 seconds and with 10 ms the same 9 seconds
Re: ESP32-DevKitCVIE
I think the rules parsing at some point will take more than 20 msec to complete.
So even if you lower it to 1 msec, it will not be faster.
Make sure the logging is turned off here, or else that will for sure be the limiting factor.
Anyway, it is too slow to be practical.
What you can do (but requires some scripting to generate the rules file) is to add the allowed keys in sorted order.
For example starting at index 1000.
It is best to add the long list to a separate file as it only needs to be ran once and this way it is easier to manage when updating
Add this to rules2.txt
To rules1.txt:
Add checkID at the top of the file as it will be called most often.
This is untested code, but I guess you'll get the idea how it will be working.
In short, we keep on generating async events (which will be added to a queue, so no risk of a stack overflow) and thus will be processed as fast as we can while still letting other things run on the ESP.
Each iteration we will 'split' the list of keys in half and check to see if we need to search the lower or upper half.
Then generate a new async event with the new upper and lower limits.
This should take roughly 10 async events for 300 users. (11 events for 512 users, 12 for 1024 users, etc...)
The really nice thing about this solution is that you're not depending on variables which can be changed while searching.
For example when a new tag is scanned while searching.
All needed parameters to perform the search are handed over as eventvalues along with the asyncevent.
It is very important to use asyncevent here instead of event, as the latter will create a new rules parsing environment and thus in the end run out of resources.
Using a set of 300 keys in variables can only be done on an ESP32 as it will take roughly 5kB of RAM which is probably too much for the ESP8266.
So even if you lower it to 1 msec, it will not be faster.
Make sure the logging is turned off here, or else that will for sure be the limiting factor.
Anyway, it is too slow to be practical.
What you can do (but requires some scripting to generate the rules file) is to add the allowed keys in sorted order.
For example starting at index 1000.
It is best to add the long list to a separate file as it only needs to be ran once and this way it is easier to manage when updating
Add this to rules2.txt
Code: Select all
on system#boot do
// Add keys in sorted order
let,1000,12345678
let,1001,12345679
....
let,1300,34567890
let,999,1300 // The last index used for storing a key (the upper limit for searching)
endon
Add checkID at the top of the file as it will be called most often.
Code: Select all
On checkID Do
// %eventvalue1% = key
// %eventvalue2% = lower limit index
// %eventvalue3% = upper limit index
let,1,(%eventvalue2%+%eventvalue3%)/2 // Compute "middle" index
// [int#%v1%] is the key in the middle of our search range
if %eventvalue1% = [int#%v1%]
// Found it
event,OkTag=%eventvalue1%
else
if %eventvalue2%=%eventvalue3%
// Upper and lower limit are the same
// So we have not found the key
// No need to continue searching
else
// When refering to an index, make sure to use the [int#1] notation, not the floating point version.
if %eventvalue1% > [int#%v1%]
// Check upper half
asyncevent,checkID=%eventvalue1%,[int#1],%eventvalue3%
else
// Check lower half
asyncevent,checkID=%eventvalue1%,%eventvalue2%,[int#1]
endif
endif
endif
Endon
On Turnstile_out#Tag Do
If [Turnstile_out#Tag]>0
Event,readet=[Turnstile_out#Tag]
Endif
Endon
On Turnstile_in#Tag Do
If [Turnstile_in#Tag]>0
Event,readet=[Turnstile_in#Tag]
Endif
Endon
On readet Do
// %eventvalue1% = key
// 1000 = Lower limit
// [int#999] = upper limit
asyncevent,checkID=%eventvalue1%,1000,[int#999]
Endon
On OkTag Do
LogEntry,'Tag %eventvalue1% OK',1 // ERROR log
LongPulse,25,0,2
Endon
This is untested code, but I guess you'll get the idea how it will be working.
In short, we keep on generating async events (which will be added to a queue, so no risk of a stack overflow) and thus will be processed as fast as we can while still letting other things run on the ESP.
Each iteration we will 'split' the list of keys in half and check to see if we need to search the lower or upper half.
Then generate a new async event with the new upper and lower limits.
This should take roughly 10 async events for 300 users. (11 events for 512 users, 12 for 1024 users, etc...)
The really nice thing about this solution is that you're not depending on variables which can be changed while searching.
For example when a new tag is scanned while searching.
All needed parameters to perform the search are handed over as eventvalues along with the asyncevent.
It is very important to use asyncevent here instead of event, as the latter will create a new rules parsing environment and thus in the end run out of resources.
Using a set of 300 keys in variables can only be done on an ESP32 as it will take roughly 5kB of RAM which is probably too much for the ESP8266.
Re: ESP32-DevKitCVIE
Wow that work very fast/ SUPER
Big big Thanks
Big big Thanks
Re: ESP32-DevKitCVIE
Just curious.... how fast?
I imagine it will still take roughly 300 - 500 msec.
I imagine it will still take roughly 300 - 500 msec.
Re: ESP32-DevKitCVIE
That's quite usable for a lock I think.
Doubling the amount of tags in the list would probably increase the delay with roughly 20 - 30 msec.
Doubling the amount of tags in the list would probably increase the delay with roughly 20 - 30 msec.
Re: ESP32-DevKitCVIE
Ton (@Ath) noticed there was an edge case when using an even nr of codes and try to find the last one.
So he fixed it and also made it into documentation: https://espeasy.readthedocs.io/en/lates ... orted-list
So he fixed it and also made it into documentation: https://espeasy.readthedocs.io/en/lates ... orted-list
Re: ESP32-DevKitCVIE
found bug in https://espeasy.readthedocs.io/en/lates ... orted-list
if
Let,1018,3787096
Let,1019,3801121
and key not in key list (3797686)
it go to loop
457464: EVENT: checkID=3797686,1018,1019
457470: ACT : Let,997,(1018+1019)/2
457476: ACT : Let,998,1018+1
if
Let,1018,3787096
Let,1019,3801121
and key not in key list (3797686)
it go to loop
457464: EVENT: checkID=3797686,1018,1019
457470: ACT : Let,997,(1018+1019)/2
457476: ACT : Let,998,1018+1
Re: ESP32-DevKitCVIE
Can you give the rules you are using?
Re: ESP32-DevKitCVIE
rules1.txt
rules2.txt
Code: Select all
On checkID Do
// %eventvalue1% = key
// %eventvalue2% = lower limit index
// %eventvalue3% = upper limit index
Let,997,(%eventvalue2%+%eventvalue3%)/2 // Compute "middle" index
Let,998,[int#997]+1
// [int#%v997%] is the key in the middle of our search range
If %eventvalue1% = [int#%v997%] or %eventvalue1% = [int#%v998%]
// Found it
Event,OkTag=%eventvalue1%
Else
If %eventvalue2%=%eventvalue3%
// Upper and lower limit are the same
// So we have not found the key
// No need to continue searching
Else
// When refering to an index, make sure to use the [int#<n>] notation, not the floating point version.
If %eventvalue1% > [int#%v997%]
// Check upper half
Asyncevent,checkID=%eventvalue1%,[int#997],%eventvalue3%
Else
// Check lower half
Asyncevent,checkID=%eventvalue1%,%eventvalue2%,[int#997]
Endif
Endif
Endif
Endon
On Stage2_IN#Tag Do
if %iswifi%=7
else
If [Stage2_IN#Tag]>0
Event,readet=[Stage2_IN#Tag]
Endif
endif
Endon
On Stage2_OUT#Tag Do
if %iswifi%=7
else
If [Stage2_OUT#Tag]>0
Event,readet=[Stage2_OUT#Tag]
Endif
endif
Endon
On readet Do // Valid tag value, now check if accepted
// %eventvalue1% = key
// 1000 = Lower limit
// [int#999] = upper limit
Asyncevent,checkID=%eventvalue1%,1000,[int#999]
Endon
On OkTag Do
LogEntry,'Tag %eventvalue1% OK',1 // ERROR log
LongPulse,27,1,2
// Pulse,19,0,5
Endon
on http#192.168.21.28=-1 do
if [Stage2_IN#Tag]>0
Event,readet=[Stage2_IN#Tag]
elseif [Stage2_OUT#Tag]>0
Event,readet=[Stage2_OUT#Tag]
endif
endon
on WiFi#Connected do
// LongPulse_mS,25,0,300,300,6
// LongPulse_mS,21,0,300,300,6
NeoPixel,1,0,0,20
endon
on WiFi#Disconnected do
// LongPulse_mS,25,0,500,500,6
// LongPulse_mS,21,0,500,500,6
NeoPixel,1,20,20,0
endon
on http#192.168.21.28=201 do
LongPulse,27,1,2
Pulse,25,0,5
timerSet,1,2
NeoPixel,1,0,20,0
endon
on http#192.168.21.28=202 do
LongPulse,27,1,2
Pulse,21,0,5
timerSet,1,2
NeoPixel,1,0,20,0
endon
on http#192.168.21.28=400 do
LongPulse,25,0,3
LongPulse,21,0,3
timerSet,1,3
NeoPixel,1,20,0,0
endon
on Stage2in do
LongPulse,27,1,2
endon
on Stage2out do
LongPulse,27,1,2
endon
on in1#State=0 do
LongPulse,27,1,2
timerSet,1,2
NeoPixel,1,0,20,0
endon
on in2#State=0 do
LongPulse,27,1,2
timerSet,1,2
NeoPixel,1,0,20,0
endon
On Rules#Timer=1 do
NeoPixel,1,0,0,20
endOn
On System#Boot Do
Asyncevent,loadData // Load the sorted tag data
timerSet,1,2
Endon
Code: Select all
On loadData Do
Let,999,1300
Let,1000,109327
Let,1001,109602
Let,1002,365871
Let,1003,845402
Let,1004,852479
Let,1005,858520
Let,1006,866206
Let,1007,867031
Let,1008,1945170
Let,1009,3047188
Let,1010,3082261
Let,1011,3353752
Let,1012,3366429
Let,1013,3727088
Let,1014,3727540
Let,1015,3771400
Let,1016,3772885
Let,1017,3773062
Let,1018,3787096
Let,1019,3801121
Let,1020,4026145
Let,1021,4072241
Let,1022,4080007
Let,1023,4082169
Let,1024,4097419
Let,1025,4112794
Let,1026,7008377
Let,1027,7019290
Let,1028,7444956
Let,1029,7818841
Let,1030,8074761
Let,1031,9586795
Let,1032,9602697
Let,1033,9603548
Let,1034,9657199
Let,1035,9665933
Let,1036,11672488
Let,1037,92246380
Let,1038,95878284
Let,1039,115410654
Let,1040,1111111111
Let,1041,1111111111
Let,1042,1111111111
Let,1043,1111111111
Let,1044,1111111111
Let,1045,1111111111
Let,1046,1111111111
Let,1047,1111111111
Let,1048,1111111111
Let,1049,1111111111
Let,1050,1111111111
Let,1051,1111111111
Let,1052,1111111111
Let,1053,1111111111
Let,1054,1111111111
Let,1055,1111111111
Let,1056,1111111111
Let,1057,1111111111
Let,1058,1111111111
Let,1059,1111111111
Let,1060,1111111111
Let,1061,1111111111
Let,1062,1111111111
Let,1063,1111111111
Let,1064,1111111111
Let,1065,1111111111
Let,1066,1111111111
Let,1067,1111111111
Let,1068,1111111111
Let,1069,1111111111
Let,1070,1111111111
Let,1071,1111111111
Let,1072,1111111111
Let,1073,1111111111
Let,1074,1111111111
Let,1075,1111111111
Let,1076,1111111111
Let,1077,1111111111
Let,1078,1111111111
Let,1079,1111111111
Let,1080,1111111111
Let,1081,1111111111
Let,1082,1111111111
Let,1083,1111111111
Let,1084,1111111111
Let,1085,1111111111
Let,1086,1111111111
Let,1087,1111111111
Let,1088,1111111111
Let,1089,1111111111
Let,1090,1111111111
Let,1091,1111111111
Let,1092,1111111111
Let,1093,1111111111
Let,1094,1111111111
Let,1095,1111111111
Let,1096,1111111111
Let,1097,1111111111
Let,1098,1111111111
Let,1099,1111111111
Let,1100,1111111111
Let,1101,1111111111
Let,1102,1111111111
Let,1103,1111111111
Let,1104,1111111111
Let,1105,1111111111
Let,1106,1111111111
Let,1107,1111111111
Let,1108,1111111111
Let,1109,1111111111
Let,1110,1111111111
Let,1111,1111111111
Let,1112,1111111111
Let,1113,1111111111
Let,1114,1111111111
Let,1115,1111111111
Let,1116,1111111111
Let,1117,1111111111
Let,1118,1111111111
Let,1119,1111111111
Let,1120,1111111111
Let,1121,1111111111
Let,1122,1111111111
Let,1123,1111111111
Let,1124,1111111111
Let,1125,1111111111
Let,1126,1111111111
Let,1127,1111111111
Let,1128,1111111111
Let,1129,1111111111
Let,1130,1111111111
Let,1131,1111111111
Let,1132,1111111111
Let,1133,1111111111
Let,1134,1111111111
Let,1135,1111111111
Let,1136,1111111111
Let,1137,1111111111
Let,1138,1111111111
Let,1139,1111111111
Let,1140,1111111111
Let,1141,1111111111
Let,1142,1111111111
Let,1143,1111111111
Let,1144,1111111111
Let,1145,1111111111
Let,1146,1111111111
Let,1147,1111111111
Let,1148,1111111111
Let,1149,1111111111
Let,1150,1111111111
Let,1151,1111111111
Let,1152,1111111111
Let,1153,1111111111
Let,1154,1111111111
Let,1155,1111111111
Let,1156,1111111111
Let,1157,1111111111
Let,1158,1111111111
Let,1159,1111111111
Let,1160,1111111111
Let,1161,1111111111
Let,1162,1111111111
Let,1163,1111111111
Let,1164,1111111111
Let,1165,1111111111
Let,1166,1111111111
Let,1167,1111111111
Let,1168,1111111111
Let,1169,1111111111
Let,1170,1111111111
Let,1171,1111111111
Let,1172,1111111111
Let,1173,1111111111
Let,1174,1111111111
Let,1175,1111111111
Let,1176,1111111111
Let,1177,1111111111
Let,1178,1111111111
Let,1179,1111111111
Let,1180,1111111111
Let,1181,1111111111
Let,1182,1111111111
Let,1183,1111111111
Let,1184,1111111111
Let,1185,1111111111
Let,1186,1111111111
Let,1187,1111111111
Let,1188,1111111111
Let,1189,1111111111
Let,1190,1111111111
Let,1191,1111111111
Let,1192,1111111111
Let,1193,1111111111
Let,1194,1111111111
Let,1195,1111111111
Let,1196,1111111111
Let,1197,1111111111
Let,1198,1111111111
Let,1199,1111111111
Let,1200,1111111111
Let,1201,1111111111
Let,1202,1111111111
Let,1203,1111111111
Let,1204,1111111111
Let,1205,1111111111
Let,1206,1111111111
Let,1207,1111111111
Let,1208,1111111111
Let,1209,1111111111
Let,1210,1111111111
Let,1211,1111111111
Let,1212,1111111111
Let,1213,1111111111
Let,1214,1111111111
Let,1215,1111111111
Let,1216,1111111111
Let,1217,1111111111
Let,1218,1111111111
Let,1219,1111111111
Let,1220,1111111111
Let,1221,1111111111
Let,1222,1111111111
Let,1223,1111111111
Let,1224,1111111111
Let,1225,1111111111
Let,1226,1111111111
Let,1227,1111111111
Let,1228,1111111111
Let,1229,1111111111
Let,1230,1111111111
Let,1231,1111111111
Let,1232,1111111111
Let,1233,1111111111
Let,1234,1111111111
Let,1235,1111111111
Let,1236,1111111111
Let,1237,1111111111
Let,1238,1111111111
Let,1239,1111111111
Let,1240,1111111111
Let,1241,1111111111
Let,1242,1111111111
Let,1243,1111111111
Let,1244,1111111111
Let,1245,1111111111
Let,1246,1111111111
Let,1247,1111111111
Let,1248,1111111111
Let,1249,1111111111
Let,1250,1111111111
Let,1251,1111111111
Let,1252,1111111111
Let,1253,1111111111
Let,1254,1111111111
Let,1255,1111111111
Let,1256,1111111111
Let,1257,1111111111
Let,1258,1111111111
Let,1259,1111111111
Let,1260,1111111111
Let,1261,1111111111
Let,1262,1111111111
Let,1263,1111111111
Let,1264,1111111111
Let,1265,1111111111
Let,1266,1111111111
Let,1267,1111111111
Let,1268,1111111111
Let,1269,1111111111
Let,1270,1111111111
Let,1271,1111111111
Let,1272,1111111111
Let,1273,1111111111
Let,1274,1111111111
Let,1275,1111111111
Let,1276,1111111111
Let,1277,1111111111
Let,1278,1111111111
Let,1279,1111111111
Let,1280,1111111111
Let,1281,1111111111
Let,1282,1111111111
Let,1283,1111111111
Let,1284,1111111111
Let,1285,1111111111
Let,1286,1111111111
Let,1287,1111111111
Let,1288,1111111111
Let,1289,1111111111
Let,1290,1111111111
Let,1291,1111111111
Let,1292,1111111111
Let,1293,1111111111
Let,1294,1111111111
Let,1295,1111111111
Let,1296,1111111111
Let,1297,1111111111
Let,1298,1111111111
Let,1299,1111111111
Let,1300,1111111111
Endon
Re: ESP32-DevKitCVIE
Is this running on an ESP8266?
Then I think you're running out of memory using this many variables.
Then I think you're running out of memory using this many variables.
Re: ESP32-DevKitCVIE
And I'm unsure what happens if the values are not unique... haven't tested that (yet)
/Ton (PayPal.me)
Re: ESP32-DevKitCVIE
OK, I took a slightly longer look at the code...
There needs to be another check to see whether the distance between 2 is 1 or less.
There needs to be another check to see whether the distance between 2 is 1 or less.
Re: ESP32-DevKitCVIE
ESP32-D0WDQ5-V3 chip
Re: ESP32-DevKitCVIE
OK, extended the rule a bit:
(untested)
This does decrease the search range on every call by excluding the just checked index from the range.
Also the 'distance' between upper and lower limit is checked.
Maybe this is a bit more than has to be checked, but at least it should now always finish.
Code: Select all
On checkID Do
// %eventvalue1% = key
// %eventvalue2% = lower limit index
// %eventvalue3% = upper limit index
// [int#%v997%] is the key in the middle of our search range
Let,997,(%eventvalue2%+%eventvalue3%)/2 // Compute "middle" index
if [int#998] < %eventvalue3%
Let,998,[int#998]+1
else
Let,998,[int#997]
endif
// Compute the distance between upper and lower limit
let,996,%eventvalue3%-%eventvalue2%
If %eventvalue1% = [int#%v997%] or %eventvalue1% = [int#%v998%]
// Found it
Event,OkTag=%eventvalue1%
Else
If %eventvalue2%=%eventvalue3% or [int#996]=1
// Upper and lower limit are the same
// So we have not found the key
// No need to continue searching
Else
// When refering to an index, make sure to use the [int#<n>] notation, not the floating point version.
If %eventvalue1% > [int#%v997%]
// Check upper half
if [int#998] < %eventvalue3%
// We already checked #998, so increase its index
Let,998,[int#998]+1
endif
Asyncevent,checkID=%eventvalue1%,[int#998],%eventvalue3%
Else
// Check lower half
if [int#997] > %eventvalue2%
// We already checked #997, so decrease its index
Let,997,[int#997]-1
endif
Asyncevent,checkID=%eventvalue1%,%eventvalue2%,[int#997]
Endif
Endif
Endif
Endon
This does decrease the search range on every call by excluding the just checked index from the range.
Also the 'distance' between upper and lower limit is checked.
Maybe this is a bit more than has to be checked, but at least it should now always finish.
Re: ESP32-DevKitCVIE
Code: Select all
154835: ACT : Asyncevent,checkID=3797686,933,1035
154852: EVENT: checkID=3797686,933,1035
154858: ACT : Let,997,(933+1035)/2
154868: ACT : Let,998,933+1
154877: ACT : let,996,1035-933
154908: ACT : Let,998,934+1
154915: ACT : Asyncevent,checkID=3797686,935,1035
154941: EVENT: checkID=3797686,935,1035
154947: ACT : Let,997,(935+1035)/2
154957: ACT : Let,998,935+1
154965: ACT : let,996,1035-935
154997: ACT : Let,998,936+1
155004: ACT : Asyncevent,checkID=3797686,937,1035
155031: EVENT: checkID=3797686,937,1035
155036: ACT : Let,997,(937+1035)/2
155047: ACT : Let,998,937+1
155056: ACT : let,996,1035-937
155088: ACT : Let,998,938+1
155095: ACT : Asyncevent,checkID=3797686,939,1035
155169: EVENT: checkID=3797686,939,1035
155176: ACT : Let,997,(939+1035)/2
155186: ACT : Let,998,939+1
155195: ACT : let,996,1035-939
155226: ACT : Let,998,940+1
155232: ACT : Asyncevent,checkID=3797686,941,1035
Re: ESP32-DevKitCVIE
hmm that's going to take forever....
Re: ESP32-DevKitCVIE
That was a simple mistake from me 

Code: Select all
On checkID Do
// %eventvalue1% = key
// %eventvalue2% = lower limit index
// %eventvalue3% = upper limit index
// [int#%v997%] is the key in the middle of our search range
Let,997,(%eventvalue2%+%eventvalue3%)/2 // Compute "middle" index
Let,998,[int#997]
if [int#998] < %eventvalue3%
Let,998,[int#998]+1
endif
// Compute the distance between upper and lower limit
let,996,%eventvalue3%-%eventvalue2%
If %eventvalue1% = [int#%v997%] or %eventvalue1% = [int#%v998%]
// Found it
Event,OkTag=%eventvalue1%
Else
If %eventvalue2%=%eventvalue3% or [int#996]=1
// Upper and lower limit are the same
// So we have not found the key
// No need to continue searching
Else
// When refering to an index, make sure to use the [int#<n>] notation, not the floating point version.
If %eventvalue1% > [int#%v997%]
// Check upper half
if [int#998] < %eventvalue3%
// We already checked #998, so increase its index
Let,998,[int#998]+1
endif
Asyncevent,checkID=%eventvalue1%,[int#998],%eventvalue3%
Else
// Check lower half
if [int#997] > %eventvalue2%
// We already checked #997, so decrease its index
Let,997,[int#997]-1
endif
Asyncevent,checkID=%eventvalue1%,%eventvalue2%,[int#997]
Endif
Endif
Endif
Endon
Re: ESP32-DevKitCVIE
Big Thanks
Now its work normaly
Now its work normaly
Re: ESP32-DevKitCVIE
Thanks, I updated the docs too 

Re: ESP32-DevKitCVIE
How to enable notifier feature in custom_ESP32_4m316k? i cant find it in custom.h
Re: ESP32-DevKitCVIE
Change in pre_custom_esp32.py: (assume you are building from PlatformIO/VSCode)
Code: Select all
custom_defines=[
"-DCONTROLLER_SET_ALL",
"-DNOTIFIER_SET_ALL", # was NOTIFIER_SET_NONE
"-DPLUGIN_BUILD_NONE",
"-DUSES_P001", # Switch
Code: Select all
#define NOTIFIER_SET_ALL
/Ton (PayPal.me)
Who is online
Users browsing this forum: No registered users and 15 guests