本文整理汇总了C++中TinyGPS::hdop方法的典型用法代码示例。如果您正苦于以下问题:C++ TinyGPS::hdop方法的具体用法?C++ TinyGPS::hdop怎么用?C++ TinyGPS::hdop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TinyGPS
的用法示例。
在下文中一共展示了TinyGPS::hdop方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_data
//Uses all the sensors to update all of the global variables that have to do with logging.
int update_data() {
p_sensor.Barometer_MS5803(); //Gathers data from external temp/pressure sensor
//Updates temperatures, pressure, and power
pressure = p_sensor.MS5803_Pressure();
external_temp = p_sensor.MS5803_Temperature();
internal_temp = temperature.read();
power = ain.read();
//Data gathered from GPS
bool gps_ready = gps_readable();
int max_gps_requests = 4;
int gps_counter = 0;
while (!gps_ready && gps_counter < max_gps_requests) {
gps_ready = gps_readable();
gps_counter++;
//printf("Waiting!\n");
}
if (gps_ready) {
update_lat_long();
altitude = gps.f_altitude();
precision = gps.hdop();
gps.stats(&encoded_chars, &good_sentences, &failed_checksums);
update_datetime();
} else {
//Place DUMMY GPS VALUES
latitude = -1000.0;
longitude = -1000.0;
altitude = -1000.0;
precision = -1000;
sprintf(date,"20000 BC");
encoded_chars = -1;
good_sentences = -1;
failed_checksums = -1;
}
return 0; //Data update was a success!
}
示例2: loop
void loop() {
bool newData = false;
unsigned long start = millis();
while (millis() - start < 1000) {
while (nss.available()) {
if (gps.encode(nss.read()))
newData = true;
}
}
if (newData) {
if (gps.hdop() < MAX_HDOP)
signal_fixed_status();
else
signal_instable_status();
if (!gps_filename) {
gps_filename = create_gps_file();
}
String line = create_gps_line();
gps_filename.println(line);
gps_filename.flush();
Serial.println(line);
} else {
signal_unavailable_status();
}
}
示例3: gps_spinOnce
/* GPS listen thread */
void gps_spinOnce(void) {
if(rx_ready(gps_port)) {
gps_input = rx_byte(gps_port);
if(gps.encode(gps_input)) {
gps.get_position(&lat, &lon);
if( gps_pub.reset() ) {
gps_pub.append(lat);
gps_pub.append(lon);
// TODO: fill in rest of GPS message
gps_pub.append(gps.altitude());
gps_pub.append(gps.hdop());
gps_pub.finish();
}
if( gps_pub2.reset() ) {
gps_pub2.append(lat);
gps_pub2.append(lon);
// TODO: fill in rest of GPS message
gps_pub2.finish();
}
}
}
}
示例4: create_gps_line
String create_gps_line() {
float lat, lon;
unsigned long age;
gps.f_get_position(&lat, &lon, &age);
short satellites = gps.satellites();
String line;
line.concat(line_number++);
line.concat(',');
char buf[12];
line.concat(dtostrf(lat, 4, 6, buf));
line.concat(',');
line.concat(dtostrf(lon, 4, 6, buf));
line.concat(',');
int year;
byte month, day, hour, minute, second, hundredth;
gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredth, &age);
line.concat(day);
line.concat('/');
line.concat(month);
line.concat('/');
line.concat(year);
line.concat(" ");
line.concat(hour);
line.concat(":");
line.concat(minute);
line.concat(":");
line.concat(second);
line.concat(',');
line.concat(satellites);
line.concat(',');
line.concat(dtostrf(gps.f_altitude(), 4, 2, buf));
line.concat(',');
line.concat(gps.hdop());
line.concat(',');
line.concat(age);
return line;
}