removed more unnecessary debug output
This commit is contained in:
@@ -14,13 +14,13 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import errno
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import errno
|
|
||||||
|
|
||||||
|
import smbus
|
||||||
from sqlalchemy import Column, Integer, String
|
from sqlalchemy import Column, Integer, String
|
||||||
from sqlalchemy.orm import relationship, reconstructor
|
from sqlalchemy.orm import relationship, reconstructor
|
||||||
import smbus
|
|
||||||
|
|
||||||
from . import Base
|
from . import Base
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ class Controller(Base):
|
|||||||
i2c_device = Column(Integer)
|
i2c_device = Column(Integer)
|
||||||
address = Column(String)
|
address = Column(String)
|
||||||
stripes = relationship("Stripe", backref="controller")
|
stripes = relationship("Stripe", backref="controller")
|
||||||
_pwm_freq = Column("pwm_freq", Integer)
|
pwm_freq = Column("pwm_freq", Integer)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
A controller controls a number of stripes.
|
A controller controls a number of stripes.
|
||||||
@@ -62,12 +62,14 @@ class Controller(Base):
|
|||||||
self._mode = None
|
self._mode = None
|
||||||
self.bus = smbus.SMBus(self.i2c_device)
|
self.bus = smbus.SMBus(self.i2c_device)
|
||||||
self._address = int(self.address, 16)
|
self._address = int(self.address, 16)
|
||||||
|
self._pwm_freq = self.pwm_freq
|
||||||
|
|
||||||
@reconstructor
|
@reconstructor
|
||||||
def init_on_load(self):
|
def init_on_load(self):
|
||||||
self._mode = None
|
self._mode = None
|
||||||
self.bus = smbus.SMBus(self.i2c_device)
|
self.bus = smbus.SMBus(self.i2c_device)
|
||||||
self._address = int(self.address, 16)
|
self._address = int(self.address, 16)
|
||||||
|
self._pwm_freq = self.pwm_freq
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Controller stripes={} cid={}>".format(len(self.stripes), self.id)
|
return "<Controller stripes={} cid={}>".format(len(self.stripes), self.id)
|
||||||
@@ -141,3 +143,6 @@ class Controller(Base):
|
|||||||
'i2c_device': self.i2c_device,
|
'i2c_device': self.i2c_device,
|
||||||
'mode': self.mode
|
'mode': self.mode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
self.bus.close()
|
||||||
|
@@ -14,26 +14,26 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import logging
|
|
||||||
import configparser
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import signal
|
import configparser
|
||||||
import errno
|
import errno
|
||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import signal
|
||||||
|
import sys
|
||||||
|
|
||||||
from sqlalchemy import create_engine
|
import spectra
|
||||||
from jsonrpc import JSONRPCResponseManager, dispatcher
|
from jsonrpc import JSONRPCResponseManager, dispatcher
|
||||||
from jsonrpc.exceptions import JSONRPCError, JSONRPCInvalidParams
|
from jsonrpc.exceptions import JSONRPCError, JSONRPCInvalidParams
|
||||||
import spectra
|
from sqlalchemy import create_engine
|
||||||
from sqlalchemy.exc import OperationalError
|
from sqlalchemy.exc import OperationalError
|
||||||
from sqlalchemy.orm.exc import NoResultFound
|
from sqlalchemy.orm.exc import NoResultFound
|
||||||
|
|
||||||
from ledd import VERSION
|
from ledd import VERSION
|
||||||
|
from ledd.controller import Controller
|
||||||
from ledd.effectstack import EffectStack
|
from ledd.effectstack import EffectStack
|
||||||
from ledd.models import Meta
|
from ledd.models import Meta
|
||||||
from ledd.stripe import Stripe
|
from ledd.stripe import Stripe
|
||||||
from ledd.controller import Controller
|
|
||||||
from . import Base, session
|
from . import Base, session
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
@@ -94,6 +94,10 @@ def run():
|
|||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
except (KeyboardInterrupt, SystemExit):
|
except (KeyboardInterrupt, SystemExit):
|
||||||
log.info("Exiting")
|
log.info("Exiting")
|
||||||
|
|
||||||
|
for c in controller:
|
||||||
|
c.close()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.remove("ledd.pid")
|
os.remove("ledd.pid")
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
@@ -138,6 +142,7 @@ def start_effect(**kwargs):
|
|||||||
"""
|
"""
|
||||||
Part of the Color API. Used to start a specific effect.
|
Part of the Color API. Used to start a specific effect.
|
||||||
Required parameters: stripe IDs: sids; effect id: eid, effect options: eopt
|
Required parameters: stripe IDs: sids; effect id: eid, effect options: eopt
|
||||||
|
:param kwargs:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if "sids" not in kwargs or "eid" not in kwargs or "eopt" not in kwargs:
|
if "sids" not in kwargs or "eid" not in kwargs or "eopt" not in kwargs:
|
||||||
|
@@ -1,3 +1,19 @@
|
|||||||
|
# LEDD Project
|
||||||
|
# Copyright (C) 2015 LEDD Team
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
from ledd.effects.fadeeffect import FadeEffect
|
from ledd.effects.fadeeffect import FadeEffect
|
||||||
|
Reference in New Issue
Block a user