Retroplayer:
Looking at the datasheet and looking at the adafruit library, it doesn't look like the library is directly compatible with your board. To get into bitmap mode, you need to send a specific command. The reason it works with everything else is because the printer is set at defaults at power up and accepts your text.
Page 14 of the datasheet describes how to use the bitmap mode. You have to send ESC (27) then * (42) then a mode of 8 or 24 dots, and then your actual bitmap information. I don't see the library sending all those commands.
I have got another code which is not using any specific Library. Its simply working on POS Commands... I used to send bitmap commands under //bitmap routine if you see.
The output is same yet...
The code is in next reply.
Retroplayer:
BTW, you can change the adafruit library directly. It has the main structure that you want, you just have to modify the parts that are different.
I have modified it according to the datasheet of printer. One more thing I have done is that I have made private functions accessable publically. Then I tried sending commands as in datasheet. I could see the commands working fine. Even the bitmap command also runs but couldn't produce a bitmap unfortunately..
"This command is ignored if a downloaded bit image has not been defined."
"GS * n1 n2 d1…dk Define downloaded bit image"
I think you may be using different kinds of modes. There are a few different ones. The GS /n mode requires you to have defined the image, but that is not what you have done yet.
"GS v 0 p wL wH hL hH Print raster bit image" I think this is the one you want to print a raw Bitmap.
I am not positive that I am right. The datasheet is a bit confusing and have several modes. Unfortunately since I cannot experiment with it, you must.
Having had a quick look at the printer manuals and the Adafruit library the problem looks like difference in commands sent to printer to print raster images.
The Adafruit printer does bitmaps with
DC2 * r n [d1…dn]
but to do the equivalent command with your printer is
GS v 0 p wL wH hL hH [d1…dk]
You either need to write a new printBitmap function in the Adafruit library to allow for the extra parameters or maybe modifying the existing code to use
GS * n1 n2 d1…dk
to store the bitmap (deleting all user defined characters) and then use
I have no idea what I'm doing but have attempted to modify the library to print your bitmaps. It compiles but that's as far as I can test it. The library should really be re-written to suit your printer but that's probably beyond my abilities and attention span.
To test it download the attached .h & .cpp files and replace the current ones then alter the Adafruit example to replace printBitmap with printBitmap2. You may need to delete the old library pre-compiled stuff & restart the IDE first.
// Print the 75x75 pixel logo in adalogo.h
printer.printBitmap2(adalogo_width, adalogo_height, adalogo_data);
// Print the 135x135 pixel QR code in adaqrcode.h
printer.printBitmap2(adaqrcode_width, adaqrcode_height, adaqrcode_data);
Try the tutorial for printing bitmaps stored on an SD Card on a thermal printer available at lucidtronix.com - lucidtronix Resources and Information.. Their library automatically thresholds the image if it is in color and has a print scanline function that prints the image row by row.
hope you are still around, I have tried the attached files as well as bringing in your additions to the new Adafruit libraries, however they seem to have added a few additional lines that now cause the additions to bomb out.
Any chance you would be willing to relook at this?
I have the exact same issue where i need to use the GS v function instead of DC2,
In file included from A_printertest.ino:14:0:
C:\Users\Administrator\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library/Adafruit_Thermal.h:209:102: error: ISO C++ forbids declaration of 'writeBytes' with no type [-fpermissive]
writeBytes(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f, uint8_t g, uint8_t h);
^
C:\Users\Administrator\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library/Adafruit_Thermal.h:210:30: error: ISO C++ forbids declaration of 'setPrintMode' with no type [-fpermissive]
setPrintMode(uint8_t mask),
^
C:\Users\Administrator\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library/Adafruit_Thermal.h:210:5: error: 'int Adafruit_Thermal::setPrintMode(uint8_t)' cannot be overloaded
setPrintMode(uint8_t mask),
^
hope you are still around, I have tried the attached files as well as bringing in your additions to the new Adafruit libraries, however they seem to have added a few additional lines that now cause the additions to bomb out.
Any chance you would be willing to relook at this?
I have the exact same issue where i need to use the GS v function instead of DC2,
A couple of questions first.
If you delete the Adafruit libraries and use the libraries I supplied does it print graphics okay? I'm trying to work out if the printer has changed and/or just the libraries.
Can you supply links to the printer your using (along with any manuals you can find) and link to the AdaFruit library your talking about just in case it's not the same as the ones I can find.
Initially I just renamed the original files and copied your into the folder, after restarting the IDE it came up with the similar errors.
I then reloaded the library from the Lib manager and checked if it compiled, which it did, I then went through and added the code you highlighted "//Riva Additions" into the newer libraries.
I was on a similar track last night in trying to modify the Libraries but came unstuck on some of the more complex code,
Replacing the .h and .cpp in the library gives me the following errors relating to the SoftwareSerial function:
A_printertest:26: error: no matching function for call to 'Adafruit_Thermal::Adafruit_Thermal(SoftwareSerial*)'
A_printertest.ino:26:35: note: candidates are:
In file included from A_printertest.ino:14:0:
C:\Users\Administrator\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library/Adafruit_Thermal.h:51:3: note: Adafruit_Thermal::Adafruit_Thermal(int, int)
Adafruit_Thermal(int RX_Pin, int TX_Pin);
^
C:\Users\Administrator\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library/Adafruit_Thermal.h:51:3: note: candidate expects 2 arguments, 1 provided
C:\Users\Administrator\Documents\Arduino\libraries\Adafruit_Thermal_Printer_Library/Adafruit_Thermal.h:47:7: note: Adafruit_Thermal::Adafruit_Thermal(const Adafruit_Thermal&)
class Adafruit_Thermal : public Print {
Bobbo:
Update: Fixed it - got to do with the way the IDE has removed the prog_* types
Updated library attached if anyone going forward comes across this thread.
Glad you got it sorted out. Are the libraries the old original ones or the latest AdaFruit ones? I just happened to still have the old AdaFruit libs and they compiled fine for me using IDE 1.0.6 so I guess the problem is the newer IDE's