Skip to content

Commit

Permalink
Merge pull request shbatm#2 from dushyantahuja/master
Browse files Browse the repository at this point in the history
New Variable - showOnlyWhilePrinting
  • Loading branch information
DongerZonie authored Oct 8, 2019
2 parents 5a7bb9d + 61bfb34 commit c879e65
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,10 @@ To use this module, add it to the modules array in the `config/config.js` file:
| `showDetailsWhenOffline` | *Optional* Whether or not to hide the printer details when the printer is offline (file name, time, temps)
| `interactive` | *Optional* Allow interactive control of the printer: choose files to print and upload new files. <br> *Default:* `true`. Set to `false` to hide the drop downs, if you don't use the Mirror to control anything.
| `debugMode` | *Optional* Prints all messages received from the printer socket to the console log, for debugging only and developing more features.
| `showOnlyWhilePrinting`| *Optional* Set to true so that the modules gets hidden when the printer is not printing. *Default:* `false`

## Development and Feature Requests

* If you have any feature requests or find any bugs, please post about it on the [MagicMirror Forum](https://forum.magicmirror.builders) or open an Issue on this repo.
* This module exposes the full client API for an OctoPrint instance and only displays the info that is useful to me at the moment, if there is something else you would like added, please let me know. The API is here:
- http://docs.octoprint.org/en/master/api/push.html
- http://docs.octoprint.org/en/master/api/push.html
10 changes: 9 additions & 1 deletion octomirror-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Module.register("octomirror-module", {
showDetailsWhenOffline: true,
interactive: true, // Set to false to hide the file drop down and only show the stream.
debugMode: false, // Set to true to log all messages from OctoPrint Socket
showOnlyWhilePrinting: false,
},

//Override dom generator.
Expand Down Expand Up @@ -239,6 +240,13 @@ Module.register("octomirror-module", {
$("#opBedTemp")[0].innerHTML = (temps.bed.actual) ? temps.bed.actual.round10(1) + "&deg;C" : "N/A";
$("#opBedTempTgt")[0].innerHTML = (temps.bed.target) ? Math.round(temps.bed.target) + "&deg;C" : "N/A";
}

if (data.state.text != "Printing" & this.config.showOnlyWhilePrinting){
this.hide();
}
else {
this.show();
}
},

notificationReceived: function(notification, payload, sender) {
Expand Down Expand Up @@ -278,4 +286,4 @@ Number.prototype.round10 = function(precision) {
var tempNumber = this * factor;
var roundedTempNumber = Math.round(tempNumber);
return roundedTempNumber / factor;
};
};

0 comments on commit c879e65

Please sign in to comment.