diff --git a/platformio.ini b/platformio.ini index 4e3045c2..2ed1d992 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,14 +9,14 @@ ; https://docs.platformio.org/page/projectconf.html [platformio] -default_envs = tbeam +;default_envs = tbeam ;default_envs = tbeam0.7 ;default_envs = heltec-v2.0 ;default_envs = tlora-v1 ;default_envs = tlora_v1_3 ;default_envs = tlora-v2 ;default_envs = lora-relay-v1 # nrf board -;default_envs = t-echo +default_envs = t-echo ;default_envs = nrf52840dk-geeksville ;default_envs = native # lora-relay-v1 # nrf52840dk-geeksville # linux # or if you'd like to change the default to something like lora-relay-v1 put that here ;default_envs = rak4631 @@ -218,7 +218,7 @@ src_filter = ${arduino_base.src_filter} - - - - - - lib_ignore = BluetoothOTA -monitor_port = /dev/ttyACM1 +; monitor_port = /dev/ttyACM1 # we pass in options to jlink so it can understand freertos (note: we don't use "jlink" as the tool) ;debug_tool = jlink @@ -255,9 +255,12 @@ debug_init_break = [nrf52840_base] ; Common base class for all nrf52840 based targets extends = nrf52_base +; was -DTINY_USB +build_flags = ${nrf52_base.build_flags} lib_deps = ${arduino_base.lib_deps} Adafruit nRFCrypto + # Adafruit TinyUSB Arduino # add Adafruit nRFCrypto platform IO automated scan is broken [env:lora_isp4520] @@ -315,7 +318,7 @@ extends = nrf52840_base board = wiscore_rak4631 # 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/WisCore_RAK4631_Board +build_flags = ${nrf52840_base.build_flags} -Ivariants/WisCore_RAK4631_Board src_filter = ${nrf52_base.src_filter} +<../variants/WisCore_RAK4631_Board> debug_tool = jlink ; If not set we will default to uploading over serial (first it forces bootloader entry by talking 1200bps to cdcacm) @@ -354,10 +357,12 @@ lib_deps = [env:t-echo] extends = nrf52840_base board = t-echo +debug_tool = jlink +upload_protocol = jlink # add our variants files to the include and src paths # define build flags for the TFT_eSPI library - NOTE: WE NOT LONGER USE TFT_eSPI, it was for an earlier version of the TTGO eink screens # -DBUSY_PIN=3 -DRST_PIN=2 -DDC_PIN=28 -DCS_PIN=30 -build_flags = ${nrf52_base.build_flags} -Ivariants/t-echo +build_flags = ${nrf52840_base.build_flags} -Ivariants/t-echo src_filter = ${nrf52_base.src_filter} +<../variants/t-echo> lib_deps = ${nrf52840_base.lib_deps} @@ -385,7 +390,7 @@ extends = nrf52840_base board = lora-relay-v1 # 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/lora_relay_v1 +build_flags = ${nrf52840_base.build_flags} -Ivariants/lora_relay_v1 -DUSER_SETUP_LOADED -DTFT_WIDTH=80 -DTFT_HEIGHT=160 @@ -407,7 +412,7 @@ extends = nrf52840_base board = lora-relay-v2 # 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/lora_relay_v2 +build_flags = ${nrf52840_base.build_flags} -Ivariants/lora_relay_v2 -DUSER_SETUP_LOADED -DTFT_WIDTH=80 -DTFT_HEIGHT=160 diff --git a/src/nrf52/main-nrf52.cpp b/src/nrf52/main-nrf52.cpp index 6325bac8..647aefe2 100644 --- a/src/nrf52/main-nrf52.cpp +++ b/src/nrf52/main-nrf52.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "NRF52Bluetooth.h" #include "error.h" @@ -20,7 +21,8 @@ static inline void debugger_break(void) } bool loopCanSleep() { - return !tud_cdc_connected(); + // turn off sleep only while connected via USB + return !(TinyUSBDevice.mounted() && !TinyUSBDevice.suspended()); } // handle standard gcc assert failures @@ -37,7 +39,7 @@ void getMacAddr(uint8_t *dmac) ble_gap_addr_t addr; if (sd_ble_gap_addr_get(&addr) == NRF_SUCCESS) { memcpy(dmac, addr.addr, 6); - } else { + } else { const uint8_t *src = (const uint8_t *)NRF_FICR->DEVICEADDR; dmac[5] = src[0]; dmac[4] = src[1];