Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Editing code to use 20x4 LCD
#1
Smile 
I need help to add a great feature to this unit. The first thing is to change the LCD 20x4 live course content is more, many thanks.
Reply
#2
(05-22-2014, 11:16 PM)axebuddy Wrote: I need help to add a great feature to this unit. The first thing is to change the LCD 20x4 live course content is more, many thanks.

What kind of help do you need and what do you want to add to the display so that you need the additional space?

Airic
Reply
#3
(05-22-2014, 11:31 PM)Airic Lenz Wrote:
(05-22-2014, 11:16 PM)axebuddy Wrote: I need help to add a great feature to this unit. The first thing is to change the LCD 20x4 live course content is more, many thanks.

What kind of help do you need and what do you want to add to the display so that you need the additional space?

Airic

I need help some UI menu to display on 20x4 LCD.
   
   


Code:
// ======================================================================================
// this function paints the current menu
// ======================================================================================
void menu_repaint() {

  // calculate the positions
  // TODO: this can be optimized by shifting on menu_cursor_pos

  //Serial.print("--> menu_pos: ");
  //Serial.println(menu_pos, DEC);

  const char str_space[] = "  ";
  const char str_cursor[] = "> ";

  // step down?
  if (menu_pos_old < menu_pos) {
    if (menu_cursor_pos == 1) {
      menu_cursor_pos = 2;
    }  
  }
  else if (menu_pos_old > menu_pos) { // step up?
    if (menu_cursor_pos == 2) {
      menu_cursor_pos = 1;
    }  
  }

  lcd.clear();

  // paint the two lines
  lcd.setCursor(2, 0);
  lcd.print(lines[menu_pos - menu_cursor_pos]);
  lcd.setCursor(2, 1);
  lcd.print(lines[menu_pos -  menu_cursor_pos + 1]);

  // paint the cursor
  if (menu_cursor_pos == 1) {
    lcd.setCursor(0, 0);
    lcd.print(str_cursor);
    lcd.setCursor(0, 1);
    lcd.print(str_space);
  }

  if (menu_cursor_pos == 2) {
    lcd.setCursor(0, 0);
    lcd.print(str_space);
    lcd.setCursor(0, 1);
    lcd.print(str_cursor);
  }

  // paint the scroll arrows
  paint_scroll_arrows();

}

Huh How can I do for change some code for correctly display on 20x4 LCD? Anywhere else?
Thanks.
Reply
#4
(05-23-2014, 12:15 AM)axebuddy Wrote: Huh How can I do for change some code for correctly display on 20x4 LCD? Anywhere else?
Thanks.

On your photo it looks like it is already working. So please let me know where exactly you are struggling.

Changing the function you showed is a good start though as it clearly is just implemented to draw 2 lines. There will be quite some changes needed in the whole file mE_ui.ino

Airic
Reply
#5
(05-23-2014, 10:30 AM)Airic Lenz Wrote:
(05-23-2014, 12:15 AM)axebuddy Wrote: Huh How can I do for change some code for correctly display on 20x4 LCD? Anywhere else?
Thanks.

On your photo it looks like it is already working. So please let me know where exactly you are struggling.

Changing the function you showed is a good start though as it clearly is just implemented to draw 2 lines. There will be quite some changes needed in the whole file mE_ui.ino

Airic

Try it., Thanks Airic
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)