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

Safeboot #30

Merged
merged 2 commits into from
Aug 13, 2024
Merged
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
7 changes: 1 addition & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@ jobs:
~/.cache/pip
~/.platformio

- name: Cache PlatformIO Dependencies (OSS)
uses: actions/cache@v4
with:
key: ${{ runner.os }}-pio-oss-${{ matrix.environment }}
path: .pio

- name: Python
uses: actions/setup-python@v5
with:
Expand All @@ -89,6 +83,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
pip install --upgrade cryptography
ref="${{ github.ref_name }}"
ref="${ref//\//}"
ref="${ref//-/}"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/cpplint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
--recursive \
--filter=-whitespace/line_length,-whitespace/braces,-whitespace/comments,-runtime/indentation_namespace,-whitespace/indent,-readability/braces,-whitespace/newline,-readability/todo,-build/c++11,-runtime/references \
--exclude=lib/DimmableLight \
--exclude=lib/ElegantOTAPro \
--exclude=lib/ESPDASHPro \
--exclude=lib/MycilaDimmer/doc \
--exclude=lib/WebSerialPro \
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[submodule "lib/ElegantOTAPro"]
path = lib/ElegantOTAPro
url = [email protected]:mathieucarbou/ElegantOTA-Pro.git
branch = yasolr
[submodule "lib/WebSerialPro"]
path = lib/WebSerialPro
url = [email protected]:mathieucarbou/WebSerial-Pro.git
Expand Down
18 changes: 18 additions & 0 deletions data/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ <h1>YaSolR Configuration</h1>
</form>
</td>
</tr>
<tr>
<td>
<form id="safeboot-form">
<button type="submit">Restart in SafeBoot mode</button>
</form>
</td>
</tr>
<tr>
<td>
<form id="backup-form" method="get" action="/api/config/backup" target="_blank">
Expand Down Expand Up @@ -325,6 +332,17 @@ <h1>YaSolR Configuration</h1>
});
});

document
.getElementById("safeboot-form")
.addEventListener("submit", function (event) {
event.preventDefault();
fetch("/api/system/safeboot", { method: "POST" }).then((res) => {
setTimeout(function () {
window.location.reload();
}, 2000);
});
});

document
.getElementById("reset-form")
.addEventListener("submit", function (event) {
Expand Down
4 changes: 1 addition & 3 deletions include/YaSolR.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@

#ifdef APP_MODEL_PRO
#include <ESPDashPro.h>
#include <ElegantOTAPro.h>
#include <WebSerialPro.h>
#else
#include <ESPDash.h>
#include <ElegantOTA.h>
#include <MycilaWebSerial.h>
#endif

Expand Down Expand Up @@ -91,7 +89,7 @@ extern Mycila::Task dashboardTask;
extern Mycila::Task debugTask;
extern Mycila::Task networkConfigTask;
extern Mycila::Task networkManagerTask;
extern Mycila::Task otaTask;
extern Mycila::Task safeBootTask;
extern Mycila::Task resetTask;
extern Mycila::Task restartTask;
#ifdef APP_MODEL_TRIAL
Expand Down
3 changes: 2 additions & 1 deletion include/YaSolRWebsite.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ namespace YaSolR {
Tab _managementTab = Tab(&dashboard, "\u2764 " YASOLR_LBL_078);
Card _configBackup = Card(&dashboard, LINK_CARD, YASOLR_LBL_079);
Card _configRestore = Card(&dashboard, FILE_UPLOAD_CARD, YASOLR_LBL_080, ".txt");
Card _otaLink = Card(&dashboard, LINK_CARD, YASOLR_LBL_081);
Card _restart = Card(&dashboard, PUSH_BUTTON_CARD, YASOLR_LBL_082);
Card _safeBoot = Card(&dashboard, PUSH_BUTTON_CARD, YASOLR_LBL_081);
Card _energyReset = Card(&dashboard, PUSH_BUTTON_CARD, YASOLR_LBL_085);
Card _reset = Card(&dashboard, PUSH_BUTTON_CARD, YASOLR_LBL_086);
Card _debugMode = Card(&dashboard, BUTTON_CARD, YASOLR_LBL_083);
Expand All @@ -212,6 +212,7 @@ namespace YaSolR {
Card _mqttPwd = Card(&dashboard, PASSWORD_CARD, YASOLR_LBL_099);
Card _mqttSecured = Card(&dashboard, BUTTON_CARD, YASOLR_LBL_100);
Card _mqttServerCert = Card(&dashboard, FILE_UPLOAD_CARD, YASOLR_LBL_101, ".pem,crt,der");
Card _mqttServerCertDelete = Card(&dashboard, PUSH_BUTTON_CARD, YASOLR_LBL_049);
Card _mqttPublishInterval = Card(&dashboard, SLIDER_CARD, YASOLR_LBL_102, "s", 5, 30, 1);
Card _mqttTopic = Card(&dashboard, TEXT_INPUT_CARD, YASOLR_LBL_103);
Card _haDiscovery = Card(&dashboard, BUTTON_CARD, YASOLR_LBL_104);
Expand Down
4 changes: 2 additions & 2 deletions include/i18n/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
#define YASOLR_LBL_046 "Output 1"
#define YASOLR_LBL_047 "Status"
#define YASOLR_LBL_050 "Dimmer"
#define YASOLR_LBL_049
#define YASOLR_LBL_049 "Remove Server Certificate"
#define YASOLR_LBL_051 "Bypass"
#define YASOLR_LBL_052 "Power"
#define YASOLR_LBL_053 "Apparent Power"
Expand Down Expand Up @@ -80,7 +80,7 @@
#define YASOLR_LBL_078 "Management"
#define YASOLR_LBL_079 "Configuration Backup"
#define YASOLR_LBL_080 "Configuration Restore"
#define YASOLR_LBL_081 "OTA Firmware Update"
#define YASOLR_LBL_081 "Restart in SafeBoot mode"
#define YASOLR_LBL_082 "Restart"
#define YASOLR_LBL_083 "Debug"
#define YASOLR_LBL_084 "Console"
Expand Down
4 changes: 2 additions & 2 deletions include/i18n/fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
#define YASOLR_LBL_046 "Sortie 1"
#define YASOLR_LBL_047 "État"
#define YASOLR_LBL_048 "Température"
#define YASOLR_LBL_049
#define YASOLR_LBL_049 "Supprimer le certificat serveur"
#define YASOLR_LBL_050 "variateur"
#define YASOLR_LBL_051 "Marche forcée"
#define YASOLR_LBL_052 "Puissance"
Expand Down Expand Up @@ -84,7 +84,7 @@
#define YASOLR_LBL_078 "Gestion"
#define YASOLR_LBL_079 "Backup de la configuration"
#define YASOLR_LBL_080 "Restauration de la configuration"
#define YASOLR_LBL_081 "Mise à jour du micrologiciel OTA"
#define YASOLR_LBL_081 "Redémarrer en mode SafeBoot"
#define YASOLR_LBL_082 "Redémarrer"
#define YASOLR_LBL_083 "Débogage"
#define YASOLR_LBL_084 "Console"
Expand Down
1 change: 0 additions & 1 deletion lib/ElegantOTAPro
Submodule ElegantOTAPro deleted from a5f3a6
68 changes: 43 additions & 25 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,41 @@ extra_configs = platformio_override.ini
default_envs = pro-esp32, pro-esp32s3, pro-lilygo_eth_lite_s3, pro-wt32_eth01

[env]
build_type = release
framework = arduino
; platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip
platform = [email protected]
platform_packages=
platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.4
platformio/framework-arduinoespressif32-libs @ https://github.com/espressif/arduino-esp32/releases/download/3.0.4/esp32-arduino-libs-3.0.4.zip
board = esp32dev
platform = https://github.com/pioarduino/platform-espressif32/releases/download/51.03.04/platform-espressif32.zip

monitor_filters = esp32_exception_decoder, log2file
monitor_speed = 115200
upload_protocol = esptool
; upload_speed = 921600
; upload_protocol = custom
; upload_url = http://192.168.125.119

extra_scripts =
pre:tools/data.py
pre:tools/cacerts.py
pre:tools/version.py
post:tools/factory.py
; tools/upload.py

custom_cacert_url = https://curl.se/ca/cacert.pem
; custom_cacert_url = https://raw.githubusercontent.com/adafruit/certificates/main/data/roots.pem

board_build.partitions = tools/partitions-4MB-safeboot.csv
board_build.app_partition_name = app
board_build.filesystem = littlefs

board_build.embed_files =
.pio/data/cacerts.bin
.pio/data/logo.png.gz
.pio/data/logo-icon.png.gz
.pio/data/config.html.gz

lib_compat_mode = strict
lib_ldf_mode = chain
; https://github.com/espressif/arduino-esp32/issues/9782
; lib_ldf_mode = deep+
lib_deps =
DNSServer
ESP32 Async UDP
; ESPmDNS
ESPmDNS
FS
Networking
LittleFS
Expand All @@ -58,16 +67,17 @@ lib_deps =
mathieucarbou/MycilaHADiscovery @ 2.2.2
mathieucarbou/MycilaJSY @ 9.1.6
mathieucarbou/MycilaLogger @ 3.1.2
mathieucarbou/MycilaMQTT @ 4.2.0
mathieucarbou/MycilaMQTT @ 4.2.1
mathieucarbou/MycilaNTP @ 4.0.0
mathieucarbou/MycilaPulseAnalyzer @ 1.0.2
mathieucarbou/MycilaPZEM004Tv3 @ 4.0.7
mathieucarbou/MycilaRelay @ 4.0.1
mathieucarbou/MycilaSystem @ 2.0.6
mathieucarbou/MycilaSystem @ 2.0.8
mathieucarbou/MycilaTaskManager @ 3.1.2
mathieucarbou/MycilaTaskMonitor @ 3.0.1
mathieucarbou/MycilaTrafficLight @ 1.0.0
mathieucarbou/MycilaUtilities @ 1.3.7

build_flags =
; Stack sizes
-D ARDUINO_LOOP_STACK_SIZE=4096
Expand All @@ -94,7 +104,7 @@ build_flags =
-D MYCILA_JSON_SUPPORT
-D MYCILA_LOGGER_SUPPORT
; ESPConnect
-D ESPCONNECT_NO_MDNS
; -D ESPCONNECT_NO_MDNS
; MQTT
-D CONFIG_MQTT_TASK_CORE_SELECTION=1
-D MQTT_REPORT_DELETED_MESSAGES=1
Expand All @@ -108,8 +118,7 @@ build_flags =
-D DASH_DEFAULT_CARD_SIZE_XL=6
-D DASH_DEFAULT_CARD_SIZE_XS=12
-D DASH_DEFAULT_CARD_SIZE_XXL=3
; ElegantOTA
-D ELEGANTOTA_USE_ASYNC_WEBSERVER=1
; -D DASH_JSON_SIZE=4096
; WebSerial
-D WSL_HIGH_PERF
; YaSolR
Expand All @@ -129,13 +138,6 @@ build_flags =
-D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_INFO
build_unflags =
-std=gnu++11
build_type = release
board_build.partitions = tools/partitions-4MB.csv
board_build.filesystem = littlefs
board_build.embed_files =
.pio/data/logo.png.gz
.pio/data/logo-icon.png.gz
.pio/data/config.html.gz

; --------------------------------------------------------------------
; MODELS
Expand All @@ -145,10 +147,8 @@ board_build.embed_files =
build_flags = -D APP_MODEL_OSS
lib_deps =
mathieucarbou/MycilaWebSerial @ 6.3.0
ayushsharma82/ElegantOTA @ 3.1.4
https://github.com/mathieucarbou/ayushsharma82-ESP-DASH#dev
lib_ignore =
ElegantOTAPro
ESPDASHPro
WebSerialPro

Expand Down Expand Up @@ -200,6 +200,8 @@ build_flags =
; esp32dev (defaul)

[env:oss-esp32]
board = esp32dev
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32dev.bin
lib_deps =
${env.lib_deps}
${oss.lib_deps}
Expand All @@ -211,6 +213,8 @@ build_flags =
${oss.build_flags}

[env:pro-esp32]
board = esp32dev
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32dev.bin
lib_deps =
${env.lib_deps}
${pro.lib_deps}
Expand All @@ -222,6 +226,8 @@ build_flags =
${pro.build_flags}

[env:trial-esp32]
board = esp32dev
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32dev.bin
lib_deps =
${env.lib_deps}
${trial.lib_deps}
Expand All @@ -245,6 +251,7 @@ build_flags =
[env:oss-esp32s3]
extends = env:oss-esp32
board = esp32-s3-devkitc-1
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32-s3-devkitc-1.bin
build_flags =
${env.build_flags}
${oss.build_flags}
Expand All @@ -253,6 +260,7 @@ build_flags =
[env:pro-esp32s3]
extends = env:pro-esp32
board = esp32-s3-devkitc-1
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32-s3-devkitc-1.bin
build_flags =
${env.build_flags}
${pro.build_flags}
Expand All @@ -261,6 +269,7 @@ build_flags =
[env:trial-esp32s3]
extends = env:trial-esp32
board = esp32-s3-devkitc-1
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32-s3-devkitc-1.bin
build_flags =
${env.build_flags}
${trial.build_flags}
Expand All @@ -275,6 +284,7 @@ build_flags =
; [env:oss-esp32_poe]
; extends = env:oss-esp32
; board = esp32-poe
; custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32-poe.bin
; build_flags =
; ${env.build_flags}
; ${oss.build_flags}
Expand All @@ -283,6 +293,7 @@ build_flags =
; [env:pro-esp32_poe]
; extends = env:pro-esp32
; board = esp32-poe
; custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32-poe.bin
; build_flags =
; ${env.build_flags}
; ${pro.build_flags}
Expand All @@ -291,6 +302,7 @@ build_flags =
; [env:trial-esp32_poe]
; extends = env:trial-esp32
; board = esp32-poe
; custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32-poe.bin
; build_flags =
; ${env.build_flags}
; ${trial.build_flags}
Expand Down Expand Up @@ -323,6 +335,7 @@ build_flags =
[env:oss-wt32_eth01]
extends = env:oss-esp32
board = wt32-eth01
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-wt32-eth01.bin
upload_speed = 460800
build_flags =
${env.build_flags}
Expand All @@ -332,6 +345,7 @@ build_flags =
[env:pro-wt32_eth01]
extends = env:pro-esp32
board = wt32-eth01
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-wt32-eth01.bin
upload_speed = 460800
build_flags =
${env.build_flags}
Expand All @@ -341,6 +355,7 @@ build_flags =
[env:trial-wt32_eth01]
extends = env:trial-esp32
board = wt32-eth01
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-wt32-eth01.bin
upload_speed = 460800
build_flags =
${env.build_flags}
Expand Down Expand Up @@ -382,6 +397,7 @@ build_flags =
[env:oss-lilygo_eth_lite_s3]
extends = env:oss-esp32
board = esp32s3box
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32s3box.bin
upload_speed = 115200
build_flags =
${env.build_flags}
Expand All @@ -391,6 +407,7 @@ build_flags =
[env:pro-lilygo_eth_lite_s3]
extends = env:pro-esp32
board = esp32s3box
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32s3box.bin
upload_speed = 115200
build_flags =
${env.build_flags}
Expand All @@ -400,6 +417,7 @@ build_flags =
[env:trial-lilygo_eth_lite_s3]
extends = env:trial-esp32
board = esp32s3box
custom_safeboot_url = https://github.com/mathieucarbou/MycilaSafeBoot/releases/download/v1.0.0/safeboot-esp32s3box.bin
upload_speed = 115200
build_flags =
${env.build_flags}
Expand Down
Loading