diff --git a/doc/api/hubs/cityhub.rst b/doc/api/hubs/cityhub.rst index cdd3b7c3..95d4aff2 100644 --- a/doc/api/hubs/cityhub.rst +++ b/doc/api/hubs/cityhub.rst @@ -25,11 +25,11 @@ City Hub .. rubric:: System control - .. automethod:: pybricks.hubs::MoveHub.system.reset + .. automethod:: pybricks.hubs::CityHub.system.set_stop_button - .. automethod:: pybricks.hubs::MoveHub.system.reset_reason + .. automethod:: pybricks.hubs::CityHub.system.shutdown - .. automethod:: pybricks.hubs::MoveHub.system.set_stop_button + .. automethod:: pybricks.hubs::CityHub.system.reset_reason Status light examples --------------------- diff --git a/doc/api/hubs/movehub.rst b/doc/api/hubs/movehub.rst index 6ea7228d..8fdf9d99 100644 --- a/doc/api/hubs/movehub.rst +++ b/doc/api/hubs/movehub.rst @@ -33,11 +33,11 @@ Move Hub .. rubric:: System control - .. automethod:: pybricks.hubs::MoveHub.system.reset + .. automethod:: pybricks.hubs::MoveHub.system.set_stop_button - .. automethod:: pybricks.hubs::MoveHub.system.reset_reason + .. automethod:: pybricks.hubs::MoveHub.system.shutdown - .. automethod:: pybricks.hubs::MoveHub.system.set_stop_button + .. automethod:: pybricks.hubs::MoveHub.system.reset_reason Status light examples --------------------- diff --git a/doc/api/hubs/primehub.rst b/doc/api/hubs/primehub.rst index 9fe5611b..5478fd25 100644 --- a/doc/api/hubs/primehub.rst +++ b/doc/api/hubs/primehub.rst @@ -83,11 +83,11 @@ Prime Hub / Inventor Hub .. rubric:: System control - .. automethod:: pybricks.hubs::MoveHub.system.reset + .. automethod:: pybricks.hubs::PrimeHub.system.set_stop_button - .. automethod:: pybricks.hubs::MoveHub.system.reset_reason + .. automethod:: pybricks.hubs::PrimeHub.system.shutdown - .. automethod:: pybricks.hubs::MoveHub.system.set_stop_button + .. automethod:: pybricks.hubs::PrimeHub.system.reset_reason .. note:: The examples below use the ``PrimeHub`` class. The examples work fine on both hubs because they are the identical. If you prefer, you can diff --git a/doc/api/hubs/technichub.rst b/doc/api/hubs/technichub.rst index b36d074f..849f7c2f 100644 --- a/doc/api/hubs/technichub.rst +++ b/doc/api/hubs/technichub.rst @@ -39,11 +39,11 @@ Technic Hub .. rubric:: System control - .. automethod:: pybricks.hubs::MoveHub.system.reset + .. automethod:: pybricks.hubs::TechnicHub.system.set_stop_button - .. automethod:: pybricks.hubs::MoveHub.system.reset_reason + .. automethod:: pybricks.hubs::TechnicHub.system.shutdown - .. automethod:: pybricks.hubs::MoveHub.system.set_stop_button + .. automethod:: pybricks.hubs::TechnicHub.system.reset_reason Status light examples --------------------- diff --git a/pybricks/_common.py b/pybricks/_common.py index 3d9b0ee8..9449f40e 100644 --- a/pybricks/_common.py +++ b/pybricks/_common.py @@ -10,25 +10,6 @@ class System: """System control actions for a hub.""" - def reset(self, action): - """Shuts the hub down and optionally reboots. - - Arguments: - action (int): Choose ``0`` to shut down, ``1`` to reboot, - or ``2`` to enter firmware update mode. - """ - pass - - def reset_reason(self): - """Gets the reason for the most recent reset. - - Returns: - int: Gives ``0`` if the hub was shut down, or ``1`` if the hub - rebooted. It gives ``2`` if the watchdog timer expired, which - indicates a firmware issue. - """ - pass - def set_stop_button(self, button): """Sets the button or button combination that stops a running script. @@ -44,6 +25,23 @@ def set_stop_button(self, button): """ pass + def shutdown(self): + """Stops your program and shuts the hub down.""" + pass + + def reset_reason(self): + """Finds out how and why the hub (re)booted. This can be useful to + diagnose some problems. + + Returns: + int: Returns ``0`` if the hub was previously powered off + normally. Returns ``1`` if the hub rebooted automatically, like + after a firmware update. Returns ``2`` if the hub previously + crashed due to a watchdog timeout, which indicates a firmware + issue. + """ + pass + class DCMotor: """Generic class to control simple motors without rotation sensors, such