Skip to content

In 0.15.0-b7 and -b6, the "release" is always returned as 1 #4260

Closed

Description

@Moustachauve

What happened?

Release is always 1 instead of ESP32 or whatever should be needed.

To Reproduce Bug

  1. Download the release version from Github for 0.15.0-b7-ESP32.bin
  2. flash it to an esp32
  3. go to [ipAddress]/json/info
  4. notice the release field is always 1

Expected Behavior

the release field should be ESP32.

Install Method

Binary from WLED.me

What version of WLED?

WLED 0.15.0-b7 1 (ESP32-D0WDQ5 build 2410270)

Which microcontroller/board are you seeing the problem on?

ESP32

Relevant log/trace output

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. Moustachauve commented on Nov 8, 2024

    @Moustachauve
    ContributorAuthor

    I didn't try just manually building the release on my side, maybe they just need to be rebuilt with the correct flags in platformIO? Maybe the person that built them had an override or something.

  2. added
    confirmed
    on Nov 8, 2024
  3. softhack007 commented on Nov 8, 2024

    @softhack007
    Member

    Hi @Moustachauve,

    I've just tried it, and indeed the firmware WLED_0.15.0-b7_ESP32.bin shows a wrong release string:

    image

    {
        "ver": "0.15.0-b7",
        "vid": 2410270,
        "cn": "Kōsen",
        "release": "1",

    While WLED_0.15.0-b7_ESP32_WROVER.bin has the correct info

    image

    {
        "ver": "0.15.0-b7",
        "vid": 2410270,
        "cn": "Kōsen",
        "release": "ESP32_WROVER",
  4. Moustachauve commented on Nov 8, 2024

    @Moustachauve
    ContributorAuthor

    Oh! Some of them work. I tried with ESP8266 binary and it was also showing a 1, so not all of them are incorect.

  5. netmindz commented on Nov 23, 2024

    @netmindz
    Member

    It is based on the WLED_RELEASE_NAME define, which is also used to define the name of the output bin by reading this define with _get_cpp_define_value in output_bins.py

    Therefore I think the value is being set correctly as the define, but is failing to then be properly read into releaseString in wled.h in some cases.

    I don't think it's anything to do with xml.cpp as all the version and release is single replacement

     `d.getElementsByClassName("sip")[0].innerHTML = "WLED 0.15.0-b7<br>1<br>(ESP32-D0WDQ6 build 2410270)";
    

    `

  6. netmindz commented on Nov 23, 2024

    @netmindz
    Member

    I think I've worked out what is wrong, just confirming fix

  7. netmindz commented on Nov 23, 2024

    @netmindz
    Member

    So the issue is that anytime WLED_RELEASE_NAME's value matches the name of another constant, then we don't see the value of WLED_RELEASE_NAME but the expanded value of the macro of the same name, so ESP32 has the value of 1 so hence why we see 1

    I am unsure if this is something about how this line works

    WLED_GLOBAL char releaseString[] _INIT(TOSTRING(WLED_RELEASE_NAME)); // somehow this will not work if using "const char releaseString[]

    Or if it's part of the actual build process that is doing the expanding

    I have tried using WLED_RELEASE_NAME="ESP32" and WLED_RELEASE_NAME='ESP32' but both suffer the same fate, using a value that can't expand, e.g ESP32zz works as expected

  8. willmmiles commented on Nov 23, 2024

    @willmmiles
    Member

    Try replacing TOSTRING with STRINGIFY. IIRC the difference between the two is that TOSTRING performs recursive macro expansion, but STRINGIFY doesn't.

    That said, I think best practices would be to ensure the define is always a literal right from the getgo - eg. -D WLED_RELEASE_NAME=\"ESP32\" - instead of using STRINGIFY at all.

  9. netmindz commented on Nov 23, 2024

    @netmindz
    Member

    Try replacing TOSTRING with STRINGIFY. IIRC the difference between the two is that TOSTRING performs recursive macro expansion, but STRINGIFY doesn't.

    That said, I think best practices would be to ensure the define is always a literal right from the getgo - eg. -D WLED_RELEASE_NAME=\"ESP32\" - instead of using STRINGIFY at all.

    I tried your suggestion of STRINGIFY, but then we just get no expansion at all, so we see "WLED_RELEASE_NAME" as release

  10. softhack007 commented on Nov 23, 2024

    @softhack007
    Member

    Interesting find, and totally makes sense 👍
    I think it's best to add this to our toDo list for 0.15.0-RC1 #4287

    • either finding a solution that avoids inner macro expansion
    • or by putting release name into \" quotes in platformIO.ini, and checking if the python scripts for the pio build need to be adjusted to work with quoted release names.
  11. netmindz commented on Nov 23, 2024

    @netmindz
    Member

    Swapping the release name to already have the quotes is tricky as we are defining it as a command line arg with -D, so it does not behave in the same way as say DEFAULT_OTA_PASS

    i.e

    #define WLED_FOO "ESP32"
    WLED_GLOBAL char releaseString[] _INIT(WLED_FOO); // somehow this will not work if using "const char releaseString[]
    
    

    works, however

    -D WLED_RELEASE_NAME="ESP32" with WLED_GLOBAL char releaseString[] _INIT(WLED_RELEASE_NAME); does not, but -D WLED_RELEASE_NAME=\"ESP32\" does

  12. added
    fixed in source
    on Nov 24, 2024
  13. self-assigned this
    on Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugconfirmedfixed in source

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions