lvgl / lv_port_pc_vscode

MIT License
252 stars 157 forks source link

LVGL9 cannot output Log #37

Open arilink opened 8 months ago

arilink commented 8 months ago

I use lv_port_pc_eclipse and lv_port_pc_vscode to add Printf or LV_LOG_ERROR and I can't output log. Why?

arilink commented 8 months ago

@kisvegabor @microwavesafe @SIvaCoHan @rzr

kisvegabor commented 8 months ago

I see it on the Terminal tab: image

arilink commented 8 months ago

Are you the latest code pulled? I can't print using printf or LV_LOG_Error

kisvegabor commented 8 months ago

Yes, I tried the latest with printf. Do you check the terminal tab?

arilink commented 8 months ago

yes. no log show

arilink commented 8 months ago

image

kisvegabor commented 8 months ago

What is format:? Can you try just a simply printf("Hello\n");

arilink commented 8 months ago

it is just a code hint

arilink commented 8 months ago

I'll just use printf("Hello\n"); The same

arilink commented 8 months ago

I changed 3 cumputer. all computer is not have log

arilink commented 8 months ago

What is format:? Can you try just a simply printf("Hello\n");

Can you shared your Code? I use it to compare

kisvegabor commented 7 months ago

Really nothing special. Just cloned the project as it is and added printf("asd\n") in main.c.

arilink commented 7 months ago

@kisvegabor Hello senior, I re-built a V8.4 development environment using CLion, which can output log normally. Then I used CLion_V8.4 code to replace the Driver and LVGL code in LV_For_VS_Code respectively, which still cannot output Log, so it can be inferred that, There is a problem with my computer or LV_For_VS_Code code. Could you please help send an LV_For_VS_Code Project in which you can output Log so that I can troubleshoot the computer problem

kisvegabor commented 7 months ago

That's strange, however I'm using this repo as it is, so you can just clone my project from here :slightly_smiling_face:

Maybe @danyyliu has some ideas.

arilink commented 7 months ago
bbc51fdfdabf8034aad1625969a70da

I try to use uart to show log. it still no log...

kisvegabor commented 7 months ago

So it's an UART log. I completely missed that part so far.

I think the problem is that you need to disable LV_LOG_PRINTF. If it's enabled the custom print callback is not called.

arilink commented 7 months ago

yes use uart log ok,but use default still not work,should i enable LV_OS_WINDOWS?

arilink commented 7 months ago

So it's an UART log. I completely missed that part so far.

I think the problem is that you need to disable LV_LOG_PRINTF. If it's enabled the custom print callback is not called.

No. I can't fix this problem. so i try to use windows uart

arilink commented 7 months ago

I find a new way to fix this problem.but when i use LV_LOG_XX. the color log is not work. The specific content is as follows: void use_console_output() //打印窗口 { AllocConsole(); FILE *stream; freopen_s(&stream, "CONOUT$", "w", stdout); freopen_s(&stream, "CONIN$", "r", stdin); }

image

danyyliu commented 7 months ago

In my mind, this is an issue caused by some code related with the Windows system. image

From the previous information, I think we can get a conclusion that printf doesn't work, while uart is ok. It doesn't make sense that printf doesn't work, unless there are some code is manipulating the console, which can also explain why the issue can be fixed by calling AllocConsole. I don't think LVGL can support color log for windows console now, since SetConsoleTextAttribute should be used to set the color.

I'm not an expert of Windows program, please let me know if I am correct.

arilink commented 7 months ago

So from the current results, the problem is not related to LVGL, which has the log ready, but the windows console is not starting correctly or vscode is not receiving information from the console

arilink commented 7 months ago
a3b20db812bb1e73bf27ce0773513da ed41dd7f4e91f171e7aef04957ca33a 7aa5248e86fa514c3460859be1c3244 dde9df557c4ece963e9edad112f0893

I use CLion for comparison. When CLion runs the demo, it will open a new console, and the information in the console will be displayed in the IDE, while VSCode does not. Does this mean that VSCode did not wake up the console correctly? @kisvegabor @danyyliu Can you see how many consoles are added to the system when you run the demo using VSCode?

danyyliu commented 7 months ago

I haven't done any test like this in Windows. Could you please try it with hello world test without LVGL? I want to see what happens with the console in this situation.

arilink commented 7 months ago

image It can print correct log

danyyliu commented 7 months ago

So, it should not be an issue of vscode or clion. Maybe you can check if there is any code in your project is doing something with the console.

I tried to build and run this project in Windows, it seems the console can work well: image

arilink commented 7 months ago

This is the only project I opened and I didn't do anything else with the console, which is weird

arilink commented 7 months ago

image

arilink commented 7 months ago

@danyyliu I suddenly thought of a point, is it related to SDL_Main? image

vgegok commented 5 months ago

image

image

I think this is related to SDL.

kisvegabor commented 5 months ago

Does simple printf work instead of LV_LOG?

vgegok commented 5 months ago

I tested MacOS and everything is normal.

kisvegabor commented 5 months ago

How does your lv_conf.h looks like? Please also open lvgl to the latest from master. There some logging related fixes earlier.