Closed dnewman-polar3d closed 7 years ago
Hmmm... my GPX printer sends 13 ok. But it takes longer than I expect for it to show the connect button. It does send a status, then a getUrl and the getUrl, I think doesn't have a status in it. Maybe that nukes it to 0 until the next status?
The getUrl will not impact the status. Indeed, it causes no update of any form to the database. HOWEVER, I've seen some cases where the status update was sent right on the heels of the hello. As the hello had not completed processing, the status update was ignored, the socket not yet being validated but the connection established less than 60s in the past (and thus within the grace period).
Indeed, regarding the cases of a status being sent on the heels of a hello: I'd delay a few seconds (e.g., 5s) between sending the hello and then sending anything else. (5s is likely more than needed.) Point being that the hello involves a db lookup and since this is Node.js, it'll get put aside while other commands are accepted. If a status comes in too soon, before the hello command has completed all of its processing, that status command is summarily ignored.
I can now confirm that on the plugin starting up, I see in the octoprint log
So the status was sent before the hello! At any rate, it was ignored by the cloud and so the status was not updated. What shows in the cloud is whatever was still in the db from the last connection that successfully sent a status (after validation).
Then eventually a status 13 is again sent so the CONNECT button does eventually appear.
If there is an item in the printer's queue, the CONNECT button works. Owing to a bug in the web server's SPA code, if there is nothing queued, clicking CONNECT does not work (error displayed in javascript console). This is fixed and will be deployed this evening.
NOW, I notice that when I click CONNECT, the printer receives it. But its next status update is a 12. That causes the polar cloud to think there's an error. But then the next status from the plugin is then a 0 which means all is A-Okay and the printer is idle.
I believe this is fixed by dd1446e6
Looks like a status of 0 is being sent when USB is not connected and using the GPX plugin. This is what is appearing in the db,