jonask1337 / esp-lwip

ESP-IDF lwIP library with NAT
Other
53 stars 10 forks source link

Is it possible to use this on arduino IDE? #7

Closed DynamicLoader closed 3 years ago

DynamicLoader commented 4 years ago

It can be used with IDF,but what about Arduino IDE?

I try to copy it to the Arduino IDE,but there is no such function in liblwip.a.What can I do?

jonask1337 commented 4 years ago

Hi, I looked into it and got it to work with Arduino IDE. You can use the lib-builder to create the custom lwip library with NAT required to run the WiFi repeater code in the Arduino IDE.

I will probably make a new repository with the sketch for the WiFi repeater and a detailed instruction in the next days, but here is what I did in short:

1. Follow the first three steps of the "Get Started" section from this repository URL: https://github.com/jonask1337/esp32-arduino-espidf-comp-wifirepeater

The ESP-IDF with the custom lwIP library with NAT should now be installed. (Make sure that the $IDF_PATH variable is defined and points to this ESP-IDF installation)

2. Follow the lib-builder instructions to build the libaries using the custom ESP-IDF.

Make sure to enable the "Enable copy between Layer2 and Layer3 packets" option when editing the sdkconfig. It can be found in Component config -> LWIP

Note: Before executing the ./tools/install-esp-idf.sh command I think you have to comment out the following code from the /tools/install-esp-idf.sh script:

#if [ -x $idf_was_installed ]; then
#   git -C $IDF_PATH fetch origin && git -C $IDF_PATH pull origin $IDF_BRANCH
#   git -C $IDF_PATH submodule update --init --recursive
#else
#   git -C $IDF_PATH submodule update --init --recursive
#   cd $IDF_PATH && python -m pip install -r requirements.txt && cd "$AR_ROOT"
#fi

Otherwise the custom lwIP library with NAT probably will be replaced again with the original.

3. Copy the libraries to the Arduino IDE using the lib-builder tool ./tools/copy-to-arduino.sh

Now the necessary libraries should be available in Arduino IDE to create a sketch using the code from the main.cpp from this repository and you should be able to build and flash the sketch to the esp32 via the Arduino IDE

DynamicLoader commented 4 years ago

I tried it on Arduino IDE,and found a easy way to use it: ESP32-NAPT-For-Arduino

pablofr918 commented 3 years ago

Hi Jonask, did you finally make the repo for the Arduino IDE? I'm trying to get a code of ESP32 wifi repeater/extender in Arduino IDE but everything I find is for flashing directly or using MAKE.

I got a question, I'm new in this and when I code I do it from Arduino IDE. But there is a lot of repo that can´t be used as library in the IDE because they are in MAKE format, but I don't know how to use it. I would like to know if there is the possibility of installing those make lib and then use them in the IDE to add it to my project. Or when those repo are compiled with make, there is no way to add new stuff to the code.

jonask1337 commented 3 years ago

Hi @pablofr918, I did not make a separate repository for an Arduino example because the solution described in my previous comment was way more complicated than the one of Lucy2003. Maybe @Lucy2003 could share the solution again or give an update on it.

Regarding your second question I guess with the libraries in MAKE format you are referring to libraries created using the ESP-IDF? I do not know if there is an easy general way to use ESP-IDF projects in the Arduino IDE. I think it depends on the project and the best would be to ask the author of the corresponding project if it is possible.

EDIT: Since NAT is now included in the ESP-IDF lwip library from Espressif you don't need this library anymore. To get code for a wifi repeater working in the Arduino IDE I think you still have to enable the NAT feature. This seems to be a more recent example. Although it looks like platformio is used there as IDE, the process for Arduino IDE should be similar. I might try it out myself and then give an update.