mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-06 11:36:59 +03:00
More OTA fix, restore UI from previous commit
This commit is contained in:
58
.cproject
58
.cproject
@@ -97,6 +97,54 @@
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291" moduleId="org.eclipse.cdt.core.settings" name="recovery_windows">
|
||||
<macros>
|
||||
<stringMacro name="RECOVERY_APPLICATION" type="VALUE_TEXT" value="1"/>
|
||||
</macros>
|
||||
<externalSettings/>
|
||||
<extensions>
|
||||
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
|
||||
</extensions>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
<configuration artifactName="${ProjName}" buildProperties="" description="Building recovery in windows" id="cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291" name="recovery_windows" optionalBuildProperties="" parent="org.eclipse.cdt.build.core.emptycfg">
|
||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291." name="/" resourcePath="">
|
||||
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.845245133" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
|
||||
<option id="cdt.managedbuild.option.gnu.cross.prefix.1090509495" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix"/>
|
||||
<option id="cdt.managedbuild.option.gnu.cross.path.447265559" name="Path" superClass="cdt.managedbuild.option.gnu.cross.path"/>
|
||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.targetPlatform.gnu.cross.1831977109" isAbstract="false" osList="all" superClass="cdt.managedbuild.targetPlatform.gnu.cross"/>
|
||||
<builder arguments="-j8 EXTRA_CPPFLAGS="-DRECOVERY_APPLICATION=1"" command="make" id="cdt.managedbuild.builder.gnu.cross.1069921467" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="cdt.managedbuild.builder.gnu.cross"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.compiler.1302011176" name="Cross GCC Compiler" superClass="cdt.managedbuild.tool.gnu.cross.c.compiler">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="gnu.c.compiler.option.preprocessor.def.symbols.623798750" name="Defined symbols (-D)" superClass="gnu.c.compiler.option.preprocessor.def.symbols" useByScannerDiscovery="false" valueType="definedSymbols"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.539301587" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.compiler.1722031516" name="Cross G++ Compiler" superClass="cdt.managedbuild.tool.gnu.cross.cpp.compiler">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="gnu.cpp.compiler.option.preprocessor.def.2010227748" name="Defined symbols (-D)" superClass="gnu.cpp.compiler.option.preprocessor.def" useByScannerDiscovery="false" valueType="definedSymbols"/>
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.2073997022" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.746651743" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.cpp.linker.149944553" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.1372009292" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
</inputType>
|
||||
</tool>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.archiver.649046248" name="Cross GCC Archiver" superClass="cdt.managedbuild.tool.gnu.cross.archiver"/>
|
||||
<tool id="cdt.managedbuild.tool.gnu.cross.assembler.2132030687" name="Cross GCC Assembler" superClass="cdt.managedbuild.tool.gnu.cross.assembler">
|
||||
<inputType id="cdt.managedbuild.tool.gnu.assembler.input.1779870241" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</folderInfo>
|
||||
</configuration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.pathentry"/>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
@@ -104,6 +152,9 @@
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
|
||||
<storageModule moduleId="refreshScope" versionNumber="2">
|
||||
<configuration configurationName="recovery_windows">
|
||||
<resource resourceType="PROJECT" workspacePath="/squeezelite-esp32"/>
|
||||
</configuration>
|
||||
<configuration configurationName="recovery">
|
||||
<resource resourceType="PROJECT" workspacePath="/squeezelite-esp32"/>
|
||||
</configuration>
|
||||
@@ -139,6 +190,7 @@
|
||||
</target>
|
||||
</buildTargets>
|
||||
</storageModule>
|
||||
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
|
||||
<storageModule moduleId="scannerConfiguration">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934;cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.40066190;cdt.managedbuild.tool.gnu.cpp.compiler.input.773825889">
|
||||
@@ -150,6 +202,12 @@
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.293933348;cdt.managedbuild.toolchain.gnu.cross.base.293933348.949515869;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1689301712;cdt.managedbuild.tool.gnu.cpp.compiler.input.1117032298">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291;cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291.;cdt.managedbuild.tool.gnu.cross.cpp.compiler.1722031516;cdt.managedbuild.tool.gnu.cpp.compiler.input.2073997022">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291;cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291.;cdt.managedbuild.tool.gnu.cross.c.compiler.1302011176;cdt.managedbuild.tool.gnu.c.compiler.input.539301587">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
<scannerConfigBuildInfo instanceId="cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934;cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934.;cdt.managedbuild.tool.gnu.cross.c.compiler.1397900624;cdt.managedbuild.tool.gnu.c.compiler.input.24917724">
|
||||
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
|
||||
</scannerConfigBuildInfo>
|
||||
|
||||
@@ -24,4 +24,16 @@
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
</extension>
|
||||
</configuration>
|
||||
<configuration id="cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291" name="recovery_windows">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="xtensa-esp32-elf-(gcc|g\+\+|c\+\+|cc|cpp|clang)" prefer-non-shared="true"/>
|
||||
<provider class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector" console="false" env-hash="761289742387374140" id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Cross GCC Built-in Compiler Settings" parameter="xtensa-esp32-elf-gcc ${FLAGS} -std=c++11 -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
||||
|
||||
@@ -24,6 +24,23 @@ environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/op
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/PATH/value=C\:/msys2/opt/xtensa-esp32-elf/bin;C\:/jdk-12.0.2/bin/server;C\:/jdk-12.0.2/bin;C\:\\Windows\\system32;C\:\\Windows;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C\:\\Program Files\\NVIDIA Corporation\\NVIDIA NvDLISR;C\:\\jdk-12.0.2\\bin;C\:\\Program Files\\PuTTY\\;C\:\\Program Files (x86)\\HP\\IdrsOCR_15.2.10.1114\\;C\:\\eclipse
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/append=true
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.1476804786/appendContributed=true
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/BATCH_BUILD/delimiter=\:
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/BATCH_BUILD/operation=append
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/BATCH_BUILD/value=1
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/IDF_PATH/delimiter=\:
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/IDF_PATH/operation=replace
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/IDF_PATH/value=C\:/msys32/home/Sebastien/esp/esp-idf
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PATH/delimiter=\:
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PATH/operation=replace
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PATH/value=c\:\\msys32\\opt\\xtensa-esp32-elf\\bin;c\:\\msys32\\mingw32\\bin;c\:\\msys32\\usr\\local\\bin;c\:\\msys32\\usr\\bin;c\:\\msys32\\bin;c\:\\Windows\\System32;c\:\\Windows;c\:\\Windows\\System32\\Wbem;c\:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C\:\\msys32\\usr\\bin\\site_perl;C\:\\msys32\\usr\\bin\\vendor_perl;C\:\\msys32\\usr\\bin\\core_perl;C\:\\msys32\\var\\opt\\xtensa-esp32-elf\\bin\\;C\:\\msys32\\sbin;C\:\\msys32\\bin;C\:\\msys32\\usr\\bin;C\:\\msys32\\usr\\local\\bin;C\:\\msys32\\snap\\bin;C\:\\msys32\\bin;C\:\\msys32\\sbin;C\:\\msys32\\usr\\bin;C\:\\msys32\\usr\\local\\bin;C\:\\msys32\\snap\\bin
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PROJECT_NAME/delimiter=\:
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PROJECT_NAME/operation=replace
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PROJECT_NAME/value=recovery.custom
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PROJECT_VER/delimiter=\:
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PROJECT_VER/operation=append
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/PROJECT_VER/value=custom
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/append=true
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.1603996291/appendContributed=true
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/BATCH_BUILD/delimiter=\:
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/BATCH_BUILD/operation=append
|
||||
environment/project/cdt.managedbuild.toolchain.gnu.cross.base.293933348.839256934/BATCH_BUILD/value=1
|
||||
|
||||
@@ -530,7 +530,10 @@ void register_nvs()
|
||||
|
||||
namespace_args.namespace = arg_str1(NULL, NULL, "<namespace>", "namespace of the partition to be selected");
|
||||
namespace_args.end = arg_end(2);
|
||||
|
||||
list_args.partition = arg_str1(NULL, NULL, "<partition>", "partition name");
|
||||
list_args.namespace = arg_str0("n", "namespace", "<namespace>", "namespace name");
|
||||
list_args.type = arg_str0("t", "type", "<type>", ARG_TYPE_STR);
|
||||
list_args.end = arg_end(2);
|
||||
const esp_console_cmd_t set_cmd = {
|
||||
.command = "nvs_set",
|
||||
.help = "Set variable in selected namespace. Blob type must be comma separated list of hex values. \n"
|
||||
|
||||
@@ -44,6 +44,7 @@ static int perform_ota_update(int argc, char **argv)
|
||||
const char *url = ota_args.url->sval[0];
|
||||
|
||||
esp_err_t err=ESP_OK;
|
||||
ESP_LOGI(TAG, "Starting ota: %s", url);
|
||||
start_ota(url);
|
||||
|
||||
|
||||
@@ -59,10 +60,10 @@ static int perform_ota_update(int argc, char **argv)
|
||||
void register_ota_cmd()
|
||||
{
|
||||
ota_args.url= arg_str1(NULL, NULL, "<url>", "url of the binary app file");
|
||||
ota_args.end = arg_end(1);
|
||||
ota_args.end = arg_end(2);
|
||||
|
||||
const esp_console_cmd_t cmd = {
|
||||
.command = "ota_update",
|
||||
.command = "update",
|
||||
.help = "Updates the application binary from the provided URL",
|
||||
.hint = NULL,
|
||||
.func = &perform_ota_update,
|
||||
|
||||
@@ -41,28 +41,30 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
|
||||
switch (evt->event_id) {
|
||||
case HTTP_EVENT_ERROR:
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_ERROR");
|
||||
strncpy(ota_status,sizeof(ota_status)-1,"HTTP_EVENT_ERROR");
|
||||
strncpy(ota_status,"HTTP_EVENT_ERROR",sizeof(ota_status)-1);
|
||||
break;
|
||||
case HTTP_EVENT_ON_CONNECTED:
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_ON_CONNECTED");
|
||||
strncpy(ota_status,sizeof(ota_status)-1,"HTTP_EVENT_ON_CONNECTED");
|
||||
strncpy(ota_status,"HTTP_EVENT_ON_CONNECTED",sizeof(ota_status)-1);
|
||||
break;
|
||||
case HTTP_EVENT_HEADER_SENT:
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_HEADER_SENT");
|
||||
strncpy(ota_status,sizeof(ota_status)-1,"HTTP_EVENT_HEADER_SENT");
|
||||
strncpy(ota_status,"HTTP_EVENT_HEADER_SENT",sizeof(ota_status)-1);
|
||||
break;
|
||||
case HTTP_EVENT_ON_HEADER:
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);
|
||||
snprintf(ota_status,sizeof(ota_status)-1,"HTTP_EVENT_ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);
|
||||
break;
|
||||
case HTTP_EVENT_ON_DATA:
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);
|
||||
snprintf(ota_status,sizeof(ota_status)-1, "HTTP_EVENT_ON_DATA, len=%d", evt->data_len);
|
||||
break;
|
||||
case HTTP_EVENT_ON_FINISH:
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_ON_FINISH");
|
||||
break;
|
||||
case HTTP_EVENT_DISCONNECTED:
|
||||
ESP_LOGD(TAG, "HTTP_EVENT_DISCONNECTED");
|
||||
strncpy(ota_status,sizeof(ota_status)-1,"HTTP_EVENT_DISCONNECTED");
|
||||
strncpy(ota_status,"HTTP_EVENT_DISCONNECTED",sizeof(ota_status)-1);
|
||||
break;
|
||||
}
|
||||
return ESP_OK;
|
||||
@@ -78,6 +80,7 @@ void ota_task(void *pvParameter)
|
||||
//.cert_pem = (char *)server_cert_pem_start,
|
||||
.event_handler = _http_event_handler,
|
||||
};
|
||||
ESP_LOGI(TAG, "Starting ota: %s", bin_url);
|
||||
|
||||
// todo: review how certificates work
|
||||
config.skip_cert_common_name_check = true;
|
||||
@@ -88,9 +91,8 @@ void ota_task(void *pvParameter)
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Firmware upgrade failed");
|
||||
}
|
||||
while (1) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
free(pvParameter);
|
||||
return;
|
||||
}
|
||||
|
||||
void start_ota(const char * bin_url)
|
||||
@@ -110,5 +112,6 @@ void start_ota(const char * bin_url)
|
||||
char * urlPtr=malloc((strlen(bin_url)+1)*sizeof(char));
|
||||
strcpy(urlPtr,bin_url);
|
||||
|
||||
xTaskCreate(&ota_task, "ota_task", 8192, NULL, 5, urlPtr);
|
||||
ESP_LOGI(TAG, "Starting ota: %s", urlPtr);
|
||||
xTaskCreate(&ota_task, "ota_task", 8192,(void *) urlPtr, 5, NULL);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,8 @@ if (!String.prototype.format) {
|
||||
};
|
||||
}
|
||||
|
||||
var recovery = false;
|
||||
var releaseURL = 'https://api.github.com/repos/sle118/squeezelite-esp32/releases';
|
||||
var recovery = true;
|
||||
var enableTimers = true;
|
||||
var commandHeader = 'squeezelite -b 500:2000 -d all=info ';
|
||||
|
||||
@@ -24,6 +25,7 @@ var StatusIntervalActive = false;
|
||||
var ConfigIntervalActive = false;
|
||||
var RefreshAPIIntervalActive = false;
|
||||
|
||||
var output = '';
|
||||
//TODO check
|
||||
var to = 0, set_int = 0;
|
||||
|
||||
@@ -65,7 +67,7 @@ function RepeatCheckConfigInterval(){
|
||||
|
||||
function RepeatRefreshAPInterval(){
|
||||
if(RefreshAPIIntervalActive)
|
||||
startRefreshAPInterval()
|
||||
startRefreshAPInterval();
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
@@ -175,18 +177,110 @@ $(document).ready(function(){
|
||||
$( "#wifi" ).slideDown( "fast", function() {})
|
||||
});
|
||||
|
||||
$("#update-command").click(function() {
|
||||
updateAutoexec();
|
||||
$("#autoexec-cb").on("click", function() {
|
||||
autoexec = (this.checked)?1:0;
|
||||
$.ajax({
|
||||
url: '/config.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
headers: { "X-Custom-autoexec": autoexec },
|
||||
data: { 'timestamp': Date.now() }
|
||||
});
|
||||
console.log('sent config JSON with headers:', autoexec);
|
||||
});
|
||||
|
||||
$("#save-autoexec1").on("click", function() {
|
||||
autoexec1 = $("#autoexec1").val();
|
||||
|
||||
$.ajax({
|
||||
url: '/config.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
headers: { "X-Custom-autoexec1": autoexec1 },
|
||||
data: { 'timestamp': Date.now() }
|
||||
});
|
||||
console.log('sent config JSON with headers:', autoexec1);
|
||||
});
|
||||
|
||||
$("#recovery").on("click", function() {
|
||||
$.ajax({
|
||||
url: '/recovery.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: { 'timestamp': Date.now()}
|
||||
});
|
||||
});
|
||||
|
||||
$("#reboot").on("click", function() {
|
||||
$.ajax({
|
||||
url: '/reboot.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: { 'timestamp': Date.now()}
|
||||
});
|
||||
});
|
||||
|
||||
$("#generate-command").on("click", function() {
|
||||
var commandLine = commandHeader + '-n ' + $("#player").val();
|
||||
|
||||
if (output == 'bt') {
|
||||
commandLine += ' -o "BT -n \'' + $("#btsink").val() + '\'" -R -Z 192000';
|
||||
} else if (output == 'spdif') {
|
||||
commandLine += ' -o SPDIF -R -Z 192000';
|
||||
} else {
|
||||
commandLine += ' -o I2S';
|
||||
}
|
||||
if ($("#optional").val() != '') {
|
||||
commandLine += ' ' + $("#optional").val();
|
||||
}
|
||||
$("#autoexec1").val(commandLine);
|
||||
});
|
||||
|
||||
$("#generate-command").click(function() {
|
||||
generateCommand();
|
||||
});
|
||||
|
||||
$('[name=audio]').click(function(){
|
||||
selectOutput(this);
|
||||
$('[name=audio]').on("click", function(){
|
||||
if (this.id == 'bt') {
|
||||
$("#btsinkdiv").show(200);
|
||||
output = 'bt';
|
||||
} else if (this.id == 'spdif') {
|
||||
$("#btsinkdiv").hide(200);
|
||||
output = 'spdif';
|
||||
} else {
|
||||
$("#btsinkdiv").hide(200);
|
||||
output = 'i2s';
|
||||
}
|
||||
});
|
||||
|
||||
$('#fwcheck').on("click", function(){
|
||||
$("#releaseTable").html("");
|
||||
$.getJSON(releaseURL, function(data) {
|
||||
data.forEach(function(release) {
|
||||
var url = '';
|
||||
release.assets.forEach(function(asset) {
|
||||
if (asset.name.match(/\.bin$/)) {
|
||||
url = asset.browser_download_url;
|
||||
}
|
||||
});
|
||||
var [ver, idf, cfg, branch] = release.name.split('-');
|
||||
$("#releaseTable").append(
|
||||
"<tr>"+
|
||||
"<td>"+ver+"</td>"+
|
||||
"<td>"+idf+"</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>"+
|
||||
"</tr>"
|
||||
);
|
||||
});
|
||||
})
|
||||
.fail(function() {
|
||||
alert("failed to fetch release history!");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
//first time the page loads: attempt to get the connection status and start the wifi scan
|
||||
refreshAP();
|
||||
getConfig();
|
||||
@@ -196,6 +290,20 @@ $(document).ready(function(){
|
||||
startRefreshAPInterval();
|
||||
});
|
||||
|
||||
function setURL(button) {
|
||||
var url = button.dataset.url;
|
||||
$.ajax({
|
||||
url: '/config.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
headers: { "X-Custom-fwurl": url },
|
||||
data: { 'timestamp': Date.now() }
|
||||
});
|
||||
$('[data-url^="http"]').addClass("btn-success").removeClass("btn-danger");
|
||||
$('[data-url="'+url+'"]').addClass("btn-danger").removeClass("btn-success");
|
||||
}
|
||||
|
||||
function performConnect(conntype){
|
||||
//stop the status refresh. This prevents a race condition where a status
|
||||
//request would be refreshed with wrong ip info from a previous connection
|
||||
@@ -240,8 +348,6 @@ function performConnect(conntype){
|
||||
startRefreshAPInterval();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function rssiToIcon(rssi){
|
||||
if(rssi >= -60){
|
||||
return 'w0';
|
||||
@@ -367,16 +473,16 @@ function getConfig() {
|
||||
} else {
|
||||
console.log('turn off autoexec');
|
||||
$("#autoexec-cb")[0].checked=false;
|
||||
$("#autoexec-command").hide(200);
|
||||
}
|
||||
}
|
||||
if (data.hasOwnProperty('recovery')) {
|
||||
if (data["recovery"] === 1) {
|
||||
recovery = true;
|
||||
$("#tab-wifi").removeClass("active show");
|
||||
$("#tab-system").addClass("active show");
|
||||
$("#navbar").hide();
|
||||
$("#recoverydiv").hide();
|
||||
$("#otadiv").show();
|
||||
$("#command_line").hide();
|
||||
$("#wifi").hide();
|
||||
} else {
|
||||
recovery = false;
|
||||
$("#recoverydiv").show();
|
||||
@@ -399,77 +505,8 @@ function getConfig() {
|
||||
});
|
||||
}
|
||||
|
||||
function updateAutoexec(){
|
||||
autoexec = ($("#autoexec-cb")[0].checked)?1:0;
|
||||
autoexec1 = $("#autoexec1").val();
|
||||
|
||||
$.ajax({
|
||||
url: '/config.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
headers: { "X-Custom-autoexec": autoexec, "X-Custom-autoexec1": autoexec1 },
|
||||
data: { 'timestamp': Date.now() }
|
||||
});
|
||||
console.log('sent config JSON with headers:', autoexec, autoexec1);
|
||||
}
|
||||
|
||||
var output = '';
|
||||
function selectOutput(el) {
|
||||
if ($(el).attr('id') == 'bt') {
|
||||
$("#btsinkdiv").show(200);
|
||||
output = 'bt';
|
||||
} else if ($(el).attr('id') == 'spdif') {
|
||||
$("#btsinkdiv").hide(200);
|
||||
output = 'spdif';
|
||||
} else {
|
||||
$("#btsinkdiv").hide(200);
|
||||
output = 'i2s';
|
||||
}
|
||||
}
|
||||
|
||||
function generateCommand() {
|
||||
var commandLine = commandHeader + '-n ' + $("#player").val();
|
||||
|
||||
if (output == 'bt') {
|
||||
commandLine += ' -o "BT -n \'' + $("#btsink").val() + '\'" -R -Z 192000';
|
||||
} else if (output == 'spdif') {
|
||||
commandLine += ' -o SPDIF -R -Z 192000';
|
||||
} else {
|
||||
commandLine += ' -o I2S';
|
||||
}
|
||||
if ($("#optional").val() != '') {
|
||||
commandLine += ' ' + $("#optional").val();
|
||||
}
|
||||
$("#autoexec1").val(commandLine);
|
||||
}
|
||||
|
||||
function handleClick(item) {
|
||||
console.log(item);
|
||||
if (item.id == 'autoexec-cb') {
|
||||
if (item.checked) {
|
||||
$("#autoexec-command").show(200);
|
||||
} else {
|
||||
$("#autoexec-command").hide(200);
|
||||
}
|
||||
} else if (item.id == 'recovery') {
|
||||
$.ajax({
|
||||
url: '/recovery.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: { 'timestamp': Date.now()}
|
||||
});
|
||||
} else if (item.id == 'reboot') {
|
||||
$.ajax({
|
||||
url: '/reboot.json',
|
||||
dataType: 'json',
|
||||
method: 'POST',
|
||||
cache: false,
|
||||
data: { 'timestamp': Date.now()}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//TODO daduke check
|
||||
function file_change() {
|
||||
|
||||
@@ -4,24 +4,26 @@
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<link rel="stylesheet" href="/test/bootstrap.min.css"> <!-- TODO delete -->
|
||||
<link rel="stylesheet" href="/bootstrap.css">
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<script src="/jquery.js"></script>
|
||||
<script src="/bootstrap.js"></script>
|
||||
<script src="/popper.js"></script>
|
||||
<script src="/code.js"></script>
|
||||
|
||||
<!-- TODO delete -->
|
||||
<link rel="stylesheet" href="/test/bootstrap.min.css">
|
||||
<script src="/test/jquery.min.js"></script>
|
||||
<script src="/test/bootstrap.min.js"></script>
|
||||
<script src="/test/popper.min.js"></script>
|
||||
|
||||
<script src="/code.js"></script>
|
||||
|
||||
|
||||
<title>esp32-wifi-manager</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<ul class="nav nav-tabs">
|
||||
<ul id="navbar" class="nav nav-tabs">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" data-toggle="tab" href="#tab-wifi">WiFi</a>
|
||||
</li>
|
||||
@@ -31,6 +33,9 @@
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#tab-audio">Audio + LMS</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#tab-gpio">GPIO</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#tab-system">System</a>
|
||||
</li>
|
||||
@@ -67,8 +72,8 @@
|
||||
<input id="manual_pwd" type="password" placeholder="Password" value="">
|
||||
</section>
|
||||
<div class="buttons">
|
||||
<input id="manual_join" type="button" value="Join" data-connect="manual" />
|
||||
<input id="manual_cancel" type="button" value="Cancel"/>
|
||||
<input id="manual_join" type="button" class="btn btn-success" value="Join" data-connect="manual" />
|
||||
<input id="manual_cancel" type="button" class="btn btn-danger" value="Cancel"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -81,8 +86,8 @@
|
||||
<input id="pwd" type="password" placeholder="Password" value="">
|
||||
</section>
|
||||
<div class="buttons">
|
||||
<input id="join" type="button" value="Join" />
|
||||
<input id="cancel" type="button" value="Cancel"/>
|
||||
<input id="join" type="button" class="btn btn-success" value="Join" />
|
||||
<input id="cancel" type="button" class="btn btn-danger" value="Cancel"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -105,7 +110,7 @@
|
||||
</div>
|
||||
</section>
|
||||
<div class="buttons">
|
||||
<input id="ok-connect" type="button" value="OK" class="ctr" />
|
||||
<input id="ok-connect" type="button" value="OK" class="btn btn-success" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -117,7 +122,7 @@
|
||||
<h2></h2>
|
||||
<section>
|
||||
<div class="buttons">
|
||||
<input id="disconnect" type="button" value="Disconnect" class="ctr"/>
|
||||
<input id="disconnect" type="button" value="Disconnect" class="btn btn-danger"/>
|
||||
</div>
|
||||
</section>
|
||||
<h2>IP Address</h2>
|
||||
@@ -127,15 +132,15 @@
|
||||
<div class="ape">Default Gateway:<div id="gw" class="fr"></div></div>
|
||||
</section>
|
||||
<div class="buttons">
|
||||
<input id="ok-details" type="button" value="OK" class="ctr" />
|
||||
<input id="ok-details" type="button" value="Back" class="btn btn-success" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="diag-disconnect" class="diag-box">
|
||||
<div class="diag-box-win">
|
||||
<p>Are you sure you would like to disconnect from this wifi?</p>
|
||||
<div class="buttons">
|
||||
<input id="no-disconnect" type="button" value="No" />
|
||||
<input id="yes-disconnect" type="button" value="Yes" />
|
||||
<input id="no-disconnect" type="button" value="No" class="btn btn-success" />
|
||||
<input id="yes-disconnect" type="button" value="Yes" class="btn btn-danger" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -143,71 +148,92 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tab-startup">
|
||||
<h2>Run squeezelite automatically at boot</h2>
|
||||
<div id="autoexec" class="toggle">
|
||||
<label>
|
||||
<input id="autoexec-cb" type="checkbox" checked="checked" onclick='handleClick(this);'/><span class="slider"></span>
|
||||
</label>
|
||||
<h1>Run squeezelite automatically at boot</h1>
|
||||
|
||||
<div class="custom-control custom-switch">
|
||||
<input type="checkbox" class="custom-control-input" id="autoexec-cb" checked="checked">
|
||||
<label class="custom-control-label" for="autoexec-cb"></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tab-audio">
|
||||
<div id="autoexec-command">
|
||||
<div id="audioout" class="toggle-buttons">
|
||||
<h2>Audio output</h2>
|
||||
<input type="radio" id="i2s" name="audio" checked='checked' />
|
||||
<label for="i2s">I2S</label>
|
||||
<input type="radio" id="spdif" name="audio" />
|
||||
<label for="spdif">SPDIF</label>
|
||||
<input type="radio" id="bt" name="audio" />
|
||||
<label for="bt">Bluetooth</label>
|
||||
<div id="audioout">
|
||||
<h1>Audio output</h1>
|
||||
<div class="form-group">
|
||||
<div class="custom-control custom-radio">
|
||||
<input type="radio" id="i2s" name="audio" class="custom-control-input" checked='checked' />
|
||||
<label for="i2s" class="custom-control-label">I2S</label>
|
||||
</div>
|
||||
<div class="custom-control custom-radio">
|
||||
<input type="radio" id="spdif" name="audio" class="custom-control-input" />
|
||||
<label for="spdif" class="custom-control-label">SPDIF</label>
|
||||
</div>
|
||||
<div class="custom-control custom-radio">
|
||||
<input type="radio" id="bt" name="audio" class="custom-control-input" />
|
||||
<label for="bt" class="custom-control-label">Bluetooth</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="btsinkdiv">
|
||||
<input id="btsink" type="text" value="BT sink name" />
|
||||
</div>
|
||||
<div>
|
||||
<h2>Player name</h2>
|
||||
<input id="player" type="text" value="squeezelite" />
|
||||
</div>
|
||||
<div>
|
||||
<h2>Optional setting (e.g. for LMS IP address)</h2>
|
||||
<input id="optional" type="text" value="" placeholder="-s 192.168.0.1" />
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<input id="generate-command" type="button" value="Generate" />
|
||||
</div>
|
||||
|
||||
<h2>Squeezelite command to run</h2>
|
||||
<section id="command-list">
|
||||
<textarea id="autoexec1" maxlength="120">squeezelite -o I2S -b 500:2000 -d all=info -M esp32</textarea>
|
||||
</section>
|
||||
</div>
|
||||
<div id="btsinkdiv">
|
||||
<input id="btsink" type="text" value="BT sink name" />
|
||||
</div>
|
||||
<div>
|
||||
<h1>Player name</h1>
|
||||
<input id="player" type="text" value="squeezelite" />
|
||||
</div>
|
||||
<div>
|
||||
<h1>Optional setting (e.g. for LMS IP address)</h1>
|
||||
<input id="optional" type="text" value="" placeholder="-s 192.168.0.1" />
|
||||
</div>
|
||||
|
||||
<div class="buttons">
|
||||
<input id="generate-command" type="button" class="btn btn-success" value="Generate" />
|
||||
</div>
|
||||
|
||||
<h1>Squeezelite command to run</h1>
|
||||
<section id="command-list">
|
||||
<textarea id="autoexec1" maxlength="120">squeezelite -o I2S -b 500:2000 -d all=info -M esp32</textarea>
|
||||
</section>
|
||||
<div class="buttons">
|
||||
<input id="save-autoexec1" type="button" class="btn btn-success" value="Save" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tab-gpio">
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tab-system">
|
||||
<div id="recoverydiv">
|
||||
<h2>Check for firmware upgrade</h2>
|
||||
<h1>Check for firmware upgrade</h1>
|
||||
<div class="buttons">
|
||||
<input type="button" id="fwcheck" value="Check" onclick='handleClick(this);' />
|
||||
<p><span id="currentfw">Currently running: 0.1</span> - <span id="latestfw">latest available version: 0.2</span></p>
|
||||
<input type="button" id="fwcheck" class="btn btn-info" value="Update" />
|
||||
</div>
|
||||
<h2>Reboot to recovery system to perform firmware upgrade</h2>
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Firmware version</th>
|
||||
<th scope="col">IDF version</th>
|
||||
<th scope="col">HW platform</th>
|
||||
<th scope="col">Branch</th>
|
||||
<th scope="col">Flash this FW</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="releaseTable">
|
||||
</tbody>
|
||||
</table>
|
||||
<h1>Reboot to recovery system to perform firmware upgrade</h1>
|
||||
<div class="buttons">
|
||||
<input type="button" id="recovery" value="Recovery" onclick='handleClick(this);' />
|
||||
<input type="button" id="recovery" class="btn btn-warning" value="Recovery" />
|
||||
</div>
|
||||
</div>
|
||||
<div id="otadiv">
|
||||
<header><h1>Firmware upgrade</h1></header>
|
||||
<form name="multipart" action="otaform" method="post" enctype="multipart/form-data" onsubmit="do_upload(this); return false;">
|
||||
<progress id="progr" value="0" max="100" >Upload Progress</progress>
|
||||
<input type="file" name="ota" id="ota" size="20" accept=".bin" onchange="file_change();">
|
||||
<span id="file_info"></span>
|
||||
<input type="submit" id="update" disabled="" value="Upload">
|
||||
</form>
|
||||
<h2>Reboot system with new firmware</h2>
|
||||
<h1>Reboot system with new firmware</h1>
|
||||
<div class="buttons">
|
||||
<input type="button" id="reboot" value="Reboot" onclick='handleClick(this);' />
|
||||
<input type="button" id="reboot" class="btn btn-warning" value="Reboot" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user