aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: e85faa53883d55b512d35af4cffb5ae1411279f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Archived. **Has license issues.** Reading CAN messages from CAN ids I want, decode and append to a file. Use it with [remote_plot](https://git.flylightning.xyz/remote_plot/)

The code is licensed under GPL-3.0-or-later. mycan.c uses some codes from <https://files.waveshare.com/upload/4/4e/RS485_CAN_HAT_Code.zip> which does not have a license which means those codes are non-free close souce proprietary, so I don't think I'm allowed to add a free and open soruce license to mycan.c. all_SRE_edited.dbc is edited from "SR-16 Custom BMS.dbc" file from <https://github.com/spartanracingelectric/SR16-CustomBMS/blob/main/SR-16%20Custom%20BMS.dbc> and authors of SR16-CustomBMS does not have a license in their code repository for "SR-16 Custom BMS.dbc" file, so authors of SR16-CustomBMS have the copyright on "SR-16 Custom BMS.dbc" file, so all_SRE_edited.dbc can be considered non-free close souce proprietary code. **So there are license issues, I use both non-free and free copyleft license codes.**

build, install, and run
```sh
make
sudo make install
mycan
```

usage
```sh
# use default can0 network interface
mycan
# use vcan0 network interface
mycan vcan0
```

all_SRE_edited.c and all_SRE_edited.h are auto generated by [dbcc](https://github.com/howerj/dbcc) via `dbcc all_SRE_edited.dbc`, see Makfile. all_SRE_edited.dbc is edited from [SR-16 Custom BMS.dbc](https://github.com/spartanracingelectric/SR16-CustomBMS/blob/main/SR-16%20Custom%20BMS.dbc) by editing some lines to make dbcc work.

Infrastructure configs, included in pi_configs dir
- I prefer manage infrastructure configs using my [cfg](https://git.flylightning.xyz/fsh/tree/sh/cfg) script, but that script is my personal project and I don't want to force people to use that, so I include those config files in this repo and I did not manage it with my cfg script on raspberry pi.
- /boot/firmware/config.txt raspberry pi configs to make CAN hat work and make CAN network interface on raspberry pi work
- /etc/systemd/system/can0.service autostart CAN network interface configs
- /home/Spartan_Racing_Charger/.config/systemd/user/mycan.service autostart mycan
- To enable and start can0 autostart, run `sudo systemctl enable --now can0`. To enable mycan autostart, run `sudo systemctl --user enable --now mycan`.

mycan future improvements
- **Rewrite some codes in mycan.c that is copied from <https://files.waveshare.com/upload/4/4e/RS485_CAN_HAT_Code.zip> so there's no license issues and I can add a free and open source license to mycan.c**
- Use a database like SQLite
- More platform independent

To assemble the raspberry pi for remote plotting software, CAN hat need to be placed and inserted onto raspberry pi's male pins. Touchscreen display needs to be put at the bottom of the raspberry pi. All these three items should be screwed with metal rods. Display needs to connect to raspberry pi's 5V and GND ground for power. Raspberry pi it self also need to connect to power supply on 5V and GND ground. CAN hat needs to connect to CAN high and CAN low wires to receive CAN messages from battery BMS.

On raspberry pi, I saved some temporary files I used to work on like git repos in  ~/test. Those files can be cleaned if you want.