Skip to content

Commit bf7123a

Browse files
committed
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 590d70e commit bf7123a

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
@@ -905,12 +905,12 @@ bool AdafruitIO_Data::_parseCSV() {
905905
}
906906

907907
if (field_count > 0) {
908-
_lon = atof(fields[1]);
908+
_lon = atof(fields[2]);
909909
field_count--;
910910
}
911911

912912
if (field_count > 0) {
913-
_ele = atof(fields[1]);
913+
_ele = atof(fields[3]);
914914
field_count--;
915915
}
916916

@@ -926,5 +926,4 @@ bool AdafruitIO_Data::_parseCSV() {
926926
return false;
927927
}
928928

929-
return true;
930929
}

0 commit comments

Comments
 (0)