diff --git a/dist/flash_download_tool_3.9.8/flash_download_tool_3.9.8_5.exe b/dist/flash_download_tool_3.9.10/flash_download_tool_3.9.10.exe similarity index 65% rename from dist/flash_download_tool_3.9.8/flash_download_tool_3.9.8_5.exe rename to dist/flash_download_tool_3.9.10/flash_download_tool_3.9.10.exe index 5c6321d31c..2d6a7182e4 100644 Binary files a/dist/flash_download_tool_3.9.8/flash_download_tool_3.9.8_5.exe and b/dist/flash_download_tool_3.9.10/flash_download_tool_3.9.10.exe differ diff --git a/dist/flash_download_tool_3.9.8/release_note.txt b/dist/flash_download_tool_3.9.8/release_note.txt deleted file mode 100644 index fc73aeadf9..0000000000 --- a/dist/flash_download_tool_3.9.8/release_note.txt +++ /dev/null @@ -1,32 +0,0 @@ -3.9.8: -* add UI to support flash & efuse read -* support ESP32-C5 / ESP32-C61 - -3.9.7: -* support ESP32-P4 -* update UI display icon -* Fix bug: icon stuck after long-term use - -3.9.6: -* support ESP32/ESP32H2/ESP32C6/ESP32C2/ESP32S2 secure boot version2 and flash encryption -* config DUT number in multiconfig file ,up to 20pcs -* update secure config file, see docs in detail - -3.9.5: -* support esp32-h2 -* support erase button disable -* fix some bugs - -3.9.4: -* support esp32-c6 -* support esp32-c3/esp32-s3 flash encrytion -* add xmc flash fix -* support dut count in factory mode - -3.9.3: -* support esp32-c2 -* update finish UI show - -3.9.2: -* fix configure file error -* update autostart process \ No newline at end of file diff --git a/docs/source/Plugin/P000_commands.repl b/docs/source/Plugin/P000_commands.repl index 1615261e23..f29d588fbb 100644 --- a/docs/source/Plugin/P000_commands.repl +++ b/docs/source/Plugin/P000_commands.repl @@ -402,6 +402,7 @@ LoopTimerSetAndRun LoopTimerSetAndRun_ms"," + :green:`Rules`"," Set a Loop-Timer using ``LoopTimerSet`` or ``LoopTimerSet_ms`` and immediately run the first iteration. If a ```` value > 0 is included in the command, that count is decremented by 1 for the first iteration, as expected. diff --git a/docs/source/Plugin/P075.rst b/docs/source/Plugin/P075.rst index 9aa67264d2..e83330f6af 100644 --- a/docs/source/Plugin/P075.rst +++ b/docs/source/Plugin/P075.rst @@ -413,7 +413,7 @@ Configure your development station as follows: At the bottom of the Debug screen enable User MCU input and select your ESP8266's USB port. If the Nextion display board is connected it will be ignored. It does NOT need to be removed. -You can now use the Nextion IDE instead of an actual HMI display board to test out your EPSEasy application. +You can now use the Nextion IDE instead of an actual HMI display board to test out your ESPEasy application. diff --git a/docs/source/Plugin/P180.rst b/docs/source/Plugin/P180.rst index 4650fd8a85..cd52ee9fe6 100644 --- a/docs/source/Plugin/P180.rst +++ b/docs/source/Plugin/P180.rst @@ -42,6 +42,7 @@ Example device configurations * :ref:`sensirion-sdp-810-differential-pressure-sensor` * :ref:`tf-luna-lidar-distance-sensor` * :ref:`qmc6310-3-axis-magnetic-sensor` +* :ref:`tca9554-io-extender` Configuration ------------- @@ -610,6 +611,61 @@ To reduce the logging content, **Single event with all values** can be enabled, | +.. _tca9554-io-extender: + +TCA9554 8-port I/O extender +^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This I/O extender provides 8 input/output pins, as documented in the Texas Instruments `TCA9554 Datasheet `_ + +Configuration below is intended to be used for a `Waveshare ESP32-S3-ETH-8DI-8RO `_ unit to control the relays. + +The plugin should be configured with these settings: + +* **I2C Address (Hex)**: ``0x20`` + +* **Output Data Type**: ``Double`` To activate this setting, the page must be submitted to show the extra input fields. + +* **Values**: The names can be changed whatever is appropriate, they are not really used, though we need 2 cached command sequences. + +* **I2C Init Commands**: ``write.u8.0x03.0x00;calc.1``: Initializes the extender for all pins as output (and return a non-zero value for successful initialization). + +* **Cache-Name 1**: Use ``readout``, to match the rules, below, and the I2C Command sequence is cached for much improved execution-performance. + +* **I2C Commands 1**: ``read.u8.0x01;eval;let.bits.%value%`` Read the current relay state, and store in rules variable ``bits`` (referenced as ``%v_bits%``). + +* **Cache-Name 2**: Use ``writeout``, to match with the rules, below. + +* **I2C Commands 2**: ``write.u8.0x01.%v_bits%`` Set then outputs as updated in ``%v_bits%``. + +To reduce the logging content, **Single event with all values** can be enabled, to generate a single event ``#All`` with all values as argument, and thus reduce the logging to a single line. + +Rules to add +~~~~~~~~~~~~ + +As this is an output-only configuration, there must be some command(s) to control these outputs. These commands are handled by a single rule (event handler): + +.. code-block:: none + + On relay Do // Usage: event,"relay=1..8,0/1" + If %eventvalue1% > 0 And %eventvalue1% < 9 And (%eventvalue2|-1% = 0 Or %eventvalue2% = 1) + geni2c,exec,readout // Read all output bits into v_bits + Let,bits,{bitWrite:%eventvalue1%-1:%v_bits%:%eventvalue2%} // Update requested bit = relay + geni2c,exec,writeout // Write new state in v_bits to the outputs + // LogEntry,'Setting relay %eventvalue1% to state %eventvalue2%, bits: %v_bits%' + Endif + Endon + +(The line with LogEntry can be uncommented to get some logging for test purposes) + +To switch a relay on or off, this command syntax can be used: + +``event,"relay=<1..8>,<1|0>"`` + +There are 8 relays on the device, so the matching number should be used, and the second argument ``1`` to set the relay to On, and ``0`` for Off. + +| + Change log ---------- diff --git a/docs/source/Reference/SystemVariable.rst b/docs/source/Reference/SystemVariable.rst index 62d8554b9a..5948d1ead1 100644 --- a/docs/source/Reference/SystemVariable.rst +++ b/docs/source/Reference/SystemVariable.rst @@ -241,9 +241,17 @@ More uses of these system variables can be seen in the rules section and formula * ``0`` = disconnected * ``1`` = Connected - * ``3`` = Got IP && Connected + * ``3`` = *Got IP && Connected (No longer reported since 2026-05-01)* * ``7`` = Got IP && Connected && Completed to set all flags WiFi is initialized - Yes + * - ``%iswifiap%`` + - 1 + - Status of WiFi AP mode + - Yes + * - ``%isppp%`` + - 0 + - Status of PPP Interface active (ESP32 only, with PPP Network Interface configured) + - Yes * - ``%vcc%`` - 5.2 - VCC value, this is only available in the VCC builds of FW (with "VCC" in the file name). diff --git a/src/Custom-sample.h b/src/Custom-sample.h index 11bf1af843..97e6daad1f 100644 --- a/src/Custom-sample.h +++ b/src/Custom-sample.h @@ -47,6 +47,15 @@ #define DEFAULT_AP_SUBNET 255, 255, 255, 0 // Enter IP address (comma separated) for AP (config) mode #define DEFAULT_AP_KEY "configesp" // Enter network WPA key for AP (config) mode +// #define DEFAULT_AP_DNS 1,1,1,1 // Used by PPP/NAPT feature (mind the comma-separated parts!), + // Cloudflare DNS: 1.1.1.1 and 1.0.0.1 and 1.1.1.2 (secure) and 1.1.1.3 (censored) + // Alternatives + // Cleanbrowsing: 185.228.168.9 and 185.228.169.9 + // Google Public DNS: 8.8.8.8 and 8.8.4.4 + // Quad9: 9.9.9.9 and 149.112.112.112 + // OpenDNS: 208.67.222.222 and 208.67.220.220 + // Comodo Secure DNS: 8.26.56.26 and 8.20.247.20 + // --- Wifi Client Mode ----------------------------------------------------------------------------- #define DEFAULT_SSID "MyHomeSSID" // Enter your network SSID #define DEFAULT_KEY "MySuperSecretPassword" // Enter your network WPA key @@ -295,6 +304,27 @@ // #define DEFAULT_PROVISIONING_PASS "" #endif +/* + ####################################################################################################### + Defining Ethernet & GPIO + ####################################################################################################### + */ +// Actual values can be obtained from product documentation and ESPEasyDefaults.h +// #define DEFAULT_ETH_PHY_ADDR 0 +// #define DEFAULT_ETH_PHY_TYPE 0 // See EthernetParameters.h enum EthPhyType_t +// #define DEFAULT_ETH_PIN_MDC -1 +// #define DEFAULT_ETH_PIN_MDIO -1 +// #define DEFAULT_ETH_PIN_POWER -1 +// #define DEFAULT_ETH_CLOCK_MODE (0) // See EthernetParameters.h enum EthClockMode_t + +// #define DEFAULT_NETWORK_MEDIUM ESPEasy::net::NetworkMedium_t::WIFI + +// #define DEFAULT_ENABLED_NW001 1 // Enable NWPLUGIN_001, on factory reset/initial setup +// #define DEFAULT_ENABLED_NW002 1 // Enable NWPLUGIN_002, on factory reset/initial setup +// #define DEFAULT_ENABLED_NW003 1 // Enable NWPLUGIN_003, on factory reset/initial setup +// #define DEFAULT_ENABLED_NW004 1 // Enable NWPLUGIN_004, on factory reset/initial setup +// #define DEFAULT_ENABLED_NW005 1 // Enable NWPLUGIN_005, on factory reset/initial setup +// This list should be updated when adding new Network Interface plugins diff --git a/src/ESPEasy/net/DataStructs/NetworkDriverStruct.h b/src/ESPEasy/net/DataStructs/NetworkDriverStruct.h index 181c8b2ecd..847abfe0f4 100644 --- a/src/ESPEasy/net/DataStructs/NetworkDriverStruct.h +++ b/src/ESPEasy/net/DataStructs/NetworkDriverStruct.h @@ -14,13 +14,30 @@ namespace net { \*********************************************************************************************/ struct NetworkDriverStruct { - NetworkDriverStruct() = default; + NetworkDriverStruct() { + onlySingleInstance = 1; + } - bool onlySingleInstance = true; - bool alwaysPresent = false; - bool enabledOnFactoryReset = false; - networkIndex_t fixedNetworkIndex = INVALID_NETWORK_INDEX; + union { + struct { + uint8_t onlySingleInstance : 1; // Default true + uint8_t alwaysPresent : 1; + uint8_t enabledOnFactoryReset : 1; + uint8_t _unusedNetworkDriverStructBits0_03 : 1; + uint8_t _unusedNetworkDriverStructBits0_04 : 1; + uint8_t _unusedNetworkDriverStructBits0_05 : 1; + uint8_t _unusedNetworkDriverStructBits0_06 : 1; + uint8_t _unusedNetworkDriverStructBits0_07 : 1; + }; + + uint8_t _networkDriverStructBits0{}; + + }; + + networkIndex_t fixedNetworkIndex = INVALID_NETWORK_INDEX; + + uint16_t _networkDriverStructPadding{}; }; diff --git a/src/ESPEasy/net/_NW001_WiFi_STA.cpp b/src/ESPEasy/net/_NW001_WiFi_STA.cpp index 43ae98e8bd..099166a38a 100644 --- a/src/ESPEasy/net/_NW001_WiFi_STA.cpp +++ b/src/ESPEasy/net/_NW001_WiFi_STA.cpp @@ -23,13 +23,13 @@ # include "../net/Helpers/_NWPlugin_init.h" # include "../net/NWPluginStructs/NW001_data_struct_WiFi_STA.h" # include "../net/wifi/ESPEasyWifi.h" -#ifdef ESP8266 -# include "../net/ESPEasyNetwork.h" -#endif +# ifdef ESP8266 +# include "../net/ESPEasyNetwork.h" +# endif -#if FEATURE_TASKVALUE_UNIT_OF_MEASURE -# include "../../src/Helpers/ESPEasy_UnitOfMeasure.h" -#endif +# if FEATURE_TASKVALUE_UNIT_OF_MEASURE +# include "../../src/Helpers/ESPEasy_UnitOfMeasure.h" +# endif # if FEATURE_STORE_CREDENTIALS_SEPARATE_FILE @@ -57,11 +57,13 @@ bool NWPlugin_001(NWPlugin::Function function, EventStruct *event, String& strin { case NWPlugin::Function::NWPLUGIN_DRIVER_ADD: { - NetworkDriverStruct& nw = getNetworkDriverStruct(networkDriverIndex_t::toNetworkDriverIndex(event->idx)); - nw.onlySingleInstance = true; - nw.alwaysPresent = true; + NetworkDriverStruct& nw = getNetworkDriverStruct(networkDriverIndex_t::toNetworkDriverIndex(event->idx)); + nw.onlySingleInstance = true; + nw.alwaysPresent = true; + # if DEFAULT_ENABLED_NW001 nw.enabledOnFactoryReset = true; - nw.fixedNetworkIndex = NWPLUGIN_ID_001 - 1; // Start counting at 0 + # endif + nw.fixedNetworkIndex = NWPLUGIN_ID_001 - 1; // Start counting at 0 break; } @@ -94,7 +96,7 @@ bool NWPlugin_001(NWPlugin::Function function, EventStruct *event, String& strin case NWPlugin::Function::NWPLUGIN_CREDENTIALS_CHANGED: { -// ESPEasy::net::wifi::WiFi_AP_Candidates.force_reload(); // Force reload of the credentials and found APs from the last scan + // ESPEasy::net::wifi::WiFi_AP_Candidates.force_reload(); // Force reload of the credentials and found APs from the last scan break; } @@ -106,6 +108,7 @@ bool NWPlugin_001(NWPlugin::Function function, EventStruct *event, String& strin if (NW_data) { auto runtime_data = NW_data->getNWPluginData_static_runtime(); + if (runtime_data) { success = runtime_data->connected(); } @@ -482,7 +485,7 @@ bool NWPlugin_001(NWPlugin::Function function, EventStruct *event, String& strin addFormNumericBox(LabelType::WIFI_NR_RECONNECT_ATTEMPTS, 0, 255); { - LabelType::Enum labels[]{ + LabelType::Enum labels[]{ LabelType::RESTART_WIFI_LOST_CONN , LabelType::WIFI_USE_LAST_CONN_FROM_RTC # ifndef ESP32 diff --git a/src/ESPEasy/net/_NW002_WiFi_AP.cpp b/src/ESPEasy/net/_NW002_WiFi_AP.cpp index dc1811ff17..8d37459268 100644 --- a/src/ESPEasy/net/_NW002_WiFi_AP.cpp +++ b/src/ESPEasy/net/_NW002_WiFi_AP.cpp @@ -40,10 +40,12 @@ bool NWPlugin_002(NWPlugin::Function function, EventStruct *event, String& strin case NWPlugin::Function::NWPLUGIN_DRIVER_ADD: { NetworkDriverStruct& nw = getNetworkDriverStruct(networkDriverIndex_t::toNetworkDriverIndex(event->idx)); - nw.onlySingleInstance = true; - nw.alwaysPresent = true; + nw.onlySingleInstance = true; + nw.alwaysPresent = true; + # if DEFAULT_ENABLED_NW002 nw.enabledOnFactoryReset = true; - nw.fixedNetworkIndex = NWPLUGIN_ID_002 - 1; // Start counting at 0 + # endif + nw.fixedNetworkIndex = NWPLUGIN_ID_002 - 1; // Start counting at 0 break; } @@ -288,7 +290,7 @@ bool NWPlugin_002(NWPlugin::Function function, EventStruct *event, String& strin ,169 // 5 GHz U-NII-3/4 ,173, 177 // 5 GHz U-NII-4 }; - // *INDENT-ON* + // *INDENT-ON* constexpr int nrwifiChannels = NR_ELEMENTS(wifiChannels); const FormSelectorOptions selector( nrwifiChannels, diff --git a/src/ESPEasy/net/_NW003_ETH_RMII.cpp b/src/ESPEasy/net/_NW003_ETH_RMII.cpp index 823039ea3a..85c5ead006 100644 --- a/src/ESPEasy/net/_NW003_ETH_RMII.cpp +++ b/src/ESPEasy/net/_NW003_ETH_RMII.cpp @@ -37,6 +37,9 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin nw.enabledOnFactoryReset = true; nw.fixedNetworkIndex = NWPLUGIN_ID_003 - 1; // Start counting at 0 # else // ifdef ESP32P4 + # if DEFAULT_ENABLED_NW003 + nw.enabledOnFactoryReset = true; + # endif nw.alwaysPresent = false; # endif // ifdef ESP32P4 break; @@ -46,7 +49,7 @@ bool NWPlugin_003(NWPlugin::Function function, EventStruct *event, String& strin { // Make sure the first listed Eth device is default set to have the highest route prio Settings.setRoutePrio_for_network( - event->NetworkIndex, + event->NetworkIndex, DEFAULT_ETH_ROUTE_PRIO - (5 * event->NetworkIndex)); Settings.setNetworkInterfaceSubnetBlockClientIP(event->NetworkIndex, false); Settings.setNetworkInterfaceStartupDelay(event->NetworkIndex, 500 * event->NetworkIndex); diff --git a/src/ESPEasy/net/_NW004_ETH_SPI.cpp b/src/ESPEasy/net/_NW004_ETH_SPI.cpp index de69b54d27..a341df3029 100644 --- a/src/ESPEasy/net/_NW004_ETH_SPI.cpp +++ b/src/ESPEasy/net/_NW004_ETH_SPI.cpp @@ -34,6 +34,9 @@ bool NWPlugin_004(NWPlugin::Function function, EventStruct *event, String& strin NetworkDriverStruct& nw = getNetworkDriverStruct(networkDriverIndex_t::toNetworkDriverIndex(event->idx)); nw.onlySingleInstance = true; nw.alwaysPresent = false; + # if DEFAULT_ENABLED_NW004 + nw.enabledOnFactoryReset = true; + # endif break; } diff --git a/src/ESPEasy/net/_NW005_PPP_modem.cpp b/src/ESPEasy/net/_NW005_PPP_modem.cpp index 28f8f9e446..97400de84e 100644 --- a/src/ESPEasy/net/_NW005_PPP_modem.cpp +++ b/src/ESPEasy/net/_NW005_PPP_modem.cpp @@ -35,6 +35,9 @@ bool NWPlugin_005(NWPlugin::Function function, EventStruct *event, String& strin NetworkDriverStruct& nw = getNetworkDriverStruct(networkDriverIndex_t::toNetworkDriverIndex(event->idx)); nw.onlySingleInstance = true; nw.alwaysPresent = false; + # if DEFAULT_ENABLED_NW005 + nw.enabledOnFactoryReset = true; + # endif break; } diff --git a/src/_C016.cpp b/src/_C016.cpp index 899446b438..cb691ac13c 100644 --- a/src/_C016.cpp +++ b/src/_C016.cpp @@ -31,7 +31,7 @@ # define CPLUGIN_016 # define CPLUGIN_ID_016 16 -# define CPLUGIN_NAME_016 "Cache Controller [Experimental]" +# define CPLUGIN_NAME_016 "Cache Controller" // #include @@ -46,19 +46,12 @@ bool CPlugin_016(CPlugin::Function function, struct EventStruct *event, String& case CPlugin::Function::CPLUGIN_PROTOCOL_ADD: { ProtocolStruct& proto = getProtocolStruct(event->idx); // = CPLUGIN_ID_016; - proto.usesMQTT = false; - proto.usesTemplate = false; - proto.usesAccount = false; - proto.usesPassword = false; - proto.usesExtCreds = false; proto.defaultPort = 80; - proto.usesID = false; proto.usesHost = false; proto.usesPort = false; proto.usesQueue = false; proto.usesCheckReply = false; proto.usesTimeout = false; - proto.usesSampleSets = false; proto.needsNetwork = false; proto.allowsExpire = false; proto.allowLocalSystemTime = true; @@ -115,10 +108,12 @@ bool CPlugin_016(CPlugin::Function function, struct EventStruct *event, String& uint8_t valueCount = getValueCountForTask(event->TaskIndex); if (event->timestamp_sec == 0) { - if (C016_allowLocalSystemTime) + if (C016_allowLocalSystemTime) { event->setLocalTimeTimestamp(); - else + } + else { event->setUnixTimeTimestamp(); + } } const C016_queue_element element( event, diff --git a/src/_N001_Email.cpp b/src/_N001_Email.cpp index 30a652bc89..2f287ff3cd 100644 --- a/src/_N001_Email.cpp +++ b/src/_N001_Email.cpp @@ -26,18 +26,22 @@ # include "src/NotifierStructs/N001_data_struct.h" - // The message body is included in event->String1 bool NPlugin_001(NPlugin::Function function, struct EventStruct *event, String& string) { bool success = false; - switch (function) { + switch (function) + { case NPlugin::Function::NPLUGIN_PROTOCOL_ADD: { - Notification[++notificationCount].Number = NPLUGIN_ID_001; - Notification[notificationCount].usesMessaging = true; - Notification[notificationCount].usesGPIO = 0; + auto& notif = Notification[++notificationCount]; + notif.Number = NPLUGIN_ID_001; + notif.usesMessaging = true; + notif.usesGPIO = 0; + # if FEATURE_EMAIL_TLS + notif.usesTLS = true; + # endif // if FEATURE_EMAIL_TLS break; } @@ -67,6 +71,7 @@ bool NPlugin_001(NPlugin::Function function, struct EventStruct *event, String& case NPlugin::Function::NPLUGIN_NOTIFY: { MakeNotificationSettings(NotificationSettings); + if (!AllocatedNotificationSettings()) { break; } diff --git a/src/_N002_Buzzer.cpp b/src/_N002_Buzzer.cpp index 1bcd867c08..1c1b4db331 100644 --- a/src/_N002_Buzzer.cpp +++ b/src/_N002_Buzzer.cpp @@ -25,9 +25,10 @@ bool NPlugin_002(NPlugin::Function function, struct EventStruct *event, String& { case NPlugin::Function::NPLUGIN_PROTOCOL_ADD: { - Notification[++notificationCount].Number = NPLUGIN_ID_002; - Notification[notificationCount].usesMessaging = false; - Notification[notificationCount].usesGPIO=1; + auto& notif = Notification[++notificationCount]; + notif.Number = NPLUGIN_ID_002; + notif.usesMessaging = false; + notif.usesGPIO = 1; break; } diff --git a/src/src/CustomBuild/ESPEasyDefaults.h b/src/src/CustomBuild/ESPEasyDefaults.h index f701d805d2..8c702c5e90 100644 --- a/src/src/CustomBuild/ESPEasyDefaults.h +++ b/src/src/CustomBuild/ESPEasyDefaults.h @@ -122,6 +122,21 @@ #define DEFAULT_ETH_ROUTE_PRIO 150 // ESP32-only default route priority #endif +#ifndef DEFAULT_ENABLED_NW001 +#define DEFAULT_ENABLED_NW001 1 // Wifi-STA enabled by default +#endif +#ifndef DEFAULT_ENABLED_NW002 +#define DEFAULT_ENABLED_NW002 1 // Wifi-AP enabled by default +#endif +#ifndef DEFAULT_ENABLED_NW003 +#define DEFAULT_ENABLED_NW003 0 // RMII Ethernet disabled by default, except for P4 +#endif +#ifndef DEFAULT_ENABLED_NW004 +#define DEFAULT_ENABLED_NW004 0 // SPI Ethernet disabled by default +#endif +#ifndef DEFAULT_ENABLED_NW005 +#define DEFAULT_ENABLED_NW005 0 // PPP disabled by default +#endif #ifndef DEFAULT_USE_STATIC_IP #define DEFAULT_USE_STATIC_IP false // (true|false) enabled or disabled static IP diff --git a/src/src/DataStructs/NotificationStruct.h b/src/src/DataStructs/NotificationStruct.h index 52e29c0c2b..693dd025a7 100644 --- a/src/src/DataStructs/NotificationStruct.h +++ b/src/src/DataStructs/NotificationStruct.h @@ -11,14 +11,30 @@ struct NotificationStruct { NotificationStruct() : - Number(0), usesGPIO(0), usesMessaging(false) {} + Number(0), usesGPIO(0) {} uint8_t Number; uint8_t usesGPIO; - bool usesMessaging; + union { + struct { + uint8_t usesMessaging : 1; + uint8_t usesTLS : 1; + uint8_t unusedN02 : 1; // unused + uint8_t unusedN03 : 1; // unused + uint8_t unusedN04 : 1; // unused + uint8_t unusedN05 : 1; // unused + uint8_t unusedN06 : 1; // unused + uint8_t unusedN07 : 1; // unused + + }; + + uint8_t _notificationBits0{}; + + }; + }; -#endif +#endif // if FEATURE_NOTIFIER #endif // DATASTRUCTS_NOTIFICATIONSTRUCT_H diff --git a/src/src/DataStructs/SettingsStruct.h b/src/src/DataStructs/SettingsStruct.h index 2535d4fe2b..395a192526 100644 --- a/src/src/DataStructs/SettingsStruct.h +++ b/src/src/DataStructs/SettingsStruct.h @@ -465,13 +465,11 @@ class SettingsStruct_tmpl } uint32_t getVariousBits2() const { - uint32_t res; - memcpy(&res, &VariousBits_2, sizeof(VariousBits_2)); - return res; + return VariousBits_2._all_bits; } void setVariousBits2(uint32_t value) { - memcpy(&VariousBits_2, &value, sizeof(VariousBits_2)); + VariousBits_2._all_bits = value; } bool getNetworkEnabled(ESPEasy::net::networkIndex_t index) const; diff --git a/src/src/Helpers/ESPEasy_checks.cpp b/src/src/Helpers/ESPEasy_checks.cpp index 07a7e6fe5d..a7d1c6d2a2 100644 --- a/src/src/Helpers/ESPEasy_checks.cpp +++ b/src/src/Helpers/ESPEasy_checks.cpp @@ -119,6 +119,7 @@ void run_compiletime_checks() { #if FEATURE_CUSTOM_PROVISIONING check_size(); #endif + check_size(); check_size(); check_size(); check_size(); diff --git a/src/src/Helpers/SystemVariables.cpp b/src/src/Helpers/SystemVariables.cpp index d00be13f41..5f038486b5 100644 --- a/src/src/Helpers/SystemVariables.cpp +++ b/src/src/Helpers/SystemVariables.cpp @@ -44,11 +44,24 @@ #if defined(ESP8266) # include - #define WIFI_CONNECTED WiFi.isConnected() +int WIFI_CONNECT_STATUS() { + if (WiFi.isConnected()) { + return 7; + } + return 0; +} #endif // if defined(ESP8266) #if defined(ESP32) # include - #define WIFI_CONNECTED WiFi.STA.connected() +int WIFI_CONNECT_STATUS() { + if (WiFi.STA.connected()) { + if (WiFi.STA.hasIP()) { + return 7; + } + return 1; + } + return 0; +} #endif // if defined(ESP32) @@ -176,7 +189,7 @@ String SystemVariables::getSystemVariable(SystemVariables::Enum enumval) { switch (enumval) { case BOOT_CAUSE: intvalue = lastBootCause; break; // Integer value to be used in rules - case BSSID: return (!WIFI_CONNECTED) ? MAC_address().toString() : WiFi.BSSIDstr(); + case BSSID: return (!WIFI_CONNECT_STATUS()) ? MAC_address().toString() : WiFi.BSSIDstr(); case CR: return String('\r'); case IP4: intvalue = static_cast(ESPEasy::net::NetworkLocalIP()[3]); break; // 4th IP octet case ISVAR_DOUBLE: intvalue = @@ -207,13 +220,11 @@ String SystemVariables::getSystemVariable(SystemVariables::Enum enumval) { case ISNTP: intvalue = statusNTPInitialized ? 1 : 0; break; case ISWIFIAP: intvalue = ESPEasy::net::wifi::WifiIsAP(WiFi.getMode()) ? 1 : 0; break; - case ISWIFI: intvalue = WIFI_CONNECTED ? 1 : 0; break; + case ISWIFI: intvalue = WIFI_CONNECT_STATUS(); break; #ifdef USES_NW005 case ISPPP: intvalue = PPP.connected() ? 1 : 0; break; #endif - // WiFiEventData.wifiStatus; break; // 0=disconnected, 1=connected, 2=got ip, 4=services - // initialized case LCLTIME_AM: return node_time.getDateTimeString_ampm('-', ':', ' '); case LF: return String('\n'); case MAC_INT: intvalue = getChipId(); break; // Last 24 bit of MAC address as integer, to be used in rules. @@ -236,7 +247,7 @@ String SystemVariables::getSystemVariable(SystemVariables::Enum enumval) { } #endif // ifndef LIMIT_BUILD_SIZE case SPACE: return String(' '); - case SSID: return (!WIFI_CONNECTED) ? String(F("--")) : WiFi.SSID(); + case SSID: return (!WIFI_CONNECT_STATUS()) ? String(F("--")) : WiFi.SSID(); case SYSBUILD_DATE: return get_build_date(); @@ -290,7 +301,7 @@ String SystemVariables::getSystemVariable(SystemVariables::Enum enumval) { #else // if FEATURE_ADC_VCC case VCC: intvalue = -1; break; #endif // if FEATURE_ADC_VCC - case WI_CH: intvalue = !WIFI_CONNECTED ? 0 : WiFi.channel(); break; + case WI_CH: intvalue = !WIFI_CONNECT_STATUS() ? 0 : WiFi.channel(); break; default: // Already handled above. diff --git a/src/src/PluginStructs/P073_data_struct.cpp b/src/src/PluginStructs/P073_data_struct.cpp index 4eab20b56a..1422bba28d 100644 --- a/src/src/PluginStructs/P073_data_struct.cpp +++ b/src/src/PluginStructs/P073_data_struct.cpp @@ -2,7 +2,7 @@ #ifdef USES_P073 -#include +# include uint8_t P073_getDefaultDigits(uint8_t displayModel, uint8_t digits) { @@ -1649,33 +1649,33 @@ bool P073_data_struct::plugin_write_7dbin(const String& text) { // =================================== # ifdef ESP32 -# define CLK_HIGH() DIRECT_pinWrite(this->pin1, HIGH) -# define CLK_LOW() DIRECT_pinWrite(this->pin1, LOW) -# define DIO_HIGH() DIRECT_pinWrite(this->pin2, HIGH) -# define DIO_LOW() DIRECT_PINMODE_OUTPUT(this->pin2); DIRECT_pinWrite(this->pin2, LOW) -# define DIO_INPUT() DIRECT_PINMODE_INPUT(this->pin2) +# define CLK_HIGH() DIRECT_pinWrite(this->pin1, HIGH) +# define CLK_LOW() DIRECT_pinWrite(this->pin1, LOW) +# define DIO_HIGH() DIRECT_pinWrite(this->pin2, HIGH) +# define DIO_LOW() DIRECT_PINMODE_OUTPUT(this->pin2); DIRECT_pinWrite(this->pin2, LOW) +# define DIO_INPUT() DIRECT_PINMODE_INPUT(this->pin2) # define DIO_OUTPUT() DIRECT_PINMODE_OUTPUT(this->pin2) # else // ifdef ESP32 -# define CLK_HIGH() pinMode(this->pin1, INPUT_PULLUP) -# define CLK_LOW() pinMode(this->pin1, OUTPUT) -# define DIO_HIGH() pinMode(this->pin2, INPUT_PULLUP) -# define DIO_LOW() pinMode(this->pin2, OUTPUT);digitalWrite(this->pin2, LOW) -# define DIO_INPUT() pinMode(this->pin2, INPUT_PULLUP) +# define CLK_HIGH() pinMode(this->pin1, INPUT_PULLUP) +# define CLK_LOW() pinMode(this->pin1, OUTPUT) +# define DIO_HIGH() pinMode(this->pin2, INPUT_PULLUP) +# define DIO_LOW() pinMode(this->pin2, OUTPUT); digitalWrite(this->pin2, LOW) +# define DIO_INPUT() pinMode(this->pin2, INPUT_PULLUP) # define DIO_OUTPUT() pinMode(this->pin2, OUTPUT) # endif // ifdef ESP32 void P073_data_struct::tm1637_i2cStart() { - # ifdef P073_DEBUG + # if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) addLog(LOG_LEVEL_DEBUG, F("7DGT : Comm Start")); - # endif // ifdef P073_DEBUG + # endif // if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) DIO_LOW(); delayMicroseconds(TM1637_CLOCKDELAY); } void P073_data_struct::tm1637_i2cStop() { - # ifdef P073_DEBUG + # if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) addLog(LOG_LEVEL_DEBUG, F("7DGT : Comm Stop")); - # endif // ifdef P073_DEBUG + # endif // if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) DIO_LOW(); delayMicroseconds(TM1637_CLOCKDELAY); CLK_HIGH(); @@ -1693,14 +1693,15 @@ bool P073_data_struct::tm1637_i2cAck() { const uint32_t start_wait = micros(); const bool acknowledged = -1 != - DIRECT_measureWaitForPinState_ISR(this->pin2, start_wait, TM1637_CLOCKDELAY, 0); + DIRECT_measureWaitForPinState_ISR(this->pin2, start_wait, TM1637_CLOCKDELAY, 0); const int32_t timePassed = usecPassedSince_fast(start_wait); + if (timePassed < TM1637_CLOCKDELAY) { delayMicroseconds(TM1637_CLOCKDELAY - timePassed); } - # ifdef P073_DEBUG + # if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) if (loglevelActiveFor(LOG_LEVEL_DEBUG)) { String log = F("7DGT : Comm ACK="); @@ -1712,13 +1713,13 @@ bool P073_data_struct::tm1637_i2cAck() { } addLogMove(LOG_LEVEL_DEBUG, log); } - # endif // ifdef P073_DEBUG - CLK_HIGH(); + # endif // if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) + CLK_HIGH(); - delayMicroseconds(TM1637_CLOCKDELAY); - CLK_LOW(); - delayMicroseconds(TM1637_CLOCKDELAY); - DIO_OUTPUT(); + delayMicroseconds(TM1637_CLOCKDELAY); + CLK_LOW(); + delayMicroseconds(TM1637_CLOCKDELAY); + DIO_OUTPUT(); return acknowledged; } @@ -1745,9 +1746,9 @@ void P073_data_struct::tm1637_i2cWriteByte_ack(uint8_t bytetoprint) { } void P073_data_struct::tm1637_i2cWrite(uint8_t bytetoprint) { - # ifdef P073_DEBUG + # if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) addLog(LOG_LEVEL_DEBUG, F("7DGT : WriteByte")); - # endif // ifdef P073_DEBUG + # endif // if defined(P073_DEBUG) && !defined(BUILD_NO_DEBUG) for (uint8_t i = 0; i < 8; ++i) { CLK_LOW(); @@ -1785,19 +1786,19 @@ void P073_data_struct::tm1637_SetPowerBrightness(uint8_t brightlvl, brightlvl |= TM1637_POWER_OFF; } - uint8_t bytesToPrint[]{brightlvl}; + uint8_t bytesToPrint[]{ brightlvl }; tm1637_i2cWrite_ack(bytesToPrint, NR_ELEMENTS(bytesToPrint)); } void P073_data_struct::tm1637_InitDisplay() { pinMode(this->pin1, OUTPUT); pinMode(this->pin2, OUTPUT); - - digitalWrite(this->pin1, HIGH); - digitalWrite(this->pin2, HIGH); + + digitalWrite(this->pin1, HIGH); + digitalWrite(this->pin2, HIGH); delayMicroseconds(TM1637_CLOCKDELAY); - uint8_t bytesToPrint[]{0x40}; + uint8_t bytesToPrint[]{ 0x40 }; tm1637_i2cWrite_ack(bytesToPrint, NR_ELEMENTS(bytesToPrint)); tm1637_ClearDisplay(); } diff --git a/src/src/WebServer/NetworkPage.cpp b/src/src/WebServer/NetworkPage.cpp index 5c46f4fb03..2eccdc9900 100644 --- a/src/src/WebServer/NetworkPage.cpp +++ b/src/src/WebServer/NetworkPage.cpp @@ -434,6 +434,7 @@ void handle_networks_NetworkSettingsPage(ESPEasy::net::networkIndex_t networkind if (NW_data && NW_data->hasPluginStats()) { addFormSubHeader(F("Statistics")); + addFormDetailsStart(false); # if FEATURE_CHART_JS if (NW_data->nrSamplesPresent() > 0) { @@ -454,6 +455,7 @@ void handle_networks_NetworkSettingsPage(ESPEasy::net::networkIndex_t networkind // } else { // somethingAdded = true; } + addFormDetailsEnd(); } } diff --git a/src/src/WebServer/PluginListPage.cpp b/src/src/WebServer/PluginListPage.cpp index 811bc2682c..f6b08eac06 100644 --- a/src/src/WebServer/PluginListPage.cpp +++ b/src/src/WebServer/PluginListPage.cpp @@ -41,9 +41,9 @@ void handle_pluginlist() { html_table_header(F(""), 25); html_table_header(F("Description"), 800); html_table_header(F(""), 50); - # if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS + # if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS || FEATURE_EMAIL_TLS html_table_header(F(""), 50); - # endif // if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS + # endif // if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS || FEATURE_EMAIL_TLS html_table_header(F("")); deviceIndex_t x; @@ -130,9 +130,13 @@ void handle_pluginlist() { html_table_header(F(""), 25); html_table_header(F("Description"), 800); html_table_header(F(""), 50); - # if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS + # if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS || FEATURE_EMAIL_TLS + # if FEATURE_EMAIL_TLS + html_table_header(F("TLS"), 50); + # else html_table_header(F(""), 50); - # endif // if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS + # endif // if FEATURE_EMAIL_TLS + # endif // if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS || FEATURE_EMAIL_TLS html_table_header(F("")); for (uint8_t x = 0; x <= notificationCount; x++) @@ -147,6 +151,13 @@ void handle_pluginlist() { NPlugin_ptr[x](NPlugin::Function::NPLUGIN_GET_DEVICENAME, 0, NotificationName); addHtml(NotificationName); html_TD(); + # if FEATURE_EMAIL_TLS + html_TD(); + + if (Notification[x].usesTLS) { + addEnabled(true); + } + # endif // if FEATURE_EMAIL_TLS } } # endif // if FEATURE_NOTIFIER @@ -159,9 +170,9 @@ void handle_pluginlist() { html_table_header(F(""), 25); html_table_header(F("Description"), 800); html_table_header(F(""), 50); - # if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS + # if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS || FEATURE_EMAIL_TLS html_table_header(F(""), 50); - # endif // if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS + # endif // if FEATURE_MQTT_TLS || FEATURE_HTTP_TLS || FEATURE_EMAIL_TLS html_table_header(F("")); ESPEasy::net::networkDriverIndex_t tmpNetworkDriverIndex{}; diff --git a/tools/pio/install-requirements.py b/tools/pio/install-requirements.py index 1ea4839572..a75e52f1c6 100644 --- a/tools/pio/install-requirements.py +++ b/tools/pio/install-requirements.py @@ -1,4 +1,5 @@ Import("env") +import os # ToDo: Use suggested code by Jason2866 @@ -7,4 +8,9 @@ try: from pygit2 import Repository except ImportError: - env.Execute("$PYTHONEXE -m pip install -r requirements.txt") + # Activate the Python environment penv and install the requirements there when not yet available + # Windows is different from other OS-es, assuming Powershell as default shell, not CMD (where separator: & instead of ;) + if os.name == "nt": + env.Execute(".\.platformio\penv\Scripts\activate ; uv pip install -r requirements.txt") + else: + env.Execute(". .platformio/penv/bin/activate ; uv pip install -r requirements.txt")