Skip to content

Commit

Permalink
Constants for 5GHz channel min/max
Browse files Browse the repository at this point in the history
  • Loading branch information
billz committed Nov 7, 2023
1 parent de38aa0 commit 6f45429
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
define('RASPI_ACCESS_CHECK_DNS', 'one.one.one.one');

// Constant for the 5GHz wireless regulatory domain
define("HOSTAPD_5GHZ_CHANNEL_MIN", 100);
define("RASPI_5GHZ_CHANNEL_MIN", 100);
define("RASPI_5GHZ_CHANNEL_MAX", 192);

// Enable basic authentication for the web admin.
define('RASPI_AUTH_ENABLED', true);
Expand Down
4 changes: 2 additions & 2 deletions includes/hostapd.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function SaveHostAPDConfig($wpa_array, $enc_types, $modes, $interfaces, $reg_dom
$status->addMessage('Attempting to set channel to invalid number.', 'danger');
$good_input = false;
}
if (intval($_POST['channel']) < 1 || intval($_POST['channel']) > RASPI_5GHZ_MAX_CHANNEL) {
if (intval($_POST['channel']) < 1 || intval($_POST['channel']) > RASPI_5GHZ_CHANNEL_MAX) {
$status->addMessage('Attempting to set channel outside of permitted range', 'danger');
$good_input = false;
}
Expand Down Expand Up @@ -445,7 +445,7 @@ function updateHostapdConfig($ignore_broadcast_ssid,$wifiAPEnable,$bridgedEnable
$config.= 'channel='.$_POST['channel'].PHP_EOL;

// Set VHT center frequency segment value
if ((int)$_POST['channel'] < HOSTAPD_5GHZ_CHANNEL_MIN) {
if ((int)$_POST['channel'] < RASPI_5GHZ_CHANNEL_MIN) {
$vht_freq_idx = 42;
} else {
$vht_freq_idx = 155;
Expand Down

0 comments on commit 6f45429

Please sign in to comment.