Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Implement functionality to calc req'd and then sel nearest match in menu
So far only implemented on Shutter menu, i.e. have to select ISO and In order to do that added these two functions: - nearest_match The latter needed, because need to convert "1/1000", etc into float. For Seems to work for Sunny 16. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6513b427e7cb2d6191054029b8a73724 |
User & Date: | base@atomicules.co.uk 2013-08-29 23:24:17 |
2013-08-31
| ||
07:47 | Remove extraneous line that came from menu_scroll.c check-in: ed161d4179 user: base@atomicules.co.uk tags: origin/master, trunk | |
2013-08-29
| ||
23:24 |
Implement functionality to calc req'd and then sel nearest match in menu
So far only implemented on Shutter menu, i.e. have to select ISO and In order to do that added these two functions: - nearest_match The latter needed, because need to convert "1/1000", etc into float. For Seems to work for Sunny 16. check-in: 6513b427e7 user: base@atomicules.co.uk tags: origin/master, trunk | |
2013-08-27
| ||
12:00 | Fix order of arguements in exposure functions check-in: c663824d67 user: base@atomicules.co.uk tags: origin/master, trunk | |
Changes to exposurses.c.
︙ | |||
10 11 12 13 14 15 16 | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | - + + - + + - + + + + | char *iso_array[] = { "50", "100", "200", "400", "800", "1600", |
︙ | |||
226 227 228 229 230 231 232 233 | 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | + - - - - - + + + + + + + + + + + + + | } if (menu_counter != menu_sel_last) selection_counter += 1; if (selection_counter == 2) { /* calculate the other menu */ /* how to get missing menu? */ if (strcmp("", iso_sel) == 0) { /* Test searching for item in menu */ set_menu_pattern(iso_menu, "200"); |
︙ | |||
326 327 328 329 330 331 332 | 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | return pow(aperture, 2) / pow(2, exposure); } double aperture (int exposure, int shutter) { /* EV = log2 (N^2/t) */ return sqrt(pow(2, exposure) * shutter); } int nearest_match (double x, int menu) { /* Need to search array for closest match */ int n; int diff_idx = 0; char array_value_str[7]; double array_value_db; double diff; /* Need a starting value for difference */ switch(menu) { case 1: array_value_db = strtod(iso_array[0], NULL); break; case 2: array_value_db = fraction_to_double(shutter_array[0]); break; case 3: strncpy(array_value_str, aperture_array[0]+2, 3); array_value_db = strtod(array_value_str, NULL); break; } diff = abs(array_value_db - x); /* lots of repetition here but pointers to arrays seem to be a bad thing */ switch(menu) { case 1: for ( n = 1; iso_array[n] != NULL; ++n ) { array_value_db = strtod(iso_array[n], NULL); if (abs(array_value_db - x) < diff) { diff_idx = n; diff = abs(array_value_db - x); } } break; case 2: for ( n = 1; iso_array[n] != NULL; ++n ) { array_value_db = fraction_to_double(shutter_array[n]); if (abs(array_value_db - x) < diff) { diff_idx = n; diff = abs(array_value_db - x); } } break; case 3: for ( n = 1; iso_array[n] != NULL; ++n ) { strncpy(array_value_str, aperture_array[0]+2, 3); array_value_db = strtod(array_value_str, NULL); if (abs(array_value_db - x) < diff) { diff_idx = n; diff = abs(array_value_db - x); } } break; } return diff_idx; } double fraction_to_double(char *fraction) { double fraction_as_db; char denominator[5]; char *ptr = strchr(fraction, "/"); if (ptr) { /*then split*/ strncpy(denominator, fraction+2, 5); fraction_as_db = 1/strtod(denominator, NULL); } else { fraction_as_db = strtod(fraction, NULL); } return fraction_as_db; } |