mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
🐛 fix compilation bugs with daly bms
This commit is contained in:
parent
5de2af3bdf
commit
1f5bcde8aa
3 changed files with 7 additions and 11 deletions
|
@ -69,8 +69,8 @@ uint32_t decode_uint32be(uint8_t data[8], uint8_t offset) {
|
|||
((uint32_t)data[offset + 3]);
|
||||
}
|
||||
|
||||
void decode_packet(uint8_t data[8]) {
|
||||
switch (buff[2]) {
|
||||
void decode_packet(uint8_t command, uint8_t data[8]) {
|
||||
switch (command) {
|
||||
case 0x90:
|
||||
voltage_dV = decode_uint16be(data, 0);
|
||||
current_dA = decode_int16be(data, 4) - 30000;
|
||||
|
@ -139,7 +139,7 @@ void receive_RS485() {
|
|||
}
|
||||
|
||||
if (recv_len > 12) {
|
||||
decode_packet(&recv_buff[4]);
|
||||
decode_packet(recv_buff[2], &recv_buff[4]);
|
||||
recv_len = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#ifndef DALY_BMS_H
|
||||
#define DALY_BMS_H
|
||||
#include <Arduino.h>
|
||||
#include "../include.h"
|
||||
|
||||
/* Tweak these according to your battery build */
|
||||
#define CELL_COUNT 14
|
||||
|
@ -10,17 +8,11 @@
|
|||
#define MIN_PACK_VOLTAGE_DV 518 //518 = 51.8V
|
||||
#define MAX_CELL_VOLTAGE_MV 4250 //Battery is put into emergency stop if one cell goes over this value
|
||||
#define MIN_CELL_VOLTAGE_MV 2700 //Battery is put into emergency stop if one cell goes below this value
|
||||
#define MAX_CELL_DEVIATION_MV 250
|
||||
#define MAX_DISCHARGE_POWER_ALLOWED_W 1800
|
||||
#define MAX_CHARGE_POWER_ALLOWED_W 1800
|
||||
#define MAX_CHARGE_POWER_WHEN_TOPBALANCING_W 50
|
||||
#define RAMPDOWN_SOC 9000 // (90.00) SOC% to start ramping down from max charge power towards 0 at 100.00%
|
||||
|
||||
/* Do not modify any rows below*/
|
||||
#define BATTERY_SELECTED
|
||||
#define RS485_BATTERY_SELECTED
|
||||
|
||||
void setup_battery(void);
|
||||
void receive_RS485(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -109,7 +109,9 @@ void transmit_can() {
|
|||
return; //Global block of CAN messages
|
||||
}
|
||||
|
||||
#ifndef RS485_BATTERY_SELECTED
|
||||
transmit_can_battery();
|
||||
#endif
|
||||
|
||||
#ifdef CAN_INVERTER_SELECTED
|
||||
transmit_can_inverter();
|
||||
|
@ -302,7 +304,9 @@ void map_can_frame_to_variable(CAN_frame* rx_frame, int interface) {
|
|||
#endif
|
||||
|
||||
if (interface == can_config.battery) {
|
||||
#ifndef RS485_BATTERY_SELECTED
|
||||
handle_incoming_can_frame_battery(*rx_frame);
|
||||
#endif
|
||||
#ifdef CHADEMO_BATTERY
|
||||
ISA_handleFrame(rx_frame);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue