mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-07 20:17:04 +03:00
Merge branch 'Over_The_Air_Update' of
https://github.com/sle118/squeezelite-esp32.git into Over_The_Air_Update
This commit is contained in:
@@ -124,6 +124,11 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
|
||||
{
|
||||
lastpct=newpct;
|
||||
ESP_LOGD(TAG,"Receiving OTA data chunk len: %d, %d of %d (%d pct)", evt->data_len, ota_status.ota_actual_len, ota_status.ota_total_len, newpct);
|
||||
ESP_LOGD(TAG,"Heap internal:%zu (min:%zu) external:%zu (min:%zu)\n",
|
||||
heap_caps_get_free_size(MALLOC_CAP_INTERNAL),
|
||||
heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL),
|
||||
heap_caps_get_free_size(MALLOC_CAP_SPIRAM),
|
||||
heap_caps_get_minimum_free_size(MALLOC_CAP_SPIRAM));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -208,8 +213,10 @@ void ota_task(void *pvParameter)
|
||||
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Starting OTA...");
|
||||
esp_err_t err = esp_https_ota(&config);
|
||||
if (err == ESP_OK) {
|
||||
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Success!");
|
||||
esp_restart();
|
||||
} else {
|
||||
snprintf(ota_status.status_text,sizeof(ota_status.status_text)-1,"Error: %s",esp_err_to_name(err));
|
||||
ESP_LOGE(TAG, "Firmware upgrade failed with error : %s", esp_err_to_name(err));
|
||||
}
|
||||
FREE_RESET(ota_status.current_url);
|
||||
|
||||
@@ -206,6 +206,26 @@ $(document).ready(function(){
|
||||
console.log('sent config JSON with headers:', autoexec1);
|
||||
});
|
||||
|
||||
$("#save-gpio").on("click", function() {
|
||||
var headers = {};
|
||||
$("input.gpio").each(function() {
|
||||
var id = $(this)[0].id;
|
||||
var pin = $(this).val();
|
||||
if (pin != '') {
|
||||
headers[id] = pin;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
url: '/config.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
headers: JSON.stringify(headers),
|
||||
data: { 'timestamp': Date.now() }
|
||||
});
|
||||
console.log('sent config JSON with headers:', JSON.stringify(headers));
|
||||
});
|
||||
|
||||
$("#flash").on("click", function() {
|
||||
var url = $("#fwurl").val();
|
||||
$.ajax({
|
||||
@@ -259,10 +279,13 @@ $(document).ready(function(){
|
||||
});
|
||||
var [ver, idf, cfg, branch] = release.name.split('#');
|
||||
var body = release.body.replace(/\\n/ig, "<br />").replace(/\'/ig, "\"");
|
||||
var [date, time] = release.created_at.split('T');
|
||||
if (ver.match(/esp-idf/)) return; //TODO delete
|
||||
$("#releaseTable").append(
|
||||
"<tr>"+
|
||||
"<td data-toggle='tooltip' title='"+body+"'>"+ver+"</td>"+
|
||||
"<td>"+idf+"</td>"+
|
||||
"<td>"+date+"</td>"+
|
||||
"<td>"+cfg+"</td>"+
|
||||
"<td>"+branch+"</td>"+
|
||||
"<td><input id='generate-command' type='button' class='btn btn-success' value='Select' data-url='"+url+"' onclick='setURL(this);' /></td>"+
|
||||
@@ -396,6 +419,7 @@ function checkStatus(){
|
||||
$("#netmask").text(data["netmask"]);
|
||||
$("#gw").text(data["gw"]);
|
||||
$("#wifi-status").slideDown( "fast", function() {});
|
||||
$(".footer").html("connected to SSID "+text(data["ssid"])+" with IP "+text(data["ip"]));
|
||||
|
||||
//unlock the wait screen if needed
|
||||
$( "#ok-connect" ).prop("disabled",false);
|
||||
@@ -441,6 +465,7 @@ function checkStatus(){
|
||||
$("#netmask").text(data["netmask"]);
|
||||
$("#gw").text(data["gw"]);
|
||||
$("#wifi-status").slideDown( "fast", function() {});
|
||||
$(".footer").html("connected to SSID "+data["ssid"]+" with IP "+data["ip"]);
|
||||
}
|
||||
enableAPTimer = false;
|
||||
if (!recovery) enableStatusTimer = false;
|
||||
|
||||
@@ -197,6 +197,61 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tab-gpio">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Signal</th>
|
||||
<th scope="col">GPIO pin</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="gpioTable">
|
||||
<tr>
|
||||
<td><strong>I2S</strong></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>I2S Bit clock</td>
|
||||
<td>
|
||||
<input type="text" class="form-control gpio" id="gpio-i2s-bc" maxlength="2" size="2">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>I2S Word select</td>
|
||||
<td>
|
||||
<input type="text" class="form-control gpio" id="gpio-i2s-ws" maxlength="2" size="2">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>I2S Data</td>
|
||||
<td>
|
||||
<input type="text" class="form-control gpio" id="gpio-i2s-data" maxlength="2" size="2">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>SPDIF</strong></td><td></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SPDIF Bit clock</td>
|
||||
<td>
|
||||
<input type="text" class="form-control gpio" id="spdif-i2s-bc" maxlength="2" size="2">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SPDIF Word select</td>
|
||||
<td>
|
||||
<input type="text" class="form-control gpio" id="spdif-i2s-ws" maxlength="2" size="2">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SPDIF Data</td>
|
||||
<td>
|
||||
<input type="text" class="form-control gpio" id="spdif-i2s-data" maxlength="2" size="2">
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="buttons">
|
||||
<input id="save-gpio" type="button" class="btn btn-success" value="Save" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tab-system">
|
||||
@@ -209,6 +264,7 @@
|
||||
<tr>
|
||||
<th scope="col">Firmware version</th>
|
||||
<th scope="col">IDF version</th>
|
||||
<th scope="col">Release date</th>
|
||||
<th scope="col">HW platform</th>
|
||||
<th scope="col">Branch</th>
|
||||
<th scope="col">Flash this FW</th>
|
||||
@@ -247,5 +303,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<footer class="footer"></footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
body {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
margin-bottom:50px;
|
||||
}
|
||||
a {
|
||||
color: darkblue;
|
||||
@@ -213,6 +214,12 @@ input[type='text'], input[type='password'], textarea {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
input.gpio {
|
||||
width: 2em;
|
||||
color: #000;
|
||||
height: 1.8em;
|
||||
}
|
||||
|
||||
.custom-switch, .custom-radio {
|
||||
padding-left: 2.25rem;
|
||||
margin-left: 12px;
|
||||
@@ -299,3 +306,13 @@ input, textarea {
|
||||
#mode {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
background-color: #555;
|
||||
color: white;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user