Skip to content

Commit fafb2eb

Browse files
committed
Merge branch '0_15' into blending-styles
2 parents ce5ee65 + bd7cd32 commit fafb2eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+737
-1137
lines changed

tools/cdata.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ async function minify(str, type = "plain") {
116116
} else if (type == "css-minify") {
117117
return new CleanCSS({}).minify(str).styles;
118118
} else if (type == "js-minify") {
119-
return await minifyHtml('<script>' + str + '</script>', options).replace(/<[\/]*script>/g, '');
119+
let js = await minifyHtml('<script>' + str + '</script>', options);
120+
return js.replace(/<[\/]*script>/g, '');
120121
} else if (type == "html-minify") {
121122
return await minifyHtml(str, options);
122123
}
@@ -252,6 +253,12 @@ writeChunks(
252253
str
253254
.replace("%%", "%")
254255
},
256+
{
257+
file: "common.js",
258+
name: "JS_common",
259+
method: "gzip",
260+
filter: "js-minify",
261+
},
255262
{
256263
file: "settings.htm",
257264
name: "PAGE_settings",

usermods/Animated_Staircase/Animated_Staircase.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ class Animated_Staircase : public Usermod {
332332
};
333333
// NOTE: this *WILL* return TRUE if all the pins are set to -1.
334334
// this is *BY DESIGN*.
335-
if (!pinManager.allocateMultiplePins(pins, 4, PinOwner::UM_AnimatedStaircase)) {
335+
if (!PinManager::allocateMultiplePins(pins, 4, PinOwner::UM_AnimatedStaircase)) {
336336
topPIRorTriggerPin = -1;
337337
topEchoPin = -1;
338338
bottomPIRorTriggerPin = -1;
@@ -513,10 +513,10 @@ class Animated_Staircase : public Usermod {
513513
(oldBottomAPin != bottomPIRorTriggerPin) ||
514514
(oldBottomBPin != bottomEchoPin)) {
515515
changed = true;
516-
pinManager.deallocatePin(oldTopAPin, PinOwner::UM_AnimatedStaircase);
517-
pinManager.deallocatePin(oldTopBPin, PinOwner::UM_AnimatedStaircase);
518-
pinManager.deallocatePin(oldBottomAPin, PinOwner::UM_AnimatedStaircase);
519-
pinManager.deallocatePin(oldBottomBPin, PinOwner::UM_AnimatedStaircase);
516+
PinManager::deallocatePin(oldTopAPin, PinOwner::UM_AnimatedStaircase);
517+
PinManager::deallocatePin(oldTopBPin, PinOwner::UM_AnimatedStaircase);
518+
PinManager::deallocatePin(oldBottomAPin, PinOwner::UM_AnimatedStaircase);
519+
PinManager::deallocatePin(oldBottomBPin, PinOwner::UM_AnimatedStaircase);
520520
}
521521
if (changed) setup();
522522
}

usermods/Animated_Staircase/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Before compiling, you have to make the following modifications:
1818
Edit `usermods_list.cpp`:
1919
1. Open `wled00/usermods_list.cpp`
2020
2. add `#include "../usermods/Animated_Staircase/Animated_Staircase.h"` to the top of the file
21-
3. add `usermods.add(new Animated_Staircase());` to the end of the `void registerUsermods()` function.
21+
3. add `UsermodManager::add(new Animated_Staircase());` to the end of the `void registerUsermods()` function.
2222

2323
You can configure usermod using the Usermods settings page.
2424
Please enter GPIO pins for PIR or ultrasonic sensors (trigger and echo).

usermods/Battery/usermod_v2_Battery.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class UsermodBattery : public Usermod
200200
bool success = false;
201201
DEBUG_PRINTLN(F("Allocating battery pin..."));
202202
if (batteryPin >= 0 && digitalPinToAnalogChannel(batteryPin) >= 0)
203-
if (pinManager.allocatePin(batteryPin, false, PinOwner::UM_Battery)) {
203+
if (PinManager::allocatePin(batteryPin, false, PinOwner::UM_Battery)) {
204204
DEBUG_PRINTLN(F("Battery pin allocation succeeded."));
205205
success = true;
206206
}
@@ -561,7 +561,7 @@ class UsermodBattery : public Usermod
561561
if (newBatteryPin != batteryPin)
562562
{
563563
// deallocate pin
564-
pinManager.deallocatePin(batteryPin, PinOwner::UM_Battery);
564+
PinManager::deallocatePin(batteryPin, PinOwner::UM_Battery);
565565
batteryPin = newBatteryPin;
566566
// initialise
567567
setup();

usermods/EXAMPLE_v2/usermod_v2_example.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class MyExampleUsermod : public Usermod {
7171
// #endif
7272
// in setup()
7373
// #ifdef USERMOD_EXAMPLE
74-
// UM = (MyExampleUsermod*) usermods.lookup(USERMOD_ID_EXAMPLE);
74+
// UM = (MyExampleUsermod*) UsermodManager::lookup(USERMOD_ID_EXAMPLE);
7575
// #endif
7676
// somewhere in loop() or other member method
7777
// #ifdef USERMOD_EXAMPLE

usermods/Fix_unreachable_netservices_v2/readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ void registerUsermods()
5959
* || || ||
6060
* \/ \/ \/
6161
*/
62-
//usermods.add(new MyExampleUsermod());
63-
//usermods.add(new UsermodTemperature());
64-
//usermods.add(new UsermodRenameMe());
65-
usermods.add(new FixUnreachableNetServices());
62+
//UsermodManager::add(new MyExampleUsermod());
63+
//UsermodManager::add(new UsermodTemperature());
64+
//UsermodManager::add(new UsermodRenameMe());
65+
UsermodManager::add(new FixUnreachableNetServices());
6666

6767
}
6868
```

usermods/LDR_Dusk_Dawn_v2/usermod_LDR_Dusk_Dawn_v2.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class LDR_Dusk_Dawn_v2 : public Usermod {
3030
void setup() {
3131
// register ldrPin
3232
if ((ldrPin >= 0) && (digitalPinToAnalogChannel(ldrPin) >= 0)) {
33-
if(!pinManager.allocatePin(ldrPin, false, PinOwner::UM_LDR_DUSK_DAWN)) ldrEnabled = false; // pin already in use -> disable usermod
33+
if(!PinManager::allocatePin(ldrPin, false, PinOwner::UM_LDR_DUSK_DAWN)) ldrEnabled = false; // pin already in use -> disable usermod
3434
else pinMode(ldrPin, INPUT); // alloc success -> configure pin for input
3535
} else ldrEnabled = false; // invalid pin -> disable usermod
3636
initDone = true;
@@ -110,7 +110,7 @@ class LDR_Dusk_Dawn_v2 : public Usermod {
110110

111111
if (initDone && (ldrPin != oldLdrPin)) {
112112
// pin changed - un-register previous pin, register new pin
113-
if (oldLdrPin >= 0) pinManager.deallocatePin(oldLdrPin, PinOwner::UM_LDR_DUSK_DAWN);
113+
if (oldLdrPin >= 0) PinManager::deallocatePin(oldLdrPin, PinOwner::UM_LDR_DUSK_DAWN);
114114
setup(); // setup new pin
115115
}
116116
return configComplete;
@@ -139,7 +139,7 @@ class LDR_Dusk_Dawn_v2 : public Usermod {
139139
//LDR_Off_Count.add(ldrOffCount);
140140

141141
//bool pinValid = ((ldrPin >= 0) && (digitalPinToAnalogChannel(ldrPin) >= 0));
142-
//if (pinManager.getPinOwner(ldrPin) != PinOwner::UM_LDR_DUSK_DAWN) pinValid = false;
142+
//if (PinManager::getPinOwner(ldrPin) != PinOwner::UM_LDR_DUSK_DAWN) pinValid = false;
143143
//JsonArray LDR_valid = user.createNestedArray(F("LDR pin"));
144144
//LDR_valid.add(ldrPin);
145145
//LDR_valid.add(pinValid ? F(" OK"): F(" invalid"));

usermods/PIR_sensor_switch/readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class MyUsermod : public Usermod {
5252

5353
void togglePIRSensor() {
5454
#ifdef USERMOD_PIR_SENSOR_SWITCH
55-
PIRsensorSwitch *PIRsensor = (PIRsensorSwitch::*) usermods.lookup(USERMOD_ID_PIRSWITCH);
55+
PIRsensorSwitch *PIRsensor = (PIRsensorSwitch::*) UsermodManager::lookup(USERMOD_ID_PIRSWITCH);
5656
if (PIRsensor != nullptr) {
5757
PIRsensor->EnablePIRsensor(!PIRsensor->PIRsensorEnabled());
5858
}

usermods/PIR_sensor_switch/usermod_PIR_sensor_switch.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void PIRsensorSwitch::setup()
375375
sensorPinState[i] = LOW;
376376
if (PIRsensorPin[i] < 0) continue;
377377
// pin retrieved from cfg.json (readFromConfig()) prior to running setup()
378-
if (pinManager.allocatePin(PIRsensorPin[i], false, PinOwner::UM_PIR)) {
378+
if (PinManager::allocatePin(PIRsensorPin[i], false, PinOwner::UM_PIR)) {
379379
// PIR Sensor mode INPUT_PULLDOWN
380380
#ifdef ESP8266
381381
pinMode(PIRsensorPin[i], PIRsensorPin[i]==16 ? INPUT_PULLDOWN_16 : INPUT_PULLUP); // ESP8266 has INPUT_PULLDOWN on GPIO16 only
@@ -564,7 +564,7 @@ bool PIRsensorSwitch::readFromConfig(JsonObject &root)
564564
DEBUG_PRINTLN(F(" config loaded."));
565565
} else {
566566
for (int i = 0; i < PIR_SENSOR_MAX_SENSORS; i++)
567-
if (oldPin[i] >= 0) pinManager.deallocatePin(oldPin[i], PinOwner::UM_PIR);
567+
if (oldPin[i] >= 0) PinManager::deallocatePin(oldPin[i], PinOwner::UM_PIR);
568568
setup();
569569
DEBUG_PRINTLN(F(" config (re)loaded."));
570570
}

usermods/PWM_fan/usermod_PWM_fan.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class PWMFanUsermod : public Usermod {
7575
static const char _lock[];
7676

7777
void initTacho(void) {
78-
if (tachoPin < 0 || !pinManager.allocatePin(tachoPin, false, PinOwner::UM_Unspecified)){
78+
if (tachoPin < 0 || !PinManager::allocatePin(tachoPin, false, PinOwner::UM_Unspecified)){
7979
tachoPin = -1;
8080
return;
8181
}
@@ -88,7 +88,7 @@ class PWMFanUsermod : public Usermod {
8888
void deinitTacho(void) {
8989
if (tachoPin < 0) return;
9090
detachInterrupt(digitalPinToInterrupt(tachoPin));
91-
pinManager.deallocatePin(tachoPin, PinOwner::UM_Unspecified);
91+
PinManager::deallocatePin(tachoPin, PinOwner::UM_Unspecified);
9292
tachoPin = -1;
9393
}
9494

@@ -111,7 +111,7 @@ class PWMFanUsermod : public Usermod {
111111

112112
// https://randomnerdtutorials.com/esp32-pwm-arduino-ide/
113113
void initPWMfan(void) {
114-
if (pwmPin < 0 || !pinManager.allocatePin(pwmPin, true, PinOwner::UM_Unspecified)) {
114+
if (pwmPin < 0 || !PinManager::allocatePin(pwmPin, true, PinOwner::UM_Unspecified)) {
115115
enabled = false;
116116
pwmPin = -1;
117117
return;
@@ -121,7 +121,7 @@ class PWMFanUsermod : public Usermod {
121121
analogWriteRange(255);
122122
analogWriteFreq(WLED_PWM_FREQ);
123123
#else
124-
pwmChannel = pinManager.allocateLedc(1);
124+
pwmChannel = PinManager::allocateLedc(1);
125125
if (pwmChannel == 255) { //no more free LEDC channels
126126
deinitPWMfan(); return;
127127
}
@@ -136,9 +136,9 @@ class PWMFanUsermod : public Usermod {
136136
void deinitPWMfan(void) {
137137
if (pwmPin < 0) return;
138138

139-
pinManager.deallocatePin(pwmPin, PinOwner::UM_Unspecified);
139+
PinManager::deallocatePin(pwmPin, PinOwner::UM_Unspecified);
140140
#ifdef ARDUINO_ARCH_ESP32
141-
pinManager.deallocateLedc(pwmChannel, 1);
141+
PinManager::deallocateLedc(pwmChannel, 1);
142142
#endif
143143
pwmPin = -1;
144144
}
@@ -191,9 +191,9 @@ class PWMFanUsermod : public Usermod {
191191
void setup() override {
192192
#ifdef USERMOD_DALLASTEMPERATURE
193193
// This Usermod requires Temperature usermod
194-
tempUM = (UsermodTemperature*) usermods.lookup(USERMOD_ID_TEMPERATURE);
194+
tempUM = (UsermodTemperature*) UsermodManager::lookup(USERMOD_ID_TEMPERATURE);
195195
#elif defined(USERMOD_SHT)
196-
tempUM = (ShtUsermod*) usermods.lookup(USERMOD_ID_SHT);
196+
tempUM = (ShtUsermod*) UsermodManager::lookup(USERMOD_ID_SHT);
197197
#endif
198198
initTacho();
199199
initPWMfan();

0 commit comments

Comments
 (0)