Comments (12)
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.
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.
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.
From @ffissore on October 10, 2014 14:50
If you have suggestions or fixes, please don't hesitate to share them
from bridge.
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.
From @sngl on October 13, 2014 16:35
@Lalieu , can you share your modified files? The modified library and the sketch
Thanks
from bridge.
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.
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.
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.
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.
@Lalieu @sngl if the problem has been solved please close the issue!
from bridge.
This issue was moved to #8
from bridge.
Related Issues (17)
- YUN: Errors executing Curl or Client.get via Bridge: different behaviors based on length of commands/URL HOT 1
- bridge.cpp should not use String HOT 2
- FileIO File class lacks default assignment operator HOT 3
- FileSystem.open always fails on directories
- Bridge.get("key", buffer, 0) takes forever HOT 1
- compile error HOT 1
- Compilation errors when Including Bridge.h or Invoking Bridge.begin(): no known conversion for argument 1 from ‘const __FlashStringHelper*’ to ‘const char*’ HOT 1
- Reference page doesn't document print() and println()
- Trouble compiling sketches with Bridge library HOT 1
- configurable max_retries
- Strange serial behavior HOT 1
- Problem with request curl, library Bridge.h
- async transfer() method
- No Serial Monitor output from sketch using Bridge library
- Add GitHub Action based CI
- Problem opening bmp file with FileIO on the Arduino Yún SD card to image on TFT screen. HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bridge.