Make chargers compile. Add to workflow

This commit is contained in:
Daniel 2024-04-27 13:26:00 +03:00
parent 39e8682d43
commit 93dfa1b0eb
8 changed files with 20 additions and 23 deletions

View file

@ -51,7 +51,7 @@ jobs:
- SOFAR_CAN
- SOLAX_CAN
- SERIAL_LINK_TRANSMITTER
- NISSANLEAF_CHARGER # Last element is not an inverter, but good to also test if charger compiles
# This is the platform GitHub will use to run our workflow.
runs-on: ubuntu-latest

View file

@ -527,11 +527,8 @@ void receive_can() { // This section checks if we have a complete CAN message i
receive_can_sma_tripower(rx_frame);
#endif
// Charger
#ifdef CHEVYVOLT_CHARGER
receive_can_chevyvolt_charger(rx_frame);
#endif
#ifdef NISSANLEAF_CHARGER
receive_can_nissanleaf_charger(rx_frame);
#if defined(CHEVYVOLT_CHARGER) || defined(NISSANLEAF_CHARGER)
receive_can_charger(rx_frame);
#endif
} else { // New extended frame
#ifdef PYLON_CAN
@ -565,11 +562,8 @@ void send_can() {
// Battery
send_can_battery();
// Charger
#ifdef CHEVYVOLT_CHARGER
send_can_chevyvolt_charger();
#endif
#ifdef NISSANLEAF_CHARGER
send_can_nissanleaf_charger();
#if defined(CHEVYVOLT_CHARGER) || defined(NISSANLEAF_CHARGER)
send_can_charger();
#endif
}

View file

@ -1,7 +1,7 @@
#ifndef CHARGERS_H
#define CHARGERS_H
#include "../../USER_SETTINGS.h"
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h" // This include is annoying, consider defining a frame type in types.h
#ifdef CHEVYVOLT_CHARGER
#include "CHEVY-VOLT-CHARGER.h"
@ -11,4 +11,7 @@
#include "NISSAN-LEAF-CHARGER.h"
#endif
void receive_can_charger(CAN_frame_t rx_frame);
void send_can_charger();
#endif

View file

@ -1,6 +1,7 @@
#include "../include.h"
#ifdef CHEVYVOLT_CHARGER
#include "../datalayer/datalayer.h"
#include "../devboard/utils/events.h"
#include "../lib/miwagner-ESP32-Arduino-CAN/CAN_config.h"
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
#include "CHEVY-VOLT-CHARGER.h"
@ -63,7 +64,7 @@ static CAN_frame_t charger_set_targets = {.FIR = {.B =
.data = {0x40, 0x00, 0x00, 0x00}};
/* We are mostly sending out not receiving */
void receive_can_chevyvolt_charger(CAN_frame_t rx_frame) {
void receive_can_charger(CAN_frame_t rx_frame) {
uint16_t charger_stat_HVcur_temp = 0;
uint16_t charger_stat_HVvol_temp = 0;
uint16_t charger_stat_LVcur_temp = 0;
@ -115,7 +116,7 @@ void receive_can_chevyvolt_charger(CAN_frame_t rx_frame) {
}
}
void send_can_chevyvolt_charger() {
void send_can_charger() {
unsigned long currentMillis = millis();
uint16_t Vol_temp = 0;

View file

@ -4,6 +4,8 @@
#include "../include.h"
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
#define CHARGER_SELECTED
/* Charger hardware limits
*
* Relative to runtime settings, expectations are:
@ -14,8 +16,4 @@
#define CHEVYVOLT_MAX_AMP 11.5
#define CHEVYVOLT_MAX_POWER 3300
void update_values_can_chevyvolt_charger();
void send_can_chevyvolt_charger();
void receive_can_chevyvolt_charger(CAN_frame_t rx_frame);
#endif

View file

@ -1,6 +1,7 @@
#include "../include.h"
#ifdef NISSAN_LEAF_CHARGER
#ifdef NISSANLEAF_CHARGER
#include "../datalayer/datalayer.h"
#include "../devboard/utils/events.h"
#include "../lib/miwagner-ESP32-Arduino-CAN/CAN_config.h"
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
#include "NISSAN-LEAF-CHARGER.h"
@ -144,7 +145,7 @@ static uint8_t calculate_checksum_nibble(CAN_frame_t* frame) {
return sum;
}
void receive_can_nissanleaf_charger(CAN_frame_t rx_frame) {
void receive_can_charger(CAN_frame_t rx_frame) {
switch (rx_frame.MsgID) {
case 0x679: // This message fires once when charging cable is plugged in
@ -181,7 +182,7 @@ void receive_can_nissanleaf_charger(CAN_frame_t rx_frame) {
}
}
void send_can_nissanleaf_charger() {
void send_can_charger() {
unsigned long currentMillis = millis();
/* Send keepalive with mode every 10ms */

View file

@ -4,7 +4,6 @@
#include "../include.h"
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
void send_can_nissanleaf_charger();
void receive_can_nissanleaf_charger(CAN_frame_t rx_frame);
#define CHARGER_SELECTED
#endif

View file

@ -12,6 +12,7 @@
#include "devboard/utils/types.h"
#include "battery/BATTERIES.h"
#include "charger/CHARGERS.h"
#include "inverter/INVERTERS.h"
/* - ERROR CHECKS BELOW, DON'T TOUCH - */