Skip to content

Commit

Permalink
Add RGB LED test
Browse files Browse the repository at this point in the history
  • Loading branch information
dalathegreat committed Nov 13, 2023
1 parent 7767d39 commit edf0329
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Software/Software.ino
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ uint16_t cell_min_voltage = 3700; // Stores the minimum cell voltage value in t
#define YELLOW 1
#define RED 2
#define BLUE 3
#define TEST_ALL_COLORS 10

Adafruit_NeoPixel pixels(1, WS2812_PIN, NEO_GRB + NEO_KHZ800);
static uint8_t brightness = 0;
Expand Down Expand Up @@ -451,6 +452,9 @@ void handle_LED_state() {
case RED:
pixels.setPixelColor(0, pixels.Color(150, 0, 0)); // Red LED full brightness
break;
case TEST_ALL_COLORS:
pixels.setPixelColor(0, pixels.Color(brightness, abs((100 - brightness)), abs((50 - brightness)))); // RGB
break;
default:
break;
}
Expand Down
2 changes: 1 addition & 1 deletion Software/USER_SETTINGS.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//#define NISSAN_LEAF_BATTERY
//#define RENAULT_ZOE_BATTERY
//#define TESLA_MODEL_3_BATTERY
//#define TEST_FAKE_BATTERY
#define TEST_FAKE_BATTERY

/* Select inverter communication protocol. See Wiki for which to use with your inverter: https://github.com/dalathegreat/BYD-Battery-Emulator-For-Gen24/wiki */
//#define BYD_CAN //Enable this line to emulate a "BYD Battery-Box Premium HVS" over CAN Bus
Expand Down
2 changes: 1 addition & 1 deletion Software/src/battery/TEST-FAKE-BATTERY.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void print_units(char* header, int value, char* units) {
void update_values_test_battery() { /* This function puts fake values onto the parameters sent towards the inverter */
bms_status = ACTIVE; //Always be in Active mode

LEDcolor = GREEN;
LEDcolor = TEST_ALL_COLORS; // Cycle the LED thru all available colors

SOC = 5000; // 50.00%

Expand Down
1 change: 1 addition & 0 deletions Software/src/battery/TEST-FAKE-BATTERY.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ extern uint8_t LEDcolor; //Enum, 0-2
#define YELLOW 1
#define RED 2
#define BLUE 3
#define TEST_ALL_COLORS 10

void update_values_test_battery();
void receive_can_test_battery(CAN_frame_t rx_frame);
Expand Down

0 comments on commit edf0329

Please sign in to comment.