diff --git a/Code/thermal_printer/etc/systemd/system/devterm-printer.service b/Code/thermal_printer/etc/systemd/system/devterm-printer.service index 267a13b..51d544c 100644 --- a/Code/thermal_printer/etc/systemd/system/devterm-printer.service +++ b/Code/thermal_printer/etc/systemd/system/devterm-printer.service @@ -4,6 +4,8 @@ After=devterm-socat [Service] Type=simple +StandardOutput=/tmp/devterm_printer.log +StandardError=/tmp/devterm_printer.err.log ExecStart=/usr/local/bin/devterm_thermal_printer.elf diff --git a/Code/thermal_printer/printer.c b/Code/thermal_printer/printer.c index d3ebf00..3cc48d3 100644 --- a/Code/thermal_printer/printer.c +++ b/Code/thermal_printer/printer.c @@ -60,7 +60,7 @@ uint8_t IsPaper() if(ASK4PAPER==LOW) // * LOW is what we want** {status = IS_PAPER;} else - {status = NO_PAPER;printf("Error:NO PAPER\n");} + {status = NO_PAPER; PRINTF("Error:NO PAPER\n"); } DISABLE_PEM; }else { status = printer_vps_last_status; @@ -69,7 +69,7 @@ uint8_t IsPaper() tmp = temperature(); if (tmp >= HOT){ - printf("Printer too Hot\n"); + PRINTF("Printer too Hot\n"); status |= HOT_PRINTER; } @@ -113,7 +113,7 @@ uint8_t header_init() { SPI.begin(); //Initialize the SPI_1 port. */ if (!wiringPiSPISetup (0, 4500000 )) { - printf("SPI init failed,exiting...\n"); + PRINTF("SPI init failed,exiting...\n"); } /* diff --git a/Code/thermal_printer/utils.h b/Code/thermal_printer/utils.h index 27e21be..605b11c 100644 --- a/Code/thermal_printer/utils.h +++ b/Code/thermal_printer/utils.h @@ -13,6 +13,8 @@ #define ALINE printf("\n"); +#define PRINTF(...) { printf(__VA_ARGS__);fflush(stdout);} + void delayus(unsigned int _us); uint8_t invert_bit(uint8_t a);