Skip to content

Commit

Permalink
moved utility scripts to new folder
Browse files Browse the repository at this point in the history
  • Loading branch information
ai-republic committed Jan 3, 2024
1 parent 871f094 commit 0dc9433
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 15 deletions.
16 changes: 8 additions & 8 deletions bms-to-inverter-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,18 @@
<!-- #################### !!!!!!!! Choose BMS !!!!!!!! ###################### -->

<!-- #################### DALY(CAN) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>bms-daly-can</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### DALY (RS485) ################### -->
<dependency>
<groupId>com.ai-republic.bms-to-inverter</groupId>
<artifactId>bms-daly-rs485</artifactId>
<artifactId>bms-daly-can</artifactId>
<version>${project.version}</version>
</dependency>

<!-- #################### DALY (RS485) ################### -->
<!-- <dependency>-->
<!-- <groupId>com.ai-republic.bms-to-inverter</groupId>-->
<!-- <artifactId>bms-daly-rs485</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->

<!-- #################### PYLONTECH (CAN) ################### -->
<!-- <dependency>-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ public boolean isOpen() {
public ByteBuffer receiveFrame(final Predicate<byte[]> validator) throws IOException {
ensureOpen();

LOG.debug("CAN frame read...");
final CanFrame frame = canChannel.read();
LOG.debug("CAN read frame {}", printBuffer(frame.getBuffer()));
final ByteBuffer buffer = frame.getBuffer();
buffer.rewind();
buffer.putInt(frame.getId());
Expand Down Expand Up @@ -100,6 +102,7 @@ public void sendExtendedFrame(final ByteBuffer frame) throws IOException {

final CanFrame sendFrame = CanFrame.createExtended(frameId, flags, data, 0, length);
canChannel.write(sendFrame);
LOG.debug("CAN frame sent: {}", printBuffer(sendFrame.getBuffer()));
}


Expand Down
6 changes: 3 additions & 3 deletions cleanrepo.sh → scripts/cleanrepo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
cd ~/bms-to-inverter
git restore *
git pull
cp ~/bms-to-inverter/pom.xml.mine ~/bms-to-inverter/bms-to-inverter-main/pom.xml
cp ~/bms-to-inverter/config.properties.mine ~/bms-to-inverter/bms-to-inverter-main/src/main/resources/config.properties
cp ~/bms-to-inverter/log4j2.xml.mine ~/bms-to-inverter/bms-to-inverter-main/src/main/resources/log4j2.xml
cp ~/pom.xml.mine ~/bms-to-inverter/bms-to-inverter-main/pom.xml
cp ~/config.properties.mine ~/bms-to-inverter/bms-to-inverter-main/src/main/resources/config.properties
cp ~/log4j2.xml.mine ~/bms-to-inverter/bms-to-inverter-main/src/main/resources/log4j2.xml

mvn clean package -DskipTests
rm -R ~/final
Expand Down
9 changes: 5 additions & 4 deletions config.properties.mine → scripts/config.properties.mine
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ ModBus.baudrate=9600

#### Simple single port configuration ####
# BMS port protocol (CAN/RS485/ModBus)
bms.portProtocol=RS485
#bms.portProtocol=CAN
#bms.portProtocol=RS485
bms.portProtocol=CAN

# The port name/device to use to communicate to the BMS
#bms.portLocator=com3
#bms.portLocator=can0
bms.portLocator=can0
#bms.portLocator=/dev/ttyS0
bms.portLocator=/dev/ttyUSB0
#bms.portLocator=/dev/ttyUSB0

#### Or for multiple BMSes connected to multiple ports ####
#bms.0.portProtocol=CAN
Expand All @@ -54,6 +54,7 @@ bms.pollInterval=60

# The port name/device to use to communicate to the inverter
inverter.portLocator=can1

# Interval to send data to the inverter (in seconds)
inverter.sendInterval=1

Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions scripts/startcan.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash
sudo ip link set can0 type can bitrate 500000 restart-ms 100 fd off
sudo ip link set can1 type can bitrate 500000 restart-ms 100 fd off
sudo ifconfig can0 txqueuelen 65536
sudo ifconfig can1 txqueuelen 65536
sudo ip link set up can0
sudo ip link set up can1

0 comments on commit 0dc9433

Please sign in to comment.