Add basic OTA updates handling (#3)

This commit is contained in:
Zdzislaw Goik 2022-03-02 22:14:00 +01:00 committed by GitHub
parent c80b665077
commit a569ac21e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View File

@ -2,5 +2,5 @@
#include "pinout.h"
namespace WiFiHandler {
void setupWifi();
void setupWifi(const char* ssid, const char* password);
}

View File

@ -1,2 +1,5 @@
const char* ssid = "";
const char* password = "";
const char* OTAPassword = ""; // if empty, no password will be required
uint16_t OTAServerPort = 3232;

View File

@ -15,8 +15,15 @@ framework = arduino
monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
build_flags = -O2
build_flags =
-O2
build_unflags = -Os
;upload_port = 192.168.1.43 ;replace this with your own ip
;upload_protocol = espota
upload_flags =
--auth=Password
board_build.partitions = min_spiffs.csv
lib_deps =
esp32-camera

View File

@ -1,9 +1,11 @@
#include <Arduino.h>
#include "pinout.h"
#include "credentials.h"
#include "WifiHandler.h"
#include "cameraHandler.h"
#include "LEDManager.h"
#include "httpdHandler.h"
#include "OTA.h"
void setup(){
Serial.begin(115200);
@ -14,12 +16,14 @@ void setup(){
LEDManager::setupLED();
// todo add blink handling
CameraHandler::setupCamera();
WiFiHandler::setupWifi();
WiFiHandler::setupWifi(ssid, password);
// todo add blink handling
HttpdHandler::startStreamServer();
LEDManager::on();
OTA::SetupOTA(OTAPassword, OTAServerPort);
}
void loop(){
delay(1);
OTA::HandleOTAUpdate();
}

View File

@ -1,9 +1,8 @@
#include "WifiHandler.h"
#include "credentials.h"
#include "LEDManager.h"
namespace WiFiHandler {
void setupWifi(){
void setupWifi(const char* ssid, const char* password){
Serial.println("Initializing connection to wifi");
WiFi.begin(ssid, password);