mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-09-11 17:14:27 +00:00
[ESP-IDF5.1] Fix IPv6 for ESP32-S3
This commit is contained in:
@@ -217,7 +217,7 @@ lib_ignore =
|
||||
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1847/framework-arduinoespressif32-release_v5.1-29db12e.zip
|
||||
platform = https://github.com/tasmota/platform-espressif32/releases/download/2023.12.10/platform-espressif32.zip
|
||||
;platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1894/framework-arduinoespressif32-release_v5.1-8f01299.zip
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1916/framework-arduinoespressif32-release_v5.1-d4d5f8a.zip
|
||||
platform_packages = framework-arduinoespressif32 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1917/framework-arduinoespressif32-release_v5.1-d4d5f8a.zip
|
||||
build_flags = -DESP32_STAGE
|
||||
-DESP_IDF_VERSION_MAJOR=5
|
||||
-DLIBRARIES_NO_LOG=1
|
||||
|
||||
@@ -62,7 +62,7 @@ build_flags = ${core_esp32_IDF5_1__3_0_0.build_flags}
|
||||
-DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_NONE
|
||||
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO
|
||||
; -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE
|
||||
-DLWIP_IPV6
|
||||
-DLWIP_IPV6=1
|
||||
monitor_filters = esp32_exception_decoder
|
||||
lib_ignore =
|
||||
${core_esp32_IDF5_1__3_0_0.lib_ignore}
|
||||
|
||||
@@ -18,7 +18,7 @@ build_unflags = ${esp32_base.build_unflags}
|
||||
; IDF 5.1.2
|
||||
[esp32_solo1_common_LittleFS]
|
||||
extends = esp32_base_idf5
|
||||
platform_packages = framework-arduino-solo1 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1915/framework-arduinoespressif32-solo1-release_v5.1-d4d5f8a.zip
|
||||
platform_packages = framework-arduino-solo1 @ https://github.com/Jason2866/esp32-arduino-lib-builder/releases/download/1918/framework-arduinoespressif32-solo1-release_v5.1-d4d5f8a.zip
|
||||
build_flags = ${esp32_base_idf5.build_flags}
|
||||
-DFEATURE_ARDUINO_OTA=1
|
||||
-DUSE_LITTLEFS
|
||||
|
||||
@@ -145,7 +145,7 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
|
||||
-DFEATURE_ARDUINO_OTA=1
|
||||
-DPLUGIN_BUILD_CUSTOM
|
||||
-DFEATURE_SD=1
|
||||
extra_scripts = ${esp32s3_common.extra_scripts}
|
||||
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
|
||||
pre:tools/pio/pre_custom_esp32.py
|
||||
|
||||
[env:custom_ESP32s3_8M1M_LittleFS_OPI_PSRAM_CDC]
|
||||
@@ -160,7 +160,7 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
|
||||
-DFEATURE_ARDUINO_OTA=1
|
||||
-DPLUGIN_BUILD_MAX_ESP32
|
||||
-DPLUGIN_BUILD_IR_EXTENDED
|
||||
extra_scripts = ${esp32_common.extra_scripts}
|
||||
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
|
||||
|
||||
|
||||
[env:max_ESP32s3_8M1M_LittleFS_OPI_PSRAM_CDC]
|
||||
@@ -176,7 +176,7 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
|
||||
-DPLUGIN_BUILD_CUSTOM
|
||||
-DPLUGIN_BUILD_IR_EXTENDED
|
||||
-DFEATURE_SD=1
|
||||
extra_scripts = ${esp32s3_common.extra_scripts}
|
||||
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
|
||||
pre:tools/pio/pre_custom_esp32.py
|
||||
|
||||
[env:custom_ESP32s3_16M8M_LittleFS_OPI_PSRAM_CDC]
|
||||
@@ -192,7 +192,7 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
|
||||
-DFEATURE_ARDUINO_OTA=1
|
||||
-DPLUGIN_BUILD_MAX_ESP32
|
||||
-DPLUGIN_BUILD_IR_EXTENDED
|
||||
extra_scripts = ${esp32_common.extra_scripts}
|
||||
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
|
||||
|
||||
|
||||
[env:max_ESP32s3_16M8M_LittleFS_OPI_PSRAM_CDC]
|
||||
@@ -203,6 +203,6 @@ build_flags = ${esp32s3_common_LittleFS.build_flags}
|
||||
-DFEATURE_ARDUINO_OTA=1
|
||||
-DPLUGIN_BUILD_MAX_ESP32
|
||||
-DPLUGIN_BUILD_IR_EXTENDED
|
||||
extra_scripts = ${esp32_common.extra_scripts}
|
||||
extra_scripts = ${esp32s3_common_LittleFS.extra_scripts}
|
||||
|
||||
|
||||
|
||||
@@ -179,26 +179,17 @@ const __FlashStringHelper * Command_JSONPortStatus(struct EventStruct *event, co
|
||||
void createLogPortStatus(std::map<uint32_t, portStatusStruct>::iterator it)
|
||||
{
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO)) {
|
||||
String log;
|
||||
log += F("PortStatus detail: Port=");
|
||||
log += getPortFromKey(it->first);
|
||||
log += F(" State=");
|
||||
log += it->second.getValue();
|
||||
log += F(" Output=");
|
||||
log += it->second.output;
|
||||
log += F(" Mode=");
|
||||
log += it->second.mode;
|
||||
log += F(" Task=");
|
||||
log += it->second.task;
|
||||
log += F(" Monitor=");
|
||||
log += it->second.monitor;
|
||||
log += F(" Command=");
|
||||
log += it->second.command;
|
||||
log += F(" Init=");
|
||||
log += it->second.init;
|
||||
log += F(" PreviousTask=");
|
||||
log += it->second.previousTask;
|
||||
addLogMove(LOG_LEVEL_INFO, log);
|
||||
addLogMove(LOG_LEVEL_INFO, strformat(
|
||||
F("PortStatus detail: Port=%u State=%d Output=%d Mode=%u Task=%u Monitor=%u Command=%d Init=%d PreviousTask=%d"),
|
||||
getPortFromKey(it->first),
|
||||
it->second.getValue(),
|
||||
it->second.output,
|
||||
it->second.mode,
|
||||
it->second.task,
|
||||
it->second.monitor,
|
||||
it->second.command,
|
||||
it->second.init,
|
||||
it->second.previousTask));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -309,6 +309,9 @@ bool InternalCommands::executeInternalCommand()
|
||||
case ESPEasy_cmd_e::i2cscanner: COMMAND_CASE_R(Command_i2c_Scanner, -1); // i2c.h
|
||||
case ESPEasy_cmd_e::inc: COMMAND_CASE_A(Command_Rules_Inc, -1); // Rules.h
|
||||
case ESPEasy_cmd_e::ip: COMMAND_CASE_R(Command_IP, 1); // Network Command
|
||||
#if FEATURE_USE_IPV6
|
||||
case ESPEasy_cmd_e::ip6: COMMAND_CASE_R(Command_show_all_IP6, 0); // Network Command
|
||||
#endif
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
case ESPEasy_cmd_e::jsonportstatus: COMMAND_CASE_A(Command_JSONPortStatus, -1); // Diagnostic.h
|
||||
#endif // ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
|
||||
@@ -87,6 +87,9 @@ const char Internal_commands_ghij[] PROGMEM =
|
||||
"i2cscanner|"
|
||||
"inc|"
|
||||
"ip|"
|
||||
#if FEATURE_USE_IPV6
|
||||
"ip6|"
|
||||
#endif
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
"jsonportstatus|"
|
||||
#endif // ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
|
||||
@@ -67,6 +67,9 @@ enum class ESPEasy_cmd_e : uint8_t {
|
||||
i2cscanner,
|
||||
inc,
|
||||
ip,
|
||||
#if FEATURE_USE_IPV6
|
||||
ip6,
|
||||
#endif
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
jsonportstatus,
|
||||
#endif // ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
|
||||
@@ -40,6 +40,29 @@ String Command_IP (struct EventStruct *event, const char* Line)
|
||||
return Command_GetORSetIP(event, F("IP:"), Line, Settings.IP, NetworkLocalIP(),1);
|
||||
}
|
||||
|
||||
#if FEATURE_USE_IPV6
|
||||
String Command_show_all_IP6 (struct EventStruct *event, const char* Line)
|
||||
{
|
||||
// Only get all IPv6 addresses
|
||||
IP6Addresses_t addresses = NetworkAllIPv6();
|
||||
String res;
|
||||
res += '[';
|
||||
bool first = true;
|
||||
for (auto it = addresses.begin(); it != addresses.end(); ++it)
|
||||
{
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
res += ',';
|
||||
}
|
||||
res += wrap_String(it->toString(true), '"');
|
||||
}
|
||||
res += ']';
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
String Command_Subnet (struct EventStruct *event, const char* Line)
|
||||
{
|
||||
return Command_GetORSetIP(event, F("Subnet:"), Line, Settings.Subnet, NetworkSubnetMask(), 1);
|
||||
|
||||
@@ -9,7 +9,11 @@ String Command_AccessInfo_Clear (struct EventStruct *event, const char* Line);
|
||||
String Command_DNS (struct EventStruct *event, const char* Line);
|
||||
String Command_Gateway (struct EventStruct *event, const char* Line);
|
||||
String Command_IP (struct EventStruct *event, const char* Line);
|
||||
#if FEATURE_USE_IPV6
|
||||
String Command_show_all_IP6 (struct EventStruct *event, const char* Line);
|
||||
#endif
|
||||
String Command_Subnet (struct EventStruct *event, const char* Line);
|
||||
#if FEATURE_ETHERNET
|
||||
String Command_ETH_Phy_Addr (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_Pin_mdc (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_Pin_mdio (struct EventStruct *event, const char* Line);
|
||||
@@ -22,5 +26,6 @@ String Command_ETH_Subnet (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_DNS (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_Wifi_Mode (struct EventStruct *event, const char* Line);
|
||||
String Command_ETH_Disconnect (struct EventStruct *event, const char* Line);
|
||||
#endif
|
||||
|
||||
#endif // COMMAND_NETWORKS_H
|
||||
|
||||
@@ -1088,6 +1088,9 @@ To create/register a plugin, you have to :
|
||||
#define PLUGIN_SET_MAX
|
||||
#define CONTROLLER_SET_ALL
|
||||
#define NOTIFIER_SET_ALL
|
||||
#ifndef TESTING_FEATURE_USE_IPV6
|
||||
#define TESTING_FEATURE_USE_IPV6
|
||||
#endif
|
||||
#ifndef PLUGIN_ENERGY_COLLECTION
|
||||
#define PLUGIN_ENERGY_COLLECTION
|
||||
#endif
|
||||
|
||||
@@ -218,7 +218,11 @@ String formatIP(const IPAddress& ip, bool includeZone) {
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
#if FEATURE_USE_IPV6
|
||||
return ip.toString(includeZone);
|
||||
#else
|
||||
return ip.toString();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -666,6 +670,18 @@ String to_json_value(const String& value, bool wrapInQuotes) {
|
||||
// Empty string
|
||||
return F("\"\"");
|
||||
}
|
||||
if (value.length() > 2) {
|
||||
// Check for JSON objects or arrays
|
||||
const char firstchar = value[0];
|
||||
const char lastchar = value[value.length() - 1];
|
||||
if ((firstchar == '[' && lastchar == ']') ||
|
||||
(firstchar == '{' && lastchar == '}'))
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (wrapInQuotes || mustConsiderAsJSONString(value)) {
|
||||
// Is not a numerical value, or BIN/HEX notation, thus wrap with quotes
|
||||
|
||||
|
||||
@@ -43,27 +43,41 @@ HandledWebCommand_result handle_command_from_web(EventValueSource::Enum source,
|
||||
eventQueue.addMove(parseStringToEndKeepCase(webrequest, 2));
|
||||
handledCmd = true;
|
||||
sendOK = true;
|
||||
} else if (command_e == ESPEasy_cmd_e::taskrun ||
|
||||
command_e == ESPEasy_cmd_e::taskrunat ||
|
||||
command_e == ESPEasy_cmd_e::scheduletaskrun ||
|
||||
command_e == ESPEasy_cmd_e::taskvalueset ||
|
||||
command_e == ESPEasy_cmd_e::taskvaluesetandrun ||
|
||||
command_e == ESPEasy_cmd_e::taskvaluetoggle ||
|
||||
command_e == ESPEasy_cmd_e::let ||
|
||||
} else {
|
||||
switch (command_e) {
|
||||
case ESPEasy_cmd_e::taskrun:
|
||||
case ESPEasy_cmd_e::taskrunat:
|
||||
case ESPEasy_cmd_e::scheduletaskrun:
|
||||
case ESPEasy_cmd_e::taskvalueset:
|
||||
case ESPEasy_cmd_e::taskvaluesetandrun:
|
||||
case ESPEasy_cmd_e::taskvaluetoggle:
|
||||
case ESPEasy_cmd_e::let:
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
command_e == ESPEasy_cmd_e::logportstatus ||
|
||||
case ESPEasy_cmd_e::logportstatus:
|
||||
#endif
|
||||
command_e == ESPEasy_cmd_e::logentry ||
|
||||
case ESPEasy_cmd_e::logentry:
|
||||
case ESPEasy_cmd_e::rules:
|
||||
sendOK = true;
|
||||
break;
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
command_e == ESPEasy_cmd_e::jsonportstatus ||
|
||||
case ESPEasy_cmd_e::jsonportstatus:
|
||||
sendOK = true;
|
||||
printToWebJSON = true;
|
||||
break;
|
||||
#endif
|
||||
command_e == ESPEasy_cmd_e::rules) {
|
||||
sendOK = true;
|
||||
#if FEATURE_USE_IPV6
|
||||
case ESPEasy_cmd_e::ip6:
|
||||
sendOK = true;
|
||||
printToWebJSON = true;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
sendOK = false;
|
||||
break;
|
||||
}
|
||||
|
||||
// handledCmd = true;
|
||||
} else {
|
||||
sendOK = false;
|
||||
}
|
||||
}
|
||||
if (!handledCmd) {
|
||||
printToWeb = true;
|
||||
handledCmd = ExecuteCommand_internal(source, webrequest.c_str());
|
||||
@@ -73,11 +87,11 @@ HandledWebCommand_result handle_command_from_web(EventValueSource::Enum source,
|
||||
if (handledCmd) {
|
||||
if (sendOK) {
|
||||
String reply = printWebString.isEmpty() ? F("OK") : printWebString;
|
||||
removeChar(reply, '\n'); // Don't use newline in JSON.
|
||||
if (printToWebJSON) {
|
||||
removeChar(reply, '\n'); // Don't use newline in JSON.
|
||||
// Format return string of command to JSON format
|
||||
printWebString = strformat(
|
||||
F("{\"return\": \"%s\",\"command\": \"%s\"}"),
|
||||
F("{\"return\": %s,\"command\": %s}"),
|
||||
to_json_value(reply).c_str(),
|
||||
to_json_value(webrequest).c_str());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user