Using the supplied code, the weather API returns a 400 code (connection refused). The exact same url when pasted into a browser works fine.
I tried adding header information to the Get request with no change. I added some prints to get more information about what is happening and this is the result::
06:04:07.476 -> LVGL Library Version: 9.1.0
06:04:07.570 -> Connecting…………………………..
06:04:23.592 -> Connected to Wi-Fi network with IP Address: 192.168.1.55
06:04:23.877 -> URL:
06:04:23.877 -> https://api.weatherapi.com/v1/current.json?q=Hot Springs, AR&key=77da0fb696c449bdb77da0fb69641307
06:04:26.352 -> Http Code = 400
06:04:26.352 -> Request payload:
06:04:26.352 -> <html>
06:04:26.352 -> <head><title>400 Bad Request</title></head>
06:04:26.352 -> <body>
06:04:26.352 -> <center><h1>400 Bad Request</h1></center>
06:04:26.352 -> <hr><center>nginx</center>
06:04:26.352 -> </body>
06:04:26.352 -> </html>
06:04:26.352 ->
I have run out of ideas at this time, is there anything else I can try?
Thanks, Dan
Hi.
can you share the URL you’re passing to the code (omit part of the api key)? Seems like you have a space on the name of your location. Instead of the space add “%20”
Regards
Thanks for replying.
The exact URL that I am using to paste into the browser that provides a correct response is:
https://api.weatherapi.com/v1/current.json?q=Hot Springs Village, AR&key=77da0fb696
I changed the API key to a fake one. This URL was copied directly from the console and pasted into Firefox.
The code used to print the information above is
static void update_table_values(void) {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
Serial.println(“URL: “);
Serial.println(url);
http.begin(url);
// http.addHeader(“X-device”, “12345678”);
int httpCode = http.GET(); // Make the GET request
Serial.print(“Http Code = “);
Serial.println(httpCode);
String payload = http.getString();
Serial.println(“Request payload:”);
Serial.println(payload);
if (httpCode > 0) {
// Check for the response
if (httpCode == HTTP_CODE_OK) {
String payload = http.getString();
Serial.println(“Request payload:”);
Serial.println(payload);
I have commented out one of my attempts to send a header with the Get request.
Other than this little problem and not being able to calibrate the screen, the course was an excellent introduction to the many uses for the CYD an lvgl.
Thank you, Dan
Hi.
You should use Hot%20Springs%20Village in your URL.
What issues did you have with calibration? And what was the exact board model you were using?
Regards,
Sara
Thanks, coding the spaces worked after I removed all my print statements.
For the display, the test program shows the following in landscape mode with the power socket on the left:
Top-left: x=21, y =7 ———— top-right: x=32, y=9
bottom-left: x=27, y=323 ————-bottom-right: x=321, y=236
The left-side readings are taken at the physical edge of the screen.
The right-side readings are about 3mm from the right edge, the right 3 mm part of the screen does not register.
I located a screen calibration program in:
…\Arduino\libraries\TFT_eSPI\examples\Generic\Touch_calibrate
When it runs, an arrow is placed in the top left corner and the user is supposed to touch the point. On my screen, the arrow point is outside the display limit and cannot be touched.
Since the screen could not be calibrated, I could not use the scroll bar, so I tried to rotate the display and it looks like the display was sized for portrait mode, but still display in landscape mode. The scroll bar was now absent. I am still looking at this problem.
Thanks for your response and your course.
Dan
Also, the board is labled ESP32-2432S028.
It is a resistive screen with an XP-2046 chip.
Dan
Hi.
It seems you need to calibrate your display.
We’ll add the instructions for calibration to the eBook in the next update, which were working on at the moment.
Meanwhile, I’ll send you the instructions to calibrate the display via email.
Regards,
Sara
I followed your instructions, which are very clear, and now the display works fine. The scroll bar works with the stylus or my finger. Thanks for you help.
You can close this stream as resolved.
Dan