ESP32S2 AT wifi repeater

ferrero
Posts: 18
Joined: Tue Nov 05, 2024 3:11 am

ESP32S2 AT wifi repeater

Postby ferrero » Tue Jan 28, 2025 8:13 am

Is it possible to create a wifi network repeater using AT commands or will you have to manually implement NAT by changing the internals of the firmware?

ferrero
Posts: 18
Joined: Tue Nov 05, 2024 3:11 am

Re: ESP32S2 AT wifi repeater

Postby ferrero » Thu Jan 30, 2025 3:56 am

SOLVED:
1. exec AT+CWMODE=3
2. Connect to AP with AT+CWJAP=
3. exec AT+CWDHCP=1,3
4. exec custom AT cmd AT+NAT=1
5. using phone connect to ESP soft AP WIFI
+turn on the NAT param in lwIP in menuconfig

idf: 5.0.6

AT+NAT:

Code: Select all

static int32_t proc = 0;

uint8_t user_at_query_cmd_nat(uint8_t *cmd_name)
{
  char buffer[50] = {0};
  sprintf(buffer, "+NAT:%d\r\n", proc);
  esp_at_port_write_data((uint8_t*)buffer, strlen(buffer));
  return ESP_AT_RESULT_CODE_OK;
}

uint8_t user_at_setup_cmd_nat(uint8_t para_num)
{
  uint8_t index = 0;
  if(esp_at_get_para_as_digit(index++, &proc)  != ESP_AT_PARA_PARSE_RESULT_OK) return ESP_AT_RESULT_CODE_ERROR;
  u32_t napt_netif_ip = 0xC0A80401; // Set to ip address of softAP netif (Default is 192.168.4.1)
  ESP_LOGV("NAT", "INIT: %d", proc);
  ip_napt_enable(htonl(napt_netif_ip), proc);
  return ESP_AT_RESULT_CODE_OK;
}

Who is online

Users browsing this forum: No registered users and 46 guests