Beispiel #1
0
	def iter(self):
		self.updateUptime()
		tcb = {
			'app uptime sec.': self.uptime,
			'app uptime nice': self.uptimeNice
			}
		if not self.iterCount % self.updateEvery:		
			if self.light['ok']:
				self.light['val'] = light.illumination
				tcb['lightLumens'] = self.light['val'] 
				self.gui.rl.ids.lSenLum.text = str(self.light['val'])
				
			if self.battery['ok']:
				self.battery['charging'] = battery.status['isCharging']
				tcb['batteryCharging'] = self.battery['charging']
				self.battery['percent'] = battery.status['percentage']
				tcb['batteryPercentage'] = battery.status['percentage']
				
				self.gui.rl.ids.lSenBatCha.text = str(self.battery['charging'])
				self.gui.rl.ids.lSenBatPer.text = str(self.battery['percent'])
				
			if self.backlight['ok']:
				self.backlight['current'] = brightness.current_level()
				tcb['bgLight'] = brightness.current_level()
				self.gui.rl.ids.lSenBacOrg.text = str(self.backlight['org'])
				self.gui.rl.ids.lSenBacCur.text = str(self.backlight['current'])
			
			for o in self.callBacksForUpdate:
				o.update(self.title, tcb)
				
		self.iterCount+= 1
Beispiel #2
0
    def initSensors(self):
        try:
            light.enable()
            self.light = {'ok': True, 'val': light.illumination}
            print("light Yes!")
        except Exception:
            print(traceback.format_exc())
            print("light NO")
            self.light['ok'] = False

        try:
            self.battery = {
                "ok": True,
                "charging": battery.status['isCharging'],
                "percent": battery.status['percentage']
            }
            print("battery Yes!")
        except Exception:
            print(traceback.format_exc())
            print("battery NO")
            self.battery['ok'] = False

        try:
            brig = brightness.current_level()
            self.backlight = {"ok": True, "org": brig, "current": brig}
            print("backlight Yes!")
        except Exception:
            print(traceback.format_exc())
            print("backlight NO")
            self.backlight['ok'] = False
Beispiel #3
0
    def iter(self):
        doGuiUpdate = True if self.gui.rl.current == "Sensors" else False

        self.updateUptime()
        tcb = {
            'app uptime sec.': self.uptime,
            'app uptime nice': self.uptimeNice
        }
        if not self.iterCount % self.updateEvery:
            if self.light['ok']:
                self.light['val'] = light.illumination
                tcb['lightLumens'] = self.light['val']

            if self.battery['ok']:
                self.battery['charging'] = battery.status['isCharging']
                tcb['batteryCharging'] = self.battery['charging']
                self.battery['percent'] = battery.status['percentage']
                tcb['batteryPercentage'] = battery.status['percentage']

            if self.backlight['ok']:
                brig = brightness.current_level()
                self.backlight['current'] = brig
                tcb['bgLight'] = brig

            #for o in self.callBacksForUpdate:
            #    o.update(self.title, tcb)
            self.broadcastCallBack(self.gui, self.title, tcb)

        self.iterCount += 1
Beispiel #4
0
 def get_current_brightness(self):
     return brightness.current_level()
Beispiel #5
0
 def get_current_brightness(self):
     return brightness.current_level()