Flash LED is working but blinking is not working
This commit is contained in:
parent
a97a69c3f7
commit
f394cb0e43
|
@ -39,6 +39,7 @@ CRGB backlight[NUM_BACKLIGHT_LED]; // Backlight
|
||||||
// Global vars
|
// Global vars
|
||||||
bool blinkingLED = false; // Enable / disable blinking flash LED
|
bool blinkingLED = false; // Enable / disable blinking flash LED
|
||||||
bool statusLED = false; // Actual status of flash LED on/off
|
bool statusLED = false; // Actual status of flash LED on/off
|
||||||
|
|
||||||
int uvDuration = 0; // Under voltage duration in n x 100ms
|
int uvDuration = 0; // Under voltage duration in n x 100ms
|
||||||
|
|
||||||
void hardwareInit()
|
void hardwareInit()
|
||||||
|
@ -49,9 +50,6 @@ void hardwareInit()
|
||||||
// Init RGB LEDs
|
// Init RGB LEDs
|
||||||
FastLED.addLeds<WS2812B, OBP_FLASH_LED, GRB>(fled, NUM_FLASH_LED);
|
FastLED.addLeds<WS2812B, OBP_FLASH_LED, GRB>(fled, NUM_FLASH_LED);
|
||||||
FastLED.addLeds<WS2812B, OBP_BACKLIGHT_LED, GRB>(backlight, NUM_BACKLIGHT_LED);
|
FastLED.addLeds<WS2812B, OBP_BACKLIGHT_LED, GRB>(backlight, NUM_BACKLIGHT_LED);
|
||||||
FastLED.setBrightness(255);
|
|
||||||
fled[0] = CRGB::Red;
|
|
||||||
FastLED.show();
|
|
||||||
|
|
||||||
// Init PCF8574 digital outputs
|
// Init PCF8574 digital outputs
|
||||||
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz
|
Wire.setClock(I2C_SPEED); // Set I2C clock on 10 kHz
|
||||||
|
@ -82,10 +80,10 @@ void setFlashLED(bool status){
|
||||||
statusLED = status;
|
statusLED = status;
|
||||||
FastLED.setBrightness(255); // Brightness for flash LED
|
FastLED.setBrightness(255); // Brightness for flash LED
|
||||||
if(statusLED == true){
|
if(statusLED == true){
|
||||||
fled[0] = CRGB::Red; // Backlight LED on in red
|
fled[0] = CRGB::Red; // Flash LED on in red
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fled[0] = CRGB::Black; // Backlight LED off
|
fled[0] = CRGB::Black; // Flash LED off
|
||||||
}
|
}
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
}
|
}
|
||||||
|
@ -95,10 +93,10 @@ void blinkingFlashLED(){
|
||||||
statusLED != statusLED;
|
statusLED != statusLED;
|
||||||
FastLED.setBrightness(255); // Brightness for flash LED
|
FastLED.setBrightness(255); // Brightness for flash LED
|
||||||
if(statusLED == true){
|
if(statusLED == true){
|
||||||
fled[0] = CRGB::Red; // Backlight LED on in red
|
fled[0] = CRGB::Red; // Flash LED on in red
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
fled[0] = CRGB::Black; // Backlight LED off
|
fled[0] = CRGB::Black; // Flash LED off
|
||||||
}
|
}
|
||||||
FastLED.show();
|
FastLED.show();
|
||||||
}
|
}
|
||||||
|
@ -121,6 +119,7 @@ void buzzer(uint frequency, uint duration){
|
||||||
duration = 1000;
|
duration = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Using LED PWM function for sound generation
|
||||||
pinMode(OBP_BUZZER, OUTPUT);
|
pinMode(OBP_BUZZER, OUTPUT);
|
||||||
ledcSetup(0, frequency, 8); // Ch 0, ferquency in Hz, 8 Bit resolution of PWM
|
ledcSetup(0, frequency, 8); // Ch 0, ferquency in Hz, 8 Bit resolution of PWM
|
||||||
ledcAttachPin(OBP_BUZZER, 0);
|
ledcAttachPin(OBP_BUZZER, 0);
|
||||||
|
|
|
@ -357,7 +357,7 @@ void sensorTask(void *param){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send data from environment sensor all 1s
|
// Send data from environment sensor all 2s
|
||||||
if(millis() > starttime6 + 2000){
|
if(millis() > starttime6 + 2000){
|
||||||
starttime6 = millis();
|
starttime6 = millis();
|
||||||
unsigned char TempSource = 2; // Inside temperature
|
unsigned char TempSource = 2; // Inside temperature
|
||||||
|
|
|
@ -95,6 +95,7 @@ public:
|
||||||
// Limits for Pb battery
|
// Limits for Pb battery
|
||||||
if(String(batType) == "Pb" && (raw < 11.8 || raw > 14.8)){
|
if(String(batType) == "Pb" && (raw < 11.8 || raw > 14.8)){
|
||||||
setBlinkingLED(true);
|
setBlinkingLED(true);
|
||||||
|
setFlashLED(true);
|
||||||
}
|
}
|
||||||
if(String(batType) == "Pb" && (raw >= 11.8 && raw <= 14.8)){
|
if(String(batType) == "Pb" && (raw >= 11.8 && raw <= 14.8)){
|
||||||
setBlinkingLED(false);
|
setBlinkingLED(false);
|
||||||
|
|
|
@ -394,11 +394,11 @@ void OBP60Task(GwApi *api){
|
||||||
|
|
||||||
// If GPS fix then LED off (HDOP)
|
// If GPS fix then LED off (HDOP)
|
||||||
if(String(gpsFix) == "GPS Fix Lost" && date->valid == true){
|
if(String(gpsFix) == "GPS Fix Lost" && date->valid == true){
|
||||||
setPortPin(OBP_FLASH_LED, false);
|
setFlashLED(false);
|
||||||
}
|
}
|
||||||
// Ifmissing GPS fix then LED on
|
// Ifmissing GPS fix then LED on
|
||||||
if(String(gpsFix) == "GPS Fix Lost" && date->valid == false){
|
if(String(gpsFix) == "GPS Fix Lost" && date->valid == false){
|
||||||
setPortPin(OBP_FLASH_LED, true);
|
setFlashLED(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the keyboard message
|
// Check the keyboard message
|
||||||
|
|
Loading…
Reference in New Issue