From 3ecdc27550760a1cd5d5f621d2a224c935f129de Mon Sep 17 00:00:00 2001 From: rjwats Date: Sun, 3 Jan 2021 18:51:11 +0000 Subject: [PATCH] Add additional settings to AP configuration (#215) * add wifi settings option to set AP visible/non visible * add add channel and max client settings Co-authored-by: lukas --- factory_settings.ini | 3 ++ interface/src/ap/APSettingsForm.tsx | 49 ++++++++++++++++++++++++++--- interface/src/ap/types.ts | 3 ++ lib/framework/APSettingsService.cpp | 2 +- lib/framework/APSettingsService.h | 26 +++++++++++++-- 5 files changed, 76 insertions(+), 7 deletions(-) diff --git a/factory_settings.ini b/factory_settings.ini index db8744d..b9fbd60 100644 --- a/factory_settings.ini +++ b/factory_settings.ini @@ -15,6 +15,9 @@ build_flags = -D FACTORY_AP_PROVISION_MODE=AP_MODE_DISCONNECTED -D FACTORY_AP_SSID=\"ESP8266-React-#{unique_id}\" ; 1-64 characters, supports placeholders -D FACTORY_AP_PASSWORD=\"esp-react\" ; 8-64 characters + -D FACTORY_AP_CHANNEL=1 + -D FACTORY_AP_SSID_HIDDEN=false + -D FACTORY_AP_MAX_CLIENTS=4 -D FACTORY_AP_LOCAL_IP=\"192.168.4.1\" -D FACTORY_AP_GATEWAY_IP=\"192.168.4.1\" -D FACTORY_AP_SUBNET_MASK=\"255.255.255.0\" diff --git a/interface/src/ap/APSettingsForm.tsx b/interface/src/ap/APSettingsForm.tsx index 4828c7b..7f2d21c 100644 --- a/interface/src/ap/APSettingsForm.tsx +++ b/interface/src/ap/APSettingsForm.tsx @@ -1,14 +1,17 @@ import React, { Fragment } from 'react'; -import { TextValidator, ValidatorForm, SelectValidator } from 'react-material-ui-form-validator'; +import { TextValidator, ValidatorForm } from 'react-material-ui-form-validator'; +import { range } from 'lodash'; import MenuItem from '@material-ui/core/MenuItem'; +import Checkbox from '@material-ui/core/Checkbox'; import SaveIcon from '@material-ui/icons/Save'; -import { PasswordValidator, RestFormProps, FormActions, FormButton } from '../components'; +import { PasswordValidator, RestFormProps, FormActions, FormButton, BlockFormControlLabel } from '../components'; import { isAPEnabled } from './APModes'; import { APSettings, APProvisionMode } from './types'; import { isIP } from '../validators'; +import { TextField } from '@material-ui/core'; type APSettingsFormProps = RestFormProps; @@ -22,17 +25,18 @@ class APSettingsForm extends React.Component { const { data, handleValueChange, saveData } = this.props; return ( - Always When WiFi Disconnected Never - + { isAPEnabled(data) && @@ -58,6 +62,43 @@ class APSettingsForm extends React.Component { onChange={handleValueChange('password')} margin="normal" /> + + { + range(1, 14).map(i => {i}) + } + + + } + label="Hide SSID?" + /> + + { + range(1, 9).map(i => {i}) + } +