mirror of
https://github.com/lora-aprs/LoRa_APRS_Tracker.git
synced 2025-12-06 07:12:15 +01:00
first test-version
This commit is contained in:
parent
bd93748196
commit
8860ccb98e
58
LoRa_APRS_Tracker/LoRa_APRS_Tracker.ino
Normal file
58
LoRa_APRS_Tracker/LoRa_APRS_Tracker.ino
Normal file
|
|
@ -0,0 +1,58 @@
|
||||||
|
#include <Arduino.h>
|
||||||
|
#include <LoRa.h>
|
||||||
|
#include <APRS-Decoder.h>
|
||||||
|
|
||||||
|
#include "settings.h"
|
||||||
|
#include "display.h"
|
||||||
|
|
||||||
|
|
||||||
|
void setup_lora();
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
setup_display();
|
||||||
|
|
||||||
|
delay(500);
|
||||||
|
Serial.println("[INFO] LoRa APRS iGate by OE5BPA (Peter Buchegger)");
|
||||||
|
show_display("OE5BPA", "LoRa APRS iGate", "by Peter Buchegger", 2000);
|
||||||
|
|
||||||
|
setup_lora();
|
||||||
|
|
||||||
|
delay(500);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
String buffer = "OE5BPA-7>APRS:=4819.82NI01418.68E&LoRa Tracker test\n";
|
||||||
|
LoRa.beginPacket();
|
||||||
|
LoRa.write((const uint8_t*)buffer.c_str(), buffer.length());
|
||||||
|
LoRa.endPacket();
|
||||||
|
Serial.print("[INFO] Package sent: ");
|
||||||
|
Serial.println(buffer);
|
||||||
|
show_display("OE5BPA", "Package sent", buffer);
|
||||||
|
delay(30000);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup_lora()
|
||||||
|
{
|
||||||
|
Serial.println("[INFO] Set SPI pins!");
|
||||||
|
SPI.begin(LORA_SCK, LORA_MISO, LORA_MOSI, LORA_SS);
|
||||||
|
LoRa.setPins(LORA_SS, LORA_RST, LORA_DIO0);
|
||||||
|
Serial.println("[INFO] Set LoRa pins!");
|
||||||
|
|
||||||
|
long freq = 433775000;
|
||||||
|
Serial.print("[INFO] frequency: ");
|
||||||
|
Serial.println(freq);
|
||||||
|
if (!LoRa.begin(freq)) {
|
||||||
|
Serial.println("[ERROR] Starting LoRa failed!");
|
||||||
|
show_display("ERROR", "Starting LoRa failed!");
|
||||||
|
while (1);
|
||||||
|
}
|
||||||
|
LoRa.setSpreadingFactor(12);
|
||||||
|
LoRa.setSignalBandwidth(125E3);
|
||||||
|
LoRa.setCodingRate4(5);
|
||||||
|
LoRa.enableCrc();
|
||||||
|
Serial.println("[INFO] LoRa init done!");
|
||||||
|
show_display("INFO", "LoRa init done!", 2000);
|
||||||
|
}
|
||||||
132
LoRa_APRS_Tracker/display.cpp
Normal file
132
LoRa_APRS_Tracker/display.cpp
Normal file
|
|
@ -0,0 +1,132 @@
|
||||||
|
|
||||||
|
#include <Wire.h>
|
||||||
|
#include <Adafruit_GFX.h>
|
||||||
|
#include <Adafruit_SSD1306.h>
|
||||||
|
|
||||||
|
#include "display.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RST);
|
||||||
|
|
||||||
|
void setup_display()
|
||||||
|
{
|
||||||
|
pinMode(OLED_RST, OUTPUT);
|
||||||
|
digitalWrite(OLED_RST, LOW);
|
||||||
|
delay(20);
|
||||||
|
digitalWrite(OLED_RST, HIGH);
|
||||||
|
|
||||||
|
Wire.begin(OLED_SDA, OLED_SCL);
|
||||||
|
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3c, false, false))
|
||||||
|
{
|
||||||
|
Serial.println("SSD1306 allocation failed");
|
||||||
|
while (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0,0);
|
||||||
|
display.print("LORA SENDER ");
|
||||||
|
display.display();
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_display(String header, int wait)
|
||||||
|
{
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setCursor(0,0);
|
||||||
|
display.println(header);
|
||||||
|
display.display();
|
||||||
|
delay(wait);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_display(String header, String line1, int wait)
|
||||||
|
{
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setCursor(0,0);
|
||||||
|
display.println(header);
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0,16);
|
||||||
|
display.println(line1);
|
||||||
|
display.display();
|
||||||
|
delay(wait);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_display(String header, String line1, String line2, int wait)
|
||||||
|
{
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setCursor(0,0);
|
||||||
|
display.println(header);
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0,16);
|
||||||
|
display.println(line1);
|
||||||
|
display.setCursor(0,26);
|
||||||
|
display.println(line2);
|
||||||
|
display.display();
|
||||||
|
delay(wait);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_display(String header, String line1, String line2, String line3, int wait)
|
||||||
|
{
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setCursor(0,0);
|
||||||
|
display.println(header);
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0,16);
|
||||||
|
display.println(line1);
|
||||||
|
display.setCursor(0,26);
|
||||||
|
display.println(line2);
|
||||||
|
display.setCursor(0,36);
|
||||||
|
display.println(line3);
|
||||||
|
display.display();
|
||||||
|
delay(wait);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_display(String header, String line1, String line2, String line3, String line4, int wait)
|
||||||
|
{
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setCursor(0,0);
|
||||||
|
display.println(header);
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0,16);
|
||||||
|
display.println(line1);
|
||||||
|
display.setCursor(0,26);
|
||||||
|
display.println(line2);
|
||||||
|
display.setCursor(0,36);
|
||||||
|
display.println(line3);
|
||||||
|
display.setCursor(0,46);
|
||||||
|
display.println(line4);
|
||||||
|
display.display();
|
||||||
|
delay(wait);
|
||||||
|
}
|
||||||
|
|
||||||
|
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait)
|
||||||
|
{
|
||||||
|
display.clearDisplay();
|
||||||
|
display.setTextColor(WHITE);
|
||||||
|
display.setTextSize(2);
|
||||||
|
display.setCursor(0,0);
|
||||||
|
display.println(header);
|
||||||
|
display.setTextSize(1);
|
||||||
|
display.setCursor(0,16);
|
||||||
|
display.println(line1);
|
||||||
|
display.setCursor(0,26);
|
||||||
|
display.println(line2);
|
||||||
|
display.setCursor(0,36);
|
||||||
|
display.println(line3);
|
||||||
|
display.setCursor(0,46);
|
||||||
|
display.println(line4);
|
||||||
|
display.setCursor(0,56);
|
||||||
|
display.println(line5);
|
||||||
|
display.display();
|
||||||
|
delay(wait);
|
||||||
|
}
|
||||||
14
LoRa_APRS_Tracker/display.h
Normal file
14
LoRa_APRS_Tracker/display.h
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
#ifndef DISPLAY_H_
|
||||||
|
#define DISPLAY_H_
|
||||||
|
|
||||||
|
void setup_display();
|
||||||
|
|
||||||
|
void show_display(String header, int wait = 0);
|
||||||
|
void show_display(String header, String line1, int wait = 0);
|
||||||
|
void show_display(String header, String line1, String line2, int wait = 0);
|
||||||
|
void show_display(String header, String line1, String line2, String line3, int wait = 0);
|
||||||
|
void show_display(String header, String line1, String line2, String line3, String line4, int wait = 0);
|
||||||
|
void show_display(String header, String line1, String line2, String line3, String line4, String line5, int wait = 0);
|
||||||
|
|
||||||
|
#endif
|
||||||
20
LoRa_APRS_Tracker/settings.h
Normal file
20
LoRa_APRS_Tracker/settings.h
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
|
||||||
|
#ifndef SETTINGS_H_
|
||||||
|
#define SETTINGS_H_
|
||||||
|
|
||||||
|
#define CALL "OE5BPA-7"
|
||||||
|
|
||||||
|
#define LORA_SCK 5
|
||||||
|
#define LORA_MISO 19
|
||||||
|
#define LORA_MOSI 27
|
||||||
|
#define LORA_SS 18
|
||||||
|
#define LORA_RST 23
|
||||||
|
#define LORA_DIO0 26
|
||||||
|
|
||||||
|
#define OLED_SDA 21
|
||||||
|
#define OLED_SCL 22
|
||||||
|
#define OLED_RST 4
|
||||||
|
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||||
|
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
||||||
|
|
||||||
|
#endif
|
||||||
Loading…
Reference in a new issue