diff --git a/src/gps/Air530GPS.cpp b/src/gps/Air530GPS.cpp deleted file mode 100644 index 46070eb30..000000000 --- a/src/gps/Air530GPS.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "configuration.h" -#include "Air530GPS.h" -#include - -/* -Helpful translations from the Air530 GPS datasheet - -Sat acquision mode -捕获电流值@3.3v 42.6 mA - -sat tracking mode -跟踪电流值@3.3v 36.7 mA - -Low power mode -低功耗模式@3.3V 0.85 mA -(发送指令:$PGKC051,0) - -Super low power mode -超低功耗模式@3.3V 31 uA -(发送指令:$PGKC105,4) - -To exit sleep use WAKE pin - -Commands to enter sleep -6、Command: 105 -进入周期性低功耗模式 -Arguments: - -Arg1: “0”,正常运行模式 (normal mode) -“1”,周期超低功耗跟踪模式,需要拉高 WAKE 来唤醒 (periodic low power tracking mode - keeps sat positions, use wake to wake up) -“2”,周期低功耗模式 (periodic low power mode) -“4”,直接进入超低功耗跟踪模式,需要拉高 WAKE 来唤醒 (super low power consumption mode immediately, need WAKE to resume) -“8”,自动低功耗模式,可以通过串口唤醒 (automatic low power mode, wake by sending characters to serial port) -“9”, 自动超低功耗跟踪模式,需要拉高 WAKE 来唤醒 (automatic low power tracking when possible, need wake pin to resume) - -(Arg 2 & 3 only valid if Arg1 is "1" or "2") -Arg2:运行时间(毫秒),在 Arg1 为 1、2 的周期模式下,此参数起作用 -ON time in msecs - -Arg3:睡眠时间(毫秒),在 Arg1 为 1、2 的周期模式下,此参数起作用 -Sleep time in msecs - -Example: -$PGKC105,8*3F -This will set automatic low power mode with waking when we send chars to the serial port. Possibly do this as soon as we get a -new location. When we wake again in a minute we send a character to wake up. - -*/ - - -void Air530GPS::sendCommand(const char *cmd) { - uint8_t sum = 0; - - // Skip the $ - assert(cmd[0] == '$'); - const char *p = cmd + 1; - while(*p) - sum ^= *p++; - - assert(_serial_gps); - - _serial_gps->write(cmd); - _serial_gps->printf("*%02x\r\n", sum); - - // DEBUG_MSG("xsum %02x\n", sum); -} - -void Air530GPS::sleep() { - NMEAGPS::sleep(); -#ifdef PIN_GPS_WAKE - sendCommand("$PGKC105,4"); -#endif -} - -/// wake the GPS into normal operation mode -void Air530GPS::wake() -{ -#if 1 - NMEAGPS::wake(); -#else - // For power testing - keep GPS sleeping forever - sleep(); -#endif -} \ No newline at end of file diff --git a/src/gps/Air530GPS.h b/src/gps/Air530GPS.h deleted file mode 100644 index 535b08029..000000000 --- a/src/gps/Air530GPS.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "NMEAGPS.h" - -/** - * A gps class thatreads from a NMEA GPS stream (and FIXME - eventually keeps the gps powered down except when reading) - * - * When new data is available it will notify observers. - */ -class Air530GPS : public NMEAGPS -{ - protected: - /// If possible force the GPS into sleep/low power mode - virtual void sleep() override; - - /// wake the GPS into normal operation mode - virtual void wake() override; - - private: - /// Send a NMEA cmd with checksum - void sendCommand(const char *str); -}; diff --git a/src/gps/GPS.cpp b/src/gps/GPS.cpp index 4ce7c0f61..3f0c52242 100644 --- a/src/gps/GPS.cpp +++ b/src/gps/GPS.cpp @@ -310,9 +310,7 @@ int GPS::prepareDeepSleep(void *unused) #include "UBloxGPS.h" #endif -#ifdef HAS_AIR530_GPS -#include "Air530GPS.h" -#elif !defined(NO_GPS) +#ifndef NO_GPS #include "NMEAGPS.h" #endif @@ -346,11 +344,7 @@ GPS *createGps() // 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. DEBUG_MSG("Hoping that NMEA might work\n"); -#ifdef HAS_AIR530_GPS - GPS *new_gps = new Air530GPS(); -#else GPS *new_gps = new NMEAGPS(); -#endif new_gps->setup(); return new_gps; } diff --git a/src/gps/NMEAGPS.cpp b/src/gps/NMEAGPS.cpp index d0d5e46e2..359256a3d 100644 --- a/src/gps/NMEAGPS.cpp +++ b/src/gps/NMEAGPS.cpp @@ -127,7 +127,6 @@ bool NMEAGPS::lookForLocation() // We know the solution is fresh and valid, so just read the data auto loc = reader.location.value(); - // Some GPSes (Air530) seem to send a zero longitude when the current fix is bogus // Bail out EARLY to avoid overwriting previous good data (like #857) if(toDegInt(loc.lat) == 0) { DEBUG_MSG("Ignoring bogus NMEA position\n"); diff --git a/variants/eink0.1/platformio.ini b/variants/eink0.1/platformio.ini deleted file mode 100644 index 243e94906..000000000 --- a/variants/eink0.1/platformio.ini +++ /dev/null @@ -1,13 +0,0 @@ -; First prototype eink/nrf52840/sx1262 device (removed from build because didn't ship in quantity) -;[env:eink0.1] -;extends = nrf52840_base -;board = eink0.1 -;# add our variants files to the include and src paths -;# define build flags for the TFT_eSPI library -;build_flags = ${nrf52_base.build_flags} -Ivariants/eink0.1 -; -DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30 -;src_filter = ${nrf52_base.src_filter} +<../variants/eink0.1> -;lib_deps = -; ${nrf52840_base.lib_deps} -; https://github.com/geeksville/EPD_Libraries.git -; TFT_eSPI \ No newline at end of file diff --git a/variants/eink0.1/variant.cpp b/variants/eink0.1/variant.cpp deleted file mode 100644 index cae079b74..000000000 --- a/variants/eink0.1/variant.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2014-2015 Arduino LLC. All right reserved. - Copyright (c) 2016 Sandeep Mistry All right reserved. - Copyright (c) 2018, Adafruit Industries (adafruit.com) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#include "variant.h" -#include "nrf.h" -#include "wiring_constants.h" -#include "wiring_digital.h" - -const uint32_t g_ADigitalPinMap[] = { - // P0 - pins 0 and 1 are hardwired for xtal and should never be enabled - 0xff, 0xff, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - - // P1 - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47}; - -void initVariant() -{ - // LED1 & LED2 - pinMode(PIN_LED1, OUTPUT); - ledOff(PIN_LED1); - - pinMode(PIN_LED2, OUTPUT); - ledOff(PIN_LED2); - - pinMode(PIN_LED3, OUTPUT); - ledOff(PIN_LED3); -} diff --git a/variants/eink0.1/variant.h b/variants/eink0.1/variant.h deleted file mode 100644 index b53f04811..000000000 --- a/variants/eink0.1/variant.h +++ /dev/null @@ -1,257 +0,0 @@ -/* - Copyright (c) 2014-2015 Arduino LLC. All right reserved. - Copyright (c) 2016 Sandeep Mistry All right reserved. - Copyright (c) 2018, Adafruit Industries (adafruit.com) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -*/ - -#ifndef _VARIANT_TTGO_EINK_V0_1_ -#define _VARIANT_TTGO_EINK_V0_1_ - -/** Master clock frequency */ -#define VARIANT_MCK (64000000ul) - -#define USE_LFXO // Board uses 32khz crystal for LF - -/* -@geeksville eink TODO: - -soonish: -DONE hook cdc acm device to debug output -DONE fix bootloader to use two buttons - remove bootloader hacks -DONE get second button working in app load -DONE use tp_ser_io as a button, it goes high when pressed unify eink display classes -fix display width and height -clean up eink drawing to not have the nasty timeout hack -measure current draws -DONE put eink to sleep when we think the screen is off -enable gps sleep mode -turn off txco on lora? -make screen.adjustBrightness() a nop on eink screens - -later: -enable flash on qspi. -fix floating point SEGGER printf on nrf52 - see "new NMEA GPS pos" -add factory/power on self test - -feedback to give: - -* bootloader is finished - -* the capacitive touch sensor works, though I'm not sure what use you are intending for it - -* remove ipx connector for nfc, instead use two caps and loop traces on the back of the board as an antenna? - -* the i2c RTC seems to talk fine on the i2c bus. However, I'm not sure of the utility of that part. Instead I'd be in favor of -the following: - -* move BAT1 to power the GPS VBACKUP instead per page 6 of the Air530 datasheet. And remove the i2c RTC entirely. - -* remove the cp2014 chip. - -* I've made the serial flash chip work, but if you do a new spin of the board I recommend: -connect pin 3 and pin 7 of U4 to spare GPIOs on the processor (instead of their current connections), -This would allow using 4 bit wide interface mode to the serial flash - doubling the transfer speed! see example here: -https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/nrf52840_DK/hw_external_memory.html?cp=4_0_4_7_4 -Once again - I'm glad you added that external flash chip. - -* Power measurements -When powered by 4V battery - -CPU on, lora radio RX mode, bluetooth enabled, GPS trying to lock. total draw 43mA -CPU on, lora radio RX mode, bluetooth enabled, GPS super low power sleep mode. Total draw 20mA -CPU on, lora radio TX mode, bluetooth enabled, GPS super low power sleep mode. Total draw 132mA - -Note: power consumption while connected via BLE to a phone almost identical. - -Note: eink display for all tests was in sleep mode most of the time. Current draw during the brief periods while the eink was being drawn was not -measured (but it was low). - -Note: Turning off EINK PWR_ON produces no noticeable power savings over just putting the eink display into sleep mode. - -*/ - -/*---------------------------------------------------------------------------- - * Headers - *----------------------------------------------------------------------------*/ - -#include "WVariant.h" - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// Number of pins defined in PinDescription array -#define PINS_COUNT (48) -#define NUM_DIGITAL_PINS (48) -#define NUM_ANALOG_INPUTS (1) -#define NUM_ANALOG_OUTPUTS (0) - -// LEDs -#define PIN_LED1 (0 + 13) // green (but red on my prototype) -#define PIN_LED2 (0 + 15) // blue (but red on my prototype) -#define PIN_LED3 (0 + 14) // red (not functional on my prototype) - -#define LED_RED PIN_LED3 -#define LED_GREEN PIN_LED1 -#define LED_BLUE PIN_LED2 - -#define LED_BUILTIN LED_GREEN -#define LED_CONN PIN_BLUE - -#define LED_STATE_ON 0 // State when LED is lit -#define LED_INVERTED 1 - -/* - * Buttons - */ -#define PIN_BUTTON1 (32 + 10) -#define PIN_BUTTON2 (0 + 18) // 0.18 is labeled on the board as RESET but we configure it in the bootloader as a regular GPIO - -/* - * Analog pins - */ -#define PIN_A0 (4) // Battery ADC - -#define BATTERY_PIN PIN_A0 - -static const uint8_t A0 = PIN_A0; - -#define ADC_RESOLUTION 14 - -#define PIN_NFC1 (9) -#define PIN_NFC2 (10) - -/* - * Serial interfaces - */ - -/* -No longer populated on PCB -*/ -//#define PIN_SERIAL2_RX (0 + 6) -//#define PIN_SERIAL2_TX (0 + 8) -// #define PIN_SERIAL2_EN (0 + 17) - -/** - Wire Interfaces - */ -#define WIRE_INTERFACES_COUNT 1 - -#define PIN_WIRE_SDA (26) // Not connected on board? -#define PIN_WIRE_SCL (27) - -/* touch sensor, active high */ - -#define TP_SER_IO (0 + 11) - -#define PIN_RTC_INT (0 + 16) // Interrupt from the PCF8563 RTC - -/* -External serial flash WP25R1635FZUIL0 -*/ - -// QSPI Pins -#define PIN_QSPI_SCK (32 + 14) -#define PIN_QSPI_CS (32 + 15) -#define PIN_QSPI_IO0 (32 + 12) // MOSI if using two bit interface -#define PIN_QSPI_IO1 (32 + 13) // MISO if using two bit interface -//#define PIN_QSPI_IO2 22 // WP if using two bit interface (i.e. not used) -//#define PIN_QSPI_IO3 23 // HOLD if using two bit interface (i.e. not used) - -// On-board QSPI Flash -#define EXTERNAL_FLASH_DEVICES MX25R1635F -#define EXTERNAL_FLASH_USE_QSPI - -/* - * Lora radio - */ - -#define USE_SX1262 -#define SX126X_CS (0 + 24) // FIXME - we really should define LORA_CS instead -#define SX126X_DIO1 (0 + 20) -// Note DIO2 is attached internally to the module to an analog switch for TX/RX switching -#define SX1262_DIO3 \ - (0 + 21) // This is used as an *output* from the sx1262 and connected internally to power the tcxo, do not drive from the main - // CPU? -#define SX126X_BUSY (0 + 17) -#define SX126X_RESET (0 + 25) -#define SX126X_E22 // Not really an E22 but TTGO seems to be trying to clone that -// Internally the TTGO module hooks the SX1262-DIO2 in to control the TX/RX switch (which is the default for the sx1262interface -// code) - -// #define LORA_DISABLE_SENDING // Define this to disable transmission for testing (power testing etc...) - -/* - * eink display pins - */ - -#define PIN_EINK_EN (32 + 11) -#define PIN_EINK_CS (0 + 30) -#define PIN_EINK_BUSY (0 + 3) -#define PIN_EINK_DC (0 + 28) -#define PIN_EINK_RES (0 + 2) -#define PIN_EINK_SCLK (0 + 31) -#define PIN_EINK_MOSI (0 + 29) // also called SDI - -// Controls power for the eink display - Board power is enabled either by VBUS from USB or the CPU asserting PWR_ON -// FIXME - I think this is actually just the board power enable - it enables power to the CPU also -#define PIN_EINK_PWR_ON (0 + 12) - -#define HAS_EINK - -// No screen wipes on eink -#define SCREEN_TRANSITION_MSECS 0 - -#define PIN_SPI1_MISO \ - (32 + 7) // FIXME not really needed, but for now the SPI code requires something to be defined, pick an used GPIO -#define PIN_SPI1_MOSI PIN_EINK_MOSI -#define PIN_SPI1_SCK PIN_EINK_SCLK - -/* - * Air530 GPS pins - */ - -#define PIN_GPS_WAKE (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake -#define PIN_GPS_PPS (32 + 4) // Pulse per second input from the GPS -#define PIN_GPS_TX (32 + 9) // This is for bits going TOWARDS the CPU -#define PIN_GPS_RX (32 + 8) // This is for bits going TOWARDS the GPS - -#define HAS_AIR530_GPS - -#define PIN_SERIAL1_RX PIN_GPS_TX -#define PIN_SERIAL1_TX PIN_GPS_RX - -/* - * SPI Interfaces - */ -#define SPI_INTERFACES_COUNT 2 - -// For LORA, spi 0 -#define PIN_SPI_MISO (0 + 23) -#define PIN_SPI_MOSI (0 + 22) -#define PIN_SPI_SCK (0 + 19) - -// To debug via the segger JLINK console rather than the CDC-ACM serial device -// #define USE_SEGGER - -#ifdef __cplusplus -} -#endif - -/*---------------------------------------------------------------------------- - * Arduino objects - C++ only - *----------------------------------------------------------------------------*/ - -#endif diff --git a/variants/t-echo/variant.h b/variants/t-echo/variant.h index a1471c67b..c5b767d05 100644 --- a/variants/t-echo/variant.h +++ b/variants/t-echo/variant.h @@ -24,64 +24,6 @@ #define USE_LFXO // Board uses 32khz crystal for LF -/* -@geeksville eink TODO: - -soonish: -DONE hook cdc acm device to debug output -DONE fix bootloader to use two buttons - remove bootloader hacks -DONE get second button working in app load -DONE use tp_ser_io as a button, it goes high when pressed unify eink display classes -fix display width and height -clean up eink drawing to not have the nasty timeout hack -measure current draws -DONE put eink to sleep when we think the screen is off -enable gps sleep mode -turn off txco on lora? -make screen.adjustBrightness() a nop on eink screens - -later: -enable flash on qspi. -fix floating point SEGGER printf on nrf52 - see "new NMEA GPS pos" -add factory/power on self test - -feedback to give: - -* bootloader is finished - -* the capacitive touch sensor works, though I'm not sure what use you are intending for it - -* remove ipx connector for nfc, instead use two caps and loop traces on the back of the board as an antenna? - -* the i2c RTC seems to talk fine on the i2c bus. However, I'm not sure of the utility of that part. Instead I'd be in favor of -the following: - -* move BAT1 to power the GPS VBACKUP instead per page 6 of the Air530 datasheet. And remove the i2c RTC entirely. - -* remove the cp2014 chip. - -* I've made the serial flash chip work, but if you do a new spin of the board I recommend: -connect pin 3 and pin 7 of U4 to spare GPIOs on the processor (instead of their current connections), -This would allow using 4 bit wide interface mode to the serial flash - doubling the transfer speed! see example here: -https://infocenter.nordicsemi.com/topic/ug_nrf52840_dk/UG/nrf52840_DK/hw_external_memory.html?cp=4_0_4_7_4 -Once again - I'm glad you added that external flash chip. - -* Power measurements -When powered by 4V battery - -CPU on, lora radio RX mode, bluetooth enabled, GPS trying to lock. total draw 43mA -CPU on, lora radio RX mode, bluetooth enabled, GPS super low power sleep mode. Total draw 20mA -CPU on, lora radio TX mode, bluetooth enabled, GPS super low power sleep mode. Total draw 132mA - -Note: power consumption while connected via BLE to a phone almost identical. - -Note: eink display for all tests was in sleep mode most of the time. Current draw during the brief periods while the eink was being drawn was not -measured (but it was low). - -Note: Turning off EINK PWR_ON produces no noticeable power savings over just putting the eink display into sleep mode. - -*/ - /*---------------------------------------------------------------------------- * Headers *----------------------------------------------------------------------------*/ @@ -226,7 +168,7 @@ External serial flash WP25R1635FZUIL0 #define PIN_SPI1_SCK PIN_EINK_SCLK /* - * Air530 GPS pins + * GPS pins */ #define PIN_GPS_WAKE (32 + 2) // An output to wake GPS, low means allow sleep, high means force wake