Commit b8b9c468e0ed2c069379b5e2ebd72c1ea3dc602b

Kano 2012-08-02T07:58:05

ICA default fpga_count to work_division if specified

diff --git a/FPGA-README b/FPGA-README
index 1c83d9f..0c4da8a 100644
--- a/FPGA-README
+++ b/FPGA-README
@@ -26,6 +26,8 @@ There are two hidden options in cgminer when Icarus support is compiled in:
                           e.g. 2 means each FPGA does half the nonce range - default 2
            fpga_count     The actual number of FPGA working - this would normally be the same
                           as work_division - range is from 1 up to 'work_division'
+                          It defaults to the value of work_division - or 2 if you don't specify
+                          work_division
 
 If you define fewer comma seperated values than Icarus devices, the last values will be used
 for all extra devices
diff --git a/driver-icarus.c b/driver-icarus.c
index 0b3aea7..f1cf9d1 100644
--- a/driver-icarus.c
+++ b/driver-icarus.c
@@ -470,9 +470,10 @@ static void get_options(int this_option_offset, int *baud, int *work_division, i
 
 			if (*colon) {
 				tmp = atoi(colon);
-				if (tmp == 1 || tmp == 2 || tmp == 4 || tmp == 8)
+				if (tmp == 1 || tmp == 2 || tmp == 4 || tmp == 8) {
 					*work_division = tmp;
-				else {
+					*fpga_count = tmp;	// default to the same
+				} else {
 					sprintf(err_buf, "Invalid icarus-options for work_division (%s) must be 1, 2, 4 or 8", colon);
 					quit(1, err_buf);
 				}