Monitor One and enableIoCanPowerSleep

Hi,
I have spent a good amount of time trying to figure out how to control the CAN power during sleep on Monitor One.
I will leave many details out to avoid additional confusion, but the net result is as follows.

Putting the following code in setup() results in CAN power turned "off" during sleep:

    EdgeConfiguration config;
    config.disableCharging(false)
          .enableFastLock(true)
          .enableIoCanPowerSleep(true) // enable 5V can power during sleep
          .enableIoCanPower(true);

   Edge::instance().init(config);

while this results in the CAN power staying "on" during sleep

    EdgeConfiguration config;
    config.disableCharging(false)
          .enableFastLock(true)
          .enableIoCanPowerSleep(false) // disable 5V can power during sleep
          .enableIoCanPower(true);

   Edge::instance().init(config);

So the result is opposite to what is expected. The OS is 6.1.0

My actual goal is to be able to decide whether CAN power should stay "on" or be turned "off" based on the conditions determined in the sleepPrepareCallback. Is it at all possible?

Thanks!

Yes, it appears that you can do that. It looks like the prepare sleep callback is called before the flag is tested.

To answer my own question.
Simply use

Edge::instance().enableIoCanPower(true/false);

In the wakeCallback and sleepPrepareCallback

Problem solved!

The first issue is still a mystery, but not really a roadblock once it is known that true is false and false is true :wink:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.