Giter Site home page Giter Site logo

Comments (12)

agdl avatar agdl commented on September 6, 2024

From @ffissore on October 9, 2014 9:36

When you load the image, lots of debug info should be printed on the serial monitor. Can you paste them here?

from bridge.

agdl avatar agdl commented on September 6, 2024

From @Lalieu on October 10, 2014 14:20

When the image is loaded the following is printed to the serial monitor:

File size: 2770445601
Image Offset: 2770445601
Header size: 2770445601
loadImage: invalid n. of planes

any ideas?

from bridge.

agdl avatar agdl commented on September 6, 2024

From @ffissore on October 10, 2014 14:44

So this is where it's failing: https://github.com/arduino/Arduino/blob/ide-1.5.x/libraries/TFT/src/utility/Adafruit_GFX.h#L340
Thank you, we'll look into it.

from bridge.

agdl avatar agdl commented on September 6, 2024

From @ffissore on October 10, 2014 14:50

If you have suggestions or fixes, please don't hesitate to share them

from bridge.

agdl avatar agdl commented on September 6, 2024

From @Lalieu on October 10, 2014 15:3

I don't know if the spot you highlighted in your previous comment (where read16() is called) is the first spot where it is failing. The numbers printed for the File Size, Image Offset and Header Size seem a bit strange to me, being equal. These numbers are generated using read32() (just above your highlighted part), so maybe it already fails there.

I should be able to check the numbers by formatting the SD card, plugging it back into the TFT SD slot and reading the image from the SD card in the TFT SD slot (in which case i was able to print the image on the TFT screen). Hope to check that this evening.

from bridge.

agdl avatar agdl commented on September 6, 2024

From @sngl on October 13, 2014 16:35

@Lalieu , can you share your modified files? The modified library and the sketch
Thanks

from bridge.

agdl avatar agdl commented on September 6, 2024

From @Lalieu on October 13, 2014 19:13

@sngl , Hey, I don't know if this is the best way to share the files, but I've put the changed files and the sketch here.

from bridge.

agdl avatar agdl commented on September 6, 2024

From @sngl on October 16, 2014 10:27

Hello @Lalieu ,
what causes the problem is the method you use to pass the bmpFile to the functions read16 and read32.

The FileIO class updates its internal data after every read or write to remain in sync with the linux-side Bridge library.
In your code you are passing the File object by value, so for example when you use f.read in read16 function, you are communicating with the linux-side but you are updating the internal data of the local File object. When you exit from the function the local object is lost and if you call again read16 or read32 you will pass them the old bmpFile object that is not in sync with the Bridge on linux. This causes errors in the communication so the data you read on the Serial monitor is not the data coming from the file.
You can see this error because when the TFT library reads the BMP header it works correctly and then tries to read the next sections of the bmp file. After the header reading is competed it exits from the read16 function and then it call again read16 or read32, causing the problem.

The solution is to pass the bmpFile object by reference, so you have to modify the functions in this way
uint16_t PImage::read16(File f) ----> uint16_t PImage::read16(File *f)
and inside the function:
((uint8_t *)&result)[0] = f.read(); ----> ((uint8_t *)&result)[0] = f->read();
and so on...
and calling it by read16(&bmpFile) instead of read16(bmpFile);
Passing the bmpFile by reference to read16 the f->read( ) method will update the original object so when you call different times the read16 and read32 functions it will be always in sync.


Initializing FileSystem...
OK!
File size: 9482
Image Offset: 122
Header size: 108
Bit Depth: 24
Image size: 52x60

Image loaded

from bridge.

agdl avatar agdl commented on September 6, 2024

From @Lalieu on October 17, 2014 7:19

@sngl , Thank you for the time and effort! I understand the problem now, and will try the fix this weekend.

from bridge.

agdl avatar agdl commented on September 6, 2024

From @ld21 on October 18, 2014 22:39

@Lalieu: I just implemented what you are trying to do. Check out http://forum.arduino.cc/index.php?topic=268492.0 where I left my sketch for you. Good luck and a lot of fun with your project I wish!

from bridge.

agdl avatar agdl commented on September 6, 2024

@Lalieu @sngl if the problem has been solved please close the issue!

from bridge.

agdl avatar agdl commented on September 6, 2024

This issue was moved to #8

from bridge.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.