Fixed transitions and gamma

This commit is contained in:
cschwinne 2019-09-19 21:15:20 +02:00
parent 40aaac5868
commit 6c9d161950
6 changed files with 10 additions and 12 deletions

View File

@ -6,7 +6,7 @@
#define LEDPIN 2 //strip pin. Any for ESP32, gpio2 or 3 is recommended for ESP8266 (gpio2/3 are labeled D4/RX on NodeMCU and Wemos)
//#define USE_APA102 // Uncomment for using APA102 LEDs.
#define BTNPIN 0 //button pin. Needs to have pullup (gpio0 recommended)
#define IR_PIN -1 //infrared pin (-1 to disable)
#define IR_PIN 4 //infrared pin (-1 to disable)
#define RLYPIN 12 //pin for relay, will be set HIGH if LEDs are on (-1 to disable). Also usable for standby leds, triggers,...
#define AUXPIN -1 //debug auxiliary output pin (-1 to disable)

View File

@ -350,8 +350,9 @@ void WS2812FX::setColor(uint8_t slot, uint32_t c) {
void WS2812FX::setBrightness(uint8_t b) {
if (_brightness == b) return;
_brightness = gammaCorrectBri ? gamma8(b) : b;
if (SEGENV.next_time > millis() + 20) show(); //apply brightness change immediately if no refresh soon
_brightness = (gammaCorrectBri) ? gamma8(b) : b;
_segment_index = 0;
if (SEGENV.next_time > millis() + 22) show();//apply brightness change immediately if no refresh soon
}
uint8_t WS2812FX::getMode(void) {
@ -535,6 +536,7 @@ void WS2812FX::unlockAll()
void WS2812FX::setTransitionMode(bool t)
{
_segment_index = 0;
SEGMENT.setOption(7,t);
if (!t) return;
unsigned long waitMax = millis() + 20; //refresh after 20 ms if transition enabled
@ -779,7 +781,7 @@ void WS2812FX::handle_palette(void)
uint32_t WS2812FX::color_from_palette(uint16_t i, bool mapping, bool wrap, uint8_t mcol, uint8_t pbri)
{
if (SEGMENT.palette == 0 && mcol < 3) return SEGMENT.colors[mcol]; //WS2812FX default
if (SEGMENT.palette == 0 && mcol < 3) return SEGCOLOR(mcol); //WS2812FX default
uint8_t paletteIndex = i;
if (mapping) paletteIndex = map(i,SEGMENT.start,SEGMENT.stop-1,0,255);
if (!wrap) paletteIndex = scale8(paletteIndex, 240); //cut off blend at palette "end"

View File

@ -17,9 +17,6 @@
button {
outline: none;
cursor: pointer;
}
.btn {
padding: 8px;
margin: 10px;
width: 230px;
@ -49,9 +46,9 @@
If you encounter a bug or have a question/feature suggestion, feel free to open a GitHub issue!<br><br>
<b>Next steps:</b><br><br>
Connect the module to your local WiFi here!<br>
<button class="btn" onclick="window.location.href='/settings/wifi'">WiFi settings</button><br>
<button onclick="window.location.href='/settings/wifi'">WiFi settings</button><br>
<i>Just trying this out in AP mode?</i><br>
<button class="btn" onclick="window.location.href='/sliders'">To the controls!</button>
<button onclick="window.location.href='/sliders'">To the controls!</button>
</body>
</html>

View File

@ -98,7 +98,7 @@
//version code in format yymmddb (b = daily build)
#define VERSION 1909122
#define VERSION 1909194
char versionString[] = "0.8.5";

View File

@ -111,6 +111,7 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
nightlightTargetBri = request->arg("TB").toInt();
t = request->arg("TL").toInt();
if (t > 0) nightlightDelayMinsDefault = t;
nightlightDelayMins = nightlightDelayMinsDefault;
nightlightFade = request->hasArg("TW");
t = request->arg("PB").toInt();

View File

@ -148,8 +148,6 @@ void wledInit()
void beginStrip()
{
// Initialize NeoPixel Strip and button
strip.setColor(0, 0);
strip.setBrightness(255);
#ifdef BTNPIN
pinMode(BTNPIN, INPUT_PULLUP);