@@ -94,6 +94,25 @@ void handleNotFound() {
94
94
digitalWrite (led, 0 );
95
95
}
96
96
97
+ void drawGraph () {
98
+ String out;
99
+ out.reserve (2600 );
100
+ char temp[70 ];
101
+ out += " <svg xmlns=\" http://www.w3.org/2000/svg\" version=\" 1.1\" width=\" 400\" height=\" 150\" >\n " ;
102
+ out += " <rect width=\" 400\" height=\" 150\" fill=\" rgb(250, 230, 210)\" stroke-width=\" 1\" stroke=\" rgb(0, 0, 0)\" />\n " ;
103
+ out += " <g stroke=\" black\" >\n " ;
104
+ int y = rand () % 130 ;
105
+ for (int x = 10 ; x < 390 ; x += 10 ) {
106
+ int y2 = rand () % 130 ;
107
+ sprintf (temp, " <line x1=\" %d\" y1=\" %d\" x2=\" %d\" y2=\" %d\" stroke-width=\" 1\" />\n " , x, 140 - y, x + 10 , 140 - y2);
108
+ out += temp;
109
+ y = y2;
110
+ }
111
+ out += " </g>\n </svg>\n " ;
112
+
113
+ server.send (200 , " image/svg+xml" , out);
114
+ }
115
+
97
116
void setup (void ) {
98
117
pinMode (led, OUTPUT);
99
118
digitalWrite (led, 0 );
@@ -133,20 +152,3 @@ void loop(void) {
133
152
MDNS.update ();
134
153
}
135
154
136
- void drawGraph () {
137
- String out = " " ;
138
- char temp[100 ];
139
- out += " <svg xmlns=\" http://www.w3.org/2000/svg\" version=\" 1.1\" width=\" 400\" height=\" 150\" >\n " ;
140
- out += " <rect width=\" 400\" height=\" 150\" fill=\" rgb(250, 230, 210)\" stroke-width=\" 1\" stroke=\" rgb(0, 0, 0)\" />\n " ;
141
- out += " <g stroke=\" black\" >\n " ;
142
- int y = rand () % 130 ;
143
- for (int x = 10 ; x < 390 ; x += 10 ) {
144
- int y2 = rand () % 130 ;
145
- sprintf (temp, " <line x1=\" %d\" y1=\" %d\" x2=\" %d\" y2=\" %d\" stroke-width=\" 1\" />\n " , x, 140 - y, x + 10 , 140 - y2);
146
- out += temp;
147
- y = y2;
148
- }
149
- out += " </g>\n </svg>\n " ;
150
-
151
- server.send (200 , " image/svg+xml" , out);
152
- }
0 commit comments