Show Posts
Pages: [1] 2 3 ... 97
1  Using Arduino / Displays / Re: Ucglib: A new Color OLED and TFT Library... on: Today at 01:52:51 pm
Great. Excellent error description. I will create an issue for this.
Meanwhile, UCG_FONT_MODE_TRANSPARENT could be used as a workaround.

K+

Oliver
2  Using Arduino / Displays / Re: Reducing the size of u8glib on: July 29, 2014, 03:25:21 am
Which fonts did you select? Maybe select a font with an "r" postfix, if codes above 127 are not required.
On the wiki pages, for each font, the size in bytes is also mentioned. Based on this, you can predict and optimize the code size.

Oliver
3  Using Arduino / Displays / Re: U8glib: Graphics Lib for LCDs and OLEDs on: July 29, 2014, 03:21:12 am
Yes, the listing file would be nice to see.
Depending on the fonts U8glib requires about 10K. If you do not need ASCII chars with code higher than 127, then fonts with a "r" postfix can be used to reduce flash memory.
Also other libraries and the use of floating point are common reasons for increased memory usage.

Oliver
4  Using Arduino / Displays / Re: Req: Display two pages of data alternately using U8glib on: July 29, 2014, 03:15:11 am
Hi Dave

First you need to group your procedures according to what needs to be displayed on one page.
For the first page, this seems to be:
draw(0);
draw(1);
draw(2);

I personally suggest to introduce a procedure for this (to simplify the code):
Code:
void draw_page_1(void)
{
draw(0);
draw(1);
draw(2);
}
Of course you could still use the param loop.
Same should be done for draw_page_2()

Second, the delay and the different pages must be selected/switched outside the picture loop.
This might look like this:

Code:
  u8g.firstPage();   
  do {
   draw_page_1();
  }
  while( u8g.nextPage() );//end of picture loop
  delay(1000);
  u8g.firstPage();   
  do {
   draw_page_2();
  }
  while( u8g.nextPage() );//end of picture loop

Oliver

5  Using Arduino / Displays / Re: U8glib refreshing delay, communicating trough xbee on: July 26, 2014, 02:13:40 pm
Hi

1. Only do graphics output in the draw() procedure (body of the picture loop)
More specific: Do not call unpack() inside the loop body, instead call "unpack" in loop itself:

Code:
void loop(void) { 
  unpack();
  u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() );
    delay(150);  // maybe this can be removed or the value can be reduced
}
I guess this will also solve your second problem.

2. Display graphics, then your numbers
The keyword is "state machine". You must introduce a state variable, e.g.:
Code:
uint8_t dispaly_state = 0;
Then define, what should be shown for which number. Let me define this:
0 = display graphics
1 = display normal content

Then, your main loop will look like this:
Code:
uint8_t dispaly_state = 0;

void loop(void) { 
  unpack();
  u8g.firstPage(); 
  do {
    if ( display_state == 0 )
      draw_graphics();   // show graphics here
   else
      draw();
  } while( u8g.nextPage() );
    delay(150);
}
Now, because display_state is set to 0 at startup, this will always show your graphics, but will never call draw(). But this is easy, we just need to assign 1 to display_state. As requested, this could be done after 5 seconds:

Code:
uint8_t dispaly_state = 0;

void loop(void) { 
  unpack();
  u8g.firstPage(); 
  do {
    if ( display_state == 0 )
      draw_graphics();   // show graphics here
   else
      draw();
  } while( u8g.nextPage() );

  if ( display_state == 0 && millis() > 5000 )
    display_state = 1;

  delay(150);
}

Oliver

6  Using Arduino / Displays / Re: ST7920 Dot Matrix LCD Screen has shadows/artifacts. on: July 24, 2014, 04:34:33 pm
If this picture was created by the sketch with the endless for loop, then i would also thinkt, that this is a hardware issue with the display.

Oliver
7  Using Arduino / Displays / Re: ST7920 Dot Matrix LCD Screen has shadows/artifacts. on: July 24, 2014, 02:06:51 pm
I have seen a lot of timing problems with the ST7920, but they usually look differently.
Is there some flicker, or is it constantly looking like this?

Can you modify the HelloWorld example, where you enter an infinit loop after the first picture loop:

Code:
void loop(void) {
  // picture loop
  u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() );
 
  for(;;)
    ;
}

How  will it look like?

Oliver
8  Using Arduino / Programming Questions / Re: Menu for Display on: July 23, 2014, 04:59:06 pm
Yes, you need to replace m2_es_arduino by a self written procedure, which might be named as you wish.
If you want to use M2_KEY_0 to M2_KEY_9, then indeed you need to use m2_eh_6bks. You can safe some flash memory by using m2_eh_6bs if you do not need the numeric keys. But using m2_eh_6bks is always ok.


      // Is necessary Here Call Standard Key Pad Like Readkeypad Procedure that I've did or I can do something like this:
Yes, you have to call your standard key pad library. Calls to m2 procedures do not make sense here, because this is exactly the interface to the key pad library.

     // then return one of M2_KEY_SELECT or M2_KEY_NEXT or ...
     How I can do for return the action expected ?

Just by writing
"return M2_KEY_NEXT;"
or
"return M2_KEY_SELECT;"

Here is some pseudo code. Your code should look like this:

Code:
uint8_t m2_es_gnusso(m2_p ep, uint8_t msg)
{
  switch(msg)
  {
    case M2_ES_MSG_GET_KEY:
      if ( key pad lib reports that "4" is pressed )
        return M2_KEY_PREV;
      if ( key pad lib reports that "5" is pressed )
        return M2_KEY_SELECT;
      if ( key pad lib reports that "6" is pressed )
        return M2_KEY_NEXT;
      // ....


It might be required to encapsulate the return values with M2_KEY_EVENT().This depends on your library (which i do not  know):
Code:
uint8_t m2_es_gnusso(m2_p ep, uint8_t msg)
{
  switch(msg)
  {
    case M2_ES_MSG_GET_KEY:
      if ( key pad lib reports that "4" is pressed )
        return  M2_KEY_EVENT(M2_KEY_PREV);
      if ( key pad lib reports that "5" is pressed )
        return  M2_KEY_EVENT(M2_KEY_SELECT);
      if ( key pad lib reports that "6" is pressed )
        return  M2_KEY_EVENT(M2_KEY_NEXT);
      // ....

Oliver
9  Using Arduino / Displays / Re: Library Size on: July 23, 2014, 01:52:24 pm
I tried to develop Ucglib with the smallest possible footprint. But sure, it still requires some flash rom memory.
Your code also make use of floating point. That also eats up a lot of memory. And the: You use some other libs. What about their size.
One idea: Using double and float requires more memory than only double or float variables. You can also try to use only one font, which will also reduce the flash rom size.

Oliver
10  Using Arduino / Programming Questions / Re: What's the difference between Adafruit SSD1306 and SH1106? on: July 23, 2014, 01:44:13 pm
In fact I do not much about the Adafriut library. But what i have seen the commands might need to be adjusted. Best is to study the commands, which are sent by the Adafruit lib and update them according to the display. It also seems that some internal drawing area is defined. This usually is not required if this is the case.
I also think that it is better to draw each page (128x8 pixel area) individually instead of writing all the 128x64 pixel at once. That means i think it is better to use two nested loops instead of one loop. This would also allow you to send commands at the begin of the page:
Code:
for( page = 0; page < 8; page ++ ) {
  // send commands to place cursor at the correct page start position
  for( i = 0; i < 128; i++ ) {
    // write page
  }
}

Oliver
11  Using Arduino / Displays / Re: SSD1306 128x64 to 64x48 size Oled Display on: July 22, 2014, 02:14:12 pm
The OLED has a size of 64x48. The controller has a size of 128x64 pixel. The question is, how is the OLED window mapped into the 128x64 RAM are of the controller.
Or: How is the upper left corner of the OLED display mapped onto the RAM of the controller.
This is very specific to the connection between controller and OLED and can have (almost) any mapping. For example if the OLED display is centered in the RAM of the controller, then the upper left corner of the display has the pixel coordinates (32,8).

Usually this is documented in the datasheet for the specific OLED module.

A similar discussion is here: http://forum.arduino.cc/index.php?topic=256374.msg1814470#msg1814470

Oliver
12  Using Arduino / Programming Questions / Re: What's the difference between Adafruit SSD1306 and SH1106? on: July 22, 2014, 02:03:52 pm
There is only one small difference between SSD1306 and SH1106: The SH1106 controller has an internal RAM of 132x64 pixel. The SSD1306 only has 128x64 pixel.

First problem for standard 128x64 OLEDs with SH1106 controller is: How is the 128x64 window mapped into the 132x64 RAM?
It seems, that the 128x64 OLED is centered in most cases within the 132x64 area, that means pixel (2,0) in ram is pixel (0,0) on the display.

For u8glib, the update for the SH1106 was very small. I just had to shift the display by 2 pixel. This is more complicated with the Adafruit lib. Mainly the procedure "Adafruit_SSD1306::display(void)" depends very much on the hardware architecture and assumes, that the width of the RAM area is 128 (which is wrong for the SH1106). I think the procedure Adafruit_SSD1306::display(void) needs to be rewritten completly (including the commands, which are sent).

Oliver

13  Using Arduino / Displays / Re: SSD1306 128x64 to 64x48 size Oled Display on: July 22, 2014, 01:48:13 pm
hmm... you could use u8glib and modify the SSD1306 128x64 driver:

https://code.google.com/p/u8glib/source/browse/csrc/u8g_dev_ssd1306_128x64.c

First, change WIDTH and HEIGHT to 64 and 48 (lines 39 and 40).
Then update the init sequence. By default this is u8g_dev_ssd1306_128x64_adafruit3_init_seq (line 112).

After this, you should be able to at least see something with the U8GLIB_SSD1306_128x64 constructor.

Oliver

14  Using Arduino / Programming Questions / Re: Menu for Display on: July 22, 2014, 01:42:22 pm
Hi

As discussed here, you must define your own event source procedure:
https://code.google.com/p/m2tklib/wiki/t11#Numeric_Key_Pad

It might look like this:
Code:
uint8_t m2_es_gnusso(m2_p ep, uint8_t msg)
{
  switch(msg)
  {
    case M2_ES_MSG_GET_KEY:
      // make a call to the read num key libary
     // then check for the key
     // then return one of M2_KEY_SELECT or M2_KEY_NEXT or ...
      break;
    case M2_ES_MSG_INIT:
      break;
  }
  /* call Arduino standard event source */
  // may not be required
  // return m2_es_arduino(ep, msg);
}

Then your m2 constructor will look differently:

Code:
M2tk m2(&m2_null_element, m2_es_gnusso, m2_eh_6bs, m2_gh_lc);

Additionally, calls to m2.setPin are not required any more. This is instead handled by your new event source "m2_es_gnusso".

Oliver
15  Using Arduino / Displays / Re: ST9720 128x64 - slow loop time, what can I do ? Due/u8glib/HWSPI ? on: July 21, 2014, 04:16:09 pm
For sure, there is a plan to add HW SPI for U8glib... but currently i do not have much time for this project  smiley-roll

Oliver
Pages: [1] 2 3 ... 97