Merge pull request #44 from geeksville/master

various minor commits based on bugs I see while testing app
This commit is contained in:
Kevin Hester 2020-03-18 18:55:57 -07:00 committed by GitHub
commit ef5cdefca6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 35 additions and 30 deletions

View File

@ -1,3 +1,3 @@
export VERSION=0.1.7
export VERSION=0.1.8

1
release/latest/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
curfirmwareversion.xml

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- This file is kept in source control because it reflects the last stable
release. It is used by the android app for forcing software updates. Do not edit.
Generated by bin/buildall.sh -->
<resources>
<string name="cur_firmware_version">0.1.7</string>
</resources>

View File

@ -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

View File

@ -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;

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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