From a0bca54bb1c307a18f82232ad465d45d9f88ce29 Mon Sep 17 00:00:00 2001 From: Felix Pankratz Date: Sun, 15 Dec 2024 14:49:48 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20cleanup,=20minor=20param=20chang?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- organism/src/main.cpp | 66 ++++------------------------------------- organism/src/visual.cpp | 2 +- 2 files changed, 6 insertions(+), 62 deletions(-) diff --git a/organism/src/main.cpp b/organism/src/main.cpp index a84dd08..40a7b25 100644 --- a/organism/src/main.cpp +++ b/organism/src/main.cpp @@ -17,8 +17,6 @@ MatrixPanel_I2S_DMA *matrix = nullptr; -//#define AGENT_DROP_AMOUNT 10 -//#define NUM_ITERATIONS 500 struct SlimeAgent { int x_position; int y_position; @@ -59,14 +57,12 @@ void init_attractant() { void init_agents() { AGENT_MOVE_DISTANCE = 1; //random(1, 3); - //AGENT_MOVE_ANGLE = random(0, 334) / 1000.0; AGENT_MOVE_ANGLE = 0.175;//random(0, 334) / 1000.0; - //AGENT_SENSOR_ANGLE = random(0, 334) / 1000.0; - if (random(0, 2) > 0) { - AGENT_SENSOR_ANGLE = 0.175; - } else { - AGENT_SENSOR_ANGLE = 0.0875; - } + //if (random(0, 2) > 0) { + // AGENT_SENSOR_ANGLE = 0.175; + //} else { + AGENT_SENSOR_ANGLE = 0.0875; + //} AGENT_SENSOR_DISTANCE = random(AGENT_SENSOR_DISTANCE_MIN * 1000.0, AGENT_SENSOR_DISTANCE_MAX * 1000.0) / 1000.0; NUM_AGENTS = random(NUM_AGENTS_MIN, NUM_AGENTS_MAX); @@ -115,58 +111,6 @@ void setup(){ init_attractant(); } -//void draw_bg() { -// int h_lines = round(PANEL_HEIGHT / 7); -// int v_lines = round(PANEL_WIDTH / 7); -// for(int v = 0; v <= v_lines; v++) { -// matrix->drawFastVLine(v*7+2, 0, PANEL_HEIGHT, matrix->color565(41, 17, 76)); -// } -// for(int h = 0; h <= h_lines; h++) { -// matrix->drawFastHLine(0, 7*h + 1, PANEL_WIDTH, matrix->color565(41, 17, 76)); -// } -//} -// -//void draw_attractant() { -// for(int x = 0; x 17.0) { -// matrix->drawPixel(x, y, matrix->color565( -// int((255.0 / 255.0) * round(attractant[x][y])), -// int((80.0 / 255.0) * round(attractant[x][y])), -// int((83.0 / 255.0) * round(attractant[x][y])) -// ) -// ); -// } -// } -// } -//} - -//int cleanup_x = 0; -//void cleanup() { -// int progress = iterations - NUM_ITERATIONS; -// matrix->drawFastVLine(cleanup_x, 0, PANEL_HEIGHT, matrix->color565(254, 242, 255)); -// if (cleanup_x > 0) { -// matrix->fillRect(0, 0, cleanup_x, PANEL_HEIGHT, matrix->color565(16, 0, 16)); -// } -// int h_lines = round(PANEL_HEIGHT / 7); -// int v_lines = round(cleanup_x / 7); -// for(int v = 0; v < cleanup_x; v++) { -// if (v%7 == 2) { -// matrix->drawFastVLine(v, 0, PANEL_HEIGHT, matrix->color565(41, 17, 76)); -// } -// } -// for(int h = 0; h <= h_lines; h++) { -// matrix->drawFastHLine(0, 7*h + 1, cleanup_x-1, matrix->color565(41, 17, 76)); -// } -// cleanup_x++; -// if (cleanup_x > PANEL_WIDTH) { -// iterations = 0; -// cleanup_x = 0; -// init_attractant(); -// init_agents(); -// } -//} - void loop() { matrix ->flipDMABuffer(); delay(10); diff --git a/organism/src/visual.cpp b/organism/src/visual.cpp index 9a96ed4..4f50b49 100644 --- a/organism/src/visual.cpp +++ b/organism/src/visual.cpp @@ -15,7 +15,7 @@ void draw_bg(MatrixPanel_I2S_DMA *matrix) { void draw_attractant(MatrixPanel_I2S_DMA *matrix, float attractant[PANEL_WIDTH][PANEL_HEIGHT]) { for(int x = 0; x 17.0) { + if (attractant[x][y] > 15.0) { matrix->drawPixel(x, y, matrix->color565( int((255.0 / 255.0) * round(attractant[x][y])), int((80.0 / 255.0) * round(attractant[x][y])),