Big update

- Removed credentials.h && pinouts.h
- Added wifi environment and pinouts env to ini file

To get rid of the extra header files i migrated the settings to the ini
This is much cleaner imo and easier to maintain.
I added explixit commets to guide the user to the right section to add their wifi details
This commit is contained in:
ZanzyTHEbar 2022-07-18 16:23:36 +01:00 committed by Zdzislaw Goik
parent 06ca809d26
commit 7da2449733
7 changed files with 76 additions and 41 deletions

View File

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

View File

@ -1,18 +0,0 @@
// AI Tinker camera, the ov2650
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27
#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22

View File

@ -4,7 +4,6 @@ LEDManager::LEDManager(byte pin) : _ledPin(pin), _previousMillis(0), _ledState(f
LEDManager::~LEDManager() {}
void LEDManager::begin()
{
pinMode(_ledPin, OUTPUT);
@ -19,7 +18,6 @@ void LEDManager::begin()
} */
}
void LEDManager::onOff(bool state) const
{
digitalWrite(_ledPin, state);

View File

@ -1,5 +1,4 @@
#pragma once
#include "pinout.h"
#include "esp_camera.h"
#include <Arduino.h>

View File

@ -1,6 +1,5 @@
#pragma once
#include <WiFi.h>
#include "pinout.h"
#include "../../data/StateManager/StateManager.hpp"
namespace WiFiHandler

View File

@ -9,7 +9,35 @@
; https://docs.platformio.org/page/projectconf.html
[platformio]
default_envs = debug
default_envs = debug ; do not change this value
; The below options are available for all environments
; The ssid and password are requried for the trackers to connect to your network!!!
[wifi]
ssid="your_ssid_goes_here" ; your wifi network name goes here
password="your_password_goes_here" ; Place your Wifi password here
OTAPassword="" ; if empty, no password will be required
OTAServerPort=3232
; DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU ARE DOING
[pinouts]
; AI Tinker camera, the ov2650
PWDN_GPIO_NUM = 32
RESET_GPIO_NUM = -1
XCLK_GPIO_NUM = 0
SIOD_GPIO_NUM = 26
SIOC_GPIO_NUM = 27
Y9_GPIO_NUM = 35
Y8_GPIO_NUM = 34
Y7_GPIO_NUM = 39
Y6_GPIO_NUM = 36
Y5_GPIO_NUM = 21
Y4_GPIO_NUM = 19
Y3_GPIO_NUM = 18
Y2_GPIO_NUM = 5
VSYNC_GPIO_NUM = 25
HREF_GPIO_NUM = 23
PCLK_GPIO_NUM = 22
[common]
platform = espressif32
@ -19,12 +47,45 @@ monitor_speed = 115200
monitor_rts = 0
monitor_dtr = 0
build_flags =
'-DMDNS_TRACKER_NAME="OpenIrisTracker"' ; Set the tracker name - The string literal tells platformio to include the quatations in the string - making sure that the compiler sees the string as a cstring
-DOTA_SERVER_PORT=${wifi.OTAServerPort} ; Set the OTA server
'-DOTA_PASSWORD=${wifi.OTAPassword}' ; Set the OTA password
'-DWIFI_SSID=${wifi.ssid}' ; Set the users wifi network name
'-DWIFI_PASSWORD=${wifi.password}' ; Set the users wifi network password
-DDEBUG_ESP_PORT=Serial
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-I include
-include "pinout.h" ; this has been added for future movement to a proper library structure
;-I include
;-include "pinout.h" ; this has been added for future movement to a proper library structure
;-include "credentials.h" ; this has been added for future movement to a proper library structure
; CAMERA PINOUT DEFINITIONS
-DPWDN_GPIO_NUM=${pinouts.PWDN_GPIO_NUM} ; Set the PWDN pin
-DRESET_GPIO_NUM=${pinouts.RESET_GPIO_NUM} ; Set the RESET pin
-DXCLK_GPIO_NUM=${pinouts.XCLK_GPIO_NUM} ; Set the XCLK pin
-DSIOD_GPIO_NUM=${pinouts.SIOD_GPIO_NUM} ; Set the SIOD pin
-DSIOC_GPIO_NUM=${pinouts.SIOC_GPIO_NUM} ; Set the SIOC pin
-DY9_GPIO_NUM=${pinouts.Y9_GPIO_NUM} ; Set the Y9 pin
-DY8_GPIO_NUM=${pinouts.Y8_GPIO_NUM} ; Set the Y8 pin
-DY7_GPIO_NUM=${pinouts.Y7_GPIO_NUM} ; Set the Y7 pin
-DY6_GPIO_NUM=${pinouts.Y6_GPIO_NUM} ; Set the Y6 pin
-DY5_GPIO_NUM=${pinouts.Y5_GPIO_NUM} ; Set the Y5 pin
-DY4_GPIO_NUM=${pinouts.Y4_GPIO_NUM} ; Set the Y4 pin
-DY3_GPIO_NUM=${pinouts.Y3_GPIO_NUM} ; Set the Y3 pin
-DY2_GPIO_NUM=${pinouts.Y2_GPIO_NUM} ; Set the Y2 pin
-DVSYNC_GPIO_NUM=${pinouts.VSYNC_GPIO_NUM} ; Set the VSYNC pin
-DHREF_GPIO_NUM=${pinouts.HREF_GPIO_NUM} ; Set the HREF pin
-DPCLK_GPIO_NUM=${pinouts.PCLK_GPIO_NUM} ; Set the PCLK pin
build_unflags = -Os
board_build.partitions = min_spiffs.csv
lib_ldf_mode = deep+

View File

@ -1,6 +1,4 @@
#include <Arduino.h>
#include "pinout.h"
#include "credentials.h"
#include <network/WifiHandler/WifiHandler.hpp>
#include <network/mDNS/MDNSManager.hpp>
#include <io/camera/cameraHandler.hpp>
@ -10,10 +8,6 @@
#include <network/OTA/OTA.hpp>
const char *MDSNTrackerName = "OpenIrisTracker";
int STREAM_SERVER_PORT = 80;
int CONTROL_SERVER_PORT = 81;
@ -23,6 +17,13 @@ CameraHandler cameraHandler;
APIServer apiServer(CONTROL_SERVER_PORT, &cameraHandler);
StreamServer streamServer(STREAM_SERVER_PORT);
//******************************************************************************
// * Welcome to OpenIris!
// * Please make sure you have the following:
// * 1. A camera connected to the ESP32
// * 2. Your wifi credentials saved in the platformio.ini file
// * 3. You have downloaded our app and installed it on your PC
// ******************************************************************************
void setup()
{
Serial.begin(115200);
@ -30,13 +31,13 @@ void setup()
ledManager.begin();
cameraHandler.setupCamera();
WiFiHandler::setupWifi(ssid, password, &wifiStateManager);
MDNSHandler::setupMDNS(MDSNTrackerName, &mdnsStateManager);
WiFiHandler::setupWifi(WIFI_SSID, WIFI_PASSWORD, &wifiStateManager);
MDNSHandler::setupMDNS(MDNS_TRACKER_NAME, &mdnsStateManager);
apiServer.startAPIServer();
streamServer.startStreamServer();
ledManager.onOff(true);
ota.SetupOTA(OTAPassword, OTAServerPort);
ota.SetupOTA(OTA_PASSWORD, OTA_SERVER_PORT);
}
void loop()