Page 1 of 1

ESP32S2 AT wifi repeater

Posted: Tue Jan 28, 2025 8:13 am
by ferrero
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?

Re: ESP32S2 AT wifi repeater

Posted: Thu Jan 30, 2025 3:56 am
by ferrero
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;
}