toxuin / ESPRINTER

Duet web panel for ESP8266
36 stars 20 forks source link

Response to gcode commands is not displayed in gcode console #5

Open dc42 opened 8 years ago

dc42 commented 8 years ago

If a command is sent on the Gcode Console page, and that command returns a non-trivial response (e.g. M114, M119) then the response is not displayed.

To fix this, we need to capture and store the last non-json response received from the host, and have rr_reply return that response. We also need to indicate in the rr_status reply whether or not a new response is available, by adding the 'seq' variable and incrementing it every time a new non-json response (other than "OK") is received.

toxuin commented 8 years ago

this is not trivial to solve, but possible. Since Repetier firmware does not store last response and has little RAM - I did not add "seq" field to it. The only way (and the proper way) of doing this is to store the last gcode response on ESP8266 (which is already done) and somehow notify the web interface that the contents has changed (like a replacement to "seq" mechanics). I don't think it would be wize to gut the JSON response and add fields to it on the microcontroller. There is another way that involves little more coding: web interface currently has "compat mode" where it knows that it is not connected to a RepRapFirmware ( = Repetier currently). My point is - we could add a check to web interface that if it is in compat mode - don't look for "seq", just send rr_reply request over and over certain timeout. This was the plan to implement after transitioning to Duet Web Control 1.07 (which is happening in dwc107 branch). If you have another ideas how to make this work (properly :-D ) please let me know.

dc42 commented 8 years ago

A problem I can see with what you propose is that unless the web interface sends rr_reply requests very frequently, responses may be lost. They can already be lost if the host electronics generates responses faster than the polling interval. It seems much easier to me to patch the 'seq' field into the response from M408.