Skip to content

Commit

Permalink
[CI] Web upload factorizing and ESP Web Tools update (#1862)
Browse files Browse the repository at this point in the history
Update esp web tools
Simplify scripts
Add serial console
  • Loading branch information
1technophile authored Jan 11, 2024
1 parent 8fa47d2 commit d7d5d08
Show file tree
Hide file tree
Showing 9 changed files with 232 additions and 345 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
- "esp32s3-dev-c1-ble"
- "esp32c3-dev-m1-ble"
- "airm2m_core_esp32c3"
- "lolin_c3_mini"
- "esp32c3_lolin_mini"
- "esp32c3-m5stamp"
- "thingpulse-espgateway"
- "theengs-bridge"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build_and_docs_to_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
curl -o docs/.vuepress/public/commonConfig.js https://www.theengs.io/commonConfig.js
- name: Build documentation
run: |
python ./scripts/gen_wu_dev.py
python ./scripts/gen_wu.py --dev
npm run docs:build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
2 changes: 1 addition & 1 deletion docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module.exports = {
['link', { rel: 'mask-icon', href: '/icons/safari-pinned-tab.svg', color: '#3eaf7c' }],
['meta', { name: 'msapplication-TileImage', content: '/favicon-144x144.png' }],
['meta', { name: 'msapplication-TileColor', content: '#000000' }],
['script', {type: 'module', src: 'https://unpkg.com/esp-web-tools@3.5.0/dist/web/install-button.js?module'}]
['script', {type: 'module', src: 'https://unpkg.com/esp-web-tools@9.4.3/dist/web/install-button.js?module'}]
],
themeConfig: {
repo: '1technophile/OpenMQTTGateway',
Expand Down
11 changes: 11 additions & 0 deletions docs/.vuepress/styles/index.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// index.styl
div.table-generated-page
main
div.content__default,
footer.page-edit,
div.page-nav
// Display full with the API pages
max-width: 65%

.sidebar
z-index 6
5 changes: 5 additions & 0 deletions docs/upload/web-install.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
pageClass: table-generated-page
---

# (Option 1) Upload from the web

[![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fdocs.openmqttgateway.com%2Fupload%2Fweb-install.html&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com)
Expand All @@ -22,6 +26,7 @@ You can upload the firmware to your ESP device directly from here.

<web-uploader/>

Upload powered by [ESP Web Tools](https://esphome.github.io/esp-web-tools/)

## Using OpenMQTTGateway ?
Support open-source development through sponsorship and gain exclusive access to our private forum. Your questions, issues, and feature requests will receive priority attention, plus you'll gain insider access to our roadmap.
Expand Down
8 changes: 4 additions & 4 deletions environments.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1716,7 +1716,7 @@ build_flags =
custom_description = BLE gateway on Espressiv ESP32-C3-DevKitC-02 without logging

; Wemos Lolin C3 mini v2.1.0
[env:lolin_c3_mini]
[env:esp32c3_lolin_mini]
platform = ${com.esp32_platform}
board = lolin_c3_mini
board_build.partitions = min_spiffs.csv
Expand Down Expand Up @@ -1746,10 +1746,10 @@ build_flags =
custom_description = BLE gateway on ESP32C3
custom_hardware = Wemos Lolin C3 mini v2.1.0

[env:lolin_c3_mini_with_serial]
extends = env:lolin_c3_mini
[env:esp32c3_lolin_mini_with_serial]
extends = env:esp32c3_lolin_mini
build_flags =
${env:lolin_c3_mini.build_flags}
${env:esp32c3_lolin_mini.build_flags}
'-DLOG_LEVEL=LOG_LEVEL_NOTICE' ;default
'-DWM_DEBUG_LEVEL=1' ;DEBUG_NOTIFY=1, default value
; Serial output via USB
Expand Down
114 changes: 114 additions & 0 deletions scripts/common_wu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
import string

mf_temp32 = string.Template('''{
"name": "OpenMQTTGateway",
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP32",
"improv": false,
"parts": [
{ "path": "$cp$bl", "offset": 4096 },
{ "path": "$cp$part", "offset": 32768 },
{ "path": "$cp$boot", "offset": 57344 },
{ "path": "$cp$bin", "offset": 65536 }
]
}
]
}''')

mf_temp32c3 = string.Template('''{
"name": "OpenMQTTGateway",
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP32-C3",
"improv": false,
"parts": [
{ "path": "$cp$bl", "offset": 0 },
{ "path": "$cp$part", "offset": 32768 },
{ "path": "$cp$boot", "offset": 57344 },
{ "path": "$cp$bin", "offset": 65536 }
]
}
]
}''')

mf_temp32s3 = string.Template('''{
"name": "OpenMQTTGateway",
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP32-S3",
"improv": false,
"parts": [
{ "path": "$cp$bl", "offset": 0 },
{ "path": "$cp$part", "offset": 32768 },
{ "path": "$cp$boot", "offset": 57344 },
{ "path": "$cp$bin", "offset": 65536 }
]
}
]
}''')

mf_temp8266 = string.Template('''{
"name": "OpenMQTTGateway",
"new_install_prompt_erase": true,
"builds": [
{
"chipFamily": "ESP8266",
"parts": [{ "path": "$cp$bin", "offset": 0 }]
}
]
}''')

wu_temp_opt = string.Template('''
<option
value="$mff"
>
$mfn
</option>
''')

wu_temp_p1 = '''<template>
<div align="center">
<select>
<optgroup label="ESP32">'''

wu_temp_p2 = '''
</optgroup>
<optgroup label="ESP32C3">'''

wu_temp_p3 = '''
</optgroup>
<optgroup label="ESP32S3">'''

wu_temp_p4 = '''
</optgroup>
<optgroup label="ESP8266">'''

wu_temp_end = '''
</optgroup>
</select><br><br>
<esp-web-install-button erase-first></esp-web-install-button>
</div>
</template>
<script>
export default {
mounted () {
const espWebInstallButton = document.querySelector("esp-web-install-button");
espWebInstallButton.addEventListener("state-changed", (ev) => { console.log(ev.detail) });
const selectFW = document.querySelector("select");
espWebInstallButton.manifest = selectFW.value;
selectFW.addEventListener("change", () => {
espWebInstallButton.manifest = selectFW.value;
});
}
}
</script>'''

manif_path = 'docs/.vuepress/public/firmware_build/'
vue_path = 'docs/.vuepress/components/'
cors_proxy = '' # 'https://cors.bridged.cc/'
esp32_boot = 'https://github.com/espressif/arduino-esp32/raw/2.0.7/tools/partitions/boot_app0.bin'
Loading

0 comments on commit d7d5d08

Please sign in to comment.