OpenAstroTech / OpenAstroTracker-Desktop

Software related to the OAT used in Desktop environments
29 stars 12 forks source link

Does not scan WiFi networks.. #49

Closed illigtr closed 3 months ago

illigtr commented 3 months ago

According to the documentation https://wiki.openastrotech.com/en/Knowledge/Software/OpenAstroTracker/OATControl one should be able to pickup any OATscope on WiFi. This does not appear to work and there is no other documentation on how to debug this.

I have compiled OAT for ESP32 and have had it both in infrastructure mode and AP mode and BOTH do not work with OAT-Desktop, even if I am connected on the same wifi network. Is there some addtional information on this feature?

OAT-Desktop version: 1.1.1.0 ESP32 OAT firmware: 1.13.1

ClutchplateDude commented 3 months ago

Did you put your SSID and password into your config file?

illigtr commented 3 months ago

Yes, in OAT...is there a place in OAT desktop?... the option for wifi are not available...

On Mon, Apr 1, 2024, 12:24 Lutz @.***> wrote:

Did you put your SSID and password into your config file?

— Reply to this email directly, view it on GitHub https://github.com/OpenAstroTech/OpenAstroTracker-Desktop/issues/49#issuecomment-2030093209, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4UNTTSAL44URFWLJXADEHTY3GC2NAVCNFSM6AAAAABFRWBOSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZQGA4TGMRQHE . You are receiving this because you authored the thread.Message ID: @.***>

ClutchplateDude commented 3 months ago

You don't need to set anything in OATControl. I suggest enabling debugging in the firmware and looking what's happening

illigtr commented 3 months ago

Thanks, but I don't think that will help. I have spent 2 weeks familiarizing myself with the firmware, including making corrections and additions to use it with an ESP32S3. The firmware works fine and both INFRA and AP mode of WIFI are working and can be seen in the debug, It works with OAT-Desktop in serial mode as well as ASCOM mode. The issue is OAT-Desktop in WiFi mode.

Looking at this document: https://wiki.openastrotech.com/Knowledge/Software/OpenAstroTracker/OATControl one can see a screenshot showing the WiFi option:

image

For me the wifi section NEVER appears. It there any debugging information in OAT Desktop? Is there a configuration file somewhere? How does OTA Desktop build potential wifi candidates in the selection list? Is it looking for specific IP addresses, is it looking for specific host names? Is it looking for specific ports? Which ones? What does it expect a port to answer to?

ClutchplateDude commented 3 months ago

Can we use the correct name for what app you are using? I assume you mean OATControl when you say OTA Desktop?

OATControl does emit logs, there's a button on the UI that will open the folder for logs. Also the firmware will emit debugging logs if you set DEBUG_LEVEL. Make sure to include DEBUG_WIFI in the flags. The current firmware will only work in Wifi mode if ESP32 is defined.

I would suggest enabling debugging on firmware and then looking at both firmware output and the OATControl log file to see why nothing is happening.

illigtr commented 3 months ago

Pardon me, I just realized the GitHub repository is called OpenAstroTracker-Desktop, but the actually the components are OATControl, ASCOM, etc. I meant OATControl.

Thank you for the additional and valuable information concerning the process that OATControl uses to determine valid WiFi candidates. I can now test various methods to determine handshake protocol and what is ultimately happening or not.

illigtr commented 3 months ago

Ok. some progress....

The following example is in instrastructure mode.

16:26:02.330 -> [2484]{24}ms:327044B: [WIFI]: Starting up Wifi As Mode 0
16:26:02.330 -> 
16:26:02.330 -> [2515]{31}ms:327044B: [WIFI]: Starting Infrastructure Mode Wifi
16:26:02.364 -> [2549]{34}ms:327060B: [WIFI]:    with host name: OATScope
16:26:02.397 -> [2580]{31}ms:327060B: [WIFI]:          for SSID: ********
16:26:02.431 -> [2608]{28}ms:327060B: [WIFI]:       and WPA key: ***************
16:26:02.508 -> [  2656][D][WiFiGeneric.cpp:1039] _eventCallback(): Arduino Event: 0 - WIFI_READY
16:26:02.543 -> [  2690][V][WiFiGeneric.cpp:340] _arduino_event_cb(): STA Started
16:26:02.581 -> [  2692][V][WiFiGeneric.cpp:97] set_esp_interface_ip(): Configuring Station static IP: 0.0.0.0, MASK: 0.0.0.0, GW: 0.0.0.0
16:26:02.670 -> [  2692][D][WiFiGeneric.cpp:1039] _eventCallback(): Arduino Event: 2 - STA_START
16:26:02.670 -> [  2828][V][WiFiGeneric.cpp:355] _arduino_event_cb(): STA Connected: SSID: X17N, BSSID: e8:9c:25:00:55:68, Channel: 1, Auth: WPA2_PSK
16:26:02.738 -> [  2844][D][WiFiGeneric.cpp:1039] _eventCallback(): Arduino Event: 4 - STA_CONNECTED
16:26:02.803 -> [  2861][V][WiFiGeneric.cpp:369] _arduino_event_cb(): STA Got New IP:10.254.254.149
16:26:02.836 -> [  2934][D][WiFiGeneric.cpp:1039] _eventCallback(): Arduino Event: 7 - STA_GOT_IP
16:26:02.869 -> [  2977][D][WiFiGeneric.cpp:1102] _eventCallback(): STA IP: 10.254.254.149, MASK: 255.255.255.0, GW: 10.254.254.1

First my firmware WiFi logging never shows "[WIFI]: connected to...." from WifiControl::loop().

I was able to determine that the code that starts the tcp listening port of 4030 is never called unless inSerialControl is TRUE. This can be set from the LCD panel, CTRL, Serial Display.

Doing so, I now get this addtional info in the WiFi logs.

16:34:26.911 -> [507038]{3077}ms:244984B: [WIFI]: Connected status changed to Connected!
16:34:26.911 -> [507077][V][WiFiServer.h:42] WiFiServer(): WiFiServer::WiFiServer(port=4030, ...)
16:34:26.943 -> [507078]{40}ms:242364B: [WIFI]: Connecting to SSID X17N at 10.254.254.149:4030
16:34:36.387 -> [516528]{9450}ms:242268B: [WIFIUDP]: Received 10 bytes from 10.254.254.83, port 4031
16:34:36.421 -> [516573]{45}ms:242360B: [WIFIUDP]: Received: skyfi:OAT?
16:34:36.468 -> [516604]{31}ms:241996B: [WIFIUDP]: Replied: skyfi:OATScope@10.254.254.149
16:34:43.746 -> [523909]{7305}ms:242268B: [WIFIUDP]: Received 10 bytes from 10.254.254.83, port 4031
16:34:43.812 -> [523954]{45}ms:242360B: [WIFIUDP]: Received: skyfi:OAT?

I fire up OAT-Control and scan or rescan for available connections. Nothing. Each rescan results the the last 2 WIFIUDP log entries.

I have test with PuTTY as well, I can not connect to 4030 and send commands... but as you can see OAT-Control never includes my ESP32 in the list, even though it is responding (now) to OAT-Control.

I just waited several minutes and retested and now I DO SEE Wifi:OATScope in the connection list.

Now attempting to connect... but after 20 seconds "communications failed". OAT-Control hangs and I have to kill the session. Restart. Available connections shows my ESP32. Attempt connection by (Next). This time "Unrecognizable firmware version '0#'" WiFi logs does not show any further communication.

WIFI LOGS

16:55:28.359 -> [1768514]{4531}ms:228776B: [WIFIUDP]: Received 10 bytes from 10.254.254.83, port 4031
16:55:28.405 -> [1768559]{45}ms:228868B: [WIFIUDP]: Received: skyfi:OAT?
16:55:28.405 -> [1768590]{31}ms:228644B: [WIFIUDP]: Replied: skyfi:OATScope@10.254.254.149
illigtr commented 3 months ago

Ok. I have OAT-Control finally working over WiFi. The ESP32 signal strength was a bit weak so I reoriented it and now OAT-Control functions well. Thank for the information that allowed me to debug this issue.

ClutchplateDude commented 3 months ago

Awesome. Next time you run into an issue, you might want to use Discord instead, it's generally faster and more people are there to help. (I just happened to be on the repo today, so you got lucky :-) ).