'tcpip_adapter_init' has been deprecated
This commit is contained in:
@@ -73,29 +73,11 @@ __NOTE__
|
|||||||
Check [here](http://www.ti.com/lit/an/slla337/slla337.pdf).
|
Check [here](http://www.ti.com/lit/an/slla337/slla337.pdf).
|
||||||
|
|
||||||
|
|
||||||
# Installation for ESP32
|
# Installation
|
||||||
```
|
```
|
||||||
git clone https://github.com/nopnop2002/esp-idf-can2http
|
git clone https://github.com/nopnop2002/esp-idf-can2http
|
||||||
cd esp-idf-can2http
|
cd esp-idf-can2http
|
||||||
idf.py set-target esp32
|
idf.py set-target {esp32/esp32s2/esp32c3}
|
||||||
idf.py menuconfig
|
|
||||||
idf.py flash
|
|
||||||
```
|
|
||||||
|
|
||||||
# Installation for ESP32-S2
|
|
||||||
```
|
|
||||||
git clone https://github.com/nopnop2002/esp-idf-can2http
|
|
||||||
cd esp-idf-can2http
|
|
||||||
idf.py set-target esp32s2
|
|
||||||
idf.py menuconfig
|
|
||||||
idf.py flash
|
|
||||||
```
|
|
||||||
|
|
||||||
# Installation for ESP32-C3
|
|
||||||
```
|
|
||||||
git clone https://github.com/nopnop2002/esp-idf-can2http
|
|
||||||
cd esp-idf-can2http
|
|
||||||
idf.py set-target esp32c3
|
|
||||||
idf.py menuconfig
|
idf.py menuconfig
|
||||||
idf.py flash
|
idf.py flash
|
||||||
```
|
```
|
||||||
@@ -105,7 +87,7 @@ idf.py flash
|
|||||||

|

|
||||||
|
|
||||||
## CAN Setting
|
## CAN Setting
|
||||||

|

|
||||||
|
|
||||||
## WiFi Setting
|
## WiFi Setting
|
||||||

|

|
||||||
@@ -118,7 +100,7 @@ You can connect using mDNS.
|
|||||||
|
|
||||||
## External HTTP Server Setting
|
## External HTTP Server Setting
|
||||||
The External HTTP Server receives CAN Bus received data.
|
The External HTTP Server receives CAN Bus received data.
|
||||||

|

|
||||||
|
|
||||||
__Note__
|
__Note__
|
||||||
The Built-in HTTP Server receives CAN Bus transmittion data.
|
The Built-in HTTP Server receives CAN Bus transmittion data.
|
||||||
@@ -178,10 +160,12 @@ CANBus reception using UNO.
|
|||||||
|
|
||||||
# HTTP Server Using Tornado
|
# HTTP Server Using Tornado
|
||||||
```
|
```
|
||||||
|
cd $HOME
|
||||||
sudo apt install python3-pip python3-setuptools
|
sudo apt install python3-pip python3-setuptools
|
||||||
python -m pip install -U pip
|
python -m pip install -U pip
|
||||||
python -m pip install -U wheel
|
python -m pip install -U wheel
|
||||||
python -m pip install tornado
|
python -m pip install tornado
|
||||||
|
cd esp-idf-can2http
|
||||||
cd tornado
|
cd tornado
|
||||||
python can.py
|
python can.py
|
||||||
```
|
```
|
||||||
@@ -190,11 +174,13 @@ python can.py
|
|||||||
|
|
||||||
# HTTP Server Using Flask
|
# HTTP Server Using Flask
|
||||||
```
|
```
|
||||||
|
cd $HOME
|
||||||
sudo apt install python3-pip python3-setuptools
|
sudo apt install python3-pip python3-setuptools
|
||||||
python -m pip install -U pip
|
python -m pip install -U pip
|
||||||
python -m pip install -U wheel
|
python -m pip install -U wheel
|
||||||
python -m pip install -U Werkzeug
|
python -m pip install -U Werkzeug
|
||||||
python -m pip install flask
|
python -m pip install flask
|
||||||
|
cd esp-idf-can2http
|
||||||
cd flask
|
cd flask
|
||||||
python can.py
|
python can.py
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ menu "Application Configuration"
|
|||||||
|
|
||||||
config ENABLE_PRINT
|
config ENABLE_PRINT
|
||||||
bool "Output the received CAN FRAME to STDOUT"
|
bool "Output the received CAN FRAME to STDOUT"
|
||||||
|
default y
|
||||||
help
|
help
|
||||||
Output the received CAN FRAME to STDOUT.
|
Output the received CAN FRAME to STDOUT.
|
||||||
|
|
||||||
@@ -129,7 +130,7 @@ menu "Application Configuration"
|
|||||||
|
|
||||||
config WEB_SERVER
|
config WEB_SERVER
|
||||||
string "HTTP Server IP or mDNS"
|
string "HTTP Server IP or mDNS"
|
||||||
default "myhttpserver"
|
default "httpserver.local"
|
||||||
help
|
help
|
||||||
The host name or IP address of the HTTP server to use.
|
The host name or IP address of the HTTP server to use.
|
||||||
|
|
||||||
|
|||||||
+10
-21
@@ -102,17 +102,21 @@ void wifi_init_sta()
|
|||||||
s_wifi_event_group = xEventGroupCreate();
|
s_wifi_event_group = xEventGroupCreate();
|
||||||
|
|
||||||
ESP_LOGI(TAG,"ESP-IDF Ver%d.%d", ESP_IDF_VERSION_MAJOR, ESP_IDF_VERSION_MINOR);
|
ESP_LOGI(TAG,"ESP-IDF Ver%d.%d", ESP_IDF_VERSION_MAJOR, ESP_IDF_VERSION_MINOR);
|
||||||
|
ESP_LOGI(TAG,"ESP_IDF_VERSION %d", ESP_IDF_VERSION);
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
//#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
||||||
|
#if ESP_IDF_VERSION > ESP_IDF_VERSION_VAL(4, 1, 0)
|
||||||
ESP_LOGI(TAG,"ESP-IDF esp_netif");
|
ESP_LOGI(TAG,"ESP-IDF esp_netif");
|
||||||
ESP_ERROR_CHECK(esp_netif_init());
|
ESP_ERROR_CHECK(esp_netif_init());
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||||
esp_netif_t *netif = esp_netif_create_default_wifi_sta();
|
esp_netif_t *netif = esp_netif_create_default_wifi_sta();
|
||||||
|
assert(netif);
|
||||||
#else
|
#else
|
||||||
ESP_LOGI(TAG,"ESP-IDF tcpip_adapter");
|
ESP_LOGE(TAG,"esp-idf version 4.1 or higher required");
|
||||||
tcpip_adapter_init();
|
while(1) {
|
||||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
vTaskDelay(1);
|
||||||
#endif
|
}
|
||||||
|
#endif // ESP_IDF_VERSION
|
||||||
|
|
||||||
#if CONFIG_STATIC_IP
|
#if CONFIG_STATIC_IP
|
||||||
|
|
||||||
@@ -120,7 +124,6 @@ void wifi_init_sta()
|
|||||||
ESP_LOGI(TAG, "CONFIG_STATIC_GW_ADDRESS=[%s]",CONFIG_STATIC_GW_ADDRESS);
|
ESP_LOGI(TAG, "CONFIG_STATIC_GW_ADDRESS=[%s]",CONFIG_STATIC_GW_ADDRESS);
|
||||||
ESP_LOGI(TAG, "CONFIG_STATIC_NM_ADDRESS=[%s]",CONFIG_STATIC_NM_ADDRESS);
|
ESP_LOGI(TAG, "CONFIG_STATIC_NM_ADDRESS=[%s]",CONFIG_STATIC_NM_ADDRESS);
|
||||||
|
|
||||||
#if ESP_IDF_VERSION_MAJOR >= 4 && ESP_IDF_VERSION_MINOR >= 1
|
|
||||||
/* Stop DHCP client */
|
/* Stop DHCP client */
|
||||||
ESP_ERROR_CHECK(esp_netif_dhcpc_stop(netif));
|
ESP_ERROR_CHECK(esp_netif_dhcpc_stop(netif));
|
||||||
ESP_LOGI(TAG, "Stop DHCP Services");
|
ESP_LOGI(TAG, "Stop DHCP Services");
|
||||||
@@ -133,20 +136,6 @@ void wifi_init_sta()
|
|||||||
ip_info.gw.addr = ipaddr_addr(CONFIG_STATIC_GW_ADDRESS);;
|
ip_info.gw.addr = ipaddr_addr(CONFIG_STATIC_GW_ADDRESS);;
|
||||||
esp_netif_set_ip_info(netif, &ip_info);
|
esp_netif_set_ip_info(netif, &ip_info);
|
||||||
|
|
||||||
#else
|
|
||||||
/* Stop DHCP client */
|
|
||||||
tcpip_adapter_dhcpc_stop(TCPIP_ADAPTER_IF_STA);
|
|
||||||
ESP_LOGI(TAG, "Stop DHCP Services");
|
|
||||||
|
|
||||||
/* Set STATIC IP Address */
|
|
||||||
tcpip_adapter_ip_info_t ip_info;
|
|
||||||
memset(&ip_info, 0 , sizeof(tcpip_adapter_ip_info_t));
|
|
||||||
ip_info.ip.addr = ipaddr_addr(CONFIG_STATIC_IP_ADDRESS);
|
|
||||||
ip_info.netmask.addr = ipaddr_addr(CONFIG_STATIC_NM_ADDRESS);
|
|
||||||
ip_info.gw.addr = ipaddr_addr(CONFIG_STATIC_GW_ADDRESS);;
|
|
||||||
tcpip_adapter_set_ip_info(TCPIP_ADAPTER_IF_STA, &ip_info);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
I referred from here.
|
I referred from here.
|
||||||
https://www.esp32.com/viewtopic.php?t=5380
|
https://www.esp32.com/viewtopic.php?t=5380
|
||||||
@@ -162,7 +151,7 @@ void wifi_init_sta()
|
|||||||
d.u_addr.ip4.addr = 0x08080404; //8.8.4.4 dns
|
d.u_addr.ip4.addr = 0x08080404; //8.8.4.4 dns
|
||||||
dns_setserver(1, &d);
|
dns_setserver(1, &d);
|
||||||
|
|
||||||
#endif
|
#endif // CONFIG_STATIC_IP
|
||||||
|
|
||||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||||
|
|||||||
Reference in New Issue
Block a user