Browse Source

Test

pull/1/head
US1GHQ 3 months ago
parent
commit
c19229130f
  1. 23
      src/TTGO_T-Beam_LoRa_APRS.ino
  2. 9
      src/taskWebServer.cpp

23
src/TTGO_T-Beam_LoRa_APRS.ino

@ -113,9 +113,8 @@ String relay_path;
String aprsComment = MY_COMMENT;
String aprsLatPreset = LATIDUDE_PRESET;
String aprsLonPreset = LONGITUDE_PRESET;
String aprsFreq = "433.775";
float aprsFreq;
String aprsMode = "1200";
String txPwr = "20";
boolean gps_state = true;
boolean key_up = true;
@ -348,16 +347,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 aprsFreq
* @param message
*/
void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
void loraSend(byte lora_LTXPower, float aprsFreq, const String &message) {
#ifdef TX_RX_LNA
digitalWrite(TXPIN, HIGH);
digitalWrite(RXPIN, LOW);
@ -375,7 +374,7 @@ void loraSend(byte lora_LTXPower, float lora_FREQ, const String &message) {
#else
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
#endif
rf95.setFrequency(lora_FREQ);
rf95.setFrequency(aprsFreq);
rf95.setTxPower(lora_LTXPower);
rf95.sendAPRS(lora_TXBUFF, messageSize);
rf95.waitPacketSent();
@ -662,9 +661,9 @@ void setup(){
//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);
preferences.putFloat(PREF_APRS_FREQ, aprsFreq);
}
aprsFreq = preferences.getString(PREF_APRS_FREQ);
aprsFreq = preferences.getFloat(PREF_APRS_FREQ);
if (!preferences.getBool(PREF_APRS_MODE_INIT)){
preferences.putBool(PREF_APRS_MODE_INIT, true);
@ -674,9 +673,9 @@ void setup(){
if (!preferences.getBool(PREF_APRS_TXPOWER_INIT)){
preferences.putBool(PREF_APRS_TXPOWER_INIT, true);
preferences.putString(PREF_APRS_TXPOWER, txPwr);
preferences.putInt(PREF_APRS_TXPOWER, txPower);
}
txPwr = preferences.getString(PREF_APRS_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);
@ -826,7 +825,7 @@ void setup(){
#else
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
#endif
rf95.setFrequency(433.767);
rf95.setFrequency(aprsFreq);
rf95.setTxPower(txPower);
delay(250);
#ifdef KISS_PROTOCOL
@ -951,7 +950,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;
}
}

9
src/taskWebServer.cpp

@ -56,6 +56,9 @@ String jsonLineFromPreferenceBool(const char *preferenceName, bool last=false){
String jsonLineFromPreferenceInt(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":" + (preferences.getInt(preferenceName)) + (last ? + R"()" : + R"(,)");
}
String jsonLineFromPreferenceFloat(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":\"" + (preferences.getFloat(preferenceName)) + (last ? + R"(")" : + R"(",)");
}
String jsonLineFromString(const char *name, const char *value, bool last=false){
return String("\"") + name + "\":\"" + jsonEscape(value) + "\"" + (last ? + R"()" : + R"(,)");
}
@ -146,7 +149,7 @@ void handle_Cfg() {
jsonData += jsonLineFromPreferenceBool(PREF_APRS_FIXED_BEACON_PRESET);
jsonData += jsonLineFromPreferenceBool(PREF_APRS_SHOW_ALTITUDE);
jsonData += jsonLineFromPreferenceBool(PREF_APRS_GPS_EN);
jsonData += jsonLineFromPreferenceString(PREF_APRS_FREQ);
jsonData += jsonLineFromPreferenceFloat(PREF_APRS_FREQ);
jsonData += jsonLineFromPreferenceString(PREF_APRS_MODE);
jsonData += jsonLineFromPreferenceString(PREF_APRS_TXPOWER);
jsonData += jsonLineFromPreferenceBool(PREF_DEV_OL_EN);
@ -240,7 +243,7 @@ void handle_saveDeviceCfg(){
preferences.putInt(PREF_DEV_AUTO_SHUT_PRESET, server.arg(PREF_DEV_AUTO_SHUT_PRESET).toInt());
}
if (server.hasArg(PREF_APRS_FREQ)){
preferences.putString(PREF_APRS_FREQ, server.arg(PREF_APRS_FREQ));
preferences.putFloat(PREF_APRS_FREQ, server.arg(PREF_APRS_FREQ).toFloat());
}
if (server.hasArg(PREF_APRS_MODE)){
preferences.putString(PREF_APRS_MODE, server.arg(PREF_APRS_MODE));
@ -354,7 +357,7 @@ void handle_saveDeviceCfg(){
tncServer.begin();
#endif
if (MDNS.begin(webServerCfg->callsign.c_str())) {
MDNS.setInstanceName(webServerCfg->callsign + " TTGO LoRa APRS TNC " + TXFREQ + "MHz");
MDNS.setInstanceName(webServerCfg->callsign + " LoRa APRS TNC ");
MDNS.addService("http", "tcp", 80);
#ifdef KISS_PROTOCOL
MDNS.addService("kiss-tnc", "tcp", NETWORK_TNC_PORT);

Loading…
Cancel
Save