Skip to content

Commit

Permalink
fixed protection alarms setting
Browse files Browse the repository at this point in the history
  • Loading branch information
ai-republic committed Feb 17, 2024
1 parent b86715b commit 9495a99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,18 +256,18 @@ private void readAlarms(final BatteryPack pack, final ByteBuffer data) {

// Protection
final short protection = data.getShort();
pack.alarms.levelTwoCellVoltageTooLow.value = Util.bit(alarms, 0);
pack.alarms.levelTwoCellVoltageTooHigh.value = Util.bit(alarms, 1);
pack.alarms.levelTwoStateOfChargeTooLow.value = Util.bit(alarms, 2);
pack.alarms.levelTwoStateOfChargeTooHigh.value = Util.bit(alarms, 3);
pack.alarms.levelTwoChargeTempTooLow.value = Util.bit(alarms, 4);
pack.alarms.levelTwoChargeTempTooHigh.value = Util.bit(alarms, 5);
pack.alarms.levelTwoDischargeTempTooLow.value = Util.bit(alarms, 6);
pack.alarms.levelTwoDischargeTempTooHigh.value = Util.bit(alarms, 7);
pack.alarms.levelTwoChargeCurrentTooHigh.value = Util.bit(alarms, 8);
pack.alarms.levelTwoDischargeCurrentTooHigh.value = Util.bit(alarms, 9);
pack.alarms.levelTwoPackVoltageTooLow.value = Util.bit(alarms, 10);
pack.alarms.levelTwoPackVoltageTooHigh.value = Util.bit(alarms, 11);
pack.alarms.levelTwoCellVoltageTooLow.value = Util.bit(protection, 0);
pack.alarms.levelTwoCellVoltageTooHigh.value = Util.bit(protection, 1);
pack.alarms.levelTwoStateOfChargeTooLow.value = Util.bit(protection, 2);
pack.alarms.levelTwoStateOfChargeTooHigh.value = Util.bit(protection, 3);
pack.alarms.levelTwoChargeTempTooLow.value = Util.bit(protection, 4);
pack.alarms.levelTwoChargeTempTooHigh.value = Util.bit(protection, 5);
pack.alarms.levelTwoDischargeTempTooLow.value = Util.bit(protection, 6);
pack.alarms.levelTwoDischargeTempTooHigh.value = Util.bit(protection, 7);
pack.alarms.levelTwoChargeCurrentTooHigh.value = Util.bit(protection, 8);
pack.alarms.levelTwoDischargeCurrentTooHigh.value = Util.bit(protection, 9);
pack.alarms.levelTwoPackVoltageTooLow.value = Util.bit(protection, 10);
pack.alarms.levelTwoPackVoltageTooHigh.value = Util.bit(protection, 11);
}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.airepublic.bmstoinverter.core.util;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import org.junit.jupiter.api.Test;

import com.airepublic.bmstoinverter.core.util.Util;

public class TestUtil {
@Test
public void testReadBitAllZero() {
Expand Down

0 comments on commit 9495a99

Please sign in to comment.