Browse Source

More accuracy change freq via WWW

master
US1GHQ 2 months ago
parent
commit
84a2a4b2f8
  1. 22
      platformio.ini
  2. 20
      src/TTGO_T-Beam_LoRa_APRS.ino
  3. 9
      src/taskWebServer.cpp
  4. 2
      tools/buildscript_versioning.py

22
platformio.ini

@ -43,8 +43,8 @@ build_flags =
-D 'SHOW_BATT'
-D 'SHOW_RX_PACKET'
-D 'SHOW_RX_TIME=10000'
-D 'TXFREQ="433.775"'
; -D 'SPEED_1200' ; comment out to set 300baud
-D 'TXFREQ=433.775'
-D 'SPEED_1200' ; comment out to set 300baud
-D 'TXdbmW=20'
-D 'ENABLE_OLED'
-D 'ENABLE_LED_SIGNALING'
@ -52,10 +52,10 @@ build_flags =
-D 'MAX_TIME_TO_NEXT_TX=360000L'
-D 'FIX_BEACON_INTERVAL=1800000L'
; -D 'RSSI_SNR_REPORT' ; RSSI and snr report in the KISS PACKET
; -D 'TX_RX_LNA' ; Set external pins for 1W modules
; -D 'TX_RX_LNA' ; Enable external pins for 1W modules, choose pins in *.ino file (default using D16 for RXEN and D17 for TXEN)
[env:ttgo-t-beam-v1.0]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = ttgo-t-beam
build_flags =
${env.build_flags}
@ -64,7 +64,7 @@ build_flags =
; -D ENABLE_BLUETOOTH
[env:ttgo-t-beam-v0.7]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = ttgo-t-beam
build_flags =
${env.build_flags}
@ -73,7 +73,7 @@ build_flags =
-D T_BEAM_V0_7
[env:ttgo-lora32-v2.1]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = ttgo-lora32-v21
build_flags =
${env.build_flags}
@ -82,7 +82,7 @@ build_flags =
-D LORA32_21
[env:ttgo-lora32-v2]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = ttgo-lora32-v2
build_flags =
${env.build_flags}
@ -91,7 +91,7 @@ build_flags =
-D LORA32_2
[env:ttgo-lora32-v1]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = ttgo-lora32-v1
build_flags =
${env.build_flags}
@ -100,7 +100,7 @@ build_flags =
-D LORA32_1
[env:Heltec-WiFi-v1]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = heltec_wifi_kit_32
build_flags =
${env.build_flags}
@ -109,7 +109,7 @@ build_flags =
-D HELTEC_V1
[env:Heltec-WiFi-v2]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = heltec_wifi_kit_32_v2
board_build.f_cpu = 80000000L
build_flags =
@ -119,7 +119,7 @@ build_flags =
-D HELTEC_V2
[env:Esp32-Dev-v1]
platform = espressif32 @ 3.3.0
platform = espressif32 @ 3.3.1
board = esp32dev
; change MCU frequency
;board_build.f_cpu = 80000000L

20
src/TTGO_T-Beam_LoRa_APRS.ino

@ -114,12 +114,13 @@ String aprsComment = MY_COMMENT;
String aprsLatPreset = LATIDUDE_PRESET;
String aprsLonPreset = LONGITUDE_PRESET;
String aprsFreq = TXFREQ;
//Set params
double aprsFreq = TXFREQ;
#ifdef SPEED_1200
int aprsMode = 1200;
ulong aprsMode = 1200;
#else
int aprsMode = 300;
ulong aprsMode = 300;
#endif
boolean gps_state = true;
@ -362,7 +363,7 @@ void sendpacket(){
* @param aprsFreq
* @param message
*/
void loraSend(byte txPower, String aprsFreq, const String &message) {
void loraSend(byte txPower, float aprsFreq, const String &message) {
#ifdef TX_RX_LNA
digitalWrite(TXPIN, HIGH);
digitalWrite(RXPIN, LOW);
@ -383,8 +384,7 @@ void loraSend(byte txPower, String aprsFreq, const String &message) {
{
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
}
float aprsFreq2 = aprsFreq.toFloat();
rf95.setFrequency(aprsFreq2);
rf95.setFrequency(aprsFreq);
rf95.setTxPower(txPower);
rf95.sendAPRS(lora_TXBUFF, messageSize);
rf95.waitPacketSent();
@ -671,9 +671,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.putDouble(PREF_APRS_FREQ, aprsFreq);
}
aprsFreq = preferences.getString(PREF_APRS_FREQ);
aprsFreq = preferences.getDouble(PREF_APRS_FREQ);
if (!preferences.getBool(PREF_APRS_MODE_INIT)){
preferences.putBool(PREF_APRS_MODE_INIT, true);
@ -838,8 +838,8 @@ void setup(){
{
rf95.setModemConfig(BG_RF95::Bw125Cr45Sf4096);
}
float aprsFreq2 = aprsFreq.toFloat();
rf95.setFrequency(aprsFreq2);
rf95.setFrequency(aprsFreq);
rf95.setTxPower(txPower);
delay(250);
#ifdef KISS_PROTOCOL

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 jsonLineFromPreferenceDouble(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":" + String(preferences.getDouble(preferenceName),3) + (last ? + R"()" : + R"(,)");
}
String jsonLineFromPreferenceFloat(const char *preferenceName, bool last=false){
return String("\"") + preferenceName + "\":\"" + (preferences.getFloat(preferenceName)) + (last ? + R"(")" : + R"(",)");
}
@ -149,7 +152,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 += jsonLineFromPreferenceDouble(PREF_APRS_FREQ);
jsonData += jsonLineFromPreferenceInt(PREF_APRS_MODE);
jsonData += jsonLineFromPreferenceInt(PREF_APRS_TXPOWER);
jsonData += jsonLineFromPreferenceBool(PREF_DEV_OL_EN);
@ -243,8 +246,8 @@ 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.putDouble(PREF_APRS_FREQ, server.arg(PREF_APRS_FREQ).toDouble());
}
if (server.hasArg(PREF_APRS_MODE)){
preferences.putInt(PREF_APRS_MODE, server.arg(PREF_APRS_MODE).toInt());
}

2
tools/buildscript_versioning.py

@ -1,6 +1,6 @@
FILENAME_BUILDNO = '.pio/versioning'
FILENAME_VERSION_H = 'include/version.h'
version = 'v0.3.1.'
version = 'v0.3.1.1.'
import datetime
from subprocess import *

Loading…
Cancel
Save