making sure original Avalon is unaffected by BitBurner changes
1 2 3 4 5 6 7 8 9 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
diff --git a/driver-avalon.c b/driver-avalon.c
index b47bff6..0f35f5c 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -923,8 +923,12 @@ static void *avalon_get_results(void *userdata)
static void avalon_rotate_array(struct cgpu_info *avalon)
{
+ int array_size = AVALON_ARRAY_SIZE;
+
+ if (usb_ident(avalon) == IDENT_BTB)
+ array_size = BITBURNER_ARRAY_SIZE;
avalon->queued = 0;
- if (++avalon->work_array >= AVALON_ARRAY_SIZE)
+ if (++avalon->work_array >= array_size)
avalon->work_array = 0;
}
@@ -1090,10 +1094,13 @@ static bool avalon_prepare(struct thr_info *thr)
{
struct cgpu_info *avalon = thr->cgpu;
struct avalon_info *info = avalon->device_data;
+ int array_size = AVALON_ARRAY_SIZE;
+ if (usb_ident(avalon) == IDENT_BTB)
+ array_size = BITBURNER_ARRAY_SIZE;
free(avalon->works);
avalon->works = calloc(info->miner_count * sizeof(struct work *),
- AVALON_ARRAY_SIZE);
+ array_size);
if (!avalon->works)
quit(1, "Failed to calloc avalon works in avalon_prepare");
diff --git a/driver-avalon.h b/driver-avalon.h
index 116e80f..e8f07c7 100644
--- a/driver-avalon.h
+++ b/driver-avalon.h
@@ -146,7 +146,8 @@ struct avalon_info {
#define AVALON_WRITE_SIZE (sizeof(struct avalon_task))
#define AVALON_READ_SIZE (sizeof(struct avalon_result))
-#define AVALON_ARRAY_SIZE 4
+#define AVALON_ARRAY_SIZE 3
+#define BITBURNER_ARRAY_SIZE 4
#define AVA_GETS_ERROR -1
#define AVA_GETS_OK 0