Added:
- analogue FX speed - analogue FX intensity - analogue palette selection - UI legend
This commit is contained in:
parent
13bc378069
commit
7e0d9cb48c
@ -70,9 +70,9 @@ void handleAnalog(uint8_t b)
|
|||||||
{
|
{
|
||||||
static uint8_t oldRead[WLED_MAX_BUTTONS];
|
static uint8_t oldRead[WLED_MAX_BUTTONS];
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
uint16_t aRead = analogRead(A0) >> 5; // convert 10bit read to 5bit (remove noise)
|
uint16_t aRead = analogRead(A0) >> 4; // convert 10bit read to 6bit (remove noise/reduce range & frequency of UI updates)
|
||||||
#else
|
#else
|
||||||
uint16_t aRead = analogRead(btnPin[b]) >> 7; // convert 12bit read to 5bit (remove noise)
|
uint16_t aRead = analogRead(btnPin[b]) >> 6; // convert 12bit read to 6bit (remove noise/reduce range & frequency of UI updates)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (oldRead[b] == aRead) return; // no change in reading
|
if (oldRead[b] == aRead) return; // no change in reading
|
||||||
@ -80,14 +80,41 @@ void handleAnalog(uint8_t b)
|
|||||||
|
|
||||||
// if no macro for "short press" and "long press" is defined use brightness control
|
// if no macro for "short press" and "long press" is defined use brightness control
|
||||||
if (!macroButton[b] && !macroLongPress[b]) {
|
if (!macroButton[b] && !macroLongPress[b]) {
|
||||||
// if "double press" macro is 250 or greater use global brightness
|
// if "double press" macro defines which option to change
|
||||||
if (macroDoublePress[b] >= 250) {
|
if (macroDoublePress[b] >= 250) {
|
||||||
// if change in analog read was detected change global brightness
|
// global brightness
|
||||||
if (aRead == 0) {
|
if (aRead == 0) {
|
||||||
briLast = bri;
|
briLast = bri;
|
||||||
bri = 0;
|
bri = 0;
|
||||||
} else{
|
} else{
|
||||||
bri = aRead << 3;
|
bri = aRead << 2;
|
||||||
|
}
|
||||||
|
} else if (macroDoublePress[b] == 249) {
|
||||||
|
// effect speed
|
||||||
|
effectSpeed = aRead << 2;
|
||||||
|
effectChanged = true;
|
||||||
|
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||||
|
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||||
|
if (!seg.isSelected()) continue;
|
||||||
|
seg.speed = effectSpeed;
|
||||||
|
}
|
||||||
|
} else if (macroDoublePress[b] == 248) {
|
||||||
|
// effect intensity
|
||||||
|
effectIntensity = aRead << 2;
|
||||||
|
effectChanged = true;
|
||||||
|
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||||
|
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||||
|
if (!seg.isSelected()) continue;
|
||||||
|
seg.intensity = effectIntensity;
|
||||||
|
}
|
||||||
|
} else if (macroDoublePress[b] == 247) {
|
||||||
|
// selected palette
|
||||||
|
effectPalette = map(aRead, 0, 63, 0, strip.getPaletteCount()-1);
|
||||||
|
effectChanged = true;
|
||||||
|
for (uint8_t i = 0; i < strip.getMaxSegments(); i++) {
|
||||||
|
WS2812FX::Segment& seg = strip.getSegment(i);
|
||||||
|
if (!seg.isSelected()) continue;
|
||||||
|
seg.palette = effectPalette;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// otherwise use "double press" for segment selection
|
// otherwise use "double press" for segment selection
|
||||||
|
@ -173,11 +173,20 @@
|
|||||||
<td>short<br>on->off</td>
|
<td>short<br>on->off</td>
|
||||||
<td>long<br>off->on</td>
|
<td>long<br>off->on</td>
|
||||||
<td>double<br>N/A</td>
|
<td>double<br>N/A</td>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<div>For analog button set <i>duble</i> to:
|
||||||
|
<ul>
|
||||||
|
<li>250=global brightness</li>
|
||||||
|
<li>249=effect speed</li>
|
||||||
|
<li>248=effect intensity</li>
|
||||||
|
<li>247=palette</li>
|
||||||
|
<li>0..32=segment X opacity</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
<h3>Time-controlled presets</h3>
|
<h3>Time-controlled presets</h3>
|
||||||
<div style="display: inline-block">
|
<div style="display: inline-block">
|
||||||
<table id="TMT">
|
<table id="TMT">
|
||||||
|
@ -349,10 +349,13 @@ name="MC" type="number" min="0" max="250" required><br>
|
|||||||
Timed-Light-Over Presets: <input name="MN" type="number" min="0" max="250"
|
Timed-Light-Over Presets: <input name="MN" type="number" min="0" max="250"
|
||||||
required><br><h3>Button actions</h3><table style="margin:0 auto" id="macros">
|
required><br><h3>Button actions</h3><table style="margin:0 auto" id="macros">
|
||||||
<thead><tr><td>push<br>switch</td><td>short<br>on->off</td><td>long<br>
|
<thead><tr><td>push<br>switch</td><td>short<br>on->off</td><td>long<br>
|
||||||
off->on</td><td>double<br>N/A</td></tr></thead><tbody></tbody></table><h3>
|
off->on</td><td>double<br>N/A</td></tr></thead><tbody></tbody></table><div>
|
||||||
Time-controlled presets</h3><div style="display:inline-block"><table id="TMT">
|
For analog button set <i>duble</i> to:<ul><li>250=global brightness</li><li>
|
||||||
</table></div><hr><button type="button" onclick="B()">Back</button><button
|
249=effect speed</li><li>248=effect intensity</li><li>247=palette</li><li>
|
||||||
type="submit">Save</button></form></body></html>)=====";
|
0..32=segment X opacity</li></ul></div><h3>Time-controlled presets</h3><div
|
||||||
|
style="display:inline-block"><table id="TMT"></table></div><hr><button
|
||||||
|
type="button" onclick="B()">Back</button><button type="submit">Save</button>
|
||||||
|
</form></body></html>)=====";
|
||||||
|
|
||||||
|
|
||||||
// Autogenerated from wled00/data/settings_sec.htm, do not edit!!
|
// Autogenerated from wled00/data/settings_sec.htm, do not edit!!
|
||||||
|
Loading…
Reference in New Issue
Block a user