Print Progress Info not working



  • I just noticed that the print file / progress info is not working - at least when connected to RRF3.
    I started off with the latest standalone config default. The relevant values are commented out - but in any case do not reflect the structure returned by

    rr_status?type=3

    I was able to get elapsed time etc. working with code like this :

    "value": "${(state.status == 'P') ? DueUI.formatElapsed(state.printDuration) : \"00:00:00\"}",
    

    However current print file and the like are alluding me. It looks like Dueui.js has not yet implemented a call to

    rr_fileinfo?name=

    Specifically , I'm looking for the fileName - or is there some other way ?

    Thanks in advance



  • @stuartofmt Hmmm. They should be working. I'll take a look.



  • As a "quick and dirty" i.e. not sure you would want to do it this way ....

    I inserted this to dueui.js at line 1358

    resp = await super.getJSON("/rr_fileinfo?name=");
    if (resp.ok) {
         $.extend(true, this.model, resp.data);
    }
    

    And use this in my config file to display the current print job name

    "value": "Current/Last File:     ${(state.status == 'P') ? state.fileName.substring(10) : 'Not Printing'}",
    


  • @stuartofmt The currently printing file name should be in the object model already. So does state.job.file.fileName not work?



  • No - state.job.file.fileName gives an error (see below).

    Note that there is no job element returned by the rr_status?type=XXX series of calls (see attached for type=3)

    Possible changes in DWC ? I'm using V3.1.1

    Capture.PNG

    status3.json



  • @stuartofmt Run this CGI from your web browser instead of rr_status...
    http://<duet>/rr_model?flags=fnd10

    That should return the full model.



  • @gtj0 said in Print Progress Info not working:

    http://<duet>/rr_model?flags=fnd10

    There does not seem to be such a call anywhere in Dueui.js - is it elsewhere?
    EDIT: Just realized that this just returns the schema.

    From the browser (recent chrome) attached is what I get.

    In any case - there is no element for job.file, let alone job.file.fileName.
    There are only two elements with "file" in the name but neither of them is a string but neither is what we are looking for.

    flags.json



  • @stuartofmt dueui.json should never have to do any retrieval itself. dueui.js polls the Duet at the interval you set in settings using the "rr_model" call and keeps the top-level "state" object up to date. That being said, it does look like the model is incomplete so let me look at 3.1.1 and see what the deal is.



  • @gtj0

    Yes - my reference to Dueui.json was a typo - I meant Dueui.js.
    A disclaimer - my knowledge of java and js is barely one step above zero and short even of being a novice ( I even get the spelling of file extensions wrong 🙂 )

    The Dueui.js in the version I downloaded (I believe it is the latest) has this as the relevant code (If I am interpreting correctly)

    	async connect_once(url) {
    		let resp = {};
    		if (this.connected) {
    			resp.ok = true;
    			return resp;
    		}
    		try {
    			resp = await super.getJSON(`/rr_connect?password=${ encodeURI(this.settings.duet_password) }`);
    			if (!resp.ok) {
    				return resp;
    			}
    			resp = await super.getJSON("/rr_status?type=1");
    			if (resp.ok) {
    				$.extend(true, this.model, resp.data);
    			}
    			resp = await super.getJSON("/rr_status?type=3");
    			if (resp.ok) {
    				$.extend(true, this.model, resp.data);
    			}
    			return resp;
    		} catch(error) {
    			console.log(error);
    			resp.error = error;
    			resp.ok = false;
    		}
    		return resp;
    	}
    

    I will double check but it seems like the call /rr_status?type=1 may be redundant as all the info looks to be included in /rr_status?type=3

    I added this your Dueui.js as an additional call to get the filename

    			resp = await super.getJSON("/rr_fileinfo?name=");
    			if (resp.ok) {
    				$.extend(true, this.model, resp.data);
    			}
    

    Hope this helps - I realize this is not your day job 🙂



  • @stuartofmt OK, I'm an idiot. I'm looking at code I hadn't pushed up yet. The day job is killing me this week but I promise I'll have everything corrected and pushed up by Sunday.



  • @gtj0

    Don't rush on my behalf. I have got most everything working. I just did not want to go too far down a path that may end up being incompatible with your base code.

    Again - Thanks for a terrific enhancement to the Duet world!

    P.S. I posted my efforts in the configuration thread. Unfortunately this was before I noticed that the print info was not coming through. I will have a V3 shortly but did not want it to have to rely on my mods to dueui.js.

    P.P.S. I have a couple of other suggestions / observations that I will put in separate threads tomorrow,



  • I can confirm that type=3 is a superset of type=1 - so it does indeed look like type=1 may be redundant (in the context of Dueui)
    I suspect that the object model has evolved over time and is now more structured / consistent.



  • Still working on stuff. Wll be Monday before teh next release.



  • Things should be working much better now. Give the new release a try.


Log in to reply