skip first gps fix if in upload mode
This commit is contained in:
parent
ceab2f70bd
commit
01c66faf79
2 changed files with 30 additions and 27 deletions
|
@ -48,7 +48,7 @@ So you either..
|
|||
- connect to the open network `mobile-sensebox` and run `telnet 192.168.1.1`
|
||||
- connect to the same network as configured in `config.h` and run `telnet <whateverIPtheESPgets>`
|
||||
|
||||
Connections are not polled all the time, so you may have to wait a moment until you recieve first data.
|
||||
Connections are not polled all the time, so you may have to wait a moment until you receive first data.
|
||||
|
||||
Note that, due to the limited single-channel hardware of the ESP8266,
|
||||
a reconnection to the configured WiFi network fails,
|
||||
|
|
|
@ -52,9 +52,9 @@ void measure(WifiState& wifiState, TinyGPSLocation& loc) {
|
|||
DEBUG_OUT << "numNetworks: " << wifiState.numNetworks << EOL;
|
||||
DEBUG_OUT << "numUnencrypted: " << wifiState.numUnencrypted << EOL;
|
||||
DEBUG_OUT.print("lat: ");
|
||||
DEBUG_OUT.print(loc.lat(), 6);
|
||||
DEBUG_OUT.print(loc.lat(), 8);
|
||||
DEBUG_OUT.print(" lng: ");
|
||||
DEBUG_OUT.println(loc.lng(), 6);
|
||||
DEBUG_OUT.println(loc.lng(), 8);
|
||||
DEBUG_OUT << dateString << EOL;
|
||||
|
||||
// IDEA: write location update to separate file?
|
||||
|
@ -152,7 +152,9 @@ void setup() {
|
|||
wifi.begin(WIFI_SSID, WIFI_PASS);
|
||||
DEBUG_OUT.begin(115200);
|
||||
|
||||
// wait until we got a first fix from GPS, and thus an initial *time*
|
||||
// wait until we got a first fix from GPS, and thus an initial time
|
||||
// exception: measure mode is disabled (for quick upload only)
|
||||
if (digitalRead(PIN_MEASURE_MODE) == HIGH) {
|
||||
DEBUG_OUT << "Getting GPS fix..";
|
||||
while (!gps.updateLocation()) {
|
||||
adaptiveDelay(0, location); // poll for telnet connections
|
||||
|
@ -161,6 +163,7 @@ void setup() {
|
|||
location = gps.getLocation();
|
||||
DEBUG_OUT << " done!" << EOL;
|
||||
digitalWrite(BUILTIN_LED, HIGH);
|
||||
}
|
||||
|
||||
// DEBUG
|
||||
//while (!wifi.isConnected()) adaptiveDelay(500, location);
|
||||
|
@ -185,11 +188,11 @@ void loop() {
|
|||
if (digitalRead(PIN_UPLOAD_MODE) == HIGH)
|
||||
upload(wifiState);
|
||||
|
||||
if (digitalRead(PIN_MEASURE_MODE) == HIGH) {
|
||||
// run the measurements in a fixed interval, using an adaptive delay
|
||||
// the interval is defined by a duration and/or distance from our last fix
|
||||
if (digitalRead(PIN_MEASURE_MODE) == HIGH)
|
||||
return adaptiveDelay(MEASUREMENT_INTERVAL, location, millis() - cycleStart, MEASUREMENT_DISTANCE_ENABLED);
|
||||
}
|
||||
|
||||
// run as fast as possible when not measuring.
|
||||
// smartDelay has to be called anyway, as some polling functions are run within
|
||||
adaptiveDelay(0, location);
|
||||
|
|
Loading…
Add table
Reference in a new issue