Skip to content

Commit cad7012

Browse files
committed
watchdog; DNS for static IP
1 parent 3a98b06 commit cad7012

24 files changed

Lines changed: 104 additions & 15 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# in this exact order for cmake to work correctly
33
cmake_minimum_required(VERSION 3.16)
44

5-
set(PROJECT_VER "2.4.10")
5+
set(PROJECT_VER "2.4.11")
66
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
77
project(esp32_nat_router)
88

components/cmd_router/cmd_router.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ static void register_set_led_gpio(void);
8787
static void register_set_led_lowactive(void);
8888
static void register_set_led_strip(void);
8989
static void register_set_ttl(void);
90+
static void register_set_watchdog(void);
9091
static void register_client_stats_cmd(void);
9192
static void register_set_ap_nat(void);
9293
static void register_set_tx_power(void);
@@ -306,6 +307,7 @@ void register_router(void)
306307
register_set_led_lowactive();
307308
register_set_led_strip();
308309
register_set_ttl();
310+
register_set_watchdog();
309311
register_client_stats_cmd();
310312
register_set_ap_nat();
311313
register_set_tx_power();
@@ -2191,6 +2193,49 @@ static void register_set_ttl(void)
21912193
ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
21922194
}
21932195

2196+
/* 'set_watchdog' command - set reconnect watchdog timeout */
2197+
static int set_watchdog_cmd(int argc, char **argv)
2198+
{
2199+
if (argc < 2) {
2200+
printf("Usage: set_watchdog <seconds>\n");
2201+
printf(" seconds: 0-65535 (0 = disabled, default)\n");
2202+
printf("\nCurrent setting: %d s", reconnect_watchdog_s);
2203+
printf(reconnect_watchdog_s == 0 ? " (disabled)\n" : "\n");
2204+
return 0;
2205+
}
2206+
2207+
char *endptr;
2208+
long val = strtol(argv[1], &endptr, 10);
2209+
if (*endptr != '\0' || val < 0 || val > 65535) {
2210+
printf("Invalid value. Use 0-65535 (0 = disabled).\n");
2211+
return 1;
2212+
}
2213+
2214+
esp_err_t err = set_config_param_int("wd_s", (int32_t)val);
2215+
if (err == ESP_OK) {
2216+
reconnect_watchdog_s = (uint16_t)val;
2217+
if (val == 0) {
2218+
printf("Reconnect watchdog disabled.\n");
2219+
} else {
2220+
printf("Reconnect watchdog set to %ld s.\n", val);
2221+
}
2222+
} else {
2223+
printf("Failed to save setting\n");
2224+
}
2225+
return err;
2226+
}
2227+
2228+
static void register_set_watchdog(void)
2229+
{
2230+
const esp_console_cmd_t cmd = {
2231+
.command = "set_watchdog",
2232+
.help = "Set reconnect watchdog timeout in seconds (0 = disabled, default)",
2233+
.hint = NULL,
2234+
.func = &set_watchdog_cmd,
2235+
};
2236+
ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
2237+
}
2238+
21942239
/* 'client_stats' command - enable/disable per-client traffic statistics */
21952240
static int client_stats_cmd(int argc, char **argv)
21962241
{

firmware_esp32/bootloader.bin

0 Bytes
Binary file not shown.

firmware_esp32/build_info.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ESP32 NAT Router Build Information
22
=================================
33
Target: ESP32 (Original) (esp32)
4-
Build Time: 2026-05-06 11:52:43
5-
Git Hash: fec99fb
4+
Build Time: 2026-05-20 15:48:30
5+
Git Hash: 3a98b06
66
Binary Files: 4
77
Build Directory: build
1.02 KB
Binary file not shown.

firmware_esp32c3/bootloader.bin

0 Bytes
Binary file not shown.

firmware_esp32c3/build_info.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ESP32 NAT Router Build Information
22
=================================
33
Target: ESP32-C3 (esp32c3)
4-
Build Time: 2026-05-06 12:08:58
5-
Git Hash: fec99fb
4+
Build Time: 2026-05-20 16:02:53
5+
Git Hash: 3a98b06
66
Binary Files: 4
77
Build Directory: build
1.14 KB
Binary file not shown.

firmware_esp32c5/bootloader.bin

0 Bytes
Binary file not shown.

firmware_esp32c5/build_info.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ESP32 NAT Router Build Information
22
=================================
33
Target: ESP32-C5 (esp32c5)
4-
Build Time: 2026-05-06 12:02:28
5-
Git Hash: fec99fb
4+
Build Time: 2026-05-20 15:57:10
5+
Git Hash: 3a98b06
66
Binary Files: 4
77
Build Directory: build

0 commit comments

Comments
 (0)