Skip to content

Commit

Permalink
Merge pull request #67 from geeksville/master
Browse files Browse the repository at this point in the history
kevin's minor work items saturday queue
  • Loading branch information
geeksville authored Mar 29, 2020
2 parents a47d6c4 + c1f8c8c commit 450fb7b
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 25 deletions.
2 changes: 2 additions & 0 deletions bin/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ 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"
do_build "heltec"
Expand Down
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.10
export VERSION=0.2.0
17 changes: 15 additions & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,32 @@ 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
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
[env:ttgo-lora32-v2]
board = ttgo-lora32-v1
build_flags =
${env.build_flags} -D TTGO_LORA_V2
48 changes: 37 additions & 11 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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"

Expand All @@ -117,6 +117,30 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// 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"
Expand All @@ -138,37 +162,39 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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

// #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 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
Expand Down
10 changes: 5 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <Wire.h>
#include <driver/rtc_io.h>

#ifdef ARDUINO_T_Beam
#ifdef TBEAM_V10
#include "axp20x.h"
AXP20X_Class axp;
bool pmu_irq = false;
Expand Down Expand Up @@ -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");
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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");
Expand Down
13 changes: 7 additions & 6 deletions src/sleep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <Wire.h>
#include <driver/rtc_io.h>

#ifdef ARDUINO_T_Beam
#ifdef TBEAM_V10
#include "axp20x.h"
extern AXP20X_Class axp;
#endif
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]);
Expand Down

0 comments on commit 450fb7b

Please sign in to comment.