mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-14 15:37:10 +03:00
Compare commits
3 Commits
developmen
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c224b4b84 | ||
|
|
bbbc924fcd | ||
|
|
cc5fb49ff8 |
@@ -43,7 +43,7 @@ static struct {
|
||||
/****************************************************************************************
|
||||
*
|
||||
*/
|
||||
int battery_value_svc(void) {
|
||||
float battery_value_svc(void) {
|
||||
return battery.avg;
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ void monitor_svc_init(void) {
|
||||
monitor_timer = xTimerCreate("monitor", MONITOR_TIMER / portTICK_RATE_MS, pdTRUE, NULL, monitor_callback);
|
||||
xTimerStart(monitor_timer, portMAX_DELAY);
|
||||
}
|
||||
free(p);
|
||||
FREE_AND_NULL(p);
|
||||
|
||||
ESP_LOGI(TAG, "Heap internal:%zu (min:%zu) external:%zu (min:%zu)",
|
||||
heap_caps_get_free_size(MALLOC_CAP_INTERNAL),
|
||||
|
||||
@@ -16,6 +16,6 @@ extern bool jack_inserted_svc(void);
|
||||
extern void (*spkfault_handler_svc)(bool inserted);
|
||||
extern bool spkfault_svc(void);
|
||||
|
||||
extern int battery_value_svc(void);
|
||||
extern float battery_value_svc(void);
|
||||
extern uint8_t battery_level_svc(void);
|
||||
|
||||
|
||||
@@ -1028,19 +1028,27 @@ function checkStatus() {
|
||||
if (data.hasOwnProperty('Voltage')) {
|
||||
var voltage = data['Voltage'];
|
||||
var layer;
|
||||
|
||||
/* Assuming Li-ion 18650s as a power source, 3.9V per cell, or above is treated
|
||||
as full charge (>75% of capacity). 3.4V is empty. The gauge is loosely
|
||||
following the graph here:
|
||||
https://learn.adafruit.com/li-ion-and-lipoly-batteries/voltages
|
||||
using the 0.2C discharge profile for the rest of the values.
|
||||
*/
|
||||
|
||||
if (voltage > 0) {
|
||||
if (inRange(voltage, 5.8, 6.2) || inRange(voltage, 8.8, 9.2)) {
|
||||
if (inRange(voltage, 5.8, 6.8) || inRange(voltage, 8.8, 10.2)) {
|
||||
layer = bat0;
|
||||
} else if (inRange(voltage, 6.2, 6.8) || inRange(voltage, 9.2, 10.0)) {
|
||||
} else if (inRange(voltage, 6.8, 7.4) || inRange(voltage, 10.2, 11.1)) {
|
||||
layer = bat1;
|
||||
} else if (inRange(voltage, 6.8, 7.1) || inRange(voltage, 10.0, 10.5)) {
|
||||
} else if (inRange(voltage, 7.4, 7.5) || inRange(voltage, 11.1, 11.25)) {
|
||||
layer = bat2;
|
||||
} else if (inRange(voltage, 7.1, 7.5) || inRange(voltage, 10.5, 11.0)) {
|
||||
} else if (inRange(voltage, 7.5, 7.8) || inRange(voltage, 11.25, 11.7)) {
|
||||
layer = bat3;
|
||||
} else {
|
||||
layer = bat4;
|
||||
}
|
||||
layer.setAttribute("display", "inline");
|
||||
layer.setAttribute("display","inline");
|
||||
}
|
||||
}
|
||||
if (data.hasOwnProperty('Jack')) {
|
||||
@@ -1235,8 +1243,9 @@ function getCommands() {
|
||||
}
|
||||
|
||||
function getConfig() {
|
||||
$.getJSON("/config.json", function(data) {
|
||||
Object.keys(data.hasOwnProperty('config') ? data.config : data).sort().forEach(function(key, i) {
|
||||
$.getJSON("/config.json", function(entries) {
|
||||
data = entries.hasOwnProperty('config') ? entries.config : entries;
|
||||
Object.keys(data).sort().forEach(function(key, i) {
|
||||
if (data.hasOwnProperty(key)) {
|
||||
if (key == 'autoexec') {
|
||||
if (data["autoexec"].value === "1") {
|
||||
@@ -1272,9 +1281,9 @@ function getConfig() {
|
||||
}
|
||||
});
|
||||
$("tbody#nvsTable").append("<tr><td><input type='text' class='form-control' id='nvs-new-key' placeholder='new key'></td><td><input type='text' class='form-control' id='nvs-new-value' placeholder='new value' nvs_type=33 ></td></tr>");
|
||||
if (data.hasOwnProperty('gpio')) {
|
||||
data.gpio.forEach(function(gpio_entry) {
|
||||
cl = gpio_entry.fixed ? "table-light" : "table-dark";
|
||||
if (entries.hasOwnProperty('gpio')) {
|
||||
entries.gpio.forEach(function(gpio_entry) {
|
||||
cl = gpio_entry.fixed ? "table-secondary" : "table-primary";
|
||||
$("tbody#gpiotable").append('<tr class=' + cl + '><th scope="row">' + gpio_entry.group + '</th><td>' + gpio_entry.name + '</td><td>' + gpio_entry.gpio + '</td><td>' + (gpio_entry.fixed ? 'Fixed':'Configuration') + '</td></tr>');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -207,6 +207,7 @@
|
||||
</div>
|
||||
<!-- wifi -->
|
||||
<div class="tab-pane fade" id="tab-setdisplay">
|
||||
<div id="set_services-list"></div>
|
||||
<div id="setname-list"></div>
|
||||
<div id="setdisplay-list"></div>
|
||||
<div id="i2cconfig-list"></div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -272,10 +272,18 @@ void wifi_manager_init_wifi(){
|
||||
ESP_LOGD(TAG, "Initializing wifi. Setting WiFi mode to WIFI_MODE_NULL");
|
||||
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_NULL) );
|
||||
ESP_LOGD(TAG, "Initializing wifi. Starting wifi");
|
||||
if (gpio36_39_used) {
|
||||
ESP_LOGW(TAG, "GPIO 36 or 39 are in use, need to disable WiFi PowerSave!");
|
||||
esp_wifi_set_ps(WIFI_PS_NONE);
|
||||
char * disable_ps = config_alloc_get_default(NVS_TYPE_STR, "disable_ps", "n", 0);
|
||||
|
||||
if (gpio36_39_used || (disable_ps && strcasecmp(disable_ps,"y")==0)) {
|
||||
if(gpio36_39_used){
|
||||
ESP_LOGW(TAG, "GPIO 36 or 39 are in use, need to disable WiFi PowerSave!");
|
||||
}
|
||||
else {
|
||||
ESP_LOGW(TAG, "wifi powersave config is disabled. Disabling WiFi PowerSave!");
|
||||
}
|
||||
esp_wifi_set_ps(WIFI_PS_NONE);
|
||||
}
|
||||
FREE_AND_NULL(disable_ps);
|
||||
ESP_ERROR_CHECK( esp_wifi_start() );
|
||||
|
||||
taskYIELD();
|
||||
|
||||
Reference in New Issue
Block a user