diff --git a/bin/version.sh b/bin/version.sh index a6ab5bbb4..f20179194 100644 --- a/bin/version.sh +++ b/bin/version.sh @@ -1,3 +1,3 @@ -export VERSION=0.1.7 \ No newline at end of file +export VERSION=0.1.8 \ No newline at end of file diff --git a/release/latest/.gitignore b/release/latest/.gitignore new file mode 100644 index 000000000..fff416667 --- /dev/null +++ b/release/latest/.gitignore @@ -0,0 +1 @@ +curfirmwareversion.xml diff --git a/release/latest/curfirmwareversion.xml b/release/latest/curfirmwareversion.xml deleted file mode 100644 index 71a400aa7..000000000 --- a/release/latest/curfirmwareversion.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - 0.1.7 - diff --git a/src/GPS.cpp b/src/GPS.cpp index 52feaf651..e120b73f1 100644 --- a/src/GPS.cpp +++ b/src/GPS.cpp @@ -146,7 +146,9 @@ void GPS::doTask() ublox.checkUblox(); // See if new data is available. Process bytes as they come in. // If we don't have a fix (a quick check), don't try waiting for a solution) - fixtype = ublox.getFixType(); + // Hmmm my fix type reading returns zeros for fix, which doesn't seem correct, because it is still sptting out positions + // turn off for now + // fixtype = ublox.getFixType(); DEBUG_MSG("fix type %d\n", fixtype); } @@ -154,7 +156,7 @@ void GPS::doTask() // DEBUG_MSG("lat %d\n", ublox.getLatitude()); // any fix that has time - if ((fixtype >= 2 && fixtype <= 5) && !timeSetFromGPS && ublox.getT()) { + if (!timeSetFromGPS && ublox.getT()) { struct timeval tv; /* Convert to unix time diff --git a/src/MeshService.cpp b/src/MeshService.cpp index 0834f5189..fc3a507d6 100644 --- a/src/MeshService.cpp +++ b/src/MeshService.cpp @@ -328,14 +328,16 @@ void MeshService::onGPSChanged() // Update our local node info with our position (even if we don't decide to update anyone else) MeshPacket *p = allocForSending(); p->payload.which_variant = SubPacket_position_tag; + Position &pos = p->payload.variant.position; -#if 0 - if (gps.altitude.isValid()) - pos.altitude = gps.altitude.meters(); - pos.latitude = gps.location.lat(); - pos.longitude = gps.location.lng(); - pos.time = gps.getValidTime(); -#endif + // !zero or !zero lat/long means valid + if(gps.latitude != 0 || gps.longitude != 0) { + if (gps.altitude != 0) + pos.altitude = gps.altitude; + pos.latitude = gps.latitude; + pos.longitude = gps.longitude; + pos.time = gps.getValidTime(); + } // We limit our GPS broadcasts to a max rate static uint32_t lastGpsSend; diff --git a/src/NodeDB.cpp b/src/NodeDB.cpp index 6915ee0ac..bee714a0f 100644 --- a/src/NodeDB.cpp +++ b/src/NodeDB.cpp @@ -26,7 +26,7 @@ DeviceState versions used to be defined in the .proto file but really only this #define here. */ -#define DEVICESTATE_CUR_VER 2 +#define DEVICESTATE_CUR_VER 6 #define DEVICESTATE_MIN_VER DEVICESTATE_CUR_VER #define FS SPIFFS @@ -159,6 +159,7 @@ void NodeDB::loadFromDisk() DEBUG_MSG("Warn: devicestate is old, discarding\n"); else { + DEBUG_MSG("Loaded saved preferences version %d\n", scratch.version); devicestate = scratch; } diff --git a/src/PowerFSM.cpp b/src/PowerFSM.cpp index 5a02c08ee..14e858b64 100644 --- a/src/PowerFSM.cpp +++ b/src/PowerFSM.cpp @@ -25,7 +25,7 @@ static void sdsEnter() static void lsEnter() { - DEBUG_MSG("lsEnter begin\n"); + DEBUG_MSG("lsEnter begin, ls_secs=%u\n", radioConfig.preferences.ls_secs); screen.setOn(false); while (!service.radio.rf95.canSleep()) @@ -124,16 +124,23 @@ static void screenPress() screen.onPress(); } + +static void bootEnter() { +} + State stateSDS(sdsEnter, NULL, NULL, "SDS"); State stateLS(lsEnter, lsIdle, lsExit, "LS"); State stateNB(nbEnter, NULL, NULL, "NB"); State stateDARK(darkEnter, NULL, NULL, "DARK"); +State stateBOOT(bootEnter , NULL, NULL, "BOOT"); State stateON(onEnter, NULL, NULL, "ON"); -Fsm powerFSM(&stateDARK); +Fsm powerFSM(&stateBOOT); void PowerFSM_setup() { - powerFSM.add_transition(&stateDARK, &stateON, EVENT_BOOT, NULL, "Boot"); + powerFSM.add_timed_transition(&stateBOOT, &stateON, 3 * 1000, NULL, + "boot timeout"); + powerFSM.add_transition(&stateLS, &stateDARK, EVENT_WAKE_TIMER, wakeForPing, "Wake timer"); // Note we don't really use this transition, because when we wake from light sleep we _always_ transition to NB and then it diff --git a/src/PowerFSM.h b/src/PowerFSM.h index f8a013dd2..c1bb7a87f 100644 --- a/src/PowerFSM.h +++ b/src/PowerFSM.h @@ -4,12 +4,12 @@ // See sw-design.md for documentation -#define EVENT_PRESS 1 +#define EVENT_PRESS 1 #define EVENT_WAKE_TIMER 2 #define EVENT_RECEIVED_PACKET 3 #define EVENT_PACKET_FOR_PHONE 4 #define EVENT_RECEIVED_TEXT_MSG 5 -#define EVENT_BOOT 6 +// #define EVENT_BOOT 6 // now done with a timed transition #define EVENT_BLUETOOTH_PAIR 7 #define EVENT_NODEDB_UPDATED 8 // NodeDB has a big enough change that we think you should turn on the screen #define EVENT_CONTACT_FROM_PHONE 9 // the phone just talked to us over bluetooth diff --git a/src/main.cpp b/src/main.cpp index 30de87692..b31a1f290 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -252,18 +252,18 @@ void setup() axp192Init(); + screen.print("Started...\n"); + // Init GPS gps.setup(); - screen.print("Started...\n"); - service.init(); + // This must be _after_ service.init because we need our preferences loaded from flash to have proper timeout values + PowerFSM_setup(); // we will transition to ON in a couple of seconds, FIXME, only do this for cold boots, not waking from SDS + // setBluetoothEnable(false); we now don't start bluetooth until we enter the proper state setCPUFast(false); // 80MHz is fine for our slow peripherals - - PowerFSM_setup(); - powerFSM.trigger(EVENT_BOOT); // transition to ON, FIXME, only do this for cold boots, not waking from SDS } void initBluetooth() diff --git a/src/screen.h b/src/screen.h index 17c217936..94c1c9db8 100644 --- a/src/screen.h +++ b/src/screen.h @@ -108,6 +108,7 @@ class Screen : public PeriodicTask /// Rebuilds our list of frames (screens) to default ones. void setFrames(); +private: /// Queue of commands to execute in doTask. TypedQueue cmdQueue; /// Whether we are using a display