Go Down

Topic: MENWIZ: yet another character lcd menu wizard library (Read 83309 times) previous topic - next topic

brunialti

direct value input is not supported in this version. I know this could yeld to a missing fan :-)
I'm trying to find a way to implement generic input value field without cosuming too much memory, in order to let the lib be usable even inside an "old" uno.

brunialti

BTW, which is the arduino model you are using the lib on?

starbug

i am using a ATMega 1284 with Optiboot bootloader on a own design. The design consists of LCD20x4 or  a MIO283-QT2 /9 GLCD, 4x3 or 4x4 Matrix Keypad, Rot. Enc, 6 Buttons with LEDs and a SD Card. LCD and Buttons use multiplexed Pins. At the moment i am trying to speed up the GLCD. I have exact the same board with a mbed working on it. You can imagine that board is really much faster. But of cost reduction i transfered the source to the AVR. I hope it will work otherwise the next step will be a Chipkit board or a FEZ Domino and later use their Controllers.

brunialti

#393
Jun 27, 2013, 02:59 pm Last Edit: Jun 27, 2013, 03:57 pm by brunialti Reason: 1
As you can read from the previous posts, i'm promising since a lot to put a new version....
I'm thinking to implement a gneral purpose input field of type text using the up/down buttons to select the characters to display. The r/l buttons should allow the user to position the cursor to the desired char position. The user should manage the input string making any check and type conversion as needed. That is a minimal approach.
I cannot use specific input fields for each data type (int, float, text ecc...) as the code would take too much memory space.

Operant

Any plans for a method of locking menus via a password? Other options instead of the password portion (if memory is an issue) could be a certain order of button presses (think up, down, right, right, etc...) or a time of holding down a number of buttons.

starbug

#395
Jun 27, 2013, 03:51 pm Last Edit: Jun 27, 2013, 03:57 pm by starbug Reason: 1
@brunialti
sounds great. Just had a look at MENWIZ.cpp regarding the VAR section. I don't want to manipulate the source for my purpose. It is never good to change somebody else's sources. Could give mighty problems when updating. So i will wait for your results.

brunialti

About pwd: it is the same problem: the lib grows too much.
I could implement a "large memory" lib, were the user could be able to enable/disable functionalities depending on the available memory. The drowback is that the code will became rapidly unreadable, as the new implementations are in a sensitive part of the code where it is difficult to segregate large/small functions and the massive use of #ifdef could lead to a real mess...

Operant

Very true and I agree that adding a bunch of conditional blocks would only increase the complexity. Would it be that difficult to implement a button combination instead (even hardcoded on compile)?

starbug

I don't think that the lib size is a real problem. Sacrifice of memory and size for such a grand menu lib? I cannot imagine that this lib will be used on a ATTiny13 or even smaller. Most will have a big CPU. I would even use two CPUs if i can program comfortably. So what?

hydrogen99

hello
Can i use this library with the glcd v3.
I have arduino mega 2650 and the lcd LCM12864C

liquidarts

Have just started playing with this menu system and I find it somewhat easier to use. But since i'm at the beginning of my learning curve I was wondering if there is anyone out there that has it setup to use with a DS1307 RTC to setup. If I can get your sketch i'd greatly appreciate it as it'll help me learn faster as to how some of it is done more. I know how to set hi/low temps for a 18B20 sensor. but thats about it...thanks....

starbug

@brunialti

I am still struggling along with MenWiz. Could you help me with this:
Code: [Select]

      s2=menu.addMenu(MW_SUBMENU,s1, F("Config"));             
          s3=menu.addMenu(MW_VAR,s2, F("Module Number")); 
              s3->addVar(MW_AUTO_INT,&MNR,1,25,1);

              s3->addVar(MW_ACTION,my_modultest);
              s3->setBehaviour(MW_ACTION_CONFIRM,false); // no confirmation needed



after changing MNR i would like to jump to my_modultest but my above code does not work. What am i doing wrong?

Thanks for your help.

limel

Crazy question but as a complete beginner I have problems with the following:

how do I create an additional custom character for LCD. Without the use of MENWIZ library i do this  with the following commands:

Code: [Select]
uint8_t degrees[8]  = {0x8,0x14,0x8,0x0,0x0,0x0,0x0};
uint8_t clock[8] = {0x0,0xe,0x15,0x17,0x11,0xe,0x0};
.
lcd.createChar(0, degrees);
lcd.createChar(1, clock);
.
lcd.printByte(0);
lcd.printByte(1);


But when I use  MENWIZ library instead of my defined characters i get strange characters. I assume that MEMWIZ use their special characters?
How do I make my custom characters ?

starbug

Hi Limel,

this is how i did it: (i am using a 20x4 lcd)

1. put the call to show custom chars in procedure 'maUS'
2. init the characters each time you need them, so you you can use more than the limited 8 characters.
3. Run 'maUS' as the main loop and call 'menu.addUsrScreen' in it.

This works for me.

Code: [Select]

//----------------------------------------------------------------
// custom Characters
//----------------------------------------------------------------
const uint8_t cc0[8] = {B11100, B10000, B11000, B10010, B10101, B00101, B00101, B00010};
const uint8_t cc1[8] = {B11100, B10000, B11000, B10010, B10110, B00010, B00010, B00111};
const uint8_t cc2[8] = {B11100, B10000, B11000, B10110, B10001, B00010, B00100, B00111};
const uint8_t cc3[8] = {B11100, B10000, B11000, B10110, B10001, B00010, B00001, B00110};
const uint8_t cc4[8] = {B11100, B10000, B11000, B10101, B10101, B00111, B00001, B00001};
const uint8_t cc5[8] = {B00000, B00000, B00000, B11100, B11100, B00000, B00000, B00000};
const uint8_t cc6[8] = {B11111, B11111, B11111, B11111, B11111, B11111, B11111, B00000};
const uint8_t cc7[8] = {B11111, B10001, B10001, B10001, B10001, B10001, B11111, B00000};


void customclear()
{
  // ensures all custom character slots are clear before new custom
  // characters can be defined.

const uint8_t blank[8] = {B00000, B00000, B00000, B00000, B00000, B00000, B00000, B00000};
 
  for(int i = 0; i < 9; i++)
  {
    lcd.createChar(0,(uint8_t*)blank);
  }
}



Here a snippet of the Loop:

Code: [Select]

void maUS(){
  static  char buf[7];
  char buffer [64];
  int n;
  int value;
//  int smenu;

  char sdir;

//-----------------------------------------------------------------

  smenu = 50;
   
  customclear(); // clear all old characters

  // creat new ones

  lcd.createChar(0,(uint8_t*)cc0); // F0
  lcd.createChar(1,(uint8_t*)cc1); // F1
  lcd.createChar(2,(uint8_t*)cc2); // F2
  lcd.createChar(3,(uint8_t*)cc3); // F3
  lcd.createChar(4,(uint8_t*)cc4); // F4
  lcd.createChar(5,(uint8_t*)cc5); // .
  lcd.createChar(6,(uint8_t*)cc6); // off
  lcd.createChar(7,(uint8_t*)cc7); // on


do { // repeat until.....

  n=sprintf (buffer, "Time: %02d:%02d:%02d", hour(), minute(), second()); // 1st Line
  strcpy(menu.sbuf,buffer);
//-----------------------------------------------------------------------------------------------------------------------

  if (dir == 0) sdir = char(127);
  if (dir == 1) sdir = char(126);
 
%  n=sprintf(buffer, "\nAdr.:%04d  St.:%03d %c",DecoderAdr,speed_byte,sdir);
  strcat(menu.sbuf,buffer);
   
//-----------------------------------------------------------------------------------------------------------------------
// Show Function Button Values
//-----------------------------------------------------------------------------------------------------------------------
  if (STATUS_VERSION == 1) {
    lcd.setCursor(0,2);lcd.print("Function:"); 

    if (bitRead(fByte, 0) == 0) {lcd.setCursor(10,2);lcd.write(byte(5)); } else {lcd.setCursor(10,2);lcd.write(byte(0)); }
    if (bitRead(fByte, 1) == 0) {lcd.setCursor(12,2);lcd.write(byte(5)); } else {lcd.setCursor(12,2);lcd.write(byte(1)); }
    if (bitRead(fByte, 2) == 0) {lcd.setCursor(14,2);lcd.write(byte(5)); } else {lcd.setCursor(14,2);lcd.write(byte(2)); }
    if (bitRead(fByte, 3) == 0) {lcd.setCursor(16,2);lcd.write(byte(5)); } else {lcd.setCursor(16,2);lcd.write(byte(3)); }
    if (bitRead(fByte, 4) == 0) {lcd.setCursor(18,2);lcd.write(byte(5)); } else {lcd.setCursor(18,2);lcd.write(byte(4)); }

    lcdOFF();
    check_Fx_switches();      // when we check the switches we'll get the current state
    set_Bits();               // and set the correct bits
    lcdON();
  }
//-----------------------------------------------------------------------------------------------------------------------
// Show S-88 Action Values
//-----------------------------------------------------------------------------------------------------------------------

  if (STATUS_VERSION == 2) {
    s88_showStatus();
   }
//----------------------------------------------------------------------------------------------------------------------- 
  menu.drawUsrScreen(menu.sbuf);
//-----------------------------------------------------------------------------------------------------------------------

  getspeed_byte();


I set and reset bits in fByte to set the character value.

Hope could help you.

brunialti

@limel

yes menwiz uses the first 2 custom characters. One more since the next version (1.3).
Use the last custom characters (starting from 4th) if you need to use your own characters.
It is possible menwiz could use more custom characters in the future.

Go Up