PC .NET c# change from isPaused/isPaperOut to isReadyToPrint

We're using a Zebra ZD410-300dpi ZPL in an embedded application that will load labels separately as needed. I need to restore operations to our printer programmatically. When a particular error occurs, I run this (sequenced from several separate methods in my code);

zebraPrinter.Reset();
while (true)
{
List<DiscoveredUsbPrinter> connectedUsbPrinters
= UsbDiscoverer.GetZebraUsbPrinters(new ZebraPrinterFilter());
if (connectedUsbPrinters.Count == 1)
{
Connection printerConnection = new UsbConnection(connectedUsbPrinters[0].Address);
printerConnection.Open();
string setupCommand = "^XA^MFN,N^JUS^XZ";
zebraPrinter.SendCommand(setupCommand);
break;
}
}

PrinterStatus printerStatus = zebraPrinter.GetCurrentStatus();
if (printerStatus.isReadyToPrint)
{
return SUCCESS;
}

There's more to it in terms of waiting, but that's basically it, and it works for most cases. However, we have a case where I send the setup and string to print using zebraPrinter.SendCommand(print_commands) and no label is in the printer. This is of course an error, and I detect that and do the reset sequence above. But in this case, after reset, I get

printerStatus.isPaused = true
printerStatus.isPaperOut = true

Yes, this is true and reflects what happened, but I didn't expect that to persist after doing the zebraPrinter.Reset() call.

All that for this question: Is there anything I can do before or after a zebraPrinter.Reset() to get back to a printerStatus.isReady state, other than sending a ~JR to do a Power On Reset?

Thanks for reading.
Sal

Robin West
power on behavior

You are likely getting the above errors because the printer is set to try and calculate the label length after reset.  This is default behavior but can be changed to do nothing on reset:

^XA^MFN^XZ^XA^JUS^XZ

You only need to send this command once and it will persist.  

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Sal Quintanilla
RE: power on behavior

Thanks Robin. I should have mentioned that as part of our initial setup, we configure the printer to do nothing in terms of advancing media when we power-in and when the door is opened and closed with

^XA^MFN,N^JUS^XZ

which we got by sniffing the USB port and setting options with the Zebra utility. I changed to the setup string you provided to test it, but it's behaving the same as I described above.

I expressed my question as if it was a new situation, but it's actually a regression test. I believe this used to work, but I have no proof of that now..

(and how do you mark-up your pre-formatted text in here?)

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robin West
More detail please

Thanks Sal, Sorry, didn't fully read the code you had.  I think I need more info.  Are you resetting (soft power cycle) between checking the status again?  Just setitng the ^MF will not clear the error.  Is the printer still out of paper, or is it giving a false reading after reset?  Can you give a little more detail on the steps you use to reproduce?  

(I'm a site moderator so I have access to more options.  I think the plan is to open up some these options to external users soon, but they are going through security review)

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Sal Quintanilla
RE: More detail please

The ^MF is part of a 1-time printer setup string, which I re-ran based on your first reply so it matches.

I'm using the SDK ZebraPrinter.Reset() method… and based on the flags being set after it runs, my guess is that does a soft reset, though soft reset still seems like it should clear states.

The printer is still out of paper after reset, the same as when power-up. But unlike when we power-up, the printer is showing the noPaper and isPaused.

UPDATE: ^XA~JR^XZ is causing a reset, but it's still not clearing things the way I need it to.

UPDATE UPDATE: Or maybe it's not causing a reset. We don't have the front panel anymore so it's hard to tell, but it's coming back a little too fast.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robin West
Try this reset

Hi Sal, 

So I suspect it's not really resetting the printer.  The ~JQ does not really reset, it just turns off ZBI.  I would try sending the soft reset command and see if that works differently than what you have:

String reset = "{}{\"device.reset\":\"now\"}";

It does take a minute or two to come back up though, so I'm still trying to figure out if there is a way to force clear an error without doing this.  

Not going to ask why you removed the front panel... :)

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Sal Quintanilla
RE: Try this reset

Thanks Robin. I'm clearly not doing something right, even with that I don't think the reset is working, and I'm not sure why yet.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Sal Quintanilla
Driver vs. no driver

Robin, we've got several units. Some have the zebra driver installed under Windows 10, and others simply show the installed ZD-410 instance under unspecified devices. We're using the SDK to print our labels by sending PDL directly, and it works under both circumstances (which made me think we're just doing USB communication). Would not using the driver keep the reset sequences we're trying from working? It doesn't seem like it, but I wanted to make sure.

Also on the subject of drivers, we got into a state where the printer wouldn't respond and wouldn't reset. I checked Devices and Printers (Windows 10) and found the Zebra printer driver device instance, and the ZD-410 instance under Unspecified drivers, both present simultaneously with neither saying offline. I checked another one of our machines as well and found the same condition. Does Zebra have any issues like this that there may be a correction for? It makes me think that the phantom device is why reset seems to be getting ignored.

Thanks.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Robin West
maybe...

The SDK gives you two options for PC USB connections - one is labled driver and the other is just USBConnection or something like that.  The USBConnection does not really go through the driver but it does use the HID system to access the USB port.  That may be why you are seeing a generic device created.  It should not interfere, but it sounds like there's something strange going on.  At this point I'm going to recommend contacting Tech Support.  I think they are better able to help with this sort of issue.  I'm guessing you might need to update your drivers or even the printer firmware.  If they can't help, please still feel free to reach back out, but I'm at a loss that this isn't doing what it's supposed to. 

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Log in to post comments