Skip to content

(discussion) Change how WLED_DISABLE_2D is implemented: don't change functions, just remove 2D effects #5415

@softhack007

Description

@softhack007

Currently when building WLED with -D WLED_DISABLE_2D, all 2D-related code is stubbed out, especially all function prototypes in FX.h are replaced, and different code will be used in functions like setPixelColor(). While this does completely remove any 2D support, its kind of overkill because everywhere in the codebase we find small parts guarded with #ifdnef WLED_DISABLE_2D.

In fact when users want a "build without 2D", it would be sufficient to remove 2D effects (FX.cpp) and the 2D settings menue, while leaving all the functions of the segment class untouched. The linker will any way take care of removing unused functions.

WLED_DISABLE_2D is a historical flag, that was very useful in WLED 0.14 when 2D support was added as a new feature, and only a few users needed it. Today the "2D included" version of WLED has become mainstream - there are no official builds without 2D support, and almost zero testing with non-2D builds. At the same time, non-2D mode always requires special attention when changing source code, and the non-2D replacement code still has some "surprising" behaviour even for experienced maintainers.

IMHO this has become a technical burden, with very limited value for users.

My proposal:

  • Leave #ifdnef WLED_DISABLE_2D intact in FX.cpp so users can still get a build where 2D effects are removed.
  • remove #ifdnef WLED_DISABLE_2D parts everywhere else in the codebase,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions