1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Add suspend mode

Discussion in 'Development' started by Portisch, 18 April 2019.

  1. Portisch

    Portisch New Member

    Messages:
    14
    Hi,

    I currently trying to add support of suspend mode for hyperion.ng.
    I added two signals in hyperion, one for suspend, one for resume.
    On suspend I turn off the leds, on resume I turn it on:

    Code:
    CoreELEC:~/.config/sleep.d # ./hyperion-suspend.power pre
    Going to suspend...
    [hyperiond ComponentRegister] <DEBUG> <ComponentRegister.cpp:67:componentStateChanged()> LED device: disabled
    CoreELEC:~/.config/sleep.d # ./hyperion-suspend.power post
    Resume from suspend...
    [hyperiond ComponentRegister] <DEBUG> <ComponentRegister.cpp:67:componentStateChanged()> LED device: enabled
    But the leds are remaining on!? They are not getting updated but they are still on. When I send the resume signal the leds are chaninging like before.

    This line should be called because of the signal:
    https://github.com/hyperion-project...0836ec1ac9/libsrc/leddevice/LedDevice.cpp#L42

    I just call:
    Code:
    _hyperion(Hyperion::getInstance();
    _hyperio->handleComponentState(hyperion::COMP_LEDDEVICE, true/false);
    Why are the leds not off (black)?
     
  2. TPmodding

    TPmodding Administrator Staff Member Administrator

    Messages:
    1,372
    Hardware:
    RPi1/Zero, RPi2, RPi3, +Arduino, +nodeMCU/ESP8266
    do you just stop to write to leds or do you send all black signal?
     
  3. Portisch

    Portisch New Member

    Messages:
    14
    It looks like it is just stopping. But this line should send black to the leds, isn't it?
    https://github.com/hyperion-project...1ac9/libsrc/leddevice/LedDevice.cpp#L104-L107

    EDIT:
    I guess I found it. It looks like it get set to black for one time, but after this it get reset to the last frame:
    Code:
    [hyperiond LEDDEVICE] <DEBUG> <LedDeviceAdalight.cpp:94:write()> LedDeviceAdalight writebytes 231: 416461004A1F000708000A0B000E10001013001014000F14000E15000D16000D16000D18000F19000F1B00101B000C1402040502040502030402030402030402030302030402030402030405060702030407090A020304050607040506020304002C41002C41050506020303020303020303010202010202010203010303060809050707000D10051012000B0E000B0E000C11040F14000B1200090E050F1400090F00070B000609000406000304000304000204020304090B0C01030300050800050900060900060A00070A00070A00080A00080A00080A000809000709000708000607000607
    [hyperiond ComponentRegister] <DEBUG> <ComponentRegister.cpp:67:componentStateChanged()> LED device: disabled
    [hyperiond LEDDEVICE] <DEBUG> <LedDeviceAdalight.cpp:94:write()> LedDeviceAdalight writebytes 231: 416461004A1F000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
    [hyperiond LEDDEVICE] <DEBUG> <LedDeviceAdalight.cpp:94:write()> LedDeviceAdalight writebytes 231: 416461004A1F000708000A0B000E10001013001014000F14000E15000D16000D16000D18000F19000F1B00101B000C1402040502040502030402030402030402030302030402030402030405060702030407090A020304050607040506020304002C41002C41050506020303020303020303010202010202010203010303060809050707000D10051012000B0E000B0E000C11040F14000B1200090E050F1400090F00070B000609000406000304000304000204020304090B0C01030300050800050900060900060A00070A00070A00080A00080A00080A000809000709000708000607000607
    EDIT2:
    The smoothing have to be disabled also:
    Code:
    void signal_handler(const int signum)
    {
        /// Hyperion instance
        Hyperion* _hyperion = Hyperion::getInstance();
    
        if(signum == SIGCHLD)
        {
            // only quit when a registered child process is gone
            // currently this feature is not active ...
            return;
        }
        else if (signum == SIGUSR1)
        {
        if (_hyperion != nullptr)
        {
          _hyperion->setComponentState(hyperion::COMP_SMOOTHING, false);
          _hyperion->setComponentState(hyperion::COMP_LEDDEVICE, false);
        }
            return;
        }
        else if (signum == SIGUSR2)
        {
        if (_hyperion != nullptr)
        {
          _hyperion->setComponentState(hyperion::COMP_LEDDEVICE, true);
          _hyperion->setComponentState(hyperion::COMP_SMOOTHING, true);
        }
            return;
        }
        QCoreApplication::quit();
    
        // reset signal handler to default (in case this handler is not capable of stopping)
        signal(signum, SIG_DFL);
    }
    Then it should work...
     
    Last edited: 19 April 2019
  4. Portisch

    Portisch New Member

    Messages:
    14
    • Like Like x 1