Skip to content

Button variable initialisation error #11

@phant0mias

Description

@phant0mias

Describe the bug

I tried to access a button using "M5StamPLC.BtnA". BtnA was a nullptr, but M5Unfied.BtnA was valid

The reason for the nullptr is the way how "M5StamPLC.BtnA" is initialized.

The static instances of M5StamPlc and M5Unified contain a variable BtnA. In M5Unfied BtnA is assigned to an internal structure, In M5StamPlc BtnA is assigned to M5Unfied.BtnA.
THis is working if the initialisation order is first M5Unified an then M5Stamplc. But this cannot be guaranteed., it depends on the project and compiler.

To reproduce

i used platformio the latest version

m5stack/M5StamPLC@1.1.0
m5stack/M5Unified@0.2.8

Expected behavior

Variable should not be a nullptr

Screenshots

No response

Environment

  • OS: Windows 10
  • IDE &IDE Version: latest version
  • Repository Version:

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • My report contains all necessary details

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