@@ -13,7 +13,7 @@ use gilrs::{Axis, Button, Gamepad, GamepadId, Gilrs};
1313use serde_json:: { json, Value } ;
1414use types:: step:: Step ;
1515
16- use crate :: { nao:: Nao , panel:: Panel , value_buffer:: BufferHandle } ;
16+ use crate :: { nao:: Nao , panel:: { Panel , PanelCreationContext } , value_buffer:: BufferHandle } ;
1717
1818pub struct RemotePanel {
1919 nao : Arc < Nao > ,
@@ -22,10 +22,11 @@ pub struct RemotePanel {
2222 bg_running : Arc < AtomicBool > ,
2323 bg_handle : Option < JoinHandle < ( ) > > ,
2424}
25- impl Panel for RemotePanel {
25+ impl < ' a > Panel < ' a > for RemotePanel {
2626 const NAME : & ' static str = "Remote" ;
2727
28- fn new ( nao : Arc < Nao > , _value : Option < & Value > ) -> Self {
28+ fn new ( context : PanelCreationContext ) -> Self {
29+ let nao = context. nao . clone ( ) ;
2930 let enabled = Arc :: new ( AtomicBool :: new ( false ) ) ;
3031 let latest_step = nao. subscribe_value ( "parameters.remote_control_parameters.walk" ) ;
3132 let bg_running = Arc :: new ( AtomicBool :: new ( true ) ) ;
@@ -36,9 +37,9 @@ impl Panel for RemotePanel {
3637
3738 let handle = thread:: spawn ( move || {
3839 let mut gilrs = match Gilrs :: new ( ) {
39- Ok ( g ) => g ,
40- Err ( e ) => {
41- eprintln ! ( "failed to init gilrs in bg thread: {e }" ) ;
40+ Ok ( gilrs ) => gilrs ,
41+ Err ( error ) => {
42+ eprintln ! ( "failed to init gilrs in bg thread: {error }" ) ;
4243 return ;
4344 }
4445 } ;
0 commit comments