@@ -124,6 +124,51 @@ impl Crazyflie {
124124 } )
125125 }
126126
127+ /// Power off the STM32 and deck subsystem
128+ ///
129+ /// Cuts power to the STM32 and decks while keeping the nRF51 powered.
130+ /// The Crazyflie can be powered on again using `power_on_stm32_domain()`.
131+ /// This does not require a full connection.
132+ #[ staticmethod]
133+ #[ gen_stub( override_return_type( type_repr = "collections.abc.Coroutine[typing.Any, typing.Any, None]" ) ) ]
134+ fn power_off_stm32_domain < ' py > ( py : Python < ' py > , link_context : & LinkContext , uri : String ) -> PyResult < Bound < ' py , PyAny > > {
135+ let inner = link_context. inner . clone ( ) ;
136+ pyo3_async_runtimes:: tokio:: future_into_py ( py, async move {
137+ crazyflie_lib:: Crazyflie :: power_off_stm32_domain ( & inner, & uri) . await . map_err ( to_pyerr) ?;
138+ Ok ( ( ) )
139+ } )
140+ }
141+
142+ /// Power on the STM32 and deck subsystem
143+ ///
144+ /// Powers the STM32 and decks back on after a `power_off_stm32_domain()`.
145+ /// This does not require a full connection.
146+ #[ staticmethod]
147+ #[ gen_stub( override_return_type( type_repr = "collections.abc.Coroutine[typing.Any, typing.Any, None]" ) ) ]
148+ fn power_on_stm32_domain < ' py > ( py : Python < ' py > , link_context : & LinkContext , uri : String ) -> PyResult < Bound < ' py , PyAny > > {
149+ let inner = link_context. inner . clone ( ) ;
150+ pyo3_async_runtimes:: tokio:: future_into_py ( py, async move {
151+ crazyflie_lib:: Crazyflie :: power_on_stm32_domain ( & inner, & uri) . await . map_err ( to_pyerr) ?;
152+ Ok ( ( ) )
153+ } )
154+ }
155+
156+ /// Power off the Crazyflie completely
157+ ///
158+ /// Powers off the nRF51, STM32, and deck subsystem. Equivalent to
159+ /// pressing the power button. The Crazyflie cannot be woken up via
160+ /// radio after this.
161+ /// This does not require a full connection.
162+ #[ staticmethod]
163+ #[ gen_stub( override_return_type( type_repr = "collections.abc.Coroutine[typing.Any, typing.Any, None]" ) ) ]
164+ fn power_off_all < ' py > ( py : Python < ' py > , link_context : & LinkContext , uri : String ) -> PyResult < Bound < ' py , PyAny > > {
165+ let inner = link_context. inner . clone ( ) ;
166+ pyo3_async_runtimes:: tokio:: future_into_py ( py, async move {
167+ crazyflie_lib:: Crazyflie :: power_off_all ( & inner, & uri) . await . map_err ( to_pyerr) ?;
168+ Ok ( ( ) )
169+ } )
170+ }
171+
127172 /// Disconnect from the Crazyflie
128173 #[ gen_stub( override_return_type( type_repr = "collections.abc.Coroutine[typing.Any, typing.Any, None]" ) ) ]
129174 fn disconnect < ' py > ( & self , py : Python < ' py > ) -> PyResult < Bound < ' py , PyAny > > {
0 commit comments