1
0
mirror of https://github.com/thooge/esp32-nmea2000-obp60.git synced 2025-12-13 05:53:06 +01:00

allow to change the Wifi AP Ip address and mask

This commit is contained in:
andreas
2023-10-20 20:40:44 +02:00
parent 371372f1f4
commit b5210a79e8
6 changed files with 110 additions and 31 deletions

View File

@@ -119,6 +119,22 @@
"category": "system",
"capabilities":{"apPwChange":["true"]}
},
{
"name": "apIp",
"type": "string",
"default":"192.168.15.1",
"check": "checkApIp",
"description": "The IP address for the access point. Clients will get addresses within the same subnet.",
"category":"system"
},
{
"name": "apMask",
"type": "string",
"default":"255.255.255.0",
"check": "checkNetMask",
"description": "The net mask for the access point",
"category":"system"
},
{
"name": "useAdminPass",
"type": "boolean",

View File

@@ -186,6 +186,21 @@ function checkAdminPass(v){
return checkApPass(v);
}
function checkApIp(v,allValues){
if (! v) return "cannot be empty";
let err1="must be in the form 192.168.x.x";
if (! v.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/))return err1;
let parts=v.split(".");
if (parts.length != 4) return err1;
for (let idx=0;idx < 4;idx++){
let iv=parseInt(parts[idx]);
if (iv < 0 || iv > 255) return err1;
}
}
function checkNetMask(v,allValues){
return checkApIp(v,allValues);
}
function checkIpAddress(v,allValues,def){
if (allValues.tclEnabled != "true") return;
if (! v) return "cannot be empty";