Skip to content

Commit d50dc56

Browse files
committed
Some comments and config rearrangement
1 parent bd95125 commit d50dc56

File tree

3 files changed

+24
-1596
lines changed

3 files changed

+24
-1596
lines changed

esp32-cam-webserver.ino

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
* A camera name can now be configured, and wifi details can be stored in an optional
1313
* header file to allow easier updated of the repo.
1414
*
15-
* The web UI has had minor changes to add the Lamp control when present, I have made the
15+
* The web UI has had minor changes to add the lamp control when present, I have made the
1616
* 'Start Stream' controls more accessible, and add feedback of the camera name/firmware.
1717
*
1818
*
1919
* note: Make sure that you have either selected ESP32 AI Thinker,
20-
* or another board which has PSRAM enabled to use High resolution Modes
20+
* or another board which has PSRAM enabled to use high resolution camera modes
2121
*/
2222

2323
// Select camera board model
@@ -148,42 +148,54 @@ void setup() {
148148
s->set_hmirror(s, 1);
149149
#endif
150150

151+
// Feedback that hardware init is complete and we are now attempting to connect
152+
Serial.println("");
153+
Serial.print("Connecting to Wifi Netowrk: ");
154+
Serial.println(ssid);
155+
flashLED(400);
156+
delay(100);
157+
151158
WiFi.begin(ssid, password);
152159

153-
while (WiFi.status() != WL_CONNECTED) { // Owen, pulse LED for this.
154-
delay(250);
160+
while (WiFi.status() != WL_CONNECTED) {
161+
delay(250); // Wait for Wifi to connect. If no wifi the code basically hangs here.
162+
// It would be good to do something else here as a future enhancement.
163+
// (eg: go to a captive AP config portal to configure the wifi)
155164
}
156165

157166
// feedback that we are connected
167+
Serial.println("");
168+
Serial.println("WiFi connected");
158169
flashLED(200);
159170
delay(100);
160171
flashLED(200);
161172
delay(100);
162173
flashLED(200);
163-
164-
Serial.println("");
165-
Serial.println("WiFi connected");
166174

175+
// Start the Stream server, and the handler processes for the Web UI.
167176
startCameraServer();
168177

169178
Serial.print("Camera Ready! Use 'http://");
170179
Serial.print(WiFi.localIP());
171180
Serial.println("' to connect");
172181
}
173182

183+
// Notification LED
174184
void flashLED(int flashtime)
175185
{
176-
#ifdef LED_PIN // Notification LED; If we have it; flash it.
177-
digitalWrite(LED_PIN, LED_ON); // On at full power.
186+
#ifdef LED_PIN // If we have it; flash it.
187+
digitalWrite(LED_PIN, LED_ON); // On at full power.
178188
delay(flashtime); // delay
179-
digitalWrite(LED_PIN, LED_OFF); // turn Off
189+
digitalWrite(LED_PIN, LED_OFF); // turn Off
180190
#else
181-
return; // No notifcation LED, do nothing
191+
return; // No notifcation LED, do nothing, no delay
182192
#endif
183193
}
184194

185195

186196
void loop() {
187-
// put your main code here, to run repeatedly:
197+
// Just loop forever.
198+
// The stream and URI handler processes initiated by the startCameraServer() call at the
199+
// end of setup() will handle the camera and UI processing from now on.
188200
delay(10000);
189201
}

0 commit comments

Comments
 (0)