Wifi Tx Power not adjusted #1614

This commit is contained in:
Proddy
2024-02-11 14:21:51 +01:00
parent fea63b0d52
commit 3d715c45e0
16 changed files with 247 additions and 200 deletions

View File

@@ -23,6 +23,7 @@
#include "temperaturesensor.h"
#include "version.h"
#include "default_settings.h"
#include "helpers.h"
#include <ESP8266React.h>

View File

@@ -68,7 +68,7 @@ MAKE_WORD_TRANSLATION(fetch_cmd, "refresh all EMS values", "Lese alle EMS-Werte
MAKE_WORD_TRANSLATION(restart_cmd, "restart EMS-ESP", "Neustart", "opnieuw opstarten", "", "uruchom ponownie EMS-ESP", "restart EMS-ESP", "redémarrer EMS-ESP", "EMS-ESPyi yeniden başlat", "riavvia EMS-ESP", "reštart EMS-ESP") // TODO translate
MAKE_WORD_TRANSLATION(watch_cmd, "watch incoming telegrams", "Watch auf eingehende Telegramme", "inkomende telegrammen bekijken", "", "obserwuj przyczodzące telegramy", "se innkommende telegrammer", "", "Gelen telegramları", "guardare i telegrammi in arrivo", "sledovať prichádzajúce telegramy") // TODO translate
MAKE_WORD_TRANSLATION(publish_cmd, "publish all to MQTT", "Publiziere MQTT", "publiceer alles naar MQTT", "", "opublikuj wszystko na MQTT", "Publiser alt til MQTT", "", "Hepsini MQTTye gönder", "pubblica tutto su MQTT", "zverejniť všetko na MQTT") // TODO translate
MAKE_WORD_TRANSLATION(system_info_cmd, "show system status", "Zeige System-Status", "toon systeemstatus", "", "pokaż status systemu", "vis system status", "", "Sistem Durumunu Göster", "visualizza stati di sistema", "zobraziť stav systému") // TODO translate
MAKE_WORD_TRANSLATION(system_info_cmd, "show system info", "Zeige System-Status", "toon systeemstatus", "", "pokaż status systemu", "vis system status", "", "Sistem Durumunu Göster", "visualizza stati di sistema", "zobraziť stav systému") // TODO translate
MAKE_WORD_TRANSLATION(schedule_cmd, "enable schedule item", "Aktiviere Zeitplan", "activeer tijdschema item", "", "aktywuj wybrany harmonogram", "", "", "program öğesini etkinleştir", "abilitare l'elemento programmato", "povoliť položku plánu") // TODO translate
MAKE_WORD_TRANSLATION(entity_cmd, "set custom value on ems", "Sende eigene Entitäten zu EMS", "verstuur custom waarde naar EMS", "", "wyślij własną wartość na EMS", "", "", "emp üzerinde özel değer ayarla", "imposta valori personalizzati su EMS", "nastaviť vlastnú hodnotu na ems") // TODO translate
MAKE_WORD_TRANSLATION(commands_response, "get response", "Hole Antwort", "Verzoek om antwoord", "", "uzyskaj odpowiedź", "", "", "gelen cevap", "", "získať odpoveď") // TODO translate

View File

@@ -274,10 +274,11 @@ void System::system_restart() {
// saves all settings
void System::wifi_reconnect() {
LOG_INFO("WiFi reconnecting...");
EMSESP::esp8266React.getNetworkSettingsService()->read(
[](NetworkSettings & networkSettings) { LOG_INFO("WiFi reconnecting to SSID '%s'...", networkSettings.ssid.c_str()); });
Shell::loop_all();
delay(1000); // wait a second
EMSESP::webSettingsService.save(); // local settings
EMSESP::webSettingsService.save(); // save local settings
EMSESP::esp8266React.getNetworkSettingsService()->callUpdateHandlers("local"); // in case we've changed ssid or password
}
@@ -468,7 +469,7 @@ void System::start() {
// button single click
void System::button_OnClick(PButton & b) {
LOG_DEBUG("Button pressed - single click");
LOG_NOTICE("Button pressed - single click - show settings folders");
#if defined(EMSESP_TEST)
#ifndef EMSESP_STANDALONE
@@ -479,20 +480,19 @@ void System::button_OnClick(PButton & b) {
// button double click
void System::button_OnDblClick(PButton & b) {
LOG_DEBUG("Button pressed - double click - reconnect");
LOG_NOTICE("Button pressed - double click - wifi reconnect");
EMSESP::system_.wifi_reconnect();
}
// button long press
void System::button_OnLongPress(PButton & b) {
LOG_DEBUG("Button pressed - long press");
LOG_NOTICE("Button pressed - long press");
}
// button indefinite press
void System::button_OnVLongPress(PButton & b) {
LOG_DEBUG("Button pressed - very long press");
LOG_NOTICE("Button pressed - very long press - factory reset");
#ifndef EMSESP_STANDALONE
LOG_WARNING("Performing factory reset...");
EMSESP::esp8266React.factoryReset();
#endif
}
@@ -973,6 +973,8 @@ void System::show_system(uuid::console::Shell & shell) {
shell.printfln(" SSID: %s", WiFi.SSID().c_str());
shell.printfln(" BSSID: %s", WiFi.BSSIDstr().c_str());
shell.printfln(" RSSI: %d dBm (%d %%)", WiFi.RSSI(), wifi_quality(WiFi.RSSI()));
char result[10];
shell.printfln(" TxPower: %s dBm", emsesp::Helpers::render_value(result, (double)(WiFi.getTxPower() / 4), 1));
shell.printfln(" MAC address: %s", WiFi.macAddress().c_str());
shell.printfln(" Hostname: %s", WiFi.getHostname());
shell.printfln(" IPv4 address: %s/%s", uuid::printable_to_string(WiFi.localIP()).c_str(), uuid::printable_to_string(WiFi.subnetMask()).c_str());
@@ -1108,7 +1110,7 @@ bool System::check_upgrade(bool factory_settings) {
#if defined(EMSESP_DEBUG)
if (!missing_version) {
LOG_INFO("Checking version (settings has %d.%d.%d-%s)...",
LOG_INFO("Checking version (settings file is v%d.%d.%d-%s)...",
settings_version.major(),
settings_version.minor(),
settings_version.patch(),
@@ -1144,7 +1146,7 @@ bool System::check_upgrade(bool factory_settings) {
EMSESP::esp8266React.getNetworkSettingsService()->update(
[&](NetworkSettings & networkSettings) {
if (networkSettings.tx_power == 20) {
networkSettings.tx_power = 0; // use Auto
networkSettings.tx_power = WIFI_POWER_19_5dBm; // use 19.5 as we don't have 20 anymore
LOG_INFO("Setting WiFi TX Power to Auto");
return StateUpdateResult::CHANGED;
}
@@ -1266,6 +1268,7 @@ bool System::command_info(const char * value, const int8_t id, JsonObject output
if (WiFi.status() == WL_CONNECTED && !settings.bssid.isEmpty()) {
node["BSSID"] = "set";
}
node["TxPower setting"] = settings.tx_power;
node["static ip config"] = settings.staticIPConfig;
node["enable IPv6"] = settings.enableIPv6;
node["low bandwidth"] = settings.bandwidth20;

View File

@@ -1978,20 +1978,22 @@ void Test::listDir(fs::FS & fs, const char * dirname, uint8_t levels) {
File file = root.openNextFile();
while (file) {
if (file.isDirectory()) {
Serial.print(" DIR : ");
Serial.print(" DIR: ");
Serial.println(file.name());
if (levels) {
listDir(fs, file.name(), levels - 1);
}
Serial.println();
} else {
Serial.print(" FILE: ");
Serial.print(" ");
Serial.print(file.name());
Serial.print("\tSIZE: ");
Serial.println(file.size());
Serial.print(" (");
Serial.print(file.size());
Serial.println(" bytes)");
}
file = root.openNextFile();
}
Serial.println();
}
#endif
#endif