Преглед изворни кода

Fixing #59 and unnecessary jack insertion messages-release

Sebastien пре 4 година
родитељ
комит
2d573da503

+ 0 - 6
components/driver_bt/bt_app_source.c

@@ -28,10 +28,6 @@ extern void 	output_bt_tick(void);
 extern char*	output_state_str(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 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){
         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;
-        wifi_manager_update_status();
     }
 }
 void set_a2dp_media_state(int new_state){
     if(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)

+ 3 - 1
components/services/accessors.c

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

+ 0 - 3
components/services/battery.c

@@ -40,8 +40,6 @@ static struct {
 	.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.sum = battery.count = 0;
 		ESP_LOGI(TAG, "Voltage %.2fV", battery.avg);
-		wifi_manager_update_status();
 	}	
 }
 

+ 0 - 3
components/services/monitor.c

@@ -41,7 +41,6 @@ bool jack_inserted_svc(void);
 void (*spkfault_handler_svc)(bool inserted);
 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) {
 	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);
 }
 

+ 2 - 0
components/wifi-manager/http_server_handlers.c

@@ -1182,6 +1182,8 @@ esp_err_t status_get_handler(httpd_req_t *req){
 	else {
 		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;
 }