diff --git a/files/etc/config.mesh/_setup b/files/etc/config.mesh/_setup index 3b1aced8..2ac7e95c 100644 --- a/files/etc/config.mesh/_setup +++ b/files/etc/config.mesh/_setup @@ -6,7 +6,7 @@ wifi_mode = adhoc wifi_txpower = 19 wifi_channel = 1 wifi_chanbw = 20 -wifi_distance = 100000 +wifi_distance = 0 wifi_country = 00 dmz_mode = 3 diff --git a/files/etc/config.mesh/_setup.default b/files/etc/config.mesh/_setup.default index 31dcec0c..031bd9ce 100644 --- a/files/etc/config.mesh/_setup.default +++ b/files/etc/config.mesh/_setup.default @@ -6,7 +6,7 @@ wifi_mode = adhoc wifi_txpower = 19 wifi_channel = 1 wifi_chanbw = 20 -wifi_distance = 100000 +wifi_distance = 0 wifi_country = 00 dmz_mode = 3 diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index 55b12f21..11bc6cbb 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -150,24 +150,27 @@ $wifi_distance = 0 if $wifi_distance =~ /\D/; $parms{wifi_distance} = $wifi_distance; $parms{wifi_txpower} = $wifi_txpower; +@errors = (); + # # apply the wifi settings # if($parms{button_apply} or $parms{button_save}) { - my $wifiintf = get_interface("wifi"); - $cmd = ""; - $cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;"; - $cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;"; - system $cmd; + if($wifi_distance < 1 or $wifi_distance =~ /\D/) + { + push (@errors, "invalid distance value"); + } else { + my $wifiintf = get_interface("wifi"); + $cmd = ""; + $cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;"; + $cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;"; + system $cmd; + } } - # validate and save configuration - -@errors = (); - if($parms{button_save}) { if($wifi_proto eq "static") @@ -200,7 +203,7 @@ if($parms{button_save}) $wifi_chanbw = 20; } - push (@errors, "invalid WiFi distance") if $wifi_distance < 0 or $wifi_distance =~ /\D/; + $wifi_country_validated=0; foreach my $testcountry (split(',',"00,HX,AD,AE,AL,AM,AN,AR,AT,AU,AW,AZ,BA,BB,BD,BE,BG,BH,BL,BN,BO,BR,BY,BZ,CA,CH,CL,CN,CO,CR,CY,CZ,DE,DK,DO,DZ,EC,EE,EG,ES,FI,FR,GE,GB,GD,GR,GL,GT,GU,HN,HK,HR,HT,HU,ID,IE,IL,IN,IS,IR,IT,JM,JP,JO,KE,KH,KP,KR,KW,KZ,LB,LI,LK,LT,LU,LV,MC,MA,MO,MK,MT,MY,MX,NL,NO,NP,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PR,QA,RO,RS,RU,RW,SA,SE,SG,SI,SK,SV,SY,TW,TH,TT,TN,TR,UA,US,UY,UZ,VE,VN,YE,ZA,ZW")) { @@ -373,7 +376,7 @@ function updDist(x) { document.getElementsByName('wifi_distance_disp')[0].value = x; dist_hidden.value = xc; // if default, then ALERT! - if(dist_hidden.value==100000) { + if(dist_hidden.value==0) { distBox.className = 'dist-alert'; } else { distBox.className = 'dist-norm'; @@ -640,7 +643,7 @@ if($wifi_proto ne "disabled") for($i = wifi_maxpower($wifi_channel); $i >= 1; --$i) { selopt($i+$txpoweroffset ." dBm", $i, $wifi_txpower) } print " \n"; - print "