mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 17:59:27 +02:00
Make serial compile, add github workflow
This commit is contained in:
parent
2c4fd25943
commit
4cf741a32b
8 changed files with 37 additions and 22 deletions
|
@ -55,6 +55,7 @@ jobs:
|
||||||
- SMA_TRIPOWER_CAN
|
- SMA_TRIPOWER_CAN
|
||||||
- SOFAR_CAN
|
- SOFAR_CAN
|
||||||
- SOLAX_CAN
|
- SOLAX_CAN
|
||||||
|
- SERIAL_LINK_TRANSMITTER
|
||||||
|
|
||||||
# This is the platform GitHub will use to run our workflow.
|
# This is the platform GitHub will use to run our workflow.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
1
.github/workflows/compile-all-inverters.yml
vendored
1
.github/workflows/compile-all-inverters.yml
vendored
|
@ -50,6 +50,7 @@ jobs:
|
||||||
- SMA_TRIPOWER_CAN
|
- SMA_TRIPOWER_CAN
|
||||||
- SOFAR_CAN
|
- SOFAR_CAN
|
||||||
- SOLAX_CAN
|
- SOLAX_CAN
|
||||||
|
- SERIAL_LINK_TRANSMITTER
|
||||||
|
|
||||||
# This is the platform GitHub will use to run our workflow.
|
# This is the platform GitHub will use to run our workflow.
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
|
@ -361,9 +361,7 @@ void inform_user_on_inverter() {
|
||||||
void init_battery() {
|
void init_battery() {
|
||||||
// Inform user what battery is used and perform setup
|
// Inform user what battery is used and perform setup
|
||||||
setup_battery();
|
setup_battery();
|
||||||
#ifdef SERIAL_LINK_RECEIVER
|
|
||||||
Serial.println("SERIAL_DATA_LINK_RECEIVER selected");
|
|
||||||
#endif
|
|
||||||
#ifndef BATTERY_SELECTED
|
#ifndef BATTERY_SELECTED
|
||||||
#error No battery selected! Choose one from the USER_SETTINGS.h file
|
#error No battery selected! Choose one from the USER_SETTINGS.h file
|
||||||
#endif
|
#endif
|
||||||
|
@ -377,7 +375,9 @@ void receive_can() { // This section checks if we have a complete CAN message i
|
||||||
if (rx_frame.FIR.B.FF == CAN_frame_std) {
|
if (rx_frame.FIR.B.FF == CAN_frame_std) {
|
||||||
//printf("New standard frame");
|
//printf("New standard frame");
|
||||||
// Battery
|
// Battery
|
||||||
|
#ifndef SERIAL_LINK_RECEIVER
|
||||||
receive_can_battery(rx_frame);
|
receive_can_battery(rx_frame);
|
||||||
|
#endif
|
||||||
// Inverter
|
// Inverter
|
||||||
#ifdef BYD_CAN
|
#ifdef BYD_CAN
|
||||||
receive_can_byd(rx_frame);
|
receive_can_byd(rx_frame);
|
||||||
|
@ -651,23 +651,22 @@ void update_values() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(SERIAL_LINK_RECEIVER) || defined(SERIAL_LINK_TRANSMITTER)
|
||||||
void runSerialDataLink() {
|
void runSerialDataLink() {
|
||||||
static unsigned long updateTime = 0;
|
static unsigned long updateTime = 0;
|
||||||
unsigned long currentMillis = millis();
|
unsigned long currentMillis = millis();
|
||||||
#ifdef SERIAL_LINK_RECEIVER
|
|
||||||
if ((currentMillis - updateTime) > 1) { //Every 2ms
|
|
||||||
updateTime = currentMillis;
|
|
||||||
manageSerialLinkReceiver();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SERIAL_LINK_TRANSMITTER
|
|
||||||
if ((currentMillis - updateTime) > 1) { //Every 2ms
|
if ((currentMillis - updateTime) > 1) { //Every 2ms
|
||||||
updateTime = currentMillis;
|
updateTime = currentMillis;
|
||||||
|
#ifdef SERIAL_LINK_RECEIVER
|
||||||
|
manageSerialLinkReceiver();
|
||||||
|
#endif
|
||||||
|
#ifdef SERIAL_LINK_TRANSMITTER
|
||||||
manageSerialLinkTransmitter();
|
manageSerialLinkTransmitter();
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void init_serialDataLink() {
|
void init_serialDataLink() {
|
||||||
#if defined(SERIAL_LINK_RECEIVER) || defined(SERIAL_LINK_TRANSMITTER)
|
#if defined(SERIAL_LINK_RECEIVER) || defined(SERIAL_LINK_TRANSMITTER)
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
//#define CHADEMO_BATTERY
|
//#define CHADEMO_BATTERY
|
||||||
//#define IMIEV_CZERO_ION_BATTERY
|
//#define IMIEV_CZERO_ION_BATTERY
|
||||||
//#define KIA_HYUNDAI_64_BATTERY
|
//#define KIA_HYUNDAI_64_BATTERY
|
||||||
//#define NISSAN_LEAF_BATTERY
|
//define NISSAN_LEAF_BATTERY
|
||||||
//#define RENAULT_KANGOO_BATTERY
|
//#define RENAULT_KANGOO_BATTERY
|
||||||
//#define RENAULT_ZOE_BATTERY
|
//#define RENAULT_ZOE_BATTERY
|
||||||
//#define SANTA_FE_PHEV_BATTERY
|
//#define SANTA_FE_PHEV_BATTERY
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
//#define SOLAX_CAN //Enable this line to emulate a "SolaX Triple Power LFP" over CAN bus
|
//#define SOLAX_CAN //Enable this line to emulate a "SolaX Triple Power LFP" over CAN bus
|
||||||
|
|
||||||
/* Other options */
|
/* Other options */
|
||||||
#define DEBUG_VIA_USB //Enable this line to have the USB port output serial diagnostic data while program runs
|
//#define DEBUG_VIA_USB //Enable this line to have the USB port output serial diagnostic data while program runs
|
||||||
//#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting
|
//#define INTERLOCK_REQUIRED //Nissan LEAF specific setting, if enabled requires both high voltage conenctors to be seated before starting
|
||||||
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
|
//#define CONTACTOR_CONTROL //Enable this line to have pins 25,32,33 handle automatic precharge/contactor+/contactor- closing sequence
|
||||||
//#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation
|
//#define PWM_CONTACTOR_CONTROL //Enable this line to use PWM logic for contactors, which lower power consumption and heat generation
|
||||||
|
|
|
@ -47,7 +47,12 @@
|
||||||
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h" //See this file for more Serial-battery settings
|
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h" //See this file for more Serial-battery settings
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SERIAL_LINK_RECEIVER // The serial thing does its thing
|
#ifdef SERIAL_LINK_RECEIVER // The serial thing does its thing
|
||||||
|
void update_values_battery();
|
||||||
|
void receive_can_battery();
|
||||||
|
void send_can_battery();
|
||||||
|
void setup_battery(void);
|
||||||
|
#else
|
||||||
void update_values_battery();
|
void update_values_battery();
|
||||||
void receive_can_battery(CAN_frame_t rx_frame);
|
void receive_can_battery(CAN_frame_t rx_frame);
|
||||||
void send_can_battery();
|
void send_can_battery();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
// SERIAL-LINK-RECEIVER-FROM-BATTERY.cpp
|
#include "BATTERIES.h"
|
||||||
|
#ifdef SERIAL_LINK_RECEIVER
|
||||||
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h"
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "../devboard/utils/events.h"
|
#include "../devboard/utils/events.h"
|
||||||
|
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h"
|
||||||
|
|
||||||
#define INVERTER_SEND_NUM_VARIABLES 1
|
#define INVERTER_SEND_NUM_VARIABLES 1
|
||||||
#define INVERTER_RECV_NUM_VARIABLES 16
|
#define INVERTER_RECV_NUM_VARIABLES 16
|
||||||
|
@ -212,3 +212,11 @@ void update_values_serial_link() {
|
||||||
|
|
||||||
Serial.println("");
|
Serial.println("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setup_battery(void) {
|
||||||
|
Serial.println("SERIAL_DATA_LINK_RECEIVER selected");
|
||||||
|
}
|
||||||
|
void update_values_battery() {}
|
||||||
|
void send_can_battery() {}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#ifndef SERIAL_LINK_RECEIVER_FROM_BATTERY_H
|
#ifndef SERIAL_LINK_RECEIVER_FROM_BATTERY_H
|
||||||
#define SERIAL_LINK_RECEIVER_FROM_BATTERY_H
|
#define SERIAL_LINK_RECEIVER_FROM_BATTERY_H
|
||||||
|
|
||||||
|
#define BATTERY_SELECTED
|
||||||
|
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include "../../USER_SETTINGS.h"
|
#include "../../USER_SETTINGS.h"
|
||||||
#include "../devboard/config.h" // Needed for all defines
|
#include "../devboard/config.h" // Needed for all defines
|
||||||
|
@ -35,5 +37,6 @@ extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false
|
||||||
|
|
||||||
void manageSerialLinkReceiver();
|
void manageSerialLinkReceiver();
|
||||||
void update_values_serial_link();
|
void update_values_serial_link();
|
||||||
|
void setup_battery(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
//SERIAL-LINK-TRANSMITTER-INVERTER.h
|
|
||||||
|
|
||||||
#ifndef SERIAL_LINK_TRANSMITTER_INVERTER_H
|
#ifndef SERIAL_LINK_TRANSMITTER_INVERTER_H
|
||||||
#define SERIAL_LINK_TRANSMITTER_INVERTER_H
|
#define SERIAL_LINK_TRANSMITTER_INVERTER_H
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue