add manual ev moveamount to settings, add zonesystem scale to minmax-bar

This commit is contained in:
interfisch 2018-04-17 11:36:19 +02:00
parent 288520eadc
commit 1f0d2d4fea
1 changed files with 43 additions and 13 deletions

View File

@ -109,7 +109,9 @@ struct Settings {
uint8_t aperatureSelectionMode; //1=Full, 2=Half, 3=Third uint8_t aperatureSelectionMode; //1=Full, 2=Half, 3=Third
uint8_t shutterSelectionMode; //index for which shuttertimes table to use uint8_t shutterSelectionMode; //index for which shuttertimes table to use
uint8_t ISOSelectionMode; //1=Full, 2=Thirds uint8_t ISOSelectionMode; //1=Full, 2=Thirds
uint8_t manualev_moveamount_frac; // 1=1ev, 2=1/2ev, 3=1/3 ev
}; };
#define MAXIMUM_MANUAL_EV_MOVEAMOUNT_FRAC 3
bool settingsStructEqual(Settings a, Settings b){ bool settingsStructEqual(Settings a, Settings b){
if (a.minimumAperatureIndex!=b.minimumAperatureIndex || a.aperatureSelectionMode!=b.aperatureSelectionMode || a.shutterSelectionMode!=b.shutterSelectionMode || a.ISOSelectionMode!=b.ISOSelectionMode){ if (a.minimumAperatureIndex!=b.minimumAperatureIndex || a.aperatureSelectionMode!=b.aperatureSelectionMode || a.shutterSelectionMode!=b.shutterSelectionMode || a.ISOSelectionMode!=b.ISOSelectionMode){
@ -118,7 +120,7 @@ bool settingsStructEqual(Settings a, Settings b){
return true; return true;
} }
Settings userSettings= {1,1, 1,2}; Settings userSettings= {1,1, 1,2,1};
Settings eeprom_userSettings; //to store current eeprom status Settings eeprom_userSettings; //to store current eeprom status
@ -163,8 +165,8 @@ enum displaymode {
}; };
displaymode displaymode=lightmeter; displaymode displaymode=lightmeter;
uint8_t settings_selectedItem=0; //in settings display uint8_t settings_selectedItem=0; //in settings display
String settingStrings[]={"ISO:","F-Stops:","Timetable:","Turn Off"}; String settingStrings[]={"ISO:","F-Stops:","Timetable:","EV Step:","Turn Off"};
#define SETTINGS_SELECTEDITEM_MAX 3 //inclusive. 2 means 3 items available #define SETTINGS_SELECTEDITEM_MAX 4 //inclusive. 2 means 3 items available
boolean settings_itemActive=false; //item in settings selected to change value boolean settings_itemActive=false; //item in settings selected to change value
#define DISPLAY_UPDATEDELAY 200 #define DISPLAY_UPDATEDELAY 200
long last_displayupdate=0; long last_displayupdate=0;
@ -591,10 +593,10 @@ void handleInputs_Lightmeter()
if (manualev_mode){ //Manual Ev if (manualev_mode){ //Manual Ev
//Value Change //Value Change
if ( button_left ) { if ( button_left ) {
ev-=1.0/3; ev-=1.0/userSettings.manualev_moveamount_frac;
} }
if ( button_right ) { if ( button_right ) {
ev+=1.0/3; ev+=1.0/userSettings.manualev_moveamount_frac;
} }
//Change Mode //Change Mode
if ( button_hold_left ){ // Manual Ev -> Av if ( button_hold_left ){ // Manual Ev -> Av
@ -648,7 +650,8 @@ void handleInputs_Lightmeter()
ev=getEV(); //set ev to current measurement by selected mode ev=getEV(); //set ev to current measurement by selected mode
if (ev<ev_min || ev_min<-254){ //new ev is smaller than last or ev_min wasn set if (ev<ev_min || ev_min<-254){ //new ev is smaller than last or ev_min wasn set
ev_min=ev; ev_min=ev;
}else if(ev>ev_max){ //new ev is greater }
if(ev>ev_max){ //new ev is greater
ev_max=ev; ev_max=ev;
} }
debug_analog_high=analog_high; debug_analog_high=analog_high;
@ -656,7 +659,10 @@ void handleInputs_Lightmeter()
//LED Brightness on trigger //LED Brightness on trigger
uint8_t triggerblinkbrightness=255; uint8_t triggerblinkbrightness=255;
if (ev<4){ //dim led when dark if (ev<4){ //dim led when dark
triggerblinkbrightness=map(ev,4,0,255,50); triggerblinkbrightness=map(ev,4,2,255,10);
}
if (ev<2){
triggerblinkbrightness=10;
} }
blinkLED(20,triggerblinkbrightness); blinkLED(20,triggerblinkbrightness);
} }
@ -740,7 +746,20 @@ void handleInputs_Settings()
} }
break; break;
case 3: //Turn Off case 3: //manual ev moveamount
if ( button_left ) {
if(userSettings.manualev_moveamount_frac>1){
userSettings.manualev_moveamount_frac-=1;
}
}
if ( button_right ) {
if (userSettings.manualev_moveamount_frac<MAXIMUM_MANUAL_EV_MOVEAMOUNT_FRAC){
userSettings.manualev_moveamount_frac+=1;
}
}
break;
case 4: //Turn Off
poweroff(); poweroff();
break; break;
} }
@ -1232,7 +1251,7 @@ void updateDisplay_Lightmeter() //Lightmeter display
//EV Scale //EV Scale
int8_t _startev=-5; //first ev to display, 13 ev values can fit on screen int8_t _startev=-5; //first ev to display, 13 ev values can fit on screen
if (ev>2 && (ev_min<-254 || ev_min>2)){ //TODO make this better if (ev>2 && (ev_min<-254 || ev_min>2)){ //TODO make ev scale start better
_startev=0; _startev=0;
} }
if (ev>11 || ev_max>11){ if (ev>11 || ev_max>11){
@ -1272,6 +1291,7 @@ void updateDisplay_Lightmeter() //Lightmeter display
if (manualev_mode){ //in manual ev mode if (manualev_mode){ //in manual ev mode
display.drawXBitmap(xpos_arrow - icon_arrow_width/2.0 -1, ypos_icon_arrow, icon_arrow_bits, icon_arrow_width, icon_arrow_height, WHITE); //arrow icon //draw bold display.drawXBitmap(xpos_arrow - icon_arrow_width/2.0 -1, ypos_icon_arrow, icon_arrow_bits, icon_arrow_width, icon_arrow_height, WHITE); //arrow icon //draw bold
display.drawXBitmap(xpos_arrow - icon_arrow_width/2.0 +1, ypos_icon_arrow, icon_arrow_bits, icon_arrow_width, icon_arrow_height, WHITE); //arrow icon //draw bold display.drawXBitmap(xpos_arrow - icon_arrow_width/2.0 +1, ypos_icon_arrow, icon_arrow_bits, icon_arrow_width, icon_arrow_height, WHITE); //arrow icon //draw bold
display.drawXBitmap(xpos_arrow - icon_arrow_width/2.0 , ypos_icon_arrow-1, icon_arrow_bits, icon_arrow_width, icon_arrow_height, WHITE); //arrow icon //draw bold
} }
uint8_t _xpos_current_evtext_move=5; //for text centering uint8_t _xpos_current_evtext_move=5; //for text centering
if (_ev_decimals <= 0.1666 || _ev_decimals > 0.8333) { //without fraction displayed if (_ev_decimals <= 0.1666 || _ev_decimals > 0.8333) { //without fraction displayed
@ -1318,18 +1338,23 @@ void updateDisplay_Lightmeter() //Lightmeter display
if (ev_min>-254){ //ev_min is set (-255 is placeholder for "not set") if (ev_min>-254){ //ev_min is set (-255 is placeholder for "not set")
display.drawLine(xpos_ev_min,2,xpos_ev_min,5,WHITE); display.drawLine(xpos_ev_min,2,xpos_ev_min,5,WHITE);
if ((xpos_arrow-xpos_ev_min)>3 && arrow_is_between_minmax){ //arrow is not overlaying line and is in between min and max if ((xpos_arrow-xpos_ev_min)>3 && arrow_is_between_minmax){ //arrow is not overlaying line and is in between min and max
display.drawLine(xpos_ev_min,4,xpos_arrow - 4,4,WHITE); //line from left horizontally to arrow display.drawLine(xpos_ev_min,4,xpos_arrow ,4,WHITE); //line from left horizontally to arrow
display.drawLine(xpos_ev_min,5,xpos_arrow - 4,5,WHITE); //line from left horizontally to arrow display.drawLine(xpos_ev_min,5,xpos_arrow - 4,5,WHITE); //line from left horizontally to arrow
} }
} }
if (ev_max>-254){ //ev_min is set (-255 is placeholder for "not set") if (ev_max>-254){ //ev_min is set (-255 is placeholder for "not set")
display.drawLine(xpos_ev_max,2,xpos_ev_max,5,WHITE); display.drawLine(xpos_ev_max,2,xpos_ev_max,5,WHITE);
if ((xpos_ev_max-xpos_arrow)>3 && arrow_is_between_minmax){ //arrow is not overlaying line and is in between min and max if ((xpos_ev_max-xpos_arrow)>3 && arrow_is_between_minmax){ //arrow is not overlaying line and is in between min and max
display.drawLine(xpos_ev_max,4,xpos_arrow + 3,4,WHITE); //line from right horizontally to arrow display.drawLine(xpos_ev_max,4,xpos_arrow ,4,WHITE); //line from right horizontally to arrow
display.drawLine(xpos_ev_max,5,xpos_arrow + 3,5,WHITE); //line from right horizontally to arrow display.drawLine(xpos_ev_max,5,xpos_arrow + 2,5,WHITE); //line from right horizontally to arrow
} }
} }
for (int8_t i=-(xpos_arrow-xpos_ev_min)/FULLEVLINEDISTANCE;i<(xpos_ev_max-xpos_arrow)/FULLEVLINEDISTANCE;i++){ //draw black lines for every zone border
display.drawLine(xpos_arrow+i*FULLEVLINEDISTANCE+FULLEVLINEDISTANCE/2,4,xpos_arrow+i*FULLEVLINEDISTANCE+FULLEVLINEDISTANCE/2 ,5,BLACK); //erase part of horizontal line
}
//DEBUG Message //DEBUG Message
@ -1347,7 +1372,9 @@ void updateDisplay_Lightmeter() //Lightmeter display
display.print(debug_analog_high);*/ display.print(debug_analog_high);*/
display.print(ev_min,1); display.print(ev_min,1);
display.print(":"); display.print("<");
display.print(ev,1);
display.print("<");
display.print(ev_max,1); display.print(ev_max,1);
} }
@ -1382,6 +1409,9 @@ void updateDisplay_Settings()
break; break;
case 2: display.print(settingsnameShutterSelectionMode[userSettings.shutterSelectionMode-1]); case 2: display.print(settingsnameShutterSelectionMode[userSettings.shutterSelectionMode-1]);
break; break;
case 3: display.print("1/"); display.print(userSettings.manualev_moveamount_frac);display.print(" EV");
break;
//case 4 is power off, no value to display here
} }
display.setCursor(SETTINGS_XPOS_OFFSET,display.getCursorY()+SETTINGS_YPOS_INCREMENT); //move cursor to next entry display.setCursor(SETTINGS_XPOS_OFFSET,display.getCursorY()+SETTINGS_YPOS_INCREMENT); //move cursor to next entry