mirror of
https://github.com/UberGuidoZ/Flipper.git
synced 2026-09-18 19:21:30 +00:00
Reorg, added more sources
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
#include "lightmeter_helper.h"
|
||||
#include "lightmeter_config.h"
|
||||
|
||||
extern const float aperture_numbers[];
|
||||
extern const float speed_numbers[];
|
||||
|
||||
float lux2ev(float lux) {
|
||||
return log2(lux / 2.5);
|
||||
}
|
||||
|
||||
float getMinDistance(float x, float v1, float v2) {
|
||||
if(x - v1 > v2 - x) {
|
||||
return v2;
|
||||
}
|
||||
|
||||
return v1;
|
||||
}
|
||||
|
||||
float normalizeAperture(float a) {
|
||||
for(int i = 0; i < AP_NUM; i++) {
|
||||
float a1 = aperture_numbers[i];
|
||||
float a2 = aperture_numbers[i + 1];
|
||||
|
||||
if(a1 < a && a2 >= a) {
|
||||
return getMinDistance(a, a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
float normalizeTime(float a) {
|
||||
for(int i = 0; i < SPEED_NUM; i++) {
|
||||
float a1 = speed_numbers[i];
|
||||
float a2 = speed_numbers[i + 1];
|
||||
|
||||
if(a1 < a && a2 >= a) {
|
||||
return getMinDistance(a, a1, a2);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user