From be468a2183cb42698bab0f18f0e682544747ffb7 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sat, 28 Mar 2020 14:45:33 -0700 Subject: [PATCH 1/3] add reasonable guesses for TTGO LORA V1 and V2 boards - thanks @sensorsiot for the pinouts --- bin/build-all.sh | 1 + platformio.ini | 8 ++++++-- src/configuration.h | 22 ++++++++++++---------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index b7eccd59e..f8eadba91 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -33,6 +33,7 @@ for COUNTRY in $COUNTRIES; do export PLATFORMIO_BUILD_FLAGS="$COMMONOPTS" + do_build "ttgo-lora32-v2" do_build "ttgo-lora32-v1" do_build "tbeam" do_build "heltec" diff --git a/platformio.ini b/platformio.ini index f8de66947..0d6e5f9c4 100644 --- a/platformio.ini +++ b/platformio.ini @@ -80,7 +80,11 @@ board = heltec_wifi_lora_32_V2 [env:ttgo-lora32-v1] board = ttgo-lora32-v1 +build_flags = + ${env.build_flags} -D TTGO_LORA_V1 ; note: the platformio definition for lora32-v2 seems stale, it is missing a pins_arduino.h file, therefore I don't think it works -; [env:ttgo-lora32-v2] -; board = ttgo-lora32-v2 \ No newline at end of file +[env:ttgo-lora32-v2] +board = ttgo-lora32-v1 +build_flags = + ${env.build_flags} -D TTGO_LORA_V2 \ No newline at end of file diff --git a/src/configuration.h b/src/configuration.h index a0bbdbe97..12d7a3810 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -138,12 +138,12 @@ along with this program. If not, see . #define DIO0_GPIO 26 #define DIO1_GPIO 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number #define DIO2_GPIO 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number -#elif defined(ARDUINO_TTGO_LoRa32_V1) +#elif defined(TTGO_LORA_V1) // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR "ttgo-lora32-v1" -#define I2C_SDA 4 // I2C pins for this board -#define I2C_SCL 15 +#define I2C_SDA 21 // I2C pins for this board +#define I2C_SCL 22 #define RESET_OLED 16 // If defined, this pin will be used to reset the display controller @@ -151,24 +151,26 @@ along with this program. If not, see . #define LED_PIN 2 // If defined we will blink this LED #define BUTTON_PIN 0 // If defined, this will be used for user button presses -#define RESET_GPIO 23 // If defined, this pin will be used to reset the LORA radio +#define RESET_GPIO 14 // If defined, this pin will be used to reset the LORA radio #define DIO0_GPIO 26 // IRQ line for the LORA radio #define DIO1_GPIO 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number #define DIO2_GPIO 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number -#elif defined(ARDUINO_TTGO_LoRa32_V2) +#elif defined(TTGO_LORA_V2) // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR "ttgo-lora32-v2" -#define I2C_SDA 21 // I2C pins for this board -#define I2C_SCL 22 +#define I2C_SDA 4 // I2C pins for this board +#define I2C_SCL 15 #define RESET_OLED 16 // If defined, this pin will be used to reset the display controller #define VEXT_ENABLE 21 // active low, powers the oled display and the lora antenna boost -#define LED_PIN 2 // If defined we will blink this LED -#define BUTTON_PIN 0 // If defined, this will be used for user button presses +#define LED_PIN 25 // If defined we will blink this LED +#define BUTTON_PIN \ + 0 // If defined, this will be used for user button presses, if your board doesn't have a physical switch, you can wire one +// between this pin and ground -#define RESET_GPIO 23 // If defined, this pin will be used to reset the LORA radio +#define RESET_GPIO 14 // If defined, this pin will be used to reset the LORA radio #define DIO0_GPIO 26 // IRQ line for the LORA radio #define DIO1_GPIO 35 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number #define DIO2_GPIO 34 // DIO1 & DIO2 are not currently used, but they must be assigned to a pin number From ea250d9cd393b96f0b354c2133ab9768a0a8e8f2 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sat, 28 Mar 2020 15:31:22 -0700 Subject: [PATCH 2/3] add initial guess at TBEAM 0.7 hardware support --- bin/build-all.sh | 1 + platformio.ini | 9 +++++++++ src/configuration.h | 26 +++++++++++++++++++++++++- src/main.cpp | 10 +++++----- src/sleep.cpp | 13 +++++++------ 5 files changed, 47 insertions(+), 12 deletions(-) diff --git a/bin/build-all.sh b/bin/build-all.sh index f8eadba91..2c3f1dd92 100755 --- a/bin/build-all.sh +++ b/bin/build-all.sh @@ -33,6 +33,7 @@ for COUNTRY in $COUNTRIES; do export PLATFORMIO_BUILD_FLAGS="$COMMONOPTS" + do_build "tbeam0.7" do_build "ttgo-lora32-v2" do_build "ttgo-lora32-v1" do_build "tbeam" diff --git a/platformio.ini b/platformio.ini index 0d6e5f9c4..d66f86de3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -68,11 +68,20 @@ lib_deps = https://github.com/meshtastic/arduino-fsm.git https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git +; The 1.0 release of the TBEAM board [env:tbeam] board = ttgo-t-beam lib_deps = ${env.lib_deps} AXP202X_Library +build_flags = + ${env.build_flags} -D TBEAM_V10 + +; The original TBEAM board without the AXP power chip and a few other changes +[env:tbeam0.7] +board = ttgo-t-beam +build_flags = + ${env.build_flags} -D TBEAM_V07 [env:heltec] ;build_type = debug ; to make it possible to step through our jtag debugger diff --git a/src/configuration.h b/src/configuration.h index 12d7a3810..44f627391 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -96,7 +96,7 @@ along with this program. If not, see . #define MOSI_GPIO 27 #define NSS_GPIO 18 -#if defined(ARDUINO_T_Beam) +#if defined(TBEAM_V10) // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR "tbeam" @@ -117,6 +117,30 @@ along with this program. If not, see . // Leave undefined to disable our PMU IRQ handler #define PMU_IRQ 35 +#elif defined(TBEAM_V07) +// This string must exactly match the case used in release file names or the android updater won't work +#define HW_VENDOR "tbeam0.7" + +// #define BUTTON_NEED_PULLUP // if set we need to turn on the internal CPU pullup during sleep + +#define I2C_SDA 21 +#define I2C_SCL 22 + +#define BUTTON_PIN 39 + +#ifndef USE_JTAG +#define RESET_GPIO 23 +#endif +#define DIO0_GPIO 26 +#define DIO1_GPIO 33 // Note: not really used on this board +#define DIO2_GPIO 32 // Note: not really used on this board + +// This board has different GPS pins than all other boards +#undef GPS_RX_PIN +#undef GPS_TX_PIN +#define GPS_RX_PIN 12 +#define GPS_TX_PIN 15 + #elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2) // This string must exactly match the case used in release file names or the android updater won't work #define HW_VENDOR "heltec" diff --git a/src/main.cpp b/src/main.cpp index f1965fbac..794020f75 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,7 +39,7 @@ #include #include -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 #include "axp20x.h" AXP20X_Class axp; bool pmu_irq = false; @@ -81,7 +81,7 @@ void scanI2Cdevice(void) ssd1306_found = true; DEBUG_MSG("ssd1306 display found\n"); } -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 if (addr == AXP192_SLAVE_ADDRESS) { axp192_found = true; DEBUG_MSG("axp192 PMU found\n"); @@ -97,7 +97,7 @@ void scanI2Cdevice(void) DEBUG_MSG("done\n"); } -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 /// Reads power status to powerStatus singleton. // // TODO(girts): move this and other axp stuff to power.h/power.cpp. @@ -110,7 +110,7 @@ void readPowerStatus() powerStatus.usb = axp.isVBUSPlug(); powerStatus.charging = axp.isChargeing(); } -#endif // ARDUINO_T_Beam +#endif // TBEAM_V10 /** * Init the power manager chip @@ -123,7 +123,7 @@ void readPowerStatus() */ void axp192Init() { -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 if (axp192_found) { if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) { DEBUG_MSG("AXP192 Begin PASS\n"); diff --git a/src/sleep.cpp b/src/sleep.cpp index 9894e6299..8326f572c 100644 --- a/src/sleep.cpp +++ b/src/sleep.cpp @@ -14,7 +14,7 @@ #include #include -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 #include "axp20x.h" extern AXP20X_Class axp; #endif @@ -48,7 +48,7 @@ void setLed(bool ledOn) digitalWrite(LED_PIN, ledOn); #endif -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 if (axp192_found) { // blink the axp led axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF); @@ -60,7 +60,7 @@ void setGPSPower(bool on) { DEBUG_MSG("Setting GPS power=%d\n", on); -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 if (axp192_found) axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power #endif @@ -124,7 +124,7 @@ void doDeepSleep(uint64_t msecToWake) setLed(false); -#ifdef ARDUINO_T_Beam +#ifdef TBEAM_V10 if (axp192_found) { // No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would // leave floating input for the IRQ line @@ -159,8 +159,9 @@ void doDeepSleep(uint64_t msecToWake) /* 14, */ /* 15, */ #endif /* 25, */ 26, /* 27, */ - 32, 33, 34, 35, 36, 37, - /* 38, */ 39}; + 32, 33, 34, 35, + 36, 37 + /* 38, 39 */}; for (int i = 0; i < sizeof(rtcGpios); i++) rtc_gpio_isolate((gpio_num_t)rtcGpios[i]); From c1f8c8cca4ae7865e35aeda3098b84138bb1a756 Mon Sep 17 00:00:00 2001 From: geeksville Date: Sat, 28 Mar 2020 20:10:37 -0700 Subject: [PATCH 3/3] 0.2.0 --- bin/version.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/version.sh b/bin/version.sh index 499b3b4e8..4fe810620 100644 --- a/bin/version.sh +++ b/bin/version.sh @@ -1,3 +1,3 @@ -export VERSION=0.1.10 \ No newline at end of file +export VERSION=0.2.0 \ No newline at end of file