Skip to content

Bug: ENV_INCLUDE_GPS — #ifdef vs #if inconsistency breaks =0 builds #2549

@flumiii

Description

@flumiii

Hi
I tried to build lilygo_techo_lite companion radio with -D ENV_INCLUDE_GPS=0 (since I need the pins for UART inputs) and it fails because two files test the macro differently:

variants/lilygo_techo_lite/target.cpp:15 uses #ifdef ENV_INCLUDE_GPS → true whenever defined, even if value is 0
src/helpers/sensors/EnvironmentSensorManager.h:31,44,52 uses #if ENV_INCLUDE_GPS → only true if non-zero
So with =0, target.cpp ends up calling the EnvironmentSensorManager(nmea) constructor, but the header only compiled in the no-arg version → compile error.

Repro: add an env that extends LilyGo_T-Echo-Lite and add -D ENV_INCLUDE_GPS=0, then pio run:

error: no matching function for call to
'EnvironmentSensorManager::EnvironmentSensorManager(MicroNMEALocationProvider&)'

My Workaround: use -UENV_INCLUDE_GPS (glued, no space) instead of =0. Works but unexpected.

Suggested fix: change target.cpp to #if ENV_INCLUDE_GPS so it matches the header. The base env already passes =1, which suggests a numeric toggle was the intent. Same fix probably needed in other variants' target.cpp.

Is this the intended fix or did you want presence-only semantics?

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