Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTC not waking from Sleep in 2.2.0.6 #1328

Closed
Palomino34 opened this issue Oct 17, 2023 · 0 comments
Closed

RTC not waking from Sleep in 2.2.0.6 #1328

Palomino34 opened this issue Oct 17, 2023 · 0 comments
Assignees
Labels
Milestone

Comments

@Palomino34
Copy link
Contributor

https://forums.ghielectronics.com/t/rtc-not-waking-from-sleep-in-2-2-0-6/24739/23

Special code below can reproduce the issue on SC20260

class Program10
{
    static void Main()
    {
        //RtcController.GetDefault().Now = new DateTime(2000, 1, 1);
        RtcController.GetDefault().Now = new DateTime(2023, 10, 17, 13, 20, 15);
        RtcController.GetDefault().SetChargeMode(BatteryChargeMode.None);

        GpioPin ledDBG = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PH11);

        ledDBG.SetDriveMode(GpioPinDriveMode.Output);
        ledDBG.Write(GpioPinValue.High);
                    
        GpioPin ldr = GpioController.GetDefault().OpenPin(SC20260.GpioPin.PE3);
        ldr.SetDriveMode(GpioPinDriveMode.InputPullUp);
        ldr.ValueChangedEdge = GpioPinEdge.FallingEdge;
        ldr.ValueChanged += (GpioPin sender, GpioPinValueChangedEventArgs e) =>
        {
            Shutdown();
        };
        if (ldr.Read() == GpioPinValue.Low)
        {
            Shutdown();
        }

        Thread.Sleep(1000);

        Power.WakeupEdge = WakeupEdge.Falling;
        DateTime wakeupTime = RtcController.GetDefault().Now.AddSeconds(4);

        Power.Shutdown(false, wakeupTime);
        
        Thread.Sleep(Timeout.Infinite);

        void Shutdown()
        {
            Power.WakeupEdge = WakeupEdge.Falling;
            //Power.Shutdown(false, RtcController.GetDefault().Now.AddHours(24 * 365 * 5));
            Power.Shutdown(false, RtcController.GetDefault().Now.AddSeconds(7 * 24 * 60 * 60 + 10));
            //Power.Shutdown(false, DateTime.MaxValue);

            while (true) ;
        }
    }
}
@Palomino34 Palomino34 added the bug label Oct 17, 2023
@Palomino34 Palomino34 self-assigned this Oct 17, 2023
@Palomino34 Palomino34 added this to the 2.2.0.6200 milestone Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant