diff --git a/config-102.cvs b/config-102.cvs index 7bc85d236..44f4d3c75 100644 --- a/config-102.cvs +++ b/config-102.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-201.cvs b/config-201.cvs index 11a7b6cad..050588143 100644 --- a/config-201.cvs +++ b/config-201.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-202.cvs b/config-202.cvs index 480fa0d39..4a6058f0d 100644 --- a/config-202.cvs +++ b/config-202.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-203.cvs b/config-203.cvs index bd36af6c4..0e24d582d 100644 --- a/config-203.cvs +++ b/config-203.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-204.cvs b/config-204.cvs index 3bd348082..bfe792612 100644 --- a/config-204.cvs +++ b/config-204.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-205.cvs b/config-205.cvs index 5261fce91..132602353 100644 --- a/config-205.cvs +++ b/config-205.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-207.cvs b/config-207.cvs index baf2146aa..738734ae8 100644 --- a/config-207.cvs +++ b/config-207.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-302.cvs b/config-302.cvs index d322ac0e9..45d533063 100644 --- a/config-302.cvs +++ b/config-302.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-303.cvs b/config-303.cvs index 4cc46a2b8..3087fec60 100644 --- a/config-303.cvs +++ b/config-303.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-400.cvs b/config-400.cvs index 84082677e..fe033a50a 100644 --- a/config-400.cvs +++ b/config-400.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-401.cvs b/config-401.cvs index e28181978..a60a26abb 100644 --- a/config-401.cvs +++ b/config-401.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-402.cvs b/config-402.cvs index 2aca33220..abd289adc 100644 --- a/config-402.cvs +++ b/config-402.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-403.cvs b/config-403.cvs index 48cf4dadc..13fb3d95b 100644 --- a/config-403.cvs +++ b/config-403.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-601.cvs b/config-601.cvs index f5ec5ddc2..dac413b1d 100644 --- a/config-601.cvs +++ b/config-601.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-602.cvs b/config-602.cvs index 6fa2d9595..5e1f5b87b 100644 --- a/config-602.cvs +++ b/config-602.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-701.cvs b/config-701.cvs index 1eef3c5b6..fb9f069ba 100644 --- a/config-701.cvs +++ b/config-701.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-702.cvs b/config-702.cvs index cde37e2b6..01ef92e5e 100644 --- a/config-702.cvs +++ b/config-702.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-800x.cvs b/config-800x.cvs index 5243f1e4c..59fd8a2a1 100644 --- a/config-800x.cvs +++ b/config-800x.cvs @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,0 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config-custom.cvs b/config-custom.cvs index 642417b7b..7019288b1 100644 --- a/config-custom.cvs +++ b/config-custom.cvs @@ -56,4 +56,6 @@ TPS546,data,u16,1 # TMP1075 (0,1) TMP1075,data,u16,1 # Self-test Power Consumption Target (> 0) -power_cons_tgt,data,u16,12 \ No newline at end of file +power_cons_tgt,data,u16,12 +# Enable captive portal +captiveportal,data,u16,1 \ No newline at end of file diff --git a/config.cvs.example b/config.cvs.example index 77deeaebf..0299130e2 100644 --- a/config.cvs.example +++ b/config.cvs.example @@ -28,4 +28,5 @@ rotation,data,u16,0 autofanspeed,data,u16,1 fanspeed,data,u16,100 selftest,data,u16,1 -overheat_mode,data,u16,0 \ No newline at end of file +overheat_mode,data,u16,0 +captiveportal,data,u16,1 \ No newline at end of file diff --git a/main/http_server/http_server.c b/main/http_server/http_server.c index 79493298d..932a1fb95 100644 --- a/main/http_server/http_server.c +++ b/main/http_server/http_server.c @@ -1416,9 +1416,11 @@ esp_err_t start_rest_server(void * pvParameters) // Start websocket log handler thread xTaskCreateWithCaps(websocket_task, "websocket_task", 8192, server, 2, NULL, MALLOC_CAP_SPIRAM); - // Start the DNS server that will redirect all queries to the softAP IP - dns_server_config_t dns_config = DNS_SERVER_CONFIG_SINGLE("*" /* all A queries */, "WIFI_AP_DEF" /* softAP netif ID */); - start_dns_server(&dns_config); + // Start the DNS server that will redirect all queries to the softAP IP, only if captive portal is enabled + if (nvs_config_get_bool(NVS_CONFIG_CAPTIVE_PORTAL)) { + dns_server_config_t dns_config = DNS_SERVER_CONFIG_SINGLE("*" /* all A queries */, "WIFI_AP_DEF" /* softAP netif ID */); + start_dns_server(&dns_config); + } return ESP_OK; err_start: diff --git a/main/nvs_config.c b/main/nvs_config.c index 5d5fdeea3..d77a793f8 100644 --- a/main/nvs_config.c +++ b/main/nvs_config.c @@ -107,6 +107,7 @@ static Settings settings[NVS_CONFIG_COUNT] = { [NVS_CONFIG_TPS546] = {.nvs_key_name = "TPS546", .type = TYPE_BOOL}, [NVS_CONFIG_TMP1075] = {.nvs_key_name = "TMP1075", .type = TYPE_BOOL}, [NVS_CONFIG_POWER_CONSUMPTION_TARGET] = {.nvs_key_name = "power_cons_tgt", .type = TYPE_U16}, + [NVS_CONFIG_CAPTIVE_PORTAL] = {.nvs_key_name = "captiveportal", .type = TYPE_BOOL, .default_value = {.b = true}}, }; Settings *nvs_config_get_settings(NvsConfigKey key) diff --git a/main/nvs_config.h b/main/nvs_config.h index 14b600a2d..7925efcbc 100644 --- a/main/nvs_config.h +++ b/main/nvs_config.h @@ -70,6 +70,7 @@ typedef enum { NVS_CONFIG_TPS546, NVS_CONFIG_TMP1075, NVS_CONFIG_POWER_CONSUMPTION_TARGET, + NVS_CONFIG_CAPTIVE_PORTAL, NVS_CONFIG_COUNT } NvsConfigKey;