Alan Chang Posted September 26, 2017 Report Posted September 26, 2017 Hello, When I compiled the Dial widget example(win32_dial), I got those errors. ..\dial.c(127): error: #167: argument of type "point (*)[4]" is incompatible with parameter of type "point *" ..\dial.c(127): error: #167: argument of type "point (*)[4]" is incompatible with parameter of type "const point *" What can I do to fix them? I use freeRTOS and STM32F429-disco board. Thanks.
Joel Bodenmann Posted September 26, 2017 Report Posted September 26, 2017 Hi Alan, Those are actually compiler warnings and not errors. I just uploaded a new version of the demo where those are fixed. Thank you for bringing this to our attention!
Alan Chang Posted September 27, 2017 Author Report Posted September 27, 2017 Hi Joel, Thanks for the new version of demo. There is no error when complied. By the way, can I use the custom image of the needle? Like this. And it can rotate also. Thanks.
Joel Bodenmann Posted September 27, 2017 Report Posted September 27, 2017 Hello Alan, Yes, you can of course use an image for the needle. The example is really just that: An example. It's a custom widget and you can customize it to fit your needs. However, the current version of the µGFX library doesn't provide any high-level API for image rotation so you'd have to handle the image rotation yourself. But looking at your image it doesn't look like this needs to be an image anyway. I see two polygons and a circle
Alan Chang Posted September 27, 2017 Author Report Posted September 27, 2017 Hi Joel, Very thanks for your quick reply. Also thanks for your tip about the image. I will think about a way to draw this needle. Thanks.
Alan Chang Posted September 27, 2017 Author Report Posted September 27, 2017 Hi Joel, I just ran this dial widget example on my STM32F429 board. Icons are showed correctly on LCD except the needle. Needle is never displayed. So I went back to run the gdisp polygons demo. I found polygon could be draw by only using MATRIXFIXED2D API. I do not know the reason why MATRIXFLOAT2D API could not. If I use MATRIXFIXED2D API to draw needle in the dial widget example, will the result be same? Hope you can give some advice. Thanks.
Joel Bodenmann Posted September 27, 2017 Report Posted September 27, 2017 Hello Alan, The gdispFillConvexPoly() function can only operate on integer points because the points represent pixel coordinates. There is no such thing as half a pixel. When rendering a shape to the framebuffer. Of course you can use float matrix operations prior to that - that's no problem. 1 hour ago, Alan Chang said: Icons are showed correctly on LCD except the needle. Needle is never displayed. I assume that you enabled the convex polygon support as you wouldn't be able to compile otherwise? Did the /demos/modules/gdisp/polygons demo work on your hardware?
Alan Chang Posted September 28, 2017 Author Report Posted September 28, 2017 Hi Joel, Yes, I can run the /demos/modules/gdisp/polygons demo. MOV_0248.mp4 Just I need to turn the MATRIXFIXED2D API. I guess I only can use MATRIXFIXED2D on my board. Let me modify the Dial widget example code and try again. Thanks.
inmarket Posted September 28, 2017 Report Posted September 28, 2017 The most likely reason the fixed2d calls work but the float3d calls don't would be that there is something wrong with the compiler or c library support for floating point for your cpu. This could be as simple as not setting the compiler options correctly for your cpu. The fixed2d routines will invariably be much faster anyway than floating point operations (albiet slightly less accurate ).
Alan Chang Posted September 28, 2017 Author Report Posted September 28, 2017 Hello, Thanks for your quite reply. I remember I could run the demos\modules\gdisp\streaming successfully before. The note mentioned the demo uses floating point operations. Also there is FPU inside STMF429. Maybe there is setting issue in compiler or library . I will check them soon. Thanks.
Alan Chang Posted October 3, 2017 Author Report Posted October 3, 2017 Hello, When I change to my dial image in dial widget example code, why do I get two needles? I think one of them is from "dialCreate". How can I fix it? // Dial widget wi.g.show = TRUE; wi.g.width = 160; wi.g.height = 80; wi.g.y = 70; wi.g.x = 50; wi.g.parent = 0; wi.text = "Dial Widget"; //gdispImageOpenFile(&_imgDialFace, "rsc/dial_face.bmp"); gdispImageOpenFile(&_imgDialFace, "rsc/scale150x76.bmp"); gdispImageCache(&_imgDialFace); _ghDial = dialCreate(0, &wi, &_imgDialFace); dialSetAngle(_ghDial, DIAL_INITIAL_ANGLE); Thanks.
Joel Bodenmann Posted October 3, 2017 Report Posted October 3, 2017 It appears that your image is simply too small. Make sure that the image is of the same size as the widget itself. The current rendering function of the dial widget that you're using doesn't do a solid-color clear of the area but instead relies on the fact that the image covers the entire widget area.
Alan Chang Posted October 5, 2017 Author Report Posted October 5, 2017 Hi Joel, Very thanks for your reply. I changed the size of the widget to fit for my dial image.. It was solved. Thanks.
Joel Bodenmann Posted October 5, 2017 Report Posted October 5, 2017 Glad to hear that you managed to get it working!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now