add PRINTF, StandardOutput for debugging

This commit is contained in:
cuu 2021-05-13 16:50:01 +08:00
parent 3fb2310548
commit fb12b78724
3 changed files with 7 additions and 3 deletions

View File

@ -4,6 +4,8 @@ After=devterm-socat
[Service] [Service]
Type=simple Type=simple
StandardOutput=/tmp/devterm_printer.log
StandardError=/tmp/devterm_printer.err.log
ExecStart=/usr/local/bin/devterm_thermal_printer.elf ExecStart=/usr/local/bin/devterm_thermal_printer.elf

View File

@ -60,7 +60,7 @@ uint8_t IsPaper()
if(ASK4PAPER==LOW) // * LOW is what we want** if(ASK4PAPER==LOW) // * LOW is what we want**
{status = IS_PAPER;} {status = IS_PAPER;}
else else
{status = NO_PAPER;printf("Error:NO PAPER\n");} {status = NO_PAPER; PRINTF("Error:NO PAPER\n"); }
DISABLE_PEM; DISABLE_PEM;
}else { }else {
status = printer_vps_last_status; status = printer_vps_last_status;
@ -69,7 +69,7 @@ uint8_t IsPaper()
tmp = temperature(); tmp = temperature();
if (tmp >= HOT){ if (tmp >= HOT){
printf("Printer too Hot\n"); PRINTF("Printer too Hot\n");
status |= HOT_PRINTER; status |= HOT_PRINTER;
} }
@ -113,7 +113,7 @@ uint8_t header_init() {
SPI.begin(); //Initialize the SPI_1 port. SPI.begin(); //Initialize the SPI_1 port.
*/ */
if (!wiringPiSPISetup (0, 4500000 )) { if (!wiringPiSPISetup (0, 4500000 )) {
printf("SPI init failed,exiting...\n"); PRINTF("SPI init failed,exiting...\n");
} }
/* /*

View File

@ -13,6 +13,8 @@
#define ALINE printf("\n"); #define ALINE printf("\n");
#define PRINTF(...) { printf(__VA_ARGS__);fflush(stdout);}
void delayus(unsigned int _us); void delayus(unsigned int _us);
uint8_t invert_bit(uint8_t a); uint8_t invert_bit(uint8_t a);