Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LVGL9 cannot output Log #37

Open
arilink opened this issue Mar 30, 2024 · 32 comments
Open

LVGL9 cannot output Log #37

arilink opened this issue Mar 30, 2024 · 32 comments

Comments

@arilink
Copy link

arilink commented Mar 30, 2024

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
Copy link
Author

arilink commented Mar 31, 2024

@kisvegabor
Copy link
Member

I see it on the Terminal tab:
image

@arilink
Copy link
Author

arilink commented Apr 3, 2024

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

@kisvegabor
Copy link
Member

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

@arilink
Copy link
Author

arilink commented Apr 3, 2024

yes. no log show

@arilink
Copy link
Author

arilink commented Apr 3, 2024

image

@kisvegabor
Copy link
Member

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

@arilink
Copy link
Author

arilink commented Apr 3, 2024

it is just a code hint

@arilink
Copy link
Author

arilink commented Apr 3, 2024

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

@arilink
Copy link
Author

arilink commented Apr 3, 2024

I changed 3 cumputer. all computer is not have log

@arilink
Copy link
Author

arilink commented Apr 3, 2024

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

Can you shared your Code? I use it to compare

@kisvegabor
Copy link
Member

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

@arilink
Copy link
Author

arilink commented Apr 7, 2024

@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
Copy link
Member

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

Maybe @danyyliu has some ideas.

@arilink
Copy link
Author

arilink commented Apr 8, 2024

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

@kisvegabor
Copy link
Member

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
Copy link
Author

arilink commented Apr 8, 2024

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

@arilink
Copy link
Author

arilink commented Apr 8, 2024

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
Copy link
Author

arilink commented Apr 9, 2024

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
Copy link

danyyliu commented Apr 9, 2024

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
Copy link
Author

arilink commented Apr 9, 2024

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
Copy link
Author

arilink commented Apr 9, 2024

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
Copy link

danyyliu commented Apr 9, 2024

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
Copy link
Author

arilink commented Apr 9, 2024

image
It can print correct log

@danyyliu
Copy link

danyyliu commented Apr 9, 2024

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
Copy link
Author

arilink commented Apr 10, 2024

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

@arilink
Copy link
Author

arilink commented Apr 10, 2024

image

@arilink
Copy link
Author

arilink commented Apr 11, 2024

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

@vgegok
Copy link

vgegok commented Jun 13, 2024

image

image

I think this is related to SDL.

@kisvegabor
Copy link
Member

Does simple printf work instead of LV_LOG?

@vgegok
Copy link

vgegok commented Jun 17, 2024

I tested MacOS and everything is normal.

@kisvegabor
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants