Skip to content

Commit aafe528

Browse files
committed
Enable ESP32 TWAI in default binary
1 parent d5d757f commit aafe528

File tree

5 files changed

+16
-7
lines changed

5 files changed

+16
-7
lines changed

BUILDS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,9 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the
105105
| **Feature or Sensor** | **l** | **t** | **k** | **s** | **i** | **d** | **Remarks** |
106106
| USE_I2C | - | x / x | x | x | - | x |
107107
| USE_RTC_CHIPS | - | - / x | - | - | - | - |
108-
| -USE_DS3231 | - | - / - | - | - | - | - |
109108
| -USE_BM8563 | - | - / x | - | - | - | - |
109+
| -USE_DS3231 | - | - / - | - | - | - | - |
110+
| -USE_PCF85063 | - | - / - | - | - | - | - |
110111
| -USE_PCF85363 | - | - / - | - | - | - | - |
111112
| -USE_RX8010 | - | - / - | - | - | - | - |
112113
| USE_SHT | - | - / x | - | x | - | - |
@@ -249,6 +250,7 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the
249250
| USE_DYP | - | - / - | - | - | - | - |
250251
| USE_TM1638 | - | - / x | - | x | - | - |
251252
| USE_HX711 | - | - / x | - | x | - | - |
253+
| -USE_HX711_M5SCALES | - | - / - | - | - | - | - |
252254
| USE_TX2x_WIND_SENSOR | - | - / - | - | - | - | - |
253255
| USE_WINDMETER | - | - / - | - | - | - | - |
254256
| USE_RC_SWITCH | - | - / x | - | x | - | - |
@@ -283,6 +285,7 @@ Note: the `minimal` variant is not listed as it shouldn't be used outside of the
283285
| USE_SONOFF_SPM | | / x | | | | |
284286
| USE_DISPLAY_TM1621_SONOFF | | / x | | | | |
285287
| USE_SHELLY_PRO | | / x | | | | |
288+
| USE_ESP32_TWAI | | / x | | | | |
286289
| USE_DALI | | / x | | | | |
287290
| USE_DINGTIAN_RELAY | | / - | | | | |
288291
| USE_MATTER_DEVICE | | / x | | | | | See SetOption151 |

tasmota/include/tasmota_configurations_ESP32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,7 @@
802802
#define USE_KNX // Enable KNX IP Protocol Support (+23k code, +3k3 mem)
803803
#endif
804804
#define USE_DALI // Add support for DALI gateway (+5k code)
805+
#define USE_ESP32_TWAI // Add support for TWAI/CAN interface (+7k code)
805806

806807
#endif // FIRMWARE_TASMOTA32
807808

tasmota/tasmota_support/support_features.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,12 @@ constexpr uint32_t feature[] = {
931931
#if defined(USE_I2C) && defined(USE_RTC_CHIPS) && defined(USE_RX8010)
932932
0x00000200 | // xdrv_56_rtc_chips.ino
933933
#endif
934-
// 0x00000400 | //
935-
// 0x00000800 | //
934+
#if defined(USE_I2C) && defined(USE_RTC_CHIPS) && defined(USE_PCF85063)
935+
0x00000400 | // xdrv_56_rtc_chips.ino
936+
#endif
937+
#ifdef USE_ESP32_TWAI
938+
0x00000800 | // xdrv_91_esp32_twai.ino
939+
#endif
936940
// 0x00001000 | //
937941
// 0x00002000 | //
938942
// 0x00004000 | //

tasmota/tasmota_xdrv_driver/xdrv_91_esp32_twai.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ class twai_cls
114114
var id = ident & 0x1fffffff
115115
if id == 0x076 # Incremental counter from 0 to 255
116116
# tasmota.log(f"RMH: 0x{id:03x} Count {data1}", 3)
117+
# elif id == 0x080 # Heartbeat every second
117118
elif id == 0x100 # Date and Time
118119
var epoch = 441763200 + (data2 * 24 * 60 * 60) + (data1 / 1000)
119120
# tasmota.log(f"RMH: 0x{id:03x} Time {tasmota.time_str(epoch)}", 3)
@@ -411,8 +412,8 @@ void TWAIInit(void) {
411412
Twai.supported = false;
412413
for (uint32_t bus = 0; bus < MAX_TWAI; bus++) {
413414
if (PinUsed(GPIO_TWAI_TX, bus) && PinUsed(GPIO_TWAI_RX, bus)) {
414-
Twai.speed[bus] = TWAI_SPEED_1MBITS;
415-
Twai.mode[bus] = TWAI_MODE_LISTEN_ONLY; // 0 = TWAI_MODE_NORMAL, 1 = TWAI_MODE_NO_ACK, 2 = TWAI_MODE_LISTEN_ONLY
415+
Twai.speed[bus] = TWAI_SPEED_100KBITS;
416+
Twai.mode[bus] = TWAI_MODE_NORMAL; // 0 = TWAI_MODE_NORMAL, 1 = TWAI_MODE_NO_ACK, 2 = TWAI_MODE_LISTEN_ONLY
416417
#ifdef USE_BERRY
417418
TWAIBerryConfig(bus);
418419
#endif // USE_BERRY

tools/decode-status.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@
309309
],[
310310
"USE_MAGIC_SWITCH","USE_PIPSOLAR","USE_GPIO_VIEWER","USE_AMSX915",
311311
"USE_SPI_LORA","USE_SPL06_007","USE_QMP6988","USE_WOOLIIS",
312-
"USE_HX711_M5SCALES","USE_RX8010","","",
312+
"USE_HX711_M5SCALES","USE_RX8010","USE_PCF85063","USE_ESP32_TWAI",
313313
"","","","",
314314
"","","","",
315315
"","","","",
@@ -342,7 +342,7 @@
342342
obj = json.load(fp)
343343

344344
def StartDecode():
345-
print ("\n*** decode-status.py v14.4.1.1 by Theo Arends and Jacek Ziolkowski ***")
345+
print ("\n*** decode-status.py v14.4.1.2 by Theo Arends and Jacek Ziolkowski ***")
346346

347347
# print("Decoding\n{}".format(obj))
348348

0 commit comments

Comments
 (0)