mirror of
https://github.com/rstrouse/ESPSomfy-RTS.git
synced 2025-12-13 02:52:11 +01:00
Improve workflows for GitOTA.
This commit is contained in:
parent
51fd2e9174
commit
a944772f96
11 changed files with 103 additions and 47 deletions
16
.github/workflows/release.yaml
vendored
16
.github/workflows/release.yaml
vendored
|
|
@ -2,7 +2,7 @@ name: ESPSomfy-RTS Release
|
|||
|
||||
on:
|
||||
release:
|
||||
types: published
|
||||
types: [published]
|
||||
|
||||
env:
|
||||
ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS: "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json"
|
||||
|
|
@ -62,14 +62,15 @@ jobs:
|
|||
retention-days: 5
|
||||
|
||||
- name: Upload LittleFS
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_name: SomfyController.littlefs.bin
|
||||
asset_path: build/SomfyController.ino.bin
|
||||
asset_content_type: application/zip
|
||||
asset_path: SomfyController.littlefs.bin
|
||||
overwrite: true
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
|
||||
arduino:
|
||||
|
|
@ -173,26 +174,27 @@ jobs:
|
|||
0x290000 SomfyController.littlefs.bin
|
||||
|
||||
- name: Upload Firmware ${{ matrix.name }}
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_name: ${{ matrix.fwname }}
|
||||
asset_path: build/SomfyController.ino.bin
|
||||
asset_content_type: application/zip
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: ${{ matrix.name }} Compress Onboard Image
|
||||
run: |
|
||||
zip ${{ matrix.obname }}.zip ./${{ matrix.obname }}
|
||||
|
||||
- name: Upload Onboard ${{ matrix.name }}
|
||||
uses: actions/upload-release-asset@v1.0.2
|
||||
uses: shogo82148/actions-upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
upload_url: ${{ steps.get_release.outputs.upload_url }}
|
||||
asset_name: ${{ matrix.obname }}.zip
|
||||
asset_path: ${{ matrix.obname }}.zip
|
||||
overwrite: true
|
||||
asset_content_type: application/zip
|
||||
|
||||
|
|
|
|||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -3,4 +3,4 @@ debug_custom.json
|
|||
esp32.vsd
|
||||
esp32s3.svd
|
||||
debug.cfg
|
||||
SomfyController.ino.esp32s3.bin
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
#ifndef configsettings_h
|
||||
#define configsettings_h
|
||||
|
||||
#define FW_VERSION "v2.2.3"
|
||||
#define FW_VERSION "v2.2.4"
|
||||
enum DeviceStatus {
|
||||
DS_OK = 0,
|
||||
DS_ERROR = 1,
|
||||
|
|
|
|||
26
GitOTA.cpp
26
GitOTA.cpp
|
|
@ -34,7 +34,7 @@ void GitRelease::setReleaseProperty(const char *key, const char *val) {
|
|||
}
|
||||
void GitRelease::setAssetProperty(const char *key, const char *val) {
|
||||
if(strcmp(key, "name") == 0) {
|
||||
Serial.println(val);
|
||||
//Serial.println(val);
|
||||
if(strstr(val, "littlefs.bin")) this->hasFS = true;
|
||||
else if(strstr(val, "ino.esp32.bin")) {
|
||||
if(strlen(this->hwVersions)) strcat(this->hwVersions, ",");
|
||||
|
|
@ -94,6 +94,7 @@ int16_t GitRepo::getReleases(uint8_t num) {
|
|||
main->main = true;
|
||||
strcpy(main->version.name, "main");
|
||||
strcpy(main->name, "Main");
|
||||
strcpy(main->hwVersions, "32,s3");
|
||||
if(https.begin(*client, url)) {
|
||||
int httpCode = https.GET();
|
||||
Serial.printf("[HTTPS] GET... code: %d\n", httpCode);
|
||||
|
|
@ -127,7 +128,7 @@ int16_t GitRepo::getReleases(uint8_t num) {
|
|||
if(arrTok == 2 && strcmp(jsonElem, "assets") == 0) {
|
||||
inElem = inValue = awaitValue = false;
|
||||
inAss = true;
|
||||
Serial.printf("%s: %d\n", jsonElem, arrTok);
|
||||
//Serial.printf("%s: %d\n", jsonElem, arrTok);
|
||||
}
|
||||
else if(arrTok < 2) inAss = false;
|
||||
}
|
||||
|
|
@ -336,7 +337,24 @@ void GitUpdater::emitDownloadProgress(uint8_t num, size_t total, size_t loaded,
|
|||
sockEmit.loop();
|
||||
webServer.loop();
|
||||
}
|
||||
|
||||
void GitUpdater::setFirmwareFile() {
|
||||
esp_chip_info_t ci;
|
||||
esp_chip_info(&ci);
|
||||
switch(ci.model) {
|
||||
case esp_chip_model_t::CHIP_ESP32S3:
|
||||
strcpy(this->currentFile, "SomfyController.ino.esp32s3.bin");
|
||||
break;
|
||||
case esp_chip_model_t::CHIP_ESP32S2:
|
||||
strcpy(this->currentFile, "SomfyController.ino.esp32s2.bin");
|
||||
break;
|
||||
case esp_chip_model_t::CHIP_ESP32C3:
|
||||
strcpy(this->currentFile, "SomfyController.ino.esp32c3.bin");
|
||||
break;
|
||||
default:
|
||||
strcpy(this->currentFile, "SomfyController.ino.esp32.bin");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool GitUpdater::beginUpdate(const char *version) {
|
||||
Serial.println("Begin update called...");
|
||||
|
|
@ -345,7 +363,7 @@ bool GitUpdater::beginUpdate(const char *version) {
|
|||
|
||||
strcpy(this->targetRelease, version);
|
||||
this->emitUpdateCheck();
|
||||
strcpy(this->currentFile, "SomfyController.ino.esp32.bin");
|
||||
this->setFirmwareFile();
|
||||
this->partition = U_FLASH;
|
||||
this->cancelled = false;
|
||||
this->error = 0;
|
||||
|
|
|
|||
1
GitOTA.h
1
GitOTA.h
|
|
@ -51,6 +51,7 @@ class GitUpdater {
|
|||
bool beginUpdate(const char *release);
|
||||
bool endUpdate();
|
||||
int8_t downloadFile();
|
||||
void setFirmwareFile();
|
||||
void setCurrentRelease(GitRepo &repo);
|
||||
void loop();
|
||||
void toJSON(JsonObject &obj);
|
||||
|
|
|
|||
39
Somfy.cpp
39
Somfy.cpp
|
|
@ -1508,6 +1508,8 @@ void SomfyShade::unpublish(uint8_t id) {
|
|||
SomfyShade::unpublish(id, "tiltDirection");
|
||||
SomfyShade::unpublish(id, "tiltPosition");
|
||||
SomfyShade::unpublish(id, "tiltTarget");
|
||||
SomfyShade::unpublish(id, "windy");
|
||||
SomfyShade::unpublish(id, "sunny");
|
||||
}
|
||||
}
|
||||
void SomfyGroup::unpublish(uint8_t id) {
|
||||
|
|
@ -4157,6 +4159,43 @@ void transceiver_config_t::removeNVSKey(const char *key) {
|
|||
}
|
||||
}
|
||||
void transceiver_config_t::load() {
|
||||
esp_chip_info_t ci;
|
||||
esp_chip_info(&ci);
|
||||
switch(ci.model) {
|
||||
case esp_chip_model_t::CHIP_ESP32S3:
|
||||
Serial.println("Setting S3 Transceiver Defaults...");
|
||||
this->TXPin = 15;
|
||||
this->RXPin = 14;
|
||||
this->MOSIPin = 11;
|
||||
this->MISOPin = 13;
|
||||
this->SCKPin = 12;
|
||||
this->CSNPin = 10;
|
||||
break;
|
||||
case esp_chip_model_t::CHIP_ESP32S2:
|
||||
this->TXPin = 15;
|
||||
this->RXPin = 14;
|
||||
this->MOSIPin = 35;
|
||||
this->MISOPin = 37;
|
||||
this->SCKPin = 36;
|
||||
this->CSNPin = 34;
|
||||
break;
|
||||
case esp_chip_model_t::CHIP_ESP32C3:
|
||||
this->TXPin = 13;
|
||||
this->RXPin = 12;
|
||||
this->MOSIPin = 16;
|
||||
this->MISOPin = 17;
|
||||
this->SCKPin = 15;
|
||||
this->CSNPin = 14;
|
||||
break;
|
||||
default:
|
||||
this->TXPin = 13;
|
||||
this->RXPin = 12;
|
||||
this->MOSIPin = 23;
|
||||
this->MISOPin = 19;
|
||||
this->SCKPin = 18;
|
||||
this->CSNPin = 5;
|
||||
break;
|
||||
}
|
||||
pref.begin("CC1101");
|
||||
this->type = pref.getUChar("type", 56);
|
||||
this->TXPin = pref.getUChar("TXPin", this->TXPin);
|
||||
|
|
|
|||
Binary file not shown.
BIN
SomfyController.ino.esp32s3.bin
Normal file
BIN
SomfyController.ino.esp32s3.bin
Normal file
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
2.2.3
|
||||
2.2.4
|
||||
|
|
@ -3,11 +3,11 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" href="main.css?v=2.2.3" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.2.3" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.2.3" type="text/css" />
|
||||
<link rel="stylesheet" href="main.css?v=2.2.4" type="text/css" />
|
||||
<link rel="stylesheet" href="widgets.css?v=2.2.4" type="text/css" />
|
||||
<link rel="stylesheet" href="icons.css?v=2.2.4" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="favicon.png" />
|
||||
<script type="text/javascript" src="index.js?v=2.2.3"></script>
|
||||
<script type="text/javascript" src="index.js?v=2.2.4"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="divContainer" class="container main" data-auth="false">
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
<div id="divFirmware" class="subtab-content" style="display:none;">
|
||||
<div style="font-size:17px;">
|
||||
<span style="text-align:right;display:inline-block;color:#00bcd4;width:127px;margin-top:-27px;">Hardware: </span>
|
||||
<span style="padding-left: 4px; display: inline-block;">ESP32-<span id="spanHwVersion" style="text-transform:uppercase; text-align:left;width:120px;"></span></span>
|
||||
<span style="padding-left: 4px; display: inline-block;">ESP32<span id="spanHwVersion" style="text-transform:uppercase; text-align:left;width:120px;"></span></span>
|
||||
</div>
|
||||
<div style="font-size:17px;">
|
||||
<span style="text-align:right;display:inline-block;color:#00bcd4;width:127px;margin-top:-27px;">Firmware:</span>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
var hst = '192.168.1.209';
|
||||
var hst = '192.168.1.208';
|
||||
//var hst = '192.168.1.152';
|
||||
|
||||
var errors = [
|
||||
{ code: -10, desc: "Pin setting in use for Transceiver. Output pins cannot be re-used." },
|
||||
{ code: -11, desc: "Pin setting in use for Ethernet Adapter. Output pins cannot be re-used." },
|
||||
|
|
@ -1253,7 +1255,7 @@ var security = new Security();
|
|||
|
||||
class General {
|
||||
initialized = false;
|
||||
appVersion = 'v2.2.3';
|
||||
appVersion = 'v2.2.4';
|
||||
reloadApp = false;
|
||||
init() {
|
||||
if (this.initialized) return;
|
||||
|
|
@ -1397,8 +1399,9 @@ class General {
|
|||
else {
|
||||
console.log(settings);
|
||||
document.getElementById('spanFwVersion').innerText = settings.fwVersion;
|
||||
document.getElementById('spanHwVersion').innerText = settings.chipModel;
|
||||
document.getElementById('spanHwVersion').innerText = settings.chipModel.length > 0 ? '-' + settings.chipModel : '';
|
||||
document.getElementById('divContainer').setAttribute('data-chipmodel', settings.chipModel);
|
||||
somfy.initPins();
|
||||
general.setAppVersion();
|
||||
ui.toElement(pnl, { general: settings });
|
||||
}
|
||||
|
|
@ -1906,6 +1909,9 @@ class Somfy {
|
|||
];
|
||||
init() {
|
||||
if (this.initialized) return;
|
||||
this.initialized = true;
|
||||
}
|
||||
initPins() {
|
||||
this.loadPins('inout', document.getElementById('selTransSCKPin'));
|
||||
this.loadPins('inout', document.getElementById('selTransCSNPin'));
|
||||
this.loadPins('inout', document.getElementById('selTransMOSIPin'));
|
||||
|
|
@ -1919,7 +1925,6 @@ class Somfy {
|
|||
this.loadPins('out', document.getElementById('selShadeGPIOUp'));
|
||||
this.loadPins('out', document.getElementById('selShadeGPIODown'));
|
||||
this.loadPins('out', document.getElementById('selShadeGPIOMy'));
|
||||
this.initialized = true;
|
||||
}
|
||||
async loadSomfy() {
|
||||
getJSONSync('/controller', (err, somfy) => {
|
||||
|
|
@ -2621,30 +2626,21 @@ class Somfy {
|
|||
}
|
||||
document.getElementById('divLinkedShadeList').innerHTML = divCfg;
|
||||
}
|
||||
pinMaps = [
|
||||
{ name: '', maxPins: 39, inputs: [0, 1, 6, 7, 8, 9, 10, 11, 37, 38], outputs: [3, 6, 7, 8, 9, 10, 11, 34, 35, 36, 37, 38, 39] },
|
||||
{ name: 's2', maxPins: 46, inputs: [0, 15, 16, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 45], outputs: [0, 15, 16, 19, 20, 26, 27, 28, 29, 30, 31, 32, 45, 46]},
|
||||
{ name: 's3', maxPins: 48, inputs: [0, 3, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 39, 40, 41, 42, 43, 44], outputs: [0, 3, 19, 20, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 39, 40, 41, 42, 43, 44] },
|
||||
{ name: 'c3', maxPins: 21, inputs: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20], outputs: [11, 12, 13, 14, 15, 16, 17, 21] }
|
||||
];
|
||||
|
||||
loadPins(type, sel, opt) {
|
||||
while (sel.firstChild) sel.removeChild(sel.firstChild);
|
||||
for (let i = 0; i < 40; i++) {
|
||||
switch (i) {
|
||||
case 6: // SPI Flash Pins
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
if (type !== 'inout' && type !== 'input') continue;
|
||||
break;
|
||||
case 37:
|
||||
case 38:
|
||||
continue;
|
||||
case 32: // We cannot use this pin with the mask for TX.
|
||||
case 33:
|
||||
case 34: // Input only
|
||||
case 35:
|
||||
case 36:
|
||||
case 39:
|
||||
if (type !== 'input') continue;
|
||||
break;
|
||||
}
|
||||
let cm = document.getElementById('divContainer').getAttribute('data-chipmodel');
|
||||
let pm = this.pinMaps.find(x => x.name === cm) || { name: '', maxPins: 39, inputs: [0, 1, 6, 7, 8, 9, 10, 11, 37, 38], outputs: [3, 6, 7, 8, 9, 10, 11, 34, 35, 36, 37, 38, 39] };
|
||||
console.log({ cm: cm, pm: pm });
|
||||
for (let i = 0; i <= pm.maxPins; i++) {
|
||||
if (type.includes('in') && pm.inputs.includes(i)) continue;
|
||||
if (type.includes('out') && pm.outputs.includes(i)) continue;
|
||||
sel.options[sel.options.length] = new Option(`GPIO-${i > 9 ? i.toString() : '0' + i.toString()}`, i, typeof opt !== 'undefined' && opt === i);
|
||||
}
|
||||
}
|
||||
|
|
@ -4075,8 +4071,8 @@ class Firmware {
|
|||
html += `<div class="field-group" style = "text-align:center;">`;
|
||||
html += `<select id="selVersion" data-bind="version" style="width:50%;font-size:2em;color:white;" onchange="firmware.gitReleaseSelected(document.getElementById('divGitInstall'));">`
|
||||
for (let i = 0; i < rel.releases.length; i++) {
|
||||
//if (rel.releases[i].hwVersions.length === 0 || rel.releases[i].hwVersions.indexOf(chip) >= 0)
|
||||
html += `<option style="text-align:left;font-size:.5em;color:black;" value="${rel.releases[i].version.name}">${rel.releases[i].name}</option>`
|
||||
if (rel.releases[i].hwVersions.length === 0 || rel.releases[i].hwVersions.indexOf(chip) >= 0)
|
||||
html += `<option style="text-align:left;font-size:.5em;color:black;" value="${rel.releases[i].version.name}">${rel.releases[i].name}</option>`
|
||||
}
|
||||
html += `</select><label for="selVersion">Select a version</label></div>`;
|
||||
html += `<div class="button-container" id="divReleaseNotes" style="text-align:center;margin-top:-20px;display:none;"><button type="button" onclick="firmware.showReleaseNotes(document.getElementById('selVersion').value);" style="display:inline-block;width:auto;padding-left:20px;padding-right:20px;">Release Notes</button></div>`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue