diff --git a/bin/upload-to-bootloader.sh b/bin/upload-to-bootloader.sh index 55a039a67..ba4b7b48c 100755 --- a/bin/upload-to-bootloader.sh +++ b/bin/upload-to-bootloader.sh @@ -1,4 +1,4 @@ echo "Converting to uf2 for NRF52 Adafruit bootloader" -bin/uf2conv.py .pio/build/lora-relay-v1/firmware.hex -f 0xADA52840 +bin/uf2conv.py .pio/build/lora-relay-v2/firmware.hex -f 0xADA52840 # cp flash.uf2 /media/kevinh/FTH*BOOT/ diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index fccce06d4..4469fd97e 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -36,10 +36,15 @@ bool GPS::setup() return ok; } +// Allow defining the polarity of the WAKE output. default is active high +#ifndef GPS_WAKE_ACTIVE +#define GPS_WAKE_ACTIVE 1 +#endif + void GPS::wake() { #ifdef PIN_GPS_WAKE - digitalWrite(PIN_GPS_WAKE, 1); + digitalWrite(PIN_GPS_WAKE, GPS_WAKE_ACTIVE); pinMode(PIN_GPS_WAKE, OUTPUT); #endif } @@ -47,7 +52,7 @@ void GPS::wake() void GPS::sleep() { #ifdef PIN_GPS_WAKE - digitalWrite(PIN_GPS_WAKE, 0); + digitalWrite(PIN_GPS_WAKE, GPS_WAKE_ACTIVE ? 0 : 1); pinMode(PIN_GPS_WAKE, OUTPUT); #endif } diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp index d4d9639df..517f5580b 100644 --- a/src/gps/NMEAGPS.cpp +++ b/src/gps/NMEAGPS.cpp @@ -102,7 +102,7 @@ bool NMEAGPS::whileIdle() // First consume any chars that have piled up at the receiver while (_serial_gps->available() > 0) { int c = _serial_gps->read(); - // DEBUG_MSG("%c", c); + DEBUG_MSG("%c", c); isValid |= reader.encode(c); } diff --git a/src/main.cpp b/src/main.cpp index f082c8f7a..d8c666ad8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -301,39 +301,39 @@ void setup() readFromRTC(); // read the main CPU RTC at first (in case we can't get GPS time) -// If we know we have a L80 GPS, don't try UBLOX -#ifndef L80_RESET +// If we don't have bidirectional comms, we can't even try talking to UBLOX + UBloxGPS *ublox = NULL; +#ifdef GPS_TX_PIN // Init GPS - first try ublox - auto ublox = new UBloxGPS(); + ublox = new UBloxGPS(); gps = ublox; if (!gps->setup()) { DEBUG_MSG("ERROR: No UBLOX GPS found\n"); delete ublox; gps = ublox = NULL; + } +#endif - if (GPS::_serial_gps) { - // Some boards might have only the TX line from the GPS connected, in that case, we can't configure it at all. Just - // assume NMEA at 9600 baud. - // dumb NMEA access only work for serial GPSes) - DEBUG_MSG("Hoping that NMEA might work\n"); + if (!gps && GPS::_serial_gps) { + // Some boards might have only the TX line from the GPS connected, in that case, we can't configure it at all. Just + // assume NMEA at 9600 baud. + // dumb NMEA access only work for serial GPSes) + DEBUG_MSG("Hoping that NMEA might work\n"); #ifdef HAS_AIR530_GPS - gps = new Air530GPS(); + gps = new Air530GPS(); #else - gps = new NMEAGPS(); + gps = new NMEAGPS(); #endif - gps->setup(); - } + gps->setup(); } -#else - gps = new NMEAGPS(); - gps->setup(); -#endif + if (gps) gpsStatus->observe(&gps->newStatus); else DEBUG_MSG("Warning: No GPS found - running without GPS\n"); + nodeStatus->observe(&nodeDB.newStatus); service.init(); diff --git a/variants/lora_relay_v2/variant.h b/variants/lora_relay_v2/variant.h index 54e9586d9..6814fdb3c 100644 --- a/variants/lora_relay_v2/variant.h +++ b/variants/lora_relay_v2/variant.h @@ -38,6 +38,7 @@ serial flash ok lora (inc boost en) mention dat1 and dat2 on sd card +use hardware spi controller for lcd - not bitbang */ @@ -161,6 +162,7 @@ static const uint8_t SCK = PIN_SPI_SCK; #define ST7735_SCK (37) // actually spi clk #define PIN_GPS_WAKE 36 // Just kill GPS power when we want it to sleep? FIXME +#define GPS_WAKE_ACTIVE 0 // GPS Power output is active low // #define LORA_DISABLE_SENDING // The board can brownout during lora TX if you don't have a battery connected. Disable sending // to allow USB power only based debugging