12 Commits

Author SHA1 Message Date
2bc3e68119 Add esp idf build workflow
Some checks failed
clang-format Check / Formatting Check (map[check:main/src exclude:]) (push) Has been cancelled
2023-11-26 19:32:39 +01:00
d254049421 Try official clang-format action
Some checks failed
clang-format Check / Formatting Check (map[check:main/src exclude:]) (push) Failing after 10s
2023-11-26 19:15:28 +01:00
a84ad5b430 Use newest version of clang format action
Some checks failed
clang-format Check / Formatting Check (map[check:main/src]) (push) Failing after 5s
2023-11-26 19:09:00 +01:00
8fc5c0ead6 Test commit
Some checks failed
clang-format Check / Formatting Check (map[check:main/src]) (push) Failing after 56s
2023-11-26 18:59:39 +01:00
6f09edbdfd CI test commit
Some checks failed
clang-format Check / Formatting Check (map[check:main/src]) (push) Failing after 54m36s
2023-11-25 18:48:50 +01:00
9b41d1d399 Change ubuntu version to 20.04
Some checks failed
clang-format Check / Formatting Check (map[check:main/src]) (push) Failing after 46s
2023-11-25 18:13:49 +01:00
1bcb7a7981 Test new version of action for workflow
Some checks failed
clang-format Check / Formatting Check (map[check:main/src]) (push) Failing after 38s
2023-11-25 17:56:42 +01:00
c8dc085cc7 Add main/src folder to format check paths
Some checks failed
clang-format Check / Formatting Check (components) (push) Successful in 22s
clang-format Check / Formatting Check (main/src) (push) Failing after 22s
2023-11-25 17:50:41 +01:00
f91d7b5335 Add clang format and corresponding ci action
Some checks failed
clang-format Check / Formatting Check (components) (push) Successful in 2m43s
clang-format Check / Formatting Check (main) (push) Failing after 30s
2023-11-25 17:46:16 +01:00
da6a2d9d28 Add nanofmt as submodule 2023-09-11 01:10:06 +02:00
6f0acc90c3 Add first version of setup.html 2023-09-11 00:58:32 +02:00
e90941ba91 Add build dirs to gitignore 2023-09-10 23:23:56 +02:00
9 changed files with 244 additions and 0 deletions

28
.clang-format Normal file
View File

@@ -0,0 +1,28 @@
BasedOnStyle: LLVM
Language: Cpp
IndentWidth: 4
UseTab: Never
#NamespaceIndentation: All
PointerAlignment: Left
AccessModifierOffset: -4
AlwaysBreakTemplateDeclarations: true
LambdaBodyIndentation: Signature
MaxEmptyLinesToKeep: 3
#ColumnLimit: 128
CompactNamespaces: true
FixNamespaceComments: true
AllowShortFunctionsOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
AlignConsecutiveAssignments: true
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: true
AlignConsecutiveMacros: true
#BraceWrapping:
# BeforeElse: true

View File

@@ -0,0 +1,16 @@
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: esp-idf build
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: v4.4
target: esp32s2
path: 'esp32-s2-hmi-devkit-1/examples/smart-panel'

View File

@@ -0,0 +1,20 @@
name: clang-format Check
on: [push, pull_request]
jobs:
formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
strategy:
matrix:
path:
- check: 'main/src'
exclude: '' # Nothing to exclude
steps:
- uses: actions/checkout@v3
- name: Run clang-format style check for C/C++/Protobuf programs.
uses: jidicula/clang-format-action@v4.11.0
with:
clang-format-version: '13'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}
fallback-style: 'Mozilla' # optional

3
.gitignore vendored
View File

@@ -10,3 +10,6 @@ sdkconfig.old
cmake-build-debug cmake-build-debug
cmake-build-release cmake-build-release
cmake-build-relwithdebinfo cmake-build-relwithdebinfo
cmake-build-debug-docker/
cmake-build-release-docker/
cmake-build-relwithdebinfo-docker/

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "components/nanofmt/nanofmt"]
path = components/nanofmt/nanofmt
url = https://github.com/antsouchlos/nanofmt.git

View File

@@ -0,0 +1,2 @@
idf_component_register(SRCS "nanofmt/src/serialize.cpp"
INCLUDE_DIRS "nanofmt/include")

View File

@@ -13,6 +13,8 @@
#include "esp_flash.h" #include "esp_flash.h"
#include "esp_system.h" #include "esp_system.h"
#include "nanofmt/format.h"
extern "C" void app_main(void) extern "C" void app_main(void)
{ {
printf("Hello world!\n"); printf("Hello world!\n");

169
res/setup.html Normal file
View File

@@ -0,0 +1,169 @@
<html>
<head>
<title>CommonSense</title>
<style>
body {
margin: 0;
background-color: #022B3C;
}
#wrapper {
position: fixed;
width: 80%;
margin: 5% 10% 5% 10%;
background-color: #93A3B1;
}
#header {
background-color: #491D30;
text-align: center;
vertical-align: middle;
color: white;
font-weight: bold;
font-size: 15pt;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
}
#header-text {
padding: 15px;
}
#tab {
overflow: hidden;
}
#tab button {
background-color: inherit;
color: white;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 14px 16px;
transition: 0.3s;
}
#tab button:hover {
background-color: #DC7D6A;
}
#tab button.active {
background-color: #93A3B1;
color: black;
}
.tabcontent {
display: none;
text-align: left;
margin: 20px 10% 20px 10%;
}
#container {
padding: 50px 30% 20px 30%;
text-align: left;
}
#footer {
text-align: center;
padding: 10px;
}
.card {
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
transition: 0.3s;
border-radius: 11px 11px 5px 5px;
}
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
table tr th {
text-align: right;
}
th, td {
padding: 0 15px 0 15px;
}
</style>
<script>
function openTab(evt, tabName) {
// Declare all variables
var i, tabcontent, tablinks;
// Get all elements with class="tabcontent" and hide them
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none";
}
// Get all elements with class="tablinks" and remove the class "active"
tablinks = document.getElementsByClassName("tablink");
for (i = 0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
// Show the current tab, and add an "active" class to the button that opened the tab
document.getElementById(tabName).style.display = "block";
evt.currentTarget.className += " active";
}
</script>
</head>
<body>
<div id="wrapper" class="card">
<div id="header">
<div id="header-text">
CommonSense
</div>
<div id="tab">
<button class="tablink" onclick="openTab(event, 'Setup')" id="defaultOpen">Setup</button>
<button class="tablink" onclick="openTab(event, 'Info')">Info</button>
</div>
</div>
<div id="Setup" class="tabcontent">
Please enter the WiFi network name and password below.
The device will restart and attempt to connect to the given network.
If the connection is unsuccessful, the setup access point will be activated again.
<form method="post">
<div id="container">
<label for="uname"><b>Network</b></label>
<input type="text" placeholder="Enter Network Name" name="uname" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit">Apply & Reboot</button>
</div>
</form>
</div>
<div id="Info" class="tabcontent">
<table>
<tr>
<th>Version</th>
</tr>
<tr>
<th>Commit Hash</th>
</tr>
</table>
</div>
<div id="footer">
<hr />
Copyright &copy Andreas Tsouchlos 2023
</div>
<script>
document.getElementById("defaultOpen").click();
</script>
</div>
</body>
</html>