app/models/extface/driver/daisy_fx1200.rb in extface-0.5.3 vs app/models/extface/driver/daisy_fx1200.rb in extface-0.5.4a

- old
+ new

@@ -173,10 +173,19 @@ s.fsend Sales::CANCEL_DOC s.autocut s.notify "Doc Cancel End" end end + + def autofix_unclosed_doc + if @last_fp_status + unless (@last_fp_status[2].ord & 0x20).zero? and (@last_fp_status[2].ord & 0x08).zero? + fsend Sales::CANCEL_DOC + autocut + end + end + end #other def autocut(partial = true) # return "P" - success, "F" - failed resp = fsend(Printer::CUT) resp == "P" @@ -210,11 +219,13 @@ no_resp = 0 flush # fix mysterious double packet response, #TODO send 2 commands and then read 2 responses may fail push packet_data ACKS_MAX_WAIT.times do |retries| errors.clear + @last_fp_status = nil if resp = frecv(RESPONSE_TIMEOUT) if resp.valid? + @last_fp_status = resp.status human_status_errors(resp.status) if errors.empty? result = resp.data break else \ No newline at end of file