Compare commits
	
		
			4 Commits
		
	
	
		
			205a0df842
			...
			b5c1f350d2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| b5c1f350d2 | |||
| 5eba691429 | |||
| d8fe055e3d | |||
| 6b4f75b8bc | 
@@ -9,7 +9,7 @@
 | 
				
			|||||||
class MatrixEffectColumn {
 | 
					class MatrixEffectColumn {
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    Window* window;
 | 
					    Window* window;
 | 
				
			||||||
    accum88 x, y;
 | 
					    saccum78 x, y;
 | 
				
			||||||
    uint8_t length = 1;
 | 
					    uint8_t length = 1;
 | 
				
			||||||
    uint8_t _direction = 2;
 | 
					    uint8_t _direction = 2;
 | 
				
			||||||
    bool _random_direction = false;
 | 
					    bool _random_direction = false;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,8 +26,8 @@ struct Settings {
 | 
				
			|||||||
		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 = 1;
 | 
								uint16_t speed_min = 3;
 | 
				
			||||||
			uint16_t speed_max = 10;
 | 
								uint16_t speed_max = 7;
 | 
				
			||||||
		} matrix;
 | 
							} matrix;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		struct /* confetti */ {
 | 
							struct /* confetti */ {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,7 @@ void MatrixEffectColumn::advance(uint16_t ms) {
 | 
				
			|||||||
	switch(_direction) {
 | 
						switch(_direction) {
 | 
				
			||||||
		case DIR_NORTH:
 | 
							case DIR_NORTH:
 | 
				
			||||||
			y-=speed * ms;
 | 
								y-=speed * ms;
 | 
				
			||||||
			if ((y>>8) > window->height && (y>>8) + length > window->height) running=false;
 | 
								if ((y>>8) + length < 0) running=false;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case DIR_EAST:
 | 
							case DIR_EAST:
 | 
				
			||||||
			x+=speed * ms;
 | 
								x+=speed * ms;
 | 
				
			||||||
@@ -59,7 +59,7 @@ void MatrixEffectColumn::advance(uint16_t ms) {
 | 
				
			|||||||
			break;
 | 
								break;
 | 
				
			||||||
		case DIR_WEST:
 | 
							case DIR_WEST:
 | 
				
			||||||
			x-=speed * ms;
 | 
								x-=speed * ms;
 | 
				
			||||||
			if ((x>>8) > window->width && (y>>8) + length > window->width) running=false;
 | 
								if ((x>>8) + length < 0) running=false;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,7 @@ void http_server_setup() {
 | 
				
			|||||||
	PGM_P text_plain = PSTR("text/plain");
 | 
						PGM_P text_plain = PSTR("text/plain");
 | 
				
			||||||
	http_server.on("/", HTTP_GET, [&](){
 | 
						http_server.on("/", HTTP_GET, [&](){
 | 
				
			||||||
		LOGln("HTTP * GET /");
 | 
							LOGln("HTTP * GET /");
 | 
				
			||||||
		String message = "<html><head><title>Pitrix</title></head><body><h1>Pitrix</h1><a href='/settings'>Settings</a><p>Known animations:</p>";
 | 
							String message = "<html><head><title>Pitrix</title></head><body><h1>Pitrix</h1><p><a href='/settings'>Settings</a></p><p><a href='/effects'>Effect</a></p><p>Known animations:</p>";
 | 
				
			||||||
		if (!SPIFFS.begin()) {
 | 
							if (!SPIFFS.begin()) {
 | 
				
			||||||
			message += "<strong>No SPIFFS file system found.</strong>";
 | 
								message += "<strong>No SPIFFS file system found.</strong>";
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
@@ -83,6 +83,16 @@ void http_server_setup() {
 | 
				
			|||||||
			http_server.send(400, "text/plain", "Could not change setting.");
 | 
								http_server.send(400, "text/plain", "Could not change setting.");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
						http_server.on("/effects", HTTP_GET, [&]() {
 | 
				
			||||||
 | 
							String message = "<html><head><title>Pitrix effects</title></head><body><h1>Pitrix settings</h1><a href='/'>Back to main page</a><table>";
 | 
				
			||||||
 | 
							for (int i=0; i<effects_size; i++) {
 | 
				
			||||||
 | 
								message += "<tr><td>";
 | 
				
			||||||
 | 
								message += effects[i].name;
 | 
				
			||||||
 | 
								message += "</td></tr>";
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							message += "</table></body></html>";
 | 
				
			||||||
 | 
							http_server.send(200, "text/html", message);
 | 
				
			||||||
 | 
						});
 | 
				
			||||||
	http_server.on("/delete", HTTP_GET, [&]() {
 | 
						http_server.on("/delete", HTTP_GET, [&]() {
 | 
				
			||||||
		LOGln("HTTP * GET /delete");
 | 
							LOGln("HTTP * GET /delete");
 | 
				
			||||||
		if (http_server.args()==0) {
 | 
							if (http_server.args()==0) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user