Epson L4150 L4160 L4170 Resetter Adjustment Program Here

def reset_pad_counter(self): """Reset waste ink pad counter""" if not self.connected: messagebox.showwarning("Warning", "Printer not connected") return if not messagebox.askyesno("Confirm Reset", "WARNING: Resetting the waste ink counter without replacing the\n" "waste ink pads may cause ink leakage and printer damage.\n\n" "Have you replaced the waste ink pads?\n\n" "Proceed with reset?"): return def reset(): self.progress.start() try: # Send reset command response = self.send_command(self.CMD_RESET_COUNTER, 16) if response: self.log_message("Pad counter reset command sent successfully") time.sleep(1) self.get_counters() # Refresh counters messagebox.showinfo("Success", "Waste ink pad counter has been reset!") else: raise Exception("No response from printer") except Exception as e: self.log_message(f"Reset failed: {str(e)}") messagebox.showerror("Error", f"Reset failed: {str(e)}") finally: self.progress.stop() threading.Thread(target=reset, daemon=True).start()

root.mainloop() if == " main ": main()

# Help menu help_menu = tk.Menu(menubar, tearoff=0) menubar.add_cascade(label="Help", menu=help_menu) help_menu.add_command(label="Instructions", command=lambda: messagebox.showinfo("Instructions", "1. Connect printer via USB\n" "2. Select COM port and baud rate (9600)\n" "3. Click Connect\n" "4. Check current waste ink counter values\n" "5. Replace waste ink pads if necessary\n" "6. Click 'Reset Waste Ink Pad Counter'\n" "7. Verify counters are reset to 0\n\n" "Supported models: Epson L4150, L4160, L4170")) help_menu.add_command(label="About", command=lambda: messagebox.showinfo("About", "Epson Resetter Adjustment Program v2.0\n\n" "For Epson L4150/L4160/L4170 printers\n\n" "Use at your own risk. Always replace waste ink pads before resetting.")) Epson L4150 L4160 L4170 Resetter Adjustment Program

# Add menu bar menubar = tk.Menu(root) root.config(menu=menubar)

# Command codes for Epson protocol CMD_RESET_COUNTER = b'\x1B\x40\x1B\x52\x00\x00\x00\x00' CMD_GET_COUNTER = b'\x1B\x40\x1B\x52\x01\x00\x00\x00' CMD_INITIALIZE = b'\x1B\x40' CMD_STATUS = b'\x1B\x40\x1B\x52\x02\x00\x00\x00' Click Connect\n" "4

def __init__(self, parent): self.parent = parent self.serial_port = None self.current_model = None self.connected = False self.setup_ui() def setup_ui(self): """Setup the main user interface""" self.parent.title("Epson Resetter Adjustment Program v2.0") self.parent.geometry("800x600") self.parent.resizable(True, True) # Set style style = ttk.Style() style.theme_use('clam') # Main container main_frame = ttk.Frame(self.parent, padding="10") main_frame.grid(row=0, column=0, sticky=(tk.W, tk.E, tk.N, tk.S)) # Connection Frame conn_frame = ttk.LabelFrame(main_frame, text="Printer Connection", padding="10") conn_frame.grid(row=0, column=0, columnspan=2, sticky=(tk.W, tk.E), pady=5) ttk.Label(conn_frame, text="COM Port:").grid(row=0, column=0, sticky=tk.W) self.port_combo = ttk.Combobox(conn_frame, values=self.get_serial_ports(), width=15) self.port_combo.grid(row=0, column=1, padx=5) ttk.Label(conn_frame, text="Baud Rate:").grid(row=0, column=2, sticky=tk.W, padx=(20,0)) self.baud_combo = ttk.Combobox(conn_frame, values=[9600, 19200, 38400, 115200], width=10) self.baud_combo.set(9600) self.baud_combo.grid(row=0, column=3, padx=5) self.connect_btn = ttk.Button(conn_frame, text="Connect", command=self.connect_printer) self.connect_btn.grid(row=0, column=4, padx=10) self.disconnect_btn = ttk.Button(conn_frame, text="Disconnect", command=self.disconnect_printer, state=tk.DISABLED) self.disconnect_btn.grid(row=0, column=5) # Status indicator self.status_label = ttk.Label(conn_frame, text="● Disconnected", foreground="red") self.status_label.grid(row=0, column=6, padx=(20,0)) # Printer Info Frame info_frame = ttk.LabelFrame(main_frame, text="Printer Information", padding="10") info_frame.grid(row=1, column=0, columnspan=2, sticky=(tk.W, tk.E), pady=5) ttk.Label(info_frame, text="Model:").grid(row=0, column=0, sticky=tk.W) self.model_var = tk.StringVar() ttk.Label(info_frame, textvariable=self.model_var, font=("Arial", 10, "bold")).grid(row=0, column=1, sticky=tk.W) ttk.Label(info_frame, text="Firmware:").grid(row=0, column=2, sticky=tk.W, padx=(20,0)) self.firmware_var = tk.StringVar() ttk.Label(info_frame, textvariable=self.firmware_var).grid(row=0, column=3, sticky=tk.W) ttk.Label(info_frame, text="Serial:").grid(row=1, column=0, sticky=tk.W) self.serial_var = tk.StringVar() ttk.Label(info_frame, textvariable=self.serial_var).grid(row=1, column=1, sticky=tk.W) # Counter Display Frame counter_frame = ttk.LabelFrame(main_frame, text="Waste Ink Counters", padding="10") counter_frame.grid(row=2, column=0, columnspan=2, sticky=(tk.W, tk.E, tk.N, tk.S), pady=5) # Create treeview for counters columns = ('Counter', 'Current Value', 'Maximum', 'Percentage') self.counter_tree = ttk.Treeview(counter_frame, columns=columns, show='headings', height=5) for col in columns: self.counter_tree.heading(col, text=col) self.counter_tree.column(col, width=150) scrollbar = ttk.Scrollbar(counter_frame, orient=tk.VERTICAL, command=self.counter_tree.yview) self.counter_tree.configure(yscrollcommand=scrollbar.set) self.counter_tree.grid(row=0, column=0, sticky=(tk.W, tk.E, tk.N, tk.S)) scrollbar.grid(row=0, column=1, sticky=(tk.N, tk.S)) ttk.Button(counter_frame, text="Refresh Counters", command=self.get_counters).grid(row=1, column=0, pady=10) # Reset Actions Frame reset_frame = ttk.LabelFrame(main_frame, text="Reset Operations", padding="10") reset_frame.grid(row=3, column=0, columnspan=2, sticky=(tk.W, tk.E), pady=5) # Reset buttons self.reset_pad_btn = ttk.Button(reset_frame, text="Reset Waste Ink Pad Counter", command=self.reset_pad_counter, state=tk.DISABLED, style="Danger.TButton") self.reset_pad_btn.grid(row=0, column=0, padx=5, pady=5) self.reset_all_btn = ttk.Button(reset_frame, text="Reset All Counters", command=self.reset_all_counters, state=tk.DISABLED) self.reset_all_btn.grid(row=0, column=1, padx=5, pady=5) # Progress bar self.progress = ttk.Progressbar(main_frame, mode='indeterminate') self.progress.grid(row=4, column=0, columnspan=2, sticky=(tk.W, tk.E), pady=10) # Log Frame log_frame = ttk.LabelFrame(main_frame, text="Operation Log", padding="10") log_frame.grid(row=5, column=0, columnspan=2, sticky=(tk.W, tk.E, tk.N, tk.S), pady=5) self.log_text = tk.Text(log_frame, height=10, wrap=tk.WORD) scroll_log = ttk.Scrollbar(log_frame, orient=tk.VERTICAL, command=self.log_text.yview) self.log_text.configure(yscrollcommand=scroll_log.set) self.log_text.grid(row=0, column=0, sticky=(tk.W, tk.E, tk.N, tk.S)) scroll_log.grid(row=0, column=1, sticky=(tk.N, tk.S)) # Configure grid weights self.parent.columnconfigure(0, weight=1) self.parent.rowconfigure(0, weight=1) main_frame.columnconfigure(0, weight=1) main_frame.rowconfigure(2, weight=1) main_frame.rowconfigure(5, weight=1) counter_frame.columnconfigure(0, weight=1) counter_frame.rowconfigure(0, weight=1) log_frame.columnconfigure(0, weight=1) log_frame.rowconfigure(0, weight=1) # Create custom styles style.configure("Danger.TButton", foreground="red") def get_serial_ports(self): """Get list of available serial ports""" ports = serial.tools.list_ports.comports() return [port.device for port in ports]

def reset_all_counters(self): """Reset all counters (full initialization)""" if not self.connected: messagebox.showwarning("Warning", "Printer not connected") return if messagebox.askyesno("Confirm Full Reset", "This will reset ALL printer counters including:\n" "- Waste ink counters\n" "- Paper feed counters\n" "- Maintenance counters\n\n" "Are you sure you want to proceed?"): def full_reset(): self.progress.start() try: # Send initialization sequence self.send_command(b'\x1B\x40\x1B\x52\xFF\xFF\xFF\xFF') time.sleep(0.5) self.send_command(self.CMD_INITIALIZE) time.sleep(1) self.log_message("Full reset completed") self.get_counters() messagebox.showinfo("Success", "All counters have been reset!") except Exception as e: self.log_message(f"Full reset failed: {str(e)}") messagebox.showerror("Error", f"Reset failed: {str(e)}") finally: self.progress.stop() threading.Thread(target=full_reset, daemon=True).start() Click 'Reset Waste Ink Pad Counter'\n" "7

def send_command(self, command, response_length=0): """Send command to printer and return response""" if not self.serial_port or not self.serial_port.is_open: raise Exception("Printer not connected") self.serial_port.write(command) self.serial_port.flush() if response_length > 0: time.sleep(0.2) response = self.serial_port.read(response_length) return response return None