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:
avollkopf 2021-12-02 14:48:39 +01:00
parent 2ebf9f3245
commit 80bdac45ce
4 changed files with 23 additions and 5 deletions

View file

@ -1 +1 @@
__version__ = "4.0.0.54"
__version__ = "4.0.0.55"

View 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"

View file

@ -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 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()

View file

@ -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: