Skip to content

Commit c47f7ff

Browse files
committed
change wdt
1 parent 1fce718 commit c47f7ff

File tree

3 files changed

+56
-7
lines changed

3 files changed

+56
-7
lines changed

camsend.cpp

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include "cert.h"
33
#include "myconfig2.h"
44
#include <esp_camera.h>
5+
#include <ArduinoJson.h>
56

67

78
// Functions from the main .ino
@@ -11,6 +12,44 @@ extern void setLamp(int newVal);
1112
extern int lampVal;
1213
extern bool autoLamp;
1314
extern bool debugData;
15+
extern char mdnsName;
16+
17+
18+
String serverurl = CAMSERVER;
19+
20+
21+
/*
22+
send status
23+
24+
*/
25+
esp_err_t SendStatusHttp()
26+
{
27+
HTTPClient http;
28+
29+
JsonDocument doc;
30+
31+
doc["esphostname"] = String(mdnsName);
32+
doc["rssi"] = String(WiFi.RSSI());
33+
34+
// Serialize JSON document
35+
String json;
36+
serializeJson(doc, json);
37+
38+
http.begin( serverurl + "/espstatus/", root_ca); // Specify the URL and certificate
39+
http.addHeader("Content-Type", "application/json");
40+
41+
int httpCode = http.POST(json);
42+
43+
http.end();
44+
45+
if(httpCode > 0)
46+
{
47+
Serial.println(httpCode);
48+
return ESP_OK;
49+
}
50+
return ESP_FAIL;
51+
52+
}
1453

1554
/*
1655
@@ -50,7 +89,7 @@ esp_err_t SendPictureHttp()
5089
fb_len = fb->len;
5190
HTTPClient http;
5291

53-
http.begin(CAMSERVER, root_ca); // Specify the URL and certificate
92+
http.begin(serverurl + "/muccam/", root_ca); // Specify the URL and certificate
5493
http.addHeader("Content-Type", "image/jpeg");
5594
http.addHeader("Content-Length", String(fb_len));
5695
http.addHeader("Filename", PICTURE);

esp32-cam-webserver.ino

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "src/parsebytes.h"
99
#include "time.h"
1010
#include <ESPmDNS.h>
11+
#include "soc/soc.h"
12+
#include "soc/rtc_cntl_reg.h"
1113

1214

1315
SET_LOOP_TASK_STACK_SIZE(12*1024);
@@ -75,8 +77,8 @@ extern esp_err_t SendPictureHttp();
7577

7678
unsigned long previousMillis;
7779

78-
// Every 5 Minutes
79-
const unsigned long interval = (5 * 60 * 1000);
80+
// Every 1 Minutes
81+
const unsigned long interval = (1 * 60 * 1000);
8082

8183
// Names for the Camera. (set these in myconfig.h)
8284
#if defined(CAM_NAME)
@@ -391,8 +393,12 @@ void StartCamera()
391393
// Start a 60 second watchdog timer
392394
esp_task_wdt_init(60, true);
393395
esp_task_wdt_add(NULL);
394-
//delay(60 * 1000);
395-
//ESP.restart();
396+
while (1)
397+
{
398+
flashLED(1500);
399+
delay(1500);
400+
}
401+
396402
}
397403
else
398404
{
@@ -711,6 +717,8 @@ void setup()
711717
Serial.println(baseVersion);
712718
Serial.println();
713719

720+
// WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
721+
714722
// Warn if no PSRAM is detected (typically user error with board selection in the IDE)
715723
if (!psramFound())
716724
{
@@ -734,7 +742,7 @@ void setup()
734742

735743
#if defined(LED_PIN) // If we have a notification LED, set it to output
736744
pinMode(LED_PIN, OUTPUT);
737-
digitalWrite(LED_PIN, LED_ON);
745+
digitalWrite(LED_PIN, LED_OFF);
738746
#endif
739747

740748
// Start the SPIFFS filesystem before we initialise the camera

platformio.ini

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
src_dir = ./
3535

3636
[env:esp32dev]
37-
platform = espressif32@^6.9.0
37+
platform = espressif32@^6.10.0
3838
board = esp32dev
3939
board_build.partitions = min_spiffs.csv
4040
framework = arduino
@@ -43,6 +43,8 @@ monitor_speed = 115200
4343
monitor_rts = 0
4444
monitor_dtr = 0
4545
build_type = debug
46+
lib_deps = bblanchon/ArduinoJson
47+
4648
monitor_filters = esp32_exception_decoder
4749
; log2file
4850
time

0 commit comments

Comments
 (0)