Merge pull request #49 from dalathegreat/main

Add timeout to CAN write to prevent crashing
This commit is contained in:
rjsc 2023-08-16 22:31:51 +01:00 committed by GitHub
commit beaeddcbe9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 9 deletions

View file

@ -76,6 +76,8 @@ uint16_t cell_min_voltage = 3700; //Stores the minimum cell voltage value in the
#define GREEN 0
#define YELLOW 1
#define RED 2
#define BLUE 3
Adafruit_NeoPixel pixels(1, WS2812_PIN, NEO_GRB + NEO_KHZ800);
static uint8_t brightness = 0;
static bool rampUp = true;
@ -178,8 +180,6 @@ void setup()
// Init LED control
pixels.begin();
pixels.setPixelColor(0, pixels.Color(0, 0, 255)); // Blue LED full brightness while battery and CAN is starting.
pixels.show(); // Incase of crash due to CAN polarity / termination, LED will remain BLUE
//Inform user what setup is used
#ifdef DUAL_CAN
@ -554,8 +554,11 @@ void handle_LED_state()
case YELLOW:
pixels.setPixelColor(0, pixels.Color(brightness, brightness, 0)); // Yellow pulsing LED
break;
case BLUE:
pixels.setPixelColor(0, pixels.Color(0, 0, brightness)); //Blue pulsing LED
break;
case RED:
pixels.setPixelColor(0, pixels.Color(255, 0, 0)); // Red LED full brightness
pixels.setPixelColor(0, pixels.Color(150, 0, 0)); // Red LED full brightness
break;
default:
break;