|
|
|
@ -62,11 +62,11 @@
|
|
|
|
|
#define BUZZER 15 // enter your buzzer pin gpio
|
|
|
|
|
const byte TXLED = 4; //pin number for LED on TX Tracker
|
|
|
|
|
#elif LORA32_21
|
|
|
|
|
#define I2C_SDA 4
|
|
|
|
|
#define I2C_SCL 15
|
|
|
|
|
#define I2C_SDA 21
|
|
|
|
|
#define I2C_SCL 22
|
|
|
|
|
#define BUTTON 2 //pin number for BUTTO
|
|
|
|
|
#define BUZZER 13 // enter your buzzer pin gpio
|
|
|
|
|
const byte TXLED = 4; //pin number for LED on TX Tracker
|
|
|
|
|
const byte TXLED = 25; //pin number for LED on TX Tracker
|
|
|
|
|
#elif LORA32_2
|
|
|
|
|
#define I2C_SDA 21
|
|
|
|
|
#define I2C_SCL 22
|
|
|
|
@ -113,6 +113,15 @@ String relay_path;
|
|
|
|
|
String aprsComment = MY_COMMENT;
|
|
|
|
|
String aprsLatPreset = LATIDUDE_PRESET;
|
|
|
|
|
String aprsLonPreset = LONGITUDE_PRESET;
|
|
|
|
|
|
|
|
|
|
String aprsFreq = TXFREQ;
|
|
|
|
|
|
|
|
|
|
#ifdef SPEED_1200
|
|
|
|
|
int aprsMode = 1200;
|
|
|
|
|
#else
|
|
|
|
|
int aprsMode = 300;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
boolean gps_state = true;
|
|
|
|
|
boolean key_up = true;
|
|
|
|
|
boolean t_lock = false;
|
|
|
|
@ -344,16 +353,16 @@ void sendpacket(){
|
|
|
|
|
#endif
|
|
|
|
|
batt_read();
|
|
|
|
|
prepareAPRSFrame();
|
|
|
|
|
loraSend(txPower, TXFREQ, outString); //send the packet, data is in TXbuff from lora_TXStart to lora_TXEnd
|
|
|
|
|
loraSend(txPower, aprsFreq, outString); //send the packet, data is in TXbuff from lora_TXStart to lora_TXEnd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Send message as APRS LoRa packet
|
|
|
|
|
* @param lora_LTXPower
|
|
|
|
|
* @param lora_FREQ
|
|
|
|
|
* @param txPower
|
|
|
|
|
* @param aprsFreq
|
|
|
|
|
* @param message
|
|
|
|
|
*/
|
|
|
|
|
void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
|
|
|
|
|
void loraSend(byte txPower, String aprsFreq, const String &message) {
|
|
|
|
|
#ifdef TX_RX_LNA
|
|
|
|
|
digitalWrite(TXPIN, HIGH);
|
|
|
|
|
digitalWrite(RXPIN, LOW);
|
|
|
|
@ -366,13 +375,17 @@ void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
|
|
|
|
|
|
|
|
|
|
int messageSize = min(message.length(), sizeof(lora_TXBUFF) - 1);
|
|
|
|
|
message.toCharArray((char*)lora_TXBUFF, messageSize + 1, 0);
|
|
|
|
|
#ifdef SPEED_1200
|
|
|
|
|
if (aprsMode == 1200)
|
|
|
|
|
{
|
|
|
|
|
rf95.setModemConfig(BG_RF95::Bw125Cr47Sf512);
|
|
|
|
|
#else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
|
|
|
|
|
#endif
|
|
|
|
|
rf95.setFrequency(lora_FREQ);
|
|
|
|
|
rf95.setTxPower(lora_LTXPower);
|
|
|
|
|
}
|
|
|
|
|
float aprsFreq2 = aprsFreq.toFloat();
|
|
|
|
|
rf95.setFrequency(aprsFreq2);
|
|
|
|
|
rf95.setTxPower(txPower);
|
|
|
|
|
rf95.sendAPRS(lora_TXBUFF, messageSize);
|
|
|
|
|
rf95.waitPacketSent();
|
|
|
|
|
#ifdef TX_RX_LNA
|
|
|
|
@ -574,8 +587,8 @@ void setup(){
|
|
|
|
|
preferences.putString(PREF_APRS_SYMBOL, APRS_SYMBOL);
|
|
|
|
|
aprsSymbol = preferences.getString(PREF_APRS_SYMBOL, APRS_SYMBOL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!preferences.getBool(PREF_APRS_COMMENT_INIT)){
|
|
|
|
|
|
|
|
|
|
if (!preferences.getBool(PREF_APRS_COMMENT_INIT)){
|
|
|
|
|
preferences.putBool(PREF_APRS_COMMENT_INIT, true);
|
|
|
|
|
preferences.putString(PREF_APRS_COMMENT, MY_COMMENT);
|
|
|
|
|
}
|
|
|
|
@ -644,7 +657,6 @@ void setup(){
|
|
|
|
|
}
|
|
|
|
|
sb_max_interval = preferences.getInt(PREF_APRS_SB_MAX_INTERVAL_PRESET) * 1000;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!preferences.getBool(PREF_APRS_SB_MIN_SPEED_PRESET_INIT)){
|
|
|
|
|
preferences.putBool(PREF_APRS_SB_MIN_SPEED_PRESET_INIT, true);
|
|
|
|
|
preferences.putInt(PREF_APRS_SB_MIN_SPEED_PRESET, sb_min_speed);
|
|
|
|
@ -656,7 +668,25 @@ void setup(){
|
|
|
|
|
preferences.putInt(PREF_APRS_SB_MAX_SPEED_PRESET, sb_max_speed);
|
|
|
|
|
}
|
|
|
|
|
sb_max_speed = preferences.getInt(PREF_APRS_SB_MAX_SPEED_PRESET);
|
|
|
|
|
//
|
|
|
|
|
//Set parameters (freq,mode,txpower)
|
|
|
|
|
if (!preferences.getBool(PREF_APRS_FREQ_INIT)){
|
|
|
|
|
preferences.putBool(PREF_APRS_FREQ_INIT, true);
|
|
|
|
|
preferences.putString(PREF_APRS_FREQ, aprsFreq);
|
|
|
|
|
}
|
|
|
|
|
aprsFreq = preferences.getString(PREF_APRS_FREQ);
|
|
|
|
|
|
|
|
|
|
if (!preferences.getBool(PREF_APRS_MODE_INIT)){
|
|
|
|
|
preferences.putBool(PREF_APRS_MODE_INIT, true);
|
|
|
|
|
preferences.putInt(PREF_APRS_MODE, aprsMode);
|
|
|
|
|
}
|
|
|
|
|
aprsMode = preferences.getInt(PREF_APRS_MODE);
|
|
|
|
|
|
|
|
|
|
if (!preferences.getBool(PREF_APRS_TXPOWER_INIT)){
|
|
|
|
|
preferences.putBool(PREF_APRS_TXPOWER_INIT, true);
|
|
|
|
|
preferences.putInt(PREF_APRS_TXPOWER, txPower);
|
|
|
|
|
}
|
|
|
|
|
txPower = preferences.getInt(PREF_APRS_TXPOWER);
|
|
|
|
|
//End set parameters
|
|
|
|
|
if (!preferences.getBool(PREF_DEV_SHOW_RX_TIME_INIT)){
|
|
|
|
|
preferences.putBool(PREF_DEV_SHOW_RX_TIME_INIT, true);
|
|
|
|
|
preferences.putInt(PREF_DEV_SHOW_RX_TIME, showRXTime/1000);
|
|
|
|
@ -710,7 +740,7 @@ void setup(){
|
|
|
|
|
pinMode(RXPIN, OUTPUT);
|
|
|
|
|
#endif
|
|
|
|
|
pinMode(TXLED, OUTPUT);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef T_BEAM_V1_0
|
|
|
|
|
pinMode(BUTTON, INPUT);
|
|
|
|
|
#elif T_BEAM_V0_7
|
|
|
|
@ -800,12 +830,16 @@ void setup(){
|
|
|
|
|
#endif
|
|
|
|
|
batt_read();
|
|
|
|
|
writedisplaytext("LoRa-APRS","","Init:","ADC OK!","BAT: "+String(BattVolts,1),"");
|
|
|
|
|
#ifdef SPEED_1200
|
|
|
|
|
if (aprsMode == 1200)
|
|
|
|
|
{
|
|
|
|
|
rf95.setModemConfig(BG_RF95::Bw125Cr47Sf512);
|
|
|
|
|
#else
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
|
|
|
|
|
#endif
|
|
|
|
|
rf95.setFrequency(433.775);
|
|
|
|
|
}
|
|
|
|
|
float aprsFreq2 = aprsFreq.toFloat();
|
|
|
|
|
rf95.setFrequency(aprsFreq2);
|
|
|
|
|
rf95.setTxPower(txPower);
|
|
|
|
|
delay(250);
|
|
|
|
|
#ifdef KISS_PROTOCOL
|
|
|
|
@ -930,7 +964,7 @@ void loop() {
|
|
|
|
|
if (xQueueReceive(tncToSendQueue, &TNC2DataFrame, (1 / portTICK_PERIOD_MS)) == pdPASS) {
|
|
|
|
|
writedisplaytext("((KISSTX))","","","","","");
|
|
|
|
|
time_to_refresh = millis() + showRXTime;
|
|
|
|
|
loraSend(txPower, TXFREQ, *TNC2DataFrame);
|
|
|
|
|
loraSend(txPower, aprsFreq, *TNC2DataFrame);
|
|
|
|
|
delete TNC2DataFrame;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|