dieki-n / Octoprint-Filament-Scale

48 stars 31 forks source link

Plugin creates heavy systemload #2

Open fabicodes opened 6 years ago

fabicodes commented 6 years ago

Under normal idle circumstances my Octoprint setup has the following loadaverage output load average: 0.02, 0.22, 0.26 After activating the plugin again the loadaverage output changes to load average: 0.68, 0.65, 0.52 This will result in an stuttering print for me, especially if there are a lot of curves.

Also the reading switches quite often from the actual reading to NaNg for like a second.

And there are some errors in my browsers console octopi.local-1536171335227.log

dieki-n commented 6 years ago

I have fixed the heavy systemload; the 3rd party library I was using to read the HX711 was hanging in a loop to wait for the HX711 to be ready. I rewrote it to instead wait asynchronously and performance should be vastly improved. You will have to uninstall/reinstall the plugin as the update URL on the original plugin was incorrect.

I am unable to reproduce the console errors or the reading switching to NaN. What browser are you using?

fabicodes commented 6 years ago

I'm using the latest Google Chrome on my Laptop and Chrome beta on my desktop which both gave me those not a number readings every now and then

dieki-n commented 6 years ago

Do the NaN readings seem to correspond with the console errors?

fabicodes commented 6 years ago

I am not really sure. Just tested it in Firefox though and I got the same console error and the same effect (it displays every now and then NaN).

Here is the error from the firefox console Error calling onDataUpdaterPluginMessage on view model Filament_scaleViewModel : Filament_scaleViewModel/self.getWeight@http://octopi.local/static/webassets/packed_plugins.js?f900ce94:799:31 Filament_scaleViewModel/self.onDataUpdaterPluginMessage@http://octopi.local/static/webassets/packed_plugins.js?f900ce94:794:21 callViewModelIf@http://octopi.local/static/webassets/packed_core.js?7fd71485:14020:17 callViewModelsIf/<@http://octopi.local/static/webassets/packed_core.js?7fd71485:13969:13 Pn@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11208:530 ur/<@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11229:66 callViewModelsIf@http://octopi.local/static/webassets/packed_core.js?7fd71485:13967:5 callViewModels@http://octopi.local/static/webassets/packed_core.js?7fd71485:13961:5 DataUpdater/self._onPluginMessage/<@http://octopi.local/static/webassets/packed_core.js?7fd71485:12733:13 DataUpdater/self._ifInitialized@http://octopi.local/static/webassets/packed_core.js?7fd71485:12751:13 DataUpdater/self._onPluginMessage@http://octopi.local/static/webassets/packed_core.js?7fd71485:12732:9 OctoPrintSocketClient.prototype.propagateMessage/<@http://octopi.local/static/webassets/packed_client.js?4a844250:388:17 Pn@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11208:530 ur/<@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11229:66 OctoPrintSocketClient.prototype.propagateMessage@http://octopi.local/static/webassets/packed_client.js?4a844250:387:13 onMessage/<@http://octopi.local/static/webassets/packed_client.js?4a844250:478:17 Zt/<@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11225:23 _t@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11213:392 Vt/<@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11224:369 ur/<@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:11229:73 onMessage@http://octopi.local/static/webassets/packed_client.js?4a844250:477:13 [5]</EventTarget.prototype.dispatchEvent@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:22527:5 [14]</</SockJS.prototype._transportMessage/<@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:23240:11 [14]</</SockJS.prototype._transportMessage@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:23238:9 [3]</EventEmitter.prototype.emit@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:22443:5 WebSocketTransport/this.ws.onmessage@http://octopi.local/static/webassets/packed_libs.js?331a1bb5:25314:5 2 packed_core.js:14033:13

dieki-n commented 6 years ago

Give the latest version another try, among other improvements I've made it put some diagnostic data in the console if it encounters a NaN.