Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add folder structure #78

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions Software/Software.ino
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@

#include <Arduino.h>
#include "HardwareSerial.h"
#include "src/lib/adafruit-Adafruit_NeoPixel/Adafruit_NeoPixel.h"
#include "src/lib/eModbus-eModbus/Logging.h"
#include "src/lib/eModbus-eModbus/ModbusServerRTU.h"
#include "src/lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"
#include "USER_SETTINGS.h"
#include "config.h"
#include "Logging.h"
#include "mbServerFCs.h"
#include "ModbusServerRTU.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "Adafruit_NeoPixel.h"
#include "BATTERIES.h"
#include "INVERTERS.h"
#include "src/devboard/config.h"
#include "src/devboard/modbus/mbServerFCs.h"
#include "src/devboard/can/ESP32CAN.h"
#include "src/battery/BATTERIES.h"
#include "src/inverter/INVERTERS.h"

//CAN parameters
CAN_device_t CAN_cfg; // CAN Config
const int rx_queue_size = 10; // Receive Queue size

#ifdef DUAL_CAN
#include "ACAN2515.h"
#include "src/lib/pierremolinaro-acan2515/ACAN2515.h"
static const uint32_t QUARTZ_FREQUENCY = 8UL * 1000UL * 1000UL ; // 8 MHz
ACAN2515 can(MCP2515_CS, SPI, MCP2515_INT);
static ACAN2515_Buffer16 gBuffer;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "BMW-I3-BATTERY.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

//TODO before using
// Map the final values in update_values_i3_battery, set some to static values if not available (current, discharge max , charge max)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef BMW_I3_BATTERY_H
#define BMW_I3_BATTERY_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "CHADEMO-BATTERY.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

/* Do not change code below unless you are sure what you are doing */
static unsigned long previousMillis100 = 0; // will store last time a 100ms CAN Message was send
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef CHADEMO_BATTERY_H
#define CHADEMO_BATTERY_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "IMIEV-CZERO-ION-BATTERY.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

//Code still work in progress, TODO:
//Figure out if CAN messages need to be sent to keep the system happy?
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef IMIEV_CZERO_ION_BATTERY_H
#define IMIEV_CZERO_ION_BATTERY_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "KIA-HYUNDAI-64-BATTERY.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

/* Do not change code below unless you are sure what you are doing */
static unsigned long previousMillis10 = 0; // will store last time a 10ms CAN Message was send
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef KIA_HYUNDAI_64_BATTERY_H
#define KIA_HYUNDAI_64_BATTERY_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "NISSAN-LEAF-BATTERY.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

/* Do not change code below unless you are sure what you are doing */
static unsigned long previousMillis10 = 0; // will store last time a 10ms CAN Message was send
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef NISSAN_LEAF_BATTERY_H
#define NISSAN_LEAF_BATTERY_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "RENAULT-ZOE-BATTERY.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

/* Do not change code below unless you are sure what you are doing */
#define LB_MAX_SOC 1000 //BMS never goes over this value. We use this info to rescale SOC% sent to Fronius
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef RENAULT_ZOE_BATTERY_H
#define RENAULT_ZOE_BATTERY_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

#define ABSOLUTE_MAX_VOLTAGE 4040 // 404.4V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
#define ABSOLUTE_MIN_VOLTAGE 3100 // 310.0V if battery voltage goes under this, discharging further is disabled
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "TESLA-MODEL-3-BATTERY.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

/* Do not change code below unless you are sure what you are doing */
/* Credits: Most of the code comes from Per Carlen's bms_comms_tesla_model3.py (https://gitlab.com/pelle8/batt2gen24/) */
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef TESLA_MODEL_3_BATTERY_H
#define TESLA_MODEL_3_BATTERY_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

#define ABSOLUTE_MAX_VOLTAGE 4030 // 403.0V,if battery voltage goes over this, charging is not possible (goes into forced discharge)
#define ABSOLUTE_MIN_VOLTAGE 2450 // 245.0V if battery voltage goes under this, discharging further is disabled
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions Software/ESP32CAN.h → Software/src/devboard/can/ESP32CAN.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef ESP32CAN_H
#define ESP32CAN_H

#include "CAN_config.h"
#include "CAN.h"
#include "../../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"
#include "../../lib/ThomasBarth-ESP32-CAN-Driver/CAN.h"
extern uint8_t LEDcolor;

class ESP32CAN
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "mbServerFCs.h"
#include "Logging.h"
#include "../../lib/eModbus-eModbus/Logging.h"

//modbus register memory - declared in main.cpp

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "ModbusServerRTU.h"
#include "../../lib/eModbus-eModbus/ModbusServerRTU.h"

#define MBTCP_ID 21 // modbus TCP server ID
#define MBPV_MAX 30000
Expand Down
4 changes: 2 additions & 2 deletions Software/BYD-CAN.cpp → Software/src/inverter/BYD-CAN.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "BYD-CAN.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

/* Do not change code below unless you are sure what you are doing */
static unsigned long previousMillis2s = 0; // will store last time a 2s CAN Message was send
Expand Down
4 changes: 2 additions & 2 deletions Software/BYD-CAN.h → Software/src/inverter/BYD-CAN.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef BYD_CAN_H
#define BYD_CAN_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

extern uint16_t SOC;
extern uint16_t StateOfHealth;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "PYLON-CAN.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

#define SEND_0 //If defined, the messages will have ID ending with 0 (useful for some inverters)
//#define SEND_1 //If defined, the messages will have ID ending with 1 (useful for some inverters)
Expand Down
4 changes: 2 additions & 2 deletions Software/PYLON-CAN.h → Software/src/inverter/PYLON-CAN.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef PYLON_CAN_H
#define PYLON_CAN_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

extern uint16_t SOC;
extern uint16_t StateOfHealth;
Expand Down
4 changes: 2 additions & 2 deletions Software/SMA-CAN.cpp → Software/src/inverter/SMA-CAN.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "SMA-CAN.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

//TODO, change CAN sending routine once confirmed that 500ms interval is OK for this battery type

Expand Down
4 changes: 2 additions & 2 deletions Software/SMA-CAN.h → Software/src/inverter/SMA-CAN.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef SMA_CAN_H
#define SMA_CAN_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

extern uint16_t SOC; //SOC%, 0-100.00 (0-10000)
extern uint16_t StateOfHealth; //SOH%, 0-100.00 (0-10000)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "SOFAR-CAN.h"
#include "ESP32CAN.h"
#include "CAN_config.h"
#include "../devboard/can/ESP32CAN.h"
#include "../lib/ThomasBarth-ESP32-CAN-Driver/CAN_config.h"

/* This implementation of the SOFAR can protocol is halfway done. What's missing is implementing the inverter replies, all the CAN messages are listed, but the can sending is missing. */

Expand Down
4 changes: 2 additions & 2 deletions Software/SOFAR-CAN.h → Software/src/inverter/SOFAR-CAN.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef SOFAR_CAN_H
#define SOFAR_CAN_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../../USER_SETTINGS.h"

// These parameters need to be mapped for the inverter
extern uint16_t SOC; //SOC%, 0-100.00 (0-10000)
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions Software/SOLAX-CAN.h → Software/src/inverter/SOLAX-CAN.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef SOLAX_CAN_H
#define SOLAX_CAN_H
#include <Arduino.h>
#include "ESP32CAN.h"
#include "config.h"
#include "USER_SETTINGS.h"
#include "../devboard/can/ESP32CAN.h"
#include "../devboard/config.h"
#include "../../USER_SETTINGS.h"

#include "ACAN2515.h"
#include "../lib/pierremolinaro-acan2515/ACAN2515.h"
extern ACAN2515 can;

extern uint16_t SOC;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.