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

Enable possiblity to transition to ESP-IDF #73

Closed
wants to merge 20 commits into from
Closed
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
2 changes: 2 additions & 0 deletions .github/actions/build-firmware/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ runs:
steps:
- uses: actions/checkout@v4
if: ${{ !inputs.skip-checkout }}
with:
submodules: recursive

- uses: actions/cache@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ data/www
# ignore local config files
*.local

# Ignore esp-idf stuff
managed_components
dependencies.lock

# ignore generated files
.vs
packages
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "components/esp_littlefs"]
path = components/esp_littlefs
url = https://github.com/joltwallet/esp_littlefs.git
35 changes: 20 additions & 15 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
{
"recommendations": [
"ardenivanov.svelte-intellisense",
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"fivethree.vscode-svelte-snippets",
"gaborv.flatbuffers",
"ms-python.black-formatter",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"platformio.platformio-ide",
"svelte.svelte-vscode",
"xaver.clang-format"
]
// See http://go.microsoft.com/fwlink/?LinkId=827846
// for the documentation about the extensions.json format
"recommendations": [
"ardenivanov.svelte-intellisense",
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"fivethree.vscode-svelte-snippets",
"gaborv.flatbuffers",
"ms-python.black-formatter",
"ms-vscode.cpptools",
"ms-vscode.cpptools-extension-pack",
"platformio.platformio-ide",
"svelte.svelte-vscode",
"xaver.clang-format"
],
"unwantedRecommendations": [
"ms-vscode.cpptools-extension-pack"
]
}
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.16.0)

include($ENV{IDF_PATH}/tools/cmake/project.cmake)

list(APPEND EXTRA_COMPONENT_DIRS esp_littlefs)

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.
1 change: 1 addition & 0 deletions components/esp_littlefs
Submodule esp_littlefs added at b67106
3 changes: 3 additions & 0 deletions include/CaptivePortalInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "WebSocketDeFragger.h"

#include "StaticFileHandler.h"

#include <ESPAsyncWebServer.h>
#include <WebSocketsServer.h>

Expand Down Expand Up @@ -29,5 +31,6 @@ namespace OpenShock {
AsyncWebServer m_webServer;
WebSocketsServer m_socketServer;
WebSocketDeFragger m_socketDeFragger;
StaticFileHandler m_staticFileHandler;
};
} // namespace OpenShock
1 change: 0 additions & 1 deletion include/CertificateUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@

namespace OpenShock::CertificateUtils {
WiFiClientSecure GetSecureClient();
bool GetHostCertificate(const char* host, std::vector<char>& pem);
} // namespace OpenShock::CertificateUtils
21 changes: 21 additions & 0 deletions include/StaticFileHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include "Utils/FS.h"

#include <ESPAsyncWebServer.h>

namespace OpenShock {
class StaticFileHandler : public AsyncWebHandler {
public:
StaticFileHandler();

bool ok() const;
bool canServeFiles() const;

bool canHandle(AsyncWebServerRequest* request) override;
void handleRequest(AsyncWebServerRequest* request) override;

private:
std::shared_ptr<FileSystem> m_fileSystem;
};
} // namespace OpenShock
32 changes: 32 additions & 0 deletions include/Utils/FS.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include <cstdint>
#include <memory>

namespace OpenShock {
class FileSystem {
public:
static std::shared_ptr<FileSystem> GetWWW();
static std::shared_ptr<FileSystem> GetConfig();

FileSystem(const char* partitionLabel, const char* basePath, bool formatIfMountFailed, bool readOnly);
~FileSystem();

bool ok() const;

bool exists(const char* path) const;
bool canRead(const char* path) const;
bool canWrite(const char* path) const;
bool canReadAndWrite(const char* path) const;

bool deleteFile(const char* path);

bool format();
private:
bool _checkAccess(const char* path, int mode) const;

char* m_partitionLabel;
char* m_basePath;
bool m_readOnly;
};
} // namespace OpenShock
Loading
Loading