From e8ca96008fc8512183725b49e037c2b44ab8fe4b Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sun, 2 Feb 2025 16:08:50 +0100 Subject: [PATCH] Add `#define FIX_JSON_HEXADECIMAL` to change JSON hexadecimal value "FF5F78" into "0xFF5F78" (#22919) --- CHANGELOG.md | 1 + RELEASENOTES.md | 1 + tasmota/my_user_config.h | 2 +- tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino | 4 ++++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8cfd9257..426e323e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ All notable changes to this project will be documented in this file. - LVGL `lv.set_paint_cb()` to register a callback when screen is refreshed (#22909) - Berry `tasmota.settings` entries for PixelType (#22912) - Support for C8-CO2-5K CO2 sensor (#22905) +- `#define FIX_JSON_HEXADECIMAL` to change JSON hexadecimal value "FF5F78" into "0xFF5F78" (#22919) ### Breaking Changed diff --git a/RELEASENOTES.md b/RELEASENOTES.md index e4fe27c8a..277f86903 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -124,6 +124,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm - Support for Senseair S88 CO2 sensor [#22733](https://github.com/arendst/Tasmota/issues/22733) - 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) - 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) diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 6af3146ac..bab69c63f 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -533,6 +533,7 @@ #define ROTARY_V1 // Add support for Rotary Encoder as used in MI Desk Lamp (+0k8 code) #define ROTARY_MAX_STEPS 10 // Rotary step boundary #define USE_SONOFF_RF // Add support for Sonoff Rf Bridge (+3k2 code) +// #define FIX_JSON_HEXADECIMAL // Add "0x" as prefix to hexadecimal value (disabled for legacy) #define USE_RF_FLASH // Add support for flashing the EFM8BB1 chip on the Sonoff RF Bridge. C2CK must be connected to GPIO4, C2D to GPIO5 on the PCB (+2k7 code) #define USE_SONOFF_SC // Add support for Sonoff Sc (+1k1 code) #define USE_TUYA_MCU // Add support for Tuya Serial MCU @@ -902,7 +903,6 @@ // #define GM861_DECODE_AIM // Decode AIM-id (+0k3 code) // #define GM861_HEARTBEAT // Enable heartbeat (+0k2 code) //#define USE_WOOLIIS // Add support for Wooliis Hall Effect Coulometer or Battery capacity monitor (+1k6 code) -//#define USE_C8_CO2_5K // Add support for C8-CO2-5K CO2 Sensor (+4k3 code) //#define USE_DALI // Add support for DALI gateway (+5k code) // -- Power monitoring sensors -------------------- diff --git a/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino b/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino index 8bbaeef56..48ed367e9 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_06_snfbridge.ino @@ -242,7 +242,11 @@ void SonoffBridgeReceived(void) if (Settings->flag.rf_receive_decimal) { // SetOption28 - RF receive data format snprintf_P(stemp, sizeof(stemp), PSTR("%u"), received_id); } else { +#ifdef FIX_JSON_HEXADECIMAL + snprintf_P(stemp, sizeof(stemp), PSTR("\"0x%06X\""), received_id); +#else snprintf_P(stemp, sizeof(stemp), PSTR("\"%06X\""), received_id); +#endif // FIX_JSON_HEXADECIMAL } ResponseTime_P(PSTR(",\"" D_JSON_RFRECEIVED "\":{\"" D_JSON_SYNC "\":%d,\"" D_JSON_LOW "\":%d,\"" D_JSON_HIGH "\":%d,\"" D_JSON_DATA "\":%s,\"" D_CMND_PREFIX_RF D_CMND_RFKEY "\":%s}}"), sync_time, low_time, high_time, stemp, rfkey);