diff -r 28d35eb6698f shoot.c
--- a/shoot.c	Sat Jan 08 22:24:08 2011 +0200
+++ b/shoot.c	Mon Jan 10 20:28:17 2011 +0100
@@ -497,6 +497,29 @@
 	);
 }
 
+static int 
+raw_add( int step_size, int step_base, int raw_in, int delta, int raw_min, int raw_max) 
+{ 
+	int raw_out, raw_tmp;
+   
+	raw_tmp = raw_in * step_base - delta * step_size * 8;
+	raw_out = raw_tmp / step_base;
+	//rounding
+	if ( raw_tmp >= 0 ) {
+		if ( raw_tmp % step_base > ( step_base - 1 ) / 2 )
+			raw_out++;
+	} else {
+		if ( -raw_tmp % step_base > ( step_base - 1 ) / 2 )
+			raw_out--;
+	}
+	//check limits
+	if ( raw_out < raw_min )
+		raw_out = raw_min;
+	if ( raw_out > raw_max )
+		raw_out = raw_max;
+	return raw_out;
+}
+
 uint32_t cfn[4];
 PROP_HANDLER( PROP_CFN )
 {
@@ -588,7 +611,8 @@
 
 
 int hdr_steps = 1;
-CONFIG_INT("hdr.stepsize", hdr_stepsize, 8);
+CONFIG_INT("hdr.stepsize", hdr_stepsize, 1);
+CONFIG_INT("hdr.stepbase", hdr_stepbase, 1);
 
 static void 
 hdr_display( void * priv, int x, int y, int selected )
@@ -602,17 +626,40 @@
 		);
 	}
 	else
-	{
-		bmp_printf(
-			selected ? MENU_FONT_SEL : MENU_FONT,
-			x, y,
-			"HDR Brack:%dx%dEV",
-			hdr_steps, 
-			hdr_stepsize / 8
-		);
+	{	
+		if  ( hdr_stepsize % hdr_stepbase > 0 ) {
+			if ( hdr_stepsize / hdr_stepbase > 0 ) {
+				bmp_printf(
+					selected ? MENU_FONT_SEL : MENU_FONT,
+					x, y,
+					"HDR Brack:%dx%d+%d/%d EV",
+					hdr_steps, 
+					hdr_stepsize / hdr_stepbase,
+					hdr_stepsize % hdr_stepbase,
+					hdr_stepbase
+				);
+			} else {
+				bmp_printf(
+					selected ? MENU_FONT_SEL : MENU_FONT,
+					x, y,
+					"HDR Brack:%dx%d/%d EV",
+					hdr_steps, 
+					hdr_stepsize % hdr_stepbase,
+					hdr_stepbase
+				);
+			}
+		} else {
+			bmp_printf(
+				selected ? MENU_FONT_SEL : MENU_FONT,
+				x, y,
+				"HDR Brack:%dx%d EV",
+				hdr_steps, 
+				hdr_stepsize / hdr_stepbase
+			);
+		}
 	}
-	bmp_printf(FONT_MED, x + 440, y, "[SET ]\n[DISP]");
-	bmp_printf(FONT_MED, x + 510, y+5, "[Q]");
+	bmp_printf(FONT_MED, x + 400, y+6, "[SET-DISP-Q]");
+	//~ bmp_printf(FONT_MED, x + 510, y+5, "[Q]");
 }
 
 static void
@@ -624,14 +671,27 @@
 static void
 hdr_stepsize_toggle( void * priv )
 {
-	hdr_stepsize = mod(hdr_stepsize, 40) + 8;
+	hdr_stepsize++;
+	if ( ( ( hdr_stepsize * 8 ) / hdr_stepbase ) > 40) 
+		hdr_stepsize = 1;
+}
+
+static void
+hdr_stepbase_toggle( void * priv )
+{
+	hdr_stepbase++;
+	hdr_stepsize = 1;
+	if  ( hdr_stepbase == 9 )  {
+		hdr_stepbase = 1;
+	}
 }
 
 static void
 hdr_reset( void * priv )
 {
 	hdr_steps = 1;
-	hdr_stepsize = 8;
+	hdr_stepsize = 1;
+	hdr_stepbase = 3;
 }
 
 int mov_test_en = 0;
@@ -667,7 +727,7 @@
 		.display	= hdr_display,
 		.select		= hdr_steps_toggle,
 		.select_reverse = hdr_stepsize_toggle,
-		.select_auto = hdr_reset,
+		.select_auto = hdr_stepbase_toggle,
 	},
 	{
 		.priv		= &trap_focus,
@@ -749,7 +809,7 @@
 }
 
 // skip0: don't take the middle exposure
-void hdr_take_pics(int steps, int step_size, int skip0)
+void hdr_take_pics(int steps, int step_size, int step_base, int skip0)
 {
 	hdr_create_script(steps, skip0);
 	int i;
@@ -761,7 +821,7 @@
 			if (skip0 && (i == 0)) continue;
 			bmp_printf(FONT_LARGE, 30, 30, "%d   ", i);
 			msleep(1);
-			int new_s = COERCE(s - step_size * i, 0x10, 152);
+			int new_s = raw_add( step_size, step_base, s, -i, 16, 152); 
 			lens_set_rawshutter( new_s );
 			msleep(1);
 			lens_take_picture( 64000 );
@@ -777,7 +837,7 @@
 			if (skip0 && (i == 0)) continue;
 			bmp_printf(FONT_LARGE, 30, 30, "%d   ", i);
 			msleep(10);
-			int new_ae = ae + step_size * i;
+			int new_ae = raw_add( step_size, step_base, ae, i, -40, 40);
 			lens_set_ae( new_ae );
 			msleep(10);
 			lens_take_picture( 64000 );
@@ -821,7 +881,7 @@
 }
 
 static void
-hdr_take_mov(steps, step_size)
+hdr_take_mov(steps, step_size, step_base)
 {
 	int g = get_global_draw();
 	set_global_draw(0);
@@ -833,7 +893,7 @@
 	for( i = -steps/2; i <= steps/2; i ++  )
 	{
 		bmp_printf(FONT_LARGE, 30, 30, "%d   ", i);
-		int new_s = COERCE(s - step_size * i, 96, 152);
+		int new_s = raw_add( step_size, step_base, s, -i, 96, 152); 
 		lens_set_rawshutter( new_s );
 		msleep(interval_movie_duration);
 	}
@@ -849,13 +909,13 @@
 	//~ msleep(2000);
 	if (shooting_mode == SHOOTMODE_MOVIE)
 	{
-		hdr_take_mov(hdr_steps, hdr_stepsize);
+		hdr_take_mov(hdr_steps, hdr_stepsize, hdr_stepbase);
 	}
 	else
 	{
 		if (drive_mode != DRIVE_SINGLE && drive_mode != DRIVE_CONTINUOUS) 
 			lens_set_drivemode(DRIVE_CONTINUOUS);
-		hdr_take_pics(hdr_steps, hdr_stepsize, skip0);
+		hdr_take_pics(hdr_steps, hdr_stepsize, hdr_stepbase, skip0);
 		while (lens_info.job_state) msleep(500);
 	}
 }
@@ -917,7 +977,7 @@
 	fnt = FONT(FONT_MED, 80, bg);
 	
 	if (hdr_steps > 1)
-		bmp_printf(fnt, 380, 450, "HDR %dx%dEV", hdr_steps, hdr_stepsize/8);
+		bmp_printf(fnt, 380, 450, "HDR %dx%d+%d/%d EV", hdr_steps, hdr_stepsize / hdr_stepbase, hdr_stepsize % hdr_stepbase, hdr_stepbase);
 	else
 		bmp_printf(fnt, 380, 450, "           ");
 
