Skip to content

Commit

Permalink
feat: Introduce new setting gallia.power_cycle_sleep_after
Browse files Browse the repository at this point in the history
The powercycle works like this:

1. power off
2. wait for `gallia.power_cycle_sleep` time
3. power on
4. wait for `gallia.power_cycle_sleep_after` time

Step 4 was hard coded to 2 secs before this change.
  • Loading branch information
rumpelsepp committed Jan 27, 2023
1 parent 4708238 commit 9df430d
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/gallia/command/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,8 @@ async def setup(self, args: Namespace) -> None:
self.power_supply = await PowerSupply.connect(args.power_supply)
if args.power_cycle is True:
await self.power_supply.power_cycle(
args.power_cycle_sleep, lambda: asyncio.sleep(2)
args.power_cycle_sleep,
args.power_cycle_sleep_after,
)
elif args.power_cycle is True:
self.parser.error("--power-cycle needs --power-supply")
Expand Down Expand Up @@ -598,6 +599,15 @@ def configure_class_parser(self) -> None:
metavar="SECs",
type=float,
default=self.config.get_value("gallia.scanner.power_cycle_sleep", 5.0),
help="time to sleep after the power-off",
)
group.add_argument(
"--power-cycle-sleep-after",
metavar="SECs",
type=float,
default=self.config.get_value(
"gallia.scanner.power_cycle_sleep_after", 2.0
),
help="time to sleep after the power-cycle",
)

Expand Down

0 comments on commit 9df430d

Please sign in to comment.