🧹 cleanup, minor param changes
This commit is contained in:
parent
8cc53c8bb2
commit
a0bca54bb1
@ -17,8 +17,6 @@
|
|||||||
MatrixPanel_I2S_DMA *matrix = nullptr;
|
MatrixPanel_I2S_DMA *matrix = nullptr;
|
||||||
|
|
||||||
|
|
||||||
//#define AGENT_DROP_AMOUNT 10
|
|
||||||
//#define NUM_ITERATIONS 500
|
|
||||||
struct SlimeAgent {
|
struct SlimeAgent {
|
||||||
int x_position;
|
int x_position;
|
||||||
int y_position;
|
int y_position;
|
||||||
@ -59,14 +57,12 @@ void init_attractant() {
|
|||||||
|
|
||||||
void init_agents() {
|
void init_agents() {
|
||||||
AGENT_MOVE_DISTANCE = 1; //random(1, 3);
|
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_MOVE_ANGLE = 0.175;//random(0, 334) / 1000.0;
|
||||||
//AGENT_SENSOR_ANGLE = random(0, 334) / 1000.0;
|
//if (random(0, 2) > 0) {
|
||||||
if (random(0, 2) > 0) {
|
// AGENT_SENSOR_ANGLE = 0.175;
|
||||||
AGENT_SENSOR_ANGLE = 0.175;
|
//} else {
|
||||||
} else {
|
AGENT_SENSOR_ANGLE = 0.0875;
|
||||||
AGENT_SENSOR_ANGLE = 0.0875;
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
AGENT_SENSOR_DISTANCE = random(AGENT_SENSOR_DISTANCE_MIN * 1000.0, AGENT_SENSOR_DISTANCE_MAX * 1000.0) / 1000.0;
|
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);
|
NUM_AGENTS = random(NUM_AGENTS_MIN, NUM_AGENTS_MAX);
|
||||||
@ -115,58 +111,6 @@ void setup(){
|
|||||||
init_attractant();
|
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<PANEL_WIDTH; x++) {
|
|
||||||
// for(int y = 0; y<PANEL_HEIGHT; y++){
|
|
||||||
// if (attractant[x][y] > 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() {
|
void loop() {
|
||||||
matrix ->flipDMABuffer();
|
matrix ->flipDMABuffer();
|
||||||
delay(10);
|
delay(10);
|
||||||
|
@ -15,7 +15,7 @@ void draw_bg(MatrixPanel_I2S_DMA *matrix) {
|
|||||||
void draw_attractant(MatrixPanel_I2S_DMA *matrix, float attractant[PANEL_WIDTH][PANEL_HEIGHT]) {
|
void draw_attractant(MatrixPanel_I2S_DMA *matrix, float attractant[PANEL_WIDTH][PANEL_HEIGHT]) {
|
||||||
for(int x = 0; x<PANEL_WIDTH; x++) {
|
for(int x = 0; x<PANEL_WIDTH; x++) {
|
||||||
for(int y = 0; y<PANEL_HEIGHT; y++){
|
for(int y = 0; y<PANEL_HEIGHT; y++){
|
||||||
if (attractant[x][y] > 17.0) {
|
if (attractant[x][y] > 15.0) {
|
||||||
matrix->drawPixel(x, y, matrix->color565(
|
matrix->drawPixel(x, y, matrix->color565(
|
||||||
int((255.0 / 255.0) * round(attractant[x][y])),
|
int((255.0 / 255.0) * round(attractant[x][y])),
|
||||||
int((80.0 / 255.0) * round(attractant[x][y])),
|
int((80.0 / 255.0) * round(attractant[x][y])),
|
||||||
|
Loading…
Reference in New Issue
Block a user