mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2026-05-29 16:37:45 +01:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a653bf374 | |||
| 2a77d09f11 | |||
| d03678ea81 | |||
| 5019b5bf0f | |||
| 3f1a7265b1 | |||
| 338eea33d1 | |||
| ffb79e1e8c | |||
| 1fe515b18d | |||
| fa5b2c8e45 | |||
| 9b97404fa2 | |||
| a0d3c60f62 | |||
| b60aed659a | |||
| 484d8c54a8 |
@@ -1,11 +1,5 @@
|
||||
2023-10-27
|
||||
- fix vorbis (and opus) memory leak
|
||||
|
||||
2023-10-25
|
||||
- fix vorbis codec close
|
||||
|
||||
2023-10-23
|
||||
- fix Spotify track insertion
|
||||
2023-10-11
|
||||
- Reduce the size of binaries (Fixes https://github.com/sle118/squeezelite-esp32/issues/329)
|
||||
- [WEB] Allow running without LMS with option "Audio/Disable Squeezelite"
|
||||
|
||||
2023-10.07
|
||||
|
||||
@@ -25,11 +25,7 @@ ENV GCC_TOOLS_BASE=/opt/esp/tools/xtensa-esp32-elf/esp-2021r2-patch3-8.4.0/xtens
|
||||
# pushd components/wifi-manager/webapp/ && npm install && npm run-script build && popd
|
||||
#
|
||||
# to run the docker with netwotrk port published on the host:
|
||||
# (windows)
|
||||
# docker run --rm -p 5000:5000/tcp -v %cd%:/project -w /project -it sle118/squeezelite-esp32-idfv435
|
||||
# (linux)
|
||||
# docker run --rm -p 5000:5000/tcp -v `pwd`:/project -w /project -it sle118/squeezelite-esp32-idfv435
|
||||
|
||||
|
||||
ARG IDF_CLONE_URL=https://github.com/espressif/esp-idf.git
|
||||
ARG IDF_CLONE_BRANCH_OR_TAG=master
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
param (
|
||||
[Parameter(Position=0, Mandatory=$false)]
|
||||
[ValidateSet("t", "u")]
|
||||
[string]$option
|
||||
)
|
||||
|
||||
# Define the directory to apply changes to
|
||||
$targetDir = "components\wifi-manager\webapp\dist"
|
||||
|
||||
# Get the current directory
|
||||
$currentDir = Get-Location
|
||||
|
||||
# Get list of files from the file system
|
||||
$fsFiles = Get-ChildItem -Recurse $targetDir -File | ForEach-Object {
|
||||
$_.FullName.Substring($currentDir.Path.Length + 1).Replace("\", "/")
|
||||
}
|
||||
|
||||
# Get list of files from the Git index
|
||||
$indexFiles = git ls-files -s $targetDir | ForEach-Object {
|
||||
($_ -split "\s+")[3]
|
||||
}
|
||||
|
||||
# Combine and remove duplicates
|
||||
$allFiles = $fsFiles + $indexFiles | Sort-Object -Unique
|
||||
|
||||
# Apply the git command based on the option
|
||||
$allFiles | ForEach-Object {
|
||||
$relativePath = $_
|
||||
$isInIndex = $indexFiles -contains $relativePath
|
||||
|
||||
if ($null -eq $option) {
|
||||
$status = if ($isInIndex) { 'tracked' } else { 'not tracked' }
|
||||
Write-Host "$relativePath is $status"
|
||||
}
|
||||
elseif ($isInIndex) {
|
||||
if ($option -eq "t") {
|
||||
git update-index --no-skip-worktree $relativePath
|
||||
Write-Host "Started tracking changes in $relativePath"
|
||||
}
|
||||
elseif ($option -eq "u") {
|
||||
git update-index --skip-worktree $relativePath
|
||||
Write-Host "Stopped tracking changes in $relativePath"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "File $relativePath is not tracked."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
|
||||
#include "Batch.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_http_client.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_netif.h"
|
||||
#include "esp_ota_ops.h"
|
||||
#include "esp_tls.h"
|
||||
#include "nvs_flash.h"
|
||||
#if CONFIG_MBEDTLS_CERTIFICATE_BUNDLE
|
||||
#include "esp_crt_bundle.h"
|
||||
#endif
|
||||
#include "esp_system.h"
|
||||
#include "http_handlers.h"
|
||||
#include "nvs.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "nvs_utilities.h"
|
||||
#include "tools.h"
|
||||
#include <algorithm>
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <sys/param.h>
|
||||
#if CONFIG_WITH_METRICS
|
||||
static const char* const TAG = "MetricsBatch";
|
||||
static const char* const feature_evt_name = "$feature_flag_called";
|
||||
static const char* const feature_flag_name = "$feature_flag";
|
||||
static const char* const feature_flag_response_name = "$feature_flag_response";
|
||||
|
||||
namespace Metrics {
|
||||
|
||||
Event& Batch::add_feature_event() { return add_event(feature_evt_name); }
|
||||
void Batch::add_remove_feature_event(const char* name, bool active) {
|
||||
if (!active) {
|
||||
remove_feature_event(name);
|
||||
} else {
|
||||
add_event(feature_evt_name).add_property(feature_flag_name, name);
|
||||
}
|
||||
}
|
||||
Event& Batch::add_feature_variant_event(const char* const name, const char* const value) {
|
||||
return add_event(feature_evt_name)
|
||||
.add_property(feature_flag_name, name)
|
||||
.add_property(feature_flag_response_name, value);
|
||||
}
|
||||
void Batch::remove_feature_event(const char* name) {
|
||||
for (Metrics::Event& e : _events) {
|
||||
if (strcmp(e.get_name(), feature_evt_name) == 0) {
|
||||
e.remove_property(feature_flag_name, name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
cJSON* Batch::to_json() {
|
||||
cJSON* batch_json = cJSON_CreateArray();
|
||||
for (Metrics::Event& e : _events) {
|
||||
cJSON_AddItemToArray(batch_json, e.to_json(_metrics_uid.c_str()));
|
||||
}
|
||||
cJSON* message = cJSON_CreateObject();
|
||||
cJSON_AddItemToObject(message, "batch", batch_json);
|
||||
cJSON_AddStringToObject(message, "api_key", _api_key);
|
||||
return batch_json;
|
||||
}
|
||||
char* Batch::to_json_str() {
|
||||
cJSON* json = to_json();
|
||||
char* json_str = cJSON_PrintUnformatted(json);
|
||||
cJSON_Delete(json);
|
||||
return json_str;
|
||||
}
|
||||
|
||||
void Batch::push() {
|
||||
int status_code = 0;
|
||||
if (_metrics_uid.empty() && !_warned) {
|
||||
ESP_LOGW(TAG, "Metrics disabled; no CID found");
|
||||
_warned = true;
|
||||
return;
|
||||
}
|
||||
|
||||
char* json_str = to_json_str();
|
||||
ESP_LOGV(TAG, "Metrics payload: %s", json_str);
|
||||
uint32_t start_time = gettime_ms();
|
||||
|
||||
status_code = metrics_http_post_request(json_str, _url);
|
||||
|
||||
if (status_code == 200 || status_code == 204) {
|
||||
_events.clear();
|
||||
}
|
||||
FREE_AND_NULL(json_str)
|
||||
ESP_LOGD(TAG, "Total duration for metrics call: %lu. ", gettime_ms() - start_time);
|
||||
}
|
||||
|
||||
void Batch::build_guid() {
|
||||
uint8_t raw[16];
|
||||
std::ostringstream oss;
|
||||
esp_fill_random(raw, 16);
|
||||
std::for_each(std::begin(raw), std::end(raw), [&oss](const uint8_t& byte) {
|
||||
oss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(byte);
|
||||
});
|
||||
_metrics_uid = oss.str();
|
||||
}
|
||||
void Batch::assign_id() {
|
||||
size_t size = 0;
|
||||
esp_err_t esp_err = ESP_OK;
|
||||
_metrics_uid = std::string((char*)get_nvs_value_alloc_for_partition(
|
||||
NVS_DEFAULT_PART_NAME, TAG, NVS_TYPE_BLOB, "cid", &size));
|
||||
if (_metrics_uid[0] == 'G') {
|
||||
ESP_LOGW(TAG, "Invalid ID. %s", _metrics_uid.c_str());
|
||||
_metrics_uid.clear();
|
||||
}
|
||||
if (_metrics_uid.empty()) {
|
||||
build_guid();
|
||||
if (_metrics_uid.empty()) {
|
||||
ESP_LOGE(TAG, "ID Failed");
|
||||
return;
|
||||
}
|
||||
ESP_LOGW(TAG, "Metrics ID: %s", _metrics_uid.c_str());
|
||||
esp_err = store_nvs_value_len_for_partition(NVS_DEFAULT_PART_NAME, TAG, NVS_TYPE_BLOB,
|
||||
"cid", _metrics_uid.c_str(), _metrics_uid.length() + 1);
|
||||
if (esp_err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Store ID failed: %s", esp_err_to_name(esp_err));
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace Metrics
|
||||
#endif
|
||||
@@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
#include "Events.h"
|
||||
#include <string>
|
||||
#ifdef __cplusplus
|
||||
namespace Metrics {
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
class Batch {
|
||||
private:
|
||||
std::list<Event> _events;
|
||||
bool _warned = false;
|
||||
std::string _metrics_uid = nullptr;
|
||||
const char* _api_key = nullptr;
|
||||
const char* _url = nullptr;
|
||||
void build_guid();
|
||||
void assign_id();
|
||||
|
||||
public:
|
||||
Batch() = default;
|
||||
void configure(const char* api_key, const char* url) {
|
||||
_api_key = api_key;
|
||||
_url = url;
|
||||
assign_id();
|
||||
}
|
||||
Event& add_feature_event();
|
||||
void add_remove_feature_event(const char* name, bool active);
|
||||
Event& add_feature_variant_event(const char* const name, const char* const value);
|
||||
Event& add_event(const char* name) {
|
||||
_events.emplace_back(name);
|
||||
return _events.back();
|
||||
}
|
||||
|
||||
bool has_events() const { return !_events.empty(); }
|
||||
void remove_feature_event(const char* name);
|
||||
cJSON* to_json();
|
||||
char* to_json_str();
|
||||
void push();
|
||||
};
|
||||
}
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
idf_component_register(SRC_DIRS .
|
||||
INCLUDE_DIRS .
|
||||
REQUIRES json tools platform_config wifi-manager esp-tls platform_config
|
||||
PRIV_REQUIRES esp32 freertos
|
||||
)
|
||||
@@ -0,0 +1,98 @@
|
||||
#include "Events.h"
|
||||
#include <algorithm>
|
||||
#include "esp_app_format.h"
|
||||
#include "esp_ota_ops.h"
|
||||
#if CONFIG_WITH_METRICS
|
||||
static const char* const TAG = "MetricsEvent";
|
||||
namespace Metrics {
|
||||
Event& Event::add_property(const char* name, const char* value) {
|
||||
ESP_LOGV(TAG, "Adding property %s:%s to event %s",name,value,_name);
|
||||
char* mutable_name = strdup_psram(name); // Cast away const-ness, be careful with this
|
||||
auto elem = properties.find(mutable_name);
|
||||
FREE_AND_NULL(mutable_name)
|
||||
if (elem == properties.end()) {
|
||||
ESP_LOGV(TAG, "Adding property %s:%s to event %s",name,value,_name);
|
||||
properties.insert({strdup_psram(name), strdup_psram(value)});
|
||||
} else {
|
||||
ESP_LOGV(TAG, "Replacing value for property %s. Old: %s New: %s, Event: %s",name,elem->second,value,name);
|
||||
FREE_AND_NULL(elem->second)
|
||||
elem->second = strdup_psram(value);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool Event::has_property_value(const char* name, const char* value) const {
|
||||
ESP_LOGV(TAG, "Checking if event %s property %s has value %s",_name, name,value);
|
||||
return std::any_of(properties.begin(), properties.end(),
|
||||
[name, value](const std::pair<const char* const, char*>& kv) {
|
||||
ESP_LOGV(TAG, "Found property %s=%s", name,value);
|
||||
return strcmp(kv.first, name) == 0 && strcmp(kv.second, value) == 0;
|
||||
});
|
||||
}
|
||||
|
||||
void Event::remove_property(const char* name, const char* value) {
|
||||
auto it = properties.begin();
|
||||
ESP_LOGV(TAG, "Removing event %s property %s=%s",_name, name,value);
|
||||
while (it != properties.end()) {
|
||||
if (strcmp(it->first, name) == 0 && strcmp(it->second, value)) {
|
||||
properties.erase(it);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ESP_LOGV(TAG, "Property %s=%s not found.", name,value);
|
||||
}
|
||||
cJSON* Event::properties_to_json() {
|
||||
ESP_LOGV(TAG, "Event %s properties to json.",_name);
|
||||
const esp_app_desc_t* desc = esp_ota_get_app_description();
|
||||
#ifdef CONFIG_FW_PLATFORM_NAME
|
||||
const char* platform = CONFIG_FW_PLATFORM_NAME;
|
||||
#else
|
||||
const char* platform = desc->project_name;
|
||||
#endif
|
||||
cJSON* prop_json = cJSON_CreateObject();
|
||||
auto it = properties.begin();
|
||||
|
||||
while (it != properties.end()) {
|
||||
cJSON_AddStringToObject(prop_json, it->first, it->second);
|
||||
++it;
|
||||
}
|
||||
cJSON_AddStringToObject(prop_json, "platform", platform);
|
||||
cJSON_AddStringToObject(prop_json, "build", desc->version);
|
||||
dump_json_content("User properties for event:", prop_json, ESP_LOG_VERBOSE);
|
||||
return prop_json;
|
||||
}
|
||||
cJSON* Event::to_json(const char* distinct_id) {
|
||||
// The target structure looks like this
|
||||
// {
|
||||
// "event": "batched_event_name_1",
|
||||
// "properties": {
|
||||
// "distinct_id": "user distinct id",
|
||||
// "account_type": "pro"
|
||||
// },
|
||||
// "timestamp": "[optional timestamp in ISO 8601 format]"
|
||||
// }
|
||||
ESP_LOGV(TAG,"Event %s to json",_name);
|
||||
|
||||
free_json();
|
||||
_json = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(_json, "name", _name);
|
||||
cJSON_AddItemToObject(_json, "properties", properties_to_json());
|
||||
|
||||
char buf[26] = {};
|
||||
strftime(buf, sizeof(buf), "%FT%TZ", gmtime(&_time));
|
||||
// this will work too, if your compiler doesn't support %F or %T:
|
||||
// strftime(buf, sizeof buf, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
|
||||
cJSON_AddStringToObject(_json, "timestamp", buf);
|
||||
cJSON* prop_json = properties_to_json();
|
||||
cJSON_AddStringToObject(prop_json, "distinct_id", distinct_id);
|
||||
dump_json_content("Full Event:", _json, ESP_LOG_VERBOSE);
|
||||
return _json;
|
||||
}
|
||||
void Event::free_json() { cJSON_Delete(_json); }
|
||||
void Event::update_time() {
|
||||
if (_time == 0) {
|
||||
_time = time(nullptr);
|
||||
}
|
||||
}
|
||||
} // namespace Metrics
|
||||
#endif
|
||||
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "esp_log.h"
|
||||
#include "tools.h"
|
||||
#include <cJSON.h>
|
||||
#include <ctime>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
namespace Metrics {
|
||||
struct StrCompare {
|
||||
bool operator()(const char* a, const char* b) const { return strcmp(a, b) < 0; }
|
||||
};
|
||||
|
||||
class Event {
|
||||
|
||||
public:
|
||||
std::map<char*, char*, StrCompare> properties;
|
||||
Event& add_property(const char* name, const char* value);
|
||||
bool has_property_value(const char* name, const char* value) const;
|
||||
void remove_property(const char* name, const char* value);
|
||||
cJSON* properties_to_json();
|
||||
cJSON* to_json(const char* distinct_id);
|
||||
void free_json();
|
||||
void update_time();
|
||||
explicit Event(const char* name) {
|
||||
_name = strdup_psram(name);
|
||||
memset(&_time, 0x00, sizeof(_time));
|
||||
}
|
||||
const char* get_name() const { return _name; }
|
||||
~Event() {
|
||||
FREE_AND_NULL(_name);
|
||||
|
||||
// Iterate through the map and free the elements
|
||||
for (auto& kv : properties) {
|
||||
free((void*)kv.first);
|
||||
free(kv.second);
|
||||
}
|
||||
properties.clear(); // Clear the map after freeing memory
|
||||
FREE_AND_NULL(_json);
|
||||
}
|
||||
private:
|
||||
char* _name = nullptr;
|
||||
uint32_t _time;
|
||||
cJSON* _json = nullptr;
|
||||
};
|
||||
|
||||
} // namespace Metrics
|
||||
#endif
|
||||
@@ -0,0 +1,148 @@
|
||||
#define LOG_LOCAL_LEVEL ESP_LOG_VERBOSE
|
||||
#include "Metrics.h"
|
||||
#include "Batch.h"
|
||||
#include "esp_event.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_netif.h"
|
||||
#include "esp_ota_ops.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_tls.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "tools.h"
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <vector>
|
||||
|
||||
#include "cJSON.h"
|
||||
#include "freertos/timers.h"
|
||||
#include "network_manager.h"
|
||||
#include "platform_config.h"
|
||||
|
||||
static const char* TAG = "metrics";
|
||||
|
||||
#if CONFIG_WITH_METRICS
|
||||
extern bool is_network_connected();
|
||||
#define METRICS_CLIENT_ID_LEN 50
|
||||
#define MAX_HTTP_RECV_BUFFER 512
|
||||
|
||||
static bool metrics_usage_gen = false;
|
||||
static uint32_t metrics_usage_gen_time = 0;
|
||||
#ifndef METRICS_API_KEY
|
||||
#pragma message "Metrics API key needs to be passed from the environment"
|
||||
#define METRICS_API_KEY "ZZZ"
|
||||
#endif
|
||||
static const char* metrics_api_key =
|
||||
static const char* parms_str = "params";
|
||||
static const char* properties_str = "properties";
|
||||
static const char* user_properties_str = "user_properties";
|
||||
static const char* items_str = "items";
|
||||
static const char* quantity_str = "quantity";
|
||||
static const char* metrics_url = "https://app.posthog.com";
|
||||
static TimerHandle_t timer;
|
||||
extern cJSON* get_cmd_list();
|
||||
Metrics::Batch batch;
|
||||
|
||||
static void metrics_timer_cb(void* timer_id) {
|
||||
if (batch.has_events()) {
|
||||
if (!is_network_connected()) {
|
||||
ESP_LOGV(TAG, "Network not connected. can't flush");
|
||||
} else {
|
||||
ESP_LOGV(TAG, "Pushing events");
|
||||
batch.push();
|
||||
}
|
||||
}
|
||||
if (gettime_ms() > metrics_usage_gen_time && !metrics_usage_gen) {
|
||||
metrics_usage_gen = true;
|
||||
ESP_LOGV(TAG, "Generate command list to pull features");
|
||||
cJSON* cmdlist = get_cmd_list();
|
||||
dump_json_content("generated cmd list", cmdlist, ESP_LOG_VERBOSE);
|
||||
cJSON_Delete(cmdlist);
|
||||
}
|
||||
}
|
||||
void metrics_init() {
|
||||
ESP_LOGV(TAG, "Initializing metrics");
|
||||
batch.configure(metrics_api_key, metrics_url);
|
||||
if (!timer) {
|
||||
ESP_LOGE(TAG, "Metrics Timer failure");
|
||||
} else {
|
||||
ESP_LOGV(TAG, "Starting timer");
|
||||
xTimerStart(timer, portMAX_DELAY);
|
||||
}
|
||||
// set a 20 seconds delay before generating the
|
||||
// features so the system has time to boot
|
||||
metrics_usage_gen_time = gettime_ms() + 20000;
|
||||
}
|
||||
|
||||
void metrics_event_playback(const char* source) {
|
||||
ESP_LOGV(TAG, "Playback event: %s", source);
|
||||
auto event = batch.add_event("play").add_property("source", source);
|
||||
}
|
||||
void metrics_event_boot(const char* partition) {
|
||||
ESP_LOGV(TAG, "Boot event %s", partition);
|
||||
auto event = batch.add_event("start");
|
||||
event.add_property("partition", partition);
|
||||
}
|
||||
void metrics_add_feature_variant(const char* name, const char* format, ...) {
|
||||
va_list args;
|
||||
ESP_LOGV(TAG, "Feature %s", name);
|
||||
va_start(args, format);
|
||||
|
||||
// Determine the required buffer size
|
||||
int size = vsnprintf(nullptr, 0, format, args);
|
||||
va_end(args); // Reset the va_list
|
||||
|
||||
// Allocate buffer and format the string
|
||||
std::vector<char> buffer(size + 1); // +1 for the null-terminator
|
||||
va_start(args, format);
|
||||
vsnprintf(buffer.data(), buffer.size(), format, args);
|
||||
va_end(args);
|
||||
|
||||
// Now buffer.data() contains the formatted string
|
||||
batch.add_feature_variant_event(name, buffer.data());
|
||||
}
|
||||
void metrics_add_feature(const char* name, bool active) {
|
||||
ESP_LOGV(TAG, "Adding feature %s: %s", name, active ? "ACTIVE" : "INACTIVE");
|
||||
batch.add_remove_feature_event(name, active);
|
||||
}
|
||||
void metrics_event(const char* name) {
|
||||
ESP_LOGV(TAG, "Adding Event %s", name);
|
||||
batch.add_event(name);
|
||||
}
|
||||
#else
|
||||
static const char * not_enabled = " - (metrics not enabled, this is just marking where the call happens)";
|
||||
void metrics_init(){
|
||||
#pragma message("Metrics disabled")
|
||||
ESP_LOGD(TAG,"Metrics init%s",not_enabled);
|
||||
}
|
||||
void metrics_event_boot(const char* partition){
|
||||
ESP_LOGD(TAG,"Metrics Event Boot from partition %s%s",partition,not_enabled);
|
||||
}
|
||||
void metrics_event(const char* name){
|
||||
ESP_LOGD(TAG,"Metrics Event %s%s",name,not_enabled);
|
||||
}
|
||||
void metrics_add_feature(const char* name, bool active) {
|
||||
ESP_LOGD(TAG,"Metrics add feature %s%s%s",name,active?"ACTIVE":"INACTIVE",not_enabled);
|
||||
}
|
||||
void metrics_add_feature_variant(const char* name, const char* format, ...){
|
||||
va_list args;
|
||||
ESP_LOGV(TAG, "Feature %s", name);
|
||||
va_start(args, format);
|
||||
|
||||
// Determine the required buffer size
|
||||
int size = vsnprintf(nullptr, 0, format, args);
|
||||
va_end(args); // Reset the va_list
|
||||
|
||||
// Allocate buffer and format the string
|
||||
std::vector<char> buffer(size + 1); // +1 for the null-terminator
|
||||
va_start(args, format);
|
||||
vsnprintf(buffer.data(), buffer.size(), format, args);
|
||||
va_end(args);
|
||||
|
||||
ESP_LOGD(TAG,"Metrics add feature %s variant %s%s",name,buffer.data(),not_enabled);
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void metrics_event_playback(const char* source);
|
||||
void metrics_event_boot(const char* partition);
|
||||
void metrics_event(const char* name);
|
||||
void metrics_add_feature(const char* name, bool active);
|
||||
void metrics_add_feature_variant(const char* name, const char* format, ...);
|
||||
void metrics_init();
|
||||
void metrics_flush();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,163 @@
|
||||
#include "http_handlers.h"
|
||||
#include "esp_http_client.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_tls.h"
|
||||
#include "tools.h"
|
||||
#include <sys/param.h>
|
||||
#if CONFIG_WITH_METRICS
|
||||
static const char* TAG = "metrics_http";
|
||||
static char* output_buffer; // Buffer to store response of http request from
|
||||
// event handler
|
||||
static int output_len = 0; // Stores number of bytes read
|
||||
#define MAX_HTTP_OUTPUT_BUFFER 2048
|
||||
// Common function signature for event handlers
|
||||
typedef void (*HttpEventHandler)(esp_http_client_event_t* evt);
|
||||
|
||||
static void handle_http_error(esp_http_client_event_t* evt) { ESP_LOGV(TAG, "ERROR"); }
|
||||
|
||||
static void handle_http_connected(esp_http_client_event_t* evt) {
|
||||
ESP_LOGV(TAG, "ON_CONNECTED");
|
||||
}
|
||||
|
||||
static void handle_http_header_sent(esp_http_client_event_t* evt) {
|
||||
ESP_LOGV(TAG, "HEADER_SENT");
|
||||
}
|
||||
|
||||
static void handle_http_on_header(esp_http_client_event_t* evt) {
|
||||
ESP_LOGV(TAG, "ON_HEADER, key=%s, value=%s", evt->header_key, evt->header_value);
|
||||
}
|
||||
|
||||
static void handle_http_on_data(esp_http_client_event_t* evt) {
|
||||
ESP_LOGV(TAG, "ON_DATA, len=%d", evt->data_len);
|
||||
ESP_LOGV(TAG, "ON_DATA, len=%d", evt->data_len);
|
||||
// Clean the buffer in case of a new request
|
||||
if (output_len == 0 && evt->user_data) {
|
||||
// we are just starting to copy the output data into the use
|
||||
ESP_LOGV(TAG, "Resetting buffer");
|
||||
memset(evt->user_data, 0, MAX_HTTP_OUTPUT_BUFFER);
|
||||
}
|
||||
/*
|
||||
* Check for chunked encoding is added as the URL for chunked encoding used in this example
|
||||
* returns binary data. However, event handler can also be used in case chunked encoding is
|
||||
* used.
|
||||
*/
|
||||
|
||||
// If user_data buffer is configured, copy the response into the buffer
|
||||
int copy_len = 0;
|
||||
if (evt->user_data) {
|
||||
ESP_LOGV(TAG, "Not Chunked response, with user data");
|
||||
// The last byte in evt->user_data is kept for the NULL character in
|
||||
// case of out-of-bound access.
|
||||
copy_len = MIN(evt->data_len, (MAX_HTTP_OUTPUT_BUFFER - output_len));
|
||||
if (copy_len) {
|
||||
memcpy(evt->user_data + output_len, evt->data, copy_len);
|
||||
}
|
||||
} else {
|
||||
int content_len = esp_http_client_get_content_length(evt->client);
|
||||
if (esp_http_client_is_chunked_response(evt->client)) {
|
||||
esp_http_client_get_chunk_length(evt->client, &content_len);
|
||||
}
|
||||
|
||||
if (output_buffer == NULL) {
|
||||
// We initialize output_buffer with 0 because it is used by
|
||||
// strlen() and similar functions therefore should be null
|
||||
// terminated.
|
||||
size_t len=(content_len + 1) * sizeof(char);
|
||||
ESP_LOGV(TAG, "Init buffer %d",len);
|
||||
output_buffer = (char*)malloc_init_external(len);
|
||||
output_len = 0;
|
||||
if (output_buffer == NULL) {
|
||||
ESP_LOGE(TAG, "Buffer alloc failed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
copy_len = MIN(evt->data_len, (content_len - output_len));
|
||||
if (copy_len) {
|
||||
memcpy(output_buffer + output_len, evt->data, copy_len);
|
||||
}
|
||||
}
|
||||
output_len += copy_len;
|
||||
}
|
||||
|
||||
static void handle_http_on_finish(esp_http_client_event_t* evt) {
|
||||
ESP_LOGD(TAG, "ON_FINISH");
|
||||
if (output_buffer != NULL) {
|
||||
ESP_LOGV(TAG, "Response: %s", output_buffer);
|
||||
free(output_buffer);
|
||||
output_buffer = NULL;
|
||||
}
|
||||
output_len = 0;
|
||||
}
|
||||
static void handle_http_disconnected(esp_http_client_event_t* evt) {
|
||||
ESP_LOGI(TAG, "DISCONNECTED");
|
||||
int mbedtls_err = 0;
|
||||
esp_err_t err =
|
||||
esp_tls_get_and_clear_last_error((esp_tls_error_handle_t)evt->data, &mbedtls_err, NULL);
|
||||
if (err != 0) {
|
||||
ESP_LOGI(TAG, "Last error : %s", esp_err_to_name(err));
|
||||
ESP_LOGI(TAG, "Last mbedtls err 0x%x", mbedtls_err);
|
||||
}
|
||||
if (output_buffer != NULL) {
|
||||
free(output_buffer);
|
||||
output_buffer = NULL;
|
||||
}
|
||||
output_len = 0;
|
||||
}
|
||||
static const HttpEventHandler eventHandlers[] = {
|
||||
handle_http_error, // HTTP_EVENT_ERROR
|
||||
handle_http_connected, // HTTP_EVENT_ON_CONNECTED
|
||||
handle_http_header_sent, // HTTP_EVENT_HEADERS_SENT
|
||||
handle_http_header_sent, // HTTP_EVENT_HEADER_SENT (alias for HTTP_EVENT_HEADERS_SENT)
|
||||
handle_http_on_header, // HTTP_EVENT_ON_HEADER
|
||||
handle_http_on_data, // HTTP_EVENT_ON_DATA
|
||||
handle_http_on_finish, // HTTP_EVENT_ON_FINISH
|
||||
handle_http_disconnected // HTTP_EVENT_DISCONNECTED
|
||||
};
|
||||
esp_err_t metrics_http_event_handler(esp_http_client_event_t* evt) {
|
||||
|
||||
if (evt->event_id < 0 || evt->event_id >= sizeof(eventHandlers) / sizeof(eventHandlers[0])) {
|
||||
ESP_LOGE(TAG, "Invalid event ID: %d", evt->event_id);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
eventHandlers[evt->event_id](evt);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
int metrics_http_post_request(const char* payload, const char* url) {
|
||||
int status_code = 0;
|
||||
esp_http_client_config_t config = {.url = url,
|
||||
.disable_auto_redirect = false,
|
||||
.event_handler = metrics_http_event_handler,
|
||||
.transport_type = HTTP_TRANSPORT_OVER_SSL,
|
||||
.user_data = NULL, // local_response_buffer, // Pass address of
|
||||
// local buffer to get response
|
||||
.skip_cert_common_name_check = true
|
||||
|
||||
};
|
||||
esp_http_client_handle_t client = esp_http_client_init(&config);
|
||||
esp_err_t err = esp_http_client_set_method(client, HTTP_METHOD_POST);
|
||||
|
||||
if (err == ESP_OK) {
|
||||
err = esp_http_client_set_header(client, "Content-Type", "application/json");
|
||||
}
|
||||
if (err == ESP_OK) {
|
||||
ESP_LOGV(TAG, "Setting payload: %s", payload);
|
||||
err = esp_http_client_set_post_field(client, payload, strlen(payload));
|
||||
}
|
||||
if (err == ESP_OK) {
|
||||
err = esp_http_client_perform(client);
|
||||
}
|
||||
if (err == ESP_OK) {
|
||||
status_code = esp_http_client_get_status_code(client);
|
||||
ESP_LOGD(TAG, "metrics call Status = %d, content_length = %d",
|
||||
esp_http_client_get_status_code(client), esp_http_client_get_content_length(client));
|
||||
|
||||
} else {
|
||||
status_code = 500;
|
||||
ESP_LOGW(TAG, "metrics call Status failed: %s", esp_err_to_name(err));
|
||||
}
|
||||
esp_http_client_cleanup(client);
|
||||
return status_code;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int metrics_http_post_request(const char* payload, const char* url);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -13,14 +13,14 @@ esp_err_t store_nvs_value_len(nvs_type_t type, const char *key, void * data, siz
|
||||
esp_err_t store_nvs_value(nvs_type_t type, const char *key, void * data);
|
||||
esp_err_t get_nvs_value(nvs_type_t type, const char *key, void*value, const uint8_t buf_size);
|
||||
void * get_nvs_value_alloc(nvs_type_t type, const char *key);
|
||||
void * get_nvs_value_alloc_for_partition(const char * partition,const char * ns,nvs_type_t type, const char *key, size_t * size);
|
||||
esp_err_t erase_nvs_for_partition(const char * partition, const char * ns,const char *key);
|
||||
esp_err_t store_nvs_value_len_for_partition(const char * partition,const char * ns,nvs_type_t type, const char *key, const void * data,size_t data_len);
|
||||
void * get_nvs_value_alloc_for_partition(const char * partition,const char * name_space,nvs_type_t type, const char *key, size_t * size);
|
||||
esp_err_t erase_nvs_for_partition(const char * partition, const char * name_space,const char *key);
|
||||
esp_err_t store_nvs_value_len_for_partition(const char * partition,const char * name_space,nvs_type_t type, const char *key, const void * data,size_t data_len);
|
||||
esp_err_t erase_nvs(const char *key);
|
||||
void print_blob(const char *blob, size_t len);
|
||||
const char *type_to_str(nvs_type_t type);
|
||||
nvs_type_t str_to_type(const char *type);
|
||||
esp_err_t erase_nvs_partition(const char * partition, const char * ns);
|
||||
esp_err_t erase_nvs_partition(const char * partition, const char * name_space);
|
||||
void erase_settings_partition();
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -538,7 +538,7 @@ bool config_set_group_bit(int bit_num,bool flag){
|
||||
return result;
|
||||
}
|
||||
|
||||
void config_set_default(nvs_type_t type, const char *key, void * default_value, size_t blob_size) {
|
||||
void config_set_default(nvs_type_t type, const char *key, const void * default_value, size_t blob_size) {
|
||||
if(!config_lock(LOCK_MAX_WAIT/portTICK_PERIOD_MS)){
|
||||
ESP_LOGE(TAG, "Unable to lock config");
|
||||
return;
|
||||
@@ -634,7 +634,7 @@ cJSON * config_alloc_get_cjson(const char *key){
|
||||
}
|
||||
return conf_json;
|
||||
}
|
||||
esp_err_t config_set_cjson_str_and_free(const char *key, cJSON *value){
|
||||
esp_err_t config_set_cjson(const char *key, cJSON *value, bool free_cjson){
|
||||
char * value_str = cJSON_PrintUnformatted(value);
|
||||
if(value_str==NULL){
|
||||
ESP_LOGE(TAG, "Unable to print cJSON for key [%s]", key);
|
||||
@@ -642,9 +642,14 @@ esp_err_t config_set_cjson_str_and_free(const char *key, cJSON *value){
|
||||
}
|
||||
esp_err_t err = config_set_value(NVS_TYPE_STR,key, value_str);
|
||||
free(value_str);
|
||||
cJSON_Delete(value);
|
||||
if(free_cjson){
|
||||
cJSON_Delete(value);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
esp_err_t config_set_cjson_str_and_free(const char *key, cJSON *value){
|
||||
return config_set_cjson(key, value, true);
|
||||
}
|
||||
void config_get_uint16t_from_str(const char *key, uint16_t *value, uint16_t default_value){
|
||||
char * str_value = config_alloc_get(NVS_TYPE_STR, key);
|
||||
if(str_value == NULL){
|
||||
@@ -786,6 +791,7 @@ cJSON* cjson_update_number(cJSON** root, const char* key, int value) {
|
||||
}
|
||||
return *root;
|
||||
}
|
||||
|
||||
IMPLEMENT_SET_DEFAULT(uint8_t,NVS_TYPE_U8);
|
||||
IMPLEMENT_SET_DEFAULT(int8_t,NVS_TYPE_I8);
|
||||
IMPLEMENT_SET_DEFAULT(uint16_t,NVS_TYPE_U16);
|
||||
|
||||
@@ -9,23 +9,23 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PARSE_PARAM(S,P,C,V) do { \
|
||||
char *__p; \
|
||||
if ((__p = strcasestr(S, P)) && (__p = strchr(__p, C))) V = atoi(__p+1); \
|
||||
} while (0)
|
||||
#define PARSE_PARAM(S,P,C,V) do { \
|
||||
char *__p; \
|
||||
if ((__p = strcasestr(S, P)) && (__p = strchr(__p, C))) V = atoi(__p+1); \
|
||||
} while (0)
|
||||
|
||||
#define PARSE_PARAM_FLOAT(S,P,C,V) do { \
|
||||
char *__p; \
|
||||
if ((__p = strcasestr(S, P)) && (__p = strchr(__p, C))) V = atof(__p+1); \
|
||||
} while (0)
|
||||
#define PARSE_PARAM_FLOAT(S,P,C,V) do { \
|
||||
char *__p; \
|
||||
if ((__p = strcasestr(S, P)) && (__p = strchr(__p, C))) V = atof(__p+1); \
|
||||
} while (0)
|
||||
|
||||
#define PARSE_PARAM_STR(S,P,C,V,I) do { \
|
||||
char *__p; \
|
||||
if ((__p = strstr(S, P)) && (__p = strchr(__p, C))) { \
|
||||
while (*++__p == ' '); \
|
||||
sscanf(__p,"%" #I "[^,]", V); \
|
||||
} \
|
||||
} while (0)
|
||||
#define PARSE_PARAM_STR(S,P,C,V,I) do { \
|
||||
char *__p; \
|
||||
if ((__p = strstr(S, P)) && (__p = strchr(__p, C))) { \
|
||||
while (*++__p == ' '); \
|
||||
sscanf(__p,"%" #I "[^,]", V); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define DECLARE_SET_DEFAULT(t) void config_set_default_## t (const char *key, t value);
|
||||
#define DECLARE_GET_NUM(t) esp_err_t config_get_## t (const char *key, t * value);
|
||||
@@ -54,9 +54,10 @@ void * config_alloc_get_default(nvs_type_t type, const char *key, void * default
|
||||
void * config_alloc_get_str(const char *key, char *lead, char *fallback);
|
||||
cJSON * config_alloc_get_cjson(const char *key);
|
||||
esp_err_t config_set_cjson_str_and_free(const char *key, cJSON *value);
|
||||
esp_err_t config_set_cjson(const char *key, cJSON *value, bool free_cjson);
|
||||
void config_get_uint16t_from_str(const char *key, uint16_t *value, uint16_t default_value);
|
||||
void config_delete_key(const char *key);
|
||||
void config_set_default(nvs_type_t type, const char *key, void * default_value, size_t blob_size);
|
||||
void config_set_default(nvs_type_t type, const char *key, const void * default_value, size_t blob_size);
|
||||
void * config_alloc_get(nvs_type_t nvs_type, const char *key) ;
|
||||
bool wait_for_commit();
|
||||
char * config_alloc_get_json(bool bFormatted);
|
||||
|
||||
@@ -8,7 +8,7 @@ idf_component_register( SRCS
|
||||
cmd_config.c
|
||||
INCLUDE_DIRS .
|
||||
REQUIRES nvs_flash
|
||||
PRIV_REQUIRES console app_update tools services spi_flash platform_config vfs pthread wifi-manager platform_config newlib telnet display squeezelite tools)
|
||||
PRIV_REQUIRES console app_update tools services spi_flash platform_config vfs pthread wifi-manager platform_config newlib telnet display squeezelite tools metrics)
|
||||
|
||||
set_source_files_properties(cmd_config.c
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
idf_component_register( SRC_DIRS .
|
||||
INCLUDE_DIRS .
|
||||
PRIV_REQUIRES bootloader_support
|
||||
PRIV_REQUIRES bootloader_support json
|
||||
)
|
||||
|
||||
target_link_libraries(${COMPONENT_LIB} INTERFACE "-Wl,--undefined=esp_app_desc")
|
||||
|
||||
@@ -3,9 +3,10 @@
|
||||
#include "application_name.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_app_format.h"
|
||||
|
||||
#include "cJSON.h"
|
||||
#include "stdbool.h"
|
||||
extern esp_err_t process_recovery_ota(const char * bin_url, char * bin_buffer, uint32_t length);
|
||||
|
||||
extern cJSON * gpio_list;
|
||||
const __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = {
|
||||
.magic_word = ESP_APP_DESC_MAGIC_WORD,
|
||||
.version = PROJECT_VER,
|
||||
@@ -26,7 +27,12 @@ const __attribute__((section(".rodata_desc"))) esp_app_desc_t esp_app_desc = {
|
||||
.date = "",
|
||||
#endif
|
||||
};
|
||||
|
||||
cJSON * get_gpio_list(bool refresh){
|
||||
if(!gpio_list){
|
||||
gpio_list = cJSON_CreateArray();
|
||||
}
|
||||
return gpio_list;
|
||||
}
|
||||
void register_optional_cmd(void) {
|
||||
}
|
||||
|
||||
|
||||
@@ -44,15 +44,24 @@ extern void register_audio_config(void);
|
||||
extern void register_rotary_config(void);
|
||||
extern void register_ledvu_config(void);
|
||||
extern void register_nvs();
|
||||
|
||||
extern cJSON * get_gpio_list_handler(bool refresh);
|
||||
void register_optional_cmd(void) {
|
||||
#if CONFIG_WITH_CONFIG_UI
|
||||
#if CONFIG_WITH_CONFIG_UI
|
||||
register_rotary_config();
|
||||
#endif
|
||||
register_audio_config();
|
||||
register_ledvu_config();
|
||||
register_nvs();
|
||||
}
|
||||
|
||||
}
|
||||
cJSON * get_gpio_list(bool refresh){
|
||||
#if CONFIG_WITH_CONFIG_UI
|
||||
return get_gpio_list_handler(refresh);
|
||||
#else
|
||||
return cJSON_CreateArray();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
extern int squeezelite_main(int argc, char **argv);
|
||||
|
||||
|
||||
+1247
-1138
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -589,6 +589,7 @@ void register_nvs()
|
||||
.func = &list_entries,
|
||||
.argtable = &list_args
|
||||
};
|
||||
|
||||
MEMTRACE_PRINT_DELTA_MESSAGE("registering list_entries_cmd");
|
||||
ESP_ERROR_CHECK(esp_console_cmd_register(&list_entries_cmd));
|
||||
MEMTRACE_PRINT_DELTA_MESSAGE("registering set_cmd");
|
||||
|
||||
@@ -62,7 +62,7 @@ static int perform_ota_update(int argc, char **argv)
|
||||
|
||||
const esp_console_cmd_t cmd = {
|
||||
.command = "update",
|
||||
.help = "Updates the application binary from the provided URL",
|
||||
.help = "Update from URL",
|
||||
.hint = NULL,
|
||||
.func = &perform_ota_update,
|
||||
.argtable = &ota_args
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
#include "messaging.h"
|
||||
#include "platform_console.h"
|
||||
#include "tools.h"
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
#include "Metrics.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS
|
||||
#pragma message("Runtime stats enabled")
|
||||
@@ -64,8 +67,10 @@ static void register_heap();
|
||||
static void register_dump_heap();
|
||||
static void register_version();
|
||||
static void register_restart();
|
||||
#if CONFIG_WITH_CONFIG_UI
|
||||
static void register_deep_sleep();
|
||||
static void register_light_sleep();
|
||||
#endif
|
||||
static void register_factory_boot();
|
||||
static void register_restart_ota();
|
||||
static void register_set_services();
|
||||
@@ -83,8 +88,8 @@ FILE * system_open_memstream(const char * cmdname,char **buf,size_t *buf_size){
|
||||
void register_system()
|
||||
{
|
||||
|
||||
register_setdevicename();
|
||||
register_set_services();
|
||||
register_setdevicename();
|
||||
register_free();
|
||||
register_heap();
|
||||
register_dump_heap();
|
||||
@@ -553,6 +558,7 @@ static void register_tasks()
|
||||
|
||||
/** 'deep_sleep' command puts the chip into deep sleep mode */
|
||||
|
||||
#if CONFIG_WITH_CONFIG_UI
|
||||
static struct {
|
||||
struct arg_int *wakeup_time;
|
||||
struct arg_int *wakeup_gpio_num;
|
||||
@@ -616,6 +622,8 @@ static void register_deep_sleep()
|
||||
};
|
||||
ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
|
||||
}
|
||||
#endif
|
||||
|
||||
static int enable_disable(FILE * f,char * nvs_name, struct arg_lit *arg){
|
||||
esp_err_t err = config_set_value(NVS_TYPE_STR, nvs_name, arg->count>0?"Y":"N");
|
||||
const char * name = arg->hdr.longopts?arg->hdr.longopts:arg->hdr.glossary;
|
||||
@@ -704,6 +712,9 @@ cJSON * set_services_cb(){
|
||||
else {
|
||||
cJSON_AddStringToObject(values,set_services_args.telnet->hdr.longopts,"Disabled");
|
||||
}
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
metrics_add_feature_variant("telnet",p);
|
||||
#endif
|
||||
FREE_AND_NULL(p);
|
||||
}
|
||||
|
||||
@@ -731,6 +742,8 @@ static void register_set_services(){
|
||||
cmd_to_json_with_cb(&cmd,&set_services_cb);
|
||||
ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
|
||||
}
|
||||
|
||||
#if CONFIG_WITH_CONFIG_UI
|
||||
static struct {
|
||||
struct arg_int *wakeup_time;
|
||||
struct arg_int *wakeup_gpio_num;
|
||||
@@ -822,4 +835,4 @@ static void register_light_sleep()
|
||||
};
|
||||
ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -18,7 +18,6 @@ esp_err_t guided_factory();
|
||||
esp_err_t guided_restart_ota();
|
||||
void simple_restart();
|
||||
FILE * system_open_memstream(const char * cmdname,char **buf,size_t *buf_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,9 @@ extern bool bypass_network_manager;
|
||||
#define JOIN_TIMEOUT_MS (10000)
|
||||
#include "platform_console.h"
|
||||
|
||||
// To enable wifi configuration from the command line, uncomment the line below
|
||||
// define WIFI_CMDLINE 1
|
||||
|
||||
|
||||
extern EventGroupHandle_t network_event_group;
|
||||
extern const int CONNECTED_BIT;
|
||||
@@ -53,13 +56,6 @@ static struct {
|
||||
|
||||
// todo: implement access point config - cmd_to_json(&i2cdetect_cmd);
|
||||
|
||||
|
||||
///** Arguments used by 'join' function */
|
||||
//static struct {
|
||||
// struct arg_int *autoconnect;
|
||||
// struct arg_end *end;
|
||||
//} auto_connect_args;
|
||||
|
||||
static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
int32_t event_id, void* event_data)
|
||||
{
|
||||
@@ -72,27 +68,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
|
||||
xEventGroupSetBits(network_event_group, CONNECTED_BIT);
|
||||
}
|
||||
}
|
||||
//bool wait_for_wifi(){
|
||||
//
|
||||
// bool connected=(xEventGroupGetBits(wifi_event_group) & CONNECTED_BIT)!=0;
|
||||
//
|
||||
// if(!connected){
|
||||
// ESP_LOGD(TAG,"Waiting for WiFi...");
|
||||
// connected = (xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
|
||||
// pdFALSE, pdTRUE, JOIN_TIMEOUT_MS / portTICK_PERIOD_MS)& CONNECTED_BIT)!=0;
|
||||
// if(!connected){
|
||||
// ESP_LOGD(TAG,"wifi timeout.");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// ESP_LOGI(TAG,"WiFi Connected!");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// return connected;
|
||||
//
|
||||
//}
|
||||
|
||||
static void initialise_wifi(void)
|
||||
{
|
||||
static bool initialized = false;
|
||||
@@ -204,10 +180,10 @@ void register_wifi_join()
|
||||
|
||||
void register_wifi()
|
||||
{
|
||||
#ifdef WIFI_CMDLINE
|
||||
#ifdef WIFI_CMDLINE
|
||||
register_wifi_join();
|
||||
if(bypass_network_manager){
|
||||
initialise_wifi();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@
|
||||
#include "platform_config.h"
|
||||
#include "telnet.h"
|
||||
#include "tools.h"
|
||||
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
#include "metrics.h"
|
||||
#endif
|
||||
#include "messaging.h"
|
||||
|
||||
#include "config.h"
|
||||
@@ -85,14 +87,22 @@ cJSON * get_cmd_list(){
|
||||
}
|
||||
void console_set_bool_parameter(cJSON * root,char * nvs_name, struct arg_lit *arg){
|
||||
char * p=NULL;
|
||||
if(!root) {
|
||||
bool enabled = false;
|
||||
if(!root) {
|
||||
ESP_LOGE(TAG,"Invalid json parameter. Cannot set %s from %s",arg->hdr.longopts?arg->hdr.longopts:arg->hdr.glossary,nvs_name);
|
||||
return;
|
||||
}
|
||||
if ((p = config_alloc_get(NVS_TYPE_STR, nvs_name)) != NULL) {
|
||||
cJSON_AddBoolToObject(root,arg->hdr.longopts,strcmp(p,"1") == 0 || strcasecmp(p,"y") == 0);
|
||||
enabled = strcmp(p,"1") == 0 || strcasecmp(p,"y") == 0;
|
||||
cJSON_AddBoolToObject(root,arg->hdr.longopts,enabled);
|
||||
FREE_AND_NULL(p);
|
||||
}
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
if(enabled){
|
||||
metrics_add_feature(nvs_name,"enabled");
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
struct arg_end *getParmsEnd(struct arg_hdr * * argtable){
|
||||
if(!argtable) return NULL;
|
||||
@@ -360,8 +370,6 @@ void console_start() {
|
||||
register_system();
|
||||
MEMTRACE_PRINT_DELTA_MESSAGE("Registering config commands");
|
||||
register_config_cmd();
|
||||
MEMTRACE_PRINT_DELTA_MESSAGE("Registering nvs commands");
|
||||
register_nvs();
|
||||
MEMTRACE_PRINT_DELTA_MESSAGE("Registering wifi commands");
|
||||
register_wifi();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
idf_component_register(SRC_DIRS .
|
||||
INCLUDE_DIRS .
|
||||
REQUIRES json tools platform_config display wifi-manager
|
||||
REQUIRES json tools platform_config display wifi-manager esp-tls platform_config
|
||||
PRIV_REQUIRES soc esp32
|
||||
)
|
||||
|
||||
@@ -47,6 +47,7 @@ cJSON * gpio_list=NULL;
|
||||
#define STR(macro) QUOTE(macro)
|
||||
#endif
|
||||
|
||||
extern cJSON * get_gpio_list(bool refresh);
|
||||
bool are_statistics_enabled(){
|
||||
#if defined(CONFIG_FREERTOS_USE_TRACE_FACILITY) && defined (CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS)
|
||||
return true;
|
||||
@@ -592,7 +593,7 @@ const gpio_exp_config_t* config_gpio_exp_get(int index) {
|
||||
PARSE_PARAM(item, "intr", '=', config.intr);
|
||||
PARSE_PARAM(item, "base", '=', config.base);
|
||||
PARSE_PARAM(item, "count", '=', config.count);
|
||||
PARSE_PARAM_STR(item, "model", '=', config.model, 31);
|
||||
PARSE_PARAM_STR(item, "model", '=', config.model, sizeof(config.model)-1);
|
||||
|
||||
if ((p = strcasestr(item, "port")) != NULL) {
|
||||
char port[8] = "";
|
||||
@@ -646,6 +647,12 @@ const set_GPIO_struct_t * get_gpio_struct(){
|
||||
#endif
|
||||
#ifdef CONFIG_LED_RED_GPIO
|
||||
gpio_struct.red.gpio = CONFIG_LED_RED_GPIO;
|
||||
#endif
|
||||
#if defined(CONFIG_POWER_GPIO) && CONFIG_POWER_GPIO != -1
|
||||
gpio_struct.power.gpio = CONFIG_POWER_GPIO;
|
||||
#endif
|
||||
#ifdef CONFIG_POWER_GPIO_LEVEL
|
||||
gpio_struct.power.level = CONFIG_POWER_GPIO_LEVEL;
|
||||
#endif
|
||||
if(nvs_item){
|
||||
HANDLE_GPIO_STRUCT_MEMBER(amp,false);
|
||||
@@ -658,6 +665,7 @@ const set_GPIO_struct_t * get_gpio_struct(){
|
||||
HANDLE_GPIO_STRUCT_MEMBER(vcc,false);
|
||||
HANDLE_GPIO_STRUCT_MEMBER(gnd,false);
|
||||
HANDLE_GPIO_STRUCT_MEMBER(ir,false);
|
||||
HANDLE_GPIO_STRUCT_MEMBER(power,false);
|
||||
free(nvs_item);
|
||||
}
|
||||
|
||||
@@ -823,6 +831,7 @@ cJSON * get_GPIO_nvs_list(cJSON * list) {
|
||||
ADD_GPIO_STRUCT_MEMBER_TO_ARRAY(ilist,gpios,jack,"other");
|
||||
ADD_GPIO_STRUCT_MEMBER_TO_ARRAY(ilist,gpios,green,"other");
|
||||
ADD_GPIO_STRUCT_MEMBER_TO_ARRAY(ilist,gpios,red,"other");
|
||||
ADD_GPIO_STRUCT_MEMBER_TO_ARRAY(ilist,gpios,power,"other");
|
||||
ADD_GPIO_STRUCT_MEMBER_TO_ARRAY(ilist,gpios,spkfault,"other");
|
||||
return ilist;
|
||||
}
|
||||
@@ -1169,7 +1178,7 @@ cJSON * get_psram_gpio_list(cJSON * list){
|
||||
/****************************************************************************************
|
||||
*
|
||||
*/
|
||||
cJSON * get_gpio_list(bool refresh) {
|
||||
cJSON * get_gpio_list_handler(bool refresh) {
|
||||
gpio_num_t gpio_num;
|
||||
if(gpio_list && !refresh){
|
||||
return gpio_list;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "driver/i2s.h"
|
||||
#include "driver/spi_master.h"
|
||||
#include "gpio_exp.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
extern const char *i2c_name_type;
|
||||
extern const char *spi_name_type;
|
||||
|
||||
@@ -73,6 +73,7 @@ typedef struct {
|
||||
gpio_with_level_t green;
|
||||
gpio_with_level_t red;
|
||||
gpio_with_level_t spkfault;
|
||||
gpio_with_level_t power;
|
||||
} set_GPIO_struct_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -117,7 +118,7 @@ bool is_spdif_config_locked();
|
||||
esp_err_t free_gpio_entry( gpio_entry_t ** gpio);
|
||||
gpio_entry_t * get_gpio_by_name(char * name,char * group, bool refresh);
|
||||
gpio_entry_t * get_gpio_by_no(int gpionum, bool refresh);
|
||||
cJSON * get_gpio_list(bool refresh);
|
||||
|
||||
bool is_dac_config_locked();
|
||||
bool are_statistics_enabled();
|
||||
const rotary_struct_t * config_rotary_get();
|
||||
|
||||
@@ -186,7 +186,7 @@ static int read_opus_header(void) {
|
||||
switch (u->status) {
|
||||
case OGG_SYNC:
|
||||
u->status = OGG_ID_HEADER;
|
||||
OG(&gu, stream_reset_serialno, &u->state, OG(&gu, page_serialno, &u->page));
|
||||
OG(&gu, stream_init, &u->state, OG(&gu, page_serialno, &u->page));
|
||||
fetch = false;
|
||||
break;
|
||||
case OGG_ID_HEADER:
|
||||
@@ -359,10 +359,10 @@ static void opus_open(u8_t size, u8_t rate, u8_t chan, u8_t endianness) {
|
||||
|
||||
u->status = OGG_SYNC;
|
||||
u->overframes = 0;
|
||||
|
||||
OG(&go, stream_clear, &u->state);
|
||||
OG(&go, sync_clear, &u->sync);
|
||||
OG(&go, stream_init, &u->state, -1);
|
||||
|
||||
OG(&gu, sync_clear, &u->sync);
|
||||
OG(&gu, stream_clear, &u->state);
|
||||
OG(&gu, stream_init, &u->state, -1);
|
||||
}
|
||||
|
||||
static void opus_close(void) {
|
||||
@@ -372,8 +372,8 @@ static void opus_close(void) {
|
||||
free(u->overbuf);
|
||||
u->overbuf = NULL;
|
||||
|
||||
OG(&go, stream_clear, &u->state);
|
||||
OG(&go, sync_clear, &u->sync);
|
||||
OG(&gu, stream_clear, &u->state);
|
||||
OG(&gu, sync_clear, &u->sync);
|
||||
}
|
||||
|
||||
static bool load_opus(void) {
|
||||
@@ -394,7 +394,7 @@ static bool load_opus(void) {
|
||||
}
|
||||
|
||||
g_handle->ogg_stream_clear = dlsym(g_handle->handle, "ogg_stream_clear");
|
||||
g_handle->ogg_stream_reset = dlsym(g_handle->handle, "ogg_stream_reset");
|
||||
g_handle->.ogg_stream_reset = dlsym(g_handle->handle, "ogg_stream_reset");
|
||||
g_handle->ogg_stream_eos = dlsym(g_handle->handle, "ogg_stream_eos");
|
||||
g_handle->ogg_stream_reset_serialno = dlsym(g_handle->handle, "ogg_stream_reset_serialno");
|
||||
g_handle->ogg_sync_clear = dlsym(g_handle->handle, "ogg_sync_clear");
|
||||
|
||||
@@ -744,7 +744,7 @@ static void IRAM_ATTR spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst) {
|
||||
|
||||
// we assume frame == 0 as well...
|
||||
if (!src) {
|
||||
count = 0;
|
||||
count = 192;
|
||||
vu = VUCP24[0];
|
||||
}
|
||||
|
||||
@@ -757,7 +757,7 @@ static void IRAM_ATTR spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst) {
|
||||
|
||||
if (!count--) {
|
||||
*dst++ = (vu << 24) | (PREAMBLE_B << 16) | 0xCCCC;
|
||||
count = 191;
|
||||
count = 192;
|
||||
} else {
|
||||
*dst++ = (vu << 24) | (PREAMBLE_M << 16) | 0xCCCC;
|
||||
}
|
||||
@@ -771,7 +771,7 @@ static void IRAM_ATTR spdif_convert(ISAMPLE_T *src, size_t frames, u32_t *dst) {
|
||||
|
||||
if (!count--) {
|
||||
*dst++ = (vu << 24) | (PREAMBLE_B << 16) | aux;
|
||||
count = 191;
|
||||
count = 192;
|
||||
} else {
|
||||
*dst++ = (vu << 24) | (PREAMBLE_M << 16) | aux;
|
||||
}
|
||||
|
||||
@@ -72,13 +72,6 @@ static struct vorbis {
|
||||
// vorbis symbols to be dynamically loaded - from either vorbisfile or vorbisidec (tremor) version of library
|
||||
vorbis_info *(* ov_info)(OggVorbis_File *vf, int link);
|
||||
int (* ov_clear)(OggVorbis_File *vf);
|
||||
void (* ov_info_init)(vorbis_info* vi);
|
||||
void (* ov_info_clear)(vorbis_info* vi);
|
||||
void (* ov_comment_init)(vorbis_comment* vc);
|
||||
void (* ov_comment_clear(vorbis_comment *vc);
|
||||
int (* ov_block_init)(vorbis_dsp_state* v, vorbis_block* vb);
|
||||
int (* ov_block_clear)(vorbis_block* vb);
|
||||
void (* ov_vorbis_dsp_clear)(vorbis_dsp_state* v);
|
||||
long (* ov_read)(OggVorbis_File *vf, char *buffer, int length, int bigendianp, int word, int sgned, int *bitstream);
|
||||
long (* ov_read_tremor)(OggVorbis_File *vf, char *buffer, int length, int *bitstream);
|
||||
int (* ov_open_callbacks)(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks);
|
||||
@@ -403,32 +396,33 @@ static decode_state vorbis_decode(void) {
|
||||
}
|
||||
|
||||
static void vorbis_open(u8_t size, u8_t rate, u8_t chan, u8_t endianness) {
|
||||
LOG_INFO("OPENING CODEC");
|
||||
if (v->opened) {
|
||||
OV(&gv, block_clear, &v->block);
|
||||
OV(&gv, dsp_clear, &v->decoder);
|
||||
OV(&gv, info_clear, &v->info);
|
||||
OV(&go, block_clear, &v->block);
|
||||
OV(&go, info_clear, &v->info);
|
||||
OV(&go, dsp_clear, &v->decoder);
|
||||
}
|
||||
|
||||
v->opened = false;
|
||||
v->status = OGG_SYNC;
|
||||
v->overflow = 0;
|
||||
|
||||
OG(&go, stream_clear, &v->state);
|
||||
OG(&go, sync_clear, &v->sync);
|
||||
OG(&go, stream_init, &v->state, -1);
|
||||
|
||||
OG(&gu, sync_clear, &v->sync);
|
||||
OG(&gu, stream_clear, &v->state);
|
||||
OG(&gu, stream_init, &v->state, -1);
|
||||
}
|
||||
|
||||
static void vorbis_close() {
|
||||
return;
|
||||
LOG_INFO("CLOSING CODEC");
|
||||
if (v->opened) {
|
||||
OV(&gv, block_clear, &v->block);
|
||||
OV(&gv, dsp_clear, &v->decoder);
|
||||
// info must be last otherwise there is memory leak (where is it said... nowhere)
|
||||
OV(&gv, info_clear, &v->info);
|
||||
// we don' t have comments to free
|
||||
OV(&go, block_clear, &v->block);
|
||||
OV(&go, info_clear, &v->info);
|
||||
OV(&go, dsp_clear, &v->decoder);
|
||||
}
|
||||
|
||||
v->opened = false;
|
||||
|
||||
|
||||
OG(&go, stream_clear, &v->state);
|
||||
OG(&go, sync_clear, &v->sync);
|
||||
}
|
||||
@@ -475,11 +469,6 @@ static bool load_vorbis() {
|
||||
v_handle.ov_read = dlsym(handle, "ov_read");
|
||||
v_handle.ov_info = dlsym(handle, "ov_info");
|
||||
v_handle.ov_clear = dlsym(handle, "ov_clear");
|
||||
v.handle.ov_info_clear = dlsym(gv.handle, "vorbis_info_clear");
|
||||
v.handle.ov_comment_init = dlsym(gv.handle, "vorbis_comment_init");
|
||||
v.handle.ov_comment_clear = dlsym(gv.handle, "vorbis_comment_clear");
|
||||
v.handle.ov_block_init = dlsym(gv.handle, "vorbis_block_init");
|
||||
v.handle.ov_block_clear = dlsym(gv.handle, "vorbis_block_clear");
|
||||
v_handle.ov_open_callbacks = dlsym(handle, "ov_open_callbacks");
|
||||
|
||||
if ((err = dlerror()) != NULL) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
idf_component_register( SRCS operator.cpp tools.c trace.c
|
||||
REQUIRES esp_common pthread
|
||||
PRIV_REQUIRES esp_http_client esp-tls
|
||||
PRIV_REQUIRES esp_http_client esp-tls json
|
||||
INCLUDE_DIRS .
|
||||
)
|
||||
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "esp_task.h"
|
||||
#include "esp_tls.h"
|
||||
#include "esp_http_client.h"
|
||||
@@ -318,11 +316,23 @@ static esp_err_t http_event_handler(esp_http_client_event_t *evt) {
|
||||
return ESP_FAIL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void dump_json_content(const char* prefix, cJSON* json, int level) {
|
||||
if (!json) {
|
||||
ESP_LOG_LEVEL(level,TAG, "%s: empty!", prefix);
|
||||
return;
|
||||
}
|
||||
char* output = cJSON_Print(json);
|
||||
if (output) {
|
||||
ESP_LOG_LEVEL(level,TAG, "%s: \n%s", prefix, output);
|
||||
}
|
||||
FREE_AND_NULL(output);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "cJSON.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -52,6 +55,13 @@ void* clone_obj_psram(void * source, size_t source_sz);
|
||||
char* strdup_psram(const char * source);
|
||||
const char* str_or_unknown(const char * str);
|
||||
const char* str_or_null(const char * str);
|
||||
void dump_json_content(const char* prefix, cJSON* json, int level);
|
||||
|
||||
#ifndef gettime_ms
|
||||
// body is provided somewhere else...
|
||||
uint32_t _gettime_ms_(void);
|
||||
#define gettime_ms _gettime_ms_
|
||||
#endif
|
||||
|
||||
typedef void (*http_download_cb_t)(uint8_t* data, size_t len, void *context);
|
||||
void http_download(char *url, size_t max, http_download_cb_t callback, void *context);
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef struct session_context {
|
||||
char * sess_ip_address;
|
||||
u16_t port;
|
||||
} session_context_t;
|
||||
|
||||
extern cJSON * get_gpio_list(bool refresh);
|
||||
|
||||
union sockaddr_aligned {
|
||||
struct sockaddr sa;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
@@ -65,8 +65,6 @@ declare function getStatus(): {};
|
||||
declare function getStatus(): {};
|
||||
declare function getStatus(): {};
|
||||
declare function getStatus(): {};
|
||||
declare function getStatus(): {};
|
||||
declare function getRadioButton(entry: any): string;
|
||||
declare function getRadioButton(entry: any): string;
|
||||
declare function getRadioButton(entry: any): string;
|
||||
declare function getRadioButton(entry: any): string;
|
||||
@@ -201,7 +199,6 @@ declare function pushStatus(): void;
|
||||
declare function pushStatus(): void;
|
||||
declare function pushStatus(): void;
|
||||
declare function pushStatus(): void;
|
||||
declare function pushStatus(): void;
|
||||
declare let sd: {};
|
||||
declare let rf: boolean;
|
||||
declare function refreshStatus(): void;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"babel": "^6.23.0",
|
||||
"babel-loader": "^8.2.3",
|
||||
"babel-runtime": "^6.26.0",
|
||||
"bootswatch": "file:src/bootswatch",
|
||||
"clean-webpack-plugin": "^4.0.0",
|
||||
"commander": "^8.3.0",
|
||||
"compression-webpack-plugin": "^9.2.0",
|
||||
@@ -74,10 +75,8 @@
|
||||
"@babel/runtime": "^7.16.7",
|
||||
"async-mutex": "^0.3.2",
|
||||
"bootstrap": "^5.1.3",
|
||||
"bootswatch": "^5.3.2",
|
||||
"jquery": "^3.6.0",
|
||||
"npm": "^10.1.0",
|
||||
"optipng-bin": "^9.0.0",
|
||||
"popper.js": "^1.16.1",
|
||||
"webpack-visualizer-plugin": "^0.1.11",
|
||||
"webpack-visualizer-plugin2": "^1.0.0"
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
<div class="tab-pane fade" id="tab-cfg-gen"></div>
|
||||
<div class="tab-pane fade" id="tab-cfg-fw">
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card text-white mb-3">
|
||||
<div class="card-header">Software Updates</div>
|
||||
<div class="card-body">
|
||||
<table class="table table-hover table-striped table-dark">
|
||||
@@ -171,7 +171,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mb-3">
|
||||
<div class="card text-white mb-3">
|
||||
<div class="card-header">Local Firmware Upload</div>
|
||||
<div class="card-body">
|
||||
<div id="uploaddiv" class="form-group row ">
|
||||
@@ -216,7 +216,7 @@
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="tab-cfg-audio">
|
||||
<div class="card mb-3">
|
||||
<div class="card text-white mb-3">
|
||||
<div class="card-header">Usage Templates</div>
|
||||
<div class="card-body">
|
||||
<fieldset class="form-group" id="output-tmpl">
|
||||
@@ -355,7 +355,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane fade active show" id="tab-wifi">
|
||||
<div class="card mb-3">
|
||||
<div class="card text-white mb-3">
|
||||
<div class="card-header">WiFi Status</div>
|
||||
|
||||
<div class="card-body if_eth" style="display: none">
|
||||
@@ -527,7 +527,7 @@
|
||||
</div>
|
||||
<!-- syslog -->
|
||||
<div class="tab-pane fade " id="tab-credits">
|
||||
<div class="card mb-3">
|
||||
<div class="card text-white mb-3">
|
||||
<div class="card-header">Credits</div>
|
||||
<div class="card-body">
|
||||
<p><strong><a
|
||||
@@ -554,7 +554,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card mb-3">
|
||||
<div class="card text-white mb-3">
|
||||
<div class="card-header">Extras/Overrides</div>
|
||||
<div class="card-body">
|
||||
<fieldset>
|
||||
|
||||
@@ -2097,7 +2097,7 @@ function getCommands() {
|
||||
const isConfig = cmdParts[0] === 'cfg';
|
||||
const targetDiv = '#tab-' + cmdParts[0] + '-' + cmdParts[1];
|
||||
let innerhtml = '';
|
||||
innerhtml += `<div class="card mb-3"><div class="card-header">${command.help.encodeHTML().replace(/\n/g, '<br />')}</div><div class="card-body"><fieldset id="flds-${command.name}">`;
|
||||
innerhtml += `<div class="card text-white mb-3"><div class="card-header">${command.help.encodeHTML().replace(/\n/g, '<br />')}</div><div class="card-body"><fieldset id="flds-${command.name}">`;
|
||||
if (command.argtable) {
|
||||
command.argtable.forEach(function (arg) {
|
||||
let placeholder = arg.datatype || '';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// @import "~bootswatch/dist/darkly/variables"; -- remove darkly until bootswatch color is resolved
|
||||
@import "~bootswatch/dist/darkly/variables";
|
||||
@import "utils/variables";
|
||||
@import "~bootstrap/scss/bootstrap";
|
||||
// @import "~bootstrap/scss/functions";
|
||||
@@ -38,5 +38,5 @@
|
||||
|
||||
// // Utilities
|
||||
// @import "~bootstrap/scss/utilities/api";
|
||||
// @import "~bootswatch/dist/darkly/bootswatch"; -- remove darkly until bootswatch color is resolved
|
||||
@import "~bootswatch/dist/darkly/bootswatch";
|
||||
@import "utils/style";
|
||||
@@ -1,5 +1,5 @@
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/css/index.1ab179394339385e0a02.css.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/favicon-32x32.png BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/index.html.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.e0b953.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.e0b953.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/index.1b8c7b.bundle.js.gz BINARY)
|
||||
target_add_binary_data( __idf_wifi-manager webapp/dist/js/node_vendors.1b8c7b.bundle.js.gz BINARY)
|
||||
|
||||
@@ -6,29 +6,29 @@ extern const uint8_t _favicon_32x32_png_start[] asm("_binary_favicon_32x32_png_s
|
||||
extern const uint8_t _favicon_32x32_png_end[] asm("_binary_favicon_32x32_png_end");
|
||||
extern const uint8_t _index_html_gz_start[] asm("_binary_index_html_gz_start");
|
||||
extern const uint8_t _index_html_gz_end[] asm("_binary_index_html_gz_end");
|
||||
extern const uint8_t _index_e0b953_bundle_js_gz_start[] asm("_binary_index_e0b953_bundle_js_gz_start");
|
||||
extern const uint8_t _index_e0b953_bundle_js_gz_end[] asm("_binary_index_e0b953_bundle_js_gz_end");
|
||||
extern const uint8_t _node_vendors_e0b953_bundle_js_gz_start[] asm("_binary_node_vendors_e0b953_bundle_js_gz_start");
|
||||
extern const uint8_t _node_vendors_e0b953_bundle_js_gz_end[] asm("_binary_node_vendors_e0b953_bundle_js_gz_end");
|
||||
extern const uint8_t _index_1b8c7b_bundle_js_gz_start[] asm("_binary_index_1b8c7b_bundle_js_gz_start");
|
||||
extern const uint8_t _index_1b8c7b_bundle_js_gz_end[] asm("_binary_index_1b8c7b_bundle_js_gz_end");
|
||||
extern const uint8_t _node_vendors_1b8c7b_bundle_js_gz_start[] asm("_binary_node_vendors_1b8c7b_bundle_js_gz_start");
|
||||
extern const uint8_t _node_vendors_1b8c7b_bundle_js_gz_end[] asm("_binary_node_vendors_1b8c7b_bundle_js_gz_end");
|
||||
const char * resource_lookups[] = {
|
||||
"/css/index.1ab179394339385e0a02.css.gz",
|
||||
"/favicon-32x32.png",
|
||||
"/index.html.gz",
|
||||
"/js/index.e0b953.bundle.js.gz",
|
||||
"/js/node_vendors.e0b953.bundle.js.gz",
|
||||
"/js/index.1b8c7b.bundle.js.gz",
|
||||
"/js/node_vendors.1b8c7b.bundle.js.gz",
|
||||
""
|
||||
};
|
||||
const uint8_t * resource_map_start[] = {
|
||||
_index_1ab179394339385e0a02_css_gz_start,
|
||||
_favicon_32x32_png_start,
|
||||
_index_html_gz_start,
|
||||
_index_e0b953_bundle_js_gz_start,
|
||||
_node_vendors_e0b953_bundle_js_gz_start
|
||||
_index_1b8c7b_bundle_js_gz_start,
|
||||
_node_vendors_1b8c7b_bundle_js_gz_start
|
||||
};
|
||||
const uint8_t * resource_map_end[] = {
|
||||
_index_1ab179394339385e0a02_css_gz_end,
|
||||
_favicon_32x32_png_end,
|
||||
_index_html_gz_end,
|
||||
_index_e0b953_bundle_js_gz_end,
|
||||
_node_vendors_e0b953_bundle_js_gz_end
|
||||
_index_1b8c7b_bundle_js_gz_end,
|
||||
_node_vendors_1b8c7b_bundle_js_gz_end
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/***********************************
|
||||
webpack_headers
|
||||
dist/css/index.1ab179394339385e0a02.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.e0b953.bundle.js.gz,dist/js/node_vendors.e0b953.bundle.js.gz
|
||||
dist/css/index.1ab179394339385e0a02.css.gz,dist/favicon-32x32.png,dist/index.html.gz,dist/js/index.1b8c7b.bundle.js.gz,dist/js/node_vendors.1b8c7b.bundle.js.gz
|
||||
***********************************/
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
const path = require("path");
|
||||
const fs = require('fs');
|
||||
const zlib = require("zlib");
|
||||
const glob = require('glob');
|
||||
|
||||
|
||||
class BuildEventsHook {
|
||||
constructor(name, fn, stage = 'afterEmit') {
|
||||
this.name = name;
|
||||
this.stage = stage;
|
||||
this.function = fn;
|
||||
}
|
||||
apply(compiler) {
|
||||
compiler.hooks[this.stage].tap(this.name, this.function);
|
||||
}
|
||||
}
|
||||
|
||||
function createBuildEventsHook(options){
|
||||
return new BuildEventsHook('Update C App',
|
||||
function (stats, arguments) {
|
||||
|
||||
if (options.mode !== "production") return;
|
||||
let buildRootPath = path.join(process.cwd(), '..', '..', '..');
|
||||
let wifiManagerPath = glob.sync(path.join(buildRootPath, 'components/**/wifi-manager*'))[0];
|
||||
let buildCRootPath = glob.sync(buildRootPath)[0];
|
||||
fs.appendFileSync('./dist/index.html.gz',
|
||||
zlib.gzipSync(fs.readFileSync('./dist/index.html'),
|
||||
{
|
||||
chunckSize: 65536,
|
||||
level: zlib.constants.Z_BEST_COMPRESSION
|
||||
}));
|
||||
|
||||
let getDirectories = function getDirectories (src, callback) {
|
||||
let searchPath = path.posix.join(src, '/**/*(*.gz|favicon-32x32.png)');
|
||||
console.log(`Post build: Getting file list from ${searchPath}`);
|
||||
glob(searchPath, callback);
|
||||
};
|
||||
let cleanUpPath = path.posix.join(buildCRootPath, '/build/*.S');
|
||||
console.log(`Post build: Cleaning up previous builds in ${cleanUpPath}`);
|
||||
glob(cleanUpPath, function (err, list) {
|
||||
if (err) {
|
||||
console.error('Error', err);
|
||||
} else {
|
||||
list.forEach(fileName => {
|
||||
try {
|
||||
console.log(`Post build: Purging old binary file ${fileName} from C project.`);
|
||||
fs.unlinkSync(fileName)
|
||||
//file removed
|
||||
} catch (ferr) {
|
||||
console.error(ferr)
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'afterEmit'
|
||||
);
|
||||
console.log('Generating C include files from webpack build output');
|
||||
getDirectories('./dist', function (err, list) {
|
||||
console.log(`Post build: found ${list.length} files. Relative path: ${wifiManagerPath}.`);
|
||||
if (err) {
|
||||
console.log('Error', err);
|
||||
} else {
|
||||
|
||||
let exportDefHead =
|
||||
`/***********************************
|
||||
webpack_headers
|
||||
${arguments[1]}
|
||||
***********************************/
|
||||
#pragma once
|
||||
#include <inttypes.h>
|
||||
extern const char * resource_lookups[];
|
||||
extern const uint8_t * resource_map_start[];
|
||||
extern const uint8_t * resource_map_end[];`;
|
||||
let exportDef = '// Automatically generated. Do not edit manually!.\n' +
|
||||
'#include <inttypes.h>\n';
|
||||
let lookupDef = 'const char * resource_lookups[] = {\n';
|
||||
let lookupMapStart = 'const uint8_t * resource_map_start[] = {\n';
|
||||
let lookupMapEnd = 'const uint8_t * resource_map_end[] = {\n';
|
||||
let cMake = '';
|
||||
|
||||
list.forEach(foundFile => {
|
||||
let exportName = path.basename(foundFile).replace(/[\. \-]/gm, '_');
|
||||
//take the full path of the file and make it relative to the build directory
|
||||
let cmakeFileName = path.posix.relative(wifiManagerPath, glob.sync(path.resolve(foundFile))[0]);
|
||||
let httpRelativePath = path.posix.join('/', path.posix.relative('dist', foundFile));
|
||||
exportDef += `extern const uint8_t _${exportName}_start[] asm("_binary_${exportName}_start");\nextern const uint8_t _${exportName}_end[] asm("_binary_${exportName}_end");\n`;
|
||||
lookupDef += `\t"${httpRelativePath}",\n`;
|
||||
lookupMapStart += '\t_' + exportName + '_start,\n';
|
||||
lookupMapEnd += '\t_' + exportName + '_end,\n';
|
||||
cMake += `target_add_binary_data( __idf_wifi-manager ${cmakeFileName} BINARY)\n`;
|
||||
console.log(`Post build: adding cmake file reference to ${cmakeFileName} from C project, with web path ${httpRelativePath}.`);
|
||||
});
|
||||
|
||||
lookupDef += '""\n};\n';
|
||||
lookupMapStart = lookupMapStart.substring(0, lookupMapStart.length - 2) + '\n};\n';
|
||||
lookupMapEnd = lookupMapEnd.substring(0, lookupMapEnd.length - 2) + '\n};\n';
|
||||
try {
|
||||
fs.writeFileSync('webapp.cmake', cMake);
|
||||
fs.writeFileSync('webpack.c', exportDef + lookupDef + lookupMapStart + lookupMapEnd);
|
||||
fs.writeFileSync('webpack.h', exportDefHead);
|
||||
//file written successfully
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log('Post build completed.');
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
BuildEventsHook,
|
||||
createBuildEventsHook
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ const HtmlWebPackPlugin = require('html-webpack-plugin');
|
||||
const { Command } = require('commander');
|
||||
let cmdLines= { };
|
||||
var { parseArgsStringToArgv } = require('string-argv');
|
||||
const PORT = 5000;
|
||||
const PORT = 9100;
|
||||
|
||||
const data = {
|
||||
messages: require("../mock/messages.json"),
|
||||
@@ -159,7 +159,7 @@ module.exports ={
|
||||
open: true,
|
||||
compress: true,
|
||||
port: PORT,
|
||||
host: '0.0.0.0',
|
||||
host: '127.0.0.1',//your ip address
|
||||
allowedHosts: "all",
|
||||
headers: {'Access-Control-Allow-Origin': '*', 'Accept-Encoding': 'identity'},
|
||||
client: {
|
||||
|
||||
@@ -1,91 +0,0 @@
|
||||
param (
|
||||
[Parameter(Position=0, Mandatory=$false)]
|
||||
[ValidateSet("t", "u", "d")]
|
||||
[string]$option
|
||||
)
|
||||
|
||||
# Get the current directory
|
||||
$currentDir = Get-Location
|
||||
|
||||
# Define target directories
|
||||
$targetDir = "components\wifi-manager\webapp"
|
||||
$distDir = "$targetDir\dist"
|
||||
|
||||
# Get list of files from the 'dist' directory
|
||||
$fsFiles = Get-ChildItem -Recurse $distDir -File | ForEach-Object {
|
||||
$_.FullName.Substring($currentDir.Path.Length + 1).Replace("\", "/")
|
||||
}
|
||||
|
||||
# Define additional files to include
|
||||
$additionalFiles = @("webpack.c", "webpack.h", "webapp.cmake")
|
||||
|
||||
# Check if additional files exist in $targetDir and format them
|
||||
$additionalFilesFormatted = @()
|
||||
Get-ChildItem $targetDir -File | ForEach-Object {
|
||||
if ($additionalFiles -contains $_.Name) {
|
||||
$formatted = $_.FullName.Substring($currentDir.Path.Length + 1).Replace("\", "/")
|
||||
$additionalFilesFormatted += $formatted
|
||||
Write-Host "Found $formatted"
|
||||
}
|
||||
}
|
||||
|
||||
# Get list of files from the Git index
|
||||
$indexFiles = git ls-files -s $distDir | ForEach-Object {
|
||||
($_ -split "\s+")[3]
|
||||
}
|
||||
|
||||
# Combine and remove duplicates
|
||||
$allFiles = $fsFiles + $additionalFilesFormatted + $indexFiles | Sort-Object -Unique
|
||||
# ... (previous code remains unchanged)
|
||||
|
||||
# Apply the git command based on the option
|
||||
$allFiles | ForEach-Object {
|
||||
$relativePath = $_
|
||||
$isInIndex = $indexFiles -contains $relativePath
|
||||
|
||||
if ($null -eq $option) {
|
||||
$gitStatus = & git status --porcelain -- $relativePath
|
||||
if ($gitStatus) {
|
||||
$status = ($gitStatus -split "\s")[0]
|
||||
Write-Host "$relativePath has Git status: $status"
|
||||
} else {
|
||||
Write-Host "$relativePath is not tracked"
|
||||
}
|
||||
}
|
||||
elseif ($isInIndex) {
|
||||
if ($option -eq "d") {
|
||||
$resetResult = & git reset -- $relativePath 2>&1
|
||||
if ($resetResult -match 'error:') {
|
||||
Write-Host "Error resetting ${relativePath}: $resetResult"
|
||||
|
||||
continue
|
||||
}
|
||||
$checkoutResult = & git checkout -- $relativePath 2>&1
|
||||
if ($checkoutResult -match 'error:') {
|
||||
Write-Host "Error checking out ${relativePath}: $checkoutResult"
|
||||
|
||||
continue
|
||||
}
|
||||
Write-Host "Discarded changes in $relativePath"
|
||||
}
|
||||
# ... (rest of the code remains unchanged)
|
||||
}
|
||||
# else {
|
||||
# # if ($option -eq "d") {
|
||||
# # Remove-Item -Path $relativePath -Force
|
||||
# # Write-Host "Removed untracked file $relativePath"
|
||||
# # } else {
|
||||
# # Write-Host "File $relativePath is not tracked."
|
||||
# # }
|
||||
|
||||
# }
|
||||
else {
|
||||
if ($option -eq "t") {
|
||||
git add $relativePath
|
||||
git update-index --no-skip-worktree $relativePath
|
||||
Write-Host "Started tracking changes in $relativePath"
|
||||
} else {
|
||||
Write-Host "File $relativePath is not tracked."
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
idf_component_register(SRC_DIRS .
|
||||
PRIV_REQUIRES _override esp_common wifi-manager pthread squeezelite-ota platform_console telnet display targets led_strip
|
||||
PRIV_REQUIRES _override esp_common wifi-manager pthread squeezelite-ota platform_console telnet display targets led_strip metrics
|
||||
LDFRAGMENTS "linker.lf"
|
||||
)
|
||||
|
||||
@@ -74,6 +74,16 @@ menu "Squeezelite-ESP32"
|
||||
select I2C_LOCKED
|
||||
select TARGET_LOCKED
|
||||
endchoice
|
||||
config WITH_CONFIG_UI
|
||||
bool "Enable config UI"
|
||||
default n
|
||||
help
|
||||
Enable configuring system options with the UI
|
||||
config WITH_METRICS
|
||||
bool "Enable Metrics"
|
||||
default n
|
||||
help
|
||||
Enable capturing and reporting anonymous metrics
|
||||
config RELEASE_API
|
||||
string "Software update URL"
|
||||
default "https://api.github.com/repos/sle118/squeezelite-esp32/releases"
|
||||
|
||||
+23
-7
@@ -47,6 +47,9 @@
|
||||
#include "accessors.h"
|
||||
#include "cmd_system.h"
|
||||
#include "tools.h"
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
#include "Metrics.h"
|
||||
#endif
|
||||
|
||||
const char unknown_string_placeholder[] = "unknown";
|
||||
const char null_string_placeholder[] = "null";
|
||||
@@ -230,8 +233,8 @@ void register_default_string_val(const char * key, const char * value){
|
||||
char * existing =(char *)config_alloc_get(NVS_TYPE_STR,key );
|
||||
ESP_LOGD(TAG,"Register default called with: %s= %s",key,value );
|
||||
if(!existing) {
|
||||
ESP_LOGI(TAG,"Registering default value for key %s, value %s",key,value );
|
||||
config_set_default(NVS_TYPE_STR, key,value, 0);
|
||||
ESP_LOGI(TAG,"Registering default value for key %s, value %s", key, value );
|
||||
config_set_default(NVS_TYPE_STR, key, value, 0);
|
||||
}
|
||||
else {
|
||||
ESP_LOGD(TAG,"Value found for %s: %s",key,existing );
|
||||
@@ -259,7 +262,7 @@ char * alloc_get_string_with_mac(const char * val) {
|
||||
strcat(fullvalue, macStr);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG,"Memory allocation failed when getting mac value for %s", val);
|
||||
ESP_LOGE(TAG,"malloc failed for value %s", val);
|
||||
}
|
||||
return fullvalue;
|
||||
|
||||
@@ -271,7 +274,7 @@ void register_default_with_mac(const char* key, char* defval) {
|
||||
FREE_AND_NULL(fullvalue);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG,"Memory allocation failed when registering default value for %s", key);
|
||||
ESP_LOGE(TAG,"malloc failed for value %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +294,9 @@ void register_default_nvs(){
|
||||
else {
|
||||
register_default_string_val("cspot_config", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AIRPLAY_SINK
|
||||
@@ -322,7 +327,7 @@ uint32_t halSTORAGE_RebootCounterUpdate(int32_t xValue) {
|
||||
}
|
||||
RebootCounter = (xValue != 0) ? (RebootCounter + xValue) : 0;
|
||||
RecoveryRebootCounter = (xValue != 0) && is_recovery_running ? (RecoveryRebootCounter + xValue) : 0;
|
||||
return (RebootCounter) ;
|
||||
return RebootCounter ;
|
||||
}
|
||||
|
||||
void handle_ap_connect(nm_state_t new_state, int sub_state){
|
||||
@@ -375,11 +380,17 @@ void app_main()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
char * fwurl = NULL;
|
||||
MEMTRACE_PRINT_DELTA();
|
||||
ESP_LOGI(TAG,"Starting app_main");
|
||||
initialize_nvs();
|
||||
MEMTRACE_PRINT_DELTA();
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
ESP_LOGI(TAG,"Setting up metrics.");
|
||||
metrics_init();
|
||||
MEMTRACE_PRINT_DELTA();
|
||||
#endif
|
||||
ESP_LOGI(TAG,"Setting up telnet.");
|
||||
init_telnet(); // align on 32 bits boundaries
|
||||
MEMTRACE_PRINT_DELTA();
|
||||
@@ -390,7 +401,6 @@ void app_main()
|
||||
network_event_group = xEventGroupCreate();
|
||||
ESP_LOGD(TAG,"Clearing CONNECTED_BIT from wifi group");
|
||||
xEventGroupClearBits(network_event_group, CONNECTED_BIT);
|
||||
|
||||
ESP_LOGI(TAG,"Registering default values");
|
||||
register_default_nvs();
|
||||
MEMTRACE_PRINT_DELTA();
|
||||
@@ -418,7 +428,10 @@ void app_main()
|
||||
led_vu_color_yellow(LED_VU_BRIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
metrics_event_boot(is_recovery_running?"recovery":"ota");
|
||||
#endif
|
||||
|
||||
ESP_LOGD(TAG,"Getting firmware OTA URL (if any)");
|
||||
fwurl = process_ota_url();
|
||||
|
||||
@@ -476,6 +489,9 @@ void app_main()
|
||||
taskYIELD();
|
||||
}
|
||||
ESP_LOGI(TAG,"Updating firmware from link: %s",fwurl);
|
||||
#if defined(CONFIG_WITH_METRICS)
|
||||
metrics_event("fw_update");
|
||||
#endif
|
||||
start_ota(fwurl, NULL, 0);
|
||||
}
|
||||
else {
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user