MKR 1010 and A02YYUW Waterproof Ultrasonic Sensor

(255+9+170)&0xFF= B2 or 178 decimal
looks like you are missing the following 255 or 0xFF

I would suggest you simplify your program
remove all the WiFi code and concentrate on getting reading the sensor data correct