Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for direct APRS messages over WiFi #43

Open
kareiva opened this issue Oct 13, 2021 · 15 comments
Open

Support for direct APRS messages over WiFi #43

kareiva opened this issue Oct 13, 2021 · 15 comments

Comments

@kareiva
Copy link
Contributor

kareiva commented Oct 13, 2021

Since the tracker is supposed to be off-grid, I'm considering reusing the WiFi AP (or even BLE) for a small web service to send APRS messages over RF

It would be something similar to the below (and hopefully the iGate will be able to pick it up):
https://github.com/TheNico14/LoRaMessenger

Is anyone interested?

@peterus
Copy link
Member

peterus commented Oct 13, 2021

@kareiva this feature is on my loooong list for "features which i want to habe in the future" 😂

my idea was that the esp is providing an AP with a web service to manage the configuration and to get access to send messages and other stuff.
BLE is I think to complicated to support all devices (android, apple, netbooks or pc's) etc.

i would like to use my web-configuration implementation as this is perfectly working with the already used json. there is still some work to do in the lib as currently as an example no arrays are supported.

@kareiva
Copy link
Contributor Author

kareiva commented Oct 13, 2021

Yes, the AP is nice, but BLE's complexity pays off with keeping the phone online. Connecting to no-internet AP has to be backed by background 4G/LTE connectivity which probably requires extra configuration on the phone.

But let's go with AP first. I will have a look at the web configuration and return. At first glance, there should be no problem to leverage that library.

@peterus
Copy link
Member

peterus commented Oct 13, 2021

@kareiva you are right! having still access to LTE/... is definitely better than having no connection at all.
I did some research now on BLE as I have absolutely no experience with Bluetooth at all. Looks like BLE is already very supported from many devices. But it has a downside: looks like there is no way to create some sort of webserver on the ESP which is using BLE, just some text an values. This means that we have to create our own app for various different devices which is not really the way to go for me.
Or do you have some other tipps for BLE?

please let me know with a ticket if you want to do some changes 😉 not that we are working on the same 😊

@kareiva
Copy link
Contributor Author

kareiva commented Oct 19, 2021

If you're already working on your web configuration, it's fine, I'd like to see at least the framework of that first before I conclude to any action. A W-I-P pull request would be nice. Else, I'd be implementing something similar to this:
https://github.com/TheNico14/LoRaMessenger/blob/master/Code/src/webserver.cpp

@kareiva
Copy link
Contributor Author

kareiva commented Oct 19, 2021

Here's an example - @peterus, please have a look if I am on a correct path:
kareiva@6c3411c

@peterus
Copy link
Member

peterus commented Oct 19, 2021

@kareiva thanks for the first implementation. I do not habe something currently, so go ahead 👍

I was thinking a little bit and I was coming to the conclusion to first skip my ESP-Config Lib. I have to redesign some parts and for the first tests to send a message or to have some logs it is not important -> skip the ESP-Config lib and use the configuration class as you are already doing 😉

Currently I can see that you are using the ESP in the client mode to connect to a wifi. which is good, because on the mobile you should than have still internet and the ESP has internet to!

From my side you can continue with your implementation after a quick cleanup 😉
please create a MR as i have some small suggestions to your code. It is easier in a MR than here in a ticket 😊

@kareiva
Copy link
Contributor Author

kareiva commented Oct 19, 2021

Sure, this is just the simple piece of code demonstrating my intent. I will open up a PR with the below:

  1. option to choose between AP and client mode
  2. cleaner code, possibly refactored to a separate library

@kareiva
Copy link
Contributor Author

kareiva commented Oct 21, 2021

So few updates from my end, tested out the example web-configuration and the GET /page is giving me some hard time, but just to let you know, I'm diving into that a bit. Here's what I'm getting on the serial monitor when issuing the GET request:

Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC      : 0x4000c3f0  PS      : 0x00060630  A0      : 0x800e8d8e  A1      : 0x3ffdd1a0
A2      : 0x3ffe4374  A3      : 0x00000032  A4      : 0x00003ffd  A5      : 0x8df26c27
A6      : 0x00000000  A7      : 0x00000000  A8      : 0x00000000  A9      : 0x00000032
A10     : 0x00000001  A11     : 0x8df26c27  A12     : 0x3ffc290c  A13     : 0x8df26c27
A14     : 0x3ffdded0  A15     : 0x3ffdded0  SAR     : 0x00000008  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000032  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000

Backtrace: 0x4000c3f0:0x3ffdd1a0 0x400e8d8b:0x3ffdd1c0 0x400e8f23:0x3ffdd1e0 0x400e8f3f:0x3ffdd200 0x400d21b3:0x3ffdd220 0x400d331a:0x3ffdd280 0x400d380f:0x3ffdd380 0x400e0dc5:0x3ffdd3c0 0x400de7e1:0x3ffdd400 0x400de8ae:0x3ffdd440 0x400deb2d:0x3ffdd480 0x40171ace:0x3ffdd4a0 0x40171b4d:0x3ffdd4e0 0x40172266:0x3ffdd500 0x400905f5:0x3ffdd530
  #0  0x4000c3f0:0x3ffdd1a0 in ?? ??:0
  #1  0x400e8d8b:0x3ffdd1c0 in String::copy(char const*, unsigned int) at C:\Users\simon\.platformio\packages\framework-arduinoespressif32@3.10004.210126\cores\esp32/WString.cpp:850
  #2  0x400e8f23:0x3ffdd1e0 in String::operator=(String const&) at C:\Users\simon\.platformio\packages\framework-arduinoespressif32@3.10004.210126\cores\esp32/WString.cpp:850
  #3  0x400e8f3f:0x3ffdd200 in String::String(String const&) at C:\Users\simon\.platformio\packages\framework-arduinoespressif32@3.10004.210126\cores\esp32/WString.cpp:850
  #4  0x400d21b3:0x3ffdd220 in ConfigPage::getVisibleName() const at .pio/libdeps/ttgo-t-beam-v1/ESP-Config/src/ConfigStructure.h:20
      (inlined by) ConfigHTML::createHTMLcode(ConfigPage const*, String const&) at .pio/libdeps/ttgo-t-beam-v1/ESP-Config/src/ConfigHTML.h:151
  #5  0x400d331a:0x3ffdd280 in ConfigHTML::createHTMLForm(ConfigPage*, String const&) at .pio/libdeps/ttgo-t-beam-v1/ESP-Config/src/ConfigHTML.h:54
  #6  0x400d380f:0x3ffdd380 in ConfigHTML::registerWebServer(AsyncWebServer&, String const&)::{lambda(AsyncWebServerRequest*)#1}::operator()(AsyncWebServerRequest*) const at .pio/libdeps/ttgo-t-beam-v1/ESP-Config/src/ConfigHTML.h:34
      (inlined by) std::_Function_handler<void (AsyncWebServerRequest*), ConfigHTML::registerWebServer(AsyncWebServer&, String const&)::{lambda(AsyncWebServerRequest*)#1}>::_M_invoke(std::_Any_data const&, AsyncWebServerRequest*&&) at c:\users\simon\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\5.2.0/functional:1871
  #7  0x400e0dc5:0x3ffdd3c0 in std::function<void (AsyncWebServerRequest*)>::operator()(AsyncWebServerRequest*) const at .pio\libdeps\ttgo-t-beam-v1\ESP Async WebServer\src/ESPAsyncWebServer.h:310
      (inlined by) AsyncCallbackWebHandler::handleRequest(AsyncWebServerRequest*) at .pio\libdeps\ttgo-t-beam-v1\ESP Async WebServer\src/WebHandlerImpl.h:118
  #8  0x400de7e1:0x3ffdd400 in AsyncWebServerRequest::_parseLine() at C:\Users\simon\.platformio\packages\framework-arduinoespressif32@3.10004.210126\cores\esp32/WString.h:85
  #9  0x400de8ae:0x3ffdd440 in AsyncWebServerRequest::_onData(void*, unsigned int) at C:\Users\simon\.platformio\packages\framework-arduinoespressif32@3.10004.210126\cores\esp32/WString.h:85
  #10 0x400deb2d:0x3ffdd480 in std::_Function_handler<void (void*, AsyncClient*, void*, unsigned int), AsyncWebServerRequest::AsyncWebServerRequest(AsyncWebServer*, AsyncClient*)::{lambda(void*, AsyncClient*, void*, unsigned int)#8}>::_M_invoke(std::_Any_data const&, void*&&, AsyncClient*&&, std::_Any_data const&, unsigned int&&) at C:\Users\simon\.platformio\packages\framework-arduinoespressif32@3.10004.210126\cores\esp32/WString.h:85 
      (inlined by) _M_invoke at c:\users\simon\.platformio\packages\toolchain-xtensa32\xtensa-esp32-elf\include\c++\5.2.0/functional:1871
  #11 0x40171ace:0x3ffdd4a0 in std::function<void (void*, AsyncClient*, void*, unsigned int)>::operator()(void*, AsyncClient*, void*, unsigned int) const at .pio\libdeps\ttgo-t-beam-v1\AsyncTCP\src/AsyncTCP.cpp:1020     
      (inlined by) AsyncClient::_recv(tcp_pcb*, pbuf*, signed char) at .pio\libdeps\ttgo-t-beam-v1\AsyncTCP\src/AsyncTCP.cpp:915
  #12 0x40171b4d:0x3ffdd4e0 in AsyncClient::_s_recv(void*, tcp_pcb*, pbuf*, signed char) at .pio\libdeps\ttgo-t-beam-v1\AsyncTCP\src/AsyncTCP.cpp:1020
  #13 0x40172266:0x3ffdd500 in _async_service_task(void*) at .pio\libdeps\ttgo-t-beam-v1\AsyncTCP\src/AsyncTCP.cpp:1020
      (inlined by) _async_service_task at .pio\libdeps\ttgo-t-beam-v1\AsyncTCP\src/AsyncTCP.cpp:194
  #14 0x400905f5:0x3ffdd530 in vPortTaskWrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/port.c:355 (discriminator 1)

Rebooting...
ets Jun  8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:1044
load:0x40078000,len:8896
load:0x40080400,len:5828
entry 0x400806ac

@peterus
Copy link
Member

peterus commented Oct 21, 2021

@kareiva can you show me the code? i had this issue when i startet the webserver and the esp had no connection to a wifi.

@kareiva
Copy link
Contributor Author

kareiva commented Oct 21, 2021

@peterus not much changed since the example. the webserver starts after the wifi connection:

https://github.com/kareiva/LoRa_APRS_Tracker/compare/master...kareiva:wifi_ap?expand=1

@kareiva
Copy link
Contributor Author

kareiva commented Oct 21, 2021

Okay @peterus, I seem to have figured this out by moving the code around in the setup() section - stay tuned.

@kareiva
Copy link
Contributor Author

kareiva commented Oct 21, 2021

Now facing some issues when the webserver saves the JSON configuration under the parent element which equals the page name, example:

{"index":{"section":{ ... }}}

The tracker.json does not have a single parent element, therefore I think I need to hack the saveConfig method so that it can generate JSON by skipping the parent element. Your thoughts?

@peterus
Copy link
Member

peterus commented Oct 21, 2021

please leave the configuration for the moment. I need to change here a lot of stuff, so the interface will be heavily changing in the future.

You can start to develop the webinterface to show maybe the status or to send the messages.

@kareiva
Copy link
Contributor Author

kareiva commented Oct 21, 2021

To send the messages, the APRS decoder library also needs tweaking. It should literally support both decoding and encoding. I'll start working on a fork.

@peterus
Copy link
Member

peterus commented Oct 21, 2021

🙈 I am NOW redesigning the lib.

@peterus peterus changed the title Support for direct APRS messages over WiFi AP - anyone interested? Support for direct APRS messages over WiFi Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants