Skip to content

Commit

Permalink
Merge pull request #44 from geeksville/master
Browse files Browse the repository at this point in the history
various minor commits based on bugs I see while testing app
  • Loading branch information
geeksville authored Mar 19, 2020
2 parents 6bc8e1b + f6f9dfa commit ef5cdef
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 30 deletions.
2 changes: 1 addition & 1 deletion bin/version.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@


export VERSION=0.1.7
export VERSION=0.1.8
1 change: 1 addition & 0 deletions release/latest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curfirmwareversion.xml
9 changes: 0 additions & 9 deletions release/latest/curfirmwareversion.xml

This file was deleted.

6 changes: 4 additions & 2 deletions src/GPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,17 @@ 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);
}

// DEBUG_MSG("sec %d\n", ublox.getSecond());
// 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
Expand Down
16 changes: 9 additions & 7 deletions src/MeshService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion src/NodeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
13 changes: 10 additions & 3 deletions src/PowerFSM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/PowerFSM.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions src/screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<CmdItem> cmdQueue;
/// Whether we are using a display
Expand Down

0 comments on commit ef5cdef

Please sign in to comment.