From f45b55a18b17cffc95a780507ceb3ecfcb516705 Mon Sep 17 00:00:00 2001 From: Dellucifer <84488210+dellucifer@users.noreply.github.com> Date: Thu, 26 Oct 2023 21:34:34 +0530 Subject: [PATCH 1/5] Rectified Typos (#19841) * Rectified Typos * Update settings.json --- API.md | 2 +- CONTRIBUTING.md | 2 +- FIRMWARE.md | 2 +- info/xdrv_57_tasmesh.md | 2 +- pio-tools/espupload.py | 2 +- pio-tools/name-firmware.py | 2 +- tools/decode-status.py | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/API.md b/API.md index 3a7a24c78bf2..e12eea92e5f4 100644 --- a/API.md +++ b/API.md @@ -17,7 +17,7 @@ Callback Id | Bool | xdrv | xsns | xnrg | xlgt | Description ----------------------------|------|------|------|------|------|---------------------------------- FUNC_SETTINGS_OVERRIDE | | x | | | | Override start-up settings FUNC_PIN_STATE | x | 1 | 2 | | | At GPIO configuration -FUNC_I2C_INIT | | x | | | | Immediatly after I2C init +FUNC_I2C_INIT | | x | | | | Immediately after I2C init FUNC_MODULE_INIT | x | 3 | 1 | | 2 | Init module specific parameters FUNC_PRE_INIT | | 1 | 3 | 2 | | Once GPIO have been established FUNC_INIT | | 1 | 3 | 2 | | At end of initialisation diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7b15232be36e..ddb0768a5e89 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -99,7 +99,7 @@ To accept the CLA it is required to put a x between [ ] on `[ ] I accept the CLA **Why a CLA ?** -_"A Contributor Licence Agreement (CLA) is strongly recommended when accepting third party contributions to an open development project, such as an open source software project. In order to redistribute contributions, it is necessary to ensure that the project has the necessary rights to do so. A Contributor Licence Agreement is a lightweight agreement, signed by the copyright holder, that grants the necessary rights for the contribution to be redistributed as part of the project."_ [OSS Watch](http://oss-watch.ac.uk/resources/cla) +_"A Contributor License Agreement (CLA) is strongly recommended when accepting third party contributions to an open development project, such as an open source software project. In order to redistribute contributions, it is necessary to ensure that the project has the necessary rights to do so. A Contributor License Agreement is a lightweight agreement, signed by the copyright holder, that grants the necessary rights for the contribution to be redistributed as part of the project."_ [OSS Watch](http://oss-watch.ac.uk/resources/cla) A CLA is a legal document in which you state _you are entitled to contribute the code/documentation/translation to the project_ you’re contributing to and that _you are willing to have it used in distributions and derivative works_. This means that should there be any kind of legal issue in the future as to the origins and ownership of any particular piece of code, then that project has the necessary forms on file from the contributor(s) saying they were permitted to make this contribution. diff --git a/FIRMWARE.md b/FIRMWARE.md index f0e069a9a136..43f76f8d2815 100644 --- a/FIRMWARE.md +++ b/FIRMWARE.md @@ -27,7 +27,7 @@ See [CHANGELOG.md](/~https://github.com/arendst/Tasmota/blob/development/tasmota/C Unless your Tasmota powered device exhibits a problem or you need to make use of a feature that is not available in the Tasmota version currently installed on your device, leave your device alone - it works so don't make unnecessary changes! If the release version (i.e., the master branch) exhibits unexpected behaviour for your device and configuration, you should upgrade to the latest development version instead to see if your problem is resolved as some bugs in previous releases or development builds may already have been resolved. -If new commits have been merged and they compile successfuly, new binary files for every variant will be placed here /~https://github.com/arendst/Tasmota-firmware/tree/main/firmware (this URL address can NOT be used for OTA updates) It is important to note that these binaries are based on the current development codebase. These commits are tested as much as is possible and are typically quite stable. However, it is infeasible to test on the hundreds of different types of devices with all the available configuration options permitted. +If new commits have been merged and they compile successfully, new binary files for every variant will be placed here /~https://github.com/arendst/Tasmota-firmware/tree/main/firmware (this URL address can NOT be used for OTA updates) It is important to note that these binaries are based on the current development codebase. These commits are tested as much as is possible and are typically quite stable. However, it is infeasible to test on the hundreds of different types of devices with all the available configuration options permitted. Note that there is a chance, as with any upgrade, that the device may not function as expected. You must always account for the possibility that you may need to flash the device via the serial programming interface if the OTA upgrade fails. Even with the master release, you should always attempt to test the device or a similar prototype before upgrading a device which is in production or is hard to reach. And, as always, make a backup of the device configuration before beginning any firmware update. diff --git a/info/xdrv_57_tasmesh.md b/info/xdrv_57_tasmesh.md index 2da2fac191ff..ff7c3ee062cb 100644 --- a/info/xdrv_57_tasmesh.md +++ b/info/xdrv_57_tasmesh.md @@ -8,7 +8,7 @@ Automatic payload encryption is applied using the WiFi-password1 as the key. A m As ACK/NACK messages seem to be not reliable on both ESP-platforms, the method "send-and-pray" is used. -## Working priciple +## Working principle An ESP32 is needed as gateway/broker to connect the nodes (typically an ESP8266) to the WLAN. The ESP32 will receive the MQTT-topic of every node and subscribe to it as a proxy. If a MQTT-message in the form of 'cmnd/node_topic/...' is received, the broker will automatically send this to the referring node via ESP-NOW. diff --git a/pio-tools/espupload.py b/pio-tools/espupload.py index 8b0993a551ca..a25345e65083 100755 --- a/pio-tools/espupload.py +++ b/pio-tools/espupload.py @@ -20,7 +20,7 @@ Provides: Uploads binary file to OTA server. - Usually initated from http-uploader.py + Usually initiated from http-uploader.py Requirements: - Python diff --git a/pio-tools/name-firmware.py b/pio-tools/name-firmware.py index 43e595117a17..6b32b771fb1a 100644 --- a/pio-tools/name-firmware.py +++ b/pio-tools/name-firmware.py @@ -31,7 +31,7 @@ def bin_map_copy(source, target, env): # copy firmware.bin and map to final destination shutil.copy(firsttarget, bin_file) if env["PIOPLATFORM"] == "espressif32": - # the map file is needed later for fimrmware-metrics.py + # the map file is needed later for firmware-metrics.py shutil.copy(tasmotapiolib.get_source_map_path(env), map_file) if("safeboot" not in firmware_name): shutil.copy(factory, one_bin_file) diff --git a/tools/decode-status.py b/tools/decode-status.py index bc03d3604028..980f094678c0 100755 --- a/tools/decode-status.py +++ b/tools/decode-status.py @@ -90,7 +90,7 @@ "(Restart) Number of restarts to start detecting boot loop (default 1)", "(Light) RGB and White channel separation (default 0)", "(IR) Set the smallest sized UNKNOWN message packets we actually care about (default 6, max 255)", - "(CSE7766) Number of invalid power measurements before declaring it invalid allowing low load measurments (default 128)", + "(CSE7766) Number of invalid power measurements before declaring it invalid allowing low load measurements (default 128)", "(Button/Shutter) Ignore button change in seconds (default 0)", "(Wifi) Interval in seconds between gratuitous ARP requests (default 60)", "(Energy) Turn all power off at or above this temperature (default 90C)", From 0130ce972a32b75c4aab161d61c94419afdb6073 Mon Sep 17 00:00:00 2001 From: FransOv <57999223+FransOv@users.noreply.github.com> Date: Fri, 27 Oct 2023 17:34:49 +0200 Subject: [PATCH 2/5] Support of Winsum ZH03B sensor Dust particle sensor in xsns_18_pms5003.ino (#19850) * Update xsns_18_pms5003.ino The Winsum ZH03B sensor is quite similar to the Plantower PMS3003 sensor. The main difference is the response in passive mode. With these changes xsns_18_pms5003.ino can support the ZH03B sensor when PMS_MODEL_ZH03X is defined in the configuration file. * Update xsns_18_pms5003.ino --- .../tasmota_xsns_sensor/xsns_18_pms5003.ino | 103 ++++++++++++++++-- 1 file changed, 92 insertions(+), 11 deletions(-) diff --git a/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino b/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino index 9471d9c18d18..426b6e2861c5 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_18_pms5003.ino @@ -27,6 +27,8 @@ * You can either support PMS3003 or PMS5003-7003 at one time. To enable the PMS3003 support * you must enable the define PMS_MODEL_PMS3003 on your configuration file. * For PMSx003T models that report temperature and humidity define PMS_MODEL_PMS5003T + * This module can also support de Winsen ZH03x series of dust particle sensors, + * To support those sensors, you must define PMS_MODEL_ZH03X in the confuguration file. \*********************************************************************************************/ #define XSNS_18 18 @@ -61,6 +63,15 @@ enum PmsCommands CMD_READ_DATA }; +#ifdef PMS_MODEL_ZH03X +const uint8_t kPmsCommands[][9] PROGMEM = { + // 0 1 2 3 4 5 6 7 8 + {0xFF, 0x01, 0x78, 0x40, 0x00, 0x00, 0x00, 0x00, 0x47}, // pms_set_active_mode + {0xFF, 0x01, 0xA7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x57}, // pms_sleep + {0xFF, 0x01, 0xA7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58}, // pms_wake + {0xFF, 0x01, 0x78, 0x41, 0x00, 0x00, 0x00, 0x00, 0x46}, // pms_set_passive_mode + {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79}}; // pms_passive_mode_read +#else const uint8_t kPmsCommands[][7] PROGMEM = { // 0 1 2 3 4 5 6 {0x42, 0x4D, 0xE1, 0x00, 0x01, 0x01, 0x71}, // pms_set_active_mode @@ -68,12 +79,13 @@ const uint8_t kPmsCommands[][7] PROGMEM = { {0x42, 0x4D, 0xE4, 0x00, 0x01, 0x01, 0x74}, // pms_wake {0x42, 0x4D, 0xE1, 0x00, 0x00, 0x01, 0x70}, // pms_set_passive_mode {0x42, 0x4D, 0xE2, 0x00, 0x00, 0x01, 0x71}}; // pms_passive_mode_read +#endif // PMS_MODEL_ZH03X struct pmsX003data { uint16_t framelen; uint16_t pm10_standard, pm25_standard, pm100_standard; uint16_t pm10_env, pm25_env, pm100_env; -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) uint16_t reserved1, reserved2, reserved3; #else uint16_t particles_03um, particles_05um, particles_10um, particles_25um; @@ -104,7 +116,7 @@ bool PmsReadData(void) while ((PmsSerial->peek() != 0x42) && PmsSerial->available()) { PmsSerial->read(); } -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) if (PmsSerial->available() < 24) { #else if (PmsSerial->available() < 32) { @@ -112,7 +124,7 @@ bool PmsReadData(void) return false; } -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) uint8_t buffer[24]; PmsSerial->readBytes(buffer, 24); #else @@ -122,14 +134,14 @@ bool PmsReadData(void) uint16_t sum = 0; PmsSerial->flush(); // Make room for another burst -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, 24); #else AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, 32); #endif // PMS_MODEL_PMS3003 // get checksum ready -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) for (uint32_t i = 0; i < 22; i++) { #else for (uint32_t i = 0; i < 30; i++) { @@ -137,7 +149,7 @@ bool PmsReadData(void) sum += buffer[i]; } // The data comes in endian'd, this solves it so it works on all platforms -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) uint16_t buffer_u16[12]; for (uint32_t i = 0; i < 12; i++) { #else @@ -147,7 +159,8 @@ bool PmsReadData(void) buffer_u16[i] = buffer[2 + i*2 + 1]; buffer_u16[i] += (buffer[2 + i*2] << 8); } -#ifdef PMS_MODEL_PMS3003 + +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) if (sum != buffer_u16[10]) { #else if (sum != buffer_u16[14]) { @@ -156,7 +169,7 @@ bool PmsReadData(void) return false; } -#ifdef PMS_MODEL_PMS3003 +#if defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X) memcpy((void *)&pms_data, (void *)buffer_u16, 22); #else memcpy((void *)&pms_data, (void *)buffer_u16, 30); @@ -170,6 +183,60 @@ bool PmsReadData(void) return true; } +#ifdef PMS_MODEL_ZH03X +bool ZH03ReadDataPassive() // process the passive mode response of the ZH03x sensor +{ + if (! PmsSerial->available()) { + return false; + } + while ((PmsSerial->peek() != 0xFF) && PmsSerial->available()) { + PmsSerial->read(); + } + if (PmsSerial->available() < 9) { + return false; + } + uint8_t buffer[9]; + PmsSerial->readBytes(buffer, 9); + if (buffer[1] != 0x86) { + return false; + } + PmsSerial->flush(); // Make room for another burst + + AddLogBuffer(LOG_LEVEL_DEBUG_MORE, buffer, 9); + + uint8_t sum = 0; + for (uint32_t i = 1; i < 7; i++) { + sum += buffer[i]; + } + sum=(~sum)+1; + if (sum != buffer[8]) { + AddLog(LOG_LEVEL_DEBUG, PSTR("ZH03x: " D_CHECKSUM_FAILURE)); + return false; + } + + uint16_t buffer_u16[12]; + for (uint32_t i = 1; i < 4; i++) { + buffer_u16[i] = buffer[i*2 + 1]; + buffer_u16[i] += (buffer[i*2] << 8); + buffer_u16[i+3] = buffer[i*2 + 1]; // Direct and Environment values identical + buffer_u16[i+3] += (buffer[i*2] << 8); // Direct and Environment values identical + buffer_u16[0] = 20; // set dummy framelength + buffer_u16[11] = buffer[8]; // copy checksum + } + + memcpy((void *)&pms_data, (void *)buffer_u16, 22); + + Pms.valid = 10; + + if (!Pms.discovery_triggered) { + TasmotaGlobal.discovery_counter = 1; // Force discovery + Pms.discovery_triggered = true; + } + + return true; + +} +#endif // PMS_MODEL_ZH03X /*********************************************************************************************\ * Command Sensor18 @@ -227,7 +294,18 @@ void PmsSecond(void) // Every second } if (Pms.ready) { +#ifdef PMS_MODEL_ZH03X + bool validread; + if (Settings->pms_wake_interval >= MIN_INTERVAL_PERIOD) { + validread = ZH03ReadDataPassive(); // in passive mode, the response is different from the PMS sensors + } + else { + validread = PmsReadData(); // In active mode the rsponse is identical to the PMS sensors + } + if (validread) { +#else if (PmsReadData()) { +#endif // PMS_MODEL_ZH03X Pms.valid = 10; if (Settings->pms_wake_interval >= MIN_INTERVAL_PERIOD) { PmsSendCmd(CMD_SLEEP); @@ -276,7 +354,10 @@ void PmsInit(void) { void PmsShow(bool json) { if (Pms.valid) { char types[10]; -#ifdef PMS_MODEL_PMS3003 + +#ifdef PMS_MODEL_ZH03X + strcpy_P(types, PSTR("ZH03x")); +#elif defined(PMS_MODEL_PMS3003) strcpy_P(types, PSTR("PMS3003")); #elif defined(PMS_MODEL_PMS5003T) strcpy_P(types, PSTR("PMS5003T")); @@ -294,7 +375,7 @@ void PmsShow(bool json) { types, pms_data.pm10_standard, pms_data.pm25_standard, pms_data.pm100_standard, pms_data.pm10_env, pms_data.pm25_env, pms_data.pm100_env); -#ifndef PMS_MODEL_PMS3003 +#if !(defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X)) ResponseAppend_P(PSTR(",\"PB0.3\":%d,\"PB0.5\":%d,\"PB1\":%d,\"PB2.5\":%d,"), pms_data.particles_03um, pms_data.particles_05um, pms_data.particles_10um, pms_data.particles_25um); #ifdef PMS_MODEL_PMS5003T @@ -321,7 +402,7 @@ void PmsShow(bool json) { WSContentSend_PD(HTTP_SNS_ENVIRONMENTAL_CONCENTRATION, types, "1", pms_data.pm10_env); WSContentSend_PD(HTTP_SNS_ENVIRONMENTAL_CONCENTRATION, types, "2.5", pms_data.pm25_env); WSContentSend_PD(HTTP_SNS_ENVIRONMENTAL_CONCENTRATION, types, "10", pms_data.pm100_env); -#ifndef PMS_MODEL_PMS3003 +#if !(defined(PMS_MODEL_PMS3003) || defined(PMS_MODEL_ZH03X)) WSContentSend_PD(HTTP_SNS_PARTICALS_BEYOND, types, "0.3", pms_data.particles_03um); WSContentSend_PD(HTTP_SNS_PARTICALS_BEYOND, types, "0.5", pms_data.particles_05um); WSContentSend_PD(HTTP_SNS_PARTICALS_BEYOND, types, "1", pms_data.particles_10um); From 18c56f92bb819600d311b95e640cfc9a4fb407a2 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Fri, 27 Oct 2023 17:42:38 +0200 Subject: [PATCH 3/5] Update change logs --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c55cc9755db..470fa3bdfdd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - I2C bus2 support to LM75AD temperature sensor - Command ``GpioRead`` to show input state (#19810) - ESP32 core v3 auto TasConsole USB or Serial connection by @staars +- Support for Winsen XH03x dust particle sensors using USE_PMS5003 and PMS_MODEL_ZH03X (#19850) ### Breaking Changed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 37a9e5d40b4a..92d6f5067d57 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -121,6 +121,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - I2C bus2 support to HYTxxx temperature and humidity sensor - I2C bus2 support to SI1145/6/7 Ultra violet index and light sensor - I2C bus2 support to LM75AD temperature sensor +- Support for Winsen XH03x dust particle sensors using USE_PMS5003 and PMS_MODEL_ZH03X [#19850](/~https://github.com/arendst/Tasmota/issues/19850) - Experimental support for ESP32-C2 and ESP32-C6 using Arduino core v3 - ESP32 core v3 auto TasConsole USB or Serial connection by @staars From dfa6f9a7714584289b97acdb5927c383c9c50e40 Mon Sep 17 00:00:00 2001 From: Andreas Ziemer Date: Sat, 28 Oct 2023 11:43:35 +0200 Subject: [PATCH 4/5] Update be_lexer.c (#19856) Added check for unterminated block comments --- lib/libesp32/berry/src/be_lexer.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/libesp32/berry/src/be_lexer.c b/lib/libesp32/berry/src/be_lexer.c index 8a038a507f21..b558a72ff875 100644 --- a/lib/libesp32/berry/src/be_lexer.c +++ b/lib/libesp32/berry/src/be_lexer.c @@ -260,6 +260,7 @@ static void skip_comment(blexer *lexer) { next(lexer); /* skip '#' */ if (lgetc(lexer) == '-') { /* mult-line comment */ + int lno = lexer->linenumber; int mark, c = 'x'; /* skip first '-' (#- ... -#) */ do { mark = c == '-'; @@ -269,6 +270,11 @@ static void skip_comment(blexer *lexer) } c = next(lexer); } while (!(mark && c == '#') && c != EOS); + if (c == EOS) { + char tmp[64]; + sprintf(tmp, "unterminated comment block started in line %d", lno); + be_lexerror(lexer, tmp); + } next(lexer); /* skip '#' */ } else { /* line comment */ while (!is_newline(lgetc(lexer)) && lgetc(lexer)) { From 75ec9da8a297223152f392b796c0f499339bade0 Mon Sep 17 00:00:00 2001 From: Jason2866 <24528715+Jason2866@users.noreply.github.com> Date: Sat, 28 Oct 2023 13:15:31 +0200 Subject: [PATCH 5/5] Refactoring of storing safeboot bin (#19858) * Folder for storing safeboot is now configurable * Platform 2023.10.06 * Platform 2023.10.12 --- .gitignore | 2 ++ boards/esp32-fix.json | 2 +- boards/esp32.json | 2 +- boards/esp32_solo1.json | 2 +- boards/esp32c2.json | 2 +- boards/esp32c2_2M.json | 2 +- boards/esp32c3.json | 2 +- boards/esp32c3cdc.json | 2 +- boards/esp32c6.json | 2 +- boards/esp32c6cdc.json | 2 +- boards/esp32s2.json | 2 +- boards/esp32s2cdc.json | 2 +- boards/esp32s3-qio_opi.json | 2 +- boards/esp32s3-qio_qspi.json | 2 +- boards/esp32s3cdc-qio_opi.json | 2 +- boards/esp32s3cdc-qio_qspi.json | 2 +- pio-tools/post_esp32.py | 30 ++++++++++++++++++++----- platformio.ini | 1 + platformio_tasmota32.ini | 2 +- platformio_tasmota_core3_env_sample.ini | 3 ++- platformio_tasmota_env32.ini | 1 + tasmota/tasmota.ino | 2 +- 22 files changed, 48 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 78c2cfe2f902..dcc81a15dc63 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,8 @@ data unpacked_fs unpacked_boards tasmota/user_config_override.h +variants +variants3 build build_output/* firmware.map diff --git a/boards/esp32-fix.json b/boards/esp32-fix.json index a2a9bed87f68..8287019b8018 100644 --- a/boards/esp32-fix.json +++ b/boards/esp32-fix.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32-safeboot.bin" + "tasmota32-safeboot.bin" ] ] }, diff --git a/boards/esp32.json b/boards/esp32.json index 1e476569c569..4dd2a3602032 100644 --- a/boards/esp32.json +++ b/boards/esp32.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32-safeboot.bin" + "tasmota32-safeboot.bin" ] ] }, diff --git a/boards/esp32_solo1.json b/boards/esp32_solo1.json index 3bb85fe05447..f3d9913b0036 100644 --- a/boards/esp32_solo1.json +++ b/boards/esp32_solo1.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32solo1-safeboot.bin" + "tasmota32solo1-safeboot.bin" ] ] }, diff --git a/boards/esp32c2.json b/boards/esp32c2.json index 563a3357c15f..c61238f2f3a2 100644 --- a/boards/esp32c2.json +++ b/boards/esp32c2.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c2-safeboot.bin" + "tasmota32c2-safeboot.bin" ] ] }, diff --git a/boards/esp32c2_2M.json b/boards/esp32c2_2M.json index 36f16ffe3432..00414399ac83 100644 --- a/boards/esp32c2_2M.json +++ b/boards/esp32c2_2M.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c2-safeboot.bin" + "tasmota32c2-safeboot.bin" ] ] }, diff --git a/boards/esp32c3.json b/boards/esp32c3.json index b7f74c3e5a95..2bb2f7660614 100644 --- a/boards/esp32c3.json +++ b/boards/esp32c3.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c3-safeboot.bin" + "tasmota32c3-safeboot.bin" ] ] }, diff --git a/boards/esp32c3cdc.json b/boards/esp32c3cdc.json index 3d280a73b4a9..711225bf66f6 100644 --- a/boards/esp32c3cdc.json +++ b/boards/esp32c3cdc.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c3cdc-safeboot.bin" + "tasmota32c3cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32c6.json b/boards/esp32c6.json index 57dd9b8f4d91..76e7620dbf92 100644 --- a/boards/esp32c6.json +++ b/boards/esp32c6.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c6-safeboot.bin" + "tasmota32c6-safeboot.bin" ] ] }, diff --git a/boards/esp32c6cdc.json b/boards/esp32c6cdc.json index 17932b7a83bf..62147804ac81 100644 --- a/boards/esp32c6cdc.json +++ b/boards/esp32c6cdc.json @@ -29,7 +29,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32c6cdc-safeboot.bin" + "tasmota32c6cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32s2.json b/boards/esp32s2.json index d13f2a855197..aa9efca8b31b 100644 --- a/boards/esp32s2.json +++ b/boards/esp32s2.json @@ -28,7 +28,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s2-safeboot.bin" + "tasmota32s2-safeboot.bin" ] ] }, diff --git a/boards/esp32s2cdc.json b/boards/esp32s2cdc.json index bdd230d5cde6..fe5662174321 100644 --- a/boards/esp32s2cdc.json +++ b/boards/esp32s2cdc.json @@ -28,7 +28,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s2cdc-safeboot.bin" + "tasmota32s2cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32s3-qio_opi.json b/boards/esp32s3-qio_opi.json index 498534e610a4..4f2a06c4757d 100644 --- a/boards/esp32s3-qio_opi.json +++ b/boards/esp32s3-qio_opi.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3-safeboot.bin" + "tasmota32s3-safeboot.bin" ] ] }, diff --git a/boards/esp32s3-qio_qspi.json b/boards/esp32s3-qio_qspi.json index cdc6d70cac78..42b20a4bc9a7 100644 --- a/boards/esp32s3-qio_qspi.json +++ b/boards/esp32s3-qio_qspi.json @@ -31,7 +31,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3-safeboot.bin" + "tasmota32s3-safeboot.bin" ] ] }, diff --git a/boards/esp32s3cdc-qio_opi.json b/boards/esp32s3cdc-qio_opi.json index 67dae1a6e2fd..d7650b42f82c 100644 --- a/boards/esp32s3cdc-qio_opi.json +++ b/boards/esp32s3cdc-qio_opi.json @@ -41,7 +41,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3cdc-safeboot.bin" + "tasmota32s3cdc-safeboot.bin" ] ] }, diff --git a/boards/esp32s3cdc-qio_qspi.json b/boards/esp32s3cdc-qio_qspi.json index f37a47bb5b55..77c89f9aa7df 100644 --- a/boards/esp32s3cdc-qio_qspi.json +++ b/boards/esp32s3cdc-qio_qspi.json @@ -41,7 +41,7 @@ "flash_extra_images": [ [ "0x10000", - "variants/tasmota/tasmota32s3cdc-safeboot.bin" + "tasmota32s3cdc-safeboot.bin" ] ] }, diff --git a/pio-tools/post_esp32.py b/pio-tools/post_esp32.py index 0d1dff34efd0..8cbc2809ff2f 100644 --- a/pio-tools/post_esp32.py +++ b/pio-tools/post_esp32.py @@ -16,7 +16,7 @@ # - 0x1000 | ~\.platformio\packages\framework-arduinoespressif32\tools\sdk\esp32\bin\bootloader_dout_40m.bin # - 0x8000 | ~\Tasmota\.pio\build\\partitions.bin # - 0xe000 | ~\.platformio\packages\framework-arduinoespressif32\tools\partitions\boot_app0.bin -# - 0x10000 | ~\.platformio/packages/framework-arduinoespressif32/variants/tasmota/\-safeboot.bin +# - 0x10000 | ~\Tasmota\/-safeboot.bin # - 0xe0000 | ~\Tasmota\.pio\build\/firmware.bin # - 0x3b0000| ~\Tasmota\.pio\build\/littlefs.bin @@ -37,6 +37,13 @@ sys.path.append(join(platform.get_package_dir("tool-esptoolpy"))) import esptool +variants_dir = env.BoardConfig().get("build.variants_dir", "") +variant = env.BoardConfig().get("build.variant", "") +sections = env.subst(env.get("FLASH_EXTRA_IMAGES")) +chip = env.get("BOARD_MCU") +mcu_build_variant = env.BoardConfig().get("build.variant", "").lower() + +# Copy safeboots firmwares in place when running in Github github_actions = os.getenv('GITHUB_ACTIONS') extra_flags = ''.join([element.replace("-D", " ") for element in env.BoardConfig().get("build.extra_flags", "")]) build_flags = ''.join([element.replace("-D", " ") for element in env.GetProjectOption("build_flags")]) @@ -45,16 +52,31 @@ FRAMEWORK_DIR = platform.get_package_dir("framework-arduino-solo1") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduino-solo1/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) elif "CORE32ITEAD" in extra_flags or "FRAMEWORK_ARDUINO_ITEAD" in build_flags: FRAMEWORK_DIR = platform.get_package_dir("framework-arduino-ITEAD") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduino-ITEAD/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) else: FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoespressif32") if github_actions and os.path.exists("./firmware/firmware"): shutil.copytree("./firmware/firmware", "/home/runner/.platformio/packages/framework-arduinoespressif32/variants/tasmota") + if variants_dir: + shutil.copytree("./firmware/firmware", variants_dir, dirs_exist_ok=True) + +# Copy pins_arduino.h to variants folder +if variants_dir: + mcu_build_variant_path = join(FRAMEWORK_DIR, "variants", mcu_build_variant, "pins_arduino.h") + custom_variant_build = join(env.subst("$PROJECT_DIR"), variants_dir , mcu_build_variant, "pins_arduino.h") + os.makedirs(join(env.subst("$PROJECT_DIR"), variants_dir , mcu_build_variant), exist_ok=True) + shutil.copy(mcu_build_variant_path, custom_variant_build) -variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota") +if not variants_dir: + variants_dir = join(FRAMEWORK_DIR, "variants", "tasmota") + env.BoardConfig().update("build.variants_dir", variants_dir) def esp32_detect_flashsize(): uploader = env.subst("$UPLOADER") @@ -195,9 +217,7 @@ def esp32_create_combined_bin(source, target, env): new_file_name = env.subst("$BUILD_DIR/${PROGNAME}.factory.bin") - sections = env.subst(env.get("FLASH_EXTRA_IMAGES")) firmware_name = env.subst("$BUILD_DIR/${PROGNAME}.bin") - chip = env.get("BOARD_MCU") tasmota_platform = esp32_create_chip_string(chip) if "-DUSE_USB_CDC_CONSOLE" in env.BoardConfig().get("build.extra_flags") and "cdc" not in tasmota_platform: @@ -274,8 +294,8 @@ def esp32_create_combined_bin(source, target, env): ) print("Will use custom upload command for flashing operation to add file system defined for this build target.") - #print('Using esptool.py arguments: %s' % ' '.join(cmd)) if("safeboot" not in firmware_name): + #print('Using esptool.py arguments: %s' % ' '.join(cmd)) esptool.main(cmd) diff --git a/platformio.ini b/platformio.ini index 5f55fe7f28ac..f45cd00f5d6c 100644 --- a/platformio.ini +++ b/platformio.ini @@ -32,6 +32,7 @@ platform_packages = ${core.platform_packages} framework = arduino board = esp8266_1M board_build.filesystem = littlefs +board_build.variants_dir = variants/tasmota custom_unpack_dir = unpacked_littlefs build_unflags = ${core.build_unflags} build_flags = ${core.build_flags} diff --git a/platformio_tasmota32.ini b/platformio_tasmota32.ini index c49c5e9a7ff4..d1ee861fa18d 100644 --- a/platformio_tasmota32.ini +++ b/platformio_tasmota32.ini @@ -78,7 +78,7 @@ lib_ignore = ${esp32_defaults.lib_ignore} ccronexpr [core32] -platform = /~https://github.com/tasmota/platform-espressif32/releases/download/2023.10.05/platform-espressif32.zip +platform = /~https://github.com/tasmota/platform-espressif32/releases/download/2023.10.06/platform-espressif32.zip platform_packages = build_unflags = ${esp32_defaults.build_unflags} build_flags = ${esp32_defaults.build_flags} diff --git a/platformio_tasmota_core3_env_sample.ini b/platformio_tasmota_core3_env_sample.ini index 8c3bf2c96ed2..7c8a055e82b7 100644 --- a/platformio_tasmota_core3_env_sample.ini +++ b/platformio_tasmota_core3_env_sample.ini @@ -22,7 +22,7 @@ ; tasmota32c6cdc-safeboot [core32_30] -platform = /~https://github.com/tasmota/platform-espressif32/releases/download/2023.10.11/platform-espressif32.zip +platform = /~https://github.com/tasmota/platform-espressif32/releases/download/2023.10.12/platform-espressif32.zip platform_packages = build_unflags = ${core32.build_unflags} @@ -50,6 +50,7 @@ framework = ${common.framework} platform = ${core32_30.platform} platform_packages = ${core32_30.platform_packages} board_build.filesystem = ${common.board_build.filesystem} +board_build.variants_dir = variants/tasmota_ard3 custom_unpack_dir = ${common.custom_unpack_dir} board = esp32 monitor_speed = 115200 diff --git a/platformio_tasmota_env32.ini b/platformio_tasmota_env32.ini index bea48c5a6482..5b62e0bc6886 100644 --- a/platformio_tasmota_env32.ini +++ b/platformio_tasmota_env32.ini @@ -4,6 +4,7 @@ platform = ${core32.platform} platform_packages = ${core32.platform_packages} board_build.filesystem = ${common.board_build.filesystem} custom_unpack_dir = ${common.custom_unpack_dir} +board_build.variants_dir = ${common.board_build.variants_dir} board = esp32 monitor_speed = ${common.monitor_speed} monitor_echo = ${common.monitor_echo} diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index bfd026f78099..fd980bef8ae2 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -223,7 +223,7 @@ bool tasconsole_serial = false; #if ARDUINO_USB_MODE //#warning **** TasConsole ARDUINO_USB_MODE **** -TASCONSOLE TasConsole{USBSerial}; // ESP32C3/C6/S3 embedded USB using JTAG interface +TASCONSOLE TasConsole{HWCDCSerial}; // ESP32C3/C6/S3 embedded USB using JTAG interface //#warning **** TasConsole uses HWCDC **** #else // No ARDUINO_USB_MODE #include "USB.h"