Print: improve printing receipt:
- call prn_cut() 200ms after prn_switchPower(true) - make an "emergency cut" on error - improve log output on error
This commit is contained in:
		@@ -806,7 +806,7 @@ void ATBDeviceControllerPlugin::requestPrintReceipt(const QString & printingStri
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    this->printResultCheckCounter = 0;
 | 
			
		||||
    QTimer::singleShot(4000, this, SLOT(onPrinterWaitForPrintingReceipt()));
 | 
			
		||||
    QTimer::singleShot(2000, this, SLOT(onPrinterWaitForPrintingReceipt()));
 | 
			
		||||
 | 
			
		||||
    //QTimer::singleShot(2000, this, [this](){ hw->prn_cut(3);  } );
 | 
			
		||||
}
 | 
			
		||||
@@ -827,7 +827,7 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
 | 
			
		||||
                                        "",
 | 
			
		||||
                                        "");
 | 
			
		||||
        hw->prn_switchPower(true);
 | 
			
		||||
        hw->prn_cut(3);
 | 
			
		||||
        QTimer::singleShot(200, this, [this](){ hw->prn_cut(3);  } );
 | 
			
		||||
        break;
 | 
			
		||||
    case 2:    // printing finished, Error
 | 
			
		||||
        qCritical() << "DC Error: wait for printing receipt";
 | 
			
		||||
@@ -837,15 +837,21 @@ void ATBDeviceControllerPlugin::onPrinterWaitForPrintingReceipt()
 | 
			
		||||
        emit this->printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
 | 
			
		||||
                                       this->errorCode,
 | 
			
		||||
                                       this->errorDescription);
 | 
			
		||||
        hw->prn_switchPower(true);
 | 
			
		||||
        QTimer::singleShot(200, this, [this](){ hw->prn_cut(3);  } );
 | 
			
		||||
        break;
 | 
			
		||||
    default:
 | 
			
		||||
        qCritical() << "DC Error: wait for printing receipt";
 | 
			
		||||
        qCritical() << "DC Error: wait for printing receipt: printerResult = " << printerResult;
 | 
			
		||||
        this->errorCode = "PRINTER";               // TODO: get more detailed error code from low level API
 | 
			
		||||
        this->errorDescription = "Printer error";  // TODO: get more detailed error description from low level API
 | 
			
		||||
        this->errorDescription = "Printer error(" + QString(printerResult) + ")";
 | 
			
		||||
 | 
			
		||||
        emit this->printReceiptFinished(nsDeviceControllerInterface::RESULT_STATE::ERROR_BACKEND,
 | 
			
		||||
                                       this->errorCode,
 | 
			
		||||
                                       this->errorDescription);
 | 
			
		||||
        // do an emergency cut
 | 
			
		||||
        hw->prn_switchPower(true);
 | 
			
		||||
        QTimer::singleShot(200, this, [this](){ hw->prn_cut(3);  } );
 | 
			
		||||
 | 
			
		||||
        break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user