Skip to content

crude hack in presets.cpp #2681

Closed
Closed

Description

@softhack007

I just saw that preset.cpp contains a somewhat 'crude hack' - see below.

It might be dangerous:

  • the observation that user code runs on core 1, while system events (like network requests) run on core 0 may not always be true.
  • core allocation can be changed at compile time; try adding -DARDUINO_RUNNING_CORE=0 -DARDUINO_EVENT_RUNNING_CORE=1 in your platformio.ini
  • there are ESP32 chips without second core - both"classic" ESP32 and some of the newer "-C3" and "-S2" variants sometimes have only one single core. On single core, the variable core will always have the value false (i.e. 0).

Please consider if there are other options to (more reliably) detect where a file request came from.

https://github.com/Aircoookie/WLED/blob/19c8b4fe2d0d86887d49abd5c965fd1d46502679/wled00/presets.cpp#L14-L24

Activity

  1. blazoncek commented on May 30, 2022

    @blazoncek
    Contributor

    The upcoming changes I proposed introduce a asynchronous preset loading which always happens within main loop().
    Unfortunately this leads to all sorts of different problems (making some presets with HTTP API no longer work correctly and UI not getting a correct preset ID on return, etc).
    If you want to test please use my fork, dev branch.

  2. linked a pull request that will close this issueFull blazoncek fork merge #2610on Jul 12, 2022
  3. softhack007 commented on Aug 10, 2022

    @softhack007
    MemberAuthor

    In SR WLED, we found a solution by

    1. using a patched version of Lorol LittleFS, which is more thread-safe (https://github.com/softhack007/LITTLEFS-threadsafe.git#master)

    2. replacing the "coreID" checks with a check for task names:
      https://github.com/atuline/WLED/blob/153e29b927f2afaec4fcd96f4cbe2c71506eeab0/wled00/presets.cpp#L13-L31

    image

    Users feedback was very positive after these changes. No more "lost preset" problems seen.

  4. softhack007 commented on Sep 21, 2022

    @softhack007
    MemberAuthor

    Solved in 0_14 branch by using new async presets implementation. Can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions