Skip to content

Conflict with M5Unified #2

@Kabron287

Description

@Kabron287

Describe the bug

Device: M5StickS3, Arduino 2.3.8

Although I followed the recommendation:
#include <M5Unified.h> // ✓ must come first
#include <M5PM1.h>

Some M5Unified Power function works incorrect.
I.e.:

M5.Power.getExtOutput() - allways false;
M5.Power.getBatteryLevel() - allways 0
M5.Power.getVBUSVoltage() - allways 0
M5.Power.getBatteryVoltage() - allways 0

Excluding M5PM1 solve the problem.

To reproduce

#include <M5Unified.h>
//#include <M5PM1.h> // works if commented out

void powerStatus(){ // M5Unified lib
M5.Display.setCursor(0, 50);
M5.Display.printf("ExtOut: %s\n\r", M5.Power.getExtOutput() ? "On" : "Off");
M5.Display.printf("UsbOut: %s\n\r", M5.Power.getUsbOutput() ? "On" : "Off");
M5.Display.printf("BatLev: %d\n\r", M5.Power.getBatteryLevel());
M5.Display.printf("VBUS_U: %.2f\n\r", (float)M5.Power.getVBUSVoltage()/1000.0);
M5.Display.printf("Batt_U: %.2f\n\r", (float)M5.Power.getBatteryVoltage()/1000.0);
}

Expected behavior

void powerStatus(){ // M5Unified lib
M5.Display.setCursor(0, 50);
M5.Display.printf("ExtOut: %s\n\r", M5.Power.getExtOutput() ? "On" : "Off");
M5.Display.printf("UsbOut: %s\n\r", M5.Power.getUsbOutput() ? "On" : "Off");
M5.Display.printf("BatLev: %d\n\r", M5.Power.getBatteryLevel());
M5.Display.printf("VBUS_U: %.2f\n\r", (float)M5.Power.getVBUSVoltage()/1000.0);
M5.Display.printf("Batt_U: %.2f\n\r", (float)M5.Power.getBatteryVoltage()/1000.0);
}

Screenshots

No response

Environment

Windows 1
Arduino 2.3.8

  • Repository Version: 1.05

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