Porównaj commity

...

3 Commity

Autor SHA1 Wiadomość Data
Thomas Osterried 85236cda21 Two fixes
I did the following mistakes:
  - GPS age was computed wrong (since I introduced
    compute_time_since_received() )
  - course computation had a small bug

Web page:
clarified in the description of the middle button where the shown
distance and position is based on (the values are based on your current
position, not on the position when you received the packet)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-17 17:22:12 +01:00
Thomas Osterried c68cf822e6 local aprsis-filter, bugfix, vers_xxshort_bn, no gif
1.1 local aprsis-filter

1.1 Filter type (local, optional)

Local aprsis-filter incoming for packet-types.
We observed that if you have a server-site filter, i.e. for receive private
messages only, 20km around you (t/m/MYCALL/20), aprsis sends also some
location positions of users (if you heard them on RF), and even if \>20km
away.  Also we have seen packets of type objects telemetry, etc.
With this option, you can filter incoming aprsis-packets localy in order
to prevent them from gating to RF. Valid filters are poimqstunwb (Position
packets, objects, items, message, query, status, telemetry, user-defined,
NWS, weather, bulletin (bulletins are aprs-messages prefixed with BLN').
You can invert the filter ('all except ...') by adding a leading '-',
i.e. '-mws'.
If you leave this field empty, aprsis local filter is disabled.
=> [-]poimqstunwb

1.2 Filter 'words' (local, optional)

Local aprsis-filter incoming for 'words': if this word is part of the header
or message body of a packet coming from aprsis, the packet is filtered out.
You can sepearate multiple word-filters by space.
Leave empty to disable a word filter.

Many thanks go to Tomasz SP2ATJ for this idea and nice discussions
and intensively testing.

2. bugfix

During "save" of the config via web-interface, we call
setup_phase2_soft_reconfiguration()
String Tcall is changed. OledHdr had a reference to Tcall.
OledHdr needs to be updated. Else there's a very rare race condition
(only observed one time in 3 years) where
writedisplaytext(OledHdr,OledLine1,OledLine2,OledLine3,OledLine4,OledLine5);
crashed during accessing OledHdr.
OledHdr = String(Tcall); sould make a local copy.
OledLines1-5 are also set explicit to "" now.

3. VERS_XXSHORT_BN

buildscript_versioning.py generates BUILD_NUMBER, VERSION, VERSION_SHORT, etc.

We compute the build_nr with base62 (0-9, a-z, A-Z)
This gives us room for (62**2)-1 = 3843 builds between git commits. Should be
enough.
git_id short is 7 bytes.  length of 5 has hopefully enough entropy.
VERS_XXSHORT_BN may also be sent on RF -> We keep it short. 8 bytes now,
(5 bytes git id, 2 bytes base62-encoded build_no) instead of typically
3 bytes before.

Why we need both?
1. git-id: you can determine which was the git head when you checked out,
   and what has changed since then
2. During developmment / testing, build-nr increases each compiler run -
   but the git id only changes after git push. build_no helps you to
   distinguish, which version of a compler run you currently use.

VERSION had a date resolution of 1 microsecond. -> now cutting string after
the minute value.

4. style.css

I decided to remove the #logo ("background-image"), which is a base64-
encoded inline gif.
We need space for the flash, because the code reached 100% of it's size!!
If we have a solution, the logo comes back.

Other options:
  - don't compile with -DENABLE_SYSLOG, or the like
  - re-partition. Other firmmware-developers did this. But I'm a bit
    sceptical to do this.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-17 05:42:21 +01:00
Thomas Osterried 65f10b62e7 Some smaller fixes
- display:
    - some fixes
    - fix incorrect display if external power plugged off and gps fix
valid
- removed some debug_verbose messages and moved some debig_verbose
  messages inside #ifdef DEVELOPMENT_DEBUG
  -> saves some flash space of the binary
- other smaller fixes

Signed-off-by: DL3EL <dl3el@darc.de>
Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-14 10:55:32 +01:00
6 zmienionych plików z 303 dodań i 87 usunięć

Wyświetl plik

@ -510,9 +510,17 @@ III: Values above are referring to latitude; distance between two latitudes is a
<input type="password" name="aprsis_pw" id="aprsis_pw" title="Your password for the APRS-IS connection.">
</div>
<div>
<label for="aprsis_fltr">Filter (optional)</label>
<label for="aprsis_fltr">Filter (server-site, optional)</label>
<input type="text" name="aprsis_fltr" id="aprsis_fltr" title="Request server-site filter (may be left empty). See http://www.aprs-is.net/javAPRSFilter.aspx ; Example: 't/mqs/YOURCALL/50' -> Gate only messages, query and status messages to RF, from a circle of 50km around your last known position. w, o and i may be of interest, but some people on 2m APRS or APRS-IS may send those packets much too frequently. Please trace the effect! Perhaps in combination with '-e/DB0FRI-10'. In our case, the digi positioning beacon from DB0FRI-10 (which is also an igate nearby, APRS-IS path qAI,DB0FRI-10) came from APRS-IS to us and we gated his beacon, encoded as third-party-trafffic, back to RF (which makes no sense: 1. His direct RF beacon is much better heard than ours -> all RF users heard it. 2. We needless consumed airtime). -> Using -e/IGATE1/IGATE2/.. , everything heard (and sent to APRS-IS) by our neighbor igates like DB0FRI-10 will not be re-gated by us. Please also check, if '-d/..' instead of (or additional to) '-e/..' is more suitiable in your environment; you may also consider -/b/.. ." placeholder="may be left blank">
</div>
<div>
<label for="aprsis_fli">Filter type (local, optional)</label>
<input type="text" name="aprsis_fli" id="aprsis_fli" title="Local aprsis-filter incoming for packet-types. We observed that if you have a server-site filter, i.e. for receive private messages only, 20km around you (t/m/MYCALL/20), aprsis sends also some location positions of users (if you heard them on RF), and even if \>20km away. Also we have seen packets of type objects telemetry, etc. With this option, you can filter incoming aprsis-packets localy in order to prevent them from gating to RF. Valid filters are poimqstunwb (Position packets, objects, items, message, query, status, telemetry, user-defined, NWS, weather, bulletin (bulletins are aprs-messages prefixed with BLN'). You can invert the filter ('all except ...') by adding a leading '-', i.e. '-mws'. If you leave this field empty, aprsis local filter is disabled." placeholder="[-]poimqstunwb">
</div>
<div>
<label for="aprsis_fliw">Filter 'words' (local, optional)</label>
<input type="text" name="aprsis_fliw" id="aprsis_fliw" title="Local aprsis-filter incoming for 'words': if this word is part of the header or message body of a packet coming from aprsis, the packet is filtered out. You can sepearate multiple word-filters by space. Leave empty to disable a word filter." placeholder="">
</div>
<div>
<label for="tx_aprsis_sm">Send status-message to APRS-IS</label>
<input name="tx_aprsis_sm" id="tx_aprsis_sm" type="checkbox" value="1" title="Send APRS-status-message about new tcp connectioni, -attepts or your requested shutdown/reboot to APRS-IS. This helps you to trace reboots and unexpected loss of wifi- or internet-access.">
@ -867,11 +875,11 @@ Hard readable lengths / too long for our display:
If OLED is disabled or OLED is ON:<br>
<ul>
<li>flip through the available pages</li>
<li>1. press: show lastheard list (Call, time, distance, direction)</li>
<li>1. press: show lastheard list (Call, time, distance, direction). Distance and direction based on your current (or last known) position.</li>
<li>2. press: show current build number</li>
<li>3. - 5. press: show last 3 received packets (raw)</li>
<li>6. press: with GPS-FIX immediate send a beacon with the position from the GPS</li>
<li>6. press: without GPS-FIX, immediate send a beacon with the position saved in the configuration</li>
<li>6a. press, if you have GPS-FIX: immediate send a beacon with the position from the GPS</li>
<li>6b. press, if you don't have a GPS-FIX: immediate send a beacon with the position saved in the configuration (or last known position)</li>
</ul>
<h6 class="u-full-width">long press</h6>
<ul>
@ -989,7 +997,8 @@ Hard readable lengths / too long for our display:
<center><b>This version runs the DL9SAU/DL3EL fork:</b> <a href=https://github.com/DL9SAU/TTGO-T-Beam-LoRa-APRS>https://github.com/DL9SAU/TTGO-T-Beam-LoRa-APRS</a></center>
<center><b>Licensed under:</b> CC BY-NC-SA</center>
<center><!--VERSION--></center>
<center><label for="CompileFlags">Hardware / compiled with features:</label>
<center>
<label for="CompileFlags">Hardware / compiled with features:</label>
<input type="text" name="CompileFlags" id="CompileFlags" readonly title="CompileFlags">
</center>
</footer>

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -179,6 +179,10 @@ static const char *const PREF_APRSIS_SERVER_PORT_INIT = "aprsis_srv_p_i";
static const char *const PREF_APRSIS_SERVER_PORT = "aprsis_srv_p";
static const char *const PREF_APRSIS_FILTER_INIT = "aprsis_fltr_i";
static const char *const PREF_APRSIS_FILTER = "aprsis_fltr";
static const char *const PREF_APRSIS_FILTER_LOCAL_INCOMING_INIT = "aprsis_fli_i";
static const char *const PREF_APRSIS_FILTER_LOCAL_INCOMING = "aprsis_fli";
static const char *const PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING_INIT = "aprsis_fliw_i";
static const char *const PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING = "aprsis_fliw";
static const char *const PREF_APRSIS_CALLSIGN_INIT = "aprsis_call_i";
static const char *const PREF_APRSIS_CALLSIGN = "aprsis_call";
static const char *const PREF_APRSIS_PASSWORD_INIT = "aprsis_pw_i";

Wyświetl plik

@ -37,8 +37,7 @@
#ifdef DEVELOPMENT_DEBUG
int debug_verbose = 1;
#else
//int debug_verbose = 0;
int debug_verbose = 1;
int debug_verbose = 0;
#endif
// Access to SPIFFS for wifi.cfg
@ -145,6 +144,9 @@ boolean aprsis_enabled = false;
String aprsis_host = "euro.aprs2.net";
uint16_t aprsis_port = 14580;
String aprsis_filter = "";
String aprsis_own_filters_in = "";
boolean aprsis_own_filter_in_is_whitelist = true;
String aprsis_own_filters_words_in = "";
String aprsis_callsign = "";
String aprsis_password = "-1";
uint8_t aprsis_data_allow_inet_to_rf = 0; // 0: disable (default). 1: gate to main qrg. 2: gate to secondary qrg. 3: gate to both frequencies
@ -1345,6 +1347,7 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3
if (Line5.length() > 21) Line5.remove(21, Line5.length()-21);
}
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) {
if (HeaderTxt.length() > 21) {
Serial.printf("HeaderTxt: %s (%d)\r\n", HeaderTxt.c_str(), HeaderTxt.length());
@ -1365,8 +1368,16 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3
Serial.printf("Line5: %s (%d)\r\n", Line5.c_str(), Line5.length());
}
}
#endif
OledHdr = HeaderTxt;
OledLine1 = Line1;
OledLine2 = Line2;
OledLine3 = Line3;
OledLine4 = Line4;
OledLine5 = Line5;
if (display_is_on) {
write2display();
#ifdef DEVELOPMENT_DEBUG
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
@ -1384,6 +1395,7 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3
display.setCursor(0,56);
display.println(Line5);
display.display();
#endif
}
// if oled is continuosly on (or currently on), refresh every second (DL3EL)
@ -1394,12 +1406,14 @@ void writedisplaytext(String HeaderTxt, String Line1, String Line2, String Line3
time_to_refresh = millis() + showRXTime;
}
// save last display output for blinker
#ifdef DEVELOPMENT_DEBUG
OledHdr = HeaderTxt;
OledLine1 = Line1;
OledLine2 = Line2;
OledLine3 = Line3;
OledLine4 = Line4;
OledLine5 = Line5;
#endif
}
void timer_once_a_second() {
@ -1453,6 +1467,7 @@ void timer_once_a_second() {
if (OledLine5.length() > 21) OledLine5.remove(21, OledLine5.length()-21);
}
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) {
if (OledHdr.length() > 21) {
Serial.printf("OledHdr [timer_once_a_second]: %s (%d)\r\n", OledHdr.c_str(), OledHdr.length());
@ -1473,7 +1488,9 @@ void timer_once_a_second() {
Serial.printf("OledLine5 [timer_once_a_second]: %s (%d)\r\n", OledLine5.c_str(), OledLine5.length());
}
}
#endif
write2display();
#ifdef DEVELOPMENT_DEBUG
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
@ -1491,9 +1508,30 @@ void timer_once_a_second() {
display.setCursor(0,56);
display.println(OledLine5);
display.display();
#endif
}
}
void write2display() {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(2);
display.setCursor(0,0);
display.println(OledHdr);
display.setTextSize(1);
display.setCursor(0,16);
display.println(OledLine1);
display.setCursor(0,26);
display.println(OledLine2);
display.setCursor(0,36);
display.println(OledLine3);
display.setCursor(0,46);
display.println(OledLine4);
display.setCursor(0,56);
display.println(OledLine5);
display.display();
}
char *str_course(int resolution) {
static char buf[7]; // room for 359.9G + \0
@ -1652,6 +1690,8 @@ void fillDisplayLine1(int caller) {
void fillDisplayLine2() {
if (freeze_display)
return;
#ifdef ENABLE_WIFI
wifi_info = "WiFi";
if (wifi_connection_status == WIFI_RUNNING_AS_AP) {
@ -1696,15 +1736,10 @@ void fillDisplayLine2() {
void fillDisplayLines3to5(int force) {
static uint32_t ratelimit_until = 0L;
if (debug_verbose > 2)
Serial.printf("fillDisplayLines3to5 start, force:%d Display::%d\r\n",force,display_is_on);
if (!force && millis() < ratelimit_until)
return;
ratelimit_until = millis() + (oled_timeout == 0 ? 1000 : showRXTime);
if (debug_verbose > 1)
Serial.printf("fillDisplayLines3to5 ongoing, force:%d Display::%d\r\n",force,display_is_on);
boolean show_locator = false;
if (oled_show_locator == 1) {
show_locator = true;
@ -1739,11 +1774,6 @@ void fillDisplayLines3to5(int force) {
}
OledLine4 = getSpeedCourseAlti();
if (debug_verbose > 1) {
Serial.printf("OledLine3_1 [fillDisplayLines3to5] from %d: [%s] (%d)\r\n", force, OledLine3.c_str(), OledLine3.length());
Serial.printf("OledLine4_1 [fillDisplayLines3to5] from %d: [%s] (%d)\r\n", force, OledLine4.c_str(), OledLine4.length());
}
} else {
char buf[22]; // OLED-Display can show 21 characters in a line
@ -1838,8 +1868,6 @@ void fillDisplayLines3to5(int force) {
sprintf(buf, "%11.11s %1s %7.7s", b, aprsPresetShown.c_str(), spd);
}
OledLine3 = String(buf);
if (debug_verbose > 1)
Serial.printf("OledLine3_2 [fillDisplayLines3to5] from %d: %s (%d)\r\n", force, OledLine3.c_str(), OledLine3.length());
if ((oled_line3and4_format % 2)) {
const char *p = aprsLonPreset.c_str();
sprintf(b, "%.3s\xF7%s", p, p+3);
@ -1856,19 +1884,15 @@ void fillDisplayLines3to5(int force) {
sprintf(buf, "%11.11s %4.4s%5.5s", b, str_course(0), str_altitude());
}
OledLine4 = String(buf);
if (debug_verbose > 1)
Serial.printf("OledLine4_2 [fillDisplayLines3to5] from %d: %s (%d)\r\n", force, OledLine4.c_str(), OledLine4.length());
}
}
OledLine5 = getSatAndBatInfo();
}
String compute_time_since_received(uint32_t recv) {
String compute_time_since_received(uint32_t elapsed) {
String recv_p;
uint32_t elapsed;
elapsed = millis()/1000 - recv;
if (elapsed < 60) {
recv_p = String(elapsed) + "s";
} else if (elapsed < 3600) {
@ -1886,8 +1910,6 @@ void displayInvalidGPS() {
uint32_t gpsage;
if (freeze_display)
return;
if (debug_verbose > 1)
Serial.printf("displayInvalidGPS start (%d)\r\n",freeze_display);
String gpsage_p = " GPS: dis";
fillDisplayLine1(1);
if (gps_state) {
@ -1975,7 +1997,7 @@ void set_callsign() {
#endif
#endif
}
Tcall = s;
Tcall = String(s);
}
// telemetry frames
@ -3078,6 +3100,8 @@ void load_preferences_cfg_file()
aprsis_host = jsonElementFromPreferenceCFGString(PREF_APRSIS_SERVER_NAME,PREF_APRSIS_SERVER_NAME_INIT);
aprsis_port = jsonElementFromPreferenceCFGInt(PREF_APRSIS_SERVER_PORT,PREF_APRSIS_SERVER_PORT_INIT);
aprsis_filter = jsonElementFromPreferenceCFGString(PREF_APRSIS_FILTER,PREF_APRSIS_FILTER_INIT);
aprsis_own_filters_in = jsonElementFromPreferenceCFGString(PREF_APRSIS_FILTER_LOCAL_INCOMING,PREF_APRSIS_FILTER_LOCAL_INCOMING_INIT);
aprsis_own_filters_words_in = jsonElementFromPreferenceCFGString(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING,PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING_INIT);
aprsis_callsign = jsonElementFromPreferenceCFGString(PREF_APRSIS_CALLSIGN,PREF_APRSIS_CALLSIGN_INIT);
aprsis_password = jsonElementFromPreferenceCFGString(PREF_APRSIS_PASSWORD,PREF_APRSIS_PASSWORD_INIT);
aprsis_data_allow_inet_to_rf = jsonElementFromPreferenceCFGInt(PREF_APRSIS_ALLOW_INET_TO_RF,PREF_APRSIS_ALLOW_INET_TO_RF_INIT);
@ -3591,6 +3615,27 @@ void load_preferences_from_flash()
}
aprsis_filter = preferences.getString(PREF_APRSIS_FILTER, "");
if (!preferences.getBool(PREF_APRSIS_FILTER_LOCAL_INCOMING_INIT)){
preferences.putBool(PREF_APRSIS_FILTER_LOCAL_INCOMING_INIT, true);
preferences.putString(PREF_APRSIS_FILTER_LOCAL_INCOMING, "");
}
aprsis_own_filters_in = preferences.getString(PREF_APRSIS_FILTER_LOCAL_INCOMING, "");
if (!aprsis_own_filters_in.isEmpty() && aprsis_own_filters_in.startsWith("-")) {
aprsis_own_filter_in_is_whitelist = false;
aprsis_own_filters_in = String((aprsis_own_filters_in.c_str())+1);
aprsis_own_filters_in.trim();
aprsis_own_filters_in.replace(" ", "");
} else {
aprsis_own_filter_in_is_whitelist = true;
}
if (!preferences.getBool(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING_INIT)){
preferences.putBool(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING_INIT, true);
preferences.putString(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING, "");
}
aprsis_own_filters_words_in = preferences.getString(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING, "");
aprsis_own_filters_words_in.trim();
if (!preferences.getBool(PREF_APRSIS_CALLSIGN_INIT)){
preferences.putBool(PREF_APRSIS_CALLSIGN_INIT, true);
preferences.putString(PREF_APRSIS_CALLSIGN, aprsis_callsign);
@ -3709,6 +3754,13 @@ void setup_phase2_soft_reconfiguration(boolean runtime_reconfiguration) {
if (runtime_reconfiguration) {
setup_oled_timer_values();
// fix exception: reference to free'd Tcall in OledHdr -> New copy of current Tcall
OledHdr = String(Tcall);
OledLine1 = "setup_phase2";
OledLine2 = String("");
OledLine3 = String("");
OledLine4 = String("");
OledLine5 = String("");
writedisplaytext(OledHdr,OledLine1,OledLine2,OledLine3,OledLine4,OledLine5);
} // else: in setup() during boot, we have several unpredictable delays. That's why it's not called here
@ -3748,7 +3800,7 @@ void setup_compile_flags_info()
#ifdef KISS_PROTOCOL
strcat(compile_flags, ",KISS_PROTOCOL");
#endif
#ifdef ENABLE_OLED
#ifdef ENABLE_OLED
strcat(compile_flags, ",ENABLE_OLED");
#endif
#ifdef ENABLE_SYSLOG
@ -3760,7 +3812,6 @@ void setup_compile_flags_info()
#endif
}
// + SETUP --------------------------------------------------------------+//
void setup()
{
@ -3771,8 +3822,9 @@ void setup()
// initialize ESP32 Process WDT, 120s T/O
esp_task_wdt_init(120, true);
// Our BUILD_NUMBER. The define is not available in the WEBSERVR -> we need to assign a global variable
buildnr = BUILD_NUMBER;
// Our BUILD_NUMBER. The define is not available in the WEBSERVER -> we need to assign a global variable
//buildnr = BUILD_NUMBER;
buildnr = VERS_XXSHORT_BN;
setup_compile_flags_info();
SPI.begin(SPI_sck,SPI_miso,SPI_mosi,SPI_ss); //DO2JMG Heltec Patch
@ -3784,6 +3836,11 @@ void setup()
for(;;); // Don't proceed, loop forever
}
writedisplaytext("LoRa-APRS","by DL9SAU & DL3EL","Build:" + buildnr,"Hello!","For Factory Reset:"," press middle Button");
Serial.println("LoRa-APRS by DL9SAU & DL3EL Build:" + buildnr);
Serial.println("Hardware / compiled with features: ");
Serial.print(" ");
Serial.println(compile_flags);
Serial.println("Time used since start (-2000ms delay): " + String(millis()-t_setup_entered-2000) + "ms");
delay(2000); // 2s delay to be safe that serial.print works
Serial.println("System Start-Up");
@ -3931,10 +3988,6 @@ void setup()
set_callsign();
writedisplaytext("LoRa-APRS","by DL9SAU & DL3EL","Build:" + buildnr,"Hello de " + Tcall,"For Factory Reset:"," press middle Button");
Serial.println("LoRa-APRS by DL9SAU & DL3EL Build:" + buildnr);
Serial.println("Hardware / compiled with features: ");
Serial.print(" ");
Serial.println(compile_flags);
Serial.println("Time used since start (-2000ms delay): " + String(millis()-t_setup_entered-2000) + "ms");
delay(2000);
@ -5093,8 +5146,8 @@ void handle_usb_serial_input(void) {
#endif
#ifdef ENABLE_WIFI
Serial.println(" wifi <on|off>");
Serial.println(" version");
#endif
Serial.println(" version");
Serial.println(" ? (help)");
} else if (cmd == "reboot") {
enableOled_now();
@ -5463,7 +5516,6 @@ void aprspos2double(char *lh_lat_aprs, char *lh_lng_aprs, double &lh_lat, double
lh_lng = atoi(buf) + decimals;
if (west) lh_lng *= -1;
if (debug_verbose > 1) Serial.printf("Decimal Pos %5.2f %5.2f South: %d West %d\r\n", lh_lat, lh_lng,south, west);
}
@ -5477,22 +5529,20 @@ void fill_lh(const String &rxcall, const char *digipeatedflag, const char *p) {
int pos_type = 0;
boolean lh_position = false;
if (debug_verbose > 1) Serial.printf("Check for LH RX pos for %s out of Payload:(%s)\r\n",rxcall.c_str(), p);
if (p[0] == '!' || p[0] == '=') {
pos_type = 1;
p++;
} else if (p[0] == '/' || p[0] == '@') {
if (debug_verbose > 1) Serial.printf("Pos Type 2 detected LH RX pos out of %s\r\n", p);
// Pos Type 2 detected
pos_type = 2;
p += 8;
} else {
// Pos Type 3 detected
pos_type = 3;
if (debug_verbose > 1) Serial.printf("Pos Type 3 detected, not valid here\r\n");
}
if (pos_type == 1 || pos_type == 2) {
lh_position = true;
if (debug_verbose > 1) Serial.printf("Pos detected %s\r\n", p);
if (isdigit(*p)) {
strncpy(lh_lat_aprs, p, 8);
lh_lat_aprs[8] = 0;
@ -5520,7 +5570,6 @@ void fill_lh(const String &rxcall, const char *digipeatedflag, const char *p) {
lh_lng = double ( -180 + n / 190463.0);
}
} else {
if (debug_verbose > 1) Serial.printf("no Pos detected\r\n");
lh_lat = 0;
lh_lng = 0;
lh_position = false;
@ -5543,7 +5592,6 @@ void fill_lh(const String &rxcall, const char *digipeatedflag, const char *p) {
LH[0].lat = lh_lat;
LH[0].lng = lh_lng;
LH[0].direct = digipeatedflag ? false : true;
if (debug_verbose > 1) Serial.printf("LH new:(0)%s%c%ds %5.2f %5.2f \r\n", LH[0].callsign.c_str(), LH[0].direct ? ':' : '*', LH[0].time_received, LH[0].lat, LH[0].lng);
}
}
@ -5557,14 +5605,14 @@ void write_last_heard_calls_with_distance_and_course_to_display() {
for (int i=0; i < MAX_LH; i++) {
if (LH[i].callsign != "") {
courseTo = TinyGPSPlus::courseTo(aprsLatPresetDouble, aprsLonPresetDouble, LH[i].lat, LH[i].lng);
if (courseTo >= 22.5 && courseTo < 67.5) sprintf(course, "NE");
if (courseTo < 22.5 || courseTo >= 337.5) sprintf(course, "N");
else if (courseTo < 67.5) sprintf(course, "NE");
else if (courseTo < 112.5) sprintf(course, "E");
else if (courseTo < 157.5) sprintf(course, "SE");
else if (courseTo < 202.5) sprintf(course, "S");
else if (courseTo < 247.5) sprintf(course, "SW");
else if (courseTo < 292.5) sprintf(course, "W");
else if (courseTo < 337.5) sprintf(course, "NW");
else sprintf(course, "N");
else /* if (courseTo < 337.5) */ sprintf(course, "NW");
distTo = TinyGPSPlus::distanceBetween(aprsLatPresetDouble, aprsLonPresetDouble, LH[i].lat, LH[i].lng) / 1000.0f;
@ -5590,13 +5638,12 @@ void write_last_heard_calls_with_distance_and_course_to_display() {
} else {
sprintf(dist_and_course, " >999 %s", course);
}
line[i] = LH[i].callsign + (LH[i].direct ? ":" : "*") + compute_time_since_received(LH[i].time_received) + dist_and_course;
line[i] = LH[i].callsign + (LH[i].direct ? ":" : "*") + compute_time_since_received(millis()/1000.0L - LH[i].time_received) + dist_and_course;
} else {
line[i] = "";
}
}
writedisplaytext("((LH))",line[0],line[1],line[2],line[3],line[4]);
if (debug_verbose > 1) Serial.printf("LH write End:\r\n[0]%s\r\n[1]%s\r\n[2]%s\r\n[3]%s\r\n", line[0].c_str(), line[1].c_str(), line[2].c_str(), line[3].c_str());
}
@ -5643,12 +5690,15 @@ void loop()
Serial.println("Tracker: Button pressed...");
button_down_count += 1;
if (debug_verbose > 1) Serial.printf("Button pressed %dx (1)\r\n", button_down_count);
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) Serial.printf("Button pressed %dx (1)\r\n", button_down_count);
#endif
if (digitalRead(BUTTON) == LOW) {
delay(300);
time_delay = millis() + 1500;
if (debug_verbose > 1) Serial.printf("Button has been pressed %dx (2)\r\n", button_down_count);
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) Serial.printf("Button has been pressed %dx (2)\r\n", button_down_count);
#endif
if (digitalRead(BUTTON) == HIGH) {
#if defined(T_BEAM_V1_0) || defined(T_BEAM_V1_2)
if (shutdown_active && shutdown_countdown_timer_enable) {
@ -5660,27 +5710,26 @@ void loop()
} else
#endif
if (!(display_is_on && enabled_oled)) {
write2display();
enableOled_now(); // turn ON OLED now
button_down_count = 0;
} else {
enableOled(); // rewind oled_timer
freeze_display = true;
if (debug_verbose > 1) Serial.printf("Button Count (Oled on): %d\r\n", button_down_count);
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) Serial.printf("Button Count (Oled on): %d\r\n", button_down_count);
#endif
if (button_down_count == 1) {
write_last_heard_calls_with_distance_and_course_to_display();
if (debug_verbose > 1) Serial.printf("Action Button Count (Oled on): %d\r\n", button_down_count);
} else if (button_down_count == 2) {
if (debug_verbose > 1) Serial.printf("Button pressed check == %d, show buildnr %s\r\n", button_down_count, buildnr.c_str());
writedisplaytext("((BN))","","BuildNr:" + buildnr,"by DL9SAU & DL3EL","","");
} else if (button_down_count < 6) {
int n = button_down_count-3;
if (debug_verbose > 1) Serial.printf("Button pressed check == %d, show raw rx_Packet %s\r\n", button_down_count, RX_RAW_PACKET_LIST[n].c_str());
writedisplaytext(n == 0 ? "RX raw" : "RX raw-" + String(n+1),n == 2 ? "next press: tx bcn" : "",RX_RAW_PACKET_LIST[n],"","","");
time_to_refresh = millis() + showRXTime;
} else if (button_down_count == 6) {
button_down_count = 0;
if (lora_tx_enabled || aprsis_enabled) {
if (debug_verbose > 1) Serial.printf("sending position (%d)\r\n", button_down_count);
freeze_display = false;
fillDisplayLines3to5(1);
if (gps_state && gps_isValid) {
@ -5704,22 +5753,30 @@ void loop()
next_fixed_beacon = millis() + fix_beacon_interval;
}
} else {
if (debug_verbose > 1) Serial.printf("Button pressed check >= 6: %d, shouldn't come here\r\n", button_down_count);
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) Serial.printf("Button pressed check >= 6: %d, shouldn't come here\r\n", button_down_count);
#endif
button_down_count = 0;
}
key_up = true;
}
if (debug_verbose > 1) Serial.printf("Button still down %dx \r\n", button_down_count);
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) Serial.printf("Button still down %dx \r\n", button_down_count);
#endif
} else {
if (debug_verbose > 1) Serial.printf("Button now up %dx \r\n", button_down_count);
#ifdef DEVELOPMENT_DEBUG
if (debug_verbose > 1) Serial.printf("Button now up %dx \r\n", button_down_count);
#endif
}
} else {
if (button_down_count > 0) {
if (debug_verbose > 1) Serial.printf("Button press was lost...(%d)\r\n", button_down_count);
}
#ifdef DEVELOPMENT_DEBUG
if (button_down_count > 0) {
Serial.printf("Button press was lost...(%d)\r\n", button_down_count);
}
#endif
}
}
// Time to adjust time?
int8_t t_hour_adjust_next = -1;
if (gps_state && gps.time.isValid() && gps.time.isUpdated() &&
@ -6780,12 +6837,15 @@ if (nextTX > 1 && tmp_t_since_last_sb_tx > (sb_turn_time*1000L) && average_speed
if (!fixed_beacon_enabled && !dont_send_own_position_packets && (lora_tx_enabled || aprsis_enabled) && (lastPositionTX+nextTX) < millis() && (nextTX <= 1 || (tmp_t_since_last_sb_tx >= (6000000L / lora_speed) ))) {
if (gps_isValid) {
//enableOled(); // enable OLED
enableOled_now(); // enable OLED
//writedisplaytext(" ((TX))","","LAT: "+LatShownP,"LON: "+LongShownP,"SPD: "+String(gps.speed.kmph(),1)+" CRS: "+String(gps.course.deg(),1),getSatAndBatInfo());
fillDisplayLine1(3);
fillDisplayLine2();
fillDisplayLines3to5(0);
writedisplaytext(" ((TX))","",OledLine2,OledLine3,OledLine4,OledLine5);
// we need to send, display it and cancel skip through pages
if (!freeze_display) {
enableOled_now(); // enable OLED
//writedisplaytext(" ((TX))","","LAT: "+LatShownP,"LON: "+LongShownP,"SPD: "+String(gps.speed.kmph(),1)+" CRS: "+String(gps.course.deg(),1),getSatAndBatInfo());
fillDisplayLine1(3);
fillDisplayLine2();
fillDisplayLines3to5(0);
writedisplaytext(" ((TX))","",OledLine2,OledLine3,OledLine4,OledLine5);
}
sendpacket(SP_POS_GPS | (nextTX == 1 ? SP_ENFORCE_COURSE : 0));
// for fixed beacon (if we loose gps fix, we'll send our last position in fix_beacon_interval)
// We just transmitted. We transmitted due to turn (nextTX == 1)? Also Don't TX again in next round, sendpacket() adjustet nextTX
@ -6799,21 +6859,21 @@ if (nextTX > 1 && tmp_t_since_last_sb_tx > (sb_turn_time*1000L) && average_speed
behind_position_tx:
if (!display_was_updated) {
if (millis() > time_to_refresh){
if (gps_isValid) {
OledHdr = Tcall;
if (debug_verbose > 1)
Serial.printf("Main Loop (behind_position_tx), Display GPS, freeze_display: %d\r\n", freeze_display);
fillDisplayLine1(4);
fillDisplayLine2();
fillDisplayLines3to5(0);
writedisplaytext(OledHdr,OledLine1,OledLine2,OledLine3,OledLine4,OledLine5);
if (!freeze_display) {
if (millis() > time_to_refresh){
if (gps_isValid) {
OledHdr = Tcall;
fillDisplayLine1(4);
fillDisplayLine2();
fillDisplayLines3to5(0);
writedisplaytext(OledHdr,OledLine1,OledLine2,OledLine3,OledLine4,OledLine5);
} else {
displayInvalidGPS();
}
} else {
displayInvalidGPS();
}
} else {
// refresh time
fillDisplayLine1(5);
}
}
}

Wyświetl plik

@ -68,6 +68,9 @@ extern String to_aprsis_data;
extern boolean aprsis_enabled;
extern String aprsis_host;
extern uint16_t aprsis_port;
extern String aprsis_own_filters_in;
extern boolean aprsis_own_filter_in_is_whitelist;
extern String aprsis_own_filters_words_in;
extern String aprsis_filter;
extern String aprsis_callsign;
extern String aprsis_password;
@ -547,6 +550,8 @@ void refill_preferences_as_jsonData()
s = s + "\n " + jsonLineFromPreferenceString(PREF_APRSIS_SERVER_NAME);
s = s + "\n " + jsonLineFromPreferenceInt(PREF_APRSIS_SERVER_PORT);
s = s + "\n " + jsonLineFromPreferenceString(PREF_APRSIS_FILTER);
s = s + "\n " + jsonLineFromPreferenceString(PREF_APRSIS_FILTER_LOCAL_INCOMING);
s = s + "\n " + jsonLineFromPreferenceString(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING);
s = s + "\n " + jsonLineFromPreferenceString(PREF_APRSIS_CALLSIGN);
s = s + "\n " + jsonLineFromPreferenceString(PREF_APRSIS_PASSWORD);
s = s + "\n " + jsonLineFromPreferenceInt(PREF_APRSIS_ALLOW_INET_TO_RF);
@ -1203,6 +1208,17 @@ void handle_SaveAPRSCfg() {
s.trim();
preferences.putString(PREF_APRSIS_FILTER, s);
}
if (server.hasArg(PREF_APRSIS_FILTER_LOCAL_INCOMING)){
String s = server.arg(PREF_APRSIS_FILTER_LOCAL_INCOMING);
s.trim();
s.replace(" ", "");
preferences.putString(PREF_APRSIS_FILTER_LOCAL_INCOMING, s);
}
if (server.hasArg(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING)){
String s = server.arg(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING);
s.trim();
preferences.putString(PREF_APRSIS_FILTER_LOCAL_WORDS_INCOMING, s);
}
if (server.hasArg(PREF_APRSIS_CALLSIGN)){
String s = server.arg(PREF_APRSIS_CALLSIGN);
s.toUpperCase(); s.trim();
@ -1762,6 +1778,79 @@ String generate_third_party_packet(String callsign, String packet_in) {
return packet_out;
}
char aprsis_own_filter_check(const char *data) {
char *q;
int len;
char call[10];
switch (data[0]) {
case '!':
case '=':
len = strlen(data);
if ((len > 12 && data[12] == '_') || (len > 19 && data[19] == '_'))
return 'w';
return 'p';
case '/':
case '@':
len = strlen(data);
if ((len > 18 && data[18] == '_') || (len > 26 && data[26] == '_'))
return 'w';
return 'p';
case '[':
case '$': case '\'':
case '`':
return 'p';
case ';':
len = strlen(data);
if ((len > 29 && data[29] == '_') || (len > 36 && data[36] == '_') ||
(len > 20 && data[20] == '_') || (len > 28 && data[27] == '_'))
return 'w';
return 'o';
case ')':
return 'i';
case '#':
case '*':
case '_':
return 'w';
case 'T':
return 't';
case ':':
if (strlen(data) < 11 || data[10] != ':')
return '~';
strncpy(call, data+1, 9);
call[9] = 0;
if ((q = strchr(call, ' ')))
*q = 0;
if (!strncmp(call, "BLN", 3))
return 'b';
else if (!strncmp(call, "NWS-", 4))
return 'n';
else if (is_call_blacklisted(call))
return '~';
else if (data[11] == '?')
return 'q';
else if (!strncmp(data + 11, "PARM.", 5) || !strncmp(data + 11, "UNIT.", 5) || !strncmp(data + 11, "EQNS.", 5) ||!strncmp(data + 11, "BITS.", 5))
return 't';
return 'm';
case '?':
case '<':
return 'q';
case '>':
return 's';
case '}':
if ((q = strchr(data+1, ':')) && q > strchr(data+1, '>'))
return aprsis_own_filter_check(q + 1);
return '~';
case '{':
case ',':
return 'u';
case '%':
return 'p';
}
return '~';
}
// read packets from APRSIS
void read_from_aprsis(void) {
@ -1948,6 +2037,44 @@ void read_from_aprsis(void) {
if (is_call_blacklisted(s.c_str()))
return;
if (!header_end[1])
return;
if (!aprsis_own_filters_in.isEmpty()) {
char aprs_data_type = aprsis_own_filter_check(header_end+1);
// Sometheing really negative, like a blacklisted call writing a message
if (aprs_data_type == '~')
return;
if (aprsis_own_filter_in_is_whitelist) {
if (aprsis_own_filters_in.indexOf(aprs_data_type) == -1) {
// Data type is not whitelisted
return;
// else: // Found in whitelist, may pass
}
} else {
if (aprsis_own_filters_in.indexOf(aprs_data_type) != -1) {
// Data type is blacklisted
return;
} // else: Not found in blacklist, may pass
}
}
if (!aprsis_own_filters_words_in.isEmpty()) {
char *p = strdup(aprsis_own_filters_words_in.c_str());
char *q = strtok(p, " ");
while(q) {
if (s.indexOf(q) > -1) {
free(p);
return;
}
q = strtok(NULL, " ");
}
if (p)
free(p);
}
String answer_message = handle_aprs_messsage_addressed_to_us(s.c_str());
boolean its_an_aprs_message_for_us = !answer_message.isEmpty();
if (answer_message == "M") {

Wyświetl plik

@ -22,9 +22,22 @@ try:
git_id = Popen('git rev-parse --short HEAD', stdout=PIPE, shell=True).stdout.read().strip().decode('ascii')
version_full = "%s-%s" % (version_full, git_id)
except:
#git_id = "0000000"
git_id = "No_GIT.."
pass
version_string = "{} - {}".format(version_full, datetime.datetime.now())
date_now = "%.16s" % datetime.datetime.now()
version_string = "{} - {}".format(version_full, date_now)
# dl9sau: build_no in base62 -> base62 (0-9, a-z, A-Z)
# This gives us room for (62**2)-1 = 3843 builds between git commits. Should be enough
# git_id: length of 5 has hopefully enough entropy.
# VERS_XXSHORT_BN may also be sent on RF -> We keep it short. 8 bytes now, instead of typically 3 bytes before.
s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
bnA=s[(int(build_no / len(s))) % len(s)]
bnB=s[build_no % len(s)]
vers_xxshort_bn="%.5s.%c%c" % (git_id, bnA, bnB)
hf = """
#ifndef BUILD_NUMBER
#define BUILD_NUMBER "{}"
@ -35,7 +48,10 @@ hf = """
#ifndef VERSION_SHORT
#define VERSION_SHORT "{}"
#endif
""".format(build_no, version_string, version_full)
#ifndef VERS_XXSHORT_BN
#define VERS_XXSHORT_BN "{}"
#endif
""".format(build_no, version_string, version_full, vers_xxshort_bn)
with open(FILENAME_VERSION_H, 'w+') as f:
f.write(hf)