Add support for CAN bus and Freedom Won Battery Management System by Marius Bezuidenhout (#12651)

This commit is contained in:
Theo Arends 2021-07-17 15:16:48 +02:00
parent de2e86f022
commit 4173340c6a
5 changed files with 20 additions and 16 deletions

View File

@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
## [9.5.0.3]
### Added
- Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver
- Support for CAN bus and Freedom Won Battery Management System by Marius Bezuidenhout (#12651)
## [9.5.0.2] 20210714
### Added

View File

@ -110,6 +110,7 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- MQTT minimum password length restriction in GUI [#12553](https://github.com/arendst/Tasmota/issues/12553)
- Support for Technoline WS2300-15 Anemometer [#12573](https://github.com/arendst/Tasmota/issues/12573)
- Support for Telaire T6700 Series CO2 sensor by Alexander Savchenko [#12618](https://github.com/arendst/Tasmota/issues/12618)
- Support for CAN bus and Freedom Won Battery Management System by Marius Bezuidenhout [#12651](https://github.com/arendst/Tasmota/issues/12651)
### Changed
- ESP32 core library from v1.0.6 to v1.0.7.1

View File

@ -738,19 +738,21 @@ void ResponseAppendFeatures(void)
feature8 |= 0x00000008; // xdrv_52_9_berry.ino
#endif
#if defined(USE_I2C) && defined(USE_BM8563)
feature8 |= 0x00000010;
feature8 |= 0x00000010; // xdrv_56_BM8563_RTC.ino
#endif
#if defined(USE_ENERGY_SENSOR) && defined(USE_ENERGY_DUMMY)
feature8 |= 0x00000020;
feature8 |= 0x00000020; // xnrg_20_dummy.ino
#endif
#if defined(USE_I2C) && defined(USE_AM2320)
feature8 |= 0x00000040;
feature8 |= 0x00000040; // xsns_88_am2320.ino
#endif
#if defined(USE_I2C) && defined(USE_T67XX)
feature8 |= 0x00000080;
feature8 |= 0x00000080; // xsns_89_t67xx.ino
#endif
// feature8 |= 0x00000100;
#if defined(USE_SPI) && defined(USE_MCP2515)
feature8 |= 0x00000100; // xsns_87_mcp2515.ino
#endif
// feature8 |= 0x00000200;
// feature8 |= 0x00000400;
// feature8 |= 0x00000800;

View File

@ -1,7 +1,7 @@
/*
xsns_89_mcp2515.ino - MCP2515 CAN bus support for Tasmota
xsns_87_mcp2515.ino - MCP2515 CAN bus support for Tasmota
Copyright (C) 2021 Marius Bezuidenhout
Copyright (C) 2021 Marius Bezuidenhout
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -34,9 +34,7 @@
* VCC Vin/5V
\*********************************************************************************************/
#define XSNS_90 90
#include "mcp2515.h"
#define XSNS_87 87
// set defaults if not defined
#ifndef MCP2515_BITRATE
@ -67,6 +65,8 @@
#endif // MCP2515_BMS_FREEDWON
#endif // MCP2515_BMS_CLIENT
#include "mcp2515.h"
#ifdef MCP2515_BMS_CLIENT
struct BMS_Struct {
uint16_t stateOfCharge;
@ -100,7 +100,7 @@ void MCP2515_Init(void) {
AddLog(LOG_LEVEL_ERROR, PSTR("MCP2515: Failed to set module bitrate"));
mcp2515_init_status = 0;
}
if (mcp2515_init_status && MCP2515::ERROR_OK != mcp2515->setNormalMode()) {
AddLog(LOG_LEVEL_ERROR, PSTR("MCP2515: Failed to set normal mode"));
mcp2515_init_status = 0;
@ -221,8 +221,8 @@ void MCP2515_Show(bool Json) {
if (lastFrameRecv > 0 && TasmotaGlobal.uptime - lastFrameRecv <= MCP2515_TIMEOUT ) {
#ifdef MCP2515_BMS_CLIENT
ResponseAppend_P(PSTR(",\"MCP2515\":{\"SOC\":%d,\"SOH\":%d}"), \
bms.stateOfCharge,
bms.stateOfHealth
bms.stateOfCharge,
bms.stateOfHealth
);
#endif // MCP2515_BMS_CLIENT
}
@ -245,7 +245,7 @@ void MCP2515_Show(bool Json) {
* Interface
\*********************************************************************************************/
bool Xsns90(uint8_t function)
bool Xsns87(uint8_t function)
{
bool result = false;

View File

@ -255,7 +255,7 @@ a_features = [[
],[
"USE_MPU_ACCEL","USE_TFMINIPLUS","USE_CSE7761","USE_BERRY",
"USE_BM8563","USE_ENERGY_DUMMY","USE_AM2320","USE_T67XX",
"","","","",
"USE_MCP2515","","","",
"","","","",
"","","","",
"","","","",
@ -288,7 +288,7 @@ else:
obj = json.load(fp)
def StartDecode():
print ("\n*** decode-status.py v20210713 by Theo Arends and Jacek Ziolkowski ***")
print ("\n*** decode-status.py v20210717 by Theo Arends and Jacek Ziolkowski ***")
# print("Decoding\n{}".format(obj))