Nokia 6100 LCD Logo darstellen

Hallo

Für einen Linuxday bin ich gerade dabei, ein kleines Projekt zu bauen. Es soll auf einem Nokia 6100 ColorLCD Shield (von elecfreacs) ein paar Sensor-Informationen (Temp, Luftfeuchte, ...) und ein Logo dargestellt werden. Die Sensorwerte sind kein Problem, deshalb auch hier nicht im Code vorhanden.

Das Logo bekomme ich irgendwie nicht hin. Mein Code sieht z.z. so aus:

#include <gLCD.h>
#define BACKGROUND WHITE
#define TEXTCOLOR1 BLACK
#define BACKLIGHTpin 10

const char RST  = 8;
const char CS   = 9;
const char Clk  = 5;
const char Data = 3;

static char logo[1024] = {    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0xa0, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff,
   0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0x1f, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x80, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff,
   0xff, 0x0f, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x03,
   0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x00, 0xc0, 0x0f,
   0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, 0x00, 0xe0, 0x1f, 0x00, 0x00,
   0x00, 0x00, 0xfc, 0xff, 0x3f, 0x00, 0xc0, 0x3f, 0x00, 0x00, 0x00, 0x00,
   0xfe, 0xff, 0x3f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff,
   0x1f, 0xe0, 0xbf, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xe0,
   0x7f, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0x0f, 0xf8, 0xff, 0xff,
   0x01, 0x00, 0x00, 0x80, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xfe, 0x01, 0x00,
   0x00, 0x80, 0xff, 0xff, 0x07, 0xfc, 0xff, 0xfb, 0x01, 0x00, 0x00, 0xc0,
   0xff, 0xff, 0x07, 0xfc, 0xff, 0xff, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff,
   0x0f, 0xfe, 0xff, 0xfe, 0x03, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0xfe,
   0xff, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x07, 0xfc, 0xff, 0xfe,
   0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xfd, 0x07, 0x00,
   0x00, 0xe0, 0xff, 0xff, 0x07, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0xe0,
   0xff, 0xff, 0x07, 0xfe, 0xbf, 0xfd, 0x07, 0x00, 0x00, 0xe0, 0xff, 0xff,
   0x07, 0xfc, 0xff, 0xff, 0x0f, 0x00, 0x00, 0xe0, 0xff, 0x5f, 0x05, 0x54,
   0x7f, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0x07, 0x00, 0x00, 0xf6, 0xfd,
   0x0f, 0x00, 0x00, 0xe0, 0xff, 0x07, 0x00, 0x00, 0xdc, 0xff, 0x07, 0x00,
   0x00, 0xe0, 0xff, 0x03, 0x00, 0x00, 0x7c, 0xff, 0x0f, 0x00, 0x00, 0xe0,
   0xff, 0x07, 0x00, 0x00, 0xf4, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xdf, 0x07,
   0x00, 0x00, 0xfe, 0xff, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0x2f, 0x01, 0x90,
   0xfe, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xef, 0xff, 0x07, 0xfe, 0xff, 0xff,
   0x07, 0x00, 0x00, 0xe0, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x07, 0x00,
   0x00, 0xf0, 0xdb, 0xff, 0x0f, 0xfc, 0xff, 0xff, 0x03, 0x00, 0x00, 0xe0,
   0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x03, 0x00, 0x00, 0xe0, 0xfb, 0xff,
   0x07, 0xfc, 0xff, 0xff, 0x03, 0x00, 0x00, 0xe0, 0xf7, 0xff, 0x07, 0xfe,
   0xff, 0xff, 0x01, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x0f, 0xfc, 0xff, 0xff,
   0x01, 0x00, 0x00, 0xe0, 0xf6, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x00, 0x00,
   0x00, 0xe0, 0xff, 0xff, 0x07, 0xfe, 0xff, 0xff, 0x00, 0x00, 0x00, 0xe0,
   0xf6, 0xff, 0x03, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff,
   0x01, 0xfe, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xe0, 0xf7, 0xff, 0x01, 0xff,
   0xff, 0x1f, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x3f, 0x00, 0xff, 0xff, 0x1f,
   0x00, 0x00, 0x00, 0xe0, 0xef, 0x00, 0x80, 0xff, 0xff, 0x0f, 0x00, 0x00,
   0x00, 0xf0, 0x3f, 0x00, 0x80, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xe0,
   0x7f, 0x00, 0xe0, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xe0, 0x3f, 0x00,
   0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x00, 0xf8, 0xff,
   0xff, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x02, 0xff, 0xff, 0x1f, 0x00,
   0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x17, 0x00, 0x00, 0x00,
   0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
   0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
   0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

gLCD graphic(RST,CS,Clk,Data,HIGH_SPEED);

void setup() {
  pinMode(BACKLIGHTpin, OUTPUT);
  analogWrite(BACKLIGHTpin, 1023);  // Hintergrundbeleuchtung aktivieren
  graphic.begin(0,0,0,PHILLIPS_0);
  graphic.Clear();
  graphic.Window(0,0,127,127);
  for(int i=0 ; i<(sizeof logo) ; i+=3) {
    graphic.twoPixels(logo[i], logo[i+1], logo[i+2]);
  }
}

void loop() {
}

Anstelle des Logos wird jedoch immer nur das Display blau...

Das Logo hab ich in die Hex-Werte konvertiert, indem ich in gimp ein jpg als xbm abgespeichert habe und diese dann hier eingefügt habe. Die verwendete gLCD-Lib ist von hier: GitHub - TCWORLD/gLCD-Library: Arduino Nokia 128x128 Graphic LCD Library..

Ich wäre um jeden Hinweis oder Links zu Bespielen froh.

Danke
beduine

Ich hoffe Du benutzt einen Arduino MEGA 2560.
Oder gar einen mir unbekannten Arduino der PWM mit 10 Bit Auflösung hat?

 analogWrite(BACKLIGHTpin, 1023);  // Hintergrundbeleuchtung aktivieren

Grüße Uwe

Nein - ich verwende einen Arduino Uno, wobei ich nicht mehr sagen kann, wie ich auf die 1023 gekommen bin.

Mit static char logo[1024] belegst Du bereits die Hälfte des RAMs. Wieviel verbraucht dann noch die gLCD.h Bibliothek?

Grüße Uwe

Am besten du schreibst das mit PROGMEM ins Flash:

Der gesamte Sketch benötigt 7,200bytes. Das mit PROGMEM werde ich mir anschauen - klingt interessant.

Danke

Die Frage war wieviel RAM. Hiermit kannst du überprüfen was noch frei ist:

int freeRam () 
{
  extern int __heap_start, *__brkval; 
  int v; 
  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval); 
}

Serial.println(freeRam());

Genaugenommen ist es der Abstand zwischen Stack und Heap

Sorry, Verständnisproblem von meiner Seite. Ich muss mich da mal genauer einlesen.

Das ganze gibt 722 aus.