-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem opening bmp file with FileIO on the Arduino Yún SD card to image on TFT screen. #2320
Comments
When you load the image, lots of debug info should be printed on the serial monitor. Can you paste them here? |
When the image is loaded the following is printed to the serial monitor: File size: 2770445601 any ideas? |
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 |
If you have suggestions or fixes, please don't hesitate to share them |
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. |
@Lalieu , can you share your modified files? The modified library and the sketch |
Hello @Lalieu , The FileIO class updates its internal data after every read or write to remain in sync with the linux-side Bridge library. The solution is to pass the bmpFile object by reference, so you have to modify the functions in this way Initializing FileSystem... Image loaded |
@sngl , Thank you for the time and effort! I understand the problem now, and will try the fix this weekend. |
@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! |
This issue was moved to arduino-libraries/Bridge#8 |
This issue was moved to arduino-libraries/Bridge#9 |
Hi all,
I have been trying to print a .bmp image on the arduino 1.77" TFT screen using the Arduino Yún, but I have some trouble opening the file using the FileIO library of the Yún. Although I can find the .bmp file on the SD card installed on the Yún, and can open it using: FileSystem.open(filename), it is not loaded as an image file properly when using: PImage logo = tft.loadImage(filename), causing logo.isValid() to return false.
Here is how far I got:
System:
With the system I was able to:
Code:
FileSystem.open("/mnt/sd/arduino.bmp")
So, from this I conclude that the connection between the TFT screen and Yún is fine and the image on the SD card installed in the Yún is accessible using the FileIO library of the Yún.
However, when the .bmp is stored on the SD card in the Yún, the FileIO library is needed to access the file. To display the image, the TFT library is needed, which in turn needs the SD library. The SD and FileIO library interfere with each other, due to double declarations of the File class.
The TFT library just uses the Adafruit_ST7735 and Adafruit_GFX libraries. Looking at these libraries it seems that the SD library is only needed to open the file on the SD card:
bmpFile = SD.open(fileName)
Therefore the PImage class and image handling functions needed to print the image on the screen are only declared when the SD library is loaded (#if defined(SD_H)).
In order to use the Adafruit libraries in combination with the FileIO library instead of the SD library I changed:
bmpFile = SD.open(fileName)
into:
File bmpFile = FileSystem.open(fileName);
and
#if defined(SD_H)
into
#if defined(FILEIO_H)
in the Adafruit library files and Pimage.h file.
With these modifications the different libraries are able to work with each other, and I can access the image on the SD card in the Yún, while using the Adafruit libraries, which should allow to print the image on the screen using the following code:
However, logo.isValid() returns false. So I guess the image is loaded differently now I’m using:
File bmpFile = FileSystem.open(fileName);
instead of:
bmpFile = SD.open(fileName);
However, until now I haven’t been able to figure out what is going wrong.
Therefore I hope there is someone who knows what is going wrong, or who encountered the problem before and discovered a solution.
Cheers,
Mark
The text was updated successfully, but these errors were encountered: