Skip to content

Commit

Permalink
add a feature to show text hidden by printing mechanism
Browse files Browse the repository at this point in the history
After 500ms of printing inactivity, roll platen up N lines (currently 8)
to show state to user. Before printing again, roll platen back down N+1,
then up one to return to the current location for new printing.  This
enhances the experience for the user, as they can see what they just typed
or what the computer just typed back at them.

Signed-off-by: Russell Senior <russell@personaltelco.net>
  • Loading branch information
RussellSenior committed May 18, 2019
1 parent 7761a23 commit 24bb50e
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@ does RTS/CTS hardware flow control, so the Teensy program looks for XON/XOFF fro
and stops reading from the computer serial port when it last saw XOFF, which lets the hardware
UART's flow control to just work.

One of the disadvantages of the LQP02 is that it was intended as a strictly output device, and
as a result being able to see what you are typing is not prioritized. I saw a video on youtube
(https://www.youtube.com/watch?v=TRxz4x45i54) which used the vertical motion control to roll
the platen to lift the active printing line up above the printing mechanism at appropriate
moments so that you can see what you have typed. On the LQP02, 8 lines seems about right.
When rolling the paper back down to continue printing, I am rolling an extra line down and then
back up one to hopefully improve vertical registration. Thanks Blake Thomas for the idea.

There are a bunch of TODO's:

* Fix the terminal thinking there are only 24 lines per page and sending a form feed;
* Look into using platen motion to show what's just been printed (Wheelwriter is better at this);
* Add a toggle switch to switch between Line and Local mode;
* Support the mini-DIN8 connected Sun Keyboard;
* Support output to an IBM Wheelwriter;
34 changes: 34 additions & 0 deletions lqp02-teletype.ino
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,29 @@ static const int clockPin = 4;
static const int dataPin = 5;
bool debug = 0;
bool local = 0;
bool rolledUp = 0;
int linesToRoll = 8;

int rollUpToShow() {
if(!rolledUp) {
for (int i=0 ; i<linesToRoll ; i++) {
Printer.printf("%cD",ESCAPE);
}
rolledUp = 1;
}
return 0;
}

int rollDownToPrint() {
if(rolledUp) {
for (int i=0 ; i<(linesToRoll+1) ; i++) {
Printer.printf("%cM",ESCAPE);
}
Printer.printf("%cD",ESCAPE);
rolledUp = 0;
}
return 0;
}

int sendEscapeSequence(int f) {
Serial.printf("sending escape sequence %d\n",f);
Expand Down Expand Up @@ -149,15 +172,26 @@ void setup() {
static ps2::NeutralTranslator translator;
bool pxon = 1;

bool timedBefore = 0;
unsigned long lastPrint = 0;

void loop() {
// diagnostics.setLedIndicator<LED_BUILTIN, ps2::DiagnosticsLedBlink::heartbeat>();
int fromComputer;
int fromPrinter;
unsigned long sinceLastPrint = millis() - lastPrint;

if (timedBefore && sinceLastPrint > 500) {
rollUpToShow();
}

if (Computer.available() > 0 && pxon) {
fromComputer = Computer.read();
if (!local) {
rollDownToPrint();
Printer.write(fromComputer);
lastPrint = millis();
timedBefore = 1;
}
if (debug) {
Serial.printf("computer: 0x%02x %c",fromComputer,fromComputer);
Expand Down

0 comments on commit 24bb50e

Please sign in to comment.