diff --git a/README.md b/README.md index b6d26d2..182e0fc 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,12 @@ A range of features are offered for both end-users and developers, making it eas start with `@BDC [SP] ST2 [CR] [LF]` ...). It is used to convey various aspects of the status of the printer, such as errors, paper status, ink and more. The element fields of this format may vary depending on the printer model. The *Epson Printer Configuration Tool* can decode all element fields found in publicly available Epson Programming Manuals of various printer models (a relevant subset of fields used by the Epson printers). - __Advanced Maintenance Functions__: + - Open the Web interface of the printer (via the default browser). - Reset the ink waste counter. The ink waste counters track the amount of ink discarded during maintenance tasks to prevent overflow in the waste ink pads. Once the counters indicate that one of the printer pads is full, the printer will stop working to avoid potential damage or ink spills. Resetting the ink waste counter extends the printer operation while a pad maintenance or tank replacement is programmed. - Adjust the power-off timer for more accurate energy efficiency. + - Change the printer WiFi MAC address and the printer serial number (typically used in specialized scenarios where specific device identifiers are required). - Access various administrative and debugging options. - Read and write to EEPROM addresses for advanced configurations. - Dump and analyze sets of EEPROM addresses. @@ -42,9 +44,10 @@ The GUI can automatically find and display printer IP addresses and model names, - Read and write the EEPROM - Detect the access key (*read_key* and *write_key*) - Reset the ink waste counter -- Special features allow showing the internal configuration settings - The *First TI Received Time* in Epson printers typically refers to the timestamp of the first transmission instruction to the printer when it was first set up. This feature tracks when the printer first operated. +Special features allow showing the internal configuration settings. + +The *First TI Received Time* in Epson printers typically refers to the timestamp of the first transmission instruction to the printer when it was first set up. This feature tracks when the printer first operated. The software provides a configurable printer dictionary, which can be easily extended. In addition, a tool allows importing and converting an extensive Epson printer configuration DB. diff --git a/epson_print_conf.py b/epson_print_conf.py index 1a3708b..588f836 100644 --- a/epson_print_conf.py +++ b/epson_print_conf.py @@ -76,6 +76,8 @@ class EpsonPrinter: "main_waste": {"oids": [24, 25, 30], "divider": 73.5}, "borderless_waste": {"oids": [26, 27, 34], "divider": 34.34}, "wifi_mac_address": range(130, 136), + "brand_name": range(868, 932), + "model_name": range(934, 998), "same-as": "XP-315" }, "ET-4700": { @@ -1730,6 +1732,34 @@ def get_serial_number(self) -> str: self.parm["serial_number"], label="serial_number") ) + def get_printer_brand(self) -> str: + """Return the producer name of the printer ("EPSON").""" + if not self.parm: + logging.error("EpsonPrinter - invalid API usage") + return None + if "brand_name" not in self.parm: + return None + return ''.join( + [chr(int(i or "0x3f", 16)) + for i in self.read_eeprom_many( + self.parm["brand_name"], label="get_brand_name" + ) if i != '00'] + ) + + def get_printer_model(self) -> str: + """Return the model name of the printer.""" + if not self.parm: + logging.error("EpsonPrinter - invalid API usage") + return None + if "model_name" not in self.parm: + return None + return ''.join( + [chr(int(i or "0x3f", 16)) + for i in self.read_eeprom_many( + self.parm["model_name"], label="get_model_name" + ) if i != '00'] + ) + def get_wifi_mac_address(self) -> str: """Return the WiFi MAC address of the printer.""" if not self.parm: @@ -1773,11 +1803,14 @@ def get_stats(self, stat_name: str = None) -> str: if "First TI received time" not in stats_result: return stats_result ftrt = stats_result["First TI received time"] - year = 2000 + ftrt // (16 * 32) - month = (ftrt - (year - 2000) * (16 * 32)) // 32 - day = ftrt - (year - 2000) * 16 * 32 - 32 * month - stats_result["First TI received time"] = datetime.datetime( - year, month, day).strftime('%d %b %Y') + try: + year = 2000 + ftrt // (16 * 32) + month = (ftrt - (year - 2000) * (16 * 32)) // 32 + day = ftrt - (year - 2000) * 16 * 32 - 32 * month + stats_result["First TI received time"] = datetime.datetime( + year, month, day).strftime('%d %b %Y') + except Exception: + stats_result["First TI received time"] = "?" return stats_result def get_printer_head_id(self) -> str: # only partially correct diff --git a/ui.py b/ui.py index 10f3007..db3becf 100644 --- a/ui.py +++ b/ui.py @@ -2199,7 +2199,7 @@ def detect_sequence(eeprom, sequence): result = detect_sequence(eeprom, epson_name) c = 0 for i in result: - conf_data["epson_name[%s]" % c] = range(i, i + 64) + conf_data["brand_name[%s]" % c] = range(i, i + 64) c += 1 if "Model" in stats["snmp_info"] and stats["snmp_info"]["Model"]: @@ -2277,6 +2277,10 @@ def detect_sequence(eeprom, sequence): except Exception as e: self.handle_printer_error(e) finally: + self.status_text.insert( + tk.END, + f"[INFO] Operation completed.\n" + ) self.update_idletasks() self.config(cursor="") self.update_idletasks()