This commit is contained in:
		| @@ -22,53 +22,53 @@ struct Settings { | |||||||
| 			uint16_t time = 300; | 			uint16_t time = 300; | ||||||
| 			uint16_t random = 1; | 			uint16_t random = 1; | ||||||
| 		} cycle ; | 		} cycle ; | ||||||
| 		 |  | ||||||
| 		struct /* matrix */ { | 		struct /* matrix */ { | ||||||
| 			uint16_t length_min = 4; | 			uint16_t length_min = 4; | ||||||
| 			uint16_t length_max = 20; | 			uint16_t length_max = 20; | ||||||
| 			uint16_t speed_min = 3; | 			uint16_t speed_min = 3; | ||||||
| 			uint16_t speed_max = 7; | 			uint16_t speed_max = 7; | ||||||
| 		} matrix; | 		} matrix; | ||||||
| 		 |  | ||||||
| 		struct /* confetti */ { | 		struct /* confetti */ { | ||||||
| 			uint16_t pixels_per_loop = 2; | 			uint16_t pixels_per_loop = 2; | ||||||
| 		} confetti; | 		} confetti; | ||||||
| 		 |  | ||||||
| 		struct /* dvd */ { | 		struct /* dvd */ { | ||||||
| 			uint16_t width = 3; | 			uint16_t width = 3; | ||||||
| 			uint16_t height = 2; | 			uint16_t height = 2; | ||||||
| 			uint16_t speed = 50; | 			uint16_t speed = 50; | ||||||
| 		} dvd; | 		} dvd; | ||||||
| 		 |  | ||||||
| 		struct /* dynamic */ { | 		struct /* dynamic */ { | ||||||
| 			uint16_t single_loop_time = 40; | 			uint16_t single_loop_time = 40; | ||||||
| 			uint16_t multi_loop_time = 1400; | 			uint16_t multi_loop_time = 1400; | ||||||
| 			uint16_t big_loop_time = 50; | 			uint16_t big_loop_time = 50; | ||||||
| 			uint16_t big_size = 3; | 			uint16_t big_size = 3; | ||||||
| 		} dynamic; | 		} dynamic; | ||||||
| 		 |  | ||||||
| 		struct /* fire */ { | 		struct /* fire */ { | ||||||
| 			uint16_t cooldown = 192; | 			uint16_t cooldown = 192; | ||||||
| 			uint16_t spark_chance = 5; | 			uint16_t spark_chance = 5; | ||||||
| 		} fire; | 		} fire; | ||||||
| 		 |  | ||||||
| 		struct /* firework */ { | 		struct /* firework */ { | ||||||
| 			uint16_t drag = 255; | 			uint16_t drag = 255; | ||||||
| 			uint16_t bounce = 200; | 			uint16_t bounce = 200; | ||||||
| 			uint16_t gravity = 10; | 			uint16_t gravity = 10; | ||||||
| 			uint16_t sparks = 12; | 			uint16_t sparks = 12; | ||||||
| 		} firework; | 		} firework; | ||||||
| 		 |  | ||||||
| 		struct /* gol */ { | 		struct /* gol */ { | ||||||
| 			uint16_t start_percentage = 90; | 			uint16_t start_percentage = 90; | ||||||
| 			uint16_t blend_speed = 10; | 			uint16_t blend_speed = 10; | ||||||
| 			uint16_t restart_after_steps = 100; | 			uint16_t restart_after_steps = 100; | ||||||
| 		} gol; | 		} gol; | ||||||
| 		 |  | ||||||
| 		struct /* sines */ { | 		struct /* sines */ { | ||||||
| 			uint16_t count = 5; | 			uint16_t count = 5; | ||||||
| 		} sines; | 		} sines; | ||||||
| 		 |  | ||||||
| 		struct /* snake */ { | 		struct /* snake */ { | ||||||
| 			uint16_t direction_change = 5; | 			uint16_t direction_change = 5; | ||||||
| 			uint16_t slowdown = 2; | 			uint16_t slowdown = 2; | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ void BigClockEffect::_draw_seconds() { | |||||||
| 	for (int i=1; i<=seconds; i++) { | 	for (int i=1; i<=seconds; i++) { | ||||||
| 		_draw_border_pixel(i, 0, (i%5==0) ? &_color_seconds_light : &_color_seconds_dark); | 		_draw_border_pixel(i, 0, (i%5==0) ? &_color_seconds_light : &_color_seconds_dark); | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	uint16_t millis = ntpClient.getEpochMillis() % 1000; | 	uint16_t millis = ntpClient.getEpochMillis() % 1000; | ||||||
| 	/* | 	/* | ||||||
| 	// Enable this to have the next pixel move smoothly to its position | 	// Enable this to have the next pixel move smoothly to its position | ||||||
|   | |||||||
| @@ -18,9 +18,9 @@ File upload_file; | |||||||
|  |  | ||||||
| void http_server_handle_file_upload() { | void http_server_handle_file_upload() { | ||||||
| 	if (http_server.uri() != "/upload") return; | 	if (http_server.uri() != "/upload") return; | ||||||
| 	 |  | ||||||
| 	HTTPUpload upload = http_server.upload(); | 	HTTPUpload upload = http_server.upload(); | ||||||
| 	 |  | ||||||
| 	if (upload.status == UPLOAD_FILE_START) { | 	if (upload.status == UPLOAD_FILE_START) { | ||||||
| 		String filename = upload.filename; | 		String filename = upload.filename; | ||||||
| 		if (!filename.startsWith("/")) filename = "/" + filename; | 		if (!filename.startsWith("/")) filename = "/" + filename; | ||||||
| @@ -159,7 +159,7 @@ void http_server_setup() { | |||||||
| 		} | 		} | ||||||
| 	}); | 	}); | ||||||
| 	http_server.begin(); | 	http_server.begin(); | ||||||
| 	 |  | ||||||
| 	MDNS.addService("_http", "_tcp", 80); | 	MDNS.addService("_http", "_tcp", 80); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,40 +5,40 @@ Settings settings; | |||||||
|  |  | ||||||
| Setting all_settings[] = { | Setting all_settings[] = { | ||||||
| 	{"fps", &settings.fps, TYPE_UINT8}, | 	{"fps", &settings.fps, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.confetti.pixels_per_loop", &settings.effects.confetti.pixels_per_loop, TYPE_UINT8}, | 	{"effects.confetti.pixels_per_loop", &settings.effects.confetti.pixels_per_loop, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.cycle.random", &settings.effects.cycle.random, TYPE_BOOL}, | 	{"effects.cycle.random", &settings.effects.cycle.random, TYPE_BOOL}, | ||||||
| 	{"effects.cycle.time", &settings.effects.cycle.time, TYPE_UINT16}, | 	{"effects.cycle.time", &settings.effects.cycle.time, TYPE_UINT16}, | ||||||
| 	 |  | ||||||
| 	{"effects.dvd.width", &settings.effects.dvd.width, TYPE_UINT8}, | 	{"effects.dvd.width", &settings.effects.dvd.width, TYPE_UINT8}, | ||||||
| 	{"effects.dvd.height", &settings.effects.dvd.height, TYPE_UINT8}, | 	{"effects.dvd.height", &settings.effects.dvd.height, TYPE_UINT8}, | ||||||
| 	{"effects.dvd.speed", &settings.effects.dvd.speed, TYPE_UINT8}, | 	{"effects.dvd.speed", &settings.effects.dvd.speed, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.dynamic.single_loop_time", &settings.effects.dynamic.single_loop_time, TYPE_UINT16}, | 	{"effects.dynamic.single_loop_time", &settings.effects.dynamic.single_loop_time, TYPE_UINT16}, | ||||||
| 	{"effects.dynamic.multi_loop_time", &settings.effects.dynamic.multi_loop_time, TYPE_UINT16}, | 	{"effects.dynamic.multi_loop_time", &settings.effects.dynamic.multi_loop_time, TYPE_UINT16}, | ||||||
| 	{"effects.dynamic.big_loop_time", &settings.effects.dynamic.big_loop_time, TYPE_UINT16}, | 	{"effects.dynamic.big_loop_time", &settings.effects.dynamic.big_loop_time, TYPE_UINT16}, | ||||||
| 	{"effects.dynamic.big_size", &settings.effects.dynamic.big_size, TYPE_UINT8}, | 	{"effects.dynamic.big_size", &settings.effects.dynamic.big_size, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.fire.cooldown", &settings.effects.fire.cooldown, TYPE_UINT8}, | 	{"effects.fire.cooldown", &settings.effects.fire.cooldown, TYPE_UINT8}, | ||||||
| 	{"effects.fire.spark_chance", &settings.effects.fire.spark_chance, TYPE_UINT8}, | 	{"effects.fire.spark_chance", &settings.effects.fire.spark_chance, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.firework.drag", &settings.effects.firework.drag, TYPE_UINT8}, | 	{"effects.firework.drag", &settings.effects.firework.drag, TYPE_UINT8}, | ||||||
| 	{"effects.firework.bounce", &settings.effects.firework.bounce, TYPE_UINT8}, | 	{"effects.firework.bounce", &settings.effects.firework.bounce, TYPE_UINT8}, | ||||||
| 	{"effects.firework.gravity", &settings.effects.firework.gravity, TYPE_UINT8}, | 	{"effects.firework.gravity", &settings.effects.firework.gravity, TYPE_UINT8}, | ||||||
| 	{"effects.firework.sparks", &settings.effects.firework.sparks, TYPE_UINT8}, | 	{"effects.firework.sparks", &settings.effects.firework.sparks, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.gol.start_percentage", &settings.effects.gol.start_percentage, TYPE_UINT8}, | 	{"effects.gol.start_percentage", &settings.effects.gol.start_percentage, TYPE_UINT8}, | ||||||
| 	{"effects.gol.blend_speed", &settings.effects.gol.blend_speed, TYPE_UINT8}, | 	{"effects.gol.blend_speed", &settings.effects.gol.blend_speed, TYPE_UINT8}, | ||||||
| 	{"effects.gol.restart_after_steps", &settings.effects.gol.restart_after_steps, TYPE_UINT8}, | 	{"effects.gol.restart_after_steps", &settings.effects.gol.restart_after_steps, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.matrix.length_min", &settings.effects.matrix.length_min, TYPE_UINT8}, | 	{"effects.matrix.length_min", &settings.effects.matrix.length_min, TYPE_UINT8}, | ||||||
| 	{"effects.matrix.length_max", &settings.effects.matrix.length_max, TYPE_UINT8}, | 	{"effects.matrix.length_max", &settings.effects.matrix.length_max, TYPE_UINT8}, | ||||||
| 	{"effects.matrix.speed_min", &settings.effects.matrix.speed_min, TYPE_UINT8}, | 	{"effects.matrix.speed_min", &settings.effects.matrix.speed_min, TYPE_UINT8}, | ||||||
| 	{"effects.matrix.speed_max", &settings.effects.matrix.speed_max, TYPE_UINT8}, | 	{"effects.matrix.speed_max", &settings.effects.matrix.speed_max, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.sines.count", &settings.effects.sines.count, TYPE_UINT8}, | 	{"effects.sines.count", &settings.effects.sines.count, TYPE_UINT8}, | ||||||
| 	 |  | ||||||
| 	{"effects.snake.direction_change", &settings.effects.snake.direction_change, TYPE_UINT8} | 	{"effects.snake.direction_change", &settings.effects.snake.direction_change, TYPE_UINT8} | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -57,7 +57,7 @@ bool change_setting(const char* key, uint16_t new_value) { | |||||||
| 		LOGln("Settings * No setting matching the name %s found.", key); | 		LOGln("Settings * No setting matching the name %s found.", key); | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	// Check data size | 	// Check data size | ||||||
| 	if (s->type == TYPE_BOOL && new_value > 1) { | 	if (s->type == TYPE_BOOL && new_value > 1) { | ||||||
| 		LOGln("Settings * Data type of %s is boolean, but new value is > 1.", key); | 		LOGln("Settings * Data type of %s is boolean, but new value is > 1.", key); | ||||||
| @@ -67,7 +67,7 @@ bool change_setting(const char* key, uint16_t new_value) { | |||||||
| 		LOGln("Settings * Data type of %s is uint8_t, but new value is > 0xFF.", key); | 		LOGln("Settings * Data type of %s is uint8_t, but new value is > 0xFF.", key); | ||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
| 	 |  | ||||||
| 	*(s->value) = new_value; | 	*(s->value) = new_value; | ||||||
| 	LOGln("Settings * Success. New value for %s is %d.", key, new_value); | 	LOGln("Settings * Success. New value for %s is %d.", key, new_value); | ||||||
| 	return true; | 	return true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user