@@ -3,7 +3,7 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH};
33use color_eyre:: Result ;
44use context_attribute:: context;
55use framework:: { MainOutput , PerceptionInput } ;
6- use types:: { Ball , CycleTime , Eye , FilteredWhistle , Leds , PrimaryState , Rgb , SensorData } ;
6+ use types:: { Ball , CycleTime , Eye , FilteredWhistle , Leds , PrimaryState , Rgb } ;
77
88pub struct LedStatus {
99 blink_state : bool ,
@@ -17,7 +17,6 @@ pub struct CreationContext {}
1717
1818#[ context]
1919pub struct CycleContext {
20- pub sensor_data : Input < SensorData , "sensor_data" > ,
2120 pub primary_state : Input < PrimaryState , "primary_state" > ,
2221 pub cycle_time : Input < CycleTime , "cycle_time" > ,
2322 pub filtered_whistle : Input < FilteredWhistle , "filtered_whistle" > ,
@@ -148,7 +147,6 @@ impl LedStatus {
148147 at_least_one_ball_data_bottom,
149148 last_ball_data_top_too_old,
150149 last_ball_data_bottom_too_old,
151- context. sensor_data ,
152150 ) ;
153151
154152 let ears = if context. filtered_whistle . is_detected {
@@ -162,8 +160,8 @@ impl LedStatus {
162160 left_ear : ears,
163161 right_ear : ears,
164162 chest,
165- left_foot : Rgb :: DNT_ORANGE ,
166- right_foot : Rgb :: DNT_ORANGE ,
163+ left_foot : Rgb :: GREEN ,
164+ right_foot : Rgb :: GREEN ,
167165 left_eye,
168166 right_eye,
169167 } ;
@@ -178,7 +176,6 @@ impl LedStatus {
178176 at_least_one_ball_data_bottom : bool ,
179177 last_ball_data_top_too_old : bool ,
180178 last_ball_data_bottom_too_old : bool ,
181- sensor_data : & SensorData ,
182179 ) -> ( Eye , Eye ) {
183180 match primary_state {
184181 PrimaryState :: Unstiff => {
@@ -202,9 +199,6 @@ impl LedStatus {
202199 } else {
203200 None
204201 } ;
205-
206- let battery_charge = sensor_data. battery . charge ;
207-
208202 (
209203 Eye {
210204 color_at_0 : ball_color_top
@@ -222,7 +216,7 @@ impl LedStatus {
222216 color_at_315 : ball_color_top
223217 . unwrap_or_else ( || ball_background_color. unwrap_or ( Rgb :: BLACK ) ) ,
224218 } ,
225- get_filled_eye ( battery_charge , Rgb :: DNT_ORANGE ) ,
219+ Eye :: default ( ) ,
226220 )
227221 }
228222 }
@@ -286,32 +280,3 @@ impl LedStatus {
286280 }
287281 }
288282}
289-
290- fn get_filled_eye ( battery_charge : f32 , color : Rgb ) -> Eye {
291- let mut eye = Eye :: default ( ) ;
292-
293- eye. color_at_0 = color;
294- if battery_charge >= 0.125 {
295- eye. color_at_45 = color;
296- }
297- if battery_charge >= 0.250 {
298- eye. color_at_90 = color;
299- }
300- if battery_charge >= 0.375 {
301- eye. color_at_135 = color;
302- }
303- if battery_charge >= 0.5 {
304- eye. color_at_180 = color;
305- }
306- if battery_charge >= 0.625 {
307- eye. color_at_225 = color;
308- }
309- if battery_charge >= 0.750 {
310- eye. color_at_270 = color;
311- }
312- if battery_charge >= 0.875 {
313- eye. color_at_315 = color;
314- }
315-
316- eye
317- }
0 commit comments