mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-16 21:42:06 +08:00
a43fc920b5
# Conflicts: # .github/workflows/prebuilt.yaml # common/api.py # common/params_keys.h # opendbc_repo # selfdrive/controls/controlsd.py # selfdrive/controls/lib/desire_helper.py # selfdrive/modeld/modeld.py # selfdrive/ui/mici/layouts/settings/device.py # selfdrive/ui/soundd.py # system/athena/athenad.py # system/athena/registration.py # system/hardware/hardwared.py # system/loggerd/deleter.py # system/manager/manager.py # system/manager/process_config.py # system/sentry.py # system/updated/updated.py # tinygrad_repo # tools/scripts/uiview.py
28 lines
946 B
Python
Executable File
28 lines
946 B
Python
Executable File
#!/usr/bin/env python3
|
|
import argparse
|
|
import multiprocessing
|
|
from openpilot.common.hardware import HARDWARE
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description='Control power saving mode')
|
|
parser.add_argument('--enable', action='store_true', help='Enable power saving mode')
|
|
parser.add_argument('--disable', action='store_true', help='Disable power saving mode')
|
|
args = parser.parse_args()
|
|
|
|
if args.enable and args.disable:
|
|
parser.error("Cannot specify both --enable and --disable")
|
|
elif not (args.enable or args.disable):
|
|
parser.error("Must specify either --enable or --disable")
|
|
|
|
print(f"Number of CPU cores available before: [{multiprocessing.cpu_count()}]")
|
|
HARDWARE.set_power_save(args.enable)
|
|
|
|
state = "enabled" if args.enable else "disabled"
|
|
print(f"Power save mode set to: [{state}]")
|
|
print(f"Number of CPU cores available now: [{multiprocessing.cpu_count()}]")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|