Skip to content

Commit

Permalink
Merge pull request #280 from mrbeam/r_v0.1.31
Browse files Browse the repository at this point in the history
v0.1.31
  • Loading branch information
Gallore authored Apr 9, 2018
2 parents a787017 + 35ab76a commit ccf9a43
Show file tree
Hide file tree
Showing 15 changed files with 7,879 additions and 7,035 deletions.
4 changes: 2 additions & 2 deletions octoprint_mrbeam/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def get_settings_defaults(self):
precision = 0.05,
optimize_travel = True,
small_paths_first = True,
clip_working_area = False # this is due a bug in clipping. Would be great if we could fix it an enable it again.
clip_working_area = True # https://github.com/mrbeam/MrBeamPlugin/issues/134
),
)

Expand Down Expand Up @@ -1445,7 +1445,7 @@ def notify_frontend(self, title, text, type=None, sticky=False, replay_when_new_
Show a frontend notification to the user. (PNotify)
:param title: title of your mesasge
:param text: the actual text
:param type: inft, success, error, ... (default is info)
:param type: info, success, error, ... (default is info)
:param sticky: True | False (default is False)
:param replay_when_new_client_connects: If True the notification well be sent to all clients when a new client connects.
If you send the same notification (all params have identical values) it won't be sent again.
Expand Down
8 changes: 8 additions & 0 deletions octoprint_mrbeam/iobeam/lid_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,17 @@ def _capture(self):
except Exception as e:
if e.__class__.__name__.startswith('PiCamera'):
self._logger.error("PiCamera Error while capturing picture: %s: %s", e.__class__.__name__, e)
self.active = False
_mrbeam_plugin_implementation.notify_frontend(
title="Camera Error",
text="Please try the following:<br>- Close and reopen the lid<br>- Reboot the device and reload this page",
type='notice',
sticky=True,
replay_when_new_client_connects=True)
else:
self._logger.exception("Exception while taking picture from camera:")


def _createFolder_if_not_existing(self, filename):
try:
path = os.path.dirname(filename)
Expand Down
6 changes: 3 additions & 3 deletions octoprint_mrbeam/led_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class LedEventListener(CommandTrigger):
LED_EVENTS = {}
LED_EVENTS[Events.STARTUP] = "mrbeam_ledstrips_cli Startup"
# connect/disconnect to printer
LED_EVENTS[Events.CONNECTED] = "mrbeam_ledstrips_cli Connected"
LED_EVENTS[Events.DISCONNECTED] = "mrbeam_ledstrips_cli Disconnected"
# LED_EVENTS[Events.CONNECTED] = "mrbeam_ledstrips_cli Connected" # remove
# LED_EVENTS[Events.DISCONNECTED] = "mrbeam_ledstrips_cli Disconnected" # remove
# connect/disconnect by client
LED_EVENTS[Events.CLIENT_OPENED] = "mrbeam_ledstrips_cli ClientOpened"
LED_EVENTS[Events.CLIENT_CLOSED] = "mrbeam_ledstrips_cli ClientClosed"
Expand All @@ -36,7 +36,7 @@ class LedEventListener(CommandTrigger):


# File management
LED_EVENTS[Events.UPLOAD] = "mrbeam_ledstrips_cli Upload"
# LED_EVENTS[Events.UPLOAD] = "mrbeam_ledstrips_cli Upload"
# Slicing
LED_EVENTS[Events.SLICING_STARTED] = "mrbeam_ledstrips_cli SlicingStarted"
LED_EVENTS[Events.SLICING_DONE] = "mrbeam_ledstrips_cli SlicingDone"
Expand Down
12 changes: 12 additions & 0 deletions octoprint_mrbeam/software_update_information.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,18 @@ def set_info_netconnectd_plugin(self, tier):
pip="https://github.com/mrbeam/OctoPrint-Netconnectd/archive/{target_version}.zip",
restart="octoprint")

if tier in [SW_UPDATE_TIER_DEV]:
sw_update_config[module_id] = dict(
displayName=_get_display_name(self, name),
displayVersion=current_version,
type="github_commit",
user="mrbeam",
repo="OctoPrint-Netconnectd",
branch="develop",
branch_default="develop",
pip="https://github.com/mrbeam/OctoPrint-Netconnectd/archive/{target_version}.zip",
restart="octoprint")


def set_info_findmymrbeam(self, tier):
name = "OctoPrint-FindMyMrBeam"
Expand Down
183 changes: 135 additions & 48 deletions octoprint_mrbeam/static/js/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ $(function(){
name: 'Anodized Aluminum',
img: 'anodized_aluminum.jpg',
description: 'Dark anodized aluminum can be engraved. Works on iPhones.',
hints: 'Anodized aluminum turns brighter through laser engraving. Therefor the settings are inverted! Requires very precise focus.',
hints: 'Requires very precise focus. Anodized aluminum turns brighter through laser engraving. Therefor we suggest to invert photos for engravings.',
laser_type: 'MrBeamII-1.0',
colors: {
'000000': {
engrave: {eng_i:[100,0], eng_f:[30,1000], pierceTime: 0, dithering: false },
engrave: {eng_i:[0,100], eng_f:[1000, 30], pierceTime: 0, dithering: false },
cut: []
}
}
Expand Down Expand Up @@ -140,79 +140,145 @@ $(function(){
}
}
},
'Felt': {
'Felt': { // took settings from IHM fair
name: 'Felt',
img: 'felt.jpg',
description: 'Acrylic felt like the one sold in many arts and craft stores.',
hints: 'Be aware, natural felt is something different.',
hints: 'Be aware that natural felt is something else.',
safety_notes: '',
laser_type: 'MrBeamII-1.0',
colors: {
'00b000': {
name: 'green',
engrave: null, // not tested yet
cut: [
{thicknessMM: 4, cut_i:100, cut_f:225, cut_p:1}
]
},
'4dcaca': {
name: 'baby blue',
engrave: null, // not tested yet
'EB5A3E': {
name: 'orange',
engrave: {eng_i:[0,35], eng_f:[1600,1600], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:100, cut_p:5}
{thicknessMM: 3, cut_i:100, cut_f:550, cut_p:2}
]
},
'181866': {
name: 'royal blue',
engrave: null, // not tested yet
'F49A39': {
name: 'yellow',
engrave: {eng_i:[0,30], eng_f:[1200,1200], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:260, cut_p:2}
{thicknessMM: 3, cut_i:100, cut_f:625, cut_p:2}
]
},
'c98600': {
name: 'yellow',
engrave: null, // not tested yet
'293365': {
name: 'blue',
engrave: {eng_i:[0,35], eng_f:[1600,1600], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:260, cut_p:2}
{thicknessMM: 3, cut_i:100, cut_f:500, cut_p:2}
]
},
'eca100': {
name: 'sunny yellow',
engrave: null, // not tested yet
'322F33': {
name: 'black',
engrave: {eng_i:[0,30], eng_f:[1600,1600], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:225, cut_p:2}
{thicknessMM: 3, cut_i:100, cut_f:400, cut_p:2}
]
},
'550024': {
name: 'purple',
engrave: null, // not tested yet
'54392E': {
name: 'brown',
engrave: {eng_i:[0,30], eng_f:[1600,1600], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:375, cut_p:2}
{thicknessMM: 3, cut_i:100, cut_f:500, cut_p:2}
]
},
'393939': {
name: 'gray',
engrave: null, // not tested yet
'A21F25': {
name: 'dunkelrot',
engrave: {eng_i:[0,30], eng_f:[1600,1600], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:300, cut_p:2}
{thicknessMM: 3, cut_i:100, cut_f:550, cut_p:2}
]
},
'000000': {
name: 'black',
engrave: null, // not tested yet
'3E613E': {
name: 'green',
engrave: {eng_i:[0,30], eng_f:[1600,1600], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:300, cut_p:2}
{thicknessMM: 3, cut_i:100, cut_f:500, cut_p:2}
]
},
'e03800': {
name: 'orange',
engrave: null, // not tested yet
'D91F48': {
name: 'pink',
engrave: {eng_i:[0,40], eng_f:[1600,1600], pierceTime: 0, dithering: false },
cut: [
{thicknessMM: 4, cut_i:100, cut_f:375, cut_p:2}
{thicknessMM: 3, cut_i:100, cut_f:600, cut_p:2}
]
},
}
},
// 'Felt': { // old settings we had before IHM fair
// name: 'Felt',
// img: 'felt.jpg',
// description: 'Acrylic felt like the one sold in many arts and craft stores.',
// hints: 'Be aware, natural felt is something different.',
// safety_notes: '',
// laser_type: 'MrBeamII-1.0',
// colors: {
// '00b000': {
// name: 'green',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:225, cut_p:1}
// ]
// },
// '4dcaca': {
// name: 'baby blue',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:100, cut_p:5}
// ]
// },
// '181866': {
// name: 'royal blue',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:260, cut_p:2}
// ]
// },
// 'c98600': {
// name: 'yellow',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:260, cut_p:2}
// ]
// },
// 'eca100': {
// name: 'sunny yellow',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:225, cut_p:2}
// ]
// },
// '550024': {
// name: 'purple',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:375, cut_p:2}
// ]
// },
// '393939': {
// name: 'gray',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:300, cut_p:2}
// ]
// },
// '000000': {
// name: 'black',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:300, cut_p:2}
// ]
// },
// 'e03800': {
// name: 'orange',
// engrave: null, // not tested yet
// cut: [
// {thicknessMM: 4, cut_i:100, cut_f:375, cut_p:2}
// ]
// },
// }
// },
'Foam Rubber': {
name: 'Foam Rubber',
img: 'foam_rubber.jpg',
Expand Down Expand Up @@ -798,9 +864,11 @@ $(function(){

// vector icons dragged into engraving.
$('#colored_line_mapping input').each(function(i, el){
var hex = '#' +$(el).attr('id').substr(-6);
var brightness = self._get_brightness(hex);
var initial_factor = 1 - (brightness / 255);
var colorkey = $(el).attr('id').substr(-6);
var hex = '#' + colorkey;
var slider_id = '#adjuster_cd_color_' + colorkey;
var brightness = $(slider_id).val();
var initial_factor = brightness / 255;
var intensity_user = intensity_white_user + initial_factor * (intensity_black_user - intensity_white_user);
var intensity = Math.round(intensity_user * self.profile.currentProfileData().laser.intensity_factor());
var feedrate = Math.round(speed_white + initial_factor * (speed_black - speed_white));
Expand Down Expand Up @@ -959,13 +1027,32 @@ $(function(){
if(self.gcodeFilesToAppend !== undefined){
data.gcodeFilesToAppend = self.gcodeFilesToAppend;
}

var json = JSON.stringify(data);
var length = json.length;
console.log("Conversion: " + length + " bytes have to be converted.");
$.ajax({
url: "plugin/mrbeam/convert",
type: "POST",
dataType: "json",
contentType: "application/json; charset=UTF-8",
data: JSON.stringify(data)
data: json,
success: function (response) {
console.log("Conversion started.", response);
},
error: function ( jqXHR, textStatus, errorThrown) {
console.error("Conversion failed with status " + jqXHR.status, textStatus, errorThrown);
if(length > 10000000){
console.error("JSON size " + length + "Bytes may be over the request maximum.");
}
self.slicing_in_progress(false);
new PNotify({
title: gettext("Conversion failed"),
text: gettext("Unable to start the conversion in the backend. Content length was " + length + " bytes."),
type: "error",
tag: "conversion_error",
hide: false
});
}
});

});
Expand Down
Loading

0 comments on commit ccf9a43

Please sign in to comment.