Fixing #59 and unnecessary jack insertion messages-release

This commit is contained in:
Sebastien
2020-11-21 09:26:56 -05:00
parent 2687023b6f
commit 2d573da503
5 changed files with 5 additions and 13 deletions

View File

@@ -28,10 +28,6 @@ extern void output_bt_tick(void);
extern char* output_state_str(void); extern char* output_state_str(void);
extern bool output_stopped(void); extern bool output_stopped(void);
extern void wifi_manager_update_status();
//int64_t connecting_timeout = 0;
static void bt_app_av_state_connecting(uint16_t event, void *param); static void bt_app_av_state_connecting(uint16_t event, void *param);
static void filter_inquiry_scan_result(esp_bt_gap_cb_param_t *param); static void filter_inquiry_scan_result(esp_bt_gap_cb_param_t *param);
@@ -206,13 +202,11 @@ void set_app_source_state(int new_state){
if(bt_app_source_a2d_state!=new_state){ if(bt_app_source_a2d_state!=new_state){
ESP_LOGD(TAG, "Updating state from %s to %s", APP_AV_STATE_DESC[bt_app_source_a2d_state], APP_AV_STATE_DESC[new_state]); ESP_LOGD(TAG, "Updating state from %s to %s", APP_AV_STATE_DESC[bt_app_source_a2d_state], APP_AV_STATE_DESC[new_state]);
bt_app_source_a2d_state=new_state; bt_app_source_a2d_state=new_state;
wifi_manager_update_status();
} }
} }
void set_a2dp_media_state(int new_state){ void set_a2dp_media_state(int new_state){
if(bt_app_source_media_state!=new_state){ if(bt_app_source_media_state!=new_state){
bt_app_source_media_state=new_state; bt_app_source_media_state=new_state;
wifi_manager_update_status();
} }
} }
void hal_bluetooth_init(const char * options) void hal_bluetooth_init(const char * options)

View File

@@ -531,8 +531,10 @@ cJSON * add_gpio_for_name(cJSON * list,const char * nvs_entry,const char * name,
int gpioNum=0; int gpioNum=0;
if ((p = strcasestr(nvs_entry, name)) != NULL) { if ((p = strcasestr(nvs_entry, name)) != NULL) {
gpioNum = atoi(strchr(p, '=') + 1); gpioNum = atoi(strchr(p, '=') + 1);
if(gpioNum>=0){
cJSON_AddItemToArray(llist,get_gpio_entry(name,prefix,gpioNum,fixed)); cJSON_AddItemToArray(llist,get_gpio_entry(name,prefix,gpioNum,fixed));
} }
}
return llist; return llist;
} }

View File

@@ -40,8 +40,6 @@ static struct {
.cells = 2, .cells = 2,
}; };
extern void wifi_manager_update_status();
/**************************************************************************************** /****************************************************************************************
* *
*/ */
@@ -66,7 +64,6 @@ static void battery_callback(TimerHandle_t xTimer) {
battery.avg = battery.sum / battery.count; battery.avg = battery.sum / battery.count;
battery.sum = battery.count = 0; battery.sum = battery.count = 0;
ESP_LOGI(TAG, "Voltage %.2fV", battery.avg); ESP_LOGI(TAG, "Voltage %.2fV", battery.avg);
wifi_manager_update_status();
} }
} }

View File

@@ -41,7 +41,6 @@ bool jack_inserted_svc(void);
void (*spkfault_handler_svc)(bool inserted); void (*spkfault_handler_svc)(bool inserted);
bool spkfault_svc(void); bool spkfault_svc(void);
extern void wifi_manager_update_status();
/**************************************************************************************** /****************************************************************************************
* *
@@ -147,8 +146,6 @@ static void monitor_callback(TimerHandle_t xTimer) {
*/ */
static void jack_handler_default(void *id, button_event_e event, button_press_e mode, bool long_press) { static void jack_handler_default(void *id, button_event_e event, button_press_e mode, bool long_press) {
ESP_LOGD(TAG, "Jack %s", event == BUTTON_PRESSED ? "inserted" : "removed"); ESP_LOGD(TAG, "Jack %s", event == BUTTON_PRESSED ? "inserted" : "removed");
messaging_post_message(MESSAGING_INFO, MESSAGING_CLASS_SYSTEM,"jack is %s",BUTTON_PRESSED ? "inserted" : "removed");
wifi_manager_update_status();
if (jack_handler_svc) (*jack_handler_svc)(event == BUTTON_PRESSED); if (jack_handler_svc) (*jack_handler_svc)(event == BUTTON_PRESSED);
} }

View File

@@ -1182,6 +1182,8 @@ esp_err_t status_get_handler(httpd_req_t *req){
else { else {
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR , "Error retrieving status object"); httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR , "Error retrieving status object");
} }
// update status for next status call
wifi_manager_update_status();
return ESP_OK; return ESP_OK;
} }