Skip to content
This repository has been archived by the owner on Dec 24, 2021. It is now read-only.

Commit

Permalink
Update to V2.2.0
Browse files Browse the repository at this point in the history
Implemenation of Watchdog
Code Restructuring (partly)
  • Loading branch information
jomjol committed Sep 27, 2019
1 parent 1089bed commit 9095d4b
Show file tree
Hide file tree
Showing 8 changed files with 143 additions and 180 deletions.
9 changes: 9 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Changelog
##### 2.2.0 Implementation of Watchdog (ESP32-CAM only)
* ESP32 Watchdog with 120s time implemented
##### 2.1.0 Parametrized Output (quality, size) (ESP32-CAM only)
* Introduction of parameter for adjustable resolution and jpeg quality
* V2.1.1 ERROR-CORRECTION: setting of default quality was faulty
##### 2.0.0 Usage of internal ESP32-CAM Flash LED
* Attention @ ESP32-CAM: compared to v1.0.0 the connection to the LED-strip has been changed from GPIO4 to GPIO2 ##### 1.0.0 Initial Version for ESP8266 (with ArduCAM) and ESP32-CAM (with OV2640)

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
//#include <ESP8266mDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

#include "esp_system.h"

#include "arduino.h"
#include "JomjolGitESP32CAM-Server-Class.h"


const char* ssid = "SSID";
const char* password = "Password";
const char* host = "Kamera";
Expand All @@ -15,16 +16,31 @@ const char* host = "Kamera";
#define INT_LED 33 // Interne LED zum Blinken bei WiFi-Connect at pin GPIO33 (ESP32-CAM).
#define FLASH_PIN 4 // Intere Flash-LED des ESP32-CAM Moduls

hw_timer_t *timer = NULL;
void IRAM_ATTR resetModule(){
ets_printf("reboot\n");
ESP.restart();;
}


GitESP32CAMServerLibrary::ESP32CAMServerClass ESP32CAMServer(LEDPin, 10, 50, 16, FLASH_PIN); // Pin, Anzahl LEDs, Brightness, CS, GPIO_FLASH

void setup() {
Serial.begin(115200);
Serial.println("gestartet - setup - done");
Serial.println("Setup start");

// Setup Watchdogtimer to 2 Minutes
timer = timerBegin(0, 80, true); //timer 0, div 80
timerAttachInterrupt(timer, &resetModule, true);
timerAlarmWrite(timer, 120000000, false); //set time in us
timerAlarmEnable(timer); //enable interrupt
Serial.println("Watchdog enabled");

WifiReConnect();
OTA_setup();


ESP32CAMServer.setup();
Serial.println("Setup done");
}


Expand Down Expand Up @@ -78,4 +94,5 @@ void OTA_setup()
void OTA_loop()
{
ArduinoOTA.handle();
timerWrite(timer, 0); //reset timer (feed watchdog)
}
42 changes: 11 additions & 31 deletions ESP32-CAM_Server-GitHub/JomjolGitESP32CAM-Server-Class.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,15 @@
#include "JomjolGitESP32CAM-Server-Class.h"

/*
FRAMESIZE_QQVGA, // 160x120
FRAMESIZE_QQVGA2, // 128x160
FRAMESIZE_QCIF, // 176x144
FRAMESIZE_HQVGA, // 240x176
FRAMESIZE_QVGA, // 320x240
FRAMESIZE_CIF, // 400x296
FRAMESIZE_VGA, // 640x480
FRAMESIZE_SVGA, // 800x600
FRAMESIZE_XGA, // 1024x768
FRAMESIZE_SXGA, // 1280x1024
FRAMESIZE_UXGA, // 1600x1200
FRAMESIZE_QXGA, // 2048*1536
*/

void GitESP32CAMServerLibrary::ESP32CAMServerClass::handleCommand(String _param, String _value, String _modus)
void GitESP32CAMServerLibrary::ESP32CAMServerClass::handleRoot()
{
if (_param.equals("humidity"))
{
if (_modus.equals("name"))
send(200, "text/plain", "tbd");
else
send(200, "text/plain", "tbd");
delay(0);
return;
}
String zw;
zw = "Hello from ESP32-CAM!\n";
zw = zw + "Flash-Light is on GPIO" + String(flashPIN) + " - recommended illumination!\n";
zw = zw + "WS2812b-LED Strip is on GPIO" + String(NeoPixelPIN) + " - if connected\n";
zw = zw + "Watchdog enabled with 120s";

send(200, "text/plain", zw);
}

void GitESP32CAMServerLibrary::ESP32CAMServerClass::doCaptureWithLigth()
Expand All @@ -39,21 +23,19 @@ void GitESP32CAMServerLibrary::ESP32CAMServerClass::doCaptureWithLigth()

void GitESP32CAMServerLibrary::ESP32CAMServerClass::doCaptureWithFlashLight()
{

Serial.println("ArduCAM-Server-Class - doCaptureWithLigth");
Serial.println("ESP32CAM-Server-Class - doCaptureWithFlashLigth");
FlashOn();
Serial.println("sleep 5000");
delay(5000);
Serial.println("Start doCapture");
this->doCapture();
FlashOff();
// serverCaptureWithFlashLight();
}


void GitESP32CAMServerLibrary::ESP32CAMServerClass::doCapture()
{
Serial.println("ArduCAM-Server-Class - doCapture");
Serial.println("ESP32CAM-Server-Class - doCapture");
String str_resolution = "";
framesize_t res;
String str_quality = "";
Expand Down Expand Up @@ -96,15 +78,13 @@ void GitESP32CAMServerLibrary::ESP32CAMServerClass::doCapture()
void GitESP32CAMServerLibrary::ESP32CAMServerClass::doLightOn()
{
Serial.println("ArduCAM-Server-Class - Ligth On");
// LEDBandComm->LightOn();
LightOn();
send(200, "text/plain", "Light On");
}

void GitESP32CAMServerLibrary::ESP32CAMServerClass::doLightOff()
{
Serial.println("ArduCAM-Server-Class - Ligth Off");
// LEDBandComm->LightOff();
Serial.println("ESP32-CAM-Server-Class - Ligth Off");
LightOff();
send(200, "text/plain", "Light Off");
}
Expand Down
3 changes: 2 additions & 1 deletion ESP32-CAM_Server-GitHub/JomjolGitESP32CAM-Server-Class.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace GitESP32CAMServerLibrary
class ESP32CAMServerClass: public GitESP32CAMCommLibrary::ESP32CAMCommClass, public GitServerLibrary::ServerClass
{
private:
void handleCommand(String _param, String _value, String _modus);
void doCaptureWithLigth();
void doCaptureWithFlashLight();
void doCapture();
Expand All @@ -19,6 +18,8 @@ namespace GitESP32CAMServerLibrary
void doFlashOn();
void doFlashOff();

void handleRoot();

public:
ESP32CAMServerClass(int _pin, int _num_led, int _brightness, int _CS, int _flashPIN) : GitESP32CAMCommLibrary::ESP32CAMCommClass(_pin, _num_led, _brightness, _CS, _flashPIN, this), GitServerLibrary::ServerClass() {} ;

Expand Down
Loading

0 comments on commit 9095d4b

Please sign in to comment.