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

ESP-IDF conversion #254

Draft
wants to merge 16 commits into
base: develop
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
cmake_minimum_required(VERSION 3.16.0)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(Firmware)
16 changes: 0 additions & 16 deletions certificates/README.md

This file was deleted.

3,451 changes: 0 additions & 3,451 deletions certificates/cacrt_all.pem

This file was deleted.

227 changes: 0 additions & 227 deletions certificates/gen_crt_bundle.py

This file was deleted.

Binary file removed certificates/x509_crt_bundle
Binary file not shown.
3 changes: 1 addition & 2 deletions include/CaptivePortalInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ namespace OpenShock {
void handleWebSocketClientError(uint8_t socketId, uint16_t code, const char* message);
void handleWebSocketEvent(uint8_t socketId, WebSocketMessageType type, const uint8_t* payload, std::size_t length);

AsyncWebServer m_webServer;
WebSocketsServer m_socketServer;
httpd_handle_t m_httpServer;
WebSocketDeFragger m_socketDeFragger;
fs::LittleFSFS m_fileSystem;
DNSServer m_dnsServer;
Expand Down
29 changes: 12 additions & 17 deletions include/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
#include <cstdint>
#include <string_view>

#define DISABLE_COPY(TypeName) \
TypeName(const TypeName&) = delete; \
#define DISABLE_COPY(TypeName) \
TypeName(const TypeName&) = delete; \
void operator=(const TypeName&) = delete
#define DISABLE_MOVE(TypeName) \
TypeName(TypeName&&) = delete; \
#define DISABLE_MOVE(TypeName) \
TypeName(TypeName&&) = delete; \
void operator=(TypeName&&) = delete

#ifndef OPENSHOCK_API_DOMAIN
Expand All @@ -31,30 +31,25 @@

// Check if OPENSHOCK_FW_USERAGENT is overridden trough compiler flags, if not, generate a default useragent.
#ifndef OPENSHOCK_FW_USERAGENT
#define OPENSHOCK_FW_USERAGENT OPENSHOCK_FW_HOSTNAME "/" OPENSHOCK_FW_VERSION " (arduino-esp32; " OPENSHOCK_FW_BOARD "; " OPENSHOCK_FW_CHIP "; Espressif)"
#endif

// Check if Arduino.h exists, if not instruct the developer to remove "arduino-esp32" from the useragent and replace it with "ESP-IDF", after which the developer may remove this warning.
#if defined(__has_include) && !__has_include("Arduino.h")
#warning "Let it be known that Arduino hath finally been cast aside in favor of the noble ESP-IDF! I beseech thee, kind sir or madam, wouldst thou kindly partake in the honors of expunging 'arduino-esp32' from yonder useragent aloft, and in its stead, bestow the illustrious 'ESP-IDF'?"
#define OPENSHOCK_FW_USERAGENT OPENSHOCK_FW_HOSTNAME "/" OPENSHOCK_FW_VERSION " (esp-idf; " OPENSHOCK_FW_BOARD "; " OPENSHOCK_FW_CHIP "; Espressif)"
#endif

#if __cplusplus >= 202'302L
#warning "C++23 compiler detected"
#elif __cplusplus >= 202'002L
#warning "C++20 compiler detected"
// C++20 :3
#elif __cplusplus >= 201'703L
// C++17 :3
#warning "C++17 compiler detected, OpenShock requires a C++20 compliant compiler"
#elif __cplusplus >= 201'402L
#error "C++14 compiler detected, OpenShock requires a C++17 compliant compiler"
#error "C++14 compiler detected, OpenShock requires a C++20 compliant compiler"
#elif __cplusplus >= 201'103L
#error "C++11 compiler detected, OpenShock requires a C++17 compliant compiler"
#error "C++11 compiler detected, OpenShock requires a C++20 compliant compiler"
#elif __cplusplus >= 199'711L
#error "C++98 compiler detected, OpenShock requires a C++17 compliant compiler"
#error "C++98 compiler detected, OpenShock requires a C++20 compliant compiler"
#elif __cplusplus == 1
#error "Pre-C++98 compiler detected, OpenShock requires a C++17 compliant compiler"
#error "Pre-C++98 compiler detected, OpenShock requires a C++20 compliant compiler"
#else
#error "Unknown C++ standard detected, OpenShock requires a C++17 compliant compiler"
#error "Unknown C++ standard detected, OpenShock requires a C++20 compliant compiler"
#endif

namespace OpenShock::Constants {
Expand Down
5 changes: 2 additions & 3 deletions include/RGBPatternManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

#include "Common.h"

#include <driver/rmt_types.h>
#include <hal/gpio_types.h>

#include <freertos/semphr.h>
#include <freertos/task.h>

#include <esp32-hal-rmt.h>

#include <cstdint>
#include <vector>

Expand Down Expand Up @@ -45,7 +44,7 @@ namespace OpenShock {
gpio_num_t m_gpioPin;
uint8_t m_brightness; // 0-255
std::vector<RGBState> m_pattern;
rmt_obj_t* m_rmtHandle;
rmt_channel_handle_t m_channelHandle;
TaskHandle_t m_taskHandle;
SemaphoreHandle_t m_taskMutex;
};
Expand Down
Loading
Loading