Zedeldi / epson-printer-snmp

Read information and reset waste ink counters on Epson printers, using SNMP.
GNU General Public License v3.0
23 stars 7 forks source link

Can you explain what is solved #6

Open schellingerhout opened 4 months ago

schellingerhout commented 4 months ago

Can you explain what exactly is solved and why:

Values for waste ink levels are stored across multiple addresses, which, when reversed, combine to make a value in hex. This value is then divided by a constant, which again seems to vary across models of printer, to make the percentage. The constant value can be found by using wicreset to read the counters' percentage, getting the hex values of these OIDs, then following the above process to solve: e.g.

# Percentage is 80%.
# Hex values are (0x68, 0x3d) => 0x3d68

(0x3d68 / 80) * 100 = 19650.0

I originally used https://github.com/gentu/reink-net/ with some modifcations (https://github.com/gentu/reink-net/issues/1) and found that the values get reset after the printer restarts.

I finally just ran wicreset and reset with the trial code and also cleared the errors wic-application.log

I see 79.99% and 80%

From the log 18C216 and 266316 6,338/79.99 = 79.234904363045380672584073009126 9827/80 = 122.8375;

Only later that I saw that you said to not write first but read first... anyway here is the read only (done after the fact) wic-application-read.log

I see 80.97% and 80%, maybe due to a printer purge cycle?

The ruby app gets these value. There is a bug in the multibyte read getting 19F16 is 415 instead of 190F16 which is 6415

5% Waste ink counter 1. Value: 415 // should have been 6415 = 190F16 80% Waste ink counter 2. Value: 9827 = 266316

  def waste_ink_levels
    val1 = read_eeprom_multibyte(@printer[:waste_ink1])
    puts "%i%%\tWaste ink counter 1. Value: %i" % [(val1/81.92).round, val1]

    val2 = read_eeprom_multibyte(@printer[:waste_ink2])
    puts "%i%%\tWaste ink counter 2. Value: %i" % [(val2/122.88).round, val2]
  end

6415/80.97 = 79.226874150920093861924169445474; //seems to correlate quite well with WicReset prior value, but not reink 9827/80 = 122.8375; // close to reink value (hex did not change since last time)

So now that I have this (at least I think I have these) values how do I use them?

Very curious, with my limited understand it looks like wicreset also reads OE16 OF16 and 1016 and 1116, but it also seems to read 3C16.

EDIT: Well I just reset the for 1016, 1116, 0E10, 0F16 again, values were at 0 and after test page print one counter was set to 1.6% and after a head cleaning moved to 3.23%.... normal? I don't know enough . I wonder if I didn't turn off the printer fast enough last time or that reink maybe needs to reset some other values