File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import 'package:fl_chart/fl_chart.dart';
66import 'package:geolocator/geolocator.dart' ;
77import 'package:intl/intl.dart' ;
88
9+ import '../communication/science_lab.dart' ;
910import '../l10n/app_localizations.dart' ;
1011import '../others/logger_service.dart' ;
1112import 'dust_sensor_config_provider.dart' ;
@@ -90,6 +91,8 @@ class DustSensorStateProvider extends ChangeNotifier {
9091 onSensorError = onError;
9192
9293 try {
94+ ScienceLab scienceLab = getIt.get <ScienceLab >();
95+
9396 _startTime = DateTime .now ().millisecondsSinceEpoch / 1000.0 ;
9497
9598 _timeTimer = Timer .periodic (const Duration (seconds: 1 ), (timer) {
@@ -100,10 +103,11 @@ class DustSensorStateProvider extends ChangeNotifier {
100103 });
101104
102105 int interval = _configProvider? .config.updatePeriod ?? 1000 ;
103- _dustTimer = Timer . periodic ( Duration (milliseconds : interval), (timer) {
104-
105- /// TO DO
106+ _dustTimer =
107+ Timer . periodic ( Duration (milliseconds : interval), (timer) async {
108+ double voltageReading = await scienceLab. getVoltage ( "CH1" , 1 );
106109
110+ _currentDust = voltageReading;
107111 notifyListeners ();
108112 });
109113 } catch (e) {
You can’t perform that action at this time.
0 commit comments