Closed Devilscave closed 4 years ago
There is a bug in the esp8266_webinterface sketch when using the myModes[] array. See issue #243.
OK thanks, that almost overlapped. But it works. But I have a question. How can I change the line if my goal is "Menu == 1 ... 2 ... 3"? Instead of getModeCount
uint8_t new_mode = sizeof(myModes) > 0 ? myModes[tmp % sizeof(myModes)] : tmp % ws2812fx.getModeCount(); ws2812fx.setMode(new_mode);
I've adjusted most of the effects to the values, but when you switch them via the browser, neither brightness, speed nor color is correct.
Hmm, I'm not sure I understand what you mean. Can you paste your code?
I'm trying to explain better, in my sketch I switch between the effects with a simple "menu function". It is called very simply "menu = 1;" or "menu = 2" I would now like to use the browser (like in the webinterface Sketch) when I click the button with the effect, I don't want the "ws2812fx.getModeCount ()" to be passed but a menu number defined by me 1...2...3... I have to ask because I don't understand the new line for the bugfix.
Ok i found a way, think so it's ok, at least it works.
uint8_t new_mode = sizeof(myModes) > 0 ? myModes[tmp % sizeof(myModes)] : tmp % ws2812fx.getModeCount();
switch(new_mode){ //myModes 25,50,11,12
case 25:
menu=1;
break;
case 50:
menu=3;
break;
case 11:
menu=4;
break;
case 12:
menu=5;
break;
}
I looked at the example "esp8266 - Webinterface" and tried to implement it in my project. Which in itself also worked. But now I wanted to use the "myModes" function to play my own list of effects in a different order. In the web interface, everything is displayed correctly, only the stored effects are no longer correct. For example, if the first effect in the array of myModes is (25,12,13,45,48) = Hyper Sparkle and I then also click on the first field with "Hyper Sparkle" text in the web browser, it is the mode "Static", the second "Blink" etc... I would like to transfer this to a stored integer called "menu", but this has all failed so far. Could someone from the sketch "webinterface" explain "viod modes_setup ()" in more detail.
void modes_setup() {
modes = "";
uint8_t num_modes = sizeof(myModes) > 0 ? sizeof(myModes) : ws2812fx.getModeCount();
for(uint8_t i=0; i < num_modes; i++) {
uint8_t m = sizeof(myModes) > 0 ? myModes[i] : i;
modes += "<li><a href='#'>";
modes += ws2812fx.getModeName(m);
modes += "</a></li>";