lower debounce time, add trigger hold to measure, calibrate battery voltage

This commit is contained in:
interfisch 2018-04-09 11:45:18 +02:00
parent 737aabd03b
commit b61a824901
1 changed files with 15 additions and 7 deletions

View File

@ -32,7 +32,7 @@ BH1750 lightMeter;
#define TIME_METERINGMODESELECTION_CLOSE 4000
#define LDRDELAY 50 //minimum delay between ldr readings. Transistor for lower value pulldown resistor switches in between
#define INCIDENTDELAY 100 //minimum delay between incident sensor (BH1750) readings
#define DEBOUNCETIME 50 //time to not check for inputs after key press
#define DEBOUNCETIME 20 //time to not check for inputs after key press
#define BUTTONTIMEHOLD 750 //time for button hold
#define voltage_warn 3.4 //voltage per cell //TODO implement warning
@ -287,7 +287,7 @@ void handleInputs()
*/
//Voltage
vbat=map(analogRead(PIN_VBAT), 0,3910,0,8400)/1000.0; //180k and 300k voltage divider. 8,4V -> 3,15V=3910
vbat=map(analogRead(PIN_VBAT), 0,3560,0,8200)/1000.0; //180k and 300k voltage divider. 8,4V -> 3,15V=3910
//LDR
if ( loopmillis-last_ldrReading>LDRDELAY )
@ -438,7 +438,7 @@ void handleInputs_Lightmeter()
}
}
if (button_trigger) { //Trigger
if (button_trigger || button_hold_trigger) { //Trigger
ev=getEV(); //set ev to current measurement by selected mode
}
@ -928,6 +928,9 @@ void updateDisplay_Lightmeter() //Lightmeter display
//EV Scale
uint8_t _startev=2; //first ev to display, 13 ev values can fit on screen
if (ev>13){
_startev=5+ev-13;
}
#define FULLEVLINEDISTANCE 9
#define THIRDEVLINEDISTANCE 3
@ -963,12 +966,17 @@ void updateDisplay_Lightmeter() //Lightmeter display
if (_ev_decimals <= 0.1666 || _ev_decimals > 0.8333) { //without fraction displayed
_xpos_current_evtext_move=2;
}
display.setCursor(xpos_arrow-_xpos_current_evtext_move,ypos_icon_arrow+icon_arrow_height+2); //current ev text position
int _displayev=(int)ev;
if (_ev_decimals > 0.8333 ){
display.print((int)ev+1); //EV Value under arrow. Ceil
}else{
display.print((int)ev); //EV Value under arrow
_displayev=(int)(ev+1);//EV Value under arrow. Ceil
}
if (_displayev>=10){
_xpos_current_evtext_move+=5; //move digits to left
}
display.setCursor(xpos_arrow-_xpos_current_evtext_move,ypos_icon_arrow+icon_arrow_height+2); //current ev text position
display.print(_displayev); //EV Value under arrow
if ( _ev_decimals > 0.1666 && _ev_decimals <= 0.4166) {
display.drawXBitmap(xpos_arrow , ypos_icon_arrow+icon_arrow_height-(icon_one_third_height-8)/2 +2, icon_one_third_bits, icon_one_third_width, icon_one_third_height, WHITE); //one third