Go Down

Topic: PB lecture image sur carte SD (Read 5263 times) previous topic - next topic

Jazznet

Bon j'ai téléchargé les 2 lib, en gros tu fais quoi pour changer le code qu'on utilise avec tinyfat ?

Heloderma-kris

tu as un sketch d'example apres il sufi d'aporter les modification corespondante a ton ecran ç'est tou de memoire.

il te faut sdFat.h et utft-Sdraw.

Jazznet

#17
Apr 30, 2015, 04:00 pm Last Edit: Apr 30, 2015, 04:02 pm by Jazznet
ok j'ai bien trouvé, merci :)

mais mais mais
Code: [Select]
Arduino : 1.6.1 (Windows 8.1), Carte : "Arduino Due (Native USB Port)"

Les options de compilation ont été modifiées, tout sera recompilé

In file included from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/SdBaseFile.h:52:0,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/ios.h:22,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/istream.h:26,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat\istream.cpp:21:

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/SdVolume.h:25:2: error: #error SdVolume is deperacated. Remove this line to continue using this class.

 #error SdVolume is deperacated.  Remove this line to continue using this class.

  ^

In file included from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/iostream.h:27:0,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/bufstream.h:27,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ArduinoStream.h:29,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/FatLib.h:23,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/SdVolume.h:22,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/SdBaseFile.h:52,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/ios.h:22,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/istream.h:26,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat\istream.cpp:21:

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:50:36: error: expected class-name before '{' token

 class ostream : public virtual ios {

                                    ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:65:24: error: declaration of 'operator<<' as non-function

   ostream& operator<< (ios_base& (*pf)(ios_base& str)) {

                        ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:65:20: error: expected ';' at end of member declaration

   ostream& operator<< (ios_base& (*pf)(ios_base& str)) {

                    ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:65:32: error: expected ')' before '&' token

   ostream& operator<< (ios_base& (*pf)(ios_base& str)) {

                                ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:241:3: error: 'pos_type' does not name a type

   pos_type tellp() {

   ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:249:12: error: expected ';' at end of member declaration

   ostream& seekp(pos_type pos) {

            ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:249:27: error: expected ')' before 'pos'

   ostream& seekp(pos_type pos) {

                           ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat\istream.cpp:411:1: error: expected '}' at end of input

 }

 ^

In file included from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/iostream.h:27:0,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/bufstream.h:27,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ArduinoStream.h:29,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/FatLib.h:23,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/SdVolume.h:22,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/SdBaseFile.h:52,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/ios.h:22,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/istream.h:26,

                 from C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat\istream.cpp:21:

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In constructor 'ostream::ostream()':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:52:3: error: uninitialized reference member 'ostream::seekp' [-fpermissive]

   ostream() {}

   ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(bool)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:74:16: error: 'putBool' was not declared in this scope

     putBool(arg);

                ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(const char*)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:82:15: error: 'putStr' was not declared in this scope

     putStr(arg);

               ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(const signed char*)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:90:28: error: 'putStr' was not declared in this scope

     putStr((const char*)arg);

                            ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(const unsigned char*)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:98:28: error: 'putStr' was not declared in this scope

     putStr((const char*)arg);

                            ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(char)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:106:16: error: 'putChar' was not declared in this scope

     putChar(arg);

                ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(signed char)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:114:35: error: 'putChar' was not declared in this scope

     putChar(static_cast<char>(arg));

                                   ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(unsigned char)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:122:35: error: 'putChar' was not declared in this scope

     putChar(static_cast<char>(arg));

                                   ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(double)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:130:18: error: 'putDouble' was not declared in this scope

     putDouble(arg);

                  ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(float)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:138:18: error: 'putDouble' was not declared in this scope

     putDouble(arg);

                  ^

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h: In member function 'ostream& ostream::operator<<(short int)':

C:\Users\Jeff\Desktop\arduino-1.6.1\libraries\SdFat/utility/ostream.h:146:24: error: 'putNum' was not declared in this scope

     putNum((int32_t)arg);

                        ^

........ et cela continue :/

   }


raaaa cela m'enerve un peu :/..... la le 7 pouces fonctionne bien avec la due, donc si cela passe je vais avoir mon soft ultra rapide, ........ j'ai vraiment envie que cela marche maintenant :)

Heloderma-kris

perso je suis en 1.7 est le fichier d'exemple compile impécable!
verifie que tu a bien la derniere version de SDFat

https://github.com/greiman/SdFat

elle date du 21 mars 2015

Jazznet

Bon cela vient doucement.....
as tu les images du sketch d'essais ? je ne les trouve pas :/

Jazznet

ou pas, j'arrive a rien..... je me mélange de partout c'est un calvaire....

tu parts de quel sketch ?
(maintenant j'ai plus de message d'erreur a la compil, mais j'ai rien non plus qui s'affiche après :/)

Heloderma-kris

voila je vien de tester cela avec le 5" car pour le moment le 7" ne demar pas :smiley-evil:
pense a changer la config d'ecran et touchpad
la vitesse et en halfspeed car sinon marche pas chez moi

Code: [Select]
#include <SPI.h>
// SdFat lib from here :-
// https://github.com/greiman/SdFat/archive/master.zip
#include <SdFat.h>
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <UTFT_SdRaw.h>
extern uint8_t SmallFont[];
extern uint8_t BigFont[];

#define SD_CHIP_SELECT  53  // SD chip select pin
// file system object
SdFat sd;
// print stream
ArduinoOutStream cout(Serial);

int wait = 2, pressed_button;

// Initialize display
// ------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield            : <display model>,19,18,17,16
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due       : <display model>,25,26,27,28
// Teensy 3.x TFT Test Board                   : <display model>,23,22, 3, 4
// ElecHouse TFT LCD/SD Shield for Arduino Due : <display model>,22,23,31,33
//
// Remember to change the model parameter to suit your display module!

UTFT myGLCD(CTE50, 25, 26, 27, 28);
//UTFT myGLCD(CTE50, 25, 26, 27, 28);
//UTFT myGLCD(CTE70, 25, 26, 27, 28);


// Initialize touchscreen
// ----------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield            : 15,10,14, 9, 8
// Standard Arduino Mega/Due shield            :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due       :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due (JP10):  6, 5,32, 3, 2
// Teensy 3.x TFT Test Board                   : 26,31,27,28,29
// ElecHouse TFT LCD/SD Shield for Arduino Due : 25,26,27,29,30
//
UTouch  myTouch( 62, 63, 64, 65, 66); // shield aqualedsource
//UTouch  myTouch( 6, 5, 4, 3, 2);

UTFT_SdRaw myFiles(&myGLCD);
UTFT_Buttons  myButtons(&myGLCD, &myTouch);

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for DUE & Leonardo only
  }
  Serial.println(F("Initialising SD card..."));
  bool mysd = 0;
  // see if the card is present and can be initialized:
  while (!mysd)
  {
    if (!sd.begin(SD_CHIP_SELECT, SPI_HALF_SPEED)) {
      Serial.println(F("Card failed, or not present"));
      Serial.println(F("Retrying...."));
    }
    else
    {
      mysd = 1;
      Serial.println(F("Card initialised."));
    }
  }
  Serial.println(F("Initialising LCD."));
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
  myButtons.setTextFont(BigFont);
  int butskip = myButtons.addButton( 85,  219 , 70,  20, "Skip");
  Serial.println(F("LCD initialised."));
  // ////////////////////////////////////////////////////////////////////////////////
  //             Wait for GPS screen  or skip button
  ///////////////////////////////////////////////////////////////////////////////////
  Serial.println(F("Initialising GPS."));
  long mytime = millis();
  myFiles.load(0, 0, 240, 240, "wait4gps.RAW", 1 , 1);
  long mytime1 = millis() - mytime;
  cout << F("Time to draw 240x240 raw ") << mytime1 << F(" ms") << endl;
  myButtons.drawButton(butskip);
  while (wait == 2) {
    pressed_button = myButtons.checkButtons();
    if (pressed_button == butskip)
    {
      cout << F("Skip button detected (No GPS :( )\n");
      wait = true;
    }
  }
  char fname440[] = "SO11/SO100100.RAW";
  myGLCD.clrScr();
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (no extra buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 32, 0);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (32*buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 32, 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (32*buffer) (inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  mytime = millis();
  myFiles.pan(20, 20, 440, 440, 0, 0, 4040, 4040, "SK45/SK45.RAW", 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 portion from 4040x4040 raw image (inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  int xad, yad;
  int xd = 0, yd = 0;
  int tmpx = 0, tmpy = 0;
  mytime = millis();
  for (int z = 0; z < 209; z++)
  {
    tmpy = (z / 19);
    tmpx = z - (tmpy * 19);
    xd = tmpx * 42;
    yd = tmpy * 42;
    tmpy = (z / 22);
    tmpx = z - (tmpy * 22);
    yad = (tmpy * 69) + 10;
    xad = (tmpx * 108) + 44;
    myFiles.pan(xd, yd, 42, 42, xad, yad, 2374, 696, "icons.raw");
  }
  mytime1 = millis();
  cout << F("time to draw 210 42x42 icons (ms) ") << (mytime1 - mytime) << endl;
  delay(5000);
  cout << F("Thanks for watching!") << endl;
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);
  myGLCD.setColor(VGA_GREEN);
  myGLCD.print("Thanks for watching!", CENTER, 231);
}

void loop()
{
}



Jazznet

bon je suis mauvais, cela ne fonctionne pas, et je n'ai pas de retour sur le moniteur de serie non plus  >:(
plus de problème de compile, juste un écran blanc sans rien

alors que le teste de l'écran fonctionne bien ..... avec le sketch d'utft


Heloderma-kris

Dans le sketch que je t'ai donner au dessu change la vitesse SD init a SPI_QUARTER_SPEED pour tester.
tu utilise le lecteur sur le shield ou sur l'ecran ?

Jazznet

Sur l'écran et c'est une vieille carte :/
Celle qui fonctionne parfaitement sur la mega avec tous les écrans ;)

Heloderma-kris

tu est toujours sur la 1.6.0 ?
essayer une autre carte eventuelement , la je commence a séché!

Heloderma-kris

#28
May 05, 2015, 09:38 am Last Edit: May 05, 2015, 09:39 am by Heloderma-kris
Bon j'ai enfin  tester le 7" avec la DUE , 1 bonne et 1 mauvaise nouvelle:
la bonne ça marche chez moi
la mauvaise  bha ça marche chez moi :smiley-mr-green:

donc voila ce que j'ai mi :

carte SD 16Go clase 4
vitesse spi  SPI_HALF_SPEED sinon marche pas en full
j'ai adapter mes sortie a mon shield et mon ecran

voici le code :
Code: [Select]
#include <SPI.h>
// SdFat lib from here :-
// https://github.com/greiman/SdFat/archive/master.zip
#include <SdFat.h>
#include <UTFT.h>
#include <UTouch.h>
#include <UTFT_Buttons.h>
#include <UTFT_SdRaw.h>
extern uint8_t SmallFont[];
extern uint8_t BigFont[];

#define SD_CHIP_SELECT  53  // SD chip select pin
// file system object
SdFat sd;
// print stream
ArduinoOutStream cout(Serial);

int wait = 2, pressed_button;

// Initialize display
// ------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield            : <display model>,19,18,17,16
// Standard Arduino Mega/Due shield            : <display model>,38,39,40,41
// CTE TFT LCD/SD Shield for Arduino Due       : <display model>,25,26,27,28
// Teensy 3.x TFT Test Board                   : <display model>,23,22, 3, 4
// ElecHouse TFT LCD/SD Shield for Arduino Due : <display model>,22,23,31,33
//
// Remember to change the model parameter to suit your display module!

UTFT myGLCD(CTE70, 25, 26, 27, 28);
//UTFT myGLCD(CTE50, 25, 26, 27, 28);
//UTFT myGLCD(CTE70, 25, 26, 27, 28);


// Initialize touchscreen
// ----------------------
// Set the pins to the correct ones for your development board
// -----------------------------------------------------------
// Standard Arduino Uno/2009 Shield            : 15,10,14, 9, 8
// Standard Arduino Mega/Due shield            :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due       :  6, 5, 4, 3, 2
// CTE TFT LCD/SD Shield for Arduino Due (JP10):  6, 5,32, 3, 2
// Teensy 3.x TFT Test Board                   : 26,31,27,28,29
// ElecHouse TFT LCD/SD Shield for Arduino Due : 25,26,27,29,30
//
UTouch  myTouch( 62, 63, 64, 65, 66);
//UTouch  myTouch( 6, 5, 4, 3, 2);

UTFT_SdRaw myFiles(&myGLCD);
UTFT_Buttons  myButtons(&myGLCD, &myTouch);

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for DUE & Leonardo only
  }
  Serial.println(F("Initialising SD card..."));
  bool mysd = 0;
  // see if the card is present and can be initialized:
  while (!mysd)
  {
    if (!sd.begin(SD_CHIP_SELECT, SPI_HALF_SPEED)) {
      Serial.println(F("Card failed, or not present"));
      Serial.println(F("Retrying...."));
    }
    else
    {
      mysd = 1;
      Serial.println(F("Card initialised."));
    }
  }
  Serial.println(F("Initialising LCD."));
  myGLCD.InitLCD();
  myGLCD.clrScr();
  myGLCD.setFont(SmallFont);
  myTouch.InitTouch();
  myTouch.setPrecision(PREC_MEDIUM);
  myButtons.setTextFont(BigFont);
  int butskip = myButtons.addButton( 85,  219 , 70,  20, "Skip");
  Serial.println(F("LCD initialised."));
  // ////////////////////////////////////////////////////////////////////////////////
  //             Wait for GPS screen  or skip button
  ///////////////////////////////////////////////////////////////////////////////////
  Serial.println(F("Initialising GPS."));
  long mytime = millis();
  myFiles.load(0, 0, 240, 240, "wait4gps.RAW", 1 , 1);
  long mytime1 = millis() - mytime;
  cout << F("Time to draw 240x240 raw ") << mytime1 << F(" ms") << endl;
  myButtons.drawButton(butskip);
  while (wait == 2) {
    pressed_button = myButtons.checkButtons();
    if (pressed_button == butskip)
    {
      cout << F("Skip button detected (No GPS :( )\n");
      wait = true;
    }
  }
  char fname440[] = "SO11/SO100100.RAW";
  myGLCD.clrScr();
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (no extra buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 32, 0);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (32*buffer) (non inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  mytime = millis();
  myFiles.load(20, 20, 440, 440, fname440, 32, 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 raw (32*buffer) (inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  mytime = millis();
  myFiles.pan(20, 20, 440, 440, 0, 0, 4040, 4040, "SK45/SK45.RAW", 1);
  mytime1 = millis() - mytime;
  cout << F("Time to draw 440x440 portion from 4040x4040 raw image (inverted colour) ") << mytime1 << F(" ms") << endl;
  delay(5000);
  myGLCD.clrScr();
  int xad, yad;
  int xd = 0, yd = 0;
  int tmpx = 0, tmpy = 0;
  mytime = millis();
  for (int z = 0; z < 209; z++)
  {
    tmpy = (z / 19);
    tmpx = z - (tmpy * 19);
    xd = tmpx * 42;
    yd = tmpy * 42;
    tmpy = (z / 22);
    tmpx = z - (tmpy * 22);
    yad = (tmpy * 69) + 10;
    xad = (tmpx * 108) + 44;
    myFiles.pan(xd, yd, 42, 42, xad, yad, 2374, 696, "icons.raw");
  }
  mytime1 = millis();
  cout << F("time to draw 210 42x42 icons (ms) ") << (mytime1 - mytime) << endl;
  delay(5000);
  cout << F("Thanks for watching!") << endl;
  myGLCD.clrScr();
  myGLCD.setFont(BigFont);
  myGLCD.setColor(VGA_GREEN);
  myGLCD.print("Thanks for watching!", CENTER, 231);
}

void loop()
{
}


et voici quelques photos de ce que tu devrais obtenir :






Go Up