mirror of
https://github.com/UtilitechAS/amsreader-firmware.git
synced 2026-01-13 15:37:03 +00:00
Merge branch 'master' into mqtt_changes
This commit is contained in:
commit
f7cb022e3e
@ -1200,6 +1200,7 @@ void AmsConfiguration::print(Print* debugger)
|
||||
}
|
||||
debugger->printf_P(PSTR("Hostname: '%s'\r\n"), wifi.hostname);
|
||||
debugger->printf_P(PSTR("mDNS: '%s'\r\n"), wifi.mdns ? "Yes" : "No");
|
||||
debugger->printf_P(PSTR("802.11b: '%s'\r\n"), wifi.use11b ? "Yes" : "No");
|
||||
debugger->println(F(""));
|
||||
delay(10);
|
||||
debugger->flush();
|
||||
|
||||
18
lib/SvelteUi/app/dist/index.js
vendored
18
lib/SvelteUi/app/dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -444,11 +444,9 @@
|
||||
<div class="my-3">
|
||||
<label><input type="checkbox" name="wa" value="true" bind:checked={configuration.w.a} class="rounded mb-1"/> Auto reboot on connection problem</label>
|
||||
</div>
|
||||
{#if sysinfo.chip != 'esp8266'}
|
||||
<div class="my-3">
|
||||
<label><input type="checkbox" name="wb" value="true" bind:checked={configuration.w.b} class="rounded mb-1"/> Allow 802.11b legacy rates</label>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="cnt">
|
||||
<strong class="text-sm">Network</strong>
|
||||
|
||||
@ -238,11 +238,11 @@ void AmsWebServer::sysinfoJson() {
|
||||
#if defined(ESP8266)
|
||||
wifi_get_macaddr(STATION_IF, mac);
|
||||
wifi_get_macaddr(SOFTAP_IF, apmac);
|
||||
uint32_t cpu_freq = 80;
|
||||
uint8_t cpu_freq = system_get_cpu_freq();
|
||||
#elif defined(ESP32)
|
||||
esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_STA, mac);
|
||||
esp_wifi_get_mac((wifi_interface_t)ESP_IF_WIFI_AP, apmac);
|
||||
uint32_t cpu_freq = esp_clk_cpu_freq();
|
||||
uint32_t cpu_freq = esp_clk_cpu_freq() / 1000000;
|
||||
#endif
|
||||
|
||||
sprintf(macStr, "%02X:%02X:%02X:%02X:%02X:%02X", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
|
||||
@ -278,7 +278,7 @@ void AmsWebServer::sysinfoJson() {
|
||||
"esp8266",
|
||||
#endif
|
||||
chipIdStr.c_str(),
|
||||
cpu_freq / 1000000,
|
||||
cpu_freq,
|
||||
macStr,
|
||||
apMacStr,
|
||||
sys.boardType,
|
||||
@ -1448,7 +1448,7 @@ void AmsWebServer::handleSave() {
|
||||
strcpy(entsoe.area, priceRegion.c_str());
|
||||
strcpy(entsoe.currency, server.arg(F("pc")).c_str());
|
||||
entsoe.multiplier = server.arg(F("pm")).toFloat() * 1000;
|
||||
entsoe.fixedPrice = server.arg(F("pf")).toFloat() * 1000;
|
||||
entsoe.fixedPrice = server.hasArg(F("pf")) ? server.arg(F("pf")).toFloat() * 1000 : 0;
|
||||
config->setEntsoeConfig(entsoe);
|
||||
}
|
||||
|
||||
|
||||
@ -572,11 +572,12 @@ void loop() {
|
||||
debugW_P(PSTR("Used %dms to handle mqtt"), millis()-start);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(now - lastVoltageCheck > 500) {
|
||||
handleVoltageCheck();
|
||||
lastVoltageCheck = now;
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
if(dnsServer != NULL) {
|
||||
dnsServer->processNextRequest();
|
||||
@ -847,8 +848,8 @@ bool handleVoltageCheck() {
|
||||
debugD_P(PSTR("Setting new max Vcc to %.2f"), vcc);
|
||||
maxVcc = vcc;
|
||||
} else if(WiFi.getMode() != WIFI_OFF) {
|
||||
float diff = maxVcc-vcc;
|
||||
if(diff > 0.3) {
|
||||
float diff = min(maxVcc, (float) 3.3)-vcc;
|
||||
if(diff > 0.4) {
|
||||
debugW_P(PSTR("Vcc dropped to %.2f, disconnecting WiFi for 5 seconds to preserve power"), vcc);
|
||||
WiFi_disconnect(2000);
|
||||
return false;
|
||||
@ -1432,10 +1433,12 @@ void WiFi_connect() {
|
||||
}
|
||||
lastWifiRetry = millis();
|
||||
|
||||
/*
|
||||
if(!handleVoltageCheck()) {
|
||||
debugW_P(PSTR("Voltage is not high enough to reconnect"));
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
if (WiFi.status() != WL_CONNECTED) {
|
||||
WiFiConfig wifi;
|
||||
@ -1485,16 +1488,18 @@ void WiFi_connect() {
|
||||
if(!WiFi.config(ip, gw, sn, dns1, dns2)) {
|
||||
debugE_P(PSTR("Static IP configuration is invalid, not using"));
|
||||
}
|
||||
} else {
|
||||
#if defined(ESP32)
|
||||
// This trick does not work anymore...
|
||||
// WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE); // Workaround to make DHCP hostname work for ESP32. See: https://github.com/espressif/arduino-esp32/issues/2537
|
||||
#endif
|
||||
}
|
||||
#if defined(ESP8266)
|
||||
if(strlen(wifi.hostname) > 0) {
|
||||
WiFi.hostname(wifi.hostname);
|
||||
}
|
||||
}
|
||||
//wifi_set_phy_mode(PHY_MODE_11N);
|
||||
if(!wifi.use11b) {
|
||||
wifi_set_user_sup_rate(RATE_11G6M, RATE_11G54M);
|
||||
wifi_set_user_rate_limit(RC_LIMIT_11G, 0x00, RATE_11G_G54M, RATE_11G_G6M);
|
||||
wifi_set_user_rate_limit(RC_LIMIT_11N, 0x00, RATE_11N_MCS7S, RATE_11N_MCS0);
|
||||
wifi_set_user_limit_rate_mask(LIMIT_RATE_MASK_ALL);
|
||||
}
|
||||
#endif
|
||||
#if defined(ESP32)
|
||||
WiFi.setScanMethod(WIFI_ALL_CHANNEL_SCAN);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user