mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 15:00:40 +00:00
recalc ev on measure
This commit is contained in:
parent
1a73cefa76
commit
a595d5dcd4
1 changed files with 7 additions and 10 deletions
|
@ -33,7 +33,7 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
late IsoValue _iso = _userPreferencesService.iso;
|
late IsoValue _iso = _userPreferencesService.iso;
|
||||||
late NdValue _nd = _userPreferencesService.ndFilter;
|
late NdValue _nd = _userPreferencesService.ndFilter;
|
||||||
late Film _film = _userPreferencesService.film;
|
late Film _film = _userPreferencesService.film;
|
||||||
double _ev = 0.0;
|
double _ev100 = 0.0;
|
||||||
bool _isMeteringInProgress = false;
|
bool _isMeteringInProgress = false;
|
||||||
|
|
||||||
MeteringBloc(
|
MeteringBloc(
|
||||||
|
@ -90,14 +90,12 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
/// doesn't contain currently selected value
|
/// doesn't contain currently selected value
|
||||||
if (!event.equipmentProfileData.isoValues.any((v) => _iso.value == v.value)) {
|
if (!event.equipmentProfileData.isoValues.any((v) => _iso.value == v.value)) {
|
||||||
_userPreferencesService.iso = event.equipmentProfileData.isoValues.first;
|
_userPreferencesService.iso = event.equipmentProfileData.isoValues.first;
|
||||||
_ev = _ev + log2(event.equipmentProfileData.isoValues.first.value / _iso.value);
|
|
||||||
_iso = event.equipmentProfileData.isoValues.first;
|
_iso = event.equipmentProfileData.isoValues.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The same for ND filter
|
/// The same for ND filter
|
||||||
if (!event.equipmentProfileData.ndValues.any((v) => _nd.value == v.value)) {
|
if (!event.equipmentProfileData.ndValues.any((v) => _nd.value == v.value)) {
|
||||||
_userPreferencesService.ndFilter = event.equipmentProfileData.ndValues.first;
|
_userPreferencesService.ndFilter = event.equipmentProfileData.ndValues.first;
|
||||||
_ev = _ev - event.equipmentProfileData.ndValues.first.stopReduction + _nd.stopReduction;
|
|
||||||
_nd = event.equipmentProfileData.ndValues.first;
|
_nd = event.equipmentProfileData.ndValues.first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,14 +120,12 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
_film = Film.values.first;
|
_film = Film.values.first;
|
||||||
}
|
}
|
||||||
_userPreferencesService.iso = event.isoValue;
|
_userPreferencesService.iso = event.isoValue;
|
||||||
_ev = _ev + log2(event.isoValue.value / _iso.value);
|
|
||||||
_iso = event.isoValue;
|
_iso = event.isoValue;
|
||||||
_emitMeasuredState(emit);
|
_emitMeasuredState(emit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onNdChanged(NdChangedEvent event, Emitter emit) {
|
void _onNdChanged(NdChangedEvent event, Emitter emit) {
|
||||||
_userPreferencesService.ndFilter = event.ndValue;
|
_userPreferencesService.ndFilter = event.ndValue;
|
||||||
_ev = _ev - event.ndValue.stopReduction + _nd.stopReduction;
|
|
||||||
_nd = event.ndValue;
|
_nd = event.ndValue;
|
||||||
_emitMeasuredState(emit);
|
_emitMeasuredState(emit);
|
||||||
}
|
}
|
||||||
|
@ -143,25 +139,26 @@ class MeteringBloc extends Bloc<MeteringEvent, MeteringState> {
|
||||||
|
|
||||||
void _onMeasured(MeasuredEvent event, Emitter emit) {
|
void _onMeasured(MeasuredEvent event, Emitter emit) {
|
||||||
_meteringInteractor.responseVibration();
|
_meteringInteractor.responseVibration();
|
||||||
_ev = event.ev100 + log2(_iso.value / 100);
|
_ev100 = event.ev100;
|
||||||
_emitMeasuredState(emit);
|
_emitMeasuredState(emit);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _emitMeasuredState(Emitter emit) {
|
void _emitMeasuredState(Emitter emit) {
|
||||||
|
final ev = _ev100 + log2(_iso.value / 100) - _nd.stopReduction;
|
||||||
emit(_isMeteringInProgress
|
emit(_isMeteringInProgress
|
||||||
? MeteringInProgressState(
|
? MeteringInProgressState(
|
||||||
ev: _ev,
|
ev: ev,
|
||||||
film: _film,
|
film: _film,
|
||||||
iso: _iso,
|
iso: _iso,
|
||||||
nd: _nd,
|
nd: _nd,
|
||||||
exposurePairs: _buildExposureValues(_ev),
|
exposurePairs: _buildExposureValues(ev),
|
||||||
)
|
)
|
||||||
: MeteringEndedState(
|
: MeteringEndedState(
|
||||||
ev: _ev,
|
ev: ev,
|
||||||
film: _film,
|
film: _film,
|
||||||
iso: _iso,
|
iso: _iso,
|
||||||
nd: _nd,
|
nd: _nd,
|
||||||
exposurePairs: _buildExposureValues(_ev),
|
exposurePairs: _buildExposureValues(ev),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue