mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-12-22 13:34:55 +01:00
some fixes for actor power
- Actor used to set power to 100 eventhough target was 0 - moved chromium.desktop file to config folder -> easier available for users and potential to enable chromium desktop via cbpi commandline in future
This commit is contained in:
parent
2ebf9f3245
commit
80bdac45ce
4 changed files with 23 additions and 5 deletions
|
@ -1 +1 @@
|
|||
__version__ = "4.0.0.54"
|
||||
__version__ = "4.0.0.55"
|
||||
|
|
6
cbpi/config/chromium.desktop
Normal file
6
cbpi/config/chromium.desktop
Normal file
|
@ -0,0 +1,6 @@
|
|||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Chromium
|
||||
Comment=Chromium Webbrowser
|
||||
NoDisplay=false
|
||||
Exec=chromium-browser --noerrordialogs --disable-session-crashed-bubble --disable-infobars --force-device-scale-factor=1.00 --start-fullscreen "http://localhost:8000"
|
|
@ -9,10 +9,15 @@ class ActorController(BasicController):
|
|||
self.update_key = "actorupdate"
|
||||
|
||||
async def on(self, id, power=None):
|
||||
logging.info("Controller_power: {}".format(power))
|
||||
try:
|
||||
item = self.find_by_id(id)
|
||||
if item.power:
|
||||
power = item.power
|
||||
if power is None:
|
||||
logging.info("Power is none")
|
||||
if item.power:
|
||||
power = item.power
|
||||
else:
|
||||
power = 100
|
||||
if item.instance.state is False:
|
||||
await item.instance.on(power)
|
||||
await self.push_udpate()
|
||||
|
|
|
@ -48,7 +48,7 @@ class GPIOActor(CBPiActor):
|
|||
return 0 if self.inverted == False else 1
|
||||
|
||||
async def on_start(self):
|
||||
self.power = 100
|
||||
self.power = None
|
||||
self.gpio = self.props.GPIO
|
||||
self.inverted = True if self.props.get("Inverted", "No") == "Yes" else False
|
||||
self.sampleTime = int(self.props.get("SamplingTime", 5))
|
||||
|
@ -59,6 +59,8 @@ class GPIOActor(CBPiActor):
|
|||
async def on(self, power = None):
|
||||
if power is not None:
|
||||
self.power = power
|
||||
else:
|
||||
self.power = 100
|
||||
await self.set_power(self.power)
|
||||
|
||||
logger.info("ACTOR %s ON - GPIO %s " % (self.id, self.gpio))
|
||||
|
@ -116,13 +118,18 @@ class GPIOPWMActor(CBPiActor):
|
|||
GPIO.setup(self.gpio, GPIO.OUT)
|
||||
GPIO.output(self.gpio, 0)
|
||||
self.state = False
|
||||
self.power = 100
|
||||
self.power = None
|
||||
self.p = None
|
||||
pass
|
||||
|
||||
async def on(self, power = None):
|
||||
logging.info("PWM Actor Power: {}".format(power))
|
||||
if power is not None:
|
||||
self.power = power
|
||||
else:
|
||||
self.power = 100
|
||||
|
||||
logging.info("PWM Final Power: {}".format(self.power))
|
||||
|
||||
logger.info("PWM ACTOR %s ON - GPIO %s - Frequency %s - Power %s" % (self.id, self.gpio,self.frequency,self.power))
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue