2
0
Эх сурвалжийг харах

fix hires display - release

Philippe G 4 жил өмнө
parent
commit
3dc2ed9629

+ 1 - 1
build-scripts/I2S-4MFlash-sdkconfig.defaults

@@ -457,9 +457,9 @@ CONFIG_LWIP_SO_REUSE=y
 CONFIG_LWIP_SO_REUSE_RXTOALL=y
 # CONFIG_LWIP_SO_RCVBUF is not set
 # CONFIG_LWIP_IP_FRAG is not set
-#CONFIG_LWIP_IP_REASSEMBLY is not set
 # CONFIG_LWIP_STATS is not set
 # CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
+CONFIG_LWIP_IP_REASSEMBLY=y
 CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
 CONFIG_LWIP_GARP_TMR_INTERVAL=60
 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32

+ 1 - 1
build-scripts/SqueezeAmp-sdkconfig.defaults

@@ -457,7 +457,7 @@ CONFIG_LWIP_MAX_SOCKETS=16
 # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set
 CONFIG_LWIP_SO_REUSE=y
 CONFIG_LWIP_SO_REUSE_RXTOALL=y
-#CONFIG_LWIP_IP_REASSEMBLY is not set
+CONFIG_LWIP_IP_REASSEMBLY=y
 CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
 CONFIG_LWIP_GARP_TMR_INTERVAL=60
 CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32

+ 25 - 8
components/squeezelite/display.c

@@ -808,6 +808,8 @@ static void grfa_handler(u8_t *data, int len) {
 			artwork.y = htons(pkt->y);		
 		} else if (artwork.size) GDS_ClearWindow(display, artwork.x, artwork.y, -1, -1, GDS_COLOR_BLACK);
 		
+		LOG_INFO("gfra en:%u x:%hu, y:%hu", artwork.enable, artwork.x, artwork.y);
+		
 		// done in any case
 		return;
 	}
@@ -1042,8 +1044,8 @@ static void visu_handler( u8_t *data, int len) {
 	
 	// little trick to clean the taller screens when switching visu 
 	if (visu.row >= displayer.height) GDS_ClearExt(display, false, true, visu.col, visu.row, visu.col + visu.width - 1, visu.row + visu.height - 1);
-	
-	if (visu.mode) {
+
+	if ((visu.mode = pkt->which) != 0) {
 		// these will be overidden if necessary
 		visu.col = visu.border = 0;
 		visu.rotate = false;
@@ -1065,13 +1067,27 @@ static void visu_handler( u8_t *data, int len) {
 				bars = htonl(pkt->bars);
 				visu.spectrum_scale = htonl(pkt->spectrum_scale) / 100.;
 			} else {
-				// full screen visu, try to use bottom screen if available
+				// full screen visu, try to optimize orientation/shape
 				visu.width = htonl(pkt->full.width);
-				visu.height = GDS_GetHeight(display) > displayer.height ? GDS_GetHeight(display) - displayer.height : GDS_GetHeight(display);
-				visu.row = GDS_GetHeight(display) - visu.height;			
+				visu.height = GDS_GetHeight(display);					
 				
-				// try to estimate if we should rotate visu
-				if (visu.height > displayer.height && visu.height > 2*visu.width) visu.rotate = true;
+				// do we have enough height to play with layout
+				if (GDS_GetHeight(display) > displayer.height) {
+					// by default, use up to the bottom of the display
+					visu.height -= displayer.height;					
+					visu.row = displayer.height;
+
+					if (artwork.enable && artwork.y) {
+						// server sets width to artwork X offset to tell us to rotate
+						if (visu.width != artwork.x) {
+							visu.height = artwork.y - displayer.height;
+							if (visu.height <= 0) {
+								visu.height = displayer.height;
+								LOG_WARN("No room left for visualizer, disable it or increase artwork offset %d", artwork.y);
+							}				
+						} else visu.rotate = true;
+					}		
+				} else visu.row = 0;
 				
 				// is this spectrum or analogue/digital
 				if ((visu.mode & ~VISU_ESP32) == VISU_SPECTRUM) {
@@ -1094,9 +1110,10 @@ static void visu_handler( u8_t *data, int len) {
 				visu.style = htonl(pkt->classical_vu.style);
 				if (visu.style) visu.row = visu.height - VU_HEIGHT;
 			}	
-			if (bars > MAX_BARS) bars = MAX_BARS;
 		}	
 		
+		if (bars > MAX_BARS) bars = MAX_BARS;
+		
 		// for rotate, swap width & height
 		if (visu.rotate) visu_fit(bars, visu.height, visu.width);
 		else visu_fit(bars, visu.width, visu.height);

+ 2 - 2
components/squeezelite/output_bt.c

@@ -124,7 +124,7 @@ static int _write_frames(frames_t out_frames, bool silence, s32_t gainL, s32_t g
 int32_t output_bt_data(uint8_t *data, int32_t len) {
 	int32_t iframes = len / BYTES_PER_FRAME, start_timer = 0;
 
-	if (len < 0 || data == NULL || !running) {
+	if (iframes <= 0 || data == NULL || !running) {
 		return 0;
 	}
 	
@@ -135,9 +135,9 @@ int32_t output_bt_data(uint8_t *data, int32_t len) {
 	// for us to send. (BTC_SBC_DEC_PCM_DATA_LEN * sizeof(OI_INT16) - availPcmBytes
 	SET_MIN_MAX(len,req);
 	TIME_MEASUREMENT_START(start_timer);
-	SET_MIN_MAX_SIZED(_buf_used(outputbuf),bt,outputbuf->size);
 	
 	LOCK;	
+	SET_MIN_MAX_SIZED(_buf_used(outputbuf),bt,outputbuf->size);
 	output.device_frames = 0; 
 	output.updated = gettime_ms();
 	output.frames_played_dmp = output.frames_played;

+ 1 - 1
components/wifi-manager/CMakeLists.txt

@@ -1,7 +1,7 @@
 idf_component_register( SRC_DIRS .
 						INCLUDE_DIRS . ${IDF_PATH}/components/esp_http_server/src ${IDF_PATH}/components/esp_http_server/src/port/esp32  ${IDF_PATH}/components/esp_http_server/src/util ${IDF_PATH}/components/esp_http_server/src/
 						REQUIRES squeezelite-ota json mdns 
-						PRIV_REQUIRES tools services platform_config esp_common json newlib freertos  spi_flash nvs_flash mdns pthread wpa_supplicant platform_console esp_http_server console   driver_bt
+						PRIV_REQUIRES tools services platform_config esp_common json newlib freertos  spi_flash nvs_flash mdns pthread wpa_supplicant platform_console esp_http_server console driver_bt
 						EMBED_FILES res/style.css.gz res/code.js.gz index.html res/bootstrap.css.gz res/yeti/bootstrap.css.gz res/jquery.js.gz res/bootstrap.js.gz res/favicon.ico
 						
 )