diff --git a/CHANGELOG.md b/CHANGELOG.md index 426e323e3..c01c05e82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,21 @@ All notable changes to this project will be documented in this file. ## [Unreleased] - Development -## [14.4.1.3] +## [14.4.1.4] +### Added +- Formatter `%_U` for `ext_snprintf_P()` to print uint64_t variable as decimal equivalent to `%llu` +- Support for RC-switch decoding of 64-bit received data + +### Breaking Changed + +### Changed +- ESP32 Platform from 2025.01.31 to 2025.02.30, Framework (Arduino Core) from v3.1.1.250109 to v3.1.1.250203 and IDF to 5.3.2 (#22943) + +### Fixed + +### Removed + +## [14.4.1.3] 20250204 ### Added - Command `FileLog 0..4` to enable logging to filesystem using up to 16 rotating log files of 100kB (`#define FILE_LOG_SIZE 100`) - Command `FileLog 10..14` to enable logging to filesystem using up to 16 log files of 100kB (`#define FILE_LOG_SIZE 100`) @@ -25,8 +39,6 @@ All notable changes to this project will be documented in this file. - Support for C8-CO2-5K CO2 sensor (#22905) - `#define FIX_JSON_HEXADECIMAL` to change JSON hexadecimal value "FF5F78" into "0xFF5F78" (#22919) -### Breaking Changed - ### Changed - ESP32 Platform from 2024.12.30 to 2025.01.30, Framework (Arduino Core) from v3.1.0.241206 to v3.1.1.250109 and IDF to 5.3.2 (#22792) - Allow negative values for AdcParam/AdcGpio INPUT, TEMP and RANGE parameters (#22809) @@ -41,9 +53,6 @@ All notable changes to this project will be documented in this file. - ESP32-Cx compilation fails on Windows (#22832) - LoraWan decoding of Dragino LDS02 and MerryIoT DW10 (#22880) -### Removed - - ## [14.4.1.2] 20250110 ### Added - Support for ESP32 Two-Wire Automotive Interface (TWAI) or Controller Area Network (CAN) busses diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 277f86903..0d3ace4ae 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -114,7 +114,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm [Complete list](BUILDS.md) of available feature and sensors. -## Changelog v14.4.1.3 +## Changelog v14.4.1.4 ### Added - Command `SetOption163 1` to disable display of Device name in GUI header - Command `FileLog 0..4` to enable logging to filesystem using up to 16 rotating log files of 100kB (`#define FILE_LOG_SIZE 100`) @@ -125,6 +125,8 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Support for C8-CO2-5K CO2 sensor [#22905](https://github.com/arendst/Tasmota/issues/22905) - Support for ESP32 Two-Wire Automotive Interface (TWAI) or Controller Area Network (CAN) busses - `#define FIX_JSON_HEXADECIMAL` to change JSON hexadecimal value "FF5F78" into "0xFF5F78" [#22919](https://github.com/arendst/Tasmota/issues/22919) +- Support for RC-switch decoding of 64-bit received data +- Formatter `%_U` for `ext_snprintf_P()` to print uint64_t variable as decimal equivalent to `%llu` - GPS driver select baudrate using GPIO GPS_RX1 (9600bps), GPS_RX2 (19200bps) or GPS_RX3 (38400bps) [#22869](https://github.com/arendst/Tasmota/issues/22869) - I2S AAC support for web radio [#22787](https://github.com/arendst/Tasmota/issues/22787) - I2S Opus stream and file support for opus/aac [#22795](https://github.com/arendst/Tasmota/issues/22795) @@ -154,7 +156,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm ### Breaking Changed ### Changed -- ESP32 Platform from 2024.12.30 to 2025.01.31, Framework (Arduino Core) from v3.1.0.241206 to v3.1.1.250109 and IDF to 5.3.2 [#22832](https://github.com/arendst/Tasmota/issues/22832) +- ESP32 Platform from 2024.12.30 to 2025.02.30, Framework (Arduino Core) from v3.1.0.241206 to v3.1.1.250203 and IDF to 5.3.2 [#22943](https://github.com/arendst/Tasmota/issues/22943) - GPIOViewer from v1.5.6 to v1.6.1 (No functional change) - Postpone save_data during light animation when fade is Off - Allow negative values for AdcParam/AdcGpio INPUT, TEMP and RANGE parameters [#22809](https://github.com/arendst/Tasmota/issues/22809) diff --git a/lib/default/Ext-printf/src/ext_printf.cpp b/lib/default/Ext-printf/src/ext_printf.cpp index 48499685c..65ff73212 100644 --- a/lib/default/Ext-printf/src/ext_printf.cpp +++ b/lib/default/Ext-printf/src/ext_printf.cpp @@ -177,6 +177,22 @@ char * ToBinary(uint32_t value, char *str, int32_t digits) { return str; } +char * U64toStr(uint64_t value, char *str) { + // str must be at least 24 bytes long + uint32_t i = 23; + str[--i] = 0; // end of string + do { + uint64_t m = value; + value /= 10; + char c = m - 10 * value; + str[--i] = c < 10 ? c + '0' : c + 'A' - 10; + } while (value); + if (i) { + memmove(str, str +i, 23 -i); + } + return str; +} + char * U64toHex(uint64_t value, char *str, uint32_t zeroleads) { // str must be at least 17 bytes long str[16] = 0; // end of string @@ -310,6 +326,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l } } break; + case 'B': // Pointer to SBuffer { if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } @@ -326,6 +343,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l } } break; + // '%_b' outputs a uint32_t to binary // '%8_b' outputs a uint8_t to binary case 'b': // Binary, decimals indicates the zero prefill @@ -416,6 +434,7 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l } } break; + // '%_X' outputs a 64 bits unsigned int to uppercase HEX with 16 digits case 'X': // input is `uint64_t*`, printed as 16 hex digits (no prefix 0x) { @@ -429,6 +448,20 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l } } break; + + // '%_U' outputs a 64 bits unsigned int to decimal + case 'U': // input is `uint64_t*`, printed as decimal + { + if (cur_val < min_valid_ptr) { new_val_str = ext_invalid_mem; } + else { + U64toStr(*(uint64_t*)cur_val, hex); + new_val_str = copyStr(hex); + if (new_val_str == nullptr) { goto free_allocs; } + allocs[alloc_idx++] = new_val_str; + } + } + break; + } *cur_val_ptr = new_val_str; *fmt = 's'; // replace `%_X` with `%0s` to display a string instead diff --git a/lib/default/Ext-printf/test/test_ext_printf.cpp b/lib/default/Ext-printf/test/test_ext_printf.cpp index f8b7b2ff9..b58203076 100644 --- a/lib/default/Ext-printf/test/test_ext_printf.cpp +++ b/lib/default/Ext-printf/test/test_ext_printf.cpp @@ -66,11 +66,14 @@ void test_ext_snprintf_P(void) { Serial.printf("--> out=%s\n", c); ext_snprintf_P(c, sizeof(c), "Float default=%*_f, int(3)=%*_f, int(3)=%*_f, int(3)=%*_f, 6dec=%*_f", 1, &fpi, 4, &f3, -4, &f3, -4, &f31, -8, &fpi); Serial.printf("--> out=%s\n", c); - uint64_t u641 = 0x1122334455667788LL; - uint64_t u642 = 0x0123456789ABCDEFLL; - uint64_t u643 = 0xFEDCBA9876543210LL; + + uint64_t u641 = 0x1122334455667788LL; // 1234605616436508552 + uint64_t u642 = 0x0123456789ABCDEFLL; // 81985529216486895 + uint64_t u643 = 0xFEDCBA9876543210LL; // 18364758544493064720 ext_snprintf_P(c, sizeof(c), "Int64 0x%_X 0x%_X 0x%_X", &u641, &u642, &u643); Serial.printf("--> out=%s\n", c); + ext_snprintf_P(c, sizeof(c), "Int64 decimal %_U %_U %_U", &u641, &u642, &u643); + Serial.printf("--> out=%s\n", c); // ext_snprintf_P(c, sizeof(c), "Float default=%*_f, int(3)=%*_f, int(3)=%*_f, int(3)=%*_f, 6dec=%*_f", &fpi, &f3, &f3, &f31, &fpi); diff --git a/tasmota/include/tasmota_version.h b/tasmota/include/tasmota_version.h index d1bc5dfed..e19048afa 100644 --- a/tasmota/include/tasmota_version.h +++ b/tasmota/include/tasmota_version.h @@ -22,6 +22,6 @@ #define TASMOTA_SHA_SHORT // Filled by Github sed -const uint32_t TASMOTA_VERSION = 0x0E040103; // 14.4.1.3 +const uint32_t TASMOTA_VERSION = 0x0E040104; // 14.4.1.4 #endif // _TASMOTA_VERSION_H_ diff --git a/tasmota/tasmota_xdrv_driver/xdrv_17_rcswitch.ino b/tasmota/tasmota_xdrv_driver/xdrv_17_rcswitch.ino index 65e30acae..008bfb5b1 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_17_rcswitch.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_17_rcswitch.ino @@ -51,22 +51,22 @@ uint32_t rf_lasttime = 0; void RfReceiveCheck(void) { if (mySwitch.available()) { - unsigned long data = mySwitch.getReceivedValue(); + uint64_t data = mySwitch.getReceivedValue(); unsigned int bits = mySwitch.getReceivedBitlength(); int protocol = mySwitch.getReceivedProtocol(); int delay = mySwitch.getReceivedDelay(); - AddLog(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%lX (%u), Bits %d, Protocol %d, Delay %d"), data, data, bits, protocol, delay); + AddLog(LOG_LEVEL_DEBUG, PSTR("RFR: Data 0x%_X (%_U), Bits %d, Protocol %d, Delay %d"), &data, &data, bits, protocol, delay); uint32_t now = millis(); if ((now - rf_lasttime > Settings->rf_duplicate_time) && (data > 0)) { rf_lasttime = now; - char stemp[16]; + char stemp[24]; if (Settings->flag.rf_receive_decimal) { // SetOption28 - RF receive data format (0 = hexadecimal, 1 = decimal) - snprintf_P(stemp, sizeof(stemp), PSTR("%u"), (uint32_t)data); + ext_snprintf_P(stemp, sizeof(stemp), PSTR("%_U"), &data); } else { - snprintf_P(stemp, sizeof(stemp), PSTR("\"0x%lX\""), (uint32_t)data); + ext_snprintf_P(stemp, sizeof(stemp), PSTR("\"0x%_X\""), &data); } ResponseTime_P(PSTR(",\"" D_JSON_RFRECEIVED "\":{\"" D_JSON_RF_DATA "\":%s,\"" D_JSON_RF_BITS "\":%d,\"" D_JSON_RF_PROTOCOL "\":%d,\"" D_JSON_RF_PULSE "\":%d}}"), stemp, bits, protocol, delay);