Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WLED 0.15 seven_segment_display_reloaded crashes ESP32-C3 #4121

Closed
1 task done
KrX3D opened this issue Aug 30, 2024 · 9 comments
Closed
1 task done

WLED 0.15 seven_segment_display_reloaded crashes ESP32-C3 #4121

KrX3D opened this issue Aug 30, 2024 · 9 comments
Labels
bug fixed in source This issue is unsolved in the latest release but fixed in master usermod usermod related

Comments

@KrX3D
Copy link

KrX3D commented Aug 30, 2024

What happened?

Hello,

i have an ESP32-C3, i just downloaded WLED 0.15 and enabled in the my_config file the usermod:

seven_segment_display_reloaded
with
#define USERMOD_SSDR

after flasing i cant connect to the gui and it seems the esp just hangs. i tried like 3 or 4 other ESP32-C3 and always the same.
when i dont enable the usermod it works.

i got it to "work" by disabling those lines in the usermod_seven_segment_reloaded.h

line 244 and 247:
//umSSDRMask[i] = true;

line 262:
//umSSDRMask[i] = false;

and also line 255:
//strip.setPixelColor(i, 0x000000);

all 4 need to be commented out or i cant connect to the gui

To Reproduce Bug

  • get WLED 0.15 and enabled in the my_config file the usermod: (also enable my_config in the wled.h file)
  • enable in the config the usermod seven_segment_display_reloaded with #define USERMOD_SSDR

Expected Behavior

it should work like in 13.3 and 14.4 (was woring before but on a nodemcu)

Install Method

Self-Compiled

What version of WLED?

WLED 0.15.0.-b4 BUILD 2407070

Which microcontroller/board are you seeing the problem on?

ESP32-C3

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@KrX3D KrX3D added the bug label Aug 30, 2024
@KrX3D
Copy link
Author

KrX3D commented Aug 31, 2024

some more info:

the esp32-c3 where before working iwth wled 0.14.4 and there i had 3 led outpouts set with ws281x than i updated to 0.15 and i realized that the 3rd led output was missing. and i cant set it again like i mentioned here:

#4122

now i reflashed 0.15-b4 via https://install.wled.me/ and all settings where reset.
i reflashed my self compiiled version and when i dont set up any led output i just need to comment out line 244 : //umSSDRMask[i] = true;

the other 3 can be as intended. even when i set up led output 1 and 2

so maybe the 3rd output that went "missing" after updating to 0.15 caused this?

but this usermod is still broken since line 244 crashes it

@blazoncek
Copy link
Collaborator

You will need to contact usermod creator or maintainer as WLED team does not support usermods unless personally involved.

@KrX3D
Copy link
Author

KrX3D commented Aug 31, 2024

Hi,

im not really a github user. How do i know who created the usermod and how can i contact him?

also it is possible like i mentioned that after upgrading from 0.14 to 0.15 and one led output got missing (becausxe of not enough RTM channels like you mentioned on the other thread) that the 3rd led output was still "stored" and cause some problems, which got soloved after all userdata was deleted ? or do you think that was something else?

@blazoncek
Copy link
Collaborator

Use Git blame feature (available on Github) to find out original author or current maintainer.
Git commit history is another way but too much cumbersome.

As for upgrading, backup settings and presets. If anything does not play as you expect, erase all settings and see if reconfiguring helps. If not, there might be a bug (0.15 is still a beta) or the feature has changed.

@KrX3D
Copy link
Author

KrX3D commented Aug 31, 2024

ok i think i got it working. and it seems not to be a problem with the usermod, but it could be handled better by the usermode.

like i said i had 3 led outputs and when i switched to 0.15 only 2 led outputs are there and the third was missing, like you said bec ause of not enough RTM channels.
but the usermod was still set to use the 10 leds that the third led output had.

and so the usermod was using those 10 leds from led output 3 which is missing. so for me it seems to be an array issue.

if (range) {
for(int i = lastSeenLedNr; i <= lednr; i++) {
	umSSDRMask[i] = true;
}
} else {
umSSDRMask[lednr] = true;
}

i removed the 10 leds which i set in the usermod config in the gui and now it seems to work

@KrX3D
Copy link
Author

KrX3D commented Aug 31, 2024

i got it woking now and added some checks in the _setLeds function

im mostly checking for umSSDRLength . here is the improved code which works now even when i have set some leds that are not present:

  void _setLeds(int lednr, int lastSeenLedNr, bool range, int countSegments, int number, bool colon) {
    if (number >= 0 && number < 11 && countSegments >= 0 && countSegments < 7) {
        if ((colon && umSSDRColonblink) || umSSDRNumbers[number][countSegments]) {
            if (range) {
                // Check if the LED index is within the valid range before accessing the array
                if (lednr < umSSDRLength && lastSeenLedNr < umSSDRLength) {
                    for (int i = lastSeenLedNr; i <= lednr; i++) {
                        umSSDRMask[i] = true;
                    }
                }
            } else {
                // Check if the single LED index is within the valid range before accessing the array
                if (lednr < umSSDRLength) {
                    umSSDRMask[lednr] = true;
                }
            }
        }
    }
  }````

@softhack007 softhack007 added the usermod usermod related label Sep 4, 2024
softhack007 added a commit that referenced this issue Sep 6, 2024
…ion (solves #4121)

I'm not the maintainer of this usermod, but its obvious that the code might overrun array bounds, so fixing this.
@softhack007 softhack007 added the fixed in source This issue is unsolved in the latest release but fixed in master label Sep 6, 2024
@softhack007
Copy link
Collaborator

@KrX3D I've fixed some potential array bounds violations and pointer errors in the usermod. Please check if it works for you.

Important: I'm not the maintainer of this usermod, and I have no idea what the usermod does. I've just applied a bandaid where it seemed reasonable.

@KrX3D
Copy link
Author

KrX3D commented Sep 8, 2024

hi,

i tested your fix here:
340a9f8

for now it seems to work, so thanks for that.

i will test it for the next 2-3 days and report back

@KrX3D
Copy link
Author

KrX3D commented Sep 11, 2024

@softhack007

Hi,

so its not completly solved. But its maybe not only the fault of this usermod.

What i did:

  • Download a fresh copy of 0.15-b5
  • enable in wled.h - #define WLED_USE_MY_CONFIG
  • in my_config.h i added my ssid and my pass and also added - #define USERMOD_SSDR
  • in platformio.ini i changed it to this: default_envs = lolin_s2_mini

than i flashed a completly new esp32 s2 (i tried even others) and when i enable the usermod everything works but when i uncheck at

/settings/leds ---> Turn LEDs on after power up/reset: and i restart the esp via gui or unplug the device it doesnt connect again.
in device manager (windows) it is also not shown as COM Port

when i dont enable the usermod and i uncheck it, and restart the device it works.
also when i dont uncheck it and set everything up, it also works.

its just this combination that "breaks" it

--
where exactly can i find what Turn LEDs on after power up/reset: does? i just found the string the file

EDIT:

also after that i cant just flash wled back via visual studio, i need to reflash it via the web installer.
is there a way to delete the user data when flashing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fixed in source This issue is unsolved in the latest release but fixed in master usermod usermod related
Projects
None yet
Development

No branches or pull requests

4 participants
@blazoncek @KrX3D @softhack007 and others