esp32_loraprs/esp32_loraprs.ino

66 wiersze
1.4 KiB
Arduino
Czysty Zwykły widok Historia

#include <timer.h>
#include "WiFi.h"
#include "loraprs.h"
#define LED_BUILTIN 2
#define LED_TOGGLE_PERIOD 1000
#define LORAPRS_CLIENT
// https://vienna.iaru-r1.org/wp-content/uploads/2019/01/VIE19-C5-015-OEVSV-LORA-APRS-433-MHz.pdf
2019-05-09 16:13:08 +00:00
#ifdef LORAPRS_CLIENT
2019-05-10 12:32:14 +00:00
// calibrate client based on server frequency drift report
#define LORAPRS_FREQ 433.775E6
2019-05-09 16:13:08 +00:00
#else
#define LORAPRS_FREQ 433.775E6
2019-05-09 16:13:08 +00:00
#endif
#ifdef LORAPRS_CLIENT
#define LORAPRS_BT_NAME "loraprs_client"
#define LORAPRS_WIFI_SSID ""
#define LORAPRS_WIFI_KEY ""
#define LORAPRS_LOGIN "NOCALL-0"
#define LORAPRS_PASS "00000"
#define LORAPRS_FREQ_CORR false
#else
2019-04-30 17:31:04 +00:00
#define LORAPRS_BT_NAME ""
#define LORAPRS_WIFI_SSID "<mywifi>"
#define LORAPRS_WIFI_KEY "<key>"
#define LORAPRS_LOGIN "NOCALL-0"
#define LORAPRS_PASS "00000"
#define LORAPRS_FREQ_CORR false
#endif
LoraPrs loraPrs(
LORAPRS_FREQ,
LORAPRS_BT_NAME,
LORAPRS_WIFI_SSID,
LORAPRS_WIFI_KEY,
LORAPRS_LOGIN,
LORAPRS_PASS,
LORAPRS_FREQ_CORR);
auto watchdogLedTimer = timer_create_default();
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, 1);
Serial.begin(115200);
while (!Serial);
loraPrs.setup();
watchdogLedTimer.every(LED_TOGGLE_PERIOD, toggleWatchdogLed);
}
void loop() {
loraPrs.loop();
watchdogLedTimer.tick();
}
bool toggleWatchdogLed(void *) {
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
return true;
}