Hi,
I'm trying to use a lookup table stored on a SD card.
At the moment I works well but it's very slow, because I read each byte en parse everything until I find the correct value. Is there a way to do that in a more efficient and quick way?
Here is the reading part of my code :
do {
lkpLat = lookup.parseFloat();
lkpLon = lookup.parseFloat();
lkpDeclDeg = lookup.parseFloat();
lkpDeclRad = lookup.parseFloat();
if (lkpLat == minLat && lkpLon == minLon)
g0 = lkpDeclRad;
else if (lkpLat == minLat && lkpLon == maxLon)
g1 = lkpDeclRad;
else if (lkpLat == maxLat && lkpLon == minLon)
g2 = lkpDeclRad;
else if (lkpLat == maxLat && lkpLon == maxLon)
g3 = lkpDeclRad;
ligne++;
} while (lookup.available() && (lkpLat < maxLat || lkpLon < maxLon));
and here it's how my lookup table look like (just a small part of it) :
...
50;40;8;0.14
50;45;9;0.16
50;50;9;0.16
50;55;9;0.16
50;60;9;0.16
50;65;9;0.16
50;70;9;0.16
50;75;8;0.14
50;80;7;0.12
50;85;5;0.09
50;90;3;0.05
50;95;1;0.02
50;100;-1;-0.02
50;105;-3;-0.05
50;110;-6;-0.10
50;115;-8;-0.14
50;120;-10;-0.17
50;125;-11;-0.19
50;130;-12;-0.21
50;135;-12;-0.21
50;140;-11;-0.19
50;145;-10;-0.17
50;150;-9;-0.16
50;155;-7;-0.12
50;160;-5;-0.09
50;165;-2;-0.03
50;170;0;0.00
50;175;1;0.02
50;180;4;0.07
55;-180;4;0.07
55;-175;6;0.10
55;-170;8;0.14
55;-165;11;0.19
55;-160;13;0.23
55;-155;15;0.26
55;-150;16;0.28
55;-145;18;0.31
55;-140;19;0.33
55;-135;19;0.33
55;-130;19;0.33
55;-125;19;0.33
55;-120;18;0.31
55;-115;16;0.28
55;-110;13;0.23
55;-105;10;0.17
55;-100;5;0.09
55;-95;0;0.00
55;-90;-5;-0.09
55;-85;-10;-0.17
55;-80;-15;-0.26
55;-75;-18;-0.31
55;-70;-21;-0.37
55;-65;-22;-0.38
55;-60;-23;-0.40
55;-55;-22;-0.38
55;-50;-22;-0.38
55;-45;-20;-0.35
55;-40;-18;-0.31
55;-35;-17;-0.30
55;-30;-14;-0.24
55;-25;-12;-0.21
55;-20;-10;-0.17
55;-15;-8;-0.14
55;-10;-5;-0.09
55;-5;-3;-0.05
55;0;-1;-0.02
55;5;0;0.00
55;10;1;0.02
55;15;3;0.05
55;20;5;0.09
55;25;6;0.10
55;30;8;0.14
55;35;9;0.16
55;40;10;0.17
55;45;11;0.19
55;50;12;0.21
55;55;12;0.21
55;60;13;0.23
55;65;12;0.21
55;70;12;0.21
55;75;11;0.19
55;80;9;0.16
55;85;7;0.12
55;90;5;0.09
55;95;2;0.03
55;100;0;0.00
55;105;-3;-0.05
55;110;-6;-0.10
55;115;-9;-0.16
55;120;-11;-0.19
55;125;-12;-0.21
55;130;-13;-0.23
55;135;-13;-0.23
...
Actually it takes around 5sec to read until line 2000. But if the value is closer to the end of the file, it will take a lot much more time...
Please help me
Thanks !