kopia lustrzana https://github.com/helium/longfi-arduino
fixes
rodzic
7b7f03962e
commit
2ff9394fb6
|
@ -40,19 +40,6 @@ https://grumpyoldpizza.github.io/ArduinoCore-stm32l0/package_stm32l0_boards_inde
|
||||||
4. Search for "Tlera Corp STM32L0 Boards"
|
4. Search for "Tlera Corp STM32L0 Boards"
|
||||||
5. Select the newest version and install.
|
5. Select the newest version and install.
|
||||||
|
|
||||||
### Temporary Manual Fix
|
|
||||||
This issue has been fixed but not released yet, until then you will need to insert three lines of code in a library file.
|
|
||||||
Insert the following:
|
|
||||||
```
|
|
||||||
#ifndef NULL
|
|
||||||
#define NULL 0
|
|
||||||
#endif
|
|
||||||
```
|
|
||||||
Into the file found here:
|
|
||||||
linux: /home/{user}/Arduino/libraries/IBM_LMIC_framework/src/lmic
|
|
||||||
windows: Documents/Arduino/libraries/IBM_LMIC_framework/src/lmic
|
|
||||||
mac os: Documents/Arduino/libraries/IBM_LMIC_framework/src/lmic
|
|
||||||
|
|
||||||

|

|
||||||
## Programming (Uploading):
|
## Programming (Uploading):
|
||||||
|
|
||||||
|
|
|
@ -7,22 +7,20 @@ const char *devEui = "FILL_ME_IN";
|
||||||
const char *appEui = "FILL_ME_IN";
|
const char *appEui = "FILL_ME_IN";
|
||||||
const char *appKey = "FILL_ME_IN";
|
const char *appKey = "FILL_ME_IN";
|
||||||
|
|
||||||
const uint32_t TX_INTERVAL = 10000;
|
#define RESET_PIN 7
|
||||||
|
|
||||||
|
const uint32_t TX_INTERVAL = 60000; // 60 Seconds
|
||||||
TimerMillis timer_send;
|
TimerMillis timer_send;
|
||||||
|
|
||||||
// Sensors
|
|
||||||
float longitude_mdeg;
|
float longitude_mdeg;
|
||||||
float latitude_mdeg;
|
float latitude_mdeg;
|
||||||
long alt;
|
long alt;
|
||||||
|
|
||||||
#define RESET_PIN 7
|
|
||||||
|
|
||||||
// Refer to serial devices by use
|
// Refer to serial devices by use
|
||||||
HardwareSerial &console = Serial;
|
HardwareSerial &console = Serial;
|
||||||
HardwareSerial &gps = Serial1;
|
HardwareSerial &gps = Serial1;
|
||||||
|
|
||||||
CayenneLPP lpp(51);
|
CayenneLPP lpp(51);
|
||||||
|
|
||||||
static volatile bool uplink_attempted;
|
static volatile bool uplink_attempted;
|
||||||
|
|
||||||
// MicroNMEA library structures
|
// MicroNMEA library structures
|
||||||
|
@ -86,7 +84,7 @@ void setupGPS() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void readGPS() {
|
void readGPS() {
|
||||||
// If a message is received, print all the info
|
// If a message is received
|
||||||
if (ppsTriggered) {
|
if (ppsTriggered) {
|
||||||
ppsTriggered = false;
|
ppsTriggered = false;
|
||||||
ledState = !ledState;
|
ledState = !ledState;
|
||||||
|
@ -95,60 +93,13 @@ void readGPS() {
|
||||||
// Clear Payload
|
// Clear Payload
|
||||||
lpp.reset();
|
lpp.reset();
|
||||||
|
|
||||||
// Output GPS information from previous second
|
|
||||||
Serial.print("Valid fix: ");
|
|
||||||
Serial.println(nmea.isValid() ? "yes" : "no");
|
|
||||||
|
|
||||||
Serial.print("Nav. system: ");
|
|
||||||
if (nmea.getNavSystem())
|
|
||||||
Serial.println(nmea.getNavSystem());
|
|
||||||
else
|
|
||||||
Serial.println("none");
|
|
||||||
|
|
||||||
Serial.print("Num. satellites: ");
|
|
||||||
Serial.println(nmea.getNumSatellites());
|
|
||||||
|
|
||||||
Serial.print("HDOP: ");
|
|
||||||
Serial.println(nmea.getHDOP() / 10., 1);
|
|
||||||
|
|
||||||
Serial.print("Date/time: ");
|
|
||||||
Serial.print(nmea.getYear());
|
|
||||||
Serial.print('-');
|
|
||||||
Serial.print(int(nmea.getMonth()));
|
|
||||||
Serial.print('-');
|
|
||||||
Serial.print(int(nmea.getDay()));
|
|
||||||
Serial.print('T');
|
|
||||||
Serial.print(int(nmea.getHour()));
|
|
||||||
Serial.print(':');
|
|
||||||
Serial.print(int(nmea.getMinute()));
|
|
||||||
Serial.print(':');
|
|
||||||
Serial.println(int(nmea.getSecond()));
|
|
||||||
|
|
||||||
latitude_mdeg = nmea.getLatitude();
|
latitude_mdeg = nmea.getLatitude();
|
||||||
longitude_mdeg = nmea.getLongitude();
|
longitude_mdeg = nmea.getLongitude();
|
||||||
|
nmea.getAltitude(alt);
|
||||||
Serial.print("Latitude (deg): ");
|
|
||||||
Serial.println(latitude_mdeg / 1000000., 6);
|
|
||||||
|
|
||||||
Serial.print("Longitude (deg): ");
|
|
||||||
Serial.println(longitude_mdeg / 1000000., 6);
|
|
||||||
|
|
||||||
// long alt;
|
|
||||||
Serial.print("Altitude (m): ");
|
|
||||||
if (nmea.getAltitude(alt))
|
|
||||||
Serial.println(alt / 1000., 3);
|
|
||||||
else
|
|
||||||
Serial.println("not available");
|
|
||||||
|
|
||||||
lpp.addGPS(1, latitude_mdeg / 1000000, longitude_mdeg / 1000000,
|
lpp.addGPS(1, latitude_mdeg / 1000000, longitude_mdeg / 1000000,
|
||||||
alt / 1000);
|
alt / 1000);
|
||||||
|
|
||||||
Serial.print("Speed: ");
|
|
||||||
Serial.println(nmea.getSpeed() / 1000., 3);
|
|
||||||
Serial.print("Course: ");
|
|
||||||
Serial.println(nmea.getCourse() / 1000., 3);
|
|
||||||
|
|
||||||
Serial.println("-----------------------");
|
|
||||||
nmea.clear();
|
nmea.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +107,7 @@ void readGPS() {
|
||||||
while (!ppsTriggered && gps.available()) {
|
while (!ppsTriggered && gps.available()) {
|
||||||
// Fetch the character one by one
|
// Fetch the character one by one
|
||||||
char c = gps.read();
|
char c = gps.read();
|
||||||
Serial.print(c);
|
// Serial.print(c);
|
||||||
// Pass the character to the library
|
// Pass the character to the library
|
||||||
nmea.process(c);
|
nmea.process(c);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +115,6 @@ void readGPS() {
|
||||||
|
|
||||||
void async_timer_send() {
|
void async_timer_send() {
|
||||||
if (LoRaWAN.joined() && !LoRaWAN.busy()) {
|
if (LoRaWAN.joined() && !LoRaWAN.busy()) {
|
||||||
Serial.println("Timer Send");
|
|
||||||
// Send Packet
|
// Send Packet
|
||||||
LoRaWAN.sendPacket(1, lpp.getBuffer(), lpp.getSize());
|
LoRaWAN.sendPacket(1, lpp.getBuffer(), lpp.getSize());
|
||||||
uplink_attempted = true;
|
uplink_attempted = true;
|
||||||
|
@ -185,6 +135,8 @@ void setup(void) {
|
||||||
LoRaWAN.setSubBand(2);
|
LoRaWAN.setSubBand(2);
|
||||||
// Disable Adaptive Data Rate
|
// Disable Adaptive Data Rate
|
||||||
LoRaWAN.setADR(false);
|
LoRaWAN.setADR(false);
|
||||||
|
// Set Data Rate 1 - Max Payload 53 Bytes
|
||||||
|
LoRaWAN.setDataRate(1);
|
||||||
// Device IDs and Key
|
// Device IDs and Key
|
||||||
LoRaWAN.joinOTAA(appEui, appKey, devEui);
|
LoRaWAN.joinOTAA(appEui, appKey, devEui);
|
||||||
|
|
||||||
|
@ -218,6 +170,15 @@ void loop(void) {
|
||||||
Serial.print(", DownLinkCounter: ");
|
Serial.print(", DownLinkCounter: ");
|
||||||
Serial.print(LoRaWAN.getDownLinkCounter());
|
Serial.print(LoRaWAN.getDownLinkCounter());
|
||||||
Serial.println(" )");
|
Serial.println(" )");
|
||||||
|
Serial.print("Latitude (deg): ");
|
||||||
|
Serial.print(latitude_mdeg / 1000000., 6);
|
||||||
|
Serial.print(" Longitude (deg): ");
|
||||||
|
Serial.print(longitude_mdeg / 1000000., 6);
|
||||||
|
Serial.print(" Altitude (m): ");
|
||||||
|
if (nmea.getAltitude(alt))
|
||||||
|
Serial.println(alt / 1000., 3);
|
||||||
|
else
|
||||||
|
Serial.println("not available");
|
||||||
|
|
||||||
uplink_attempted = false;
|
uplink_attempted = false;
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue