Skip to content

Commit

Permalink
AP password setting
Browse files Browse the repository at this point in the history
  • Loading branch information
vitotai committed Sep 16, 2024
1 parent 394abfd commit 710639a
Show file tree
Hide file tree
Showing 91 changed files with 7,262 additions and 7,214 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ You will need to run the hardware setup procedure after upgrading to v2.4 from p
* The gravity caluated by the controller is slightly different from that shown on chart. It is because the formula are derived speratedly. Due to different float precision, the formula is different. The difference should be small, though.

## Version History
* 2024/09/16 update
* trying ESP32 framework 6.8.1
* No password for AP mode by default; workaround for an issue in newer framework.
* Add BLE sensor supports(not enabled by default)
* 4.4
* Settings might be reset, save it before updgrading.
* (ESP32) Rapt Pill support
Expand Down
2 changes: 1 addition & 1 deletion htmljs/dist/chinese/BPLLogViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/chinese/BPLLogViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/chinese/BPLogWebViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/chinese/BPLogWebViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/chinese/config.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/chinese/config.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/chinese/setup.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/chinese/setup.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/english/BPLLogViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/english/BPLLogViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/english/BPLogWebViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/english/BPLogWebViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/english/config.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/english/config.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/english/setup.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/english/setup.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/italian/BPLLogViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/italian/BPLLogViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/italian/BPLogWebViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/italian/BPLogWebViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/italian/config.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/italian/config.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/italian/setup.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/italian/setup.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/norwegian/BPLLogViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/norwegian/BPLLogViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/norwegian/BPLogWebViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/norwegian/BPLogWebViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/norwegian/config.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/norwegian/config.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/norwegian/control_s.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/norwegian/control_s.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/norwegian/setup.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/norwegian/setup.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/portuguese-br/BPLLogViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/portuguese-br/BPLLogViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/portuguese-br/BPLogWebViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/portuguese-br/BPLogWebViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/portuguese-br/config.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/portuguese-br/config.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/portuguese-br/control_s.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/portuguese-br/control_s.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/portuguese-br/setup.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/portuguese-br/setup.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/slovak/BPLLogViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/slovak/BPLLogViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/slovak/BPLogWebViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/slovak/BPLogWebViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/slovak/config.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/slovak/config.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/slovak/control_s.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/slovak/control_s.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/slovak/setup.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/slovak/setup.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/spanish/BPLLogViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/spanish/BPLLogViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/spanish/BPLogWebViewer.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/spanish/BPLogWebViewer.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/spanish/config.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/spanish/config.htm.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion htmljs/dist/spanish/setup.htm

Large diffs are not rendered by default.

Binary file modified htmljs/dist/spanish/setup.htm.gz
Binary file not shown.
10 changes: 9 additions & 1 deletion htmljs/src/config.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ <h6 class="inline-header">
<option value="3"><%= config_stationap %></option>
</select>
</div>

<div layout horizontal cross-center>
<h6 class="inline-header">
<%= config_ap_password %>
</h6>
<input type="checkbox" id="eap" name="eap" class="switch-input" checked>
<label for="eap" class="switch-label" style="min-width: 0;"></label>
</div>
<div layout horizontal cross-center>
<h6 class="inline-header">
<%= config_network %>
Expand Down Expand Up @@ -441,4 +449,4 @@ <h6 class="inline-header">

</body>

</html>
</html>
2 changes: 1 addition & 1 deletion htmljs/src/js/chart-edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BrewChart.prototype.calInfo=function(){
cdata[idx++]=0xF3;
cdata[idx++]=points.length;
for(var i=0;i<points.length;i++){
var raw =Math.round((t.devType == 2)? points[i][0]*1000:points[i][0]*10);
var raw =Math.round((t.devType == 2)? points[i][0]*10000:points[i][0]*100);
var gravity =Math.round(t.plato? points[i][1]*100:points[i][1]*10000);
cdata[idx++]= (raw >> 8) & 0xFF;
cdata[idx++]= raw & 0xFF;
Expand Down
1 change: 1 addition & 0 deletions htmljs/src/js/script-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var HW_1W_2413=3;
var HW_EXT_SENSOR=5;
var HW_ENV_SENSOR= 6;
var HW_BME280=7;
var HW_BTHOME=8;

var devices = {
pinlabel:function(pin){
Expand Down
3 changes: 2 additions & 1 deletion htmljs/src/locales/chinese.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
"config_save":"儲存",
"confg_restore_from":"從檔案中載入",
"config_restore":"回復",
"config_ap_password":"AP模式使用密碼",

"__gdc_html": "gdc.html",
"gravity_title": "比重計",
Expand Down Expand Up @@ -496,4 +497,4 @@
"gravity_change_24h": "比重變化 24H",

"end": "***END***"
}
}
3 changes: 2 additions & 1 deletion htmljs/src/locales/english.json
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@
"config_save":"Save",
"confg_restore_from":"Restore from",
"config_restore":"Restore",
"config_ap_password":"Enable AP Password",

"__gdc_html": "gdc.html",
"gravity_title": "Gravity Device",
Expand Down Expand Up @@ -499,4 +500,4 @@
"gravity_change_24h": "Gravity Change 24H",

"__end__": "END"
}
}
1 change: 1 addition & 0 deletions htmljs/src/locales/italian.json
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@
"config_save":"Save",
"confg_restore_from":"Restore from",
"config_restore":"Restore",
"config_ap_password":"Enable AP Password",

"__gdc_html": "gdc.html",
"gravity_title": "Dispositivo densità",
Expand Down
3 changes: 2 additions & 1 deletion htmljs/src/locales/norwegian.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"config_save":"Save",
"confg_restore_from":"Restore from",
"config_restore":"Restore",
"config_ap_password":"Enable AP Password",

"__gdc_html": "gdc.html",
"gravity_title": "Enhet egenvekt",
Expand Down Expand Up @@ -495,4 +496,4 @@
"gravity_change_24h": "Gravity Change 24H",

"__end__": "END"
}
}
3 changes: 2 additions & 1 deletion htmljs/src/locales/portuguese-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
"config_save":"Save",
"confg_restore_from":"Restore from",
"config_restore":"Restore",
"config_ap_password":"Enable AP Password",

"__gdc_html": "gdc.html",
"gravity_title": "BrewPiLess | Densidade",
Expand Down Expand Up @@ -496,4 +497,4 @@
"gravity_change_24h": "Gravity Change 24H",

"__end__": "END"
}
}
1 change: 1 addition & 0 deletions htmljs/src/locales/slovak.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"config_save":"Save",
"confg_restore_from":"Restore from",
"config_restore":"Restore",
"config_ap_password":"Enable AP Password",

"__gdc_html": "gdc.html",
"gravity_title": "Zariadenie na meranie hustoty",
Expand Down
3 changes: 2 additions & 1 deletion htmljs/src/locales/spanish.json
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@
"config_save":"Save",
"confg_restore_from":"Restore from",
"config_restore":"Restore",
"config_ap_password":"Enable AP Password",

"__gdc_html": "gdc.html",
"gravity_title": "Dens&iacute;metro",
Expand Down Expand Up @@ -495,4 +496,4 @@
"gravity_change_24h": "Gravity Change 24H",

"__end__": "END"
}
}
7 changes: 5 additions & 2 deletions src/BPLSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ bool BPLSettings::autoCapSettingsSanity(void){ return true;}
#define KeyGateway "gw"
#define KeyNetmask "mask"
#define KeyDNS "dns"
#define KeySecuredAP "eap"

#define KeyFlashChipId "fid"
#define KeyFlashRealSize "frsize"
Expand Down Expand Up @@ -201,6 +202,7 @@ void BPLSettings::defaultSystemConfiguration(void){
syscfg->netmask = (uint32_t) IPAddress(0,0,0,0);
syscfg->dns = (uint32_t) IPAddress(0,0,0,0);
syscfg->glycolChilling = 0;
syscfg->securedAp = false;
#if TWOFACED_LCD
syscfg->displayMode = 0;
#endif
Expand Down Expand Up @@ -236,7 +238,8 @@ bool BPLSettings::dejsonSystemConfiguration(String json){
syscfg->passwordLcd = root[KeyProtect];
syscfg->wifiMode = root[KeyWifi];
syscfg->backlite = root[KeyLcdBackLight];
#if TWOFACED_LCD
syscfg->securedAp = root[KeySecuredAP];
#if TWOFACED_LCD
syscfg->displayMode = root[KeyDisplayMode];
#endif
syscfg->glycolChilling=root[KeyGlycol];
Expand Down Expand Up @@ -270,7 +273,7 @@ String BPLSettings::jsonSystemConfiguration(void){
root[KeyNetmask]= IPAddress(syscfg->netmask).toString();
root[KeyDNS] = IPAddress(syscfg->dns).toString();
root[KeyGlycol] = syscfg->glycolChilling;

root[KeySecuredAP] = syscfg->securedAp;
#if TWOFACED_LCD
root[KeyDisplayMode] = syscfg->displayMode;
#endif
Expand Down
3 changes: 2 additions & 1 deletion src/BPLSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ typedef struct _SystemConfiguration{
uint32_t dns;
uint8_t displayMode;
uint8_t glycolChilling;
uint8_t _padding[2];
uint8_t securedAp;
uint8_t _padding;
}SystemConfiguration;

//*****************************************************
Expand Down
8 changes: 6 additions & 2 deletions src/BrewPiLess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,10 @@ class BrewPiWebHandler: public AsyncWebHandler
DBG_PRINTF("config saved: %s\n",theSettings.systemConfiguration()->hostnetworkname);
request->send(200,ApplicationJsonType,"{}");
display.setAutoOffPeriod(theSettings.systemConfiguration()->backlite);
if (theSettings.systemConfiguration()->securedAp){
WiFi.eraseAP();
// https://github.com/espressif/arduino-esp32/issues/8976
}

#if TWOFACED_LCD
sharedDisplayManager.setDisplayMode(theSettings.systemConfiguration()->displayMode);
Expand Down Expand Up @@ -1952,14 +1956,14 @@ void setup(void){
WiFiConfiguration *wifiCon=theSettings.getWifiConfiguration();

if(strlen(syscfg->hostnetworkname)>0)
WiFiSetup.begin(wifiMode,syscfg->hostnetworkname,syscfg->password,
WiFiSetup.begin(wifiMode,syscfg->hostnetworkname,syscfg->securedAp? syscfg->password:NULL,
wifiCon->ssid[0]? wifiCon->ssid:NULL,
wifiCon->pass[0]? wifiCon->pass:NULL);
else // something wrong with the file
WiFiSetup.begin(wifiMode,DEFAULT_HOSTNAME,DEFAULT_PASSWORD);
#else
if(strlen(syscfg->hostnetworkname)>0)
WiFiSetup.begin(wifiMode,syscfg->hostnetworkname,syscfg->password);
WiFiSetup.begin(wifiMode,syscfg->hostnetworkname,syscfg->securedAp? syscfg->password:NULL);
else // something wrong with the file
WiFiSetup.begin(wifiMode,DEFAULT_HOSTNAME,DEFAULT_PASSWORD);
#endif
Expand Down
17 changes: 9 additions & 8 deletions src/WiFiSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ void WiFiSetupClass::enterBackupApMode(void)
}

void WiFiSetupClass::createNetwork(){
if(strlen(_apPassword)>=8)
if(_apPassword != NULL && strlen(_apPassword)>=8){
WiFi.softAP(_apName, _apPassword);
else
DBG_PRINTF("\ncreate network:%s pass:%s\n",_apName, _apPassword);
}else{
WiFi.softAP(_apName);

DBG_PRINTF("\ncreate network:%s pass:%s\n",_apName, _apPassword);
DBG_PRINTF("\ncreate network:%s without pass\n",_apName);
}
}

void WiFiSetupClass::setupApService(void)
Expand Down Expand Up @@ -95,19 +96,19 @@ void WiFiSetupClass::begin(WiFiMode mode, char const *ssid,const char *passwd,ch
_mode= mode;
WiFiMode mode2use = (_mode == WIFI_OFF)? WIFI_AP_STA:_mode;

DBG_PRINTF("\nSaved SSID:\"%s\" targetSSID:%s\n",WiFi.SSID().c_str(),targetSSID? targetSSID:"NULL");
DBG_PRINTF("\nAP mode:%d, used;%d autoReconect:%d\n",mode,mode2use,WiFi.getAutoReconnect());

if( (mode2use == WIFI_STA || mode2use == WIFI_AP_STA)
&& _targetSSID == NULL
&& (WiFi.SSID() == "[Your SSID]" || WiFi.SSID() == "" || WiFi.SSID() == NULL)){
/*&& (WiFi.SSID() == "[Your SSID]" || WiFi.SSID() == "" || WiFi.SSID() == NULL)*/){
DBG_PRINTF("Invalid SSID!");
mode2use = WIFI_AP;
}
_apName=(ssid == NULL || *ssid=='\0')? DEFAULT_HOSTNAME:ssid;
_apPassword=(passwd !=NULL && *passwd=='\0')? NULL:passwd;

WiFi.setAutoConnect(true);
DBG_PRINTF("\nSaved SSID:\"%s\" targetSSID:%s\n",WiFi.SSID().c_str(),targetSSID? targetSSID:"NULL");
DBG_PRINTF("\nAP mode:%d, used;%d autoReconect:%d\n",mode,mode2use,WiFi.getAutoReconnect());

WiFi.mode(mode2use);
// start AP
if( mode2use == WIFI_AP || mode2use == WIFI_AP_STA){
Expand Down
Loading

0 comments on commit 710639a

Please sign in to comment.