Refactor LED defines

This commit is contained in:
Daniel 2023-11-14 21:52:41 +02:00
parent cc2f2e9a5b
commit 2621e29e5f
7 changed files with 15 additions and 25 deletions

View file

@ -1,4 +1,4 @@
/* Do not change any code below this line unless you are sure what you are doing */ /* Do not change any code below this lc:\Git\BYD-Battery-Emulator-For-Gen24\Software\src\battery\NISSAN-LEAF-BATTERY.hine unless you are sure what you are doing */
/* Only change battery specific settings in "USER_SETTINGS.h" */ /* Only change battery specific settings in "USER_SETTINGS.h" */
#include <Arduino.h> #include <Arduino.h>
@ -75,12 +75,6 @@ uint16_t cell_max_voltage = 3700; // Stores the highest cell voltage value in t
uint16_t cell_min_voltage = 3700; // Stores the minimum cell voltage value in the system uint16_t cell_min_voltage = 3700; // Stores the minimum cell voltage value in the system
// LED parameters // LED parameters
#define GREEN 0
#define YELLOW 1
#define RED 2
#define BLUE 3
#define TEST_ALL_COLORS 10
Adafruit_NeoPixel pixels(1, WS2812_PIN, NEO_GRB + NEO_KHZ800); Adafruit_NeoPixel pixels(1, WS2812_PIN, NEO_GRB + NEO_KHZ800);
static uint8_t brightness = 0; static uint8_t brightness = 0;
static bool rampUp = true; static bool rampUp = true;

View file

@ -2,6 +2,7 @@
#define NISSAN_LEAF_BATTERY_H #define NISSAN_LEAF_BATTERY_H
#include <Arduino.h> #include <Arduino.h>
#include "../../USER_SETTINGS.h" #include "../../USER_SETTINGS.h"
#include "../devboard/config.h" // Needed for LED defines
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h" #include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
#define ABSOLUTE_MAX_VOLTAGE \ #define ABSOLUTE_MAX_VOLTAGE \
@ -25,7 +26,7 @@ extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 funct
extern uint16_t cell_max_voltage; //mV, 0-4350 extern uint16_t cell_max_voltage; //mV, 0-4350
extern uint16_t cell_min_voltage; //mV, 0-4350 extern uint16_t cell_min_voltage; //mV, 0-4350
extern uint8_t batteryAllowsContactorClosing; //Bool, 1=true, 0=false extern uint8_t batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern uint8_t LEDcolor; //Enum, 0-2 extern uint8_t LEDcolor; //Enum, 0-10
// Definitions for bms_status // Definitions for bms_status
#define STANDBY 0 #define STANDBY 0
#define INACTIVE 1 #define INACTIVE 1
@ -33,10 +34,6 @@ extern uint8_t LEDcolor; //Enum, 0-2
#define ACTIVE 3 #define ACTIVE 3
#define FAULT 4 #define FAULT 4
#define UPDATING 5 #define UPDATING 5
// LED colors
#define GREEN 0
#define YELLOW 1
#define RED 2
void update_values_leaf_battery(); void update_values_leaf_battery();
void receive_can_leaf_battery(CAN_frame_t rx_frame); void receive_can_leaf_battery(CAN_frame_t rx_frame);

View file

@ -2,6 +2,7 @@
#define TESLA_MODEL_3_BATTERY_H #define TESLA_MODEL_3_BATTERY_H
#include <Arduino.h> #include <Arduino.h>
#include "../../USER_SETTINGS.h" #include "../../USER_SETTINGS.h"
#include "../devboard/config.h" // Needed for LED defines
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h" #include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
#define ABSOLUTE_MAX_VOLTAGE \ #define ABSOLUTE_MAX_VOLTAGE \
@ -33,10 +34,6 @@ extern uint8_t LEDcolor;
#define ACTIVE 3 #define ACTIVE 3
#define FAULT 4 #define FAULT 4
#define UPDATING 5 #define UPDATING 5
// LED colors
#define GREEN 0
#define YELLOW 1
#define RED 2
void update_values_tesla_model_3_battery(); void update_values_tesla_model_3_battery();
void receive_can_tesla_model_3_battery(CAN_frame_t rx_frame); void receive_can_tesla_model_3_battery(CAN_frame_t rx_frame);

View file

@ -2,6 +2,7 @@
#define TEST_FAKE_BATTERY_H #define TEST_FAKE_BATTERY_H
#include <Arduino.h> #include <Arduino.h>
#include "../../USER_SETTINGS.h" #include "../../USER_SETTINGS.h"
#include "../devboard/config.h" // Needed for LED defines
#include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h" #include "../lib/miwagner-ESP32-Arduino-CAN/ESP32CAN.h"
#define ABSOLUTE_MAX_VOLTAGE \ #define ABSOLUTE_MAX_VOLTAGE \
@ -25,7 +26,7 @@ extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 funct
extern uint16_t cell_max_voltage; //mV, 0-4350 extern uint16_t cell_max_voltage; //mV, 0-4350
extern uint16_t cell_min_voltage; //mV, 0-4350 extern uint16_t cell_min_voltage; //mV, 0-4350
extern uint8_t batteryAllowsContactorClosing; //Bool, 1=true, 0=false extern uint8_t batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern uint8_t LEDcolor; //Enum, 0-2 extern uint8_t LEDcolor; //Enum, 0-10
// Definitions for bms_status // Definitions for bms_status
#define STANDBY 0 #define STANDBY 0
#define INACTIVE 1 #define INACTIVE 1
@ -33,12 +34,6 @@ extern uint8_t LEDcolor; //Enum, 0-2
#define ACTIVE 3 #define ACTIVE 3
#define FAULT 4 #define FAULT 4
#define UPDATING 5 #define UPDATING 5
// LED colors
#define GREEN 0
#define YELLOW 1
#define RED 2
#define BLUE 3
#define TEST_ALL_COLORS 10
void update_values_test_battery(); void update_values_test_battery();
void receive_can_test_battery(CAN_frame_t rx_frame); void receive_can_test_battery(CAN_frame_t rx_frame);

View file

@ -32,4 +32,11 @@
#define SD_CS_PIN 13 #define SD_CS_PIN 13
#define WS2812_PIN 4 #define WS2812_PIN 4
// LED definitions for the board
#define GREEN 0
#define YELLOW 1
#define RED 2
#define BLUE 3
#define TEST_ALL_COLORS 10
#endif #endif

View file

@ -21,7 +21,7 @@ extern uint16_t cell_max_voltage; //mV, 0-4350
extern uint16_t cell_min_voltage; //mV, 0-4350 extern uint16_t cell_min_voltage; //mV, 0-4350
extern uint16_t min_voltage; extern uint16_t min_voltage;
extern uint16_t max_voltage; extern uint16_t max_voltage;
extern uint8_t LEDcolor; //Enum, 0-2 extern uint8_t LEDcolor; //Enum, 0-10
// Definitions for BMS status // Definitions for BMS status
#define STANDBY 0 #define STANDBY 0
#define INACTIVE 1 #define INACTIVE 1

View file

@ -21,7 +21,7 @@ extern uint16_t temperature_max; //C+1, Goes thru convert2unsignedint16 funct
extern uint16_t cell_max_voltage; //mV, 0-4350 extern uint16_t cell_max_voltage; //mV, 0-4350
extern uint16_t cell_min_voltage; //mV, 0-4350 extern uint16_t cell_min_voltage; //mV, 0-4350
extern uint8_t batteryAllowsContactorClosing; //Bool, 1=true, 0=false extern uint8_t batteryAllowsContactorClosing; //Bool, 1=true, 0=false
extern uint8_t LEDcolor; //Enum, 0-2 extern uint8_t LEDcolor; //Enum, 0-10
extern uint16_t min_voltage; extern uint16_t min_voltage;
extern uint16_t max_voltage; extern uint16_t max_voltage;
// Definitions for BMS status // Definitions for BMS status