OK so… new here so please be gentle…..
I’m manipulating data in arrays…
Base data array =
String ukRepeaters[72][11] = { {"CALL" , "CH" , "Tx" , "Rx" , "MH" , "Loc" "Area" , "CTCSS", "Owner", "Lat" , "Lon" },
{"GB3SN","RV58","145.7250","145.1250","IO91LC","ALTON HANTS", "SW", "71.9", "G4EPX", "51.083333", "1.083333"},
{"GB3AL","RV59","145.7375","145.1375","IO91QP","AMERSHAM", "SW", "77", "G0RDI", "51.625000", "0.666666"},
….. etc.
I use this data to calculate the distance away for my current location and store the results into another array….
double repeaterDistances [72][9];
// index [0]
// lat [1] // converted to float
// lon [2] // converted to float
// latRadians [3] // repeater lat in radians
// lonRadians [4] // repeater lon in radians
// distanceToRepeaterFromCurrentLocation [5]
// bearingToRepeater [6]
All OK so far….
The data in ‘repeaterDistances’ is then used to calculate the distance and bearing and store the results in same array….
All OK so far….
I now want to sort the repeaterDistances array by distance and store the results into a third array
double sortedRepeaters[72][3];
// index [0]
// distance [1]
// bearing [2]
This is my problem… I’ve spent a couple of days now going around in circles getting myself completely confused with the sort algorithm and save routine, any suggestions welcome …
My sort routine starts at line 200, hardware is a Teensy 3.2 so no problems with floating point cals etc. The calculations are all working it now just data manipulation within arrays.
Thanks for looking.
Repeater_Sort_Test_4.ino (18 KB)