3232#endif
3333#endif
3434
35- #ifdef ARDUINO_ARDUINO_NANO33BLE
35+ #if defined ( ARDUINO_ARDUINO_NANO33BLE ) || defined( ARDUINO_UNOR4_WIFI )
3636#include < ArduinoBLE.h>
3737#endif
3838
@@ -46,8 +46,7 @@ static char szPrinterName[32];
4646volatile uint8_t ucPrinterType; // one of PRINTER_MTP2, PRINTER_CAT, etc
4747static int bb_width, bb_height; // back buffer width and height in pixels
4848static int tp_wrap, bb_pitch;
49- static int iCursorX = 0 ;
50- static int iCursorY = 0 ;
49+ static int16_t iCursorX = 0 , iCursorY = 0 ;
5150static uint8_t bWithResponse = 0 ; // default to not wait for a response
5251static uint8_t *pBackBuffer = NULL ;
5352static uint8_t bConnected = 0 ;
@@ -66,7 +65,8 @@ struct PRINTERID
6665 uint8_t ucBLEType;
6766} ;
6867// Names and types of supported printers
69- const PRINTERID szPrinterIDs[] = {
68+ const PRINTERID szPrinterIDs[] PROGMEM = {
69+ {(char *)" MP210" , PRINTER_MTP2},
7070 {(char *)" PT-210" , PRINTER_MTP2},
7171 {(char *)" MTP-2" , PRINTER_MTP2},
7272 {(char *)" MPT-II" , PRINTER_MTP2},
@@ -120,7 +120,7 @@ uint8_t CatStrLen = 0;
120120char CatStr[48 ]; // max 48 characters * 8 pixels
121121
122122// CRC8 pre calculated values
123- const uint8_t cChecksumTable[] = {
123+ const uint8_t cChecksumTable[] PROGMEM = {
124124 0x00 , 0x07 , 0x0e , 0x09 , 0x1c , 0x1b , 0x12 , 0x15 , 0x38 , 0x3f , 0x36 , 0x31 , 0x24 , 0x23 , 0x2a , 0x2d ,
125125 0x70 , 0x77 , 0x7e , 0x79 , 0x6c , 0x6b , 0x62 , 0x65 , 0x48 , 0x4f , 0x46 , 0x41 , 0x54 , 0x53 , 0x5a , 0x5d ,
126126 0xe0 , 0xe7 , 0xee , 0xe9 , 0xfc , 0xfb , 0xf2 , 0xf5 , 0xd8 , 0xdf , 0xd6 , 0xd1 , 0xc4 , 0xc3 , 0xca , 0xcd ,
@@ -139,7 +139,7 @@ const uint8_t cChecksumTable[] = {
139139 0xde , 0xd9 , 0xd0 , 0xd7 , 0xc2 , 0xc5 , 0xcc , 0xcb , 0xe6 , 0xe1 , 0xe8 , 0xef , 0xfa , 0xfd , 0xf4 , 0xf3 };
140140
141141/* Table of byte flip values to mirror-image incoming CCITT data */
142- const unsigned char ucMirror[256 ]=
142+ const unsigned char ucMirror[256 ] PROGMEM =
143143 {0x00 , 0x80 , 0x40 , 0xC0 , 0x20 , 0xA0 , 0x60 , 0xE0 , 0x10 , 0x90 , 0x50 , 0xD0 , 0x30 , 0xB0 , 0x70 , 0xF0 ,
144144 0x08 , 0x88 , 0x48 , 0xC8 , 0x28 , 0xA8 , 0x68 , 0xE8 , 0x18 , 0x98 , 0x58 , 0xD8 , 0x38 , 0xB8 , 0x78 , 0xF8 ,
145145 0x04 , 0x84 , 0x44 , 0xC4 , 0x24 , 0xA4 , 0x64 , 0xE4 , 0x14 , 0x94 , 0x54 , 0xD4 , 0x34 , 0xB4 , 0x74 , 0xF4 ,
@@ -319,7 +319,7 @@ static BLEClient* pClient;
319319static char Scanned_BLE_Name[32 ];
320320#endif
321321
322- #ifdef ARDUINO_ARDUINO_NANO33BLE
322+ #ifdef _ARDUINO_BLE_H_
323323static BLEDevice peripheral;
324324static BLEService prtService;
325325static BLECharacteristic pRemoteCharacteristicData;
@@ -866,7 +866,7 @@ int tpConnect(const char *szMacAddress)
866866 }
867867 return 0 ;
868868#endif
869- #ifdef ARDUINO_ARDUINO_NANO33BLE // Arduino BLE
869+ #ifdef _ARDUINO_BLE_H_ // Arduino BLE
870870 if (!peripheral)
871871 {
872872#ifdef DEBUG_OUTPUT
@@ -951,7 +951,7 @@ void tpDisconnect(void)
951951 bConnected = 0 ;
952952 }
953953#endif
954- #ifdef ARDUINO_ARDUINO_NANO33BLE
954+ #ifdef _ARDUINO_BLE_H_
955955 if (peripheral)
956956 {
957957 if (peripheral.connected ())
@@ -1053,7 +1053,7 @@ int iLen = strlen(szName);
10531053 }
10541054 }
10551055#endif
1056- #ifdef ARDUINO_ARDUINO_NANO33BLE // Arduino API
1056+ #ifdef _ARDUINO_BLE_H_ // Arduino API
10571057 // initialize the BLE hardware
10581058 BLE.begin ();
10591059 // start scanning for the printer service UUID
@@ -1190,7 +1190,7 @@ static void tpWriteData(uint8_t *pData, int iLen)
11901190 pRemoteCharacteristicData->writeValue (pData, iLen, bWithResponse);
11911191 }
11921192#endif
1193- #ifdef ARDUINO_ARDUINO_NANO33BLE
1193+ #ifdef _ARDUINO_BLE_H_
11941194 pRemoteCharacteristicData.writeValue (pData, iLen, bWithResponse);
11951195#endif
11961196#ifdef ARDUINO_NRF52_ADAFRUIT
0 commit comments