Skip to content

Commit 1ba0ad3

Browse files
authored
Fix _parseCSV() array index bug: lon and ele always returned lat value
In _parseCSV(), all three location fields (lat, lon, ele) were reading from fields[1], meaning lon and ele always returned the latitude value instead of their own data. Also removes an unreachable return statement at the end of the function.
1 parent 7092002 commit 1ba0ad3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/AdafruitIO_Data.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,12 +890,12 @@ bool AdafruitIO_Data::_parseCSV() {
890890
}
891891

892892
if (field_count > 0) {
893-
_lon = atof(fields[1]);
893+
_lon = atof(fields[2]);
894894
field_count--;
895895
}
896896

897897
if (field_count > 0) {
898-
_ele = atof(fields[1]);
898+
_ele = atof(fields[3]);
899899
field_count--;
900900
}
901901

@@ -911,5 +911,4 @@ bool AdafruitIO_Data::_parseCSV() {
911911
return false;
912912
}
913913

914-
return true;
915914
}

0 commit comments

Comments
 (0)