cleanup
All checks were successful
Build ptprnt / build (push) Successful in 3m25s

This commit is contained in:
2025-10-11 18:37:27 +02:00
parent 8658e5c9fd
commit bf7ff27b8d
4 changed files with 14 additions and 30 deletions

View File

@@ -21,6 +21,7 @@
#include <spdlog/spdlog.h>
#include <cassert>
#include <cstdint>
#include <iterator>
#include <memory>
@@ -32,9 +33,6 @@
#include "../libusbwrap/LibUsbTypes.hpp"
#include "spdlog/fmt/bin_to_hex.h"
// as long as DRYRUN is defined, no data is actually send to the printer, we need to save some tape ;)
#define DRYRUN
namespace ptprnt::printer {
const PrinterInfo P700Printer::mInfo = {.driverName = "P700",
@@ -129,9 +127,6 @@ bool P700Printer::printBitmap(const graphics::Bitmap<graphics::ALPHA8>& bitmap)
}
bool P700Printer::printMonochromeData(const graphics::MonochromeData& data) {
#ifdef DRYRUN
spdlog::debug("DRYRUN enabled, printing nothing");
#endif
send(p700::commands::RASTER_START);
std::vector<uint8_t> rastercmd(4);
@@ -184,7 +179,6 @@ bool P700Printer::printLabel(std::unique_ptr<graphics::ILabel> label) {
monoData.transformTo(graphics::Orientation::PORTRAIT);
spdlog::debug("Label surface is {}x{}, transformed to portrait", label->getWidth(), label->getHeight());
monoData.visualize();
return printMonochromeData(monoData);
}
@@ -203,19 +197,15 @@ bool P700Printer::send(const std::vector<uint8_t>& data) {
return false;
}
size_t tx = 0;
int tx = 0;
#ifndef DRYRUN
if (!mUsbHndl->bulkTransfer(0x02, data, &tx, 0)) {
spdlog::error("Error writing command to Printer: {}", mUsbHndl->getLastErrorString());
return false;
}
#else
tx = data.size();
spdlog::trace("USB raw data(len {}): {}", data.size(), spdlog::to_hex(data));
#endif
if (tx != data.size()) {
assert(tx > 0);
if (static_cast<std::uint32_t>(tx) != data.size()) {
spdlog::error("Could not transfer all data via USB bulk transfer. Only sent {} of {} bytes", tx, data.size());
return false;
}