fix GPS precision bug

esp8266-bme280
noerw 8 years ago
parent f17b5c4275
commit f7f7dda22c

@ -7,8 +7,8 @@
struct Measurement { struct Measurement {
char timeStamp[20]; char timeStamp[20];
float lat; double lat;
float lng; double lng;
float value; float value;
char sensorID[24]; char sensorID[24];
}; };
@ -20,16 +20,15 @@ class Storage {
f << m.sensorID << '\n'; f << m.sensorID << '\n';
// convert floats to strings // convert floats to strings
char val[10], lat[10], lng[10]; char val[8], lat[16], lng[16];
dtostrf(m.value, 5, 6, val); dtostrf(m.value, 6, 4, val);
dtostrf(m.lat, 5, 6, lat); dtostrf(m.lat, 12, 8, lat);
dtostrf(m.lng, 5, 6, lng); dtostrf(m.lng, 12, 8, lng);
f << "{\"value\":" << val f << "{\"value\":" << val
<< ",\"createdAt\":\"" << m.timeStamp << ",\"createdAt\":\"" << m.timeStamp
<< "\",\"lat\":" << lat << "\",\"location\":[" << lng << "," << lat
<< ",\"lng\":" << lng << "]}" << EOL;
<< "}" << EOL;
} }
public: public:

Loading…
Cancel
Save