Porównaj commity

...

57 Commity

Autor SHA1 Wiadomość Data
Thomas Osterried e4e82c9043 Code cleanup. Better heltec wireless teacker support. GPS poweroff cycles improved
- "shutdown" (esp32 deep sleep) for non-lilygo-T-Beam-V1.x devices
  Only T-Beam v1.x has an AXP chip capable to do a real poweroff.
  But esp32 is capable to do a deep sleep. On heltec wireless tracker
  the power consumption is only a few microwatts.

- work on the new gps cyclic-power-off-powersave-feature.
  Works perfect now.
  Reduces gps wake time on GPS fix loss to 63 %
    ((8.75*2+10)+6.25*3+5.41*3+5*3) / (((8.75*2+10)+6.25*3+5.41*3+5*3) + (8*3+1*3+2*3+4*3)) = 0.632
  And if you don't move, sleep:awak ratio is 4:5
  On new gps fix, we remember first initial fix, t_gps_got_first_fix_after_last_loss = millis()

- input power messures: smoothing jumps by calculating the average of
  five measurements.
  Added batt_read() to the timer_once_a_second() function.

- user button: now behaves correct on wireless tracker: if display
  is off, button press enables tft (adnd gps (because they are both
  controlled by the same pin, VEXT_CTRL))

- oled: some gps-state assurances. If gps sleeps, tft is off.
  -> a state display_is_on == true (which reflects the current situation,
  not the proposed) is wrong in this case.

- code cleanup:
  for tft for heltec wireless tracker we have now do_tft_init()
  do_poweroff_gps() and do_poweron_gps() functions
  do_shutdown() for the shutdown cases (this also cleans up taskWebserver.cpp)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-06-14 10:36:06 +02:00
Thomas Osterried 8fbaab750b Support for heltec wireless tracker. And many fixes.
Two weeks hard work.

- Webserver config:
  - Allow freq to be configured down to 430.1000.
    Set to at minimum 430.150 if you use bandwith 250 kHz!
  - Added hint for wifi tcp kiss android config

- platformio.ini:
  - less monolithic lib dependencies, because with
    heltec wireless tracker we have another radiolib and
    a TFT instead of OLED, no AXP chip, etc.
 - heltec section: need to have the many defineshere (two hand full
   are needed for TFT)

- heltec wireless tracker:
  - long press (if WiFi off) sets the tracker to deep sleep (there's no
    real power-off due to the lack of an axp chip. But the current is
    very very low). See also notes at webserver config.
  - uses RadioLib SX126X
  - has no AXP chip, and the VEXT_CTRL pin only switches (both at the
    same time!), gps and tft.
    For power saving ("lora rx disabled" config setting), we can
    call radio.sleep(), and wake it up with radio.standby()
  - If you set gps to allow sleep, VEXT_CTRL turns also TFT. Be aware
    of it, it's not a bug but a hardware limitation.
    GPS sleep is for powersave. TFT off saves also power. That's what
    you should expect.
    On wakeup, tft is reinitialized.
  - Funny: If you do Serial.flush() and immediately call
      setCpuFrequencyMhz(adjust_cpuFreq_to),
    then USB chip is reset to a state before that what
    the esp32 driver inizializes. -> Serial.printf's don't work.
    This lead to
      Serial.print("CPU Freq ad"); Serial.flush();
      setCpuFrequencyMhz(adjust_cpuFreq_to);
      // ..survived
      Serial.printf("justed to: %d MHz\r\n", adjust_cpuFreq_to);
    -> "CPU Freq ad" - and finito.
    => removed the flush()
  - TODO: bluetooth LE support. Unfortunately, the chip lacks support
    for classic bluetooth serial.
    If you need to connect aprsdroid to the device, look at the
    wifi tcp server description.

- TTGO_T-Beam_LoRa_APRS.ino:
  - better platform dependend includes
  - I had a bad usb cable or switch with too less voltage which caused
    the ttgo to reboot
    -> Changes to minimum voltage for shutdown
       Disabled brownout detector (which was per default according  to esp32
       libs)
	WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
   Please check if this would be a problem of deep discharging your akku:
     #if defined(T_BEAM_V1_0) || defined(T_BEAM_V1_2)
     -    if (InpVolts > 4.3) {
     +    //if (InpVolts > 4.3) {  // No, my usb hub suddenly only made 4.1V
     +    if (InpVolts > 4.0) {
   I suppose no, because AXP does it's job at thosee devices
  - Needed to define BATTERY_PIN for every hardware
  - Renamed definition of LOW to TXLED_LOW
  - What is key_up, t_lock and time_delay? Wrong, it's for button control. ->
    Changed the names to button_key_up, button_t_lock and button_time_delay
  - LORA_MAX_MESSAGE_LEN is for SX127X (B_RF95 lib), because it
    includes the 4 bytes header. For the RadioLib buffer we need to
    reserver more space.
  - quite nice hack for reusing the display.xxx() routines for tft
    (class Emulated_SSD1306 which provides the needed functions)
  - New OLED_LINE_LEN_MAX instead of hardcoded value 21, because
    heltec TFT has in the normal font a width of 25.
  - RadioLib calls interrupt drivven signal_new_packet_received after a packet
    was receeived.
  - RadioLib special: Added definition for lora speeds / coding rate,
    like they have been addigned in the BG_RF95 lib
  - Pseudo-Sema-Locks: does not work 100%. Avoided endless loop by
    adding ESP.restart after 5min
    Also a delay of 1s in LoraSend() to mitigate lock problems when
    digipeating to the second of the both frequencies.
  - BG_RF95 sometimes causes crashes, esp. in waitPacketSent().
    Introduced a delay. 100ms between sendAprs() and waitPacketSend()
    Changed calls to rf95.waitAvailableTimeout() to rf95.available()
    for stability reasons.
  - richonguzman has a good docu for power readings for non-AXP-chips.
    I use it for the heltec wireles tracker We may think about
    using it on T_BEAM_V0_7 and the rest. Problem: intensive testing
    needed, and the old T_BEAM_V0_7 devices became rare.
  - timer_once_a_second():
      This is ok:
        if (!freeze_display)
          fillDisplayLine1(0); //update time & uptime
      But the following operations destroyed line3to5 for a displayed
      "((RX))" packet. -> Commented it out. No side effects observed-.
  - write2display():
    now uses caching (calls write2display_cached()).
    Reason: TFT flickers when updates happen too often.
    On the other hand, caching on OLED is not possible because calling
    display.clearDisplay() is mandatory, else you get a pixel puzzle
    with old and new characters at each position.
    TFT has no display.display() and also nothing like clearLine.
    -> IF we write a line, we have to add (when using the normal font)
    blanks at the end of the text (up to position 25)-.
    Also, instead of OLED, TFT cannot brak long lins to the next;
    that's why we need to break the line ourself. The "next" lines
    we use in this case must not be cached.
  - fillDisplayLine1: Word "Up:" was behind the uptime value
    (caused by one of the commits of the last weeks). Fixed.
  - If own callsign is still N0CALL, disable lora_tx and set txPower to 0.
  - If during setup init lora chip or display fails, do not for(;;); , but
    sleep 5min and do ESP.restart(). Else you cannot land on the moon ;)
    TODO: check for correct initialization of SX126X chip
  - Removed tuplicate "Time used since start"-message
  - start of taskGPS moved to setup_phase2 section
  - If you double-click (or better "dit daah") the user button, manual
    beacon is triggered (like the behaviour at the end of the section).
    Needed by someone driving a car and cannot look at the display menu
    page number.
  - long press (if WiFi off) sets the heltec wireeless trackeer to deep sleep
    (nearly off - see description above). If wifi is off, press
    two times (first long-press starts webserver; second one does the
    shutdown).
    If tracker is not compiled with WIFI, long-press does a shutdown
    on heltec and a a reboot on other devices. TODO (and TEST!): check if other
    non-AXP-chip esp32 devices would instead also profit from a deep sleep
  - Tests before radio.readData() on SX126X devices are easier
    (no locking; no call comparing to rf95.available()), because
    flag_lora_packet_available is set.
    Changed general variable name packet_available to flag_lora_packet_available.
  - In part "((TX))", enforce a display update:
      fillDisplayLines3to5(1);
    Reason: tracker had his first gps fix and transmits - but the OLED
    showed the old position during TX; the sent packet hat the correct
    current position.

- taskGPS:
  - support for heltec wireless tracker (Pin assignment and correct bitrate)
  - fix:
      -              Serial.println(gpsDataBuffer);
      +              Serial.print(gpsDataBuffer);
- taskTNC:
      -        if (serial_bt_client_is_connected) {
      +        if (enable_bluetooth && serial_bt_client_is_connected) {

- taskWebServer.cpp:
    deadlock protection, as in TTGO_T-Beam_LoRa_APRS.ino

- data_embed: style.css and js.js had many blanks and comments which needed
  a quite large amount of disk space.
  A new script ../tools/remove_comment_from_code.py  (which also can be used
  as a library) removes them, but leaves copyright comments intact. Feel free
  to use it in other projects.

In summuary, many changes
$ git diff|wc -l
    2470

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-05-27 09:29:21 +02:00
Thomas Osterried f88fe7b8cf Smaller fixes
- gps:
  - gps info on lcd: in sleep mode, "S:zzz" is now shown,
    instead of "S:sats/hdop"
    Lie with "GPS:" will show now fix or GPS age as usuual

- own beacon:
  If lora TX is off and no aprsis connection, we sent no beacon.
  This was a regression; at one digipeater qth there was a setup
  where an aprs digi software attached to kiss. The beacon
  via kiss is required.
  ->
  -  if (manBeacon && (lora_tx_enabled || aprsis_enabled)) {
  +  if (manBeacon && (lora_tx_enabled || aprsis_enabled || usb_serial_data_type == 0 || usb_serial_data_type & 2)) {

- Boot messages: if no AP is configured (-> empty SSID), message was
  Preferences AP  found with PW  in wifi.cfg and not stored again.
  -> Made it nicer

- More tests on poersaving mode.
  - With the bad GPS antenna of the T-Beam v1.2, it takes > 5 min to
    get a fix after repowering the chip.
  - The algorith of my last commit had too short awake times.
    I also test powering off the chip if I don't move. Still testing, it
    may not be perfect.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-05-13 11:41:36 +02:00
Thomas Osterried d25692b209 Fixes and improvements: preamble, gps powersaving mode, LH, ..
- web:
  - preamble: A bit more detailed description, with suggestion to try
    value 12 (default is 8)
    Assurance in taskWebserver that value is >= 8.
  - sb_angle: min is 5 but text said Range 0 to 360.
  - GPS: new "GPS powersaving mode".
    Still testing. "Made GPS may sleep when running on battery" default.

- GPS powersaving mode:
  If you have problems, set it to "Ignore this feature".
  While looking at the power consumption, GPS has a quite high power
  consumption.
  If we have no fix for 10min, we go to sleep mode. Interval
  Sleep  1min, 2min, 4min, 8min, 1min, 2min, ..
  Awake  120, next: 60s, next: 40, next: 30s
  After 4 rounds, we run GPS 10min again (better chance to refresh the
  almanach).
  During sleep, taskGPS is suspended and gps chip is powered off.
  -> This algorithm saves reduces the power consumption of the GPS chip to
     ~30%.
  If it behaves good, more fine-tuning can be done (i.E. switching it earlier
  off if you don't move. Reduce the initial fix-loss-time of 10min, ..)
  LCD shows "GPS: sleep" when GPS is in power saving mode. If it awakes
  and has no fix, it shows (as usual) GPS: age nnn".

- preamble changes:
  - TX setting:
    Now only affects main qrg. Perhaps it's wiser to be able to set it
    in more detail: Main, Secondary, Both. Or with different values
    for the different frequencies.
  - RX setting:
    moved to loraSend(), where default rx values are reset after TX

- LCD:
  - "GPS: sleep" as described above
  - Tried to improve the readibility of the LastHeard lines. Need to verify

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-04-24 13:36:39 +02:00
Thomas Osterried 769896ae3f
Merge pull request #12 from piotr022/master
Preamble length settings, added ability to rx packets with longer preambles

Signed-off-by: Thomas Osterried dl9sau@darc.de
2024-04-23 14:56:29 +02:00
Thomas Osterried 591662cb64 Web page: improvement to prevent the need of scrolling horizontally
Thanks to Tomasz SP2ATJ

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-04-22 16:43:49 +02:00
Piotr Lewandowski 3c645ca232 added preamble conf placeholder with def val, changed def to 8 symbols 2024-04-21 13:25:52 +02:00
Piotr Lewandowski bfa18ff5eb updated-description 2024-04-20 14:17:51 +02:00
Piotr Lewandowski 307aeb0c80 preambleLen added in preferences.cfg 2024-04-20 14:13:32 +02:00
Piotr Lewandowski 88c7994e47 tx preamle len settings, extended rx timeout 2024-04-20 13:15:02 +02:00
Thomas Osterried 7dc1c3c728 Minor changes
- New Message indicator:
  - "private message" is now "m"
  - "winlink" is now "w"
  - Both: "M"
  - M / m is now cleared if you read your message on display (see below)

- message ((MSG)):
  - changed date notation to mm-dd
  - fixed small bug in displaying the time
  - If you enter this menu item, new message-indicaor is cleared

- middle button: if webserver is started
  - changed info text for display to make it more clear, that you now
    should release the button (to avoid factory reset on boot)
  - changed time to tread this from 2s to 3s

- tnc:
  - fixed a bug when starting webserver via tnc cli
  - beauty: added blank for displaying debug level

- display: in behind_position_tx, fillDisplayLine1(5) is not needed;
  we test this and commented it out.

Signed-off-by: DL3EL <dl3el@darc.de>
Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-04-03 08:25:45 +02:00
Thomas Osterried a8cf5ce0a1 Improved local aprsis-filter
1. The local aprsis-filter is for gating.
   aprs-text-messages addressed to our tracker call should always pass (and go
   to kiss-TNCs and usb-trace -- but not on RF of course)
2. Documentation in web: make clearer what a positive and negative filter is

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-26 23:45:07 +01:00
Thomas Osterried f5d114b400 MSG feature for display.
Thomas dl3el wrote this feature for displaying the the last personal aprs-messages.
    Thomas dl9sau modified: don't overwrite a personal aprs-message with winlink notification.
                            Display shows "m" for personal message. "W" for winlink info. "M" for both.
    Message is cleared when you cycled through the display up to the ((BN)) screen.

    Thomas dl3el's commit messages:
    - include LastMessage in flip pages
      indicate message unread with an "m" between time & uptime
      flag is cleared when all pages have been flipped through and the manual beacon has been sent

    - move display of buildnr to the last butone flip page. Gives us more space for the message "next button will tx beacon"

Signed-off-by: DL3EL <dl3el@darc.de>
Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-21 15:00:54 +01:00
Thomas Osterried 19136a6405 MSG feature for display.
Thomas dl3el wrote this feature for displaying the the last personal aprs-messages.
    Thomas dl9sau modified: don't overwrite a personal aprs-message with winlink notification.
                            Display shows "m" for personal message. "W" for winlink info. "M" for both.
    Message is cleared when you cycled through the display up to the ((BN)) screen.

    Thomas dl3el's commit messages:
    - include LastMessage in flip pages
      indicate message unread with an "m" between time & uptime
      flag is cleared when all pages have been flipped through and the manual beacon has been sent

    - move display of buildnr to the last butone flip page. Gives us more space for the message "next button will tx beacon"

Signed-off-by: DL3EL <dl3el@darc.de>
Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-21 14:40:08 +01:00
Thomas Osterried 64d397835e MSG feature for display.
Thomas dl3el wrote this feature for displaying the the last personal aprs-messages.
  Thomas dl9sau modified: don't overwrite a personal aprs-message with winlink notification.
                          Display shows "m" for personal message. "W" for winlink info. "M" for both.
  Message is cleared when you cycled through the display up to the ((BN)) screen.

  Thomas dl3el's commit messages:
  - include LastMessage in flip pages
    indicate message unread with an "m" between time & uptime
    flag is cleared when all pages have been flipped through and the manual beacon has been sent

  - move display of buildnr to the last butone flip page. Gives us more space for the message "next button will tx beacon"

Signed-off-by: DL3EL <dl3el@darc.de>

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-21 14:37:19 +01:00
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
Thomas Osterried 7aa902c4e4 Info: comple flags
TNC now has a "version" command, showing VERSION and compile_flags.
Webserver had a VERSION info and now additionaly shows compile_flags.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-03-11 07:24:22 +01:00
Thomas Osterried 5e67590004
Merge pull request #11 from DL3EL/master
New enhanced Display
2024-03-11 06:52:12 +01:00
DL3EL 0042ca48b7 New enhanced display
If OLED is ON: flip through the available pages
1. press: show lastheard list (Call, time, distance, direction)
2. press: show current build number
3. - 5. press: show last 3 received packets (raw)
6. press: with GPS-FIX immediate send a beacon with the position from the GPS
6. press: without GPS-FIX, immediate send a beacon with the position saved in the configuration

changed behaviour when external power is switched off and and autopower off is selected:
- any keypress or new plugin of external power within auto power off delay will abort the process and return to normal op
- for the time "auto power off delay", the display will show the power off message plus the remaining time und shutdown

Signed-off-by: DL3EL <dl3el@darc.de>
2024-03-10 18:46:39 +01:00
DL3EL 9f6e6d9ee4 New enhanced display
If OLED is ON: flip through the available pages
1. press: show lastheard list (Call, time, distance, direction)
2. press: show current build number
3. - 5. press: show last 3 received packets (raw)
6. press: with GPS-FIX immediate send a beacon with the position from the GPS
6. press: without GPS-FIX, immediate send a beacon with the position saved in the configuration

changed behaviour when external power is switched off and and autopower off is selected:
- any keypress or new plugin of external power within auto power off delay will abort the process and return to normal op
- fo

Signed-off-by: DL3EL <dl3el@darc.de>
2024-03-10 16:16:14 +01:00
DL3EL a121c6b8c7 Merge branch 'master' of https://github.com/DL3EL/TTGO-T-Beam-LoRa-APRS
Signed-off-by: DL3EL <dl3el@darc.de>
2024-03-10 13:46:15 +01:00
DL3EL 55018abf7b bug fixes
Signed-off-by: DL3EL <dl3el@darc.de>
2024-03-09 00:06:26 +01:00
DL3EL 4746266cce Bug fixes, make programm smaller
Signed-off-by: DL3EL <dl3el@darc.de>
2024-03-08 00:21:19 +01:00
DL3EL 46f37ba4d0 Bugfixes
NEW: Lastheard List (see info on webpage)

Signed-off-by: DL3EL <dl3el@darc.de>
2024-03-06 10:34:00 +01:00
Thomas Osterried 9b66a4cc07 New important fix. And: Many new features. bug fixes and improvements
Last commit from today lead to a stack smash (buffer overflow) in is_call_valid().
Found the bug -> fixed with this commit.

is_call_blacklisted() and the new handle_aprs_messsage_addressed_to_us() function
may be called concurrently in the main program thread and in the taskWebServer-thread.
I'm not really sure if buffer operation on the local variable is thread safe; that's
why I added sema locking for both. Needed? Not? I'd be glad to remove it ;)

handle_aprs_messsage_addressed_to_us() returns a String. I'm also not sure what
happens on concurrency -> I now return a copy of the String: String(answer_message).

The changelog of the last commit of today:
==========================================

New features
------------

- personal text messages addressed to the tracker
  - are now recognized and stay local -> will not be digipeated or sent to aprsis
     see handle_aprs_messsage_addressed_to_us(), used in the main program (for
     rf-received packets) and in taskWebServer for packets received from aprs-is
     It also displays the message
        +      writedisplaytext(" ((MSG))","",String(msg_from) + String(": ") + String(header_normal_or_third_party_end + 11+1),"","","");
     for 30s:
        +      display_dont_update_until = millis() + 30000L;
     We display the msg in favour of the RX packet.
  - we send an ACK when a message-ID is present
  - This is also useful for the winlink feature described below

- Winlink feature
  - if enabled, your device will add the word @winlink to the position beacon text
    every hour (Refresh interval at winlink is two hours).
    You can choose if it is sent always, or only if a bluetooth device (i.e. aprsdroid)
    is connected.
    Winlink documented that you could send a "status packet" instead. This would be
    really nice and I implemented it - but they ignore it. -> I've commented
    it our (for not loosing it), and switched to the position comment approach.
  - If we get a notification, a "W" is in the display as indicator that new messages
    are waiting for you.
    The W is displayed for 24h. Because winlink only informs every 24 hours, and the
    tracker does not know if you read the message at the winlink system

- Powerdown:
  - If you disconnect external power (USB) from the TTGO device, it can shutdown if
    you configured the shutdown delay. This is useful when operating in the car and
    you park. Someone configured a shutdown delay of 1h. -> Shutdown info is displayed
    a few seconds (you can interrupt the shutdown by pressing the middle button), and
    info is displayed again a few seconds right before the actual shutdown (also with
    the option do interrupt the shutdown by pressing the middle button).
  - On shutdown, a message QRT status message could be sent automatically, if configured

- LoRa APRS digipeating: you can configure now an alias reacting as digipeater
  (kenwood names it "UITRACE". We react only on this call if it's in the first
  position of the path and has no digipeated flag.

- Serial console tnc cli:
  - Show reboot and halt info also at the display if you issue the reboot or shutdown command
    And send a status packet if configured (see new status packet feature described above)

Bug fixes
---------
- Fix for AXP2101 on T-Beam V1.2:
  In setup() (setup_phase2_soft_reconfiguration()), we needed to add
    +        axp.setButtonBatteryChargeVoltage(3300);                             // enable charge of the gps battery
    +        axp.enableButtonBatteryCharge();
  else the button battery (which is a capacitor) never became loaded. This lead
  to a time of 10 min to get a GPS fix after powering on (because it needed to wait
  for the almanach)
- Fix and improve of smartbeaconing computation. Sometimes the timer went too fast down,
  sometimes it went up to max again -> we mostly relied on the course-change event.
  You will really notice the improvement.
- Wrong info if lora TX is enabled and current state of dont_send_own_position_packets
  is true. Display showed "LoRa-TX; dis", but only the active sending of the
  beacon is stopped:
    -  if (dont_send_own_position_packets || !(lora_tx_enabled || aprsis_enabled)) {
    +  if (dont_send_own_position_packets) {
    +    OledLine2 = wifi_info + " Own Bcn: dis";
    +  } else if (!(lora_tx_enabled || aprsis_enabled)) {
         OledLine2 = wifi_info + " LoRa-TX: dis";
- Beautifying the lines in the display output (indents for different speed units,
  missing blank if no "p" or "P", etc.
  I had developed that with the device with-display-and-no-GPS and saw the indent
  errors at the moment I used my new-device-with-display-and-GPS
- During debugging, I was not able to send a packet with digipeated flag via serial
  console converse mode: typo (q instead of p check):
    -          if (! (*p == '-' || *p == '>' || *p == ',' || *q == '*' || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9')))
    +          if (! (*p == '-' || *p == '>' || *p == ',' || *p == '*' || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9')))
  ;))
- Moved update_speed_from_gps() higher, before gps.speed() calls, because update_speed_from_gps()
  implicitly changes the gps.speed.isUpdated() value during his calls. This lead to unexpected fewer conditions of speed updates
- Improved gps location / speed / ... handling:
  Work on bestHdop section. You know, gps jumps at low speeds, and it's hard to find a good value
  between needed updates and wrong-positives. I left old values commented-out in the code. In my test, it now behaves much better.
  If situation is "p" (had a fix, but lost it), not only set aprsPresetShown "p" but also call displayInvalidGPS();
  If situation is " ": we had no gps fix, but we now have a fix:
           // No GPS signal for a long time? Enforce tx:
    +      if ((millis() - lastPositionTX) > ((sb_max_interval - sb_min_interval) / 2))
    +        nextTX = sb_min_interval;
  Sounds good?
- removed time_to_refresh = millis() + showRXTime from handle_usb_serial_input(), KISSTX, TX-Xdigi, ..
  because this value is only intended for the time of displaying ((RX)-packets and must not be
  overloaded by other stuff. See also new variable display_dont_update_until.
- taskWebServer send_queue_to_aprsis():
  While \r is a valid char in an aprs message text (for separating lines), it must not be
    sent to aprs-is, because they interpret \r, \n, \r\n as EOL. That means, the rest of the
    line will be interpreted and may lead to a disconnect due to garbled input.
    -> +  data.replace("\r", " "); data.replace("\n", " "); data.replace("\0", " ");
- is_call_blacklisted(): moved strcat after length check:
    -      // our ssid filter construct: -0 means search for call with ssid 0 zero.
    -      if (!(r = strchr(buf, '-')))
    -        strcat(buf, "-0");
           // after modifications above, is len(buf) still < 10 (space for ',' and \0)?
           if (strlen(buf) > 10)
             return 0;
    +      // our ssid filter construct: -0 means search for call with ssid 0 zero.
    +      if (!(r = strchr(buf, '-')))
    +        strcat(buf, "-0");
- Fixed: average_speed array: last field was always zero (%4 instead of %5)
    -  average_speed[point_avg_speed] = (((curr_hdop < 1.5 && curr_sats >= 3 && curr_kmph <= 16.0) || (curr_hdop < 4.0 && curr_sats >= 3 && curr_kmph > 16.0)) ? curr_kmph : average_speed[(point_avg_speed-1) % 4]);   // calculate smart beaconing. Even a not-updated old speed is ok here.
    +  average_speed[point_avg_speed] = ((curr_kmph < 1.8 || (curr_hdop < 1.5 && curr_sats >= 3 && curr_kmph <= 16.0) || (curr_hdop < 4.0 && curr_sats >= 3 && curr_kmph > 16.0)) ? curr_kmph : average_speed[(point_avg_speed-1) % 5]);   // calculate smart beaconing. Even a not-updated old speed is ok here.

average_speed_final = (average_speed[0]+average_speed[1]+average_speed[2]+average_speed[3]+average_speed[4])/5;

Other changes
-------------

- Instead of
    if (enable_bluetooth && SerialBT.hasClient()){
  we now have
    if (serial_bt_client_is_connected){
  in TTGO_T-Beam_LoRa_APRS.ino, taskWebServer.cpp and taskTNC.cpp
  and the current state is checked in the main loop.
  This way we also learn if a new serial_bt_client is connected
- Oled: new display_dont_update_until prevents display changes -> important messages
  are not interrupted
- Better space handling for beacon text additions like "@winlink" "Batt=", "P=", " !W..!"
- nextTX and next_fixed_beacon adjustments moved now in sendpacket(), because
  they need to be adjusted (and only then) after calling this function:
    +  lastPositionTX = millis();
    +  // reset timer for automatic fixed beacon after manual beacon
    +  next_fixed_beacon = millis() + fix_beacon_interval;
    +  nextTX = sb_max_interval;
- enableOled_now() enforces Oled to be on (without waiting for the next loop in main loop).
  display_dont_update_until is set to the needed values
- variable name lastTX changed to lastPositionTX because this variable is only needed
  in the context of the last position transmission. -> the name lastTX was misleading.
- is_call_blacklisted():
  whitelist call "WLNK", because it has to be valid for winlink communication
- at various places in the code:
  moved display routines like writedisplaytext("((KISSTX))","",inputBuf,"","",""); to the
  place before loraSend -> more time for the user to read the message
- Middle button code:
    - fillDisplayLines3to5(0) added to MAN TX / FIX TX part
    - handle the power-off-timer condition (-> timeslots for being able to abort the poweroff)
- variables t_last_smart_beacon_sent and lastPositionTX had the same meaning.
  -> Abandoned t_last_smart_beacon_sent.
- New tmp_t_since_last_sb_tx in the loop: avoid unnecessary recomputations of
  millis() - lastPositionTX at various places afterwards in the loop.
- taskWebserver:
  - On shutdown or reboot, send statusPacket if configured.
    And set a delay for do_send_status_message_about_shutdown_to_aprsis()
  - code beautify in handle_SaveAPRSCfg() and read_from_aprsis() (here: changed
    log message read_from_aprs to the more correct read_from_aprsis).
  - aprs-message ack-handling (described above)
  - renamed send_to_aprsis() to send_queue_to_aprsis(), because we have in  TTGO_T-Beam_LoRa_APRS.ino
    the same function (which only fills the queue, which is handled by send_queue_to_aprsis() in
    taskWebServer.cpp).
  - More comprehensible:
      -                        <label for="aprs_llfgps">Use lat/lon of current GPS position</label>
      +                        <label for="aprs_llfgps">Instead, store current GPS position</label>

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-02-24 21:34:10 +01:00
Thomas Osterried 08997f5720 Many new features. bug fixes and improvements
New features
------------

- personal text messages addressed to the tracker
  - are now recognized and stay local -> will not be digipeated or sent to aprsis
     see handle_aprs_messsage_addressed_to_us(), used in the main program (for
     rf-received packets) and in taskWebServer for packets received from aprs-is
     It also displays the message
        +      writedisplaytext(" ((MSG))","",String(msg_from) + String(": ") + String(header_normal_or_third_party_end + 11+1),"","","");
     for 30s:
        +      display_dont_update_until = millis() + 30000L;
     We display the msg in favour of the RX packet.
  - we send an ACK when a message-ID is present
  - This is also useful for the winlink feature described below

- Winlink feature
  - if enabled, your device will add the word @winlink to the position beacon text
    every hour (Refresh interval at winlink is two hours).
    You can choose if it is sent always, or only if a bluetooth device (i.e. aprsdroid)
    is connected.
    Winlink documented that you could send a "status packet" instead. This would be
    really nice and I implemented it - but they ignore it. -> I've commented
    it our (for not loosing it), and switched to the position comment approach.
  - If we get a notification, a "W" is in the display as indicator that new messages
    are waiting for you.
    The W is displayed for 24h. Because winlink only informs every 24 hours, and the
    tracker does not know if you read the message at the winlink system

- Powerdown:
  - If you disconnect external power (USB) from the TTGO device, it can shutdown if
    you configured the shutdown delay. This is useful when operating in the car and
    you park. Someone configured a shutdown delay of 1h. -> Shutdown info is displayed
    a few seconds (you can interrupt the shutdown by pressing the middle button), and
    info is displayed again a few seconds right before the actual shutdown (also with
    the option do interrupt the shutdown by pressing the middle button).
  - On shutdown, a message QRT status message could be sent automatically, if configured

- LoRa APRS digipeating: you can configure now an alias reacting as digipeater
  (kenwood names it "UITRACE". We react only on this call if it's in the first
  position of the path and has no digipeated flag.

- Serial console tnc cli:
  - Show reboot and halt info also at the display if you issue the reboot or shutdown command
    And send a status packet if configured (see new status packet feature described above)

Bug fixes
---------
- Fix for AXP2101 on T-Beam V1.2:
  In setup() (setup_phase2_soft_reconfiguration()), we needed to add
    +        axp.setButtonBatteryChargeVoltage(3300);                             // enable charge of the gps battery
    +        axp.enableButtonBatteryCharge();
  else the button battery (which is a capacitor) never became loaded. This lead
  to a time of 10 min to get a GPS fix after powering on (because it needed to wait
  for the almanach)
- Fix and improve of smartbeaconing computation. Sometimes the timer went too fast down,
  sometimes it went up to max again -> we mostly relied on the course-change event.
  You will really notice the improvement.
- Wrong info if lora TX is enabled and current state of dont_send_own_position_packets
  is true. Display showed "LoRa-TX; dis", but only the active sending of the
  beacon is stopped:
    -  if (dont_send_own_position_packets || !(lora_tx_enabled || aprsis_enabled)) {
    +  if (dont_send_own_position_packets) {
    +    OledLine2 = wifi_info + " Own Bcn: dis";
    +  } else if (!(lora_tx_enabled || aprsis_enabled)) {
         OledLine2 = wifi_info + " LoRa-TX: dis";
- Beautifying the lines in the display output (indents for different speed units,
  missing blank if no "p" or "P", etc.
  I had developed that with the device with-display-and-no-GPS and saw the indent
  errors at the moment I used my new-device-with-display-and-GPS
- During debugging, I was not able to send a packet with digipeated flag via serial
  console converse mode: typo (q instead of p check):
    -          if (! (*p == '-' || *p == '>' || *p == ',' || *q == '*' || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9')))
    +          if (! (*p == '-' || *p == '>' || *p == ',' || *p == '*' || (*p >= 'A' && *p <= 'Z') || (*p >= '0' && *p <= '9')))
  ;))
- Moved update_speed_from_gps() higher, before gps.speed() calls, because update_speed_from_gps()
  implicitly changes the gps.speed.isUpdated() value during his calls. This lead to unexpected fewer conditions of speed updates
- Improved gps location / speed / ... handling:
  Work on bestHdop section. You know, gps jumps at low speeds, and it's hard to find a good value
  between needed updates and wrong-positives. I left old values commented-out in the code. In my test, it now behaves much better.
  If situation is "p" (had a fix, but lost it), not only set aprsPresetShown "p" but also call displayInvalidGPS();
  If situation is " ": we had no gps fix, but we now have a fix:
           // No GPS signal for a long time? Enforce tx:
    +      if ((millis() - lastPositionTX) > ((sb_max_interval - sb_min_interval) / 2))
    +        nextTX = sb_min_interval;
  Sounds good?
- removed time_to_refresh = millis() + showRXTime from handle_usb_serial_input(), KISSTX, TX-Xdigi, ..
  because this value is only intended for the time of displaying ((RX)-packets and must not be
  overloaded by other stuff. See also new variable display_dont_update_until.
- taskWebServer send_queue_to_aprsis():
  While \r is a valid char in an aprs message text (for separating lines), it must not be
    sent to aprs-is, because they interpret \r, \n, \r\n as EOL. That means, the rest of the
    line will be interpreted and may lead to a disconnect due to garbled input.
    -> +  data.replace("\r", " "); data.replace("\n", " "); data.replace("\0", " ");
- is_call_blacklisted(): moved strcat after length check:
    -      // our ssid filter construct: -0 means search for call with ssid 0 zero.
    -      if (!(r = strchr(buf, '-')))
    -        strcat(buf, "-0");
           // after modifications above, is len(buf) still < 10 (space for ',' and \0)?
           if (strlen(buf) > 10)
             return 0;
    +      // our ssid filter construct: -0 means search for call with ssid 0 zero.
    +      if (!(r = strchr(buf, '-')))
    +        strcat(buf, "-0");
- Fixed: average_speed array: last field was always zero (%4 instead of %5)
    -  average_speed[point_avg_speed] = (((curr_hdop < 1.5 && curr_sats >= 3 && curr_kmph <= 16.0) || (curr_hdop < 4.0 && curr_sats >= 3 && curr_kmph > 16.0)) ? curr_kmph : average_speed[(point_avg_speed-1) % 4]);   // calculate smart beaconing. Even a not-updated old speed is ok here.
    +  average_speed[point_avg_speed] = ((curr_kmph < 1.8 || (curr_hdop < 1.5 && curr_sats >= 3 && curr_kmph <= 16.0) || (curr_hdop < 4.0 && curr_sats >= 3 && curr_kmph > 16.0)) ? curr_kmph : average_speed[(point_avg_speed-1) % 5]);   // calculate smart beaconing. Even a not-updated old speed is ok here.

average_speed_final = (average_speed[0]+average_speed[1]+average_speed[2]+average_speed[3]+average_speed[4])/5;

Other changes
-------------

- Instead of
    if (enable_bluetooth && SerialBT.hasClient()){
  we now have
    if (serial_bt_client_is_connected){
  in TTGO_T-Beam_LoRa_APRS.ino, taskWebServer.cpp and taskTNC.cpp
  and the current state is checked in the main loop.
  This way we also learn if a new serial_bt_client is connected
- Oled: new display_dont_update_until prevents display changes -> important messages
  are not interrupted
- Better space handling for beacon text additions like "@winlink" "Batt=", "P=", " !W..!"
- nextTX and next_fixed_beacon adjustments moved now in sendpacket(), because
  they need to be adjusted (and only then) after calling this function:
    +  lastPositionTX = millis();
    +  // reset timer for automatic fixed beacon after manual beacon
    +  next_fixed_beacon = millis() + fix_beacon_interval;
    +  nextTX = sb_max_interval;
- enableOled_now() enforces Oled to be on (without waiting for the next loop in main loop).
  display_dont_update_until is set to the needed values
- variable name lastTX changed to lastPositionTX because this variable is only needed
  in the context of the last position transmission. -> the name lastTX was misleading.
- is_call_blacklisted():
  whitelist call "WLNK", because it has to be valid for winlink communication
- at various places in the code:
  moved display routines like writedisplaytext("((KISSTX))","",inputBuf,"","",""); to the
  place before loraSend -> more time for the user to read the message
- Middle button code:
    - fillDisplayLines3to5(0) added to MAN TX / FIX TX part
    - handle the power-off-timer condition (-> timeslots for being able to abort the poweroff)
- variables t_last_smart_beacon_sent and lastPositionTX had the same meaning.
  -> Abandoned t_last_smart_beacon_sent.
- New tmp_t_since_last_sb_tx in the loop: avoid unnecessary recomputations of
  millis() - lastPositionTX at various places afterwards in the loop.
- taskWebserver:
  - On shutdown or reboot, send statusPacket if configured.
    And set a delay for do_send_status_message_about_shutdown_to_aprsis()
  - code beautify in handle_SaveAPRSCfg() and read_from_aprsis() (here: changed
    log message read_from_aprs to the more correct read_from_aprsis).
  - aprs-message ack-handling (described above)
  - renamed send_to_aprsis() to send_queue_to_aprsis(), because we have in  TTGO_T-Beam_LoRa_APRS.ino
    the same function (which only fills the queue, which is handled by send_queue_to_aprsis() in
    taskWebServer.cpp).
  - More comprehensible:
      -                        <label for="aprs_llfgps">Use lat/lon of current GPS position</label>
      +                        <label for="aprs_llfgps">Instead, store current GPS position</label>

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2024-02-24 12:29:10 +01:00
Thomas Osterried 5acc023193 minor changes
- a bit better temp averaging
- telemetry BITS (currently unused): added komma-separator

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-12-04 12:32:59 +01:00
Thomas Osterried 17c278c53b - fix regressipon in TTGO_T-Beam_LoRa_APRS.ino:
If lora_tx is disabled, own beacon was not sent to aprsis.
  This came from my commit https://github.com/dl9sau/TTGO-T-Beam-LoRa-APRS/commi
t/a00555f9cc8111e0caeff9db4a7f739c83c53d6e
  in Apr 2023.
  Reason: I disabled TX, saw "TX" on the LCD, and thought it would be
  wise to check this earlier and not call sendpacket(), because
  I thought sendpacket() will do nothing usefull. But I was wrong,
  send to aprsis is a usecase.

  Thanks to Erik OH2LAK who reported this.

- Web-Interface: fixed typo and a missing '/' in </option>

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-11-01 08:05:22 +01:00
Thomas Osterried 57c2d372c0 fixes, improvements and features
- fixes / improvements

  loraSend():
    - Since T_BEAM_V1_2 support, the
       #if defined (T_BEAM_V1_0) || defined(T_BEAM_V1_2) was wrong:
       #if (T_BEAM_V1_0) || defined(T_BEAM_V1_2)
       -> The loraChip sleep feature did not work with T_BEAM_V1_0 anymore.
          This feature powers lora-chip after transmission,
          if lora_rx is disabled AND lora_digipeating-mode is 0 AND
          no bluetooth client is connected.

  In receiption / for reception:
    bg_rf95rssi_to_rssi(): has now two arguments, the rssi of rf95.lastRssi()
      and bg_rf95snr_to_snr(rf95.lastSNR()).
    encode_snr_rssi_in_path() has now two arguments, the snr and the rssi
    from bg_rf95snr_to_snr() and bg_rf95rssi_to_rssi().
    On receiption, we store the snr and rssi right after receiving a packet,
    while still being in the sema-lock (which is released then right afterwards).
    -> This may lead to even exacter values, and it prevents access to a
    busy lora chip.
i
  After receiption, in the part for the switching-between-both-frequencies
  on rx, we now try to acquire a lock for the change of frequency
  and speed (because the lora chip may currently send).
  If we switch back from secondary to main frequency, clear packet cache
  (for not being interpreted to come from main frequency)

- taskWebserver:

  - fixed regression: 0d06bac161 (2023-08-21)
      featured a low IP RTT over WiFi. Unfortunately, a user reported
      a crash. Message of the driver:
       "E (27793) wifi:Error! Should enable WiFi modem sleep when both WiFi and
 Bluetooth are enabled!!!!!!"
       abort() was called at PC 0x40139607 on core 0
   This bugfix disables WiFi sleep (which is default) only if bluetooth
   is disabled by configuration option.

  - when gating aprs-is traffic to rf (third-party-traffic), then we now
    give the main taks to handle a received packet:
    rf95.waitAvailableTimeout() indicates this; then we wait (dependend
    on lora_speed setting) -> the main loop rx handler has a chance to
    read and handle the packet from lora-chip's rx buffer.

  - taskWebserver: on firmware upload start, disconnect from aprsis; on
    fail, re-set to old state.
    And re-init not only lora_freq but also lora_speed and txPower.
    And disable/re-enable lora_rx and lora_tx setting.

- features
  - send_own_beacon_to_aprsis_cached_or_now():
    We separated sendpacket_to_aprsis() from sendpacket() due to the wish of a user:
    Messages to aprsis are faster than those sent to rf, received by another igate and sent from there to aprsis.
    But the user likes to examine RF-conditions (that means, who heard him on RF).
    Thus we send some of our packets with delay.

- smaller changes:
  - uint32_t instead of time_t for nextTelemetryFrame and
    time_lora_TXBUFF_for_digipeating_was_filled
  - fixed typo in Terminal mesage word "show_preferences"

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-10-20 15:04:15 +02:00
Thomas Osterried e50a214c38 fixes and improvements
.ino:
  - cleaner check for occurences of TCPIP or TCPXX in path
    when gating rf-to-aprsis or kiss-to-aprsis.
    Changed decision for received third-party-encoded packets:
      potential gating of third-paty-packets that were not on the internet
      before is now possible, because send_to_aprsis() is now capable
      to re-encode them properly.
  - if beacon was triggered via tnc cli, then the display said
    "((WEB TX))". -> fixed.
  - is_call_blacklisted(): moved empty-list-check beyond the ssid check
  - beauty fixes and string assurances

taskWeberserver:
  - fix for gating packets with TCPIP in path from aprsis. TCPIP is allowed,
    TCPXX, NOGATE and RFONLY is not.
  - cleaner check for occurences of TCPIP in path when preparing
    to gate as third-party-traffic to aprsis.
  - also check for NOGATE, RFONLY, TCPXX, TCPIP in the path of the
    third-party header when gating rf to aprsis.
    Third-party-packets (from other networks than tcpip) can now be sent
    unencoded, according to the aprsis spec.
  - when uploading firmware
    - acquire sema lock against loraSend() ->
      lora chip could safely be powered down.
    - workaround to circumvent crash on interrupt handler isr0():
  - re-enable logging when we restart the device do to aprsis-connection-errors
  - check sender with call is_call_blacklisted() when gating aprsis to rf,
    like we did this already for that what we hear on rf (for digipeating,
    or sending to aprsis)
  - from aprisis (according to the APRS spec): packets from invalid calls are
    not sent on rf; now: also not to TNC.
  - from aprsis: disable general station queries (':?'))

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-09-23 12:38:36 +02:00
Thomas Osterried db1ee46dc1 features: exernal gps, usbserial nmea. changed: aprsis-connect wait time
1. usb-serial: option for output gps nmea sentences
   I patched taskGPS.cpp this for an om a few months ago.
   Unexpectedly, I pushed this change to github with my last push
   a few days ago. -> I needed to implent this feature now,
   because else gps nmea output was sent uninterruptable.
   I needed to add a small change to taskGPS.cpp.
   You can enable this in the webinterface
   tnc mode now also has the option to enable nmea (like the logging and trace
   command).

2. Feature for those who attached a GPS to a non-gps-tracker like the
   lora32 device.
   - GPS speed for those devices is currently hardcoded accordnig to the
     need of one OM (the way it was already hardcoded for T-BEAM devices)
     Perhaps it will become a web-configurable featuee
   - new compile time option FORCE_ENABLE_GPS for your platform.ini
     if you use a non-T-BEAM hardware (-> gps_state = true)
   - in setup_phase2_soft_reconfiguration I removed the condition
     #else

3. On aprsis-connection setup, we waited up to 25s for login prompt.
   -> The webinterface is unresponsive for this time.
   connect_to_aprsis() is a sub sub function from the main loop with
   many checked conditions like variables and retry times. A better
   solution would need a major redesign.
   => the wait time for the prompt is now 5s.

4. removed block
    if (curr_hdop < bestHdop && curr_sats >= 4) {
      do_update = 1;
    } else
  because bestHdop always <= curr_hdop (assignment above)
  -> This condition was always false, and it is obsolete
  (came from a time when experimenting for best values, and
  where the assignment bestHdop = curr_hdop was done after that block).

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-08-24 19:55:01 +02:00
Thomas Osterried 7ad89c177c - Better Web-Layout
Thanks to Michal SQ2MO

- GPS nmea to serial:
  With my commit yesterday,
    0d06bac161 (diff-dbe66a6426995ddbd695f74c1c87b1b5948f41d3b8c0ea1cf73c7d13ee14aea8)
  I unintentional uploaded a patch for GPS nmea data to usb-serial. Someone had
  requested that feature recently.
  It was not tested for general relase and may may have impact to tnc trace mode.
  Because my TTGO is defect, feedback is welcome. Hint: usb_serial_data_type 4.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-08-22 09:56:01 +02:00
Thomas Osterried 0d06bac161 - Feature RTT
WiFi power-management as station:  if aprs-is connection is
  established, switch power saving setting from WIFI_PS_MIN_MODEM
  to WIFI_PS_NONE. -> less delay.
- Beauty:
  - Webserver index.html: small change in description
  - getLocalTimeTheBetterWay():
    changed  if (now != ~0 && now) {
    to       if (now && now != ~((time_t ) 0)) {
    ;)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-08-21 16:23:53 +02:00
Thomas Osterried 7dbacac67c Fixes for getLocalTime() and configTime()
fix #1: getLocalTime() has bugs
getLocalTimeTheBetterWay is my  reimplementation of the buggy getLocalTime()
library call of esp32
which caused 5s delay on each call of getLocalTime(), if no gps- or ntp-
time was obtained since boot. getLocalTime() has an optional argument to
reduce this delay, but even then each call has a delay of 10ms.
Also, posix recommends to call time with nullpointer instead of storing
the time to the address of the argument. On linux, see man (2) time.

Thanks to Thomas dl3el for locating the cause of the 5s-delay we observed
under some cirumstances.

fix #2: configTime() resulted in strange DNS requests.
configTime() stores the memory address of ntp-server.
Thus the variable needs to be static, else ntp will later will see garbage.
This forbids the use of ntp_server.c_str().
Now, we use there a static char array, instead of a
more inefficient String buffer. configTime() expects a char array anyway.
For more fun with bad concepts, see https://github.com/opendata-stuttgart/sensors-software/issues/471

Thanks to Michal SQ2MO for locating the cause: DNS requests for
IN A addresses that looked like the content of free()'d memory.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-08-09 17:51:42 +02:00
Thomas Osterried 3344a44b89 Bug fixes for AXP2101, web received_list; aprs-null-position; some smaller features
- AXP2101 powerchip:
  - fix: battery did not charge. Reason: do not enable
    axp.enableTSPinMeasure() because the T-BEAM does not this
    hardware capability
  - enhancement: battery-friendly charge settings added:
    - axp.setPrechargeCurr(XPOWERS_AXP2101_PRECHARGE_200MA);
    - axp.setChargerTerminationCurr(XPOWERS_AXP2101_CHG_ITERM_25MA);
  - this power chip has no current load measurement, but
    it could show the battery charge level (in %).
    -> Added this info to the display, and to (when enabled)
       the beacon text
    -> P:4.87V/23%+ means, usb powered (4.87V). Battery is
       present and is charging; it's 23 % full.
       P:4.87V/100% means, battery is full and charging has stopped.
       P without /... means: no battery attached
       B:3.67V/23%- means, usb power is not plugged in;
       battery has 3.67V and is discharging; it's 23 % full.

- webinterface received_list:
  This fixes an old issue which occured seldomly:
  SP2ATJ who reported lives in a region where compressed position often
  contains "...<...>...".
  Data to the webserver (/received_listi) comes json format (which properly
  escapes things like '"' or '\''; but web-server unexpectedly interprets
  html-commands (compare it to "...<blink>..." ;).
  -> Now rewriting ", >, <, & and ' ' to &quot; &lt; &gt; &amp; &nbsp;

- fix for "null"-position (aprs standard; our default on full reset):
  - was not sent if compressed position was configured
  - was faulty if uncompressed position was configured
  - documented notation 0000.00N 00000.00W in web config tooltip.

- WIFI: Another approach to fix the problem that WIFI-encryption in mode
        SelfAP is not honored. Tried string-COPY of String(ap_password));
        did not really help.

Special thanks to Tomasz SP2ATJ for help (our long debug sessions) and testing:
the AXP2101 code, his helpful location ...<..>...., and the inspiration
for the battery load.

About the new power chip, see commit 02dedd3517
and 5a1a6d7d5a from 2023-07-15:
    Now with axp1201 support (T-BEAM V1.2)

    - Support for T-BEAM V1.2 (axp1201 power chip),
      T-BEAM V1.1 and V.0 used the axp192.
      Unfortunately, this new chip is not able to read current load.
      In the case of telemetry, we do not drop the current readings (but set it
      to 0). This notation may change in future.

    - Feature for needed in SP:
      enable TX on main and secondary frequency as user.
      (new commit, had a bug)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-07-22 00:06:27 +02:00
Thomas Osterried 02dedd3517 Now with axp1201 support (T-BEAM V1.2)
- Support for T-BEAM V1.2 (axp1201 power chip),
  T-BEAM V1.1 and V.0 used the axp192.
  Unfortunately, this new chip is not able to read current load.
  In the case of telemetry, we do not drop the current readings (but set it
  to 0). This notation may change in future.

- Feature for needed in SP:
  enable TX on main and secondary frequency as user.
  (new commit, had a bug)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-07-15 13:23:04 +02:00
Thomas Osterried 5a1a6d7d5a Now with axp1201 support (T-BEAM V1.2)
- Support for T-BEAM V1.2 (axp1201 power chip),
  T-BEAM V1.1 and V.0 used the axp192.
  Unfortunately, this new chip is not able to read current load.
  In the case of telemetry, we do not drop the current readings (but set it
  to 0). This notation may change in future.

- Feature for needed in SP:
  enable TX on main and secondary frequency as user.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-07-15 12:04:47 +02:00
Thomas Osterried 61f4fe9528
Merge pull request #10 from Luceoria/dev_emptyssid
Allow empty SSID
2023-06-21 10:50:38 +02:00
Luceoria 4a5a8251f3
Allow empty SSID 2023-06-18 19:53:36 +02:00
Thomas Osterried d833835e16 Fixes and improvements:
- platform.ini: changed env:xxx-1.0 to xxx-1_0, because latest
  platformio complains about the dot.

- Optional: send beacon as object
  This is recommended if you like an aps icon like L, while using
  your normal ssid like DL9SAU-12
  You can set it in the webinterface, of by compile time in platform.ini
- if you really insist in adding SSID -L4 to your callsign,
  your RF TX will be disabled. You can connect with that call to to aprs-is.

- renamed function name compute_locator() to locator_to_lat_lon(),
  because it's more clear

- GPS accuracy:
  GPS becomes inaccurate if you move very slow or halt.
  These jumps may have a distance of more than 100m.
  If we take hdop and visible satellites into acount, the situation
  improves significant.
  A measured height needs even more sats and better vdop.
  Beacons are also triggered by course change. Speed is not a good
  indicator, because speed is computed by location change. And if
  you jump 200m in between 5s, then you speed is interpreted as 144km/h.
  This leads to wrong assumptions about course change.
  As far as we know, our changes have no impact to the quality of the
  positions and the course change detection for smart-beaconing.
  hdop and sat values for exacter location, course, speed,
  and altitude have been testet by experiment. If you like, you
  may find better values.

After this commit, we'll test extensively. Then it will become
a release dedicated to HAMRADIO 2023 ;)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-06-15 20:42:49 +02:00
Thomas Osterried a00555f9cc - fix: global variable lastTX (used for smart beaconing) was set by loraSend().
If you send telemetry, this also goes through loraSend. If you reach long
  smart beaconing interval (you move slow) and you send telemety in a shorter
  interval, the smart beacon was not sent.
  -> Moved lastTX to sendPacket().
- lora_tx_enabled check: added to manual beacon and smart beaconing; it is
  also checked as a last resort in loraSend, but it's more clear to not call
  loraSend in that case.
- prepareAPSFrame: do not remember current position anymore; it made
  gps-hoping even worse.
  I have a better approach in the queue, but I like to add this in a separate
  commit (for easier being able to roll-back, if it does not work as expected)

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-04-20 10:30:26 +02:00
Thomas Osterried 52096d7a45 bug fixes, features, much work on telemetry
Last commit: fix aprs message call length (had introduced a new bug)

Log of todays commits:

- bugfixes
   - on reset and read from preferences.cfg file, configured lat/lon
    have been ignored.
   - fix for compressed position with ambiguity > 0

- right after boot, do not wait for a precise position.
  this avoids a jump to the configured fixed position,
  which may be very far away.
  The code will become even nicer in a next release (I'm
  currently testing with hdop.hdop(), which will have changes
  of the decision-making of storing a current location); so
  the use of no_gps_position_since_boot will become nice.

- display:
  - show P= instead of Batt= if powered from USB
  - "Up " instead of " Up " for uptime if no system time is available
  - display " LoRa-TX: dis" instead of " never TX"
  - display " GPS: no fix " instead of " no GPS fix"
      Why?: "WiFi-Cli no GPS fix" is irritating (no WiFi-Client but GPS fix?
      No, it was WiFo mode Client, and GPS without fix).
  - show P: instead tof Batt: on boot
  - show axp temperature on TTGO

- InpVolts vs BattVolts:
  Hardware without AXP chip (all except T-BEAM TTGO) have no idea of
  battery voltage. -> Changed Display and Telemetry vor this:
  InpVolts instead of VattVolts.

- system time from GPS:
  - Added check if function calls are successful
  - changed nasty code with type errors and misleading variable names
  - etc..

- manual beacon (button pressed): added next_fixed_beacon = ...

- Telemetry
  - removed dependency of define KISS_PROTOCOL
  - the AXP chip of the T-BEAM could measure temperature! Cewl..
    But we already have all 5 telemetry-positions in use.
    -> If we have no battery on boot, we have 3 fields free (Batt V,
    Current in ant out). If we have no usb on battery-boot connected,
    we have one field free for the temperature. Temperature is measured
    in steps of 0.25 degrees C.
  - The new temperature field as well as the "InputVolts vs BatteryVolts
    values" for the different devices needet a re-mix of the positions
    in the telemetry frame.
    I also decided "AC V" and "AC C" to "P V" and "P C". Trackers are
    powered on DC, not AC ;)
    For various reasons, we add temperature to the 5'th field.
    "B Out" was irritating: what, Volt, Current, Light? It's now BCout.
  - Changed equations for Volt. The problem with the old method was,
    that if you have 0 V (i.E. no battery attached), it was interpreted
    by the += 3000 level -> 3V.
    Unfortunately, the APRS spec does not define an encoding if i.E.
    a sensor is not available. ",," would be nice. But the field is
    defined exactly as ",nmo," with n, m and o as digit.
  - We had two cases for
      // DO NOT ENABLE THIS UNTIL YOU READ AND UNDERSTOOD THE IMPACT DESCRIBED ABOVE
    and people have overseen the second case. Changed the concept (one
    boolean variable).
  - Searched more than week why often EQNS are sent (while PARM, etc..
    was expected). Our local state variable (type static) sometimes,
    but not always, was set to 0 on re-entering the function block.
    -> either a compiler problem, or might be a buffer overflow corrupts
    the stack?
    After I fixed this, the same happeneed with the new local static
    variable static const boolan may_add_temperature = ...,
    which changed it's assigned value  during runtime.

- taskWebserver: made status messages more consistent.

- watchdog patches from hb9xar

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-03-27 22:34:18 +02:00
Thomas Osterried 31fb53ca1e bug fixes, features, much work on telemetry
- bugfixes
   - on reset and read from preferences.cfg file, configured lat/lon
    have been ignored.
   - fix for compressed position with ambiguity > 0

- right after boot, do not wait for a precise position.
  this avoids a jump to the configured fixed position,
  which may be very far away.
  The code will become even nicer in a next release (I'm
  currently testing with hdop.hdop(), which will have changes
  of the decision-making of storing a current location); so
  the use of no_gps_position_since_boot will become nice.

- display:
  - show P= instead of Batt= if powered from USB
  - "Up " instead of " Up " for uptime if no system time is available
  - display " LoRa-TX: dis" instead of " never TX"
  - display " GPS: no fix " instead of " no GPS fix"
      Why?: "WiFi-Cli no GPS fix" is irritating (no WiFi-Client but GPS fix?
      No, it was WiFo mode Client, and GPS without fix).
  - show P: instead tof Batt: on boot
  - show axp temperature on TTGO

- InpVolts vs BattVolts:
  Hardware without AXP chip (all except T-BEAM TTGO) have no idea of
  battery voltage. -> Changed Display and Telemetry vor this:
  InpVolts instead of VattVolts.

- system time from GPS:
  - Added check if function calls are successful
  - changed nasty code with type errors and misleading variable names
  - etc..

- manual beacon (button pressed): added next_fixed_beacon = ...

- Telemetry
  - removed dependency of define KISS_PROTOCOL
  - the AXP chip of the T-BEAM could measure temperature! Cewl..
    But we already have all 5 telemetry-positions in use.
    -> If we have no battery on boot, we have 3 fields free (Batt V,
    Current in ant out). If we have no usb on battery-boot connected,
    we have one field free for the temperature. Temperature is measured
    in steps of 0.25 degrees C.
  - The new temperature field as well as the "InputVolts vs BatteryVolts
    values" for the different devices needet a re-mix of the positions
    in the telemetry frame.
    I also decided "AC V" and "AC C" to "P V" and "P C". Trackers are
    powered on DC, not AC ;)
    For various reasons, we add temperature to the 5'th field.
    "B Out" was irritating: what, Volt, Current, Light? It's now BCout.
  - Changed equations for Volt. The problem with the old method was,
    that if you have 0 V (i.E. no battery attached), it was interpreted
    by the += 3000 level -> 3V.
    Unfortunately, the APRS spec does not define an encoding if i.E.
    a sensor is not available. ",," would be nice. But the field is
    defined exactly as ",nmo," with n, m and o as digit.
  - We had two cases for
      // DO NOT ENABLE THIS UNTIL YOU READ AND UNDERSTOOD THE IMPACT DESCRIBED ABOVE
    and people have overseen the second case. Changed the concept (one
    boolean variable).
  - Searched more than week why often EQNS are sent (while PARM, etc..
    was expected). Our local state variable (type static) sometimes,
    but not always, was set to 0 on re-entering the function block.
    -> either a compiler problem, or might be a buffer overflow corrupts
    the stack?
    After I fixed this, the same happeneed with the new local static
    variable static const boolan may_add_temperature = ...,
    which changed it's assigned value  during runtime.

- taskWebserver: made status messages more consistent.

- watchdog patches from hb9xar

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-03-27 18:51:03 +02:00
Thomas Osterried 8f6a308c50 bug fixes, features, much work on telemetry
- bugfixes
   - on reset and read from preferences.cfg file, configured lat/lon
    have been ignored.
   - fix for compressed position with ambiguity > 0

- right after boot, do not wait for a precise position.
  this avoids a jump to the configured fixed position,
  which may be very far away.
  The code will become even nicer in a next release (I'm
  currently testing with hdop.hdop(), which will have changes
  of the decision-making of storing a current location); so
  the use of no_gps_position_since_boot will become nice.

- display:
  - show P= instead of Batt= if powered from USB
  - "Up " instead of " Up " for uptime if no system time is available
  - display " LoRa-TX: dis" instead of " never TX"
  - display " GPS: no fix " instead of " no GPS fix"
      Why?: "WiFi-Cli no GPS fix" is irritating (no WiFi-Client but GPS fix?
      No, it was WiFo mode Client, and GPS without fix).
  - show P: instead tof Batt: on boot
  - show axp temperature on TTGO

- InpVolts vs BattVolts:
  Hardware without AXP chip (all except T-BEAM TTGO) have no idea of
  battery voltage. -> Changed Display and Telemetry vor this:
  InpVolts instead of VattVolts.

- system time from GPS:
  - Added check if function calls are successful
  - changed nasty code with type errors and misleading variable names
  - etc..

- manual beacon (button pressed): added next_fixed_beacon = ...

- Telemetry
  - removed dependency of define KISS_PROTOCOL
  - the AXP chip of the T-BEAM could measure temperature! Cewl..
    But we already have all 5 telemetry-positions in use.
    -> If we have no battery on boot, we have 3 fields free (Batt V,
    Current in ant out). If we have no usb on battery-boot connected,
    we have one field free for the temperature. Temperature is measured
    in steps of 0.25 degrees C.
  - The new temperature field as well as the "InputVolts vs BatteryVolts
    values" for the different devices needet a re-mix of the positions
    in the telemetry frame.
    I also decided "AC V" and "AC C" to "P V" and "P C". Trackers are
    powered on DC, not AC ;)
    For various reasons, we add temperature to the 5'th field.
    "B Out" was irritating: what, Volt, Current, Light? It's now BCout.
  - Changed equations for Volt. The problem with the old method was,
    that if you have 0 V (i.E. no battery attached), it was interpreted
    by the += 3000 level -> 3V.
    Unfortunately, the APRS spec does not define an encoding if i.E.
    a sensor is not available. ",," would be nice. But the field is
    defined exactly as ",nmo," with n, m and o as digit.
  - We had two cases for
      // DO NOT ENABLE THIS UNTIL YOU READ AND UNDERSTOOD THE IMPACT DESCRIBED ABOVE
    and people have overseen the second case. Changed the concept (one
    boolean variable).
  - Searched more than week why often EQNS are sent (while PARM, etc..
    was expected). Our local state variable (type static) sometimes,
    but not always, was set to 0 on re-entering the function block.
    -> either a compiler problem, or might be a buffer overflow corrupts
    the stack?
    After I fixed this, the same happeneed with the new local static
    variable static const boolan may_add_temperature = ...,
    which changed it's assigned value  during runtime.

- taskWebserver: made status messages more consistent.

- watchdog patches from hb9xar

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-03-27 18:37:56 +02:00
Thomas Osterried 883c9f84cb bug fixes, features, much work on telemetry
- bugfixes
   - on reset and read from preferences.cfg file, configured lat/lon
    have been ignored.
   - fix for compressed position with ambiguity > 0

- right after boot, do not wait for a precise position.
  this avoids a jump to the configured fixed position,
  which may be very far away.
  The code will become even nicer in a next release (I'm
  currently testing with hdop.hdop(), which will have changes
  of the decision-making of storing a current location); so
  the use of no_gps_position_since_boot will become nice.

- display:
  - show P= instead of Batt= if powered from USB
  - "Up " instead of " Up " for uptime if no system time is available
  - display " LoRa-TX: dis" instead of " never TX"
  - display " GPS: no fix " instead of " no GPS fix"
      Why?: "WiFi-Cli no GPS fix" is irritating (no WiFi-Client but GPS fix?
      No, it was WiFo mode Client, and GPS without fix).
  - show P: instead tof Batt: on boot
  - show axp temperature on TTGO

- InpVolts vs BattVolts:
  Hardware without AXP chip (all except T-BEAM TTGO) have no idea of
  battery voltage. -> Changed Display and Telemetry vor this:
  InpVolts instead of VattVolts.

- system time from GPS:
  - Added check if function calls are successful
  - changed nasty code with type errors and misleading variable names
  - etc..

- manual beacon (button pressed): added next_fixed_beacon = ...

- Telemetry
  - removed dependency of define KISS_PROTOCOL
  - the AXP chip of the T-BEAM could measure temperature! Cewl..
    But we already have all 5 telemetry-positions in use.
    -> If we have no battery on boot, we have 3 fields free (Batt V,
    Current in ant out). If we have no usb on battery-boot connected,
    we have one field free for the temperature. Temperature is measured
    in steps of 0.25 degrees C.
  - The new temperature field as well as the "InputVolts vs BatteryVolts
    values" for the different devices needet a re-mix of the positions
    in the telemetry frame.
    I also decided "AC V" and "AC C" to "P V" and "P C". Trackers are
    powered on DC, not AC ;)
    For various reasons, we add temperature to the 5'th field.
    "B Out" was irritating: what, Volt, Current, Light? It's now BCout.
  - Changed equations for Volt. The problem with the old method was,
    that if you have 0 V (i.E. no battery attached), it was interpreted
    by the += 3000 level -> 3V.
    Unfortunately, the APRS spec does not define an encoding if i.E.
    a sensor is not available. ",," would be nice. But the field is
    defined exactly as ",nmo," with n, m and o as digit.
  - We had two cases for
      // DO NOT ENABLE THIS UNTIL YOU READ AND UNDERSTOOD THE IMPACT DESCRIBED ABOVE
    and people have overseen the second case. Changed the concept (one
    boolean variable).
  - Searched more than week why often EQNS are sent (while PARM, etc..
    was expected). Our local state variable (type static) sometimes,
    but not always, was set to 0 on re-entering the function block.
    -> either a compiler problem, or might be a buffer overflow corrupts
    the stack?
    After I fixed this, the same happeneed with the new local static
    variable static const boolan may_add_temperature = ...,
    which changed it's assigned value  during runtime.

- taskWebserver: made status messages more consistent.

- watchdog patches from hb9xar

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-03-27 18:28:25 +02:00
Thomas Osterried c8d7a6c71f bug fixes, features, much work on telemetry
- bugfixes
   - on reset and read from preferences.cfg file, configured lat/lon
    have been ignored.
   - fix for compressed position with ambiguity > 0

- right after boot, do not wait for a precise position.
  this avoids a jump to the configured fixed position,
  which may be very far away.
  The code will become even nicer in a next release (I'm
  currently testing with hdop.hdop(), which will have changes
  of the decision-making of storing a current location); so
  the use of no_gps_position_since_boot will become nice.

- display:
  - show P= instead of Batt= if powered from USB
  - "Up " instead of " Up " for uptime if no system time is available
  - display " LoRa-TX: dis" instead of " never TX"
  - display " GPS: no fix " instead of " no GPS fix"
      Why?: "WiFi-Cli no GPS fix" is irritating (no WiFi-Client but GPS fix?
      No, it was WiFo mode Client, and GPS without fix).
  - show P: instett of Batt: on boot

- InpVolts vs BattVolts:
  Hardware without AXP chip (all except T-BEAM TTGO) have no idea of
  battery voltage. -> Changed Display and Telemetry vor this:
  InpVolts instead of VattVolts.

- system time from GPS:
  - Added check if function calls are successful
  - changed nasty code with type errors and misleading variable names
  - etc..

- manual beacon (button pressed): added next_fixed_beacon = ...

- Telemetry
  - removed dependency of define KISS_PROTOCOL
  - the AXP chip of the T-BEAM could measure temperature! Cewl..
    But we already have all 5 telemetry-positions in use.
    -> If we have no battery on boot, we have 3 fields free (Batt V,
    Current in ant out). If we have no usb on battery-boot connected,
    we have one field free for the temperature. Temperature is measured
    in steps of 0.25 degrees C.
  - The new temperature field as well as the "InputVolts vs BatteryVolts
    values" for the different devices needet a re-mix of the positions
    in the telemetry frame.
    I also decided "AC V" and "AC C" to "P V" and "P C". Trackers are
    powered on DC, not AC ;)
    For various reasons, we add temperature to the 5'th field.
    "B Out" was irritating: what, Volt, Current, Light? It's now BCout.
  - Changed equations for Volt. The problem with the old method was,
    that if you have 0 V (i.E. no battery attached), it was interpreted
    by the += 3000 level -> 3V.
    Unfortunately, the APRS spec does not define an encoding if i.E.
    a sensor is not available. ",," would be nice. But the field is
    defined exactly as ",nmo," with n, m and o as digit.
  - We had two cases for
      // DO NOT ENABLE THIS UNTIL YOU READ AND UNDERSTOOD THE IMPACT DESCRIBED ABOVE
    and people have overseen the second case. Changed the concept (one
    boolean variable).
  - Searched more than week why often EQNS are sent (while PARM, etc..
    was expected). Our local state variable (type static) sometimes,
    but not always, was set to 0 on re-entering the function block.
    -> either a compiler problem, or might be a buffer overflow corrupts
    the stack?
    After I fixed this, the same happeneed with the new local static
    variable static const boolan may_add_temperature = ...,
    which changed it's assigned value  during runtime.

- taskWebserver: made status messages more consistent.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-03-27 11:50:00 +02:00
Thomas Osterried 5bcb7ef0c6 bug fixes, features, much work on telemetry
- bugfix:
    on reset and read from preferences.cfg file, configured lat/lon
    have been ignored.
- right after boot, do not wait for a precise position.
  this avoids a jump to the configured fixed position,
  which may be very far away.
  The code will become even nicer in a next release (I'm
  currently testing with hdop.hdop(), which will have changes
  of the decision-making of storing a current location); so
  the use of no_gps_position_since_boot will become nice.

- display:
  - show P= instead of Batt= if powered from USB
  - "Up " instead of " Up " for uptime if no system time is available
  - display " LoRa-TX: dis" instead of " never TX"
  - display " GPS: no fix " instead of " no GPS fix"
      Why?: "WiFi-Cli no GPS fix" is irritating (no WiFi-Client but GPS fix?
      No, it was WiFo mode Client, and GPS without fix).
  - show P: instett of Batt: on boot

- InpVolts vs BattVolts:
  Hardware without AXP chip (all except T-BEAM TTGO) have no idea of
  battery voltage. -> Changed Display and Telemetry vor this:
  InpVolts instead of VattVolts.

- system time from GPS:
  - Added check if function calls are successful
  - changed nasty code with type errors and misleading variable names
  - etc..

- manual beacon (button pressed): added next_fixed_beacon = ...

- Telemetry
  - removed dependency of define KISS_PROTOCOL
  - the AXP chip of the T-BEAM could measure temperature! Cewl..
    But we already have all 5 telemetry-positions in use.
    -> If we have no battery on boot, we have 3 fields free (Batt V,
    Current in ant out). If we have no usb on battery-boot connected,
    we have one field free for the temperature. Temperature is measured
    in steps of 0.25 degrees C.
  - The new temperature field as well as the "InputVolts vs BatteryVolts
    values" for the different devices needet a re-mix of the positions
    in the telemetry frame.
    I also decided "AC V" and "AC C" to "P V" and "P C". Trackers are
    powered on DC, not AC ;)
    For various reasons, we add temperature to the 5'th field.
    "B Out" was irritating: what, Volt, Current, Light? It's now BCout.
  - Changed equations for Volt. The problem with the old method was,
    that if you have 0 V (i.E. no battery attached), it was interpreted
    by the += 3000 level -> 3V.
    Unfortunately, the APRS spec does not define an encoding if i.E.
    a sensor is not available. ",," would be nice. But the field is
    defined exactly as ",nmo," with n, m and o as digit.
  - We had two cases for
      // DO NOT ENABLE THIS UNTIL YOU READ AND UNDERSTOOD THE IMPACT DESCRIBED ABOVE
    and people have overseen the second case. Changed the concept (one
    boolean variable).
  - Searched more than week why often EQNS are sent (while PARM, etc..
    was expected). Our local state variable (type static) sometimes,
    but not always, was set to 0 on re-entering the function block.
    -> either a compiler problem, or might be a buffer overflow corrupts
    the stack?
    After I fixed this, the same happeneed with the new local static
    variable static const boolan may_add_temperature = ...,
    which changed it's assigned value  during runtime.

- taskWebserver: made status messages more consistent.

Signed-off-by: Thomas Osterried <dl9sau@darc.de>
2023-03-27 10:26:03 +02:00
DL3EL aa37003826 Merge branch 'master' of https://github.com/DL3EL/TTGO-T-Beam-LoRa-APRS
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-18 22:26:02 +02:00
DL3EL 30c2cf8b68 bug fixes and textual changes in index.html
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-18 22:12:20 +02:00
DL3EL fe20713a8a add file.close()
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-17 19:00:10 +02:00
DL3EL 91f86a5456 Bugfixes & check if safeappw min 8 byte
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-17 13:25:50 +02:00
DL3EL 18c0a2e583 send reboot message to aprs-is, including build-nr
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-16 22:21:45 +02:00
DL3EL d892cf5206 enhance logging
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-16 16:58:56 +02:00
DL3EL 2c2ebfb051 data/wifi.cfg no contains a backup or safe wifi. When the configured wifi is not answering, this ssid will be tested. If this one is also not reachable, the selfAP is activated. The file must only contain ssid & pw of one ap, as scown in the example.
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-15 20:55:21 +02:00
DL3EL 6c485f5a52 introduce SPIFFS
Signed-off-by: DL3EL <dl3el@darc.de>
2022-09-15 11:31:55 +02:00
14 zmienionych plików z 4114 dodań i 1196 usunięć

Wyświetl plik

@ -14,6 +14,7 @@
"lora_rx_en": true,
"lora_tx_en": true,
"txPower": 23,
"preambleLen": 8,
"lora_cradapt": false,
"lora_rssi2p": 34,
"snraprsis": true,

Wyświetl plik

@ -19,7 +19,7 @@
</div>
<article>
<form action="/save_wifi_cfg" method="post">
<div class="grid-container quarters">
<div class="grid-container full">
<div>
<label for="wifi_en">Enable Wifi</label>
<select id="wifi_en" name="wifi_en">
@ -29,41 +29,14 @@
</select>
</div>
</div>
<div class="grid-container quarters">
<div id="wifi_list">
<label for="wifi_ssid">Network</label>
<input type="button" value="Scan WiFi" id="scan_wifi_btn" onclick="scanWifi();">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="wifi_ssid">WiFi SSID</label>
<input class="u-full-width" type="text" name="wifi_ssid" placeholder="Your Wifi SSID" title="Your Wifi SSID" id="wifi_ssid">
</div>
<div>
<label for="wifi_password">WiFi Password</label>
<input class="u-full-width" type="password" name="wifi_password" id="wifi_password" placeholder="Your WiFi Password" title="Your WiFi Password, 8 characters minimum">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="wifi_pwrSTA">TXPWR as STA</label>
<select id="wifi_pwrSTA" name="wifi_pwrSTA">
<option value="80">Max (20dBm, 100mW, suggested)</option>
<option value="8">Min (2dBm, 2mW)</option>
<option value="44">Low (11dBm, 12mW)</option>
<option value="60">Mid (15dBm, 32mW)</option>
<option value="72">High (18dBm, 63mW)</option>
</select>
</div>
</div>
<div class="grid-container quarters">
<div class="grid-container full">
<h5 class="u-full-width">AP settings</h5>
</div>
<div class="grid-container halves">
<div>
<label for="ap_password">AUTO AP Password</label>
<input class="u-full-width" type="password" name="ap_password" id="ap_password" placeholder="AUTO AP Password" title="AUTO AP Password, 8 characters minimum">
<input type="password" name="ap_password" id="ap_password" placeholder="AUTO AP Password" title="AUTO AP Password, 8 characters minimum">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="wifi_pwrAP">TXPWR as AP</label>
<select id="wifi_pwrAP" name="wifi_pwrAP">
@ -75,18 +48,46 @@
</select>
</div>
</div>
<div class="grid-container quarters">
<div class="grid-container full">
<h5 class="u-full-width">STA settings</h5>
</div>
<div class="grid-container full">
<div id="wifi_list">
<label for="wifi_ssid">Network</label>
<input type="button" value="Scan WiFi" id="scan_wifi_btn" onclick="scanWifi();">
</div>
</div>
<div class="grid-container thirds">
<div>
<label for="wifi_ssid">WiFi SSID</label>
<input type="text" name="wifi_ssid" placeholder="Your Wifi SSID" title="Your Wifi SSID" id="wifi_ssid">
</div>
<div>
<label for="wifi_password">WiFi Password</label>
<input type="password" name="wifi_password" id="wifi_password" placeholder="Your WiFi Password" title="Your WiFi Password, 8 characters minimum">
</div>
<div>
<label for="wifi_pwrSTA">TXPWR as STA</label>
<select id="wifi_pwrSTA" name="wifi_pwrSTA">
<option value="80">Max (20dBm, 100mW, suggested)</option>
<option value="8">Min (2dBm, 2mW)</option>
<option value="44">Low (11dBm, 12mW)</option>
<option value="60">Mid (15dBm, 32mW)</option>
<option value="72">High (18dBm, 63mW)</option>
</select>
</div>
</div>
<div class="grid-container halves">
<div>
<label for="ntp_server">NTP Server</label>
<input type="text" name="ntp_server" id="ntp_server" placeholder="pool.ntp.org" title="NTP Server name or IP Address. I.e. pool.ntp.org. If your igate is in the HAMNET, use ntp.hc.r1.ampr.org.">
</div>
</div>
<div>
<label for="syslog_server">Syslog Server</label>
<input type="text" name="syslog_server" id="syslog_server" placeholder="" title="Syslog Server name or IP Address. Leave empty to switch off. If unsure, you may use the broadcast address 255.255.255.255. Syslog needs do be compiled in (it's by default now)">
</div>
</div>
</div>
</div>
<div class="grid-container quarters">
<div class="grid-container thirds">
<div>
<label for="wifi_failAP">Allow failback to Mode AP</label>
<input name="wifi_failAP" id="wifi_failAP" type="checkbox" value="1" title="
@ -103,7 +104,7 @@ You like to enable, if you use your tracker portable and it should automatically
</div>
<div>
<label for="tncsrvr_en">Enable TNC-Server</label>
<input name="tncsrvr_en" id="tncsrvr_en" type="checkbox" value="1" title="Enable TNC-Server (KISS over TCP) on port tcp 8001. If your device in open networks like HAMNET, enable it only when needed and consider firewalling.">
<input name="tncsrvr_en" id="tncsrvr_en" type="checkbox" value="1" title="Enable TNC-Server (KISS over TCP) on port tcp 8001. If your device in open networks like HAMNET, enable it only when needed and consider firewalling. If you use aprsdroid connected to this devices in WiFi-mode-AP, configure: 'Protocol' 'TNC (KISS)', 'Connection type' 'TCP/IP' and 'Server' '192.168.4.1:8001'">
</div>
<div>
<label for="gpssrv_en">Enable GPS-Server</label>
@ -128,7 +129,7 @@ You like to enable, if you use your tracker portable and it should automatically
<div class="grid-container halves">
<div>
<label for="lora_freq">Main Frequency [MHz]</label>
<input name="lora_freq" id="lora_freq" type="number" min="433.0000" max="928.0000" step="0.0001" title="LoRa center frequency between 433.0001 and 928.0000. I.e. 433.775">
<input name="lora_freq" id="lora_freq" type="number" min="430.1000" max="928.0000" step="0.0001" title="LoRa center frequency between 430.1000 and 928.0000. I.e. 433.775">
</div>
<div>
<label for="lora_speed">Speed</label>
@ -143,7 +144,7 @@ You like to enable, if you use your tracker portable and it should automatically
</div>
<div>
<label for="lora_tx_en">Enable LoRa transmitter</label>
<input name="lora_tx_en" id="lora_tx_en" type="checkbox" value="1" title="Allow TX on LoRa. Disable this if you like to prevent TX under all circumstances (i.e. if your tracker is behind an rx-amplifier)">
<input name="lora_tx_en" id="lora_tx_en" type="checkbox" value="1" title="Allow TX on LoRa. Disable this if you like to prevent TX under all circumstances (i.e. if your tracker is behind an rx-amplifier). If this checkbox keeps off after trying to enable, you might check if your configured CALLSIGN-SSID is correct (see explanation there).">
</div>
<div>
<label for="lora_rx_en">Enable LoRa receiver</label>
@ -153,6 +154,10 @@ You like to enable, if you use your tracker portable and it should automatically
<label for="txPower">TX power [dBm]</label>
<input name="txPower" id="txPower" type="number" min="0" max="23" title="LoRa TX Power. Range 0 to 23dBm">
</div>
<div>
<label for="preambleLen">TX preamble length [symbols]</label>
<input name="preambleLen" id="preambleLen" type="number" min="8" max="4096" title="A larger preamble size improves packet detection but increases transmission time. Range 8 to 4096 symbols. 8 is default. Please experiment with 12. This setting only affects transmission on Main frequency." placeholder="8">
</div>
<div>
<label for="lora_cradapt">Automatic CodeRate adaption on TX</label>
<input name="lora_cradapt" id="lora_cradapt" type="checkbox" value="1" title="Enable automatic CR adaption. Has only influence on TX (RX can decode every CR). Use this only if you are not a WIDE1 or WIDE2 digi (here you like to send always with higher speed). Still testing, if it behaves good to our network. Currently works only for SF12 modes, because for SF 10 and lower the code for programming CR+SF+BW-combination has not been written yet">
@ -183,16 +188,16 @@ You like to enable, if you use your tracker portable and it should automatically
<option value="56">To APRSIS* and RF* and KISS* (also a good setting!)</option>
<option value="35">To APRSIS* and RF and KISS (~)</option>
<option value="49">To APRSIS* and RF and KISS* (~)</option>
<option value="57">!Too much options. GUI needs redisign!</option>
<option value="9">!I.e. To RF* and RF would not make any sense!<option>
<option value="57">!Too much options. GUI needs redesign!</option>
<option value="9">!I.e. To RF* and RF would not make any sense!</option>
</select>
</div>
</div>
<div class="grid-container halves">
More info for SNR/RSSI path encoding see documentation section below
<div>
<label for="snraprsis">SNR/RSSI-encoding on kiss: compatible to APRS-IS?</label>
<input name="snraprsis" id="snraprsis" type="checkbox" value=1 title="Add snr+rssi at last digipeater, without digipeated flag. Use this for APRS-IS connections. If you have connected a digipeater software to kiss, this option has to be switched off">
<div>
More info for SNR/RSSI path encoding see documentation section below
</div>
</div>
</div>
<div class="grid-container full">
@ -201,7 +206,7 @@ You like to enable, if you use your tracker portable and it should automatically
<div class="grid-container quarters">
<div>
<label for="aprs_callsign">Callsign and SSID *</label>
<input class="u-full-width" type="text" minlength="3" maxlength="9" name="aprs_callsign" placeholder="NOCALL-1" id="aprs_callsign" title="your callsign with SSID">
<input class="u-full-width" type="text" minlength="3" maxlength="9" name="aprs_callsign" placeholder="NOCALL-1" id="aprs_callsign" title="your callsign with SSID. SSID is optional and should be in the range of -1 to -15. SSIDs like '-L4' are ok for aprs-is, but should not be sent on RF; thus LoRa TX will be disabled.">
</div>
<div>
<label for="aprs_relay_path">Relay Path</label>
@ -215,9 +220,13 @@ You like to enable, if you use your tracker portable and it should automatically
<label for="aprs_symbol">Symbol</label>
<input class="u-full-width" type="text" minlength="1" maxlength="1" name="aprs_symbol" id="aprs_symbol" title="select an icon, for example: [ - jogger, Y - jacht, > - car, b - bike">
</div>
<div>
<label for="aprs_objnam">ObjectName (optional)</label>
<input class="u-full-width" type="text" minlength="0" maxlength="9" name="aprs_objnam" id="aprs_objnam" title="This is optional; most users will leave this empty. If you set this to DL1AAA-L4 because like to see your gateway as DL1AAA-L4 on the map (and also like to send on RF), we'll send our position as type APRS Object (instead of a normal aprs position), with the configured Callsign you configured above.">
</div>
<div>
<label for="aprs_alt_r">Altitude ratio [%]</label>
<input name="aprs_alt_r" id="aprs_alt_r" type="number" min="0" max="100" title="Altitude ratio every n'th packet.. Use 100 for every packet, 0 for no altitude, or any number in between. Recommended: 10 (altitude every tenth's frame). If you use compression ('Send Course/Speed along with Altitude switched off') for reducing airtime (-> then n% altitude-encoding packets are sent, and 100-n% course/speed-encoded packets), you may choose 50 for ballons, where speed/dir and altitude are of equal interrest; if you choose 10, then 90 % of your transmissions encode speed/direction. Cave: if you set it to 100 and switch next option 'Always send CSE/SPD and ALT' to off, then only altitude packets are sen; if you switch the next option on, then altitude is always sent and this configured Altitude ratio is ignored. If you configure 0, altitude is never sent (-> only compressed speed). If ratio is < 100 and gps altitude is not refreshed, only encoded speed is sent." placeholder="10">
<input name="aprs_alt_r" id="aprs_alt_r" type="number" min="0" max="100" title="Altitude ratio every n'th packet.. Use 100 for every packet, 0 for no altitude, or any number in between. Recommended: 10 (altitude every tenth's beacon). If you use compression ('Send Course/Speed along with Altitude switched off') for reducing airtime (-> then n% altitude-encoding packets are sent, and 100-n% course/speed-encoded packets), you may choose 50 for ballons, where speed/dir and altitude are of equal interrest; if you choose 10, then 90 % of your transmissions encode speed/direction. Cave: if you set it to 100 and switch next option 'Always send CSE/SPD and ALT' to off, then only altitude packets are sen; if you switch the next option on, then altitude is always sent and this configured Altitude ratio is ignored. If you configure 0, altitude is never sent (-> only compressed speed). If ratio is < 100 and gps altitude is not refreshed, only encoded speed is sent." placeholder="10">
</div>
<div>
<label for="aprs_CSandA">Always send CSE/SPD and ALT</label>
@ -240,13 +249,25 @@ You like to enable, if you use your tracker portable and it should automatically
<input name="aprs_batt" id="aprs_batt" type="checkbox" value="1" title=" show battery voltage after personal comment">
</div>
<div>
*) requires reboot only if connection to aprs-is enabled
<label for="aprs_stat_wl">Add winlink notification to position comment once/hour</label>
<select id="aprs_stat_wl" name="aprs_stat_wl">
<option value="0">off (default)</option>
<option value="1">on, if bluetooth kiss device is connected</option>
<option value="2">on</option>
</select>
</div>
<div>
<label for="aprs_stat_qrt">Send Status-packet on shutdown</label>
<input name="aprs_stat_qrt" id="aprs_stat_qrt" type="checkbox" value="1" title=" Send status packet 'QRT' right before shutdown on RF. See also option 'Auto power off' if external power is switched off">
</div>
<div class="grid-container full">
<h5 class="u-full-width">Telemetry Settings</h5>
<div>
*) requires reboot only if connection to aprs-is enabled
</div>
<div class="grid-container quarters">
</div>
<div class="grid-container full">
<h5 class="u-full-width">Telemetry Settings</h5>
</div>
<div class="grid-container thirds">
<div>
<label for="tnc_tel">Enable Self Telemetry</label>
<input name="tnc_tel" id="tnc_tel" type="checkbox" value="1" title="send self telemetry data">
@ -281,34 +302,34 @@ You like to enable, if you use your tracker portable and it should automatically
<div class="grid-container full">
<h5 class="u-full-width">Fixed Beaconing Settings</h5>
</div>
<div class="grid-container quarters">
<div class="grid-container thirds">
<div>
<label for="aprs_fixed_beac">Fixed Beacon</label>
<input name="aprs_fixed_beac" id="aprs_fixed_beac" type="checkbox" value="1" title="enable fixed beacon when GPS is disabled or no fix">
<input name="aprs_fixed_beac" id="aprs_fixed_beac" type="checkbox" value="1" title="enable fixed beacon when GPS is disabled or no fix". If set to off, your tracker will not send the configured fixed position (but only the current GPS position, after GPS-fix), except: if you maually send a position-beacon (using middle button, web-interface, cli), it starts sending in Fixed Beacon Interval (like Fixed Beacon would be enabled)>
</div>
<div>
<label for="aprs_fb_interv">Fixed Beacon Interval [s]</label>
<input name="aprs_fb_interv" id="aprs_fb_interv" type="number" min="120" title="time between sending a beacon if Fixed Beacon option is selected. 1800 or 3600 is recommended for users; 900 or 1800 for digis. Min 120. This beacon value is also used if GPS is lost when smart-beacooning. If it is >= sb_max_intervall, this value is used.">
</div>
</div>
<div class="grid-container thirds">
<div>
<label for="aprs_lat_p">Latitude</label>
<input class="u-full-width" type="text" minlength="0" name="aprs_lat_p" id="aprs_lat_p" title="latitude for fixed beacon, APRS format for example: 5215.00N (this is ddmm.mmN). 'dd.nnnnN', '-dd.nnnn', 'dd mm[.nnn]' and 'dd mm ss' and 'dd mm' ss&quot;' and 'dd-mm[.nn]N' are also supported. If position is south, you can prefix '-' instead of writing 'S' behind the coordinate. '-nnS' does not make sense. If you like to add a locator, add it here and leave longitude field blank. If GPS is enabled and a valid position has been received, that one will be used instead of the configured one, until the next system reboot">
<input type="text" minlength="0" name="aprs_lat_p" id="aprs_lat_p" title="latitude for fixed beacon, APRS format for example: 5215.00N (this is ddmm.mmN). 'dd.nnnnN', '-dd.nnnn', 'dd mm[.nnn]' and 'dd mm ss' and 'dd mm' ss&quot;' and 'dd-mm[.nn]N' are also supported. If position is south, you can prefix '-' instead of writing 'S' behind the coordinate. '-nnS' does not make sense. If you like to add a locator, add it here and leave longitude field blank. APRS spec defindes a special notation for null-position: 0000.00N 00000.00W (W, not E). If GPS is enabled and a valid position has been received, that one will be used instead of the configured one, until the next system reboot">
</div>
<div>
<label for="aprs_lon_p">Longitude</label>
<input class="u-full-width" type="text" minlength="0" name="aprs_lon_p" id="aprs_lon_p" title="longtitude for fixed beacon, APRS format for example 02050.59Ei (this is ddd.mmE). 'ddd.nnnnE', '-ddd.nnnn', 'ddd mm[.nnn]' and 'ddd mm ss' and 'ddd mm' ss&quot;' and 'ddd-mm[.nn]E' are also supported. If position is west, you can prefix '-' instead of writing 'W' behind the coordinate. '-nnW' does not make sense.. If you like to add a locator, add it to the latitude field and leave this field blank.">
<input type="text" minlength="0" name="aprs_lon_p" id="aprs_lon_p" title="longtitude for fixed beacon, APRS format for example 02050.59Ei (this is ddd.mmE). 'ddd.nnnnE', '-ddd.nnnn', 'ddd mm[.nnn]' and 'ddd mm ss' and 'ddd mm' ss&quot;' and 'ddd-mm[.nn]E' are also supported. If position is west, you can prefix '-' instead of writing 'W' behind the coordinate. '-nnW' does not make sense.. If you like to add a locator, add it to the latitude field and leave this field blank. APRS spec defindes a special notation for null-position: 0000.00N 00000.00W (W, not E). If GPS is enabled and a valid position has been received, that one will be used instead of the configured one, until the next system reboot">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="aprs_llfgps">Use lat/lon of current GPS position</label>
<label for="aprs_llfgps">Instead, store current GPS position</label>
<input name="aprs_llfgps" id="aprs_llfgps" type="checkbox" value="1" title="Use lat/lon of current GPS position. Overwrites Latitude / Longitude settings above. Requires valid GPS position.">
</div>
</div>
<div class="grid-container full">
<h5 class="u-full-width">Position format and precision / ambiguity</h5>
</div>
<div class="grid-container quarters">
<div class="grid-container full">
<div>
<label for="pos_amb">Position precision *</label>
<select id="pos_amb" name="pos_amb" title="Position precision / Ambiguity
@ -337,27 +358,25 @@ III: Values above are referring to latitude; distance between two latitudes is a
<div class="grid-container quarters">
<div>
<label for="sb_min_interv">Min interval [s]</label>
<input name="sb_min_interv" id="sb_min_interv" type="number" min="10" title="Minimal time for Smart Beaconing. 60 is recommended. Min 10.">
<input class="u-full-width" name="sb_min_interv" id="sb_min_interv" type="number" min="10" title="Minimal time for Smart Beaconing. 60 is recommended. Min 10.">
</div>
<div>
<label for="sb_max_interv">Max interval [s]</label>
<input name="sb_max_interv" id="sb_max_interv" type="number" min="90" title="Maximal time for Smart Beaconing. 1800 is recommended. Min 90.">
<input class="u-full-width" name="sb_max_interv" id="sb_max_interv" type="number" min="90" title="Maximal time for Smart Beaconing. 1800 is recommended. Min 90.">
</div>
</div>
<div class="grid-container quarters">
<div>
<label for="sb_min_speed">Min speed [km/h]</label>
<input name="sb_min_speed" id="sb_min_speed" type="number" min="0" title="Minimal speed for Smart Beaconing. Min 0.">
<input class="u-full-width" name="sb_min_speed" id="sb_min_speed" type="number" min="0" title="Minimal speed for Smart Beaconing. Min 0.">
</div>
<div>
<label for="sb_max_speed">Max speed [km/h]</label>
<input name="sb_max_speed" id="sb_max_speed" type="number" min="1" title="Maximal speed for Smart Beaconing. Min 1.">
<input class="u-full-width" name="sb_max_speed" id="sb_max_speed" type="number" min="1" title="Maximal speed for Smart Beaconing. Min 1.">
</div>
</div>
<div class="grid-container quarters">
<div class="grid-container thirds">
<div>
<label for="sb_angle">Course change [degrees]</label>
<input name="sb_angle" id="sb_angle" type="number" min="5" max="360" title="Angle of course change to speed up beacon transmission. Recommended value: 28. Range 0 to 360.">
<input name="sb_angle" id="sb_angle" type="number" min="5" max="360" title="Angle of course change to speed up beacon transmission. Recommended value: 28. Range 5 to 360.">
</div>
<div>
<label for="sb_turn_slope">Turn Slope [degrees]</label>
@ -373,6 +392,14 @@ III: Values above are referring to latitude; distance between two latitudes is a
<label for="gps_enabled">GPS enabled *</label>
<input name="gps_enabled" id="gps_enabled" type="checkbox" value="1" title="enable or disable GPS">
</div>
<div>
<label for="gps_pwrsve">GPS powersaving mode</label>
<select id="gps_pwrsve" name="gps_pwrsve" title="If there's no GPS fix, allow GPS to go to sleep (chip powered off; taskGPS will suspend). Chip awakes for 1 minute, looking for a fix; if no ifx, sleeps again. Sleep interval is: 1min, 2min, 4min, 8min, 1min, ... You can decide if it may always sleep, or only when you run on battery (default), or if GPS should always be on (according to GPS enabled setting).">
<option value="1">GPS may sleep when running on battery (default)</option>
<option value="2">GPS always may sleep</option>
<option value="0">Ignore this feature</option>
</select>
</div>
<div>
<label for="kiss_myloc_ok">Accept own positions via KISS</label>
<input name="kiss_myloc_ok" id="kiss_myloc_ok" type="checkbox" value="1" title="If set to true, we'll stop sending own position beacons if we heard a position from our call via kiss. Uncheck this, if you like to filter out those positions and keep sending it by this device.">
@ -386,20 +413,20 @@ III: Values above are referring to latitude; distance between two latitudes is a
</div>
</div>
<div class="grid-container full">
<h6 class="u-full-width">Additional settings for secondary frequency:<br/>EXPERIMANTAL - USE WITH CARE!</h6>
<h6 class="u-full-width">Additional settings for secondary frequency:<br/>EXPERIMENTAL - USE WITH CARE!</h6>
</div>
<div class="grid-container halves">
<div>
<label for="lora_freq_x">Secondary Frequency [MHz]</label>
(for cross-repeating or listening transmissions from igates)</label>
<input name="lora_freq_x" id="lora_freq_x" type="number" min="0.0000" max="928.0000" step="0.0001" title="LoRa center frequency - must be different from main frequency and between 433.0001 and 928.0000 or 0 if not needed. I.e. 433.900">
<input name="lora_freq_x" id="lora_freq_x" type="number" min="430.1000" max="928.0000" step="0.0001" title="LoRa center frequency - must be different from main frequency and between 430.0000 and 928.0000 or 0 if not needed. I.e. 433.900">
</div>
<div>
<label for="txPower_x">TX power on secondary frequency [dBm]</label>
<input name="txPower_x" id="txPower_x" type="number" min="0" max="23" title="LoRa TX Power on secondary frequency. Range 0 to 23dBm">
</div>
</div>
<div class="grid-container halves">
<div class="grid-container full">
<div>
<label for="lora_speed_x">Speed on secondary frequency</label>
<select id="lora_speed_x" name="lora_speed_x">
@ -428,9 +455,9 @@ III: Values above are referring to latitude; distance between two latitudes is a
</div>
</div>
<div class="grid-container full">
<h6 class="u-full-width">Additional settings for mode repater:<br/>EXPERIMANTAL - USE WITH CARE!</h6>
<h6 class="u-full-width">Additional settings for mode repater:<br/>EXPERIMENTAL - USE WITH CARE!</h6>
</div>
<div class="grid-container halves">
<div class="grid-container full">
<div>
<label for="lora_dig_mode">LoRa Repater Mode</label>
<select id="lora_dig_mode" name="lora_dig_mode">
@ -441,25 +468,30 @@ III: Values above are referring to latitude; distance between two latitudes is a
</select>
</div>
</div>
<div class="grid-container full">
<div>
<label for="lora_myalias">My alias for digipeating (optional)</label>
<input class="u-full-width" type="text" minlength="0" maxlength="9" name="lora_myalias" id="lora_myalias" title="My alias for digipeting (empty recommended). Kenwood users know it as UITRACE. We repeat this alias, if found in first position of the path and if it is not already repeated. Don't set this to WIDEn-m. This option is only active in LoRa Repeater Mode >= 1">
</div>
</div>
<div class="grid-container halves">
<div>
<label for="lora_dig_x_m">Digipeat heard stations from MAIN frequency to which frequencies</label>
(If LoRa Repeater Mode has not been set to off)
<select id="lora_dig_x_m" name="lora_dig_x_m">
<select class="u-full-width" id="lora_dig_x_m" name="lora_dig_x_m">
<option value="0">Repeat only to main frequency (default)</option>
<option value="1">Repeat to both frequencies</option>
<option value="2">Repeat only to cross-digi frequency</option>
</select>
</div>
</div>
<div class="grid-container halves">
<div>
<label for="tx_qrg_bc">TX our beacon from this device or from-kiss to frequencies</label>
(Only honored, if we are configured as WIDE1 or WIDE2 digi)
<select id="tx_qrg_bc" name="tx_qrg_bc">
<select class="u-full-width" id="tx_qrg_bc" name="tx_qrg_bc">
<option value="1">TX on main frequency</option>
<option value="2">TX on secondary frequency</option>
<option value="3">TX on both frequencies</option>
<option value="5">(TX on both frequencies as USER - not recommended, needed in SP)</option>
<option value="0">Don't send our beacon on RF (but only to kiss and to APRS-IS)</option>
</select>
</div>
@ -490,9 +522,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. This is a positive-filter, i.e. 'ms', which means: accept aprs-text-message and status packets. You can invert the filter ('all except ...') by adding a leading '-', i.e. '-mws'. Valid packet type filters are: poimqstunwb (Position packets, objects, items, message, query, status, telemetry, user-defined, NWS, weather, bulletin (bulletins are aprs-messages prefixed with BLN'). If you leave this field empty, aprsis local filter is disabled. Reason for this local filter: We observed that if you have a server-site filter, i.e. for receiving onöly private text messages for hams a radius 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." 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.">
@ -551,8 +591,12 @@ III: Values above are referring to latitude; distance between two latitudes is a
<option value="0">1. KISS (default)</option>
<option value="1">2. Serial logging</option>
<option value="2">3. Trace packets from LoRa (TNC-trace-format)</option>
<option value="3">4. 2) and 3)</option>
<option value="4">5. No KISS, no logging, no tnc-trace.</option>
<option value="4">4. NMEA GPS data</option>
<option value="3">5. 2) and 3)</option>
<option value="5">6. 4) and 2)</option>
<option value="6">7. 4) and 3)</option>
<option value="7">8. 4) and 2) and 3)</option>
<option value="128">8. No KISS, no logging, no tnc-trace, no NMEA.</option>
</select>
</div>
<div>
@ -571,17 +615,17 @@ III: Values above are referring to latitude; distance between two latitudes is a
</div>
<div>
<label for="shutdown_act">Auto power off</label>
<input name="shutdown_act" id="shutdown_act" type="checkbox" value="1" title="activate auto shutdown after usb plug off (not for T-BEAM 0.7). The power off the device will be switched off.">
<input name="shutdown_act" id="shutdown_act" type="checkbox" value="1" title="activate auto shutdown after usb plug off (not for T-BEAM 0.7). The device will powered down. You can interrupt this by pressing the middle button in time (right after pluging of or short before it powers down). Default: 'yes' (power off). Consider if you need to switch it to 'no' (keep power on), i.e. if you are an additionaly battery-connected igate, or if you have a not reliable power source. Please also look at the option 'Send Status-packet when shutdown' above.">
</div>
<div>
<label for="shutdown_dt">Auto power off delay [s]</label>
<input name="shutdown_dt" id="shutdown_dt" type="number" min="3" max="3600" title="auto shutdown delay in seconds. Range 3 to 3600.">
<input name="shutdown_dt" id="shutdown_dt" type="number" min="3" max="3600" title="auto shutdown delay in seconds. Range 3 to 3600. You can interrupt the timer by pressing the middle-button.">
</div>
</div>
<div class="grid-container quarters">
<div class="grid-container thirds">
<div>
<label for="sh_rxtime">Display show RX time [s]</label>
<input name="sh_rxtime" id="sh_rxtime" type="number" min="0" max="45" title="show RX packet for seconds, refresh rate for OLED. Range 0 to 45.">
<label for="sh_rxtime">Seconds to show RX packets [s]</label>
<input name="sh_rxtime" id="sh_rxtime" type="number" min="0" max="45" title="show a received packet for seconds, refresh rate for OLED. Range 0 to 45.">
</div>
<div>
<label for="sh_oledtime">Display timeout [s]</label>
@ -598,7 +642,7 @@ III: Values above are referring to latitude; distance between two latitudes is a
</select>
</div>
</div>
<div class="grid-container quarters">
<div class="grid-container thirds">
<div>
<label for="oledl3l4fmt">OLED Line3 and Line4 Format</label>
<select id="oledl3l4fmt" name="oledl3l4fmt" title="A: (default): Original format, L3: Lat/Lon; L4: speed, course, altitude. Lat/Lon in APRS format. Good for learning how aprs works.
@ -618,10 +662,10 @@ See also the option beneath about showing maidenhead grid locator.">
<option value="1">B1: Lat/Lon in classic notation</option>
<option value="2">B2: Lat/Lon in nautical notation</option>
<option value="3">C1: Lat/Lon in classic notation, left side</option>
<option value="4">C1: Lat/Lon in nautical notation, left side</option>
<option value="4">C2: Lat/Lon in nautical notation, left side</option>
</select>
</div>
<div>
<div>
<label for="oledlocator">Maidenhead Locator</label>
<select id="oledlocator" name="oledlocator" title="Show Maidenhead grid locator: always (instead of Lat/Lon), never, alternating. Alternating:
0: Never
@ -664,40 +708,6 @@ Hard readable lengths / too long for our display:
</select>
</div>
</div>
<div class="grid-container halves">
<div>
<label for="UptimeMinutes">Uptime of Device [min]</label>
<input type="text" name="UptimeMinutes" id="UptimeMinutes" readonly title="uptime device in minutes">
</div>
<div>
<label for="curPos">Current Position</label>
<input type="text" name="curPos" id="curPos" readonly title="Current Position of device [P if fixed mode; p, if gps is invalid and used as temporary preset]">
</div>
<div>
<label for="OledLine5">Satellite & Batt Info</label>
<input type="text" name="OledLine5" id="OledLine5" readonly title="Satellite (#Sats/HDOP) [more sats are good, lowest HDOP is best. Should be < 8], and Batt Info [B means Battery; P means external pwr. Positive current is battery-charge-current, while prefixed with 'B', and battery voltage shown.]">
</div>
</div>
<div class="grid-container halves">
<div>
<label for="OledLine1">OledLine1</label>
<input type="text" name="OledLine1" id="OledLine1" readonly title="OledLine1">
</div>
<div>
<label for="OledLine2">OledLine2</label>
<input type="text" name="OledLine2" id="OledLine2" readonly title="OledLine2">
</div>
</div>
<div class="grid-container halves">
<div>
<label for="OledLine3">OledLine3</label>
<input type="text" name="OledLine3" id="OledLine3" readonly title="OledLine3">
</div>
<div>
<label for="OledLine4">OledLine4</label>
<input type="text" name="OledLine4" id="OledLine4" readonly title="OledLine4">
</div>
</div>
<div class="grid-container full">
<div>
<input class="button-primary u-full-width" type="submit" value="Save" title="save settings, remember reboot tracker after save">
@ -706,12 +716,51 @@ Hard readable lengths / too long for our display:
</form>
</article>
</section>
<section>
<div class="grid-container full">
<h2 class="u-full-width">Device Info</h2>
</div>
<div class="grid-container halves">
<div>
<label for="UptimeMinutes">Uptime of Device [min]</label>
<input type="text" name="UptimeMinutes" id="UptimeMinutes" readonly title="uptime device in minutes">
</div>
<div>
<label for="curPos">Current Position</label>
<input type="text" name="curPos" id="curPos" readonly title="Current Position of device [P if fixed mode; p, if gps is invalid and used as temporary preset]">
</div>
<div>
<label for="OledLine5">Satellite & Batt Info</label>
<input type="text" name="OledLine5" id="OledLine5" readonly title="Satellite (#Sats/HDOP) [more sats are good, lowest HDOP is best. Should be < 8], and Batt Info [B means Battery; P means external pwr. Positive current is battery-charge-current, while prefixed with 'B', and battery voltage shown.]">
</div>
</div>
<div class="grid-container halves">
<div>
<label for="OledLine1">OledLine1</label>
<input type="text" name="OledLine1" id="OledLine1" readonly title="OledLine1">
</div>
<div>
<label for="OledLine2">OledLine2</label>
<input type="text" name="OledLine2" id="OledLine2" readonly title="OledLine2">
</div>
</div>
<div class="grid-container halves">
<div>
<label for="OledLine3">OledLine3</label>
<input type="text" name="OledLine3" id="OledLine3" readonly title="OledLine3">
</div>
<div>
<label for="OledLine4">OledLine4</label>
<input type="text" name="OledLine4" id="OledLine4" readonly title="OledLine4">
</div>
</div>
</section>
<section>
<div class="grid-container full">
<h2 class="u-full-width">Received</h2>
</div>
<article>
<table class="u-full-width">
<article style="overflow-x:auto;">
<table>
<thead>
<tr>
<th>Time (UTC)</th>
@ -827,22 +876,26 @@ Hard readable lengths / too long for our display:
Use with care; resulting longer path consumes a bit more airtime.
</div>
<div class="grid-container full">
<h5 class="u-full-width">TTGO T-Beam middle hardware-button: User key functions:</h5>
<h5 class="u-full-width">TTGO T-Beam <b>middle</b> hardware-button<br>(User key functions):</h5>
</div>
<div>
<h6 class="u-full-width">short press</h6>
If OLED is enabled and OLED is OFF:<br/>
<ul>
<li>a short press will wake it up and show current data (as "Display Timeout" seconds</li>
<li>a short press will wake it up and show current data (as long as your configured "Display Timeout")</li>
</ul>
If OLED is disabled or OLED is ON:<br>
<ul>
<li>with GPS-FIX immediate sending of a frame with the position from the GPS</li>
<li>without GPS-FIX, immediate sending of the frame with the position saved in the configuration</li>
<li>flip through the available pages</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>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>
<li>toggle on or off WiFi and WebServer</li>
<li>toggle on or off WiFi and WebServer. Switching off WebServer will cause the device to reboot (or on a heltec wireless tracker device: shutdown (deep sleep)).</li>
<li><b>Cave</b>: if you long-press during boot, your <b>settings are purged!</b></li>
</ul>
</div>
@ -871,7 +924,7 @@ Hard readable lengths / too long for our display:
</ul>
Fixed Beacon off:<br>
<ul>
<li>Smart Beaconing is activated, if there is no fixed beacon</li>
<li>Smart Beaconing is activated and GPS position is sent (if GPS fix is available). There is no fixed beacon. Beaconing starts after first GPS-fix (or if you manualy send a fixed beacon). If GPS-fix is lost, the last GPS position is sent in Fixed Beacon Interval.</li>
</ul>
</div>
<div class="grid-container full">
@ -956,6 +1009,10 @@ 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>
<input type="text" name="CompileFlags" id="CompileFlags" readonly title="CompileFlags">
</center>
</footer>
</body>
</html>

File diff suppressed because one or more lines are too long

Wyświetl plik

@ -37,6 +37,8 @@ static const char *const PREF_LORA_TX_ENABLE_INIT = "lora_tx_en_i";
static const char *const PREF_LORA_TX_ENABLE = "lora_tx_en";
static const char *const PREF_LORA_TX_POWER_INIT = "txPower_i";
static const char *const PREF_LORA_TX_POWER = "txPower";
static const char *const PREF_LORA_TX_PREAMBLE_LEN_INIT = "preambleLen_i";
static const char *const PREF_LORA_TX_PREAMBLE_LEN = "preambleLen";
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET_INIT = "lora_rssi2p_i";
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_PRESET = "lora_rssi2p";
static const char *const PREF_LORA_ADD_SNR_RSSI_TO_PATH_END_AT_KISS_PRESET_INIT = "snraprsis_i";
@ -59,6 +61,8 @@ static const char *const PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET_INIT = "lora_cra
static const char *const PREF_LORA_AUTOMATIC_CR_ADAPTION_PRESET = "lora_cradapt";
static const char *const PREF_APRS_DIGIPEATING_MODE_PRESET_INIT = "lora_dig_mode_i";
static const char *const PREF_APRS_DIGIPEATING_MODE_PRESET = "lora_dig_mode";
static const char *const PREF_APRS_DIGIPEATING_MYALIAS_INIT = "lora_myalias_i";
static const char *const PREF_APRS_DIGIPEATING_MYALIAS = "lora_myalias";
static const char *const PREF_APRS_CROSS_DIGIPEATING_MODE_PRESET_INIT = "lora_dig_x_m_i";
static const char *const PREF_APRS_CROSS_DIGIPEATING_MODE_PRESET = "lora_dig_x_m";
@ -68,6 +72,8 @@ static const char *const PREF_APRS_RELAY_PATH = "aprs_relay_path";
static const char *const PREF_APRS_RELAY_PATH_INIT = "aprs_relay_init";
static const char *const PREF_APRS_SYMBOL_TABLE = "aprs_s_table";
static const char *const PREF_APRS_SYMBOL = "aprs_symbol";
static const char *const PREF_APRS_OBJECT_NAME = "aprs_objnam";
static const char *const PREF_APRS_OBJECT_NAME_INIT = "aprs_objnam_i";
static const char *const PREF_APRS_COMMENT = "aprs_comment";
static const char *const PREF_APRS_COMMENT_INIT = "aprs_comm_init";
static const char *const PREF_APRS_COMMENT_RATELIMIT_PRESET = "aprs_comm_rt";
@ -81,6 +87,10 @@ static const char *const PREF_APRS_ALWAYS_SEND_CSE_SPEED_AND_ALTITUDE_INIT = "ap
static const char *const PREF_APRS_SHOW_BATTERY = "aprs_batt";
static const char *const PREF_APRS_SHOW_BATTERY_INIT = "aprs_batt_init";
static const char *const PREF_APRS_STATUS_WINLINK_NOTIFICATION = "aprs_stat_wl";
static const char *const PREF_APRS_STATUS_WINLINK_NOTIFICATION_INIT = "aprs_stat_wl_i";
static const char *const PREF_APRS_STATUS_SHUTDOWN_NOTIFICATION = "aprs_stat_qrt";
static const char *const PREF_APRS_STATUS_SHUTDOWN_NOTIFICATION_INIT = "aprs_stat_qrt_i";
static const char *const PREF_APRS_LATITUDE_PRESET = "aprs_lat_p";
static const char *const PREF_APRS_LATITUDE_PRESET_INIT = "aprs_lat_p_init";
static const char *const PREF_APRS_LATLON_FROM_GPS = "aprs_llfgps"; // no _INIT needed. Checkbox is evaluated on "save" in the Web interface
@ -126,6 +136,8 @@ static const char *const PREF_APRS_SB_TURN_TIME_PRESET_INIT = "sb_turn_time_i";
// Device settings
static const char *const PREF_APRS_GPS_EN = "gps_enabled";
static const char *const PREF_APRS_GPS_EN_INIT = "gps_state_init";
static const char *const PREF_GPS_POWERSAVE = "gps_pwrsve";
static const char *const PREF_GPS_POWERSAVE_INIT = "gps_pwrsve_i";
static const char *const PREF_ACCEPT_OWN_POSITION_REPORTS_VIA_KISS = "kiss_myloc_ok";
static const char *const PREF_ACCEPT_OWN_POSITION_REPORTS_VIA_KISS_INIT = "kiss_myloc_ok_i";
static const char *const PREF_GPS_ALLOW_SLEEP_WHILE_KISS = "gps_sleep_ok";
@ -171,6 +183,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

@ -3,13 +3,21 @@
#include <WebServer.h>
#include <ESPmDNS.h>
#include <Update.h>
#include <BG_RF95.h>
#include <esp_wifi.h>
#ifndef TASK_WEBSERVER
#define TASK_WEBSERVER
extern BG_RF95 rf95;
#ifdef HAS_SX127X
#include <BG_RF95.h>
extern BG_RF95 rf95;
#elif HAS_SX126X
#include <RadioLib.h>
#if defined(HELTEC_WIRELESS_TRACKER)
extern SX1262 radio;
#endif
#endif
#ifdef KISS_PROTOCOL
extern WiFiServer tncServer;
#endif

Wyświetl plik

@ -11,25 +11,24 @@
[env]
framework = arduino
monitor_speed = 115200
monitor_filters = esp32_exception_decoder
board_build.partitions = partitions.csv
board_build.embed_files =
board_build.embed_files =
data_embed/index.html.out
data_embed/style.css.out
data_embed/js.js.out
extra_scripts =
extra_scripts =
pre:tools/buildscript_versioning.py
pre:tools/remove_comment_from_files_data_embed.py
pre:tools/compress_assets.py
lib_deps =
RadioHead
lib_deps =
TinyGPSPlus
Adafruit SSD1306
Adafruit GFX Library
Adafruit Unified Sensor
Adafruit BusIO
https://github.com/SQ9MDD/AXP202X_Library.git
SparkFun u-blox Arduino Library
bblanchon/ArduinoJson
arcao/Syslog
build_flags =
-Wl,--gc-sections,--relax
-D 'KISS_PROTOCOL' ; leave enabled
@ -42,6 +41,7 @@ build_flags =
-D 'LONGITUDE_PRESET="00000.00W"' ; can be set from www interface
-D 'APRS_SYMBOL_TABLE="/"' ; can be set from www interface. Hint: if you need Symbol "&", you need to escape: "\&"
-D 'APRS_SYMBOL="["' ; can be set from www interface. Hint: if you need Symbol "&", you need to escape: "\&"
-D 'APRS_OBJECT_NAME=""' ; can be set from www interface
-D 'MY_COMMENT="Lora Tracker/iGate"' ; can be set from www interface
-D 'SHOW_ALT' ; can be set from www interface
; -D 'SHOW_BATT' ; can be set from www interface
@ -62,72 +62,179 @@ build_flags =
-D 'TNC_SELF_TELEMETRY_INTERVAL=3600L' ; can be set from www interface (seconds)
-D 'SHOW_OLED_TIME=15000' ; can be set from www interface (OLED Timeout)
[env:ttgo-t-beam-v1.0]
[libs_AXP192]
lib_deps =
https://github.com/SQ9MDD/AXP202X_Library.git
[libs_AXP2101]
lib_deps =
https://github.com/lewisxhe/XPowersLib
[libs_SSD1306]
lib_deps =
Adafruit SSD1306
Adafruit GFX Library
[libs_TFT]
lib_deps =
bodmer/TFT_eSPI@^2.5.43
[libs_SX127X]
lib_deps =
RadioHead
[libs_SX126X]
lib_deps =
jgromes/RadioLib @ 6.1.0
[env:ttgo-t-beam-v1_0]
platform = espressif32 @ 3.5.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
build_flags =
${env.build_flags}
-D T_BEAM_V1_0
-D ENABLE_WIFI
-D ENABLE_SYSLOG
-D ENABLE_BLUETOOTH
lib_deps =
${env.lib_deps}
${libs_AXP192.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:ttgo-t-beam-v0.7]
[env:ttgo-t-beam-v1_2]
platform = espressif32 @ 3.5.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
build_flags =
${env.build_flags}
-D T_BEAM_V1_2
-D ENABLE_WIFI
-D ENABLE_SYSLOG
#-D ENABLE_BLUETOOTH
lib_deps =
${env.lib_deps}
${libs_AXP2101.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:ttgo-t-beam-v0_7]
platform = espressif32 @ 3.5.0
board = ttgo-t-beam
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D ENABLE_SYSLOG
-D T_BEAM_V0_7
lib_deps =
${env.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:ttgo-lora32-v2.1]
[env:ttgo-lora32-v2_1]
platform = espressif32 @ 3.5.0
board = ttgo-lora32-v21
build_flags =
${env.build_flags}
build_flags =
${env.build_flags}
-D LORA32_21
-D ENABLE_WIFI
-D ENABLE_SYSLOG
-D ENABLE_BLUETOOTH
lib_deps =
${env.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:ttgo-lora32-v2]
platform = espressif32 @ 3.5.0
board = ttgo-lora32-v2
build_flags =
${env.build_flags}
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D ENABLE_SYSLOG
-D LORA32_2
lib_deps =
${env.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:ttgo-lora32-v1]
platform = espressif32 @ 3.5.0
board = ttgo-lora32-v1
build_flags =
${env.build_flags}
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D ENABLE_SYSLOG
-D LORA32_1
lib_deps =
${env.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:Heltec-WiFi-v1]
platform = espressif32 @ 3.5.0
board = heltec_wifi_kit_32
build_flags =
${env.build_flags}
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D ENABLE_SYSLOG
-D HELTEC_V1
lib_deps =
${env.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:Heltec-WiFi-v2]
platform = espressif32 @ 3.5.0
board = heltec_wifi_kit_32_v2
build_flags =
${env.build_flags}
build_flags =
${env.build_flags}
-D ENABLE_WIFI
-D ENABLE_SYSLOG
-D HELTEC_V2
lib_deps =
${env.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}
[env:ttgo-t-beam-v1.0-development]
[env:heltec-wireless-tracker]
platform = espressif32 @ 6.3.1
board = esp32-s3-devkitc-1
board_build.mcu = esp32s3
build_flags =
${env.build_flags}
-D HELTEC_WIRELESS_TRACKER
-D HAS_SX126X
-D ENABLE_WIFI
-D ENABLE_SYSLOG
#-D ENABLE_BLUETOOTH
-D SPI_FREQUENCY=27000000
-D USE_HSPI_PORT
-D ARDUINO_USB_MODE=1 # needed for serial console else you'd have to call USBSerial.printf instead of Serial.printf
-D ARDUINO_USB_CDC_ON_BOOT=1 #
-D HAS_TFT
-D USER_SETUP_LOADED
-D TFT_WIDTH=80
-D TFT_HEIGHT=160
-D ST7735_DRIVER
-D ST7735_GREENTAB160x80
-D TFT_RGB_ORDER=TFT_BGR
-D TFT_MOSI=42
-D TFT_SCLK=41
-D TFT_CS=38
-D TFT_DC=40
-D TFT_RST=39
-D TFT_BL=21
-D TFT_BACKLIGHT_ON=1
-D TOUCH_CS=-1
-D LOAD_GLCD
-D LOAD_FONT2
-D LOAD_FONT4
-D LOAD_FONT6
-D LOAD_FONT7
-D LOAD_FONT8
lib_deps =
${env.lib_deps}
${libs_SX126X.lib_deps}
${libs_SX127X.lib_deps} # needed for compiler dependencies (../lib/BG_RF95/)
${libs_TFT.lib_deps}
[env:ttgo-t-beam-v1_0-development]
platform = espressif32 @ 3.5.0
board = ttgo-t-beam
build_flags =
@ -138,5 +245,8 @@ build_flags =
-D ENABLE_SYSLOG
-D 'SYSLOG_IP="255.255.255.255"'
-D DEVELOPMENT_DEBUG
#lib_deps =
#${env.lib_deps}
lib_deps =
${env.lib_deps}
${libs_AXP192.lib_deps}
${libs_SX127X.lib_deps}
${libs_SSD1306.lib_deps}

Wyświetl plik

@ -6,6 +6,9 @@
SFE_UBLOX_GPS myGPS;
extern uint8_t usb_serial_data_type;
extern volatile boolean gps_task_enabled;
#ifdef ENABLE_WIFI
#include "wifi_clients.h"
#define MAX_GPS_WIFI_CLIENTS 6
@ -13,18 +16,30 @@ SFE_UBLOX_GPS myGPS;
#endif
// Pins for GPS
#ifdef T_BEAM_V1_0
#if defined(T_BEAM_V1_0) || defined(T_BEAM_V1_2)
static const int RXPin = 12, TXPin = 34;
#else
#elif defined(HELTEC_WIRELESS_TRACKER)
static const int RXPin = 34, TXPin = 33;
#else /* i.e. T_BEAM_V0_7, or lora32-device-with-self-attached-GPS */
static const int RXPin = 15, TXPin = 12;
#endif
static const uint32_t GPSBaud = 9600; //GPS
#ifdef LORA32_21
/* one user played with self-attached GPS on his LORA32 device. TODO: gps speed choosable in Web-Interface */
static const uint32_t GPSBaud = 57600; //GPS
#elif HELTEC_WIRELESS_TRACKER
static const uint32_t GPSBaud = 115200; //GPS
#else
static const uint32_t GPSBaud = 9600; //GPS
#endif
HardwareSerial gpsSerial(1); // TTGO has HW serial
TinyGPSPlus gps; // The TinyGPS++ object
bool gpsInitialized = false;
[[noreturn]] void taskGPS(void *parameter) {
reinitialize:
if (!gpsInitialized){
gpsSerial.begin(GPSBaud, SERIAL_8N1, TXPin, RXPin); //Startup HW serial for GPS
// set GPS parameters on restart
@ -43,13 +58,20 @@ bool gpsInitialized = false;
delay(1000);
}
}
gps_task_enabled = true;
esp_task_wdt_init(120, true); //enable panic so ESP32 restarts
// esp_task_wdt_init() has already been done in main task during setup()
esp_task_wdt_add(NULL); //add current thread to WDT watch
String gpsDataBuffer = " ";
for (;;) {
if (!gps_task_enabled) {
//gpsSerial.end(); // No, raises exception
esp_task_wdt_delete(NULL);
gpsInitialized = false;
vTaskSuspend(NULL);
goto reinitialize;
}
esp_task_wdt_reset();
#ifdef ENABLE_WIFI
check_for_new_clients(&gpsServer, gps_clients, MAX_GPS_WIFI_CLIENTS);
@ -57,23 +79,25 @@ bool gpsInitialized = false;
while (gpsSerial.available() > 0) {
char gpsChar = (char)gpsSerial.read();
gps.encode(gpsChar);
#ifdef ENABLE_WIFI
if (gpsChar == '$') {
gpsDataBuffer = String(gpsChar);
} else {
gpsDataBuffer += String(gpsChar);
if (gpsChar == '\n') {
if ((usb_serial_data_type & 4))
Serial.print(gpsDataBuffer);
#ifdef ENABLE_WIFI
iterateWifiClients([](WiFiClient *client, int clientIdx, const String *data){
if (client->connected()){
client->print(*data);
client->flush();
}
}, &gpsDataBuffer, gps_clients, MAX_GPS_WIFI_CLIENTS);
#endif
gpsDataBuffer = "";
}
}
#endif
}
vTaskDelay(100 / portTICK_PERIOD_MS);
}

Wyświetl plik

@ -2,11 +2,12 @@
#include <esp_task_wdt.h>
extern boolean enable_bluetooth;
extern uint8_t usb_serial_data_type;
extern boolean enable_bluetooth;
#ifdef ENABLE_BLUETOOTH
BluetoothSerial SerialBT;
extern boolean serial_bt_client_is_connected;
#endif
QueueHandle_t tncReceivedQueue = nullptr;
@ -46,7 +47,7 @@ void handleKISSData(char character, int bufferIndex) {
Serial.print(inTNCData);
}
#ifdef ENABLE_BLUETOOTH
if (enable_bluetooth && SerialBT.hasClient()) {
if (enable_bluetooth && serial_bt_client_is_connected) {
SerialBT.print(inTNCData);
}
#endif
@ -79,7 +80,7 @@ void handleKISSData(char character, int bufferIndex) {
tncReceivedQueue = xQueueCreate(4,sizeof(String *));
String *loraReceivedFrameString = nullptr;
esp_task_wdt_init(120, true); //enable panic so ESP32 restarts
// esp_task_wdt_init() has already been done in main task during setup()
esp_task_wdt_add(NULL); //add current thread to WDT watch
while (true) {
@ -91,7 +92,7 @@ void handleKISSData(char character, int bufferIndex) {
}
}
#ifdef ENABLE_BLUETOOTH
if (enable_bluetooth && SerialBT.hasClient()) {
if (enable_bluetooth && serial_bt_client_is_connected) {
while (SerialBT.available() > 0) {
char character = SerialBT.read();
handleKISSData(character, 1);
@ -114,7 +115,7 @@ void handleKISSData(char character, int bufferIndex) {
if (!usb_serial_data_type)
Serial.print(kissEncoded);
#ifdef ENABLE_BLUETOOTH
if (enable_bluetooth && SerialBT.hasClient()){
if (enable_bluetooth && serial_bt_client_is_connected){
SerialBT.print(kissEncoded);
}
#endif

Plik diff jest za duży Load Diff

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)
@ -44,5 +60,5 @@ with open("data_embed/index.html", "r") as f:
index_html_content = index_html_content.replace('<!--VERSION-->', version_string)
with open("data_embed/index.html.out", "w") as f:
with open("data_embed/index.html.tmp", "w") as f:
f.write(index_html_content)

Wyświetl plik

@ -1,8 +1,8 @@
import gzip
assets_list = {
'data_embed/index.html.out': 'data_embed/index.html.out',
'data_embed/js.js': 'data_embed/js.js.out',
'data_embed/style.css': 'data_embed/style.css.out',
'data_embed/index.html.tmp2': 'data_embed/index.html.out',
'data_embed/js.js.tmp': 'data_embed/js.js.out',
'data_embed/style.css.tmp': 'data_embed/style.css.out',
}

Wyświetl plik

@ -0,0 +1,125 @@
#!/usr/bin/python3
# remove-comment-from-code.py
# removes comments and indents.
# works as a filter and reads from stdin.
# keeps lines with copyright or license information
# reason: on a smal esp32 device we needed to gain space for
# flash storage, in concrete: style.css
# options: -d "// ^#", meaning also one-line-comments like //,
# and lines beginning with '#'
#
# usage: remove-comment-from-code.py < style.css.orig > style.css
#
# examples:
# remove-comment-from-code.py -d "// ^#"
# in out
# -----------------------+-------------
# foo /* bar */ abc foo abc
# foo // bar abc foo
# // bar abc line ignored
# /* this is a comment */ line ignored
# foo /* this is a foo bar
# comment text */ bar
# # foo line ignored
# foo # bar foo
# foo bar foo bar
#
# (c) 2024-03-19 Thomas Osterried <dl9sau@darc.de>. License: GPL
import sys
one_line_comment_chars = []
def usage():
sys.stderr.write("usage: %s [-d x]\n" % sys.argv[0])
sys.stderr.write(" with x i.e. \"// ^#\", meaning also one-line-comments)\n")
sys.stderr.write(" like //, and lines beginning with '#'\n")
sys.exit(1)
def remove_tabs_and_reduce_blanks_to_one_and_strip(s):
return s.replace("\t", " ").replace(" ", " ").replace(" ", " ").strip()
def set_one_line_comment_chars(s):
global one_line_comment_chars
if type(s) == list and len(s):
one_line_comment_chars = s
elif type(s) == str and len(s):
one_line_comment_chars = s.split(" ")
else:
one_line_comment_chars = []
def do_remove_comment_from_code(file_in = None, file_out = None):
commentStart = -1
line_out = ""
if not file_in:
file_in = sys.stdin
if not file_out:
file_out = sys.stdout
while True:
line_in = file_in.readline()
if line_in == "": break
line_in = line_in.rstrip()
if commentStart == -1:
commentStart = line_in.find("/*")
if commentStart > -1:
if len(line_out) > 0 and not line_out[len(line_out)-1].isspace():
line_out = line_out + " "
line_out = line_out + line_in
commentEnd = line_out.find("*/")
if commentEnd == -1:
continue
comment = line_out[commentStart+2:commentEnd]
comment = comment.lower()
if comment.find("license") == -1 and comment.find("copyright") == -1:
line_out = line_out[:commentStart] + " " + line_out[commentEnd+2:]
# else:
# leave comment as is
commentStart = -1
else:
line_out = line_in
for s in one_line_comment_chars:
if s[0] == '^':
if line_in.startswith(s[1:]):
line_out = ""
break
else:
comment_pos = line_in.find(s)
if comment_pos > -1:
line_out = line_in[:comment_pos]
break
line_out = remove_tabs_and_reduce_blanks_to_one_and_strip(line_out)
if len(line_out) > 0:
file_out.write(line_out + "\n")
line_out = ""
# main()
if __name__ == '__main__':
argc = len(sys.argv)
if argc > 1:
if argc > 2:
if sys.argv[1] == "-d":
set_one_line_comment_chars(sys.argv[2])
# cave: not valid for css, because ^# is a valid part of syntax
for s in one_line_comment_chars:
if s[0] == "^" and len(s) < 2:
usage()
else:
if len(s) < 1:
usage()
else:
usage()
else:
usage()
do_remove_comment_from_code()

Wyświetl plik

@ -0,0 +1,21 @@
import remove_comment_from_code
assets_list = {
'data_embed/index.html.tmp': 'data_embed/index.html.tmp2',
'data_embed/js.js': 'data_embed/js.js.tmp',
'data_embed/style.css': 'data_embed/style.css.tmp'
}
for src_file_name, out_file_name in assets_list.items():
file_in = open(src_file_name, 'r')
file_out = open(out_file_name, 'w')
try:
if src_file_name.find(".js") > -1:
remove_comment_from_code.set_one_line_comment_chars("//")
else:
remove_comment_from_code.set_one_line_comment_chars([])
remove_comment_from_code.do_remove_comment_from_code(file_in, file_out)
except:
file_out.write(file_in.read())