mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-06 03:50:13 +02:00
Merge pull request #49 from dalathegreat/main
Add timeout to CAN write to prevent crashing
This commit is contained in:
commit
beaeddcbe9
4 changed files with 30 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue