I ended up figuring out how to create the script on my own. I also added some additional functionality by providing parameters for min / max servo range values and also letting the user provide the pin value on the M42 command.
Hope this helps others that are trying to use a berdair or other servo type air source:
# Copyright (c) 2020 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. # Created by Wayne Porter from ..Script import Script class convertFantoServo(Script): def __init__(self): super().__init__() def getSettingDataString(self): return """{ "name": "Convert Fan to Servo", "key": "convertFantoServo", "metadata": {}, "version": 2, "settings": { "minServo": { "label": "Servo Min Travel Value.", "description": "Servo Min Travel Value.", "type": "str", "default_value": ".4" }, "maxServo": { "label": "Servo Max Travel Value.", "description": "Servo Max Travel Value.", "type": "str", "default_value": ".7" }, "servoPin": { "label": "Servo pin assigned in M42.", "description": "What pin on the controller board your servo is connected to.", "type": "str", "default_value": "8" } } }""" def execute(self, data): minServo = float(self.getSettingValueByKey("minServo")) maxServo = float(self.getSettingValueByKey("maxServo")) servoPin = self.getSettingValueByKey("servoPin") servoRange = maxServo - minServo conversionVal = 255 / round(servoRange, 3) for layer in data: # Check that a layer is being printed lines = layer.split("\n") for line in lines: if "M106" in line: index = data.index(layer) getFanval = line.replace("M106 S", "") check_fan_speed = (float(getFanval) / conversionVal) + minServo layer = "M42 P" + servoPin + " S" + str(round(check_fan_speed, 3)) + "\n" + layer data[index] = layer break return data
Edited by troyproffitt
Recommended Posts
troyproffitt 0
So if I was able to use the S value off the M106, the formula would be something like this:
(<fan_value>/850)+.4
So if M106 S255 , I'd like to add a row that said
M42 P8 S((255/850)+.4)
Link to post
Share on other sites