Muon Power Diagnostics "unknown"

I've been testing out some M404's with the Muon carrier, and I've noticed that the "power" diagnostics are not working properly for me.

I have a lipo plugged into the battery port, and a 6V panel into the DC in port.

The charge light is illuminated.

Here are the values from the spark/device/diagnostics/update payload:

"power":{
    "battery":{
        "charge":{
            "err":-210
        }
        "state":"unknown"
    }
    "source":"unknown"
}

I also get zero's when I use the great DiagnosticsHelper library from RK:

  PowerSource = DiagnosticsHelper::getValue(DIAG_ID_SYSTEM_POWER_SOURCE);
  BatteryState = DiagnosticsHelper::getValue(DIAG_ID_SYSTEM_BATTERY_STATE);

Reading the battery voltage works as expected, however the SOC value is -1.

    FuelGauge fuel;
    BattV = fuel.getVCell();
    BattSOC = System.batteryCharge();

I recall reading somewhere that I may need to tell the Muon that we have the PM-BAT module attached, is that what I'm missing?

Thanks!

My guess is that the PMIC was not enabled on your Muon for some reason. It should have been enabled during setup, but this should do it manually. It's only necessary do to this once; the setting should be persistent.

void setup() {
    SystemPowerConfiguration powerConfig = System.getPowerConfiguration();
    powerConfig
      .feature(SystemPowerFeature::PMIC_DETECTION)
      .auxiliaryPowerControlPin(D7)
      .interruptPin(A7);
    System.setPowerConfiguration(powerConfig);
}

Hmm.. putting this in setup has not affected the result. Running deviceOS 5.9.0

Still getting accurate Battery Voltage.