v1.2.0 release

This commit is contained in:
Kyle Gabriel 2020-08-20 16:39:13 -04:00
parent 5b67743915
commit 08a9fe4ce0
8 changed files with 48 additions and 94 deletions

32
.vscode/launch.json vendored
View File

@ -1,32 +0,0 @@
// AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY
// PIO Unified Debugger
//
// Documentation: https://docs.platformio.org/page/plus/debugging.html
// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html
{
"version": "0.2.0",
"configurations": [
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug",
"executable": "/home/kevinh/development/lora/ttgo-tbeam-ttn-tracker/.pio/build/esp32/firmware.elf",
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
"preLaunchTask": {
"type": "PlatformIO",
"task": "Pre-Debug"
},
"internalConsoleOptions": "openOnSessionStart"
},
{
"type": "platformio-debug",
"request": "launch",
"name": "PIO Debug (skip Pre-Debug)",
"executable": "/home/kevinh/development/lora/ttgo-tbeam-ttn-tracker/.pio/build/esp32/firmware.elf",
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
"internalConsoleOptions": "openOnSessionStart"
}
]
}

View File

@ -1,6 +1,6 @@
## TTGO T-Beam Tracker for The Things Network ## TTGO T-Beam Tracker for The Things Network
Current version: 1.1.1 Current version: 1.2.0
Uploads GPS data from the TTGO T-Beam to [The Things Network](https://www.thethingsnetwork.org) (TTN) and [TTN Mapper](https://ttnmapper.org) for tracking and determining signal strength of LoRaWAN gateways and nodes. Uploads GPS data from the TTGO T-Beam to [The Things Network](https://www.thethingsnetwork.org) (TTN) and [TTN Mapper](https://ttnmapper.org) for tracking and determining signal strength of LoRaWAN gateways and nodes.
@ -22,7 +22,7 @@ NOTE: There are now 2 versions of the TTGO T-BEAM, the first version (Rev0) and
* [ThingPulse/esp8266-oled-ssd1306](https://github.com/ThingPulse/esp8266-oled-ssd1306) (for Rev0 and Rev1) * [ThingPulse/esp8266-oled-ssd1306](https://github.com/ThingPulse/esp8266-oled-ssd1306) (for Rev0 and Rev1)
* [lewisxhe/AXP202X_Library](https://github.com/lewisxhe/AXP202X_Library) (for Rev1 only) * [lewisxhe/AXP202X_Library](https://github.com/lewisxhe/AXP202X_Library) (for Rev1 only)
3. Copy the contents of the project file ```main/lmic_project_config.h``` to the library file ```arduino-lmic/project_config/lmic_project_config.h``` and uncomment the proper frequency for your region. 3. Edit ```arduino-lmic/project_config/lmic_project_config.h``` and uncomment the proper frequency for your region.
4. Edit this project file ```main/configuration.h``` and select your correct board revision, either T_BEAM_V07 or T_BEAM_V10 (see [T-BEAM Board Versions](#t-beam-board-versions) to determine which board revision you have). 4. Edit this project file ```main/configuration.h``` and select your correct board revision, either T_BEAM_V07 or T_BEAM_V10 (see [T-BEAM Board Versions](#t-beam-board-versions) to determine which board revision you have).

View File

@ -33,7 +33,7 @@ void ttn_register(void (*callback)(uint8_t message));
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#define APP_NAME "TTN MAP-TRACK" #define APP_NAME "TTN MAP-TRACK"
#define APP_VERSION "1.1.1" #define APP_VERSION "1.2.0"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Configuration // Configuration
@ -56,8 +56,8 @@ void ttn_register(void (*callback)(uint8_t message));
#define DEBUG_PORT Serial // Serial debug port #define DEBUG_PORT Serial // Serial debug port
#define SERIAL_BAUD 115200 // Serial debug baud rate #define SERIAL_BAUD 115200 // Serial debug baud rate
#define SLEEP_BETWEEN_MESSAGES true // Do sleep between messages #define SLEEP_BETWEEN_MESSAGES false // Do sleep between messages
#define SEND_INTERVAL (5 * 60 * 1000) // Sleep for these many millis #define SEND_INTERVAL (20 * 1000) // Sleep for these many millis
#define MESSAGE_TO_SLEEP_DELAY 5000 // Time after message before going to sleep #define MESSAGE_TO_SLEEP_DELAY 5000 // Time after message before going to sleep
#define LOGO_DELAY 5000 // Time to show logo on first boot #define LOGO_DELAY 5000 // Time to show logo on first boot
#define LORAWAN_PORT 10 // Port the messages will be sent to #define LORAWAN_PORT 10 // Port the messages will be sent to

View File

@ -7,41 +7,39 @@ Credentials file
#pragma once #pragma once
// Only one of these settings must be defined // Only one of these settings must be defined
//#define USE_ABP #define USE_ABP
#define USE_OTAA //#define USE_OTAA
#ifdef USE_ABP #ifdef USE_ABP
// LoRaWAN NwkSKey, network session key // LoRaWAN NwkSKey, network session key
static const u1_t PROGMEM NWKSKEY[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const u1_t PROGMEM NWKSKEY[16] = { 0x59, 0xA5, 0xCC, 0xD8, 0xD0, 0x43, 0x20, 0x56, 0xCE, 0xB6, 0x93, 0x3C, 0x97, 0xFF, 0x21, 0xE1 };
// LoRaWAN AppSKey, application session key // LoRaWAN AppSKey, application session key
static const u1_t PROGMEM APPSKEY[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const u1_t PROGMEM APPSKEY[16] = { 0x83, 0xF1, 0x0F, 0xE6, 0xFE, 0xB9, 0xBE, 0x37, 0xA2, 0x47, 0x96, 0xAA, 0xB4, 0x8D, 0xF6, 0x61 };
// LoRaWAN end-device address (DevAddr) // LoRaWAN end-device address (DevAddr)
// This has to be unique for every node // This has to be unique for every node
static const u4_t DEVADDR = 0x00000000; static const u4_t DEVADDR = 0x26021BCB;
#endif #endif
#ifdef USE_OTAA #ifdef USE_OTAA
#if 0
// copy these variables to ../credentials-private.h and customize with your secret appkey. // copy these variables to ../credentials-private.h and customize with your secret appkey.
// This EUI must be in little-endian format, so least-significant-byte // This EUI must be in little-endian format, so least-significant-byte
// first. When copying an EUI from ttnctl output, this means to reverse // first. When copying an EUI from ttnctl output, this means to reverse
// the bytes. For TTN issued EUIs the last bytes should be 0x00, 0x00, // the bytes. For TTN issued EUIs the last bytes should be 0x00, 0x00,
// 0x00. // 0x00.
static const u1_t PROGMEM APPEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const u1_t PROGMEM APPEUI[8] = { 0x20, 0x77, 0x01, 0xD0, 0x7E, 0xD5, 0xB3, 0x70 };
// This should also be in little endian format, see above. // This should also be in little endian format, see above.
// Note: You do not need to set this field, if unset it will be generated automatically based on the device macaddr // Note: You do not need to set this field, if unset it will be generated automatically based on the device macaddr
static u1_t DEVEUI[8] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static u1_t DEVEUI[8] = { 0xB7, 0x0F, 0x8E, 0x33, 0xF9, 0x37, 0x9E, 0x00 };
// This key should be in big endian format (or, since it is not really a // This key should be in big endian format (or, since it is not really a
// number but a block of memory, endianness does not really apply). In // number but a block of memory, endianness does not really apply). In
// practice, a key taken from ttnctl can be copied as-is. // practice, a key taken from ttnctl can be copied as-is.
// The key shown here is the semtech default key. // The key shown here is the semtech default key.
static const u1_t PROGMEM APPKEY[16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; static const u1_t PROGMEM APPKEY[16] = { 0xC4, 0xAB, 0xDA, 0xB6, 0xDC, 0xD6, 0xEC, 0x56, 0xDD, 0xAC, 0x90, 0x67, 0xCE, 0x17, 0x0D, 0x8A };
#endif
#endif #endif

View File

@ -1,13 +0,0 @@
// This sketch supports EU868 and US915
// The Arduino-LMIC library by MCCI Catena is set to US915,
// these settings have to be copied over the ones in the
// lmic_project_config.h file in the library,
// inside the project_config folder.
// Make sure only one of the following is defined (CFG_us915 or CFG_eu868)
#define CFG_us915 1
//#define CFG_eu868 1
// DO NOT modify this
#define CFG_sx1276_radio 1

View File

@ -153,8 +153,6 @@ void sleep() {
} }
void callback(uint8_t message) { void callback(uint8_t message) {
if (EV_JOINING == message) screen_print("Joining TTN...\n"); if (EV_JOINING == message) screen_print("Joining TTN...\n");
if (EV_JOINED == message) { if (EV_JOINED == message) {
@ -193,7 +191,6 @@ void callback(uint8_t message) {
} }
void scanI2Cdevice(void) void scanI2Cdevice(void)
{ {
byte err, addr; byte err, addr;
@ -241,6 +238,7 @@ void scanI2Cdevice(void)
LDO2 200mA -> LORA LDO2 200mA -> LORA
LDO3 200mA -> GPS LDO3 200mA -> GPS
*/ */
void axp192Init() { void axp192Init() {
if (axp192_found) { if (axp192_found) {
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) { if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
@ -304,6 +302,7 @@ void initDeepSleep() {
Serial.printf("booted, wake cause %d (boot count %d)\n", wakeCause, bootCount); Serial.printf("booted, wake cause %d (boot count %d)\n", wakeCause, bootCount);
} }
void setup() { void setup() {
// Debug // Debug
#ifdef DEBUG_PORT #ifdef DEBUG_PORT
@ -319,6 +318,7 @@ void setup() {
// Buttons & LED // Buttons & LED
pinMode(BUTTON_PIN, INPUT_PULLUP); pinMode(BUTTON_PIN, INPUT_PULLUP);
#ifdef LED_PIN #ifdef LED_PIN
pinMode(LED_PIN, OUTPUT); pinMode(LED_PIN, OUTPUT);
#endif #endif
@ -330,8 +330,7 @@ void setup() {
if (wakeCause == ESP_SLEEP_WAKEUP_TIMER) if (wakeCause == ESP_SLEEP_WAKEUP_TIMER)
ssd1306_found = false; // forget we even have the hardware ssd1306_found = false; // forget we even have the hardware
if(ssd1306_found) if (ssd1306_found) screen_setup();
screen_setup();
// Init GPS // Init GPS
gps_setup(); gps_setup();
@ -405,6 +404,7 @@ void loop() {
screen_print("Waiting GPS lock\n"); screen_print("Waiting GPS lock\n");
first = false; first = false;
} }
#ifdef GPS_WAIT_FOR_LOCK #ifdef GPS_WAIT_FOR_LOCK
if (millis() > GPS_WAIT_FOR_LOCK) { if (millis() > GPS_WAIT_FOR_LOCK) {
sleep(); sleep();

View File

@ -110,8 +110,7 @@ void screen_print(const char * text) {
} }
void screen_update() { void screen_update() {
if(display) if (display) display->display();
display->display();
} }
void screen_setup() { void screen_setup() {

View File

@ -31,9 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "configuration.h" #include "configuration.h"
#include "credentials.h" #include "credentials.h"
// This file should not be in any publig git repos, it contains your secret APPKEY
#include "../credentials-private.h"
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Globals // Globals
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -119,6 +116,7 @@ static void printHex2(unsigned v) {
Serial.print(v, HEX); Serial.print(v, HEX);
} }
#ifdef USE_OTAA
// generate DevEUI from macaddr if needed // generate DevEUI from macaddr if needed
void initDevEUI() { void initDevEUI() {
bool needInit = true; bool needInit = true;
@ -136,6 +134,7 @@ void initDevEUI() {
} }
Serial.println(); Serial.println();
} }
#endif
// LMIC library will call this method when an event is fired // LMIC library will call this method when an event is fired
void onEvent(ev_t event) { void onEvent(ev_t event) {
@ -240,7 +239,10 @@ static void initCount() {
bool ttn_setup() { bool ttn_setup() {
initCount(); initCount();
#if defined(USE_OTAA)
initDevEUI(); initDevEUI();
#endif
// SPI interface // SPI interface
SPI.begin(SCK_GPIO, MISO_GPIO, MOSI_GPIO, NSS_GPIO); SPI.begin(SCK_GPIO, MISO_GPIO, MOSI_GPIO, NSS_GPIO);