i-am-grub / VRxC_ELRS

ExpressLRS VRx Controller Plugin for RotorHazard
MIT License
6 stars 3 forks source link

Couldnt find backpack #1

Closed lesharodin closed 7 months ago

lesharodin commented 7 months ago

Windows + esp32 (fresh fw) + beta3 plugin Start log: v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM6 - It detects port correctly Could not find connected backpack. Ending connector thread.

I added extra logger to see if it detect a port

        for port in ports:
            s.port = port.device

            try:
                s.open()
                logger.info(f"Attempting to find backpack on {port.device}")
            except:
                continue

Tried to replug esp several times, didt help

For some reason it didnt fall back to logger.warning('Failed to write to open serial device. Attempting to connect to new device...')

Only straight to closing port

i-am-grub commented 7 months ago

What board(s) are you using again? Is it just the standard DevKitC?

lesharodin commented 7 months ago

What board(s) are you using again? Is it just the standard DevKitC?

Just a standart NodeMCU ESP32 boards, I dont think the problem is with boards because if flashes well and it worked well on previous versions.

i-am-grub commented 7 months ago

What board(s) are you using again? Is it just the standard DevKitC?

Just a standart NodeMCU ESP32 boards, I dont think the problem is with boards because if flashes well and it worked well on previous versions.

The plugin has been primarily been developed on a Windows PC, so initially I don't think the code base is the issue right now. You've mentioned having issues with other beta versions in the past, especially on Windows, so I wonder it if could be a driver issue.

Drivers for the typical USB to serial converter chips that are used on the ESP32s can be found here

i-am-grub commented 7 months ago

Another thing to try is to add a logging line here

It could be closing the port because it wasn't receiving the right message from the esp32

lesharodin commented 7 months ago

Another thing to try is to add a logging line here

It could be closing the port because it wasn't receiving the right message from the esp32

Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM7 Could not find connected backpack. Ending connector thread.

Added logger to line https://github.com/i-am-grub/VRxC_ELRS/blob/8fc3968589f4375de5fd89bfb5bc57ebcab23aa5/elrsBackpack.py#L170 and it doesnt apper in log

image

lesharodin commented 7 months ago

What board(s) are you using again? Is it just the standard DevKitC?

Just a standart NodeMCU ESP32 boards, I dont think the problem is with boards because if flashes well and it worked well on previous versions.

The plugin has been primarily been developed on a Windows PC, so initially I don't think the code base is the issue right now. You've mentioned having issues with other beta versions in the past, especially on Windows, so I wonder it if could be a driver issue.

Drivers for the typical USB to serial converter chips that are used on the ESP32s can be found here

I dont think its a driver issue, I cant flash esp any time no problem. I can run pkendall64 test message code no problem too. (https://github.com/ExpressLRS/Backpack/pull/96) I allready tried to uninstall/install recomended drivers.

i-am-grub commented 7 months ago

Does adding logger.info(response) before what's currently in line 154 give you anything?

lesharodin commented 7 months ago

Does adding logger.info(response) before what's currently in line 154 give you anything?

Yes

Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM7 [0, 248, 120, 120, 120, 120, 0, 128] Could not find connected backpack. Ending connector thread.

i-am-grub commented 7 months ago

Does adding logger.info(response) before what's currently in line 154 give you anything?

Yes

Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM7 [0, 248, 120, 120, 120, 120, 0, 128] Could not find connected backpack. Ending connector thread.

So it looks like its an issue with the backpack. the proper response should be [36, 88, 62, 0, 128, 3, 6, 0]

lesharodin commented 7 months ago

Does adding logger.info(response) before what's currently in line 154 give you anything?

Yes Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM7 [0, 248, 120, 120, 120, 120, 0, 128] Could not find connected backpack. Ending connector thread.

So it looks like its an issue with the backpack. the proper response should be [36, 88, 62, 0, 128, 3, 6, 0]

This is from another ESP module

Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM1 [36, 88, 62, 0, 16, 0, 6, 0] Could not find connected backpack. Ending connector thread.

i-am-grub commented 7 months ago

If you change msptypes.MSP_ELRS_BACKPACK_SET_MODE to msptypes.MSP_ELRS_GET_BACKPACK_VERSION here, that should get the second ESP module to work with the old backpack firmware.

I thought that the firmware in the beta 2 was suppose to support that, but it looks like I forgot about the config changes I made for the elrs pull request. I'll just those update, thanks for the help!

lesharodin commented 7 months ago

If you change msptypes.MSP_ELRS_BACKPACK_SET_MODE to msptypes.MSP_ELRS_GET_BACKPACK_VERSION here, that should get the second ESP module to work with the old backpack firmware.

I thought that the firmware in the beta 2 was suppose to support that, but it looks like I forgot about the config changes I made for the elrs pull request. I'll just those update, thanks for the help!

Yes, it works now:

v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM1 [36, 88, 62, 0, 16, 0, 6, 0] Connected to backpack on COM1 Backpack version: master

lesharodin commented 7 months ago

Maybe you need to leave that extra loggers in code just for future user debugging :)

i-am-grub commented 7 months ago

yup you are right, they are going to be pushed up to master fairly soon. If you wanted to test with the updated firmware, I did switch out the esp32 firmware that was included with the beta.3 release

lesharodin commented 7 months ago

yup you are right, they are going to be pushed up to master fairly soon. If you wanted to test with the updated firmware, I did switch out the esp32 firmware that was included with the beta.3 release

Flashed with https://github.com/i-am-grub/VRxC_ELRS/releases/download/v1.0.0-beta.3/firmware-esp32.zip And return https://github.com/i-am-grub/VRxC_ELRS/blob/8fc3968589f4375de5fd89bfb5bc57ebcab23aa5/elrsBackpack.py#L160

Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM1 [120, 128, 0, 120, 128, 120, 0, 120] Could not find connected backpack. Ending connector thread.

lesharodin commented 7 months ago

Hmm now its connected.. Didnt change anything

Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM7 [36, 88, 62, 0, 128, 3, 6, 0] Connected to backpack on COM7 Backpack version: master

Another ESP too (reflashed)

v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM6 [36, 88, 62, 0, 128, 3, 6, 0] Connected to backpack on COM6 Backpack version: master

i-am-grub commented 7 months ago

Every time the esp is rebooted, it will send out a bunch of messages over serial during it's startup process. If Windows tries to communicate too early, it receives a bunch of junk back as a response as shown in one of your earlier messages.

lesharodin commented 7 months ago

I can test esp8286 too, shoud I build it from you PR https://github.com/ExpressLRS/Backpack/pull/114 ?

i-am-grub commented 7 months ago

yes please. I don't have any firmware currently compiled for the 8266 yet

lesharodin commented 7 months ago

yes please. I don't have any firmware currently compiled for the 8266 yet

Esp8266 works too Loaded plugin module VRxC_ELRS v1.0.0-beta.3 Attempting to find backpack Attempting to find backpack on COM6 [36, 88, 62, 0, 128, 3, 6, 0] Connected to backpack on COM6 Backpack version: master

didnt actually test osd messages yet, will test later, but it was working with diferent code before

i-am-grub commented 7 months ago

Just had some new devkits show up, and they gave me the same issue where they wouldn't connect to Windows. it looks like adding in this sleep fixes it for some reason.

sleep