diff --git a/Makefile b/Makefile index d4dd85b3e..e911b4558 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,9 @@ MAKEFLAGS+="j " #TARGET := $(notdir $(CURDIR)) TARGET := emsesp BUILD := build -SOURCES := src src/* lib_standalone lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src src/devices lib/ArduinoJson/src lib/PButton lib/semver -INCLUDES := src lib_standalone lib/ArduinoJson/src lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src lib/uuid-telnet/src lib/uuid-syslog/src lib/semver lib/* src/devices -LIBRARIES := +SOURCES := src src/* lib_standalone lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src src/devices lib/ArduinoJson/src lib/PButton lib/semver lib/espMqttClient/src lib/espMqttClient/src/* +INCLUDES := src lib_standalone lib/espMqttClient/src lib/espMqttClient/src/Transport lib/ArduinoJson/src lib/uuid-common/src lib/uuid-console/src lib/uuid-log/src lib/uuid-telnet/src lib/uuid-syslog/src lib/semver lib/* src/devices +LIBRARIES := CPPCHECK = cppcheck # CHECKFLAGS = -q --force --std=c++17 @@ -36,8 +36,8 @@ CXX_STANDARD := -std=c++11 #---------------------------------------------------------------------- # Defined Symbols #---------------------------------------------------------------------- -DEFINES += -DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0 -DARDUINO -DEFINES += -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST +DEFINES += -DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0 +DEFINES += -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST -D__linux__ DEFINES += $(ARGS) DEFAULTS = -DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.6.0-dev\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\" @@ -52,7 +52,7 @@ CSOURCES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.c)) CXXSOURCES := $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.cpp)) OBJS := $(patsubst %,$(BUILD)/%.o,$(basename $(CSOURCES)) $(basename $(CXXSOURCES)) ) -DEPS := $(patsubst %,$(BUILD)/%.d,$(basename $(CSOURCES)) $(basename $(CXXSOURCES)) ) +DEPS := $(patsubst %,$(BUILD)/%.d,$(basename $(CSOURCES)) $(basename $(CXXSOURCES)) ) INCLUDE += $(addprefix -I,$(foreach dir,$(INCLUDES), $(wildcard $(dir)))) INCLUDE += $(addprefix -I,$(foreach dir,$(LIBRARIES),$(wildcard $(dir)/include))) @@ -79,7 +79,7 @@ CPPFLAGS += -g3 CPPFLAGS += -Os CFLAGS += $(CPPFLAGS) -CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-unused-lambda-capture +CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter CXXFLAGS += $(CFLAGS) -MMD diff --git a/lib/espMqttClient/src/MqttClient.h b/lib/espMqttClient/src/MqttClient.h index 6d36e0af5..dbcf7ec5b 100644 --- a/lib/espMqttClient/src/MqttClient.h +++ b/lib/espMqttClient/src/MqttClient.h @@ -24,167 +24,171 @@ the LICENSE file. #include "Transport/Transport.h" class MqttClient { - public: - virtual ~MqttClient(); - bool connected() const; - bool disconnected() const; - bool connect(); - bool disconnect(bool force = false); - template - uint16_t subscribe(const char* topic, uint8_t qos, Args&&... args) { - uint16_t packetId = _getNextPacketId(); - if (_state != State::connected) { - packetId = 0; - } else { - EMC_SEMAPHORE_TAKE(); - if (!_addPacket(packetId, topic, qos, std::forward(args) ...)) { - emc_log_e("Could not create SUBSCRIBE packet"); - packetId = 0; - } - EMC_SEMAPHORE_GIVE(); + public: + virtual ~MqttClient(); + bool connected() const; + bool disconnected() const; + bool connect(); + bool disconnect(bool force = false); + template + uint16_t subscribe(const char * topic, uint8_t qos, Args &&... args) { + uint16_t packetId = _getNextPacketId(); + if (_state != State::connected) { + packetId = 0; + } else { + EMC_SEMAPHORE_TAKE(); + if (!_addPacket(packetId, topic, qos, std::forward(args)...)) { + emc_log_e("Could not create SUBSCRIBE packet"); + packetId = 0; + } + EMC_SEMAPHORE_GIVE(); + } + return packetId; } - return packetId; - } - template - uint16_t unsubscribe(const char* topic, Args&&... args) { - uint16_t packetId = _getNextPacketId(); - if (_state != State::connected) { - packetId = 0; - } else { - EMC_SEMAPHORE_TAKE(); - if (!_addPacket(packetId, topic, std::forward(args) ...)) { - emc_log_e("Could not create UNSUBSCRIBE packet"); - packetId = 0; - } - EMC_SEMAPHORE_GIVE(); + template + uint16_t unsubscribe(const char * topic, Args &&... args) { + uint16_t packetId = _getNextPacketId(); + if (_state != State::connected) { + packetId = 0; + } else { + EMC_SEMAPHORE_TAKE(); + if (!_addPacket(packetId, topic, std::forward(args)...)) { + emc_log_e("Could not create UNSUBSCRIBE packet"); + packetId = 0; + } + EMC_SEMAPHORE_GIVE(); + } + return packetId; } - return packetId; - } - uint16_t publish(const char* topic, uint8_t qos, bool retain, const uint8_t* payload, size_t length); - uint16_t publish(const char* topic, uint8_t qos, bool retain, const char* payload); - uint16_t publish(const char* topic, uint8_t qos, bool retain, espMqttClientTypes::PayloadCallback callback, size_t length); - void clearQueue(bool deleteSessionData = false); // Not MQTT compliant and may cause unpredictable results when `deleteSessionData` = true! - const char* getClientId() const; - uint16_t getQueue() const; - void loop(); + uint16_t publish(const char * topic, uint8_t qos, bool retain, const uint8_t * payload, size_t length); + uint16_t publish(const char * topic, uint8_t qos, bool retain, const char * payload); + uint16_t publish(const char * topic, uint8_t qos, bool retain, espMqttClientTypes::PayloadCallback callback, size_t length); + void clearQueue(bool deleteSessionData = false); // Not MQTT compliant and may cause unpredictable results when `deleteSessionData` = true! + const char * getClientId() const; + uint16_t getQueue() const; + void loop(); - protected: - explicit MqttClient(espMqttClientTypes::UseInternalTask useInternalTask, uint8_t priority = 1, uint8_t core = 1); - espMqttClientTypes::UseInternalTask _useInternalTask; - espMqttClientInternals::Transport* _transport; + protected: + explicit MqttClient(espMqttClientTypes::UseInternalTask useInternalTask, uint8_t priority = 1, uint8_t core = 1); + espMqttClientTypes::UseInternalTask _useInternalTask; + espMqttClientInternals::Transport * _transport; - espMqttClientTypes::OnConnectCallback _onConnectCallback; - espMqttClientTypes::OnDisconnectCallback _onDisconnectCallback; - espMqttClientTypes::OnSubscribeCallback _onSubscribeCallback; - espMqttClientTypes::OnUnsubscribeCallback _onUnsubscribeCallback; - espMqttClientTypes::OnMessageCallback _onMessageCallback; - espMqttClientTypes::OnPublishCallback _onPublishCallback; - espMqttClientTypes::OnErrorCallback _onErrorCallback; - typedef void(*mqttClientHook)(void*); - const char* _clientId; - IPAddress _ip; - const char* _host; - uint16_t _port; - bool _useIp; - uint32_t _keepAlive; - bool _cleanSession; - const char* _username; - const char* _password; - const char* _willTopic; - const uint8_t* _willPayload; - uint16_t _willPayloadLength; - uint8_t _willQos; - bool _willRetain; - uint32_t _timeout; + espMqttClientTypes::OnConnectCallback _onConnectCallback; + espMqttClientTypes::OnDisconnectCallback _onDisconnectCallback; + espMqttClientTypes::OnSubscribeCallback _onSubscribeCallback; + espMqttClientTypes::OnUnsubscribeCallback _onUnsubscribeCallback; + espMqttClientTypes::OnMessageCallback _onMessageCallback; + espMqttClientTypes::OnPublishCallback _onPublishCallback; + espMqttClientTypes::OnErrorCallback _onErrorCallback; + typedef void (*mqttClientHook)(void *); + const char * _clientId; + IPAddress _ip; + const char * _host; + uint16_t _port; + bool _useIp; + uint32_t _keepAlive; + bool _cleanSession; + const char * _username; + const char * _password; + const char * _willTopic; + const uint8_t * _willPayload; + uint16_t _willPayloadLength; + uint8_t _willQos; + bool _willRetain; + uint32_t _timeout; - // state is protected to allow state changes by the transport system, defined in child classes - // eg. to allow AsyncTCP - enum class State { - disconnected = 0, - connectingTcp1 = 1, - connectingTcp2 = 2, - connectingMqtt = 3, - connected = 4, - disconnectingMqtt1 = 5, - disconnectingMqtt2 = 6, - disconnectingTcp1 = 7, - disconnectingTcp2 = 8 - }; - std::atomic _state; + // state is protected to allow state changes by the transport system, defined in child classes + // eg. to allow AsyncTCP + enum class State { + disconnected = 0, + connectingTcp1 = 1, + connectingTcp2 = 2, + connectingMqtt = 3, + connected = 4, + disconnectingMqtt1 = 5, + disconnectingMqtt2 = 6, + disconnectingTcp1 = 7, + disconnectingTcp2 = 8 + }; + std::atomic _state; - private: - char _generatedClientId[EMC_CLIENTID_LENGTH]; - uint16_t _packetId; + private: + char _generatedClientId[EMC_CLIENTID_LENGTH]; + uint16_t _packetId; #if defined(ARDUINO_ARCH_ESP32) - SemaphoreHandle_t _xSemaphore; - TaskHandle_t _taskHandle; - static void _loop(MqttClient* c); + SemaphoreHandle_t _xSemaphore; + TaskHandle_t _taskHandle; + static void _loop(MqttClient * c); #elif defined(ARDUINO_ARCH_ESP8266) && EMC_ESP8266_MULTITHREADING - std::atomic _xSemaphore = false; + std::atomic _xSemaphore = false; #elif defined(__linux__) - std::mutex mtx; + // added mutable to compile EMS-ESP standalone + mutable std::mutex mtx; #endif - uint8_t _rxBuffer[EMC_RX_BUFFER_SIZE]; - struct OutgoingPacket { - uint32_t timeSent; - espMqttClientInternals::Packet packet; + uint8_t _rxBuffer[EMC_RX_BUFFER_SIZE]; + struct OutgoingPacket { + uint32_t timeSent; + espMqttClientInternals::Packet packet; + template + OutgoingPacket(uint32_t t, espMqttClientTypes::Error error, Args &&... args) + : timeSent(t) + , packet(error, std::forward(args)...) { + } + }; + espMqttClientInternals::Outbox _outbox; + size_t _bytesSent; + espMqttClientInternals::Parser _parser; + uint32_t _lastClientActivity; + uint32_t _lastServerActivity; + bool _pingSent; + espMqttClientTypes::DisconnectReason _disconnectReason; + + uint16_t _getNextPacketId(); + template - OutgoingPacket(uint32_t t, espMqttClientTypes::Error error, Args&&... args) : - timeSent(t), - packet(error, std::forward(args) ...) {} - }; - espMqttClientInternals::Outbox _outbox; - size_t _bytesSent; - espMqttClientInternals::Parser _parser; - uint32_t _lastClientActivity; - uint32_t _lastServerActivity; - bool _pingSent; - espMqttClientTypes::DisconnectReason _disconnectReason; + bool _addPacket(Args &&... args) { + espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS); + espMqttClientInternals::Outbox::Iterator it = _outbox.emplace(0, error, std::forward(args)...); + if (it && error == espMqttClientTypes::Error::SUCCESS) + return true; + return false; + } - uint16_t _getNextPacketId(); + template + bool _addPacketFront(Args &&... args) { + espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS); + espMqttClientInternals::Outbox::Iterator it = _outbox.emplaceFront(0, error, std::forward(args)...); + if (it && error == espMqttClientTypes::Error::SUCCESS) + return true; + return false; + } - template - bool _addPacket(Args&&... args) { - espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS); - espMqttClientInternals::Outbox::Iterator it = _outbox.emplace(0, error, std::forward(args) ...); - if (it && error == espMqttClientTypes::Error::SUCCESS) return true; - return false; - } + void _checkOutbox(); + int _sendPacket(); + bool _advanceOutbox(); + void _checkIncoming(); + void _checkPing(); + void _checkTimeout(); - template - bool _addPacketFront(Args&&... args) { - espMqttClientTypes::Error error(espMqttClientTypes::Error::SUCCESS); - espMqttClientInternals::Outbox::Iterator it = _outbox.emplaceFront(0, error, std::forward(args) ...); - if (it && error == espMqttClientTypes::Error::SUCCESS) return true; - return false; - } + void _onConnack(); + void _onPublish(); + void _onPuback(); + void _onPubrec(); + void _onPubrel(); + void _onPubcomp(); + void _onSuback(); + void _onUnsuback(); - void _checkOutbox(); - int _sendPacket(); - bool _advanceOutbox(); - void _checkIncoming(); - void _checkPing(); - void _checkTimeout(); + void _clearQueue(int clearData); // 0: keep session, + // 1: keep only PUBLISH qos > 0 + // 2: delete all + void _onError(uint16_t packetId, espMqttClientTypes::Error error); - void _onConnack(); - void _onPublish(); - void _onPuback(); - void _onPubrec(); - void _onPubrel(); - void _onPubcomp(); - void _onSuback(); - void _onUnsuback(); - - void _clearQueue(int clearData); // 0: keep session, - // 1: keep only PUBLISH qos > 0 - // 2: delete all - void _onError(uint16_t packetId, espMqttClientTypes::Error error); - - #if defined(ARDUINO_ARCH_ESP32) - #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO - size_t _highWaterMark; - #endif - #endif +#if defined(ARDUINO_ARCH_ESP32) +#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO + size_t _highWaterMark; +#endif +#endif }; diff --git a/lib_standalone/Arduino.cpp b/lib_standalone/Arduino.cpp index 56dd38695..34194b2d7 100644 --- a/lib_standalone/Arduino.cpp +++ b/lib_standalone/Arduino.cpp @@ -51,9 +51,9 @@ int main(int argc __attribute__((unused)), char * argv[] __attribute__((unused)) return 0; } -unsigned long millis() { - return __millis; -} +// unsigned long millis() { +// return __millis; +// } int64_t esp_timer_get_time() { return __millis; diff --git a/lib_standalone/Arduino.h b/lib_standalone/Arduino.h index afacf2578..0b83797e4 100644 --- a/lib_standalone/Arduino.h +++ b/lib_standalone/Arduino.h @@ -35,7 +35,7 @@ #include // #define IPAddress std::string -#define IPAddress String +// #define IPAddress String #define ICACHE_FLASH_ATTR #define ICACHE_RAM_ATTR @@ -171,7 +171,13 @@ extern NativeConsole Serial; extern ETHClass ETH; extern WiFiClass WiFi; -unsigned long millis(); +// unsigned long millis(); + +#if defined(__linux__) +#include // NOLINT [build/c++11] +#include // NOLINT [build/c++11] for yield() +#define millis() std::chrono::duration_cast(std::chrono::steady_clock::now().time_since_epoch()).count() +#endif int64_t esp_timer_get_time(); diff --git a/lib_standalone/ESP8266React.h b/lib_standalone/ESP8266React.h index b673f41b8..e5d8e5b02 100644 --- a/lib_standalone/ESP8266React.h +++ b/lib_standalone/ESP8266React.h @@ -112,6 +112,11 @@ class ESP8266React { return _mqttClient; } + void setWill(const char * will_topic) { + } + void onMessage(espMqttClientTypes::OnMessageCallback callback) { + } + StatefulService * getNetworkSettingsService() { return &_settings; } diff --git a/lib_standalone/Network.h b/lib_standalone/Network.h index 836167df5..6fa63c151 100644 --- a/lib_standalone/Network.h +++ b/lib_standalone/Network.h @@ -3,6 +3,7 @@ #include #include +#include #define WiFiMode_t wifi_mode_t #define WIFI_OFF WIFI_MODE_NULL diff --git a/lib_standalone/avr/pgmspace.h b/lib_standalone/avr/pgmspace.h new file mode 100644 index 000000000..e69de29bb diff --git a/lib_standalone/espMqttClient.h b/lib_standalone/espMqttClient.h deleted file mode 100644 index 354850f49..000000000 --- a/lib_standalone/espMqttClient.h +++ /dev/null @@ -1,130 +0,0 @@ -#ifndef ESPMQTTCLIENT_H_ -#define ESPMQTTCLIENT_H_ - -#include "Arduino.h" -#include - -namespace espMqttClientTypes { - -enum class DisconnectReason : uint8_t { - USER_OK = 0, - MQTT_UNACCEPTABLE_PROTOCOL_VERSION = 1, - MQTT_IDENTIFIER_REJECTED = 2, - MQTT_SERVER_UNAVAILABLE = 3, - MQTT_MALFORMED_CREDENTIALS = 4, - MQTT_NOT_AUTHORIZED = 5, - TLS_BAD_FINGERPRINT = 6, - TCP_DISCONNECTED = 7 -}; -const char * disconnectReasonToString(DisconnectReason reason); - -enum class SubscribeReturncode : uint8_t { QOS0 = 0x00, QOS1 = 0x01, QOS2 = 0x02, FAIL = 0X80 }; -const char * subscribeReturncodeToString(SubscribeReturncode returnCode); - -enum class Error : uint8_t { SUCCESS = 0, OUT_OF_MEMORY = 1, MAX_RETRIES = 2, MALFORMED_PARAMETER = 3, MISC_ERROR = 4 }; -const char * errorToString(Error error); - -struct MessageProperties { - uint8_t qos; - bool dup; - bool retain; - uint16_t packetId; -}; - -typedef std::function OnConnectCallback; -typedef std::function OnDisconnectCallback; -typedef std::function OnSubscribeCallback; -typedef std::function OnUnsubscribeCallback; -typedef std::function OnMessageCallback; -typedef std::function OnPublishCallback; -typedef std::function PayloadCallback; -typedef std::function OnErrorCallback; - -} // namespace espMqttClientTypes - -class espMqttClient { - public: - espMqttClient(); - ~espMqttClient(); - - espMqttClient & setKeepAlive(uint16_t keepAlive); - espMqttClient & setClientId(const char * clientId); - espMqttClient & setCleanSession(bool cleanSession); - espMqttClient & setMaxTopicLength(uint16_t maxTopicLength); - espMqttClient & setCredentials(const char * username, const char * password = nullptr); - espMqttClient & setWill(const char * topic, uint8_t qos, bool retain, const char * payload = nullptr, size_t length = 0) { - return *this; - } - espMqttClient & setServer(IPAddress ip, uint16_t port); - espMqttClient & setServer(const char * host, uint16_t port); - - espMqttClient & onConnect(espMqttClientTypes::OnConnectCallback callback) { - return *this; - } - espMqttClient & onDisconnect(espMqttClientTypes::OnDisconnectCallback callback) { - return *this; - } - espMqttClient & onSubscribe(espMqttClientTypes::OnSubscribeCallback callback) { - return *this; - } - espMqttClient & onUnsubscribe(espMqttClientTypes::OnUnsubscribeCallback callback) { - return *this; - } - espMqttClient & onMessage(espMqttClientTypes::OnMessageCallback callback) { - return *this; - } - espMqttClient & onPublish(espMqttClientTypes::OnPublishCallback callback) { - return *this; - } - - bool connected() const { - return false; - } - void connect() { - } - void disconnect(bool force = false) { - } - uint16_t subscribe(const char * topic, uint8_t qos) { - return 1; - } - uint16_t unsubscribe(const char * topic) { - return 1; - } - uint16_t publish(const char * topic, uint8_t qos, bool retain, const char * payload = nullptr, size_t length = 0, bool dup = false, uint16_t message_id = 0) { - return 1; - } - - const char * getClientId() { - return "12"; - } - - uint16_t getQueue() const { - return 0; - } - - private: - bool _connected; - bool _connectPacketNotEnoughSpace; - bool _disconnectOnPoll; - bool _tlsBadFingerprint; - uint32_t _lastClientActivity; - uint32_t _lastServerActivity; - uint32_t _lastPingRequestTime; - char _generatedClientId[18 + 1]; // esp8266-abc123 and esp32-abcdef123456 - IPAddress _ip; - const char * _host; - bool _useIp; - uint16_t _port; - uint16_t _keepAlive; - bool _cleanSession; - const char * _clientId; - const char * _username; - const char * _password; - const char * _willTopic; - const char * _willPayload; - uint16_t _willPayloadLength; - uint8_t _willQos; - bool _willRetain; -}; - -#endif diff --git a/platformio.ini b/platformio.ini index dccd71b4c..e13e08f13 100644 --- a/platformio.ini +++ b/platformio.ini @@ -2,10 +2,10 @@ ; override any settings with your own local ones in pio_local.ini [platformio] -default_envs = esp32_4M +; default_envs = esp32_4M ; default_envs = lolin_s3 ; default_envs = esp32_16M -; default_envs = standalone +default_envs = standalone extra_configs = factory_settings.ini @@ -20,7 +20,6 @@ core_build_flags = ; -std=gnu++17 ; core_unbuild_flags = -std=gnu++11 -; core_unbuild_flags = -std=gnu++17 core_unbuild_flags = ; my_build_flags is set in pio_local.ini @@ -41,9 +40,12 @@ unbuild_flags = [espressi32_base] platform = espressif32 -; platform = espressif32@5.3.0 -; platform = espressif32@5.2.0 framework = arduino +build_flags = ${common.build_flags} +build_unflags = ${common.unbuild_flags} +extra_scripts = + pre:scripts/build_interface.py + scripts/rename_fw.py [env] monitor_speed = 115200 @@ -62,7 +64,7 @@ check_flags = ; build for GitHub Actions CI ; the Web interface is built seperately [env:ci] -platform = espressif32@5.2.0 +platform = espressif32 framework = arduino extra_scripts = scripts/rename_fw.py board = esp32dev @@ -84,99 +86,69 @@ build_flags = ${common.build_flags} -O2 build_unflags = ${common.unbuild_flags} [env:esp32_4M] -platform = espressif32@5.2.0 -framework = arduino -extra_scripts = - pre:scripts/build_interface.py - scripts/rename_fw.py +extends = espressi32_base board = esp32dev board_upload.flash_size = 4MB board_build.partitions = esp32_partition_4M.csv build_flags = ${common.build_flags} -Os -build_unflags = ${common.unbuild_flags} [env:esp32_4Mplus] extends = espressi32_base -extra_scripts = - pre:scripts/build_interface.py - scripts/rename_fw.py board = esp32dev board_upload.flash_size = 4MB board_build.partitions = esp32_asym_partition_4M.csv build_flags = ${common.build_flags} -build_unflags = ${common.unbuild_flags} [env:esp32_16M] extends = espressi32_base -extra_scripts = - pre:scripts/build_interface.py - scripts/rename_fw.py board = esp32dev board_upload.flash_size = 16MB board_build.partitions = esp32_partition_16M.csv build_flags = ${common.build_flags} -build_unflags = ${common.unbuild_flags} [env:lolin_c3_mini] extends = espressi32_base -extra_scripts = - pre:scripts/build_interface.py - scripts/rename_fw.py board = lolin_c3_mini board_upload.flash_size = 4MB board_build.partitions = esp32_asym_partition_4M.csv build_flags = ${common.build_flags} -build_unflags = ${common.unbuild_flags} ; lolin C3 mini v1 needs special wifi init. ; https://www.wemos.cc/en/latest/c3/c3_mini_1_0_0.html#about-wifi [env:lolin_c3_mini_v1] extends = espressi32_base -extra_scripts = - pre:scripts/build_interface.py - scripts/rename_fw.py board = lolin_c3_mini board_upload.flash_size = 4MB board_build.partitions = esp32_asym_partition_4M.csv build_flags = ${common.build_flags} -DBOARD_C3_MINI_V1 -build_unflags = ${common.unbuild_flags} [env:lolin_s2_mini] extends = espressi32_base -extra_scripts = - pre:scripts/build_interface.py - scripts/rename_fw.py board = lolin_s2_mini board_upload.flash_size = 4MB board_build.partitions = esp32_asym_partition_4M.csv build_flags = ${common.build_flags} -build_unflags = ${common.unbuild_flags} [env:lolin_s3] extends = espressi32_base -extra_scripts = - pre:scripts/build_interface.py - scripts/rename_fw.py board = lolin_s3 board_build.f_cpu = 240000000L board_upload.flash_size = 16MB board_build.partitions = esp32_partition_16M.csv -build_flags = ${common.build_flags} -O2 -build_unflags = ${common.unbuild_flags} board_upload.use_1200bps_touch = false board_upload.wait_for_upload_port = false +build_flags = ${common.build_flags} -O2 ; to build and run: pio run -e standalone -t exec [env:standalone] platform = native build_flags = - -DARDUINO - -DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0 + -DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0 -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST -DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.6.0-dev\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\" -lpthread -std=gnu++11 -Og -ggdb -build_src_flags = +build_src_flags = -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-unused-lambda-capture -I./lib_standalone -I./lib/ArduinoJson/src @@ -185,6 +157,8 @@ build_src_flags = -I./lib/uuid-log/src -I./lib/semver -I./lib/PButton + -I./lib/espMqttClient/src + -I./lib/espMqttClient/src/Transport build_src_filter = +<*> -<.git/> @@ -194,5 +168,7 @@ build_src_filter = +<../lib/uuid-log> +<../lib/semver> +<../lib/PButton> + +<../lib/espMqttClient/src> + +<../lib/espMqttClient/src/Transport> lib_compat_mode = off lib_ldf_mode = off