Skip to content

Commit

Permalink
Merge pull request #632 from robjustice/master
Browse files Browse the repository at this point in the history
printer updates for A2/A3 for SP buffering
  • Loading branch information
tschak909 authored Jul 17, 2023
2 parents 61f6ef4 + cb1ac8b commit ba5c803
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/device/iwm/printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "html_printer.h"
#include "epson_80.h"
#include "fnSystem.h"
#include "../../hardware/led.h"

constexpr const char *const iwmPrinter::printer_model_str[PRINTER_INVALID];

Expand Down Expand Up @@ -181,6 +182,7 @@ void iwmPrinter::print_from_cpm(uint8_t c)

void iwmPrinter::process(iwm_decoded_cmd_t cmd)
{
fnLedManager.set(LED_BUS, true);
switch (cmd.command)
{
case 0x00: // status
Expand All @@ -200,6 +202,7 @@ void iwmPrinter::process(iwm_decoded_cmd_t cmd)
iwm_return_badcmd(cmd);
break;
}
fnLedManager.set(LED_BUS, false);
}

void iwmPrinter::set_printer_type(iwmPrinter::printer_type printer_type)
Expand Down
8 changes: 6 additions & 2 deletions lib/printer-emulator/epson_80.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,11 @@ void epson80::pdf_clear_modes()
void epson80::at_reset()
{
leftMargin = 18.0;
#ifndef BUILD_APPLE
bottomMargin = 0;
#else
bottomMargin = 13; // line height + 1
#endif /* APPLE2 */
printWidth = 576.0; // 8 inches
lineHeight = 12.0;
charWidth = 7.2;
Expand All @@ -616,10 +620,10 @@ void epson80::post_new_file()

pageWidth = 612.0;
pageHeight = 792.0;
#ifndef BUILD_APPLE2
#ifndef BUILD_APPLE
topMargin = 16.0;
#else
topMargin = -1.5;
topMargin = 12;
#endif /* APPLE2 */
// leftMargin = 18.0;
// bottomMargin = 0;
Expand Down
16 changes: 16 additions & 0 deletions lib/printer-emulator/pdf_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,21 @@ bool pdfPrinter::process_buffer(uint8_t n, uint8_t aux1, uint8_t aux2)
// textMode is set inside of pdf_handle_char at first character, so...
// need to test for textMode inside the loop

#ifndef BUILD_APPLE
if (TOPflag)
pdf_new_page();
#endif // BUILD_APPLE

// loop through string
do
{

//
#ifdef BUILD_APPLE // move this inside the loop incase the buffer has more than one line (SP packet buffering)
if (TOPflag)
pdf_new_page();
#endif // BUILD_APPLE

c = buffer[i++];
#ifdef BUILD_APPLE
if (textMode == true)
Expand Down Expand Up @@ -409,12 +418,19 @@ bool pdfPrinter::process_buffer(uint8_t n, uint8_t aux1, uint8_t aux2)
// Debug_printf("\r\n");
#endif
}
#ifdef BUILD_APPLE // move this inside the loop incase the buffer has more than one line (SP packet buffering)
// if wrote last line, then close the page
if (pdf_Y < bottomMargin) // lineHeight + bottomMargin
pdf_end_page();
#endif // BUILD_APPLE

} while (i < n && (cc != ATASCII_EOL));

#ifndef BUILD_APPLE
// if wrote last line, then close the page
if (pdf_Y < bottomMargin) // lineHeight + bottomMargin
pdf_end_page();
#endif // BUILD_APPLE

return true;
}
Expand Down

0 comments on commit ba5c803

Please sign in to comment.