Merge branch 'master' of ssh://access.engr.oregonstate.edu:/nfs/stak/users/sessionm/git/collar
This commit is contained in:
commit
9cbd23ef60
32
collar.cpp
32
collar.cpp
|
@ -1,35 +1,9 @@
|
|||
/*******************************************************************************
|
||||
* The Things Network - ABP Feather
|
||||
*
|
||||
* Example of using an Adafruit Feather M0 and DHT22 with a
|
||||
* single-channel TheThingsNetwork gateway.
|
||||
*
|
||||
* This uses ABP (Activation by Personalization), where session keys for
|
||||
* communication would be assigned/generated by TTN and hard-coded on the device.
|
||||
*
|
||||
* Learn Guide: https://learn.adafruit.com/lora-pi
|
||||
*
|
||||
* Copyright (c) 2015 Thomas Telkamp and Matthijs Kooijman
|
||||
* Copyright (c) 2018 Terry Moore, MCCI
|
||||
* Copyright (c) 2018 Brent Rubell, Adafruit Industries
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to anyone
|
||||
* obtaining a copy of this document and accompanying files,
|
||||
* to do whatever they want with them without any restriction,
|
||||
* including, but not limited to, copying, modification and redistribution.
|
||||
* NO WARRANTY OF ANY KIND IS PROVIDED.
|
||||
*******************************************************************************/
|
||||
#include <lmic.h>
|
||||
#include <hal/hal.h>
|
||||
#include <TinyGPS++.h>
|
||||
|
||||
#include <AltSoftSerial.h>
|
||||
|
||||
|
||||
// DHT digital pin and sensor type
|
||||
#define DHTPIN 60
|
||||
#define DHTTYPE DHT22
|
||||
|
||||
// LoRaWAN NwkSKey, network session key
|
||||
static const PROGMEM u1_t NWKSKEY[16] = { 0x52, 0x92, 0xC0, 0x72, 0x2D, 0x3C, 0x55, 0x5E, 0xE4, 0xB9, 0x9E, 0x9B, 0x88, 0x66, 0x47, 0xF1 };
|
||||
|
||||
|
@ -53,7 +27,6 @@ void os_getArtEui (u1_t* buf) { }
|
|||
void os_getDevEui (u1_t* buf) { }
|
||||
void os_getDevKey (u1_t* buf) { }
|
||||
|
||||
// Data Packet to Send to TTN
|
||||
static osjob_t sendjob;
|
||||
static osjob_t gpsjob;
|
||||
|
||||
|
@ -70,9 +43,6 @@ const lmic_pinmap lmic_pins = {
|
|||
.dio = {2, 3, LMIC_UNUSED_PIN},
|
||||
};
|
||||
|
||||
// init. DHT
|
||||
//DHT dht(DHTPIN, DHTTYPE);
|
||||
|
||||
/****************************************************
|
||||
* Arduino drivers
|
||||
* - LoRaWAN
|
||||
|
@ -204,7 +174,6 @@ uint8_t buffer[] = {
|
|||
|
||||
void do_send(osjob_t* j){
|
||||
// Check if there is not a current TX/RX job running
|
||||
is_sending = 1;
|
||||
if (LMIC.opmode & OP_TXRXPEND) {
|
||||
Serial.println(F("OP_TXRXPEND, not sending"));
|
||||
} else {
|
||||
|
@ -229,6 +198,7 @@ void do_gps(osjob_t* j){
|
|||
gps.encode(softserial_read());
|
||||
}
|
||||
if(!is_sending && gps.location.isValid()) {
|
||||
is_sending = 1;
|
||||
do_send(&sendjob);
|
||||
}
|
||||
os_setTimedCallback(&gpsjob, os_getTime()+sec2osticks(GPS_INTERVAL), do_gps);
|
||||
|
|
Loading…
Reference in New Issue
Block a user