Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ESP32-CAM modules #292

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,23 @@ upload_speed = 115200
; Uncomment this line if you want to define the protocol. Autodetected otherwise.
; upload_protocol = espota

lib_deps =
PubSubClient

[env:esp32-cam]
platform = espressif32
board = esp32cam
framework = arduino
board_build.partitions = min_spiffs.csv
monitor_speed = 115200
upload_speed = 115200
; Uncomment this line to allow for remote upgrade. If name resolution does not work for you, replace with the IP of ESPAltherma
; upload_port = ESPAltherma.local
; Uncomment this line if you want to define the protocol. Autodetected otherwise.
; upload_protocol = espota
; upload_flags =
; --host_port=45678

lib_deps =
PubSubClient

Expand Down
14 changes: 14 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,11 @@ void setup()
pinMode(PIN_THERM, OUTPUT);
digitalWrite(PIN_THERM, HIGH);

#ifdef PIN_LED
// LED for WiFi indicator
pinMode(PIN_LED, OUTPUT);
#endif

#ifdef PIN_SG1
//Smartgrid pins - Set first to the inactive state, before configuring as outputs (avoid false triggering when initializing)
digitalWrite(PIN_SG1, SG_RELAY_INACTIVE_STATE);
Expand All @@ -219,6 +224,7 @@ void setup()
mqttSerial.print("Setting up wifi...");
setup_wifi();
ArduinoOTA.setHostname("ESPAltherma");
ArduinoOTA.setTimeout(3000);
ArduinoOTA.onStart([]() {
busy = true;
});
Expand Down Expand Up @@ -255,8 +261,16 @@ void loop()
unsigned long start = millis();
if (WiFi.status() != WL_CONNECTED)
{ //restart board if needed
#ifdef PIN_LED
digitalWrite(PIN_LED, HIGH);
#endif
checkWifi();
}

#ifdef PIN_LED
digitalWrite(PIN_LED, LOW);
#endif

if (!client.connected())
{ //(re)connect to MQTT if needed
reconnectMqtt();
Expand Down
3 changes: 3 additions & 0 deletions src/setup.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,6 @@
#ifndef PROTOCOL
#define PROTOCOL 'I'
#endif

// LED pin to use with WiFi indicator (if present)
//#define PIN_LED 33