Skip to content

Commit

Permalink
SW-3812 Frontend - Refresh the web page if the laser cutter mode flips (
Browse files Browse the repository at this point in the history
#1814)

* SW-3833 fix 1027 error (#1798)

* improve error handling for fan pcb
* only report hardware malfunction for fan stuff once and don't flood the log
* dimiss notifications
* don't cancel laser job on fan not spinning error only pause it
and only report the errors if they appear outside the boot grace periode

* SW-3537 fix laserhead none will crash plugin (#1800)

* prevent recursive log calls
* fix race condition for failing test

* SW-3537 improve recursive log prevention (#1801)

improve recursive log prevention

* SW-3833 fix bug in logic (#1802)

* SW-3915 fix final dust extraction phase 1 not working (#1808)

* SW-3291 Quick text fonts are not loaded causing bounding box discrepancies (#1806)

* SW-3291 Update cluster if it includes quickText elements

* SW-3291 Refactor url2png and redraw canvas if url contains quickText elements

* SW-3291 Refactor render-fills.js

* SW-3291 Handle caught error

* SW-3291 Add quickText font load timeout as a constant

* SW-3291 Add includesQuickText parameter to all generatePNGFromURL methods used on QuickText elements

* SW-3291 Add log messages on draw and clear canvas

* SW-3291 Fix comments

* SW-3291 Fix comments

* SW-3291 Fix unneeded log variable

* SW-3291 Add to analytics on issue detection

* Revert "SW-3291 Add to analytics on issue detection"

This reverts commit 45d1610.

* SW-3291 Add Todo comment

* SW-3291 Fix typo

* First version

* Revert "Merge branch 'alpha' into SW-3812-frontend-refresh-the-web-page-if-the-laser-cutter-mode-flips"

This reverts commit 1a8688a, reversing
changes made to e26217b.

* Switch to using laser cutter mode string instead of id

* Fix log

---------

Co-authored-by: Josef-MrBeam <[email protected]>
Co-authored-by: khaledsherkawi <[email protected]>
  • Loading branch information
3 people authored Oct 6, 2023
1 parent db245dc commit 7db5a75
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
4 changes: 3 additions & 1 deletion octoprint_mrbeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2677,7 +2677,9 @@ def on_event(self, event, payload):
self.fire_event(
MrBeamEvents.MRB_PLUGIN_VERSION,
payload=dict(
version=self._plugin_version, is_first_run=self.isFirstRun()
version=self._plugin_version,
is_first_run=self.isFirstRun(),
laser_cutter_mode=self.get_laser_cutter_mode()
),
)

Expand Down
14 changes: 14 additions & 0 deletions octoprint_mrbeam/static/js/app/view-models/mother.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,13 @@ $(function () {
self.onEventMrbPluginVersion = function (payload) {
if (
payload?.version ||
payload?.laser_cutter_mode ||
payload?.is_first_run ||
payload?.mrb_state?.laser_model
) {
self.force_reload_if_required(
payload["version"],
payload["laser_cutter_mode"],
payload["is_first_run"],
payload["mrb_state"]["laser_model"]
);
Expand Down Expand Up @@ -485,11 +487,13 @@ $(function () {
* This happens sometimes after a software update or if the user used a reset stick
* @private
* @param backend_version (optional) If no version is given the function reads it from self.settings
* @param backendLaserCutterMode (optional) If no laser_cutter_mode flag is given the function reads it from self.settings
* @param isFirstRun (optional) If no firstRun flag is given the function reads it from self.settings
* @param laserHeadModel (optional) If no laserHeadModel flag is given the function reads it from self.settings
*/
self.force_reload_if_required = function (
backend_version,
backendLaserCutterMode,
isFirstRun,
laserHeadModel
) {
Expand All @@ -499,6 +503,9 @@ $(function () {
backend_version = backend_version
? backend_version
: mrb_settings._version();
backendLaserCutterMode = backendLaserCutterMode
? backendLaserCutterMode
: "default"; // TODO: SW-3719 get real value from settings or leave it as default
isFirstRun = isFirstRun
? isFirstRun
: mrb_settings.isFirstRun();
Expand All @@ -510,6 +517,7 @@ $(function () {
}
if (
backend_version !== MRBEAM_PLUGIN_VERSION ||
backendLaserCutterMode !== LASER_CUTTER_MODE ||
isFirstRun !== CONFIG_FIRST_RUN ||
(laserHeadModel !== undefined &&
laserHeadModel !== MRBEAM_LASER_HEAD_MODEL)
Expand All @@ -527,6 +535,10 @@ $(function () {
MRBEAM_LASER_HEAD_MODEL +
", backend=" +
laserHeadModel +
", laserCutterMode: frontend=" +
LASER_CUTTER_MODE +
", backend=" +
backendLaserCutterMode +
")"
);
console.log("Reloading frontend...");
Expand All @@ -537,6 +549,8 @@ $(function () {
MRBEAM_PLUGIN_VERSION +
", isFirstRun: " +
CONFIG_FIRST_RUN +
", laserCutterMode: " +
LASER_CUTTER_MODE +
", laserheadModel: " +
MRBEAM_LASER_HEAD_MODEL +
")"
Expand Down
1 change: 1 addition & 0 deletions octoprint_mrbeam/templates/mrbeam_initscript.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
var MRBEAM_GRBL_VERSION = "{{ grbl_version }}";
var INIT_TS_MS = "{{ init_ts_ms }}";
var INITIAL_CALIBRATION = false;
let LASER_CUTTER_MODE = "default"; // TODO: SW-3719 get real value
window.mrbeam = {};
</script>

0 comments on commit 7db5a75

Please sign in to comment.