diff --git a/src/birdbrain/finchandHummingbirdServer/PollServlet.java b/src/birdbrain/finchandHummingbirdServer/PollServlet.java index 70fb8df..0b52aed 100644 --- a/src/birdbrain/finchandHummingbirdServer/PollServlet.java +++ b/src/birdbrain/finchandHummingbirdServer/PollServlet.java @@ -91,22 +91,22 @@ protected void doGet(HttpServletRequest req, HttpServletResponse response) throw finchOrientation = "Right_Wing_Down"; } - response.getWriter().print("temperature " + Math.floor(temperature*100)/100 + '\n' + endofline); - response.getWriter().print("leftLight " + (int)(lights[0]*100/255) + '\n' + endofline); - response.getWriter().print("rightLight " + (int)(lights[1]*100/255) + '\n' + endofline); - response.getWriter().print("leftObstacle " + obstacles[0] + '\n' + endofline); - response.getWriter().print("rightObstacle " + obstacles[1] + '\n' + endofline); - response.getWriter().print("orientation " + finchOrientation + '\n' + endofline); - response.getWriter().print("XAcceleration " + Math.floor(100*accels[0])/100 + '\n' + endofline); - response.getWriter().print("YAcceleration " + Math.floor(100*accels[1])/100 + '\n' + endofline); - response.getWriter().print("ZAcceleration " + Math.floor(100*accels[2])/100 + '\n' + endofline); + response.getWriter().print("temperature " + Math.floor(temperature*100)/100 + endofline); + response.getWriter().print("leftLight " + (int)(lights[0]*100/255) + endofline); + response.getWriter().print("rightLight " + (int)(lights[1]*100/255) + endofline); + response.getWriter().print("leftObstacle " + obstacles[0] + endofline); + response.getWriter().print("rightObstacle " + obstacles[1] + endofline); + response.getWriter().print("orientation " + finchOrientation + endofline); + response.getWriter().print("XAcceleration " + Math.floor(100*accels[0])/100 + endofline); + response.getWriter().print("YAcceleration " + Math.floor(100*accels[1])/100 + endofline); + response.getWriter().print("ZAcceleration " + Math.floor(100*accels[2])/100 + endofline); } else { response.getWriter().print("_problem Finch sensors not responding"); } } else if(finchProblemReport && !isHummingbirdConnected){ - response.getWriter().print("_problem Finch not connected" + '\n' + endofline); + response.getWriter().print("_problem Finch not connected" + endofline); } if(isHummingbirdConnected) { @@ -115,9 +115,9 @@ else if(finchProblemReport && !isHummingbirdConnected){ { for(int i = 1; i < 5; i++) { - response.getWriter().print("voltage/" + i + " " + Math.floor(100*(double)sensors[i-1]/51)/100 + '\n' + endofline); - response.getWriter().print("raw/" + i + " " + (int)((double)sensors[i-1]/2.55) + '\n' + endofline); - response.getWriter().print("raw2/" + i + " " + (int)((double)sensors[i-1]/2.55) + '\n' + endofline); + response.getWriter().print("voltage/" + i + " " + Math.floor(100*(double)sensors[i-1]/51)/100 + endofline); + response.getWriter().print("raw/" + i + " " + (int)((double)sensors[i-1]/2.55) + endofline); + response.getWriter().print("raw2/" + i + " " + (int)((double)sensors[i-1]/2.55) + endofline); } } else @@ -129,7 +129,7 @@ else if(finchProblemReport && !isHummingbirdConnected){ Integer distance = hummingbird.getDistanceAtPort(i); if(distance != null) { - response.getWriter().print("distance/" + i + " " + distance + '\n' + endofline); + response.getWriter().print("distance/" + i + " " + distance + endofline); } else { response.getWriter().print("_problem Hummingbird sensors not responding"); @@ -140,7 +140,7 @@ else if(finchProblemReport && !isHummingbirdConnected){ Integer sound = hummingbird.getSoundValue(i); if(sound != null) { - response.getWriter().print("sound/" + i + " " + sound + '\n' + endofline); + response.getWriter().print("sound/" + i + " " + sound + endofline); } else { response.getWriter().print("_problem Hummingbird sensors not responding"); @@ -151,7 +151,7 @@ else if(finchProblemReport && !isHummingbirdConnected){ Double temperature = hummingbird.getTemperatureAtPort(i); if(temperature != null) { - response.getWriter().print("temperature/" + i + " " + temperature + '\n' + endofline); + response.getWriter().print("temperature/" + i + " " + temperature + endofline); } else { response.getWriter().print("_problem Hummingbird sensors not responding");