diff --git a/octoprint_mrbeam/analytics/usage_handler.py b/octoprint_mrbeam/analytics/usage_handler.py index 93b80ff4a..e10d3bbc9 100644 --- a/octoprint_mrbeam/analytics/usage_handler.py +++ b/octoprint_mrbeam/analytics/usage_handler.py @@ -375,7 +375,7 @@ def _get_job_time(self, usage_data): Returns: int: job time in seconds, -1 if it could not be found """ - if self.JOB_TIME_KEY not in usage_data: + if usage_data is None or self.JOB_TIME_KEY not in usage_data: self._logger.error( "No job time found in %s, returning 0 - %s", usage_data, @@ -410,6 +410,9 @@ def reset_prefilter_usage(self, serial): if serial is None: serial = self.UNKNOWN_SERIAL_KEY self._set_job_time([self.AIRFILTER_KEY, serial, self.PREFILTER_KEY], 0) + self._logger.info( + "Reset prefilter usage data from {}".format(self.get_prefilter_usage()) + ) self.start_time_prefilter = -1 self._write_usage_data() self.write_usage_analytics(action="reset_prefilter") @@ -430,6 +433,11 @@ def reset_carbon_filter_usage(self, serial): [self.AIRFILTER_KEY, serial, self.CARBON_FILTER_KEY], 0, ) + self._logger.info( + "Reset carbon filter usage data from {}".format( + self.get_carbon_filter_usage() + ) + ) self.start_time_prefilter = -1 self._write_usage_data() self.write_usage_analytics(action="reset_carbon_filter") @@ -447,12 +455,16 @@ def reset_laser_head_usage(self, serial): if serial is None: serial = self.UNKNOWN_SERIAL_KEY self._set_job_time([self.LASER_HEAD_KEY, serial], 0) + self._logger.info( + "Reset laser head usage data from {}".format(self.get_laser_head_usage()) + ) self.start_time_laser_head = -1 self._write_usage_data() self.write_usage_analytics(action="reset_laser_head") def reset_gantry_usage(self): self._set_job_time([self.GANTRY_KEY], 0) + self._logger.info("Reset gantry usage data {}".format(self.get_gantry_usage())) self.start_time_gantry = -1 self._write_usage_data() self.write_usage_analytics(action="reset_gantry") @@ -918,10 +930,13 @@ def _calculate_af2_filter_usage(self, filter_stage): else: stage_usage_time = 0 + if self._airfilter.get_lifespans(filter_stage): + lifespan = self._airfilter.get_lifespans(filter_stage)[0] + else: + lifespan = 0.1 # set to 0.1 as division by 0 will fail + # calculate the percentage - time_percentage = self._get_percentage_from_time( - stage_usage_time, self._airfilter.get_lifespans(filter_stage)[0] - ) + time_percentage = self._get_percentage_from_time(stage_usage_time, lifespan) # calculate the total percentage total_percentage = ( @@ -976,9 +991,9 @@ def _calculate_af3_filter_usage(self, filter_stage): ) # calculate the total percentage - total_percentage = max(pressure_percentage, time_percentage) + total_percentage = max(pressure_percentage, min(time_percentage, 80)) logger.debug( - "pressure_percentage: {} time_percentage: {} rpm_percentage: {} total percentag: {}".format( + "pressure_percentage: {} time_percentage: {} rpm_percentage: {} total percentage: {}".format( pressure_percentage, time_percentage, rpm_percentage, total_percentage ) ) diff --git a/octoprint_mrbeam/files/material_settings/materials.csv b/octoprint_mrbeam/files/material_settings/materials.csv index 2d52a7de5..3e0f771f3 100644 --- a/octoprint_mrbeam/files/material_settings/materials.csv +++ b/octoprint_mrbeam/files/material_settings/materials.csv @@ -461,6 +461,15 @@ MrB II Dreamcut x,,#54392e,Engrave,0-25,2000-2000,1,3,0,no, MrB II Dreamcut x,,#54392e,3,100,1500,1,3,0,no, MrB II Dreamcut x,,#d91f48,Engrave,0-40,1500-1500,1,3,0,no, MrB II Dreamcut x,,#d91f48,3,100,1500,1,3,0,no, +MrB II Dreamcut x,Glitter Felt,#000000,3,100,1600,1,3,0,no, +MrB II Dreamcut x,,#ff0000,3,100,1800,1,3,0,no, +MrB II Dreamcut x,,#0d48bb,3,100,1500,2,3,0,no, +MrB II Dreamcut x,,#8e8b98,3,100,500,2,3,0,no, +MrB II Dreamcut x,,#c2ae59,3,100,1300,1,3,0,no, +MrB II Dreamcut x,,#db97b7,3,100,500,3,3,0,no, +MrB II Dreamcut x,,#910786,3,100,1000,1,3,0,no, +MrB II Dreamcut x,,#b758ac,3,100,500,3,3,0,no, +MrB II Dreamcut x,,#ccc8d5,3,100,150,6,3,0,no, MrB II Dreamcut x,Finn Cardboard,#c7c97c,Engrave,0-60,2000-2000,1,3,0,no, MrB II Dreamcut x,,#c7c97c,"0,9",100,2000,2,3,0,no, MrB II Dreamcut x,,#c7c97c,"1,5",100,1500,2,3,0,no, diff --git a/octoprint_mrbeam/iobeam/airfilter.py b/octoprint_mrbeam/iobeam/airfilter.py index fb50357a3..dea10d11d 100644 --- a/octoprint_mrbeam/iobeam/airfilter.py +++ b/octoprint_mrbeam/iobeam/airfilter.py @@ -72,12 +72,12 @@ class AirFilter(object): (1880, 100), ] AF3_PRESSURE_GRAPH_PREFILTER = [ - (100, 0), - (300, 20), - (620, 40), - (800, 60), - (980, 80), - (1200, 100), + (70, 0), + (170, 20), + (300, 40), + (500, 60), + (700, 80), + (800, 100), ] AF3_RPM_GRAPH = [ (9860, 0), diff --git a/octoprint_mrbeam/iobeam/lid_handler.py b/octoprint_mrbeam/iobeam/lid_handler.py index 2df1507ff..cd2c7c48e 100644 --- a/octoprint_mrbeam/iobeam/lid_handler.py +++ b/octoprint_mrbeam/iobeam/lid_handler.py @@ -925,7 +925,7 @@ def serve_pictures( self._plugin.user_notification_system.show_notifications( self._plugin.user_notification_system.get_notification( "err_cam_conn_err", - error_code=ErrorCodes.E_1006, + err_code=ErrorCodes.E_1006, ) ) cam.async_capture() # starts capture with new settings diff --git a/octoprint_mrbeam/profiles/airfilter_system/airfilter_system_id_8.yaml b/octoprint_mrbeam/profiles/airfilter_system/airfilter_system_id_8.yaml index 9dec02d16..9022d94e3 100644 --- a/octoprint_mrbeam/profiles/airfilter_system/airfilter_system_id_8.yaml +++ b/octoprint_mrbeam/profiles/airfilter_system/airfilter_system_id_8.yaml @@ -2,7 +2,7 @@ prefilter_stages: 1 carbonfilter_stages: 1 prefilter: - - lifespan: 320 + - lifespan: 150 shopify_link: 'maintenance/af3/pf1' # no utm parameters needed, as the redirect already use these carbonfilter: - lifespan: 1120 diff --git a/octoprint_mrbeam/static/img/materials/Glitter-Felt.png b/octoprint_mrbeam/static/img/materials/Glitter-Felt.png new file mode 100644 index 000000000..1a8f05a1f Binary files /dev/null and b/octoprint_mrbeam/static/img/materials/Glitter-Felt.png differ diff --git a/octoprint_mrbeam/static/js/app/view-models/modal/material-settings.js b/octoprint_mrbeam/static/js/app/view-models/modal/material-settings.js index bba601b51..7fd84b4a4 100644 --- a/octoprint_mrbeam/static/js/app/view-models/modal/material-settings.js +++ b/octoprint_mrbeam/static/js/app/view-models/modal/material-settings.js @@ -170,7 +170,9 @@ $(function () { ), safety_notes: "", type: "collection", - url: gettext("https://www.mr-beam.org/en/collections/filz"), + url: gettext( + "https://www.mr-beam.org/en/collections/filz-schaumstoff" + ), }, "Fabric Cotton": null, "Fabric Polyester": null, @@ -480,6 +482,19 @@ $(function () { type: null, url: null, }, + "Glitter Felt": { + name: gettext("Glitter Felt"), + img: "Glitter-Felt.png", + description: "", + hints: "", + safety_notes: gettext( + "Please mirror your file and only cut from the back so that the reflective side is facing down! Reflective materials that are lasered from the front can damage the laser lens!" + ), + type: "product", + url: gettext( + "https://www.mr-beam.org/en/products/mr-beam-glitzer-acryl-filz" + ), + }, }; ///// EDIT MATERIAL SETTINGS ABOVE THIS LINE ////////` diff --git a/tests/analytics/test_usage_handler.py b/tests/analytics/test_usage_handler.py index 9bc90eb4b..2270f7148 100644 --- a/tests/analytics/test_usage_handler.py +++ b/tests/analytics/test_usage_handler.py @@ -308,7 +308,7 @@ def test_prefilter_usage_af3(usage_handler, mrbeam_plugin): usage = usage_handler.get_prefilter_usage() # Assert - assert usage == 48 + assert usage == 80 # test set pressure @@ -430,7 +430,7 @@ def test_set_fan_test_rpm(usage_handler, mrbeam_plugin): "graph, value, expected", [ (AirFilter.AF3_PRESSURE_GRAPH_CARBON_FILTER, 900, 25), - (AirFilter.AF3_PRESSURE_GRAPH_PREFILTER, 700, 48), + (AirFilter.AF3_PRESSURE_GRAPH_PREFILTER, 700, 80), (AirFilter.AF3_RPM_GRAPH, 9870, 5), ], ) diff --git a/tests/iobeam/test_airfilter.py b/tests/iobeam/test_airfilter.py index 9eed00cab..287d66f36 100644 --- a/tests/iobeam/test_airfilter.py +++ b/tests/iobeam/test_airfilter.py @@ -273,7 +273,7 @@ def test_profile_for_airfilter_8(air_filter): "carbonfilter_stages": 1, "prefilter": [ { - "lifespan": 320, + "lifespan": 150, "shopify_link": "maintenance/af3/pf1", }, ], @@ -333,7 +333,7 @@ def test_get_lifespan_for_airfilter_1_carbonfilter(air_filter): (3, 40), (4, 40), (5, 40), - (8, 320), + (8, 150), (None, 40), ], ) @@ -356,7 +356,7 @@ def test_get_lifespan_for_prefilter(model_id, expected_lifespan, air_filter): (3, [80]), (4, [80]), (5, [40]), - (8, [320]), + (8, [150]), (None, [40]), ], ) @@ -436,7 +436,7 @@ def test_get_list_of_lifespans_for_prefilter(air_filter, mrbeam_plugin): lifespan = air_filter.get_lifespans("prefilter") # Assert - assert lifespan == [320] + assert lifespan == [150] def test_get_list_of_lifespans_for_carbonfilter(air_filter, mrbeam_plugin):