Update to version 1.1.0
This commit is contained in:
@ -33,13 +33,12 @@ void ttn_register(void (*callback)(uint8_t message));
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define APP_NAME "TTN MAP-TRACK"
|
||||
#define APP_VERSION "1.0.0"
|
||||
#define APP_VERSION "1.1.0"
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Configuration
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#define USE_CAYENNE
|
||||
#define DEBUG_PORT Serial // Serial debug port
|
||||
#define SERIAL_BAUD 115200 // Serial debug baud rate
|
||||
#define SLEEP_BETWEEN_MESSAGES 0 // Do sleep between messages
|
||||
@ -52,6 +51,10 @@ void ttn_register(void (*callback)(uint8_t message));
|
||||
#define LORAWAN_ADR 0 // Enable ADR
|
||||
#define GPS_WAIT_FOR_LOCK 5000 // Wait 5s after every boot for GPS lock
|
||||
|
||||
// Only enable one
|
||||
//#define PAYLOAD_USE_CAYENNE
|
||||
#define PAYLOAD_USE_FULL
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// DEBUG
|
||||
// -----------------------------------------------------------------------------
|
||||
|
96
main/gps.ino
96
main/gps.ino
@ -1,21 +1,21 @@
|
||||
/*
|
||||
|
||||
GPS module
|
||||
GPS module
|
||||
|
||||
Copyright (C) 2018 by Xose Pérez <xose dot perez at gmail dot com>
|
||||
Copyright (C) 2018 by Xose Pérez <xose dot perez at gmail dot com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
*/
|
||||
|
||||
@ -62,7 +62,33 @@ static void gps_loop() {
|
||||
_gps.encode(_serial_gps.read());
|
||||
}
|
||||
}
|
||||
#ifdef USE_CAYENNE
|
||||
|
||||
#ifdef PAYLOAD_USE_FULL
|
||||
// More data than PAYLOAD_USE_CAYENNE
|
||||
void buildPacket(uint8_t txBuffer[9])
|
||||
{
|
||||
LatitudeBinary = ((_gps.location.lat() + 90) / 180.0) * 16777215;
|
||||
LongitudeBinary = ((_gps.location.lng() + 180) / 360.0) * 16777215;
|
||||
sprintf(t, "Lat: %f", _gps.location.lat());
|
||||
Serial.println(t);
|
||||
sprintf(t, "Lng: %f", _gps.location.lng());
|
||||
Serial.println(t);
|
||||
|
||||
txBuffer[0] = ( LatitudeBinary >> 16 ) & 0xFF;
|
||||
txBuffer[1] = ( LatitudeBinary >> 8 ) & 0xFF;
|
||||
txBuffer[2] = LatitudeBinary & 0xFF;
|
||||
txBuffer[3] = ( LongitudeBinary >> 16 ) & 0xFF;
|
||||
txBuffer[4] = ( LongitudeBinary >> 8 ) & 0xFF;
|
||||
txBuffer[5] = LongitudeBinary & 0xFF;
|
||||
altitudeGps = _gps.altitude.meters();
|
||||
txBuffer[6] = ( altitudeGps >> 8 ) & 0xFF;
|
||||
txBuffer[7] = altitudeGps & 0xFF;
|
||||
hdopGps = _gps.hdop.value()/10;
|
||||
txBuffer[8] = hdopGps & 0xFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PAYLOAD_USE_CAYENNE
|
||||
// CAYENNE DF
|
||||
void buildPacket(uint8_t txBuffer[11])
|
||||
{
|
||||
@ -85,47 +111,5 @@ static void gps_loop() {
|
||||
txBuffer[8] = alt >> 16;
|
||||
txBuffer[9] = alt >> 8;
|
||||
txBuffer[10] = alt;
|
||||
/*
|
||||
txBuffer[2] = ( LatitudeBinary >> 16 );// & 0xFF;
|
||||
txBuffer[3] = ( LatitudeBinary >> 8 );// & 0xFF;
|
||||
txBuffer[4] = LatitudeBinary;// & 0xFF;
|
||||
|
||||
txBuffer[5] = ( LongitudeBinary >> 16 ) & 0xFF;
|
||||
txBuffer[6] = ( LongitudeBinary >> 8 ) & 0xFF;
|
||||
txBuffer[7] = LongitudeBinary & 0xFF;
|
||||
|
||||
txBuffer[8] = Height >> 16;
|
||||
txBuffer[9] = Height >> 8;
|
||||
txBuffer[10] = Height;*/
|
||||
}
|
||||
#else
|
||||
uint8_t txBuffer[9];
|
||||
|
||||
void buildPacket(uint8_t txBuffer[9])
|
||||
{
|
||||
LatitudeBinary = ((_gps.location.lat() + 90) / 180.0) * 16777215;
|
||||
LongitudeBinary = ((_gps.location.lng() + 180) / 360.0) * 16777215;
|
||||
|
||||
sprintf(t, "Lat: %f", _gps.location.lat());
|
||||
Serial.println(t);
|
||||
|
||||
sprintf(t, "Lng: %f", _gps.location.lng());
|
||||
Serial.println(t);
|
||||
|
||||
txBuffer[0] = ( LatitudeBinary >> 16 ) & 0xFF;
|
||||
txBuffer[1] = ( LatitudeBinary >> 8 ) & 0xFF;
|
||||
txBuffer[2] = LatitudeBinary & 0xFF;
|
||||
|
||||
txBuffer[3] = ( LongitudeBinary >> 16 ) & 0xFF;
|
||||
txBuffer[4] = ( LongitudeBinary >> 8 ) & 0xFF;
|
||||
txBuffer[5] = LongitudeBinary & 0xFF;
|
||||
|
||||
altitudeGps = _gps.altitude.meters();
|
||||
txBuffer[6] = ( altitudeGps >> 8 ) & 0xFF;
|
||||
txBuffer[7] = altitudeGps & 0xFF;
|
||||
|
||||
hdopGps = _gps.hdop.value()/10;
|
||||
txBuffer[8] = hdopGps & 0xFF;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
@ -6,8 +6,8 @@
|
||||
// inside the project_config folder.
|
||||
|
||||
// Make sure only one of the following is defined (CFG_us915 or CFG_eu868)
|
||||
#define CFG_au915 1
|
||||
//#define CFG_au923 1
|
||||
#define CFG_us915 1
|
||||
//#define CFG_eu868 1
|
||||
|
||||
// DO NOT modify this
|
||||
#define CFG_sx1276_radio 1
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "configuration.h"
|
||||
#include "rom/rtc.h"
|
||||
|
||||
|
||||
// Message counter, stored in RTC memory, survives deep sleep
|
||||
RTC_DATA_ATTR uint32_t count = 0;
|
||||
// -----------------------------------------------------------------------------
|
||||
@ -32,13 +31,15 @@ RTC_DATA_ATTR uint32_t count = 0;
|
||||
// -----------------------------------------------------------------------------
|
||||
#include <TinyGPS++.h>
|
||||
|
||||
#ifdef USE_CAYENNE
|
||||
// CAYENNE DF
|
||||
static uint8_t txBuffer[11] = {0x03, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
#else
|
||||
#ifdef PAYLOAD_USE_FULL
|
||||
uint8_t txBuffer[9];
|
||||
#endif
|
||||
|
||||
#ifdef PAYLOAD_USE_CAYENNE
|
||||
// CAYENNE DF
|
||||
static uint8_t txBuffer[11] = {0x03, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
#endif
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Application
|
||||
// -----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user