Merge pull request #156 from vitormhenrique/dev

Dev
This commit was merged in pull request #156.
This commit is contained in:
Vitor de Miranda Henrique
2018-06-19 23:16:32 -05:00
committed by GitHub
8 changed files with 3403 additions and 3403 deletions

View File

@@ -1,21 +1,21 @@
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add screenshots of your settings screen, so I know how to recreate the data. Also enable the debug information under the advanced section of the plugin, reproduce the issue and attach the [octoprint log](https://discourse.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) here.
---
name: Bug report
about: Create a report to help us improve
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Additional context**
Add screenshots of your settings screen, so I know how to recreate the data. Also enable the debug information under the advanced section of the plugin, reproduce the issue and attach the [octoprint log](https://discourse.octoprint.org/t/where-can-i-find-octoprints-and-octopis-log-files/299) here.

View File

@@ -1,17 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
---
name: Feature request
about: Suggest an idea for this project
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

File diff suppressed because it is too large Load Diff

View File

@@ -1,30 +1,30 @@
from neopixel import *
import sys
import time
LED_INVERT = False
LED_FREQ_HZ = 800000
if len(sys.argv) == 8:
LED_PIN = int(sys.argv[1])
LED_COUNT = int(sys.argv[2])
LED_BRIGHTNESS = int(sys.argv[3])
red = int(sys.argv[4])
green = int(sys.argv[5])
blue = int(sys.argv[6])
LED_DMA = int(sys.argv[7], 16)
else:
print("fail")
sys.exit(1)
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT)
strip.begin()
color = Color(green, red, blue)
for i in range(LED_COUNT):
strip.setPixelColor(i, color)
strip.show()
print("ok")
from neopixel import *
import sys
import time
LED_INVERT = False
LED_FREQ_HZ = 800000
if len(sys.argv) == 8:
LED_PIN = int(sys.argv[1])
LED_COUNT = int(sys.argv[2])
LED_BRIGHTNESS = int(sys.argv[3])
red = int(sys.argv[4])
green = int(sys.argv[5])
blue = int(sys.argv[6])
LED_DMA = int(sys.argv[7], 16)
else:
print("fail")
sys.exit(1)
strip = Adafruit_NeoPixel(LED_COUNT, LED_PIN, LED_FREQ_HZ, LED_DMA, LED_INVERT)
strip.begin()
color = Color(green, red, blue)
for i in range(LED_COUNT):
strip.setPixelColor(i, color)
strip.show()
print("ok")

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,48 +1,48 @@
import ctypes
import struct
import sys
import smbus
def main():
# Get bus address if provided or use default address
address = 0x48
if len(sys.argv) >= 2:
address = int(sys.argv[1], 0)
if not 0x48 <= address <= 0x4b:
raise ValueError("Invalid address value")
# Connect to I2C bus (use 0 on original Raspberry Pi, 1 on later models)
bus = smbus.SMBus(1)
# Set pointer to the temperature register
bus.write_byte(address, 0)
# Read two byte value
temp = bus.read_word_data(address, 0)
# Disconnect from bus
bus.close()
# Byte swap
temp = struct.unpack(">H", struct.pack("<H", temp))[0]
# Shift
temp = temp >> 4
# Convert to 2 byte twos compliment negative if negative
if ((temp & 0x800) != 0):
temp |= 0xF800
# Convert into a signed number
temp = ctypes.c_short(temp).value
# Divide by 16 to get value in celsius
temp /= 16.0
print('{0:0.1f}'.format(temp))
if __name__ == "__main__":
main()
import ctypes
import struct
import sys
import smbus
def main():
# Get bus address if provided or use default address
address = 0x48
if len(sys.argv) >= 2:
address = int(sys.argv[1], 0)
if not 0x48 <= address <= 0x4b:
raise ValueError("Invalid address value")
# Connect to I2C bus (use 0 on original Raspberry Pi, 1 on later models)
bus = smbus.SMBus(1)
# Set pointer to the temperature register
bus.write_byte(address, 0)
# Read two byte value
temp = bus.read_word_data(address, 0)
# Disconnect from bus
bus.close()
# Byte swap
temp = struct.unpack(">H", struct.pack("<H", temp))[0]
# Shift
temp = temp >> 4
# Convert to 2 byte twos compliment negative if negative
if ((temp & 0x800) != 0):
temp |= 0xF800
# Convert into a signed number
temp = ctypes.c_short(temp).value
# Divide by 16 to get value in celsius
temp /= 16.0
print('{0:0.1f}'.format(temp))
if __name__ == "__main__":
main()

198
setup.py
View File

@@ -1,99 +1,99 @@
# coding=utf-8
########################################################################################################################
### Do not forget to adjust the following variables to your own plugin.
# The plugin's identifier, has to be unique
plugin_identifier = "enclosure"
# The plugin's python package, should be "octoprint_<plugin identifier>", has to be unique
plugin_package = "octoprint_enclosure"
# The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the
# plugin module
plugin_name = "OctoPrint-Enclosure"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "4.09"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
plugin_description = "Awesome plugin to control everything that you ever wanted on your enclosure"
# The plugin's author. Can be overwritten within OctoPrint's internal data via __plugin_author__ in the plugin module
plugin_author = "Vitor Henrique"
# The plugin's author's mail address.
plugin_author_email = "vitormhenrique@gmail.com"
# The plugin's homepage URL. Can be overwritten within OctoPrint's internal data via __plugin_url__ in the plugin module
plugin_url = "https://github.com/vitormhenrique/OctoPrint-Enclosure"
# The plugin's license. Can be overwritten within OctoPrint's internal data via __plugin_license__ in the plugin module
plugin_license = "AGPLv3"
# Any additional requirements besides OctoPrint should be listed here
plugin_requires = ["RPi.GPIO>=0.6","requests>=2.7"]
additional_setup_parameters = {}
#additional_setup_parameters = {"dependency_links": ["git://github.com/adafruit/Adafruit_Python_DHT.git#egg=adafruit_python_dht"]}
#install_requires = requirements("requirements.txt")
### --------------------------------------------------------------------------------------------------------------------
### More advanced options that you usually shouldn't have to touch follow after this point
### --------------------------------------------------------------------------------------------------------------------
# Additional package data to install for this plugin. The subfolders "templates", "static" and "translations" will
# already be installed automatically if they exist.
plugin_additional_data = []
# Any additional python packages you need to install with your plugin that are not contains in <plugin_package>.*
plugin_addtional_packages = []
# Any python packages within <plugin_package>.* you do NOT want to install with your plugin
plugin_ignored_packages = []
# Additional parameters for the call to setuptools.setup. If your plugin wants to register additional entry points,
# define dependency links or other things like that, this is the place to go. Will be merged recursively with the
# default setup parameters as provided by octoprint_setuptools.create_plugin_setup_parameters using
# octoprint.util.dict_merge.
#
# Example:
# plugin_requires = ["someDependency==dev"]
# additional_setup_parameters = {"dependency_links": ["https://github.com/someUser/someRepo/archive/master.zip#egg=someDependency-dev"]}
########################################################################################################################
from setuptools import setup
try:
import octoprint_setuptools
except:
print("Could not import OctoPrint's setuptools, are you sure you are running that under "
"the same python installation that OctoPrint is installed under?")
import sys
sys.exit(-1)
setup_parameters = octoprint_setuptools.create_plugin_setup_parameters(
identifier=plugin_identifier,
package=plugin_package,
name=plugin_name,
version=plugin_version,
description=plugin_description,
author=plugin_author,
mail=plugin_author_email,
url=plugin_url,
license=plugin_license,
requires=plugin_requires,
additional_packages=plugin_addtional_packages,
ignored_packages=plugin_ignored_packages,
additional_data=plugin_additional_data
)
if len(additional_setup_parameters):
from octoprint.util import dict_merge
setup_parameters = dict_merge(setup_parameters, additional_setup_parameters)
setup(**setup_parameters)
# coding=utf-8
########################################################################################################################
### Do not forget to adjust the following variables to your own plugin.
# The plugin's identifier, has to be unique
plugin_identifier = "enclosure"
# The plugin's python package, should be "octoprint_<plugin identifier>", has to be unique
plugin_package = "octoprint_enclosure"
# The plugin's human readable name. Can be overwritten within OctoPrint's internal data via __plugin_name__ in the
# plugin module
plugin_name = "OctoPrint-Enclosure"
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
plugin_version = "4.10"
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
# module
plugin_description = "Awesome plugin to control everything that you ever wanted on your enclosure"
# The plugin's author. Can be overwritten within OctoPrint's internal data via __plugin_author__ in the plugin module
plugin_author = "Vitor Henrique"
# The plugin's author's mail address.
plugin_author_email = "vitormhenrique@gmail.com"
# The plugin's homepage URL. Can be overwritten within OctoPrint's internal data via __plugin_url__ in the plugin module
plugin_url = "https://github.com/vitormhenrique/OctoPrint-Enclosure"
# The plugin's license. Can be overwritten within OctoPrint's internal data via __plugin_license__ in the plugin module
plugin_license = "AGPLv3"
# Any additional requirements besides OctoPrint should be listed here
plugin_requires = ["RPi.GPIO>=0.6","requests>=2.7"]
additional_setup_parameters = {}
#additional_setup_parameters = {"dependency_links": ["git://github.com/adafruit/Adafruit_Python_DHT.git#egg=adafruit_python_dht"]}
#install_requires = requirements("requirements.txt")
### --------------------------------------------------------------------------------------------------------------------
### More advanced options that you usually shouldn't have to touch follow after this point
### --------------------------------------------------------------------------------------------------------------------
# Additional package data to install for this plugin. The subfolders "templates", "static" and "translations" will
# already be installed automatically if they exist.
plugin_additional_data = []
# Any additional python packages you need to install with your plugin that are not contains in <plugin_package>.*
plugin_addtional_packages = []
# Any python packages within <plugin_package>.* you do NOT want to install with your plugin
plugin_ignored_packages = []
# Additional parameters for the call to setuptools.setup. If your plugin wants to register additional entry points,
# define dependency links or other things like that, this is the place to go. Will be merged recursively with the
# default setup parameters as provided by octoprint_setuptools.create_plugin_setup_parameters using
# octoprint.util.dict_merge.
#
# Example:
# plugin_requires = ["someDependency==dev"]
# additional_setup_parameters = {"dependency_links": ["https://github.com/someUser/someRepo/archive/master.zip#egg=someDependency-dev"]}
########################################################################################################################
from setuptools import setup
try:
import octoprint_setuptools
except:
print("Could not import OctoPrint's setuptools, are you sure you are running that under "
"the same python installation that OctoPrint is installed under?")
import sys
sys.exit(-1)
setup_parameters = octoprint_setuptools.create_plugin_setup_parameters(
identifier=plugin_identifier,
package=plugin_package,
name=plugin_name,
version=plugin_version,
description=plugin_description,
author=plugin_author,
mail=plugin_author_email,
url=plugin_url,
license=plugin_license,
requires=plugin_requires,
additional_packages=plugin_addtional_packages,
ignored_packages=plugin_ignored_packages,
additional_data=plugin_additional_data
)
if len(additional_setup_parameters):
from octoprint.util import dict_merge
setup_parameters = dict_merge(setup_parameters, additional_setup_parameters)
setup(**setup_parameters)