olikraus / m2tklib

Automatically exported from code.google.com/p/m2tklib
Other
49 stars 11 forks source link

S8NUM format: “yyyy.mm.dd” #150

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I want to make a menu to set the date, format: “yyyy.mm.dd”
But it turns out just like this: “˽yyyy˽.˽mm˽.˽dd˽”. 
Can't remove the space between the elements S8NUM. It is possible to do this 
using a library?

Original issue reported on code.google.com by seriga...@gmail.com on 9 May 2015 at 8:56

GoogleCodeExporter commented 9 years ago
Is this a character based display?

Original comment by olikr...@gmail.com on 10 May 2015 at 4:44

GoogleCodeExporter commented 9 years ago
Sorry I bad know English. I better get some code for example.

#include <LiquidCrystal.h>
#include "M2tk.h"
#include "utility/m2ghlc.h"
...
LiquidCrystal lcd(42,44,46,48,50,52)
...
uint8_t Month = 5;
uint8_t Day = 10;
M2_U8NUM(u8_month, "c2", 1, 12, &Month);
M2_U8NUM(u8_day, "c2", 1, 31, &Day);
M2_LIST(list_date) = {&u8_month, &u8_day}; 
M2_HLIST(hlist_month, NULL, list_date);
M2tk m2(&hlist_month, m2_es_arduino, m2_eh_4bs, m2_gh_lc);
...
void setup() 
{  
  m2_SetLiquidCrystal(&lcd, 20, 4);
}
...
void loop() 
{  
  m2.checkKey();
  if ( m2.handleKey() ) 
  {
      m2.draw();
  }
}

*********************
display:
˽05˽˽10˽
*********************

On both sides of the “Month” and “Day” will be two empty spaces. 
Reserved for selection cursor to”[]”. I could not get rid of them. 
It does not matter. Redesigned menu to view:

Year / Month / Day
2015 /  10   /  5

Original comment by seriga...@gmail.com on 10 May 2015 at 8:26

GoogleCodeExporter commented 9 years ago
If you do not need a curser, you can make the elements read only.
This means, use "r1c2" instead of "c2" as a format option. Will this be a 
suitable solution?

Original comment by olikr...@gmail.com on 10 May 2015 at 11:45

GoogleCodeExporter commented 9 years ago
Thanks for the help. 
The problem was solved by changing the structure displays the date as shown 
above and now everything is beautiful and works.

Please help with another question.
The menu should display the current time, e.g. “12:34”
Indicator seconds “:” should flash once every one second.(12:34 -> 12 34 -> 
12:34 -> 12 34)

...
char lb_secInd[] = ":";
M2_LABEL(label_secInd, NULL, lb_secInd);
...

In the program code with a one-second interval, change the value of the 
variable lb_secInd (lb_secInd[0] = "" or lb_secInd[0] = ":")
But the updated value of the variable is displayed on the screen have to call 
the function m2.draw() every second. This leads to a noticeable screen flicker.

Of course you can directly display the seconds indicator ":" on the screen 
bypassing the M2tklib library
lcd.setCursor(16, 4); lcd.print(" ");
lcd.setCursor(16, 4); lcd.print(":");
But this solution has serious drawbacks. 

The screen flicker would be if I display any dynamic (rapidly changing) data. 
Can I upgrade (to withdraw) only part of the data and not to redraw the entire 
screen entirely?

Original comment by seriga...@gmail.com on 10 May 2015 at 12:55

GoogleCodeExporter commented 9 years ago
I think bypassing m2tklib is ok in this context. Only graphics based on u8glib 
will be absent of any "flicker".

Original comment by olikr...@gmail.com on 11 May 2015 at 8:00

GoogleCodeExporter commented 9 years ago
Thanks for the help and many thanks to developers of libraries. In general, all 
the tasks have been solved with the help of the library.

Original comment by seriga...@gmail.com on 9 Jun 2015 at 1:18

GoogleCodeExporter commented 9 years ago
thanks for the feedback. Glad to read that m2tklib did solve your problems.

Original comment by olikr...@gmail.com on 9 Jun 2015 at 6:41