mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-08 12:37:01 +03:00
misc changes (see PR) (#340)
* misc changes (see PR) * macro only parsing
This commit is contained in:
@@ -77,7 +77,7 @@ void Batch::push() {
|
||||
|
||||
char* json_str = to_json_str();
|
||||
ESP_LOGV(TAG, "Metrics payload: %s", json_str);
|
||||
time_t start_time = millis();
|
||||
uint32_t start_time = gettime_ms();
|
||||
|
||||
status_code = metrics_http_post_request(json_str, _url);
|
||||
|
||||
@@ -85,7 +85,7 @@ void Batch::push() {
|
||||
_events.clear();
|
||||
}
|
||||
FREE_AND_NULL(json_str)
|
||||
ESP_LOGD(TAG, "Total duration for metrics call: %lu. ", millis() - start_time);
|
||||
ESP_LOGD(TAG, "Total duration for metrics call: %lu. ", gettime_ms() - start_time);
|
||||
}
|
||||
|
||||
void Batch::build_guid() {
|
||||
|
||||
@@ -45,7 +45,7 @@ class Event {
|
||||
}
|
||||
private:
|
||||
char* _name = nullptr;
|
||||
time_t _time;
|
||||
uint32_t _time;
|
||||
cJSON* _json = nullptr;
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ extern bool is_network_connected();
|
||||
#define MAX_HTTP_RECV_BUFFER 512
|
||||
|
||||
static bool metrics_usage_gen = false;
|
||||
static time_t metrics_usage_gen_time = 0;
|
||||
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"
|
||||
@@ -56,7 +56,7 @@ static void metrics_timer_cb(void* timer_id) {
|
||||
batch.push();
|
||||
}
|
||||
}
|
||||
if (millis() > metrics_usage_gen_time && !metrics_usage_gen) {
|
||||
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();
|
||||
@@ -75,7 +75,7 @@ void metrics_init() {
|
||||
}
|
||||
// set a 20 seconds delay before generating the
|
||||
// features so the system has time to boot
|
||||
metrics_usage_gen_time = millis() + 20000;
|
||||
metrics_usage_gen_time = gettime_ms() + 20000;
|
||||
}
|
||||
|
||||
void metrics_event_playback(const char* source) {
|
||||
|
||||
Reference in New Issue
Block a user