Fix frontlight
This commit is contained in:
parent
82e80f66e2
commit
32e40e2cb7
3 changed files with 20 additions and 18 deletions
|
@ -3,7 +3,7 @@ dependencies:
|
|||
component_hash: null
|
||||
source:
|
||||
type: idf
|
||||
version: 4.4.6
|
||||
manifest_hash: c799a313787fb26f19e5716786e23d7a9f10f1cd0bbd7bc379c518bb5e67be3e
|
||||
version: 4.4.7
|
||||
manifest_hash: 615d994fdba8799111cf7825a85adb23ca6a2ae02b2335b53fde1188ff862f23
|
||||
target: esp32s3
|
||||
version: 1.0.0
|
||||
|
|
|
@ -18,9 +18,9 @@ uint lastTimeSync;
|
|||
|
||||
void setup()
|
||||
{
|
||||
setupPreferences();
|
||||
setupHardware();
|
||||
|
||||
setupPreferences();
|
||||
setupDisplays();
|
||||
if (preferences.getBool("ledTestOnPower", true))
|
||||
{
|
||||
|
@ -701,26 +701,26 @@ uint getLastTimeSync()
|
|||
#ifdef HAS_FRONTLIGHT
|
||||
void setupFrontlight()
|
||||
{
|
||||
if (!flArray.begin(PCA9685_MODE1_AUTOINCR, PCA9685_MODE2_INVERT))
|
||||
if (!flArray.begin(PCA9685_MODE1_AUTOINCR | PCA9685_MODE1_ALLCALL, PCA9685_MODE2_TOTEMPOLE))
|
||||
{
|
||||
Serial.println(F("FL driver error"));
|
||||
return;
|
||||
}
|
||||
Serial.println(F("FL driver active"));
|
||||
flArray.setFrequency(1000);
|
||||
flArray.setOutputEnablePin(PCA_OE_PIN);
|
||||
flArray.setOutputEnable(true);
|
||||
delay(1000);
|
||||
flArray.setOutputEnable(false);
|
||||
|
||||
if (!preferences.isKey("flMaxBrightness"))
|
||||
{
|
||||
preferences.putUInt("flMaxBrightness", 4095);
|
||||
preferences.putUInt("flMaxBrightness", 2048);
|
||||
}
|
||||
|
||||
if (preferences.getBool("flAlwaysOn", false)) {
|
||||
Serial.println(F("FL Always on"));
|
||||
|
||||
frontlightFadeInAll();
|
||||
} else {
|
||||
Serial.println(F("FL all off"));
|
||||
flArray.allOFF();
|
||||
}
|
||||
// Initialize all LEDs to off
|
||||
// for (int ledPin = 0; ledPin < NUM_SCREENS; ledPin++) {
|
||||
// flArray.setPWM(ledPin, 0, 0); // Turn off LED
|
||||
// }
|
||||
flArray.allOFF();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -338,11 +338,11 @@ void ledTheaterChaseRainbow(int wait) {
|
|||
Adafruit_NeoPixel getPixels() { return pixels; }
|
||||
|
||||
#ifdef HAS_FRONTLIGHT
|
||||
int flDelayTime = 10;
|
||||
int flDelayTime = 5;
|
||||
|
||||
void frontlightFadeInAll() {
|
||||
for (int dutyCycle = 0; dutyCycle <= preferences.getUInt("flMaxBrightness"); dutyCycle += 5) {
|
||||
for (int ledPin = 0; ledPin < NUM_SCREENS; ledPin++) {
|
||||
for (int ledPin = 0; ledPin <= NUM_SCREENS; ledPin++) {
|
||||
flArray.setPWM(ledPin, 0, dutyCycle);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
||||
|
@ -351,11 +351,13 @@ void frontlightFadeInAll() {
|
|||
|
||||
void frontlightFadeOutAll() {
|
||||
for (int dutyCycle = preferences.getUInt("flMaxBrightness"); dutyCycle >= 0; dutyCycle -= 5) {
|
||||
for (int ledPin = 0; ledPin < NUM_SCREENS; ledPin++) {
|
||||
for (int ledPin = 0; ledPin <= NUM_SCREENS; ledPin++) {
|
||||
flArray.setPWM(ledPin, 0, dutyCycle);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(flDelayTime));
|
||||
}
|
||||
|
||||
flArray.allOFF();
|
||||
}
|
||||
|
||||
void frontlightFadeIn(uint num) {
|
||||
|
|
Loading…
Reference in a new issue