From 6027d4153a50d966bcfa3fd88c007dec7749c566 Mon Sep 17 00:00:00 2001 From: kleponijo Date: Sun, 5 Jul 2026 19:15:54 +0700 Subject: [PATCH] ok --- .../wind_speed/blocs/wind_speed_bloc.dart | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart index 03d41e5..3b0c48f 100644 --- a/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart +++ b/lib/screens/monitoring/wind_speed/blocs/wind_speed_bloc.dart @@ -109,7 +109,6 @@ class WindSpeedBloc extends Bloc { _WindSpeedRealtimeUpdated event, Emitter emit, ) { - // Guard: abaikan data jika windweg 0 dan pulse 0 (ESP tidak kirim data nyata) if (event.data.windwegKm == 0 && event.data.totalPulse == 0) { emit(state.copyWith( currentSpeed: 0, @@ -118,27 +117,12 @@ class WindSpeedBloc extends Bloc { return; } - final updated = List.from(state.dailySpeeds); - final index = DateTime.now().hour; - double newValue = event.data.speed; + final double speed = event.data.speed; - if (index < updated.length) { - final lastValue = updated[index]; - if (lastValue != 0) { - if ((newValue - lastValue).abs() > 15) { - newValue = lastValue; - } else { - newValue = (lastValue + newValue) / 2; - } - } - updated[index] = newValue.clamp(0, 100); - } - - _emitWindAlert(newValue); + _emitWindAlert(speed); emit(state.copyWith( - currentSpeed: newValue, - dailySpeeds: updated, - alertLevel: _getAlertLevel(newValue), + currentSpeed: speed, + alertLevel: _getAlertLevel(speed), )); }