Make serial compile, add github workflow

This commit is contained in:
Daniel 2024-02-20 21:24:32 +02:00
parent 2c4fd25943
commit 4cf741a32b
8 changed files with 37 additions and 22 deletions

View file

@ -55,6 +55,7 @@ jobs:
- SMA_TRIPOWER_CAN
- SOFAR_CAN
- SOLAX_CAN
- SERIAL_LINK_TRANSMITTER
# This is the platform GitHub will use to run our workflow.
runs-on: ubuntu-latest

View file

@ -50,6 +50,7 @@ jobs:
- SMA_TRIPOWER_CAN
- SOFAR_CAN
- SOLAX_CAN
- SERIAL_LINK_TRANSMITTER
# This is the platform GitHub will use to run our workflow.
runs-on: ubuntu-latest

View file

@ -361,9 +361,7 @@ void inform_user_on_inverter() {
void init_battery() {
// Inform user what battery is used and perform setup
setup_battery();
#ifdef SERIAL_LINK_RECEIVER
Serial.println("SERIAL_DATA_LINK_RECEIVER selected");
#endif
#ifndef BATTERY_SELECTED
#error No battery selected! Choose one from the USER_SETTINGS.h file
#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) {
//printf("New standard frame");
// Battery
#ifndef SERIAL_LINK_RECEIVER
receive_can_battery(rx_frame);
#endif
// Inverter
#ifdef BYD_CAN
receive_can_byd(rx_frame);
@ -651,23 +651,22 @@ void update_values() {
#endif
}
#if defined(SERIAL_LINK_RECEIVER) || defined(SERIAL_LINK_TRANSMITTER)
void runSerialDataLink() {
static unsigned long updateTime = 0;
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
updateTime = currentMillis;
#ifdef SERIAL_LINK_RECEIVER
manageSerialLinkReceiver();
#endif
#ifdef SERIAL_LINK_TRANSMITTER
manageSerialLinkTransmitter();
}
#endif
}
}
#endif
void init_serialDataLink() {
#if defined(SERIAL_LINK_RECEIVER) || defined(SERIAL_LINK_TRANSMITTER)

View file

@ -12,7 +12,7 @@
//#define CHADEMO_BATTERY
//#define IMIEV_CZERO_ION_BATTERY
//#define KIA_HYUNDAI_64_BATTERY
//#define NISSAN_LEAF_BATTERY
//define NISSAN_LEAF_BATTERY
//#define RENAULT_KANGOO_BATTERY
//#define RENAULT_ZOE_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
/* 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 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

View file

@ -47,7 +47,12 @@
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h" //See this file for more Serial-battery settings
#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 receive_can_battery(CAN_frame_t rx_frame);
void send_can_battery();

View file

@ -1,8 +1,8 @@
// SERIAL-LINK-RECEIVER-FROM-BATTERY.cpp
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h"
#include "BATTERIES.h"
#ifdef SERIAL_LINK_RECEIVER
#include <Arduino.h>
#include "../devboard/utils/events.h"
#include "SERIAL-LINK-RECEIVER-FROM-BATTERY.h"
#define INVERTER_SEND_NUM_VARIABLES 1
#define INVERTER_RECV_NUM_VARIABLES 16
@ -212,3 +212,11 @@ void update_values_serial_link() {
Serial.println("");
}
void setup_battery(void) {
Serial.println("SERIAL_DATA_LINK_RECEIVER selected");
}
void update_values_battery() {}
void send_can_battery() {}
#endif

View file

@ -3,6 +3,8 @@
#ifndef SERIAL_LINK_RECEIVER_FROM_BATTERY_H
#define SERIAL_LINK_RECEIVER_FROM_BATTERY_H
#define BATTERY_SELECTED
#include <Arduino.h>
#include "../../USER_SETTINGS.h"
#include "../devboard/config.h" // Needed for all defines
@ -35,5 +37,6 @@ extern bool inverterAllowsContactorClosing; //Bool, 1=true, 0=false
void manageSerialLinkReceiver();
void update_values_serial_link();
void setup_battery(void);
#endif

View file

@ -1,5 +1,3 @@
//SERIAL-LINK-TRANSMITTER-INVERTER.h
#ifndef SERIAL_LINK_TRANSMITTER_INVERTER_H
#define SERIAL_LINK_TRANSMITTER_INVERTER_H