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

Power off improvements #265

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Commits on Sep 7, 2024

  1. pbio/sys: move VCC power off to after shutdown

    Up to now, the VCC power off was done when shutdown was requested. This
    will cause external sensors to power off. Users may see this and assume
    that the hub is now off. However, the hub is still busy with the
    shutdown process, e.g. writing to flash memory. So we don't want the
    user to release the power button yet.
    
    Instead, move the VCC power off to after the hub has finished everything
    and it is safe to power off.
    
    This lets us remove the sys/io_ports.c and sys/io_ports.h files. The
    function is renamed to pbdrv_ioport_power_off() to be consistent with
    pbdrv_reset_power_off().
    dlech committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    66c3ba3 View commit details
    Browse the repository at this point in the history
  2. pbio/drv/ioport/ioport_pup: add PBDRV_CONFIG_IOPORT_PUP_QUIRK_SHUTDOWN

    Add a new PBDRV_CONFIG_IOPORT_PUP_QUIRK_SHUTDOWN configuration flag for
    the ioport_pup driver. This flag is used to indicate that the driver
    that special handling of the I/O port VCC pin is needed during shutdown.
    
    We already had such a quirk in place, but it was enabled at all times
    on all hubs. This improves the situation by only enabling the quirk on
    hubs that need it. Also, on hubs that needed it, we now only enable the
    quirk when the button is not pressed. This has the desired effect of
    turning off sensors before the user released the button so that it looks
    like the hub is really off. This way it will be more clear to the user
    that they can release the button because the hub is "off".
    dlech committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    b85a8d4 View commit details
    Browse the repository at this point in the history
  3. pbio/sys/main: turn off all motor outputs on shutdown

    In most cases, pbio_stop_all() was already stopping motors, but it
    doesn't turn off motor outputs for non-motor devices that need extra
    power. This was causing the SPIKE Light Matrix to turn on all green LEDs
    when any hub was turned off.
    
    This fix is a bit of a hack since it is going behind the back of the
    higher-level I/O port stuff, but it works for now.
    dlech committed Sep 7, 2024
    Configuration menu
    Copy the full SHA
    91c5940 View commit details
    Browse the repository at this point in the history