Jump to content

Alan Chang

Members
  • Posts

    45
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi Joel, Here is the two pages. Oil --> Time Actually, this is sometimes happened. The ghost picture of the previous page appeared on next page. Thanks.
  2. Hi Joel, Thanks for your explanation. Now I totally use the gdispFillStringBox() to show the string. Unfortunately, I found some issue again. When I change the page to next, there is sometimes remained the ghost picture from last page. I tried to use gdispFillArea() to clear the string box area. It still can not be solved. Here is my code to show page. void modeIconDisplay(uint8_t modePage){ ... gdispFillArea(0, u_y+INFO_PADDING_LEFT_Y, dispwidth, u_fheight, Black); sprintf((char*)MODEICONBUFFER, " Time"); DATAWIDTH = gdispGetStringWidth(MODEICONBUFFER, u_font); gdispFillStringBox(0, u_y+INFO_PADDING_LEFT_Y, dispwidth, u_fheight, MODEICONBUFFER, u_font, colors->text, SkyBlue, justifyLeft); ...} void modeDataDisplay(uint8_t modePage){ ... sprintf((char*)MODEDATATIME_HOURSEBUFFER, "%0.2d",newModeitemInfo.hours); gdispFillStringBox(u_x+INFO_PADDING_LEFT_X+80, u_y+INFO_PADDING_LEFT_Y, 34, u_fheight, MODEDATATIME_HOURSBUFFER, u_font, colors->text, SkyBlue, justifyCenter); printf((char*)MODEDATATIME_MINUTESBUFFER, "%0.2d",newModeitemInfo.minutes); gdispFillStringBox(u_x+INFO_PADDING_LEFT_X+128, u_y+INFO_PADDING_LEFT_Y, 34, u_fheight, MODEDATATIME_MINUTESBUFFER, u_font, colors->text, SkyBlue, justifyCenter); sprintf((char*)MODEDATATIME_SECONDSBUFFER, "%0.2d",newModeitemInfo.seconds); gdispFillStringBox(u_x+INFO_PADDING_LEFT_X+185, u_y+INFO_PADDING_LEFT_Y, 34, u_fheight, MODEDATATIME_SECONDSBUFFER, u_font, colors->text, Silver, justifyCenter); ... } How cam I fix it? Thanks.
  3. Hi Joel, I am really using the gdispFillString() to display the time. Here is the part of my code. sprintf((char*)MODEDATABUFFER, "%0.2d",newhours); gdispFillString(u_x+INFO_PADDING_LEFT_X+76, u_y+INFO_PADDING_LEFT_Y+30, MODEDATABUFFER, u_font, colors->text, Orange); sprintf((char*)MODEDATABUFFER, "%0.2d",newminutes); gdispFillString(u_x+INFO_PADDING_LEFT_X+108, u_y+INFO_PADDING_LEFT_Y+30, MODEDATABUFFER, u_font, colors->text, Orange); sprintf((char*)MODEDATABUFFER, "%0.2d",newseconds); gdispFillString(u_x+INFO_PADDING_LEFT_X+145, u_y+INFO_PADDING_LEFT_Y+30, MODEDATABUFFER, u_font, colors->text, Orange); Then I used the gtimer to update the time. However, when I changed to use gdispFillStringBox, every thing is fine. The digits is well on the screen. So now I change gdispFillStringBox to display the time. Thanks.
  4. Hi Joel, When I use gdispFillString(), there is always ghost picture from last digits. Like this below. It is from "0" to "1". How can I fix it? Thanks.
  5. Hi Joel, Very thanks for your information. I have another question. When I set the digits, the value will be increased by press hardware button. At this moment should I stop the Gtimer? And then use gdispGFillString() to cover and show the increased digits. After no change, update new value to clock immediately and re-start Gtimer. Is that ok? Or is there other way to process this display? Thanks.
  6. Hi Joel, Thanks for your information. I used one gdispFillStringBox() to display the clock in my widget. The time format is "hr : min : sec". When I set the clock, it will start in hours and then minutes. I want to let the number be ticking. It means now it is setting the "hours". Should I use Gtimer ? If I use Gtimer, do I need to separate the time format? For example, use five gdispFillStringBox() to display on screen. First gdispFillStringBox() is for hours. Second gdispFillStringBox() is for ":". Tried gdispFillStringBox() is for minutes. Fourth gdispFillStringBox() is for ":". Fifth gdispFillStringBox() is for Second. Finally I use Gimer to control each to make ticking style when set the time for hours and minute. Is it correct? Hope you can understand. Thanks.
  7. Hi, Thanks for the explanation. I can think a solution to solve this. By the way, how can I let the number flicker when set the clock? Like this. https://www.youtube.com/watch?v=WBdNld6jixE Thanks.
  8. Hi Joel, The autoDemo() function actually is from the part of the dial widget example. And I add the digital number ICON display function which is display3DigitalNumber(). The updateModeItem() is for update the clock. void autoDemo(void) { uint16_t dialAngle = dialGetAngle(ghDial); printf("456"); //alan test display3DigitalNumber(150); gfxSleepMilliseconds(80); display3DigitalNumber(151); gfxSleepMilliseconds(80); // Increment the dial position and handle overflows if (dialAngle >= 180) { dialAngle = 0; } else { dialAngle++; } // Apply the new dial needle position dialSetAngle(ghDial, dialAngle); } void updateModeItem(void) { printf("123"); //alan test modeClockUpdate(); //update clock } Then I used gtimeStart() to call them. gtimerStart(&gtimer_Demo, auto_Demo, 0, TRUE, AUTO_DEMO_INTERVAL); gtimerStart(&gtimer_UpdateItem, updateModeItem, 0, TRUE, UPDATE_ITEM_INTERVAL); The video of the result is blow. MOV_0365.mp4 Today I found this. If I deleted the code in the autoDemo(). //display3DigitalNumber(150); //gfxSleepMilliseconds(80); //display3DigitalNumber(151); //gfxSleepMilliseconds(80); Every thing works well. MOV_0369.mp4 The display3DigitalNumber() is built by the gdispImageOpenFile(), gdispImageDraw() and gdispImageClose(). Such as this. switch (number){ case 0: gdispImageOpenFile(&_Digtal_num0, "rsc/P0_48x68.bmp"); gdispImageDraw(&_Digtal_num0, p_x, p_y, gdispGetWidth(),gdispGetHeight(), 0, 0); //show image file gdispImageClose(&_Digtal_num0); break; case 1: gdispImageOpenFile(&_Digtal_num1, "rsc/P1_48x68.bmp"); gdispImageDraw(&_Digtal_num1, p_x, p_y, gdispGetWidth(),gdispGetHeight(), 0, 0); //show image file gdispImageClose(&_Digtal_num1); break; Will it delay the timer when open the image file? How can I solve this? By the way, the UPDATE_ITEM_INTERVAL means the interal time to update the clock for my custom widget. I set 100 here. Thanks.
  9. Hi Joel, Thanks for your quick reply. And Yes, I did the function code same as yours below when used the gtimer. GTimer gtimer_Demo; GTimer gtimer_UpdateItem; gtimerInit(&gtimer_Demo); gtimerInit(&gtimer_UpdateItem); gtimerStart(&gtimer_Demo, auto_Demo, 0, TRUE, AUTO_DEMO_INTERVAL); gtimerStart(&gtimer_UpdateItem, updateModeItem, 0, TRUE, UPDATE_ITEM_INTERVAL); How did you check that the second one didn't work? ==> I used "printf()" in the call back function to output a simple message on PuTTY for debug. And there is no output in second "gtimerStart()". In gfxconf.h the GTIMER configuration is below. /////////////////////////////////////////////////////////////////////////// // GTIMER // /////////////////////////////////////////////////////////////////////////// #define GFX_USE_GTIMER TRUE #define GTIMER_THREAD_PRIORITY HIGH_PRIORITY #define GTIMER_THREAD_WORKAREA_SIZE 2048 Is there any issue? Thanks.
  10. Hi Joel, Can I build two "gtimerStart" functions at same time? Like this. gtimerStart(&gtimer_Demo, auto_Demo, 0, TRUE, AUTO_DEMO_INTERVAL); gtimerStart(&gtimer_UpdateItem, updateModeItem, 0, TRUE, UPDATE_ITEM_INTERVAL); Now when I executed this program, the second one did not work. Thanks.
  11. Hi Joel, Thanks for your suggestion. I will try them. Thanks.
  12. Hi guys , Very thanks for your information. My application will be similar like this video. https://www.youtube.com/watch?v=9dCVJIUPspM I designed my custom widget for these two things below. 1. Change pages by a hardware button. 2. Show the latest information in every page. So it will be always updates the data. I tested the gwinAttachToggle() and there was no FALSE returned. The pages can be changed. So I think toggle is working with my custom widget well. Now if I do not change page, the information of this present page still need to update all the time. Just when I tried to update the information, the loop was blocked in geventEventWait. It was waiting for the toggle event. However, I think I can not set a specific time in geventEventWait. Because I do not know when the user press the hardware button, and some information like clock and clock can be really changed very quickly. Is there any return value of some API which I can handle during the geventEventWait loop? Or I only can solve by create a new thread. Hope you can give me some suggestion. By the way, I am using FreeRTOS. Thank you.
  13. Hello, I used gwinAttachToggle to assign the toggle for my widget. When the hardware button is pressed, the listener will receive an event and call "the page change" function. I use the geventEventWait to wait the event. pe = geventEventWait(&_glistener, TIME_INFINITE); However, this function only keeps waiting an event. If I do not press the button, I want the information of current page can continue update. Also wait for the event at same. What can I do in my code? Thanks.
  14. Hello Joel, Thanks for your information. I think my custom widget has some issue and can not be attached well with gwinAttachToggle(). There is no response when executed, so I traced the code. I found this part is always be "TRUE". bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { ... if (instance == oi) return TRUE; ... } However, I tried to create a win button(gwinButtonCreate()), and check the oi value. It is always have a value which is 65535. I think the value of oi is given here. oi = wvmt->ToggleGet(gw, role); static uint16_t ButtonToggleGet(GWidgetObject *gw, uint16_t role) { (void) role; return ((GButtonObject *)gw)->toggle; } When is the value put in "((GButtonObject *)gw)->toggle" ? Here is my widget VMT. static const gwidgetVMT modeVMT = { { //gwindowVMT g part start------ "Mode", // The classname sizeof(ModeObject), // The object size _gwidgetDestroy, // The destroy routine _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, //gwindowVMT g part end------ modeDraw_Default, // The default drawing routine #if GINPUT_NEED_MOUSE { 0, // Process mouse down events 0, // Process mouse up events 0, // Process mouse move events }, #endif #if GINPUT_NEED_KEYBOARD || GWIN_NEED_KEYBOARD { 0 // Process keyboard events }, #endif #if GINPUT_NEED_TOGGLE { 1, // Toggle role uModeToggleAssign, // Assign Toggles uModeToggleGet, // Get Toggles 0, // Process toggle off events uModeToggleOn, // Process toggle on events }, #endif #if GINPUT_NEED_DIAL { 0, // No dial roles 0, // Assign Dials 0, // Get Dials 0, // Process dial move events }, #endif }; and static void uModeToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { (void) role; ((ModeObject *)gw)->toggle = instance; } static uint16_t uModeToggleGet(GWidgetObject *gw, uint16_t role) { (void) role; return ((ModeObject *)gw)->toggle; } Is anything wrong in my code? Please help. Thanks.
  15. Hi Joel, Thanks for your explanation. But I still do not know how the "on" state of hardware button pass to the widget. In other words, how does the widget get the "on" state and start ToggleOn() ? Hope you can explain. Thanks.
×
×
  • Create New...