• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Learn LVGL: 6.1 Get Error

Q&A Forum › Learn LVGL: 6.1 Get Error
0 Vote Up Vote Down
dbarnett asked 12 months ago

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

11 Answers
0 Vote Up Vote Down
dbarnett answered 12 months ago

Ooops.

0 Vote Up Vote Down
Robert Fleming answered 12 months ago

Yeah, you probably didn’t mean to share that.
 

0 Vote Up Vote Down
Sara Santos Staff answered 12 months ago

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
 

0 Vote Up Vote Down
dbarnett answered 12 months ago

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

0 Vote Up Vote Down
Sara Santos Staff answered 12 months ago

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

0 Vote Up Vote Down
dbarnett answered 12 months ago

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

0 Vote Up Vote Down
dbarnett answered 12 months ago

Also, the board is labled ESP32-2432S028.
It is a resistive screen with an XP-2046 chip.
Dan

0 Vote Up Vote Down
dbarnett answered 12 months ago

Typo above:
top-right should be X=323
Sorry.
Dan

0 Vote Up Vote Down
Sara Santos Staff answered 12 months ago

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

0 Vote Up Vote Down
dbarnett answered 12 months ago

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 

0 Vote Up Vote Down
Sara Santos Staff answered 12 months ago

Great.
I’ll try to update the eBook soon with the calibration sketch.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.