mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 05:10:34 +08:00
geofence: be more verbose if import fails
This commit is contained in:
@@ -297,8 +297,10 @@ Geofence::loadFromFile(const char *filename)
|
||||
/* Handle degree minute second format */
|
||||
float lat_d, lat_m, lat_s, lon_d, lon_m, lon_s;
|
||||
|
||||
if (sscanf(line, "DMS %f %f %f %f %f %f", &lat_d, &lat_m, &lat_s, &lon_d, &lon_m, &lon_s) != 6)
|
||||
if (sscanf(line, "DMS %f %f %f %f %f %f", &lat_d, &lat_m, &lat_s, &lon_d, &lon_m, &lon_s) != 6) {
|
||||
warnx("Scanf to parse DMS geofence vertex failed.");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
// warnx("Geofence DMS: %.5f %.5f %.5f ; %.5f %.5f %.5f", (double)lat_d, (double)lat_m, (double)lat_s, (double)lon_d, (double)lon_m, (double)lon_s);
|
||||
|
||||
@@ -307,9 +309,10 @@ Geofence::loadFromFile(const char *filename)
|
||||
|
||||
} else {
|
||||
/* Handle decimal degree format */
|
||||
|
||||
if (sscanf(line, "%f %f", &(vertex.lat), &(vertex.lon)) != 2)
|
||||
if (sscanf(line, "%f %f", &(vertex.lat), &(vertex.lon)) != 2) {
|
||||
warnx("Scanf to parse geofence vertex failed.");
|
||||
return ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
if (dm_write(DM_KEY_FENCE_POINTS, pointCounter, DM_PERSIST_POWER_ON_RESET, &vertex, sizeof(vertex)) != sizeof(vertex))
|
||||
|
||||
Reference in New Issue
Block a user